From 6f67ed40ac2974bcc7f5f1f1e5397f2bab84ac43 Mon Sep 17 00:00:00 2001 From: goyuken <goyuken@4bbf4f03-6f44-549e-7e59-35d4b0962838> Date: Thu, 14 Aug 2014 23:26:14 +0000 Subject: [PATCH] gba: i have altered the saveram format. https://www.youtube.com/watch?v=qd8hy032uLc --- output/dll/libvbanext.dll | Bin 442880 -> 443392 bytes vbanext/instance.cpp | 93 ++++++++++++++++++++++++++------------ 2 files changed, 65 insertions(+), 28 deletions(-) diff --git a/output/dll/libvbanext.dll b/output/dll/libvbanext.dll index 209d1a06e833ff9bd52181fdf5533cb0ea3c005c..60350c839f64ede8c4194f67ea3f8db65ab5816c 100644 GIT binary patch delta 13552 zcmc&)3v?6Jx}FS~A;mxg^lgEH1<FhEn!FzcQ9&v#EwtsxQ^7M<To$N@9&aJVRw$%l z3Mp(v#iCpnDi;e>TNSZ~7C{9><sf3^ROCREiUmQd7JC0Z*-2&$=W*9MYu&E(H<|B$ z?0^4z|9iekQeJs`dDZPTUBgNzeV<2>zjlfqdYhsTMWwP7wIc`~OZTTJ?xaWe^53Tz z98<H2r6wyVs@lIqaYxKp14W(CvQ+AZp|>mQ{BJ4DefFk+s|H+C{l6*(_dESCyafx2 zhu1X!2zsRd33`Bk9-T019iWoGOp409bLpbRk3U3F31(0<gWdwK)%&*5vwG3rChq%% z(JJXZG5#@qM$l_x{CRzb(htY@|I}wD9UJ36*5^5TiOT=zZOiGd-v0BqEvDD?_UEea zpcnP_FISJIt-bv(sh_8}vi^yE=MA#5ELG8}J*cGC3R!71wXS9E1KzCkv4*38!L0v4 z-(<QMyYGv>Lu0iy>sig(N$JYAzE$w9jVs6h`<BB0F9ALKL0jMX7-0(Gf8Y?s?i)SG zt{P9gRJZg}{m$zTUHfW>KTRiW5kvFga9^dS2Oj;&KR&}vFTL(B&Tu6Z-@@Y5b-#Ml zAph4H@wZg3$7=m8RrdrvmyF7$)2{gsjv7l}{n6hEFRefB8$9~Ff<Al2uN*su-gCvT zgO|!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^W<XHj7Q<k{F02t+gg1o~!n;Dd@QH9i2nbh%AB3L;tvFB|CXNuth*L#L zbcmiA;$319?DOT~L*i<2z33DD;`3qyl>CTzUYum)j4tC{#u8(xafNZ6af|Ue;~U14 zM%FaYG}*+%G4r*l*EG`1o6Y9k=Dp?@%njxv=6B2&%vx!PG*TK1yWJu!k(No1NLA8m zsaD!7ZIk{0JO5efW!U<q3>-HPTACJZXVb^gZn~*-7n?$(yLYl_rESg=PP;41mFFsS zEpk=5*1+k!!?nv*4|}r}_GUZm&VZ}Sb=5`Hv6KkgG?q(+9m;VcCvjO^N${ku<Ti0F dTq_in;?wy|elni}=d+t{N_vA0Xt!{>{{}}u`HKJm diff --git a/vbanext/instance.cpp b/vbanext/instance.cpp index 9f48a56e07..d89585f572 100644 --- a/vbanext/instance.cpp +++ b/vbanext/instance.cpp @@ -13187,47 +13187,63 @@ void LoadLegacyBatteryRam(const u8 *data, int len) } } +bool HasBatteryRam() +{ + return cpuSaveType != 5; +} + template<bool isReader>bool SyncBatteryRam(NewState *ns) { // if we were given a positive ID from the gamedb, we can choose to save/load only that type // else, we save\load everything -- even if we used our knowledge of the current state to // save only what was needed, we'd have to save that metadata as well for load - // since we may get other people's crap, try to detect that here - char batteryramid[16]; - if (!isReader) - { - std::memcpy(batteryramid, "BIZVBANEXTBATTRY", 16); - } + // file id detection + char batteryramid[8]; + std::memcpy(batteryramid, "GBABATT\0", 8); NSS(batteryramid); - if (isReader) - { - if (std::memcmp(batteryramid, "BIZVBANEXTBATTRY", 16) != 0) - return false; - } + if (std::memcmp(batteryramid, "GBABATT\0", 8) != 0) + return false; + int flashFileSize; + int eepromFileSize; + + // when writing, try to figure out the sizes as smartly as we can switch (cpuSaveType) { default: case 0: // auto - NSS(flashSaveMemory); - NSS(eepromData); + flashFileSize = 0x20000; + eepromFileSize = 0x2000; break; case 1: case 4: // eeprom - PSS(eepromData, eepromSize); + flashFileSize = 0; + eepromFileSize = eepromSize; break; case 2: // sram // should only be 32K, but vba uses 64K as a stand-in for both SRAM (guess no game ever checks mirroring?), // and for 64K flash where the program never issues any flash commands - PSS(flashSaveMemory, 0x10000); + flashFileSize = 0x10000; + eepromFileSize = 0; break; case 3: // flash - PSS(flashSaveMemory, flashSize); + flashFileSize = flashSize; + eepromFileSize = 0; break; case 5: // none + flashFileSize = 0; + eepromFileSize = 0; break; } + NSS(flashFileSize); + NSS(eepromFileSize); + // when reading, cap to allowable limits. any save file with numbers larger than this is not legal. + flashFileSize = std::min<int>(flashFileSize, sizeof(flashSaveMemory)); + eepromFileSize = std::min<int>(eepromFileSize, sizeof(eepromData)); + + PSS(flashSaveMemory, flashFileSize); + PSS(eepromData, eepromFileSize); return true; } @@ -13350,30 +13366,51 @@ EXPORT int FrameAdvance(Gigazoid *g, int input, u32 *videobuffer, s16 *audiobuff EXPORT int SaveRamSize(Gigazoid *g) { - NewStateDummy dummy; - g->SyncBatteryRam<false>(&dummy); - return dummy.GetLength(); + if (g->HasBatteryRam()) + { + NewStateDummy dummy; + g->SyncBatteryRam<false>(&dummy); + return dummy.GetLength(); + } + else + { + return 0; + } } EXPORT int SaveRamSave(Gigazoid *g, char *data, int length) { - NewStateExternalBuffer saver(data, length); - g->SyncBatteryRam<false>(&saver); - return !saver.Overflow() && saver.GetLength() == length; + if (g->HasBatteryRam()) + { + NewStateExternalBuffer saver(data, length); + g->SyncBatteryRam<false>(&saver); + return !saver.Overflow() && saver.GetLength() == length; + } + else + { + return false; + } } EXPORT int SaveRamLoad(Gigazoid *g, const char *data, int length) { - NewStateExternalBuffer loader(const_cast<char *>(data), length); - if (g->SyncBatteryRam<true>(&loader)) + if (g->HasBatteryRam()) { - return !loader.Overflow() && loader.GetLength() == length; + NewStateExternalBuffer loader(const_cast<char *>(data), length); + if (g->SyncBatteryRam<true>(&loader)) + { + return !loader.Overflow() && loader.GetLength() == length; + } + else + { + // couldn't find the magic signature at the top, so try a salvage load + g->LoadLegacyBatteryRam(reinterpret_cast<const u8*>(data), length); + return true; + } } else { - // couldn't find the magic signature at the top, so try a salvage load - g->LoadLegacyBatteryRam(reinterpret_cast<const u8*>(data), length); - return true; + return false; } }