From 6bd9342584b3f06666d0eca7b4eda88bf0495eda Mon Sep 17 00:00:00 2001 From: Joel Smith Date: Sun, 19 Apr 2020 16:31:41 -0700 Subject: [PATCH 1/8] missing file jtag.lua --- host/scripts/app/jtag.lua | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 host/scripts/app/jtag.lua diff --git a/host/scripts/app/jtag.lua b/host/scripts/app/jtag.lua new file mode 100644 index 0000000..e69de29 From d220212bdfb2a5bb06e89a235f3720de40084466 Mon Sep 17 00:00:00 2001 From: Joel Smith Date: Sun, 19 Apr 2020 19:06:32 -0700 Subject: [PATCH 2/8] Added SNES SuperFX hardware type --- host/scripts/snes/v2proto_hirom.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/host/scripts/snes/v2proto_hirom.lua b/host/scripts/snes/v2proto_hirom.lua index 3f8e48f..e3c9fa1 100644 --- a/host/scripts/snes/v2proto_hirom.lua +++ b/host/scripts/snes/v2proto_hirom.lua @@ -17,12 +17,14 @@ local lorom_name = 'LoROM' -- http://old.smwiki.net/wiki/Internal_ROM_Header -- https://en.wikibooks.org/wiki/Super_NES_Programming/SNES_memory_map -- https://patpend.net/technical/snes/sneskart.html +-- https://snesdev.mesen.ca/wiki/index.php local hardware_type = { [0x00] = "ROM Only", [0x01] = "ROM and RAM", [0x02] = "ROM and Save RAM", [0x03] = "ROM and DSP1", + [0x13] = "ROM and SuperFX", [0x43] = "ROM and S-DD1", [0xF3] = "ROM and CX4", From 650b523b8906eacbcc18b9ccb3ce1f51d0a39b86 Mon Sep 17 00:00:00 2001 From: Joel Smith Date: Sun, 19 Apr 2020 20:33:28 -0700 Subject: [PATCH 3/8] Added hardware types for OBC1 and SA-1 --- host/scripts/snes/v2proto_hirom.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/host/scripts/snes/v2proto_hirom.lua b/host/scripts/snes/v2proto_hirom.lua index e3c9fa1..93fe15c 100644 --- a/host/scripts/snes/v2proto_hirom.lua +++ b/host/scripts/snes/v2proto_hirom.lua @@ -25,9 +25,10 @@ local hardware_type = { [0x02] = "ROM and Save RAM", [0x03] = "ROM and DSP1", [0x13] = "ROM and SuperFX", + [0x23] = "ROM and OBC1", + [0x33] = "ROM and SA-1", [0x43] = "ROM and S-DD1", [0xF3] = "ROM and CX4", - } --[[ TODO: Investigate these configurations. From c444a9d152e0dd030f08d3b83ee3e8ad56630282 Mon Sep 17 00:00:00 2001 From: Joel Smith Date: Sun, 19 Apr 2020 21:53:36 -0700 Subject: [PATCH 4/8] Added hardware code for SNES SuperFX + SRAM --- host/scripts/snes/v2proto_hirom.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/host/scripts/snes/v2proto_hirom.lua b/host/scripts/snes/v2proto_hirom.lua index 93fe15c..c03a29a 100644 --- a/host/scripts/snes/v2proto_hirom.lua +++ b/host/scripts/snes/v2proto_hirom.lua @@ -25,6 +25,7 @@ local hardware_type = { [0x02] = "ROM and Save RAM", [0x03] = "ROM and DSP1", [0x13] = "ROM and SuperFX", + [0x15] = "ROM and SuperFX and Save RAM", [0x23] = "ROM and OBC1", [0x33] = "ROM and SA-1", [0x43] = "ROM and S-DD1", From 4d83c034b1ae336c7493125235125dcd77e41d9a Mon Sep 17 00:00:00 2001 From: Joel Smith Date: Mon, 20 Apr 2020 13:32:22 -0700 Subject: [PATCH 5/8] Added values for SNES Stunt Race FX rom type and SRAM --- host/scripts/snes/v2proto_hirom.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/host/scripts/snes/v2proto_hirom.lua b/host/scripts/snes/v2proto_hirom.lua index c03a29a..01de1c8 100644 --- a/host/scripts/snes/v2proto_hirom.lua +++ b/host/scripts/snes/v2proto_hirom.lua @@ -26,6 +26,7 @@ local hardware_type = { [0x03] = "ROM and DSP1", [0x13] = "ROM and SuperFX", [0x15] = "ROM and SuperFX and Save RAM", + [0x1A] = "ROM and SuperFX and Save RAM", [0x23] = "ROM and OBC1", [0x33] = "ROM and SA-1", [0x43] = "ROM and S-DD1", @@ -68,7 +69,8 @@ local ram_size_tbl = { [0x01] = "16 kilobits", [0x02] = "32 kilobits", [0x03] = "64 kilobits", - [0x05] = "256 kilobits" + [0x05] = "256 kilobits", + [0x06] = "512 kilobits" } -- Translates ram size in header to KBytes. @@ -77,7 +79,8 @@ local ram_size_kb_tbl = { [0x01] = 2, [0x02] = 4, [0x03] = 8, - [0x05] = 32 + [0x05] = 32, + [0x06] = 64 } local destination_code = { From 13c73053d01e8d8d84e299d4db2490eb9bd93453 Mon Sep 17 00:00:00 2001 From: Joel Smith Date: Mon, 20 Apr 2020 19:21:25 -0700 Subject: [PATCH 6/8] Added support for SNES save ram length from Expansion Ram Header (if valid) fixes issues with SMW 2: Yoshi's Island and Stunt Race FX --- host/scripts/snes/v2proto_hirom.lua | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/host/scripts/snes/v2proto_hirom.lua b/host/scripts/snes/v2proto_hirom.lua index 01de1c8..512f191 100644 --- a/host/scripts/snes/v2proto_hirom.lua +++ b/host/scripts/snes/v2proto_hirom.lua @@ -308,6 +308,9 @@ function print_header(internal_header) local sram_size_str = "UNKNOWN - " .. hexfmt(internal_header["sram_size"]) if ram_size_tbl[internal_header["sram_size"]] then sram_size_str = ram_size_tbl[internal_header["sram_size"]] end + local exp_size_str = "UNKNOWN - " .. hexfmt(internal_header["exp_ram_size"]) + if ram_size_tbl[internal_header["exp_ram_size"]] then exp_size_str = ram_size_tbl[internal_header["exp_ram_size"]] end + local destination_code_str = "UNKNOWN - " .. hexfmt(internal_header["destination_code"]) if destination_code[internal_header["destination_code"]] then destination_code_str = destination_code[internal_header["destination_code"]] @@ -323,6 +326,7 @@ function print_header(internal_header) print("Hardware Type:\t\t" .. rom_type_str) print("Rom Size Upper Bound:\t" .. rom_size_str) print("SRAM Size:\t\t" .. sram_size_str) + print("Expansion RAM Size:\t" .. exp_size_str) print("Destination Code:\t" .. destination_code_str) print("Developer:\t\t" .. developer_code_str) print("Version:\t\t" .. hexfmt(internal_header["version"])) @@ -357,6 +361,7 @@ function get_header(map_adjust) rom_type = dict.snes("SNES_ROM_RD", addr_rom_type), rom_size = dict.snes("SNES_ROM_RD", addr_rom_size), sram_size = dict.snes("SNES_ROM_RD", addr_sram_size), + exp_ram_size = dict.snes("SNES_ROM_RD", addr_expansion_ram_size), destination_code = dict.snes("SNES_ROM_RD", addr_destination_code), developer_code = dict.snes("SNES_ROM_RD", addr_developer_code), version = dict.snes("SNES_ROM_RD", addr_version), @@ -876,10 +881,26 @@ local function process(process_opts, console_opts) end end + -- Autodetect missing ram size if (ram_size == 0) or (ram_size == nil) then - 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") - print("SRAM Size not provided, " .. ram_size_tbl[internal_header["sram_size"]] .. " detected.") + + sram_table = ram_size_kb_tbl[internal_header["sram_size"]] + exp_ram_table = ram_size_kb_tbl[internal_header["exp_ram_size"]] + + -- Some titles (Yoshi's Story, Stunt Race FX) use expansion ram header value + -- ram_size will use sram value unless a valid size is found in expansion ram header + if (sram_table == 0) or (sram_table == nil) then + if exp_ram_table == nil then + ram_size = sram_table + else + ram_size = exp_ram_table + end + else + ram_size = sram_table + end + + assert(ram_size, "Save RAM Size unknown and not provided, please add ram size to console_opts") + print("Save RAM Size not provided, " .. ram_size .. " detected.") end if (rom_size == 0) or (rom_size == nil) then From 18e3e3c6a27511a8d8a9257c0cc596564c999c74 Mon Sep 17 00:00:00 2001 From: Joel Smith Date: Mon, 20 Apr 2020 19:46:25 -0700 Subject: [PATCH 7/8] wording changes --- host/scripts/snes/v2proto_hirom.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/host/scripts/snes/v2proto_hirom.lua b/host/scripts/snes/v2proto_hirom.lua index 512f191..318bb5c 100644 --- a/host/scripts/snes/v2proto_hirom.lua +++ b/host/scripts/snes/v2proto_hirom.lua @@ -65,7 +65,7 @@ local rom_size_kb_tbl = { } local ram_size_tbl = { - [0x00] = "No sram", + [0x00] = "None", [0x01] = "16 kilobits", [0x02] = "32 kilobits", [0x03] = "64 kilobits", @@ -900,7 +900,7 @@ local function process(process_opts, console_opts) end assert(ram_size, "Save RAM Size unknown and not provided, please add ram size to console_opts") - print("Save RAM Size not provided, " .. ram_size .. " detected.") + print("Save RAM Size not provided, " .. ram_size .. " kilobytes detected.") end if (rom_size == 0) or (rom_size == nil) then From 660f7f110524e29ae99923332d5b73d27526837c Mon Sep 17 00:00:00 2001 From: Joel Smith Date: Mon, 1 Jun 2020 20:56:46 +0000 Subject: [PATCH 8/8] Change label to reflect Stunt Race FX --- host/scripts/snes/v2proto_hirom.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/host/scripts/snes/v2proto_hirom.lua b/host/scripts/snes/v2proto_hirom.lua index 318bb5c..ab4b96c 100644 --- a/host/scripts/snes/v2proto_hirom.lua +++ b/host/scripts/snes/v2proto_hirom.lua @@ -1,4 +1,3 @@ - -- create the module's table local v2proto = {} @@ -26,7 +25,7 @@ local hardware_type = { [0x03] = "ROM and DSP1", [0x13] = "ROM and SuperFX", [0x15] = "ROM and SuperFX and Save RAM", - [0x1A] = "ROM and SuperFX and Save RAM", + [0x1A] = "ROM and SuperFX and Save RAM (Stunt Race FX)", [0x23] = "ROM and OBC1", [0x33] = "ROM and SA-1", [0x43] = "ROM and S-DD1",