(PS2) TheGame/main/GameInit/SystemInit, ProcessSlowMode

This commit is contained in:
Fire-Head 2020-04-09 02:52:38 +03:00
parent 5a034097c9
commit 3769170113
12 changed files with 1408 additions and 744 deletions

View File

@ -142,7 +142,7 @@ CCamera::Init(void)
PlayerExhaustion = 1.0f; PlayerExhaustion = 1.0f;
DebugCamMode = CCam::MODE_NONE; DebugCamMode = CCam::MODE_NONE;
m_PedOrientForBehindOrInFront = 0.0f; m_PedOrientForBehindOrInFront = 0.0f;
if(!FrontEndMenuManager.m_bStartGameLoading){ if(!FrontEndMenuManager.m_bWantToRestart){
m_bFading = false; m_bFading = false;
CDraw::FadeValue = 0; CDraw::FadeValue = 0;
m_fFLOATingFade = 0.0f; m_fFLOATingFade = 0.0f;
@ -151,7 +151,7 @@ CCamera::Init(void)
m_fFLOATingFadeMusic = 0.0f; m_fFLOATingFadeMusic = 0.0f;
} }
m_bMoveCamToAvoidGeom = false; m_bMoveCamToAvoidGeom = false;
if(FrontEndMenuManager.m_bStartGameLoading) if(FrontEndMenuManager.m_bWantToRestart)
m_bMoveCamToAvoidGeom = true; m_bMoveCamToAvoidGeom = true;
m_bStartingSpline = false; m_bStartingSpline = false;
m_iTypeOfSwitch = INTERPOLATION; m_iTypeOfSwitch = INTERPOLATION;

View File

@ -555,7 +555,7 @@ void CMenuManager::DoSettingsBeforeStartingAGame()
m_PrefsVsync = m_PrefsVsyncDisp; m_PrefsVsync = m_PrefsVsyncDisp;
DMAudio.Service(); DMAudio.Service();
m_bStartGameLoading = true; m_bWantToRestart = true;
ShutdownJustMenu(); ShutdownJustMenu();
UnloadTextures(); UnloadTextures();
@ -2819,7 +2819,7 @@ void CMenuManager::Process(void)
if (!m_bSaveMenuActive && TheCamera.GetScreenFadeStatus() != FADE_0) if (!m_bSaveMenuActive && TheCamera.GetScreenFadeStatus() != FADE_0)
return; return;
m_bStartGameLoading = false; m_bWantToRestart = false;
InitialiseChangedLanguageSettings(); InitialiseChangedLanguageSettings();
if (CPad::GetPad(0)->GetEscapeJustDown()) if (CPad::GetPad(0)->GetEscapeJustDown())
@ -2861,9 +2861,9 @@ void CMenuManager::Process(void)
if (m_PrefsVsyncDisp != m_PrefsVsync) if (m_PrefsVsyncDisp != m_PrefsVsync)
m_PrefsVsync = m_PrefsVsyncDisp; m_PrefsVsync = m_PrefsVsyncDisp;
DMAudio.Service(); DMAudio.Service();
m_bStartGameLoading = true; m_bWantToRestart = true;
RequestFrontEndShutDown(); RequestFrontEndShutDown();
m_bLoadingSavedGame = true; m_bWantToLoad = true;
b_FoundRecentSavedGameWantToLoad = true; b_FoundRecentSavedGameWantToLoad = true;
DMAudio.SetEffectsFadeVol(0); DMAudio.SetEffectsFadeVol(0);
DMAudio.SetMusicFadeVol(0); DMAudio.SetMusicFadeVol(0);
@ -2960,7 +2960,7 @@ void CMenuManager::Process(void)
m_bWaitingForNewKeyBind = false; m_bWaitingForNewKeyBind = false;
} }
if (!m_bStartGameLoading) { if (!m_bWantToRestart) {
if (m_bGameNotLoaded) if (m_bGameNotLoaded)
DMAudio.Service(); DMAudio.Service();
} }

View File

@ -464,7 +464,7 @@ public:
bool m_bMenuActive; bool m_bMenuActive;
bool m_bMenuStateChanged; bool m_bMenuStateChanged;
bool m_bWaitingForNewKeyBind; bool m_bWaitingForNewKeyBind;
bool m_bStartGameLoading; bool m_bWantToRestart;
bool m_bFirstTime; bool m_bFirstTime;
bool m_bGameNotLoaded; bool m_bGameNotLoaded;
int32 m_nMousePosX; int32 m_nMousePosX;
@ -484,7 +484,7 @@ public:
bool m_bQuitGameNoCD; bool m_bQuitGameNoCD;
bool m_bRenderGameInMenu; bool m_bRenderGameInMenu;
bool m_bSaveMenuActive; bool m_bSaveMenuActive;
bool m_bLoadingSavedGame; bool m_bWantToLoad;
char field_455; char field_455;
bool m_bStartWaitingForKeyBind; bool m_bStartWaitingForKeyBind;
bool m_bSpritesLoaded; bool m_bSpritesLoaded;

View File

@ -89,8 +89,6 @@
#define DEFAULT_VIEWWINDOW (0.7f)
eLevelName &CGame::currLevel = *(eLevelName*)0x941514; eLevelName &CGame::currLevel = *(eLevelName*)0x941514;
bool &CGame::bDemoMode = *(bool*)0x5F4DD0; bool &CGame::bDemoMode = *(bool*)0x5F4DD0;
bool &CGame::nastyGame = *(bool*)0x5F4DD4; bool &CGame::nastyGame = *(bool*)0x5F4DD4;
@ -492,7 +490,7 @@ void CGame::ReInitGameObjectVariables(void)
CParticle::ReloadConfig(); CParticle::ReloadConfig();
CCullZones::ResolveVisibilities(); CCullZones::ResolveVisibilities();
if ( !FrontEndMenuManager.m_bLoadingSavedGame ) if ( !FrontEndMenuManager.m_bWantToLoad )
{ {
CCranes::InitCranes(); CCranes::InitCranes();
CTheScripts::StartTestScript(); CTheScripts::StartTestScript();
@ -566,7 +564,7 @@ void CGame::InitialiseWhenRestarting(void)
TheCamera.Init(); TheCamera.Init();
if ( FrontEndMenuManager.m_bLoadingSavedGame == true ) if ( FrontEndMenuManager.m_bWantToLoad == true )
{ {
RestoreForStartLoad(); RestoreForStartLoad();
CStreaming::LoadScene(TheCamera.GetPosition()); CStreaming::LoadScene(TheCamera.GetPosition());
@ -574,7 +572,7 @@ void CGame::InitialiseWhenRestarting(void)
ReInitGameObjectVariables(); ReInitGameObjectVariables();
if ( FrontEndMenuManager.m_bLoadingSavedGame == true ) if ( FrontEndMenuManager.m_bWantToLoad == true )
{ {
if ( GenericLoad() == true ) if ( GenericLoad() == true )
{ {
@ -593,7 +591,7 @@ void CGame::InitialiseWhenRestarting(void)
ShutDownForRestart(); ShutDownForRestart();
CTimer::Stop(); CTimer::Stop();
CTimer::Initialise(); CTimer::Initialise();
FrontEndMenuManager.m_bLoadingSavedGame = false; FrontEndMenuManager.m_bWantToLoad = false;
ReInitGameObjectVariables(); ReInitGameObjectVariables();
currLevel = LEVEL_INDUSTRIAL; currLevel = LEVEL_INDUSTRIAL;
CCollision::SortOutCollisionAfterLoad(); CCollision::SortOutCollisionAfterLoad();
@ -609,6 +607,9 @@ extern void (*DebugMenuProcess)(void);
void CGame::Process(void) void CGame::Process(void)
{ {
CPad::UpdatePads(); CPad::UpdatePads();
#ifdef PS2
ProcessTidyUpMemory();
#endif
TheCamera.SetMotionBlurAlpha(0); TheCamera.SetMotionBlurAlpha(0);
if (TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_SNIPER || TheCamera.m_BlurType == MBLUR_NORMAL) if (TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_SNIPER || TheCamera.m_BlurType == MBLUR_NORMAL)
TheCamera.SetMotionBlur(0, 0, 0, 0, MBLUR_NONE); TheCamera.SetMotionBlur(0, 0, 0, 0, MBLUR_NONE);
@ -695,6 +696,13 @@ void CGame::TidyUpMemory(bool, bool)
#endif #endif
} }
void CGame::ProcessTidyUpMemory(void)
{
#ifdef PS2
// meow
#endif
}
STARTPATCHES STARTPATCHES
InjectHook(0x48BB80, CGame::InitialiseOnceBeforeRW, PATCH_JUMP); InjectHook(0x48BB80, CGame::InitialiseOnceBeforeRW, PATCH_JUMP);
InjectHook(0x48BBA0, CGame::InitialiseRenderWare, PATCH_JUMP); InjectHook(0x48BBA0, CGame::InitialiseRenderWare, PATCH_JUMP);

View File

@ -39,4 +39,5 @@ public:
// NB: these do something on PS2 // NB: these do something on PS2
static void TidyUpMemory(bool, bool); static void TidyUpMemory(bool, bool);
static void DrasticTidyUpMemory(bool); static void DrasticTidyUpMemory(bool);
static void ProcessTidyUpMemory(void);
}; };

View File

@ -34,6 +34,7 @@ CMousePointerStateHelper &MousePointerStateHelper = *(CMousePointerStateHelper*)
bool &CPad::bDisplayNoControllerMessage = *(bool *)0x95CD52; bool &CPad::bDisplayNoControllerMessage = *(bool *)0x95CD52;
bool &CPad::bObsoleteControllerMessage = *(bool *)0x95CDB8; bool &CPad::bObsoleteControllerMessage = *(bool *)0x95CDB8;
bool CPad::bOldDisplayNoControllerMessage;
bool &CPad::m_bMapPadOneToPadTwo = *(bool *)0x95CD48; bool &CPad::m_bMapPadOneToPadTwo = *(bool *)0x95CD48;
CKeyboardState &CPad::OldKeyState = *(CKeyboardState*)0x6F1E70; CKeyboardState &CPad::OldKeyState = *(CKeyboardState*)0x6F1E70;
@ -137,6 +138,19 @@ void CKeyboardState::Clear()
LWIN = RWIN = APPS = 0; LWIN = RWIN = APPS = 0;
} }
void CPad::Initialise(void)
{
for (int i = 0; i < MAX_PADS; i++)
{
CPad::GetPad(i)->Clear(true);
CPad::GetPad(i)->Mode = 0;
}
bObsoleteControllerMessage = false;
bOldDisplayNoControllerMessage = false;
bDisplayNoControllerMessage = false;
}
void CPad::Clear(bool bResetPlayerControls) void CPad::Clear(bool bResetPlayerControls)
{ {
NewState.Clear(); NewState.Clear();

View File

@ -161,6 +161,7 @@ public:
static bool &bDisplayNoControllerMessage; static bool &bDisplayNoControllerMessage;
static bool &bObsoleteControllerMessage; static bool &bObsoleteControllerMessage;
static bool bOldDisplayNoControllerMessage;
static bool &m_bMapPadOneToPadTwo; static bool &m_bMapPadOneToPadTwo;
static CKeyboardState &OldKeyState; static CKeyboardState &OldKeyState;
@ -173,7 +174,7 @@ public:
static void Initialise(void);
void Clear(bool bResetPlayerControls); void Clear(bool bResetPlayerControls);
void ClearMouseHistory(); void ClearMouseHistory();
void UpdateMouse(); void UpdateMouse();

View File

@ -84,12 +84,14 @@ extern void **rwengine;
#define DEFAULT_SCREEN_WIDTH (640) #define DEFAULT_SCREEN_WIDTH (640)
#define DEFAULT_SCREEN_HEIGHT (448) #define DEFAULT_SCREEN_HEIGHT (448)
#define DEFAULT_ASPECT_RATIO (4.0f/3.0f) #define DEFAULT_ASPECT_RATIO (4.0f/3.0f)
#define DEFAULT_VIEWWINDOW (0.7f)
// game uses maximumWidth/Height, but this probably won't work // game uses maximumWidth/Height, but this probably won't work
// with RW windowed mode // with RW windowed mode
#define SCREEN_WIDTH ((float)RsGlobal.width) #define SCREEN_WIDTH ((float)RsGlobal.width)
#define SCREEN_HEIGHT ((float)RsGlobal.height) #define SCREEN_HEIGHT ((float)RsGlobal.height)
#define SCREEN_ASPECT_RATIO (CDraw::GetAspectRatio()) #define SCREEN_ASPECT_RATIO (CDraw::GetAspectRatio())
#define SCREEN_VIEWWINDOW (Tan(DEGTORAD(CDraw::GetFOV() * 0.5f)))
// This scales from PS2 pixel coordinates to the real resolution // This scales from PS2 pixel coordinates to the real resolution
#define SCREEN_STRETCH_X(a) ((a) * (float) SCREEN_WIDTH / DEFAULT_SCREEN_WIDTH) #define SCREEN_STRETCH_X(a) ((a) * (float) SCREEN_WIDTH / DEFAULT_SCREEN_WIDTH)

File diff suppressed because it is too large Load Diff

View File

@ -48,6 +48,13 @@ char SaveFileNameJustSaved[260];
int (&Slots)[SLOT_COUNT+1] = *(int(*)[SLOT_COUNT+1])*(uintptr*)0x72803C; int (&Slots)[SLOT_COUNT+1] = *(int(*)[SLOT_COUNT+1])*(uintptr*)0x72803C;
CDate &CompileDateAndTime = *(CDate*)0x72BCB8; CDate &CompileDateAndTime = *(CDate*)0x72BCB8;
bool &b_FoundRecentSavedGameWantToLoad = *(bool*)0x95CDA8;
bool &JustLoadedDontFadeInYet = *(bool*)0x95CDB4;
bool &StillToFadeOut = *(bool*)0x95CD99;
uint32 &TimeStartedCountingForFade = *(uint32*)0x9430EC;
uint32 &TimeToStayFadedBeforeFadeOut = *(uint32*)0x611564;
#define ReadDataFromBufferPointer(buf, to) memcpy(&to, buf, sizeof(to)); buf += align4bytes(sizeof(to)); #define ReadDataFromBufferPointer(buf, to) memcpy(&to, buf, sizeof(to)); buf += align4bytes(sizeof(to));
#define WriteDataToBufferPointer(buf, from) memcpy(buf, &from, sizeof(from)); buf += align4bytes(sizeof(from)); #define WriteDataToBufferPointer(buf, from) memcpy(buf, &from, sizeof(from)); buf += align4bytes(sizeof(from));

View File

@ -32,6 +32,12 @@ extern int &CheckSum;
extern enum eLevelName &m_LevelToLoad; extern enum eLevelName &m_LevelToLoad;
extern int (&Slots)[SLOT_COUNT+1]; extern int (&Slots)[SLOT_COUNT+1];
extern bool &b_FoundRecentSavedGameWantToLoad;
extern bool &JustLoadedDontFadeInYet;
extern bool &StillToFadeOut;
extern uint32 &TimeStartedCountingForFade;
extern uint32 &TimeToStayFadedBeforeFadeOut;
extern char SaveFileNameJustSaved[260]; // 8F2570 extern char SaveFileNameJustSaved[260]; // 8F2570
const char TopLineEmptyFile[] = "THIS FILE IS NOT VALID YET"; const char TopLineEmptyFile[] = "THIS FILE IS NOT VALID YET";

View File

@ -1927,7 +1927,7 @@ _WinMain(HINSTANCE instance,
* Enter the message processing loop... * Enter the message processing loop...
*/ */
while( !RsGlobal.quit && !FrontEndMenuManager.m_bStartGameLoading ) while( !RsGlobal.quit && !FrontEndMenuManager.m_bWantToRestart )
{ {
if( PeekMessage(&message, nil, 0U, 0U, PM_REMOVE|PM_NOYIELD) ) if( PeekMessage(&message, nil, 0U, 0U, PM_REMOVE|PM_NOYIELD) )
{ {
@ -2059,13 +2059,13 @@ _WinMain(HINSTANCE instance,
if (wp.showCmd != SW_SHOWMINIMIZED) if (wp.showCmd != SW_SHOWMINIMIZED)
RsEventHandler(rsFRONTENDIDLE, nil); RsEventHandler(rsFRONTENDIDLE, nil);
if ( !FrontEndMenuManager.m_bMenuActive || FrontEndMenuManager.m_bLoadingSavedGame ) if ( !FrontEndMenuManager.m_bMenuActive || FrontEndMenuManager.m_bWantToLoad )
{ {
gGameState = GS_INIT_PLAYING_GAME; gGameState = GS_INIT_PLAYING_GAME;
TRACE("gGameState = GS_INIT_PLAYING_GAME;"); TRACE("gGameState = GS_INIT_PLAYING_GAME;");
} }
if ( FrontEndMenuManager.m_bLoadingSavedGame ) if ( FrontEndMenuManager.m_bWantToLoad )
{ {
InitialiseGame(); InitialiseGame();
FrontEndMenuManager.m_bGameNotLoaded = false; FrontEndMenuManager.m_bGameNotLoaded = false;
@ -2128,7 +2128,7 @@ _WinMain(HINSTANCE instance,
RwInitialised = FALSE; RwInitialised = FALSE;
FrontEndMenuManager.UnloadTextures(); FrontEndMenuManager.UnloadTextures();
if ( !FrontEndMenuManager.m_bStartGameLoading ) if ( !FrontEndMenuManager.m_bWantToRestart )
break; break;
CPad::ResetCheats(); CPad::ResetCheats();
@ -2138,13 +2138,13 @@ _WinMain(HINSTANCE instance,
CTimer::Stop(); CTimer::Stop();
if ( FrontEndMenuManager.m_bLoadingSavedGame ) if ( FrontEndMenuManager.m_bWantToLoad )
{ {
CGame::ShutDownForRestart(); CGame::ShutDownForRestart();
CGame::InitialiseWhenRestarting(); CGame::InitialiseWhenRestarting();
DMAudio.ChangeMusicMode(MUSICMODE_GAME); DMAudio.ChangeMusicMode(MUSICMODE_GAME);
LoadSplash(GetLevelSplashScreen(CGame::currLevel)); LoadSplash(GetLevelSplashScreen(CGame::currLevel));
FrontEndMenuManager.m_bLoadingSavedGame = false; FrontEndMenuManager.m_bWantToLoad = false;
} }
else else
{ {
@ -2168,7 +2168,7 @@ _WinMain(HINSTANCE instance,
} }
FrontEndMenuManager.m_bFirstTime = false; FrontEndMenuManager.m_bFirstTime = false;
FrontEndMenuManager.m_bStartGameLoading = false; FrontEndMenuManager.m_bWantToRestart = false;
} }