From 97924ed72d1e8c023472009c84b1b72753ab2a47 Mon Sep 17 00:00:00 2001 From: Grinch_ Date: Sat, 21 Aug 2021 08:54:11 +0600 Subject: [PATCH] Add generate timecyc option (vc) --- .vscode/c_cpp_properties.json | 10 +-- src/Hook.cpp | 2 +- src/MenuInfo.h | 2 +- src/TimeCycle.h | 2 + src/Visual.cpp | 147 +++++++++++++++++++++------------- 5 files changed, 101 insertions(+), 62 deletions(-) diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 9bf22bb..aa011ad 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -6,10 +6,10 @@ "${workspaceFolder}/**", "${PLUGIN_SDK_DIR}/*", "${DIRECTX9_SDK_DIR}/Include/*", - // "${PLUGIN_SDK_DIR}/plugin_sa/*", - // "${PLUGIN_SDK_DIR}/plugin_sa/game_sa/*", - "${PLUGIN_SDK_DIR}/plugin_vc/*", - "${PLUGIN_SDK_DIR}/plugin_vc/game_vc/*", + "${PLUGIN_SDK_DIR}/plugin_sa/*", + "${PLUGIN_SDK_DIR}/plugin_sa/game_sa/*", + // "${PLUGIN_SDK_DIR}/plugin_vc/*", + // "${PLUGIN_SDK_DIR}/plugin_vc/game_vc/*", "${PLUGIN_SDK_DIR}/shared/*", "${PLUGIN_SDK_DIR}/shared/game/*", "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.19041.0\\ucrt\\*", @@ -20,7 +20,7 @@ "IS_PLATFORM_WIN", "_CRT_SECURE_NO_WARNINGS", "_CRT_NON_CONFORMING_SWPRINTFS", - "GTAVC", + "GTASA", "_DX9_SDK_INSTALLED", "PLUGIN_SGV_10US" ], diff --git a/src/Hook.cpp b/src/Hook.cpp index d7c146c..5523b1d 100644 --- a/src/Hook.cpp +++ b/src/Hook.cpp @@ -137,7 +137,7 @@ void Hook::RenderFrame(void* ptr) io.IniFilename = nullptr; io.LogFilename = nullptr; - io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad && ImGuiConfigFlags_NavEnableKeyboard; + io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; style.WindowTitleAlign = ImVec2(0.5, 0.5); oWndProc = (WNDPROC)SetWindowLongPtr(RsGlobal.ps->window, GWL_WNDPROC, (LRESULT)WndProc); diff --git a/src/MenuInfo.h b/src/MenuInfo.h index 882cf15..3ba1430 100644 --- a/src/MenuInfo.h +++ b/src/MenuInfo.h @@ -2,5 +2,5 @@ #define MENU_NAME "Cheat Menu" #define MENU_VERSION_NUMBER "2.9" #define MENU_VERSION MENU_VERSION_NUMBER"-beta" -#define BUILD_NUMBER "20210815" +#define BUILD_NUMBER "20210821" #define MENU_TITLE MENU_NAME " v" MENU_VERSION "(" BUILD_NUMBER ")" diff --git a/src/TimeCycle.h b/src/TimeCycle.h index 90a7ed2..1ab30ce 100644 --- a/src/TimeCycle.h +++ b/src/TimeCycle.h @@ -1,3 +1,5 @@ +#pragma once + uchar* m_nAmbientRed = (uchar*)BY_GAME(0x560C61, 0x9388C8); uchar* m_nAmbientGreen = (uchar*)BY_GAME(0x55F4D6, 0x78D508); uchar* m_nAmbientBlue = (uchar*)BY_GAME(0x55F4E8, 0x813D48); diff --git a/src/Visual.cpp b/src/Visual.cpp index 9ad8474..348e2c5 100644 --- a/src/Visual.cpp +++ b/src/Visual.cpp @@ -132,6 +132,7 @@ void Visual::GenerateTimecycFile() { #ifdef GTASA std::ofstream file; + std::string buffer; if (m_nTimecycHour == 24) { file = std::ofstream("timecyc_24h.dat"); @@ -143,80 +144,116 @@ void Visual::GenerateTimecycFile() for (uint i = 0; i < m_WeatherNames.size(); ++i) { - file << "\n\n//////////// " << m_WeatherNames[i] << "\n"; - file << - "//\tAmb\t\t\t\t\tAmb Obj \t\t\t\tDir \t\t\t\t\tSky top\t\t\t\tSky bot\t\t\t\tSunCore\t\t\t\t\tSunCorona\t\t\tSunSz\tSprSz\tSprBght\t\tShdw\tLightShd\tPoleShd\t\tFarClp\t\tFogSt\tLightOnGround\tLowCloudsRGB\tBottomCloudRGB\t\tWaterRGBA\t\t\t\tARGB1\t\t\t\t\tARGB2\t\t\tCloudAlpha\t\tIntensityLimit\t\tWaterFogAlpha\tDirMult \n\n"; + buffer += "\n// " + m_WeatherNames[i] + "\n"; + buffer += "// Amb Amb Obj Dir Sky top Sky bot SunCore SunCorona SunSz SprSz SprBght Shdw LightShd PoleShd FarClp FogSt LightOnGround LowCloudsRGB BottomCloudRGB WaterRGBA ARGB1 ARGB2 CloudAlpha IntensityLimit WaterFogAlpha DirMult"; + file << buffer << std::endl; for (int j = 0; j < m_nTimecycHour; ++j) { if (m_nTimecycHour == 24) { - if (j >= 12) - file << "// " << j << " PM\n"; + if (j < 12) + { + buffer = std::format("// {} AM\n", j); + } else - file << "// " << j << " AM\n"; + { + buffer = std::format("// {} PM\n", j); + } } else { - if (j == 0) file << "// Midnight\n"; - if (j == 1) file << "// 5 AM\n"; - if (j == 2) file << "// 6 AM\n"; - if (j == 3) file << "// 7 AM\n"; - if (j == 4) file << "// Midday\n"; - if (j == 5) file << "// 7 PM\n"; - if (j == 6) file << "// 8 PM\n"; - if (j == 7) file << "// 10 PM\n"; + if (j == 0) buffer = "// Midnight\n"; + if (j == 1) buffer = "// 5 AM\n"; + if (j == 2) buffer = "// 6 AM\n"; + if (j == 3) buffer = "// 7 AM\n"; + if (j == 4) buffer = "// Midday\n"; + if (j == 5) buffer = "// 7 PM\n"; + if (j == 6) buffer = "// 8 PM\n"; + if (j == 7) buffer = "// 10 PM\n"; } int val = 23 * j + i; - file << "\t" << GetTCVal(m_nAmbientRed, val) << " " << GetTCVal(m_nAmbientGreen, val) << " " << GetTCVal( - m_nAmbientBlue, val) << " \t\t" + buffer += std::format("{} {} {}\t{} {} {}\t255 255 255\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {} {}\t{} {} {} {}\t{} {} {} {}\t{} {} {} {}", + GetTCVal(m_nAmbientRed, val), GetTCVal(m_nAmbientGreen, val), GetTCVal(m_nAmbientBlue, val), + GetTCVal(m_nAmbientRed_Obj, val), GetTCVal(m_nAmbientGreen_Obj, val), GetTCVal(m_nAmbientBlue_Obj, val), + GetTCVal(m_nSkyTopRed, val), GetTCVal(m_nSkyTopGreen, val), GetTCVal(m_nSkyTopBlue, val), + GetTCVal(m_nSkyBottomRed, val), GetTCVal(m_nSkyBottomGreen, val), GetTCVal(m_nSkyBottomBlue, val), + GetTCVal(m_nSunCoreRed, val), GetTCVal(m_nSunCoreGreen, val), GetTCVal(m_nSunCoreBlue, val), + GetTCVal(m_nSunCoronaRed, val), GetTCVal(m_nSunCoronaGreen, val), GetTCVal(m_nSunCoronaBlue, val), + GetTCVal(m_fSunSize, val) / 10.0f, GetTCVal(m_fSpriteSize, val) / 10.0f, GetTCVal(m_fSpriteBrightness, val) / 10.0f, + GetTCVal(m_nShadowStrength, val), GetTCVal(m_nLightShadowStrength, val), GetTCVal(m_nPoleShadowStrength, val), + GetTCVal(m_fFarClip, val), GetTCVal(m_fFogStart, val), GetTCVal(m_fLightsOnGroundBrightness, val)/ 10.0f, + GetTCVal(m_nLowCloudsRed, val), GetTCVal(m_nLowCloudsGreen, val), GetTCVal(m_nLowCloudsBlue, val), + GetTCVal(m_nSkyBottomRed, val), GetTCVal(m_nSkyBottomGreen, val), GetTCVal(m_nSkyBottomBlue, val), + GetTCVal(m_fWaterRed, val), GetTCVal(m_fWaterGreen, val), GetTCVal(m_fWaterBlue, val), GetTCVal(m_fWaterAlpha, val), + GetTCVal(m_fPostFx1Red, val), GetTCVal(m_fPostFx1Green, val), GetTCVal(m_fPostFx1Blue, val), GetTCVal(m_fPostFx1Alpha, val), + GetTCVal(m_fPostFx2Red, val), GetTCVal(m_fPostFx2Green, val), GetTCVal(m_fPostFx2Blue, val), GetTCVal(m_fPostFx2Alpha, val), + GetTCVal(m_fCloudAlpha, val), GetTCVal(m_nHighLightMinIntensity, val), GetTCVal(m_nWaterFogAlpha, val), GetTCVal(m_nDirectionalMult, val) / 100.0 + ); + file << buffer << std::endl; + } + } +#elif GTAVC + std::ofstream file = std::ofstream("timecyc.dat"); - << "\t" << GetTCVal(m_nAmbientRed_Obj, val) << " " << GetTCVal(m_nAmbientGreen_Obj, val) << " " << - GetTCVal(m_nAmbientBlue_Obj, val) << " \t\t" + for (uint i = 0; i < 4; ++i) + { + std::string buffer; + switch(i) + { + case 0: + buffer = "\n// SUNNY\n"; + break; + case 1: + buffer = "\n// CLOUDY\n"; + break; + case 2: + buffer = "\n// RAINY\n"; + break; + case 3: + buffer = "\n// FOGGY\n"; + } - << "\t255 255 255\t\t" // unused + buffer += "// Amb Amb_Obj Amb_bl Amb_Obj_bl Dir Sky top Sky bot SunCore SunCorona SunSz SprSz SprBght Shdw LightShd PoleShd FarClp FogSt LightOnGround LowCloudsRGB TopCloudRGB BottomCloudRGB BlurRGB WaterRGBA"; - << "\t" << GetTCVal(m_nSkyTopRed, val) << " " << GetTCVal(m_nSkyTopGreen, val) << " " << GetTCVal( - m_nSkyTopBlue, val) << " \t\t" + file << buffer << std::endl; - << "\t" << GetTCVal(m_nSkyBottomRed, val) << " " << GetTCVal(m_nSkyBottomGreen, val) << " " << GetTCVal( - m_nSkyBottomBlue, val) << " \t\t" + for (size_t j = 0; j < 24; ++j) + { + buffer = "// " + std::to_string(j) + " "; + if (j < 12) + { + buffer += "AM\n"; + } + else + { + buffer += "PM\n"; + } - << "\t" << GetTCVal(m_nSunCoreRed, val) << " " << GetTCVal(m_nSunCoreGreen, val) << " " << GetTCVal( - m_nSunCoreBlue, val) << " \t\t" + size_t val = 7 * i + j; - << "\t" << GetTCVal(m_nSunCoronaRed, val) << " " << GetTCVal(m_nSunCoronaGreen, val) << " " << GetTCVal( - m_nSunCoronaBlue, val) << " \t\t" - - << "\t" << (GetTCVal(m_fSunSize, val) - 0.5f) / 10.0f << " " << (GetTCVal(m_fSpriteSize, val) - 0.5f) / - 10.0f << " " << (GetTCVal(m_fSpriteBrightness, val) - 0.5f) / 10.0f << " \t\t" - - << "\t" << GetTCVal(m_nShadowStrength, val) << " " << GetTCVal(m_nLightShadowStrength, val) << " " << - GetTCVal(m_nPoleShadowStrength, val) << " \t\t" - - << "\t" << GetTCVal(m_fFarClip, val) << " " << GetTCVal(m_fFogStart, val) << " " << (GetTCVal( - m_fLightsOnGroundBrightness, val) - 0.5) / 10.0f << " \t\t" - - << "\t" << GetTCVal(m_nLowCloudsRed, val) << " " << GetTCVal(m_nLowCloudsGreen, val) << " " << GetTCVal( - m_nLowCloudsBlue, val) << " \t\t" - - << "\t" << GetTCVal(m_nFluffyCloudsBottomRed, val) << " " << GetTCVal(m_nFluffyCloudsBottomGreen, val) - << " " << GetTCVal(m_nFluffyCloudsBottomBlue, val) << " \t\t" - - << "\t" << GetTCVal(m_fWaterRed, val) << " " << GetTCVal(m_fWaterGreen, val) << " " << - GetTCVal(m_fWaterBlue, val) << " " << GetTCVal(m_fWaterAlpha, val) << " \t\t" - - << "\t" << GetTCVal(m_fPostFx1Alpha, val) << " " << GetTCVal(m_fPostFx1Red, val) << " " << - GetTCVal(m_fPostFx1Green, val) << " " << GetTCVal(m_fPostFx1Blue, val) << " \t\t" - - << "\t" << GetTCVal(m_fPostFx2Alpha, val) << " " << GetTCVal(m_fPostFx2Red, val) << " " << - GetTCVal(m_fPostFx2Green, val) << " " << GetTCVal(m_fPostFx2Blue, val) << " \t\t" - - << "\t" << GetTCVal(m_fCloudAlpha, val) << " " << GetTCVal(m_nHighLightMinIntensity, val) << " " << - GetTCVal(m_nWaterFogAlpha, val) << " " << GetTCVal(m_nDirectionalMult, val) / 100.0 << " \t\t" << - std::endl; + buffer += std::format("{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {}\t{} {} {} {}", + GetTCVal(m_nAmbientRed, val), GetTCVal(m_nAmbientGreen, val), GetTCVal(m_nAmbientBlue, val), + GetTCVal(m_nAmbientRed_Obj, val), GetTCVal(m_nAmbientGreen_Obj, val), GetTCVal(m_nAmbientBlue_Obj, val), + GetTCVal(m_nAmbientBlRed, val), GetTCVal(m_nAmbientBlGreen, val), GetTCVal(m_nAmbientBlBlue, val), + GetTCVal(m_nAmbientBlRed_Obj, val), GetTCVal(m_nAmbientBlGreen_Obj, val), GetTCVal(m_nAmbientBlBlue_Obj, val), + GetTCVal(m_nDirRed, val), GetTCVal(m_nDirGreen, val), GetTCVal(m_nDirBlue, val), + GetTCVal(m_nSkyTopRed, val), GetTCVal(m_nSkyTopGreen, val), GetTCVal(m_nSkyTopBlue, val), + GetTCVal(m_nSkyBottomRed, val), GetTCVal(m_nSkyBottomGreen, val), GetTCVal(m_nSkyBottomBlue, val), + GetTCVal(m_nSunCoreRed, val), GetTCVal(m_nSunCoreGreen, val), GetTCVal(m_nSunCoreBlue, val), + GetTCVal(m_nSunCoronaRed, val), GetTCVal(m_nSunCoronaGreen, val), GetTCVal(m_nSunCoronaBlue, val), + GetTCVal(m_fSunSize, val) / 10.0f, GetTCVal(m_fSpriteSize, val) / 10.0f, GetTCVal(m_fSpriteBrightness, val) / 10.0f, + GetTCVal(m_nShadowStrength, val), GetTCVal(m_nLightShadowStrength, val), GetTCVal(m_nPoleShadowStrength, val), + GetTCVal(m_fFarClip, val), GetTCVal(m_fFogStart, val), GetTCVal(m_fLightsOnGroundBrightness, val)/ 10.0f, + GetTCVal(m_nLowCloudsRed, val), GetTCVal(m_nLowCloudsGreen, val), GetTCVal(m_nLowCloudsBlue, val), + GetTCVal(m_nTopCloudsRed, val), GetTCVal(m_nTopCloudsGreen, val), GetTCVal(m_nTopCloudsBlue, val), + GetTCVal(m_nBottomCloudsRed, val), GetTCVal(m_nBottomCloudsGreen, val), GetTCVal(m_nBottomCloudsBlue, val), + GetTCVal(m_nBlurRed, val), GetTCVal(m_nBlurGreen, val), GetTCVal(m_nBlurBlue, val), + GetTCVal(m_fWaterRed, val), GetTCVal(m_fWaterGreen, val), GetTCVal(m_fWaterBlue, val), GetTCVal(m_fWaterAlpha, val) + ); + file << buffer << std::endl; } } #endif