Print version into to log

This commit is contained in:
rebtd7 2020-01-11 12:23:50 -03:00 committed by GitHub
parent c553aae0c0
commit 5d19dcc5a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 7 deletions

View File

@ -42,7 +42,7 @@ void MainContext::FF13_2_CreateSetFrameRateCodeBlock()
ChangeMemoryProtectionToReadWriteExecute(FF13_2_SET_FRAME_RATE_INJECTED_CODE, blockSize);
float frameRateConfigValue = context.config.GetFFXIIIIngameFrameRateLimit();
float frameRateConfigValue = (float)context.config.GetFFXIIIIngameFrameRateLimit();
if (AreAlmostTheSame(frameRateConfigValue, -1.0F) || frameRateConfigValue > FF13_2_MAX_FRAME_CAP) {
ff13_2_targetFrameRate = FF13_2_MAX_FRAME_CAP;
}
@ -283,7 +283,7 @@ void MainContext::FF13_2_RemoveContinuousControllerScan() {
}
void MainContext::FF13_2_AddHookIngameFrameRateLimitSetter() {
if (context.AreAlmostTheSame(context.config.GetFFXIIIIngameFrameRateLimit(), 0.0F)) {
if (context.AreAlmostTheSame((float)context.config.GetFFXIIIIngameFrameRateLimit(), 0.0F)) {
PrintLog("Frame rate should not be changed (config = 0)");
return;
}
@ -302,6 +302,10 @@ void MainContext::ChangeMemoryProtectionToReadWriteExecute(void* address, const
VirtualProtect(address, size, PAGE_EXECUTE_READWRITE, &oldProtection);
}
void MainContext::PrintVersionInfo() {
PrintLog("FF13Fix 1.3 https://github.com/rebtd7/FF13Fix");
}
bool MainContext::AreAlmostTheSame(float a, float b) {
return fabs(a - b) < 0.01f;
}

View File

@ -1,3 +1,3 @@
#pragma once
bool CheckFix(DWORD* flags);
#pragma once
bool CheckFix(DWORD* flags);

View File

@ -41,6 +41,7 @@ Config::Config()
MainContext::MainContext() : oldWndProc(nullptr)
{
LogFile("FF13Fix.log");
PrintVersionInfo();
if (config.GetAutoFix()) EnableAutoFix();

View File

@ -98,7 +98,9 @@ private:
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
WNDPROC oldWndProc;
void ChangeMemoryProtectionToReadWriteExecute(void* address, const int size);
void ChangeMemoryProtectionToReadWriteExecute(void* address, const int size);
bool AreAlmostTheSame(float a, float b);
void PrintVersionInfo();
void FF13_OneTimeFixes();
void FF13_AddHookIngameFrameRateLimitSetter();
@ -109,7 +111,6 @@ private:
void FF13_2_RemoveContinuousControllerScan();
void FF13_2_AddHookIngameFrameRateLimitSetter();
void FF13_2_OneTimeFixes();
bool AreAlmostTheSame(float a, float b);
};
extern MainContext context;