From 5beb60743516ad459a8602402a9965b61da83736 Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Wed, 10 Jul 2024 19:20:19 +0300 Subject: [PATCH] More HLE stuff and fixes (#273) * sceKernelOpen truncate is not neccesary * fixup scePthreadCondSignal * dummy error , ime dialogs stubbed * sceErrorDialog implemenation (no ui) * small fix in sceSaveDataGetEventResult and sceAppContentTemporaryDataMount2. * ime dialog structs and functions definations * added stubbed avplayer * Open folder should be first on context menu --------- Co-authored-by: raziel1000 --- CMakeLists.txt | 10 + src/common/logging/filter.cpp | 3 + src/common/logging/types.h | 3 + .../libraries/app_content/app_content.cpp | 2 + src/core/libraries/avplayer/avplayer.cpp | 190 ++++++++++++++++++ src/core/libraries/avplayer/avplayer.h | 43 ++++ src/core/libraries/dialogs/error_codes.h | 12 ++ src/core/libraries/dialogs/error_dialog.cpp | 86 ++++++++ src/core/libraries/dialogs/error_dialog.h | 37 ++++ src/core/libraries/dialogs/ime_dialog.cpp | 118 +++++++++++ src/core/libraries/dialogs/ime_dialog.h | 186 +++++++++++++++++ src/core/libraries/kernel/file_system.cpp | 2 +- .../libraries/kernel/thread_management.cpp | 1 + src/core/libraries/libs.cpp | 4 + src/core/libraries/save_data/savedata.cpp | 16 +- src/qt_gui/gui_context_menus.h | 2 +- 16 files changed, 701 insertions(+), 14 deletions(-) create mode 100644 src/core/libraries/avplayer/avplayer.cpp create mode 100644 src/core/libraries/avplayer/avplayer.h create mode 100644 src/core/libraries/dialogs/error_codes.h create mode 100644 src/core/libraries/dialogs/error_dialog.cpp create mode 100644 src/core/libraries/dialogs/error_dialog.h create mode 100644 src/core/libraries/dialogs/ime_dialog.cpp create mode 100644 src/core/libraries/dialogs/ime_dialog.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 89b1f03e..c6036ce9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -161,6 +161,8 @@ set(SYSTEM_LIBS src/core/libraries/system/commondialog.cpp src/core/libraries/disc_map/disc_map.cpp src/core/libraries/disc_map/disc_map.h src/core/libraries/disc_map/disc_map_codes.h + src/core/libraries/avplayer/avplayer.cpp + src/core/libraries/avplayer/avplayer.h ) set(VIDEOOUT_LIB src/core/libraries/videoout/buffer.h @@ -188,6 +190,13 @@ set(LIBC_SOURCES src/core/libraries/libc/libc.cpp src/core/libraries/libc_internal/libc_internal.h ) +set(DIALOGS_LIB src/core/libraries/dialogs/error_dialog.cpp + src/core/libraries/dialogs/error_dialog.h + src/core/libraries/dialogs/ime_dialog.cpp + src/core/libraries/dialogs/ime_dialog.h + src/core/libraries/dialogs/error_codes.h +) + set(PAD_LIB src/core/libraries/pad/pad.cpp src/core/libraries/pad/pad.h ) @@ -309,6 +318,7 @@ set(CORE src/core/aerolib/stubs.cpp ${PLAYGO_LIB} ${USBD_LIB} ${MISC_LIBS} + ${DIALOGS_LIB} src/core/linker.cpp src/core/linker.h src/core/memory.cpp diff --git a/src/common/logging/filter.cpp b/src/common/logging/filter.cpp index 35159bf1..32576abe 100644 --- a/src/common/logging/filter.cpp +++ b/src/common/logging/filter.cpp @@ -108,6 +108,9 @@ bool ParseFilterRule(Filter& instance, Iterator begin, Iterator end) { SUB(Lib, PlayGo) \ SUB(Lib, Usbd) \ SUB(Lib, Ajm) \ + SUB(Lib, ErrorDialog) \ + SUB(Lib, ImeDialog) \ + SUB(Lib, AvPlayer) \ CLS(Frontend) \ CLS(Render) \ SUB(Render, Vulkan) \ diff --git a/src/common/logging/types.h b/src/common/logging/types.h index d415335b..33e52fd4 100644 --- a/src/common/logging/types.h +++ b/src/common/logging/types.h @@ -75,6 +75,9 @@ enum class Class : u8 { Lib_PlayGo, ///< The LibScePlayGo implementation. Lib_Usbd, ///< The LibSceUsbd implementation. Lib_Ajm, ///< The LibSceAjm implementation. + Lib_ErrorDialog, ///< The LibSceErrorDialog implementation. + Lib_ImeDialog, ///< The LibSceImeDialog implementation. + Lib_AvPlayer, ///< The LibSceAvPlayer implementation. Frontend, ///< Emulator UI Render, ///< Video Core Render_Vulkan, ///< Vulkan backend diff --git a/src/core/libraries/app_content/app_content.cpp b/src/core/libraries/app_content/app_content.cpp index aadc368f..7e9cf7a2 100644 --- a/src/core/libraries/app_content/app_content.cpp +++ b/src/core/libraries/app_content/app_content.cpp @@ -198,6 +198,8 @@ int PS4_SYSV_ABI sceAppContentTemporaryDataMount() { int PS4_SYSV_ABI sceAppContentTemporaryDataMount2(OrbisAppContentTemporaryDataOption option, OrbisAppContentMountPoint* mountPoint) { + if (std::string_view(mountPoint->data).empty()) // causing issues with save_data. + return ORBIS_APP_CONTENT_ERROR_PARAMETER; auto* param_sfo = Common::Singleton::Instance(); std::string id(param_sfo->GetString("CONTENT_ID"), 7, 9); const auto& mount_dir = Common::FS::GetUserPath(Common::FS::PathType::TempDataDir) / id; diff --git a/src/core/libraries/avplayer/avplayer.cpp b/src/core/libraries/avplayer/avplayer.cpp new file mode 100644 index 00000000..dd9f42b2 --- /dev/null +++ b/src/core/libraries/avplayer/avplayer.cpp @@ -0,0 +1,190 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +// Generated By moduleGenerator +#include "avplayer.h" +#include "common/logging/log.h" +#include "core/libraries/error_codes.h" +#include "core/libraries/libs.h" + +namespace Libraries::AvPlayer { + +int PS4_SYSV_ABI sceAvPlayerAddSource() { + LOG_ERROR(Lib_AvPlayer, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceAvPlayerAddSourceEx() { + LOG_ERROR(Lib_AvPlayer, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceAvPlayerChangeStream() { + LOG_ERROR(Lib_AvPlayer, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceAvPlayerClose() { + LOG_ERROR(Lib_AvPlayer, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceAvPlayerCurrentTime() { + LOG_ERROR(Lib_AvPlayer, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceAvPlayerDisableStream() { + LOG_ERROR(Lib_AvPlayer, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceAvPlayerEnableStream() { + LOG_ERROR(Lib_AvPlayer, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceAvPlayerGetAudioData() { + LOG_ERROR(Lib_AvPlayer, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceAvPlayerGetStreamInfo() { + LOG_ERROR(Lib_AvPlayer, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceAvPlayerGetVideoData() { + LOG_ERROR(Lib_AvPlayer, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceAvPlayerGetVideoDataEx() { + LOG_ERROR(Lib_AvPlayer, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceAvPlayerInit() { + LOG_ERROR(Lib_AvPlayer, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceAvPlayerInitEx() { + LOG_ERROR(Lib_AvPlayer, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceAvPlayerIsActive() { + LOG_ERROR(Lib_AvPlayer, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceAvPlayerJumpToTime() { + LOG_ERROR(Lib_AvPlayer, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceAvPlayerPause() { + LOG_ERROR(Lib_AvPlayer, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceAvPlayerPostInit() { + LOG_ERROR(Lib_AvPlayer, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceAvPlayerPrintf() { + LOG_ERROR(Lib_AvPlayer, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceAvPlayerResume() { + LOG_ERROR(Lib_AvPlayer, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceAvPlayerSetAvSyncMode() { + LOG_ERROR(Lib_AvPlayer, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceAvPlayerSetLogCallback() { + LOG_ERROR(Lib_AvPlayer, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceAvPlayerSetLooping() { + LOG_ERROR(Lib_AvPlayer, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceAvPlayerSetTrickSpeed() { + LOG_ERROR(Lib_AvPlayer, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceAvPlayerStart() { + LOG_ERROR(Lib_AvPlayer, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceAvPlayerStop() { + LOG_ERROR(Lib_AvPlayer, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceAvPlayerStreamCount() { + LOG_ERROR(Lib_AvPlayer, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceAvPlayerVprintf() { + LOG_ERROR(Lib_AvPlayer, "(STUBBED) called"); + return ORBIS_OK; +} + +void RegisterlibSceAvPlayer(Core::Loader::SymbolsResolver* sym) { + LIB_FUNCTION("KMcEa+rHsIo", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0, sceAvPlayerAddSource); + LIB_FUNCTION("x8uvuFOPZhU", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0, + sceAvPlayerAddSourceEx); + LIB_FUNCTION("buMCiJftcfw", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0, + sceAvPlayerChangeStream); + LIB_FUNCTION("NkJwDzKmIlw", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0, sceAvPlayerClose); + LIB_FUNCTION("wwM99gjFf1Y", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0, + sceAvPlayerCurrentTime); + LIB_FUNCTION("BOVKAzRmuTQ", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0, + sceAvPlayerDisableStream); + LIB_FUNCTION("ODJK2sn9w4A", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0, + sceAvPlayerEnableStream); + LIB_FUNCTION("Wnp1OVcrZgk", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0, + sceAvPlayerGetAudioData); + LIB_FUNCTION("d8FcbzfAdQw", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0, + sceAvPlayerGetStreamInfo); + LIB_FUNCTION("o3+RWnHViSg", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0, + sceAvPlayerGetVideoData); + LIB_FUNCTION("JdksQu8pNdQ", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0, + sceAvPlayerGetVideoDataEx); + LIB_FUNCTION("aS66RI0gGgo", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0, sceAvPlayerInit); + LIB_FUNCTION("o9eWRkSL+M4", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0, sceAvPlayerInitEx); + LIB_FUNCTION("UbQoYawOsfY", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0, sceAvPlayerIsActive); + LIB_FUNCTION("XC9wM+xULz8", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0, sceAvPlayerJumpToTime); + LIB_FUNCTION("9y5v+fGN4Wk", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0, sceAvPlayerPause); + LIB_FUNCTION("HD1YKVU26-M", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0, sceAvPlayerPostInit); + LIB_FUNCTION("agig-iDRrTE", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0, sceAvPlayerPrintf); + LIB_FUNCTION("w5moABNwnRY", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0, sceAvPlayerResume); + LIB_FUNCTION("k-q+xOxdc3E", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0, + sceAvPlayerSetAvSyncMode); + LIB_FUNCTION("eBTreZ84JFY", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0, + sceAvPlayerSetLogCallback); + LIB_FUNCTION("OVths0xGfho", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0, sceAvPlayerSetLooping); + LIB_FUNCTION("av8Z++94rs0", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0, + sceAvPlayerSetTrickSpeed); + LIB_FUNCTION("ET4Gr-Uu07s", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0, sceAvPlayerStart); + LIB_FUNCTION("ZC17w3vB5Lo", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0, sceAvPlayerStop); + LIB_FUNCTION("hdTyRzCXQeQ", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0, + sceAvPlayerStreamCount); + LIB_FUNCTION("yN7Jhuv8g24", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0, sceAvPlayerVprintf); +}; + +} // namespace Libraries::AvPlayer \ No newline at end of file diff --git a/src/core/libraries/avplayer/avplayer.h b/src/core/libraries/avplayer/avplayer.h new file mode 100644 index 00000000..39a619ee --- /dev/null +++ b/src/core/libraries/avplayer/avplayer.h @@ -0,0 +1,43 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "common/types.h" + +namespace Core::Loader { +class SymbolsResolver; +} + +namespace Libraries::AvPlayer { + +int PS4_SYSV_ABI sceAvPlayerAddSource(); +int PS4_SYSV_ABI sceAvPlayerAddSourceEx(); +int PS4_SYSV_ABI sceAvPlayerChangeStream(); +int PS4_SYSV_ABI sceAvPlayerClose(); +int PS4_SYSV_ABI sceAvPlayerCurrentTime(); +int PS4_SYSV_ABI sceAvPlayerDisableStream(); +int PS4_SYSV_ABI sceAvPlayerEnableStream(); +int PS4_SYSV_ABI sceAvPlayerGetAudioData(); +int PS4_SYSV_ABI sceAvPlayerGetStreamInfo(); +int PS4_SYSV_ABI sceAvPlayerGetVideoData(); +int PS4_SYSV_ABI sceAvPlayerGetVideoDataEx(); +int PS4_SYSV_ABI sceAvPlayerInit(); +int PS4_SYSV_ABI sceAvPlayerInitEx(); +int PS4_SYSV_ABI sceAvPlayerIsActive(); +int PS4_SYSV_ABI sceAvPlayerJumpToTime(); +int PS4_SYSV_ABI sceAvPlayerPause(); +int PS4_SYSV_ABI sceAvPlayerPostInit(); +int PS4_SYSV_ABI sceAvPlayerPrintf(); +int PS4_SYSV_ABI sceAvPlayerResume(); +int PS4_SYSV_ABI sceAvPlayerSetAvSyncMode(); +int PS4_SYSV_ABI sceAvPlayerSetLogCallback(); +int PS4_SYSV_ABI sceAvPlayerSetLooping(); +int PS4_SYSV_ABI sceAvPlayerSetTrickSpeed(); +int PS4_SYSV_ABI sceAvPlayerStart(); +int PS4_SYSV_ABI sceAvPlayerStop(); +int PS4_SYSV_ABI sceAvPlayerStreamCount(); +int PS4_SYSV_ABI sceAvPlayerVprintf(); + +void RegisterlibSceAvPlayer(Core::Loader::SymbolsResolver* sym); +} // namespace Libraries::AvPlayer \ No newline at end of file diff --git a/src/core/libraries/dialogs/error_codes.h b/src/core/libraries/dialogs/error_codes.h new file mode 100644 index 00000000..587a2a97 --- /dev/null +++ b/src/core/libraries/dialogs/error_codes.h @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +constexpr int ORBIS_ERROR_DIALOG_ERROR_NOT_INITIALIZED = 0x80ED0001; // not initialized +constexpr int ORBIS_ERROR_DIALOG_ERROR_ALREADY_INITIALIZED = 0x80ED0002; // already initialized +constexpr int ORBIS_ERROR_DIALOG_ERROR_PARAM_INVALID = 0x80ED0003; // Parameter is invalid +constexpr int ORBIS_ERROR_DIALOG_ERROR_UNEXPECTED_FATAL = 0x80ED0004; // Unexpected fatal error +constexpr int ORBIS_ERROR_DIALOG_ERROR_INVALID_STATE = 0x80ED0005; // not in a callable state +constexpr int ORBIS_ERROR_DIALOG_ERROR_SERVICE_BUSY = 0x80ED0006; // Process is busy +constexpr int ORBIS_ERROR_DIALOG_ERROR_INVALID_USER_ID = 0x80ED0007; // Invalid user ID diff --git a/src/core/libraries/dialogs/error_dialog.cpp b/src/core/libraries/dialogs/error_dialog.cpp new file mode 100644 index 00000000..02f82c09 --- /dev/null +++ b/src/core/libraries/dialogs/error_dialog.cpp @@ -0,0 +1,86 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +// Generated By moduleGenerator +#include "common/logging/log.h" +#include "core/libraries/error_codes.h" +#include "core/libraries/libs.h" +#include "error_codes.h" +#include "error_dialog.h" + +namespace Libraries::ErrorDialog { + +static OrbisErrorDialogStatus g_error_dlg_status = + OrbisErrorDialogStatus::ORBIS_ERROR_DIALOG_STATUS_NONE; + +int PS4_SYSV_ABI sceErrorDialogClose() { + g_error_dlg_status = OrbisErrorDialogStatus::ORBIS_ERROR_DIALOG_STATUS_FINISHED; + return ORBIS_OK; +} + +OrbisErrorDialogStatus PS4_SYSV_ABI sceErrorDialogGetStatus() { + return g_error_dlg_status; +} + +int PS4_SYSV_ABI sceErrorDialogInitialize(OrbisErrorDialogParam* param) { + if (g_error_dlg_status == OrbisErrorDialogStatus::ORBIS_ERROR_DIALOG_STATUS_INITIALIZED) { + LOG_ERROR(Lib_ErrorDialog, "Error dialog is already at init mode"); + return ORBIS_ERROR_DIALOG_ERROR_ALREADY_INITIALIZED; + } + g_error_dlg_status = OrbisErrorDialogStatus::ORBIS_ERROR_DIALOG_STATUS_INITIALIZED; + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceErrorDialogOpen(OrbisErrorDialogParam* param) { + LOG_ERROR(Lib_ErrorDialog, "size = {} errorcode = {:#x} userid = {}", param->size, + param->errorCode, param->userId); + g_error_dlg_status = OrbisErrorDialogStatus::ORBIS_ERROR_DIALOG_STATUS_RUNNING; + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceErrorDialogOpenDetail() { + LOG_ERROR(Lib_ErrorDialog, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceErrorDialogOpenWithReport() { + LOG_ERROR(Lib_ErrorDialog, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceErrorDialogTerminate() { + if (g_error_dlg_status == OrbisErrorDialogStatus::ORBIS_ERROR_DIALOG_STATUS_NONE) { + LOG_ERROR(Lib_ErrorDialog, "Error dialog hasn't initialized"); + return ORBIS_ERROR_DIALOG_ERROR_NOT_INITIALIZED; + } + g_error_dlg_status = OrbisErrorDialogStatus::ORBIS_ERROR_DIALOG_STATUS_NONE; + return ORBIS_OK; +} + +OrbisErrorDialogStatus PS4_SYSV_ABI sceErrorDialogUpdateStatus() { + // TODO when imgui dialog is done this will loop until ORBIS_ERROR_DIALOG_STATUS_FINISHED + // This should be done calling sceErrorDialogClose but since we don't have a dialog we finish it + // here + return OrbisErrorDialogStatus::ORBIS_ERROR_DIALOG_STATUS_FINISHED; +} + +void RegisterlibSceErrorDialog(Core::Loader::SymbolsResolver* sym) { + LIB_FUNCTION("ekXHb1kDBl0", "libSceErrorDialog", 1, "libSceErrorDialog", 1, 1, + sceErrorDialogClose); + LIB_FUNCTION("t2FvHRXzgqk", "libSceErrorDialog", 1, "libSceErrorDialog", 1, 1, + sceErrorDialogGetStatus); + LIB_FUNCTION("I88KChlynSs", "libSceErrorDialog", 1, "libSceErrorDialog", 1, 1, + sceErrorDialogInitialize); + LIB_FUNCTION("M2ZF-ClLhgY", "libSceErrorDialog", 1, "libSceErrorDialog", 1, 1, + sceErrorDialogOpen); + LIB_FUNCTION("jrpnVQfJYgQ", "libSceErrorDialog", 1, "libSceErrorDialog", 1, 1, + sceErrorDialogOpenDetail); + LIB_FUNCTION("wktCiyWoDTI", "libSceErrorDialog", 1, "libSceErrorDialog", 1, 1, + sceErrorDialogOpenWithReport); + LIB_FUNCTION("9XAxK2PMwk8", "libSceErrorDialog", 1, "libSceErrorDialog", 1, 1, + sceErrorDialogTerminate); + LIB_FUNCTION("WWiGuh9XfgQ", "libSceErrorDialog", 1, "libSceErrorDialog", 1, 1, + sceErrorDialogUpdateStatus); +}; + +} // namespace Libraries::ErrorDialog \ No newline at end of file diff --git a/src/core/libraries/dialogs/error_dialog.h b/src/core/libraries/dialogs/error_dialog.h new file mode 100644 index 00000000..e491b2ee --- /dev/null +++ b/src/core/libraries/dialogs/error_dialog.h @@ -0,0 +1,37 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "common/types.h" + +namespace Core::Loader { +class SymbolsResolver; +} +namespace Libraries::ErrorDialog { + +enum OrbisErrorDialogStatus { + ORBIS_ERROR_DIALOG_STATUS_NONE = 0, + ORBIS_ERROR_DIALOG_STATUS_INITIALIZED = 1, + ORBIS_ERROR_DIALOG_STATUS_RUNNING = 2, + ORBIS_ERROR_DIALOG_STATUS_FINISHED = 3 +}; + +struct OrbisErrorDialogParam { + s32 size; + u32 errorCode; + s32 userId; + s32 reserved; +}; + +int PS4_SYSV_ABI sceErrorDialogClose(); +OrbisErrorDialogStatus PS4_SYSV_ABI sceErrorDialogGetStatus(); +int PS4_SYSV_ABI sceErrorDialogInitialize(OrbisErrorDialogParam* param); +int PS4_SYSV_ABI sceErrorDialogOpen(OrbisErrorDialogParam* param); +int PS4_SYSV_ABI sceErrorDialogOpenDetail(); +int PS4_SYSV_ABI sceErrorDialogOpenWithReport(); +int PS4_SYSV_ABI sceErrorDialogTerminate(); +OrbisErrorDialogStatus PS4_SYSV_ABI sceErrorDialogUpdateStatus(); + +void RegisterlibSceErrorDialog(Core::Loader::SymbolsResolver* sym); +} // namespace Libraries::ErrorDialog \ No newline at end of file diff --git a/src/core/libraries/dialogs/ime_dialog.cpp b/src/core/libraries/dialogs/ime_dialog.cpp new file mode 100644 index 00000000..89136a03 --- /dev/null +++ b/src/core/libraries/dialogs/ime_dialog.cpp @@ -0,0 +1,118 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +// Generated By moduleGenerator +#include "common/logging/log.h" +#include "core/libraries/error_codes.h" +#include "core/libraries/libs.h" +#include "ime_dialog.h" + +namespace Libraries::ImeDialog { + +int PS4_SYSV_ABI sceImeDialogAbort() { + LOG_ERROR(Lib_ImeDialog, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceImeDialogForceClose() { + LOG_ERROR(Lib_ImeDialog, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceImeDialogForTestFunction() { + LOG_ERROR(Lib_ImeDialog, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceImeDialogGetCurrentStarState() { + LOG_ERROR(Lib_ImeDialog, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceImeDialogGetPanelPositionAndForm() { + LOG_ERROR(Lib_ImeDialog, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceImeDialogGetPanelSize() { + LOG_ERROR(Lib_ImeDialog, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceImeDialogGetPanelSizeExtended() { + LOG_ERROR(Lib_ImeDialog, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceImeDialogGetResult(OrbisImeDialogResult* result) { + LOG_ERROR(Lib_ImeDialog, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceImeDialogGetStatus() { + LOG_ERROR(Lib_ImeDialog, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceImeDialogInit(const OrbisImeDialogParam* param, + const OrbisImeParamExtended* extended) { + LOG_ERROR(Lib_ImeDialog, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceImeDialogInitInternal() { + LOG_ERROR(Lib_ImeDialog, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceImeDialogInitInternal2() { + LOG_ERROR(Lib_ImeDialog, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceImeDialogInitInternal3() { + LOG_ERROR(Lib_ImeDialog, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceImeDialogSetPanelPosition() { + LOG_ERROR(Lib_ImeDialog, "(STUBBED) called"); + return ORBIS_OK; +} + +int PS4_SYSV_ABI sceImeDialogTerm() { + LOG_ERROR(Lib_ImeDialog, "(STUBBED) called"); + return ORBIS_OK; +} + +void RegisterlibSceImeDialog(Core::Loader::SymbolsResolver* sym) { + LIB_FUNCTION("oBmw4xrmfKs", "libSceImeDialog", 1, "libSceImeDialog", 1, 1, sceImeDialogAbort); + LIB_FUNCTION("bX4H+sxPI-o", "libSceImeDialog", 1, "libSceImeDialog", 1, 1, + sceImeDialogForceClose); + LIB_FUNCTION("UFcyYDf+e88", "libSceImeDialog", 1, "libSceImeDialog", 1, 1, + sceImeDialogForTestFunction); + LIB_FUNCTION("fy6ntM25pEc", "libSceImeDialog", 1, "libSceImeDialog", 1, 1, + sceImeDialogGetCurrentStarState); + LIB_FUNCTION("8jqzzPioYl8", "libSceImeDialog", 1, "libSceImeDialog", 1, 1, + sceImeDialogGetPanelPositionAndForm); + LIB_FUNCTION("wqsJvRXwl58", "libSceImeDialog", 1, "libSceImeDialog", 1, 1, + sceImeDialogGetPanelSize); + LIB_FUNCTION("CRD+jSErEJQ", "libSceImeDialog", 1, "libSceImeDialog", 1, 1, + sceImeDialogGetPanelSizeExtended); + LIB_FUNCTION("x01jxu+vxlc", "libSceImeDialog", 1, "libSceImeDialog", 1, 1, + sceImeDialogGetResult); + LIB_FUNCTION("IADmD4tScBY", "libSceImeDialog", 1, "libSceImeDialog", 1, 1, + sceImeDialogGetStatus); + LIB_FUNCTION("NUeBrN7hzf0", "libSceImeDialog", 1, "libSceImeDialog", 1, 1, sceImeDialogInit); + LIB_FUNCTION("KR6QDasuKco", "libSceImeDialog", 1, "libSceImeDialog", 1, 1, + sceImeDialogInitInternal); + LIB_FUNCTION("oe92cnJQ9HE", "libSceImeDialog", 1, "libSceImeDialog", 1, 1, + sceImeDialogInitInternal2); + LIB_FUNCTION("IoKIpNf9EK0", "libSceImeDialog", 1, "libSceImeDialog", 1, 1, + sceImeDialogInitInternal3); + LIB_FUNCTION("-2WqB87KKGg", "libSceImeDialog", 1, "libSceImeDialog", 1, 1, + sceImeDialogSetPanelPosition); + LIB_FUNCTION("gyTyVn+bXMw", "libSceImeDialog", 1, "libSceImeDialog", 1, 1, sceImeDialogTerm); +}; + +} // namespace Libraries::ImeDialog \ No newline at end of file diff --git a/src/core/libraries/dialogs/ime_dialog.h b/src/core/libraries/dialogs/ime_dialog.h new file mode 100644 index 00000000..08c980a4 --- /dev/null +++ b/src/core/libraries/dialogs/ime_dialog.h @@ -0,0 +1,186 @@ +// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "common/types.h" + +namespace Core::Loader { +class SymbolsResolver; +} + +namespace Libraries::ImeDialog { + +enum OrbisImeDialogStatus { + ORBIS_IME_DIALOG_STATUS_NONE = 0, + ORBIS_IME_DIALOG_STATUS_RUNNING = 1, + ORBIS_IME_DIALOG_STATUS_FINISHED = 2 +}; + +enum OrbisImeDialogEndStatus { + ORBIS_IME_DIALOG_END_STATUS_OK = 0, + ORBIS_IME_DIALOG_END_STATUS_USER_CANCELED = 1, + ORBIS_IME_DIALOG_END_STATUS_ABORTED = 2 +}; + +struct OrbisImeDialogResult { + OrbisImeDialogEndStatus endstatus; + s32 reserved[12]; +}; + +enum OrbisImeType { + ORBIS_IME_TYPE_DEFAULT = 0, + ORBIS_IME_TYPE_BASIC_LATIN = 1, + ORBIS_IME_TYPE_URL = 2, + ORBIS_IME_TYPE_MAIL = 3, + ORBIS_IME_TYPE_NUMBER = 4 +}; + +enum OrbisImeEnterLabel { + ORBIS_IME_ENTER_LABEL_DEFAULT = 0, + ORBIS_IME_ENTER_LABEL_SEND = 1, + ORBIS_IME_ENTER_LABEL_SEARCH = 2, + ORBIS_IME_ENTER_LABEL_GO = 3 +}; +enum OrbiImeInputMethod { ORBIS_IME_INPUT_METHOD_DEFAULT = 0 }; + +typedef int (*OrbisImeTextFilter)(wchar_t* outText, u32* outTextLength, const wchar_t* srcText, + u32 srcTextLength); + +enum OrbisImeHorizontalAlignment { + ORBIS_IME_HALIGN_LEFT = 0, + ORBIS_IME_HALIGN_CENTER = 1, + ORBIS_IME_HALIGN_RIGHT = 2 +}; + +enum OrbisImeVerticalAlignment { + ORBIS_IME_VALIGN_TOP = 0, + ORBIS_IME_VALIGN_CENTER = 1, + ORBIS_IME_VALIGN_BOTTOM = 2 +}; + +struct OrbisImeDialogParam { + s32 userId; + OrbisImeType type; + u64 supportedLanguages; + OrbisImeEnterLabel enterLabel; + OrbiImeInputMethod inputMethod; + OrbisImeTextFilter filter; + u32 option; + u32 maxTextLength; + wchar_t* inputTextBuffer; + float posx; + float posy; + OrbisImeHorizontalAlignment horizontalAlignment; + OrbisImeVerticalAlignment verticalAlignment; + const wchar_t* placeholder; + const wchar_t* title; + s8 reserved[16]; +}; + +struct OrbisImeColor { + u8 r; + u8 g; + u8 b; + u8 a; +}; + +enum OrbisImePanelPriority { + ORBIS_IME_PANEL_PRIORITY_DEFAULT = 0, + ORBIS_IME_PANEL_PRIORITY_ALPHABET = 1, + ORBIS_IME_PANEL_PRIORITY_SYMBOL = 2, + ORBIS_IME_PANEL_PRIORITY_ACCENT = 3 +}; + +enum OrbisImeKeyboardType { + ORBIS_IME_KEYBOARD_TYPE_NONE = 0, + ORBIS_IME_KEYBOARD_TYPE_DANISH = 1, + ORBIS_IME_KEYBOARD_TYPE_GERMAN = 2, + ORBIS_IME_KEYBOARD_TYPE_GERMAN_SW = 3, + ORBIS_IME_KEYBOARD_TYPE_ENGLISH_US = 4, + ORBIS_IME_KEYBOARD_TYPE_ENGLISH_GB = 5, + ORBIS_IME_KEYBOARD_TYPE_SPANISH = 6, + ORBIS_IME_KEYBOARD_TYPE_SPANISH_LA = 7, + ORBIS_IME_KEYBOARD_TYPE_FINNISH = 8, + ORBIS_IME_KEYBOARD_TYPE_FRENCH = 9, + ORBIS_IME_KEYBOARD_TYPE_FRENCH_BR = 10, + ORBIS_IME_KEYBOARD_TYPE_FRENCH_CA = 11, + ORBIS_IME_KEYBOARD_TYPE_FRENCH_SW = 12, + ORBIS_IME_KEYBOARD_TYPE_ITALIAN = 13, + ORBIS_IME_KEYBOARD_TYPE_DUTCH = 14, + ORBIS_IME_KEYBOARD_TYPE_NORWEGIAN = 15, + ORBIS_IME_KEYBOARD_TYPE_POLISH = 16, + ORBIS_IME_KEYBOARD_TYPE_PORTUGUESE_BR = 17, + ORBIS_IME_KEYBOARD_TYPE_PORTUGUESE_PT = 18, + ORBIS_IME_KEYBOARD_TYPE_RUSSIAN = 19, + ORBIS_IME_KEYBOARD_TYPE_SWEDISH = 20, + ORBIS_IME_KEYBOARD_TYPE_TURKISH = 21, + ORBIS_IME_KEYBOARD_TYPE_JAPANESE_ROMAN = 22, + ORBIS_IME_KEYBOARD_TYPE_JAPANESE_KANA = 23, + ORBIS_IME_KEYBOARD_TYPE_KOREAN = 24, + ORBIS_IME_KEYBOARD_TYPE_SM_CHINESE = 25, + ORBIS_IME_KEYBOARD_TYPE_TR_CHINESE_ZY = 26, + ORBIS_IME_KEYBOARD_TYPE_TR_CHINESE_PY_HK = 27, + ORBIS_IME_KEYBOARD_TYPE_TR_CHINESE_PY_TW = 28, + ORBIS_IME_KEYBOARD_TYPE_TR_CHINESE_CG = 29, + ORBIS_IME_KEYBOARD_TYPE_ARABIC_AR = 30, + ORBIS_IME_KEYBOARD_TYPE_THAI = 31, + ORBIS_IME_KEYBOARD_TYPE_CZECH = 32, + ORBIS_IME_KEYBOARD_TYPE_GREEK = 33, + ORBIS_IME_KEYBOARD_TYPE_INDONESIAN = 34, + ORBIS_IME_KEYBOARD_TYPE_VIETNAMESE = 35, + ORBIS_IME_KEYBOARD_TYPE_ROMANIAN = 36, + ORBIS_IME_KEYBOARD_TYPE_HUNGARIAN = 37 +}; + +struct OrbisImeKeycode { + u16 keycode; + wchar_t character; + u32 status; + OrbisImeKeyboardType type; + s32 userId; + u32 resourceId; + u64 timestamp; +}; + +typedef int (*OrbisImeExtKeyboardFilter)(const OrbisImeKeycode* srcKeycode, u16* outKeycode, + u32* outStatus, void* reserved); + +struct OrbisImeParamExtended { + u32 option; + OrbisImeColor colorBase; + OrbisImeColor colorLine; + OrbisImeColor colorTextField; + OrbisImeColor colorPreedit; + OrbisImeColor colorButtonDefault; + OrbisImeColor colorButtonFunction; + OrbisImeColor colorButtonSymbol; + OrbisImeColor colorText; + OrbisImeColor colorSpecial; + OrbisImePanelPriority priority; + char* additionalDictionaryPath; + OrbisImeExtKeyboardFilter extKeyboardFilter; + uint32_t disableDevice; + uint32_t extKeyboardMode; + int8_t reserved[60]; +}; + +int PS4_SYSV_ABI sceImeDialogAbort(); +int PS4_SYSV_ABI sceImeDialogForceClose(); +int PS4_SYSV_ABI sceImeDialogForTestFunction(); +int PS4_SYSV_ABI sceImeDialogGetCurrentStarState(); +int PS4_SYSV_ABI sceImeDialogGetPanelPositionAndForm(); +int PS4_SYSV_ABI sceImeDialogGetPanelSize(); +int PS4_SYSV_ABI sceImeDialogGetPanelSizeExtended(); +int PS4_SYSV_ABI sceImeDialogGetResult(OrbisImeDialogResult* result); +/*OrbisImeDialogStatus*/ int PS4_SYSV_ABI sceImeDialogGetStatus(); +int PS4_SYSV_ABI sceImeDialogInit(const OrbisImeDialogParam* param, + const OrbisImeParamExtended* extended); +int PS4_SYSV_ABI sceImeDialogInitInternal(); +int PS4_SYSV_ABI sceImeDialogInitInternal2(); +int PS4_SYSV_ABI sceImeDialogInitInternal3(); +int PS4_SYSV_ABI sceImeDialogSetPanelPosition(); +int PS4_SYSV_ABI sceImeDialogTerm(); + +void RegisterlibSceImeDialog(Core::Loader::SymbolsResolver* sym); +} // namespace Libraries::ImeDialog \ No newline at end of file diff --git a/src/core/libraries/kernel/file_system.cpp b/src/core/libraries/kernel/file_system.cpp index 3c5c0ac9..099cf9f9 100644 --- a/src/core/libraries/kernel/file_system.cpp +++ b/src/core/libraries/kernel/file_system.cpp @@ -75,7 +75,7 @@ int PS4_SYSV_ABI sceKernelOpen(const char* path, int flags, u16 mode) { file->m_host_name = mnt->GetHostFile(file->m_guest_name); if (read) { file->f.Open(file->m_host_name, Common::FS::FileAccessMode::Read); - } else if (write && create && truncate) { + } else if (write && create) { file->f.Open(file->m_host_name, Common::FS::FileAccessMode::Write); } else if (write && create && append) { // CUSA04729 (appends app0/shaderlist.txt) file->f.Open(file->m_host_name, Common::FS::FileAccessMode::Append); diff --git a/src/core/libraries/kernel/thread_management.cpp b/src/core/libraries/kernel/thread_management.cpp index 3f6f9bd6..b31e777d 100644 --- a/src/core/libraries/kernel/thread_management.cpp +++ b/src/core/libraries/kernel/thread_management.cpp @@ -1067,6 +1067,7 @@ ScePthread PS4_SYSV_ABI posix_pthread_self() { } int PS4_SYSV_ABI scePthreadCondSignal(ScePthreadCond* cond) { + cond = createCond(cond); if (cond == nullptr) { return SCE_KERNEL_ERROR_EINVAL; } diff --git a/src/core/libraries/libs.cpp b/src/core/libraries/libs.cpp index 00df4ddf..82cb59b6 100644 --- a/src/core/libraries/libs.cpp +++ b/src/core/libraries/libs.cpp @@ -33,6 +33,8 @@ #include "core/libraries/usbd/usbd.h" #include "core/libraries/videoout/video_out.h" #include "src/core/libraries/ajm/ajm.h" +#include "src/core/libraries/dialogs/error_dialog.h" +#include "src/core/libraries/dialogs/ime_dialog.h" #include "src/core/libraries/libpng/pngdec.h" namespace Libraries { @@ -71,6 +73,8 @@ void InitHLELibs(Core::Loader::SymbolsResolver* sym) { Libraries::Usbd::RegisterlibSceUsbd(sym); Libraries::Pad::RegisterlibScePad(sym); Libraries::Ajm::RegisterlibSceAjm(sym); + Libraries::ErrorDialog::RegisterlibSceErrorDialog(sym); + Libraries::ImeDialog::RegisterlibSceImeDialog(sym); } } // namespace Libraries diff --git a/src/core/libraries/save_data/savedata.cpp b/src/core/libraries/save_data/savedata.cpp index 3f470e67..7d12ed81 100644 --- a/src/core/libraries/save_data/savedata.cpp +++ b/src/core/libraries/save_data/savedata.cpp @@ -248,20 +248,12 @@ int PS4_SYSV_ABI sceSaveDataGetEventInfo() { int PS4_SYSV_ABI sceSaveDataGetEventResult(const OrbisSaveDataEventParam* eventParam, OrbisSaveDataEvent* event) { - LOG_INFO(Lib_SaveData, "called sceSaveDataGetEventResult : null = {}", (eventParam == nullptr)); - if (eventParam == nullptr) - return ORBIS_SAVE_DATA_ERROR_PARAMETER; + // eventParam can be 0/null. + if (event == nullptr) + return ORBIS_SAVE_DATA_ERROR_NOT_INITIALIZED; - const auto& mount_dir = Common::FS::GetUserPath(Common::FS::PathType::SaveDataDir) / - std::to_string(1) / game_serial; // fix me - - Common::FS::IOFile file(mount_dir / "param.txt", Common::FS::FileAccessMode::Read); - OrbisSaveDataParam* param = new OrbisSaveDataParam{}; - file.ReadRaw(param, sizeof(OrbisSaveDataParam)); - - LOG_INFO(Lib_SaveData, "called"); + LOG_INFO(Lib_SaveData, "called: Todo."); event->userId = 1; - return ORBIS_OK; } diff --git a/src/qt_gui/gui_context_menus.h b/src/qt_gui/gui_context_menus.h index 8c10a10c..9f895360 100644 --- a/src/qt_gui/gui_context_menus.h +++ b/src/qt_gui/gui_context_menus.h @@ -48,8 +48,8 @@ public: QAction openSfoViewer("SFO Viewer", widget); QAction openTrophyViewer("Trophy Viewer", widget); - menu.addAction(&createShortcut); menu.addAction(&openFolder); + menu.addAction(&createShortcut); menu.addAction(&openSfoViewer); menu.addAction(&openTrophyViewer);