megadrive: core side stuff for loading a cart + CD at once (not hooked up in frontend)
This commit is contained in:
parent
e71d729626
commit
e76b71b72f
|
@ -47,6 +47,9 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
// three or six button?
|
// three or six button?
|
||||||
// http://www.sega-16.com/forum/showthread.php?4398-Forgotten-Worlds-giving-you-GAME-OVER-immediately-Fix-inside&highlight=forgotten%20worlds
|
// http://www.sega-16.com/forum/showthread.php?4398-Forgotten-Worlds-giving-you-GAME-OVER-immediately-Fix-inside&highlight=forgotten%20worlds
|
||||||
|
|
||||||
|
//hack, don't use
|
||||||
|
//romfile = File.ReadAllBytes(@"D:\encodes\bizhawksrc\output\SANIC CD\PierSolar (E).bin");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.SyncSettings = (GPGXSyncSettings)SyncSettings ?? GPGXSyncSettings.GetDefaults();
|
this.SyncSettings = (GPGXSyncSettings)SyncSettings ?? GPGXSyncSettings.GetDefaults();
|
||||||
|
@ -165,18 +168,26 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
}
|
}
|
||||||
srcdata = romfile;
|
srcdata = romfile;
|
||||||
}
|
}
|
||||||
else if (filename == "PRIMARY_CD")
|
else if (filename == "PRIMARY_CD" || filename == "SECONDARY_CD")
|
||||||
{
|
{
|
||||||
if (CD == null)
|
if (filename == "PRIMARY_CD" && romfile != null)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Couldn't satisfy firmware request PRIMARY_CD because none was provided.");
|
Console.WriteLine("Declined to satisfy firmware request PRIMARY_CD because PRIMARY_ROM was provided.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
srcdata = GetCDData();
|
else
|
||||||
if (srcdata.Length != maxsize)
|
|
||||||
{
|
{
|
||||||
Console.WriteLine("Couldn't satisfy firmware request PRIMARY_CD because of struct size.");
|
if (CD == null)
|
||||||
return 0;
|
{
|
||||||
|
Console.WriteLine("Couldn't satisfy firmware request {0} because none was provided.", filename);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
srcdata = GetCDData();
|
||||||
|
if (srcdata.Length != maxsize)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Couldn't satisfy firmware request {0} because of struct size.", filename);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -128,7 +128,7 @@ typedef struct
|
||||||
void (*cdd_readcallback)(int lba, void *dest, int audio);
|
void (*cdd_readcallback)(int lba, void *dest, int audio);
|
||||||
} frontendcd_t;
|
} frontendcd_t;
|
||||||
|
|
||||||
int cdd_load(char *header)
|
int cdd_load(const char *key, char *header)
|
||||||
{
|
{
|
||||||
frontendcd_t fecd;
|
frontendcd_t fecd;
|
||||||
char data[2048];
|
char data[2048];
|
||||||
|
@ -136,7 +136,7 @@ int cdd_load(char *header)
|
||||||
|
|
||||||
|
|
||||||
int bytes = sizeof(frontendcd_t);
|
int bytes = sizeof(frontendcd_t);
|
||||||
if (load_archive("PRIMARY_CD", (unsigned char *)&fecd, bytes, NULL) != bytes)
|
if (load_archive(key, (unsigned char *)&fecd, bytes, NULL) != bytes)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// look for valid header
|
// look for valid header
|
||||||
|
|
|
@ -98,7 +98,7 @@ extern void cdd_init(blip_t* left, blip_t* right);
|
||||||
extern void cdd_reset(void);
|
extern void cdd_reset(void);
|
||||||
extern int cdd_context_save(uint8 *state);
|
extern int cdd_context_save(uint8 *state);
|
||||||
extern int cdd_context_load(uint8 *state);
|
extern int cdd_context_load(uint8 *state);
|
||||||
extern int cdd_load(char *header);
|
extern int cdd_load(const char *key, char *header);
|
||||||
extern void cdd_unload(void);
|
extern void cdd_unload(void);
|
||||||
extern void cdd_read_data(uint8 *dst);
|
extern void cdd_read_data(uint8 *dst);
|
||||||
extern void cdd_read_audio(unsigned int samples);
|
extern void cdd_read_audio(unsigned int samples);
|
||||||
|
|
|
@ -541,7 +541,7 @@ int load_rom(const char *filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* auto-detect CD image files */
|
/* auto-detect CD image files */
|
||||||
size = cdd_load((char *)(cart.rom));
|
size = cdd_load("PRIMARY_CD", (char *)(cart.rom));
|
||||||
if (size < 0)
|
if (size < 0)
|
||||||
{
|
{
|
||||||
/* error opening file */
|
/* error opening file */
|
||||||
|
@ -731,7 +731,7 @@ int load_rom(const char *filename)
|
||||||
/* automatically load associated .iso image */
|
/* automatically load associated .iso image */
|
||||||
// this will only possibly work if a CD and a ROM are provided at the same time, which the frontend
|
// this will only possibly work if a CD and a ROM are provided at the same time, which the frontend
|
||||||
// has no provision for at the moment
|
// has no provision for at the moment
|
||||||
if (cdd_load((char *)cdc.ram) <= 0)
|
if (cdd_load("SECONDARY_CD", (char *)cdc.ram) <= 0)
|
||||||
// no load, so disable CD hardware
|
// no load, so disable CD hardware
|
||||||
system_hw = SYSTEM_MD;
|
system_hw = SYSTEM_MD;
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue