Skip to content

Commit

Permalink
Merge pull request #19830 from hrydgard/socket-remap-prep
Browse files Browse the repository at this point in the history
Socket remap prep
  • Loading branch information
hrydgard authored Jan 8, 2025
2 parents f5c2360 + baf6bcc commit 3b81cb9
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Common/Net/HTTPClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ int Client::ReadResponseHeaders(net::Buffer *readbuf, std::vector<std::string> &
int sz = readbuf->TakeLineCRLF(&line);
if (!sz || sz < 0)
break;
INFO_LOG(Log::HTTP, "Header line: %s", line.c_str());
VERBOSE_LOG(Log::HTTP, "Header line: %s", line.c_str());
responseHeaders.push_back(line);
}

Expand Down
1 change: 1 addition & 0 deletions Common/Net/SocketCompat.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
inline bool connectInProgress(int errcode) { return (errcode == WSAEWOULDBLOCK || errcode == WSAEINPROGRESS || errcode == WSAEALREADY || errcode == WSAEINVAL); } // WSAEINVAL should be treated as WSAEALREADY during connect for backward-compatibility with Winsock 1.1
inline bool isDisconnected(int errcode) { return (errcode == WSAECONNRESET || errcode == WSAECONNABORTED || errcode == WSAESHUTDOWN); }
#else
#define SOCKET int
#define INVALID_SOCKET -1
#define SOCKET_ERROR -1
#define closesocket close
Expand Down
4 changes: 4 additions & 0 deletions Core/Dialog/PSPNetconfDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,10 @@ int PSPNetconfDialog::Update(int animSpeed) {
UpdateFade(animSpeed);
StartDraw();

// This disables the notice that we don't support the internet below.
// Keeping the code in case we need it for something later.
hideNotice = true;

if (!hideNotice) {
auto err = GetI18NCategory(I18NCat::ERRORS);
const float WRAP_WIDTH = 254.0f;
Expand Down
2 changes: 0 additions & 2 deletions Core/HLE/NetInetConstants.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#pragma once

#include "ppsspp_config.h"

#if PPSSPP_PLATFORM(WINDOWS)
Expand Down
3 changes: 3 additions & 0 deletions Core/HLE/sceNetInet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,9 @@ static int sceNetInetRecvmsg(int socket, u32 msghdrPtr, int flags) {
// TODO: Do similar to the already working sceNetInetSendmsg but in reverse
//if (pspMsghdr->msg_name != 0) { ... }

//UNFINISHED
free(iov);

return hleLogError(Log::sceNet, retval); // returns number of bytes received?
}

Expand Down
7 changes: 3 additions & 4 deletions Core/HLE/sceNetInet.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

#include "Core/HLE/HLE.h"

#if PPSSPP_PLATFORM(WINDOWS)
#include "Common/CommonWindows.h"
#include <winsock.h>
#endif
#include "Common/Net/SocketCompat.h"

#include <memory>
#include <shared_mutex>
Expand Down Expand Up @@ -106,6 +103,7 @@ typedef struct SceNetInetPollfd { //similar format to pollfd in 32bit (pollfd in
} PACK SceNetInetPollfd;

// TCP & UDP Socket Union (Internal use only)
/*
typedef struct InetSocket {
s32_le id; // posix socket id
s32_le domain; // AF_INET/PF_INET/etc
Expand All @@ -115,6 +113,7 @@ typedef struct InetSocket {
s32_le so_broadcast; // broadcast flag (ie. SO_BROADCAST) to keep track of the broadcast flag, since we're using fake broadcast
s32_le tcp_state; // to keep track TCP connection state
} PACK InetSocket;
*/

#ifdef _MSC_VER
#pragma pack(pop)
Expand Down
13 changes: 7 additions & 6 deletions Core/HLE/sceNp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,18 @@ SceNpAuthMemoryStat npAuthMemStat = {};
PSPTimeval npSigninTimestamp{};

// TODO: These should probably be grouped in a struct, since they're used to generate an auth ticket
int npParentalControl = PARENTAL_CONTROL_ENABLED;
int npUserAge = 24; // faking user Age to 24 yo
int npChatRestriction = 0; // default/initial value on Patapon 3 is 1 (restricted boolean?)
SceNpMyLanguages npMyLangList = { 1033, 2057, 1036 };
constexpr int npParentalControl = PARENTAL_CONTROL_ENABLED;
constexpr int npUserAge = 24; // faking user Age to 24 yo
constexpr int npChatRestriction = 0; // default/initial value on Patapon 3 is 1 (restricted boolean?)
static const SceNpMyLanguages npMyLangList = { 1033, 2057, 1036 }; // Languages the user is assumed to know. No known games make use of this.
// Fields are 4-sized, so the data needs to be too.
char npCountryCode[4] = "fr"; // dummy data taken from https://www.psdevwiki.com/ps3/X-I-5-Ticket. France?
char npRegionCode[4] = "c9"; // not sure what "c9" meant, since it was close to country code data, might be region-related data?
static const char npCountryCode[4] = "us"; // dummy data taken from https://www.psdevwiki.com/ps3/X-I-5-Ticket. Mainly affects what EULA is downloaded.
static const char npRegionCode[4] = "c9"; // not sure what "c9" meant, since it was close to country code data, might be region-related data?
std::string npOnlineId = "DummyOnlineId"; // SceNpOnlineId struct?
std::string npServiceId = ""; // UNO game uses EP2006-NPEH00020_00
std::string npAvatarUrl = "http://DummyAvatarUrl"; // SceNpAvatarUrl struct?

// Game-specific ID, I guess we can use this to auto-choose DNS?
SceNpCommunicationId npTitleId;

std::recursive_mutex npAuthEvtMtx;
Expand Down

0 comments on commit 3b81cb9

Please sign in to comment.