Skip to content

Commit

Permalink
fix MDTM, fix localtime spelling, fix wii asset copying, fix wii buil…
Browse files Browse the repository at this point in the history
…ding against libogc2
  • Loading branch information
ITotalJustice committed Jan 16, 2025
1 parent e8ef5f9 commit aa1e7f7
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 28 deletions.
11 changes: 5 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ endif()
function(fetch_minini)
FetchContent_Declare(minIni
GIT_REPOSITORY https://github.com/ITotalJustice/minIni-nx.git
GIT_TAG 63ec295
GIT_TAG 11cac8b
)

set(MININI_USE_NX ${NINTENDO_SWITCH})
Expand Down Expand Up @@ -449,7 +449,8 @@ else()
SMDH ${PROJECT_NAME}.smdh
)
elseif(NINTENDO_WII)
ftp_set_options(ftpsrv 769 10 1024*64)
# NOTE: 64k net_send/net_recv breaks with ogc2...
ftp_set_options(ftpsrv 769 10 1024*32)
fetch_minini()

target_compile_definitions(ftpsrv PUBLIC
Expand All @@ -466,6 +467,8 @@ else()
ftp_add(ftpexe)

file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/apps/ftpsrv)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/platform/wii/meta.xml ${CMAKE_CURRENT_BINARY_DIR}/apps/ftpsrv/meta.xml)

ogc_create_dol(ftpexe)

add_custom_command(
Expand All @@ -474,10 +477,6 @@ else()
${CMAKE_CURRENT_SOURCE_DIR}/src/platform/wii/icon.png
${CMAKE_CURRENT_BINARY_DIR}/apps/ftpsrv/icon.png

COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/src/platform/wii/meta.xml
${CMAKE_CURRENT_BINARY_DIR}/apps/ftpsrv/meta.xml

COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_BINARY_DIR}/ftpexe.dol
${CMAKE_CURRENT_BINARY_DIR}/apps/ftpsrv/boot.dol
Expand Down
2 changes: 1 addition & 1 deletion src/ftpsrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,7 @@ static void ftp_cmd_MDTM(struct FtpSession* session, const char* data) {
if (!unpack_time(&st.st_mtime, &tm)) {
ftp_client_msg(session, 550, "Syntax error in parameters or arguments, %s. Failed to get timestamp: %s", strerror(errno), fullpath.s);
} else {
ftp_client_msg(session, 213, "%04d%02d%02d%02d%02d", tm.tm_year + 1900, tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
ftp_client_msg(session, 213, "%04d%02d%02d%02d%02d", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/platform/3ds/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ int main(void) {
iprintf(TEXT_YELLOW "pass: %s" TEXT_NORMAL "\n", g_ftpsrv_config.pass);
}
iprintf(TEXT_YELLOW "timeout: %us" TEXT_NORMAL "\n", g_ftpsrv_config.timeout);
iprintf(TEXT_YELLOW "use_locatime: %us" TEXT_NORMAL "\n", g_ftpsrv_config.use_localtime);
iprintf(TEXT_YELLOW "use_localtime: %u" TEXT_NORMAL "\n", g_ftpsrv_config.use_localtime);
iprintf(TEXT_YELLOW "log: %d" TEXT_NORMAL "\n", log_enabled);
iprintf(TEXT_YELLOW "\nconfig: %s" TEXT_NORMAL "\n", INI_PATH);
iprintf("\n");
Expand Down
2 changes: 1 addition & 1 deletion src/platform/nds/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ int main(void) {
iprintf(TEXT_YELLOW "pass: %s" TEXT_NORMAL "\n", g_ftpsrv_config.pass);
}
iprintf(TEXT_YELLOW "timeout: %us" TEXT_NORMAL "\n", g_ftpsrv_config.timeout);
iprintf(TEXT_YELLOW "use_locatime: %us" TEXT_NORMAL "\n", g_ftpsrv_config.use_localtime);
iprintf(TEXT_YELLOW "use_localtime: %u" TEXT_NORMAL "\n", g_ftpsrv_config.use_localtime);
iprintf(TEXT_YELLOW "log: %d" TEXT_NORMAL "\n", log_enabled);
iprintf(TEXT_YELLOW "\nconfig: %s" TEXT_NORMAL "\n", INI_PATH);
iprintf("\n");
Expand Down
2 changes: 1 addition & 1 deletion src/platform/nx/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ int main(int argc, char** argv) {
}
printf("\n");
printf(TEXT_YELLOW "timeout: %us" TEXT_NORMAL "\n", g_ftpsrv_config.timeout);
printf(TEXT_YELLOW "use_locatime: %us" TEXT_NORMAL "\n", g_ftpsrv_config.use_localtime);
printf(TEXT_YELLOW "use_localtime: %u" TEXT_NORMAL "\n", g_ftpsrv_config.use_localtime);
printf(TEXT_YELLOW "log: %d" TEXT_NORMAL "\n", log_enabled);
printf(TEXT_YELLOW "mount_devices: %d" TEXT_NORMAL "\n", mount_devices);
printf(TEXT_YELLOW "save_writable: %d" TEXT_NORMAL "\n", save_writable);
Expand Down
2 changes: 1 addition & 1 deletion src/platform/unistd/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ int main(int argc, char** argv) {
printf(TEXT_YELLOW "pass: %s" TEXT_NORMAL "\n", ftpsrv_config.pass);
}
printf(TEXT_YELLOW "timeout: %us" TEXT_NORMAL "\n", ftpsrv_config.timeout);
printf(TEXT_YELLOW "use_locatime: %us" TEXT_NORMAL "\n", ftpsrv_config.use_localtime);
printf(TEXT_YELLOW "use_localtime: %u" TEXT_NORMAL "\n", ftpsrv_config.use_localtime);

int timeout = -1;
if (ftpsrv_config.timeout) {
Expand Down
34 changes: 17 additions & 17 deletions src/platform/wii/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ static void processEvents(void) {

switch (g_callback_data[i].type) {
case FTP_API_LOG_TYPE_COMMAND:
iprintf(TEXT_BLUE "Command: %s" TEXT_NORMAL "\n", g_callback_data[i].msg);
printf(TEXT_BLUE "Command: %s" TEXT_NORMAL "\n", g_callback_data[i].msg);
break;
case FTP_API_LOG_TYPE_RESPONSE:
iprintf(TEXT_GREEN "Response: %s" TEXT_NORMAL "\n", g_callback_data[i].msg);
printf(TEXT_GREEN "Response: %s" TEXT_NORMAL "\n", g_callback_data[i].msg);
break;
case FTP_API_LOG_TYPE_ERROR:
iprintf(TEXT_RED "Error: %s" TEXT_NORMAL "\n", g_callback_data[i].msg);
printf(TEXT_RED "Error: %s" TEXT_NORMAL "\n", g_callback_data[i].msg);
break;
}
}
Expand Down Expand Up @@ -106,9 +106,9 @@ static void consolePrint(const char* fmt, ...) {

static int error_loop(const char* msg) {
log_file_write(msg);
iprintf("Error: %s\n\n", msg);
iprintf("Modify the config at: %s\n\n", INI_PATH);
iprintf("\tPress (+) to exit...\n");
printf("Error: %s\n\n", msg);
printf("Modify the config at: %s\n\n", INI_PATH);
printf("\tPress (+) to exit...\n");

while (1) {
WPAD_ScanPads();
Expand Down Expand Up @@ -142,7 +142,7 @@ int main(void) {
// Allocate memory for the display in the uncached region
xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));

// Initialise the console, required for iprintf
// Initialise the console, required for printf
console_init(xfb,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ);

// Set up the video registers with the chosen mode
Expand Down Expand Up @@ -207,19 +207,19 @@ int main(void) {
while (1) {
if (!has_net && net_get_status() >= 0) {
const struct in_addr addr = {net_gethostip()};
iprintf(TEXT_YELLOW "ip: %s\n", inet_ntoa(addr));
iprintf(TEXT_YELLOW "port: %d" TEXT_NORMAL "\n", g_ftpsrv_config.port);
printf(TEXT_YELLOW "ip: %s\n", inet_ntoa(addr));
printf(TEXT_YELLOW "port: %d" TEXT_NORMAL "\n", g_ftpsrv_config.port);
if (g_ftpsrv_config.anon) {
iprintf(TEXT_YELLOW "anon: %d" TEXT_NORMAL "\n", 1);
printf(TEXT_YELLOW "anon: %d" TEXT_NORMAL "\n", 1);
} else {
iprintf(TEXT_YELLOW "user: %s" TEXT_NORMAL "\n", g_ftpsrv_config.user);
iprintf(TEXT_YELLOW "pass: %s" TEXT_NORMAL "\n", g_ftpsrv_config.pass);
printf(TEXT_YELLOW "user: %s" TEXT_NORMAL "\n", g_ftpsrv_config.user);
printf(TEXT_YELLOW "pass: %s" TEXT_NORMAL "\n", g_ftpsrv_config.pass);
}
iprintf(TEXT_YELLOW "log: %d" TEXT_NORMAL "\n", log_enabled);
iprintf(TEXT_YELLOW "timeout: %us" TEXT_NORMAL "\n", g_ftpsrv_config.timeout);
iprintf(TEXT_YELLOW "use_locatime: %us" TEXT_NORMAL "\n", g_ftpsrv_config.use_localtime);
iprintf(TEXT_YELLOW "\nconfig: %s" TEXT_NORMAL "\n", INI_PATH);
iprintf("\n");
printf(TEXT_YELLOW "log: %d" TEXT_NORMAL "\n", log_enabled);
printf(TEXT_YELLOW "timeout: %us" TEXT_NORMAL "\n", g_ftpsrv_config.timeout);
printf(TEXT_YELLOW "use_localtime: %u" TEXT_NORMAL "\n", g_ftpsrv_config.use_localtime);
printf(TEXT_YELLOW "\nconfig: %s" TEXT_NORMAL "\n", INI_PATH);
printf("\n");
has_net = true;
}

Expand Down

0 comments on commit aa1e7f7

Please sign in to comment.