-
Notifications
You must be signed in to change notification settings - Fork 0
/
Heondows.hsp
430 lines (371 loc) · 14.9 KB
/
Heondows.hsp
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
/*
OSもどき
@author Humi@bass_clef_
@e-mail bassclef.nico@gmail.com
*/
#define global APP_NAME "ヘォンドウズ10"
#packopt name APP_NAME
#packopt icon "heondows.ico"
#packopt hide 1
#bootopt hsp64 0
// u-global
#include DIR_HSPWORK\\list.as
// u-local
#include DIR_HSPWORK\\fileio.as
#include DIR_HSPWORK\\fpsex.as
#include DIR_HSPWORK\\keys.as
#include DIR_HSPWORK\\gui.as
#include DIR_HSPWORK\\sound.as
#include DIR_HSPWORK\\window.as
// global
// local
// definition
#enum W_MAIN = 0
#enum W_WHITE
#enum W_BLACK
#enum W_WORK
#enum KEY_MAIN = 0
#enum KEY_SUB
#enum KEY_MAX
#enum OSM_INIT = 0
#enum OSM_DESKTOP
#define PRODUCT_KEY "Hot-Soup-Processer-3-5"
#ifdef _DEBUG
gsel 0, -1
#endif
initMain
fpsMain
calcMain
drawMain
fpsLoop
#deffunc calcMain
w = mousew
mx = mousex
my = mousey
frameCount = (frameCount+1) \ INT_MAX
// キー
calcKeys
downingKey = false
downedKey = false
if keyDowned(keys.KEY_MAIN) :downedKey = keys.KEY_MAIN
if keyDowned(keys.KEY_SUB) :downedKey = keys.KEY_SUB
if keyDowning(keys.KEY_MAIN) :downingKey = keys.KEY_MAIN
if keyDowning(keys.KEY_SUB) :downingKey = keys.KEY_SUB
// GUI
calcGUI mx, my, false != downedKey, false != downingKey, w < 0, 0 < w
// app
if -1 == mx || -1 == my {
pos omx, omy
} else {
pos mx, my
}
moveGUIObject guiCursorId
// Heondowsの起動モードによって動作を変える
gosub label_os_mode_calc.osMode
return
*label_om_calc_initialize
watchNextButtonId = -1
if 0 <= installLayerCount && installLayerCount < length(watchNextButtonIdList) {
watchNextButtonId = watchNextButtonIdList.installLayerCount
}
switch installLayerCount
case 1
if -1 != watchNextButtonId :if downedButton(watchNextButtonId) {
s = getGUIText(guiProductKeyId)
if PRODUCT_KEY != s {
changeGUIText guiWarningProductKeyId, "※プロダクトキーが間違っています"
swbreak
} else {
nextInstallLayer
}
}
swbreak
case 4
changeGUIText guiInstallFileCopyingId, "Heondows ファイルのコピー中("+ strf("%d", percent) +"%)"
changeGUIText guiInstallReserveId, "インストールするファイルの準備中("+ strf("%d", (percent/5)\99) +"%)"
changeGUIText guiInstallFunctionId, "機能をインストールしています("+ strf("%d", percent/10) +"%)"
changeGUIText guiInstallUpdateProgramId, "更新プログラムをインストールしています("+ strf("%d", 50 + sin( M_PI*2 / 100 * (percent/11) ) * 50) +"%)"
changeGUIText guiInstallFinalId, "処理が完了します(0%)"
percent += 0.2
#ifdef _debug
if 7 <= percent {
#else
if 777 <= percent {
#endif
nextInstallLayer
percent = 0
}
swbreak
case 5
percent++
if 200 < percent {
#ifndef _debug
saveFileName dir_my +"init.ini" :fileId = stat
pushFileData OSM_DESKTOP
saveToFile
closeFile
#endif
exec ""+ APP_NAME +".exe"
end
}
swbreak
default
if -1 != watchNextButtonId :if downedButton(watchNextButtonId) {
nextInstallLayer
}
swbreak
swend
return
#deffunc nextInstallLayer
if installLayerCount < length(watchNextButtonIdList) {
if guiInstallNextId == watchNextButtonIdList(installLayerCount+1) {
setGUIParent guiInstallNextId, guiLayerInstallId(installLayerCount+1)
setGUIParent guiInstallSkipId, guiLayerInstallId(installLayerCount+1)
} else {
setGUIParent guiInstallNextId, -1
setGUIParent guiInstallSkipId, -1
}
}
destroyGUIObject guiLayerInstallId.installLayerCount
installLayerCount++
return
*label_om_calc_desktop
if downedButton(guiStartId) {
dialog "試用版ではこれ以上の機能を試すことはできません。", 0, APP_NAME
}
return
#deffunc drawMain
redraw 0
colorwhite :boxf :color
drawGUI
redraw 1
return
#deffunc initMain
dir_my = dir_cur +"\\data\\"
initFileio
loadFile dir_my +"init.ini"
if -1 == stat {
osMode = OSM_INIT
} else {
osMode = popFileData()
}
closeFile
initMainWidth = 640
initMainHeight = 480
fontSize = 14
fhSize = fontSize/2
xMargin = 5
yMargin = 5
omx = ginfo_dispx
omy = ginfo_dispy
label_os_mode_boot = *label_om_boot_initialize, *label_om_boot_desktop
label_os_mode_calc = *label_om_calc_initialize, *label_om_calc_desktop
percent = 0.0
initFPS 60, 10
initWindow
windowList.W_MAIN = getWindowId(initMainWidth, initMainHeight)
windowList.W_WORK = getWindowId(ginfo_dispx, ginfo_dispy)
windowList.W_WHITE = getWindowId(ginfo_dispx, ginfo_dispy)
windowList.W_BLACK = getWindowId(ginfo_dispx, ginfo_dispy)
initKeys
keys.KEY_MAIN = 1
keys.KEY_SUB = 2
repeat KEY_MAX
registoryKey keys.cnt, 1, 10
loop
// windows
buffer windowList.W_WORK, getWindowWidth(windowList.W_WORK), getWindowHeight(windowList.W_WORK)
font msgothic, fontSize
buffer windowList.W_WHITE, getWindowWidth(windowList.W_WHITE), getWindowHeight(windowList.W_WHITE)
colorwhite :boxf
buffer windowList.W_BLACK, getWindowWidth(windowList.W_BLACK), getWindowHeight(windowList.W_BLACK)
color :boxf
screen windowList.W_MAIN, ginfo_dispx, ginfo_dispy, 0, (ginfo_dispx-getWindowWidth(windowList.W_MAIN))/2, (ginfo_dispy-getWindowHeight(windowList.W_MAIN))/2, getWindowWidth(windowList.W_MAIN), getWindowHeight(windowList.W_MAIN)
title APP_NAME
font msgothic, fontSize
// mouse -1, -1
initGUI windowList.W_BLACK, windowList.W_WHITE, windowList.W_WORK, fhSize, xMargin, yMargin
color 1, 1, 1
gosub label_os_mode_boot.osMode
colorwhite
mouseImgId = makeImageBuffer(dir_my + "mouse.png")
guiOption getWindowWidth(mouseImgId), getWindowHeight(mouseImgId), GUI_S_SHOW
pos omx, omy
makeImageButton mouseImgId, getWindowWidth(mouseImgId), getWindowHeight(mouseImgId) :guiCursorId = stat
setGUIBackAlpha guiCursorId, 0
return
*label_om_boot_initialize
loadFile dir_my + "licence.txt" :fileId = stat
licenceTxtString = getFileRawData(fileId)
closeFile
color 1, 1, 1
guiOption 170, 20, GUI_S_SHOW, windowList.W_WHITE, windowList.W_BLACK
pos 380, 440 :makeButton "スキップはできません(S)" :guiInstallSkipId = stat
guiOption 60, 20, GUI_S_SHOW, windowList.W_WHITE, windowList.W_BLACK
pos 560, 440 :makeButton "次へ(N)" :guiInstallNextId = stat
/* install layer 5 */
guiOption ginfo_winx, ginfo_winy, GUI_S_SHOW
inWindowId.5 = getWindowId(ginfo_dispx, ginfo_dispy)
pos 0, 0 :makeWindow "", ginfo_winx, ginfo_winy, inWindowId.5 :guiLayerInstallId.5 = stat
sel = ginfo_sel
welcomeWindowId = getBufferId(640, 480, true)
buffer welcomeWindowId, getWindowWidth(welcomeWindowId), getWindowHeight(welcomeWindowId)
color 200, 255, 200 :boxf
gsel sel
guiOption getWindowWidth(welcomeWindowId), getWindowHeight(welcomeWindowId), GUI_S_SHOW
pos 0, 0 :makeImageButton welcomeWindowId, getWindowWidth(welcomeWindowId), getWindowHeight(welcomeWindowId)
setGUIParent stat, guiLayerInstallId.5
logoWelcomeImgId = makeImageBuffer(dir_my + "logo.png")
guiOption getWindowWidth(logoWelcomeImgId), getWindowHeight(logoWelcomeImgId), GUI_S_SHOW
colorwhite
pos (ginfo_winx - getWindowWidth(logoWelcomeImgId))/2, (ginfo_winy - getWindowHeight(logoWelcomeImgId))/3 :makeImageButton logoWelcomeImgId, getWindowWidth(logoWelcomeImgId), getWindowHeight(logoWelcomeImgId) :logoWelcomeImgId = stat
setGUIBackAlpha logoWelcomeImgId, 0
setGUIParent logoWelcomeImgId, guiLayerInstallId.5
guiOption 560, 30, GUI_S_SHOW
color 1, 1, 1
pos 40, ginfo_winy/2 :makeButton "ようこそ" :guiWelcomeId = stat
setGUIBackAlpha guiWelcomeId, 0
setGUIParent guiWelcomeId, guiLayerInstallId.5
watchNextButtonIdList.5 = -1
/* install layer 4 */
guiOption ginfo_winx, ginfo_winy, GUI_S_SHOW
inWindowId.4 = getWindowId(ginfo_dispx, ginfo_dispy)
pos 0, 0 :makeWindow "", ginfo_winx, ginfo_winy, inWindowId.4 :guiLayerInstallId.4 = stat
guiOption 560, 30, GUI_S_SHOW
color 0, 0, 175
pos 40, 20 :makeText "Heondows をインストールしています" :guiInstallFinalInfoId.0 = stat
color 1, 1, 1
pos 40, 100 :makeText "PCは数回再起動しません。代わりにアプリが再起動します。少し?お待ち下さい。" :guiInstallFinalInfoId.length(guiInstallFinalInfoId) = stat
pos 60, 150
makeText "Heondows ファイルのコピー中" :guiInstallFileCopyingId = stat
guiInstallFinalInfoId.length(guiInstallFinalInfoId) = guiInstallFileCopyingId
makeText "インストールするファイルの準備中" :guiInstallReserveId = stat
guiInstallFinalInfoId.length(guiInstallFinalInfoId) = guiInstallReserveId
makeText "機能をインストールしています" :guiInstallFunctionId = stat
guiInstallFinalInfoId.length(guiInstallFinalInfoId) = guiInstallFunctionId
makeText "更新プログラムをインストールしています" :guiInstallUpdateProgramId = stat
guiInstallFinalInfoId.length(guiInstallFinalInfoId) = guiInstallUpdateProgramId
makeText "処理が完了します" :guiInstallFinalId = stat
guiInstallFinalInfoId.length(guiInstallFinalInfoId) = guiInstallFinalId
watchNextButtonIdList.4 = -1
repeat length(guiInstallFinalInfoId)
setGUIParent guiInstallFinalInfoId.cnt, guiLayerInstallId.4
setGUIBackAlpha guiInstallFinalInfoId.cnt, 0
loop
/**/
/* install layer 3 */
guiOption ginfo_winx, ginfo_winy, GUI_S_SHOW
inWindowId.3 = getWindowId(ginfo_dispx, ginfo_dispy)
pos 0, 0 :makeWindow "", ginfo_winx, ginfo_winy, inWindowId.3 :guiLayerInstallId.3 = stat
guiOption 560, 30, GUI_S_SHOW
pos 40, 20
color 0, 0, 175
makeText "インストールの種類を選ぶも何も一つしかありません。" :guiInstallTypeInfoId.0 = stat
guiOption 560, 100, GUI_S_SHOW
pos 40, 100
makeButton ""
watchNextButtonIdList.3 = stat
guiInstallTypeInfoId.length(guiInstallTypeInfoId) = watchNextButtonIdList.3
color 100, 160, 200
pos 40, 100
makeText "カスタム: Heondowsのみをインストールする (詳細設定なんてありません。)(C)\nこのオプションでは、ファイル、設定、アプリが Heondows に引き継がれません。ドライブとパーティションなんてものは存在しませんがそれらに変更を加える場合は、インストール ディスクなんてものはありませんが それをなんとか起動してください。手順を続ける前にファイルのバックアップすることを。進めたり進めなかったりします。"
guiInstallTypeInfoId.length(guiInstallTypeInfoId) = stat
guiOption 560, 30, GUI_S_SHOW
pos 40, 400
makeText "ヘルプは表示できません(H)" :guiInstallTypeInfoId.length(guiInstallTypeInfoId) = stat
repeat length(guiInstallTypeInfoId)
setGUIParent guiInstallTypeInfoId.cnt, guiLayerInstallId.3
if GUI_T_BUTTON == getGUIObjectType(guiInstallTypeInfoId.cnt) :continue
setGUIBackAlpha guiInstallTypeInfoId.cnt, 0
loop
/**/
/* install layer 2 */
guiOption ginfo_winx, ginfo_winy, GUI_S_SHOW
inWindowId.2 = getWindowId(ginfo_dispx, ginfo_dispy)
pos 0, 0 :makeWindow "", ginfo_winx, ginfo_winy, inWindowId.2 :guiLayerInstallId.2 = stat
guiOption 560, 30, GUI_S_SHOW
pos 40, 20
color 0, 0, 175
makeText "ライセンス条項" :guiLicenceInfoId.0 = stat
color 1, 1, 1
guiOption 560, 300, GUI_S_SHOW
pos 40, 60 :makeList licenceTxtString :guiLicenceInfoId.length(guiLicenceInfoId) = stat
guiOption 500, 30, GUI_S_SHOW
pos 40, 380
makeText "同意します(A)...\n\nも何もreadme.txt読んで実行した時点で同意したはずだからチェックボタンとかいらないよね?" :guiLicenceInfoId.length(guiLicenceInfoId) = stat
repeat length(guiLicenceInfoId)
setGUIParent guiLicenceInfoId.cnt, guiLayerInstallId.2
if GUI_T_LIST == getGUIObjectType(guiLicenceInfoId.cnt) :continue
setGUIBackAlpha guiLicenceInfoId.cnt, 0
loop
watchNextButtonIdList.2 = guiInstallNextId
/**/
/* install layer 1 */
guiOption ginfo_winx, ginfo_winy, GUI_S_SHOW
inWindowId.1 = getWindowId(ginfo_dispx, ginfo_dispy)
pos 0, 0 :makeWindow "", ginfo_winx, ginfo_winy, inWindowId.1 :guiLayerInstallId.1 = stat
guiOption 560, 30, GUI_S_SHOW
pos 40, 0
color 0, 0, 175
makeText "\nHeondows のライセンス認証を行うためのプロダクト キーを入力してください" :guiProductKeyInfoId.0 = stat
color 1, 1, 1
makeText "\nプロダクト キーは、Heondowsが入っているディレクトリの背面か Heondows 購入時のメッセージに記載されています。" :guiProductKeyInfoId.length(guiProductKeyInfoId) = stat
makeText "\n\n\nプロダクト キーは次のような形式です: XXX-XXXX-XXXXXXXXX-X-X" :guiProductKeyInfoId.length(guiProductKeyInfoId) = stat
makeText "\n\n\nハイフンは自動的に入力されませんし、アプリケーションキーボードなんてものは作ってないし、プロダクトキーを入力するところも別れてません。" :guiProductKeyInfoId.length(guiProductKeyInfoId) = stat
guiOption 400, 20, GUI_S_SHOW
pos , ginfo_cy + 100
makeInput ""+ PRODUCT_KEY :guiProductKeyId = stat
guiProductKeyInfoId.length(guiProductKeyInfoId) = guiProductKeyId
color 255, 0, 0
makeText "" :guiWarningProductKeyId = stat
guiProductKeyInfoId.length(guiProductKeyInfoId) = guiWarningProductKeyId
guiOption 340, 20, GUI_S_SHOW
pos 0, 440
color 0, 0, 175
makeButton "プライバシーに関する声明はありません。(P)" :guiProductKeyInfoId.length(guiProductKeyInfoId) = stat
repeat length(guiProductKeyInfoId)
setGUIParent guiProductKeyInfoId.cnt, guiLayerInstallId.1
if GUI_T_INPUT == getGUIObjectType(guiProductKeyInfoId.cnt) :continue
setGUIBackAlpha guiProductKeyInfoId.cnt, 0
loop
watchNextButtonIdList.1 = guiInstallNextId
/**/
/* install layer 0 */
guiOption ginfo_winx, ginfo_winy, GUI_S_SHOW
inWindowId.0 = getWindowId(ginfo_dispx, ginfo_dispy)
pos 0, 0 :makeWindow "", ginfo_winx, ginfo_winy, inWindowId :guiLayerInstallId.0 = stat
colorwhite
logoImgId = makeImageBuffer(dir_my + "logo.png")
guiOption getWindowWidth(logoImgId), getWindowHeight(logoImgId), GUI_S_SHOW
pos (ginfo_winx - getWindowWidth(logoImgId))/2, (ginfo_winy - getWindowHeight(logoImgId))/6 :makeImageButton logoImgId, getWindowWidth(logoImgId), getWindowHeight(logoImgId) :guiLogoId = stat
setGUIBackAlpha guiLogoId, 0
setGUIParent guiLogoId, guiLayerInstallId.0
guiOption 250, 30, GUI_S_SHOW
pos (ginfo_winx - 250)/2, (ginfo_winy - 30)/2 :makeButton "今すぐインストール(I)" :guiInstallId = stat
setGUIParent guiInstallId, guiLayerInstallId.0
guiOption 500, 20, GUI_S_SHOW
color 1, 1, 1
pos 20, 430 :makeText "コンピューターは修復できません(R)" :guiRecoveryId = stat
setGUIBackAlpha guiRecoveryId, 0
setGUIParent guiRecoveryId, guiLayerInstallId.0
pos 20, 450 :makeText "Copyright 2019 Humi@bass_clef_ All rights reserved." :guiCopyRightId = stat
setGUIBackAlpha guiCopyRightId, 0
setGUIParent guiCopyRightId, guiLayerInstallId.0
watchNextButtonIdList.0 = guiInstallId
/**/
installLayerCount = 0
return
*label_om_boot_desktop
desktopImgId = makeImageBuffer(dir_my + "desktop.png")
guiOption getWindowWidth(desktopImgId), getWindowHeight(desktopImgId), GUI_S_SHOW
pos 0, 0 :makeImageButton desktopImgId, getWindowWidth(desktopImgId), getWindowHeight(desktopImgId) :guiDesktopId = stat
guiOption ginfo_winx, 20, GUI_S_SHOW
inWindowId = getWindowId(ginfo_dispx, ginfo_dispy)
pos 0, ginfo_winy - 20 :makeWindow "", ginfo_winx, ginfo_winy, inWindowId :guiTaskBarId = stat
guiOption 100, 20, GUI_S_SHOW
colorwhite
pos 0, 0 :makeButton "スタート" :guiStartId = stat
setGUIParent guiStartId, guiTaskBarId
mciopen dir_my + "boot.wav", 0, 1
mciplay 0, 1000
return