From 7f9b635431197d6afb8d327ca961a03854053bed Mon Sep 17 00:00:00 2001 From: Shinovon Date: Tue, 12 May 2026 07:00:35 +0500 Subject: [PATCH] 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...