Skip to content

Commit

Permalink
Add option to force 4K movies.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyall committed Jun 19, 2024
1 parent c088a3d commit 50618b2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
4 changes: 4 additions & 0 deletions SMTVFix.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ Distance = 580
FOV = 60
Height = 73

[Force 4K Movies]
; Set to true to force 4K movies to play instead of 720p.
Enabled = true

;;;;;;;;;; Ultrawide/Narrower Fixes ;;;;;;;;;;

[Fix Aspect Ratio]
Expand Down
25 changes: 23 additions & 2 deletions src/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ HMODULE thisModule;
inipp::Ini<char> ini;
std::shared_ptr<spdlog::logger> logger;
std::string sFixName = "SMTVFix";
std::string sFixVer = "0.8.7";
std::string sFixVer = "0.8.8";
std::string sLogFile = "SMTVFix.log";
std::string sConfigFile = "SMTVFix.ini";
std::string sExeName;
Expand All @@ -51,6 +51,7 @@ bool bAdjustCam;
float fAdjustDist;
float fAdjustFOV;
float fAdjustHeight;
bool bForceMovieRes;
bool bShadowQuality;
int iShadowResolution;
bool bEnableGTAO;
Expand Down Expand Up @@ -175,6 +176,7 @@ void ReadConfig()
inipp::get_value(ini.sections["Adjust Player Camera"], "Distance", fAdjustDist);
inipp::get_value(ini.sections["Adjust Player Camera"], "FOV", fAdjustFOV);
inipp::get_value(ini.sections["Adjust Player Camera"], "Height", fAdjustHeight);
inipp::get_value(ini.sections["Force 4K Movies"], "Enabled", bForceMovieRes);
inipp::get_value(ini.sections["Screen Percentage"], "Enabled", bScreenPercentage);
inipp::get_value(ini.sections["Screen Percentage"], "Value", fScreenPercentage);
inipp::get_value(ini.sections["Enable TAA"], "Enabled", bEnableTAA);
Expand Down Expand Up @@ -216,6 +218,7 @@ void ReadConfig()
fAdjustHeight = std::clamp(fAdjustHeight, (float)1, (float)10000);
spdlog::warn("Config Parse: fAdjustHeight value invalid, clamped to {}", fAdjustHeight);
}
spdlog::info("Config Parse: bForceMovieRes: {}", bForceMovieRes);
spdlog::info("Config Parse: bScreenPercentage: {}", bScreenPercentage);
spdlog::info("Config Parse: fScreenPercentage: {}", fScreenPercentage);
if (fScreenPercentage < (float)10 || fScreenPercentage >(float)400)
Expand Down Expand Up @@ -865,7 +868,7 @@ void Misc()
if (bDisableMenuFPSCap)
{
// Disable FrameRateManager changing t.MaxFPS to 60
uint8_t* FramerateChangeScanResult = Memory::PatternScan(baseModule, "44 ?? ?? ?? 0F ?? ?? ?? ?? 41 ?? ?? ?? 74 ?? 41 ?? ?? ?? 74 ?? 41 ?? ?? ?? 74 ?? ");
uint8_t* FramerateChangeScanResult = Memory::PatternScan(baseModule, "44 ?? ?? ?? 0F ?? ?? ?? ?? 41 ?? ?? ?? 74 ?? 41 ?? ?? ?? 74 ?? 41 ?? ?? ?? 74 ??");
if (FramerateChangeScanResult)
{
spdlog::info("Menu Framerate Cap: Address is {:s}+{:x}", sExeName.c_str(), (uintptr_t)FramerateChangeScanResult - (uintptr_t)baseModule);
Expand All @@ -882,6 +885,24 @@ void Misc()
spdlog::error("Menu Framerate Cap: Pattern scan failed.");
}
}

if (bForceMovieRes)
{
// Always play 4K movies
// EventFunctionLibrary::IsOriginalMovieResolution()
uint8_t* MovieResolutionScanResult = Memory::PatternScan(baseModule, "81 ?? ?? D0 07 00 00 0F ?? ?? 48 83 ?? ?? C3");
if (MovieResolutionScanResult)
{
spdlog::info("Movie Resolution: Address is {:s}+{:x}", sExeName.c_str(), (uintptr_t)MovieResolutionScanResult - (uintptr_t)baseModule);
Memory::Write((uintptr_t)MovieResolutionScanResult + 0x3, (int)0);
spdlog::info("Movie Resolution: Patched instruction.");
}
else if (!MovieResolutionScanResult)
{
spdlog::error("Movie Resolution: Pattern scan failed.");
}
}

}

void IntroSkip()
Expand Down

0 comments on commit 50618b2

Please sign in to comment.