-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHongKongArduinoClone.abp
More file actions
102 lines (84 loc) · 2.7 KB
/
HongKongArduinoClone.abp
File metadata and controls
102 lines (84 loc) · 2.7 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#include <RGBALib.sbp>
#include "HongKongArduinoClone.idx"
' Todo: BSMとSFT, SFMemの検証 → BSM(SA1除く)とSFT検証完了
' Todo: ini control class
' Todo: mmodelのcallbackをNULLにするんじゃない
' Todo: isLoROMの削除と高速化
' TODO: BSとSFMなど外付けWindowのボタン排他があまい
' get/set int,string,hex, コンストラクタでファイル名. デフォルトでEXEのディレクトリ
/*
' INIへのIFを提供
Class IniConfig
Sub IniConfig(path)
Function GetText
Function SetText
Function GetInt
Function SetInt
'デフォルト値を含めた設定値を管理
Class Config
Config(ライトスルー)
AddConfigString(CONFIG_ID, "SECTION", "KeyName", "Default value")
AddConfigInt(CONFIG_ID, "SECTION", "KeyName", DEFAULT_VALUE)
LoadConfig()
SaveConfig()
GetConfigString(CONFIG_ID)
GetConfigInt(CONFIG_ID)
SetConfigString(CONFIG_ID)
SetConfigInt(CONFIG_ID)
if config.GetConfigInt(CONFIG_ID)<1 then
*/
Const ProgramName = "HongKongArduinoClone"
Const VerStr = "v2.1β" ' sync this to git tag
Const INIFILE_NAME = "HongKongArduinoClone.ini"
Const FIRMWARE_NAME = "HongKongArduinoFast"
Const DEFAULT_BAUDRATE = 1000000
Const DEFAULT_CONTINUE = 20
Const DEFAULT_DUMP_SIZE = 4
Const DEFAULT_QDD_BUFSIZE = 1024 * 512
Const DEVICE_BUFFER_SIZE_OUT = 16 * 1024
Const DEVICE_BUFFER_SIZE_IN = 16 * 1024
Const DEFAULT_SOUND_ENABLE = 1
Const DEFAULT_TRIM_ENABLE = 1
'タイムアウト設定
Const HKAC_TRANSFER_FLOAT_TIME_MUL = 2.0
Const HKAC_TRANSFER_FLOAT_TIME_ADD = 10
Const HKAC_SRAM_WRITE_RETRY_LIMIT = 2
'ファームウェアと同期すべき案件
Const INITIAL_BAUDRATE = 115200
Const HKAC_WRITE_BUFFER_LEN = &H100
Const FIRMWARE_ID = "HKAF"
Const FIRMWARE_VERSION = &H34
const ID_DLG_TAB = &H1001
Dim INIFILE_PATH AS BytePtr
#define DEBUG_BUILD
#ifdef DEBUG_BUILD
#console
#else
Declare Function AllocConsole Lib "kernel32" () As Long
Declare Function FreeConsole Lib "kernel32" () As Long
Dim _System_hConsoleOut As HANDLE
_System_hConsoleOut = GetStdHandle(STD_OUTPUT_HANDLE)
#endif
'受信タイムアウト追加時間の設定読み込み
Dim HKAC_RX_TIMEOUT_MARGIN AS Long
HKAC_RX_TIMEOUT_MARGIN = GetPrivateProfileInt(ProgramName, "RxTimeoutMargine", 10, INIFILE_PATH)
'---------------------------
' Window Message Loop
'---------------------------
RegisterSubClass()
RegistAcceleratorKey()
Dim msgMain As MSG, iResult As Long
Do
iResult = GetMessage(msgMain, 0, 0, 0)
If iResult = 0 Then ExitDo
if TranslateAccelerator(hMainWnd, hAccel, msgMain) = FALSE Then 'ショートカットキー
If IsDialogMessage(hMainWnd, msgMain) = FALSE Then 'TAB用
TranslateMessage(msgMain)
DispatchMessage(msgMain)
End If
End If
Loop
' Call destructores and exit process
DestroyAcceleratorTable(hAccel)
FreeConsole()
ExitProcess(0)