mirror of
https://github.com/libretro/Mesen.git
synced 2024-11-23 09:09:45 +00:00
Remove built-in rewind code - RetroArch takes care of that
This commit is contained in:
parent
1ac829ab5c
commit
8c77855c6b
@ -22,7 +22,6 @@
|
||||
#include "SoundMixer.h"
|
||||
#include "NsfMapper.h"
|
||||
#include "MovieManager.h"
|
||||
#include "RewindManager.h"
|
||||
#include "SaveStateManager.h"
|
||||
#include "HdPackBuilder.h"
|
||||
#include "HdAudioDevice.h"
|
||||
@ -106,8 +105,6 @@ void Console::Release(bool forShutdown)
|
||||
_master->_notificationManager->SendNotification(ConsoleNotificationType::VsDualSystemStopped);
|
||||
}
|
||||
|
||||
_rewindManager.reset();
|
||||
|
||||
_hdPackBuilder.reset();
|
||||
_hdData.reset();
|
||||
_hdAudioDevice.reset();
|
||||
@ -363,14 +360,6 @@ bool Console::Initialize(VirtualFile &romFile, VirtualFile &patchFile, bool forP
|
||||
|
||||
ResetComponents(false);
|
||||
|
||||
//Reset components before creating rewindmanager, otherwise the first save state it takes will be invalid
|
||||
if(!forPowerCycle) {
|
||||
_rewindManager.reset(new RewindManager(shared_from_this()));
|
||||
_notificationManager->RegisterNotificationListener(_rewindManager);
|
||||
} else {
|
||||
_rewindManager->Initialize();
|
||||
}
|
||||
|
||||
//Poll controller input after creating rewind manager, to make sure it catches the first frame's input
|
||||
_controlManager->UpdateInputState();
|
||||
|
||||
@ -479,11 +468,6 @@ CheatManager* Console::GetCheatManager()
|
||||
return _cheatManager.get();
|
||||
}
|
||||
|
||||
shared_ptr<RewindManager> Console::GetRewindManager()
|
||||
{
|
||||
return _rewindManager;
|
||||
}
|
||||
|
||||
HistoryViewer* Console::GetHistoryViewer()
|
||||
{
|
||||
return _historyViewer.get();
|
||||
@ -659,7 +643,6 @@ void Console::Run()
|
||||
if(_historyViewer) {
|
||||
_historyViewer->ProcessEndOfFrame();
|
||||
}
|
||||
_rewindManager->ProcessEndOfFrame();
|
||||
_settings->DisableOverclocking(_disableOcNextFrame || IsNsf());
|
||||
_disableOcNextFrame = false;
|
||||
|
||||
@ -1185,20 +1168,6 @@ bool Console::IsNsf()
|
||||
return std::dynamic_pointer_cast<NsfMapper>(_mapper) != nullptr;
|
||||
}
|
||||
|
||||
void Console::CopyRewindData(shared_ptr<Console> sourceConsole)
|
||||
{
|
||||
sourceConsole->Pause();
|
||||
Pause();
|
||||
|
||||
//Disable battery saving for this instance
|
||||
_batteryManager->SetSaveEnabled(false);
|
||||
_historyViewer.reset(new HistoryViewer(shared_from_this()));
|
||||
sourceConsole->_rewindManager->CopyHistory(_historyViewer);
|
||||
|
||||
Resume();
|
||||
sourceConsole->Resume();
|
||||
}
|
||||
|
||||
uint8_t* Console::GetRamBuffer(uint16_t address)
|
||||
{
|
||||
//Only used by libretro port for achievements - should not be used by anything else.
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include "VirtualFile.h"
|
||||
|
||||
class BaseMapper;
|
||||
class RewindManager;
|
||||
class HistoryViewer;
|
||||
class APU;
|
||||
class CPU;
|
||||
@ -48,7 +47,6 @@ private:
|
||||
SimpleLock _stopLock;
|
||||
atomic<uint32_t> _pauseCounter;
|
||||
|
||||
shared_ptr<RewindManager> _rewindManager;
|
||||
shared_ptr<HistoryViewer> _historyViewer;
|
||||
|
||||
shared_ptr<CPU> _cpu;
|
||||
@ -129,7 +127,6 @@ public:
|
||||
ControlManager* GetControlManager();
|
||||
MemoryManager* GetMemoryManager();
|
||||
CheatManager* GetCheatManager();
|
||||
shared_ptr<RewindManager> GetRewindManager();
|
||||
HistoryViewer* GetHistoryViewer();
|
||||
|
||||
bool LoadMatchingRom(string romName, HashInfo hashInfo);
|
||||
@ -209,8 +206,6 @@ public:
|
||||
void StartRecordingHdPack(string saveFolder, ScaleFilterType filterType, uint32_t scale, uint32_t flags, uint32_t chrRamBankSize);
|
||||
void StopRecordingHdPack();
|
||||
|
||||
void CopyRewindData(shared_ptr<Console> sourceConsole);
|
||||
|
||||
uint8_t* GetRamBuffer(uint16_t address);
|
||||
|
||||
void DebugAddTrace(const char *log);
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "DisassemblyInfo.h"
|
||||
#include "PPU.h"
|
||||
#include "MemoryManager.h"
|
||||
#include "RewindManager.h"
|
||||
#include "DebugBreakHelper.h"
|
||||
#include "ScriptHost.h"
|
||||
#include "StandardController.h"
|
||||
@ -95,7 +94,6 @@ Debugger::Debugger(shared_ptr<Console> console, shared_ptr<CPU> cpu, shared_ptr<
|
||||
_runToCycle = -1;
|
||||
_prevInstructionCycle = -1;
|
||||
_curInstructionCycle = -1;
|
||||
_needRewind = false;
|
||||
|
||||
//Only enable break on uninitialized reads when debugger is opened at power on/reset
|
||||
_enableBreakOnUninitRead = _cpu->GetPC() == 0;
|
||||
@ -705,32 +703,6 @@ bool Debugger::ProcessRamOperation(MemoryOperationType type, uint16_t &addr, uin
|
||||
value = _memoryManager->DebugRead(addr, true);
|
||||
_cpu->SetDebugPC(addr);
|
||||
_nextReadAddr = -1;
|
||||
} else if(_needRewind) {
|
||||
//Step back - Need to load a state, and then alter the current opcode based on the new program counter
|
||||
if(!_rewindCache.empty()) {
|
||||
//Restore the state, and the cycle number of the instruction that preceeded that state
|
||||
//Otherwise, the target cycle number when building the next cache will be incorrect
|
||||
_console->LoadState(_rewindCache.back());
|
||||
_curInstructionCycle = _rewindPrevInstructionCycleCache.back();
|
||||
|
||||
_rewindCache.pop_back();
|
||||
_rewindPrevInstructionCycleCache.pop_back();
|
||||
|
||||
//This state is for the instruction we want to stop on, break here.
|
||||
_runToCycle = -1;
|
||||
Step(1);
|
||||
} else {
|
||||
_console->GetRewindManager()->StartRewinding(true);
|
||||
|
||||
//Adjust the cycle counter by 1 because the state was taken before the instruction started
|
||||
//whereas the CPU already read the first byte of the instruction by the time we get here
|
||||
State cpuState;
|
||||
_cpu->GetState(cpuState);
|
||||
cpuState.CycleCount++;
|
||||
_cpu->SetState(cpuState);
|
||||
}
|
||||
UpdateProgramCounter(addr, value);
|
||||
_needRewind = false;
|
||||
}
|
||||
ProcessScriptSaveState(addr, value);
|
||||
|
||||
@ -798,8 +770,6 @@ bool Debugger::ProcessRamOperation(MemoryOperationType type, uint16_t &addr, uin
|
||||
|
||||
if(_runToCycle != -1) {
|
||||
if((int64_t)_cpu->GetCycleCount() >= _runToCycle) {
|
||||
//Step back operation is done, revert RewindManager's state & break debugger
|
||||
_console->GetRewindManager()->StopRewinding(true);
|
||||
_runToCycle = -1;
|
||||
Step(1);
|
||||
} else if(_runToCycle - (int64_t)_cpu->GetCycleCount() < 500) {
|
||||
@ -916,7 +886,7 @@ bool Debugger::ProcessRamOperation(MemoryOperationType type, uint16_t &addr, uin
|
||||
if(_runToCycle == -1 && (type == MemoryOperationType::ExecOpCode || type == MemoryOperationType::ExecOperand)) {
|
||||
_memoryAccessCounter->ProcessMemoryExec(addressInfo, _cpu->GetCycleCount());
|
||||
}
|
||||
if(!_needRewind && type == MemoryOperationType::ExecOpCode) {
|
||||
if(type == MemoryOperationType::ExecOpCode) {
|
||||
UpdateCallstack(_lastInstruction, addr);
|
||||
}
|
||||
}
|
||||
@ -1120,7 +1090,6 @@ void Debugger::StepBack()
|
||||
{
|
||||
if(_runToCycle == -1 && _prevInstructionCycle < _curInstructionCycle) {
|
||||
_runToCycle = _prevInstructionCycle;
|
||||
_needRewind = true;
|
||||
Run();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "stdafx.h"
|
||||
#include "EmulationSettings.h"
|
||||
#include "Console.h"
|
||||
#include "RewindManager.h"
|
||||
|
||||
//Version 0.9.9
|
||||
uint16_t EmulationSettings::_versionMajor = 0;
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include "PPU.h"
|
||||
#include "HdNesPack.h"
|
||||
#include "VideoDecoder.h"
|
||||
#include "RewindManager.h"
|
||||
#include "HdPackBuilder.h"
|
||||
#include "HdPpu.h"
|
||||
|
||||
@ -127,4 +126,4 @@ public:
|
||||
PPU::SendFrame();
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include "Console.h"
|
||||
#include "HdNesPack.h"
|
||||
#include "VideoDecoder.h"
|
||||
#include "RewindManager.h"
|
||||
#include "HdPackConditions.h"
|
||||
#include "NotificationManager.h"
|
||||
#include "BaseMapper.h"
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "ScriptingContext.h"
|
||||
#include "DebugHud.h"
|
||||
#include "VideoDecoder.h"
|
||||
#include "RewindManager.h"
|
||||
#include "SaveStateManager.h"
|
||||
#include "Console.h"
|
||||
#include "IKeyManager.h"
|
||||
@ -591,7 +590,6 @@ int LuaApi::Rewind(lua_State *lua)
|
||||
checkparams();
|
||||
checksavestateconditions();
|
||||
errorCond(seconds <= 0, "seconds must be >= 1");
|
||||
_console->GetRewindManager()->RewindSeconds(seconds);
|
||||
return l.ReturnCount();
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include "VideoDecoder.h"
|
||||
#include "Debugger.h"
|
||||
#include "BaseMapper.h"
|
||||
#include "RewindManager.h"
|
||||
#include "ControlManager.h"
|
||||
#include "MemoryManager.h"
|
||||
#include "Console.h"
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include "SoundMixer.h"
|
||||
#include "CPU.h"
|
||||
#include "VideoRenderer.h"
|
||||
#include "RewindManager.h"
|
||||
#include "OggMixer.h"
|
||||
#include "Console.h"
|
||||
#include "BaseMapper.h"
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "HdVideoFilter.h"
|
||||
#include "ScaleFilter.h"
|
||||
#include "VideoRenderer.h"
|
||||
#include "RewindManager.h"
|
||||
#include "Console.h"
|
||||
#include "PPU.h"
|
||||
#include "HdData.h"
|
||||
@ -124,8 +123,7 @@ void VideoDecoder::DecodeFrame(bool synchronous)
|
||||
|
||||
_frameChanged = false;
|
||||
|
||||
//Rewind manager will take care of sending the correct frame to the video renderer
|
||||
_console->GetRewindManager()->SendFrame(outputBuffer, frameInfo.Width, frameInfo.Height, synchronous);
|
||||
_console->GetVideoRenderer()->UpdateFrame(outputBuffer, frameInfo.Width, frameInfo.Height);
|
||||
}
|
||||
|
||||
uint32_t VideoDecoder::GetFrameCount()
|
||||
|
Loading…
Reference in New Issue
Block a user