X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Fmain-win.c;h=a22216846b8f6bf66ffb2d4e043c2c431178dc2f;hb=04cdaa5d31ae2877156b0e9249d740b00a683089;hp=c2cc572d6b6df42568529391b284b00708cf7150;hpb=437f9c66110c6175e5a6309c60914f6767936b18;p=hengbandforosx%2Fhengbandosx.git diff --git a/src/main-win.c b/src/main-win.c index c2cc572d6..a22216846 100644 --- a/src/main-win.c +++ b/src/main-win.c @@ -126,14 +126,16 @@ #include "util/string-processor.h" #include "view/display-map.h" #include "view/display-messages.h" +#include "wizard/spoiler-util.h" +#include "wizard/wizard-spoiler.h" #include "world/world.h" #ifdef WINDOWS +#include "direct.h" #include "dungeon/dungeon.h" +#include "locale.h" #include "save/save.h" -#include -#include -#include +#include "windows.h" /* * Available graphic modes @@ -817,6 +819,7 @@ static void save_prefs(void) strcpy(buf, use_bg ? "1" : "0"); WritePrivateProfileString("Angband", "BackGround", buf, ini_file); WritePrivateProfileString("Angband", "BackGroundBitmap", bg_bitmap_file[0] != '\0' ? bg_bitmap_file : "bg.bmp", ini_file); + WritePrivateProfileString("Angband", "SaveFile", savefile, ini_file); for (int i = 0; i < MAX_TERM_DATA; ++i) { save_prefs_aux(i); @@ -892,6 +895,7 @@ static void load_prefs(void) arg_music = (GetPrivateProfileInt("Angband", "Music", 0, ini_file) != 0); use_bg = GetPrivateProfileInt("Angband", "BackGround", 0, ini_file); GetPrivateProfileString("Angband", "BackGroundBitmap", "bg.bmp", bg_bitmap_file, 1023, ini_file); + GetPrivateProfileString("Angband", "SaveFile", "", savefile, 1023, ini_file); for (int i = 0; i < MAX_TERM_DATA; ++i) { load_prefs_aux(i); } @@ -945,15 +949,17 @@ static void load_sound_prefs(void) char wav_path[1024]; char *zz[SAMPLE_SOUND_MAX]; - path_build(ini_path, 1024, ANGBAND_DIR_XTRA_SOUND, "sound.cfg"); + path_build(ini_path, 1024, ANGBAND_DIR_XTRA_SOUND, "sound_debug.cfg"); + if (GetPrivateProfileString("Device", "type", "", mci_device_type, 256, ini_path) == 0) { + path_build(ini_path, 1024, ANGBAND_DIR_XTRA_SOUND, "sound.cfg"); + GetPrivateProfileString("Device", "type", "", mci_device_type, 256, ini_path); + } + for (int i = 0; i < SOUND_MAX; i++) { GetPrivateProfileString("Sound", angband_sound_name[i], "", tmp, 1024, ini_path); int num = tokenize_whitespace(tmp, SAMPLE_SOUND_MAX, zz); for (int j = 0; j < num; j++) { - /* Access the sound */ path_build(wav_path, 1024, ANGBAND_DIR_XTRA_SOUND, zz[j]); - - /* Save the sound filename, if it exists */ if (check_file(wav_path)) sound_file[i][j] = string_make(zz[j]); } @@ -968,8 +974,12 @@ static void load_music_prefs(void) char *zz[SAMPLE_MUSIC_MAX]; char key[80]; - path_build(ini_path, 1024, ANGBAND_DIR_XTRA_MUSIC, "music.cfg"); - GetPrivateProfileString("Device", "type", "", mci_device_type, 256, ini_path); + path_build(ini_path, 1024, ANGBAND_DIR_XTRA_MUSIC, "music_debug.cfg"); + if (GetPrivateProfileString("Device", "type", "", mci_device_type, 256, ini_path) == 0) { + path_build(ini_path, 1024, ANGBAND_DIR_XTRA_MUSIC, "music.cfg"); + GetPrivateProfileString("Device", "type", "", mci_device_type, 256, ini_path); + } + for (int i = 0; i < MUSIC_BASIC_MAX; i++) { GetPrivateProfileString("Basic", angband_music_basic_name[i], "", tmp, 1024, ini_path); int num = tokenize_whitespace(tmp, SAMPLE_MUSIC_MAX, zz); @@ -2267,7 +2277,7 @@ static void check_for_save_file(player_type *player_ptr, LPSTR cmd_line) if (!*s) return; - strcat(savefile, s); + strcpy(savefile, s); validate_file(savefile); game_in_progress = TRUE; play_game(player_ptr, FALSE, FALSE); @@ -2289,6 +2299,7 @@ static void process_menus(player_type *player_ptr, WORD wCmd) } else { game_in_progress = TRUE; term_flush(); + strcpy(savefile, ""); play_game(player_ptr, TRUE, FALSE); quit(NULL); } @@ -3050,7 +3061,7 @@ LRESULT PASCAL AngbandWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam p_ptr->panic_save = 1; signals_ignore_tstp(); (void)strcpy(p_ptr->died_from, _("(緊急セーブ)", "(panic save)")); - (void)save_player(p_ptr, SAVE_TYPE_NORMAL); + (void)save_player(p_ptr, SAVE_TYPE_CLOSE_GAME); quit(NULL); return 0; } @@ -3213,7 +3224,7 @@ LRESULT PASCAL AngbandListProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara term_resize(td->cols, td->rows); term_activate(old_term); InvalidateRect(td->w, NULL, TRUE); - p_ptr->window = 0xFFFFFFFF; + p_ptr->window_flags = 0xFFFFFFFF; handle_stuff(p_ptr); } @@ -3482,6 +3493,28 @@ static void init_stuff(void) } /*! + * @brief コマンドラインから全スポイラー出力を行う + * Create Spoiler files from Command Line + * @return spoiler_output_status + */ +static spoiler_output_status create_debug_spoiler(LPSTR cmd_line) +{ + char *s, *option; + s = cmd_line; + if (!*s) + return SPOILER_OUTPUT_CANCEL; + option = "--output-spoilers"; + + if (strncmp(s, option, strlen(option)) != 0) + return SPOILER_OUTPUT_CANCEL; + + init_stuff(); + init_angband(p_ptr, process_autopick_file_command, TRUE); + + return output_all_spoilers(); +} + +/*! * todo よく見るとhMutexはちゃんと使われていない……? * @brief (Windows固有)変愚蛮怒が起動済かどうかのチェック */ @@ -3514,6 +3547,23 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC return FALSE; } + switch (create_debug_spoiler(lpCmdLine)) { + case SPOILER_OUTPUT_SUCCESS: + fprintf(stdout, "Successfully created a spoiler file."); + quit(NULL); + return 0; + case SPOILER_OUTPUT_FAIL_FOPEN: + fprintf(stderr, "Cannot create spoiler file."); + quit(NULL); + return 0; + case SPOILER_OUTPUT_FAIL_FCLOSE: + fprintf(stderr, "Cannot close spoiler file."); + quit(NULL); + return 0; + default: + break; + } + if (hPrevInst == NULL) { wc.style = CS_CLASSDC; wc.lpfnWndProc = AngbandWndProc; @@ -3601,7 +3651,7 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC signals_init(); term_activate(term_screen); - init_angband(p_ptr, process_autopick_file_command); + init_angband(p_ptr, process_autopick_file_command, FALSE); initialized = TRUE; check_for_save_file(p_ptr, lpCmdLine); prt(_("[ファイル] メニューの [新規] または [開く] を選択してください。", "[Choose 'New' or 'Open' from the 'File' menu]"), 23, _(8, 17));