summaryrefslogtreecommitdiffstats
path: root/src/rw
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-04-14 23:10:50 +0200
committerSergeanur <s.anureev@yandex.ua>2020-04-14 23:10:50 +0200
commite373d0526ef07183cba8e89aba46f2ab416e67ba (patch)
treee6b2052e078cd2ad2ae1503262421c6858a20a0f /src/rw
parentCFont (diff)
parentRwMatFX support with linked RW libs (diff)
downloadre3-e373d0526ef07183cba8e89aba46f2ab416e67ba.tar
re3-e373d0526ef07183cba8e89aba46f2ab416e67ba.tar.gz
re3-e373d0526ef07183cba8e89aba46f2ab416e67ba.tar.bz2
re3-e373d0526ef07183cba8e89aba46f2ab416e67ba.tar.lz
re3-e373d0526ef07183cba8e89aba46f2ab416e67ba.tar.xz
re3-e373d0526ef07183cba8e89aba46f2ab416e67ba.tar.zst
re3-e373d0526ef07183cba8e89aba46f2ab416e67ba.zip
Diffstat (limited to '')
-rw-r--r--src/rw/ClumpRead.cpp (renamed from src/core/RwClumpRead.cpp)0
-rw-r--r--src/rw/Lights.cpp (renamed from src/render/Lights.cpp)0
-rw-r--r--src/rw/Lights.h (renamed from src/render/Lights.h)0
-rw-r--r--src/rw/NodeName.cpp (renamed from src/core/NodeName.cpp)0
-rw-r--r--src/rw/NodeName.h (renamed from src/core/NodeName.h)0
-rw-r--r--src/rw/RwHelper.cpp (renamed from src/core/RwHelper.cpp)60
-rw-r--r--src/rw/RwHelper.h (renamed from src/core/RwHelper.h)1
-rw-r--r--src/rw/RwMatFX.cpp (renamed from src/core/RwMatFX.cpp)13
-rw-r--r--src/rw/TexRead.cpp349
-rw-r--r--src/rw/TxdStore.cpp (renamed from src/core/TxdStore.cpp)0
-rw-r--r--src/rw/TxdStore.h (renamed from src/core/TxdStore.h)0
-rw-r--r--src/rw/VisibilityPlugins.cpp (renamed from src/render/VisibilityPlugins.cpp)2
-rw-r--r--src/rw/VisibilityPlugins.h (renamed from src/render/VisibilityPlugins.h)0
-rw-r--r--src/rw/rw.cpp (renamed from src/core/rw.cpp)428
14 files changed, 828 insertions, 25 deletions
diff --git a/src/core/RwClumpRead.cpp b/src/rw/ClumpRead.cpp
index c9f027e7..c9f027e7 100644
--- a/src/core/RwClumpRead.cpp
+++ b/src/rw/ClumpRead.cpp
diff --git a/src/render/Lights.cpp b/src/rw/Lights.cpp
index cd83a898..cd83a898 100644
--- a/src/render/Lights.cpp
+++ b/src/rw/Lights.cpp
diff --git a/src/render/Lights.h b/src/rw/Lights.h
index 6fdd51de..6fdd51de 100644
--- a/src/render/Lights.h
+++ b/src/rw/Lights.h
diff --git a/src/core/NodeName.cpp b/src/rw/NodeName.cpp
index 2aea3c83..2aea3c83 100644
--- a/src/core/NodeName.cpp
+++ b/src/rw/NodeName.cpp
diff --git a/src/core/NodeName.h b/src/rw/NodeName.h
index 1a3e057b..1a3e057b 100644
--- a/src/core/NodeName.h
+++ b/src/rw/NodeName.h
diff --git a/src/core/RwHelper.cpp b/src/rw/RwHelper.cpp
index 6325bf15..44ca3a0a 100644
--- a/src/core/RwHelper.cpp
+++ b/src/rw/RwHelper.cpp
@@ -3,6 +3,44 @@
#include "patcher.h"
#include "Timecycle.h"
#include "skeleton.h"
+#if defined(RWLIBS) && !defined(FINAL)
+#include "rtcharse.h"
+#pragma comment( lib, "rtcharse.lib" )
+
+RtCharset *debugCharset;
+#endif
+
+void CreateDebugFont()
+{
+#if defined(RWLIBS) && !defined(FINAL)
+ RwRGBA color = { 255, 255, 128, 255 };
+ RwRGBA colorbg = { 0, 0, 0, 0 };
+ RtCharsetOpen();
+ debugCharset = RtCharsetCreate(&color, &colorbg);
+#endif
+}
+
+void DestroyDebugFont()
+{
+#if defined(RWLIBS) && !defined(FINAL)
+ RtCharsetDestroy(debugCharset);
+ RtCharsetClose();
+#endif
+}
+
+void ObrsPrintfString(const char *str, short x, short y)
+{
+#if defined(RWLIBS) && !defined(FINAL)
+ RtCharsetPrintBuffered(debugCharset, str, x, y, true);
+#endif
+}
+
+void FlushObrsPrintfs()
+{
+#if defined(RWLIBS) && !defined(FINAL)
+ RtCharsetBufferFlush();
+#endif
+}
void *
RwMallocAlign(RwUInt32 size, RwUInt32 align)
@@ -347,28 +385,6 @@ CameraCreate(RwInt32 width, RwInt32 height, RwBool zBuffer)
return (nil);
}
-WRAPPER void ReadVideoCardCapsFile(uint32&, uint32&, uint32&, uint32&) { EAXJMP(0x5926C0); }
-WRAPPER bool CheckVideoCardCaps(void) { EAXJMP(0x592740); }
-WRAPPER void WriteVideoCardCapsFile(void) { EAXJMP(0x5927D0); }
-WRAPPER void ConvertingTexturesScreen(uint32, uint32, const char*) { EAXJMP(0x592880); }
-WRAPPER void DealWithTxdWriteError(uint32, uint32, const char*) { EAXJMP(0x592BF0); }
-WRAPPER bool CreateTxdImageForVideoCard() { EAXJMP(0x592C70); }
-
-void CreateDebugFont()
-{
- ;
-}
-
-void DestroyDebugFont()
-{
- ;
-}
-
-void FlushObrsPrintfs()
-{
- ;
-}
-
WRAPPER void _TexturePoolsInitialise() { EAXJMP(0x598B10); }
WRAPPER void _TexturePoolsShutdown() { EAXJMP(0x598B30); }
diff --git a/src/core/RwHelper.h b/src/rw/RwHelper.h
index a9f0bdf4..5b47cb6f 100644
--- a/src/core/RwHelper.h
+++ b/src/rw/RwHelper.h
@@ -5,6 +5,7 @@ void RwFreeAlign(void *mem);
void CreateDebugFont();
void DestroyDebugFont();
+void ObrsPrintfString(const char *str, short x, short y);
void FlushObrsPrintfs();
void DefinedState(void);
RwFrame *GetFirstChild(RwFrame *frame);
diff --git a/src/core/RwMatFX.cpp b/src/rw/RwMatFX.cpp
index ca9a633b..3af6fabe 100644
--- a/src/core/RwMatFX.cpp
+++ b/src/rw/RwMatFX.cpp
@@ -43,8 +43,16 @@ struct MatFX
int effects;
};
+#ifdef RWLIBS
+extern "C" {
+ extern int MatFXMaterialDataOffset;
+ extern int MatFXAtomicDataOffset;
+ void _rpMatFXD3D8AtomicMatFXEnvRender(RxD3D8InstanceData* inst, int flags, int sel, RwTexture* texture, RwTexture* envMap);
+}
+#else
int &MatFXMaterialDataOffset = *(int*)0x66188C;
int &MatFXAtomicDataOffset = *(int*)0x66189C;
+#endif
#ifdef PS2_MATFX
@@ -206,8 +214,13 @@ _rpMatFXD3D8AtomicMatFXEnvRender_ps2(RxD3D8InstanceData *inst, int flags, int se
RwD3D8SetTextureStageState(0, D3DTSS_TEXCOORDINDEX, 0);
}
+
STARTPATCHES
+#ifdef RWLIBS
+ InjectHook((uintptr)&_rpMatFXD3D8AtomicMatFXEnvRender, _rpMatFXD3D8AtomicMatFXEnvRender_ps2, PATCH_JUMP);
+#else
InjectHook(0x5CF6C0, _rpMatFXD3D8AtomicMatFXEnvRender_ps2, PATCH_JUMP);
+#endif
ENDPATCHES
#endif
diff --git a/src/rw/TexRead.cpp b/src/rw/TexRead.cpp
new file mode 100644
index 00000000..50b99d47
--- /dev/null
+++ b/src/rw/TexRead.cpp
@@ -0,0 +1,349 @@
+#pragma warning( push )
+#pragma warning( disable : 4005)
+#define DIRECTINPUT_VERSION 0x0800
+#include <dinput.h>
+#pragma warning( pop )
+#define WITHWINDOWS
+#include "common.h"
+#include "win.h"
+#include "patcher.h"
+#include "Timer.h"
+#ifdef GTA_PC
+#include "FileMgr.h"
+#include "Pad.h"
+#include "main.h"
+#include "Directory.h"
+#include "Streaming.h"
+#include "TxdStore.h"
+#include "CdStream.h"
+#include "Font.h"
+#include "Sprite2d.h"
+#include "Text.h"
+#include "RwHelper.h"
+#endif //GTA_PC
+
+float &texLoadTime = *(float*)0x8F1B50;
+int32 &texNumLoaded = *(int32*)0x8F252C;
+
+RwTexture*
+RwTextureGtaStreamRead(RwStream *stream)
+{
+ RwUInt32 size, version;
+ RwTexture *tex;
+
+ if(!RwStreamFindChunk(stream, rwID_TEXTURENATIVE, &size, &version))
+ return nil;
+
+ float preloadTime = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond();
+
+ if(!RWSRCGLOBAL(stdFunc[rwSTANDARDNATIVETEXTUREREAD](stream, &tex, size)))
+ return nil;
+
+ if (gGameState == GS_INIT_PLAYING_GAME) {
+ texLoadTime = (texNumLoaded * texLoadTime + (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond() - preloadTime) / (float)(texNumLoaded+1);
+ texNumLoaded++;
+ }
+ return tex;
+}
+
+RwTexture*
+destroyTexture(RwTexture *texture, void *data)
+{
+ RwTextureDestroy(texture);
+ return texture;
+}
+
+RwTexDictionary*
+RwTexDictionaryGtaStreamRead(RwStream *stream)
+{
+ RwUInt32 size, version;
+ RwInt32 numTextures;
+ RwTexDictionary *texDict;
+ RwTexture *tex;
+
+ if(!RwStreamFindChunk(stream, rwID_STRUCT, &size, &version))
+ return nil;
+ assert(size == 4);
+ if(RwStreamRead(stream, &numTextures, size) != size)
+ return nil;
+
+ texDict = RwTexDictionaryCreate();
+ if(texDict == nil)
+ return nil;
+
+ while(numTextures--){
+ tex = RwTextureGtaStreamRead(stream);
+ if(tex == nil){
+ RwTexDictionaryForAllTextures(texDict, destroyTexture, nil);
+ RwTexDictionaryDestroy(texDict);
+ return nil;
+ }
+ RwTexDictionaryAddTexture(texDict, tex);
+ }
+
+ return texDict;
+}
+
+static int32 numberTextures = -1;
+static int32 streamPosition;
+
+RwTexDictionary*
+RwTexDictionaryGtaStreamRead1(RwStream *stream)
+{
+ RwUInt32 size, version;
+ RwInt32 numTextures;
+ RwTexDictionary *texDict;
+ RwTexture *tex;
+
+ numberTextures = 0;
+ if(!RwStreamFindChunk(stream, rwID_STRUCT, &size, &version))
+ return nil;
+ assert(size == 4);
+ if(RwStreamRead(stream, &numTextures, size) != size)
+ return nil;
+
+ texDict = RwTexDictionaryCreate();
+ if(texDict == nil)
+ return nil;
+
+ numberTextures = numTextures/2;
+
+ while(numTextures > numberTextures){
+ numTextures--;
+
+ tex = RwTextureGtaStreamRead(stream);
+ if(tex == nil){
+ RwTexDictionaryForAllTextures(texDict, destroyTexture, nil);
+ RwTexDictionaryDestroy(texDict);
+ return nil;
+ }
+ RwTexDictionaryAddTexture(texDict, tex);
+ }
+
+ numberTextures = numTextures;
+ streamPosition = stream->Type.memory.position;
+
+ return texDict;
+}
+
+RwTexDictionary*
+RwTexDictionaryGtaStreamRead2(RwStream *stream, RwTexDictionary *texDict)
+{
+ RwTexture *tex;
+
+ RwStreamSkip(stream, streamPosition - stream->Type.memory.position);
+
+ while(numberTextures--){
+ tex = RwTextureGtaStreamRead(stream);
+ if(tex == nil){
+ RwTexDictionaryForAllTextures(texDict, destroyTexture, nil);
+ RwTexDictionaryDestroy(texDict);
+ return nil;
+ }
+ RwTexDictionaryAddTexture(texDict, tex);
+ }
+
+ return texDict;
+}
+
+#ifdef GTA_PC
+#ifdef RWLIBS
+extern "C" RwInt32 _rwD3D8FindCorrectRasterFormat(RwRasterType type, RwInt32 flags);
+#else
+WRAPPER RwInt32 _rwD3D8FindCorrectRasterFormat(RwRasterType type, RwInt32 flags) { EAXJMP(0x59A350); }
+#endif
+
+void
+ReadVideoCardCapsFile(uint32 &cap32, uint32 &cap24, uint32 &cap16, uint32 &cap8)
+{
+ cap32 = UINT32_MAX;
+ cap24 = UINT32_MAX;
+ cap16 = UINT32_MAX;
+ cap8 = UINT32_MAX;
+
+ int32 file = CFileMgr::OpenFile("DATA\\CAPS.DAT", "rb");
+ if (file != 0) {
+ CFileMgr::Read(file, (char*)&cap32, 4);
+ CFileMgr::Read(file, (char*)&cap24, 4);
+ CFileMgr::Read(file, (char*)&cap16, 4);
+ CFileMgr::Read(file, (char*)&cap8, 4);
+ CFileMgr::CloseFile(file);
+ }
+}
+
+bool
+CheckVideoCardCaps(void)
+{
+ uint32 cap32 = _rwD3D8FindCorrectRasterFormat(rwRASTERTYPETEXTURE, rwRASTERFORMAT8888);
+ uint32 cap24 = _rwD3D8FindCorrectRasterFormat(rwRASTERTYPETEXTURE, rwRASTERFORMAT888);
+ uint32 cap16 = _rwD3D8FindCorrectRasterFormat(rwRASTERTYPETEXTURE, rwRASTERFORMAT1555);
+ uint32 cap8 = _rwD3D8FindCorrectRasterFormat(rwRASTERTYPETEXTURE, rwRASTERFORMATPAL8 | rwRASTERFORMAT8888);
+ uint32 fcap32, fcap24, fcap16, fcap8;
+ ReadVideoCardCapsFile(fcap32, fcap24, fcap16, fcap8);
+ return cap32 != fcap32 || cap24 != fcap24 || cap16 != fcap16 || cap8 != fcap8;
+}
+
+void
+WriteVideoCardCapsFile(void)
+{
+ uint32 cap32 = _rwD3D8FindCorrectRasterFormat(rwRASTERTYPETEXTURE, rwRASTERFORMAT8888);
+ uint32 cap24 = _rwD3D8FindCorrectRasterFormat(rwRASTERTYPETEXTURE, rwRASTERFORMAT888);
+ uint32 cap16 = _rwD3D8FindCorrectRasterFormat(rwRASTERTYPETEXTURE, rwRASTERFORMAT1555);
+ uint32 cap8 = _rwD3D8FindCorrectRasterFormat(rwRASTERTYPETEXTURE, rwRASTERFORMATPAL8 | rwRASTERFORMAT8888);
+ int32 file = CFileMgr::OpenFile("DATA\\CAPS.DAT", "wb");
+ if (file != 0) {
+ CFileMgr::Write(file, (char*)&cap32, 4);
+ CFileMgr::Write(file, (char*)&cap24, 4);
+ CFileMgr::Write(file, (char*)&cap16, 4);
+ CFileMgr::Write(file, (char*)&cap8, 4);
+ CFileMgr::CloseFile(file);
+ }
+}
+
+bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
+void DoRWStuffEndOfFrame(void);
+
+void
+ConvertingTexturesScreen(uint32 num, uint32 count, const char *text)
+{
+ HandleExit();
+
+ CSprite2d *splash = LoadSplash(nil);
+ if (!DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255))
+ return;
+
+ CSprite2d::SetRecipNearClip();
+ CSprite2d::InitPerFrame();
+ CFont::InitPerFrame();
+ DefinedState();
+
+ RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSCLAMP);
+ splash->Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, 255));
+
+ CSprite2d::DrawRect(CRect(SCREEN_SCALE_X(200.0f), SCREEN_SCALE_Y(240.0f), SCREEN_SCALE_FROM_RIGHT(200.0f), SCREEN_SCALE_Y(248.0f)), CRGBA(64, 64, 64, 255));
+ CSprite2d::DrawRect(CRect(SCREEN_SCALE_X(200.0f), SCREEN_SCALE_Y(240.0f), (SCREEN_SCALE_FROM_RIGHT(200.0f) - SCREEN_SCALE_X(200.0f)) * ((float)num / (float)count) + SCREEN_SCALE_X(200.0f), SCREEN_SCALE_Y(248.0f)), CRGBA(255, 217, 106, 255));
+ CSprite2d::DrawRect(CRect(SCREEN_SCALE_X(120.0f), SCREEN_SCALE_Y(150.0f), SCREEN_SCALE_FROM_RIGHT(120.0f), SCREEN_HEIGHT - SCREEN_SCALE_Y(220.0f)), CRGBA(50, 50, 50, 210));
+
+ CFont::SetBackgroundOff();
+ CFont::SetPropOn();
+ CFont::SetScale(SCREEN_SCALE_X(0.45f), SCREEN_SCALE_Y(0.7f));
+ CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(170.0f));
+ CFont::SetJustifyOff();
+ CFont::SetColor(CRGBA(255, 217, 106, 255));
+ CFont::SetBackGroundOnlyTextOff();
+ CFont::SetFontStyle(FONT_BANK);
+ CFont::PrintString(SCREEN_SCALE_X(170.0f), SCREEN_SCALE_Y(160.0f), TheText.Get(text));
+ CFont::DrawFonts();
+ DoRWStuffEndOfFrame();
+}
+
+void
+DealWithTxdWriteError(uint32 num, uint32 count, const char *text)
+{
+ while (!RsGlobal.quit) {
+ ConvertingTexturesScreen(num, count, text);
+ CPad::UpdatePads();
+ if (CPad::GetPad(0)->GetEscapeJustDown())
+ break;
+ }
+ RsGlobal.quit = false;
+ LoadingScreen(nil, nil, nil);
+ RsGlobal.quit = true;
+}
+
+bool
+CreateTxdImageForVideoCard()
+{
+ uint8 *buf = new uint8[CDSTREAM_SECTOR_SIZE];
+ CDirectory *pDir = new CDirectory(TXDSTORESIZE);
+ CDirectory::DirectoryInfo dirInfo;
+
+ CStreaming::FlushRequestList();
+
+ RwFileFunctions *filesys = RwOsGetFileInterface();
+
+ RwStream *img = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMWRITE, "models\\txd.img");
+ if (img == nil) {
+ // original code does otherwise and it leaks
+ delete []buf;
+ delete pDir;
+
+ if (_dwOperatingSystemVersion == OS_WINNT || _dwOperatingSystemVersion == OS_WIN2000 || _dwOperatingSystemVersion == OS_WINXP)
+ DealWithTxdWriteError(0, TXDSTORESIZE, "CVT_CRT");
+
+ return false;
+ }
+
+ int32 i;
+ for (i = 0; i < TXDSTORESIZE; i++) {
+ ConvertingTexturesScreen(i, TXDSTORESIZE, "CVT_MSG");
+
+ if (CTxdStore::GetSlot(i) != nil && CStreaming::IsObjectInCdImage(i + STREAM_OFFSET_TXD)) {
+ CStreaming::RequestTxd(i, STREAMFLAGS_KEEP_IN_MEMORY);
+ CStreaming::RequestModelStream(0);
+ CStreaming::FlushChannels();
+
+ char filename[64];
+ sprintf(filename, "%s.txd", CTxdStore::GetTxdName(i));
+
+ if (CTxdStore::GetSlot(i)->texDict) {
+ int32 pos = filesys->rwftell(img->Type.file.fpFile);
+
+ if (RwTexDictionaryStreamWrite(CTxdStore::GetSlot(i)->texDict, img) == nil) {
+ DealWithTxdWriteError(i, TXDSTORESIZE, "CVT_ERR");
+ RwStreamClose(img, nil);
+ delete []buf;
+ delete pDir;
+ CStreaming::RemoveTxd(i);
+ return false;
+ }
+
+ int32 size = filesys->rwftell(img->Type.file.fpFile) - pos;
+ int32 num = size % CDSTREAM_SECTOR_SIZE;
+
+ size /= CDSTREAM_SECTOR_SIZE;
+ if (num != 0) {
+ size++;
+ num = CDSTREAM_SECTOR_SIZE - num;
+ RwStreamWrite(img, buf, num);
+ }
+
+ dirInfo.offset = pos / CDSTREAM_SECTOR_SIZE;
+ dirInfo.size = size;
+ strncpy(dirInfo.name, filename, sizeof(dirInfo.name));
+ pDir->AddItem(dirInfo);
+ CStreaming::RemoveTxd(i);
+ }
+ CStreaming::FlushRequestList();
+ }
+ }
+
+ RwStreamClose(img, nil);
+ delete []buf;
+
+ if (!pDir->WriteDirFile("models\\txd.dir")) {
+ DealWithTxdWriteError(i, TXDSTORESIZE, "CVT_ERR");
+ delete pDir;
+ return false;
+ }
+
+ delete pDir;
+
+ WriteVideoCardCapsFile();
+ return true;
+}
+#endif // GTA_PC
+
+STARTPATCHES
+ InjectHook(0x592380, RwTextureGtaStreamRead, PATCH_JUMP);
+ InjectHook(0x5924A0, RwTexDictionaryGtaStreamRead, PATCH_JUMP);
+ InjectHook(0x592550, RwTexDictionaryGtaStreamRead1, PATCH_JUMP);
+ InjectHook(0x592650, RwTexDictionaryGtaStreamRead2, PATCH_JUMP);
+
+ InjectHook(0x5926C0, ReadVideoCardCapsFile, PATCH_JUMP);
+ InjectHook(0x592740, CheckVideoCardCaps, PATCH_JUMP);
+ InjectHook(0x5927D0, WriteVideoCardCapsFile, PATCH_JUMP);
+ InjectHook(0x592880, ConvertingTexturesScreen, PATCH_JUMP);
+ InjectHook(0x592BF0, DealWithTxdWriteError, PATCH_JUMP);
+ InjectHook(0x592C70, CreateTxdImageForVideoCard, PATCH_JUMP);
+ENDPATCHES
diff --git a/src/core/TxdStore.cpp b/src/rw/TxdStore.cpp
index c751147d..c751147d 100644
--- a/src/core/TxdStore.cpp
+++ b/src/rw/TxdStore.cpp
diff --git a/src/core/TxdStore.h b/src/rw/TxdStore.h
index 12ac708f..12ac708f 100644
--- a/src/core/TxdStore.h
+++ b/src/rw/TxdStore.h
diff --git a/src/render/VisibilityPlugins.cpp b/src/rw/VisibilityPlugins.cpp
index 74cd2590..f8b1f6b2 100644
--- a/src/render/VisibilityPlugins.cpp
+++ b/src/rw/VisibilityPlugins.cpp
@@ -117,7 +117,7 @@ CVisibilityPlugins::SetRenderWareCamera(RwCamera *camera)
RpMaterial*
SetAlphaCB(RpMaterial *material, void *data)
{
- material->color.alpha = (uint8)(uint32)data;
+ ((RwRGBA*)RpMaterialGetColor(material))->alpha = (uint8)(uint32)data;
return material;
}
diff --git a/src/render/VisibilityPlugins.h b/src/rw/VisibilityPlugins.h
index 65d2675a..65d2675a 100644
--- a/src/render/VisibilityPlugins.h
+++ b/src/rw/VisibilityPlugins.h
diff --git a/src/core/rw.cpp b/src/rw/rw.cpp
index 52bcf5bb..3875f2a1 100644
--- a/src/core/rw.cpp
+++ b/src/rw/rw.cpp
@@ -11,7 +11,8 @@ typedef RwV3d *(*rwVectorsMultFn) (RwV3d * pointsOut,
const RwV3d * pointsIn,
RwInt32 numPoints,
const RwMatrix * matrix);
-
+
+#ifndef RWLIBS
WRAPPER void _rwObjectHasFrameSetFrame(void* object, RwFrame* frame) { EAXJMP(0x5BC950); }
WRAPPER RpAtomic* AtomicDefaultRenderCallBack(RpAtomic* atomic) { EAXJMP(0x59E690); }
@@ -412,4 +413,427 @@ WRAPPER RxNodeDefinition* RxNodeDefinitionGetAtomicEnumerateLights() { EAXJMP(0x
WRAPPER RxNodeDefinition* RxNodeDefinitionGetMaterialScatter() { EAXJMP(0x5DDAA0); }
WRAPPER RxNodeDefinition* RxNodeDefinitionGetLight() { EAXJMP(0x5DF040); }
WRAPPER RxNodeDefinition* RxNodeDefinitionGetPostLight() { EAXJMP(0x5DF560); }
-WRAPPER void RxD3D8AllInOneSetRenderCallBack(RxPipelineNode* node, RxD3D8AllInOneRenderCallBack callback) { EAXJMP(0x5DFC60); } \ No newline at end of file
+WRAPPER void RxD3D8AllInOneSetRenderCallBack(RxPipelineNode* node, RxD3D8AllInOneRenderCallBack callback) { EAXJMP(0x5DFC60); }
+#else
+
+extern "C"
+{
+ void* _rwFrameOpen(void* instance, RwInt32 offset, RwInt32 size);
+ void* _rwFrameClose(void* instance, RwInt32 offset, RwInt32 size);
+ RwFrame* _rwFrameCloneAndLinkClones(RwFrame* root);
+ RwFrame* _rwFramePurgeClone(RwFrame* root);
+ RwBool RwFrameDirty(RwFrame const* frame);
+ void _rwFrameInit(RwFrame* frame);
+ RwBool _rwMatrixSetMultFn(rwMatrixMultFn multMat);
+ void* _rwMatrixClose(void* instance, RwInt32 offset, RwInt32 size);
+ void* _rwMatrixOpen(void* instance, RwInt32 offset, RwInt32 size);
+ RwBool _rwVectorSetMultFn(rwVectorMultFn multPoint, rwVectorsMultFn multPoints, rwVectorMultFn multVector, rwVectorsMultFn multVectors);
+ void* _rwVectorClose(void* instance, RwInt32 offset, RwInt32 size);
+ void* _rwVectorOpen(void* instance, RwInt32 offset, RwInt32 size);
+ RwBool _rwPluginRegistryOpen();
+ RwBool _rwPluginRegistryClose();
+}
+
+STARTPATCHES
+InjectHook(0x5BC950, &_rwObjectHasFrameSetFrame, PATCH_JUMP);
+InjectHook(0x59E690, &AtomicDefaultRenderCallBack, PATCH_JUMP);
+InjectHook(0x59E6C0, &_rpAtomicResyncInterpolatedSphere, PATCH_JUMP);
+InjectHook(0x59E800, &RpAtomicGetWorldBoundingSphere, PATCH_JUMP);
+InjectHook(0x59ED50, &RpClumpGetNumAtomics, PATCH_JUMP);
+InjectHook(0x59ED80, &RpClumpRender, PATCH_JUMP);
+InjectHook(0x59EDD0, &RpClumpForAllAtomics, PATCH_JUMP);
+InjectHook(0x59EE10, &RpClumpForAllCameras, PATCH_JUMP);
+InjectHook(0x59EE60, &RpClumpForAllLights, PATCH_JUMP);
+InjectHook(0x59EEB0, &RpAtomicCreate, PATCH_JUMP);
+InjectHook(0x59EFA0, &RpAtomicSetGeometry, PATCH_JUMP);
+InjectHook(0x59F020, &RpAtomicDestroy, PATCH_JUMP);
+InjectHook(0x59F0A0, &RpAtomicClone, PATCH_JUMP);
+InjectHook(0x59F1B0, &RpClumpClone, PATCH_JUMP);
+InjectHook(0x59F490, &RpClumpCreate, PATCH_JUMP);
+InjectHook(0x59F500, &RpClumpDestroy, PATCH_JUMP);
+InjectHook(0x59F680, &RpClumpAddAtomic, PATCH_JUMP);
+InjectHook(0x59F6B0, &RpClumpRemoveAtomic, PATCH_JUMP);
+InjectHook(0x59F6E0, &RpClumpRemoveLight, PATCH_JUMP);
+InjectHook(0x59FC50, &RpClumpStreamRead, PATCH_JUMP);
+InjectHook(0x5A0510, &RpAtomicRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5A0540, &RpClumpRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5A0570, &RpAtomicRegisterPluginStream, PATCH_JUMP);
+InjectHook(0x5A05A0, &RpAtomicSetStreamAlwaysCallBack, PATCH_JUMP);
+InjectHook(0x5A05C0, &RpAtomicSetStreamRightsCallBack, PATCH_JUMP);
+InjectHook(0x5A05E0, &RpAtomicGetPluginOffset, PATCH_JUMP);
+InjectHook(0x5A0600, &RpAtomicSetFrame, PATCH_JUMP);
+InjectHook(0x5A0DC0, &RwEngineRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5A0DF0, &RwEngineGetPluginOffset, PATCH_JUMP);
+InjectHook(0x5A0E10, &RwEngineGetNumSubSystems, PATCH_JUMP);
+InjectHook(0x5A0E40, &RwEngineGetSubSystemInfo, PATCH_JUMP);
+InjectHook(0x5A0E70, &RwEngineGetCurrentSubSystem, PATCH_JUMP);
+InjectHook(0x5A0EA0, &RwEngineSetSubSystem, PATCH_JUMP);
+InjectHook(0x5A0ED0, &RwEngineGetNumVideoModes, PATCH_JUMP);
+InjectHook(0x5A0F00, &RwEngineGetVideoModeInfo, PATCH_JUMP);
+InjectHook(0x5A0F30, &RwEngineGetCurrentVideoMode, PATCH_JUMP);
+InjectHook(0x5A0F60, &RwEngineSetVideoMode, PATCH_JUMP);
+InjectHook(0x5A0F90, &RwEngineStop, PATCH_JUMP);
+InjectHook(0x5A0FE0, &RwEngineStart, PATCH_JUMP);
+InjectHook(0x5A1070, &RwEngineClose, PATCH_JUMP);
+InjectHook(0x5A10E0, &RwEngineOpen, PATCH_JUMP);
+InjectHook(0x5A1290, &RwEngineTerm, PATCH_JUMP);
+InjectHook(0x5A12D0, &RwEngineInit, PATCH_JUMP);
+InjectHook(0x5A15E0, &_rwFrameOpen, PATCH_JUMP);
+InjectHook(0x5A1650, &_rwFrameClose, PATCH_JUMP);
+InjectHook(0x5A1690, &_rwFrameCloneAndLinkClones, PATCH_JUMP);
+InjectHook(0x5A1880, &_rwFramePurgeClone, PATCH_JUMP);
+InjectHook(0x5A1930, &RwFrameDirty, PATCH_JUMP);
+InjectHook(0x5A1950, &_rwFrameInit, PATCH_JUMP);
+InjectHook(0x5A1A00, &RwFrameCreate, PATCH_JUMP);
+InjectHook(0x5A1A30, &RwFrameDestroy, PATCH_JUMP);
+InjectHook(0x5A1BF0, &RwFrameDestroyHierarchy, PATCH_JUMP);
+InjectHook(0x5A1C60, &RwFrameUpdateObjects, PATCH_JUMP);
+InjectHook(0x5A1CE0, &RwFrameGetLTM, PATCH_JUMP);
+InjectHook(0x5A1D00, &RwFrameAddChild, PATCH_JUMP);
+InjectHook(0x5A1ED0, &RwFrameRemoveChild, PATCH_JUMP);
+InjectHook(0x5A1FC0, &RwFrameForAllChildren, PATCH_JUMP);
+InjectHook(0x5A2000, &RwFrameTranslate, PATCH_JUMP);
+InjectHook(0x5A20A0, &RwFrameScale, PATCH_JUMP);
+InjectHook(0x5A2140, &RwFrameTransform, PATCH_JUMP);
+InjectHook(0x5A21E0, &RwFrameRotate, PATCH_JUMP);
+InjectHook(0x5A2280, &RwFrameSetIdentity, PATCH_JUMP);
+InjectHook(0x5A2340, &RwFrameForAllObjects, PATCH_JUMP);
+InjectHook(0x5A2380, &RwFrameRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5A23B0, &_rwMatrixSetMultFn, PATCH_JUMP);
+InjectHook(0x5A2520, &_rwMatrixDeterminant, PATCH_JUMP);
+InjectHook(0x5A2570, &_rwMatrixOrthogonalError, PATCH_JUMP);
+InjectHook(0x5A25D0, &_rwMatrixNormalError, PATCH_JUMP);
+InjectHook(0x5A2660, &_rwMatrixIdentityError, PATCH_JUMP);
+InjectHook(0x5A2730, &_rwMatrixClose, PATCH_JUMP);
+InjectHook(0x5A2770, &_rwMatrixOpen, PATCH_JUMP);
+InjectHook(0x5A2820, &RwMatrixOptimize, PATCH_JUMP);
+InjectHook(0x5A28E0, &RwMatrixUpdate, PATCH_JUMP);
+InjectHook(0x5A28F0, &RwMatrixMultiply, PATCH_JUMP);
+InjectHook(0x5A2960, &RwMatrixRotateOneMinusCosineSine, PATCH_JUMP);
+InjectHook(0x5A2BF0, &RwMatrixRotate, PATCH_JUMP);
+InjectHook(0x5A2C90, &RwMatrixInvert, PATCH_JUMP);
+InjectHook(0x5A2EE0, &RwMatrixScale, PATCH_JUMP);
+InjectHook(0x5A3070, &RwMatrixTranslate, PATCH_JUMP);
+InjectHook(0x5A31C0, &RwMatrixTransform, PATCH_JUMP);
+InjectHook(0x5A3300, &RwMatrixDestroy, PATCH_JUMP);
+InjectHook(0x5A3330, &RwMatrixCreate, PATCH_JUMP);
+InjectHook(0x5A3450, &_rwVectorSetMultFn, PATCH_JUMP);
+InjectHook(0x5A3600, &_rwV3dNormalize, PATCH_JUMP);
+InjectHook(0x5A36A0, &RwV3dLength, PATCH_JUMP);
+InjectHook(0x5A3710, &_rwSqrt, PATCH_JUMP);
+InjectHook(0x5A3770, &_rwInvSqrt, PATCH_JUMP);
+InjectHook(0x5A37D0, &RwV3dTransformPoints, PATCH_JUMP);
+InjectHook(0x5A37E0, &RwV3dTransformVectors, PATCH_JUMP);
+InjectHook(0x5A37F0, &_rwVectorClose, PATCH_JUMP);
+InjectHook(0x5A3860, &_rwVectorOpen, PATCH_JUMP);
+InjectHook(0x5A3AD0, &RwStreamRead, PATCH_JUMP);
+InjectHook(0x5A3C30, &RwStreamWrite, PATCH_JUMP);
+InjectHook(0x5A3DF0, &RwStreamSkip, PATCH_JUMP);
+InjectHook(0x5A3F10, &RwStreamClose, PATCH_JUMP);
+InjectHook(0x5A3FE0, &RwStreamOpen, PATCH_JUMP);
+InjectHook(0x5A43A0, &RwIm2DGetNearScreenZ, PATCH_JUMP);
+InjectHook(0x5A43B0, &RwIm2DGetFarScreenZ, PATCH_JUMP);
+InjectHook(0x5A43C0, &RwRenderStateSet, PATCH_JUMP);
+InjectHook(0x5A4410, &RwRenderStateGet, PATCH_JUMP);
+InjectHook(0x5A4420, &RwIm2DRenderLine, PATCH_JUMP);
+InjectHook(0x5A4430, &RwIm2DRenderPrimitive, PATCH_JUMP);
+InjectHook(0x5A4440, &RwIm2DRenderIndexedPrimitive, PATCH_JUMP);
+InjectHook(0x5A5020, &RwCameraEndUpdate, PATCH_JUMP);
+InjectHook(0x5A5030, &RwCameraBeginUpdate, PATCH_JUMP);
+InjectHook(0x5A5040, &RwCameraSetViewOffset, PATCH_JUMP);
+InjectHook(0x5A5070, &RwCameraSetNearClipPlane, PATCH_JUMP);
+InjectHook(0x5A5140, &RwCameraSetFarClipPlane, PATCH_JUMP);
+InjectHook(0x5A5170, &RwCameraFrustumTestSphere, PATCH_JUMP);
+InjectHook(0x5A51E0, &RwCameraClear, PATCH_JUMP);
+InjectHook(0x5A5210, &RwCameraShowRaster, PATCH_JUMP);
+InjectHook(0x5A5240, &RwCameraSetProjection, PATCH_JUMP);
+InjectHook(0x5A52B0, &RwCameraSetViewWindow, PATCH_JUMP);
+InjectHook(0x5A52F0, &RwCameraRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5A5320, &RwCameraDestroy, PATCH_JUMP);
+InjectHook(0x5A5360, &RwCameraCreate, PATCH_JUMP);
+InjectHook(0x5A7100, &RwTextureSetMipmapping, PATCH_JUMP);
+InjectHook(0x5A7120, &RwTextureGetMipmapping, PATCH_JUMP);
+InjectHook(0x5A7130, &RwTextureSetAutoMipmapping, PATCH_JUMP);
+InjectHook(0x5A7150, &RwTextureGetAutoMipmapping, PATCH_JUMP);
+InjectHook(0x5A7160, &RwTexDictionaryCreate, PATCH_JUMP);
+InjectHook(0x5A7200, &RwTexDictionaryDestroy, PATCH_JUMP);
+InjectHook(0x5A7290, &RwTexDictionaryForAllTextures, PATCH_JUMP);
+InjectHook(0x5A72D0, &RwTextureCreate, PATCH_JUMP);
+InjectHook(0x5A7330, &RwTextureDestroy, PATCH_JUMP);
+InjectHook(0x5A73B0, &RwTextureSetName, PATCH_JUMP);
+InjectHook(0x5A7420, &RwTextureSetMaskName, PATCH_JUMP);
+InjectHook(0x5A7490, &RwTexDictionaryAddTexture, PATCH_JUMP);
+InjectHook(0x5A74D0, &RwTexDictionaryFindNamedTexture, PATCH_JUMP);
+InjectHook(0x5A7550, &RwTexDictionarySetCurrent, PATCH_JUMP);
+InjectHook(0x5A7570, &RwTexDictionaryGetCurrent, PATCH_JUMP);
+InjectHook(0x5A7580, &RwTextureRead, PATCH_JUMP);
+InjectHook(0x5A7780, &RwTextureRasterGenerateMipmaps, PATCH_JUMP);
+InjectHook(0x5A9120, &RwImageCreate, PATCH_JUMP);
+InjectHook(0x5A9180, &RwImageDestroy, PATCH_JUMP);
+InjectHook(0x5A91E0, &RwImageAllocatePixels, PATCH_JUMP);
+InjectHook(0x5A92A0, &RwImageFreePixels, PATCH_JUMP);
+InjectHook(0x5A92D0, &RwImageMakeMask, PATCH_JUMP);
+InjectHook(0x5A93A0, &RwImageApplyMask, PATCH_JUMP);
+InjectHook(0x5A9750, &RwImageSetPath, PATCH_JUMP);
+InjectHook(0x5A9810, &RwImageRead, PATCH_JUMP);
+InjectHook(0x5A9B40, &RwImageFindFileType, PATCH_JUMP);
+InjectHook(0x5A9C10, &RwImageReadMaskedImage, PATCH_JUMP);
+InjectHook(0x5A9F50, &RwImageCopy, PATCH_JUMP);
+InjectHook(0x5AA130, &RwImageGammaCorrect, PATCH_JUMP);
+InjectHook(0x5AA2C0, &RwImageSetGamma, PATCH_JUMP);
+InjectHook(0x5AA4E0, &_rwStreamWriteVersionedChunkHeader, PATCH_JUMP);
+InjectHook(0x5AA540, &RwStreamFindChunk, PATCH_JUMP);
+InjectHook(0x5AA640, &RwMemLittleEndian32, PATCH_JUMP);
+InjectHook(0x5AA650, &RwMemNative32, PATCH_JUMP);
+InjectHook(0x5AA660, &RwMemFloat32ToReal, PATCH_JUMP);
+InjectHook(0x5AA680, &RwStreamWriteReal, PATCH_JUMP);
+InjectHook(0x5AA720, &RwStreamWriteInt32, PATCH_JUMP);
+InjectHook(0x5AA740, &RwStreamReadReal, PATCH_JUMP);
+InjectHook(0x5AA7B0, &RwStreamReadInt32, PATCH_JUMP);
+InjectHook(0x5AA800, &RwTextureStreamGetSize, PATCH_JUMP);
+InjectHook(0x5AA870, &RwTextureStreamWrite, PATCH_JUMP);
+InjectHook(0x5AAA40, &RwTextureStreamRead, PATCH_JUMP);
+InjectHook(0x5AB020, &RwTexDictionaryStreamWrite, PATCH_JUMP);
+InjectHook(0x5AC890, &RpMorphTargetCalcBoundingSphere, PATCH_JUMP);
+InjectHook(0x5AC9A0, &RpGeometryAddMorphTargets, PATCH_JUMP);
+InjectHook(0x5ACB60, &RpGeometryTriangleSetVertexIndices, PATCH_JUMP);
+InjectHook(0x5ACB90, &RpGeometryTriangleSetMaterial, PATCH_JUMP);
+InjectHook(0x5ACBF0, &RpGeometryForAllMaterials, PATCH_JUMP);
+InjectHook(0x5ACC30, &RpGeometryLock, PATCH_JUMP);
+InjectHook(0x5ACC60, &RpGeometryUnlock, PATCH_JUMP);
+InjectHook(0x5ACD10, &RpGeometryCreate, PATCH_JUMP);
+InjectHook(0x5ACF40, &_rpGeometryAddRef, PATCH_JUMP);
+InjectHook(0x5ACF50, &RpGeometryDestroy, PATCH_JUMP);
+InjectHook(0x5ACFF0, &RpGeometryRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5AD020, &RpGeometryRegisterPluginStream, PATCH_JUMP);
+InjectHook(0x5AD050, &RpGeometryStreamRead, PATCH_JUMP);
+InjectHook(0x5AD6D0, &RwRasterGetCurrentContext, PATCH_JUMP);
+InjectHook(0x5AD6F0, &RwRasterUnlock, PATCH_JUMP);
+InjectHook(0x5AD710, &RwRasterRenderFast, PATCH_JUMP);
+InjectHook(0x5AD750, &RwRasterUnlockPalette, PATCH_JUMP);
+InjectHook(0x5AD780, &RwRasterDestroy, PATCH_JUMP);
+InjectHook(0x5AD7C0, &RwRasterPushContext, PATCH_JUMP);
+InjectHook(0x5AD810, &RwRasterRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5AD840, &RwRasterLockPalette, PATCH_JUMP);
+InjectHook(0x5AD870, &RwRasterPopContext, PATCH_JUMP);
+InjectHook(0x5AD8C0, &RwRasterGetNumLevels, PATCH_JUMP);
+InjectHook(0x5AD900, &RwRasterShowRaster, PATCH_JUMP);
+InjectHook(0x5AD930, &RwRasterCreate, PATCH_JUMP);
+InjectHook(0x5AD9D0, &RwRasterLock, PATCH_JUMP);
+InjectHook(0x5ADC30, &RpMaterialCreate, PATCH_JUMP);
+InjectHook(0x5ADCB0, &RpMaterialDestroy, PATCH_JUMP);
+InjectHook(0x5ADD10, &RpMaterialSetTexture, PATCH_JUMP);
+InjectHook(0x5ADD40, &RpMaterialRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5ADD70, &RpMaterialRegisterPluginStream, PATCH_JUMP);
+InjectHook(0x5ADDA0, &RpMaterialStreamRead, PATCH_JUMP);
+InjectHook(0x5AE0B0, &_rpSectorDefaultRenderCallBack, PATCH_JUMP);
+InjectHook(0x5AE100, &_rpWorldForAllGlobalLights, PATCH_JUMP);
+InjectHook(0x5AE150, &_rpWorldSectorForAllLocalLights, PATCH_JUMP);
+InjectHook(0x5AE190, &RpWorldUnlock, PATCH_JUMP);
+InjectHook(0x5AE2B0, &RpWorldSectorGetWorld, PATCH_JUMP);
+InjectHook(0x5AE340, &RpWorldDestroy, PATCH_JUMP);
+InjectHook(0x5AE6A0, &RpWorldCreate, PATCH_JUMP);
+InjectHook(0x5AEA40, &RpWorldRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5AEA70, &RpWorldRegisterPluginStream, PATCH_JUMP);
+InjectHook(0x5AEAA0, &RpWorldPluginAttach, PATCH_JUMP);
+InjectHook(0x5AFB80, &RpWorldAddCamera, PATCH_JUMP);
+InjectHook(0x5AFBB0, &RpWorldRemoveCamera, PATCH_JUMP);
+InjectHook(0x5AFC10, &RpAtomicGetWorld, PATCH_JUMP);
+InjectHook(0x5AFC20, &RpWorldAddClump, PATCH_JUMP);
+InjectHook(0x5AFDA0, &RpWorldAddLight, PATCH_JUMP);
+InjectHook(0x5AFDF0, &RpWorldRemoveLight, PATCH_JUMP);
+InjectHook(0x5AFE70, &RtBMPImageRead, PATCH_JUMP);
+InjectHook(0x5B07D0, &RpSkinPluginAttach, PATCH_JUMP);
+InjectHook(0x5B1050, &RpSkinAtomicSetHAnimHierarchy, PATCH_JUMP);
+InjectHook(0x5B1070, &RpSkinAtomicGetHAnimHierarchy, PATCH_JUMP);
+InjectHook(0x5B1080, &RpSkinGeometryGetSkin, PATCH_JUMP);
+InjectHook(0x5B1090, &RpSkinGeometrySetSkin, PATCH_JUMP);
+InjectHook(0x5B10D0, &RpSkinGetSkinToBoneMatrices, PATCH_JUMP);
+InjectHook(0x5B10E0, &RpHAnimHierarchyCreate, PATCH_JUMP);
+InjectHook(0x5B11F0, &RpHAnimFrameGetHierarchy, PATCH_JUMP);
+InjectHook(0x5B1200, &RpHAnimHierarchySetCurrentAnim, PATCH_JUMP);
+InjectHook(0x5B12B0, &RpHAnimHierarchySubAnimTime, PATCH_JUMP);
+InjectHook(0x5B1480, &RpHAnimHierarchyAddAnimTime, PATCH_JUMP);
+InjectHook(0x5B1780, &RpHAnimHierarchyUpdateMatrices, PATCH_JUMP);
+InjectHook(0x5B1C10, &RpHAnimAnimationStreamRead, PATCH_JUMP);
+InjectHook(0x5B1D50, &RpHAnimPluginAttach, PATCH_JUMP);
+InjectHook(0x5B2640, &RpMatFXPluginAttach, PATCH_JUMP);
+InjectHook(0x5B3750, &RpMatFXAtomicEnableEffects, PATCH_JUMP);
+InjectHook(0x5B3780, &RpMatFXMaterialSetEffects, PATCH_JUMP);
+InjectHook(0x5B38D0, &RpMatFXMaterialSetupEnvMap, PATCH_JUMP);
+InjectHook(0x5B3A40, &RpMatFXMaterialSetBumpMapTexture, PATCH_JUMP);
+InjectHook(0x5B3CF0, &RwD3D8SetRenderState, PATCH_JUMP);
+InjectHook(0x5B3D40, &RwD3D8GetRenderState, PATCH_JUMP);
+InjectHook(0x5B3D60, &RwD3D8SetTextureStageState, PATCH_JUMP);
+InjectHook(0x5B53A0, &RwD3D8SetTexture, PATCH_JUMP);
+InjectHook(0x5B6720, &RwIm3DTransform, PATCH_JUMP);
+InjectHook(0x5B67F0, &RwIm3DEnd, PATCH_JUMP);
+InjectHook(0x5B6820, &RwIm3DRenderIndexedPrimitive, PATCH_JUMP);
+InjectHook(0x5B6980, &RwIm3DRenderLine, PATCH_JUMP);
+InjectHook(0x5B6A50, &RwIm3DSetTransformPipeline, PATCH_JUMP);
+InjectHook(0x5B6AC0, &RwIm3DSetRenderPipeline, PATCH_JUMP);
+InjectHook(0x5B95D0, &RwD3D8EngineSetRefreshRate, PATCH_JUMP);
+InjectHook(0x5B9640, &RwD3D8CameraAttachWindow, PATCH_JUMP);
+InjectHook(0x5BAEB0, &RwD3D8DeviceSupportsDXTTexture, PATCH_JUMP);
+InjectHook(0x5BAF90, &RwD3D8SetVertexShader, PATCH_JUMP);
+InjectHook(0x5BAFD0, &RwD3D8SetPixelShader, PATCH_JUMP);
+InjectHook(0x5BB010, &RwD3D8SetStreamSource, PATCH_JUMP);
+InjectHook(0x5BB060, &RwD3D8SetIndices, PATCH_JUMP);
+InjectHook(0x5BB0B0, &RwD3D8DrawIndexedPrimitive, PATCH_JUMP);
+InjectHook(0x5BB140, &RwD3D8DrawPrimitive, PATCH_JUMP);
+InjectHook(0x5BB1D0, &RwD3D8SetTransform, PATCH_JUMP);
+InjectHook(0x5BB310, &RwD3D8GetTransform, PATCH_JUMP);
+InjectHook(0x5BB340, &RwD3D8SetTransformWorld, PATCH_JUMP);
+InjectHook(0x5BB490, &RwD3D8SetSurfaceProperties, PATCH_JUMP);
+InjectHook(0x5BB7A0, &RwD3D8SetLight, PATCH_JUMP);
+InjectHook(0x5BB890, &RwD3D8EnableLight, PATCH_JUMP);
+InjectHook(0x5BB9F0, &RwD3D8DynamicVertexBufferCreate, PATCH_JUMP);
+InjectHook(0x5BBAE0, &RwD3D8DynamicVertexBufferDestroy, PATCH_JUMP);
+InjectHook(0x5BBB10, &RwD3D8IndexBufferCreate, PATCH_JUMP);
+InjectHook(0x5BBB40, &RwD3D8CreatePixelShader, PATCH_JUMP);
+InjectHook(0x5BBB90, &RwD3D8DeletePixelShader, PATCH_JUMP);
+InjectHook(0x5BBC00, &RwD3D8SetPixelShaderConstant, PATCH_JUMP);
+InjectHook(0x5BBC30, &RwD3D8GetCaps, PATCH_JUMP);
+InjectHook(0x5BBC40, &RwD3D8CameraIsSphereFullyInsideFrustum, PATCH_JUMP);
+InjectHook(0x5BBCA0, &RwD3D8CameraIsBBoxFullyInsideFrustum, PATCH_JUMP);
+InjectHook(0x5BBD30, &RwD3D8DynamicVertexBufferLock, PATCH_JUMP);
+InjectHook(0x5BBEB0, &RwD3D8DynamicVertexBufferUnlock, PATCH_JUMP);
+InjectHook(0x5BBED0, &_rwIntelSSEsupported, PATCH_JUMP);
+InjectHook(0x5BBF10, &RwImageSetFromRaster, PATCH_JUMP);
+InjectHook(0x5BBF50, &RwRasterSetFromImage, PATCH_JUMP);
+InjectHook(0x5BBF80, &RwImageFindRasterFormat, PATCH_JUMP);
+InjectHook(0x5BBFF0, &RwFrameRegisterPluginStream, PATCH_JUMP);
+InjectHook(0x5BC020, &_rwFrameListDeinitialize, PATCH_JUMP);
+InjectHook(0x5BC050, &_rwFrameListStreamRead, PATCH_JUMP);
+InjectHook(0x5BC300, &RpLightSetRadius, PATCH_JUMP);
+InjectHook(0x5BC320, &RpLightSetColor, PATCH_JUMP);
+InjectHook(0x5BC370, &RpLightGetConeAngle, PATCH_JUMP);
+InjectHook(0x5BC5B0, &RpLightRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5BC5E0, &RpLightStreamRead, PATCH_JUMP);
+InjectHook(0x5BC780, &RpLightDestroy, PATCH_JUMP);
+InjectHook(0x5BC7C0, &RpLightCreate, PATCH_JUMP);
+InjectHook(0x5BE280, &_rwD3D8TexDictionaryEnableRasterFormatConversion, PATCH_JUMP);
+InjectHook(0x5BF110, &RwOsGetFileInterface, PATCH_JUMP);
+InjectHook(0x5C1720, &RwFreeListDestroy, PATCH_JUMP);
+InjectHook(0x5C1790, &RwFreeListCreate, PATCH_JUMP);
+InjectHook(0x5C19F0, &RwFreeListPurge, PATCH_JUMP);
+InjectHook(0x5C1B90, &RwFreeListPurgeAllFreeLists, PATCH_JUMP);
+InjectHook(0x5C1D40, &RwFreeListForAllUsed, PATCH_JUMP);
+InjectHook(0x5C2780, &_rxPipelineClose, PATCH_JUMP);
+InjectHook(0x5C27E0, &_rxPipelineOpen, PATCH_JUMP);
+InjectHook(0x5C2AD0, &RxHeapGetGlobalHeap, PATCH_JUMP);
+InjectHook(0x5C2AE0, &RxPacketCreate, PATCH_JUMP);
+InjectHook(0x5C2B10, &RxClusterSetExternalData, PATCH_JUMP);
+InjectHook(0x5C2B70, &RxClusterSetData, PATCH_JUMP);
+InjectHook(0x5C2BD0, &RxClusterInitializeData, PATCH_JUMP);
+InjectHook(0x5C2C40, &RxClusterResizeData, PATCH_JUMP);
+InjectHook(0x5C2C90, &RxClusterLockWrite, PATCH_JUMP);
+InjectHook(0x5C2D60, &RxPipelineExecute, PATCH_JUMP);
+InjectHook(0x5C2E00, &RxPipelineCreate, PATCH_JUMP);
+InjectHook(0x5C2E70, &_rxPipelineDestroy, PATCH_JUMP);
+InjectHook(0x5C3080, &RwResourcesFreeResEntry, PATCH_JUMP);
+InjectHook(0x5C30F0, &_rwResourcesPurge, PATCH_JUMP);
+InjectHook(0x5C3170, &RwResourcesAllocateResEntry, PATCH_JUMP);
+InjectHook(0x5C3360, &RwResourcesEmptyArena, PATCH_JUMP);
+InjectHook(0x5C3450, &_rwPluginRegistryOpen, PATCH_JUMP);
+InjectHook(0x5C3480, &_rwPluginRegistryClose, PATCH_JUMP);
+InjectHook(0x5C3590, &_rwPluginRegistryGetPluginOffset, PATCH_JUMP);
+InjectHook(0x5C35C0, &_rwPluginRegistryAddPlugin, PATCH_JUMP);
+InjectHook(0x5C37F0, &_rwPluginRegistryInitObject, PATCH_JUMP);
+InjectHook(0x5C3850, &_rwPluginRegistryDeInitObject, PATCH_JUMP);
+InjectHook(0x5C3880, &_rwPluginRegistryCopyObject, PATCH_JUMP);
+InjectHook(0x5C3910, &RwErrorSet, PATCH_JUMP);
+InjectHook(0x5C3970, &_rwerror, PATCH_JUMP);
+InjectHook(0x5C3980, &_rwPluginRegistryAddPluginStream, PATCH_JUMP);
+InjectHook(0x5C39C0, &_rwPluginRegistryAddPlgnStrmlwysCB, PATCH_JUMP);
+InjectHook(0x5C39F0, &_rwPluginRegistryAddPlgnStrmRightsCB, PATCH_JUMP);
+InjectHook(0x5C3A20, & _rwPluginRegistryReadDataChunks, PATCH_JUMP);
+InjectHook(0x5C3B50, & _rwPluginRegistryInvokeRights, PATCH_JUMP);
+InjectHook(0x5C3BA0, &_rwPluginRegistryGetSize, PATCH_JUMP);
+InjectHook(0x5C3BE0, &_rwPluginRegistryWriteDataChunks, PATCH_JUMP);
+InjectHook(0x5C3CB0, &_rwPluginRegistrySkipDataChunks, PATCH_JUMP);
+InjectHook(0x5C3D30, &RwCameraStreamRead, PATCH_JUMP);
+InjectHook(0x5C5570, &RwBBoxCalculate, PATCH_JUMP);
+InjectHook(0x5C72B0, &RwImageResample, PATCH_JUMP);
+InjectHook(0x5C7B30, &RwImageCreateResample, PATCH_JUMP);
+InjectHook(0x5D9240, &RxRenderStateVectorSetDefaultRenderStateVector, PATCH_JUMP);
+InjectHook(0x5D9340, &RxRenderStateVectorCreate, PATCH_JUMP);
+InjectHook(0x5D9410, &RxRenderStateVectorDestroy, PATCH_JUMP);
+InjectHook(0x5D9460, &RxRenderStateVectorLoadDriverState, PATCH_JUMP);
+InjectHook(0x5D95D0, &_rxEmbeddedPacketBetweenPipelines, PATCH_JUMP);
+InjectHook(0x5D9740, &_rxEmbeddedPacketBetweenNodes, PATCH_JUMP);
+InjectHook(0x5D9810, &_rxPacketDestroy, PATCH_JUMP);
+InjectHook(0x5C8B10, &_rpMaterialListDeinitialize, PATCH_JUMP);
+InjectHook(0x5C8B70, &_rpMaterialListInitialize, PATCH_JUMP);
+InjectHook(0x5C8B80, &_rpMaterialListGetMaterial, PATCH_JUMP);
+InjectHook(0x5C8B90, &_rpMaterialListAppendMaterial, PATCH_JUMP);
+InjectHook(0x5C8C50, &_rpMaterialListFindMaterialIndex, PATCH_JUMP);
+InjectHook(0x5C8C80, &_rpMaterialListStreamRead, PATCH_JUMP);
+InjectHook(0x5C8FE0, &_rpMeshHeaderCreate, PATCH_JUMP);
+InjectHook(0x5C8FF0, &_rpMeshClose, PATCH_JUMP);
+InjectHook(0x5C9020, &_rpMeshOpen, PATCH_JUMP);
+InjectHook(0x5C9140, &_rpBuildMeshCreate, PATCH_JUMP);
+InjectHook(0x5C9220, &_rpBuildMeshDestroy, PATCH_JUMP);
+InjectHook(0x5C9260, &_rpMeshDestroy, PATCH_JUMP);
+InjectHook(0x5C92A0, &_rpBuildMeshAddTriangle, PATCH_JUMP);
+InjectHook(0x5C9380, &_rpMeshHeaderForAllMeshes, PATCH_JUMP);
+InjectHook(0x5C93C0, &_rpMeshWrite, PATCH_JUMP);
+InjectHook(0x5C9510, &_rpMeshRead, PATCH_JUMP);
+InjectHook(0x5C96E0, &_rpMeshSize, PATCH_JUMP);
+InjectHook(0x5C9730, &RpBuildMeshGenerateDefaultTriStrip, PATCH_JUMP);
+InjectHook(0x5CAE10, &_rpTriListMeshGenerate, PATCH_JUMP);
+InjectHook(0x5CB230, &_rpMeshOptimise, PATCH_JUMP);
+InjectHook(0x5CB2B0, &RpWorldSectorRegisterPlugin, PATCH_JUMP);
+InjectHook(0x5CB2E0, &RpWorldSectorRegisterPluginStream, PATCH_JUMP);
+InjectHook(0x5CB630, &RpWorldSetDefaultSectorPipeline, PATCH_JUMP);
+InjectHook(0x5CB670, &RpAtomicSetDefaultPipeline, PATCH_JUMP);
+InjectHook(0x5CDEE0, &RpHAnimStdKeyFrameToMatrix, PATCH_JUMP);
+InjectHook(0x5CE000, &RpHAnimStdKeyFrameInterpolate, PATCH_JUMP);
+InjectHook(0x5CE420, &RpHAnimStdKeyFrameBlend, PATCH_JUMP);
+InjectHook(0x5CE820, &RpHAnimStdKeyFrameStreamRead, PATCH_JUMP);
+InjectHook(0x5CE8C0, &RpHAnimStdKeyFrameStreamWrite, PATCH_JUMP);
+InjectHook(0x5CE930, &RpHAnimStdKeyFrameStreamGetSize, PATCH_JUMP);
+InjectHook(0x5CE950, &RpHAnimStdKeyFrameMulRecip, PATCH_JUMP);
+InjectHook(0x5CEAB0, &RpHAnimStdKeyFrameAdd, PATCH_JUMP);
+InjectHook(0x5D1070, &RxHeapFree, PATCH_JUMP);
+InjectHook(0x5D1260, &RxHeapAlloc, PATCH_JUMP);
+InjectHook(0x5D14D0, &RxHeapRealloc, PATCH_JUMP);
+InjectHook(0x5D1680, &_rxHeapReset, PATCH_JUMP);
+InjectHook(0x5D16F0, &RxHeapDestroy, PATCH_JUMP);
+InjectHook(0x5D1750, &RxHeapCreate, PATCH_JUMP);
+InjectHook(0x5D1EC0, &RxPipelineNodeFindOutputByName, PATCH_JUMP);
+InjectHook(0x5D1F20, &RxPipelineNodeFindInput, PATCH_JUMP);
+InjectHook(0x5D1F30, &RxPipelineNodeRequestCluster, PATCH_JUMP);
+InjectHook(0x5D1FA0, &RxLockedPipeUnlock, PATCH_JUMP);
+InjectHook(0x5D29F0, &RxPipelineLock, PATCH_JUMP);
+InjectHook(0x5D2B10, &RxPipelineFindNodeByName, PATCH_JUMP);
+InjectHook(0x5D2BA0, &RxLockedPipeAddFragment, PATCH_JUMP);
+InjectHook(0x5D2EE0, &RxLockedPipeAddPath, PATCH_JUMP);
+InjectHook(0x5D31C0, &RxNodeDefinitionGetImmRenderSetup, PATCH_JUMP);
+InjectHook(0x5D35C0, &RxNodeDefinitionGetImmMangleTriangleIndices, PATCH_JUMP);
+InjectHook(0x5D3C60, &RxNodeDefinitionGetCullTriangle, PATCH_JUMP);
+InjectHook(0x5D4F80, &RxNodeDefinitionGetClipTriangle, PATCH_JUMP);
+InjectHook(0x5D51C0, &RxNodeDefinitionGetSubmitTriangle, PATCH_JUMP);
+InjectHook(0x5D5400, &RxNodeDefinitionGetImmInstance, PATCH_JUMP);
+InjectHook(0x5D6000, &RxNodeDefinitionGetTransform, PATCH_JUMP);
+InjectHook(0x5D61C0, &RxNodeDefinitionGetImmStash, PATCH_JUMP);
+InjectHook(0x5D6470, &RxNodeDefinitionGetImmMangleLineIndices, PATCH_JUMP);
+InjectHook(0x5D7230, &RxNodeDefinitionGetClipLine, PATCH_JUMP);
+InjectHook(0x5D74C0, &RxNodeDefinitionGetSubmitLine, PATCH_JUMP);
+InjectHook(0x5D9C90, &_rwD3D8LightsOpen, PATCH_JUMP);
+InjectHook(0x5D9EF0, &_rwD3D8LightsClose, PATCH_JUMP);
+InjectHook(0x5D9F80, &_rwD3D8LightsGlobalEnable, PATCH_JUMP);
+InjectHook(0x5DA210, &_rwD3D8LightLocalEnable, PATCH_JUMP);
+InjectHook(0x5DA450, &_rwD3D8LightsEnable, PATCH_JUMP);
+InjectHook(0x5DAAC0, &RxNodeDefinitionGetD3D8WorldSectorAllInOne, PATCH_JUMP);
+InjectHook(0x5DC500, &RxNodeDefinitionGetD3D8AtomicAllInOne, PATCH_JUMP);
+InjectHook(0x5DCC50, &RxNodeDefinitionGetWorldSectorInstance, PATCH_JUMP);
+InjectHook(0x5DCD80, &RxNodeDefinitionGetWorldSectorEnumerateLights, PATCH_JUMP);
+InjectHook(0x5DD800, &RxNodeDefinitionGetAtomicInstance, PATCH_JUMP);
+InjectHook(0x5DD9B0, &RxNodeDefinitionGetAtomicEnumerateLights, PATCH_JUMP);
+InjectHook(0x5DDAA0, &RxNodeDefinitionGetMaterialScatter, PATCH_JUMP);
+InjectHook(0x5DF040, &RxNodeDefinitionGetLight, PATCH_JUMP);
+InjectHook(0x5DF560, &RxNodeDefinitionGetPostLight, PATCH_JUMP);
+InjectHook(0x5DFC60, &RxD3D8AllInOneSetRenderCallBack, PATCH_JUMP);
+ENDPATCHES
+#endif \ No newline at end of file