mirror of
https://github.com/Dillonb/n64.git
synced 2024-05-17 03:20:34 -04:00
Remove mupen64plus RDP plugin support
This commit is contained in:
parent
d184004ea2
commit
b35dc036c0
|
@ -74,7 +74,6 @@ n64, a dgb n64 emulator
|
|||
-v, --verbose enables verbose output, repeat up to 4 times for more verbosity
|
||||
-h, --help Display this help message
|
||||
-i, --interpreter Force the use of the interpreter
|
||||
-r, --rdp Load RDP plugin (Mupen64Plus compatible) - note: disables UI and requires ROM to be passed on the command line!
|
||||
-m, --movie Load movie (Mupen64Plus .m64 format)
|
||||
-p, --pif Load PIF ROM
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -55,9 +55,6 @@ int main(int argc, char** argv) {
|
|||
#endif
|
||||
#endif
|
||||
|
||||
const char* rdp_plugin_path = NULL;
|
||||
cflags_add_string(flags, 'r', "rdp", &rdp_plugin_path, "Load RDP plugin (Mupen64Plus compatible) "
|
||||
"- note: disables UI and requires ROM to be passed on the command line!");
|
||||
const char* tas_movie_path = NULL;
|
||||
cflags_add_string(flags, 'm', "movie", &tas_movie_path, "Load movie (Mupen64Plus .m64 format)");
|
||||
|
||||
|
@ -83,14 +80,7 @@ int main(int argc, char** argv) {
|
|||
interpreter = true;
|
||||
}
|
||||
#endif
|
||||
if (rdp_plugin_path != NULL) {
|
||||
if (flags->argc != 1) {
|
||||
usage(flags);
|
||||
return 1;
|
||||
}
|
||||
init_n64system(flags->argv[0], true, debug, OPENGL_VIDEO_TYPE, interpreter);
|
||||
load_rdp_plugin(rdp_plugin_path);
|
||||
} else if (software_mode) {
|
||||
if (software_mode) {
|
||||
const char* rom_path = NULL;
|
||||
if (flags->argc >= 1) {
|
||||
rom_path = flags->argv[0];
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
#include <SDL.h>
|
||||
#include <SDL_vulkan.h>
|
||||
|
||||
#define GLAD_GL_IMPLEMENTATION
|
||||
#include <glad/gl.h>
|
||||
#include <volk.h>
|
||||
#include <rdp/parallel_rdp_wrapper.h>
|
||||
|
||||
|
@ -35,39 +33,6 @@ SDL_Window* get_window_handle() {
|
|||
return window;
|
||||
}
|
||||
|
||||
void video_init_opengl() {
|
||||
window = SDL_CreateWindow(N64_APP_NAME,
|
||||
SDL_WINDOWPOS_UNDEFINED,
|
||||
SDL_WINDOWPOS_UNDEFINED,
|
||||
N64_SCREEN_X * SCREEN_SCALE,
|
||||
N64_SCREEN_Y * SCREEN_SCALE,
|
||||
SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL);
|
||||
gl_context = SDL_GL_CreateContext(window);
|
||||
if (gl_context == NULL) {
|
||||
logfatal("SDL couldn't create OpenGL context! %s", SDL_GetError());
|
||||
}
|
||||
|
||||
int gl_version = gladLoadGL((GLADloadfunc)SDL_GL_GetProcAddress);
|
||||
|
||||
if (gl_version == 0) {
|
||||
logfatal("Failed to initialize Glad context");
|
||||
}
|
||||
|
||||
printf("OpenGL initialized.\n");
|
||||
printf("Vendor: %s\n", glGetString(GL_VENDOR));
|
||||
printf("Renderer: %s\n", glGetString(GL_RENDERER));
|
||||
printf("Version: %s\n", glGetString(GL_VERSION));
|
||||
|
||||
glViewport(0, 0, N64_SCREEN_X * SCREEN_SCALE, N64_SCREEN_Y * SCREEN_SCALE);
|
||||
glClearColor(0.0f, 0.5f, 1.0f, 0.0f);
|
||||
|
||||
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
|
||||
|
||||
if (renderer == NULL) {
|
||||
logfatal("SDL couldn't create a renderer! %s", SDL_GetError());
|
||||
}
|
||||
}
|
||||
|
||||
void video_init_vulkan() {
|
||||
window = SDL_CreateWindow(N64_APP_NAME,
|
||||
SDL_WINDOWPOS_UNDEFINED,
|
||||
|
@ -101,9 +66,6 @@ void render_init(n64_video_type_t video_type) {
|
|||
logfatal("SDL couldn't initialize! %s", SDL_GetError());
|
||||
}
|
||||
switch (video_type) {
|
||||
case OPENGL_VIDEO_TYPE:
|
||||
video_init_opengl();
|
||||
break;
|
||||
case VULKAN_VIDEO_TYPE:
|
||||
video_init_vulkan();
|
||||
break;
|
||||
|
@ -198,9 +160,6 @@ void render_screen_software() {
|
|||
|
||||
void n64_render_screen() {
|
||||
switch (n64_video_type) {
|
||||
case OPENGL_VIDEO_TYPE:
|
||||
SDL_RenderPresent(renderer);
|
||||
break;
|
||||
case VULKAN_VIDEO_TYPE: // frame pushing handled elsewhere
|
||||
case QT_VULKAN_VIDEO_TYPE:
|
||||
break;
|
||||
|
@ -237,7 +196,6 @@ bool is_framerate_unlocked() {
|
|||
return prdp_is_framerate_unlocked();
|
||||
|
||||
case UNKNOWN_VIDEO_TYPE:
|
||||
case OPENGL_VIDEO_TYPE:
|
||||
case SOFTWARE_VIDEO_TYPE:
|
||||
return false;
|
||||
}
|
||||
|
@ -251,7 +209,6 @@ void set_framerate_unlocked(bool unlocked) {
|
|||
break;
|
||||
|
||||
case UNKNOWN_VIDEO_TYPE:
|
||||
case OPENGL_VIDEO_TYPE:
|
||||
case SOFTWARE_VIDEO_TYPE:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -15,8 +15,7 @@ file(GLOB_RECURSE contrib_headers contrib/*.h)
|
|||
add_library(rdp
|
||||
${contrib_headers}
|
||||
rdp.c rdp.h
|
||||
softrdp.cpp softrdp.h
|
||||
mupen_interface.c mupen_interface.h)
|
||||
softrdp.cpp softrdp.h)
|
||||
|
||||
add_library(parallel_rdp_wrapper
|
||||
parallel_rdp_wrapper.cpp parallel_rdp_wrapper.h
|
||||
|
|
|
@ -1,90 +0,0 @@
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Mupen64plus-core - m64p_common.h *
|
||||
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
|
||||
* Copyright (C) 2009 Richard Goedeken *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/* This header file defines typedefs for function pointers to common Core
|
||||
* and plugin functions, for use by the front-end and plugin modules to attach
|
||||
* to the dynamic libraries.
|
||||
*/
|
||||
|
||||
#if !defined(M64P_COMMON_H)
|
||||
#define M64P_COMMON_H
|
||||
|
||||
#include "m64p_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* PluginGetVersion()
|
||||
*
|
||||
* This function retrieves version information from a library. This
|
||||
* function is the same for the core library and the plugins.
|
||||
*/
|
||||
typedef m64p_error (*ptr_PluginGetVersion)(m64p_plugin_type *, int *, int *, const char **, int *);
|
||||
#if defined(M64P_PLUGIN_PROTOTYPES) || defined(M64P_CORE_PROTOTYPES)
|
||||
EXPORT m64p_error CALL PluginGetVersion(m64p_plugin_type *, int *, int *, const char **, int *);
|
||||
#endif
|
||||
|
||||
/* CoreGetAPIVersions()
|
||||
*
|
||||
* This function retrieves API version information from the core.
|
||||
*/
|
||||
typedef m64p_error (*ptr_CoreGetAPIVersions)(int *, int *, int *, int *);
|
||||
#if defined(M64P_CORE_PROTOTYPES)
|
||||
EXPORT m64p_error CALL CoreGetAPIVersions(int *, int *, int *, int *);
|
||||
#endif
|
||||
|
||||
/* CoreErrorMessage()
|
||||
*
|
||||
* This function returns a pointer to a NULL-terminated string giving a
|
||||
* human-readable description of the error.
|
||||
*/
|
||||
typedef const char * (*ptr_CoreErrorMessage)(m64p_error);
|
||||
#if defined(M64P_CORE_PROTOTYPES)
|
||||
EXPORT const char * CALL CoreErrorMessage(m64p_error);
|
||||
#endif
|
||||
|
||||
/* PluginStartup()
|
||||
*
|
||||
* This function initializes a plugin for use by allocating memory, creating
|
||||
* data structures, and loading the configuration data.
|
||||
*/
|
||||
typedef m64p_error (*ptr_PluginStartup)(m64p_dynlib_handle, void *, void (*)(void *, int, const char *));
|
||||
#if defined(M64P_PLUGIN_PROTOTYPES) || defined(M64P_CORE_PROTOTYPES)
|
||||
EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle, void *, void (*)(void *, int, const char *));
|
||||
#endif
|
||||
|
||||
/* PluginShutdown()
|
||||
*
|
||||
* This function destroys data structures and releases memory allocated by
|
||||
* the plugin library.
|
||||
*/
|
||||
typedef m64p_error (*ptr_PluginShutdown)(void);
|
||||
#if defined(M64P_PLUGIN_PROTOTYPES) || defined(M64P_CORE_PROTOTYPES)
|
||||
EXPORT m64p_error CALL PluginShutdown(void);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* #define M64P_COMMON_H */
|
||||
|
|
@ -1,286 +0,0 @@
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Mupen64plus-core - m64p_plugin.h *
|
||||
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
|
||||
* Copyright (C) 2002 Hacktarux *
|
||||
* Copyright (C) 2009 Richard Goedeken *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#if !defined(M64P_PLUGIN_H)
|
||||
#define M64P_PLUGIN_H
|
||||
|
||||
#include "m64p_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*** Controller plugin's ****/
|
||||
#define PLUGIN_NONE 1
|
||||
#define PLUGIN_MEMPAK 2
|
||||
#define PLUGIN_RUMBLE_PAK 3 /* not implemented for non raw data */
|
||||
#define PLUGIN_TRANSFER_PAK 4 /* not implemented for non raw data */
|
||||
#define PLUGIN_RAW 5 /* the controller plugin is passed in raw data */
|
||||
|
||||
/***** Structures *****/
|
||||
typedef struct {
|
||||
unsigned char * RDRAM;
|
||||
unsigned char * DMEM;
|
||||
unsigned char * IMEM;
|
||||
|
||||
unsigned int * MI_INTR_REG;
|
||||
|
||||
unsigned int * SP_MEM_ADDR_REG;
|
||||
unsigned int * SP_DRAM_ADDR_REG;
|
||||
unsigned int * SP_RD_LEN_REG;
|
||||
unsigned int * SP_WR_LEN_REG;
|
||||
unsigned int * SP_STATUS_REG;
|
||||
unsigned int * SP_DMA_FULL_REG;
|
||||
unsigned int * SP_DMA_BUSY_REG;
|
||||
unsigned int * SP_PC_REG;
|
||||
unsigned int * SP_SEMAPHORE_REG;
|
||||
|
||||
unsigned int * DPC_START_REG;
|
||||
unsigned int * DPC_END_REG;
|
||||
unsigned int * DPC_CURRENT_REG;
|
||||
unsigned int * DPC_STATUS_REG;
|
||||
unsigned int * DPC_CLOCK_REG;
|
||||
unsigned int * DPC_BUFBUSY_REG;
|
||||
unsigned int * DPC_PIPEBUSY_REG;
|
||||
unsigned int * DPC_TMEM_REG;
|
||||
|
||||
void (*CheckInterrupts)(void);
|
||||
void (*ProcessDlistList)(void);
|
||||
void (*ProcessAlistList)(void);
|
||||
void (*ProcessRdpList)(void);
|
||||
void (*ShowCFB)(void);
|
||||
} RSP_INFO;
|
||||
|
||||
typedef struct {
|
||||
unsigned char * HEADER; /* This is the rom header (first 40h bytes of the rom) */
|
||||
unsigned char * RDRAM;
|
||||
unsigned char * DMEM;
|
||||
unsigned char * IMEM;
|
||||
|
||||
unsigned int * MI_INTR_REG;
|
||||
|
||||
unsigned int * DPC_START_REG;
|
||||
unsigned int * DPC_END_REG;
|
||||
unsigned int * DPC_CURRENT_REG;
|
||||
unsigned int * DPC_STATUS_REG;
|
||||
unsigned int * DPC_CLOCK_REG;
|
||||
unsigned int * DPC_BUFBUSY_REG;
|
||||
unsigned int * DPC_PIPEBUSY_REG;
|
||||
unsigned int * DPC_TMEM_REG;
|
||||
|
||||
unsigned int * VI_STATUS_REG;
|
||||
unsigned int * VI_ORIGIN_REG;
|
||||
unsigned int * VI_WIDTH_REG;
|
||||
unsigned int * VI_INTR_REG;
|
||||
unsigned int * VI_V_CURRENT_LINE_REG;
|
||||
unsigned int * VI_TIMING_REG;
|
||||
unsigned int * VI_V_SYNC_REG;
|
||||
unsigned int * VI_H_SYNC_REG;
|
||||
unsigned int * VI_LEAP_REG;
|
||||
unsigned int * VI_H_START_REG;
|
||||
unsigned int * VI_V_START_REG;
|
||||
unsigned int * VI_V_BURST_REG;
|
||||
unsigned int * VI_X_SCALE_REG;
|
||||
unsigned int * VI_Y_SCALE_REG;
|
||||
|
||||
void (*CheckInterrupts)(void);
|
||||
|
||||
/* The GFX_INFO.version parameter was added in version 2.5.1 of the core.
|
||||
Plugins should ensure the core is at least this version before
|
||||
attempting to read GFX_INFO.version. */
|
||||
unsigned int version;
|
||||
/* SP_STATUS_REG and RDRAM_SIZE were added in version 2 of GFX_INFO.version.
|
||||
Plugins should only attempt to read these values if GFX_INFO.version is at least 2. */
|
||||
|
||||
/* The RSP plugin should set (HALT | BROKE | TASKDONE) *before* calling ProcessDList.
|
||||
It should not modify SP_STATUS_REG after ProcessDList has returned.
|
||||
This will allow the GFX plugin to unset these bits if it needs. */
|
||||
unsigned int * SP_STATUS_REG;
|
||||
const unsigned int * RDRAM_SIZE;
|
||||
} GFX_INFO;
|
||||
|
||||
typedef struct {
|
||||
unsigned char * RDRAM;
|
||||
unsigned char * DMEM;
|
||||
unsigned char * IMEM;
|
||||
|
||||
unsigned int * MI_INTR_REG;
|
||||
|
||||
unsigned int * AI_DRAM_ADDR_REG;
|
||||
unsigned int * AI_LEN_REG;
|
||||
unsigned int * AI_CONTROL_REG;
|
||||
unsigned int * AI_STATUS_REG;
|
||||
unsigned int * AI_DACRATE_REG;
|
||||
unsigned int * AI_BITRATE_REG;
|
||||
|
||||
void (*CheckInterrupts)(void);
|
||||
} AUDIO_INFO;
|
||||
|
||||
typedef struct {
|
||||
int Present;
|
||||
int RawData;
|
||||
int Plugin;
|
||||
} CONTROL;
|
||||
|
||||
typedef union {
|
||||
unsigned int Value;
|
||||
struct {
|
||||
unsigned R_DPAD : 1;
|
||||
unsigned L_DPAD : 1;
|
||||
unsigned D_DPAD : 1;
|
||||
unsigned U_DPAD : 1;
|
||||
unsigned START_BUTTON : 1;
|
||||
unsigned Z_TRIG : 1;
|
||||
unsigned B_BUTTON : 1;
|
||||
unsigned A_BUTTON : 1;
|
||||
|
||||
unsigned R_CBUTTON : 1;
|
||||
unsigned L_CBUTTON : 1;
|
||||
unsigned D_CBUTTON : 1;
|
||||
unsigned U_CBUTTON : 1;
|
||||
unsigned R_TRIG : 1;
|
||||
unsigned L_TRIG : 1;
|
||||
unsigned Reserved1 : 1;
|
||||
unsigned Reserved2 : 1;
|
||||
|
||||
signed X_AXIS : 8;
|
||||
signed Y_AXIS : 8;
|
||||
};
|
||||
} BUTTONS;
|
||||
|
||||
typedef struct {
|
||||
CONTROL *Controls; /* A pointer to an array of 4 controllers .. eg:
|
||||
CONTROL Controls[4]; */
|
||||
} CONTROL_INFO;
|
||||
|
||||
/* common plugin function pointer types */
|
||||
typedef void (*ptr_RomClosed)(void);
|
||||
typedef int (*ptr_RomOpen)(void);
|
||||
#if defined(M64P_PLUGIN_PROTOTYPES)
|
||||
EXPORT int CALL RomOpen(void);
|
||||
EXPORT void CALL RomClosed(void);
|
||||
#endif
|
||||
|
||||
/* video plugin function pointer types */
|
||||
typedef void (*ptr_ChangeWindow)(void);
|
||||
typedef int (*ptr_InitiateGFX)(GFX_INFO Gfx_Info);
|
||||
typedef void (*ptr_MoveScreen)(int x, int y);
|
||||
typedef void (*ptr_ProcessDList)(void);
|
||||
typedef void (*ptr_ProcessRDPList)(void);
|
||||
typedef void (*ptr_ShowCFB)(void);
|
||||
typedef void (*ptr_UpdateScreen)(void);
|
||||
typedef void (*ptr_ViStatusChanged)(void);
|
||||
typedef void (*ptr_ViWidthChanged)(void);
|
||||
typedef void (*ptr_ReadScreen2)(void *dest, int *width, int *height, int front);
|
||||
typedef void (*ptr_SetRenderingCallback)(void (*callback)(int));
|
||||
typedef void (*ptr_ResizeVideoOutput)(int width, int height);
|
||||
#if defined(M64P_PLUGIN_PROTOTYPES)
|
||||
EXPORT void CALL ChangeWindow(void);
|
||||
EXPORT int CALL InitiateGFX(GFX_INFO Gfx_Info);
|
||||
EXPORT void CALL MoveScreen(int x, int y);
|
||||
EXPORT void CALL ProcessDList(void);
|
||||
EXPORT void CALL ProcessRDPList(void);
|
||||
EXPORT void CALL ShowCFB(void);
|
||||
EXPORT void CALL UpdateScreen(void);
|
||||
EXPORT void CALL ViStatusChanged(void);
|
||||
EXPORT void CALL ViWidthChanged(void);
|
||||
EXPORT void CALL ReadScreen2(void *dest, int *width, int *height, int front);
|
||||
EXPORT void CALL SetRenderingCallback(void (*callback)(int));
|
||||
EXPORT void CALL ResizeVideoOutput(int width, int height);
|
||||
#endif
|
||||
|
||||
/* frame buffer plugin spec extension */
|
||||
typedef struct
|
||||
{
|
||||
unsigned int addr;
|
||||
unsigned int size;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
} FrameBufferInfo;
|
||||
typedef void (*ptr_FBRead)(unsigned int addr);
|
||||
typedef void (*ptr_FBWrite)(unsigned int addr, unsigned int size);
|
||||
typedef void (*ptr_FBGetFrameBufferInfo)(void *p);
|
||||
#if defined(M64P_PLUGIN_PROTOTYPES)
|
||||
EXPORT void CALL FBRead(unsigned int addr);
|
||||
EXPORT void CALL FBWrite(unsigned int addr, unsigned int size);
|
||||
EXPORT void CALL FBGetFrameBufferInfo(void *p);
|
||||
#endif
|
||||
|
||||
/* audio plugin function pointers */
|
||||
typedef void (*ptr_AiDacrateChanged)(int SystemType);
|
||||
typedef void (*ptr_AiLenChanged)(void);
|
||||
typedef int (*ptr_InitiateAudio)(AUDIO_INFO Audio_Info);
|
||||
typedef void (*ptr_ProcessAList)(void);
|
||||
typedef void (*ptr_SetSpeedFactor)(int percent);
|
||||
typedef void (*ptr_VolumeUp)(void);
|
||||
typedef void (*ptr_VolumeDown)(void);
|
||||
typedef int (*ptr_VolumeGetLevel)(void);
|
||||
typedef void (*ptr_VolumeSetLevel)(int level);
|
||||
typedef void (*ptr_VolumeMute)(void);
|
||||
typedef const char * (*ptr_VolumeGetString)(void);
|
||||
#if defined(M64P_PLUGIN_PROTOTYPES)
|
||||
EXPORT void CALL AiDacrateChanged(int SystemType);
|
||||
EXPORT void CALL AiLenChanged(void);
|
||||
EXPORT int CALL InitiateAudio(AUDIO_INFO Audio_Info);
|
||||
EXPORT void CALL ProcessAList(void);
|
||||
EXPORT void CALL SetSpeedFactor(int percent);
|
||||
EXPORT void CALL VolumeUp(void);
|
||||
EXPORT void CALL VolumeDown(void);
|
||||
EXPORT int CALL VolumeGetLevel(void);
|
||||
EXPORT void CALL VolumeSetLevel(int level);
|
||||
EXPORT void CALL VolumeMute(void);
|
||||
EXPORT const char * CALL VolumeGetString(void);
|
||||
#endif
|
||||
|
||||
/* input plugin function pointers */
|
||||
typedef void (*ptr_ControllerCommand)(int Control, unsigned char *Command);
|
||||
typedef void (*ptr_GetKeys)(int Control, BUTTONS *Keys);
|
||||
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 */
|
||||
typedef unsigned int (*ptr_DoRspCycles)(unsigned int Cycles);
|
||||
typedef void (*ptr_InitiateRSP)(RSP_INFO Rsp_Info, unsigned int *CycleCount);
|
||||
#if defined(M64P_PLUGIN_PROTOTYPES)
|
||||
EXPORT unsigned int CALL DoRspCycles(unsigned int Cycles);
|
||||
EXPORT void CALL InitiateRSP(RSP_INFO Rsp_Info, unsigned int *CycleCount);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* M64P_PLUGIN_H */
|
||||
|
||||
|
|
@ -1,366 +0,0 @@
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Mupen64plus-core - m64p_types.h *
|
||||
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
|
||||
* Copyright (C) 2012 CasualJames *
|
||||
* Copyright (C) 2009 Richard Goedeken *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#if !defined(M64P_TYPES_H)
|
||||
#define M64P_TYPES_H
|
||||
|
||||
/* ----------------------------------------- */
|
||||
/* Platform-specific stuff */
|
||||
/* ----------------------------------------- */
|
||||
|
||||
/* necessary headers */
|
||||
#include <stdint.h>
|
||||
#if defined(WIN32)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
/* DLL handles and function declaration specifiers */
|
||||
#if defined(WIN32)
|
||||
#define IMPORT extern "C" __declspec(dllimport)
|
||||
#define EXPORT __declspec(dllexport)
|
||||
#define CALL __cdecl
|
||||
typedef HMODULE m64p_dynlib_handle;
|
||||
#else
|
||||
#define IMPORT extern "C"
|
||||
#define EXPORT __attribute__((visibility("default")))
|
||||
#define CALL
|
||||
typedef void * m64p_dynlib_handle;
|
||||
#endif
|
||||
|
||||
/* ----------------------------------------- */
|
||||
/* Structures and Types for Core library API */
|
||||
/* ----------------------------------------- */
|
||||
|
||||
typedef void * m64p_handle;
|
||||
|
||||
typedef void (*m64p_frame_callback)(unsigned int FrameIndex);
|
||||
typedef void (*m64p_input_callback)(void);
|
||||
typedef void (*m64p_audio_callback)(void);
|
||||
typedef void (*m64p_vi_callback)(void);
|
||||
|
||||
typedef enum {
|
||||
M64TYPE_INT = 1,
|
||||
M64TYPE_FLOAT,
|
||||
M64TYPE_BOOL,
|
||||
M64TYPE_STRING
|
||||
} m64p_type;
|
||||
|
||||
typedef enum {
|
||||
M64MSG_ERROR = 1,
|
||||
M64MSG_WARNING,
|
||||
M64MSG_INFO,
|
||||
M64MSG_STATUS,
|
||||
M64MSG_VERBOSE
|
||||
} m64p_msg_level;
|
||||
|
||||
typedef enum {
|
||||
M64ERR_SUCCESS = 0,
|
||||
M64ERR_NOT_INIT, /* Function is disallowed before InitMupen64Plus() is called */
|
||||
M64ERR_ALREADY_INIT, /* InitMupen64Plus() was called twice */
|
||||
M64ERR_INCOMPATIBLE, /* API versions between components are incompatible */
|
||||
M64ERR_INPUT_ASSERT, /* Invalid parameters for function call, such as ParamValue=NULL for GetCoreParameter() */
|
||||
M64ERR_INPUT_INVALID, /* Invalid input data, such as ParamValue="maybe" for SetCoreParameter() to set a BOOL-type value */
|
||||
M64ERR_INPUT_NOT_FOUND, /* The input parameter(s) specified a particular item which was not found */
|
||||
M64ERR_NO_MEMORY, /* Memory allocation failed */
|
||||
M64ERR_FILES, /* Error opening, creating, reading, or writing to a file */
|
||||
M64ERR_INTERNAL, /* Internal error (bug) */
|
||||
M64ERR_INVALID_STATE, /* Current program state does not allow operation */
|
||||
M64ERR_PLUGIN_FAIL, /* A plugin function returned a fatal error */
|
||||
M64ERR_SYSTEM_FAIL, /* A system function call, such as an SDL or file operation, failed */
|
||||
M64ERR_UNSUPPORTED, /* Function call is not supported (ie, core not built with debugger) */
|
||||
M64ERR_WRONG_TYPE /* A given input type parameter cannot be used for desired operation */
|
||||
} m64p_error;
|
||||
|
||||
typedef enum {
|
||||
M64CAPS_DYNAREC = 1,
|
||||
M64CAPS_DEBUGGER = 2,
|
||||
M64CAPS_CORE_COMPARE = 4
|
||||
} m64p_core_caps;
|
||||
|
||||
typedef enum {
|
||||
M64PLUGIN_NULL = 0,
|
||||
M64PLUGIN_RSP = 1,
|
||||
M64PLUGIN_GFX,
|
||||
M64PLUGIN_AUDIO,
|
||||
M64PLUGIN_INPUT,
|
||||
M64PLUGIN_CORE
|
||||
} m64p_plugin_type;
|
||||
|
||||
typedef enum {
|
||||
M64EMU_STOPPED = 1,
|
||||
M64EMU_RUNNING,
|
||||
M64EMU_PAUSED
|
||||
} m64p_emu_state;
|
||||
|
||||
typedef enum {
|
||||
M64VIDEO_NONE = 1,
|
||||
M64VIDEO_WINDOWED,
|
||||
M64VIDEO_FULLSCREEN
|
||||
} m64p_video_mode;
|
||||
|
||||
typedef enum {
|
||||
M64VIDEOFLAG_SUPPORT_RESIZING = 1
|
||||
} m64p_video_flags;
|
||||
|
||||
typedef enum {
|
||||
M64CORE_EMU_STATE = 1,
|
||||
M64CORE_VIDEO_MODE,
|
||||
M64CORE_SAVESTATE_SLOT,
|
||||
M64CORE_SPEED_FACTOR,
|
||||
M64CORE_SPEED_LIMITER,
|
||||
M64CORE_VIDEO_SIZE,
|
||||
M64CORE_AUDIO_VOLUME,
|
||||
M64CORE_AUDIO_MUTE,
|
||||
M64CORE_INPUT_GAMESHARK,
|
||||
M64CORE_STATE_LOADCOMPLETE,
|
||||
M64CORE_STATE_SAVECOMPLETE
|
||||
} m64p_core_param;
|
||||
|
||||
typedef enum {
|
||||
M64CMD_NOP = 0,
|
||||
M64CMD_ROM_OPEN,
|
||||
M64CMD_ROM_CLOSE,
|
||||
M64CMD_ROM_GET_HEADER,
|
||||
M64CMD_ROM_GET_SETTINGS,
|
||||
M64CMD_EXECUTE,
|
||||
M64CMD_STOP,
|
||||
M64CMD_PAUSE,
|
||||
M64CMD_RESUME,
|
||||
M64CMD_CORE_STATE_QUERY,
|
||||
M64CMD_STATE_LOAD,
|
||||
M64CMD_STATE_SAVE,
|
||||
M64CMD_STATE_SET_SLOT,
|
||||
M64CMD_SEND_SDL_KEYDOWN,
|
||||
M64CMD_SEND_SDL_KEYUP,
|
||||
M64CMD_SET_FRAME_CALLBACK,
|
||||
M64CMD_TAKE_NEXT_SCREENSHOT,
|
||||
M64CMD_CORE_STATE_SET,
|
||||
M64CMD_READ_SCREEN,
|
||||
M64CMD_RESET,
|
||||
M64CMD_ADVANCE_FRAME
|
||||
} m64p_command;
|
||||
|
||||
typedef struct {
|
||||
uint32_t address;
|
||||
int value;
|
||||
} m64p_cheat_code;
|
||||
|
||||
/* ----------------------------------------- */
|
||||
/* Structures to hold ROM image information */
|
||||
/* ----------------------------------------- */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SYSTEM_NTSC = 0,
|
||||
SYSTEM_PAL,
|
||||
SYSTEM_MPAL
|
||||
} m64p_system_type;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
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
|
||||
{
|
||||
char goodname[256];
|
||||
char MD5[33];
|
||||
unsigned char savetype;
|
||||
unsigned char status; /* Rom status on a scale from 0-5. */
|
||||
unsigned char players; /* Local players 0-4, 2/3/4 way Netplay indicated by 5/6/7. */
|
||||
unsigned char rumble; /* 0 - No, 1 - Yes boolean for rumble support. */
|
||||
} m64p_rom_settings;
|
||||
|
||||
/* ----------------------------------------- */
|
||||
/* Structures and Types for the Debugger */
|
||||
/* ----------------------------------------- */
|
||||
|
||||
typedef enum {
|
||||
M64P_DBG_RUN_STATE = 1,
|
||||
M64P_DBG_PREVIOUS_PC,
|
||||
M64P_DBG_NUM_BREAKPOINTS,
|
||||
M64P_DBG_CPU_DYNACORE,
|
||||
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,
|
||||
M64P_DBG_MEM_HAS_RECOMPILED,
|
||||
M64P_DBG_MEM_NUM_RECOMPILED,
|
||||
M64P_DBG_RECOMP_OPCODE = 16,
|
||||
M64P_DBG_RECOMP_ARGS,
|
||||
M64P_DBG_RECOMP_ADDR
|
||||
} m64p_dbg_mem_info;
|
||||
|
||||
typedef enum {
|
||||
M64P_MEM_NOMEM = 0,
|
||||
M64P_MEM_NOTHING,
|
||||
M64P_MEM_RDRAM,
|
||||
M64P_MEM_RDRAMREG,
|
||||
M64P_MEM_RSPMEM,
|
||||
M64P_MEM_RSPREG,
|
||||
M64P_MEM_RSP,
|
||||
M64P_MEM_DP,
|
||||
M64P_MEM_DPS,
|
||||
M64P_MEM_VI,
|
||||
M64P_MEM_AI,
|
||||
M64P_MEM_PI,
|
||||
M64P_MEM_RI,
|
||||
M64P_MEM_SI,
|
||||
M64P_MEM_FLASHRAMSTAT,
|
||||
M64P_MEM_ROM,
|
||||
M64P_MEM_PIF,
|
||||
M64P_MEM_MI,
|
||||
M64P_MEM_BREAKPOINT
|
||||
} m64p_dbg_mem_type;
|
||||
|
||||
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_WRITABLE_EMUONLY = 0x08
|
||||
} m64p_dbg_mem_flags;
|
||||
|
||||
typedef enum {
|
||||
M64P_DBG_PTR_RDRAM = 1,
|
||||
M64P_DBG_PTR_PI_REG,
|
||||
M64P_DBG_PTR_SI_REG,
|
||||
M64P_DBG_PTR_VI_REG,
|
||||
M64P_DBG_PTR_RI_REG,
|
||||
M64P_DBG_PTR_AI_REG
|
||||
} m64p_dbg_memptr_type;
|
||||
|
||||
typedef enum {
|
||||
M64P_CPU_PC = 1,
|
||||
M64P_CPU_REG_REG,
|
||||
M64P_CPU_REG_HI,
|
||||
M64P_CPU_REG_LO,
|
||||
M64P_CPU_REG_COP0,
|
||||
M64P_CPU_REG_COP1_DOUBLE_PTR,
|
||||
M64P_CPU_REG_COP1_SIMPLE_PTR,
|
||||
M64P_CPU_REG_COP1_FGR_64,
|
||||
M64P_CPU_TLB
|
||||
} m64p_dbg_cpu_data;
|
||||
|
||||
typedef enum {
|
||||
M64P_BKP_CMD_ADD_ADDR = 1,
|
||||
M64P_BKP_CMD_ADD_STRUCT,
|
||||
M64P_BKP_CMD_REPLACE,
|
||||
M64P_BKP_CMD_REMOVE_ADDR,
|
||||
M64P_BKP_CMD_REMOVE_IDX,
|
||||
M64P_BKP_CMD_ENABLE,
|
||||
M64P_BKP_CMD_DISABLE,
|
||||
M64P_BKP_CMD_CHECK
|
||||
} m64p_dbg_bkp_command;
|
||||
|
||||
#define M64P_MEM_INVALID 0xFFFFFFFF /* invalid memory read will return this */
|
||||
|
||||
#define BREAKPOINTS_MAX_NUMBER 128
|
||||
|
||||
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 {
|
||||
uint32_t address;
|
||||
uint32_t endaddr;
|
||||
unsigned int flags;
|
||||
} m64p_breakpoint;
|
||||
|
||||
/* ------------------------------------------------- */
|
||||
/* Structures and Types for Core Video Extension API */
|
||||
/* ------------------------------------------------- */
|
||||
|
||||
typedef struct {
|
||||
unsigned int uiWidth;
|
||||
unsigned int uiHeight;
|
||||
} m64p_2d_size;
|
||||
|
||||
typedef enum {
|
||||
M64P_GL_DOUBLEBUFFER = 1,
|
||||
M64P_GL_BUFFER_SIZE,
|
||||
M64P_GL_DEPTH_SIZE,
|
||||
M64P_GL_RED_SIZE,
|
||||
M64P_GL_GREEN_SIZE,
|
||||
M64P_GL_BLUE_SIZE,
|
||||
M64P_GL_ALPHA_SIZE,
|
||||
M64P_GL_SWAP_CONTROL,
|
||||
M64P_GL_MULTISAMPLEBUFFERS,
|
||||
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);
|
||||
m64p_error (*VidExtFuncQuit)(void);
|
||||
m64p_error (*VidExtFuncListModes)(m64p_2d_size *, int *);
|
||||
m64p_error (*VidExtFuncSetMode)(int, int, int, int, int);
|
||||
void * (*VidExtFuncGLGetProc)(const char*);
|
||||
m64p_error (*VidExtFuncGLSetAttr)(m64p_GLattr, int);
|
||||
m64p_error (*VidExtFuncGLGetAttr)(m64p_GLattr, int *);
|
||||
m64p_error (*VidExtFuncGLSwapBuf)(void);
|
||||
m64p_error (*VidExtFuncSetCaption)(const char *);
|
||||
m64p_error (*VidExtFuncToggleFS)(void);
|
||||
m64p_error (*VidExtFuncResizeWindow)(int, int);
|
||||
} m64p_video_extension_functions;
|
||||
|
||||
#endif /* define M64P_TYPES_H */
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
#include "mupen_interface.h"
|
||||
#include <log.h>
|
||||
#include <frontend/render.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <SDL_video.h>
|
||||
|
||||
#define PARAM(name, value) if (strcmp(param, name) == 0) { return value; }
|
||||
|
||||
void init_mupen_interface() {
|
||||
printf("Initialized Mupen64Plus plugin interface\n");
|
||||
}
|
||||
|
||||
EXPORT m64p_error CALL ConfigOpenSection(const char* section, m64p_handle* handle) {
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
EXPORT m64p_error CALL ConfigSaveSection(const char* section) {
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
EXPORT m64p_error CALL ConfigSetDefaultInt(m64p_handle handle, const char* param, int value, const char* help) {
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
EXPORT m64p_error CALL ConfigSetDefaultFloat(m64p_handle handle, const char* param, float value, const char* help) {
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
EXPORT m64p_error CALL ConfigSetDefaultBool(m64p_handle handle, const char* param, int value, const char* help) {
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
EXPORT m64p_error CALL ConfigSetDefaultString(m64p_handle handle, const char* param, const char* value, const char* help) {
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
EXPORT m64p_error CALL VidExt_Init() {
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
EXPORT m64p_error CALL VidExt_GL_SetAttribute(m64p_GLattr attr, int arg1) {
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
EXPORT m64p_error CALL VidExt_SetVideoMode(int width, int height, int bits_per_pixel, m64p_video_mode mode, m64p_video_flags flags) {
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
EXPORT void* CALL VidExt_GL_GetProcAddress(const char* proc) {
|
||||
void* pointer = SDL_GL_GetProcAddress(proc);
|
||||
if (pointer == NULL) {
|
||||
logfatal("VidExt_GL_GetProcAddress: could not get address of %s!", proc);
|
||||
}
|
||||
|
||||
return pointer;
|
||||
}
|
||||
|
||||
EXPORT int CALL ConfigGetParamInt(m64p_handle handle, const char* param) {
|
||||
PARAM("ScreenWidth", N64_SCREEN_X * SCREEN_SCALE)
|
||||
PARAM("ScreenHeight", N64_SCREEN_Y * SCREEN_SCALE)
|
||||
PARAM("NumWorkers", 0)
|
||||
PARAM("ViMode", 0)
|
||||
PARAM("ViInterpolation", 0)
|
||||
PARAM("DpCompat", 0)
|
||||
|
||||
|
||||
logfatal("Unknown int param: %s", param);
|
||||
}
|
||||
|
||||
EXPORT float CALL ConfigGetParamFloat(m64p_handle handle, const char* param) {
|
||||
logfatal("Unknown float param: %s", param);
|
||||
}
|
||||
|
||||
EXPORT int CALL ConfigGetParamBool(m64p_handle handle, const char* param) {
|
||||
PARAM("Fullscreen", false)
|
||||
PARAM("Parallel", true)
|
||||
PARAM("ViWidescreen", false)
|
||||
PARAM("ViHideOverscan", false)
|
||||
PARAM("ViIntegerScaling", false)
|
||||
PARAM("BusyLoop", false)
|
||||
|
||||
|
||||
logfatal("Unknown bool param: %s", param);
|
||||
}
|
||||
|
||||
EXPORT const char * CALL ConfigGetParamString(m64p_handle handle, const char* param) {
|
||||
logfatal("Unknown string param: %s", param);
|
||||
}
|
||||
|
||||
EXPORT m64p_error CALL VidExt_Quit(void) {
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
EXPORT m64p_error CALL VidExt_GL_SwapBuffers(void) {
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
#ifndef N64_MUPEN_INTERFACE_H
|
||||
#define N64_MUPEN_INTERFACE_H
|
||||
|
||||
#include "contrib/m64p_types.h"
|
||||
#include "contrib/m64p_plugin.h"
|
||||
#include "contrib/m64p_common.h"
|
||||
#include <system/n64system.h>
|
||||
|
||||
void init_mupen_interface();
|
||||
|
||||
typedef struct mupen_graphics_plugin {
|
||||
const char* plugin_name;
|
||||
|
||||
// Called on startup. Gives the plugin some handles back into the core.
|
||||
ptr_PluginStartup PluginStartup;
|
||||
// Called on shutdown to clean up plugin stuff.
|
||||
ptr_PluginShutdown PluginShutdown;
|
||||
// Called when plugin loaded to retrieve version info
|
||||
ptr_PluginGetVersion PluginGetVersion;
|
||||
|
||||
|
||||
// This emulator does not support fullscreen (yet?) so this is never called.
|
||||
ptr_ChangeWindow ChangeWindow;
|
||||
// Called as the plugin is loaded. This sets up the graphics context, and lets the plugin access parts of the emulator's memory.
|
||||
ptr_InitiateGFX InitiateGFX;
|
||||
// TODO? Angrylion does not use this, so this is never called.
|
||||
ptr_MoveScreen MoveScreen;
|
||||
// Used by HLE RSP plugins, and HLE RDP plugins. Never called.
|
||||
ptr_ProcessDList ProcessDList;
|
||||
// Called by the RSP when a command needs to be run.
|
||||
ptr_ProcessRDPList ProcessRDPList;
|
||||
// For cleanup
|
||||
ptr_RomClosed RomClosed;
|
||||
// Initialization
|
||||
ptr_RomOpen RomOpen;
|
||||
// TODO? Angrylion does not use this, so this is never called. Might be used for HLE RSP emulation?
|
||||
ptr_ShowCFB ShowCFB;
|
||||
// Called on every VI interrupt, whether or not it's been masked to actually happen
|
||||
ptr_UpdateScreen UpdateScreen;
|
||||
// Called when VI_STATUS_REG is changed
|
||||
ptr_ViStatusChanged ViStatusChanged;
|
||||
// Called when VI_WIDTH_REG is changed
|
||||
ptr_ViWidthChanged ViWidthChanged;
|
||||
// Seems to be used for screenshots?
|
||||
ptr_ReadScreen2 ReadScreen2;
|
||||
// Used to set a function to be called when a new frame is rendered.
|
||||
ptr_SetRenderingCallback SetRenderingCallback;
|
||||
ptr_FBRead FBRead;
|
||||
ptr_FBWrite FBWrite;
|
||||
ptr_FBGetFrameBufferInfo FBGetFrameBufferInfo;
|
||||
} mupen_graphics_plugin_t;
|
||||
|
||||
#endif //N64_MUPEN_INTERFACE_H
|
125
src/rdp/rdp.c
125
src/rdp/rdp.c
|
@ -11,7 +11,6 @@
|
|||
#endif
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "mupen_interface.h"
|
||||
#include "parallel_rdp_wrapper.h"
|
||||
#include "softrdp.h"
|
||||
#include <log.h>
|
||||
|
@ -20,7 +19,6 @@
|
|||
#include <frontend/frontend.h>
|
||||
|
||||
static void* plugin_handle = NULL;
|
||||
static mupen_graphics_plugin_t graphics_plugin;
|
||||
static u32 rdram_size_word = N64_RDRAM_SIZE; // GFX_INFO needs this to be sent as a uint32
|
||||
|
||||
#define RDP_COMMAND_BUFFER_SIZE 0xFFFFF
|
||||
|
@ -64,113 +62,6 @@ void rdp_check_interrupts() {
|
|||
on_interrupt_change();
|
||||
}
|
||||
|
||||
GFX_INFO get_gfx_info() {
|
||||
GFX_INFO gfx_info;
|
||||
gfx_info.HEADER = n64sys.mem.rom.rom;
|
||||
gfx_info.RDRAM = n64sys.mem.rdram;
|
||||
gfx_info.DMEM = N64RSP.sp_dmem;
|
||||
gfx_info.IMEM = N64RSP.sp_imem;
|
||||
|
||||
gfx_info.MI_INTR_REG = &n64sys.mi.intr.raw;
|
||||
|
||||
gfx_info.DPC_START_REG = &n64sys.dpc.start;
|
||||
gfx_info.DPC_END_REG = &n64sys.dpc.end;
|
||||
gfx_info.DPC_CURRENT_REG = &n64sys.dpc.current;
|
||||
gfx_info.DPC_STATUS_REG = &n64sys.dpc.status.raw;
|
||||
gfx_info.DPC_CLOCK_REG = &n64sys.dpc.clock;
|
||||
gfx_info.DPC_BUFBUSY_REG = &n64sys.dpc.bufbusy;
|
||||
gfx_info.DPC_PIPEBUSY_REG = &n64sys.dpc.pipebusy;
|
||||
gfx_info.DPC_TMEM_REG = &n64sys.dpc.tmem;
|
||||
|
||||
gfx_info.VI_STATUS_REG = (unsigned int*) &n64sys.vi.status.raw;
|
||||
gfx_info.VI_ORIGIN_REG = (unsigned int*) &n64sys.vi.vi_origin;
|
||||
gfx_info.VI_WIDTH_REG = (unsigned int*) &n64sys.vi.vi_width;
|
||||
gfx_info.VI_INTR_REG = (unsigned int*) &n64sys.vi.vi_v_intr;
|
||||
gfx_info.VI_V_CURRENT_LINE_REG = (unsigned int*) &n64sys.vi.v_current;
|
||||
gfx_info.VI_TIMING_REG = (unsigned int*) &n64sys.vi.vi_burst;
|
||||
gfx_info.VI_V_SYNC_REG = (unsigned int*) &n64sys.vi.vsync;
|
||||
gfx_info.VI_H_SYNC_REG = (unsigned int*) &n64sys.vi.hsync;
|
||||
gfx_info.VI_LEAP_REG = (unsigned int*) &n64sys.vi.leap;
|
||||
gfx_info.VI_H_START_REG = (unsigned int*) &n64sys.vi.hstart;
|
||||
gfx_info.VI_V_START_REG = (unsigned int*) &n64sys.vi.vstart;
|
||||
gfx_info.VI_V_BURST_REG = (unsigned int*) &n64sys.vi.vburst;
|
||||
gfx_info.VI_X_SCALE_REG = (unsigned int*) &n64sys.vi.xscale;
|
||||
gfx_info.VI_Y_SCALE_REG = (unsigned int*) &n64sys.vi.yscale;
|
||||
|
||||
gfx_info.CheckInterrupts = &rdp_check_interrupts;
|
||||
|
||||
gfx_info.version = 2;
|
||||
|
||||
gfx_info.SP_STATUS_REG = (unsigned int*) &N64RSP.status;
|
||||
gfx_info.RDRAM_SIZE = &rdram_size_word;
|
||||
|
||||
return gfx_info;
|
||||
}
|
||||
|
||||
void load_rdp_plugin(const char* filename) {
|
||||
#ifdef N64_WIN
|
||||
logfatal("Loading RDP plugins is not supported on windows!");
|
||||
#else
|
||||
char path[PATH_MAX] = "";
|
||||
if (filename[0] == '.' || filename[0] == '/') {
|
||||
snprintf(path, sizeof(path), "%s", filename);
|
||||
} else {
|
||||
snprintf(path, sizeof(path), "./%s", filename);
|
||||
}
|
||||
|
||||
plugin_handle = dlopen(path, RTLD_NOW);
|
||||
if (plugin_handle == NULL) {
|
||||
logfatal("Failed to load RDP plugin. Please pass a path to a shared library file!");
|
||||
}
|
||||
|
||||
init_mupen_interface();
|
||||
|
||||
LOAD_SYM(graphics_plugin.PluginStartup, "PluginStartup");
|
||||
LOAD_SYM(graphics_plugin.PluginGetVersion, "PluginGetVersion");
|
||||
LOAD_SYM(graphics_plugin.ChangeWindow, "ChangeWindow");
|
||||
LOAD_SYM(graphics_plugin.InitiateGFX, "InitiateGFX");
|
||||
LOAD_SYM(graphics_plugin.MoveScreen, "MoveScreen");
|
||||
LOAD_SYM(graphics_plugin.ProcessDList, "ProcessDList");
|
||||
LOAD_SYM(graphics_plugin.ProcessRDPList, "ProcessRDPList");
|
||||
LOAD_SYM(graphics_plugin.RomClosed, "RomClosed");
|
||||
LOAD_SYM(graphics_plugin.RomOpen, "RomOpen");
|
||||
LOAD_SYM(graphics_plugin.ShowCFB, "ShowCFB");
|
||||
LOAD_SYM(graphics_plugin.UpdateScreen, "UpdateScreen");
|
||||
LOAD_SYM(graphics_plugin.ViStatusChanged, "ViStatusChanged");
|
||||
LOAD_SYM(graphics_plugin.ViWidthChanged, "ViWidthChanged");
|
||||
LOAD_SYM(graphics_plugin.ReadScreen2, "ReadScreen2");
|
||||
LOAD_SYM(graphics_plugin.SetRenderingCallback, "SetRenderingCallback");
|
||||
LOAD_SYM(graphics_plugin.FBRead, "FBRead");
|
||||
LOAD_SYM(graphics_plugin.FBWrite, "FBWrite");
|
||||
LOAD_SYM(graphics_plugin.FBGetFrameBufferInfo, "FBGetFrameBufferInfo");
|
||||
|
||||
m64p_plugin_type plugin_type;
|
||||
int plugin_version;
|
||||
int api_version;
|
||||
const char* plugin_name;
|
||||
int capabilities;
|
||||
|
||||
|
||||
graphics_plugin.PluginGetVersion(&plugin_type, &plugin_version, &api_version, &plugin_name, &capabilities);
|
||||
if (plugin_type != M64PLUGIN_GFX) {
|
||||
logfatal("Plugin loaded successfully, but was not a graphics plugin!");
|
||||
}
|
||||
|
||||
graphics_plugin.PluginStartup(NULL, NULL, NULL); // Null handle, null debug callbacks.
|
||||
|
||||
GFX_INFO gfx_info = get_gfx_info();
|
||||
|
||||
graphics_plugin.InitiateGFX(gfx_info);
|
||||
graphics_plugin.RomOpen();
|
||||
|
||||
graphics_plugin.SetRenderingCallback(rdp_rendering_callback);
|
||||
|
||||
// TODO: check plugin version, API version, etc for compatibility
|
||||
|
||||
printf("Loaded RDP plugin %s\n", plugin_name);
|
||||
#endif
|
||||
}
|
||||
|
||||
void write_word_dpcreg(u32 address, u32 value) {
|
||||
switch (address) {
|
||||
case ADDR_DPC_START_REG:
|
||||
|
@ -222,18 +113,10 @@ u32 read_word_dpcreg(u32 address) {
|
|||
}
|
||||
}
|
||||
|
||||
void rdp_cleanup() {
|
||||
if (graphics_plugin.RomClosed) {
|
||||
graphics_plugin.RomClosed();
|
||||
}
|
||||
}
|
||||
|
||||
INLINE void rdp_enqueue_command(int command_length, u32* buffer) {
|
||||
switch (n64sys.video_type) {
|
||||
case UNKNOWN_VIDEO_TYPE:
|
||||
logfatal("RDP enqueue command with video type UNKNOWN_VIDEO_TYPE");
|
||||
case OPENGL_VIDEO_TYPE:
|
||||
logfatal("RDP enqueue command with video type OPENGL_VIDEO_TYPE");
|
||||
case VULKAN_VIDEO_TYPE:
|
||||
case QT_VULKAN_VIDEO_TYPE:
|
||||
prdp_enqueue_command(command_length, buffer); break;
|
||||
|
@ -246,8 +129,6 @@ INLINE void rdp_on_full_sync() {
|
|||
switch (n64sys.video_type) {
|
||||
case UNKNOWN_VIDEO_TYPE:
|
||||
logfatal("RDP on full sync with video type UNKNOWN_VIDEO_TYPE");
|
||||
case OPENGL_VIDEO_TYPE:
|
||||
logfatal("RDP on full sync with video type OPENGL_VIDEO_TYPE");
|
||||
case VULKAN_VIDEO_TYPE:
|
||||
case QT_VULKAN_VIDEO_TYPE:
|
||||
prdp_on_full_sync(); break;
|
||||
|
@ -358,9 +239,6 @@ void process_rdp_list() {
|
|||
void rdp_run_command() {
|
||||
//printf("Running commands from 0x%08X to 0x%08X\n", n64sys.dpc.current, n64sys.dpc.end);
|
||||
switch (n64sys.video_type) {
|
||||
case OPENGL_VIDEO_TYPE:
|
||||
graphics_plugin.ProcessRDPList();
|
||||
break;
|
||||
case VULKAN_VIDEO_TYPE:
|
||||
case QT_VULKAN_VIDEO_TYPE:
|
||||
case SOFTWARE_VIDEO_TYPE:
|
||||
|
@ -373,9 +251,6 @@ void rdp_run_command() {
|
|||
|
||||
void rdp_update_screen() {
|
||||
switch (n64sys.video_type) {
|
||||
case OPENGL_VIDEO_TYPE:
|
||||
graphics_plugin.UpdateScreen();
|
||||
break;
|
||||
case VULKAN_VIDEO_TYPE:
|
||||
case QT_VULKAN_VIDEO_TYPE:
|
||||
prdp_update_screen();
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#ifndef N64_RDP_H
|
||||
#define N64_RDP_H
|
||||
#include <system/n64system.h>
|
||||
#include "mupen_interface.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -10,11 +9,9 @@ extern "C" {
|
|||
void load_rdp_plugin(const char* filename);
|
||||
void write_word_dpcreg(u32 address, u32 value);
|
||||
u32 read_word_dpcreg(u32 address);
|
||||
void rdp_cleanup();
|
||||
void rdp_run_command();
|
||||
void rdp_update_screen();
|
||||
void rdp_status_reg_write(u32 value);
|
||||
GFX_INFO get_gfx_info();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -425,7 +425,6 @@ void n64_system_loop() {
|
|||
}
|
||||
|
||||
void n64_system_cleanup() {
|
||||
rdp_cleanup();
|
||||
if (n64sys.dynarec != NULL) {
|
||||
free(n64sys.dynarec);
|
||||
n64sys.dynarec = NULL;
|
||||
|
|
|
@ -31,7 +31,6 @@ extern "C" {
|
|||
|
||||
typedef enum n64_video_type {
|
||||
UNKNOWN_VIDEO_TYPE,
|
||||
OPENGL_VIDEO_TYPE,
|
||||
VULKAN_VIDEO_TYPE,
|
||||
QT_VULKAN_VIDEO_TYPE,
|
||||
SOFTWARE_VIDEO_TYPE
|
||||
|
|
|
@ -463,7 +463,6 @@ void check_jit_sync_log(FILE* fp) {
|
|||
|
||||
int main(int argc, char** argv) {
|
||||
const char* log_file = NULL;
|
||||
const char* rdp_plugin_path = NULL;
|
||||
bool test_rsp = false;
|
||||
bool test_jit_sync = false;
|
||||
|
||||
|
@ -472,7 +471,6 @@ int main(int argc, char** argv) {
|
|||
cflags_add_string(flags, 'f', "log-file", &log_file, "log file to check run against");
|
||||
cflags_add_bool(flags, 's', "rsp", &test_rsp, "check RSP log file instead of CPU log file");
|
||||
cflags_add_bool(flags, 'j', "jitsync", &test_jit_sync, "check JIT sync point log file against interpreter instead of CPU log file");
|
||||
cflags_add_string(flags, 'r', "rdp", &rdp_plugin_path, "Load RDP plugin (Mupen64Plus compatible)");
|
||||
|
||||
const char* pif_rom_path = NULL;
|
||||
cflags_add_string(flags, 'p', "pif", &pif_rom_path, "Load PIF ROM");
|
||||
|
@ -498,13 +496,9 @@ int main(int argc, char** argv) {
|
|||
|
||||
log_set_verbosity(verbose->count);
|
||||
|
||||
if (rdp_plugin_path != NULL) {
|
||||
init_n64system(rom, true, false, OPENGL_VIDEO_TYPE, false);
|
||||
load_rdp_plugin(rdp_plugin_path);
|
||||
} else {
|
||||
init_n64system(rom, true, false, VULKAN_VIDEO_TYPE, false);
|
||||
prdp_init_internal_swapchain();
|
||||
}
|
||||
init_n64system(rom, true, false, VULKAN_VIDEO_TYPE, false);
|
||||
prdp_init_internal_swapchain();
|
||||
|
||||
if (pif_rom_path) {
|
||||
load_pif_rom(pif_rom_path);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue