diff --git a/data/SNES_PSX_addresses.tsv b/data/5/addresses_SNES_PSX.tsv similarity index 99% rename from data/SNES_PSX_addresses.tsv rename to data/5/addresses_SNES_PSX.tsv index 6db02db..eb88839 100644 --- a/data/SNES_PSX_addresses.tsv +++ b/data/5/addresses_SNES_PSX.tsv @@ -18,6 +18,7 @@ enemy_battle_sprite_palettes 0x0ED000 See enemy_battle_sprite_data for pointe worldmap_blocks 0x0FF0C0 /nar/ff5_binx.bin 0x040300 3 of 4 of 192 of u8 # Top-left corners, top-right corners, bottom-left corners, bottom-right corners worldmap_tiles.bias 0x0FF9C0 /nar/ff5_bin3.bin 0x03FB00 3 of 256 of u8 Add to each pixel of the mode7c tiles worldmap_palettes 0x0FFCC0 /nar/ff5_binx.bin 0x040000 3 of Palette128Of555 +enemy_stats 0x100000 384 of EnemyStats enemy_battle_sprite_layouts_small 0x10D004 102 of 8 of u8 length 0x330 enemy_battle_sprite_layouts_large 0x10D334 72 of 16 of u16 length 0x900 enemy_battle_sprite_mini 0x10E003 4 of TileSNES4bpp length 0x80 diff --git a/data/SNES_other.tsv b/data/5/structs_SNES.tsv similarity index 89% rename from data/SNES_other.tsv rename to data/5/structs_SNES.tsv index 3f31556..650f01c 100644 --- a/data/SNES_other.tsv +++ b/data/5/structs_SNES.tsv @@ -136,3 +136,30 @@ u8 tilemap_flips_id u8 tilemap_v_flips_id # Unused, all 0xFF = no flips u8 tilecycle_id u8 palcycle_id + +struct EnemyStats +u8 speed +u8 attack_power +u8 attack_multiplier +u8 evasion +u8 defense +u8 magic_power +u8 magic_defense +u8 magic_evasion +u16 max_hp +u16 max_mp +u16 reward_exp +u16 reward_gil +u8 attack_graphics +u8 elements_immune +u24 status_immune +u8 elements_absorb +AttackType attack_type +u8 elements_weak +u8 monster_type +u8 flags_25 +u16 status_26 +u16 status_28 +u8 29 +u8 30 +u8 level # 31 diff --git a/data/SNES_save.tsv b/data/5/structs_SNES_save.tsv similarity index 100% rename from data/SNES_save.tsv rename to data/5/structs_SNES_save.tsv diff --git a/data/5/structs_SNES_stubs.tsv b/data/5/structs_SNES_stubs.tsv new file mode 100644 index 0000000..800214b --- /dev/null +++ b/data/5/structs_SNES_stubs.tsv @@ -0,0 +1,9 @@ +struct ItemCost # All definitions here are intended to be overriden in code, but provide correctly-sized stubs for programs that don't care +u1 is_sellable +u1 is_sellprice_5gil +u6 exponent +u8 mantissa # buy_price = mantissa * int(pow(10, exponent)); sell_price = -1 if not is_sellable else (5 if is_sellprice_5gil else buy_price/2) + +struct EquipStatBonus +u1 is_stat_bonus # 0 -> data is elemental bonus bitfield; 1 -> 4bit toggle fields for affected stats, 3bit selector of bonus enum +u7 data # Meaning changes based on is_stat_bonus diff --git a/data/structs_SNES_stubs.tsv b/data/structs_SNES_stubs.tsv new file mode 100644 index 0000000..90e3fdd --- /dev/null +++ b/data/structs_SNES_stubs.tsv @@ -0,0 +1,29 @@ +struct TileSNESMode7 # All definitions here are intended to be overriden in code, but provide correctly-sized stubs for programs that don't care +64 of u8 data + +struct TileSNESMode7c +32 of u8 data + +struct TileSNES4bpp +32 of u8 data + +struct TileSNES3bpp +24 of u8 data + +struct TileSNES2bpp +16 of u8 data + +struct TileSNES1bpp +8 of u8 data + +struct SNESTritile +24 of u8 data + +struct ColorBGR555 +u16 data + +struct Palette16Of555 # Typed PoolColorArray in GDscript +16 of ColorBGR555 data + +struct Palette128Of555 # Typed PoolColorArray in GDscript +128 of ColorBGR555 data diff --git a/scripts/loaders/RomLoader.gd b/scripts/loaders/RomLoader.gd index eb0ecd1..acaf958 100644 --- a/scripts/loaders/RomLoader.gd +++ b/scripts/loaders/RomLoader.gd @@ -135,9 +135,11 @@ func _ready(): if THREADED_LOADING: thread = Thread.new() structdefs.merge(STRUCT.get_base_structarraytypes()) - structdefs.merge(STRUCT_SNES.get_structtypes()) - STRUCT.parse_struct_definitions_from_tsv_filename('res://data/SNES_save.tsv', structdefs) - STRUCT.parse_struct_definitions_from_tsv_filename('res://data/SNES_other.tsv', structdefs) + STRUCT.parse_struct_definitions_from_tsv_filename('res://data/structs_SNES_stubs.tsv', structdefs) + STRUCT.parse_struct_definitions_from_tsv_filename('res://data/5/structs_SNES_stubs.tsv', structdefs) + structdefs.merge(STRUCT_SNES.get_structtypes(), true) # Overwrite the stubs! + STRUCT.parse_struct_definitions_from_tsv_filename('res://data/5/structs_SNES_save.tsv', structdefs) + STRUCT.parse_struct_definitions_from_tsv_filename('res://data/5/structs_SNES.tsv', structdefs) var _error := psx_productcode_regex.compile('(S[A-Z]{3}_\\d{3}\\.\\d{2});(\\d)') # Debugging breakpoint pass diff --git a/scripts/loaders/SaveLoader.gd b/scripts/loaders/SaveLoader.gd index 3c9073b..8f87b3d 100644 --- a/scripts/loaders/SaveLoader.gd +++ b/scripts/loaders/SaveLoader.gd @@ -167,4 +167,4 @@ func delete_save_slot(sram: File, slot_id: int): sram.store_16(0) func _ready(): - STRUCT.parse_struct_definitions_from_tsv_filename('res://data/SNES_save.tsv', struct_types) + STRUCT.parse_struct_definitions_from_tsv_filename('res://data/5/structs_SNES_save.tsv', struct_types) diff --git a/scripts/managers/Common.gd b/scripts/managers/Common.gd index 673aa94..5ca90e1 100644 --- a/scripts/managers/Common.gd +++ b/scripts/managers/Common.gd @@ -6,7 +6,7 @@ var shrink_timer := Timer.new() var last_resolution_pre_shrink := Vector2.ZERO var config := ConfigFile.new() -var SNES_PSX_addresses := load_tsv('res://data/SNES_PSX_addresses.tsv') +var SNES_PSX_addresses := load_tsv('res://data/5/addresses_SNES_PSX.tsv') # Canonicalize english stat names within the codebase # This is based off of FF8, and is more or less RPGe but with Speed instead of Agility diff --git a/scripts/struct.gd b/scripts/struct.gd index f386b23..2f3e9c2 100644 --- a/scripts/struct.gd +++ b/scripts/struct.gd @@ -216,4 +216,5 @@ static func parse_struct_definitions_from_tsv_filename(filename: String, existin parse_struct_definitions_from_tsv_file(file, existing_structs) return OK var error: + print_debug('Error reading tsv '+filename+' - %d'%error) return error