diff --git a/.github/workflows/accuracy.yml b/.github/workflows/accuracy.yml index 27f37bce..2ad9e706 100644 --- a/.github/workflows/accuracy.yml +++ b/.github/workflows/accuracy.yml @@ -36,11 +36,19 @@ jobs: mv AGB_*.gba ags.gba # Download the remaining testing ROMs - wget https://raw.githubusercontent.com/jsmolka/gba-tests/master/arm/arm.gba - wget https://raw.githubusercontent.com/jsmolka/gba-tests/master/thumb/thumb.gba - wget https://raw.githubusercontent.com/Arignir/Hades-Tests/master/roms/dma-start-delay.gba - wget https://raw.githubusercontent.com/Arignir/Hades-Tests/master/roms/openbus-bios.gba - wget https://raw.githubusercontent.com/Arignir/Hades-Tests/master/roms/timer-basic.gba + wget https://raw.githubusercontent.com/jsmolka/gba-tests/master/arm/arm.gba -O jsmolka-arm.gba + wget https://raw.githubusercontent.com/jsmolka/gba-tests/master/bios/bios.gba -O jsmolka-bios.gba + wget https://raw.githubusercontent.com/jsmolka/gba-tests/master/memory/memory.gba -O jsmolka-memory.gba + wget https://raw.githubusercontent.com/jsmolka/gba-tests/master/nes/nes.gba -O jsmolka-nes.gba + wget https://raw.githubusercontent.com/jsmolka/gba-tests/master/thumb/thumb.gba -O jsmolka-thumb.gba + wget https://raw.githubusercontent.com/jsmolka/gba-tests/master/unsafe/unsafe.gba -O jsmolka-unsafe.gba + wget https://raw.githubusercontent.com/jsmolka/gba-tests/master/save/flash64.gba -O jsmolka-flash64.gba + wget https://raw.githubusercontent.com/jsmolka/gba-tests/master/save/flash128.gba -O jsmolka-flash128.gba + wget https://raw.githubusercontent.com/jsmolka/gba-tests/master/save/none.gba -O jsmolka-none.gba + wget https://raw.githubusercontent.com/jsmolka/gba-tests/master/save/sram.gba -O jsmolka-sram.gba + wget https://raw.githubusercontent.com/Arignir/Hades-Tests/master/roms/dma-start-delay.gba -O hades-dma-start-delay.gba + wget https://raw.githubusercontent.com/Arignir/Hades-Tests/master/roms/openbus-bios.gba -O hades-openbus-bios.gba + wget https://raw.githubusercontent.com/Arignir/Hades-Tests/master/roms/timer-basic.gba -O hades-timer-basic.gba env: BIOS_DATA: ${{ secrets.BIOS_DATA }} BIOS_KEY: ${{ secrets.BIOS_KEY }} diff --git a/accuracy/expected/dma_start_delay.png b/accuracy/expected/hades_dma_start_delay.png similarity index 100% rename from accuracy/expected/dma_start_delay.png rename to accuracy/expected/hades_dma_start_delay.png diff --git a/accuracy/expected/openbus_bios.png b/accuracy/expected/hades_openbus_bios.png similarity index 100% rename from accuracy/expected/openbus_bios.png rename to accuracy/expected/hades_openbus_bios.png diff --git a/accuracy/expected/timer_basic.png b/accuracy/expected/hades_timer_basic.png similarity index 100% rename from accuracy/expected/timer_basic.png rename to accuracy/expected/hades_timer_basic.png diff --git a/accuracy/expected/arm.png b/accuracy/expected/jsmolka_arm.png similarity index 100% rename from accuracy/expected/arm.png rename to accuracy/expected/jsmolka_arm.png diff --git a/accuracy/expected/thumb.png b/accuracy/expected/jsmolka_bios.png similarity index 100% rename from accuracy/expected/thumb.png rename to accuracy/expected/jsmolka_bios.png diff --git a/accuracy/expected/jsmolka_flash128.png b/accuracy/expected/jsmolka_flash128.png new file mode 100644 index 00000000..512904da Binary files /dev/null and b/accuracy/expected/jsmolka_flash128.png differ diff --git a/accuracy/expected/jsmolka_flash64.png b/accuracy/expected/jsmolka_flash64.png new file mode 100644 index 00000000..512904da Binary files /dev/null and b/accuracy/expected/jsmolka_flash64.png differ diff --git a/accuracy/expected/jsmolka_memory.png b/accuracy/expected/jsmolka_memory.png new file mode 100644 index 00000000..512904da Binary files /dev/null and b/accuracy/expected/jsmolka_memory.png differ diff --git a/accuracy/expected/jsmolka_nes.png b/accuracy/expected/jsmolka_nes.png new file mode 100644 index 00000000..512904da Binary files /dev/null and b/accuracy/expected/jsmolka_nes.png differ diff --git a/accuracy/expected/jsmolka_none.png b/accuracy/expected/jsmolka_none.png new file mode 100644 index 00000000..512904da Binary files /dev/null and b/accuracy/expected/jsmolka_none.png differ diff --git a/accuracy/expected/jsmolka_sram.png b/accuracy/expected/jsmolka_sram.png new file mode 100644 index 00000000..512904da Binary files /dev/null and b/accuracy/expected/jsmolka_sram.png differ diff --git a/accuracy/expected/jsmolka_thumb.png b/accuracy/expected/jsmolka_thumb.png new file mode 100644 index 00000000..512904da Binary files /dev/null and b/accuracy/expected/jsmolka_thumb.png differ diff --git a/accuracy/expected/jsmolka_unsafe.png b/accuracy/expected/jsmolka_unsafe.png new file mode 100644 index 00000000..512904da Binary files /dev/null and b/accuracy/expected/jsmolka_unsafe.png differ diff --git a/accuracy/suite.py b/accuracy/suite.py index 6413ae0d..8116b1dc 100644 --- a/accuracy/suite.py +++ b/accuracy/suite.py @@ -3,56 +3,132 @@ TESTS_SUITE: List[Test] = [ - # Jsmolka's arm.gba & thumg.gba + # Jsmolka's test roms # https://github.com/jsmolka/gba-tests Test( - name="Jsmolka - Arm.gba", - rom='arm.gba', + name="Jsmolka - arm.gba", + rom='jsmolka-arm.gba', code=''' frame 10 - screenshot ./.tests_screenshots/arm.png + screenshot ./.tests_screenshots/jsmolka_arm.png ''', - screenshot='arm.png', + screenshot='jsmolka_arm.png', ), Test( - name="Jsmolka - Thumb.gba", - rom='thumb.gba', + name="Jsmolka - bios.gba", + rom='jsmolka-bios.gba', code=''' frame 10 - screenshot ./.tests_screenshots/thumb.png + screenshot ./.tests_screenshots/jsmolka_bios.png ''', - screenshot='thumb.png', + screenshot='jsmolka_bios.png', + skip=True, + ), + Test( + name="Jsmolka - memory.gba", + rom='jsmolka-memory.gba', + code=''' + frame 10 + screenshot ./.tests_screenshots/jsmolka_memory.png + ''', + screenshot='jsmolka_memory.png', + ), + Test( + name="Jsmolka - nes.gba", + rom='jsmolka-nes.gba', + code=''' + frame 10 + screenshot ./.tests_screenshots/jsmolka_nes.png + ''', + screenshot='jsmolka_nes.png', + ), + Test( + name="Jsmolka - thumb.gba", + rom='jsmolka-thumb.gba', + code=''' + frame 10 + screenshot ./.tests_screenshots/jsmolka_thumb.png + ''', + screenshot='jsmolka_thumb.png', + ), + Test( + name="Jsmolka - unsafe.gba", + rom='jsmolka-unsafe.gba', + code=''' + frame 10 + screenshot ./.tests_screenshots/jsmolka_unsafe.png + ''', + screenshot='jsmolka_unsafe.png', + ), + Test( + name="Jsmolka - save/sram.gba", + rom='jsmolka-sram.gba', + code=''' + frame 10 + screenshot ./.tests_screenshots/jsmolka_sram.png + ''', + screenshot='jsmolka_sram.png', + skip=True, + ), + Test( + name="Jsmolka - save/none.gba", + rom='jsmolka-none.gba', + code=''' + frame 10 + screenshot ./.tests_screenshots/jsmolka_none.png + ''', + screenshot='jsmolka_none.png', + ), + Test( + name="Jsmolka - save/flash64.gba", + rom='jsmolka-flash64.gba', + code=''' + frame 10 + screenshot ./.tests_screenshots/jsmolka_flash64.png + ''', + screenshot='jsmolka_flash64.png', + skip=True, + ), + Test( + name="Jsmolka - save/flash128.gba", + rom='jsmolka-flash128.gba', + code=''' + frame 10 + screenshot ./.tests_screenshots/jsmolka_flash128.png + ''', + screenshot='jsmolka_flash128.png', + skip=True, ), # Hades Tests # https://github.com/Arignir/Hades-Tests Test( name="Hades Tests - DMA Start Delay", - rom='dma-start-delay.gba', + rom='hades-dma-start-delay.gba', code=''' frame 20 - screenshot ./.tests_screenshots/dma_start_delay.png + screenshot ./.tests_screenshots/hades_dma_start_delay.png ''', - screenshot='dma_start_delay.png', + screenshot='hades_dma_start_delay.png', skip=True, ), Test( name="Hades Tests - Openbus BIOS", - rom='openbus-bios.gba', + rom='hades-openbus-bios.gba', code=''' frame 20 - screenshot ./.tests_screenshots/openbus_bios.png + screenshot ./.tests_screenshots/hades_openbus_bios.png ''', - screenshot='openbus_bios.png', + screenshot='hades_openbus_bios.png', ), Test( name="Hades Tests - Timer Basic", - rom='timer-basic.gba', + rom='hades-timer-basic.gba', code=''' frame 20 - screenshot ./.tests_screenshots/timer_basic.png + screenshot ./.tests_screenshots/hades_timer_basic.png ''', - screenshot='timer_basic.png', + screenshot='hades_timer_basic.png', ), # AGS diff --git a/include/gba/memory.h b/include/gba/memory.h index 84ecdf18..986bf748 100644 --- a/include/gba/memory.h +++ b/include/gba/memory.h @@ -91,13 +91,13 @@ enum access_types { #define CART_REGION_END (CART_2_END >> 24) #define SRAM_START (0x0E000000) -#define SRAM_END (0x0E00FFFF) +#define SRAM_END (0x0E007FFF) #define SRAM_SIZE (SRAM_END - SRAM_START + 1) #define SRAM_MASK (SRAM_END - SRAM_START) #define SRAM_REGION (SRAM_START >> 24) #define SRAM_MIRROR_START (0x0F000000) -#define SRAM_MIRROR_END (0x0F00FFFF) +#define SRAM_MIRROR_END (0x0F007FFF) #define SRAM_MIRROR_REGION (SRAM_MIRROR_START >> 24) #define FLASH_START (0x0E000000) diff --git a/source/gba/gba.c b/source/gba/gba.c index 48f5b763..7eb13927 100644 --- a/source/gba/gba.c +++ b/source/gba/gba.c @@ -314,9 +314,11 @@ gba_state_reset( } if (gba->shared_data.backup_storage.size) { - gba->shared_data.backup_storage.data = calloc(1, gba->shared_data.backup_storage.size); + gba->shared_data.backup_storage.data = malloc(gba->shared_data.backup_storage.size); hs_assert(gba->shared_data.backup_storage.data); + memset(gba->shared_data.backup_storage.data, 0xFF, gba->shared_data.backup_storage.size); + if (config->backup_storage.data && config->backup_storage.size) { memcpy(gba->shared_data.backup_storage.data, config->backup_storage.data, min(gba->shared_data.backup_storage.size, config->backup_storage.size)); } diff --git a/source/gba/memory/storage/storage.c b/source/gba/memory/storage/storage.c index 1e4c37bb..e0be2062 100644 --- a/source/gba/memory/storage/storage.c +++ b/source/gba/memory/storage/storage.c @@ -32,7 +32,7 @@ mem_backup_storage_read8( return (gba->shared_data.backup_storage.data[addr & SRAM_MASK]); break; default: - return (0); + return (0xFF); } }