mirror of
https://github.com/libretro/beetle-pce-fast-libretro.git
synced 2024-11-23 07:50:03 +00:00
Start removing most of MDFNGameInfo
This commit is contained in:
parent
604c2a2e28
commit
7657a5cfbb
49
libretro.cpp
49
libretro.cpp
@ -275,7 +275,9 @@ static int LoadCommon(void)
|
||||
|
||||
PCE_Power();
|
||||
|
||||
#if 0
|
||||
MDFNGameInfo->LayerNames = "Background\0Sprites\0";
|
||||
#endif
|
||||
MDFNGameInfo->fps = (uint32)((double)7159090.90909090 / 455 / 263 * 65536 * 256);
|
||||
|
||||
// Clean this up:
|
||||
@ -449,7 +451,7 @@ static void Emulate(EmulateSpecStruct *espec)
|
||||
PCECD_ResetTS();
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
@ -528,7 +530,7 @@ static MDFNSetting PCESettings[] =
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static uint8 MemRead(uint32 addr)
|
||||
uint8 MemRead(uint32 addr)
|
||||
{
|
||||
return(PCERead[(addr / 8192) & 0xFF](addr));
|
||||
}
|
||||
@ -844,30 +846,6 @@ void HuC_Power(void)
|
||||
|
||||
MDFNGI EmulatedPCE_Fast =
|
||||
{
|
||||
"pce_fast",
|
||||
"PC Engine (CD)/TurboGrafx 16 (CD)/SuperGrafx",
|
||||
KnownExtensions,
|
||||
MODPRIO_INTERNAL_LOW,
|
||||
NULL,
|
||||
&PCEInputInfo,
|
||||
Load,
|
||||
TestMagic,
|
||||
LoadCD,
|
||||
TestMagicCD,
|
||||
CloseGame,
|
||||
VDC_SetLayerEnableMask,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
MemRead,
|
||||
NULL,
|
||||
false,
|
||||
StateAction,
|
||||
Emulate,
|
||||
PCEINPUT_SetInput,
|
||||
DoSimpleCommand,
|
||||
PCESettings,
|
||||
MDFN_MASTERCLOCK_FIXED(PCE_MASTER_CLOCK),
|
||||
0,
|
||||
@ -988,16 +966,9 @@ MDFNGI *MDFNI_LoadCD(const char *force_module, const char *devicename)
|
||||
}
|
||||
MDFN_indent(-1);
|
||||
|
||||
// This if statement will be true if force_module references a system without CDROM support.
|
||||
if(!MDFNGameInfo->LoadCD)
|
||||
{
|
||||
MDFN_PrintError(_("Specified system \"%s\" doesn't support CDs!"), force_module);
|
||||
return(0);
|
||||
}
|
||||
MDFN_printf("Using module: pce_fast.\n");
|
||||
|
||||
MDFN_printf(_("Using module: %s(%s)\n\n"), MDFNGameInfo->shortname, MDFNGameInfo->fullname);
|
||||
|
||||
if(!(MDFNGameInfo->LoadCD(&CDInterfaces)))
|
||||
if(!(LoadCD(&CDInterfaces)))
|
||||
{
|
||||
for(unsigned i = 0; i < CDInterfaces.size(); i++)
|
||||
delete CDInterfaces[i];
|
||||
@ -1032,7 +1003,7 @@ MDFNGI *MDFNI_LoadGame(const char *force_module, const char *name)
|
||||
MDFN_indent(1);
|
||||
|
||||
// Construct a NULL-delimited list of known file extensions for MDFN_fopen()
|
||||
const FileExtensionSpecStruct *curexts = MDFNGameInfo->FileExtensions;
|
||||
const FileExtensionSpecStruct *curexts = KnownExtensions;
|
||||
|
||||
while(curexts->extension && curexts->description)
|
||||
{
|
||||
@ -1045,7 +1016,7 @@ MDFNGI *MDFNI_LoadGame(const char *force_module, const char *name)
|
||||
if(!GameFile)
|
||||
goto error;
|
||||
|
||||
MDFN_printf(_("Using module: %s(%s)\n\n"), MDFNGameInfo->shortname, MDFNGameInfo->fullname);
|
||||
MDFN_printf(_("Using module: pce_fast.\n\n"));
|
||||
MDFN_indent(1);
|
||||
|
||||
//
|
||||
@ -1055,7 +1026,7 @@ MDFNGI *MDFNI_LoadGame(const char *force_module, const char *name)
|
||||
// End load per-game settings
|
||||
//
|
||||
|
||||
if(MDFNGameInfo->Load(name, GameFile) <= 0)
|
||||
if(Load(name, GameFile) <= 0)
|
||||
goto error;
|
||||
|
||||
MDFN_LoadGameCheats(NULL);
|
||||
@ -1569,7 +1540,7 @@ void retro_unload_game(void)
|
||||
|
||||
MDFN_FlushGameCheats(0);
|
||||
|
||||
MDFNGameInfo->CloseGame();
|
||||
CloseGame();
|
||||
|
||||
if(MDFNGameInfo->name)
|
||||
free(MDFNGameInfo->name);
|
||||
|
@ -276,70 +276,13 @@ typedef enum
|
||||
|
||||
class CDIF;
|
||||
|
||||
#define MDFN_MASTERCLOCK_FIXED(n) ((int64)((double)(n) * (1LL << 32)))
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* Private functions to Mednafen. Do not call directly
|
||||
from the driver code, or else bad things shall happen. Maybe. Probably not, but don't
|
||||
do it(yet)!
|
||||
*/
|
||||
// Short system name, lowercase a-z, 0-9, and _ are the only allowable characters!
|
||||
const char *shortname;
|
||||
|
||||
// Full system name. Preferably English letters, but can be UTF8
|
||||
const char *fullname;
|
||||
|
||||
// Pointer to an array of FileExtensionSpecStruct, with the last entry being { NULL, NULL } to terminate the list.
|
||||
// This list is used to make best-guess choices, when calling the TestMagic*() functions would be unreasonable, such
|
||||
// as when scanning a ZIP archive for a file to load. The list may also be used in the future for GUI file open windows.
|
||||
const FileExtensionSpecStruct *FileExtensions;
|
||||
|
||||
ModPrio ModulePriority;
|
||||
|
||||
void *Debugger;
|
||||
InputInfoStruct *InputInfo;
|
||||
|
||||
// Returns 1 on successful load, 0 on fatal error(deprecated: -1 on unrecognized format)
|
||||
int (*Load)(const char *name, MDFNFILE *fp);
|
||||
|
||||
// Return TRUE if the file is a recognized type, FALSE if not.
|
||||
bool (*TestMagic)(const char *name, MDFNFILE *fp);
|
||||
|
||||
//
|
||||
// (*CDInterfaces).size() is guaranteed to be >= 1.
|
||||
int (*LoadCD)(std::vector<CDIF *> *CDInterfaces);
|
||||
bool (*TestMagicCD)(std::vector<CDIF *> *CDInterfaces);
|
||||
|
||||
void (*CloseGame)(void);
|
||||
|
||||
void (*SetLayerEnableMask)(uint64 mask); // Video
|
||||
const char *LayerNames;
|
||||
|
||||
void (*SetChanEnableMask)(uint64 mask); // Audio(TODO, placeholder)
|
||||
const char *ChanNames;
|
||||
|
||||
void (*InstallReadPatch)(uint32 address);
|
||||
void (*RemoveReadPatches)(void);
|
||||
uint8 (*MemRead)(uint32 addr);
|
||||
|
||||
#ifdef WANT_NEW_API
|
||||
CheatFormatInfoStruct *CheatFormatInfo;
|
||||
#endif
|
||||
|
||||
bool SaveStateAltersState; // true for bsnes and some libco-style emulators, false otherwise.
|
||||
// Main save state routine, called by the save state code in state.cpp.
|
||||
// When saving, load is set to 0. When loading, load is set to the version field of the save state being loaded.
|
||||
// data_only is true when the save state data is temporary, such as being saved into memory for state rewinding.
|
||||
int (*StateAction)(StateMem *sm, int load, int data_only);
|
||||
|
||||
void (*Emulate)(EmulateSpecStruct *espec);
|
||||
void (*SetInput)(int port, const char *type, void *ptr);
|
||||
|
||||
void (*DoSimpleCommand)(int cmd);
|
||||
|
||||
const MDFNSetting *Settings;
|
||||
|
||||
// Time base for EmulateSpecStruct::MasterCycles
|
||||
#define MDFN_MASTERCLOCK_FIXED(n) ((int64)((double)(n) * (1LL << 32)))
|
||||
int64 MasterClock;
|
||||
|
||||
uint32 fps; // frames per second * 65536 * 256, truncated
|
||||
@ -389,4 +332,8 @@ typedef struct
|
||||
|
||||
double mouse_sensitivity;
|
||||
} MDFNGI;
|
||||
|
||||
int StateAction(StateMem *sm, int load, int data_only);
|
||||
uint8 MemRead(uint32 addr);
|
||||
|
||||
#endif
|
||||
|
@ -132,22 +132,29 @@ void MDFNMP_AddRAM(uint32 size, uint32 A, uint8 *RAM)
|
||||
|
||||
void MDFNMP_InstallReadPatches(void)
|
||||
{
|
||||
if(!CheatsActive) return;
|
||||
unsigned x;
|
||||
std::vector<SUBCHEAT>::iterator chit;
|
||||
if(!CheatsActive) return;
|
||||
|
||||
std::vector<SUBCHEAT>::iterator chit;
|
||||
|
||||
for(unsigned int x = 0; x < 8; x++)
|
||||
for(chit = SubCheats[x].begin(); chit != SubCheats[x].end(); chit++)
|
||||
{
|
||||
if(MDFNGameInfo->InstallReadPatch)
|
||||
MDFNGameInfo->InstallReadPatch(chit->addr);
|
||||
}
|
||||
#if 0
|
||||
for(x = 0; x < 8; x++)
|
||||
{
|
||||
for(chit = SubCheats[x].begin(); chit != SubCheats[x].end(); chit++)
|
||||
{
|
||||
if(MDFNGameInfo->InstallReadPatch)
|
||||
MDFNGameInfo->InstallReadPatch(chit->addr);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void MDFNMP_RemoveReadPatches(void)
|
||||
{
|
||||
#if 0
|
||||
if(MDFNGameInfo->RemoveReadPatches)
|
||||
MDFNGameInfo->RemoveReadPatches();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void CheatMemErr(void)
|
||||
@ -299,7 +306,7 @@ static bool TestConditions(const char *string)
|
||||
shiftie = (bytelen - 1 - x) * 8;
|
||||
else
|
||||
shiftie = x * 8;
|
||||
value_at_address |= MDFNGameInfo->MemRead(v_address + x) << shiftie;
|
||||
value_at_address |= MemRead(v_address + x) << shiftie;
|
||||
}
|
||||
|
||||
//printf("A: %08x, V: %08llx, VA: %08llx, OP: %s\n", v_address, v_value, value_at_address, operation);
|
||||
|
@ -467,7 +467,7 @@ int MDFNSS_SaveSM(void *st_p, int, int, const void*, const void*, const void*)
|
||||
MDFN_en32lsb(header + 28, neoheight);
|
||||
smem_write(st, header, 32);
|
||||
|
||||
if(!MDFNGameInfo->StateAction(st, 0, 0))
|
||||
if(!StateAction(st, 0, 0))
|
||||
return(0);
|
||||
|
||||
uint32_t sizy = st->loc;
|
||||
@ -490,5 +490,5 @@ int MDFNSS_LoadSM(void *st_p, int, int)
|
||||
|
||||
stateversion = MDFN_de32lsb(header + 16);
|
||||
|
||||
return(MDFNGameInfo->StateAction(st, stateversion, 0));
|
||||
return StateAction(st, stateversion, 0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user