Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
folium-app
GitHub Repository: folium-app/Folium
Path: blob/a-new-beginning/Cherry/Core/include/GearcolecoCore.h
2 views
1
/*
2
* Gearcoleco - ColecoVision Emulator
3
* Copyright (C) 2021 Ignacio Sanchez
4
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* any later version.
9
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see http://www.gnu.org/licenses/
17
*
18
*/
19
20
#ifndef CORE_H
21
#define CORE_H
22
23
#include "definitions.h"
24
#include "Cartridge.h"
25
26
class CVMemory;
27
class Processor;
28
class Audio;
29
class Video;
30
class Input;
31
class ColecoVisionIOPorts;
32
33
class GearcolecoCore
34
{
35
36
public:
37
GearcolecoCore();
38
~GearcolecoCore();
39
void Init(GC_Color_Format pixelFormat = GC_PIXEL_RGB888);
40
bool RunToVBlank(u8* pFrameBuffer, s16* pSampleBuffer, int* pSampleCount, bool step = false, bool stopOnBreakpoints = false);
41
bool LoadROM(const char* szFilePath, Cartridge::ForceConfiguration* config = NULL);
42
bool LoadROMFromBuffer(const u8* buffer, int size, Cartridge::ForceConfiguration* config = NULL);
43
void SaveDisassembledROM();
44
bool GetRuntimeInfo(GC_RuntimeInfo& runtime_info);
45
void KeyPressed(GC_Controllers controller, GC_Keys key);
46
void KeyReleased(GC_Controllers controller, GC_Keys key);
47
void Spinner1(int movement);
48
void Spinner2(int movement);
49
void Pause(bool paused);
50
bool IsPaused();
51
void ResetROM(Cartridge::ForceConfiguration* config = NULL);
52
void ResetROMPreservingRAM(Cartridge::ForceConfiguration* config = NULL);
53
void ResetSound();
54
void SaveRam();
55
void SaveRam(const char* szPath, bool fullPath = false);
56
void LoadRam();
57
void LoadRam(const char* szPath, bool fullPath = false);
58
void SaveState(int index);
59
void SaveState(const char* szPath, int index);
60
bool SaveState(u8* buffer, size_t& size);
61
bool SaveState(std::ostream& stream, size_t& size);
62
void LoadState(int index);
63
void LoadState(const char* szPath, int index);
64
bool LoadState(const u8* buffer, size_t size);
65
bool LoadState(std::istream& stream);
66
CVMemory* GetMemory();
67
Cartridge* GetCartridge();
68
Processor* GetProcessor();
69
Audio* GetAudio();
70
Video* GetVideo();
71
72
private:
73
void Reset();
74
void RenderFrameBuffer(u8* finalFrameBuffer);
75
76
private:
77
CVMemory* m_pMemory;
78
Processor* m_pProcessor;
79
Audio* m_pAudio;
80
Video* m_pVideo;
81
Input* m_pInput;
82
Cartridge* m_pCartridge;
83
ColecoVisionIOPorts* m_pColecoVisionIOPorts;
84
bool m_bPaused;
85
GC_Color_Format m_pixelFormat;
86
};
87
88
#endif /* CORE_H */
89
90