added some debug info

This commit is contained in:
georgemoralis 2025-04-20 10:25:19 +03:00
parent 572b96ac85
commit 852c7c0d22
2 changed files with 62 additions and 78 deletions

View File

@ -9,6 +9,8 @@
namespace Libraries::Http { namespace Libraries::Http {
static bool g_isHttpInitialized = true; // TODO temp always inited
void NormalizeAndAppendPath(char* dest, char* src) { void NormalizeAndAppendPath(char* dest, char* src) {
char* lastSlash; char* lastSlash;
u64 length; u64 length;
@ -29,6 +31,13 @@ void NormalizeAndAppendPath(char* dest, char* src) {
return; 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;
@ -54,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;
} }
@ -104,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;
} }
@ -124,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;
} }
@ -205,7 +218,7 @@ int PS4_SYSV_ABI sceHttpGetAcceptEncodingGZIPEnabled() {
} }
int PS4_SYSV_ABI sceHttpGetAllResponseHeaders(int reqId, char** header, u64* headerSize) { int PS4_SYSV_ABI sceHttpGetAllResponseHeaders(int reqId, char** header, u64* headerSize) {
LOG_ERROR(Lib_Http, "(STUBBED) called"); LOG_ERROR(Lib_Http, "(STUBBED) called reqId = {}", reqId);
return ORBIS_OK; return ORBIS_OK;
} }
@ -275,76 +288,38 @@ int PS4_SYSV_ABI sceHttpGetResponseContentLength() {
} }
int PS4_SYSV_ABI sceHttpGetStatusCode(int reqId, int* statusCode) { 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 0
uint uVar1; if (!g_isHttpInitialized)
#endif return ORBIS_HTTP_ERROR_BEFORE_INIT;
int returnCode;
#if 0 if (statusCode == nullptr)
undefined8 uVar3;
long local_60;
undefined1 local_58 [8];
undefined1 local_50 [8];
long local_48;
undefined8 local_40;
long local_38;
local_38 = ___stack_chk_guard;
local_40 = 0;
local_48 = 0;
if (g_isHttpInitialized == 0) {
returnCode = -0x7fbcefff;
}
#endif
if (statusCode == nullptr) {
// returnCode = ORBIS_HTTP_ERROR_INVALID_VALUE; //TODO
return ORBIS_HTTP_ERROR_INVALID_VALUE; return ORBIS_HTTP_ERROR_INVALID_VALUE;
}
#if 0 int ret = 0;
else { // Lookup HttpRequestInternal by reqId
uVar1 = getSdkVersion(); HttpRequestInternal* request = nullptr;
returnCode = scePthreadAttrInit(local_50); ret = HttpRequestInternal_Acquire(&request, reqId);
if ((-1 < returnCode) || (uVar1 < 0x3000000)) { if (ret < 0)
uVar3 = scePthreadSelf(); return ret;
returnCode = scePthreadAttrGet(uVar3,local_50); request->m_mutex.lock();
if ((returnCode < 0) && (0x2ffffff < uVar1)) { if (request->state > 0x11) {
scePthreadAttrDestroy(local_50); if (request->state == 0x16) {
} ret = request->errorCode;
else { } else {
returnCode = scePthreadAttrGetstack(local_50,&local_60,local_58); *statusCode = request->httpStatusCode;
scePthreadAttrDestroy(local_50); ret = 0;
if (((-1 < returnCode) || (uVar1 < 0x3000000)) &&
((uVar1 < 0x1000000 ||
(returnCode = -0x7fbcef8a, 0x3fcf < (ulong)((long)&local_40 - local_60))))) {
returnCode = FUN_01018c20(&local_48,reqId);
if ((-1 < returnCode) && (returnCode = scePthreadMutexLock(local_48 + 0x530), -1 < returnCode)) {
returnCode = -0x7fbcef9b;
if (0x11 < *(int *)(local_48 + 0x20)) {
if (*(int *)(local_48 + 0x20) == 0x16) {
returnCode = *(int *)(local_48 + 0x28);
}
else {
returnCode = 0;
*statusCode = *(int *)(local_48 + 0x20c);
}
}
scePthreadMutexUnlock(local_48 + 0x530);
}
if (local_48 != 0) {
FUN_010195c0();
}
} }
} } else {
ret = ORBIS_HTTP_ERROR_BEFORE_SEND;
} }
} request->m_mutex.unlock();
if (___stack_chk_guard != local_38) { HttpRequestInternal_Release(request);
/* WARNING: Subroutine does not return */
__stack_chk_fail(); return ret;
} #else
return returnCode;
#endif
*statusCode = 404; // not found
return ORBIS_OK; return ORBIS_OK;
#endif
} }
int PS4_SYSV_ABI sceHttpInit(int libnetMemId, int libsslCtxId, u64 poolSize) { int PS4_SYSV_ABI sceHttpInit(int libnetMemId, int libsslCtxId, u64 poolSize) {
@ -495,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;
} }

View File

@ -3,6 +3,7 @@
#pragma once #pragma once
#include <mutex>
#include "common/types.h" #include "common/types.h"
namespace Core::Loader { namespace Core::Loader {
@ -24,12 +25,19 @@ struct OrbisHttpUriElement {
u8 reserved[10]; u8 reserved[10];
}; };
struct HttpRequestInternal {
int state; // +0x20
int errorCode; // +0x28
int httpStatusCode; // +0x20C
std::mutex m_mutex;
};
int PS4_SYSV_ABI sceHttpAbortRequest(); int PS4_SYSV_ABI sceHttpAbortRequest();
int PS4_SYSV_ABI sceHttpAbortRequestForce(); 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();
@ -39,11 +47,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();
@ -88,7 +97,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();