summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorerorcun <erayorcunus@gmail.com>2021-02-12 16:15:51 +0100
committerGitHub <noreply@github.com>2021-02-12 16:15:51 +0100
commita44d7d86cb66ff584eb497ec1efb70d11d58288d (patch)
treec4e99fefd4af077dfe7a7479978d013cf14f6ff6 /src
parentUpdate TXDs (diff)
parentFix sha1 on premake linux (diff)
downloadre3-a44d7d86cb66ff584eb497ec1efb70d11d58288d.tar
re3-a44d7d86cb66ff584eb497ec1efb70d11d58288d.tar.gz
re3-a44d7d86cb66ff584eb497ec1efb70d11d58288d.tar.bz2
re3-a44d7d86cb66ff584eb497ec1efb70d11d58288d.tar.lz
re3-a44d7d86cb66ff584eb497ec1efb70d11d58288d.tar.xz
re3-a44d7d86cb66ff584eb497ec1efb70d11d58288d.tar.zst
re3-a44d7d86cb66ff584eb497ec1efb70d11d58288d.zip
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt7
-rw-r--r--src/core/config.h6
-rw-r--r--src/core/main.cpp54
-rw-r--r--src/core/re3.cpp13
-rw-r--r--src/extras/GitSHA1.cpp.in2
-rw-r--r--src/extras/GitSHA1.h1
6 files changed, 78 insertions, 5 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index df39c7c9..c81873fd 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,5 +1,5 @@
-set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
+set(THREADS_PREFER_PTHREAD_FLAG ON)
file(GLOB_RECURSE ${PROJECT}_SOURCES "*.cpp" "*.h" "*.rc")
@@ -17,6 +17,9 @@ endfunction()
header_directories(${PROJECT}_INCLUDES)
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/extras/GitSHA1.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/extras/GitSHA1.cpp" @ONLY)
+list(APPEND ${PROJECT}_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/extras/GitSHA1.cpp")
+
add_executable(${EXECUTABLE} WIN32
${${PROJECT}_SOURCES}
)
@@ -46,6 +49,8 @@ if(LIBRW_PLATFORM_D3D9)
)
endif()
+target_compile_definitions(${EXECUTABLE} PRIVATE CMAKE_BUILD)
+
if(${PROJECT}_AUDIO STREQUAL "OAL")
find_package(OpenAL REQUIRED)
target_include_directories(${EXECUTABLE} PRIVATE ${OPENAL_INCLUDE_DIR})
diff --git a/src/core/config.h b/src/core/config.h
index 73c29f15..c051bdbb 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -183,7 +183,11 @@ enum Config {
// those infamous texts
#define DRAW_GAME_VERSION_TEXT
-#define DRAW_MENU_VERSION_TEXT
+#ifdef DRAW_GAME_VERSION_TEXT
+ // unlike R* development builds, ours has runtime switch on debug menu & .ini, and disabled as default.
+ #define USE_OUR_VERSIONING // If you disable this then game will fetch version from peds.col, as R* did while in development
+#endif
+//#define DRAW_MENU_VERSION_TEXT
// Memory allocation and compression
// #define USE_CUSTOM_ALLOCATOR // use CMemoryHeap for allocation. use with care, not finished yet
diff --git a/src/core/main.cpp b/src/core/main.cpp
index 1bcdff19..37a87859 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -72,6 +72,9 @@
#include "custompipes.h"
#include "screendroplets.h"
#include "MemoryHeap.h"
+#ifdef USE_OUR_VERSIONING
+#include "GitSHA1.h"
+#endif
GlobalScene Scene;
@@ -88,6 +91,9 @@ bool gbModelViewer;
#ifdef TIMEBARS
bool gbShowTimebars;
#endif
+#ifdef DRAW_GAME_VERSION_TEXT
+bool gDrawVersionText; // Our addition, we think it was always enabled on !MASTER builds
+#endif
volatile int32 frameCount;
@@ -1102,13 +1108,56 @@ DisplayGameDebugText()
#ifdef DRAW_GAME_VERSION_TEXT
wchar ver[200];
-
+
+ if(gDrawVersionText) // This realtime switch is our thing
+ {
+
+#ifdef USE_OUR_VERSIONING
+ char verA[200];
+ sprintf(verA,
+#if defined _WIN32
+ "Win "
+#elif defined __linux__
+ "Linux "
+#elif defined __APPLE__
+ "Mac OS X "
+#elif defined __FreeBSD__
+ "FreeBSD "
+#else
+ "Posix-compliant "
+#endif
+#if defined __LP64__ || defined _WIN64
+ "64-bit "
+#else
+ "32-bit "
+#endif
+#if defined RW_D3D9
+ "D3D9 "
+#elif defined RWLIBS
+ "D3D8 "
+#elif defined RW_GL3
+ "OpenGL "
+#endif
+#if defined AUDIO_OAL
+ "OAL "
+#elif defined AUDIO_MSS
+ "MSS "
+#endif
+#if defined _DEBUG || defined DEBUG
+ "DEBUG "
+#endif
+ "%.8s",
+ g_GIT_SHA1);
+ AsciiToUnicode(verA, ver);
+ CFont::SetScale(SCREEN_SCALE_X(0.5f), SCREEN_SCALE_Y(0.7f));
+#else
AsciiToUnicode(version_name, ver);
+ CFont::SetScale(SCREEN_SCALE_X(0.5f), SCREEN_SCALE_Y(0.5f));
+#endif
CFont::SetPropOn();
CFont::SetBackgroundOff();
CFont::SetFontStyle(FONT_BANK);
- CFont::SetScale(SCREEN_SCALE_X(0.5f), SCREEN_SCALE_Y(0.5f));
CFont::SetCentreOff();
CFont::SetRightJustifyOff();
CFont::SetWrapx(SCREEN_WIDTH);
@@ -1120,6 +1169,7 @@ DisplayGameDebugText()
#else
CFont::PrintString(10.0f, 10.0f, ver);
#endif
+ }
#endif // #ifdef DRAW_GAME_VERSION_TEXT
FrameSamples++;
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index 3584e226..7f7f1f83 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -508,6 +508,10 @@ bool LoadINISettings()
#ifdef FIX_SPRITES
ReadIniIfExists("Draw", "FixSprites", &CDraw::ms_bFixSprites);
#endif
+#ifdef DRAW_GAME_VERSION_TEXT
+ extern bool gDrawVersionText;
+ ReadIniIfExists("General", "DrawVersionText", &gDrawVersionText);
+#endif
#ifdef CUSTOM_FRONTEND_OPTIONS
bool migrate = cfg.category_size("FrontendOptions") != 0;
@@ -595,6 +599,10 @@ void SaveINISettings()
#ifdef FIX_SPRITES
StoreIni("Draw", "FixSprites", CDraw::ms_bFixSprites);
#endif
+#ifdef DRAW_GAME_VERSION_TEXT
+ extern bool gDrawVersionText;
+ StoreIni("General", "DrawVersionText", gDrawVersionText);
+#endif
#ifdef CUSTOM_FRONTEND_OPTIONS
for (int i = 0; i < MENUPAGES; i++) {
for (int j = 0; j < NUM_MENUROWS; j++) {
@@ -985,7 +993,10 @@ extern bool gbRenderWorld2;
#endif
-
+#ifdef DRAW_GAME_VERSION_TEXT
+ extern bool gDrawVersionText;
+ DebugMenuAddVarBool8("Debug", "Version Text", &gDrawVersionText, nil);
+#endif
#ifndef FINAL
DebugMenuAddVarBool8("Debug", "Print Memory Usage", &gbPrintMemoryUsage, nil);
#ifdef USE_CUSTOM_ALLOCATOR
diff --git a/src/extras/GitSHA1.cpp.in b/src/extras/GitSHA1.cpp.in
new file mode 100644
index 00000000..6168dc79
--- /dev/null
+++ b/src/extras/GitSHA1.cpp.in
@@ -0,0 +1,2 @@
+#define GIT_SHA1 "@GIT_SHA1@"
+const char* g_GIT_SHA1 = GIT_SHA1;
diff --git a/src/extras/GitSHA1.h b/src/extras/GitSHA1.h
new file mode 100644
index 00000000..359bfaff
--- /dev/null
+++ b/src/extras/GitSHA1.h
@@ -0,0 +1 @@
+extern const char* g_GIT_SHA1; \ No newline at end of file