mirror of
https://github.com/gwdevhub/gMod.git
synced 2026-07-15 15:09:30 +00:00
unsloppify comments
This commit is contained in:
@@ -2,17 +2,8 @@
|
||||
|
||||
#include <d3d9.h>
|
||||
|
||||
// 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);
|
||||
|
||||
+2
-3
@@ -3,9 +3,8 @@
|
||||
#include <d3d9.h>
|
||||
#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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
+3
-8
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user