diff --git a/source-code/source/plugins/TLAC/Components/ScoreSaver.cpp b/source-code/source/plugins/TLAC/Components/ScoreSaver.cpp index 017b39d..55202a9 100644 --- a/source-code/source/plugins/TLAC/Components/ScoreSaver.cpp +++ b/source-code/source/plugins/TLAC/Components/ScoreSaver.cpp @@ -22,6 +22,11 @@ namespace TLAC::Components ScoreSaver::~ScoreSaver() { + for (int diff = 0; diff < 4; diff++) + { + *(DivaScore**)(PLAYER_DATA_ADDRESS + diff * 0x18 + 0x5d0) = 0; + *(DivaScore**)(PLAYER_DATA_ADDRESS + diff * 0x18 + 0x5d8) = 0; + } } const char* ScoreSaver::GetDisplayName() @@ -333,8 +338,8 @@ namespace TLAC::Components } else { - *(DivaScore**)(PLAYER_DATA_ADDRESS + diff * 0x18 + 0x5d0) = nullptr; - *(DivaScore**)(PLAYER_DATA_ADDRESS + diff * 0x18 + 0x5d8) = nullptr; + *(DivaScore**)(PLAYER_DATA_ADDRESS + diff * 0x18 + 0x5d0) = 0; + *(DivaScore**)(PLAYER_DATA_ADDRESS + diff * 0x18 + 0x5d8) = 0; } } @@ -366,12 +371,22 @@ namespace TLAC::Components swprintf(key, 32, L"%ls.%ls", keyBase, L"percent"); int percent = GetPrivateProfileIntW(section, key, 0, rival_configPath); + swprintf(key, 32, L"%ls.%ls", keyBase, L"alltimerank"); + int allTimeRank = GetPrivateProfileIntW(section, key, -1, rival_configPath); + + if (allTimeRank == -1) // fallback for old scores without alltimerank + { + swprintf(key, 32, L"%ls.%ls", keyBase, L"rank"); + allTimeRank = GetPrivateProfileIntW(section, key, 0, rival_configPath); + } + DivaScore* cachedScore = GetCachedScore(pvNum, diff, exDiff); if (cachedScore == nullptr) { ScoreCache[diff].push_back(DivaScore(pvNum, exDiff)); cachedScore = GetCachedScore(pvNum, diff, exDiff); } + cachedScore->rival_clearRank = allTimeRank; cachedScore->rival_score = score; cachedScore->rival_percent = percent; } @@ -391,8 +406,8 @@ namespace TLAC::Components } else { - *(DivaScore**)(PLAYER_DATA_ADDRESS + diff * 0x18 + 0x5d0) = nullptr; - *(DivaScore**)(PLAYER_DATA_ADDRESS + diff * 0x18 + 0x5d8) = nullptr; + *(DivaScore**)(PLAYER_DATA_ADDRESS + diff * 0x18 + 0x5d0) = 0; + *(DivaScore**)(PLAYER_DATA_ADDRESS + diff * 0x18 + 0x5d8) = 0; } } diff --git a/source-code/source/plugins/TLAC/Components/ScoreSaver.h b/source-code/source/plugins/TLAC/Components/ScoreSaver.h index 0b8b838..bb5490a 100644 --- a/source-code/source/plugins/TLAC/Components/ScoreSaver.h +++ b/source-code/source/plugins/TLAC/Components/ScoreSaver.h @@ -26,7 +26,8 @@ namespace TLAC::Components int clearRank; // +0xac: clear rank int score; // +0xb0: score int percent; // +0xb4: best percent - byte paddingB8[0x18]; // ??? + byte paddingB8[0x14]; // ??? + int rival_clearRank; // +0xcc: rival clear rank? int rival_score; // +0xd0: rival score int rival_percent; // +0xd4: rival percent byte paddingD8[0x8]; // ???