From fab93611c1ef05087dbec125c9365ad8a6c225f9 Mon Sep 17 00:00:00 2001 From: "code@koerner-de.net" Date: Tue, 8 Nov 2011 14:00:53 +0000 Subject: [PATCH] BugFix: - OTM_TextureClient::MergeUpdate: force reload does now switch the correct texture (previously it lead to a crash) - OTM_TextureClient::MergeUpdate: volume and cube textures are now loaded (if they were not loaded before) - OTM_TextureServer: if textures were added more than once, they could not be deleted correctly - OTM_Sender::SendTextures: if texture were loaded, but get unloaded due to a rearranging of the list, they are now marked correctly as unloaded Improvements: - OTM keeps in mind the actual window position - added a MORE_TEXTURES flag for the pipe comunication: if more data is written to the pipe, than the size of the buffer, the Mainloop of the OTM_TextureServer will wait for the rest of the date before it prepare an update for the OTM_TextureClient. - added the last missing texture formats of D3DFORMAT (except two formats) --- OTM_DX9/OTM_TextureClient.cpp | 163 +++++++++++++----- OTM_DX9/OTM_TextureClient.h | 8 +- OTM_DX9/OTM_TextureFunction.h | 43 ++++- OTM_DX9/OTM_TextureServer.cpp | 18 +- OTM_GUI/OTM_GUI.cpp | 3 +- OTM_GUI/OTM_Language.cpp | 2 +- OTM_GUI/OTM_Sender.cpp | 48 ++++-- OTM_GUI/OTM_Settings.cpp | 25 ++- OTM_GUI/OTM_Settings.h | 1 + OTM_GUI/bin/README_Deutsch.txt | 2 +- OTM_GUI/bin/README_English.txt | 2 +- .../languages/OTM_LanguagePackU_Deutsch.txt | Bin 5048 -> 5064 bytes .../languages/OTM_LanguagePackU_Russian.txt | Bin 5368 -> 5384 bytes OTM_GlobalDefines.h | 1 + 14 files changed, 244 insertions(+), 72 deletions(-) diff --git a/OTM_DX9/OTM_TextureClient.cpp b/OTM_DX9/OTM_TextureClient.cpp index 9425065..4fe51ab 100644 --- a/OTM_DX9/OTM_TextureClient.cpp +++ b/OTM_DX9/OTM_TextureClient.cpp @@ -154,6 +154,8 @@ int OTM_TextureClient::RemoveTexture( OTM_IDirect3DTexture9* pTexture) // is cal { FileToMod[ref].NumberOfTextures--; for (int j=i; jRelease(); // we release the fake textures + for (int i=FileToMod[pos_old].NumberOfTextures-1; i>=0; i--) FileToMod[pos_old].Textures[i]->Release(); // we release the fake textures if (FileToMod[pos_old].Textures!=NULL) delete [] FileToMod[pos_old].Textures; // we delete the memory + FileToMod[pos_old].NumberOfTextures = 0; + FileToMod[pos_old].Textures = NULL; + pos_old++; // we increase only the old counter by one } else // the hash value is the same, thus this texture is in the array FileToMod as well as in the array Update @@ -380,13 +389,14 @@ int OTM_TextureClient::MergeUpdate(void) { OTM_IDirect3DTexture9 *pTexture = (OTM_IDirect3DTexture9*) FileToMod[pos_old].Textures[i];// OTM_IDirect3DTexture9 *pRefTexture = pTexture->CrossRef_D3Dtex; - FileToMod[pos_old].Textures[i]->Release(); - FileToMod[pos_old].Textures[i] = NULL; + pTexture->Release(); + i--; //after the Release of the old fake texture FileToMod[pos_old].Textures[i] is overwritten by entries with index greater than i + OTM_IDirect3DTexture9 *fake_Texture; if (int ret = LoadTexture( & (Update[pos_new]), &fake_Texture)) return (ret); - if (SwitchTextures( fake_Texture, pTexture)) + if (SwitchTextures( fake_Texture, pRefTexture)) { - Message("MergeUpdate(): textures not switched %#lX\n", pTexture->Hash); + Message("MergeUpdate(): textures not switched %#lX\n", pRefTexture->Hash); fake_Texture->Release(); } else @@ -400,13 +410,14 @@ int OTM_TextureClient::MergeUpdate(void) { OTM_IDirect3DVolumeTexture9 *pTexture = (OTM_IDirect3DVolumeTexture9*) FileToMod[pos_old].Textures[i];// OTM_IDirect3DVolumeTexture9 *pRefTexture = pTexture->CrossRef_D3Dtex; - FileToMod[pos_old].Textures[i]->Release(); - FileToMod[pos_old].Textures[i] = NULL; + pTexture->Release(); + i--; //after the Release of the old fake texture FileToMod[pos_old].Textures[i] is overwritten by entries with index greater than i + OTM_IDirect3DVolumeTexture9 *fake_Texture; if (int ret = LoadTexture( & (Update[pos_new]), &fake_Texture)) return (ret); - if (SwitchTextures( fake_Texture, pTexture)) + if (SwitchTextures( fake_Texture, pRefTexture)) { - Message("MergeUpdate(): textures not switched %#lX\n", pTexture->Hash); + Message("MergeUpdate(): textures not switched %#lX\n", pRefTexture->Hash); fake_Texture->Release(); } else @@ -420,13 +431,14 @@ int OTM_TextureClient::MergeUpdate(void) { OTM_IDirect3DCubeTexture9 *pTexture = (OTM_IDirect3DCubeTexture9*) FileToMod[pos_old].Textures[i];// OTM_IDirect3DCubeTexture9 *pRefTexture = pTexture->CrossRef_D3Dtex; - FileToMod[pos_old].Textures[i]->Release(); - FileToMod[pos_old].Textures[i] = NULL; + pTexture->Release(); + i--; //after the Release of the old fake texture FileToMod[pos_old].Textures[i] is overwritten by entries with index greater than i + OTM_IDirect3DCubeTexture9 *fake_Texture; if (int ret = LoadTexture( & (Update[pos_new]), &fake_Texture)) return (ret); - if (SwitchTextures( fake_Texture, pTexture)) + if (SwitchTextures( fake_Texture, pRefTexture)) { - Message("MergeUpdate(): textures not switched %#lX\n", pTexture->Hash); + Message("MergeUpdate(): textures not switched %#lX\n", pRefTexture->Hash); fake_Texture->Release(); } else @@ -445,6 +457,7 @@ int OTM_TextureClient::MergeUpdate(void) { Update[pos_new].NumberOfTextures = FileToMod[pos_old].NumberOfTextures; Update[pos_new].Textures = FileToMod[pos_old].Textures; + FileToMod[pos_old].NumberOfTextures = 0; FileToMod[pos_old].Textures = NULL; } // we increase both counters by one @@ -455,8 +468,10 @@ int OTM_TextureClient::MergeUpdate(void) while (pos_oldRelease(); // we release the fake textures + for (int i=FileToMod[pos_old].NumberOfTextures-1; i>=0; i--) FileToMod[pos_old].Textures[i]->Release(); // we release the fake textures + //for (int i=0; iRelease(); // we release the fake textures if (FileToMod[pos_old].Textures!=NULL) delete [] FileToMod[pos_old].Textures; // we delete the memory + FileToMod[pos_old].Textures = NULL; pos_old++; } while (pos_newGetSingleTexture(); if (num_to_lookup>0) { @@ -497,7 +512,6 @@ int OTM_TextureClient::MergeUpdate(void) // Note: contradicting to normal C-code here the interval includes the index "begin" and "end"! while (begin+1 Update[to_lookup[pos]].Hash) // the new interval is the right half of the actual interval { begin = pos+1; // the new interval does not contain the index "pos" @@ -540,14 +554,50 @@ int OTM_TextureClient::MergeUpdate(void) } } } +*/ + + if (FileToMod!=NULL) + { + //for (int i=0; i0) + { + OTM_IDirect3DTexture9 *single_texture = ((OTM_IDirect3DDevice9*)D3D9Device)->GetSingleTexture(); + int num = OriginalTextures.GetNumber(); + for (int i=0; iCrossRef_D3Dtex==NULL || OriginalTextures[i]->CrossRef_D3Dtex==single_texture) + { + UnswitchTextures(OriginalTextures[i]); //this we can do always, so we unswitch the single texture + LookUpToMod( OriginalTextures[i], num_to_lookup, to_lookup); + } + OTM_IDirect3DVolumeTexture9 *single_volume_texture = ((OTM_IDirect3DDevice9*)D3D9Device)->GetSingleVolumeTexture(); + num = OriginalVolumeTextures.GetNumber(); + for (int i=0; iCrossRef_D3Dtex==NULL || OriginalVolumeTextures[i]->CrossRef_D3Dtex==single_volume_texture) + { + UnswitchTextures(OriginalVolumeTextures[i]); //this we can do always, so we unswitch the single texture + LookUpToMod( OriginalVolumeTextures[i], num_to_lookup, to_lookup); + } + OTM_IDirect3DCubeTexture9 *single_cube_texture = ((OTM_IDirect3DDevice9*)D3D9Device)->GetSingleCubeTexture(); + num = OriginalCubeTextures.GetNumber(); + for (int i=0; iCrossRef_D3Dtex==NULL || OriginalCubeTextures[i]->CrossRef_D3Dtex==single_cube_texture) + { + UnswitchTextures(OriginalCubeTextures[i]); //this we can do always, so we unswitch the single texture + LookUpToMod( OriginalCubeTextures[i], num_to_lookup, to_lookup); + } + } + + + + if (to_lookup != NULL) delete [] to_lookup; + return (UnlockMutex()); } @@ -570,42 +620,71 @@ int OTM_TextureClient::UnlockMutex(void) -int OTM_TextureClient::LookUpToMod( MyTypeHash hash) +int OTM_TextureClient::LookUpToMod( MyTypeHash hash, int num_index_list, int *index_list) { if(NumberToMod>0) { - if (hashFileToMod[NumberToMod-1].Hash) return (-1); - int pos = NumberToMod/2; - int begin = 0; - int end = NumberToMod-1; - - // We look in the middle of the interval and each step we halve the interval, - // unless we find the texture or the size of the interval is less than 3. - // Note: contradicting to normal C-code here the interval includes the index "begin" and "end"! - while (begin+1 FileToMod[pos].Hash) // the new interval is the right half of the actual interval + if (hashFileToMod[NumberToMod-1].Hash) return (-1); + int pos = NumberToMod/2; + int begin = 0; + int end = NumberToMod-1; + + // We look in the middle of the interval and each step we halve the interval, + // unless we find the texture or the size of the interval is less than 3. + // Note: contradicting to normal C-code here the interval includes the index "begin" and "end"! + while (begin+1 FileToMod[pos].Hash) // the new interval is the right half of the actual interval + { + begin = pos+1; // the new interval does not contain the index "pos" + pos = (begin + end)/2; // set "pos" somewhere inside the new intervall + } + else if (hash < FileToMod[pos].Hash) // the new interval is the left half of the actual interval + { + end = pos-1; // the new interval does not contain the index "pos" + pos = (begin + end)/2; // set "pos" somewhere inside the new intervall + } + else {return (pos); break;} // we hit the correct hash } - else if (hash < FileToMod[pos].Hash) // the new interval is the left half of the actual interval + for ( pos=begin; pos<=end; pos++) if (FileToMod[pos].Hash==hash) return (pos); + } + else + { + if (hashFileToMod[index_list[num_index_list-1]].Hash) return (-1); + int pos = num_index_list/2; + int begin = 0; + int end = num_index_list-1; + + // We look in the middle of the interval and each step we halve the interval, + // unless we find the texture or the size of the interval is less than 3. + // Note: contradicting to normal C-code here the interval includes the index "begin" and "end"! + while (begin+1 FileToMod[index_list[pos]].Hash) // the new interval is the right half of the actual interval + { + begin = pos+1; // the new interval does not contain the index "pos" + pos = (begin + end)/2; // set "pos" somewhere inside the new intervall + } + else if (hash < FileToMod[index_list[pos]].Hash) // the new interval is the left half of the actual interval + { + end = pos-1; // the new interval does not contain the index "pos" + pos = (begin + end)/2; // set "pos" somewhere inside the new intervall + } + else {return (index_list[pos]); break;} // we hit the correct hash } - else {return (pos); break;} // we hit the correct hash + for ( pos=begin; pos<=end; pos++) if (FileToMod[index_list[pos]].Hash==hash) return (index_list[pos]); } - for (int i=begin; i<=end; i++) if (FileToMod[i].Hash==hash) return (i); } return (-1); } -int OTM_TextureClient::LookUpToMod( OTM_IDirect3DTexture9* pTexture) // should only be called for original textures +int OTM_TextureClient::LookUpToMod( OTM_IDirect3DTexture9* pTexture, int num_index_list, int *index_list) // should only be called for original textures { Message("OTM_TextureClient::LookUpToMod( %lu): hash: %#lX, %lu\n", pTexture, pTexture->Hash, this); if (pTexture->CrossRef_D3Dtex!=NULL) return (RETURN_OK); // bug, this texture is already switched - int index = LookUpToMod( pTexture->Hash); + int index = LookUpToMod( pTexture->Hash, num_index_list, index_list); if (index>=0) { OTM_IDirect3DTexture9 *fake_Texture; @@ -630,11 +709,11 @@ int OTM_TextureClient::LookUpToMod( OTM_IDirect3DTexture9* pTexture) // should o return (RETURN_OK); } -int OTM_TextureClient::LookUpToMod( OTM_IDirect3DVolumeTexture9* pTexture) // should only be called for original textures +int OTM_TextureClient::LookUpToMod( OTM_IDirect3DVolumeTexture9* pTexture, int num_index_list, int *index_list) // should only be called for original textures { Message("OTM_TextureClient::LookUpToMod( Volume %lu): hash: %#lX, %lu\n", pTexture, pTexture->Hash, this); if (pTexture->CrossRef_D3Dtex!=NULL) return (RETURN_OK); // bug, this texture is already switched - int index = LookUpToMod( pTexture->Hash); + int index = LookUpToMod( pTexture->Hash, num_index_list, index_list); if (index>=0) { OTM_IDirect3DVolumeTexture9 *fake_Texture; @@ -659,11 +738,11 @@ int OTM_TextureClient::LookUpToMod( OTM_IDirect3DVolumeTexture9* pTexture) // sh return (RETURN_OK); } -int OTM_TextureClient::LookUpToMod( OTM_IDirect3DCubeTexture9* pTexture) // should only be called for original textures +int OTM_TextureClient::LookUpToMod( OTM_IDirect3DCubeTexture9* pTexture, int num_index_list, int *index_list) // should only be called for original textures { Message("OTM_TextureClient::LookUpToMod( Cube %lu): hash: %#lX, %lu\n", pTexture, pTexture->Hash, this); if (pTexture->CrossRef_D3Dtex!=NULL) return (RETURN_OK); // bug, this texture is already switched - int index = LookUpToMod( pTexture->Hash); + int index = LookUpToMod( pTexture->Hash, num_index_list, index_list); if (index>=0) { OTM_IDirect3DCubeTexture9 *fake_Texture; diff --git a/OTM_DX9/OTM_TextureClient.h b/OTM_DX9/OTM_TextureClient.h index 35d938e..44ba366 100644 --- a/OTM_DX9/OTM_TextureClient.h +++ b/OTM_DX9/OTM_TextureClient.h @@ -71,9 +71,9 @@ public: int AddUpdate(TextureFileStruct* update, int number); //called from the Server, client object must delete update array int MergeUpdate(void); //called from OTM_IDirect3DDevice9::BeginScene() - int LookUpToMod( OTM_IDirect3DTexture9* pTexture); // called at the end AddTexture(...) and from Device->UpdateTexture(...) - int LookUpToMod( OTM_IDirect3DVolumeTexture9* pTexture); // called at the end AddTexture(...) and from Device->UpdateTexture(...) - int LookUpToMod( OTM_IDirect3DCubeTexture9* pTexture); // called at the end AddTexture(...) and from Device->UpdateTexture(...) + int LookUpToMod( OTM_IDirect3DTexture9* pTexture, int num_index_list=0, int *index_list=NULL); // called at the end AddTexture(...) and from Device->UpdateTexture(...) + int LookUpToMod( OTM_IDirect3DVolumeTexture9* pTexture, int num_index_list=0, int *index_list=NULL); // called at the end AddTexture(...) and from Device->UpdateTexture(...) + int LookUpToMod( OTM_IDirect3DCubeTexture9* pTexture, int num_index_list=0, int *index_list=NULL); // called at the end AddTexture(...) and from Device->UpdateTexture(...) OTM_TextureHandler OriginalTextures; // stores the pointer to the OTM_IDirect3DTexture9 objects created by the game OTM_TextureHandler OriginalVolumeTextures; // stores the pointer to the OTM_IDirect3DVolumeTexture9 objects created by the game @@ -105,7 +105,7 @@ private: TextureFileStruct* FileToMod; // array which stores the file in memory and the hash of each texture to be modded - int LookUpToMod( MyTypeHash hash); // called from LookUpToMod(...); + int LookUpToMod( MyTypeHash hash, int num_index_list, int *index_list); // called from LookUpToMod(...); int LoadTexture( TextureFileStruct* file_in_memory, OTM_IDirect3DTexture9 **ppTexture); // called if a target texture is found int LoadTexture( TextureFileStruct* file_in_memory, OTM_IDirect3DVolumeTexture9 **ppTexture); // called if a target texture is found int LoadTexture( TextureFileStruct* file_in_memory, OTM_IDirect3DCubeTexture9 **ppTexture); // called if a target texture is found diff --git a/OTM_DX9/OTM_TextureFunction.h b/OTM_DX9/OTM_TextureFunction.h index 166a10d..da027fe 100644 --- a/OTM_DX9/OTM_TextureFunction.h +++ b/OTM_DX9/OTM_TextureFunction.h @@ -10,7 +10,10 @@ unsigned int GetCRC32( char *pcDatabuf, unsigned int ulDatalen); - +/* + case D3DFMT_MULTI2_ARGB8: + case D3DFMT_VERTEXDATA: + */ inline int GetBitsFromFormat(D3DFORMAT format) { switch(format) //switch trough the formats to calculate the size of the raw data @@ -28,13 +31,17 @@ inline int GetBitsFromFormat(D3DFORMAT format) case D3DFMT_L8: // 8-bit luminance only. case D3DFMT_A4L4: // 8-bit using 4 bits each for alpha and luminance. case D3DFMT_FORCE_DWORD: + case D3DFMT_S8_LOCKABLE: // A lockable 8-bit stencil buffer. { return (8); break; } + case D3DFMT_D16_LOCKABLE: //16-bit z-buffer bit depth. + case D3DFMT_D15S1: // 16-bit z-buffer bit depth where 15 bits are reserved for the depth channel and 1 bit is reserved for the stencil channel. case D3DFMT_L6V5U5: // 16-bit bump-map format with luminance using 6 bits for luminance, and 5 bits each for v and u. case D3DFMT_V8U8: // 16-bit bump-map format using 8 bits each for u and v data. + case D3DFMT_CxV8U8: // 16-bit normal compression format. The texture sampler computes the C channel from: C = sqrt(1 - U2 - V2). case D3DFMT_R5G6B5: // 16-bit RGB pixel format with 5 bits for red, 6 bits for green, and 5 bits for blue. case D3DFMT_X1R5G5B5: // 16-bit pixel format where 5 bits are reserved for each color. case D3DFMT_A1R5G5B5: // 16-bit pixel format where 5 bits are reserved for each color and 1 bit is reserved for alpha. @@ -42,7 +49,14 @@ inline int GetBitsFromFormat(D3DFORMAT format) case D3DFMT_A8R3G3B2: // 16-bit ARGB texture format using 8 bits for alpha, 3 bits each for red and green, and 2 bits for blue. case D3DFMT_X4R4G4B4: // 16-bit RGB pixel format using 4 bits for each color. case D3DFMT_L16: // 16-bit luminance only. + case D3DFMT_R16F: // 16-bit float format using 16 bits for the red channel. case D3DFMT_A8L8: // 16-bit using 8 bits each for alpha and luminance. + case D3DFMT_D16: // 16-bit z-buffer bit depth. + case D3DFMT_INDEX16: // 16-bit index buffer bit depth. + case D3DFMT_G8R8_G8B8: // ?? + case D3DFMT_R8G8_B8G8: // ?? + case D3DFMT_UYVY: // ?? + case D3DFMT_YUY2: // ?? { return (16); break; @@ -66,7 +80,20 @@ inline int GetBitsFromFormat(D3DFORMAT format) case D3DFMT_A8B8G8R8: // 32-bit ARGB pixel format with alpha, using 8 bits per channel. case D3DFMT_X8B8G8R8: // 32-bit RGB pixel format, where 8 bits are reserved for each color. case D3DFMT_G16R16: // 32-bit pixel format using 16 bits each for green and red. + case D3DFMT_G16R16F: // 32-bit float format using 16 bits for the red channel and 16 bits for the green channel. case D3DFMT_A2R10G10B10: // 32-bit pixel format using 10 bits each for red, green, and blue, and 2 bits for alpha. + case D3DFMT_D32: // 32-bit z-buffer bit depth. + case D3DFMT_D24S8: // 32-bit z-buffer bit depth using 24 bits for the depth channel and 8 bits for the stencil channel. + case D3DFMT_D24X8: //32-bit z-buffer bit depth using 24 bits for the depth channel. + case D3DFMT_D24X4S4: // 32-bit z-buffer bit depth using 24 bits for the depth channel and 4 bits for the stencil channel. + case D3DFMT_D32F_LOCKABLE: // A lockable format where the depth value is represented as a standard IEEE floating-point number. + case D3DFMT_D24FS8: // A non-lockable format that contains 24 bits of depth (in a 24-bit floating point format - 20e4) and 8 bits of stencil. + case D3DFMT_D32_LOCKABLE: // A lockable 32-bit depth buffer. + case D3DFMT_INDEX32: // 32-bit index buffer bit depth. + //case : // + //case : // + //case : // + //case : // { return (32); break; @@ -75,6 +102,7 @@ inline int GetBitsFromFormat(D3DFORMAT format) case D3DFMT_G32R32F: // 64-bit float format using 32 bits for the red channel and 32 bits for the green channel. case D3DFMT_Q16W16V16U16: // 64-bit bump-map format using 16 bits for each component. case D3DFMT_A16B16G16R16: // 64-bit pixel format using 16 bits for each component. + case D3DFMT_A16B16G16R16F: // 64-bit float format using 16 bits for the each channel (alpha, blue, green, red). { return (64); break; @@ -85,6 +113,19 @@ inline int GetBitsFromFormat(D3DFORMAT format) return (128); break; } + case D3DFMT_DXT2: + case D3DFMT_DXT3: + case D3DFMT_DXT4: + case D3DFMT_DXT5: + { + return (8); + break; + } + case D3DFMT_DXT1: + { + return (4); + break; + } default: //compressed formats { return (4); diff --git a/OTM_DX9/OTM_TextureServer.cpp b/OTM_DX9/OTM_TextureServer.cpp index ba7d5ec..8e84ae0 100644 --- a/OTM_DX9/OTM_TextureServer.cpp +++ b/OTM_DX9/OTM_TextureServer.cpp @@ -211,12 +211,12 @@ int OTM_TextureServer::AddFile( char* buffer, unsigned int size, MyTypeHash has temp->Size = size; temp->NumberOfTextures = 0; - temp->Reference = -1; temp->Textures = NULL; temp->Hash = hash; - if (new_file) temp->ForceReload = false; // no need to force a load of the texture - else temp->ForceReload = force; + //if (new_file) temp->ForceReload = false; // no need to force a load of the texture + //else + temp->ForceReload = force; Message("End AddFile(%#lX)\n", hash); if (new_file) return (CurrentMod.Add(temp)); // new files must be added to the list of the CurrentMod @@ -297,7 +297,6 @@ int OTM_TextureServer::AddFile(wchar_t* file_name, MyTypeHash hash, bool force) temp->Size = size; temp->NumberOfTextures = 0; - temp->Reference = -1; temp->Textures = NULL; temp->Hash = hash; @@ -567,6 +566,8 @@ int OTM_TextureServer::MainLoop(void) // run as a separated thread unsigned long num; Message("MainLoop: started\n"); + bool update_textures = false; + bool more_textures = false; while (1) { Message("MainLoop: run\n"); @@ -581,7 +582,7 @@ int OTM_TextureServer::MainLoop(void) // run as a separated thread { unsigned int pos = 0; MsgStruct *commands; - bool update_textures = false; + more_textures = false; while (pos <= num - sizeof(MsgStruct)) { commands = (MsgStruct*) &buffer[pos]; @@ -590,6 +591,11 @@ int OTM_TextureServer::MainLoop(void) // run as a separated thread switch (commands->Control) { + case CONTROL_MORE_TEXTURES: + { + more_textures=true; + break; + } case CONTROL_FORCE_RELOAD_TEXTURE: force=true; case CONTROL_ADD_TEXTURE: { @@ -678,7 +684,7 @@ int OTM_TextureServer::MainLoop(void) // run as a separated thread } pos += sizeof(MsgStruct) + size; } - if (update_textures) PropagateUpdate(); + if (!more_textures && update_textures) {PropagateUpdate(); update_textures=false;} } else { diff --git a/OTM_GUI/OTM_GUI.cpp b/OTM_GUI/OTM_GUI.cpp index fa3fe69..ea9217e 100644 --- a/OTM_GUI/OTM_GUI.cpp +++ b/OTM_GUI/OTM_GUI.cpp @@ -79,7 +79,7 @@ bool MyApp::OnInit(void) wxMessageBox( Language->Error_AlreadyRunning, "ERROR", wxOK|wxICON_ERROR); return false; } - OTM_Frame *frame = new OTM_Frame( OTM_VERSION, wxDefaultPosition, wxSize(set.XSize,set.YSize)); + OTM_Frame *frame = new OTM_Frame( OTM_VERSION, wxPoint(set.XPos,set.YPos), wxSize(set.XSize,set.YSize)); SetTopWindow( frame ); return true; @@ -209,6 +209,7 @@ OTM_Frame::~OTM_Frame(void) OTM_Settings set; set.Language = Language->GetCurrentLanguage(); GetSize( &set.XSize, &set.YSize); + GetPosition( &set.XPos, &set.YPos); set.Save(); } diff --git a/OTM_GUI/OTM_Language.cpp b/OTM_GUI/OTM_Language.cpp index c96108a..92ad994 100644 --- a/OTM_GUI/OTM_Language.cpp +++ b/OTM_GUI/OTM_Language.cpp @@ -322,7 +322,7 @@ int OTM_Language::LoadDefault(void) Author = "Author: "; Error_FileNotSupported = "This file type is not supported:\n"; - Error_DLLNotFound = "Could not load the dll.\nThe dll injection won't work.\nThis might happen if D3DX9_43.dll is not installed on your system.\nPlease install the newest DirectX End-User Runtime Web Installer."; + Error_DLLNotFound = "Could not load the dll.\nThe dll injection won't work.\nThis might happen if D3DX9_43.dll (32bit) is not installed on your system.\nPlease install the newest DirectX End-User Runtime Web Installer."; Error_FktNotFound = "Could not load function out of dll.\nThe dll injection won't work."; Error_AlreadyRunning = "An other instance of OpenTexMod is already running."; diff --git a/OTM_GUI/OTM_Sender.cpp b/OTM_GUI/OTM_Sender.cpp index 721d241..68c15d4 100644 --- a/OTM_GUI/OTM_Sender.cpp +++ b/OTM_GUI/OTM_Sender.cpp @@ -110,7 +110,11 @@ int OTM_Sender::Send( const OTM_GameInfo &game, const OTM_GameInfo &game_old, bo for (int i=0; iError_Memory; return -1;} - for (int i=0; iBIG_BUFSIZE) + if (tex[i].Size[j]+2*sizeof(MsgStruct)+pos>BIG_BUFSIZE) //the buffer is full { + msg = (MsgStruct*) &Buffer[pos]; + msg->Control = CONTROL_MORE_TEXTURES; // we will send more textures + pos+=sizeof(MsgStruct); if (int ret = SendToGame( Buffer, pos)) return ret; pos = 0; } @@ -315,6 +330,17 @@ int OTM_Sender::SendTextures(unsigned int num, AddTextureClass *tex) tex[i].WasAdded[j] = false; } } + else if (tex[i].Add && tex[i].WasAdded[j]) // this texture could be removed, due to a rearranging of the list + { + bool hit = false; //we send only if this has was not send before + unsigned long temp_hash = tex[i].Hash[j]; + for (unsigned int ii=0u; ii. OTM_Settings::OTM_Settings(void) { - XSize=600; - YSize=400; - Language="English"; + XSize = 600; + YSize = 400; + XPos = -1; + YPos = -1; + Language = "English"; } #define SETTINGS_FILE "OTM_Settings.txt" @@ -81,6 +83,16 @@ int OTM_Settings::Load(void) long y; if (value.ToLong( &y)) YSize=y; } + else if (command == "x_pos") + { + long x; + if (value.ToLong( &x)) XPos=x; + } + else if (command == "y_pos") + { + long y; + if (value.ToLong( &y)) YPos=y; + } } return 0; @@ -103,10 +115,15 @@ int OTM_Settings::Save(void) content.Printf("y_size:%d\n", YSize); file.Write( content.wc_str(), content.Len()*2); + + content.Printf("x_pos:%d\n", XPos); + file.Write( content.wc_str(), content.Len()*2); + + content.Printf("y_pos:%d\n", YPos); + file.Write( content.wc_str(), content.Len()*2); file.Close(); return 0; - } diff --git a/OTM_GUI/OTM_Settings.h b/OTM_GUI/OTM_Settings.h index cd852f9..9da2ff5 100644 --- a/OTM_GUI/OTM_Settings.h +++ b/OTM_GUI/OTM_Settings.h @@ -30,6 +30,7 @@ public: int XSize, YSize; + int XPos, YPos; wxString Language; int Load(void); diff --git a/OTM_GUI/bin/README_Deutsch.txt b/OTM_GUI/bin/README_Deutsch.txt index 3f7ad92..4d073cb 100644 --- a/OTM_GUI/bin/README_Deutsch.txt +++ b/OTM_GUI/bin/README_Deutsch.txt @@ -11,7 +11,7 @@ Warnung: Du verwendest diese Programm auf eigene Gefahr hin! http://code.google.com/p/texmod/downloads/list -OpenTexMod verwendet die D3DX9_43.dll. Wegen den EULA kann diese dll nicht mit OpenTexMod +OpenTexMod verwendet die D3DX9_43.dll (32bit). Wegen den EULA kann diese dll nicht mit OpenTexMod mit geliefert werden. Wenn diese dll auf deinem System nicht installiert ist, wird dich OpenTexMod darauf hinweisen. diff --git a/OTM_GUI/bin/README_English.txt b/OTM_GUI/bin/README_English.txt index cb92f44..2359a8b 100644 --- a/OTM_GUI/bin/README_English.txt +++ b/OTM_GUI/bin/README_English.txt @@ -8,7 +8,7 @@ WARNING: You use this program at your own risk! Download it by your self and don't use versions, send to you by team or guild members! http://code.google.com/p/texmod/downloads/list -OpenTexMod uses the D3DX9_43.dll. Due to the EULA this dll cannot be delivered together with OpenTexMod . +OpenTexMod uses the D3DX9_43.dll (32bit). Due to the EULA this dll cannot be delivered together with OpenTexMod . If D3DX9_43.dll is not installed on your system, OpenTexMod will give you a hint at program start. diff --git a/OTM_GUI/bin/languages/OTM_LanguagePackU_Deutsch.txt b/OTM_GUI/bin/languages/OTM_LanguagePackU_Deutsch.txt index d9561c16b275f0c43e4cf589ea3a4e1f946b4f07..70082783fedfea58a19cd08eb0b136db52cac646 100644 GIT binary patch delta 26 hcmdm?enNdi4;QZngE4~2hJbWAgCpZO3 diff --git a/OTM_GlobalDefines.h b/OTM_GlobalDefines.h index c8443bd..cea88c2 100644 --- a/OTM_GlobalDefines.h +++ b/OTM_GlobalDefines.h @@ -51,6 +51,7 @@ typedef struct #define CONTROL_REMOVE_TEXTURE 3 #define CONTROL_FORCE_RELOAD_TEXTURE_DATA 4 #define CONTROL_ADD_TEXTURE_DATA 5 +#define CONTROL_MORE_TEXTURES 6 #define CONTROL_SAVE_ALL 10