98 lines
3.1 KiB
C++
98 lines
3.1 KiB
C++
/*
|
|
* Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms and conditions of the GNU General Public License,
|
|
* version 2, as published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
*/
|
|
|
|
/* --------------------------------------------------------------------------
|
|
* "THE BEER-WARE LICENSE" (Revision 42):
|
|
* <p-sam@d3vs.net>, <natinusala@gmail.com>, <m4x@m4xw.net>
|
|
* wrote this file. As long as you retain this notice you can do whatever you
|
|
* want with this stuff. If you meet any of us some day, and you think this
|
|
* stuff is worth it, you can buy us a beer in return. - The sys-clk authors
|
|
* --------------------------------------------------------------------------
|
|
*/
|
|
|
|
|
|
#define TESLA_INIT_IMPL
|
|
#include <tesla.hpp>
|
|
#include "ui/gui/fatal_gui.h"
|
|
#include "ui/gui/main_gui.h"
|
|
#include "rgltr_services.h" // for extern Service g_rgltrSrv, etc.
|
|
|
|
class AppOverlay : public tsl::Overlay
|
|
{
|
|
public:
|
|
AppOverlay() {}
|
|
~AppOverlay() {}
|
|
|
|
//virtual void initServices() override {
|
|
// rgltrInitialize();
|
|
//}
|
|
|
|
virtual void exitServices() override {
|
|
rgltrExit();
|
|
sysclkIpcExit();
|
|
}
|
|
|
|
virtual std::unique_ptr<tsl::Gui> loadInitialGui() override
|
|
{
|
|
uint32_t apiVersion;
|
|
smInitialize();
|
|
|
|
tsl::hlp::ScopeGuard smGuard([] { smExit(); });
|
|
|
|
if(!sysclkIpcRunning())
|
|
{
|
|
return initially<FatalGui>(
|
|
"hoc-clk is not running.\n\n"
|
|
"\n"
|
|
"Please make sure it is correctly\n\n"
|
|
"installed and enabled.",
|
|
""
|
|
);
|
|
}
|
|
|
|
if(R_FAILED(sysclkIpcInitialize()) || R_FAILED(sysclkIpcGetAPIVersion(&apiVersion)))
|
|
{
|
|
return initially<FatalGui>(
|
|
"Could not connect to hoc-clk.\n\n"
|
|
"\n"
|
|
"Please make sure it is correctly\n\n"
|
|
"installed and enabled.",
|
|
""
|
|
);
|
|
}
|
|
|
|
if(SYSCLK_IPC_API_VERSION != apiVersion)
|
|
{
|
|
return initially<FatalGui>(
|
|
"Overlay not compatible with\n\n"
|
|
"the running hoc-clk version.\n\n"
|
|
"\n"
|
|
"Please make sure everything is\n\n"
|
|
"installed and up to date.",
|
|
""
|
|
);
|
|
}
|
|
|
|
return initially<MainGui>();
|
|
}
|
|
};
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
return tsl::loop<AppOverlay>(argc, argv);
|
|
}
|