mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-04-09 11:11:29 -06:00
Merge 77f9275d82 into e64f038ad6
This commit is contained in:
commit
bc2ecb8725
@ -623,8 +623,10 @@ set(NP_LIBS src/core/libraries/np/np_error.h
|
||||
src/core/libraries/np/np_party.h
|
||||
src/core/libraries/np/np_auth.cpp
|
||||
src/core/libraries/np/np_auth.h
|
||||
src/core/libraries/np/np_profile_dialog.cpp
|
||||
src/core/libraries/np/np_profile_dialog.h
|
||||
src/core/libraries/np/np_profile_dialog/np_profile_dialog.cpp
|
||||
src/core/libraries/np/np_profile_dialog/np_profile_dialog.h
|
||||
src/core/libraries/np/np_profile_dialog/np_profile_dialog_ui.cpp
|
||||
src/core/libraries/np/np_profile_dialog/np_profile_dialog_ui.h
|
||||
src/core/libraries/np/np_sns_facebook_dialog.cpp
|
||||
src/core/libraries/np/np_sns_facebook_dialog.h
|
||||
src/core/libraries/np/np_partner.cpp
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
#include "core/libraries/np/np_matching2.h"
|
||||
#include "core/libraries/np/np_partner.h"
|
||||
#include "core/libraries/np/np_party.h"
|
||||
#include "core/libraries/np/np_profile_dialog.h"
|
||||
#include "core/libraries/np/np_profile_dialog/np_profile_dialog.h"
|
||||
#include "core/libraries/np/np_score.h"
|
||||
#include "core/libraries/np/np_sns_facebook_dialog.h"
|
||||
#include "core/libraries/np/np_trophy.h"
|
||||
|
||||
@ -1,72 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2025 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/logging/log.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/libs.h"
|
||||
#include "core/libraries/np/np_profile_dialog.h"
|
||||
|
||||
namespace Libraries::Np::NpProfileDialog {
|
||||
|
||||
s32 PS4_SYSV_ABI sceNpProfileDialogOpen() {
|
||||
LOG_ERROR(Lib_NpProfileDialog, "(STUBBED) called");
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
s32 PS4_SYSV_ABI sceNpProfileDialogClose() {
|
||||
LOG_ERROR(Lib_NpProfileDialog, "(STUBBED) called");
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
s32 PS4_SYSV_ABI sceNpProfileDialogGetResult() {
|
||||
LOG_ERROR(Lib_NpProfileDialog, "(STUBBED) called");
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
s32 PS4_SYSV_ABI sceNpProfileDialogGetStatus() {
|
||||
LOG_ERROR(Lib_NpProfileDialog, "(STUBBED) called");
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
s32 PS4_SYSV_ABI sceNpProfileDialogInitialize() {
|
||||
LOG_ERROR(Lib_NpProfileDialog, "(STUBBED) called");
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
s32 PS4_SYSV_ABI sceNpProfileDialogOpenA() {
|
||||
LOG_ERROR(Lib_NpProfileDialog, "(STUBBED) called");
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
s32 PS4_SYSV_ABI sceNpProfileDialogTerminate() {
|
||||
LOG_ERROR(Lib_NpProfileDialog, "(STUBBED) called");
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
s32 PS4_SYSV_ABI sceNpProfileDialogUpdateStatus() {
|
||||
LOG_DEBUG(Lib_NpProfileDialog, "(STUBBED) called");
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
void RegisterLib(Core::Loader::SymbolsResolver* sym) {
|
||||
LIB_FUNCTION("uj9Cz7Tk0cc", "libSceNpProfileDialogCompat", 1, "libSceNpProfileDialog",
|
||||
sceNpProfileDialogOpen);
|
||||
LIB_FUNCTION("wkwjz0Xdo2A", "libSceNpProfileDialog", 1, "libSceNpProfileDialog",
|
||||
sceNpProfileDialogClose);
|
||||
LIB_FUNCTION("8rhLl1-0W-o", "libSceNpProfileDialog", 1, "libSceNpProfileDialog",
|
||||
sceNpProfileDialogGetResult);
|
||||
LIB_FUNCTION("3BqoiFOjSsk", "libSceNpProfileDialog", 1, "libSceNpProfileDialog",
|
||||
sceNpProfileDialogGetStatus);
|
||||
LIB_FUNCTION("Lg+NCE6pTwQ", "libSceNpProfileDialog", 1, "libSceNpProfileDialog",
|
||||
sceNpProfileDialogInitialize);
|
||||
LIB_FUNCTION("uj9Cz7Tk0cc", "libSceNpProfileDialog", 1, "libSceNpProfileDialog",
|
||||
sceNpProfileDialogOpen);
|
||||
LIB_FUNCTION("nrQRlLKzdwE", "libSceNpProfileDialog", 1, "libSceNpProfileDialog",
|
||||
sceNpProfileDialogOpenA);
|
||||
LIB_FUNCTION("0Sp9vJcB1-w", "libSceNpProfileDialog", 1, "libSceNpProfileDialog",
|
||||
sceNpProfileDialogTerminate);
|
||||
LIB_FUNCTION("haVZE9FgKqE", "libSceNpProfileDialog", 1, "libSceNpProfileDialog",
|
||||
sceNpProfileDialogUpdateStatus);
|
||||
};
|
||||
|
||||
} // namespace Libraries::Np::NpProfileDialog
|
||||
@ -1,24 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2025 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/types.h"
|
||||
|
||||
namespace Core::Loader {
|
||||
class SymbolsResolver;
|
||||
}
|
||||
|
||||
namespace Libraries::Np::NpProfileDialog {
|
||||
|
||||
s32 PS4_SYSV_ABI sceNpProfileDialogOpen();
|
||||
s32 PS4_SYSV_ABI sceNpProfileDialogClose();
|
||||
s32 PS4_SYSV_ABI sceNpProfileDialogGetResult();
|
||||
s32 PS4_SYSV_ABI sceNpProfileDialogGetStatus();
|
||||
s32 PS4_SYSV_ABI sceNpProfileDialogInitialize();
|
||||
s32 PS4_SYSV_ABI sceNpProfileDialogOpenA();
|
||||
s32 PS4_SYSV_ABI sceNpProfileDialogTerminate();
|
||||
s32 PS4_SYSV_ABI sceNpProfileDialogUpdateStatus();
|
||||
|
||||
void RegisterLib(Core::Loader::SymbolsResolver* sym);
|
||||
} // namespace Libraries::Np::NpProfileDialog
|
||||
137
src/core/libraries/np/np_profile_dialog/np_profile_dialog.cpp
Normal file
137
src/core/libraries/np/np_profile_dialog/np_profile_dialog.cpp
Normal file
@ -0,0 +1,137 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2025-2026 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <core/libraries/system/commondialog.h>
|
||||
#include "common/logging/log.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/libs.h"
|
||||
#include "magic_enum/magic_enum.hpp"
|
||||
#include "np_profile_dialog.h"
|
||||
#include "np_profile_dialog_ui.h"
|
||||
|
||||
namespace Libraries::Np::NpProfileDialog {
|
||||
|
||||
static auto g_status = Libraries::CommonDialog::Status::NONE;
|
||||
static NpProfileDialogState g_state{};
|
||||
static OrbisNpProfileDialogResult g_result{};
|
||||
static NpProfileDialogUi g_profile_dialog_ui;
|
||||
|
||||
Libraries::CommonDialog::Error PS4_SYSV_ABI
|
||||
sceNpProfileDialogOpen(OrbisNpProfileDialogParam* param) {
|
||||
if (g_status != Libraries::CommonDialog::Status::INITIALIZED &&
|
||||
g_status != Libraries::CommonDialog::Status::FINISHED) {
|
||||
LOG_INFO(Lib_NpProfileDialog, "called without initialize");
|
||||
return Libraries::CommonDialog::Error::INVALID_STATE;
|
||||
}
|
||||
LOG_ERROR(Lib_NpProfileDialog, "(STUBBED) called");
|
||||
NpProfileDialogState state{};
|
||||
state.onlineId = std::string(param->targetOnlineId.data);
|
||||
state.hasAccountId = false;
|
||||
state.userId = param->userId;
|
||||
g_state = state;
|
||||
g_result = {};
|
||||
g_result.userData = param->userData;
|
||||
g_status = Libraries::CommonDialog::Status::RUNNING;
|
||||
g_profile_dialog_ui = NpProfileDialogUi(&g_state, &g_status, &g_result);
|
||||
return Libraries::CommonDialog::Error::OK;
|
||||
}
|
||||
|
||||
Libraries::CommonDialog::Error PS4_SYSV_ABI sceNpProfileDialogClose() {
|
||||
LOG_DEBUG(Lib_NpProfileDialog, "called");
|
||||
if (g_status != Libraries::CommonDialog::Status::RUNNING) {
|
||||
return Libraries::CommonDialog::Error::NOT_RUNNING;
|
||||
}
|
||||
g_profile_dialog_ui.Finish(Libraries::CommonDialog::Result::OK);
|
||||
return Libraries::CommonDialog::Error::OK;
|
||||
}
|
||||
|
||||
Libraries::CommonDialog::Error PS4_SYSV_ABI
|
||||
sceNpProfileDialogGetResult(OrbisNpProfileDialogResult* result) {
|
||||
LOG_DEBUG(Lib_NpProfileDialog, "called");
|
||||
if (result == nullptr) {
|
||||
return Libraries::CommonDialog::Error::PARAM_INVALID;
|
||||
}
|
||||
*result = g_result;
|
||||
return Libraries::CommonDialog::Error::OK;
|
||||
}
|
||||
|
||||
Libraries::CommonDialog::Status PS4_SYSV_ABI sceNpProfileDialogGetStatus() {
|
||||
LOG_TRACE(Lib_NpProfileDialog, "called status={}", magic_enum::enum_name(g_status));
|
||||
return g_status;
|
||||
}
|
||||
|
||||
Libraries::CommonDialog::Error PS4_SYSV_ABI sceNpProfileDialogInitialize() {
|
||||
if (!CommonDialog::g_isInitialized) {
|
||||
return Libraries::CommonDialog::Error::NOT_SYSTEM_INITIALIZED;
|
||||
}
|
||||
if (g_status != Libraries::CommonDialog::Status::NONE) {
|
||||
LOG_INFO(Lib_NpProfileDialog, "already initialized");
|
||||
return Libraries::CommonDialog::Error::ALREADY_INITIALIZED;
|
||||
}
|
||||
if (CommonDialog::g_isUsed) {
|
||||
return Libraries::CommonDialog::Error::BUSY;
|
||||
}
|
||||
g_status = Libraries::CommonDialog::Status::INITIALIZED;
|
||||
CommonDialog::g_isUsed = true;
|
||||
return Libraries::CommonDialog::Error::OK;
|
||||
}
|
||||
|
||||
Libraries::CommonDialog::Error PS4_SYSV_ABI
|
||||
sceNpProfileDialogOpenA(OrbisNpProfileDialogParamA* param) {
|
||||
if (g_status != Libraries::CommonDialog::Status::INITIALIZED &&
|
||||
g_status != Libraries::CommonDialog::Status::FINISHED) {
|
||||
LOG_INFO(Lib_NpProfileDialog, "called without initialize");
|
||||
return Libraries::CommonDialog::Error::INVALID_STATE;
|
||||
}
|
||||
LOG_ERROR(Lib_NpProfileDialog, "(STUBBED) called");
|
||||
NpProfileDialogState state{};
|
||||
state.accountId = param->targetAccountId;
|
||||
state.hasAccountId = true;
|
||||
state.userId = param->userId;
|
||||
g_state = state;
|
||||
g_result = {};
|
||||
g_result.userData = param->userData;
|
||||
g_status = Libraries::CommonDialog::Status::RUNNING;
|
||||
g_profile_dialog_ui = NpProfileDialogUi(&g_state, &g_status, &g_result);
|
||||
return Libraries::CommonDialog::Error::OK;
|
||||
}
|
||||
|
||||
Libraries::CommonDialog::Error PS4_SYSV_ABI sceNpProfileDialogTerminate() {
|
||||
if (g_status == Libraries::CommonDialog::Status::RUNNING) {
|
||||
sceNpProfileDialogClose();
|
||||
}
|
||||
if (g_status == Libraries::CommonDialog::Status::NONE) {
|
||||
return Libraries::CommonDialog::Error::NOT_INITIALIZED;
|
||||
}
|
||||
g_status = Libraries::CommonDialog::Status::NONE;
|
||||
CommonDialog::g_isUsed = false;
|
||||
return Libraries::CommonDialog::Error::OK;
|
||||
}
|
||||
|
||||
Libraries::CommonDialog::Status PS4_SYSV_ABI sceNpProfileDialogUpdateStatus() {
|
||||
LOG_TRACE(Lib_NpProfileDialog, "called status={}", magic_enum::enum_name(g_status));
|
||||
return g_status;
|
||||
}
|
||||
|
||||
void RegisterLib(Core::Loader::SymbolsResolver* sym) {
|
||||
LIB_FUNCTION("uj9Cz7Tk0cc", "libSceNpProfileDialogCompat", 1, "libSceNpProfileDialog",
|
||||
sceNpProfileDialogOpen);
|
||||
LIB_FUNCTION("wkwjz0Xdo2A", "libSceNpProfileDialog", 1, "libSceNpProfileDialog",
|
||||
sceNpProfileDialogClose);
|
||||
LIB_FUNCTION("8rhLl1-0W-o", "libSceNpProfileDialog", 1, "libSceNpProfileDialog",
|
||||
sceNpProfileDialogGetResult);
|
||||
LIB_FUNCTION("3BqoiFOjSsk", "libSceNpProfileDialog", 1, "libSceNpProfileDialog",
|
||||
sceNpProfileDialogGetStatus);
|
||||
LIB_FUNCTION("Lg+NCE6pTwQ", "libSceNpProfileDialog", 1, "libSceNpProfileDialog",
|
||||
sceNpProfileDialogInitialize);
|
||||
LIB_FUNCTION("uj9Cz7Tk0cc", "libSceNpProfileDialog", 1, "libSceNpProfileDialog",
|
||||
sceNpProfileDialogOpen);
|
||||
LIB_FUNCTION("nrQRlLKzdwE", "libSceNpProfileDialog", 1, "libSceNpProfileDialog",
|
||||
sceNpProfileDialogOpenA);
|
||||
LIB_FUNCTION("0Sp9vJcB1-w", "libSceNpProfileDialog", 1, "libSceNpProfileDialog",
|
||||
sceNpProfileDialogTerminate);
|
||||
LIB_FUNCTION("haVZE9FgKqE", "libSceNpProfileDialog", 1, "libSceNpProfileDialog",
|
||||
sceNpProfileDialogUpdateStatus);
|
||||
};
|
||||
|
||||
} // namespace Libraries::Np::NpProfileDialog
|
||||
71
src/core/libraries/np/np_profile_dialog/np_profile_dialog.h
Normal file
71
src/core/libraries/np/np_profile_dialog/np_profile_dialog.h
Normal file
@ -0,0 +1,71 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2025-2026 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <core/libraries/system/commondialog.h>
|
||||
#include <core/libraries/system/userservice.h>
|
||||
#include "common/types.h"
|
||||
#include "core/libraries/np/np_types.h"
|
||||
|
||||
namespace Core::Loader {
|
||||
class SymbolsResolver;
|
||||
}
|
||||
|
||||
namespace Libraries::Np::NpProfileDialog {
|
||||
|
||||
enum class OrbisNpProfileDialogMode : u32 {
|
||||
ORBIS_NP_PROFILE_DIALOG_MODE_INVALID = 0,
|
||||
ORBIS_NP_PROFILE_DIALOG_MODE_NORMAL = 1,
|
||||
};
|
||||
|
||||
struct OrbisNpProfileDialogParam {
|
||||
CommonDialog::BaseParam baseParam;
|
||||
u64 size;
|
||||
OrbisNpProfileDialogMode mode;
|
||||
Libraries::UserService::OrbisUserServiceUserId userId;
|
||||
Libraries::Np::OrbisNpOnlineId targetOnlineId;
|
||||
void* userData;
|
||||
u8 reserved[32];
|
||||
};
|
||||
|
||||
struct OrbisNpProfileGriefReportParam {
|
||||
s32 reportItem;
|
||||
u8 reserved[28];
|
||||
};
|
||||
|
||||
struct OrbisNpProfileDialogParamA {
|
||||
CommonDialog::BaseParam baseParam;
|
||||
u64 size;
|
||||
OrbisNpProfileDialogMode mode;
|
||||
Libraries::UserService::OrbisUserServiceUserId userId;
|
||||
Libraries::Np::OrbisNpAccountId targetAccountId;
|
||||
int : 32;
|
||||
void* userData;
|
||||
union {
|
||||
uint8_t reserved[32];
|
||||
OrbisNpProfileGriefReportParam griefReportParam;
|
||||
};
|
||||
};
|
||||
|
||||
struct OrbisNpProfileDialogResult {
|
||||
s32 result;
|
||||
CommonDialog::Result userAction;
|
||||
void* userData;
|
||||
u8 reserved[32];
|
||||
};
|
||||
|
||||
Libraries::CommonDialog::Error PS4_SYSV_ABI
|
||||
sceNpProfileDialogOpen(OrbisNpProfileDialogParam* param);
|
||||
Libraries::CommonDialog::Error PS4_SYSV_ABI sceNpProfileDialogClose();
|
||||
Libraries::CommonDialog::Error PS4_SYSV_ABI
|
||||
sceNpProfileDialogGetResult(OrbisNpProfileDialogResult* result);
|
||||
Libraries::CommonDialog::Status PS4_SYSV_ABI sceNpProfileDialogGetStatus();
|
||||
Libraries::CommonDialog::Error PS4_SYSV_ABI sceNpProfileDialogInitialize();
|
||||
Libraries::CommonDialog::Error PS4_SYSV_ABI
|
||||
sceNpProfileDialogOpenA(OrbisNpProfileDialogParamA* param);
|
||||
Libraries::CommonDialog::Error PS4_SYSV_ABI sceNpProfileDialogTerminate();
|
||||
Libraries::CommonDialog::Status PS4_SYSV_ABI sceNpProfileDialogUpdateStatus();
|
||||
|
||||
void RegisterLib(Core::Loader::SymbolsResolver* sym);
|
||||
} // namespace Libraries::Np::NpProfileDialog
|
||||
115
src/core/libraries/np/np_profile_dialog/np_profile_dialog_ui.cpp
Normal file
115
src/core/libraries/np/np_profile_dialog/np_profile_dialog_ui.cpp
Normal file
@ -0,0 +1,115 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2025-2026 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <cinttypes>
|
||||
#include <thread>
|
||||
#include <utility>
|
||||
#include <imgui.h>
|
||||
#include <imgui/imgui_std.h>
|
||||
#include "np_profile_dialog_ui.h"
|
||||
|
||||
using namespace ImGui;
|
||||
using namespace Libraries::CommonDialog;
|
||||
|
||||
namespace Libraries::Np::NpProfileDialog {
|
||||
|
||||
static constexpr ImVec2 BUTTON_SIZE{100.0f, 30.0f};
|
||||
|
||||
NpProfileDialogUi::NpProfileDialogUi(NpProfileDialogState* state, Status* status,
|
||||
OrbisNpProfileDialogResult* result)
|
||||
: state(state), status(status), result(result) {
|
||||
if (status && *status == Status::RUNNING) {
|
||||
first_render = true;
|
||||
AddLayer(this);
|
||||
}
|
||||
}
|
||||
|
||||
NpProfileDialogUi::~NpProfileDialogUi() {
|
||||
Finish(Result::USER_CANCELED);
|
||||
}
|
||||
|
||||
NpProfileDialogUi::NpProfileDialogUi(NpProfileDialogUi&& other) noexcept
|
||||
: Layer(other), state(other.state), status(other.status), result(other.result) {
|
||||
other.state = nullptr;
|
||||
other.status = nullptr;
|
||||
other.result = nullptr;
|
||||
}
|
||||
|
||||
NpProfileDialogUi& NpProfileDialogUi::operator=(NpProfileDialogUi other) {
|
||||
using std::swap;
|
||||
swap(state, other.state);
|
||||
swap(status, other.status);
|
||||
swap(result, other.result);
|
||||
if (status && *status == Status::RUNNING) {
|
||||
first_render = true;
|
||||
AddLayer(this);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
void NpProfileDialogUi::Finish(Result user_action) {
|
||||
if (result) {
|
||||
result->result = 0; // ORBIS_OK for normal termination
|
||||
result->userAction = user_action;
|
||||
}
|
||||
if (status) {
|
||||
*status = Status::FINISHED;
|
||||
}
|
||||
state = nullptr;
|
||||
status = nullptr;
|
||||
result = nullptr;
|
||||
RemoveLayer(this);
|
||||
}
|
||||
|
||||
void NpProfileDialogUi::Draw() {
|
||||
if (status == nullptr || *status != Status::RUNNING) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& io = GetIO();
|
||||
ImVec2 window_size{std::min(io.DisplaySize.x, 400.0f), std::min(io.DisplaySize.y, 200.0f)};
|
||||
|
||||
CentralizeNextWindow();
|
||||
SetNextWindowSize(window_size);
|
||||
SetNextWindowCollapsed(false);
|
||||
if (first_render || !io.NavActive) {
|
||||
SetNextWindowFocus();
|
||||
}
|
||||
KeepNavHighlight();
|
||||
|
||||
if (Begin("NP Profile##NpProfileDialog", nullptr,
|
||||
ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoSavedSettings)) {
|
||||
|
||||
Text("Player Profile");
|
||||
Separator();
|
||||
Spacing();
|
||||
|
||||
if (state->hasAccountId) {
|
||||
Text("Account ID:");
|
||||
Text("%" PRIu64, state->accountId);
|
||||
} else {
|
||||
Text("Online ID:");
|
||||
Text("%s", state->onlineId.c_str());
|
||||
}
|
||||
|
||||
Spacing();
|
||||
SetCursorPos({
|
||||
window_size.x / 2.0f - BUTTON_SIZE.x / 2.0f,
|
||||
window_size.y - 10.0f - BUTTON_SIZE.y,
|
||||
});
|
||||
|
||||
if (Button("OK", BUTTON_SIZE)) {
|
||||
Finish(Result::USER_CANCELED);
|
||||
}
|
||||
|
||||
if (first_render) {
|
||||
SetItemCurrentNavFocus();
|
||||
}
|
||||
}
|
||||
|
||||
End();
|
||||
|
||||
first_render = false;
|
||||
}
|
||||
|
||||
} // namespace Libraries::Np::NpProfileDialog
|
||||
@ -0,0 +1,46 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2026 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <variant>
|
||||
|
||||
#include "common/fixed_value.h"
|
||||
#include "common/types.h"
|
||||
#include "core/libraries/system/commondialog.h"
|
||||
#include "imgui/imgui_layer.h"
|
||||
#include "np_profile_dialog.h"
|
||||
|
||||
namespace Libraries::Np::NpProfileDialog {
|
||||
|
||||
struct NpProfileDialogState {
|
||||
std::string onlineId;
|
||||
OrbisNpAccountId accountId{};
|
||||
bool hasAccountId{false};
|
||||
int userId{};
|
||||
};
|
||||
|
||||
class NpProfileDialogUi : public ImGui::Layer {
|
||||
public:
|
||||
explicit NpProfileDialogUi(NpProfileDialogState* state = nullptr,
|
||||
CommonDialog::Status* status = nullptr,
|
||||
OrbisNpProfileDialogResult* result = nullptr);
|
||||
~NpProfileDialogUi() override;
|
||||
|
||||
NpProfileDialogUi(const NpProfileDialogUi& other) = delete;
|
||||
NpProfileDialogUi(NpProfileDialogUi&& other) noexcept;
|
||||
NpProfileDialogUi& operator=(NpProfileDialogUi other);
|
||||
|
||||
void Finish(CommonDialog::Result user_action);
|
||||
|
||||
void Draw() override;
|
||||
|
||||
private:
|
||||
NpProfileDialogState* state{};
|
||||
CommonDialog::Status* status{};
|
||||
OrbisNpProfileDialogResult* result{};
|
||||
bool first_render{false};
|
||||
};
|
||||
|
||||
} // namespace Libraries::Np::NpProfileDialog
|
||||
@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2024-2026 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/logging/log.h"
|
||||
@ -11,9 +11,13 @@ namespace Libraries::WebBrowserDialog {
|
||||
|
||||
static auto g_status = Libraries::CommonDialog::Status::NONE;
|
||||
|
||||
s32 PS4_SYSV_ABI sceWebBrowserDialogClose() {
|
||||
Libraries::CommonDialog::Error PS4_SYSV_ABI sceWebBrowserDialogClose() {
|
||||
LOG_ERROR(Lib_WebBrowserDialog, "(STUBBED) called");
|
||||
return ORBIS_OK;
|
||||
if (g_status != Libraries::CommonDialog::Status::RUNNING) {
|
||||
return Libraries::CommonDialog::Error::NOT_RUNNING;
|
||||
}
|
||||
LOG_INFO(Lib_NpProfileDialog, "TODO: close npprofile ui dialog"); // TODO close Ui dialog
|
||||
return Libraries::CommonDialog::Error::OK;
|
||||
}
|
||||
|
||||
s32 PS4_SYSV_ABI sceWebBrowserDialogGetEvent() {
|
||||
@ -27,17 +31,23 @@ s32 PS4_SYSV_ABI sceWebBrowserDialogGetResult() {
|
||||
}
|
||||
|
||||
Libraries::CommonDialog::Status PS4_SYSV_ABI sceWebBrowserDialogGetStatus() {
|
||||
LOG_TRACE(Lib_MsgDlg, "called status={}", magic_enum::enum_name(g_status));
|
||||
LOG_TRACE(Lib_WebBrowserDialog, "called status={}", magic_enum::enum_name(g_status));
|
||||
return g_status;
|
||||
}
|
||||
|
||||
Libraries::CommonDialog::Error PS4_SYSV_ABI sceWebBrowserDialogInitialize() {
|
||||
if (CommonDialog::g_isInitialized) {
|
||||
LOG_INFO(Lib_WebBrowserDialog, "already initialized");
|
||||
return Libraries::CommonDialog::Error::ALREADY_SYSTEM_INITIALIZED;
|
||||
if (!CommonDialog::g_isInitialized) {
|
||||
return Libraries::CommonDialog::Error::NOT_SYSTEM_INITIALIZED;
|
||||
}
|
||||
LOG_DEBUG(Lib_WebBrowserDialog, "initialized");
|
||||
CommonDialog::g_isInitialized = true;
|
||||
if (g_status != Libraries::CommonDialog::Status::NONE) {
|
||||
LOG_ERROR(Lib_WebBrowserDialog, "already initialized");
|
||||
return Libraries::CommonDialog::Error::ALREADY_INITIALIZED;
|
||||
}
|
||||
if (CommonDialog::g_isUsed) {
|
||||
return Libraries::CommonDialog::Error::BUSY;
|
||||
}
|
||||
g_status = Libraries::CommonDialog::Status::INITIALIZED;
|
||||
CommonDialog::g_isUsed = true;
|
||||
return Libraries::CommonDialog::Error::OK;
|
||||
}
|
||||
|
||||
@ -46,9 +56,15 @@ s32 PS4_SYSV_ABI sceWebBrowserDialogNavigate() {
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
s32 PS4_SYSV_ABI sceWebBrowserDialogOpen() {
|
||||
LOG_ERROR(Lib_WebBrowserDialog, "(STUBBED) called");
|
||||
return ORBIS_OK;
|
||||
Libraries::CommonDialog::Error PS4_SYSV_ABI sceWebBrowserDialogOpen() {
|
||||
if (g_status != Libraries::CommonDialog::Status::INITIALIZED &&
|
||||
g_status != Libraries::CommonDialog::Status::FINISHED) {
|
||||
LOG_INFO(Lib_WebBrowserDialog, "called without initialize");
|
||||
return Libraries::CommonDialog::Error::INVALID_STATE;
|
||||
}
|
||||
LOG_ERROR(Lib_WebBrowserDialog, "(STUBBED) called"); // TODO open ui dialog
|
||||
g_status = Libraries::CommonDialog::Status::RUNNING;
|
||||
return Libraries::CommonDialog::Error::OK;
|
||||
}
|
||||
|
||||
s32 PS4_SYSV_ABI sceWebBrowserDialogOpenForPredeterminedContent() {
|
||||
@ -73,8 +89,7 @@ s32 PS4_SYSV_ABI sceWebBrowserDialogSetZoom() {
|
||||
|
||||
Libraries::CommonDialog::Error PS4_SYSV_ABI sceWebBrowserDialogTerminate() {
|
||||
if (g_status == Libraries::CommonDialog::Status::RUNNING) {
|
||||
LOG_ERROR(Lib_WebBrowserDialog,
|
||||
"CloseWebBrowser Dialog unimplemented"); // sceWebBrowserDialogClose();
|
||||
sceWebBrowserDialogClose();
|
||||
}
|
||||
if (g_status == Libraries::CommonDialog::Status::NONE) {
|
||||
return Libraries::CommonDialog::Error::NOT_INITIALIZED;
|
||||
@ -85,7 +100,11 @@ Libraries::CommonDialog::Error PS4_SYSV_ABI sceWebBrowserDialogTerminate() {
|
||||
}
|
||||
|
||||
Libraries::CommonDialog::Status PS4_SYSV_ABI sceWebBrowserDialogUpdateStatus() {
|
||||
LOG_TRACE(Lib_MsgDlg, "called status={}", magic_enum::enum_name(g_status));
|
||||
LOG_TRACE(Lib_WebBrowserDialog, "called status={}", magic_enum::enum_name(g_status));
|
||||
if (g_status == Libraries::CommonDialog::Status::RUNNING) {
|
||||
g_status = Libraries::CommonDialog::Status::FINISHED; // TODO removed it when implementing
|
||||
// real dialog
|
||||
}
|
||||
return g_status;
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2024-2026 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
@ -12,13 +12,13 @@ class SymbolsResolver;
|
||||
|
||||
namespace Libraries::WebBrowserDialog {
|
||||
|
||||
s32 PS4_SYSV_ABI sceWebBrowserDialogClose();
|
||||
Libraries::CommonDialog::Error PS4_SYSV_ABI sceWebBrowserDialogClose();
|
||||
s32 PS4_SYSV_ABI sceWebBrowserDialogGetEvent();
|
||||
s32 PS4_SYSV_ABI sceWebBrowserDialogGetResult();
|
||||
Libraries::CommonDialog::Status PS4_SYSV_ABI sceWebBrowserDialogGetStatus();
|
||||
Libraries::CommonDialog::Error PS4_SYSV_ABI sceWebBrowserDialogInitialize();
|
||||
s32 PS4_SYSV_ABI sceWebBrowserDialogNavigate();
|
||||
s32 PS4_SYSV_ABI sceWebBrowserDialogOpen();
|
||||
Libraries::CommonDialog::Error PS4_SYSV_ABI sceWebBrowserDialogOpen();
|
||||
s32 PS4_SYSV_ABI sceWebBrowserDialogOpenForPredeterminedContent();
|
||||
s32 PS4_SYSV_ABI sceWebBrowserDialogResetCookie();
|
||||
s32 PS4_SYSV_ABI sceWebBrowserDialogSetCookie();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user