From: Lukas Krickl Date: Fri, 27 Dec 2024 09:23:31 +0000 (+0100) Subject: Added struct for save game X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=155b53df3409ffbac7f1006e447fd9e6ac18fb7f;p=gbrg%2F.git Added struct for save game --- diff --git a/src/sram.s b/src/sram.s index b0edd89..f4e62ea 100644 --- a/src/sram.s +++ b/src/sram.s @@ -10,17 +10,4 @@ ; flag for init of sram sram_magic: .adv 1 - ; checksum of save game - ; this is simply all bytes in the save game added -save_game1_chksm: .adv 1 - - ; saving rng seed -save_game1_seed: .adv 1 - ; saving all rooms -save_game1_rooms: .adv ROOM_SIZE_TOTAL * ROOMS_TOTAL - ; saving player state -save_game1_player: .adv player_size - - ; this is a canary value to detect out of bounds reads in sram - ; if this value is not SRAM_MAGIC then the save game is corrupted -save_game1_overflow_canary: .adv 1 +save_game1: .adv save_game_size diff --git a/src/wram.s b/src/wram.s index 3db3cd8..68f6918 100644 --- a/src/wram.s +++ b/src/wram.s @@ -142,6 +142,22 @@ curr_room_exits: .adv 2 ; room_struct, tiles, flags, actor_table, exit_table #define ROOM_SIZE_TOTAL room_size + ROOM_TILES_SIZE + ROOM_FLAGS_SIZE + ACTOR_TABLE_SIZE + ROOM_EXIT_TABLE_SIZE + ; save game struct +.se 0 + ; checksum of save game + ; this is simply all bytes in the save game added +.de save_game_chksm, 1 + ; saving rng seed +.de save_game_seed, 1 + ; saving all rooms +.de save_game_rooms, ROOM_SIZE_TOTAL * ROOMS_TOTAL + ; saving player state +.de save_game_player, player_size + ; this is a canary value to detect out of bounds reads in sram + ; if this value is not SRAM_MAGIC then the save game is corrupted +.de save_game_canary, 1 +.de save_game_size, 0 + ; drawing related flags ; UI flags