From 1097ad513cfff350ee9ad9253eed2b7327cecaae Mon Sep 17 00:00:00 2001 From: Jay39w Date: Tue, 12 Nov 2019 01:20:02 +0000 Subject: [PATCH 1/5] Allow for song specific module choices and saving/loading of song specific module choices. This feature should require use_card, this is automatically enabled by default (this may be changed in the next commit) and has one notable bug, which is a significant FPS drop when selecting (or sometimes loading) modules on songs with 3 vocals. (This does NOT impact gameplay past song select to my knowledge) Huge thanks to somewhatlurker again for coding help and advice as well as just being a sweetie <3 --- .../TLAC/Components/CustomPlayerData.h | 3 + .../TLAC/Components/PlayerDataManager.cpp | 42 +++++++++- .../plugins/TLAC/Components/ScoreSaver.cpp | 77 ++++++++++++++++++- .../plugins/TLAC/Components/ScoreSaver.h | 11 ++- 4 files changed, 127 insertions(+), 6 deletions(-) diff --git a/source-code/source/plugins/TLAC/Components/CustomPlayerData.h b/source-code/source/plugins/TLAC/Components/CustomPlayerData.h index 4be53a8..c2cd89e 100644 --- a/source-code/source/plugins/TLAC/Components/CustomPlayerData.h +++ b/source-code/source/plugins/TLAC/Components/CustomPlayerData.h @@ -29,6 +29,9 @@ namespace TLAC::Components int ModuleEquipCmn3; int ModuleEquipCmn4; int ModuleEquipCmn5; + int ActionVol; + int ActionSlideVol; + int UsePVEquip; bool ShowGreatClearBorder; bool ShowExcellentClearBorder; bool ShowRivalClearBorder; diff --git a/source-code/source/plugins/TLAC/Components/PlayerDataManager.cpp b/source-code/source/plugins/TLAC/Components/PlayerDataManager.cpp index 352f50b..f0a8507 100644 --- a/source-code/source/plugins/TLAC/Components/PlayerDataManager.cpp +++ b/source-code/source/plugins/TLAC/Components/PlayerDataManager.cpp @@ -10,6 +10,8 @@ const std::string PLAYER_DATA_FILE_NAME = "playerdata.ini"; static WCHAR configPath[256]; +int* headitemequip = (int*)0x0000000141804CDC; +int customheaditemequip; namespace TLAC::Components { PlayerDataManager::PlayerDataManager() @@ -234,7 +236,7 @@ namespace TLAC::Components config.TryGetValue("player_name", &customPlayerData->PlayerName); config.TryGetValue("level_name", &customPlayerData->LevelName); - // ScoreSaver copies (can be improved?) + // ScoreSaver copies & declaring non-playerdata values std::string utf8path = TLAC::framework::GetModuleDirectory() + "/playerdata.ini"; MultiByteToWideChar(CP_UTF8, 0, utf8path.c_str(), -1, configPath, 256); @@ -253,12 +255,16 @@ namespace TLAC::Components //customPlayerData->ModuleEquip3 = config.GetIntegerValue("module_equip3"); //customPlayerData->ModuleEquip4 = config.GetIntegerValue("module_equip4"); //customPlayerData->ModuleEquip5 = config.GetIntegerValue("module_equip5"); + customPlayerData->UsePVEquip = config.GetIntegerValue("use_pv_module_equip"); customPlayerData->ModuleEquipCmn0 = config.GetIntegerValue("module_equip_cmn0"); customPlayerData->ModuleEquipCmn1 = config.GetIntegerValue("module_equip_cmn1"); customPlayerData->ModuleEquipCmn2 = config.GetIntegerValue("module_equip_cmn2"); customPlayerData->ModuleEquipCmn3 = config.GetIntegerValue("module_equip_cmn3"); customPlayerData->ModuleEquipCmn4 = config.GetIntegerValue("module_equip_cmn4"); customPlayerData->ModuleEquipCmn5 = config.GetIntegerValue("module_equip_cmn5"); + customPlayerData->ActionVol = config.GetIntegerValue("act_vol"); + customPlayerData->ActionSlideVol = config.GetIntegerValue("act_slide_vol"); + customheaditemequip = config.GetIntegerValue("head_item"); customPlayerData->ShowExcellentClearBorder = config.GetBooleanValue("border_excellent"); customPlayerData->ShowGreatClearBorder = config.GetBooleanValue("border_great"); customPlayerData->ShowRivalClearBorder = config.GetBooleanValue("border_rival"); @@ -274,15 +280,18 @@ namespace TLAC::Components * target = value; }; - // only need to run this line once on startup, otherwise cannot increase/decrease in-game + // only need to run this line once on startup, otherwise cannot increase/decrease in-game (or use per-song settings!) setIfNotEqual(&playerData->vocaloid_point, customPlayerData->VocaloidPoints, 0); - // run once to check if module setting is invalid + setIfNotEqual(&playerData->skin_equip_cmn, customPlayerData->SkinEquip, 0); setIfNotEqual(&playerData->module_equip_cmn0, customPlayerData->ModuleEquipCmn0, 0); setIfNotEqual(&playerData->module_equip_cmn1, customPlayerData->ModuleEquipCmn1, 0); setIfNotEqual(&playerData->module_equip_cmn2, customPlayerData->ModuleEquipCmn2, 0); setIfNotEqual(&playerData->module_equip_cmn3, customPlayerData->ModuleEquipCmn3, 0); setIfNotEqual(&playerData->module_equip_cmn4, customPlayerData->ModuleEquipCmn4, 0); setIfNotEqual(&playerData->module_equip_cmn5, customPlayerData->ModuleEquipCmn5, 0); + setIfNotEqual(headitemequip, customheaditemequip, 0); + setIfNotEqual(&playerData->act_vol, customPlayerData->ActionVol, 100); + setIfNotEqual(&playerData->act_slide_vol, customPlayerData->ActionSlideVol, 100); std::string* mylistString; std::vector mylistStringVec; @@ -434,11 +443,36 @@ namespace TLAC::Components swprintf(val, 32, L"%d", playerData->module_equip_cmn5); WritePrivateProfileStringW(L"playerdata", L"module_equip_cmn5", val, configPath); } + if (customPlayerData->ActionVol != playerData->act_vol) + { + customPlayerData->ActionVol = playerData->act_vol; + WCHAR val[32]; + swprintf(val, 32, L"%d", playerData->act_vol); + WritePrivateProfileStringW(L"playerdata", L"act_vol", val, configPath); + } + if (customPlayerData->ActionSlideVol != playerData->act_slide_vol) + { + customPlayerData->ActionSlideVol = playerData->act_slide_vol; + WCHAR val[32]; + swprintf(val, 32, L"%d", playerData->act_slide_vol); + WritePrivateProfileStringW(L"playerdata", L"act_slide_vol", val, configPath); + } + if (playerData->use_pv_module_equip != 1) + { + playerData->use_pv_module_equip = 1; + } + if (customheaditemequip != *headitemequip) + { + customheaditemequip = *headitemequip; + WCHAR val[32]; + swprintf(val, 32, L"%d", *headitemequip); + WritePrivateProfileStringW(L"playerdata", L"head_item", val, configPath); + } + setIfNotEqual(&playerData->level, customPlayerData->LevelNum, 1); setIfNotEqual(&playerData->level_plate_id, customPlayerData->LevelPlateId, 0); setIfNotEqual(&playerData->level_plate_effect, customPlayerData->LevelPlateEffect, 0); - setIfNotEqual(&playerData->skin_equip, customPlayerData->SkinEquip, 0); setIfNotEqual(&playerData->btn_se_equip, customPlayerData->BtnSeEquip, -1); setIfNotEqual(&playerData->slide_se_equip, customPlayerData->SlideSeEquip, -1); setIfNotEqual(&playerData->chainslide_se_equip, customPlayerData->ChainslideSeEquip, -1); diff --git a/source-code/source/plugins/TLAC/Components/ScoreSaver.cpp b/source-code/source/plugins/TLAC/Components/ScoreSaver.cpp index 4b68d39..c68eca2 100644 --- a/source-code/source/plugins/TLAC/Components/ScoreSaver.cpp +++ b/source-code/source/plugins/TLAC/Components/ScoreSaver.cpp @@ -13,12 +13,15 @@ namespace TLAC::Components { WCHAR ScoreSaver::configPath[256]; WCHAR ScoreSaver::rival_configPath[256]; + WCHAR ScoreSaver::modules_configPath[256]; ScoreSaver::ScoreSaver() { std::string utf8path = TLAC::framework::GetModuleDirectory() + "/scores.ini"; MultiByteToWideChar(CP_UTF8, 0, utf8path.c_str(), -1, configPath, 256); utf8path = TLAC::framework::GetModuleDirectory() + "/rivalscores.ini"; MultiByteToWideChar(CP_UTF8, 0, utf8path.c_str(), -1, rival_configPath, 256); + utf8path = TLAC::framework::GetModuleDirectory() + "/modules.ini"; + MultiByteToWideChar(CP_UTF8, 0, utf8path.c_str(), -1, modules_configPath, 256); } ScoreSaver::~ScoreSaver() @@ -354,12 +357,16 @@ namespace TLAC::Components // update score begin and end vars from game FixScoreCacheAddresses(diff); } - + else + { + UpdateSingleScoreCacheModulesEntry; + } currentPv = pvNum; currentDifficulty = diff; currentDifficultyIsEx = diffIsEx; currentInsurance = insurance; } + ModuleCheck(pvNum, diff, diffIsEx); } } } @@ -541,6 +548,73 @@ namespace TLAC::Components } } + void ScoreSaver::UpdateSingleScoreCacheModulesEntry(int pvNum, int diff, int exDiff) + { + if (pvNum < 0 || diff < 0 || exDiff < 0 || pvNum > 999 || diff > 3 || exDiff > 1) + return; + + + WCHAR keyBase[32]; // needs to be big enough to store pv.999 + WCHAR key[32]; // needs to be big enough to store pv.999.module5 + + const WCHAR section[] = L"modules"; + swprintf(keyBase, 32, L"pv.%03d", pvNum); + + for (int i = 0; i < 6; ++i) + { + swprintf(key, 32, L"%ls.module%d", keyBase, i); + int INImodule = GetPrivateProfileIntW(section, key, 0, modules_configPath); + + if (INImodule > 0) + { + DivaScore* cachedScore = GetCachedScore(pvNum, diff, exDiff); + if (cachedScore == nullptr) + { + ScoreCache[diff].push_back(DivaScore(pvNum, exDiff)); + cachedScore = GetCachedScore(pvNum, diff, exDiff); + } + if (cachedScore != nullptr) + { + cachedScore->per_module_equip[i] = INImodule; + WCHAR val[32]; + swprintf(val, 32, L"%d", INImodule); + WritePrivateProfileStringW(L"modules", key, val, modules_configPath); + } + } + } + + + } + + void ScoreSaver::ModuleCheck(int pvNum, int diff, int exDiff) + { + if (pvNum < 0 || diff < 0 || exDiff < 0 || pvNum > 999 || diff > 3 || exDiff > 1) + return; + + WCHAR keyBase[32]; // needs to be big enough to store pv.999 + WCHAR key[32]; // needs to be big enough to store pv.999.module5 + const WCHAR section[] = L"modules"; + swprintf(keyBase, 32, L"pv.%03d", pvNum); + DivaScore* cachedScore = GetCachedScore(pvNum, diff, exDiff); + for (int i = 0; i < 6; ++i) + { + swprintf(key, 32, L"%ls.module%d", keyBase, i); + int INImodule = GetPrivateProfileIntW(section, key, 0, modules_configPath); + if (INImodule != cachedScore->per_module_equip[0] || INImodule != cachedScore->per_module_equip[1] || INImodule != cachedScore->per_module_equip[2] || INImodule != cachedScore->per_module_equip[3] || INImodule != cachedScore->per_module_equip[4] || INImodule != cachedScore->per_module_equip[5]) + { + INImodule = *cachedScore->per_module_equip; + WCHAR val[32]; + swprintf(val, 32, L"%d", cachedScore->per_module_equip[i]); + WritePrivateProfileStringW(L"modules", key, val, modules_configPath); + } + else + { + return; + } + } + + } + void ScoreSaver::FixScoreCacheAddresses(int diff) { // update score begin and end vars from game @@ -558,6 +632,7 @@ namespace TLAC::Components { UpdateSingleScoreCacheEntry(pvNum, diff, exDiff, false); UpdateSingleScoreCacheRivalEntry(pvNum, diff, exDiff); + UpdateSingleScoreCacheModulesEntry(pvNum, diff, exDiff); } } } diff --git a/source-code/source/plugins/TLAC/Components/ScoreSaver.h b/source-code/source/plugins/TLAC/Components/ScoreSaver.h index dc58a0c..ff62e4d 100644 --- a/source-code/source/plugins/TLAC/Components/ScoreSaver.h +++ b/source-code/source/plugins/TLAC/Components/ScoreSaver.h @@ -23,7 +23,13 @@ namespace TLAC::Components { int pvNum; int exDifficulty; - byte padding08[0xa4]; // ??? -- seems to be 6*6 ints (0x90 bytes) for modules + 5 ints (0x14 bytes) for skin and button se + int per_module_equip[6]; + int other_module_shit[30]; // ??? -- seems to be 6*6 ints (0x90 bytes) for modules + 5 ints (0x14 bytes) for skin and button se + int per_skin_equip; + int per_btn_se_equip; + int per_slide_se_equip; + int per_chainslide_se_equip; + int per_slidertouch_se_equip; int clearRank; // +0xac: clear rank int score; // +0xb0: score int percent; // +0xb4: best percent @@ -104,9 +110,11 @@ namespace TLAC::Components static void UpdateScoreCache(); static void UpdateSingleScoreCacheEntry(int pvNum, int diff, int exDiff, bool doDefaultsReset); static void UpdateSingleScoreCacheRivalEntry(int pvNum, int diff, int exDiff); + static void UpdateSingleScoreCacheModulesEntry(int pvNum, int diff, int exDiff); static void FixScoreCacheAddresses(int diff); // only call this from the main thread static DivaScore* GetCachedScore(int pvNum, int diff, int exDiff); static void UpdateClearCounts(); + static void ModuleCheck(int pvNum, int diff, int exDiff); private: static bool(__stdcall* divaInitResults)(void* cls); @@ -118,6 +126,7 @@ namespace TLAC::Components static WCHAR configPath[256]; static WCHAR rival_configPath[256]; + static WCHAR modules_configPath[256]; static std::thread initThread; int currentPv; From 7a119900e2d292f5d549ebe9d31f344d6b09f1e5 Mon Sep 17 00:00:00 2001 From: Jay39w Date: Tue, 12 Nov 2019 23:52:03 +0000 Subject: [PATCH 2/5] Add song-specific booleans to Launcher.dva for easier access --- source-code/source/plugins/Launcher/framework.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source-code/source/plugins/Launcher/framework.h b/source-code/source/plugins/Launcher/framework.h index 01def69..56816f5 100644 --- a/source-code/source/plugins/Launcher/framework.h +++ b/source-code/source/plugins/Launcher/framework.h @@ -224,6 +224,9 @@ ConfigOptionBase* playerdataArray[] = { new BooleanOption(L"use_card", PLAYERDATA_SECTION, PLAYERDATA_FILE, L"Use Card", L"Enables IC card. This allows module selection.", false, true), new BooleanOption(L"module_card_workaround", PLAYERDATA_SECTION, PLAYERDATA_FILE, L"Module Selection Workaround", L"Allows module selection without card and tries to improve menu performance.\n(BETA)", true, true), + new BooleanOption(L"use_pv_module_equip ", PLAYERDATA_SECTION, PLAYERDATA_FILE, L"Song Specific Modules", L"Allows song-specific module selection.", false, true), + new BooleanOption(L"use_pv_skin_equip ", PLAYERDATA_SECTION, PLAYERDATA_FILE, L"Song Specific Skins", L"Allows song-specific skin settings.\nValues stored in skins.ini", false, true), + new BooleanOption(L"use_pv_sfx_equip ", PLAYERDATA_SECTION, PLAYERDATA_FILE, L"Song Specific Sound Effects", L"Allows song-specific sound effect settings.\nValues stored in sfx.ini", false, true), new BooleanOption(L"gamemode_options", PLAYERDATA_SECTION, PLAYERDATA_FILE, L"Game Modifiers", L"Allows use of game mode modifiers (hi-speed, hidden, and sudden).", true, true), }; From 5416c60f9af96ee6173ffec8eb7b8210f0565375 Mon Sep 17 00:00:00 2001 From: Jay39w Date: Tue, 12 Nov 2019 23:53:26 +0000 Subject: [PATCH 3/5] Allow song specific choices such as modules, skins and sfx. Set in playerdata.ini, modules.ini, skins.ini and sfx.ini respectively. --- .../TLAC/Components/CustomPlayerData.h | 2 + .../TLAC/Components/PlayerDataManager.cpp | 44 +++--- .../plugins/TLAC/Components/ScoreSaver.cpp | 133 +++++++++++++++++- .../plugins/TLAC/Components/ScoreSaver.h | 4 + 4 files changed, 153 insertions(+), 30 deletions(-) diff --git a/source-code/source/plugins/TLAC/Components/CustomPlayerData.h b/source-code/source/plugins/TLAC/Components/CustomPlayerData.h index c2cd89e..5d9d385 100644 --- a/source-code/source/plugins/TLAC/Components/CustomPlayerData.h +++ b/source-code/source/plugins/TLAC/Components/CustomPlayerData.h @@ -32,6 +32,8 @@ namespace TLAC::Components int ActionVol; int ActionSlideVol; int UsePVEquip; + int UsePVSFXEquip; + int UsePVSkinEquip; bool ShowGreatClearBorder; bool ShowExcellentClearBorder; bool ShowRivalClearBorder; diff --git a/source-code/source/plugins/TLAC/Components/PlayerDataManager.cpp b/source-code/source/plugins/TLAC/Components/PlayerDataManager.cpp index f0a8507..abfbfb9 100644 --- a/source-code/source/plugins/TLAC/Components/PlayerDataManager.cpp +++ b/source-code/source/plugins/TLAC/Components/PlayerDataManager.cpp @@ -249,13 +249,6 @@ namespace TLAC::Components customPlayerData->SlideSeEquip = config.GetIntegerValue("slide_se_equip"); customPlayerData->ChainslideSeEquip = config.GetIntegerValue("chainslide_se_equip"); customPlayerData->SlidertouchSeEquip = config.GetIntegerValue("slidertouch_se_equip"); - //customPlayerData->ModuleEquip0 = config.GetIntegerValue("module_equip0"); See below for explanation - //customPlayerData->ModuleEquip1 = config.GetIntegerValue("module_equip1"); - //customPlayerData->ModuleEquip2 = config.GetIntegerValue("module_equip2"); - //customPlayerData->ModuleEquip3 = config.GetIntegerValue("module_equip3"); - //customPlayerData->ModuleEquip4 = config.GetIntegerValue("module_equip4"); - //customPlayerData->ModuleEquip5 = config.GetIntegerValue("module_equip5"); - customPlayerData->UsePVEquip = config.GetIntegerValue("use_pv_module_equip"); customPlayerData->ModuleEquipCmn0 = config.GetIntegerValue("module_equip_cmn0"); customPlayerData->ModuleEquipCmn1 = config.GetIntegerValue("module_equip_cmn1"); customPlayerData->ModuleEquipCmn2 = config.GetIntegerValue("module_equip_cmn2"); @@ -264,7 +257,9 @@ namespace TLAC::Components customPlayerData->ModuleEquipCmn5 = config.GetIntegerValue("module_equip_cmn5"); customPlayerData->ActionVol = config.GetIntegerValue("act_vol"); customPlayerData->ActionSlideVol = config.GetIntegerValue("act_slide_vol"); - customheaditemequip = config.GetIntegerValue("head_item"); + customPlayerData->UsePVSFXEquip = config.GetBooleanValue("use_pv_sfx_equip"); + customPlayerData->UsePVSkinEquip = config.GetBooleanValue("use_pv_skin_equip"); + customPlayerData->UsePVEquip = config.GetBooleanValue("use_pv_module_equip"); customPlayerData->ShowExcellentClearBorder = config.GetBooleanValue("border_excellent"); customPlayerData->ShowGreatClearBorder = config.GetBooleanValue("border_great"); customPlayerData->ShowRivalClearBorder = config.GetBooleanValue("border_rival"); @@ -289,9 +284,13 @@ namespace TLAC::Components setIfNotEqual(&playerData->module_equip_cmn3, customPlayerData->ModuleEquipCmn3, 0); setIfNotEqual(&playerData->module_equip_cmn4, customPlayerData->ModuleEquipCmn4, 0); setIfNotEqual(&playerData->module_equip_cmn5, customPlayerData->ModuleEquipCmn5, 0); - setIfNotEqual(headitemequip, customheaditemequip, 0); setIfNotEqual(&playerData->act_vol, customPlayerData->ActionVol, 100); setIfNotEqual(&playerData->act_slide_vol, customPlayerData->ActionSlideVol, 100); + setIfNotEqual(&playerData->btn_se_equip, customPlayerData->BtnSeEquip, -1); + setIfNotEqual(&playerData->slide_se_equip, customPlayerData->SlideSeEquip, -1); + setIfNotEqual(&playerData->chainslide_se_equip, customPlayerData->ChainslideSeEquip, -1); + setIfNotEqual(&playerData->slidertouch_se_equip, customPlayerData->SlidertouchSeEquip, -1); + setIfNotEqual(&playerData->act_toggle, customPlayerData->ActionSE, 1); std::string* mylistString; std::vector mylistStringVec; @@ -457,33 +456,26 @@ namespace TLAC::Components swprintf(val, 32, L"%d", playerData->act_slide_vol); WritePrivateProfileStringW(L"playerdata", L"act_slide_vol", val, configPath); } - if (playerData->use_pv_module_equip != 1) + if (customPlayerData->UsePVEquip != playerData->use_pv_module_equip) { playerData->use_pv_module_equip = 1; } - if (customheaditemequip != *headitemequip) + if (customPlayerData->UsePVSFXEquip != playerData->use_pv_btn_se_equip) { - customheaditemequip = *headitemequip; - WCHAR val[32]; - swprintf(val, 32, L"%d", *headitemequip); - WritePrivateProfileStringW(L"playerdata", L"head_item", val, configPath); + playerData->use_pv_btn_se_equip = 1; + playerData->use_pv_chainslide_se_equip = 1; + playerData->use_pv_slidertouch_se_equip = 1; + playerData->use_pv_slide_se_equip = 1; + } + if (customPlayerData->UsePVSkinEquip != playerData->use_pv_skin_equip) + { + playerData->use_pv_skin_equip = 1; } setIfNotEqual(&playerData->level, customPlayerData->LevelNum, 1); setIfNotEqual(&playerData->level_plate_id, customPlayerData->LevelPlateId, 0); setIfNotEqual(&playerData->level_plate_effect, customPlayerData->LevelPlateEffect, 0); - setIfNotEqual(&playerData->btn_se_equip, customPlayerData->BtnSeEquip, -1); - setIfNotEqual(&playerData->slide_se_equip, customPlayerData->SlideSeEquip, -1); - setIfNotEqual(&playerData->chainslide_se_equip, customPlayerData->ChainslideSeEquip, -1); - setIfNotEqual(&playerData->slidertouch_se_equip, customPlayerData->SlidertouchSeEquip, -1); - setIfNotEqual(&playerData->act_toggle, customPlayerData->ActionSE, 1); - //setIfNotEqual(&playerData->module_equip0, customPlayerData->ModuleEquip0, 0); Do NOT recommend using this - //setIfNotEqual(&playerData->module_equip1, customPlayerData->ModuleEquip1, 0); - //setIfNotEqual(&playerData->module_equip2, customPlayerData->ModuleEquip2, 0); - //setIfNotEqual(&playerData->module_equip3, customPlayerData->ModuleEquip3, 0); - //setIfNotEqual(&playerData->module_equip4, customPlayerData->ModuleEquip4, 0); - //setIfNotEqual(&playerData->module_equip5, customPlayerData->ModuleEquip5, 0); // Display clear borders on the progress bar playerData->clear_border = (customPlayerData->ShowRivalClearBorder << 2) | (customPlayerData->ShowExcellentClearBorder << 1) | (customPlayerData->ShowGreatClearBorder); diff --git a/source-code/source/plugins/TLAC/Components/ScoreSaver.cpp b/source-code/source/plugins/TLAC/Components/ScoreSaver.cpp index c68eca2..fa1ce40 100644 --- a/source-code/source/plugins/TLAC/Components/ScoreSaver.cpp +++ b/source-code/source/plugins/TLAC/Components/ScoreSaver.cpp @@ -14,14 +14,21 @@ namespace TLAC::Components WCHAR ScoreSaver::configPath[256]; WCHAR ScoreSaver::rival_configPath[256]; WCHAR ScoreSaver::modules_configPath[256]; + WCHAR ScoreSaver::skins_configPath[256]; + WCHAR ScoreSaver::sfx_configPath[256]; ScoreSaver::ScoreSaver() { std::string utf8path = TLAC::framework::GetModuleDirectory() + "/scores.ini"; MultiByteToWideChar(CP_UTF8, 0, utf8path.c_str(), -1, configPath, 256); utf8path = TLAC::framework::GetModuleDirectory() + "/rivalscores.ini"; MultiByteToWideChar(CP_UTF8, 0, utf8path.c_str(), -1, rival_configPath, 256); - utf8path = TLAC::framework::GetModuleDirectory() + "/modules.ini"; + utf8path = TLAC::framework::GetModuleDirectory() + "/pv_equip/modules.ini"; MultiByteToWideChar(CP_UTF8, 0, utf8path.c_str(), -1, modules_configPath, 256); + utf8path = TLAC::framework::GetModuleDirectory() + "/pv_equip/skins.ini"; + MultiByteToWideChar(CP_UTF8, 0, utf8path.c_str(), -1, skins_configPath, 256); + utf8path = TLAC::framework::GetModuleDirectory() + "/pv_equip/sfx.ini"; + MultiByteToWideChar(CP_UTF8, 0, utf8path.c_str(), -1, sfx_configPath, 256); + } ScoreSaver::~ScoreSaver() @@ -559,6 +566,21 @@ namespace TLAC::Components const WCHAR section[] = L"modules"; swprintf(keyBase, 32, L"pv.%03d", pvNum); + swprintf(key, 32, L"%ls.skin", keyBase); + int INISkin = GetPrivateProfileIntW(section, key, 0, skins_configPath); + if (INISkin > 0) + { + DivaScore* cachedScore = GetCachedScore(pvNum, diff, exDiff); + if (cachedScore == nullptr) + { + ScoreCache[diff].push_back(DivaScore(pvNum, exDiff)); + cachedScore = GetCachedScore(pvNum, diff, exDiff); + } + if (cachedScore != nullptr) + { + cachedScore->per_skin_equip = INISkin; + } + } for (int i = 0; i < 6; ++i) { @@ -576,9 +598,6 @@ namespace TLAC::Components if (cachedScore != nullptr) { cachedScore->per_module_equip[i] = INImodule; - WCHAR val[32]; - swprintf(val, 32, L"%d", INImodule); - WritePrivateProfileStringW(L"modules", key, val, modules_configPath); } } } @@ -615,6 +634,110 @@ namespace TLAC::Components } + void ScoreSaver::UpdateSingleScoreCacheSkinsEntry(int pvNum, int diff, int exDiff) + { + if (pvNum < 0 || diff < 0 || exDiff < 0 || pvNum > 999 || diff > 3 || exDiff > 1) + return; + + + WCHAR keyBase[32]; // needs to be big enough to store pv.999 + WCHAR key[32]; // needs to be big enough to store pv.999.module5 + + const WCHAR section[] = L"skins"; + swprintf(keyBase, 32, L"pv.%03d", pvNum); + swprintf(key, 32, L"%ls.skin", keyBase); + int INISkin = GetPrivateProfileIntW(section, key, 0, skins_configPath); + if (INISkin > 0) + { + DivaScore* cachedScore = GetCachedScore(pvNum, diff, exDiff); + if (cachedScore == nullptr) + { + ScoreCache[diff].push_back(DivaScore(pvNum, exDiff)); + cachedScore = GetCachedScore(pvNum, diff, exDiff); + } + if (cachedScore != nullptr) + { + cachedScore->per_skin_equip = INISkin; + } + } + } + + void ScoreSaver::UpdateSingleScoreCacheSFXEntry(int pvNum, int diff, int exDiff) + { + if (pvNum < 0 || diff < 0 || exDiff < 0 || pvNum > 999 || diff > 3 || exDiff > 1) + return; + + + WCHAR keyBase[32]; // needs to be big enough to store pv.999 + WCHAR key[32]; // needs to be big enough to store pv.999.module5 + + const WCHAR section[] = L"SFX"; + swprintf(keyBase, 32, L"pv.%03d", pvNum); + swprintf(key, 32, L"%ls.btn", keyBase); + int INIBtn = GetPrivateProfileIntW(section, key, 0, sfx_configPath); + if (INIBtn > 0) + { + DivaScore* cachedScore = GetCachedScore(pvNum, diff, exDiff); + if (cachedScore == nullptr) + { + ScoreCache[diff].push_back(DivaScore(pvNum, exDiff)); + cachedScore = GetCachedScore(pvNum, diff, exDiff); + } + if (cachedScore != nullptr) + { + cachedScore->per_btn_se_equip = INIBtn; + } + } + swprintf(keyBase, 32, L"pv.%03d", pvNum); + swprintf(key, 32, L"%ls.chain", keyBase); + int INIChain = GetPrivateProfileIntW(section, key, 0, sfx_configPath); + if (INIChain > 0) + { + DivaScore* cachedScore = GetCachedScore(pvNum, diff, exDiff); + if (cachedScore == nullptr) + { + ScoreCache[diff].push_back(DivaScore(pvNum, exDiff)); + cachedScore = GetCachedScore(pvNum, diff, exDiff); + } + if (cachedScore != nullptr) + { + cachedScore->per_chainslide_se_equip = INIChain; + } + } + swprintf(keyBase, 32, L"pv.%03d", pvNum); + swprintf(key, 32, L"%ls.slide", keyBase); + int INISlide = GetPrivateProfileIntW(section, key, 0, sfx_configPath); + if (INISlide > 0) + { + DivaScore* cachedScore = GetCachedScore(pvNum, diff, exDiff); + if (cachedScore == nullptr) + { + ScoreCache[diff].push_back(DivaScore(pvNum, exDiff)); + cachedScore = GetCachedScore(pvNum, diff, exDiff); + } + if (cachedScore != nullptr) + { + cachedScore->per_slide_se_equip = INISlide; + } + } + swprintf(keyBase, 32, L"pv.%03d", pvNum); + swprintf(key, 32, L"%ls.touch", keyBase); + int INITouch = GetPrivateProfileIntW(section, key, 0, sfx_configPath); + if (INITouch > 0) + { + DivaScore* cachedScore = GetCachedScore(pvNum, diff, exDiff); + if (cachedScore == nullptr) + { + ScoreCache[diff].push_back(DivaScore(pvNum, exDiff)); + cachedScore = GetCachedScore(pvNum, diff, exDiff); + } + if (cachedScore != nullptr) + { + cachedScore->per_slidertouch_se_equip = INITouch; + } + } + } + void ScoreSaver::FixScoreCacheAddresses(int diff) { // update score begin and end vars from game @@ -633,6 +756,8 @@ namespace TLAC::Components UpdateSingleScoreCacheEntry(pvNum, diff, exDiff, false); UpdateSingleScoreCacheRivalEntry(pvNum, diff, exDiff); UpdateSingleScoreCacheModulesEntry(pvNum, diff, exDiff); + UpdateSingleScoreCacheSkinsEntry(pvNum, diff, exDiff); + UpdateSingleScoreCacheSFXEntry(pvNum, diff, exDiff); } } } diff --git a/source-code/source/plugins/TLAC/Components/ScoreSaver.h b/source-code/source/plugins/TLAC/Components/ScoreSaver.h index ff62e4d..247b45a 100644 --- a/source-code/source/plugins/TLAC/Components/ScoreSaver.h +++ b/source-code/source/plugins/TLAC/Components/ScoreSaver.h @@ -111,6 +111,8 @@ namespace TLAC::Components static void UpdateSingleScoreCacheEntry(int pvNum, int diff, int exDiff, bool doDefaultsReset); static void UpdateSingleScoreCacheRivalEntry(int pvNum, int diff, int exDiff); static void UpdateSingleScoreCacheModulesEntry(int pvNum, int diff, int exDiff); + static void UpdateSingleScoreCacheSkinsEntry(int pvNum, int diff, int exDiff); + static void UpdateSingleScoreCacheSFXEntry(int pvNum, int diff, int exDiff); static void FixScoreCacheAddresses(int diff); // only call this from the main thread static DivaScore* GetCachedScore(int pvNum, int diff, int exDiff); static void UpdateClearCounts(); @@ -127,6 +129,8 @@ namespace TLAC::Components static WCHAR configPath[256]; static WCHAR rival_configPath[256]; static WCHAR modules_configPath[256]; + static WCHAR skins_configPath[256]; + static WCHAR sfx_configPath[256]; static std::thread initThread; int currentPv; From e47624a30032f572a52530eb2391b1e2bd08fd57 Mon Sep 17 00:00:00 2001 From: Jay39w Date: Tue, 12 Nov 2019 23:56:56 +0000 Subject: [PATCH 4/5] new base playerdata.ini --- source-code/data/plugins/playerdata.ini | 76 ++++++++++++++----------- 1 file changed, 42 insertions(+), 34 deletions(-) diff --git a/source-code/data/plugins/playerdata.ini b/source-code/data/plugins/playerdata.ini index fbf649f..e5ab653 100644 --- a/source-code/data/plugins/playerdata.ini +++ b/source-code/data/plugins/playerdata.ini @@ -1,3 +1,4 @@ +[playerdata] ######################################### # /!\ WARNING: DO NOT EDIT WITH NOTEPAD!# ######################################### @@ -5,52 +6,59 @@ # playerdata.ini # defines constant values to be loaded into the PlayerData struct # this file has to be encoded using utf-8 - -player_name = NO-NAME -level_name = 忘れないでね私の声を +player_name =NO-NAME +level_name =忘れないでね私の声を +level =1 +vocaloid_point=0 # IDs defined in rom/gm_plate_tbl.farc/gm_plate_id.bin -level_plate_id = 0 -# Shows an effect on the level plate (-1=off, 0~2=different settings) -level_plate_effect =-1 - -# IDs same as gam_skin%03d -skin_equip = 0 - +level_plate_id =0 +level_plate_effect=1 +# IDs same as gam_skin%3d +skin_equip =0 +# Allows for song specific skin settings which can be set in the file skins.ini +use_pv_skin_equip =true # IDs defined in rom/gm_btn_se_tbl.farc/gm_btn_se_id.bin -btn_se_equip = -1 - +btn_se_equip =-1 +# Allows for song specific sound effect settings which can be set in the file sfx.ini +use_pv_sfx_equip =true # IDs defined in rom/gm_slide_se_tbl.farc/gm_slide_se_id.bin -slide_se_equip = -1 - +slide_se_equip =-1 # IDs defined in rom/gm_chainslide_se_tbl.farc/gm_chainslide_se_id.bin -chainslide_se_equip = -1 - -# IDs defined in rom/gm_slidertouch_se_tbl.farc/gm_slidertouch_se_id.bin(?) -slidertouch_se_equip =-1 - -# Enable button/slider sounds -act_toggle = true - +chainslide_se_equip =-1 +slidertouch_se_equip=-1 +# "Shared Set" or "Original" setting, works similarly to PSP series module selection (Updates when changed in-game) +module_equip_cmn0=0 +module_equip_cmn1=0 +module_equip_cmn2=0 +module_equip_cmn3=0 +module_equip_cmn4=0 +module_equip_cmn5=0 +# Allows Song Specific module selections (values update when changed in-game in the file modules.ini) (May lag on song select and menu) +use_pv_module_equip=true +# Enable button/slider sounds & volume settings +act_toggle =true +act_vol =100 +act_slide_vol=100 # Show clear borders on Progress Bar for: # Great -border_great = true +border_great =true # Excellent -border_excellent = true -# Rival score -border_rival =false +border_excellent =true +# Rival +border_rival=true -# Allows module selection safely (WARNING: It may cause lag in the main menu and other places) -use_card = true +# Allows module selection (WARNING: It may cause lag in the main menu and other places) (May be necessary for use_pv_equip settings!) +use_card =true -# Attempts to disable module refresh when sliding in PV select to reduce CPU and IO load. -module_card_workaround = false +# Allows module selection without card and attempts to disable module refresh when sliding in PV select to reduce CPU and IO load. +module_card_workaround =false # Allows use of game mode modifiers (hi-speed, hidden, and sudden) -gamemode_options = true +gamemode_options =true + + -# Mylists -# Make comma separated lists, like `mylist_A=1,2,3` mylist_A= mylist_B= -mylist_C= \ No newline at end of file +mylist_C= From d2884fcaed0e0aba18c9c7feb018145a97fdb5ff Mon Sep 17 00:00:00 2001 From: Jay39w Date: Tue, 12 Nov 2019 23:58:27 +0000 Subject: [PATCH 5/5] new song specific ini files please note the player must edit these before they have any effect in-game --- source-code/data/plugins/pv_equip/modules.ini | 2 ++ source-code/data/plugins/pv_equip/sfx.ini | 4 ++++ source-code/data/plugins/pv_equip/skins.ini | 3 +++ 3 files changed, 9 insertions(+) create mode 100644 source-code/data/plugins/pv_equip/modules.ini create mode 100644 source-code/data/plugins/pv_equip/sfx.ini create mode 100644 source-code/data/plugins/pv_equip/skins.ini diff --git a/source-code/data/plugins/pv_equip/modules.ini b/source-code/data/plugins/pv_equip/modules.ini new file mode 100644 index 0000000..614255b --- /dev/null +++ b/source-code/data/plugins/pv_equip/modules.ini @@ -0,0 +1,2 @@ +[modules] +# Manual editing is NOT recommended as the game will save here during gameplay \ No newline at end of file diff --git a/source-code/data/plugins/pv_equip/sfx.ini b/source-code/data/plugins/pv_equip/sfx.ini new file mode 100644 index 0000000..4334136 --- /dev/null +++ b/source-code/data/plugins/pv_equip/sfx.ini @@ -0,0 +1,4 @@ +[SFX] +# INI Format = ' pv.xxx.btn = sfx id (ex. 5) ' +# pv.001.btn=2 for example +# pv.xxx.btn, pv.xxx.chain, pv.xxx.slide & pv.xxx.touch can all be assigned using the format \ No newline at end of file diff --git a/source-code/data/plugins/pv_equip/skins.ini b/source-code/data/plugins/pv_equip/skins.ini new file mode 100644 index 0000000..431c606 --- /dev/null +++ b/source-code/data/plugins/pv_equip/skins.ini @@ -0,0 +1,3 @@ +[skins] +# INI Format = ' pv.xxx.skin = skin ID (ex. 123) ' +# pv.001.skin=100 for example