Mesen/Core/Console.h

70 lines
1.6 KiB
C
Raw Normal View History

#pragma once
2014-06-14 15:27:55 +00:00
#include "stdafx.h"
#include "CPU.h"
#include "PPU.h"
#include "APU.h"
2014-06-14 15:27:55 +00:00
#include "MemoryManager.h"
2014-06-21 19:43:41 +00:00
#include "ControlManager.h"
#include "../Utilities/SimpleLock.h"
2014-06-14 15:27:55 +00:00
class Debugger;
class BaseMapper;
2014-06-14 15:27:55 +00:00
class Console
{
private:
static shared_ptr<Console> Instance;
SimpleLock _pauseLock;
SimpleLock _runLock;
SimpleLock _stopLock;
2014-06-21 23:03:13 +00:00
shared_ptr<CPU> _cpu;
shared_ptr<PPU> _ppu;
unique_ptr<APU> _apu;
shared_ptr<Debugger> _debugger;
shared_ptr<BaseMapper> _mapper;
2014-06-21 19:43:41 +00:00
unique_ptr<ControlManager> _controlManager;
shared_ptr<MemoryManager> _memoryManager;
2014-06-14 15:27:55 +00:00
string _romFilepath;
2014-06-22 12:38:42 +00:00
bool _stop = false;
bool _reset = false;
bool _initialized = false;
void ResetComponents(bool softReset);
2015-12-27 23:41:38 +00:00
void Initialize(string filename, stringstream *filestream = nullptr, string ipsFilename = "");
double UpdateNesModel();
2014-06-14 15:27:55 +00:00
public:
Console();
2014-06-14 15:27:55 +00:00
~Console();
void Run();
void Stop();
static void Reset(bool softReset = true);
//Used to pause the emu loop to perform thread-safe operations
static void Pause();
//Used to resume the emu loop after calling Pause()
static void Resume();
2014-06-21 23:03:13 +00:00
std::weak_ptr<Debugger> GetDebugger();
void StopDebugger();
static void SaveState(ostream &saveStream);
static void LoadState(istream &loadStream);
static void LoadState(uint8_t *buffer, uint32_t bufferSize);
2014-06-26 01:52:37 +00:00
2015-12-26 22:11:00 +00:00
static void LoadROM(string filepath, stringstream *filestream = nullptr);
static bool LoadROM(string romName, uint32_t crc32Hash);
2015-12-27 23:41:38 +00:00
static void ApplyIpsPatch(string ipsFilename);
static string GetROMPath();
2016-01-29 01:47:16 +00:00
static uint32_t GetCrc32();
static shared_ptr<Console> GetInstance();
static void Release();
2014-06-14 15:27:55 +00:00
};