From 9f816ede65d2b91a76b680abb08a2eb78c1a1caa Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Thu, 1 Feb 2024 00:00:47 +0800 Subject: [PATCH] [saco] Implement _VehicleEnvMappingFromScreen --- saco/game/util.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/saco/game/util.cpp b/saco/game/util.cpp index de8fdc7..2fd7349 100644 --- a/saco/game/util.cpp +++ b/saco/game/util.cpp @@ -1057,6 +1057,44 @@ bool IsNumeric(char * szString) //---------------------------------------------------- +DWORD CamFrameBuffer=0; +DWORD FrameBufferTexture=0; + +extern CChatWindow * pChatWindow; + +void _VehicleEnvMappingFromScreen() +{ + /* + if(FrameBufferTexture) { + _asm push FrameBufferTexture + _asm mov edx, 0x7F3820 + _asm call edx + _asm pop edx + FrameBufferTexture = 0; + }*/ + + // get the frame buffer from the main RwCamera + _asm mov eax, 0xC402D8 + _asm mov ebx, [eax] + _asm mov CamFrameBuffer, ebx + + _asm push CamFrameBuffer + _asm mov edx, 0x7F37C0 // RwTextureCreate + _asm call edx + _asm pop edx + _asm mov FrameBufferTexture, eax + + if(!FrameBufferTexture) { + pChatWindow->AddDebugMessage("No texture!"); + } + + *(DWORD *)0xB4E690 = FrameBufferTexture; + *(DWORD *)0xB4E68C = FrameBufferTexture; + *(DWORD *)0xB4E47C = FrameBufferTexture; + *(DWORD *)0xB4E3EC = FrameBufferTexture; + *(float *)0x8A7780 = 2.0f; +} + BOOL IsFileOrDirectoryExists(char * szPath) { struct _stat buf;