static UI_MENU_CALLBACK(custom_Speed_callback) { static char buf[20]; char *value = NULL; int previous, new_value; resources_get_int("Speed", &previous); if (activated) { sprintf(buf, "%i", previous); value = sdl_ui_text_input_dialog("Enter custom maximum speed", buf); if (value) { new_value = strtol(value, NULL, 0); if (new_value != previous) { resources_set_int("Speed", new_value); } lib_free(value); } } else { if (previous != 0 && previous != 10 && previous != 25 && previous != 50 && previous != 100 && previous != 200) { sprintf(buf, "%i%%", previous); return buf; } } return NULL; }
static INT_PTR CALLBACK superpet_io_dialog_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { int type; switch (msg) { case WM_NOTIFY: if (((NMHDR FAR *)lparam)->code == (UINT)PSN_APPLY) { resources_set_int("SuperPET", (IsDlgButtonChecked(hwnd, IDC_TOGGLE_PET_SUPER_IO_ENABLE) == BST_CHECKED ? 1 : 0)); SetWindowLongPtr(hwnd, DWLP_MSGRESULT, FALSE); return TRUE; } return FALSE; case WM_INITDIALOG: init_superpet_io_dialog(hwnd); return TRUE; case WM_COMMAND: type = LOWORD(wparam); switch (type) { case IDC_TOGGLE_PET_SUPER_IO_ENABLE: break; } return TRUE; } return FALSE; }
static UI_MENU_CALLBACK(custom_RefreshRate_callback) { static char buf[20]; char *value = NULL; int previous, new_value; resources_get_int("RefreshRate", &previous); if (activated) { sprintf(buf, "%i", previous); value = sdl_ui_text_input_dialog("Enter custom refresh rate", buf); if (value) { new_value = strtol(value, NULL, 0); if (new_value != previous) { resources_set_int("RefreshRate", new_value); } lib_free(value); } } else { if (previous > 5) { sprintf(buf, "1/%i", previous); return buf; } } return NULL; }
static UI_CALLBACK(datasette_settings) { int what = vice_ptr_to_int(UI_MENU_CB_PARAM); char *prompt, *title, *resource; char buf[50]; ui_button_t button; int current; long res; if (what) { prompt = title = _("Datasette speed tuning"); resource = "DatasetteSpeedTuning"; } else { prompt = title = _("Datasette zero gap delay"); resource = "DatasetteZeroGapDelay"; } resources_get_int(resource, ¤t); sprintf(buf, "%d", current); button = ui_input_string(title, prompt, buf, 50); switch (button) { case UI_BUTTON_OK: if (util_string_to_long(buf, NULL, 10, &res) != 0) { ui_error(_("Invalid value: %s"), buf); return; } resources_set_int(resource, (int)res); break; default: break; } }
static TUI_MENU_CALLBACK(set_joy_device_callback) { int port = (int)param >> 8; char *resource; switch (port) { case 1: default: resource = "JoyDevice1"; break; case 2: resource = "JoyDevice2"; break; case 3: resource = "JoyDevice3"; break; case 4: resource = "JoyDevice4"; break; } if (been_activated) { resources_set_int(resource, ((int)param & 0xff)); ui_update_menus(); } else { int value; resources_get_int(resource, &value); if (value == ((int)param & 0xff)) { *become_default = 1; } } return NULL; }
static int mem_read_rom_snapshot_module(snapshot_t *p) { BYTE vmajor, vminor; snapshot_module_t *m; BYTE config; int trapfl; m = snapshot_module_open(p, SNAP_ROM_MODULE_NAME, &vmajor, &vminor); if (m == NULL) { return 0; /* optional */ } if (vmajor != VIC20ROM_DUMP_VER_MAJOR) { snapshot_module_close(m); return -1; } /* disable traps before loading the ROM */ resources_get_int("VirtualDevices", &trapfl); resources_set_int("VirtualDevices", 0); /* old cart system ROMs (ignored) */ SMR_B(m, &config); /* read kernal */ SMR_BA(m, vic20memrom_kernal_rom, 0x2000); /* read basic */ SMR_BA(m, vic20memrom_basic_rom, 0x2000); SMR_BA(m, vic20memrom_chargen_rom, 0x1000); vic20rom_kernal_checksum(); vic20rom_basic_checksum(); log_warning(vic20_snapshot_log, "Dumped Romset files and saved settings will " "represent\nthe state before loading the snapshot!"); /* enable traps again when necessary */ resources_set_int("VirtualDevices", trapfl); snapshot_module_close(m); mem_initialize_memory(); return 0; }
int petmem_set_conf_info(petinfo_t *pi) { resources_set_int("RamSize", pi->ramSize); resources_set_int("IOSize", pi->IOSize); resources_set_int("Crtc", pi->crtc); resources_set_int("VideoSize", pi->video); resources_set_int("Ram9", pi->ramsel9); resources_set_int("RamA", pi->ramselA); resources_set_int("EoiBlank", pi->eoiblank); resources_set_int("SuperPET", pi->superpet); resources_set_int("KeyboardType", pi->kbd_type); return 0; }
static int expert_common_attach(void) { DBG(("EXPERT: common attach\n")); if (resources_set_int("ExpertCartridgeEnabled", 1) < 0) { return -1; } if (expert_enabled) { /* Set default mode here we want to load a previously saved image. we use ON as default here. */ resources_set_int("ExpertCartridgeMode", EXPERT_MODE_ON); DBG(("EXPERT: common attach ok\n")); return 0; } return -1; }
int expert_enable(void) { DBG(("EXPERT: enable\n")); if (resources_set_int("ExpertCartridgeEnabled", 1) < 0) { return -1; } return 0; }
int soundmovie_start(soundmovie_funcs_t *f) { funcs = f; resources_set_string("SoundRecordDeviceName", "soundmovie"); resources_set_int("Sound", 1); return 0; }
static void end_ds12c887rtc_dialog(HWND hwnd) { int *ui_ds12c887rtc_base; if (machine_class == VICE_MACHINE_VIC20) { ui_ds12c887rtc_base = ui_vic20_ds12c887rtc_base; } else if (machine_class == VICE_MACHINE_C128) { ui_ds12c887rtc_base = ui_c128_ds12c887rtc_base; } else { ui_ds12c887rtc_base = ui_c64_ds12c887rtc_base; } resources_set_int("DS12C887RTC", (IsDlgButtonChecked(hwnd, IDC_DS12C887RTC_ENABLE) == BST_CHECKED ? 1 : 0 )); resources_set_int("DS12C887RTCRunMode", (IsDlgButtonChecked(hwnd, IDC_DS12C887RTC_RUNMODE) == BST_CHECKED ? 1 : 0 )); resources_set_int("DS12C887RTCSave", (IsDlgButtonChecked(hwnd, IDC_DS12C887RTC_SAVE) == BST_CHECKED ? 1 : 0 )); resources_set_int("DS12C887RTCbase", ui_ds12c887rtc_base[SendMessage(GetDlgItem(hwnd, IDC_DS12C887RTC_BASE), CB_GETCURSEL, 0, 0)]); }
static INT_PTR CALLBACK memory_dialog_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { int type; switch (msg) { case WM_INITDIALOG: init_memory_dialog(hwnd); return TRUE; case WM_COMMAND: type = LOWORD(wparam); switch (type) { case IDC_SELECT_CBMII_MEM_128: resources_set_int("RamSize", 128); break; case IDC_SELECT_CBMII_MEM_256: resources_set_int("RamSize", 256); break; case IDC_SELECT_CBMII_MEM_512: resources_set_int("RamSize", 512); break; case IDC_SELECT_CBMII_MEM_1024: resources_set_int("RamSize", 1024); break; case IDC_TOGGLE_CBMII_RAM08: resources_toggle("Ram08", NULL); break; case IDC_TOGGLE_CBMII_RAM1: resources_toggle("Ram1", NULL); break; case IDC_TOGGLE_CBMII_RAM2: resources_toggle("Ram2", NULL); break; case IDC_TOGGLE_CBMII_RAM4: resources_toggle("Ram4", NULL); break; case IDC_TOGGLE_CBMII_RAM6: resources_toggle("Ram6", NULL); break; case IDC_TOGGLE_CBMII_RAMC: resources_toggle("RamC", NULL); break; } return TRUE; } return FALSE; }
static TUI_MENU_CALLBACK(radio_renderfilter_callback) { int i; int video_index; int render_index; int crtemu; int scale2x; i = (int)param; video_index = i >> 4; render_index = i & 0xf; if (been_activated) { switch (render_index) { default: case 0: crtemu = 0; scale2x = 0; break; case 1: crtemu = 1; scale2x = 0; break; case 2: crtemu = 0; scale2x = 1; break; } resources_set_int("PALEmulation", crtemu); if (video_item[video_index].scale2x_res != NULL) { resources_set_int(video_item[video_index].scale2x_res, scale2x); } *become_default = 1; } else { resources_get_int("PALEmulation", &crtemu); if (video_item[video_index].scale2x_res != NULL) { resources_get_int(video_item[video_index].scale2x_res, &scale2x); } else { scale2x = 0; } if (render_index == (crtemu * 2) + scale2x) { *become_default = 1; } } return NULL; }
static int set_video_standard(const char *param, void *extra_param) { int value = vice_ptr_to_int(extra_param); int vicii_model; resources_get_int("VICIIModel", &vicii_model); switch (value) { case MACHINE_SYNC_PAL: default: if (vicii_model == VICII_MODEL_8562 || vicii_model == VICII_MODEL_8565) { return resources_set_int("VICIIModel", VICII_MODEL_8565); } else if (vicii_model == VICII_MODEL_6567R56A) { return resources_set_int("VICIIModel", VICII_MODEL_6569R1); } else { return resources_set_int("VICIIModel", VICII_MODEL_6569); } break; case MACHINE_SYNC_NTSC: if (vicii_model == VICII_MODEL_8562 || vicii_model == VICII_MODEL_8565) { return resources_set_int("VICIIModel", VICII_MODEL_8562); } else { return resources_set_int("VICIIModel", VICII_MODEL_6567); } break; case MACHINE_SYNC_NTSCOLD: return resources_set_int("VICIIModel", VICII_MODEL_6567R56A); case MACHINE_SYNC_PALN: return resources_set_int("VICIIModel", VICII_MODEL_6572); } return 0; }
static INT_PTR CALLBACK dialog_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { int type; switch (msg) { case WM_INITDIALOG: init_dialog(hwnd); return TRUE; case WM_COMMAND: type = LOWORD(wparam); switch (type) { case IDC_SELECT_CBMII_610: cbm2_set_model("610", NULL); break; case IDC_SELECT_CBMII_620: cbm2_set_model("620", NULL); break; case IDC_SELECT_CBMII_620P: cbm2_set_model("620+", NULL); break; case IDC_SELECT_CBMII_710: cbm2_set_model("710", NULL); break; case IDC_SELECT_CBMII_720: cbm2_set_model("720", NULL); break; case IDC_SELECT_CBMII_720P: cbm2_set_model("720+", NULL); break; case IDC_SELECT_CBMII_HW0: resources_set_int("ModelLine", 0); break; case IDC_SELECT_CBMII_HW1: resources_set_int("ModelLine", 1); break; case IDC_SELECT_CBMII_HW2: resources_set_int("ModelLine", 2); break; } return TRUE; } return FALSE; }
static BOOL CALLBACK dialog_new_pal_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 == PSN_APPLY) { GetDlgItemText(hwnd, IDC_VIDEO_NEW_PAL_TINT, s, 100); _stscanf(s, TEXT("%f"), &tf); ival = (int)(tf * 1000.0 + 0.5); resources_set_int("ColorTint", ival); GetDlgItemText(hwnd, IDC_VIDEO_NEW_PAL_PHASE, s, 100); _stscanf(s, TEXT("%f"), &tf); ival = (int)(tf * 1000.0 + 0.5); resources_set_int("PALOddLinePhase", ival); GetDlgItemText(hwnd, IDC_VIDEO_NEW_PAL_OFFSET, s, 100); _stscanf(s, TEXT("%f"), &tf); ival = (int)(tf * 1000.0 + 0.5); resources_set_int("PALOddLineOffset", ival); querynewpalette = 1; SetWindowLong(hwnd, DWL_MSGRESULT, FALSE); return TRUE; } return FALSE; case WM_INITDIALOG: init_new_pal_dialog(hwnd); return TRUE; case WM_COMMAND: type = LOWORD(wparam); switch (type) { case IDC_VIDEO_NEW_PAL_TINT: case IDC_VIDEO_NEW_PAL_PHASE: case IDC_VIDEO_NEW_PAL_OFFSET: break; } return TRUE; } return FALSE; }
static BOOL CALLBACK dialog_color_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_SAT, s, 100); _stscanf(s, TEXT("%f"), &tf); ival = (int)(tf * 1000.0 + 0.5); resources_set_int("ColorSaturation", ival); GetDlgItemText(hwnd, IDC_VIDEO_COLORS_CON, s, 100); _stscanf(s, TEXT("%f"), &tf); ival = (int)(tf * 1000.0 + 0.5); resources_set_int("ColorContrast", ival); GetDlgItemText(hwnd, IDC_VIDEO_COLORS_BRI, s, 100); _stscanf(s, TEXT("%f"), &tf); ival = (int)(tf * 1000.0 + 0.5); resources_set_int("ColorBrightness", ival); querynewpalette = 1; SetWindowLong(hwnd, DWL_MSGRESULT, FALSE); return TRUE; } return FALSE; case WM_INITDIALOG: init_color_dialog(hwnd); return TRUE; case WM_COMMAND: type = LOWORD(wparam); switch (type) { case IDC_VIDEO_COLORS_SAT: case IDC_VIDEO_COLORS_CON: case IDC_VIDEO_COLORS_BRI: break; } return TRUE; } return FALSE; }
static void end_functionrom_dialog(HWND hwnd) { char name[MAX_PATH]; TCHAR st_name[MAX_PATH]; resources_set_int("InternalFunctionROM", (IsDlgButtonChecked(hwnd, IDC_C128_FUNCTIONROM_INTERNAL) == BST_CHECKED ? 1 : 0 )); GetDlgItemText(hwnd, IDC_C128_FUNCTIONROM_INTERNAL_NAME, st_name, MAX_PATH); system_wcstombs(name, st_name, MAX_PATH); resources_set_string("InternalFunctionName", name); resources_set_int("ExternalFunctionROM", (IsDlgButtonChecked(hwnd, IDC_C128_FUNCTIONROM_EXTERNAL) == BST_CHECKED ? 1 : 0 )); GetDlgItemText(hwnd, IDC_C128_FUNCTIONROM_EXTERNAL_NAME, st_name, MAX_PATH); system_wcstombs(name, st_name, MAX_PATH); resources_set_string("ExternalFunctionName", name); }
static void end_magicvoice_dialog(HWND hwnd) { TCHAR st[MAX_PATH]; char s[MAX_PATH]; resources_set_int("MagicVoiceCartridgeEnabled", (IsDlgButtonChecked(hwnd, IDC_MAGICVOICE_ENABLE) == BST_CHECKED ? 1 : 0 )); GetDlgItemText(hwnd, IDC_MAGICVOICE_FILE, st, MAX_PATH); system_wcstombs(s, st, MAX_PATH); resources_set_string("MagicVoiceImage", s); }
static void end_romset_dialog(HWND hwnd) { TCHAR st[MAX_PATH]; char s[MAX_PATH]; if (IsDlgButtonChecked(hwnd, IDC_ROMSET_SELECT_ARCHIVE) == BST_CHECKED) { resources_set_int("RomsetSourceFile", 0); } if (IsDlgButtonChecked(hwnd, IDC_ROMSET_SELECT_FILE) == BST_CHECKED) { resources_set_int("RomsetSourceFile", 1); } GetDlgItemText(hwnd, IDC_ROMSET_ARCHIVE_NAME, st, MAX_PATH); system_wcstombs(s, st, MAX_PATH); resources_set_string("RomsetArchiveName", s); GetDlgItemText(hwnd, IDC_ROMSET_FILE_NAME, st, MAX_PATH); system_wcstombs(s, st, MAX_PATH); resources_set_string("RomsetFileName", s); }
static void end_v364speech_dialog(HWND hwnd) { TCHAR st[MAX_PATH]; char s[MAX_PATH]; resources_set_int("SpeechEnabled", (IsDlgButtonChecked(hwnd, IDC_V364SPEECH_ENABLE) == BST_CHECKED ? 1 : 0 )); GetDlgItemText(hwnd, IDC_V364SPEECH_FILE, st, MAX_PATH); system_wcstombs(s, st, MAX_PATH); resources_set_string("SpeechImage", s); }
void cbm2model_set(int model) { int old_model; old_model = cbm2model_get(); if ((model == old_model) || (model == CBM2MODEL_UNKNOWN)) { return; } DBG(("cbm2model_set (%d)", model)); resources_set_int("ModelLine", cbm2models[model].line); resources_set_int("MachineVideoStandard", cbm2models[model].video); resources_set_int("RamSize", cbm2models[model].ramsize); resources_set_string("KernalName", cbm2models[model].kernalname); resources_set_string("BasicName", cbm2models[model].basicname); resources_set_string("ChargenName", cbm2models[model].chargenname); }
static int set_ram_size_plus4(int rs, void *param) { if ((rs != 64) && (rs != 32) && (rs != 16) && (rs != 256) && (rs != 1024) && (rs != 4096)) { return -1; } ram_size_plus4 = rs; if (ram_size_plus4 < 256) { resources_set_int("H256K", 0); resources_set_int("CS256K", 0); } vsync_suspend_speed_eval(); mem_initialize_memory(); machine_trigger_reset(MACHINE_RESET_MODE_HARD); return 0; }
static TUI_MENU_CALLBACK(set_common_memory_configuration_callback) { if (been_activated) { int blocks; switch ((int)param) { case MEM_NONE: blocks = 0; break; case MEM_ALL: blocks = BLOCK_0 | BLOCK_1 | BLOCK_2 | BLOCK_3 | BLOCK_5; break; case MEM_3K: blocks = BLOCK_0; break; case MEM_8K: blocks = BLOCK_1; break; case MEM_16K: blocks = BLOCK_1 | BLOCK_2; break; case MEM_24K: blocks = BLOCK_1 | BLOCK_2 | BLOCK_3; break; default: /* Shouldn't happen. */ log_debug("What?!"); blocks = 0; /* Make compiler happy. */ } resources_set_int("RamBlock0", blocks & BLOCK_0 ? 1 : 0); resources_set_int("RamBlock1", blocks & BLOCK_1 ? 1 : 0); resources_set_int("RamBlock2", blocks & BLOCK_2 ? 1 : 0); resources_set_int("RamBlock3", blocks & BLOCK_3 ? 1 : 0); resources_set_int("RamBlock5", blocks & BLOCK_5 ? 1 : 0); ui_update_menus(); } /* This way, the "Not Really!" item is always the default one. */ *become_default = 0; return NULL; }
static void c64_song_init() { /* Set default, potentially overridden by reset. */ resources_set_int("MachineVideoStandard", videomode_is_ntsc ? MACHINE_SYNC_NTSC : MACHINE_SYNC_PAL); /* Default to 6581 in case tune doesn't specify. */ resources_set_int("SidModel", sid); /* Reset C64, which also initializes PSID for us. */ machine_trigger_reset(MACHINE_RESET_MODE_SOFT); /* Now force video mode if we are asked to. */ if (videomode_is_forced) { resources_set_int("MachineVideoStandard", videomode_is_ntsc ? MACHINE_SYNC_NTSC : MACHINE_SYNC_PAL); } /* Force the SID model if told to in the settings */ if (sid_is_forced) { resources_set_int("SidModel", sid); } }
static UI_CALLBACK(set_joystick_device_4) { int tmp; if (!CHECK_MENUS) { resources_set_int("JoyDevice4", vice_ptr_to_int(UI_MENU_CB_PARAM)); ui_update_menus(); } else { resources_get_int("JoyDevice4", &tmp); ui_menu_set_tick(w, tmp == vice_ptr_to_int(UI_MENU_CB_PARAM)); } }
static void end_plus256k_dialog(HWND hwnd) { TCHAR st[MAX_PATH]; char s[MAX_PATH]; resources_set_int("PLUS256K", (IsDlgButtonChecked(hwnd, IDC_PLUS256K_ENABLE) == BST_CHECKED ? 1 : 0 )); GetDlgItemText(hwnd, IDC_PLUS256K_FILE, st, MAX_PATH); system_wcstombs(s, st, MAX_PATH); resources_set_string("PLUS256Kfilename", s); }
static void end_general_dialog(HWND hwnd) { int engine, model, temp; HWND sid_hwnd; resources_set_int("SidFilters", (IsDlgButtonChecked(hwnd, IDC_SID_FILTERS) == BST_CHECKED ? 1 : 0)); sid_hwnd = GetDlgItem(hwnd, IDC_SID_EXTRA_AMOUNT); resources_set_int("SidStereo", (int)SendMessage(sid_hwnd, CB_GETCURSEL, 0, 0)); sid_hwnd = GetDlgItem(hwnd, IDC_SID_STEREOADDRESS); CreateAndGetSidAddress(sid_hwnd, 1, (int)SendMessage(sid_hwnd, CB_GETCURSEL, 0, 0), "SidStereoAddressStart"); sid_hwnd = GetDlgItem(hwnd, IDC_SID_TRIPLEADDRESS); CreateAndGetSidAddress(sid_hwnd, 1, (int)SendMessage(sid_hwnd, CB_GETCURSEL, 0, 0), "SidTripleAddressStart"); temp = ui_sid_engine_model_list[SendDlgItemMessage(hwnd, IDC_SID_ENGINE_MODEL, CB_GETCURSEL, 0, 0)]->value; engine = temp >> 8; model = temp & 0xff; sid_set_engine_model(engine, model); }
/* unused ? */ static UI_CALLBACK(set_joystick_device) { vsync_suspend_speed_eval(); if (!CHECK_MENUS) { resources_set_int("JoyDevice1", vice_ptr_to_int(UI_MENU_CB_PARAM)); ui_update_menus(); } else { int tmp; resources_get_int("JoyDevice1", &tmp); ui_menu_set_tick(w, tmp == vice_ptr_to_int(UI_MENU_CB_PARAM)); } }
static UI_CALLBACK(toggle_DelayLoopEmulation) { int delayloopemulation; resources_get_int("PALEmulation", &delayloopemulation); if (!CHECK_MENUS) { resources_set_int("PALEmulation", !delayloopemulation); ui_update_menus(); } else { ui_menu_set_tick(w, delayloopemulation); } }