From 0588e8866f52cb21f4747a9aec4dffde3b8db5f5 Mon Sep 17 00:00:00 2001 From: Shinovon Date: Sat, 9 May 2026 19:00:19 +0500 Subject: [PATCH 01/21] Bump pkg version forgot --- sis/re3-gles1.pkg | 2 +- sis/re3.pkg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sis/re3-gles1.pkg b/sis/re3-gles1.pkg index 5a13e0c..b20c89d 100644 --- a/sis/re3-gles1.pkg +++ b/sis/re3-gles1.pkg @@ -1,4 +1,4 @@ -#{"GTA III"},(0xe0d67647),1,0,0 +#{"GTA III"},(0xe0d67647),1,0,1 [0x101F7961], 0, 0, 0, {"S60ProductID"} ; S60v3 [0x1028315F], 0, 0, 0, {"S60ProductID"} ; ^1 diff --git a/sis/re3.pkg b/sis/re3.pkg index 83795a9..84887fd 100644 --- a/sis/re3.pkg +++ b/sis/re3.pkg @@ -1,4 +1,4 @@ -#{"GTA III"},(0xe0d67647),1,0,0 +#{"GTA III"},(0xe0d67647),1,0,1 [0x101F7961], 0, 0, 0, {"S60ProductID"} ; S60v3 [0x1028315F], 0, 0, 0, {"S60ProductID"} ; ^1 From 4e180c10516649492358f0db9973988181c2c122 Mon Sep 17 00:00:00 2001 From: Shinovon Date: Sat, 9 May 2026 19:07:55 +0500 Subject: [PATCH 02/21] Update todo --- TODO.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/TODO.md b/TODO.md index 11a6b91..698f30f 100644 --- a/TODO.md +++ b/TODO.md @@ -21,6 +21,7 @@ GLES 2.0 specific: - [ ] Fix face animations in optimized builds - [ ] Skinning shader is still broken on VC4 - [ ] Disappearing background in cutscenes +- [ ] HUD still disappearing sometimes GLES 1.1 specific: - [x] Backport to STLport v4 @@ -28,9 +29,10 @@ GLES 1.1 specific: - [x] Keyboard mappings for both QWERTY/12-keys - [ ] Use pvrtc compression - [ ] Optimize to always run 10+ fps +- [ ] Fix z-buffer issues (world clips through hud) +- [ ] Fix lighting Issues: - [x] Fix crash in Texture::destroy on exit - [x] Save menu is too slow -- [x] HUD disappearing on GLES 2.0 (mostly fixed, was caused by OOM) - [x] Crash when picking up a bat From 67cd77edf88c9cc1a3e73787271d047a0ac7ff21 Mon Sep 17 00:00:00 2001 From: Dante Leoncini Date: Sat, 9 May 2026 17:20:59 -0300 Subject: [PATCH 03/21] I already fixed the issue where the heads appeared black during cutscenes. It seems it was a vertex color problem --- src/core/main.cpp | 22 +++++++++++++--------- vendor/librw/src/gles1/gl1skin.cpp | 5 +++++ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/core/main.cpp b/src/core/main.cpp index 87484ee..d44fe99 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -1448,17 +1448,21 @@ RenderEffects(void) CGlass::Render(); CWaterCannons::Render(); CSpecialFX::Render(); -// CShadows::RenderStaticShadows(); -// CShadows::RenderStoredShadows(); -// CSkidmarks::Render(); -// CAntennas::Render(); -// CRubbish::Render(); -// CCoronas::Render(); + #ifdef RW_GLES1 + CShadows::RenderStaticShadows(); + CShadows::RenderStoredShadows(); + CSkidmarks::Render(); + CAntennas::Render(); + CRubbish::Render(); + CCoronas::Render(); + #endif CParticle::Render(); CPacManPickups::Render(); -// CWeaponEffects::Render(); -// CPointLights::RenderFogEffect(); -// CMovingThings::Render(); + #ifdef RW_GLES1 + CWeaponEffects::Render(); + CPointLights::RenderFogEffect(); + CMovingThings::Render(); + #endif CRenderer::RenderFirstPersonVehicle(); POP_RENDERGROUP(); } diff --git a/vendor/librw/src/gles1/gl1skin.cpp b/vendor/librw/src/gles1/gl1skin.cpp index 901923d..a4c3849 100644 --- a/vendor/librw/src/gles1/gl1skin.cpp +++ b/vendor/librw/src/gles1/gl1skin.cpp @@ -33,6 +33,10 @@ skinRenderCB(Atomic *atomic, InstanceDataHeader *header) InstanceData *inst = header->inst; int32 n = header->numMeshes; + //test rapido a ver si es la textura + glDisableClientState(GL_COLOR_ARRAY); + glColor4f(1,1,1,1); + while(n--){ m = inst->material; setMaterial(flags, m->color, m->surfaceProps); @@ -47,6 +51,7 @@ skinRenderCB(Atomic *atomic, InstanceDataHeader *header) // skinInstanceCB: igual que defaultInstanceCB, sin pesos/indices // porque GLES1 no puede hacer skinning en GPU +// aunque... capaz podemos hacerloc on el PowerVR y las extensiones void skinInstanceCB(Geometry *geo, InstanceDataHeader *header, bool32 reinstance) { From 20c7bf7818645a7fa28318e3ec1f18021df5d74a Mon Sep 17 00:00:00 2001 From: Shinovon Date: Mon, 11 May 2026 06:20:30 +0500 Subject: [PATCH 04/21] Update todo --- TODO.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/TODO.md b/TODO.md index 698f30f..32eb71c 100644 --- a/TODO.md +++ b/TODO.md @@ -22,11 +22,13 @@ GLES 2.0 specific: - [ ] Skinning shader is still broken on VC4 - [ ] Disappearing background in cutscenes - [ ] HUD still disappearing sometimes +- [ ] Huge lag spikes on VC4 GLES 1.1 specific: - [x] Backport to STLport v4 - [x] GLES 1.1 engine - [x] Keyboard mappings for both QWERTY/12-keys +- [x] Fix cutscene heads - [ ] Use pvrtc compression - [ ] Optimize to always run 10+ fps - [ ] Fix z-buffer issues (world clips through hud) From 7f9b635431197d6afb8d327ca961a03854053bed Mon Sep 17 00:00:00 2001 From: Shinovon Date: Tue, 12 May 2026 07:00:35 +0500 Subject: [PATCH 05/21] Fix compilation for windows --- .gitignore | 1 + printHash.bat | 26 ++++++++++++++++++++++++++ printHash.sh | 14 ++++++++++++++ src/audio/eax/eax-util.cpp | 3 ++- src/audio/eax/eax-util.h | 2 +- src/audio/eax/eax.h | 2 +- src/audio/oal/oal_utils.h | 4 ++++ src/audio/sampman_oal.cpp | 2 +- src/core/config.h | 10 ++++++++-- src/core/timebars.cpp | 4 ++++ src/rw/TexRead.cpp | 5 ++++- vendor/librw/src/rwbase.h | 4 ++++ 12 files changed, 70 insertions(+), 7 deletions(-) create mode 100644 printHash.bat create mode 100644 printHash.sh diff --git a/.gitignore b/.gitignore index a2e661e..6da620a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .cproject .project *.bat +!/printHash.bat *.sis *.sisx *.d diff --git a/printHash.bat b/printHash.bat new file mode 100644 index 0000000..ef1cd9d --- /dev/null +++ b/printHash.bat @@ -0,0 +1,26 @@ +@echo off + +REM creates version.h with HEAD commit hash +REM params: $1=full path to output file (usually points version.h) + +setlocal enableextensions enabledelayedexpansion + +cd /d "%~dp0" + +break> %1 + + %1 + +where git +if "%errorlevel%" == "0" ( goto :havegit ) else ( goto :writeending ) + +:havegit +for /f %%v in ('git rev-parse --short HEAD') do set version=%%v +> %1 + +:writeending + +echo ^" >> %1 +echo const char* g_GIT_SHA1 = GIT_SHA1; >> %1 + +EXIT /B \ No newline at end of file diff --git a/printHash.sh b/printHash.sh new file mode 100644 index 0000000..213d935 --- /dev/null +++ b/printHash.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env sh +if [ -z "${1}" ] + then + printf "%s\n" "Input the path to the file for writing the commit hash to." + else + printf "%s" "#define GIT_SHA1 \"" > $1 + + if (command -v "git" >/dev/null) then + git rev-parse --short HEAD | tr -d '\n' >> $1 + fi + + printf "%s\n" "\"" >> $1 + printf "%s\n" "const char* g_GIT_SHA1 = GIT_SHA1;" >> $1 +fi diff --git a/src/audio/eax/eax-util.cpp b/src/audio/eax/eax-util.cpp index 42eef73..64a1eff 100644 --- a/src/audio/eax/eax-util.cpp +++ b/src/audio/eax/eax-util.cpp @@ -6,7 +6,7 @@ * Arrays grouping together all the EAX presets in a scenario * * * ************************************************************************************************/ - +#if 0 #include "eax-util.h" #include @@ -704,3 +704,4 @@ EAXLISTENERPROPERTIES EAX30_MISC_PRESETS[] = EAX30_PRESET_SMALLWATERROOM }; +#endif diff --git a/src/audio/eax/eax-util.h b/src/audio/eax/eax-util.h index 441f011..c97a35e 100644 --- a/src/audio/eax/eax-util.h +++ b/src/audio/eax/eax-util.h @@ -8,7 +8,7 @@ * * \*******************************************************************/ -#ifndef EAXUTIL_INCLUDED +#if !defined EAXUTIL_INCLUDED && 0 #define EAXUTIL_INCLUDED #include diff --git a/src/audio/eax/eax.h b/src/audio/eax/eax.h index b221093..9496265 100644 --- a/src/audio/eax/eax.h +++ b/src/audio/eax/eax.h @@ -5,7 +5,7 @@ * * ********************************************************************/ -#ifndef EAX_H_INCLUDED +#if !defined EAX_H_INCLUDED && 0 #define EAX_H_INCLUDED #ifdef __cplusplus diff --git a/src/audio/oal/oal_utils.h b/src/audio/oal/oal_utils.h index f0fa090..24b6f1c 100644 --- a/src/audio/oal/oal_utils.h +++ b/src/audio/oal/oal_utils.h @@ -1,5 +1,9 @@ #pragma once +#ifdef AUDIO_OAL +#undef AUDIO_OAL +#endif + #ifdef AUDIO_OAL #include "eax.h" #include "AL/efx.h" diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp index d59b86e..64195f9 100644 --- a/src/audio/sampman_oal.cpp +++ b/src/audio/sampman_oal.cpp @@ -1,6 +1,6 @@ //#define JUICY_OAL -#ifdef AUDIO_OAL +#if defined AUDIO_OAL && 0 #include #include "eax.h" diff --git a/src/core/config.h b/src/core/config.h index 56a689e..26bec20 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -1,7 +1,13 @@ #pragma once #define LOGS +#ifdef __SYMBIAN32__ #define LOGS_RDEBUG +#endif + +#ifdef AUDIO_OAL +#undef AUDIO_OAL +#endif // disables (most) stuff that wasn't in original gta3.exe #ifdef __MWERKS__ @@ -438,8 +444,8 @@ enum Config { //#define AUDIO_CACHE #define PS2_AUDIO_CHANNELS // increases the maximum number of audio channels to PS2 value of 44 (PC has 28 originally) #define PS2_AUDIO_PATHS // changes audio paths for cutscenes and radio to PS2 paths (needs vbdec on MSS builds) -#define AUDIO_OAL_USE_SNDFILE // use libsndfile to decode WAVs instead of our internal decoder -#define AUDIO_OAL_USE_MPG123 // use mpg123 to support mp3 files +//#define AUDIO_OAL_USE_SNDFILE // use libsndfile to decode WAVs instead of our internal decoder +//#define AUDIO_OAL_USE_MPG123 // use mpg123 to support mp3 files #define PAUSE_RADIO_IN_FRONTEND // pause radio when game is paused #define ATTACH_RELEASING_SOUNDS_TO_ENTITIES // sounds would follow ped and vehicles coordinates if not being queued otherwise #define USE_TIME_SCALE_FOR_AUDIO // slow down/speed up sounds according to the speed of the game diff --git a/src/core/timebars.cpp b/src/core/timebars.cpp index 8f01fe0..e00f76e 100644 --- a/src/core/timebars.cpp +++ b/src/core/timebars.cpp @@ -91,7 +91,9 @@ float Diag_GetFPS() return 39000.0f / (msCollected[(curMS - 1) % MAX_MS_COLLECTED] - msCollected[curMS % MAX_MS_COLLECTED]); } +#ifdef LOGS_RDEBUG extern "C" void RDebug_Printf(const char*, ...); +#endif void tbDisplay() { @@ -114,6 +116,7 @@ void tbDisplay() CFont::SetFontStyle(FONT_BANK); sprintf(temp, "FPS: %.2f", Diag_GetFPS()); if (frames >= 15) { +//#ifdef LOGS_RDEBUG // RDebug_Printf("FPS: %.2f", Diag_GetFPS()); // RDebug_Printf("vbo: %d, draw: %d, render: %d, matfx: %d, skin: %d, im2d: %d, im3d: %d", vboUploads, draw, render, matfx, skin, im2d, im3d); // for (uint32 i = 0; i < TimerBar.count; i++) { @@ -124,6 +127,7 @@ void tbDisplay() // RDebug_Printf("EndOfFrame: %.2f", endOfFrameTime); // RDebug_Printf("Frame Time: %.2f", MaxFrameTime); // RDebug_Printf(" "); +//#endif frames = 0; } else frames++; diff --git a/src/rw/TexRead.cpp b/src/rw/TexRead.cpp index a9c9946..2c7ccbf 100644 --- a/src/rw/TexRead.cpp +++ b/src/rw/TexRead.cpp @@ -207,12 +207,15 @@ RwTextureGtaStreamRead(RwStream *stream) if (gGameState == GS_INIT_PLAYING_GAME) { texLoadTime = (texNumLoaded * texLoadTime + (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond() - preloadTime) / (float)(texNumLoaded+1); texNumLoaded++; - } else if (gGameState != GS_PLAYING_GAME || FrontEndMenuManager.m_bMenuActive) { + } +#ifdef __SYMBIAN32__ + else if (gGameState != GS_PLAYING_GAME || FrontEndMenuManager.m_bMenuActive) { if (tex != nil && tex->raster != nil && (RwRasterGetWidth(tex->raster) > 128 || RwRasterGetHeight(tex->raster) > 128)) { // debug("downscaling %s", tex->name); halveTexture(tex); } } +#endif #ifdef ANISOTROPIC_FILTERING if(tex && RpAnisotGetMaxSupportedMaxAnisotropy() > 1) // BUG? this was RpAnisotTextureGetMaxAnisotropy, but that doesn't make much sense diff --git a/vendor/librw/src/rwbase.h b/vendor/librw/src/rwbase.h index fca8bed..11fb6f8 100644 --- a/vendor/librw/src/rwbase.h +++ b/vendor/librw/src/rwbase.h @@ -16,7 +16,11 @@ #ifdef OFFSET_OF #undef OFFSET_OF #endif +#ifdef __SYMBIAN32__ #define OFFSET_OF(type, member) ((size_t)&(((type*)0)->member)) +#else +#define OFFSET_OF offsetof +#endif // TODO: clean up the opengl defines // and figure out what we even want here... From e3ad2108f1f3d051e3b1f6651409bcfce14d8eeb Mon Sep 17 00:00:00 2001 From: Shinovon Date: Tue, 12 May 2026 07:24:54 +0500 Subject: [PATCH 06/21] Fix streaming on windows --- src/core/Streaming.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp index 4a7fbd7..594a054 100644 --- a/src/core/Streaming.cpp +++ b/src/core/Streaming.cpp @@ -228,8 +228,13 @@ CStreaming::Init2(void) if(ms_memoryAvailable < 10*MB) ms_memoryAvailable = 10*MB; } else + ms_memoryAvailable = STREAMING_MEM_SIZE; +#else + extern size_t _dwMemAvailPhys; + ms_memoryAvailable = (_dwMemAvailPhys - 10 * MB) / 2; + if (ms_memoryAvailable < 10 * MB) + ms_memoryAvailable = 10 * MB; #endif - ms_memoryAvailable = STREAMING_MEM_SIZE; desiredNumVehiclesLoaded = 12; if(desiredNumVehiclesLoaded > MAXVEHICLESLOADED) desiredNumVehiclesLoaded = MAXVEHICLESLOADED; @@ -2702,8 +2707,12 @@ CStreaming::MakeSpaceFor(int32 size) ms_memoryAvailable = (_dwMemAvailPhys - 10 * MB) / 2; if(ms_memoryAvailable < 10 * MB) ms_memoryAvailable = 10 * MB; } else -#endif ms_memoryAvailable = STREAMING_MEM_SIZE; +#else + extern size_t _dwMemAvailPhys; + ms_memoryAvailable = (_dwMemAvailPhys - 10 * MB) / 2; + if (ms_memoryAvailable < 10 * MB) ms_memoryAvailable = 10 * MB; +#endif } #undef MB #endif From 6992f313a9ee19cc01910c0210404c9195d1a9ed Mon Sep 17 00:00:00 2001 From: Shinovon Date: Tue, 12 May 2026 08:00:13 +0500 Subject: [PATCH 07/21] Something with streaming --- src/core/Streaming.cpp | 47 ++++++++++++---------------- src/rw/TexRead.cpp | 6 ++++ src/skel/symbian/symbian.cpp | 8 +++++ vendor/librw/src/gl/gl3raster.cpp | 2 +- vendor/librw/src/gles1/gl1raster.cpp | 4 +-- 5 files changed, 37 insertions(+), 30 deletions(-) diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp index 594a054..5624b64 100644 --- a/src/core/Streaming.cpp +++ b/src/core/Streaming.cpp @@ -85,8 +85,6 @@ int32 islandLODcomSub; int32 islandLODsubInd; int32 islandLODsubCom; -#define STREAMING_MEM_SIZE (10 * 1024 * 1024) - bool CStreamingInfo::GetCdPosnAndSize(uint32 &posn, uint32 &size) { @@ -221,19 +219,13 @@ CStreaming::Init2(void) #ifdef GTA_PC #define MB (1024*1024) #ifdef __SYMBIAN32__ - extern bool moreVram; - if (moreVram) { - extern size_t _dwMemAvailPhys; - ms_memoryAvailable = (_dwMemAvailPhys - 10*MB)/2; - if(ms_memoryAvailable < 10*MB) - ms_memoryAvailable = 10*MB; - } else - ms_memoryAvailable = STREAMING_MEM_SIZE; + extern size_t streamingMemSize; + ms_memoryAvailable = streamingMemSize; #else - extern size_t _dwMemAvailPhys; - ms_memoryAvailable = (_dwMemAvailPhys - 10 * MB) / 2; - if (ms_memoryAvailable < 10 * MB) - ms_memoryAvailable = 10 * MB; + extern size_t _dwMemAvailPhys; + ms_memoryAvailable = (_dwMemAvailPhys - 10 * MB) / 2; + if (ms_memoryAvailable < 10 * MB) + ms_memoryAvailable = 10 * MB; #endif desiredNumVehiclesLoaded = 12; if(desiredNumVehiclesLoaded > MAXVEHICLESLOADED) @@ -647,7 +639,9 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId) if(ms_aInfoForModel[streamId].m_loadState != STREAMSTATE_STARTED){ ms_aInfoForModel[streamId].m_loadState = STREAMSTATE_LOADED; #ifndef USE_CUSTOM_ALLOCATOR - ms_memoryUsed += ms_aInfoForModel[streamId].GetCdSize() * CDSTREAM_SECTOR_SIZE; + if(streamId < STREAM_OFFSET_TXD) { + ms_memoryUsed += ms_aInfoForModel[streamId].GetCdSize() * CDSTREAM_SECTOR_SIZE; + } #endif } @@ -713,7 +707,9 @@ CStreaming::FinishLoadingLargeFile(int8 *buf, int32 streamId) ms_aInfoForModel[streamId].m_loadState = STREAMSTATE_LOADED; // only done if success on PS2 #ifndef USE_CUSTOM_ALLOCATOR - ms_memoryUsed += ms_aInfoForModel[streamId].GetCdSize() * CDSTREAM_SECTOR_SIZE; + if(streamId < STREAM_OFFSET_TXD) { + ms_memoryUsed += ms_aInfoForModel[streamId].GetCdSize() * CDSTREAM_SECTOR_SIZE; + } #endif if(!success){ @@ -959,7 +955,9 @@ CStreaming::RemoveModel(int32 id) #ifdef USE_CUSTOM_ALLOCATOR UpdateMemoryUsed(); #else - ms_memoryUsed -= ms_aInfoForModel[id].GetCdSize()*CDSTREAM_SECTOR_SIZE; + if (id < STREAM_OFFSET_TXD) { + ms_memoryUsed -= ms_aInfoForModel[id].GetCdSize()*CDSTREAM_SECTOR_SIZE; + } #endif } @@ -2701,17 +2699,12 @@ CStreaming::MakeSpaceFor(int32 size) #define MB (1024 * 1024) if(ms_memoryAvailable == 0) { #ifdef __SYMBIAN32__ - extern bool moreVram; - if (moreVram) { - extern size_t _dwMemAvailPhys; - ms_memoryAvailable = (_dwMemAvailPhys - 10 * MB) / 2; - if(ms_memoryAvailable < 10 * MB) ms_memoryAvailable = 10 * MB; - } else - ms_memoryAvailable = STREAMING_MEM_SIZE; + extern size_t streamingMemSize; + ms_memoryAvailable = streamingMemSize; #else - extern size_t _dwMemAvailPhys; - ms_memoryAvailable = (_dwMemAvailPhys - 10 * MB) / 2; - if (ms_memoryAvailable < 10 * MB) ms_memoryAvailable = 10 * MB; + extern size_t _dwMemAvailPhys; + ms_memoryAvailable = (_dwMemAvailPhys - 10 * MB) / 2; + if (ms_memoryAvailable < 10 * MB) ms_memoryAvailable = 10 * MB; #endif } #undef MB diff --git a/src/rw/TexRead.cpp b/src/rw/TexRead.cpp index 2c7ccbf..87e2d64 100644 --- a/src/rw/TexRead.cpp +++ b/src/rw/TexRead.cpp @@ -532,6 +532,8 @@ CreateTxdImageForVideoCard() // only works for textures that are not yet loaded // so let's hope that is the case for all rw::gl3::needToReadBackTextures = true; +#elif defined RW_GLES1 + rw::gl1::needToReadBackTextures = true; #endif #ifdef DISABLE_VSYNC_ON_TEXTURE_CONVERSION @@ -582,6 +584,8 @@ CreateTxdImageForVideoCard() CStreaming::RemoveTxd(i); #ifdef RW_GL3 rw::gl3::needToReadBackTextures = false; +#elif defined RW_GLES1 + rw::gl1::needToReadBackTextures = false; #endif return false; } @@ -617,6 +621,8 @@ CreateTxdImageForVideoCard() #ifdef RW_GL3 rw::gl3::needToReadBackTextures = false; +#elif defined RW_GLES1 + rw::gl1::needToReadBackTextures = false; #endif if (!pDir->WriteDirFile("models\\txd.dir")) { diff --git a/src/skel/symbian/symbian.cpp b/src/skel/symbian/symbian.cpp index 3c9588e..fdb5ea5 100644 --- a/src/skel/symbian/symbian.cpp +++ b/src/skel/symbian/symbian.cpp @@ -49,6 +49,7 @@ psGlobalType psGlobal; uint32 gGameState = 0; long _dwOperatingSystemVersion = 0; uint32 _dwMemAvailPhys = 0; +size_t streamingMemSize; static EGLDisplay eglDisplay; static EGLContext eglContext; @@ -526,6 +527,13 @@ public: VersionInfo::TPlatformVersion platformVersion; VersionInfo::GetVersion(platformVersion); moreVram = platformVersion.iMajorVersion == 5 && platformVersion.iMinorVersion >= 4; + if (moreVram) { + streamingMemSize = 12 * 1024 * 1024; + } else { + streamingMemSize = 10 * 1024 * 1024; + } +#else + streamingMemSize = 8 * 1024 * 1024; #endif TSize size = Size(); diff --git a/vendor/librw/src/gl/gl3raster.cpp b/vendor/librw/src/gl/gl3raster.cpp index 95cc034..71545b1 100644 --- a/vendor/librw/src/gl/gl3raster.cpp +++ b/vendor/librw/src/gl/gl3raster.cpp @@ -630,7 +630,7 @@ rasterUnlock(Raster *raster, int32 level) #endif ) { // convert to 16-bit - uint16_t* pixels16 = (uint16_t*)malloc(raster->width * raster->height * sizeof(uint16_t)); + uint16_t* pixels16 = (uint16_t*)rwMalloc(raster->width * raster->height * sizeof(uint16_t)); uint8_t* pixels8 = (uint8_t*)raster->pixels; for (int i = 0; i < raster->width * raster->height; i++) { diff --git a/vendor/librw/src/gles1/gl1raster.cpp b/vendor/librw/src/gles1/gl1raster.cpp index bca261a..e258225 100644 --- a/vendor/librw/src/gles1/gl1raster.cpp +++ b/vendor/librw/src/gles1/gl1raster.cpp @@ -456,7 +456,7 @@ void rasterUnlock(Raster *raster, int32 level){ // flip vertical (igual que antes) { int stride = raster->width * natras->bpp; - uint8_t *tmp = (uint8_t*)malloc(stride); + uint8_t *tmp = (uint8_t*)rwMalloc(stride); for(int y = 0; y < raster->height / 2; y++){ uint8_t *a = (uint8_t*)raster->pixels + y * stride; uint8_t *b = (uint8_t*)raster->pixels + (raster->height - 1 - y) * stride; @@ -470,7 +470,7 @@ void rasterUnlock(Raster *raster, int32 level){ if(!natras->isCompressed){ if(natras->format == GL_RGBA && natras->type == GL_UNSIGNED_BYTE){ // convertir RGBA8888 → RGBA4444 - uint16_t *pixels16 = (uint16_t*)malloc(raster->width * raster->height * 2); + uint16_t *pixels16 = (uint16_t*)rwMalloc(raster->width * raster->height * 2); uint8_t *pixels8 = (uint8_t*)raster->pixels; for(int i = 0; i < raster->width * raster->height; i++){ uint8_t r = pixels8[i*4+0]; From dfdd037ed3694b6e7bd15bc53509d9a9f89ea843 Mon Sep 17 00:00:00 2001 From: Shinovon Date: Tue, 12 May 2026 08:55:18 +0500 Subject: [PATCH 08/21] Fixes --- src/core/config.h | 2 + src/rw/TexRead.cpp | 97 ++++++++++++++-------------- vendor/librw/src/gl/rwgl3.h | 2 +- vendor/librw/src/gles1/gl1raster.cpp | 21 +++--- 4 files changed, 61 insertions(+), 61 deletions(-) diff --git a/src/core/config.h b/src/core/config.h index 26bec20..9771ebe 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -1,9 +1,11 @@ #pragma once +#ifdef _DEBUG #define LOGS #ifdef __SYMBIAN32__ #define LOGS_RDEBUG #endif +#endif #ifdef AUDIO_OAL #undef AUDIO_OAL diff --git a/src/rw/TexRead.cpp b/src/rw/TexRead.cpp index 87e2d64..146140b 100644 --- a/src/rw/TexRead.cpp +++ b/src/rw/TexRead.cpp @@ -95,67 +95,69 @@ static int clamp(int size, int targetSize) static void halveTexture(RwTexture *texture){ if(texture == nil) - return; + return; + debug("halving %s", texture->name); - RwRaster *oldRaster = RwTextureGetRaster(texture); - if(oldRaster == nil) - return; + RwRaster *oldRaster = RwTextureGetRaster(texture); + if(oldRaster == nil) + return; - int oldWidth = RwRasterGetWidth(oldRaster); - int oldHeight = RwRasterGetHeight(oldRaster); + int oldWidth = RwRasterGetWidth(oldRaster); + int oldHeight = RwRasterGetHeight(oldRaster); - // dividir a la mitad, mínimo 16x16 - int newWidth = oldWidth > 16 ? oldWidth / 2 : oldWidth; - int newHeight = oldHeight > 16 ? oldHeight / 2 : oldHeight; + // dividir a la mitad, mínimo 16x16 + int newWidth = oldWidth > 16 ? oldWidth / 2 : oldWidth; + int newHeight = oldHeight > 16 ? oldHeight / 2 : oldHeight; - // si ya es suficientemente chica, no hacer nada - if(newWidth == oldWidth && newHeight == oldHeight) - return; + // si ya es suficientemente chica, no hacer nada + if(newWidth == oldWidth && newHeight == oldHeight) + return; - // toImage() funciona porque el backingStore está populado - RwImage *image = oldRaster->toImage(); - if(image == nil){ - debug("downscaleTexture: toImage FAILED for %dx%d", oldWidth, oldHeight); - return; - } + // toImage() funciona porque el backingStore está populado + RwImage *image = oldRaster->toImage(); + if(image == nil){ + debug("downscaleTexture: toImage FAILED for %dx%d", oldWidth, oldHeight); + return; + } - RwImage *resized = resizeImage(image, newWidth, newHeight); - RwImageDestroy(image); - if(resized == nil){ - debug("downscaleTexture: resizeImage FAILED"); - return; - } + RwImage *resized = resizeImage(image, newWidth, newHeight); + RwImageDestroy(image); + if(resized == nil){ + debug("downscaleTexture: resizeImage FAILED"); + return; + } - // crear nuevo raster en formato compatible con GLES1 - int32 w, h, d, f; - rw::Raster::imageFindRasterFormat(resized, rw::Raster::TEXTURE, &w, &h, &d, &f); + // crear nuevo raster en formato compatible con GLES1 + int32 w, h, d, f; + rw::Raster::imageFindRasterFormat(resized, rw::Raster::TEXTURE, &w, &h, &d, &f); #ifdef RW_GLES1 - RwRaster *newRaster = rw::Raster::create(w, h, d, f | rw::Raster::TEXTURE, rw::PLATFORM_GLES1); + RwRaster *newRaster = rw::Raster::create(w, h, d, f | rw::Raster::TEXTURE, rw::PLATFORM_GLES1); #else - RwRaster *newRaster = rw::Raster::create(w, h, d, f | rw::Raster::TEXTURE, rw::PLATFORM_GL3); + RwRaster *newRaster = rw::Raster::create(w, h, d, f | rw::Raster::TEXTURE, rw::PLATFORM_GL3); #endif - if(newRaster == nil){ - debug("downscaleTexture: raster create FAILED"); - RwImageDestroy(resized); - return; - } - - if(newRaster->setFromImage(resized) == nil){ - debug("downscaleTexture: setFromImage FAILED"); - RwRasterDestroy(newRaster); - RwImageDestroy(resized); - return; - } - + if(newRaster == nil){ + debug("downscaleTexture: raster create FAILED"); RwImageDestroy(resized); - RwTextureSetRaster(texture, newRaster); - RwRasterDestroy(oldRaster); + return; + } + + if(newRaster->setFromImage(resized) == nil){ + debug("downscaleTexture: setFromImage FAILED"); + RwRasterDestroy(newRaster); + RwImageDestroy(resized); + return; + } + + RwImageDestroy(resized); + RwTextureSetRaster(texture, newRaster); + RwRasterDestroy(oldRaster); } static void downscaleTexture(RwTexture *texture) { RwRaster *oldRaster = RwTextureGetRaster(texture); if (oldRaster == nil) return; + debug("downscaling %s", texture->name); extern bool moreVram; int targetSize = moreVram ? 64 : 32; @@ -211,7 +213,6 @@ RwTextureGtaStreamRead(RwStream *stream) #ifdef __SYMBIAN32__ else if (gGameState != GS_PLAYING_GAME || FrontEndMenuManager.m_bMenuActive) { if (tex != nil && tex->raster != nil && (RwRasterGetWidth(tex->raster) > 128 || RwRasterGetHeight(tex->raster) > 128)) { -// debug("downscaling %s", tex->name); halveTexture(tex); } } @@ -533,7 +534,7 @@ CreateTxdImageForVideoCard() // so let's hope that is the case for all rw::gl3::needToReadBackTextures = true; #elif defined RW_GLES1 - rw::gl1::needToReadBackTextures = true; + rw::gles1::needToReadBackTextures = true; #endif #ifdef DISABLE_VSYNC_ON_TEXTURE_CONVERSION @@ -585,7 +586,7 @@ CreateTxdImageForVideoCard() #ifdef RW_GL3 rw::gl3::needToReadBackTextures = false; #elif defined RW_GLES1 - rw::gl1::needToReadBackTextures = false; + rw::gles1::needToReadBackTextures = false; #endif return false; } @@ -622,7 +623,7 @@ CreateTxdImageForVideoCard() #ifdef RW_GL3 rw::gl3::needToReadBackTextures = false; #elif defined RW_GLES1 - rw::gl1::needToReadBackTextures = false; + rw::gles1::needToReadBackTextures = false; #endif if (!pDir->WriteDirFile("models\\txd.dir")) { diff --git a/vendor/librw/src/gl/rwgl3.h b/vendor/librw/src/gl/rwgl3.h index f5b966a..4a5b8a2 100644 --- a/vendor/librw/src/gl/rwgl3.h +++ b/vendor/librw/src/gl/rwgl3.h @@ -18,7 +18,7 @@ #endif #endif -#if 0 +#ifdef _DEBUG extern void re3_debug(const char *format, ...); extern void re3_trace(const char *filename, unsigned int lineno, const char *func, const char *format, ...); #define CHECK_GL_ERROR(trace) do { \ diff --git a/vendor/librw/src/gles1/gl1raster.cpp b/vendor/librw/src/gles1/gl1raster.cpp index e258225..8e7a0fd 100644 --- a/vendor/librw/src/gles1/gl1raster.cpp +++ b/vendor/librw/src/gles1/gl1raster.cpp @@ -395,11 +395,8 @@ rasterLock(Raster *raster, int32 level, int32 lockMode) px = (uint8*)rwMalloc(allocSz, MEMDUR_EVENT | ID_DRIVER); assert(raster->pixels == nil); raster->pixels = px; -#ifdef __SYMBIAN32__ + memset(px, 0, allocSz); -#else - glReadBuffer(GL_BACK); -#endif glReadPixels(0, 0, raster->width, raster->height, GL_RGB, GL_UNSIGNED_BYTE, px); raster->privateFlags = lockMode; @@ -501,11 +498,11 @@ void rasterUnlock(Raster *raster, int32 level){ rwFree(raster->pixels); raster->pixels = nil; #endif - raster->width = raster->originalWidth; - raster->height = raster->originalHeight; - raster->stride = raster->originalStride; - raster->pixels = raster->originalPixels; - raster->privateFlags = 0; + raster->width = raster->originalWidth; + raster->height = raster->originalHeight; + raster->stride = raster->originalStride; + raster->pixels = raster->originalPixels; + raster->privateFlags = 0; } int32 @@ -751,8 +748,8 @@ void evictRaster(Raster *raster); static void* destroyNativeRaster(void *object, int32 offset, int32) { - Raster *raster = (Raster*)object; - Gl1Raster *natras = PLUGINOFFSET(Gl1Raster, object, offset); + Raster *raster = (Raster*)object; + Gl1Raster *natras = PLUGINOFFSET(Gl1Raster, object, offset); #ifdef RW_GLES1 evictRaster(raster); switch(raster->type){ @@ -786,7 +783,7 @@ destroyNativeRaster(void *object, int32 offset, int32) natras->backingStore = nil; } #endif - return object; + return object; } static void* From 6c644421fd928165c4443a259ed1d1870d208974 Mon Sep 17 00:00:00 2001 From: Shinovon Date: Tue, 12 May 2026 09:01:52 +0500 Subject: [PATCH 09/21] Fix --- vendor/librw/src/gl/gl3raster.cpp | 4 ++-- vendor/librw/src/gles1/gl1raster.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/vendor/librw/src/gl/gl3raster.cpp b/vendor/librw/src/gl/gl3raster.cpp index 71545b1..d3bbc48 100644 --- a/vendor/librw/src/gl/gl3raster.cpp +++ b/vendor/librw/src/gl/gl3raster.cpp @@ -630,7 +630,7 @@ rasterUnlock(Raster *raster, int32 level) #endif ) { // convert to 16-bit - uint16_t* pixels16 = (uint16_t*)rwMalloc(raster->width * raster->height * sizeof(uint16_t)); + uint16_t* pixels16 = (uint16_t*)rwMalloc(raster->width * raster->height * sizeof(uint16_t), MEMDUR_FUNCTION | ID_DRIVER); uint8_t* pixels8 = (uint8_t*)raster->pixels; for (int i = 0; i < raster->width * raster->height; i++) { @@ -642,7 +642,7 @@ rasterUnlock(Raster *raster, int32 level) pixels16[i] = ((r >> 4) << 12) | ((g >> 4) << 8) | ((b >> 4) << 4) | (a >> 4); } glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA, raster->width, raster->height, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, pixels16); - free(pixels16); + rwFree(pixels16); CHECK_GL_ERROR("glTexImage2D 1"); } else { diff --git a/vendor/librw/src/gles1/gl1raster.cpp b/vendor/librw/src/gles1/gl1raster.cpp index 8e7a0fd..571efe3 100644 --- a/vendor/librw/src/gles1/gl1raster.cpp +++ b/vendor/librw/src/gles1/gl1raster.cpp @@ -453,7 +453,7 @@ void rasterUnlock(Raster *raster, int32 level){ // flip vertical (igual que antes) { int stride = raster->width * natras->bpp; - uint8_t *tmp = (uint8_t*)rwMalloc(stride); + uint8_t *tmp = (uint8_t*)rwMalloc(stride, MEMDUR_FUNCTION | ID_DRIVER); for(int y = 0; y < raster->height / 2; y++){ uint8_t *a = (uint8_t*)raster->pixels + y * stride; uint8_t *b = (uint8_t*)raster->pixels + (raster->height - 1 - y) * stride; @@ -461,13 +461,13 @@ void rasterUnlock(Raster *raster, int32 level){ memcpy(a, b, stride); memcpy(b, tmp, stride); } - free(tmp); + rwFree(tmp); } if(!natras->isCompressed){ if(natras->format == GL_RGBA && natras->type == GL_UNSIGNED_BYTE){ // convertir RGBA8888 → RGBA4444 - uint16_t *pixels16 = (uint16_t*)rwMalloc(raster->width * raster->height * 2); + uint16_t *pixels16 = (uint16_t*)rwMalloc(raster->width * raster->height * 2, MEMDUR_FUNCTION | ID_DRIVER); uint8_t *pixels8 = (uint8_t*)raster->pixels; for(int i = 0; i < raster->width * raster->height; i++){ uint8_t r = pixels8[i*4+0]; @@ -479,7 +479,7 @@ void rasterUnlock(Raster *raster, int32 level){ glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA, raster->width, raster->height, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, pixels16); - free(pixels16); + rwFree(pixels16); } else { glTexImage2D(GL_TEXTURE_2D, level, natras->internalFormat, raster->width, raster->height, 0, From 52c4681c0c134dde0b5239f868c6e743d8a4d792 Mon Sep 17 00:00:00 2001 From: Shinovon Date: Tue, 12 May 2026 13:17:18 +0500 Subject: [PATCH 10/21] Improve touch controls --- src/renderer/Hud.cpp | 48 +++++++++++++++--------- src/skel/symbian/symbian.cpp | 71 +++++++++++++++++++++--------------- 2 files changed, 73 insertions(+), 46 deletions(-) diff --git a/src/renderer/Hud.cpp b/src/renderer/Hud.cpp index 7b9e0dd..acd548c 100644 --- a/src/renderer/Hud.cpp +++ b/src/renderer/Hud.cpp @@ -1325,6 +1325,7 @@ void CHud::DrawAfterFade() if (touch) { // FIXME int w = 640; + int h = 360; int y = 0; { CFont::SetJustifyOff(); @@ -1349,11 +1350,30 @@ void CHud::DrawAfterFade() CSprite2d::DrawRect(CRECT(w - 180 - 90, 6 + y, 90, 20), CRGBA(0, 0, 0, 128)); PRINT("R2", w - 180 - 90, 12 + y, 90); - // select, start - CSprite2d::DrawRect(CRECT(320 - 80, 286 + y, 60, 20), CRGBA(0, 0, 0, 128)); - PRINT("select", 320 - 80, 290 + y, 60); - CSprite2d::DrawRect(CRECT(320 + 20, 286 + y, 60, 20), CRGBA(0, 0, 0, 128)); - PRINT("start", 320 + 20, 290 + y, 60); + int cy = (h * 2) / 5; + int b = 14; //(40 - 12) / 2; + + // dpad + int cx = w / 8; + CSprite2d::DrawRect(CRECT(cx - 20, cy - 60, 40, 40), CRGBA(0, 0, 0, 128)); + PRINT("\"", cx - 15, cy - 60 + b, 30); + CSprite2d::DrawRect(CRECT(cx - 20, cy + 30, 40, 40), CRGBA(0, 0, 0, 128)); + PRINT("v", cx - 15, cy + 30 + b, 30); + CSprite2d::DrawRect(CRECT(cx - 75, cy - 20, 40, 40), CRGBA(0, 0, 0, 128)); + PRINT("<", cx - 75 + 8, cy - 20 + b, 30); + CSprite2d::DrawRect(CRECT(cx + 35, cy - 20, 40, 40), CRGBA(0, 0, 0, 128)); + PRINT(">", cx + 35 + 10, cy - 20 + b, 30); + + // abxy + cx = w - w / 8; + CSprite2d::DrawRect(CRECT(cx - 20, cy - 60, 40, 40), CRGBA(0, 0, 0, 128)); + PRINT("\"", cx - 15, cy - 60 + b, 30); + CSprite2d::DrawRect(CRECT(cx - 20, cy + 30, 40, 40), CRGBA(0, 0, 0, 128)); + PRINT("X", cx - 15, cy + 30 + b, 30); + CSprite2d::DrawRect(CRECT(cx - 75, cy - 20, 40, 40), CRGBA(0, 0, 0, 128)); + PRINT("[]", cx - 75 + 12, cy - 20 + b, 30); + CSprite2d::DrawRect(CRECT(cx + 35, cy - 20, 40, 40), CRGBA(0, 0, 0, 128)); + PRINT("|", cx + 35 + 10, cy - 20 + b, 30); // l3, r3 CSprite2d::DrawRect(CRECT(320 - 80, 254 + y, 60, 20), CRGBA(0, 0, 0, 128)); @@ -1361,19 +1381,13 @@ void CHud::DrawAfterFade() CSprite2d::DrawRect(CRECT(320 + 20, 254 + y, 60, 20), CRGBA(0, 0, 0, 128)); PRINT("R3", 320 + 20, 258 + y, 60); - // dpad - CSprite2d::DrawRect(CRECT(0, 80 + y, w / 4, 120), CRGBA(0, 0, 0, 128)); - PRINT("\"", w / 8 - 15, 90 + y, 30); - PRINT("v", w / 8 - 15, 160 + y, 30); - PRINT("<", w / 8 - 60, 125 + y, 30); - PRINT(">", w / 8 + 30, 125 + y, 30); + CFont::SetScale(0.65f, 0.65f); - // abxy - CSprite2d::DrawRect(CRECT(w - w / 4, 80 + y, w / 4, 120), CRGBA(0, 0, 0, 128)); - PRINT("\"", w - w / 8 - 15, 90 + y, 30); - PRINT("X", w - w / 8 - 15, 160 + y, 30); - PRINT("[]", w - w / 8 - 60, 125 + y, 30); - PRINT("|", w - w / 8 + 30, 125 + y, 30); + // select, start + CSprite2d::DrawRect(CRECT(320 - 80, 286 + y, 60, 20), CRGBA(0, 0, 0, 128)); + PRINT("SELECT", 320 - 80, 290 + y, 60); + CSprite2d::DrawRect(CRECT(320 + 20, 286 + y, 60, 20), CRGBA(0, 0, 0, 128)); + PRINT("START", 320 + 20, 290 + y, 60); #undef PRINT #undef CRECT } diff --git a/src/skel/symbian/symbian.cpp b/src/skel/symbian/symbian.cpp index fdb5ea5..b8f38ae 100644 --- a/src/skel/symbian/symbian.cpp +++ b/src/skel/symbian/symbian.cpp @@ -625,6 +625,10 @@ public: RestartTimerL(10000); } + static bool c(int px, int py, int x, int y, int w, int h) { + return px >= x && py >= y && px <= x + w && py <= y + h; + } + virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent) { touch = true; int x = aPointerEvent.iPosition.iX; @@ -683,7 +687,7 @@ public: activeZone[i] = JOY_R2 + 1; virtualButtons[JOY_R2] = 1; } - } else if (y > 200 && y <= 360 && (x < 200 || x > w - 200)) { + } else if (y > 220 && y <= 360 && (x < 200 || x > w - 200)) { if (x < 200) { activeZone[i] = -1; stickCenterX[i] = x; @@ -712,35 +716,44 @@ public: virtualButtons[JOY_R3] = 1; } } else if (y >= 80 && y <= 80 + 120) { - if (x < w / 4) { - // dpad - int b = 0; - if (y < 125) { - b = JOY_DPAD_UP; - } else if (y > 155) { - b = JOY_DPAD_DOWN; - } else if (x < w / 8) { - b = JOY_DPAD_LEFT; - } else { - b = JOY_DPAD_RIGHT; + do { + int cy = (h * 2) / 5; + if (x < w / 4) { + // dpad + int b = 0; + int cx = w / 8; + if (c(x, y, cx - 20, cy - 60, 40, 30)) { + b = JOY_DPAD_UP; + } else if (c(x, y, cx - 20, cy + 30, 40, 40)) { + b = JOY_DPAD_DOWN; + } else if (c(x, y, cx - 75, cy - 20, 40, 40)) { + b = JOY_DPAD_LEFT; + } else if (c(x, y, cx + 35, cy - 20, 40, 40)) { + b = JOY_DPAD_RIGHT; + } else { + break; + } + activeZone[i] = b + 1; + virtualButtons[b] = 1; + } else if (x > w - w / 4) { + // abxy + int cx = w - w / 8; + int b = 0; + if (c(x, y, cx - 20, cy - 60, 40, 40)) { + b = JOY_Y; + } else if (c(x, y, cx - 20, cy + 30, 40, 40)) { + b = JOY_B; + } else if (c(x, y, cx - 75, cy - 20, 40, 40)) { + b = JOY_X; + } else if (c(x, y, cx + 35, cy - 20, 40, 40)) { + b = JOY_A; + } else { + break; + } + activeZone[i] = b + 1; + virtualButtons[b] = 1; } - activeZone[i] = b + 1; - virtualButtons[b] = 1; - } else if (x > w - w / 4) { - // abxy - int b = 0; - if (y < 125) { - b = JOY_Y; - } else if (y > 155) { - b = JOY_B; - } else if (x < w - w / 8) { - b = JOY_X; - } else { - b = JOY_A; - } - activeZone[i] = b + 1; - virtualButtons[b] = 1; - } + } while (0); } } else if (aPointerEvent.iType == TPointerEvent::EDrag) { if (activeZone[i] == -1 || activeZone[i] == -2) { From fa86cdc880b6dae81cf120fe02f5991ce1dd4309 Mon Sep 17 00:00:00 2001 From: Shinovon Date: Tue, 12 May 2026 13:17:38 +0500 Subject: [PATCH 11/21] Bump pkg version --- sis/re3-gles1.pkg | 2 +- sis/re3.pkg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sis/re3-gles1.pkg b/sis/re3-gles1.pkg index b20c89d..2f70b53 100644 --- a/sis/re3-gles1.pkg +++ b/sis/re3-gles1.pkg @@ -1,4 +1,4 @@ -#{"GTA III"},(0xe0d67647),1,0,1 +#{"GTA III"},(0xe0d67647),1,0,2 [0x101F7961], 0, 0, 0, {"S60ProductID"} ; S60v3 [0x1028315F], 0, 0, 0, {"S60ProductID"} ; ^1 diff --git a/sis/re3.pkg b/sis/re3.pkg index 84887fd..e570f2e 100644 --- a/sis/re3.pkg +++ b/sis/re3.pkg @@ -1,4 +1,4 @@ -#{"GTA III"},(0xe0d67647),1,0,1 +#{"GTA III"},(0xe0d67647),1,0,2 [0x101F7961], 0, 0, 0, {"S60ProductID"} ; S60v3 [0x1028315F], 0, 0, 0, {"S60ProductID"} ; ^1 From 2829feffadb1e4261ab71a69917f8c20a9b60451 Mon Sep 17 00:00:00 2001 From: Shinovon Date: Tue, 12 May 2026 14:02:36 +0500 Subject: [PATCH 12/21] Enable mission retry --- src/core/config.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/config.h b/src/core/config.h index 9771ebe..10edd1b 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -394,9 +394,9 @@ enum Config { #define USE_MEASUREMENTS_IN_METERS // makes game use meters instead of feet in script #define USE_PRECISE_MEASUREMENT_CONVERTION // makes game convert feet to meeters more precisely #ifdef PC_MENU -//# define MISSION_REPLAY // mobile feature +# define MISSION_REPLAY // mobile feature #endif -//#define SIMPLIER_MISSIONS // apply simplifications from mobile +#define SIMPLIER_MISSIONS // apply simplifications from mobile #define USE_ADVANCED_SCRIPT_DEBUG_OUTPUT #define SCRIPT_LOG_FILE_LEVEL 0 // 0 == no log, 1 == overwrite every frame, 2 == full log From a3847a976882d052a27fe7493bcdba88c18bc262 Mon Sep 17 00:00:00 2001 From: Shinovon Date: Tue, 12 May 2026 22:44:44 +0500 Subject: [PATCH 13/21] VC4 fixes Fixed lags on specific conditions, skinning --- TODO.md | 8 ++++---- src/core/main.cpp | 6 +++--- src/renderer/SpecialFX.cpp | 6 +++--- vendor/librw/src/gl/gl3immed.cpp | 20 ++++++++++++++++++++ vendor/librw/src/gl/gl3skin.cpp | 1 - vendor/librw/src/gl/shaders/skin.vert | 2 +- vendor/librw/src/gl/shaders/skin_gl.inc | 2 +- 7 files changed, 32 insertions(+), 13 deletions(-) diff --git a/TODO.md b/TODO.md index 32eb71c..3b2cf5f 100644 --- a/TODO.md +++ b/TODO.md @@ -16,13 +16,13 @@ Common: GLES 2.0 specific: - [x] Optimize to always run 10+ fps - [x] Fix skinning shader (cutscene heads require it) +- [x] Fix face animations in optimized builds +- [x] Disappearing background in cutscenes +- [x] Huge lag spikes on VC4 +- [x] Skinning shader is still broken on VC4 - [ ] Optimize to always run 20+ fps - [ ] Use etc1 compression -- [ ] Fix face animations in optimized builds -- [ ] Skinning shader is still broken on VC4 -- [ ] Disappearing background in cutscenes - [ ] HUD still disappearing sometimes -- [ ] Huge lag spikes on VC4 GLES 1.1 specific: - [x] Backport to STLport v4 diff --git a/src/core/main.cpp b/src/core/main.cpp index d44fe99..21643e0 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -1403,10 +1403,10 @@ RenderScene(void) } #endif PUSH_RENDERGROUP("RenderScene"); -// CClouds::Render(); + CClouds::Render(); DoRWRenderHorizon(); CRenderer::RenderRoads(); -// CCoronas::RenderReflections(); + CCoronas::RenderReflections(); RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE); CRenderer::RenderEverythingBarRoads(); CRenderer::RenderBoats(); @@ -1416,7 +1416,7 @@ RenderScene(void) #ifndef SQUEEZE_PERFORMANCE CRenderer::RenderVehiclesButNotBoats(); #endif -// CWeather::RenderRainStreaks(); + CWeather::RenderRainStreaks(); POP_RENDERGROUP(); } diff --git a/src/renderer/SpecialFX.cpp b/src/renderer/SpecialFX.cpp index 4f4e4a0..6d96d21 100644 --- a/src/renderer/SpecialFX.cpp +++ b/src/renderer/SpecialFX.cpp @@ -137,10 +137,10 @@ void CSpecialFX::Render(void) { PUSH_RENDERGROUP("CSpecialFX::Render"); -// CMotionBlurStreaks::Render(); + CMotionBlurStreaks::Render(); CBulletTraces::Render(); -// CBrightLights::Render(); -// CShinyTexts::Render(); + CBrightLights::Render(); + CShinyTexts::Render(); CMoneyMessages::Render(); #ifdef NEW_RENDERER if(!(gbNewRenderer && FredIsInFirstPersonCam())) diff --git a/vendor/librw/src/gl/gl3immed.cpp b/vendor/librw/src/gl/gl3immed.cpp index 1619f23..8eaa827 100644 --- a/vendor/librw/src/gl/gl3immed.cpp +++ b/vendor/librw/src/gl/gl3immed.cpp @@ -118,6 +118,11 @@ im2DRenderPrimitive(PrimitiveType primType, void *vertices, int32 numVertices) glEnableVertexAttribArray(ATTRIB_TEXCOORDS0); glVertexAttribPointer(ATTRIB_TEXCOORDS0, 2, GL_FLOAT, GL_FALSE, sizeof(Im2DVertex), (uint8*)vertices + OFFSET_OF(Im2DVertex, u)); + glDisableVertexAttribArray(ATTRIB_NORMAL); + glDisableVertexAttribArray(ATTRIB_WEIGHTS); + glDisableVertexAttribArray(ATTRIB_INDICES); + glDisableVertexAttribArray(ATTRIB_TEXCOORDS1); + glDrawArrays(primTypeMap[primType], 0, numVertices); glDisableVertexAttribArray(ATTRIB_POS); @@ -151,6 +156,11 @@ im2DRenderIndexedPrimitive(PrimitiveType primType, glEnableVertexAttribArray(ATTRIB_TEXCOORDS0); glVertexAttribPointer(ATTRIB_TEXCOORDS0, 2, GL_FLOAT, GL_FALSE, sizeof(Im2DVertex), (uint8*)vertices + OFFSET_OF(Im2DVertex, u)); + glDisableVertexAttribArray(ATTRIB_NORMAL); + glDisableVertexAttribArray(ATTRIB_WEIGHTS); + glDisableVertexAttribArray(ATTRIB_INDICES); + glDisableVertexAttribArray(ATTRIB_TEXCOORDS1); + glDrawElements(primTypeMap[primType], numIndices, GL_UNSIGNED_SHORT, indices); glDisableVertexAttribArray(ATTRIB_POS); @@ -221,6 +231,11 @@ im3DRenderPrimitive(PrimitiveType primType) glEnableVertexAttribArray(ATTRIB_TEXCOORDS0); glVertexAttribPointer(ATTRIB_TEXCOORDS0, 2, GL_FLOAT, GL_FALSE, sizeof(Im3DVertex), (uint8*)currentIm3dVertices + OFFSET_OF(Im3DVertex, u)); + glDisableVertexAttribArray(ATTRIB_NORMAL); + glDisableVertexAttribArray(ATTRIB_WEIGHTS); + glDisableVertexAttribArray(ATTRIB_INDICES); + glDisableVertexAttribArray(ATTRIB_TEXCOORDS1); + glDrawArrays(primTypeMap[primType], 0, num3DVertices); glDisableVertexAttribArray(ATTRIB_POS); @@ -245,6 +260,11 @@ im3DRenderIndexedPrimitive(PrimitiveType primType, void *indices, int32 numIndic glEnableVertexAttribArray(ATTRIB_TEXCOORDS0); glVertexAttribPointer(ATTRIB_TEXCOORDS0, 2, GL_FLOAT, GL_FALSE, sizeof(Im3DVertex), (uint8*)currentIm3dVertices + OFFSET_OF(Im3DVertex, u)); + glDisableVertexAttribArray(ATTRIB_NORMAL); + glDisableVertexAttribArray(ATTRIB_WEIGHTS); + glDisableVertexAttribArray(ATTRIB_INDICES); + glDisableVertexAttribArray(ATTRIB_TEXCOORDS1); + glDrawElements(primTypeMap[primType], numIndices, GL_UNSIGNED_SHORT, indices); glDisableVertexAttribArray(ATTRIB_POS); diff --git a/vendor/librw/src/gl/gl3skin.cpp b/vendor/librw/src/gl/gl3skin.cpp index 8c626d7..a3dbeee 100644 --- a/vendor/librw/src/gl/gl3skin.cpp +++ b/vendor/librw/src/gl/gl3skin.cpp @@ -342,7 +342,6 @@ skinClose(void *o, int32, int32) void initSkin(void) { - if (moreVram) return; // TODO u_boneMatrices = registerUniform("u_boneMatrices", UNIFORM_MAT4, MAX_BONES); Driver::registerPlugin(PLATFORM_GL3, 0, ID_SKIN, diff --git a/vendor/librw/src/gl/shaders/skin.vert b/vendor/librw/src/gl/shaders/skin.vert index 1092d85..65e8595 100644 --- a/vendor/librw/src/gl/shaders/skin.vert +++ b/vendor/librw/src/gl/shaders/skin.vert @@ -13,7 +13,7 @@ main(void) SkinVertex += (u_boneMatrices[int(in_indices.x)] * vec4(in_pos, 1.0)).xyz * in_weights.x; SkinVertex += (u_boneMatrices[int(in_indices.y)] * vec4(in_pos, 1.0)).xyz * in_weights.y; SkinVertex += (u_boneMatrices[int(in_indices.z)] * vec4(in_pos, 1.0)).xyz * in_weights.z; - SkinVertex += (u_boneMatrices[int(in_indices.w)] * vec4(in_pos, 1.0)).xyz * in_weights.w; + //SkinVertex += (u_boneMatrices[int(in_indices.w)] * vec4(in_pos, 1.0)).xyz * in_weights.w; vec4 Vertex = u_world * vec4(SkinVertex, 1.0); gl_Position = u_proj * u_view * Vertex; diff --git a/vendor/librw/src/gl/shaders/skin_gl.inc b/vendor/librw/src/gl/shaders/skin_gl.inc index 21f13d7..ab7115a 100644 --- a/vendor/librw/src/gl/shaders/skin_gl.inc +++ b/vendor/librw/src/gl/shaders/skin_gl.inc @@ -14,7 +14,7 @@ const char *skin_vert_src = " SkinVertex += (u_boneMatrices[int(in_indices.x)] * vec4(in_pos, 1.0)).xyz * in_weights.x;\n" " SkinVertex += (u_boneMatrices[int(in_indices.y)] * vec4(in_pos, 1.0)).xyz * in_weights.y;\n" " SkinVertex += (u_boneMatrices[int(in_indices.z)] * vec4(in_pos, 1.0)).xyz * in_weights.z;\n" -" SkinVertex += (u_boneMatrices[int(in_indices.w)] * vec4(in_pos, 1.0)).xyz * in_weights.w;\n" +" //SkinVertex += (u_boneMatrices[int(in_indices.w)] * vec4(in_pos, 1.0)).xyz * in_weights.w;\n" " vec4 Vertex = u_world * vec4(SkinVertex, 1.0);\n" " gl_Position = u_proj * u_view * Vertex;\n" From 8cdae37d6e72f784a3dfbce94a4fbc6b25e504eb Mon Sep 17 00:00:00 2001 From: Shinovon Date: Tue, 12 May 2026 22:46:35 +0500 Subject: [PATCH 14/21] Bump pkg version --- sis/re3-gles1.pkg | 2 +- sis/re3.pkg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sis/re3-gles1.pkg b/sis/re3-gles1.pkg index 2f70b53..93aa794 100644 --- a/sis/re3-gles1.pkg +++ b/sis/re3-gles1.pkg @@ -1,4 +1,4 @@ -#{"GTA III"},(0xe0d67647),1,0,2 +#{"GTA III"},(0xe0d67647),1,0,3 [0x101F7961], 0, 0, 0, {"S60ProductID"} ; S60v3 [0x1028315F], 0, 0, 0, {"S60ProductID"} ; ^1 diff --git a/sis/re3.pkg b/sis/re3.pkg index e570f2e..9374b6b 100644 --- a/sis/re3.pkg +++ b/sis/re3.pkg @@ -1,4 +1,4 @@ -#{"GTA III"},(0xe0d67647),1,0,2 +#{"GTA III"},(0xe0d67647),1,0,3 [0x101F7961], 0, 0, 0, {"S60ProductID"} ; S60v3 [0x1028315F], 0, 0, 0, {"S60ProductID"} ; ^1 From 4029e8ac5dafe2b74a0af5a0fdb3fe4ee3b6bcca Mon Sep 17 00:00:00 2001 From: Shinovon Date: Tue, 12 May 2026 22:49:50 +0500 Subject: [PATCH 15/21] Update todo --- TODO.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TODO.md b/TODO.md index 3b2cf5f..21e2dd3 100644 --- a/TODO.md +++ b/TODO.md @@ -35,6 +35,6 @@ GLES 1.1 specific: - [ ] Fix lighting Issues: -- [x] Fix crash in Texture::destroy on exit +- [ ] Fix crash in Texture::destroy on exit - [x] Save menu is too slow - [x] Crash when picking up a bat From 0f1389bb3ea2a884c3867ca79baaf4acd0441b38 Mon Sep 17 00:00:00 2001 From: Shinovon Date: Wed, 13 May 2026 11:52:05 +0500 Subject: [PATCH 16/21] Update readme --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 83d7686..59786b0 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # re3-symbian -Work-in-progress port of GTA III for Symbian devices.\ -Supports S60 3rd Edition FP1, S60 5th edition Symbian^3 and later. +Work-in-progress port of GTA III for Symbian devices. Based on re3, uses some code from [Dreamcast](https://gitlab.com/skmp/dca3-game) and [Vita](https://github.com/Rinnegatamante/librw-vita) ports. @@ -14,6 +13,13 @@ Tested devices: - Anna/Belle with BCM2727 (E7, N8, E6) - GLES 2.0 - S60v3.1 with PowerVR MBX (E90, N95) - GLES 1.1 +## Device requirements + +- S60 3rd Edition FP1, S60 5th Edition (non-Nokia), Symbian^3 or later +- GPU +- 128 MB RAM with at least 50 MB free +- Functional E: drive with 400 MB of free space + ## Building Import bld.inf in Carbide.c++ with Symbian^3 or newer SDK, add PKG file to SIS Builder and build the project. From 7e3f0685a3283cc0593ddc002b54a7a092c1450a Mon Sep 17 00:00:00 2001 From: Shinovon Date: Wed, 13 May 2026 11:56:03 +0500 Subject: [PATCH 17/21] Update readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 59786b0..72c9ed8 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,8 @@ Tested devices: - S60 3rd Edition FP1, S60 5th Edition (non-Nokia), Symbian^3 or later - GPU -- 128 MB RAM with at least 50 MB free -- Functional E: drive with 400 MB of free space +- 128 MB RAM with at least 50 MB free (won't run on regular 64 MB N95 unless you disable all textures) +- Functional E: drive with 400 MB of free space (will be more as it'll start to support audio) ## Building From 3bec747ea69fc2a402e5efe2f9c9feba57bf72b7 Mon Sep 17 00:00:00 2001 From: Shinovon Date: Thu, 14 May 2026 10:36:47 +0500 Subject: [PATCH 18/21] Check for stdcpp installation in pkg --- sis/re3.pkg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sis/re3.pkg b/sis/re3.pkg index 9374b6b..4b38c53 100644 --- a/sis/re3.pkg +++ b/sis/re3.pkg @@ -7,7 +7,7 @@ %{"nnproject"} :"nnproject" -IF (NOT package(0x20009A80)) OR (NOT package(0x2002372A)) ; old or missing openc +IF (NOT package(0x20009A80)) OR (NOT package(0x2002372A)) OR (NOT package(0x10282872)) ; old or missing openc "incompatible_openc.txt"-"", FT, FORCEABORT ENDIF From 78e67407359b761edbefbe3d551a7c5b45bc23de Mon Sep 17 00:00:00 2001 From: Shinovon Date: Thu, 14 May 2026 13:52:53 +0500 Subject: [PATCH 19/21] Supress logging --- README.md | 10 +++++----- group/librw.mmh | 2 +- vendor/librw/src/gl/gl3shader.cpp | 5 +++++ vendor/librw/src/printf_stub.c | 11 +++++++++++ 4 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 vendor/librw/src/printf_stub.c diff --git a/README.md b/README.md index 72c9ed8..6aa9517 100644 --- a/README.md +++ b/README.md @@ -8,11 +8,6 @@ Based on re3, uses some code from [Dreamcast](https://gitlab.com/skmp/dca3-game) See [TODO.md](/TODO.md) for more details on project state. -Tested devices: -- Belle with BCM2763 (700) - GLES 2.0 -- Anna/Belle with BCM2727 (E7, N8, E6) - GLES 2.0 -- S60v3.1 with PowerVR MBX (E90, N95) - GLES 1.1 - ## Device requirements - S60 3rd Edition FP1, S60 5th Edition (non-Nokia), Symbian^3 or later @@ -20,6 +15,11 @@ Tested devices: - 128 MB RAM with at least 50 MB free (won't run on regular 64 MB N95 unless you disable all textures) - Functional E: drive with 400 MB of free space (will be more as it'll start to support audio) +Tested devices: +- Belle with BCM2763 (700) - GLES 2.0 +- Anna/Belle with BCM2727 (E7, N8, E6) - GLES 2.0 +- S60v3.1 with PowerVR MBX (E90, N95) - GLES 1.1 + ## Building Import bld.inf in Carbide.c++ with Symbian^3 or newer SDK, add PKG file to SIS Builder and build the project. diff --git a/group/librw.mmh b/group/librw.mmh index b38f518..2276d21 100644 --- a/group/librw.mmh +++ b/group/librw.mmh @@ -25,4 +25,4 @@ SOURCEPATH ../vendor/librw/src/ps2 SOURCE pds.cpp ps2.cpp ps2device.cpp ps2matfx.cpp ps2raster.cpp ps2skin.cpp SOURCEPATH ../vendor/librw/src SOURCE raster.cpp render.cpp skin.cpp texture.cpp tga.cpp tristrip.cpp userdata.cpp uvanim.cpp world.cpp -SOURCE assert.cpp +SOURCE assert.cpp printf_stub.c diff --git a/vendor/librw/src/gl/gl3shader.cpp b/vendor/librw/src/gl/gl3shader.cpp index 5e37304..c217a85 100644 --- a/vendor/librw/src/gl/gl3shader.cpp +++ b/vendor/librw/src/gl/gl3shader.cpp @@ -189,8 +189,13 @@ compileshader(GLenum type, const char **src, GLuint *shader) glShaderSource(shdr, n, src, nil); glCompileShader(shdr); glGetShaderiv(shdr, GL_COMPILE_STATUS, &success); +#ifdef _DEBUG printShaderSource(src); +#endif if(!success){ +#ifndef _DEBUG + printShaderSource(src); +#endif fprintf(stderr, "Error in %s shader\n", type == GL_VERTEX_SHADER ? "vertex" : "fragment"); glGetShaderiv(shdr, GL_INFO_LOG_LENGTH, &len); diff --git a/vendor/librw/src/printf_stub.c b/vendor/librw/src/printf_stub.c new file mode 100644 index 0000000..04df7e5 --- /dev/null +++ b/vendor/librw/src/printf_stub.c @@ -0,0 +1,11 @@ +#ifndef _DEBUG +#include + +int printf(const char * __restrict s, ...) { + return 0; +} + +int puts(const char *s) { + return 0; +} +#endif From ad5d8af63b1be9a8a85431f055fd81cb4136fd98 Mon Sep 17 00:00:00 2001 From: Shinovon Date: Thu, 14 May 2026 13:53:24 +0500 Subject: [PATCH 20/21] Detect whether rendering on powervr or videocore --- src/skel/symbian/symbian.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/skel/symbian/symbian.cpp b/src/skel/symbian/symbian.cpp index b8f38ae..a07a202 100644 --- a/src/skel/symbian/symbian.cpp +++ b/src/skel/symbian/symbian.cpp @@ -96,6 +96,7 @@ static bool spinning; bool qwerty; bool touch; bool moreVram; +bool powervr; void _InputTranslateShiftKeyUpDown(RsKeyCodes *rs) { } @@ -574,6 +575,17 @@ public: eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext); + const char* renderer = (const char *)glGetString(GL_RENDERER); + if (strstr(renderer, "MBX") || strstr(renderer, "SGX")) { + // use pvrtc + powervr = true; + } else if (strstr(renderer, "VideoCore")) { + // use etc1 + } else { + User::Leave(KErrNotSupported); + return; + } + setlocale(LC_ALL, ""); setlocale(LC_CTYPE, "C"); setlocale(LC_COLLATE, "C"); From 653d313413b9a299c2ebcf6701e7bf7b7eeb9f95 Mon Sep 17 00:00:00 2001 From: Shinovon Date: Fri, 15 May 2026 09:09:32 +0500 Subject: [PATCH 21/21] Update todo --- TODO.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/TODO.md b/TODO.md index 21e2dd3..c78f917 100644 --- a/TODO.md +++ b/TODO.md @@ -10,7 +10,7 @@ Common: - [x] Merge S60v3 and ^3 branches - [ ] Simplify geometry - [ ] Move map to top left corner -- [ ] Do something with sprites, they're still taking too much frame time +- [ ] Too many draw calls - [ ] Audio GLES 2.0 specific: @@ -22,7 +22,8 @@ GLES 2.0 specific: - [x] Skinning shader is still broken on VC4 - [ ] Optimize to always run 20+ fps - [ ] Use etc1 compression -- [ ] HUD still disappearing sometimes +- [ ] HUD still disappearing sometimes on VC3 +- [ ] Effects are slowing the render on VC4 GLES 1.1 specific: - [x] Backport to STLport v4