Merge branch 'master' of Jay39w/PD-Loader into master
This commit is contained in:
@@ -8,6 +8,8 @@ namespace TLAC::Components
|
||||
{
|
||||
std::string *PlayerName;
|
||||
std::string* LevelName;
|
||||
int VocaloidPoints;
|
||||
int LevelNum;
|
||||
int LevelPlateId;
|
||||
int LevelPlateEffect;
|
||||
int SkinEquip;
|
||||
@@ -15,6 +17,18 @@ namespace TLAC::Components
|
||||
int SlideSeEquip;
|
||||
int ChainslideSeEquip;
|
||||
int SlidertouchSeEquip;
|
||||
int ModuleEquip0;
|
||||
int ModuleEquip1;
|
||||
int ModuleEquip2;
|
||||
int ModuleEquip3;
|
||||
int ModuleEquip4;
|
||||
int ModuleEquip5;
|
||||
int ModuleEquipCmn0;
|
||||
int ModuleEquipCmn1;
|
||||
int ModuleEquipCmn2;
|
||||
int ModuleEquipCmn3;
|
||||
int ModuleEquipCmn4;
|
||||
int ModuleEquipCmn5;
|
||||
bool ShowGreatClearBorder;
|
||||
bool ShowExcellentClearBorder;
|
||||
bool ShowRivalClearBorder;
|
||||
|
||||
@@ -76,7 +76,7 @@ struct PlayerData
|
||||
int32_t field_114;
|
||||
int32_t field_118;
|
||||
int32_t field_11C;
|
||||
int32_t field_120;
|
||||
int32_t level;
|
||||
int32_t level_plate_id;
|
||||
int32_t level_plate_effect;
|
||||
int32_t vocaloid_point;
|
||||
@@ -96,39 +96,39 @@ struct PlayerData
|
||||
int32_t field_164;
|
||||
int32_t field_168;
|
||||
int32_t field_16C;
|
||||
int32_t field_170;
|
||||
int32_t field_170; //170
|
||||
int32_t field_174;
|
||||
int32_t field_178;
|
||||
int32_t field_17C;
|
||||
int32_t field_180;
|
||||
int32_t field_184;
|
||||
int32_t field_184; //184
|
||||
int32_t field_188;
|
||||
int32_t field_18C;
|
||||
int32_t field_190;
|
||||
int32_t field_194;
|
||||
int32_t field_198;
|
||||
int32_t field_198; //198
|
||||
int32_t field_19C;
|
||||
int32_t field_1A0;
|
||||
int32_t field_1A4;
|
||||
int32_t field_1A8;
|
||||
int32_t field_1AC;
|
||||
int32_t field_1AC; //1AC
|
||||
int32_t field_1B0;
|
||||
int32_t field_1B4;
|
||||
int32_t field_1B8;
|
||||
int32_t field_1BC;
|
||||
int32_t field_1C0;
|
||||
int32_t field_1C4;
|
||||
int32_t field_1C8;
|
||||
int32_t field_1CC;
|
||||
int32_t field_1D0;
|
||||
int32_t field_1D4;
|
||||
int32_t field_1D8;
|
||||
int32_t field_1DC;
|
||||
int32_t field_1E0;
|
||||
int32_t field_1E4;
|
||||
int32_t field_1E8;
|
||||
int32_t field_1EC;
|
||||
int32_t field_1F0;
|
||||
int32_t module_equip0; //1C0
|
||||
int32_t module_equip1; //1C4
|
||||
int32_t module_equip2; //1C8
|
||||
int32_t module_equip3; //1CC
|
||||
int32_t module_equip4; //1D0
|
||||
int32_t module_equip5; //1D4
|
||||
int32_t module_equip_cmn0; //1D8
|
||||
int32_t module_equip_cmn1;//1DC
|
||||
int32_t module_equip_cmn2;//1E0
|
||||
int32_t module_equip_cmn3;//1E4
|
||||
int32_t module_equip_cmn4;//1E8
|
||||
int32_t module_equip_cmn5;//1EC
|
||||
int32_t field_1F0;//1F0
|
||||
int32_t field_1F4;
|
||||
int32_t field_1F8;
|
||||
int32_t field_1FC;
|
||||
@@ -148,7 +148,7 @@ struct PlayerData
|
||||
int32_t field_234;
|
||||
int32_t field_238;
|
||||
int32_t field_23C;
|
||||
int32_t field_240;
|
||||
int32_t module_hist; //240
|
||||
int32_t field_244;
|
||||
int32_t field_248;
|
||||
int32_t field_24C;
|
||||
|
||||
@@ -5,9 +5,11 @@
|
||||
#include "../Input/Keyboard/Keyboard.h"
|
||||
#include "../FileSystem/ConfigFile.h"
|
||||
#include "../Utilities/Operations.h"
|
||||
#include <windows.h>
|
||||
#include "GameState.h"
|
||||
|
||||
const std::string PLAYER_DATA_FILE_NAME = "playerdata.ini";
|
||||
|
||||
static WCHAR configPath[256];
|
||||
namespace TLAC::Components
|
||||
{
|
||||
PlayerDataManager::PlayerDataManager()
|
||||
@@ -232,6 +234,12 @@ namespace TLAC::Components
|
||||
config.TryGetValue("player_name", &customPlayerData->PlayerName);
|
||||
config.TryGetValue("level_name", &customPlayerData->LevelName);
|
||||
|
||||
// ScoreSaver copies (can be improved?)
|
||||
std::string utf8path = TLAC::framework::GetModuleDirectory() + "/playerdata.ini";
|
||||
MultiByteToWideChar(CP_UTF8, 0, utf8path.c_str(), -1, configPath, 256);
|
||||
|
||||
customPlayerData->LevelNum = config.GetIntegerValue("level");
|
||||
customPlayerData->VocaloidPoints = config.GetIntegerValue("vocaloid_point");
|
||||
customPlayerData->LevelPlateId = config.GetIntegerValue("level_plate_id");
|
||||
customPlayerData->LevelPlateEffect = config.GetIntegerValue("level_plate_effect");
|
||||
customPlayerData->SkinEquip = config.GetIntegerValue("skin_equip");
|
||||
@@ -239,6 +247,18 @@ 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->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->ShowExcellentClearBorder = config.GetBooleanValue("border_excellent");
|
||||
customPlayerData->ShowGreatClearBorder = config.GetBooleanValue("border_great");
|
||||
customPlayerData->ShowRivalClearBorder = config.GetBooleanValue("border_rival");
|
||||
@@ -247,6 +267,23 @@ namespace TLAC::Components
|
||||
customPlayerData->ActionSE = config.GetBooleanValue("act_toggle");
|
||||
moduleCardWorkaround = config.GetBooleanValue("module_card_workaround");
|
||||
|
||||
// don't want to overwrite the default values
|
||||
auto setIfNotEqual = [](int* target, int value, int comparison)
|
||||
{
|
||||
if (value != comparison)
|
||||
* target = value;
|
||||
};
|
||||
|
||||
// only need to run this line once on startup, otherwise cannot increase/decrease in-game
|
||||
setIfNotEqual(&playerData->vocaloid_point, customPlayerData->VocaloidPoints, 0);
|
||||
// run once to check if module setting is invalid
|
||||
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);
|
||||
|
||||
std::string* mylistString;
|
||||
std::vector<std::string> mylistStringVec;
|
||||
|
||||
@@ -337,6 +374,7 @@ namespace TLAC::Components
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PlayerDataManager::ApplyCustomData()
|
||||
{
|
||||
// don't want to overwrite the default values
|
||||
@@ -345,7 +383,59 @@ namespace TLAC::Components
|
||||
if (value != comparison)
|
||||
*target = value;
|
||||
};
|
||||
// check if the playerData in-game value is different from the customPlayerData value and update and save the ini
|
||||
if (customPlayerData->VocaloidPoints != playerData->vocaloid_point)
|
||||
{
|
||||
customPlayerData->VocaloidPoints = playerData->vocaloid_point;
|
||||
WCHAR val[32];
|
||||
swprintf(val, 32, L"%d", playerData->vocaloid_point);
|
||||
WritePrivateProfileStringW(L"playerdata", L"vocaloid_point", val, configPath);
|
||||
}
|
||||
// save module choices to module_equip_cmn[0-5]
|
||||
if (customPlayerData->ModuleEquipCmn0 != playerData->module_equip_cmn0)
|
||||
{
|
||||
customPlayerData->ModuleEquipCmn0 = playerData->module_equip_cmn0;
|
||||
WCHAR val[32];
|
||||
swprintf(val, 32, L"%d", playerData->module_equip_cmn0);
|
||||
WritePrivateProfileStringW(L"playerdata", L"module_equip_cmn0", val, configPath);
|
||||
}
|
||||
if (customPlayerData->ModuleEquipCmn1 != playerData->module_equip_cmn1)
|
||||
{
|
||||
customPlayerData->ModuleEquipCmn1 = playerData->module_equip_cmn1;
|
||||
WCHAR val[32];
|
||||
swprintf(val, 32, L"%d", playerData->module_equip_cmn1);
|
||||
WritePrivateProfileStringW(L"playerdata", L"module_equip_cmn1", val, configPath);
|
||||
}
|
||||
if (customPlayerData->ModuleEquipCmn2 != playerData->module_equip_cmn2)
|
||||
{
|
||||
customPlayerData->ModuleEquipCmn2 = playerData->module_equip_cmn2;
|
||||
WCHAR val[32];
|
||||
swprintf(val, 32, L"%d", playerData->module_equip_cmn2);
|
||||
WritePrivateProfileStringW(L"playerdata", L"module_equip_cmn2", val, configPath);
|
||||
}
|
||||
if (customPlayerData->ModuleEquipCmn3 != playerData->module_equip_cmn3)
|
||||
{
|
||||
customPlayerData->ModuleEquipCmn3 = playerData->module_equip_cmn3;
|
||||
WCHAR val[32];
|
||||
swprintf(val, 32, L"%d", playerData->module_equip_cmn3);
|
||||
WritePrivateProfileStringW(L"playerdata", L"module_equip_cmn3", val, configPath);
|
||||
}
|
||||
if (customPlayerData->ModuleEquipCmn4 != playerData->module_equip_cmn4)
|
||||
{
|
||||
customPlayerData->ModuleEquipCmn4 = playerData->module_equip_cmn4;
|
||||
WCHAR val[32];
|
||||
swprintf(val, 32, L"%d", playerData->module_equip_cmn4);
|
||||
WritePrivateProfileStringW(L"playerdata", L"module_equip_cmn4", val, configPath);
|
||||
}
|
||||
if (customPlayerData->ModuleEquipCmn5 != playerData->module_equip_cmn5)
|
||||
{
|
||||
customPlayerData->ModuleEquipCmn5 = playerData->module_equip_cmn5;
|
||||
WCHAR val[32];
|
||||
swprintf(val, 32, L"%d", playerData->module_equip_cmn5);
|
||||
WritePrivateProfileStringW(L"playerdata", L"module_equip_cmn5", 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);
|
||||
@@ -354,6 +444,12 @@ namespace TLAC::Components
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user