Fix zero luma corner case
[lsnes.git] / src / plat-wxwidgets / main.cpp
blob1ad4f97aa46afa165adf935f2822639e74877aaf
1 #include "lsnes.hpp"
2 #include <snes/snes.hpp>
3 #include <ui-libsnes/libsnes.hpp>
5 #include "core/dispatch.hpp"
6 #include "core/framerate.hpp"
7 #include "core/lua.hpp"
8 #include "core/misc.hpp"
9 #include "core/rom.hpp"
10 #include "core/rrdata.hpp"
11 #include "core/window.hpp"
12 #include "core/zip.hpp"
14 #include "plat-wxwidgets/messages_window.hpp"
15 #include "plat-wxwidgets/rom_select_window.hpp"
16 #include "plat-wxwidgets/status_window.hpp"
18 #include <cassert>
19 #include <boost/lexical_cast.hpp>
21 #include <wx/wx.h>
22 #include <wx/event.h>
23 #include <wx/control.h>
24 #include <wx/combobox.h>
27 class lsnes_app : public wxApp
29 public:
30 virtual bool OnInit();
31 virtual int OnExit();
34 IMPLEMENT_APP(lsnes_app)
36 bool lsnes_app::OnInit()
38 set_random_seed();
41 std::ostringstream x;
42 x << snes_library_id() << " (" << SNES::Info::Profile << " core)";
43 bsnes_core_version = x.str();
45 window::init();
46 init_lua();
48 messages << "BSNES version: " << bsnes_core_version << std::endl;
49 messages << "lsnes version: lsnes rr" << lsnes_version << std::endl;
51 std::string cfgpath = get_config_path();
52 messages << "Saving per-user data to: " << get_config_path() << std::endl;
54 wx_messages_window* msgs = new wx_messages_window();
55 window1 = msgs;
56 msgs->Show();
58 wx_rom_select_window* romwin = new wx_rom_select_window();
59 romwin->Show();
61 return true;
64 int lsnes_app::OnExit()
66 information_dispatch::do_dump_end();
67 rrdata::close();
68 window::quit();
69 return 0;
72 void window::notify_message() throw(std::bad_alloc, std::runtime_error)
74 if(wx_messages_window::ptr)
75 wx_messages_window::ptr->notify_message();