├── .gitattributes
├── .github
├── FUNDING.yml
└── workflows
│ └── windows.yml
├── .gitignore
├── Anubis.sln
├── Anubis
├── Anubis.vcxproj
├── Anubis.vcxproj.filters
├── Config.c
├── Config.h
├── GUI.c
├── GUI.h
├── Hacks
│ ├── Esp.c
│ ├── Esp.h
│ ├── Glow.c
│ ├── Glow.h
│ ├── Misc.c
│ ├── Misc.h
│ ├── Triggerbot.c
│ └── Triggerbot.h
├── Hooks.c
├── Hooks.h
├── Interfaces.c
├── Interfaces.h
├── Memory.c
├── Memory.h
├── Netvars.c
├── Netvars.h
├── SDK
│ ├── ClassId.h
│ ├── Client.c
│ ├── Client.h
│ ├── ClientClass.h
│ ├── ConVar.c
│ ├── ConVar.h
│ ├── Cvar.c
│ ├── Cvar.h
│ ├── DebugOverlay.c
│ ├── DebugOverlay.h
│ ├── Engine.c
│ ├── Engine.h
│ ├── EngineTrace.c
│ ├── EngineTrace.h
│ ├── Entity.c
│ ├── Entity.h
│ ├── EntityList.c
│ ├── EntityList.h
│ ├── GameUI.c
│ ├── GameUI.h
│ ├── GlobalVars.c
│ ├── GlobalVars.h
│ ├── GlowObjectDefinition.c
│ ├── GlowObjectDefinition.h
│ ├── ItemDefinitionIndex.c
│ ├── ItemDefinitionIndex.h
│ ├── Localize.c
│ ├── Localize.h
│ ├── Matrix3x4.h
│ ├── Panel.c
│ ├── Panel.h
│ ├── Recv.h
│ ├── Surface.c
│ ├── Surface.h
│ ├── UserCmd.h
│ ├── Utils.c
│ ├── Utils.h
│ ├── UtlVector.h
│ ├── Vector.c
│ ├── Vector.h
│ └── WeaponData.h
├── cJSON
│ ├── cJSON.c
│ └── cJSON.h
├── dllmain.c
├── imgui
│ ├── LICENSE.txt
│ ├── cimgui.cpp
│ ├── cimgui.h
│ ├── imconfig.h
│ ├── imgui.cpp
│ ├── imgui.h
│ ├── imgui_demo.cpp
│ ├── imgui_draw.cpp
│ ├── imgui_impl_dx9.c
│ ├── imgui_impl_dx9.h
│ ├── imgui_impl_win32.c
│ ├── imgui_impl_win32.h
│ ├── imgui_internal.h
│ ├── imgui_tables.cpp
│ ├── imgui_widgets.cpp
│ ├── imstb_rectpack.h
│ ├── imstb_textedit.h
│ └── imstb_truetype.h
└── vector.h
├── LICENSE
└── README.md
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.h linguist-language=C
2 | Anubis/imgui/* linguist-vendored
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | custom: https://paypal.me/DanielK19
2 |
--------------------------------------------------------------------------------
/.github/workflows/windows.yml:
--------------------------------------------------------------------------------
1 | name: Windows
2 |
3 | on: [push, pull_request]
4 |
5 | jobs:
6 | msvc:
7 |
8 | runs-on: windows-latest
9 |
10 | env:
11 | MSBUILD_PATH: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\
12 |
13 | steps:
14 | - uses: actions/checkout@v2
15 | - name: Build
16 | shell: cmd
17 | run: '"%MSBUILD_PATH%\MSBuild.exe" Anubis/Anubis.vcxproj /p:Platform=Win32 /p:Configuration=Release'
18 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Build results
17 | [Dd]ebug/
18 | [Dd]ebugPublic/
19 | [Rr]elease/
20 | [Rr]eleases/
21 | x64/
22 | x86/
23 | bld/
24 | [Bb]in/
25 | [Oo]bj/
26 | [Ll]og/
27 |
28 | # Visual Studio 2015/2017 cache/options directory
29 | .vs/
30 | # Uncomment if you have tasks that create the project's static files in wwwroot
31 | #wwwroot/
32 |
33 | # Visual Studio 2017 auto generated files
34 | Generated\ Files/
35 |
36 | # MSTest test Results
37 | [Tt]est[Rr]esult*/
38 | [Bb]uild[Ll]og.*
39 |
40 | # NUNIT
41 | *.VisualState.xml
42 | TestResult.xml
43 |
44 | # Build Results of an ATL Project
45 | [Dd]ebugPS/
46 | [Rr]eleasePS/
47 | dlldata.c
48 |
49 | # Benchmark Results
50 | BenchmarkDotNet.Artifacts/
51 |
52 | # .NET Core
53 | project.lock.json
54 | project.fragment.lock.json
55 | artifacts/
56 |
57 | # StyleCop
58 | StyleCopReport.xml
59 |
60 | # Files built by Visual Studio
61 | *_i.c
62 | *_p.c
63 | *_h.h
64 | *.ilk
65 | *.meta
66 | *.obj
67 | *.iobj
68 | *.pch
69 | *.pdb
70 | *.ipdb
71 | *.pgc
72 | *.pgd
73 | *.rsp
74 | *.sbr
75 | *.tlb
76 | *.tli
77 | *.tlh
78 | *.tmp
79 | *.tmp_proj
80 | *_wpftmp.csproj
81 | *.log
82 | *.vspscc
83 | *.vssscc
84 | .builds
85 | *.pidb
86 | *.svclog
87 | *.scc
88 |
89 | # Chutzpah Test files
90 | _Chutzpah*
91 |
92 | # Visual C++ cache files
93 | ipch/
94 | *.aps
95 | *.ncb
96 | *.opendb
97 | *.opensdf
98 | *.sdf
99 | *.cachefile
100 | *.VC.db
101 | *.VC.VC.opendb
102 |
103 | # Visual Studio profiler
104 | *.psess
105 | *.vsp
106 | *.vspx
107 | *.sap
108 |
109 | # Visual Studio Trace Files
110 | *.e2e
111 |
112 | # TFS 2012 Local Workspace
113 | $tf/
114 |
115 | # Guidance Automation Toolkit
116 | *.gpState
117 |
118 | # ReSharper is a .NET coding add-in
119 | _ReSharper*/
120 | *.[Rr]e[Ss]harper
121 | *.DotSettings.user
122 |
123 | # JustCode is a .NET coding add-in
124 | .JustCode
125 |
126 | # TeamCity is a build add-in
127 | _TeamCity*
128 |
129 | # DotCover is a Code Coverage Tool
130 | *.dotCover
131 |
132 | # AxoCover is a Code Coverage Tool
133 | .axoCover/*
134 | !.axoCover/settings.json
135 |
136 | # Visual Studio code coverage results
137 | *.coverage
138 | *.coveragexml
139 |
140 | # NCrunch
141 | _NCrunch_*
142 | .*crunch*.local.xml
143 | nCrunchTemp_*
144 |
145 | # MightyMoose
146 | *.mm.*
147 | AutoTest.Net/
148 |
149 | # Web workbench (sass)
150 | .sass-cache/
151 |
152 | # Installshield output folder
153 | [Ee]xpress/
154 |
155 | # DocProject is a documentation generator add-in
156 | DocProject/buildhelp/
157 | DocProject/Help/*.HxT
158 | DocProject/Help/*.HxC
159 | DocProject/Help/*.hhc
160 | DocProject/Help/*.hhk
161 | DocProject/Help/*.hhp
162 | DocProject/Help/Html2
163 | DocProject/Help/html
164 |
165 | # Click-Once directory
166 | publish/
167 |
168 | # Publish Web Output
169 | *.[Pp]ublish.xml
170 | *.azurePubxml
171 | # Note: Comment the next line if you want to checkin your web deploy settings,
172 | # but database connection strings (with potential passwords) will be unencrypted
173 | *.pubxml
174 | *.publishproj
175 |
176 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
177 | # checkin your Azure Web App publish settings, but sensitive information contained
178 | # in these scripts will be unencrypted
179 | PublishScripts/
180 |
181 | # NuGet Packages
182 | *.nupkg
183 | # The packages folder can be ignored because of Package Restore
184 | **/[Pp]ackages/*
185 | # except build/, which is used as an MSBuild target.
186 | !**/[Pp]ackages/build/
187 | # Uncomment if necessary however generally it will be regenerated when needed
188 | #!**/[Pp]ackages/repositories.config
189 | # NuGet v3's project.json files produces more ignorable files
190 | *.nuget.props
191 | *.nuget.targets
192 |
193 | # Microsoft Azure Build Output
194 | csx/
195 | *.build.csdef
196 |
197 | # Microsoft Azure Emulator
198 | ecf/
199 | rcf/
200 |
201 | # Windows Store app package directories and files
202 | AppPackages/
203 | BundleArtifacts/
204 | Package.StoreAssociation.xml
205 | _pkginfo.txt
206 | *.appx
207 |
208 | # Visual Studio cache files
209 | # files ending in .cache can be ignored
210 | *.[Cc]ache
211 | # but keep track of directories ending in .cache
212 | !*.[Cc]ache/
213 |
214 | # Others
215 | ClientBin/
216 | ~$*
217 | *~
218 | *.dbmdl
219 | *.dbproj.schemaview
220 | *.jfm
221 | *.pfx
222 | *.publishsettings
223 | orleans.codegen.cs
224 |
225 | # Including strong name files can present a security risk
226 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
227 | #*.snk
228 |
229 | # Since there are multiple workflows, uncomment next line to ignore bower_components
230 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
231 | #bower_components/
232 |
233 | # RIA/Silverlight projects
234 | Generated_Code/
235 |
236 | # Backup & report files from converting an old project file
237 | # to a newer Visual Studio version. Backup files are not needed,
238 | # because we have git ;-)
239 | _UpgradeReport_Files/
240 | Backup*/
241 | UpgradeLog*.XML
242 | UpgradeLog*.htm
243 | ServiceFabricBackup/
244 | *.rptproj.bak
245 |
246 | # SQL Server files
247 | *.mdf
248 | *.ldf
249 | *.ndf
250 |
251 | # Business Intelligence projects
252 | *.rdl.data
253 | *.bim.layout
254 | *.bim_*.settings
255 | *.rptproj.rsuser
256 |
257 | # Microsoft Fakes
258 | FakesAssemblies/
259 |
260 | # GhostDoc plugin setting file
261 | *.GhostDoc.xml
262 |
263 | # Node.js Tools for Visual Studio
264 | .ntvs_analysis.dat
265 | node_modules/
266 |
267 | # Visual Studio 6 build log
268 | *.plg
269 |
270 | # Visual Studio 6 workspace options file
271 | *.opt
272 |
273 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
274 | *.vbw
275 |
276 | # Visual Studio LightSwitch build output
277 | **/*.HTMLClient/GeneratedArtifacts
278 | **/*.DesktopClient/GeneratedArtifacts
279 | **/*.DesktopClient/ModelManifest.xml
280 | **/*.Server/GeneratedArtifacts
281 | **/*.Server/ModelManifest.xml
282 | _Pvt_Extensions
283 |
284 | # Paket dependency manager
285 | .paket/paket.exe
286 | paket-files/
287 |
288 | # FAKE - F# Make
289 | .fake/
290 |
291 | # JetBrains Rider
292 | .idea/
293 | *.sln.iml
294 |
295 | # CodeRush personal settings
296 | .cr/personal
297 |
298 | # Python Tools for Visual Studio (PTVS)
299 | __pycache__/
300 | *.pyc
301 |
302 | # Cake - Uncomment if you are using it
303 | # tools/**
304 | # !tools/packages.config
305 |
306 | # Tabs Studio
307 | *.tss
308 |
309 | # Telerik's JustMock configuration file
310 | *.jmconfig
311 |
312 | # BizTalk build output
313 | *.btp.cs
314 | *.btm.cs
315 | *.odx.cs
316 | *.xsd.cs
317 |
318 | # OpenCover UI analysis results
319 | OpenCover/
320 |
321 | # Azure Stream Analytics local run output
322 | ASALocalRun/
323 |
324 | # MSBuild Binary and Structured Log
325 | *.binlog
326 |
327 | # NVidia Nsight GPU debugger configuration file
328 | *.nvuser
329 |
330 | # MFractors (Xamarin productivity tool) working folder
331 | .mfractor/
332 |
333 | # Local History for Visual Studio
334 | .localhistory/
--------------------------------------------------------------------------------
/Anubis.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.28803.202
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Anubis", "Anubis\Anubis.vcxproj", "{6A49A05D-B889-4F5A-9923-9DD7C68A9951}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x86 = Debug|x86
11 | Release|x86 = Release|x86
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {6A49A05D-B889-4F5A-9923-9DD7C68A9951}.Debug|x86.ActiveCfg = Debug|Win32
15 | {6A49A05D-B889-4F5A-9923-9DD7C68A9951}.Debug|x86.Build.0 = Debug|Win32
16 | {6A49A05D-B889-4F5A-9923-9DD7C68A9951}.Release|x86.ActiveCfg = Release|Win32
17 | {6A49A05D-B889-4F5A-9923-9DD7C68A9951}.Release|x86.Build.0 = Release|Win32
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {2B627E6B-3245-4E6C-A96A-A9CAD507AF71}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/Anubis/Anubis.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 | {6A49A05D-B889-4F5A-9923-9DD7C68A9951}
24 | Win32Proj
25 | Anubis
26 | 10.0
27 |
28 |
29 |
30 | DynamicLibrary
31 | true
32 | v142
33 | Unicode
34 | false
35 |
36 |
37 | DynamicLibrary
38 | false
39 | v142
40 | true
41 | Unicode
42 | false
43 |
44 |
45 | DynamicLibrary
46 | true
47 | v142
48 | Unicode
49 |
50 |
51 | DynamicLibrary
52 | false
53 | v142
54 | true
55 | Unicode
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 | true
77 |
78 |
79 | true
80 |
81 |
82 | false
83 | false
84 |
85 |
86 | false
87 |
88 |
89 |
90 | NotUsing
91 | Level3
92 | Disabled
93 | true
94 | CIMGUI_NO_EXPORT;CJSON_HIDE_SYMBOLS;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;ANUBIS_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
95 | true
96 | pch.h
97 | Default
98 |
99 |
100 | Windows
101 | true
102 | false
103 | shlwapi.lib;%(AdditionalDependencies)
104 |
105 |
106 |
107 |
108 | Use
109 | Level3
110 | Disabled
111 | true
112 | _DEBUG;ANUBIS_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
113 | true
114 | pch.h
115 |
116 |
117 | Windows
118 | true
119 | false
120 |
121 |
122 |
123 |
124 | NotUsing
125 | Level3
126 | Full
127 | true
128 | true
129 | CIMGUI_NO_EXPORT;CJSON_HIDE_SYMBOLS;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;ANUBIS_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
130 | true
131 | pch.h
132 | Default
133 | AnySuitable
134 | Speed
135 | true
136 | true
137 | true
138 | Fast
139 | false
140 | false
141 | false
142 | false
143 | false
144 | false
145 | true
146 | AdvancedVectorExtensions
147 |
148 |
149 | Windows
150 | true
151 | true
152 | false
153 | false
154 | false
155 | shlwapi.lib;%(AdditionalDependencies)
156 |
157 |
158 |
159 |
160 | Use
161 | Level3
162 | MaxSpeed
163 | true
164 | true
165 | true
166 | NDEBUG;ANUBIS_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
167 | true
168 | pch.h
169 |
170 |
171 | Windows
172 | true
173 | true
174 | true
175 | false
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
--------------------------------------------------------------------------------
/Anubis/Anubis.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd
11 |
12 |
13 | {4af2c0a8-6194-4424-beb3-6641e5edcead}
14 |
15 |
16 | {0ddfdfd4-7f9b-4e31-84db-367cc4518a39}
17 |
18 |
19 | {5ce6b9d5-851d-4618-a847-cd0b1de850dd}
20 |
21 |
22 | {2606249a-b90d-4a5a-bb2e-10081d24744d}
23 |
24 |
25 |
26 |
27 | Source Files
28 |
29 |
30 | Source Files
31 |
32 |
33 | SDK
34 |
35 |
36 | SDK
37 |
38 |
39 | Source Files
40 |
41 |
42 | Source Files
43 |
44 |
45 | SDK
46 |
47 |
48 | Hacks
49 |
50 |
51 | Source Files
52 |
53 |
54 | imgui
55 |
56 |
57 | imgui
58 |
59 |
60 | imgui
61 |
62 |
63 | imgui
64 |
65 |
66 | Source Files
67 |
68 |
69 | SDK
70 |
71 |
72 | cJSON
73 |
74 |
75 | SDK
76 |
77 |
78 | Hacks
79 |
80 |
81 | SDK
82 |
83 |
84 | SDK
85 |
86 |
87 | SDK
88 |
89 |
90 | SDK
91 |
92 |
93 | SDK
94 |
95 |
96 | Hacks
97 |
98 |
99 | SDK
100 |
101 |
102 | SDK
103 |
104 |
105 | SDK
106 |
107 |
108 | SDK
109 |
110 |
111 | Hacks
112 |
113 |
114 | SDK
115 |
116 |
117 | SDK
118 |
119 |
120 | SDK
121 |
122 |
123 | imgui
124 |
125 |
126 | imgui
127 |
128 |
129 | imgui
130 |
131 |
132 | imgui
133 |
134 |
135 | Source Files
136 |
137 |
138 |
139 |
140 | SDK
141 |
142 |
143 | Header Files
144 |
145 |
146 | SDK
147 |
148 |
149 | Header Files
150 |
151 |
152 | Header Files
153 |
154 |
155 | SDK
156 |
157 |
158 | SDK
159 |
160 |
161 | SDK
162 |
163 |
164 | Hacks
165 |
166 |
167 | Header Files
168 |
169 |
170 | Header Files
171 |
172 |
173 | imgui
174 |
175 |
176 | imgui
177 |
178 |
179 | imgui
180 |
181 |
182 | imgui
183 |
184 |
185 | imgui
186 |
187 |
188 | imgui
189 |
190 |
191 | imgui
192 |
193 |
194 | imgui
195 |
196 |
197 | Header Files
198 |
199 |
200 | SDK
201 |
202 |
203 | SDK
204 |
205 |
206 | cJSON
207 |
208 |
209 | SDK
210 |
211 |
212 | SDK
213 |
214 |
215 | Hacks
216 |
217 |
218 | SDK
219 |
220 |
221 | SDK
222 |
223 |
224 | SDK
225 |
226 |
227 | SDK
228 |
229 |
230 | SDK
231 |
232 |
233 | SDK
234 |
235 |
236 | SDK
237 |
238 |
239 | Hacks
240 |
241 |
242 | SDK
243 |
244 |
245 | SDK
246 |
247 |
248 | SDK
249 |
250 |
251 | SDK
252 |
253 |
254 | Header Files
255 |
256 |
257 | SDK
258 |
259 |
260 | Hacks
261 |
262 |
263 | SDK
264 |
265 |
266 | SDK
267 |
268 |
269 | SDK
270 |
271 |
272 | imgui
273 |
274 |
275 |
--------------------------------------------------------------------------------
/Anubis/Config.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include "cJSON/cJSON.h"
5 | #include "Config.h"
6 |
7 | struct Config config;
8 |
9 | static CHAR path[MAX_PATH];
10 |
11 | VOID Config_init()
12 | {
13 | Config_reset();
14 |
15 | PWSTR pathToDocuments;
16 | if (SUCCEEDED(SHGetKnownFolderPath(&FOLDERID_Documents, 0, NULL, &pathToDocuments))) {
17 | sprintf(path, "%ws/%s/", pathToDocuments, "Anubis");
18 | if (PathFileExistsA(path)) {
19 | strcat(path, "*");
20 | WIN32_FIND_DATAA foundData;
21 | HANDLE found = FindFirstFileA(path, &foundData);
22 |
23 | if (found != INVALID_HANDLE_VALUE) {
24 | do {
25 | if (!(foundData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
26 | Config_add(foundData.cFileName);
27 | } while (FindNextFileA(found, &foundData));
28 | }
29 | path[strlen(path) - 1] = '\0';
30 | } else {
31 | CreateDirectoryA(path, NULL);
32 | }
33 | CoTaskMemFree(pathToDocuments);
34 | }
35 | }
36 |
37 | VOID Config_add(PCSTR name)
38 | {
39 | config.count++;
40 | LPVOID newAlloc = realloc(config.names, config.count * sizeof(PSTR));
41 | if (newAlloc)
42 | config.names = newAlloc;
43 | newAlloc = malloc(strlen(name) + 1);
44 | if (newAlloc)
45 | config.names[config.count - 1] = newAlloc;
46 | strcpy(config.names[config.count - 1], name);
47 | }
48 |
49 | VOID Config_rename(size_t id, PCSTR newName)
50 | {
51 | if (strlen(newName) > strlen(config.names[id])) {
52 | LPVOID newAlloc = realloc(config.names[id], strlen(config.names[id]) + 1);
53 | if (newAlloc)
54 | config.names[id] = newAlloc;
55 | }
56 | CHAR fileName[MAX_PATH], newFileName[MAX_PATH];
57 | sprintf(fileName, "%s%s", path, config.names[id]);
58 | sprintf(newFileName, "%s%s", path, newName);
59 |
60 | if (MoveFileA(fileName, newFileName))
61 | strcpy(config.names[id], newName);
62 | }
63 |
64 | VOID Config_load(UINT id)
65 | {
66 | CHAR fileName[MAX_PATH];
67 | sprintf(fileName, "%s%s", path, config.names[id]);
68 |
69 | FILE* in = fopen(fileName, "r");
70 |
71 | if (!in)
72 | return;
73 |
74 | fseek(in, 0L, SEEK_END);
75 | LONG size = ftell(in);
76 | rewind(in);
77 |
78 | PSTR buffer = calloc(size + 1, sizeof(CHAR));
79 | size_t read = 0;
80 | if (buffer) read = fread(buffer, sizeof(CHAR), size, in);
81 | fclose(in);
82 | if (!read) return;
83 |
84 | cJSON* json = cJSON_Parse(buffer);
85 | if (json) {
86 | {
87 | const cJSON* triggerbotJson;
88 | INT i = 0;
89 | cJSON_ArrayForEach(triggerbotJson, cJSON_GetObjectItem(json, "Triggerbot")) {
90 | cJSON* enabled = cJSON_GetObjectItem(triggerbotJson, "Enabled");
91 | if (cJSON_IsBool(enabled)) config.triggerbot[i].enabled = cJSON_IsTrue(enabled);
92 | cJSON* onKey = cJSON_GetObjectItem(triggerbotJson, "On key");
93 | if (cJSON_IsBool(onKey)) config.triggerbot[i].onKey = cJSON_IsTrue(onKey);
94 | cJSON* key = cJSON_GetObjectItem(triggerbotJson, "Key");
95 | if (cJSON_IsNumber(key)) config.triggerbot[i].key = key->valueint;
96 | cJSON* friendlyFire = cJSON_GetObjectItem(triggerbotJson, "Friendly fire");
97 | if (cJSON_IsBool(friendlyFire)) config.triggerbot[i].friendlyFire = cJSON_IsTrue(friendlyFire);
98 | cJSON* scopedOnly = cJSON_GetObjectItem(triggerbotJson, "Scoped only");
99 | if (cJSON_IsBool(scopedOnly)) config.triggerbot[i].scopedOnly = cJSON_IsTrue(scopedOnly);
100 | cJSON* ignoreFlash = cJSON_GetObjectItem(triggerbotJson, "Ignore flash");
101 | if (cJSON_IsBool(ignoreFlash)) config.triggerbot[i].ignoreFlash = cJSON_IsTrue(ignoreFlash);
102 | cJSON* ignoreSmoke = cJSON_GetObjectItem(triggerbotJson, "Ignore smoke");
103 | if (cJSON_IsBool(ignoreSmoke)) config.triggerbot[i].ignoreSmoke = cJSON_IsTrue(ignoreSmoke);
104 | cJSON* hitgroup = cJSON_GetObjectItem(triggerbotJson, "Hitgroup");
105 | if (cJSON_IsNumber(hitgroup)) config.triggerbot[i].hitgroup = hitgroup->valueint;
106 | cJSON* shotDelay = cJSON_GetObjectItem(triggerbotJson, "Shot delay");
107 | if (cJSON_IsNumber(shotDelay)) config.triggerbot[i].shotDelay = shotDelay->valueint;
108 | cJSON* minDamage = cJSON_GetObjectItem(triggerbotJson, "Min damage");
109 | if (cJSON_IsNumber(minDamage)) config.triggerbot[i].minDamage = minDamage->valueint;
110 | cJSON* killshot = cJSON_GetObjectItem(triggerbotJson, "Killshot");
111 | if (cJSON_IsBool(killshot)) config.triggerbot[i].killshot = cJSON_IsTrue(killshot);
112 |
113 | i++;
114 | }
115 | }
116 |
117 | {
118 | const cJSON* glowJson;
119 | INT i = 0;
120 | cJSON_ArrayForEach(glowJson, cJSON_GetObjectItem(json, "Glow")) {
121 | cJSON* enabled = cJSON_GetObjectItem(glowJson, "Enabled");
122 | if (cJSON_IsBool(enabled)) config.glow[i].enabled = cJSON_IsTrue(enabled);
123 | cJSON* healthBased = cJSON_GetObjectItem(glowJson, "Health based");
124 | if (cJSON_IsBool(healthBased)) config.glow[i].healthBased = cJSON_IsTrue(healthBased);
125 | cJSON* rainbow = cJSON_GetObjectItem(glowJson, "Rainbow");
126 | if (cJSON_IsBool(rainbow)) config.glow[i].rainbow = cJSON_IsTrue(rainbow);
127 | cJSON* thickness = cJSON_GetObjectItem(glowJson, "Thickness");
128 | if (cJSON_IsNumber(thickness)) config.glow[i].thickness = (FLOAT)thickness->valuedouble;
129 | cJSON* alpha = cJSON_GetObjectItem(glowJson, "Alpha");
130 | if (cJSON_IsNumber(alpha)) config.glow[i].alpha = (FLOAT)alpha->valuedouble;
131 | cJSON* style = cJSON_GetObjectItem(glowJson, "Style");
132 | if (cJSON_IsNumber(style)) config.glow[i].style = style->valueint;
133 | const cJSON* colorJson;
134 | INT j = 0;
135 | cJSON_ArrayForEach(colorJson, cJSON_GetObjectItem(glowJson, "Color")) {
136 | if (cJSON_IsNumber(colorJson)) config.glow[i].color[j] = (FLOAT)colorJson->valuedouble;
137 | j++;
138 | }
139 | i++;
140 | }
141 | }
142 |
143 | {
144 | cJSON* miscJson = cJSON_GetObjectItem(json, "Misc");
145 |
146 | cJSON* autoStrafe = cJSON_GetObjectItem(miscJson, "Auto strafe");
147 | if (cJSON_IsBool(autoStrafe)) config.misc.autostrafe = cJSON_IsTrue(autoStrafe);
148 | cJSON* bunnyHop = cJSON_GetObjectItem(miscJson, "Bunny hop");
149 | if (cJSON_IsBool(bunnyHop)) config.misc.bunnyhop = cJSON_IsTrue(bunnyHop);
150 | cJSON* moonwalk = cJSON_GetObjectItem(miscJson, "Moonwalk");
151 | if (cJSON_IsBool(moonwalk)) config.misc.moonwalk = cJSON_IsTrue(moonwalk);
152 | }
153 | }
154 |
155 | cJSON_Delete(json);
156 | }
157 |
158 | VOID Config_save(UINT id)
159 | {
160 | cJSON* json = cJSON_CreateObject();
161 |
162 | {
163 | cJSON* triggerbotJson = cJSON_AddArrayToObject(json, "Triggerbot");
164 |
165 | for (INT i = 0; i < sizeof(config.triggerbot) / sizeof(config.triggerbot[0]); i++) {
166 | cJSON* triggerbot = cJSON_CreateObject();
167 |
168 | cJSON_AddBoolToObject(triggerbot, "Enabled", config.triggerbot[i].enabled);
169 | cJSON_AddBoolToObject(triggerbot, "On key", config.triggerbot[i].onKey);
170 | cJSON_AddNumberToObject(triggerbot, "Key", config.triggerbot[i].key);
171 | cJSON_AddBoolToObject(triggerbot, "Friendly fire", config.triggerbot[i].friendlyFire);
172 | cJSON_AddBoolToObject(triggerbot, "Scoped only", config.triggerbot[i].scopedOnly);
173 | cJSON_AddBoolToObject(triggerbot, "Ignore flash", config.triggerbot[i].ignoreFlash);
174 | cJSON_AddBoolToObject(triggerbot, "Ignore smoke", config.triggerbot[i].ignoreSmoke);
175 | cJSON_AddNumberToObject(triggerbot, "Hitgroup", config.triggerbot[i].hitgroup);
176 | cJSON_AddNumberToObject(triggerbot, "Shot delay", config.triggerbot[i].shotDelay);
177 | cJSON_AddNumberToObject(triggerbot, "Min damage", config.triggerbot[i].minDamage);
178 | cJSON_AddBoolToObject(triggerbot, "Killshot", config.triggerbot[i].killshot);
179 |
180 | cJSON_AddItemToArray(triggerbotJson, triggerbot);
181 | }
182 | }
183 |
184 | {
185 | cJSON* glowJson = cJSON_AddArrayToObject(json, "Glow");
186 |
187 | for (INT i = 0; i < sizeof(config.glow) / sizeof(config.glow[0]); i++) {
188 | cJSON* glow = cJSON_CreateObject();
189 |
190 | cJSON_AddBoolToObject(glow, "Enabled", config.glow[i].enabled);
191 | cJSON_AddBoolToObject(glow, "Health based", config.glow[i].healthBased);
192 | cJSON_AddBoolToObject(glow, "Rainbow", config.glow[i].rainbow);
193 | cJSON_AddNumberToObject(glow, "Thickness", config.glow[i].thickness);
194 | cJSON_AddNumberToObject(glow, "Alpha", config.glow[i].alpha);
195 | cJSON_AddNumberToObject(glow, "Style", config.glow[i].style);
196 |
197 | cJSON* colorJson = cJSON_AddArrayToObject(glow, "Color");
198 |
199 | for (INT j = 0; j < 3; j++)
200 | cJSON_AddItemToArray(colorJson, cJSON_CreateNumber(config.glow[i].color[j]));
201 |
202 | cJSON_AddItemToArray(glowJson, glow);
203 |
204 | }
205 | }
206 |
207 | {
208 | cJSON* miscJson = cJSON_CreateObject();
209 |
210 | cJSON_AddBoolToObject(miscJson, "Auto strafe", config.misc.autostrafe);
211 | cJSON_AddBoolToObject(miscJson, "Bunny hop", config.misc.bunnyhop);
212 | cJSON_AddBoolToObject(miscJson, "Moonwalk", config.misc.moonwalk);
213 | cJSON_AddItemToObject(json, "Misc", miscJson);
214 | }
215 |
216 | CHAR fileName[MAX_PATH];
217 | sprintf(fileName, "%s%s", path, config.names[id]);
218 |
219 | if (!PathFileExistsA(path))
220 | CreateDirectoryA(path, NULL);
221 |
222 | FILE* out = fopen(fileName, "w");
223 |
224 | if (out) {
225 | fprintf(out, cJSON_Print(json));
226 | fclose(out);
227 | }
228 |
229 | cJSON_Delete(json);
230 | }
231 |
232 | VOID Config_reset(VOID)
233 | {
234 | Config_resetTriggerbot();
235 | Config_resetGlow();
236 | Config_resetEsp();
237 |
238 | config.misc.autostrafe = false;
239 | config.misc.bunnyhop = false;
240 | config.misc.moonwalk = false;
241 | }
242 |
243 | VOID Config_resetTriggerbot(VOID)
244 | {
245 | for (INT i = 0; i < sizeof(config.triggerbot) / sizeof(config.triggerbot[0]); i++) {
246 | config.triggerbot[i].enabled = false;
247 | config.triggerbot[i].onKey = false;
248 | config.triggerbot[i].key = 0;
249 | config.triggerbot[i].friendlyFire = false;
250 | config.triggerbot[i].scopedOnly = true;
251 | config.triggerbot[i].ignoreFlash = false;
252 | config.triggerbot[i].ignoreSmoke = false;
253 | config.triggerbot[i].hitgroup = 0;
254 | config.triggerbot[i].shotDelay = 0;
255 | config.triggerbot[i].minDamage = 1;
256 | config.triggerbot[i].killshot = false;
257 | }
258 | }
259 |
260 | VOID Config_resetGlow(VOID)
261 | {
262 | for (INT i = 0; i < sizeof(config.glow) / sizeof(config.glow[0]); i++) {
263 | config.glow[i].enabled = false;
264 | config.glow[i].healthBased = false;
265 | config.glow[i].rainbow = false;
266 | config.glow[i].thickness = 1.0f;
267 | config.glow[i].alpha = 1.0f;
268 | config.glow[i].style = 0;
269 | config.glow[i].color[0] = 1.0f;
270 | config.glow[i].color[1] = 1.0f;
271 | config.glow[i].color[2] = 1.0f;
272 | }
273 | }
274 |
275 | VOID Config_resetEsp(VOID)
276 | {
277 | for (INT i = 0; i < sizeof(config.esp.players) / sizeof(config.esp.players[0]); i++) {
278 | config.esp.players[i].enabled = false;
279 | config.esp.players[i].box = false;
280 | config.esp.players[i].boxColor[0] = 1.0f;
281 | config.esp.players[i].boxColor[1] = 1.0f;
282 | config.esp.players[i].boxColor[2] = 1.0f;
283 | }
284 | config.esp.weapon.enabled = false;
285 | config.esp.weapon.font = 0x1d;
286 | config.esp.weapon.box = false;
287 | config.esp.weapon.boxColor[0] = 1.0f;
288 | config.esp.weapon.boxColor[1] = 1.0f;
289 | config.esp.weapon.boxColor[2] = 1.0f;
290 | config.esp.weapon.boxType = 0;
291 | config.esp.weapon.snapLine = false;
292 | config.esp.weapon.snapLineColor[0] = 1.0f;
293 | config.esp.weapon.snapLineColor[1] = 1.0f;
294 | config.esp.weapon.snapLineColor[2] = 1.0f;
295 | config.esp.weapon.name = false;
296 | config.esp.weapon.nameColor[0] = 1.0f;
297 | config.esp.weapon.nameColor[1] = 1.0f;
298 | config.esp.weapon.nameColor[2] = 1.0f;
299 | }
300 |
301 | VOID Config_remove(UINT id)
302 | {
303 | CHAR fileName[MAX_PATH];
304 | sprintf(fileName, "%s%s", path, config.names[id]);
305 | if (!DeleteFileA(fileName))
306 | return;
307 |
308 | free(config.names[id]);
309 | config.count--;
310 |
311 | for (SIZE_T i = id; i < config.count; i++)
312 | config.names[i] = config.names[i + 1];
313 | }
314 |
--------------------------------------------------------------------------------
/Anubis/Config.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | struct TriggerbotConfig {
7 | bool enabled;
8 | bool onKey;
9 | INT key;
10 | bool friendlyFire;
11 | bool scopedOnly;
12 | bool ignoreFlash;
13 | bool ignoreSmoke;
14 | INT hitgroup;
15 | INT shotDelay;
16 | INT minDamage;
17 | bool killshot;
18 | };
19 |
20 | struct GlowConfig {
21 | bool enabled;
22 | bool healthBased;
23 | bool rainbow;
24 | FLOAT thickness;
25 | FLOAT alpha;
26 | INT style;
27 | FLOAT color[3];
28 | };
29 |
30 | struct PlayerEsp {
31 | bool enabled;
32 | bool box;
33 | FLOAT boxColor[3];
34 | };
35 |
36 | struct WeaponEsp {
37 | bool enabled;
38 | INT font;
39 | bool box;
40 | FLOAT boxColor[3];
41 | INT boxType;
42 | bool snapLine;
43 | FLOAT snapLineColor[3];
44 | bool name;
45 | FLOAT nameColor[3];
46 | };
47 |
48 | struct Esp {
49 | struct PlayerEsp players[6];
50 | struct WeaponEsp weapon;
51 | };
52 |
53 | struct Config {
54 | struct TriggerbotConfig triggerbot[35];
55 | struct GlowConfig glow[17];
56 | struct Esp esp;
57 |
58 | struct {
59 | bool bunnyhop;
60 | bool autostrafe;
61 | bool moonwalk;
62 | } misc;
63 |
64 | size_t count;
65 | PSTR* names;
66 | };
67 |
68 | extern struct Config config;
69 | VOID Config_init(VOID);
70 | VOID Config_add(PCSTR);
71 | VOID Config_rename(size_t, PCSTR);
72 | VOID Config_load(UINT);
73 | VOID Config_save(UINT);
74 | VOID Config_reset(VOID);
75 | VOID Config_resetTriggerbot(VOID);
76 | VOID Config_resetGlow(VOID);
77 | VOID Config_resetEsp(VOID);
78 | VOID Config_remove(UINT);
79 |
--------------------------------------------------------------------------------
/Anubis/GUI.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #define CIMGUI_DEFINE_ENUMS_AND_STRUCTS
5 | #include "imgui/cimgui.h"
6 | #include "imgui/imgui_impl_win32.h"
7 | #include "imgui/imgui_impl_dx9.h"
8 |
9 | #include "Config.h"
10 | #include "GUI.h"
11 | #include "Hooks.h"
12 |
13 | bool isGuiOpen = false;
14 |
15 | LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
16 |
17 | bool GUI_handleInput(HWND window, UINT msg, WPARAM wParam, LPARAM lParam)
18 | {
19 | if (GetAsyncKeyState(VK_INSERT) & 1) {
20 | isGuiOpen = !isGuiOpen;
21 | }
22 | if (isGuiOpen && !ImGui_ImplWin32_WndProcHandler(window, msg, wParam, lParam))
23 | return true;
24 | return false;
25 | }
26 |
27 | void GUI_init(IDirect3DDevice9* device)
28 | {
29 | igCreateContext(NULL);
30 | ImGui_ImplWin32_Init(FindWindowA("Valve001", NULL));
31 | ImGui_ImplDX9_Init(device);
32 | igStyleColorsDark(NULL);
33 | ImGuiStyle* style = igGetStyle();
34 | style->WindowRounding = 5.0f;
35 | style->WindowBorderSize = 0.0f;
36 | style->ChildBorderSize = 0.0f;
37 | style->GrabMinSize = 7.0f;
38 | style->GrabRounding = 5.0f;
39 | style->FrameRounding = 5.0f;
40 | style->PopupRounding = 5.0f;
41 | ImGuiIO* io = igGetIO();
42 | io->IniFilename = NULL;
43 | io->LogFilename = NULL;
44 |
45 | static ImWchar ranges[] = { 0x0020, 0x00FF, 0x0100, 0x017f, 0 };
46 | char buffer[MAX_PATH];
47 | if (GetWindowsDirectoryA(buffer, MAX_PATH))
48 | ImFontAtlas_AddFontFromFileTTF(io->Fonts, strcat(buffer, "/Fonts/Tahoma.ttf"), 16.0f, NULL, ranges);
49 | }
50 |
51 | static struct {
52 | bool triggerbot;
53 | bool glow;
54 | bool esp;
55 | bool misc;
56 | bool config;
57 | } window;
58 |
59 | static void renderMenuBar()
60 | {
61 | if (igBeginMainMenuBar()) {
62 | igMenuItemBoolPtr("Triggerbot", NULL, &window.triggerbot, true);
63 | igMenuItemBoolPtr("Glow", NULL, &window.glow, true);
64 | igMenuItemBoolPtr("Esp", NULL, &window.esp, true);
65 | igMenuItemBoolPtr("Misc", NULL, &window.misc, true);
66 | igMenuItemBoolPtr("Config", NULL, &window.config, true);
67 | igEndMainMenuBar();
68 | }
69 | }
70 |
71 | static const ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize
72 | | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse;
73 |
74 | #define IM_ARRAYSIZE(_ARR) ((int)(sizeof(_ARR) / sizeof(*(_ARR))))
75 |
76 | static void keybind(int* key)
77 | {
78 | *key ? igText("[ 0x%x ]", *key) : igTextUnformatted("[ key ]", NULL);
79 | if (igIsItemHovered(ImGuiHoveredFlags_None)) {
80 | igSetTooltip("Press any key to change keybind");
81 | ImGuiIO* io = igGetIO();
82 | for (int i = 0; i < IM_ARRAYSIZE(io->KeysDown); i++)
83 | if (igIsKeyPressed(i, false))
84 | *key = i != VK_ESCAPE ? i : 0;
85 |
86 | for (int i = 0; i < IM_ARRAYSIZE(io->MouseDown); i++)
87 | if (igIsMouseDown(i))
88 | *key = i + (i > 1 ? 2 : 1);
89 | }
90 | }
91 |
92 | static void checkboxedColorPicker(const char* name, bool* enable, float* color)
93 | {
94 | char buf[128];
95 | sprintf_s(buf, sizeof(buf), "##%s", name);
96 | igCheckbox(buf, enable);
97 | igSameLine(0.0f, 5.0f);
98 | igPushIDInt(0);
99 | bool openPopup = igColorButton(buf, (ImVec4) { color[0], color[1], color[2], 1.0f }, ImGuiColorEditFlags_NoTooltip, (ImVec2){ 0, 0 });
100 | igPopID();
101 | igSameLine(0.0f, 5.0f);
102 | igTextUnformatted(name, NULL);
103 | igPushIDInt(1);
104 | if (openPopup)
105 | igOpenPopup(buf, ImGuiPopupFlags_None);
106 | if (igBeginPopup(buf, ImGuiWindowFlags_None)) {
107 | igPushIDInt(2);
108 | igColorPicker3(buf, color, ImGuiColorEditFlags_DisplayRGB | ImGuiColorEditFlags_NoSidePreview);
109 | igPopID();
110 | igEndPopup();
111 | }
112 | igPopID();
113 | }
114 |
115 | static void renderTriggerbotWindow()
116 | {
117 | if (window.triggerbot) {
118 | igSetNextWindowSize((ImVec2){ 0.0f, 0.0f }, ImGuiCond_None);
119 | igBegin("Triggerbot", &window.triggerbot, windowFlags);
120 | static int currentCategory = 0;
121 | igPushItemWidth(110.0f);
122 | igPushIDInt(0);
123 | igComboStr("", ¤tCategory, "All\0Pistols\0Heavy\0SMG\0Rifles\0", -1);
124 | igPopID();
125 | igSameLine(0.0f, -1.0f);
126 | static int currentWeapon = 0;
127 | igPushIDInt(1);
128 | switch (currentCategory) {
129 | case 0:
130 | currentWeapon = 0;
131 | igNewLine();
132 | break;
133 | case 1: {
134 | static int currentPistol = 0;
135 | igComboStr("", ¤tPistol, "Glock-18\0P2000\0USP-S\0Dual Berettas\0P250\0Tec-9\0Five-Seven\0CZ-75\0Desert Eagle\0Revolver\0", -1);
136 | currentWeapon = currentPistol + 1;
137 | break;
138 | }
139 | case 2: {
140 | static int currentHeavy = 0;
141 | igComboStr("", ¤tHeavy, "Nova\0XM1014\0Sawed-off\0MAG-7\0M249\0Negev\0", -1);
142 | currentWeapon = currentHeavy + 11;
143 | break;
144 | }
145 | case 3: {
146 | static int currentSmg = 0;
147 | igComboStr("", ¤tSmg, "Mac-10\0MP9\0MP7\0MP5-SD\0UMP-45\0P90\0PP-Bizon\0", -1);
148 | currentWeapon = currentSmg + 17;
149 | break;
150 | }
151 | case 4: {
152 | static int currentRifle = 0;
153 | igComboStr("", ¤tRifle, "Galil AR\0Famas\0AK-47\0M4A4\0M4A1-S\0SSG-08\0SG-553\0AUG\0AWP\0G3SG1\0SCAR-20\0", -1);
154 | currentWeapon = currentRifle + 24;
155 | break;
156 | }
157 | }
158 | igPopID();
159 | igSameLine(0.0f, -1.0f);
160 | igCheckbox("Enabled", &config.triggerbot[currentWeapon].enabled);
161 | igSeparator();
162 | igCheckbox("On key", &config.triggerbot[currentWeapon].onKey);
163 | igSameLine(0.0f, -1.0f);
164 | keybind(&config.triggerbot[currentWeapon].key);
165 | igCheckbox("Friendly fire", &config.triggerbot[currentWeapon].friendlyFire);
166 | igCheckbox("Scoped only", &config.triggerbot[currentWeapon].scopedOnly);
167 | igCheckbox("Ignore flash", &config.triggerbot[currentWeapon].ignoreFlash);
168 | igCheckbox("Ignore smoke", &config.triggerbot[currentWeapon].ignoreSmoke);
169 | igPushItemWidth(85.0f);
170 | igComboStr("Hitgroup", &config.triggerbot[currentWeapon].hitgroup, "All\0Head\0Chest\0Stomach\0Left arm\0Right arm\0Left leg\0Right leg\0", -1);
171 | igPushItemWidth(220.0f);
172 | igSliderInt("Shot delay", &config.triggerbot[currentWeapon].shotDelay, 0, 250, "%d ms", ImGuiSliderFlags_None);
173 | igInputInt("Min damage", &config.triggerbot[currentWeapon].minDamage, 1, 100, ImGuiInputTextFlags_None);
174 | config.triggerbot[currentWeapon].minDamage = max(min(config.triggerbot[currentWeapon].minDamage, 250), 0);
175 | igCheckbox("Killshot", &config.triggerbot[currentWeapon].killshot);
176 | igEnd();
177 | }
178 | }
179 |
180 | static void renderGlowWindow()
181 | {
182 | if (window.glow) {
183 | igSetNextWindowSize((ImVec2){ 450.0f, 0.0f }, ImGuiCond_None);
184 | igBegin("Glow", &window.glow, windowFlags);
185 |
186 | static int currentCategory = 0;
187 | igPushItemWidth(110.0f);
188 | igPushIDInt(0);
189 | igComboStr("", ¤tCategory, "Allies\0Enemies\0Planting\0Defusing\0Local player\0Weapons\0C4\0Planted C4\0Chickens\0", -1);
190 | igPopID();
191 | static int currentItem = 0;
192 | if (currentCategory <= 3) {
193 | igSameLine(0.0f, -1.0f);
194 | static int currentType = 0;
195 | igPushIDInt(1);
196 | igComboStr("", ¤tType, "All\0Visible\0Occluded\0", -1);
197 | igPopID();
198 | currentItem = currentCategory * 3 + currentType;
199 | } else {
200 | currentItem = currentCategory + 8;
201 | }
202 |
203 | igSameLine(0.0f, -1.0f);
204 | igCheckbox("Enabled", &config.glow[currentItem].enabled);
205 | igSeparator();
206 | igColumns(2, NULL, false);
207 | igSetColumnOffset(1, 150.0f);
208 | igCheckbox("Health based", &config.glow[currentItem].healthBased);
209 | igCheckbox("Rainbow", &config.glow[currentItem].rainbow);
210 | bool openPopup = igColorButton("Color", (ImVec4){ config.glow[currentItem].color[0], config.glow[currentItem].color[1], config.glow[currentItem].color[2], 1.0f }, ImGuiColorEditFlags_NoTooltip, (ImVec2){ 0, 0 });
211 | igSameLine(0.0f, 5.0f);
212 | igText("Color");
213 | igPushIDInt(2);
214 | if (openPopup)
215 | igOpenPopup("", ImGuiPopupFlags_None);
216 | if (igBeginPopup("", ImGuiPopupFlags_None)) {
217 | igPushIDInt(3);
218 | igColorPicker3("", config.glow[currentItem].color, ImGuiColorEditFlags_DisplayRGB | ImGuiColorEditFlags_NoSidePreview);
219 | igPopID();
220 | igEndPopup();
221 | }
222 | igPopID();
223 | igNextColumn();
224 | igPushItemWidth(220.0f);
225 | igSliderFloat("Thickness", &config.glow[currentItem].thickness, 0.0f, 1.0f, "%.2f", ImGuiSliderFlags_None);
226 | igSliderFloat("Alpha", &config.glow[currentItem].alpha, 0.0f, 1.0f, "%.2f", ImGuiSliderFlags_None);
227 | igInputInt("Style", &config.glow[currentItem].style, 1, 1, ImGuiInputTextFlags_None);
228 | config.glow[currentItem].style = max(min(config.glow[currentItem].style, 3), 0);
229 | igEnd();
230 | }
231 | }
232 |
233 | static void renderEspWindow()
234 | {
235 | if (window.esp) {
236 | igSetNextWindowSize((ImVec2){ 0.0f, 0.0f }, ImGuiCond_None);
237 | igBegin("Esp", &window.esp, windowFlags);
238 |
239 | static int currentCategory = 0;
240 | igPushItemWidth(110.0f);
241 | igPushIDInt(0);
242 | igComboStr("", ¤tCategory, "Allies\0Enemies\0Weapons", -1);
243 | igPopID();
244 | igSameLine(0.0f, -1.0f);
245 |
246 | if (currentCategory < 2) {
247 | static int currentType = 0;
248 | igPushIDInt(1);
249 | igComboStr("", ¤tType, "All\0Visible\0Occluded\0", -1);
250 | igPopID();
251 | int currentItem = currentCategory * 3 + currentType;
252 | igSameLine(0.0f, -1.0f);
253 | igCheckbox("Enabled", &config.esp.players[currentItem].enabled);
254 | igSeparator();
255 |
256 | checkboxedColorPicker("Box", &config.esp.players[currentItem].box, config.esp.players[currentItem].boxColor);
257 | } else {
258 | igCheckbox("Enabled", &config.esp.weapon.enabled);
259 | igSeparator();
260 |
261 | checkboxedColorPicker("Box", &config.esp.weapon.box, config.esp.weapon.boxColor);
262 | igSameLine(0.0f, -1.0f);
263 | igComboStr("", &config.esp.weapon.boxType, "2D\0""3D\0", -1);
264 | checkboxedColorPicker("Snap line", &config.esp.weapon.snapLine, config.esp.weapon.snapLineColor);
265 | checkboxedColorPicker("Name", &config.esp.weapon.name, config.esp.weapon.nameColor);
266 | }
267 | igEnd();
268 | }
269 | }
270 |
271 | static void renderMiscWindow()
272 | {
273 | if (window.misc) {
274 | igSetNextWindowSize((ImVec2){ 0.0f, 0.0f }, ImGuiCond_None);
275 | igBegin("Misc", &window.misc, windowFlags);
276 | igCheckbox("Auto strafe", &config.misc.autostrafe);
277 | igCheckbox("Bunnyhop", &config.misc.bunnyhop);
278 | igCheckbox("Moonwalk", &config.misc.moonwalk);
279 | if (igButton("Unhook", (ImVec2){ 0, 0 }))
280 | Hooks_restore();
281 | igEnd();
282 | }
283 | }
284 |
285 | static void renderConfigWindow()
286 | {
287 | if (window.config) {
288 | igSetNextWindowSize((ImVec2){ 290.0f, 190.0f }, ImGuiCond_None);
289 | igBegin("Config", &window.config, windowFlags);
290 |
291 | igColumns(2, NULL, false);
292 | igSetColumnOffset(1, 170.0f);
293 |
294 | igPushItemWidth(160.0f);
295 |
296 | static int currentConfig = -1;
297 |
298 | if ((size_t)currentConfig >= config.count)
299 | currentConfig = -1;
300 |
301 | static char buffer[16];
302 |
303 | if (igListBoxStr_arr("", ¤tConfig, config.names, config.count, 5) && currentConfig != -1)
304 | strcpy(buffer, config.names[currentConfig]);
305 |
306 | igPushIDInt(0);
307 | if (igInputText("", buffer, IM_ARRAYSIZE(buffer), ImGuiInputTextFlags_EnterReturnsTrue, NULL, NULL)) {
308 | if (currentConfig != -1)
309 | Config_rename(currentConfig, buffer);
310 | }
311 | igPopID();
312 | igNextColumn();
313 |
314 | igPushItemWidth(100.0f);
315 |
316 | if (igButton("Create config", (ImVec2){ 100.0f, 25.0f }))
317 | Config_add(buffer);
318 |
319 | if (igButton("Reset config", (ImVec2){ 100.0f, 25.0f }))
320 | Config_reset();
321 |
322 | if (currentConfig != -1) {
323 | if (igButton("Load selected", (ImVec2){ 100.0f, 25.0f })) {
324 | Config_load(currentConfig);
325 | }
326 | if (igButton("Save selected", (ImVec2){ 100.0f, 25.0f }))
327 | Config_save(currentConfig);
328 | if (igButton("Delete selected", (ImVec2){ 100.0f, 25.0f }))
329 | Config_remove(currentConfig);
330 | }
331 | igEnd();
332 | }
333 | }
334 |
335 | void GUI_render()
336 | {
337 | ImGui_ImplDX9_NewFrame();
338 | ImGui_ImplWin32_NewFrame();
339 | igNewFrame();
340 |
341 | renderMenuBar();
342 | renderTriggerbotWindow();
343 | renderGlowWindow();
344 | renderEspWindow();
345 | renderMiscWindow();
346 | renderConfigWindow();
347 |
348 | igEndFrame();
349 | igRender();
350 | ImGui_ImplDX9_RenderDrawData(igGetDrawData());
351 | }
352 |
353 | void GUI_invalidateDeviceObjects(void)
354 | {
355 | ImGui_ImplDX9_InvalidateDeviceObjects();
356 | }
357 |
358 | void GUI_createDeviceObjects(void)
359 | {
360 | ImGui_ImplDX9_CreateDeviceObjects();
361 | }
362 |
--------------------------------------------------------------------------------
/Anubis/GUI.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | bool GUI_handleInput(HWND, UINT, WPARAM, LPARAM);
7 | void GUI_init(IDirect3DDevice9*);
8 | void GUI_render(void);
9 | void GUI_invalidateDeviceObjects(void);
10 | void GUI_createDeviceObjects(void);
11 |
12 | extern bool isGuiOpen;
13 |
--------------------------------------------------------------------------------
/Anubis/Hacks/Esp.c:
--------------------------------------------------------------------------------
1 | #include "../Config.h"
2 | #include "Esp.h"
3 | #include "../SDK/DebugOverlay.h"
4 | #include "../SDK/Engine.h"
5 | #include "../SDK/Entity.h"
6 | #include "../SDK/EntityList.h"
7 | #include "../SDK/Localize.h"
8 | #include "../SDK/Surface.h"
9 | #include "../SDK/Vector.h"
10 | #include "../SDK/WeaponData.h"
11 |
12 | struct BoundingBox {
13 | FLOAT x0, y0;
14 | FLOAT x1, y1;
15 | struct Vector vertices[8];
16 | };
17 |
18 | static BOOLEAN boundingBox(PVOID entity, struct BoundingBox* out)
19 | {
20 | CONST struct Vector* min = Entity_obbMins(entity);
21 | CONST struct Vector* max = Entity_obbMaxs(entity);
22 |
23 | INT width, height;
24 | Surface_getScreenSize(&width, &height);
25 |
26 | out->x0 = (FLOAT)(width * 2);
27 | out->y0 = (FLOAT)(height * 2);
28 | out->x1 = -(FLOAT)(width * 2);
29 | out->y1 = -(FLOAT)(height * 2);
30 |
31 | for (INT i = 0; i < 8; i++) {
32 | CONST struct Vector vertex = { i & 1 ? max->x : min->x,
33 | i & 2 ? max->y : min->y,
34 | i & 4 ? max->z : min->z };
35 |
36 | struct Vector transformed = Vector_transform(&vertex, Entity_coordinateFrame(entity));
37 |
38 | if (DebugOverlay_screenPosition(&transformed, out->vertices + i))
39 | return FALSE;
40 |
41 | if (out->x0 > out->vertices[i].x)
42 | out->x0 = out->vertices[i].x;
43 |
44 | if (out->y0 > out->vertices[i].y)
45 | out->y0 = out->vertices[i].y;
46 |
47 | if (out->x1 < out->vertices[i].x)
48 | out->x1 = out->vertices[i].x;
49 |
50 | if (out->y1 < out->vertices[i].y)
51 | out->y1 = out->vertices[i].y;
52 | }
53 | return TRUE;
54 | }
55 |
56 | static VOID renderEspforWeapon(PVOID entity)
57 | {
58 | if (config.esp.weapon.enabled) {
59 | struct BoundingBox bbox;
60 | if (boundingBox(entity, &bbox)) {
61 | if (config.esp.weapon.box) {
62 | Surface_setDrawColor2(config.esp.weapon.boxColor, 255);
63 |
64 | switch (config.esp.weapon.boxType) {
65 | case 0:
66 | Surface_drawOutlinedRect(bbox.x0, bbox.y0, bbox.x1, bbox.y1);
67 | break;
68 | case 1:
69 | for (INT i = 0; i < 8; i++) {
70 | if (!(i & 1))
71 | Surface_drawLine(bbox.vertices[i].x, bbox.vertices[i].y, bbox.vertices[i + 1].x, bbox.vertices[i + 1].y);
72 | if (!(i & 2))
73 | Surface_drawLine(bbox.vertices[i].x, bbox.vertices[i].y, bbox.vertices[i + 2].x, bbox.vertices[i + 2].y);
74 | if (!(i & 4))
75 | Surface_drawLine(bbox.vertices[i].x, bbox.vertices[i].y, bbox.vertices[i + 4].x, bbox.vertices[i + 4].y);
76 | }
77 | break;
78 | }
79 | }
80 |
81 | if (config.esp.weapon.name) {
82 | PCWSTR name = Localize_find(Entity_getWeaponData(entity)->name);
83 | INT width, height;
84 | Surface_getTextSize(0x1D, name, &width, &height);
85 |
86 | Surface_setTextFont(0x1D);
87 | Surface_setTextColor(config.esp.weapon.nameColor, 255);
88 | Surface_setTextPosition(bbox.x0 + (bbox.x1 - bbox.x0 - width) / 2, bbox.y1 + 5);
89 | Surface_printText(name);
90 | }
91 | }
92 |
93 | if (config.esp.weapon.snapLine) {
94 | struct Vector absOrigin = Entity_getAbsOrigin(entity);
95 | struct Vector position;
96 | if (!DebugOverlay_screenPosition(&absOrigin, &position)) {
97 | INT width, height;
98 | Surface_getScreenSize(&width, &height);
99 | Surface_setDrawColor2(config.esp.weapon.snapLineColor, 255);
100 | Surface_drawLine((FLOAT)(width / 2), (FLOAT)height, position.x, position.y);
101 | }
102 | }
103 | }
104 | }
105 |
106 | VOID Esp_render(VOID)
107 | {
108 | if (Engine_isInGame()) {
109 | PVOID localPlayer = EntityList_getEntity(Engine_getLocalPlayer());
110 | for (INT i = 1; i <= Engine_getMaxClients(); i++) {
111 | PVOID entity = EntityList_getEntity(i);
112 |
113 | if (!entity || entity == localPlayer || Entity_isDormant(entity) || !Entity_isAlive(entity))
114 | continue;
115 |
116 | }
117 |
118 | for (INT i = Engine_getMaxClients() + 1; i <= EntityList_getHighestEntityIndex(); i++) {
119 | PVOID entity = EntityList_getEntity(i);
120 |
121 | if (!entity || Entity_isDormant(entity) || !Entity_isWeapon(entity) || *Entity_ownerEntity(entity) != -1)
122 | continue;
123 |
124 | renderEspforWeapon(entity);
125 | }
126 |
127 | }
128 | }
129 |
--------------------------------------------------------------------------------
/Anubis/Hacks/Esp.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | VOID Esp_render(VOID);
6 |
--------------------------------------------------------------------------------
/Anubis/Hacks/Glow.c:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "../Config.h"
4 | #include "Glow.h"
5 | #include "../Memory.h"
6 |
7 | #include "../SDK/ClassId.h"
8 | #include "../SDK/ClientClass.h"
9 | #include "../SDK/Engine.h"
10 | #include "../SDK/Entity.h"
11 | #include "../SDK/EntityList.h"
12 | #include "../SDK/GlobalVars.h"
13 | #include "../SDK/GlowObjectDefinition.h"
14 |
15 | static VOID applyGlow(struct GlowObjectDefinition* glowObject, struct GlowConfig* glowConfig, INT health)
16 | {
17 | if (glowConfig->enabled) {
18 | glowObject->renderWhenOccluded = true;
19 | glowObject->alpha = glowConfig->alpha;
20 | glowObject->glowStyle = glowConfig->style;
21 | glowObject->bloomAmount = glowConfig->thickness;
22 |
23 | if (glowConfig->healthBased && health) {
24 | glowObject->glowColor.x = 1.0f - health / 100.0f;
25 | glowObject->glowColor.y = health / 100.0f;
26 | glowObject->glowColor.z = 0.0f;
27 | } else if (glowConfig->rainbow) {
28 | glowObject->glowColor.x = sinf(0.6f * Memory()->globalVars->currentTime) * 0.5f + 0.5f;
29 | glowObject->glowColor.y = sinf(0.6f * Memory()->globalVars->currentTime + 2.0f) * 0.5f + 0.5f;
30 | glowObject->glowColor.z = sinf(0.6f * Memory()->globalVars->currentTime + 4.0f) * 0.5f + 0.5f;
31 | } else {
32 | glowObject->glowColor.x = glowConfig->color[0];
33 | glowObject->glowColor.y = glowConfig->color[1];
34 | glowObject->glowColor.z = glowConfig->color[2];
35 | }
36 | }
37 | }
38 |
39 | static VOID applyPlayerGlow(struct GlowObjectDefinition* glowObject, struct GlowConfig* glowConfigAll, struct GlowConfig* glowConfigVisible, struct GlowConfig* glowConfigOccluded, PVOID entity)
40 | {
41 | Vector localPlayerEyePosition;
42 | Entity_getEyePosition(EntityList_getEntity(Engine_getLocalPlayer()), &localPlayerEyePosition);
43 | if (glowConfigAll->enabled) applyGlow(glowObject, glowConfigAll, *Entity_health(entity));
44 | else if ((glowConfigVisible->style || Entity_isVisible(entity, NULL)) && !Memory()->lineGoesThroughSmoke(localPlayerEyePosition, Entity_getBonePosition(entity, 8), 1)) applyGlow(glowObject, glowConfigVisible, *Entity_health(entity));
45 | else applyGlow(glowObject, glowConfigOccluded, *Entity_health(entity));
46 |
47 | }
48 |
49 | VOID Glow_render(VOID)
50 | {
51 | for (int i = 0; i < Memory()->glowObjectManager->glowObjectDefinitions.size; i++) {
52 | struct GlowObjectDefinition* glowObject = (struct GlowObjectDefinition*)Memory()->glowObjectManager->glowObjectDefinitions.memory + i;
53 | PVOID entity = glowObject->entity;
54 |
55 | if (glowObject->nextFreeSlot != -2 || !entity || Entity_isDormant(entity))
56 | continue;
57 |
58 | switch (Entity_getClientClass(entity)->classId) {
59 | case ClassId_CSPlayer: {
60 | PVOID activeWeapon = Entity_getActiveWeapon(entity);
61 | if (activeWeapon && Entity_getClientClass(entity)->classId == ClassId_C4 && *Entity_c4startedArming(activeWeapon))
62 | applyPlayerGlow(glowObject, config.glow + 6, config.glow + 7, config.glow + 8, entity);
63 | else if (*Entity_isDefusing(entity))
64 | applyPlayerGlow(glowObject, config.glow + 9, config.glow + 10, config.glow + 11, entity);
65 | else if (entity == EntityList_getEntity(Engine_getLocalPlayer()))
66 | applyGlow(glowObject, config.glow + 12, *Entity_health(entity));
67 | else if (Entity_isEnemy(entity))
68 | applyPlayerGlow(glowObject, config.glow + 3, config.glow + 4, config.glow + 5, entity);
69 | else
70 | applyPlayerGlow(glowObject, config.glow + 0, config.glow + 1, config.glow + 2, entity);
71 | break;
72 | }
73 | case ClassId_C4:
74 | applyGlow(glowObject, config.glow + 14, 0);
75 | break;
76 | case ClassId_PlantedC4:
77 | applyGlow(glowObject, config.glow + 15, 0);
78 | break;
79 | case ClassId_Chicken:
80 | applyGlow(glowObject, config.glow + 16, 0);
81 | break;
82 | default:
83 | if (Entity_isWeapon(entity)) {
84 | applyGlow(glowObject, config.glow + 13, 0);
85 | if (!config.glow[13].enabled) glowObject->renderWhenOccluded = false;
86 | }
87 | }
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/Anubis/Hacks/Glow.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | VOID Glow_render(VOID);
6 |
--------------------------------------------------------------------------------
/Anubis/Hacks/Misc.c:
--------------------------------------------------------------------------------
1 | #include "../Config.h"
2 | #include "Misc.h"
3 | #include "../SDK/Engine.h"
4 | #include "../SDK/Entity.h"
5 | #include "../SDK/EntityList.h"
6 | #include "../SDK/UserCmd.h"
7 |
8 | VOID Misc_bunnyhop(UserCmd* cmd)
9 | {
10 | PVOID localPlayer = EntityList_getEntity(Engine_getLocalPlayer());
11 | static BOOLEAN wasLastTimeOnGround = TRUE;
12 |
13 | if (config.misc.bunnyhop && !(*Entity_flags(localPlayer) & 1) && !wasLastTimeOnGround && *Entity_moveType(localPlayer) != MoveType_Ladder)
14 | cmd->buttons &= ~IN_JUMP;
15 |
16 | wasLastTimeOnGround = *Entity_flags(localPlayer) & 1;
17 | }
18 |
19 | VOID Misc_autostrafe(UserCmd* cmd)
20 | {
21 | if (config.misc.autostrafe && !(*Entity_flags(EntityList_getEntity(Engine_getLocalPlayer())) & 1)) {
22 | if (cmd->mousedx < 0)
23 | cmd->sidemove = -450.0f;
24 | else if (cmd->mousedx > 0)
25 | cmd->sidemove = 450.0f;
26 | }
27 | }
28 |
29 | VOID Misc_moonwalk(UserCmd* cmd)
30 | {
31 | if (config.misc.moonwalk && *Entity_moveType(EntityList_getEntity(Engine_getLocalPlayer())) != MoveType_Ladder)
32 | cmd->buttons ^= IN_FORWARD | IN_BACK | IN_MOVELEFT | IN_MOVERIGHT;
33 | }
34 |
--------------------------------------------------------------------------------
/Anubis/Hacks/Misc.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | typedef struct UserCmd UserCmd;
4 |
5 | VOID Misc_bunnyhop(UserCmd*);
6 | VOID Misc_autostrafe(UserCmd*);
7 | VOID Misc_moonwalk(UserCmd*);
8 |
--------------------------------------------------------------------------------
/Anubis/Hacks/Triggerbot.c:
--------------------------------------------------------------------------------
1 | #include "../Config.h"
2 | #include "../Memory.h"
3 |
4 | #include "../SDK/ClassId.h"
5 | #include "../SDK/ClientClass.h"
6 | #include "../SDK/ConVar.h"
7 | #include "../SDK/Cvar.h"
8 | #include "../SDK/Engine.h"
9 | #include "../SDK/EngineTrace.h"
10 | #include "../SDK/Entity.h"
11 | #include "../SDK/EntityList.h"
12 | #include "../SDK/GlobalVars.h"
13 | #include "../SDK/ItemDefinitionIndex.h"
14 | #include "../SDK/UserCmd.h"
15 | #include "../SDK/Utils.h"
16 | #include "../SDK/Vector.h"
17 | #include "../SDK/WeaponData.h"
18 |
19 | #include "Triggerbot.h"
20 |
21 | VOID Triggerbot_run(UserCmd* cmd)
22 | {
23 | PVOID localPlayer = EntityList_getEntity(Engine_getLocalPlayer());
24 | if (*Entity_nextAttack(localPlayer) > GlobalVars_serverTime(NULL))
25 | return;
26 |
27 | PVOID activeWeapon = Entity_getActiveWeapon(localPlayer);
28 | if (!activeWeapon || !*Entity_clip(activeWeapon) || *Entity_nextPrimaryAttack(activeWeapon) > GlobalVars_serverTime(NULL))
29 | return;
30 |
31 | INT weaponIndex = getWeaponIndex(*Entity_itemDefinitionIndex(activeWeapon));
32 | if (!weaponIndex)
33 | return;
34 |
35 | if (!config.triggerbot[weaponIndex].enabled)
36 | weaponIndex = 0;
37 |
38 | static FLOAT lastTime = 0.0f;
39 |
40 | if (config.triggerbot[weaponIndex].enabled) {
41 | const FLOAT now = Memory()->globalVars->realTime;
42 |
43 | if ((GetAsyncKeyState(config.triggerbot[weaponIndex].key) || !config.triggerbot[weaponIndex].onKey)
44 | && now - lastTime >= config.triggerbot[weaponIndex].shotDelay / 1000.0f) {
45 |
46 | UTILS_STATIC_VAR(ConVar*, weaponRecoilScale, Cvar_findVar("weapon_recoil_scale"));
47 | const float recoilScale = ConVar_getFloat(weaponRecoilScale);
48 |
49 | Vector aimPunch = *Entity_aimPunchAngle(localPlayer);
50 | aimPunch.x *= recoilScale;
51 | aimPunch.y *= recoilScale;
52 | aimPunch.z *= recoilScale;
53 |
54 | CONST struct WeaponData* weaponData = Entity_getWeaponData(activeWeapon);
55 |
56 | Vector viewAngles = { cosf(DEG2RAD(cmd->viewangles.x + aimPunch.x)) * cosf(DEG2RAD(cmd->viewangles.y + aimPunch.y)) * weaponData->range,
57 | cosf(DEG2RAD(cmd->viewangles.x + aimPunch.x)) * sinf(DEG2RAD(cmd->viewangles.y + aimPunch.y)) * weaponData->range,
58 | -sinf(DEG2RAD(cmd->viewangles.x + aimPunch.x)) * weaponData->range };
59 |
60 | Ray ray;
61 | ray.isRay = true;
62 | Entity_getEyePosition(localPlayer, &ray.start);
63 | ray.delta = viewAngles;
64 | ray.isSwept = ray.delta.x || ray.delta.y || ray.delta.z;
65 |
66 | Trace trace;
67 | TraceFilter filter;
68 | TraceFilter_init(&filter);
69 | filter.skip = localPlayer;
70 | EngineTrace_traceRay(&ray, 0x46004009, &filter, &trace);
71 |
72 | if (trace.entity && Entity_getClientClass(trace.entity)->classId == ClassId_CSPlayer
73 | && (config.triggerbot[weaponIndex].friendlyFire
74 | || Entity_isEnemy(trace.entity))
75 | && !*Entity_gunGameImmunity(trace.entity)
76 | && (!config.triggerbot[weaponIndex].hitgroup
77 | || trace.hitgroup == config.triggerbot[weaponIndex].hitgroup)
78 | && (config.triggerbot[weaponIndex].ignoreSmoke
79 | || !Memory()->lineGoesThroughSmoke(ray.start, Vector_add(&ray.start, &viewAngles), 1))
80 | && (config.triggerbot[weaponIndex].ignoreFlash
81 | || !*Entity_flashDuration(localPlayer))
82 | && (!config.triggerbot[weaponIndex].scopedOnly
83 | || !Entity_isSniperRifle(activeWeapon)
84 | || *Entity_isScoped(localPlayer))) {
85 |
86 | FLOAT damage = (*Entity_itemDefinitionIndex(activeWeapon) != ItemDefinitionIndex_Taser ? HitGroup_getDamageMultiplier(trace.hitgroup) : 1.0f) * weaponData->damage * powf(weaponData->rangeModifier, trace.fraction * weaponData->range / 500.0f);
87 | FLOAT armorRatio = weaponData->armorRatio / 2.0f;
88 | if (*Entity_itemDefinitionIndex(activeWeapon) != ItemDefinitionIndex_Taser && HitGroup_isArmored(trace.hitgroup, *Entity_hasHelmet(trace.entity)))
89 | damage -= (*Entity_armor(trace.entity) < damage * armorRatio / 2.0f ? *Entity_armor(trace.entity) * 4.0f : damage) * (1.0f - armorRatio);
90 |
91 | if (damage >= (config.triggerbot[weaponIndex].killshot ? *Entity_health(trace.entity) : config.triggerbot[weaponIndex].minDamage)) {
92 | cmd->buttons |= IN_ATTACK;
93 | lastTime = 0.0f;
94 | }
95 | } else {
96 | lastTime = now;
97 | }
98 | }
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/Anubis/Hacks/Triggerbot.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | typedef struct UserCmd UserCmd;
6 |
7 | VOID Triggerbot_run(UserCmd*);
8 |
--------------------------------------------------------------------------------
/Anubis/Hooks.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 |
6 | #include "GUI.h"
7 | #include "Hacks/Esp.h"
8 | #include "Hacks/Glow.h"
9 | #include "Hacks/Misc.h"
10 | #include "Hacks/Triggerbot.h"
11 | #include "Hooks.h"
12 | #include "Interfaces.h"
13 | #include "Memory.h"
14 |
15 | #include "SDK/Engine.h"
16 | #include "SDK/EntityList.h"
17 | #include "SDK/GlobalVars.h"
18 | #include "SDK/Panel.h"
19 | #include "SDK/Surface.h"
20 | #include "SDK/UserCmd.h"
21 | #include "SDK/Utils.h"
22 |
23 | struct VmtHook {
24 | PVOID base;
25 | PUINT_PTR oldVmt;
26 | PUINT_PTR newVmt;
27 | SIZE_T length;
28 | };
29 |
30 | struct Hooks {
31 | HRESULT(WINAPI* originalPresent)(IDirect3DDevice9*, const RECT*, const RECT*, HWND, const RGNDATA*);
32 | HRESULT(WINAPI* originalReset)(IDirect3DDevice9*, D3DPRESENT_PARAMETERS*);
33 | WNDPROC originalWndProc;
34 | struct VmtHook clientMode;
35 | struct VmtHook panel;
36 | struct VmtHook surface;
37 | };
38 |
39 | static struct Hooks hooks;
40 |
41 | static LRESULT WINAPI hookedWndProc(HWND window, UINT msg, WPARAM wParam, LPARAM lParam)
42 | {
43 | if (GUI_handleInput(window, msg, wParam, lParam))
44 | return true;
45 | return CallWindowProcW(hooks.originalWndProc, window, msg, wParam, lParam);
46 | }
47 |
48 | static HRESULT WINAPI hookedPresent(IDirect3DDevice9* device, const RECT* src, const RECT* dest, HWND windowOverride, const RGNDATA* dirtyRegion)
49 | {
50 | static bool init = false;
51 | if (!init) {
52 | GUI_init(device);
53 | init = true;
54 | }
55 |
56 | if (isGuiOpen)
57 | GUI_render();
58 |
59 | return hooks.originalPresent(device, src, dest, windowOverride, dirtyRegion);
60 | }
61 |
62 | static HRESULT WINAPI hookedReset(IDirect3DDevice9* device, D3DPRESENT_PARAMETERS* params)
63 | {
64 | GUI_invalidateDeviceObjects();
65 | HRESULT result = hooks.originalReset(device, params);
66 | GUI_createDeviceObjects();
67 | return result;
68 | }
69 |
70 | static SIZE_T calculateLength(PUINT_PTR vmt)
71 | {
72 | SIZE_T length = 0;
73 | MEMORY_BASIC_INFORMATION memoryInfo;
74 | while (VirtualQuery((LPCVOID)vmt[length], &memoryInfo, sizeof(memoryInfo)) && memoryInfo.Protect == PAGE_EXECUTE_READ)
75 | length++;
76 | return length;
77 | }
78 |
79 | static void hookVmt(PVOID base, struct VmtHook* vmtHook)
80 | {
81 | vmtHook->base = base;
82 | vmtHook->oldVmt = *((PUINT_PTR*)base);
83 | vmtHook->length = calculateLength(vmtHook->oldVmt) + 1;
84 | PVOID newVmt = malloc(vmtHook->length * sizeof(uintptr_t));
85 | if (newVmt) {
86 | vmtHook->newVmt = newVmt;
87 | memcpy(vmtHook->newVmt, vmtHook->oldVmt - 1, vmtHook->length * sizeof(uintptr_t));
88 | *((PUINT_PTR*)base) = vmtHook->newVmt + 1;
89 | }
90 | }
91 |
92 | static void restoreVmt(struct VmtHook* vmtHook)
93 | {
94 | *((PUINT_PTR*)vmtHook->base) = vmtHook->oldVmt;
95 | free(vmtHook->newVmt);
96 | }
97 |
98 | static void hookMethod(struct VmtHook* vmtHook, SIZE_T index, PVOID function)
99 | {
100 | if (index < vmtHook->length)
101 | vmtHook->newVmt[index + 1] = (UINT_PTR)function;
102 | }
103 |
104 | static bool __stdcall createMove(FLOAT inputSampleTime, UserCmd* cmd)
105 | {
106 | bool result = CALL_ORIGINAL(bool(__fastcall*)(PVOID, PVOID, FLOAT, UserCmd*), Memory()->clientMode, hooks.clientMode.oldVmt, 24, inputSampleTime, cmd);
107 |
108 | if (!cmd->commandNumber)
109 | return result;
110 |
111 | bool* sendPacket = (bool*)(*((PUINT_PTR)_AddressOfReturnAddress() - 1) - 0x1C);
112 |
113 | GlobalVars_serverTime(cmd);
114 | Misc_autostrafe(cmd);
115 | Misc_bunnyhop(cmd);
116 | Misc_moonwalk(cmd);
117 | Triggerbot_run(cmd);
118 |
119 | Angles_normalize(&cmd->viewangles);
120 |
121 | cmd->viewangles.x = min(89.0f, max(cmd->viewangles.x, -89.0f));
122 | cmd->viewangles.y = min(180.0f, max(cmd->viewangles.y, -180.0f));
123 | cmd->viewangles.z = 0.0f;
124 |
125 | return false;
126 | }
127 |
128 | static INT __stdcall doPostScreenEffects(INT param)
129 | {
130 | Glow_render();
131 | return CALL_ORIGINAL(INT(__fastcall*)(PVOID, PVOID, INT), Memory()->clientMode, hooks.clientMode.oldVmt, 44, param);
132 | }
133 |
134 | static VOID __stdcall lockCursor(VOID)
135 | {
136 | if (isGuiOpen) {
137 | Surface_unlockCursor();
138 | return;
139 | }
140 | CALL_ORIGINAL(VOID(__fastcall*)(PVOID, PVOID), Interfaces()->surface, hooks.surface.oldVmt, 67);
141 | }
142 |
143 | static VOID __stdcall paintTraverse(UINT panel, BOOLEAN forceRepaint, BOOLEAN allowForce)
144 | {
145 | if (!strcmp(Panel_getName(panel), "MatSystemTopPanel")) {
146 | Esp_render();
147 | }
148 |
149 | CALL_ORIGINAL(VOID(__fastcall*)(PVOID, PVOID, UINT, BOOLEAN, BOOLEAN), Interfaces()->panel, hooks.panel.oldVmt, 41, panel, forceRepaint, allowForce);
150 | }
151 |
152 | VOID Hooks_init(VOID)
153 | {
154 | hookVmt(Memory()->clientMode, &hooks.clientMode);
155 | hookMethod(&hooks.clientMode, 24, createMove);
156 | hookMethod(&hooks.clientMode, 44, doPostScreenEffects);
157 |
158 | hookVmt(Interfaces()->panel, &hooks.panel);
159 | hookMethod(&hooks.panel, 41, paintTraverse);
160 |
161 | hookVmt(Interfaces()->surface, &hooks.surface);
162 | hookMethod(&hooks.surface, 67, lockCursor);
163 |
164 | HWND window = FindWindowA("Valve001", NULL);
165 | hooks.originalWndProc = (WNDPROC)SetWindowLongPtrW(window, GWLP_WNDPROC, (LONG_PTR)hookedWndProc);
166 |
167 | hooks.originalPresent = **Memory()->present;
168 | **Memory()->present = hookedPresent;
169 |
170 | hooks.originalReset = **Memory()->reset;
171 | **Memory()->reset = hookedReset;
172 | }
173 |
174 | VOID Hooks_restore(VOID)
175 | {
176 | restoreVmt(&hooks.clientMode);
177 | restoreVmt(&hooks.panel);
178 | restoreVmt(&hooks.surface);
179 |
180 | SetWindowLongPtrW(FindWindowW(L"Valve001", NULL), GWLP_WNDPROC, (LONG_PTR)hooks.originalWndProc);
181 |
182 | **Memory()->present = hooks.originalPresent;
183 | **Memory()->reset = hooks.originalReset;
184 | }
185 |
--------------------------------------------------------------------------------
/Anubis/Hooks.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | VOID Hooks_init(VOID);
7 | VOID Hooks_restore(VOID);
8 |
--------------------------------------------------------------------------------
/Anubis/Interfaces.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include "Interfaces.h"
5 | #include "SDK/GameUI.h"
6 |
7 | static struct Interfaces interfaces;
8 |
9 | static uintptr_t** find(const wchar_t* module, const char* name)
10 | {
11 | typedef uintptr_t** (*CreateInterface)(const char*, int*);
12 | HMODULE moduleHandle = GetModuleHandleW(module);
13 |
14 | if (moduleHandle) {
15 | CreateInterface createInterface = (CreateInterface)GetProcAddress(moduleHandle, "CreateInterface");
16 | if (createInterface) {
17 | uintptr_t** foundInterface = createInterface(name, 0);
18 | if (foundInterface)
19 | return foundInterface;
20 | }
21 | }
22 |
23 | char buf[100];
24 | sprintf_s(buf, sizeof(buf), "Failed to find %s interface!", name);
25 | MessageBoxA(NULL, buf, "Error", MB_OK | MB_ICONERROR);
26 | exit(EXIT_FAILURE);
27 | }
28 |
29 | void Interfaces_init(void)
30 | {
31 | interfaces.client = find(L"client", "VClient018");
32 | interfaces.cvar = find(L"vstdlib", "VEngineCvar007");
33 | interfaces.debugOverlay = find(L"engine", "VDebugOverlay004");
34 | interfaces.engine = find(L"engine", "VEngineClient014");
35 | interfaces.engineTrace = find(L"engine", "EngineTraceClient004");
36 | interfaces.entityList = find(L"client", "VClientEntityList003");
37 | interfaces.gameUI = find(L"client", "GameUI011");
38 | interfaces.localize = find(L"localize", "Localize_001");
39 | interfaces.panel = find(L"vgui2", "VGUI_Panel009");
40 | interfaces.surface = find(L"vguimatsurface", "VGUI_Surface031");
41 |
42 | GameUI_messageBox("Huge success!", "Anubis has been succesfully loaded.");
43 | }
44 |
45 | const struct Interfaces* Interfaces(void)
46 | {
47 | return &interfaces;
48 | }
49 |
--------------------------------------------------------------------------------
/Anubis/Interfaces.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | struct Interfaces {
6 | uintptr_t** client;
7 | uintptr_t** cvar;
8 | uintptr_t** debugOverlay;
9 | uintptr_t** engine;
10 | uintptr_t** engineTrace;
11 | uintptr_t** entityList;
12 | uintptr_t** gameUI;
13 | uintptr_t** localize;
14 | uintptr_t** panel;
15 | uintptr_t** surface;
16 | };
17 |
18 | void Interfaces_init(void);
19 | const struct Interfaces* Interfaces(void);
20 |
--------------------------------------------------------------------------------
/Anubis/Memory.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 |
7 | #include "Interfaces.h"
8 | #include "Memory.h"
9 |
10 | static struct Memory memory;
11 |
12 | static void* findPattern(PCWSTR module, PCSTR pattern, SIZE_T offset)
13 | {
14 | MODULEINFO moduleInfo;
15 | HMODULE moduleHandle = GetModuleHandleW(module);
16 |
17 | if (moduleHandle && GetModuleInformation(GetCurrentProcess(), moduleHandle, &moduleInfo, sizeof(moduleInfo))) {
18 | PCHAR begin = moduleInfo.lpBaseOfDll;
19 | PCHAR end = begin + moduleInfo.SizeOfImage;
20 |
21 | for (PCHAR c = begin; c != end; c++) {
22 | bool matched = true;
23 |
24 | for (PCSTR patternIt = pattern, it = c; *patternIt; patternIt++, it++) {
25 | if (*patternIt != '?' && *it != *patternIt) {
26 | matched = false;
27 | break;
28 | }
29 | }
30 | if (matched)
31 | return c + offset;
32 | }
33 | }
34 | WCHAR buf[100];
35 | swprintf(buf, sizeof(buf) / sizeof(WCHAR), L"Failed to find pattern in %s.dll!", module);
36 | MessageBoxW(NULL, buf, L"Error", MB_OK | MB_ICONERROR);
37 | exit(EXIT_FAILURE);
38 | }
39 |
40 | static PVOID relativeToAbsolute(int* address)
41 | {
42 | return (PBYTE)(address + 1) + *address;
43 | }
44 |
45 | VOID Memory_init(VOID)
46 | {
47 | memory.debugMsg = (void*)GetProcAddress(GetModuleHandleW(L"tier0"), "Msg");
48 |
49 | memory.clientMode = **((PVOID**)(Interfaces()->client[0][10] + 5));
50 | memory.loadSky = findPattern(L"engine", "\x55\x8B\xEC\x81\xEC????\x56\x57\x8B\xF9\xC7\x45", 0);
51 | memory.present = findPattern(L"gameoverlayrenderer", "\xFF\x15????\x8B\xF0\x85\xFF", 2);
52 | memory.reset = findPattern(L"gameoverlayrenderer", "\xC7\x45?????\xFF\x15????\x8B\xD8", 9);
53 | memory.glowObjectManager = *(GlowObjectManager**)findPattern(L"client", "\x0F\x11\x05????\x83\xC8\x01", 3);
54 | memory.globalVars = **((PVOID**)(Interfaces()->client[0][11] + 10));
55 | memory.isOtherEnemy = relativeToAbsolute(findPattern(L"client", "\xE8????\x02\xC0", 1));
56 | memory.lineGoesThroughSmoke = relativeToAbsolute(findPattern(L"client", "\xE8????\x8B\x4C\x24\x30\x33\xD2", 1));
57 | }
58 |
59 | const struct Memory* Memory(void)
60 | {
61 | return &memory;
62 | }
63 |
--------------------------------------------------------------------------------
/Anubis/Memory.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 |
7 | typedef struct GlowObjectManager GlowObjectManager;
8 | typedef struct GlobalVars GlobalVars;
9 | typedef struct Vector Vector;
10 |
11 | struct Memory {
12 | PVOID* clientMode;
13 | VOID(__fastcall* loadSky)(PCSTR);
14 | PVOID** present;
15 | PVOID** reset;
16 | GlowObjectManager* glowObjectManager;
17 | GlobalVars* globalVars;
18 | bool(__fastcall* isOtherEnemy)(PVOID, PVOID, PVOID);
19 | bool(__cdecl* lineGoesThroughSmoke)(Vector, Vector, SHORT);
20 | void(__cdecl* debugMsg)(const char* msg, ...);
21 | };
22 |
23 | VOID Memory_init(VOID);
24 | const struct Memory* Memory(void);
25 |
--------------------------------------------------------------------------------
/Anubis/Netvars.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include "Netvars.h"
5 | #include "SDK/Client.h"
6 | #include "SDK/ClientClass.h"
7 | #include "SDK/Recv.h"
8 | #include "SDK/Utils.h"
9 |
10 | typedef struct Offset {
11 | UINT nameHash;
12 | SIZE_T offset;
13 | struct Offset* next;
14 | } Offset;
15 |
16 | static Offset firstOffset;
17 | static Offset* currentOffset;
18 |
19 | static VOID traverseTable(bool unload, const char* networkName, RecvTable* recvTable, const SIZE_T offset)
20 | {
21 | for (int i = 0; i < recvTable->propCount; i++) {
22 | RecvProp* prop = recvTable->props + i;
23 |
24 | if (isdigit(prop->name[0]))
25 | continue;
26 |
27 | if (Utils_hashRuntime(prop->name) == UTILS_HASH("baseclass"))
28 | continue;
29 |
30 | if (prop->type == 6
31 | && prop->dataTable
32 | && prop->dataTable->netTableName[0] == 'D')
33 | traverseTable(unload, networkName, prop->dataTable, prop->offset + offset);
34 |
35 | CHAR name[256];
36 | sprintf_s(name, sizeof(name), "%s->%s", networkName, prop->name);
37 | const UINT hash = Utils_hashRuntime(name);
38 |
39 | if (!unload) {
40 | currentOffset->nameHash = hash;
41 | currentOffset->offset = offset + prop->offset;
42 | currentOffset->next = calloc(1, sizeof(Offset));
43 | currentOffset = currentOffset->next;
44 | } else {
45 |
46 | }
47 | }
48 | }
49 |
50 | VOID initializeNetvars(VOID)
51 | {
52 | currentOffset = &firstOffset;
53 |
54 | for (struct ClientClass* clientClass = Client_getAllClasses(); clientClass; clientClass = clientClass->next)
55 | traverseTable(false, clientClass->networkName, clientClass->recvTable, 0);
56 | }
57 |
58 | SIZE_T Netvars_getOffset(UINT hash)
59 | {
60 | static bool netvarsInitialized = false;
61 |
62 | if (!netvarsInitialized) {
63 | initializeNetvars();
64 | netvarsInitialized = true;
65 | }
66 |
67 | for (Offset* offset = &firstOffset; offset; offset = offset->next)
68 | if (hash == offset->nameHash)
69 | return offset->offset;
70 | return 0;
71 | }
72 |
--------------------------------------------------------------------------------
/Anubis/Netvars.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include "SDK/Utils.h"
5 |
6 | SIZE_T Netvars_getOffset(UINT);
7 |
8 | #define NETVAR_OFFSET(funcname, class_name, var_name, offset, type) \
9 | type* Entity_##funcname(PVOID entity);
10 |
11 | #define NETVAR(funcname, class_name, var_name, type) \
12 | NETVAR_OFFSET(funcname, class_name, var_name, 0, type)
13 |
14 | #define NETVAR_OFFSET_IMPL(funcname, class_name, var_name, offset, type) \
15 | type* Entity_##funcname(PVOID entity) \
16 | { \
17 | UTILS_STATIC_VAR(SIZE_T, netvarOffset, Netvars_getOffset(UTILS_HASH(class_name "->" var_name))); \
18 | return (type*)((PBYTE)entity + netvarOffset + offset); \
19 | }
20 |
21 | #define NETVAR_IMPL(funcname, class_name, var_name, type) \
22 | NETVAR_OFFSET_IMPL(funcname, class_name, var_name, 0, type)
23 |
--------------------------------------------------------------------------------
/Anubis/SDK/ClassId.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | typedef enum ClassId {
4 | ClassId_BaseCSGrenadeProjectile = 9,
5 | ClassId_BreachChargeProjectile = 29,
6 | ClassId_BumpMineProjectile = 33,
7 | ClassId_C4,
8 | ClassId_Chicken = 36,
9 | ClassId_CSPlayer = 40,
10 | ClassId_CSRagdoll = 42,
11 | ClassId_Deagle = 46,
12 | ClassId_DecoyProjectile = 48,
13 | ClassId_Drone,
14 | ClassId_Dronegun,
15 | ClassId_EconEntity = 53,
16 | ClassId_Hostage = 97,
17 | ClassId_Knife = 107,
18 | ClassId_KnifeGG,
19 | ClassId_MolotovProjectile = 113,
20 | ClassId_PlantedC4 = 128,
21 | ClassId_PropDoorRotating = 142,
22 | ClassId_SensorGrenadeProjectile = 152,
23 | ClassId_SmokeGrenadeProjectile = 156,
24 | ClassId_SnowballProjectile = 160,
25 | ClassId_Tablet = 171,
26 | ClassId_Aug = 231,
27 | ClassId_Awp,
28 | ClassId_Elite = 238,
29 | ClassId_FiveSeven = 240,
30 | ClassId_G3sg1,
31 | ClassId_Glock = 244,
32 | ClassId_P2000,
33 | ClassId_P250 = 257,
34 | ClassId_Scar20 = 260,
35 | ClassId_Sg553 = 264,
36 | ClassId_Ssg08 = 266,
37 | ClassId_Tec9 = 268
38 | } ClassId;
39 |
--------------------------------------------------------------------------------
/Anubis/SDK/Client.c:
--------------------------------------------------------------------------------
1 | #include "Client.h"
2 | #include "../Interfaces.h"
3 | #include "Utils.h"
4 |
5 | struct ClientClass* Client_getAllClasses(VOID)
6 | {
7 | return CALL_VIRTUAL_METHOD(struct ClientClass*(__fastcall*)(PVOID, PVOID), Interfaces()->client, 8);
8 | }
9 |
--------------------------------------------------------------------------------
/Anubis/SDK/Client.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | struct ClientClass;
6 |
7 | struct ClientClass* Client_getAllClasses(VOID);
8 |
--------------------------------------------------------------------------------
/Anubis/SDK/ClientClass.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | typedef enum ClassId ClassId;
6 |
7 | struct ClientClass {
8 | PVOID(*createFunction)(INT, INT);
9 | PVOID createEventFunction;
10 | PSTR networkName;
11 | PVOID recvTable;
12 | struct ClientClass* next;
13 | ClassId classId;
14 | };
15 |
--------------------------------------------------------------------------------
/Anubis/SDK/ConVar.c:
--------------------------------------------------------------------------------
1 | #include "ConVar.h"
2 | #include "Utils.h"
3 |
4 | FLOAT ConVar_getFloat(struct ConVar* conVar)
5 | {
6 | return CALL_VIRTUAL_METHOD(FLOAT(__fastcall*)(PVOID, PVOID), conVar, 12);
7 | }
8 |
9 | INT ConVar_getInt(struct ConVar* conVar)
10 | {
11 | return CALL_VIRTUAL_METHOD(INT(__fastcall*)(PVOID, PVOID), conVar, 13);
12 | }
13 |
14 | VOID ConVar_setValueString(struct ConVar* conVar, PCSTR str)
15 | {
16 | CALL_VIRTUAL_METHOD(VOID(__fastcall*)(PVOID, PVOID, PCSTR), conVar, 14, str);
17 | }
18 |
19 | VOID ConVar_setValueFloat(struct ConVar* conVar, FLOAT _float)
20 | {
21 | CALL_VIRTUAL_METHOD(VOID(__fastcall*)(PVOID, PVOID, FLOAT), conVar, 15, _float);
22 | }
23 |
24 | VOID ConVar_setValueInt(struct ConVar* conVar, INT _int)
25 | {
26 | CALL_VIRTUAL_METHOD(VOID(__fastcall*)(PVOID, PVOID, INT), conVar, 16, _int);
27 | }
28 |
--------------------------------------------------------------------------------
/Anubis/SDK/ConVar.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | struct ConVar {
6 | BYTE pad[24];
7 | VOID(*changeCallback)(VOID);
8 | struct ConVar* parent;
9 | PCSTR defaultValue;
10 | PSTR string;
11 | };
12 |
13 | FLOAT ConVar_getFloat(struct ConVar*);
14 | INT ConVar_getInt(struct ConVar*);
15 | VOID ConVar_setValueString(struct ConVar*, PCSTR);
16 | VOID ConVar_setValueFloat(struct ConVar*, FLOAT);
17 | VOID ConVar_setValueInt(struct ConVar*, INT);
18 |
--------------------------------------------------------------------------------
/Anubis/SDK/Cvar.c:
--------------------------------------------------------------------------------
1 | #include "Cvar.h"
2 | #include "../Interfaces.h"
3 | #include "Utils.h"
4 |
5 | ConVar* Cvar_findVar(PCSTR name)
6 | {
7 | return CALL_VIRTUAL_METHOD(ConVar* (__fastcall*)(PVOID, PVOID, PCSTR), Interfaces()->cvar, 15, name);
8 | }
9 |
--------------------------------------------------------------------------------
/Anubis/SDK/Cvar.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | typedef struct ConVar ConVar;
6 |
7 | ConVar* Cvar_findVar(PCSTR);
8 |
--------------------------------------------------------------------------------
/Anubis/SDK/DebugOverlay.c:
--------------------------------------------------------------------------------
1 | #include "DebugOverlay.h"
2 | #include "../Interfaces.h"
3 | #include "Utils.h"
4 |
5 | BOOL DebugOverlay_screenPosition(CONST struct Vector* point, struct Vector* screen)
6 | {
7 | return CALL_VIRTUAL_METHOD(BOOL(__fastcall*)(PVOID, PVOID, CONST struct Vector*, struct Vector*), Interfaces()->debugOverlay, 13, point, screen);
8 | }
9 |
--------------------------------------------------------------------------------
/Anubis/SDK/DebugOverlay.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | struct Vector;
6 |
7 | BOOL DebugOverlay_screenPosition(CONST struct Vector*, struct Vector*);
8 |
--------------------------------------------------------------------------------
/Anubis/SDK/Engine.c:
--------------------------------------------------------------------------------
1 | #include "Engine.h"
2 | #include "../Interfaces.h"
3 | #include "Utils.h"
4 |
5 | INT Engine_getLocalPlayer(VOID)
6 | {
7 | return CALL_VIRTUAL_METHOD(INT(__fastcall*)(PVOID, PVOID), Interfaces()->engine, 12);
8 | }
9 |
10 | INT Engine_getMaxClients(VOID)
11 | {
12 | return CALL_VIRTUAL_METHOD(INT(__fastcall*)(PVOID, PVOID), Interfaces()->engine, 20);
13 | }
14 |
15 | bool Engine_isInGame(VOID)
16 | {
17 | return CALL_VIRTUAL_METHOD(bool(__fastcall*)(PVOID, PVOID), Interfaces()->engine, 26);
18 | }
19 |
--------------------------------------------------------------------------------
/Anubis/SDK/Engine.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | INT Engine_getLocalPlayer(VOID);
7 | INT Engine_getMaxClients(VOID);
8 | bool Engine_isInGame(VOID);
9 |
--------------------------------------------------------------------------------
/Anubis/SDK/EngineTrace.c:
--------------------------------------------------------------------------------
1 | #include "EngineTrace.h"
2 | #include "../Interfaces.h"
3 |
4 | static bool __fastcall shouldHitEntity(TraceFilter* traceFilter, PVOID _1, PVOID entity, INT _2)
5 | {
6 | return entity != traceFilter->skip;
7 | }
8 |
9 | static INT __fastcall getTraceType()
10 | {
11 | return 0;
12 | }
13 |
14 | static PVOID traceFilterVmt[2] = { shouldHitEntity, getTraceType };
15 |
16 | VOID TraceFilter_init(TraceFilter* traceFilter)
17 | {
18 | traceFilter->vmt = traceFilterVmt;
19 | }
20 |
21 | FLOAT HitGroup_getDamageMultiplier(INT hitGroup)
22 | {
23 | switch (hitGroup) {
24 | case HitGroup_Head:
25 | return 4.0f;
26 | case HitGroup_Stomach:
27 | return 1.25f;
28 | case HitGroup_LeftLeg:
29 | case HitGroup_RightLeg:
30 | return 0.75f;
31 | default:
32 | return 1.0f;
33 | }
34 | }
35 |
36 | BOOLEAN HitGroup_isArmored(INT hitGroup, BOOLEAN helmet)
37 | {
38 | switch (hitGroup) {
39 | case HitGroup_Head:
40 | return helmet;
41 | case HitGroup_Chest:
42 | case HitGroup_Stomach:
43 | case HitGroup_LeftArm:
44 | case HitGroup_RightArm:
45 | return TRUE;
46 | default:
47 | return FALSE;
48 | }
49 | }
50 |
51 | VOID EngineTrace_traceRay(const Ray* ray, UINT mask, const TraceFilter* filter, Trace* trace)
52 | {
53 | CALL_VIRTUAL_METHOD(VOID(__fastcall*)(PVOID, PVOID, const Ray*, UINT, const TraceFilter*, Trace*), Interfaces()->engineTrace, 5, ray, mask, filter, trace);
54 | }
55 |
--------------------------------------------------------------------------------
/Anubis/SDK/EngineTrace.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #include "Utils.h"
6 | #include "Vector.h"
7 |
8 | typedef struct Ray {
9 | struct Vector start;
10 | FLOAT pad;
11 | struct Vector delta;
12 | BYTE pad2[40];
13 | bool isRay;
14 | bool isSwept;
15 | } Ray;
16 |
17 | typedef struct TraceFilter {
18 | PVOID vmt;
19 | PVOID skip;
20 | } TraceFilter;
21 |
22 | VOID TraceFilter_init(TraceFilter*);
23 |
24 | typedef enum HitGroup {
25 | HitGroup_Invalid = -1,
26 | HitGroup_Generic,
27 | HitGroup_Head,
28 | HitGroup_Chest,
29 | HitGroup_Stomach,
30 | HitGroup_LeftArm,
31 | HitGroup_RightArm,
32 | HitGroup_LeftLeg,
33 | HitGroup_RightLeg,
34 | HitGroup_Gear = 10
35 | } HitGroup;
36 |
37 | FLOAT HitGroup_getDamageMultiplier(INT);
38 | BOOLEAN HitGroup_isArmored(INT, BOOLEAN);
39 |
40 | typedef struct TraceSurface {
41 | PCSTR name;
42 | SHORT surfaceProps;
43 | USHORT flags;
44 | } TraceSurface;
45 |
46 | typedef struct Trace {
47 | struct Vector startpos;
48 | struct Vector endpos;
49 | BYTE pad[20];
50 | FLOAT fraction;
51 | INT contents;
52 | USHORT dispFlags;
53 | bool allSolid;
54 | bool startSolid;
55 | BYTE pad1[4];
56 | TraceSurface surface;
57 | HitGroup hitgroup;
58 | BYTE pad2[4];
59 | PVOID entity;
60 | INT hitbox;
61 | } Trace;
62 |
63 | VOID EngineTrace_traceRay(const Ray*, UINT, const TraceFilter*, Trace*);
64 |
--------------------------------------------------------------------------------
/Anubis/SDK/Entity.c:
--------------------------------------------------------------------------------
1 | #include "ClassId.h"
2 | #include "ClientClass.h"
3 | #include "Engine.h"
4 | #include "EngineTrace.h"
5 | #include "Entity.h"
6 | #include "EntityList.h"
7 | #include "Matrix3x4.h"
8 | #include "../Memory.h"
9 | #include "Utils.h"
10 | #include "Vector.h"
11 |
12 | struct ClientClass* Entity_getClientClass(PVOID entity)
13 | {
14 | return CALL_VIRTUAL_METHOD(struct ClientClass*(__fastcall*)(PVOID, PVOID), (PBYTE)entity + 8, 2);
15 | }
16 |
17 | bool Entity_isDormant(PVOID entity)
18 | {
19 | return CALL_VIRTUAL_METHOD(bool(__fastcall*)(PVOID, PVOID), (PBYTE)entity + 8, 9);
20 | }
21 |
22 | bool Entity_setupBones(PVOID entity, struct Matrix3x4* out, INT maxBones, INT boneMask, FLOAT currentTime)
23 | {
24 | return CALL_VIRTUAL_METHOD(bool(__fastcall*)(PVOID, PVOID, struct Matrix3x4*, INT, INT, FLOAT), (PBYTE)entity + 4, 13, out, maxBones, boneMask, currentTime);
25 | }
26 |
27 | CONST struct Vector* Entity_obbMins(PVOID entity)
28 | {
29 | PVOID collideable = CALL_VIRTUAL_METHOD(PVOID(__fastcall*)(PVOID, PVOID), entity, 3);
30 | return CALL_VIRTUAL_METHOD(CONST struct Vector*(__fastcall*)(PVOID, PVOID), collideable, 1);
31 | }
32 |
33 | CONST struct Vector* Entity_obbMaxs(PVOID entity)
34 | {
35 | PVOID collideable = CALL_VIRTUAL_METHOD(PVOID(__fastcall*)(PVOID, PVOID), entity, 3);
36 | return CALL_VIRTUAL_METHOD(CONST struct Vector* (__fastcall*)(PVOID, PVOID), collideable, 2);
37 | }
38 |
39 | struct Vector Entity_getAbsOrigin(PVOID entity)
40 | {
41 | return *CALL_VIRTUAL_METHOD(struct Vector*(__fastcall*)(PVOID, PVOID), entity, 10);
42 | }
43 |
44 | BOOLEAN Entity_isAlive(PVOID entity)
45 | {
46 | return Entity_health(entity) && CALL_VIRTUAL_METHOD(BOOLEAN(__fastcall*)(PVOID, PVOID), entity, 155);
47 | }
48 |
49 | bool Entity_isWeapon(PVOID entity)
50 | {
51 | return CALL_VIRTUAL_METHOD(bool(__fastcall*)(PVOID, PVOID), entity, 165);
52 | }
53 |
54 | PVOID Entity_getActiveWeapon(PVOID entity)
55 | {
56 | return CALL_VIRTUAL_METHOD(PVOID(__fastcall*)(PVOID, PVOID), entity, 267);
57 | }
58 |
59 | VOID Entity_getEyePosition(PVOID entity, Vector* out)
60 | {
61 | CALL_VIRTUAL_METHOD(VOID(__fastcall*)(PVOID, PVOID, Vector*), entity, 284, out);
62 | }
63 |
64 | struct WeaponData* Entity_getWeaponData(PVOID entity)
65 | {
66 | return CALL_VIRTUAL_METHOD(struct WeaponData*(__fastcall*)(PVOID, PVOID), entity, 460);
67 | }
68 |
69 | bool Entity_isEnemy(PVOID entity)
70 | {
71 | return Memory()->isOtherEnemy(entity, NULL, EntityList_getEntity(Engine_getLocalPlayer()));
72 | }
73 |
74 | Vector Entity_getBonePosition(PVOID entity, INT bone)
75 | {
76 | struct Matrix3x4 boneMatrices[128];
77 |
78 | if (Entity_setupBones(entity, boneMatrices, 128, 256, 0.0f)) {
79 | Vector result = { boneMatrices[bone].m[0][3], boneMatrices[bone].m[1][3], boneMatrices[bone].m[2][3] };
80 | return result;
81 | } else {
82 | Vector result = { 0.0f, 0.0f, 0.0f };
83 | return result;
84 | }
85 | }
86 |
87 | bool Entity_isVisible(PVOID entity, CONST struct Vector* position)
88 | {
89 | PVOID localPlayer = EntityList_getEntity(Engine_getLocalPlayer());
90 | Ray ray;
91 | Entity_getEyePosition(localPlayer, &ray.start);
92 | const Vector endPosition = position ? *position : Entity_getBonePosition(entity, 8);
93 |
94 | ray.delta.x = endPosition.x - ray.start.x;
95 | ray.delta.y = endPosition.y - ray.start.y;
96 | ray.delta.z = endPosition.z - ray.start.z;
97 | if (endPosition.x || endPosition.y || endPosition.z)
98 | ray.isSwept = true;
99 |
100 | Trace trace;
101 | TraceFilter filter;
102 | TraceFilter_init(&filter);
103 | filter.skip = localPlayer;
104 | EngineTrace_traceRay(&ray, 0x46004009, &filter, &trace);
105 | return trace.entity == entity;
106 | }
107 |
108 | bool Entity_isSniperRifle(PVOID entity)
109 | {
110 | switch (Entity_getClientClass(entity)->classId) {
111 | case ClassId_Ssg08:
112 | case ClassId_Awp:
113 | case ClassId_Scar20:
114 | case ClassId_G3sg1:
115 | return true;
116 | default:
117 | return false;
118 | }
119 | }
120 |
121 | CONST struct Matrix3x4* Entity_coordinateFrame(PVOID entity)
122 | {
123 | return (CONST struct Matrix3x4*)((PBYTE)entity + 0x444);
124 | }
125 |
126 | NETVAR_OFFSET_IMPL(moveType, "CBaseEntity", "m_nRenderMode", 1, enum MoveType);
127 | NETVAR_IMPL(ownerEntity, "CBaseEntity", "m_hOwnerEntity", int);
128 |
129 | NETVAR_IMPL(nextAttack, "CBaseCombatCharacter", "m_flNextAttack", FLOAT);
130 |
131 | NETVAR_IMPL(clip, "CBaseCombatWeapon", "m_iClip1", INT);
132 | NETVAR_IMPL(nextPrimaryAttack, "CBaseCombatWeapon", "m_flNextPrimaryAttack", FLOAT);
133 |
134 | NETVAR_IMPL(itemDefinitionIndex, "CBaseAttributableItem", "m_iItemDefinitionIndex", SHORT);
135 |
136 | NETVAR_IMPL(flags, "CBasePlayer", "m_fFlags", INT);
137 | NETVAR_IMPL(health, "CBasePlayer", "m_iHealth", INT);
138 | NETVAR_IMPL(tickBase, "CBasePlayer", "m_nTickBase", INT);
139 | NETVAR_IMPL(aimPunchAngle, "CBasePlayer", "m_aimPunchAngle", Vector);
140 |
141 | NETVAR_IMPL(isDefusing, "CCSPlayer", "m_bIsDefusing", BOOLEAN);
142 | NETVAR_IMPL(gunGameImmunity, "CCSPlayer", "m_bGunGameImmunity", BOOLEAN);
143 | NETVAR_IMPL(flashDuration, "CCSPlayer", "m_flFlashDuration", FLOAT);
144 | NETVAR_IMPL(isScoped, "CCSPlayer", "m_bIsScoped", BOOLEAN);
145 | NETVAR_IMPL(hasHelmet, "CCSPlayer", "m_bHasHelmet", BOOLEAN);
146 | NETVAR_IMPL(armor, "CCSPlayer", "m_ArmorValue", INT);
147 |
148 | NETVAR_IMPL(c4startedArming, "CC4", "m_bStartedArming", BOOLEAN);
149 |
--------------------------------------------------------------------------------
/Anubis/SDK/Entity.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | #include "../Netvars.h"
7 |
8 | struct ClientClass;
9 | struct Vector;
10 | struct WeaponData;
11 | struct Matrix3x4;
12 |
13 | struct ClientClass* Entity_getClientClass(PVOID);
14 | bool Entity_isDormant(PVOID);
15 | bool Entity_setupBones(PVOID, struct Matrix3x4*, INT, INT, FLOAT);
16 | CONST struct Vector* Entity_obbMins(PVOID);
17 | CONST struct Vector* Entity_obbMaxs(PVOID);
18 | struct Vector Entity_getAbsOrigin(PVOID);
19 | BOOLEAN Entity_isAlive(PVOID);
20 | bool Entity_isWeapon(PVOID);
21 | PVOID Entity_getActiveWeapon(PVOID);
22 | VOID Entity_getEyePosition(PVOID, struct Vector*);
23 | struct WeaponData* Entity_getWeaponData(PVOID);
24 | bool Entity_isEnemy(PVOID);
25 | struct Vector Entity_getBonePosition(PVOID, INT);
26 | bool Entity_isVisible(PVOID, CONST struct Vector*);
27 | bool Entity_isSniperRifle(PVOID);
28 | CONST struct Matrix3x4* Entity_coordinateFrame(PVOID);
29 |
30 | enum MoveType {
31 | MoveType_Noclip = 8,
32 | MoveType_Ladder = 9
33 | };
34 |
35 | NETVAR_OFFSET(moveType, "CBaseEntity", "m_nRenderMode", 1, enum MoveType);
36 | NETVAR(ownerEntity, "CBaseEntity", "m_hOwnerEntity", int);
37 |
38 | NETVAR(nextAttack, "CBaseCombatCharacter", "m_flNextAttack", FLOAT);
39 |
40 | NETVAR(clip, "CBaseCombatWeapon", "m_iClip1", INT);
41 | NETVAR(nextPrimaryAttack, "CBaseCombatWeapon", "m_flNextPrimaryAttack", FLOAT);
42 |
43 | NETVAR(itemDefinitionIndex, "CBaseAttributableItem", "m_iItemDefinitionIndex", SHORT);
44 |
45 | NETVAR(flags, "CBasePlayer", "m_fFlags", INT);
46 | NETVAR(health, "CBasePlayer", "m_iHealth", INT);
47 | NETVAR(tickBase, "CBasePlayer", "m_nTickBase", INT);
48 | NETVAR(aimPunchAngle, "CBasePlayer", "m_aimPunchAngle", struct Vector);
49 |
50 | NETVAR(isDefusing, "CCSPlayer", "m_bIsDefusing", BOOLEAN);
51 | NETVAR(gunGameImmunity, "CCSPlayer", "m_bGunGameImmunity", BOOLEAN);
52 | NETVAR(flashDuration, "CCSPlayer", "m_flFlashDuration", FLOAT);
53 | NETVAR(isScoped, "CCSPlayer", "m_bIsScoped", BOOLEAN);
54 | NETVAR(hasHelmet, "CCSPlayer", "m_bHasHelmet", BOOLEAN);
55 | NETVAR(armor, "CCSPlayer", "m_ArmorValue", INT);
56 |
57 | NETVAR(c4startedArming, "CC4", "m_bStartedArming", BOOLEAN);
58 |
--------------------------------------------------------------------------------
/Anubis/SDK/EntityList.c:
--------------------------------------------------------------------------------
1 | #include "EntityList.h"
2 | #include "../Interfaces.h"
3 | #include "Utils.h"
4 |
5 | PVOID EntityList_getEntity(INT index)
6 | {
7 | return CALL_VIRTUAL_METHOD(PVOID(__fastcall*)(PVOID, PVOID, INT), Interfaces()->entityList, 3, index);
8 | }
9 |
10 | INT EntityList_getHighestEntityIndex(VOID)
11 | {
12 | return CALL_VIRTUAL_METHOD(INT(__fastcall*)(PVOID, PVOID), Interfaces()->entityList, 6);
13 | }
14 |
--------------------------------------------------------------------------------
/Anubis/SDK/EntityList.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | PVOID EntityList_getEntity(INT);
6 | INT EntityList_getHighestEntityIndex(VOID);
7 |
--------------------------------------------------------------------------------
/Anubis/SDK/GameUI.c:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "GameUI.h"
4 | #include "../Interfaces.h"
5 | #include "Utils.h"
6 |
7 | VOID GameUI_messageBox(PCSTR title, PCSTR text)
8 | {
9 | CALL_VIRTUAL_METHOD(VOID(__fastcall*)(PVOID, PVOID, PCSTR, PCSTR, bool, bool, PCSTR, PCSTR, PCSTR, PCSTR, PVOID), Interfaces()->gameUI, 20, title, text, true, false, NULL, NULL, NULL, NULL, NULL);
10 | }
11 |
--------------------------------------------------------------------------------
/Anubis/SDK/GameUI.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | VOID GameUI_messageBox(PCSTR, PCSTR);
6 |
--------------------------------------------------------------------------------
/Anubis/SDK/GlobalVars.c:
--------------------------------------------------------------------------------
1 | #include "GlobalVars.h"
2 | #include "../Memory.h"
3 | #include "UserCmd.h"
4 |
5 | #include "../SDK/Engine.h"
6 | #include "../SDK/Entity.h"
7 | #include "../SDK/EntityList.h"
8 |
9 | FLOAT GlobalVars_serverTime(struct UserCmd* cmd)
10 | {
11 | static INT tick = 0;
12 | static struct UserCmd* lastCmd = NULL;
13 |
14 | if (cmd) {
15 | if (!lastCmd || lastCmd->hasbeenpredicted)
16 | tick = *Entity_tickBase(EntityList_getEntity(Engine_getLocalPlayer()));
17 | else
18 | tick++;
19 | lastCmd = cmd;
20 | }
21 | return tick * Memory()->globalVars->intervalPerTick;
22 | }
23 |
--------------------------------------------------------------------------------
/Anubis/SDK/GlobalVars.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | struct UserCmd;
6 |
7 | struct GlobalVars {
8 | const FLOAT realTime;
9 | const INT frameCount;
10 | const FLOAT absoluteFrameTime;
11 | const BYTE pad[4];
12 | const FLOAT currentTime;
13 | const FLOAT frameTime;
14 | const INT maxClients;
15 | const INT tickCount;
16 | const FLOAT intervalPerTick;
17 | };
18 |
19 | FLOAT GlobalVars_serverTime(struct UserCmd*);
20 |
--------------------------------------------------------------------------------
/Anubis/SDK/GlowObjectDefinition.c:
--------------------------------------------------------------------------------
1 | #include "GlowObjectDefinition.h"
2 |
3 | bool GlowObjectManager_hasGlowEffect(struct GlowObjectManager* glowObjectManager, PVOID entity)
4 | {
5 | for (int i = 0; i < glowObjectManager->glowObjectDefinitions.size; i++) {
6 | struct GlowObjectDefinition* glowObject = (struct GlowObjectDefinition*)glowObjectManager->glowObjectDefinitions.memory + i;
7 | if (glowObject->nextFreeSlot == -2 && glowObject->entity == entity)
8 | return true;
9 | }
10 | return false;
11 | }
12 |
13 | INT GlowObjectManager_registerGlowObject(struct GlowObjectManager* glowObjectManager, PVOID entity)
14 | {
15 | int index = glowObjectManager->firstFreeSlot;
16 | if (index != -1) {
17 | struct GlowObjectDefinition* glowObject = (struct GlowObjectDefinition*)glowObjectManager->glowObjectDefinitions.memory + index;
18 | glowObjectManager->firstFreeSlot = glowObject->nextFreeSlot;
19 | glowObject->entity = entity;
20 | glowObject->fullBloomRender = false;
21 | glowObject->fullBloomStencilTestValue = 0;
22 | glowObject->splitScreenSlot = -1;
23 | glowObject->nextFreeSlot = -2;
24 | }
25 | return index;
26 | }
27 |
28 | VOID GlowObjectManager_unregisterGlowObject(struct GlowObjectManager* glowObjectManager, INT index)
29 | {
30 | struct GlowObjectDefinition* glowObject = (struct GlowObjectDefinition*)glowObjectManager->glowObjectDefinitions.memory + index;
31 | glowObject->nextFreeSlot = glowObjectManager->firstFreeSlot;
32 | glowObject->entity = NULL;
33 | glowObject->renderWhenOccluded = false;
34 | glowObject->renderWhenUnoccluded = false;
35 | glowObjectManager->firstFreeSlot = index;
36 | }
37 |
--------------------------------------------------------------------------------
/Anubis/SDK/GlowObjectDefinition.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | #include "UtlVector.h"
7 | #include "Vector.h"
8 |
9 | struct GlowObjectDefinition {
10 | int nextFreeSlot;
11 | PVOID entity;
12 | struct Vector glowColor;
13 | float alpha;
14 | BYTE pad[4];
15 | float m_flSomeFloat;
16 | float bloomAmount;
17 | float m_flAnotherFloat;
18 | bool renderWhenOccluded;
19 | bool renderWhenUnoccluded;
20 | bool fullBloomRender;
21 | BYTE pad1;
22 | int fullBloomStencilTestValue;
23 | int glowStyle;
24 | int splitScreenSlot;
25 | };
26 |
27 | struct GlowObjectManager {
28 | struct UtlVector glowObjectDefinitions;
29 | INT firstFreeSlot;
30 | };
31 |
32 | bool GlowObjectManager_hasGlowEffect(struct GlowObjectManager*, PVOID);
33 | INT GlowObjectManager_registerGlowObject(struct GlowObjectManager*, PVOID);
34 | VOID GlowObjectManager_unregisterGlowObject(struct GlowObjectManager*, INT);
35 |
--------------------------------------------------------------------------------
/Anubis/SDK/ItemDefinitionIndex.c:
--------------------------------------------------------------------------------
1 | #include "ItemDefinitionIndex.h"
2 |
3 | INT getWeaponIndex(ItemDefinitionIndex itemDefinitionIndex)
4 | {
5 | switch (itemDefinitionIndex) {
6 | default: return 0;
7 |
8 | case ItemDefinitionIndex_Glock: return 1;
9 | case ItemDefinitionIndex_Hkp2000: return 2;
10 | case ItemDefinitionIndex_Usp_s: return 3;
11 | case ItemDefinitionIndex_Elite: return 4;
12 | case ItemDefinitionIndex_P250: return 5;
13 | case ItemDefinitionIndex_Tec9: return 6;
14 | case ItemDefinitionIndex_Fiveseven: return 7;
15 | case ItemDefinitionIndex_Cz75a: return 8;
16 | case ItemDefinitionIndex_Deagle: return 9;
17 | case ItemDefinitionIndex_Revolver: return 10;
18 |
19 | case ItemDefinitionIndex_Nova: return 11;
20 | case ItemDefinitionIndex_Xm1014: return 12;
21 | case ItemDefinitionIndex_Sawedoff: return 13;
22 | case ItemDefinitionIndex_Mag7: return 14;
23 | case ItemDefinitionIndex_M249: return 15;
24 | case ItemDefinitionIndex_Negev: return 16;
25 |
26 | case ItemDefinitionIndex_Mac10: return 17;
27 | case ItemDefinitionIndex_Mp9: return 18;
28 | case ItemDefinitionIndex_Mp7: return 19;
29 | case ItemDefinitionIndex_Mp5sd: return 20;
30 | case ItemDefinitionIndex_Ump45: return 21;
31 | case ItemDefinitionIndex_P90: return 22;
32 | case ItemDefinitionIndex_Bizon: return 23;
33 |
34 | case ItemDefinitionIndex_GalilAr: return 24;
35 | case ItemDefinitionIndex_Famas: return 25;
36 | case ItemDefinitionIndex_Ak47: return 26;
37 | case ItemDefinitionIndex_M4A1: return 27;
38 | case ItemDefinitionIndex_M4a1_s: return 28;
39 | case ItemDefinitionIndex_Ssg08: return 29;
40 | case ItemDefinitionIndex_Sg553: return 30;
41 | case ItemDefinitionIndex_Aug: return 31;
42 | case ItemDefinitionIndex_Awp: return 32;
43 | case ItemDefinitionIndex_G3SG1: return 33;
44 | case ItemDefinitionIndex_Scar20: return 34;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/Anubis/SDK/ItemDefinitionIndex.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | enum ItemDefinitionIndex {
6 | ItemDefinitionIndex_Deagle = 1,
7 | ItemDefinitionIndex_Elite,
8 | ItemDefinitionIndex_Fiveseven,
9 | ItemDefinitionIndex_Glock,
10 | ItemDefinitionIndex_Ak47 = 7,
11 | ItemDefinitionIndex_Aug,
12 | ItemDefinitionIndex_Awp,
13 | ItemDefinitionIndex_Famas,
14 | ItemDefinitionIndex_G3SG1,
15 | ItemDefinitionIndex_GalilAr = 13,
16 | ItemDefinitionIndex_M249,
17 | ItemDefinitionIndex_M4A1 = 16,
18 | ItemDefinitionIndex_Mac10,
19 | ItemDefinitionIndex_P90 = 19,
20 | ItemDefinitionIndex_Mp5sd = 23,
21 | ItemDefinitionIndex_Ump45,
22 | ItemDefinitionIndex_Xm1014,
23 | ItemDefinitionIndex_Bizon,
24 | ItemDefinitionIndex_Mag7,
25 | ItemDefinitionIndex_Negev,
26 | ItemDefinitionIndex_Sawedoff,
27 | ItemDefinitionIndex_Tec9,
28 | ItemDefinitionIndex_Taser,
29 | ItemDefinitionIndex_Hkp2000,
30 | ItemDefinitionIndex_Mp7,
31 | ItemDefinitionIndex_Mp9,
32 | ItemDefinitionIndex_Nova,
33 | ItemDefinitionIndex_P250,
34 | ItemDefinitionIndex_Scar20 = 38,
35 | ItemDefinitionIndex_Sg553,
36 | ItemDefinitionIndex_Ssg08,
37 | ItemDefinitionIndex_GoldenKnife,
38 | ItemDefinitionIndex_M4a1_s = 60,
39 | ItemDefinitionIndex_Usp_s,
40 | ItemDefinitionIndex_Cz75a = 63,
41 | ItemDefinitionIndex_Revolver,
42 | ItemDefinitionIndex_GhostKnife = 80,
43 | ItemDefinitionIndex_Bayonet = 500,
44 | ItemDefinitionIndex_Flip = 505,
45 | ItemDefinitionIndex_Gut,
46 | ItemDefinitionIndex_Karambit,
47 | ItemDefinitionIndex_M9Bayonet,
48 | ItemDefinitionIndex_Huntsman,
49 | ItemDefinitionIndex_Falchion = 512,
50 | ItemDefinitionIndex_Bowie = 514,
51 | ItemDefinitionIndex_Butterfly,
52 | ItemDefinitionIndex_Daggers,
53 | ItemDefinitionIndex_Ursus = 519,
54 | ItemDefinitionIndex_Navaja,
55 | ItemDefinitionIndex_Stiletto = 522,
56 | ItemDefinitionIndex_Talon,
57 | ItemDefinitionIndex_GloveStuddedBloodhound = 5027,
58 | ItemDefinitionIndex_GloveT,
59 | ItemDefinitionIndex_GloveCT,
60 | ItemDefinitionIndex_GloveSporty,
61 | ItemDefinitionIndex_GloveSlick,
62 | ItemDefinitionIndex_GloveLeatherWrap,
63 | ItemDefinitionIndex_GloveMotorcycle,
64 | ItemDefinitionIndex_GloveSpecialist,
65 | ItemDefinitionIndex_GloveHydra
66 | };
67 |
68 | typedef enum ItemDefinitionIndex ItemDefinitionIndex;
69 | INT getWeaponIndex(ItemDefinitionIndex);
70 |
--------------------------------------------------------------------------------
/Anubis/SDK/Localize.c:
--------------------------------------------------------------------------------
1 | #include "../Interfaces.h"
2 | #include "Localize.h"
3 |
4 | PCWSTR Localize_find(PCSTR tokenName)
5 | {
6 | return CALL_VIRTUAL_METHOD(PCWSTR(__fastcall*)(PVOID, PVOID, PCSTR), Interfaces()->localize, 12, tokenName);
7 | }
8 |
--------------------------------------------------------------------------------
/Anubis/SDK/Localize.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "Utils.h"
4 |
5 | PCWSTR Localize_find(PCSTR);
6 |
--------------------------------------------------------------------------------
/Anubis/SDK/Matrix3x4.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | struct Matrix3x4 {
6 | FLOAT m[3][4];
7 | };
8 |
--------------------------------------------------------------------------------
/Anubis/SDK/Panel.c:
--------------------------------------------------------------------------------
1 | #include "../Interfaces.h"
2 | #include "Panel.h"
3 |
4 | PCSTR Panel_getName(UINT panel)
5 | {
6 | return CALL_VIRTUAL_METHOD(PCSTR(__fastcall*)(PVOID, PVOID, UINT), Interfaces()->panel, 36, panel);
7 | }
8 |
--------------------------------------------------------------------------------
/Anubis/SDK/Panel.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include "Utils.h"
5 |
6 | PCSTR Panel_getName(UINT);
7 |
--------------------------------------------------------------------------------
/Anubis/SDK/Recv.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include "Vector.h"
5 |
6 | typedef struct RecvProxyData {
7 | INT pad;
8 | union {
9 | FLOAT _float;
10 | INT _int;
11 | PSTR _string;
12 | PVOID data;
13 | struct Vector vector;
14 | INT64 int64;
15 | } value;
16 | } RecvProxyData;
17 |
18 | typedef struct RecvProp {
19 | PSTR name;
20 | INT type;
21 | INT flags;
22 | INT stringBufferSize;
23 | INT insideArray;
24 | LPCVOID extraData;
25 | struct RecvProp* arrayProp;
26 | PVOID arrayLengthProxy;
27 | VOID(*proxy)(RecvProxyData*, PVOID, PVOID);
28 | PVOID dataTableProxy;
29 | struct RecvTable* dataTable;
30 | INT offset;
31 | INT elementStride;
32 | INT elementCount;
33 | PCSTR parentArrayPropName;
34 | } RecvProp;
35 |
36 | typedef struct RecvTable {
37 | RecvProp* props;
38 | INT propCount;
39 | PVOID decoder;
40 | PSTR netTableName;
41 | bool isInitialized;
42 | bool isInMainList;
43 | } RecvTable;
44 |
--------------------------------------------------------------------------------
/Anubis/SDK/Surface.c:
--------------------------------------------------------------------------------
1 | #include "../Interfaces.h"
2 | #include "Surface.h"
3 | #include "Utils.h"
4 |
5 | VOID Surface_setDrawColor(INT r, INT g, INT b, INT a)
6 | {
7 | CALL_VIRTUAL_METHOD(VOID(__fastcall*)(PVOID, PVOID, INT, INT, INT, INT), Interfaces()->surface, 15, r, g, b, a);
8 | }
9 |
10 | VOID Surface_setDrawColor2(FLOAT color[3], INT a)
11 | {
12 | CALL_VIRTUAL_METHOD(VOID(__fastcall*)(PVOID, PVOID, INT, INT, INT, INT), Interfaces()->surface, 15, (INT)(color[0] * 255), (INT)(color[1] * 255), (INT)(color[2] * 255), a);
13 | }
14 |
15 | VOID Surface_drawOutlinedRect(FLOAT x0, FLOAT y0, FLOAT x1, FLOAT y1)
16 | {
17 | CALL_VIRTUAL_METHOD(VOID(__fastcall*)(PVOID, PVOID, INT, INT, INT, INT), Interfaces()->surface, 18, (INT)x0, (INT)y0, (INT)x1, (INT)y1);
18 | }
19 |
20 | VOID Surface_drawLine(FLOAT x0, FLOAT y0, FLOAT x1, FLOAT y1)
21 | {
22 | CALL_VIRTUAL_METHOD(VOID(__fastcall*)(PVOID, PVOID, INT, INT, INT, INT), Interfaces()->surface, 19, (INT)x0, (INT)y0, (INT)x1, (INT)y1);
23 | }
24 |
25 | VOID Surface_setTextFont(UINT font)
26 | {
27 | CALL_VIRTUAL_METHOD(VOID(__fastcall*)(PVOID, PVOID, UINT), Interfaces()->surface, 23, font);
28 | }
29 |
30 | VOID Surface_setTextColor(FLOAT color[3], INT a)
31 | {
32 | CALL_VIRTUAL_METHOD(VOID(__fastcall*)(PVOID, PVOID, INT, INT, INT, INT), Interfaces()->surface, 25, (INT)(color[0] * 255), (INT)(color[1] * 255), (INT)(color[2] * 255), a);
33 | }
34 |
35 | VOID Surface_setTextPosition(FLOAT x, FLOAT y)
36 | {
37 | CALL_VIRTUAL_METHOD(VOID(__fastcall*)(PVOID, PVOID, INT, INT), Interfaces()->surface, 26, (INT)x, (INT)y);
38 | }
39 |
40 | VOID Surface_printText(PCWSTR text)
41 | {
42 | CALL_VIRTUAL_METHOD(VOID(__fastcall*)(PVOID, PVOID, PCWSTR, INT, INT), Interfaces()->surface, 28, text, wcslen(text), 0);
43 | }
44 |
45 | VOID Surface_getScreenSize(INT* width, INT* height)
46 | {
47 | CALL_VIRTUAL_METHOD(VOID(__fastcall*)(PVOID, PVOID, INT*, INT*), Interfaces()->surface, 44, width, height);
48 | }
49 |
50 | VOID Surface_unlockCursor(VOID)
51 | {
52 | CALL_VIRTUAL_METHOD(VOID(__fastcall*)(PVOID, PVOID), Interfaces()->surface, 66);
53 | }
54 |
55 | VOID Surface_getTextSize(UINT font, PCWSTR text, INT* width, INT* height)
56 | {
57 | CALL_VIRTUAL_METHOD(VOID(__fastcall*)(PVOID, PVOID, UINT, PCWSTR, INT*, INT*), Interfaces()->surface, 79, font, text, width, height);
58 | }
59 |
--------------------------------------------------------------------------------
/Anubis/SDK/Surface.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | VOID Surface_setDrawColor(INT, INT, INT, INT);
6 | VOID Surface_setDrawColor2(FLOAT[3], INT);
7 | VOID Surface_drawOutlinedRect(FLOAT, FLOAT, FLOAT, FLOAT);
8 | VOID Surface_drawLine(FLOAT, FLOAT, FLOAT, FLOAT);
9 | VOID Surface_setTextFont(UINT);
10 | VOID Surface_setTextColor(FLOAT[3], INT);
11 | VOID Surface_setTextPosition(FLOAT, FLOAT);
12 | VOID Surface_printText(PCWSTR);
13 | VOID Surface_getScreenSize(INT*, INT*);
14 | VOID Surface_unlockCursor(VOID);
15 | VOID Surface_getTextSize(UINT, PCWSTR, INT*, INT*);
16 |
--------------------------------------------------------------------------------
/Anubis/SDK/UserCmd.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | #include "Vector.h"
7 |
8 | enum UserCmdButtons {
9 | IN_ATTACK = 1 << 0,
10 | IN_JUMP = 1 << 1,
11 | IN_DUCK = 1 << 2,
12 | IN_FORWARD = 1 << 3,
13 | IN_BACK = 1 << 4,
14 | IN_USE = 1 << 5,
15 | IN_MOVELEFT = 1 << 9,
16 | IN_MOVERIGHT = 1 << 10,
17 | IN_ATTACK2 = 1 << 11,
18 | IN_SCORE = 1 << 16,
19 | IN_BULLRUSH = 1 << 22
20 | };
21 |
22 | struct UserCmd {
23 | INT pad;
24 | INT commandNumber;
25 | INT tickCount;
26 | struct Vector viewangles;
27 | struct Vector aimdirection;
28 | FLOAT forwardmove;
29 | FLOAT sidemove;
30 | FLOAT upmove;
31 | enum UserCmdButtons buttons;
32 | BYTE impulse;
33 | INT weaponselect;
34 | INT weaponsubtype;
35 | INT randomSeed;
36 | SHORT mousedx;
37 | SHORT mousedy;
38 | bool hasbeenpredicted;
39 | };
40 |
--------------------------------------------------------------------------------
/Anubis/SDK/Utils.c:
--------------------------------------------------------------------------------
1 | #include "Utils.h"
2 |
3 | UINT Utils_hashRuntime(PCSTR str)
4 | {
5 | UINT hash = 0;
6 | for (SIZE_T i = 0; i < strlen(str); i++)
7 | hash = 65599 * hash + str[i];
8 | return hash ^ (hash >> 16);
9 | }
10 |
--------------------------------------------------------------------------------
/Anubis/SDK/Utils.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #define _USE_MATH_DEFINES
4 | #include
5 | #include
6 |
7 | #define CALL_VIRTUAL_METHOD(type, this, index, ...) (((type)(((PUINT*)(this))[0][index]))(this, 0, __VA_ARGS__));
8 | #define CALL_ORIGINAL(type, this, vmt, index, ...) (((type)((vmt)[index]))(this, 0, __VA_ARGS__));
9 |
10 | #define UTILS_HASH_1(s, i, val) (val * 65599u + ((i) < strlen(s) ? s[strlen(s) - 1- (i)] : 0))
11 | #define UTILS_HASH_4(s, i, val) UTILS_HASH_1(s, i, UTILS_HASH_1(s, i + 1, UTILS_HASH_1(s, i + 2, UTILS_HASH_1(s, i + 3, val))))
12 | #define UTILS_HASH_16(s, i, val) UTILS_HASH_4(s, i, UTILS_HASH_4(s, i + 4, UTILS_HASH_4(s, i + 8, UTILS_HASH_4(s, i + 12, val))))
13 | #define UTILS_HASH_64(s, i, val) UTILS_HASH_16(s, i, UTILS_HASH_16(s, i + 16, UTILS_HASH_16(s, i + 32, UTILS_HASH_16(s, i + 48, val))))
14 | #define UTILS_HASH_256(s, i, val) UTILS_HASH_64(s, i, UTILS_HASH_64(s, i + 64, UTILS_HASH_64(s, i + 128, UTILS_HASH_64(s, i + 192, val))))
15 |
16 | #define UTILS_HASH(s) ((UINT)(UTILS_HASH_256(s, 0, 0) ^ UTILS_HASH_256(s, 0, 0) >> 16))
17 |
18 | UINT Utils_hashRuntime(PCSTR);
19 |
20 | #define DEG2RAD(x) ((FLOAT)(x) * (FLOAT)M_PI / 180.0f)
21 | #define RAD2DEG(x) ((FLOAT)(x) * 180.0f / (FLOAT)M_PI)
22 |
23 | #define UTILS_STATIC_VAR(type, name, initializer) static type name = 0; if (!name) name = initializer;
--------------------------------------------------------------------------------
/Anubis/SDK/UtlVector.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | struct UtlVector {
6 | PINT memory;
7 | INT allocationCount;
8 | INT growSize;
9 | INT size;
10 | PVOID elements;
11 | };
12 |
--------------------------------------------------------------------------------
/Anubis/SDK/Vector.c:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "Matrix3x4.h"
4 | #include "Vector.h"
5 |
6 | VOID Angles_normalize(struct Vector* vec)
7 | {
8 | vec->x = isfinite(vec->x) ? remainderf(vec->x, 360.0f) : 0.0f;
9 | vec->y = isfinite(vec->y) ? remainderf(vec->y, 360.0f) : 0.0f;
10 | vec->z = 0.0f;
11 | }
12 |
13 | struct Vector Vector_multiply(CONST struct Vector* v1, CONST struct Vector* v2)
14 | {
15 | struct Vector result = { v1->x * v2->x, v1->y * v2->y, v1->z * v2->z };
16 | return result;
17 | }
18 |
19 | struct Vector Vector_add(CONST struct Vector* v1, CONST struct Vector* v2)
20 | {
21 | struct Vector result = { v1->x + v2->x, v1->y + v2->y, v1->z + v2->z };
22 | return result;
23 | }
24 |
25 | FLOAT Vector_dotProduct(CONST struct Vector* v1, CONST struct Vector* v2)
26 | {
27 | return v1->x * v2->x + v1->y * v2->y + v1->z * v2->z;
28 | }
29 |
30 | struct Vector Vector_transform(CONST struct Vector* vec, CONST struct Matrix3x4* mat)
31 | {
32 | struct Vector x = { mat->m[0][0], mat->m[0][1], mat->m[0][2] },
33 | y = { mat->m[1][0], mat->m[1][1], mat->m[1][2] },
34 | z = { mat->m[2][0], mat->m[2][1], mat->m[2][2] };
35 | struct Vector result = { Vector_dotProduct(vec, &x) + mat->m[0][3], Vector_dotProduct(vec, &y) + mat->m[1][3], Vector_dotProduct(vec, &z) + mat->m[2][3] };
36 | return result;
37 | }
38 |
--------------------------------------------------------------------------------
/Anubis/SDK/Vector.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | struct Matrix3x4;
6 |
7 | struct Vector {
8 | FLOAT x, y, z;
9 | };
10 |
11 | VOID Angles_normalize(struct Vector*);
12 |
13 | struct Vector Vector_multiply(CONST struct Vector*, CONST struct Vector*);
14 | struct Vector Vector_add(CONST struct Vector*, CONST struct Vector*);
15 | FLOAT Vector_dotProduct(CONST struct Vector*, CONST struct Vector*);
16 | struct Vector Vector_transform(CONST struct Vector*, CONST struct Matrix3x4*);
17 |
--------------------------------------------------------------------------------
/Anubis/SDK/WeaponData.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | struct WeaponData {
6 | BYTE pad[20];
7 | INT maxClip;
8 | BYTE pad1[112];
9 | PSTR name;
10 | BYTE pad1_[60];
11 | INT type;
12 | BYTE pad2[32];
13 | BOOLEAN fullAuto;
14 | BYTE pad3[3];
15 | INT damage;
16 | FLOAT armorRatio;
17 | INT bullets;
18 | FLOAT penetration;
19 | BYTE pad4[8];
20 | FLOAT range;
21 | FLOAT rangeModifier;
22 | BYTE pad5[16];
23 | BOOLEAN hasSilencer;
24 | };
25 |
--------------------------------------------------------------------------------
/Anubis/cJSON/cJSON.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2017 Dave Gamble and cJSON contributors
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 | */
22 |
23 | #ifndef cJSON__h
24 | #define cJSON__h
25 |
26 | #ifdef __cplusplus
27 | extern "C"
28 | {
29 | #endif
30 |
31 | #if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32))
32 | #define __WINDOWS__
33 | #endif
34 |
35 | #ifdef __WINDOWS__
36 |
37 | /* When compiling for windows, we specify a specific calling convention to avoid issues where we are being called from a project with a different default calling convention. For windows you have 3 define options:
38 |
39 | CJSON_HIDE_SYMBOLS - Define this in the case where you don't want to ever dllexport symbols
40 | CJSON_EXPORT_SYMBOLS - Define this on library build when you want to dllexport symbols (default)
41 | CJSON_IMPORT_SYMBOLS - Define this if you want to dllimport symbol
42 |
43 | For *nix builds that support visibility attribute, you can define similar behavior by
44 |
45 | setting default visibility to hidden by adding
46 | -fvisibility=hidden (for gcc)
47 | or
48 | -xldscope=hidden (for sun cc)
49 | to CFLAGS
50 |
51 | then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJSON_EXPORT_SYMBOLS does
52 |
53 | */
54 |
55 | #define CJSON_CDECL __cdecl
56 | #define CJSON_STDCALL __stdcall
57 |
58 | /* export symbols by default, this is necessary for copy pasting the C and header file */
59 | #if !defined(CJSON_HIDE_SYMBOLS) && !defined(CJSON_IMPORT_SYMBOLS) && !defined(CJSON_EXPORT_SYMBOLS)
60 | #define CJSON_EXPORT_SYMBOLS
61 | #endif
62 |
63 | #if defined(CJSON_HIDE_SYMBOLS)
64 | #define CJSON_PUBLIC(type) type CJSON_STDCALL
65 | #elif defined(CJSON_EXPORT_SYMBOLS)
66 | #define CJSON_PUBLIC(type) __declspec(dllexport) type CJSON_STDCALL
67 | #elif defined(CJSON_IMPORT_SYMBOLS)
68 | #define CJSON_PUBLIC(type) __declspec(dllimport) type CJSON_STDCALL
69 | #endif
70 | #else /* !__WINDOWS__ */
71 | #define CJSON_CDECL
72 | #define CJSON_STDCALL
73 |
74 | #if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(CJSON_API_VISIBILITY)
75 | #define CJSON_PUBLIC(type) __attribute__((visibility("default"))) type
76 | #else
77 | #define CJSON_PUBLIC(type) type
78 | #endif
79 | #endif
80 |
81 | /* project version */
82 | #define CJSON_VERSION_MAJOR 1
83 | #define CJSON_VERSION_MINOR 7
84 | #define CJSON_VERSION_PATCH 12
85 |
86 | #include
87 |
88 | /* cJSON Types: */
89 | #define cJSON_Invalid (0)
90 | #define cJSON_False (1 << 0)
91 | #define cJSON_True (1 << 1)
92 | #define cJSON_NULL (1 << 2)
93 | #define cJSON_Number (1 << 3)
94 | #define cJSON_String (1 << 4)
95 | #define cJSON_Array (1 << 5)
96 | #define cJSON_Object (1 << 6)
97 | #define cJSON_Raw (1 << 7) /* raw json */
98 |
99 | #define cJSON_IsReference 256
100 | #define cJSON_StringIsConst 512
101 |
102 | /* The cJSON structure: */
103 | typedef struct cJSON
104 | {
105 | /* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */
106 | struct cJSON *next;
107 | struct cJSON *prev;
108 | /* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */
109 | struct cJSON *child;
110 |
111 | /* The type of the item, as above. */
112 | int type;
113 |
114 | /* The item's string, if type==cJSON_String and type == cJSON_Raw */
115 | char *valuestring;
116 | /* writing to valueint is DEPRECATED, use cJSON_SetNumberValue instead */
117 | int valueint;
118 | /* The item's number, if type==cJSON_Number */
119 | double valuedouble;
120 |
121 | /* The item's name string, if this item is the child of, or is in the list of subitems of an object. */
122 | char *string;
123 | } cJSON;
124 |
125 | typedef struct cJSON_Hooks
126 | {
127 | /* malloc/free are CDECL on Windows regardless of the default calling convention of the compiler, so ensure the hooks allow passing those functions directly. */
128 | void *(CJSON_CDECL *malloc_fn)(size_t sz);
129 | void (CJSON_CDECL *free_fn)(void *ptr);
130 | } cJSON_Hooks;
131 |
132 | typedef int cJSON_bool;
133 |
134 | /* Limits how deeply nested arrays/objects can be before cJSON rejects to parse them.
135 | * This is to prevent stack overflows. */
136 | #ifndef CJSON_NESTING_LIMIT
137 | #define CJSON_NESTING_LIMIT 1000
138 | #endif
139 |
140 | /* returns the version of cJSON as a string */
141 | CJSON_PUBLIC(const char*) cJSON_Version(void);
142 |
143 | /* Supply malloc, realloc and free functions to cJSON */
144 | CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks* hooks);
145 |
146 | /* Memory Management: the caller is always responsible to free the results from all variants of cJSON_Parse (with cJSON_Delete) and cJSON_Print (with stdlib free, cJSON_Hooks.free_fn, or cJSON_free as appropriate). The exception is cJSON_PrintPreallocated, where the caller has full responsibility of the buffer. */
147 | /* Supply a block of JSON, and this returns a cJSON object you can interrogate. */
148 | CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value);
149 | /* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */
150 | /* If you supply a ptr in return_parse_end and parsing fails, then return_parse_end will contain a pointer to the error so will match cJSON_GetErrorPtr(). */
151 | CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated);
152 |
153 | /* Render a cJSON entity to text for transfer/storage. */
154 | CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item);
155 | /* Render a cJSON entity to text for transfer/storage without any formatting. */
156 | CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item);
157 | /* Render a cJSON entity to text using a buffered strategy. prebuffer is a guess at the final size. guessing well reduces reallocation. fmt=0 gives unformatted, =1 gives formatted */
158 | CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt);
159 | /* Render a cJSON entity to text using a buffer already allocated in memory with given length. Returns 1 on success and 0 on failure. */
160 | /* NOTE: cJSON is not always 100% accurate in estimating how much memory it will use, so to be safe allocate 5 bytes more than you actually need */
161 | CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format);
162 | /* Delete a cJSON entity and all subentities. */
163 | CJSON_PUBLIC(void) cJSON_Delete(cJSON *c);
164 |
165 | /* Returns the number of items in an array (or object). */
166 | CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array);
167 | /* Retrieve item number "index" from array "array". Returns NULL if unsuccessful. */
168 | CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int index);
169 | /* Get item "string" from object. Case insensitive. */
170 | CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string);
171 | CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string);
172 | CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *string);
173 | /* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */
174 | CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void);
175 |
176 | /* Check if the item is a string and return its valuestring */
177 | CJSON_PUBLIC(char *) cJSON_GetStringValue(cJSON *item);
178 |
179 | /* These functions check the type of an item */
180 | CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item);
181 | CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(const cJSON * const item);
182 | CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(const cJSON * const item);
183 | CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(const cJSON * const item);
184 | CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(const cJSON * const item);
185 | CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(const cJSON * const item);
186 | CJSON_PUBLIC(cJSON_bool) cJSON_IsString(const cJSON * const item);
187 | CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(const cJSON * const item);
188 | CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(const cJSON * const item);
189 | CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON * const item);
190 |
191 | /* These calls create a cJSON item of the appropriate type. */
192 | CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void);
193 | CJSON_PUBLIC(cJSON *) cJSON_CreateTrue(void);
194 | CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(void);
195 | CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool boolean);
196 | CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num);
197 | CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string);
198 | /* raw json */
199 | CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw);
200 | CJSON_PUBLIC(cJSON *) cJSON_CreateArray(void);
201 | CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void);
202 |
203 | /* Create a string where valuestring references a string so
204 | * it will not be freed by cJSON_Delete */
205 | CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string);
206 | /* Create an object/arrray that only references it's elements so
207 | * they will not be freed by cJSON_Delete */
208 | CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON *child);
209 | CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child);
210 |
211 | /* These utilities create an Array of count items. */
212 | CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count);
213 | CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count);
214 | CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count);
215 | CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char **strings, int count);
216 |
217 | /* Append item to the specified array/object. */
218 | CJSON_PUBLIC(void) cJSON_AddItemToArray(cJSON *array, cJSON *item);
219 | CJSON_PUBLIC(void) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item);
220 | /* Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object.
221 | * WARNING: When this function was used, make sure to always check that (item->type & cJSON_StringIsConst) is zero before
222 | * writing to `item->string` */
223 | CJSON_PUBLIC(void) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item);
224 | /* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */
225 | CJSON_PUBLIC(void) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item);
226 | CJSON_PUBLIC(void) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item);
227 |
228 | /* Remove/Detatch items from Arrays/Objects. */
229 | CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item);
230 | CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array, int which);
231 | CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON *array, int which);
232 | CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON *object, const char *string);
233 | CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string);
234 | CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string);
235 | CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string);
236 |
237 | /* Update array items. */
238 | CJSON_PUBLIC(void) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */
239 | CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement);
240 | CJSON_PUBLIC(void) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem);
241 | CJSON_PUBLIC(void) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem);
242 | CJSON_PUBLIC(void) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem);
243 |
244 | /* Duplicate a cJSON item */
245 | CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse);
246 | /* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will
247 | need to be released. With recurse!=0, it will duplicate any children connected to the item.
248 | The item->next and ->prev pointers are always zero on return from Duplicate. */
249 | /* Recursively compare two cJSON items for equality. If either a or b is NULL or invalid, they will be considered unequal.
250 | * case_sensitive determines if object keys are treated case sensitive (1) or case insensitive (0) */
251 | CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive);
252 |
253 |
254 | CJSON_PUBLIC(void) cJSON_Minify(char *json);
255 |
256 | /* Helper functions for creating and adding items to an object at the same time.
257 | * They return the added item or NULL on failure. */
258 | CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name);
259 | CJSON_PUBLIC(cJSON*) cJSON_AddTrueToObject(cJSON * const object, const char * const name);
260 | CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * const object, const char * const name);
261 | CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_bool boolean);
262 | CJSON_PUBLIC(cJSON*) cJSON_AddNumberToObject(cJSON * const object, const char * const name, const double number);
263 | CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * const object, const char * const name, const char * const string);
264 | CJSON_PUBLIC(cJSON*) cJSON_AddRawToObject(cJSON * const object, const char * const name, const char * const raw);
265 | CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * const object, const char * const name);
266 | CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * const name);
267 |
268 | /* When assigning an integer value, it needs to be propagated to valuedouble too. */
269 | #define cJSON_SetIntValue(object, number) ((object) ? (object)->valueint = (object)->valuedouble = (number) : (number))
270 | /* helper for the cJSON_SetNumberValue macro */
271 | CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number);
272 | #define cJSON_SetNumberValue(object, number) ((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number))
273 |
274 | /* Macro for iterating over an array or object */
275 | #define cJSON_ArrayForEach(element, array) for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next)
276 |
277 | /* malloc/free objects using the malloc/free functions that have been set with cJSON_InitHooks */
278 | CJSON_PUBLIC(void *) cJSON_malloc(size_t size);
279 | CJSON_PUBLIC(void) cJSON_free(void *object);
280 |
281 | #ifdef __cplusplus
282 | }
283 | #endif
284 |
285 | #endif
286 |
--------------------------------------------------------------------------------
/Anubis/dllmain.c:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "Config.h"
4 | #include "Hooks.h"
5 | #include "Interfaces.h"
6 | #include "Memory.h"
7 | #include "Netvars.h"
8 |
9 | BOOL APIENTRY DllMain(HMODULE hModule,
10 | DWORD ul_reason_for_call,
11 | LPVOID lpReserved)
12 | {
13 | if (ul_reason_for_call == DLL_PROCESS_ATTACH) {
14 | Config_init();
15 | Interfaces_init();
16 | Memory_init();
17 | Hooks_init();
18 | }
19 | return TRUE;
20 | }
21 |
--------------------------------------------------------------------------------
/Anubis/imgui/LICENSE.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014-2019 Omar Cornut
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 |
--------------------------------------------------------------------------------
/Anubis/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 names. 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_DISABLE_OSX_FUNCTIONS // [OSX] Won't use and link with any OSX function (clipboard).
38 | //#define IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS // Don't implement ImFormatString/ImFormatStringV so you can implement them yourself if you don't want to link with vsnprintf.
39 | //#define IMGUI_DISABLE_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 wrapper so you can implement them yourself. Declare your prototypes in imconfig.h.
40 | //#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().
41 |
42 | //---- Include imgui_user.h at the end of imgui.h as a convenience
43 | //#define IMGUI_INCLUDE_IMGUI_USER_H
44 |
45 | //---- Pack colors to BGRA8 instead of RGBA8 (to avoid converting from one to another)
46 | //#define IMGUI_USE_BGRA_PACKED_COLOR
47 |
48 | //---- Avoid multiple STB libraries implementations, or redefine path/filenames to prioritize another version
49 | // By default the embedded implementations are declared static and not available outside of imgui cpp files.
50 | //#define IMGUI_STB_TRUETYPE_FILENAME "my_folder/stb_truetype.h"
51 | //#define IMGUI_STB_RECT_PACK_FILENAME "my_folder/stb_rect_pack.h"
52 | //#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION
53 | //#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION
54 |
55 | //---- Define constructor and implicit cast operators to convert back<>forth between your math types and ImVec2/ImVec4.
56 | // This will be inlined as part of ImVec2 and ImVec4 class declarations.
57 | /*
58 | #define IM_VEC2_CLASS_EXTRA \
59 | ImVec2(const MyVec2& f) { x = f.x; y = f.y; } \
60 | operator MyVec2() const { return MyVec2(x,y); }
61 | */
62 | #define IM_VEC4_CLASS_EXTRA explicit ImVec4(float f[3]) noexcept { x = f[0]; y = f[1]; z = f[2]; w = 0.0f; }
63 |
64 | //---- Using 32-bits vertex indices (default is 16-bits) is one way to allow large meshes with more than 64K vertices.
65 | // Your renderer back-end will need to support it (most example renderer back-ends support both 16/32-bits indices).
66 | // Another way to allow large meshes while keeping 16-bits indices is to handle ImDrawCmd::VtxOffset in your renderer.
67 | // Read about ImGuiBackendFlags_RendererHasVtxOffset for details.
68 | //#define ImDrawIdx unsigned int
69 |
70 | //---- Override ImDrawCallback signature (will need to modify renderer back-ends accordingly)
71 | //struct ImDrawList;
72 | //struct ImDrawCmd;
73 | //typedef void (*MyImDrawCallback)(const ImDrawList* draw_list, const ImDrawCmd* cmd, void* my_renderer_user_data);
74 | //#define ImDrawCallback MyImDrawCallback
75 |
76 | //---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files.
77 | /*
78 | namespace ImGui
79 | {
80 | void MyFunction(const char* name, const MyMatrix44& v);
81 | }
82 | */
83 |
--------------------------------------------------------------------------------
/Anubis/imgui/imgui_impl_dx9.c:
--------------------------------------------------------------------------------
1 | // dear imgui: Renderer for DirectX9
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 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
6 | // [X] Renderer: Support for large meshes (64k+ vertices) with 16-bits 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 | // CHANGELOG
13 | // (minor and older changes stripped away, please see git history for details)
14 | // 2019-05-29: DirectX9: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag.
15 | // 2019-04-30: DirectX9: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
16 | // 2019-03-29: Misc: Fixed erroneous assert in ImGui_ImplDX9_InvalidateDeviceObjects().
17 | // 2019-01-16: Misc: Disabled fog before drawing UI's. Fixes issue #2288.
18 | // 2018-11-30: Misc: Setting up io.BackendRendererName so it can be displayed in the About Window.
19 | // 2018-06-08: Misc: Extracted imgui_impl_dx9.cpp/.h away from the old combined DX9+Win32 example.
20 | // 2018-06-08: DirectX9: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle.
21 | // 2018-05-07: Render: Saving/restoring Transform because they don't seem to be included in the StateBlock. Setting shading mode to Gouraud.
22 | // 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplDX9_RenderDrawData() in the .h file so you can call it yourself.
23 | // 2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves.
24 |
25 | #define CIMGUI_DEFINE_ENUMS_AND_STRUCTS
26 | #include "cimgui.h"
27 | #include "imgui_impl_dx9.h"
28 |
29 | // DirectX
30 | #include
31 | #define DIRECTINPUT_VERSION 0x0800
32 | #include
33 |
34 | // DirectX data
35 | static LPDIRECT3DDEVICE9 g_pd3dDevice = NULL;
36 | static LPDIRECT3DVERTEXBUFFER9 g_pVB = NULL;
37 | static LPDIRECT3DINDEXBUFFER9 g_pIB = NULL;
38 | static LPDIRECT3DTEXTURE9 g_FontTexture = NULL;
39 | static int g_VertexBufferSize = 5000, g_IndexBufferSize = 10000;
40 |
41 | struct CUSTOMVERTEX
42 | {
43 | float pos[3];
44 | D3DCOLOR col;
45 | float uv[2];
46 | };
47 | #define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1)
48 |
49 | static void ImGui_ImplDX9_SetupRenderState(ImDrawData* draw_data)
50 | {
51 | // Setup viewport
52 | D3DVIEWPORT9 vp;
53 | vp.X = vp.Y = 0;
54 | vp.Width = (DWORD)draw_data->DisplaySize.x;
55 | vp.Height = (DWORD)draw_data->DisplaySize.y;
56 | vp.MinZ = 0.0f;
57 | vp.MaxZ = 1.0f;
58 |
59 | IDirect3DDevice9_SetViewport(g_pd3dDevice, &vp);
60 |
61 | // Setup render state: fixed-pipeline, alpha-blending, no face culling, no depth testing, shade mode (for gradient)
62 | IDirect3DDevice9_SetPixelShader(g_pd3dDevice, NULL);
63 | IDirect3DDevice9_SetVertexShader(g_pd3dDevice, NULL);
64 | IDirect3DDevice9_SetRenderState(g_pd3dDevice, D3DRS_CULLMODE, D3DCULL_NONE);
65 | IDirect3DDevice9_SetRenderState(g_pd3dDevice, D3DRS_LIGHTING, false);
66 | IDirect3DDevice9_SetRenderState(g_pd3dDevice, D3DRS_ZENABLE, false);
67 | IDirect3DDevice9_SetRenderState(g_pd3dDevice, D3DRS_ALPHABLENDENABLE, true);
68 | IDirect3DDevice9_SetRenderState(g_pd3dDevice, D3DRS_ALPHATESTENABLE, false);
69 | IDirect3DDevice9_SetRenderState(g_pd3dDevice, D3DRS_BLENDOP, D3DBLENDOP_ADD);
70 | IDirect3DDevice9_SetRenderState(g_pd3dDevice, D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
71 | IDirect3DDevice9_SetRenderState(g_pd3dDevice, D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
72 | IDirect3DDevice9_SetRenderState(g_pd3dDevice, D3DRS_SCISSORTESTENABLE, true);
73 | IDirect3DDevice9_SetRenderState(g_pd3dDevice, D3DRS_SHADEMODE, D3DSHADE_GOURAUD);
74 | IDirect3DDevice9_SetRenderState(g_pd3dDevice, D3DRS_FOGENABLE, false);
75 | IDirect3DDevice9_SetTextureStageState(g_pd3dDevice, 0, D3DTSS_COLOROP, D3DTOP_MODULATE);
76 | IDirect3DDevice9_SetTextureStageState(g_pd3dDevice, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
77 | IDirect3DDevice9_SetTextureStageState(g_pd3dDevice, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
78 | IDirect3DDevice9_SetTextureStageState(g_pd3dDevice, 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
79 | IDirect3DDevice9_SetTextureStageState(g_pd3dDevice, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
80 | IDirect3DDevice9_SetTextureStageState(g_pd3dDevice, 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
81 | IDirect3DDevice9_SetSamplerState(g_pd3dDevice, 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
82 | IDirect3DDevice9_SetSamplerState(g_pd3dDevice, 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
83 |
84 | // Setup orthographic projection matrix
85 | // Our visible imgui space lies from draw_data->DisplayPos (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayPos is (0,0) for single viewport apps.
86 | // Being agnostic of whether or can be used, we aren't relying on D3DXMatrixIdentity()/D3DXMatrixOrthoOffCenterLH() or DirectX::XMMatrixIdentity()/DirectX::XMMatrixOrthographicOffCenterLH()
87 | {
88 | float L = draw_data->DisplayPos.x + 0.5f;
89 | float R = draw_data->DisplayPos.x + draw_data->DisplaySize.x + 0.5f;
90 | float T = draw_data->DisplayPos.y + 0.5f;
91 | float B = draw_data->DisplayPos.y + draw_data->DisplaySize.y + 0.5f;
92 | D3DMATRIX mat_identity = { { { 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f } } };
93 | D3DMATRIX mat_projection =
94 | { { {
95 | 2.0f / (R - L), 0.0f, 0.0f, 0.0f,
96 | 0.0f, 2.0f / (T - B), 0.0f, 0.0f,
97 | 0.0f, 0.0f, 0.5f, 0.0f,
98 | (L + R) / (L - R), (T + B) / (B - T), 0.5f, 1.0f
99 | } } };
100 | IDirect3DDevice9_SetTransform(g_pd3dDevice, D3DTS_WORLD, &mat_identity);
101 | IDirect3DDevice9_SetTransform(g_pd3dDevice, D3DTS_VIEW, &mat_identity);
102 | IDirect3DDevice9_SetTransform(g_pd3dDevice, D3DTS_PROJECTION, &mat_projection);
103 | }
104 | }
105 |
106 | // Render function.
107 | // (this used to be set in io.RenderDrawListsFn and called by ImGui::Render(), but you can now call this directly from your main loop)
108 | void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data)
109 | {
110 | // Avoid rendering when minimized
111 | if (draw_data->DisplaySize.x <= 0.0f || draw_data->DisplaySize.y <= 0.0f)
112 | return;
113 |
114 | // Create and grow buffers if needed
115 | if (!g_pVB || g_VertexBufferSize < draw_data->TotalVtxCount)
116 | {
117 | if (g_pVB) { IDirect3DVertexBuffer9_Release(g_pVB); g_pVB = NULL; }
118 | g_VertexBufferSize = draw_data->TotalVtxCount + 5000;
119 | if (IDirect3DDevice9_CreateVertexBuffer(g_pd3dDevice, g_VertexBufferSize * sizeof(struct CUSTOMVERTEX), D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, D3DFVF_CUSTOMVERTEX, D3DPOOL_DEFAULT, &g_pVB, NULL) < 0)
120 | return;
121 | }
122 | if (!g_pIB || g_IndexBufferSize < draw_data->TotalIdxCount)
123 | {
124 | if (g_pIB) { IDirect3DIndexBuffer9_Release(g_pIB); g_pIB = NULL; }
125 | g_IndexBufferSize = draw_data->TotalIdxCount + 10000;
126 | if (IDirect3DDevice9_CreateIndexBuffer(g_pd3dDevice, g_IndexBufferSize * sizeof(ImDrawIdx), D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, sizeof(ImDrawIdx) == 2 ? D3DFMT_INDEX16 : D3DFMT_INDEX32, D3DPOOL_DEFAULT, &g_pIB, NULL) < 0)
127 | return;
128 | }
129 |
130 | // Backup the DX9 state
131 | IDirect3DStateBlock9* d3d9_state_block = NULL;
132 | if (IDirect3DDevice9_CreateStateBlock(g_pd3dDevice, D3DSBT_ALL, &d3d9_state_block) < 0)
133 | return;
134 |
135 | if (IDirect3DStateBlock9_Capture(d3d9_state_block) != D3D_OK)
136 | return;
137 |
138 | // Backup the DX9 transform (DX9 documentation suggests that it is included in the StateBlock but it doesn't appear to)
139 | D3DMATRIX last_world, last_view, last_projection;
140 | IDirect3DDevice9_GetTransform(g_pd3dDevice, D3DTS_WORLD, &last_world);
141 | IDirect3DDevice9_GetTransform(g_pd3dDevice, D3DTS_VIEW, &last_view);
142 | IDirect3DDevice9_GetTransform(g_pd3dDevice, D3DTS_PROJECTION, &last_projection);
143 |
144 | // Copy and convert all vertices into a single contiguous buffer, convert colors to DX9 default format.
145 | // FIXME-OPT: This is a waste of resource, the ideal is to use imconfig.h and
146 | // 1) to avoid repacking colors: #define IMGUI_USE_BGRA_PACKED_COLOR
147 | // 2) to avoid repacking vertices: #define IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT struct ImDrawVert { ImVec2 pos; float z; ImU32 col; ImVec2 uv; }
148 | struct CUSTOMVERTEX* vtx_dst;
149 | ImDrawIdx* idx_dst;
150 | if (IDirect3DVertexBuffer9_Lock(g_pVB, 0, (UINT)(draw_data->TotalVtxCount * sizeof(struct CUSTOMVERTEX)), (void**)& vtx_dst, D3DLOCK_DISCARD) < 0)
151 | return;
152 | if (IDirect3DIndexBuffer9_Lock(g_pIB, 0, (UINT)(draw_data->TotalIdxCount * sizeof(ImDrawIdx)), (void**)& idx_dst, D3DLOCK_DISCARD) < 0)
153 | return;
154 | for (int n = 0; n < draw_data->CmdListsCount; n++)
155 | {
156 | const ImDrawList* cmd_list = draw_data->CmdLists[n];
157 | const ImDrawVert* vtx_src = cmd_list->VtxBuffer.Data;
158 | for (int i = 0; i < cmd_list->VtxBuffer.Size; i++)
159 | {
160 | vtx_dst->pos[0] = vtx_src->pos.x;
161 | vtx_dst->pos[1] = vtx_src->pos.y;
162 | vtx_dst->pos[2] = 0.0f;
163 | vtx_dst->col = (vtx_src->col & 0xFF00FF00) | ((vtx_src->col & 0xFF0000) >> 16) | ((vtx_src->col & 0xFF) << 16); // RGBA --> ARGB for DirectX9
164 | vtx_dst->uv[0] = vtx_src->uv.x;
165 | vtx_dst->uv[1] = vtx_src->uv.y;
166 | vtx_dst++;
167 | vtx_src++;
168 | }
169 | memcpy(idx_dst, cmd_list->IdxBuffer.Data, cmd_list->IdxBuffer.Size * sizeof(ImDrawIdx));
170 | idx_dst += cmd_list->IdxBuffer.Size;
171 | }
172 | IDirect3DVertexBuffer9_Unlock(g_pVB);
173 | IDirect3DIndexBuffer9_Unlock(g_pIB);
174 | IDirect3DDevice9_SetStreamSource(g_pd3dDevice, 0, g_pVB, 0, sizeof(struct CUSTOMVERTEX));
175 | IDirect3DDevice9_SetIndices(g_pd3dDevice, g_pIB);
176 | IDirect3DDevice9_SetFVF(g_pd3dDevice, D3DFVF_CUSTOMVERTEX);
177 |
178 | // Setup desired DX state
179 | ImGui_ImplDX9_SetupRenderState(draw_data);
180 |
181 | // Render command lists
182 | // (Because we merged all buffers into a single one, we maintain our own offset into them)
183 | int global_vtx_offset = 0;
184 | int global_idx_offset = 0;
185 | ImVec2 clip_off = draw_data->DisplayPos;
186 | for (int n = 0; n < draw_data->CmdListsCount; n++)
187 | {
188 | const ImDrawList* cmd_list = draw_data->CmdLists[n];
189 | for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
190 | {
191 | // ImVector_ImDrawCmd
192 | const ImDrawCmd* pcmd = &cmd_list->CmdBuffer.Data[cmd_i];
193 | if (pcmd->UserCallback != NULL)
194 | {
195 | // User callback, registered via ImDrawList::AddCallback()
196 | // (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.)
197 | if (pcmd->UserCallback == (ImDrawCallback)(-1)) // ImDrawCallback_ResetRenderState
198 | ImGui_ImplDX9_SetupRenderState(draw_data);
199 | else
200 | pcmd->UserCallback(cmd_list, pcmd);
201 | } else
202 | {
203 | const RECT r = { (LONG)(pcmd->ClipRect.x - clip_off.x), (LONG)(pcmd->ClipRect.y - clip_off.y), (LONG)(pcmd->ClipRect.z - clip_off.x), (LONG)(pcmd->ClipRect.w - clip_off.y) };
204 | const LPDIRECT3DTEXTURE9 texture = (LPDIRECT3DTEXTURE9)pcmd->TextureId;
205 | IDirect3DDevice9_SetTexture(g_pd3dDevice, 0, (IDirect3DBaseTexture9*)texture);
206 | IDirect3DDevice9_SetScissorRect(g_pd3dDevice, &r);
207 | IDirect3DDevice9_DrawIndexedPrimitive(g_pd3dDevice, D3DPT_TRIANGLELIST, pcmd->VtxOffset + global_vtx_offset, 0, (UINT)cmd_list->VtxBuffer.Size, pcmd->IdxOffset + global_idx_offset, pcmd->ElemCount / 3);
208 | }
209 | }
210 | global_idx_offset += cmd_list->IdxBuffer.Size;
211 | global_vtx_offset += cmd_list->VtxBuffer.Size;
212 | }
213 |
214 | // Restore the DX9 transform
215 | IDirect3DDevice9_SetTransform(g_pd3dDevice, D3DTS_WORLD, &last_world);
216 | IDirect3DDevice9_SetTransform(g_pd3dDevice, D3DTS_VIEW, &last_view);
217 | IDirect3DDevice9_SetTransform(g_pd3dDevice, D3DTS_PROJECTION, &last_projection);
218 |
219 | // Restore the DX9 state
220 | IDirect3DStateBlock9_Apply(d3d9_state_block);
221 | IDirect3DStateBlock9_Release(d3d9_state_block);
222 | }
223 |
224 | bool ImGui_ImplDX9_Init(IDirect3DDevice9* device)
225 | {
226 | // Setup back-end capabilities flags
227 | ImGuiIO* io = igGetIO();
228 | io->BackendRendererName = "imgui_impl_dx9";
229 | io->BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
230 |
231 | g_pd3dDevice = device;
232 | IDirect3DDevice9_AddRef(g_pd3dDevice);
233 | return true;
234 | }
235 |
236 | void ImGui_ImplDX9_Shutdown()
237 | {
238 | ImGui_ImplDX9_InvalidateDeviceObjects();
239 | if (g_pd3dDevice) { IDirect3DDevice9_Release(g_pd3dDevice); g_pd3dDevice = NULL; }
240 | }
241 |
242 | static bool ImGui_ImplDX9_CreateFontsTexture()
243 | {
244 | // Build texture atlas
245 | ImGuiIO* io = igGetIO();
246 | unsigned char* pixels;
247 | int width, height, bytes_per_pixel;
248 | ImFontAtlas_GetTexDataAsRGBA32(io->Fonts, &pixels, &width, &height, &bytes_per_pixel);
249 |
250 | // Upload texture to graphics system
251 | g_FontTexture = NULL;
252 | if (IDirect3DDevice9_CreateTexture(g_pd3dDevice, width, height, 1, D3DUSAGE_DYNAMIC, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &g_FontTexture, NULL) < 0)
253 | return false;
254 | D3DLOCKED_RECT tex_locked_rect;
255 | if (IDirect3DTexture9_LockRect(g_FontTexture, 0, &tex_locked_rect, NULL, 0) != D3D_OK)
256 | return false;
257 | for (int y = 0; y < height; y++)
258 | memcpy((unsigned char*)tex_locked_rect.pBits + tex_locked_rect.Pitch * y, pixels + (width * bytes_per_pixel) * y, (width * bytes_per_pixel));
259 | IDirect3DTexture9_UnlockRect(g_FontTexture, 0);
260 |
261 | // Store our identifier
262 | io->Fonts->TexID = (ImTextureID)g_FontTexture;
263 |
264 | return true;
265 | }
266 |
267 | bool ImGui_ImplDX9_CreateDeviceObjects()
268 | {
269 | if (!g_pd3dDevice)
270 | return false;
271 | if (!ImGui_ImplDX9_CreateFontsTexture())
272 | return false;
273 | return true;
274 | }
275 |
276 | void ImGui_ImplDX9_InvalidateDeviceObjects()
277 | {
278 | if (!g_pd3dDevice)
279 | return;
280 | if (g_pVB) { IDirect3DVertexBuffer9_Release(g_pVB); g_pVB = NULL; }
281 | if (g_pIB) { IDirect3DIndexBuffer9_Release(g_pIB); g_pIB = NULL; }
282 | if (g_FontTexture) { IDirect3DTexture9_Release(g_FontTexture); g_FontTexture = NULL; igGetIO()->Fonts->TexID = NULL; } // We copied g_pFontTextureView to io.Fonts->TexID so let's clear that as well.
283 | }
284 |
285 | void ImGui_ImplDX9_NewFrame()
286 | {
287 | if (!g_FontTexture)
288 | ImGui_ImplDX9_CreateDeviceObjects();
289 | }
290 |
--------------------------------------------------------------------------------
/Anubis/imgui/imgui_impl_dx9.h:
--------------------------------------------------------------------------------
1 | // dear imgui: Renderer for DirectX9
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 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
6 | // [X] Renderer: Support for large meshes (64k+ vertices) with 16-bits 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 IDirect3DDevice9;
15 |
16 | #ifdef __cplusplus
17 | extern "C"
18 | {
19 | #endif
20 |
21 | bool ImGui_ImplDX9_Init(struct IDirect3DDevice9* device);
22 | void ImGui_ImplDX9_Shutdown();
23 | void ImGui_ImplDX9_NewFrame();
24 | void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data);
25 |
26 | // Use if you want to reset your rendering device without losing ImGui state.
27 | bool ImGui_ImplDX9_CreateDeviceObjects();
28 | void ImGui_ImplDX9_InvalidateDeviceObjects();
29 |
30 | #ifdef __cplusplus
31 | }
32 | #endif
33 |
--------------------------------------------------------------------------------
/Anubis/imgui/imgui_impl_win32.c:
--------------------------------------------------------------------------------
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 | #define CIMGUI_DEFINE_ENUMS_AND_STRUCTS
11 | #include "cimgui.h"
12 | #include "imgui_impl_win32.h"
13 |
14 | #include
15 | #include
16 | #include
17 |
18 | #ifndef WIN32_LEAN_AND_MEAN
19 | #define WIN32_LEAN_AND_MEAN
20 | #endif
21 | #include
22 | #include
23 | #include
24 |
25 | // CHANGELOG
26 | // (minor and older changes stripped away, please see git history for details)
27 | // 2019-05-11: Inputs: Don't filter value from WM_CHAR before calling AddInputCharacter().
28 | // 2019-01-17: Misc: Using GetForegroundWindow()+IsChild() instead of GetActiveWindow() to be compatible with windows created in a different thread or parent.
29 | // 2019-01-17: Inputs: Added support for mouse buttons 4 and 5 via WM_XBUTTON* messages.
30 | // 2019-01-15: Inputs: Added support for XInput gamepads (if ImGuiConfigFlags_NavEnableGamepad is set by user application).
31 | // 2018-11-30: Misc: Setting up io.BackendPlatformName so it can be displayed in the About Window.
32 | // 2018-06-29: Inputs: Added support for the ImGuiMouseCursor_Hand cursor.
33 | // 2018-06-10: Inputs: Fixed handling of mouse wheel messages to support fine position messages (typically sent by track-pads).
34 | // 2018-06-08: Misc: Extracted imgui_impl_win32.cpp/.h away from the old combined DX9/DX10/DX11/DX12 examples.
35 | // 2018-03-20: Misc: Setup io.BackendFlags ImGuiBackendFlags_HasMouseCursors and ImGuiBackendFlags_HasSetMousePos flags + honor ImGuiConfigFlags_NoMouseCursorChange flag.
36 | // 2018-02-20: Inputs: Added support for mouse cursors (ImGui::GetMouseCursor() value and WM_SETCURSOR message handling).
37 | // 2018-02-06: Inputs: Added mapping for ImGuiKey_Space.
38 | // 2018-02-06: Inputs: Honoring the io.WantSetMousePos by repositioning the mouse (when using navigation and ImGuiConfigFlags_NavMoveMouse is set).
39 | // 2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves.
40 | // 2018-01-20: Inputs: Added Horizontal Mouse Wheel support.
41 | // 2018-01-08: Inputs: Added mapping for ImGuiKey_Insert.
42 | // 2018-01-05: Inputs: Added WM_LBUTTONDBLCLK double-click handlers for window classes with the CS_DBLCLKS flag.
43 | // 2017-10-23: Inputs: Added WM_SYSKEYDOWN / WM_SYSKEYUP handlers so e.g. the VK_MENU key can be read.
44 | // 2017-10-23: Inputs: Using Win32 ::SetCapture/::GetCapture() to retrieve mouse positions outside the client area when dragging.
45 | // 2016-11-12: Inputs: Only call Win32 ::SetCursor(NULL) when io.MouseDrawCursor is set.
46 |
47 | // Win32 Data
48 | static HWND g_hWnd = 0;
49 | static INT64 g_Time = 0;
50 | static INT64 g_TicksPerSecond = 0;
51 | static ImGuiMouseCursor g_LastMouseCursor = ImGuiMouseCursor_COUNT;
52 | static bool g_HasGamepad = false;
53 | static bool g_WantUpdateHasGamepad = true;
54 |
55 | // Functions
56 | bool ImGui_ImplWin32_Init(void* hwnd)
57 | {
58 | if (!QueryPerformanceFrequency((LARGE_INTEGER*)&g_TicksPerSecond))
59 | return false;
60 | if (!QueryPerformanceCounter((LARGE_INTEGER*)&g_Time))
61 | return false;
62 |
63 | // Setup back-end capabilities flags
64 | g_hWnd = (HWND)hwnd;
65 | ImGuiIO* io = igGetIO();
66 | io->BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
67 | io->BackendFlags |= ImGuiBackendFlags_HasSetMousePos; // We can honor io->WantSetMousePos requests (optional, rarely used)
68 | io->BackendPlatformName = "imgui_impl_win32";
69 | io->ImeWindowHandle = hwnd;
70 |
71 | // Keyboard mapping. ImGui will use those indices to peek into the io->KeysDown[] array that we will update during the application lifetime.
72 | io->KeyMap[ImGuiKey_Tab] = VK_TAB;
73 | io->KeyMap[ImGuiKey_LeftArrow] = VK_LEFT;
74 | io->KeyMap[ImGuiKey_RightArrow] = VK_RIGHT;
75 | io->KeyMap[ImGuiKey_UpArrow] = VK_UP;
76 | io->KeyMap[ImGuiKey_DownArrow] = VK_DOWN;
77 | io->KeyMap[ImGuiKey_PageUp] = VK_PRIOR;
78 | io->KeyMap[ImGuiKey_PageDown] = VK_NEXT;
79 | io->KeyMap[ImGuiKey_Home] = VK_HOME;
80 | io->KeyMap[ImGuiKey_End] = VK_END;
81 | io->KeyMap[ImGuiKey_Insert] = VK_INSERT;
82 | io->KeyMap[ImGuiKey_Delete] = VK_DELETE;
83 | io->KeyMap[ImGuiKey_Backspace] = VK_BACK;
84 | io->KeyMap[ImGuiKey_Space] = VK_SPACE;
85 | io->KeyMap[ImGuiKey_Enter] = VK_RETURN;
86 | io->KeyMap[ImGuiKey_Escape] = VK_ESCAPE;
87 | io->KeyMap[ImGuiKey_A] = 'A';
88 | io->KeyMap[ImGuiKey_C] = 'C';
89 | io->KeyMap[ImGuiKey_V] = 'V';
90 | io->KeyMap[ImGuiKey_X] = 'X';
91 | io->KeyMap[ImGuiKey_Y] = 'Y';
92 | io->KeyMap[ImGuiKey_Z] = 'Z';
93 |
94 | return true;
95 | }
96 |
97 | void ImGui_ImplWin32_Shutdown()
98 | {
99 | g_hWnd = (HWND)0;
100 | }
101 |
102 | static bool ImGui_ImplWin32_UpdateMouseCursor()
103 | {
104 | ImGuiIO* io = igGetIO();
105 | if (io->ConfigFlags & ImGuiConfigFlags_NoMouseCursorChange)
106 | return false;
107 |
108 | ImGuiMouseCursor imgui_cursor = igGetMouseCursor();
109 | if (imgui_cursor == ImGuiMouseCursor_None || io->MouseDrawCursor)
110 | {
111 | // Hide OS mouse cursor if imgui is drawing it or if it wants no cursor
112 | SetCursor(NULL);
113 | }
114 | else
115 | {
116 | // Show OS mouse cursor
117 | LPTSTR win32_cursor = IDC_ARROW;
118 | switch (imgui_cursor)
119 | {
120 | case ImGuiMouseCursor_Arrow: win32_cursor = IDC_ARROW; break;
121 | case ImGuiMouseCursor_TextInput: win32_cursor = IDC_IBEAM; break;
122 | case ImGuiMouseCursor_ResizeAll: win32_cursor = IDC_SIZEALL; break;
123 | case ImGuiMouseCursor_ResizeEW: win32_cursor = IDC_SIZEWE; break;
124 | case ImGuiMouseCursor_ResizeNS: win32_cursor = IDC_SIZENS; break;
125 | case ImGuiMouseCursor_ResizeNESW: win32_cursor = IDC_SIZENESW; break;
126 | case ImGuiMouseCursor_ResizeNWSE: win32_cursor = IDC_SIZENWSE; break;
127 | case ImGuiMouseCursor_Hand: win32_cursor = IDC_HAND; break;
128 | }
129 | SetCursor(LoadCursor(NULL, win32_cursor));
130 | }
131 | return true;
132 | }
133 |
134 | static void ImGui_ImplWin32_UpdateMousePos()
135 | {
136 | ImGuiIO* io = igGetIO();
137 |
138 | // Set OS mouse position if requested (rarely used, only when ImGuiConfigFlags_NavEnableSetMousePos is enabled by user)
139 | if (io->WantSetMousePos)
140 | {
141 | POINT pos = { (int)io->MousePos.x, (int)io->MousePos.y };
142 | ClientToScreen(g_hWnd, &pos);
143 | SetCursorPos(pos.x, pos.y);
144 | }
145 |
146 | // Set mouse position
147 | io->MousePos = (ImVec2){ -FLT_MAX, -FLT_MAX };
148 | POINT pos;
149 | HWND active_window = GetForegroundWindow();
150 | if (active_window)
151 | if (active_window == g_hWnd || IsChild(active_window, g_hWnd))
152 | if (GetCursorPos(&pos) && ScreenToClient(g_hWnd, &pos))
153 | io->MousePos = (ImVec2){ (float)pos.x, (float)pos.y };
154 | }
155 |
156 | void ImGui_ImplWin32_NewFrame()
157 | {
158 | ImGuiIO* io = igGetIO();
159 | assert(ImFontAtlas_IsBuilt(io->Fonts) && "Font atlas not built! It is generally built by the renderer back-end. Missing call to renderer _NewFrame() function? e.g. ImGui_ImplOpenGL3_NewFrame().");
160 |
161 | // Setup display size (every frame to accommodate for window resizing)
162 | RECT rect;
163 | GetClientRect(g_hWnd, &rect);
164 | io->DisplaySize = (ImVec2){ (float)(rect.right - rect.left), (float)(rect.bottom - rect.top) };
165 |
166 | // Setup time step
167 | INT64 current_time;
168 | QueryPerformanceCounter((LARGE_INTEGER*)¤t_time);
169 | io->DeltaTime = (float)(current_time - g_Time) / g_TicksPerSecond;
170 | g_Time = current_time;
171 |
172 | // Read keyboard modifiers inputs
173 | io->KeyCtrl = (GetKeyState(VK_CONTROL) & 0x8000) != 0;
174 | io->KeyShift = (GetKeyState(VK_SHIFT) & 0x8000) != 0;
175 | io->KeyAlt = (GetKeyState(VK_MENU) & 0x8000) != 0;
176 | io->KeySuper = false;
177 | // io.KeysDown[], io.MousePos, io.MouseDown[], io.MouseWheel: filled by the WndProc handler below.
178 |
179 | // Update OS mouse position
180 | ImGui_ImplWin32_UpdateMousePos();
181 |
182 | // Update OS mouse cursor with the cursor requested by imgui
183 | ImGuiMouseCursor mouse_cursor = io->MouseDrawCursor ? ImGuiMouseCursor_None : igGetMouseCursor();
184 | if (g_LastMouseCursor != mouse_cursor)
185 | {
186 | g_LastMouseCursor = mouse_cursor;
187 | ImGui_ImplWin32_UpdateMouseCursor();
188 | }
189 | }
190 |
191 | // Allow compilation with old Windows SDK. MinGW doesn't have default _WIN32_WINNT/WINVER versions.
192 | #ifndef WM_MOUSEHWHEEL
193 | #define WM_MOUSEHWHEEL 0x020E
194 | #endif
195 | #ifndef DBT_DEVNODES_CHANGED
196 | #define DBT_DEVNODES_CHANGED 0x0007
197 | #endif
198 |
199 | // Process Win32 mouse/keyboard inputs.
200 | // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
201 | // - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application.
202 | // - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application.
203 | // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
204 | // PS: In this Win32 handler, we use the capture API (GetCapture/SetCapture/ReleaseCapture) to be able to read mouse coordinates when dragging mouse outside of our window bounds.
205 | // PS: We treat DBLCLK messages as regular mouse down messages, so this code will work on windows classes that have the CS_DBLCLKS flag set. Our own example app code doesn't set this flag.
206 | LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
207 | {
208 | if (igGetCurrentContext() == NULL)
209 | return 0;
210 |
211 | ImGuiIO* io = igGetIO();
212 | switch (msg)
213 | {
214 | case WM_LBUTTONDOWN: case WM_LBUTTONDBLCLK:
215 | case WM_RBUTTONDOWN: case WM_RBUTTONDBLCLK:
216 | case WM_MBUTTONDOWN: case WM_MBUTTONDBLCLK:
217 | case WM_XBUTTONDOWN: case WM_XBUTTONDBLCLK:
218 | {
219 | int button = 0;
220 | if (msg == WM_LBUTTONDOWN || msg == WM_LBUTTONDBLCLK) { button = 0; }
221 | if (msg == WM_RBUTTONDOWN || msg == WM_RBUTTONDBLCLK) { button = 1; }
222 | if (msg == WM_MBUTTONDOWN || msg == WM_MBUTTONDBLCLK) { button = 2; }
223 | if (msg == WM_XBUTTONDOWN || msg == WM_XBUTTONDBLCLK) { button = (GET_XBUTTON_WPARAM(wParam) == XBUTTON1) ? 3 : 4; }
224 | if (!igIsAnyMouseDown() && GetCapture() == NULL)
225 | SetCapture(hwnd);
226 | io->MouseDown[button] = true;
227 | return 0;
228 | }
229 | case WM_LBUTTONUP:
230 | case WM_RBUTTONUP:
231 | case WM_MBUTTONUP:
232 | case WM_XBUTTONUP:
233 | {
234 | int button = 0;
235 | if (msg == WM_LBUTTONUP) { button = 0; }
236 | if (msg == WM_RBUTTONUP) { button = 1; }
237 | if (msg == WM_MBUTTONUP) { button = 2; }
238 | if (msg == WM_XBUTTONUP) { button = (GET_XBUTTON_WPARAM(wParam) == XBUTTON1) ? 3 : 4; }
239 | io->MouseDown[button] = false;
240 | if (!igIsAnyMouseDown() && GetCapture() == hwnd)
241 | ReleaseCapture();
242 | return 0;
243 | }
244 | case WM_MOUSEWHEEL:
245 | io->MouseWheel += (float)GET_WHEEL_DELTA_WPARAM(wParam) / (float)WHEEL_DELTA;
246 | return 0;
247 | case WM_MOUSEHWHEEL:
248 | io->MouseWheelH += (float)GET_WHEEL_DELTA_WPARAM(wParam) / (float)WHEEL_DELTA;
249 | return 0;
250 | case WM_KEYDOWN:
251 | case WM_SYSKEYDOWN:
252 | if (wParam < 256)
253 | io->KeysDown[wParam] = 1;
254 | return 0;
255 | case WM_KEYUP:
256 | case WM_SYSKEYUP:
257 | if (wParam < 256)
258 | io->KeysDown[wParam] = 0;
259 | return 0;
260 | case WM_CHAR:
261 | // You can also use ToAscii()+GetKeyboardState() to retrieve characters.
262 | ImGuiIO_AddInputCharacter(io, (unsigned int)wParam);
263 | return 0;
264 | case WM_SETCURSOR:
265 | if (LOWORD(lParam) == HTCLIENT && ImGui_ImplWin32_UpdateMouseCursor())
266 | return 1;
267 | return 0;
268 | case WM_DEVICECHANGE:
269 | if ((UINT)wParam == DBT_DEVNODES_CHANGED)
270 | g_WantUpdateHasGamepad = true;
271 | return 0;
272 | }
273 | return 0;
274 | }
275 |
--------------------------------------------------------------------------------
/Anubis/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 | // Missing features:
9 | // [ ] Platform: Gamepad support (best leaving it to user application to fill io.NavInputs[] with gamepad inputs from their source of choice).
10 |
11 | #pragma once
12 |
13 | #ifdef __cplusplus
14 | extern "C"
15 | {
16 | #endif
17 |
18 | bool ImGui_ImplWin32_Init(void* hwnd);
19 | void ImGui_ImplWin32_Shutdown();
20 | void ImGui_ImplWin32_NewFrame();
21 |
22 | #ifdef __cplusplus
23 | }
24 | #endif
25 |
26 | // Handler for Win32 messages, update mouse/keyboard data.
27 | // You may or not need this for your implementation, but it can serve as reference for handling inputs.
28 | // Intentionally commented out to avoid dragging dependencies on types. You can copy the extern declaration in your code.
29 | /*
30 | IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
31 | */
32 |
--------------------------------------------------------------------------------
/Anubis/imgui/imstb_rectpack.h:
--------------------------------------------------------------------------------
1 | // [DEAR IMGUI]
2 | // This is a slightly modified version of stb_rect_pack.h 1.00.
3 | // Those changes would need to be pushed into nothings/stb:
4 | // - Added STBRP__CDECL
5 | // Grep for [DEAR IMGUI] to find the changes.
6 |
7 | // stb_rect_pack.h - v1.00 - public domain - rectangle packing
8 | // Sean Barrett 2014
9 | //
10 | // Useful for e.g. packing rectangular textures into an atlas.
11 | // Does not do rotation.
12 | //
13 | // Not necessarily the awesomest packing method, but better than
14 | // the totally naive one in stb_truetype (which is primarily what
15 | // this is meant to replace).
16 | //
17 | // Has only had a few tests run, may have issues.
18 | //
19 | // More docs to come.
20 | //
21 | // No memory allocations; uses qsort() and assert() from stdlib.
22 | // Can override those by defining STBRP_SORT and STBRP_ASSERT.
23 | //
24 | // This library currently uses the Skyline Bottom-Left algorithm.
25 | //
26 | // Please note: better rectangle packers are welcome! Please
27 | // implement them to the same API, but with a different init
28 | // function.
29 | //
30 | // Credits
31 | //
32 | // Library
33 | // Sean Barrett
34 | // Minor features
35 | // Martins Mozeiko
36 | // github:IntellectualKitty
37 | //
38 | // Bugfixes / warning fixes
39 | // Jeremy Jaussaud
40 | // Fabian Giesen
41 | //
42 | // Version history:
43 | //
44 | // 1.00 (2019-02-25) avoid small space waste; gracefully fail too-wide rectangles
45 | // 0.99 (2019-02-07) warning fixes
46 | // 0.11 (2017-03-03) return packing success/fail result
47 | // 0.10 (2016-10-25) remove cast-away-const to avoid warnings
48 | // 0.09 (2016-08-27) fix compiler warnings
49 | // 0.08 (2015-09-13) really fix bug with empty rects (w=0 or h=0)
50 | // 0.07 (2015-09-13) fix bug with empty rects (w=0 or h=0)
51 | // 0.06 (2015-04-15) added STBRP_SORT to allow replacing qsort
52 | // 0.05: added STBRP_ASSERT to allow replacing assert
53 | // 0.04: fixed minor bug in STBRP_LARGE_RECTS support
54 | // 0.01: initial release
55 | //
56 | // LICENSE
57 | //
58 | // See end of file for license information.
59 |
60 | //////////////////////////////////////////////////////////////////////////////
61 | //
62 | // INCLUDE SECTION
63 | //
64 |
65 | #ifndef STB_INCLUDE_STB_RECT_PACK_H
66 | #define STB_INCLUDE_STB_RECT_PACK_H
67 |
68 | #define STB_RECT_PACK_VERSION 1
69 |
70 | #ifdef STBRP_STATIC
71 | #define STBRP_DEF static
72 | #else
73 | #define STBRP_DEF extern
74 | #endif
75 |
76 | #ifdef __cplusplus
77 | extern "C" {
78 | #endif
79 |
80 | typedef struct stbrp_context stbrp_context;
81 | typedef struct stbrp_node stbrp_node;
82 | typedef struct stbrp_rect stbrp_rect;
83 |
84 | #ifdef STBRP_LARGE_RECTS
85 | typedef int stbrp_coord;
86 | #else
87 | typedef unsigned short stbrp_coord;
88 | #endif
89 |
90 | STBRP_DEF int stbrp_pack_rects (stbrp_context *context, stbrp_rect *rects, int num_rects);
91 | // Assign packed locations to rectangles. The rectangles are of type
92 | // 'stbrp_rect' defined below, stored in the array 'rects', and there
93 | // are 'num_rects' many of them.
94 | //
95 | // Rectangles which are successfully packed have the 'was_packed' flag
96 | // set to a non-zero value and 'x' and 'y' store the minimum location
97 | // on each axis (i.e. bottom-left in cartesian coordinates, top-left
98 | // if you imagine y increasing downwards). Rectangles which do not fit
99 | // have the 'was_packed' flag set to 0.
100 | //
101 | // You should not try to access the 'rects' array from another thread
102 | // while this function is running, as the function temporarily reorders
103 | // the array while it executes.
104 | //
105 | // To pack into another rectangle, you need to call stbrp_init_target
106 | // again. To continue packing into the same rectangle, you can call
107 | // this function again. Calling this multiple times with multiple rect
108 | // arrays will probably produce worse packing results than calling it
109 | // a single time with the full rectangle array, but the option is
110 | // available.
111 | //
112 | // The function returns 1 if all of the rectangles were successfully
113 | // packed and 0 otherwise.
114 |
115 | struct stbrp_rect
116 | {
117 | // reserved for your use:
118 | int id;
119 |
120 | // input:
121 | stbrp_coord w, h;
122 |
123 | // output:
124 | stbrp_coord x, y;
125 | int was_packed; // non-zero if valid packing
126 |
127 | }; // 16 bytes, nominally
128 |
129 |
130 | STBRP_DEF void stbrp_init_target (stbrp_context *context, int width, int height, stbrp_node *nodes, int num_nodes);
131 | // Initialize a rectangle packer to:
132 | // pack a rectangle that is 'width' by 'height' in dimensions
133 | // using temporary storage provided by the array 'nodes', which is 'num_nodes' long
134 | //
135 | // You must call this function every time you start packing into a new target.
136 | //
137 | // There is no "shutdown" function. The 'nodes' memory must stay valid for
138 | // the following stbrp_pack_rects() call (or calls), but can be freed after
139 | // the call (or calls) finish.
140 | //
141 | // Note: to guarantee best results, either:
142 | // 1. make sure 'num_nodes' >= 'width'
143 | // or 2. call stbrp_allow_out_of_mem() defined below with 'allow_out_of_mem = 1'
144 | //
145 | // If you don't do either of the above things, widths will be quantized to multiples
146 | // of small integers to guarantee the algorithm doesn't run out of temporary storage.
147 | //
148 | // If you do #2, then the non-quantized algorithm will be used, but the algorithm
149 | // may run out of temporary storage and be unable to pack some rectangles.
150 |
151 | STBRP_DEF void stbrp_setup_allow_out_of_mem (stbrp_context *context, int allow_out_of_mem);
152 | // Optionally call this function after init but before doing any packing to
153 | // change the handling of the out-of-temp-memory scenario, described above.
154 | // If you call init again, this will be reset to the default (false).
155 |
156 |
157 | STBRP_DEF void stbrp_setup_heuristic (stbrp_context *context, int heuristic);
158 | // Optionally select which packing heuristic the library should use. Different
159 | // heuristics will produce better/worse results for different data sets.
160 | // If you call init again, this will be reset to the default.
161 |
162 | enum
163 | {
164 | STBRP_HEURISTIC_Skyline_default=0,
165 | STBRP_HEURISTIC_Skyline_BL_sortHeight = STBRP_HEURISTIC_Skyline_default,
166 | STBRP_HEURISTIC_Skyline_BF_sortHeight
167 | };
168 |
169 |
170 | //////////////////////////////////////////////////////////////////////////////
171 | //
172 | // the details of the following structures don't matter to you, but they must
173 | // be visible so you can handle the memory allocations for them
174 |
175 | struct stbrp_node
176 | {
177 | stbrp_coord x,y;
178 | stbrp_node *next;
179 | };
180 |
181 | struct stbrp_context
182 | {
183 | int width;
184 | int height;
185 | int align;
186 | int init_mode;
187 | int heuristic;
188 | int num_nodes;
189 | stbrp_node *active_head;
190 | stbrp_node *free_head;
191 | stbrp_node extra[2]; // we allocate two extra nodes so optimal user-node-count is 'width' not 'width+2'
192 | };
193 |
194 | #ifdef __cplusplus
195 | }
196 | #endif
197 |
198 | #endif
199 |
200 | //////////////////////////////////////////////////////////////////////////////
201 | //
202 | // IMPLEMENTATION SECTION
203 | //
204 |
205 | #ifdef STB_RECT_PACK_IMPLEMENTATION
206 | #ifndef STBRP_SORT
207 | #include
208 | #define STBRP_SORT qsort
209 | #endif
210 |
211 | #ifndef STBRP_ASSERT
212 | #include
213 | #define STBRP_ASSERT assert
214 | #endif
215 |
216 | // [DEAR IMGUI] Added STBRP__CDECL
217 | #ifdef _MSC_VER
218 | #define STBRP__NOTUSED(v) (void)(v)
219 | #define STBRP__CDECL __cdecl
220 | #else
221 | #define STBRP__NOTUSED(v) (void)sizeof(v)
222 | #define STBRP__CDECL
223 | #endif
224 |
225 | enum
226 | {
227 | STBRP__INIT_skyline = 1
228 | };
229 |
230 | STBRP_DEF void stbrp_setup_heuristic(stbrp_context *context, int heuristic)
231 | {
232 | switch (context->init_mode) {
233 | case STBRP__INIT_skyline:
234 | STBRP_ASSERT(heuristic == STBRP_HEURISTIC_Skyline_BL_sortHeight || heuristic == STBRP_HEURISTIC_Skyline_BF_sortHeight);
235 | context->heuristic = heuristic;
236 | break;
237 | default:
238 | STBRP_ASSERT(0);
239 | }
240 | }
241 |
242 | STBRP_DEF void stbrp_setup_allow_out_of_mem(stbrp_context *context, int allow_out_of_mem)
243 | {
244 | if (allow_out_of_mem)
245 | // if it's ok to run out of memory, then don't bother aligning them;
246 | // this gives better packing, but may fail due to OOM (even though
247 | // the rectangles easily fit). @TODO a smarter approach would be to only
248 | // quantize once we've hit OOM, then we could get rid of this parameter.
249 | context->align = 1;
250 | else {
251 | // if it's not ok to run out of memory, then quantize the widths
252 | // so that num_nodes is always enough nodes.
253 | //
254 | // I.e. num_nodes * align >= width
255 | // align >= width / num_nodes
256 | // align = ceil(width/num_nodes)
257 |
258 | context->align = (context->width + context->num_nodes-1) / context->num_nodes;
259 | }
260 | }
261 |
262 | STBRP_DEF void stbrp_init_target(stbrp_context *context, int width, int height, stbrp_node *nodes, int num_nodes)
263 | {
264 | int i;
265 | #ifndef STBRP_LARGE_RECTS
266 | STBRP_ASSERT(width <= 0xffff && height <= 0xffff);
267 | #endif
268 |
269 | for (i=0; i < num_nodes-1; ++i)
270 | nodes[i].next = &nodes[i+1];
271 | nodes[i].next = NULL;
272 | context->init_mode = STBRP__INIT_skyline;
273 | context->heuristic = STBRP_HEURISTIC_Skyline_default;
274 | context->free_head = &nodes[0];
275 | context->active_head = &context->extra[0];
276 | context->width = width;
277 | context->height = height;
278 | context->num_nodes = num_nodes;
279 | stbrp_setup_allow_out_of_mem(context, 0);
280 |
281 | // node 0 is the full width, node 1 is the sentinel (lets us not store width explicitly)
282 | context->extra[0].x = 0;
283 | context->extra[0].y = 0;
284 | context->extra[0].next = &context->extra[1];
285 | context->extra[1].x = (stbrp_coord) width;
286 | #ifdef STBRP_LARGE_RECTS
287 | context->extra[1].y = (1<<30);
288 | #else
289 | context->extra[1].y = 65535;
290 | #endif
291 | context->extra[1].next = NULL;
292 | }
293 |
294 | // find minimum y position if it starts at x1
295 | static int stbrp__skyline_find_min_y(stbrp_context *c, stbrp_node *first, int x0, int width, int *pwaste)
296 | {
297 | stbrp_node *node = first;
298 | int x1 = x0 + width;
299 | int min_y, visited_width, waste_area;
300 |
301 | STBRP__NOTUSED(c);
302 |
303 | STBRP_ASSERT(first->x <= x0);
304 |
305 | #if 0
306 | // skip in case we're past the node
307 | while (node->next->x <= x0)
308 | ++node;
309 | #else
310 | STBRP_ASSERT(node->next->x > x0); // we ended up handling this in the caller for efficiency
311 | #endif
312 |
313 | STBRP_ASSERT(node->x <= x0);
314 |
315 | min_y = 0;
316 | waste_area = 0;
317 | visited_width = 0;
318 | while (node->x < x1) {
319 | if (node->y > min_y) {
320 | // raise min_y higher.
321 | // we've accounted for all waste up to min_y,
322 | // but we'll now add more waste for everything we've visted
323 | waste_area += visited_width * (node->y - min_y);
324 | min_y = node->y;
325 | // the first time through, visited_width might be reduced
326 | if (node->x < x0)
327 | visited_width += node->next->x - x0;
328 | else
329 | visited_width += node->next->x - node->x;
330 | } else {
331 | // add waste area
332 | int under_width = node->next->x - node->x;
333 | if (under_width + visited_width > width)
334 | under_width = width - visited_width;
335 | waste_area += under_width * (min_y - node->y);
336 | visited_width += under_width;
337 | }
338 | node = node->next;
339 | }
340 |
341 | *pwaste = waste_area;
342 | return min_y;
343 | }
344 |
345 | typedef struct
346 | {
347 | int x,y;
348 | stbrp_node **prev_link;
349 | } stbrp__findresult;
350 |
351 | static stbrp__findresult stbrp__skyline_find_best_pos(stbrp_context *c, int width, int height)
352 | {
353 | int best_waste = (1<<30), best_x, best_y = (1 << 30);
354 | stbrp__findresult fr;
355 | stbrp_node **prev, *node, *tail, **best = NULL;
356 |
357 | // align to multiple of c->align
358 | width = (width + c->align - 1);
359 | width -= width % c->align;
360 | STBRP_ASSERT(width % c->align == 0);
361 |
362 | // if it can't possibly fit, bail immediately
363 | if (width > c->width || height > c->height) {
364 | fr.prev_link = NULL;
365 | fr.x = fr.y = 0;
366 | return fr;
367 | }
368 |
369 | node = c->active_head;
370 | prev = &c->active_head;
371 | while (node->x + width <= c->width) {
372 | int y,waste;
373 | y = stbrp__skyline_find_min_y(c, node, node->x, width, &waste);
374 | if (c->heuristic == STBRP_HEURISTIC_Skyline_BL_sortHeight) { // actually just want to test BL
375 | // bottom left
376 | if (y < best_y) {
377 | best_y = y;
378 | best = prev;
379 | }
380 | } else {
381 | // best-fit
382 | if (y + height <= c->height) {
383 | // can only use it if it first vertically
384 | if (y < best_y || (y == best_y && waste < best_waste)) {
385 | best_y = y;
386 | best_waste = waste;
387 | best = prev;
388 | }
389 | }
390 | }
391 | prev = &node->next;
392 | node = node->next;
393 | }
394 |
395 | best_x = (best == NULL) ? 0 : (*best)->x;
396 |
397 | // if doing best-fit (BF), we also have to try aligning right edge to each node position
398 | //
399 | // e.g, if fitting
400 | //
401 | // ____________________
402 | // |____________________|
403 | //
404 | // into
405 | //
406 | // | |
407 | // | ____________|
408 | // |____________|
409 | //
410 | // then right-aligned reduces waste, but bottom-left BL is always chooses left-aligned
411 | //
412 | // This makes BF take about 2x the time
413 |
414 | if (c->heuristic == STBRP_HEURISTIC_Skyline_BF_sortHeight) {
415 | tail = c->active_head;
416 | node = c->active_head;
417 | prev = &c->active_head;
418 | // find first node that's admissible
419 | while (tail->x < width)
420 | tail = tail->next;
421 | while (tail) {
422 | int xpos = tail->x - width;
423 | int y,waste;
424 | STBRP_ASSERT(xpos >= 0);
425 | // find the left position that matches this
426 | while (node->next->x <= xpos) {
427 | prev = &node->next;
428 | node = node->next;
429 | }
430 | STBRP_ASSERT(node->next->x > xpos && node->x <= xpos);
431 | y = stbrp__skyline_find_min_y(c, node, xpos, width, &waste);
432 | if (y + height <= c->height) {
433 | if (y <= best_y) {
434 | if (y < best_y || waste < best_waste || (waste==best_waste && xpos < best_x)) {
435 | best_x = xpos;
436 | STBRP_ASSERT(y <= best_y);
437 | best_y = y;
438 | best_waste = waste;
439 | best = prev;
440 | }
441 | }
442 | }
443 | tail = tail->next;
444 | }
445 | }
446 |
447 | fr.prev_link = best;
448 | fr.x = best_x;
449 | fr.y = best_y;
450 | return fr;
451 | }
452 |
453 | static stbrp__findresult stbrp__skyline_pack_rectangle(stbrp_context *context, int width, int height)
454 | {
455 | // find best position according to heuristic
456 | stbrp__findresult res = stbrp__skyline_find_best_pos(context, width, height);
457 | stbrp_node *node, *cur;
458 |
459 | // bail if:
460 | // 1. it failed
461 | // 2. the best node doesn't fit (we don't always check this)
462 | // 3. we're out of memory
463 | if (res.prev_link == NULL || res.y + height > context->height || context->free_head == NULL) {
464 | res.prev_link = NULL;
465 | return res;
466 | }
467 |
468 | // on success, create new node
469 | node = context->free_head;
470 | node->x = (stbrp_coord) res.x;
471 | node->y = (stbrp_coord) (res.y + height);
472 |
473 | context->free_head = node->next;
474 |
475 | // insert the new node into the right starting point, and
476 | // let 'cur' point to the remaining nodes needing to be
477 | // stiched back in
478 |
479 | cur = *res.prev_link;
480 | if (cur->x < res.x) {
481 | // preserve the existing one, so start testing with the next one
482 | stbrp_node *next = cur->next;
483 | cur->next = node;
484 | cur = next;
485 | } else {
486 | *res.prev_link = node;
487 | }
488 |
489 | // from here, traverse cur and free the nodes, until we get to one
490 | // that shouldn't be freed
491 | while (cur->next && cur->next->x <= res.x + width) {
492 | stbrp_node *next = cur->next;
493 | // move the current node to the free list
494 | cur->next = context->free_head;
495 | context->free_head = cur;
496 | cur = next;
497 | }
498 |
499 | // stitch the list back in
500 | node->next = cur;
501 |
502 | if (cur->x < res.x + width)
503 | cur->x = (stbrp_coord) (res.x + width);
504 |
505 | #ifdef _DEBUG
506 | cur = context->active_head;
507 | while (cur->x < context->width) {
508 | STBRP_ASSERT(cur->x < cur->next->x);
509 | cur = cur->next;
510 | }
511 | STBRP_ASSERT(cur->next == NULL);
512 |
513 | {
514 | int count=0;
515 | cur = context->active_head;
516 | while (cur) {
517 | cur = cur->next;
518 | ++count;
519 | }
520 | cur = context->free_head;
521 | while (cur) {
522 | cur = cur->next;
523 | ++count;
524 | }
525 | STBRP_ASSERT(count == context->num_nodes+2);
526 | }
527 | #endif
528 |
529 | return res;
530 | }
531 |
532 | // [DEAR IMGUI] Added STBRP__CDECL
533 | static int STBRP__CDECL rect_height_compare(const void *a, const void *b)
534 | {
535 | const stbrp_rect *p = (const stbrp_rect *) a;
536 | const stbrp_rect *q = (const stbrp_rect *) b;
537 | if (p->h > q->h)
538 | return -1;
539 | if (p->h < q->h)
540 | return 1;
541 | return (p->w > q->w) ? -1 : (p->w < q->w);
542 | }
543 |
544 | // [DEAR IMGUI] Added STBRP__CDECL
545 | static int STBRP__CDECL rect_original_order(const void *a, const void *b)
546 | {
547 | const stbrp_rect *p = (const stbrp_rect *) a;
548 | const stbrp_rect *q = (const stbrp_rect *) b;
549 | return (p->was_packed < q->was_packed) ? -1 : (p->was_packed > q->was_packed);
550 | }
551 |
552 | #ifdef STBRP_LARGE_RECTS
553 | #define STBRP__MAXVAL 0xffffffff
554 | #else
555 | #define STBRP__MAXVAL 0xffff
556 | #endif
557 |
558 | STBRP_DEF int stbrp_pack_rects(stbrp_context *context, stbrp_rect *rects, int num_rects)
559 | {
560 | int i, all_rects_packed = 1;
561 |
562 | // we use the 'was_packed' field internally to allow sorting/unsorting
563 | for (i=0; i < num_rects; ++i) {
564 | rects[i].was_packed = i;
565 | }
566 |
567 | // sort according to heuristic
568 | STBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_height_compare);
569 |
570 | for (i=0; i < num_rects; ++i) {
571 | if (rects[i].w == 0 || rects[i].h == 0) {
572 | rects[i].x = rects[i].y = 0; // empty rect needs no space
573 | } else {
574 | stbrp__findresult fr = stbrp__skyline_pack_rectangle(context, rects[i].w, rects[i].h);
575 | if (fr.prev_link) {
576 | rects[i].x = (stbrp_coord) fr.x;
577 | rects[i].y = (stbrp_coord) fr.y;
578 | } else {
579 | rects[i].x = rects[i].y = STBRP__MAXVAL;
580 | }
581 | }
582 | }
583 |
584 | // unsort
585 | STBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_original_order);
586 |
587 | // set was_packed flags and all_rects_packed status
588 | for (i=0; i < num_rects; ++i) {
589 | rects[i].was_packed = !(rects[i].x == STBRP__MAXVAL && rects[i].y == STBRP__MAXVAL);
590 | if (!rects[i].was_packed)
591 | all_rects_packed = 0;
592 | }
593 |
594 | // return the all_rects_packed status
595 | return all_rects_packed;
596 | }
597 | #endif
598 |
599 | /*
600 | ------------------------------------------------------------------------------
601 | This software is available under 2 licenses -- choose whichever you prefer.
602 | ------------------------------------------------------------------------------
603 | ALTERNATIVE A - MIT License
604 | Copyright (c) 2017 Sean Barrett
605 | Permission is hereby granted, free of charge, to any person obtaining a copy of
606 | this software and associated documentation files (the "Software"), to deal in
607 | the Software without restriction, including without limitation the rights to
608 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
609 | of the Software, and to permit persons to whom the Software is furnished to do
610 | so, subject to the following conditions:
611 | The above copyright notice and this permission notice shall be included in all
612 | copies or substantial portions of the Software.
613 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
614 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
615 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
616 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
617 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
618 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
619 | SOFTWARE.
620 | ------------------------------------------------------------------------------
621 | ALTERNATIVE B - Public Domain (www.unlicense.org)
622 | This is free and unencumbered software released into the public domain.
623 | Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
624 | software, either in source code form or as a compiled binary, for any purpose,
625 | commercial or non-commercial, and by any means.
626 | In jurisdictions that recognize copyright laws, the author or authors of this
627 | software dedicate any and all copyright interest in the software to the public
628 | domain. We make this dedication for the benefit of the public at large and to
629 | the detriment of our heirs and successors. We intend this dedication to be an
630 | overt act of relinquishment in perpetuity of all present and future rights to
631 | this software under copyright law.
632 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
633 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
634 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
635 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
636 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
637 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
638 | ------------------------------------------------------------------------------
639 | */
640 |
--------------------------------------------------------------------------------
/Anubis/vector.h:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | The MIT License (MIT)
4 |
5 | Copyright (c) 2015 Evan Teran
6 |
7 | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | of this software and associated documentation files (the "Software"), to deal
9 | in the Software without restriction, including without limitation the rights
10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | copies of the Software, and to permit persons to whom the Software is
12 | furnished to do so, subject to the following conditions:
13 |
14 | The above copyright notice and this permission notice shall be included in all
15 | copies or substantial portions of the Software.
16 |
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | SOFTWARE.
24 |
25 | */
26 |
27 | #ifndef VECTOR_H_
28 | #define VECTOR_H_
29 |
30 | #include /* for size_t */
31 | #include /* for malloc/realloc/free */
32 | #include /* for assert */
33 |
34 | /**
35 | * @brief vector_set_capacity - For internal use, sets the capacity variable of the vector
36 | * @param vec - the vector
37 | * @param size - the new capacity to set
38 | * @return void
39 | */
40 | #define vector_set_capacity(vec, size) \
41 | do { \
42 | if(vec) { \
43 | ((size_t *)(vec))[-1] = (size); \
44 | } \
45 | } while(0)
46 |
47 | /**
48 | * @brief vector_set_size - For internal use, sets the size variable of the vector
49 | * @param vec - the vector
50 | * @param size - the new capacity to set
51 | * @return void
52 | */
53 | #define vector_set_size(vec, size) \
54 | do { \
55 | if(vec) { \
56 | ((size_t *)(vec))[-2] = (size); \
57 | } \
58 | } while(0)
59 |
60 | /**
61 | * @brief vector_capacity - gets the current capacity of the vector
62 | * @param vec - the vector
63 | * @return the capacity as a size_t
64 | */
65 | #define vector_capacity(vec) \
66 | ((vec) ? ((size_t *)(vec))[-1] : (size_t)0)
67 |
68 | /**
69 | * @brief vector_size - gets the current size of the vector
70 | * @param vec - the vector
71 | * @return the size as a size_t
72 | */
73 | #define vector_size(vec) \
74 | ((vec) ? ((size_t *)(vec))[-2] : (size_t)0)
75 |
76 | /**
77 | * @brief vector_empty - returns non-zero if the vector is empty
78 | * @param vec - the vector
79 | * @return non-zero if empty, zero if non-empty
80 | */
81 | #define vector_empty(vec) \
82 | (vector_size(vec) == 0)
83 |
84 | /**
85 | * @brief vector_grow - For internal use, ensures that the vector is at least elements big
86 | * @param vec - the vector
87 | * @param size - the new capacity to set
88 | * @return void
89 | */
90 | #define vector_grow(vec, count) \
91 | do { \
92 | if(!(vec)) { \
93 | size_t *__p = malloc((count) * sizeof(*(vec)) + (sizeof(size_t) * 2)); \
94 | assert(__p); \
95 | (vec) = (void *)(&__p[2]); \
96 | vector_set_capacity((vec), (count)); \
97 | vector_set_size((vec), 0); \
98 | } else { \
99 | size_t *__p1 = &((size_t *)(vec))[-2]; \
100 | size_t *__p2 = realloc(__p1, ((count) * sizeof(*(vec))+ (sizeof(size_t) * 2))); \
101 | assert(__p2); \
102 | (vec) = (void *)(&__p2[2]); \
103 | vector_set_capacity((vec), (count)); \
104 | } \
105 | } while(0)
106 |
107 | /**
108 | * @brief vector_pop_back - removes the last element from the vector
109 | * @param vec - the vector
110 | * @return void
111 | */
112 | #define vector_pop_back(vec) \
113 | do { \
114 | vector_set_size((vec), vector_size(vec) - 1); \
115 | } while(0)
116 |
117 | /**
118 | * @brief vector_erase - removes the element at index i from the vector
119 | * @param vec - the vector
120 | * @param i - index of element to remove
121 | * @return void
122 | */
123 | #define vector_erase(vec, i) \
124 | do { \
125 | if (vec) { \
126 | const size_t __sz = vector_size(vec); \
127 | if ((i) < __sz) { \
128 | vector_set_size((vec), __sz - 1); \
129 | size_t __x; \
130 | for (__x = (i); __x < (__sz - 1); ++__x) { \
131 | (vec)[__x] = (vec)[__x + 1]; \
132 | } \
133 | } \
134 | } \
135 | } while(0)
136 |
137 | /**
138 | * @brief vector_free - frees all memory associated with the vector
139 | * @param vec - the vector
140 | * @return void
141 | */
142 | #define vector_free(vec) \
143 | do { \
144 | if(vec) { \
145 | size_t *p1 = &((size_t *)(vec))[-2]; \
146 | free(p1); \
147 | } \
148 | } while(0)
149 |
150 | /**
151 | * @brief vector_begin - returns an iterator to first element of the vector
152 | * @param vec - the vector
153 | * @return a pointer to the first element (or NULL)
154 | */
155 | #define vector_begin(vec) \
156 | (vec)
157 |
158 | /**
159 | * @brief vector_end - returns an iterator to one past the last element of the vector
160 | * @param vec - the vector
161 | * @return a pointer to one past the last element (or NULL)
162 | */
163 | #define vector_end(vec) \
164 | ((vec) ? &((vec)[vector_size(vec)]) : NULL)
165 |
166 |
167 | /**
168 | * @brief vector_push_back - adds an element to the end of the vector
169 | * @param vec - the vector
170 | * @param value - the value to add
171 | * @return void
172 | */
173 | #ifdef LOGARITHMIC_GROWTH
174 |
175 | #define vector_push_back(vec, value) \
176 | do { \
177 | size_t __cap = vector_capacity(vec); \
178 | if(__cap <= vector_size(vec)) { \
179 | vector_grow((vec), !__cap ? __cap + 1 : __cap * 2); \
180 | } \
181 | vec[vector_size(vec)] = (value); \
182 | vector_set_size((vec), vector_size(vec) + 1); \
183 | } while(0)
184 |
185 | #else
186 |
187 | #define vector_push_back(vec, value) \
188 | do { \
189 | size_t __cap = vector_capacity(vec); \
190 | if(__cap <= vector_size(vec)) { \
191 | vector_grow((vec), __cap + 1); \
192 | } \
193 | vec[vector_size(vec)] = (value); \
194 | vector_set_size((vec), vector_size(vec) + 1); \
195 | } while(0)
196 |
197 | #endif
198 |
199 | #endif
200 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Daniel Krupiński
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 | # Anubis [](https://en.wikipedia.org/wiki/C) [](https://store.steampowered.com/app/730/CounterStrike_Global_Offensive/) [](https://en.wikipedia.org/wiki/Microsoft_Windows) [](https://en.wikipedia.org/wiki/X86) [](LICENSE)
2 |
3 | Free open-source training software / cheat for **Counter-Strike: Global Offensive** game. Designed as internal cheat - [Dynamic-link library](https://en.wikipedia.org/wiki/Dynamic-link_library) (DLL) loadable into game process. Compatible with the latest version of the game on Steam.
4 |
5 | ## Features
6 |
7 | * **Glow** - render glow effect on entities
8 | * **Misc** - miscellaneous features
9 | * **Config** - JSON-based configuration system
10 |
11 |
12 | Features in depth
13 |
14 | * **Glow** - render glow effect on entities
15 |
16 | *Allies, Enemies, Planting (player planting bomb), Defusing (player defusing bomb), Local player, Weapons (dropped weapons), C4, Planted C4, Chickens* **/** *All, Visible, Occluded*
17 |
18 | * **Enabled** - on / off master switch
19 | * **Health based** - color is based on player's hp
20 | * **Rainbow** - change color frequently
21 | * **Thickness** - outline thickness
22 | * **Alpha** - outline alpha
23 | * **Style** - glow style [*0*-*3*]
24 |
25 | * **Misc** - miscellaneous features
26 | * **Auto strafe** - automatically strafe in air following mouse movement
27 | * **Bunny hop** - automatically simulate space bar press / release while jump button is being held; increases movement speed
28 | * **Moonwalk** - break walking animation
29 |
30 | * **Config** - JSON-based configuration system
31 | * **Create config** - create new configuration file
32 | * **Reset config** - restore default configuration settings (does not touch saved configuration)
33 | * **Load selected** - load selected configuration file
34 | * **Save selected** - save selected configuration file
35 | * **Delete selected** - delete selected configuration file
36 |
37 |
38 | ## Getting started
39 |
40 | ### Prerequisites
41 | Microsoft Visual Studio 2019 (preferably latest version i.e. 16.0.3), platform toolset v142 and Windows SDK 10.0 are required in order to compile Anubis. If you don't have ones, you can download VS [here](https://visualstudio.microsoft.com/) (Windows SDK is installed during Visual Studio Setup).
42 |
43 | ### Cloning
44 | The very first step in order to compile Anubis is to clone this repo from GitHub to your local computer. Git is required to step futher, if not installed download it [here](https://git-scm.com). Open git bash / git cmd / cmd and enter following command:
45 | ```
46 | git clone https://github.com/danielkrupinski/Anubis.git
47 | ```
48 | `Anubis` folder should have been succesfully created, containing all the source files.
49 |
50 | ### Compiling from source
51 |
52 | When you have equiped a copy of source code, next step is opening **Anubis.sln** in Microsoft Visual Studio 2017.
53 |
54 | Then change build configuration to `Release | x86` and simply press **Build solution**.
55 |
56 | If everything went right you should receive `Anubis.dll` binary file.
57 |
58 | ### Loading / Injecting into game process
59 |
60 | Open your favorite [DLL injector](https://en.wikipedia.org/wiki/DLL_injection) and just inject `Anubis.dll` into `csgo.exe` process.
61 |
62 | When injected, menu is openable under `INSERT` key.
63 |
64 |
--------------------------------------------------------------------------------