void sdl_window_info::modify_prescale(int dir) { worker_param wp = worker_param(this); int new_prescale = prescale(); if (dir > 0 && prescale() < 3) new_prescale = prescale() + 1; if (dir < 0 && prescale() > 1) new_prescale = prescale() - 1; if (new_prescale != prescale()) { if (m_fullscreen && video_config.switchres) { execute_async_wait(&sdlwindow_video_window_destroy_wt, wp); m_prescale = new_prescale; execute_async_wait(&complete_create_wt, wp); } else { notify_changed(); m_prescale = new_prescale; } machine().ui().popup_time(1, "Prescale %d", prescale()); } }
void sdl_window_info::modify_prescale(int dir) { int new_prescale = prescale(); if (dir > 0 && prescale() < 3) new_prescale = prescale() + 1; if (dir < 0 && prescale() > 1) new_prescale = prescale() - 1; if (new_prescale != prescale()) { if (m_fullscreen && video_config.switchres) { auto wp = std::make_unique<worker_param>(std::static_pointer_cast<sdl_window_info>(shared_from_this())); execute_async_wait(&sdlwindow_video_window_destroy_wt, std::move(wp)); m_prescale = new_prescale; wp = std::make_unique<worker_param>(std::static_pointer_cast<sdl_window_info>(shared_from_this())); execute_async_wait(&complete_create_wt, std::move(wp)); } else { notify_changed(); m_prescale = new_prescale; } machine().ui().popup_time(1, "Prescale %d", prescale()); } }
static void sdlwindow_modify_yuv(running_machine *machine, sdl_window_info *window, int dir) { int new_scale_mode = window->scale_mode; worker_param wp; const char *stemp; if (dir > 0) new_scale_mode = window->scale_mode + 1; if (dir < 0) new_scale_mode = window->scale_mode - 1; stemp = drawsdl_scale_mode_str(new_scale_mode); if (stemp==NULL) return; clear_worker_param(&wp); wp.window = window; wp.machine = machine; sdlwindow_sync(); execute_async_wait(&sdlwindow_video_window_destroy_wt, &wp); window->scale_mode = new_scale_mode; ui_popup_time(1, "Scale mode %s", stemp); mame_printf_verbose("Scale mode %s\n", stemp); sdlwindow_sync(); execute_async_wait(&complete_create_wt, &wp); sdlwindow_sync(); }
void sdlwindow_modify_prescale(running_machine &machine, sdl_window_info *window, int dir) { worker_param wp; int new_prescale = window->prescale; clear_worker_param(&wp); wp.window = window; wp.m_machine = &machine; if (dir > 0 && window->prescale < 3) new_prescale = window->prescale + 1; if (dir < 0 && window->prescale > 1) new_prescale = window->prescale - 1; if (new_prescale != window->prescale) { if (window->fullscreen && video_config.switchres) { execute_async_wait(&sdlwindow_video_window_destroy_wt, &wp); window->prescale = new_prescale; execute_async_wait(&complete_create_wt, &wp); } else { execute_async_wait(destroy_all_textures_wt, &wp); window->prescale = new_prescale; } ui_popup_time(1, "Prescale %d", window->prescale); } }
void sdl_window_info::window_changeres(running_machine &machine) { #if (SDLMAME_SDL2) if (this->fullscreen() && video_config.switchres) { execute_async_wait(&sdlwindow_video_window_destroy_wt, worker_param(this)); SDL_QuitSubSystem(SDL_INIT_VIDEO); SDL_InitSubSystem(SDL_INIT_VIDEO); execute_async_wait(&complete_create_wt, worker_param(this)); } #else if (this->fullscreen() && video_config.switchres) this->window_resize(window->minwidth, window->minheight); #endif }
void sdlwindow_modify_effect(running_machine *machine, sdl_window_info *window, int dir) { if (video_config.mode == VIDEO_MODE_SOFT) { sdlwindow_modify_yuv(machine, window, dir); return; } else if (USE_OPENGL) { int new_prescale_effect = window->prescale_effect; const char *effect_names[] = { "none", "scale2x" }; if (dir > 0 && window->prescale_effect < 1) new_prescale_effect = window->prescale_effect + 1; if (dir < 0 && window->prescale_effect > 0) new_prescale_effect = window->prescale_effect - 1; if (new_prescale_effect != window->prescale_effect) { worker_param wp; clear_worker_param(&wp); wp.window = window; execute_async_wait(destroy_all_textures_wt, &wp); window->prescale_effect = new_prescale_effect; ui_popup_time(1, "Effect: %s", effect_names[window->prescale_effect]); } } }
void sdl_window_info::destroy() { sdl_window_info **prevptr; ASSERT_MAIN_THREAD(); if (multithreading_enabled) { sdlwindow_sync(); } //osd_event_wait(window->rendered_event, osd_ticks_per_second()*10); // remove us from the list for (prevptr = &sdl_window_list; *prevptr != NULL; prevptr = &(*prevptr)->m_next) if (*prevptr == this) { *prevptr = this->m_next; break; } // free the textures etc execute_async_wait(&sdlwindow_video_window_destroy_wt, worker_param(this)); // free the render target, after the textures! this->machine().render().target_free(m_target); // free the event osd_event_free(m_rendered_event); // free the lock osd_lock_free(this->m_render_lock); }
static void sdlwindow_exit(running_machine &machine) { ASSERT_MAIN_THREAD(); mame_printf_verbose("Enter sdlwindow_exit\n"); // free all the windows while (sdl_window_list != NULL) { sdl_window_info *temp = sdl_window_list; sdl_window_list = temp->next; sdlwindow_video_window_destroy(machine, temp); } // if we're multithreaded, clean up the window thread if (multithreading_enabled) { sdlwindow_sync(); } // kill the drawers (*draw.exit)(); execute_async_wait(&sdlwindow_exit_wt, NULL); if (multithreading_enabled) { osd_work_queue_wait(work_queue, 1000000); osd_work_queue_free(work_queue); } mame_printf_verbose("Leave sdlwindow_exit\n"); }
void sdl_window_info::resize(INT32 width, INT32 height) { ASSERT_MAIN_THREAD(); osd_dim cd = get_size(); if (width != cd.width() || height != cd.height()) execute_async_wait(&sdlwindow_resize_wt, worker_param(this, width, height)); }
void sdl_window_info::notify_changed() { auto wp = std::make_unique<worker_param>(std::static_pointer_cast<sdl_window_info>(shared_from_this())); if (SDL_ThreadID() == main_threadid) { execute_async_wait(¬ify_changed_wt, std::move(wp)); } else execute_sync(¬ify_changed_wt, std::move(wp)); }
void sdl_window_info::notify_changed() { worker_param wp; if (SDL_ThreadID() == main_threadid) { execute_async_wait(¬ify_changed_wt, worker_param(this)); } else execute_sync(¬ify_changed_wt, worker_param(this)); }
void sdlwindow_toggle_full_screen(running_machine &machine, sdl_window_info *window) { worker_param wp; ASSERT_MAIN_THREAD(); clear_worker_param(&wp); wp.window = window; wp.m_machine = &machine; execute_async_wait(&sdlwindow_toggle_full_screen_wt, &wp); }
void sdl_window_info::resize(INT32 width, INT32 height) { ASSERT_MAIN_THREAD(); osd_dim cd = get_size(); if (width != cd.width() || height != cd.height()) { auto wp = std::make_unique<worker_param>(std::static_pointer_cast<sdl_window_info>(shared_from_this()), width, height); execute_async_wait(&sdlwindow_resize_wt, std::move(wp)); } }
void sdlwindow_toggle_draw(running_machine *machine, sdl_window_info *window) { #if USE_OPENGL //FIXME: Not yet working in 1.3 #if (!SDL_VERSION_ATLEAST(1,3,0)) worker_param wp; // If we are not fullscreen (windowed) remember our windowed size if (!window->fullscreen) { window->windowed_width = window->width; window->windowed_height = window->height; } clear_worker_param(&wp); wp.window = window; wp.machine = machine; execute_async_wait(&sdlwindow_video_window_destroy_wt, &wp); window->scale_mode = VIDEO_SCALE_MODE_NONE; if (video_config.mode == VIDEO_MODE_OPENGL) { video_config.mode = VIDEO_MODE_SOFT; drawsdl_init(&draw); ui_popup_time(1, "Using software rendering"); } else { video_config.mode = VIDEO_MODE_OPENGL; drawogl_init(&draw); ui_popup_time(1, "Using OpenGL rendering"); } execute_async_wait(&complete_create_wt, &wp); #endif #endif }
void sdlwindow_clear(sdl_window_info *window) { worker_param *wp = (worker_param *) osd_malloc(sizeof(worker_param)); clear_worker_param(wp); wp->window = window; if (SDL_ThreadID() == main_threadid) { execute_async_wait(&sdlwindow_clear_surface_wt, wp); osd_free(wp); } else sdlwindow_clear_surface_wt( (void *) wp, 0); }
void sdlwindow_resize(sdl_window_info *window, INT32 width, INT32 height) { worker_param wp; ASSERT_MAIN_THREAD(); if (width == window->width && height == window->height) return; clear_worker_param(&wp); wp.resize_new_width = width; wp.resize_new_height = height; wp.window = window; execute_async_wait(&sdlwindow_resize_wt, &wp); }
void sdl_window_info::destroy() { ASSERT_MAIN_THREAD(); //osd_event_wait(window->rendered_event, osd_ticks_per_second()*10); // remove us from the list sdl_window_list.remove(std::static_pointer_cast<sdl_window_info>(shared_from_this())); // free the textures etc auto wp = std::make_unique<worker_param>(std::static_pointer_cast<sdl_window_info>(shared_from_this())); execute_async_wait(&sdlwindow_video_window_destroy_wt, std::move(wp)); // free the render target, after the textures! this->machine().render().target_free(m_target); }
void sdl_osd_interface::window_exit() { std::unique_ptr<worker_param> wp_dummy(nullptr); ASSERT_MAIN_THREAD(); osd_printf_verbose("Enter sdlwindow_exit\n"); // free all the windows while (!sdl_window_list.empty()) { auto window = sdl_window_list.front(); // Part of destroy removes the window from the list window->destroy(); } switch(video_config.mode) { case VIDEO_MODE_SDL2ACCEL: renderer_sdl1::exit(); break; case VIDEO_MODE_SOFT: renderer_sdl1::exit(); break; case VIDEO_MODE_BGFX: renderer_bgfx::exit(); break; #if (USE_OPENGL) case VIDEO_MODE_OPENGL: renderer_ogl::exit(); break; #endif default: break; } execute_async_wait(&sdlwindow_exit_wt, std::move(wp_dummy)); osd_printf_verbose("Leave sdlwindow_exit\n"); }
static void sdlwindow_video_window_destroy(running_machine *machine, sdl_window_info *window) { sdl_window_info **prevptr; worker_param wp; ASSERT_MAIN_THREAD(); if (multithreading_enabled) { sdlwindow_sync(); } //osd_event_wait(window->rendered_event, osd_ticks_per_second()*10); // remove us from the list for (prevptr = &sdl_window_list; *prevptr != NULL; prevptr = &(*prevptr)->next) if (*prevptr == window) { *prevptr = window->next; break; } // free the textures etc clear_worker_param(&wp); wp.window = window; wp.machine = machine; execute_async_wait(&sdlwindow_video_window_destroy_wt, &wp); // free the render target, after the textures! if (window->target != NULL) render_target_free(window->target); // free the event osd_event_free(window->rendered_event); // free the window itself global_free(window); }
void sdl_osd_interface::window_exit() { worker_param wp_dummy; ASSERT_MAIN_THREAD(); osd_printf_verbose("Enter sdlwindow_exit\n"); // free all the windows while (sdl_window_list != NULL) { sdl_window_info *temp = sdl_window_list; sdl_window_list = temp->m_next; temp->destroy(); // free the window itself global_free(temp); } // if we're multithreaded, clean up the window thread if (multithreading_enabled) { sdlwindow_sync(); } // kill the drawers (*draw.exit)(); execute_async_wait(&sdlwindow_exit_wt, wp_dummy); if (multithreading_enabled) { osd_work_queue_wait(work_queue, 1000000); osd_work_queue_free(work_queue); } osd_printf_verbose("Leave sdlwindow_exit\n"); }
void sdl_window_info::toggle_full_screen() { ASSERT_MAIN_THREAD(); auto wp = std::make_unique<worker_param>(std::static_pointer_cast<sdl_window_info>(shared_from_this())); execute_async_wait(&sdlwindow_toggle_full_screen_wt, std::move(wp)); }
void sdl_window_info::toggle_full_screen() { ASSERT_MAIN_THREAD(); execute_async_wait(&sdlwindow_toggle_full_screen_wt, worker_param(this)); }