Lua: Fix type confusion between signed and unsigned
[lsnes.git] / include / core / framebuffer.hpp
blobcb7cc9538603baabbca67496687daf1a1b383955
1 #ifndef _framebuffer__hpp__included__
2 #define _framebuffer__hpp__included__
4 #include "core/window.hpp"
5 #include "core/queue.hpp"
6 #include "library/command.hpp"
7 #include "library/framebuffer.hpp"
8 #include "library/triplebuffer.hpp"
10 #include <stdexcept>
12 class subtitle_commentary;
13 class memwatch_set;
14 class emulator_dispatch;
15 class lua_state;
16 class loaded_rom;
17 class status_updater;
18 namespace settingvar
20 class group;
22 namespace keyboard
24 class keyboard;
27 /**
28 * Emulator frame buffer.
30 class emu_framebuffer
32 public:
33 emu_framebuffer(subtitle_commentary& _subtitles, settingvar::group& _settings, memwatch_set& _mwatch,
34 keyboard::keyboard& _keyboard, emulator_dispatch& _dispatch, lua_state& _lua2, loaded_rom& _rom,
35 status_updater& _supdater, command::group& _cmd, input_queue& _iqueue);
36 /**
37 * The main framebuffer.
39 framebuffer::raw main_framebuffer;
40 /**
41 * Special screen: "SYSTEM STATE CORRUPT".
43 static framebuffer::raw screen_corrupt;
44 /**
45 * The main screen to draw on.
47 framebuffer::fb<false> main_screen;
48 /**
49 * Initialize special screens.
51 * throws std::bad_alloc: Not enough memory.
53 static void init_special_screens() throw(std::bad_alloc);
54 /**
55 * Copy framebuffer to backing store, running Lua hooks if any.
57 void redraw_framebuffer(framebuffer::raw& torender, bool no_lua = false, bool spontaneous = false);
58 /**
59 * Redraw the framebuffer, reusing contents from last redraw. Runs lua hooks if last redraw ran them.
61 void redraw_framebuffer();
62 /**
63 * Return last complete framebuffer.
65 framebuffer::raw get_framebuffer() throw(std::bad_alloc);
66 /**
67 * Render framebuffer to main screen.
69 void render_framebuffer();
70 /**
71 * Get the size of current framebuffer.
73 std::pair<uint32_t, uint32_t> get_framebuffer_size();
74 /**
75 * Take a screenshot to specified file.
77 void take_screenshot(const std::string& file) throw(std::bad_alloc, std::runtime_error);
78 /**
79 * Kill pending requests associated with object.
81 void render_kill_request(void* obj);
82 /**
83 * Get latest screen received from core.
85 framebuffer::raw& render_get_latest_screen();
86 void render_get_latest_screen_end();
87 private:
88 void do_screenshot(command::arg_filename a);
89 struct render_info
91 framebuffer::raw fbuf;
92 framebuffer::queue rq;
93 uint32_t hscl;
94 uint32_t vscl;
95 uint32_t lgap;
96 uint32_t rgap;
97 uint32_t tgap;
98 uint32_t bgap;
100 render_info buffer1;
101 render_info buffer2;
102 render_info buffer3;
103 triplebuffer::triplebuffer<render_info> buffering;
104 bool last_redraw_no_lua;
105 subtitle_commentary& subtitles;
106 settingvar::group& settings;
107 memwatch_set& mwatch;
108 keyboard::keyboard& keyboard;
109 emulator_dispatch& edispatch;
110 lua_state& lua2;
111 loaded_rom& rom;
112 status_updater& supdater;
113 command::group& cmd;
114 input_queue& iqueue;
115 command::_fnptr<command::arg_filename> screenshot;
118 #endif