Skip to content

Commit

Permalink
Add a bunch of ROMS to check the accuracy against.
Browse files Browse the repository at this point in the history
  • Loading branch information
Arignir committed Dec 19, 2023
1 parent 1950755 commit 1bf3016
Show file tree
Hide file tree
Showing 18 changed files with 113 additions and 27 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/accuracy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added accuracy/expected/jsmolka_flash128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added accuracy/expected/jsmolka_flash64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added accuracy/expected/jsmolka_memory.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added accuracy/expected/jsmolka_nes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added accuracy/expected/jsmolka_none.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added accuracy/expected/jsmolka_sram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added accuracy/expected/jsmolka_thumb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added accuracy/expected/jsmolka_unsafe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
112 changes: 94 additions & 18 deletions accuracy/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions include/gba/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion source/gba/gba.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
2 changes: 1 addition & 1 deletion source/gba/memory/storage/storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ mem_backup_storage_read8(
return (gba->shared_data.backup_storage.data[addr & SRAM_MASK]);
break;
default:
return (0);
return (0xFF);
}
}

Expand Down

0 comments on commit 1bf3016

Please sign in to comment.