mirror of
https://github.com/SourMesen/Mesen.git
synced 2025-04-02 10:52:48 -04:00
Power Cycle: Fixed a couple of bugs, moved logic to core
This commit is contained in:
parent
f5806ed5bb
commit
c4ef93ccbb
5 changed files with 16 additions and 1 deletions
|
@ -31,6 +31,7 @@ Console::Console()
|
|||
{
|
||||
_resetRequested = false;
|
||||
_lagCounter = 0;
|
||||
_archiveFileIndex = -1;
|
||||
}
|
||||
|
||||
Console::~Console()
|
||||
|
@ -63,6 +64,8 @@ bool Console::Initialize(string romFilename, stringstream *filestream, string pa
|
|||
|
||||
if(mapper) {
|
||||
_romFilepath = romFilename;
|
||||
_patchFilename = patchFilename;
|
||||
_archiveFileIndex = archiveFileIndex;
|
||||
|
||||
_autoSaveManager.reset(new AutoSaveManager());
|
||||
VideoDecoder::GetInstance()->StopThread();
|
||||
|
@ -219,6 +222,13 @@ NesModel Console::GetModel()
|
|||
return Instance->_model;
|
||||
}
|
||||
|
||||
void Console::PowerCycle()
|
||||
{
|
||||
if(Instance->_initialized && !Instance->_romFilepath.empty()) {
|
||||
LoadROM(Instance->_romFilepath, nullptr, Instance->_archiveFileIndex, Instance->_patchFilename);
|
||||
}
|
||||
}
|
||||
|
||||
void Console::Reset(bool softReset)
|
||||
{
|
||||
if(Instance->_initialized) {
|
||||
|
|
|
@ -39,6 +39,8 @@ class Console
|
|||
NesModel _model;
|
||||
|
||||
string _romFilepath;
|
||||
string _patchFilename;
|
||||
int32_t _archiveFileIndex;
|
||||
|
||||
bool _stop = false;
|
||||
|
||||
|
@ -61,6 +63,7 @@ class Console
|
|||
void Stop();
|
||||
static void RequestReset();
|
||||
static void Reset(bool softReset = true);
|
||||
static void PowerCycle();
|
||||
|
||||
//Used to pause the emu loop to perform thread-safe operations
|
||||
static void Pause();
|
||||
|
|
|
@ -917,7 +917,7 @@ namespace Mesen.GUI.Forms
|
|||
|
||||
private void mnuPowerCycle_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadROM(_currentRomPath, ConfigManager.Config.PreferenceInfo.AutoLoadIpsPatches, _currentRomArchiveIndex);
|
||||
InteropEmu.PowerCycle();
|
||||
}
|
||||
|
||||
private void mnuShowFPS_Click(object sender, EventArgs e)
|
||||
|
|
|
@ -62,6 +62,7 @@ namespace Mesen.GUI
|
|||
|
||||
[DllImport(DLLPath, EntryPoint = "GetRomInfo")] private static extern UInt32 GetRomInfoWrapper(ref InteropRomInfo romInfo, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(UTF8Marshaler))]string filename = "", Int32 archiveFileIndex = -1);
|
||||
|
||||
[DllImport(DLLPath)] public static extern void PowerCycle();
|
||||
[DllImport(DLLPath)] public static extern void Reset();
|
||||
[DllImport(DLLPath)] public static extern void ResetLagCounter();
|
||||
|
||||
|
|
|
@ -204,6 +204,7 @@ namespace InteropEmu {
|
|||
}
|
||||
|
||||
DllExport void __stdcall Reset() { Console::Reset(); }
|
||||
DllExport void __stdcall PowerCycle() { Console::PowerCycle(); }
|
||||
DllExport void __stdcall ResetLagCounter() { Console::ResetLagCounter(); }
|
||||
|
||||
DllExport void __stdcall StartServer(uint16_t port, char* hostPlayerName) { GameServer::StartServer(port, hostPlayerName); }
|
||||
|
|
Loading…
Add table
Reference in a new issue