From 22c9ba9fda76b73a46588954a31fb53b8762553e Mon Sep 17 00:00:00 2001 From: dingusdev <52434309+dingusdev@users.noreply.github.com> Date: Mon, 1 Jul 2019 21:54:12 -0700 Subject: [PATCH] Proper ROM String finding Cleaned up string finding; Compiles now --- main.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/main.cpp b/main.cpp index 58dd2ff..fdef39d 100644 --- a/main.cpp +++ b/main.cpp @@ -486,14 +486,16 @@ int main(int argc, char **argv) {"TNT ", "Power Mac 7xxxx/8xxx series"}, //Trinitrotoluene :-) {"Zanz", "A complete engima."} //Zanzibar (mentioned in Sheepshaver's code, but no match to any known ROM) }; - + + char configGrab = 0; uint32_t configInfoOffset = 0; if (grab_sysrom_size == 0x400000){ romFile.seekg (0x300082, ios::beg); //This is where the place to get the offset is - romFile.read(configInfoOffset, 1); - uint32_t configInfoAddr = 0x300000 + (configInfoOffset << 8); + romFile.get(configGrab); //just one byte to determine where the identifier string is + configInfoOffset = (uint32_t)(configGrab & 0xff); + uint32_t configInfoAddr = 0x300000 + (configInfoOffset << 8) + 0x69; //address to check the identifier string romFile.seekg (configInfoAddr, ios::beg); romFile.read(memPPCBlock, sizeof(uint32_t)); //Only four chars needed to distinguish between codenames @@ -504,7 +506,7 @@ int main(int argc, char **argv) string redo_me = iter->first; - if (!string_test.compare(redo_me)){ + if (string_test.compare(redo_me) == 0){ cout << "The machine is identified as..." << iter->second << endl; romFile.seekg (0x0, ios::beg); @@ -524,10 +526,12 @@ int main(int argc, char **argv) openpic_init(); break; } + else{ + iter++; + } } } - //Copy the contents of the IO data and the ROM to memory appropriate locations. romFile.read ((char *)machine_sysrom_mem,grab_sysrom_size);