ftpiiu_plugin/source/main.cpp

81 lines
1.8 KiB
C++
Raw Permalink Normal View History

2020-04-05 21:16:16 +02:00
// ftpd is a server implementation based on the following:
// - RFC 959 (https://tools.ietf.org/html/rfc959)
// - RFC 3659 (https://tools.ietf.org/html/rfc3659)
// - suggested implementation details from https://cr.yp.to/ftp/filesystem.html
//
2022-10-04 04:52:19 +02:00
// Copyright (C) 2022 Michael Theall
2020-04-05 21:16:16 +02:00
//
// This program 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 3 of the License, or
// (at your option) any later version.
//
// This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
#include "platform.h"
#include "ftpServer.h"
2023-11-19 13:55:58 +01:00
#include "log.h"
#ifndef __WIIU__
2020-04-05 21:16:16 +02:00
#include "imgui.h"
#endif
2020-04-05 21:16:16 +02:00
2022-10-04 04:52:19 +02:00
#ifndef CLASSIC
#include <curl/curl.h>
#endif
2020-04-05 21:16:16 +02:00
#include <cstdio>
#include <cstdlib>
int main (int argc_, char *argv_[])
{
2020-04-17 22:32:39 +02:00
#ifndef CLASSIC
2022-10-04 04:52:19 +02:00
curl_global_init (CURL_GLOBAL_ALL);
2020-04-06 07:36:03 +02:00
IMGUI_CHECKVERSION ();
ImGui::CreateContext ();
2020-04-17 22:32:39 +02:00
#endif
2020-04-06 07:36:03 +02:00
2020-04-05 21:16:16 +02:00
if (!platform::init ())
2020-04-06 07:36:03 +02:00
{
2020-04-17 22:32:39 +02:00
#ifndef CLASSIC
2020-04-06 07:36:03 +02:00
ImGui::DestroyContext ();
2020-04-17 22:32:39 +02:00
#endif
2020-04-05 21:16:16 +02:00
return EXIT_FAILURE;
2020-04-06 07:36:03 +02:00
}
2020-04-05 21:16:16 +02:00
2020-04-17 22:32:39 +02:00
#ifndef CLASSIC
auto &style = ImGui::GetStyle ();
// turn off window rounding
2020-04-05 21:16:16 +02:00
style.WindowRounding = 0.0f;
2020-04-17 22:32:39 +02:00
#endif
2020-04-05 21:16:16 +02:00
2020-04-24 22:51:43 +02:00
auto server = FtpServer::create ();
2020-04-05 21:16:16 +02:00
while (platform::loop ())
{
2023-11-19 13:55:58 +01:00
#ifndef NO_CONSOLE
2020-04-05 21:16:16 +02:00
server->draw ();
platform::render ();
2023-11-19 13:55:58 +01:00
#else
drawLog ();
2023-11-19 13:55:58 +01:00
#endif
2020-04-05 21:16:16 +02:00
}
2020-04-07 03:24:06 +02:00
// clean up resources before exiting switch/3ds services
2020-04-06 07:36:03 +02:00
server.reset ();
2020-04-07 03:24:06 +02:00
2020-04-05 21:16:16 +02:00
platform::exit ();
2020-04-17 22:32:39 +02:00
#ifndef CLASSIC
2020-04-06 07:36:03 +02:00
ImGui::DestroyContext ();
2022-10-04 04:52:19 +02:00
curl_global_cleanup ();
2020-04-17 22:32:39 +02:00
#endif
2020-04-05 21:16:16 +02:00
}