From 7f8a4b4867cff2a2aaf32eddaca65ba9f4e92806 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Tue, 14 Apr 2020 10:31:00 +0300 Subject: Debug font and CProfiles --- src/rw/RwHelper.cpp | 53 ++++++++++++++++++++++++++++++++++++++--------------- src/rw/RwHelper.h | 1 + 2 files changed, 39 insertions(+), 15 deletions(-) (limited to 'src/rw') diff --git a/src/rw/RwHelper.cpp b/src/rw/RwHelper.cpp index 44866f4f..44ca3a0a 100644 --- a/src/rw/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,21 +385,6 @@ CameraCreate(RwInt32 width, RwInt32 height, RwBool zBuffer) return (nil); } -void CreateDebugFont() -{ - ; -} - -void DestroyDebugFont() -{ - ; -} - -void FlushObrsPrintfs() -{ - ; -} - WRAPPER void _TexturePoolsInitialise() { EAXJMP(0x598B10); } WRAPPER void _TexturePoolsShutdown() { EAXJMP(0x598B30); } diff --git a/src/rw/RwHelper.h b/src/rw/RwHelper.h index a9f0bdf4..5b47cb6f 100644 --- a/src/rw/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); -- cgit v1.2.3 From 6d934892ecd3c4b6f025fbe2c4e6504fd979d391 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Tue, 14 Apr 2020 18:35:07 +0300 Subject: RwMatFX support with linked RW libs --- src/rw/RwMatFX.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/rw') diff --git a/src/rw/RwMatFX.cpp b/src/rw/RwMatFX.cpp index ca9a633b..3af6fabe 100644 --- a/src/rw/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 -- cgit v1.2.3