diff --git a/AVPPH_CustomLauncher.sdf b/AVPPH_CustomLauncher.sdf index a54dc1a..9c1fa8e 100644 Binary files a/AVPPH_CustomLauncher.sdf and b/AVPPH_CustomLauncher.sdf differ diff --git a/GameHack.cs b/GameHack.cs index f447cba..4363f6f 100644 --- a/GameHack.cs +++ b/GameHack.cs @@ -39,7 +39,8 @@ class GameHack int[] offsetFovY = new int[] { 0x4, 0xC8 }; int bgScalingAddress = 0x001F70C4; - int[] bgScalingOffsets = new int[] { 0x2BC, 0x1c4 }; + int[] bgScalingOffsetsX = new int[] { 0x2BC, 0x1c0 }; + int[] bgScalingOffsetsY = new int[] { 0x2BC, 0x1c4 }; public void DoWork() { @@ -86,7 +87,7 @@ public void DoWork() { ReadFovX = Trainer.ReadPointerFloat(myProcess, cshellBaseAdress + fovAddress, offsetFovX); ReadFovY = Trainer.ReadPointerFloat(myProcess, cshellBaseAdress + fovAddress, offsetFovY); - readBgValue = Trainer.ReadPointerFloat(myProcess, cshellBaseAdress + bgScalingAddress, bgScalingOffsets); + readBgValue = Trainer.ReadPointerFloat(myProcess, cshellBaseAdress + bgScalingAddress, bgScalingOffsetsY); @@ -96,7 +97,10 @@ public void DoWork() Trainer.WritePointerFloat(myProcess, cshellBaseAdress + fovAddress, offsetFovY, fovY); if (readBgValue != bgCorrectedValue && readBgValue != 0x0000000) - Trainer.WritePointerFloat(myProcess, cshellBaseAdress + bgScalingAddress, bgScalingOffsets, bgCorrectedValue); + { + Trainer.WritePointerFloat(myProcess, cshellBaseAdress + bgScalingAddress, bgScalingOffsetsX, 1.570796f); + Trainer.WritePointerFloat(myProcess, cshellBaseAdress + bgScalingAddress, bgScalingOffsetsY, bgCorrectedValue); + } if (!dllInjected && LithTechBaseAdress != 0x0 && cshellBaseAdress != 0x0 && d3dren != 0x0) { diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 7a716e4..d166840 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.6.3.0")] -[assembly: AssemblyFileVersion("0.6.3.0")] +[assembly: AssemblyVersion("0.6.4.0")] +[assembly: AssemblyFileVersion("0.6.4.0")] diff --git a/README.md b/README.md index ac438b7..0657c18 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,14 @@ Features * Built in aspect ratio hack for easy access to widescreen resolutions. * Built in FOV changer, tied directly to aspect ratio hack (calculated as the most common Horizontal+ FOV). +Requirements +------- + * Aliens vs. Predator 2: Primal Hunt + * Windows Vista / 7 / 8 / 10 + * [Microsoft .NET Framework 4.5](https://www.microsoft.com/en-US/download/details.aspx?id=30653) + * [Visual C++ Redistributable for Visual Studio 2015](https://www.microsoft.com/en-US/download/details.aspx?id=48145) 32-bit + * Administrator rights on the system (due to writting to memory of other program / injecting DLL libraries etc.) + Installation ------- Patch the game if you haven't already. Download the program from [releases page](https://github.com/SuiMachine/AVP2PH-Custom-Launcher/releases). Copy it to AVP2 directory. To get rid of annoying question from Windows about download files, right click on **AVP_CustomLauncher.exe**, and choose Properties. In the General tab, click Unlock. @@ -18,6 +26,10 @@ Patch the game if you haven't already. Download the program from [releases page] **Note 2**: For running the game on resolutions wider than 2048px you'll need "special" D3DIM700.DLL by jackfuste. It can be found [here](http://www.wsgf.org/forums/viewtopic.php?p=155982#p155982). +**Note 3**: While it may be surprising some some people, I have not tested the launcher with multiplayer. With the master servers being dead for a long time and projects to restore them having suspecious files (says the one, who literally injects DLLs into memory), for me, it's dead. + Credits ------- -* [SuicideMachine](http://www.twitch.tv/suicidemachine/) \ No newline at end of file +* [SuicideMachine](http://www.twitch.tv/suicidemachine/) +* evolution536 - who wrote the DLL injector class +* Cless - who wrote the trainer class \ No newline at end of file diff --git a/Release/AVP2PH_CustomLauncher.exe b/Release/AVP2PH_CustomLauncher.exe index b1b3182..2a95f79 100644 Binary files a/Release/AVP2PH_CustomLauncher.exe and b/Release/AVP2PH_CustomLauncher.exe differ diff --git a/Release/widescreenfix.dll b/Release/widescreenfix.dll index 0ba3ec0..562fb92 100644 Binary files a/Release/widescreenfix.dll and b/Release/widescreenfix.dll differ diff --git a/SettingsForms/GameSettingsForm.cs b/SettingsForms/GameSettingsForm.cs index 7f11cda..3d1fc45 100644 --- a/SettingsForms/GameSettingsForm.cs +++ b/SettingsForms/GameSettingsForm.cs @@ -29,6 +29,9 @@ public partial class GameSettings : Form public bool disablejoystick = true; public bool disablehardwarecursor = false; + public bool notificationWindowed = true; + public bool notificationToBig = true; + public bool aspectratiohack = false; public float fov = 90.0f; string text = ""; @@ -54,10 +57,173 @@ public GameSettings(mainform parent) readfile(); } + #region eventHandlers private void GraphicsSettings_Load(object sender, EventArgs e) { } - + + private void T_ResolutionX_TextChanged(object sender, EventArgs e) + { + var res = 1280; + if (int.TryParse(T_ResolutionX.Text, out res)) + { + ResolutionX = res; + + if (ResolutionX > 2048 && notificationToBig == false) + { + notificationToBig = true; + if (!File.Exists("D3DIM700.DLL")) + { + DialogResult result = MessageBox.Show("For resolutions wider than 2048 you'll need jackfuste's D3DIM700.dll wrapper. Running the game without it, will either crash the game or cause it to start in 640x480. Do you wish to download it?", "Notification", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (result == DialogResult.Yes) + { + System.Diagnostics.Process.Start("http://www.wsgf.org/forums/viewtopic.php?p=155982#p155982"); + } + } + } + } + } + + private void T_ResolutionY_TextChanged(object sender, EventArgs e) + { + var res = 720; + if (int.TryParse(T_ResolutionY.Text, out res)) + { + ResolutionY = res; + + if (ResolutionY > 2048 && notificationToBig == false) + { + notificationToBig = true; + if (!File.Exists("D3DIM700.DLL")) + { + DialogResult result = MessageBox.Show("For resolutions wider than 2048 you'll need jackfuste's D3DIM700.dll wrapper. Running the game without it, will either crash the game or cause it to start in 640x480. Do you wish to download it?", "Notification", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (result == DialogResult.Yes) + { + System.Diagnostics.Process.Start("http://www.wsgf.org/forums/viewtopic.php?p=155982#p155982"); + } + } + } + } + } + + private void C_Windowed_CheckedChanged(object sender, EventArgs e) + { + if (C_Windowed.Checked) + { + windowed = true; + if (!notificationWindowed) + { + notificationWindowed = true; + MessageBox.Show("Warning: The game uses V-sync to limit its framerate and has some unintended behaviours when the framerate is uncapped.\n\nSince V-sync doesn't work in windowed mode, make sure to use either GPU control panel setting or external application (like Dxtory) to limit your framerate.", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + else + windowed = false; + } + + private void C_EnableAspectRatioMemoryWrite_CheckedChanged(object sender, EventArgs e) + { + if (C_EnableAspectRatioMemoryWrite.Checked) + { + aspectratiohack = true; + TB_FOV.Enabled = true; + } + else + { + aspectratiohack = false; + TB_FOV.Enabled = false; + } + + } + + private void C_32color_CheckedChanged(object sender, EventArgs e) + { + if (C_32color.Checked) + GameBitDepth = true; + else + GameBitDepth = false; + } + + private void TB_FOV_TextChanged(object sender, EventArgs e) + { + var res = 90.0f; + if (float.TryParse(TB_FOV.Text, out res)) + { + fov = res; + } + } + + private void B_ManualEdit_TextChanged(object sender, EventArgs e) + { + text = B_ManualEdit.Text; + } + + private void B_SaveAndClose_Click(object sender, EventArgs e) + { + savecustomconfig(); + savefile(); + Close(); + } + + private void B_Cancel_Click(object sender, EventArgs e) + { + Close(); + } + + private void C_DisableSound_CheckedChanged(object sender, EventArgs e) + { + if (C_DisableSound.Checked) + disablesound = true; + else + disablesound = false; + } + + private void C_DisableMusic_CheckedChanged(object sender, EventArgs e) + { + if (C_DisableMusic.Checked) + disablemusic = true; + else + disablemusic = false; + } + + private void C_DisableLogos_CheckedChanged(object sender, EventArgs e) + { + if (C_DisableLogos.Checked) + disablelogos = true; + else + disablelogos = false; + } + + private void C_DisableTripleBuffering_CheckedChanged(object sender, EventArgs e) + { + if (C_DisableTripleBuffering.Checked) + disabletripplebuffering = true; + else + disabletripplebuffering = false; + } + + private void C_DisableJoystick_CheckedChanged(object sender, EventArgs e) + { + if (C_DisableJoystick.Checked) + disablejoystick = true; + else + disablejoystick = false; + } + + private void C_DisableHardwareCursor_CheckedChanged(object sender, EventArgs e) + { + if (C_DisableHardwareCursor.Checked) + disablehardwarecursor = true; + else + disablehardwarecursor = false; + } + + private void T_CommandLine_TextChanged(object sender, EventArgs e) + { + } + #endregion + + #region readFunctions public void readcustomconfig() { StreamReader SR = new StreamReader(customConfig); @@ -245,75 +411,17 @@ public void readfile() B_ManualEdit.Text = text; SR.Close(); SR.Dispose(); + notificationToBig = false; + notificationWindowed = false; } + #endregion - private void T_ResolutionX_TextChanged(object sender, EventArgs e) - { - var res = 1280; - if(int.TryParse(T_ResolutionX.Text, out res)) - { - ResolutionX = res; - } - } - - private void T_ResolutionY_TextChanged(object sender, EventArgs e) - { - var res = 720; - if (int.TryParse(T_ResolutionY.Text, out res)) - { - ResolutionY = res; - } - } - - private void C_Windowed_CheckedChanged(object sender, EventArgs e) - { - if (C_Windowed.Checked) - { - windowed = true; - //MessageBox.Show("Warning: The game uses V-sync to limit its framerate and has some unintended behaviours when the framerate is uncapped.\n\nSince V-sync doesn't work in windowed mode, make sure to use either GPU control panel setting or external application (like Dxtory) to limit your framerate.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); - } - - else - windowed = false; - } - - private void C_EnableAspectRatioMemoryWrite_CheckedChanged(object sender, EventArgs e) - { - if (C_EnableAspectRatioMemoryWrite.Checked) - { - aspectratiohack = true; - TB_FOV.Enabled = true; - } - else - { - aspectratiohack = false; - TB_FOV.Enabled = false; - } - - } - - private void C_32color_CheckedChanged(object sender, EventArgs e) - { - if (C_32color.Checked) - GameBitDepth = true; - else - GameBitDepth = false; - } - - private void TB_FOV_TextChanged(object sender, EventArgs e) - { - var res = 90.0f; - if(float.TryParse(TB_FOV.Text, out res)) - { - fov = res; - } - } - + #region saveFunctions private void savecustomconfig() { string output = ""; output += "Windowed:" + windowed.ToString() + "\n"; - output += "DisableSound:" + disablesound.ToString() + "\n"; + output += "DisableSound:" + disablesound.ToString() + "\n"; output += "DisableMusic:" + disablemusic.ToString() + "\n"; output += "DisableLogos:" + disablelogos.ToString() + "\n"; output += "DisableTrippleBuffering:" + disabletripplebuffering.ToString() + "\n"; @@ -333,12 +441,12 @@ private void savefile() output += "\"SCREENHEIGHT\" \"" + ResolutionY.ToString() + "\"\n"; output += "\"GameScreenHeight\" \"" + ResolutionY.ToString() + "\"\n"; - if(GameBitDepth) + if (GameBitDepth) output += "\"GameBitDepth\" \"32\"\n"; else output += "\"GameBitDepth\" \"16\"\n"; - if(FixTJunc) + if (FixTJunc) output += "\"FixTJunc\" \"1\"\n"; else output += "\"FixTJunc\" \"0\"\n"; @@ -346,74 +454,6 @@ private void savefile() output += text; File.WriteAllText(autoexecfile, output); } - - private void B_ManualEdit_TextChanged(object sender, EventArgs e) - { - text = B_ManualEdit.Text; - } - - private void B_SaveAndClose_Click(object sender, EventArgs e) - { - savecustomconfig(); - savefile(); - Close(); - } - - private void B_Cancel_Click(object sender, EventArgs e) - { - Close(); - } - - private void C_DisableSound_CheckedChanged(object sender, EventArgs e) - { - if (C_DisableSound.Checked) - disablesound = true; - else - disablesound = false; - } - - private void C_DisableMusic_CheckedChanged(object sender, EventArgs e) - { - if (C_DisableMusic.Checked) - disablemusic = true; - else - disablemusic = false; - } - - private void C_DisableLogos_CheckedChanged(object sender, EventArgs e) - { - if (C_DisableLogos.Checked) - disablelogos = true; - else - disablelogos = false; - } - - private void C_DisableTripleBuffering_CheckedChanged(object sender, EventArgs e) - { - if (C_DisableTripleBuffering.Checked) - disabletripplebuffering = true; - else - disabletripplebuffering = false; - } - - private void C_DisableJoystick_CheckedChanged(object sender, EventArgs e) - { - if (C_DisableJoystick.Checked) - disablejoystick = true; - else - disablejoystick = false; - } - - private void C_DisableHardwareCursor_CheckedChanged(object sender, EventArgs e) - { - if (C_DisableHardwareCursor.Checked) - disablehardwarecursor = true; - else - disablehardwarecursor = false; - } - - private void T_CommandLine_TextChanged(object sender, EventArgs e) - { - } + #endregion } }