/* This file is part of Flycast. Flycast is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. Flycast is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Flycast. If not, see . */ #ifndef LIBRETRO #include "nswitch.h" #include "stdclass.h" #include "log/LogManager.h" #include "emulator.h" #include "ui/mainui.h" #include "oslib/directory.h" #include "oslib/i18n.h" #include #include static void warmUpSwitchExceptions() { try { throw 1; } catch (...) { } } int main(int argc, char *argv[]) { socketInitializeDefault(); nxlinkStdio(); //appletSetFocusHandlingMode(AppletFocusHandlingMode_NoSuspend); nifmInitialize(NifmServiceType_User); LogManager::Init(); i18n::init(); // Set directories flycast::mkdir("/flycast", 0755); flycast::mkdir("/flycast/data", 0755); set_user_config_dir("/flycast/"); set_user_data_dir("/flycast/data/"); add_system_config_dir("/flycast"); add_system_config_dir("./"); add_system_data_dir("/flycast/data/"); add_system_data_dir("./"); add_system_data_dir("data/"); warmUpSwitchExceptions(); if (flycast_init(argc, argv)) die("Flycast initialization failed"); try { mainui_loop(); } catch (const std::exception& e) { ERROR_LOG(BOOT, "mainui_loop error: %s", e.what()); } catch (...) { ERROR_LOG(BOOT, "mainui_loop unknown exception"); } flycast_term(); nifmExit(); socketExit(); return 0; } void os_DoEvents() { } namespace hostfs { void saveScreenshot(const std::string& name, const std::vector& data) { throw FlycastException(i18n::Ts("Not supported on Switch")); } } #endif //!LIBRETRO