bool Rpcs3App::OnInit() { TheApp = this; SetAppName(_PRGNAME_); wxInitAllImageHandlers(); Ini.Load(); m_MainFrame = new MainFrame(); SetTopWindow(m_MainFrame); Emu.Init(); m_MainFrame->Show(); m_MainFrame->DoSettings(true); OnArguments(); return true; }
bool Rpcs3App::OnInit() { static const wxCmdLineEntryDesc desc[] { { wxCMD_LINE_SWITCH, "h", "help", "Command line options:\nh (help): Help and commands\nt (test): For directly executing a (S)ELF", wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP }, { wxCMD_LINE_SWITCH, "t", "test", "Run in test mode on (S)ELF", wxCMD_LINE_VAL_NONE }, { wxCMD_LINE_PARAM, NULL, NULL, "(S)ELF", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, { wxCMD_LINE_NONE } }; parser.SetDesc(desc); parser.SetCmdLine(argc, argv); if (parser.Parse()) { // help was given, terminating this->Exit(); } s_gui_cfg.open(fs::get_config_dir() + "/config_gui.yml", fs::read + fs::write + fs::create); g_gui_cfg = YAML::Load(s_gui_cfg.to_string()); EmuCallbacks callbacks; callbacks.call_after = [](std::function<void()> func) { wxGetApp().CallAfter(std::move(func)); }; callbacks.process_events = [this]() { m_MainFrame->Update(); wxGetApp().ProcessPendingEvents(); }; callbacks.exit = [this]() { wxGetApp().Exit(); }; callbacks.send_dbg_command = [](DbgCommand id, cpu_thread* t) { wxGetApp().SendDbgCommand(id, t); }; callbacks.get_kb_handler = PURE_EXPR(g_cfg_kb_handler.get()()); callbacks.get_mouse_handler = PURE_EXPR(g_cfg_mouse_handler.get()()); callbacks.get_pad_handler = PURE_EXPR(g_cfg_pad_handler.get()()); callbacks.get_gs_frame = [](frame_type type, int w, int h) -> std::unique_ptr<GSFrameBase> { switch (type) { case frame_type::OpenGL: return std::make_unique<GLGSFrame>(w, h); case frame_type::DX12: return std::make_unique<GSFrame>("DirectX 12", w, h); case frame_type::Null: return std::make_unique<GSFrame>("Null", w, h); case frame_type::Vulkan: return std::make_unique<GSFrame>("Vulkan", w, h); } throw EXCEPTION("Invalid Frame Type (0x%x)", type); }; callbacks.get_gs_render = PURE_EXPR(g_cfg_gs_render.get()()); callbacks.get_audio = PURE_EXPR(g_cfg_audio_render.get()()); callbacks.get_msg_dialog = []() -> std::shared_ptr<MsgDialogBase> { return std::make_shared<MsgDialogFrame>(); }; callbacks.get_save_dialog = []() -> std::unique_ptr<SaveDialogBase> { return std::make_unique<SaveDialogFrame>(); }; Emu.SetCallbacks(std::move(callbacks)); TheApp = this; SetAppName("RPCS3"); wxInitAllImageHandlers(); Emu.Init(); m_MainFrame = new MainFrame(); SetTopWindow(m_MainFrame); m_MainFrame->Show(); m_MainFrame->DoSettings(true); OnArguments(parser); return true; }
bool Rpcs3App::OnInit() { SetSendDbgCommandCallback([](DbgCommand id, CPUThread* t) { wxGetApp().SendDbgCommand(id, t); }); SetCallAfterCallback([](std::function<void()> func) { wxGetApp().CallAfter(func); }); SetGetKeyboardHandlerCountCallback([]() { return 2; }); SetGetKeyboardHandlerCallback([](int i) -> KeyboardHandlerBase* { switch (i) { case 0: return new NullKeyboardHandler(); break; case 1: return new WindowsKeyboardHandler(); break; default: return new NullKeyboardHandler(); } }); SetGetMouseHandlerCountCallback([]() { return 2; }); SetGetMouseHandlerCallback([](int i) -> MouseHandlerBase* { switch (i) { case 0: return new NullMouseHandler(); break; case 1: return new WindowsMouseHandler(); break; default: return new NullMouseHandler(); } }); SetGetPadHandlerCountCallback([]() { #if defined(_WIN32) return 3; #else return 2; #endif }); SetGetPadHandlerCallback([](int i) -> PadHandlerBase* { switch (i) { case 0: return new NullPadHandler(); break; case 1: return new WindowsPadHandler(); break; #if defined(_WIN32) case 2: return new XInputPadHandler(); break; #endif default: return new NullPadHandler(); } }); SetGetGSFrameCallback([]() -> GSFrameBase* { return new GLGSFrame(); }); SetMsgDialogCreateCallback(MsgDialogCreate); SetMsgDialogDestroyCallback(MsgDialogDestroy); SetMsgDialogProgressBarSetMsgCallback(MsgDialogProgressBarSetMsg); SetMsgDialogProgressBarResetCallback(MsgDialogProgressBarReset); SetMsgDialogProgressBarIncCallback(MsgDialogProgressBarInc); TheApp = this; SetAppName(_PRGNAME_); wxInitAllImageHandlers(); // RPCS3 assumes the current working directory is the folder where it is contained, so we make sure this is true const wxString executablePath = wxStandardPaths::Get().GetExecutablePath(); wxSetWorkingDirectory(wxPathOnly(executablePath)); main_thread = std::this_thread::get_id(); Ini.Load(); m_MainFrame = new MainFrame(); SetTopWindow(m_MainFrame); Emu.Init(); m_MainFrame->Show(); m_MainFrame->DoSettings(true); OnArguments(); return true; }
bool Rpcs3App::OnInit() { static const wxCmdLineEntryDesc desc[] { { wxCMD_LINE_SWITCH, "h", "help", "Command line options:\nh (help): Help and commands\nt (test): For directly executing a (S)ELF", wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP }, { wxCMD_LINE_SWITCH, "t", "test", "Run in test mode on (S)ELF", wxCMD_LINE_VAL_NONE }, { wxCMD_LINE_PARAM, NULL, NULL, "(S)ELF", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, { wxCMD_LINE_NONE } }; parser.SetDesc(desc); parser.SetCmdLine(argc, argv); if (parser.Parse()) { // help was given, terminating this->Exit(); } s_gui_cfg.open(fs::get_config_dir() + "/config_gui.yml", fs::read + fs::write + fs::create); g_gui_cfg = YAML::Load(s_gui_cfg.to_string()); EmuCallbacks callbacks; callbacks.call_after = [](std::function<void()> func) { wxGetApp().CallAfter(std::move(func)); }; callbacks.process_events = [this]() { m_MainFrame->Update(); wxGetApp().ProcessPendingEvents(); }; callbacks.exit = [this]() { wxGetApp().Exit(); }; callbacks.get_kb_handler = []() -> std::shared_ptr<KeyboardHandlerBase> { switch (keyboard_handler type = g_cfg.io.keyboard) { case keyboard_handler::null: return std::make_shared<NullKeyboardHandler>(); case keyboard_handler::basic: return std::make_shared<BasicKeyboardHandler>(); default: fmt::throw_exception("Invalid keyboard handler: %s", type); } }; callbacks.get_mouse_handler = []() -> std::shared_ptr<MouseHandlerBase> { switch (mouse_handler type = g_cfg.io.mouse) { case mouse_handler::null: return std::make_shared<NullMouseHandler>(); case mouse_handler::basic: return std::make_shared<BasicMouseHandler>(); default: fmt::throw_exception("Invalid mouse handler: %s", type); } }; callbacks.get_pad_handler = []() -> std::shared_ptr<PadHandlerBase> { switch (pad_handler type = g_cfg.io.pad) { case pad_handler::null: return std::make_shared<NullPadHandler>(); case pad_handler::keyboard: return std::make_shared<KeyboardPadHandler>(); case pad_handler::ds4: return std::make_shared<DS4PadHandler>(); #ifdef _MSC_VER case pad_handler::xinput: return std::make_shared<XInputPadHandler>(); #endif #ifdef _WIN32 case pad_handler::mm: return std::make_shared<MMJoystickHandler>(); #endif default: fmt::throw_exception("Invalid pad handler: %s", type); } }; callbacks.get_gs_frame = []() -> std::unique_ptr<GSFrameBase> { extern const std::unordered_map<video_resolution, std::pair<int, int>, value_hash<video_resolution>> g_video_out_resolution_map; const auto size = g_video_out_resolution_map.at(g_cfg.video.resolution); switch (video_renderer type = g_cfg.video.renderer) { case video_renderer::null: return std::make_unique<GSFrame>("Null", size.first, size.second); case video_renderer::opengl: return std::make_unique<GLGSFrame>(size.first, size.second); #ifndef APPLE case video_renderer::vulkan: return std::make_unique<GSFrame>("Vulkan", size.first, size.second); #endif #ifdef _MSC_VER case video_renderer::dx12: return std::make_unique<GSFrame>("DirectX 12", size.first, size.second); #endif default: fmt::throw_exception("Invalid video renderer: %s" HERE, type); } }; callbacks.get_gs_render = []() -> std::shared_ptr<GSRender> { switch (video_renderer type = g_cfg.video.renderer) { case video_renderer::null: return std::make_shared<NullGSRender>(); case video_renderer::opengl: return std::make_shared<GLGSRender>(); #if !defined(__APPLE__) case video_renderer::vulkan: return std::make_shared<VKGSRender>(); #endif #ifdef _MSC_VER case video_renderer::dx12: return std::make_shared<D3D12GSRender>(); #endif default: fmt::throw_exception("Invalid video renderer: %s" HERE, type); } }; callbacks.get_audio = []() -> std::shared_ptr<AudioThread> { switch (audio_renderer type = g_cfg.audio.renderer) { case audio_renderer::null: return std::make_shared<NullAudioThread>(); #ifdef _WIN32 case audio_renderer::xaudio: return std::make_shared<XAudio2Thread>(); #elif __linux__ case audio_renderer::alsa: return std::make_shared<ALSAThread>(); #endif case audio_renderer::openal: return std::make_shared<OpenALThread>(); default: fmt::throw_exception("Invalid audio renderer: %s" HERE, type); } }; callbacks.get_msg_dialog = []() -> std::shared_ptr<MsgDialogBase> { return std::make_shared<MsgDialogFrame>(); }; callbacks.get_save_dialog = []() -> std::unique_ptr<SaveDialogBase> { return std::make_unique<SaveDialogFrame>(); }; Emu.SetCallbacks(std::move(callbacks)); TheApp = this; SetAppName("RPCS3"); wxInitAllImageHandlers(); Emu.Init(); m_MainFrame = new MainFrame(); SetTopWindow(m_MainFrame); m_MainFrame->Show(); m_MainFrame->DoSettings(true); OnArguments(parser); return true; }
bool Rpcs3App::OnInit() { static const wxCmdLineEntryDesc desc[] { { wxCMD_LINE_SWITCH, "h", "help", "Command line options:\nh (help): Help and commands\nt (test): For directly executing a (S)ELF", wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP }, { wxCMD_LINE_SWITCH, "t", "test", "Run in test mode on (S)ELF", wxCMD_LINE_VAL_NONE }, { wxCMD_LINE_PARAM, NULL, NULL, "(S)ELF", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, { wxCMD_LINE_NONE } }; parser.SetDesc(desc); parser.SetCmdLine(argc, argv); if (parser.Parse()) { // help was given, terminating this->Exit(); } EmuCallbacks callbacks; callbacks.call_after = [](std::function<void()> func) { wxGetApp().CallAfter(std::move(func)); }; callbacks.process_events = [this]() { m_MainFrame->Update(); wxGetApp().ProcessPendingEvents(); }; callbacks.send_dbg_command = [](DbgCommand id, CPUThread* t) { wxGetApp().SendDbgCommand(id, t); }; callbacks.get_kb_handler = []() -> std::unique_ptr<KeyboardHandlerBase> { switch (auto mode = rpcs3::config.io.keyboard_handler_mode.value()) { case io_handler_mode::null: return std::make_unique<NullKeyboardHandler>(); case io_handler_mode::windows: return std::make_unique<WindowsKeyboardHandler>(); default: throw EXCEPTION("Invalid Keyboard Handler Mode %d", +(u32)mode); } }; callbacks.get_mouse_handler = []() -> std::unique_ptr<MouseHandlerBase> { switch (auto mode = rpcs3::config.io.mouse_handler_mode.value()) { case io_handler_mode::null: return std::make_unique<NullMouseHandler>(); case io_handler_mode::windows: return std::make_unique<WindowsMouseHandler>(); default: throw EXCEPTION("Invalid Mouse Handler Mode %d", +(u32)mode); } }; callbacks.get_pad_handler = []() -> std::unique_ptr<PadHandlerBase> { switch (auto mode = rpcs3::config.io.pad_handler_mode.value()) { case io_handler_mode::null: return std::make_unique<NullPadHandler>(); case io_handler_mode::windows: return std::make_unique<WindowsPadHandler>(); #ifdef _MSC_VER case io_handler_mode::xinput: return std::make_unique<XInputPadHandler>(); #endif default: throw EXCEPTION("Invalid Pad Handler Mode %d", (int)mode); } }; callbacks.get_gs_frame = [](frame_type type) -> std::unique_ptr<GSFrameBase> { switch (type) { case frame_type::OpenGL: return std::make_unique<GLGSFrame>(); case frame_type::DX12: return std::make_unique<GSFrame>("DirectX 12"); case frame_type::Null: return std::make_unique<GSFrame>("Null"); } throw EXCEPTION("Invalid Frame Type"); }; callbacks.get_gs_render = []() -> std::shared_ptr<GSRender> { switch (auto mode = rpcs3::state.config.rsx.renderer.value()) { case rsx_renderer_type::Null: return std::make_shared<NullGSRender>(); case rsx_renderer_type::OpenGL: return std::make_shared<GLGSRender>(); #ifdef _MSC_VER case rsx_renderer_type::DX12: return std::make_shared<D3D12GSRender>(); #endif default: throw EXCEPTION("Invalid GS Renderer %d", (int)mode); } }; callbacks.get_msg_dialog = []() -> std::shared_ptr<MsgDialogBase> { return std::make_shared<MsgDialogFrame>(); }; callbacks.get_save_dialog = []() -> std::unique_ptr<SaveDialogBase> { return std::make_unique<SaveDialogFrame>(); }; Emu.SetCallbacks(std::move(callbacks)); TheApp = this; SetAppName(_PRGNAME_); wxInitAllImageHandlers(); Emu.Init(); m_MainFrame = new MainFrame(); SetTopWindow(m_MainFrame); m_MainFrame->Show(); m_MainFrame->DoSettings(true); OnArguments(parser); return true; }