GB: Fixed crash on reload when frame count is shown
+ Fixed game timer not being accurate for GB
This commit is contained in:
parent
7100eab0f1
commit
8b2a6b5fa6
4 changed files with 13 additions and 5 deletions
|
@ -145,10 +145,8 @@ void BaseRenderer::ShowFpsCounter(int lineNumber)
|
|||
void BaseRenderer::ShowGameTimer(int lineNumber)
|
||||
{
|
||||
int yPos = 13 + 24 * lineNumber;
|
||||
shared_ptr<Ppu> ppu = _console->GetPpu();
|
||||
uint32_t frameCount = _console->GetFrameCount();
|
||||
bool isPal = _console->GetRegion() == ConsoleRegion::Pal;
|
||||
double frameRate = isPal ? 50.006977968268290848936010226333 : 60.098811862348404716732985230828;
|
||||
double frameRate = _console->GetFps();
|
||||
uint32_t seconds = (uint32_t)(frameCount / frameRate) % 60;
|
||||
uint32_t minutes = (uint32_t)(frameCount / frameRate / 60) % 60;
|
||||
uint32_t hours = (uint32_t)(frameCount / frameRate / 3600);
|
||||
|
|
|
@ -4,13 +4,14 @@
|
|||
#include "Ppu.h"
|
||||
#include "Spc.h"
|
||||
#include "NecDsp.h"
|
||||
#include "Gameboy.h"
|
||||
#include "InternalRegisters.h"
|
||||
#include "ControlManager.h"
|
||||
#include "MemoryManager.h"
|
||||
#include "DmaController.h"
|
||||
#include "BaseCartridge.h"
|
||||
#include "RamHandler.h"
|
||||
#include "Gameboy.h"
|
||||
#include "GbPpu.h"
|
||||
#include "Debugger.h"
|
||||
#include "DebugTypes.h"
|
||||
#include "NotificationManager.h"
|
||||
|
@ -294,6 +295,8 @@ void Console::Stop(bool sendNotification)
|
|||
_notificationManager->SendNotification(ConsoleNotificationType::BeforeEmulationStop);
|
||||
}
|
||||
|
||||
_settings->ClearFlag(EmulationFlags::GameboyMode);
|
||||
|
||||
//Make sure we release both pointers to destroy the debugger before everything else
|
||||
_debugger.reset();
|
||||
debugger.reset();
|
||||
|
@ -876,7 +879,8 @@ uint32_t Console::GetFrameCount()
|
|||
{
|
||||
shared_ptr<BaseCartridge> cart = _cart;
|
||||
if(_settings->CheckFlag(EmulationFlags::GameboyMode) && cart->GetGameboy()) {
|
||||
return cart->GetGameboy()->GetState().Ppu.FrameCount;
|
||||
GbPpu* ppu = cart->GetGameboy()->GetPpu();
|
||||
return ppu ? ppu->GetFrameCount() : 0;
|
||||
} else {
|
||||
shared_ptr<Ppu> ppu = _ppu;
|
||||
return ppu ? ppu->GetFrameCount() : 0;
|
||||
|
|
|
@ -473,6 +473,11 @@ void GbPpu::GetPalette(uint16_t out[4], uint8_t palCfg)
|
|||
out[3] = bwRgbPalette[(palCfg >> 6) & 0x03];
|
||||
}
|
||||
|
||||
uint32_t GbPpu::GetFrameCount()
|
||||
{
|
||||
return _state.FrameCount;
|
||||
}
|
||||
|
||||
void GbPpu::SendFrame()
|
||||
{
|
||||
_console->ProcessEvent(EventType::EndFrame);
|
||||
|
|
|
@ -70,6 +70,7 @@ public:
|
|||
uint16_t* GetEventViewerBuffer();
|
||||
uint16_t* GetPreviousEventViewerBuffer();
|
||||
void GetPalette(uint16_t out[4], uint8_t palCfg);
|
||||
uint32_t GetFrameCount();
|
||||
|
||||
void Exec();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue