-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainform.h
87 lines (70 loc) · 1.88 KB
/
mainform.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#pragma once
#include <array>
#include <thread>
#include <wx/wx.h>
#include "ui/statebox.h"
#include "core/emulator.h"
class reMainForm : public wxFrame
{
public:
enum ID
{
ID_LOAD = wxID_HIGHEST + 1,
ID_COMPILE_AND_LOAD,
ID_RUN,
ID_STEP,
ID_INPUT,
ID_STOP,
ID_RESET
};
enum class State
{
kWaiting,
kRunning,
kStepping,
kStopping,
kClosing
};
public:
const int kMillisecondsPerCycle = 2000;
public:
reMainForm();
private:
void Update();
void Stop();
void Load(const wxString& path);
void Raise(const std::string& msg);
void OnLoad(wxCommandEvent& event);
void OnCompileAndLoad(wxCommandEvent& event);
void OnRun(wxCommandEvent& event);
void OnStep(wxCommandEvent& event);
void OnStop(wxCommandEvent& event);
void OnReset(wxCommandEvent& event);
void OnInput(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
void OnClose(wxCloseEvent& event);
void EnableRun(bool enable = true);
void EnableStep(bool enable = true);
void EnableLoad(bool enable = true);
void EnableInput(bool enable = true);
void EnableStop(bool enable = true);
void EnableReset(bool enable = true);
void CreateControls();
void CreateMenuBar();
wxToolBar* CreateToolBar(long style = -1L, wxWindowID winid = wxID_ANY,
const wxString& name = wxToolBarNameStr) override;
void RunEmulatorThread();
private:
State state_ = State::kWaiting;
wxMenu* run_menu_;
wxMenu* load_menu_;
wxSlider* speed_slider_;
wxScrolledWindow* state_window_;
reRegisterStateBox* registers_;
reFlagStateBox* flags_;
reROMStateBox* rom_;
std::array<uint8_t, 2> last_input_ = {};
Emulator emulator_ = { true };
std::thread background_thread_ = {};
wxDECLARE_EVENT_TABLE();
};