1.5.6, severely improve memory footprint and loading speed (#13)

* remove more unnecessary code

* todo?

* 1.5.5.0

* change GetHash from in_out parameter to return the hash

* remove ForceReload bool for textures

* remove textureserver, place logic in textureclient, not yet finished
next up change FileToMod and shit to use modded_textures map

* fix debug compilation errors

* fix typo

* should_update boolean, replace the entire MergeUpdate logic later

* tidy up d3d9_dll.cpp and bits (#12)

* define `ASSERT`
Added minhook lib to tidy up hooks
Remove cruft from dx9_dll.cpp

* Bug fix

* Another typo

---------

Co-authored-by: Jon <>

* gitignore

* Proxy functions, cache dx9 device type

* simplify LoadModsFromFile

* move minhook dependency to fetch content

* Make it work

* Tweaked debug for file reads

* Fixed inverse check

* unordered_map

* set should_update (yikes)

* simplify libzippp.cmake

* remove unnecessary code

* rename project files (keep uMod_ prefix only for d3d9 classes)

* remove unused Nothing() function

* remove unnecessary fields

* remove some code duplication

refactor methods together

* refactor SwitchTextures and UnswitchTextures together

* move loaded_size into function

* enable libzippp encryption again

* copy data from opened zipentry and then delete the entry

* fix hash bug in volume textures

* const

* change uMod_TextureClient to TextureClient

* revert libzippp.cmake

* 1.5.6
This commit is contained in:
DubbleClick
2023-11-22 21:50:11 +01:00
committed by GitHub
parent 13b7df3ae3
commit f07e180b53
44 changed files with 919 additions and 2562 deletions
+12 -20
View File
@@ -1,4 +1,4 @@
#include "uMod_Main.h"
#include "Main.h"
#ifndef RETURN_QueryInterface
#define RETURN_QueryInterface 0x01000000L
@@ -24,7 +24,6 @@ int uMod_IDirect3DDevice9::CreateSingleTexture()
}
LastCreatedTexture = nullptr; // set LastCreatedTexture to NULL, cause LastCreatedTexture is equal SingleTexture
SingleTexture->FAKE = true; //this is no texture created from by game
SingleTexture->Reference = -2;
}
{
@@ -54,7 +53,6 @@ int uMod_IDirect3DDevice9::CreateSingleTexture()
}
LastCreatedVolumeTexture = nullptr; // set LastCreatedTexture to NULL, cause LastCreatedTexture is equal SingleTexture
SingleVolumeTexture->FAKE = true; //this is no texture created from by game
SingleVolumeTexture->Reference = -2;
}
{
@@ -83,7 +81,6 @@ int uMod_IDirect3DDevice9::CreateSingleTexture()
}
LastCreatedCubeTexture = nullptr; // set LastCreatedTexture to NULL, cause LastCreatedTexture is equal SingleTexture
SingleCubeTexture->FAKE = true; //this is no texture created from by game
SingleCubeTexture->Reference = -2;
}
{
@@ -109,15 +106,15 @@ int uMod_IDirect3DDevice9::CreateSingleTexture()
return RETURN_OK;
}
uMod_IDirect3DDevice9::uMod_IDirect3DDevice9(IDirect3DDevice9* pOriginal, uMod_TextureServer* server, int back_buffer_count)
uMod_IDirect3DDevice9::uMod_IDirect3DDevice9(IDirect3DDevice9* pOriginal, int back_buffer_count)
{
Message(PRE_MESSAGE "::" PRE_MESSAGE "( %p, %p): %p\n", pOriginal, server, this);
Message(PRE_MESSAGE "::" PRE_MESSAGE " (%p): %p\n", pOriginal, this);
BackBufferCount = back_buffer_count;
NormalRendering = true;
uMod_Server = server;
uMod_Client = new uMod_TextureClient(uMod_Server, this); //get a new texture client for this device
uMod_Client = new TextureClient(this); //get a new texture client for this device
uMod_Client->Initialize();
LastCreatedTexture = nullptr;
LastCreatedVolumeTexture = nullptr;
@@ -422,12 +419,10 @@ HRESULT uMod_IDirect3DDevice9::UpdateTexture(IDirect3DBaseTexture9* pSourceTextu
uMod_IDirect3DCubeTexture9* pSourceCube = nullptr;
IDirect3DBaseTexture9* cpy;
if (pSourceTexture != nullptr) {
long int ret = pSourceTexture->QueryInterface(IID_IDirect3D9, (void**)&cpy);
switch (ret) {
switch (pSourceTexture->QueryInterface(IID_IDirect3D9, (void**)&cpy)) {
case 0x01000000L: {
MyTypeHash hash;
pSource = static_cast<uMod_IDirect3DTexture9*>(pSourceTexture);
if (pSource->GetHash(hash) == RETURN_OK) {
if (const auto hash = pSource->GetHash()) {
if (hash != pSource->Hash) // this hash has changed !!
{
pSource->Hash = hash;
@@ -451,9 +446,8 @@ HRESULT uMod_IDirect3DDevice9::UpdateTexture(IDirect3DBaseTexture9* pSourceTextu
break;
}
case 0x01000001L: {
MyTypeHash hash;
pSourceVolume = static_cast<uMod_IDirect3DVolumeTexture9*>(pSourceTexture);
if (pSourceVolume->GetHash(hash) == RETURN_OK) {
if (const auto hash = pSource->GetHash()) {
if (hash != pSourceVolume->Hash) // this hash has changed !!
{
pSourceVolume->Hash = hash;
@@ -477,9 +471,8 @@ HRESULT uMod_IDirect3DDevice9::UpdateTexture(IDirect3DBaseTexture9* pSourceTextu
break;
}
case 0x01000002L: {
MyTypeHash hash;
pSourceCube = static_cast<uMod_IDirect3DCubeTexture9*>(pSourceTexture);
if (pSourceCube->GetHash(hash) == RETURN_OK) {
if (const auto hash = pSourceCube->GetHash()) {
if (hash != pSourceCube->Hash) // this hash has changed !!
{
pSourceCube->Hash = hash;
@@ -509,10 +502,9 @@ HRESULT uMod_IDirect3DDevice9::UpdateTexture(IDirect3DBaseTexture9* pSourceTextu
if (pDestinationTexture != nullptr) {
long int ret = pSourceTexture->QueryInterface(IID_IDirect3D9, (void**)&cpy);
switch (ret) {
switch (pSourceTexture->QueryInterface(IID_IDirect3D9, (void**)&cpy)) {
case 0x01000000L: {
auto pDest = static_cast<uMod_IDirect3DTexture9*>(pDestinationTexture);
const auto pDest = static_cast<uMod_IDirect3DTexture9*>(pDestinationTexture);
if (pSource != nullptr && pDest->Hash != pSource->Hash) {
pDest->Hash = pSource->Hash; // take over the hash
@@ -532,7 +524,7 @@ HRESULT uMod_IDirect3DDevice9::UpdateTexture(IDirect3DBaseTexture9* pSourceTextu
break;
}
case 0x01000001L: {
auto pDest = static_cast<uMod_IDirect3DVolumeTexture9*>(pDestinationTexture);
const auto pDest = static_cast<uMod_IDirect3DVolumeTexture9*>(pDestinationTexture);
if (pSourceVolume != nullptr && pDest->Hash != pSourceVolume->Hash) {
pDest->Hash = pSourceVolume->Hash; // take over the hash