;-------------------------------------- ; ; 作:せつき ; HP:http://www.setsuki.com/ ; ;-------------------------------------- #module #deffunc bitcut val,int ;************************************** ; byte分をbitに分解 ;************************************** mref p1,16 mref p2,1 num=p1.0 repeat p2,1 tmp=0 : i=cnt repeat p1.i if num\2=1 : tmp=1<>1 loop p1.i=tmp loop return ;************************************** #global ;初期設定 ;-------------------------------------- screen 2,160,185,6 : gsel 0 sdim file,10000 sdim buf ,65535 sdim pals,10000 : pal=0 dim clr ,1024,2 objmode 1,1 : objsize 100,24 pos 0,0 : button "読み込み",*begin pos 100,0 : button "結果を保存",*hozon pos 206,2 : combox pal,100,pals pos 312,5 : mes "の" pos 330,0 : button "パレット表示",*colorview objmode 2,1 : pos 0,24 : mesbox buf,winx,winy-24,5,65535 ;ファイルを開く ;-------------------------------------- *begin gsel 2,-1 : gsel 0,1 dialog "gif",16,"" : if stat!1 : stop file=refstr ;ファイルのサイズを取得 ;-------------------------------------- exist file : flen=strsize if flen<0 : dialog "ファイルが存在しません" : stop ;GIFチェック ;-------------------------------------- sdim check,6 : bload file,check,6 if(check!"GIF89a")&(check!"GIF87a") : dialog "GIFファイルではありません" : goto *begin ;バイナリ・ロード ;-------------------------------------- sdim b,flen : bload file,b,flen getpath t,file,8 : title t+" ("+flen+"byte)" ;(ヘッダ情報などを書く) ;-------------------- buf="" : notesel buf : no=0 noteadd ""+file+"\n" noteadd "======================================" noteadd "ファイルタイプ\n 6: 識別文字  :"+check+"\n" ;スクリーン情報 ;-------------------- ;2 (imgx) 画像の横幅 ;2 (imgy) 同、高さ ;1 (scrn) スクリーン情報のフラグ ;1 (bclr) 背景色 ;1 (aspc) アスペクト比 wpeek imgx,b,6 ;横 wpeek imgy,b,8 ;縦 peek scrn,b,10 ;スクリーン情報のフラグ peek bclr,b,11 ;背景色 peek aspc,b,12 ;アスペクト比 ;スクリーン情報のフラグ ;-------------------- ;1 共通パレットの色数 : 2<=flen : break peek c,b,i : i++ if c=0x3B { noteadd "終了ブロック" noteadd " 1: 終了部     :0x3B" : break } if c=0x21 { peek e,b,i : i++ peek s,b,i : i++ if e=0xFF : gosub *label_21_FF : i+=s+1 : continue if e=0xFE : gosub *label_21_FE : i+=s+1 : continue if e=0xF9 : gosub *label_21_F9 : i+=s+1 : continue gosub *label_21 : i+=s+1 : continue } if c=0x2C { gosub *label_2C : no++ : continue } noteadd ""+c loop ;結果を表示 ;-------------------------------------- *view objprm 2,pals : objprm 2,0 : pal=0 clrobj 4,4 pos 0,24 : mesbox buf,winx,winy-24,5,65535 stop ;====================================== ;拡張ブロック:アプリケーション ;-------------------- *label_21_FF noteadd "拡張ブロック(アプリケーション)" : noteadd " 1: ブロック識別子 :0x21" : noteadd " 1: ラベル識別子  :0xFF" : noteadd " 1: ブロック・サイズ:"+s strmid n,b,i,8 : noteadd " 8: アプリケーション:"+n strmid n,b,i+8,3 : noteadd " 3: バージョン情報 :"+n peek c,b,i+11 : if c!0 { : noteadd " 1: ブロック・サイズ:"+c : s+=c+1 peek c,b,i+12 : noteadd " 1: 予約済み(常に1) :"+c wpeek c,b,i+13 : noteadd " 2: ループ回数   :"+c peek c,b,i+15 } : noteadd " 1: ブロック終端  :"+c+"\n" return ;拡張ブロック:コメント ;-------------------- *label_21_FE noteadd "拡張ブロック(コメント)" : noteadd " 1: ブロック識別子 :0x21" : noteadd " 1: ラベル識別子  :0xFE" : noteadd " 1: ブロック・サイズ:"+s : if s=0 : i-- : noteadd "" : return strmid n,b,i,s : noteadd " -: コメントデータ :"+n peek c,b,i+s : noteadd " 1: ブロック終端  :"+c+"\n" return ;拡張ブロック:イメージ・コントロール ;-------------------- *label_21_F9 noteadd "拡張ブロック(イメージ・コントロール)" : noteadd " 1: ブロック識別子 :0x21" n=e : str n,18 : noteadd " 1: ラベル識別子  :0x"+n : noteadd " 1: ブロック・サイズ:"+s peek flag,b,i : noteadd " 1: イメージ・コントロールフラグ" flag.1=1,1,3,3 : bitcut flag,4 n="" : if flag.3=0 : n=" (何もしない)" : if flag.3=1 : n=" (重ねる)" : if flag.3=2 : n=" (背景色で塗りつぶす)" : if flag.3=3 : n=" (前に戻す)" : noteadd "   0 : 透過GIFの使用  :"+flag.1+" (0=不使用:1=使用)" : noteadd "   1 : ユーザー入力  :"+flag.2 : noteadd "   2〜4: フレーム描画方法:"+flag.3+""+n : noteadd "   5〜7: 予約済み(常に0) :"+flag.4 wpeek c,b,i+1 : noteadd " 2: フレーム表示時間:"+c+"(単位は100/1秒)" peek c,b,i+3 : noteadd " 1: 透過GIFの透明色 :"+c peek c,b,i+4 : noteadd " 1: ブロック終端  :"+c+"\n" return ;拡張ブロック:不明 ;-------------------- *label_21 noteadd "拡張ブロック(不明)" : noteadd " 1: ブロック識別子 :0x21" n=e : str n,18 : noteadd " 1: ラベル識別子  :0x"+n : noteadd " 1: ブロック・サイズ:"+s ; noteadd " -: ブロック・データ:--" peek c,b,i+s : noteadd " 1: ブロック終端  :"+c+"\n" return ;====================================== ;画像情報(レンダリングブロック) ;-------------------- ;1 画像ブロックのブロック・ラベル(2Ch) ;2 (posx) 画像の表示位置のX座標(左上隅) ;2 (posy) 同、Y座標 ;2 (imgx) 画像の幅 ;2 (imgy) 画像の高さ ;1 (gflg) 画像情報のフラグ *label_2C wpeek posx ,b,i+0 ;x座標 wpeek posy ,b,i+2 ;y座標 wpeek imgx2,b,i+4 ;横 wpeek imgy2,b,i+6 ;縦 peek gflg ,b,i+8 ;画像情報のフラグ ;画像情報のフラグ ;-------------------- ;1 固有パレットの色数:2<0 : palnum2=2<=flen : break peek block,b,i : i++ if block=0 { noteadd " 1: ブロック終端  :"+block break } else { noteadd " 1: ブロックサイズ :"+block i+=block } loop noteadd "\n======================================" return ;====================================== ;結果をテキストファイルに保存 ;-------------------------------------- *hozon dialog "txt",17,"" if stat=1 { strlen size,buf bsave refstr,buf,size } stop ;カラーパレット表示 ;-------------------------------------- *colorview if pal<0 : stop gsel 2,1 : cls 0 : title "カラーパレット ("+clr.pal.1+" 色)" box=10 : x=0 : y=0 : i=clr.pal.0 repeat clr.0.1 peek r,b,i : i++ peek g,b,i : i++ peek v,b,i : i++ color 0,0,0 : boxf x,y,x+box-2,y+box-2 color r,g,v : boxf x+1,y+1,x+box-3,y+box-3 x+=box : if cnt\16=15 : y+=box : x=0 loop pos 160-25/2,161 : objmode 1,0 : objsize 24,24 : button "閉",*del stop *del gsel 2,-2 : stop