Skip to content

Commit

Permalink
Fix bad return in gba read function
Browse files Browse the repository at this point in the history
  • Loading branch information
OFFTKP committed Aug 15, 2024
1 parent 036eb92 commit 905cada
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1811,19 +1811,22 @@ uint32_t retro_achievements_read_memory_callback(uint32_t address, uint8_t* buff
for(int j=0;j<num_bytes;j++){
buffer[j]=wram[j];
}
return num_bytes;
} else if (address < 0x010000U) {
// these follow the normal gb memory map
for(int j=0;j<num_bytes;j++){
buffer[j]=sb_read8(&core.gb,address+j);
}
return num_bytes;
} else if (address <= 0x015FFFU) {
// 0x10000 - 0x15FFF is WRAM banks 2-7
uint8_t* wram = &core.gb.mem.wram[(SB_WRAM_BANK_SIZE * 2) + address - 0x010000U];
for(int j=0;j<num_bytes;j++){
buffer[j]=wram[j];
}
return num_bytes;
}
return num_bytes;
printf("GB address %08x not found\n",address);
}else if(emu_state.system==SYSTEM_GBA){
const rc_memory_regions_t* regions = rc_console_memory_regions(RC_CONSOLE_GAMEBOY_ADVANCE);
for (int i=0;i<regions->num_regions;i++) {
Expand All @@ -1832,14 +1835,15 @@ uint32_t retro_achievements_read_memory_callback(uint32_t address, uint8_t* buff
for (int j=0;j<num_bytes;j++){
buffer[j]=core.gba.mem.cart_backup[address-0x048000U+j];
}
return num_bytes;
} else if (address >= region->start_address && address <= region->end_address) {
for(int j=0;j<num_bytes;j++){
buffer[j]=gba_read8(&core.gba,region->real_address+(address-region->start_address)+j);
}
return num_bytes;
}
return num_bytes;
}
return num_bytes;
printf("GBA address %08x not found\n",address);
}else if(emu_state.system==SYSTEM_NDS){
const rc_memory_regions_t* regions = rc_console_memory_regions(RC_CONSOLE_NINTENDO_DS);
for (int i=0;i<regions->num_regions;i++) {
Expand All @@ -1848,9 +1852,10 @@ uint32_t retro_achievements_read_memory_callback(uint32_t address, uint8_t* buff
for(int j=0;j<num_bytes;j++){
buffer[j]=nds9_read8(&core.nds,region->real_address+(address-region->start_address)+j);
}
return num_bytes;
}
}
return num_bytes;
printf("NDS address %08x not found\n",address);
}
return 0;
}
Expand Down

0 comments on commit 905cada

Please sign in to comment.