1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2 * Mupen64plus-core - m64p_types.h *
3 * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
4 * Copyright (C) 2012 CasualJames *
5 * Copyright (C) 2009 Richard Goedeken *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program; if not, write to the *
19 * Free Software Foundation, Inc., *
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
21 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
23 #if !defined(M64P_TYPES_H)
26 /* ----------------------------------------- */
27 /* Platform-specific stuff */
28 /* ----------------------------------------- */
30 /* necessary headers */
35 /* DLL handles and function declaration specifiers */
37 #define IMPORT extern "C" __declspec(dllimport)
38 #define EXPORT __declspec(dllexport)
40 typedef HMODULE m64p_dynlib_handle;
42 #define IMPORT extern "C"
43 #define EXPORT __attribute__((visibility("default")))
45 typedef void * m64p_dynlib_handle;
48 /* ----------------------------------------- */
49 /* Structures and Types for Core library API */
50 /* ----------------------------------------- */
52 typedef void * m64p_handle;
54 typedef void (*m64p_frame_callback)(unsigned int FrameIndex);
55 typedef void (*m64p_input_callback)(void);
56 typedef void (*m64p_audio_callback)(void);
57 typedef void (*m64p_vi_callback)(void);
76 M64ERR_NOT_INIT, /* Function is disallowed before InitMupen64Plus() is called */
77 M64ERR_ALREADY_INIT, /* InitMupen64Plus() was called twice */
78 M64ERR_INCOMPATIBLE, /* API versions between components are incompatible */
79 M64ERR_INPUT_ASSERT, /* Invalid parameters for function call, such as ParamValue=NULL for GetCoreParameter() */
80 M64ERR_INPUT_INVALID, /* Invalid input data, such as ParamValue="maybe" for SetCoreParameter() to set a BOOL-type value */
81 M64ERR_INPUT_NOT_FOUND, /* The input parameter(s) specified a particular item which was not found */
82 M64ERR_NO_MEMORY, /* Memory allocation failed */
83 M64ERR_FILES, /* Error opening, creating, reading, or writing to a file */
84 M64ERR_INTERNAL, /* Internal error (bug) */
85 M64ERR_INVALID_STATE, /* Current program state does not allow operation */
86 M64ERR_PLUGIN_FAIL, /* A plugin function returned a fatal error */
87 M64ERR_SYSTEM_FAIL, /* A system function call, such as an SDL or file operation, failed */
88 M64ERR_UNSUPPORTED, /* Function call is not supported (ie, core not built with debugger) */
89 M64ERR_WRONG_TYPE /* A given input type parameter cannot be used for desired operation */
95 M64CAPS_CORE_COMPARE = 4
120 M64VIDEOFLAG_SUPPORT_RESIZING = 1
124 M64CORE_EMU_STATE = 1,
126 M64CORE_SAVESTATE_SLOT,
127 M64CORE_SPEED_FACTOR,
128 M64CORE_SPEED_LIMITER,
130 M64CORE_AUDIO_VOLUME,
132 M64CORE_INPUT_GAMESHARK,
133 M64CORE_STATE_LOADCOMPLETE,
134 M64CORE_STATE_SAVECOMPLETE
141 M64CMD_ROM_GET_HEADER,
142 M64CMD_ROM_GET_SETTINGS,
147 M64CMD_CORE_STATE_QUERY,
150 M64CMD_STATE_SET_SLOT,
151 M64CMD_SEND_SDL_KEYDOWN,
152 M64CMD_SEND_SDL_KEYUP,
153 M64CMD_SET_FRAME_CALLBACK,
154 M64CMD_TAKE_NEXT_SCREENSHOT,
155 M64CMD_CORE_STATE_SET,
162 unsigned int address;
166 /* ----------------------------------------- */
167 /* Structures to hold ROM image information */
168 /* ----------------------------------------- */
179 unsigned char init_PI_BSB_DOM1_LAT_REG; /* 0x00 */
180 unsigned char init_PI_BSB_DOM1_PGS_REG; /* 0x01 */
181 unsigned char init_PI_BSB_DOM1_PWD_REG; /* 0x02 */
182 unsigned char init_PI_BSB_DOM1_PGS_REG2; /* 0x03 */
183 unsigned int ClockRate; /* 0x04 */
184 unsigned int PC; /* 0x08 */
185 unsigned int Release; /* 0x0C */
186 unsigned int CRC1; /* 0x10 */
187 unsigned int CRC2; /* 0x14 */
188 unsigned int Unknown[2]; /* 0x18 */
189 unsigned char Name[20]; /* 0x20 */
190 unsigned int unknown; /* 0x34 */
191 unsigned int Manufacturer_ID; /* 0x38 */
192 unsigned short Cartridge_ID; /* 0x3C - Game serial number */
193 unsigned short Country_code; /* 0x3E */
200 unsigned char savetype;
201 unsigned char status; /* Rom status on a scale from 0-5. */
202 unsigned char players; /* Local players 0-4, 2/3/4 way Netplay indicated by 5/6/7. */
203 unsigned char rumble; /* 0 - No, 1 - Yes boolean for rumble support. */
206 /* ----------------------------------------- */
207 /* Structures and Types for the Debugger */
208 /* ----------------------------------------- */
211 M64P_DBG_RUN_STATE = 1,
212 M64P_DBG_PREVIOUS_PC,
213 M64P_DBG_NUM_BREAKPOINTS,
214 M64P_DBG_CPU_DYNACORE,
215 M64P_DBG_CPU_NEXT_INTERRUPT
219 M64P_DBG_MEM_TYPE = 1,
221 M64P_DBG_MEM_HAS_RECOMPILED,
222 M64P_DBG_MEM_NUM_RECOMPILED,
223 M64P_DBG_RECOMP_OPCODE = 16,
224 M64P_DBG_RECOMP_ARGS,
243 M64P_MEM_FLASHRAMSTAT,
251 M64P_MEM_FLAG_READABLE = 0x01,
252 M64P_MEM_FLAG_WRITABLE = 0x02,
253 M64P_MEM_FLAG_READABLE_EMUONLY = 0x04, // the EMUONLY flags signify that emulated code can read/write here, but debugger cannot
254 M64P_MEM_FLAG_WRITABLE_EMUONLY = 0x08
255 } m64p_dbg_mem_flags;
258 M64P_DBG_PTR_RDRAM = 1,
264 } m64p_dbg_memptr_type;
272 M64P_CPU_REG_COP1_DOUBLE_PTR,
273 M64P_CPU_REG_COP1_SIMPLE_PTR,
274 M64P_CPU_REG_COP1_FGR_64,
279 M64P_BKP_CMD_ADD_ADDR = 1,
280 M64P_BKP_CMD_ADD_STRUCT,
281 M64P_BKP_CMD_REPLACE,
282 M64P_BKP_CMD_REMOVE_ADDR,
283 M64P_BKP_CMD_REMOVE_IDX,
285 M64P_BKP_CMD_DISABLE,
287 } m64p_dbg_bkp_command;
289 #define M64P_MEM_INVALID 0xFFFFFFFF // invalid memory read will return this
291 #define BREAKPOINTS_MAX_NUMBER 128
293 #define BPT_FLAG_ENABLED 0x01
294 #define BPT_FLAG_CONDITIONAL 0x02
295 #define BPT_FLAG_COUNTER 0x04
296 #define BPT_FLAG_READ 0x08
297 #define BPT_FLAG_WRITE 0x10
298 #define BPT_FLAG_EXEC 0x20
299 #define BPT_FLAG_LOG 0x40 //Log to the console when this breakpoint hits.
301 #define BPT_CHECK_FLAG(a, b) ((a.flags & b) == b)
302 #define BPT_SET_FLAG(a, b) a.flags = (a.flags | b);
303 #define BPT_CLEAR_FLAG(a, b) a.flags = (a.flags & (~b));
304 #define BPT_TOGGLE_FLAG(a, b) a.flags = (a.flags ^ b);
306 typedef struct _breakpoint {
307 unsigned int address;
308 unsigned int endaddr;
310 //unsigned int condition; //Placeholder for breakpoint condition
313 /* ------------------------------------------------- */
314 /* Structures and Types for Core Video Extension API */
315 /* ------------------------------------------------- */
318 unsigned int uiWidth;
319 unsigned int uiHeight;
323 M64P_GL_DOUBLEBUFFER = 1,
330 M64P_GL_SWAP_CONTROL,
331 M64P_GL_MULTISAMPLEBUFFERS,
332 M64P_GL_MULTISAMPLESAMPLES
336 unsigned int Functions;
337 m64p_error (*VidExtFuncInit)(void);
338 m64p_error (*VidExtFuncQuit)(void);
339 m64p_error (*VidExtFuncListModes)(m64p_2d_size *, int *);
340 m64p_error (*VidExtFuncSetMode)(int, int, int, int, int);
341 void * (*VidExtFuncGLGetProc)(const char*);
342 m64p_error (*VidExtFuncGLSetAttr)(m64p_GLattr, int);
343 m64p_error (*VidExtFuncGLGetAttr)(m64p_GLattr, int *);
344 m64p_error (*VidExtFuncGLSwapBuf)(void);
345 m64p_error (*VidExtFuncSetCaption)(const char *);
346 m64p_error (*VidExtFuncToggleFS)(void);
347 m64p_error (*VidExtFuncResizeWindow)(int, int);
348 } m64p_video_extension_functions;
350 #endif /* define M64P_TYPES_H */