; iniファイルを読み込んでみる ;; 実行ファイル名とexe生成を指定 #packopt name "read_ini" #packopt type 0 fullscreen_bin = "" config_bin = "" preview_img = "" #uselib "kernel32" #func GetModuleFileName "GetModuleFileNameA" int, int, int ;; 自分自身のファイル名を取得 sdim filepath, 256 GetModuleFileName, varptr(filepath), 256 ;; iniファイルのファイルパスを生成 ini_filepath = getpath(filepath, 1) + ".ini" ;; iniファイル読み込み ini_data = "" notesel ini_data ; iniファイル存在チェック exist ini_filepath if strsize = -1 { mes "Not found " + ini_filepath } else { ; iniファイルを読み込む noteload ini_filepath ; 1行ずつ内容を解析して記録 sdim ld, 512 repeat notemax noteget ld, cnt ; 1行分を取得 if instr(ld, 0, "fullscreen_bin=") >= 0 { split ld, "=", kind, cmd gosub *checkfileexist fullscreen_bin = cmd } if instr(ld, 0, "config_bin=") >= 0 { split ld, "=", kind, cmd gosub *checkfileexist config_bin = cmd } if instr(ld, 0, "preview_img=") >= 0 { split ld, "=", kind, cmd gosub *checkfileexist preview_img = cmd } loop } cls mes "fullscreen : " + fullscreen_bin mes "config : " + config_bin mes "preview : " + preview_img ; main loop repeat ; ESC key to exit stick key, 128 if key & 128 : end await (1000 / 60) loop end ; ファイルの存在チェック。 ; cmd にファイルパスを入れて呼ぶ。 ; ファイルが存在しなかったら cmd が空文字列になって返る。 *checkfileexist if cmd = "" : return exist cmd if strsize = -1 { cmd = "" } return