diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/fakerw/fake.cpp | 22 | ||||
-rw-r--r-- | src/rw/TxdStore.cpp | 35 | ||||
-rw-r--r-- | src/skel/glfw/glfw.cpp | 31 |
3 files changed, 37 insertions, 51 deletions
diff --git a/src/fakerw/fake.cpp b/src/fakerw/fake.cpp index 3d4ddf5d..26b5ae3d 100644 --- a/src/fakerw/fake.cpp +++ b/src/fakerw/fake.cpp @@ -290,9 +290,29 @@ RwTextureAddressMode RwTextureGetAddressingV(const RwTexture *texture); // TODO void _rwD3D8TexDictionaryEnableRasterFormatConversion(bool enable) { } +static rw::Raster* +ConvertTexRaster(rw::Raster *ras) +{ + using namespace rw; + Image *img = ras->toImage(); + ras->destroy(); + img->unindex(); + ras = Raster::createFromImage(img); + img->destroy(); + return ras; +} + // hack for reading native textures RwBool rwNativeTextureHackRead(RwStream *stream, RwTexture **tex, RwInt32 size) - { *tex = Texture::streamReadNative(stream); return *tex != nil; } +{ + *tex = Texture::streamReadNative(stream); +#ifdef RW_GL3 + if(strcmp((*tex)->name, "copnu") == 0) + tex = tex; + (*tex)->raster = ConvertTexRaster((*tex)->raster); +#endif + return *tex != nil; +} diff --git a/src/rw/TxdStore.cpp b/src/rw/TxdStore.cpp index bb7386d5..51d018f6 100644 --- a/src/rw/TxdStore.cpp +++ b/src/rw/TxdStore.cpp @@ -127,38 +127,6 @@ CTxdStore::RemoveRefWithoutDelete(int slot) GetSlot(slot)->refCount--; } -#ifdef RW_GL3 -rw::Raster* -convertTexRaster(rw::Raster* ras) -{ - rw::Image* img = ras->toImage(); -// ras->destroy(); - img->unindex(); - ras = rw::Raster::createFromImage(img); - img->destroy(); - return ras; -} - -void -convertTxd(rw::TexDictionary* txd) -{ - rw::Texture* tex; - FORLIST(lnk, txd->textures) { - tex = rw::Texture::fromDict(lnk); - rw::Raster* ras = tex->raster; - if (ras && ras->platform != rw::platform) { - if (!(ras->platform == rw::PLATFORM_D3D8 && rw::platform == rw::PLATFORM_D3D9 || - ras->platform == rw::PLATFORM_D3D9 && rw::platform == rw::PLATFORM_D3D8)) { - tex->raster = convertTexRaster(ras); - ras->destroy(); - } - } - tex->setFilter(rw::Texture::LINEAR); - } - -} -#endif - bool CTxdStore::LoadTxd(int slot, RwStream *stream) { @@ -166,9 +134,6 @@ CTxdStore::LoadTxd(int slot, RwStream *stream) if(RwStreamFindChunk(stream, rwID_TEXDICTIONARY, nil, nil)){ def->texDict = RwTexDictionaryGtaStreamRead(stream); -#ifdef RW_GL3 - convertTxd(def->texDict); -#endif return def->texDict != nil; } printf("Failed to load TXD\n"); diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp index 0d7dc384..db6be3a2 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -19,11 +19,25 @@ #include "platform.h" #include "crossplatform.h" +#include "patcher.h" +#include "main.h" +#include "FileMgr.h" +#include "Text.h" +#include "Pad.h" +#include "Timer.h" +#include "DMAudio.h" +#include "ControllerConfig.h" +#include "Frontend.h" +#include "Game.h" +#include "PCSave.h" +#include "Sprite2d.h" +#include "AnimViewer.h" + + #define MAX_SUBSYSTEMS (16) -using namespace rw; -EngineOpenParams openParams; +rw::EngineOpenParams openParams; static RwBool ForegroundApp = TRUE; @@ -49,19 +63,6 @@ static psGlobalType PsGlobal; #define JIF(x) if (FAILED(hr=(x))) \ {debug(TEXT("FAILED(hr=0x%x) in ") TEXT(#x) TEXT("\n"), hr); return;} -#include "patcher.h" -#include "main.h" -#include "FileMgr.h" -#include "Text.h" -#include "Pad.h" -#include "Timer.h" -#include "DMAudio.h" -#include "ControllerConfig.h" -#include "Frontend.h" -#include "Game.h" -#include "PCSave.h" -#include "Sprite2d.h" -#include "AnimViewer.h" // TODO: This is used on selecting video mode, so either think something or remove it completely DWORD _dwMemTotalVideo = 1024 * (1024 * 1024); // 1024 MB as placeholder |