score_saver: add rival clear rank (not sure, but seems like it at a glance even though it isn't really shown anywhere)

This commit is contained in:
somewhatlurker
2019-09-22 22:53:16 +10:00
parent 85b8245a64
commit 14d1001bca
2 changed files with 21 additions and 5 deletions
@@ -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;
}
}
@@ -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]; // ???