mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-01 00:55:06 +01:00
-fixed ftp server file transfers
-fixed a wrong button position (thx mamule)
This commit is contained in:
parent
959d71c186
commit
27948551b5
@ -300,7 +300,7 @@ void CMenu::_initLangSettingsMenu()
|
||||
m_LangSettingsBtnGetLanguages = _addButton("LANGUAGE/GET_LANG_BTN", theme.btnFont, L"", 420, 190, 200, 48, theme.btnFontColor);
|
||||
|
||||
m_LangSettingsLblDlLang = _addLabel("LANGUAGE/DL_LANG", theme.lblFont, L"", 20, 245, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
|
||||
m_LangSettingsLblCurDLLang = _addLabel("LANGUAGE/DL_LANG_BTN", theme.btnFont, L"", 386, 250, 104, 48, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
|
||||
m_LangSettingsLblCurDLLang = _addLabel("LANGUAGE/DL_LANG_BTN", theme.btnFont, L"", 468, 250, 104, 48, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
|
||||
m_LangSettingsBtnCurDlLangM = _addPicButton("LANGUAGE/DL_LANG_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 420, 250, 48, 48);
|
||||
m_LangSettingsBtnCurDlLangP = _addPicButton("LANGUAGE/DL_LANG_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 572, 250, 48, 48);
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "fileOps/fileOps.h"
|
||||
#include "gui/fmt.h"
|
||||
#include "loader/wbfs.h"
|
||||
#include "memory/mem2.hpp"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -277,6 +278,8 @@ int ftp_delete(char *path)
|
||||
}
|
||||
|
||||
lwp_t ftpThrdPtr = LWP_THREAD_NULL;
|
||||
u8 *ftpThrdStack = NULL;
|
||||
static const u32 ftpThrdStackSize = 65536; //we need a big stack for all the transfers
|
||||
volatile bool ftpThrd_running = false;
|
||||
bool end_ftp = false;
|
||||
s32 cur_server_num = -1;
|
||||
@ -303,8 +306,15 @@ bool ftp_startThread(void)
|
||||
|
||||
end_ftp = false;
|
||||
ftpThrd_running = true;
|
||||
LWP_CreateThread(&ftpThrdPtr, ftp_loopThrd, NULL, NULL, 0, 64);
|
||||
return true;
|
||||
ftpThrdStack = (u8*)MEM2_memalign(32, ftpThrdStackSize);
|
||||
if(ftpThrdStack != NULL)
|
||||
{
|
||||
memset(ftpThrdStack, 0, ftpThrdStackSize);
|
||||
DCFlushRange(ftpThrdStack, ftpThrdStackSize);
|
||||
LWP_CreateThread(&ftpThrdPtr, ftp_loopThrd, NULL, ftpThrdStack, ftpThrdStackSize, 64);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void ftp_endTread(void)
|
||||
@ -320,6 +330,10 @@ void ftp_endTread(void)
|
||||
LWP_JoinThread(ftpThrdPtr, NULL);
|
||||
ftpThrdPtr = LWP_THREAD_NULL;
|
||||
|
||||
if(ftpThrdStack != NULL)
|
||||
MEM2_free(ftpThrdStack);
|
||||
ftpThrdStack = NULL;
|
||||
|
||||
end_server();
|
||||
cur_server_num = -1;
|
||||
}
|
||||
|
@ -114,8 +114,11 @@ s32 send_from_file(s32 s, FILE *f) {
|
||||
s32 bytes_read;
|
||||
s32 result = 0;
|
||||
|
||||
DCFlushRange(buf, FREAD_BUFFER_SIZE);
|
||||
ICInvalidateRange(buf, FREAD_BUFFER_SIZE);
|
||||
bytes_read = fread(buf, 1, FREAD_BUFFER_SIZE, f);
|
||||
if (bytes_read > 0) {
|
||||
DCFlushRange(buf, bytes_read);
|
||||
result = send_exact(s, buf, bytes_read);
|
||||
if (result < 0) goto end;
|
||||
}
|
||||
@ -133,6 +136,8 @@ s32 recv_to_file(s32 s, FILE *f) {
|
||||
s32 bytes_read;
|
||||
while (1) {
|
||||
try_again_with_smaller_buffer:
|
||||
DCFlushRange(buf, NET_BUFFER_SIZE);
|
||||
ICInvalidateRange(buf, NET_BUFFER_SIZE);
|
||||
bytes_read = net_read(s, buf, NET_BUFFER_SIZE);
|
||||
if (bytes_read < 0) {
|
||||
if (bytes_read == -EINVAL && NET_BUFFER_SIZE == MAX_NET_BUFFER_SIZE) {
|
||||
@ -143,7 +148,7 @@ s32 recv_to_file(s32 s, FILE *f) {
|
||||
} else if (bytes_read == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
DCFlushRange(buf, bytes_read);
|
||||
s32 bytes_written = fwrite(buf, 1, bytes_read, f);
|
||||
if (bytes_written < bytes_read) return -1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user