Gamma control

This commit is contained in:
nastys
2021-09-01 02:35:30 +02:00
parent f8f98f888f
commit eb7f5a9dd9
5 changed files with 20 additions and 1 deletions
@@ -686,7 +686,7 @@ class PatchApplier710 : public PatchApplier {
{
InjectCode((void*)(0x14011e44e), { 0xf3, 0x0f, 0x10, 0x05, 0x8a, 0xcf, 0x9c, 0x00 }); // hijack xmm0
InjectCode((void*)(0x14011e46b), { 0xf3, 0x0f, 0x11, 0x44, 0x24, 0x20 }); // get value from xmm0 instead of xmm1
float startPos = (float)nLagCompensation / 1000.0;
float startPos = (float)nLagCompensation / 1000.0f;
InjectCode((void*)(0x140aeB3e0), { *((uint8_t*)(&startPos)), *((uint8_t*)(&startPos)+1), *((uint8_t*)(&startPos) + 2), *((uint8_t*)(&startPos) + 3) });
printf("[Patches] Lag Compensation: %f\n", startPos);
@@ -765,6 +765,15 @@ class PatchApplier710 : public PatchApplier {
InjectCode((void*)(0x140300a88), { 0x90, 0x90, 0x90 }); // NOPs
}
// gamma
if (nGamma != 100)
{
float gamma_float = (float)nGamma / 100.0f;
InjectCode((void*)(0x1404a863b), { *((uint8_t*)(&gamma_float)), *((uint8_t*)(&gamma_float) + 1), *((uint8_t*)(&gamma_float) + 2), *((uint8_t*)(&gamma_float) + 3) });
printf("[Patches] Gamma: %f\n", gamma_float);
}
// modpack redirection
/*{
wchar_t* mpstr = NULL;
@@ -107,6 +107,7 @@ auto nForceExpressions = GetPrivateProfileIntW(L"patches", L"force_expressions",
auto nForceLook = GetPrivateProfileIntW(L"patches", L"force_look", 0, CONFIG_FILE);
auto nNpr1 = GetPrivateProfileIntW(L"graphics", L"npr1", 0, CONFIG_FILE);
auto nReflections = GetPrivateProfileIntW(L"graphics", L"reflections", TRUE, CONFIG_FILE);
auto nGamma = GetPrivateProfileIntW(L"graphics", L"gamma", 100, CONFIG_FILE);
auto nShadows = GetPrivateProfileIntW(L"graphics", L"shadows", TRUE, CONFIG_FILE);
auto nPunchthrough = GetPrivateProfileIntW(L"graphics", L"punchthrough", TRUE, CONFIG_FILE);
auto nGlare = GetPrivateProfileIntW(L"graphics", L"glare", TRUE, CONFIG_FILE);
+6
View File
@@ -122,6 +122,12 @@ char config_template[] =
"DOF=1\n"
"# Reflections\n"
"Reflections=1\n"
"Reflect_Res_Width = 512\n"
"Reflect_Res_Height = 256\n"
"Refract_Res_Width = 512\n"
"Refract_Res_Height = 256\n"
"# Gamma -- 100=default, 125=console-like\n"
"Gamma = 100\n"
"# Shadows\n"
"Shadows=1\n"
"# Transparent Meshes\n"
@@ -32,6 +32,8 @@ REFLECT_RES_WIDTH_NAME=Reflection Res:
REFLECT_RES_WIDTH_HINT=Sets the reflection buffer resolution (instead of 512x256).
REFRACT_RES_WIDTH_NAME=Refraction Res:
REFRACT_RES_WIDTH_HINT=Sets the refraction buffer resolution (instead of 512x256).
GAMMA_NAME=Gamma:
GAMMA_HINT=Increase to darken shadows.\nSet to 125 for a console-like experience.\n\nDefault: 100
SHADOWS_NAME=Shadows
SHADOWS_HINT=Enable or disable shadows.
PUNCHTHROUGH_NAME=Transparent Meshes
@@ -189,6 +189,7 @@ ConfigOptionBase* graphicsArray[] = {
new BooleanOption(L"reflections", GRAPHICS_SECTION, CONFIG_FILE, L"REFLECTIONS_NAME", L"REFLECTIONS_HINT", true, false),
new ResolutionOption(L"reflect_res_width", L"reflect_res_height", GRAPHICS_SECTION, CONFIG_FILE, L"REFLECT_RES_WIDTH_NAME", L"REFLECT_RES_WIDTH_HINT", resolution(512, 256), std::vector<resolution>({resolution(256,256), resolution(512,256), resolution(512,512), resolution(1024,1024), resolution(2048,2048), resolution(4096,4096)}), true, (ResolutionOptionOpts)0),
new ResolutionOption(L"refract_res_width", L"refract_res_height", GRAPHICS_SECTION, CONFIG_FILE, L"REFRACT_RES_WIDTH_NAME", L"REFRACT_RES_WIDTH_HINT", resolution(512, 256), std::vector<resolution>({resolution(256,256), resolution(512,256), resolution(512,512), resolution(1024,1024), resolution(2048,2048), resolution(4096,4096)}), true, (ResolutionOptionOpts)0),
new NumericOption(L"gamma", GRAPHICS_SECTION, CONFIG_FILE, L"GAMMA_NAME", L"GAMMA_HINT", 100, 0, 200),
new BooleanOption(L"shadows", GRAPHICS_SECTION, CONFIG_FILE, L"SHADOWS_NAME", L"SHADOWS_HINT", true, false),
new BooleanOption(L"punchthrough", GRAPHICS_SECTION, CONFIG_FILE, L"PUNCHTHROUGH_NAME", L"PUNCHTHROUGH_HINT", true, false),
new BooleanOption(L"glare", GRAPHICS_SECTION, CONFIG_FILE, L"GLARE_NAME", L"GLARE_HINT", true, false),