Skip to content

Commit

Permalink
Update Mupen64Plus interface headers.
Browse files Browse the repository at this point in the history
  • Loading branch information
gonetz committed May 14, 2015
1 parent d7d22f2 commit 82a2d65
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 385 deletions.
2 changes: 1 addition & 1 deletion src/inc/callbacks.h
Expand Up @@ -26,8 +26,8 @@
#if !defined(API_CALLBACKS_H)
#define API_CALLBACKS_H

#include "m64p_types.h"
#include "m64p_frontend.h"
#include "m64p_types.h"

/* Functions for use by the Core, to send information back to the front-end app */
extern m64p_error SetDebugCallback(ptr_DebugCallback pFunc, void *Context);
Expand Down
10 changes: 10 additions & 0 deletions src/inc/m64p_config.h
Expand Up @@ -120,6 +120,16 @@ typedef m64p_error (*ptr_ConfigSetParameter)(m64p_handle, const char *, m64p_typ
EXPORT m64p_error CALL ConfigSetParameter(m64p_handle, const char *, m64p_type, const void *);
#endif

/* ConfigSetParameterHelp()
*
* This function sets the help string of one of the emulator's configuration
* parameters.
*/
typedef m64p_error (*ptr_ConfigSetParameterHelp)(m64p_handle, const char *, const char *);
#if defined(M64P_CORE_PROTOTYPES)
EXPORT m64p_error CALL ConfigSetParameterHelp(m64p_handle, const char *, const char *);
#endif

/* ConfigGetParameter()
*
* This function retrieves the value of one of the emulator's parameters.
Expand Down
8 changes: 4 additions & 4 deletions src/inc/m64p_debugger.h
Expand Up @@ -58,9 +58,9 @@ EXPORT m64p_error CALL DebugSetCoreCompare(void (*)(unsigned int), void (*)(int,
*
* This function sets the run state of the R4300 CPU emulator.
*/
typedef m64p_error (*ptr_DebugSetRunState)(int);
typedef m64p_error (*ptr_DebugSetRunState)(m64p_dbg_runstate);
#if defined(M64P_CORE_PROTOTYPES)
EXPORT m64p_error CALL DebugSetRunState(int);
EXPORT m64p_error CALL DebugSetRunState(m64p_dbg_runstate);
#endif

/* DebugGetState()
Expand Down Expand Up @@ -189,9 +189,9 @@ EXPORT int CALL DebugBreakpointLookup(unsigned int, unsigned int, unsigned int);
* removing, or searching the breakpoints. The meanings of the index and ptr
* input parameters vary by command.
*/
typedef int (*ptr_DebugBreakpointCommand)(m64p_dbg_bkp_command, unsigned int, void *);
typedef int (*ptr_DebugBreakpointCommand)(m64p_dbg_bkp_command, unsigned int, m64p_breakpoint *);
#if defined(M64P_CORE_PROTOTYPES)
EXPORT int CALL DebugBreakpointCommand(m64p_dbg_bkp_command, unsigned int, void *);
EXPORT int CALL DebugBreakpointCommand(m64p_dbg_bkp_command, unsigned int, m64p_breakpoint *);
#endif

#ifdef __cplusplus
Expand Down
2 changes: 2 additions & 0 deletions src/inc/m64p_plugin.h
Expand Up @@ -245,13 +245,15 @@ typedef void (*ptr_InitiateControllers)(CONTROL_INFO ControlInfo);
typedef void (*ptr_ReadController)(int Control, unsigned char *Command);
typedef void (*ptr_SDL_KeyDown)(int keymod, int keysym);
typedef void (*ptr_SDL_KeyUp)(int keymod, int keysym);
typedef void (*ptr_RenderCallback)(void);
#if defined(M64P_PLUGIN_PROTOTYPES)
EXPORT void CALL ControllerCommand(int Control, unsigned char *Command);
EXPORT void CALL GetKeys(int Control, BUTTONS *Keys);
EXPORT void CALL InitiateControllers(CONTROL_INFO ControlInfo);
EXPORT void CALL ReadController(int Control, unsigned char *Command);
EXPORT void CALL SDL_KeyDown(int keymod, int keysym);
EXPORT void CALL SDL_KeyUp(int keymod, int keysym);
EXPORT void CALL RenderCallback(void);
#endif

/* RSP plugin function pointers */
Expand Down
81 changes: 48 additions & 33 deletions src/inc/m64p_types.h
Expand Up @@ -28,6 +28,7 @@
/* ----------------------------------------- */

/* necessary headers */
#include <stdint.h>
#if defined(WIN32)
#include <windows.h>
#endif
Expand Down Expand Up @@ -159,8 +160,8 @@ typedef enum {
} m64p_command;

typedef struct {
unsigned int address;
int value;
uint32_t address;
int value;
} m64p_cheat_code;

/* ----------------------------------------- */
Expand All @@ -176,21 +177,21 @@ typedef enum

typedef struct
{
unsigned char init_PI_BSB_DOM1_LAT_REG; /* 0x00 */
unsigned char init_PI_BSB_DOM1_PGS_REG; /* 0x01 */
unsigned char init_PI_BSB_DOM1_PWD_REG; /* 0x02 */
unsigned char init_PI_BSB_DOM1_PGS_REG2; /* 0x03 */
unsigned int ClockRate; /* 0x04 */
unsigned int PC; /* 0x08 */
unsigned int Release; /* 0x0C */
unsigned int CRC1; /* 0x10 */
unsigned int CRC2; /* 0x14 */
unsigned int Unknown[2]; /* 0x18 */
unsigned char Name[20]; /* 0x20 */
unsigned int unknown; /* 0x34 */
unsigned int Manufacturer_ID; /* 0x38 */
unsigned short Cartridge_ID; /* 0x3C - Game serial number */
unsigned short Country_code; /* 0x3E */
uint8_t init_PI_BSB_DOM1_LAT_REG; /* 0x00 */
uint8_t init_PI_BSB_DOM1_PGS_REG; /* 0x01 */
uint8_t init_PI_BSB_DOM1_PWD_REG; /* 0x02 */
uint8_t init_PI_BSB_DOM1_PGS_REG2; /* 0x03 */
uint32_t ClockRate; /* 0x04 */
uint32_t PC; /* 0x08 */
uint32_t Release; /* 0x0C */
uint32_t CRC1; /* 0x10 */
uint32_t CRC2; /* 0x14 */
uint32_t Unknown[2]; /* 0x18 */
uint8_t Name[20]; /* 0x20 */
uint32_t unknown; /* 0x34 */
uint32_t Manufacturer_ID; /* 0x38 */
uint16_t Cartridge_ID; /* 0x3C - Game serial number */
uint16_t Country_code; /* 0x3E */
} m64p_rom_header;

typedef struct
Expand All @@ -215,6 +216,12 @@ typedef enum {
M64P_DBG_CPU_NEXT_INTERRUPT
} m64p_dbg_state;

typedef enum {
M64P_DBG_RUNSTATE_PAUSED = 0,
M64P_DBG_RUNSTATE_STEPPING,
M64P_DBG_RUNSTATE_RUNNING
} m64p_dbg_runstate;

typedef enum {
M64P_DBG_MEM_TYPE = 1,
M64P_DBG_MEM_FLAGS,
Expand Down Expand Up @@ -250,7 +257,7 @@ typedef enum {
typedef enum {
M64P_MEM_FLAG_READABLE = 0x01,
M64P_MEM_FLAG_WRITABLE = 0x02,
M64P_MEM_FLAG_READABLE_EMUONLY = 0x04, // the EMUONLY flags signify that emulated code can read/write here, but debugger cannot
M64P_MEM_FLAG_READABLE_EMUONLY = 0x04, /* the EMUONLY flags signify that emulated code can read/write here, but debugger cannot */
M64P_MEM_FLAG_WRITABLE_EMUONLY = 0x08
} m64p_dbg_mem_flags;

Expand Down Expand Up @@ -286,29 +293,28 @@ typedef enum {
M64P_BKP_CMD_CHECK
} m64p_dbg_bkp_command;

#define M64P_MEM_INVALID 0xFFFFFFFF // invalid memory read will return this
#define M64P_MEM_INVALID 0xFFFFFFFF /* invalid memory read will return this */

#define BREAKPOINTS_MAX_NUMBER 128

#define BPT_FLAG_ENABLED 0x01
#define BPT_FLAG_CONDITIONAL 0x02
#define BPT_FLAG_COUNTER 0x04
#define BPT_FLAG_READ 0x08
#define BPT_FLAG_WRITE 0x10
#define BPT_FLAG_EXEC 0x20
#define BPT_FLAG_LOG 0x40 //Log to the console when this breakpoint hits.
typedef enum {
M64P_BKP_FLAG_ENABLED = 0x01,
M64P_BKP_FLAG_READ = 0x02,
M64P_BKP_FLAG_WRITE = 0x04,
M64P_BKP_FLAG_EXEC = 0x08,
M64P_BKP_FLAG_LOG = 0x10 /* Log to the console when this breakpoint hits */
} m64p_dbg_bkp_flags;

#define BPT_CHECK_FLAG(a, b) ((a.flags & b) == b)
#define BPT_SET_FLAG(a, b) a.flags = (a.flags | b);
#define BPT_CLEAR_FLAG(a, b) a.flags = (a.flags & (~b));
#define BPT_TOGGLE_FLAG(a, b) a.flags = (a.flags ^ b);

typedef struct _breakpoint {
unsigned int address;
unsigned int endaddr;
unsigned int flags;
//unsigned int condition; //Placeholder for breakpoint condition
} breakpoint;
typedef struct {
uint32_t address;
uint32_t endaddr;
unsigned int flags;
} m64p_breakpoint;

/* ------------------------------------------------- */
/* Structures and Types for Core Video Extension API */
Expand All @@ -329,9 +335,18 @@ typedef enum {
M64P_GL_ALPHA_SIZE,
M64P_GL_SWAP_CONTROL,
M64P_GL_MULTISAMPLEBUFFERS,
M64P_GL_MULTISAMPLESAMPLES
M64P_GL_MULTISAMPLESAMPLES,
M64P_GL_CONTEXT_MAJOR_VERSION,
M64P_GL_CONTEXT_MINOR_VERSION,
M64P_GL_CONTEXT_PROFILE_MASK
} m64p_GLattr;

typedef enum {
M64P_GL_CONTEXT_PROFILE_CORE,
M64P_GL_CONTEXT_PROFILE_COMPATIBILITY,
M64P_GL_CONTEXT_PROFILE_ES
} m64p_GLContextType;

typedef struct {
unsigned int Functions;
m64p_error (*VidExtFuncInit)(void);
Expand Down

0 comments on commit 82a2d65

Please sign in to comment.