summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/Frontend.cpp51
-rw-r--r--src/core/Frontend.h48
-rw-r--r--src/core/Profile.cpp71
-rw-r--r--src/core/Profile.h28
4 files changed, 148 insertions, 50 deletions
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index 643c450f..48683abc 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -82,34 +82,34 @@ int curBottomBarOption = -1;
int hoveredBottomBarOption = -1;
#endif
-int32 &CMenuManager::OS_Language = *(int32*)0x5F2F78; // 9
-int8 &CMenuManager::m_PrefsUseVibration = *(int8*)0x95CD92;
-int8 &CMenuManager::m_DisplayControllerOnFoot = *(int8*)0x95CD8D;
-int8 &CMenuManager::m_PrefsVsync = *(int8*)0x5F2E58; // 1
-int8 &CMenuManager::m_PrefsVsyncDisp = *(int8*)0x5F2E5C; // 1
-int8 &CMenuManager::m_PrefsFrameLimiter = *(int8*)0x5F2E60; // 1
-int8 &CMenuManager::m_PrefsShowSubtitles = *(int8*)0x5F2E54; // 1
-int8 &CMenuManager::m_PrefsSpeakers = *(int8*)0x95CD7E;
-int32 &CMenuManager::m_ControlMethod = *(int32*)0x8F5F7C;
-int8 &CMenuManager::m_PrefsDMA = *(int8*)0x5F2F74; // 1
-int32 &CMenuManager::m_PrefsLanguage = *(int32*)0x941238;
+int32 CMenuManager::OS_Language = LANG_ENGLISH; // *(int32*)0x5F2F78;
+int8 CMenuManager::m_PrefsUseVibration; // = *(int8*)0x95CD92;
+int8 CMenuManager::m_DisplayControllerOnFoot; // = *(int8*)0x95CD8D;
+int8 CMenuManager::m_PrefsVsync = 1; // *(int8*)0x5F2E58;
+int8 CMenuManager::m_PrefsVsyncDisp = 1; // *(int8*)0x5F2E5C;
+int8 CMenuManager::m_PrefsFrameLimiter = 1; // *(int8*)0x5F2E60;
+int8 CMenuManager::m_PrefsShowSubtitles = 1; // *(int8*)0x5F2E54;
+int8 CMenuManager::m_PrefsSpeakers; // = *(int8*)0x95CD7E;
+int32 CMenuManager::m_ControlMethod; // = *(int32*)0x8F5F7C;
+int8 CMenuManager::m_PrefsDMA = 1; // *(int8*)0x5F2F74;
+int32 CMenuManager::m_PrefsLanguage; // = *(int32*)0x941238;
uint8 CMenuManager::m_PrefsStereoMono; // *(bool*)0x95CDB5; // unused except restore settings
-bool &CMenuManager::m_PrefsAllowNastyGame = *(bool*)0x5F2E64; // true
-bool &CMenuManager::m_bStartUpFrontEndRequested = *(bool*)0x95CCF4;
-bool &CMenuManager::m_bShutDownFrontEndRequested = *(bool*)0x95CD6A;
+bool CMenuManager::m_PrefsAllowNastyGame = true; // *(bool*)0x5F2E64;
+bool CMenuManager::m_bStartUpFrontEndRequested; // = *(bool*)0x95CCF4;
+bool CMenuManager::m_bShutDownFrontEndRequested; // = *(bool*)0x95CD6A;
-int8 &CMenuManager::m_PrefsUseWideScreen = *(int8*)0x95CD23;
-int8 &CMenuManager::m_PrefsRadioStation = *(int8*)0x95CDA4;
-int32 &CMenuManager::m_PrefsBrightness = *(int32*)0x5F2E50; // 256
-float &CMenuManager::m_PrefsLOD = *(float*)0x8F42C4;
-int8 &CMenuManager::m_bFrontEnd_ReloadObrTxtGxt = *(int8*)0x628CFC;
-int32 &CMenuManager::m_PrefsMusicVolume = *(int32*)0x5F2E4C; // 102
-int32 &CMenuManager::m_PrefsSfxVolume = *(int32*)0x5F2E48; // 102
+int8 CMenuManager::m_PrefsUseWideScreen; // = *(int8*)0x95CD23;
+int8 CMenuManager::m_PrefsRadioStation; // = *(int8*)0x95CDA4;
+int32 CMenuManager::m_PrefsBrightness = 256; // = *(int32*)0x5F2E50;
+float CMenuManager::m_PrefsLOD; // = *(float*)0x8F42C4;
+int8 CMenuManager::m_bFrontEnd_ReloadObrTxtGxt; // = *(int8*)0x628CFC;
+int32 CMenuManager::m_PrefsMusicVolume = 102; // = *(int32*)0x5F2E4C;
+int32 CMenuManager::m_PrefsSfxVolume = 102; // = *(int32*)0x5F2E48;
-char *CMenuManager::m_PrefsSkinFile = (char*)0x5F2E74; //[256] "$$\"\""
+char CMenuManager::m_PrefsSkinFile[256] = "$$\"\""; // = (char*)0x5F2E74;
-int32 &CMenuManager::m_KeyPressedCode = *(int32*)0x5F2E70; // -1
+int32 CMenuManager::m_KeyPressedCode = -1; // = *(int32*)0x5F2E70;
// Originally that was PS2 option color, they forget it here and used in PrintBriefs once(but didn't use the output anyway)
#ifdef PS2_LIKE_MENU
@@ -1655,7 +1655,6 @@ CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8
}
}
-// TODO: Complete aScreens and test that
void
CMenuManager::DrawControllerScreenExtraText(int yStart, int xStart, int lineHeight)
{
@@ -2463,7 +2462,7 @@ CMenuManager::DrawPlayerSetupScreen()
m_pSelectedSkin->skinNameDisplayed[oldLength - 4] = '\0';
m_pSelectedSkin->skinNameOriginal[oldLength - 4] = '\0';
- // Truncate to 40 bytes-39 chars, idk why. This is done in sepearate function in game.
+ // Fill to 40 bytes-39 chars, idk why. This is done in sepearate function in game.
strncpy(nameTemp, m_pSelectedSkin->skinNameDisplayed, 39); // game doesn't do that, but in our day strncpy to same string is forbidden
strncpy(m_pSelectedSkin->skinNameDisplayed, nameTemp, 39);
if (oldLength - 4 > 39)
@@ -4875,7 +4874,7 @@ float CMenuManager::StretchY(float y)
void
CMenuManager::SwitchMenuOnAndOff()
{
- bool menuWasActive = !!m_bMenuActive;
+ bool menuWasActive = GetIsMenuActive();
// Reminder: You need REGISTER_START_BUTTON defined to make it work.
if (CPad::GetPad(0)->GetStartJustDown()
diff --git a/src/core/Frontend.h b/src/core/Frontend.h
index 81765af9..9064cf4e 100644
--- a/src/core/Frontend.h
+++ b/src/core/Frontend.h
@@ -530,30 +530,30 @@ public:
bool GetIsMenuActive() {return !!m_bMenuActive;}
public:
- static int32 &OS_Language;
- static int8 &m_PrefsUseVibration;
- static int8 &m_DisplayControllerOnFoot;
- static int8 &m_PrefsUseWideScreen;
- static int8 &m_PrefsRadioStation;
- static int8 &m_PrefsVsync;
- static int8 &m_PrefsVsyncDisp;
- static int8 &m_PrefsFrameLimiter;
- static int8 &m_PrefsShowSubtitles;
- static int8 &m_PrefsSpeakers;
- static int32 &m_ControlMethod;
- static int8 &m_PrefsDMA;
- static int32 &m_PrefsLanguage;
- static int32 &m_PrefsBrightness;
- static float &m_PrefsLOD;
- static int8 &m_bFrontEnd_ReloadObrTxtGxt;
- static int32 &m_PrefsMusicVolume;
- static int32 &m_PrefsSfxVolume;
- static char *m_PrefsSkinFile;
- static int32 &m_KeyPressedCode;
-
- static bool &m_bStartUpFrontEndRequested;
- static bool &m_bShutDownFrontEndRequested;
- static bool &m_PrefsAllowNastyGame;
+ static int32 OS_Language;
+ static int8 m_PrefsUseVibration;
+ static int8 m_DisplayControllerOnFoot;
+ static int8 m_PrefsUseWideScreen;
+ static int8 m_PrefsRadioStation;
+ static int8 m_PrefsVsync;
+ static int8 m_PrefsVsyncDisp;
+ static int8 m_PrefsFrameLimiter;
+ static int8 m_PrefsShowSubtitles;
+ static int8 m_PrefsSpeakers;
+ static int32 m_ControlMethod;
+ static int8 m_PrefsDMA;
+ static int32 m_PrefsLanguage;
+ static int32 m_PrefsBrightness;
+ static float m_PrefsLOD;
+ static int8 m_bFrontEnd_ReloadObrTxtGxt;
+ static int32 m_PrefsMusicVolume;
+ static int32 m_PrefsSfxVolume;
+ static char m_PrefsSkinFile[256];
+ static int32 m_KeyPressedCode;
+
+ static bool m_bStartUpFrontEndRequested;
+ static bool m_bShutDownFrontEndRequested;
+ static bool m_PrefsAllowNastyGame;
static uint8 m_PrefsStereoMono;
static int32 m_SelectedMap;
diff --git a/src/core/Profile.cpp b/src/core/Profile.cpp
new file mode 100644
index 00000000..56584d12
--- /dev/null
+++ b/src/core/Profile.cpp
@@ -0,0 +1,71 @@
+#include "common.h"
+#include "Profile.h"
+
+#ifndef MASTER
+float CProfile::ms_afStartTime[NUM_PROFILES];
+float CProfile::ms_afCumulativeTime[NUM_PROFILES];
+float CProfile::ms_afEndTime[NUM_PROFILES];
+float CProfile::ms_afMaxEndTime[NUM_PROFILES];
+float CProfile::ms_afMaxCumulativeTime[NUM_PROFILES];
+char *CProfile::ms_pProfileString[NUM_PROFILES];
+RwRGBA CProfile::ms_aBarColours[NUM_PROFILES];
+
+void CProfile::Initialise()
+{
+ ms_afMaxEndTime[PROFILE_FRAME_RATE] = 0.0f;
+ ms_afMaxEndTime[PROFILE_PHYSICS] = 0.0f;
+ ms_afMaxEndTime[PROFILE_COLLISION] = 0.0f;
+ ms_afMaxEndTime[PROFILE_PED_AI] = 0.0f;
+ ms_afMaxEndTime[PROFILE_PROCESSING_TIME] = 0.0f;
+ ms_afMaxEndTime[PROFILE_RENDERING_TIME] = 0.0f;
+ ms_afMaxEndTime[PROFILE_TOTAL] = 0.0f;
+
+ ms_pProfileString[PROFILE_FRAME_RATE] = "Frame rate";
+ ms_pProfileString[PROFILE_PHYSICS] = "Physics";
+ ms_pProfileString[PROFILE_COLLISION] = "Collision";
+ ms_pProfileString[PROFILE_PED_AI] = "Ped AI";
+ ms_pProfileString[PROFILE_PROCESSING_TIME] = "Processing time";
+ ms_pProfileString[PROFILE_RENDERING_TIME] = "Rendering time";
+ ms_pProfileString[PROFILE_TOTAL] = "Total";
+
+ ms_afMaxCumulativeTime[PROFILE_FRAME_RATE] = 0.0f;
+ ms_afMaxCumulativeTime[PROFILE_PHYSICS] = 0.0f;
+ ms_afMaxCumulativeTime[PROFILE_COLLISION] = 0.0f;
+ ms_afMaxCumulativeTime[PROFILE_PED_AI] = 0.0f;
+ ms_afMaxCumulativeTime[PROFILE_PROCESSING_TIME] = 0.0f;
+ ms_afMaxCumulativeTime[PROFILE_RENDERING_TIME] = 0.0f;
+ ms_afMaxCumulativeTime[PROFILE_TOTAL] = 0.0f;
+
+ ms_aBarColours[PROFILE_PHYSICS] = { 0, 127, 255, 255 };
+ ms_aBarColours[PROFILE_COLLISION] = { 0, 255, 255, 255 };
+ ms_aBarColours[PROFILE_PED_AI] = { 255, 0, 0, 255 };
+ ms_aBarColours[PROFILE_PROCESSING_TIME] = { 0, 255, 0, 255 };
+ ms_aBarColours[PROFILE_RENDERING_TIME] = { 0, 0, 255, 255 };
+ ms_aBarColours[PROFILE_TOTAL] = { 255, 255, 255, 255 };
+}
+
+void CProfile::SuspendProfile(eProfile profile)
+{
+ ms_afEndTime[profile] = -ms_afStartTime[profile];
+ ms_afCumulativeTime[profile] -= ms_afStartTime[profile];
+}
+
+void CProfile::ShowResults()
+{
+ ms_afMaxEndTime[PROFILE_FRAME_RATE] = max(ms_afMaxEndTime[PROFILE_FRAME_RATE], ms_afEndTime[PROFILE_FRAME_RATE]);
+ ms_afMaxEndTime[PROFILE_PHYSICS] = max(ms_afMaxEndTime[PROFILE_PHYSICS], ms_afEndTime[PROFILE_PHYSICS]);
+ ms_afMaxEndTime[PROFILE_COLLISION] = max(ms_afMaxEndTime[PROFILE_COLLISION], ms_afEndTime[PROFILE_COLLISION]);
+ ms_afMaxEndTime[PROFILE_PED_AI] = max(ms_afMaxEndTime[PROFILE_PED_AI], ms_afEndTime[PROFILE_PED_AI]);
+ ms_afMaxEndTime[PROFILE_PROCESSING_TIME] = max(ms_afMaxEndTime[PROFILE_PROCESSING_TIME], ms_afEndTime[PROFILE_PROCESSING_TIME]);
+ ms_afMaxEndTime[PROFILE_RENDERING_TIME] = max(ms_afMaxEndTime[PROFILE_RENDERING_TIME], ms_afEndTime[PROFILE_RENDERING_TIME]);
+ ms_afMaxEndTime[PROFILE_TOTAL] = max(ms_afMaxEndTime[PROFILE_TOTAL], ms_afEndTime[PROFILE_TOTAL]);
+
+ ms_afMaxCumulativeTime[PROFILE_FRAME_RATE] = max(ms_afMaxCumulativeTime[PROFILE_FRAME_RATE], ms_afCumulativeTime[PROFILE_FRAME_RATE]);
+ ms_afMaxCumulativeTime[PROFILE_PHYSICS] = max(ms_afMaxCumulativeTime[PROFILE_PHYSICS], ms_afCumulativeTime[PROFILE_PHYSICS]);
+ ms_afMaxCumulativeTime[PROFILE_COLLISION] = max(ms_afMaxCumulativeTime[PROFILE_COLLISION], ms_afCumulativeTime[PROFILE_COLLISION]);
+ ms_afMaxCumulativeTime[PROFILE_PED_AI] = max(ms_afMaxCumulativeTime[PROFILE_PED_AI], ms_afCumulativeTime[PROFILE_PED_AI]);
+ ms_afMaxCumulativeTime[PROFILE_PROCESSING_TIME] = max(ms_afMaxCumulativeTime[PROFILE_PROCESSING_TIME], ms_afCumulativeTime[PROFILE_PROCESSING_TIME]);
+ ms_afMaxCumulativeTime[PROFILE_RENDERING_TIME] = max(ms_afMaxCumulativeTime[PROFILE_RENDERING_TIME], ms_afCumulativeTime[PROFILE_RENDERING_TIME]);
+ ms_afMaxCumulativeTime[PROFILE_TOTAL] = max(ms_afMaxCumulativeTime[PROFILE_TOTAL], ms_afCumulativeTime[PROFILE_TOTAL]);
+}
+#endif \ No newline at end of file
diff --git a/src/core/Profile.h b/src/core/Profile.h
new file mode 100644
index 00000000..d2e8054b
--- /dev/null
+++ b/src/core/Profile.h
@@ -0,0 +1,28 @@
+#pragma once
+
+enum eProfile
+{
+ PROFILE_FRAME_RATE,
+ PROFILE_PHYSICS,
+ PROFILE_COLLISION,
+ PROFILE_PED_AI,
+ PROFILE_PROCESSING_TIME,
+ PROFILE_RENDERING_TIME,
+ PROFILE_TOTAL,
+ NUM_PROFILES,
+};
+
+class CProfile
+{
+ static float ms_afStartTime[NUM_PROFILES];
+ static float ms_afCumulativeTime[NUM_PROFILES];
+ static float ms_afEndTime[NUM_PROFILES];
+ static float ms_afMaxEndTime[NUM_PROFILES];
+ static float ms_afMaxCumulativeTime[NUM_PROFILES];
+ static char *ms_pProfileString[NUM_PROFILES];
+ static RwRGBA ms_aBarColours[NUM_PROFILES];
+public:
+ static void Initialise();
+ static void SuspendProfile(eProfile profile);
+ static void ShowResults();
+}; \ No newline at end of file