/** * vlopt_window_callback_response(): Dialog Response callback. * @param dialog * @param response_id * @param user_data */ static void vlopt_window_callback_response(GtkDialog *dialog, gint response_id, gpointer user_data) { MDP_UNUSED_PARAMETER(dialog); MDP_UNUSED_PARAMETER(user_data); int rval; switch (response_id) { case VLOPT_RESPONSE_RESET: // Reset the VDP layer options to the default value. rval = vlopt_host_srv->val_set(&mdp, MDP_VAL_VDP_LAYER_OPTIONS, MDP_VDP_LAYER_OPTIONS_DEFAULT); if (rval != MDP_ERR_OK) { fprintf(stderr, "%s(): Error setting MDP_VAL_VDP_LAYER_OPTIONS: 0x%08X\n", __func__, rval); } // Reload the VDP layer options. vlopt_window_load_options(); break; case GTK_RESPONSE_CLOSE: // Close. vlopt_window_close(); break; default: // Unknown response ID. break; } }
/** * vlopt_window_callback_checkbox_toggled(): A checkbox was toggled. */ static void vlopt_window_callback_checkbox_toggled(GtkToggleButton *togglebutton, gpointer user_data) { MDP_UNUSED_PARAMETER(togglebutton); MDP_UNUSED_PARAMETER(user_data); // Save the current layer options. vlopt_window_save_options(); }
/** * vlopt_window_callback_close(): Close Window callback. * @param widget * @param event * @param user_data * @return FALSE to continue processing events; TRUE to stop processing events. */ static gboolean vlopt_window_callback_close(GtkWidget *widget, GdkEvent *event, gpointer user_data) { MDP_UNUSED_PARAMETER(widget); MDP_UNUSED_PARAMETER(event); MDP_UNUSED_PARAMETER(user_data); vlopt_window_close(); return FALSE; }
/** * DllMain(): Win32 DLL startup function. * @param hinstDLL hInstnace of the DLL. * @param fdwReason * @param lpReserved * @return TRUE on success; FALSE on failure. */ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) { MDP_UNUSED_PARAMETER(lpReserved); if (fdwReason == DLL_PROCESS_ATTACH) sgens_hInstance = hinstDLL; return TRUE; }
/** * vdpdbg_window_callback_response(): Dialog Response callback. * @param dialog * @param response_id * @param user_data */ static void vdpdbg_window_callback_response(GtkDialog *dialog, gint response_id, gpointer user_data) { MDP_UNUSED_PARAMETER(dialog); MDP_UNUSED_PARAMETER(user_data); switch (response_id) { case GTK_RESPONSE_CLOSE: // Close. vdpdbg_window_close(); break; case GTK_RESPONSE_DELETE_EVENT: default: // Other response ID. Don't do anything. // Also, don't do anything when the dialog is deleted. break; } }
/** * ntsc_event_handler(): Event handler function. * @param event_id Event ID. * @param event_info Event information. * @return MDP error code. */ static int MDP_FNCALL ntsc_event_handler(int event_id, void *event_info) { MDP_UNUSED_PARAMETER(event_info); int i, val; char buf[128]; switch (event_id) { case MDP_EVENT_LOAD_CONFIG: // Load NTSC configuration. // Check for presets. ntsc_host_srv->config_get(&mdp, "_Preset", NULL, buf, sizeof(buf)); for (i = 0; i < NTSC_PRESETS_COUNT; i++) { if (!ntsc_presets[i].setup) { // "Custom". This is the last item in the predefined list. // Since the current setup doesn't match anything else, // it must be a custom setup. break; } else { // Check if this preset matches the current setup. if (!strncasecmp(buf, ntsc_presets[i].name, sizeof(buf))) { // Match found! memcpy(&mdp_md_ntsc_setup, ntsc_presets[i].setup, sizeof(mdp_md_ntsc_setup)); break; } } } // If "Custom", load customized values. if (i != NTSC_PRESETS_COUNT) { for (i = 0; i < NTSC_CTRL_COUNT; i++) { ntsc_host_srv->config_get(&mdp, ntsc_controls[i].name, NULL, buf, sizeof(buf)); if (buf[0] == 0x00) { // Empty value. Use "Composite" preset. mdp_md_ntsc_setup.params[i] = md_ntsc_composite.params[i]; } else { // Non-empty value. Convert it to an integer. errno = 0; val = strtol(buf, NULL, 0); if (errno != 0) { // Error occurred while converting the number. // Use the default value. ("Composite" preset.) mdp_md_ntsc_setup.params[i] = md_ntsc_composite.params[i]; } else { // Number converted. // Convert it to an internal NTSC value. mdp_md_ntsc_setup.params[i] = ntsc_display_to_internal(i, val); } } } } // Effects. mdp_md_ntsc_effects = 0; // Scanlines. ntsc_host_srv->config_get(&mdp, "_Scanlines", "1", buf, sizeof(buf)); if (buf[0]) { errno = 0; val = strtol(buf, NULL, 0); if (errno != 0) val = 1; } else val = 1; if (val) mdp_md_ntsc_effects |= MDP_MD_NTSC_EFFECT_SCANLINE; // Interpolation. ntsc_host_srv->config_get(&mdp, "_Interpolation", "1", buf, sizeof(buf)); if (buf[0]) { errno = 0; val = strtol(buf, NULL, 0); if (errno != 0) val = 1; } else val = 1; if (val) mdp_md_ntsc_effects |= MDP_MD_NTSC_EFFECT_INTERP; // Sony CXA2025AS US decoder matrix. ntsc_host_srv->config_get(&mdp, "_Sony_CXA2025AS_US", "0", buf, sizeof(buf)); if (buf[0]) { errno = 0; val = strtol(buf, NULL, 0); if (errno != 0) val = 0; } else val = 0; if (val) mdp_md_ntsc_effects |= MDP_MD_NTSC_EFFECT_CXA2025AS; // Reinitialize the NTSC settings. mdp_md_ntsc_reinit_setup(); ntsc_window_load_settings(); break; case MDP_EVENT_SAVE_CONFIG: // Save NTSC configuration. // Check if the current configuration is a preset. for (i = 0; i < NTSC_PRESETS_COUNT; i++) { if (!ntsc_presets[i].setup) { // "Custom". This is the last item in the predefined list. // Since the current setup doesn't match anything else, // it must be a custom setup. ntsc_host_srv->config_set(&mdp, "_Preset", ntsc_presets[i].name); break; } else { // Check if this preset matches the current setup. if (!memcmp(&mdp_md_ntsc_setup, ntsc_presets[i].setup, sizeof(mdp_md_ntsc_setup))) { // Match found! ntsc_host_srv->config_set(&mdp, "_Preset", ntsc_presets[i].name); break; } } } // Save individual values. for (i = 0; i < NTSC_CTRL_COUNT; i++) { szprintf(buf, sizeof(buf), "%d", ntsc_internal_to_display(i, mdp_md_ntsc_setup.params[i])); ntsc_host_srv->config_set(&mdp, ntsc_controls[i].name, buf); } // Scanlines. buf[1] = 0x00; buf[0] = ((mdp_md_ntsc_effects & MDP_MD_NTSC_EFFECT_SCANLINE) ? '1' : '0'); ntsc_host_srv->config_set(&mdp, "_Scanlines", buf); // Interpolation. buf[0] = ((mdp_md_ntsc_effects & MDP_MD_NTSC_EFFECT_INTERP) ? '1' : '0'); ntsc_host_srv->config_set(&mdp, "_Interpolation", buf); // Sony CXA2025AS US decoder matrix. buf[0] = ((mdp_md_ntsc_effects & MDP_MD_NTSC_EFFECT_CXA2025AS) ? '1' : '0'); ntsc_host_srv->config_set(&mdp, "_Sony_CXA2025AS_US", buf); break; default: // Unhandled event. return -MDP_ERR_EVENT_NOT_REGISTERED; } return MDP_ERR_OK; }