Skip to content

Commit

Permalink
[GB] Disable audio on SD card error.
Browse files Browse the repository at this point in the history
  • Loading branch information
OtherCrashOverride committed Jul 12, 2018
1 parent 94cf992 commit 16047a9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions gnuboy-go/components/gnuboy/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "esp_attr.h"

#include "../odroid/odroid_display.h"
#include "../odroid/odroid_audio.h"


struct mbc mbc;
Expand Down Expand Up @@ -49,6 +50,9 @@ static inline byte* GetRomPtr(short bank)
if (fseek(RomFile, OFFSET, SEEK_SET))
{
printf("GetRomPtr: fseek failed. OFFSET=%d\n", OFFSET);

odroid_audio_terminate();

odroid_display_show_sderr(ODROID_SD_ERR_BADFILE);
abort();
}
Expand All @@ -70,8 +74,11 @@ static inline byte* GetRomPtr(short bank)
size_t count = fread((uint8_t*)PSRAM + OFFSET, 1, BANK_SIZE, RomFile);
if (count < BANK_SIZE)
{
odroid_display_show_sderr(ODROID_SD_ERR_BADFILE);
printf("GetRomPtr: fread failed. bank=%d, count=%d\n", bank, count);

odroid_audio_terminate();

odroid_display_show_sderr(ODROID_SD_ERR_BADFILE);
abort();
}
#endif
Expand Down Expand Up @@ -576,7 +583,7 @@ void IRAM_ATTR mem_write(int a, byte b)
__asm__("nop");
__asm__("nop");
__asm__("memw");

ram.sram_dirty = 1;
//printf("mem_write: bank=%d, sram %p=0x%d\n", mbc.rambank, (void*)(a & 0x1fff), b);
//printf("mem_write: check - write=0x%x, read=0x%x\n", b, ram.sbank[mbc.rambank][a & 0x1FFF]);
Expand Down

0 comments on commit 16047a9

Please sign in to comment.