playerdatamanager: add mylists
This commit is contained in:
@@ -48,3 +48,9 @@ module_card_workaround = false
|
||||
|
||||
# Allows use of game mode modifiers (hi-speed, hidden, and sudden)
|
||||
gamemode_options = true
|
||||
|
||||
# Mylists
|
||||
# Make comma separated lists, like `mylist_A=1,2,3`
|
||||
mylist_A=
|
||||
mylist_B=
|
||||
mylist_C=
|
||||
@@ -92,6 +92,11 @@ void ApplyPatches() {
|
||||
// Allow modifier mode selection (by Team Shimapan)
|
||||
{ (void*)0x00000001405CB1B3, { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 } },
|
||||
{ (void*)0x00000001405CA0F5, { 0x90, 0x90 } },
|
||||
// allow modifier modes to work without use_card
|
||||
{ (void*)0x00000001405CB14A,{ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 } },
|
||||
{ (void*)0x0000000140136CFA,{ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 } },
|
||||
// enable module selector without use_card
|
||||
{ (void*)0x00000001405C513B,{ 0x01 } },
|
||||
// Force Hide IDs
|
||||
{ (void*)0x00000001409A5918, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ (void*)0x00000001409A5928, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace TLAC::Components
|
||||
{
|
||||
@@ -20,5 +21,6 @@ namespace TLAC::Components
|
||||
bool UseCard;
|
||||
bool GameModifierOptions;
|
||||
bool ActionSE;
|
||||
std::vector<int> Mylist[3];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -361,22 +361,16 @@ struct PlayerData
|
||||
int32_t slidertouch_se_equip_cmn;
|
||||
int32_t use_pv_slidertouch_se_equip;
|
||||
int32_t field_584;
|
||||
int32_t field_588;
|
||||
int32_t field_58C;
|
||||
int32_t field_590;
|
||||
int32_t field_594;
|
||||
int* mylistA_begin;
|
||||
int* mylistA_end;
|
||||
int32_t field_598;
|
||||
int32_t field_59C;
|
||||
int32_t field_5A0;
|
||||
int32_t field_5A4;
|
||||
int32_t field_5A8;
|
||||
int32_t field_5AC;
|
||||
int* mylistB_begin;
|
||||
int* mylistB_end;
|
||||
int32_t field_5B0;
|
||||
int32_t field_5B4;
|
||||
int32_t field_5B8;
|
||||
int32_t field_5BC;
|
||||
int32_t field_5C0;
|
||||
int32_t field_5C4;
|
||||
int* mylistC_begin;
|
||||
int* mylistC_end;
|
||||
int32_t field_5C8;
|
||||
int32_t field_5CC;
|
||||
int32_t field_5D0;
|
||||
@@ -876,7 +870,10 @@ struct PlayerData
|
||||
int32_t field_D88;
|
||||
int32_t field_D8C;
|
||||
int32_t field_D90;
|
||||
int32_t field_D94;
|
||||
uint8_t clear_border;
|
||||
uint8_t field_D95;
|
||||
uint8_t field_D96;
|
||||
uint8_t field_D97;
|
||||
int32_t field_D98;
|
||||
int32_t field_D9C;
|
||||
int32_t field_DA0;
|
||||
|
||||
@@ -4,20 +4,10 @@
|
||||
#include "../Constants.h"
|
||||
#include "../Input/Keyboard/Keyboard.h"
|
||||
#include "../FileSystem/ConfigFile.h"
|
||||
#include "../Constants.h"
|
||||
#include "../Utilities/Operations.h"
|
||||
|
||||
const std::string PLAYER_DATA_FILE_NAME = "playerdata.ini";
|
||||
|
||||
void InjectCode(void* address, const std::vector<uint8_t> data)
|
||||
{
|
||||
const size_t byteCount = data.size() * sizeof(uint8_t);
|
||||
|
||||
DWORD oldProtect;
|
||||
VirtualProtect(address, byteCount, PAGE_EXECUTE_READWRITE, &oldProtect);
|
||||
memcpy(address, data.data(), byteCount);
|
||||
VirtualProtect(address, byteCount, oldProtect, nullptr);
|
||||
}
|
||||
|
||||
namespace TLAC::Components
|
||||
{
|
||||
PlayerDataManager::PlayerDataManager()
|
||||
@@ -53,15 +43,10 @@ namespace TLAC::Components
|
||||
printf("[TLAC] PlayerDataManager::Update(): Loading config...\n");
|
||||
LoadConfig();
|
||||
}*/
|
||||
if (!customPlayerData->UseCard)
|
||||
{
|
||||
DWORD oldProtect, bck;
|
||||
// allow modifier modes to work without use_card
|
||||
InjectCode((void*)0x00000001405CB14A, { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 });
|
||||
InjectCode((void*)0x0000000140136CFA, { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 });
|
||||
// enable module selector without use_card
|
||||
InjectCode((void*)0x00000001405C513B, { 0x01 });
|
||||
}
|
||||
|
||||
// nas, I moved the patches back to patches because please.. at least don't apply it every frame when it's not necessary lol
|
||||
// and reverting was the easiest way to undo that
|
||||
|
||||
if (moduleCardWorkaround) {
|
||||
int* pvId = (int*)0x00000001418054C4;
|
||||
int* modState = (int*)0x00000001411A9790;
|
||||
@@ -262,6 +247,36 @@ namespace TLAC::Components
|
||||
customPlayerData->ActionSE = config.GetBooleanValue("act_toggle");
|
||||
moduleCardWorkaround = config.GetBooleanValue("module_card_workaround");
|
||||
|
||||
std::string* mylistString;
|
||||
std::vector<std::string> mylistStringVec;
|
||||
|
||||
customPlayerData->Mylist[0].clear();
|
||||
config.TryGetValue("mylist_A", &mylistString);
|
||||
if (mylistString != nullptr)
|
||||
{
|
||||
for (std::string &pvStr : TLAC::Utilities::Split(*mylistString, ","))
|
||||
customPlayerData->Mylist[0].push_back(atoi(pvStr.c_str()));
|
||||
delete mylistString;
|
||||
}
|
||||
|
||||
customPlayerData->Mylist[1].clear();
|
||||
config.TryGetValue("mylist_B", &mylistString);
|
||||
if (mylistString != nullptr)
|
||||
{
|
||||
for (std::string &pvStr : TLAC::Utilities::Split(*mylistString, ","))
|
||||
customPlayerData->Mylist[1].push_back(atoi(pvStr.c_str()));
|
||||
delete mylistString;
|
||||
}
|
||||
|
||||
customPlayerData->Mylist[2].clear();
|
||||
config.TryGetValue("mylist_C", &mylistString);
|
||||
if (mylistString != nullptr)
|
||||
{
|
||||
for (std::string &pvStr : TLAC::Utilities::Split(*mylistString, ","))
|
||||
customPlayerData->Mylist[2].push_back(atoi(pvStr.c_str()));
|
||||
delete mylistString;
|
||||
}
|
||||
|
||||
if (moduleCardWorkaround) {
|
||||
if (!customPlayerData->UseCard)
|
||||
{
|
||||
@@ -341,7 +356,7 @@ namespace TLAC::Components
|
||||
setIfNotEqual(&playerData->act_toggle, customPlayerData->ActionSE, 1);
|
||||
|
||||
// Display clear borders on the progress bar
|
||||
*(byte*)(PLAYER_DATA_ADDRESS + 0xD94) = (customPlayerData->ShowRivalClearBorder << 2) | (customPlayerData->ShowExcellentClearBorder << 1) | (customPlayerData->ShowGreatClearBorder);
|
||||
playerData->clear_border = (customPlayerData->ShowRivalClearBorder << 2) | (customPlayerData->ShowExcellentClearBorder << 1) | (customPlayerData->ShowGreatClearBorder);
|
||||
|
||||
playerData->use_card = customPlayerData->UseCard; // required to allow for module selection
|
||||
|
||||
@@ -350,6 +365,13 @@ namespace TLAC::Components
|
||||
memset((void*)MODULE_TABLE_START, 0xFF, 128);
|
||||
memset((void*)ITEM_TABLE_START, 0xFF, 128);
|
||||
|
||||
playerData->mylistA_begin = customPlayerData->Mylist[0].begin()._Ptr;
|
||||
playerData->mylistA_end = customPlayerData->Mylist[0].end()._Ptr;
|
||||
playerData->mylistB_begin = customPlayerData->Mylist[1].begin()._Ptr;
|
||||
playerData->mylistB_end = customPlayerData->Mylist[1].end()._Ptr;
|
||||
playerData->mylistC_begin = customPlayerData->Mylist[2].begin()._Ptr;
|
||||
playerData->mylistC_end = customPlayerData->Mylist[2].end()._Ptr;
|
||||
|
||||
if (customPlayerData->PlayerName != nullptr)
|
||||
{
|
||||
playerData->field_DC = 0x10;
|
||||
|
||||
@@ -64,6 +64,8 @@ namespace TLAC::FileSystem
|
||||
continue;
|
||||
|
||||
auto splitline = Utilities::Split(line, "=");
|
||||
if (splitline.size() < 2)
|
||||
continue;
|
||||
|
||||
for (auto &line : splitline)
|
||||
Utilities::Trim(line);
|
||||
|
||||
Reference in New Issue
Block a user