sanic cd now loads up to a "backup ram broken" screen
This commit is contained in:
parent
85be43dfb8
commit
a36982ebc6
|
@ -134,14 +134,33 @@ typedef struct
|
|||
void (*cdd_readcallback)(int lba, void *dest);
|
||||
} frontendcd_t;
|
||||
|
||||
int cdd_load(void)
|
||||
int cdd_load(char *header)
|
||||
{
|
||||
frontendcd_t fecd;
|
||||
char data[2048];
|
||||
int startoffs;
|
||||
|
||||
|
||||
int bytes = sizeof(frontendcd_t);
|
||||
if (load_archive("PRIMARY_CD", (unsigned char *)&fecd, bytes, NULL) != bytes)
|
||||
return 0;
|
||||
|
||||
// look for valid header
|
||||
fecd.cdd_readcallback(0, data);
|
||||
if (memcmp("SEGADISCSYSTEM", data, 14) == 0)
|
||||
startoffs = 0;
|
||||
else if (memcmp("SEGADISCSYSTEM", data + 16, 14) == 0)
|
||||
startoffs = 16;
|
||||
else
|
||||
return 0;
|
||||
// copy security block
|
||||
memcpy(header, data + startoffs, 0x210);
|
||||
|
||||
// copy disk information
|
||||
cdd_readcallback = fecd.cdd_readcallback;
|
||||
memcpy(&cdd.toc, &fecd.toc, sizeof(toc_t));
|
||||
|
||||
cdd.loaded = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ extern void cdd_init(blip_t* left, blip_t* right);
|
|||
extern void cdd_reset(void);
|
||||
extern int cdd_context_save(uint8 *state);
|
||||
extern int cdd_context_load(uint8 *state);
|
||||
extern int cdd_load(void);
|
||||
extern int cdd_load(char *header);
|
||||
extern void cdd_unload(void);
|
||||
extern void cdd_read_data(uint8 *dst);
|
||||
extern void cdd_read_audio(unsigned int samples);
|
||||
|
|
|
@ -541,7 +541,7 @@ int load_rom(char *filename)
|
|||
}
|
||||
|
||||
/* auto-detect CD image files */
|
||||
size = cdd_load();
|
||||
size = cdd_load((char *)(cart.rom));
|
||||
if (size < 0)
|
||||
{
|
||||
/* error opening file */
|
||||
|
@ -730,7 +730,7 @@ int load_rom(char *filename)
|
|||
|
||||
/* automatically load associated .iso image */
|
||||
strncpy(&filename[strlen(filename) - 4], ".iso", 4);
|
||||
cdd_load(); // should this be checked for failure?
|
||||
cdd_load((char *)cdc.ram); // should this be checked for failure?
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue