Permalink
Browse files

Support headered bsxbios.bin too

1 parent d15049c commit 896c37b1f6d19f98ca1c7ef029f582e8c94cf942 @mrehkopf committed Nov 30, 2016
Showing with 14 additions and 4 deletions.
  1. +11 −3 src/memory.c
  2. +3 −1 src/memory.h
View
@@ -277,9 +277,9 @@ uint32_t load_rom(uint8_t* filename, uint32_t base_addr, uint8_t flags) {
if(romprops.mapper_id==3) {
printf("BSX Flash cart image\n");
printf("attempting to load BSX BIOS /sd2snes/bsxbios.bin...\n");
- load_sram_offload((uint8_t*)"/sd2snes/bsxbios.bin", 0x800000);
+ load_sram_offload((uint8_t*)"/sd2snes/bsxbios.bin", 0x800000, LOADRAM_AUTOSKIP_HEADER);
printf("attempting to load BS data file /sd2snes/bsxpage.bin...\n");
- load_sram_offload((uint8_t*)"/sd2snes/bsxpage.bin", 0x900000);
+ load_sram_offload((uint8_t*)"/sd2snes/bsxpage.bin", 0x900000, 0);
printf("Type: %02x\n", romprops.header.destcode);
set_bsx_regs(0xf6, 0x09);
uint16_t rombase;
@@ -473,13 +473,21 @@ uint32_t load_spc(uint8_t* filename, uint32_t spc_data_addr, uint32_t spc_header
return (uint32_t)filesize;
}
-uint32_t load_sram_offload(uint8_t* filename, uint32_t base_addr) {
+uint32_t load_sram_offload(uint8_t* filename, uint32_t base_addr, uint8_t flags) {
set_mcu_addr(base_addr);
UINT bytes_read;
DWORD filesize;
file_open(filename, FA_READ);
filesize = file_handle.fsize;
if(file_res) return 0;
+ if(flags & LOADRAM_AUTOSKIP_HEADER) {
+ if((filesize & 0xffff) == 0x200) {
+ ff_sd_offload=1;
+ f_lseek(&file_handle, 0x200L);
+ printf("load_sram_offload: skipping 512b header\n");
+ }
+ }
+ if(file_res) return 0;
for(;;) {
ff_sd_offload=1;
sd_offload_tgt=0;
View
@@ -61,13 +61,15 @@
#define LOADROM_WITH_RESET (2)
#define LOADROM_WAIT_SNES (4)
+#define LOADRAM_AUTOSKIP_HEADER (1)
+
#define SAVE_BASEDIR ("/sd2snes/saves/")
uint32_t load_rom(uint8_t* filename, uint32_t base_addr, uint8_t flags);
uint32_t load_spc(uint8_t* filename, uint32_t spc_data_addr, uint32_t spc_header_addr);
uint32_t migrate_and_load_srm(uint8_t *filename, uint32_t base_addr);
uint32_t load_sram(uint8_t* filename, uint32_t base_addr);
-uint32_t load_sram_offload(uint8_t* filename, uint32_t base_addr);
+uint32_t load_sram_offload(uint8_t* filename, uint32_t base_addr, uint8_t flags);
uint32_t load_sram_rle(uint8_t* filename, uint32_t base_addr);
uint32_t load_bootrle(uint32_t base_addr);
void load_dspx(const uint8_t* filename, uint8_t st0010);

0 comments on commit 896c37b

Please sign in to comment.