mirror of
https://github.com/wiiu-env/ftpiiu_plugin.git
synced 2024-12-22 19:11:47 +01:00
_3DS -> __3DS__
This commit is contained in:
parent
9c1735e33f
commit
7364ea7dd5
@ -68,7 +68,7 @@ CFLAGS := -g -Wall $(OPTIMIZE) -mword-relocations \
|
||||
-fomit-frame-pointer -ffunction-sections -fdata-sections \
|
||||
$(ARCH) $(DEFINES) $(CLASSIC)
|
||||
|
||||
CFLAGS += $(INCLUDE) -DARM11 -D_3DS \
|
||||
CFLAGS += $(INCLUDE) -DARM11 -D__3DS__ \
|
||||
-DSTATUS_STRING="\"ftpd v$(VERSION)\"" \
|
||||
-DIMGUI_DISABLE_INCLUDE_IMCONFIG_H=1 \
|
||||
-DNO_IPV6 -DFTPDCONFIG="\"/config/ftpd/ftpd.cfg\"" \
|
||||
|
@ -46,7 +46,7 @@ DATA := data
|
||||
INCLUDES := include
|
||||
|
||||
ifeq ($(strip $(CLASSIC)),)
|
||||
APP_TITLE := ftpd pro $(VERSION)
|
||||
APP_TITLE := ftpd Issue \#139
|
||||
TARGET := switch/ftpd
|
||||
BUILD := switch/build
|
||||
SOURCES += source/imgui
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
/// \brief Get port
|
||||
std::uint16_t port () const;
|
||||
|
||||
#ifdef _3DS
|
||||
#ifdef __3DS__
|
||||
/// \brief Whether to get mtime
|
||||
/// \note only effective on 3DS
|
||||
bool getMTime () const;
|
||||
@ -93,7 +93,7 @@ public:
|
||||
/// \param port_ Listen port
|
||||
bool setPort (std::uint16_t port_);
|
||||
|
||||
#ifdef _3DS
|
||||
#ifdef __3DS__
|
||||
/// \brief Set whether to get mtime
|
||||
/// \param getMTime_ Whether to get mtime
|
||||
void setGetMTime (bool getMTime_);
|
||||
@ -130,7 +130,7 @@ private:
|
||||
/// \brief Listen port
|
||||
std::uint16_t m_port;
|
||||
|
||||
#ifdef _3DS
|
||||
#ifdef __3DS__
|
||||
/// \brief Whether to get mtime
|
||||
bool m_getMTime = true;
|
||||
#endif
|
||||
|
@ -128,7 +128,7 @@ private:
|
||||
/// \brief Port setting
|
||||
std::uint16_t m_portSetting;
|
||||
|
||||
#ifdef _3DS
|
||||
#ifdef __3DS__
|
||||
/// \brief getMTime setting
|
||||
bool m_getMTimeSetting;
|
||||
#endif
|
||||
|
@ -83,7 +83,7 @@ private:
|
||||
|
||||
/// \brief Amount of file position history to keep
|
||||
constexpr static auto POSITION_HISTORY = 60;
|
||||
#elif defined(_3DS)
|
||||
#elif defined(__3DS__)
|
||||
/// \brief Socket buffer size
|
||||
constexpr static auto SOCK_BUFFERSIZE = 32768;
|
||||
|
||||
|
@ -26,7 +26,7 @@ extern char const *const g_dearImGuiVersion;
|
||||
extern char const *const g_dearImGuiCopyright;
|
||||
extern char const *const g_mitLicense;
|
||||
|
||||
#ifdef _3DS
|
||||
#ifdef __3DS__
|
||||
extern char const *const g_libctruVersion;
|
||||
extern char const *const g_citro3dVersion;
|
||||
extern char const *const g_citro3dCopyright;
|
||||
@ -47,7 +47,7 @@ extern char const *const g_bsdLicense;
|
||||
extern char const *const g_zlibLicense;
|
||||
#endif
|
||||
|
||||
#if !defined(NDS) && !defined(_3DS) && !defined(__SWITCH__)
|
||||
#if !defined(NDS) && !defined(__3DS__) && !defined(__SWITCH__)
|
||||
extern char const *const g_glfwVersion;
|
||||
extern char const *const g_glfwCopyright;
|
||||
#endif
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#if defined(NDS)
|
||||
#include <nds.h>
|
||||
#elif defined(_3DS)
|
||||
#elif defined(__3DS__)
|
||||
#include <3ds.h>
|
||||
#elif defined(__SWITCH__)
|
||||
#include <switch.h>
|
||||
@ -80,7 +80,7 @@ void render ();
|
||||
/// \brief Deinitialize platform
|
||||
void exit ();
|
||||
|
||||
#ifdef _3DS
|
||||
#ifdef __3DS__
|
||||
/// \brief Steady clock
|
||||
struct steady_clock
|
||||
{
|
||||
|
@ -65,7 +65,7 @@ public:
|
||||
/// \param addr_ Address
|
||||
SockAddr (struct sockaddr_in const &addr_);
|
||||
|
||||
#ifndef _3DS
|
||||
#ifndef __3DS__
|
||||
/// \param Parameterized constructor
|
||||
/// \param addr_ Address
|
||||
SockAddr (struct sockaddr_in6 const &addr_);
|
||||
@ -78,7 +78,7 @@ public:
|
||||
/// \param sockaddr_in cast operator
|
||||
operator struct sockaddr_in const & () const;
|
||||
|
||||
#ifndef _3DS
|
||||
#ifndef __3DS__
|
||||
/// \param sockaddr_in6 cast operator
|
||||
operator struct sockaddr_in6 const & () const;
|
||||
#endif
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
|
||||
#if defined(NDS) || defined(_3DS) || defined(__SWITCH__)
|
||||
#if defined(NDS) || defined(__3DS__) || defined(__SWITCH__)
|
||||
#define getline __getline
|
||||
#endif
|
||||
|
||||
|
@ -153,7 +153,7 @@ UniqueFtpConfig FtpConfig::load (char const *const path_)
|
||||
config->m_pass = val;
|
||||
else if (key == "port")
|
||||
parseInt (port, val);
|
||||
#ifdef _3DS
|
||||
#ifdef __3DS__
|
||||
else if (key == "mtime")
|
||||
{
|
||||
if (val == "0")
|
||||
@ -208,7 +208,7 @@ bool FtpConfig::save (char const *const path_)
|
||||
std::fprintf (fp, "pass=%s\n", m_pass.c_str ());
|
||||
std::fprintf (fp, "port=%u\n", m_port);
|
||||
|
||||
#ifdef _3DS
|
||||
#ifdef __3DS__
|
||||
std::fprintf (fp, "mtime=%u\n", m_getMTime);
|
||||
#endif
|
||||
|
||||
@ -238,7 +238,7 @@ std::uint16_t FtpConfig::port () const
|
||||
return m_port;
|
||||
}
|
||||
|
||||
#ifdef _3DS
|
||||
#ifdef __3DS__
|
||||
bool FtpConfig::getMTime () const
|
||||
{
|
||||
return m_getMTime;
|
||||
@ -290,7 +290,7 @@ bool FtpConfig::setPort (std::uint16_t const port_)
|
||||
errno = EPERM;
|
||||
return false;
|
||||
}
|
||||
#elif defined(NDS) || defined(_3DS)
|
||||
#elif defined(NDS) || defined(__3DS__)
|
||||
// 3DS is allowed < 1024, but not 0
|
||||
// NDS is allowed < 1024, but 0 crashes the app
|
||||
if (port_ == 0)
|
||||
@ -304,7 +304,7 @@ bool FtpConfig::setPort (std::uint16_t const port_)
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef _3DS
|
||||
#ifdef __3DS__
|
||||
void FtpConfig::setGetMTime (bool const getMTime_)
|
||||
{
|
||||
m_getMTime = getMTime_;
|
||||
|
@ -157,7 +157,7 @@ void FtpServer::draw ()
|
||||
auto const height = io.DisplaySize.y;
|
||||
|
||||
ImGui::SetNextWindowPos (ImVec2 (0, 0), ImGuiCond_FirstUseEver);
|
||||
#ifdef _3DS
|
||||
#ifdef __3DS__
|
||||
// top screen
|
||||
ImGui::SetNextWindowSize (ImVec2 (width, height * 0.5f));
|
||||
#else
|
||||
@ -177,26 +177,26 @@ void FtpServer::draw ()
|
||||
ImGui::Begin (title,
|
||||
nullptr,
|
||||
ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize
|
||||
#ifndef _3DS
|
||||
#ifndef __3DS__
|
||||
| ImGuiWindowFlags_MenuBar
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
#ifndef _3DS
|
||||
#ifndef __3DS__
|
||||
showMenu ();
|
||||
#endif
|
||||
|
||||
#ifndef _3DS
|
||||
#ifndef __3DS__
|
||||
ImGui::BeginChild (
|
||||
"Logs", ImVec2 (0, 0.5f * height), false, ImGuiWindowFlags_HorizontalScrollbar);
|
||||
#endif
|
||||
drawLog ();
|
||||
#ifndef _3DS
|
||||
#ifndef __3DS__
|
||||
ImGui::EndChild ();
|
||||
#endif
|
||||
|
||||
#ifdef _3DS
|
||||
#ifdef __3DS__
|
||||
ImGui::End ();
|
||||
|
||||
// bottom screen
|
||||
@ -242,7 +242,7 @@ std::string FtpServer::getFreeSpace ()
|
||||
void FtpServer::updateFreeSpace ()
|
||||
{
|
||||
struct statvfs st;
|
||||
#if defined(NDS) || defined(_3DS) || defined(__SWITCH__)
|
||||
#if defined(NDS) || defined(__3DS__) || defined(__SWITCH__)
|
||||
if (::statvfs ("sdmc:/", &st) != 0)
|
||||
#else
|
||||
if (::statvfs ("/", &st) != 0)
|
||||
@ -329,7 +329,7 @@ void FtpServer::showMenu ()
|
||||
|
||||
if (ImGui::BeginMenuBar ())
|
||||
{
|
||||
#if defined(_3DS) || defined(__SWITCH__)
|
||||
#if defined(__3DS__) || defined(__SWITCH__)
|
||||
if (ImGui::BeginMenu (u8"Menu \xee\x80\x83")) // Y Button
|
||||
#else
|
||||
if (ImGui::BeginMenu ("Menu"))
|
||||
@ -362,7 +362,7 @@ void FtpServer::showMenu ()
|
||||
|
||||
m_portSetting = m_config->port ();
|
||||
|
||||
#ifdef _3DS
|
||||
#ifdef __3DS__
|
||||
m_getMTimeSetting = m_config->getMTime ();
|
||||
#endif
|
||||
|
||||
@ -393,7 +393,7 @@ void FtpServer::showMenu ()
|
||||
|
||||
void FtpServer::showSettings ()
|
||||
{
|
||||
#ifdef _3DS
|
||||
#ifdef __3DS__
|
||||
auto const &io = ImGui::GetIO ();
|
||||
auto const width = io.DisplaySize.x;
|
||||
auto const height = io.DisplaySize.y;
|
||||
@ -425,7 +425,7 @@ void FtpServer::showSettings ()
|
||||
"%u",
|
||||
ImGuiInputTextFlags_AutoSelectAll);
|
||||
|
||||
#ifdef _3DS
|
||||
#ifdef __3DS__
|
||||
ImGui::Checkbox ("Get mtime", &m_getMTimeSetting);
|
||||
#endif
|
||||
|
||||
@ -491,7 +491,7 @@ void FtpServer::showSettings ()
|
||||
m_config->setPass (m_passSetting);
|
||||
m_config->setPort (m_portSetting);
|
||||
|
||||
#ifdef _3DS
|
||||
#ifdef __3DS__
|
||||
m_config->setGetMTime (m_getMTimeSetting);
|
||||
#endif
|
||||
|
||||
@ -522,7 +522,7 @@ void FtpServer::showSettings ()
|
||||
m_userSetting = defaults->user ();
|
||||
m_passSetting = defaults->pass ();
|
||||
m_portSetting = defaults->port ();
|
||||
#ifdef _3DS
|
||||
#ifdef __3DS__
|
||||
m_getMTimeSetting = defaults->getMTime ();
|
||||
#endif
|
||||
|
||||
@ -549,7 +549,7 @@ void FtpServer::showAbout ()
|
||||
auto const width = io.DisplaySize.x;
|
||||
auto const height = io.DisplaySize.y;
|
||||
|
||||
#ifdef _3DS
|
||||
#ifdef __3DS__
|
||||
ImGui::SetNextWindowSize (ImVec2 (width * 0.8f, height * 0.5f));
|
||||
ImGui::SetNextWindowPos (ImVec2 (width * 0.1f, height * 0.5f));
|
||||
#else
|
||||
@ -582,7 +582,7 @@ void FtpServer::showAbout ()
|
||||
}
|
||||
|
||||
#if defined(NDS)
|
||||
#elif defined(_3DS)
|
||||
#elif defined(__3DS__)
|
||||
if (ImGui::TreeNode (g_libctruVersion))
|
||||
{
|
||||
ImGui::TextWrapped (g_zlibLicense);
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include <mutex>
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
#if defined(NDS) || defined(_3DS) || defined(__SWITCH__)
|
||||
#if defined(NDS) || defined(__3DS__) || defined(__SWITCH__)
|
||||
#define lstat stat
|
||||
#endif
|
||||
|
||||
@ -341,7 +341,7 @@ void FtpSession::draw ()
|
||||
|
||||
std::fputs (m_workItem.empty () ? m_cwd.c_str () : m_workItem.c_str (), stdout);
|
||||
#else
|
||||
#ifdef _3DS
|
||||
#ifdef __3DS__
|
||||
ImGui::BeginChild (m_windowName.c_str (), ImVec2 (0.0f, 45.0f), true);
|
||||
#else
|
||||
ImGui::BeginChild (m_windowName.c_str (), ImVec2 (0.0f, 80.0f), true);
|
||||
@ -718,7 +718,7 @@ bool FtpSession::dataAccept ()
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef _3DS
|
||||
#ifndef __3DS__
|
||||
m_dataSocket->setRecvBufferSize (SOCK_BUFFERSIZE);
|
||||
m_dataSocket->setSendBufferSize (SOCK_BUFFERSIZE);
|
||||
#endif
|
||||
@ -793,7 +793,7 @@ int FtpSession::fillDirent (struct stat const &st_, std::string_view const path_
|
||||
type_ = "file";
|
||||
else if (S_ISDIR (st_.st_mode))
|
||||
type_ = "dir";
|
||||
#if !defined(_3DS) && !defined(__SWITCH__)
|
||||
#if !defined(__3DS__) && !defined(__SWITCH__)
|
||||
else if (S_ISLNK (st_.st_mode))
|
||||
type_ = "os.unix=symlink";
|
||||
else if (S_ISCHR (st_.st_mode))
|
||||
@ -970,7 +970,7 @@ int FtpSession::fillDirent (struct stat const &st_, std::string_view const path_
|
||||
buffer[pos++] = ' ';
|
||||
}
|
||||
|
||||
#ifdef _3DS
|
||||
#ifdef __3DS__
|
||||
auto const owner = "3DS";
|
||||
auto const group = "3DS";
|
||||
#elif defined(__SWITCH__)
|
||||
@ -989,7 +989,7 @@ int FtpSession::fillDirent (struct stat const &st_, std::string_view const path_
|
||||
// clang-format off
|
||||
S_ISREG (st_.st_mode) ? '-' :
|
||||
S_ISDIR (st_.st_mode) ? 'd' :
|
||||
#if !defined(_3DS) && !defined(__SWITCH__)
|
||||
#if !defined(__3DS__) && !defined(__SWITCH__)
|
||||
S_ISLNK (st_.st_mode) ? 'l' :
|
||||
S_ISCHR (st_.st_mode) ? 'c' :
|
||||
S_ISBLK (st_.st_mode) ? 'b' :
|
||||
@ -1648,7 +1648,7 @@ bool FtpSession::listTransfer ()
|
||||
auto const fullPath = buildPath (m_lwd, dent->d_name);
|
||||
struct stat st;
|
||||
|
||||
#ifdef _3DS
|
||||
#ifdef __3DS__
|
||||
// the sdmc directory entry already has the type and size, so no need to do a slow stat
|
||||
auto const dp = static_cast<DIR *> (m_dir);
|
||||
auto const magic = *reinterpret_cast<u32 *> (dp->dirData->dirStruct);
|
||||
@ -2226,7 +2226,7 @@ void FtpSession::PASV (char const *args_)
|
||||
|
||||
// create an address to bind
|
||||
struct sockaddr_in addr = m_commandSocket->sockName ();
|
||||
#if defined(NDS) || defined(_3DS)
|
||||
#if defined(NDS) || defined(__3DS__)
|
||||
static std::uint16_t ephemeralPort = 5001;
|
||||
if (ephemeralPort > 10000)
|
||||
ephemeralPort = 5001;
|
||||
@ -2550,7 +2550,7 @@ void FtpSession::SITE (char const *args_)
|
||||
" Set username: SITE USER <NAME>\r\n"
|
||||
" Set password: SITE PASS <PASS>\r\n"
|
||||
" Set port: SITE PORT <PORT>\r\n"
|
||||
#ifdef _3DS
|
||||
#ifdef __3DS__
|
||||
" Set getMTime: SITE MTIME [0|1]\r\n"
|
||||
#endif
|
||||
" Save config: SITE SAVE\r\n"
|
||||
@ -2608,7 +2608,7 @@ void FtpSession::SITE (char const *args_)
|
||||
sendResponse ("200 OK\r\n");
|
||||
return;
|
||||
}
|
||||
#ifdef _3DS
|
||||
#ifdef __3DS__
|
||||
else if (::strcasecmp (command.c_str (), "MTIME") == 0)
|
||||
{
|
||||
if (arg == "0")
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <zstd.h>
|
||||
#endif
|
||||
|
||||
#if !defined(NDS) && !defined(_3DS) && !defined(__SWITCH__)
|
||||
#if !defined(NDS) && !defined(__3DS__) && !defined(__SWITCH__)
|
||||
#include <GLFW/glfw3.h>
|
||||
#endif
|
||||
|
||||
@ -52,7 +52,7 @@ char const *const g_mitLicense =
|
||||
"ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE "
|
||||
"SOFTWARE.";
|
||||
|
||||
#ifdef _3DS
|
||||
#ifdef __3DS__
|
||||
char const *const g_libctruVersion = "libctru";
|
||||
char const *const g_citro3dVersion = "citro3d";
|
||||
|
||||
@ -125,7 +125,7 @@ char const *const g_zlibLicense =
|
||||
"3. This notice may not be removed or altered from any source distribution.";
|
||||
#endif
|
||||
|
||||
#if !defined(NDS) && !defined(_3DS) && !defined(__SWITCH__)
|
||||
#if !defined(NDS) && !defined(__3DS__) && !defined(__SWITCH__)
|
||||
#define STR(x) #x
|
||||
#define XSTR(x) STR (x)
|
||||
#define GLFW_VERSION_STRING \
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
#ifdef _3DS
|
||||
#ifdef __3DS__
|
||||
/// \brief Maximum number of log messages to keep
|
||||
constexpr auto MAX_LOGS = 250;
|
||||
#else
|
||||
|
@ -65,7 +65,7 @@ SockAddr::SockAddr (struct sockaddr_in const &addr_)
|
||||
assert (m_addr.ss_family == AF_INET);
|
||||
}
|
||||
|
||||
#ifndef _3DS
|
||||
#ifndef __3DS__
|
||||
SockAddr::SockAddr (struct sockaddr_in6 const &addr_)
|
||||
: SockAddr (reinterpret_cast<struct sockaddr const &> (addr_))
|
||||
{
|
||||
@ -84,7 +84,7 @@ SockAddr::operator struct sockaddr_in const & () const
|
||||
return reinterpret_cast<struct sockaddr_in const &> (m_addr);
|
||||
}
|
||||
|
||||
#ifndef _3DS
|
||||
#ifndef __3DS__
|
||||
SockAddr::operator struct sockaddr_in6 const & () const
|
||||
{
|
||||
assert (m_addr.ss_family == AF_INET6);
|
||||
|
Loading…
Reference in New Issue
Block a user