From 226881020d74ccb7beb44f8ad8d04c311eb17389 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sun, 2 Jun 2024 12:27:01 +0200 Subject: [PATCH] identify modes from different versions --- system.cpp | 3 ++- yendor.cpp | 30 +++++++++++++++++++++++++----- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/system.cpp b/system.cpp index 4b488d8e..776cfdaf 100644 --- a/system.cpp +++ b/system.cpp @@ -1287,7 +1287,7 @@ EX void loadsave() { && !(land == laOcean && verless(ver, "8.0f")) && !(land == laTerracotta && verless(ver, "10.3e")) && !(land == laWildWest && verless(ver, "11.3b") && !verless(ver, "11.3"))) - tactic::record(l2, score, xc); + tactic::record(l2, score, get_identify(xc)); anticheat::nextid(tactic::id, ver, cert); } } @@ -1305,6 +1305,7 @@ EX void loadsave() { if(won) if(anticheat::check(cert, ver, won ? "WON" : "LOST", tc, t, ts, xc*999 + cid + 256 * oy)) { if(xc == 19 && cid == 25) xc = 0; + xc = get_identify(xc); if(cid > 0 && cid < YENDORLEVELS) if(!(verless(ver, "8.0f") && oy > 1 && cid == 15)) if(!(verless(ver, "9.3b") && oy > 1 && (cid == 27 || cid == 28))) diff --git a/yendor.cpp b/yendor.cpp index 6c178c0c..a3d00169 100644 --- a/yendor.cpp +++ b/yendor.cpp @@ -967,6 +967,7 @@ EX } map code_for; EX map meaning; +EX map identify_modes; char xcheat; @@ -1095,6 +1096,18 @@ EX void load_mode_data_with_zero(hstream& f) { } } +#if HDR +constexpr int FIRST_MODECODE = 100000; +#endif + +EX modecode_t get_identify(modecode_t xc) { + if(xc < FIRST_MODECODE) { + meaning[xc] = "LEGACY"; + return xc; + } + return identify_modes[xc]; + } + EX modecode_t modecode(int mode) { modecode_t x = legacy_modecode(); if(x != UNKNOWN) return x; @@ -1103,16 +1116,19 @@ EX modecode_t modecode(int mode) { shstream ss; ss.write(ss.vernum); save_mode_data(ss); + string code = ss.s; + string nover = ss.s.substr(2); - if(code_for.count(ss.s)) return code_for[ss.s]; + if(code_for.count(nover)) return code_for[nover]; if(mode == 1) return UNKNOWN; - modecode_t next = 100000; + modecode_t next = FIRST_MODECODE; while(meaning.count(next)) next++; - meaning[next] = ss.s; - code_for[ss.s] = next; + meaning[next] = code; + code_for[nover] = next; + identify_modes[next] = next; if(mode == 2) return next; @@ -1134,8 +1150,12 @@ EX void load_modecode_line(string s) { if(!s[pos]) return; pos++; string t = from_hexstring(s.substr(pos)); - code_for[t] = code; + string nover = t.substr(2); meaning[code] = t; + if(code_for.count(nover)) + code = identify_modes[code] = code_for[nover]; + else identify_modes[code] = code; + code_for[nover] = code; } EX namespace peace {