Fix SA1 open bus
[lsnes.git] / src / core / dummygraphics.cpp
blob15768510a3b3cde1440a6799fcb59ff939123e2f
1 #include "core/window.hpp"
3 #include <cstdlib>
4 #include <iostream>
6 namespace
8 uint64_t next_message_to_print = 0;
9 bool is_dummy = true;
11 void dummy_init() throw()
13 platform::pausing_allowed = false;
16 void dummy_quit() throw()
20 void dummy_notify_message() throw()
22 //Read without lock becase we run in the same thread.
23 while(platform::msgbuf.get_msg_first() + platform::msgbuf.get_msg_count() > next_message_to_print) {
24 if(platform::msgbuf.get_msg_first() > next_message_to_print)
25 next_message_to_print = platform::msgbuf.get_msg_first();
26 else
27 std::cout << platform::msgbuf.get_message(next_message_to_print++) << std::endl;
31 void dummy_notify_status() throw()
35 void dummy_notify_screen() throw()
39 void dummy_error_message(const std::string& text) throw()
41 std::cerr << "Error message: " << text << std::endl;
44 void dummy_fatal_error() throw()
46 std::cerr << "Exiting on fatal error." << std::endl;
49 void dummy_action_updated()
53 void dummy_request_rom(rom_request& req)
55 throw std::runtime_error("Headless build does not support ROM requests");
58 const char* dummy_name() { return "Dummy graphics plugin"; }
60 struct _graphics_driver driver = {
61 .init = dummy_init,
62 .quit = dummy_quit,
63 .notify_message = dummy_notify_message,
64 .notify_status = dummy_notify_status,
65 .notify_screen = dummy_notify_screen,
66 .error_message = dummy_error_message,
67 .fatal_error = dummy_fatal_error,
68 .name = dummy_name,
69 .action_updated = dummy_action_updated,
70 .request_rom = dummy_request_rom
75 graphics_driver::graphics_driver(_graphics_driver drv)
77 driver = drv;
78 is_dummy = false;
81 bool graphics_driver_is_dummy()
83 return is_dummy;
86 void graphics_driver_init() throw()
88 driver.init();
91 void graphics_driver_quit() throw()
93 driver.quit();
96 void graphics_driver_notify_message() throw()
98 driver.notify_message();
101 void graphics_driver_notify_status() throw()
103 driver.notify_status();
106 void graphics_driver_notify_screen() throw()
108 driver.notify_screen();
111 void graphics_driver_error_message(const std::string& text) throw()
113 driver.error_message(text);
116 void graphics_driver_fatal_error() throw()
118 driver.fatal_error();
121 const char* graphics_driver_name()
123 return driver.name();
126 void graphics_driver_action_updated()
128 driver.action_updated();
131 void graphics_driver_request_rom(rom_request& req)
133 driver.request_rom(req);