Fix enemy scan text on aspect ratios different then 16:9

This commit is contained in:
rebtd7 2020-01-24 23:08:40 -03:00 committed by GitHub
parent e69a91d83e
commit 98ed61b776
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 10 deletions

View file

@ -116,6 +116,8 @@ void MainContext::FF13_InitializeGameAddresses()
ff13_base_controller_input_address_ptr = (byte**)(baseAddr + 0x02411220);
ff13_vibration_low_set_zero_address = baseAddr + 0x4210DF;
ff13_vibration_high_set_zero_address = baseAddr + 0x4210F3;
ff13_internal_res_w = (uint32_t*)(baseAddr + 0x22E5168);
ff13_internal_res_h = ff13_internal_res_w + 1;
}
void MainContext::FF13_OneTimeFixes() {
@ -167,12 +169,12 @@ void MainContext::FF13_FixMissingEnemyScan() {
// The game incorrectly uses the same values here regardless of the resolution.
PrintLog("Patching libra info box instructions to take in account the game resolution...");
const float originalHeight = 720.0F;
const float resolutionFactorH = (float)*ff13_internal_res_h / originalHeight;
const float resolutionFactor = (float)context.backbufferWidth / 1280.0F;
const uint32_t rectHeight = (uint32_t)ceil(130.0F * resolutionFactor);
const uint32_t rectWidth = context.backbufferWidth;
const uint32_t rectPosY = (uint32_t)(496.0F * resolutionFactor);
const uint32_t rectHeight = (uint32_t)ceil(130.0F * resolutionFactorH);
const uint32_t rectWidth = *ff13_internal_res_w;
const uint32_t rectPosY = (uint32_t)(496.0F * resolutionFactorH);
context.ChangeMemoryProtectionToReadWriteExecute(ff13_enemy_scan_box_code_address, 18);
@ -375,7 +377,7 @@ void MainContext::ChangeMemoryProtectionToReadWriteExecute(void* address, const
}
void MainContext::PrintVersionInfo() {
PrintLog("FF13Fix 1.4.0 https://github.com/rebtd7/FF13Fix");
PrintLog("FF13Fix 1.4.1 https://github.com/rebtd7/FF13Fix");
}
bool MainContext::AreAlmostTheSame(float a, float b) {

View file

@ -113,7 +113,6 @@ bool MainContext::ApplyPresentationParameters(D3DPRESENT_PARAMETERS* pPresentati
{
if (pPresentationParameters)
{
context.backbufferWidth = pPresentationParameters->BackBufferWidth;
if (config.GetTripleBuffering())
{
pPresentationParameters->BackBufferCount = 3;

View file

@ -85,6 +85,8 @@ private:
byte** ff13_base_controller_input_address_ptr = NULL;
byte* ff13_vibration_high_set_zero_address = NULL;
byte* ff13_vibration_low_set_zero_address = NULL;
uint32_t* ff13_internal_res_w;
uint32_t* ff13_internal_res_h;
byte* FF13_2_SET_FRAME_RATE_INJECTED_CODE = NULL;
byte* ff13_2_continuous_scan_instruction_address;
@ -99,8 +101,6 @@ private:
const float FF13_2_MAX_FRAME_CAP = 1000.0F;
XInputManager* xinputManager;
UINT backbufferWidth = 0;
void FixBehaviorFlagConflict(const DWORD flags_in, DWORD* flags_out);
static const std::map<const AutoFixes, const uint32_t> behaviorflags_fixes;

View file

@ -48,7 +48,7 @@ void XInputManager::VibrationLoop()
const float vibrationStrengthLowFrequency = *vibration_address_low_frequency;
const float vibrationStrengthHighFrequency = *vibration_address_high_frequency;
if (vibrationStrengthLowFrequency || vibrationStrengthHighFrequency) {
SetControllerVibration(vibrationStrengthLowFrequency * maxVibrationStrength, vibrationStrengthHighFrequency * maxVibrationStrength);
SetControllerVibration((WORD)(vibrationStrengthLowFrequency * maxVibrationStrength), (WORD)(vibrationStrengthHighFrequency * maxVibrationStrength));
wasVibrating = true;
}
else if(wasVibrating) {