diff --git a/.gitignore b/.gitignore index 6da620a..a2e661e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ .cproject .project *.bat -!/printHash.bat *.sis *.sisx *.d diff --git a/printHash.bat b/printHash.bat deleted file mode 100644 index ef1cd9d..0000000 --- a/printHash.bat +++ /dev/null @@ -1,26 +0,0 @@ -@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 deleted file mode 100644 index 213d935..0000000 --- a/printHash.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/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/sis/re3-gles1.pkg b/sis/re3-gles1.pkg index 2f70b53..b20c89d 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,1 [0x101F7961], 0, 0, 0, {"S60ProductID"} ; S60v3 [0x1028315F], 0, 0, 0, {"S60ProductID"} ; ^1 diff --git a/sis/re3.pkg b/sis/re3.pkg index e570f2e..84887fd 100644 --- a/sis/re3.pkg +++ b/sis/re3.pkg @@ -1,4 +1,4 @@ -#{"GTA III"},(0xe0d67647),1,0,2 +#{"GTA III"},(0xe0d67647),1,0,1 [0x101F7961], 0, 0, 0, {"S60ProductID"} ; S60v3 [0x1028315F], 0, 0, 0, {"S60ProductID"} ; ^1 diff --git a/src/audio/eax/eax-util.cpp b/src/audio/eax/eax-util.cpp index 64a1eff..42eef73 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,4 +704,3 @@ 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 c97a35e..441f011 100644 --- a/src/audio/eax/eax-util.h +++ b/src/audio/eax/eax-util.h @@ -8,7 +8,7 @@ * * \*******************************************************************/ -#if !defined EAXUTIL_INCLUDED && 0 +#ifndef EAXUTIL_INCLUDED #define EAXUTIL_INCLUDED #include diff --git a/src/audio/eax/eax.h b/src/audio/eax/eax.h index 9496265..b221093 100644 --- a/src/audio/eax/eax.h +++ b/src/audio/eax/eax.h @@ -5,7 +5,7 @@ * * ********************************************************************/ -#if !defined EAX_H_INCLUDED && 0 +#ifndef EAX_H_INCLUDED #define EAX_H_INCLUDED #ifdef __cplusplus diff --git a/src/audio/oal/oal_utils.h b/src/audio/oal/oal_utils.h index 24b6f1c..f0fa090 100644 --- a/src/audio/oal/oal_utils.h +++ b/src/audio/oal/oal_utils.h @@ -1,9 +1,5 @@ #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 64195f9..d59b86e 100644 --- a/src/audio/sampman_oal.cpp +++ b/src/audio/sampman_oal.cpp @@ -1,6 +1,6 @@ //#define JUICY_OAL -#if defined AUDIO_OAL && 0 +#ifdef AUDIO_OAL #include #include "eax.h" diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp index 5624b64..4a7fbd7 100644 --- a/src/core/Streaming.cpp +++ b/src/core/Streaming.cpp @@ -85,6 +85,8 @@ int32 islandLODcomSub; int32 islandLODsubInd; int32 islandLODsubCom; +#define STREAMING_MEM_SIZE (10 * 1024 * 1024) + bool CStreamingInfo::GetCdPosnAndSize(uint32 &posn, uint32 &size) { @@ -219,14 +221,15 @@ CStreaming::Init2(void) #ifdef GTA_PC #define MB (1024*1024) #ifdef __SYMBIAN32__ - extern size_t streamingMemSize; - ms_memoryAvailable = streamingMemSize; -#else + extern bool moreVram; + if (moreVram) { extern size_t _dwMemAvailPhys; - ms_memoryAvailable = (_dwMemAvailPhys - 10 * MB) / 2; - if (ms_memoryAvailable < 10 * MB) - ms_memoryAvailable = 10 * MB; + ms_memoryAvailable = (_dwMemAvailPhys - 10*MB)/2; + if(ms_memoryAvailable < 10*MB) + ms_memoryAvailable = 10*MB; + } else #endif + ms_memoryAvailable = STREAMING_MEM_SIZE; desiredNumVehiclesLoaded = 12; if(desiredNumVehiclesLoaded > MAXVEHICLESLOADED) desiredNumVehiclesLoaded = MAXVEHICLESLOADED; @@ -639,9 +642,7 @@ 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 - if(streamId < STREAM_OFFSET_TXD) { - ms_memoryUsed += ms_aInfoForModel[streamId].GetCdSize() * CDSTREAM_SECTOR_SIZE; - } + ms_memoryUsed += ms_aInfoForModel[streamId].GetCdSize() * CDSTREAM_SECTOR_SIZE; #endif } @@ -707,9 +708,7 @@ CStreaming::FinishLoadingLargeFile(int8 *buf, int32 streamId) ms_aInfoForModel[streamId].m_loadState = STREAMSTATE_LOADED; // only done if success on PS2 #ifndef USE_CUSTOM_ALLOCATOR - if(streamId < STREAM_OFFSET_TXD) { - ms_memoryUsed += ms_aInfoForModel[streamId].GetCdSize() * CDSTREAM_SECTOR_SIZE; - } + ms_memoryUsed += ms_aInfoForModel[streamId].GetCdSize() * CDSTREAM_SECTOR_SIZE; #endif if(!success){ @@ -955,9 +954,7 @@ CStreaming::RemoveModel(int32 id) #ifdef USE_CUSTOM_ALLOCATOR UpdateMemoryUsed(); #else - if (id < STREAM_OFFSET_TXD) { - ms_memoryUsed -= ms_aInfoForModel[id].GetCdSize()*CDSTREAM_SECTOR_SIZE; - } + ms_memoryUsed -= ms_aInfoForModel[id].GetCdSize()*CDSTREAM_SECTOR_SIZE; #endif } @@ -2699,13 +2696,14 @@ CStreaming::MakeSpaceFor(int32 size) #define MB (1024 * 1024) if(ms_memoryAvailable == 0) { #ifdef __SYMBIAN32__ - 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 bool moreVram; + if (moreVram) { + extern size_t _dwMemAvailPhys; + ms_memoryAvailable = (_dwMemAvailPhys - 10 * MB) / 2; + if(ms_memoryAvailable < 10 * MB) ms_memoryAvailable = 10 * MB; + } else #endif + ms_memoryAvailable = STREAMING_MEM_SIZE; } #undef MB #endif diff --git a/src/core/config.h b/src/core/config.h index 10edd1b..56a689e 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -1,15 +1,7 @@ #pragma once -#ifdef _DEBUG #define LOGS -#ifdef __SYMBIAN32__ #define LOGS_RDEBUG -#endif -#endif - -#ifdef AUDIO_OAL -#undef AUDIO_OAL -#endif // disables (most) stuff that wasn't in original gta3.exe #ifdef __MWERKS__ @@ -394,9 +386,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 @@ -446,8 +438,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 e00f76e..8f01fe0 100644 --- a/src/core/timebars.cpp +++ b/src/core/timebars.cpp @@ -91,9 +91,7 @@ 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() { @@ -116,7 +114,6 @@ 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++) { @@ -127,7 +124,6 @@ void tbDisplay() // RDebug_Printf("EndOfFrame: %.2f", endOfFrameTime); // RDebug_Printf("Frame Time: %.2f", MaxFrameTime); // RDebug_Printf(" "); -//#endif frames = 0; } else frames++; diff --git a/src/renderer/Hud.cpp b/src/renderer/Hud.cpp index acd548c..7b9e0dd 100644 --- a/src/renderer/Hud.cpp +++ b/src/renderer/Hud.cpp @@ -1325,7 +1325,6 @@ void CHud::DrawAfterFade() if (touch) { // FIXME int w = 640; - int h = 360; int y = 0; { CFont::SetJustifyOff(); @@ -1350,30 +1349,11 @@ 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); - 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); + // 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); // l3, r3 CSprite2d::DrawRect(CRECT(320 - 80, 254 + y, 60, 20), CRGBA(0, 0, 0, 128)); @@ -1381,13 +1361,19 @@ void CHud::DrawAfterFade() CSprite2d::DrawRect(CRECT(320 + 20, 254 + y, 60, 20), CRGBA(0, 0, 0, 128)); PRINT("R3", 320 + 20, 258 + y, 60); - CFont::SetScale(0.65f, 0.65f); + // 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); - // 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); + // 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); #undef PRINT #undef CRECT } diff --git a/src/rw/TexRead.cpp b/src/rw/TexRead.cpp index 146140b..a9c9946 100644 --- a/src/rw/TexRead.cpp +++ b/src/rw/TexRead.cpp @@ -95,69 +95,67 @@ static int clamp(int size, int targetSize) static void halveTexture(RwTexture *texture){ if(texture == nil) - return; - debug("halving %s", texture->name); + return; - 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 == 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->setFromImage(resized) == nil){ + debug("downscaleTexture: setFromImage FAILED"); + RwRasterDestroy(newRaster); + RwImageDestroy(resized); + return; + } - RwImageDestroy(resized); - RwTextureSetRaster(texture, newRaster); - RwRasterDestroy(oldRaster); + 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; @@ -209,14 +207,12 @@ RwTextureGtaStreamRead(RwStream *stream) if (gGameState == GS_INIT_PLAYING_GAME) { texLoadTime = (texNumLoaded * texLoadTime + (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond() - preloadTime) / (float)(texNumLoaded+1); texNumLoaded++; - } -#ifdef __SYMBIAN32__ - else if (gGameState != GS_PLAYING_GAME || FrontEndMenuManager.m_bMenuActive) { + } 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 @@ -533,8 +529,6 @@ 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::gles1::needToReadBackTextures = true; #endif #ifdef DISABLE_VSYNC_ON_TEXTURE_CONVERSION @@ -585,8 +579,6 @@ CreateTxdImageForVideoCard() CStreaming::RemoveTxd(i); #ifdef RW_GL3 rw::gl3::needToReadBackTextures = false; -#elif defined RW_GLES1 - rw::gles1::needToReadBackTextures = false; #endif return false; } @@ -622,8 +614,6 @@ CreateTxdImageForVideoCard() #ifdef RW_GL3 rw::gl3::needToReadBackTextures = false; -#elif defined RW_GLES1 - rw::gles1::needToReadBackTextures = false; #endif if (!pDir->WriteDirFile("models\\txd.dir")) { diff --git a/src/skel/symbian/symbian.cpp b/src/skel/symbian/symbian.cpp index b8f38ae..3c9588e 100644 --- a/src/skel/symbian/symbian.cpp +++ b/src/skel/symbian/symbian.cpp @@ -49,7 +49,6 @@ psGlobalType psGlobal; uint32 gGameState = 0; long _dwOperatingSystemVersion = 0; uint32 _dwMemAvailPhys = 0; -size_t streamingMemSize; static EGLDisplay eglDisplay; static EGLContext eglContext; @@ -527,13 +526,6 @@ 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(); @@ -625,10 +617,6 @@ 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; @@ -687,7 +675,7 @@ public: activeZone[i] = JOY_R2 + 1; virtualButtons[JOY_R2] = 1; } - } else if (y > 220 && y <= 360 && (x < 200 || x > w - 200)) { + } else if (y > 200 && y <= 360 && (x < 200 || x > w - 200)) { if (x < 200) { activeZone[i] = -1; stickCenterX[i] = x; @@ -716,44 +704,35 @@ public: virtualButtons[JOY_R3] = 1; } } else if (y >= 80 && y <= 80 + 120) { - 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; + 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; } - } while (0); + 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; + } } } else if (aPointerEvent.iType == TPointerEvent::EDrag) { if (activeZone[i] == -1 || activeZone[i] == -2) { diff --git a/vendor/librw/src/gl/gl3raster.cpp b/vendor/librw/src/gl/gl3raster.cpp index d3bbc48..95cc034 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), MEMDUR_FUNCTION | ID_DRIVER); + uint16_t* pixels16 = (uint16_t*)malloc(raster->width * raster->height * sizeof(uint16_t)); 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); - rwFree(pixels16); + free(pixels16); CHECK_GL_ERROR("glTexImage2D 1"); } else { diff --git a/vendor/librw/src/gl/rwgl3.h b/vendor/librw/src/gl/rwgl3.h index 4a5b8a2..f5b966a 100644 --- a/vendor/librw/src/gl/rwgl3.h +++ b/vendor/librw/src/gl/rwgl3.h @@ -18,7 +18,7 @@ #endif #endif -#ifdef _DEBUG +#if 0 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 571efe3..bca261a 100644 --- a/vendor/librw/src/gles1/gl1raster.cpp +++ b/vendor/librw/src/gles1/gl1raster.cpp @@ -395,8 +395,11 @@ 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; @@ -453,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*)rwMalloc(stride, MEMDUR_FUNCTION | ID_DRIVER); + uint8_t *tmp = (uint8_t*)malloc(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; @@ -461,13 +464,13 @@ void rasterUnlock(Raster *raster, int32 level){ memcpy(a, b, stride); memcpy(b, tmp, stride); } - rwFree(tmp); + free(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, MEMDUR_FUNCTION | ID_DRIVER); + uint16_t *pixels16 = (uint16_t*)malloc(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]; @@ -479,7 +482,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); - rwFree(pixels16); + free(pixels16); } else { glTexImage2D(GL_TEXTURE_2D, level, natras->internalFormat, raster->width, raster->height, 0, @@ -498,11 +501,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 @@ -748,8 +751,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){ @@ -783,7 +786,7 @@ destroyNativeRaster(void *object, int32 offset, int32) natras->backingStore = nil; } #endif - return object; + return object; } static void* diff --git a/vendor/librw/src/rwbase.h b/vendor/librw/src/rwbase.h index 11fb6f8..fca8bed 100644 --- a/vendor/librw/src/rwbase.h +++ b/vendor/librw/src/rwbase.h @@ -16,11 +16,7 @@ #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...