mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-06-03 05:25:01 -06:00
Merge branch 'main' into fontlib
This commit is contained in:
commit
282ceca43c
@ -40,28 +40,30 @@ namespace {
|
|||||||
switch (mode) {
|
switch (mode) {
|
||||||
case FileAccessMode::Read:
|
case FileAccessMode::Read:
|
||||||
return L"rb";
|
return L"rb";
|
||||||
case FileAccessMode::Write:
|
|
||||||
return L"wb";
|
|
||||||
case FileAccessMode::Append:
|
case FileAccessMode::Append:
|
||||||
return L"ab";
|
return L"ab";
|
||||||
|
case FileAccessMode::Write:
|
||||||
case FileAccessMode::ReadWrite:
|
case FileAccessMode::ReadWrite:
|
||||||
return L"r+b";
|
return L"r+b";
|
||||||
case FileAccessMode::ReadAppend:
|
case FileAccessMode::ReadAppend:
|
||||||
return L"a+b";
|
return L"a+b";
|
||||||
|
case FileAccessMode::Create:
|
||||||
|
return L"wb";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FileType::TextFile:
|
case FileType::TextFile:
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case FileAccessMode::Read:
|
case FileAccessMode::Read:
|
||||||
return L"r";
|
return L"r";
|
||||||
case FileAccessMode::Write:
|
|
||||||
return L"w";
|
|
||||||
case FileAccessMode::Append:
|
case FileAccessMode::Append:
|
||||||
return L"a";
|
return L"a";
|
||||||
|
case FileAccessMode::Write:
|
||||||
case FileAccessMode::ReadWrite:
|
case FileAccessMode::ReadWrite:
|
||||||
return L"r+";
|
return L"r+";
|
||||||
case FileAccessMode::ReadAppend:
|
case FileAccessMode::ReadAppend:
|
||||||
return L"a+";
|
return L"a+";
|
||||||
|
case FileAccessMode::Create:
|
||||||
|
return L"w";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -91,28 +93,30 @@ namespace {
|
|||||||
switch (mode) {
|
switch (mode) {
|
||||||
case FileAccessMode::Read:
|
case FileAccessMode::Read:
|
||||||
return "rb";
|
return "rb";
|
||||||
case FileAccessMode::Write:
|
|
||||||
return "wb";
|
|
||||||
case FileAccessMode::Append:
|
case FileAccessMode::Append:
|
||||||
return "ab";
|
return "ab";
|
||||||
|
case FileAccessMode::Write:
|
||||||
case FileAccessMode::ReadWrite:
|
case FileAccessMode::ReadWrite:
|
||||||
return "r+b";
|
return "r+b";
|
||||||
case FileAccessMode::ReadAppend:
|
case FileAccessMode::ReadAppend:
|
||||||
return "a+b";
|
return "a+b";
|
||||||
|
case FileAccessMode::Create:
|
||||||
|
return "wb";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FileType::TextFile:
|
case FileType::TextFile:
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case FileAccessMode::Read:
|
case FileAccessMode::Read:
|
||||||
return "r";
|
return "r";
|
||||||
case FileAccessMode::Write:
|
|
||||||
return "w";
|
|
||||||
case FileAccessMode::Append:
|
case FileAccessMode::Append:
|
||||||
return "a";
|
return "a";
|
||||||
|
case FileAccessMode::Write:
|
||||||
case FileAccessMode::ReadWrite:
|
case FileAccessMode::ReadWrite:
|
||||||
return "r+";
|
return "r+";
|
||||||
case FileAccessMode::ReadAppend:
|
case FileAccessMode::ReadAppend:
|
||||||
return "a+";
|
return "a+";
|
||||||
|
case FileAccessMode::Create:
|
||||||
|
return "w";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,9 +21,8 @@ enum class FileAccessMode {
|
|||||||
*/
|
*/
|
||||||
Read = 1 << 0,
|
Read = 1 << 0,
|
||||||
/**
|
/**
|
||||||
* If the file at path exists, the existing contents of the file are erased.
|
* If the file at path exists, it opens the file for writing.
|
||||||
* The empty file is then opened for writing.
|
* If the file at path does not exist, it fails to open the file.
|
||||||
* If the file at path does not exist, it creates and opens a new empty file for writing.
|
|
||||||
*/
|
*/
|
||||||
Write = 1 << 1,
|
Write = 1 << 1,
|
||||||
/**
|
/**
|
||||||
@ -42,6 +41,12 @@ enum class FileAccessMode {
|
|||||||
* reading and appending.
|
* reading and appending.
|
||||||
*/
|
*/
|
||||||
ReadAppend = Read | Append,
|
ReadAppend = Read | Append,
|
||||||
|
/**
|
||||||
|
* If the file at path exists, the existing contents of the file are erased.
|
||||||
|
* The empty file is then opened for writing.
|
||||||
|
* If the file at path does not exist, it creates and opens a new empty file for writing.
|
||||||
|
*/
|
||||||
|
Create = 1 << 3,
|
||||||
};
|
};
|
||||||
DECLARE_ENUM_FLAG_OPERATORS(FileAccessMode);
|
DECLARE_ENUM_FLAG_OPERATORS(FileAccessMode);
|
||||||
|
|
||||||
@ -102,6 +107,11 @@ public:
|
|||||||
return file != nullptr;
|
return file != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsWriteOnly() const {
|
||||||
|
return file_access_mode == FileAccessMode::Append ||
|
||||||
|
file_access_mode == FileAccessMode::Write;
|
||||||
|
}
|
||||||
|
|
||||||
uintptr_t GetFileMapping();
|
uintptr_t GetFileMapping();
|
||||||
|
|
||||||
int Open(const std::filesystem::path& path, FileAccessMode mode,
|
int Open(const std::filesystem::path& path, FileAccessMode mode,
|
||||||
@ -210,7 +220,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static size_t WriteBytes(const std::filesystem::path path, const auto& data) {
|
static size_t WriteBytes(const std::filesystem::path path, const auto& data) {
|
||||||
IOFile out(path, FileAccessMode::Write);
|
IOFile out(path, FileAccessMode::Create);
|
||||||
return out.Write(data);
|
return out.Write(data);
|
||||||
}
|
}
|
||||||
std::FILE* file = nullptr;
|
std::FILE* file = nullptr;
|
||||||
|
|||||||
@ -62,7 +62,7 @@ private:
|
|||||||
class FileBackend {
|
class FileBackend {
|
||||||
public:
|
public:
|
||||||
explicit FileBackend(const std::filesystem::path& filename, bool should_append = false)
|
explicit FileBackend(const std::filesystem::path& filename, bool should_append = false)
|
||||||
: file{filename, should_append ? FS::FileAccessMode::Append : FS::FileAccessMode::Write,
|
: file{filename, should_append ? FS::FileAccessMode::Append : FS::FileAccessMode::Create,
|
||||||
FS::FileType::TextFile} {}
|
FS::FileType::TextFile} {}
|
||||||
|
|
||||||
~FileBackend() = default;
|
~FileBackend() = default;
|
||||||
|
|||||||
@ -152,7 +152,7 @@ inline std::string RunDisassembler(const std::string& disassembler_cli, const T&
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cli.replace(pos, src_arg.size(), "\"" + bin_path.string() + "\"");
|
cli.replace(pos, src_arg.size(), "\"" + bin_path.string() + "\"");
|
||||||
Common::FS::IOFile file(bin_path, Common::FS::FileAccessMode::Write);
|
Common::FS::IOFile file(bin_path, Common::FS::FileAccessMode::Create);
|
||||||
file.Write(shader_code);
|
file.Write(shader_code);
|
||||||
file.Close();
|
file.Close();
|
||||||
|
|
||||||
|
|||||||
@ -123,7 +123,7 @@ void FrameDumpViewer::Draw() {
|
|||||||
const auto fname = fmt::format("{:%F %H-%M-%S} {}_{}_{}.bin", now_time,
|
const auto fname = fmt::format("{:%F %H-%M-%S} {}_{}_{}.bin", now_time,
|
||||||
magic_enum::enum_name(selected_queue_type),
|
magic_enum::enum_name(selected_queue_type),
|
||||||
selected_submit_num, selected_queue_num2);
|
selected_submit_num, selected_queue_num2);
|
||||||
Common::FS::IOFile file(fname, Common::FS::FileAccessMode::Write);
|
Common::FS::IOFile file(fname, Common::FS::FileAccessMode::Create);
|
||||||
const auto& data = frame_dump->queues[selected_cmd].data;
|
const auto& data = frame_dump->queues[selected_cmd].data;
|
||||||
if (file.IsOpen()) {
|
if (file.IsOpen()) {
|
||||||
DebugState.ShowDebugMessage(fmt::format("Dumping cmd as {}", fname));
|
DebugState.ShowDebugMessage(fmt::format("Dumping cmd as {}", fname));
|
||||||
|
|||||||
@ -99,7 +99,7 @@ bool PSF::Open(const std::vector<u8>& psf_buffer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool PSF::Encode(const std::filesystem::path& filepath) const {
|
bool PSF::Encode(const std::filesystem::path& filepath) const {
|
||||||
Common::FS::IOFile file(filepath, Common::FS::FileAccessMode::Write);
|
Common::FS::IOFile file(filepath, Common::FS::FileAccessMode::Create);
|
||||||
if (!file.IsOpen()) {
|
if (!file.IsOpen()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -140,7 +140,7 @@ s32 PS4_SYSV_ABI open(const char* raw_path, s32 flags, u16 mode) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// Create a file if it doesn't exist
|
// Create a file if it doesn't exist
|
||||||
Common::FS::IOFile out(file->m_host_name, Common::FS::FileAccessMode::Write);
|
Common::FS::IOFile out(file->m_host_name, Common::FS::FileAccessMode::Create);
|
||||||
}
|
}
|
||||||
} else if (!exists) {
|
} else if (!exists) {
|
||||||
// If we're not creating a file, and it doesn't exist, return ENOENT
|
// If we're not creating a file, and it doesn't exist, return ENOENT
|
||||||
@ -205,22 +205,30 @@ s32 PS4_SYSV_ABI open(const char* raw_path, s32 flags, u16 mode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (read) {
|
if (read) {
|
||||||
// Read only
|
// Open exclusively for reading
|
||||||
e = file->f.Open(file->m_host_name, Common::FS::FileAccessMode::Read);
|
e = file->f.Open(file->m_host_name, Common::FS::FileAccessMode::Read);
|
||||||
} else if (read_only) {
|
} else if (read_only) {
|
||||||
// Can't open files with write/read-write access in a read only directory
|
// Can't open files with write/read-write access in a read only directory
|
||||||
h->DeleteHandle(handle);
|
h->DeleteHandle(handle);
|
||||||
*__Error() = POSIX_EROFS;
|
*__Error() = POSIX_EROFS;
|
||||||
return -1;
|
return -1;
|
||||||
} else if (append) {
|
|
||||||
// Append can be specified with rdwr or write, but we treat it as a separate mode.
|
|
||||||
e = file->f.Open(file->m_host_name, Common::FS::FileAccessMode::Append);
|
|
||||||
} else if (write) {
|
} else if (write) {
|
||||||
// Write only
|
if (append) {
|
||||||
e = file->f.Open(file->m_host_name, Common::FS::FileAccessMode::Write);
|
// Open exclusively for appending
|
||||||
|
e = file->f.Open(file->m_host_name, Common::FS::FileAccessMode::Append);
|
||||||
|
} else {
|
||||||
|
// Open exclusively for writing
|
||||||
|
e = file->f.Open(file->m_host_name, Common::FS::FileAccessMode::Write);
|
||||||
|
}
|
||||||
} else if (rdwr) {
|
} else if (rdwr) {
|
||||||
// Read and write
|
// Read and write
|
||||||
e = file->f.Open(file->m_host_name, Common::FS::FileAccessMode::ReadWrite);
|
if (append) {
|
||||||
|
// Open for reading and appending
|
||||||
|
e = file->f.Open(file->m_host_name, Common::FS::FileAccessMode::ReadAppend);
|
||||||
|
} else {
|
||||||
|
// Open for reading and writing
|
||||||
|
e = file->f.Open(file->m_host_name, Common::FS::FileAccessMode::ReadWrite);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,6 +362,12 @@ s64 PS4_SYSV_ABI readv(s32 fd, const OrbisKernelIovec* iov, s32 iovcnt) {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (file->f.IsWriteOnly()) {
|
||||||
|
*__Error() = POSIX_EBADF;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
s64 total_read = 0;
|
s64 total_read = 0;
|
||||||
for (s32 i = 0; i < iovcnt; i++) {
|
for (s32 i = 0; i < iovcnt; i++) {
|
||||||
total_read += ReadFile(file->f, iov[i].iov_base, iov[i].iov_len);
|
total_read += ReadFile(file->f, iov[i].iov_base, iov[i].iov_len);
|
||||||
@ -509,6 +523,12 @@ s64 PS4_SYSV_ABI read(s32 fd, void* buf, u64 nbytes) {
|
|||||||
// Socket functions handle errnos internally.
|
// Socket functions handle errnos internally.
|
||||||
return file->socket->ReceivePacket(buf, nbytes, 0, nullptr, 0);
|
return file->socket->ReceivePacket(buf, nbytes, 0, nullptr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (file->f.IsWriteOnly()) {
|
||||||
|
*__Error() = POSIX_EBADF;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return ReadFile(file->f, buf, nbytes);
|
return ReadFile(file->f, buf, nbytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -801,11 +821,7 @@ s32 PS4_SYSV_ABI posix_rename(const char* from, const char* to) {
|
|||||||
auto* h = Common::Singleton<Core::FileSys::HandleTable>::Instance();
|
auto* h = Common::Singleton<Core::FileSys::HandleTable>::Instance();
|
||||||
auto file = h->GetFile(src_path);
|
auto file = h->GetFile(src_path);
|
||||||
if (file) {
|
if (file) {
|
||||||
// We need to force ReadWrite if the file had Write access before
|
auto access_mode = file->f.GetAccessMode();
|
||||||
// Otherwise f.Open will clear the file contents.
|
|
||||||
auto access_mode = file->f.GetAccessMode() == Common::FS::FileAccessMode::Write
|
|
||||||
? Common::FS::FileAccessMode::ReadWrite
|
|
||||||
: file->f.GetAccessMode();
|
|
||||||
file->f.Close();
|
file->f.Close();
|
||||||
std::filesystem::remove(src_path);
|
std::filesystem::remove(src_path);
|
||||||
file->f.Open(dst_path, access_mode);
|
file->f.Open(dst_path, access_mode);
|
||||||
@ -855,6 +871,11 @@ s64 PS4_SYSV_ABI posix_preadv(s32 fd, OrbisKernelIovec* iov, s32 iovcnt, s64 off
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (file->f.IsWriteOnly()) {
|
||||||
|
*__Error() = POSIX_EBADF;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
const s64 pos = file->f.Tell();
|
const s64 pos = file->f.Tell();
|
||||||
SCOPE_EXIT {
|
SCOPE_EXIT {
|
||||||
file->f.Seek(pos);
|
file->f.Seek(pos);
|
||||||
|
|||||||
@ -9,6 +9,35 @@
|
|||||||
|
|
||||||
namespace Libraries::Http {
|
namespace Libraries::Http {
|
||||||
|
|
||||||
|
static bool g_isHttpInitialized = true; // TODO temp always inited
|
||||||
|
|
||||||
|
void NormalizeAndAppendPath(char* dest, char* src) {
|
||||||
|
char* lastSlash;
|
||||||
|
u64 length;
|
||||||
|
|
||||||
|
lastSlash = strrchr(dest, '/');
|
||||||
|
if (lastSlash == NULL) {
|
||||||
|
length = strlen(dest);
|
||||||
|
dest[length] = '/';
|
||||||
|
dest[length + 1] = '\0';
|
||||||
|
} else {
|
||||||
|
lastSlash[1] = '\0';
|
||||||
|
}
|
||||||
|
if (*src == '/') {
|
||||||
|
dest[0] = '\0';
|
||||||
|
}
|
||||||
|
length = strnlen(dest, 0x3fff);
|
||||||
|
strncat(dest, src, 0x3fff - length);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int HttpRequestInternal_Acquire(HttpRequestInternal** outRequest, u32 requestId) {
|
||||||
|
return 0; // TODO dummy
|
||||||
|
}
|
||||||
|
int HttpRequestInternal_Release(HttpRequestInternal* request) {
|
||||||
|
return 0; // TODO dummy
|
||||||
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceHttpAbortRequest() {
|
int PS4_SYSV_ABI sceHttpAbortRequest() {
|
||||||
LOG_ERROR(Lib_Http, "(STUBBED) called");
|
LOG_ERROR(Lib_Http, "(STUBBED) called");
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
@ -34,8 +63,9 @@ int PS4_SYSV_ABI sceHttpAddQuery() {
|
|||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceHttpAddRequestHeader() {
|
int PS4_SYSV_ABI sceHttpAddRequestHeader(int id, const char* name, const char* value, s32 mode) {
|
||||||
LOG_ERROR(Lib_Http, "(STUBBED) called");
|
LOG_ERROR(Lib_Http, "(STUBBED) called id= {} name = {} value = {} mode = {}", id,
|
||||||
|
std::string(name), std::string(value), mode);
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,8 +114,9 @@ int PS4_SYSV_ABI sceHttpCreateConnection() {
|
|||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceHttpCreateConnectionWithURL() {
|
int PS4_SYSV_ABI sceHttpCreateConnectionWithURL(int tmplId, const char* url, bool enableKeepalive) {
|
||||||
LOG_ERROR(Lib_Http, "(STUBBED) called");
|
LOG_ERROR(Lib_Http, "(STUBBED) called tmpid = {} url = {} enableKeepalive = {}", tmplId,
|
||||||
|
std::string(url), enableKeepalive ? 1 : 0);
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,8 +135,10 @@ int PS4_SYSV_ABI sceHttpCreateRequest2() {
|
|||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceHttpCreateRequestWithURL() {
|
int PS4_SYSV_ABI sceHttpCreateRequestWithURL(int connId, s32 method, const char* url,
|
||||||
LOG_ERROR(Lib_Http, "(STUBBED) called");
|
u64 contentLength) {
|
||||||
|
LOG_ERROR(Lib_Http, "(STUBBED) called connId = {} method = {} url={} contentLength={}", connId,
|
||||||
|
method, url, contentLength);
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,7 +217,7 @@ int PS4_SYSV_ABI sceHttpGetAcceptEncodingGZIPEnabled() {
|
|||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceHttpGetAllResponseHeaders() {
|
int PS4_SYSV_ABI sceHttpGetAllResponseHeaders(int reqId, char** header, u64* headerSize) {
|
||||||
LOG_ERROR(Lib_Http, "(STUBBED) called");
|
LOG_ERROR(Lib_Http, "(STUBBED) called");
|
||||||
return ORBIS_FAIL;
|
return ORBIS_FAIL;
|
||||||
}
|
}
|
||||||
@ -254,12 +287,42 @@ int PS4_SYSV_ABI sceHttpGetResponseContentLength() {
|
|||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceHttpGetStatusCode() {
|
int PS4_SYSV_ABI sceHttpGetStatusCode(int reqId, int* statusCode) {
|
||||||
LOG_ERROR(Lib_Http, "(STUBBED) called");
|
LOG_ERROR(Lib_Http, "(STUBBED) called reqId = {}", reqId);
|
||||||
|
#if 0
|
||||||
|
if (!g_isHttpInitialized)
|
||||||
|
return ORBIS_HTTP_ERROR_BEFORE_INIT;
|
||||||
|
|
||||||
|
if (statusCode == nullptr)
|
||||||
|
return ORBIS_HTTP_ERROR_INVALID_VALUE;
|
||||||
|
|
||||||
|
int ret = 0;
|
||||||
|
// Lookup HttpRequestInternal by reqId
|
||||||
|
HttpRequestInternal* request = nullptr;
|
||||||
|
ret = HttpRequestInternal_Acquire(&request, reqId);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
request->m_mutex.lock();
|
||||||
|
if (request->state > 0x11) {
|
||||||
|
if (request->state == 0x16) {
|
||||||
|
ret = request->errorCode;
|
||||||
|
} else {
|
||||||
|
*statusCode = request->httpStatusCode;
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ret = ORBIS_HTTP_ERROR_BEFORE_SEND;
|
||||||
|
}
|
||||||
|
request->m_mutex.unlock();
|
||||||
|
HttpRequestInternal_Release(request);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
#else
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceHttpInit(int libnetMemId, int libsslCtxId, std::size_t poolSize) {
|
int PS4_SYSV_ABI sceHttpInit(int libnetMemId, int libsslCtxId, u64 poolSize) {
|
||||||
LOG_ERROR(Lib_Http, "(DUMMY) called libnetMemId = {} libsslCtxId = {} poolSize = {}",
|
LOG_ERROR(Lib_Http, "(DUMMY) called libnetMemId = {} libsslCtxId = {} poolSize = {}",
|
||||||
libnetMemId, libsslCtxId, poolSize);
|
libnetMemId, libsslCtxId, poolSize);
|
||||||
// return a value >1
|
// return a value >1
|
||||||
@ -267,14 +330,104 @@ int PS4_SYSV_ABI sceHttpInit(int libnetMemId, int libsslCtxId, std::size_t poolS
|
|||||||
return ++id;
|
return ++id;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceHttpParseResponseHeader() {
|
int PS4_SYSV_ABI sceHttpParseResponseHeader(const char* header, u64 headerLen, const char* fieldStr,
|
||||||
|
const char** fieldValue, u64* valueLen) {
|
||||||
LOG_ERROR(Lib_Http, "(STUBBED) called");
|
LOG_ERROR(Lib_Http, "(STUBBED) called");
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceHttpParseStatusLine() {
|
int PS4_SYSV_ABI sceHttpParseStatusLine(const char* statusLine, u64 lineLen, int32_t* httpMajorVer,
|
||||||
LOG_ERROR(Lib_Http, "(STUBBED) called");
|
int32_t* httpMinorVer, int32_t* responseCode,
|
||||||
return ORBIS_OK;
|
const char** reasonPhrase, u64* phraseLen) {
|
||||||
|
if (!statusLine) {
|
||||||
|
LOG_ERROR(Lib_Http, "Invalid response");
|
||||||
|
return ORBIS_HTTP_ERROR_PARSE_HTTP_INVALID_RESPONSE;
|
||||||
|
}
|
||||||
|
if (!httpMajorVer || !httpMinorVer || !responseCode || !reasonPhrase || !phraseLen) {
|
||||||
|
LOG_ERROR(Lib_Http, "Invalid value");
|
||||||
|
return ORBIS_HTTP_ERROR_PARSE_HTTP_INVALID_VALUE;
|
||||||
|
}
|
||||||
|
*httpMajorVer = 0;
|
||||||
|
*httpMinorVer = 0;
|
||||||
|
if (lineLen < 8) {
|
||||||
|
LOG_ERROR(Lib_Http, "Linelen is smaller than 8");
|
||||||
|
return ORBIS_HTTP_ERROR_PARSE_HTTP_INVALID_RESPONSE;
|
||||||
|
}
|
||||||
|
if (strncmp(statusLine, "HTTP/", 5) != 0) {
|
||||||
|
LOG_ERROR(Lib_Http, "statusLine doesn't start with HTTP/");
|
||||||
|
return ORBIS_HTTP_ERROR_PARSE_HTTP_INVALID_RESPONSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
u64 index = 5;
|
||||||
|
|
||||||
|
if (!isdigit(statusLine[index])) {
|
||||||
|
LOG_ERROR(Lib_Http, "Invalid response");
|
||||||
|
|
||||||
|
return ORBIS_HTTP_ERROR_PARSE_HTTP_INVALID_RESPONSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (isdigit(statusLine[index])) {
|
||||||
|
*httpMajorVer = *httpMajorVer * 10 + (statusLine[index] - '0');
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (statusLine[index] != '.') {
|
||||||
|
LOG_ERROR(Lib_Http, "Invalid response");
|
||||||
|
return ORBIS_HTTP_ERROR_PARSE_HTTP_INVALID_RESPONSE;
|
||||||
|
}
|
||||||
|
index++;
|
||||||
|
|
||||||
|
if (!isdigit(statusLine[index])) {
|
||||||
|
LOG_ERROR(Lib_Http, "Invalid response");
|
||||||
|
return ORBIS_HTTP_ERROR_PARSE_HTTP_INVALID_RESPONSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (isdigit(statusLine[index])) {
|
||||||
|
*httpMinorVer = *httpMinorVer * 10 + (statusLine[index] - '0');
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (statusLine[index] != ' ') {
|
||||||
|
LOG_ERROR(Lib_Http, "Invalid response");
|
||||||
|
return ORBIS_HTTP_ERROR_PARSE_HTTP_INVALID_RESPONSE;
|
||||||
|
}
|
||||||
|
index++;
|
||||||
|
|
||||||
|
// Validate and parse the 3-digit HTTP response code
|
||||||
|
if (lineLen - index < 3 || !isdigit(statusLine[index]) || !isdigit(statusLine[index + 1]) ||
|
||||||
|
!isdigit(statusLine[index + 2])) {
|
||||||
|
LOG_ERROR(Lib_Http, "Invalid response");
|
||||||
|
return ORBIS_HTTP_ERROR_PARSE_HTTP_INVALID_RESPONSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
*responseCode = (statusLine[index] - '0') * 100 + (statusLine[index + 1] - '0') * 10 +
|
||||||
|
(statusLine[index + 2] - '0');
|
||||||
|
index += 3;
|
||||||
|
|
||||||
|
if (statusLine[index] != ' ') {
|
||||||
|
LOG_ERROR(Lib_Http, "Invalid response");
|
||||||
|
return ORBIS_HTTP_ERROR_PARSE_HTTP_INVALID_RESPONSE;
|
||||||
|
}
|
||||||
|
index++;
|
||||||
|
|
||||||
|
// Set the reason phrase start position
|
||||||
|
*reasonPhrase = &statusLine[index];
|
||||||
|
u64 phraseStart = index;
|
||||||
|
|
||||||
|
while (index < lineLen && statusLine[index] != '\n') {
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine the length of the reason phrase, excluding trailing \r if present
|
||||||
|
if (index == phraseStart) {
|
||||||
|
*phraseLen = 0;
|
||||||
|
} else {
|
||||||
|
*phraseLen =
|
||||||
|
(statusLine[index - 1] == '\r') ? (index - phraseStart - 1) : (index - phraseStart);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the number of bytes processed
|
||||||
|
return index + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceHttpReadData() {
|
int PS4_SYSV_ABI sceHttpReadData() {
|
||||||
@ -317,8 +470,8 @@ int PS4_SYSV_ABI sceHttpsEnableOptionPrivate() {
|
|||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceHttpSendRequest() {
|
int PS4_SYSV_ABI sceHttpSendRequest(int reqId, const void* postData, u64 size) {
|
||||||
LOG_ERROR(Lib_Http, "(STUBBED) called");
|
LOG_ERROR(Lib_Http, "(STUBBED) called reqId = {} size = {}", reqId, size);
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -548,7 +701,8 @@ int PS4_SYSV_ABI sceHttpUnsetEpoll() {
|
|||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceHttpUriBuild() {
|
int PS4_SYSV_ABI sceHttpUriBuild(char* out, u64* require, u64 prepare,
|
||||||
|
const OrbisHttpUriElement* srcElement, u32 option) {
|
||||||
LOG_ERROR(Lib_Http, "(STUBBED) called");
|
LOG_ERROR(Lib_Http, "(STUBBED) called");
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
@ -563,13 +717,97 @@ int PS4_SYSV_ABI sceHttpUriEscape() {
|
|||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceHttpUriMerge() {
|
int PS4_SYSV_ABI sceHttpUriMerge(char* mergedUrl, char* url, char* relativeUri, u64* require,
|
||||||
LOG_ERROR(Lib_Http, "(STUBBED) called");
|
u64 prepare, u32 option) {
|
||||||
return ORBIS_OK;
|
u64 requiredLength;
|
||||||
|
int returnValue;
|
||||||
|
u64 baseUrlLength;
|
||||||
|
u64 relativeUriLength;
|
||||||
|
u64 totalLength;
|
||||||
|
u64 combinedLength;
|
||||||
|
int parseResult;
|
||||||
|
u64 localSizeRelativeUri;
|
||||||
|
u64 localSizeBaseUrl;
|
||||||
|
OrbisHttpUriElement parsedUriElement;
|
||||||
|
|
||||||
|
if (option != 0 || url == NULL || relativeUri == NULL) {
|
||||||
|
LOG_ERROR(Lib_Http, "Invalid value");
|
||||||
|
return ORBIS_HTTP_ERROR_INVALID_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
returnValue = sceHttpUriParse(NULL, url, NULL, &localSizeBaseUrl, 0);
|
||||||
|
if (returnValue < 0) {
|
||||||
|
LOG_ERROR(Lib_Http, "returning {:#x}", returnValue);
|
||||||
|
return returnValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
returnValue = sceHttpUriParse(NULL, relativeUri, NULL, &localSizeRelativeUri, 0);
|
||||||
|
if (returnValue < 0) {
|
||||||
|
LOG_ERROR(Lib_Http, "returning {:#x}", returnValue);
|
||||||
|
return returnValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
baseUrlLength = strnlen(url, 0x3fff);
|
||||||
|
relativeUriLength = strnlen(relativeUri, 0x3fff);
|
||||||
|
requiredLength = localSizeBaseUrl + 2 + (relativeUriLength + baseUrlLength) * 2;
|
||||||
|
|
||||||
|
if (require) {
|
||||||
|
*require = requiredLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mergedUrl == NULL) {
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prepare < requiredLength) {
|
||||||
|
LOG_ERROR(Lib_Http, "Error Out of memory");
|
||||||
|
return ORBIS_HTTP_ERROR_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
totalLength = strnlen(url, 0x3fff);
|
||||||
|
baseUrlLength = strnlen(relativeUri, 0x3fff);
|
||||||
|
combinedLength = totalLength + 1 + baseUrlLength;
|
||||||
|
relativeUriLength = prepare - combinedLength;
|
||||||
|
|
||||||
|
returnValue =
|
||||||
|
sceHttpUriParse(&parsedUriElement, relativeUri, mergedUrl + totalLength + baseUrlLength + 1,
|
||||||
|
&localSizeRelativeUri, relativeUriLength);
|
||||||
|
if (returnValue < 0) {
|
||||||
|
LOG_ERROR(Lib_Http, "returning {:#x}", returnValue);
|
||||||
|
return returnValue;
|
||||||
|
}
|
||||||
|
if (parsedUriElement.scheme == NULL) {
|
||||||
|
strncpy(mergedUrl, relativeUri, requiredLength);
|
||||||
|
if (require) {
|
||||||
|
*require = strnlen(relativeUri, 0x3fff) + 1;
|
||||||
|
}
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
returnValue =
|
||||||
|
sceHttpUriParse(&parsedUriElement, url, mergedUrl + totalLength + baseUrlLength + 1,
|
||||||
|
&localSizeBaseUrl, relativeUriLength);
|
||||||
|
if (returnValue < 0) {
|
||||||
|
LOG_ERROR(Lib_Http, "returning {:#x}", returnValue);
|
||||||
|
return returnValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
combinedLength += localSizeBaseUrl;
|
||||||
|
strncpy(mergedUrl + combinedLength, parsedUriElement.path, prepare - combinedLength);
|
||||||
|
NormalizeAndAppendPath(mergedUrl + combinedLength, relativeUri);
|
||||||
|
|
||||||
|
returnValue = sceHttpUriBuild(mergedUrl, 0, ~(baseUrlLength + totalLength) + prepare,
|
||||||
|
&parsedUriElement, 0x3f);
|
||||||
|
if (returnValue >= 0) {
|
||||||
|
return ORBIS_OK;
|
||||||
|
} else {
|
||||||
|
LOG_ERROR(Lib_Http, "returning {:#x}", returnValue);
|
||||||
|
return returnValue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceHttpUriParse(OrbisHttpUriElement* out, const char* srcUri, void* pool,
|
int PS4_SYSV_ABI sceHttpUriParse(OrbisHttpUriElement* out, const char* srcUri, void* pool,
|
||||||
size_t* require, size_t prepare) {
|
u64* require, u64 prepare) {
|
||||||
LOG_INFO(Lib_Http, "srcUri = {}", std::string(srcUri));
|
LOG_INFO(Lib_Http, "srcUri = {}", std::string(srcUri));
|
||||||
if (!srcUri) {
|
if (!srcUri) {
|
||||||
LOG_ERROR(Lib_Http, "invalid url");
|
LOG_ERROR(Lib_Http, "invalid url");
|
||||||
@ -586,10 +824,10 @@ int PS4_SYSV_ABI sceHttpUriParse(OrbisHttpUriElement* out, const char* srcUri, v
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Track the total required buffer size
|
// Track the total required buffer size
|
||||||
size_t requiredSize = 0;
|
u64 requiredSize = 0;
|
||||||
|
|
||||||
// Parse the scheme (e.g., "http:", "https:", "file:")
|
// Parse the scheme (e.g., "http:", "https:", "file:")
|
||||||
size_t schemeLength = 0;
|
u64 schemeLength = 0;
|
||||||
while (srcUri[schemeLength] && srcUri[schemeLength] != ':') {
|
while (srcUri[schemeLength] && srcUri[schemeLength] != ':') {
|
||||||
if (!isalnum(srcUri[schemeLength])) {
|
if (!isalnum(srcUri[schemeLength])) {
|
||||||
LOG_ERROR(Lib_Http, "invalid url");
|
LOG_ERROR(Lib_Http, "invalid url");
|
||||||
@ -611,7 +849,7 @@ int PS4_SYSV_ABI sceHttpUriParse(OrbisHttpUriElement* out, const char* srcUri, v
|
|||||||
requiredSize += schemeLength + 1;
|
requiredSize += schemeLength + 1;
|
||||||
|
|
||||||
// Move past the scheme and ':' character
|
// Move past the scheme and ':' character
|
||||||
size_t offset = schemeLength + 1;
|
u64 offset = schemeLength + 1;
|
||||||
|
|
||||||
// Check if "//" appears after the scheme
|
// Check if "//" appears after the scheme
|
||||||
if (strncmp(srcUri + offset, "//", 2) == 0) {
|
if (strncmp(srcUri + offset, "//", 2) == 0) {
|
||||||
@ -638,7 +876,7 @@ int PS4_SYSV_ABI sceHttpUriParse(OrbisHttpUriElement* out, const char* srcUri, v
|
|||||||
|
|
||||||
// Parse the path (everything after the slashes)
|
// Parse the path (everything after the slashes)
|
||||||
char* pathStart = (char*)srcUri + offset;
|
char* pathStart = (char*)srcUri + offset;
|
||||||
size_t pathLength = 0;
|
u64 pathLength = 0;
|
||||||
while (pathStart[pathLength] && pathStart[pathLength] != '?' &&
|
while (pathStart[pathLength] && pathStart[pathLength] != '?' &&
|
||||||
pathStart[pathLength] != '#') {
|
pathStart[pathLength] != '#') {
|
||||||
pathLength++;
|
pathLength++;
|
||||||
@ -689,7 +927,7 @@ int PS4_SYSV_ABI sceHttpUriParse(OrbisHttpUriElement* out, const char* srcUri, v
|
|||||||
hostStart++;
|
hostStart++;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t hostLength = 0;
|
u64 hostLength = 0;
|
||||||
while (hostStart[hostLength] && hostStart[hostLength] != '/' &&
|
while (hostStart[hostLength] && hostStart[hostLength] != '/' &&
|
||||||
hostStart[hostLength] != '?' && hostStart[hostLength] != ':') {
|
hostStart[hostLength] != '?' && hostStart[hostLength] != ':') {
|
||||||
hostLength++;
|
hostLength++;
|
||||||
@ -714,7 +952,7 @@ int PS4_SYSV_ABI sceHttpUriParse(OrbisHttpUriElement* out, const char* srcUri, v
|
|||||||
// Parse the port (if present)
|
// Parse the port (if present)
|
||||||
if (hostStart[hostLength] == ':') {
|
if (hostStart[hostLength] == ':') {
|
||||||
char* portStart = hostStart + hostLength + 1;
|
char* portStart = hostStart + hostLength + 1;
|
||||||
size_t portLength = 0;
|
u64 portLength = 0;
|
||||||
while (portStart[portLength] && isdigit(portStart[portLength])) {
|
while (portStart[portLength] && isdigit(portStart[portLength])) {
|
||||||
portLength++;
|
portLength++;
|
||||||
}
|
}
|
||||||
@ -754,7 +992,7 @@ int PS4_SYSV_ABI sceHttpUriParse(OrbisHttpUriElement* out, const char* srcUri, v
|
|||||||
// Parse the path (if present)
|
// Parse the path (if present)
|
||||||
if (srcUri[offset] == '/') {
|
if (srcUri[offset] == '/') {
|
||||||
char* pathStart = (char*)srcUri + offset;
|
char* pathStart = (char*)srcUri + offset;
|
||||||
size_t pathLength = 0;
|
u64 pathLength = 0;
|
||||||
while (pathStart[pathLength] && pathStart[pathLength] != '?' &&
|
while (pathStart[pathLength] && pathStart[pathLength] != '?' &&
|
||||||
pathStart[pathLength] != '#') {
|
pathStart[pathLength] != '#') {
|
||||||
pathLength++;
|
pathLength++;
|
||||||
@ -780,7 +1018,7 @@ int PS4_SYSV_ABI sceHttpUriParse(OrbisHttpUriElement* out, const char* srcUri, v
|
|||||||
// Parse the query (if present)
|
// Parse the query (if present)
|
||||||
if (srcUri[offset] == '?') {
|
if (srcUri[offset] == '?') {
|
||||||
char* queryStart = (char*)srcUri + offset + 1;
|
char* queryStart = (char*)srcUri + offset + 1;
|
||||||
size_t queryLength = 0;
|
u64 queryLength = 0;
|
||||||
while (queryStart[queryLength] && queryStart[queryLength] != '#') {
|
while (queryStart[queryLength] && queryStart[queryLength] != '#') {
|
||||||
queryLength++;
|
queryLength++;
|
||||||
}
|
}
|
||||||
@ -805,7 +1043,7 @@ int PS4_SYSV_ABI sceHttpUriParse(OrbisHttpUriElement* out, const char* srcUri, v
|
|||||||
// Parse the fragment (if present)
|
// Parse the fragment (if present)
|
||||||
if (srcUri[offset] == '#') {
|
if (srcUri[offset] == '#') {
|
||||||
char* fragmentStart = (char*)srcUri + offset + 1;
|
char* fragmentStart = (char*)srcUri + offset + 1;
|
||||||
size_t fragmentLength = 0;
|
u64 fragmentLength = 0;
|
||||||
while (fragmentStart[fragmentLength]) {
|
while (fragmentStart[fragmentLength]) {
|
||||||
fragmentLength++;
|
fragmentLength++;
|
||||||
}
|
}
|
||||||
@ -833,12 +1071,12 @@ int PS4_SYSV_ABI sceHttpUriParse(OrbisHttpUriElement* out, const char* srcUri, v
|
|||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceHttpUriSweepPath(char* dst, const char* src, size_t srcSize) {
|
int PS4_SYSV_ABI sceHttpUriSweepPath(char* dst, const char* src, u64 srcSize) {
|
||||||
LOG_ERROR(Lib_Http, "(STUBBED) called");
|
LOG_ERROR(Lib_Http, "(STUBBED) called");
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceHttpUriUnescape(char* out, size_t* require, size_t prepare, const char* in) {
|
int PS4_SYSV_ABI sceHttpUriUnescape(char* out, u64* require, u64 prepare, const char* in) {
|
||||||
LOG_ERROR(Lib_Http, "(STUBBED) called");
|
LOG_ERROR(Lib_Http, "(STUBBED) called");
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <mutex>
|
||||||
#include "common/types.h"
|
#include "common/types.h"
|
||||||
#include "core/libraries/network/ssl.h"
|
#include "core/libraries/network/ssl.h"
|
||||||
|
|
||||||
@ -25,6 +26,12 @@ struct OrbisHttpUriElement {
|
|||||||
u8 reserved[10];
|
u8 reserved[10];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct HttpRequestInternal {
|
||||||
|
int state; // +0x20
|
||||||
|
int errorCode; // +0x28
|
||||||
|
int httpStatusCode; // +0x20C
|
||||||
|
std::mutex m_mutex;
|
||||||
|
};
|
||||||
using OrbisHttpsCaList = Libraries::Ssl::OrbisSslCaList;
|
using OrbisHttpsCaList = Libraries::Ssl::OrbisSslCaList;
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceHttpAbortRequest();
|
int PS4_SYSV_ABI sceHttpAbortRequest();
|
||||||
@ -32,7 +39,7 @@ int PS4_SYSV_ABI sceHttpAbortRequestForce();
|
|||||||
int PS4_SYSV_ABI sceHttpAbortWaitRequest();
|
int PS4_SYSV_ABI sceHttpAbortWaitRequest();
|
||||||
int PS4_SYSV_ABI sceHttpAddCookie();
|
int PS4_SYSV_ABI sceHttpAddCookie();
|
||||||
int PS4_SYSV_ABI sceHttpAddQuery();
|
int PS4_SYSV_ABI sceHttpAddQuery();
|
||||||
int PS4_SYSV_ABI sceHttpAddRequestHeader();
|
int PS4_SYSV_ABI sceHttpAddRequestHeader(int id, const char* name, const char* value, s32 mode);
|
||||||
int PS4_SYSV_ABI sceHttpAddRequestHeaderRaw();
|
int PS4_SYSV_ABI sceHttpAddRequestHeaderRaw();
|
||||||
int PS4_SYSV_ABI sceHttpAuthCacheExport();
|
int PS4_SYSV_ABI sceHttpAuthCacheExport();
|
||||||
int PS4_SYSV_ABI sceHttpAuthCacheFlush();
|
int PS4_SYSV_ABI sceHttpAuthCacheFlush();
|
||||||
@ -42,11 +49,12 @@ int PS4_SYSV_ABI sceHttpCookieExport();
|
|||||||
int PS4_SYSV_ABI sceHttpCookieFlush();
|
int PS4_SYSV_ABI sceHttpCookieFlush();
|
||||||
int PS4_SYSV_ABI sceHttpCookieImport();
|
int PS4_SYSV_ABI sceHttpCookieImport();
|
||||||
int PS4_SYSV_ABI sceHttpCreateConnection();
|
int PS4_SYSV_ABI sceHttpCreateConnection();
|
||||||
int PS4_SYSV_ABI sceHttpCreateConnectionWithURL();
|
int PS4_SYSV_ABI sceHttpCreateConnectionWithURL(int tmplId, const char* url, bool enableKeepalive);
|
||||||
int PS4_SYSV_ABI sceHttpCreateEpoll();
|
int PS4_SYSV_ABI sceHttpCreateEpoll();
|
||||||
int PS4_SYSV_ABI sceHttpCreateRequest();
|
int PS4_SYSV_ABI sceHttpCreateRequest();
|
||||||
int PS4_SYSV_ABI sceHttpCreateRequest2();
|
int PS4_SYSV_ABI sceHttpCreateRequest2();
|
||||||
int PS4_SYSV_ABI sceHttpCreateRequestWithURL();
|
int PS4_SYSV_ABI sceHttpCreateRequestWithURL(int connId, s32 method, const char* url,
|
||||||
|
u64 contentLength);
|
||||||
int PS4_SYSV_ABI sceHttpCreateRequestWithURL2();
|
int PS4_SYSV_ABI sceHttpCreateRequestWithURL2();
|
||||||
int PS4_SYSV_ABI sceHttpCreateTemplate();
|
int PS4_SYSV_ABI sceHttpCreateTemplate();
|
||||||
int PS4_SYSV_ABI sceHttpDbgEnableProfile();
|
int PS4_SYSV_ABI sceHttpDbgEnableProfile();
|
||||||
@ -62,7 +70,7 @@ int PS4_SYSV_ABI sceHttpDeleteRequest();
|
|||||||
int PS4_SYSV_ABI sceHttpDeleteTemplate();
|
int PS4_SYSV_ABI sceHttpDeleteTemplate();
|
||||||
int PS4_SYSV_ABI sceHttpDestroyEpoll();
|
int PS4_SYSV_ABI sceHttpDestroyEpoll();
|
||||||
int PS4_SYSV_ABI sceHttpGetAcceptEncodingGZIPEnabled();
|
int PS4_SYSV_ABI sceHttpGetAcceptEncodingGZIPEnabled();
|
||||||
int PS4_SYSV_ABI sceHttpGetAllResponseHeaders();
|
int PS4_SYSV_ABI sceHttpGetAllResponseHeaders(int reqId, char** header, u64* headerSize);
|
||||||
int PS4_SYSV_ABI sceHttpGetAuthEnabled();
|
int PS4_SYSV_ABI sceHttpGetAuthEnabled();
|
||||||
int PS4_SYSV_ABI sceHttpGetAutoRedirect();
|
int PS4_SYSV_ABI sceHttpGetAutoRedirect();
|
||||||
int PS4_SYSV_ABI sceHttpGetConnectionStat();
|
int PS4_SYSV_ABI sceHttpGetConnectionStat();
|
||||||
@ -76,10 +84,13 @@ int PS4_SYSV_ABI sceHttpGetMemoryPoolStats();
|
|||||||
int PS4_SYSV_ABI sceHttpGetNonblock();
|
int PS4_SYSV_ABI sceHttpGetNonblock();
|
||||||
int PS4_SYSV_ABI sceHttpGetRegisteredCtxIds();
|
int PS4_SYSV_ABI sceHttpGetRegisteredCtxIds();
|
||||||
int PS4_SYSV_ABI sceHttpGetResponseContentLength();
|
int PS4_SYSV_ABI sceHttpGetResponseContentLength();
|
||||||
int PS4_SYSV_ABI sceHttpGetStatusCode();
|
int PS4_SYSV_ABI sceHttpGetStatusCode(int reqId, int* statusCode);
|
||||||
int PS4_SYSV_ABI sceHttpInit(int libnetMemId, int libsslCtxId, std::size_t poolSize);
|
int PS4_SYSV_ABI sceHttpInit(int libnetMemId, int libsslCtxId, u64 poolSize);
|
||||||
int PS4_SYSV_ABI sceHttpParseResponseHeader();
|
int PS4_SYSV_ABI sceHttpParseResponseHeader(const char* header, u64 headerLen, const char* fieldStr,
|
||||||
int PS4_SYSV_ABI sceHttpParseStatusLine();
|
const char** fieldValue, u64* valueLen);
|
||||||
|
int PS4_SYSV_ABI sceHttpParseStatusLine(const char* statusLine, u64 lineLen, int32_t* httpMajorVer,
|
||||||
|
int32_t* httpMinorVer, int32_t* responseCode,
|
||||||
|
const char** reasonPhrase, u64* phraseLen);
|
||||||
int PS4_SYSV_ABI sceHttpReadData();
|
int PS4_SYSV_ABI sceHttpReadData();
|
||||||
int PS4_SYSV_ABI sceHttpRedirectCacheFlush();
|
int PS4_SYSV_ABI sceHttpRedirectCacheFlush();
|
||||||
int PS4_SYSV_ABI sceHttpRemoveRequestHeader();
|
int PS4_SYSV_ABI sceHttpRemoveRequestHeader();
|
||||||
@ -88,7 +99,7 @@ int PS4_SYSV_ABI sceHttpsDisableOption();
|
|||||||
int PS4_SYSV_ABI sceHttpsDisableOptionPrivate();
|
int PS4_SYSV_ABI sceHttpsDisableOptionPrivate();
|
||||||
int PS4_SYSV_ABI sceHttpsEnableOption();
|
int PS4_SYSV_ABI sceHttpsEnableOption();
|
||||||
int PS4_SYSV_ABI sceHttpsEnableOptionPrivate();
|
int PS4_SYSV_ABI sceHttpsEnableOptionPrivate();
|
||||||
int PS4_SYSV_ABI sceHttpSendRequest();
|
int PS4_SYSV_ABI sceHttpSendRequest(int reqId, const void* postData, u64 size);
|
||||||
int PS4_SYSV_ABI sceHttpSetAcceptEncodingGZIPEnabled();
|
int PS4_SYSV_ABI sceHttpSetAcceptEncodingGZIPEnabled();
|
||||||
int PS4_SYSV_ABI sceHttpSetAuthEnabled();
|
int PS4_SYSV_ABI sceHttpSetAuthEnabled();
|
||||||
int PS4_SYSV_ABI sceHttpSetAuthInfoCallback();
|
int PS4_SYSV_ABI sceHttpSetAuthInfoCallback();
|
||||||
@ -134,14 +145,16 @@ int PS4_SYSV_ABI sceHttpTerm();
|
|||||||
int PS4_SYSV_ABI sceHttpTryGetNonblock();
|
int PS4_SYSV_ABI sceHttpTryGetNonblock();
|
||||||
int PS4_SYSV_ABI sceHttpTrySetNonblock();
|
int PS4_SYSV_ABI sceHttpTrySetNonblock();
|
||||||
int PS4_SYSV_ABI sceHttpUnsetEpoll();
|
int PS4_SYSV_ABI sceHttpUnsetEpoll();
|
||||||
int PS4_SYSV_ABI sceHttpUriBuild();
|
int PS4_SYSV_ABI sceHttpUriBuild(char* out, u64* require, u64 prepare,
|
||||||
|
const OrbisHttpUriElement* srcElement, u32 option);
|
||||||
int PS4_SYSV_ABI sceHttpUriCopy();
|
int PS4_SYSV_ABI sceHttpUriCopy();
|
||||||
int PS4_SYSV_ABI sceHttpUriEscape();
|
int PS4_SYSV_ABI sceHttpUriEscape();
|
||||||
int PS4_SYSV_ABI sceHttpUriMerge();
|
int PS4_SYSV_ABI sceHttpUriMerge(char* mergedUrl, char* url, char* relativeUri, u64* require,
|
||||||
|
u64 prepare, u32 option);
|
||||||
int PS4_SYSV_ABI sceHttpUriParse(OrbisHttpUriElement* out, const char* srcUri, void* pool,
|
int PS4_SYSV_ABI sceHttpUriParse(OrbisHttpUriElement* out, const char* srcUri, void* pool,
|
||||||
size_t* require, size_t prepare);
|
u64* require, u64 prepare);
|
||||||
int PS4_SYSV_ABI sceHttpUriSweepPath(char* dst, const char* src, size_t srcSize);
|
int PS4_SYSV_ABI sceHttpUriSweepPath(char* dst, const char* src, u64 srcSize);
|
||||||
int PS4_SYSV_ABI sceHttpUriUnescape(char* out, size_t* require, size_t prepare, const char* in);
|
int PS4_SYSV_ABI sceHttpUriUnescape(char* out, u64* require, u64 prepare, const char* in);
|
||||||
int PS4_SYSV_ABI sceHttpWaitRequest();
|
int PS4_SYSV_ABI sceHttpWaitRequest();
|
||||||
|
|
||||||
void RegisterLib(Core::Loader::SymbolsResolver* sym);
|
void RegisterLib(Core::Loader::SymbolsResolver* sym);
|
||||||
|
|||||||
@ -180,7 +180,7 @@ void SaveInstance::SetupAndMount(bool read_only, bool copy_icon, bool ignore_cor
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!ignore_corrupt && !read_only) {
|
if (!ignore_corrupt && !read_only) {
|
||||||
Common::FS::IOFile f(corrupt_file_path, Common::FS::FileAccessMode::Write);
|
Common::FS::IOFile f(corrupt_file_path, Common::FS::FileAccessMode::Create);
|
||||||
f.Close();
|
f.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -59,7 +59,7 @@ void PersistMemory(u32 slot_id, bool lock) {
|
|||||||
while (n++ < 10) {
|
while (n++ < 10) {
|
||||||
try {
|
try {
|
||||||
IOFile f;
|
IOFile f;
|
||||||
int r = f.Open(memoryPath, Common::FS::FileAccessMode::Write);
|
int r = f.Open(memoryPath, Common::FS::FileAccessMode::Create);
|
||||||
if (f.IsOpen()) {
|
if (f.IsOpen()) {
|
||||||
f.WriteRaw<u8>(data.memory_cache.data(), data.memory_cache.size());
|
f.WriteRaw<u8>(data.memory_cache.data(), data.memory_cache.size());
|
||||||
f.Close();
|
f.Close();
|
||||||
@ -148,7 +148,7 @@ void SetIcon(u32 slot_id, void* buf, size_t buf_size) {
|
|||||||
fs::copy_file(src_icon, icon_path);
|
fs::copy_file(src_icon, icon_path);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
IOFile file(icon_path, Common::FS::FileAccessMode::Write);
|
IOFile file(icon_path, Common::FS::FileAccessMode::Create);
|
||||||
file.WriteRaw<u8>(buf, buf_size);
|
file.WriteRaw<u8>(buf, buf_size);
|
||||||
file.Close();
|
file.Close();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1389,7 +1389,7 @@ Error PS4_SYSV_ABI sceSaveDataSaveIcon(const OrbisSaveDataMountPoint* mountPoint
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const Common::FS::IOFile file(path, Common::FS::FileAccessMode::Write);
|
const Common::FS::IOFile file(path, Common::FS::FileAccessMode::Create);
|
||||||
file.WriteRaw<u8>(icon->buf, std::min(icon->bufSize, icon->dataSize));
|
file.WriteRaw<u8>(icon->buf, std::min(icon->bufSize, icon->dataSize));
|
||||||
} catch (const fs::filesystem_error& e) {
|
} catch (const fs::filesystem_error& e) {
|
||||||
LOG_ERROR(Lib_SaveData, "Failed to load icon: {}", e.what());
|
LOG_ERROR(Lib_SaveData, "Failed to load icon: {}", e.what());
|
||||||
|
|||||||
@ -502,19 +502,19 @@ bool Elf::IsSharedLib() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Elf::ElfHeaderDebugDump(const std::filesystem::path& file_name) {
|
void Elf::ElfHeaderDebugDump(const std::filesystem::path& file_name) {
|
||||||
Common::FS::IOFile f{file_name, Common::FS::FileAccessMode::Write,
|
Common::FS::IOFile f{file_name, Common::FS::FileAccessMode::Create,
|
||||||
Common::FS::FileType::TextFile};
|
Common::FS::FileType::TextFile};
|
||||||
f.WriteString(ElfHeaderStr());
|
f.WriteString(ElfHeaderStr());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Elf::SelfHeaderDebugDump(const std::filesystem::path& file_name) {
|
void Elf::SelfHeaderDebugDump(const std::filesystem::path& file_name) {
|
||||||
Common::FS::IOFile f{file_name, Common::FS::FileAccessMode::Write,
|
Common::FS::IOFile f{file_name, Common::FS::FileAccessMode::Create,
|
||||||
Common::FS::FileType::TextFile};
|
Common::FS::FileType::TextFile};
|
||||||
f.WriteString(SElfHeaderStr());
|
f.WriteString(SElfHeaderStr());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Elf::SelfSegHeaderDebugDump(const std::filesystem::path& file_name) {
|
void Elf::SelfSegHeaderDebugDump(const std::filesystem::path& file_name) {
|
||||||
Common::FS::IOFile f{file_name, Common::FS::FileAccessMode::Write,
|
Common::FS::IOFile f{file_name, Common::FS::FileAccessMode::Create,
|
||||||
Common::FS::FileType::TextFile};
|
Common::FS::FileType::TextFile};
|
||||||
for (u16 i = 0; i < m_self.segment_count; i++) {
|
for (u16 i = 0; i < m_self.segment_count; i++) {
|
||||||
f.WriteString(SELFSegHeader(i));
|
f.WriteString(SELFSegHeader(i));
|
||||||
@ -522,7 +522,7 @@ void Elf::SelfSegHeaderDebugDump(const std::filesystem::path& file_name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Elf::PHeaderDebugDump(const std::filesystem::path& file_name) {
|
void Elf::PHeaderDebugDump(const std::filesystem::path& file_name) {
|
||||||
Common::FS::IOFile f{file_name, Common::FS::FileAccessMode::Write,
|
Common::FS::IOFile f{file_name, Common::FS::FileAccessMode::Create,
|
||||||
Common::FS::FileType::TextFile};
|
Common::FS::FileType::TextFile};
|
||||||
if (m_elf_header.e_phentsize > 0) {
|
if (m_elf_header.e_phentsize > 0) {
|
||||||
for (u16 i = 0; i < m_elf_header.e_phnum; i++) {
|
for (u16 i = 0; i < m_elf_header.e_phnum; i++) {
|
||||||
|
|||||||
@ -32,7 +32,7 @@ const SymbolRecord* SymbolsResolver::FindSymbol(const SymbolResolver& s) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SymbolsResolver::DebugDump(const std::filesystem::path& file_name) {
|
void SymbolsResolver::DebugDump(const std::filesystem::path& file_name) {
|
||||||
Common::FS::IOFile f{file_name, Common::FS::FileAccessMode::Write,
|
Common::FS::IOFile f{file_name, Common::FS::FileAccessMode::Create,
|
||||||
Common::FS::FileType::TextFile};
|
Common::FS::FileType::TextFile};
|
||||||
for (const auto& symbol : m_symbols) {
|
for (const auto& symbol : m_symbols) {
|
||||||
const auto ids = Common::SplitString(symbol.name, '#');
|
const auto ids = Common::SplitString(symbol.name, '#');
|
||||||
|
|||||||
@ -559,7 +559,7 @@ void Translator::EmitFetch(const GcnInst& inst) {
|
|||||||
std::filesystem::create_directories(dump_dir);
|
std::filesystem::create_directories(dump_dir);
|
||||||
}
|
}
|
||||||
const auto filename = fmt::format("vs_{:#018x}.fetch.bin", info.pgm_hash);
|
const auto filename = fmt::format("vs_{:#018x}.fetch.bin", info.pgm_hash);
|
||||||
const auto file = IOFile{dump_dir / filename, FileAccessMode::Write};
|
const auto file = IOFile{dump_dir / filename, FileAccessMode::Create};
|
||||||
file.WriteRaw<u8>(fetch_data->code, fetch_data->size);
|
file.WriteRaw<u8>(fetch_data->code, fetch_data->size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,7 @@ static void DumpSrtProgram(const Shader::Info& info, const u8* code, size_t code
|
|||||||
std::filesystem::create_directories(dump_dir);
|
std::filesystem::create_directories(dump_dir);
|
||||||
}
|
}
|
||||||
const auto filename = fmt::format("{}_{:#018x}.srtprogram.txt", info.stage, info.pgm_hash);
|
const auto filename = fmt::format("{}_{:#018x}.srtprogram.txt", info.stage, info.pgm_hash);
|
||||||
const auto file = IOFile{dump_dir / filename, FileAccessMode::Write, FileType::TextFile};
|
const auto file = IOFile{dump_dir / filename, FileAccessMode::Create, FileType::TextFile};
|
||||||
|
|
||||||
u64 address = reinterpret_cast<u64>(code);
|
u64 address = reinterpret_cast<u64>(code);
|
||||||
u64 code_end = address + codesize;
|
u64 code_end = address + codesize;
|
||||||
|
|||||||
@ -28,7 +28,7 @@ void DumpProgram(const Program& program, const Info& info, const std::string& ty
|
|||||||
}
|
}
|
||||||
const auto ir_filename =
|
const auto ir_filename =
|
||||||
fmt::format("{}_{:#018x}.{}irprogram.txt", info.stage, info.pgm_hash, type);
|
fmt::format("{}_{:#018x}.{}irprogram.txt", info.stage, info.pgm_hash, type);
|
||||||
const auto ir_file = IOFile{dump_dir / ir_filename, FileAccessMode::Write, FileType::TextFile};
|
const auto ir_file = IOFile{dump_dir / ir_filename, FileAccessMode::Create, FileType::TextFile};
|
||||||
|
|
||||||
size_t index{0};
|
size_t index{0};
|
||||||
std::map<const IR::Inst*, size_t> inst_to_index;
|
std::map<const IR::Inst*, size_t> inst_to_index;
|
||||||
@ -46,7 +46,7 @@ void DumpProgram(const Program& program, const Info& info, const std::string& ty
|
|||||||
|
|
||||||
const auto asl_filename = fmt::format("{}_{:#018x}.{}asl.txt", info.stage, info.pgm_hash, type);
|
const auto asl_filename = fmt::format("{}_{:#018x}.{}asl.txt", info.stage, info.pgm_hash, type);
|
||||||
const auto asl_file =
|
const auto asl_file =
|
||||||
IOFile{dump_dir / asl_filename, FileAccessMode::Write, FileType::TextFile};
|
IOFile{dump_dir / asl_filename, FileAccessMode::Create, FileType::TextFile};
|
||||||
|
|
||||||
for (const auto& node : program.syntax_list) {
|
for (const auto& node : program.syntax_list) {
|
||||||
std::string s = IR::DumpASLNode(node, block_to_index, inst_to_index) + '\n';
|
std::string s = IR::DumpASLNode(node, block_to_index, inst_to_index) + '\n';
|
||||||
|
|||||||
@ -632,7 +632,7 @@ void PipelineCache::DumpShader(std::span<const u32> code, u64 hash, Shader::Stag
|
|||||||
std::filesystem::create_directories(dump_dir);
|
std::filesystem::create_directories(dump_dir);
|
||||||
}
|
}
|
||||||
const auto filename = fmt::format("{}.{}", GetShaderName(stage, hash, perm_idx), ext);
|
const auto filename = fmt::format("{}.{}", GetShaderName(stage, hash, perm_idx), ext);
|
||||||
const auto file = IOFile{dump_dir / filename, FileAccessMode::Write};
|
const auto file = IOFile{dump_dir / filename, FileAccessMode::Create};
|
||||||
file.WriteSpan(code);
|
file.WriteSpan(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user