Use superior GB64 for emulation

This commit is contained in:
AriaHiro64 2021-05-05 00:57:27 -04:00 committed by GitHub
parent 29a6b71415
commit c8022bcd3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1084,48 +1084,53 @@ sprite_t *loadPng(u8 *png_filename)
} }
void loadgbrom(display_context_t disp, u8 *buff) void loadgbrom(display_context_t disp, TCHAR *rom_path)
{ {
FRESULT fr;
FILINFO fno;
fr = f_stat("/"ED64_FIRMWARE_PATH"/gblite.z64", &fno);
if (fr == FR_OK)
{
TCHAR gb_sram_file[64];
sprintf(gb_sram_file, "/"ED64_FIRMWARE_PATH"/%s/gblite.SRM", save_path);
FRESULT result; FRESULT result;
FIL file; FIL emufile;
UINT bytesread; UINT emubytesread;
result = f_open(&file, gb_sram_file, FA_WRITE | FA_OPEN_ALWAYS); result = f_open(&emufile, "/"ED64_FIRMWARE_PATH"/gb.v64", FA_READ);
if (result == FR_OK) if (result == FR_OK)
{ {
static uint8_t sram_buffer[36928]; int emufsize = f_size(&emufile);
//load gb emulator
for (int i = 0; i < 36928; i++)
sram_buffer[i] = 0;
sprintf(sram_buffer, buff);
UINT bw;
result = result =
f_write ( f_read (
&file, /* [IN] Pointer to the file object structure */ &emufile, /* [IN] File object */
sram_buffer, /* [IN] Pointer to the data to be written */ (void *)0xb0000000, /* [OUT] Buffer to store read data */
32768, /* [IN] Number of bytes to write */ //TODO: why is this shorter than the sram buffer? emufsize, /* [IN] Number of bytes to read */
&bw /* [OUT] Pointer to the variable to return number of bytes written */ &emubytesread /* [OUT] Number of bytes read */
); );
f_close(&file); f_close(&emufile);
sprintf(rom_filename, "gblite"); //load gb rom
gbload = 1; FIL romfile;
UINT rombytesread;
result = f_open(&romfile, rom_path, FA_READ);
loadrom(disp, "/"ED64_FIRMWARE_PATH"/gblite.z64", 1); if (result == FR_OK)
{
int romfsize = f_size(&romfile);
result =
f_read (
&romfile, /* [IN] File object */
(void *)0xb0200000, /* [OUT] Buffer to store read data */
romfsize, /* [IN] Number of bytes to read */
&rombytesread /* [OUT] Number of bytes read */
);
f_close(&romfile);
boot_cic = CIC_6102;
boot_save = 5; //flash
force_tv = 0; //no force
cheats_on = 0; //cheats off
checksum_fix_on = 0;
bootRom(disp, 1);
} }
} }
} }