From 6686a3db96be412807a4ee8f15b19147471c2682 Mon Sep 17 00:00:00 2001 From: Damon Murdoch Date: Thu, 5 May 2022 11:30:22 +1000 Subject: [PATCH] Fixed bug which broke multiplayer in 5dx+, moved story loading to after car loading. Thanks Leadbman! --- OpenParrot/src/Functions/Games/ES3X/WMMT5.cpp | 4 ++- .../src/Functions/Games/ES3X/WMMT5DXPlus.cpp | 30 ++++++++++++++----- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/OpenParrot/src/Functions/Games/ES3X/WMMT5.cpp b/OpenParrot/src/Functions/Games/ES3X/WMMT5.cpp index 68565d5..2daf809 100644 --- a/OpenParrot/src/Functions/Games/ES3X/WMMT5.cpp +++ b/OpenParrot/src/Functions/Games/ES3X/WMMT5.cpp @@ -7,7 +7,9 @@ #include #include "MinHook.h" #include +#include #include + #ifdef _M_AMD64 #pragma optimize("", off) @@ -546,7 +548,7 @@ static DWORD WINAPI forceFullTune(void* pArguments) // Loops while the program is running while (true) { - // Only runs every 16th frame + // Sleep for 16ms Sleep(16); // Run the set full tune process diff --git a/OpenParrot/src/Functions/Games/ES3X/WMMT5DXPlus.cpp b/OpenParrot/src/Functions/Games/ES3X/WMMT5DXPlus.cpp index ca24a5e..f9b87eb 100644 --- a/OpenParrot/src/Functions/Games/ES3X/WMMT5DXPlus.cpp +++ b/OpenParrot/src/Functions/Games/ES3X/WMMT5DXPlus.cpp @@ -878,10 +878,26 @@ static int loadStoryData(char* filepath) uintptr_t saveStoryBase = *(uintptr_t*)(saveDataBase + 0x108); // Not sure why, but story doesn't load unless I add this - memcpy((void*)(saveStoryBase + 0x48), saveDatadxp + 0x48, 0x1); + memcpy((void*)(saveStoryBase + 0x48), saveDatadxp + 0x48, 0x8); + // Pretty sure this is the whole save file region, but need to test more :) - memcpy((void*)(saveStoryBase + 0xE0), saveDatadxp + 0xE0, 0x80); + memcpy((void*)(saveStoryBase + 0xE0), saveDatadxp + 0xE0, 0x8); + memcpy((void*)(saveStoryBase + 0xE8), saveDatadxp + 0xE8, 0x8); + memcpy((void*)(saveStoryBase + 0xF0), saveDatadxp + 0xF0, 0x8); + memcpy((void*)(saveStoryBase + 0xF8), saveDatadxp + 0xF8, 0x8); + memcpy((void*)(saveStoryBase + 0x100), saveDatadxp + 0x100, 0x8); + memcpy((void*)(saveStoryBase + 0x108), saveDatadxp + 0x108, 0x8); + memcpy((void*)(saveStoryBase + 0x110), saveDatadxp + 0x110, 0x8); + memcpy((void*)(saveStoryBase + 0x118), saveDatadxp + 0x118, 0x8); + memcpy((void*)(saveStoryBase + 0x120), saveDatadxp + 0x120, 0x8); + memcpy((void*)(saveStoryBase + 0x128), saveDatadxp + 0x128, 0x8); + memcpy((void*)(saveStoryBase + 0x130), saveDatadxp + 0x130, 0x8); + memcpy((void*)(saveStoryBase + 0x138), saveDatadxp + 0x138, 0x8); + memcpy((void*)(saveStoryBase + 0x140), saveDatadxp + 0x140, 0x8); + memcpy((void*)(saveStoryBase + 0x148), saveDatadxp + 0x148, 0x8); + memcpy((void*)(saveStoryBase + 0x150), saveDatadxp + 0x150, 0x8); + memcpy((void*)(saveStoryBase + 0x158), saveDatadxp + 0x158, 0x8); // Save data loaded successfully loadOkDxp = true; @@ -1216,7 +1232,7 @@ static int loadGameData() memset(loadPath, 0, 0xFF); // Wirte the '.' into the load path - sprintf(loadPath, "."); + sprintf(loadPath, ".\\SaveData"); // Seperate save file / cars per user profile if (ToBool(config["Save"]["Save Per Custom Name"])) @@ -1255,12 +1271,12 @@ static int loadGameData() // Ensure the directory exists std::filesystem::create_directories(loadPath); - // Load the openprogress.sav file - loadStoryData(loadPath); - // Load the car save file loadCarData(loadPath); + // Load the openprogress.sav file + loadStoryData(loadPath); + // Load the miles save file loadMileData(loadPath); @@ -1286,7 +1302,7 @@ static int SaveGameData() memset(savePath, 0, 0xFF); // Wirte the '.' into the load path - sprintf(savePath, "."); + sprintf(savePath, ".\\SaveData"); // Seperate save file / cars per user profile if (ToBool(config["Save"]["Save Per Custom Name"]))