mirror of
https://github.com/libretro/beetle-pce-fast-libretro.git
synced 2024-11-22 23:39:50 +00:00
- Remove unused EmulatedPCEFast
- Move code around in pce_fast/input.c to avoid forward declaration
This commit is contained in:
parent
07ffa1a90f
commit
e537fe28c2
30
libretro.cpp
30
libretro.cpp
@ -68,12 +68,6 @@ std::string setting_pce_fast_cdbios = "syscard3.pce";
|
||||
|
||||
static int16_t sound_buf[0x10000];
|
||||
|
||||
extern MDFNGI EmulatedPCE_Fast;
|
||||
|
||||
extern "C" {
|
||||
MDFNGI *MDFNGameInfo = &EmulatedPCE_Fast;
|
||||
}
|
||||
|
||||
/* Composite palette 2020/09/14
|
||||
* authors: Dshadoff, Turboxray, Furrtek, Kitrinx and others
|
||||
*/
|
||||
@ -1369,23 +1363,6 @@ bool IsBRAMUsed(void)
|
||||
return(0);
|
||||
}
|
||||
|
||||
MDFNGI EmulatedPCE_Fast =
|
||||
{
|
||||
true, // Multires possible?
|
||||
|
||||
0, // lcm_width
|
||||
0, // lcm_height
|
||||
NULL, // Dummy
|
||||
|
||||
MEDNAFEN_CORE_GEOMETRY_BASE_W, // Nominal width
|
||||
MEDNAFEN_CORE_GEOMETRY_BASE_H, // Nominal height
|
||||
|
||||
FB_WIDTH, // Framebuffer width
|
||||
FB_HEIGHT, // Framebuffer height
|
||||
|
||||
2, // Number of output sound channels
|
||||
};
|
||||
|
||||
static void ReadM3U(std::vector<std::string> &file_list, std::string path, unsigned depth = 0)
|
||||
{
|
||||
std::string dir_path;
|
||||
@ -1485,7 +1462,6 @@ static bool MDFNI_LoadCD(const char *path, const char *ext)
|
||||
delete CDInterfaces[i];
|
||||
CDInterfaces.clear();
|
||||
|
||||
MDFNGameInfo = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1501,7 +1477,6 @@ static bool MDFNI_LoadGame(const char *path, const char *ext,
|
||||
const uint8_t *data, size_t size)
|
||||
{
|
||||
MDFNFILE *GameFile = NULL;
|
||||
MDFNGameInfo = &EmulatedPCE_Fast;
|
||||
const uint8_t *content_data = NULL;
|
||||
size_t content_size = 0;
|
||||
|
||||
@ -1551,7 +1526,6 @@ static bool MDFNI_LoadGame(const char *path, const char *ext,
|
||||
error:
|
||||
if (GameFile)
|
||||
file_close(GameFile);
|
||||
MDFNGameInfo = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -2135,8 +2109,6 @@ bool retro_load_game(const struct retro_game_info *info)
|
||||
void retro_unload_game(void)
|
||||
{
|
||||
unsigned i;
|
||||
if(!MDFNGameInfo)
|
||||
return;
|
||||
|
||||
MDFN_FlushGameCheats(0);
|
||||
|
||||
@ -2144,8 +2116,6 @@ void retro_unload_game(void)
|
||||
|
||||
MDFNMP_Kill();
|
||||
|
||||
MDFNGameInfo = NULL;
|
||||
|
||||
for(i = 0; i < CDInterfaces.size(); i++)
|
||||
delete CDInterfaces[i];
|
||||
CDInterfaces.clear();
|
||||
|
125
mednafen/git.h
125
mednafen/git.h
@ -7,33 +7,6 @@
|
||||
#include "state.h"
|
||||
#include "video.h"
|
||||
|
||||
enum
|
||||
{
|
||||
MDFN_ROTATE0 = 0,
|
||||
MDFN_ROTATE90,
|
||||
MDFN_ROTATE180,
|
||||
MDFN_ROTATE270
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
VIDSYS_NONE, // Can be used internally in system emulation code, but it is an error condition to let it continue to be
|
||||
// after the Load() or LoadCD() function returns!
|
||||
VIDSYS_PAL,
|
||||
VIDSYS_PAL_M, // Same timing as NTSC, but uses PAL-style colour encoding
|
||||
VIDSYS_NTSC,
|
||||
VIDSYS_SECAM
|
||||
} VideoSystems;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GMT_CART, // Self-explanatory!
|
||||
GMT_ARCADE, // VS Unisystem, PC-10...
|
||||
GMT_DISK, // Famicom Disk System, mostly
|
||||
GMT_CDROM, // PC Engine CD, PC-FX
|
||||
GMT_PLAYER // Music player(NSF, HES, GSF)
|
||||
} GameMediumTypes;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
IDIT_BUTTON, // 1-bit
|
||||
@ -61,8 +34,6 @@ typedef struct
|
||||
// due to physical limitations.
|
||||
|
||||
const char *RotateName[3]; // 90, 180, 270
|
||||
//const char *Rotate180Name;
|
||||
//const char *Rotate270Name;
|
||||
} InputDeviceInputInfoStruct;
|
||||
|
||||
typedef struct
|
||||
@ -115,45 +86,6 @@ enum
|
||||
MDFN_MSC_RESET = 0x01,
|
||||
MDFN_MSC_POWER = 0x02,
|
||||
|
||||
MDFN_MSC_INSERT_COIN = 0x07,
|
||||
|
||||
// If we ever support arcade systems, we'll abstract DIP switches differently...maybe.
|
||||
MDFN_MSC_TOGGLE_DIP0 = 0x10,
|
||||
MDFN_MSC_TOGGLE_DIP1,
|
||||
MDFN_MSC_TOGGLE_DIP2,
|
||||
MDFN_MSC_TOGGLE_DIP3,
|
||||
MDFN_MSC_TOGGLE_DIP4,
|
||||
MDFN_MSC_TOGGLE_DIP5,
|
||||
MDFN_MSC_TOGGLE_DIP6,
|
||||
MDFN_MSC_TOGGLE_DIP7,
|
||||
MDFN_MSC_TOGGLE_DIP8,
|
||||
MDFN_MSC_TOGGLE_DIP9,
|
||||
MDFN_MSC_TOGGLE_DIP10,
|
||||
MDFN_MSC_TOGGLE_DIP11,
|
||||
MDFN_MSC_TOGGLE_DIP12,
|
||||
MDFN_MSC_TOGGLE_DIP13,
|
||||
MDFN_MSC_TOGGLE_DIP14,
|
||||
MDFN_MSC_TOGGLE_DIP15,
|
||||
|
||||
|
||||
// n of DISKn translates to is emulation module specific.
|
||||
MDFN_MSC_INSERT_DISK0 = 0x20,
|
||||
MDFN_MSC_INSERT_DISK1,
|
||||
MDFN_MSC_INSERT_DISK2,
|
||||
MDFN_MSC_INSERT_DISK3,
|
||||
MDFN_MSC_INSERT_DISK4,
|
||||
MDFN_MSC_INSERT_DISK5,
|
||||
MDFN_MSC_INSERT_DISK6,
|
||||
MDFN_MSC_INSERT_DISK7,
|
||||
MDFN_MSC_INSERT_DISK8,
|
||||
MDFN_MSC_INSERT_DISK9,
|
||||
MDFN_MSC_INSERT_DISK10,
|
||||
MDFN_MSC_INSERT_DISK11,
|
||||
MDFN_MSC_INSERT_DISK12,
|
||||
MDFN_MSC_INSERT_DISK13,
|
||||
MDFN_MSC_INSERT_DISK14,
|
||||
MDFN_MSC_INSERT_DISK15,
|
||||
|
||||
MDFN_MSC_INSERT_DISK = 0x30,
|
||||
MDFN_MSC_EJECT_DISK = 0x31,
|
||||
|
||||
@ -209,63 +141,6 @@ typedef struct
|
||||
int32 SoundBufSize;
|
||||
} EmulateSpecStruct;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MODPRIO_INTERNAL_EXTRA_LOW = 0, // For "cdplay" module, mostly.
|
||||
|
||||
MODPRIO_INTERNAL_LOW = 10,
|
||||
MODPRIO_EXTERNAL_LOW = 20,
|
||||
MODPRIO_INTERNAL_HIGH = 30,
|
||||
MODPRIO_EXTERNAL_HIGH = 40
|
||||
} ModPrio;
|
||||
|
||||
#define MDFN_MASTERCLOCK_FIXED(n) ((int64)((double)(n) * (1LL << 32)))
|
||||
|
||||
typedef struct
|
||||
{
|
||||
// multires is a hint that, if set, indicates that the system has fairly programmable video modes(particularly, the ability
|
||||
// to display multiple horizontal resolutions, such as the PCE, PC-FX, or Genesis). In practice, it will cause the driver
|
||||
// code to set the linear interpolation on by default.
|
||||
//
|
||||
// lcm_width and lcm_height are the least common multiples of all possible
|
||||
// resolutions in the frame buffer as specified by DisplayRect/LineWidths(Ex for PCE: widths of 256, 341.333333, 512,
|
||||
// lcm = 1024)
|
||||
//
|
||||
// nominal_width and nominal_height specify the resolution that Mednafen should display
|
||||
// the framebuffer image in at 1x scaling, scaled from the dimensions of DisplayRect, and optionally the LineWidths array
|
||||
// passed through espec to the Emulate() function.
|
||||
//
|
||||
bool multires;
|
||||
|
||||
int lcm_width;
|
||||
int lcm_height;
|
||||
|
||||
void *dummy_separator; //
|
||||
|
||||
int nominal_width;
|
||||
int nominal_height;
|
||||
|
||||
int fb_width; // Width of the framebuffer(not necessarily width of the image). MDFN_Surface width should be >= this.
|
||||
int fb_height; // Height of the framebuffer passed to the Emulate() function(not necessarily height of the image)
|
||||
|
||||
int soundchan; // Number of output sound channels.
|
||||
|
||||
|
||||
int rotated;
|
||||
|
||||
int soundrate; /* For Ogg Vorbis expansion sound wacky support. 0 for default. */
|
||||
|
||||
VideoSystems VideoSystem;
|
||||
GameMediumTypes GameType;
|
||||
|
||||
//int DiskLogicalCount; // A single double-sided disk would be 2 here.
|
||||
//const char *DiskNames; // Null-terminated.
|
||||
|
||||
const char *cspecial; /* Special cart expansion: DIP switches, barcode reader, etc. */
|
||||
|
||||
double mouse_sensitivity;
|
||||
} MDFNGI;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -29,7 +29,6 @@ void MDFN_MidLineUpdate(EmulateSpecStruct *espec, int y);
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern MDFNGI *MDFNGameInfo;
|
||||
void MDFN_DispMessage(const char *format, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -45,11 +45,96 @@ static uint8 mouse_index[5];
|
||||
static uint8 sel;
|
||||
static uint8 read_index = 0;
|
||||
|
||||
static void SyncSettings(void);
|
||||
|
||||
void PCEINPUT_SettingChanged(const char *name)
|
||||
// GamepadIDII and GamepadIDII_DSR must be EXACTLY the same except for the RUN+SELECT exclusion in the latter.
|
||||
static const InputDeviceInputInfoStruct GamepadIDII[] =
|
||||
{
|
||||
SyncSettings();
|
||||
{ "i", "I", 12, IDIT_BUTTON_CAN_RAPID, NULL },
|
||||
{ "ii", "II", 11, IDIT_BUTTON_CAN_RAPID, NULL },
|
||||
{ "select", "SELECT", 4, IDIT_BUTTON, NULL },
|
||||
{ "run", "RUN", 5, IDIT_BUTTON, NULL },
|
||||
{ "up", "UP", 0, IDIT_BUTTON, "down" },
|
||||
{ "right", "RIGHT", 3, IDIT_BUTTON, "left" },
|
||||
{ "down", "DOWN", 1, IDIT_BUTTON, "up" },
|
||||
{ "left", "LEFT", 2, IDIT_BUTTON, "right" },
|
||||
{ "iii", "III", 10, IDIT_BUTTON, NULL },
|
||||
{ "iv", "IV", 7, IDIT_BUTTON, NULL },
|
||||
{ "v", "V", 8, IDIT_BUTTON, NULL },
|
||||
{ "vi", "VI", 9, IDIT_BUTTON, NULL },
|
||||
{ "mode_select", "2/6 Mode Select", 6, IDIT_BUTTON, NULL },
|
||||
};
|
||||
static const InputDeviceInputInfoStruct GamepadIDII_DSR[] =
|
||||
{
|
||||
{ "i", "I", 12, IDIT_BUTTON_CAN_RAPID, NULL },
|
||||
{ "ii", "II", 11, IDIT_BUTTON_CAN_RAPID, NULL },
|
||||
{ "select", "SELECT", 4, IDIT_BUTTON, "run" },
|
||||
{ "run", "RUN", 5, IDIT_BUTTON, "select" },
|
||||
{ "up", "UP", 0, IDIT_BUTTON, "down" },
|
||||
{ "right", "RIGHT", 3, IDIT_BUTTON, "left" },
|
||||
{ "down", "DOWN", 1, IDIT_BUTTON, "up" },
|
||||
{ "left", "LEFT", 2, IDIT_BUTTON, "right" },
|
||||
{ "iii", "III", 10, IDIT_BUTTON, NULL },
|
||||
{ "iv", "IV", 7, IDIT_BUTTON, NULL },
|
||||
{ "v", "V", 8, IDIT_BUTTON, NULL },
|
||||
{ "vi", "VI", 9, IDIT_BUTTON, NULL },
|
||||
{ "mode_select", "2/6 Mode Select", 6, IDIT_BUTTON, NULL },
|
||||
};
|
||||
|
||||
static const InputDeviceInputInfoStruct MouseIDII[] =
|
||||
{
|
||||
{ "x_axis", "X Axis", -1, IDIT_X_AXIS_REL },
|
||||
{ "y_axis", "Y Axis", -1, IDIT_Y_AXIS_REL },
|
||||
{ "left", "Left Button", 0, IDIT_BUTTON, NULL },
|
||||
{ "right", "Right Button", 1, IDIT_BUTTON, NULL },
|
||||
};
|
||||
|
||||
// If we add more devices to this array, REMEMBER TO UPDATE the hackish array indexing in the SyncSettings() function
|
||||
// below.
|
||||
static InputDeviceInfoStruct InputDeviceInfo[] =
|
||||
{
|
||||
// None
|
||||
{
|
||||
"none",
|
||||
"none",
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
NULL
|
||||
},
|
||||
|
||||
// Gamepad
|
||||
{
|
||||
"gamepad",
|
||||
"Gamepad",
|
||||
NULL,
|
||||
NULL,
|
||||
sizeof(GamepadIDII) / sizeof(InputDeviceInputInfoStruct),
|
||||
GamepadIDII,
|
||||
},
|
||||
|
||||
// Mouse
|
||||
{
|
||||
"mouse",
|
||||
"Mouse",
|
||||
NULL,
|
||||
NULL,
|
||||
sizeof(MouseIDII) / sizeof(InputDeviceInputInfoStruct),
|
||||
MouseIDII,
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
static const InputPortInfoStruct PortInfo[] =
|
||||
{
|
||||
{ "port1", "Port 1", sizeof(InputDeviceInfo) / sizeof(InputDeviceInfoStruct), InputDeviceInfo, "gamepad" },
|
||||
{ "port2", "Port 2", sizeof(InputDeviceInfo) / sizeof(InputDeviceInfoStruct), InputDeviceInfo, "gamepad" },
|
||||
{ "port3", "Port 3", sizeof(InputDeviceInfo) / sizeof(InputDeviceInfoStruct), InputDeviceInfo, "gamepad" },
|
||||
{ "port4", "Port 4", sizeof(InputDeviceInfo) / sizeof(InputDeviceInfoStruct), InputDeviceInfo, "gamepad" },
|
||||
{ "port5", "Port 5", sizeof(InputDeviceInfo) / sizeof(InputDeviceInfoStruct), InputDeviceInfo, "gamepad" },
|
||||
};
|
||||
|
||||
static void SyncSettings(void)
|
||||
{
|
||||
InputDeviceInfo[1].IDII = MDFN_GetSettingB("pce_fast.disable_softreset") ? GamepadIDII_DSR : GamepadIDII;
|
||||
}
|
||||
|
||||
void PCEINPUT_Init(void)
|
||||
@ -189,11 +274,9 @@ uint8 INPUT_Read(unsigned int A)
|
||||
if(!PCE_IsCD)
|
||||
ret |= 0x80; // Set when CDROM is not attached
|
||||
|
||||
//ret |= 0x40; // PC Engine if set, TG16 if clear. Let's leave it clear, PC Engine games don't seem to mind if it's clear, but TG16 games barf if it's set.
|
||||
|
||||
ret |= 0x30; // Always-set?
|
||||
|
||||
return(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void INPUT_Write(unsigned int A, uint8 V)
|
||||
@ -234,106 +317,5 @@ int INPUT_StateAction(StateMem *sm, int load, int data_only)
|
||||
SFVAR(read_index),
|
||||
SFEND
|
||||
};
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "JOY", false);
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
// GamepadIDII and GamepadIDII_DSR must be EXACTLY the same except for the RUN+SELECT exclusion in the latter.
|
||||
static const InputDeviceInputInfoStruct GamepadIDII[] =
|
||||
{
|
||||
{ "i", "I", 12, IDIT_BUTTON_CAN_RAPID, NULL },
|
||||
{ "ii", "II", 11, IDIT_BUTTON_CAN_RAPID, NULL },
|
||||
{ "select", "SELECT", 4, IDIT_BUTTON, NULL },
|
||||
{ "run", "RUN", 5, IDIT_BUTTON, NULL },
|
||||
{ "up", "UP", 0, IDIT_BUTTON, "down" },
|
||||
{ "right", "RIGHT", 3, IDIT_BUTTON, "left" },
|
||||
{ "down", "DOWN", 1, IDIT_BUTTON, "up" },
|
||||
{ "left", "LEFT", 2, IDIT_BUTTON, "right" },
|
||||
{ "iii", "III", 10, IDIT_BUTTON, NULL },
|
||||
{ "iv", "IV", 7, IDIT_BUTTON, NULL },
|
||||
{ "v", "V", 8, IDIT_BUTTON, NULL },
|
||||
{ "vi", "VI", 9, IDIT_BUTTON, NULL },
|
||||
{ "mode_select", "2/6 Mode Select", 6, IDIT_BUTTON, NULL },
|
||||
};
|
||||
static const InputDeviceInputInfoStruct GamepadIDII_DSR[] =
|
||||
{
|
||||
{ "i", "I", 12, IDIT_BUTTON_CAN_RAPID, NULL },
|
||||
{ "ii", "II", 11, IDIT_BUTTON_CAN_RAPID, NULL },
|
||||
{ "select", "SELECT", 4, IDIT_BUTTON, "run" },
|
||||
{ "run", "RUN", 5, IDIT_BUTTON, "select" },
|
||||
{ "up", "UP", 0, IDIT_BUTTON, "down" },
|
||||
{ "right", "RIGHT", 3, IDIT_BUTTON, "left" },
|
||||
{ "down", "DOWN", 1, IDIT_BUTTON, "up" },
|
||||
{ "left", "LEFT", 2, IDIT_BUTTON, "right" },
|
||||
{ "iii", "III", 10, IDIT_BUTTON, NULL },
|
||||
{ "iv", "IV", 7, IDIT_BUTTON, NULL },
|
||||
{ "v", "V", 8, IDIT_BUTTON, NULL },
|
||||
{ "vi", "VI", 9, IDIT_BUTTON, NULL },
|
||||
{ "mode_select", "2/6 Mode Select", 6, IDIT_BUTTON, NULL },
|
||||
};
|
||||
|
||||
static const InputDeviceInputInfoStruct MouseIDII[] =
|
||||
{
|
||||
{ "x_axis", "X Axis", -1, IDIT_X_AXIS_REL },
|
||||
{ "y_axis", "Y Axis", -1, IDIT_Y_AXIS_REL },
|
||||
{ "left", "Left Button", 0, IDIT_BUTTON, NULL },
|
||||
{ "right", "Right Button", 1, IDIT_BUTTON, NULL },
|
||||
};
|
||||
|
||||
// If we add more devices to this array, REMEMBER TO UPDATE the hackish array indexing in the SyncSettings() function
|
||||
// below.
|
||||
static InputDeviceInfoStruct InputDeviceInfo[] =
|
||||
{
|
||||
// None
|
||||
{
|
||||
"none",
|
||||
"none",
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
NULL
|
||||
},
|
||||
|
||||
// Gamepad
|
||||
{
|
||||
"gamepad",
|
||||
"Gamepad",
|
||||
NULL,
|
||||
NULL,
|
||||
sizeof(GamepadIDII) / sizeof(InputDeviceInputInfoStruct),
|
||||
GamepadIDII,
|
||||
},
|
||||
|
||||
// Mouse
|
||||
{
|
||||
"mouse",
|
||||
"Mouse",
|
||||
NULL,
|
||||
NULL,
|
||||
sizeof(MouseIDII) / sizeof(InputDeviceInputInfoStruct),
|
||||
MouseIDII,
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
static const InputPortInfoStruct PortInfo[] =
|
||||
{
|
||||
{ "port1", "Port 1", sizeof(InputDeviceInfo) / sizeof(InputDeviceInfoStruct), InputDeviceInfo, "gamepad" },
|
||||
{ "port2", "Port 2", sizeof(InputDeviceInfo) / sizeof(InputDeviceInfoStruct), InputDeviceInfo, "gamepad" },
|
||||
{ "port3", "Port 3", sizeof(InputDeviceInfo) / sizeof(InputDeviceInfoStruct), InputDeviceInfo, "gamepad" },
|
||||
{ "port4", "Port 4", sizeof(InputDeviceInfo) / sizeof(InputDeviceInfoStruct), InputDeviceInfo, "gamepad" },
|
||||
{ "port5", "Port 5", sizeof(InputDeviceInfo) / sizeof(InputDeviceInfoStruct), InputDeviceInfo, "gamepad" },
|
||||
};
|
||||
|
||||
InputInfoStruct PCEInputInfo =
|
||||
{
|
||||
sizeof(PortInfo) / sizeof(InputPortInfoStruct),
|
||||
PortInfo
|
||||
};
|
||||
|
||||
static void SyncSettings(void)
|
||||
{
|
||||
MDFNGameInfo->mouse_sensitivity = MDFN_GetSettingF("pce_fast.mouse_sensitivity");
|
||||
InputDeviceInfo[1].IDII = MDFN_GetSettingB("pce_fast.disable_softreset") ? GamepadIDII_DSR : GamepadIDII;
|
||||
return MDFNSS_StateAction(sm, load, data_only, StateRegs, "JOY", false);
|
||||
}
|
||||
|
@ -11,13 +11,11 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
void PCEINPUT_Init(void);
|
||||
void PCEINPUT_SettingChanged(const char *name);
|
||||
void PCEINPUT_SetInput(unsigned port, const char *type, uint8 *ptr);
|
||||
uint8 INPUT_Read(unsigned int A);
|
||||
void INPUT_Write(unsigned int A, uint8 V);
|
||||
void INPUT_Frame(void);
|
||||
int INPUT_StateAction(StateMem *sm, int load, int data_only);
|
||||
extern InputInfoStruct PCEInputInfo;
|
||||
void INPUT_FixTS(void);
|
||||
extern bool AVPad6Enabled[5];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user