mirror of
https://gitlab.com/Syroot/Worms.git
synced 2025-03-14 06:10:15 +03:00
Compare commits
19 Commits
Worms2.Gam
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
914acc2e1b | ||
|
b4e6433545 | ||
|
63691f897b | ||
|
b509d7bdaf | ||
|
046033bba7 | ||
|
6dc2de2445 | ||
|
48f1f91be3 | ||
|
cbe1388fb0 | ||
|
b68503e609 | ||
|
5fdd97c5ad | ||
|
6a418e84ae | ||
|
8eb0a971e8 | ||
|
6cba058138 | ||
|
03095916f1 | ||
|
9a218549e7 | ||
|
a99a883f6f | ||
|
518207b7e6 | ||
|
2b94e09e39 | ||
|
a314377c13 |
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017-2020 Syroot
|
||||
Copyright (c) 2017-2024 Syroot
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
18
README.md
18
README.md
@ -28,17 +28,17 @@ This repository hosts .NET libraries which can import, modify, and export the fo
|
||||
|
||||
Implementation of formats listed above as unsupported is planned for a later date.
|
||||
|
||||
The libraries are available on [NuGet](https://www.nuget.org/packages?q=Syroot.Worms).
|
||||
|
||||
## Modules
|
||||
|
||||
* `fkNetcode`: Patches Worms 2's outdated external IP detection and resolves it properly via a web service.
|
||||
* `fkDesPatch`: Unfinished module meant to replace functionality found in Sn*tch patcher.
|
||||
* `FrontendKitWS`: WormKit-like module loader for patching the Worms 2 Frontend.
|
||||
* `WormKitLib`: Utilities like signature scanning or import replacement to help in patching Worms executables.
|
||||
|
||||
## Tools
|
||||
|
||||
* `Syroot.Worms.Mgame.Launcher`: Creates a fake launch configuration to start OW or WWPA clients with.
|
||||
* `Syroot.Worms.Mgame.GameServer`: Simulates OW or WWPA networking to allow playing games.
|
||||
* `Syroot.Worms.Worms2.GameServer`: Simulates a Worms 2 server.
|
||||
|
||||
## Modules
|
||||
|
||||
* `FrontendKitWS`: WormKit-like module loader for patching the Worms 2 Frontend.
|
||||
* `fkNetcode`: Patches Worms 2's outdated external IP detection and resolves it properly via a web service.
|
||||
|
||||
## Availability
|
||||
|
||||
The libraries are available on [NuGet](https://www.nuget.org/packages?q=Syroot.Worms).
|
||||
|
@ -49,240 +49,112 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = " Solution Items", " Solut
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Syroot.Worms.Worms2.GameServer", "tool\Syroot.Worms.Worms2.GameServer\Syroot.Worms.Worms2.GameServer.csproj", "{13ABF717-5809-441D-A5D8-66E1EE75A390}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fkNetcode", "tool\fkNetcode\fkNetcode.vcxproj", "{C4138811-7CFA-4826-A3DD-AF2B618EAFC1}"
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Module Projects", "Module Projects", "{2A8C6AAA-BA1F-4FB6-A598-114930217B6C}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FrontendKitWS", "tool\FrontendKitWS\FrontendKitWS.vcxproj", "{E391EA12-B929-466C-932F-DEF72B8CEB5D}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WormKitTools", "module\WormKitTools\WormKitTools.vcxproj", "{068A8647-0A66-4E39-983B-43ACEAC5C937}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FrontendKitWS", "module\FrontendKitWS\FrontendKitWS.vcxproj", "{E391EA12-B929-466C-932F-DEF72B8CEB5D}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fkDesPatch", "module\fkDesPatch\fkDesPatch.vcxproj", "{6B4D57EA-4642-440A-AB62-2E011D7B64E1}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fkNetcode", "module\fkNetcode\fkNetcode.vcxproj", "{C4138811-7CFA-4826-A3DD-AF2B618EAFC1}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wkUnlimiter", "module\wkUnlimiter\wkUnlimiter.vcxproj", "{CDED4B7C-91DF-45D3-9704-DB8750BDAF5B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{DD76B6AA-5A5A-4FCD-95AA-9552977525A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DD76B6AA-5A5A-4FCD-95AA-9552977525A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DD76B6AA-5A5A-4FCD-95AA-9552977525A1}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{DD76B6AA-5A5A-4FCD-95AA-9552977525A1}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{DD76B6AA-5A5A-4FCD-95AA-9552977525A1}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{DD76B6AA-5A5A-4FCD-95AA-9552977525A1}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{DD76B6AA-5A5A-4FCD-95AA-9552977525A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DD76B6AA-5A5A-4FCD-95AA-9552977525A1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DD76B6AA-5A5A-4FCD-95AA-9552977525A1}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{DD76B6AA-5A5A-4FCD-95AA-9552977525A1}.Release|x64.Build.0 = Release|Any CPU
|
||||
{DD76B6AA-5A5A-4FCD-95AA-9552977525A1}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{DD76B6AA-5A5A-4FCD-95AA-9552977525A1}.Release|x86.Build.0 = Release|Any CPU
|
||||
{0D7F9DC3-7268-494E-BA1E-6C01525EB9AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0D7F9DC3-7268-494E-BA1E-6C01525EB9AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0D7F9DC3-7268-494E-BA1E-6C01525EB9AB}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{0D7F9DC3-7268-494E-BA1E-6C01525EB9AB}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{0D7F9DC3-7268-494E-BA1E-6C01525EB9AB}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{0D7F9DC3-7268-494E-BA1E-6C01525EB9AB}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{0D7F9DC3-7268-494E-BA1E-6C01525EB9AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0D7F9DC3-7268-494E-BA1E-6C01525EB9AB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0D7F9DC3-7268-494E-BA1E-6C01525EB9AB}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{0D7F9DC3-7268-494E-BA1E-6C01525EB9AB}.Release|x64.Build.0 = Release|Any CPU
|
||||
{0D7F9DC3-7268-494E-BA1E-6C01525EB9AB}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{0D7F9DC3-7268-494E-BA1E-6C01525EB9AB}.Release|x86.Build.0 = Release|Any CPU
|
||||
{510EE83E-9C52-40FD-AC7E-C4981EBF4182}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{510EE83E-9C52-40FD-AC7E-C4981EBF4182}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{510EE83E-9C52-40FD-AC7E-C4981EBF4182}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{510EE83E-9C52-40FD-AC7E-C4981EBF4182}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{510EE83E-9C52-40FD-AC7E-C4981EBF4182}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{510EE83E-9C52-40FD-AC7E-C4981EBF4182}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{510EE83E-9C52-40FD-AC7E-C4981EBF4182}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{510EE83E-9C52-40FD-AC7E-C4981EBF4182}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{510EE83E-9C52-40FD-AC7E-C4981EBF4182}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{510EE83E-9C52-40FD-AC7E-C4981EBF4182}.Release|x64.Build.0 = Release|Any CPU
|
||||
{510EE83E-9C52-40FD-AC7E-C4981EBF4182}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{510EE83E-9C52-40FD-AC7E-C4981EBF4182}.Release|x86.Build.0 = Release|Any CPU
|
||||
{D9694108-539C-4DEE-B5DD-284208D48B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D9694108-539C-4DEE-B5DD-284208D48B46}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D9694108-539C-4DEE-B5DD-284208D48B46}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{D9694108-539C-4DEE-B5DD-284208D48B46}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{D9694108-539C-4DEE-B5DD-284208D48B46}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{D9694108-539C-4DEE-B5DD-284208D48B46}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{D9694108-539C-4DEE-B5DD-284208D48B46}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D9694108-539C-4DEE-B5DD-284208D48B46}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D9694108-539C-4DEE-B5DD-284208D48B46}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{D9694108-539C-4DEE-B5DD-284208D48B46}.Release|x64.Build.0 = Release|Any CPU
|
||||
{D9694108-539C-4DEE-B5DD-284208D48B46}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{D9694108-539C-4DEE-B5DD-284208D48B46}.Release|x86.Build.0 = Release|Any CPU
|
||||
{AC9F52FA-F552-49E0-83AE-79759BF44FED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AC9F52FA-F552-49E0-83AE-79759BF44FED}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AC9F52FA-F552-49E0-83AE-79759BF44FED}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{AC9F52FA-F552-49E0-83AE-79759BF44FED}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{AC9F52FA-F552-49E0-83AE-79759BF44FED}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{AC9F52FA-F552-49E0-83AE-79759BF44FED}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{AC9F52FA-F552-49E0-83AE-79759BF44FED}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AC9F52FA-F552-49E0-83AE-79759BF44FED}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AC9F52FA-F552-49E0-83AE-79759BF44FED}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{AC9F52FA-F552-49E0-83AE-79759BF44FED}.Release|x64.Build.0 = Release|Any CPU
|
||||
{AC9F52FA-F552-49E0-83AE-79759BF44FED}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{AC9F52FA-F552-49E0-83AE-79759BF44FED}.Release|x86.Build.0 = Release|Any CPU
|
||||
{4E124BBA-15B5-422E-93D5-96EA7D4180F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4E124BBA-15B5-422E-93D5-96EA7D4180F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4E124BBA-15B5-422E-93D5-96EA7D4180F3}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{4E124BBA-15B5-422E-93D5-96EA7D4180F3}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{4E124BBA-15B5-422E-93D5-96EA7D4180F3}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{4E124BBA-15B5-422E-93D5-96EA7D4180F3}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{4E124BBA-15B5-422E-93D5-96EA7D4180F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4E124BBA-15B5-422E-93D5-96EA7D4180F3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4E124BBA-15B5-422E-93D5-96EA7D4180F3}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{4E124BBA-15B5-422E-93D5-96EA7D4180F3}.Release|x64.Build.0 = Release|Any CPU
|
||||
{4E124BBA-15B5-422E-93D5-96EA7D4180F3}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{4E124BBA-15B5-422E-93D5-96EA7D4180F3}.Release|x86.Build.0 = Release|Any CPU
|
||||
{BBCECFCC-F2FD-4C4D-A6E9-CC7AA5F10FDD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BBCECFCC-F2FD-4C4D-A6E9-CC7AA5F10FDD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BBCECFCC-F2FD-4C4D-A6E9-CC7AA5F10FDD}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{BBCECFCC-F2FD-4C4D-A6E9-CC7AA5F10FDD}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{BBCECFCC-F2FD-4C4D-A6E9-CC7AA5F10FDD}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{BBCECFCC-F2FD-4C4D-A6E9-CC7AA5F10FDD}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{BBCECFCC-F2FD-4C4D-A6E9-CC7AA5F10FDD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BBCECFCC-F2FD-4C4D-A6E9-CC7AA5F10FDD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BBCECFCC-F2FD-4C4D-A6E9-CC7AA5F10FDD}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{BBCECFCC-F2FD-4C4D-A6E9-CC7AA5F10FDD}.Release|x64.Build.0 = Release|Any CPU
|
||||
{BBCECFCC-F2FD-4C4D-A6E9-CC7AA5F10FDD}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{BBCECFCC-F2FD-4C4D-A6E9-CC7AA5F10FDD}.Release|x86.Build.0 = Release|Any CPU
|
||||
{BD8079D9-FDB5-4C7D-8AD4-C80ADC4A4B26}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BD8079D9-FDB5-4C7D-8AD4-C80ADC4A4B26}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BD8079D9-FDB5-4C7D-8AD4-C80ADC4A4B26}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{BD8079D9-FDB5-4C7D-8AD4-C80ADC4A4B26}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{BD8079D9-FDB5-4C7D-8AD4-C80ADC4A4B26}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{BD8079D9-FDB5-4C7D-8AD4-C80ADC4A4B26}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{BD8079D9-FDB5-4C7D-8AD4-C80ADC4A4B26}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BD8079D9-FDB5-4C7D-8AD4-C80ADC4A4B26}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BD8079D9-FDB5-4C7D-8AD4-C80ADC4A4B26}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{BD8079D9-FDB5-4C7D-8AD4-C80ADC4A4B26}.Release|x64.Build.0 = Release|Any CPU
|
||||
{BD8079D9-FDB5-4C7D-8AD4-C80ADC4A4B26}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{BD8079D9-FDB5-4C7D-8AD4-C80ADC4A4B26}.Release|x86.Build.0 = Release|Any CPU
|
||||
{239763CD-B7C9-4E8B-A84B-8F24DECF6D7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{239763CD-B7C9-4E8B-A84B-8F24DECF6D7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{239763CD-B7C9-4E8B-A84B-8F24DECF6D7B}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{239763CD-B7C9-4E8B-A84B-8F24DECF6D7B}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{239763CD-B7C9-4E8B-A84B-8F24DECF6D7B}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{239763CD-B7C9-4E8B-A84B-8F24DECF6D7B}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{239763CD-B7C9-4E8B-A84B-8F24DECF6D7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{239763CD-B7C9-4E8B-A84B-8F24DECF6D7B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{239763CD-B7C9-4E8B-A84B-8F24DECF6D7B}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{239763CD-B7C9-4E8B-A84B-8F24DECF6D7B}.Release|x64.Build.0 = Release|Any CPU
|
||||
{239763CD-B7C9-4E8B-A84B-8F24DECF6D7B}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{239763CD-B7C9-4E8B-A84B-8F24DECF6D7B}.Release|x86.Build.0 = Release|Any CPU
|
||||
{748D16FF-35C6-4249-A1E8-04B2D239C954}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{748D16FF-35C6-4249-A1E8-04B2D239C954}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{748D16FF-35C6-4249-A1E8-04B2D239C954}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{748D16FF-35C6-4249-A1E8-04B2D239C954}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{748D16FF-35C6-4249-A1E8-04B2D239C954}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{748D16FF-35C6-4249-A1E8-04B2D239C954}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{748D16FF-35C6-4249-A1E8-04B2D239C954}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{748D16FF-35C6-4249-A1E8-04B2D239C954}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{748D16FF-35C6-4249-A1E8-04B2D239C954}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{748D16FF-35C6-4249-A1E8-04B2D239C954}.Release|x64.Build.0 = Release|Any CPU
|
||||
{748D16FF-35C6-4249-A1E8-04B2D239C954}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{748D16FF-35C6-4249-A1E8-04B2D239C954}.Release|x86.Build.0 = Release|Any CPU
|
||||
{3AAC4992-DDB9-4175-82B9-C57F22E12FF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3AAC4992-DDB9-4175-82B9-C57F22E12FF6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3AAC4992-DDB9-4175-82B9-C57F22E12FF6}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{3AAC4992-DDB9-4175-82B9-C57F22E12FF6}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{3AAC4992-DDB9-4175-82B9-C57F22E12FF6}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{3AAC4992-DDB9-4175-82B9-C57F22E12FF6}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{3AAC4992-DDB9-4175-82B9-C57F22E12FF6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3AAC4992-DDB9-4175-82B9-C57F22E12FF6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3AAC4992-DDB9-4175-82B9-C57F22E12FF6}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{3AAC4992-DDB9-4175-82B9-C57F22E12FF6}.Release|x64.Build.0 = Release|Any CPU
|
||||
{3AAC4992-DDB9-4175-82B9-C57F22E12FF6}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{3AAC4992-DDB9-4175-82B9-C57F22E12FF6}.Release|x86.Build.0 = Release|Any CPU
|
||||
{EF308D4E-26A0-471C-B764-9C4EB713BEAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EF308D4E-26A0-471C-B764-9C4EB713BEAE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EF308D4E-26A0-471C-B764-9C4EB713BEAE}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{EF308D4E-26A0-471C-B764-9C4EB713BEAE}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{EF308D4E-26A0-471C-B764-9C4EB713BEAE}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{EF308D4E-26A0-471C-B764-9C4EB713BEAE}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{EF308D4E-26A0-471C-B764-9C4EB713BEAE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EF308D4E-26A0-471C-B764-9C4EB713BEAE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{EF308D4E-26A0-471C-B764-9C4EB713BEAE}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{EF308D4E-26A0-471C-B764-9C4EB713BEAE}.Release|x64.Build.0 = Release|Any CPU
|
||||
{EF308D4E-26A0-471C-B764-9C4EB713BEAE}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{EF308D4E-26A0-471C-B764-9C4EB713BEAE}.Release|x86.Build.0 = Release|Any CPU
|
||||
{351B93B0-301F-42E1-82A0-7FA217154F5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{351B93B0-301F-42E1-82A0-7FA217154F5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{351B93B0-301F-42E1-82A0-7FA217154F5D}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{351B93B0-301F-42E1-82A0-7FA217154F5D}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{351B93B0-301F-42E1-82A0-7FA217154F5D}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{351B93B0-301F-42E1-82A0-7FA217154F5D}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{351B93B0-301F-42E1-82A0-7FA217154F5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{351B93B0-301F-42E1-82A0-7FA217154F5D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{351B93B0-301F-42E1-82A0-7FA217154F5D}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{351B93B0-301F-42E1-82A0-7FA217154F5D}.Release|x64.Build.0 = Release|Any CPU
|
||||
{351B93B0-301F-42E1-82A0-7FA217154F5D}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{351B93B0-301F-42E1-82A0-7FA217154F5D}.Release|x86.Build.0 = Release|Any CPU
|
||||
{392E4CA2-61D9-4BE1-B065-8801A9F102B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{392E4CA2-61D9-4BE1-B065-8801A9F102B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{392E4CA2-61D9-4BE1-B065-8801A9F102B8}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{392E4CA2-61D9-4BE1-B065-8801A9F102B8}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{392E4CA2-61D9-4BE1-B065-8801A9F102B8}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{392E4CA2-61D9-4BE1-B065-8801A9F102B8}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{392E4CA2-61D9-4BE1-B065-8801A9F102B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{392E4CA2-61D9-4BE1-B065-8801A9F102B8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{392E4CA2-61D9-4BE1-B065-8801A9F102B8}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{392E4CA2-61D9-4BE1-B065-8801A9F102B8}.Release|x64.Build.0 = Release|Any CPU
|
||||
{392E4CA2-61D9-4BE1-B065-8801A9F102B8}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{392E4CA2-61D9-4BE1-B065-8801A9F102B8}.Release|x86.Build.0 = Release|Any CPU
|
||||
{212F8090-9775-4098-BD44-9ABC01FBE553}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{212F8090-9775-4098-BD44-9ABC01FBE553}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{212F8090-9775-4098-BD44-9ABC01FBE553}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{212F8090-9775-4098-BD44-9ABC01FBE553}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{212F8090-9775-4098-BD44-9ABC01FBE553}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{212F8090-9775-4098-BD44-9ABC01FBE553}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{212F8090-9775-4098-BD44-9ABC01FBE553}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{212F8090-9775-4098-BD44-9ABC01FBE553}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{212F8090-9775-4098-BD44-9ABC01FBE553}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{212F8090-9775-4098-BD44-9ABC01FBE553}.Release|x64.Build.0 = Release|Any CPU
|
||||
{212F8090-9775-4098-BD44-9ABC01FBE553}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{212F8090-9775-4098-BD44-9ABC01FBE553}.Release|x86.Build.0 = Release|Any CPU
|
||||
{1FAB6B9F-2585-46DC-81C0-579DC808C389}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1FAB6B9F-2585-46DC-81C0-579DC808C389}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1FAB6B9F-2585-46DC-81C0-579DC808C389}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{1FAB6B9F-2585-46DC-81C0-579DC808C389}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{1FAB6B9F-2585-46DC-81C0-579DC808C389}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{1FAB6B9F-2585-46DC-81C0-579DC808C389}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{1FAB6B9F-2585-46DC-81C0-579DC808C389}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1FAB6B9F-2585-46DC-81C0-579DC808C389}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1FAB6B9F-2585-46DC-81C0-579DC808C389}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{1FAB6B9F-2585-46DC-81C0-579DC808C389}.Release|x64.Build.0 = Release|Any CPU
|
||||
{1FAB6B9F-2585-46DC-81C0-579DC808C389}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{1FAB6B9F-2585-46DC-81C0-579DC808C389}.Release|x86.Build.0 = Release|Any CPU
|
||||
{13ABF717-5809-441D-A5D8-66E1EE75A390}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{13ABF717-5809-441D-A5D8-66E1EE75A390}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{13ABF717-5809-441D-A5D8-66E1EE75A390}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{13ABF717-5809-441D-A5D8-66E1EE75A390}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{13ABF717-5809-441D-A5D8-66E1EE75A390}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{13ABF717-5809-441D-A5D8-66E1EE75A390}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{13ABF717-5809-441D-A5D8-66E1EE75A390}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{13ABF717-5809-441D-A5D8-66E1EE75A390}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{13ABF717-5809-441D-A5D8-66E1EE75A390}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{13ABF717-5809-441D-A5D8-66E1EE75A390}.Release|x64.Build.0 = Release|Any CPU
|
||||
{13ABF717-5809-441D-A5D8-66E1EE75A390}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{13ABF717-5809-441D-A5D8-66E1EE75A390}.Release|x86.Build.0 = Release|Any CPU
|
||||
{C4138811-7CFA-4826-A3DD-AF2B618EAFC1}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{C4138811-7CFA-4826-A3DD-AF2B618EAFC1}.Debug|x64.ActiveCfg = Debug|Win32
|
||||
{C4138811-7CFA-4826-A3DD-AF2B618EAFC1}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{C4138811-7CFA-4826-A3DD-AF2B618EAFC1}.Debug|x86.Build.0 = Debug|Win32
|
||||
{C4138811-7CFA-4826-A3DD-AF2B618EAFC1}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||
{C4138811-7CFA-4826-A3DD-AF2B618EAFC1}.Release|x64.ActiveCfg = Release|Win32
|
||||
{C4138811-7CFA-4826-A3DD-AF2B618EAFC1}.Release|x86.ActiveCfg = Release|Win32
|
||||
{C4138811-7CFA-4826-A3DD-AF2B618EAFC1}.Release|x86.Build.0 = Release|Win32
|
||||
{068A8647-0A66-4E39-983B-43ACEAC5C937}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{068A8647-0A66-4E39-983B-43ACEAC5C937}.Debug|Any CPU.Build.0 = Debug|Win32
|
||||
{068A8647-0A66-4E39-983B-43ACEAC5C937}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||
{068A8647-0A66-4E39-983B-43ACEAC5C937}.Release|Any CPU.Build.0 = Release|Win32
|
||||
{E391EA12-B929-466C-932F-DEF72B8CEB5D}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{E391EA12-B929-466C-932F-DEF72B8CEB5D}.Debug|x64.ActiveCfg = Debug|Win32
|
||||
{E391EA12-B929-466C-932F-DEF72B8CEB5D}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{E391EA12-B929-466C-932F-DEF72B8CEB5D}.Debug|x86.Build.0 = Debug|Win32
|
||||
{E391EA12-B929-466C-932F-DEF72B8CEB5D}.Debug|Any CPU.Build.0 = Debug|Win32
|
||||
{E391EA12-B929-466C-932F-DEF72B8CEB5D}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||
{E391EA12-B929-466C-932F-DEF72B8CEB5D}.Release|x64.ActiveCfg = Release|Win32
|
||||
{E391EA12-B929-466C-932F-DEF72B8CEB5D}.Release|x86.ActiveCfg = Release|Win32
|
||||
{E391EA12-B929-466C-932F-DEF72B8CEB5D}.Release|x86.Build.0 = Release|Win32
|
||||
{E391EA12-B929-466C-932F-DEF72B8CEB5D}.Release|Any CPU.Build.0 = Release|Win32
|
||||
{6B4D57EA-4642-440A-AB62-2E011D7B64E1}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{6B4D57EA-4642-440A-AB62-2E011D7B64E1}.Debug|Any CPU.Build.0 = Debug|Win32
|
||||
{6B4D57EA-4642-440A-AB62-2E011D7B64E1}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||
{6B4D57EA-4642-440A-AB62-2E011D7B64E1}.Release|Any CPU.Build.0 = Release|Win32
|
||||
{C4138811-7CFA-4826-A3DD-AF2B618EAFC1}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{C4138811-7CFA-4826-A3DD-AF2B618EAFC1}.Debug|Any CPU.Build.0 = Debug|Win32
|
||||
{C4138811-7CFA-4826-A3DD-AF2B618EAFC1}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||
{C4138811-7CFA-4826-A3DD-AF2B618EAFC1}.Release|Any CPU.Build.0 = Release|Win32
|
||||
{CDED4B7C-91DF-45D3-9704-DB8750BDAF5B}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{CDED4B7C-91DF-45D3-9704-DB8750BDAF5B}.Debug|Any CPU.Build.0 = Debug|Win32
|
||||
{CDED4B7C-91DF-45D3-9704-DB8750BDAF5B}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||
{CDED4B7C-91DF-45D3-9704-DB8750BDAF5B}.Release|Any CPU.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@ -305,8 +177,11 @@ Global
|
||||
{212F8090-9775-4098-BD44-9ABC01FBE553} = {99E56312-A064-4AD3-8443-0B56A5F76E6B}
|
||||
{1FAB6B9F-2585-46DC-81C0-579DC808C389} = {0B9B0B74-3EB1-46A4-BCCC-F2D6AE59A9EE}
|
||||
{13ABF717-5809-441D-A5D8-66E1EE75A390} = {0B9B0B74-3EB1-46A4-BCCC-F2D6AE59A9EE}
|
||||
{C4138811-7CFA-4826-A3DD-AF2B618EAFC1} = {0B9B0B74-3EB1-46A4-BCCC-F2D6AE59A9EE}
|
||||
{E391EA12-B929-466C-932F-DEF72B8CEB5D} = {0B9B0B74-3EB1-46A4-BCCC-F2D6AE59A9EE}
|
||||
{068A8647-0A66-4E39-983B-43ACEAC5C937} = {2A8C6AAA-BA1F-4FB6-A598-114930217B6C}
|
||||
{E391EA12-B929-466C-932F-DEF72B8CEB5D} = {2A8C6AAA-BA1F-4FB6-A598-114930217B6C}
|
||||
{6B4D57EA-4642-440A-AB62-2E011D7B64E1} = {2A8C6AAA-BA1F-4FB6-A598-114930217B6C}
|
||||
{C4138811-7CFA-4826-A3DD-AF2B618EAFC1} = {2A8C6AAA-BA1F-4FB6-A598-114930217B6C}
|
||||
{CDED4B7C-91DF-45D3-9704-DB8750BDAF5B} = {2A8C6AAA-BA1F-4FB6-A598-114930217B6C}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {1CD4EDE2-A5FB-4A58-A850-3506AB7E7B69}
|
||||
|
@ -1,13 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$(SolutionDir)build.xml" />
|
||||
<Import Project="$(MSBuildThisFileDirectory)..\..\build.xml" />
|
||||
|
||||
<!-- Metadata -->
|
||||
<PropertyGroup>
|
||||
<AssemblyName>Syroot.Worms.Armageddon.ProjectX</AssemblyName>
|
||||
<Description>.NET library for loading and modifying files of Worms Armageddon ProjectX.</Description>
|
||||
<PackageReleaseNotes>Overhaul implementation and documentation.</PackageReleaseNotes>
|
||||
<PackageReleaseNotes>Fix StackOverflowException when using legacy .NET versions.</PackageReleaseNotes>
|
||||
<PackageTags>$(PackageTags);project x;worms armageddon</PackageTags>
|
||||
<Version>4.0.0</Version>
|
||||
<Version>4.0.3</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- References -->
|
||||
|
@ -1,13 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$(SolutionDir)build.xml" />
|
||||
<Import Project="$(MSBuildThisFileDirectory)..\..\build.xml" />
|
||||
|
||||
<!-- Metadata -->
|
||||
<PropertyGroup>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Description>.NET library for loading and modifying files of Team17's Worms Armageddon.</Description>
|
||||
<PackageReleaseNotes>Overhaul implementation and documentation. Implement W:A V3 scheme format.</PackageReleaseNotes>
|
||||
<PackageReleaseNotes>Fix StackOverflowException when using legacy .NET versions.</PackageReleaseNotes>
|
||||
<PackageTags>$(PackageTags);worms armageddon</PackageTags>
|
||||
<Version>4.0.2</Version>
|
||||
<Version>4.0.3</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- References -->
|
||||
|
@ -1,17 +1,17 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$(SolutionDir)build.xml" />
|
||||
|
||||
<Import Project="$(MSBuildThisFileDirectory)..\..\build.xml" />
|
||||
|
||||
<!-- Metadata -->
|
||||
<PropertyGroup>
|
||||
<Description>.NET library for loading and modifying files of Mgame Worms clients.</Description>
|
||||
<PackageReleaseNotes>Overhaul implementation and documentation.</PackageReleaseNotes>
|
||||
<PackageReleaseNotes>Fix StackOverflowException when using legacy .NET versions.</PackageReleaseNotes>
|
||||
<PackageTags>$(PackageTags);online worms;worms world party aqua</PackageTags>
|
||||
<Version>4.0.0</Version>
|
||||
<Version>4.0.3</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- References -->
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.5.0" />
|
||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.1" />
|
||||
<ProjectReference Include="..\Syroot.Worms\Syroot.Worms.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -1,13 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$(SolutionDir)build.xml" />
|
||||
|
||||
<Import Project="$(MSBuildThisFileDirectory)..\..\build.xml" />
|
||||
|
||||
<!-- Metadata -->
|
||||
<PropertyGroup>
|
||||
<AssemblyName>Syroot.Worms.WorldParty</AssemblyName>
|
||||
<Description>.NET library for loading and modifying files of Team17's Worms World Party.</Description>
|
||||
<PackageReleaseNotes>Overhaul implementation and documentation.</PackageReleaseNotes>
|
||||
<PackageReleaseNotes>Fix StackOverflowException when using legacy .NET versions.</PackageReleaseNotes>
|
||||
<PackageTags>$(PackageTags);worms world party</PackageTags>
|
||||
<Version>4.0.0</Version>
|
||||
<Version>4.0.3</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- References -->
|
||||
|
@ -76,6 +76,8 @@ namespace Syroot.Worms.Worms2
|
||||
public int DiggingTime;
|
||||
/// <summary>Amount of airstrike clusters thrown.</summary>
|
||||
public int StrikeClusterCount;
|
||||
/// <summary>Damage of airstrike clusters measured in health points which also determines the blast radius.</summary>
|
||||
public int StrikeClusterDamage;
|
||||
/// <summary>Angle in which bullets are dispersed, measured in degrees.</summary>
|
||||
public int BulletSpreadAngle;
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$(SolutionDir)build.xml" />
|
||||
<Import Project="$(MSBuildThisFileDirectory)..\..\build.xml" />
|
||||
|
||||
<!-- Metadata -->
|
||||
<PropertyGroup>
|
||||
<Description>.NET library for loading and modifying files of Team17's Worms 2.</Description>
|
||||
<PackageReleaseNotes>Overhaul implementation and documentation.</PackageReleaseNotes>
|
||||
<PackageReleaseNotes>Add missing SchemeWeapon StrikeClusterDamage field.</PackageReleaseNotes>
|
||||
<PackageTags>$(PackageTags);worms 2</PackageTags>
|
||||
<Version>4.0.0</Version>
|
||||
<Version>4.0.4</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- References -->
|
||||
|
@ -22,7 +22,7 @@ namespace System.IO
|
||||
public static int Read(this Stream stream, Span<byte> buffer)
|
||||
{
|
||||
byte[] bytes = new byte[buffer.Length];
|
||||
int bytesRead = stream.Read(bytes);
|
||||
int bytesRead = stream.Read(bytes, 0, bytes.Length);
|
||||
bytes.AsSpan(0, bytesRead).CopyTo(buffer);
|
||||
return bytesRead;
|
||||
}
|
||||
|
@ -1,22 +1,22 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$(SolutionDir)build.xml" />
|
||||
<Import Project="$(MSBuildThisFileDirectory)..\..\build.xml" />
|
||||
|
||||
<!-- Metadata -->
|
||||
<PropertyGroup>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Description>.NET library for loading and modifying files of Team17 Worms games.</Description>
|
||||
<PackageReleaseNotes>Overhaul implementation and documentation.</PackageReleaseNotes>
|
||||
<Version>4.0.0</Version>
|
||||
<PackageReleaseNotes>Fix StackOverflowException when using legacy .NET versions.</PackageReleaseNotes>
|
||||
<Version>4.0.3</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- References -->
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Syroot.BinaryData" Version="5.2.1" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="4.5.0" />
|
||||
<PackageReference Include="Syroot.BinaryData" Version="5.2.2" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="4.7.3" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
|
||||
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.0.0" />
|
||||
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.0" />
|
||||
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
|
||||
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
</Project>
|
||||
|
@ -35,13 +35,13 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
119
src/module/WormKitTools/WormKitTools.vcxproj
Normal file
119
src/module/WormKitTools/WormKitTools.vcxproj
Normal file
@ -0,0 +1,119 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{068a8647-0a66-4e39-983b-43aceac5c937}</ProjectGuid>
|
||||
<RootNamespace>WormKitTools</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
<ProjectName>WormKitTools</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>bin\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>bin\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;FRONTENDKITLIB_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<ForcedIncludeFiles>pch.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;FRONTENDKITLIB_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<ForcedIncludeFiles>pch.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\wkIni.cpp" />
|
||||
<ClCompile Include="src\wkPatch.cpp" />
|
||||
<ClCompile Include="src\wkUtils.cpp" />
|
||||
<ClCompile Include="src\pch.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\wkExe.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="include\wkIni.h" />
|
||||
<ClInclude Include="include\wkPatch.h" />
|
||||
<ClInclude Include="include\wkUtils.h" />
|
||||
<ClInclude Include="include\wkExe.h" />
|
||||
<ClInclude Include="src\pch.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="include\wkExe.inl" />
|
||||
<None Include="include\wkPatch.inl" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
59
src/module/WormKitTools/WormKitTools.vcxproj.filters
Normal file
59
src/module/WormKitTools/WormKitTools.vcxproj.filters
Normal file
@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\pch.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\wkUtils.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\wkPatch.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\wkExe.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\wkIni.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\pch.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\wkUtils.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\wkPatch.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\wkExe.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\wkIni.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="include\wkPatch.inl">
|
||||
<Filter>Header Files</Filter>
|
||||
</None>
|
||||
<None Include="include\wkExe.inl">
|
||||
<Filter>Header Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
88
src/module/WormKitTools/include/wkExe.h
Normal file
88
src/module/WormKitTools/include/wkExe.h
Normal file
@ -0,0 +1,88 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <Windows.h>
|
||||
#include "wkPatch.h"
|
||||
|
||||
namespace wk
|
||||
{
|
||||
enum JumpType
|
||||
{
|
||||
JT_JMP, // jmp (0xE9)
|
||||
JT_CALL, // call (0xE8)
|
||||
JT_FARJMP, // farjump (0xEA)
|
||||
JT_FARCALL, // farcall (0x9A)
|
||||
JT_PUSHRET, // pushret
|
||||
};
|
||||
|
||||
struct Exe
|
||||
{
|
||||
public:
|
||||
// ---- FIELDS -------------------------------------------------------------------------------------------------
|
||||
|
||||
HANDLE Handle;
|
||||
PIMAGE_DOS_HEADER DosHeader;
|
||||
PIMAGE_NT_HEADERS NtHeader;
|
||||
PIMAGE_FILE_HEADER FileHeader;
|
||||
PIMAGE_OPTIONAL_HEADER OptHeader;
|
||||
|
||||
// ---- CONSTRUCTORS & DESTRUCTOR ------------------------------------------------------------------------------
|
||||
|
||||
Exe(HMODULE hModule = NULL);
|
||||
|
||||
// ---- METHODS ------------------------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Returns the offset of the first match of the given signature. It must take the form "12 FF ?? EB 34", where
|
||||
/// two question marks represent a wildcard.
|
||||
/// </summary>
|
||||
/// <param name="signature">The signature to find.</param>
|
||||
/// <returns>The offset of the first match of the signature.</returns>
|
||||
ULONG_PTR find(std::string signature);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the offset of the first match of the given signature. It is an array of bytes, where all values
|
||||
/// being negative or bigger than 0xFF represent a wildcard.
|
||||
/// </summary>
|
||||
/// <param name="signature">The signature to find.</param>
|
||||
/// <returns>The offset of the first match of the signature.</returns>
|
||||
ULONG_PTR find(int16_t signature[], size_t signatureSize); // any non-uint8_t value is a wildcard
|
||||
|
||||
/// <summary>
|
||||
/// Writes the given value to the specified offset.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the value to write.</typeparam>
|
||||
/// <param name="offset">The relative address at which to write the value.</param>
|
||||
/// <param name="value">The value to write.</param>
|
||||
template <class T> void set(ULONG_PTR offset, T value);
|
||||
|
||||
/// <summary>
|
||||
/// Replaces the given import with the specified hook, which must have the same signature.
|
||||
/// </summary>
|
||||
/// <param name="import">The imported method to replace.</param>
|
||||
/// <param name="hook">The method to replace the import with.</param>
|
||||
void setImp(LPVOID import, LPVOID hook);
|
||||
|
||||
/// <summary>
|
||||
/// Writes a jump to the given callee at the specified offset.
|
||||
/// </summary>
|
||||
/// <param name="offset">The relative address at which to write the value.</param>
|
||||
/// <param name="size">The number of bytes overwritten for the jump opcode.</param>
|
||||
/// <param name="callee">The called method.</param>
|
||||
/// <param name="jumpType">The type of the jump to insert.</param>
|
||||
void setJmp(ULONG_PTR offset, SIZE_T size, LPVOID callee, DWORD jumpType);
|
||||
|
||||
/// <summary>
|
||||
/// Nops out the given number of bytes at the specified offset.
|
||||
/// </summary>
|
||||
/// <param name="offset">The relative address at which to nop out code.</param>
|
||||
/// <param name="size">The number of bytes to nop out.</param>
|
||||
void setNop(ULONG_PTR offset, SIZE_T size);
|
||||
|
||||
private:
|
||||
LPVOID getAddress(ULONG_PTR offset);
|
||||
PIMAGE_IMPORT_DESCRIPTOR getImports();
|
||||
};
|
||||
}
|
||||
|
||||
#include "wkExe.inl"
|
9
src/module/WormKitTools/include/wkExe.inl
Normal file
9
src/module/WormKitTools/include/wkExe.inl
Normal file
@ -0,0 +1,9 @@
|
||||
namespace wk
|
||||
{
|
||||
template <class T>
|
||||
void Exe::set(ULONG_PTR offset, T newValue)
|
||||
{
|
||||
Patch patch(getAddress(offset), sizeof(T));
|
||||
patch.write(newValue);
|
||||
}
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
#pragma once
|
||||
#include <Windows.h>
|
||||
|
||||
namespace fk
|
||||
namespace wk
|
||||
{
|
||||
class Config
|
||||
class Ini
|
||||
{
|
||||
public:
|
||||
Config(LPCSTR fileName);
|
||||
Ini(LPCSTR fileName);
|
||||
|
||||
void get(LPCSTR category, LPCSTR key, BOOL& result, UINT fallback) const;
|
||||
void get(LPCSTR category, LPCSTR key, UINT& result, UINT fallback) const;
|
31
src/module/WormKitTools/include/wkPatch.h
Normal file
31
src/module/WormKitTools/include/wkPatch.h
Normal file
@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
#include <Windows.h>
|
||||
|
||||
namespace wk
|
||||
{
|
||||
struct Patch
|
||||
{
|
||||
public:
|
||||
// ---- FIELDS -------------------------------------------------------------------------------------------------
|
||||
|
||||
ULONG_PTR position;
|
||||
|
||||
// ---- CONSTRUCTORS & DESTRUCTOR ------------------------------------------------------------------------------
|
||||
|
||||
Patch(LPVOID address, SIZE_T size);
|
||||
~Patch();
|
||||
|
||||
// ---- METHODS ------------------------------------------------------------------------------------------------
|
||||
|
||||
void close() const;
|
||||
template <class T> void write(const T& value);
|
||||
|
||||
private:
|
||||
// ---- FIELDS -------------------------------------------------------------------------------------------------
|
||||
LPBYTE _address;
|
||||
SIZE_T _size;
|
||||
DWORD _oldProtect;
|
||||
};
|
||||
}
|
||||
|
||||
#include "wkPatch.inl"
|
9
src/module/WormKitTools/include/wkPatch.inl
Normal file
9
src/module/WormKitTools/include/wkPatch.inl
Normal file
@ -0,0 +1,9 @@
|
||||
namespace wk
|
||||
{
|
||||
template <class T>
|
||||
void Patch::write(const T& value)
|
||||
{
|
||||
memcpy_s(_address + position, sizeof(T), &value, sizeof(T));
|
||||
position += sizeof(T);
|
||||
}
|
||||
}
|
43
src/module/WormKitTools/include/wkUtils.h
Normal file
43
src/module/WormKitTools/include/wkUtils.h
Normal file
@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
#include <stdexcept>
|
||||
#include <Windows.h>
|
||||
|
||||
namespace wk
|
||||
{
|
||||
// 0x 00 0000 00
|
||||
// [Game][Version][Release]
|
||||
enum GameID
|
||||
{
|
||||
GAMEID_NONE,
|
||||
|
||||
GAMEID_W2 = 0x20000000,
|
||||
GAMEID_W2_1_05 = GAMEID_W2 | 0x010500,
|
||||
GAMEID_W2_1_05_BR = GAMEID_W2_1_05 | 0x10, // Worms2 1.05 Br
|
||||
GAMEID_W2_1_05_EN = GAMEID_W2_1_05 | 0x20, // Worms2 1.05 Du, En, Fr, It, Po, Sp, Sw
|
||||
GAMEID_W2_1_05_GE = GAMEID_W2_1_05 | 0x30, // Worms2 1.05 De
|
||||
GAMEID_W2_1_05_NA = GAMEID_W2_1_05 | 0x40, // Worms2 1.05 NA
|
||||
GAMEID_W2_1_05_SA = GAMEID_W2_1_05 | 0x50, // Worms2 1.05 SA
|
||||
GAMEID_W2_1_07 = GAMEID_W2 | 0x010700,
|
||||
GAMEID_W2_1_07_TRY = GAMEID_W2_1_07 | 0x60, // Worms2 1.07 Trymedia
|
||||
GAMEID_W2_LAST = GAMEID_W2_1_07_TRY,
|
||||
|
||||
GAMEID_WA = 0x30000000,
|
||||
GAMEID_WA_3_6_31 = GAMEID_WA | 0x030630, // Worms Armageddon 3.6.31
|
||||
GAMEID_WA_3_7_2_1 = GAMEID_WA | 0x030721, // Worms Armageddon 3.7.2.1
|
||||
GAMEID_WA_3_8 = GAMEID_WA | 0x030800,
|
||||
GAMEID_WA_3_8_CD = GAMEID_WA_3_8 | 0x10, // Worms Armageddon 3.8 CD
|
||||
GAMEID_WA_LAST = GAMEID_WA_3_8_CD,
|
||||
|
||||
GAMEID_WWP = 0x40000000,
|
||||
GAMEID_WWP_LAST = GAMEID_WWP,
|
||||
|
||||
GAMEID_OW = 0x50000000,
|
||||
GAMEID_OW_LAST = GAMEID_OW,
|
||||
|
||||
GAMEID_WWPA = 0x60000000,
|
||||
GAMEID_WWPA_LAST = GAMEID_WWPA,
|
||||
};
|
||||
|
||||
int getGameID(DWORD timeDateStamp);
|
||||
std::string getErrorMessage(int error);
|
||||
}
|
2
src/module/WormKitTools/src/pch.cpp
Normal file
2
src/module/WormKitTools/src/pch.cpp
Normal file
@ -0,0 +1,2 @@
|
||||
// pch.cpp: source file corresponding to the pre-compiled header
|
||||
// When you are using pre-compiled headers, this source file is necessary for compilation to succeed.
|
14
src/module/WormKitTools/src/pch.h
Normal file
14
src/module/WormKitTools/src/pch.h
Normal file
@ -0,0 +1,14 @@
|
||||
// pch.h: This is a precompiled header file.
|
||||
// Files listed below are compiled only once, improving build performance for future builds.
|
||||
// This also affects IntelliSense performance, including code completion and many code browsing features.
|
||||
// However, files listed here are ALL re-compiled if any one of them is updated between builds.
|
||||
// Do not add files here that you will be updating frequently as this negates the performance advantage.
|
||||
|
||||
#ifndef PCH_H
|
||||
#define PCH_H
|
||||
|
||||
// add headers that you want to pre-compile here
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <Windows.h>
|
||||
|
||||
#endif
|
160
src/module/WormKitTools/src/wkExe.cpp
Normal file
160
src/module/WormKitTools/src/wkExe.cpp
Normal file
@ -0,0 +1,160 @@
|
||||
#include "wkExe.h"
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
|
||||
namespace wk
|
||||
{
|
||||
// ---- CONSTRUCTORS & DESTRUCTOR ----------------------------------------------------------------------------------
|
||||
|
||||
Exe::Exe(HMODULE hModule)
|
||||
{
|
||||
Handle = hModule == NULL ? GetModuleHandleA(NULL) : hModule;
|
||||
DosHeader = (PIMAGE_DOS_HEADER)Handle;
|
||||
NtHeader = (PIMAGE_NT_HEADERS)((DWORD)DosHeader + DosHeader->e_lfanew);
|
||||
FileHeader = (PIMAGE_FILE_HEADER)&NtHeader->FileHeader;
|
||||
OptHeader = (PIMAGE_OPTIONAL_HEADER)&NtHeader->OptionalHeader;
|
||||
}
|
||||
|
||||
// ---- METHODS (PUBLIC) -------------------------------------------------------------------------------------------
|
||||
|
||||
ULONG_PTR Exe::find(std::string signature)
|
||||
{
|
||||
std::istringstream iss(signature);
|
||||
std::istream_iterator<std::string> begin(iss), end;
|
||||
std::vector<std::string> tokens(begin, end);
|
||||
|
||||
std::vector<int16_t> sig;
|
||||
for (auto& token : tokens)
|
||||
sig.push_back(token == "??" ? -1 : std::stoi(token, 0, 16));
|
||||
|
||||
return find(&sig[0], sig.size());
|
||||
}
|
||||
|
||||
ULONG_PTR Exe::find(int16_t signature[], size_t signatureSize)
|
||||
{
|
||||
PIMAGE_SECTION_HEADER sections = IMAGE_FIRST_SECTION(NtHeader);
|
||||
for (int index = 0; index < FileHeader->NumberOfSections; index++)
|
||||
{
|
||||
if (sections[index].Characteristics != (IMAGE_SCN_CNT_CODE | IMAGE_SCN_MEM_EXECUTE | IMAGE_SCN_MEM_READ))
|
||||
continue;
|
||||
LPBYTE code = (LPBYTE)(ULONG_PTR)Handle + sections[index].VirtualAddress;
|
||||
LPBYTE last = &code[sections[index].SizeOfRawData - signatureSize];
|
||||
for (; code < last; code++)
|
||||
{
|
||||
bool found = true;
|
||||
for (size_t i = 0; i < signatureSize; i++)
|
||||
{
|
||||
if (signature[i] < 0x00 || signature[i] > 0xFF || code[i] == (BYTE)signature[i])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
return (ULONG_PTR)code - (ULONG_PTR)Handle;
|
||||
}
|
||||
}
|
||||
throw std::exception("Could not find signature.");
|
||||
}
|
||||
|
||||
void Exe::setImp(LPVOID import, LPVOID hook)
|
||||
{
|
||||
bool success = false;
|
||||
PIMAGE_IMPORT_DESCRIPTOR imports = getImports();
|
||||
if (!imports)
|
||||
throw std::exception("Import patching failed, import table not found.");
|
||||
|
||||
while (imports->Characteristics)
|
||||
{
|
||||
PIMAGE_THUNK_DATA thunk = (PIMAGE_THUNK_DATA)((ULONG_PTR)Handle + imports->OriginalFirstThunk);
|
||||
PIMAGE_THUNK_DATA table = (PIMAGE_THUNK_DATA)((ULONG_PTR)Handle + imports->FirstThunk);
|
||||
while (thunk->u1.Ordinal)
|
||||
{
|
||||
if (table->u1.Function == (ULONG_PTR)import)
|
||||
{
|
||||
Patch patch(&table->u1.Function, sizeof(ULONG_PTR));
|
||||
patch.write(hook);
|
||||
success = true;
|
||||
}
|
||||
thunk++;
|
||||
table++;
|
||||
}
|
||||
imports++;
|
||||
}
|
||||
|
||||
if (!success)
|
||||
throw std::exception("Import patching failed, import not found.");
|
||||
}
|
||||
|
||||
void Exe::setJmp(ULONG_PTR offset, SIZE_T size, LPVOID callee, DWORD jumpType)
|
||||
{
|
||||
Patch patch(getAddress(offset), size);
|
||||
|
||||
if (size >= 5 && offset)
|
||||
{
|
||||
BYTE opSize, opCode;
|
||||
switch (jumpType)
|
||||
{
|
||||
case JT_PUSHRET: opSize = 6; opCode = 0x68; break;
|
||||
case JT_FARJMP: opSize = 7; opCode = 0xEA; break;
|
||||
case JT_FARCALL: opSize = 7; opCode = 0x9A; break;
|
||||
case JT_CALL: opSize = 5; opCode = 0xE8; break;
|
||||
default: opSize = 5; opCode = 0xE9; break;
|
||||
}
|
||||
|
||||
if (size < opSize)
|
||||
throw std::exception("Not enough space to patch opcode.");
|
||||
|
||||
patch.write(opCode);
|
||||
switch (opSize)
|
||||
{
|
||||
case 7:
|
||||
patch.write((ULONG)callee);
|
||||
patch.write<WORD>(0x23);
|
||||
break;
|
||||
case 6:
|
||||
patch.write((ULONG)callee);
|
||||
patch.write<BYTE>(0xC3);
|
||||
break;
|
||||
default:
|
||||
patch.write((ULONG)callee - (ULONG_PTR)offset - 5);
|
||||
break;
|
||||
}
|
||||
for (DWORD i = opSize; i < size; i++)
|
||||
patch.write((uint8_t)0x90);
|
||||
}
|
||||
}
|
||||
|
||||
void Exe::setNop(ULONG_PTR offset, SIZE_T size)
|
||||
{
|
||||
Patch patch(getAddress(offset), size);
|
||||
while (size--)
|
||||
patch.write((uint8_t)0x90);
|
||||
}
|
||||
|
||||
// ---- METHODS (PRIVATE) ------------------------------------------------------------------------------------------
|
||||
|
||||
LPVOID Exe::getAddress(ULONG_PTR offset)
|
||||
{
|
||||
return (LPVOID)((ULONG_PTR)Handle + offset);
|
||||
}
|
||||
|
||||
PIMAGE_IMPORT_DESCRIPTOR Exe::getImports()
|
||||
{
|
||||
if ((FileHeader->SizeOfOptionalHeader
|
||||
>= FIELD_OFFSET(IMAGE_OPTIONAL_HEADER, DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT + 1]))
|
||||
&& OptHeader->DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress
|
||||
&& OptHeader->DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].Size)
|
||||
{
|
||||
return (PIMAGE_IMPORT_DESCRIPTOR)((ULONG_PTR)Handle
|
||||
+ OptHeader->DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
}
|
39
src/module/WormKitTools/src/wkIni.cpp
Normal file
39
src/module/WormKitTools/src/wkIni.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
#include "wkIni.h"
|
||||
#include <stdio.h>
|
||||
|
||||
namespace wk
|
||||
{
|
||||
Ini::Ini(LPCSTR fileName)
|
||||
{
|
||||
GetModuleFileName(NULL, _filePath, MAX_PATH);
|
||||
char* sepIdx = strrchr(_filePath, '\\') + 1;
|
||||
strcpy_s(sepIdx, MAX_PATH - (int)(sepIdx - _filePath), fileName);
|
||||
}
|
||||
|
||||
void Ini::get(LPCSTR category, LPCSTR key, BOOL& result, UINT fallback) const
|
||||
{
|
||||
result = GetPrivateProfileInt(category, key, fallback, _filePath);
|
||||
}
|
||||
|
||||
void Ini::get(LPCSTR category, LPCSTR key, UINT& result, UINT fallback) const
|
||||
{
|
||||
result = GetPrivateProfileInt(category, key, fallback, _filePath);
|
||||
}
|
||||
|
||||
void Ini::get(LPCSTR category, LPCSTR key, LPSTR result, INT resultLength, LPCSTR fallback) const
|
||||
{
|
||||
GetPrivateProfileString(category, key, fallback, result, resultLength, _filePath);
|
||||
}
|
||||
|
||||
void Ini::set(LPCSTR category, LPCSTR key, UINT value) const
|
||||
{
|
||||
CHAR buffer[32];
|
||||
sprintf_s(buffer, "%d", value);
|
||||
WritePrivateProfileString(category, key, buffer, _filePath);
|
||||
}
|
||||
|
||||
void Ini::set(LPCSTR category, LPCSTR key, LPCSTR value) const
|
||||
{
|
||||
WritePrivateProfileString(category, key, value, _filePath);
|
||||
}
|
||||
}
|
32
src/module/WormKitTools/src/wkPatch.cpp
Normal file
32
src/module/WormKitTools/src/wkPatch.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
#include "wkPatch.h"
|
||||
#include <stdexcept>
|
||||
|
||||
namespace wk
|
||||
{
|
||||
// ---- CONSTRUCTORS & DESTRUCTOR ----------------------------------------------------------------------------------
|
||||
|
||||
Patch::Patch(LPVOID address, SIZE_T size)
|
||||
: _address((LPBYTE)address)
|
||||
, _size(size)
|
||||
, position(0)
|
||||
{
|
||||
if (!_address || !_size)
|
||||
throw std::invalid_argument("Address and size must not be 0.");
|
||||
if (!VirtualProtect(_address, _size, PAGE_EXECUTE_READWRITE, &_oldProtect))
|
||||
throw std::exception("VirtualProtect failed, call GetLastError for more info.");
|
||||
}
|
||||
|
||||
Patch::~Patch()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
// ---- METHODS (PUBLIC) -------------------------------------------------------------------------------------------
|
||||
|
||||
void Patch::close() const
|
||||
{
|
||||
DWORD oldProtect;
|
||||
if (!VirtualProtect(_address, _size, _oldProtect, &oldProtect))
|
||||
throw std::exception("VirtualProtect failed, call GetLastError for more info.");
|
||||
}
|
||||
};
|
46
src/module/WormKitTools/src/wkUtils.cpp
Normal file
46
src/module/WormKitTools/src/wkUtils.cpp
Normal file
@ -0,0 +1,46 @@
|
||||
#include "wkUtils.h"
|
||||
#include <string>
|
||||
#include "wkPatch.h"
|
||||
|
||||
namespace wk
|
||||
{
|
||||
int getGameID(DWORD timeDateStamp)
|
||||
{
|
||||
switch (timeDateStamp)
|
||||
{
|
||||
case 0x3528DAFA: return GAMEID_W2_1_05_BR;
|
||||
case 0x3528DCB1: return GAMEID_W2_1_05_EN;
|
||||
case 0x3528DB52: return GAMEID_W2_1_05_GE;
|
||||
case 0x3528DA98: return GAMEID_W2_1_05_NA;
|
||||
case 0x3528DBDA: return GAMEID_W2_1_05_SA;
|
||||
case 0x3587BE19: return GAMEID_W2_1_07_TRY;
|
||||
case 0x4CE25091: return GAMEID_WA_3_6_31;
|
||||
case 0x513D83BC: return GAMEID_WA_3_7_2_1;
|
||||
case 0x5EF04515: return GAMEID_WA_3_8_CD;
|
||||
default: return GAMEID_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
std::string getErrorMessage(int error)
|
||||
{
|
||||
if (error == ERROR_SUCCESS)
|
||||
return std::string();
|
||||
|
||||
LPTSTR buffer = NULL;
|
||||
const DWORD cchMsg = FormatMessageA(
|
||||
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL,
|
||||
error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), reinterpret_cast<LPTSTR>(&buffer), 0, NULL);
|
||||
if (cchMsg > 0)
|
||||
{
|
||||
std::string message(buffer);
|
||||
LocalFree(buffer);
|
||||
return message;
|
||||
}
|
||||
else
|
||||
{
|
||||
CHAR buffer[32];
|
||||
sprintf_s(buffer, "Error code 0x%08X.", error);
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
}
|
99
src/module/fkDesPatch/fkDesPatch.vcxproj
Normal file
99
src/module/fkDesPatch/fkDesPatch.vcxproj
Normal file
@ -0,0 +1,99 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{6b4d57ea-4642-440a-ab62-2e011d7b64e1}</ProjectGuid>
|
||||
<RootNamespace>fkDesPatch</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>bin\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>bin\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;FKDESPATCH_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\WormKitTools\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;FKDESPATCH_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\WormKitTools\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\WormKitTools\WormKitTools.vcxproj">
|
||||
<Project>{068a8647-0a66-4e39-983b-43aceac5c937}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
84
src/module/fkDesPatch/main.cpp
Normal file
84
src/module/fkDesPatch/main.cpp
Normal file
@ -0,0 +1,84 @@
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <stdint.h>
|
||||
#include <Windows.h>
|
||||
#include "wkExe.h"
|
||||
#include "wkIni.h"
|
||||
#include "wkUtils.h"
|
||||
|
||||
// ---- Initialization ----
|
||||
|
||||
BOOL iniAutoOssett;
|
||||
|
||||
void init()
|
||||
{
|
||||
wk::Ini ini("fkDesPatch.ini");
|
||||
|
||||
// Load INI settings.
|
||||
ini.get("Frontend", "AutoOssett", iniAutoOssett, FALSE);
|
||||
|
||||
// Ensure INI file has been created with default setting.
|
||||
ini.set("Frontend", "AutoOssett", iniAutoOssett);
|
||||
}
|
||||
|
||||
// ---- Patch ----
|
||||
|
||||
void patch(wk::Exe& exe, int gameVersion)
|
||||
{
|
||||
if (gameVersion == wk::GAMEID_W2_1_07_TRY)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// getAddress file to code 0x400C02
|
||||
if (iniAutoOssett)
|
||||
exe.set(0x000446A2, (uint8_t)0xEB);
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Main ----
|
||||
|
||||
int getVersion(DWORD timeDateStamp)
|
||||
{
|
||||
int id = wk::getGameID(timeDateStamp);
|
||||
switch (id)
|
||||
{
|
||||
case wk::GAMEID_W2_1_05_BR:
|
||||
case wk::GAMEID_W2_1_05_EN:
|
||||
case wk::GAMEID_W2_1_05_GE:
|
||||
case wk::GAMEID_W2_1_05_NA:
|
||||
case wk::GAMEID_W2_1_05_SA:
|
||||
case wk::GAMEID_W2_1_07_TRY:
|
||||
return id;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain(HMODULE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
switch (fdwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
{
|
||||
wk::Exe exe;
|
||||
int version = getVersion(exe.FileHeader->TimeDateStamp);
|
||||
if (version)
|
||||
{
|
||||
init();
|
||||
patch(exe, version);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox(NULL, "fkDesPatch is incompatible with your game version. Please run the 1.05 patch or 1.07 "
|
||||
"release of Worms 2. Otherwise, you can delete the module to remove this warning.", "fkDesPatch",
|
||||
MB_ICONWARNING);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
@ -51,8 +51,8 @@ END
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,0,0
|
||||
PRODUCTVERSION 1,0,0,0
|
||||
FILEVERSION 1,0,1,0
|
||||
PRODUCTVERSION 1,0,1,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@ -69,12 +69,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Syroot"
|
||||
VALUE "FileDescription", "fkNetcode"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
VALUE "FileVersion", "1.0.1.0"
|
||||
VALUE "InternalName", "fkNetcode.dll"
|
||||
VALUE "LegalCopyright", "(c) Syroot, licensed under MIT"
|
||||
VALUE "OriginalFilename", "fkNetcode.dll"
|
||||
VALUE "ProductName", "fkNetcode"
|
||||
VALUE "ProductVersion", "1.0.0.0"
|
||||
VALUE "ProductVersion", "1.0.1.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
@ -22,13 +22,13 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
@ -60,6 +60,7 @@
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;FKNETCODE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\WormKitTools\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@ -76,6 +77,7 @@
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;FKNETCODE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\WormKitTools\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@ -87,24 +89,18 @@
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="fkConfig.cpp" />
|
||||
<ClCompile Include="fkPatch.cpp" />
|
||||
<ClCompile Include="fkUtils.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
<ClCompile Include="PEInfo.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="fkConfig.h" />
|
||||
<ClInclude Include="fkPatch.h" />
|
||||
<ClInclude Include="fkUtils.h" />
|
||||
<ClInclude Include="PEInfo.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="fkPatch.inl" />
|
||||
<ResourceCompile Include="fkNetcode.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="fkNetcode.rc" />
|
||||
<ProjectReference Include="..\WormKitTools\WormKitTools.vcxproj">
|
||||
<Project>{068a8647-0a66-4e39-983b-43aceac5c937}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
@ -2,35 +2,36 @@
|
||||
#include <Windows.h>
|
||||
#include <WinInet.h>
|
||||
#include <winsock.h>
|
||||
#include "fkConfig.h"
|
||||
#include "fkUtils.h"
|
||||
#include "PEInfo.h"
|
||||
#include "wkIni.h"
|
||||
#include "wkExe.h"
|
||||
#include "wkPatch.h"
|
||||
#include "wkUtils.h"
|
||||
|
||||
// ---- Configuration ----
|
||||
// ---- Initialization ----
|
||||
|
||||
CHAR cfgFallbackIP[16];
|
||||
CHAR cfgServiceUrl[MAX_PATH];
|
||||
BOOL cfgShowErrors;
|
||||
CHAR iniFallbackIP[16];
|
||||
CHAR iniServiceUrl[MAX_PATH];
|
||||
BOOL iniShowErrors;
|
||||
|
||||
void configure()
|
||||
void init()
|
||||
{
|
||||
fk::Config config("fkNetcode.ini");
|
||||
wk::Ini ini("fkNetcode.ini");
|
||||
|
||||
// Load INI settings.
|
||||
config.get("AddressResolval", "FallbackIP", cfgFallbackIP, 16);
|
||||
config.get("AddressResolval", "ServiceUrl", cfgServiceUrl, MAX_PATH, "http://ip.syroot.com");
|
||||
config.get("AddressResolval", "ShowErrors", cfgShowErrors, TRUE);
|
||||
ini.get("AddressResolval", "FallbackIP", iniFallbackIP, 16);
|
||||
ini.get("AddressResolval", "ServiceUrl", iniServiceUrl, MAX_PATH, "http://ip.syroot.com");
|
||||
ini.get("AddressResolval", "ShowErrors", iniShowErrors, TRUE);
|
||||
|
||||
// Ensure INI file has been created with default setting.
|
||||
config.set("AddressResolval", "FallbackIP", cfgFallbackIP);
|
||||
config.set("AddressResolval", "ServiceUrl", cfgServiceUrl);
|
||||
config.set("AddressResolval", "ShowErrors", cfgShowErrors);
|
||||
ini.set("AddressResolval", "FallbackIP", iniFallbackIP);
|
||||
ini.set("AddressResolval", "ServiceUrl", iniServiceUrl);
|
||||
ini.set("AddressResolval", "ShowErrors", iniShowErrors);
|
||||
|
||||
// Validate fallback IP.
|
||||
BYTE b;
|
||||
if (*cfgFallbackIP && sscanf_s(cfgFallbackIP, "%hhu.%hhu.%hhu.%hhu", &b, &b, &b, &b) != 4)
|
||||
if (*iniFallbackIP && sscanf_s(iniFallbackIP, "%hhu.%hhu.%hhu.%hhu", &b, &b, &b, &b) != 4)
|
||||
{
|
||||
*cfgFallbackIP = NULL;
|
||||
*iniFallbackIP = NULL;
|
||||
MessageBox(NULL, "Invalid fallback IP setting in fkNetcode.ini has been ignored.", "fkNetcode", MB_ICONWARNING);
|
||||
}
|
||||
}
|
||||
@ -49,14 +50,14 @@ bool resolveIPCached(LPSTR buffer)
|
||||
|
||||
bool resolveIPExternal(LPSTR buffer)
|
||||
{
|
||||
if (!*cfgServiceUrl)
|
||||
if (!*iniServiceUrl)
|
||||
return false;
|
||||
|
||||
// Query a web service which replies with the IP in plain text.
|
||||
HINTERNET hInternet = 0, hFile = 0;
|
||||
if (hInternet = InternetOpen(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0))
|
||||
{
|
||||
if (hFile = InternetOpenUrl(hInternet, cfgServiceUrl, NULL, 0,
|
||||
if (hFile = InternetOpenUrl(hInternet, iniServiceUrl, NULL, 0,
|
||||
INTERNET_FLAG_NO_COOKIES | INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_RELOAD, NULL))
|
||||
{
|
||||
DWORD responseLength = 0;
|
||||
@ -83,10 +84,10 @@ bool resolveIPExternal(LPSTR buffer)
|
||||
DWORD error = GetLastError();
|
||||
if (hFile) InternetCloseHandle(hFile);
|
||||
if (hInternet) InternetCloseHandle(hInternet);
|
||||
if (error && cfgShowErrors)
|
||||
if (error && iniShowErrors)
|
||||
{
|
||||
CHAR msg[512];
|
||||
sprintf_s(msg, "Could not resolve your IP through the web service. %s", fk::getErrorMessage(error).c_str());
|
||||
sprintf_s(msg, "Could not resolve your IP through the web service. %s", wk::getErrorMessage(error).c_str());
|
||||
MessageBox(NULL, msg, "fkNetcode", MB_ICONWARNING);
|
||||
}
|
||||
return !error;
|
||||
@ -94,9 +95,9 @@ bool resolveIPExternal(LPSTR buffer)
|
||||
|
||||
bool resolveIPFallback(LPSTR buffer)
|
||||
{
|
||||
if (!*cfgFallbackIP)
|
||||
if (!*iniFallbackIP)
|
||||
return false;
|
||||
lstrcpy(buffer, cfgFallbackIP);
|
||||
lstrcpy(buffer, iniFallbackIP);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -133,44 +134,61 @@ bool __stdcall patchResolveIP(LPSTR buffer, int bufferLength)
|
||||
|
||||
// ---- Patch ----
|
||||
|
||||
void patch(PEInfo& pe, int gameVersion)
|
||||
void patch(wk::Exe& exe, int gameVersion)
|
||||
{
|
||||
fk::patchJump((PVOID)pe.Offset(0x00001799), 5, &patchResolveIP, fk::IJ_JUMP); // replace IP resolve with web service
|
||||
exe.setJmp(0x00001799, 5, &patchResolveIP, wk::JT_JMP); // replace IP resolve with web service
|
||||
|
||||
if (gameVersion == fk::GAME_VERSION_TRY)
|
||||
if (gameVersion == wk::GAMEID_W2_1_07_TRY)
|
||||
{
|
||||
fk::patchNops(pe.Offset(0x00053B96), 5); // prevent overriding IP with user name
|
||||
fk::patchNops(pe.Offset(0x00054693), 5); // prevent overriding IP with NAT IP
|
||||
fk::patchNops(pe.Offset(0x00054635), 11); // useless sleep when connecting to server
|
||||
exe.setNop(0x00053B96, 5); // prevent overriding IP with user name
|
||||
exe.setNop(0x00054693, 5); // prevent overriding IP with NAT IP
|
||||
exe.setNop(0x00054635, 11); // useless sleep when connecting to server
|
||||
}
|
||||
else
|
||||
{
|
||||
fk::patchNops(pe.Offset(0x00053E96), 5); // prevent overriding IP with user name
|
||||
fk::patchNops(pe.Offset(0x00054935), 11); // useless sleep when connecting to server
|
||||
fk::patchNops(pe.Offset(0x00054993), 5); // prevent overriding IP with NAT IP
|
||||
exe.setNop(0x00053E96, 5); // prevent overriding IP with user name
|
||||
exe.setNop(0x00054935, 11); // useless sleep when connecting to server
|
||||
exe.setNop(0x00054993, 5); // prevent overriding IP with NAT IP
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Main ----
|
||||
|
||||
int getVersion(DWORD timeDateStamp)
|
||||
{
|
||||
int id = wk::getGameID(timeDateStamp);
|
||||
switch (id)
|
||||
{
|
||||
case wk::GAMEID_W2_1_05_BR:
|
||||
case wk::GAMEID_W2_1_05_EN:
|
||||
case wk::GAMEID_W2_1_05_GE:
|
||||
case wk::GAMEID_W2_1_05_NA:
|
||||
case wk::GAMEID_W2_1_05_SA:
|
||||
case wk::GAMEID_W2_1_07_TRY:
|
||||
return id;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain(HMODULE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
switch (fdwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
{
|
||||
PEInfo pe;
|
||||
int version = fk::getGameVersion(pe.FH->TimeDateStamp);
|
||||
if (version == fk::GAME_VERSION_NONE)
|
||||
wk::Exe exe;
|
||||
int version = getVersion(exe.FileHeader->TimeDateStamp);
|
||||
if (version)
|
||||
{
|
||||
MessageBox(NULL, "fkNetcode is incompatible with your game version. Please run the 1.05 patch or "
|
||||
"1.07 release of Worms 2. Otherwise, you can delete the module to remove this warning.",
|
||||
"fkNetcode", MB_ICONWARNING);
|
||||
init();
|
||||
patch(exe, version);
|
||||
}
|
||||
else
|
||||
{
|
||||
configure();
|
||||
patch(pe, version);
|
||||
MessageBox(NULL, "fkNetcode is incompatible with your game version. Please run the 1.05 patch or 1.07 "
|
||||
"release of Worms 2. Otherwise, you can delete the module to remove this warning.", "fkNetcode",
|
||||
MB_ICONWARNING);
|
||||
}
|
||||
}
|
||||
break;
|
132
src/module/wkUnlimiter/main.cpp
Normal file
132
src/module/wkUnlimiter/main.cpp
Normal file
@ -0,0 +1,132 @@
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <stdint.h>
|
||||
#include <Windows.h>
|
||||
#include "wkConfig.h"
|
||||
#include "wkExe.h"
|
||||
#include "wkUtils.h"
|
||||
|
||||
// ---- Initialization ----
|
||||
|
||||
BOOL iniAllowMultiInstance;
|
||||
BOOL iniEnableAllControls;
|
||||
BOOL iniShowAllControls;
|
||||
BOOL iniUnlockCamera;
|
||||
BOOL iniUnlockCursor;
|
||||
|
||||
void init(int gameID)
|
||||
{
|
||||
wk::Ini ini("wkUnlimiter.ini");
|
||||
|
||||
// Load INI settings.
|
||||
ini.get("Common", "AllowMultiInstance", iniAllowMultiInstance, TRUE);
|
||||
ini.get("Frontend", "EnableAllControls", iniEnableAllControls, TRUE);
|
||||
ini.get("Frontend", "ShowAllControls", iniShowAllControls, FALSE);
|
||||
if (gameID == wk::GAMEID_WA_3_8_CD)
|
||||
{
|
||||
ini.get("Game", "UnlockCamera", iniUnlockCamera, TRUE);
|
||||
ini.get("Game", "UnlockCursor", iniUnlockCursor, TRUE);
|
||||
}
|
||||
|
||||
// Ensure INI file has been created with default setting.
|
||||
ini.set("Common", "AllowMultiInstance", iniAllowMultiInstance);
|
||||
ini.set("Frontend", "EnableAllControls", iniEnableAllControls);
|
||||
ini.set("Frontend", "ShowAllControls", iniShowAllControls);
|
||||
if (gameID == wk::GAMEID_WA_3_8_CD)
|
||||
{
|
||||
ini.set("Game", "UnlockCamera", iniUnlockCamera);
|
||||
ini.set("Game", "UnlockCursor", iniUnlockCursor);
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Patch ----
|
||||
|
||||
HANDLE WINAPI Kernel32_CreateSemaphoreA(LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount,
|
||||
LONG lMaximumCount, LPCSTR lpName)
|
||||
{
|
||||
HANDLE handle = CreateSemaphoreA(lpSemaphoreAttributes, lInitialCount, lMaximumCount, lpName);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
return handle;
|
||||
}
|
||||
|
||||
void patch(wk::Exe& exe, int gameID)
|
||||
{
|
||||
if (iniAllowMultiInstance)
|
||||
{
|
||||
// Requires WormKitDS as game loads modules after this
|
||||
exe.setImp(CreateSemaphoreA, Kernel32_CreateSemaphoreA);
|
||||
}
|
||||
if (iniEnableAllControls)
|
||||
{
|
||||
// CWnd::EnableWindow(bEnable) -> CWnd::EnableWindow(TRUE)
|
||||
exe.set(exe.find("C2 04 00 8B 49 50 8B 01 FF A0 A8") - 13, 0x9090016A);
|
||||
}
|
||||
if (iniShowAllControls)
|
||||
{
|
||||
// CWnd::ShowWindow(bShow) -> CWnd::ShowWindow(TRUE)
|
||||
exe.set(exe.find("C2 04 00 8B 49 50 8B 01 FF A0 A0") - 13, 0x9090016A);
|
||||
}
|
||||
if (iniUnlockCamera)
|
||||
{
|
||||
exe.setNop(exe.find("89 13 EB 06 3B C7 7E 02"), 2); // X- axis
|
||||
exe.setNop(exe.find("89 3B 8B 43 04 3B C1 7D 09 5F 5E"), 2); // X+ axis
|
||||
exe.setNop(exe.find("89 4B 04 5B C2 14 00 3B C6 7E 03"), 3); // Y- axis
|
||||
exe.setNop(exe.find("89 73 04 5F 5E 5B C2 14 00"), 3); // Y+ axis
|
||||
}
|
||||
if (iniUnlockCursor)
|
||||
{
|
||||
exe.setNop(0x00159A72, 6); // X- axis 1
|
||||
exe.setNop(0x00159A8F, 6); // X+ axis 1
|
||||
exe.setNop(0x00159AE5, 6); // Y+ axis 1
|
||||
exe.setNop(0x00159B00, 10); // Y- axis 1 cave
|
||||
exe.setNop(0x00159B19, 6); // Y- axis 1 island
|
||||
exe.setNop(0x00159EAD, 6); // X- axis 2
|
||||
exe.setNop(0x00159ECA, 6); // X+ axis 2
|
||||
exe.setNop(0x00159EE7, 6); // Y+ axis 2
|
||||
exe.setNop(0x00159F02, 10); // Y- axis 2 cave
|
||||
exe.setNop(0x00159F1B, 6); // Y- axis 2 island
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Main ----
|
||||
|
||||
int getVersion(DWORD timeDateStamp)
|
||||
{
|
||||
int id = wk::getGameID(timeDateStamp);
|
||||
switch (id)
|
||||
{
|
||||
case wk::GAMEID_WA_3_6_31:
|
||||
case wk::GAMEID_WA_3_7_2_1:
|
||||
case wk::GAMEID_WA_3_8_CD:
|
||||
return id;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain(HMODULE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
switch (fdwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
{
|
||||
wk::Exe exe;
|
||||
int version = getVersion(exe.FileHeader->TimeDateStamp);
|
||||
if (version)
|
||||
{
|
||||
init(version);
|
||||
patch(exe, version);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox(NULL, "wkUnlimiter is incompatible with your game version. Please run the 3.6.31.0, "
|
||||
"3.7.2.1, or 3.8 CD release of Worms Armageddon. Otherwise, you can delete the module to remove "
|
||||
"this warning.", "wkUnlimiter", MB_ICONWARNING);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
39
src/module/wkUnlimiter/wkConfig.cpp
Normal file
39
src/module/wkUnlimiter/wkConfig.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
#include "wkConfig.h"
|
||||
#include <stdio.h>
|
||||
|
||||
namespace wk
|
||||
{
|
||||
Ini::Ini(LPCSTR fileName)
|
||||
{
|
||||
GetModuleFileName(NULL, _filePath, MAX_PATH);
|
||||
char* sepIdx = strrchr(_filePath, '\\') + 1;
|
||||
strcpy_s(sepIdx, MAX_PATH - (int)(sepIdx - _filePath), fileName);
|
||||
}
|
||||
|
||||
void Ini::get(LPCSTR category, LPCSTR key, BOOL& result, UINT fallback) const
|
||||
{
|
||||
result = GetPrivateProfileInt(category, key, fallback, _filePath);
|
||||
}
|
||||
|
||||
void Ini::get(LPCSTR category, LPCSTR key, UINT& result, UINT fallback) const
|
||||
{
|
||||
result = GetPrivateProfileInt(category, key, fallback, _filePath);
|
||||
}
|
||||
|
||||
void Ini::get(LPCSTR category, LPCSTR key, LPSTR result, INT resultLength, LPCSTR fallback) const
|
||||
{
|
||||
GetPrivateProfileString(category, key, fallback, result, resultLength, _filePath);
|
||||
}
|
||||
|
||||
void Ini::set(LPCSTR category, LPCSTR key, UINT value) const
|
||||
{
|
||||
CHAR buffer[32];
|
||||
sprintf_s(buffer, "%d", value);
|
||||
WritePrivateProfileString(category, key, buffer, _filePath);
|
||||
}
|
||||
|
||||
void Ini::set(LPCSTR category, LPCSTR key, LPCSTR value) const
|
||||
{
|
||||
WritePrivateProfileString(category, key, value, _filePath);
|
||||
}
|
||||
}
|
20
src/module/wkUnlimiter/wkConfig.h
Normal file
20
src/module/wkUnlimiter/wkConfig.h
Normal file
@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include <Windows.h>
|
||||
|
||||
namespace wk
|
||||
{
|
||||
class Ini
|
||||
{
|
||||
public:
|
||||
Ini(LPCSTR fileName);
|
||||
|
||||
void get(LPCSTR category, LPCSTR key, BOOL& result, UINT fallback) const;
|
||||
void get(LPCSTR category, LPCSTR key, UINT& result, UINT fallback) const;
|
||||
void get(LPCSTR category, LPCSTR key, LPSTR result, INT resultLength, LPCSTR fallback = NULL) const;
|
||||
void set(LPCSTR category, LPCSTR key, UINT value) const;
|
||||
void set(LPCSTR category, LPCSTR key, LPCSTR value) const;
|
||||
|
||||
private:
|
||||
CHAR _filePath[MAX_PATH];
|
||||
};
|
||||
}
|
103
src/module/wkUnlimiter/wkUnlimiter.vcxproj
Normal file
103
src/module/wkUnlimiter/wkUnlimiter.vcxproj
Normal file
@ -0,0 +1,103 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{cded4b7c-91df-45d3-9704-db8750bdaf5b}</ProjectGuid>
|
||||
<RootNamespace>wkUnlimiter</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>bin\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>bin\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;WKUNLIMITER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\WormKitTools\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;WKUNLIMITER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\WormKitTools\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="wkConfig.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="wkConfig.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\WormKitTools\WormKitTools.vcxproj">
|
||||
<Project>{068a8647-0a66-4e39-983b-43aceac5c937}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
30
src/module/wkUnlimiter/wkUnlimiter.vcxproj.filters
Normal file
30
src/module/wkUnlimiter/wkUnlimiter.vcxproj.filters
Normal file
@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="wkConfig.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="wkConfig.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -10,9 +10,9 @@
|
||||
|
||||
<!-- References -->
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="2.1.2" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Files Linking -->
|
||||
|
@ -1,5 +1,5 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$(SolutionDir)test.xml" />
|
||||
<Import Project="$(MSBuildThisFileDirectory)..\..\test.xml" />
|
||||
|
||||
<!-- References -->
|
||||
<ItemGroup>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$(SolutionDir)test.xml" />
|
||||
<Import Project="$(MSBuildThisFileDirectory)..\..\test.xml" />
|
||||
|
||||
<!-- References -->
|
||||
<ItemGroup>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$(SolutionDir)test.xml" />
|
||||
<Import Project="$(MSBuildThisFileDirectory)..\..\test.xml" />
|
||||
|
||||
<!-- References -->
|
||||
<ItemGroup>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$(SolutionDir)test.xml" />
|
||||
<Import Project="$(MSBuildThisFileDirectory)..\..\test.xml" />
|
||||
|
||||
<!-- References -->
|
||||
<ItemGroup>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$(SolutionDir)test.xml" />
|
||||
<Import Project="$(MSBuildThisFileDirectory)..\..\test.xml" />
|
||||
|
||||
<!-- References -->
|
||||
<ItemGroup>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$(SolutionDir)test.xml" />
|
||||
<Import Project="$(MSBuildThisFileDirectory)..\..\test.xml" />
|
||||
|
||||
<!-- References -->
|
||||
<ItemGroup>
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
|
||||
namespace Syroot.Worms.Mgame.GameServer
|
||||
{
|
||||
@ -33,8 +34,9 @@ namespace Syroot.Worms.Mgame.GameServer
|
||||
// Retrieve external IP if not yet done and given IP is invalid.
|
||||
if (_ipAddress == null && (IP == null || !IPAddress.TryParse(IP, out _ipAddress)))
|
||||
{
|
||||
using WebClient webClient = new WebClient();
|
||||
_ipAddress = IPAddress.Parse(webClient.DownloadString("https://ip.syroot.com"));
|
||||
using HttpClient httpClient = new HttpClient();
|
||||
_ipAddress = IPAddress.Parse(
|
||||
httpClient.GetStringAsync("https://ip.syroot.com").GetAwaiter().GetResult());
|
||||
}
|
||||
return _ipAddress;
|
||||
}
|
||||
|
@ -4,12 +4,12 @@
|
||||
<AssemblyName>Server</AssemblyName>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFrameworks>netcoreapp3</TargetFrameworks>
|
||||
<TargetFrameworks>net8.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="3.1.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.32" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.32" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="3.1.32" />
|
||||
<PackageReference Include="Syroot.BinaryData.Memory" Version="5.2.2" />
|
||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.1" />
|
||||
<ProjectReference Include="..\..\library\Syroot.Worms.Mgame\Syroot.Worms.Mgame.csproj" />
|
||||
|
@ -16,9 +16,9 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Costura.Fody" Version="4.1.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="3.1.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.32" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.32" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="3.1.32" />
|
||||
<ProjectReference Include="..\..\library\Syroot.Worms.Mgame\Syroot.Worms.Mgame.csproj" />
|
||||
<ProjectReference Include="..\..\library\Syroot.Worms\Syroot.Worms.csproj" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
|
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\library\Syroot.Worms.Armageddon.ProjectX\Syroot.Worms.Armageddon.ProjectX.csproj" />
|
||||
|
@ -40,7 +40,8 @@ namespace Syroot.Worms.Worms2.GameServer
|
||||
Stream stream = client.GetStream();
|
||||
_reader = PipeReader.Create(stream);
|
||||
_writer = PipeWriter.Create(stream);
|
||||
RemoteEndPoint = (IPEndPoint)client.Client.RemoteEndPoint;
|
||||
RemoteEndPoint = client.Client.RemoteEndPoint as IPEndPoint
|
||||
?? throw new ArgumentException("TCP client is not connected.", nameof(client));
|
||||
}
|
||||
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
@ -221,7 +222,7 @@ namespace Syroot.Worms.Worms2.GameServer
|
||||
+ add(PacketField.Value4, packet.Value4, sizeof(int))
|
||||
+ add(PacketField.Value10, packet.Value10, sizeof(int))
|
||||
+ add(PacketField.DataLength, packet.Data, sizeof(int))
|
||||
+ add(PacketField.Data, packet.Data, packet.Data?.Length ?? 0)
|
||||
+ add(PacketField.Data, packet.Data, (packet.Data?.Length ?? 0) + 1)
|
||||
+ add(PacketField.Error, packet.Error, sizeof(int))
|
||||
+ add(PacketField.Name, packet.Name, 20)
|
||||
+ add(PacketField.Session, packet.Session, Unsafe.SizeOf<SessionInfo>());
|
||||
@ -243,8 +244,10 @@ namespace Syroot.Worms.Worms2.GameServer
|
||||
if (packet.Value10 != null) writeInt(ref span, packet.Value10.Value);
|
||||
if (packet.Data != null)
|
||||
{
|
||||
writeInt(ref span, packet.Data.Length);
|
||||
writeInt(ref span, packet.Data.Length + 1);
|
||||
span = span.Slice(Encodings.Windows1252.GetBytes(packet.Data, span));
|
||||
span[0] = 0;
|
||||
span = span.Slice(1);
|
||||
}
|
||||
if (packet.Error != null) writeInt(ref span, packet.Error.Value);
|
||||
if (packet.Name != null)
|
||||
|
@ -23,9 +23,11 @@ namespace Syroot.Worms.Worms2.GameServer
|
||||
|
||||
private static IPEndPoint ParseEndPoint(string? s, IPEndPoint fallback)
|
||||
{
|
||||
if (UInt16.TryParse(s, out ushort port))
|
||||
if (s == null)
|
||||
return fallback;
|
||||
else if (UInt16.TryParse(s, out ushort port))
|
||||
return new IPEndPoint(fallback.Address, port);
|
||||
else if (IPEndPoint.TryParse(s, out IPEndPoint endPoint))
|
||||
else if (IPEndPoint.TryParse(s, out IPEndPoint? endPoint))
|
||||
return endPoint;
|
||||
else
|
||||
return fallback;
|
||||
|
@ -405,7 +405,7 @@ namespace Syroot.Worms.Worms2.GameServer
|
||||
return;
|
||||
|
||||
// Require valid room ID and IP.
|
||||
if (IPAddress.TryParse(packet.Data, out IPAddress ip) && connection.RemoteEndPoint.Address.Equals(ip))
|
||||
if (IPAddress.TryParse(packet.Data, out IPAddress? ip) && connection.RemoteEndPoint.Address.Equals(ip))
|
||||
{
|
||||
Game newGame = new Game(++_lastID, fromUser.Name, fromUser.Session.Nation, fromUser.RoomID,
|
||||
connection.RemoteEndPoint.Address, // do not use bad NAT IP reported by users here
|
||||
|
@ -8,13 +8,13 @@
|
||||
<Authors>Syroot</Authors>
|
||||
<Copyright>(c) Syroot, licensed under MIT</Copyright>
|
||||
<Description>Worms 2 Game Server</Description>
|
||||
<Version>1.1.0</Version>
|
||||
<Version>1.1.1</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- References -->
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Syroot.ColoredConsole" Version="1.0.1" />
|
||||
<PackageReference Include="System.IO.Pipelines" Version="4.7.2" />
|
||||
<PackageReference Include="System.IO.Pipelines" Version="4.7.5" />
|
||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.1" />
|
||||
<ProjectReference Include="..\..\library\Syroot.Worms\Syroot.Worms.csproj" />
|
||||
</ItemGroup>
|
||||
@ -25,7 +25,7 @@
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -1,32 +0,0 @@
|
||||
#include "PEInfo.h"
|
||||
|
||||
PEInfo::PEInfo(HMODULE hModule)
|
||||
{
|
||||
Reset(hModule);
|
||||
}
|
||||
|
||||
void PEInfo::Reset(HMODULE hModule)
|
||||
{
|
||||
Handle = hModule == 0 ? GetModuleHandleA(0) : hModule;
|
||||
DOS = (IMAGE_DOS_HEADER*)Handle;
|
||||
NT = (IMAGE_NT_HEADERS*)((DWORD)DOS + DOS->e_lfanew);
|
||||
FH = (IMAGE_FILE_HEADER*)&NT->FileHeader;
|
||||
OPT = (IMAGE_OPTIONAL_HEADER*)&NT->OptionalHeader;
|
||||
}
|
||||
|
||||
DWORD PEInfo::Offset(DWORD off)
|
||||
{
|
||||
return (DWORD)Handle + off;
|
||||
}
|
||||
|
||||
BOOL PEInfo::PtrInCode(PVOID ptr)
|
||||
{
|
||||
return DWORD(ptr) >= Offset(OPT->BaseOfCode)
|
||||
&& DWORD(ptr) < Offset(OPT->BaseOfCode) + OPT->SizeOfCode;
|
||||
}
|
||||
|
||||
BOOL PEInfo::PtrInData(PVOID ptr)
|
||||
{
|
||||
return DWORD(ptr) >= Offset(OPT->BaseOfData)
|
||||
&& DWORD(ptr) < Offset(OPT->BaseOfData) + OPT->SizeOfInitializedData + OPT->SizeOfUninitializedData;
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
#pragma once
|
||||
#include <Windows.h>
|
||||
|
||||
typedef struct PEInfo
|
||||
{
|
||||
PEInfo(HMODULE hModule = 0);
|
||||
|
||||
void Reset(HMODULE hModule);
|
||||
DWORD Offset(DWORD off);
|
||||
BOOL PtrInCode(PVOID ptr);
|
||||
BOOL PtrInData(PVOID ptr);
|
||||
|
||||
HANDLE Handle;
|
||||
IMAGE_DOS_HEADER* DOS;
|
||||
IMAGE_NT_HEADERS* NT;
|
||||
IMAGE_FILE_HEADER* FH;
|
||||
IMAGE_OPTIONAL_HEADER* OPT;
|
||||
} *PPEInfo;
|
@ -1,38 +0,0 @@
|
||||
#include "fkConfig.h"
|
||||
#include <stdio.h>
|
||||
|
||||
namespace fk
|
||||
{
|
||||
Config::Config(LPCSTR fileName)
|
||||
{
|
||||
DWORD length = GetModuleFileName(NULL, _filePath, MAX_PATH);
|
||||
strcpy_s(strrchr(_filePath, '\\') + 1, MAX_PATH, fileName);
|
||||
}
|
||||
|
||||
void Config::get(LPCSTR category, LPCSTR key, BOOL& result, UINT fallback) const
|
||||
{
|
||||
result = GetPrivateProfileInt(category, key, fallback, _filePath);
|
||||
}
|
||||
|
||||
void Config::get(LPCSTR category, LPCSTR key, UINT& result, UINT fallback) const
|
||||
{
|
||||
result = GetPrivateProfileInt(category, key, fallback, _filePath);
|
||||
}
|
||||
|
||||
void Config::get(LPCSTR category, LPCSTR key, LPSTR result, INT resultLength, LPCSTR fallback) const
|
||||
{
|
||||
GetPrivateProfileString(category, key, fallback, result, resultLength, _filePath);
|
||||
}
|
||||
|
||||
void Config::set(LPCSTR category, LPCSTR key, UINT value) const
|
||||
{
|
||||
CHAR buffer[32];
|
||||
sprintf_s(buffer, "%d", value);
|
||||
WritePrivateProfileString(category, key, buffer, _filePath);
|
||||
}
|
||||
|
||||
void Config::set(LPCSTR category, LPCSTR key, LPCSTR value) const
|
||||
{
|
||||
WritePrivateProfileString(category, key, value, _filePath);
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
#include "fkPatch.h"
|
||||
#include <stdexcept>
|
||||
|
||||
namespace fk
|
||||
{
|
||||
Patch::Patch(LPVOID lpAddress, SIZE_T dwSize)
|
||||
: _lpAddress(static_cast<LPBYTE>(lpAddress))
|
||||
, _dwSize(dwSize)
|
||||
, dwPosition(0)
|
||||
{
|
||||
if (!_lpAddress || !_dwSize)
|
||||
throw std::invalid_argument("Address and size must not be 0.");
|
||||
if (!VirtualProtect(_lpAddress, _dwSize, PAGE_EXECUTE_READWRITE, &_flOldProtect))
|
||||
throw std::exception("VirtualProtect failed, call GetLastError for more info.");
|
||||
}
|
||||
|
||||
Patch::~Patch()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
void Patch::close() const
|
||||
{
|
||||
DWORD oldProtect;
|
||||
if (!VirtualProtect(_lpAddress, _dwSize, _flOldProtect, &oldProtect))
|
||||
throw std::exception("VirtualProtect failed, call GetLastError for more info.");
|
||||
}
|
||||
};
|
@ -1,24 +0,0 @@
|
||||
#pragma once
|
||||
#include <Windows.h>
|
||||
|
||||
namespace fk
|
||||
{
|
||||
struct Patch
|
||||
{
|
||||
public:
|
||||
DWORD dwPosition;
|
||||
|
||||
Patch(LPVOID lpAddress, SIZE_T dwSize);
|
||||
~Patch();
|
||||
|
||||
void close() const;
|
||||
template <class T> void write(const T& value);
|
||||
|
||||
private:
|
||||
LPBYTE _lpAddress;
|
||||
SIZE_T _dwSize;
|
||||
DWORD _flOldProtect;
|
||||
};
|
||||
}
|
||||
|
||||
#include "fkPatch.inl"
|
@ -1,10 +0,0 @@
|
||||
namespace fk
|
||||
{
|
||||
template <class T>
|
||||
void Patch::write(const T& value)
|
||||
{
|
||||
memcpy_s(_lpAddress + dwPosition, sizeof(T), &value, sizeof(T));
|
||||
dwPosition += sizeof(T);
|
||||
}
|
||||
|
||||
}
|
@ -1,89 +0,0 @@
|
||||
#include "fkUtils.h"
|
||||
#include <string>
|
||||
#include "fkPatch.h"
|
||||
|
||||
namespace fk
|
||||
{
|
||||
int getGameVersion(DWORD timeDateStamp)
|
||||
{
|
||||
switch (timeDateStamp)
|
||||
{
|
||||
case 0x3528DAFA: return GAME_VERSION_BR;
|
||||
case 0x3528DCB1: return GAME_VERSION_EN;
|
||||
case 0x3528DB52: return GAME_VERSION_GE;
|
||||
case 0x3528DA98: return GAME_VERSION_NA;
|
||||
case 0x3528DBDA: return GAME_VERSION_SA;
|
||||
case 0x3587BE19: return GAME_VERSION_TRY;
|
||||
}
|
||||
return GAME_VERSION_NONE;
|
||||
}
|
||||
|
||||
std::string getErrorMessage(int error)
|
||||
{
|
||||
if (error == ERROR_SUCCESS)
|
||||
return std::string();
|
||||
|
||||
LPTSTR buffer = NULL;
|
||||
const DWORD cchMsg = FormatMessageA(
|
||||
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL,
|
||||
error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), reinterpret_cast<LPTSTR>(&buffer), 0, NULL);
|
||||
if (cchMsg > 0)
|
||||
{
|
||||
std::string message(buffer);
|
||||
LocalFree(buffer);
|
||||
return message;
|
||||
}
|
||||
else
|
||||
{
|
||||
CHAR buffer[32];
|
||||
sprintf_s(buffer, "Error code 0x%08X.", error);
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
|
||||
void patchNops(ULONG dwAddr, SIZE_T dwPatchSize)
|
||||
{
|
||||
fk::Patch patch(reinterpret_cast<void*>(dwAddr), dwPatchSize);
|
||||
while (dwPatchSize--)
|
||||
patch.write<BYTE>(0x90);
|
||||
}
|
||||
|
||||
void patchJump(PVOID pDest, SIZE_T dwPatchSize, PVOID pCallee, DWORD dwJumpType)
|
||||
{
|
||||
fk::Patch patch(pDest, dwPatchSize);
|
||||
|
||||
if (dwPatchSize >= 5 && pDest)
|
||||
{
|
||||
BYTE OpSize, OpCode;
|
||||
switch (dwJumpType)
|
||||
{
|
||||
case IJ_PUSHRET: OpSize = 6; OpCode = 0x68; break;
|
||||
case IJ_FARJUMP: OpSize = 7; OpCode = 0xEA; break;
|
||||
case IJ_FARCALL: OpSize = 7; OpCode = 0x9A; break;
|
||||
case IJ_CALL: OpSize = 5; OpCode = 0xE8; break;
|
||||
default: OpSize = 5; OpCode = 0xE9; break;
|
||||
}
|
||||
|
||||
if (dwPatchSize < OpSize)
|
||||
throw std::exception("Not enough space to patch opcode.");
|
||||
|
||||
patch.write(OpCode);
|
||||
switch (OpSize)
|
||||
{
|
||||
case 7:
|
||||
patch.write((ULONG)pCallee);
|
||||
patch.write<WORD>(0x23);
|
||||
break;
|
||||
case 6:
|
||||
patch.write((ULONG)pCallee);
|
||||
patch.write<BYTE>(0xC3);
|
||||
break;
|
||||
default:
|
||||
patch.write((ULONG)pCallee - (ULONG)pDest - 5);
|
||||
break;
|
||||
}
|
||||
for (DWORD i = OpSize; i < dwPatchSize; i++)
|
||||
patch.write<BYTE>(0x90);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
#pragma once
|
||||
#include <stdexcept>
|
||||
#include <Windows.h>
|
||||
|
||||
namespace fk
|
||||
{
|
||||
enum GameVersion
|
||||
{
|
||||
GAME_VERSION_NONE = -1,
|
||||
GAME_VERSION_BR, // 1.05 Br
|
||||
GAME_VERSION_EN, // 1.05 Du, En, Fr, It, Po, Sp, Sw
|
||||
GAME_VERSION_GE, // 1.05
|
||||
GAME_VERSION_NA, // 1.05
|
||||
GAME_VERSION_SA, // 1.05
|
||||
GAME_VERSION_TRY // 1.07 Trymedia
|
||||
};
|
||||
|
||||
enum InsertJump
|
||||
{
|
||||
IJ_JUMP, // Insert a jump (0xE9) with patchJump
|
||||
IJ_CALL, // Insert a call (0xE8) with patchJump
|
||||
IJ_FARJUMP, // Insert a farjump (0xEA) with patchJump
|
||||
IJ_FARCALL, // Insert a farcall (0x9A) with patchJump
|
||||
IJ_PUSHRET, // Insert a pushret with patchJump
|
||||
};
|
||||
|
||||
int getGameVersion(DWORD timeDateStamp);
|
||||
std::string getErrorMessage(int error);
|
||||
|
||||
void patchNops(ULONG dwAddr, SIZE_T dwPatchSize);
|
||||
void patchJump(PVOID pDest, SIZE_T dwPatchSize, PVOID pCallee, DWORD dwJumpType = IJ_JUMP);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user