|
|
1.1 root 1: //
2: // nono
3: // Copyright (C) 2021 nono project
4: // Licensed under nono-license.txt
5: //
6:
7: //
1.1.1.2 root 8: // UI スレッドへのメッセージ機構
1.1 root 9: //
10:
11: #pragma once
12:
1.1.1.5 root 13: #include "header.h"
1.1 root 14: #include <functional>
1.1.1.5 root 15: #include <mutex>
1.1 root 16:
17: class UIMessage
18: {
19: public:
20: // メッセージ ID
21: enum ID {
22: NONE = 0,
23:
1.1.1.2 root 24: // アプリケーションを終了する
25: APPEXIT,
1.1 root 26:
27: // MPU がホールト状態になった
28: HALT,
29:
30: // SCSI (各 ID) のメディア状態が変わった (Load/Unload)
31: SCSI_MEDIA_CHANGE,
32:
33: // SCSI メディアの挿入に失敗した
34: SCSI_MEDIA_FAILED,
35:
1.1.1.3 root 36: // FDD (各 ID) のメディア状態が変わった (Load/Unload)
37: FDD_MEDIA_CHANGE,
38:
39: // FDD メディアの挿入に失敗した
40: FDD_MEDIA_FAILED,
41:
1.1 root 42: // キー入力状態が変わった
43: KEYBOARD,
44:
45: // LCD 状態が変わった
46: LCD,
47:
1.1.1.2 root 48: // 画面を更新した
49: RENDER,
50:
51: // パレットが変更になった
52: PALETTE,
53:
1.1.1.3 root 54: // LED 状態が変わった
55: LED,
56:
1.1.1.4 root 57: // 新しいホストドライバの起動に失敗した。
58: HOSTNET_FAILED,
59: HOSTCOM_FAILED,
1.1.1.6 ! root 60: HOSTSOUND_FAILED,
1.1.1.4 root 61:
1.1 root 62: ID_MAX,
63: };
64:
65: public:
66: UIMessage();
1.1.1.5 root 67: ~UIMessage();
1.1 root 68:
1.1.1.5 root 69: // コールバックを指定して UIMessage サービスを開始。
70: void StartUIMessage(const std::function<void(uint, int)>& func_);
1.1 root 71:
1.1.1.5 root 72: // UIMessage サービスを停止。
73: void StopUIMessage();
1.1 root 74:
1.1.1.5 root 75: // UIMessage をポスト (コールバックを実行)。
76: void Post(uint id) {
77: Post(id, 0);
78: }
79: void Post(uint id, int arg);
1.1 root 80:
81: private:
1.1.1.5 root 82: std::function<void(uint, int)> func {};
83: std::mutex mtx {};
1.1 root 84: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.