graphics_plugin:: -> graphics_driver_
This commit is contained in:
parent
41ca0a3051
commit
5efecc7041
4 changed files with 35 additions and 44 deletions
|
@ -47,38 +47,30 @@ struct keypress
|
||||||
short value;
|
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.
|
* Graphics initialization function.
|
||||||
*
|
*
|
||||||
* - The first initialization function to be called by platform::init().
|
* - The first initialization function to be called by platform::init().
|
||||||
*/
|
*/
|
||||||
static void init() throw();
|
void graphics_driver_init() throw();
|
||||||
/**
|
/**
|
||||||
* Graphics quit function.
|
* Graphics quit function.
|
||||||
*
|
*
|
||||||
* - The last quit function to be called by platform::quit().
|
* - The last quit function to be called by platform::quit().
|
||||||
*/
|
*/
|
||||||
static void quit() throw();
|
void graphics_driver_quit() throw();
|
||||||
/**
|
/**
|
||||||
* Notification when messages get updated.
|
* Notification when messages get updated.
|
||||||
*/
|
*/
|
||||||
static void notify_message() throw();
|
void graphics_driver_notify_message() throw();
|
||||||
/**
|
/**
|
||||||
* Notification when status gets updated.
|
* Notification when status gets updated.
|
||||||
*/
|
*/
|
||||||
static void notify_status() throw();
|
void graphics_driver_notify_status() throw();
|
||||||
/**
|
/**
|
||||||
* Notification when main screen gets updated.
|
* Notification when main screen gets updated.
|
||||||
*/
|
*/
|
||||||
static void notify_screen() throw();
|
void graphics_driver_notify_screen() throw();
|
||||||
/**
|
/**
|
||||||
* Show modal message dialog.
|
* Show modal message dialog.
|
||||||
*
|
*
|
||||||
|
@ -86,19 +78,18 @@ struct graphics_plugin
|
||||||
* Parameter confirm: If true, display confirmation dialog, if false, display notification dialog.
|
* Parameter confirm: If true, display confirmation dialog, if false, display notification dialog.
|
||||||
* Returns: True if confirmation dialog was confirmed, otherwise false.
|
* 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.
|
* Displays fatal error message.
|
||||||
*
|
*
|
||||||
* - After this routine returns, the program will quit.
|
* - After this routine returns, the program will quit.
|
||||||
* - The call can occur in any thread.
|
* - The call can occur in any thread.
|
||||||
*/
|
*/
|
||||||
static void fatal_error() throw();
|
void graphics_driver_fatal_error() throw();
|
||||||
/**
|
/**
|
||||||
* Identification for graphics plugin.
|
* Identification for graphics plugin.
|
||||||
*/
|
*/
|
||||||
static const char* name;
|
extern const char* graphics_driver_name;
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Platform-specific-related functions.
|
* Platform-specific-related functions.
|
||||||
|
@ -184,7 +175,7 @@ struct platform
|
||||||
*/
|
*/
|
||||||
static bool modal_message(const std::string& text, bool confirm = false) throw()
|
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.
|
* Process command and keypress queues.
|
||||||
|
@ -219,21 +210,21 @@ struct platform
|
||||||
*/
|
*/
|
||||||
static void notify_message() throw()
|
static void notify_message() throw()
|
||||||
{
|
{
|
||||||
graphics_plugin::notify_message();
|
graphics_driver_notify_message();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Notify changed status.
|
* Notify changed status.
|
||||||
*/
|
*/
|
||||||
static void notify_status() throw()
|
static void notify_status() throw()
|
||||||
{
|
{
|
||||||
graphics_plugin::notify_status();
|
graphics_driver_notify_status();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Notify changed screen.
|
* Notify changed screen.
|
||||||
*/
|
*/
|
||||||
static void notify_screen() throw()
|
static void notify_screen() throw()
|
||||||
{
|
{
|
||||||
graphics_plugin::notify_screen();
|
graphics_driver_notify_screen();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Set modal pause mode.
|
* Set modal pause mode.
|
||||||
|
|
|
@ -62,7 +62,7 @@ namespace
|
||||||
function_ptr_command<> identify_key(lsnes_cmd, "show-plugins", "Show plugins in use",
|
function_ptr_command<> identify_key(lsnes_cmd, "show-plugins", "Show plugins in use",
|
||||||
"Syntax: show-plugins\nShows plugins in use.\n",
|
"Syntax: show-plugins\nShows plugins in use.\n",
|
||||||
[]() throw(std::bad_alloc, std::runtime_error) {
|
[]() 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 << "Sound:\t" << audioapi_driver_name << std::endl;
|
||||||
messages << "Joystick:\t" << joystick_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 << "lsnes started at " << buffer << std::endl;
|
||||||
system_log << "-----------------------------------------------------------------------" << std::endl;
|
system_log << "-----------------------------------------------------------------------" << std::endl;
|
||||||
do_init_font();
|
do_init_font();
|
||||||
graphics_plugin::init();
|
graphics_driver_init();
|
||||||
audioapi_init();
|
audioapi_init();
|
||||||
audioapi_driver_init();
|
audioapi_driver_init();
|
||||||
joystick_driver_init();
|
joystick_driver_init();
|
||||||
|
@ -253,7 +253,7 @@ void platform::quit()
|
||||||
joystick_driver_quit();
|
joystick_driver_quit();
|
||||||
audioapi_driver_quit();
|
audioapi_driver_quit();
|
||||||
audioapi_quit();
|
audioapi_quit();
|
||||||
graphics_plugin::quit();
|
graphics_driver_quit();
|
||||||
msgbuf.unregister_handler(msg_callback_obj);
|
msgbuf.unregister_handler(msg_callback_obj);
|
||||||
time_t curtime = time(NULL);
|
time_t curtime = time(NULL);
|
||||||
struct tm* tm = localtime(&curtime);
|
struct tm* tm = localtime(&curtime);
|
||||||
|
@ -300,7 +300,7 @@ void platform::fatal_error() throw()
|
||||||
system_log << "lsnes paniced at " << buffer << std::endl;
|
system_log << "lsnes paniced at " << buffer << std::endl;
|
||||||
system_log << "-----------------------------------------------------------------------" << std::endl;
|
system_log << "-----------------------------------------------------------------------" << std::endl;
|
||||||
system_log.close();
|
system_log.close();
|
||||||
graphics_plugin::fatal_error();
|
graphics_driver_fatal_error();
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -565,12 +565,12 @@ namespace
|
||||||
|
|
||||||
void painter_listener::on_screen_update()
|
void painter_listener::on_screen_update()
|
||||||
{
|
{
|
||||||
graphics_plugin::notify_screen();
|
graphics_driver_notify_screen();
|
||||||
}
|
}
|
||||||
|
|
||||||
void painter_listener::on_status_update()
|
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)
|
our_screen->get_palette_b() == bshift)
|
||||||
return;
|
return;
|
||||||
our_screen->set_palette(rshift, gshift, bshift);
|
our_screen->set_palette(rshift, gshift, bshift);
|
||||||
graphics_plugin::notify_screen();
|
graphics_driver_notify_screen();
|
||||||
}
|
}
|
||||||
|
|
||||||
modal_pause_holder::modal_pause_holder()
|
modal_pause_holder::modal_pause_holder()
|
||||||
|
|
|
@ -10,16 +10,16 @@ namespace
|
||||||
uint64_t next_message_to_print = 0;
|
uint64_t next_message_to_print = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void graphics_plugin::init() throw()
|
void graphics_driver_init() throw()
|
||||||
{
|
{
|
||||||
platform::pausing_allowed = false;
|
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.
|
//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) {
|
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;
|
std::cerr << "Modal message: " << text << std::endl;
|
||||||
return confirm;
|
return confirm;
|
||||||
}
|
}
|
||||||
|
|
||||||
void graphics_plugin::fatal_error() throw()
|
void graphics_driver_fatal_error() throw()
|
||||||
{
|
{
|
||||||
std::cerr << "Exiting on fatal error." << std::endl;
|
std::cerr << "Exiting on fatal error." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* graphics_plugin::name = "Dummy graphics plugin";
|
const char* graphics_driver_name = "Dummy graphics plugin";
|
||||||
|
|
|
@ -371,12 +371,12 @@ void signal_resize_needed()
|
||||||
post_ui_event(UISERV_RESIZED);
|
post_ui_event(UISERV_RESIZED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void graphics_plugin::init() throw()
|
void graphics_driver_init() throw()
|
||||||
{
|
{
|
||||||
initialize_wx_keyboard();
|
initialize_wx_keyboard();
|
||||||
}
|
}
|
||||||
|
|
||||||
void graphics_plugin::quit() throw()
|
void graphics_driver_quit() throw()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -555,17 +555,17 @@ int lsnes_app::OnExit()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void graphics_plugin::notify_message() throw()
|
void graphics_driver_notify_message() throw()
|
||||||
{
|
{
|
||||||
post_ui_event(UISERV_UPDATE_MESSAGES);
|
post_ui_event(UISERV_UPDATE_MESSAGES);
|
||||||
}
|
}
|
||||||
|
|
||||||
void graphics_plugin::notify_status() throw()
|
void graphics_driver_notify_status() throw()
|
||||||
{
|
{
|
||||||
post_ui_event(UISERV_UPDATE_STATUS);
|
post_ui_event(UISERV_UPDATE_STATUS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void graphics_plugin::notify_screen() throw()
|
void graphics_driver_notify_screen() throw()
|
||||||
{
|
{
|
||||||
post_ui_event(UISERV_UPDATE_SCREEN);
|
post_ui_event(UISERV_UPDATE_SCREEN);
|
||||||
}
|
}
|
||||||
|
@ -575,7 +575,7 @@ void signal_core_change()
|
||||||
post_ui_event(UISERV_REFRESH_TITLE);
|
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);
|
umutex_class h(ui_mutex);
|
||||||
modal_dialog_active = true;
|
modal_dialog_active = true;
|
||||||
|
@ -587,7 +587,7 @@ bool graphics_plugin::modal_message(const std::string& text, bool confirm) throw
|
||||||
return modal_dialog_confirm;
|
return modal_dialog_confirm;
|
||||||
}
|
}
|
||||||
|
|
||||||
void graphics_plugin::fatal_error() throw()
|
void graphics_driver_fatal_error() throw()
|
||||||
{
|
{
|
||||||
//Fun: This can be called from any thread!
|
//Fun: This can be called from any thread!
|
||||||
if(ui_thread == this_thread_id()) {
|
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";
|
||||||
|
|
Loading…
Add table
Reference in a new issue