-
Notifications
You must be signed in to change notification settings - Fork 1
/
hsp3dh.hsp
2133 lines (1785 loc) · 42.2 KB
/
hsp3dh.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
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;
; HSP3Dish helper
;
#packopt name "hsp3dh"
#include "hspcmp.as"
#include "hspext.as"
#include "hspinet.as"
#include "mod_appconfig.as"
#define APPTITLE "HSP3Dish helper"
#define APPVER "1.94"
#define APP_CONF "\\hsp3dh.cfg"
#define AND_LIBVER 114 ; android HSPランタイムの内部バージョン
#uselib "shell32.dll"
#cfunc SHBrowseForFolder "SHBrowseForFolder" int
#func SHGetPathFromIDList "SHGetPathFromIDList" int,int
#func SHFileOperation "SHFileOperation" sptr
#uselib "ole32.dll"
#func CoTaskMemFree "CoTaskMemFree" int
#uselib "KERNEL32.DLL"
#func global RemoveDirectory "RemoveDirectoryA" sptr
#define GRADLE_URL "https://services.gradle.org/distributions/"
#define GRADLE_BIN "gradle-7.3-bin.zip"
#define GRADLE_DIR "gradle-7.3"
#define ANDROIDSDK_LICENSE "android-sdk-license"
#define NDK_VERSION "22.1.7171670"
#define AND_TARGETDEFAULT "31"
#define AND_TOOLDEFAULT "31.0.0"
#define AND_SYSIMAGE "system-images;android-31;google_apis_playstore;x86_64"
;
; HSP3Dish Helper tool
; onion software/onitama 2012/4
;
randomize
goto *boot
#deffunc initalize
; tool初期化
;
sdim s1,256:sdim s2,256:sdim s3,256
wx=480:wy=320 ; ウィンドウサイズ
tooly=184+80 ; ツールボタン座標
dir_gps="google-play-services_lib"
dir_gplib="gameplay"
dir_extlib="extlib"
dir_hsplib="hsplib36r1"
fname_dpm = "libhsp3dish.so"
;
app_winx=-1
app_winy=-1
app_mode=0
flag_utf8=1
and_targetid=""
path_java=""
path_sdk=""
path_ndk=""
path_ant=""
path_proj=""
and_name=""
and_pack=""
and_fname=""
and_keystore=""
and_copylib=0
and_keyfile=""
and_keypass=""
path_gradle=""
and_gradle=0
and_gradleapi=0
and_gradlesdk=0
js_pack=""
js_fname=""
js_memopt=""
js_memsize=0
hspjsname="hsp3dish.js"
js_gpmode=0
js_webasm = 0
js_debug = 0
js_template = 0
ios_proj=""
ios_org="hsp3dish"
ios_ident="onionsoft.hsptv"
flag_admob=0
flag_arm=0
flag_x86=0
flag_hgimg=0
flag_sensor=0
flag_xhgimg=0
flag_andrun=0
get_hsp_appdata_path app_dir
cfg_init app_dir+APP_CONF
cfg_load:appcfg=stat
if appcfg { ; cfg読み込み
app_winx=0+cfg_getvar("winx")
app_winy=0+cfg_getvar("winy")
app_mode=0+cfg_getvar("mode")
path_java=cfg_getvar("path_java")
path_sdk=cfg_getvar("path_sdk")
path_ndk=cfg_getvar("path_ndk")
path_ant=cfg_getvar("path_ant")
path_proj=cfg_getvar("path_proj")
flag_utf8 = 0+cfg_getvar("flag_utf8")
and_name=cfg_getvar("and_name")
;and_pack=cfg_getvar("and_pack")
;and_targetid = cfg_getvar("and_target")
and_fname=cfg_getvar("and_fname")
and_keystore=cfg_getvar("and_keystore")
and_keyfile=cfg_getvar("and_keyfile")
and_keypass=cfg_getvar("and_keypass")
and_copylib=0+cfg_getvar("and_copylib")
path_gradle=cfg_getvar("path_gradle")
and_gradle=0+cfg_getvar("and_gradle")
and_gradleapi=0+cfg_getvar("and_gradleapi")
and_gradlesdk=0+cfg_getvar("and_gradlesdk")
flag_admob = 0+cfg_getvar("flag_admob")
flag_arm = 0+cfg_getvar("flag_arm")
flag_x86 = 0+cfg_getvar("flag_x86")
flag_hgimg = 0+cfg_getvar("flag_hgimg")
flag_sensor = 0+cfg_getvar("flag_sensor")
flag_xhgimg = 0+cfg_getvar("flag_xhgimg")
flag_andrun = 0+cfg_getvar("flag_andrun")
ios_org=cfg_getvar("ios_org")
ios_ident=cfg_getvar("ios_ident")
js_webasm = 0+cfg_getvar("js_webasm")
js_template = 0+cfg_getvar("js_template")
}
if and_targetid="" : and_targetid="\"android-29\""
if and_keystore="" : and_keystore="hspapp"
if app_winx<0 : app_winx = -1
if app_winy<0 : app_winy = -1
if app_winx>=ginfo_dispx : app_winx = ginfo_dispx-wx
if app_winy>=ginfo_dispy : app_winy = ginfo_dispy-wy
screen 0,wx,wy,0,app_winx,app_winy
title APPTITLE +" ver."+APPVER
gsel 0,1
sdim buf,$10000
sdim buftxt,$10000
sdim tmp,$10000
sdim outbuf,$10000
sdim ln,$10000
sdim fname,1024
sdim and_package, 256
sdim s1, $2000
sdim s2, $2000
sdim s3, $2000
return
#deffunc initwnd
cls 4
syscolor 15:boxf
sysfont 17
color 0,0,0
return
#deffunc initsub
screen 1,wx,480,8,ginfo_wx1-4,ginfo_wy2+1
title "console"
cls 4
syscolor 15:boxf
sysfont 17
color 0,0,0
mesbox buftxt,wx,320,0
objsize 160,24
pos wx-168,480-32
button gosub "閉じる",*closesub
pos 8,320+8
gsel 0
return
*closesub
gsel 1,-1
gsel 0
return
#define EM_SETSEL $B1
#define EM_REPLACESEL $C2
#deffunc execcmd str _p1
; コマンドライン実行
sdim tmp,$100000
sdim buf,$20000
sdim lntmp,$2000
cmd = app_dir+"\\"+_p1
pipeexec tmp,cmd,1
if stat : dialog "コマンドラインの実行に失敗しました" : return -1
gsel 1
edit_hwnd = objInfo(0,2)
repeat
pipeget ln
if stat=0 : break
await 0
loop
buf=""
i=0
repeat
getstr lntmp,tmp,i,10
if strsize=0 : break
i+=strsize
buf+=lntmp+"\n"
loop
objprm 0,buf
gsel 0
return 0
#deffunc execcmd2 str _p1
; コマンドライン実行(output付き)
sdim tmp,$100000
sdim buf,$20000
sdim addbuf,$4000
sdim lntmp,$2000
cmd = app_dir+"\\"+_p1
pipeexec tmp,cmd,1
if stat : dialog "コマンドラインの実行に失敗しました" : return -1
gsel 1
objprm 0,buf
edit_hwnd = objInfo(0,2)
repeat
pipeget ln,1
if stat=0 : break
if ln!="" {
getstr lntmp,ln,0,10
addbuf+=lntmp+"\n"
continue
}
if addbuf!="" {
sendmsg edit_hwnd,EM_EM_SETSEL,0,-1
sendmsg edit_hwnd,EM_EM_SETSEL,-1,-1
sendmsg edit_hwnd,EM_REPLACESEL,-1,addbuf
buf+=addbuf
addbuf=""
}
await 10
loop
if addbuf!="" {
sendmsg edit_hwnd,EM_EM_SETSEL,0,-1
sendmsg edit_hwnd,EM_EM_SETSEL,-1,-1
sendmsg edit_hwnd,EM_REPLACESEL,-1,addbuf
buf+=addbuf
addbuf=""
}
;objprm 0,buf
gsel 0
return 0
// DirCopy src, dest, モード(1= 移動 2= コピー 3= 削除 4= リネーム(同一Disc内))
#deffunc DirCopy str FromFolder,str ToFolder,int mode
From= FromFolder : To= ToFolder
SHFILEOPSTRUCT = hwnd, mode, varptr.From, varptr.To, $150, -1, 0, 0
SHFileOperation varptr.SHFILEOPSTRUCT
return
;--------------------------------------------------------------------------------
; .ini module
#deffunc ini_bye
sdim inibuf,$1000
sdim iniln,$100
return
#deffunc ini_load str _p1
ini_bye
exist _p1
if strsize<=0 : return -1
notesel inibuf
noteload _p1
return 0
#defcfunc ini_prm str _p1
res=""
notesel inibuf
repeat notemax
noteget iniln,cnt
if peek(iniln,0)=';' : continue
inipt=instr(iniln,0,"=")
if inipt<0 : continue
inival=strmid(iniln,inipt+1,255)
poke iniln,inipt,0
if iniln=_p1 : res = inival : break
loop
return res
;--------------------------------------------------------------------------------
*boot
; アプリケーション開始
;
initalize
onexit *owari
netinit
if stat : dialog "ネット接続環境がありません。" : end
*topmenu
if app_mode>=3 : goto *jsmenu
if app_mode>=1 : goto *andmenu
*srcmenu
app_mode=0
initwnd
pos 8,8
mes "指定されたスクリプトをC言語ソースファイルに変換します"
pos 8,30
sysfont 17
mes "ソーススクリプト:"
objsize 390,24
input fname
objsize 64,24
pos 408,41:button "参照...",*selfile
objsize 160,24
pos 8,68
chkbox "出力ソースをUTF-8に変換",flag_utf8
chkbox "XCode用プロジェクトを生成",flag_xcode
pos 32,68+24+24
chkbox "HGIMG4を使用する(β)",flag_xhgimg
y=160
objsize 130,24
pos 20,y
mes "プロジェクト名:"
pos 90,y-4
input ios_proj
objsize 160,24
pos 240,y
mes "Organization:"
pos 310,y-4
input ios_org
objsize 220,24
pos 20,y+30
mes "Identifier:"
pos 90,y+30-4
input ios_ident
pos 312,68
objsize 160,48
button "変換",*mksrc
pos 350,y+30
objsize 120,24
button "アイコン作成",*exec_icontool_i
y=tooly
objsize 148,48
color 190,190,240:boxf 8,y,8+144,y+46
pos 8+34,y+16:color 0,0,0
mes "ソース変換/iOS"
objsize 96,48
pos 8+158,y
button "android",*go_andmenu
pos 8+158+104,y
button "hsp3dish.js",*go_hsp3js
pos 8+158+104*2,y
button "オプション",*option
stop
*go_andmenu
app_mode=1
goto *topmenu
*andmenu
initwnd
pos 8,8
mes "HSP3Dish android"
pos 8,30
gosub *and_validsdk
if and_gradle<=1 : goto *andmenu2
if path_proj="" : goto *andmenu2
if app_mode>1 : goto *andmenu_proj
mes "プロジェクト名:"
objsize 240,24
input and_name
objsize 100,24
pos 280,45:mes "API:"
pos 310,45:mes AND_TARGETDEFAULT
pos 350,45:mes "TOOL:"
pos 390,45:mes AND_TOOLDEFAULT
;objsize 60,24
;pos 410,41:button "ID...",*view_ids
pos 8,70
mes "パッケージ名:"
objsize 390,24
input and_package
objsize 160,24
pos 8,110
chkbox "AdMobを使用する",flag_admob
;chkbox "ARM64をビルドしない",flag_arm
chkbox "x86をビルドしない",flag_x86
chkbox "HGIMG4を使用する",flag_hgimg
chkbox "センサーを使用する",flag_sensor
;objenable stat,0
x=ginfo_sx-150:y=114
objsize 140,32
pos x,y
button "新規作成",*and_start
;y=154
;x=ginfo_sx-240
;pos x,y+4
;mes "キー名:"
;x=ginfo_sx-200
;objsize 100,24
;pos x,y
;input and_keystore
;x=ginfo_sx-90
;objsize 80,24
;pos x,y
;button "KEY作成",*and_makekey
goto *andmenu3
*andmenu2
mes "androidの開発環境が設定されていません。"
mes "下のオプションボタンを押して設定を行なってください。"
goto *andmenu3
*andmenu_proj
mes "ソーススクリプト: (空白の場合はhspフォルダを参照)"
objsize 390,24
input and_fname
objsize 64,24
pos 408,41:button "参照...",*selfile2
pos 8,70
;mes "データファイル(dpm): (空白の場合は未使用)"
;objsize 390,24
;input and_pack
;objsize 64,24
;pos 408,82:button "作成...",*selfile_pack
objsize 120,24
x=350:y=82
pos x,82:button "Assetフォルダを開く",*open_asset
pos x-124,82:button "アイコン作成",*exec_icontool_a
gosub *upd_prj
pos 8,110
mes "プロジェクト名:"
objsize 300,24
combox selprj, 100, projlist
objsize 64,24
pos 408,122:button gosub "更新",*upd_prj
x=ginfo_sx-190:y=154
objsize 60,24
pos x,y
button "転送",*and_exec
pos x+60,y
button "Logcat",*and_logcat
pos x+120,y
button "リリース",*and_keyman
objsize 120,24
pos x-130,y
button "ビルド",*and_build
pos x-260,y
button "クリーン",*and_clean
pos x-124,y+28
chkbox "ビルド後に起動する",flag_andrun
pos x+60,y+28
objsize 120,24
button "Dish P Helper",*exec_dishphelper
goto *andmenu3
*upd_prj
sdim projlist,4096
dirlist projlist,path_proj+"\\*.*",5
selprj=-1
notesel projlist
repeat notemax
noteget s1,cnt
if s1=and_name : selprj=cnt
loop
return
*get_prjname
and_name=""
notesel projlist
if selprj>=0 : noteget and_name,selprj
return
*andmenu3
y=6
objsize 170,20
pos 300,y
if app_mode=1 {
button "既存プロジェクト",*go_preproj
} else {
button "新規プロジェクト",*go_newproj
}
y=tooly
objsize 148,48
pos 8,y
button "ソース変換/iOS",*srcmenu
color 190,190,240
boxf 8+158,y,8+158+96,y+46
pos 8+158+30,y+16:color 0,0,0
mes "android"
objsize 96,48
pos 8+158+104,y
button "hsp3dish.js",*go_hsp3js
pos 8+158+104*2,y
button "オプション",*option
stop
*go_newproj
app_mode=1
goto *topmenu
*go_preproj
app_mode=2
goto *topmenu
*go_hsp3js
app_mode=3
goto *topmenu
*jsmenu
initwnd
pos 8,8
mes "指定されたHSP3Dishスクリプトをhtml5(WebGL/JavaScript)に変換します"
pos 8,30
sysfont 17
mes "ソーススクリプト:"
objsize 390,24
input js_fname
objsize 64,24
pos 408,41:button "参照...",*seljsfile
pos 8,70
mes "データフォルダ: data"
mes "( ソーススクリプト以下のdataフォルダ内のファイルが追加されます )"
;objsize 390,24
;input js_pack
;objsize 64,24
;pos 408,82:button "参照...",*selfile_jspack
pos 8,110
mes "メモリサイズ(MB)指定(空白の場合は規定値)"
objsize 120,24
input js_memopt
objsize 160,24
chkbox "HGIMG4を使用する",js_gpmode
chkbox "WebAssemblyを使用する",js_webasm
chkbox "デバッグ情報を出力する",js_debug
pos 312,118
objsize 160,24
combox js_template,128,"標準のhtml\n黒い背景のhtml"
objsize 160,48
button "変換",*cnv_js
y=tooly
objsize 148,48
pos 8,y
button "ソース変換/iOS",*srcmenu
color 190,190,240
boxf 8+158+104,y,8+158+104+96,y+46
pos 8+158+104+22,y+16:color 0,0,0
mes "hsp3dish.js"
objsize 96,48
pos 8+158,y
button "android",*go_andmenu
pos 8+158+104*2,y
button "オプション",*option
stop
*selfile_jspack
selfolder s1,"データフォルダを指定してください"
if stat=0 {
js_pack = s1
objprm 2, js_pack
}
stop
*option
gosub *and_validsdk
initwnd
pos 8,8
mes "android オプション設定"
y=40
pos 8,y+3:mes "Javaフォルダ"
objsize 320,24
pos 80,y:input path_java
objsize 64,24
pos 408,y:button "参照...",*selpath_java
y+=30
pos 8,y+3:mes "SDK Gradle"
objsize 320,24
pos 80,y:input path_gradle
objsize 64,24
pos 408,y:button "参照...",*selpath_gradle
y+=30
;pos 8,y+3:mes "SDKフォルダ"
;objsize 320,24
;pos 80,y:input path_sdk
;objsize 64,24
;pos 408,y:button "参照...",*selpath_sdk
;y+=30
;pos 8,y+3:mes "NDKフォルダ"
;objsize 320,24
;pos 80,y:input path_ndk
;objsize 64,24
;pos 408,y:button "参照...",*selpath_ndk
;y+=30
;pos 8,y+3:mes "antフォルダ"
;objsize 320,24
;pos 80,y:input path_ant
;objsize 64,24
;pos 408,y:button "参照...",*selpath_ant
;y+=30
pos 8,y+3:mes "プロジェクト"
objsize 320,24
pos 80,y:input path_proj
objsize 64,24
pos 408,y:button "参照...",*selpath_proj
y+=30
objsize 102,30
;pos 8,y
;button "SDKマネージャー",*exec_sdkman
;pos 8+110,y
;button "ライブラリ更新",*and_libcopy
pos 8+180,y
button "SDKセットアップ",*and_gradlesetup
pos 8+100*3,y+6
mes "HSP3ライブラリ : "+dir_hsplib
;button "AdMobセットアップ",*exec_admob
if and_gradle<1 : goto *no_avdman
pos 8+60,y
button "AVDマネージャー",*exec_avdman
*no_avdman
y=tooly
objsize 148,48
pos 8,y
button "ソース変換/iOS",*srcmenu
objsize 96,48
pos 8+158+104,y
button "hsp3dish.js",*go_hsp3js
objsize 96,48
pos 8+158,y
button "android",*go_andmenu
color 190,190,240
boxf 8+158+104*2,y,8+158+104*2+96,y+46
pos 8+158+104*2+26,y+18:color 0,0,0
mes "オプション"
*optmenu_1
stop
*selpath_java
selfolder s1,"Javaインストールフォルダを指定してください" : if stat : goto *optmenu_1
path_java = s1
objprm 0, s1
stop
*selpath_sdk
selfolder s1,"android SDKインストールフォルダを指定してください" : if stat : goto *optmenu_1
path_sdk = s1
objprm 2, s1
stop
*selpath_ndk
selfolder s1,"android NDKインストールフォルダを指定してください" : if stat : goto *optmenu_1
path_ndk = s1
objprm 4, s1
stop
*selpath_ant
selfolder s1,"antインストールフォルダを指定してください" : if stat : goto *optmenu_1
path_ant = s1
objprm 6, s1
stop
*selpath_proj
selfolder s1,"プロジェクトのルートフォルダを指定してください" : if stat : goto *optmenu_1
path_proj = s1
objprm 4, s1
stop
*selpath_gradle
selfolder s1,"android SDK gradleインストールフォルダを指定してください" : if stat : goto *optmenu_1
path_gradle = s1
objprm 2, s1
stop
*selfile_pack
selfolder s1,"データフォルダを指定してください"
if stat=0 {
and_pack = s1
gosub *mkdpm
and_pack+="\\data.dpm"
objprm 2, and_pack
}
stop
*open_asset
gosub *get_prjname
if and_name="" : stop
basedir=path_proj+"\\"+and_name+"\\app\\src\\main\\assets"
dirlist s1,basedir,5
if stat=0 : stop
exec "explorer "+basedir
stop
*owari
; アプリケーション終了
;
gsel 0
gosub *owari_savesub
end
*owari_savesub
; 設定をセーブ
;
get_hsp_appdata_path app_dir
cfg_init app_dir+APP_CONF
cfg_seti "winx",ginfo_wx1
cfg_seti "winy",ginfo_wy1
cfg_seti "mode",app_mode
cfg_seti "flag_utf8",flag_utf8
cfg_sets "path_java",path_java
cfg_sets "path_sdk",path_sdk
cfg_sets "path_ndk",path_ndk
cfg_sets "path_ant",path_ant
cfg_sets "path_proj",path_proj
cfg_sets "and_name",and_name
;cfg_sets "and_pack",and_pack
cfg_sets "and_target",and_targetid
cfg_sets "and_fname",and_fname
cfg_sets "and_keystore",and_keystore
cfg_seti "and_copylib",and_copylib
cfg_sets "and_keyfile",and_keyfile
cfg_sets "and_keypass",and_keypass
cfg_sets "path_gradle",path_gradle
cfg_seti "and_gradle",and_gradle
cfg_seti "and_gradleapi",and_gradleapi
cfg_seti "and_gradlesdk",and_gradlesdk
cfg_seti "flag_admob",flag_admob
cfg_seti "flag_arm",flag_arm
cfg_seti "flag_x86",flag_x86
cfg_seti "flag_hgimg",flag_hgimg
cfg_seti "flag_sensor",flag_sensor
cfg_seti "flag_xhgimg",flag_xhgimg
cfg_seti "flag_andrun",flag_andrun
cfg_seti "js_webasm",js_webasm
cfg_seti "js_template",js_template
cfg_sets "ios_org",ios_org
cfg_sets "ios_ident",ios_ident
cfg_save
return
*selfile
dialog "hsp",16,"hsp3スクリプト"
fname=refstr
if stat : objprm 0,fname
stop
*selfile2
dialog "hsp",16,"hsp3スクリプト"
and_fname=refstr
if stat : objprm 0,and_fname
stop
*seljsfile
dialog "hsp",16,"hsp3スクリプト"
js_fname=refstr
if stat : objprm 0,js_fname
stop
*mksrc
; hsp convert only
;
if fname="" : stop
initsub
s1=fname
gosub *hspcnv
if hspcnv_res : goto *fin
if flag_xcode=0 : goto *mksrc_ok
gosub *mkxcode5
*mksrc_ok
gsel 1
mes "終了しました。"
*fin
gsel 1
objprm 0,buf
;button "OK",*topmenu
gsel 0
goto *topmenu
*hspcomp
; hsp compile
; s1 = full path name (.hsp)
;
mydir=getpath(s1,32)
myfile=getpath(s1,1+8+16)
chdir mydir
hspname=myfile+".hsp" ; スクリプトファイル名
objname=myfile+".ax" ; オブジェクトファイル名
cppname=myfile+".cpp" ; Cファイル名
hsc_ini s1
hsc_objname objname
hsc_comp hspcomp_mode ; コンパイル
res=stat
hsc_getmes buf
return
*hspcnv
; hsp convert
; s1 = full path name (.hsp)
; (out) hspcnv_res 0=ok,1=error
;
hspcnv_res=0
hspcomp_mode=0
gosub *hspcomp
if res!=0 : dialog "HSPコンパイル中にエラーが発生しました。" : hspcnv_res=1 : return
tmp=""
cmd = dir_exe+"\\hsp3cnv -d "+myfile
pipeexec tmp,cmd,1
if stat : dialog "hsp3cnvを実行できませんでした" : hspcnv_res=1 : return
buf+=tmp
gsel 1
mes "HSP変換処理中..."
ln=""
repeat
pipeget ln
if stat=0 : break
;buf+=ln
await 10
loop
buf+=ln
exist cppname
if strsize<=0 : dialog "HSPソース変換中にエラーが発生しました。" : hspcnv_res=1 : return
if flag_utf8=0 : return
maxsize = strsize*2
sdim outbuf, maxsize
gsel 1
mes "UTF-8に変換中..."
notesel cppbuf
noteload cppname
nkfcnv outbuf,cppbuf,"Sw",-1,maxsize ; 文字コード変換
notesel outbuf
notesave cppname
gsel 1
mes "変換終了しました。"
return
*mkdpm
; packfile作成
; s1 = packfile dir
;
sname = "packfile"
chdir s1
dirlist s1,"*.*",0
notesel s1
repeat notemax
noteget ff,cnt
hed=""
if ff="packfile" : hed=";"
if getpath(ff,2)=".dpm" : hed=";"
if hed!="" : noteadd hed+ff,cnt,1
loop
noteadd "; packfile generated by hsp3dish helper",0
notesave sname ; テキストファイルをセーブ
hsc_ini ""
pack_ini "data.dpm"
pack_make 1,0
return
; android
;
*bat_init
notesel tmp
tmp="@ECHO OFF\n"
tmp+="SET JAVA_HOME="+path_java+"\n"
tmp+="SET NDK_ROOT="+path_gradle+"\\ndk\\"+NDK_VERSION+"\n"
tmp+="SET ANDROID_HOME="+path_gradle+"\n"
tmp+="SET SDK_ROOT="+path_gradle+"\n"
tmp+="SET PATH="+path_gradle+"\\cmdline-tools\\latest\\bin;"+path_gradle+"\\platform-tools;"+path_java+"\\bin;%PATH%;\n"
s1="C:":if peek(path_proj,1)=':' {
poke s1,0,peek(path_proj,0)
}
tmp+=s1+"\n"
tmp+="CD "+path_proj+"\n"
;tmp+="ECHO START\n"
return
*bat_save
chdir app_dir
wait 1
notesave "go.bat"
return
*xml_init