ofile="test.exe" tmpfile="test.exe" hrt="F:\\tools\\hsp\\hsprt" ;ランタイム dpm="data.dpm" mes "ランタイム" input hrt,200 mes "DPMファイル" input dpm,200 mes "Window size(x,y)" wx=640:wy=480 input wx:input wy objsize 200 chkbox "ウインドウ非表示",hide chkbox "フルスクリーン",full button "OK",*start stop *start exist hrt if strsize<1 :mes "hrt error"stop size=strsize alloc buf,size+64 bload hrt,buf,size exist dpm if strsize<1 :mes "dpm error"stop dpmsize=strsize alloc dpmbuf,dpmsize+64 bload dpm,dpmbuf,dpmsize ;"HSPDEF~~\0"を探す f='H','S','P','D','E','F','~','~',0 p=0 pp=-1 repeat size peek c,buf,cnt if f.p==c :p++:else: p=0 if p>8 :pp=cnt-p+1:break loop if pp<0 :mes "err":stop ;EXE作成情報を書き込む memset buf,0,8,pp poke buf,pp+0x11,full*0x66 ;? poke buf,pp+0x13,'x' wpoke buf,pp+0x14,wx poke buf,pp+0x16,'y' wpoke buf,pp+0x17,wy poke buf,pp+0x19,0x64 ;? poke buf,pp+0x1a,hide ;何バイトになるか試してみる bsave tmpfile,buf,size exec "upx.exe "+tmpfile,1 wait 60 exist tmpfile size2=strsize ;DPMのオフセットを書き込む o=size2-65536 poke buf,pp+0x9,""+o ;もう一度圧縮 bsave tmpfile,buf,size exec "upx.exe "+tmpfile,1 wait 60 exist tmpfile if size2!=strsize :mes "ファイルサイズが予想と違った":stop ;DPMデータを追加 alloc buf,size2+dpmsize+64 bload tmpfile,buf,size2 memcpy buf,dpmbuf,dpmsize,size2,0 bsave ofile,buf,size2+dpmsize mes "OK" stop