score_saver: add more info to output
This commit is contained in:
@@ -33,73 +33,102 @@ namespace TLAC::Components
|
|||||||
DetourTransactionCommit();
|
DetourTransactionCommit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScoreSaver::hookedInitResults(void* cls)
|
void ScoreSaver::hookedInitResults(void* cls)
|
||||||
{
|
{
|
||||||
divaInitResults(cls);
|
divaInitResults(cls);
|
||||||
|
|
||||||
int clearRank = *(int*)(RESULTS_BASE_ADDRESS + 0xe8);
|
int clearRank = *(int*)(RESULTS_BASE_ADDRESS + 0xe8);
|
||||||
int insurance = *(int*)RESULTS_INSURANCE_ADDRESS;
|
int insurance = *(int*)RESULTS_INSURANCE_ADDRESS;
|
||||||
|
|
||||||
if (clearRank < 2 || insurance !=0)
|
if (clearRank < 2 || insurance !=0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// get the base for this specific set of results
|
// get the base for this specific set of results
|
||||||
uint64_t resultBase = *(uint64_t*)(RESULTS_BASE_ADDRESS + 0x100);
|
uint64_t resultBase = *(uint64_t*)(RESULTS_BASE_ADDRESS + 0x100);
|
||||||
|
|
||||||
int pvNum = *(int*)(resultBase + 0x2c);
|
int pvNum = *(int*)(resultBase + 0x2c);
|
||||||
int pvDifficulty = *(int*)(resultBase + 0x34);
|
int pvDifficulty = *(int*)(resultBase + 0x34);
|
||||||
int modifier = *(int*)(resultBase + 0x70);
|
int modifier = *(int*)(resultBase + 0x70);
|
||||||
|
|
||||||
int* cntHitTypes = (int*)(resultBase + 0x158);
|
int* cntHitTypes = (int*)(resultBase + 0x158);
|
||||||
int combo = *(int*)(resultBase + 0x180);
|
int* pctHitTypes = (int*)(resultBase + 0x16c);
|
||||||
int score = *(int*)(resultBase + 0x18c);
|
int combo = *(int*)(resultBase + 0x180);
|
||||||
int percent = *(int*)(resultBase + 0x190);
|
int challengeScore = *(int*)(resultBase + 0x184);
|
||||||
|
int holdScore = *(int*)(resultBase + 0x188);
|
||||||
|
int score = *(int*)(resultBase + 0x18c);
|
||||||
|
int percent = *(int*)(resultBase + 0x190);
|
||||||
|
int slideScore = *(int*)(resultBase + 0x194);
|
||||||
|
|
||||||
int checkField = ((short)score ^ ((short)cntHitTypes[0] << 16) ^ ((short)cntHitTypes[1]) ^ ((short)percent << 16) ^ ((short)combo)) * clearRank;
|
int checkField = ((short)score ^ ((short)cntHitTypes[0] << 16) ^ ((short)cntHitTypes[1]) ^ ((short)percent << 16) ^ ((short)combo)) * clearRank;
|
||||||
|
|
||||||
|
WCHAR songName[256];
|
||||||
|
//std::string utf8song = *(std::string*)(CURRENT_SONG_NAME_ADDRESS);
|
||||||
|
uint64_t songnamelen = *(uint64_t*)(CURRENT_SONG_NAME_ADDRESS + 0x18);
|
||||||
|
char* utf8song = songnamelen < 0x10 ? (char*)CURRENT_SONG_NAME_ADDRESS : *(char**)CURRENT_SONG_NAME_ADDRESS;
|
||||||
|
MultiByteToWideChar(CP_UTF8, 0, utf8song, -1, songName, 256);
|
||||||
|
|
||||||
|
|
||||||
WCHAR keyBase[16]; // needs to be big enough to store pv.999.diff.4
|
WCHAR keyBase[16]; // needs to be big enough to store pv.999.diff.4
|
||||||
WCHAR key[32]; // needs to be big enough to store pv.999.diff.4.modifier
|
WCHAR key[32]; // needs to be big enough to store pv.999.diff.4.challengescore
|
||||||
WCHAR val[16]; // needs to be big enough to store any int
|
WCHAR val[32]; // needs to be big enough to store five <=four digit ints (with comma separators)
|
||||||
|
|
||||||
const WCHAR section[] = L"scores";
|
const WCHAR section[] = L"scores";
|
||||||
|
|
||||||
swprintf(keyBase, 16, L"pv.%03d.diff.%01d", pvNum, pvDifficulty);
|
swprintf(keyBase, 16, L"pv.%03d.diff.%01d", pvNum, pvDifficulty);
|
||||||
|
|
||||||
swprintf(key, 32, L"%ls.%ls", keyBase, L"score");
|
swprintf(key, 32, L"%ls.%ls", keyBase, L"score");
|
||||||
int oldScore = GetPrivateProfileIntW(section, key, 0, ScoreSaver::configPath);
|
int oldScore = GetPrivateProfileIntW(section, key, 0, ScoreSaver::configPath);
|
||||||
|
|
||||||
if (score <= oldScore)
|
if (score <= oldScore)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
swprintf(key, 32, L"%ls.%ls", keyBase, L"combo");
|
swprintf(key, 32, L"%ls.%ls", keyBase, L"challengescore");
|
||||||
swprintf(val, 16, L"%d", combo);
|
swprintf(val, 32, L"%d", challengeScore);
|
||||||
WritePrivateProfileStringW(section, key, val, ScoreSaver::configPath);
|
WritePrivateProfileStringW(section, key, val, ScoreSaver::configPath);
|
||||||
|
|
||||||
swprintf(key, 32, L"%ls.%ls", keyBase, L"cools");
|
swprintf(key, 32, L"%ls.%ls", keyBase, L"combo");
|
||||||
swprintf(val, 16, L"%d", cntHitTypes[0]);
|
swprintf(val, 32, L"%d", combo);
|
||||||
WritePrivateProfileStringW(section, key, val, ScoreSaver::configPath);
|
WritePrivateProfileStringW(section, key, val, ScoreSaver::configPath);
|
||||||
|
|
||||||
swprintf(key, 32, L"%ls.%ls", keyBase, L"modifier");
|
swprintf(key, 32, L"%ls.%ls", keyBase, L"holdscore");
|
||||||
swprintf(val, 16, L"%d", modifier);
|
swprintf(val, 32, L"%d", holdScore);
|
||||||
WritePrivateProfileStringW(section, key, val, ScoreSaver::configPath);
|
WritePrivateProfileStringW(section, key, val, ScoreSaver::configPath);
|
||||||
|
|
||||||
swprintf(key, 32, L"%ls.%ls", keyBase, L"percent");
|
swprintf(key, 32, L"%ls.%ls", keyBase, L"modifier");
|
||||||
swprintf(val, 16, L"%d", percent);
|
swprintf(val, 32, L"%d", modifier);
|
||||||
WritePrivateProfileStringW(section, key, val, ScoreSaver::configPath);
|
WritePrivateProfileStringW(section, key, val, ScoreSaver::configPath);
|
||||||
|
|
||||||
swprintf(key, 32, L"%ls.%ls", keyBase, L"rank");
|
swprintf(key, 32, L"%ls.%ls", keyBase, L"name");
|
||||||
swprintf(val, 16, L"%d", clearRank);
|
WritePrivateProfileStringW(section, key, songName, ScoreSaver::configPath);
|
||||||
WritePrivateProfileStringW(section, key, val, ScoreSaver::configPath);
|
|
||||||
|
|
||||||
swprintf(key, 32, L"%ls.%ls", keyBase, L"score");
|
swprintf(key, 32, L"%ls.%ls", keyBase, L"notecounts");
|
||||||
swprintf(val, 16, L"%d", score);
|
swprintf(val, 32, L"%d,%d,%d,%d,%d", cntHitTypes[0], cntHitTypes[1], cntHitTypes[2], cntHitTypes[3], cntHitTypes[4]);
|
||||||
WritePrivateProfileStringW(section, key, val, ScoreSaver::configPath);
|
WritePrivateProfileStringW(section, key, val, ScoreSaver::configPath);
|
||||||
|
|
||||||
swprintf(key, 32, L"%ls.%ls", keyBase, L"check");
|
swprintf(key, 32, L"%ls.%ls", keyBase, L"notepercents");
|
||||||
swprintf(val, 16, L"%d", checkField);
|
swprintf(val, 32, L"%d,%d,%d,%d,%d", pctHitTypes[0], pctHitTypes[1], pctHitTypes[2], pctHitTypes[3], pctHitTypes[4]);
|
||||||
WritePrivateProfileStringW(section, key, val, ScoreSaver::configPath);
|
WritePrivateProfileStringW(section, key, val, ScoreSaver::configPath);
|
||||||
}
|
|
||||||
|
swprintf(key, 32, L"%ls.%ls", keyBase, L"percent");
|
||||||
|
swprintf(val, 32, L"%d", percent);
|
||||||
|
WritePrivateProfileStringW(section, key, val, ScoreSaver::configPath);
|
||||||
|
|
||||||
|
swprintf(key, 32, L"%ls.%ls", keyBase, L"rank");
|
||||||
|
swprintf(val, 32, L"%d", clearRank);
|
||||||
|
WritePrivateProfileStringW(section, key, val, ScoreSaver::configPath);
|
||||||
|
|
||||||
|
swprintf(key, 32, L"%ls.%ls", keyBase, L"score");
|
||||||
|
swprintf(val, 32, L"%d", score);
|
||||||
|
WritePrivateProfileStringW(section, key, val, ScoreSaver::configPath);
|
||||||
|
|
||||||
|
swprintf(key, 32, L"%ls.%ls", keyBase, L"slidescore");
|
||||||
|
swprintf(val, 32, L"%d", slideScore);
|
||||||
|
WritePrivateProfileStringW(section, key, val, ScoreSaver::configPath);
|
||||||
|
|
||||||
|
swprintf(key, 32, L"%ls.%ls", keyBase, L"check");
|
||||||
|
swprintf(val, 32, L"%d", checkField);
|
||||||
|
WritePrivateProfileStringW(section, key, val, ScoreSaver::configPath);
|
||||||
|
}
|
||||||
|
|
||||||
void ScoreSaver::Update()
|
void ScoreSaver::Update()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -92,6 +92,9 @@ constexpr uint64_t RESULTS_INIT_ADDRESS = 0x000000014065BBC0;
|
|||||||
constexpr uint64_t RESULTS_BASE_ADDRESS = 0x000000014CC93830;
|
constexpr uint64_t RESULTS_BASE_ADDRESS = 0x000000014CC93830;
|
||||||
constexpr uint64_t RESULTS_INSURANCE_ADDRESS = 0x0000000141197E14;
|
constexpr uint64_t RESULTS_INSURANCE_ADDRESS = 0x0000000141197E14;
|
||||||
|
|
||||||
|
constexpr uint64_t CURRENT_SONG_NAME_ADDRESS = 0x0000000140D0A578;
|
||||||
|
constexpr uint64_t CURRENT_SONG_ID_ADDRESS = 0x0000000140CDD8E0;
|
||||||
|
|
||||||
#define XINPUT_A 0x00
|
#define XINPUT_A 0x00
|
||||||
#define XINPUT_B 0x01
|
#define XINPUT_B 0x01
|
||||||
#define XINPUT_X 0x02
|
#define XINPUT_X 0x02
|
||||||
|
|||||||
Reference in New Issue
Block a user