From 1f9d2520638ae4675f4f67f4356e447ffb55aef7 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Mon, 19 Feb 2024 21:13:45 +0800 Subject: [PATCH] [saco] Implement `WriteRwRasterToFile()` --- saco/game/util.cpp | 49 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/saco/game/util.cpp b/saco/game/util.cpp index 398c539..724bc37 100644 --- a/saco/game/util.cpp +++ b/saco/game/util.cpp @@ -1147,6 +1147,55 @@ void _VehicleEnvMappingFromScreen() *(float *)0x8A7780 = 2.0f; } +//---------------------------------------------------- + +int Width,Height,Depth; +DWORD dwRwImage; + +void WriteRwRasterToFile(DWORD raster,char *filename) +{ + // RwImageCreate(width,height,depth) + _asm push Depth + _asm push Height + _asm push Width + _asm mov edx, 0x8026E0 + _asm call edx + _asm mov dwRwImage, eax + _asm pop edx + _asm pop edx + _asm pop edx + + // RwImageAllocatePixels + _asm push dwRwImage + _asm mov edx, 0x8027A0 + _asm call edx + _asm pop edx + + // RwImageSetFromRaster + _asm push raster + _asm push dwRwImage + _asm mov edx, 0x804250 + _asm call edx + _asm pop edx + _asm pop edx + + // RtBmpImageWrite + _asm push filename + _asm push dwRwImage + _asm mov edx, 0x7CE990 + _asm call edx + _asm pop edx + _asm pop edx + + // RwImageDestroy + _asm push dwRwImage + _asm mov edx, 0x802740 + _asm call edx + _asm pop edx +} + +//---------------------------------------------------- + BOOL IsFileOrDirectoryExists(char * szPath) { struct _stat buf;