Mesen/Core/Console.h

65 lines
1.4 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<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);
void Initialize(string filename);
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
shared_ptr<Debugger> Console::GetDebugger();
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
static void LoadROM(string filepath);
static bool LoadROM(string romName, uint32_t crc32Hash);
static string FindMatchingRomInFolder(string folder, string romFilename, uint32_t crc32Hash);
static string GetROMPath();
static shared_ptr<Console> GetInstance();
2014-06-14 15:27:55 +00:00
};