1 [http://mupen64plus.retrouprising.com Project page]
4 /* ----------------------------------------- */
5 /* Platform-specific stuff */
6 /* ----------------------------------------- */
8 /* necessary headers */
13 /* DLL handles and function declaration specifiers */
15 #define IMPORT extern "C" __declspec(dllimport)
16 #define EXPORT __declspec(dllexport)
18 typedef HMODULE m64p_dynlib_handle;
20 #define IMPORT extern "C"
21 #define EXPORT __attribute__((visibility("default")))
23 typedef void * m64p_dynlib_handle;
26 /* ----------------------------------------- */
27 /* Structures and Types for Core library API */
28 /* ----------------------------------------- */
30 typedef void * m64p_handle;
32 typedef void (*m64p_frame_callback)(unsigned int FrameIndex);
33 typedef void (*m64p_input_callback)(void);
34 typedef void (*m64p_audio_callback)(void);
35 typedef void (*m64p_vi_callback)(void);
54 M64ERR_NOT_INIT, /* Function is disallowed before InitMupen64Plus() is called */
55 M64ERR_ALREADY_INIT, /* InitMupen64Plus() was called twice */
56 M64ERR_INCOMPATIBLE, /* API versions between components are incompatible */
57 M64ERR_INPUT_ASSERT, /* Invalid parameters for function call, such as ParamValue=NULL for GetCoreParameter() */
58 M64ERR_INPUT_INVALID, /* Invalid input data, such as ParamValue="maybe" for SetCoreParameter() to set a BOOL-type value */
59 M64ERR_INPUT_NOT_FOUND, /* The input parameter(s) specified a particular item which was not found */
60 M64ERR_NO_MEMORY, /* Memory allocation failed */
61 M64ERR_FILES, /* Error opening, creating, reading, or writing to a file */
62 M64ERR_INTERNAL, /* Internal error (bug) */
63 M64ERR_INVALID_STATE, /* Current program state does not allow operation */
64 M64ERR_PLUGIN_FAIL, /* A plugin function returned a fatal error */
65 M64ERR_SYSTEM_FAIL, /* A system function call, such as an SDL or file operation, failed */
66 M64ERR_UNSUPPORTED, /* Function call is not supported (ie, core not built with debugger) */
67 M64ERR_WRONG_TYPE /* A given input type parameter cannot be used for desired operation */
73 M64CAPS_CORE_COMPARE = 4
98 M64VIDEOFLAG_SUPPORT_RESIZING = 1
102 M64CORE_EMU_STATE = 1,
104 M64CORE_SAVESTATE_SLOT,
105 M64CORE_SPEED_FACTOR,
106 M64CORE_SPEED_LIMITER,
108 M64CORE_AUDIO_VOLUME,
110 M64CORE_INPUT_GAMESHARK,
111 M64CORE_STATE_LOADCOMPLETE,
112 M64CORE_STATE_SAVECOMPLETE
119 M64CMD_ROM_GET_HEADER,
120 M64CMD_ROM_GET_SETTINGS,
125 M64CMD_CORE_STATE_QUERY,
128 M64CMD_STATE_SET_SLOT,
129 M64CMD_SEND_SDL_KEYDOWN,
130 M64CMD_SEND_SDL_KEYUP,
131 M64CMD_SET_FRAME_CALLBACK,
132 M64CMD_TAKE_NEXT_SCREENSHOT,
133 M64CMD_CORE_STATE_SET,
140 unsigned int address;
144 /* ----------------------------------------- */
145 /* Structures to hold ROM image information */
146 /* ----------------------------------------- */
157 unsigned char init_PI_BSB_DOM1_LAT_REG; /* 0x00 */
158 unsigned char init_PI_BSB_DOM1_PGS_REG; /* 0x01 */
159 unsigned char init_PI_BSB_DOM1_PWD_REG; /* 0x02 */
160 unsigned char init_PI_BSB_DOM1_PGS_REG2; /* 0x03 */
161 unsigned int ClockRate; /* 0x04 */
162 unsigned int PC; /* 0x08 */
163 unsigned int Release; /* 0x0C */
164 unsigned int CRC1; /* 0x10 */
165 unsigned int CRC2; /* 0x14 */
166 unsigned int Unknown[2]; /* 0x18 */
167 unsigned char Name[20]; /* 0x20 */
168 unsigned int unknown; /* 0x34 */
169 unsigned int Manufacturer_ID; /* 0x38 */
170 unsigned short Cartridge_ID; /* 0x3C - Game serial number */
171 unsigned short Country_code; /* 0x3E */
178 unsigned char savetype;
179 unsigned char status; /* Rom status on a scale from 0-5. */
180 unsigned char players; /* Local players 0-4, 2/3/4 way Netplay indicated by 5/6/7. */
181 unsigned char rumble; /* 0 - No, 1 - Yes boolean for rumble support. */
184 /* ----------------------------------------- */
185 /* Structures and Types for the Debugger */
186 /* ----------------------------------------- */
189 M64P_DBG_RUN_STATE = 1,
190 M64P_DBG_PREVIOUS_PC,
191 M64P_DBG_NUM_BREAKPOINTS,
192 M64P_DBG_CPU_DYNACORE,
193 M64P_DBG_CPU_NEXT_INTERRUPT
197 M64P_DBG_MEM_TYPE = 1,
199 M64P_DBG_MEM_HAS_RECOMPILED,
200 M64P_DBG_MEM_NUM_RECOMPILED,
201 M64P_DBG_RECOMP_OPCODE = 16,
202 M64P_DBG_RECOMP_ARGS,
221 M64P_MEM_FLASHRAMSTAT,
229 M64P_MEM_FLAG_READABLE = 0x01,
230 M64P_MEM_FLAG_WRITABLE = 0x02,
231 M64P_MEM_FLAG_READABLE_EMUONLY = 0x04, // the EMUONLY flags signify that emulated code can read/write here, but debugger cannot
232 M64P_MEM_FLAG_WRITABLE_EMUONLY = 0x08
233 } m64p_dbg_mem_flags;
236 M64P_DBG_PTR_RDRAM = 1,
242 } m64p_dbg_memptr_type;
250 M64P_CPU_REG_COP1_DOUBLE_PTR,
251 M64P_CPU_REG_COP1_SIMPLE_PTR,
252 M64P_CPU_REG_COP1_FGR_64,
257 M64P_BKP_CMD_ADD_ADDR = 1,
258 M64P_BKP_CMD_ADD_STRUCT,
259 M64P_BKP_CMD_REPLACE,
260 M64P_BKP_CMD_REMOVE_ADDR,
261 M64P_BKP_CMD_REMOVE_IDX,
263 M64P_BKP_CMD_DISABLE,
265 } m64p_dbg_bkp_command;
267 #define M64P_MEM_INVALID 0xFFFFFFFF // invalid memory read will return this
269 #define BREAKPOINTS_MAX_NUMBER 128
271 #define BPT_FLAG_ENABLED 0x01
272 #define BPT_FLAG_CONDITIONAL 0x02
273 #define BPT_FLAG_COUNTER 0x04
274 #define BPT_FLAG_READ 0x08
275 #define BPT_FLAG_WRITE 0x10
276 #define BPT_FLAG_EXEC 0x20
277 #define BPT_FLAG_LOG 0x40 //Log to the console when this breakpoint hits.
279 #define BPT_CHECK_FLAG(a, b) ((a.flags & b) == b)
280 #define BPT_SET_FLAG(a, b) a.flags = (a.flags | b);
281 #define BPT_CLEAR_FLAG(a, b) a.flags = (a.flags & (~b));
282 #define BPT_TOGGLE_FLAG(a, b) a.flags = (a.flags ^ b);
284 typedef struct _breakpoint {
285 unsigned int address;
286 unsigned int endaddr;
288 //unsigned int condition; //Placeholder for breakpoint condition
291 /* ------------------------------------------------- */
292 /* Structures and Types for Core Video Extension API */
293 /* ------------------------------------------------- */
296 unsigned int uiWidth;
297 unsigned int uiHeight;
301 M64P_GL_DOUBLEBUFFER = 1,
308 M64P_GL_SWAP_CONTROL,
309 M64P_GL_MULTISAMPLEBUFFERS,
310 M64P_GL_MULTISAMPLESAMPLES
314 unsigned int Functions;
315 m64p_error (*VidExtFuncInit)(void);
316 m64p_error (*VidExtFuncQuit)(void);
317 m64p_error (*VidExtFuncListModes)(m64p_2d_size *, int *);
318 m64p_error (*VidExtFuncSetMode)(int, int, int, int, int);
319 void * (*VidExtFuncGLGetProc)(const char*);
320 m64p_error (*VidExtFuncGLSetAttr)(m64p_GLattr, int);
321 m64p_error (*VidExtFuncGLGetAttr)(m64p_GLattr, int *);
322 m64p_error (*VidExtFuncGLSwapBuf)(void);
323 m64p_error (*VidExtFuncSetCaption)(const char *);
324 m64p_error (*VidExtFuncToggleFS)(void);
325 m64p_error (*VidExtFuncResizeWindow)(int, int);
326 } m64p_video_extension_functions;