Bugs fix:

- OTM_FileHandler::Remove and OTM_TextureHandler::Remove set now the correct Reference
- SingleTexture is deleted, if device is released the last time
- if original texture is released the last time and it is linked with SingleTexture, SingleTexture is not released any more
- texture->AddRef is now directed to the original texture (if texture was switched)
- texture->Release() is now directed to the original texture (if texture is switched)

improvement:
- texture->Release(): if a texture is released which was switched also the fake texture is released, for that no OTM_TextureHandler FakeTextures is needed any more.
- you can run the makefile with NO_INJECTION=1 and a dll without hook is compiled, copy this dll to the game directory, if you don't like to or even can't use the dll-injection over hooking.
This commit is contained in:
code@koerner-de.net
2011-09-12 19:14:20 +00:00
parent 7d2c28fdc5
commit b24123ddca
10 changed files with 102 additions and 48 deletions
+6 -6
View File
@@ -95,9 +95,10 @@ int OTM_FileHandler::Remove(TextureFileStruct* file)
int ref = file->Reference;
if (ref<0) return (RETURN_OK); // returning if no Reference is set
file->Reference = -1;
if (ref<--Number)
if (ref<(--Number))
{
Files[ref/FieldLength][ref%FieldLength] = Files[Number/FieldLength][Number%FieldLength];
Files[ref/FieldLength][ref%FieldLength]->Reference = ref;
}
return (RETURN_OK);
}
@@ -158,7 +159,7 @@ int OTM_TextureHandler::Add(OTM_IDirect3DTexture9* pTexture)
Message("OTM_TextureHandler::Add( %lu): %lu\n", pTexture, this);
if (gl_ErrorState & OTM_ERROR_FATAL) return (RETURN_FATAL_ERROR);
if (pTexture->TextureHandlerRef>=0) return (RETURN_TEXTURE_ALLREADY_ADDED);
if (pTexture->Reference>=0) return (RETURN_TEXTURE_ALLREADY_ADDED);
if (Number/FieldLength==FieldCounter)
{
@@ -192,7 +193,7 @@ int OTM_TextureHandler::Add(OTM_IDirect3DTexture9* pTexture)
}
Textures[Number/FieldLength][Number%FieldLength] = pTexture;
pTexture->TextureHandlerRef = Number++;
pTexture->Reference = Number++;
return (RETURN_OK);
}
@@ -203,14 +204,13 @@ int OTM_TextureHandler::Remove(OTM_IDirect3DTexture9* pTexture) //will be called
Message("OTM_TextureHandler::Remove( %lu): %lu\n", pTexture, this);
if (gl_ErrorState & OTM_ERROR_FATAL) return (RETURN_FATAL_ERROR);
int ref = pTexture->TextureHandlerRef;
int ref = pTexture->Reference;
if (ref<0) return (RETURN_OK); // returning if no TextureHandlerRef is set
UnswitchTextures( pTexture);
if (ref<(--Number))
{
Textures[ref/FieldLength][ref%FieldLength] = Textures[Number/FieldLength][Number%FieldLength];
Textures[ref/FieldLength][ref%FieldLength]->Reference = ref;
}
return (RETURN_OK);
}