Don't rely on DIEmWin window anymore
This commit is contained in:
parent
2e08f145fc
commit
2ac408687f
|
@ -13,6 +13,7 @@
|
|||
class Logger
|
||||
{
|
||||
public:
|
||||
std::mutex printLogMutex;
|
||||
Logger(const Logger&) = delete;
|
||||
const Logger& operator=(Logger& other) = delete;
|
||||
|
||||
|
@ -124,6 +125,7 @@ inline void LogConsole(const char* title = nullptr)
|
|||
|
||||
inline void PrintLog(const char* format, ...)
|
||||
{
|
||||
const std::lock_guard<std::mutex> lock(Logger::Get().printLogMutex);
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
Logger::Get().Print(format, args);
|
||||
|
|
|
@ -103,6 +103,13 @@ HRESULT APIENTRY MainContext::ApplyVertexBufferFix(IDirect3DDevice9* pIDirect3DD
|
|||
return pIDirect3DDevice9->CreateVertexBuffer(Length, Usage, FVF, Pool, ppVertexBuffer, pSharedHandle);
|
||||
}
|
||||
|
||||
void MainContext::FF13_AsyncPatchingLoop() {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
|
||||
if (*context.ff13_frame_pacer_ptr) {
|
||||
context.FF13_OneTimeFixes();
|
||||
}
|
||||
}
|
||||
|
||||
void MainContext::FF13_InitializeGameAddresses()
|
||||
{
|
||||
// FF13 always seem to use the same addresses (even if you force ASLR on the OS), but we are calculating the addresses just in case...
|
||||
|
@ -122,13 +129,13 @@ void MainContext::FF13_InitializeGameAddresses()
|
|||
|
||||
void MainContext::FF13_OneTimeFixes() {
|
||||
MainContext::FF13_NOPIngameFrameRateLimitSetter();
|
||||
MainContext::FF13_SetFrameRateVariables();
|
||||
MainContext::FF13_RemoveContinuousControllerScan();
|
||||
MainContext::FF13_FixMissingEnemyScan();
|
||||
MainContext::FF13_EnableControllerVibration();
|
||||
MainContext::FF13_SetFrameRateVariables();
|
||||
|
||||
PrintLog("Finished FF13 One Time Fixes");
|
||||
MainContext::didOneTimeFixes = true;
|
||||
context.didOneTimeFixes = true;
|
||||
}
|
||||
|
||||
void MainContext::FF13_EnableControllerVibration()
|
||||
|
@ -250,6 +257,11 @@ void MainContext::FF13_SetFrameRateVariables() {
|
|||
}
|
||||
}
|
||||
|
||||
void MainContext::FF13_2_AsyncPatchingLoop() {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
|
||||
context.FF13_2_OneTimeFixes();
|
||||
}
|
||||
|
||||
void MainContext::FF13_2_OneTimeFixes() {
|
||||
|
||||
if (*ff13_2_frame_pacer_ptr_address) {
|
||||
|
@ -262,6 +274,9 @@ void MainContext::FF13_2_OneTimeFixes() {
|
|||
PrintLog("Finished FF13-2 One Time Fixes");
|
||||
context.didOneTimeFixes = true;
|
||||
}
|
||||
else {
|
||||
PrintLog("Unable to apply FF13-2 One Time Fixes. Report this!");
|
||||
}
|
||||
}
|
||||
|
||||
void MainContext::FF13_2_EnableControllerVibration()
|
||||
|
@ -389,7 +404,7 @@ void MainContext::ChangeMemoryProtectionToReadWriteExecute(void* address, const
|
|||
}
|
||||
|
||||
void MainContext::PrintVersionInfo() {
|
||||
PrintLog("FF13Fix 1.4.2 https://github.com/rebtd7/FF13Fix");
|
||||
PrintLog("FF13Fix 1.4.3 https://github.com/rebtd7/FF13Fix");
|
||||
}
|
||||
|
||||
bool MainContext::AreAlmostTheSame(float a, float b) {
|
||||
|
|
|
@ -192,18 +192,18 @@ bool MainContext::CheckWindow(HWND hWnd)
|
|||
PrintLog("HWND 0x%p: ClassName \"%ls\", WindowName: \"%ls\"", hWnd, className.get(), windowName.get());
|
||||
|
||||
if (!context.didOneTimeFixes) {
|
||||
if (context.autofix == FINAL_FANTASY_XIII && wcscmp(windowName.get(), L"DIEmWin") == 0) {
|
||||
if (context.autofix == FINAL_FANTASY_XIII && wcscmp(className.get(), L"SQEX.CDev.Engine.Framework.MainWindow") == 0) {
|
||||
const std::lock_guard<std::mutex> lock(context.oneTimeFixesMutex);
|
||||
if(!context.didOneTimeFixes){
|
||||
PrintLog("Starting FFXIII one time RAM patches.");
|
||||
context.FF13_OneTimeFixes();
|
||||
patchingThread = new std::thread(&context.FF13_AsyncPatchingLoop);
|
||||
}
|
||||
}
|
||||
else if (context.autofix == FINAL_FANTASY_XIII2 && wcscmp(windowName.get(), L"DIEmWin") == 0) {
|
||||
else if (context.autofix == FINAL_FANTASY_XIII2 && wcscmp(className.get(), L"SQEX.CDev.Engine.Framework.MainWindow") == 0) {
|
||||
const std::lock_guard<std::mutex> lock(context.oneTimeFixesMutex);
|
||||
if (!context.didOneTimeFixes) {
|
||||
PrintLog("Starting FFXIII-2 one time RAM patches.");
|
||||
context.FF13_2_OneTimeFixes();
|
||||
patchingThread = new std::thread(&context.FF13_2_AsyncPatchingLoop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,6 @@ class MainContext
|
|||
|
||||
public:
|
||||
MainContext();
|
||||
void Foo();
|
||||
~MainContext();
|
||||
|
||||
bool ApplyPresentationParameters(D3DPRESENT_PARAMETERS* pPresentationParameters);
|
||||
|
@ -100,6 +99,7 @@ private:
|
|||
const float FF13_2_30_FPS = 30.0F;
|
||||
const float FF13_2_MAX_FRAME_CAP = 1000.0F;
|
||||
XInputManager* xinputManager;
|
||||
std::thread * patchingThread;
|
||||
|
||||
void FixBehaviorFlagConflict(const DWORD flags_in, DWORD* flags_out);
|
||||
static const std::map<const AutoFixes, const uint32_t> behaviorflags_fixes;
|
||||
|
@ -111,6 +111,8 @@ private:
|
|||
bool AreAlmostTheSame(float a, float b);
|
||||
void PrintVersionInfo();
|
||||
|
||||
|
||||
static void FF13_AsyncPatchingLoop();
|
||||
void FF13_InitializeGameAddresses();
|
||||
void FF13_OneTimeFixes();
|
||||
void FF13_EnableControllerVibration();
|
||||
|
@ -119,6 +121,7 @@ private:
|
|||
void FF13_FixMissingEnemyScan();
|
||||
void FF13_RemoveContinuousControllerScan();
|
||||
|
||||
static void FF13_2_AsyncPatchingLoop();
|
||||
void FF13_2_CreateSetFrameRateCodeBlock();
|
||||
void FF13_2_InitializeGameAddresses();
|
||||
void FF13_2_RemoveContinuousControllerScan();
|
||||
|
|
Loading…
Reference in a new issue