11 Commits

Author SHA1 Message Date
Jon ac39241ff9 Release replacement textures when a client is torn down (#38)
* 1.9

* Release replacement textures when a client is torn down

TextureClient::~TextureClient deleted the per-texture side-state but never
released the replacement IDirect3DTexture9 objects gMod created. That's
fine when the client dies because the device hit refcount 0 (a texture
refs its device, so by then every fake is already released and the maps
are empty). But when gMod is unloaded via FreeLibrary while the game's
device is still alive (late-injected/SetDevice integrations), the maps
are full of textures gMod still owns and they all leak - and ExitInstance
never deleted the clients, so the destructor didn't even run.

- ~TextureClient now releases each replacement it still owns (a fake is
  still owned while it has a partner; an orphaned fake was already
  released and is left alone). No-op in the device-release path.
- Add DestroyAllTextureClients() to delete the per-device clients.
- ExitInstance calls it, gated on a genuine FreeLibrary
  (lpReserved == nullptr) so it's skipped during process termination
  where the device/d3d9 may already be gone.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Jon <>
Co-authored-by: Marc <m@pyc.ac>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-08 17:14:10 +01:00
DubbleClick b34da98139 unsloppify comments 2026-06-08 17:44:00 +07:00
henderkes 17c7d5bdfc Replace D3D9 proxy wrappers with vtable hooks 2026-06-08 17:15:02 +07:00
DubbleClick 5be00dd712 make umod able to load and unload per dll export call 2026-05-01 16:31:40 +07:00
Marc 4fa1d8e2c5 1.8.0 (#35)
* change tpfconvert functionality to backup into backup folder

* use vcpkg for more packages

* update readme, bump to 1.7.0.2

* rework dll path

* https://github.com/gwdevhub/gMod/issues/33

* v1.7.0.3

* debug mode enabled

* fix... something... somehow??? @STL can you explain this???

* safety

* 1.8.0.0
2026-01-09 00:43:28 +01:00
Marc b060e25ee2 v1.7.0.3 (#34)
* change tpfconvert functionality to backup into backup folder

* use vcpkg for more packages

* update readme, bump to 1.7.0.2

* rework dll path

* https://github.com/gwdevhub/gMod/issues/33

* v1.7.0.3
2025-07-20 22:08:50 +07:00
DubbleClick 175002a9e4 1.7.0.1 (#30)
* read modlist.txt files immediately on launch, textures still loaded on d3d creation
2024-11-10 23:06:49 +07:00
DubbleClick fd9d1af477 support 64 bit hashes (#27)
* use image.OverrideFormat()

* 1.6.4

* import std

* uninitialised member variable

* debug statement for 64 bit hash testing

* nopetynope

* uint32_t

* support for 64 bit hashes, but rip compute time :/

* refactor weird comments and constructors

* 1.7.0.0 because of 64 bit hashes

* only check crc64 if at least one mod with crc64 is loaded

* do some dumb shit to deal with incorrect bmps somehow (needs work)

* remove image interpretation for bmps

* create TpfConvert.exe to convert tpf files easily

* attempt

* set up vcpkg and install d3dx though that

* missing env variable?

* Win32 architecture

* update ci to tag TpfConvert.exe and d3dx9.dll as well (required to run TpfConvert)

* documentation
2024-09-28 12:15:04 +02:00
DubbleClick 21c20c80e5 fix unicode characters like Umlaute üäÜÖßéè 2023-12-20 16:50:49 +01:00
DubbleClick 7dbbdc480e fix potentially wrong texture loading order (#20)
* add gsl library to track memory allocations

* rework creation to respect mod order
slight slowdown but just to be safe

* 1.6.1

* print info on timing

* specify largeaddressaware (shouldn't matter since gw is linked with it, but can't hurt)
2023-12-05 16:11:44 +01:00
DubbleClick 9e593e83ee remove d3dx dependency, severely improve memory usage if necessary (#19)
* basic tga/hdr image loading

* bgr tga tex

* convert to dds during loading
doesn't work yet, fails to create textures from dds memory

* remove ext member from TextureFileStruct

* do not convert images, leads to weird loading problems...

* use regex matching for tpf loading

* convert non-RGBA images to RGBA

* remove d3dx (mostly)

* fix moving wrong image

* move TextureFunction to module

* move FileLoader to ModfileLoader module

* move TextureClient to module

* spaces

* ifdef debug

* 1.6.0

* compress images to dxt5 (bc3_unorm) to use less memory

* remove unnecessary directxtex source code patch

* don't move unnecessarily

* only compress if mods in filesystem use up more than 400mb

* use std::future to prepare to multithread image loading
fails when using std::launch::async though, maybe something in the directxtex library is not thread safe

* remove d3dx sdk from workflows

* remove extern "C"

* catch exception when saving texture

* make loading async (call CoInitializeEx)

* support DXGI_FORMAT_BC1_UNORM (DXT1) compressed textures without warning

* don't warn for BC2 BC4 or BC5 either

* update README.md
2023-12-04 19:50:56 +01:00