static void uiattach_tape_dialog(HWND hwnd) { TCHAR *st_name; int autostart_index = -1; SuspendFullscreenModeKeep(hwnd); if ((st_name = uilib_select_file_autostart(hwnd, translate_text(IDS_ATTACH_TAPE_IMAGE), UILIB_FILTER_TAPE | #ifdef HAVE_ZLIB UILIB_FILTER_ZIP | #endif UILIB_FILTER_ALL, UILIB_SELECTOR_TYPE_FILE_LOAD, UILIB_SELECTOR_STYLE_TAPE, &autostart_index, NULL)) != NULL) { char *name; name = system_wcstombs_alloc(st_name); if (autostart_index >= 0) { if (autostart_autodetect(name, NULL, autostart_index, AUTOSTART_MODE_RUN) < 0) { ui_error(translate_text(IDS_CANNOT_AUTOSTART_FILE)); } } else { if (tape_image_attach(1, name) < 0) { ui_error(translate_text(IDS_CANNOT_ATTACH_FILE)); } } system_wcstombs_free(name); lib_free(st_name); } ResumeFullscreenModeKeep(hwnd); }
static void uiattach_autostart_dialog(HWND hwnd) { TCHAR *st_name; int autostart_index = 0; char *resource; resource = lib_msprintf("AttachDevice%dReadonly", 8); if ((st_name = uilib_select_file_autostart(hwnd, translate_text(IDS_AUTOSTART_IMAGE), UILIB_FILTER_CBM | UILIB_FILTER_DISK | UILIB_FILTER_TAPE | #ifdef HAVE_ZLIB UILIB_FILTER_ZIP | #endif UILIB_FILTER_PRGP00 | UILIB_FILTER_ALL, UILIB_SELECTOR_TYPE_FILE_LOAD, UILIB_SELECTOR_STYLE_DISK_AND_TAPE, &autostart_index, resource)) != NULL) { char *name; name = system_wcstombs_alloc(st_name); if (autostart_autodetect(name, NULL, autostart_index, AUTOSTART_MODE_RUN) < 0) { ui_error(translate_text(IDS_CANNOT_AUTOSTART_FILE)); } system_wcstombs_free(name); lib_free(st_name); } lib_free(resource); }
void uicart_attach(WPARAM wparam, HWND hwnd, const uicart_params_t *cartridges) { int i; TCHAR *st_name; i = 0; while ((cartridges[i].wparam != wparam) && (cartridges[i].wparam != 0)) i++; if (cartridges[i].wparam == 0) { ui_error(translate_text(IDS_BAD_CARTRIDGE_CONFIG)); return; } if ((st_name = uilib_select_file(hwnd, translate_text(cartridges[i].title), cartridges[i].filter, UILIB_SELECTOR_TYPE_FILE_LOAD, UILIB_SELECTOR_STYLE_CART)) != NULL) { char *name; name = system_wcstombs_alloc(st_name); if (cartridge_attach_image(cartridges[i].type, name) < 0) ui_error(translate_text(IDS_INVALID_CARTRIDGE_IMAGE)); system_wcstombs_free(name); lib_free(st_name); } }
static void apply_archive_romset_dialog(HWND hwnd) { char *name; TCHAR *st_name; st_name = active_archive_name(hwnd); name = system_wcstombs_alloc(st_name); romset_archive_item_select(name); system_wcstombs_free(name); lib_free(st_name); }
static void uiattach_disk_dialog(HWND hwnd, WPARAM wparam) { TCHAR *st_name; char *resource; int unit = 8; int autostart_index = -1; SuspendFullscreenModeKeep(hwnd); switch (wparam & 0xffff) { case IDM_ATTACH_8: unit = 8; break; case IDM_ATTACH_9: unit = 9; break; case IDM_ATTACH_10: unit = 10; break; case IDM_ATTACH_11: unit = 11; break; } resource = lib_msprintf("AttachDevice%dReadonly", unit); if ((st_name = uilib_select_file_autostart(hwnd, translate_text(IDS_ATTACH_DISK_IMAGE), UILIB_FILTER_DISK | #ifdef HAVE_ZLIB UILIB_FILTER_ZIP | #endif UILIB_FILTER_ALL, UILIB_SELECTOR_TYPE_FILE_LOAD, UILIB_SELECTOR_STYLE_DISK, &autostart_index, resource)) != NULL) { char *name; name = system_wcstombs_alloc(st_name); if (autostart_index >= 0) { if (autostart_autodetect(name, NULL, autostart_index, AUTOSTART_MODE_RUN) < 0) { ui_error(translate_text(IDS_CANNOT_AUTOSTART_FILE)); } } else { if (file_system_attach_disk(unit, name) < 0) { ui_error(translate_text(IDS_CANNOT_ATTACH_FILE)); } } system_wcstombs_free(name); lib_free(st_name); } ResumeFullscreenModeKeep(hwnd); lib_free(resource); }
static void autostart_diskimage(HWND hwnd) { TCHAR *st_name; st_name = uilib_select_file(hwnd, translate_text(IDS_AUTOSTART_DISK_IMAGE), UILIB_FILTER_ALL | UILIB_FILTER_DISK | UILIB_FILTER_ZIP, UILIB_SELECTOR_TYPE_FILE_LOAD, UILIB_SELECTOR_STYLE_DISK); if (st_name != NULL) { char *name; SetDlgItemText(hwnd, IDC_DISKIMAGE, st_name); name = system_wcstombs_alloc(st_name); if (autostart_autodetect(name, "*", 0, AUTOSTART_MODE_RUN) < 0) { ui_error(translate_text(IDS_CANNOT_AUTOSTART_FILE)); } system_wcstombs_free(name); lib_free(st_name); } }
static void dump_mapping(HWND hwnd) { TCHAR *st_name; if ((st_name = uilib_select_file(hwnd, translate_text(IDS_SAVE_KEYMAP_FILE), UILIB_FILTER_KEYMAP, UILIB_SELECTOR_TYPE_FILE_SAVE, UILIB_SELECTOR_STYLE_DEFAULT)) != NULL) { char *name; name = system_wcstombs_alloc(st_name); util_add_extension(&name, "vkm"); if (keyboard_keymap_dump(name) != 0) { ui_error(translate_text(IDS_CANNOT_WRITE_KEYMAP_FILE)); } system_wcstombs_free(name); lib_free(st_name); } }
static BOOL CALLBACK dialog_palette_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { int type; extern int querynewpalette; switch (msg) { case WM_NOTIFY: if (((NMHDR FAR *)lparam)->code == (UINT)PSN_APPLY) { querynewpalette = 1; if (resources_set_string(current_chip2->res_PaletteFile_name, palette_file2) < 0) { ui_error(translate_text(IDS_COULD_NOT_LOAD_PALETTE)); SetWindowLong (hwnd, DWL_MSGRESULT, TRUE); return TRUE; } lib_free(palette_file2); palette_file2 = NULL; SetWindowLong (hwnd, DWL_MSGRESULT, FALSE); return TRUE; } return FALSE; case WM_INITDIALOG: init_palette_dialog(hwnd, (Chip_Parameters*)((PROPSHEETPAGE*)lparam)->lParam); return TRUE; case WM_COMMAND: type = LOWORD(wparam); switch (type) { case IDC_VIDEO_CUSTOM_BROWSE: { TCHAR *st_name; if ((st_name = uilib_select_file(hwnd, translate_text(IDS_LOAD_VICE_PALETTE_FILE), UILIB_FILTER_ALL | UILIB_FILTER_PALETTE, UILIB_SELECTOR_TYPE_FILE_LOAD, UILIB_SELECTOR_STYLE_DEFAULT)) != NULL) { char *name; SetDlgItemText(hwnd, IDC_VIDEO_CUSTOM_NAME, st_name); name = system_wcstombs_alloc(st_name); update_palettename2(name); system_wcstombs_free(name); lib_free(st_name); } } break; case IDC_VIDEO_CUSTOM_NAME: { TCHAR st[100]; char s[100]; GetDlgItemText(hwnd, IDC_VIDEO_CUSTOM_NAME, st, 100); system_wcstombs(s, st, 100); update_palettename2(s); break; } } return TRUE; } return FALSE; }
static BOOL CALLBACK dialog_advanced_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { int type, ival; float tf; TCHAR s[100]; extern int querynewpalette; switch (msg) { case WM_NOTIFY: if (((NMHDR FAR *)lparam)->code == (UINT)PSN_APPLY) { GetDlgItemText(hwnd, IDC_VIDEO_COLORS_GAM, s, 100); _stscanf(s, TEXT("%f"), &tf); ival = (int)(tf * 1000.0 + 0.5); resources_set_int("ColorGamma", ival); resources_set_int(current_chip->res_ExternalPalette_name, res_extpalette); GetDlgItemText(hwnd, IDC_VIDEO_ADVANCED_SHADE, s, 100); _stscanf(s, TEXT("%f"), &tf); ival = (int)(tf * 1000.0 + 0.5); resources_set_int("PALScanLineShade", ival); GetDlgItemText(hwnd, IDC_VIDEO_ADVANCED_BLUR, s, 100); _stscanf(s, TEXT("%f"), &tf); ival = (int)(tf * 1000.0 + 0.5); resources_set_int("PALBlur", ival); ival = SendMessage(GetDlgItem(hwnd, IDC_VIDEO_ADVANCED_MODE), CB_GETCURSEL, 0, 0); resources_set_int("PALMode", ival); querynewpalette = 1; if (resources_set_string(current_chip->res_PaletteFile_name, palette_file) < 0) { ui_error(translate_text(IDS_COULD_NOT_LOAD_PALETTE)); resources_set_int(current_chip->res_ExternalPalette_name, res_extpalette); SetWindowLong (hwnd, DWL_MSGRESULT, TRUE); return TRUE; } lib_free(palette_file); palette_file = NULL; resources_set_int(current_chip->res_ExternalPalette_name, res_extpalette); SetWindowLong(hwnd, DWL_MSGRESULT, FALSE); return TRUE; } return FALSE; case WM_INITDIALOG: init_advanced_dialog(hwnd, (Chip_Parameters*)((PROPSHEETPAGE*)lparam)->lParam); return TRUE; case WM_COMMAND: type = LOWORD(wparam); switch (type) { case IDC_TOGGLE_VIDEO_EXTPALETTE: res_extpalette = !res_extpalette; EnableWindow(GetDlgItem(hwnd, IDC_VIDEO_CUSTOM_BROWSE), res_extpalette); EnableWindow(GetDlgItem(hwnd, IDC_VIDEO_CUSTOM_NAME), res_extpalette); break; case IDC_VIDEO_COLORS_GAM: break; case IDC_VIDEO_CUSTOM_BROWSE: { TCHAR *st_name; if ((st_name = uilib_select_file(hwnd, translate_text(IDS_LOAD_VICE_PALETTE_FILE), UILIB_FILTER_ALL | UILIB_FILTER_PALETTE, UILIB_SELECTOR_TYPE_FILE_LOAD, UILIB_SELECTOR_STYLE_DEFAULT)) != NULL) { char *name; SetDlgItemText(hwnd, IDC_VIDEO_CUSTOM_NAME, st_name); name = system_wcstombs_alloc(st_name); update_palettename(name); system_wcstombs_free(name); res_extpalette = 1; CheckDlgButton(hwnd, IDC_TOGGLE_VIDEO_EXTPALETTE, BST_CHECKED); lib_free(st_name); } } break; case IDC_VIDEO_CUSTOM_NAME: { TCHAR st[100]; char s[100]; GetDlgItemText(hwnd, IDC_VIDEO_CUSTOM_NAME, st, 100); system_wcstombs(s, st, 100); update_palettename(s); res_extpalette = 1; CheckDlgButton(hwnd, IDC_TOGGLE_VIDEO_EXTPALETTE, BST_CHECKED); break; } } return TRUE; } return FALSE; }
/* Probably one should simply remove the size numbers from the IDM_* stuff */ static void vic20_ui_specific(WPARAM wparam, HWND hwnd) { TCHAR *st_name; switch (wparam) { case IDM_VIC20MODEL_SETTINGS: ui_vic20model_settings_dialog(hwnd); break; case IDM_CART_VIC20_GENERIC: uicart_attach_special(hwnd, translate_text(IDS_SELECT_GENERIC), UILIB_FILTER_ALL, CARTRIDGE_VIC20_GENERIC); break; case IDM_CART_VIC20_UM: uicart_attach_special(hwnd, translate_text(IDS_SELECT_UM), UILIB_FILTER_ALL, CARTRIDGE_VIC20_UM); break; case IDM_CART_VIC20_FP: uicart_attach_special(hwnd, translate_text(IDS_SELECT_FP), UILIB_FILTER_ALL, CARTRIDGE_VIC20_FP); break; case IDM_CART_VIC20_MEGACART: uicart_attach_special(hwnd, translate_text(IDS_SELECT_MEGACART), UILIB_FILTER_ALL, CARTRIDGE_VIC20_MEGACART); break; case IDM_CART_VIC20_FINAL_EXPANSION: uicart_attach_special(hwnd, translate_text(IDS_SELECT_FINAL_EXPANSION), UILIB_FILTER_ALL, CARTRIDGE_VIC20_FINAL_EXPANSION); break; case IDM_CART_SMART_ATTACH: uicart_attach_special(hwnd, translate_text(IDS_SELECT_CARTRIDGE_IMAGE), UILIB_FILTER_ALL, CARTRIDGE_VIC20_DETECT); break; case IDM_CART_VIC20_8KB_2000: case IDM_CART_VIC20_16KB_4000: case IDM_CART_VIC20_8KB_6000: case IDM_CART_VIC20_8KB_A000: case IDM_CART_VIC20_4KB_B000: uicart_attach(wparam, hwnd, vic20_ui_cartridges); break; case IDM_CART_SET_DEFAULT: cartridge_set_default(); break; case IDM_VIC_SETTINGS: ui_vic_settings_dialog(hwnd); break; case IDM_CART_DETACH: cartridge_detach_image(-1); break; case IDM_VIC20_SETTINGS: ui_vic20_settings_dialog(hwnd); break; case IDM_SIDCART_SETTINGS: ui_sidcart_settings_dialog(hwnd); break; case IDM_ACIA_SETTINGS: ui_acia_settings_dialog(hwnd); break; case IDM_GEORAM_SETTINGS: ui_georam_settings_dialog(hwnd); break; case IDM_DIGIMAX_SETTINGS: ui_digimax_settings_dialog(hwnd); break; case IDM_DS12C887RTC_SETTINGS: ui_ds12c887rtc_settings_dialog(hwnd); break; #ifdef HAVE_TFE case IDM_TFE_SETTINGS: ui_tfe_settings_dialog(hwnd); break; #endif case IDM_SFX_SE_SETTINGS: ui_soundexpander_settings_dialog(hwnd); break; case IDM_SFX_SS_SETTINGS: ui_soundsampler_settings_dialog(hwnd); break; #ifdef HAVE_MIDI case IDM_MIDI_SETTINGS: ui_midi_settings_dialog(hwnd); break; #endif case IDM_JOYPORT_SETTINGS: ui_joyport_settings_dialog(hwnd, 1, 0, 1, 1, 0); break; case IDM_JOY_SETTINGS: ui_joystick_settings_dialog(hwnd); break; case IDM_EXTRA_JOY_SETTINGS: ui_extra_joystick_settings_dialog(hwnd); break; case IDM_MOUSE_SETTINGS: ui_mouse_settings_dialog(hwnd, 1); break; case IDM_ROM_SETTINGS: uirom_settings_dialog(hwnd, IDD_VIC20ROM_SETTINGS_DIALOG, IDD_VIC20DRIVEROM_SETTINGS_DIALOG, uirom_settings, vic20_main_trans, vic20_drive_trans, vic20_generic_trans, vic20_main_left_group, vic20_main_middle_group, vic20_main_right_group, vic20_drive_left_group, vic20_drive_middle_group, vic20_drive_right_group); break; case IDM_VIDEO_SETTINGS: ui_video_settings_dialog(hwnd, UI_VIDEO_CHIP_VIC, UI_VIDEO_CHIP_NONE); break; case IDM_DRIVE_SETTINGS: uidrivevic20_settings_dialog(hwnd); break; case IDM_RS232USER_SETTINGS: ui_rs232user_settings_dialog(hwnd); break; case IDM_KEYBOARD_SETTINGS: uikeyboard_settings_dialog(hwnd, &uikeyboard_config); break; case IDM_MEGACART_WRITEBACK_FILE: if ((st_name = uilib_select_file(hwnd, translate_text(IDS_MI_MEGACART_WRITEBACK_FILE), UILIB_FILTER_ALL, UILIB_SELECTOR_TYPE_FILE_SAVE, UILIB_SELECTOR_STYLE_DEFAULT)) != NULL) { char *name; name = system_wcstombs_alloc(st_name); resources_set_string("MegaCartNvRAMfilename", name); system_wcstombs_free(name); lib_free(st_name); } break; case IDM_SAMPLER_SETTINGS: ui_sampler_settings_dialog(hwnd); break; case IDM_USERPORT_RTC_58321A_SETTINGS: ui_userport_rtc_58321a_settings_dialog(hwnd); break; case IDM_USERPORT_RTC_DS1307_SETTINGS: ui_userport_rtc_ds1307_settings_dialog(hwnd); break; } }
static void handle_wm_command(WPARAM wparam, LPARAM lparam, HWND hwnd) { TCHAR *st_name = NULL; char *name = NULL; int i; switch (wparam) { case IDM_LOAD_PSID_FILE: st_name = uilib_select_file(hwnd, translate_text(IDS_PSID_FILE), UILIB_FILTER_ALL, UILIB_SELECTOR_TYPE_FILE_LOAD, UILIB_SELECTOR_STYLE_DEFAULT); if (st_name != NULL) { name = system_wcstombs_alloc(st_name); if (machine_autodetect_psid(st_name) >= 0) { vsid_disp(0, 0, NULL, NULL); psid_init_driver(); vsid_ui_init(); machine_play_psid(0); for (i = 0; i < VSID_S_LASTLINE; i++) { *vsidstrings[i] = 0; } machine_trigger_reset(MACHINE_RESET_MODE_SOFT); songs = psid_tunes(&default_song); current_song = default_song; psid_ui_set_tune(uint_to_void_ptr(current_song), NULL); vsid_ui_display_tune_nr(current_song); vsid_ui_set_default_tune(default_song); vsid_ui_display_nr_of_tunes(songs); } system_wcstombs_free(name); lib_free(st_name); } break; case IDM_SELECT_TUNE: ui_select_vsid_tune(hwnd); break; case IDM_NEXT_TUNE: if (current_song < songs) { current_song++; psid_ui_set_tune(uint_to_void_ptr(current_song), NULL); vsid_ui_display_tune_nr(current_song); vsid_ui_set_default_tune(default_song); vsid_ui_display_nr_of_tunes(songs); } break; case IDM_PREVIOUS_TUNE: if (current_song > 1) { current_song--; psid_ui_set_tune(uint_to_void_ptr(current_song), NULL); vsid_ui_display_tune_nr(current_song); vsid_ui_set_default_tune(default_song); vsid_ui_display_nr_of_tunes(songs); } break; case IDM_RESET_HARD: machine_trigger_reset(MACHINE_RESET_MODE_HARD); break; case IDM_RESET_SOFT: machine_trigger_reset(MACHINE_RESET_MODE_SOFT); break; case IDM_MONITOR: monitor_startup_trap(); break; case IDM_EXIT: PostMessage(hwnd, WM_CLOSE, wparam, lparam); break; case IDM_SOUND_RECORD_START: ui_sound_record_settings_dialog(hwnd); break; case IDM_SOUND_RECORD_STOP: resources_set_string("SoundRecordDeviceName", ""); break; case IDM_MAXIMUM_SPEED_CUSTOM: ui_speed_settings_dialog(hwnd); break; case IDM_SOUND_SETTINGS: ui_sound_settings_dialog(hwnd); break; case IDM_SID_SETTINGS: ui_sid_settings_dialog(hwnd, c64_sid_baseaddress); break; case IDM_SETTINGS_SAVE_FILE: if ((st_name = uilib_select_file(hwnd, translate_text(IDS_SAVE_CONFIG_FILE), UILIB_FILTER_ALL, UILIB_SELECTOR_TYPE_FILE_SAVE, UILIB_SELECTOR_STYLE_DEFAULT)) != NULL) { char *name; name = system_wcstombs_alloc(st_name); if (resources_save(st_name) < 0) { ui_error(translate_text(IDS_CANNOT_SAVE_SETTINGS)); } else { ui_message(translate_text(IDS_SETTINGS_SAVED_SUCCESS)); } system_wcstombs_free(name); lib_free(st_name); } break; case IDM_SETTINGS_LOAD_FILE: if ((st_name = uilib_select_file(hwnd, translate_text(IDS_LOAD_CONFIG_FILE), UILIB_FILTER_ALL, UILIB_SELECTOR_TYPE_FILE_LOAD, UILIB_SELECTOR_STYLE_DEFAULT)) != NULL) { char *name; name = system_wcstombs_alloc(st_name); if (resources_load(st_name) < 0) { ui_error(translate_text(IDS_CANNOT_LOAD_SETTINGS)); } else { ui_message(translate_text(IDS_SETTINGS_LOADED_SUCCESS)); } system_wcstombs_free(name); lib_free(st_name); } break; case IDM_SETTINGS_SAVE: if (resources_save(NULL) < 0) { ui_error(translate_text(IDS_CANNOT_SAVE_SETTINGS)); } else { ui_message(translate_text(IDS_SETTINGS_SAVED_SUCCESS)); } break; case IDM_SETTINGS_LOAD: if (resources_load(NULL) < 0) { ui_error(translate_text(IDS_CANNOT_LOAD_SETTINGS)); } else { ui_message(translate_text(IDS_SETTINGS_LOADED_SUCCESS)); } break; case IDM_SETTINGS_DEFAULT: resources_set_defaults(); ui_message(translate_text(IDS_DEFAULT_SETTINGS_RESTORED)); break; case IDM_LANG_EN: case IDM_LANG_DA: case IDM_LANG_DE: case IDM_LANG_ES: case IDM_LANG_FR: case IDM_LANG_HU: case IDM_LANG_IT: case IDM_LANG_KO: case IDM_LANG_NL: case IDM_LANG_PL: case IDM_LANG_RU: case IDM_LANG_SV: case IDM_LANG_TR: ui_set_language((unsigned int)wparam); vsid_ui_translate(); break; case IDM_ABOUT: case IDM_HELP: case IDM_CONTRIBUTORS: case IDM_LICENSE: case IDM_WARRANTY: case IDM_CMDLINE: uihelp_dialog(hwnd, wparam); break; default: handle_default_command(wparam, lparam, hwnd); } }