diff --git a/include/core/window.hpp b/include/core/window.hpp index ce15e673..9bf0ebc9 100644 --- a/include/core/window.hpp +++ b/include/core/window.hpp @@ -47,38 +47,30 @@ struct keypress short value; }; -/** - * Functions implemented by the graphics plugin. - * - * Unless explicitly noted otherwise, all the methods are to be called from emulation thread if that exists, otherwise - * from the main thread. - */ -struct graphics_plugin -{ /** * Graphics initialization function. * * - The first initialization function to be called by platform::init(). */ - static void init() throw(); +void graphics_driver_init() throw(); /** * Graphics quit function. * * - The last quit function to be called by platform::quit(). */ - static void quit() throw(); +void graphics_driver_quit() throw(); /** * Notification when messages get updated. */ - static void notify_message() throw(); +void graphics_driver_notify_message() throw(); /** * Notification when status gets updated. */ - static void notify_status() throw(); +void graphics_driver_notify_status() throw(); /** * Notification when main screen gets updated. */ - static void notify_screen() throw(); +void graphics_driver_notify_screen() throw(); /** * Show modal message dialog. * @@ -86,19 +78,18 @@ struct graphics_plugin * Parameter confirm: If true, display confirmation dialog, if false, display notification dialog. * Returns: True if confirmation dialog was confirmed, otherwise false. */ - static bool modal_message(const std::string& text, bool confirm = false) throw(); +bool graphics_driver_modal_message(const std::string& text, bool confirm = false) throw(); /** * Displays fatal error message. * * - After this routine returns, the program will quit. * - The call can occur in any thread. */ - static void fatal_error() throw(); +void graphics_driver_fatal_error() throw(); /** * Identification for graphics plugin. */ - static const char* name; -}; +extern const char* graphics_driver_name; /** * Platform-specific-related functions. @@ -184,7 +175,7 @@ struct platform */ static bool modal_message(const std::string& text, bool confirm = false) throw() { - return graphics_plugin::modal_message(text, confirm); + return graphics_driver_modal_message(text, confirm); } /** * Process command and keypress queues. @@ -219,21 +210,21 @@ struct platform */ static void notify_message() throw() { - graphics_plugin::notify_message(); + graphics_driver_notify_message(); } /** * Notify changed status. */ static void notify_status() throw() { - graphics_plugin::notify_status(); + graphics_driver_notify_status(); } /** * Notify changed screen. */ static void notify_screen() throw() { - graphics_plugin::notify_screen(); + graphics_driver_notify_screen(); } /** * Set modal pause mode. diff --git a/src/core/window.cpp b/src/core/window.cpp index cb8f6c56..fb2f9c72 100644 --- a/src/core/window.cpp +++ b/src/core/window.cpp @@ -62,7 +62,7 @@ namespace function_ptr_command<> identify_key(lsnes_cmd, "show-plugins", "Show plugins in use", "Syntax: show-plugins\nShows plugins in use.\n", []() throw(std::bad_alloc, std::runtime_error) { - messages << "Graphics:\t" << graphics_plugin::name << std::endl; + messages << "Graphics:\t" << graphics_driver_name << std::endl; messages << "Sound:\t" << audioapi_driver_name << std::endl; messages << "Joystick:\t" << joystick_driver_name << std::endl; }); @@ -242,7 +242,7 @@ void platform::init() system_log << "lsnes started at " << buffer << std::endl; system_log << "-----------------------------------------------------------------------" << std::endl; do_init_font(); - graphics_plugin::init(); + graphics_driver_init(); audioapi_init(); audioapi_driver_init(); joystick_driver_init(); @@ -253,7 +253,7 @@ void platform::quit() joystick_driver_quit(); audioapi_driver_quit(); audioapi_quit(); - graphics_plugin::quit(); + graphics_driver_quit(); msgbuf.unregister_handler(msg_callback_obj); time_t curtime = time(NULL); struct tm* tm = localtime(&curtime); @@ -300,7 +300,7 @@ void platform::fatal_error() throw() system_log << "lsnes paniced at " << buffer << std::endl; system_log << "-----------------------------------------------------------------------" << std::endl; system_log.close(); - graphics_plugin::fatal_error(); + graphics_driver_fatal_error(); exit(1); } @@ -565,12 +565,12 @@ namespace void painter_listener::on_screen_update() { - graphics_plugin::notify_screen(); + graphics_driver_notify_screen(); } void painter_listener::on_status_update() { - graphics_plugin::notify_status(); + graphics_driver_notify_status(); } } @@ -588,7 +588,7 @@ void platform::screen_set_palette(unsigned rshift, unsigned gshift, unsigned bsh our_screen->get_palette_b() == bshift) return; our_screen->set_palette(rshift, gshift, bshift); - graphics_plugin::notify_screen(); + graphics_driver_notify_screen(); } modal_pause_holder::modal_pause_holder() diff --git a/src/dummy/graphics.cpp b/src/dummy/graphics.cpp index 28dc5588..faa37c06 100644 --- a/src/dummy/graphics.cpp +++ b/src/dummy/graphics.cpp @@ -10,16 +10,16 @@ namespace uint64_t next_message_to_print = 0; } -void graphics_plugin::init() throw() +void graphics_driver_init() throw() { platform::pausing_allowed = false; } -void graphics_plugin::quit() throw() +void graphics_driver_quit() throw() { } -void graphics_plugin::notify_message() throw() +void graphics_driver_notify_message() throw() { //Read without lock becase we run in the same thread. while(platform::msgbuf.get_msg_first() + platform::msgbuf.get_msg_count() > next_message_to_print) { @@ -30,23 +30,23 @@ void graphics_plugin::notify_message() throw() } } -void graphics_plugin::notify_status() throw() +void graphics_driver_notify_status() throw() { } -void graphics_plugin::notify_screen() throw() +void graphics_driver_notify_screen() throw() { } -bool graphics_plugin::modal_message(const std::string& text, bool confirm) throw() +bool graphics_driver_modal_message(const std::string& text, bool confirm) throw() { std::cerr << "Modal message: " << text << std::endl; return confirm; } -void graphics_plugin::fatal_error() throw() +void graphics_driver_fatal_error() throw() { std::cerr << "Exiting on fatal error." << std::endl; } -const char* graphics_plugin::name = "Dummy graphics plugin"; +const char* graphics_driver_name = "Dummy graphics plugin"; diff --git a/src/platform/wxwidgets/main.cpp b/src/platform/wxwidgets/main.cpp index 72b1f929..b21e49b9 100644 --- a/src/platform/wxwidgets/main.cpp +++ b/src/platform/wxwidgets/main.cpp @@ -371,12 +371,12 @@ void signal_resize_needed() post_ui_event(UISERV_RESIZED); } -void graphics_plugin::init() throw() +void graphics_driver_init() throw() { initialize_wx_keyboard(); } -void graphics_plugin::quit() throw() +void graphics_driver_quit() throw() { } @@ -555,17 +555,17 @@ int lsnes_app::OnExit() return 0; } -void graphics_plugin::notify_message() throw() +void graphics_driver_notify_message() throw() { post_ui_event(UISERV_UPDATE_MESSAGES); } -void graphics_plugin::notify_status() throw() +void graphics_driver_notify_status() throw() { post_ui_event(UISERV_UPDATE_STATUS); } -void graphics_plugin::notify_screen() throw() +void graphics_driver_notify_screen() throw() { post_ui_event(UISERV_UPDATE_SCREEN); } @@ -575,7 +575,7 @@ void signal_core_change() post_ui_event(UISERV_REFRESH_TITLE); } -bool graphics_plugin::modal_message(const std::string& text, bool confirm) throw() +bool graphics_driver_modal_message(const std::string& text, bool confirm) throw() { umutex_class h(ui_mutex); modal_dialog_active = true; @@ -587,7 +587,7 @@ bool graphics_plugin::modal_message(const std::string& text, bool confirm) throw return modal_dialog_confirm; } -void graphics_plugin::fatal_error() throw() +void graphics_driver_fatal_error() throw() { //Fun: This can be called from any thread! if(ui_thread == this_thread_id()) { @@ -687,4 +687,4 @@ void show_message_ok(wxWindow* parent, const std::string& title, const std::stri } -const char* graphics_plugin::name = "wxwidgets graphics plugin"; +const char* graphics_driver_name = "wxwidgets graphics plugin";