-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathsys_main.h
More file actions
87 lines (76 loc) · 2.06 KB
/
sys_main.h
File metadata and controls
87 lines (76 loc) · 2.06 KB
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
// SimpleGraphic Engine
// (c) David Gowor, 2014
//
// System Main Header
//
#include <filesystem>
#include <optional>
#include <string>
#include <vector>
// =======
// Classes
// =======
// Timer
class timer_c {
public:
timer_c();
void Start();
int Get();
private:
std::chrono::system_clock::time_point startTime;
};
// Thread
class thread_c {
public:
thread_c(class sys_IMain* sys);
void ThreadStart(bool lowPri = false);
private:
class sys_main_c* _sysMain;
virtual void ThreadProc() = 0;
static unsigned long statThreadProc(void* obj);
};
// File finder
class find_c {
public:
std::filesystem::path fileName;
bool isDirectory = false;
uintmax_t fileSize = 0;
unsigned long long modified = 0;
find_c();
~find_c();
bool FindFirst(std::filesystem::path const&& fileSpec);
bool FindNext();
private:
std::optional<std::string> globPattern; // Empty pattern accepts all files like "*" and "*.*"
std::filesystem::directory_iterator iter;
};
std::string GetWineHostVersion();
// ==========
// Interfaces
// ==========
// System Main
class sys_IMain {
public:
IConsole* con = nullptr;
sys_IConsole* conWin = nullptr;
sys_IVideo* video = nullptr;
bool x64 = false;
bool debug = false;
bool debuggerRunning = false;
int processorCount = 0;
std::filesystem::path basePath;
std::optional<std::filesystem::path> userPath;
std::optional<std::string> userPathReason;
virtual int GetTime() = 0;
virtual void Sleep(int msec) = 0;
virtual bool IsKeyDown(byte key) = 0;
virtual void ClipboardCopy(const char* str) = 0;
virtual char* ClipboardPaste() = 0;
virtual bool SetWorkDir(std::filesystem::path const& newCwd = {}) = 0;
virtual void SpawnProcess(std::filesystem::path cmdName, const char* argList) = 0;
virtual int GetProcessCount(const std::vector<std::wstring>& imageNames) = 0;
virtual std::optional<std::string> OpenURL(const char* url) = 0;
virtual void Error(const char* fmt, ...) = 0;
virtual void Exit(const char* msg = NULL) = 0;
virtual void Restart() = 0;
};