├── src ├── stdafx.cpp ├── stdafx.h ├── proxy.def ├── helper.hpp ├── proxy.cpp └── dllmain.cpp ├── .github ├── FUNDING.yml └── workflows │ └── main.yml ├── .gitmodules ├── release_body.md ├── RERevFix.ini ├── LICENSE ├── RERevFix.sln ├── RERevFix.vcxproj.filters ├── README.md ├── .gitattributes ├── .gitignore └── RERevFix.vcxproj /src/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | 2 | ko_fi: lyall 3 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "src/external/inih"] 2 | path = src/external/inih 3 | url = https://github.com/jtilly/inih 4 | -------------------------------------------------------------------------------- /src/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | -------------------------------------------------------------------------------- /release_body.md: -------------------------------------------------------------------------------- 1 | ## Installation 2 | - Downloaded the [latest release](https://github.com/Lyall/RERevFix/releases) of RERevFix. 3 | - Unzip in to the game directory (e.g **steamapps/common/RESIDENT EVIL REVELATIONS**). 4 | - Edit **RERevFix.ini** to enable/adjust features. 5 | -------------------------------------------------------------------------------- /src/proxy.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | DllMain_stub @1 3 | XInputGetState @2 4 | XInputSetState @3 5 | XInputGetCapabilities @4 6 | XInputEnable @5 7 | XInputGetDSoundAudioDeviceGuids @6 8 | XInputGetBatteryInformation @7 9 | XInputGetKeystroke @8 10 | DirectInput8Create @9 11 | DXGIDumpJournal @10 12 | CreateDXGIFactory @11 13 | CreateDXGIFactory1 @12 14 | CreateDXGIFactory2 @13 15 | DXGID3D10CreateDevice @14 16 | DXGID3D10CreateLayeredDevice @15 17 | DXGID3D10GetLayeredDeviceSize @17 18 | DXGID3D10RegisterLayers @18 19 | DXGIGetDebugInterface1 @19 20 | DXGIReportAdapterConfiguration @20 21 | X3DAudioInitialize @21 22 | X3DAudioCalculate @22 23 | CreateFX @23 -------------------------------------------------------------------------------- /RERevFix.ini: -------------------------------------------------------------------------------- 1 | -- General -- 2 | 3 | [Increase FOV] 4 | ; Set a desired FOV increase. 5 | ; Default FOV is 36, so a value of 24 would get you 60° vertical FOV. 6 | Enabled = true 7 | Value = 24 8 | 9 | [FPS Cap] 10 | ; Set to desired FPS cap. Going beyond the 120 FPS cap of the game may incur issues. 11 | Enabled = true 12 | Value = 120 13 | 14 | [Shadow Quality] 15 | ; Set shadowmap resolution. 4096 is recommended. 16 | ; In-game defaults are: Low=256, Med=512, High=1024 17 | Enabled = true 18 | Value = 4096 19 | 20 | -- Ultrawide Fixes -- 21 | 22 | [Custom Resolution] 23 | ; Enter your chosen resolution. 24 | ; This is used for calculations related to ultrawide fixes. 25 | ; You can leave these at 0 if you want your desktop resolution used as a reference instead. 26 | Width = 0 27 | Height = 0 28 | 29 | [Fix Resolution] 30 | ; Overwrites 640x480 with your resolution. 31 | Enabled = true 32 | 33 | [Fix UI] 34 | ; Fixes incorrect UI at ultrawide/wider. 35 | Enabled = true 36 | 37 | [Fix Movies] 38 | ; Fixes stretched pre-rendered video playback. 39 | Enabled = true 40 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Lyall 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: create-release 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | version: 7 | description: 'Release version number' 8 | required: true 9 | 10 | jobs: 11 | build: 12 | runs-on: windows-latest 13 | permissions: 14 | contents: write 15 | steps: 16 | - uses: actions/checkout@v2 17 | with: 18 | submodules: 'true' 19 | 20 | - name: setup-msbuild 21 | uses: microsoft/setup-msbuild@v1.1 22 | 23 | - run: msbuild ${{ github.event.repository.name }}.sln -t:rebuild -verbosity:diag -property:Configuration=Release -property:Platform=x86 24 | - run: cp Release\xinput1_3.dll xinput1_3.dll 25 | - run: 7z a -tzip ${{ github.event.repository.name }}_${{ github.event.inputs.version }}.zip README.md ${{ github.event.repository.name }}.ini xinput1_3.dll 26 | 27 | - uses: ncipollo/release-action@v1 28 | with: 29 | artifacts: "${{ github.event.repository.name }}_${{ github.event.inputs.version }}.zip" 30 | token: ${{ secrets.GITHUB_TOKEN }} 31 | tag: ${{ github.event.inputs.version }} 32 | name: "${{ github.event.inputs.version }}" 33 | draft: true 34 | generateReleaseNotes: true 35 | bodyFile: "release_body.md" 36 | artifactErrorsFailBuild: true 37 | -------------------------------------------------------------------------------- /RERevFix.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.1.32414.318 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RERevFix", "RERevFix.vcxproj", "{547863D5-FA99-4542-ADC1-179593DE313D}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {547863D5-FA99-4542-ADC1-179593DE313D}.Debug|x64.ActiveCfg = Debug|x64 17 | {547863D5-FA99-4542-ADC1-179593DE313D}.Debug|x64.Build.0 = Debug|x64 18 | {547863D5-FA99-4542-ADC1-179593DE313D}.Debug|x86.ActiveCfg = Debug|Win32 19 | {547863D5-FA99-4542-ADC1-179593DE313D}.Debug|x86.Build.0 = Debug|Win32 20 | {547863D5-FA99-4542-ADC1-179593DE313D}.Release|x64.ActiveCfg = Release|x64 21 | {547863D5-FA99-4542-ADC1-179593DE313D}.Release|x64.Build.0 = Release|x64 22 | {547863D5-FA99-4542-ADC1-179593DE313D}.Release|x86.ActiveCfg = Release|Win32 23 | {547863D5-FA99-4542-ADC1-179593DE313D}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {0B0A1E7F-7011-4EEA-BA3B-DD15DD632ACF} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /RERevFix.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | 26 | 27 | Source Files 28 | 29 | 30 | Source Files 31 | 32 | 33 | Source Files 34 | 35 | 36 | 37 | 38 | Source Files 39 | 40 | 41 | Source Files 42 | 43 | 44 | Source Files 45 | 46 | 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RERevFix 2 | [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/W7W01UAI9)
3 | [![Github All Releases](https://img.shields.io/github/downloads/Lyall/RERevFix/total.svg)](https://github.com/Lyall/RERevFix/releases) 4 | 5 | This is a DLL hook that fixes various issues with Resident Evil Revelations relating to ultrawide support and more.
6 | 7 | ## Features 8 | - Support for ultrawide/custom resolutions. 9 | - FOV adjustment. 10 | - Uncap 120 FPS limit. 11 | - Adjust shadow quality. 12 | 13 | ## Warning 14 | - ### This game uses Valve Anti Cheat for raid mode in multiplayer.
I highly recommend that you **DO NOT** play this mode with this fix installed. 15 | 16 | ## Installation 17 | - Downloaded the [latest release](https://github.com/Lyall/RERevFix/releases) of RERevFix. 18 | - Unzip in to the game directory (e.g **steamapps/common/RESIDENT EVIL REVELATIONS**). 19 | - Edit **RERevFix.ini** to enable/adjust features. 20 | 21 | ## Troubleshooting 22 | 1. **It crashes after the "Loading content" screen.**
23 | Open up "**%localappdata%\CAPCOM\RESIDENT EVIL REVELATIONS\config.ini**" in a text editor. Find the line "**Resolution**" and make sure it is set to your chosen resolution. 24 | 25 | ## Known Issues 26 | - The first time you start the game the fix may not work properly. This is because it needs to write to your game config and a restart is required for the first boot. If you encounter this, simply restart the game. 27 | - Movie playback is anchored to the left side of the screen. 28 | - Map marker for the player is misaligned with the map. 29 | 30 | ## Screenshots 31 | 32 | | ![20220508014924_1](https://user-images.githubusercontent.com/695941/167277058-44142418-56ba-4958-ac11-9c5ed6b5e78a.jpg) | 33 | |:--:| 34 | | 21:9 with adjusted FOV and high quality shadows. | 35 | 36 | ## Credits 37 | [RERevHook](https://www.nexusmods.com/residentevilrevelations/mods/26) for the DLL proxy code.
38 | [inih](https://github.com/jtilly/inih) for ini reading. 39 | 40 | 41 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /src/helper.hpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include 3 | #include 4 | #include 5 | 6 | namespace Memory 7 | { 8 | template 9 | void Write(DWORD writeAddress, T value) 10 | { 11 | DWORD oldProtect; 12 | VirtualProtect((LPVOID)(writeAddress), sizeof(T), PAGE_EXECUTE_WRITECOPY, &oldProtect); 13 | *(reinterpret_cast(writeAddress)) = value; 14 | VirtualProtect((LPVOID)(writeAddress), sizeof(T), oldProtect, &oldProtect); 15 | } 16 | 17 | void PatchBytes(intptr_t address, const char* pattern, unsigned int numBytes) 18 | { 19 | DWORD oldProtect; 20 | VirtualProtect((LPVOID)address, numBytes, PAGE_EXECUTE_READWRITE, &oldProtect); 21 | memcpy((LPVOID)address, pattern, numBytes); 22 | VirtualProtect((LPVOID)address, numBytes, oldProtect, &oldProtect); 23 | } 24 | 25 | uintptr_t ReadMultiLevelPointer(uintptr_t base, const std::vector& offsets) 26 | { 27 | MEMORY_BASIC_INFORMATION mbi; 28 | for (auto& offset : offsets) 29 | { 30 | if (!VirtualQuery(reinterpret_cast(base), &mbi, sizeof(MEMORY_BASIC_INFORMATION)) || mbi.Protect & (PAGE_NOACCESS | PAGE_GUARD)) 31 | return 0; 32 | 33 | base = *reinterpret_cast(base) + offset; 34 | } 35 | 36 | return base; 37 | } 38 | 39 | bool Hook(void* hookAddress, void* hookFunction, int hookLength) { 40 | if (hookLength < 5) { 41 | return false; 42 | } 43 | 44 | DWORD oldProtect; 45 | VirtualProtect(hookAddress, hookLength, PAGE_EXECUTE_WRITECOPY, &oldProtect); 46 | 47 | memset(hookAddress, 0x90, hookLength); 48 | 49 | DWORD relativeAddress = ((DWORD)hookFunction - (DWORD)hookAddress) - 5; 50 | 51 | *(BYTE*)hookAddress = 0xE9; 52 | *(DWORD*)((DWORD)hookAddress + 1) = relativeAddress; 53 | 54 | DWORD tmp; 55 | VirtualProtect(hookAddress, hookLength, oldProtect, &tmp); 56 | 57 | return true; 58 | } 59 | 60 | // CSGOSimple's pattern scan 61 | // https://github.com/OneshotGH/CSGOSimple-master/blob/master/CSGOSimple/helpers/utils.cpp 62 | std::uint8_t* PatternScan(void* module, const char* signature) 63 | { 64 | static auto pattern_to_byte = [](const char* pattern) { 65 | auto bytes = std::vector{}; 66 | auto start = const_cast(pattern); 67 | auto end = const_cast(pattern) + strlen(pattern); 68 | 69 | for (auto current = start; current < end; ++current) { 70 | if (*current == '?') { 71 | ++current; 72 | if (*current == '?') 73 | ++current; 74 | bytes.push_back(-1); 75 | } 76 | else { 77 | bytes.push_back(strtoul(current, ¤t, 16)); 78 | } 79 | } 80 | return bytes; 81 | }; 82 | 83 | auto dosHeader = (PIMAGE_DOS_HEADER)module; 84 | auto ntHeaders = (PIMAGE_NT_HEADERS)((std::uint8_t*)module + dosHeader->e_lfanew); 85 | 86 | auto sizeOfImage = ntHeaders->OptionalHeader.SizeOfImage; 87 | auto patternBytes = pattern_to_byte(signature); 88 | auto scanBytes = reinterpret_cast(module); 89 | 90 | auto s = patternBytes.size(); 91 | auto d = patternBytes.data(); 92 | 93 | for (auto i = 0ul; i < sizeOfImage - s; ++i) { 94 | bool found = true; 95 | for (auto j = 0ul; j < s; ++j) { 96 | if (scanBytes[i + j] != d[j] && d[j] != -1) { 97 | found = false; 98 | break; 99 | } 100 | } 101 | if (found) { 102 | return &scanBytes[i]; 103 | } 104 | } 105 | return nullptr; 106 | } 107 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Oo]ut/ 33 | [Ll]og/ 34 | [Ll]ogs/ 35 | 36 | # Visual Studio 2015/2017 cache/options directory 37 | .vs/ 38 | # Uncomment if you have tasks that create the project's static files in wwwroot 39 | #wwwroot/ 40 | 41 | # Visual Studio 2017 auto generated files 42 | Generated\ Files/ 43 | 44 | # MSTest test Results 45 | [Tt]est[Rr]esult*/ 46 | [Bb]uild[Ll]og.* 47 | 48 | # NUnit 49 | *.VisualState.xml 50 | TestResult.xml 51 | nunit-*.xml 52 | 53 | # Build Results of an ATL Project 54 | [Dd]ebugPS/ 55 | [Rr]eleasePS/ 56 | dlldata.c 57 | 58 | # Benchmark Results 59 | BenchmarkDotNet.Artifacts/ 60 | 61 | # .NET Core 62 | project.lock.json 63 | project.fragment.lock.json 64 | artifacts/ 65 | 66 | # ASP.NET Scaffolding 67 | ScaffoldingReadMe.txt 68 | 69 | # StyleCop 70 | StyleCopReport.xml 71 | 72 | # Files built by Visual Studio 73 | *_i.c 74 | *_p.c 75 | *_h.h 76 | *.ilk 77 | *.meta 78 | *.obj 79 | *.iobj 80 | *.pch 81 | *.pdb 82 | *.ipdb 83 | *.pgc 84 | *.pgd 85 | *.rsp 86 | *.sbr 87 | *.tlb 88 | *.tli 89 | *.tlh 90 | *.tmp 91 | *.tmp_proj 92 | *_wpftmp.csproj 93 | *.log 94 | *.vspscc 95 | *.vssscc 96 | .builds 97 | *.pidb 98 | *.svclog 99 | *.scc 100 | 101 | # Chutzpah Test files 102 | _Chutzpah* 103 | 104 | # Visual C++ cache files 105 | ipch/ 106 | *.aps 107 | *.ncb 108 | *.opendb 109 | *.opensdf 110 | *.sdf 111 | *.cachefile 112 | *.VC.db 113 | *.VC.VC.opendb 114 | 115 | # Visual Studio profiler 116 | *.psess 117 | *.vsp 118 | *.vspx 119 | *.sap 120 | 121 | # Visual Studio Trace Files 122 | *.e2e 123 | 124 | # TFS 2012 Local Workspace 125 | $tf/ 126 | 127 | # Guidance Automation Toolkit 128 | *.gpState 129 | 130 | # ReSharper is a .NET coding add-in 131 | _ReSharper*/ 132 | *.[Rr]e[Ss]harper 133 | *.DotSettings.user 134 | 135 | # TeamCity is a build add-in 136 | _TeamCity* 137 | 138 | # DotCover is a Code Coverage Tool 139 | *.dotCover 140 | 141 | # AxoCover is a Code Coverage Tool 142 | .axoCover/* 143 | !.axoCover/settings.json 144 | 145 | # Coverlet is a free, cross platform Code Coverage Tool 146 | coverage*.json 147 | coverage*.xml 148 | coverage*.info 149 | 150 | # Visual Studio code coverage results 151 | *.coverage 152 | *.coveragexml 153 | 154 | # NCrunch 155 | _NCrunch_* 156 | .*crunch*.local.xml 157 | nCrunchTemp_* 158 | 159 | # MightyMoose 160 | *.mm.* 161 | AutoTest.Net/ 162 | 163 | # Web workbench (sass) 164 | .sass-cache/ 165 | 166 | # Installshield output folder 167 | [Ee]xpress/ 168 | 169 | # DocProject is a documentation generator add-in 170 | DocProject/buildhelp/ 171 | DocProject/Help/*.HxT 172 | DocProject/Help/*.HxC 173 | DocProject/Help/*.hhc 174 | DocProject/Help/*.hhk 175 | DocProject/Help/*.hhp 176 | DocProject/Help/Html2 177 | DocProject/Help/html 178 | 179 | # Click-Once directory 180 | publish/ 181 | 182 | # Publish Web Output 183 | *.[Pp]ublish.xml 184 | *.azurePubxml 185 | # Note: Comment the next line if you want to checkin your web deploy settings, 186 | # but database connection strings (with potential passwords) will be unencrypted 187 | *.pubxml 188 | *.publishproj 189 | 190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 191 | # checkin your Azure Web App publish settings, but sensitive information contained 192 | # in these scripts will be unencrypted 193 | PublishScripts/ 194 | 195 | # NuGet Packages 196 | *.nupkg 197 | # NuGet Symbol Packages 198 | *.snupkg 199 | # The packages folder can be ignored because of Package Restore 200 | **/[Pp]ackages/* 201 | # except build/, which is used as an MSBuild target. 202 | !**/[Pp]ackages/build/ 203 | # Uncomment if necessary however generally it will be regenerated when needed 204 | #!**/[Pp]ackages/repositories.config 205 | # NuGet v3's project.json files produces more ignorable files 206 | *.nuget.props 207 | *.nuget.targets 208 | 209 | # Microsoft Azure Build Output 210 | csx/ 211 | *.build.csdef 212 | 213 | # Microsoft Azure Emulator 214 | ecf/ 215 | rcf/ 216 | 217 | # Windows Store app package directories and files 218 | AppPackages/ 219 | BundleArtifacts/ 220 | Package.StoreAssociation.xml 221 | _pkginfo.txt 222 | *.appx 223 | *.appxbundle 224 | *.appxupload 225 | 226 | # Visual Studio cache files 227 | # files ending in .cache can be ignored 228 | *.[Cc]ache 229 | # but keep track of directories ending in .cache 230 | !?*.[Cc]ache/ 231 | 232 | # Others 233 | ClientBin/ 234 | ~$* 235 | *~ 236 | *.dbmdl 237 | *.dbproj.schemaview 238 | *.jfm 239 | *.pfx 240 | *.publishsettings 241 | orleans.codegen.cs 242 | 243 | # Including strong name files can present a security risk 244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 245 | #*.snk 246 | 247 | # Since there are multiple workflows, uncomment next line to ignore bower_components 248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 249 | #bower_components/ 250 | 251 | # RIA/Silverlight projects 252 | Generated_Code/ 253 | 254 | # Backup & report files from converting an old project file 255 | # to a newer Visual Studio version. Backup files are not needed, 256 | # because we have git ;-) 257 | _UpgradeReport_Files/ 258 | Backup*/ 259 | UpgradeLog*.XML 260 | UpgradeLog*.htm 261 | ServiceFabricBackup/ 262 | *.rptproj.bak 263 | 264 | # SQL Server files 265 | *.mdf 266 | *.ldf 267 | *.ndf 268 | 269 | # Business Intelligence projects 270 | *.rdl.data 271 | *.bim.layout 272 | *.bim_*.settings 273 | *.rptproj.rsuser 274 | *- [Bb]ackup.rdl 275 | *- [Bb]ackup ([0-9]).rdl 276 | *- [Bb]ackup ([0-9][0-9]).rdl 277 | 278 | # Microsoft Fakes 279 | FakesAssemblies/ 280 | 281 | # GhostDoc plugin setting file 282 | *.GhostDoc.xml 283 | 284 | # Node.js Tools for Visual Studio 285 | .ntvs_analysis.dat 286 | node_modules/ 287 | 288 | # Visual Studio 6 build log 289 | *.plg 290 | 291 | # Visual Studio 6 workspace options file 292 | *.opt 293 | 294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 295 | *.vbw 296 | 297 | # Visual Studio LightSwitch build output 298 | **/*.HTMLClient/GeneratedArtifacts 299 | **/*.DesktopClient/GeneratedArtifacts 300 | **/*.DesktopClient/ModelManifest.xml 301 | **/*.Server/GeneratedArtifacts 302 | **/*.Server/ModelManifest.xml 303 | _Pvt_Extensions 304 | 305 | # Paket dependency manager 306 | .paket/paket.exe 307 | paket-files/ 308 | 309 | # FAKE - F# Make 310 | .fake/ 311 | 312 | # CodeRush personal settings 313 | .cr/personal 314 | 315 | # Python Tools for Visual Studio (PTVS) 316 | __pycache__/ 317 | *.pyc 318 | 319 | # Cake - Uncomment if you are using it 320 | # tools/** 321 | # !tools/packages.config 322 | 323 | # Tabs Studio 324 | *.tss 325 | 326 | # Telerik's JustMock configuration file 327 | *.jmconfig 328 | 329 | # BizTalk build output 330 | *.btp.cs 331 | *.btm.cs 332 | *.odx.cs 333 | *.xsd.cs 334 | 335 | # OpenCover UI analysis results 336 | OpenCover/ 337 | 338 | # Azure Stream Analytics local run output 339 | ASALocalRun/ 340 | 341 | # MSBuild Binary and Structured Log 342 | *.binlog 343 | 344 | # NVidia Nsight GPU debugger configuration file 345 | *.nvuser 346 | 347 | # MFractors (Xamarin productivity tool) working folder 348 | .mfractor/ 349 | 350 | # Local History for Visual Studio 351 | .localhistory/ 352 | 353 | # BeatPulse healthcheck temp database 354 | healthchecksdb 355 | 356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 357 | MigrationBackup/ 358 | 359 | # Ionide (cross platform F# VS Code tools) working folder 360 | .ionide/ 361 | 362 | # Fody - auto-generated XML schema 363 | FodyWeavers.xsd -------------------------------------------------------------------------------- /RERevFix.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 16.0 37 | Win32Proj 38 | {547863d5-fa99-4542-adc1-179593de313d} 39 | RERevFix 40 | 10.0 41 | 42 | 43 | 44 | DynamicLibrary 45 | true 46 | v143 47 | Unicode 48 | 49 | 50 | DynamicLibrary 51 | false 52 | v143 53 | true 54 | Unicode 55 | 56 | 57 | DynamicLibrary 58 | true 59 | v143 60 | Unicode 61 | 62 | 63 | DynamicLibrary 64 | false 65 | v143 66 | true 67 | Unicode 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | true 89 | xinput1_3 90 | 91 | 92 | false 93 | xinput1_3 94 | 95 | 96 | true 97 | 98 | 99 | false 100 | 101 | 102 | 103 | Level3 104 | true 105 | WIN32;_DEBUG;REREVFIX_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS 106 | true 107 | NotUsing 108 | pch.h 109 | 110 | 111 | Windows 112 | true 113 | false 114 | src/proxy.def 115 | 116 | 117 | 118 | 119 | Level3 120 | true 121 | true 122 | true 123 | WIN32;NDEBUG;REREVFIX_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS 124 | true 125 | NotUsing 126 | pch.h 127 | 128 | 129 | Windows 130 | true 131 | true 132 | true 133 | false 134 | src/proxy.def 135 | 136 | 137 | 138 | 139 | Level3 140 | true 141 | _DEBUG;REREVFIX_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 142 | true 143 | Use 144 | pch.h 145 | 146 | 147 | Windows 148 | true 149 | false 150 | 151 | 152 | 153 | 154 | Level3 155 | true 156 | true 157 | true 158 | NDEBUG;REREVFIX_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) 159 | true 160 | Use 161 | pch.h 162 | 163 | 164 | Windows 165 | true 166 | true 167 | true 168 | false 169 | 170 | 171 | 172 | 173 | 174 | -------------------------------------------------------------------------------- /src/proxy.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include 3 | #include 4 | 5 | #define PLUGIN_API extern "C" __declspec(dllexport) 6 | 7 | // XAPOFX1_5.dll 8 | typedef DWORD(WINAPI* CreateFX_ptr)(REFCLSID clsid, void* pEffect); 9 | 10 | CreateFX_ptr CreateFX_orig; 11 | 12 | PLUGIN_API DWORD WINAPI CreateFX(REFCLSID clsid, void* pEffect) 13 | { 14 | return CreateFX_orig(clsid, pEffect); 15 | } 16 | 17 | // X3DAudio1_7 18 | typedef DWORD(WINAPI* X3DAudioInitialize_ptr)(UINT32 SpeakerChannelMask, float SpeedOfSound, void* Instance); 19 | typedef DWORD(WINAPI* X3DAudioCalculate_ptr)(void* Instance, void* pListener, void* pEmitter, UINT32 Flags, void* pDSPSettings); 20 | 21 | X3DAudioInitialize_ptr X3DAudioInitialize_orig; 22 | X3DAudioCalculate_ptr X3DAudioCalculate_orig; 23 | 24 | PLUGIN_API DWORD WINAPI X3DAudioInitialize(UINT32 SpeakerChannelMask, float SpeedOfSound, void* Instance) 25 | { 26 | return X3DAudioInitialize_orig(SpeakerChannelMask, SpeedOfSound, Instance); 27 | } 28 | 29 | PLUGIN_API DWORD WINAPI X3DAudioCalculate(void* Instance, void* pListener, void* pEmitter, UINT32 Flags, void* pDSPSettings) 30 | { 31 | return X3DAudioCalculate_orig(Instance, pListener, pEmitter, Flags, pDSPSettings); 32 | } 33 | 34 | // XInput1_3 and XInput9_1_0 35 | typedef DWORD(WINAPI* XInputGetState_ptr)(DWORD dwUserIndex, void* pState); 36 | typedef DWORD(WINAPI* XInputSetState_ptr)(DWORD dwUserIndex, void* pVibration); 37 | typedef DWORD(WINAPI* XInputGetCapabilities_ptr)(DWORD dwUserIndex, DWORD dwFlags, void* pCapabilities); 38 | typedef void(WINAPI* XInputEnable_ptr)(BOOL enable); 39 | typedef DWORD(WINAPI* XInputGetDSoundAudioDeviceGuids_ptr)(DWORD dwUserIndex, GUID* pDSoundRenderGuid, GUID* pDSoundCaptureGuid); 40 | typedef DWORD(WINAPI* XInputGetBatteryInformation_ptr)(DWORD dwUserIndex, BYTE devType, void* pBatteryInformation); 41 | typedef DWORD(WINAPI* XInputGetKeystroke_ptr)(DWORD dwUserIndex, DWORD dwReserved, void* pKeystroke); 42 | 43 | XInputGetState_ptr XInputGetState_orig; 44 | XInputSetState_ptr XInputSetState_orig; 45 | XInputGetCapabilities_ptr XInputGetCapabilities_orig; 46 | XInputEnable_ptr XInputEnable_orig; 47 | XInputGetDSoundAudioDeviceGuids_ptr XInputGetDSoundAudioDeviceGuids_orig; 48 | XInputGetBatteryInformation_ptr XInputGetBatteryInformation_orig; 49 | XInputGetKeystroke_ptr XInputGetKeystroke_orig; 50 | 51 | // xinput1_3 needs everything at the proper ordinal, proxy.def handles that, but we need something for ordinal 1 so: 52 | PLUGIN_API void DllMain_stub() 53 | { 54 | 55 | } 56 | 57 | PLUGIN_API DWORD WINAPI XInputGetState(DWORD dwUserIndex, void* pState) 58 | { 59 | return XInputGetState_orig(dwUserIndex, pState); 60 | } 61 | 62 | PLUGIN_API DWORD WINAPI XInputSetState(DWORD dwUserIndex, void* pVibration) 63 | { 64 | return XInputSetState_orig(dwUserIndex, pVibration); 65 | } 66 | 67 | PLUGIN_API DWORD WINAPI XInputGetCapabilities(DWORD dwUserIndex, DWORD dwFlags, void* pCapabilities) 68 | { 69 | return XInputGetCapabilities_orig(dwUserIndex, dwFlags, pCapabilities); 70 | } 71 | 72 | PLUGIN_API void WINAPI XInputEnable(BOOL enable) 73 | { 74 | XInputEnable_orig(enable); 75 | } 76 | 77 | PLUGIN_API DWORD WINAPI XInputGetDSoundAudioDeviceGuids(DWORD dwUserIndex, GUID* pDSoundRenderGuid, GUID* pDSoundCaptureGuid) 78 | { 79 | return XInputGetDSoundAudioDeviceGuids_orig(dwUserIndex, pDSoundRenderGuid, pDSoundCaptureGuid); 80 | } 81 | 82 | PLUGIN_API DWORD WINAPI XInputGetBatteryInformation(DWORD dwUserIndex, BYTE devType, void* pBatteryInformation) 83 | { 84 | return XInputGetBatteryInformation_orig(dwUserIndex, devType, pBatteryInformation); 85 | } 86 | 87 | PLUGIN_API DWORD WINAPI XInputGetKeystroke(DWORD dwUserIndex, DWORD dwReserved, void* pKeystroke) 88 | { 89 | return XInputGetKeystroke_orig(dwUserIndex, dwReserved, pKeystroke); 90 | } 91 | 92 | //dinput8.dll 93 | typedef HRESULT(WINAPI* DirectInput8Create_ptr)(HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID* ppvOut, void* punkOuter); 94 | 95 | DirectInput8Create_ptr DirectInput8Create_orig; 96 | 97 | PLUGIN_API HRESULT WINAPI DirectInput8Create(HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID* ppvOut, void* punkOuter) 98 | { 99 | return DirectInput8Create_orig(hinst, dwVersion, riidltf, ppvOut, punkOuter); 100 | } 101 | 102 | //dxgi.dll 103 | struct UNKNOWN { 104 | BYTE unknown[20]; 105 | }; 106 | 107 | typedef HRESULT(WINAPI* DXGIDumpJournal_ptr)(void* unk); 108 | typedef HRESULT(WINAPI* CreateDXGIFactory_ptr)(REFIID riid, void** ppFactory); 109 | typedef HRESULT(WINAPI* CreateDXGIFactory1_ptr)(REFIID riid, void** ppFactory); 110 | typedef HRESULT(WINAPI* CreateDXGIFactory2_ptr)(UINT Flags, REFIID riid, void** ppFactory); 111 | typedef HRESULT(WINAPI* DXGID3D10CreateDevice_ptr)(HMODULE hModule, void* pFactory, void* pAdapter, UINT Flags, void* unknown, void* ppDevice); 112 | typedef HRESULT(WINAPI* DXGID3D10CreateLayeredDevice_ptr)(UNKNOWN unk); 113 | typedef size_t(WINAPI* DXGID3D10GetLayeredDeviceSize_ptr)(const void* pLayers, UINT NumLayers); 114 | typedef HRESULT(WINAPI* DXGID3D10RegisterLayers_ptr)(const void* pLayers, UINT NumLayers); 115 | typedef HRESULT(WINAPI* DXGIGetDebugInterface1_ptr)(UINT Flags, REFIID riid, void** pDebug); 116 | typedef HRESULT(WINAPI* DXGIReportAdapterConfiguration_ptr)(DWORD unk); 117 | 118 | DXGIDumpJournal_ptr DXGIDumpJournal_orig; 119 | CreateDXGIFactory_ptr CreateDXGIFactory_orig; 120 | CreateDXGIFactory1_ptr CreateDXGIFactory1_orig; 121 | CreateDXGIFactory2_ptr CreateDXGIFactory2_orig; 122 | DXGID3D10CreateDevice_ptr DXGID3D10CreateDevice_orig; 123 | DXGID3D10CreateLayeredDevice_ptr DXGID3D10CreateLayeredDevice_orig; 124 | DXGID3D10GetLayeredDeviceSize_ptr DXGID3D10GetLayeredDeviceSize_orig; 125 | DXGID3D10RegisterLayers_ptr DXGID3D10RegisterLayers_orig; 126 | DXGIGetDebugInterface1_ptr DXGIGetDebugInterface1_orig; 127 | DXGIReportAdapterConfiguration_ptr DXGIReportAdapterConfiguration_orig; 128 | 129 | PLUGIN_API HRESULT WINAPI DXGIDumpJournal(void* unk) 130 | { 131 | return DXGIDumpJournal_orig(unk); 132 | } 133 | 134 | PLUGIN_API HRESULT WINAPI CreateDXGIFactory(REFIID riid, _Out_ void** ppFactory) 135 | { 136 | return CreateDXGIFactory_orig(riid, ppFactory); 137 | } 138 | 139 | PLUGIN_API HRESULT WINAPI CreateDXGIFactory1(REFIID riid, _Out_ void** ppFactory) 140 | { 141 | return CreateDXGIFactory1_orig(riid, ppFactory); 142 | } 143 | 144 | PLUGIN_API HRESULT WINAPI CreateDXGIFactory2(UINT Flags, REFIID riid, _Out_ void** ppFactory) 145 | { 146 | return CreateDXGIFactory2_orig(Flags, riid, ppFactory); 147 | } 148 | 149 | PLUGIN_API HRESULT WINAPI DXGID3D10CreateDevice(HMODULE hModule, void* pFactory, void* pAdapter, UINT Flags, void* unknown, void* ppDevice) 150 | { 151 | return DXGID3D10CreateDevice_orig(hModule, pFactory, pAdapter, Flags, unknown, ppDevice); 152 | } 153 | 154 | PLUGIN_API HRESULT WINAPI DXGID3D10CreateLayeredDevice(UNKNOWN unk) 155 | { 156 | return DXGID3D10CreateLayeredDevice_orig(unk); 157 | } 158 | 159 | PLUGIN_API size_t WINAPI DXGID3D10GetLayeredDeviceSize(const void* pLayers, UINT NumLayers) 160 | { 161 | return DXGID3D10GetLayeredDeviceSize_orig(pLayers, NumLayers); 162 | } 163 | 164 | PLUGIN_API HRESULT WINAPI DXGID3D10RegisterLayers(const void* pLayers, UINT NumLayers) 165 | { 166 | return DXGID3D10RegisterLayers_orig(pLayers, NumLayers); 167 | } 168 | 169 | PLUGIN_API HRESULT WINAPI DXGIGetDebugInterface1(UINT Flags, REFIID riid, void** pDebug) 170 | { 171 | return DXGIGetDebugInterface1_orig(Flags, riid, pDebug); 172 | } 173 | 174 | PLUGIN_API HRESULT WINAPI DXGIReportAdapterConfiguration(DWORD unk) 175 | { 176 | return DXGIReportAdapterConfiguration_orig(unk); 177 | } 178 | 179 | HMODULE origModule = NULL; 180 | 181 | bool Proxy_Attach() 182 | { 183 | extern HMODULE ourModule; 184 | 185 | // get the filename of our DLL and try loading the DLL with the same name from system dir 186 | WCHAR modulePath[MAX_PATH] = { 0 }; 187 | if (!GetSystemDirectoryW(modulePath, _countof(modulePath))) 188 | return false; 189 | 190 | WCHAR ourModulePath[MAX_PATH] = { 0 }; 191 | GetModuleFileNameW(ourModule, ourModulePath, _countof(ourModulePath)); 192 | 193 | WCHAR exeName[MAX_PATH] = { 0 }; 194 | WCHAR extName[MAX_PATH] = { 0 }; 195 | _wsplitpath_s(ourModulePath, NULL, NULL, NULL, NULL, exeName, MAX_PATH, extName, MAX_PATH); 196 | 197 | swprintf_s(modulePath, MAX_PATH, L"%ws\\%ws%ws", modulePath, exeName, extName); 198 | 199 | origModule = LoadLibraryW(modulePath); 200 | if (!origModule) 201 | return false; 202 | 203 | XInputGetCapabilities_orig = (XInputGetCapabilities_ptr)GetProcAddress(origModule, "XInputGetCapabilities"); 204 | XInputGetDSoundAudioDeviceGuids_orig = (XInputGetDSoundAudioDeviceGuids_ptr)GetProcAddress(origModule, "XInputGetDSoundAudioDeviceGuids"); 205 | XInputGetState_orig = (XInputGetState_ptr)GetProcAddress(origModule, "XInputGetState"); 206 | XInputSetState_orig = (XInputSetState_ptr)GetProcAddress(origModule, "XInputSetState"); 207 | XInputEnable_orig = (XInputEnable_ptr)GetProcAddress(origModule, "XInputEnable"); 208 | XInputGetBatteryInformation_orig = (XInputGetBatteryInformation_ptr)GetProcAddress(origModule, "XInputGetBatteryInformation"); 209 | XInputGetKeystroke_orig = (XInputGetKeystroke_ptr)GetProcAddress(origModule, "XInputGetKeystroke"); 210 | 211 | DirectInput8Create_orig = (DirectInput8Create_ptr)GetProcAddress(origModule, "DirectInput8Create"); 212 | 213 | DXGIDumpJournal_orig = (DXGIDumpJournal_ptr)GetProcAddress(origModule, "DXGIDumpJournal"); 214 | CreateDXGIFactory_orig = (CreateDXGIFactory_ptr)GetProcAddress(origModule, "CreateDXGIFactory"); 215 | CreateDXGIFactory1_orig = (CreateDXGIFactory1_ptr)GetProcAddress(origModule, "CreateDXGIFactory1"); 216 | CreateDXGIFactory2_orig = (CreateDXGIFactory2_ptr)GetProcAddress(origModule, "CreateDXGIFactory2"); 217 | DXGID3D10CreateDevice_orig = (DXGID3D10CreateDevice_ptr)GetProcAddress(origModule, "DXGID3D10CreateDevice"); 218 | DXGID3D10CreateLayeredDevice_orig = (DXGID3D10CreateLayeredDevice_ptr)GetProcAddress(origModule, "DXGID3D10CreateLayeredDevice"); 219 | DXGID3D10GetLayeredDeviceSize_orig = (DXGID3D10GetLayeredDeviceSize_ptr)GetProcAddress(origModule, "DXGID3D10GetLayeredDeviceSize"); 220 | DXGID3D10RegisterLayers_orig = (DXGID3D10RegisterLayers_ptr)GetProcAddress(origModule, "DXGID3D10RegisterLayers"); 221 | DXGIGetDebugInterface1_orig = (DXGIGetDebugInterface1_ptr)GetProcAddress(origModule, "DXGIGetDebugInterface1"); 222 | DXGIReportAdapterConfiguration_orig = (DXGIReportAdapterConfiguration_ptr)GetProcAddress(origModule, "DXGIReportAdapterConfiguration"); 223 | 224 | X3DAudioInitialize_orig = (X3DAudioInitialize_ptr)GetProcAddress(origModule, "X3DAudioInitialize"); 225 | X3DAudioCalculate_orig = (X3DAudioCalculate_ptr)GetProcAddress(origModule, "X3DAudioCalculate"); 226 | 227 | CreateFX_orig = (CreateFX_ptr)GetProcAddress(origModule, "CreateFX"); 228 | 229 | return true; 230 | } 231 | 232 | void Proxy_Detach() 233 | { 234 | if (!origModule) 235 | return; 236 | 237 | FreeLibrary(origModule); 238 | origModule = nullptr; 239 | } 240 | -------------------------------------------------------------------------------- /src/dllmain.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "helper.hpp" 3 | #include "external/inih/INIReader.h" 4 | #include 5 | 6 | bool Proxy_Attach(); 7 | void Proxy_Detach(); 8 | 9 | using namespace std; 10 | 11 | HMODULE baseModule = GetModuleHandle(NULL); 12 | 13 | // INI Variables 14 | bool bResFix; 15 | bool bMovieFix; 16 | bool bHUDFix; 17 | int iFPSCap; 18 | bool bFPSCap; 19 | bool bFOVAdjust; 20 | float fFOVAdjust; 21 | bool bShadowQuality; 22 | int iShadowQuality; 23 | int iCustomResX; 24 | int iCustomResY; 25 | 26 | // Variables 27 | float fDesktopRight; 28 | float fDesktopBottom; 29 | float fDesktopAspect; 30 | float fNativeAspect = 1.777777791f; 31 | float fCustomAspect; 32 | float fUIOffset; 33 | 34 | // FPS Cap Hook 35 | DWORD FPSCapReturnJMP; 36 | float FPSCapValue; 37 | void __declspec(naked) FPSCap_CC() 38 | { 39 | __asm 40 | { 41 | divss xmm1, [FPSCapValue] 42 | movaps xmm0, xmm1 43 | jmp [FPSCapReturnJMP] 44 | } 45 | } 46 | 47 | // FOV1 Hook 48 | DWORD FOV1ReturnJMP; 49 | void __declspec(naked) FOV1_CC() 50 | { 51 | __asm 52 | { 53 | fld dword ptr[ebx + 0x10] 54 | fadd [fFOVAdjust] 55 | xorps xmm0, xmm0 56 | fstp dword ptr[esi + 0x0000008C] 57 | jmp [FOV1ReturnJMP] 58 | } 59 | } 60 | 61 | // HUD Scale Hook 62 | DWORD HudScaleReturnJMP; 63 | float HudScaleValue; 64 | void __declspec(naked) HudScale_CC() 65 | { 66 | __asm 67 | { 68 | movss xmm0, [HudScaleValue] 69 | xorps xmm1, xmm1 70 | cvtsi2ss xmm1, ebx 71 | divss xmm0, xmm1 72 | jmp[HudScaleReturnJMP] 73 | } 74 | } 75 | 76 | // HUD Left Offset Hook 77 | DWORD HudLeftOffsetReturnJMP; 78 | float HudLeftOffsetValue; 79 | void __declspec(naked) HudLeftOffset_CC() 80 | { 81 | __asm 82 | { 83 | subss xmm2, [HudLeftOffsetValue] 84 | jmp[HudLeftOffsetReturnJMP] 85 | } 86 | } 87 | 88 | // Shadow Quality Hook 89 | DWORD ShadowQualityReturnJMP; 90 | void __declspec(naked) ShadowQuality_CC() 91 | { 92 | __asm 93 | { 94 | mov eax, [iShadowQuality] 95 | add eax, 31 96 | push esi 97 | jmp[ShadowQualityReturnJMP] 98 | } 99 | } 100 | 101 | // Movie Fix Hook 102 | DWORD MovieFixReturnJMP; 103 | int MovieFixValue; 104 | void __declspec(naked) MovieFix_CC() 105 | { 106 | __asm 107 | { 108 | fimul [MovieFixValue] 109 | mov[esp + 0x10], eax 110 | jmp[MovieFixReturnJMP] 111 | } 112 | } 113 | 114 | void ReadConfig() 115 | { 116 | INIReader config("RERevFix.ini"); 117 | 118 | iFPSCap = config.GetInteger("FPS Cap", "Value", -1); 119 | bFPSCap = config.GetInteger("FPS Cap", "Enabled", true); 120 | bMovieFix = config.GetBoolean("Fix Movies", "Enabled", true); 121 | bResFix = config.GetBoolean("Fix Resolution", "Enabled", true); 122 | bHUDFix = config.GetBoolean("Fix UI", "Enabled", true); 123 | iShadowQuality = config.GetInteger("Shadow Quality", "Value", -1); 124 | bShadowQuality = config.GetBoolean("Shadow Quality", "Enabled", true); 125 | bFOVAdjust = config.GetBoolean("Increase FOV", "Enabled", true); 126 | fFOVAdjust = config.GetFloat("Increase FOV", "Value", -1); 127 | iCustomResX = config.GetInteger("Custom Resolution", "Width", -1); 128 | iCustomResY = config.GetInteger("Custom Resolution", "Height", -1); 129 | 130 | RECT desktop; 131 | GetWindowRect(GetDesktopWindow(), &desktop); 132 | fDesktopRight = (float)desktop.right; 133 | fDesktopBottom = (float)desktop.bottom; 134 | fDesktopAspect = (float)desktop.right / (float)desktop.bottom; 135 | fCustomAspect = (float)iCustomResX / (float)iCustomResY; 136 | } 137 | 138 | void AspectRatio() 139 | { 140 | if (bResFix) 141 | { 142 | // Address of signature = rerev.exe + 0x00CD3860 143 | // "\x31\x36\x3A\x39", "xxxx" 144 | uint8_t* SixteenNineScanResult = Memory::PatternScan(baseModule, "31 36 3A 39"); 145 | if (SixteenNineScanResult) { 146 | Memory::PatchBytes((intptr_t)SixteenNineScanResult, "\x44\x45\x46\x41\x55\x4c\x54", 7); // Write DEFAULT to aspect 147 | #if _DEBUG 148 | std::cout << "Wrote DEFAULT to aspect" << std::endl; 149 | #endif 150 | } 151 | 152 | // Address of signature = rerev.exe + 0x00751635 153 | // "\x85\xF6\x0F\x84\x00\x00\x00\x00\x81\xFE", "xxxx????xx" 154 | uint8_t* CrashFixScanResult = Memory::PatternScan(baseModule, "85 F6 0F 84 ? ? ? ? 81 FE"); 155 | if (CrashFixScanResult) { 156 | Memory::PatchBytes((intptr_t)CrashFixScanResult, "\x90\x90", 2); // Should mitigate crashes 157 | #if _DEBUG 158 | std::cout << "NOP'd crash area" << std::endl; 159 | #endif 160 | } 161 | 162 | // Replace 640x480 with chosen res 163 | string newRes = std::to_string((int)fDesktopRight) + "x" + std::to_string((int)fDesktopBottom); 164 | if (iCustomResX > 0 && iCustomResY > 0) 165 | { 166 | newRes = std::to_string(iCustomResX) + "x" + std::to_string(iCustomResY); 167 | } 168 | uint8_t* TenEightyScanResult = Memory::PatternScan(baseModule, "36 34 30 78 34 38 30"); 169 | if (TenEightyScanResult) { 170 | Memory::PatchBytes((intptr_t)TenEightyScanResult, newRes.c_str(), 9); // 3440x1440 171 | #if _DEBUG 172 | std::cout << "640x480 replaced with: " << newRes << std::endl; 173 | #endif 174 | } 175 | } 176 | } 177 | 178 | void HUDFix() 179 | { 180 | if (bHUDFix) 181 | { 182 | // Address of signature = rerev.exe + 0x007A120A 183 | // "\x0F\x57\x00\xF3\x0F\x00\x00\xF3\x0F\x00\x00\xF3\x0F\x00\x00\x00\x00\x00\x00\x0F\x57\x00\xF3\x0F\x00\x00\xF3\x0F\x00\x00\x0F\x28", "xx?xx??xx??xx??????xx?xx??xx??xx" 184 | uint8_t* HudScaleScanResult = Memory::PatternScan(baseModule, "0F 57 ? F3 0F ? ? F3 0F ? ? F3 0F ? ? ? ? ? ? 0F 57 ? F3 0F ? ? F3 0F ? ? 0F 28"); 185 | if (HudScaleScanResult) { 186 | int HudScaleHookLength = 11; 187 | DWORD HudScaleAddress = (intptr_t)HudScaleScanResult; 188 | HudScaleValue = (float)(fNativeAspect / fDesktopAspect) * 2; 189 | if (iCustomResX > 0 && iCustomResY > 0) 190 | { 191 | HudScaleValue = (float)(fNativeAspect / fCustomAspect) * 2; 192 | } 193 | HudScaleReturnJMP = HudScaleAddress + HudScaleHookLength; 194 | Memory::Hook((void*)HudScaleAddress, HudScale_CC, HudScaleHookLength); 195 | #if _DEBUG 196 | std::cout << "Hud Scale set to: " << HudScaleValue << std::endl; 197 | #endif 198 | } 199 | 200 | // "\xF3\x0F\x00\x00\x00\x00\x00\x00\x0F\x28\x00\xF3\x0F\x00\x00\x00\x00\xF3\x0F\x00\x00\x00\x00\x00\x00\xF3\x0F\x00\x00\xF3\x0F\x00\x00\xF3\x0F\x00\x00\xF3\x0F\x00\x00\x00\xF3\x0F\x00\x00\x00\xF3\x0F\x00\x00\x00\x83\x66\x4C", "xx??????xx?xx????xx??????xx??xx??xx??xx???xx???xx???xxx" 201 | uint8_t* HudLeftOffsetScanResult = Memory::PatternScan(baseModule, "F3 0F ? ? ? ? ? ? 0F 28 ? F3 0F ? ? ? ? F3 0F ? ? ? ? ? ? F3 0F ? ? F3 0F ? ? F3 0F ? ? F3 0F ? ? ? F3 0F ? ? ? F3 0F ? ? ? 83 66 4C"); 202 | if (HudLeftOffsetScanResult) { 203 | int HudLeftOffsetHookLength = 8; 204 | DWORD HudLeftOffsetAddress = (intptr_t)HudLeftOffsetScanResult; 205 | HudLeftOffsetValue = (float)fNativeAspect / fDesktopAspect; 206 | if (iCustomResX > 0 && iCustomResY > 0) 207 | { 208 | HudLeftOffsetValue = (float)fNativeAspect / fCustomAspect; 209 | } 210 | HudLeftOffsetReturnJMP = HudLeftOffsetAddress + HudLeftOffsetHookLength; 211 | Memory::Hook((void*)HudLeftOffsetAddress, HudLeftOffset_CC, HudLeftOffsetHookLength); 212 | #if _DEBUG 213 | std::cout << "Hud Left Offset set to: " << HudLeftOffsetValue << std::endl; 214 | #endif 215 | } 216 | } 217 | } 218 | 219 | void AdjustFOV() 220 | { 221 | if (bFOVAdjust && fFOVAdjust > 0) 222 | { 223 | // Address of signature = rerev.exe + 0x00096AE6 224 | // "\xD9\x43\x00\x0F\x57\x00\xD9\x9E\x00\x00\x00\x00\xD9\x43\x00\x8B\xCB", "xx?xx?xx????xx?xx" 225 | uint8_t* FOV1ScanResult = Memory::PatternScan(baseModule, "D9 43 ? 0F 57 ? D9 9E ? ? ? ? D9 43 ? 8B CB"); 226 | 227 | if (FOV1ScanResult) 228 | { 229 | int FOV1HookLength = 12; 230 | DWORD FOV1Address = (intptr_t)FOV1ScanResult; 231 | FOV1ReturnJMP = FOV1Address + FOV1HookLength; 232 | Memory::Hook((void*)FOV1Address, FOV1_CC, FOV1HookLength); 233 | 234 | #if _DEBUG 235 | std::cout << "FOV increased by " << (int)fFOVAdjust << std::endl; 236 | #endif 237 | } 238 | else 239 | { 240 | #if _DEBUG 241 | std::cout << "FOV1 pattern scan failed." << std::endl; 242 | #endif 243 | return; 244 | } 245 | } 246 | 247 | } 248 | 249 | void FPSCap() 250 | { 251 | if (bFPSCap && iFPSCap == 0) // Don't leave it at 0, assume they want it "uncapped". 252 | { 253 | iFPSCap = 999; 254 | } 255 | 256 | if (bFPSCap && iFPSCap > 120) 257 | { 258 | // Address of signature = rerev.exe + 0x005CC311 259 | // "\xF3\x0F\x00\x00\x00\x0F\x28\x00\xF3\x0F\x00\x00\xF3\x0F\x00\x00\x00\x00\xD9\x54", "xx???xx?xx??xx????xx" 260 | uint8_t* FPSCapScanResult = Memory::PatternScan(baseModule, "F3 0F ? ? ? 0F 28 ? F3 0F ? ? F3 0F ? ? ? ? D9 54"); 261 | 262 | if (FPSCapScanResult) 263 | { 264 | int FPSCapHookLength = 8; 265 | DWORD FPSCapAddress = (intptr_t)FPSCapScanResult; 266 | FPSCapValue = (float)iFPSCap; 267 | FPSCapReturnJMP = FPSCapAddress + FPSCapHookLength; 268 | Memory::Hook((void*)FPSCapAddress, FPSCap_CC, FPSCapHookLength); 269 | 270 | #if _DEBUG 271 | std::cout << "FPS Cap set to: " << (int)iFPSCap << std::endl; 272 | #endif 273 | } 274 | else 275 | { 276 | #if _DEBUG 277 | std::cout << "FPSCap pattern scan failed." << std::endl; 278 | #endif 279 | return; 280 | } 281 | } 282 | } 283 | 284 | void IncreaseQuality() 285 | { 286 | if (bShadowQuality && iShadowQuality > 1024) 287 | { 288 | // Address of signature = rerev.exe + 0x007BC370 289 | //"\x8B\x44\x00\x00\x83\xC0\x00\x56\x8B\xF1\x83\xE0\x00\x39\x46\x00\x74\x00\x89\x46", "xx??xx?xxxxx?xx?x?xx" 290 | uint8_t* ShadowQualityScanResult = Memory::PatternScan(baseModule, "8B 44 ? ? 83 C0 ? 56 8B F1 83 E0 ? 39 46 ? 74 ? 89 46"); 291 | if (ShadowQualityScanResult) 292 | { 293 | int ShadowQualityHookLength = 8; 294 | DWORD ShadowQualityAddress = (intptr_t)ShadowQualityScanResult; 295 | ShadowQualityReturnJMP = ShadowQualityAddress + ShadowQualityHookLength; 296 | Memory::Hook((void*)ShadowQualityAddress, ShadowQuality_CC, ShadowQualityHookLength); 297 | #if _DEBUG 298 | std::cout << "Shadow resolution changed to: " << iShadowQuality << std::endl; 299 | #endif 300 | } 301 | } 302 | } 303 | 304 | void MovieFix() 305 | { 306 | //Address of signature = rerev.exe + 0x007ABE52 307 | //"\xDA\x4C\x00\x00\x89\x44\x00\x00\xD9\x6C", "xx??xx??xx" 308 | uint8_t* MovieFixScanResult = Memory::PatternScan(baseModule, "DA 4C ? ? 89 44 ? ? D9 6C"); 309 | if (MovieFixScanResult) 310 | { 311 | int MovieFixHookLength = 8; 312 | DWORD MovieFixAddress = (intptr_t)MovieFixScanResult; 313 | MovieFixValue = (int)fDesktopRight * (fNativeAspect / fDesktopAspect); 314 | if (iCustomResX > 0 && iCustomResY > 0) 315 | { 316 | MovieFixValue = (int)iCustomResX * (fNativeAspect / fCustomAspect); 317 | } 318 | MovieFixReturnJMP = MovieFixAddress + MovieFixHookLength; 319 | Memory::Hook((void*)MovieFixAddress, MovieFix_CC, MovieFixHookLength); 320 | #if _DEBUG 321 | std::cout << "Movie playback set to: " << MovieFixValue << "x" << (int)fDesktopBottom << std::endl; 322 | #endif 323 | } 324 | } 325 | 326 | DWORD __stdcall Main(void*) 327 | { 328 | #if _DEBUG 329 | AllocConsole(); 330 | freopen_s((FILE**)stdout, "CONOUT$", "w", stdout); 331 | std::cout << "Console initiated" << std::endl; 332 | #endif 333 | ReadConfig(); 334 | Sleep(500); // delay first 335 | AspectRatio(); 336 | HUDFix(); 337 | AdjustFOV(); 338 | FPSCap(); 339 | IncreaseQuality(); 340 | MovieFix(); 341 | 342 | return true; // end thread 343 | } 344 | 345 | HMODULE ourModule; 346 | 347 | void Patch_Uninit() 348 | { 349 | 350 | } 351 | 352 | BOOL APIENTRY DllMain(HMODULE hModule, int ul_reason_for_call, LPVOID lpReserved) 353 | { 354 | if (ul_reason_for_call == DLL_PROCESS_ATTACH) 355 | { 356 | ourModule = hModule; 357 | Proxy_Attach(); 358 | 359 | CreateThread(NULL, 0, Main, 0, NULL, 0); 360 | } 361 | if (ul_reason_for_call == DLL_PROCESS_DETACH) 362 | { 363 | Patch_Uninit(); 364 | 365 | Proxy_Detach(); 366 | } 367 | 368 | return TRUE; 369 | } 370 | --------------------------------------------------------------------------------