From 810bad9fd8cf344f7d73b82f042910a4c443b0f7 Mon Sep 17 00:00:00 2001 From: erorcun Date: Fri, 29 Jan 2021 01:44:33 +0300 Subject: Fix some UBs --- src/core/main.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/core/main.cpp') diff --git a/src/core/main.cpp b/src/core/main.cpp index 9a0308dd..a08a9535 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -1065,8 +1065,13 @@ DisplayGameDebugText() #endif FrameSamples++; +#ifdef FIX_HIGH_FPS_BUGS_ON_FRONTEND + FramesPerSecondCounter += frameTime / 1000.f; // convert to seconds + FramesPerSecond = FrameSamples / FramesPerSecondCounter; +#else FramesPerSecondCounter += 1000.0f / (CTimer::GetTimeStepNonClippedInSeconds() * 1000.0f); FramesPerSecond = FramesPerSecondCounter / FrameSamples; +#endif if ( FrameSamples > 30 ) { -- cgit v1.2.3 From 879838c9f20d9f166353d4dd5ea486dda6f91921 Mon Sep 17 00:00:00 2001 From: aap Date: Fri, 12 Feb 2021 00:29:09 +0100 Subject: enable screenshots with F12 --- src/core/main.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/core/main.cpp') diff --git a/src/core/main.cpp b/src/core/main.cpp index a08a9535..bb94ca5d 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -1,8 +1,10 @@ #include "common.h" +#include #include "rpmatfx.h" #include "rphanim.h" #include "rpskin.h" #include "rtbmp.h" +#include "rtpng.h" #ifdef ANISOTROPIC_FILTERING #include "rpanisot.h" #endif @@ -331,7 +333,11 @@ RwGrabScreen(RwCamera *camera, RwChar *filename) strcpy(temp, CFileMgr::GetRootDirName()); strcat(temp, filename); +#ifdef THIS_IS_STUPID if (RtBMPImageWrite(pImage, &temp[0]) == nil) +#else + if (RtPNGImageWrite(pImage, &temp[0]) == nil) +#endif result = false; RwImageDestroy(pImage); return result; @@ -350,6 +356,7 @@ DoRWStuffEndOfFrame(void) RsCameraShowRaster(Scene.camera); #ifndef MASTER char s[48]; +#ifdef THIS_IS_STUPID if (CPad::GetPad(1)->GetLeftShockJustDown()) { // try using both controllers for this thing... crazy bastards if (CPad::GetPad(0)->GetRightStickY() > 0) { @@ -361,6 +368,12 @@ DoRWStuffEndOfFrame(void) RwGrabScreen(Scene.camera, s); } } +#else + if (CPad::GetPad(1)->GetLeftShockJustDown() || CPad::GetPad(0)->GetFJustDown(11)) { + sprintf(s, "screen_%11lld.png", time(nil)); + RwGrabScreen(Scene.camera, s); + } +#endif #endif // !MASTER } -- cgit v1.2.3 From 9e22eaf79834dc6a462790b78768f5cd0f522428 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Fri, 12 Feb 2021 08:06:34 +0200 Subject: Fix RW34 --- src/core/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/main.cpp') diff --git a/src/core/main.cpp b/src/core/main.cpp index bb94ca5d..bf0ce5fe 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -333,7 +333,7 @@ RwGrabScreen(RwCamera *camera, RwChar *filename) strcpy(temp, CFileMgr::GetRootDirName()); strcat(temp, filename); -#ifdef THIS_IS_STUPID +#ifndef LIBRW if (RtBMPImageWrite(pImage, &temp[0]) == nil) #else if (RtPNGImageWrite(pImage, &temp[0]) == nil) -- cgit v1.2.3 From 2c784d979a88035176082edf986a2c02b9073338 Mon Sep 17 00:00:00 2001 From: erorcun Date: Fri, 12 Feb 2021 01:49:09 +0300 Subject: Remove version text, add toggleable debug info(with commit hash!) --- src/core/main.cpp | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 2 deletions(-) (limited to 'src/core/main.cpp') diff --git a/src/core/main.cpp b/src/core/main.cpp index bf0ce5fe..bb9bd296 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -75,6 +75,9 @@ #include "custompipes.h" #include "screendroplets.h" #include "VarConsole.h" +#ifdef USE_OUR_VERSIONING +#include "GitSHA1.h" +#endif GlobalScene Scene; @@ -91,6 +94,9 @@ bool gbModelViewer; #ifdef TIMEBARS bool gbShowTimebars; #endif +#ifdef TOGGLEABLE_VERSION_TEXT +bool gDrawVersionText; +#endif volatile int32 frameCount; @@ -1061,13 +1067,58 @@ DisplayGameDebugText() #ifdef DRAW_GAME_VERSION_TEXT wchar ver[200]; - + +#ifdef TOGGLEABLE_VERSION_TEXT + if(gDrawVersionText) +#endif + { + +#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_STANDARD); - CFont::SetScale(SCREEN_SCALE_X(0.5f), SCREEN_SCALE_Y(0.5f)); CFont::SetCentreOff(); CFont::SetRightJustifyOff(); CFont::SetWrapx(SCREEN_WIDTH); @@ -1076,6 +1127,8 @@ DisplayGameDebugText() CFont::SetColor(CRGBA(255, 108, 0, 255)); CFont::PrintString(SCREEN_SCALE_X(10.0f), SCREEN_SCALE_Y(10.0f), ver); #endif + } +#endif // #ifdef DRAW_GAME_VERSION_TEXT FrameSamples++; #ifdef FIX_HIGH_FPS_BUGS_ON_FRONTEND -- cgit v1.2.3 From 0c60ceeb33c06c17b35773ca4095c2d4c342a0dc Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Fri, 12 Feb 2021 02:04:31 +0100 Subject: Cmake version for hash --- src/core/main.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/core/main.cpp') diff --git a/src/core/main.cpp b/src/core/main.cpp index bb9bd296..52988afc 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -94,8 +94,8 @@ bool gbModelViewer; #ifdef TIMEBARS bool gbShowTimebars; #endif -#ifdef TOGGLEABLE_VERSION_TEXT -bool gDrawVersionText; +#ifdef DRAW_GAME_VERSION_TEXT +bool gDrawVersionText; // Our addition, we think it was always enabled on !MASTER builds #endif volatile int32 frameCount; @@ -1068,9 +1068,7 @@ DisplayGameDebugText() #ifdef DRAW_GAME_VERSION_TEXT wchar ver[200]; -#ifdef TOGGLEABLE_VERSION_TEXT - if(gDrawVersionText) -#endif + if(gDrawVersionText) // This realtime switch is our thing { #ifdef USE_OUR_VERSIONING -- cgit v1.2.3 From 035f0010d8d526ae4a5cd2254bd55e1486fca4f2 Mon Sep 17 00:00:00 2001 From: erorcun Date: Fri, 12 Feb 2021 21:26:03 +0300 Subject: fix --- src/core/main.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/core/main.cpp') diff --git a/src/core/main.cpp b/src/core/main.cpp index 52988afc..3ab97450 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -1124,7 +1124,6 @@ DisplayGameDebugText() CFont::SetBackGroundOnlyTextOff(); CFont::SetColor(CRGBA(255, 108, 0, 255)); CFont::PrintString(SCREEN_SCALE_X(10.0f), SCREEN_SCALE_Y(10.0f), ver); -#endif } #endif // #ifdef DRAW_GAME_VERSION_TEXT -- cgit v1.2.3 From 65f9917b651fa8b44a90899a6cc1fa650f053ab1 Mon Sep 17 00:00:00 2001 From: aap Date: Sat, 13 Feb 2021 14:22:34 +0100 Subject: clean up debug menu --- src/core/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/main.cpp') diff --git a/src/core/main.cpp b/src/core/main.cpp index 3ab97450..f6d27bd9 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -1053,7 +1053,7 @@ DisplayGameDebugText() #ifndef FINAL { - SETTWEAKPATH("GameDebugText"); + SETTWEAKPATH("Debug"); TWEAKBOOL(bDisplayPosn); TWEAKBOOL(bDisplayCheatStr); } -- cgit v1.2.3