wxwidgets: Hide dumper called "NULL"
[lsnes.git] / include / core / window.hpp
blob47fdedfab090f41750cabe2b6590e3ce3ebde360
1 #ifndef _window__hpp__included__
2 #define _window__hpp__included__
4 #include "interface/romtype.hpp"
5 #include "library/keyboard.hpp"
6 #include "library/messagebuffer.hpp"
7 #include "library/framebuffer.hpp"
8 #include <string>
9 #include <map>
10 #include <list>
11 #include <stdexcept>
13 class rom_request;
15 //Various methods corresponding to graphics_driver_*
16 struct _graphics_driver
18 void (*init)();
19 void (*quit)();
20 void (*notify_message)();
21 void (*error_message)(const std::string& text);
22 void (*fatal_error)();
23 const char* (*name)();
24 void (*request_rom)(rom_request& req);
27 struct graphics_driver
29 graphics_driver(_graphics_driver drv);
32 //Is dummy graphics plugin.
33 bool graphics_driver_is_dummy();
34 /**
35 * Graphics initialization function.
37 * - The first initialization function to be called by platform::init().
39 void graphics_driver_init() throw();
40 /**
41 * Graphics quit function.
43 * - The last quit function to be called by platform::quit().
45 void graphics_driver_quit() throw();
46 /**
47 * Notification when messages get updated.
49 void graphics_driver_notify_message() throw();
50 /**
51 * Show error message dialog when UI thread is free.
53 * Parameter text: The text for dialog.
55 void graphics_driver_error_message(const std::string& text) throw();
56 /**
57 * Displays fatal error message.
59 * - After this routine returns, the program will quit.
60 * - The call can occur in any thread.
62 void graphics_driver_fatal_error() throw();
63 /**
64 * Identification for graphics plugin.
66 const char* graphics_driver_name();
67 /**
68 * Request a ROM image.
70 void graphics_driver_request_rom(rom_request& req);
72 /**
73 * Platform-specific-related functions.
75 struct platform
77 /**
78 * Initialize the system.
80 static void init();
82 /**
83 * Shut down the system.
85 static void quit();
86 /**
87 * Get output stream printing into message queue.
89 * Note that lines printed there should be terminated by '\n'.
91 * Implemented by the generic window code.
93 * returns: The output stream.
94 * throws std::bad_alloc: Not enough memory.
96 static std::ostream& out() throw(std::bad_alloc);
97 /**
98 * Message buffer.
100 static messagebuffer msgbuf;
102 * Get message buffer lock.
104 static threads::lock& msgbuf_lock() throw();
106 * Adds a messages to mesage queue to be shown.
108 * Implemented by the generic window code.
110 * parameter msg: The messages to add (split by '\n').
111 * throws std::bad_alloc: Not enough memory.
113 static void message(const std::string& msg) throw(std::bad_alloc);
115 * Displays fatal error message, quitting after the user acks it (called by fatal_error()).
117 * Needs to be implemented by the graphics plugin.
119 static void fatal_error() throw();
121 * Enable or disable sound.
123 * Implemented by the generic window code.
125 * parameter enable: Enable sounds if true, otherwise disable sounds.
127 static void sound_enable(bool enable) throw();
129 * Are sounds enabled?
131 static bool is_sound_enabled() throw();
133 * Set sound device.
135 static void set_sound_device(const std::string& pdev, const std::string& rdev) throw();
137 * Set sound device by description.
139 static void set_sound_device_by_description(const std::string& pdev, const std::string& rdev) throw();
141 * Get sound device description.
143 static std::string get_sound_device_description(bool rec) throw(std::bad_alloc);
145 * Show error message dialog after UI thread becomes free.
147 * Parameter text: The text for dialog.
149 static void error_message(const std::string& text) throw()
151 return graphics_driver_error_message(text);
154 * Process command and keypress queues.
156 * - If emulating normally, this routine returns fast.
157 * - If emulator is in pause mode, this routine will block until emulator has left pause mode.
158 * - If emulator is in some special mode, this routine can block until said mode is left.
160 static void flush_command_queue() throw();
162 * Enable/Disable pause mode.
164 * - This function doesn't actually block. For actual paused blocking, use flush_command_queue().
166 * Parameter enable: Enable pause mode if true, disable pause mode if false.
168 static void set_paused(bool enable) throw();
170 * Wait specified number of milliseconds before returning.
172 * - The command and keypresses queues are processed while waiting.
174 * Parameter usec: The number of microseconds to wait.
176 static void wait(uint64_t usec) throw();
178 * Cause call to wait() to return immediately.
180 static void cancel_wait() throw();
182 * Notify received message.
184 static void notify_message() throw()
186 graphics_driver_notify_message();
189 * Set modal pause mode.
191 * - Modal pause works like ordinary pause, except it uses a separate flag.
193 * Parameter enable: If true, enable modal pause, else disable it.
195 static void set_modal_pause(bool enable) throw();
197 * Run all queues.
199 static void run_queues() throw();
201 static bool pausing_allowed;
202 static double global_volume;
203 static volatile bool do_exit_dummy_event_loop;
204 static void dummy_event_loop() throw();
205 static void exit_dummy_event_loop() throw();
208 class modal_pause_holder
210 public:
211 modal_pause_holder();
212 ~modal_pause_holder();
213 private:
214 modal_pause_holder(const modal_pause_holder&);
215 modal_pause_holder& operator=(const modal_pause_holder&);
219 * If set, queueing synchronous function produces a warning.
221 extern volatile bool queue_synchronous_fn_warning;
223 #endif