From b34da981398d5baf49a9db2cc102466cddebc06b Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Mon, 8 Jun 2026 17:44:00 +0700 Subject: [PATCH] unsloppify comments --- header/D3D9Hooks.h | 9 --------- header/D3D9State.h | 5 ++--- header/Main.h | 2 -- modules/TextureClient.ixx | 7 ++----- source/dll_main.cpp | 11 +++-------- 5 files changed, 7 insertions(+), 27 deletions(-) diff --git a/header/D3D9Hooks.h b/header/D3D9Hooks.h index feadc6b..7d59f43 100644 --- a/header/D3D9Hooks.h +++ b/header/D3D9Hooks.h @@ -2,17 +2,8 @@ #include -// Hooks the IDirect3D9(Ex) CreateDevice slot on the real object returned by -// Direct3DCreate9(Ex); `is_ex` also hooks CreateDeviceEx. Requires a prior -// MH_Initialize() (done in dll_main). void InstallD3D9Hooks(IDirect3D9* d3d9, bool is_ex); -// Reverts every gMod hook, leaving the host process as it was. Safe if nothing -// was hooked. void RemoveAllD3D9Hooks(); -// Registers a device that already existed when gMod was injected, so the -// CreateDevice hook never ran: hooks its vtable and stands up a TextureClient. -// Textures created from here on are modded; pre-existing ones stay unknown. -// Returns false if the device is null or already registered. bool RegisterExistingDevice(IDirect3DDevice9* device); diff --git a/header/D3D9State.h b/header/D3D9State.h index 8c9d7ae..c423f36 100644 --- a/header/D3D9State.h +++ b/header/D3D9State.h @@ -3,9 +3,8 @@ #include #include "Defines.h" -// Per-texture side-state, kept in lookups keyed by the real texture pointer (see -// D3D9Hooks.h). Holding it out-of-band leaves the game's own objects untouched, -// so reverting the vtable hooks fully detaches gMod. +// Per-texture side-state, keyed by the real texture pointer (see D3D9Hooks.h). +// Held out-of-band so reverting the vtable hooks fully detaches gMod. enum class TexType { Tex2D, diff --git a/header/Main.h b/header/Main.h index c099c07..df387cd 100644 --- a/header/Main.h +++ b/header/Main.h @@ -17,8 +17,6 @@ #include "Defines.h" #include "Error.h" -// gMod no longer subclasses the D3D9 interfaces; it hooks their vtable slots and -// keeps per-object side-state in lookups (see D3D9State.h / D3D9Hooks.h). #include "D3D9State.h" #pragma warning(disable : 4477) diff --git a/modules/TextureClient.ixx b/modules/TextureClient.ixx index 4b84471..4cff317 100644 --- a/modules/TextureClient.ixx +++ b/modules/TextureClient.ixx @@ -40,11 +40,8 @@ public: } }; -/* - * Owned by each d3d9 device (see D3D9Hooks.cpp). Holds the side-state for every - * texture and performs the actual modding. The On*() methods are the vtable-hook - * entry points, all driven by the game's render thread. - */ +// Owned by each d3d9 device (see D3D9Hooks.cpp). Holds per-texture side-state +// and does the modding; the On*() methods are the vtable-hook entry points. export class TextureClient { public: TextureClient(IDirect3DDevice9* device); diff --git a/source/dll_main.cpp b/source/dll_main.cpp index ffc52f6..ad5a588 100644 --- a/source/dll_main.cpp +++ b/source/dll_main.cpp @@ -177,9 +177,6 @@ HRESULT APIENTRY Direct3DCreate9Ex(UINT SDKVersion, IDirect3D9Ex** ppD3D) return ret; } -/* - * dll entry routine, here we initialize or clean up - */ BOOL WINAPI DllMain(HINSTANCE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { UNREFERENCED_PARAMETER(lpReserved); @@ -254,9 +251,8 @@ void InitInstance(HINSTANCE hModule) } } -// Exported entry for late injection: hand gMod a device that already exists -// (IDirect3DDevice9Ex* works too) so it hooks the vtable and mods textures from -// here on. Returns RETURN_OK if newly registered, RETURN_EXISTS if already known. +// Exported entry for late injection: hand gMod an existing device so it hooks +// the vtable and mods textures from here on. extern "C" __declspec(dllexport) int __cdecl SetDevice(IDirect3DDevice9* device) { if (!device) return RETURN_BAD_ARGUMENT; @@ -290,9 +286,8 @@ extern "C" __declspec(dllexport) int __cdecl RemoveFile(const wchar_t* path) } } -// nullptr first arg = return required size +// nullptr first arg = return required size; paths come back in load (priority) order // returns paths separated by null terminator, e.g. "C:\foo.tpf\0C:\bar.zip\0\0" -// Paths come back in load order (== priority order). extern "C" __declspec(dllexport) int __cdecl GetFiles(wchar_t* buffer, const size_t buffer_size_chars) { try {