mirror of https://github.com/AxioDL/metaforce.git
Add MP1_VARIABLE_DELTA_TIME option (for high refresh rates; buggy)
This commit is contained in:
parent
051a547c42
commit
ae591d4817
|
@ -116,14 +116,14 @@ CGameArchitectureSupport::CGameArchitectureSupport(CMain& parent, boo::IAudioVoi
|
|||
g_GameState->GameOptions().EnsureSettings();
|
||||
}
|
||||
|
||||
void CGameArchitectureSupport::UpdateTicks() {
|
||||
void CGameArchitectureSupport::UpdateTicks(float dt) {
|
||||
x4_archQueue.Push(MakeMsg::CreateFrameBegin(EArchMsgTarget::Game, x78_gameFrameCount));
|
||||
x4_archQueue.Push(MakeMsg::CreateTimerTick(EArchMsgTarget::Game, 1.f / 60.f));
|
||||
x4_archQueue.Push(MakeMsg::CreateTimerTick(EArchMsgTarget::Game, dt));
|
||||
}
|
||||
|
||||
void CGameArchitectureSupport::Update() {
|
||||
void CGameArchitectureSupport::Update(float dt) {
|
||||
g_GameState->GetWorldTransitionManager()->TouchModels();
|
||||
x30_inputGenerator.Update(1 / 60.f, x4_archQueue);
|
||||
x30_inputGenerator.Update(dt, x4_archQueue);
|
||||
x4_archQueue.Push(MakeMsg::CreateFrameEnd(EArchMsgTarget::Game, x78_gameFrameCount));
|
||||
x58_ioWinManager.PumpMessages(x4_archQueue);
|
||||
}
|
||||
|
@ -817,13 +817,25 @@ bool CMain::Proc() {
|
|||
m_loadedPersistentResources = true;
|
||||
}
|
||||
|
||||
float dt = 1 / 60.f;
|
||||
#if MP1_VARIABLE_DELTA_TIME
|
||||
auto now = delta_clock::now();
|
||||
if (m_firstFrame) {
|
||||
m_firstFrame = false;
|
||||
} else {
|
||||
using delta_duration = std::chrono::duration<float, std::ratio<1>>;
|
||||
dt = std::min(std::chrono::duration_cast<delta_duration>(now - m_prevFrameTime).count(), dt);
|
||||
}
|
||||
m_prevFrameTime = now;
|
||||
#endif
|
||||
|
||||
m_console->proc();
|
||||
if (!m_console->isOpen()) {
|
||||
CGBASupport::GlobalPoll();
|
||||
x164_archSupport->UpdateTicks();
|
||||
x164_archSupport->Update();
|
||||
CSfxManager::Update(1.f / 60.f);
|
||||
CStreamAudioManager::Update(1.f / 60.f);
|
||||
x164_archSupport->UpdateTicks(dt);
|
||||
x164_archSupport->Update(dt);
|
||||
CSfxManager::Update(dt);
|
||||
CStreamAudioManager::Update(dt);
|
||||
}
|
||||
|
||||
if (x164_archSupport->GetIOWinManager().IsEmpty() || CheckReset()) {
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
#ifndef MP1_USE_BOO
|
||||
#define MP1_USE_BOO 0
|
||||
#endif
|
||||
#ifndef MP1_VARIABLE_DELTA_TIME
|
||||
#define MP1_VARIABLE_DELTA_TIME 0
|
||||
#endif
|
||||
|
||||
#include "IMain.hpp"
|
||||
#include "CTweaks.hpp"
|
||||
|
@ -108,7 +113,6 @@ public:
|
|||
CScriptMazeNode::LoadMazeSeeds();
|
||||
}
|
||||
|
||||
|
||||
void ResetGameState() {
|
||||
x134_gameState = std::make_unique<CGameState>();
|
||||
g_GameState = x134_gameState.get();
|
||||
|
@ -174,8 +178,8 @@ public:
|
|||
void PreloadAudio();
|
||||
bool LoadAudio();
|
||||
void UnloadAudio();
|
||||
void UpdateTicks();
|
||||
void Update();
|
||||
void UpdateTicks(float dt);
|
||||
void Update(float dt);
|
||||
void Draw();
|
||||
|
||||
bool isRectDirty() const { return m_rectIsDirty; }
|
||||
|
@ -251,6 +255,12 @@ private:
|
|||
bool m_loadedPersistentResources = false;
|
||||
bool m_doQuit = false;
|
||||
|
||||
#if MP1_VARIABLE_DELTA_TIME
|
||||
bool m_firstFrame = true;
|
||||
using delta_clock = std::chrono::high_resolution_clock;
|
||||
std::chrono::time_point<delta_clock> m_prevFrameTime;
|
||||
#endif
|
||||
|
||||
void InitializeSubsystems();
|
||||
static void InitializeDiscord();
|
||||
static void ShutdownDiscord();
|
||||
|
|
Loading…
Reference in New Issue