From c686d4826850a69a9378815f271fe42db973e11d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 25 Oct 2025 10:25:46 +0200 Subject: [PATCH 1/7] Add prototype Upload screen and a couple new icons. Some refactoring. --- CMakeLists.txt | 2 + Common/File/FileDescriptor.cpp | 14 ++++-- Common/Net/HTTPClient.cpp | 4 ++ Common/Net/HTTPClient.h | 2 + Common/Net/HTTPServer.cpp | 72 ++++++++++++++++--------------- Common/Net/HTTPServer.h | 11 ++++- Common/Net/Resolve.cpp | 14 +++--- Common/Net/Resolve.h | 2 +- Core/WebServer.cpp | 43 +++++++++++++++--- Core/WebServer.h | 4 +- UI/DevScreens.cpp | 3 ++ UI/GameSettingsScreen.cpp | 2 +- UI/MainScreen.cpp | 7 +++ UI/MainScreen.h | 3 +- UI/UI.vcxproj | 2 + UI/UI.vcxproj.filters | 6 +++ UI/UIAtlas.cpp | 3 ++ UI/UploadScreen.cpp | 52 ++++++++++++++++++++++ UI/UploadScreen.h | 47 ++++++++++++++++++++ UWP/UI_UWP/UI_UWP.vcxproj | 2 + UWP/UI_UWP/UI_UWP.vcxproj.filters | 6 +++ Windows/main.cpp | 2 + android/jni/Android.mk | 1 + assets/ui_images/images.svg | 34 +++++++++------ 24 files changed, 270 insertions(+), 68 deletions(-) create mode 100644 UI/UploadScreen.cpp create mode 100644 UI/UploadScreen.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 7efddc6b3b..3b95915f1b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1605,6 +1605,8 @@ list(APPEND NativeAppSource UI/SystemInfoScreen.cpp UI/Store.h UI/Store.cpp + UI/UploadScreen.h + UI/UploadScreen.cpp UI/CwCheatScreen.h UI/CwCheatScreen.cpp UI/InstallZipScreen.h diff --git a/Common/File/FileDescriptor.cpp b/Common/File/FileDescriptor.cpp index 0da3b9e09f..61fa4a73e8 100644 --- a/Common/File/FileDescriptor.cpp +++ b/Common/File/FileDescriptor.cpp @@ -75,7 +75,8 @@ std::string GetLocalIP(int sock) { } server_addr; memset(&server_addr, 0, sizeof(server_addr)); socklen_t len = sizeof(server_addr); - if (getsockname(sock, (struct sockaddr *)&server_addr, &len) == 0) { + int retval = getsockname(sock, (struct sockaddr *)&server_addr, &len); + if (retval == 0) { char temp[64]{}; // We clear the port below for WSAAddressToStringA. @@ -94,17 +95,24 @@ std::string GetLocalIP(int sock) { wchar_t wtemp[sizeof(temp)]; DWORD len = (DWORD)sizeof(temp); // Windows XP doesn't support inet_ntop. - if (WSAAddressToStringW((struct sockaddr *)&server_addr, sizeof(server_addr), nullptr, wtemp, &len) == 0) { + HRESULT result = WSAAddressToStringW((struct sockaddr *)&server_addr, sizeof(server_addr), nullptr, wtemp, &len); + if (result == 0) { return ConvertWStringToUTF8(wtemp); + } else { + return ""; } #else const char *result = inet_ntop(server_addr.sa.sa_family, addr, temp, sizeof(temp)); if (result) { return result; + } else { + return ""; } #endif + } else { + WARN_LOG(Log::IO, "GetLocalIP: getsockname failed with error %d (%s)", retval, strerror(retval)); + return ""; } - return ""; } } // fd_util diff --git a/Common/Net/HTTPClient.cpp b/Common/Net/HTTPClient.cpp index e17565f2c0..a9aa042bb6 100644 --- a/Common/Net/HTTPClient.cpp +++ b/Common/Net/HTTPClient.cpp @@ -47,6 +47,10 @@ const char *DNSTypeAsString(DNSType type) { } } +std::string Connection::GetLocalIpAsString() const { + return fd_util::GetLocalIP(this->sock()); +} + bool Connection::Resolve(const char *host, int port, DNSType type) { if ((intptr_t)sock_ != -1) { ERROR_LOG(Log::IO, "Resolve: Already have a socket"); diff --git a/Common/Net/HTTPClient.h b/Common/Net/HTTPClient.h index c8a147db56..2ecc1d1d16 100644 --- a/Common/Net/HTTPClient.h +++ b/Common/Net/HTTPClient.h @@ -30,6 +30,8 @@ public: // Only to be used for bring-up and debugging. uintptr_t sock() const { return sock_; } + std::string GetLocalIpAsString() const; + protected: // Store the remote host here, so we can send it along through HTTP/1.1 requests. // TODO: Move to http::client? diff --git a/Common/Net/HTTPServer.cpp b/Common/Net/HTTPServer.cpp index 34bc87a7a0..c69aae0125 100644 --- a/Common/Net/HTTPServer.cpp +++ b/Common/Net/HTTPServer.cpp @@ -66,7 +66,7 @@ ServerRequest::ServerRequest(int fd) header_.ParseHeaders(in_); if (header_.ok) { - VERBOSE_LOG(Log::IO, "The request carried with it %i bytes", (int)header_.content_length); + VERBOSE_LOG(Log::HTTP, "The request carried with it %i bytes", (int)header_.content_length); } else { Close(); } @@ -76,11 +76,11 @@ ServerRequest::~ServerRequest() { Close(); if (!in_->Empty()) { - ERROR_LOG(Log::IO, "Input not empty - invalid request?"); + ERROR_LOG(Log::HTTP, "Input not empty - invalid request?"); } delete in_; if (!out_->Empty()) { - WARN_LOG(Log::IO, "Output not empty - connection abort? (%s) (%d bytes)", this->header_.resource, (int)out_->BytesRemaining()); + WARN_LOG(Log::HTTP, "Output not empty - connection abort? (%s) (%d bytes)", this->header_.resource, (int)out_->BytesRemaining()); } delete out_; } @@ -170,8 +170,8 @@ bool Server::Listen(int port, const char *reason, net::DNSType type) { } bool Server::Listen4(int port, const char *reason) { - listener_ = socket(AF_INET, SOCK_STREAM, 0); - if (listener_ < 0) + listenerSock_ = socket(AF_INET, SOCK_STREAM, 0); + if (listenerSock_ < 0) return false; struct sockaddr_in server_addr; @@ -182,42 +182,43 @@ bool Server::Listen4(int port, const char *reason) { int opt = 1; // Enable re-binding to avoid the pain when restarting the server quickly. - setsockopt(listener_, SOL_SOCKET, SO_REUSEADDR, (const char *)&opt, sizeof(opt)); + setsockopt(listenerSock_, SOL_SOCKET, SO_REUSEADDR, (const char *)&opt, sizeof(opt)); - if (bind(listener_, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) { + if (bind(listenerSock_, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) { #if PPSSPP_PLATFORM(WINDOWS) int err = WSAGetLastError(); #else int err = errno; #endif - ERROR_LOG(Log::IO, "%s: Failed to bind to port %d, error=%d - Bailing (ipv4)", reason, port, err); - closesocket(listener_); + ERROR_LOG(Log::HTTP, "%s: Failed to bind to port %d, error=%d - Bailing (ipv4)", reason, port, err); + closesocket(listenerSock_); return false; } - fd_util::SetNonBlocking(listener_, true); + fd_util::SetNonBlocking(listenerSock_, true); // 1024 is the max number of queued requests. - if (listen(listener_, 1024) < 0) { - closesocket(listener_); + if (listen(listenerSock_, 1024) < 0) { + closesocket(listenerSock_); return false; } socklen_t len = sizeof(server_addr); - if (getsockname(listener_, (struct sockaddr *)&server_addr, &len) == 0) { + if (getsockname(listenerSock_, (struct sockaddr *)&server_addr, &len) == 0) { port = ntohs(server_addr.sin_port); } - INFO_LOG(Log::IO, "HTTP server started on port %d: %s", port, reason); - port_ = port; + localAddress_ = fd_util::GetLocalIP(listenerSock_); + INFO_LOG(Log::HTTP, "HTTP IPv4 server started on port %d: %s (ip: %s)", port, reason, localAddress_.c_str()); + port_ = port; return true; } bool Server::Listen6(int port, bool ipv6_only, const char *reason) { #if !PPSSPP_PLATFORM(SWITCH) - listener_ = socket(AF_INET6, SOCK_STREAM, 0); - if (listener_ < 0) + listenerSock_ = socket(AF_INET6, SOCK_STREAM, 0); + if (listenerSock_ < 0) return false; struct sockaddr_in6 server_addr; @@ -228,54 +229,55 @@ bool Server::Listen6(int port, bool ipv6_only, const char *reason) { int opt = 1; // Enable re-binding to avoid the pain when restarting the server quickly. - setsockopt(listener_, SOL_SOCKET, SO_REUSEADDR, (const char *)&opt, sizeof(opt)); + setsockopt(listenerSock_, SOL_SOCKET, SO_REUSEADDR, (const char *)&opt, sizeof(opt)); // Enable listening on IPv6 and IPv4? opt = ipv6_only ? 1 : 0; - setsockopt(listener_, IPPROTO_IPV6, IPV6_V6ONLY, (const char *)&opt, sizeof(opt)); + setsockopt(listenerSock_, IPPROTO_IPV6, IPV6_V6ONLY, (const char *)&opt, sizeof(opt)); - if (bind(listener_, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) { + if (bind(listenerSock_, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) { #if PPSSPP_PLATFORM(WINDOWS) int err = WSAGetLastError(); #else int err = errno; #endif - ERROR_LOG(Log::IO, "%s: Failed to bind to port %d, error=%d - Bailing (ipv6)", reason, port, err); - closesocket(listener_); + ERROR_LOG(Log::HTTP, "%s: Failed to bind to port %d, error=%d - Bailing (ipv6)", reason, port, err); + closesocket(listenerSock_); return false; } - fd_util::SetNonBlocking(listener_, true); + fd_util::SetNonBlocking(listenerSock_, true); // 1024 is the max number of queued requests. - if (listen(listener_, 1024) < 0) { - closesocket(listener_); + if (listen(listenerSock_, 1024) < 0) { + closesocket(listenerSock_); return false; } socklen_t len = sizeof(server_addr); - if (getsockname(listener_, (struct sockaddr *)&server_addr, &len) == 0) { + if (getsockname(listenerSock_, (struct sockaddr *)&server_addr, &len) == 0) { port = ntohs(server_addr.sin6_port); } - INFO_LOG(Log::IO, "HTTP server started on port %d: %s", port, reason); + localAddress_ = fd_util::GetLocalIP(listenerSock_); + INFO_LOG(Log::HTTP, "HTTP IPv6 server started on port %d: %s (ip: %s)", port, reason, localAddress_.c_str()); port_ = port; - return true; #else + ERROR_LOG(Log::HTTP, "IPv6 not supported on this platform."); return false; #endif } bool Server::RunSlice(double timeout) { - if (listener_ < 0 || port_ == 0) { + if (listenerSock_ < 0 || port_ == 0) { return false; } if (timeout <= 0.0) { timeout = 86400.0; } - if (!fd_util::WaitUntilReady(listener_, timeout, false)) { + if (!fd_util::WaitUntilReady(listenerSock_, timeout, false)) { return false; } @@ -287,13 +289,13 @@ bool Server::RunSlice(double timeout) { #endif } client_addr; socklen_t client_addr_size = sizeof(client_addr); - int conn_fd = accept(listener_, &client_addr.sa, &client_addr_size); + int conn_fd = accept(listenerSock_, &client_addr.sa, &client_addr_size); if (conn_fd >= 0) { executor_->Run(std::bind(&Server::HandleConnection, this, conn_fd)); return true; } else { - ERROR_LOG(Log::IO, "socket accept failed: %i", conn_fd); + ERROR_LOG(Log::HTTP, "socket accept failed: %i", conn_fd); return false; } } @@ -312,13 +314,13 @@ bool Server::Run(int port) { } void Server::Stop() { - closesocket(listener_); + closesocket(listenerSock_); } void Server::HandleConnection(int conn_fd) { ServerRequest request(conn_fd); if (!request.IsOK()) { - WARN_LOG(Log::IO, "Bad request, ignoring."); + WARN_LOG(Log::HTTP, "Bad request, ignoring."); return; } HandleRequest(request); @@ -350,7 +352,7 @@ void Server::HandleRequestDefault(const ServerRequest &request) { } void Server::Handle404(const ServerRequest &request) { - INFO_LOG(Log::IO, "No handler for '%.*s', falling back to 404.", (int)request.resource().size(), request.resource().data()); + INFO_LOG(Log::HTTP, "No handler for '%.*s', falling back to 404.", (int)request.resource().size(), request.resource().data()); const char *payload = "404 not found\r\n"; request.WriteHttpResponseHeader("1.0", 404, strlen(payload)); request.Out()->Push(payload); diff --git a/Common/Net/HTTPServer.h b/Common/Net/HTTPServer.h index 4f117069ae..bc2b2bc6e7 100644 --- a/Common/Net/HTTPServer.h +++ b/Common/Net/HTTPServer.h @@ -96,9 +96,15 @@ public: // if they don't recognize the url. virtual void HandleRequest(const ServerRequest &request); - int Port() { + int ListenerSocket() const { + return listenerSock_; + } + int Port() const { return port_; } + const std::string &LocalAddress() const { + return localAddress_; + } private: bool Listen6(int port, bool ipv6_only, const char *reason); @@ -113,8 +119,9 @@ private: void HandleListing(const ServerRequest &request); void Handle404(const ServerRequest &request); - int listener_; + int listenerSock_; int port_ = 0; + std::string localAddress_; UrlHandlerMap handlers_; UrlHandlerFunc fallback_; diff --git a/Common/Net/Resolve.cpp b/Common/Net/Resolve.cpp index eb3727136d..23d3bf989d 100644 --- a/Common/Net/Resolve.cpp +++ b/Common/Net/Resolve.cpp @@ -113,7 +113,7 @@ void DNSResolveFree(addrinfo *res) freeaddrinfo(res); } -bool GetIPList(std::vector &IP4s) { +bool GetLocalIP4List(std::vector &IP4s) { char ipstr[INET6_ADDRSTRLEN]; // We use IPv6 length since it's longer than IPv4 // getifaddrs first appeared in glibc 2.3, On Android officially supported since __ANDROID_API__ >= 24 #if defined(_IFADDRS_H_) || (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) || (__ANDROID_API__ >= 24) @@ -145,7 +145,7 @@ bool GetIPList(std::vector &IP4s) { return true; } #elif defined(SIOCGIFCONF) // Better detection on Linux/UNIX/MacOS/some Android - INFO_LOG(Log::sceNet, "GetIPList from SIOCGIFCONF"); + INFO_LOG(Log::IO, "GetIPList from SIOCGIFCONF"); static struct ifreq ifreqs[32]; struct ifconf ifc{}; ifc.ifc_req = ifreqs; @@ -153,13 +153,13 @@ bool GetIPList(std::vector &IP4s) { int sd = socket(AF_INET, SOCK_DGRAM, 0); if (sd < 0) { - ERROR_LOG(Log::sceNet, "GetIPList failed to create socket (result = %i, errno = %i)", sd, socket_errno); + ERROR_LOG(Log::IO, "GetIPList failed to create socket (result = %i, errno = %i)", sd, socket_errno); return false; } int r = ioctl(sd, SIOCGIFCONF, (char*)&ifc); if (r != 0) { - ERROR_LOG(Log::sceNet, "GetIPList failed ioctl/SIOCGIFCONF (result = %i, errno = %i)", r, socket_errno); + ERROR_LOG(Log::IO, "GetIPList failed ioctl/SIOCGIFCONF (result = %i, errno = %i)", r, socket_errno); return false; } @@ -175,7 +175,7 @@ bool GetIPList(std::vector &IP4s) { r = ioctl(sd, SIOCGIFADDR, item); if (r != 0) { - ERROR_LOG(Log::sceNet, "GetIPList failed ioctl/SIOCGIFADDR (i = %i, result = %i, errno = %i)", i, r, socket_errno); + ERROR_LOG(Log::IO, "GetIPList failed ioctl/SIOCGIFADDR (i = %i, result = %i, errno = %i)", i, r, socket_errno); } if (ifreqs[i].ifr_addr.sa_family == AF_INET) { @@ -194,8 +194,8 @@ bool GetIPList(std::vector &IP4s) { close(sd); return true; -#else // Fallback to POSIX/Cross-platform way but may not works well on Linux (ie. only shows 127.0.0.1) - INFO_LOG(Log::sceNet, "GetIPList from Fallback"); +#else // Fallback to POSIX/Cross-platform way but may not work well on Linux (ie. only shows 127.0.0.1) + DEBUG_LOG(Log::IO, "GetIPList from fallback method"); struct addrinfo hints, * res, * p; memset(&hints, 0, sizeof hints); hints.ai_family = AF_UNSPEC; // AF_INET or AF_INET6 to force version diff --git a/Common/Net/Resolve.h b/Common/Net/Resolve.h index 5c7958d654..09c2ab168c 100644 --- a/Common/Net/Resolve.h +++ b/Common/Net/Resolve.h @@ -20,7 +20,7 @@ enum class DNSType { bool DNSResolve(const std::string &host, const std::string &service, addrinfo **res, std::string &error, DNSType type = DNSType::ANY); void DNSResolveFree(addrinfo *res); -bool GetIPList(std::vector& IP4s); +bool GetLocalIP4List(std::vector& IP4s); int inet_pton(int af, const char* src, void* dst); diff --git a/Core/WebServer.cpp b/Core/WebServer.cpp index 710479c98e..0fde0fe922 100644 --- a/Core/WebServer.cpp +++ b/Core/WebServer.cpp @@ -73,7 +73,7 @@ static ServerStatus RetrieveStatus() { } // This reports the local IP address to report.ppsspp.org, which can then -// relay that address to a mobile device searching for the server. +// relay that address to a mobile device on the same wifi/LAN searching for the server. static bool RegisterServer(int port) { bool success = false; http::Client http(nullptr); @@ -86,7 +86,7 @@ static bool RegisterServer(int port) { char resource4[1024]{}; if (http.Resolve(REPORT_HOSTNAME, REPORT_PORT, net::DNSType::IPV4)) { if (http.Connect()) { - std::string ip = fd_util::GetLocalIP(http.sock()); + std::string ip = http.GetLocalIpAsString(); snprintf(resource4, sizeof(resource4) - 1, "/match/update?local=%s&port=%d", ip.c_str(), port); if (http.GET(http::RequestParams(resource4), &theVoid, &progress) > 0) @@ -111,7 +111,7 @@ static bool RegisterServer(int port) { // Currently, we're not using keepalive, so gotta reconnect... if (http.Connect(timeout)) { char resource6[1024] = {}; - std::string ip = fd_util::GetLocalIP(http.sock()); + std::string ip = http.GetLocalIpAsString(); snprintf(resource6, sizeof(resource6) - 1, "/match/update?local=%s&port=%d", ip.c_str(), port); if (http.GET(http::RequestParams(resource6), &theVoid, &progress) > 0) @@ -388,6 +388,7 @@ static void HandleFallback(const http::ServerRequest &request) { static void ForwardDebuggerRequest(const http::ServerRequest &request) { SetCurrentThreadName("ForwardDebuggerRequest"); + // Hm, is this needed? AndroidJNIThreadContext jniContext; if (serverFlags & (int)WebServerFlags::DEBUGGER) { @@ -408,7 +409,26 @@ static void ForwardDebuggerRequest(const http::ServerRequest &request) { } } -static void ExecuteWebServer() { +static void HandleUploadUI(const http::ServerRequest &request) { + // Read the file from VFS. + AndroidJNIThreadContext jniContext; + request.WriteHttpResponseHeader("1.0", 200, -1, "text/html"); + request.Out()->Push( + "PPSSPP Remote ISO Upload" + "

Upload ISO File

" + "
" + "" + "" + "
" + ""); +} + +static void HandleUploadPost(const http::ServerRequest &request) { + AndroidJNIThreadContext jniContext; + +} + +static void WebServerThread() { SetCurrentThreadName("HTTPServer"); AndroidJNIThreadContext context; // Destructor detaches. @@ -418,6 +438,8 @@ static void ExecuteWebServer() { // This lists all the (current) recent ISOs. It also handles the debugger, which is very ugly. http->SetFallbackHandler(&HandleFallback); http->RegisterHandler("/debugger", &ForwardDebuggerRequest); + http->RegisterHandler("/upload", &HandleUploadUI); + http->RegisterHandler("/upload_post", &HandleUploadPost); if (!http->Listen(g_Config.iRemoteISOPort, "debugger-webserver")) { if (!http->Listen(0, "debugger-webserver")) { @@ -426,11 +448,14 @@ static void ExecuteWebServer() { return; } } + UpdateStatus(ServerStatus::RUNNING); g_Config.iRemoteISOPort = http->Port(); RegisterServer(http->Port()); double lastRegister = time_now_d(); + + INFO_LOG(Log::HTTP, "Entering web server loop. Listening on port %d", g_Config.iRemoteISOPort); while (RetrieveStatus() == ServerStatus::RUNNING) { constexpr double webServerSliceSeconds = 0.2f; http->RunSlice(webServerSliceSeconds); @@ -440,6 +465,7 @@ static void ExecuteWebServer() { lastRegister = now; } } + INFO_LOG(Log::HTTP, "Leaving web server loop."); http->Stop(); StopAllDebuggers(); @@ -448,11 +474,13 @@ static void ExecuteWebServer() { UpdateStatus(ServerStatus::FINISHED); } +// Only adds flags. bool StartWebServer(WebServerFlags flags) { std::lock_guard guard(serverStatusLock); switch (serverStatus) { case ServerStatus::RUNNING: if ((serverFlags & (int)flags) == (int)flags) { + // Already running with these flags. return false; } serverFlags |= (int)flags; @@ -465,7 +493,7 @@ bool StartWebServer(WebServerFlags flags) { case ServerStatus::STOPPED: serverStatus = ServerStatus::STARTING; serverFlags = (int)flags; - serverThread = std::thread(&ExecuteWebServer); + serverThread = std::thread(&WebServerThread); return true; default: @@ -473,6 +501,7 @@ bool StartWebServer(WebServerFlags flags) { } } +// Only removes flags. bool StopWebServer(WebServerFlags flags) { std::lock_guard guard(serverStatusLock); if (serverStatus != ServerStatus::RUNNING) { @@ -510,3 +539,7 @@ void ShutdownWebServer() { bool WebServerRunning(WebServerFlags flags) { return RetrieveStatus() == ServerStatus::RUNNING && (serverFlags & (int)flags) != 0; } + +int WebServerPort() { + return g_Config.iRemoteISOPort; +} diff --git a/Core/WebServer.h b/Core/WebServer.h index cd0d2cc3ec..26d2f64c71 100644 --- a/Core/WebServer.h +++ b/Core/WebServer.h @@ -23,8 +23,9 @@ enum class WebServerFlags { NONE = 0, DISCS = 1, DEBUGGER = 2, + FILE_UPLOAD = 4, - ALL = 1 | 2, + ALL = 1 | 2 | 4, }; ENUM_CLASS_BITOPS(WebServerFlags); @@ -36,3 +37,4 @@ bool WebServerRunning(WebServerFlags flags); void ShutdownWebServer(); bool RemoteISOFileSupported(const std::string &filename); +int WebServerPort(); diff --git a/UI/DevScreens.cpp b/UI/DevScreens.cpp index 19c5737f72..956916330e 100644 --- a/UI/DevScreens.cpp +++ b/UI/DevScreens.cpp @@ -496,6 +496,9 @@ void ShaderViewScreen::CreateViews() { LinearLayout *topbar = new LinearLayout(ORIENT_HORIZONTAL); topbar->Add(new Choice(ImageID("I_NAVIGATE_BACK"), new LinearLayoutParams()))->OnClick.Handle(this, &UIScreen::OnBack); + topbar->Add(new Choice(ImageID("I_FILE_COPY"), new LinearLayoutParams()))->OnClick.Add([this](UI::EventParams &e) { + System_CopyStringToClipboard(gpu->DebugGetShaderString(id_, type_, SHADER_STRING_SHORT_DESC)); + }); topbar->Add(new TextView(gpu->DebugGetShaderString(id_, type_, SHADER_STRING_SHORT_DESC), FLAG_DYNAMIC_ASCII | FLAG_WRAP_TEXT, false)); layout->Add(topbar); diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index fbb440029b..dc79bd3d4c 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -1874,7 +1874,7 @@ void HostnameSelectScreen::CreatePopupContents(UI::ViewGroup *parent) { } // Add non-editable items listIP.push_back("localhost"); - net::GetIPList(listIP); + net::GetLocalIP4List(listIP); ipRows_ = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0)); ScrollView* scrollView = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index 39d155c46d..e4d0da1bac 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -62,6 +62,7 @@ #include "UI/DisplayLayoutScreen.h" #include "UI/SavedataScreen.h" #include "UI/Store.h" +#include "UI/UploadScreen.h" #include "UI/InstallZipScreen.h" #include "Core/Config.h" #include "Core/Loaders.h" @@ -815,6 +816,12 @@ void GameBrowser::Refresh() { topBar->Add(new Choice(mm->T("PPSSPP Homebrew Store"), new UI::LinearLayoutParams(WRAP_CONTENT, 64.0f)))->OnClick.Handle(this, &GameBrowser::OnHomebrewStore); } + if (browseFlags_ & BrowseFlags::UPLOAD_BUTTON) { + topBar->Add(new Choice(ImageID("I_FOLDER_UPLOAD"), new UI::LinearLayoutParams(WRAP_CONTENT, 64.0f)))->OnClick.Add([this](UI::EventParams &e) { + screenManager_->push(new UploadScreen()); + }); + } + ChoiceStrip *layoutChoice = topBar->Add(new ChoiceStrip(ORIENT_HORIZONTAL)); layoutChoice->AddChoice(ImageID("I_GRID")); layoutChoice->AddChoice(ImageID("I_LINES")); diff --git a/UI/MainScreen.h b/UI/MainScreen.h index 40da0b1945..358c60fca2 100644 --- a/UI/MainScreen.h +++ b/UI/MainScreen.h @@ -38,7 +38,8 @@ enum class BrowseFlags { ARCHIVES = 4, PIN = 8, HOMEBREW_STORE = 16, - STANDARD = 1 | 2 | 4 | 8, + UPLOAD_BUTTON = 32, + STANDARD = 1 | 2 | 4 | 8 | 32, }; ENUM_CLASS_BITOPS(BrowseFlags); diff --git a/UI/UI.vcxproj b/UI/UI.vcxproj index 42ad2df168..551778b5e7 100644 --- a/UI/UI.vcxproj +++ b/UI/UI.vcxproj @@ -75,6 +75,7 @@ + @@ -124,6 +125,7 @@ + diff --git a/UI/UI.vcxproj.filters b/UI/UI.vcxproj.filters index 3d8693dd36..ecbd604bcb 100644 --- a/UI/UI.vcxproj.filters +++ b/UI/UI.vcxproj.filters @@ -129,6 +129,9 @@ ImDebugger + + Screens + @@ -258,6 +261,9 @@ ImDebugger + + Screens + diff --git a/UI/UIAtlas.cpp b/UI/UIAtlas.cpp index 5da10ea751..673a084939 100644 --- a/UI/UIAtlas.cpp +++ b/UI/UIAtlas.cpp @@ -138,6 +138,9 @@ static const ImageMeta imageIDs[] = { {"I_SETTINGS_DISPLAY", false}, {"I_NAVIGATE_BACK", false}, {"I_NAVIGATE_FORWARD", false}, + {"I_FOLDER_UPLOAD", false}, + {"I_FILE", false}, + {"I_FILE_COPY", false}, }; static std::string PNGNameFromID(std::string_view id) { diff --git a/UI/UploadScreen.cpp b/UI/UploadScreen.cpp new file mode 100644 index 0000000000..581e1ebe45 --- /dev/null +++ b/UI/UploadScreen.cpp @@ -0,0 +1,52 @@ +#include "Common/Net/Resolve.h" +#include "Common/System/Request.h" +#include "UI/UploadScreen.h" +#include "Common/StringUtils.h" +#include "Core/WebServer.h" + +UploadScreen::UploadScreen() { + net::GetLocalIP4List(localIPs_); + + StartWebServer(WebServerFlags::FILE_UPLOAD); +} + +UploadScreen::~UploadScreen() { + StopWebServer(WebServerFlags::FILE_UPLOAD); +} + +void UploadScreen::CreateViews() { + using namespace UI; + auto co = GetI18NCategory(I18NCat::NETWORKING); + root_ = new LinearLayout(ORIENT_VERTICAL); + LinearLayout *topBar = new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); + topBar->Add(new Choice(ImageID("I_NAVIGATE_BACK"), new LinearLayoutParams()))->OnClick.Handle(this, &UIScreen::OnBack); + + root_->Add(topBar); + + if (prevRunning_) { + root_->Add(new TextView(co->T("On your other device, connect to the same network, then go to this URL:"))); + for (const auto &ip : localIPs_) { + std::string url = StringFromFormat("http://%s:%d/upload", ip.c_str(), WebServerPort()); + root_->Add(new TextView(url)); + root_->Add(new Choice(ImageID("I_FILE_COPY")))->OnClick.Add([url](UI::EventParams &) { + System_CopyStringToClipboard(url); + }); + } + } else { + root_->Add(new TextView(co->T("Connecting..."))); + } + + //infoText->SetTextAlignment(TEXT_ALIGN_CENTER); + //verticalLayout->AddView(infoText); + //AddStandardBack(verticalLayout); + //root_->AddView(verticalLayout); +} + +void UploadScreen::update() { + UIScreen::update(); + bool running = WebServerRunning(WebServerFlags::FILE_UPLOAD); + if (prevRunning_ != running) { + prevRunning_ = running; + RecreateViews(); + } +} diff --git a/UI/UploadScreen.h b/UI/UploadScreen.h new file mode 100644 index 0000000000..4f4d0bb1cd --- /dev/null +++ b/UI/UploadScreen.h @@ -0,0 +1,47 @@ +#pragma once + +// Copyright (c) 2013- PPSSPP Project. + +// 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, version 2.0 or later versions. + +// 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 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official git repository and contact information can be found at +// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. + +#pragma once + +#include +#include +#include + +#include "Common/UI/UIScreen.h" +#include "Common/UI/ViewGroup.h" +#include "UI/MiscScreens.h" + +// Upload screen: Shows the user an ip address to go to in a web browser on the same network, +// in order to upload game files to the current directory. + +class UploadScreen : public UIDialogScreenWithBackground { +public: + UploadScreen(); + ~UploadScreen(); + void CreateViews() override; + +protected: + void update() override; + + const char *tag() const override { return "Upload"; } + +private: + bool prevRunning_ = false; + std::vector localIPs_; +}; diff --git a/UWP/UI_UWP/UI_UWP.vcxproj b/UWP/UI_UWP/UI_UWP.vcxproj index 4d14b3fa83..a4f785d754 100644 --- a/UWP/UI_UWP/UI_UWP.vcxproj +++ b/UWP/UI_UWP/UI_UWP.vcxproj @@ -132,6 +132,7 @@ + @@ -184,6 +185,7 @@ + Create diff --git a/UWP/UI_UWP/UI_UWP.vcxproj.filters b/UWP/UI_UWP/UI_UWP.vcxproj.filters index f064528ae2..addb46f19c 100644 --- a/UWP/UI_UWP/UI_UWP.vcxproj.filters +++ b/UWP/UI_UWP/UI_UWP.vcxproj.filters @@ -124,6 +124,9 @@ Screens + + Screens + @@ -249,6 +252,9 @@ Screens + + Screens + diff --git a/Windows/main.cpp b/Windows/main.cpp index cf5ab99e4d..db8050dcea 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -433,6 +433,8 @@ bool System_GetPropertyBool(SystemProperty prop) { #else return false; #endif + case SYSPROP_HAS_ACCELEROMETER: + return true; // for debugging default: return false; } diff --git a/android/jni/Android.mk b/android/jni/Android.mk index 519895951a..23c1f27f77 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -922,6 +922,7 @@ LOCAL_SRC_FILES := \ $(SRC)/UI/JoystickHistoryView.cpp \ $(SRC)/UI/GameInfoCache.cpp \ $(SRC)/UI/GameScreen.cpp \ + $(SRC)/UI/UploadScreen.cpp \ $(SRC)/UI/ControlMappingScreen.cpp \ $(SRC)/UI/GameSettingsScreen.cpp \ $(SRC)/UI/DeveloperToolsScreen.cpp \ diff --git a/assets/ui_images/images.svg b/assets/ui_images/images.svg index 9675533ad5..1c0450333c 100644 --- a/assets/ui_images/images.svg +++ b/assets/ui_images/images.svg @@ -24,15 +24,15 @@ inkscape:pagecheckerboard="true" inkscape:deskcolor="#d1d1d1" inkscape:document-units="px" - inkscape:zoom="2.8284272" - inkscape:cx="322.97101" - inkscape:cy="372.46849" + inkscape:zoom="8.0000002" + inkscape:cx="297.18749" + inkscape:cy="545.18749" inkscape:window-width="3379" inkscape:window-height="1941" inkscape:window-x="-9" inkscape:window-y="0" inkscape:window-maximized="0" - inkscape:current-layer="svg1" + inkscape:current-layer="layer1" showgrid="false" /> - Date: Sun, 26 Oct 2025 01:00:11 +0200 Subject: [PATCH 2/7] Basic upload via web browser support, only single file almost works --- CMakeLists.txt | 7 +- Common/Net/HTTPServer.h | 4 + Common/StringUtils.cpp | 10 ++ Common/StringUtils.h | 3 + Core/WebServer.cpp | 194 ++++++++++++++++++++++++++++++++---- Core/WebServer.h | 3 + UI/MainScreen.cpp | 2 +- UI/UploadScreen.cpp | 6 +- UI/UploadScreen.h | 3 +- UWP/UWP.vcxproj | 4 + android/ab.sh | 1 + assets/upload/index.html | 208 +++++++++++++++++++++++++++++++++++++++ ppsspp.iss | 1 + 13 files changed, 420 insertions(+), 26 deletions(-) create mode 100644 assets/upload/index.html diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b95915f1b..bbe6042166 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2772,6 +2772,7 @@ set(NativeAssets assets/asciifont_atlas.zim assets/asciifont_atlas.meta assets/debugger + assets/upload assets/lang assets/shaders assets/themes @@ -2915,6 +2916,7 @@ if(TargetBin) file(GLOB_RECURSE SHADER_FILES assets/shaders/*) file(GLOB_RECURSE THEME_FILE assets/themes/*) file(GLOB_RECURSE DEBUGGER_FILES assets/debugger/*) + file(GLOB_RECURSE WEB_UPLOAD_FILES assets/upload/*) file(GLOB_RECURSE VFPU_FILES assets/vfpu/*) if(NOT IOS) @@ -2926,17 +2928,18 @@ if(TargetBin) set_source_files_properties(${SHADER_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/assets/shaders") set_source_files_properties(${THEME_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/assets/themes") set_source_files_properties(${DEBUGGER_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/assets/debugger") + set_source_files_properties(${WEB_UPLOAD_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/assets/upload") set_source_files_properties(${VFPU_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/assets/vfpu") endif() if(IOS) set(AssetCatalog "${CMAKE_SOURCE_DIR}/ios/assets.xcassets") - add_executable(${TargetBin} MACOSX_BUNDLE ${NativeAssets} ${BigFontAssets} ${UIImages} ${AssetCatalog} ${SHADER_FILES} ${THEME_FILE} ${DEBUGGER_FILES} ${FLASH0_FILES} ${LANG_FILES} ${NativeAppSource} "ios/Settings.bundle" "ios/Launch Screen.storyboard") + add_executable(${TargetBin} MACOSX_BUNDLE ${NativeAssets} ${BigFontAssets} ${UIImages} ${AssetCatalog} ${SHADER_FILES} ${THEME_FILE} ${DEBUGGER_FILES} ${WEB_UPLOAD_FILES} ${FLASH0_FILES} ${LANG_FILES} ${NativeAppSource} "ios/Settings.bundle" "ios/Launch Screen.storyboard") if(NOT IOS_APP_STORE) file(INSTALL "${CMAKE_SOURCE_DIR}/ext/vulkan/iOS/Frameworks/libMoltenVK.dylib" DESTINATION "${CMAKE_BINARY_DIR}/PPSSPP.app/Frameworks/") endif() else() - add_executable(${TargetBin} MACOSX_BUNDLE ${ICON_PATH_ABS} ${NativeAssets} ${BigFontAssets} ${UIImages} ${SHADER_FILES} ${THEME_FILE} ${DEBUGGER_FILES} ${FLASH0_FILES} ${LANG_FILES} ${NativeAppSource}) + add_executable(${TargetBin} MACOSX_BUNDLE ${ICON_PATH_ABS} ${NativeAssets} ${BigFontAssets} ${UIImages} ${SHADER_FILES} ${THEME_FILE} ${DEBUGGER_FILES} ${WEB_UPLOAD_FILES} ${FLASH0_FILES} ${LANG_FILES} ${NativeAppSource}) file(INSTALL "${CMAKE_SOURCE_DIR}/ext/vulkan/macOS/Frameworks/libMoltenVK.dylib" DESTINATION "${CMAKE_BINARY_DIR}/${TargetBin}.app/Contents/Frameworks/") if(USING_QT_UI) add_custom_command(TARGET ${TargetBin} POST_BUILD COMMAND /bin/bash "${CMAKE_SOURCE_DIR}/Qt/macbundle.sh" "${CMAKE_BINARY_DIR}/PPSSPPQt.app") diff --git a/Common/Net/HTTPServer.h b/Common/Net/HTTPServer.h index bc2b2bc6e7..a60b061b7f 100644 --- a/Common/Net/HTTPServer.h +++ b/Common/Net/HTTPServer.h @@ -38,6 +38,10 @@ public: return header_.method; } + const RequestHeader &Header() const { + return header_; + } + bool GetParamValue(const char *param_name, std::string *value) const { return header_.GetParamValue(param_name, value); } diff --git a/Common/StringUtils.cpp b/Common/StringUtils.cpp index d8279380a0..c2d978b5f5 100644 --- a/Common/StringUtils.cpp +++ b/Common/StringUtils.cpp @@ -361,6 +361,16 @@ void SplitString(std::string_view str, const char delim, std::vector &output, bool trimOutput) { size_t next = 0; size_t pos = 0; diff --git a/Common/StringUtils.h b/Common/StringUtils.h index a877f9460c..33f3447fd0 100644 --- a/Common/StringUtils.h +++ b/Common/StringUtils.h @@ -110,6 +110,9 @@ void SplitString(std::string_view str, const char delim, std::vector &output, bool trimOutput = false); +// Splits on the first occurrence of delim. Returns true if the delimiter was found. +bool SplitStringOnce(std::string_view str, std::string_view *firstPart, std::string_view *secondPart, char delim); + void GetQuotedStrings(std::string_view str, std::vector &output); std::string ReplaceAll(std::string_view input, std::string_view src, std::string_view dest); diff --git a/Core/WebServer.cpp b/Core/WebServer.cpp index 0fde0fe922..3b42177215 100644 --- a/Core/WebServer.cpp +++ b/Core/WebServer.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include "Common/Net/HTTPClient.h" #include "Common/Net/HTTPServer.h" @@ -50,7 +51,10 @@ static const int REPORT_PORT = 80; static std::thread serverThread; static ServerStatus serverStatus; static std::mutex serverStatusLock; -static int serverFlags; +static WebServerFlags serverFlags; + +std::mutex g_webServerLock; +static Path g_uploadPath; // TODO: Supply this through registration instead. // NOTE: These *only* encode spaces, which is almost enough. @@ -266,7 +270,7 @@ static void HandleListing(const http::ServerRequest &request) { request.WriteHttpResponseHeader("1.0", 200, -1, "text/plain"); request.Out()->Printf("/\n"); - if (serverFlags & (int)WebServerFlags::DISCS) { + if (serverFlags & WebServerFlags::DISCS) { switch ((RemoteISOShareType)g_Config.iRemoteISOShareType) { case RemoteISOShareType::RECENT: // List the current discs in their recent order. @@ -301,22 +305,30 @@ static void HandleListing(const http::ServerRequest &request) { } } } - if (serverFlags & (int)WebServerFlags::DEBUGGER) { + if (serverFlags & WebServerFlags::DEBUGGER) { request.Out()->Printf("/debugger\n"); } } -static bool ServeDebuggerFile(const http::ServerRequest &request) { +static bool ServeAssetFile(const http::ServerRequest &request) { // Skip the slash at the start of the resource path. std::string_view filename = request.resource().substr(1); - if (filename.find("..") != std::string_view::npos) + if (filename.find("..") != std::string_view::npos) { + // Don't allow directory traversal. return false; + } size_t size; // TODO: ReadFile should take a string_view. uint8_t *data = g_VFS.ReadFile(std::string(filename).c_str(), &size); - if (!data) - return false; + if (!data) { + // Try appending index.html + data = g_VFS.ReadFile((std::string(filename) + "/index.html").c_str(), &size); + if (!data) { + return false; + } + INFO_LOG(Log::HTTP, "Redirected to /index.html"); + } std::string ext = Path(filename).GetFileExtension(); const char *mimeType = "text/plain"; @@ -347,12 +359,13 @@ static void RedirectToDebugger(const http::ServerRequest &request) { request.Out()->Push(payload); } +// TODO: Allow registering ServeAssetFile roots as well. static void HandleFallback(const http::ServerRequest &request) { SetCurrentThreadName("HandleFallback"); AndroidJNIThreadContext jniContext; - if ((serverFlags & (int)WebServerFlags::DEBUGGER) != 0) { + if ((serverFlags & WebServerFlags::DEBUGGER) != 0) { if (request.resource() == "/debugger/") { RedirectToDebugger(request); return; @@ -360,13 +373,21 @@ static void HandleFallback(const http::ServerRequest &request) { // Actually serve debugger files. if (startsWith(request.resource(), "/debugger/")) { - if (ServeDebuggerFile(request)) { + if (ServeAssetFile(request)) { return; } } } - if (serverFlags & (int)WebServerFlags::DISCS) { + if (serverFlags & WebServerFlags::FILE_UPLOAD) { + if (startsWith(request.resource(), "/upload/")) { + if (ServeAssetFile(request)) { + return; + } + } + } + + if (serverFlags & WebServerFlags::DISCS) { std::string_view resource = request.resource(); Path localPath = LocalFromRemotePath(resource); INFO_LOG(Log::Loader, "Serving %.*s from %s", (int)resource.size(), resource.data(), localPath.c_str()); @@ -391,7 +412,7 @@ static void ForwardDebuggerRequest(const http::ServerRequest &request) { // Hm, is this needed? AndroidJNIThreadContext jniContext; - if (serverFlags & (int)WebServerFlags::DEBUGGER) { + if (serverFlags & WebServerFlags::DEBUGGER) { // Check if this is a websocket request... std::string upgrade; if (!request.GetHeader("upgrade", &upgrade)) { @@ -426,6 +447,140 @@ static void HandleUploadUI(const http::ServerRequest &request) { static void HandleUploadPost(const http::ServerRequest &request) { AndroidJNIThreadContext jniContext; + // Do some sanity checks. + if (request.Method() != http::RequestHeader::POST) { + ERROR_LOG(Log::HTTP, "Wrong method"); + return; + } + + Path uploadPath; + { + std::lock_guard guard(g_webServerLock); + uploadPath = g_uploadPath; + } + + // Now start handling things. + std::string contentType; + if (!request.GetHeader("content-type", &contentType)) { + return; + } + size_t bpos = contentType.find("boundary="); + if (bpos == std::string::npos) { + return; + } + const std::string boundary = contentType.substr(bpos + strlen("boundary=")); + + // The total length of the entire multipart thing. + u64 contentLength = request.Header().content_length; + if (contentLength == 0) { + WARN_LOG(Log::HTTP, "Bad content length"); + return; + } + + std::string firstBoundary = request.In()->ReadLine(); + if (firstBoundary != "--" + boundary) { + WARN_LOG(Log::HTTP, "Bad boundary: Expected --%s but got %s", boundary); + return; + } + + std::string disposition = request.In()->ReadLine(); + std::vector parts; + SplitString(disposition, ';', parts); + if (parts.size() < 2 || !startsWith(parts[0], "Content-Disposition: form-data")) { + WARN_LOG(Log::HTTP, "Bad content disposition: %s", disposition); + return; + } + + std::string filename; + + for (const auto &part : parts) { + std::string_view key; + std::string_view value; + if (SplitStringOnce(part, &key, &value, '=')) { + key = StripSpaces(key); + value = StripQuotes(StripSpaces(value)); + if (key == "name") { + INFO_LOG(Log::HTTP, "Upload field name: %.*s", STR_VIEW(value)); + } else if (key == "filename") { + INFO_LOG(Log::HTTP, "Upload filename: %.*s", STR_VIEW(value)); + filename = value; + } + } else if (equalsNoCase(StripSpaces(part), "Content-Disposition: form-data")) { + // this is the first part, ok, ignore. + } else { + WARN_LOG(Log::HTTP, "Bad content disposition part: %.*s", STR_VIEW(part)); + } + } + + if (filename.empty()) { + ERROR_LOG(Log::HTTP, "Didn't receive a filename"); + return; + } + + std::string fileContentType = request.In()->ReadLine(); + std::string secondBoundary = request.In()->ReadLine(); + + Path destPath = uploadPath / filename; + + if (File::Exists(destPath)) { + INFO_LOG(Log::HTTP, "File already exists: %s", destPath.ToVisualString().c_str()); + return; + } + + // Make sure the destination exists. + File::CreateFullPath(destPath.NavigateUp()); + + INFO_LOG(Log::HTTP, "Receiving '%s', writing to '%s' (%d bytes)...", filename.c_str(), destPath.ToVisualString().c_str()); + + // OK, enter a loop where we read some data until we hit the boundary again. + // The boundary is chosen to be "unique" and unlikely to appear in the file. We trust that. + Buffer buffer; + FILE *fp = File::OpenCFile(destPath, "wb"); + if (!fp) { + ERROR_LOG(Log::HTTP, "Failed to open destination file '%s' for writing", destPath.ToVisualString().c_str()); + return; + } + u64 bytesWritten = 0; + while (true) { + // NOTE: Lines here can be extremely long, especially in compressed data. So we should split ReadLine up if needed. + std::string line = request.In()->ReadLine(); + if (line == "--" + boundary || line == "--" + boundary + "--") { + INFO_LOG(Log::HTTP, "Line matches boundary, breaking."); + // Done. + break; + } + // Write the line and a newline (since we ate it). TODO: This could be avoided. + size_t len = line.size(); + if (fwrite(line.data(), 1, len, fp) != len || fwrite("\r\n", 1, 2, fp) != 2) { + ERROR_LOG(Log::HTTP, "Failed to write %d bytes to destination file '%s' - bailing", (int)len, destPath.ToVisualString().c_str()); + fclose(fp); + return; + } + bytesWritten += line.size(); + } + + INFO_LOG(Log::HTTP, "Total bytes written: %d", (int)bytesWritten); + fclose(fp); + + // NOTE: We already read the boundary above. + + // Now the buffer should be empty. + if (!request.In()->Empty()) { + WARN_LOG(Log::HTTP, "We didn't drain the request."); + std::string extraLine = request.In()->ReadLine(); + INFO_LOG(Log::HTTP, "Extra line: %s", extraLine.c_str()); + } + + INFO_LOG(Log::HTTP, "Upload of '%s' complete.", filename.c_str()); + // request.WriteHttpResponseHeader("1.0", 200, -1, "text/plain"); + + const size_t blockSize = 16 * 1024; + +} + +void WebServerSetUploadPath(const Path &path) { + std::lock_guard guard(g_webServerLock); + g_uploadPath = path; } static void WebServerThread() { @@ -438,8 +593,7 @@ static void WebServerThread() { // This lists all the (current) recent ISOs. It also handles the debugger, which is very ugly. http->SetFallbackHandler(&HandleFallback); http->RegisterHandler("/debugger", &ForwardDebuggerRequest); - http->RegisterHandler("/upload", &HandleUploadUI); - http->RegisterHandler("/upload_post", &HandleUploadPost); + http->RegisterHandler("/upload_file", &HandleUploadPost); if (!http->Listen(g_Config.iRemoteISOPort, "debugger-webserver")) { if (!http->Listen(0, "debugger-webserver")) { @@ -479,11 +633,11 @@ bool StartWebServer(WebServerFlags flags) { std::lock_guard guard(serverStatusLock); switch (serverStatus) { case ServerStatus::RUNNING: - if ((serverFlags & (int)flags) == (int)flags) { + if (((int)serverFlags & (int)flags) == (int)flags) { // Already running with these flags. return false; } - serverFlags |= (int)flags; + serverFlags |= flags; return true; case ServerStatus::FINISHED: @@ -492,7 +646,7 @@ bool StartWebServer(WebServerFlags flags) { case ServerStatus::STOPPED: serverStatus = ServerStatus::STARTING; - serverFlags = (int)flags; + serverFlags = flags; serverThread = std::thread(&WebServerThread); return true; @@ -508,8 +662,8 @@ bool StopWebServer(WebServerFlags flags) { return false; } - serverFlags &= ~(int)flags; - if (serverFlags == 0) { + serverFlags &= ~flags; + if (serverFlags == WebServerFlags::NONE) { serverStatus = ServerStatus::STOPPING; } return true; @@ -523,7 +677,7 @@ bool WebServerStopping(WebServerFlags flags) { bool WebServerStopped(WebServerFlags flags) { std::lock_guard guard(serverStatusLock); if (serverStatus == ServerStatus::RUNNING) { - return (serverFlags & (int)flags) == 0; + return !(serverFlags & flags); } return serverStatus == ServerStatus::STOPPED || serverStatus == ServerStatus::FINISHED; } @@ -537,7 +691,7 @@ void ShutdownWebServer() { } bool WebServerRunning(WebServerFlags flags) { - return RetrieveStatus() == ServerStatus::RUNNING && (serverFlags & (int)flags) != 0; + return RetrieveStatus() == ServerStatus::RUNNING && (serverFlags & flags) != 0; } int WebServerPort() { diff --git a/Core/WebServer.h b/Core/WebServer.h index 26d2f64c71..37320ef8f8 100644 --- a/Core/WebServer.h +++ b/Core/WebServer.h @@ -19,6 +19,8 @@ #include "Common/Common.h" +class Path; + enum class WebServerFlags { NONE = 0, DISCS = 1, @@ -37,4 +39,5 @@ bool WebServerRunning(WebServerFlags flags); void ShutdownWebServer(); bool RemoteISOFileSupported(const std::string &filename); +void WebServerSetUploadPath(const Path &path); int WebServerPort(); diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index e4d0da1bac..fe830b3937 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -818,7 +818,7 @@ void GameBrowser::Refresh() { if (browseFlags_ & BrowseFlags::UPLOAD_BUTTON) { topBar->Add(new Choice(ImageID("I_FOLDER_UPLOAD"), new UI::LinearLayoutParams(WRAP_CONTENT, 64.0f)))->OnClick.Add([this](UI::EventParams &e) { - screenManager_->push(new UploadScreen()); + screenManager_->push(new UploadScreen(path_.GetPath())); }); } diff --git a/UI/UploadScreen.cpp b/UI/UploadScreen.cpp index 581e1ebe45..b7c1390891 100644 --- a/UI/UploadScreen.cpp +++ b/UI/UploadScreen.cpp @@ -4,9 +4,9 @@ #include "Common/StringUtils.h" #include "Core/WebServer.h" -UploadScreen::UploadScreen() { +UploadScreen::UploadScreen(const Path &targetFolder) : targetFolder_(targetFolder) { net::GetLocalIP4List(localIPs_); - + WebServerSetUploadPath(targetFolder); StartWebServer(WebServerFlags::FILE_UPLOAD); } @@ -36,6 +36,8 @@ void UploadScreen::CreateViews() { root_->Add(new TextView(co->T("Connecting..."))); } + root_->Add(new TextView(std::string(co->T("Uploading to: ")) + targetFolder_.ToVisualString())); + //infoText->SetTextAlignment(TEXT_ALIGN_CENTER); //verticalLayout->AddView(infoText); //AddStandardBack(verticalLayout); diff --git a/UI/UploadScreen.h b/UI/UploadScreen.h index 4f4d0bb1cd..f2824c6778 100644 --- a/UI/UploadScreen.h +++ b/UI/UploadScreen.h @@ -32,7 +32,7 @@ class UploadScreen : public UIDialogScreenWithBackground { public: - UploadScreen(); + UploadScreen(const Path &targetFolder); ~UploadScreen(); void CreateViews() override; @@ -44,4 +44,5 @@ protected: private: bool prevRunning_ = false; std::vector localIPs_; + Path targetFolder_; }; diff --git a/UWP/UWP.vcxproj b/UWP/UWP.vcxproj index 69117afafc..34ad349efd 100644 --- a/UWP/UWP.vcxproj +++ b/UWP/UWP.vcxproj @@ -311,6 +311,10 @@ true Content\vfpu\%(Filename)%(Extension) + + true + Content\upload\%(Filename)%(Extension) + true Content\debugger\%(Filename)%(Extension) diff --git a/android/ab.sh b/android/ab.sh index 3c9028bc64..761fc088b9 100755 --- a/android/ab.sh +++ b/android/ab.sh @@ -4,6 +4,7 @@ cp -r ../assets/lang assets/ cp -r ../assets/shaders assets/ cp -r ../assets/themes assets/ cp -r ../assets/debugger assets/ +cp -r ../assets/upload assets/ cp -r ../assets/ui_images assets/ cp ../assets/*.ini assets/ cp ../assets/Roboto-Condensed.ttf assets/Roboto-Condensed.ttf diff --git a/assets/upload/index.html b/assets/upload/index.html new file mode 100644 index 0000000000..0f0522ed6c --- /dev/null +++ b/assets/upload/index.html @@ -0,0 +1,208 @@ + + + + + File/Folder Uploader + + + + +

Upload Files or Folders

+ + + +
+ + +
+ + +
+ + +
+ +
+ +
+ + + + diff --git a/ppsspp.iss b/ppsspp.iss index ca028eedfb..4846e2f862 100644 --- a/ppsspp.iss +++ b/ppsspp.iss @@ -99,6 +99,7 @@ Source: "assets\*.*"; DestDir: "{app}\assets" Source: "assets\shaders\*.*"; DestDir: "{app}\assets\shaders" Source: "assets\themes\*.*"; DestDir: "{app}\assets\themes" Source: "assets\debugger\*"; DestDir: "{app}\assets\debugger"; Flags: recursesubdirs +Source: "assets\upload\*"; DestDir: "{app}\assets\upload"; Flags: recursesubdirs Source: "assets\lang\*.ini"; DestDir: "{app}\assets\lang" Source: "assets\flash0\font\*.*"; DestDir: "{app}\assets\flash0\font" Source: "assets\vfpu\*.*"; DestDir: "{app}\assets\vfpu" From 9abd8c21e12977b9707441af4f1485def06c2a36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 26 Oct 2025 13:50:39 +0100 Subject: [PATCH 3/7] Finish implementing the multipart protocol, now multi file uploads work without corruption. --- Common/Net/Sinks.cpp | 34 +++++- Common/Net/Sinks.h | 18 ++- Common/StringUtils.cpp | 24 ++++ Common/StringUtils.h | 2 + Common/TimeUtil.h | 2 +- Core/WebServer.cpp | 223 +++++++++++++++++++++++++++----------- Core/WebServer.h | 10 ++ UI/MainScreen.cpp | 3 + UI/UploadScreen.cpp | 17 +++ UI/UploadScreen.h | 2 + Windows/WASAPIContext.cpp | 5 +- unittest/UnitTest.cpp | 18 +++ 12 files changed, 288 insertions(+), 70 deletions(-) diff --git a/Common/Net/Sinks.cpp b/Common/Net/Sinks.cpp index 73f2afc0a8..0c8e485e85 100644 --- a/Common/Net/Sinks.cpp +++ b/Common/Net/Sinks.cpp @@ -9,6 +9,7 @@ #include "Common/Net/Sinks.h" #include "Common/Log.h" +#include "Common/StringUtils.h" #include "Common/File/FileDescriptor.h" #ifndef MSG_NOSIGNAL @@ -44,10 +45,41 @@ bool InputSink::ReadLineWithEnding(std::string &s) { memcpy(&s[0], buf_ + read_, newline + 1); } AccountDrain(newline + 1); - return true; } +std::pair InputSink::BufferParts() const { + if (read_ + valid_ <= BUFFER_SIZE) { + return {std::string_view(buf_ + read_, valid_), std::string_view()}; + } else { + size_t firstPartSize = BUFFER_SIZE - read_; + size_t secondPartSize = valid_ - firstPartSize; + return {std::string_view(buf_ + read_, firstPartSize), std::string_view(buf_, secondPartSize)}; + } +} + +size_t InputSink::ReadBinaryUntilTerminator(char *dest, size_t bufSize, std::string_view terminator, bool *didReadTerminator) { + Block(); + + auto [part1, part2] = BufferParts(); + size_t offset = SplitSearch(terminator, part1, part2); + if (offset == std::string_view::npos) { + *didReadTerminator = false; + // Not found, read as much as we can - but leave space for the terminator + const s64 toRead = std::min((s64)valid_, (s64)bufSize - (s64)terminator.length()); + TakeExact(dest, toRead); + return toRead; + } else { + // Terminator found! Read right up to it, and then skip it. + *didReadTerminator = true; + _dbg_assert_(offset < valid_); + TakeExact(dest, offset); + Skip(terminator.size()); + _dbg_assert_(valid_ >= 0); + return offset; + } +} + std::string InputSink::ReadLineWithEnding() { std::string s; ReadLineWithEnding(s); diff --git a/Common/Net/Sinks.h b/Common/Net/Sinks.h index b42c441eb7..990bc5f7ce 100644 --- a/Common/Net/Sinks.h +++ b/Common/Net/Sinks.h @@ -21,20 +21,36 @@ public: bool Skip(size_t bytes); void Discard(); + size_t ReadBinaryUntilTerminator(char *dest, size_t bufSize, std::string_view terminator, bool *didReadTerminator); + bool Empty() const; bool TryFill(); + size_t ValidAmount() const { + return valid_; + } + + // Size of the internal buffer. Useful for some clients. + enum { + BUFFER_SIZE = 32 * 1024, + }; + private: + std::pair BufferParts() const; void Fill(); bool Block(); void AccountFill(int bytes); void AccountDrain(size_t bytes); size_t FindNewline() const; - static const size_t BUFFER_SIZE = 32 * 1024; static const size_t PRESSURE = 8 * 1024; size_t fd_; + + // Circular buffer. read_ is the position to read from, write_ is the position to write to, + // valid_ is the number of valid bytes. valid_ can wrap around, so you might need to take + // two segments when reading and split when writing. + char buf_[BUFFER_SIZE]; size_t read_; size_t write_; diff --git a/Common/StringUtils.cpp b/Common/StringUtils.cpp index c2d978b5f5..e0dd997664 100644 --- a/Common/StringUtils.cpp +++ b/Common/StringUtils.cpp @@ -557,3 +557,27 @@ void MakeUnique(std::vector &v) { } v.swap(result); } + +size_t SplitSearch(std::string_view needle, std::string_view part1, std::string_view part2) { + if (part1.find(needle) != std::string_view::npos) { + // Easy case, found in part1. + return part1.find(needle); + } + size_t part1Size = part1.size(); + size_t maxOverlap = std::min(needle.size() - 1, part1Size); + for (size_t overlap = maxOverlap; overlap > 0; overlap--) { + if (part1.substr(part1Size - overlap) == needle.substr(0, overlap)) { + // Found an overlap. + size_t remaining = needle.size() - overlap; + if (part2.substr(0, remaining) == needle.substr(overlap)) { + return part1Size - overlap; + } + } + } + // Now, check if it's found in part2 instead. + size_t posInPart2 = part2.find(needle); + if (posInPart2 != std::string_view::npos) { + return part1Size + posInPart2; + } + return std::string_view::npos; +} diff --git a/Common/StringUtils.h b/Common/StringUtils.h index 33f3447fd0..3aa0bd0e63 100644 --- a/Common/StringUtils.h +++ b/Common/StringUtils.h @@ -154,6 +154,8 @@ inline void CharArrayFromFormat(char (& out)[Count], const char* format, ...) void MakeUnique(std::vector &vec); +size_t SplitSearch(std::string_view needle, std::string_view part1, std::string_view part2); + // Replaces %1, %2, %3 in format with arg1, arg2, arg3. // Much safer than snprintf and friends. // For mixes of strings and ints, manually convert the ints to strings. diff --git a/Common/TimeUtil.h b/Common/TimeUtil.h index 3a4ba44afe..84fe433ee5 100644 --- a/Common/TimeUtil.h +++ b/Common/TimeUtil.h @@ -37,6 +37,7 @@ void GetCurrentTimeFormatted(char formattedTime[13]); // Most accurate timer possible - no extra double conversions. Only for spans. class Instant { public: + Instant(); static Instant Now() { return Instant(); } @@ -44,7 +45,6 @@ public: double ElapsedMs() const { return ElapsedSeconds() * 1000.0; } int64_t ElapsedNanos() const; private: - Instant(); uint64_t nativeStart_; #ifndef _WIN32 int64_t nsecs_; diff --git a/Core/WebServer.cpp b/Core/WebServer.cpp index 3b42177215..cce8e42172 100644 --- a/Core/WebServer.cpp +++ b/Core/WebServer.cpp @@ -55,9 +55,21 @@ static WebServerFlags serverFlags; std::mutex g_webServerLock; static Path g_uploadPath; // TODO: Supply this through registration instead. +static std::atomic g_uploadSessionId(1); +std::map g_uploadsInProgress; // NOTE: These *only* encode spaces, which is almost enough. +std::vector GetUploadsInProgress() { + std::lock_guard guard(g_webServerLock); + std::vector uploads; + uploads.reserve(g_uploadsInProgress.size()); + for (const auto &pair : g_uploadsInProgress) { + uploads.push_back(pair.second); + } + return uploads; +} + std::string ServerUriEncode(std::string_view plain) { return ReplaceAll(plain, " ", "%20"); } @@ -444,51 +456,40 @@ static void HandleUploadUI(const http::ServerRequest &request) { ""); } -static void HandleUploadPost(const http::ServerRequest &request) { - AndroidJNIThreadContext jniContext; - - // Do some sanity checks. - if (request.Method() != http::RequestHeader::POST) { - ERROR_LOG(Log::HTTP, "Wrong method"); - return; - } - - Path uploadPath; - { +class ProgressTracker { +public: + ProgressTracker(int sessionId) : sessionId_(sessionId) { std::lock_guard guard(g_webServerLock); - uploadPath = g_uploadPath; + g_uploadsInProgress[sessionId_] = UploadProgress(); } + ~ProgressTracker() { + std::lock_guard guard(g_webServerLock); + g_uploadsInProgress.erase(sessionId_); + } +private: + int sessionId_; +}; - // Now start handling things. - std::string contentType; - if (!request.GetHeader("content-type", &contentType)) { - return; - } - size_t bpos = contentType.find("boundary="); - if (bpos == std::string::npos) { - return; - } - const std::string boundary = contentType.substr(bpos + strlen("boundary=")); - - // The total length of the entire multipart thing. - u64 contentLength = request.Header().content_length; - if (contentLength == 0) { - WARN_LOG(Log::HTTP, "Bad content length"); - return; - } +enum class MultiPartResult { + MoveToNext, + RequestError, + LocalError, + Done, +}; +static MultiPartResult HandleMultipartPart(const http::ServerRequest &request, std::string boundary, const Path &uploadPath, ProgressTracker &progress) { std::string firstBoundary = request.In()->ReadLine(); if (firstBoundary != "--" + boundary) { - WARN_LOG(Log::HTTP, "Bad boundary: Expected --%s but got %s", boundary); - return; + WARN_LOG(Log::HTTP, "Bad boundary: Expected --%s but got %s", boundary.c_str()); + return MultiPartResult::RequestError; } std::string disposition = request.In()->ReadLine(); std::vector parts; SplitString(disposition, ';', parts); if (parts.size() < 2 || !startsWith(parts[0], "Content-Disposition: form-data")) { - WARN_LOG(Log::HTTP, "Bad content disposition: %s", disposition); - return; + WARN_LOG(Log::HTTP, "Bad content disposition: %s", disposition.c_str()); + return MultiPartResult::RequestError; } std::string filename; @@ -514,7 +515,7 @@ static void HandleUploadPost(const http::ServerRequest &request) { if (filename.empty()) { ERROR_LOG(Log::HTTP, "Didn't receive a filename"); - return; + return MultiPartResult::RequestError; } std::string fileContentType = request.In()->ReadLine(); @@ -522,60 +523,150 @@ static void HandleUploadPost(const http::ServerRequest &request) { Path destPath = uploadPath / filename; + bool dryRun = false; if (File::Exists(destPath)) { - INFO_LOG(Log::HTTP, "File already exists: %s", destPath.ToVisualString().c_str()); - return; + INFO_LOG(Log::HTTP, "File already exists, entering dry run mode: %s", destPath.ToVisualString().c_str()); + dryRun = true; } // Make sure the destination exists. File::CreateFullPath(destPath.NavigateUp()); - INFO_LOG(Log::HTTP, "Receiving '%s', writing to '%s' (%d bytes)...", filename.c_str(), destPath.ToVisualString().c_str()); + INFO_LOG(Log::HTTP, "Receiving '%s', writing to '%s' (unknown number of bytes)...", filename.c_str(), destPath.ToVisualString().c_str()); // OK, enter a loop where we read some data until we hit the boundary again. // The boundary is chosen to be "unique" and unlikely to appear in the file. We trust that. - Buffer buffer; - FILE *fp = File::OpenCFile(destPath, "wb"); - if (!fp) { - ERROR_LOG(Log::HTTP, "Failed to open destination file '%s' for writing", destPath.ToVisualString().c_str()); - return; + FILE *fp = nullptr; + if (!dryRun) { + fp = File::OpenCFile(destPath, "wb"); + if (!fp) { + ERROR_LOG(Log::HTTP, "Failed to open destination file '%s' for writing, entering dry run mode.", destPath.ToVisualString().c_str()); + dryRun = true; // We still want to keep reading the input stream - there might be more files following. + } } - u64 bytesWritten = 0; + + u64 bytesTransferred = 0; + char buffer[net::InputSink::BUFFER_SIZE]; while (true) { - // NOTE: Lines here can be extremely long, especially in compressed data. So we should split ReadLine up if needed. - std::string line = request.In()->ReadLine(); - if (line == "--" + boundary || line == "--" + boundary + "--") { - INFO_LOG(Log::HTTP, "Line matches boundary, breaking."); - // Done. + bool terminatorFound = false; + size_t readBytes = request.In()->ReadBinaryUntilTerminator(buffer, sizeof(buffer), "\r\n--" + boundary, &terminatorFound); + if (fp) { + if (fwrite(buffer, 1, readBytes, fp) != readBytes) { + ERROR_LOG(Log::HTTP, "Failed to write %d bytes to destination file '%s' - disk full?", (int)readBytes, destPath.ToVisualString().c_str()); + fclose(fp); + return MultiPartResult::RequestError; + } + } + bytesTransferred += readBytes; + if (terminatorFound) { + INFO_LOG(Log::HTTP, "Found terminator, skipping and proceeding."); break; } - // Write the line and a newline (since we ate it). TODO: This could be avoided. - size_t len = line.size(); - if (fwrite(line.data(), 1, len, fp) != len || fwrite("\r\n", 1, 2, fp) != 2) { - ERROR_LOG(Log::HTTP, "Failed to write %d bytes to destination file '%s' - bailing", (int)len, destPath.ToVisualString().c_str()); - fclose(fp); - return; - } - bytesWritten += line.size(); } - INFO_LOG(Log::HTTP, "Total bytes written: %d", (int)bytesWritten); - fclose(fp); + INFO_LOG(Log::HTTP, "Total bytes transferred: %d", (int)bytesTransferred); + if (fp) { + fclose(fp); + } // NOTE: We already read the boundary above. + // However if this is the last part, the boundary will have "--\r\n" after it, otherwise there will be a line break. + // So, let's read two more bytes, to see if it's "--" or "\r\n". + std::string ending(2, 'x'); + request.In()->TakeExact(ending.data(), 2); + + if (ending == "--") { + INFO_LOG(Log::HTTP, "Upload of '%s' complete, '--' encountered. %d bytes left in buffer.", filename.c_str(), (int)request.In()->ValidAmount()); + // Read the final \r\n. + std::string finalCRLF; + finalCRLF.resize(2); + request.In()->TakeExact(finalCRLF.data(), 2); + if (finalCRLF != "\r\n") { + // Not a big deal, but log it. + WARN_LOG(Log::HTTP, "Expected final CRLF after ending '--', got '%02x %02x'", finalCRLF[0], finalCRLF[1]); + } + return MultiPartResult::Done; + } else if (ending == "\r\n") { + INFO_LOG(Log::HTTP, "Upload of '%s' complete, continuing to next part.", filename.c_str()); + return MultiPartResult::MoveToNext; + } else { + WARN_LOG(Log::HTTP, "Unexpected upload ending: '%s'. Bailing.", ending.c_str()); + return MultiPartResult::RequestError; + } +} + +// Handles a POST to upload a file. +// This uses the HTTP multipart protocol, which is arcane and complicated, unfortunately. +static void HandleUploadPost(const http::ServerRequest &request) { + AndroidJNIThreadContext jniContext; + + // Do some sanity checks. + if (request.Method() != http::RequestHeader::POST) { + ERROR_LOG(Log::HTTP, "Wrong method"); + return; + } + + Path uploadPath; + { + std::lock_guard guard(g_webServerLock); + uploadPath = g_uploadPath; + } + + if (uploadPath.empty()) { + ERROR_LOG(Log::HTTP, "HandleUploadPost should not happen while uploadPath is empty"); + return; + } + + // Now start handling things. + std::string contentType; + if (!request.GetHeader("content-type", &contentType)) { + return; + } + size_t bpos = contentType.find("boundary="); + if (bpos == std::string::npos) { + return; + } + const std::string boundary = contentType.substr(bpos + strlen("boundary=")); + + // The total length of the entire multipart thing. + u64 contentLength = request.Header().content_length; + if (contentLength == 0) { + WARN_LOG(Log::HTTP, "Bad content length"); + return; + } + + const int sessionId = g_uploadSessionId.fetch_add(1); + + ProgressTracker progress(sessionId); + while (true) { + MultiPartResult result = HandleMultipartPart(request, boundary, uploadPath, progress); + switch (result) { + case MultiPartResult::Done: + goto exitLoop; + case MultiPartResult::RequestError: + request.WriteHttpResponseHeader("1.0", 400, -1, "text/plain"); // Bad request + return; + case MultiPartResult::LocalError: + request.WriteHttpResponseHeader("1.0", 500, -1, "text/plain"); // Server error + // Disk full etc. + return; + case MultiPartResult::MoveToNext: + // Else just continue to the next part. + break; + } + } +exitLoop: // Now the buffer should be empty. if (!request.In()->Empty()) { - WARN_LOG(Log::HTTP, "We didn't drain the request."); - std::string extraLine = request.In()->ReadLine(); - INFO_LOG(Log::HTTP, "Extra line: %s", extraLine.c_str()); + size_t remaining = request.In()->ValidAmount(); + WARN_LOG(Log::HTTP, "We didn't fully drain the request (%d bytes still buffered)", (int)remaining); + // std::string extraBytes; + // extraBytes.resize(remaining); + // request.In()->TakeExact(extraBytes.data(), remaining); } - INFO_LOG(Log::HTTP, "Upload of '%s' complete.", filename.c_str()); - // request.WriteHttpResponseHeader("1.0", 200, -1, "text/plain"); - - const size_t blockSize = 16 * 1024; - + request.WriteHttpResponseHeader("1.0", 200, -1, "text/plain"); } void WebServerSetUploadPath(const Path &path) { diff --git a/Core/WebServer.h b/Core/WebServer.h index 37320ef8f8..1613f365d8 100644 --- a/Core/WebServer.h +++ b/Core/WebServer.h @@ -17,6 +17,7 @@ #pragma once +#include #include "Common/Common.h" class Path; @@ -41,3 +42,12 @@ void ShutdownWebServer(); bool RemoteISOFileSupported(const std::string &filename); void WebServerSetUploadPath(const Path &path); int WebServerPort(); + +struct UploadProgress { + size_t uploadedBytes = 0; + size_t totalBytes = 0; + size_t uploadedFiles = 0; // we don't know the count ahead of time + std::string currentFilename; +}; + +std::vector GetUploadsInProgress(); diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index fe830b3937..6ea5d06b27 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -1584,6 +1584,9 @@ void MainScreen::dialogFinished(const Screen *dialog, DialogResult result) { } else if (tag == "IAP") { // Gold status may have changed. RecreateViews(); + } else if (tag == "Upload") { + // Files may have been uploaded. + RecreateViews(); } } diff --git a/UI/UploadScreen.cpp b/UI/UploadScreen.cpp index b7c1390891..2613542431 100644 --- a/UI/UploadScreen.cpp +++ b/UI/UploadScreen.cpp @@ -1,5 +1,6 @@ #include "Common/Net/Resolve.h" #include "Common/System/Request.h" +#include "Common/File/DiskFree.h" #include "UI/UploadScreen.h" #include "Common/StringUtils.h" #include "Core/WebServer.h" @@ -38,6 +39,16 @@ void UploadScreen::CreateViews() { root_->Add(new TextView(std::string(co->T("Uploading to: ")) + targetFolder_.ToVisualString())); + // Show information about current upload streams (there can be multiple, but normally it's just one + // where files are uploaded sequentially). + std::vector uploads = GetUploadsInProgress(); + for (const auto &upload : uploads) { + std::string uploadText = StringFromFormat("%zu / %zu bytes uploaded (%zu files). Current file: %s", + upload.uploadedBytes, upload.totalBytes, upload.uploadedFiles, + upload.currentFilename.c_str()); + root_->Add(new TextView(uploadText)); + } + //infoText->SetTextAlignment(TEXT_ALIGN_CENTER); //verticalLayout->AddView(infoText); //AddStandardBack(verticalLayout); @@ -51,4 +62,10 @@ void UploadScreen::update() { prevRunning_ = running; RecreateViews(); } + + // Update in-progress uploads approximately every half second. + if (lastUpdate_.ElapsedSeconds() > 0.5) { + RecreateViews(); + lastUpdate_ = Instant::Now(); + } } diff --git a/UI/UploadScreen.h b/UI/UploadScreen.h index f2824c6778..8e17d7cdaa 100644 --- a/UI/UploadScreen.h +++ b/UI/UploadScreen.h @@ -26,6 +26,7 @@ #include "Common/UI/UIScreen.h" #include "Common/UI/ViewGroup.h" #include "UI/MiscScreens.h" +#include "Common/TimeUtil.h" // Upload screen: Shows the user an ip address to go to in a web browser on the same network, // in order to upload game files to the current directory. @@ -45,4 +46,5 @@ private: bool prevRunning_ = false; std::vector localIPs_; Path targetFolder_; + Instant lastUpdate_; }; diff --git a/Windows/WASAPIContext.cpp b/Windows/WASAPIContext.cpp index ee83385cf1..c9c125483b 100644 --- a/Windows/WASAPIContext.cpp +++ b/Windows/WASAPIContext.cpp @@ -12,6 +12,7 @@ #include "Common/Data/Encoding/Utf8.h" #include "Common/Log.h" +#include "Common/Thread/ThreadUtil.h" #include "WASAPIContext.h" using Microsoft::WRL::ComPtr; @@ -308,6 +309,8 @@ void WASAPIContext::FrameUpdate(bool allowAutoChange) { } void WASAPIContext::AudioLoop() { + SetCurrentThreadName("WASAPIAudioLoop"); + DWORD taskID = 0; HANDLE mmcssHandle = nullptr; if (latencyMode_ == LatencyMode::Aggressive) { @@ -323,7 +326,7 @@ void WASAPIContext::AudioLoop() { audioClient_->GetBufferSize(&available); } - AudioFormat format = Classify(format_); + const AudioFormat format = Classify(format_); const int nChannels = format_->nChannels; while (running_) { diff --git a/unittest/UnitTest.cpp b/unittest/UnitTest.cpp index 4cca6b8ccb..24696e714c 100644 --- a/unittest/UnitTest.cpp +++ b/unittest/UnitTest.cpp @@ -1232,6 +1232,23 @@ bool TestVolumeFunc() { return true; } +bool TestSplitSearch() { + std::string part1 = "The quick brown fox jumps"; + std::string part2 = " over the lazy dog."; + + size_t offset = SplitSearch("jumps over", part1, part2); + EXPECT_EQ_INT(offset, 20); + offset = SplitSearch("quick", part1, part2); + EXPECT_EQ_INT(offset, 4); + offset = SplitSearch(" over", part1, part2); + EXPECT_EQ_INT(offset, 25); + offset = SplitSearch("fox jumps", part1, part2); + EXPECT_EQ_INT(offset, 16); + offset = SplitSearch("dog.", part1, part2); + EXPECT_EQ_INT(offset, 40); + return true; +} + typedef bool (*TestFunc)(); struct TestItem { const char *name; @@ -1301,6 +1318,7 @@ TestItem availableTests[] = { TEST_ITEM(SIMD), TEST_ITEM(CrossSIMD), TEST_ITEM(VolumeFunc), + TEST_ITEM(SplitSearch), }; int main(int argc, const char *argv[]) { From d2c9104eff8a19d30becc319d6a91fe4168843a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 26 Oct 2025 23:59:40 +0100 Subject: [PATCH 4/7] Polish and fixes to the upload form. --- Common/Net/Sinks.cpp | 2 +- Common/System/System.h | 1 + Core/WebServer.cpp | 93 +++++++++-- Windows/main.cpp | 12 ++ assets/upload/index.html | 333 +++++++++++++++++++++++---------------- 5 files changed, 284 insertions(+), 157 deletions(-) diff --git a/Common/Net/Sinks.cpp b/Common/Net/Sinks.cpp index 0c8e485e85..3183ead35c 100644 --- a/Common/Net/Sinks.cpp +++ b/Common/Net/Sinks.cpp @@ -59,7 +59,7 @@ std::pair InputSink::BufferParts() const { } size_t InputSink::ReadBinaryUntilTerminator(char *dest, size_t bufSize, std::string_view terminator, bool *didReadTerminator) { - Block(); + Fill(); auto [part1, part2] = BufferParts(); size_t offset = SplitSearch(terminator, part1, part2); diff --git a/Common/System/System.h b/Common/System/System.h index 084614d4de..ce3a2b779d 100644 --- a/Common/System/System.h +++ b/Common/System/System.h @@ -145,6 +145,7 @@ enum SystemProperty { SYSPROP_CLIPBOARD_TEXT, SYSPROP_GPUDRIVER_VERSION, SYSPROP_BUILD_VERSION, + SYSPROP_COMPUTER_NAME, // Separate SD cards or similar. // Need hacky solutions to get at this. diff --git a/Core/WebServer.cpp b/Core/WebServer.cpp index cce8e42172..ab5891dcc0 100644 --- a/Core/WebServer.cpp +++ b/Core/WebServer.cpp @@ -32,6 +32,7 @@ #include "Common/File/VFS/VFS.h" #include "Common/TimeUtil.h" #include "Common/StringUtils.h" +#include "Common/System/System.h" #include "Core/Util/RecentFiles.h" #include "Core/Config.h" #include "Core/Debugger/WebSocket.h" @@ -322,6 +323,45 @@ static void HandleListing(const http::ServerRequest &request) { } } +std::string RenderTemplate(std::string_view input, const std::map& values) { + std::string output; + output.reserve(input.size()); + + size_t i = 0; + while (i < input.size()) { + if (i + 3 < input.size() && input[i] == '{' && input[i + 1] == '{') { + size_t end = input.find("}}", i + 2); + if (end != std::string_view::npos) { + // Trim whitespace around key + size_t startKey = i + 2; + while (startKey < end && std::isspace(static_cast(input[startKey]))) + startKey++; + size_t endKey = end; + while (endKey > startKey && std::isspace(static_cast(input[endKey - 1]))) + endKey--; + + std::string key(input.substr(startKey, endKey - startKey)); + + auto it = values.find(key); + if (it != values.end()) { + output += it->second; + } else { + // Keep the original placeholder if key not found + output.append(input.substr(i, end + 2 - i)); + } + + i = end + 2; + continue; + } + } + + output.push_back(input[i]); + ++i; + } + + return output; +} + static bool ServeAssetFile(const http::ServerRequest &request) { // Skip the slash at the start of the resource path. std::string_view filename = request.resource().substr(1); @@ -330,20 +370,8 @@ static bool ServeAssetFile(const http::ServerRequest &request) { return false; } - size_t size; - // TODO: ReadFile should take a string_view. - uint8_t *data = g_VFS.ReadFile(std::string(filename).c_str(), &size); - if (!data) { - // Try appending index.html - data = g_VFS.ReadFile((std::string(filename) + "/index.html").c_str(), &size); - if (!data) { - return false; - } - INFO_LOG(Log::HTTP, "Redirected to /index.html"); - } - std::string ext = Path(filename).GetFileExtension(); - const char *mimeType = "text/plain"; + std::string_view mimeType = "text/plain"; if (ext == ".html") { mimeType = "text/html"; } else if (ext == ".ico") { @@ -358,10 +386,43 @@ static bool ServeAssetFile(const http::ServerRequest &request) { mimeType = "text/css"; } - request.WriteHttpResponseHeader("1.0", 200, size, mimeType); - request.Out()->Push((char *)data, size); + size_t size; + // TODO: ReadFile should take a string_view. + uint8_t *data = g_VFS.ReadFile(std::string(filename).c_str(), &size); + if (!data) { + // Try appending index.html + data = g_VFS.ReadFile((std::string(filename) + "/index.html").c_str(), &size); + mimeType = "text/html"; + if (!data) { + return false; + } + INFO_LOG(Log::HTTP, "Redirected to /index.html"); + } + std::string html = std::string((const char *)data, size); delete[] data; + + // This is a gross, gross hack to have here in ServeAssetFile, but oh well. + if (mimeType == "text/html") { + if (html.find("") != std::string::npos) { + std::string uploadPath = g_uploadPath.ToVisualString(); + std::string deviceName = System_GetProperty(SYSPROP_NAME); + std::string computerName = System_GetProperty(SYSPROP_COMPUTER_NAME); + if (!computerName.empty()) { + deviceName = computerName; + } + std::map values = { + {"upload_path", uploadPath}, + {"device_name", deviceName}, + }; + // Use templating to insert some information. + html = RenderTemplate(html, values); + } + } + + request.WriteHttpResponseHeader("1.0", 200, html.size(), std::string(mimeType).c_str()); + request.Out()->Push(html.data(), html.size()); + return true; } @@ -392,7 +453,7 @@ static void HandleFallback(const http::ServerRequest &request) { } if (serverFlags & WebServerFlags::FILE_UPLOAD) { - if (startsWith(request.resource(), "/upload/")) { + if (startsWith(request.resource(), "/upload")) { if (ServeAssetFile(request)) { return; } diff --git a/Windows/main.cpp b/Windows/main.cpp index db8050dcea..1240f65f98 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -115,6 +115,7 @@ static std::string langRegion; static std::string osName; static std::string osVersion; static std::string gpuDriverVersion; +static std::string computerName; static std::string restartArgs; @@ -253,6 +254,17 @@ std::string System_GetProperty(SystemProperty prop) { return PPSSPP_GIT_VERSION; case SYSPROP_USER_DOCUMENTS_DIR: return Path(W32Util::UserDocumentsPath()).ToString(); // this'll reverse the slashes. + case SYSPROP_COMPUTER_NAME: + if (computerName.empty()) { + wchar_t nameBuf[MAX_COMPUTERNAME_LENGTH + 1]; + DWORD size = ARRAY_SIZE(nameBuf); + if (GetComputerNameW(nameBuf, &size)) { + computerName = ConvertWStringToUTF8(std::wstring(nameBuf, size)); + } else { + computerName = "(N/A)"; + } + } + return computerName; default: return ""; } diff --git a/assets/upload/index.html b/assets/upload/index.html index 0f0522ed6c..b17a35c7fa 100644 --- a/assets/upload/index.html +++ b/assets/upload/index.html @@ -1,208 +1,261 @@ + + - - File/Folder Uploader + + File Uploader - -

Upload Files or Folders

+

Upload files to {{ device_name }}

- - -
- - -
- +

To folder:

{{ upload_path }}

-
- - -
- +
+ + +
-
+
+ +
+ +
+ + +
+
From fa64598b4fc502c7f6a035d6540fab8a0f904259 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 27 Oct 2025 00:21:10 +0100 Subject: [PATCH 5/7] More polish --- Core/WebServer.cpp | 19 +++++++++++++++++++ Core/WebServer.h | 8 +++++--- UI/UploadScreen.cpp | 7 +------ assets/upload/index.html | 1 + 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/Core/WebServer.cpp b/Core/WebServer.cpp index ab5891dcc0..2309239aaf 100644 --- a/Core/WebServer.cpp +++ b/Core/WebServer.cpp @@ -33,6 +33,7 @@ #include "Common/TimeUtil.h" #include "Common/StringUtils.h" #include "Common/System/System.h" +#include "Common/System/OSD.h" #include "Core/Util/RecentFiles.h" #include "Core/Config.h" #include "Core/Debugger/WebSocket.h" @@ -527,6 +528,18 @@ public: std::lock_guard guard(g_webServerLock); g_uploadsInProgress.erase(sessionId_); } + void SetFile(std::string_view filename, size_t size) { + std::lock_guard guard(g_webServerLock); + auto &upload = g_uploadsInProgress[sessionId_]; + upload.currentFilename = filename; + upload.currentFileSize = size; + upload.uploadedFiles++; + upload.totalBytesBeforeCurrentFile = upload.uploadedBytes; + } + void AddBytes(size_t bytes) { + std::lock_guard guard(g_webServerLock); + g_uploadsInProgress[sessionId_].uploadedBytes += bytes; + } private: int sessionId_; }; @@ -566,6 +579,8 @@ static MultiPartResult HandleMultipartPart(const http::ServerRequest &request, s } else if (key == "filename") { INFO_LOG(Log::HTTP, "Upload filename: %.*s", STR_VIEW(value)); filename = value; + } else if (key == "fileSize") { + INFO_LOG(Log::HTTP, "Upload filesize: %.*s", STR_VIEW(value)); } } else if (equalsNoCase(StripSpaces(part), "Content-Disposition: form-data")) { // this is the first part, ok, ignore. @@ -606,6 +621,7 @@ static MultiPartResult HandleMultipartPart(const http::ServerRequest &request, s } } + progress.SetFile(filename); u64 bytesTransferred = 0; char buffer[net::InputSink::BUFFER_SIZE]; while (true) { @@ -618,6 +634,7 @@ static MultiPartResult HandleMultipartPart(const http::ServerRequest &request, s return MultiPartResult::RequestError; } } + progress.AddBytes(readBytes); bytesTransferred += readBytes; if (terminatorFound) { INFO_LOG(Log::HTTP, "Found terminator, skipping and proceeding."); @@ -630,6 +647,8 @@ static MultiPartResult HandleMultipartPart(const http::ServerRequest &request, s fclose(fp); } + g_OSD.Show(OSDType::, StringFromFormat("Uploaded '%s' (%d bytes)", filename.c_str(), (int)bytesTransferred), 5.0f); + // NOTE: We already read the boundary above. // However if this is the last part, the boundary will have "--\r\n" after it, otherwise there will be a line break. // So, let's read two more bytes, to see if it's "--" or "\r\n". diff --git a/Core/WebServer.h b/Core/WebServer.h index 1613f365d8..36e2bf4e3f 100644 --- a/Core/WebServer.h +++ b/Core/WebServer.h @@ -44,9 +44,11 @@ void WebServerSetUploadPath(const Path &path); int WebServerPort(); struct UploadProgress { - size_t uploadedBytes = 0; - size_t totalBytes = 0; - size_t uploadedFiles = 0; // we don't know the count ahead of time + s64 uploadedBytes = 0; + s64 totalBytes = 0; + s64 uploadedFiles = 0; // we don't know the count ahead of time + s64 currentFileSize = 0; + s64 totalBytesBeforeCurrentFile = 0; std::string currentFilename; }; diff --git a/UI/UploadScreen.cpp b/UI/UploadScreen.cpp index 2613542431..3a04bcef49 100644 --- a/UI/UploadScreen.cpp +++ b/UI/UploadScreen.cpp @@ -43,16 +43,11 @@ void UploadScreen::CreateViews() { // where files are uploaded sequentially). std::vector uploads = GetUploadsInProgress(); for (const auto &upload : uploads) { - std::string uploadText = StringFromFormat("%zu / %zu bytes uploaded (%zu files). Current file: %s", + std::string uploadText = StringFromFormat("%zu / %zu total bytes (%zu files). Current: %s", upload.uploadedBytes, upload.totalBytes, upload.uploadedFiles, upload.currentFilename.c_str()); root_->Add(new TextView(uploadText)); } - - //infoText->SetTextAlignment(TEXT_ALIGN_CENTER); - //verticalLayout->AddView(infoText); - //AddStandardBack(verticalLayout); - //root_->AddView(verticalLayout); } void UploadScreen::update() { diff --git a/assets/upload/index.html b/assets/upload/index.html index b17a35c7fa..febdd98621 100644 --- a/assets/upload/index.html +++ b/assets/upload/index.html @@ -252,6 +252,7 @@ // Try to preserve any directory structure, if supported. const formData = new FormData(); formData.append("file", file, file.webkitRelativePath || file.name); + formData.append("fileSize", file.size.toString()); xhr.send(formData); }); } From 068f055a3636edd68c9f7c6768163c27a1817496 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 27 Oct 2025 10:44:17 +0100 Subject: [PATCH 6/7] langtool dep bump --- Tools/langtool/Cargo.lock | 58 +++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/Tools/langtool/Cargo.lock b/Tools/langtool/Cargo.lock index 8f84ae05ee..4ae92b3a49 100644 --- a/Tools/langtool/Cargo.lock +++ b/Tools/langtool/Cargo.lock @@ -108,9 +108,9 @@ checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" [[package]] name = "cc" -version = "1.2.41" +version = "1.2.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac9fe6cdbb24b6ade63616c0a0688e45bb56732262c158df3c0c4bea4ca47cb7" +checksum = "739eb0f94557554b3ca9a86d2d37bebd49c5e6d0c1d2bda35ba5bdac830befc2" dependencies = [ "find-msvc-tools", "shlex", @@ -124,9 +124,9 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "clap" -version = "4.5.49" +version = "4.5.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4512b90fa68d3a9932cea5184017c5d200f5921df706d45e853537dea51508f" +checksum = "0c2cfd7bf8a6017ddaa4e32ffe7403d547790db06bd171c1c53926faab501623" dependencies = [ "clap_builder", "clap_derive", @@ -134,9 +134,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.49" +version = "4.5.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0025e98baa12e766c67ba13ff4695a887a1eba19569aad00a472546795bd6730" +checksum = "0a4c05b9e80c5ccd3a7ef080ad7b6ba7d6fc00a985b8b157197075677c82c7a0" dependencies = [ "anstream", "anstyle", @@ -153,7 +153,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.107", + "syn 2.0.108", ] [[package]] @@ -228,7 +228,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.107", + "syn 2.0.108", ] [[package]] @@ -689,9 +689,9 @@ dependencies = [ [[package]] name = "is_terminal_polyfill" -version = "1.70.1" +version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" [[package]] name = "itoa" @@ -868,9 +868,9 @@ checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] name = "once_cell_polyfill" -version = "1.70.1" +version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" [[package]] name = "openssl" @@ -895,7 +895,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.107", + "syn 2.0.108", ] [[package]] @@ -971,9 +971,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.101" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" +checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" dependencies = [ "unicode-ident", ] @@ -1064,9 +1064,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.33" +version = "0.23.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "751e04a496ca00bb97a5e043158d23d66b5aabf2e1d5aa2a0aaebb1aafe6f82c" +checksum = "6a9586e9ee2b4f8fab52a0048ca7334d7024eef48e2cb9407e3497bb7cab7fa7" dependencies = [ "once_cell", "rustls-pki-types", @@ -1166,7 +1166,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.107", + "syn 2.0.108", ] [[package]] @@ -1259,9 +1259,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.107" +version = "2.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a26dbd934e5451d21ef060c018dae56fc073894c5a7896f882928a76e6d081b" +checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917" dependencies = [ "proc-macro2", "quote", @@ -1285,7 +1285,7 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.107", + "syn 2.0.108", ] [[package]] @@ -1339,7 +1339,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.107", + "syn 2.0.108", ] [[package]] @@ -1483,9 +1483,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "unicode-ident" -version = "1.0.19" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d" +checksum = "462eeb75aeb73aea900253ce739c8e18a67423fadf006037cd3ff27e82748a06" [[package]] name = "untrusted" @@ -1570,7 +1570,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.107", + "syn 2.0.108", "wasm-bindgen-shared", ] @@ -1605,7 +1605,7 @@ checksum = "9f07d2f20d4da7b26400c9f4a0511e6e0345b040694e8a75bd41d578fa4421d7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.107", + "syn 2.0.108", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2003,7 +2003,7 @@ checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.107", + "syn 2.0.108", "synstructure", ] @@ -2024,7 +2024,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn 2.0.107", + "syn 2.0.108", "synstructure", ] @@ -2064,5 +2064,5 @@ checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.107", + "syn 2.0.108", ] From b1d14d8221533761f0e7b4d27740f058e4c5c3c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 27 Oct 2025 11:41:08 +0100 Subject: [PATCH 7/7] More upload UI polish --- Common/Render/TextureAtlas.cpp | 2 +- Common/Render/TextureAtlas.h | 21 ++-- Core/WebServer.cpp | 46 ++++----- Core/WebServer.h | 6 +- UI/GameInfoCache.cpp | 1 + UI/UIAtlas.cpp | 2 + UI/UploadScreen.cpp | 92 ++++++++++++++---- UI/UploadScreen.h | 2 + assets/lang/ar_AE.ini | 2 + assets/lang/az_AZ.ini | 2 + assets/lang/be_BY.ini | 2 + assets/lang/bg_BG.ini | 2 + assets/lang/ca_ES.ini | 2 + assets/lang/cz_CZ.ini | 2 + assets/lang/da_DK.ini | 2 + assets/lang/de_DE.ini | 2 + assets/lang/dr_ID.ini | 2 + assets/lang/en_US.ini | 2 + assets/lang/es_ES.ini | 2 + assets/lang/es_LA.ini | 2 + assets/lang/fa_IR.ini | 2 + assets/lang/fi_FI.ini | 2 + assets/lang/fr_FR.ini | 2 + assets/lang/gl_ES.ini | 2 + assets/lang/gr_EL.ini | 2 + assets/lang/he_IL.ini | 2 + assets/lang/he_IL_invert.ini | 2 + assets/lang/hr_HR.ini | 2 + assets/lang/hu_HU.ini | 2 + assets/lang/id_ID.ini | 2 + assets/lang/it_IT.ini | 2 + assets/lang/ja_JP.ini | 2 + assets/lang/jv_ID.ini | 2 + assets/lang/ko_KR.ini | 2 + assets/lang/ku_SO.ini | 2 + assets/lang/lo_LA.ini | 2 + assets/lang/lt-LT.ini | 2 + assets/lang/ms_MY.ini | 2 + assets/lang/nl_NL.ini | 2 + assets/lang/no_NO.ini | 2 + assets/lang/pl_PL.ini | 2 + assets/lang/pt_BR.ini | 2 + assets/lang/pt_PT.ini | 2 + assets/lang/ro_RO.ini | 2 + assets/lang/ru_RU.ini | 2 + assets/lang/sv_SE.ini | 2 + assets/lang/tg_PH.ini | 2 + assets/lang/th_TH.ini | 2 + assets/lang/tr_TR.ini | 2 + assets/lang/uk_UA.ini | 2 + assets/lang/vi_VN.ini | 2 + assets/lang/zh_CN.ini | 2 + assets/lang/zh_TW.ini | 2 + assets/ui_images/images.svg | 45 +++++++-- assets/upload/index.html | 173 ++++++++++++++++++++++++++++++--- 55 files changed, 400 insertions(+), 80 deletions(-) diff --git a/Common/Render/TextureAtlas.cpp b/Common/Render/TextureAtlas.cpp index d30fe86c5f..627dd89c96 100644 --- a/Common/Render/TextureAtlas.cpp +++ b/Common/Render/TextureAtlas.cpp @@ -106,7 +106,7 @@ const AtlasImage *Atlas::getImage(ImageID name) const { return nullptr; for (int i = 0; i < num_images; i++) { - if (!strcmp(name.id, images[i].name)) + if (name.id == images[i].name) return &images[i]; } return nullptr; diff --git a/Common/Render/TextureAtlas.h b/Common/Render/TextureAtlas.h index e9b778deda..493a73c3ba 100644 --- a/Common/Render/TextureAtlas.h +++ b/Common/Render/TextureAtlas.h @@ -3,6 +3,8 @@ #include #include +#include + #define ATLAS_MAGIC ('A' | ('T' << 8) | ('L' << 16) | ('A' << 24)) // Metadata file structure v0: @@ -21,34 +23,31 @@ struct Atlas; struct ImageID { public: - ImageID() : id(nullptr) {} - explicit ImageID(const char *_id) : id(_id) {} + ImageID() {} + explicit ImageID(std::string_view _id) : id(_id) {} static inline ImageID invalid() { - return ImageID{ nullptr }; + return ImageID{""}; } bool isValid() const { - return id != nullptr; + return !id.empty(); } bool isInvalid() const { - return id == nullptr; + return id.empty(); } bool operator ==(const ImageID &other) { - return (id == other.id) || !strcmp(id, other.id); + return id == other.id; } bool operator !=(const ImageID &other) { - if (id == other.id) { - return false; - } - return strcmp(id, other.id) != 0; + return id != other.id; } private: - const char *id; + std::string_view id; friend struct Atlas; }; diff --git a/Core/WebServer.cpp b/Core/WebServer.cpp index 2309239aaf..ecd558703c 100644 --- a/Core/WebServer.cpp +++ b/Core/WebServer.cpp @@ -30,6 +30,7 @@ #include "Common/File/FileDescriptor.h" #include "Common/File/DirListing.h" #include "Common/File/VFS/VFS.h" +#include "Common/Data/Text/I18n.h" #include "Common/TimeUtil.h" #include "Common/StringUtils.h" #include "Common/System/System.h" @@ -454,7 +455,13 @@ static void HandleFallback(const http::ServerRequest &request) { } if (serverFlags & WebServerFlags::FILE_UPLOAD) { - if (startsWith(request.resource(), "/upload")) { + Path uploadPath; + { + std::lock_guard guard(g_webServerLock); + uploadPath = g_uploadPath; + } + + if (startsWith(request.resource(), "/upload") && !uploadPath.empty()) { if (ServeAssetFile(request)) { return; } @@ -504,25 +511,11 @@ static void ForwardDebuggerRequest(const http::ServerRequest &request) { } } -static void HandleUploadUI(const http::ServerRequest &request) { - // Read the file from VFS. - AndroidJNIThreadContext jniContext; - request.WriteHttpResponseHeader("1.0", 200, -1, "text/html"); - request.Out()->Push( - "PPSSPP Remote ISO Upload" - "

Upload ISO File

" - "
" - "" - "" - "
" - ""); -} - class ProgressTracker { public: - ProgressTracker(int sessionId) : sessionId_(sessionId) { + ProgressTracker(int sessionId, s64 totalSize) : sessionId_(sessionId) { std::lock_guard guard(g_webServerLock); - g_uploadsInProgress[sessionId_] = UploadProgress(); + g_uploadsInProgress[sessionId_] = UploadProgress{totalSize}; } ~ProgressTracker() { std::lock_guard guard(g_webServerLock); @@ -531,10 +524,9 @@ public: void SetFile(std::string_view filename, size_t size) { std::lock_guard guard(g_webServerLock); auto &upload = g_uploadsInProgress[sessionId_]; - upload.currentFilename = filename; + upload.filename = filename; upload.currentFileSize = size; - upload.uploadedFiles++; - upload.totalBytesBeforeCurrentFile = upload.uploadedBytes; + upload.uploadedBytes = 0; } void AddBytes(size_t bytes) { std::lock_guard guard(g_webServerLock); @@ -559,6 +551,8 @@ static MultiPartResult HandleMultipartPart(const http::ServerRequest &request, s } std::string disposition = request.In()->ReadLine(); + + INFO_LOG(Log::HTTP, "Disposition: %s", disposition.c_str()); std::vector parts; SplitString(disposition, ';', parts); if (parts.size() < 2 || !startsWith(parts[0], "Content-Disposition: form-data")) { @@ -621,7 +615,7 @@ static MultiPartResult HandleMultipartPart(const http::ServerRequest &request, s } } - progress.SetFile(filename); + progress.SetFile(filename, 0); u64 bytesTransferred = 0; char buffer[net::InputSink::BUFFER_SIZE]; while (true) { @@ -631,6 +625,8 @@ static MultiPartResult HandleMultipartPart(const http::ServerRequest &request, s if (fwrite(buffer, 1, readBytes, fp) != readBytes) { ERROR_LOG(Log::HTTP, "Failed to write %d bytes to destination file '%s' - disk full?", (int)readBytes, destPath.ToVisualString().c_str()); fclose(fp); + // Delete the partially written file, so the user doesn't try to play it. + File::Delete(destPath); return MultiPartResult::RequestError; } } @@ -647,7 +643,8 @@ static MultiPartResult HandleMultipartPart(const http::ServerRequest &request, s fclose(fp); } - g_OSD.Show(OSDType::, StringFromFormat("Uploaded '%s' (%d bytes)", filename.c_str(), (int)bytesTransferred), 5.0f); + auto n = GetI18NCategory(I18NCat::NETWORKING); + g_OSD.Show(OSDType::MESSAGE_SUCCESS, ApplySafeSubstitutions(n->T("File transfer complete: %1"), filename)); // NOTE: We already read the boundary above. // However if this is the last part, the boundary will have "--\r\n" after it, otherwise there will be a line break. @@ -708,7 +705,7 @@ static void HandleUploadPost(const http::ServerRequest &request) { } const std::string boundary = contentType.substr(bpos + strlen("boundary=")); - // The total length of the entire multipart thing. + // The total length of the entire multipart thing. This is just above the full size of the upload, so let's use it for progress. u64 contentLength = request.Header().content_length; if (contentLength == 0) { WARN_LOG(Log::HTTP, "Bad content length"); @@ -717,7 +714,7 @@ static void HandleUploadPost(const http::ServerRequest &request) { const int sessionId = g_uploadSessionId.fetch_add(1); - ProgressTracker progress(sessionId); + ProgressTracker progress(sessionId, contentLength); while (true) { MultiPartResult result = HandleMultipartPart(request, boundary, uploadPath, progress); switch (result) { @@ -728,7 +725,6 @@ static void HandleUploadPost(const http::ServerRequest &request) { return; case MultiPartResult::LocalError: request.WriteHttpResponseHeader("1.0", 500, -1, "text/plain"); // Server error - // Disk full etc. return; case MultiPartResult::MoveToNext: // Else just continue to the next part. diff --git a/Core/WebServer.h b/Core/WebServer.h index 36e2bf4e3f..9fd1f4f807 100644 --- a/Core/WebServer.h +++ b/Core/WebServer.h @@ -44,12 +44,10 @@ void WebServerSetUploadPath(const Path &path); int WebServerPort(); struct UploadProgress { - s64 uploadedBytes = 0; s64 totalBytes = 0; - s64 uploadedFiles = 0; // we don't know the count ahead of time + s64 uploadedBytes = 0; s64 currentFileSize = 0; - s64 totalBytesBeforeCurrentFile = 0; - std::string currentFilename; + std::string filename; }; std::vector GetUploadsInProgress(); diff --git a/UI/GameInfoCache.cpp b/UI/GameInfoCache.cpp index 6b0a5a8388..87da296dad 100644 --- a/UI/GameInfoCache.cpp +++ b/UI/GameInfoCache.cpp @@ -150,6 +150,7 @@ bool GameInfo::Delete() { case IdentifiedFileType::ARCHIVE_RAR: case IdentifiedFileType::ARCHIVE_ZIP: case IdentifiedFileType::ARCHIVE_7Z: + case IdentifiedFileType::UNKNOWN: case IdentifiedFileType::PPSSPP_GE_DUMP: { const Path &fileToRemove = filePath_; diff --git a/UI/UIAtlas.cpp b/UI/UIAtlas.cpp index 673a084939..9a57a20777 100644 --- a/UI/UIAtlas.cpp +++ b/UI/UIAtlas.cpp @@ -141,6 +141,8 @@ static const ImageMeta imageIDs[] = { {"I_FOLDER_UPLOAD", false}, {"I_FILE", false}, {"I_FILE_COPY", false}, + {"I_WEB_BROWSER", false}, + {"I_WIFI", false}, }; static std::string PNGNameFromID(std::string_view id) { diff --git a/UI/UploadScreen.cpp b/UI/UploadScreen.cpp index 3a04bcef49..bea69b4a0c 100644 --- a/UI/UploadScreen.cpp +++ b/UI/UploadScreen.cpp @@ -1,9 +1,52 @@ +#include #include "Common/Net/Resolve.h" #include "Common/System/Request.h" #include "Common/File/DiskFree.h" -#include "UI/UploadScreen.h" #include "Common/StringUtils.h" +#include "Common/Data/Text/Parsers.h" #include "Core/WebServer.h" +#include "UI/UploadScreen.h" + +// Compound view, showing a text with an icon. +class TextWithImage : public UI::LinearLayout { +public: + TextWithImage(ImageID imageID, std::string_view text, UI::LinearLayoutParams *layoutParams = nullptr); +}; + +TextWithImage::TextWithImage(ImageID imageID, std::string_view text, UI::LinearLayoutParams *layoutParams) : UI::LinearLayout(UI::ORIENT_HORIZONTAL, layoutParams) { + using namespace UI; + SetSpacing(8.0f); + if (!layoutParams) { + layoutParams_->width = FILL_PARENT; + layoutParams_->height = ITEM_HEIGHT; + } + if (imageID.isValid()) { + Add(new ImageView(imageID, "", UI::IS_DEFAULT, new LinearLayoutParams(0.0f, UI::Gravity::G_VCENTER))); + } + Add(new TextView(text, new LinearLayoutParams(1.0f, UI::Gravity::G_VCENTER))); +} + +// Compound view, showing a copyable string. +class CopyableText : public UI::LinearLayout { +public: + CopyableText(ImageID imageID, std::string_view text, UI::LinearLayoutParams *layoutParams = nullptr); +}; + +CopyableText::CopyableText(ImageID imageID, std::string_view text, UI::LinearLayoutParams *layoutParams) : UI::LinearLayout(UI::ORIENT_HORIZONTAL, layoutParams) { + using namespace UI; + SetSpacing(8.0f); + if (!layoutParams) { + layoutParams_->width = FILL_PARENT; + layoutParams_->height = ITEM_HEIGHT; + } + if (imageID.isValid()) { + Add(new ImageView(imageID, "", UI::IS_DEFAULT, new LinearLayoutParams(0.0f, UI::Gravity::G_VCENTER))); + } + Add(new TextView(text, new LinearLayoutParams(1.0f, UI::Gravity::G_VCENTER)))->SetBig(true); + Add(new Choice(ImageID("I_FILE_COPY"), new LinearLayoutParams()))->OnClick.Add([text](UI::EventParams &) { + System_CopyStringToClipboard(text); + }); +} UploadScreen::UploadScreen(const Path &targetFolder) : targetFolder_(targetFolder) { net::GetLocalIP4List(localIPs_); @@ -17,36 +60,47 @@ UploadScreen::~UploadScreen() { void UploadScreen::CreateViews() { using namespace UI; - auto co = GetI18NCategory(I18NCat::NETWORKING); + auto n = GetI18NCategory(I18NCat::NETWORKING); root_ = new LinearLayout(ORIENT_VERTICAL); - LinearLayout *topBar = new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); - topBar->Add(new Choice(ImageID("I_NAVIGATE_BACK"), new LinearLayoutParams()))->OnClick.Handle(this, &UIScreen::OnBack); + LinearLayout *topBar = new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); root_->Add(topBar); + topBar->Add(new Choice(ImageID("I_NAVIGATE_BACK"), new LinearLayoutParams()))->OnClick.Handle(this, &UIScreen::OnBack); + + LinearLayout *container = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(500, FILL_PARENT, 0.0f, UI::Gravity::G_HCENTER, Margins(10))); + root_->Add(container); + + container->Add(new TextWithImage(ImageID("I_FOLDER_UPLOAD"), targetFolder_.ToVisualString())); + container->Add(new Spacer(20.0f)); + if (prevRunning_) { - root_->Add(new TextView(co->T("On your other device, connect to the same network, then go to this URL:"))); + container->Add(new TextWithImage(ImageID("I_WIFI"), n->T("With a web browser on the same network, go to:"))); for (const auto &ip : localIPs_) { std::string url = StringFromFormat("http://%s:%d/upload", ip.c_str(), WebServerPort()); - root_->Add(new TextView(url)); - root_->Add(new Choice(ImageID("I_FILE_COPY")))->OnClick.Add([url](UI::EventParams &) { - System_CopyStringToClipboard(url); - }); + container->Add(new CopyableText(ImageID("I_WEB_BROWSER"), url)); } - } else { - root_->Add(new TextView(co->T("Connecting..."))); } - root_->Add(new TextView(std::string(co->T("Uploading to: ")) + targetFolder_.ToVisualString())); + statusContainer_ = new LinearLayout(ORIENT_VERTICAL); + container->Add(statusContainer_); +} +void UploadScreen::RecreateStatus() { + if (!statusContainer_) { + return; + } + + using namespace UI; + statusContainer_->Clear(); // Show information about current upload streams (there can be multiple, but normally it's just one // where files are uploaded sequentially). std::vector uploads = GetUploadsInProgress(); for (const auto &upload : uploads) { - std::string uploadText = StringFromFormat("%zu / %zu total bytes (%zu files). Current: %s", - upload.uploadedBytes, upload.totalBytes, upload.uploadedFiles, - upload.currentFilename.c_str()); - root_->Add(new TextView(uploadText)); + int percent = upload.totalBytes == 0 ? 0 : (int)(ceil(100.0 * (double)upload.uploadedBytes / (double)upload.totalBytes)); + std::string uploadText = StringFromFormat("%s: %s/%s (%d%%)", upload.filename.c_str(), + NiceSizeFormat(upload.uploadedBytes).c_str(), NiceSizeFormat(upload.totalBytes).c_str(), percent); + statusContainer_->Add(new TextWithImage(ImageID("I_FILE"), uploadText)); } } @@ -58,9 +112,9 @@ void UploadScreen::update() { RecreateViews(); } - // Update in-progress uploads approximately every half second. - if (lastUpdate_.ElapsedSeconds() > 0.5) { - RecreateViews(); + // Update in-progress uploads approximately every quarter of a second. + if (lastUpdate_.ElapsedSeconds() > 0.25) { + RecreateStatus(); lastUpdate_ = Instant::Now(); } } diff --git a/UI/UploadScreen.h b/UI/UploadScreen.h index 8e17d7cdaa..b5acafe555 100644 --- a/UI/UploadScreen.h +++ b/UI/UploadScreen.h @@ -43,8 +43,10 @@ protected: const char *tag() const override { return "Upload"; } private: + void RecreateStatus(); bool prevRunning_ = false; std::vector localIPs_; Path targetFolder_; Instant lastUpdate_; + UI::ViewGroup *statusContainer_ = nullptr; }; diff --git a/assets/lang/ar_AE.ini b/assets/lang/ar_AE.ini index 502c3566f3..a61c80e46e 100644 --- a/assets/lang/ar_AE.ini +++ b/assets/lang/ar_AE.ini @@ -975,6 +975,7 @@ Error = فشل Failed to Bind Localhost IP = Failed to bind localhost IP Failed to Bind Port = Failed to bind port Failed to connect to Adhoc Server = Failed to connect to ad hoc server +File transfer completed: %1 = اکتمال نقل الملف: %1 Forced First Connect = Forced first connect (faster connect) GM: Data from Unknown Port = GM: Data from Unknown Port Hostname = اسم المستضيف @@ -1008,6 +1009,7 @@ UPnP need to be reinitialized = UPnP need to be reinitialized UPnP use original port = UPnP use original port (enabled = PSP compatibility) UseOriginalPort Tip = May not work for all devices or games, see wiki. Validating address... = Validating address... +With a web browser on the same network, go to: = باستخدام متصفح ويب على نفس الشبكة، انتقل إلى: WLAN Channel = WLAN channel You're in Offline Mode, go to lobby or online hall = You're in offline mode, go to lobby or online hall diff --git a/assets/lang/az_AZ.ini b/assets/lang/az_AZ.ini index 979e521c3b..77e56211e3 100644 --- a/assets/lang/az_AZ.ini +++ b/assets/lang/az_AZ.ini @@ -967,6 +967,7 @@ Error = Error Failed to Bind Localhost IP = Failed to bind localhost IP Failed to Bind Port = Failed to bind port Failed to connect to Adhoc Server = Failed to connect to ad hoc server +File transfer completed: %1 = Fail köçürməsi tamamlandı: %1 Forced First Connect = Forced first connect (faster connect) GM: Data from Unknown Port = GM: Data from Unknown Port Hostname = Hostname @@ -1000,6 +1001,7 @@ UPnP need to be reinitialized = UPnP need to be reinitialized UPnP use original port = UPnP use original port (enabled = PSP compatibility) UseOriginalPort Tip = May not work for all devices or games, see wiki. Validating address... = Validating address... +With a web browser on the same network, go to: = Eyni şəbəkədə veb brauzer ilə daxil olun: WLAN Channel = WLAN channel You're in Offline Mode, go to lobby or online hall = You're in offline mode, go to lobby or online hall diff --git a/assets/lang/be_BY.ini b/assets/lang/be_BY.ini index d95ed362b7..b35bed2e71 100644 --- a/assets/lang/be_BY.ini +++ b/assets/lang/be_BY.ini @@ -934,6 +934,7 @@ Error = Памылка Failed to Bind Localhost IP = Failed to bind localhost IP Failed to Bind Port = Failed to bind port Failed to connect to Adhoc Server = Failed to connect to ad hoc server +File transfer completed: %1 = Перадача файла завершана: %1 Forced First Connect = Forced first connect (faster connect) GM: Data from Unknown Port = GM: Data from Unknown Port Hostname = Імя хаста @@ -967,6 +968,7 @@ UPnP need to be reinitialized = UPnP need to be reinitialized UPnP use original port = UPnP use original port (enabled = PSP compatibility) UseOriginalPort Tip = Можа працаваць не на ўсіх прыладах або ў гульнях, глядзіце вікі. Validating address... = Праверка адраса... +With a web browser on the same network, go to: = З дапамогай вэб-браўзера ў той жа сетцы, перайдзіце па адрасе: WLAN Channel = Канал WLAN You're in Offline Mode, go to lobby or online hall = You're in offline mode, go to lobby or online hall diff --git a/assets/lang/bg_BG.ini b/assets/lang/bg_BG.ini index 94ecd8534d..411fc83378 100644 --- a/assets/lang/bg_BG.ini +++ b/assets/lang/bg_BG.ini @@ -967,6 +967,7 @@ Error = Грешка Failed to Bind Localhost IP = Failed to bind localhost IP Failed to Bind Port = Failed to bind port Failed to connect to Adhoc Server = Failed to connect to ad hoc server +File transfer completed: %1 = Пренос на файл завършен: %1 Forced First Connect = Forced first connect (faster connect) GM: Data from Unknown Port = GM: Data from Unknown Port Hostname = Hostname @@ -1000,6 +1001,7 @@ UPnP need to be reinitialized = UPnP need to be reinitialized UPnP use original port = UPnP use original port (enabled = PSP compatibility) UseOriginalPort Tip = May not work for all devices or games, see wiki. Validating address... = Validating address... +With a web browser on the same network, go to: = С веб браузър в същата мрежа, отидете на: WLAN Channel = WLAN channel You're in Offline Mode, go to lobby or online hall = You're in offline mode, go to lobby or online hall diff --git a/assets/lang/ca_ES.ini b/assets/lang/ca_ES.ini index 34c83fcd23..42d391b01f 100644 --- a/assets/lang/ca_ES.ini +++ b/assets/lang/ca_ES.ini @@ -967,6 +967,7 @@ Error = Error Failed to Bind Localhost IP = Failed to bind localhost IP Failed to Bind Port = Failed to bind port Failed to connect to Adhoc Server = Failed to connect to ad hoc server +File transfer completed: %1 = Transferència de fitxer completada: %1 Forced First Connect = Forced first connect (faster connect) GM: Data from Unknown Port = GM: Data from Unknown Port Hostname = Hostname @@ -1000,6 +1001,7 @@ UPnP need to be reinitialized = UPnP need to be reinitialized UPnP use original port = UPnP use original port (enabled = PSP compatibility) UseOriginalPort Tip = May not work for all devices or games, see wiki. Validating address... = Validating address... +With a web browser on the same network, go to: = Amb un navegador web a la mateixa xarxa, ves a: WLAN Channel = WLAN channel You're in Offline Mode, go to lobby or online hall = You're in offline mode, go to lobby or online hall diff --git a/assets/lang/cz_CZ.ini b/assets/lang/cz_CZ.ini index 59b47a6773..43c15efac4 100644 --- a/assets/lang/cz_CZ.ini +++ b/assets/lang/cz_CZ.ini @@ -967,6 +967,7 @@ Error = Error Failed to Bind Localhost IP = Failed to bind localhost IP Failed to Bind Port = Failed to bind port Failed to connect to Adhoc Server = Failed to connect to ad hoc server +File transfer completed: %1 = Přenos souboru dokončen: %1 Forced First Connect = Forced first connect (faster connect) GM: Data from Unknown Port = GM: Data from Unknown Port Hostname = Hostname @@ -1000,6 +1001,7 @@ UPnP need to be reinitialized = UPnP need to be reinitialized UPnP use original port = UPnP use original port (enabled = PSP compatibility) UseOriginalPort Tip = May not work for all devices or games, see wiki. Validating address... = Validating address... +With a web browser on the same network, go to: = S webovým prohlížečem ve stejné síti přejděte na: WLAN Channel = WLAN channel You're in Offline Mode, go to lobby or online hall = You're in offline mode, go to lobby or online hall diff --git a/assets/lang/da_DK.ini b/assets/lang/da_DK.ini index 25ea6e4986..c03df4f9aa 100644 --- a/assets/lang/da_DK.ini +++ b/assets/lang/da_DK.ini @@ -967,6 +967,7 @@ Error = Error Failed to Bind Localhost IP = Failed to bind localhost IP Failed to Bind Port = Failed to bind port Failed to connect to Adhoc Server = Failed to connect to ad hoc server +File transfer completed: %1 = Filoverførsel færdig: %1 Forced First Connect = Forced first connect (faster connect) GM: Data from Unknown Port = GM: Data from Unknown Port Hostname = Hostname @@ -1000,6 +1001,7 @@ UPnP need to be reinitialized = UPnP need to be reinitialized UPnP use original port = UPnP use original port (enabled = PSP compatibility) UseOriginalPort Tip = May not work for all devices or games, see wiki. Validating address... = Validating address... +With a web browser on the same network, go to: = Med en webbrowser på det samme netværk, gå til: WLAN Channel = WLAN channel You're in Offline Mode, go to lobby or online hall = You're in offline mode, go to lobby or online hall diff --git a/assets/lang/de_DE.ini b/assets/lang/de_DE.ini index c2ef28e4b5..495ca54e00 100644 --- a/assets/lang/de_DE.ini +++ b/assets/lang/de_DE.ini @@ -957,6 +957,7 @@ Error = Fehler Failed to Bind Localhost IP = Localhost-IP konnte nicht gebunden werden Failed to Bind Port = Port konnte nicht gebunden werden Failed to connect to Adhoc Server = Verbindung zum Ad-hoc-Server fehlgeschlagen +File transfer completed: %1 = Dateiübertragung abgeschlossen: %1 Forced First Connect = Erzwungene erste Verbindung (Schneller Verbinden) GM: Data from Unknown Port = GM: Daten von unbekanntem Port Hostname = Hostname @@ -990,6 +991,7 @@ UPnP need to be reinitialized = UPnP muss neu initialisiert werden UPnP use original port = UPnP-Original-Port verwenden (aktiviert = PSP-Kompatibilität) UseOriginalPort Tip = Funktioniert möglicherweise nicht mit allen Geräten oder Spielen. Siehe Wiki. Validating address... = Adresse wird validiert... +With a web browser on the same network, go to: = Öffnen Sie mit einem Webbrowser im gleichen Netzwerk: WLAN Channel = WLAN-Kanal You're in Offline Mode, go to lobby or online hall = Du bist im Offline-Modus. Gehe in die Lobby oder Online-Halle. diff --git a/assets/lang/dr_ID.ini b/assets/lang/dr_ID.ini index 00408e5741..ea82720019 100644 --- a/assets/lang/dr_ID.ini +++ b/assets/lang/dr_ID.ini @@ -967,6 +967,7 @@ Error = Error Failed to Bind Localhost IP = Failed to bind localhost IP Failed to Bind Port = Failed to bind port Failed to connect to Adhoc Server = Failed to connect to ad hoc server +File transfer completed: %1 = Transfer file selesai: %1 Forced First Connect = Forced first connect (faster connect) GM: Data from Unknown Port = GM: Data from Unknown Port Hostname = Hostname @@ -1000,6 +1001,7 @@ UPnP need to be reinitialized = UPnP need to be reinitialized UPnP use original port = UPnP use original port (enabled = PSP compatibility) UseOriginalPort Tip = May not work for all devices or games, see wiki. Validating address... = Validating address... +With a web browser on the same network, go to: = Dengan browser web di jaringan yang sama, pergi ke: WLAN Channel = WLAN channel You're in Offline Mode, go to lobby or online hall = You're in offline mode, go to lobby or online hall diff --git a/assets/lang/en_US.ini b/assets/lang/en_US.ini index 76855bfde8..5b01601bf6 100644 --- a/assets/lang/en_US.ini +++ b/assets/lang/en_US.ini @@ -958,6 +958,7 @@ Error = Error Failed to Bind Localhost IP = Failed to bind localhost IP Failed to Bind Port = Failed to bind port Failed to connect to Adhoc Server = Failed to connect to ad hoc server +File transfer completed: %1 = File transfer completed: %1 Forced First Connect = Forced first connect (faster connect) GM: Data from Unknown Port = GM: Data from Unknown Port Hostname = Hostname @@ -991,6 +992,7 @@ UPnP need to be reinitialized = UPnP need to be reinitialized UPnP use original port = UPnP use original port (enabled = PSP compatibility) UseOriginalPort Tip = May not work for all devices or games, see wiki. Validating address... = Validating address... +With a web browser on the same network, go to: = With a web browser on the same network, go to: WLAN Channel = WLAN channel You're in Offline Mode, go to lobby or online hall = You're in offline mode, go to lobby or online hall diff --git a/assets/lang/es_ES.ini b/assets/lang/es_ES.ini index 8e13be0f04..8f42aeae43 100644 --- a/assets/lang/es_ES.ini +++ b/assets/lang/es_ES.ini @@ -968,6 +968,7 @@ Error = Error Failed to Bind Localhost IP = Error al unirse a la IP localhost Failed to Bind Port = Error al vincular puerto Failed to connect to Adhoc Server = Error al conectar al servidor Ad-Hoc +File transfer completed: %1 = Transferencia de archivo completada: %1 Forced First Connect = Primera conexión forzada (más rápida) GM: Data from Unknown Port = GM: Datos de puerto desconocido Hostname = Nombre de host @@ -1001,6 +1002,7 @@ UPnP need to be reinitialized = Es necesario reiniciar UPnP UPnP use original port = UPnP usa puerto original (activado = compatibilidad PSP) UseOriginalPort Tip = Puede que no funcione con todos los dispositivos o juegos, consulta la wiki. Validating address... = Validando dirección... +With a web browser on the same network, go to: = Con un navegador web en la misma red, ve a: WLAN Channel = Canal WLAN You're in Offline Mode, go to lobby or online hall = Estás en modo offline, ve al lobby o a la sala online diff --git a/assets/lang/es_LA.ini b/assets/lang/es_LA.ini index 4378e1e82e..b09a1f7b2f 100644 --- a/assets/lang/es_LA.ini +++ b/assets/lang/es_LA.ini @@ -967,6 +967,7 @@ Error = Error Failed to Bind Localhost IP = Fallo al unirse a la IP localhost Failed to Bind Port = Fallo al unir puerto Failed to connect to Adhoc Server = Fallo al conectar al servidor Adhoc +File transfer completed: %1 = Transferencia de archivo completada: %1 Forced First Connect = Primera conexión forzada (más rápida) GM: Data from Unknown Port = GM: Datos de puerto desconocido Hostname = Hostname @@ -1000,6 +1001,7 @@ UPnP need to be reinitialized = La función de UPnP debe reinicializarse. UPnP use original port = Usar puerto UPnP de PSP (activado = más compatible con PSP ) UseOriginalPort Tip = Puede que no funcione para todos los dispositivos o juegos, consulte la wiki. Validating address... = Validando dirección ... +With a web browser on the same network, go to: = Con un navegador web en la misma red, dirígete a: WLAN Channel = Canal WLAN You're in Offline Mode, go to lobby or online hall = Estás en modo fuera de línea, ve al lobby o sala en línea diff --git a/assets/lang/fa_IR.ini b/assets/lang/fa_IR.ini index f051092e78..8fbe820a16 100644 --- a/assets/lang/fa_IR.ini +++ b/assets/lang/fa_IR.ini @@ -967,6 +967,7 @@ Error = خطا Failed to Bind Localhost IP = اتصال به IP localhost شکست خورد Failed to Bind Port = اتصال به درگاه شکست خورد Failed to connect to Adhoc Server = اتصال به سرور ادهاک شکست خورد +File transfer completed: %1 = انتقال فایل تمام شد: %1 Forced First Connect = اتصال اول اجباری (اتصال سریع تر) GM: Data from Unknown Port = GM: Data from Unknown Port Hostname = نام میزبان @@ -1000,6 +1001,7 @@ UPnP need to be reinitialized = UPnP باید بازراه‌اندازی شود UPnP use original port = استفاده از درگاه اصلی UPnP (فعال = سازگاری با PSP) UseOriginalPort Tip = ممکن است برای همه دستگاه ها یا بازی ها کار نکند، ویکی را ببینید. Validating address... = اعتبارسنجی نشانی... +With a web browser on the same network, go to: = با یک مرورگر وب در همان شبکه، به: WLAN Channel = کانال WLAN You're in Offline Mode, go to lobby or online hall = شما در حالت آفلاین هستید، به لابی یا سالن آنلاین بروید. diff --git a/assets/lang/fi_FI.ini b/assets/lang/fi_FI.ini index d969dfc00d..d6a83e07ad 100644 --- a/assets/lang/fi_FI.ini +++ b/assets/lang/fi_FI.ini @@ -967,6 +967,7 @@ Error = Error Failed to Bind Localhost IP = Failed to bind localhost IP Failed to Bind Port = Failed to bind port Failed to connect to Adhoc Server = Failed to connect to ad hoc server +File transfer completed: %1 = Tiedostonsiirto valmis: %1 Forced First Connect = Forced first connect (faster connect) GM: Data from Unknown Port = GM: Data from Unknown Port Hostname = Hostname @@ -1000,6 +1001,7 @@ UPnP need to be reinitialized = UPnP need to be reinitialized UPnP use original port = UPnP use original port (enabled = PSP compatibility) UseOriginalPort Tip = May not work for all devices or games, see wiki. Validating address... = Validating address... +With a web browser on the same network, go to: = Selaimessa, joka on samassa verkossa, siirry: WLAN Channel = WLAN channel You're in Offline Mode, go to lobby or online hall = You're in offline mode, go to lobby or online hall diff --git a/assets/lang/fr_FR.ini b/assets/lang/fr_FR.ini index 3d41c91e2b..237519a3ba 100644 --- a/assets/lang/fr_FR.ini +++ b/assets/lang/fr_FR.ini @@ -967,6 +967,7 @@ Error = Erreur Failed to Bind Localhost IP = Échec de liaison de l'IP localhost Failed to Bind Port = Échec de liaison du port Failed to connect to Adhoc Server = Échec de connexion au serveur ad hoc +File transfer completed: %1 = Transfert de fichier terminé : %1 Forced First Connect = Première connexion forcée (connexion plus rapide) GM: Data from Unknown Port = GM: Data from Unknown Port Hostname = Hostname @@ -1000,6 +1001,7 @@ UPnP need to be reinitialized = UPnP doit être réinitialisé UPnP use original port = Utiliser les ports originaux avec UPnP (activé = compatibilité PSP) UseOriginalPort Tip = May not work for all devices or games, see wiki. Validating address... = Validation de l'adresse... +With a web browser on the same network, go to: = Avec un navigateur web sur le même réseau, allez à : WLAN Channel = Canal WLAN You're in Offline Mode, go to lobby or online hall = Vous êtes en mode hors ligne, allez dans le hall en ligne. diff --git a/assets/lang/gl_ES.ini b/assets/lang/gl_ES.ini index ea389a5e94..78da604080 100644 --- a/assets/lang/gl_ES.ini +++ b/assets/lang/gl_ES.ini @@ -967,6 +967,7 @@ Error = Error Failed to Bind Localhost IP = Failed to bind localhost IP Failed to Bind Port = Failed to bind port Failed to connect to Adhoc Server = Failed to connect to ad hoc server +File transfer completed: %1 = Transferencia de ficheiro completada: %1 Forced First Connect = Forced first connect (faster connect) GM: Data from Unknown Port = GM: Data from Unknown Port Hostname = Hostname @@ -1000,6 +1001,7 @@ UPnP need to be reinitialized = UPnP need to be reinitialized UPnP use original port = UPnP use original port (enabled = PSP compatibility) UseOriginalPort Tip = May not work for all devices or games, see wiki. Validating address... = Validating address... +With a web browser on the same network, go to: = Con un navegador web na mesma rede, vai a: WLAN Channel = WLAN channel You're in Offline Mode, go to lobby or online hall = You're in offline mode, go to lobby or online hall diff --git a/assets/lang/gr_EL.ini b/assets/lang/gr_EL.ini index 8922198139..bed0ecc463 100644 --- a/assets/lang/gr_EL.ini +++ b/assets/lang/gr_EL.ini @@ -967,6 +967,7 @@ Error = Error Failed to Bind Localhost IP = Failed to bind localhost IP Failed to Bind Port = Failed to bind port Failed to connect to Adhoc Server = Failed to connect to ad hoc server +File transfer completed: %1 = Η μεταφορά αρχείου ολοκληρώθηκε: %1 Forced First Connect = Forced first connect (faster connect) GM: Data from Unknown Port = GM: Data from Unknown Port Hostname = Hostname @@ -1000,6 +1001,7 @@ UPnP need to be reinitialized = UPnP need to be reinitialized UPnP use original port = UPnP use original port (enabled = PSP compatibility) UseOriginalPort Tip = May not work for all devices or games, see wiki. Validating address... = Επικύρωση διεύθυνσης... +With a web browser on the same network, go to: = Με έναν περιηγητή ιστού στο ίδιο δίκτυο, πηγαίνετε σε: WLAN Channel = WLAN channel You're in Offline Mode, go to lobby or online hall = You're in offline mode, go to lobby or online hall diff --git a/assets/lang/he_IL.ini b/assets/lang/he_IL.ini index 3e9a068f90..80eb460aa8 100644 --- a/assets/lang/he_IL.ini +++ b/assets/lang/he_IL.ini @@ -967,6 +967,7 @@ Error = Error Failed to Bind Localhost IP = Failed to bind localhost IP Failed to Bind Port = Failed to bind port Failed to connect to Adhoc Server = Failed to connect to ad hoc server +File transfer completed: %1 = העברת קובץ הושלמה: %1 Forced First Connect = Forced first connect (faster connect) GM: Data from Unknown Port = GM: Data from Unknown Port Hostname = Hostname @@ -1000,6 +1001,7 @@ UPnP need to be reinitialized = UPnP need to be reinitialized UPnP use original port = UPnP use original port (enabled = PSP compatibility) UseOriginalPort Tip = May not work for all devices or games, see wiki. Validating address... = Validating address... +With a web browser on the same network, go to: = עם דפדפן אינטרנט באותה הרשת, עבור אל: WLAN Channel = WLAN channel You're in Offline Mode, go to lobby or online hall = You're in offline mode, go to lobby or online hall diff --git a/assets/lang/he_IL_invert.ini b/assets/lang/he_IL_invert.ini index d19a0bd496..77067679bc 100644 --- a/assets/lang/he_IL_invert.ini +++ b/assets/lang/he_IL_invert.ini @@ -964,6 +964,7 @@ Error = Error Failed to Bind Localhost IP = Failed to bind localhost IP Failed to Bind Port = Failed to bind port Failed to connect to Adhoc Server = Failed to connect to ad hoc server +File transfer completed: %1 = הושלמה העברת קובץ: %1 Forced First Connect = Forced first connect (faster connect) GM: Data from Unknown Port = GM: Data from Unknown Port Hostname = Hostname @@ -997,6 +998,7 @@ UPnP need to be reinitialized = UPnP need to be reinitialized UPnP use original port = UPnP use original port (enabled = PSP compatibility) UseOriginalPort Tip = May not work for all devices or games, see wiki. Validating address... = Validating address... +With a web browser on the same network, go to: = עם דפדפן אינטרנט באותה הרשת, עבור אל: WLAN Channel = WLAN channel You're in Offline Mode, go to lobby or online hall = You're in offline mode, go to lobby or online hall diff --git a/assets/lang/hr_HR.ini b/assets/lang/hr_HR.ini index 5a647dbc87..6365cdc094 100644 --- a/assets/lang/hr_HR.ini +++ b/assets/lang/hr_HR.ini @@ -967,6 +967,7 @@ Error = Error Failed to Bind Localhost IP = Failed to bind localhost IP Failed to Bind Port = Failed to bind port Failed to connect to Adhoc Server = Failed to connect to ad hoc server +File transfer completed: %1 = Prenos datoteke završen: %1 Forced First Connect = Forced first connect (faster connect) GM: Data from Unknown Port = GM: Data from Unknown Port Hostname = Hostname @@ -1000,6 +1001,7 @@ UPnP need to be reinitialized = UPnP need to be reinitialized UPnP use original port = UPnP use original port (enabled = PSP compatibility) UseOriginalPort Tip = May not work for all devices or games, see wiki. Validating address... = Provjeravanje adrese... +With a web browser on the same network, go to: = S web preglednikom na istoj mreži, idite na: WLAN Channel = WLAN channel You're in Offline Mode, go to lobby or online hall = Trenutno si u "Offline",idi u lobby ili online hall diff --git a/assets/lang/hu_HU.ini b/assets/lang/hu_HU.ini index ae0e35d374..414fdf9341 100644 --- a/assets/lang/hu_HU.ini +++ b/assets/lang/hu_HU.ini @@ -967,6 +967,7 @@ Error = Hiba Failed to Bind Localhost IP = Nem sikerült a localhost IP kötése Failed to Bind Port = Nem sikerült a porthoz kötés Failed to connect to Adhoc Server = Nem sikerült csatlakozni az ad hoc szerverhez +File transfer completed: %1 = Fájlátvitel befejeződött: %1 Forced First Connect = Kényszerített első csatlakozás (gyorsabb csatlakozás) GM: Data from Unknown Port = GM: ismeretlen portról származó adat Hostname = Hostnév @@ -1000,6 +1001,7 @@ UPnP need to be reinitialized = UPnP újra-inicializálás szükséges UPnP use original port = UPnP eredeti portot használja (be = PSP kompatibilitás) UseOriginalPort Tip = Lehet, hogy nem működik az összes eszközön vagy játékhoz, lásd a wiki oldalt. Validating address... = Cím ellenőrzése... +With a web browser on the same network, go to: = Azonos hálózaton lévő webböngészővel, lépjen a következőre: WLAN Channel = WLAN csatorna You're in Offline Mode, go to lobby or online hall = Offline üzemmódban vagy, menj a lobbiba vagy az online terembe! diff --git a/assets/lang/id_ID.ini b/assets/lang/id_ID.ini index 4667e4a6dc..67a6d48d38 100644 --- a/assets/lang/id_ID.ini +++ b/assets/lang/id_ID.ini @@ -967,6 +967,7 @@ Error = Kesalahan Failed to Bind Localhost IP = Gagal memuat IP host lokal Failed to Bind Port = Gagal memuat port Failed to connect to Adhoc Server = Gagal terhubung ke server Ad Hoc +File transfer completed: %1 = Transfer file selesai: %1 Forced First Connect = Sambungan pertama paksa (koneksi lebih cepat) GM: Data from Unknown Port = GM: Data dari port tidak dikenal Hostname = Nama Host @@ -1000,6 +1001,7 @@ UPnP need to be reinitialized = UPnP perlu diinisialisasi ulang UPnP use original port = UPnP menggunakan port asli (diaktifkan = kompatibilitas PSP) UseOriginalPort Tip = Mungkin tidak berfungsi untuk semua perangkat atau permainan, lihat wiki. Validating address... = Validasi alamat... +With a web browser on the same network, go to: = Dengan browser web di jaringan yang sama, buka: WLAN Channel = Saluran WLAN You're in Offline Mode, go to lobby or online hall = Anda dalam mode offline, pergi ke lobi atau aula online diff --git a/assets/lang/it_IT.ini b/assets/lang/it_IT.ini index 74ca54009f..44fa97c751 100644 --- a/assets/lang/it_IT.ini +++ b/assets/lang/it_IT.ini @@ -935,6 +935,7 @@ Error = Errore Failed to Bind Localhost IP = Impossibile correlare l'IP localhost Failed to Bind Port = Impossibile correlare la porta Failed to connect to Adhoc Server = Impossibile connettersi al sever ad hoc +File transfer completed: %1 = Trasferimento file completato: %1 Forced First Connect = Prima connessione forzata (connessione più rapida) GM: Data from Unknown Port = GM: Dati da porta sconosciuta Hostname = Nome host @@ -968,6 +969,7 @@ UPnP need to be reinitialized = UPnP dev'essere reinizializzato UPnP use original port = Usa la porta originale di UPnP (attiva = compatibilità PSP) UseOriginalPort Tip = Potrebbe non funzionare per tutti i dispositivi o giochi, controlla la wiki. Validating address... = Convalida indirizzo... +With a web browser on the same network, go to: = Con un browser web sulla stessa rete, vai a: WLAN Channel = Canale WLAN You're in Offline Mode, go to lobby or online hall = Sei in modalità offline, vai alla lobby online. diff --git a/assets/lang/ja_JP.ini b/assets/lang/ja_JP.ini index 3fc3a60578..1fbba2c237 100644 --- a/assets/lang/ja_JP.ini +++ b/assets/lang/ja_JP.ini @@ -934,6 +934,7 @@ Error = エラー Failed to Bind Localhost IP = ローカルホストIPのバインドに失敗しました Failed to Bind Port = ポートのバインドに失敗しました Failed to connect to Adhoc Server = アドホックサーバーに接続できませんでした +File transfer completed: %1 = ファイル転送が完了しました: %1 Forced First Connect = 強制初期接続 (より速い接続) GM: Data from Unknown Port = GM: 不明なポートからのデータ Hostname = ホストネーム @@ -967,6 +968,7 @@ UPnP need to be reinitialized = UPnPの再初期化が必要です UPnP use original port = UPnPでオリジナルのポートを使用する (有効 = PSP互換) UseOriginalPort Tip = デバイスやゲームによっては動作しない場合がありますので、wikiを参照してください。 Validating address... = アドレスを検証しています... +With a web browser on the same network, go to: = 同じネットワークのWebブラウザで、次のアドレスにアクセスしてください: WLAN Channel = WLANチャネル You're in Offline Mode, go to lobby or online hall = オフラインモードです。ロビーかホールに移動してください diff --git a/assets/lang/jv_ID.ini b/assets/lang/jv_ID.ini index ec077f004f..4064dabb58 100644 --- a/assets/lang/jv_ID.ini +++ b/assets/lang/jv_ID.ini @@ -967,6 +967,7 @@ Error = Error Failed to Bind Localhost IP = Failed to bind localhost IP Failed to Bind Port = Failed to bind port Failed to connect to Adhoc Server = Failed to connect to ad hoc server +File transfer completed: %1 = Transfer berkas rampung: %1 Forced First Connect = Forced first connect (faster connect) GM: Data from Unknown Port = GM: Data from Unknown Port Hostname = Hostname @@ -1000,6 +1001,7 @@ UPnP need to be reinitialized = UPnP need to be reinitialized UPnP use original port = UPnP use original port (enabled = PSP compatibility) UseOriginalPort Tip = May not work for all devices or games, see wiki. Validating address... = Validating address... +With a web browser on the same network, go to: = Kanthi browser web ing jaringan sing padha, bukak: WLAN Channel = WLAN channel You're in Offline Mode, go to lobby or online hall = You're in offline mode, go to lobby or online hall diff --git a/assets/lang/ko_KR.ini b/assets/lang/ko_KR.ini index a0ee5ef023..e1955cc777 100644 --- a/assets/lang/ko_KR.ini +++ b/assets/lang/ko_KR.ini @@ -934,6 +934,7 @@ Error = 오류 Failed to Bind Localhost IP = 로컬 호스트 IP를 바인딩하지 못했습니다. Failed to Bind Port = 포트를 바인딩하지 못했습니다. Failed to connect to Adhoc Server = Ad Hoc 서버에 연결하지 못했습니다. +File transfer completed: %1 = 파일 전송 완료: %1 Forced First Connect = 강제 첫 번째 연결 (빠른 연결) GM: Data from Unknown Port = GM: 알 수 없는 포트의 데이터 Hostname = 호스트 이름 @@ -967,6 +968,7 @@ UPnP need to be reinitialized = UPnP를 다시 초기화해야 합니다. UPnP use original port = UPnP는 원래 포트를 사용합니다 (활성화됨 = PSP 호환성) UseOriginalPort Tip = 일부 기기나 게임에서는 작동하지 않을 수 있으므로, 위키를 참조하세요. Validating address... = 주소 검증하는 중... +With a web browser on the same network, go to: = 같은 네트워크의 웹 브라우저에서 다음으로 이동하세요: WLAN Channel = 무선랜 채널 You're in Offline Mode, go to lobby or online hall = 오프라인 모드입니다. 로비 또는 온라인 홀으로 이동합니다. diff --git a/assets/lang/ku_SO.ini b/assets/lang/ku_SO.ini index 8682aa56bb..e542822427 100644 --- a/assets/lang/ku_SO.ini +++ b/assets/lang/ku_SO.ini @@ -948,6 +948,7 @@ Error = Error Failed to Bind Localhost IP = Failed to bind localhost IP Failed to Bind Port = Failed to bind port Failed to connect to Adhoc Server = Failed to connect to ad hoc server +File transfer completed: %1 = Guhertina pelî bi serketinî: %1 Forced First Connect = Forced first connect (faster connect) GM: Data from Unknown Port = GM: Data from Unknown Port Hostname = Hostname @@ -981,6 +982,7 @@ UPnP need to be reinitialized = UPnP need to be reinitialized UPnP use original port = UPnP use original port (enabled = PSP compatibility) UseOriginalPort Tip = May not work for all devices or games, see wiki. Validating address... = Validating address... +With a web browser on the same network, go to: = Bi kevneşopê webê li ser heman torê, bibe: WLAN Channel = WLAN channel You're in Offline Mode, go to lobby or online hall = You're in offline mode, go to lobby or online hall diff --git a/assets/lang/lo_LA.ini b/assets/lang/lo_LA.ini index 7ca1efabde..69843b4b71 100644 --- a/assets/lang/lo_LA.ini +++ b/assets/lang/lo_LA.ini @@ -967,6 +967,7 @@ Error = Error Failed to Bind Localhost IP = Failed to bind localhost IP Failed to Bind Port = Failed to bind port Failed to connect to Adhoc Server = Failed to connect to ad hoc server +File transfer completed: %1 = ການໂອນເຟຊ໌ແລ້ວແລ້ວ: %1 Forced First Connect = Forced first connect (faster connect) GM: Data from Unknown Port = GM: Data from Unknown Port Hostname = Hostname @@ -1000,6 +1001,7 @@ UPnP need to be reinitialized = UPnP need to be reinitialized UPnP use original port = UPnP use original port (enabled = PSP compatibility) UseOriginalPort Tip = May not work for all devices or games, see wiki. Validating address... = Validating address... +With a web browser on the same network, go to: = ກັບບຣາວເຊີບເວບເລັ່ງໃນເຄື່ອນເຊື່ອມໃນສຽງດຽວ, ເຂົ້າໄປທີ່: WLAN Channel = WLAN channel You're in Offline Mode, go to lobby or online hall = You're in offline mode, go to lobby or online hall diff --git a/assets/lang/lt-LT.ini b/assets/lang/lt-LT.ini index c2ed213fee..9f98475cf2 100644 --- a/assets/lang/lt-LT.ini +++ b/assets/lang/lt-LT.ini @@ -967,6 +967,7 @@ Error = Error Failed to Bind Localhost IP = Failed to bind localhost IP Failed to Bind Port = Failed to bind port Failed to connect to Adhoc Server = Failed to connect to ad hoc server +File transfer completed: %1 = Failo perkėlimas baigtas: %1 Forced First Connect = Forced first connect (faster connect) GM: Data from Unknown Port = GM: Data from Unknown Port Hostname = Hostname @@ -1000,6 +1001,7 @@ UPnP need to be reinitialized = UPnP need to be reinitialized UPnP use original port = UPnP use original port (enabled = PSP compatibility) UseOriginalPort Tip = May not work for all devices or games, see wiki. Validating address... = Validating address... +With a web browser on the same network, go to: = Naudodamiesi žiniatinklio naršykle toje pačioje tinkle, eikite į: WLAN Channel = WLAN channel You're in Offline Mode, go to lobby or online hall = You're in offline mode, go to lobby or online hall diff --git a/assets/lang/ms_MY.ini b/assets/lang/ms_MY.ini index 38be643cb7..da0272ab79 100644 --- a/assets/lang/ms_MY.ini +++ b/assets/lang/ms_MY.ini @@ -967,6 +967,7 @@ Error = Error Failed to Bind Localhost IP = Failed to bind localhost IP Failed to Bind Port = Failed to bind port Failed to connect to Adhoc Server = Failed to connect to ad hoc server +File transfer completed: %1 = Pemindahan fail selesai: %1 Forced First Connect = Forced first connect (faster connect) GM: Data from Unknown Port = GM: Data from Unknown Port Hostname = Hostname @@ -1000,6 +1001,7 @@ UPnP need to be reinitialized = UPnP need to be reinitialized UPnP use original port = UPnP use original port (enabled = PSP compatibility) UseOriginalPort Tip = May not work for all devices or games, see wiki. Validating address... = Validating address... +With a web browser on the same network, go to: = Dengan pelayar web pada rangkaian yang sama, pergi ke: WLAN Channel = WLAN channel You're in Offline Mode, go to lobby or online hall = You're in offline mode, go to lobby or online hall diff --git a/assets/lang/nl_NL.ini b/assets/lang/nl_NL.ini index 258b3d706c..8acd608053 100644 --- a/assets/lang/nl_NL.ini +++ b/assets/lang/nl_NL.ini @@ -967,6 +967,7 @@ Error = Error Failed to Bind Localhost IP = Failed to bind localhost IP Failed to Bind Port = Failed to bind port Failed to connect to Adhoc Server = Failed to connect to ad hoc server +File transfer completed: %1 = Bestandsoverdracht voltooid: %1 Forced First Connect = Forced first connect (faster connect) GM: Data from Unknown Port = GM: Data from Unknown Port Hostname = Hostname @@ -1000,6 +1001,7 @@ UPnP need to be reinitialized = UPnP need to be reinitialized UPnP use original port = UPnP use original port (enabled = PSP compatibility) UseOriginalPort Tip = May not work for all devices or games, see wiki. Validating address... = Validating address... +With a web browser on the same network, go to: = Ga met een webbrowser op hetzelfde netwerk naar: WLAN Channel = WLAN channel You're in Offline Mode, go to lobby or online hall = You're in offline mode, go to lobby or online hall diff --git a/assets/lang/no_NO.ini b/assets/lang/no_NO.ini index 7262814ff1..49196ba2b9 100644 --- a/assets/lang/no_NO.ini +++ b/assets/lang/no_NO.ini @@ -967,6 +967,7 @@ Error = Error Failed to Bind Localhost IP = Failed to bind localhost IP Failed to Bind Port = Failed to bind port Failed to connect to Adhoc Server = Failed to connect to ad hoc server +File transfer completed: %1 = Filoverføring fullført: %1 Forced First Connect = Forced first connect (faster connect) GM: Data from Unknown Port = GM: Data from Unknown Port Hostname = Hostname @@ -1000,6 +1001,7 @@ UPnP need to be reinitialized = UPnP need to be reinitialized UPnP use original port = UPnP use original port (enabled = PSP compatibility) UseOriginalPort Tip = May not work for all devices or games, see wiki. Validating address... = Validating address... +With a web browser on the same network, go to: = Med en nettleser på samme nettverk, gå til: WLAN Channel = WLAN channel You're in Offline Mode, go to lobby or online hall = You're in offline mode, go to lobby or online hall diff --git a/assets/lang/pl_PL.ini b/assets/lang/pl_PL.ini index dd07e30aa0..d94aee36ff 100644 --- a/assets/lang/pl_PL.ini +++ b/assets/lang/pl_PL.ini @@ -962,6 +962,7 @@ Error = Błąd Failed to Bind Localhost IP = Błąd przy przypisywaniu adresu IP lokalnego hosta Failed to Bind Port = Błąd przy przypisywaniu portu Failed to connect to Adhoc Server = Błąd przy łączeniu z serwerem Ad-Hoc +File transfer completed: %1 = Transfer pliku zakończony: %1 Forced First Connect = Wymuszenie pierwszego połączenie (szybsze łączenie) #GM = Dane z nieznanego portu GM: Data from Unknown Port = GM: Dane z nieznanego portu @@ -996,6 +997,7 @@ UPnP need to be reinitialized = Należy ponownie zainicjować UPnP UPnP use original port = UPnP używa oryginalnego portu (włączone = kompatybilność z PSP) UseOriginalPort Tip = Może nie działać ze wszystkimi grami i/lub urządzeniami. Po więcej informacji udaj się na wiki. Validating address... = Uwierzytelnianie addresu... +With a web browser on the same network, go to: = Za pomocą przeglądarki internetowej w tej samej sieci, przejdź do: WLAN Channel = Kanał WLAN You're in Offline Mode, go to lobby or online hall = Jesteś w trybie offline; wejdź do lobby lub pokoju online diff --git a/assets/lang/pt_BR.ini b/assets/lang/pt_BR.ini index 698ac2d80f..e972e62422 100644 --- a/assets/lang/pt_BR.ini +++ b/assets/lang/pt_BR.ini @@ -957,6 +957,7 @@ Error = Erro Failed to Bind Localhost IP = Falhou em associar com o IP do hospedeiro local Failed to Bind Port = Falhou em associar com a porta Failed to connect to Adhoc Server = Falhou em conectar ao servidor ad hoc +File transfer completed: %1 = Transferência de arquivo concluída: %1 Forced First Connect = Primeira conexão forçada (conexão mais rápida) GM: Data from Unknown Port = GM: Dados da Porta Desconhecida Hostname = Nome do hospedeiro @@ -990,6 +991,7 @@ UPnP need to be reinitialized = O UPnP precisa ser reinicializado UPnP use original port = O UPnP usa a porta original (ativado = compatibilidade com o PSP) UseOriginalPort Tip = Pode não funcionar com todos os dispositivos ou jogos, veja o wiki. Validating address... = Validando endereço... +With a web browser on the same network, go to: = Com um navegador web na mesma rede, vá para: WLAN Channel = Canal do WLAN You're in Offline Mode, go to lobby or online hall = Você está no modo offline, vá pro lobby ou pro salão online diff --git a/assets/lang/pt_PT.ini b/assets/lang/pt_PT.ini index 5de2f3c604..4f29715dc3 100644 --- a/assets/lang/pt_PT.ini +++ b/assets/lang/pt_PT.ini @@ -959,6 +959,7 @@ Error = Erro Failed to Bind Localhost IP = Erro ao conectar ao IP do hospedeiro local Failed to Bind Port = Erro ao conectar a porta Failed to connect to Adhoc Server = Erro ao conectar ao servidor Adhoc +File transfer completed: %1 = Transferência de arquivo concluída: %1 Forced First Connect = Primeira conexão forçada (conexão mais rápida) GM: Data from Unknown Port = GM: Dados da Porta Desconhecida Hostname = Nome do Hospedeiro @@ -993,6 +994,7 @@ UPnP use original port = O UPnP usa a porta original (ativado = compatibilidade UseOriginalPort Tip = May not work for all devices or games, see wiki. UseOriginalPort Tip = Poderá não funcionar com todos os dispositivos/jogos, para mais informações, vê a wiki. Validating address... = A validar Endereço... +With a web browser on the same network, go to: = Com um navegador web na mesma rede, dirija-se a: WLAN Channel = Canal do WLAN You're in Offline Mode, go to lobby or online hall = Estás no modo Offline, vai para o lobby/salão Online diff --git a/assets/lang/ro_RO.ini b/assets/lang/ro_RO.ini index eb6e54a107..9fde751ec4 100644 --- a/assets/lang/ro_RO.ini +++ b/assets/lang/ro_RO.ini @@ -968,6 +968,7 @@ Error = Error Failed to Bind Localhost IP = Failed to bind localhost IP Failed to Bind Port = Failed to bind port Failed to connect to Adhoc Server = Failed to connect to ad hoc server +File transfer completed: %1 = Transferul de fișiere s-a finalizat: %1 Forced First Connect = Forced first connect (faster connect) GM: Data from Unknown Port = GM: Data from Unknown Port Hostname = Hostname @@ -1001,6 +1002,7 @@ UPnP need to be reinitialized = UPnP need to be reinitialized UPnP use original port = UPnP use original port (enabled = PSP compatibility) UseOriginalPort Tip = May not work for all devices or games, see wiki. Validating address... = Validating address... +With a web browser on the same network, go to: = Cu un browser web pe aceeași rețea, accesați: WLAN Channel = WLAN channel You're in Offline Mode, go to lobby or online hall = You're in offline mode, go to lobby or online hall diff --git a/assets/lang/ru_RU.ini b/assets/lang/ru_RU.ini index 1cf42b4d2c..d8078f91e1 100644 --- a/assets/lang/ru_RU.ini +++ b/assets/lang/ru_RU.ini @@ -934,6 +934,7 @@ Error = Ошибка Failed to Bind Localhost IP = Не удалось привязать адрес для localhost Failed to Bind Port = Не удалось привязать порт Failed to connect to Adhoc Server = Не удалось подключиться к ad-hoc серверу +File transfer completed: %1 = Передача файла завершена: %1 Forced First Connect = Принудительное первое подключение (быстрое подключение) GM: Data from Unknown Port = GM: Данные с неизвестного порта Hostname = Имя хоста @@ -967,6 +968,7 @@ UPnP need to be reinitialized = Необходимо перезапустить UPnP use original port = Использовать оригинальный порт UPnP (включено = совместимость с PSP) UseOriginalPort Tip = Может не работать для всех устройств или игр, смотрите wiki. Validating address... = Проверка адреса... +With a web browser on the same network, go to: = С веб-браузером в той же сети, перейдите по адресу: WLAN Channel = Канал WLAN You're in Offline Mode, go to lobby or online hall = Вы в автономном режиме, зайдите в лобби или в комнату в Интернете diff --git a/assets/lang/sv_SE.ini b/assets/lang/sv_SE.ini index 00e661119f..4115076fd6 100644 --- a/assets/lang/sv_SE.ini +++ b/assets/lang/sv_SE.ini @@ -935,6 +935,7 @@ Error = Fel Failed to Bind Localhost IP = Misslyckades binda localhost-IP Failed to Bind Port = Misslyckades binda port Failed to connect to Adhoc Server = Misslyckades koppla upp till adhoc-servern +File transfer completed: %1 = Filöverföring slutförd: %1 Forced First Connect = Tvingad första uppkopplining (snabbare uppkoppling) GM: Data from Unknown Port = GM: Data från okänd port Hostname = Hostname @@ -968,6 +969,7 @@ UPnP need to be reinitialized = UPnP behöver ominitialiseras UPnP use original port = UPnP use original port (enabled = PSP compatibility) UseOriginalPort Tip = Funkar eventuellt inte för alla enheter eller spel, se wiki. Validating address... = Bekräftar adress... +With a web browser on the same network, go to: = Med en webbläsare på samma nätverk, gå till: WLAN Channel = WLAN-kanal You're in Offline Mode, go to lobby or online hall = Du är i offline-läge, gå till lobbyn eller online-hallen diff --git a/assets/lang/tg_PH.ini b/assets/lang/tg_PH.ini index 73f299c8c9..08e2fc4f20 100644 --- a/assets/lang/tg_PH.ini +++ b/assets/lang/tg_PH.ini @@ -968,6 +968,7 @@ Error = Error Failed to Bind Localhost IP = Nabigong i-bind ang localhost IP Failed to Bind Port = Nabigong i-bind ang port Failed to connect to Adhoc Server = Nabigong kumonekta sa ad hoc server +File transfer completed: %1 = Мубодилаи файл анҷомид: %1 Forced First Connect = Pinilit muna kumonekta (mabilis kumonekta) GM: Data from Unknown Port = GM: Data mula sa Hindi Kilalang Port Hostname = Pangalan ng host @@ -1001,6 +1002,7 @@ UPnP need to be reinitialized = Kailangang muling simulan ang UPnP UPnP use original port = Gamitin ang orihinal na port ng UPnP (enabled = PSP compatibility) UseOriginalPort Tip = Maaaring hindi gumana para sa lahat ng device o laro, tingnan ang wiki. Validating address... = Pinapatunayan ang address... +With a web browser on the same network, go to: = Бо браузери веб дар шабаκаи ҳамон, гузаред ба: WLAN Channel = Channel ng WLAN You're in Offline Mode, go to lobby or online hall = Nasa offline mode ka, pumunta sa lobby o online hall diff --git a/assets/lang/th_TH.ini b/assets/lang/th_TH.ini index b3419d66dc..d51524a129 100644 --- a/assets/lang/th_TH.ini +++ b/assets/lang/th_TH.ini @@ -986,6 +986,7 @@ Error = มีข้อผิดพลาด Failed to Bind Localhost IP = เชื่อมโยง Localhost IP ไม่สำเร็จ Failed to Bind Port = ล้มเหลวในการเชื่อมโยงพอร์ต Failed to connect to Adhoc Server = ล้มเหลวในการเชื่อมต่อกับเซิร์ฟเวอร์ Adhoc +File transfer completed: %1 = การถ่ายโอนไฟล์เสร็จสิ้น: %1 Forced First Connect = บังคับการเชื่อมต่อในครั้งแรกสุด GM: Data from Unknown Port = GM: ข้อมูลมาจากพอร์ตที่ไม่รู้จัก Hostname = ชื่อหัวห้อง @@ -1019,6 +1020,7 @@ UPnP need to be reinitialized = UPnP จำเป็นต้องเริ่ UPnP use original port = UPnP ใช้พอร์ตค่าเริ่มต้น (เปิดใช้งาน = เล่นกับเครื่อง PSP) UseOriginalPort Tip = อาจจะใช้ไม่ได้ในทุกอุปกรณ์หรือในบางเกม โปรดดูข้อมูลเพิ่มเติมที่ Wiki Validating address... = กำลังตรวจสอบที่อยู่... +With a web browser on the same network, go to: = ด้วยเว็บเบราว์เซอร์ในเครือข่ายเดียวกัน ไปที่: WLAN Channel = ช่องสัญญาณ WLAN You're in Offline Mode, go to lobby or online hall = คุณอยู่ในโหมดออฟไลน์ ต้องเข้าไปในล็อบบี้หรือออนไลน์ฮอลล์ก่อน diff --git a/assets/lang/tr_TR.ini b/assets/lang/tr_TR.ini index ffd103ed8d..b442e19ea0 100644 --- a/assets/lang/tr_TR.ini +++ b/assets/lang/tr_TR.ini @@ -969,6 +969,7 @@ Error = Hata Failed to Bind Localhost IP = Yerel ana makine IP'si bağlanamadı Failed to Bind Port = Port bağlanamadı Failed to connect to Adhoc Server = Adhoc sunucusuna bağlanılamadı +File transfer completed: %1 = Dosya aktarımı tamamlandı: %1 Forced First Connect = Zorunlu İlk Bağlantı GM: Data from Unknown Port = GM: Bilinmeyen Porttan Veri Hostname = Ana makine adı @@ -1002,6 +1003,7 @@ UPnP need to be reinitialized = UPnP yeniden başlatılmalı UPnP use original port = UPnP Orijinal Port Kullan UseOriginalPort Tip = Tüm cihazlar veya oyunlarda çalışmayabilir, wiki'ye bakın. Validating address... = Adres doğrulanıyor... +With a web browser on the same network, go to: = Aynı ağda bir web tarayıcısı ile şu adrese gidin: WLAN Channel = WLAN Kanalı You're in Offline Mode, go to lobby or online hall = Çevrimdışı moddasınız, lobiye veya çevrimiçi salona gidin diff --git a/assets/lang/uk_UA.ini b/assets/lang/uk_UA.ini index bdc16e8576..5634b3282b 100644 --- a/assets/lang/uk_UA.ini +++ b/assets/lang/uk_UA.ini @@ -967,6 +967,7 @@ Error = Помилка Failed to Bind Localhost IP = Не вдалося прив’язати локальний хост IP Failed to Bind Port = Не вдалося прив’язати порт Failed to connect to Adhoc Server = Не вдалося підключитися до ad hoc сервера +File transfer completed: %1 = Передача файлу завершена: %1 Forced First Connect = Примусове перше підключення (швидше підключення) GM: Data from Unknown Port = GM: Дані з невідомого порту Hostname = Ім'я хоста @@ -1000,6 +1001,7 @@ UPnP need to be reinitialized = UPnP необхідно повторно іні UPnP use original port = UPnP використовує оригінальний порт (увімкнуто = PSP сумісність) UseOriginalPort Tip = Може працювати не для всіх пристроїв чи ігор, подив. вікі. Validating address... = Підтвердження адреси... +With a web browser on the same network, go to: = За допомогою веб-браузера в тій же мережі перейдіть за адресою: WLAN Channel = WLAN канал You're in Offline Mode, go to lobby or online hall = Ви перебуваєте в офлайн-режимі, переходите у лоббі чи онлайн-режим diff --git a/assets/lang/vi_VN.ini b/assets/lang/vi_VN.ini index a21b769f8f..390c7971b8 100644 --- a/assets/lang/vi_VN.ini +++ b/assets/lang/vi_VN.ini @@ -967,6 +967,7 @@ Error = Error Failed to Bind Localhost IP = Failed to bind localhost IP Failed to Bind Port = Failed to bind port Failed to connect to Adhoc Server = Failed to connect to ad hoc server +File transfer completed: %1 = Chuyển file hoàn tất: %1 Forced First Connect = Forced first connect (faster connect) GM: Data from Unknown Port = GM: Data from Unknown Port Hostname = Hostname @@ -1000,6 +1001,7 @@ UPnP need to be reinitialized = UPnP need to be reinitialized UPnP use original port = UPnP use original port (enabled = PSP compatibility) UseOriginalPort Tip = May not work for all devices or games, see wiki. Validating address... = Validating address... +With a web browser on the same network, go to: = Với trình duyệt web trong cùng một mạng, hãy đi tới: WLAN Channel = WLAN channel You're in Offline Mode, go to lobby or online hall = You're in offline mode, go to lobby or online hall diff --git a/assets/lang/zh_CN.ini b/assets/lang/zh_CN.ini index 8ae75be2d7..96dafdb873 100644 --- a/assets/lang/zh_CN.ini +++ b/assets/lang/zh_CN.ini @@ -967,6 +967,7 @@ Error = 错误 Failed to Bind Localhost IP = 无法绑定本地主机IP Failed to Bind Port = 无法绑定端口 Failed to connect to Adhoc Server = 无法连接Adhoc服务器 +File transfer completed: %1 = 文件传输完成:%1 Forced First Connect = 快速初始化连接 (耗时更短) GM: Data from Unknown Port = GM:来自未知端口的数据 Hostname = 主机名 @@ -1001,6 +1002,7 @@ UPnP need to be reinitialized = UPnP 需要重新初始化 UPnP use original port = UPnP 使用原始端口 (启用=兼容PSP) UseOriginalPort Tip = 可能不适合某些游戏或设备,详见百科页面 Validating address... = 正在验证地址… +With a web browser on the same network, go to: = 在同一网络的Web浏览器中,访问: WLAN Channel = WLAN信道 You're in Offline Mode, go to lobby or online hall = 您现在处于离线模式,请进入房间或在线大厅 diff --git a/assets/lang/zh_TW.ini b/assets/lang/zh_TW.ini index 39a9c992cc..b89b500e55 100644 --- a/assets/lang/zh_TW.ini +++ b/assets/lang/zh_TW.ini @@ -934,6 +934,7 @@ Error = 錯誤 Failed to Bind Localhost IP = 無法繫結本機主機 IP Failed to Bind Port = 無法繫結連接埠 Failed to connect to Adhoc Server = 無法連線至臨機操作伺服器 +File transfer completed: %1 = 檔案傳輸完成:%1 Forced First Connect = 強制首次連線 (更快連線) GM: Data from Unknown Port = GM:來自不明連接埠的資料 Hostname = 主機名稱 @@ -967,6 +968,7 @@ UPnP need to be reinitialized = UPnP 需要重新初始化 UPnP use original port = UPnP 使用原始連接埠 (已啟用 = PSP 相容性) UseOriginalPort Tip = 可能不適用於所有裝置或遊戲,請參閱維基。 Validating address... = 正在驗證位址… +With a web browser on the same network, go to: = 在同一網絡的網頁瀏覽器上,前往: WLAN Channel = WLAN 頻道 You're in Offline Mode, go to lobby or online hall = 您目前處於離線模式,請前往大廳或線上大廳 diff --git a/assets/ui_images/images.svg b/assets/ui_images/images.svg index 1c0450333c..35e7a2d517 100644 --- a/assets/ui_images/images.svg +++ b/assets/ui_images/images.svg @@ -24,9 +24,9 @@ inkscape:pagecheckerboard="true" inkscape:deskcolor="#d1d1d1" inkscape:document-units="px" - inkscape:zoom="8.0000002" - inkscape:cx="297.18749" - inkscape:cy="545.18749" + inkscape:zoom="2.0000001" + inkscape:cx="355.74999" + inkscape:cy="544.74999" inkscape:window-width="3379" inkscape:window-height="1941" inkscape:window-x="-9" @@ -3941,14 +3941,14 @@ id="I_FLAG_US" transform="matrix(8.4810893e-4,0,0,0.00107427,3.571875,87.312501)"> + + + + + + d="m 151.0159,123.87219 c -0.0724,0 -0.13541,0.0498 -0.15205,0.12023 l -0.13584,0.57634 c -0.22788,0.0528 -0.44164,0.14237 -0.63434,0.2626 l -0.5036,-0.3112 c -0.0616,-0.038 -0.14136,-0.0288 -0.1924,0.0221 l -0.26658,0.26659 c -0.0513,0.0513 -0.0606,0.13083 -0.0225,0.1924 l 0.31148,0.50388 c -0.12024,0.19282 -0.21006,0.40617 -0.26289,0.63405 l -0.57606,0.13614 c -0.0704,0.0167 -0.1205,0.0795 -0.1205,0.15175 v 0.37685 c 0,0.0725 0.05,0.13542 0.1205,0.15205 l 0.57606,0.13612 c 0.0528,0.22789 0.14266,0.44124 0.26289,0.63406 l -0.31148,0.50359 c -0.038,0.0616 -0.0286,0.14165 0.0225,0.19269 l 0.2663,0.26629 c 0.0513,0.0513 0.13101,0.0606 0.19268,0.0225 l 0.5036,-0.31119 c 0.19272,0.12024 0.40646,0.20977 0.63434,0.2626 l 0.13584,0.57635 c 0.0167,0.0705 0.0797,0.12022 0.15205,0.12022 h 0.37685 c 0.0722,0 0.13541,-0.0497 0.15205,-0.12022 l 0.13583,-0.57635 c 0.22778,-0.0528 0.4416,-0.14236 0.63434,-0.2626 l 0.5036,0.31119 c 0.0616,0.0381 0.14126,0.0287 0.1924,-0.0225 l 0.26658,-0.26629 c 0.0512,-0.0512 0.0606,-0.13082 0.0225,-0.1924 l -0.31148,-0.50388 c 0.12024,-0.19273 0.20977,-0.40626 0.26261,-0.63406 l 0.57634,-0.13612 c 0.0706,-0.0167 0.12022,-0.0797 0.12022,-0.15205 v -0.37656 c -1e-5,-0.0724 -0.0497,-0.13541 -0.12022,-0.15204 l -0.57634,-0.13585 c -0.0528,-0.22788 -0.14237,-0.44153 -0.26261,-0.63434 l 0.31148,-0.50388 c 0.0381,-0.0617 0.0288,-0.14116 -0.0225,-0.1924 l -0.26658,-0.2663 c -0.0512,-0.0512 -0.13074,-0.0606 -0.1924,-0.0225 l -0.5036,0.31119 c -0.19282,-0.12023 -0.40646,-0.20977 -0.63434,-0.2626 l -0.13583,-0.57635 c -0.0167,-0.0704 -0.0798,-0.12022 -0.15205,-0.12022 z m 0.18842,1.30078 c 0.79691,0 1.44259,0.64585 1.44259,1.4426 0,0.79672 -0.64568,1.44286 -1.44259,1.44286 -0.79664,0 -1.44259,-0.64614 -1.44259,-1.44286 0,-0.79674 0.64595,-1.4426 1.44259,-1.4426 z m 0,0.68264 c -0.41969,0 -0.75995,0.34019 -0.75995,0.75996 0,0.41976 0.34026,0.76022 0.75995,0.76022 0.41977,0 0.75994,-0.34045 0.75994,-0.76022 0,-0.41978 -0.34017,-0.75996 -0.75994,-0.75996 z" /> diff --git a/assets/upload/index.html b/assets/upload/index.html index febdd98621..b24ff6fb53 100644 --- a/assets/upload/index.html +++ b/assets/upload/index.html @@ -8,7 +8,7 @@

Upload files to {{ device_name }}

-

To folder:

{{ upload_path }}

+

Destination folder: {{ upload_path }}

+
+
+ 📁 Drop files here or use the buttons above +
+
+
+ +
@@ -144,11 +180,37 @@ const uploadBtn = document.getElementById("uploadBtn"); const resetBtn = document.getElementById("resetBtn"); const fileListDiv = document.getElementById("fileList"); + const uploadedSection = document.getElementById("uploadedSection"); + const uploadedListDiv = document.getElementById("uploadedList"); + const dropZone = document.getElementById("dropZone"); const progressBar = document.getElementById("progressBar"); const statusDiv = document.getElementById("status"); const errorDiv = document.getElementById("error"); let files = []; + let uploadedFiles = []; + let droppedFiles = []; + + // Feature detection for drag and drop support + function isDragDropSupported() { + // Check for basic drag and drop API support + const div = document.createElement('div'); + const hasBasicSupport = ('draggable' in div) && ('ondrop' in div); + + // Check if it's a mobile device (where drag/drop from file system is limited) + const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); + + // Check if it's a touch-only device + const isTouchOnly = ('ontouchstart' in window) && !window.matchMedia('(pointer: fine)').matches; + + return hasBasicSupport && !isMobile && !isTouchOnly; + } + + // Show drop zone only if drag and drop is supported + if (isDragDropSupported()) { + dropZone.style.display = 'block'; + } + function formatBytes(bytes, decimals = 2) { if (bytes === 0) return '0 B'; const k = 1024; @@ -157,8 +219,28 @@ const size = parseFloat((bytes / Math.pow(k, i)).toFixed(decimals)); return `${size} ${units[i]}`; } + + function updateUploadedList() { + uploadedListDiv.innerHTML = ""; + if (uploadedFiles.length > 0) { + uploadedSection.style.display = "block"; + const list = document.createElement("ul"); + uploadedFiles.forEach(f => { + const li = document.createElement("li"); + const formattedBytes = formatBytes(f.size, 2); + const name = f.webkitRelativePath || f.name; + li.textContent = `${name} (${formattedBytes}) - ✓ Uploaded`; + li.style.color = "#2d7a2d"; + list.appendChild(li); + }); + uploadedListDiv.appendChild(list); + } else { + uploadedSection.style.display = "none"; + } + } + function updateFileList() { - files = [...fileInput.files, ...folderInput.files]; + files = [...fileInput.files, ...folderInput.files, ...droppedFiles]; fileListDiv.innerHTML = ""; if (files.length > 0) { uploadBtn.disabled = false; @@ -181,13 +263,62 @@ fileInput.addEventListener("change", updateFileList); folderInput.addEventListener("change", updateFileList); + // Drag and drop functionality + dropZone.addEventListener("dragover", (e) => { + e.preventDefault(); + dropZone.classList.add("drag-over"); + }); + + dropZone.addEventListener("dragleave", (e) => { + e.preventDefault(); + dropZone.classList.remove("drag-over"); + }); + + dropZone.addEventListener("drop", (e) => { + e.preventDefault(); + dropZone.classList.remove("drag-over"); + + const dt = e.dataTransfer; + const allFiles = Array.from(dt.files); + + // Filter out zero-byte entries (usually folders or invalid entries) + const validFiles = allFiles.filter(file => file.size > 0); + + // Show a message if some files were filtered out + if (allFiles.length > validFiles.length) { + const filteredCount = allFiles.length - validFiles.length; + statusDiv.textContent = `Note: ${filteredCount} folder(s) or empty file(s) were skipped. Only files can be drag/dropped.`; + setTimeout(() => { + if (statusDiv.textContent.includes("folder(s) or empty file(s) were skipped")) { + statusDiv.textContent = ""; + } + }, 8000); + } + + // Add valid dropped files to the existing array + droppedFiles = [...droppedFiles, ...validFiles]; + updateFileList(); + }); + + // Also handle drag/drop on the entire document to prevent browser default behavior + document.addEventListener("dragover", (e) => { + e.preventDefault(); + }); + + document.addEventListener("drop", (e) => { + e.preventDefault(); + }); + resetBtn.addEventListener("click", () => { // Clear the file inputs fileInput.value = ""; folderInput.value = ""; - // Clear the files array and update the display + // Clear all arrays and update displays files = []; + droppedFiles = []; + uploadedFiles = []; updateFileList(); + updateUploadedList(); }); uploadBtn.addEventListener("click", async () => { @@ -199,13 +330,27 @@ progressBar.style.display = "block"; progressBar.value = 0; - for (let i = 0; i < files.length; i++) { - const file = files[i]; - statusDiv.textContent = `Uploading ${file.webkitRelativePath || file.name} (${i + 1}/${files.length})`; + const filesToUpload = [...files]; // Create a copy to iterate over + + // Clear all file sources so files disappear from pending list as they upload + fileInput.value = ""; + folderInput.value = ""; + droppedFiles = []; + files = []; + + for (let i = 0; i < filesToUpload.length; i++) { + const file = filesToUpload[i]; + statusDiv.textContent = `Uploading ${file.webkitRelativePath || file.name} (${i + 1}/${filesToUpload.length})`; try { await uploadFile(file); + // Move successfully uploaded file to uploaded list + uploadedFiles.push(file); + updateUploadedList(); } catch (err) { + // If upload fails, add remaining files back to pending list + files = filesToUpload.slice(i); + updateFileList(); errorDiv.textContent = err.message; progressBar.style.display = "none"; uploadBtn.disabled = false; @@ -213,9 +358,11 @@ } } + // Update the pending files list (should be empty now) + updateFileList(); statusDiv.textContent = "All files uploaded successfully."; progressBar.style.display = "none"; - uploadBtn.disabled = false; + // Note: uploadBtn state is managed by updateFileList() - disabled when no files }); function uploadFile(file) { @@ -226,6 +373,7 @@ // Add custom metadata headers if needed: xhr.setRequestHeader("X-Client-Version", "1.0"); xhr.setRequestHeader("X-Upload-Timestamp", new Date().toISOString()); + xhr.setRequestHeader("X-File-Size", file.size.toString()); xhr.upload.onprogress = e => { if (e.lengthComputable) { @@ -252,7 +400,6 @@ // Try to preserve any directory structure, if supported. const formData = new FormData(); formData.append("file", file, file.webkitRelativePath || file.name); - formData.append("fileSize", file.size.toString()); xhr.send(formData); }); }