├── .gitattributes
├── LICENSE
├── README.md
└── src
├── Edit Menu Config
├── Edit Menu Config.sln
└── Edit Menu Config
│ ├── Edit Menu Config.aps
│ ├── Edit Menu Config.rc
│ ├── Edit Menu Config.vcxproj
│ ├── Edit Menu Config.vcxproj.filters
│ ├── Edit Menu Config.vcxproj.user
│ ├── main.cpp
│ └── resource.h
├── Launch SOTF Mod Menu
├── Launch SOTF Mod Menu.sln
└── Launch SOTF Mod Menu
│ ├── Launch SOTF Mod Menu.aps
│ ├── Launch SOTF Mod Menu.rc
│ ├── Launch SOTF Mod Menu.vcxproj
│ ├── Launch SOTF Mod Menu.vcxproj.filters
│ ├── Launch SOTF Mod Menu.vcxproj.user
│ ├── ini.h
│ ├── main.cpp
│ └── resource.h
├── SOTF Copy Folder
├── SOTF Copy Folder.sln
└── SOTF Copy Folder
│ ├── SOTF Copy Folder.aps
│ ├── SOTF Copy Folder.rc
│ ├── SOTF Copy Folder.vcxproj
│ ├── SOTF Copy Folder.vcxproj.filters
│ ├── SOTF Copy Folder.vcxproj.user
│ ├── main.cpp
│ └── resource.h
└── SOTFmenu
├── SOTFmenu.sln
└── SOTFmenu
├── Globals.hpp
├── SOTFmenu.vcxproj
├── SOTFmenu.vcxproj.filters
├── SOTFmenu.vcxproj.user
├── config.hpp
├── font.h
├── gui.cpp
├── gui.hpp
├── hooks.cpp
├── hooks.hpp
├── iconfont.h
├── il2cppresolver
├── Cache.cpp
├── Cache.hpp
├── Data.cpp
├── Data.hpp
├── Defines.hpp
├── Functions
│ ├── Callback.cpp
│ ├── Callback.hpp
│ ├── Class.cpp
│ ├── Class.hpp
│ ├── Domain.hpp
│ ├── ResolveCall.hpp
│ ├── String.cpp
│ ├── String.hpp
│ ├── Thread.cpp
│ └── Thread.hpp
├── Il2CppResolver.cpp
├── Il2CppResolver.hpp
├── Includes.hpp
├── Unity
│ ├── API
│ │ ├── Camera.cpp
│ │ ├── Camera.hpp
│ │ ├── Component.cpp
│ │ ├── Component.hpp
│ │ ├── GameObject.cpp
│ │ ├── GameObject.hpp
│ │ ├── LayerMask.cpp
│ │ ├── LayerMask.hpp
│ │ ├── Object.cpp
│ │ ├── Object.hpp
│ │ ├── Rigidbody.cpp
│ │ ├── Rigidbody.hpp
│ │ ├── Transform.cpp
│ │ ├── Transform.hpp
│ │ ├── _TEMPLATE_API.cpp
│ │ └── _TEMPLATE_API.hpp
│ ├── Defines.hpp
│ ├── Includes.hpp
│ ├── Obfuscators.cpp
│ ├── Obfuscators.hpp
│ └── Structures
│ │ ├── Engine.hpp
│ │ ├── Includes.hpp
│ │ ├── System_String.hpp
│ │ ├── il2cpp.hpp
│ │ ├── il2cppArray.hpp
│ │ └── il2cppDictionary.hpp
└── Utils
│ ├── Helper.cpp
│ ├── Helper.hpp
│ ├── Joaat.hpp
│ └── VFunc.hpp
├── imgui
├── imconfig.h
├── imgui.cpp
├── imgui.h
├── imgui_demo.cpp
├── imgui_draw.cpp
├── imgui_impl_dx11.cpp
├── imgui_impl_dx11.h
├── imgui_impl_win32.cpp
├── imgui_impl_win32.h
├── imgui_internal.h
├── imgui_stdlib.cpp
├── imgui_stdlib.h
├── imgui_widgets.cpp
├── imstb_rectpack.h
├── imstb_textedit.h
└── imstb_truetype.h
├── includes.hpp
├── ini.h
├── kiero
├── kiero.cpp
├── kiero.h
└── minhook
│ ├── dll_resources
│ ├── MinHook.aps
│ ├── MinHook.def
│ └── MinHook.rc
│ ├── include
│ └── MinHook.h
│ └── src
│ ├── buffer.c
│ ├── buffer.h
│ ├── hde
│ ├── hde32.c
│ ├── hde32.h
│ ├── hde64.c
│ ├── hde64.h
│ ├── pstdint.h
│ ├── table32.h
│ └── table64.h
│ ├── hook.c
│ ├── trampoline.c
│ └── trampoline.h
├── main.cpp
├── memory.cpp
├── memory.hpp
├── misc.cpp
├── misc.hpp
└── stb_image.h
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 ImAxel0
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # SOTFmenu
2 | A basic Sons Of The Forest in game mod menu
3 |
4 | Mod pages download:
5 | - https://www.nexusmods.com/sonsoftheforest/mods/59
6 | - https://thunderstore.io/c/sons-of-the-forest/p/ImAxel0/SOTF_Menu/
7 |
8 | 
9 |
--------------------------------------------------------------------------------
/src/Edit Menu Config/Edit Menu Config.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.2.32616.157
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Edit Menu Config", "Edit Menu Config\Edit Menu Config.vcxproj", "{3D8DFD8B-05FC-44D6-B553-360473B3877D}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {3D8DFD8B-05FC-44D6-B553-360473B3877D}.Debug|x64.ActiveCfg = Debug|x64
17 | {3D8DFD8B-05FC-44D6-B553-360473B3877D}.Debug|x64.Build.0 = Debug|x64
18 | {3D8DFD8B-05FC-44D6-B553-360473B3877D}.Debug|x86.ActiveCfg = Debug|Win32
19 | {3D8DFD8B-05FC-44D6-B553-360473B3877D}.Debug|x86.Build.0 = Debug|Win32
20 | {3D8DFD8B-05FC-44D6-B553-360473B3877D}.Release|x64.ActiveCfg = Release|x64
21 | {3D8DFD8B-05FC-44D6-B553-360473B3877D}.Release|x64.Build.0 = Release|x64
22 | {3D8DFD8B-05FC-44D6-B553-360473B3877D}.Release|x86.ActiveCfg = Release|Win32
23 | {3D8DFD8B-05FC-44D6-B553-360473B3877D}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {ACA6C2C0-B728-4902-ACBB-0AA252F2F1FF}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/src/Edit Menu Config/Edit Menu Config/Edit Menu Config.aps:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ImAxel0/SOTFmenu/08bdb3ecd1c8f93c15143924ffbf7118e362e374/src/Edit Menu Config/Edit Menu Config/Edit Menu Config.aps
--------------------------------------------------------------------------------
/src/Edit Menu Config/Edit Menu Config/Edit Menu Config.rc:
--------------------------------------------------------------------------------
1 | // Microsoft Visual C++ generated resource script.
2 | //
3 | #include "resource.h"
4 |
5 | #define APSTUDIO_READONLY_SYMBOLS
6 | /////////////////////////////////////////////////////////////////////////////
7 | //
8 | // Generated from the TEXTINCLUDE 2 resource.
9 | //
10 | #include "winres.h"
11 |
12 | /////////////////////////////////////////////////////////////////////////////
13 | #undef APSTUDIO_READONLY_SYMBOLS
14 |
15 | /////////////////////////////////////////////////////////////////////////////
16 | // Italian (Italy) resources
17 |
18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA)
19 | LANGUAGE LANG_ITALIAN, SUBLANG_ITALIAN
20 | #pragma code_page(1252)
21 |
22 | #ifdef APSTUDIO_INVOKED
23 | /////////////////////////////////////////////////////////////////////////////
24 | //
25 | // TEXTINCLUDE
26 | //
27 |
28 | 1 TEXTINCLUDE
29 | BEGIN
30 | "resource.h\0"
31 | END
32 |
33 | 2 TEXTINCLUDE
34 | BEGIN
35 | "#include ""winres.h""\r\n"
36 | "\0"
37 | END
38 |
39 | 3 TEXTINCLUDE
40 | BEGIN
41 | "\r\n"
42 | "\0"
43 | END
44 |
45 | #endif // APSTUDIO_INVOKED
46 |
47 |
48 | /////////////////////////////////////////////////////////////////////////////
49 | //
50 | // Icon
51 | //
52 |
53 | // Icon with lowest ID value placed first to ensure application icon
54 | // remains consistent on all systems.
55 | IDI_ICON1 ICON "C:\\Users\\Alex\\Downloads\\Pelfusion-Long-Shadow-Media-Settings.ico"
56 |
57 | #endif // Italian (Italy) resources
58 | /////////////////////////////////////////////////////////////////////////////
59 |
60 |
61 |
62 | #ifndef APSTUDIO_INVOKED
63 | /////////////////////////////////////////////////////////////////////////////
64 | //
65 | // Generated from the TEXTINCLUDE 3 resource.
66 | //
67 |
68 |
69 | /////////////////////////////////////////////////////////////////////////////
70 | #endif // not APSTUDIO_INVOKED
71 |
72 |
--------------------------------------------------------------------------------
/src/Edit Menu Config/Edit Menu Config/Edit Menu Config.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 | Debug
14 | x64
15 |
16 |
17 | Release
18 | x64
19 |
20 |
21 |
22 | 16.0
23 | Win32Proj
24 | {3d8dfd8b-05fc-44d6-b553-360473b3877d}
25 | Edit_Menu_Config
26 | 10.0
27 |
28 |
29 |
30 | Application
31 | true
32 | v143
33 | Unicode
34 |
35 |
36 | Application
37 | false
38 | v143
39 | true
40 | Unicode
41 |
42 |
43 | Application
44 | true
45 | v143
46 | MultiByte
47 |
48 |
49 | Application
50 | false
51 | v143
52 | true
53 | MultiByte
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 | Level3
76 | true
77 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
78 | true
79 |
80 |
81 | Console
82 | true
83 |
84 |
85 |
86 |
87 | Level3
88 | true
89 | true
90 | true
91 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
92 | true
93 |
94 |
95 | Console
96 | true
97 | true
98 | true
99 |
100 |
101 |
102 |
103 | Level3
104 | true
105 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions)
106 | true
107 | stdcpp20
108 |
109 |
110 | Console
111 | true
112 |
113 |
114 |
115 |
116 | Level3
117 | true
118 | true
119 | true
120 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
121 | true
122 | stdcpp20
123 |
124 |
125 | Console
126 | true
127 | true
128 | true
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
--------------------------------------------------------------------------------
/src/Edit Menu Config/Edit Menu Config/Edit Menu Config.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | File di origine
20 |
21 |
22 |
23 |
24 | File di intestazione
25 |
26 |
27 |
28 |
29 | File di risorse
30 |
31 |
32 |
33 |
34 | File di risorse
35 |
36 |
37 |
--------------------------------------------------------------------------------
/src/Edit Menu Config/Edit Menu Config/Edit Menu Config.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/Edit Menu Config/Edit Menu Config/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 |
7 | #pragma comment (lib, "Shell32")
8 |
9 | int main()
10 | {
11 | // Config Path
12 | std::filesystem::path path;
13 | PWSTR path_tmp;
14 |
15 | auto get_folder_path_ret = SHGetKnownFolderPath(FOLDERID_Documents, 0, nullptr, &path_tmp);
16 |
17 | if (get_folder_path_ret != S_OK) {
18 | CoTaskMemFree(path_tmp);
19 | return 1;
20 | }
21 | path = path_tmp;
22 | CoTaskMemFree(path_tmp);
23 |
24 | path += "\\SOTF\\config\\config.ini";
25 | std::string path_str = path.string();
26 | const char* real_path = path_str.c_str();
27 |
28 | ShellExecute(NULL, "open", real_path, NULL, NULL, SW_SHOW);
29 |
30 | // Game Path
31 | std::filesystem::path path2;
32 | PWSTR path_tmp2;
33 |
34 | auto get_folder_path_ret2 = SHGetKnownFolderPath(FOLDERID_Documents, 0, nullptr, &path_tmp2);
35 |
36 | if (get_folder_path_ret2 != S_OK) {
37 | CoTaskMemFree(path_tmp2);
38 | return 1;
39 | }
40 | path2 = path_tmp2;
41 | CoTaskMemFree(path_tmp2);
42 |
43 | path2 += "\\SOTF\\config\\gamePath.ini";
44 | std::string path_str2 = path2.string();
45 | const char* real_path2 = path_str2.c_str();
46 |
47 | ShellExecute(NULL, "open", real_path2, NULL, NULL, SW_SHOW);
48 |
49 | return 0;
50 | }
--------------------------------------------------------------------------------
/src/Edit Menu Config/Edit Menu Config/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by Edit Menu Config.rc
4 | //
5 | #define IDI_ICON1 101
6 |
7 | // Next default values for new objects
8 | //
9 | #ifdef APSTUDIO_INVOKED
10 | #ifndef APSTUDIO_READONLY_SYMBOLS
11 | #define _APS_NEXT_RESOURCE_VALUE 102
12 | #define _APS_NEXT_COMMAND_VALUE 40001
13 | #define _APS_NEXT_CONTROL_VALUE 1001
14 | #define _APS_NEXT_SYMED_VALUE 101
15 | #endif
16 | #endif
17 |
--------------------------------------------------------------------------------
/src/Launch SOTF Mod Menu/Launch SOTF Mod Menu.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.2.32616.157
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Launch SOTF Mod Menu", "Launch SOTF Mod Menu\Launch SOTF Mod Menu.vcxproj", "{5AE63E86-2E09-408D-B8F6-68591BB4DAD4}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {5AE63E86-2E09-408D-B8F6-68591BB4DAD4}.Debug|x64.ActiveCfg = Debug|x64
17 | {5AE63E86-2E09-408D-B8F6-68591BB4DAD4}.Debug|x64.Build.0 = Debug|x64
18 | {5AE63E86-2E09-408D-B8F6-68591BB4DAD4}.Debug|x86.ActiveCfg = Debug|Win32
19 | {5AE63E86-2E09-408D-B8F6-68591BB4DAD4}.Debug|x86.Build.0 = Debug|Win32
20 | {5AE63E86-2E09-408D-B8F6-68591BB4DAD4}.Release|x64.ActiveCfg = Release|x64
21 | {5AE63E86-2E09-408D-B8F6-68591BB4DAD4}.Release|x64.Build.0 = Release|x64
22 | {5AE63E86-2E09-408D-B8F6-68591BB4DAD4}.Release|x86.ActiveCfg = Release|Win32
23 | {5AE63E86-2E09-408D-B8F6-68591BB4DAD4}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {2BF6AC69-0E58-4947-8FA2-1505083A2F4A}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/src/Launch SOTF Mod Menu/Launch SOTF Mod Menu/Launch SOTF Mod Menu.aps:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ImAxel0/SOTFmenu/08bdb3ecd1c8f93c15143924ffbf7118e362e374/src/Launch SOTF Mod Menu/Launch SOTF Mod Menu/Launch SOTF Mod Menu.aps
--------------------------------------------------------------------------------
/src/Launch SOTF Mod Menu/Launch SOTF Mod Menu/Launch SOTF Mod Menu.rc:
--------------------------------------------------------------------------------
1 | // Microsoft Visual C++ generated resource script.
2 | //
3 | #include "resource.h"
4 |
5 | #define APSTUDIO_READONLY_SYMBOLS
6 | /////////////////////////////////////////////////////////////////////////////
7 | //
8 | // Generated from the TEXTINCLUDE 2 resource.
9 | //
10 | #include "winres.h"
11 |
12 | /////////////////////////////////////////////////////////////////////////////
13 | #undef APSTUDIO_READONLY_SYMBOLS
14 |
15 | /////////////////////////////////////////////////////////////////////////////
16 | // Italian (Italy) resources
17 |
18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA)
19 | LANGUAGE LANG_ITALIAN, SUBLANG_ITALIAN
20 | #pragma code_page(1252)
21 |
22 | #ifdef APSTUDIO_INVOKED
23 | /////////////////////////////////////////////////////////////////////////////
24 | //
25 | // TEXTINCLUDE
26 | //
27 |
28 | 1 TEXTINCLUDE
29 | BEGIN
30 | "resource.h\0"
31 | END
32 |
33 | 2 TEXTINCLUDE
34 | BEGIN
35 | "#include ""winres.h""\r\n"
36 | "\0"
37 | END
38 |
39 | 3 TEXTINCLUDE
40 | BEGIN
41 | "\r\n"
42 | "\0"
43 | END
44 |
45 | #endif // APSTUDIO_INVOKED
46 |
47 |
48 | /////////////////////////////////////////////////////////////////////////////
49 | //
50 | // Icon
51 | //
52 |
53 | // Icon with lowest ID value placed first to ensure application icon
54 | // remains consistent on all systems.
55 | IDI_ICON1 ICON "C:\\Users\\Alex\\Downloads\\SonsOfTheForest-removebg-preview.ico"
56 |
57 | #endif // Italian (Italy) resources
58 | /////////////////////////////////////////////////////////////////////////////
59 |
60 |
61 |
62 | #ifndef APSTUDIO_INVOKED
63 | /////////////////////////////////////////////////////////////////////////////
64 | //
65 | // Generated from the TEXTINCLUDE 3 resource.
66 | //
67 |
68 |
69 | /////////////////////////////////////////////////////////////////////////////
70 | #endif // not APSTUDIO_INVOKED
71 |
72 |
--------------------------------------------------------------------------------
/src/Launch SOTF Mod Menu/Launch SOTF Mod Menu/Launch SOTF Mod Menu.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 | Debug
14 | x64
15 |
16 |
17 | Release
18 | x64
19 |
20 |
21 |
22 | 16.0
23 | Win32Proj
24 | {5ae63e86-2e09-408d-b8f6-68591bb4dad4}
25 | Launch_SOTF_Mod_Menu
26 | 10.0
27 |
28 |
29 |
30 | Application
31 | true
32 | v143
33 | Unicode
34 |
35 |
36 | Application
37 | false
38 | v143
39 | true
40 | Unicode
41 |
42 |
43 | Application
44 | true
45 | v143
46 | Unicode
47 |
48 |
49 | Application
50 | false
51 | v143
52 | true
53 | Unicode
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 | Level3
76 | true
77 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
78 | true
79 |
80 |
81 | Console
82 | true
83 |
84 |
85 |
86 |
87 | Level3
88 | true
89 | true
90 | true
91 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
92 | true
93 |
94 |
95 | Console
96 | true
97 | true
98 | true
99 |
100 |
101 |
102 |
103 | Level3
104 | true
105 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions)
106 | true
107 | stdcpp20
108 |
109 |
110 | Console
111 | true
112 |
113 |
114 |
115 |
116 | Level3
117 | true
118 | true
119 | true
120 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
121 | true
122 | stdcpp20
123 |
124 |
125 | Console
126 | true
127 | true
128 | true
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
--------------------------------------------------------------------------------
/src/Launch SOTF Mod Menu/Launch SOTF Mod Menu/Launch SOTF Mod Menu.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | File di origine
20 |
21 |
22 |
23 |
24 | File di intestazione
25 |
26 |
27 | File di intestazione
28 |
29 |
30 |
31 |
32 | File di risorse
33 |
34 |
35 |
36 |
37 | File di risorse
38 |
39 |
40 |
--------------------------------------------------------------------------------
/src/Launch SOTF Mod Menu/Launch SOTF Mod Menu/Launch SOTF Mod Menu.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/Launch SOTF Mod Menu/Launch SOTF Mod Menu/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include "ini.h"
7 | #include
8 | #include
9 |
10 | using namespace mINI;
11 |
12 | std::string gamePath_str;
13 |
14 | void ReadGamePath()
15 | {
16 | std::filesystem::path path;
17 | PWSTR path_tmp;
18 | auto get_folder_path_ret = SHGetKnownFolderPath(FOLDERID_Documents, 0, nullptr, &path_tmp);
19 | // Error check
20 | if (get_folder_path_ret != S_OK) {
21 | CoTaskMemFree(path_tmp);
22 | }
23 | path = path_tmp;
24 | CoTaskMemFree(path_tmp);
25 | path += "\\SOTF\\config\\gamePath.ini";
26 | std::string path_str = path.string();
27 | const char* real_path = path_str.c_str();
28 |
29 | INIFile config(real_path);
30 | INIStructure ini;
31 |
32 | if (config.read(ini))
33 | {
34 | gamePath_str = ini["Game Path"].get("path");
35 | }
36 | else
37 | {
38 | ini["Game Path"]["path"] = "C:\\Program Files (x86)\\Steam\\steamapps\\common\\Sons Of The Forest\\SonsOfTheForest.exe";
39 | config.write(ini, true);
40 | }
41 | }
42 |
43 | int GetProcessByName(const char* lpProcessName)
44 | {
45 | char lpCurrentProcessName[255];
46 |
47 | PROCESSENTRY32 ProcList{};
48 | ProcList.dwSize = sizeof(ProcList);
49 |
50 | const HANDLE hProcList = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
51 | if (hProcList == INVALID_HANDLE_VALUE)
52 | return 1;
53 |
54 | if (!Process32First(hProcList, &ProcList))
55 | return 1;
56 |
57 | wcstombs_s(nullptr, lpCurrentProcessName, ProcList.szExeFile, 255);
58 |
59 | if (lstrcmpA(lpCurrentProcessName, lpProcessName) == 0)
60 | return ProcList.th32ProcessID;
61 |
62 | while (Process32Next(hProcList, &ProcList))
63 | {
64 | wcstombs_s(nullptr, lpCurrentProcessName, ProcList.szExeFile, 255);
65 |
66 | if (lstrcmpA(lpCurrentProcessName, lpProcessName) == 0)
67 | return ProcList.th32ProcessID;
68 | }
69 |
70 | return 1;
71 | }
72 |
73 | int main()
74 | {
75 | using namespace std::chrono;
76 |
77 | ReadGamePath();
78 |
79 | char dllName[] = "SOTFmenu.dll";
80 | char processName[] = "SonsOfTheForest.exe";
81 | char lpFullDLLPath[MAX_PATH];
82 |
83 | ShellExecuteA(NULL, "open", gamePath_str.c_str(), NULL, NULL, SW_SHOWDEFAULT);
84 |
85 | printf("Waiting for game to load and 20 seconds to inject the Mod Menu (this will close itself after it)\n\n");
86 |
87 | std::this_thread::sleep_for(20s);
88 |
89 | const int dwProcessID = GetProcessByName(processName);
90 | if (dwProcessID == 1)
91 | {
92 | printf("Can't find SonsOfTheForest.exe process\n");
93 | system("pause");
94 | return 1;
95 | }
96 |
97 | const DWORD dwFullPathResult = GetFullPathNameA(dllName, MAX_PATH, lpFullDLLPath, nullptr);
98 | if (dwFullPathResult == 0)
99 | {
100 | printf("Couldn't find dll path\n");
101 | system("pause");
102 | return 1;
103 | }
104 |
105 | const HANDLE hTargetProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcessID);
106 | if (hTargetProcess == INVALID_HANDLE_VALUE)
107 | {
108 | printf("Couldn't open the target process.\n");
109 | system("pause");
110 | return 1;
111 | }
112 |
113 | const LPVOID lpPathAddress = VirtualAllocEx(hTargetProcess, nullptr, lstrlenA(lpFullDLLPath) + 1, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
114 | if (lpPathAddress == nullptr)
115 | {
116 | printf("Couldn't allocate memory in the target process.\n");
117 | system("pause");
118 | return 1;
119 | }
120 |
121 | const DWORD dwWriteResult = WriteProcessMemory(hTargetProcess, lpPathAddress, lpFullDLLPath, lstrlenA(lpFullDLLPath) + 1, nullptr);
122 | if (dwWriteResult == 0)
123 | {
124 | printf("Couldn't write the dll path in the target process.\n");
125 | system("pause");
126 | return 1;
127 | }
128 |
129 | const HMODULE hModule = GetModuleHandleA("kernel32.dll");
130 | if (hModule == INVALID_HANDLE_VALUE || hModule == nullptr)
131 | {
132 | system("pause");
133 | return 1;
134 | }
135 |
136 | const FARPROC lpFunctionAddress = GetProcAddress(hModule, "LoadLibraryA");
137 | if (lpFunctionAddress == nullptr)
138 | {
139 | printf("Couldm't get \"LoadLibraryA\" address.\n");
140 | system("pause");
141 | return 1;
142 | }
143 |
144 | const HANDLE hThreadCreationResult = CreateRemoteThread(hTargetProcess, nullptr, 0, (LPTHREAD_START_ROUTINE)lpFunctionAddress, lpPathAddress, 0, nullptr);
145 | if (hThreadCreationResult == INVALID_HANDLE_VALUE)
146 | {
147 | printf("Couldn't create the thread in the target process.\n");
148 | system("pause");
149 | return 1;
150 | }
151 |
152 | printf("Mod Menu Injected!\n");
153 | return 0;
154 | }
--------------------------------------------------------------------------------
/src/Launch SOTF Mod Menu/Launch SOTF Mod Menu/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by Launch SOTF Mod Menu.rc
4 | //
5 | #define IDI_ICON1 101
6 |
7 | // Next default values for new objects
8 | //
9 | #ifdef APSTUDIO_INVOKED
10 | #ifndef APSTUDIO_READONLY_SYMBOLS
11 | #define _APS_NEXT_RESOURCE_VALUE 102
12 | #define _APS_NEXT_COMMAND_VALUE 40001
13 | #define _APS_NEXT_CONTROL_VALUE 1001
14 | #define _APS_NEXT_SYMED_VALUE 101
15 | #endif
16 | #endif
17 |
--------------------------------------------------------------------------------
/src/SOTF Copy Folder/SOTF Copy Folder.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.2.32616.157
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SOTF Copy Folder", "SOTF Copy Folder\SOTF Copy Folder.vcxproj", "{78C37EFB-AFDD-44FC-9BCF-A7F9AE02EAAC}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {78C37EFB-AFDD-44FC-9BCF-A7F9AE02EAAC}.Debug|x64.ActiveCfg = Debug|x64
17 | {78C37EFB-AFDD-44FC-9BCF-A7F9AE02EAAC}.Debug|x64.Build.0 = Debug|x64
18 | {78C37EFB-AFDD-44FC-9BCF-A7F9AE02EAAC}.Debug|x86.ActiveCfg = Debug|Win32
19 | {78C37EFB-AFDD-44FC-9BCF-A7F9AE02EAAC}.Debug|x86.Build.0 = Debug|Win32
20 | {78C37EFB-AFDD-44FC-9BCF-A7F9AE02EAAC}.Release|x64.ActiveCfg = Release|x64
21 | {78C37EFB-AFDD-44FC-9BCF-A7F9AE02EAAC}.Release|x64.Build.0 = Release|x64
22 | {78C37EFB-AFDD-44FC-9BCF-A7F9AE02EAAC}.Release|x86.ActiveCfg = Release|Win32
23 | {78C37EFB-AFDD-44FC-9BCF-A7F9AE02EAAC}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {7C766F7B-8A6E-4C61-A379-317CD19C2265}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/src/SOTF Copy Folder/SOTF Copy Folder/SOTF Copy Folder.aps:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ImAxel0/SOTFmenu/08bdb3ecd1c8f93c15143924ffbf7118e362e374/src/SOTF Copy Folder/SOTF Copy Folder/SOTF Copy Folder.aps
--------------------------------------------------------------------------------
/src/SOTF Copy Folder/SOTF Copy Folder/SOTF Copy Folder.rc:
--------------------------------------------------------------------------------
1 | // Microsoft Visual C++ generated resource script.
2 | //
3 | #include "resource.h"
4 |
5 | #define APSTUDIO_READONLY_SYMBOLS
6 | /////////////////////////////////////////////////////////////////////////////
7 | //
8 | // Generated from the TEXTINCLUDE 2 resource.
9 | //
10 | #include "winres.h"
11 |
12 | /////////////////////////////////////////////////////////////////////////////
13 | #undef APSTUDIO_READONLY_SYMBOLS
14 |
15 | /////////////////////////////////////////////////////////////////////////////
16 | // Italian (Italy) resources
17 |
18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA)
19 | LANGUAGE LANG_ITALIAN, SUBLANG_ITALIAN
20 | #pragma code_page(1252)
21 |
22 | #ifdef APSTUDIO_INVOKED
23 | /////////////////////////////////////////////////////////////////////////////
24 | //
25 | // TEXTINCLUDE
26 | //
27 |
28 | 1 TEXTINCLUDE
29 | BEGIN
30 | "resource.h\0"
31 | END
32 |
33 | 2 TEXTINCLUDE
34 | BEGIN
35 | "#include ""winres.h""\r\n"
36 | "\0"
37 | END
38 |
39 | 3 TEXTINCLUDE
40 | BEGIN
41 | "\r\n"
42 | "\0"
43 | END
44 |
45 | #endif // APSTUDIO_INVOKED
46 |
47 |
48 | /////////////////////////////////////////////////////////////////////////////
49 | //
50 | // Icon
51 | //
52 |
53 | // Icon with lowest ID value placed first to ensure application icon
54 | // remains consistent on all systems.
55 | IDI_ICON1 ICON "C:\\Users\\Alex\\Downloads\\COPY-FOLDER.ico"
56 |
57 | #endif // Italian (Italy) resources
58 | /////////////////////////////////////////////////////////////////////////////
59 |
60 |
61 |
62 | #ifndef APSTUDIO_INVOKED
63 | /////////////////////////////////////////////////////////////////////////////
64 | //
65 | // Generated from the TEXTINCLUDE 3 resource.
66 | //
67 |
68 |
69 | /////////////////////////////////////////////////////////////////////////////
70 | #endif // not APSTUDIO_INVOKED
71 |
72 |
--------------------------------------------------------------------------------
/src/SOTF Copy Folder/SOTF Copy Folder/SOTF Copy Folder.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 | Debug
14 | x64
15 |
16 |
17 | Release
18 | x64
19 |
20 |
21 |
22 | 16.0
23 | Win32Proj
24 | {78c37efb-afdd-44fc-9bcf-a7f9ae02eaac}
25 | SOTF_Copy_Folder
26 | 10.0
27 |
28 |
29 |
30 | Application
31 | true
32 | v143
33 | Unicode
34 |
35 |
36 | Application
37 | false
38 | v143
39 | true
40 | Unicode
41 |
42 |
43 | Application
44 | true
45 | v143
46 | Unicode
47 |
48 |
49 | Application
50 | false
51 | v143
52 | true
53 | Unicode
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 | Level3
76 | true
77 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
78 | true
79 |
80 |
81 | Console
82 | true
83 |
84 |
85 |
86 |
87 | Level3
88 | true
89 | true
90 | true
91 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
92 | true
93 |
94 |
95 | Console
96 | true
97 | true
98 | true
99 |
100 |
101 |
102 |
103 | Level3
104 | true
105 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions)
106 | true
107 | stdcpp20
108 |
109 |
110 | Console
111 | true
112 |
113 |
114 |
115 |
116 | Level3
117 | true
118 | true
119 | true
120 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
121 | true
122 | stdcpp20
123 |
124 |
125 | Console
126 | true
127 | true
128 | true
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
--------------------------------------------------------------------------------
/src/SOTF Copy Folder/SOTF Copy Folder/SOTF Copy Folder.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | File di origine
20 |
21 |
22 |
23 |
24 | File di intestazione
25 |
26 |
27 |
28 |
29 | File di risorse
30 |
31 |
32 |
33 |
34 | File di risorse
35 |
36 |
37 |
--------------------------------------------------------------------------------
/src/SOTF Copy Folder/SOTF Copy Folder/SOTF Copy Folder.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/SOTF Copy Folder/SOTF Copy Folder/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 |
6 | int main()
7 | {
8 | HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
9 | SetConsoleTextAttribute(hConsole, 15);
10 |
11 | int result{};
12 | std::filesystem::path path;
13 | PWSTR path_tmp;
14 |
15 | auto get_folder_path_ret = SHGetKnownFolderPath(FOLDERID_Documents, 0, nullptr, &path_tmp);
16 | // Error check
17 | if (get_folder_path_ret != S_OK) {
18 | CoTaskMemFree(path_tmp);
19 | return 1;
20 | }
21 | path = path_tmp;
22 | CoTaskMemFree(path_tmp);
23 |
24 | std::cout << "Destination path: " << path << "\n\n";
25 |
26 | try
27 | {
28 | std::filesystem::copy("Copy", path, std::filesystem::copy_options::update_existing | std::filesystem::copy_options::recursive);
29 | }
30 | catch (const std::filesystem::filesystem_error& e) {
31 | SetConsoleTextAttribute(hConsole, 4);
32 | std::cerr << e.what() << std::endl;
33 | system("pause");
34 | return 1;
35 | }
36 | printf("Copying...\n\n");
37 | SetConsoleTextAttribute(hConsole, 2);
38 | std::cout << "SOTF folder copied successfully at: " << path << "\n\n";
39 | SetConsoleTextAttribute(hConsole, 15);
40 |
41 | system("pause");
42 | return 0;
43 | }
--------------------------------------------------------------------------------
/src/SOTF Copy Folder/SOTF Copy Folder/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by SOTF Copy Folder.rc
4 | //
5 | #define IDI_ICON1 101
6 |
7 | // Next default values for new objects
8 | //
9 | #ifdef APSTUDIO_INVOKED
10 | #ifndef APSTUDIO_READONLY_SYMBOLS
11 | #define _APS_NEXT_RESOURCE_VALUE 102
12 | #define _APS_NEXT_COMMAND_VALUE 40001
13 | #define _APS_NEXT_CONTROL_VALUE 1001
14 | #define _APS_NEXT_SYMED_VALUE 101
15 | #endif
16 | #endif
17 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.2.32616.157
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SOTFmenu", "SOTFmenu\SOTFmenu.vcxproj", "{0E7D1620-7B76-4D24-9A05-3BFE99221824}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {0E7D1620-7B76-4D24-9A05-3BFE99221824}.Debug|x64.ActiveCfg = Debug|x64
17 | {0E7D1620-7B76-4D24-9A05-3BFE99221824}.Debug|x64.Build.0 = Debug|x64
18 | {0E7D1620-7B76-4D24-9A05-3BFE99221824}.Debug|x86.ActiveCfg = Debug|Win32
19 | {0E7D1620-7B76-4D24-9A05-3BFE99221824}.Debug|x86.Build.0 = Debug|Win32
20 | {0E7D1620-7B76-4D24-9A05-3BFE99221824}.Release|x64.ActiveCfg = Release|x64
21 | {0E7D1620-7B76-4D24-9A05-3BFE99221824}.Release|x64.Build.0 = Release|x64
22 | {0E7D1620-7B76-4D24-9A05-3BFE99221824}.Release|x86.ActiveCfg = Release|Win32
23 | {0E7D1620-7B76-4D24-9A05-3BFE99221824}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {C9BC23B9-0E64-4B91-82F5-AAB69B74470A}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/Globals.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include "il2cppresolver/Il2CppResolver.hpp"
5 | #include
6 |
7 | #include "includes.h"
8 |
9 | namespace Globals
10 | {
11 | inline uintptr_t GameAssembly{ NULL };
12 | inline Unity::CGameObject* LocalPlayer;
13 | inline Unity::CGameObject* Atmosphere;
14 | inline Unity::CGameObject* GameManagers;
15 | inline Unity::CGameObject* StructureCraftingSystem;
16 | inline Unity::CGameObject* DebugConsole;
17 | inline Unity::CGameObject* CharacterManager;
18 |
19 | inline Unity::CComponent* Vitals;
20 | inline Unity::CComponent* FirstPersonCharacter;
21 | inline Unity::CComponent* PlayerHangGliderAction;
22 | inline Unity::CComponent* CompactPistolWeaponController;
23 | inline Unity::CComponent* RevolverWeaponController;
24 | inline Unity::CComponent* ShotgunWeaponController;
25 | inline Unity::CComponent* PlayerKnightVAction;
26 | inline Unity::CComponent* KnightVControlDefinition;
27 | inline Unity::CComponent* FlashlightController;
28 | inline Unity::CComponent* PlasmaLighterController;
29 | inline Unity::CComponent* LocalPlayerPlasmaLight;
30 | inline Unity::CComponent* RebreatherController;
31 | inline Unity::CComponent* RopeGunController;
32 | inline Unity::CComponent* SunLightManager;
33 | inline Unity::CComponent* SunLight;
34 | inline Unity::CComponent* WindManager;
35 | inline Unity::CComponent* TimeOfDayHolder;
36 | inline Unity::CComponent* StructureCraftingSystem_component;
37 | inline Unity::CComponent* ItemInstanceManager;
38 | inline Unity::CComponent* SeasonsManager;
39 | inline Unity::CComponent* TreeRegrowChecker;
40 | inline Unity::CComponent* CharacterManager_component;
41 |
42 | inline Unity::CObject* CoopLobbyManager;
43 | inline Unity::CObject* CoopLobby;
44 |
45 | inline DWORD Cheats_CheatsBridge_o{};
46 |
47 | namespace Classes
48 | {
49 | inline Unity::il2cppClass* LocalPlayerClass;
50 | }
51 |
52 | namespace Methods
53 | {
54 | inline void* TryAddItems;
55 | inline void* get_ActiveSeason;
56 | inline void* _spawnitem;
57 | inline void* DebugAddCharacter;
58 | }
59 |
60 | namespace Stats
61 | {
62 | inline Unity::CObject* Health;
63 | inline Unity::CObject* Stamina;
64 | inline Unity::CObject* Fullness;
65 | inline Unity::CObject* Hydration;
66 | inline Unity::CObject* Rest;
67 | }
68 |
69 | namespace ToggleStats
70 | {
71 | inline bool toggleFullness = true;
72 | inline bool toggleHydration = true;
73 | inline bool toggleRest = true;
74 | inline bool toggleSpeed = true;
75 | inline bool toggleJumpHeight = true;
76 | }
77 |
78 | namespace Gui
79 | {
80 | inline Present oPresent;
81 | inline ImGuiStyle* style;
82 |
83 | inline bool isFullness = false;
84 | inline bool isHydration = false;
85 | inline bool isRest = false;
86 |
87 | inline bool showMenu = false;
88 | inline bool isOpen = true;
89 | inline std::string window = "home";
90 | inline bool showAbout = false;
91 | inline HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
92 | inline int dot{ 1 };
93 | inline bool CustomTheme = false;
94 | inline bool RainbowTheme = false;
95 | inline bool RainbowThread = true;
96 | inline float RainbowDelay{ 0.5f };
97 | inline ImVec4 LighterColor(0, 1, 0, 1);
98 | inline ImVec4 SunLightColor(1, 0, 0, 1);
99 |
100 | inline bool showMap = false;
101 |
102 | inline int OpenKey{ 0x50 };
103 | inline bool ShowTerminal = true;
104 | }
105 |
106 | inline bool initSingleHooks = false;
107 | inline bool il2cppStatus = false;
108 | }
109 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/SOTFmenu.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/gui.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 |
4 | bool LoadTextureFromFile(const char* filename, ID3D11ShaderResourceView** out_srv, int* out_width, int* out_height);
5 | void InitImGui();
6 | LRESULT __stdcall WndProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
7 | static void HelpMarker(const char* desc);
8 | DWORD WINAPI Rainbow(LPVOID lpReserved);
9 | HRESULT __stdcall hkPresent(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Flags);
10 | bool LoadTextureFromFile(const char* filename, ID3D11ShaderResourceView** out_srv, int* out_width, int* out_height);
11 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/hooks.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include "kiero/minhook/include/MinHook.h"
4 | #include "config.h"
5 | #include "Globals.h"
6 |
7 | typedef BOOL(WINAPI* hk_SetCursorPos)(int, int);
8 | hk_SetCursorPos origSetCursorPos = NULL;
9 |
10 | BOOL WINAPI HOOK_SetCursorPos(int X, int Y)
11 | {
12 | if (Globals::Gui::showMenu) {
13 | return FALSE;
14 | }
15 |
16 | return origSetCursorPos(X, Y);
17 | }
18 |
19 | void InitCursorHook()
20 | {
21 | if (MH_CreateHook(&SetCursorPos, &HOOK_SetCursorPos, reinterpret_cast(&origSetCursorPos)) != MH_OK)
22 | {
23 | std::cout << "Couldn't create hook for SetCursorPos." << '\n';
24 | return;
25 | }
26 |
27 | if (MH_EnableHook(&SetCursorPos) != MH_OK)
28 | {
29 | std::cout << "Couldn't enable SetCursorPos hook." << '\n';
30 | }
31 | }
32 |
33 | // God Mode
34 | void(__fastcall* Vitals__ApplyDamage_o)(DWORD*, float, DWORD*);
35 | void __stdcall Vitals__ApplyDamage_Hook(DWORD* __this, float value, DWORD* method) {
36 |
37 | if (Config::bHealth) {
38 | value = 0.0f;
39 | }
40 | //printf("ApplyDamage hook called!\n");
41 | return Vitals__ApplyDamage_o(__this, value, method);
42 | }
43 | // Stamina
44 | void(__fastcall* Vitals__AdjustStamina_o)(DWORD*, float, DWORD*);
45 | void __stdcall Vitals__AdjustStamina_Hook(DWORD* __this, float value, DWORD* method) {
46 |
47 | if (Config::bStamina) {
48 | value = 0.0f;
49 | }
50 | //printf("AdjustStamina hook called!\n");
51 | return Vitals__AdjustStamina_o(__this, value, method);
52 | }
53 | // Continuously grab the Cheats_CheatsBridge_o* address to call other in game functions, SinglePlayer only!
54 | void(__fastcall* Cheats_o)(DWORD*, DWORD*);
55 | void __stdcall Cheats_Hook(DWORD* __this, DWORD* method) {
56 |
57 | Globals::Cheats_CheatsBridge_o = *__this;
58 |
59 | return Cheats_o(__this, method);
60 | }
61 | // Infinite Ammo
62 | void(__fastcall* Sons_Weapon_RangedWeapon_Ammo__Remove_o)(DWORD*, int, DWORD*);
63 | void __stdcall Sons_Weapon_RangedWeapon_Ammo__Remove_Hook(DWORD* __this, int count, DWORD* method) {
64 |
65 | if (Config::bInfiniteAmmo) {
66 | count = 0;
67 | }
68 | //printf("AdjustStamina hook called!\n");
69 | return Sons_Weapon_RangedWeapon_Ammo__Remove_o(__this, count, method);
70 | }
71 |
72 | void CreateHacksHooks()
73 | {
74 | // God Mode
75 | if (MH_CreateHook(reinterpret_cast(Globals::GameAssembly + Config::Offsets::ApplyDamage), &Vitals__ApplyDamage_Hook, reinterpret_cast(&Vitals__ApplyDamage_o)) != MH_OK) {
76 | SetConsoleTextAttribute(Globals::Gui::hConsole, 4);
77 | printf("[-] Error creating ApplyDamage hook\n");
78 | }
79 | else {
80 | SetConsoleTextAttribute(Globals::Gui::hConsole, 2);
81 | printf("[+] ApplyDamage hook created\n");
82 | }
83 | if (MH_EnableHook(reinterpret_cast(Globals::GameAssembly + Config::Offsets::ApplyDamage)) != MH_OK) {
84 | SetConsoleTextAttribute(Globals::Gui::hConsole, 4);
85 | printf("[-] Error enabling ApplyDamage hook\n");
86 | }
87 | else {
88 | SetConsoleTextAttribute(Globals::Gui::hConsole, 2);
89 | printf("[+] ApplyDamage hook enabled\n");
90 | }
91 | // Stamina
92 | if (MH_CreateHook(reinterpret_cast(Globals::GameAssembly + Config::Offsets::AdjustStamina), &Vitals__AdjustStamina_Hook, reinterpret_cast(&Vitals__AdjustStamina_o)) != MH_OK) {
93 | SetConsoleTextAttribute(Globals::Gui::hConsole, 4);
94 | printf("[-] Error creating AdjustStamina hook\n");
95 | }
96 | else {
97 | SetConsoleTextAttribute(Globals::Gui::hConsole, 2);
98 | printf("[+] AdjustStamina hook created\n");
99 | }
100 | if (MH_EnableHook(reinterpret_cast(Globals::GameAssembly + Config::Offsets::AdjustStamina)) != MH_OK) {
101 | SetConsoleTextAttribute(Globals::Gui::hConsole, 4);
102 | printf("[-] Error enabling AdjustStamina hook\n");
103 | }
104 | else {
105 | SetConsoleTextAttribute(Globals::Gui::hConsole, 2);
106 | printf("[+] AdjustStamina hook enabled\n");
107 | }
108 | // Infinite Ammo
109 | if (MH_CreateHook(reinterpret_cast(Globals::GameAssembly + Config::Offsets::RemoveAmmo), &Sons_Weapon_RangedWeapon_Ammo__Remove_Hook, reinterpret_cast(&Sons_Weapon_RangedWeapon_Ammo__Remove_o)) != MH_OK) {
110 | SetConsoleTextAttribute(Globals::Gui::hConsole, 4);
111 | printf("[-] Error creating Infinite Ammo hook\n");
112 | }
113 | else {
114 | SetConsoleTextAttribute(Globals::Gui::hConsole, 2);
115 | printf("[+] Infinite Ammo hook created\n");
116 | }
117 | if (MH_EnableHook(reinterpret_cast(Globals::GameAssembly + Config::Offsets::RemoveAmmo)) != MH_OK) {
118 | SetConsoleTextAttribute(Globals::Gui::hConsole, 4);
119 | printf("[-] Error enabling Infinite Ammo hook\n");
120 | }
121 | else {
122 | SetConsoleTextAttribute(Globals::Gui::hConsole, 2);
123 | printf("[+] Infinite Ammo hook enabled\n");
124 | }
125 | }
126 |
127 | // Disabled since they seem to have removed Cheats_CheatsBridge_o value
128 | /*
129 | void CreateSinglePlayerHacksHooks()
130 | {
131 | if (MH_CreateHook(reinterpret_cast(Globals::GameAssembly + Config::Offsets::GrabCheats_CheatsBridge_o), &Cheats_Hook, reinterpret_cast(&Cheats_o)) != MH_OK) {
132 | SetConsoleTextAttribute(Globals::Gui::hConsole, 4);
133 | printf("[-] Error creating Grab Cheats_CheatsBridge_o value hook\n");
134 | }
135 | else {
136 | SetConsoleTextAttribute(Globals::Gui::hConsole, 2);
137 | printf("[+] Grab Cheats_CheatsBridge_o value hook created\n");
138 | }
139 | if (MH_EnableHook(reinterpret_cast(Globals::GameAssembly + Config::Offsets::GrabCheats_CheatsBridge_o)) != MH_OK) {
140 | SetConsoleTextAttribute(Globals::Gui::hConsole, 4);
141 | printf("[-] Error enabling Grab Cheats_CheatsBridge_o value hook\n");
142 | }
143 | else {
144 | SetConsoleTextAttribute(Globals::Gui::hConsole, 2);
145 | printf("[+] Grab Cheats_CheatsBridge_o value hook enabled\n");
146 | }
147 | }
148 |
149 | */
150 |
151 | /* From here in game functions calling begins
152 | typedef void* (__cdecl* _Cheats_CheatsBridge__SetGodMode)(DWORD* __this, bool onoff, DWORD* method);
153 | _Cheats_CheatsBridge__SetGodMode Cheats_CheatsBridge__SetGodMode;
154 |
155 | void GodMode()
156 | {
157 | Cheats_CheatsBridge__SetGodMode = (_Cheats_CheatsBridge__SetGodMode)(Globals::GameAssembly + Config::Offsets::GodMode);
158 |
159 | if (Config::bHealthSP)
160 | {
161 | Cheats_CheatsBridge__SetGodMode(&Globals::Cheats_CheatsBridge_o, true, nullptr);
162 | }
163 | else {
164 | Cheats_CheatsBridge__SetGodMode(&Globals::Cheats_CheatsBridge_o, false, nullptr);
165 | }
166 | }
167 |
168 | typedef void* (__cdecl* _Cheats_CheatsBridge__SetInfiniteEnergy)(DWORD* __this, bool onoff, DWORD* method);
169 | _Cheats_CheatsBridge__SetInfiniteEnergy Cheats_CheatsBridge__SetInfiniteEnergy;
170 |
171 | void InfiniteStamina()
172 | {
173 | Cheats_CheatsBridge__SetInfiniteEnergy = (_Cheats_CheatsBridge__SetInfiniteEnergy)(Globals::GameAssembly + Config::Offsets::InfiniteStamina);
174 |
175 | if (Config::bStaminaSP)
176 | {
177 | Cheats_CheatsBridge__SetInfiniteEnergy(&Globals::Cheats_CheatsBridge_o, true, nullptr);
178 | }
179 | else {
180 | Cheats_CheatsBridge__SetInfiniteEnergy(&Globals::Cheats_CheatsBridge_o, false, nullptr);
181 | }
182 | }
183 | */
184 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/hooks.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | inline void InitCursorHook();
4 | inline void CreateHacksHooks();
5 | inline void CreateSinglePlayerHacksHooks();
6 | inline void GodMode();
7 | inline void InfiniteStamina();
8 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Cache.cpp:
--------------------------------------------------------------------------------
1 | #include "Includes.hpp"
2 |
3 | namespace IL2CPP
4 | {
5 | namespace SystemTypeCache
6 | {
7 | class CCache
8 | {
9 | public:
10 | unsigned int m_uHash = 0U;
11 | Unity::il2cppObject* m_pSystemType = nullptr;
12 |
13 | CCache() { }
14 | CCache(unsigned int m_uKey, Unity::il2cppObject* m_pValue)
15 | {
16 | m_uHash = m_uKey;
17 | m_pSystemType = m_pValue;
18 | }
19 | };
20 | std::vector m_vCache;
21 |
22 | void Add(unsigned int m_uHash, Unity::il2cppObject* m_pSystemType)
23 | {
24 | if (!m_pSystemType)
25 | return;
26 |
27 | m_vCache.emplace_back(CCache(m_uHash, m_pSystemType));
28 | }
29 |
30 | void Add(const char* m_pName, Unity::il2cppObject* m_pSystemType)
31 | {
32 | if (!m_pName)
33 | return;
34 |
35 | Add(Utils::JOAAT(m_pName), m_pSystemType);
36 | }
37 |
38 | Unity::il2cppObject* Find(unsigned int m_uHash)
39 | {
40 | size_t m_sSize = m_vCache.size();
41 | if (m_sSize > 0)
42 | {
43 | CCache* m_pData = m_vCache.data();
44 | for (size_t i = 0; m_sSize > i; ++i)
45 | {
46 | if (m_pData[i].m_uHash == m_uHash)
47 | return m_pData[i].m_pSystemType;
48 | }
49 | }
50 |
51 | return nullptr;
52 | }
53 |
54 | Unity::il2cppObject* Find(const char* m_pName)
55 | {
56 | return Find(Utils::JOAAT(m_pName));
57 | }
58 |
59 | namespace Initializer
60 | {
61 | std::vector m_vList;
62 |
63 | void Add(const char* m_pName) { m_vList.emplace_back(m_pName); }
64 |
65 | void PreCache()
66 | {
67 | for (const char* m_pName : m_vList)
68 | SystemTypeCache::Add(m_pName, IL2CPP::Class::GetSystemType(m_pName));
69 |
70 | m_vList.clear();
71 | }
72 | }
73 | }
74 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Cache.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace IL2CPP
4 | {
5 | namespace SystemTypeCache
6 | {
7 | void Add(unsigned int m_uHash, Unity::il2cppObject* m_pSystemType);
8 |
9 | void Add(const char* m_pName, Unity::il2cppObject* m_pSystemType);
10 |
11 | Unity::il2cppObject* Find(unsigned int m_uHash);
12 |
13 | Unity::il2cppObject* Find(const char* m_pName);
14 |
15 | namespace Initializer
16 | {
17 | extern std::vector m_vList;
18 |
19 | /*
20 | * (WARNING) this needs to be called before actual IL2CPP Resolver Init, otherwise use function Add outside Initializer namespace!
21 | */
22 | void Add(const char* m_pName);
23 |
24 | void PreCache();
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Data.cpp:
--------------------------------------------------------------------------------
1 | #include "Includes.hpp"
2 |
3 | namespace IL2CPP { SData Data; }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Data.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace IL2CPP
4 | {
5 | struct SData
6 | {
7 | HMODULE m_hGameAseembly = 0;
8 |
9 | struct SFunctions
10 | {
11 | void* m_pClassFromName = nullptr;
12 | void* m_pClassGetFields = nullptr;
13 | void* m_pClassGetFieldFromName = nullptr;
14 | void* m_pClassGetMethods = nullptr;
15 | void* m_pClassGetMethodFromName = nullptr;
16 | void* m_pClassGetPropertyFromName = nullptr;
17 | void* m_pClassGetType = nullptr;
18 | void* m_pDomainGet = nullptr;
19 | void* m_pDomainGetAssemblies = nullptr;
20 | void* m_pFree = nullptr;
21 | void* m_pImageGetClass = nullptr;
22 | void* m_pImageGetClassCount = nullptr;
23 | void* m_pResolveFunction = nullptr;
24 | void* m_pStringNew = nullptr;
25 | void* m_pThreadAttach = nullptr;
26 | void* m_pThreadDetach = nullptr;
27 | void* m_pTypeGetObject = nullptr;
28 | };
29 | SFunctions Functions;
30 | };
31 | extern SData Data;
32 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Defines.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | // Disable Asserts
3 | //#define IL2CPP_ASSERT(x) assert(0)
4 | #ifndef IL2CPP_ASSERT
5 | #define IL2CPP_ASSERT(x) assert(x)
6 | #endif
7 |
8 | #ifndef IL2CPP_MAIN_MODULE
9 | #define IL2CPP_MAIN_MODULE "GameAssembly.dll"
10 | #endif
11 |
12 | #define IL2CPP_INIT_EXPORT "il2cpp_init"
13 | #define IL2CPP_CLASS_FROM_NAME_EXPORT "il2cpp_class_from_name"
14 | #define IL2CPP_CLASS_GET_FIELDS "il2cpp_class_get_fields"
15 | #define IL2CPP_CLASS_GET_FIELD_FROM_NAME_EXPORT "il2cpp_class_get_field_from_name"
16 | #define IL2CPP_CLASS_GET_METHODS "il2cpp_class_get_methods"
17 | #define IL2CPP_CLASS_GET_METHOD_FROM_NAME_EXPORT "il2cpp_class_get_method_from_name"
18 | #define IL2CPP_CLASS_GET_PROPERTY_FROM_NAME_EXPORT "il2cpp_class_get_property_from_name"
19 | #define IL2CPP_CLASS_GET_TYPE_EXPORT "il2cpp_class_get_type"
20 | #define IL2CPP_DOMAIN_GET_EXPORT "il2cpp_domain_get"
21 | #define IL2CPP_DOMAIN_GET_ASSEMBLIES_EXPORT "il2cpp_domain_get_assemblies"
22 | #define IL2CPP_FREE_EXPORT "il2cpp_free"
23 | #define IL2CPP_IMAGE_GET_CLASS_EXPORT "il2cpp_image_get_class"
24 | #define IL2CPP_IMAGE_GET_CLASS_COUNT_EXPORT "il2cpp_image_get_class_count"
25 | #define IL2CPP_RESOLVE_FUNC_EXPORT "il2cpp_resolve_icall"
26 | #define IL2CPP_STRING_NEW_EXPORT "il2cpp_string_new"
27 | #define IL2CPP_THREAD_ATTACH_EXPORT "il2cpp_thread_attach"
28 | #define IL2CPP_THREAD_DETACH_EXPORT "il2cpp_thread_detach"
29 | #define IL2CPP_TYPE_GET_OBJECT_EXPORT "il2cpp_type_get_object"
30 |
31 | // Calling Convention
32 |
33 | #ifdef _WIN64
34 | #define IL2CPP_CALLING_CONVENTION __fastcall*
35 | #elif _WIN32
36 | #define IL2CPP_CALLING_CONVENTION __cdecl*
37 | #endif
38 |
39 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Functions/Callback.cpp:
--------------------------------------------------------------------------------
1 | #include "../Includes.hpp"
2 |
3 | namespace IL2CPP
4 | {
5 | namespace Callback
6 | {
7 | struct _VFuncCallback
8 | {
9 | std::vector m_vFunctions;
10 |
11 | void** m_pVTable = nullptr;
12 | void* m_pOriginal = nullptr;
13 | };
14 |
15 | namespace OnUpdate
16 | {
17 | _VFuncCallback Data;
18 |
19 | void Add(void* m_pFunction) { Data.m_vFunctions.emplace_back(m_pFunction); }
20 |
21 | void __fastcall Caller(void* rcx)
22 | {
23 | for (void* m_pFunction : Data.m_vFunctions)
24 | reinterpret_cast(m_pFunction)();
25 |
26 | reinterpret_cast(Data.m_pOriginal)(rcx);
27 | }
28 | }
29 |
30 | namespace OnLateUpdate
31 | {
32 | _VFuncCallback Data;
33 |
34 | void Add(void* m_pFunction) { Data.m_vFunctions.emplace_back(m_pFunction); }
35 |
36 | void __fastcall Caller(void* rcx)
37 | {
38 | for (void* m_pFunction : Data.m_vFunctions)
39 | reinterpret_cast(m_pFunction)();
40 |
41 | reinterpret_cast(Data.m_pOriginal)(rcx);
42 | }
43 | }
44 |
45 | void Replace_VFunc(void** m_pVTableFunc, void* m_pCaller, void** m_pCallbackOriginal)
46 | {
47 | DWORD m_dOldProtection = 0x0;
48 | if (m_pVTableFunc && VirtualProtect(m_pVTableFunc, sizeof(void*), PAGE_READWRITE, &m_dOldProtection))
49 | {
50 | if (m_pCallbackOriginal) *m_pCallbackOriginal = *m_pVTableFunc;
51 | *m_pVTableFunc = m_pCaller;
52 |
53 | VirtualProtect(m_pVTableFunc, sizeof(void*), m_dOldProtection, &m_dOldProtection);
54 | }
55 | }
56 |
57 | void Initialize()
58 | {
59 | void* m_pThread = IL2CPP::Thread::Attach(IL2CPP::Domain::Get());
60 |
61 | // Fetch
62 | {
63 | void** m_pMonoBehaviourVTable = *reinterpret_cast(IL2CPP::Helper::GetMonoBehaviour()->m_CachedPtr);
64 | if (m_pMonoBehaviourVTable) // x86: Hello my old friend :)
65 | {
66 | #ifdef _WIN64
67 | OnUpdate::Data.m_pVTable = VFunc::Find_ASM(m_pMonoBehaviourVTable, 99, { 0x33, 0xD2, 0xE9 }); // xor edx, edx | jmp
68 | OnLateUpdate::Data.m_pVTable = VFunc::Find_ASM(m_pMonoBehaviourVTable, 99, { 0xBA, 0x01, 0x00, 0x00, 0x00, 0xE9 }); // mov edx, 1 | jmp
69 | #elif _WIN32
70 | OnUpdate::Data.m_pVTable = VFunc::Find_ASM(m_pMonoBehaviourVTable, 99, { 0x6A, 0x00, 0xE8 }); // push 00 | call
71 | OnLateUpdate::Data.m_pVTable = VFunc::Find_ASM(m_pMonoBehaviourVTable, 99, { 0x6A, 0x01, 0xE8 }); // push 01 | call
72 | #endif
73 | }
74 | }
75 |
76 | IL2CPP::Thread::Detach(m_pThread);
77 |
78 | // Replace
79 | {
80 | Replace_VFunc(OnUpdate::Data.m_pVTable, OnUpdate::Caller, &OnUpdate::Data.m_pOriginal);
81 | Replace_VFunc(OnLateUpdate::Data.m_pVTable, OnLateUpdate::Caller, &OnLateUpdate::Data.m_pOriginal);
82 | }
83 | }
84 |
85 | void Uninitialize()
86 | {
87 | Replace_VFunc(OnUpdate::Data.m_pVTable, OnUpdate::Data.m_pOriginal, nullptr);
88 | Replace_VFunc(OnLateUpdate::Data.m_pVTable, OnLateUpdate::Data.m_pOriginal, nullptr);
89 | }
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Functions/Callback.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace IL2CPP
4 | {
5 | namespace Callback
6 | {
7 | namespace OnUpdate
8 | {
9 | void Add(void* m_pFunction);
10 | }
11 |
12 | namespace OnLateUpdate
13 | {
14 | void Add(void* m_pFunction);
15 | }
16 |
17 | void Initialize();
18 |
19 | void Uninitialize();
20 | }
21 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Functions/Domain.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace IL2CPP
4 | {
5 | namespace Domain
6 | {
7 | static void* Get()
8 | {
9 | return reinterpret_cast(Data.Functions.m_pDomainGet)();
10 | }
11 |
12 | static Unity::il2cppAssembly** GetAssemblies(size_t* m_pSize)
13 | {
14 | return reinterpret_cast(Data.Functions.m_pDomainGetAssemblies)(Get(), m_pSize);
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Functions/ResolveCall.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace IL2CPP
4 | {
5 | // Without this function, you're pretty much fucked up.
6 | static void* ResolveCall(const char* m_pName)
7 | {
8 | return reinterpret_cast(Data.Functions.m_pResolveFunction)(m_pName);
9 | }
10 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Functions/String.cpp:
--------------------------------------------------------------------------------
1 | #include "../Includes.hpp"
2 | #include
3 |
4 | namespace IL2CPP
5 | {
6 | namespace String
7 | {
8 | Unity::System_String* New(const char* m_pString)
9 | {
10 | return reinterpret_cast(Data.Functions.m_pStringNew)(m_pString); // return reinterpret_cast(Data.Functions.m_pStringNew)(m_pString);
11 | }
12 |
13 | Unity::System_String* New(std::string m_sString) { return New(&m_sString[0]); }
14 |
15 | namespace NoGC
16 | {
17 | Unity::System_String* New(const char* m_pString)
18 | {
19 | Unity::System_String* m_pNew = new Unity::System_String;
20 | m_pNew->m_pClass = IL2CPP::Class::Find("System.String");
21 | m_pNew->m_iLength = swprintf_s(m_pNew->m_wString, (sizeof(Unity::System_String::m_wString) / 4), L"%hs", m_pString);
22 |
23 | return m_pNew;
24 | }
25 |
26 | Unity::System_String* New(std::string m_sString) { return New(&m_sString[0]); }
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Functions/String.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace IL2CPP
4 | {
5 | namespace String
6 | {
7 | Unity::System_String* New(const char* m_pString);
8 |
9 | Unity::System_String* New(std::string m_sString);
10 |
11 | // Make sure to delete it after you done using it.
12 | namespace NoGC
13 | {
14 | Unity::System_String* New(const char* m_pString);
15 |
16 | Unity::System_String* New(std::string m_sString);
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Functions/Thread.cpp:
--------------------------------------------------------------------------------
1 | #include "../Includes.hpp"
2 |
3 | namespace IL2CPP
4 | {
5 | DWORD __stdcall ThreadHandler(void* pReserved)
6 | {
7 | void* m_pIL2CPPThread = Thread::Attach(Domain::Get());
8 |
9 | CThread* m_pThread = reinterpret_cast(pReserved);
10 | void* m_pThreadStart = m_pThread->m_pThreadOnStart;
11 | void* m_pThreadEnd = m_pThread->m_pThreadOnEnd;
12 | delete m_pThread;
13 |
14 | reinterpret_cast(m_pThreadStart)();
15 | if (m_pThreadEnd)
16 | reinterpret_cast(m_pThreadEnd)();
17 |
18 | Thread::Detach(m_pIL2CPPThread);
19 | return 0x0;
20 | }
21 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Functions/Thread.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace IL2CPP
4 | {
5 | DWORD __stdcall ThreadHandler(void* pReserved);
6 |
7 | class CThread
8 | {
9 | public:
10 | void* m_pThreadOnStart = nullptr;
11 | void* m_pThreadOnEnd = nullptr;
12 |
13 | CThread() { /* Why would you even do this? */ }
14 | CThread(void* m_pOnStart, void* m_pOnEnd)
15 | {
16 | m_pThreadOnStart = m_pOnStart;
17 | m_pThreadOnEnd = m_pOnEnd;
18 |
19 | if (!m_pThreadOnStart)
20 | {
21 | IL2CPP_ASSERT("IL2CPP::CThread - m_pThreadOnStart is nullptr");
22 | return;
23 | }
24 |
25 | CreateThread(0, 0, ThreadHandler, this, 0, 0);
26 | }
27 | };
28 |
29 | namespace Thread
30 | {
31 | static void Create(void* m_pOnStart, void* m_pOnEnd = nullptr)
32 | {
33 | CThread* pThread = new CThread(m_pOnStart, m_pOnEnd);
34 | IL2CPP_ASSERT(pThread && "IL2CPP::Thread::Create - Failed!");
35 | }
36 |
37 | static void* Attach(void* m_pDomain)
38 | {
39 | return reinterpret_cast(IL2CPP::Data.Functions.m_pThreadAttach)(m_pDomain);
40 | }
41 |
42 | static void Detach(void* m_pThread)
43 | {
44 | reinterpret_cast(IL2CPP::Data.Functions.m_pThreadDetach)(m_pThread);
45 | }
46 | }
47 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Il2CppResolver.cpp:
--------------------------------------------------------------------------------
1 | #include "Il2CppResolver.hpp"
2 |
3 | namespace IL2CPP
4 | {
5 | bool Initialize(bool m_bWaitForModule)
6 | {
7 | if (m_bWaitForModule)
8 | {
9 | while (!Data.m_hGameAseembly)
10 | {
11 | Data.m_hGameAseembly = GetModuleHandleA(IL2CPP_MAIN_MODULE);
12 | Sleep(1000); // Prevent high CPU usage!
13 | }
14 | }
15 | else
16 | {
17 | Data.m_hGameAseembly = GetModuleHandleA(IL2CPP_MAIN_MODULE);
18 | if (!Data.m_hGameAseembly) return false;
19 | }
20 |
21 | if (!UnityAPI::Initialize()) return false;
22 |
23 | return true;
24 | }
25 |
26 | namespace UnityAPI
27 | {
28 | m_eExportObfuscationType m_ExportObfuscation = m_eExportObfuscationType::None;
29 | int m_iROTObfuscationValue = -1;
30 |
31 | void* ResolveExport(const char* m_pName)
32 | {
33 | switch (m_ExportObfuscation)
34 | {
35 | case m_eExportObfuscationType::ROT:
36 | {
37 | if (m_iROTObfuscationValue == -1) // Bruteforce
38 | {
39 | for (int i = 1; 26 > i; ++i)
40 | {
41 | void* pReturn = GetProcAddress(Data.m_hGameAseembly, &Unity::Obfuscators::ROT_String(m_pName, i)[0]);
42 | if (pReturn)
43 | {
44 | m_iROTObfuscationValue = i;
45 | return pReturn;
46 | }
47 | }
48 |
49 | return nullptr;
50 | }
51 |
52 | return GetProcAddress(Data.m_hGameAseembly, &Unity::Obfuscators::ROT_String(m_pName, m_iROTObfuscationValue)[0]);
53 | }
54 | default: return GetProcAddress(Data.m_hGameAseembly, m_pName);
55 | }
56 |
57 | return nullptr;
58 | }
59 |
60 | bool ResolveExport_Boolean(void** m_pAddress, const char* m_pName)
61 | {
62 | *m_pAddress = ResolveExport(m_pName);
63 | IL2CPP_ASSERT(*m_pAddress != nullptr && "Couldn't resolve export!");
64 | return *m_pAddress != nullptr;
65 | }
66 |
67 | bool Initialize()
68 | {
69 | bool m_bInitExportResolved = false;
70 | for (int i = 0; m_eExportObfuscationType::MAX > i; ++i)
71 | {
72 | m_ExportObfuscation = static_cast(i);
73 | if (ResolveExport(IL2CPP_INIT_EXPORT))
74 | {
75 | m_bInitExportResolved = true;
76 | break;
77 | }
78 | }
79 |
80 | IL2CPP_ASSERT(m_bInitExportResolved && "Couldn't resolve il2cpp_init!");
81 | if (!m_bInitExportResolved) return false;
82 |
83 | std::unordered_map m_uExports =
84 | {
85 | { IL2CPP_CLASS_FROM_NAME_EXPORT, &Data.Functions.m_pClassFromName },
86 | { IL2CPP_CLASS_GET_FIELDS, &Data.Functions.m_pClassGetFields },
87 | { IL2CPP_CLASS_GET_FIELD_FROM_NAME_EXPORT, &Data.Functions.m_pClassGetFieldFromName },
88 | { IL2CPP_CLASS_GET_METHODS, &Data.Functions.m_pClassGetMethods },
89 | { IL2CPP_CLASS_GET_METHOD_FROM_NAME_EXPORT, &Data.Functions.m_pClassGetMethodFromName },
90 | { IL2CPP_CLASS_GET_PROPERTY_FROM_NAME_EXPORT, &Data.Functions.m_pClassGetPropertyFromName },
91 | { IL2CPP_CLASS_GET_TYPE_EXPORT, &Data.Functions.m_pClassGetType },
92 | { IL2CPP_DOMAIN_GET_EXPORT, &Data.Functions.m_pDomainGet },
93 | { IL2CPP_DOMAIN_GET_ASSEMBLIES_EXPORT, &Data.Functions.m_pDomainGetAssemblies },
94 | { IL2CPP_FREE_EXPORT, &Data.Functions.m_pFree },
95 | { IL2CPP_IMAGE_GET_CLASS_EXPORT, &Data.Functions.m_pImageGetClass },
96 | { IL2CPP_IMAGE_GET_CLASS_COUNT_EXPORT, &Data.Functions.m_pImageGetClassCount },
97 | { IL2CPP_RESOLVE_FUNC_EXPORT, &Data.Functions.m_pResolveFunction },
98 | { IL2CPP_STRING_NEW_EXPORT, &Data.Functions.m_pStringNew },
99 | { IL2CPP_THREAD_ATTACH_EXPORT, &Data.Functions.m_pThreadAttach },
100 | { IL2CPP_THREAD_DETACH_EXPORT, &Data.Functions.m_pThreadDetach },
101 | { IL2CPP_TYPE_GET_OBJECT_EXPORT, &Data.Functions.m_pTypeGetObject },
102 | };
103 |
104 | for (std::pair m_pExport : m_uExports)
105 | {
106 | if (!ResolveExport_Boolean(m_pExport.second, m_pExport.first))
107 | return false;
108 | }
109 |
110 | // Unity APIs
111 | Unity::Camera::Initialize();
112 | Unity::Component::Initialize();
113 | Unity::GameObject::Initialize();
114 | Unity::LayerMask::Initialize();
115 | Unity::Object::Initialize();
116 | Unity::RigidBody::Initialize();
117 | Unity::Transform::Initialize();
118 |
119 | // Caches
120 | IL2CPP::SystemTypeCache::Initializer::PreCache();
121 |
122 | return true;
123 | }
124 | }
125 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Il2CppResolver.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "Includes.hpp"
3 |
4 | namespace IL2CPP
5 | {
6 | /* Must be called once before using any other functions!
7 | * Args:
8 | * bWaitForModule: (Wait for GameAssembly - can result in infinite loop!)
9 | */
10 | bool Initialize(bool m_bWaitForModule = false);
11 |
12 | namespace UnityAPI
13 | {
14 | enum m_eExportObfuscationType
15 | {
16 | None = 0,
17 | ROT = 1,
18 | MAX = 2,
19 | };
20 |
21 | extern m_eExportObfuscationType m_ExportObfuscation;
22 |
23 | void* ResolveExport(const char* m_pName);
24 |
25 | bool Initialize();
26 | }
27 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Includes.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | // Disable Asserts
3 | // #define IL2CPP_ASSERT(x) ((void)(x))
4 | #include "Defines.hpp"
5 |
6 | #define _USE_MATH_DEFINES
7 | #include
8 | #include
9 | #include
10 | #define WIN32_LEAN_AND_MEAN
11 | #include
12 | #include
13 |
14 | // Unity
15 | #include "Unity/Includes.hpp"
16 |
17 | // IL2CPP API
18 | #include "Data.hpp" // Pointers, Variables, etc...
19 | #include "Cache.hpp"
20 |
21 | // IL2CPP
22 | #include "Functions/Callback.hpp"
23 | #include "Functions/Class.hpp"
24 | #include "Functions/Domain.hpp"
25 | #include "Functions/ResolveCall.hpp"
26 | #include "Functions/String.hpp"
27 | #include "Functions/Thread.hpp"
28 |
29 | // Unity API - Include here so we have access to some cute IL2CPP Features
30 | #include "Unity/API/_TEMPLATE_API.hpp"
31 | #include "Unity/API/Object.hpp"
32 | #include "Unity/API/Component.hpp"
33 | #include "Unity/API/GameObject.hpp"
34 | #include "Unity/API/Camera.hpp"
35 | #include "Unity/API/LayerMask.hpp"
36 | #include "Unity/API/Rigidbody.hpp"
37 | #include "Unity/API/Transform.hpp"
38 |
39 | // Utils
40 | #include "Utils/Helper.hpp"
41 | #include "Utils/Joaat.hpp"
42 | #include "Utils/VFunc.hpp"
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Unity/API/Camera.cpp:
--------------------------------------------------------------------------------
1 | #include "../../Includes.hpp"
2 |
3 | namespace Unity
4 | {
5 | SCameraFunctions CameraFunctions;
6 |
7 | namespace Camera
8 | {
9 | void Initialize()
10 | {
11 | IL2CPP::SystemTypeCache::Initializer::Add(UNITY_CAMERA_CLASS);
12 |
13 | CameraFunctions.m_pGetCurrent = IL2CPP::ResolveCall(UNITY_CAMERA_GETCURRENT);
14 | CameraFunctions.m_pGetMain = IL2CPP::ResolveCall(UNITY_CAMERA_GETMAIN);
15 | CameraFunctions.m_pGetDepth = IL2CPP::ResolveCall(UNITY_CAMERA_GETDEPTH);
16 | CameraFunctions.m_pSetDepth = IL2CPP::ResolveCall(UNITY_CAMERA_SETDEPTH);
17 | CameraFunctions.m_pGetFieldOfView = IL2CPP::ResolveCall(UNITY_CAMERA_GETFIELDOFVIEW);
18 | CameraFunctions.m_pSetFieldOfView = IL2CPP::ResolveCall(UNITY_CAMERA_SETFIELDOFVIEW);
19 | CameraFunctions.m_pWorldToScreen = IL2CPP::ResolveCall(UNITY_CAMERA_WORLDTOSCREEN);
20 | }
21 |
22 | CCamera* GetCurrent()
23 | {
24 | return reinterpret_cast(CameraFunctions.m_pGetCurrent)();
25 | }
26 |
27 | CCamera* GetMain()
28 | {
29 | return reinterpret_cast(CameraFunctions.m_pGetMain)();
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Unity/API/Camera.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace Unity
4 | {
5 | struct SCameraFunctions
6 | {
7 | void* m_pGetCurrent = nullptr;
8 | void* m_pGetMain = nullptr;
9 | void* m_pGetDepth = nullptr;
10 | void* m_pSetDepth = nullptr;
11 | void* m_pGetFieldOfView = nullptr;
12 | void* m_pSetFieldOfView = nullptr;
13 | void* m_pWorldToScreen = nullptr;
14 | };
15 | extern SCameraFunctions CameraFunctions;
16 |
17 | class CCamera : public CGameObject
18 | {
19 | public:
20 | float GetDepth()
21 | {
22 | return reinterpret_cast(CameraFunctions.m_pGetDepth)(this);
23 | }
24 |
25 | void SetDepth(float m_fValue)
26 | {
27 | reinterpret_cast(CameraFunctions.m_pSetDepth)(this, m_fValue);
28 | }
29 |
30 | float GetFieldOfView()
31 | {
32 | return reinterpret_cast(CameraFunctions.m_pGetFieldOfView)(this);
33 | }
34 |
35 | void SetFieldOfView(float m_fValue)
36 | {
37 | reinterpret_cast(CameraFunctions.m_pSetFieldOfView)(this, m_fValue);
38 | }
39 |
40 | void WorldToScreen(Vector3& m_vWorld, Vector3& m_vScreen, int m_iEye = 2)
41 | {
42 | reinterpret_cast(CameraFunctions.m_pWorldToScreen)(this, m_vWorld, m_iEye, m_vScreen);
43 | }
44 | };
45 |
46 | namespace Camera
47 | {
48 | void Initialize();
49 |
50 | CCamera* GetCurrent();
51 |
52 | CCamera* GetMain();
53 | }
54 |
55 | enum m_eCameraType : int
56 | {
57 | m_eCameraType_Game = 1,
58 | m_eCameraType_SceneView = 2,
59 | m_eCameraType_Preview = 4,
60 | m_eCameraType_VR = 8,
61 | m_eCameraType_Reflection = 16,
62 | };
63 |
64 | enum m_eCameraEye : int
65 | {
66 | m_eCameraEye_Left = 0,
67 | m_eCameraEye_Right = 1,
68 | m_eCameraEye_Center = 2,
69 | };
70 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Unity/API/Component.cpp:
--------------------------------------------------------------------------------
1 | #include "../../Includes.hpp"
2 |
3 | namespace Unity
4 | {
5 | SComponentFunctions ComponentFunctions;
6 |
7 | namespace Component
8 | {
9 | void Initialize()
10 | {
11 | IL2CPP::SystemTypeCache::Initializer::Add(UNITY_COMPONENT_CLASS);
12 |
13 | ComponentFunctions.m_pGetGameObject = IL2CPP::ResolveCall(UNITY_COMPONENT_GETGAMEOBJECT);
14 | ComponentFunctions.m_pGetTransform = IL2CPP::ResolveCall(UNITY_COMPONENT_GETTRANSFORM);
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Unity/API/Component.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace Unity
4 | {
5 | struct SComponentFunctions
6 | {
7 | void* m_pGetGameObject = nullptr;
8 | void* m_pGetTransform = nullptr;
9 | };
10 | extern SComponentFunctions ComponentFunctions;
11 |
12 | class CComponent : public CObject
13 | {
14 | public:
15 | CGameObject* GetGameObject()
16 | {
17 | return reinterpret_cast(ComponentFunctions.m_pGetGameObject)(this);
18 | }
19 |
20 | CTransform* GetTransform()
21 | {
22 | return reinterpret_cast(ComponentFunctions.m_pGetTransform)(this);
23 | }
24 | };
25 |
26 | namespace Component
27 | {
28 | void Initialize();
29 | }
30 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Unity/API/GameObject.cpp:
--------------------------------------------------------------------------------
1 | #include "../../Includes.hpp"
2 | #include
3 |
4 | namespace Unity
5 | {
6 | SGameObjectFunctions GameObjectFunctions;
7 |
8 | namespace GameObject
9 | {
10 | void Initialize()
11 | {
12 | IL2CPP::SystemTypeCache::Initializer::Add(UNITY_GAMEOBJECT_CLASS);
13 |
14 | GameObjectFunctions.m_pAddComponent = IL2CPP::ResolveCall(UNITY_GAMEOBJECT_ADDCOMPONENT);
15 | GameObjectFunctions.m_pCreatePrimitive = IL2CPP::ResolveCall(UNITY_GAMEOBJECT_CREATEPRIMITIVE);
16 | GameObjectFunctions.m_pFind = IL2CPP::ResolveCall(UNITY_GAMEOBJECT_FIND);
17 | GameObjectFunctions.m_pFindGameObjectsWithTag = IL2CPP::ResolveCall(UNITY_GAMEOBJECT_FINDGAMEOBJECTWITHTAG);
18 | GameObjectFunctions.m_pGetComponent = IL2CPP::ResolveCall(UNITY_GAMEOBJECT_GETCOMPONENT);
19 | GameObjectFunctions.m_pGetComponents = IL2CPP::ResolveCall(UNITY_GAMEOBJECT_GETCOMPONENTS);
20 | GameObjectFunctions.m_pGetActive = IL2CPP::ResolveCall(UNITY_GAMEOBJECT_GETACTIVE);
21 | GameObjectFunctions.m_pGetLayer = IL2CPP::ResolveCall(UNITY_GAMEOBJECT_GETLAYER);
22 | GameObjectFunctions.m_pGetTransform = IL2CPP::ResolveCall(UNITY_GAMEOBJECT_GETTRANSFORM);
23 | GameObjectFunctions.m_pSetActive = IL2CPP::ResolveCall(UNITY_GAMEOBJECT_SETACTIVE);
24 | GameObjectFunctions.m_pSetLayer = IL2CPP::ResolveCall(UNITY_GAMEOBJECT_SETLAYER);
25 | GameObjectFunctions.m_pGetComponentInChildren = IL2CPP::ResolveCall(UNITY_GAMEOBJECT_GETCOMPONENTINCHILDREN);
26 | }
27 |
28 | CGameObject* CreatePrimitive(m_ePrimitiveType m_eType)
29 | {
30 | return reinterpret_cast(GameObjectFunctions.m_pCreatePrimitive)(m_eType);
31 | }
32 |
33 | CGameObject* Find(const char* m_pName)
34 | {
35 | return reinterpret_cast(GameObjectFunctions.m_pFind)(IL2CPP::String::New(m_pName));
36 | }
37 |
38 | il2cppArray* FindWithTag(const char* m_pTag)
39 | {
40 | return reinterpret_cast*(UNITY_CALLING_CONVENTION)(void*)>(GameObjectFunctions.m_pFindGameObjectsWithTag)(IL2CPP::String::New(m_pTag));
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Unity/API/GameObject.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 |
4 | namespace Unity
5 | {
6 | struct SGameObjectFunctions
7 | {
8 | void* m_pAddComponent = nullptr;
9 | void* m_pCreatePrimitive = nullptr;
10 | void* m_pFind = nullptr;
11 | void* m_pFindGameObjectsWithTag = nullptr;
12 | void* m_pGetComponent = nullptr;
13 | void* m_pGetComponents = nullptr;
14 | void* m_pGetActive = nullptr;
15 | void* m_pGetLayer = nullptr;
16 | void* m_pGetTransform = nullptr;
17 | void* m_pSetActive = nullptr;
18 | void* m_pSetLayer = nullptr;
19 | void* m_pGetComponentInChildren = nullptr;
20 | };
21 | extern SGameObjectFunctions GameObjectFunctions;
22 |
23 | class CGameObject : public CObject
24 | {
25 | public:
26 | void AddComponent(il2cppObject* m_pSystemType)
27 | {
28 | reinterpret_cast(GameObjectFunctions.m_pAddComponent)(this, m_pSystemType);
29 | }
30 |
31 | CComponent* GetComponent(const char* m_pName)
32 | {
33 | return reinterpret_cast(GameObjectFunctions.m_pGetComponent)(this, IL2CPP::String::New(m_pName));
34 | }
35 |
36 | CComponent* GetComponentInChildren(il2cppObject* m_pSystemType, bool includeInactive)
37 | {
38 | return reinterpret_cast(GameObjectFunctions.m_pGetComponentInChildren)(this, m_pSystemType, includeInactive);
39 | }
40 |
41 | // e.g CGameObject->GetComponentInChildren("Namespace.Component");
42 | CComponent* GetComponentInChildren(const char* type)
43 | {
44 | il2cppClass* m_pClass = IL2CPP::Class::Find(type);
45 | if (!m_pClass) return nullptr;
46 |
47 | return GetComponentInChildren(IL2CPP::Class::GetSystemType(m_pClass), true);
48 | }
49 |
50 | il2cppArray* GetComponents(il2cppObject* m_pSystemType)
51 | {
52 | /*
53 | 0 - Object
54 | 1 - Type
55 | 2 - Use search type as array return type
56 | 3 - Recursive
57 | 4 - Include inactive
58 | 5 - Reverse
59 | 6 - Result list
60 | */
61 | return reinterpret_cast*(UNITY_CALLING_CONVENTION)(void*, void*, bool, bool, bool, bool, void*)>(GameObjectFunctions.m_pGetComponents)(this, m_pSystemType, false, false, true, false, nullptr);
62 | }
63 |
64 | il2cppArray* GetComponents(const char* m_pSystemTypeName)
65 | {
66 | il2cppClass* m_pClass = IL2CPP::Class::Find(m_pSystemTypeName);
67 | if (!m_pClass) return nullptr;
68 |
69 | return GetComponents(IL2CPP::Class::GetSystemType(m_pClass));
70 | }
71 |
72 | CComponent* GetComponentByIndex(il2cppObject* m_pSystemType, unsigned int m_uIndex = 0U)
73 | {
74 | il2cppArray* m_pComponents = GetComponents(m_pSystemType);
75 | if (!m_pComponents || m_uIndex >= m_pComponents->m_uMaxLength) return nullptr;
76 |
77 | return m_pComponents->operator[](m_uIndex);
78 | }
79 |
80 | CComponent* GetComponentByIndex(const char* m_pSystemTypeName, unsigned int m_uIndex = 0U)
81 | {
82 | il2cppClass* m_pClass = IL2CPP::Class::Find(m_pSystemTypeName);
83 | if (!m_pClass) return nullptr;
84 |
85 | return GetComponentByIndex(IL2CPP::Class::GetSystemType(m_pClass), m_uIndex);
86 | }
87 |
88 | CTransform* GetTransform()
89 | {
90 | return reinterpret_cast(GameObjectFunctions.m_pGetTransform)(this);
91 | }
92 |
93 | bool GetActive()
94 | {
95 | return reinterpret_cast(GameObjectFunctions.m_pGetActive)(this);
96 | }
97 |
98 | unsigned int GetLayer()
99 | {
100 | return reinterpret_cast(GameObjectFunctions.m_pGetLayer)(this);
101 | }
102 |
103 | /*
104 | * (WARNING) when you use GameObject::Find and you set the object to unactive, you won't find it anymore with that slow function.
105 | */
106 | void SetActive(bool m_bActive)
107 | {
108 | reinterpret_cast(GameObjectFunctions.m_pSetActive)(this, m_bActive);
109 | }
110 |
111 | void SetLayer(unsigned int m_uLayer)
112 | {
113 | reinterpret_cast(GameObjectFunctions.m_pSetLayer)(this, m_uLayer);
114 | }
115 | };
116 |
117 | namespace GameObject
118 | {
119 | enum class m_ePrimitiveType : int
120 | {
121 | Default = 0,
122 | Sphere = 0,
123 | Capsule,
124 | Cylinder,
125 | Cube,
126 | Plane,
127 | Quad,
128 | };
129 |
130 | void Initialize();
131 |
132 | CGameObject* CreatePrimitive(m_ePrimitiveType m_eType);
133 |
134 | CGameObject* Find(const char* m_pName); // CGameObject* Find(const char* m_pName);
135 |
136 | il2cppArray* FindWithTag(const char* m_pTag);
137 | }
138 | }
139 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Unity/API/LayerMask.cpp:
--------------------------------------------------------------------------------
1 | #include "../../Includes.hpp"
2 |
3 | namespace Unity
4 | {
5 | SLayerMaskFunctions LayerMaskFunctions;
6 |
7 | namespace LayerMask
8 | {
9 | void Initialize()
10 | {
11 | IL2CPP::SystemTypeCache::Initializer::Add(UNITY_LAYERMASK_CLASS);
12 |
13 | LayerMaskFunctions.m_pLayerToName = IL2CPP::ResolveCall(UNITY_LAYERMASK_LAYERTONAME);
14 | LayerMaskFunctions.m_pNameToLayer = IL2CPP::ResolveCall(UNITY_LAYERMASK_NAMETOLAYER);
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Unity/API/LayerMask.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace Unity
4 | {
5 | struct SLayerMaskFunctions
6 | {
7 | void* m_pLayerToName = nullptr;
8 | void* m_pNameToLayer = nullptr;
9 | };
10 | extern SLayerMaskFunctions LayerMaskFunctions;
11 |
12 | namespace LayerMask
13 | {
14 | void Initialize();
15 |
16 | static System_String* LayerToName(unsigned int m_uLayer)
17 | {
18 | return reinterpret_cast(LayerMaskFunctions.m_pLayerToName)(m_uLayer);
19 | }
20 |
21 | static unsigned int NameToLayer(const char* m_pName)
22 | {
23 | return reinterpret_cast(LayerMaskFunctions.m_pNameToLayer)(IL2CPP::String::New(m_pName));
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Unity/API/Object.cpp:
--------------------------------------------------------------------------------
1 | #include "../../Includes.hpp"
2 |
3 | namespace Unity
4 | {
5 | SObjectFunctions ObjectFunctions;
6 |
7 | namespace Object
8 | {
9 | void Initialize()
10 | {
11 | IL2CPP::SystemTypeCache::Initializer::Add(UNITY_OBJECT_CLASS);
12 |
13 | ObjectFunctions.m_pDestroy = IL2CPP::ResolveCall(UNITY_OBJECT_DESTROY);
14 | ObjectFunctions.m_pFindObjectsOfType = IL2CPP::ResolveCall(UNITY_OBJECT_FINDOBJECTSOFTYPE);
15 | ObjectFunctions.m_pGetName = IL2CPP::ResolveCall(UNITY_OBJECT_GETNAME);
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Unity/API/Object.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace Unity
4 | {
5 | struct SObjectFunctions
6 | {
7 | void* m_pDestroy = nullptr;
8 | void* m_pFindObjectsOfType = nullptr;
9 | void* m_pGetName = nullptr;
10 | };
11 | extern SObjectFunctions ObjectFunctions;
12 |
13 | class CObject : public IL2CPP::CClass
14 | {
15 | public:
16 | void Destroy(float fTimeDelay = 0.f)
17 | {
18 | reinterpret_cast(ObjectFunctions.m_pDestroy)(this, fTimeDelay);
19 | }
20 |
21 | System_String* GetName()
22 | {
23 | return reinterpret_cast(ObjectFunctions.m_pGetName)(this);
24 | }
25 | };
26 |
27 | namespace Object
28 | {
29 | void Initialize();
30 |
31 | template
32 | static il2cppArray* FindObjectsOfType(il2cppObject* m_pSystemType)
33 | {
34 | return reinterpret_cast*(UNITY_CALLING_CONVENTION)(void*)>(ObjectFunctions.m_pFindObjectsOfType)(m_pSystemType);
35 | }
36 |
37 | template
38 | static il2cppArray* FindObjectsOfType(const char* m_pSystemTypeName)
39 | {
40 | il2cppClass* m_pClass = IL2CPP::Class::Find(m_pSystemTypeName);
41 | if (!m_pClass) return nullptr;
42 |
43 | return FindObjectsOfType(IL2CPP::Class::GetSystemType(m_pClass));
44 | }
45 |
46 | template
47 | static T* FindObjectOfType(il2cppObject* m_pSystemType)
48 | {
49 | il2cppArray* m_pArray = FindObjectsOfType(m_pSystemType);
50 | if (!m_pArray || m_pArray->m_uMaxLength == 0U) return nullptr;
51 |
52 | return m_pArray->m_pValues[0];
53 | }
54 |
55 | template
56 | static T* FindObjectOfType(const char* m_pSystemTypeName)
57 | {
58 | il2cppClass* m_pClass = IL2CPP::Class::Find(m_pSystemTypeName);
59 | if (!m_pClass) return nullptr;
60 |
61 | return FindObjectOfType(IL2CPP::Class::GetSystemType(m_pClass));
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Unity/API/Rigidbody.cpp:
--------------------------------------------------------------------------------
1 | #include "../../Includes.hpp"
2 |
3 | namespace Unity
4 | {
5 | SRigidbodyFunctions RigidbodyFunctions;
6 |
7 | namespace RigidBody
8 | {
9 | void Initialize()
10 | {
11 | IL2CPP::SystemTypeCache::Initializer::Add(UNITY_RIGIDBODY_CLASS);
12 |
13 | RigidbodyFunctions.m_pGetDetectCollisions = IL2CPP::ResolveCall(UNITY_RIGIDBODY_GETDETECTCOLLISIONS);
14 | RigidbodyFunctions.m_pGetVelocity = IL2CPP::ResolveCall(UNITY_RIGIDBODY_GETVELOCITY);
15 | RigidbodyFunctions.m_pSetDetectCollisions = IL2CPP::ResolveCall(UNITY_RIGIDBODY_SETDETECTCOLLISIONS);
16 | RigidbodyFunctions.m_pSetVelocity = IL2CPP::ResolveCall(UNITY_RIGIDBODY_SETVELOCITY);
17 |
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Unity/API/Rigidbody.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace Unity
4 | {
5 | struct SRigidbodyFunctions
6 | {
7 | void* m_pGetDetectCollisions = nullptr;
8 | void* m_pGetVelocity = nullptr;
9 | void* m_pSetDetectCollisions = nullptr;
10 | void* m_pSetVelocity = nullptr;
11 | };
12 | extern SRigidbodyFunctions RigidbodyFunctions;
13 |
14 | class CRigidbody : public IL2CPP::CClass
15 | {
16 | public:
17 | bool GetDetectCollisions()
18 | {
19 | return reinterpret_cast(RigidbodyFunctions.m_pGetDetectCollisions)(this);
20 | }
21 |
22 | void SetDetectCollisions(bool m_bDetect)
23 | {
24 | reinterpret_cast(RigidbodyFunctions.m_pSetDetectCollisions)(this, m_bDetect);
25 | }
26 |
27 | Vector3 GetVelocity()
28 | {
29 | Vector3 vRet;
30 | reinterpret_cast(RigidbodyFunctions.m_pGetVelocity)(this, vRet);
31 | return vRet;
32 | }
33 |
34 | void SetVelocity(Vector3 m_vVector)
35 | {
36 | reinterpret_cast(RigidbodyFunctions.m_pSetVelocity)(this, m_vVector);
37 | }
38 | };
39 |
40 | namespace RigidBody
41 | {
42 | void Initialize();
43 | }
44 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Unity/API/Transform.cpp:
--------------------------------------------------------------------------------
1 | #include "../../Includes.hpp"
2 |
3 | namespace Unity
4 | {
5 | STransformFunctions TransformFunctions;
6 |
7 | namespace Transform
8 | {
9 | void Initialize()
10 | {
11 | IL2CPP::SystemTypeCache::Initializer::Add(UNITY_TRANSFORM_CLASS);
12 |
13 | TransformFunctions.m_pGetParent = IL2CPP::ResolveCall(UNITY_TRANSFORM_GETPARENT);
14 | TransformFunctions.m_pGetRoot = IL2CPP::ResolveCall(UNITY_TRANSFORM_GETROOT);
15 | TransformFunctions.m_pGetChild = IL2CPP::ResolveCall(UNITY_TRANSFORM_GETCHILD);
16 | TransformFunctions.m_pGetChildCount = IL2CPP::ResolveCall(UNITY_TRANSFORM_GETCHILDCOUNT);
17 | TransformFunctions.m_pGetPosition = IL2CPP::ResolveCall(UNITY_TRANSFORM_GETPOSITION);
18 | TransformFunctions.m_pGetRotation = IL2CPP::ResolveCall(UNITY_TRANSFORM_GETROTATION);
19 | TransformFunctions.m_pGetLocalPosition = IL2CPP::ResolveCall(UNITY_TRANSFORM_GETLOCALPOSITION);
20 | TransformFunctions.m_pGetLocalScale = IL2CPP::ResolveCall(UNITY_TRANSFORM_GETLOCALSCALE);
21 | TransformFunctions.m_pSetPosition = IL2CPP::ResolveCall(UNITY_TRANSFORM_SETPOSITION);
22 | TransformFunctions.m_pSetRotation = IL2CPP::ResolveCall(UNITY_TRANSFORM_SETROTATION);
23 | TransformFunctions.m_pSetLocalPosition = IL2CPP::ResolveCall(UNITY_TRANSFORM_SETLOCALPOSITION);
24 | TransformFunctions.m_pSetLocalScale = IL2CPP::ResolveCall(UNITY_TRANSFORM_SETLOCALSCALE);
25 | TransformFunctions.m_pFindChild = IL2CPP::ResolveCall(UNITY_TRANSFORM_FINDCHILD);
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Unity/API/Transform.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace Unity
4 | {
5 | struct STransformFunctions
6 | {
7 | void* m_pGetParent = nullptr;
8 | void* m_pGetRoot = nullptr;
9 | void* m_pGetChild = nullptr;
10 | void* m_pGetChildCount = nullptr;
11 | void* m_pGetPosition = nullptr;
12 | void* m_pGetRotation = nullptr;
13 | void* m_pGetLocalPosition = nullptr;
14 | void* m_pGetLocalScale = nullptr;
15 | void* m_pSetPosition = nullptr;
16 | void* m_pSetRotation = nullptr;
17 | void* m_pSetLocalPosition = nullptr;
18 | void* m_pSetLocalScale = nullptr;
19 | void* m_pFindChild = nullptr;
20 | };
21 | extern STransformFunctions TransformFunctions;
22 |
23 | class CTransform : public IL2CPP::CClass
24 | {
25 | public:
26 | CTransform* GetParent()
27 | {
28 | return reinterpret_cast(TransformFunctions.m_pGetParent)(this);
29 | }
30 |
31 | CTransform* GetRoot()
32 | {
33 | return reinterpret_cast(TransformFunctions.m_pGetRoot)(this);
34 | }
35 |
36 | CTransform* GetChild(int m_iIndex)
37 | {
38 | return reinterpret_cast(TransformFunctions.m_pGetChild)(this, m_iIndex);
39 | }
40 |
41 | int GetChildCount()
42 | {
43 | return reinterpret_cast(TransformFunctions.m_pGetChildCount)(this);
44 | }
45 |
46 | CTransform* FindChild(const char* path, bool isActiveOnly)
47 | {
48 | return reinterpret_cast(TransformFunctions.m_pFindChild)(this, IL2CPP::String::New(path), isActiveOnly);
49 | }
50 |
51 | // e.g CGameObject->GetTransform()->FindChild("child1/child2/child3");
52 | CTransform* FindChild(const char* path)
53 | {
54 | if (path == NULL) {
55 | return nullptr;
56 | }
57 | return FindChild(path, false);
58 | }
59 |
60 | Vector3 GetPosition()
61 | {
62 | Vector3 vRet;
63 | reinterpret_cast(TransformFunctions.m_pGetPosition)(this, vRet);
64 | return vRet;
65 | }
66 |
67 | Quaternion GetRotation()
68 | {
69 | Quaternion m_qRet;
70 | reinterpret_cast(TransformFunctions.m_pGetRotation)(this, m_qRet);
71 | return m_qRet;
72 | }
73 |
74 | Vector3 GetLocalPosition()
75 | {
76 | Vector3 vRet;
77 | reinterpret_cast(TransformFunctions.m_pGetLocalPosition)(this, vRet);
78 | return vRet;
79 | }
80 |
81 | Vector3 GetLocalScale()
82 | {
83 | Vector3 vRet;
84 | reinterpret_cast(TransformFunctions.m_pGetLocalScale)(this, vRet);
85 | return vRet;
86 | }
87 |
88 | void SetPosition(Vector3 m_vVector)
89 | {
90 | reinterpret_cast(TransformFunctions.m_pSetPosition)(this, m_vVector);
91 | }
92 |
93 | void SetRotation(Quaternion m_qQuat)
94 | {
95 | reinterpret_cast(TransformFunctions.m_pSetRotation)(this, m_qQuat);
96 | }
97 |
98 | void SetLocalPosition(Vector3 m_vVector)
99 | {
100 | reinterpret_cast(TransformFunctions.m_pSetLocalPosition)(this, m_vVector);
101 | }
102 |
103 | void SetLocalScale(Vector3 m_vVector)
104 | {
105 | reinterpret_cast(TransformFunctions.m_pSetLocalScale)(this, m_vVector);
106 | }
107 | };
108 |
109 | namespace Transform
110 | {
111 | void Initialize();
112 | }
113 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Unity/API/_TEMPLATE_API.cpp:
--------------------------------------------------------------------------------
1 | #include "../../Includes.hpp"
2 | // C+P Ready Template
3 |
4 | namespace Unity
5 | {
6 | S_TEMPLATEFunctions _TEMPLATEFunctions;
7 |
8 | namespace _TEMPLATE
9 | {
10 | void Initialize()
11 | {
12 |
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Unity/API/_TEMPLATE_API.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | // C+P Ready Template
3 |
4 | namespace Unity
5 | {
6 | struct S_TEMPLATEFunctions
7 | {
8 |
9 | };
10 | extern S_TEMPLATEFunctions _TEMPLATEFunctions;
11 |
12 | class C_TEMPLATE : public IL2CPP::CClass
13 | {
14 | public:
15 |
16 | };
17 |
18 | namespace _TEMPLATE
19 | {
20 | void Initialize();
21 | }
22 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Unity/Defines.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | // Calling Convention
3 | #ifdef _WIN64
4 | #define UNITY_CALLING_CONVENTION __fastcall*
5 | #elif _WIN32
6 | #define UNITY_CALLING_CONVENTION __cdecl*
7 | #endif
8 |
9 |
10 |
11 | // Camera
12 | #define UNITY_CAMERA_CLASS "UnityEngine.Camera"
13 | #define UNITY_CAMERA_GETCURRENT UNITY_CAMERA_CLASS"::get_current"
14 | #define UNITY_CAMERA_GETMAIN UNITY_CAMERA_CLASS"::get_main"
15 | #define UNITY_CAMERA_GETDEPTH UNITY_CAMERA_CLASS"::get_depth"
16 | #define UNITY_CAMERA_SETDEPTH UNITY_CAMERA_CLASS"::set_depth"
17 | #define UNITY_CAMERA_GETFIELDOFVIEW UNITY_CAMERA_CLASS"::get_fieldOfView"
18 | #define UNITY_CAMERA_SETFIELDOFVIEW UNITY_CAMERA_CLASS"::set_fieldOfView"
19 | #define UNITY_CAMERA_WORLDTOSCREEN UNITY_CAMERA_CLASS"::WorldToScreenPoint_Injected"
20 |
21 | // Component
22 | #define UNITY_COMPONENT_CLASS "UnityEngine.Component"
23 | #define UNITY_COMPONENT_GETGAMEOBJECT UNITY_COMPONENT_CLASS"::get_gameObject"
24 | #define UNITY_COMPONENT_GETTRANSFORM UNITY_COMPONENT_CLASS"::get_transform"
25 |
26 | // GameObject
27 | #define UNITY_GAMEOBJECT_CLASS "UnityEngine.GameObject"
28 | #define UNITY_GAMEOBJECT_ADDCOMPONENT UNITY_GAMEOBJECT_CLASS"::Internal_AddComponentWithType"
29 | #define UNITY_GAMEOBJECT_CREATEPRIMITIVE UNITY_GAMEOBJECT_CLASS"::CreatePrimitive"
30 | #define UNITY_GAMEOBJECT_FIND UNITY_GAMEOBJECT_CLASS"::Find"
31 | #define UNITY_GAMEOBJECT_GETCOMPONENT UNITY_GAMEOBJECT_CLASS"::GetComponentByName"
32 | #define UNITY_GAMEOBJECT_GETCOMPONENTS UNITY_GAMEOBJECT_CLASS"::GetComponentsInternal"
33 | #define UNITY_GAMEOBJECT_GETACTIVE UNITY_GAMEOBJECT_CLASS"::get_active"
34 | #define UNITY_GAMEOBJECT_GETLAYER UNITY_GAMEOBJECT_CLASS"::get_layer"
35 | #define UNITY_GAMEOBJECT_GETTRANSFORM UNITY_GAMEOBJECT_CLASS"::get_transform"
36 | #define UNITY_GAMEOBJECT_SETACTIVE UNITY_GAMEOBJECT_CLASS"::set_active"
37 | #define UNITY_GAMEOBJECT_SETLAYER UNITY_GAMEOBJECT_CLASS"::set_layer"
38 | #define UNITY_GAMEOBJECT_FINDGAMEOBJECTWITHTAG UNITY_GAMEOBJECT_CLASS"::FindGameObjectsWithTag"
39 | #define UNITY_GAMEOBJECT_GETCOMPONENTINCHILDREN UNITY_GAMEOBJECT_CLASS"::GetComponentInChildren"
40 |
41 | // LayerMask
42 | #define UNITY_LAYERMASK_CLASS "UnityEngine.LayerMask"
43 | #define UNITY_LAYERMASK_LAYERTONAME UNITY_LAYERMASK_CLASS"::LayerToName"
44 | #define UNITY_LAYERMASK_NAMETOLAYER UNITY_LAYERMASK_CLASS"::NameToLayer"
45 |
46 | // MonoBehaviour
47 | #define UNITY_MONOBEHAVIOUR_CLASS "UnityEngine.MonoBehaviour"
48 |
49 | // Object
50 | #define UNITY_OBJECT_CLASS "UnityEngine.Object"
51 | #define UNITY_OBJECT_DESTROY UNITY_OBJECT_CLASS"::Destroy"
52 | #define UNITY_OBJECT_FINDOBJECTSOFTYPE UNITY_OBJECT_CLASS"::FindObjectsOfType"
53 | #define UNITY_OBJECT_GETNAME UNITY_OBJECT_CLASS"::GetName"
54 |
55 | // Rigidbody
56 | #define UNITY_RIGIDBODY_CLASS "UnityEngine.Rigidbody"
57 | #define UNITY_RIGIDBODY_GETDETECTCOLLISIONS UNITY_RIGIDBODY_CLASS"::get_detectCollisions"
58 | #define UNITY_RIGIDBODY_GETVELOCITY UNITY_RIGIDBODY_CLASS"::get_velocity_Injected"
59 | #define UNITY_RIGIDBODY_SETDETECTCOLLISIONS UNITY_RIGIDBODY_CLASS"::set_detectCollisions"
60 | #define UNITY_RIGIDBODY_SETVELOCITY UNITY_RIGIDBODY_CLASS"::set_velocity_Injected"
61 |
62 | // Transform
63 | #define UNITY_TRANSFORM_CLASS "UnityEngine.Transform"
64 | #define UNITY_TRANSFORM_GETPARENT UNITY_TRANSFORM_CLASS"::GetParent"
65 | #define UNITY_TRANSFORM_GETROOT UNITY_TRANSFORM_CLASS"::GetRoot"
66 | #define UNITY_TRANSFORM_GETCHILD UNITY_TRANSFORM_CLASS"::GetChild"
67 | #define UNITY_TRANSFORM_GETCHILDCOUNT UNITY_TRANSFORM_CLASS"::get_childCount"
68 | #define UNITY_TRANSFORM_GETPOSITION UNITY_TRANSFORM_CLASS"::get_position_Injected"
69 | #define UNITY_TRANSFORM_GETROTATION UNITY_TRANSFORM_CLASS"::get_rotation_Injected"
70 | #define UNITY_TRANSFORM_GETLOCALPOSITION UNITY_TRANSFORM_CLASS"::get_localPosition_Injected"
71 | #define UNITY_TRANSFORM_GETLOCALSCALE UNITY_TRANSFORM_CLASS"::get_localScale_Injected"
72 | #define UNITY_TRANSFORM_SETPOSITION UNITY_TRANSFORM_CLASS"::set_position_Injected"
73 | #define UNITY_TRANSFORM_SETROTATION UNITY_TRANSFORM_CLASS"::set_rotation_Injected"
74 | #define UNITY_TRANSFORM_SETLOCALPOSITION UNITY_TRANSFORM_CLASS"::set_localPosition_Injected"
75 | #define UNITY_TRANSFORM_SETLOCALSCALE UNITY_TRANSFORM_CLASS"::set_localScale_Injected"
76 | #define UNITY_TRANSFORM_FINDCHILD UNITY_TRANSFORM_CLASS"::FindRelativeTransformWithPath"
77 |
78 | namespace Unity
79 | {
80 | enum m_eTypeEnum
81 | {
82 | Type_Void = 1,
83 | Type_Boolean = 2,
84 | Type_Character = 3,
85 | Type_Integer = 8,
86 | Type_Float = 12,
87 | Type_String = 14,
88 | Type_Pointer = 15,
89 | Type_ValueType = 17,
90 | Type_Class = 18,
91 | Type_Variable = 19,
92 | Type_Array = 20,
93 | Type_Enum = 85,
94 | };
95 |
96 | enum m_eFieldAttribute
97 | {
98 | FieldAttribute_Compiler,
99 | FieldAttribute_Private,
100 | FieldAttribute_FamilyAndAssembly,
101 | FieldAttribute_Assembly,
102 | FieldAttribute_Family,
103 | FieldAttribute_FamilyOrAssembly,
104 | FieldAttribute_Public,
105 | FieldAttribute_AccessMask,
106 | FieldAttribute_Static = 16,
107 | FieldAttribute_InitOnly = 32,
108 | FieldAttribute_Literal = 64,
109 | FieldAttribute_NotSerialized = 128,
110 | FieldAttribute_HasRVA = 256,
111 | FieldAttribute_SpecialName = 512,
112 | FieldAttribute_RTSpecialName = 1024,
113 | FieldAttribute_HasMarshal = 4096,
114 | FieldAttribute_InvokeImpl = 8192,
115 | FieldAttribute_Default = 32768,
116 | FieldAttribute_Reserved = 38144,
117 | };
118 | }
119 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Unity/Includes.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "Defines.hpp"
3 | #include "Obfuscators.hpp"
4 |
5 | // Structures
6 | #include "Structures/Includes.hpp"
7 |
8 | // Class APIs - So they're accessible everywhere
9 | namespace Unity
10 | {
11 | class CCamera;
12 | class CComponent;
13 | class CGameObject;
14 | class CObject;
15 | class CRigidbody;
16 | class CTransform;
17 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Unity/Obfuscators.cpp:
--------------------------------------------------------------------------------
1 | #include "../Includes.hpp"
2 |
3 | namespace Unity
4 | {
5 | namespace Obfuscators
6 | {
7 | // Should do the basic work
8 | std::string ROT_String(const char* pString, int iValue)
9 | {
10 | std::string sRet;
11 | size_t sSize = strlen(pString);
12 | for (size_t i = 0; sSize > i; ++i)
13 | {
14 | bool bIsUppercase = pString[i] >= 'A' && 'Z' >= pString[i];
15 | bool bIsLowercase = !bIsUppercase && pString[i] >= 'a' && 'z' >= pString[i];
16 | if (!bIsUppercase && !bIsLowercase)
17 | {
18 | sRet += pString[i];
19 | continue;
20 | }
21 |
22 | int iNewValue = static_cast(pString[i]) + iValue;
23 | if (bIsUppercase)
24 | {
25 | int iMaxValue = static_cast('Z');
26 | while (iNewValue > iMaxValue) iNewValue = static_cast('A') + (iNewValue - iMaxValue);
27 | }
28 | else
29 | {
30 | int iMaxValue = static_cast('z');
31 | while (iNewValue > iMaxValue) iNewValue = static_cast('a') + (iNewValue - iMaxValue);
32 | }
33 |
34 | sRet += static_cast(iNewValue);
35 | }
36 |
37 | sRet += '\0';
38 | return sRet;
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Unity/Obfuscators.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace Unity
4 | {
5 | namespace Obfuscators
6 | {
7 | std::string ROT_String(const char* pString, int iValue);
8 | }
9 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Unity/Structures/Engine.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace Unity
4 | {
5 | struct Vector2
6 | {
7 | float x, y;
8 |
9 | Vector2() { x = y = 0.f; }
10 | Vector2(float f1, float f2) { x = f1; y = f2; }
11 | };
12 |
13 | struct Vector3
14 | {
15 | float x, y, z;
16 |
17 | Vector3() { x = y = z = 0.f; }
18 | Vector3(float f1, float f2, float f3) { x = f1; y = f2; z = f3; }
19 |
20 | void ToVectors(Vector3* m_pForward, Vector3* m_pRight, Vector3* m_pUp)
21 | {
22 | float m_fDeg2Rad = static_cast(M_PI) / 180.f;
23 |
24 | float m_fSinX = sinf(x * m_fDeg2Rad);
25 | float m_fCosX = cosf(x * m_fDeg2Rad);
26 |
27 | float m_fSinY = sinf(y * m_fDeg2Rad);
28 | float m_fCosY = cosf(y * m_fDeg2Rad);
29 |
30 | float m_fSinZ = sinf(z * m_fDeg2Rad);
31 | float m_fCosZ = cosf(z * m_fDeg2Rad);
32 |
33 | if (m_pForward)
34 | {
35 | m_pForward->x = m_fCosX * m_fCosY;
36 | m_pForward->y = -m_fSinX;
37 | m_pForward->z = m_fCosX * m_fSinY;
38 | }
39 |
40 | if (m_pRight)
41 | {
42 | m_pRight->x = -1.f * m_fSinZ * m_fSinX * m_fCosY + -1.f * m_fCosZ * -m_fSinY;
43 | m_pRight->y = -1.f * m_fSinZ * m_fCosX;
44 | m_pRight->z = -1.f * m_fSinZ * m_fSinX * m_fSinY + -1.f * m_fCosZ * m_fCosY;
45 | }
46 |
47 | if (m_pUp)
48 | {
49 | m_pUp->x = m_fCosZ * m_fSinX * m_fCosY + -m_fSinZ * -m_fSinY;
50 | m_pUp->y = m_fCosZ * m_fCosX;
51 | m_pUp->z = m_fCosZ * m_fSinX * m_fSinY + -m_fSinZ * m_fCosY;
52 | }
53 | }
54 | };
55 |
56 | struct Vector4
57 | {
58 | float x, y, z, w;
59 |
60 | Vector4() { x = y = z = w = 0.f; }
61 | Vector4(float f1, float f2, float f3, float f4) { x = f1; y = f2; z = f3; w = f4; }
62 | };
63 |
64 | struct Quaternion
65 | {
66 | float x, y, z, w;
67 |
68 | Quaternion() { x = y = z = w = 0.f; }
69 | Quaternion(float f1, float f2, float f3, float f4) { x = f1; y = f2; z = f3; w = f4; }
70 |
71 | Quaternion Euler(float m_fX, float m_fY, float m_fZ)
72 | {
73 | float m_fDeg2Rad = static_cast(M_PI) / 180.f;
74 |
75 | m_fX = m_fX * m_fDeg2Rad * 0.5f;
76 | m_fY = m_fY * m_fDeg2Rad * 0.5f;
77 | m_fZ = m_fZ * m_fDeg2Rad * 0.5f;
78 |
79 | float m_fSinX = sinf(m_fX);
80 | float m_fCosX = cosf(m_fX);
81 |
82 | float m_fSinY = sinf(m_fY);
83 | float m_fCosY = cosf(m_fY);
84 |
85 | float m_fSinZ = sinf(m_fZ);
86 | float m_fCosZ = cosf(m_fZ);
87 |
88 | x = m_fCosY * m_fSinX * m_fCosZ + m_fSinY * m_fCosX * m_fSinZ;
89 | y = m_fSinY * m_fCosX * m_fCosZ - m_fCosY * m_fSinX * m_fSinZ;
90 | z = m_fCosY * m_fCosX * m_fSinZ - m_fSinY * m_fSinX * m_fCosZ;
91 | w = m_fCosY * m_fCosX * m_fCosZ + m_fSinY * m_fSinX * m_fSinZ;
92 |
93 | return *this;
94 | }
95 |
96 | Quaternion Euler(Vector3 m_vRot)
97 | {
98 | return Euler(m_vRot.x, m_vRot.y, m_vRot.z);
99 | }
100 |
101 | Vector3 ToEuler()
102 | {
103 | Vector3 m_vEuler;
104 |
105 | float m_fDist = (x * x) + (y * y) + (z * z) + (w * w);
106 |
107 | float m_fTest = x * w - y * z;
108 | if (m_fTest > 0.4995f * m_fDist)
109 | {
110 | m_vEuler.x = static_cast(M_PI) * 0.5f;
111 | m_vEuler.y = 2.f * atan2f(y, x);
112 | m_vEuler.z = 0.f;
113 | }
114 | else if (m_fTest < -0.4995f * m_fDist)
115 | {
116 | m_vEuler.x = static_cast(M_PI) * -0.5f;
117 | m_vEuler.y = -2.f * atan2f(y, x);
118 | m_vEuler.z = 0.f;
119 | }
120 | else
121 | {
122 | m_vEuler.x = asinf(2.f * (w * x - y * z));
123 | m_vEuler.y = atan2f(2.f * w * y + 2.f * z * x, 1.f - 2.f * (x * x + y * y));
124 | m_vEuler.z = atan2f(2.f * w * z + 2.f * x * y, 1.f - 2.f * (z * z + x * x));
125 | }
126 |
127 | float m_fRad2Deg = 180.f / static_cast(M_PI);
128 | m_vEuler.x *= m_fRad2Deg;
129 | m_vEuler.y *= m_fRad2Deg;
130 | m_vEuler.z *= m_fRad2Deg;
131 |
132 | return m_vEuler;
133 | }
134 | };
135 |
136 | struct Bounds
137 | {
138 | Vector3 m_vCenter;
139 | Vector3 m_vExtents;
140 | };
141 |
142 | struct Plane
143 | {
144 | Vector3 m_vNormal;
145 | float fDistance;
146 | };
147 |
148 | struct Ray
149 | {
150 | Vector3 m_vOrigin;
151 | Vector3 m_vDirection;
152 | };
153 |
154 | struct Rect
155 | {
156 | float fX, fY;
157 | float fWidth, fHeight;
158 |
159 | Rect() { fX = fY = fWidth = fHeight = 0.f; }
160 | Rect(float f1, float f2, float f3, float f4) { fX = f1; fY = f2; fWidth = f3; fHeight = f4; }
161 | };
162 |
163 | struct Color
164 | {
165 | float r, g, b, a;
166 |
167 | Color() { r = g = b = a = 0.f; }
168 | Color(float fRed = 0.f, float fGreen = 0.f, float fBlue = 0.f, float fAlpha = 1.f) { r = fRed; g = fGreen; b = fBlue; a = fAlpha; }
169 | };
170 |
171 | struct Matrix4x4
172 | {
173 | float m[4][4] = { 0 };
174 |
175 | Matrix4x4() { }
176 |
177 | float* operator[](int i) { return m[i]; }
178 | };
179 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Unity/Structures/Includes.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "il2cpp.hpp"
3 | #include "il2cppArray.hpp"
4 | #include "il2cppDictionary.hpp"
5 |
6 | #include "Engine.hpp"
7 | #include "System_String.hpp"
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Unity/Structures/System_String.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace Unity
4 | {
5 | struct System_String : il2cppObject
6 | {
7 | int m_iLength;
8 | wchar_t m_wString[1024];
9 |
10 | void Clear()
11 | {
12 | if (!this) return;
13 |
14 | memset(m_wString, 0, static_cast(m_iLength) * 2);
15 | m_iLength = 0;
16 | }
17 |
18 | std::string ToString()
19 | {
20 | if (!this) return "";
21 |
22 | std::string sRet(static_cast(m_iLength) + 1, '\0');
23 | WideCharToMultiByte(CP_UTF8, 0, m_wString, m_iLength, &sRet[0], m_iLength, 0, 0);
24 | return sRet;
25 | }
26 | };
27 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Unity/Structures/il2cpp.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace Unity
4 | {
5 | struct il2cppImage
6 | {
7 | const char* m_pName;
8 | const char* m_pNameNoExt;
9 | };
10 |
11 | struct il2cppAssemblyName
12 | {
13 | const char* m_pName;
14 | const char* m_pCulture;
15 | const char* m_pHash;
16 | const char* m_pPublicKey;
17 | unsigned int m_uHash;
18 | int m_iHashLength;
19 | unsigned int m_uFlags;
20 | int m_iMajor;
21 | int m_iMinor;
22 | int m_iBuild;
23 | int m_bRevision;
24 | unsigned char m_uPublicKeyToken[8];
25 | };
26 |
27 | struct il2cppAssembly
28 | {
29 | il2cppImage* m_pImage;
30 | unsigned int m_uToken;
31 | int m_ReferencedAssemblyStart;
32 | int m_ReferencedAssemblyCount;
33 | il2cppAssemblyName m_aName;
34 | };
35 |
36 | struct il2cppClass
37 | {
38 | void* m_pImage;
39 | void* m_pGC;
40 | const char* m_pName;
41 | const char* m_pNamespace;
42 | void* m_pValue;
43 | void* m_pArgs;
44 | il2cppClass* m_pElementClass;
45 | il2cppClass* m_pCastClass;
46 | il2cppClass* m_pDeclareClass;
47 | il2cppClass* m_pParentClass;
48 | void* m_pGenericClass;
49 | void* m_pTypeDefinition;
50 | void* m_pInteropData;
51 | void* m_pFields;
52 | void* m_pEvents;
53 | void* m_pProperties;
54 | void** m_pMethods;
55 | il2cppClass** m_pNestedTypes;
56 | il2cppClass** m_ImplementedInterfaces;
57 | void* m_pInterfaceOffsets;
58 | void* m_pStaticFields;
59 | void* m_pRGCTX;
60 | };
61 |
62 | struct il2cppObject
63 | {
64 | il2cppClass* m_pClass = nullptr;
65 | void* m_pMonitor = nullptr;
66 | };
67 |
68 | struct il2cppType
69 | {
70 | union
71 | {
72 | void* m_pDummy;
73 | unsigned int m_uClassIndex;
74 | il2cppType* m_pType;
75 | void* m_pArray;
76 | unsigned int m_uGenericParameterIndex;
77 | void* m_pGenericClass;
78 | };
79 | unsigned int m_uAttributes : 16;
80 | unsigned int m_uType : 8;
81 | unsigned int m_uMods : 6;
82 | unsigned int m_uByref : 1;
83 | unsigned int m_uPinned : 1;
84 | };
85 |
86 | struct il2cppFieldInfo
87 | {
88 | const char* m_pName;
89 | il2cppType* m_pType;
90 | il2cppClass* m_pParentClass;
91 | int m_iOffset;
92 | int m_iAttributeIndex;
93 | unsigned int m_uToken;
94 | };
95 |
96 | struct il2cppParameterInfo
97 | {
98 | const char* m_pName;
99 | int m_iPosition;
100 | unsigned int m_uToken;
101 | il2cppType* m_pParameterType;
102 | };
103 |
104 | struct il2cppMethodInfo
105 | {
106 | void* m_pMethodPointer;
107 | void* m_pInvokerMethod;
108 | const char* m_pName;
109 | il2cppClass* m_pClass;
110 | il2cppType* m_pReturnType;
111 | il2cppParameterInfo* m_pParameters;
112 |
113 | union
114 | {
115 | void* m_pRGCTX;
116 | void* m_pMethodDefinition;
117 | };
118 |
119 | union
120 | {
121 | void* m_pGenericMethod;
122 | void* m_pGenericContainer;
123 | };
124 |
125 | unsigned int m_uToken;
126 | unsigned short m_uFlags;
127 | unsigned short m_uFlags2;
128 | unsigned short m_uSlot;
129 | unsigned char m_uArgsCount;
130 | unsigned char m_uGeneric : 1;
131 | unsigned char m_uInflated : 1;
132 | unsigned char m_uWrapperType : 1;
133 | unsigned char m_uMarshaledFromNative : 1;
134 | };
135 |
136 | struct il2cppPropertyInfo
137 | {
138 | il2cppClass* m_pParentClass;
139 | const char* m_pName;
140 | il2cppMethodInfo* m_pGet;
141 | il2cppMethodInfo* m_pSet;
142 | unsigned int m_uAttributes;
143 | unsigned int m_uToken;
144 | };
145 |
146 | struct il2cppArrayBounds
147 | {
148 | uintptr_t m_uLength;
149 | int m_iLowerBound;
150 | };
151 | }
152 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Unity/Structures/il2cppArray.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace Unity
4 | {
5 | template
6 | struct il2cppArray : il2cppObject
7 | {
8 | il2cppArrayBounds* m_pBounds = nullptr;
9 | uintptr_t m_uMaxLength = 0;
10 | T* m_pValues = nullptr;
11 |
12 | uintptr_t GetData()
13 | {
14 | return reinterpret_cast(&m_pValues);
15 | }
16 |
17 | T& operator[](unsigned int m_uIndex)
18 | {
19 | return *reinterpret_cast(GetData() + sizeof(T) * m_uIndex);
20 | }
21 |
22 | T& At(unsigned int m_uIndex)
23 | {
24 | return operator[](m_uIndex);
25 | }
26 |
27 | void Insert(T* m_pArray, uintptr_t m_uSize, uintptr_t m_uIndex = 0)
28 | {
29 | if ((m_uSize + m_uIndex) >= m_uMaxLength)
30 | {
31 | if (m_uIndex >= m_uMaxLength)
32 | return;
33 |
34 | m_uSize = m_uMaxLength - m_uIndex;
35 | }
36 |
37 | for (uintptr_t u = 0; m_uSize > u; ++u)
38 | operator[](u + m_uIndex) = m_pArray[u];
39 | }
40 |
41 | void Fill(T m_tValue)
42 | {
43 | for (uintptr_t u = 0; m_uMaxLength > u; ++u)
44 | operator[](u) = m_tValue;
45 | }
46 |
47 | void RemoveAt(unsigned int m_uIndex)
48 | {
49 | if (m_uIndex >= m_uMaxLength)
50 | return;
51 |
52 | if (m_uMaxLength > (m_uIndex + 1))
53 | {
54 | for (unsigned int u = m_uIndex; (static_cast(m_uMaxLength) - m_uIndex) > u; ++u)
55 | operator[](u) = operator[](u + 1);
56 | }
57 |
58 | --m_uMaxLength;
59 | }
60 |
61 | void RemoveRange(unsigned int m_uIndex, unsigned int m_uCount)
62 | {
63 | if (m_uCount == 0)
64 | m_uCount = 1;
65 |
66 | unsigned int m_uTotal = m_uIndex + m_uCount;
67 | if (m_uTotal >= m_uMaxLength)
68 | return;
69 |
70 | if (m_uMaxLength > (m_uTotal + 1))
71 | {
72 | for (unsigned int u = m_uIndex; (static_cast(m_uMaxLength) - m_uTotal) >= u; ++u)
73 | operator[](u) = operator[](u + m_uCount);
74 | }
75 |
76 | m_uMaxLength -= m_uCount;
77 | }
78 |
79 | void RemoveAll()
80 | {
81 | if (m_uMaxLength > 0)
82 | {
83 | memset(GetData(), 0, sizeof(T) * m_uMaxLength);
84 | m_uMaxLength = 0;
85 | }
86 | }
87 | };
88 |
89 | // Defined here because its basically same shit
90 | template
91 | struct il2cppList : il2cppObject
92 | {
93 | il2cppArray* m_pListArray;
94 |
95 | il2cppArray* ToArray() { return m_pListArray; }
96 | };
97 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Unity/Structures/il2cppDictionary.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace Unity
4 | {
5 | template
6 | struct il2cppDictionary : il2cppObject
7 | {
8 | struct Entry
9 | {
10 | int m_iHashCode;
11 | int m_iNext;
12 | TKey m_tKey;
13 | TValue m_tValue;
14 | };
15 | il2cppArray* m_pBuckets;
16 | il2cppArray* m_pEntries;
17 | int m_iCount;
18 | int m_iVersion;
19 | int m_iFreeList;
20 | int m_iFreeCount;
21 | void* m_pComparer;
22 | void* m_pKeys;
23 | void* m_pValues;
24 |
25 | Entry* GetEntry()
26 | {
27 | return (Entry*)m_pEntries->GetData();
28 | }
29 |
30 | TKey GetKeyByIndex(int iIndex)
31 | {
32 | TKey tKey = { 0 };
33 |
34 | Entry* pEntry = GetEntry();
35 | if (pEntry)
36 | tKey = pEntry[iIndex].m_tKey;
37 |
38 | return tKey;
39 | }
40 |
41 | TValue GetValueByIndex(int iIndex)
42 | {
43 | TValue tValue = { 0 };
44 |
45 | Entry* pEntry = GetEntry();
46 | if (pEntry)
47 | tValue = pEntry[iIndex].m_tValue;
48 |
49 | return tValue;
50 | }
51 |
52 | TValue GetValueByKey(TKey tKey)
53 | {
54 | TValue tValue = { 0 };
55 | for (int i = 0; i < m_iCount; i++) {
56 | if (GetEntry()[i].m_tKey == tKey)
57 | tValue = GetEntry()[i].m_tValue;
58 | }
59 | return tValue;
60 | }
61 | };
62 | }
63 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Utils/Helper.cpp:
--------------------------------------------------------------------------------
1 | #include "../Includes.hpp"
2 |
3 | namespace IL2CPP
4 | {
5 | namespace Helper
6 | {
7 | Unity::CComponent* GetMonoBehaviour()
8 | {
9 | Unity::il2cppArray* m_pObjects = Unity::Object::FindObjectsOfType(UNITY_GAMEOBJECT_CLASS);
10 | for (uintptr_t u = 0U; m_pObjects->m_uMaxLength > u; ++u)
11 | {
12 | Unity::CGameObject* m_pObject = m_pObjects->operator[](static_cast(u));
13 | if (!m_pObject) continue;
14 |
15 | Unity::CComponent* m_pMonoBehaviour = m_pObject->GetComponentByIndex(UNITY_MONOBEHAVIOUR_CLASS);
16 | if (m_pMonoBehaviour)
17 | return m_pMonoBehaviour;
18 | }
19 |
20 | return nullptr;
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Utils/Helper.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace IL2CPP
4 | {
5 | namespace Helper
6 | {
7 | Unity::CComponent* GetMonoBehaviour();
8 | }
9 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Utils/Joaat.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace IL2CPP
4 | {
5 | namespace Utils
6 | {
7 | inline unsigned int JOAAT(const char* str)
8 | {
9 | unsigned int m_uHash = 0;
10 |
11 | while (*str)
12 | {
13 | m_uHash += *(str++);
14 | m_uHash += (m_uHash << 10);
15 | m_uHash ^= (m_uHash >> 6);
16 | }
17 |
18 | m_uHash += (m_uHash << 3);
19 | m_uHash ^= (m_uHash >> 11);
20 | m_uHash += (m_uHash << 15);
21 |
22 | return m_uHash;
23 | }
24 |
25 | inline constexpr unsigned int JOAAT_CONSTEXPR(const char* str)
26 | {
27 | unsigned int m_uHash = 0;
28 |
29 | while (*str)
30 | {
31 | m_uHash += *(str++);
32 | m_uHash += (m_uHash << 10);
33 | m_uHash ^= (m_uHash >> 6);
34 | }
35 |
36 | m_uHash += (m_uHash << 3);
37 | m_uHash ^= (m_uHash >> 11);
38 | m_uHash += (m_uHash << 15);
39 |
40 | return m_uHash;
41 | }
42 | }
43 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/il2cppresolver/Utils/VFunc.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace VFunc
4 | {
5 | static void** Find_ASM(void** m_pVTable, int m_iCount, std::initializer_list m_lASM)
6 | {
7 | int m_iASMSize = static_cast(m_lASM.size());
8 | unsigned char* m_pBytes = const_cast(m_lASM.begin());
9 |
10 | for (int i = 0; m_iCount > i; ++i)
11 | {
12 | void* m_pVFunc = m_pVTable[i];
13 | unsigned char* m_pVFuncBytes = reinterpret_cast(m_pVFunc);
14 |
15 | bool m_bAllMatch = true;
16 | for (int b = 0; m_iASMSize > b; ++b)
17 | {
18 | if (m_pBytes[b] != m_pVFuncBytes[b])
19 | {
20 | m_bAllMatch = false;
21 | break;
22 | }
23 | }
24 |
25 | if (m_bAllMatch)
26 | return &m_pVTable[i];
27 | }
28 |
29 | return 0;
30 | }
31 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/imgui/imconfig.h:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------------
2 | // COMPILE-TIME OPTIONS FOR DEAR IMGUI
3 | // Runtime options (clipboard callbacks, enabling various features, etc.) can generally be set via the ImGuiIO structure.
4 | // You can use ImGui::SetAllocatorFunctions() before calling ImGui::CreateContext() to rewire memory allocation functions.
5 | //-----------------------------------------------------------------------------
6 | // A) You may edit imconfig.h (and not overwrite it when updating Dear ImGui, or maintain a patch/branch with your modifications to imconfig.h)
7 | // B) or add configuration directives in your own file and compile with #define IMGUI_USER_CONFIG "myfilename.h"
8 | // If you do so you need to make sure that configuration settings are defined consistently _everywhere_ Dear ImGui is used, which include
9 | // the imgui*.cpp files but also _any_ of your code that uses Dear ImGui. This is because some compile-time options have an affect on data structures.
10 | // Defining those options in imconfig.h will ensure every compilation unit gets to see the same data structure layouts.
11 | // Call IMGUI_CHECKVERSION() from your .cpp files to verify that the data structures your files are using are matching the ones imgui.cpp is using.
12 | //-----------------------------------------------------------------------------
13 |
14 | #pragma once
15 |
16 | //---- Define assertion handler. Defaults to calling assert().
17 | //#define IM_ASSERT(_EXPR) MyAssert(_EXPR)
18 | //#define IM_ASSERT(_EXPR) ((void)(_EXPR)) // Disable asserts
19 |
20 | //---- Define attributes of all API symbols declarations, e.g. for DLL under Windows
21 | // Using dear imgui via a shared library is not recommended, because of function call overhead and because we don't guarantee backward nor forward ABI compatibility.
22 | //#define IMGUI_API __declspec( dllexport )
23 | //#define IMGUI_API __declspec( dllimport )
24 |
25 | //---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to avoid using soon-to-be obsolete function/names.
26 | //#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
27 |
28 | //---- Don't implement demo windows functionality (ShowDemoWindow()/ShowStyleEditor()/ShowUserGuide() methods will be empty)
29 | // It is very strongly recommended to NOT disable the demo windows during development. Please read the comments in imgui_demo.cpp.
30 | //#define IMGUI_DISABLE_DEMO_WINDOWS
31 | //#define IMGUI_DISABLE_METRICS_WINDOW
32 |
33 | //---- Don't implement some functions to reduce linkage requirements.
34 | //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc.
35 | //#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] Don't implement default IME handler. Won't use and link with ImmGetContext/ImmSetCompositionWindow.
36 | //#define IMGUI_DISABLE_WIN32_FUNCTIONS // [Win32] Won't use and link with any Win32 function (clipboard, ime).
37 | //#define IMGUI_ENABLE_OSX_DEFAULT_CLIPBOARD_FUNCTIONS // [OSX] Implement default OSX clipboard handler (need to link with '-framework ApplicationServices', this is why this is not the default).
38 | //#define IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS // Don't implement ImFormatString/ImFormatStringV so you can implement them yourself (e.g. if you don't want to link with vsnprintf)
39 | //#define IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 so you can implement them yourself.
40 | //#define IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite so you can implement them yourself if you don't want to link with fopen/fclose/fread/fwrite. This will also disable the LogToTTY() function.
41 | //#define IMGUI_DISABLE_DEFAULT_ALLOCATORS // Don't implement default allocators calling malloc()/free() to avoid linking with them. You will need to call ImGui::SetAllocatorFunctions().
42 |
43 | //---- Include imgui_user.h at the end of imgui.h as a convenience
44 | //#define IMGUI_INCLUDE_IMGUI_USER_H
45 |
46 | //---- Pack colors to BGRA8 instead of RGBA8 (to avoid converting from one to another)
47 | //#define IMGUI_USE_BGRA_PACKED_COLOR
48 |
49 | //---- Avoid multiple STB libraries implementations, or redefine path/filenames to prioritize another version
50 | // By default the embedded implementations are declared static and not available outside of imgui cpp files.
51 | //#define IMGUI_STB_TRUETYPE_FILENAME "my_folder/stb_truetype.h"
52 | //#define IMGUI_STB_RECT_PACK_FILENAME "my_folder/stb_rect_pack.h"
53 | //#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION
54 | //#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION
55 |
56 | //---- Define constructor and implicit cast operators to convert back<>forth between your math types and ImVec2/ImVec4.
57 | // This will be inlined as part of ImVec2 and ImVec4 class declarations.
58 | /*
59 | #define IM_VEC2_CLASS_EXTRA \
60 | ImVec2(const MyVec2& f) { x = f.x; y = f.y; } \
61 | operator MyVec2() const { return MyVec2(x,y); }
62 |
63 | #define IM_VEC4_CLASS_EXTRA \
64 | ImVec4(const MyVec4& f) { x = f.x; y = f.y; z = f.z; w = f.w; } \
65 | operator MyVec4() const { return MyVec4(x,y,z,w); }
66 | */
67 |
68 | //---- Use 32-bit vertex indices (default is 16-bit) is one way to allow large meshes with more than 64K vertices.
69 | // Your renderer back-end will need to support it (most example renderer back-ends support both 16/32-bit indices).
70 | // Another way to allow large meshes while keeping 16-bit indices is to handle ImDrawCmd::VtxOffset in your renderer.
71 | // Read about ImGuiBackendFlags_RendererHasVtxOffset for details.
72 | //#define ImDrawIdx unsigned int
73 |
74 | //---- Override ImDrawCallback signature (will need to modify renderer back-ends accordingly)
75 | //struct ImDrawList;
76 | //struct ImDrawCmd;
77 | //typedef void (*MyImDrawCallback)(const ImDrawList* draw_list, const ImDrawCmd* cmd, void* my_renderer_user_data);
78 | //#define ImDrawCallback MyImDrawCallback
79 |
80 | //---- Debug Tools: Macro to break in Debugger
81 | // (use 'Metrics->Tools->Item Picker' to pick widgets with the mouse and break into them for easy debugging.)
82 | //#define IM_DEBUG_BREAK IM_ASSERT(0)
83 | //#define IM_DEBUG_BREAK __debugbreak()
84 |
85 | //---- Debug Tools: Have the Item Picker break in the ItemAdd() function instead of ItemHoverable(),
86 | // (which comes earlier in the code, will catch a few extra items, allow picking items other than Hovered one.)
87 | // This adds a small runtime cost which is why it is not enabled by default.
88 | //#define IMGUI_DEBUG_TOOL_ITEM_PICKER_EX
89 |
90 | //---- Debug Tools: Enable slower asserts
91 | //#define IMGUI_DEBUG_PARANOID
92 |
93 | //---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files.
94 | /*
95 | namespace ImGui
96 | {
97 | void MyFunction(const char* name, const MyMatrix44& v);
98 | }
99 | */
100 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/imgui/imgui_impl_dx11.h:
--------------------------------------------------------------------------------
1 | // dear imgui: Renderer for DirectX11
2 | // This needs to be used along with a Platform Binding (e.g. Win32)
3 |
4 | // Implemented features:
5 | // [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID!
6 | // [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices.
7 |
8 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
9 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
10 | // https://github.com/ocornut/imgui
11 |
12 | #pragma once
13 |
14 | struct ID3D11Device;
15 | struct ID3D11DeviceContext;
16 |
17 | IMGUI_IMPL_API bool ImGui_ImplDX11_Init(ID3D11Device* device, ID3D11DeviceContext* device_context);
18 | IMGUI_IMPL_API void ImGui_ImplDX11_Shutdown();
19 | IMGUI_IMPL_API void ImGui_ImplDX11_NewFrame();
20 | IMGUI_IMPL_API void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data);
21 |
22 | // Use if you want to reset your rendering device without losing ImGui state.
23 | IMGUI_IMPL_API void ImGui_ImplDX11_InvalidateDeviceObjects();
24 | IMGUI_IMPL_API bool ImGui_ImplDX11_CreateDeviceObjects();
25 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/imgui/imgui_impl_win32.h:
--------------------------------------------------------------------------------
1 | // dear imgui: Platform Binding for Windows (standard windows API for 32 and 64 bits applications)
2 | // This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..)
3 |
4 | // Implemented features:
5 | // [X] Platform: Clipboard support (for Win32 this is actually part of core imgui)
6 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
7 | // [X] Platform: Keyboard arrays indexed using VK_* Virtual Key Codes, e.g. ImGui::IsKeyPressed(VK_SPACE).
8 | // [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
9 |
10 | #pragma once
11 |
12 | IMGUI_IMPL_API bool ImGui_ImplWin32_Init(void* hwnd);
13 | IMGUI_IMPL_API void ImGui_ImplWin32_Shutdown();
14 | IMGUI_IMPL_API void ImGui_ImplWin32_NewFrame();
15 |
16 | // Handler for Win32 messages, update mouse/keyboard data.
17 | // You may or not need this for your implementation, but it can serve as reference for handling inputs.
18 | // Intentionally commented out to avoid dragging dependencies on types. You can COPY this line into your .cpp code instead.
19 | /*
20 | IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
21 | */
22 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/imgui/imgui_stdlib.cpp:
--------------------------------------------------------------------------------
1 | // dear imgui: wrappers for C++ standard library (STL) types (std::string, etc.)
2 | // This is also an example of how you may wrap your own similar types.
3 |
4 | // Changelog:
5 | // - v0.10: Initial version. Added InputText() / InputTextMultiline() calls with std::string
6 |
7 | // See more C++ related extension (fmt, RAII, syntaxis sugar) on Wiki:
8 | // https://github.com/ocornut/imgui/wiki/Useful-Extensions#cness
9 |
10 | #include "../imgui/imgui.h"
11 | #include "imgui_stdlib.h"
12 |
13 | struct InputTextCallback_UserData
14 | {
15 | std::string* Str;
16 | ImGuiInputTextCallback ChainCallback;
17 | void* ChainCallbackUserData;
18 | };
19 |
20 | static int InputTextCallback(ImGuiInputTextCallbackData* data)
21 | {
22 | InputTextCallback_UserData* user_data = (InputTextCallback_UserData*)data->UserData;
23 | if (data->EventFlag == ImGuiInputTextFlags_CallbackResize)
24 | {
25 | // Resize string callback
26 | // If for some reason we refuse the new length (BufTextLen) and/or capacity (BufSize) we need to set them back to what we want.
27 | std::string* str = user_data->Str;
28 | IM_ASSERT(data->Buf == str->c_str());
29 | str->resize(data->BufTextLen);
30 | data->Buf = (char*)str->c_str();
31 | }
32 | else if (user_data->ChainCallback)
33 | {
34 | // Forward to user callback, if any
35 | data->UserData = user_data->ChainCallbackUserData;
36 | return user_data->ChainCallback(data);
37 | }
38 | return 0;
39 | }
40 |
41 | bool ImGui::InputText(const char* label, std::string* str, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data)
42 | {
43 | IM_ASSERT((flags & ImGuiInputTextFlags_CallbackResize) == 0);
44 | flags |= ImGuiInputTextFlags_CallbackResize;
45 |
46 | InputTextCallback_UserData cb_user_data;
47 | cb_user_data.Str = str;
48 | cb_user_data.ChainCallback = callback;
49 | cb_user_data.ChainCallbackUserData = user_data;
50 | return InputText(label, (char*)str->c_str(), str->capacity() + 1, flags, InputTextCallback, &cb_user_data);
51 | }
52 |
53 | bool ImGui::InputTextMultiline(const char* label, std::string* str, const ImVec2& size, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data)
54 | {
55 | IM_ASSERT((flags & ImGuiInputTextFlags_CallbackResize) == 0);
56 | flags |= ImGuiInputTextFlags_CallbackResize;
57 |
58 | InputTextCallback_UserData cb_user_data;
59 | cb_user_data.Str = str;
60 | cb_user_data.ChainCallback = callback;
61 | cb_user_data.ChainCallbackUserData = user_data;
62 | return InputTextMultiline(label, (char*)str->c_str(), str->capacity() + 1, size, flags, InputTextCallback, &cb_user_data);
63 | }
64 |
65 | bool ImGui::InputTextWithHint(const char* label, const char* hint, std::string* str, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data)
66 | {
67 | IM_ASSERT((flags & ImGuiInputTextFlags_CallbackResize) == 0);
68 | flags |= ImGuiInputTextFlags_CallbackResize;
69 |
70 | InputTextCallback_UserData cb_user_data;
71 | cb_user_data.Str = str;
72 | cb_user_data.ChainCallback = callback;
73 | cb_user_data.ChainCallbackUserData = user_data;
74 | return InputTextWithHint(label, hint, (char*)str->c_str(), str->capacity() + 1, flags, InputTextCallback, &cb_user_data);
75 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/imgui/imgui_stdlib.h:
--------------------------------------------------------------------------------
1 | // dear imgui: wrappers for C++ standard library (STL) types (std::string, etc.)
2 | // This is also an example of how you may wrap your own similar types.
3 |
4 | // Changelog:
5 | // - v0.10: Initial version. Added InputText() / InputTextMultiline() calls with std::string
6 |
7 | // See more C++ related extension (fmt, RAII, syntaxis sugar) on Wiki:
8 | // https://github.com/ocornut/imgui/wiki/Useful-Extensions#cness
9 |
10 | #pragma once
11 |
12 | #include
13 |
14 | namespace ImGui
15 | {
16 | // ImGui::InputText() with std::string
17 | // Because text input needs dynamic resizing, we need to setup a callback to grow the capacity
18 | IMGUI_API bool InputText(const char* label, std::string* str, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = nullptr, void* user_data = nullptr);
19 | IMGUI_API bool InputTextMultiline(const char* label, std::string* str, const ImVec2& size = ImVec2(0, 0), ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = nullptr, void* user_data = nullptr);
20 | IMGUI_API bool InputTextWithHint(const char* label, const char* hint, std::string* str, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = nullptr, void* user_data = nullptr);
21 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/includes.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include "kiero/kiero.h"
7 | #include "kiero/minhook/include/MinHook.h"
8 | #include "imgui/imgui.h"
9 | #include "imgui/imgui_impl_win32.h"
10 | #include "imgui/imgui_impl_dx11.h"
11 |
12 | typedef HRESULT(__stdcall* Present) (IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Flags);
13 | typedef LRESULT(CALLBACK* WNDPROC)(HWND, UINT, WPARAM, LPARAM);
14 | typedef uintptr_t PTR;
15 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/kiero/kiero.h:
--------------------------------------------------------------------------------
1 | #ifndef __KIERO_H__
2 | #define __KIERO_H__
3 |
4 | #include
5 |
6 | #define KIERO_VERSION "1.2.6"
7 |
8 | #define KIERO_INCLUDE_D3D9 0 // 1 if you need D3D9 hook
9 | #define KIERO_INCLUDE_D3D10 0 // 1 if you need D3D10 hook
10 | #define KIERO_INCLUDE_D3D11 1 // 1 if you need D3D11 hook
11 | #define KIERO_INCLUDE_D3D12 0 // 1 if you need D3D12 hook
12 | #define KIERO_INCLUDE_OPENGL 0 // 1 if you need OpenGL hook
13 | #define KIERO_INCLUDE_VULKAN 0 // 1 if you need Vulkan hook
14 | #define KIERO_USE_MINHOOK 1 // 1 if you will use kiero::bind function
15 |
16 | #define KIERO_ARCH_X64 0
17 | #define KIERO_ARCH_X86 0
18 |
19 | #if defined(_M_X64)
20 | # undef KIERO_ARCH_X64
21 | # define KIERO_ARCH_X64 1
22 | #else
23 | # undef KIERO_ARCH_X86
24 | # define KIERO_ARCH_X86 1
25 | #endif
26 |
27 | #if KIERO_ARCH_X64
28 | typedef uint64_t uint150_t;
29 | #else
30 | typedef uint32_t uint150_t;
31 | #endif
32 |
33 | namespace kiero
34 | {
35 | struct Status
36 | {
37 | enum Enum
38 | {
39 | UnknownError = -1,
40 | NotSupportedError = -2,
41 | ModuleNotFoundError = -3,
42 |
43 | AlreadyInitializedError = -4,
44 | NotInitializedError = -5,
45 |
46 | Success = 0,
47 | };
48 | };
49 |
50 | struct RenderType
51 | {
52 | enum Enum
53 | {
54 | None,
55 |
56 | D3D9,
57 | D3D10,
58 | D3D11,
59 | D3D12,
60 |
61 | OpenGL,
62 | Vulkan,
63 |
64 | Auto
65 | };
66 | };
67 |
68 | Status::Enum init(RenderType::Enum renderType);
69 | void shutdown();
70 |
71 | Status::Enum bind(uint16_t index, void** original, void* function);
72 | void unbind(uint16_t index);
73 |
74 | RenderType::Enum getRenderType();
75 | uint150_t* getMethodsTable();
76 | }
77 |
78 | #endif // __KIERO_H__
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/kiero/minhook/dll_resources/MinHook.aps:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ImAxel0/SOTFmenu/08bdb3ecd1c8f93c15143924ffbf7118e362e374/src/SOTFmenu/SOTFmenu/kiero/minhook/dll_resources/MinHook.aps
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/kiero/minhook/dll_resources/MinHook.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | MH_Initialize
3 | MH_Uninitialize
4 |
5 | MH_CreateHook
6 | MH_CreateHookApi
7 | MH_CreateHookApiEx
8 | MH_RemoveHook
9 | MH_EnableHook
10 | MH_DisableHook
11 | MH_QueueEnableHook
12 | MH_QueueDisableHook
13 | MH_ApplyQueued
14 | MH_StatusToString
15 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/kiero/minhook/dll_resources/MinHook.rc:
--------------------------------------------------------------------------------
1 | 1 VERSIONINFO
2 | FILEVERSION 1,3,3,0
3 | PRODUCTVERSION 1,3,3,0
4 | FILEFLAGSMASK 0x17L
5 | #ifdef _DEBUG
6 | FILEFLAGS 0x1L
7 | #else
8 | FILEFLAGS 0x0L
9 | #endif
10 | FILEOS 0x4L
11 | FILETYPE 0x2L
12 | FILESUBTYPE 0x0L
13 | BEGIN
14 | BLOCK "StringFileInfo"
15 | BEGIN
16 | BLOCK "040904b0"
17 | BEGIN
18 | VALUE "CompanyName", "Tsuda Kageyu"
19 | VALUE "FileDescription", "MinHook - The Minimalistic API Hook Library for x64/x86"
20 | VALUE "FileVersion", "1.3.3.0"
21 | VALUE "InternalName", "MinHookD"
22 | VALUE "LegalCopyright", "Copyright (C) 2009-2017 Tsuda Kageyu. All rights reserved."
23 | VALUE "LegalTrademarks", "Tsuda Kageyu"
24 | VALUE "ProductName", "MinHook DLL"
25 | VALUE "ProductVersion", "1.3.3.0"
26 | END
27 | END
28 | BLOCK "VarFileInfo"
29 | BEGIN
30 | VALUE "Translation", 0x409, 1200
31 | END
32 | END
33 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/kiero/minhook/include/MinHook.h:
--------------------------------------------------------------------------------
1 | /*
2 | * MinHook - The Minimalistic API Hooking Library for x64/x86
3 | * Copyright (C) 2009-2017 Tsuda Kageyu.
4 | * All rights reserved.
5 | *
6 | * Redistribution and use in source and binary forms, with or without
7 | * modification, are permitted provided that the following conditions
8 | * are met:
9 | *
10 | * 1. Redistributions of source code must retain the above copyright
11 | * notice, this list of conditions and the following disclaimer.
12 | * 2. Redistributions in binary form must reproduce the above copyright
13 | * notice, this list of conditions and the following disclaimer in the
14 | * documentation and/or other materials provided with the distribution.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
19 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
20 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 | */
28 |
29 | #pragma once
30 |
31 | #if !(defined _M_IX86) && !(defined _M_X64) && !(defined __i386__) && !(defined __x86_64__)
32 | #error MinHook supports only x86 and x64 systems.
33 | #endif
34 |
35 | #include
36 |
37 | // MinHook Error Codes.
38 | typedef enum MH_STATUS
39 | {
40 | // Unknown error. Should not be returned.
41 | MH_UNKNOWN = -1,
42 |
43 | // Successful.
44 | MH_OK = 0,
45 |
46 | // MinHook is already initialized.
47 | MH_ERROR_ALREADY_INITIALIZED,
48 |
49 | // MinHook is not initialized yet, or already uninitialized.
50 | MH_ERROR_NOT_INITIALIZED,
51 |
52 | // The hook for the specified target function is already created.
53 | MH_ERROR_ALREADY_CREATED,
54 |
55 | // The hook for the specified target function is not created yet.
56 | MH_ERROR_NOT_CREATED,
57 |
58 | // The hook for the specified target function is already enabled.
59 | MH_ERROR_ENABLED,
60 |
61 | // The hook for the specified target function is not enabled yet, or already
62 | // disabled.
63 | MH_ERROR_DISABLED,
64 |
65 | // The specified pointer is invalid. It points the address of non-allocated
66 | // and/or non-executable region.
67 | MH_ERROR_NOT_EXECUTABLE,
68 |
69 | // The specified target function cannot be hooked.
70 | MH_ERROR_UNSUPPORTED_FUNCTION,
71 |
72 | // Failed to allocate memory.
73 | MH_ERROR_MEMORY_ALLOC,
74 |
75 | // Failed to change the memory protection.
76 | MH_ERROR_MEMORY_PROTECT,
77 |
78 | // The specified module is not loaded.
79 | MH_ERROR_MODULE_NOT_FOUND,
80 |
81 | // The specified function is not found.
82 | MH_ERROR_FUNCTION_NOT_FOUND
83 | }
84 | MH_STATUS;
85 |
86 | // Can be passed as a parameter to MH_EnableHook, MH_DisableHook,
87 | // MH_QueueEnableHook or MH_QueueDisableHook.
88 | #define MH_ALL_HOOKS NULL
89 |
90 | #ifdef __cplusplus
91 | extern "C" {
92 | #endif
93 |
94 | // Initialize the MinHook library. You must call this function EXACTLY ONCE
95 | // at the beginning of your program.
96 | MH_STATUS WINAPI MH_Initialize(VOID);
97 |
98 | // Uninitialize the MinHook library. You must call this function EXACTLY
99 | // ONCE at the end of your program.
100 | MH_STATUS WINAPI MH_Uninitialize(VOID);
101 |
102 | // Creates a Hook for the specified target function, in disabled state.
103 | // Parameters:
104 | // pTarget [in] A pointer to the target function, which will be
105 | // overridden by the detour function.
106 | // pDetour [in] A pointer to the detour function, which will override
107 | // the target function.
108 | // ppOriginal [out] A pointer to the trampoline function, which will be
109 | // used to call the original target function.
110 | // This parameter can be NULL.
111 | MH_STATUS WINAPI MH_CreateHook(LPVOID pTarget, LPVOID pDetour, LPVOID *ppOriginal);
112 |
113 | // Creates a Hook for the specified API function, in disabled state.
114 | // Parameters:
115 | // pszModule [in] A pointer to the loaded module name which contains the
116 | // target function.
117 | // pszTarget [in] A pointer to the target function name, which will be
118 | // overridden by the detour function.
119 | // pDetour [in] A pointer to the detour function, which will override
120 | // the target function.
121 | // ppOriginal [out] A pointer to the trampoline function, which will be
122 | // used to call the original target function.
123 | // This parameter can be NULL.
124 | MH_STATUS WINAPI MH_CreateHookApi(
125 | LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID *ppOriginal);
126 |
127 | // Creates a Hook for the specified API function, in disabled state.
128 | // Parameters:
129 | // pszModule [in] A pointer to the loaded module name which contains the
130 | // target function.
131 | // pszTarget [in] A pointer to the target function name, which will be
132 | // overridden by the detour function.
133 | // pDetour [in] A pointer to the detour function, which will override
134 | // the target function.
135 | // ppOriginal [out] A pointer to the trampoline function, which will be
136 | // used to call the original target function.
137 | // This parameter can be NULL.
138 | // ppTarget [out] A pointer to the target function, which will be used
139 | // with other functions.
140 | // This parameter can be NULL.
141 | MH_STATUS WINAPI MH_CreateHookApiEx(
142 | LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID *ppOriginal, LPVOID *ppTarget);
143 |
144 | // Removes an already created hook.
145 | // Parameters:
146 | // pTarget [in] A pointer to the target function.
147 | MH_STATUS WINAPI MH_RemoveHook(LPVOID pTarget);
148 |
149 | // Enables an already created hook.
150 | // Parameters:
151 | // pTarget [in] A pointer to the target function.
152 | // If this parameter is MH_ALL_HOOKS, all created hooks are
153 | // enabled in one go.
154 | MH_STATUS WINAPI MH_EnableHook(LPVOID pTarget);
155 |
156 | // Disables an already created hook.
157 | // Parameters:
158 | // pTarget [in] A pointer to the target function.
159 | // If this parameter is MH_ALL_HOOKS, all created hooks are
160 | // disabled in one go.
161 | MH_STATUS WINAPI MH_DisableHook(LPVOID pTarget);
162 |
163 | // Queues to enable an already created hook.
164 | // Parameters:
165 | // pTarget [in] A pointer to the target function.
166 | // If this parameter is MH_ALL_HOOKS, all created hooks are
167 | // queued to be enabled.
168 | MH_STATUS WINAPI MH_QueueEnableHook(LPVOID pTarget);
169 |
170 | // Queues to disable an already created hook.
171 | // Parameters:
172 | // pTarget [in] A pointer to the target function.
173 | // If this parameter is MH_ALL_HOOKS, all created hooks are
174 | // queued to be disabled.
175 | MH_STATUS WINAPI MH_QueueDisableHook(LPVOID pTarget);
176 |
177 | // Applies all queued changes in one go.
178 | MH_STATUS WINAPI MH_ApplyQueued(VOID);
179 |
180 | // Translates the MH_STATUS to its name as a string.
181 | const char * WINAPI MH_StatusToString(MH_STATUS status);
182 |
183 | #ifdef __cplusplus
184 | }
185 | #endif
186 |
187 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/kiero/minhook/src/buffer.c:
--------------------------------------------------------------------------------
1 | /*
2 | * MinHook - The Minimalistic API Hooking Library for x64/x86
3 | * Copyright (C) 2009-2017 Tsuda Kageyu.
4 | * All rights reserved.
5 | *
6 | * Redistribution and use in source and binary forms, with or without
7 | * modification, are permitted provided that the following conditions
8 | * are met:
9 | *
10 | * 1. Redistributions of source code must retain the above copyright
11 | * notice, this list of conditions and the following disclaimer.
12 | * 2. Redistributions in binary form must reproduce the above copyright
13 | * notice, this list of conditions and the following disclaimer in the
14 | * documentation and/or other materials provided with the distribution.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
19 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
20 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 | */
28 |
29 | #include
30 | #include "buffer.h"
31 |
32 | // Size of each memory block. (= page size of VirtualAlloc)
33 | #define MEMORY_BLOCK_SIZE 0x1000
34 |
35 | // Max range for seeking a memory block. (= 1024MB)
36 | #define MAX_MEMORY_RANGE 0x40000000
37 |
38 | // Memory protection flags to check the executable address.
39 | #define PAGE_EXECUTE_FLAGS \
40 | (PAGE_EXECUTE | PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY)
41 |
42 | // Memory slot.
43 | typedef struct _MEMORY_SLOT
44 | {
45 | union
46 | {
47 | struct _MEMORY_SLOT *pNext;
48 | UINT8 buffer[MEMORY_SLOT_SIZE];
49 | };
50 | } MEMORY_SLOT, *PMEMORY_SLOT;
51 |
52 | // Memory block info. Placed at the head of each block.
53 | typedef struct _MEMORY_BLOCK
54 | {
55 | struct _MEMORY_BLOCK *pNext;
56 | PMEMORY_SLOT pFree; // First element of the free slot list.
57 | UINT usedCount;
58 | } MEMORY_BLOCK, *PMEMORY_BLOCK;
59 |
60 | //-------------------------------------------------------------------------
61 | // Global Variables:
62 | //-------------------------------------------------------------------------
63 |
64 | // First element of the memory block list.
65 | PMEMORY_BLOCK g_pMemoryBlocks;
66 |
67 | //-------------------------------------------------------------------------
68 | VOID InitializeBuffer(VOID)
69 | {
70 | // Nothing to do for now.
71 | }
72 |
73 | //-------------------------------------------------------------------------
74 | VOID UninitializeBuffer(VOID)
75 | {
76 | PMEMORY_BLOCK pBlock = g_pMemoryBlocks;
77 | g_pMemoryBlocks = NULL;
78 |
79 | while (pBlock)
80 | {
81 | PMEMORY_BLOCK pNext = pBlock->pNext;
82 | VirtualFree(pBlock, 0, MEM_RELEASE);
83 | pBlock = pNext;
84 | }
85 | }
86 |
87 | //-------------------------------------------------------------------------
88 | #if defined(_M_X64) || defined(__x86_64__)
89 | static LPVOID FindPrevFreeRegion(LPVOID pAddress, LPVOID pMinAddr, DWORD dwAllocationGranularity)
90 | {
91 | ULONG_PTR tryAddr = (ULONG_PTR)pAddress;
92 |
93 | // Round down to the allocation granularity.
94 | tryAddr -= tryAddr % dwAllocationGranularity;
95 |
96 | // Start from the previous allocation granularity multiply.
97 | tryAddr -= dwAllocationGranularity;
98 |
99 | while (tryAddr >= (ULONG_PTR)pMinAddr)
100 | {
101 | MEMORY_BASIC_INFORMATION mbi;
102 | if (VirtualQuery((LPVOID)tryAddr, &mbi, sizeof(mbi)) == 0)
103 | break;
104 |
105 | if (mbi.State == MEM_FREE)
106 | return (LPVOID)tryAddr;
107 |
108 | if ((ULONG_PTR)mbi.AllocationBase < dwAllocationGranularity)
109 | break;
110 |
111 | tryAddr = (ULONG_PTR)mbi.AllocationBase - dwAllocationGranularity;
112 | }
113 |
114 | return NULL;
115 | }
116 | #endif
117 |
118 | //-------------------------------------------------------------------------
119 | #if defined(_M_X64) || defined(__x86_64__)
120 | static LPVOID FindNextFreeRegion(LPVOID pAddress, LPVOID pMaxAddr, DWORD dwAllocationGranularity)
121 | {
122 | ULONG_PTR tryAddr = (ULONG_PTR)pAddress;
123 |
124 | // Round down to the allocation granularity.
125 | tryAddr -= tryAddr % dwAllocationGranularity;
126 |
127 | // Start from the next allocation granularity multiply.
128 | tryAddr += dwAllocationGranularity;
129 |
130 | while (tryAddr <= (ULONG_PTR)pMaxAddr)
131 | {
132 | MEMORY_BASIC_INFORMATION mbi;
133 | if (VirtualQuery((LPVOID)tryAddr, &mbi, sizeof(mbi)) == 0)
134 | break;
135 |
136 | if (mbi.State == MEM_FREE)
137 | return (LPVOID)tryAddr;
138 |
139 | tryAddr = (ULONG_PTR)mbi.BaseAddress + mbi.RegionSize;
140 |
141 | // Round up to the next allocation granularity.
142 | tryAddr += dwAllocationGranularity - 1;
143 | tryAddr -= tryAddr % dwAllocationGranularity;
144 | }
145 |
146 | return NULL;
147 | }
148 | #endif
149 |
150 | //-------------------------------------------------------------------------
151 | static PMEMORY_BLOCK GetMemoryBlock(LPVOID pOrigin)
152 | {
153 | PMEMORY_BLOCK pBlock;
154 | #if defined(_M_X64) || defined(__x86_64__)
155 | ULONG_PTR minAddr;
156 | ULONG_PTR maxAddr;
157 |
158 | SYSTEM_INFO si;
159 | GetSystemInfo(&si);
160 | minAddr = (ULONG_PTR)si.lpMinimumApplicationAddress;
161 | maxAddr = (ULONG_PTR)si.lpMaximumApplicationAddress;
162 |
163 | // pOrigin ± 512MB
164 | if ((ULONG_PTR)pOrigin > MAX_MEMORY_RANGE && minAddr < (ULONG_PTR)pOrigin - MAX_MEMORY_RANGE)
165 | minAddr = (ULONG_PTR)pOrigin - MAX_MEMORY_RANGE;
166 |
167 | if (maxAddr > (ULONG_PTR)pOrigin + MAX_MEMORY_RANGE)
168 | maxAddr = (ULONG_PTR)pOrigin + MAX_MEMORY_RANGE;
169 |
170 | // Make room for MEMORY_BLOCK_SIZE bytes.
171 | maxAddr -= MEMORY_BLOCK_SIZE - 1;
172 | #endif
173 |
174 | // Look the registered blocks for a reachable one.
175 | for (pBlock = g_pMemoryBlocks; pBlock != NULL; pBlock = pBlock->pNext)
176 | {
177 | #if defined(_M_X64) || defined(__x86_64__)
178 | // Ignore the blocks too far.
179 | if ((ULONG_PTR)pBlock < minAddr || (ULONG_PTR)pBlock >= maxAddr)
180 | continue;
181 | #endif
182 | // The block has at least one unused slot.
183 | if (pBlock->pFree != NULL)
184 | return pBlock;
185 | }
186 |
187 | #if defined(_M_X64) || defined(__x86_64__)
188 | // Alloc a new block above if not found.
189 | {
190 | LPVOID pAlloc = pOrigin;
191 | while ((ULONG_PTR)pAlloc >= minAddr)
192 | {
193 | pAlloc = FindPrevFreeRegion(pAlloc, (LPVOID)minAddr, si.dwAllocationGranularity);
194 | if (pAlloc == NULL)
195 | break;
196 |
197 | pBlock = (PMEMORY_BLOCK)VirtualAlloc(
198 | pAlloc, MEMORY_BLOCK_SIZE, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
199 | if (pBlock != NULL)
200 | break;
201 | }
202 | }
203 |
204 | // Alloc a new block below if not found.
205 | if (pBlock == NULL)
206 | {
207 | LPVOID pAlloc = pOrigin;
208 | while ((ULONG_PTR)pAlloc <= maxAddr)
209 | {
210 | pAlloc = FindNextFreeRegion(pAlloc, (LPVOID)maxAddr, si.dwAllocationGranularity);
211 | if (pAlloc == NULL)
212 | break;
213 |
214 | pBlock = (PMEMORY_BLOCK)VirtualAlloc(
215 | pAlloc, MEMORY_BLOCK_SIZE, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
216 | if (pBlock != NULL)
217 | break;
218 | }
219 | }
220 | #else
221 | // In x86 mode, a memory block can be placed anywhere.
222 | pBlock = (PMEMORY_BLOCK)VirtualAlloc(
223 | NULL, MEMORY_BLOCK_SIZE, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
224 | #endif
225 |
226 | if (pBlock != NULL)
227 | {
228 | // Build a linked list of all the slots.
229 | PMEMORY_SLOT pSlot = (PMEMORY_SLOT)pBlock + 1;
230 | pBlock->pFree = NULL;
231 | pBlock->usedCount = 0;
232 | do
233 | {
234 | pSlot->pNext = pBlock->pFree;
235 | pBlock->pFree = pSlot;
236 | pSlot++;
237 | } while ((ULONG_PTR)pSlot - (ULONG_PTR)pBlock <= MEMORY_BLOCK_SIZE - MEMORY_SLOT_SIZE);
238 |
239 | pBlock->pNext = g_pMemoryBlocks;
240 | g_pMemoryBlocks = pBlock;
241 | }
242 |
243 | return pBlock;
244 | }
245 |
246 | //-------------------------------------------------------------------------
247 | LPVOID AllocateBuffer(LPVOID pOrigin)
248 | {
249 | PMEMORY_SLOT pSlot;
250 | PMEMORY_BLOCK pBlock = GetMemoryBlock(pOrigin);
251 | if (pBlock == NULL)
252 | return NULL;
253 |
254 | // Remove an unused slot from the list.
255 | pSlot = pBlock->pFree;
256 | pBlock->pFree = pSlot->pNext;
257 | pBlock->usedCount++;
258 | #ifdef _DEBUG
259 | // Fill the slot with INT3 for debugging.
260 | memset(pSlot, 0xCC, sizeof(MEMORY_SLOT));
261 | #endif
262 | return pSlot;
263 | }
264 |
265 | //-------------------------------------------------------------------------
266 | VOID FreeBuffer(LPVOID pBuffer)
267 | {
268 | PMEMORY_BLOCK pBlock = g_pMemoryBlocks;
269 | PMEMORY_BLOCK pPrev = NULL;
270 | ULONG_PTR pTargetBlock = ((ULONG_PTR)pBuffer / MEMORY_BLOCK_SIZE) * MEMORY_BLOCK_SIZE;
271 |
272 | while (pBlock != NULL)
273 | {
274 | if ((ULONG_PTR)pBlock == pTargetBlock)
275 | {
276 | PMEMORY_SLOT pSlot = (PMEMORY_SLOT)pBuffer;
277 | #ifdef _DEBUG
278 | // Clear the released slot for debugging.
279 | memset(pSlot, 0x00, sizeof(*pSlot));
280 | #endif
281 | // Restore the released slot to the list.
282 | pSlot->pNext = pBlock->pFree;
283 | pBlock->pFree = pSlot;
284 | pBlock->usedCount--;
285 |
286 | // Free if unused.
287 | if (pBlock->usedCount == 0)
288 | {
289 | if (pPrev)
290 | pPrev->pNext = pBlock->pNext;
291 | else
292 | g_pMemoryBlocks = pBlock->pNext;
293 |
294 | VirtualFree(pBlock, 0, MEM_RELEASE);
295 | }
296 |
297 | break;
298 | }
299 |
300 | pPrev = pBlock;
301 | pBlock = pBlock->pNext;
302 | }
303 | }
304 |
305 | //-------------------------------------------------------------------------
306 | BOOL IsExecutableAddress(LPVOID pAddress)
307 | {
308 | MEMORY_BASIC_INFORMATION mi;
309 | VirtualQuery(pAddress, &mi, sizeof(mi));
310 |
311 | return (mi.State == MEM_COMMIT && (mi.Protect & PAGE_EXECUTE_FLAGS));
312 | }
313 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/kiero/minhook/src/buffer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * MinHook - The Minimalistic API Hooking Library for x64/x86
3 | * Copyright (C) 2009-2017 Tsuda Kageyu.
4 | * All rights reserved.
5 | *
6 | * Redistribution and use in source and binary forms, with or without
7 | * modification, are permitted provided that the following conditions
8 | * are met:
9 | *
10 | * 1. Redistributions of source code must retain the above copyright
11 | * notice, this list of conditions and the following disclaimer.
12 | * 2. Redistributions in binary form must reproduce the above copyright
13 | * notice, this list of conditions and the following disclaimer in the
14 | * documentation and/or other materials provided with the distribution.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
19 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
20 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 | */
28 |
29 | #pragma once
30 |
31 | // Size of each memory slot.
32 | #if defined(_M_X64) || defined(__x86_64__)
33 | #define MEMORY_SLOT_SIZE 64
34 | #else
35 | #define MEMORY_SLOT_SIZE 32
36 | #endif
37 |
38 | VOID InitializeBuffer(VOID);
39 | VOID UninitializeBuffer(VOID);
40 | LPVOID AllocateBuffer(LPVOID pOrigin);
41 | VOID FreeBuffer(LPVOID pBuffer);
42 | BOOL IsExecutableAddress(LPVOID pAddress);
43 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/kiero/minhook/src/hde/hde32.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Hacker Disassembler Engine 32 C
3 | * Copyright (c) 2008-2009, Vyacheslav Patkov.
4 | * All rights reserved.
5 | *
6 | */
7 |
8 | #if defined(_M_IX86) || defined(__i386__)
9 |
10 | #include "hde32.h"
11 | #include "table32.h"
12 |
13 | unsigned int hde32_disasm(const void *code, hde32s *hs)
14 | {
15 | uint8_t x, c, *p = (uint8_t *)code, cflags, opcode, pref = 0;
16 | uint8_t *ht = hde32_table, m_mod, m_reg, m_rm, disp_size = 0;
17 |
18 | // Avoid using memset to reduce the footprint.
19 | #ifndef _MSC_VER
20 | memset((LPBYTE)hs, 0, sizeof(hde32s));
21 | #else
22 | __stosb((LPBYTE)hs, 0, sizeof(hde32s));
23 | #endif
24 |
25 | for (x = 16; x; x--)
26 | switch (c = *p++) {
27 | case 0xf3:
28 | hs->p_rep = c;
29 | pref |= PRE_F3;
30 | break;
31 | case 0xf2:
32 | hs->p_rep = c;
33 | pref |= PRE_F2;
34 | break;
35 | case 0xf0:
36 | hs->p_lock = c;
37 | pref |= PRE_LOCK;
38 | break;
39 | case 0x26: case 0x2e: case 0x36:
40 | case 0x3e: case 0x64: case 0x65:
41 | hs->p_seg = c;
42 | pref |= PRE_SEG;
43 | break;
44 | case 0x66:
45 | hs->p_66 = c;
46 | pref |= PRE_66;
47 | break;
48 | case 0x67:
49 | hs->p_67 = c;
50 | pref |= PRE_67;
51 | break;
52 | default:
53 | goto pref_done;
54 | }
55 | pref_done:
56 |
57 | hs->flags = (uint32_t)pref << 23;
58 |
59 | if (!pref)
60 | pref |= PRE_NONE;
61 |
62 | if ((hs->opcode = c) == 0x0f) {
63 | hs->opcode2 = c = *p++;
64 | ht += DELTA_OPCODES;
65 | } else if (c >= 0xa0 && c <= 0xa3) {
66 | if (pref & PRE_67)
67 | pref |= PRE_66;
68 | else
69 | pref &= ~PRE_66;
70 | }
71 |
72 | opcode = c;
73 | cflags = ht[ht[opcode / 4] + (opcode % 4)];
74 |
75 | if (cflags == C_ERROR) {
76 | hs->flags |= F_ERROR | F_ERROR_OPCODE;
77 | cflags = 0;
78 | if ((opcode & -3) == 0x24)
79 | cflags++;
80 | }
81 |
82 | x = 0;
83 | if (cflags & C_GROUP) {
84 | uint16_t t;
85 | t = *(uint16_t *)(ht + (cflags & 0x7f));
86 | cflags = (uint8_t)t;
87 | x = (uint8_t)(t >> 8);
88 | }
89 |
90 | if (hs->opcode2) {
91 | ht = hde32_table + DELTA_PREFIXES;
92 | if (ht[ht[opcode / 4] + (opcode % 4)] & pref)
93 | hs->flags |= F_ERROR | F_ERROR_OPCODE;
94 | }
95 |
96 | if (cflags & C_MODRM) {
97 | hs->flags |= F_MODRM;
98 | hs->modrm = c = *p++;
99 | hs->modrm_mod = m_mod = c >> 6;
100 | hs->modrm_rm = m_rm = c & 7;
101 | hs->modrm_reg = m_reg = (c & 0x3f) >> 3;
102 |
103 | if (x && ((x << m_reg) & 0x80))
104 | hs->flags |= F_ERROR | F_ERROR_OPCODE;
105 |
106 | if (!hs->opcode2 && opcode >= 0xd9 && opcode <= 0xdf) {
107 | uint8_t t = opcode - 0xd9;
108 | if (m_mod == 3) {
109 | ht = hde32_table + DELTA_FPU_MODRM + t*8;
110 | t = ht[m_reg] << m_rm;
111 | } else {
112 | ht = hde32_table + DELTA_FPU_REG;
113 | t = ht[t] << m_reg;
114 | }
115 | if (t & 0x80)
116 | hs->flags |= F_ERROR | F_ERROR_OPCODE;
117 | }
118 |
119 | if (pref & PRE_LOCK) {
120 | if (m_mod == 3) {
121 | hs->flags |= F_ERROR | F_ERROR_LOCK;
122 | } else {
123 | uint8_t *table_end, op = opcode;
124 | if (hs->opcode2) {
125 | ht = hde32_table + DELTA_OP2_LOCK_OK;
126 | table_end = ht + DELTA_OP_ONLY_MEM - DELTA_OP2_LOCK_OK;
127 | } else {
128 | ht = hde32_table + DELTA_OP_LOCK_OK;
129 | table_end = ht + DELTA_OP2_LOCK_OK - DELTA_OP_LOCK_OK;
130 | op &= -2;
131 | }
132 | for (; ht != table_end; ht++)
133 | if (*ht++ == op) {
134 | if (!((*ht << m_reg) & 0x80))
135 | goto no_lock_error;
136 | else
137 | break;
138 | }
139 | hs->flags |= F_ERROR | F_ERROR_LOCK;
140 | no_lock_error:
141 | ;
142 | }
143 | }
144 |
145 | if (hs->opcode2) {
146 | switch (opcode) {
147 | case 0x20: case 0x22:
148 | m_mod = 3;
149 | if (m_reg > 4 || m_reg == 1)
150 | goto error_operand;
151 | else
152 | goto no_error_operand;
153 | case 0x21: case 0x23:
154 | m_mod = 3;
155 | if (m_reg == 4 || m_reg == 5)
156 | goto error_operand;
157 | else
158 | goto no_error_operand;
159 | }
160 | } else {
161 | switch (opcode) {
162 | case 0x8c:
163 | if (m_reg > 5)
164 | goto error_operand;
165 | else
166 | goto no_error_operand;
167 | case 0x8e:
168 | if (m_reg == 1 || m_reg > 5)
169 | goto error_operand;
170 | else
171 | goto no_error_operand;
172 | }
173 | }
174 |
175 | if (m_mod == 3) {
176 | uint8_t *table_end;
177 | if (hs->opcode2) {
178 | ht = hde32_table + DELTA_OP2_ONLY_MEM;
179 | table_end = ht + sizeof(hde32_table) - DELTA_OP2_ONLY_MEM;
180 | } else {
181 | ht = hde32_table + DELTA_OP_ONLY_MEM;
182 | table_end = ht + DELTA_OP2_ONLY_MEM - DELTA_OP_ONLY_MEM;
183 | }
184 | for (; ht != table_end; ht += 2)
185 | if (*ht++ == opcode) {
186 | if (*ht++ & pref && !((*ht << m_reg) & 0x80))
187 | goto error_operand;
188 | else
189 | break;
190 | }
191 | goto no_error_operand;
192 | } else if (hs->opcode2) {
193 | switch (opcode) {
194 | case 0x50: case 0xd7: case 0xf7:
195 | if (pref & (PRE_NONE | PRE_66))
196 | goto error_operand;
197 | break;
198 | case 0xd6:
199 | if (pref & (PRE_F2 | PRE_F3))
200 | goto error_operand;
201 | break;
202 | case 0xc5:
203 | goto error_operand;
204 | }
205 | goto no_error_operand;
206 | } else
207 | goto no_error_operand;
208 |
209 | error_operand:
210 | hs->flags |= F_ERROR | F_ERROR_OPERAND;
211 | no_error_operand:
212 |
213 | c = *p++;
214 | if (m_reg <= 1) {
215 | if (opcode == 0xf6)
216 | cflags |= C_IMM8;
217 | else if (opcode == 0xf7)
218 | cflags |= C_IMM_P66;
219 | }
220 |
221 | switch (m_mod) {
222 | case 0:
223 | if (pref & PRE_67) {
224 | if (m_rm == 6)
225 | disp_size = 2;
226 | } else
227 | if (m_rm == 5)
228 | disp_size = 4;
229 | break;
230 | case 1:
231 | disp_size = 1;
232 | break;
233 | case 2:
234 | disp_size = 2;
235 | if (!(pref & PRE_67))
236 | disp_size <<= 1;
237 | }
238 |
239 | if (m_mod != 3 && m_rm == 4 && !(pref & PRE_67)) {
240 | hs->flags |= F_SIB;
241 | p++;
242 | hs->sib = c;
243 | hs->sib_scale = c >> 6;
244 | hs->sib_index = (c & 0x3f) >> 3;
245 | if ((hs->sib_base = c & 7) == 5 && !(m_mod & 1))
246 | disp_size = 4;
247 | }
248 |
249 | p--;
250 | switch (disp_size) {
251 | case 1:
252 | hs->flags |= F_DISP8;
253 | hs->disp.disp8 = *p;
254 | break;
255 | case 2:
256 | hs->flags |= F_DISP16;
257 | hs->disp.disp16 = *(uint16_t *)p;
258 | break;
259 | case 4:
260 | hs->flags |= F_DISP32;
261 | hs->disp.disp32 = *(uint32_t *)p;
262 | }
263 | p += disp_size;
264 | } else if (pref & PRE_LOCK)
265 | hs->flags |= F_ERROR | F_ERROR_LOCK;
266 |
267 | if (cflags & C_IMM_P66) {
268 | if (cflags & C_REL32) {
269 | if (pref & PRE_66) {
270 | hs->flags |= F_IMM16 | F_RELATIVE;
271 | hs->imm.imm16 = *(uint16_t *)p;
272 | p += 2;
273 | goto disasm_done;
274 | }
275 | goto rel32_ok;
276 | }
277 | if (pref & PRE_66) {
278 | hs->flags |= F_IMM16;
279 | hs->imm.imm16 = *(uint16_t *)p;
280 | p += 2;
281 | } else {
282 | hs->flags |= F_IMM32;
283 | hs->imm.imm32 = *(uint32_t *)p;
284 | p += 4;
285 | }
286 | }
287 |
288 | if (cflags & C_IMM16) {
289 | if (hs->flags & F_IMM32) {
290 | hs->flags |= F_IMM16;
291 | hs->disp.disp16 = *(uint16_t *)p;
292 | } else if (hs->flags & F_IMM16) {
293 | hs->flags |= F_2IMM16;
294 | hs->disp.disp16 = *(uint16_t *)p;
295 | } else {
296 | hs->flags |= F_IMM16;
297 | hs->imm.imm16 = *(uint16_t *)p;
298 | }
299 | p += 2;
300 | }
301 | if (cflags & C_IMM8) {
302 | hs->flags |= F_IMM8;
303 | hs->imm.imm8 = *p++;
304 | }
305 |
306 | if (cflags & C_REL32) {
307 | rel32_ok:
308 | hs->flags |= F_IMM32 | F_RELATIVE;
309 | hs->imm.imm32 = *(uint32_t *)p;
310 | p += 4;
311 | } else if (cflags & C_REL8) {
312 | hs->flags |= F_IMM8 | F_RELATIVE;
313 | hs->imm.imm8 = *p++;
314 | }
315 |
316 | disasm_done:
317 |
318 | if ((hs->len = (uint8_t)(p-(uint8_t *)code)) > 15) {
319 | hs->flags |= F_ERROR | F_ERROR_LENGTH;
320 | hs->len = 15;
321 | }
322 |
323 | return (unsigned int)hs->len;
324 | }
325 |
326 | #endif // defined(_M_IX86) || defined(__i386__)
327 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/kiero/minhook/src/hde/hde32.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Hacker Disassembler Engine 32
3 | * Copyright (c) 2006-2009, Vyacheslav Patkov.
4 | * All rights reserved.
5 | *
6 | * hde32.h: C/C++ header file
7 | *
8 | */
9 |
10 | #ifndef _HDE32_H_
11 | #define _HDE32_H_
12 |
13 | /* stdint.h - C99 standard header
14 | * http://en.wikipedia.org/wiki/stdint.h
15 | *
16 | * if your compiler doesn't contain "stdint.h" header (for
17 | * example, Microsoft Visual C++), you can download file:
18 | * http://www.azillionmonkeys.com/qed/pstdint.h
19 | * and change next line to:
20 | * #include "pstdint.h"
21 | */
22 | #include "pstdint.h"
23 |
24 | #define F_MODRM 0x00000001
25 | #define F_SIB 0x00000002
26 | #define F_IMM8 0x00000004
27 | #define F_IMM16 0x00000008
28 | #define F_IMM32 0x00000010
29 | #define F_DISP8 0x00000020
30 | #define F_DISP16 0x00000040
31 | #define F_DISP32 0x00000080
32 | #define F_RELATIVE 0x00000100
33 | #define F_2IMM16 0x00000800
34 | #define F_ERROR 0x00001000
35 | #define F_ERROR_OPCODE 0x00002000
36 | #define F_ERROR_LENGTH 0x00004000
37 | #define F_ERROR_LOCK 0x00008000
38 | #define F_ERROR_OPERAND 0x00010000
39 | #define F_PREFIX_REPNZ 0x01000000
40 | #define F_PREFIX_REPX 0x02000000
41 | #define F_PREFIX_REP 0x03000000
42 | #define F_PREFIX_66 0x04000000
43 | #define F_PREFIX_67 0x08000000
44 | #define F_PREFIX_LOCK 0x10000000
45 | #define F_PREFIX_SEG 0x20000000
46 | #define F_PREFIX_ANY 0x3f000000
47 |
48 | #define PREFIX_SEGMENT_CS 0x2e
49 | #define PREFIX_SEGMENT_SS 0x36
50 | #define PREFIX_SEGMENT_DS 0x3e
51 | #define PREFIX_SEGMENT_ES 0x26
52 | #define PREFIX_SEGMENT_FS 0x64
53 | #define PREFIX_SEGMENT_GS 0x65
54 | #define PREFIX_LOCK 0xf0
55 | #define PREFIX_REPNZ 0xf2
56 | #define PREFIX_REPX 0xf3
57 | #define PREFIX_OPERAND_SIZE 0x66
58 | #define PREFIX_ADDRESS_SIZE 0x67
59 |
60 | #pragma pack(push,1)
61 |
62 | typedef struct {
63 | uint8_t len;
64 | uint8_t p_rep;
65 | uint8_t p_lock;
66 | uint8_t p_seg;
67 | uint8_t p_66;
68 | uint8_t p_67;
69 | uint8_t opcode;
70 | uint8_t opcode2;
71 | uint8_t modrm;
72 | uint8_t modrm_mod;
73 | uint8_t modrm_reg;
74 | uint8_t modrm_rm;
75 | uint8_t sib;
76 | uint8_t sib_scale;
77 | uint8_t sib_index;
78 | uint8_t sib_base;
79 | union {
80 | uint8_t imm8;
81 | uint16_t imm16;
82 | uint32_t imm32;
83 | } imm;
84 | union {
85 | uint8_t disp8;
86 | uint16_t disp16;
87 | uint32_t disp32;
88 | } disp;
89 | uint32_t flags;
90 | } hde32s;
91 |
92 | #pragma pack(pop)
93 |
94 | #ifdef __cplusplus
95 | extern "C" {
96 | #endif
97 |
98 | /* __cdecl */
99 | unsigned int hde32_disasm(const void *code, hde32s *hs);
100 |
101 | #ifdef __cplusplus
102 | }
103 | #endif
104 |
105 | #endif /* _HDE32_H_ */
106 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/kiero/minhook/src/hde/hde64.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Hacker Disassembler Engine 64 C
3 | * Copyright (c) 2008-2009, Vyacheslav Patkov.
4 | * All rights reserved.
5 | *
6 | */
7 |
8 | #if defined(_M_X64) || defined(__x86_64__)
9 |
10 | #include "hde64.h"
11 | #include "table64.h"
12 |
13 | unsigned int hde64_disasm(const void *code, hde64s *hs)
14 | {
15 | uint8_t x, c, *p = (uint8_t *)code, cflags, opcode, pref = 0;
16 | uint8_t *ht = hde64_table, m_mod, m_reg, m_rm, disp_size = 0;
17 | uint8_t op64 = 0;
18 |
19 | // Avoid using memset to reduce the footprint.
20 | #ifndef _MSC_VER
21 | memset((LPBYTE)hs, 0, sizeof(hde64s));
22 | #else
23 | __stosb((LPBYTE)hs, 0, sizeof(hde64s));
24 | #endif
25 |
26 | for (x = 16; x; x--)
27 | switch (c = *p++) {
28 | case 0xf3:
29 | hs->p_rep = c;
30 | pref |= PRE_F3;
31 | break;
32 | case 0xf2:
33 | hs->p_rep = c;
34 | pref |= PRE_F2;
35 | break;
36 | case 0xf0:
37 | hs->p_lock = c;
38 | pref |= PRE_LOCK;
39 | break;
40 | case 0x26: case 0x2e: case 0x36:
41 | case 0x3e: case 0x64: case 0x65:
42 | hs->p_seg = c;
43 | pref |= PRE_SEG;
44 | break;
45 | case 0x66:
46 | hs->p_66 = c;
47 | pref |= PRE_66;
48 | break;
49 | case 0x67:
50 | hs->p_67 = c;
51 | pref |= PRE_67;
52 | break;
53 | default:
54 | goto pref_done;
55 | }
56 | pref_done:
57 |
58 | hs->flags = (uint32_t)pref << 23;
59 |
60 | if (!pref)
61 | pref |= PRE_NONE;
62 |
63 | if ((c & 0xf0) == 0x40) {
64 | hs->flags |= F_PREFIX_REX;
65 | if ((hs->rex_w = (c & 0xf) >> 3) && (*p & 0xf8) == 0xb8)
66 | op64++;
67 | hs->rex_r = (c & 7) >> 2;
68 | hs->rex_x = (c & 3) >> 1;
69 | hs->rex_b = c & 1;
70 | if (((c = *p++) & 0xf0) == 0x40) {
71 | opcode = c;
72 | goto error_opcode;
73 | }
74 | }
75 |
76 | if ((hs->opcode = c) == 0x0f) {
77 | hs->opcode2 = c = *p++;
78 | ht += DELTA_OPCODES;
79 | } else if (c >= 0xa0 && c <= 0xa3) {
80 | op64++;
81 | if (pref & PRE_67)
82 | pref |= PRE_66;
83 | else
84 | pref &= ~PRE_66;
85 | }
86 |
87 | opcode = c;
88 | cflags = ht[ht[opcode / 4] + (opcode % 4)];
89 |
90 | if (cflags == C_ERROR) {
91 | error_opcode:
92 | hs->flags |= F_ERROR | F_ERROR_OPCODE;
93 | cflags = 0;
94 | if ((opcode & -3) == 0x24)
95 | cflags++;
96 | }
97 |
98 | x = 0;
99 | if (cflags & C_GROUP) {
100 | uint16_t t;
101 | t = *(uint16_t *)(ht + (cflags & 0x7f));
102 | cflags = (uint8_t)t;
103 | x = (uint8_t)(t >> 8);
104 | }
105 |
106 | if (hs->opcode2) {
107 | ht = hde64_table + DELTA_PREFIXES;
108 | if (ht[ht[opcode / 4] + (opcode % 4)] & pref)
109 | hs->flags |= F_ERROR | F_ERROR_OPCODE;
110 | }
111 |
112 | if (cflags & C_MODRM) {
113 | hs->flags |= F_MODRM;
114 | hs->modrm = c = *p++;
115 | hs->modrm_mod = m_mod = c >> 6;
116 | hs->modrm_rm = m_rm = c & 7;
117 | hs->modrm_reg = m_reg = (c & 0x3f) >> 3;
118 |
119 | if (x && ((x << m_reg) & 0x80))
120 | hs->flags |= F_ERROR | F_ERROR_OPCODE;
121 |
122 | if (!hs->opcode2 && opcode >= 0xd9 && opcode <= 0xdf) {
123 | uint8_t t = opcode - 0xd9;
124 | if (m_mod == 3) {
125 | ht = hde64_table + DELTA_FPU_MODRM + t*8;
126 | t = ht[m_reg] << m_rm;
127 | } else {
128 | ht = hde64_table + DELTA_FPU_REG;
129 | t = ht[t] << m_reg;
130 | }
131 | if (t & 0x80)
132 | hs->flags |= F_ERROR | F_ERROR_OPCODE;
133 | }
134 |
135 | if (pref & PRE_LOCK) {
136 | if (m_mod == 3) {
137 | hs->flags |= F_ERROR | F_ERROR_LOCK;
138 | } else {
139 | uint8_t *table_end, op = opcode;
140 | if (hs->opcode2) {
141 | ht = hde64_table + DELTA_OP2_LOCK_OK;
142 | table_end = ht + DELTA_OP_ONLY_MEM - DELTA_OP2_LOCK_OK;
143 | } else {
144 | ht = hde64_table + DELTA_OP_LOCK_OK;
145 | table_end = ht + DELTA_OP2_LOCK_OK - DELTA_OP_LOCK_OK;
146 | op &= -2;
147 | }
148 | for (; ht != table_end; ht++)
149 | if (*ht++ == op) {
150 | if (!((*ht << m_reg) & 0x80))
151 | goto no_lock_error;
152 | else
153 | break;
154 | }
155 | hs->flags |= F_ERROR | F_ERROR_LOCK;
156 | no_lock_error:
157 | ;
158 | }
159 | }
160 |
161 | if (hs->opcode2) {
162 | switch (opcode) {
163 | case 0x20: case 0x22:
164 | m_mod = 3;
165 | if (m_reg > 4 || m_reg == 1)
166 | goto error_operand;
167 | else
168 | goto no_error_operand;
169 | case 0x21: case 0x23:
170 | m_mod = 3;
171 | if (m_reg == 4 || m_reg == 5)
172 | goto error_operand;
173 | else
174 | goto no_error_operand;
175 | }
176 | } else {
177 | switch (opcode) {
178 | case 0x8c:
179 | if (m_reg > 5)
180 | goto error_operand;
181 | else
182 | goto no_error_operand;
183 | case 0x8e:
184 | if (m_reg == 1 || m_reg > 5)
185 | goto error_operand;
186 | else
187 | goto no_error_operand;
188 | }
189 | }
190 |
191 | if (m_mod == 3) {
192 | uint8_t *table_end;
193 | if (hs->opcode2) {
194 | ht = hde64_table + DELTA_OP2_ONLY_MEM;
195 | table_end = ht + sizeof(hde64_table) - DELTA_OP2_ONLY_MEM;
196 | } else {
197 | ht = hde64_table + DELTA_OP_ONLY_MEM;
198 | table_end = ht + DELTA_OP2_ONLY_MEM - DELTA_OP_ONLY_MEM;
199 | }
200 | for (; ht != table_end; ht += 2)
201 | if (*ht++ == opcode) {
202 | if (*ht++ & pref && !((*ht << m_reg) & 0x80))
203 | goto error_operand;
204 | else
205 | break;
206 | }
207 | goto no_error_operand;
208 | } else if (hs->opcode2) {
209 | switch (opcode) {
210 | case 0x50: case 0xd7: case 0xf7:
211 | if (pref & (PRE_NONE | PRE_66))
212 | goto error_operand;
213 | break;
214 | case 0xd6:
215 | if (pref & (PRE_F2 | PRE_F3))
216 | goto error_operand;
217 | break;
218 | case 0xc5:
219 | goto error_operand;
220 | }
221 | goto no_error_operand;
222 | } else
223 | goto no_error_operand;
224 |
225 | error_operand:
226 | hs->flags |= F_ERROR | F_ERROR_OPERAND;
227 | no_error_operand:
228 |
229 | c = *p++;
230 | if (m_reg <= 1) {
231 | if (opcode == 0xf6)
232 | cflags |= C_IMM8;
233 | else if (opcode == 0xf7)
234 | cflags |= C_IMM_P66;
235 | }
236 |
237 | switch (m_mod) {
238 | case 0:
239 | if (pref & PRE_67) {
240 | if (m_rm == 6)
241 | disp_size = 2;
242 | } else
243 | if (m_rm == 5)
244 | disp_size = 4;
245 | break;
246 | case 1:
247 | disp_size = 1;
248 | break;
249 | case 2:
250 | disp_size = 2;
251 | if (!(pref & PRE_67))
252 | disp_size <<= 1;
253 | }
254 |
255 | if (m_mod != 3 && m_rm == 4) {
256 | hs->flags |= F_SIB;
257 | p++;
258 | hs->sib = c;
259 | hs->sib_scale = c >> 6;
260 | hs->sib_index = (c & 0x3f) >> 3;
261 | if ((hs->sib_base = c & 7) == 5 && !(m_mod & 1))
262 | disp_size = 4;
263 | }
264 |
265 | p--;
266 | switch (disp_size) {
267 | case 1:
268 | hs->flags |= F_DISP8;
269 | hs->disp.disp8 = *p;
270 | break;
271 | case 2:
272 | hs->flags |= F_DISP16;
273 | hs->disp.disp16 = *(uint16_t *)p;
274 | break;
275 | case 4:
276 | hs->flags |= F_DISP32;
277 | hs->disp.disp32 = *(uint32_t *)p;
278 | }
279 | p += disp_size;
280 | } else if (pref & PRE_LOCK)
281 | hs->flags |= F_ERROR | F_ERROR_LOCK;
282 |
283 | if (cflags & C_IMM_P66) {
284 | if (cflags & C_REL32) {
285 | if (pref & PRE_66) {
286 | hs->flags |= F_IMM16 | F_RELATIVE;
287 | hs->imm.imm16 = *(uint16_t *)p;
288 | p += 2;
289 | goto disasm_done;
290 | }
291 | goto rel32_ok;
292 | }
293 | if (op64) {
294 | hs->flags |= F_IMM64;
295 | hs->imm.imm64 = *(uint64_t *)p;
296 | p += 8;
297 | } else if (!(pref & PRE_66)) {
298 | hs->flags |= F_IMM32;
299 | hs->imm.imm32 = *(uint32_t *)p;
300 | p += 4;
301 | } else
302 | goto imm16_ok;
303 | }
304 |
305 |
306 | if (cflags & C_IMM16) {
307 | imm16_ok:
308 | hs->flags |= F_IMM16;
309 | hs->imm.imm16 = *(uint16_t *)p;
310 | p += 2;
311 | }
312 | if (cflags & C_IMM8) {
313 | hs->flags |= F_IMM8;
314 | hs->imm.imm8 = *p++;
315 | }
316 |
317 | if (cflags & C_REL32) {
318 | rel32_ok:
319 | hs->flags |= F_IMM32 | F_RELATIVE;
320 | hs->imm.imm32 = *(uint32_t *)p;
321 | p += 4;
322 | } else if (cflags & C_REL8) {
323 | hs->flags |= F_IMM8 | F_RELATIVE;
324 | hs->imm.imm8 = *p++;
325 | }
326 |
327 | disasm_done:
328 |
329 | if ((hs->len = (uint8_t)(p-(uint8_t *)code)) > 15) {
330 | hs->flags |= F_ERROR | F_ERROR_LENGTH;
331 | hs->len = 15;
332 | }
333 |
334 | return (unsigned int)hs->len;
335 | }
336 |
337 | #endif // defined(_M_X64) || defined(__x86_64__)
338 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/kiero/minhook/src/hde/hde64.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Hacker Disassembler Engine 64
3 | * Copyright (c) 2008-2009, Vyacheslav Patkov.
4 | * All rights reserved.
5 | *
6 | * hde64.h: C/C++ header file
7 | *
8 | */
9 |
10 | #ifndef _HDE64_H_
11 | #define _HDE64_H_
12 |
13 | /* stdint.h - C99 standard header
14 | * http://en.wikipedia.org/wiki/stdint.h
15 | *
16 | * if your compiler doesn't contain "stdint.h" header (for
17 | * example, Microsoft Visual C++), you can download file:
18 | * http://www.azillionmonkeys.com/qed/pstdint.h
19 | * and change next line to:
20 | * #include "pstdint.h"
21 | */
22 | #include "pstdint.h"
23 |
24 | #define F_MODRM 0x00000001
25 | #define F_SIB 0x00000002
26 | #define F_IMM8 0x00000004
27 | #define F_IMM16 0x00000008
28 | #define F_IMM32 0x00000010
29 | #define F_IMM64 0x00000020
30 | #define F_DISP8 0x00000040
31 | #define F_DISP16 0x00000080
32 | #define F_DISP32 0x00000100
33 | #define F_RELATIVE 0x00000200
34 | #define F_ERROR 0x00001000
35 | #define F_ERROR_OPCODE 0x00002000
36 | #define F_ERROR_LENGTH 0x00004000
37 | #define F_ERROR_LOCK 0x00008000
38 | #define F_ERROR_OPERAND 0x00010000
39 | #define F_PREFIX_REPNZ 0x01000000
40 | #define F_PREFIX_REPX 0x02000000
41 | #define F_PREFIX_REP 0x03000000
42 | #define F_PREFIX_66 0x04000000
43 | #define F_PREFIX_67 0x08000000
44 | #define F_PREFIX_LOCK 0x10000000
45 | #define F_PREFIX_SEG 0x20000000
46 | #define F_PREFIX_REX 0x40000000
47 | #define F_PREFIX_ANY 0x7f000000
48 |
49 | #define PREFIX_SEGMENT_CS 0x2e
50 | #define PREFIX_SEGMENT_SS 0x36
51 | #define PREFIX_SEGMENT_DS 0x3e
52 | #define PREFIX_SEGMENT_ES 0x26
53 | #define PREFIX_SEGMENT_FS 0x64
54 | #define PREFIX_SEGMENT_GS 0x65
55 | #define PREFIX_LOCK 0xf0
56 | #define PREFIX_REPNZ 0xf2
57 | #define PREFIX_REPX 0xf3
58 | #define PREFIX_OPERAND_SIZE 0x66
59 | #define PREFIX_ADDRESS_SIZE 0x67
60 |
61 | #pragma pack(push,1)
62 |
63 | typedef struct {
64 | uint8_t len;
65 | uint8_t p_rep;
66 | uint8_t p_lock;
67 | uint8_t p_seg;
68 | uint8_t p_66;
69 | uint8_t p_67;
70 | uint8_t rex;
71 | uint8_t rex_w;
72 | uint8_t rex_r;
73 | uint8_t rex_x;
74 | uint8_t rex_b;
75 | uint8_t opcode;
76 | uint8_t opcode2;
77 | uint8_t modrm;
78 | uint8_t modrm_mod;
79 | uint8_t modrm_reg;
80 | uint8_t modrm_rm;
81 | uint8_t sib;
82 | uint8_t sib_scale;
83 | uint8_t sib_index;
84 | uint8_t sib_base;
85 | union {
86 | uint8_t imm8;
87 | uint16_t imm16;
88 | uint32_t imm32;
89 | uint64_t imm64;
90 | } imm;
91 | union {
92 | uint8_t disp8;
93 | uint16_t disp16;
94 | uint32_t disp32;
95 | } disp;
96 | uint32_t flags;
97 | } hde64s;
98 |
99 | #pragma pack(pop)
100 |
101 | #ifdef __cplusplus
102 | extern "C" {
103 | #endif
104 |
105 | /* __cdecl */
106 | unsigned int hde64_disasm(const void *code, hde64s *hs);
107 |
108 | #ifdef __cplusplus
109 | }
110 | #endif
111 |
112 | #endif /* _HDE64_H_ */
113 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/kiero/minhook/src/hde/pstdint.h:
--------------------------------------------------------------------------------
1 | /*
2 | * MinHook - The Minimalistic API Hooking Library for x64/x86
3 | * Copyright (C) 2009-2017 Tsuda Kageyu. All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright
10 | * notice, this list of conditions and the following disclaimer.
11 | * 2. Redistributions in binary form must reproduce the above copyright
12 | * notice, this list of conditions and the following disclaimer in the
13 | * documentation and/or other materials provided with the distribution.
14 | *
15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 | */
26 |
27 | #pragma once
28 |
29 | #include
30 |
31 | // Integer types for HDE.
32 | typedef INT8 int8_t;
33 | typedef INT16 int16_t;
34 | typedef INT32 int32_t;
35 | typedef INT64 int64_t;
36 | typedef UINT8 uint8_t;
37 | typedef UINT16 uint16_t;
38 | typedef UINT32 uint32_t;
39 | typedef UINT64 uint64_t;
40 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/kiero/minhook/src/hde/table32.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Hacker Disassembler Engine 32 C
3 | * Copyright (c) 2008-2009, Vyacheslav Patkov.
4 | * All rights reserved.
5 | *
6 | */
7 |
8 | #define C_NONE 0x00
9 | #define C_MODRM 0x01
10 | #define C_IMM8 0x02
11 | #define C_IMM16 0x04
12 | #define C_IMM_P66 0x10
13 | #define C_REL8 0x20
14 | #define C_REL32 0x40
15 | #define C_GROUP 0x80
16 | #define C_ERROR 0xff
17 |
18 | #define PRE_ANY 0x00
19 | #define PRE_NONE 0x01
20 | #define PRE_F2 0x02
21 | #define PRE_F3 0x04
22 | #define PRE_66 0x08
23 | #define PRE_67 0x10
24 | #define PRE_LOCK 0x20
25 | #define PRE_SEG 0x40
26 | #define PRE_ALL 0xff
27 |
28 | #define DELTA_OPCODES 0x4a
29 | #define DELTA_FPU_REG 0xf1
30 | #define DELTA_FPU_MODRM 0xf8
31 | #define DELTA_PREFIXES 0x130
32 | #define DELTA_OP_LOCK_OK 0x1a1
33 | #define DELTA_OP2_LOCK_OK 0x1b9
34 | #define DELTA_OP_ONLY_MEM 0x1cb
35 | #define DELTA_OP2_ONLY_MEM 0x1da
36 |
37 | unsigned char hde32_table[] = {
38 | 0xa3,0xa8,0xa3,0xa8,0xa3,0xa8,0xa3,0xa8,0xa3,0xa8,0xa3,0xa8,0xa3,0xa8,0xa3,
39 | 0xa8,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xac,0xaa,0xb2,0xaa,0x9f,0x9f,
40 | 0x9f,0x9f,0xb5,0xa3,0xa3,0xa4,0xaa,0xaa,0xba,0xaa,0x96,0xaa,0xa8,0xaa,0xc3,
41 | 0xc3,0x96,0x96,0xb7,0xae,0xd6,0xbd,0xa3,0xc5,0xa3,0xa3,0x9f,0xc3,0x9c,0xaa,
42 | 0xaa,0xac,0xaa,0xbf,0x03,0x7f,0x11,0x7f,0x01,0x7f,0x01,0x3f,0x01,0x01,0x90,
43 | 0x82,0x7d,0x97,0x59,0x59,0x59,0x59,0x59,0x7f,0x59,0x59,0x60,0x7d,0x7f,0x7f,
44 | 0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x9a,0x88,0x7d,
45 | 0x59,0x50,0x50,0x50,0x50,0x59,0x59,0x59,0x59,0x61,0x94,0x61,0x9e,0x59,0x59,
46 | 0x85,0x59,0x92,0xa3,0x60,0x60,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,
47 | 0x59,0x59,0x9f,0x01,0x03,0x01,0x04,0x03,0xd5,0x03,0xcc,0x01,0xbc,0x03,0xf0,
48 | 0x10,0x10,0x10,0x10,0x50,0x50,0x50,0x50,0x14,0x20,0x20,0x20,0x20,0x01,0x01,
49 | 0x01,0x01,0xc4,0x02,0x10,0x00,0x00,0x00,0x00,0x01,0x01,0xc0,0xc2,0x10,0x11,
50 | 0x02,0x03,0x11,0x03,0x03,0x04,0x00,0x00,0x14,0x00,0x02,0x00,0x00,0xc6,0xc8,
51 | 0x02,0x02,0x02,0x02,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0xff,0xca,
52 | 0x01,0x01,0x01,0x00,0x06,0x00,0x04,0x00,0xc0,0xc2,0x01,0x01,0x03,0x01,0xff,
53 | 0xff,0x01,0x00,0x03,0xc4,0xc4,0xc6,0x03,0x01,0x01,0x01,0xff,0x03,0x03,0x03,
54 | 0xc8,0x40,0x00,0x0a,0x00,0x04,0x00,0x00,0x00,0x00,0x7f,0x00,0x33,0x01,0x00,
55 | 0x00,0x00,0x00,0x00,0x00,0xff,0xbf,0xff,0xff,0x00,0x00,0x00,0x00,0x07,0x00,
56 | 0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
57 | 0x00,0xff,0xff,0x00,0x00,0x00,0xbf,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
58 | 0x7f,0x00,0x00,0xff,0x4a,0x4a,0x4a,0x4a,0x4b,0x52,0x4a,0x4a,0x4a,0x4a,0x4f,
59 | 0x4c,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x55,0x45,0x40,0x4a,0x4a,0x4a,
60 | 0x45,0x59,0x4d,0x46,0x4a,0x5d,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,
61 | 0x4a,0x4a,0x4a,0x4a,0x4a,0x61,0x63,0x67,0x4e,0x4a,0x4a,0x6b,0x6d,0x4a,0x4a,
62 | 0x45,0x6d,0x4a,0x4a,0x44,0x45,0x4a,0x4a,0x00,0x00,0x00,0x02,0x0d,0x06,0x06,
63 | 0x06,0x06,0x0e,0x00,0x00,0x00,0x00,0x06,0x06,0x06,0x00,0x06,0x06,0x02,0x06,
64 | 0x00,0x0a,0x0a,0x07,0x07,0x06,0x02,0x05,0x05,0x02,0x02,0x00,0x00,0x04,0x04,
65 | 0x04,0x04,0x00,0x00,0x00,0x0e,0x05,0x06,0x06,0x06,0x01,0x06,0x00,0x00,0x08,
66 | 0x00,0x10,0x00,0x18,0x00,0x20,0x00,0x28,0x00,0x30,0x00,0x80,0x01,0x82,0x01,
67 | 0x86,0x00,0xf6,0xcf,0xfe,0x3f,0xab,0x00,0xb0,0x00,0xb1,0x00,0xb3,0x00,0xba,
68 | 0xf8,0xbb,0x00,0xc0,0x00,0xc1,0x00,0xc7,0xbf,0x62,0xff,0x00,0x8d,0xff,0x00,
69 | 0xc4,0xff,0x00,0xc5,0xff,0x00,0xff,0xff,0xeb,0x01,0xff,0x0e,0x12,0x08,0x00,
70 | 0x13,0x09,0x00,0x16,0x08,0x00,0x17,0x09,0x00,0x2b,0x09,0x00,0xae,0xff,0x07,
71 | 0xb2,0xff,0x00,0xb4,0xff,0x00,0xb5,0xff,0x00,0xc3,0x01,0x00,0xc7,0xff,0xbf,
72 | 0xe7,0x08,0x00,0xf0,0x02,0x00
73 | };
74 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/kiero/minhook/src/hde/table64.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Hacker Disassembler Engine 64 C
3 | * Copyright (c) 2008-2009, Vyacheslav Patkov.
4 | * All rights reserved.
5 | *
6 | */
7 |
8 | #define C_NONE 0x00
9 | #define C_MODRM 0x01
10 | #define C_IMM8 0x02
11 | #define C_IMM16 0x04
12 | #define C_IMM_P66 0x10
13 | #define C_REL8 0x20
14 | #define C_REL32 0x40
15 | #define C_GROUP 0x80
16 | #define C_ERROR 0xff
17 |
18 | #define PRE_ANY 0x00
19 | #define PRE_NONE 0x01
20 | #define PRE_F2 0x02
21 | #define PRE_F3 0x04
22 | #define PRE_66 0x08
23 | #define PRE_67 0x10
24 | #define PRE_LOCK 0x20
25 | #define PRE_SEG 0x40
26 | #define PRE_ALL 0xff
27 |
28 | #define DELTA_OPCODES 0x4a
29 | #define DELTA_FPU_REG 0xfd
30 | #define DELTA_FPU_MODRM 0x104
31 | #define DELTA_PREFIXES 0x13c
32 | #define DELTA_OP_LOCK_OK 0x1ae
33 | #define DELTA_OP2_LOCK_OK 0x1c6
34 | #define DELTA_OP_ONLY_MEM 0x1d8
35 | #define DELTA_OP2_ONLY_MEM 0x1e7
36 |
37 | unsigned char hde64_table[] = {
38 | 0xa5,0xaa,0xa5,0xb8,0xa5,0xaa,0xa5,0xaa,0xa5,0xb8,0xa5,0xb8,0xa5,0xb8,0xa5,
39 | 0xb8,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xac,0xc0,0xcc,0xc0,0xa1,0xa1,
40 | 0xa1,0xa1,0xb1,0xa5,0xa5,0xa6,0xc0,0xc0,0xd7,0xda,0xe0,0xc0,0xe4,0xc0,0xea,
41 | 0xea,0xe0,0xe0,0x98,0xc8,0xee,0xf1,0xa5,0xd3,0xa5,0xa5,0xa1,0xea,0x9e,0xc0,
42 | 0xc0,0xc2,0xc0,0xe6,0x03,0x7f,0x11,0x7f,0x01,0x7f,0x01,0x3f,0x01,0x01,0xab,
43 | 0x8b,0x90,0x64,0x5b,0x5b,0x5b,0x5b,0x5b,0x92,0x5b,0x5b,0x76,0x90,0x92,0x92,
44 | 0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x6a,0x73,0x90,
45 | 0x5b,0x52,0x52,0x52,0x52,0x5b,0x5b,0x5b,0x5b,0x77,0x7c,0x77,0x85,0x5b,0x5b,
46 | 0x70,0x5b,0x7a,0xaf,0x76,0x76,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,
47 | 0x5b,0x5b,0x86,0x01,0x03,0x01,0x04,0x03,0xd5,0x03,0xd5,0x03,0xcc,0x01,0xbc,
48 | 0x03,0xf0,0x03,0x03,0x04,0x00,0x50,0x50,0x50,0x50,0xff,0x20,0x20,0x20,0x20,
49 | 0x01,0x01,0x01,0x01,0xc4,0x02,0x10,0xff,0xff,0xff,0x01,0x00,0x03,0x11,0xff,
50 | 0x03,0xc4,0xc6,0xc8,0x02,0x10,0x00,0xff,0xcc,0x01,0x01,0x01,0x00,0x00,0x00,
51 | 0x00,0x01,0x01,0x03,0x01,0xff,0xff,0xc0,0xc2,0x10,0x11,0x02,0x03,0x01,0x01,
52 | 0x01,0xff,0xff,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0x10,
53 | 0x10,0x10,0x10,0x02,0x10,0x00,0x00,0xc6,0xc8,0x02,0x02,0x02,0x02,0x06,0x00,
54 | 0x04,0x00,0x02,0xff,0x00,0xc0,0xc2,0x01,0x01,0x03,0x03,0x03,0xca,0x40,0x00,
55 | 0x0a,0x00,0x04,0x00,0x00,0x00,0x00,0x7f,0x00,0x33,0x01,0x00,0x00,0x00,0x00,
56 | 0x00,0x00,0xff,0xbf,0xff,0xff,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0xff,0x00,
57 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,
58 | 0x00,0x00,0x00,0xbf,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x00,0x00,
59 | 0xff,0x40,0x40,0x40,0x40,0x41,0x49,0x40,0x40,0x40,0x40,0x4c,0x42,0x40,0x40,
60 | 0x40,0x40,0x40,0x40,0x40,0x40,0x4f,0x44,0x53,0x40,0x40,0x40,0x44,0x57,0x43,
61 | 0x5c,0x40,0x60,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
62 | 0x40,0x40,0x64,0x66,0x6e,0x6b,0x40,0x40,0x6a,0x46,0x40,0x40,0x44,0x46,0x40,
63 | 0x40,0x5b,0x44,0x40,0x40,0x00,0x00,0x00,0x00,0x06,0x06,0x06,0x06,0x01,0x06,
64 | 0x06,0x02,0x06,0x06,0x00,0x06,0x00,0x0a,0x0a,0x00,0x00,0x00,0x02,0x07,0x07,
65 | 0x06,0x02,0x0d,0x06,0x06,0x06,0x0e,0x05,0x05,0x02,0x02,0x00,0x00,0x04,0x04,
66 | 0x04,0x04,0x05,0x06,0x06,0x06,0x00,0x00,0x00,0x0e,0x00,0x00,0x08,0x00,0x10,
67 | 0x00,0x18,0x00,0x20,0x00,0x28,0x00,0x30,0x00,0x80,0x01,0x82,0x01,0x86,0x00,
68 | 0xf6,0xcf,0xfe,0x3f,0xab,0x00,0xb0,0x00,0xb1,0x00,0xb3,0x00,0xba,0xf8,0xbb,
69 | 0x00,0xc0,0x00,0xc1,0x00,0xc7,0xbf,0x62,0xff,0x00,0x8d,0xff,0x00,0xc4,0xff,
70 | 0x00,0xc5,0xff,0x00,0xff,0xff,0xeb,0x01,0xff,0x0e,0x12,0x08,0x00,0x13,0x09,
71 | 0x00,0x16,0x08,0x00,0x17,0x09,0x00,0x2b,0x09,0x00,0xae,0xff,0x07,0xb2,0xff,
72 | 0x00,0xb4,0xff,0x00,0xb5,0xff,0x00,0xc3,0x01,0x00,0xc7,0xff,0xbf,0xe7,0x08,
73 | 0x00,0xf0,0x02,0x00
74 | };
75 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/kiero/minhook/src/trampoline.h:
--------------------------------------------------------------------------------
1 | /*
2 | * MinHook - The Minimalistic API Hooking Library for x64/x86
3 | * Copyright (C) 2009-2017 Tsuda Kageyu.
4 | * All rights reserved.
5 | *
6 | * Redistribution and use in source and binary forms, with or without
7 | * modification, are permitted provided that the following conditions
8 | * are met:
9 | *
10 | * 1. Redistributions of source code must retain the above copyright
11 | * notice, this list of conditions and the following disclaimer.
12 | * 2. Redistributions in binary form must reproduce the above copyright
13 | * notice, this list of conditions and the following disclaimer in the
14 | * documentation and/or other materials provided with the distribution.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
19 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
20 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 | */
28 |
29 | #pragma once
30 |
31 | #pragma pack(push, 1)
32 |
33 | // Structs for writing x86/x64 instructions.
34 |
35 | // 8-bit relative jump.
36 | typedef struct _JMP_REL_SHORT
37 | {
38 | UINT8 opcode; // EB xx: JMP +2+xx
39 | UINT8 operand;
40 | } JMP_REL_SHORT, *PJMP_REL_SHORT;
41 |
42 | // 32-bit direct relative jump/call.
43 | typedef struct _JMP_REL
44 | {
45 | UINT8 opcode; // E9/E8 xxxxxxxx: JMP/CALL +5+xxxxxxxx
46 | UINT32 operand; // Relative destination address
47 | } JMP_REL, *PJMP_REL, CALL_REL;
48 |
49 | // 64-bit indirect absolute jump.
50 | typedef struct _JMP_ABS
51 | {
52 | UINT8 opcode0; // FF25 00000000: JMP [+6]
53 | UINT8 opcode1;
54 | UINT32 dummy;
55 | UINT64 address; // Absolute destination address
56 | } JMP_ABS, *PJMP_ABS;
57 |
58 | // 64-bit indirect absolute call.
59 | typedef struct _CALL_ABS
60 | {
61 | UINT8 opcode0; // FF15 00000002: CALL [+6]
62 | UINT8 opcode1;
63 | UINT32 dummy0;
64 | UINT8 dummy1; // EB 08: JMP +10
65 | UINT8 dummy2;
66 | UINT64 address; // Absolute destination address
67 | } CALL_ABS;
68 |
69 | // 32-bit direct relative conditional jumps.
70 | typedef struct _JCC_REL
71 | {
72 | UINT8 opcode0; // 0F8* xxxxxxxx: J** +6+xxxxxxxx
73 | UINT8 opcode1;
74 | UINT32 operand; // Relative destination address
75 | } JCC_REL;
76 |
77 | // 64bit indirect absolute conditional jumps that x64 lacks.
78 | typedef struct _JCC_ABS
79 | {
80 | UINT8 opcode; // 7* 0E: J** +16
81 | UINT8 dummy0;
82 | UINT8 dummy1; // FF25 00000000: JMP [+6]
83 | UINT8 dummy2;
84 | UINT32 dummy3;
85 | UINT64 address; // Absolute destination address
86 | } JCC_ABS;
87 |
88 | #pragma pack(pop)
89 |
90 | typedef struct _TRAMPOLINE
91 | {
92 | LPVOID pTarget; // [In] Address of the target function.
93 | LPVOID pDetour; // [In] Address of the detour function.
94 | LPVOID pTrampoline; // [In] Buffer address for the trampoline and relay function.
95 |
96 | #if defined(_M_X64) || defined(__x86_64__)
97 | LPVOID pRelay; // [Out] Address of the relay function.
98 | #endif
99 | BOOL patchAbove; // [Out] Should use the hot patch area?
100 | UINT nIP; // [Out] Number of the instruction boundaries.
101 | UINT8 oldIPs[8]; // [Out] Instruction boundaries of the target function.
102 | UINT8 newIPs[8]; // [Out] Instruction boundaries of the trampoline function.
103 | } TRAMPOLINE, *PTRAMPOLINE;
104 |
105 | BOOL CreateTrampolineFunction(PTRAMPOLINE ct);
106 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/main.cpp:
--------------------------------------------------------------------------------
1 | #include "includes.h"
2 | #include "config.h"
3 | #include "Globals.h"
4 | #include "hooks.h"
5 | #include "misc.h"
6 | #include "memory.h"
7 | #include "gui.h"
8 | #include
9 |
10 | DWORD WINAPI MainThread(LPVOID lpReserved)
11 | {
12 | ReadConfig(); // read config.ini file
13 | if (Globals::Gui::ShowTerminal)
14 | {
15 | AllocConsole();
16 | FILE* f;
17 | freopen_s(&f, "CONOUT$", "w", stdout);
18 | }
19 | HANDLE hCons = GetStdHandle(STD_OUTPUT_HANDLE);
20 | Globals::Gui::hConsole = hCons;
21 |
22 | printf("Trying to Kill conflicting Programs if present...\n");
23 |
24 | killProcessByName("MSIAfterburner.exe");
25 | printf("[*] Tried to Kill MSIAfterburner.exe!\n");
26 |
27 | killProcessByName("RTSS.exe");
28 | printf("[*] Tried to Kill RTSS.exe!\n");
29 | killProcessByName("RTSSHooksLoader.exe");
30 | killProcessByName("RTSSHooksLoader64.exe");
31 | printf("[*] Tried to Kill RTSSHooksLoader/64.exe!\n\n");
32 |
33 | SetConsoleTextAttribute(Globals::Gui::hConsole, 15);
34 | printf("Initializing IL2CPP...\n");
35 | Globals::il2cppStatus = IL2CPP::Initialize(true);
36 | if (!Globals::il2cppStatus) {
37 | SetConsoleTextAttribute(Globals::Gui::hConsole, 4);
38 | printf("[-] Can't Initialize IL2CPP!\n\n");
39 | exit(1);
40 | }
41 | SetConsoleTextAttribute(Globals::Gui::hConsole, 2);
42 | printf("[+] IL2CPP Initialized!\n\n");
43 |
44 | bool init_hook = false;
45 | do
46 | {
47 | if (kiero::init(kiero::RenderType::D3D11) == kiero::Status::Success)
48 | {
49 | SetConsoleTextAttribute(Globals::Gui::hConsole, 15);
50 | printf("Initializing MinHook...\n");
51 | MH_Initialize();
52 | SetConsoleTextAttribute(Globals::Gui::hConsole, 2);
53 | printf("[+] MinHook Initialized!\n\n");
54 |
55 | findInMemory();
56 | while (Globals::LocalPlayer == 0 || Globals::SunLight == 0) {
57 | Sleep(500);
58 | findInMemory();
59 | }
60 | CreateHacksHooks();
61 | IL2CPP::Callback::Initialize();
62 | InstantiateMethods();
63 | kiero::bind(8, (void**)&Globals::Gui::oPresent, hkPresent);
64 |
65 | SetConsoleTextAttribute(Globals::Gui::hConsole, 2);
66 | printf("\n[+] Menu Loaded!\n");
67 | InitCursorHook();
68 |
69 | SetConsoleTextAttribute(Globals::Gui::hConsole, 14);
70 | printf("ALL DONE!\n\n");
71 | SetConsoleTextAttribute(Globals::Gui::hConsole, 15);
72 |
73 | init_hook = true;
74 | }
75 | } while (!init_hook);
76 | return TRUE;
77 | }
78 |
79 | BOOL WINAPI DllMain(HMODULE hMod, DWORD dwReason, LPVOID lpReserved)
80 | {
81 | switch (dwReason)
82 | {
83 | case DLL_PROCESS_ATTACH:
84 | DisableThreadLibraryCalls(hMod);
85 | CreateThread(nullptr, 0, MainThread, hMod, 0, nullptr);
86 | break;
87 | case DLL_PROCESS_DETACH:
88 | kiero::shutdown();
89 | break;
90 | }
91 | return TRUE;
92 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/memory.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | inline DWORD WINAPI ShotgunRapidFire(LPVOID lpReserved);
4 |
5 | inline void findInMemory();
6 | inline void setMemory();
7 | inline bool findPistol();
8 | inline bool findRevolver();
9 | inline bool findShotgun();
10 | inline bool findFlashLight();
11 | inline bool findLighter();
12 | inline bool findRebreather();
13 | inline bool findRopeGun();
14 |
15 | inline void InstantiateMethods();
16 | inline void GetLobbyInfo();
17 |
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/misc.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include "ini.h"
5 | #include "Globals.h"
6 | #include
7 | #include
8 |
9 | using namespace mINI;
10 |
11 | void killProcessByName(const char* filename)
12 | {
13 | HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPALL, NULL);
14 | PROCESSENTRY32 pEntry;
15 | pEntry.dwSize = sizeof(pEntry);
16 | BOOL hRes = Process32First(hSnapShot, &pEntry);
17 | while (hRes)
18 | {
19 | if (strcmp(pEntry.szExeFile, filename) == 0)
20 | {
21 | HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, 0,
22 | (DWORD)pEntry.th32ProcessID);
23 | if (hProcess != NULL)
24 | {
25 | TerminateProcess(hProcess, 9);
26 | CloseHandle(hProcess);
27 | }
28 | }
29 | hRes = Process32Next(hSnapShot, &pEntry);
30 | }
31 | CloseHandle(hSnapShot);
32 | }
33 |
34 | void ReadConfig()
35 | {
36 | std::filesystem::path path;
37 | PWSTR path_tmp;
38 | auto get_folder_path_ret = SHGetKnownFolderPath(FOLDERID_Documents, 0, nullptr, &path_tmp);
39 | // Error check
40 | if (get_folder_path_ret != S_OK) {
41 | CoTaskMemFree(path_tmp);
42 | }
43 | path = path_tmp;
44 | CoTaskMemFree(path_tmp);
45 | path += "\\SOTF\\config\\config.ini";
46 | std::string path_str = path.string();
47 | const char* real_path = path_str.c_str();
48 |
49 | INIFile config(real_path);
50 | INIStructure ini;
51 |
52 | if (config.read(ini))
53 | {
54 | Globals::Gui::OpenKey = std::stoi(ini["Open/close key"].get("key value"), nullptr, 16);
55 | Globals::Gui::ShowTerminal = std::stoi(ini["Show Terminal"].get("value"));
56 | }
57 | else
58 | {
59 | ini["Open/close key"]["key value"] = "0x50";
60 | ini["Show Terminal"]["value"] = "1";
61 | config.write(ini, true);
62 | }
63 | }
--------------------------------------------------------------------------------
/src/SOTFmenu/SOTFmenu/misc.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | void killProcessByName(const char* filename);
4 | void ReadConfig();
5 |
--------------------------------------------------------------------------------