Fixed SNES v2proto_hirom to detect and set ROM size if not provided (or set to 0) and is known in rom_ubound table

This commit is contained in:
Joel Smith 2019-07-10 00:33:50 -07:00
parent 7992165100
commit c26dca8c8e
1 changed files with 3 additions and 2 deletions

View File

@ -536,6 +536,7 @@ local function dump_ram( file, start_bank, ram_size_KB, mapping, debug )
local num_banks local num_banks
--determine how much ram to read per bank --determine how much ram to read per bank
if ram_size_KB == nil then ram_size_KB = 0 end
if (ram_size_KB < KB_per_bank) then if (ram_size_KB < KB_per_bank) then
num_banks = 1 num_banks = 1
KB_per_bank = ram_size_KB KB_per_bank = ram_size_KB
@ -868,13 +869,13 @@ local function process(process_opts, console_opts)
end end
end end
if ram_size == 0 then if (ram_size == 0) or (ram_size == nil) then
ram_size = ram_size_kb_tbl[internal_header["sram_size"]] ram_size = ram_size_kb_tbl[internal_header["sram_size"]]
assert(ram_size, "SRAM Size unknown and not provided, please add ram size to console_opts") assert(ram_size, "SRAM Size unknown and not provided, please add ram size to console_opts")
print("SRAM Size not provided, " .. ram_size_tbl[internal_header["sram_size"]] .. " detected.") print("SRAM Size not provided, " .. ram_size_tbl[internal_header["sram_size"]] .. " detected.")
end end
if rom_size == 0 then if (rom_size == 0) or (rom_size == nil) then
rom_size = rom_size_kb_tbl[internal_header["rom_size"]] rom_size = rom_size_kb_tbl[internal_header["rom_size"]]
assert(rom_size, "ROM Size unknown and not provided, please add rom size to console_opts") assert(rom_size, "ROM Size unknown and not provided, please add rom size to console_opts")
print("ROM Size not provided, " .. rom_ubound[internal_header["rom_size"]] .. " detected.") print("ROM Size not provided, " .. rom_ubound[internal_header["rom_size"]] .. " detected.")