summaryrefslogtreecommitdiffstats
path: root/src/fakerw/fake.cpp
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-04-26 23:55:22 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2020-04-26 23:55:22 +0200
commita38a867cc5fe1677866b7a6b6c01c4dc5dc3387b (patch)
tree35f1795ea2a38d996e43dd5119e28e26a34f06d3 /src/fakerw/fake.cpp
parentpools compatibility (diff)
parentMerge pull request #489 from Nick007J/master (diff)
downloadre3-a38a867cc5fe1677866b7a6b6c01c4dc5dc3387b.tar
re3-a38a867cc5fe1677866b7a6b6c01c4dc5dc3387b.tar.gz
re3-a38a867cc5fe1677866b7a6b6c01c4dc5dc3387b.tar.bz2
re3-a38a867cc5fe1677866b7a6b6c01c4dc5dc3387b.tar.lz
re3-a38a867cc5fe1677866b7a6b6c01c4dc5dc3387b.tar.xz
re3-a38a867cc5fe1677866b7a6b6c01c4dc5dc3387b.tar.zst
re3-a38a867cc5fe1677866b7a6b6c01c4dc5dc3387b.zip
Diffstat (limited to 'src/fakerw/fake.cpp')
-rw-r--r--src/fakerw/fake.cpp30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/fakerw/fake.cpp b/src/fakerw/fake.cpp
index c4ff2dd2..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;
+}
@@ -460,13 +480,17 @@ RwBool RwRenderStateSet(RwRenderState state, void *value)
}
}
-
-static EngineOpenParams openParams;
// WARNING: unused parameters
RwBool RwEngineInit(RwMemoryFunctions *memFuncs, RwUInt32 initFlags, RwUInt32 resArenaSize) { Engine::init(); return true; }
// TODO: this is platform dependent
RwBool RwEngineOpen(RwEngineOpenParams *initParams) {
+#if defined RW_D3D9 || defined RWLIBS
+ static EngineOpenParams openParams;
openParams.window = (HWND)initParams->displayID;
+#else
+ extern EngineOpenParams openParams;
+ openParams.window = (GLFWwindow**)initParams->displayID;
+#endif
return Engine::open(&openParams);
}
RwBool RwEngineStart(void) {