├── .clang-format ├── .gitattributes ├── .gitignore ├── LICENSE.md ├── build_definitions.props ├── cpu_info ├── cpu_info.vcxproj ├── cpu_info.vcxproj.filters ├── d3dx9_38_exports.c ├── main.c └── util.h ├── heap_replacer.sln └── heap_replacer ├── dheap ├── cdesc.h ├── clist.h ├── cnode.h ├── dheap.h ├── dheap_defs.h └── mcell.h ├── heap_replacer.vcxproj ├── heap_replacer.vcxproj.filters ├── locks ├── nlock.h └── rlock.h ├── main ├── defs.h ├── heap_replacer.h ├── main.c └── util.h ├── mheap ├── mheap.h ├── mheap_defs.h ├── mpool - Copy.h └── mpool.h └── sheap ├── sheap.h └── sheap_defs.h /.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: Microsoft 2 | ColumnLimit: 80 3 | #AllowShortLoopsOnASingleLine: true 4 | #AllowShortBlocksOnASingleLine: true -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.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 -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /build_definitions.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | FNV 6 | C:/Games/Fallout New Vegas 7 | NVHR 8 | nvhr 9 | AVX2 10 | avx2 11 | 12 | 13 | 14 | 15 | WIN32_LEAN_AND_MEAN;$(HR_GAME);HR_NAME="$(HR_NAME)";HR_NAME_LOWER="$(HR_NAME_LOWER)";%(PreprocessorDefinitions) 16 | 17 | 18 | 19 | 20 | $(HR_GAME) 21 | 22 | 23 | $(HR_GAME_DIR) 24 | 25 | 26 | $(HR_NAME) 27 | 28 | 29 | $(HR_NAME_LOWER) 30 | 31 | 32 | $(ARCH) 33 | 34 | 35 | $(ARCH_LOWER) 36 | 37 | 38 | -------------------------------------------------------------------------------- /cpu_info/cpu_info.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Release 6 | Win32 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 16.0 18 | Win32Proj 19 | {7835da3e-6140-4e3b-b7ad-1af48b254fae} 20 | cpuinfo 21 | 10.0 22 | 23 | 24 | 25 | DynamicLibrary 26 | false 27 | v143 28 | true 29 | Unicode 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | false 43 | $(SolutionDir)binaries\$(Configuration)\$(ProjectName)\$(Arch)\ 44 | $(SolutionDir)intermediates\$(Configuration)\$(ProjectName)\$(Arch)\ 45 | d3dx9_38 46 | 47 | 48 | 49 | Level3 50 | true 51 | true 52 | false 53 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 54 | true 55 | stdc17 56 | stdcpp20 57 | OldStyle 58 | AnySuitable 59 | Speed 60 | true 61 | true 62 | false 63 | false 64 | Fast 65 | FastCall 66 | CompileAsC 67 | NoExtensions 68 | 69 | 70 | Console 71 | true 72 | true 73 | DebugFull 74 | 75 | 76 | copy "$(TargetPath)" "$(HR_GAME_DIR)\$(TargetFileName)" 77 | 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /cpu_info/cpu_info.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 | Source Files 23 | 24 | 25 | 26 | 27 | Header Files 28 | 29 | 30 | -------------------------------------------------------------------------------- /cpu_info/d3dx9_38_exports.c: -------------------------------------------------------------------------------- 1 | #pragma comment( \ 2 | linker, \ 3 | "/export:D3DXAssembleShader=C:\\Windows\\System32\\d3dx9_38.D3DXAssembleShader") 4 | #pragma comment( \ 5 | linker, \ 6 | "/export:D3DXAssembleShaderFromFileA=C:\\Windows\\System32\\d3dx9_38.D3DXAssembleShaderFromFileA") 7 | #pragma comment( \ 8 | linker, \ 9 | "/export:D3DXAssembleShaderFromFileW=C:\\Windows\\System32\\d3dx9_38.D3DXAssembleShaderFromFileW") 10 | #pragma comment( \ 11 | linker, \ 12 | "/export:D3DXAssembleShaderFromResourceA=C:\\Windows\\System32\\d3dx9_38.D3DXAssembleShaderFromResourceA") 13 | #pragma comment( \ 14 | linker, \ 15 | "/export:D3DXAssembleShaderFromResourceW=C:\\Windows\\System32\\d3dx9_38.D3DXAssembleShaderFromResourceW") 16 | #pragma comment( \ 17 | linker, \ 18 | "/export:D3DXBoxBoundProbe=C:\\Windows\\System32\\d3dx9_38.D3DXBoxBoundProbe") 19 | #pragma comment( \ 20 | linker, \ 21 | "/export:D3DXCheckCubeTextureRequirements=C:\\Windows\\System32\\d3dx9_38.D3DXCheckCubeTextureRequirements") 22 | #pragma comment( \ 23 | linker, \ 24 | "/export:D3DXCheckTextureRequirements=C:\\Windows\\System32\\d3dx9_38.D3DXCheckTextureRequirements") 25 | #pragma comment( \ 26 | linker, \ 27 | "/export:D3DXCheckVersion=C:\\Windows\\System32\\d3dx9_38.D3DXCheckVersion") 28 | #pragma comment( \ 29 | linker, \ 30 | "/export:D3DXCheckVolumeTextureRequirements=C:\\Windows\\System32\\d3dx9_38.D3DXCheckVolumeTextureRequirements") 31 | #pragma comment( \ 32 | linker, \ 33 | "/export:D3DXCleanMesh=C:\\Windows\\System32\\d3dx9_38.D3DXCleanMesh") 34 | #pragma comment( \ 35 | linker, \ 36 | "/export:D3DXColorAdjustContrast=C:\\Windows\\System32\\d3dx9_38.D3DXColorAdjustContrast") 37 | #pragma comment( \ 38 | linker, \ 39 | "/export:D3DXColorAdjustSaturation=C:\\Windows\\System32\\d3dx9_38.D3DXColorAdjustSaturation") 40 | #pragma comment( \ 41 | linker, \ 42 | "/export:D3DXCompileShader=C:\\Windows\\System32\\d3dx9_38.D3DXCompileShader") 43 | #pragma comment( \ 44 | linker, \ 45 | "/export:D3DXCompileShaderFromFileA=C:\\Windows\\System32\\d3dx9_38.D3DXCompileShaderFromFileA") 46 | #pragma comment( \ 47 | linker, \ 48 | "/export:D3DXCompileShaderFromFileW=C:\\Windows\\System32\\d3dx9_38.D3DXCompileShaderFromFileW") 49 | #pragma comment( \ 50 | linker, \ 51 | "/export:D3DXCompileShaderFromResourceA=C:\\Windows\\System32\\d3dx9_38.D3DXCompileShaderFromResourceA") 52 | #pragma comment( \ 53 | linker, \ 54 | "/export:D3DXCompileShaderFromResourceW=C:\\Windows\\System32\\d3dx9_38.D3DXCompileShaderFromResourceW") 55 | #pragma comment( \ 56 | linker, \ 57 | "/export:D3DXComputeBoundingBox=C:\\Windows\\System32\\d3dx9_38.D3DXComputeBoundingBox") 58 | #pragma comment( \ 59 | linker, \ 60 | "/export:D3DXComputeBoundingSphere=C:\\Windows\\System32\\d3dx9_38.D3DXComputeBoundingSphere") 61 | #pragma comment( \ 62 | linker, \ 63 | "/export:D3DXComputeIMTFromPerTexelSignal=C:\\Windows\\System32\\d3dx9_38.D3DXComputeIMTFromPerTexelSignal") 64 | #pragma comment( \ 65 | linker, \ 66 | "/export:D3DXComputeIMTFromPerVertexSignal=C:\\Windows\\System32\\d3dx9_38.D3DXComputeIMTFromPerVertexSignal") 67 | #pragma comment( \ 68 | linker, \ 69 | "/export:D3DXComputeIMTFromSignal=C:\\Windows\\System32\\d3dx9_38.D3DXComputeIMTFromSignal") 70 | #pragma comment( \ 71 | linker, \ 72 | "/export:D3DXComputeIMTFromTexture=C:\\Windows\\System32\\d3dx9_38.D3DXComputeIMTFromTexture") 73 | #pragma comment( \ 74 | linker, \ 75 | "/export:D3DXComputeNormalMap=C:\\Windows\\System32\\d3dx9_38.D3DXComputeNormalMap") 76 | #pragma comment( \ 77 | linker, \ 78 | "/export:D3DXComputeNormals=C:\\Windows\\System32\\d3dx9_38.D3DXComputeNormals") 79 | #pragma comment( \ 80 | linker, \ 81 | "/export:D3DXComputeTangent=C:\\Windows\\System32\\d3dx9_38.D3DXComputeTangent") 82 | #pragma comment( \ 83 | linker, \ 84 | "/export:D3DXComputeTangentFrame=C:\\Windows\\System32\\d3dx9_38.D3DXComputeTangentFrame") 85 | #pragma comment( \ 86 | linker, \ 87 | "/export:D3DXComputeTangentFrameEx=C:\\Windows\\System32\\d3dx9_38.D3DXComputeTangentFrameEx") 88 | #pragma comment( \ 89 | linker, \ 90 | "/export:D3DXConcatenateMeshes=C:\\Windows\\System32\\d3dx9_38.D3DXConcatenateMeshes") 91 | #pragma comment( \ 92 | linker, \ 93 | "/export:D3DXConvertMeshSubsetToSingleStrip=C:\\Windows\\System32\\d3dx9_38.D3DXConvertMeshSubsetToSingleStrip") 94 | #pragma comment( \ 95 | linker, \ 96 | "/export:D3DXConvertMeshSubsetToStrips=C:\\Windows\\System32\\d3dx9_38.D3DXConvertMeshSubsetToStrips") 97 | #pragma comment( \ 98 | linker, \ 99 | "/export:D3DXCreateAnimationController=C:\\Windows\\System32\\d3dx9_38.D3DXCreateAnimationController") 100 | #pragma comment( \ 101 | linker, \ 102 | "/export:D3DXCreateBox=C:\\Windows\\System32\\d3dx9_38.D3DXCreateBox") 103 | #pragma comment( \ 104 | linker, \ 105 | "/export:D3DXCreateBuffer=C:\\Windows\\System32\\d3dx9_38.D3DXCreateBuffer") 106 | #pragma comment( \ 107 | linker, \ 108 | "/export:D3DXCreateCompressedAnimationSet=C:\\Windows\\System32\\d3dx9_38.D3DXCreateCompressedAnimationSet") 109 | #pragma comment( \ 110 | linker, \ 111 | "/export:D3DXCreateCubeTexture=C:\\Windows\\System32\\d3dx9_38.D3DXCreateCubeTexture") 112 | #pragma comment( \ 113 | linker, \ 114 | "/export:D3DXCreateCubeTextureFromFileA=C:\\Windows\\System32\\d3dx9_38.D3DXCreateCubeTextureFromFileA") 115 | #pragma comment( \ 116 | linker, \ 117 | "/export:D3DXCreateCubeTextureFromFileExA=C:\\Windows\\System32\\d3dx9_38.D3DXCreateCubeTextureFromFileExA") 118 | #pragma comment( \ 119 | linker, \ 120 | "/export:D3DXCreateCubeTextureFromFileExW=C:\\Windows\\System32\\d3dx9_38.D3DXCreateCubeTextureFromFileExW") 121 | #pragma comment( \ 122 | linker, \ 123 | "/export:D3DXCreateCubeTextureFromFileInMemory=C:\\Windows\\System32\\d3dx9_38.D3DXCreateCubeTextureFromFileInMemory") 124 | #pragma comment( \ 125 | linker, \ 126 | "/export:D3DXCreateCubeTextureFromFileInMemoryEx=C:\\Windows\\System32\\d3dx9_38.D3DXCreateCubeTextureFromFileInMemoryEx") 127 | #pragma comment( \ 128 | linker, \ 129 | "/export:D3DXCreateCubeTextureFromFileW=C:\\Windows\\System32\\d3dx9_38.D3DXCreateCubeTextureFromFileW") 130 | #pragma comment( \ 131 | linker, \ 132 | "/export:D3DXCreateCubeTextureFromResourceA=C:\\Windows\\System32\\d3dx9_38.D3DXCreateCubeTextureFromResourceA") 133 | #pragma comment( \ 134 | linker, \ 135 | "/export:D3DXCreateCubeTextureFromResourceExA=C:\\Windows\\System32\\d3dx9_38.D3DXCreateCubeTextureFromResourceExA") 136 | #pragma comment( \ 137 | linker, \ 138 | "/export:D3DXCreateCubeTextureFromResourceExW=C:\\Windows\\System32\\d3dx9_38.D3DXCreateCubeTextureFromResourceExW") 139 | #pragma comment( \ 140 | linker, \ 141 | "/export:D3DXCreateCubeTextureFromResourceW=C:\\Windows\\System32\\d3dx9_38.D3DXCreateCubeTextureFromResourceW") 142 | #pragma comment( \ 143 | linker, \ 144 | "/export:D3DXCreateCylinder=C:\\Windows\\System32\\d3dx9_38.D3DXCreateCylinder") 145 | #pragma comment( \ 146 | linker, \ 147 | "/export:D3DXCreateEffect=C:\\Windows\\System32\\d3dx9_38.D3DXCreateEffect") 148 | #pragma comment( \ 149 | linker, \ 150 | "/export:D3DXCreateEffectCompiler=C:\\Windows\\System32\\d3dx9_38.D3DXCreateEffectCompiler") 151 | #pragma comment( \ 152 | linker, \ 153 | "/export:D3DXCreateEffectCompilerFromFileA=C:\\Windows\\System32\\d3dx9_38.D3DXCreateEffectCompilerFromFileA") 154 | #pragma comment( \ 155 | linker, \ 156 | "/export:D3DXCreateEffectCompilerFromFileW=C:\\Windows\\System32\\d3dx9_38.D3DXCreateEffectCompilerFromFileW") 157 | #pragma comment( \ 158 | linker, \ 159 | "/export:D3DXCreateEffectCompilerFromResourceA=C:\\Windows\\System32\\d3dx9_38.D3DXCreateEffectCompilerFromResourceA") 160 | #pragma comment( \ 161 | linker, \ 162 | "/export:D3DXCreateEffectCompilerFromResourceW=C:\\Windows\\System32\\d3dx9_38.D3DXCreateEffectCompilerFromResourceW") 163 | #pragma comment( \ 164 | linker, \ 165 | "/export:D3DXCreateEffectEx=C:\\Windows\\System32\\d3dx9_38.D3DXCreateEffectEx") 166 | #pragma comment( \ 167 | linker, \ 168 | "/export:D3DXCreateEffectFromFileA=C:\\Windows\\System32\\d3dx9_38.D3DXCreateEffectFromFileA") 169 | #pragma comment( \ 170 | linker, \ 171 | "/export:D3DXCreateEffectFromFileExA=C:\\Windows\\System32\\d3dx9_38.D3DXCreateEffectFromFileExA") 172 | #pragma comment( \ 173 | linker, \ 174 | "/export:D3DXCreateEffectFromFileExW=C:\\Windows\\System32\\d3dx9_38.D3DXCreateEffectFromFileExW") 175 | #pragma comment( \ 176 | linker, \ 177 | "/export:D3DXCreateEffectFromFileW=C:\\Windows\\System32\\d3dx9_38.D3DXCreateEffectFromFileW") 178 | #pragma comment( \ 179 | linker, \ 180 | "/export:D3DXCreateEffectFromResourceA=C:\\Windows\\System32\\d3dx9_38.D3DXCreateEffectFromResourceA") 181 | #pragma comment( \ 182 | linker, \ 183 | "/export:D3DXCreateEffectFromResourceExA=C:\\Windows\\System32\\d3dx9_38.D3DXCreateEffectFromResourceExA") 184 | #pragma comment( \ 185 | linker, \ 186 | "/export:D3DXCreateEffectFromResourceExW=C:\\Windows\\System32\\d3dx9_38.D3DXCreateEffectFromResourceExW") 187 | #pragma comment( \ 188 | linker, \ 189 | "/export:D3DXCreateEffectFromResourceW=C:\\Windows\\System32\\d3dx9_38.D3DXCreateEffectFromResourceW") 190 | #pragma comment( \ 191 | linker, \ 192 | "/export:D3DXCreateEffectPool=C:\\Windows\\System32\\d3dx9_38.D3DXCreateEffectPool") 193 | #pragma comment( \ 194 | linker, \ 195 | "/export:D3DXCreateFontA=C:\\Windows\\System32\\d3dx9_38.D3DXCreateFontA") 196 | #pragma comment( \ 197 | linker, \ 198 | "/export:D3DXCreateFontIndirectA=C:\\Windows\\System32\\d3dx9_38.D3DXCreateFontIndirectA") 199 | #pragma comment( \ 200 | linker, \ 201 | "/export:D3DXCreateFontIndirectW=C:\\Windows\\System32\\d3dx9_38.D3DXCreateFontIndirectW") 202 | #pragma comment( \ 203 | linker, \ 204 | "/export:D3DXCreateFontW=C:\\Windows\\System32\\d3dx9_38.D3DXCreateFontW") 205 | #pragma comment( \ 206 | linker, \ 207 | "/export:D3DXCreateFragmentLinker=C:\\Windows\\System32\\d3dx9_38.D3DXCreateFragmentLinker") 208 | #pragma comment( \ 209 | linker, \ 210 | "/export:D3DXCreateFragmentLinkerEx=C:\\Windows\\System32\\d3dx9_38.D3DXCreateFragmentLinkerEx") 211 | #pragma comment( \ 212 | linker, \ 213 | "/export:D3DXCreateKeyframedAnimationSet=C:\\Windows\\System32\\d3dx9_38.D3DXCreateKeyframedAnimationSet") 214 | #pragma comment( \ 215 | linker, \ 216 | "/export:D3DXCreateLine=C:\\Windows\\System32\\d3dx9_38.D3DXCreateLine") 217 | #pragma comment( \ 218 | linker, \ 219 | "/export:D3DXCreateMatrixStack=C:\\Windows\\System32\\d3dx9_38.D3DXCreateMatrixStack") 220 | #pragma comment( \ 221 | linker, \ 222 | "/export:D3DXCreateMesh=C:\\Windows\\System32\\d3dx9_38.D3DXCreateMesh") 223 | #pragma comment( \ 224 | linker, \ 225 | "/export:D3DXCreateMeshFVF=C:\\Windows\\System32\\d3dx9_38.D3DXCreateMeshFVF") 226 | #pragma comment( \ 227 | linker, \ 228 | "/export:D3DXCreateNPatchMesh=C:\\Windows\\System32\\d3dx9_38.D3DXCreateNPatchMesh") 229 | #pragma comment( \ 230 | linker, \ 231 | "/export:D3DXCreatePatchMesh=C:\\Windows\\System32\\d3dx9_38.D3DXCreatePatchMesh") 232 | #pragma comment( \ 233 | linker, \ 234 | "/export:D3DXCreatePMeshFromStream=C:\\Windows\\System32\\d3dx9_38.D3DXCreatePMeshFromStream") 235 | #pragma comment( \ 236 | linker, \ 237 | "/export:D3DXCreatePolygon=C:\\Windows\\System32\\d3dx9_38.D3DXCreatePolygon") 238 | #pragma comment( \ 239 | linker, \ 240 | "/export:D3DXCreatePRTBuffer=C:\\Windows\\System32\\d3dx9_38.D3DXCreatePRTBuffer") 241 | #pragma comment( \ 242 | linker, \ 243 | "/export:D3DXCreatePRTBufferTex=C:\\Windows\\System32\\d3dx9_38.D3DXCreatePRTBufferTex") 244 | #pragma comment( \ 245 | linker, \ 246 | "/export:D3DXCreatePRTCompBuffer=C:\\Windows\\System32\\d3dx9_38.D3DXCreatePRTCompBuffer") 247 | #pragma comment( \ 248 | linker, \ 249 | "/export:D3DXCreatePRTEngine=C:\\Windows\\System32\\d3dx9_38.D3DXCreatePRTEngine") 250 | #pragma comment( \ 251 | linker, \ 252 | "/export:D3DXCreateRenderToEnvMap=C:\\Windows\\System32\\d3dx9_38.D3DXCreateRenderToEnvMap") 253 | #pragma comment( \ 254 | linker, \ 255 | "/export:D3DXCreateRenderToSurface=C:\\Windows\\System32\\d3dx9_38.D3DXCreateRenderToSurface") 256 | #pragma comment( \ 257 | linker, \ 258 | "/export:D3DXCreateSkinInfo=C:\\Windows\\System32\\d3dx9_38.D3DXCreateSkinInfo") 259 | #pragma comment( \ 260 | linker, \ 261 | "/export:D3DXCreateSkinInfoFromBlendedMesh=C:\\Windows\\System32\\d3dx9_38.D3DXCreateSkinInfoFromBlendedMesh") 262 | #pragma comment( \ 263 | linker, \ 264 | "/export:D3DXCreateSkinInfoFVF=C:\\Windows\\System32\\d3dx9_38.D3DXCreateSkinInfoFVF") 265 | #pragma comment( \ 266 | linker, \ 267 | "/export:D3DXCreateSphere=C:\\Windows\\System32\\d3dx9_38.D3DXCreateSphere") 268 | #pragma comment( \ 269 | linker, \ 270 | "/export:D3DXCreateSPMesh=C:\\Windows\\System32\\d3dx9_38.D3DXCreateSPMesh") 271 | #pragma comment( \ 272 | linker, \ 273 | "/export:D3DXCreateSprite=C:\\Windows\\System32\\d3dx9_38.D3DXCreateSprite") 274 | #pragma comment( \ 275 | linker, \ 276 | "/export:D3DXCreateTeapot=C:\\Windows\\System32\\d3dx9_38.D3DXCreateTeapot") 277 | #pragma comment( \ 278 | linker, \ 279 | "/export:D3DXCreateTextA=C:\\Windows\\System32\\d3dx9_38.D3DXCreateTextA") 280 | #pragma comment( \ 281 | linker, \ 282 | "/export:D3DXCreateTexture=C:\\Windows\\System32\\d3dx9_38.D3DXCreateTexture") 283 | #pragma comment( \ 284 | linker, \ 285 | "/export:D3DXCreateTextureFromFileA=C:\\Windows\\System32\\d3dx9_38.D3DXCreateTextureFromFileA") 286 | #pragma comment( \ 287 | linker, \ 288 | "/export:D3DXCreateTextureFromFileExA=C:\\Windows\\System32\\d3dx9_38.D3DXCreateTextureFromFileExA") 289 | #pragma comment( \ 290 | linker, \ 291 | "/export:D3DXCreateTextureFromFileExW=C:\\Windows\\System32\\d3dx9_38.D3DXCreateTextureFromFileExW") 292 | #pragma comment( \ 293 | linker, \ 294 | "/export:D3DXCreateTextureFromFileInMemory=C:\\Windows\\System32\\d3dx9_38.D3DXCreateTextureFromFileInMemory") 295 | #pragma comment( \ 296 | linker, \ 297 | "/export:D3DXCreateTextureFromFileInMemoryEx=C:\\Windows\\System32\\d3dx9_38.D3DXCreateTextureFromFileInMemoryEx") 298 | #pragma comment( \ 299 | linker, \ 300 | "/export:D3DXCreateTextureFromFileW=C:\\Windows\\System32\\d3dx9_38.D3DXCreateTextureFromFileW") 301 | #pragma comment( \ 302 | linker, \ 303 | "/export:D3DXCreateTextureFromResourceA=C:\\Windows\\System32\\d3dx9_38.D3DXCreateTextureFromResourceA") 304 | #pragma comment( \ 305 | linker, \ 306 | "/export:D3DXCreateTextureFromResourceExA=C:\\Windows\\System32\\d3dx9_38.D3DXCreateTextureFromResourceExA") 307 | #pragma comment( \ 308 | linker, \ 309 | "/export:D3DXCreateTextureFromResourceExW=C:\\Windows\\System32\\d3dx9_38.D3DXCreateTextureFromResourceExW") 310 | #pragma comment( \ 311 | linker, \ 312 | "/export:D3DXCreateTextureFromResourceW=C:\\Windows\\System32\\d3dx9_38.D3DXCreateTextureFromResourceW") 313 | #pragma comment( \ 314 | linker, \ 315 | "/export:D3DXCreateTextureGutterHelper=C:\\Windows\\System32\\d3dx9_38.D3DXCreateTextureGutterHelper") 316 | #pragma comment( \ 317 | linker, \ 318 | "/export:D3DXCreateTextureShader=C:\\Windows\\System32\\d3dx9_38.D3DXCreateTextureShader") 319 | #pragma comment( \ 320 | linker, \ 321 | "/export:D3DXCreateTextW=C:\\Windows\\System32\\d3dx9_38.D3DXCreateTextW") 322 | #pragma comment( \ 323 | linker, \ 324 | "/export:D3DXCreateTorus=C:\\Windows\\System32\\d3dx9_38.D3DXCreateTorus") 325 | #pragma comment( \ 326 | linker, \ 327 | "/export:D3DXCreateVolumeTexture=C:\\Windows\\System32\\d3dx9_38.D3DXCreateVolumeTexture") 328 | #pragma comment( \ 329 | linker, \ 330 | "/export:D3DXCreateVolumeTextureFromFileA=C:\\Windows\\System32\\d3dx9_38.D3DXCreateVolumeTextureFromFileA") 331 | #pragma comment( \ 332 | linker, \ 333 | "/export:D3DXCreateVolumeTextureFromFileExA=C:\\Windows\\System32\\d3dx9_38.D3DXCreateVolumeTextureFromFileExA") 334 | #pragma comment( \ 335 | linker, \ 336 | "/export:D3DXCreateVolumeTextureFromFileExW=C:\\Windows\\System32\\d3dx9_38.D3DXCreateVolumeTextureFromFileExW") 337 | #pragma comment( \ 338 | linker, \ 339 | "/export:D3DXCreateVolumeTextureFromFileInMemory=C:\\Windows\\System32\\d3dx9_38.D3DXCreateVolumeTextureFromFileInMemory") 340 | #pragma comment( \ 341 | linker, \ 342 | "/export:D3DXCreateVolumeTextureFromFileInMemoryEx=C:\\Windows\\System32\\d3dx9_38.D3DXCreateVolumeTextureFromFileInMemoryEx") 343 | #pragma comment( \ 344 | linker, \ 345 | "/export:D3DXCreateVolumeTextureFromFileW=C:\\Windows\\System32\\d3dx9_38.D3DXCreateVolumeTextureFromFileW") 346 | #pragma comment( \ 347 | linker, \ 348 | "/export:D3DXCreateVolumeTextureFromResourceA=C:\\Windows\\System32\\d3dx9_38.D3DXCreateVolumeTextureFromResourceA") 349 | #pragma comment( \ 350 | linker, \ 351 | "/export:D3DXCreateVolumeTextureFromResourceExA=C:\\Windows\\System32\\d3dx9_38.D3DXCreateVolumeTextureFromResourceExA") 352 | #pragma comment( \ 353 | linker, \ 354 | "/export:D3DXCreateVolumeTextureFromResourceExW=C:\\Windows\\System32\\d3dx9_38.D3DXCreateVolumeTextureFromResourceExW") 355 | #pragma comment( \ 356 | linker, \ 357 | "/export:D3DXCreateVolumeTextureFromResourceW=C:\\Windows\\System32\\d3dx9_38.D3DXCreateVolumeTextureFromResourceW") 358 | #pragma comment( \ 359 | linker, \ 360 | "/export:D3DXDebugMute=C:\\Windows\\System32\\d3dx9_38.D3DXDebugMute") 361 | #pragma comment( \ 362 | linker, \ 363 | "/export:D3DXDeclaratorFromFVF=C:\\Windows\\System32\\d3dx9_38.D3DXDeclaratorFromFVF") 364 | #pragma comment( \ 365 | linker, \ 366 | "/export:D3DXDisassembleEffect=C:\\Windows\\System32\\d3dx9_38.D3DXDisassembleEffect") 367 | #pragma comment( \ 368 | linker, \ 369 | "/export:D3DXDisassembleShader=C:\\Windows\\System32\\d3dx9_38.D3DXDisassembleShader") 370 | #pragma comment( \ 371 | linker, \ 372 | "/export:D3DXFileCreate=C:\\Windows\\System32\\d3dx9_38.D3DXFileCreate") 373 | #pragma comment( \ 374 | linker, \ 375 | "/export:D3DXFillCubeTexture=C:\\Windows\\System32\\d3dx9_38.D3DXFillCubeTexture") 376 | #pragma comment( \ 377 | linker, \ 378 | "/export:D3DXFillCubeTextureTX=C:\\Windows\\System32\\d3dx9_38.D3DXFillCubeTextureTX") 379 | #pragma comment( \ 380 | linker, \ 381 | "/export:D3DXFillTexture=C:\\Windows\\System32\\d3dx9_38.D3DXFillTexture") 382 | #pragma comment( \ 383 | linker, \ 384 | "/export:D3DXFillTextureTX=C:\\Windows\\System32\\d3dx9_38.D3DXFillTextureTX") 385 | #pragma comment( \ 386 | linker, \ 387 | "/export:D3DXFillVolumeTexture=C:\\Windows\\System32\\d3dx9_38.D3DXFillVolumeTexture") 388 | #pragma comment( \ 389 | linker, \ 390 | "/export:D3DXFillVolumeTextureTX=C:\\Windows\\System32\\d3dx9_38.D3DXFillVolumeTextureTX") 391 | #pragma comment( \ 392 | linker, \ 393 | "/export:D3DXFilterTexture=C:\\Windows\\System32\\d3dx9_38.D3DXFilterTexture") 394 | #pragma comment( \ 395 | linker, \ 396 | "/export:D3DXFindShaderComment=C:\\Windows\\System32\\d3dx9_38.D3DXFindShaderComment") 397 | #pragma comment( \ 398 | linker, \ 399 | "/export:D3DXFloat16To32Array=C:\\Windows\\System32\\d3dx9_38.D3DXFloat16To32Array") 400 | #pragma comment( \ 401 | linker, \ 402 | "/export:D3DXFloat32To16Array=C:\\Windows\\System32\\d3dx9_38.D3DXFloat32To16Array") 403 | #pragma comment( \ 404 | linker, \ 405 | "/export:D3DXFrameAppendChild=C:\\Windows\\System32\\d3dx9_38.D3DXFrameAppendChild") 406 | #pragma comment( \ 407 | linker, \ 408 | "/export:D3DXFrameCalculateBoundingSphere=C:\\Windows\\System32\\d3dx9_38.D3DXFrameCalculateBoundingSphere") 409 | #pragma comment( \ 410 | linker, \ 411 | "/export:D3DXFrameDestroy=C:\\Windows\\System32\\d3dx9_38.D3DXFrameDestroy") 412 | #pragma comment( \ 413 | linker, \ 414 | "/export:D3DXFrameFind=C:\\Windows\\System32\\d3dx9_38.D3DXFrameFind") 415 | #pragma comment( \ 416 | linker, \ 417 | "/export:D3DXFrameNumNamedMatrices=C:\\Windows\\System32\\d3dx9_38.D3DXFrameNumNamedMatrices") 418 | #pragma comment( \ 419 | linker, \ 420 | "/export:D3DXFrameRegisterNamedMatrices=C:\\Windows\\System32\\d3dx9_38.D3DXFrameRegisterNamedMatrices") 421 | #pragma comment( \ 422 | linker, \ 423 | "/export:D3DXFresnelTerm=C:\\Windows\\System32\\d3dx9_38.D3DXFresnelTerm") 424 | #pragma comment( \ 425 | linker, \ 426 | "/export:D3DXFVFFromDeclarator=C:\\Windows\\System32\\d3dx9_38.D3DXFVFFromDeclarator") 427 | #pragma comment( \ 428 | linker, \ 429 | "/export:D3DXGatherFragments=C:\\Windows\\System32\\d3dx9_38.D3DXGatherFragments") 430 | #pragma comment( \ 431 | linker, \ 432 | "/export:D3DXGatherFragmentsFromFileA=C:\\Windows\\System32\\d3dx9_38.D3DXGatherFragmentsFromFileA") 433 | #pragma comment( \ 434 | linker, \ 435 | "/export:D3DXGatherFragmentsFromFileW=C:\\Windows\\System32\\d3dx9_38.D3DXGatherFragmentsFromFileW") 436 | #pragma comment( \ 437 | linker, \ 438 | "/export:D3DXGatherFragmentsFromResourceA=C:\\Windows\\System32\\d3dx9_38.D3DXGatherFragmentsFromResourceA") 439 | #pragma comment( \ 440 | linker, \ 441 | "/export:D3DXGatherFragmentsFromResourceW=C:\\Windows\\System32\\d3dx9_38.D3DXGatherFragmentsFromResourceW") 442 | #pragma comment( \ 443 | linker, \ 444 | "/export:D3DXGenerateOutputDecl=C:\\Windows\\System32\\d3dx9_38.D3DXGenerateOutputDecl") 445 | #pragma comment( \ 446 | linker, \ 447 | "/export:D3DXGeneratePMesh=C:\\Windows\\System32\\d3dx9_38.D3DXGeneratePMesh") 448 | #pragma comment( \ 449 | linker, \ 450 | "/export:D3DXGetDeclLength=C:\\Windows\\System32\\d3dx9_38.D3DXGetDeclLength") 451 | #pragma comment( \ 452 | linker, \ 453 | "/export:D3DXGetDeclVertexSize=C:\\Windows\\System32\\d3dx9_38.D3DXGetDeclVertexSize") 454 | #pragma comment( \ 455 | linker, \ 456 | "/export:D3DXGetDriverLevel=C:\\Windows\\System32\\d3dx9_38.D3DXGetDriverLevel") 457 | #pragma comment( \ 458 | linker, \ 459 | "/export:D3DXGetFVFVertexSize=C:\\Windows\\System32\\d3dx9_38.D3DXGetFVFVertexSize") 460 | #pragma comment( \ 461 | linker, \ 462 | "/export:D3DXGetImageInfoFromFileA=C:\\Windows\\System32\\d3dx9_38.D3DXGetImageInfoFromFileA") 463 | #pragma comment( \ 464 | linker, \ 465 | "/export:D3DXGetImageInfoFromFileInMemory=C:\\Windows\\System32\\d3dx9_38.D3DXGetImageInfoFromFileInMemory") 466 | #pragma comment( \ 467 | linker, \ 468 | "/export:D3DXGetImageInfoFromFileW=C:\\Windows\\System32\\d3dx9_38.D3DXGetImageInfoFromFileW") 469 | #pragma comment( \ 470 | linker, \ 471 | "/export:D3DXGetImageInfoFromResourceA=C:\\Windows\\System32\\d3dx9_38.D3DXGetImageInfoFromResourceA") 472 | #pragma comment( \ 473 | linker, \ 474 | "/export:D3DXGetImageInfoFromResourceW=C:\\Windows\\System32\\d3dx9_38.D3DXGetImageInfoFromResourceW") 475 | #pragma comment( \ 476 | linker, \ 477 | "/export:D3DXGetPixelShaderProfile=C:\\Windows\\System32\\d3dx9_38.D3DXGetPixelShaderProfile") 478 | #pragma comment( \ 479 | linker, \ 480 | "/export:D3DXGetShaderConstantTable=C:\\Windows\\System32\\d3dx9_38.D3DXGetShaderConstantTable") 481 | #pragma comment( \ 482 | linker, \ 483 | "/export:D3DXGetShaderConstantTableEx=C:\\Windows\\System32\\d3dx9_38.D3DXGetShaderConstantTableEx") 484 | #pragma comment( \ 485 | linker, \ 486 | "/export:D3DXGetShaderInputSemantics=C:\\Windows\\System32\\d3dx9_38.D3DXGetShaderInputSemantics") 487 | #pragma comment( \ 488 | linker, \ 489 | "/export:D3DXGetShaderOutputSemantics=C:\\Windows\\System32\\d3dx9_38.D3DXGetShaderOutputSemantics") 490 | #pragma comment( \ 491 | linker, \ 492 | "/export:D3DXGetShaderSamplers=C:\\Windows\\System32\\d3dx9_38.D3DXGetShaderSamplers") 493 | #pragma comment( \ 494 | linker, \ 495 | "/export:D3DXGetShaderSize=C:\\Windows\\System32\\d3dx9_38.D3DXGetShaderSize") 496 | #pragma comment( \ 497 | linker, \ 498 | "/export:D3DXGetShaderVersion=C:\\Windows\\System32\\d3dx9_38.D3DXGetShaderVersion") 499 | #pragma comment( \ 500 | linker, \ 501 | "/export:D3DXGetVertexShaderProfile=C:\\Windows\\System32\\d3dx9_38.D3DXGetVertexShaderProfile") 502 | #pragma comment( \ 503 | linker, \ 504 | "/export:D3DXIntersect=C:\\Windows\\System32\\d3dx9_38.D3DXIntersect") 505 | #pragma comment( \ 506 | linker, \ 507 | "/export:D3DXIntersectSubset=C:\\Windows\\System32\\d3dx9_38.D3DXIntersectSubset") 508 | #pragma comment( \ 509 | linker, \ 510 | "/export:D3DXIntersectTri=C:\\Windows\\System32\\d3dx9_38.D3DXIntersectTri") 511 | #pragma comment( \ 512 | linker, \ 513 | "/export:D3DXLoadMeshFromXA=C:\\Windows\\System32\\d3dx9_38.D3DXLoadMeshFromXA") 514 | #pragma comment( \ 515 | linker, \ 516 | "/export:D3DXLoadMeshFromXInMemory=C:\\Windows\\System32\\d3dx9_38.D3DXLoadMeshFromXInMemory") 517 | #pragma comment( \ 518 | linker, \ 519 | "/export:D3DXLoadMeshFromXof=C:\\Windows\\System32\\d3dx9_38.D3DXLoadMeshFromXof") 520 | #pragma comment( \ 521 | linker, \ 522 | "/export:D3DXLoadMeshFromXResource=C:\\Windows\\System32\\d3dx9_38.D3DXLoadMeshFromXResource") 523 | #pragma comment( \ 524 | linker, \ 525 | "/export:D3DXLoadMeshFromXW=C:\\Windows\\System32\\d3dx9_38.D3DXLoadMeshFromXW") 526 | #pragma comment( \ 527 | linker, \ 528 | "/export:D3DXLoadMeshHierarchyFromXA=C:\\Windows\\System32\\d3dx9_38.D3DXLoadMeshHierarchyFromXA") 529 | #pragma comment( \ 530 | linker, \ 531 | "/export:D3DXLoadMeshHierarchyFromXInMemory=C:\\Windows\\System32\\d3dx9_38.D3DXLoadMeshHierarchyFromXInMemory") 532 | #pragma comment( \ 533 | linker, \ 534 | "/export:D3DXLoadMeshHierarchyFromXW=C:\\Windows\\System32\\d3dx9_38.D3DXLoadMeshHierarchyFromXW") 535 | #pragma comment( \ 536 | linker, \ 537 | "/export:D3DXLoadPatchMeshFromXof=C:\\Windows\\System32\\d3dx9_38.D3DXLoadPatchMeshFromXof") 538 | #pragma comment( \ 539 | linker, \ 540 | "/export:D3DXLoadPRTBufferFromFileA=C:\\Windows\\System32\\d3dx9_38.D3DXLoadPRTBufferFromFileA") 541 | #pragma comment( \ 542 | linker, \ 543 | "/export:D3DXLoadPRTBufferFromFileW=C:\\Windows\\System32\\d3dx9_38.D3DXLoadPRTBufferFromFileW") 544 | #pragma comment( \ 545 | linker, \ 546 | "/export:D3DXLoadPRTCompBufferFromFileA=C:\\Windows\\System32\\d3dx9_38.D3DXLoadPRTCompBufferFromFileA") 547 | #pragma comment( \ 548 | linker, \ 549 | "/export:D3DXLoadPRTCompBufferFromFileW=C:\\Windows\\System32\\d3dx9_38.D3DXLoadPRTCompBufferFromFileW") 550 | #pragma comment( \ 551 | linker, \ 552 | "/export:D3DXLoadSkinMeshFromXof=C:\\Windows\\System32\\d3dx9_38.D3DXLoadSkinMeshFromXof") 553 | #pragma comment( \ 554 | linker, \ 555 | "/export:D3DXLoadSurfaceFromFileA=C:\\Windows\\System32\\d3dx9_38.D3DXLoadSurfaceFromFileA") 556 | #pragma comment( \ 557 | linker, \ 558 | "/export:D3DXLoadSurfaceFromFileInMemory=C:\\Windows\\System32\\d3dx9_38.D3DXLoadSurfaceFromFileInMemory") 559 | #pragma comment( \ 560 | linker, \ 561 | "/export:D3DXLoadSurfaceFromFileW=C:\\Windows\\System32\\d3dx9_38.D3DXLoadSurfaceFromFileW") 562 | #pragma comment( \ 563 | linker, \ 564 | "/export:D3DXLoadSurfaceFromMemory=C:\\Windows\\System32\\d3dx9_38.D3DXLoadSurfaceFromMemory") 565 | #pragma comment( \ 566 | linker, \ 567 | "/export:D3DXLoadSurfaceFromResourceA=C:\\Windows\\System32\\d3dx9_38.D3DXLoadSurfaceFromResourceA") 568 | #pragma comment( \ 569 | linker, \ 570 | "/export:D3DXLoadSurfaceFromResourceW=C:\\Windows\\System32\\d3dx9_38.D3DXLoadSurfaceFromResourceW") 571 | #pragma comment( \ 572 | linker, \ 573 | "/export:D3DXLoadSurfaceFromSurface=C:\\Windows\\System32\\d3dx9_38.D3DXLoadSurfaceFromSurface") 574 | #pragma comment( \ 575 | linker, \ 576 | "/export:D3DXLoadVolumeFromFileA=C:\\Windows\\System32\\d3dx9_38.D3DXLoadVolumeFromFileA") 577 | #pragma comment( \ 578 | linker, \ 579 | "/export:D3DXLoadVolumeFromFileInMemory=C:\\Windows\\System32\\d3dx9_38.D3DXLoadVolumeFromFileInMemory") 580 | #pragma comment( \ 581 | linker, \ 582 | "/export:D3DXLoadVolumeFromFileW=C:\\Windows\\System32\\d3dx9_38.D3DXLoadVolumeFromFileW") 583 | #pragma comment( \ 584 | linker, \ 585 | "/export:D3DXLoadVolumeFromMemory=C:\\Windows\\System32\\d3dx9_38.D3DXLoadVolumeFromMemory") 586 | #pragma comment( \ 587 | linker, \ 588 | "/export:D3DXLoadVolumeFromResourceA=C:\\Windows\\System32\\d3dx9_38.D3DXLoadVolumeFromResourceA") 589 | #pragma comment( \ 590 | linker, \ 591 | "/export:D3DXLoadVolumeFromResourceW=C:\\Windows\\System32\\d3dx9_38.D3DXLoadVolumeFromResourceW") 592 | #pragma comment( \ 593 | linker, \ 594 | "/export:D3DXLoadVolumeFromVolume=C:\\Windows\\System32\\d3dx9_38.D3DXLoadVolumeFromVolume") 595 | #pragma comment( \ 596 | linker, \ 597 | "/export:D3DXMatrixAffineTransformation=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixAffineTransformation") 598 | #pragma comment( \ 599 | linker, \ 600 | "/export:D3DXMatrixAffineTransformation2D=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixAffineTransformation2D") 601 | #pragma comment( \ 602 | linker, \ 603 | "/export:D3DXMatrixDecompose=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixDecompose") 604 | #pragma comment( \ 605 | linker, \ 606 | "/export:D3DXMatrixDeterminant=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixDeterminant") 607 | #pragma comment( \ 608 | linker, \ 609 | "/export:D3DXMatrixInverse=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixInverse") 610 | #pragma comment( \ 611 | linker, \ 612 | "/export:D3DXMatrixLookAtLH=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixLookAtLH") 613 | #pragma comment( \ 614 | linker, \ 615 | "/export:D3DXMatrixLookAtRH=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixLookAtRH") 616 | #pragma comment( \ 617 | linker, \ 618 | "/export:D3DXMatrixMultiply=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixMultiply") 619 | #pragma comment( \ 620 | linker, \ 621 | "/export:D3DXMatrixMultiplyTranspose=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixMultiplyTranspose") 622 | #pragma comment( \ 623 | linker, \ 624 | "/export:D3DXMatrixOrthoLH=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixOrthoLH") 625 | #pragma comment( \ 626 | linker, \ 627 | "/export:D3DXMatrixOrthoOffCenterLH=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixOrthoOffCenterLH") 628 | #pragma comment( \ 629 | linker, \ 630 | "/export:D3DXMatrixOrthoOffCenterRH=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixOrthoOffCenterRH") 631 | #pragma comment( \ 632 | linker, \ 633 | "/export:D3DXMatrixOrthoRH=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixOrthoRH") 634 | #pragma comment( \ 635 | linker, \ 636 | "/export:D3DXMatrixPerspectiveFovLH=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixPerspectiveFovLH") 637 | #pragma comment( \ 638 | linker, \ 639 | "/export:D3DXMatrixPerspectiveFovRH=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixPerspectiveFovRH") 640 | #pragma comment( \ 641 | linker, \ 642 | "/export:D3DXMatrixPerspectiveLH=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixPerspectiveLH") 643 | #pragma comment( \ 644 | linker, \ 645 | "/export:D3DXMatrixPerspectiveOffCenterLH=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixPerspectiveOffCenterLH") 646 | #pragma comment( \ 647 | linker, \ 648 | "/export:D3DXMatrixPerspectiveOffCenterRH=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixPerspectiveOffCenterRH") 649 | #pragma comment( \ 650 | linker, \ 651 | "/export:D3DXMatrixPerspectiveRH=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixPerspectiveRH") 652 | #pragma comment( \ 653 | linker, \ 654 | "/export:D3DXMatrixReflect=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixReflect") 655 | #pragma comment( \ 656 | linker, \ 657 | "/export:D3DXMatrixRotationAxis=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixRotationAxis") 658 | #pragma comment( \ 659 | linker, \ 660 | "/export:D3DXMatrixRotationQuaternion=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixRotationQuaternion") 661 | #pragma comment( \ 662 | linker, \ 663 | "/export:D3DXMatrixRotationX=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixRotationX") 664 | #pragma comment( \ 665 | linker, \ 666 | "/export:D3DXMatrixRotationY=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixRotationY") 667 | #pragma comment( \ 668 | linker, \ 669 | "/export:D3DXMatrixRotationYawPitchRoll=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixRotationYawPitchRoll") 670 | #pragma comment( \ 671 | linker, \ 672 | "/export:D3DXMatrixRotationZ=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixRotationZ") 673 | #pragma comment( \ 674 | linker, \ 675 | "/export:D3DXMatrixScaling=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixScaling") 676 | #pragma comment( \ 677 | linker, \ 678 | "/export:D3DXMatrixShadow=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixShadow") 679 | #pragma comment( \ 680 | linker, \ 681 | "/export:D3DXMatrixTransformation=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixTransformation") 682 | #pragma comment( \ 683 | linker, \ 684 | "/export:D3DXMatrixTransformation2D=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixTransformation2D") 685 | #pragma comment( \ 686 | linker, \ 687 | "/export:D3DXMatrixTranslation=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixTranslation") 688 | #pragma comment( \ 689 | linker, \ 690 | "/export:D3DXMatrixTranspose=C:\\Windows\\System32\\d3dx9_38.D3DXMatrixTranspose") 691 | #pragma comment( \ 692 | linker, \ 693 | "/export:D3DXOptimizeFaces=C:\\Windows\\System32\\d3dx9_38.D3DXOptimizeFaces") 694 | #pragma comment( \ 695 | linker, \ 696 | "/export:D3DXOptimizeVertices=C:\\Windows\\System32\\d3dx9_38.D3DXOptimizeVertices") 697 | #pragma comment( \ 698 | linker, \ 699 | "/export:D3DXPlaneFromPointNormal=C:\\Windows\\System32\\d3dx9_38.D3DXPlaneFromPointNormal") 700 | #pragma comment( \ 701 | linker, \ 702 | "/export:D3DXPlaneFromPoints=C:\\Windows\\System32\\d3dx9_38.D3DXPlaneFromPoints") 703 | #pragma comment( \ 704 | linker, \ 705 | "/export:D3DXPlaneIntersectLine=C:\\Windows\\System32\\d3dx9_38.D3DXPlaneIntersectLine") 706 | #pragma comment( \ 707 | linker, \ 708 | "/export:D3DXPlaneNormalize=C:\\Windows\\System32\\d3dx9_38.D3DXPlaneNormalize") 709 | #pragma comment( \ 710 | linker, \ 711 | "/export:D3DXPlaneTransform=C:\\Windows\\System32\\d3dx9_38.D3DXPlaneTransform") 712 | #pragma comment( \ 713 | linker, \ 714 | "/export:D3DXPlaneTransformArray=C:\\Windows\\System32\\d3dx9_38.D3DXPlaneTransformArray") 715 | #pragma comment( \ 716 | linker, \ 717 | "/export:D3DXPreprocessShader=C:\\Windows\\System32\\d3dx9_38.D3DXPreprocessShader") 718 | #pragma comment( \ 719 | linker, \ 720 | "/export:D3DXPreprocessShaderFromFileA=C:\\Windows\\System32\\d3dx9_38.D3DXPreprocessShaderFromFileA") 721 | #pragma comment( \ 722 | linker, \ 723 | "/export:D3DXPreprocessShaderFromFileW=C:\\Windows\\System32\\d3dx9_38.D3DXPreprocessShaderFromFileW") 724 | #pragma comment( \ 725 | linker, \ 726 | "/export:D3DXPreprocessShaderFromResourceA=C:\\Windows\\System32\\d3dx9_38.D3DXPreprocessShaderFromResourceA") 727 | #pragma comment( \ 728 | linker, \ 729 | "/export:D3DXPreprocessShaderFromResourceW=C:\\Windows\\System32\\d3dx9_38.D3DXPreprocessShaderFromResourceW") 730 | #pragma comment( \ 731 | linker, \ 732 | "/export:D3DXQuaternionBaryCentric=C:\\Windows\\System32\\d3dx9_38.D3DXQuaternionBaryCentric") 733 | #pragma comment( \ 734 | linker, \ 735 | "/export:D3DXQuaternionExp=C:\\Windows\\System32\\d3dx9_38.D3DXQuaternionExp") 736 | #pragma comment( \ 737 | linker, \ 738 | "/export:D3DXQuaternionInverse=C:\\Windows\\System32\\d3dx9_38.D3DXQuaternionInverse") 739 | #pragma comment( \ 740 | linker, \ 741 | "/export:D3DXQuaternionLn=C:\\Windows\\System32\\d3dx9_38.D3DXQuaternionLn") 742 | #pragma comment( \ 743 | linker, \ 744 | "/export:D3DXQuaternionMultiply=C:\\Windows\\System32\\d3dx9_38.D3DXQuaternionMultiply") 745 | #pragma comment( \ 746 | linker, \ 747 | "/export:D3DXQuaternionNormalize=C:\\Windows\\System32\\d3dx9_38.D3DXQuaternionNormalize") 748 | #pragma comment( \ 749 | linker, \ 750 | "/export:D3DXQuaternionRotationAxis=C:\\Windows\\System32\\d3dx9_38.D3DXQuaternionRotationAxis") 751 | #pragma comment( \ 752 | linker, \ 753 | "/export:D3DXQuaternionRotationMatrix=C:\\Windows\\System32\\d3dx9_38.D3DXQuaternionRotationMatrix") 754 | #pragma comment( \ 755 | linker, \ 756 | "/export:D3DXQuaternionRotationYawPitchRoll=C:\\Windows\\System32\\d3dx9_38.D3DXQuaternionRotationYawPitchRoll") 757 | #pragma comment( \ 758 | linker, \ 759 | "/export:D3DXQuaternionSlerp=C:\\Windows\\System32\\d3dx9_38.D3DXQuaternionSlerp") 760 | #pragma comment( \ 761 | linker, \ 762 | "/export:D3DXQuaternionSquad=C:\\Windows\\System32\\d3dx9_38.D3DXQuaternionSquad") 763 | #pragma comment( \ 764 | linker, \ 765 | "/export:D3DXQuaternionSquadSetup=C:\\Windows\\System32\\d3dx9_38.D3DXQuaternionSquadSetup") 766 | #pragma comment( \ 767 | linker, \ 768 | "/export:D3DXQuaternionToAxisAngle=C:\\Windows\\System32\\d3dx9_38.D3DXQuaternionToAxisAngle") 769 | #pragma comment( \ 770 | linker, \ 771 | "/export:D3DXRectPatchSize=C:\\Windows\\System32\\d3dx9_38.D3DXRectPatchSize") 772 | #pragma comment( \ 773 | linker, \ 774 | "/export:D3DXSaveMeshHierarchyToFileA=C:\\Windows\\System32\\d3dx9_38.D3DXSaveMeshHierarchyToFileA") 775 | #pragma comment( \ 776 | linker, \ 777 | "/export:D3DXSaveMeshHierarchyToFileW=C:\\Windows\\System32\\d3dx9_38.D3DXSaveMeshHierarchyToFileW") 778 | #pragma comment( \ 779 | linker, \ 780 | "/export:D3DXSaveMeshToXA=C:\\Windows\\System32\\d3dx9_38.D3DXSaveMeshToXA") 781 | #pragma comment( \ 782 | linker, \ 783 | "/export:D3DXSaveMeshToXW=C:\\Windows\\System32\\d3dx9_38.D3DXSaveMeshToXW") 784 | #pragma comment( \ 785 | linker, \ 786 | "/export:D3DXSavePRTBufferToFileA=C:\\Windows\\System32\\d3dx9_38.D3DXSavePRTBufferToFileA") 787 | #pragma comment( \ 788 | linker, \ 789 | "/export:D3DXSavePRTBufferToFileW=C:\\Windows\\System32\\d3dx9_38.D3DXSavePRTBufferToFileW") 790 | #pragma comment( \ 791 | linker, \ 792 | "/export:D3DXSavePRTCompBufferToFileA=C:\\Windows\\System32\\d3dx9_38.D3DXSavePRTCompBufferToFileA") 793 | #pragma comment( \ 794 | linker, \ 795 | "/export:D3DXSavePRTCompBufferToFileW=C:\\Windows\\System32\\d3dx9_38.D3DXSavePRTCompBufferToFileW") 796 | #pragma comment( \ 797 | linker, \ 798 | "/export:D3DXSaveSurfaceToFileA=C:\\Windows\\System32\\d3dx9_38.D3DXSaveSurfaceToFileA") 799 | #pragma comment( \ 800 | linker, \ 801 | "/export:D3DXSaveSurfaceToFileInMemory=C:\\Windows\\System32\\d3dx9_38.D3DXSaveSurfaceToFileInMemory") 802 | #pragma comment( \ 803 | linker, \ 804 | "/export:D3DXSaveSurfaceToFileW=C:\\Windows\\System32\\d3dx9_38.D3DXSaveSurfaceToFileW") 805 | #pragma comment( \ 806 | linker, \ 807 | "/export:D3DXSaveTextureToFileA=C:\\Windows\\System32\\d3dx9_38.D3DXSaveTextureToFileA") 808 | #pragma comment( \ 809 | linker, \ 810 | "/export:D3DXSaveTextureToFileInMemory=C:\\Windows\\System32\\d3dx9_38.D3DXSaveTextureToFileInMemory") 811 | #pragma comment( \ 812 | linker, \ 813 | "/export:D3DXSaveTextureToFileW=C:\\Windows\\System32\\d3dx9_38.D3DXSaveTextureToFileW") 814 | #pragma comment( \ 815 | linker, \ 816 | "/export:D3DXSaveVolumeToFileA=C:\\Windows\\System32\\d3dx9_38.D3DXSaveVolumeToFileA") 817 | #pragma comment( \ 818 | linker, \ 819 | "/export:D3DXSaveVolumeToFileInMemory=C:\\Windows\\System32\\d3dx9_38.D3DXSaveVolumeToFileInMemory") 820 | #pragma comment( \ 821 | linker, \ 822 | "/export:D3DXSaveVolumeToFileW=C:\\Windows\\System32\\d3dx9_38.D3DXSaveVolumeToFileW") 823 | #pragma comment(linker, \ 824 | "/export:D3DXSHAdd=C:\\Windows\\System32\\d3dx9_38.D3DXSHAdd") 825 | #pragma comment(linker, \ 826 | "/export:D3DXSHDot=C:\\Windows\\System32\\d3dx9_38.D3DXSHDot") 827 | #pragma comment( \ 828 | linker, \ 829 | "/export:D3DXSHEvalConeLight=C:\\Windows\\System32\\d3dx9_38.D3DXSHEvalConeLight") 830 | #pragma comment( \ 831 | linker, \ 832 | "/export:D3DXSHEvalDirection=C:\\Windows\\System32\\d3dx9_38.D3DXSHEvalDirection") 833 | #pragma comment( \ 834 | linker, \ 835 | "/export:D3DXSHEvalDirectionalLight=C:\\Windows\\System32\\d3dx9_38.D3DXSHEvalDirectionalLight") 836 | #pragma comment( \ 837 | linker, \ 838 | "/export:D3DXSHEvalHemisphereLight=C:\\Windows\\System32\\d3dx9_38.D3DXSHEvalHemisphereLight") 839 | #pragma comment( \ 840 | linker, \ 841 | "/export:D3DXSHEvalSphericalLight=C:\\Windows\\System32\\d3dx9_38.D3DXSHEvalSphericalLight") 842 | #pragma comment( \ 843 | linker, \ 844 | "/export:D3DXSHMultiply2=C:\\Windows\\System32\\d3dx9_38.D3DXSHMultiply2") 845 | #pragma comment( \ 846 | linker, \ 847 | "/export:D3DXSHMultiply3=C:\\Windows\\System32\\d3dx9_38.D3DXSHMultiply3") 848 | #pragma comment( \ 849 | linker, \ 850 | "/export:D3DXSHMultiply4=C:\\Windows\\System32\\d3dx9_38.D3DXSHMultiply4") 851 | #pragma comment( \ 852 | linker, \ 853 | "/export:D3DXSHMultiply5=C:\\Windows\\System32\\d3dx9_38.D3DXSHMultiply5") 854 | #pragma comment( \ 855 | linker, \ 856 | "/export:D3DXSHMultiply6=C:\\Windows\\System32\\d3dx9_38.D3DXSHMultiply6") 857 | #pragma comment( \ 858 | linker, \ 859 | "/export:D3DXSHProjectCubeMap=C:\\Windows\\System32\\d3dx9_38.D3DXSHProjectCubeMap") 860 | #pragma comment( \ 861 | linker, \ 862 | "/export:D3DXSHPRTCompSplitMeshSC=C:\\Windows\\System32\\d3dx9_38.D3DXSHPRTCompSplitMeshSC") 863 | #pragma comment( \ 864 | linker, \ 865 | "/export:D3DXSHPRTCompSuperCluster=C:\\Windows\\System32\\d3dx9_38.D3DXSHPRTCompSuperCluster") 866 | #pragma comment( \ 867 | linker, \ 868 | "/export:D3DXSHRotate=C:\\Windows\\System32\\d3dx9_38.D3DXSHRotate") 869 | #pragma comment( \ 870 | linker, \ 871 | "/export:D3DXSHRotateZ=C:\\Windows\\System32\\d3dx9_38.D3DXSHRotateZ") 872 | #pragma comment( \ 873 | linker, "/export:D3DXSHScale=C:\\Windows\\System32\\d3dx9_38.D3DXSHScale") 874 | #pragma comment( \ 875 | linker, \ 876 | "/export:D3DXSimplifyMesh=C:\\Windows\\System32\\d3dx9_38.D3DXSimplifyMesh") 877 | #pragma comment( \ 878 | linker, \ 879 | "/export:D3DXSphereBoundProbe=C:\\Windows\\System32\\d3dx9_38.D3DXSphereBoundProbe") 880 | #pragma comment( \ 881 | linker, \ 882 | "/export:D3DXSplitMesh=C:\\Windows\\System32\\d3dx9_38.D3DXSplitMesh") 883 | #pragma comment( \ 884 | linker, \ 885 | "/export:D3DXTessellateNPatches=C:\\Windows\\System32\\d3dx9_38.D3DXTessellateNPatches") 886 | #pragma comment( \ 887 | linker, \ 888 | "/export:D3DXTessellateRectPatch=C:\\Windows\\System32\\d3dx9_38.D3DXTessellateRectPatch") 889 | #pragma comment( \ 890 | linker, \ 891 | "/export:D3DXTessellateTriPatch=C:\\Windows\\System32\\d3dx9_38.D3DXTessellateTriPatch") 892 | #pragma comment( \ 893 | linker, \ 894 | "/export:D3DXTriPatchSize=C:\\Windows\\System32\\d3dx9_38.D3DXTriPatchSize") 895 | #pragma comment( \ 896 | linker, \ 897 | "/export:D3DXUVAtlasCreate=C:\\Windows\\System32\\d3dx9_38.D3DXUVAtlasCreate") 898 | #pragma comment( \ 899 | linker, \ 900 | "/export:D3DXUVAtlasPack=C:\\Windows\\System32\\d3dx9_38.D3DXUVAtlasPack") 901 | #pragma comment( \ 902 | linker, \ 903 | "/export:D3DXUVAtlasPartition=C:\\Windows\\System32\\d3dx9_38.D3DXUVAtlasPartition") 904 | #pragma comment( \ 905 | linker, \ 906 | "/export:D3DXValidMesh=C:\\Windows\\System32\\d3dx9_38.D3DXValidMesh") 907 | #pragma comment( \ 908 | linker, \ 909 | "/export:D3DXValidPatchMesh=C:\\Windows\\System32\\d3dx9_38.D3DXValidPatchMesh") 910 | #pragma comment( \ 911 | linker, \ 912 | "/export:D3DXVec2BaryCentric=C:\\Windows\\System32\\d3dx9_38.D3DXVec2BaryCentric") 913 | #pragma comment( \ 914 | linker, \ 915 | "/export:D3DXVec2CatmullRom=C:\\Windows\\System32\\d3dx9_38.D3DXVec2CatmullRom") 916 | #pragma comment( \ 917 | linker, \ 918 | "/export:D3DXVec2Hermite=C:\\Windows\\System32\\d3dx9_38.D3DXVec2Hermite") 919 | #pragma comment( \ 920 | linker, \ 921 | "/export:D3DXVec2Normalize=C:\\Windows\\System32\\d3dx9_38.D3DXVec2Normalize") 922 | #pragma comment( \ 923 | linker, \ 924 | "/export:D3DXVec2Transform=C:\\Windows\\System32\\d3dx9_38.D3DXVec2Transform") 925 | #pragma comment( \ 926 | linker, \ 927 | "/export:D3DXVec2TransformArray=C:\\Windows\\System32\\d3dx9_38.D3DXVec2TransformArray") 928 | #pragma comment( \ 929 | linker, \ 930 | "/export:D3DXVec2TransformCoord=C:\\Windows\\System32\\d3dx9_38.D3DXVec2TransformCoord") 931 | #pragma comment( \ 932 | linker, \ 933 | "/export:D3DXVec2TransformCoordArray=C:\\Windows\\System32\\d3dx9_38.D3DXVec2TransformCoordArray") 934 | #pragma comment( \ 935 | linker, \ 936 | "/export:D3DXVec2TransformNormal=C:\\Windows\\System32\\d3dx9_38.D3DXVec2TransformNormal") 937 | #pragma comment( \ 938 | linker, \ 939 | "/export:D3DXVec2TransformNormalArray=C:\\Windows\\System32\\d3dx9_38.D3DXVec2TransformNormalArray") 940 | #pragma comment( \ 941 | linker, \ 942 | "/export:D3DXVec3BaryCentric=C:\\Windows\\System32\\d3dx9_38.D3DXVec3BaryCentric") 943 | #pragma comment( \ 944 | linker, \ 945 | "/export:D3DXVec3CatmullRom=C:\\Windows\\System32\\d3dx9_38.D3DXVec3CatmullRom") 946 | #pragma comment( \ 947 | linker, \ 948 | "/export:D3DXVec3Hermite=C:\\Windows\\System32\\d3dx9_38.D3DXVec3Hermite") 949 | #pragma comment( \ 950 | linker, \ 951 | "/export:D3DXVec3Normalize=C:\\Windows\\System32\\d3dx9_38.D3DXVec3Normalize") 952 | #pragma comment( \ 953 | linker, \ 954 | "/export:D3DXVec3Project=C:\\Windows\\System32\\d3dx9_38.D3DXVec3Project") 955 | #pragma comment( \ 956 | linker, \ 957 | "/export:D3DXVec3ProjectArray=C:\\Windows\\System32\\d3dx9_38.D3DXVec3ProjectArray") 958 | #pragma comment( \ 959 | linker, \ 960 | "/export:D3DXVec3Transform=C:\\Windows\\System32\\d3dx9_38.D3DXVec3Transform") 961 | #pragma comment( \ 962 | linker, \ 963 | "/export:D3DXVec3TransformArray=C:\\Windows\\System32\\d3dx9_38.D3DXVec3TransformArray") 964 | #pragma comment( \ 965 | linker, \ 966 | "/export:D3DXVec3TransformCoord=C:\\Windows\\System32\\d3dx9_38.D3DXVec3TransformCoord") 967 | #pragma comment( \ 968 | linker, \ 969 | "/export:D3DXVec3TransformCoordArray=C:\\Windows\\System32\\d3dx9_38.D3DXVec3TransformCoordArray") 970 | #pragma comment( \ 971 | linker, \ 972 | "/export:D3DXVec3TransformNormal=C:\\Windows\\System32\\d3dx9_38.D3DXVec3TransformNormal") 973 | #pragma comment( \ 974 | linker, \ 975 | "/export:D3DXVec3TransformNormalArray=C:\\Windows\\System32\\d3dx9_38.D3DXVec3TransformNormalArray") 976 | #pragma comment( \ 977 | linker, \ 978 | "/export:D3DXVec3Unproject=C:\\Windows\\System32\\d3dx9_38.D3DXVec3Unproject") 979 | #pragma comment( \ 980 | linker, \ 981 | "/export:D3DXVec3UnprojectArray=C:\\Windows\\System32\\d3dx9_38.D3DXVec3UnprojectArray") 982 | #pragma comment( \ 983 | linker, \ 984 | "/export:D3DXVec4BaryCentric=C:\\Windows\\System32\\d3dx9_38.D3DXVec4BaryCentric") 985 | #pragma comment( \ 986 | linker, \ 987 | "/export:D3DXVec4CatmullRom=C:\\Windows\\System32\\d3dx9_38.D3DXVec4CatmullRom") 988 | #pragma comment( \ 989 | linker, \ 990 | "/export:D3DXVec4Cross=C:\\Windows\\System32\\d3dx9_38.D3DXVec4Cross") 991 | #pragma comment( \ 992 | linker, \ 993 | "/export:D3DXVec4Hermite=C:\\Windows\\System32\\d3dx9_38.D3DXVec4Hermite") 994 | #pragma comment( \ 995 | linker, \ 996 | "/export:D3DXVec4Normalize=C:\\Windows\\System32\\d3dx9_38.D3DXVec4Normalize") 997 | #pragma comment( \ 998 | linker, \ 999 | "/export:D3DXVec4Transform=C:\\Windows\\System32\\d3dx9_38.D3DXVec4Transform") 1000 | #pragma comment( \ 1001 | linker, \ 1002 | "/export:D3DXVec4TransformArray=C:\\Windows\\System32\\d3dx9_38.D3DXVec4TransformArray") 1003 | #pragma comment( \ 1004 | linker, \ 1005 | "/export:D3DXWeldVertices=C:\\Windows\\System32\\d3dx9_38.D3DXWeldVertices") 1006 | -------------------------------------------------------------------------------- /cpu_info/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "util.h" 7 | 8 | #define btos(b) (b) ? "Y" : "N" 9 | 10 | enum 11 | { 12 | EAX, 13 | EBX, 14 | ECX, 15 | EDX, 16 | }; 17 | 18 | enum 19 | { 20 | IA32, 21 | SSE, 22 | SSE2, 23 | AVX, 24 | AVX2, 25 | AVX512, 26 | }; 27 | 28 | const char *iset_names[] = { 29 | [IA32] = HR_NAME_LOWER "_ia32.dll", [SSE] = HR_NAME_LOWER "_sse.dll", 30 | [SSE2] = HR_NAME_LOWER "_sse2.dll", [AVX] = HR_NAME_LOWER "_avx.dll", 31 | [AVX2] = HR_NAME_LOWER "_avx2.dll", [AVX512] = HR_NAME_LOWER "_avx512.dll", 32 | }; 33 | 34 | int get_min_iset(void) 35 | { 36 | int f1_ecx = 0, f1_edx = 0, f7_ebx = 0; 37 | int regs[4]; 38 | char brand[0x30]; 39 | int i, c; 40 | int ret; 41 | 42 | __cpuid(regs, 0); 43 | c = regs[EAX]; 44 | for (i = 0; i <= c; i++) 45 | { 46 | __cpuidex(regs, i, 0); 47 | if (i == 1) 48 | { 49 | f1_ecx = regs[ECX]; 50 | f1_edx = regs[EDX]; 51 | } 52 | if (i == 7) 53 | { 54 | f7_ebx = regs[EBX]; 55 | } 56 | } 57 | 58 | __cpuid(regs, 0x80000000); 59 | c = regs[EAX]; 60 | memset(brand, 0, sizeof(brand)); 61 | for (i = 0x80000000; i <= c; i++) 62 | { 63 | __cpuidex(regs, i, 0); 64 | if (i == 0x80000002) 65 | { 66 | memcpy(brand + 0x00, regs, sizeof(regs)); 67 | } 68 | if (i == 0x80000003) 69 | { 70 | memcpy(brand + 0x10, regs, sizeof(regs)); 71 | } 72 | if (i == 0x80000004) 73 | { 74 | memcpy(brand + 0x20, regs, sizeof(regs)); 75 | } 76 | } 77 | 78 | printf("%s\n", brand); 79 | printf("\n"); 80 | 81 | printf("SSE\t: %s\n", btos(f1_edx & (1 << 25))); 82 | printf("SSE2\t: %s\n", btos(f1_edx & (1 << 26))); 83 | printf("SSE3\t: %s\n", btos(f1_ecx & (1 << 0))); 84 | printf("SSSE3\t: %s\n", btos(f1_ecx & (1 << 9))); 85 | printf("SSE4.1\t: %s\n", btos(f1_ecx & (1 << 19))); 86 | printf("SSE4.2\t: %s\n", btos(f1_ecx & (1 << 20))); 87 | printf("AVX\t: %s\n", btos(f1_ecx & (1 << 28))); 88 | printf("AVX2\t: %s\n", btos(f7_ebx & (1 << 5))); 89 | printf("AVX512\t: %s\n", btos(f7_ebx & (1 << 16))); 90 | 91 | printf("\n => "); 92 | if (f7_ebx & (1 << 16)) 93 | { 94 | printf("Use AVX512"); 95 | ret = AVX512; 96 | goto end; 97 | } 98 | else if (f7_ebx & (1 << 05)) 99 | { 100 | printf("Use AVX2"); 101 | ret = AVX2; 102 | goto end; 103 | } 104 | else if (f1_ecx & (1 << 28)) 105 | { 106 | printf("Use AVX"); 107 | ret = AVX; 108 | goto end; 109 | } 110 | else if (f1_edx & (1 << 26)) 111 | { 112 | printf("Use SSE2"); 113 | ret = SSE2; 114 | goto end; 115 | } 116 | else if (f1_edx & (1 << 25)) 117 | { 118 | printf("Use SSE"); 119 | ret = SSE; 120 | goto end; 121 | } 122 | else 123 | { 124 | printf("Use IA32"); 125 | ret = IA32; 126 | goto end; 127 | } 128 | 129 | end: 130 | printf(" <= \n"); 131 | return ret; 132 | } 133 | 134 | BOOL APIENTRY DllMain(HMODULE hModule, DWORD fdwReason, LPVOID lpReserved) 135 | { 136 | int iset; 137 | char buff[MAX_PATH] = "Data\\" HR_NAME "\\"; 138 | 139 | if (fdwReason == DLL_PROCESS_ATTACH) 140 | { 141 | if (!file_exists("d3dx9_38.tmp")) 142 | { 143 | create_console(); 144 | } 145 | 146 | DisableThreadLibraryCalls(hModule); 147 | 148 | iset = get_min_iset(); 149 | strcat(buff, iset_names[iset]); 150 | printf("\nsearching for %s... ", buff); 151 | if (file_exists(buff)) 152 | { 153 | printf("found!\n\n"); 154 | LoadLibraryA(buff); 155 | } 156 | else 157 | { 158 | printf("not found!\n\n"); 159 | HR_MSGBOX("No valid HR binary found in Data/" HR_NAME "!", 160 | MB_ICONERROR); 161 | } 162 | } 163 | 164 | return TRUE; 165 | } 166 | -------------------------------------------------------------------------------- /cpu_info/util.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #define HR_MSGBOX(msg, type) \ 6 | MessageBox(NULL, HR_NAME L" - " msg, L"Error", type) 7 | 8 | void create_console(void) 9 | { 10 | FILE *f; 11 | if (AllocConsole()) 12 | { 13 | f = freopen("CONIN$", "r", stdin); 14 | f = freopen("CONOUT$", "w", stdout); 15 | f = freopen("CONOUT$", "w", stderr); 16 | } 17 | } 18 | 19 | int file_exists(const char *name) 20 | { 21 | int ret = 0; 22 | FILE *file; 23 | 24 | if (file = fopen(name, "r")) 25 | { 26 | fclose(file); 27 | ret = 1; 28 | goto end; 29 | } 30 | 31 | end: 32 | return ret; 33 | } 34 | -------------------------------------------------------------------------------- /heap_replacer.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.1.32228.430 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "heap_replacer", "heap_replacer\heap_replacer.vcxproj", "{B7641A6B-8A63-42E6-84FE-FF4D0C871DF1}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpu_info", "cpu_info\cpu_info.vcxproj", "{7835DA3E-6140-4E3B-B7AD-1AF48B254FAE}" 9 | EndProject 10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4692FA0E-04FF-4B52-962B-90B4B0910185}" 11 | ProjectSection(SolutionItems) = preProject 12 | .clang-format = .clang-format 13 | EndProjectSection 14 | EndProject 15 | Global 16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 | FNV|x86 = FNV|x86 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {B7641A6B-8A63-42E6-84FE-FF4D0C871DF1}.FNV|x86.ActiveCfg = Release|Win32 21 | {B7641A6B-8A63-42E6-84FE-FF4D0C871DF1}.FNV|x86.Build.0 = Release|Win32 22 | {7835DA3E-6140-4E3B-B7AD-1AF48B254FAE}.FNV|x86.ActiveCfg = Release|Win32 23 | {7835DA3E-6140-4E3B-B7AD-1AF48B254FAE}.FNV|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {BE275BA0-C6D4-4685-96DB-77DD3D7767C1} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /heap_replacer/dheap/cdesc.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "dheap_defs.h" 4 | 5 | struct cdesc 6 | { 7 | void *addr; 8 | struct 9 | { 10 | size_t size : DHEAP_CELL_SIZE_BITS; 11 | size_t index : 32 - DHEAP_CELL_SIZE_BITS; 12 | }; 13 | }; 14 | 15 | void *cdesc_get_end(struct cdesc *desc) 16 | { 17 | return VSUM(desc->addr, desc->size); 18 | } 19 | 20 | int cdesc_is_in_range(struct cdesc *desc, void *addr) 21 | { 22 | return ((desc->addr <= addr) & (addr < cdesc_get_end(desc))); 23 | } 24 | -------------------------------------------------------------------------------- /heap_replacer/dheap/clist.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "cnode.h" 4 | #include "main/heap_replacer.h" 5 | #include "mcell.h" 6 | 7 | struct cnode; 8 | struct mcell; 9 | 10 | struct clist 11 | { 12 | struct cnode head; 13 | struct cnode tail; 14 | }; 15 | 16 | void clist_init(struct clist *list) 17 | { 18 | list->head = (struct cnode){&list->tail, NULL, 0xffffffffu}; 19 | list->tail = (struct cnode){NULL, &list->head, 0xffffffffu}; 20 | } 21 | 22 | struct cnode *clist_get_head(struct clist *list) 23 | { 24 | return list->head.next; 25 | } 26 | 27 | struct cnode *clist_get_tail(struct clist *list) 28 | { 29 | return list->tail.prev; 30 | } 31 | 32 | void clist_add_head(struct clist *list, struct cnode *node) 33 | { 34 | cnode_link(node, &list->head, list->head.next); 35 | } 36 | 37 | void clist_add_tail(struct clist *list, struct cnode *node) 38 | { 39 | cnode_link(node, list->tail.prev, &list->tail); 40 | } 41 | 42 | void clist_insert_before(struct clist *list, struct cnode *node, 43 | struct cnode *pos) 44 | { 45 | cnode_link(node, pos->prev, pos); 46 | } 47 | 48 | void clist_insert_after(struct clist *list, struct cnode *node, 49 | struct cnode *pos) 50 | { 51 | cnode_link(node, pos, pos->next); 52 | } 53 | 54 | void clist_remove_node(struct clist *list, struct cnode *__restrict node) 55 | { 56 | node->prev->next = node->next; 57 | node->next->prev = node->prev; 58 | } 59 | 60 | int clist_is_empty(struct clist *list) 61 | { 62 | return list->head.next == &list->tail; 63 | } 64 | -------------------------------------------------------------------------------- /heap_replacer/dheap/cnode.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define get_mcell(node, type) \ 4 | ((struct mcell *)(((DWORD)node - offsetof(struct mcell, type)) & \ 5 | (!cnode_is_valid(node) - 1))) 6 | 7 | struct cnode 8 | { 9 | struct cnode *next; 10 | struct cnode *prev; 11 | size_t array_index; 12 | }; 13 | 14 | void cnode_link(struct cnode *node, struct cnode *prev, struct cnode *next) 15 | { 16 | node->prev = prev; 17 | prev->next = node; 18 | node->next = next; 19 | next->prev = node; 20 | } 21 | 22 | int cnode_is_valid(struct cnode *node) 23 | { 24 | return !!node->next & !!node->prev; 25 | } 26 | -------------------------------------------------------------------------------- /heap_replacer/dheap/dheap.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "main/util.h" 4 | 5 | #include "cdesc.h" 6 | #include "clist.h" 7 | #include "dheap_defs.h" 8 | #include "locks/rlock.h" 9 | #include "mcell.h" 10 | 11 | struct dheap 12 | { 13 | struct clist size_list; 14 | struct clist addr_list[DHEAP_BLOCK_COUNT]; 15 | struct mcell *size_array[DHEAP_CELLS_PER_BLOCK]; 16 | struct mcell **addr_array[DHEAP_BLOCK_COUNT]; 17 | struct mcell **used_cells[DHEAP_BLOCK_COUNT]; 18 | struct cdesc block_desc[DHEAP_BLOCK_COUNT]; 19 | struct rlock lock; 20 | }; 21 | 22 | size_t dheap_get_block_index(struct dheap *heap, void *addr); 23 | struct mcell *dheap_create_new_block(struct dheap *heap); 24 | void dheap_add_free_cell(struct dheap *heap, struct mcell *cell); 25 | 26 | void dheap_init(struct dheap *heap) 27 | { 28 | clist_init(&heap->size_list); 29 | rlock_init(&heap->lock); 30 | } 31 | 32 | size_t dheap_get_size_index_from_size(struct dheap *heap, size_t size) 33 | { 34 | return (size / DHEAP_CELL_SIZE) - 1u; 35 | } 36 | 37 | size_t dheap_get_size_index_from_cell(struct dheap *heap, struct mcell *cell) 38 | { 39 | return dheap_get_size_index_from_size(heap, cell->desc.size); 40 | } 41 | 42 | size_t dheap_get_addr_index_from_cell(struct dheap *heap, struct mcell *cell) 43 | { 44 | return USUB(cell->desc.addr, heap->block_desc[cell->desc.index].addr) / 45 | DHEAP_CELL_SIZE; 46 | } 47 | 48 | void dheap_add_cell_to_size_array(struct dheap *heap, struct mcell *cell) 49 | { 50 | struct cnode *curr; 51 | struct mcell *elem; 52 | 53 | if ((elem = heap->size_array[cell->size_node.array_index]) && 54 | (cell->desc.size == elem->desc.size)) 55 | { 56 | return; 57 | } 58 | 59 | for (curr = cell->size_node.prev; 60 | (elem = get_mcell(curr, size_node)) && mcell_is_smaller(cell, elem); 61 | curr = curr->prev) 62 | { 63 | } 64 | 65 | hr_memset32(&heap->size_array[curr->array_index + 1u], (DWORD)cell, 66 | cell->size_node.array_index - curr->array_index); 67 | } 68 | 69 | void dheap_add_cell_to_addr_array(struct dheap *heap, struct mcell *cell) 70 | { 71 | struct cnode *curr; 72 | struct mcell *elem; 73 | 74 | for (curr = cell->addr_node.prev; 75 | (elem = get_mcell(curr, addr_node)) && mcell_is_before(cell, elem); 76 | curr = curr->prev) 77 | { 78 | } 79 | 80 | hr_memset32(&heap->addr_array[cell->desc.index][curr->array_index + 1u], 81 | (DWORD)cell, cell->addr_node.array_index - curr->array_index); 82 | } 83 | 84 | void dheap_rmv_cell_from_size_array(struct dheap *heap, struct mcell *cell) 85 | { 86 | struct cnode *curr = cell->size_node.prev; 87 | 88 | if (cell == heap->size_array[curr->array_index + 1u]) 89 | { 90 | hr_memset32(&heap->size_array[curr->array_index + 1u], 91 | (DWORD)get_mcell(cell->size_node.next, size_node), 92 | cell->size_node.array_index - curr->array_index); 93 | } 94 | } 95 | 96 | void dheap_rmv_cell_from_addr_array(struct dheap *heap, struct mcell *cell) 97 | { 98 | struct cnode *curr = cell->addr_node.prev; 99 | 100 | hr_memset32(&heap->addr_array[cell->desc.index][curr->array_index + 1u], 101 | (DWORD)get_mcell(cell->addr_node.next, addr_node), 102 | cell->addr_node.array_index - curr->array_index); 103 | } 104 | 105 | void dheap_add_cell_to_size_list(struct dheap *heap, struct mcell *cell) 106 | { 107 | struct mcell *elem; 108 | size_t index = dheap_get_size_index_from_cell(heap, cell); 109 | 110 | if (elem = heap->size_array[index]) 111 | { 112 | if (elem->desc.size == cell->desc.size) 113 | { 114 | clist_insert_after(&heap->size_list, &cell->size_node, 115 | &elem->size_node); 116 | } 117 | else 118 | { 119 | clist_insert_before(&heap->size_list, &cell->size_node, 120 | &elem->size_node); 121 | } 122 | goto end; 123 | } 124 | 125 | clist_add_tail(&heap->size_list, &cell->size_node); 126 | 127 | end: 128 | cell->size_node.array_index = index; 129 | } 130 | 131 | void dheap_add_cell_to_addr_list(struct dheap *heap, struct mcell *cell) 132 | { 133 | struct mcell *elem; 134 | size_t index = dheap_get_addr_index_from_cell(heap, cell); 135 | 136 | if (elem = heap->addr_array[cell->desc.index][index]) 137 | { 138 | clist_insert_before(&heap->addr_list[cell->desc.index], 139 | &cell->addr_node, &elem->addr_node); 140 | goto end; 141 | } 142 | 143 | clist_add_tail(&heap->addr_list[cell->desc.index], &cell->addr_node); 144 | 145 | end: 146 | cell->addr_node.array_index = index; 147 | } 148 | 149 | void dheap_put_used_cell(struct dheap *heap, struct mcell *cell) 150 | { 151 | size_t addr_index = dheap_get_addr_index_from_cell(heap, cell); 152 | heap->used_cells[cell->desc.index][addr_index] = cell; 153 | } 154 | 155 | struct mcell *dheap_rmv_used_cell(struct dheap *heap, void *addr, size_t index) 156 | { 157 | size_t addr_index = 158 | USUB(addr, heap->block_desc[index].addr) / DHEAP_CELL_SIZE; 159 | return InterlockedExchangePointer(&heap->used_cells[index][addr_index], 160 | NULL); 161 | } 162 | 163 | struct mcell *dheap_get_used_cell(struct dheap *heap, void *addr, size_t index) 164 | { 165 | size_t addr_index = 166 | USUB(addr, heap->block_desc[index].addr) / DHEAP_CELL_SIZE; 167 | return heap->used_cells[index][addr_index]; 168 | } 169 | 170 | void dheap_rmv_free_cell(struct dheap *heap, struct mcell *cell) 171 | { 172 | dheap_rmv_cell_from_size_array(heap, cell); 173 | dheap_rmv_cell_from_addr_array(heap, cell); 174 | 175 | clist_remove_node(&heap->size_list, &cell->size_node); 176 | clist_remove_node(&heap->addr_list[cell->desc.index], &cell->addr_node); 177 | } 178 | 179 | void dheap_add_free_cell(struct dheap *heap, struct mcell *cell) 180 | { 181 | size_t index = dheap_get_addr_index_from_cell(heap, cell); 182 | struct mcell *next; 183 | struct mcell *prev; 184 | 185 | rlock_lock(&heap->lock); 186 | 187 | next = heap->addr_array[cell->desc.index][index]; 188 | prev = next ? get_mcell(next->addr_node.prev, addr_node) : NULL; 189 | 190 | if (prev && mcell_precedes(prev, cell)) 191 | { 192 | dheap_rmv_free_cell(heap, prev); 193 | cell->desc.addr = prev->desc.addr; 194 | cell->desc.size += prev->desc.size; 195 | cell->addr_node.array_index = prev->addr_node.array_index; 196 | hr_free(prev); 197 | } 198 | if (next && mcell_precedes(cell, next)) 199 | { 200 | dheap_rmv_free_cell(heap, next); 201 | cell->desc.size += next->desc.size; 202 | hr_free(next); 203 | } 204 | 205 | dheap_add_cell_to_addr_list(heap, cell); 206 | dheap_add_cell_to_addr_array(heap, cell); 207 | dheap_add_cell_to_size_list(heap, cell); 208 | dheap_add_cell_to_size_array(heap, cell); 209 | 210 | rlock_unlock(&heap->lock); 211 | } 212 | 213 | struct mcell *dheap_get_free_cell(struct dheap *heap, size_t size) 214 | { 215 | size_t rsize, index; 216 | 217 | rsize = ROUND_UP(size, DHEAP_CELL_SIZE); 218 | index = dheap_get_size_index_from_size(heap, rsize); 219 | 220 | struct mcell *cell; 221 | struct mcell *split; 222 | 223 | rlock_lock(&heap->lock); 224 | 225 | cell = heap->size_array[index]; 226 | if (!cell) 227 | { 228 | cell = dheap_create_new_block(heap); 229 | if (!cell) 230 | { 231 | HR_LOG("failed to create new block"); 232 | goto end; 233 | } 234 | dheap_add_free_cell(heap, cell); 235 | } 236 | 237 | if ((cell->desc.size - rsize) < DHEAP_MIN_CELL_SIZE) 238 | { 239 | dheap_rmv_free_cell(heap, cell); 240 | } 241 | else 242 | { 243 | dheap_rmv_cell_from_size_array(heap, cell); 244 | clist_remove_node(&heap->size_list, &cell->size_node); 245 | 246 | split = mcell_split(cell, rsize); 247 | 248 | dheap_add_cell_to_size_list(heap, cell); 249 | dheap_add_cell_to_size_array(heap, cell); 250 | 251 | cell = split; 252 | } 253 | 254 | end: 255 | rlock_unlock(&heap->lock); 256 | return cell; 257 | } 258 | 259 | size_t dheap_get_block_index(struct dheap *heap, void *addr) 260 | { 261 | size_t index = DHEAP_BLOCK_COUNT; 262 | 263 | for (size_t i = 0u; i < DHEAP_BLOCK_COUNT; i++) 264 | { 265 | if (cdesc_is_in_range(&heap->block_desc[i], addr)) 266 | { 267 | index = i; 268 | goto end; 269 | } 270 | } 271 | 272 | end: 273 | return index; 274 | } 275 | 276 | size_t dheap_next_free_block_index(struct dheap *heap) 277 | { 278 | size_t index = DHEAP_BLOCK_COUNT; 279 | 280 | for (size_t i = 0u; i < DHEAP_BLOCK_COUNT; i++) 281 | { 282 | if (!heap->block_desc[i].addr) 283 | { 284 | index = i; 285 | goto end; 286 | } 287 | } 288 | 289 | end: 290 | return index; 291 | } 292 | 293 | struct mcell *dheap_create_new_block(struct dheap *heap) 294 | { 295 | void *addr; 296 | struct mcell *cell = NULL; 297 | size_t index = dheap_next_free_block_index(heap); 298 | 299 | if (index == DHEAP_BLOCK_COUNT) 300 | { 301 | HR_LOG("no more blocks available"); 302 | goto end; 303 | } 304 | 305 | addr = hr_winapi_malloc(DHEAP_BLOCK_SIZE); 306 | if (!addr) 307 | { 308 | HR_LOG("failed to allocate new block"); 309 | goto end; 310 | } 311 | 312 | HR_LOG("new block %d allocated at 0x%08X", index, (DWORD)addr); 313 | 314 | heap->block_desc[index] = (struct cdesc){addr, DHEAP_BLOCK_SIZE, index}; 315 | clist_init(&heap->addr_list[index]); 316 | 317 | heap->addr_array[index] = (struct mcell **)hr_winapi_calloc( 318 | DHEAP_CELLS_PER_BLOCK, sizeof(struct mcell *)); 319 | if (!heap->addr_array[index]) 320 | { 321 | HR_LOG("failed to allocate new addr array"); 322 | goto end; 323 | } 324 | 325 | heap->used_cells[index] = (struct mcell **)hr_winapi_calloc( 326 | DHEAP_CELLS_PER_BLOCK, sizeof(struct mcell *)); 327 | if (!heap->used_cells[index]) 328 | { 329 | HR_LOG("failed to allocate new used cells array"); 330 | goto end; 331 | } 332 | 333 | cell = (struct mcell *)hr_malloc(sizeof(struct mcell)); 334 | if (!cell) 335 | { 336 | HR_LOG("failed to allocate new cell"); 337 | goto end; 338 | } 339 | cell->desc = (struct cdesc){addr, DHEAP_BLOCK_SIZE, index}; 340 | 341 | end: 342 | return cell; 343 | } 344 | 345 | void *dheap_malloc(struct dheap *heap, size_t size) 346 | { 347 | struct mcell *cell = dheap_get_free_cell(heap, size); 348 | void *addr = NULL; 349 | 350 | if (!cell) 351 | { 352 | goto end; 353 | } 354 | 355 | dheap_put_used_cell(heap, cell); 356 | addr = cell->desc.addr; 357 | 358 | end: 359 | return addr; 360 | } 361 | 362 | void *dheap_calloc(struct dheap *heap, size_t size) 363 | { 364 | void *addr = dheap_malloc(heap, size); 365 | 366 | if (addr) 367 | { 368 | hr_memset32(addr, 0, (size + 3u) >> 2u); 369 | } 370 | 371 | return addr; 372 | } 373 | 374 | size_t dheap_mem_size(struct dheap *heap, void *addr) 375 | { 376 | size_t index = dheap_get_block_index(heap, addr); 377 | struct mcell *cell; 378 | size_t size = 0; 379 | 380 | if (index == DHEAP_BLOCK_COUNT) 381 | { 382 | goto end; 383 | } 384 | 385 | cell = dheap_get_used_cell(heap, addr, index); 386 | size = cell->desc.size; 387 | 388 | end: 389 | return size; 390 | } 391 | 392 | int dheap_free(struct dheap *heap, void *addr) 393 | { 394 | size_t index = dheap_get_block_index(heap, addr); 395 | struct mcell *cell; 396 | int ret = 0; 397 | 398 | if (index == DHEAP_BLOCK_COUNT) 399 | { 400 | goto end; 401 | } 402 | 403 | ret = 1; 404 | 405 | if (cell = dheap_rmv_used_cell(heap, addr, index)) 406 | { 407 | dheap_add_free_cell(heap, cell); 408 | } 409 | 410 | end: 411 | return ret; 412 | } 413 | -------------------------------------------------------------------------------- /heap_replacer/dheap/dheap_defs.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define DHEAP_CELL_SIZE (2u * KB) 4 | #define DHEAP_MIN_CELL_SIZE (4u * KB) 5 | #define DHEAP_BLOCK_SIZE (16u * MB) 6 | #define DHEAP_MAX_SIZE (2u * GB) 7 | 8 | #define DHEAP_CELL_SIZE_BITS (25) 9 | 10 | #define DHEAP_BLOCK_COUNT (DHEAP_MAX_SIZE / DHEAP_BLOCK_SIZE) 11 | #define DHEAP_CELLS_PER_BLOCK (DHEAP_BLOCK_SIZE / DHEAP_CELL_SIZE) 12 | -------------------------------------------------------------------------------- /heap_replacer/dheap/mcell.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "cdesc.h" 4 | #include "cnode.h" 5 | #include "main/heap_replacer.h" 6 | 7 | struct cnode; 8 | struct cdesc; 9 | 10 | struct mcell 11 | { 12 | struct cdesc desc; 13 | struct cnode size_node; 14 | struct cnode addr_node; 15 | }; 16 | 17 | int mcell_precedes(struct mcell *cell, struct mcell *other) 18 | { 19 | return cdesc_get_end(&cell->desc) == other->desc.addr; 20 | } 21 | 22 | struct mcell *mcell_split(struct mcell *cell, size_t size) 23 | { 24 | struct mcell *__restrict new_cell = 25 | (struct mcell *)hr_malloc(sizeof(struct mcell)); 26 | 27 | cell->desc.size -= size; 28 | 29 | new_cell->desc = 30 | (struct cdesc){cdesc_get_end(&cell->desc), size, cell->desc.index}; 31 | 32 | return new_cell; 33 | } 34 | 35 | int mcell_is_smaller(struct mcell *cell, struct mcell *other) 36 | { 37 | return cell->desc.size < other->desc.size; 38 | } 39 | 40 | int mcell_is_before(struct mcell *cell, struct mcell *other) 41 | { 42 | return cell->desc.addr < other->desc.addr; 43 | } 44 | -------------------------------------------------------------------------------- /heap_replacer/heap_replacer.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Release 6 | Win32 7 | 8 | 9 | 10 | 16.0 11 | Win32Proj 12 | {b7641a6b-8a63-42e6-84fe-ff4d0c871df1} 13 | heapreplacer 14 | 10.0 15 | 16 | 17 | 18 | DynamicLibrary 19 | false 20 | v143 21 | true 22 | Unicode 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | false 36 | $(SolutionDir)binaries\$(Configuration)\$(ProjectName)\$(Arch)\ 37 | $(SolutionDir)intermediates\$(Configuration)\$(ProjectName)\$(Arch)\ 38 | $(HR_NAME_LOWER)_$(ARCH_LOWER) 39 | 40 | 41 | 42 | Level3 43 | true 44 | true 45 | false 46 | _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 47 | true 48 | stdc17 49 | $(ProjectDir) 50 | FastCall 51 | OldStyle 52 | AnySuitable 53 | Speed 54 | true 55 | true 56 | MaxSpeed 57 | true 58 | CompileAsC 59 | false 60 | false 61 | Fast 62 | stdcpp20 63 | /arch:$(ARCH) %(AdditionalOptions) 64 | 65 | 66 | Console 67 | true 68 | true 69 | DebugFull 70 | $(CoreLibraryDependencies);%(AdditionalDependencies) 71 | 72 | 73 | UseLinkTimeCodeGeneration 74 | false 75 | 76 | 77 | copy "$(TargetPath)" "$(HR_GAME_DIR)\Data\$(HR_NAME)\$(TargetFileName)" 78 | 79 | 80 | false 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /heap_replacer/heap_replacer.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 | 23 | 24 | Header Files 25 | 26 | 27 | Header Files 28 | 29 | 30 | Header Files 31 | 32 | 33 | Header Files 34 | 35 | 36 | Header Files 37 | 38 | 39 | Header Files 40 | 41 | 42 | Header Files 43 | 44 | 45 | Header Files 46 | 47 | 48 | Header Files 49 | 50 | 51 | Header Files 52 | 53 | 54 | Header Files 55 | 56 | 57 | Header Files 58 | 59 | 60 | Header Files 61 | 62 | 63 | Header Files 64 | 65 | 66 | Header Files 67 | 68 | 69 | Header Files 70 | 71 | 72 | -------------------------------------------------------------------------------- /heap_replacer/locks/nlock.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | struct nlock 6 | { 7 | DWORD locked; 8 | }; 9 | 10 | void nlock_init(struct nlock *lock) 11 | { 12 | lock->locked = 0; 13 | } 14 | 15 | void nlock_lock(struct nlock *lock) 16 | { 17 | while (InterlockedCompareExchange(&lock->locked, 1, 0)) 18 | { 19 | YieldProcessor(); 20 | }; 21 | } 22 | 23 | void nlock_unlock(struct nlock *lock) 24 | { 25 | lock->locked = 0; 26 | } 27 | -------------------------------------------------------------------------------- /heap_replacer/locks/rlock.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | struct rlock 6 | { 7 | DWORD thread_id; 8 | size_t lock_count; 9 | }; 10 | 11 | void rlock_init(struct rlock *lock) 12 | { 13 | lock->thread_id = 0; 14 | lock->lock_count = 0; 15 | } 16 | 17 | void rlock_lock(struct rlock *lock) 18 | { 19 | DWORD id = GetCurrentThreadId(); 20 | if (lock->thread_id == id) 21 | { 22 | lock->lock_count++; 23 | } 24 | else 25 | { 26 | while (InterlockedCompareExchange(&lock->thread_id, id, 0)) 27 | { 28 | YieldProcessor(); 29 | }; 30 | lock->lock_count = 1; 31 | } 32 | } 33 | 34 | void rlock_unlock(struct rlock *lock) 35 | { 36 | if (!--lock->lock_count) 37 | { 38 | lock->thread_id = 0; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /heap_replacer/main/defs.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #if defined(FNV) 4 | 5 | #define HR_GAME_VERSION L"1.4.0.525" 6 | #define HR_GAME_QPC_HOOK (0xF0A0) 7 | #define HR_GECK_QPC_HOOK (0x320C) 8 | 9 | #elif defined(FO3) 10 | 11 | #define HR_GAME_VERSION L"1.7.0.3" 12 | #define HR_GAME_QPC_HOOK (0xB0E4) 13 | #define HR_GECK_QPC_HOOK (0x3208) 14 | 15 | #endif 16 | 17 | #define HR_MSGBOX(msg, type) \ 18 | MessageBox(NULL, HR_NAME L" - " msg, L"Error", type) 19 | 20 | #define HR_LOG(fmt, ...) \ 21 | nlock_lock(&log_lock); \ 22 | get_time(time_buff, sizeof(time_buff)); \ 23 | fprintf(log_file, "[%s] - <%s> " fmt "\n", time_buff, __FUNCTION__, \ 24 | ##__VA_ARGS__); \ 25 | nlock_unlock(&log_lock); \ 26 | fflush(log_file); 27 | -------------------------------------------------------------------------------- /heap_replacer/main/heap_replacer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "defs.h" 6 | #include "locks/nlock.h" 7 | 8 | FILE *log_file; 9 | struct nlock log_lock; 10 | char time_buff[32]; 11 | 12 | void *hr_malloc(size_t size); 13 | void *hr_calloc(size_t count, size_t size); 14 | void *hr_realloc(void *addr, size_t size); 15 | void *hr_recalloc(void *addr, size_t size, size_t count); 16 | size_t hr_mem_size(void *addr); 17 | void hr_free(void *addr); 18 | 19 | #include "dheap/dheap.h" 20 | #include "mheap/mheap.h" 21 | #include "sheap/sheap.h" 22 | 23 | struct mheap m; 24 | struct dheap d; 25 | 26 | void *hr_malloc(size_t size) 27 | { 28 | void *addr; 29 | 30 | if (size <= POOL_MAX_ALLOC_SIZE) 31 | { 32 | if (addr = mheap_malloc(&m, size)) 33 | { 34 | goto end; 35 | } 36 | } 37 | 38 | if (size <= DHEAP_BLOCK_SIZE) 39 | { 40 | if (addr = dheap_malloc(&d, size)) 41 | { 42 | goto end; 43 | } 44 | } 45 | 46 | addr = hr_winapi_malloc(size); 47 | 48 | if (!addr) 49 | { 50 | HR_LOG("returned NULL"); 51 | } 52 | 53 | end: 54 | return addr; 55 | } 56 | 57 | void *hr_calloc(size_t count, size_t size) 58 | { 59 | void *addr; 60 | 61 | size *= count; 62 | 63 | if (size <= POOL_MAX_ALLOC_SIZE) 64 | { 65 | if (addr = mheap_calloc(&m, size)) 66 | { 67 | goto end; 68 | } 69 | } 70 | 71 | if (size <= DHEAP_BLOCK_SIZE) 72 | { 73 | if (addr = dheap_calloc(&d, size)) 74 | { 75 | goto end; 76 | } 77 | } 78 | 79 | addr = hr_winapi_malloc(size); 80 | 81 | if (!addr) 82 | { 83 | HR_LOG("returned NULL"); 84 | } 85 | 86 | end: 87 | return addr; 88 | } 89 | 90 | void *hr_realloc(void *addr, size_t size) 91 | { 92 | void *new_addr; 93 | size_t old_size, new_size; 94 | 95 | if (!addr) 96 | { 97 | new_addr = hr_malloc(size); 98 | goto end; 99 | } 100 | 101 | if ((old_size = hr_mem_size(addr)) >= (new_size = size)) 102 | { 103 | new_addr = addr; 104 | goto end; 105 | } 106 | 107 | new_addr = hr_malloc(size); 108 | memcpy(new_addr, addr, old_size); 109 | hr_free(addr); 110 | 111 | end: 112 | return new_addr; 113 | } 114 | 115 | void *hr_recalloc(void *addr, size_t count, size_t size) 116 | { 117 | void *new_addr; 118 | size_t old_size, new_size; 119 | 120 | if (!addr) 121 | { 122 | new_addr = hr_calloc(count, size); 123 | goto end; 124 | } 125 | 126 | if ((old_size = hr_mem_size(addr)) >= (new_size = size * count)) 127 | { 128 | hr_memset8(VSUM(addr, new_size), 0, old_size - new_size); 129 | new_addr = addr; 130 | goto end; 131 | } 132 | 133 | new_addr = hr_calloc(count, size); 134 | memcpy(new_addr, addr, old_size); 135 | hr_free(addr); 136 | 137 | end: 138 | return new_addr; 139 | } 140 | 141 | size_t hr_mem_size(void *addr) 142 | { 143 | size_t size = 0; 144 | 145 | if (!addr) 146 | { 147 | goto end; 148 | } 149 | 150 | if (size = mheap_mem_size(&m, addr)) 151 | { 152 | goto end; 153 | } 154 | 155 | if (size = dheap_mem_size(&d, addr)) 156 | { 157 | goto end; 158 | } 159 | 160 | end: 161 | return size; 162 | } 163 | 164 | void hr_free(void *addr) 165 | { 166 | if (!addr) 167 | { 168 | goto end; 169 | } 170 | 171 | if (mheap_free(&m, addr)) 172 | { 173 | goto end; 174 | } 175 | 176 | if (dheap_free(&d, addr)) 177 | { 178 | goto end; 179 | } 180 | 181 | hr_winapi_free(addr); 182 | 183 | end: 184 | return; 185 | } 186 | 187 | void *game_heap_allocate(void *self, void *edx, size_t size) 188 | { 189 | return hr_malloc(size); 190 | } 191 | 192 | void *game_heap_reallocate(void *self, void *edx, void *addr, size_t size) 193 | { 194 | return hr_realloc(addr, size); 195 | } 196 | 197 | size_t game_heap_msize(void *self, void *edx, void *addr) 198 | { 199 | return hr_mem_size(addr); 200 | } 201 | 202 | void game_heap_free(void *self, void *edx, void *addr) 203 | { 204 | hr_free(addr); 205 | } 206 | 207 | void *__cdecl crt_malloc(size_t size) 208 | { 209 | return hr_malloc(size); 210 | } 211 | 212 | void *__cdecl crt_calloc(size_t count, size_t size) 213 | { 214 | return hr_calloc(count, size); 215 | } 216 | 217 | void *__cdecl crt_realloc(void *addr, size_t size) 218 | { 219 | return hr_realloc(addr, size); 220 | } 221 | 222 | void *__cdecl crt_recalloc(void *addr, size_t count, size_t size) 223 | { 224 | return hr_recalloc(addr, count, size); 225 | } 226 | 227 | size_t __cdecl crt_msize(void *addr) 228 | { 229 | return hr_mem_size(addr); 230 | } 231 | 232 | void __cdecl crt_free(void *addr) 233 | { 234 | hr_free(addr); 235 | } 236 | 237 | void apply_hr_hooks() 238 | { 239 | HR_LOG("initializing mheap"); 240 | mheap_init(&m); 241 | 242 | HR_LOG("initializing dheap"); 243 | dheap_init(&d); 244 | 245 | #if defined(FNV) 246 | 247 | patch_jmp((void *)0x00ECD1C7, &crt_malloc); 248 | patch_jmp((void *)0x00ED0CDF, &crt_malloc); 249 | patch_jmp((void *)0x00EDDD7D, &crt_calloc); 250 | patch_jmp((void *)0x00ED0D24, &crt_calloc); 251 | patch_jmp((void *)0x00ECCF5D, &crt_realloc); 252 | patch_jmp((void *)0x00ED0D70, &crt_realloc); 253 | patch_jmp((void *)0x00EE1700, &crt_recalloc); 254 | patch_jmp((void *)0x00ED0DBE, &crt_recalloc); 255 | patch_jmp((void *)0x00ECD31F, &crt_msize); 256 | patch_jmp((void *)0x00ECD291, &crt_free); 257 | 258 | patch_jmp((void *)0x00AA3E40, &game_heap_allocate); 259 | patch_jmp((void *)0x00AA4150, &game_heap_reallocate); 260 | patch_jmp((void *)0x00AA4200, &game_heap_reallocate); 261 | patch_jmp((void *)0x00AA44C0, &game_heap_msize); 262 | patch_jmp((void *)0x00AA4060, &game_heap_free); 263 | 264 | patch_ret((void *)0x00AA6840); 265 | patch_ret((void *)0x00866E00); 266 | patch_ret((void *)0x00866770); 267 | 268 | patch_ret((void *)0x00AA6F90); 269 | patch_ret((void *)0x00AA7030); 270 | patch_ret((void *)0x00AA7290); 271 | patch_ret((void *)0x00AA7300); 272 | 273 | patch_ret((void *)0x00AA58D0); 274 | patch_ret((void *)0x00866D10); 275 | patch_ret((void *)0x00AA5C80); 276 | 277 | patch_jmp((void *)0x00AA53F0, &sheap_init_fix); 278 | patch_jmp((void *)0x00AA5410, &sheap_init_var); 279 | patch_jmp((void *)0x00AA54A0, &sheap_alloc); 280 | patch_jmp((void *)0x00AA5610, &sheap_free); 281 | patch_jmp((void *)0x00AA5460, &sheap_purge); 282 | 283 | patch_nops((void *)0x00AA38CA, 0x00AA38E8 - 0x00AA38CA); 284 | patch_jmp((void *)0x00AA42E0, &sheap_get_thread_local); 285 | 286 | patch_nop_call((void *)0x00AA3060); 287 | 288 | patch_nop_call((void *)0x0086C56F); 289 | patch_nop_call((void *)0x00C42EB1); 290 | patch_nop_call((void *)0x00EC1701); 291 | 292 | patch_bytes((void *)0x0086EED4, (BYTE *)"\xEB\x55", 2); 293 | 294 | #elif defined(FO3) 295 | 296 | patch_jmp((void *)0x00C063F5, &crt_malloc); 297 | patch_jmp((void *)0x00C0AB3F, &crt_malloc); 298 | patch_jmp((void *)0x00C1843C, &crt_calloc); 299 | patch_jmp((void *)0x00C0AB7F, &crt_calloc); 300 | patch_jmp((void *)0x00C06546, &crt_realloc); 301 | patch_jmp((void *)0x00C0ABC7, &crt_realloc); 302 | patch_jmp((void *)0x00C06761, &crt_recalloc); 303 | patch_jmp((void *)0x00C0AC12, &crt_recalloc); 304 | patch_jmp((void *)0x00C067DA, &crt_msize); 305 | patch_jmp((void *)0x00C064B8, &crt_free); 306 | 307 | patch_jmp((void *)0x0086B930, &game_heap_allocate); 308 | patch_jmp((void *)0x0086BAE0, &game_heap_reallocate); 309 | patch_jmp((void *)0x0086BB50, &game_heap_reallocate); 310 | patch_jmp((void *)0x0086B8C0, &game_heap_msize); 311 | patch_jmp((void *)0x0086BA60, &game_heap_free); 312 | 313 | patch_ret((void *)0x0086D670); 314 | patch_ret((void *)0x006E21F0); 315 | patch_ret((void *)0x006E1E10); 316 | 317 | patch_ret((void *)0x0086C600); 318 | patch_ret((void *)0x006E1CD0); 319 | patch_ret((void *)0x0086CA30); 320 | 321 | patch_jmp((void *)0x0086CB70, &sheap_init_fix); 322 | patch_jmp((void *)0x0086CB90, &sheap_init_var); 323 | patch_jmp((void *)0x0086C710, &sheap_alloc); 324 | patch_jmp((void *)0x0086C7B0, &sheap_free); 325 | patch_jmp((void *)0x0086CAA0, &sheap_purge); 326 | 327 | patch_nops((void *)0x0086C038, 0x0086C086 - 0x0086C038); 328 | patch_jmp((void *)0x0086BCB0, &sheap_get_thread_local); 329 | 330 | patch_nop_call((void *)0x006E9B30); 331 | patch_nop_call((void *)0x007FACDB); 332 | patch_nop_call((void *)0x00AA6534); 333 | 334 | #endif 335 | } 336 | -------------------------------------------------------------------------------- /heap_replacer/main/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "defs.h" 5 | #include "heap_replacer.h" 6 | #include "util.h" 7 | 8 | BOOL(WINAPI *old_qpc)(LARGE_INTEGER *); 9 | 10 | BOOL WINAPI qpc_hook(LARGE_INTEGER *lpPerformanceCount) 11 | { 12 | void *addr; 13 | HMODULE hmd = GetModuleHandle(NULL); 14 | 15 | HR_LOG("QPC hook executing..."); 16 | 17 | apply_hr_hooks(); 18 | 19 | HR_LOG("hooks applied."); 20 | 21 | HR_LOG("cleaning QPC hook..."); 22 | 23 | addr = get_import_address(hmd, "kernel32.dll", "QueryPerformanceCounter"); 24 | 25 | patch_func_ptr(addr, old_qpc); 26 | return old_qpc(lpPerformanceCount); 27 | } 28 | 29 | void create_loader_hook(void) 30 | { 31 | HMODULE hmd = GetModuleHandle(NULL); 32 | 33 | HR_LOG("module base is at 0x%08X", (DWORD)hmd); 34 | 35 | void *addr = 36 | get_import_address(hmd, "kernel32.dll", "QueryPerformanceCounter"); 37 | 38 | HR_LOG("kernel32.dll::QueryPerformanceCounter is at 0x%08X", (DWORD)addr); 39 | 40 | if (((DWORD)addr & HR_GAME_QPC_HOOK) == HR_GAME_QPC_HOOK) 41 | { 42 | if (is_large_addr_aware(hmd)) 43 | { 44 | HR_LOG("creating QPC hook at 0x%08X...", (DWORD)addr); 45 | patch_detour(addr, &qpc_hook, (void **)&old_qpc); 46 | } 47 | else 48 | { 49 | HR_MSGBOX(L"Your game is not LAA, please apply a 4GB patcher", 50 | MB_ICONERROR); 51 | } 52 | } 53 | else if (((DWORD)addr & HR_GECK_QPC_HOOK) != HR_GECK_QPC_HOOK) 54 | { 55 | HR_MSGBOX(L"Incompatible game executable. Please use version " 56 | L"(" HR_GAME_VERSION ")", 57 | MB_ICONERROR); 58 | } 59 | } 60 | 61 | BOOL APIENTRY DllMain(HMODULE hModule, DWORD fdwReason, LPVOID lpReserved) 62 | { 63 | /* while (!IsDebuggerPresent()) 64 | { 65 | Sleep(1); 66 | } */ 67 | 68 | if (fdwReason == DLL_PROCESS_ATTACH) 69 | { 70 | DisableThreadLibraryCalls(hModule); 71 | 72 | log_file = fopen("hr.log", "w"); 73 | nlock_init(&log_lock); 74 | 75 | create_loader_hook(); 76 | } 77 | 78 | return TRUE; 79 | } 80 | -------------------------------------------------------------------------------- /heap_replacer/main/util.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #define KB (1024u * 1u) 10 | #define MB (1024u * KB) 11 | #define GB (1024u * MB) 12 | 13 | #define USUM(a, b) ((unsigned int)(a) + (unsigned int)(b)) 14 | #define USUB(a, b) ((unsigned int)(a) - (unsigned int)(b)) 15 | 16 | #define VSUM(a, b) ((void *)(USUM(a, b))) 17 | #define VSUB(a, b) ((void *)(USUB(a, b))) 18 | 19 | #define ROUND_UP(x, y) (USUM(((USUB((x), 1)) | (USUB((y), 1))), 1)) 20 | #define ROUND_DOWN(x, y) ((unsigned int)(x) & ~(USUB((y), 1)))) 21 | 22 | #define countof(a) (sizeof(a) / sizeof(a[0])) 23 | 24 | void *hr_winapi_alloc(size_t size) 25 | { 26 | return VirtualAlloc(NULL, size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); 27 | } 28 | 29 | void *hr_winapi_malloc(size_t size) 30 | { 31 | return hr_winapi_alloc(size); 32 | } 33 | 34 | void *hr_winapi_calloc(size_t count, size_t size) 35 | { 36 | return hr_winapi_alloc(count * size); 37 | } 38 | 39 | void hr_winapi_free(void *addr) 40 | { 41 | VirtualFree(addr, 0, MEM_RELEASE); 42 | } 43 | 44 | void hr_memset8(void *dst, BYTE val, size_t cnt) 45 | { 46 | for (BYTE *pos = (BYTE *)dst; cnt--; *pos++ = val) 47 | { 48 | } 49 | } 50 | 51 | void hr_memset16(void *dst, WORD val, size_t cnt) 52 | { 53 | for (WORD *pos = (WORD *)dst; cnt--; *pos++ = val) 54 | { 55 | } 56 | } 57 | 58 | void hr_memset32(void *dst, DWORD val, size_t cnt) 59 | { 60 | for (DWORD *pos = (DWORD *)dst; cnt--; *pos++ = val) 61 | { 62 | } 63 | } 64 | 65 | void patch_bytes(void *addr, BYTE *data, DWORD size) 66 | { 67 | DWORD p; 68 | VirtualProtect(addr, size, PAGE_EXECUTE_READWRITE, &p); 69 | memcpy(addr, data, size); 70 | VirtualProtect(addr, size, p, &p); 71 | FlushInstructionCache(GetCurrentProcess(), addr, size); 72 | } 73 | 74 | void patch_BYTE(void *addr, BYTE data) 75 | { 76 | patch_bytes(addr, &data, 1u); 77 | } 78 | 79 | void patch_WORD(void *addr, WORD data) 80 | { 81 | BYTE bytes[2]; 82 | *(WORD *)bytes = data; 83 | patch_bytes(addr, bytes, 2u); 84 | } 85 | 86 | void patch_DWORD(void *addr, DWORD data) 87 | { 88 | BYTE bytes[4]; 89 | *(DWORD *)bytes = data; 90 | patch_bytes(addr, bytes, 4u); 91 | } 92 | 93 | void patch_func_ptr(void *addr, void *ptr) 94 | { 95 | patch_DWORD(addr, (DWORD)ptr); 96 | } 97 | 98 | void patch_detour(void *addr, void *new_func, void **old_func) 99 | { 100 | *old_func = *(void **)addr; 101 | patch_func_ptr(addr, new_func); 102 | } 103 | 104 | void patch_call(void *addr, void *dst) 105 | { 106 | BYTE bytes[5]; 107 | bytes[0] = 0xE8u; 108 | *(DWORD *)((DWORD)bytes + 1u) = (DWORD)dst - (DWORD)addr - 5u; 109 | patch_bytes(addr, bytes, 5u); 110 | } 111 | 112 | void patch_jmp(void *addr, void *dst) 113 | { 114 | BYTE bytes[5]; 115 | bytes[0] = 0xE9u; 116 | *(DWORD *)((DWORD)bytes + 1u) = (DWORD)dst - (DWORD)addr - 5u; 117 | patch_bytes(addr, bytes, 5u); 118 | } 119 | 120 | void patch_ret(void *addr) 121 | { 122 | BYTE bytes = 0xC3u; 123 | patch_bytes(addr, &bytes, 1u); 124 | } 125 | 126 | void patch_ret_argc(void *addr, size_t argc) 127 | { 128 | BYTE bytes = 0xC2u; 129 | patch_bytes(addr, &bytes, 1u); 130 | patch_WORD(VSUM(addr, 1u), (WORD)(4u * argc)); 131 | } 132 | 133 | void patch_bp(void *addr) 134 | { 135 | BYTE bytes = 0xCCu; 136 | patch_bytes(addr, &bytes, 1u); 137 | } 138 | 139 | void patch_nops(void *addr, size_t count) 140 | { 141 | BYTE *bytes = _alloca(count); 142 | memset(bytes, 0x90u, count); 143 | patch_bytes(addr, bytes, count); 144 | } 145 | 146 | void patch_nop_call(void *addr) 147 | { 148 | patch_nops(addr, 5u); 149 | } 150 | 151 | void patch_call_nops(void *addr, void *dst, size_t nops) 152 | { 153 | patch_call(addr, dst); 154 | patch_nops(VSUM(addr, 5u), nops); 155 | } 156 | 157 | void detour_vtable(void *obj, size_t index, void *new_func, void **old_func) 158 | { 159 | void **vtable = *(void ***)obj; 160 | *old_func = vtable[index]; 161 | patch_func_ptr(&vtable[index], new_func); 162 | } 163 | 164 | void *get_import_address(HMODULE hmd, const char *dll_name, 165 | const char *func_name) 166 | { 167 | char *base = (char *)hmd; 168 | int i; 169 | const char *loaded_dll; 170 | char *import_name; 171 | 172 | IMAGE_THUNK_DATA *name_table; 173 | IMAGE_THUNK_DATA *import_table; 174 | IMAGE_DOS_HEADER *dos_header = (IMAGE_DOS_HEADER *)base; 175 | IMAGE_NT_HEADERS *nt_headers = 176 | (IMAGE_NT_HEADERS *)(base + dos_header->e_lfanew); 177 | IMAGE_DATA_DIRECTORY section = 178 | nt_headers->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT]; 179 | IMAGE_IMPORT_DESCRIPTOR *import_descriptor = 180 | (IMAGE_IMPORT_DESCRIPTOR *)(base + section.VirtualAddress); 181 | 182 | for (i = 0; import_descriptor[i].Name; i++) 183 | { 184 | loaded_dll = (const char *)(base + import_descriptor[i].Name); 185 | 186 | if (!_stricmp(loaded_dll, dll_name)) 187 | { 188 | if (!import_descriptor[i].FirstThunk) 189 | { 190 | return NULL; 191 | } 192 | name_table = 193 | (IMAGE_THUNK_DATA *)(base + 194 | import_descriptor[i].OriginalFirstThunk); 195 | import_table = 196 | (IMAGE_THUNK_DATA *)(base + import_descriptor[i].FirstThunk); 197 | while (name_table->u1.Ordinal) 198 | { 199 | if (!IMAGE_SNAP_BY_ORDINAL(name_table->u1.Ordinal)) 200 | { 201 | import_name = 202 | ((IMAGE_IMPORT_BY_NAME *)(base + name_table->u1 203 | .ForwarderString)) 204 | ->Name; 205 | 206 | if (!_stricmp(import_name, func_name)) 207 | { 208 | return &import_table->u1.AddressOfData; 209 | } 210 | } 211 | name_table++; 212 | import_table++; 213 | } 214 | } 215 | } 216 | return NULL; 217 | } 218 | 219 | int is_large_addr_aware(HMODULE hmd) 220 | { 221 | char *base = (char *)hmd; 222 | IMAGE_DOS_HEADER *dos_header = (IMAGE_DOS_HEADER *)base; 223 | IMAGE_NT_HEADERS *nt_headers = 224 | (IMAGE_NT_HEADERS *)(base + dos_header->e_lfanew); 225 | return (nt_headers->FileHeader.Characteristics & 226 | IMAGE_FILE_LARGE_ADDRESS_AWARE) == IMAGE_FILE_LARGE_ADDRESS_AWARE; 227 | } 228 | 229 | int file_exists(const char *name) 230 | { 231 | int ret = 0; 232 | FILE *file; 233 | 234 | if (file = fopen(name, "r")) 235 | { 236 | fclose(file); 237 | ret = 1; 238 | goto end; 239 | } 240 | 241 | end: 242 | return ret; 243 | } 244 | 245 | char *get_time(char *buff, size_t size) 246 | { 247 | time_t timet; 248 | time(&timet); 249 | strftime(buff, size, "%H:%M:%S", localtime(&timet)); 250 | return buff + size; 251 | } 252 | -------------------------------------------------------------------------------- /heap_replacer/mheap/mheap.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "main/util.h" 4 | #include "mheap_defs.h" 5 | #include "mpool.h" 6 | 7 | struct pool_data 8 | { 9 | size_t item_size; 10 | size_t max_size; 11 | }; 12 | 13 | /* POOLS SIZE MUST BE A MULTIPLE OF POOL_ALIGN !!! */ 14 | struct pool_data pool_desc[] = { 15 | {8u, 32u * MB}, {12u, 32u * MB}, {16u, 32u * MB}, {20u, 16u * MB}, 16 | {24u, 16u * MB}, {28u, 16u * MB}, {32u, 16u * MB}, {40u, 16u * MB}, 17 | {48u, 16u * MB}, {56u, 16u * MB}, {64u, 16u * MB}, {80u, 128u * MB}, 18 | {96u, 128u * MB}, {112u, 32u * MB}, {128u, 32u * MB}, {160u, 32u * MB}, 19 | {192u, 32u * MB}, {224u, 32u * MB}, {256u, 16u * MB}, {320u, 32u * MB}, 20 | {384u, 16u * MB}, {448u, 64u * MB}, {512u, 32u * MB}, {640u, 64u * MB}, 21 | {768u, 16u * MB}, {896u, 16u * MB}, {1024u, 32u * MB}, {1280u, 64u * MB}, 22 | {1536u, 64u * MB}, {1792u, 16u * MB}, {2048u, 32u * MB}, {2560u, 16u * MB}, 23 | {3072u, 32u * MB}, {3584u, 32u * MB}, 24 | }; 25 | 26 | struct mheap 27 | { 28 | struct mpool *pools_by_size[POOL_SIZE_ARRAY_LEN]; 29 | struct mpool *pools_by_addr[POOL_ADDR_ARRAY_LEN]; 30 | struct mpool *pools_by_indx[POOL_INDX_ARRAY_LEN]; 31 | struct pool_data pool_desc[countof(pool_desc)]; 32 | }; 33 | 34 | void mheap_init_pools(struct mheap *heap); 35 | 36 | void mheap_init(struct mheap *heap) 37 | { 38 | hr_memset8(heap->pools_by_size, 0, 39 | POOL_SIZE_ARRAY_LEN * sizeof(struct mpool *)); 40 | hr_memset8(heap->pools_by_addr, 0, 41 | POOL_ADDR_ARRAY_LEN * sizeof(struct mpool *)); 42 | hr_memset8(heap->pools_by_indx, 0, 43 | POOL_INDX_ARRAY_LEN * sizeof(struct mpool *)); 44 | mheap_init_pools(heap); 45 | } 46 | 47 | void mheap_init_pools(struct mheap *heap) 48 | { 49 | size_t p; 50 | size_t i; 51 | for (p = 0; p < countof(pool_desc); p++) 52 | { 53 | struct pool_data *pd = &pool_desc[p]; 54 | struct mpool *pool = 55 | (struct mpool *)hr_winapi_malloc(sizeof(struct mpool)); 56 | 57 | if (!pool) 58 | { 59 | continue; 60 | } 61 | 62 | mpool_init(pool, pd->item_size, pd->max_size, p); 63 | 64 | void *addr = mpool_setup(pool); 65 | 66 | if (!addr) 67 | { 68 | continue; 69 | } 70 | 71 | HR_LOG("pool %d at 0x%08X", pd->item_size, (DWORD)addr); 72 | 73 | if (p == 0) 74 | { 75 | heap->pools_by_size[0] = pool; 76 | heap->pools_by_size[1] = pool; 77 | } 78 | heap->pools_by_indx[p] = pool; 79 | for (i = pd->item_size >> 2u; i && !heap->pools_by_size[i]; i--) 80 | { 81 | heap->pools_by_size[i] = pool; 82 | } 83 | for (i = 0; i < ((pd->max_size + (POOL_ALIGN - 1u)) / POOL_ALIGN); i++) 84 | { 85 | heap->pools_by_addr[((uintptr_t)addr / POOL_ALIGN) + i] = pool; 86 | } 87 | } 88 | } 89 | 90 | struct mpool *mheap_pool_from_size(struct mheap *heap, size_t size) 91 | { 92 | return heap->pools_by_size[(size + 3u) >> 2u]; 93 | } 94 | 95 | struct mpool *mheap_pool_from_addr(struct mheap *heap, void *addr) 96 | { 97 | return heap->pools_by_addr[(uintptr_t)addr / POOL_ALIGN]; 98 | } 99 | 100 | struct mpool *mheap_pool_from_indx(struct mheap *heap, size_t indx) 101 | { 102 | return heap->pools_by_indx[indx]; 103 | } 104 | 105 | void *mheap_malloc(struct mheap *heap, size_t size) 106 | { 107 | void *addr = NULL; 108 | size_t index; 109 | struct mpool *pool = mheap_pool_from_size(heap, size); 110 | 111 | if (addr = mpool_malloc(pool, size)) 112 | { 113 | goto end; 114 | } 115 | 116 | index = mpool_get_index(pool); 117 | while (++index < countof(pool_desc)) 118 | { 119 | pool = mheap_pool_from_indx(heap, index); 120 | if (addr = mpool_malloc(pool, size)) 121 | { 122 | goto end; 123 | } 124 | } 125 | 126 | end: 127 | return addr; 128 | } 129 | 130 | void *mheap_calloc(struct mheap *heap, size_t size) 131 | { 132 | void *addr = mheap_malloc(heap, size); 133 | 134 | if (addr) 135 | { 136 | hr_memset32(addr, 0, (size + 3u) >> 2u); 137 | } 138 | 139 | return addr; 140 | } 141 | 142 | size_t mheap_mem_size(struct mheap *heap, void *addr) 143 | { 144 | size_t ret = 0; 145 | struct mpool *pool = mheap_pool_from_addr(heap, addr); 146 | 147 | if (!pool) 148 | { 149 | goto end; 150 | } 151 | 152 | ret = mpool_mem_size(pool, addr); 153 | 154 | end: 155 | return ret; 156 | } 157 | 158 | int mheap_free(struct mheap *heap, void *addr) 159 | { 160 | int ret = 0; 161 | struct mpool *pool = mheap_pool_from_addr(heap, addr); 162 | 163 | if (!pool) 164 | { 165 | goto end; 166 | } 167 | 168 | ret = 1; 169 | 170 | mpool_free(pool, addr); 171 | 172 | end: 173 | return ret; 174 | } 175 | -------------------------------------------------------------------------------- /heap_replacer/mheap/mheap_defs.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define POOL_ALIGN (0x01000000u) 4 | #define POOL_BLOCK_SIZE (0x00100000u) 5 | 6 | #define POOL_MAX_ALLOC_SIZE (3584u) 7 | 8 | #define POOL_SIZE_ARRAY_LEN (((POOL_MAX_ALLOC_SIZE) >> 2u) + 1u) 9 | #define POOL_ADDR_ARRAY_LEN ((0x80000000u / (POOL_ALIGN)) << 1u) 10 | #define POOL_INDX_ARRAY_LEN (countof(pool_desc)) 11 | -------------------------------------------------------------------------------- /heap_replacer/mheap/mpool - Copy.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "locks/nlock.h" 4 | #include "main/util.h" 5 | #include "mheap.h" 6 | #include "mheap_defs.h" 7 | 8 | struct cell 9 | { 10 | struct cell *next; 11 | }; 12 | 13 | union pool_state { 14 | struct 15 | { 16 | struct cell *next_free; 17 | __int32 counter; 18 | }; 19 | __int64 state; 20 | }; 21 | 22 | struct mpool 23 | { 24 | size_t item_size; 25 | size_t max_size; 26 | size_t cell_count; 27 | size_t max_cell_count; 28 | 29 | size_t block_count; 30 | size_t cells_per_block; 31 | 32 | void *bgn; 33 | void *cur; 34 | void *end; 35 | 36 | struct cell *free_cells; 37 | 38 | struct cell *saved_next; 39 | int busy; 40 | 41 | union { 42 | struct 43 | { 44 | struct cell *next_free; 45 | __int32 counter; 46 | }; 47 | __int64 state; 48 | }; 49 | 50 | size_t index; 51 | 52 | struct nlock lock; 53 | }; 54 | 55 | struct cell *mpool_setup_new_block(struct mpool *pool); 56 | 57 | void mpool_init(struct mpool *pool, size_t item_size, size_t max_size, 58 | size_t index) 59 | { 60 | pool->item_size = item_size; 61 | pool->max_size = max_size; 62 | pool->cell_count = 0; 63 | 64 | pool->bgn = NULL; 65 | pool->cur = NULL; 66 | pool->end = NULL; 67 | 68 | pool->block_count = pool->max_size / POOL_BLOCK_SIZE; 69 | pool->cells_per_block = POOL_BLOCK_SIZE / pool->item_size; 70 | 71 | pool->max_cell_count = pool->block_count * pool->cells_per_block; 72 | 73 | pool->free_cells = 74 | (struct cell *)winapi_calloc(pool->max_cell_count, sizeof(struct cell)); 75 | pool->next_free = NULL; 76 | 77 | pool->index = index; 78 | 79 | nlock_init(&pool->lock); 80 | } 81 | 82 | void *mpool_setup(struct mpool *pool) 83 | { 84 | size_t i = 0; 85 | 86 | while (!pool->bgn) 87 | { 88 | pool->bgn = VirtualAlloc((void *)(++i * POOL_ALIGN), pool->max_size, 89 | MEM_RESERVE, PAGE_READWRITE); // large pages 90 | if (i == 0xff) 91 | { 92 | i = 0; 93 | } 94 | } 95 | pool->cur = pool->bgn; 96 | pool->end = VSUM(pool->bgn, pool->max_size); 97 | 98 | pool->saved_next = mpool_setup_new_block(pool); 99 | pool->busy = 0; 100 | 101 | return pool->bgn; 102 | } 103 | 104 | struct cell *mpool_setup_new_block(struct mpool *pool) 105 | { 106 | pool->cur = 107 | VirtualAlloc(pool->cur, POOL_BLOCK_SIZE, MEM_COMMIT, PAGE_READWRITE); 108 | size_t bank_offset = 109 | USUB(pool->cur, pool->bgn) / POOL_BLOCK_SIZE * pool->cells_per_block; 110 | 111 | if (pool->item_size == 196) 112 | { 113 | printf("bank_offset: %d\n", bank_offset); 114 | } 115 | 116 | for (size_t i = 0u; i < pool->cells_per_block - 1u; i++) 117 | { 118 | pool->free_cells[bank_offset + i].next = 119 | &pool->free_cells[bank_offset + i + 1u]; 120 | } 121 | 122 | pool->free_cells[bank_offset + pool->cells_per_block - 1u].next = NULL; 123 | 124 | pool->cur = VSUM(pool->cur, POOL_BLOCK_SIZE); 125 | 126 | return &pool->free_cells[bank_offset]; 127 | } 128 | 129 | void *mpool_translate_to_real(struct mpool *pool, void *addr) 130 | { 131 | return VSUM(pool->bgn, 132 | ((USUB(addr, pool->free_cells) >> 2u) * pool->item_size)); 133 | } 134 | 135 | void *mpool_translate_from_real(struct mpool *pool, void *addr) 136 | { 137 | return VSUM(((USUB(addr, pool->bgn) / pool->item_size) << 2u), 138 | pool->free_cells); 139 | } 140 | 141 | int mpool_is_in_range(struct mpool *pool, void *addr) 142 | { 143 | return ((pool->bgn <= addr) & (addr < pool->end)); 144 | } 145 | 146 | void *mpool_malloc(struct mpool *pool) 147 | { 148 | union pool_state os, ns; 149 | 150 | struct cell *old_free; 151 | 152 | do 153 | { 154 | if (InterlockedCompareExchange(&pool->next_free, NULL, NULL) == NULL) 155 | { 156 | if (InterlockedCompareExchange(&pool->busy, 1, 0) == 0) 157 | { 158 | do 159 | { 160 | os.state = pool->state; 161 | (pool->saved_next + pool->cells_per_block - 1u)->next = 162 | os.next_free; 163 | 164 | ns.next_free = pool->saved_next; 165 | ns.counter = os.counter + 1; 166 | } while (InterlockedCompareExchange64(&pool->state, ns.state, 167 | os.state) != os.state); 168 | 169 | pool->saved_next = mpool_setup_new_block(pool); 170 | pool->busy = 0; 171 | } 172 | else 173 | { 174 | printf("spin\n"); 175 | Sleep(0u); 176 | continue; 177 | } 178 | } 179 | 180 | os.state = pool->state; 181 | old_free = os.next_free; 182 | 183 | ns.next_free = old_free->next; 184 | ns.counter = os.counter + 1; 185 | 186 | } while (InterlockedCompareExchange64(&pool->state, ns.state, os.state) != 187 | os.state); 188 | 189 | old_free->next = NULL; 190 | 191 | void *addr = mpool_translate_to_real(pool, old_free); 192 | 193 | return addr; 194 | } 195 | 196 | void *mpool_calloc(struct mpool *pool) 197 | { 198 | void *addr = mpool_malloc(pool); 199 | if (addr) 200 | { 201 | cmemset32(addr, 0, pool->item_size >> 2u); 202 | } 203 | return addr; 204 | } 205 | 206 | size_t mpool_mem_size(struct mpool *pool) 207 | { 208 | return pool->item_size; 209 | } 210 | 211 | void mpool_free(struct mpool *pool, void *addr) 212 | { 213 | struct cell *c = (struct cell *)mpool_translate_from_real(pool, addr); 214 | 215 | union pool_state os, ns; 216 | 217 | if (InterlockedCompareExchangePointer(&c->next, NULL, 0xffffffff) == NULL) 218 | { 219 | do 220 | { 221 | os.state = pool->state; 222 | c->next = os.next_free; 223 | 224 | ns.next_free = c; 225 | ns.counter = os.counter + 1; 226 | 227 | } while (InterlockedCompareExchange64(&pool->state, ns.state, 228 | os.state) != os.state); 229 | } 230 | else 231 | { 232 | printf("invalid free\n"); 233 | } 234 | } 235 | 236 | size_t mpool_get_index(struct mpool *pool) 237 | { 238 | return pool->index; 239 | } 240 | -------------------------------------------------------------------------------- /heap_replacer/mheap/mpool.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "locks/nlock.h" 4 | #include "main/util.h" 5 | #include "mheap.h" 6 | #include "mheap_defs.h" 7 | 8 | struct cell 9 | { 10 | struct cell *next; 11 | }; 12 | 13 | struct mpool 14 | { 15 | size_t item_size; 16 | size_t max_size; 17 | size_t max_cell_count; 18 | 19 | size_t block_count; 20 | size_t cells_per_block; 21 | 22 | void *bgn; 23 | void *cur; 24 | void *end; 25 | 26 | struct cell *free_cells; 27 | struct cell *next_free; 28 | 29 | size_t index; 30 | 31 | struct nlock lock; 32 | }; 33 | 34 | void mpool_init(struct mpool *pool, size_t item_size, size_t max_size, 35 | size_t index) 36 | { 37 | pool->item_size = item_size; 38 | pool->max_size = max_size; 39 | 40 | pool->bgn = NULL; 41 | pool->cur = NULL; 42 | pool->end = NULL; 43 | 44 | pool->block_count = pool->max_size / POOL_BLOCK_SIZE; 45 | pool->cells_per_block = POOL_BLOCK_SIZE / pool->item_size; 46 | 47 | pool->max_cell_count = pool->block_count * pool->cells_per_block; 48 | 49 | pool->free_cells = (struct cell *)hr_winapi_calloc(pool->max_cell_count, 50 | sizeof(struct cell)); 51 | pool->next_free = pool->free_cells; 52 | 53 | pool->index = index; 54 | 55 | nlock_init(&pool->lock); 56 | } 57 | 58 | void *mpool_setup(struct mpool *pool) 59 | { 60 | size_t i = 0; 61 | 62 | while (!pool->bgn) 63 | { 64 | pool->bgn = VirtualAlloc((void *)(++i * POOL_ALIGN), pool->max_size, 65 | MEM_RESERVE, PAGE_READWRITE); 66 | if (i == 0xff) 67 | { 68 | i = 0; 69 | } 70 | } 71 | pool->cur = pool->bgn; 72 | pool->end = VSUM(pool->bgn, pool->max_size); 73 | 74 | return pool->bgn; 75 | } 76 | 77 | void mpool_setup_new_block(struct mpool *pool) 78 | { 79 | pool->cur = 80 | VirtualAlloc(pool->cur, POOL_BLOCK_SIZE, MEM_COMMIT, PAGE_READWRITE); 81 | size_t bank_offset = 82 | USUB(pool->cur, pool->bgn) / POOL_BLOCK_SIZE * pool->cells_per_block; 83 | 84 | pool->free_cells[bank_offset].next = NULL; 85 | for (size_t i = 0u; i < pool->cells_per_block - 1u; i++) 86 | { 87 | pool->free_cells[bank_offset + i + 1u].next = 88 | &pool->free_cells[bank_offset + i]; 89 | } 90 | pool->next_free = 91 | &pool->free_cells[bank_offset + pool->cells_per_block - 1u]; 92 | 93 | pool->cur = VSUM(pool->cur, POOL_BLOCK_SIZE); 94 | } 95 | 96 | void *mpool_free_ptr_to_real(struct mpool *pool, void *addr) 97 | { 98 | return VSUM(pool->bgn, 99 | ((USUB(addr, pool->free_cells) >> 2u) * pool->item_size)); 100 | } 101 | 102 | void *mpool_real_to_free_ptr(struct mpool *pool, void *addr) 103 | { 104 | return VSUM(((USUB(addr, pool->bgn) / pool->item_size) << 2u), 105 | pool->free_cells); 106 | } 107 | 108 | int mpool_is_in_range(struct mpool *pool, void *addr) 109 | { 110 | return ((pool->bgn <= addr) & (addr < pool->end)); 111 | } 112 | 113 | void *mpool_malloc(struct mpool *pool, size_t size) 114 | { 115 | void *addr; 116 | struct cell *old_free; 117 | 118 | nlock_lock(&pool->lock); 119 | 120 | if (!pool->next_free->next) 121 | { 122 | if (pool->cur == pool->end) 123 | { 124 | nlock_unlock(&pool->lock); 125 | return NULL; 126 | } 127 | mpool_setup_new_block(pool); 128 | } 129 | 130 | __assume(pool->next_free != NULL); 131 | 132 | old_free = pool->next_free; 133 | pool->next_free = pool->next_free->next; 134 | 135 | nlock_unlock(&pool->lock); 136 | 137 | old_free->next = NULL; 138 | addr = mpool_free_ptr_to_real(pool, old_free); 139 | 140 | return addr; 141 | } 142 | 143 | size_t mpool_mem_size(struct mpool *pool, void *addr) 144 | { 145 | return pool->item_size; 146 | } 147 | 148 | void mpool_free(struct mpool *pool, void *addr) 149 | { 150 | struct cell *c = (struct cell *)mpool_real_to_free_ptr(pool, addr); 151 | 152 | nlock_lock(&pool->lock); 153 | 154 | if (!c->next) 155 | { 156 | c->next = pool->next_free; 157 | pool->next_free = c; 158 | } 159 | 160 | nlock_unlock(&pool->lock); 161 | } 162 | 163 | size_t mpool_get_index(struct mpool *pool) 164 | { 165 | return pool->index; 166 | } 167 | -------------------------------------------------------------------------------- /heap_replacer/sheap/sheap.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "main/util.h" 4 | #include "sheap_defs.h" 5 | 6 | struct schnk 7 | { 8 | struct 9 | { 10 | size_t index : 8; 11 | size_t size : 24; 12 | }; 13 | struct schnk *prev; 14 | }; 15 | 16 | struct sheap 17 | { 18 | void **blocks; 19 | void *cur; 20 | struct schnk *last; 21 | }; 22 | 23 | void sheap_purge(struct sheap *heap, void *edx); 24 | 25 | void sheap_init(struct sheap *heap) 26 | { 27 | heap->blocks = (void **)hr_calloc(SHEAP_MAX_BLOCKS, sizeof(void *)); 28 | heap->blocks[0] = hr_malloc(SHEAP_BUFF_SIZE); 29 | heap->cur = heap->blocks[0]; 30 | heap->last = NULL; 31 | } 32 | 33 | void sheap_init_fix(struct sheap *heap, void *edx) 34 | { 35 | sheap_init(heap); 36 | } 37 | 38 | void sheap_init_var(struct sheap *heap, void *edx, size_t size) 39 | { 40 | sheap_init(heap); 41 | } 42 | 43 | void *sheap_alloc(struct sheap *heap, void *edx, size_t size, size_t align) 44 | { 45 | struct schnk *hdr; 46 | int i = heap->last ? heap->last->index : 0; 47 | void *alloc_end = VSUM(ROUND_UP(heap->cur, 4), sizeof(struct schnk) + size); 48 | void *block_end = VSUM(heap->blocks[i], SHEAP_BUFF_SIZE); 49 | 50 | if (alloc_end > block_end) 51 | { 52 | ++i; 53 | if (i == SHEAP_MAX_BLOCKS) 54 | { 55 | HR_LOG("no more block space available"); 56 | return NULL; 57 | } 58 | 59 | if (!heap->blocks[i]) 60 | { 61 | heap->blocks[i] = hr_malloc(SHEAP_BUFF_SIZE); 62 | if (!heap->blocks[i]) 63 | { 64 | HR_LOG("failed to allocate new block"); 65 | return NULL; 66 | } 67 | } 68 | 69 | heap->cur = heap->blocks[i]; 70 | 71 | HR_LOG("0x%08X created new block %d at 0x%08X", (DWORD)heap, i, 72 | (DWORD)heap->blocks[i]); 73 | } 74 | 75 | hdr = (struct schnk *)ROUND_UP(heap->cur, 4); 76 | 77 | hdr->index = i; 78 | hdr->size = size; 79 | hdr->prev = heap->last; 80 | 81 | heap->last = hdr++; 82 | heap->cur = VSUM(hdr, size); 83 | 84 | return hdr; 85 | } 86 | 87 | void sheap_free(struct sheap *heap, void *edx, void *addr) 88 | { 89 | int i, j = 0; 90 | struct schnk *chunk = (struct schnk *)VSUB(addr, sizeof(struct schnk)); 91 | 92 | if (addr && !(chunk->size & SHEAP_FREE)) 93 | { 94 | for (chunk->size |= SHEAP_FREE; 95 | heap->last && (heap->last->size & SHEAP_FREE); 96 | heap->last = heap->last->prev) 97 | { 98 | i = heap->last->index + 1; 99 | if ((i != j) && heap->blocks[i]) 100 | { 101 | HR_LOG("0x%08X deleted old block %d at 0x%08X", (DWORD)heap, i, 102 | (DWORD)heap->blocks[i]); 103 | hr_free(heap->blocks[i]); 104 | heap->blocks[i] = NULL; 105 | j = i; 106 | } 107 | } 108 | 109 | heap->cur = heap->last ? VSUM(heap->last, 110 | sizeof(struct schnk) + heap->last->size) 111 | : heap->blocks[0]; 112 | } 113 | } 114 | 115 | void sheap_purge(struct sheap *heap, void *edx) 116 | { 117 | int i; 118 | 119 | for (i = 0; i < SHEAP_MAX_BLOCKS && heap->blocks[i]; i++) 120 | { 121 | hr_free(heap->blocks[i]); 122 | heap->blocks[i] = NULL; 123 | } 124 | 125 | for (; i < SHEAP_MAX_BLOCKS; i++) 126 | { 127 | if (heap->blocks[i]) 128 | { 129 | HR_LOG("leak detected %d", i); 130 | } 131 | } 132 | 133 | hr_free(heap->blocks); 134 | } 135 | 136 | struct sheap *sheap_get_thread_local(void) 137 | { 138 | static __declspec(thread) struct sheap *heap = NULL; 139 | DWORD id; 140 | 141 | if (!heap) 142 | { 143 | heap = (struct sheap *)hr_malloc(sizeof(struct sheap)); 144 | if (!heap) 145 | { 146 | HR_LOG("failed to allocate new sheap"); 147 | goto end; 148 | } 149 | sheap_init(heap); 150 | 151 | id = GetCurrentThreadId(); 152 | HR_LOG("new sheap for %d allocated at 0x%08X", id, (DWORD)heap); 153 | } 154 | 155 | end: 156 | return heap; 157 | } 158 | -------------------------------------------------------------------------------- /heap_replacer/sheap/sheap_defs.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define SHEAP_MAX_BLOCKS (32) 4 | 5 | #define SHEAP_BUFF_SIZE (512 * KB) 6 | #define SHEAP_FREE (0x00800000u) 7 | --------------------------------------------------------------------------------