Compare commits

..

No commits in common. "main" and "v.0.10.0" have entirely different histories.

272 changed files with 2327 additions and 5915 deletions

View File

@ -17,7 +17,7 @@ body:
This repository does not provide support for game patches. If you are having issues with patches please refer to [Cheats and Patches Repository](https://github.com/shadps4-emu/ps4_cheats). This repository does not provide support for game patches. If you are having issues with patches please refer to [Cheats and Patches Repository](https://github.com/shadps4-emu/ps4_cheats).
Before submitting an issue please check [Game Compatibility Repository](https://github.com/shadps4-compatibility/shadps4-game-compatibility) for the information about the status of the game. Before submitting an issue please check [Game Compatibility Repository](https://github.com/shadps4-emu/shadps4-game-compatibility) for the information about the status of the game.
Please make an effort to make sure your issue isn't already reported. Please make an effort to make sure your issue isn't already reported.

9
.gitmodules vendored
View File

@ -103,9 +103,6 @@
path = externals/MoltenVK/cereal path = externals/MoltenVK/cereal
url = https://github.com/USCiLab/cereal url = https://github.com/USCiLab/cereal
shallow = true shallow = true
[submodule "externals/ext-libusb"] [submodule "externals/libusb"]
path = externals/ext-libusb path = externals/libusb
url = https://github.com/shadps4-emu/ext-libusb.git url = https://github.com/libusb/libusb-cmake.git
[submodule "externals/epoll-shim"]
path = externals/epoll-shim
url = https://github.com/jiixyj/epoll-shim.git

View File

@ -126,7 +126,7 @@ execute_process(
# If there's no upstream set or the command failed, check remote.pushDefault # If there's no upstream set or the command failed, check remote.pushDefault
if (GIT_REMOTE_RESULT OR GIT_REMOTE_NAME STREQUAL "") if (GIT_REMOTE_RESULT OR GIT_REMOTE_NAME STREQUAL "")
message(STATUS "check default push") message("check default push")
execute_process( execute_process(
COMMAND git config --get remote.pushDefault COMMAND git config --get remote.pushDefault
OUTPUT_VARIABLE GIT_REMOTE_NAME OUTPUT_VARIABLE GIT_REMOTE_NAME
@ -134,30 +134,30 @@ if (GIT_REMOTE_RESULT OR GIT_REMOTE_NAME STREQUAL "")
ERROR_QUIET ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
) )
message(STATUS "got remote: ${GIT_REMOTE_NAME}") message("got remote: ${GIT_REMOTE_NAME}")
endif() endif()
# If running in GitHub Actions and the above fails # If running in GitHub Actions and the above fails
if (GIT_REMOTE_RESULT OR GIT_REMOTE_NAME STREQUAL "") if (GIT_REMOTE_RESULT OR GIT_REMOTE_NAME STREQUAL "")
message(STATUS "check github") message("check github")
set(GIT_REMOTE_NAME "origin") set(GIT_REMOTE_NAME "origin")
# Retrieve environment variables # Retrieve environment variables
if (DEFINED ENV{GITHUB_HEAD_REF} AND NOT "$ENV{GITHUB_HEAD_REF}" STREQUAL "") if (DEFINED ENV{GITHUB_HEAD_REF} AND NOT "$ENV{GITHUB_HEAD_REF}" STREQUAL "")
message(STATUS "github head ref: $ENV{GITHUB_HEAD_REF}") message("github head ref: $ENV{GITHUB_HEAD_REF}")
set(GITHUB_HEAD_REF "$ENV{GITHUB_HEAD_REF}") set(GITHUB_HEAD_REF "$ENV{GITHUB_HEAD_REF}")
else() else()
set(GITHUB_HEAD_REF "") set(GITHUB_HEAD_REF "")
endif() endif()
if (DEFINED ENV{GITHUB_REF} AND NOT "$ENV{GITHUB_REF}" STREQUAL "") if (DEFINED ENV{GITHUB_REF} AND NOT "$ENV{GITHUB_REF}" STREQUAL "")
message(STATUS "github ref: $ENV{GITHUB_REF}") message("github ref: $ENV{GITHUB_REF}")
string(REGEX REPLACE "^refs/[^/]*/" "" GITHUB_BRANCH "$ENV{GITHUB_REF}") string(REGEX REPLACE "^refs/[^/]*/" "" GITHUB_BRANCH "$ENV{GITHUB_REF}")
string(REGEX MATCH "refs/pull/([0-9]+)/merge" MATCHED_REF "$ENV{GITHUB_REF}") string(REGEX MATCH "refs/pull/([0-9]+)/merge" MATCHED_REF "$ENV{GITHUB_REF}")
if (MATCHED_REF) if (MATCHED_REF)
set(PR_NUMBER "${CMAKE_MATCH_1}") set(PR_NUMBER "${CMAKE_MATCH_1}")
set(GITHUB_BRANCH "") set(GITHUB_BRANCH "")
message(STATUS "PR number: ${PR_NUMBER}") message("PR number: ${PR_NUMBER}")
else() else()
set(PR_NUMBER "") set(PR_NUMBER "")
endif() endif()
@ -179,7 +179,7 @@ if (GIT_REMOTE_RESULT OR GIT_REMOTE_NAME STREQUAL "")
elseif ("${PR_NUMBER}" STREQUAL "" AND NOT "${GITHUB_REF}" STREQUAL "") elseif ("${PR_NUMBER}" STREQUAL "" AND NOT "${GITHUB_REF}" STREQUAL "")
set(GIT_BRANCH "${GITHUB_REF}") set(GIT_BRANCH "${GITHUB_REF}")
elseif("${GIT_BRANCH}" STREQUAL "") elseif("${GIT_BRANCH}" STREQUAL "")
message(STATUS "couldn't find branch") message("couldn't find branch")
set(GIT_BRANCH "detached-head") set(GIT_BRANCH "detached-head")
endif() endif()
else() else()
@ -188,13 +188,13 @@ else()
if (INDEX GREATER -1) if (INDEX GREATER -1)
string(SUBSTRING "${GIT_REMOTE_NAME}" 0 "${INDEX}" GIT_REMOTE_NAME) string(SUBSTRING "${GIT_REMOTE_NAME}" 0 "${INDEX}" GIT_REMOTE_NAME)
elseif("${GIT_REMOTE_NAME}" STREQUAL "") elseif("${GIT_REMOTE_NAME}" STREQUAL "")
message(STATUS "reset to origin") message("reset to origin")
set(GIT_REMOTE_NAME "origin") set(GIT_REMOTE_NAME "origin")
endif() endif()
endif() endif()
# Get remote link # Get remote link
message(STATUS "getting remote link") message("getting remote link")
execute_process( execute_process(
COMMAND git config --get remote.${GIT_REMOTE_NAME}.url COMMAND git config --get remote.${GIT_REMOTE_NAME}.url
OUTPUT_VARIABLE GIT_REMOTE_URL OUTPUT_VARIABLE GIT_REMOTE_URL
@ -204,21 +204,15 @@ execute_process(
# Set Version # Set Version
set(EMULATOR_VERSION_MAJOR "0") set(EMULATOR_VERSION_MAJOR "0")
set(EMULATOR_VERSION_MINOR "10") set(EMULATOR_VERSION_MINOR "10")
set(EMULATOR_VERSION_PATCH "1") set(EMULATOR_VERSION_PATCH "0")
set_source_files_properties(src/shadps4.rc PROPERTIES COMPILE_DEFINITIONS "EMULATOR_VERSION_MAJOR=${EMULATOR_VERSION_MAJOR};EMULATOR_VERSION_MINOR=${EMULATOR_VERSION_MINOR};EMULATOR_VERSION_PATCH=${EMULATOR_VERSION_PATCH}") set_source_files_properties(src/shadps4.rc PROPERTIES COMPILE_DEFINITIONS "EMULATOR_VERSION_MAJOR=${EMULATOR_VERSION_MAJOR};EMULATOR_VERSION_MINOR=${EMULATOR_VERSION_MINOR};EMULATOR_VERSION_PATCH=${EMULATOR_VERSION_PATCH}")
set(APP_VERSION "${EMULATOR_VERSION_MAJOR}.${EMULATOR_VERSION_MINOR}.${EMULATOR_VERSION_PATCH} WIP") set(APP_VERSION "${EMULATOR_VERSION_MAJOR}.${EMULATOR_VERSION_MINOR}.${EMULATOR_VERSION_PATCH}")
set(APP_IS_RELEASE false) set(APP_IS_RELEASE true)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/common/scm_rev.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/src/common/scm_rev.cpp" @ONLY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/common/scm_rev.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/src/common/scm_rev.cpp" @ONLY)
message("-- end git things, remote: ${GIT_REMOTE_NAME}, branch: ${GIT_BRANCH}, link: ${GIT_REMOTE_URL}") message("end git things, remote: ${GIT_REMOTE_NAME}, branch: ${GIT_BRANCH}")
string(TOLOWER "${GIT_REMOTE_URL}" GIT_REMOTE_URL_LOWER)
if(NOT GIT_REMOTE_URL_LOWER MATCHES "shadps4-emu/shadps4" OR NOT GIT_BRANCH STREQUAL "main")
message(STATUS "not main, disabling auto update")
set(ENABLE_UPDATER OFF)
endif()
if(WIN32 AND ENABLE_QT_GUI AND NOT CMAKE_PREFIX_PATH) if(WIN32 AND ENABLE_QT_GUI AND NOT CMAKE_PREFIX_PATH)
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/DetectQtInstallation.cmake") include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/DetectQtInstallation.cmake")
@ -244,9 +238,9 @@ find_package(xxHash 0.8.2 MODULE)
find_package(ZLIB 1.3 MODULE) find_package(ZLIB 1.3 MODULE)
find_package(Zydis 5.0.0 CONFIG) find_package(Zydis 5.0.0 CONFIG)
find_package(pugixml 1.14 CONFIG) find_package(pugixml 1.14 CONFIG)
find_package(libusb 1.0.27 MODULE)
if (APPLE) if (APPLE)
find_package(date 3.0.1 CONFIG) find_package(date 3.0.1 CONFIG)
find_package(epoll-shim 3.14 CONFIG)
endif() endif()
list(POP_BACK CMAKE_MODULE_PATH) list(POP_BACK CMAKE_MODULE_PATH)
@ -261,6 +255,7 @@ endif()
add_subdirectory(externals) add_subdirectory(externals)
include_directories(src) include_directories(src)
include_directories(Resources)
if(ENABLE_QT_GUI) if(ENABLE_QT_GUI)
find_package(Qt6 REQUIRED COMPONENTS Widgets Concurrent LinguistTools Network Multimedia) find_package(Qt6 REQUIRED COMPONENTS Widgets Concurrent LinguistTools Network Multimedia)
@ -305,8 +300,6 @@ set(AJM_LIB src/core/libraries/ajm/ajm.cpp
set(AUDIO_LIB src/core/libraries/audio/audioin.cpp set(AUDIO_LIB src/core/libraries/audio/audioin.cpp
src/core/libraries/audio/audioin.h src/core/libraries/audio/audioin.h
src/core/libraries/audio/sdl_in.h
src/core/libraries/audio/sdl_in.cpp
src/core/libraries/voice/voice.cpp src/core/libraries/voice/voice.cpp
src/core/libraries/voice/voice.h src/core/libraries/voice/voice.h
src/core/libraries/audio/audioout.cpp src/core/libraries/audio/audioout.cpp
@ -1175,7 +1168,7 @@ if (APPLE)
endif() endif()
# Replacement for std::chrono::time_zone # Replacement for std::chrono::time_zone
target_link_libraries(shadps4 PRIVATE date::date-tz epoll-shim) target_link_libraries(shadps4 PRIVATE date::date-tz)
endif() endif()
if (ENABLE_QT_GUI) if (ENABLE_QT_GUI)
@ -1244,7 +1237,6 @@ include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/CMakeRC.cmake")
cmrc_add_resource_library(embedded-resources cmrc_add_resource_library(embedded-resources
ALIAS res::embedded ALIAS res::embedded
NAMESPACE res NAMESPACE res
src/images/trophy.wav
src/images/bronze.png src/images/bronze.png
src/images/gold.png src/images/gold.png
src/images/platinum.png src/images/platinum.png

View File

@ -37,7 +37,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
**shadPS4** is an early **PlayStation 4** emulator for **Windows**, **Linux** and **macOS** written in C++. **shadPS4** is an early **PlayStation 4** emulator for **Windows**, **Linux** and **macOS** written in C++.
If you encounter problems or have doubts, do not hesitate to look at the [**Quickstart**](https://github.com/shadps4-emu/shadPS4/wiki/I.-Quick-start-%5BUsers%5D).\ If you encounter problems or have doubts, do not hesitate to look at the [**Quickstart**](https://github.com/shadps4-emu/shadPS4/wiki/I.-Quick-start-%5BUsers%5D).\
To verify that a game works, you can look at [**shadPS4 Game Compatibility**](https://github.com/shadps4-compatibility/shadps4-game-compatibility).\ To verify that a game works, you can look at [**shadPS4 Game Compatibility**](https://github.com/shadps4-emu/shadps4-game-compatibility).\
To discuss shadPS4 development, suggest ideas or to ask for help, join our [**Discord server**](https://discord.gg/bFJxfftGW6).\ To discuss shadPS4 development, suggest ideas or to ask for help, join our [**Discord server**](https://discord.gg/bFJxfftGW6).\
To get the latest news, go to our [**X (Twitter)**](https://x.com/shadps4) or our [**website**](https://shadps4.net/).\ To get the latest news, go to our [**X (Twitter)**](https://x.com/shadps4) or our [**website**](https://shadps4.net/).\
For those who'd like to donate to the project, we now have a [**Kofi page**](https://ko-fi.com/shadps4)! For those who'd like to donate to the project, we now have a [**Kofi page**](https://ko-fi.com/shadps4)!

View File

@ -73,7 +73,6 @@ path = [
"src/images/shadps4.svg", "src/images/shadps4.svg",
"src/images/website.svg", "src/images/website.svg",
"src/images/youtube.svg", "src/images/youtube.svg",
"src/images/trophy.wav",
"src/shadps4.qrc", "src/shadps4.qrc",
"src/shadps4.rc", "src/shadps4.rc",
"src/qt_gui/translations/update_translation.sh", "src/qt_gui/translations/update_translation.sh",

View File

@ -1,28 +1,14 @@
# SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project # SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
# SPDX-License-Identifier: GPL-2.0-or-later # SPDX-License-Identifier: GPL-2.0-or-later
set(highest_version "0") file(GLOB QT_KITS LIST_DIRECTORIES true "C:/Qt/*/msvc*_64")
set(CANDIDATE_DRIVES A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) list(SORT QT_KITS COMPARE NATURAL)
list(REVERSE QT_KITS)
foreach(drive ${CANDIDATE_DRIVES}) if(QT_KITS)
file(GLOB kits LIST_DIRECTORIES true CONFIGURE_DEPENDS "${drive}:/Qt/*/msvc*_64") list(GET QT_KITS 0 QT_PREFIX)
foreach(kit IN LISTS kits)
get_filename_component(version_dir "${kit}" DIRECTORY)
get_filename_component(kit_version "${version_dir}" NAME)
message(STATUS "DetectQtInstallation.cmake: Detected Qt: ${kit}")
if (kit_version VERSION_GREATER highest_version)
set(highest_version "${kit_version}")
set(QT_PREFIX "${kit}")
endif()
endforeach()
endforeach()
if(QT_PREFIX)
set(CMAKE_PREFIX_PATH "${QT_PREFIX}" CACHE PATH "Qt prefix autodetected" FORCE) set(CMAKE_PREFIX_PATH "${QT_PREFIX}" CACHE PATH "Qt prefix autodetected" FORCE)
message(STATUS "DetectQtInstallation.cmake: Choose newest Qt: ${QT_PREFIX}") message(STATUS "Auto-detected Qt prefix: ${QT_PREFIX}")
else() else()
message(STATUS "DetectQtInstallation.cmake: No QtDirectory found in <drive>:/Qt please set CMAKE_PREFIX_PATH manually") message(STATUS "findQt.cmake: no QtDirectory found in C:/Qt please set CMAKE_PREFIX_PATH manually")
endif() endif()

View File

@ -147,7 +147,7 @@ Accurately identifying games will help other developers that own that game recog
- If your issue is small or you aren't sure whether you have properly identified something, [join the Discord server](https://discord.gg/MyZRaBngxA) and use the #development channel - If your issue is small or you aren't sure whether you have properly identified something, [join the Discord server](https://discord.gg/MyZRaBngxA) and use the #development channel
to concisely explain the issue, as well as any findings you currently have. to concisely explain the issue, as well as any findings you currently have.
- It is recommended that you check the [game compatibility issue tracker](https://github.com/shadps4-compatibility/shadps4-game-compatibility/issues) and post very short summaries of progress changes there, - It is recommended that you check the [game compatibility issue tracker](https://github.com/shadps4-emu/shadps4-game-compatibility/issues) and post very short summaries of progress changes there,
(such as the game now booting into the menu or getting in-game) for organizational and status update purposes. (such as the game now booting into the menu or getting in-game) for organizational and status update purposes.
- ⚠ **Do not post theoretical, unproven game-specific issues in the emulator issue tracker that you cannot verify and locate in the emulator source code as being a bug.**\ - ⚠ **Do not post theoretical, unproven game-specific issues in the emulator issue tracker that you cannot verify and locate in the emulator source code as being a bug.**\

View File

@ -0,0 +1,58 @@
<!--
SPDX-FileCopyrightText: 2024 shadPS4 Emulator Project
SPDX-License-Identifier: GPL-2.0-or-later
-->
# shadPS4 Quickstart
## Summary
- [**PC Requirements**](#minimum-pc-requirements)
- [**CPU**](#cpu)
- [**GPU**](#gpu)
- [**RAM**](#ram)
- [**OS**](#os)
- [**Have the latest WIP version**](#how-to-run-the-latest-work-in-progress-builds-of-shadps4)
- [**Configure the emulator**](#configure-the-emulator)
## Minimum PC requirements
### CPU
- A processor with at least 4 cores and 6 threads
- Above 2.5 GHz frequency
- A CPU supporting the x86-64-v3 baseline.
- **Intel**: Haswell generation or newer
- **AMD**: Excavator generation or newer
- **Apple**: Rosetta 2 on macOS 15.4 or newer
### GPU
- A graphics card with at least 1GB of VRAM
- Up-to-date graphics drivers
- Vulkan 1.3 with the `VK_KHR_swapchain` and `VK_KHR_push_descriptor` extensions
### RAM
- 8GB of RAM or more
### OS
- Windows 10 or Ubuntu 22.04
## How to run the latest Work-in-Progress builds of shadPS4
1. Go to <https://github.com/shadps4-emu/shadPS4/releases> In the release identified as 'pre-release' click on the down arrow(Assets), select your operating system of choice (the "**qt**" versions have a user interface, which is probably the one you want. The others are SDL versions, which can only be run via command line).
![image](https://github.com/user-attachments/assets/af520c77-797c-41a0-8f67-d87f5de3e3df)
2. Once downloaded, extract to its own folder, and run shadPS4's executable from the extracted folder.
3. Upon first launch, shadPS4 will prompt you to select a folder to store your installed games in. Select "Browse" and then select a folder that contains your dumped games.
## Configure the emulator
To configure the emulator, you can go through the interface and go to "settings".
You can also configure the emulator by editing the `config.toml` file located in the `user` folder created after the application is started (Mostly useful if you are using the SDL version).
Some settings may be related to more technical development and debugging.\
For more information on this, see [**Debugging**](https://github.com/shadps4-emu/shadPS4/blob/main/documents/Debugging/Debugging.md#configuration).

View File

@ -197,7 +197,7 @@ endif()
# libusb # libusb
if (NOT TARGET libusb::usb) if (NOT TARGET libusb::usb)
add_subdirectory(ext-libusb) add_subdirectory(libusb)
add_library(libusb::usb ALIAS usb-1.0) add_library(libusb::usb ALIAS usb-1.0)
endif() endif()
@ -229,8 +229,4 @@ if (APPLE)
if (NOT TARGET MoltenVK) if (NOT TARGET MoltenVK)
add_subdirectory(MoltenVK) add_subdirectory(MoltenVK)
endif() endif()
if (NOT TARGET epoll-shim)
add_subdirectory(epoll-shim)
endif()
endif() endif()

@ -1 +0,0 @@
Subproject commit 18159584bb3d17e601b9315a7398ace018251bdc

@ -1 +0,0 @@
Subproject commit e1f4ac1472bdf6aab27f8b836a2f47df85465bac

1
externals/libusb vendored Submodule

@ -0,0 +1 @@
Subproject commit a63a7e43e0950a595cf4b98a0eaf4051749ace5f

2
externals/sirit vendored

@ -1 +1 @@
Subproject commit 282083a595dcca86814dedab2f2b0363ef38f1ec Subproject commit 6b450704f6fedb9413d0c89a9eb59d028eb1e6c0

View File

@ -32,7 +32,6 @@ std::filesystem::path find_fs_path_or(const basic_value<TC>& v, const K& ky,
namespace Config { namespace Config {
// General // General
static int volumeSlider = 100;
static bool isNeo = false; static bool isNeo = false;
static bool isDevKit = false; static bool isDevKit = false;
static bool isPSNSignedIn = false; static bool isPSNSignedIn = false;
@ -47,7 +46,6 @@ static bool isShowSplash = false;
static std::string isSideTrophy = "right"; static std::string isSideTrophy = "right";
static bool compatibilityData = false; static bool compatibilityData = false;
static bool checkCompatibilityOnStartup = false; static bool checkCompatibilityOnStartup = false;
static bool isConnectedToNetwork = false;
// Input // Input
static int cursorState = HideCursorState::Idle; static int cursorState = HideCursorState::Idle;
@ -56,21 +54,17 @@ static bool useSpecialPad = false;
static int specialPadClass = 1; static int specialPadClass = 1;
static bool isMotionControlsEnabled = true; static bool isMotionControlsEnabled = true;
static bool useUnifiedInputConfig = true; static bool useUnifiedInputConfig = true;
static std::string micDevice = "Default Device";
// These two entries aren't stored in the config // These two entries aren't stored in the config
static bool overrideControllerColor = false; static bool overrideControllerColor = false;
static int controllerCustomColorRGB[3] = {0, 0, 255}; static int controllerCustomColorRGB[3] = {0, 0, 255};
// GPU // GPU
static u32 windowWidth = 1280; static u32 screenWidth = 1280;
static u32 windowHeight = 720; static u32 screenHeight = 720;
static u32 internalScreenWidth = 1280;
static u32 internalScreenHeight = 720;
static bool isNullGpu = false; static bool isNullGpu = false;
static bool shouldCopyGPUBuffers = false; static bool shouldCopyGPUBuffers = false;
static bool readbacksEnabled = false; static bool readbacksEnabled = false;
static bool readbackLinearImagesEnabled = false;
static bool directMemoryAccessEnabled = false; static bool directMemoryAccessEnabled = false;
static bool shouldDumpShaders = false; static bool shouldDumpShaders = false;
static bool shouldPatchShaders = false; static bool shouldPatchShaders = false;
@ -108,12 +102,9 @@ u32 m_language = 1; // english
// Keys // Keys
static std::string trophyKey = ""; static std::string trophyKey = "";
// Config version, used to determine if a user's config file is outdated. // Expected number of items in the config file
static std::string config_version = Common::g_scm_rev; static constexpr u64 total_entries = 51;
int getVolumeSlider() {
return volumeSlider;
}
bool allowHDR() { bool allowHDR() {
return isHDRAllowed; return isHDRAllowed;
} }
@ -163,10 +154,6 @@ std::filesystem::path GetSaveDataPath() {
return save_data_path; return save_data_path;
} }
void setVolumeSlider(int volumeValue) {
volumeSlider = volumeValue;
}
void setLoadGameSizeEnabled(bool enable) { void setLoadGameSizeEnabled(bool enable) {
load_game_size = enable; load_game_size = enable;
} }
@ -203,28 +190,16 @@ int getCursorHideTimeout() {
return cursorHideTimeout; return cursorHideTimeout;
} }
std::string getMicDevice() {
return micDevice;
}
double getTrophyNotificationDuration() { double getTrophyNotificationDuration() {
return trophyNotificationDuration; return trophyNotificationDuration;
} }
u32 getWindowWidth() { u32 getScreenWidth() {
return windowWidth; return screenWidth;
} }
u32 getWindowHeight() { u32 getScreenHeight() {
return windowHeight; return screenHeight;
}
u32 getInternalScreenWidth() {
return internalScreenHeight;
}
u32 getInternalScreenHeight() {
return internalScreenHeight;
} }
s32 getGpuId() { s32 getGpuId() {
@ -287,10 +262,6 @@ bool readbacks() {
return readbacksEnabled; return readbacksEnabled;
} }
bool readbackLinearImages() {
return readbackLinearImagesEnabled;
}
bool directMemoryAccess() { bool directMemoryAccess() {
return directMemoryAccessEnabled; return directMemoryAccessEnabled;
} }
@ -359,28 +330,16 @@ bool getCheckCompatibilityOnStartup() {
return checkCompatibilityOnStartup; return checkCompatibilityOnStartup;
} }
bool getIsConnectedToNetwork() {
return isConnectedToNetwork;
}
void setGpuId(s32 selectedGpuId) { void setGpuId(s32 selectedGpuId) {
gpuId = selectedGpuId; gpuId = selectedGpuId;
} }
void setWindowWidth(u32 width) { void setScreenWidth(u32 width) {
windowWidth = width; screenWidth = width;
} }
void setWindowHeight(u32 height) { void setScreenHeight(u32 height) {
windowHeight = height; screenHeight = height;
}
void setInternalScreenWidth(u32 width) {
internalScreenWidth = width;
}
void setInternalScreenHeight(u32 height) {
internalScreenHeight = height;
} }
void setDebugDump(bool enable) { void setDebugDump(bool enable) {
@ -415,10 +374,6 @@ void setReadbacks(bool enable) {
readbacksEnabled = enable; readbacksEnabled = enable;
} }
void setReadbackLinearImages(bool enable) {
readbackLinearImagesEnabled = enable;
}
void setDirectMemoryAccess(bool enable) { void setDirectMemoryAccess(bool enable) {
directMemoryAccessEnabled = enable; directMemoryAccessEnabled = enable;
} }
@ -466,11 +421,6 @@ void setCursorState(s16 newCursorState) {
void setCursorHideTimeout(int newcursorHideTimeout) { void setCursorHideTimeout(int newcursorHideTimeout) {
cursorHideTimeout = newcursorHideTimeout; cursorHideTimeout = newcursorHideTimeout;
} }
void setMicDevice(std::string device) {
micDevice = device;
}
void setTrophyNotificationDuration(double newTrophyNotificationDuration) { void setTrophyNotificationDuration(double newTrophyNotificationDuration) {
trophyNotificationDuration = newTrophyNotificationDuration; trophyNotificationDuration = newTrophyNotificationDuration;
} }
@ -632,10 +582,11 @@ void load(const std::filesystem::path& path) {
return; return;
} }
u64 entry_count = 0;
if (data.contains("General")) { if (data.contains("General")) {
const toml::value& general = data.at("General"); const toml::value& general = data.at("General");
volumeSlider = toml::find_or<int>(general, "volumeSlider", volumeSlider);
isNeo = toml::find_or<bool>(general, "isPS4Pro", isNeo); isNeo = toml::find_or<bool>(general, "isPS4Pro", isNeo);
isDevKit = toml::find_or<bool>(general, "isDevKit", isDevKit); isDevKit = toml::find_or<bool>(general, "isDevKit", isDevKit);
isPSNSignedIn = toml::find_or<bool>(general, "isPSNSignedIn", isPSNSignedIn); isPSNSignedIn = toml::find_or<bool>(general, "isPSNSignedIn", isPSNSignedIn);
@ -652,10 +603,9 @@ void load(const std::filesystem::path& path) {
compatibilityData = toml::find_or<bool>(general, "compatibilityEnabled", compatibilityData); compatibilityData = toml::find_or<bool>(general, "compatibilityEnabled", compatibilityData);
checkCompatibilityOnStartup = toml::find_or<bool>(general, "checkCompatibilityOnStartup", checkCompatibilityOnStartup = toml::find_or<bool>(general, "checkCompatibilityOnStartup",
checkCompatibilityOnStartup); checkCompatibilityOnStartup);
isConnectedToNetwork =
toml::find_or<bool>(general, "isConnectedToNetwork", isConnectedToNetwork);
chooseHomeTab = toml::find_or<std::string>(general, "chooseHomeTab", chooseHomeTab); chooseHomeTab = toml::find_or<std::string>(general, "chooseHomeTab", chooseHomeTab);
entry_count += general.size();
} }
if (data.contains("Input")) { if (data.contains("Input")) {
@ -669,22 +619,18 @@ void load(const std::filesystem::path& path) {
toml::find_or<bool>(input, "isMotionControlsEnabled", isMotionControlsEnabled); toml::find_or<bool>(input, "isMotionControlsEnabled", isMotionControlsEnabled);
useUnifiedInputConfig = useUnifiedInputConfig =
toml::find_or<bool>(input, "useUnifiedInputConfig", useUnifiedInputConfig); toml::find_or<bool>(input, "useUnifiedInputConfig", useUnifiedInputConfig);
micDevice = toml::find_or<std::string>(input, "micDevice", micDevice);
entry_count += input.size();
} }
if (data.contains("GPU")) { if (data.contains("GPU")) {
const toml::value& gpu = data.at("GPU"); const toml::value& gpu = data.at("GPU");
windowWidth = toml::find_or<int>(gpu, "screenWidth", windowWidth); screenWidth = toml::find_or<int>(gpu, "screenWidth", screenWidth);
windowHeight = toml::find_or<int>(gpu, "screenHeight", windowHeight); screenHeight = toml::find_or<int>(gpu, "screenHeight", screenHeight);
internalScreenWidth = toml::find_or<int>(gpu, "internalScreenWidth", internalScreenWidth);
internalScreenHeight =
toml::find_or<int>(gpu, "internalScreenHeight", internalScreenHeight);
isNullGpu = toml::find_or<bool>(gpu, "nullGpu", isNullGpu); isNullGpu = toml::find_or<bool>(gpu, "nullGpu", isNullGpu);
shouldCopyGPUBuffers = toml::find_or<bool>(gpu, "copyGPUBuffers", shouldCopyGPUBuffers); shouldCopyGPUBuffers = toml::find_or<bool>(gpu, "copyGPUBuffers", shouldCopyGPUBuffers);
readbacksEnabled = toml::find_or<bool>(gpu, "readbacks", readbacksEnabled); readbacksEnabled = toml::find_or<bool>(gpu, "readbacks", readbacksEnabled);
readbackLinearImagesEnabled =
toml::find_or<bool>(gpu, "readbackLinearImages", readbackLinearImagesEnabled);
directMemoryAccessEnabled = directMemoryAccessEnabled =
toml::find_or<bool>(gpu, "directMemoryAccess", directMemoryAccessEnabled); toml::find_or<bool>(gpu, "directMemoryAccess", directMemoryAccessEnabled);
shouldDumpShaders = toml::find_or<bool>(gpu, "dumpShaders", shouldDumpShaders); shouldDumpShaders = toml::find_or<bool>(gpu, "dumpShaders", shouldDumpShaders);
@ -693,6 +639,8 @@ void load(const std::filesystem::path& path) {
isFullscreen = toml::find_or<bool>(gpu, "Fullscreen", isFullscreen); isFullscreen = toml::find_or<bool>(gpu, "Fullscreen", isFullscreen);
fullscreenMode = toml::find_or<std::string>(gpu, "FullscreenMode", fullscreenMode); fullscreenMode = toml::find_or<std::string>(gpu, "FullscreenMode", fullscreenMode);
isHDRAllowed = toml::find_or<bool>(gpu, "allowHDR", isHDRAllowed); isHDRAllowed = toml::find_or<bool>(gpu, "allowHDR", isHDRAllowed);
entry_count += gpu.size();
} }
if (data.contains("Vulkan")) { if (data.contains("Vulkan")) {
@ -706,9 +654,10 @@ void load(const std::filesystem::path& path) {
vkHostMarkers = toml::find_or<bool>(vk, "hostMarkers", vkHostMarkers); vkHostMarkers = toml::find_or<bool>(vk, "hostMarkers", vkHostMarkers);
vkGuestMarkers = toml::find_or<bool>(vk, "guestMarkers", vkGuestMarkers); vkGuestMarkers = toml::find_or<bool>(vk, "guestMarkers", vkGuestMarkers);
rdocEnable = toml::find_or<bool>(vk, "rdocEnable", rdocEnable); rdocEnable = toml::find_or<bool>(vk, "rdocEnable", rdocEnable);
entry_count += vk.size();
} }
std::string current_version = {};
if (data.contains("Debug")) { if (data.contains("Debug")) {
const toml::value& debug = data.at("Debug"); const toml::value& debug = data.at("Debug");
@ -717,7 +666,8 @@ void load(const std::filesystem::path& path) {
toml::find_or<bool>(debug, "isSeparateLogFilesEnabled", isSeparateLogFilesEnabled); toml::find_or<bool>(debug, "isSeparateLogFilesEnabled", isSeparateLogFilesEnabled);
isShaderDebug = toml::find_or<bool>(debug, "CollectShader", isShaderDebug); isShaderDebug = toml::find_or<bool>(debug, "CollectShader", isShaderDebug);
isFpsColor = toml::find_or<bool>(debug, "FPSColor", isFpsColor); isFpsColor = toml::find_or<bool>(debug, "FPSColor", isFpsColor);
current_version = toml::find_or<std::string>(debug, "ConfigVersion", current_version);
entry_count += debug.size();
} }
if (data.contains("GUI")) { if (data.contains("GUI")) {
@ -749,20 +699,26 @@ void load(const std::filesystem::path& path) {
settings_addon_install_dir = settings_addon_install_dir =
toml::find_fs_path_or(gui, "addonInstallDir", settings_addon_install_dir); toml::find_fs_path_or(gui, "addonInstallDir", settings_addon_install_dir);
entry_count += gui.size();
} }
if (data.contains("Settings")) { if (data.contains("Settings")) {
const toml::value& settings = data.at("Settings"); const toml::value& settings = data.at("Settings");
m_language = toml::find_or<int>(settings, "consoleLanguage", m_language); m_language = toml::find_or<int>(settings, "consoleLanguage", m_language);
entry_count += settings.size();
} }
if (data.contains("Keys")) { if (data.contains("Keys")) {
const toml::value& keys = data.at("Keys"); const toml::value& keys = data.at("Keys");
trophyKey = toml::find_or<std::string>(keys, "TrophyKey", trophyKey); trophyKey = toml::find_or<std::string>(keys, "TrophyKey", trophyKey);
entry_count += keys.size();
} }
// Run save after loading to generate any missing fields with default values. // Run save after loading to generate any missing fields with default values.
if (config_version != current_version) { if (entry_count != total_entries) {
fmt::print("Outdated config detected, updating config file.\n"); fmt::print("Outdated config detected, updating config file.\n");
save(path); save(path);
} }
@ -821,7 +777,6 @@ void save(const std::filesystem::path& path) {
fmt::print("Saving new configuration file {}\n", fmt::UTF(path.u8string())); fmt::print("Saving new configuration file {}\n", fmt::UTF(path.u8string()));
} }
data["General"]["volumeSlider"] = volumeSlider;
data["General"]["isPS4Pro"] = isNeo; data["General"]["isPS4Pro"] = isNeo;
data["General"]["isDevKit"] = isDevKit; data["General"]["isDevKit"] = isDevKit;
data["General"]["isPSNSignedIn"] = isPSNSignedIn; data["General"]["isPSNSignedIn"] = isPSNSignedIn;
@ -836,22 +791,17 @@ void save(const std::filesystem::path& path) {
data["General"]["sideTrophy"] = isSideTrophy; data["General"]["sideTrophy"] = isSideTrophy;
data["General"]["compatibilityEnabled"] = compatibilityData; data["General"]["compatibilityEnabled"] = compatibilityData;
data["General"]["checkCompatibilityOnStartup"] = checkCompatibilityOnStartup; data["General"]["checkCompatibilityOnStartup"] = checkCompatibilityOnStartup;
data["General"]["isConnectedToNetwork"] = isConnectedToNetwork;
data["Input"]["cursorState"] = cursorState; data["Input"]["cursorState"] = cursorState;
data["Input"]["cursorHideTimeout"] = cursorHideTimeout; data["Input"]["cursorHideTimeout"] = cursorHideTimeout;
data["Input"]["useSpecialPad"] = useSpecialPad; data["Input"]["useSpecialPad"] = useSpecialPad;
data["Input"]["specialPadClass"] = specialPadClass; data["Input"]["specialPadClass"] = specialPadClass;
data["Input"]["isMotionControlsEnabled"] = isMotionControlsEnabled; data["Input"]["isMotionControlsEnabled"] = isMotionControlsEnabled;
data["Input"]["useUnifiedInputConfig"] = useUnifiedInputConfig; data["Input"]["useUnifiedInputConfig"] = useUnifiedInputConfig;
data["Input"]["micDevice"] = micDevice; data["GPU"]["screenWidth"] = screenWidth;
data["GPU"]["screenWidth"] = windowWidth; data["GPU"]["screenHeight"] = screenHeight;
data["GPU"]["screenHeight"] = windowHeight;
data["GPU"]["internalScreenWidth"] = internalScreenWidth;
data["GPU"]["internalScreenHeight"] = internalScreenHeight;
data["GPU"]["nullGpu"] = isNullGpu; data["GPU"]["nullGpu"] = isNullGpu;
data["GPU"]["copyGPUBuffers"] = shouldCopyGPUBuffers; data["GPU"]["copyGPUBuffers"] = shouldCopyGPUBuffers;
data["GPU"]["readbacks"] = readbacksEnabled; data["GPU"]["readbacks"] = readbacksEnabled;
data["GPU"]["readbackLinearImages"] = readbackLinearImagesEnabled;
data["GPU"]["directMemoryAccess"] = directMemoryAccessEnabled; data["GPU"]["directMemoryAccess"] = directMemoryAccessEnabled;
data["GPU"]["dumpShaders"] = shouldDumpShaders; data["GPU"]["dumpShaders"] = shouldDumpShaders;
data["GPU"]["patchShaders"] = shouldPatchShaders; data["GPU"]["patchShaders"] = shouldPatchShaders;
@ -871,7 +821,6 @@ void save(const std::filesystem::path& path) {
data["Debug"]["CollectShader"] = isShaderDebug; data["Debug"]["CollectShader"] = isShaderDebug;
data["Debug"]["isSeparateLogFilesEnabled"] = isSeparateLogFilesEnabled; data["Debug"]["isSeparateLogFilesEnabled"] = isSeparateLogFilesEnabled;
data["Debug"]["FPSColor"] = isFpsColor; data["Debug"]["FPSColor"] = isFpsColor;
data["Debug"]["ConfigVersion"] = config_version;
data["Keys"]["TrophyKey"] = trophyKey; data["Keys"]["TrophyKey"] = trophyKey;
std::vector<std::string> install_dirs; std::vector<std::string> install_dirs;
@ -920,7 +869,6 @@ void save(const std::filesystem::path& path) {
void setDefaultValues() { void setDefaultValues() {
// General // General
volumeSlider = 100;
isNeo = false; isNeo = false;
isDevKit = false; isDevKit = false;
isPSNSignedIn = false; isPSNSignedIn = false;
@ -935,7 +883,6 @@ void setDefaultValues() {
isSideTrophy = "right"; isSideTrophy = "right";
compatibilityData = false; compatibilityData = false;
checkCompatibilityOnStartup = false; checkCompatibilityOnStartup = false;
isConnectedToNetwork = false;
// Input // Input
cursorState = HideCursorState::Idle; cursorState = HideCursorState::Idle;
@ -948,17 +895,13 @@ void setDefaultValues() {
controllerCustomColorRGB[0] = 0; controllerCustomColorRGB[0] = 0;
controllerCustomColorRGB[1] = 0; controllerCustomColorRGB[1] = 0;
controllerCustomColorRGB[2] = 255; controllerCustomColorRGB[2] = 255;
micDevice = "Default Device";
// GPU // GPU
windowWidth = 1280; screenWidth = 1280;
windowHeight = 720; screenHeight = 720;
internalScreenWidth = 1280;
internalScreenHeight = 720;
isNullGpu = false; isNullGpu = false;
shouldCopyGPUBuffers = false; shouldCopyGPUBuffers = false;
readbacksEnabled = false; readbacksEnabled = false;
readbackLinearImagesEnabled = false;
directMemoryAccessEnabled = false; directMemoryAccessEnabled = false;
shouldDumpShaders = false; shouldDumpShaders = false;
shouldPatchShaders = false; shouldPatchShaders = false;

View File

@ -19,22 +19,16 @@ enum HideCursorState : int { Never, Idle, Always };
void load(const std::filesystem::path& path); void load(const std::filesystem::path& path);
void save(const std::filesystem::path& path); void save(const std::filesystem::path& path);
int getVolumeSlider();
void setVolumeSlider(int volumeValue);
std::string getTrophyKey(); std::string getTrophyKey();
void setTrophyKey(std::string key); void setTrophyKey(std::string key);
bool getIsFullscreen(); bool getIsFullscreen();
void setIsFullscreen(bool enable); void setIsFullscreen(bool enable);
std::string getFullscreenMode(); std::string getFullscreenMode();
void setFullscreenMode(std::string mode); void setFullscreenMode(std::string mode);
u32 getWindowWidth(); u32 getScreenWidth();
u32 getWindowHeight(); u32 getScreenHeight();
void setWindowWidth(u32 width); void setScreenWidth(u32 width);
void setWindowHeight(u32 height); void setScreenHeight(u32 height);
u32 getInternalScreenWidth();
u32 getInternalScreenHeight();
void setInternalScreenWidth(u32 width);
void setInternalScreenHeight(u32 height);
bool debugDump(); bool debugDump();
void setDebugDump(bool enable); void setDebugDump(bool enable);
s32 getGpuId(); s32 getGpuId();
@ -53,8 +47,6 @@ bool copyGPUCmdBuffers();
void setCopyGPUCmdBuffers(bool enable); void setCopyGPUCmdBuffers(bool enable);
bool readbacks(); bool readbacks();
void setReadbacks(bool enable); void setReadbacks(bool enable);
bool readbackLinearImages();
void setReadbackLinearImages(bool enable);
bool directMemoryAccess(); bool directMemoryAccess();
void setDirectMemoryAccess(bool enable); void setDirectMemoryAccess(bool enable);
bool dumpShaders(); bool dumpShaders();
@ -86,9 +78,7 @@ void setLogFilter(const std::string& type);
double getTrophyNotificationDuration(); double getTrophyNotificationDuration();
void setTrophyNotificationDuration(double newTrophyNotificationDuration); void setTrophyNotificationDuration(double newTrophyNotificationDuration);
int getCursorHideTimeout(); int getCursorHideTimeout();
std::string getMicDevice();
void setCursorHideTimeout(int newcursorHideTimeout); void setCursorHideTimeout(int newcursorHideTimeout);
void setMicDevice(std::string device);
void setSeparateLogFilesEnabled(bool enabled); void setSeparateLogFilesEnabled(bool enabled);
bool getSeparateLogFilesEnabled(); bool getSeparateLogFilesEnabled();
u32 GetLanguage(); u32 GetLanguage();
@ -114,7 +104,6 @@ std::filesystem::path GetSaveDataPath();
void setLoadGameSizeEnabled(bool enable); void setLoadGameSizeEnabled(bool enable);
bool getCompatibilityEnabled(); bool getCompatibilityEnabled();
bool getCheckCompatibilityOnStartup(); bool getCheckCompatibilityOnStartup();
bool getIsConnectedToNetwork();
std::string getUserName(); std::string getUserName();
std::string getChooseHomeTab(); std::string getChooseHomeTab();
bool GetUseUnifiedInputConfig(); bool GetUseUnifiedInputConfig();

View File

@ -358,17 +358,9 @@ enum PosixPageProtection {
[[nodiscard]] constexpr PosixPageProtection ToPosixProt(Core::MemoryProt prot) { [[nodiscard]] constexpr PosixPageProtection ToPosixProt(Core::MemoryProt prot) {
if (True(prot & Core::MemoryProt::CpuReadWrite) || if (True(prot & Core::MemoryProt::CpuReadWrite) ||
True(prot & Core::MemoryProt::GpuReadWrite)) { True(prot & Core::MemoryProt::GpuReadWrite)) {
if (True(prot & Core::MemoryProt::CpuExec)) { return PAGE_READWRITE;
return PAGE_EXECUTE_READWRITE;
} else {
return PAGE_READWRITE;
}
} else if (True(prot & Core::MemoryProt::CpuRead) || True(prot & Core::MemoryProt::GpuRead)) { } else if (True(prot & Core::MemoryProt::CpuRead) || True(prot & Core::MemoryProt::GpuRead)) {
if (True(prot & Core::MemoryProt::CpuExec)) { return PAGE_READONLY;
return PAGE_EXECUTE_READ;
} else {
return PAGE_READONLY;
}
} else { } else {
return PAGE_NOACCESS; return PAGE_NOACCESS;
} }

View File

@ -163,9 +163,7 @@ static void GenerateEXTRQ(void* /* address */, const ZydisDecodedOperand* operan
mask = (1ULL << length) - 1; mask = (1ULL << length) - 1;
} }
if (length + index > 64) { ASSERT_MSG(length + index <= 64, "length + index must be less than or equal to 64.");
mask = 0xFFFF'FFFF'FFFF'FFFF;
}
// Get lower qword from xmm register // Get lower qword from xmm register
c.vmovq(scratch1, xmm_dst); c.vmovq(scratch1, xmm_dst);
@ -179,8 +177,8 @@ static void GenerateEXTRQ(void* /* address */, const ZydisDecodedOperand* operan
c.mov(scratch2, mask); c.mov(scratch2, mask);
c.and_(scratch1, scratch2); c.and_(scratch1, scratch2);
// Writeback to xmm register, extrq instruction says top 64-bits are undefined but zeroed on // Writeback to xmm register, extrq instruction says top 64-bits are undefined so we don't
// AMD CPUs // care to preserve them
c.vmovq(xmm_dst, scratch1); c.vmovq(xmm_dst, scratch1);
c.pop(scratch2); c.pop(scratch2);
@ -289,9 +287,7 @@ static void GenerateINSERTQ(void* /* address */, const ZydisDecodedOperand* oper
mask_value = (1ULL << length) - 1; mask_value = (1ULL << length) - 1;
} }
if (length + index > 64) { ASSERT_MSG(length + index <= 64, "length + index must be less than or equal to 64.");
mask_value = 0xFFFF'FFFF'FFFF'FFFF;
}
c.vmovq(scratch1, xmm_src); c.vmovq(scratch1, xmm_src);
c.vmovq(scratch2, xmm_dst); c.vmovq(scratch2, xmm_dst);
@ -311,9 +307,8 @@ static void GenerateINSERTQ(void* /* address */, const ZydisDecodedOperand* oper
// dst |= src // dst |= src
c.or_(scratch2, scratch1); c.or_(scratch2, scratch1);
// Insert scratch2 into low 64 bits of dst, upper 64 bits are undefined but zeroed on AMD // Insert scratch2 into low 64 bits of dst, upper 64 bits are unaffected
// CPUs c.vpinsrq(xmm_dst, xmm_dst, scratch2, 0);
c.vmovq(xmm_dst, scratch2);
c.pop(mask); c.pop(mask);
c.pop(scratch2); c.pop(scratch2);
@ -379,7 +374,7 @@ static void GenerateINSERTQ(void* /* address */, const ZydisDecodedOperand* oper
c.and_(scratch2, mask); c.and_(scratch2, mask);
c.or_(scratch2, scratch1); c.or_(scratch2, scratch1);
// Upper 64 bits are undefined in insertq but AMD CPUs zero them // Upper 64 bits are undefined in insertq
c.vmovq(xmm_dst, scratch2); c.vmovq(xmm_dst, scratch2);
c.pop(mask); c.pop(mask);
@ -640,7 +635,6 @@ static bool TryExecuteIllegalInstruction(void* ctx, void* code_address) {
lowQWordDst >>= index; lowQWordDst >>= index;
lowQWordDst &= mask; lowQWordDst &= mask;
memset((u8*)dst + sizeof(u64), 0, sizeof(u64));
memcpy(dst, &lowQWordDst, sizeof(lowQWordDst)); memcpy(dst, &lowQWordDst, sizeof(lowQWordDst));
Common::IncrementRip(ctx, 4); Common::IncrementRip(ctx, 4);
@ -681,7 +675,6 @@ static bool TryExecuteIllegalInstruction(void* ctx, void* code_address) {
lowQWordDst &= ~(mask << index); lowQWordDst &= ~(mask << index);
lowQWordDst |= lowQWordSrc << index; lowQWordDst |= lowQWordSrc << index;
memset((u8*)dst + sizeof(u64), 0, sizeof(u64));
memcpy(dst, &lowQWordDst, sizeof(lowQWordDst)); memcpy(dst, &lowQWordDst, sizeof(lowQWordDst));
Common::IncrementRip(ctx, 4); Common::IncrementRip(ctx, 4);
@ -753,10 +746,6 @@ static bool PatchesIllegalInstructionHandler(void* context) {
ZydisDecodedOperand operands[ZYDIS_MAX_OPERAND_COUNT]; ZydisDecodedOperand operands[ZYDIS_MAX_OPERAND_COUNT];
const auto status = const auto status =
Common::Decoder::Instance()->decodeInstruction(instruction, operands, code_address); Common::Decoder::Instance()->decodeInstruction(instruction, operands, code_address);
if (ZYAN_SUCCESS(status) && instruction.mnemonic == ZydisMnemonic::ZYDIS_MNEMONIC_UD2)
[[unlikely]] {
UNREACHABLE_MSG("ud2 at code address {:#x}", (u64)code_address);
}
LOG_ERROR(Core, "Failed to patch address {:x} -- mnemonic: {}", (u64)code_address, LOG_ERROR(Core, "Failed to patch address {:x} -- mnemonic: {}", (u64)code_address,
ZYAN_SUCCESS(status) ? ZydisMnemonicGetString(instruction.mnemonic) ZYAN_SUCCESS(status) ? ZydisMnemonicGetString(instruction.mnemonic)
: "Failed to decode"); : "Failed to decode");

View File

@ -219,7 +219,7 @@ int PS4_SYSV_ABI sceAjmStrError() {
return ORBIS_OK; return ORBIS_OK;
} }
void RegisterLib(Core::Loader::SymbolsResolver* sym) { void RegisterlibSceAjm(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("NVDXiUesSbA", "libSceAjm", 1, "libSceAjm", 1, 1, sceAjmBatchCancel); LIB_FUNCTION("NVDXiUesSbA", "libSceAjm", 1, "libSceAjm", 1, 1, sceAjmBatchCancel);
LIB_FUNCTION("WfAiBW8Wcek", "libSceAjm", 1, "libSceAjm", 1, 1, sceAjmBatchErrorDump); LIB_FUNCTION("WfAiBW8Wcek", "libSceAjm", 1, "libSceAjm", 1, 1, sceAjmBatchErrorDump);
LIB_FUNCTION("dmDybN--Fn8", "libSceAjm", 1, "libSceAjm", 1, 1, sceAjmBatchJobControlBufferRa); LIB_FUNCTION("dmDybN--Fn8", "libSceAjm", 1, "libSceAjm", 1, 1, sceAjmBatchJobControlBufferRa);

View File

@ -229,5 +229,5 @@ int PS4_SYSV_ABI sceAjmModuleRegister(u32 context, AjmCodecType codec_type, s64
int PS4_SYSV_ABI sceAjmModuleUnregister(); int PS4_SYSV_ABI sceAjmModuleUnregister();
int PS4_SYSV_ABI sceAjmStrError(); int PS4_SYSV_ABI sceAjmStrError();
void RegisterLib(Core::Loader::SymbolsResolver* sym); void RegisterlibSceAjm(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::Ajm } // namespace Libraries::Ajm

View File

@ -369,7 +369,7 @@ int PS4_SYSV_ABI sceAppContentGetDownloadedStoreCountry() {
return ORBIS_OK; return ORBIS_OK;
} }
void RegisterLib(Core::Loader::SymbolsResolver* sym) { void RegisterlibSceAppContent(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("AS45QoYHjc4", "libSceAppContent", 1, "libSceAppContentUtil", 1, 1, _Z5dummyv); LIB_FUNCTION("AS45QoYHjc4", "libSceAppContent", 1, "libSceAppContentUtil", 1, 1, _Z5dummyv);
LIB_FUNCTION("ZiATpP9gEkA", "libSceAppContent", 1, "libSceAppContentUtil", 1, 1, LIB_FUNCTION("ZiATpP9gEkA", "libSceAppContent", 1, "libSceAppContentUtil", 1, 1,
sceAppContentAddcontDelete); sceAppContentAddcontDelete);

View File

@ -119,5 +119,5 @@ int PS4_SYSV_ABI sceAppContentGetAddcontInfoByEntitlementId();
int PS4_SYSV_ABI sceAppContentGetAddcontInfoListByIroTag(); int PS4_SYSV_ABI sceAppContentGetAddcontInfoListByIroTag();
int PS4_SYSV_ABI sceAppContentGetDownloadedStoreCountry(); int PS4_SYSV_ABI sceAppContentGetDownloadedStoreCountry();
void RegisterLib(Core::Loader::SymbolsResolver* sym); void RegisterlibSceAppContent(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::AppContent } // namespace Libraries::AppContent

View File

@ -3,21 +3,18 @@
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/libraries/audio/audioin.h" #include "core/libraries/audio/audioin.h"
#include "core/libraries/audio/sdl_in.h"
#include "core/libraries/error_codes.h" #include "core/libraries/error_codes.h"
#include "core/libraries/libs.h" #include "core/libraries/libs.h"
namespace Libraries::AudioIn { namespace Libraries::AudioIn {
static std::unique_ptr<SDLAudioIn> audio = std::make_unique<SDLAudioIn>();
int PS4_SYSV_ABI sceAudioInChangeAppModuleState() { int PS4_SYSV_ABI sceAudioInChangeAppModuleState() {
LOG_ERROR(Lib_AudioIn, "(STUBBED) called"); LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK; return ORBIS_OK;
} }
int PS4_SYSV_ABI sceAudioInClose(s32 handle) { int PS4_SYSV_ABI sceAudioInClose() {
audio->AudioInClose(handle); LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK; return ORBIS_OK;
} }
@ -96,13 +93,9 @@ int PS4_SYSV_ABI sceAudioInGetSilentState() {
return ORBIS_OK; return ORBIS_OK;
} }
int PS4_SYSV_ABI sceAudioInHqOpen(Libraries::UserService::OrbisUserServiceUserId userId, u32 type, int PS4_SYSV_ABI sceAudioInHqOpen() {
u32 index, u32 len, u32 freq, u32 param) { LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
int result = audio->AudioInOpen(type, len, freq, param); return ORBIS_OK;
if (result < 0) {
LOG_ERROR(Lib_AudioIn, "Error returned {:#x}", result);
}
return result;
} }
int PS4_SYSV_ABI sceAudioInHqOpenEx() { int PS4_SYSV_ABI sceAudioInHqOpenEx() {
@ -115,8 +108,9 @@ int PS4_SYSV_ABI sceAudioInInit() {
return ORBIS_OK; return ORBIS_OK;
} }
int PS4_SYSV_ABI sceAudioInInput(s32 handle, void* dest) { int PS4_SYSV_ABI sceAudioInInput() {
return audio->AudioInInput(handle, dest); LOG_ERROR(Lib_AudioIn, "(STUBBED) called");
return ORBIS_OK;
} }
int PS4_SYSV_ABI sceAudioInInputs() { int PS4_SYSV_ABI sceAudioInInputs() {
@ -129,13 +123,9 @@ int PS4_SYSV_ABI sceAudioInIsSharedDevice() {
return ORBIS_OK; return ORBIS_OK;
} }
int PS4_SYSV_ABI sceAudioInOpen(Libraries::UserService::OrbisUserServiceUserId userId, u32 type, int PS4_SYSV_ABI sceAudioInOpen() {
u32 index, u32 len, u32 freq, u32 param) { LOG_ERROR(Lib_AudioIn, "(DUMMY) called");
int result = audio->AudioInOpen(type, len, freq, param); return 0x80260005; // ports are full return
if (result < 0) {
LOG_ERROR(Lib_AudioIn, "Error returned {:#x}", result);
}
return result;
} }
int PS4_SYSV_ABI sceAudioInOpenEx() { int PS4_SYSV_ABI sceAudioInOpenEx() {
@ -228,7 +218,7 @@ int PS4_SYSV_ABI sceAudioInVmicWrite() {
return ORBIS_OK; return ORBIS_OK;
} }
void RegisterLib(Core::Loader::SymbolsResolver* sym) { void RegisterlibSceAudioIn(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("IQtWgnrw6v8", "libSceAudioIn", 1, "libSceAudioIn", 1, 1, LIB_FUNCTION("IQtWgnrw6v8", "libSceAudioIn", 1, "libSceAudioIn", 1, 1,
sceAudioInChangeAppModuleState); sceAudioInChangeAppModuleState);
LIB_FUNCTION("Jh6WbHhnI68", "libSceAudioIn", 1, "libSceAudioIn", 1, 1, sceAudioInClose); LIB_FUNCTION("Jh6WbHhnI68", "libSceAudioIn", 1, "libSceAudioIn", 1, 1, sceAudioInClose);

View File

@ -3,7 +3,6 @@
#pragma once #pragma once
#include <core/libraries/system/userservice.h>
#include "common/types.h" #include "common/types.h"
namespace Core::Loader { namespace Core::Loader {
@ -12,12 +11,8 @@ class SymbolsResolver;
namespace Libraries::AudioIn { namespace Libraries::AudioIn {
enum class OrbisAudioInParamFormat : u32 { S16Mono = 0, S16Stereo = 2 };
enum class OrbisAudioInType : u32 { VoiceChat = 0, General = 1, VoiceRecognition = 5 };
int PS4_SYSV_ABI sceAudioInChangeAppModuleState(); int PS4_SYSV_ABI sceAudioInChangeAppModuleState();
int PS4_SYSV_ABI sceAudioInClose(s32 handle); int PS4_SYSV_ABI sceAudioInClose();
int PS4_SYSV_ABI sceAudioInCountPorts(); int PS4_SYSV_ABI sceAudioInCountPorts();
int PS4_SYSV_ABI sceAudioInDeviceHqOpen(); int PS4_SYSV_ABI sceAudioInDeviceHqOpen();
int PS4_SYSV_ABI sceAudioInDeviceIdHqOpen(); int PS4_SYSV_ABI sceAudioInDeviceIdHqOpen();
@ -33,15 +28,13 @@ int PS4_SYSV_ABI sceAudioInGetGain();
int PS4_SYSV_ABI sceAudioInGetHandleStatusInfo(); int PS4_SYSV_ABI sceAudioInGetHandleStatusInfo();
int PS4_SYSV_ABI sceAudioInGetRerouteCount(); int PS4_SYSV_ABI sceAudioInGetRerouteCount();
int PS4_SYSV_ABI sceAudioInGetSilentState(); int PS4_SYSV_ABI sceAudioInGetSilentState();
int PS4_SYSV_ABI sceAudioInHqOpen(Libraries::UserService::OrbisUserServiceUserId userId, u32 type, int PS4_SYSV_ABI sceAudioInHqOpen();
u32 index, u32 len, u32 freq, u32 param);
int PS4_SYSV_ABI sceAudioInHqOpenEx(); int PS4_SYSV_ABI sceAudioInHqOpenEx();
int PS4_SYSV_ABI sceAudioInInit(); int PS4_SYSV_ABI sceAudioInInit();
int PS4_SYSV_ABI sceAudioInInput(s32 handle, void* dest); int PS4_SYSV_ABI sceAudioInInput();
int PS4_SYSV_ABI sceAudioInInputs(); int PS4_SYSV_ABI sceAudioInInputs();
int PS4_SYSV_ABI sceAudioInIsSharedDevice(); int PS4_SYSV_ABI sceAudioInIsSharedDevice();
int PS4_SYSV_ABI sceAudioInOpen(Libraries::UserService::OrbisUserServiceUserId userId, u32 type, int PS4_SYSV_ABI sceAudioInOpen();
u32 index, u32 len, u32 freq, u32 param);
int PS4_SYSV_ABI sceAudioInOpenEx(); int PS4_SYSV_ABI sceAudioInOpenEx();
int PS4_SYSV_ABI sceAudioInSetAllMute(); int PS4_SYSV_ABI sceAudioInSetAllMute();
int PS4_SYSV_ABI sceAudioInSetCompressorPreGain(); int PS4_SYSV_ABI sceAudioInSetCompressorPreGain();
@ -61,5 +54,5 @@ int PS4_SYSV_ABI sceAudioInVmicCreate();
int PS4_SYSV_ABI sceAudioInVmicDestroy(); int PS4_SYSV_ABI sceAudioInVmicDestroy();
int PS4_SYSV_ABI sceAudioInVmicWrite(); int PS4_SYSV_ABI sceAudioInVmicWrite();
void RegisterLib(Core::Loader::SymbolsResolver* sym); void RegisterlibSceAudioIn(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::AudioIn } // namespace Libraries::AudioIn

View File

@ -14,7 +14,6 @@
#include "core/libraries/audio/audioout.h" #include "core/libraries/audio/audioout.h"
#include "core/libraries/audio/audioout_backend.h" #include "core/libraries/audio/audioout_backend.h"
#include "core/libraries/audio/audioout_error.h" #include "core/libraries/audio/audioout_error.h"
#include "core/libraries/kernel/time.h"
#include "core/libraries/libs.h" #include "core/libraries/libs.h"
namespace Libraries::AudioOut { namespace Libraries::AudioOut {
@ -169,19 +168,8 @@ int PS4_SYSV_ABI sceAudioOutGetInfoOpenNum() {
return ORBIS_OK; return ORBIS_OK;
} }
int PS4_SYSV_ABI sceAudioOutGetLastOutputTime(s32 handle, u64* output_time) { int PS4_SYSV_ABI sceAudioOutGetLastOutputTime() {
LOG_DEBUG(Lib_AudioOut, "called, handle: {}, output time: {}", handle, fmt::ptr(output_time)); LOG_ERROR(Lib_AudioOut, "(STUBBED) called");
if (!output_time) {
return ORBIS_AUDIO_OUT_ERROR_INVALID_POINTER;
}
if (handle >= ports_out.size()) {
return ORBIS_AUDIO_OUT_ERROR_INVALID_PORT;
}
auto& port = ports_out.at(handle - 1);
if (!port.IsOpen()) {
return ORBIS_AUDIO_OUT_ERROR_NOT_OPENED;
}
*output_time = port.last_output_time;
return ORBIS_OK; return ORBIS_OK;
} }
@ -408,7 +396,6 @@ s32 PS4_SYSV_ABI sceAudioOutOutput(s32 handle, void* ptr) {
if (ptr != nullptr && port.IsOpen()) { if (ptr != nullptr && port.IsOpen()) {
std::memcpy(port.output_buffer, ptr, port.BufferSize()); std::memcpy(port.output_buffer, ptr, port.BufferSize());
port.output_ready = true; port.output_ready = true;
port.last_output_time = Kernel::sceKernelGetProcessTime();
} }
} }
port.output_cv.notify_one(); port.output_cv.notify_one();
@ -536,24 +523,9 @@ s32 PS4_SYSV_ABI sceAudioOutSetVolume(s32 handle, s32 flag, s32* vol) {
} }
port.impl->SetVolume(port.volume); port.impl->SetVolume(port.volume);
} }
AdjustVol();
return ORBIS_OK; return ORBIS_OK;
} }
void AdjustVol() {
if (audio == nullptr) {
return;
}
for (int i = 0; i < ports_out.size(); i++) {
std::unique_lock lock{ports_out[i].mutex};
if (!ports_out[i].IsOpen()) {
continue;
}
ports_out[i].impl->SetVolume(ports_out[i].volume);
}
}
int PS4_SYSV_ABI sceAudioOutSetVolumeDown() { int PS4_SYSV_ABI sceAudioOutSetVolumeDown() {
LOG_ERROR(Lib_AudioOut, "(STUBBED) called"); LOG_ERROR(Lib_AudioOut, "(STUBBED) called");
return ORBIS_OK; return ORBIS_OK;
@ -624,7 +596,7 @@ int PS4_SYSV_ABI sceAudioOutSetSystemDebugState() {
return ORBIS_OK; return ORBIS_OK;
} }
void RegisterLib(Core::Loader::SymbolsResolver* sym) { void RegisterlibSceAudioOut(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("cx2dYFbzIAg", "libSceAudioOutDeviceService", 1, "libSceAudioOut", 1, 1, LIB_FUNCTION("cx2dYFbzIAg", "libSceAudioOutDeviceService", 1, "libSceAudioOut", 1, 1,
sceAudioOutDeviceIdOpen); sceAudioOutDeviceIdOpen);
LIB_FUNCTION("tKumjQSzhys", "libSceAudioDeviceControl", 1, "libSceAudioOut", 1, 1, LIB_FUNCTION("tKumjQSzhys", "libSceAudioDeviceControl", 1, "libSceAudioOut", 1, 1,

View File

@ -96,7 +96,6 @@ struct PortOut {
AudioFormatInfo format_info; AudioFormatInfo format_info;
u32 sample_rate; u32 sample_rate;
u32 buffer_frames; u32 buffer_frames;
u64 last_output_time;
std::array<s32, 8> volume; std::array<s32, 8> volume;
[[nodiscard]] bool IsOpen() const { [[nodiscard]] bool IsOpen() const {
@ -128,7 +127,7 @@ int PS4_SYSV_ABI sceAudioOutGetFocusEnablePid();
int PS4_SYSV_ABI sceAudioOutGetHandleStatusInfo(); int PS4_SYSV_ABI sceAudioOutGetHandleStatusInfo();
int PS4_SYSV_ABI sceAudioOutGetInfo(); int PS4_SYSV_ABI sceAudioOutGetInfo();
int PS4_SYSV_ABI sceAudioOutGetInfoOpenNum(); int PS4_SYSV_ABI sceAudioOutGetInfoOpenNum();
int PS4_SYSV_ABI sceAudioOutGetLastOutputTime(s32 handle, u64* output_time); int PS4_SYSV_ABI sceAudioOutGetLastOutputTime();
int PS4_SYSV_ABI sceAudioOutGetPortState(s32 handle, OrbisAudioOutPortState* state); int PS4_SYSV_ABI sceAudioOutGetPortState(s32 handle, OrbisAudioOutPortState* state);
int PS4_SYSV_ABI sceAudioOutGetSimulatedBusUsableStatusByBusType(); int PS4_SYSV_ABI sceAudioOutGetSimulatedBusUsableStatusByBusType();
int PS4_SYSV_ABI sceAudioOutGetSimulatedHandleStatusInfo(); int PS4_SYSV_ABI sceAudioOutGetSimulatedHandleStatusInfo();
@ -182,6 +181,5 @@ int PS4_SYSV_ABI sceAudioOutSystemControlSet();
int PS4_SYSV_ABI sceAudioOutSparkControlSetEqCoef(); int PS4_SYSV_ABI sceAudioOutSparkControlSetEqCoef();
int PS4_SYSV_ABI sceAudioOutSetSystemDebugState(); int PS4_SYSV_ABI sceAudioOutSetSystemDebugState();
void AdjustVol(); void RegisterlibSceAudioOut(Core::Loader::SymbolsResolver* sym);
void RegisterLib(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::AudioOut } // namespace Libraries::AudioOut

View File

@ -4,7 +4,6 @@
#include <thread> #include <thread>
#include <SDL3/SDL_audio.h> #include <SDL3/SDL_audio.h>
#include <SDL3/SDL_hints.h> #include <SDL3/SDL_hints.h>
#include <common/config.h>
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/libraries/audio/audioout.h" #include "core/libraries/audio/audioout.h"
@ -42,7 +41,6 @@ public:
stream = nullptr; stream = nullptr;
return; return;
} }
SDL_SetAudioStreamGain(stream, Config::getVolumeSlider() / 100.0f);
} }
~SDLPortBackend() override { ~SDLPortBackend() override {
@ -79,8 +77,7 @@ public:
} }
// SDL does not have per-channel volumes, for now just take the maximum of the channels. // SDL does not have per-channel volumes, for now just take the maximum of the channels.
const auto vol = *std::ranges::max_element(ch_volumes); const auto vol = *std::ranges::max_element(ch_volumes);
if (!SDL_SetAudioStreamGain(stream, static_cast<float>(vol) / SCE_AUDIO_OUT_VOLUME_0DB * if (!SDL_SetAudioStreamGain(stream, static_cast<float>(vol) / SCE_AUDIO_OUT_VOLUME_0DB)) {
Config::getVolumeSlider() / 100.0f)) {
LOG_WARNING(Lib_AudioOut, "Failed to change SDL audio stream volume: {}", LOG_WARNING(Lib_AudioOut, "Failed to change SDL audio stream volume: {}",
SDL_GetError()); SDL_GetError());
} }

View File

@ -1,135 +0,0 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <cstring>
#include <common/config.h>
#include <common/logging/log.h>
#include "sdl_in.h"
int SDLAudioIn::AudioInit() {
return SDL_InitSubSystem(SDL_INIT_AUDIO);
}
int SDLAudioIn::AudioInOpen(int type, uint32_t samples_num, uint32_t freq, uint32_t format) {
std::scoped_lock lock{m_mutex};
for (int id = 0; id < static_cast<int>(portsIn.size()); ++id) {
auto& port = portsIn[id];
if (!port.isOpen) {
port.isOpen = true;
port.type = type;
port.samples_num = samples_num;
port.freq = freq;
port.format = format;
SDL_AudioFormat sampleFormat;
switch (format) {
case Libraries::AudioIn::ORBIS_AUDIO_IN_PARAM_FORMAT_S16_MONO:
sampleFormat = SDL_AUDIO_S16;
port.channels_num = 1;
port.sample_size = 2;
break;
case Libraries::AudioIn::ORBIS_AUDIO_IN_PARAM_FORMAT_S16_STEREO:
sampleFormat = SDL_AUDIO_S16;
port.channels_num = 2;
port.sample_size = 2;
break;
default:
port.isOpen = false;
return ORBIS_AUDIO_IN_ERROR_INVALID_PORT;
}
SDL_AudioSpec fmt;
SDL_zero(fmt);
fmt.format = sampleFormat;
fmt.channels = port.channels_num;
fmt.freq = port.freq;
std::string micDevStr = Config::getMicDevice();
uint32_t devId;
if (micDevStr == "None") {
return ORBIS_AUDIO_IN_ERROR_INVALID_PORT;
} else if (micDevStr == "Default Device") {
devId = SDL_AUDIO_DEVICE_DEFAULT_RECORDING;
} else {
try {
devId = static_cast<uint32_t>(std::stoul(micDevStr));
} catch (const std::exception& e) {
return ORBIS_AUDIO_IN_ERROR_INVALID_PORT;
}
}
port.stream = SDL_OpenAudioDeviceStream(devId, &fmt, nullptr, nullptr);
if (!port.stream) {
port.isOpen = false;
return ORBIS_AUDIO_IN_ERROR_INVALID_PORT;
}
if (SDL_ResumeAudioStreamDevice(port.stream) == false) {
SDL_DestroyAudioStream(port.stream);
port = {};
return ORBIS_AUDIO_IN_ERROR_STREAM_FAIL;
}
return id + 1;
}
}
return ORBIS_AUDIO_IN_ERROR_INVALID_PORT;
}
int SDLAudioIn::AudioInInput(int handle, void* out_buffer) {
std::scoped_lock lock{m_mutex};
if (handle < 1 || handle > static_cast<int>(portsIn.size()) || !out_buffer)
return ORBIS_AUDIO_IN_ERROR_INVALID_PORT;
auto& port = portsIn[handle - 1];
if (!port.isOpen)
return ORBIS_AUDIO_IN_ERROR_INVALID_PORT;
const int bytesToRead = port.samples_num * port.sample_size * port.channels_num;
if (out_buffer == nullptr) {
int attempts = 0;
while (SDL_GetAudioStreamAvailable(port.stream) > 0) {
SDL_Delay(1);
if (++attempts > 1000) {
return ORBIS_AUDIO_IN_ERROR_TIMEOUT;
}
}
return 0; // done
}
int attempts = 0;
while (SDL_GetAudioStreamAvailable(port.stream) < bytesToRead) {
SDL_Delay(1);
if (++attempts > 1000) {
return ORBIS_AUDIO_IN_ERROR_TIMEOUT;
}
}
const int bytesRead = SDL_GetAudioStreamData(port.stream, out_buffer, bytesToRead);
if (bytesRead < 0) {
// SDL_GetAudioStreamData failed
LOG_ERROR(Lib_AudioIn, "AudioInInput error: {}", SDL_GetError());
return ORBIS_AUDIO_IN_ERROR_STREAM_FAIL;
}
const int framesRead = bytesRead / (port.sample_size * port.channels_num);
return framesRead;
}
void SDLAudioIn::AudioInClose(int handle) {
std::scoped_lock lock{m_mutex};
if (handle < 1 || handle > (int)portsIn.size())
return;
auto& port = portsIn[handle - 1];
if (!port.isOpen)
return;
SDL_DestroyAudioStream(port.stream);
port = {};
}

View File

@ -1,42 +0,0 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <array>
#include <mutex>
#include <SDL3/SDL.h>
namespace Libraries::AudioIn {
enum OrbisAudioInParam {
ORBIS_AUDIO_IN_PARAM_FORMAT_S16_MONO = 0,
ORBIS_AUDIO_IN_PARAM_FORMAT_S16_STEREO = 2
};
}
#define ORBIS_AUDIO_IN_ERROR_INVALID_PORT -1
#define ORBIS_AUDIO_IN_ERROR_TIMEOUT -2
#define ORBIS_AUDIO_IN_ERROR_STREAM_FAIL -3
class SDLAudioIn {
public:
int AudioInit();
int AudioInOpen(int type, uint32_t samples_num, uint32_t freq, uint32_t format);
int AudioInInput(int handle, void* out_buffer);
void AudioInClose(int handle);
private:
struct AudioInPort {
bool isOpen = false;
int type = 0;
uint32_t samples_num = 0;
uint32_t freq = 0;
int channels_num = 0;
int sample_size = 0;
uint32_t format = 0;
SDL_AudioStream* stream = nullptr;
};
std::array<AudioInPort, 8> portsIn;
std::mutex m_mutex;
};

View File

@ -526,18 +526,11 @@ s32 PS4_SYSV_ABI sceAudio3dStrError() {
} }
s32 PS4_SYSV_ABI sceAudio3dTerminate() { s32 PS4_SYSV_ABI sceAudio3dTerminate() {
LOG_INFO(Lib_Audio3d, "called"); LOG_ERROR(Lib_Audio3d, "(STUBBED) called");
if (!state) {
return ORBIS_AUDIO3D_ERROR_NOT_READY;
}
AudioOut::sceAudioOutOutput(state->audio_out_handle, nullptr);
AudioOut::sceAudioOutClose(state->audio_out_handle);
state.release();
return ORBIS_OK; return ORBIS_OK;
} }
void RegisterLib(Core::Loader::SymbolsResolver* sym) { void RegisterlibSceAudio3d(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("pZlOm1aF3aA", "libSceAudio3d", 1, "libSceAudio3d", 1, 1, sceAudio3dAudioOutClose); LIB_FUNCTION("pZlOm1aF3aA", "libSceAudio3d", 1, "libSceAudio3d", 1, 1, sceAudio3dAudioOutClose);
LIB_FUNCTION("ucEsi62soTo", "libSceAudio3d", 1, "libSceAudio3d", 1, 1, sceAudio3dAudioOutOpen); LIB_FUNCTION("ucEsi62soTo", "libSceAudio3d", 1, "libSceAudio3d", 1, 1, sceAudio3dAudioOutOpen);
LIB_FUNCTION("7NYEzJ9SJbM", "libSceAudio3d", 1, "libSceAudio3d", 1, 1, LIB_FUNCTION("7NYEzJ9SJbM", "libSceAudio3d", 1, "libSceAudio3d", 1, 1,

View File

@ -141,5 +141,5 @@ s32 PS4_SYSV_ABI sceAudio3dSetGpuRenderer();
s32 PS4_SYSV_ABI sceAudio3dStrError(); s32 PS4_SYSV_ABI sceAudio3dStrError();
s32 PS4_SYSV_ABI sceAudio3dTerminate(); s32 PS4_SYSV_ABI sceAudio3dTerminate();
void RegisterLib(Core::Loader::SymbolsResolver* sym); void RegisterlibSceAudio3d(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::Audio3d } // namespace Libraries::Audio3d

View File

@ -278,7 +278,7 @@ s32 PS4_SYSV_ABI sceAvPlayerVprintf(const char* format, va_list args) {
return ORBIS_OK; return ORBIS_OK;
} }
void RegisterLib(Core::Loader::SymbolsResolver* sym) { void RegisterlibSceAvPlayer(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("KMcEa+rHsIo", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0, sceAvPlayerAddSource); LIB_FUNCTION("KMcEa+rHsIo", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0, sceAvPlayerAddSource);
LIB_FUNCTION("x8uvuFOPZhU", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0, LIB_FUNCTION("x8uvuFOPZhU", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0,
sceAvPlayerAddSourceEx); sceAvPlayerAddSourceEx);

View File

@ -290,6 +290,6 @@ enum class SceAvPlayerAvSyncMode {
using SceAvPlayerLogCallback = int PS4_SYSV_ABI (*)(void* p, const char* format, va_list args); using SceAvPlayerLogCallback = int PS4_SYSV_ABI (*)(void* p, const char* format, va_list args);
void RegisterLib(Core::Loader::SymbolsResolver* sym); void RegisterlibSceAvPlayer(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::AvPlayer } // namespace Libraries::AvPlayer

View File

@ -40,7 +40,7 @@ public:
FrameBuffer(const SceAvPlayerMemAllocator& memory_replacement, u32 align, u32 size) noexcept FrameBuffer(const SceAvPlayerMemAllocator& memory_replacement, u32 align, u32 size) noexcept
: m_memory_replacement(memory_replacement), : m_memory_replacement(memory_replacement),
m_data(Allocate(memory_replacement, align, size)) { m_data(Allocate(memory_replacement, align, size)) {
ASSERT_MSG(m_data, "Could not allocate frame buffer."); ASSERT_MSG(m_data, "Could not allocated frame buffer.");
} }
~FrameBuffer() { ~FrameBuffer() {

View File

@ -410,7 +410,7 @@ s32 PS4_SYSV_ABI sceCameraStopByHandle() {
return ORBIS_OK; return ORBIS_OK;
} }
void RegisterLib(Core::Loader::SymbolsResolver* sym) { void RegisterlibSceCamera(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("QhjrPkRPUZQ", "libSceCamera", 1, "libSceCamera", 1, 1, sceCameraAccGetData); LIB_FUNCTION("QhjrPkRPUZQ", "libSceCamera", 1, "libSceCamera", 1, 1, sceCameraAccGetData);
LIB_FUNCTION("UFonL7xopFM", "libSceCamera", 1, "libSceCamera", 1, 1, sceCameraAudioClose); LIB_FUNCTION("UFonL7xopFM", "libSceCamera", 1, "libSceCamera", 1, 1, sceCameraAudioClose);
LIB_FUNCTION("fkZE7Hup2ro", "libSceCamera", 1, "libSceCamera", 1, 1, sceCameraAudioGetData); LIB_FUNCTION("fkZE7Hup2ro", "libSceCamera", 1, "libSceCamera", 1, 1, sceCameraAudioGetData);

View File

@ -304,5 +304,5 @@ s32 PS4_SYSV_ABI sceCameraStartByHandle();
s32 PS4_SYSV_ABI sceCameraStop(s32 handle); s32 PS4_SYSV_ABI sceCameraStop(s32 handle);
s32 PS4_SYSV_ABI sceCameraStopByHandle(); s32 PS4_SYSV_ABI sceCameraStopByHandle();
void RegisterLib(Core::Loader::SymbolsResolver* sym); void RegisterlibSceCamera(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::Camera } // namespace Libraries::Camera

View File

@ -102,7 +102,7 @@ s32 PS4_SYSV_ABI sceCompanionHttpdUnregisterRequestCallback() {
return ORBIS_OK; return ORBIS_OK;
} }
void RegisterLib(Core::Loader::SymbolsResolver* sym) { void RegisterlibSceCompanionHttpd(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("8pWltDG7h6A", "libSceCompanionHttpd", 1, "libSceCompanionHttpd", 1, 1, LIB_FUNCTION("8pWltDG7h6A", "libSceCompanionHttpd", 1, "libSceCompanionHttpd", 1, 1,
sceCompanionHttpdAddHeader); sceCompanionHttpdAddHeader);
LIB_FUNCTION("B-QBMeFdNgY", "libSceCompanionHttpd", 1, "libSceCompanionHttpd", 1, 1, LIB_FUNCTION("B-QBMeFdNgY", "libSceCompanionHttpd", 1, "libSceCompanionHttpd", 1, 1,

View File

@ -87,5 +87,5 @@ s32 PS4_SYSV_ABI sceCompanionHttpdTerminate();
s32 PS4_SYSV_ABI sceCompanionHttpdUnregisterRequestBodyReceptionCallback(); s32 PS4_SYSV_ABI sceCompanionHttpdUnregisterRequestBodyReceptionCallback();
s32 PS4_SYSV_ABI sceCompanionHttpdUnregisterRequestCallback(); s32 PS4_SYSV_ABI sceCompanionHttpdUnregisterRequestCallback();
void RegisterLib(Core::Loader::SymbolsResolver* sym); void RegisterlibSceCompanionHttpd(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::CompanionHttpd } // namespace Libraries::CompanionHttpd

View File

@ -56,7 +56,7 @@ s32 PS4_SYSV_ABI sceCompanionUtilTerminate() {
return ORBIS_OK; return ORBIS_OK;
} }
void RegisterLib(Core::Loader::SymbolsResolver* sym) { void RegisterlibSceCompanionUtil(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("cE5Msy11WhU", "libSceCompanionUtil", 1, "libSceCompanionUtil", 1, 1, LIB_FUNCTION("cE5Msy11WhU", "libSceCompanionUtil", 1, "libSceCompanionUtil", 1, 1,
sceCompanionUtilGetEvent); sceCompanionUtilGetEvent);
LIB_FUNCTION("MaVrz79mT5o", "libSceCompanionUtil", 1, "libSceCompanionUtil", 1, 1, LIB_FUNCTION("MaVrz79mT5o", "libSceCompanionUtil", 1, "libSceCompanionUtil", 1, 1,

View File

@ -29,5 +29,5 @@ s32 PS4_SYSV_ABI sceCompanionUtilInitialize();
s32 PS4_SYSV_ABI sceCompanionUtilOptParamInitialize(); s32 PS4_SYSV_ABI sceCompanionUtilOptParamInitialize();
s32 PS4_SYSV_ABI sceCompanionUtilTerminate(); s32 PS4_SYSV_ABI sceCompanionUtilTerminate();
void RegisterLib(Core::Loader::SymbolsResolver* sym); void RegisterlibSceCompanionUtil(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::CompanionUtil } // namespace Libraries::CompanionUtil

View File

@ -34,7 +34,7 @@ int PS4_SYSV_ABI Func_E7EBCE96E92F91F8() {
return ORBIS_DISC_MAP_ERROR_NO_BITMAP_INFO; return ORBIS_DISC_MAP_ERROR_NO_BITMAP_INFO;
} }
void RegisterLib(Core::Loader::SymbolsResolver* sym) { void RegisterlibSceDiscMap(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("fl1eoDnwQ4s", "libSceDiscMap", 1, "libSceDiscMap", 1, 1, LIB_FUNCTION("fl1eoDnwQ4s", "libSceDiscMap", 1, "libSceDiscMap", 1, 1,
sceDiscMapGetPackageSize); sceDiscMapGetPackageSize);
LIB_FUNCTION("lbQKqsERhtE", "libSceDiscMap", 1, "libSceDiscMap", 1, 1, LIB_FUNCTION("lbQKqsERhtE", "libSceDiscMap", 1, "libSceDiscMap", 1, 1,

View File

@ -18,5 +18,5 @@ int PS4_SYSV_ABI Func_8A828CAEE7EDD5E9(char* path, s64 offset, s64 nbytes, int*
int* ret2); int* ret2);
int PS4_SYSV_ABI Func_E7EBCE96E92F91F8(); int PS4_SYSV_ABI Func_E7EBCE96E92F91F8();
void RegisterLib(Core::Loader::SymbolsResolver* sym); void RegisterlibSceDiscMap(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::DiscMap } // namespace Libraries::DiscMap

View File

@ -545,7 +545,7 @@ s32 PS4_SYSV_ABI sceFiberSwitch(OrbisFiber* fiber, u64 arg_on_run_to, u64* arg_o
return sceFiberSwitchImpl(fiber, nullptr, 0, arg_on_run_to, arg_on_run); return sceFiberSwitchImpl(fiber, nullptr, 0, arg_on_run_to, arg_on_run);
} }
void RegisterLib(Core::Loader::SymbolsResolver* sym) { void RegisterlibSceFiber(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("hVYD7Ou2pCQ", "libSceFiber", 1, "libSceFiber", 1, 1, sceFiberInitialize); LIB_FUNCTION("hVYD7Ou2pCQ", "libSceFiber", 1, "libSceFiber", 1, 1, sceFiberInitialize);
LIB_FUNCTION("7+OJIpko9RY", "libSceFiber", 1, "libSceFiber", 1, 1, LIB_FUNCTION("7+OJIpko9RY", "libSceFiber", 1, "libSceFiber", 1, 1,
sceFiberInitializeImpl); // _sceFiberInitializeWithInternalOptionImpl sceFiberInitializeImpl); // _sceFiberInitializeWithInternalOptionImpl

View File

@ -116,5 +116,5 @@ s32 PS4_SYSV_ABI sceFiberRename(OrbisFiber* fiber, const char* name);
s32 PS4_SYSV_ABI sceFiberGetThreadFramePointerAddress(u64* addr_frame_pointer); s32 PS4_SYSV_ABI sceFiberGetThreadFramePointerAddress(u64* addr_frame_pointer);
void RegisterLib(Core::Loader::SymbolsResolver* sym); void RegisterlibSceFiber(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::Fiber } // namespace Libraries::Fiber

View File

@ -246,7 +246,7 @@ int PS4_SYSV_ABI sceGameLiveStreamingUnregisterCallback() {
return ORBIS_OK; return ORBIS_OK;
} }
void RegisterLib(Core::Loader::SymbolsResolver* sym) { void RegisterlibSceGameLiveStreaming(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("caqgDl+V9qA", "libSceGameLiveStreaming_debug", 1, "libSceGameLiveStreaming", 1, 1, LIB_FUNCTION("caqgDl+V9qA", "libSceGameLiveStreaming_debug", 1, "libSceGameLiveStreaming", 1, 1,
sceGameLiveStreamingStartDebugBroadcast); sceGameLiveStreamingStartDebugBroadcast);
LIB_FUNCTION("0i8Lrllxwow", "libSceGameLiveStreaming_debug", 1, "libSceGameLiveStreaming", 1, 1, LIB_FUNCTION("0i8Lrllxwow", "libSceGameLiveStreaming_debug", 1, "libSceGameLiveStreaming", 1, 1,

View File

@ -77,5 +77,5 @@ int PS4_SYSV_ABI sceGameLiveStreamingStopSocialFeedbackMessageFiltering();
int PS4_SYSV_ABI sceGameLiveStreamingTerminate(); int PS4_SYSV_ABI sceGameLiveStreamingTerminate();
int PS4_SYSV_ABI sceGameLiveStreamingUnregisterCallback(); int PS4_SYSV_ABI sceGameLiveStreamingUnregisterCallback();
void RegisterLib(Core::Loader::SymbolsResolver* sym); void RegisterlibSceGameLiveStreaming(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::GameLiveStreaming } // namespace Libraries::GameLiveStreaming

View File

@ -2823,7 +2823,7 @@ int PS4_SYSV_ABI Func_F916890425496553() {
return ORBIS_OK; return ORBIS_OK;
} }
void RegisterLib(Core::Loader::SymbolsResolver* sym) { void RegisterlibSceGnmDriver(Core::Loader::SymbolsResolver* sym) {
LOG_INFO(Lib_GnmDriver, "Initializing presenter"); LOG_INFO(Lib_GnmDriver, "Initializing presenter");
liverpool = std::make_unique<AmdGpu::Liverpool>(); liverpool = std::make_unique<AmdGpu::Liverpool>();
presenter = std::make_unique<Vulkan::Presenter>(*g_window, liverpool.get()); presenter = std::make_unique<Vulkan::Presenter>(*g_window, liverpool.get());

View File

@ -297,5 +297,5 @@ int PS4_SYSV_ABI Func_BFB41C057478F0BF();
int PS4_SYSV_ABI Func_E51D44DB8151238C(); int PS4_SYSV_ABI Func_E51D44DB8151238C();
int PS4_SYSV_ABI Func_F916890425496553(); int PS4_SYSV_ABI Func_F916890425496553();
void RegisterLib(Core::Loader::SymbolsResolver* sym); void RegisterlibSceGnmDriver(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::GnmDriver } // namespace Libraries::GnmDriver

View File

@ -939,7 +939,7 @@ s32 PS4_SYSV_ABI Func_FF2E0E53015FE231() {
return ORBIS_OK; return ORBIS_OK;
} }
void RegisterLib(Core::Loader::SymbolsResolver* sym) { void RegisterlibSceHmd(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("8gH1aLgty5I", "libsceHmdReprojectionMultilayer", 1, "libSceHmd", 1, 1, LIB_FUNCTION("8gH1aLgty5I", "libsceHmdReprojectionMultilayer", 1, "libSceHmd", 1, 1,
sceHmdReprojectionStartMultilayer); sceHmdReprojectionStartMultilayer);
LIB_FUNCTION("gEokC+OGI8g", "libSceHmdDistortion", 1, "libSceHmd", 1, 1, LIB_FUNCTION("gEokC+OGI8g", "libSceHmdDistortion", 1, "libSceHmd", 1, 1,

View File

@ -199,5 +199,5 @@ s32 PS4_SYSV_ABI Func_B9A6FA0735EC7E49();
s32 PS4_SYSV_ABI Func_FC193BD653F2AF2E(); s32 PS4_SYSV_ABI Func_FC193BD653F2AF2E();
s32 PS4_SYSV_ABI Func_FF2E0E53015FE231(); s32 PS4_SYSV_ABI Func_FF2E0E53015FE231();
void RegisterLib(Core::Loader::SymbolsResolver* sym); void RegisterlibSceHmd(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::Hmd } // namespace Libraries::Hmd

View File

@ -190,7 +190,7 @@ Status PS4_SYSV_ABI sceErrorDialogUpdateStatus() {
return g_status; return g_status;
} }
void RegisterLib(Core::Loader::SymbolsResolver* sym) { void RegisterlibSceErrorDialog(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("ekXHb1kDBl0", "libSceErrorDialog", 1, "libSceErrorDialog", 1, 1, LIB_FUNCTION("ekXHb1kDBl0", "libSceErrorDialog", 1, "libSceErrorDialog", 1, 1,
sceErrorDialogClose); sceErrorDialogClose);
LIB_FUNCTION("t2FvHRXzgqk", "libSceErrorDialog", 1, "libSceErrorDialog", 1, 1, LIB_FUNCTION("t2FvHRXzgqk", "libSceErrorDialog", 1, "libSceErrorDialog", 1, 1,

View File

@ -24,5 +24,5 @@ int PS4_SYSV_ABI sceErrorDialogOpenWithReport();
CommonDialog::Error PS4_SYSV_ABI sceErrorDialogTerminate(); CommonDialog::Error PS4_SYSV_ABI sceErrorDialogTerminate();
CommonDialog::Status PS4_SYSV_ABI sceErrorDialogUpdateStatus(); CommonDialog::Status PS4_SYSV_ABI sceErrorDialogUpdateStatus();
void RegisterLib(Core::Loader::SymbolsResolver* sym); void RegisterlibSceErrorDialog(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::ErrorDialog } // namespace Libraries::ErrorDialog

View File

@ -18,11 +18,9 @@ static ImeUi g_ime_ui;
class ImeHandler { class ImeHandler {
public: public:
ImeHandler(const OrbisImeKeyboardParam* param) { ImeHandler(const OrbisImeKeyboardParam* param) {
LOG_INFO(Lib_Ime, "Creating ImeHandler for keyboard");
Init(param, false); Init(param, false);
} }
ImeHandler(const OrbisImeParam* param) { ImeHandler(const OrbisImeParam* param) {
LOG_INFO(Lib_Ime, "Creating ImeHandler for IME");
Init(param, true); Init(param, true);
} }
~ImeHandler() = default; ~ImeHandler() = default;
@ -40,18 +38,13 @@ public:
openEvent.id = (ime_mode ? OrbisImeEventId::Open : OrbisImeEventId::KeyboardOpen); openEvent.id = (ime_mode ? OrbisImeEventId::Open : OrbisImeEventId::KeyboardOpen);
if (ime_mode) { if (ime_mode) {
LOG_INFO(Lib_Ime, "calling sceImeGetPanelSize"); sceImeGetPanelSize(&m_param.ime, &openEvent.param.rect.width,
Error e = sceImeGetPanelSize(&m_param.ime, &openEvent.param.rect.width, &openEvent.param.rect.height);
&openEvent.param.rect.height);
if (e != Error::OK) {
LOG_ERROR(Lib_Ime, "sceImeGetPanelSize returned 0x{:X}", static_cast<u32>(e));
}
openEvent.param.rect.x = m_param.ime.posx; openEvent.param.rect.x = m_param.ime.posx;
openEvent.param.rect.y = m_param.ime.posy; openEvent.param.rect.y = m_param.ime.posy;
} else { } else {
openEvent.param.resource_id_array.user_id = 1; openEvent.param.resource_id_array.userId = 1;
openEvent.param.resource_id_array.resource_id[0] = 1; openEvent.param.resource_id_array.resourceId[0] = 1;
} }
// Are we supposed to call the event handler on init with // Are we supposed to call the event handler on init with
@ -66,13 +59,13 @@ public:
} }
} }
Error Update(OrbisImeEventHandler handler) { s32 Update(OrbisImeEventHandler handler) {
if (!m_ime_mode) { if (!m_ime_mode) {
/* We don't handle any events for ImeKeyboard */ /* We don't handle any events for ImeKeyboard */
return Error::OK; return ORBIS_OK;
} }
std::unique_lock<std::mutex> lock{g_ime_state.queue_mutex}; std::unique_lock lock{g_ime_state.queue_mutex};
while (!g_ime_state.event_queue.empty()) { while (!g_ime_state.event_queue.empty()) {
OrbisImeEvent event = g_ime_state.event_queue.front(); OrbisImeEvent event = g_ime_state.event_queue.front();
@ -80,7 +73,7 @@ public:
Execute(handler, &event, false); Execute(handler, &event, false);
} }
return Error::OK; return ORBIS_OK;
} }
void Execute(OrbisImeEventHandler handler, OrbisImeEvent* event, bool use_param_handler) { void Execute(OrbisImeEventHandler handler, OrbisImeEvent* event, bool use_param_handler) {
@ -101,14 +94,14 @@ public:
} }
} }
Error SetText(const char16_t* text, u32 length) { s32 SetText(const char16_t* text, u32 length) {
g_ime_state.SetText(text, length); g_ime_state.SetText(text, length);
return Error::OK; return ORBIS_OK;
} }
Error SetCaret(const OrbisImeCaret* caret) { s32 SetCaret(const OrbisImeCaret* caret) {
g_ime_state.SetCaret(caret->index); g_ime_state.SetCaret(caret->index);
return Error::OK; return ORBIS_OK;
} }
bool IsIme() { bool IsIme() {
@ -151,24 +144,17 @@ int PS4_SYSV_ABI sceImeCheckUpdateTextInfo() {
return ORBIS_OK; return ORBIS_OK;
} }
Error PS4_SYSV_ABI sceImeClose() { s32 PS4_SYSV_ABI sceImeClose() {
LOG_INFO(Lib_Ime, "called"); LOG_INFO(Lib_Ime, "(STUBBED) called");
if (!g_ime_handler) { if (!g_ime_handler) {
LOG_ERROR(Lib_Ime, "No IME handler is open"); return ORBIS_IME_ERROR_NOT_OPENED;
return Error::NOT_OPENED;
} }
g_ime_handler.release(); g_ime_handler.release();
if (g_ime_handler) {
LOG_ERROR(Lib_Ime, "Failed to close IME handler, it is still open");
return Error::INTERNAL;
}
g_ime_ui = ImeUi(); g_ime_ui = ImeUi();
g_ime_state = ImeState(); g_ime_state = ImeState();
return ORBIS_OK;
LOG_INFO(Lib_Ime, "IME closed successfully");
return Error::OK;
} }
int PS4_SYSV_ABI sceImeConfigGet() { int PS4_SYSV_ABI sceImeConfigGet() {
@ -236,193 +222,71 @@ int PS4_SYSV_ABI sceImeGetPanelPositionAndForm() {
return ORBIS_OK; return ORBIS_OK;
} }
Error PS4_SYSV_ABI sceImeGetPanelSize(const OrbisImeParam* param, u32* width, u32* height) { s32 PS4_SYSV_ABI sceImeGetPanelSize(const OrbisImeParam* param, u32* width, u32* height) {
LOG_INFO(Lib_Ime, "sceImeGetPanelSize called"); LOG_INFO(Lib_Ime, "called");
if (!param) { if (!width || !height) {
LOG_ERROR(Lib_Ime, "Invalid param: NULL"); return ORBIS_IME_ERROR_INVALID_ADDRESS;
return Error::INVALID_ADDRESS;
}
if (!width) {
LOG_ERROR(Lib_Ime, "Invalid *width: NULL");
return Error::INVALID_ADDRESS;
}
if (!height) {
LOG_ERROR(Lib_Ime, "Invalid *height: NULL");
return Error::INVALID_ADDRESS;
}
if (static_cast<u32>(param->option) & ~0x7BFF) { // Basic check for invalid options
LOG_ERROR(Lib_Ime, "Invalid option: {:032b}", static_cast<u32>(param->option));
return Error::INVALID_OPTION;
} }
switch (param->type) { switch (param->type) {
case OrbisImeType::Default: case OrbisImeType::Default:
*width = 500; // dummy value
*height = 100; // dummy value
LOG_DEBUG(Lib_Ime, "param->type: Default ({})", static_cast<u32>(param->type));
break;
case OrbisImeType::BasicLatin: case OrbisImeType::BasicLatin:
*width = 500; // dummy value
*height = 100; // dummy value
LOG_DEBUG(Lib_Ime, "param->type: BasicLatin ({})", static_cast<u32>(param->type));
break;
case OrbisImeType::Url: case OrbisImeType::Url:
*width = 500; // dummy value
*height = 100; // dummy value
LOG_DEBUG(Lib_Ime, "param->type: Url ({})", static_cast<u32>(param->type));
break;
case OrbisImeType::Mail: case OrbisImeType::Mail:
// We set our custom sizes, commented sizes are the original ones // We set our custom sizes, commented sizes are the original ones
*width = 500; // 793 *width = 500; // 793
*height = 100; // 408 *height = 100; // 408
LOG_DEBUG(Lib_Ime, "param->type: Mail ({})", static_cast<u32>(param->type));
break; break;
case OrbisImeType::Number: case OrbisImeType::Number:
*width = 370; *width = 370;
*height = 402; *height = 402;
LOG_DEBUG(Lib_Ime, "param->type: Number ({})", static_cast<u32>(param->type));
break; break;
default:
LOG_ERROR(Lib_Ime, "Invalid param->type: ({})", static_cast<u32>(param->type));
return Error::INVALID_TYPE;
} }
LOG_INFO(Lib_Ime, "IME panel size: width={}, height={}", *width, *height); return ORBIS_OK;
return Error::OK;
} }
Error PS4_SYSV_ABI sceImeKeyboardClose(Libraries::UserService::OrbisUserServiceUserId userId) { s32 PS4_SYSV_ABI sceImeKeyboardClose(s32 userId) {
LOG_INFO(Lib_Ime, "called"); LOG_INFO(Lib_Ime, "(STUBBED) called");
if (!g_keyboard_handler) { if (!g_keyboard_handler) {
LOG_ERROR(Lib_Ime, "No keyboard handler is open"); return ORBIS_IME_ERROR_NOT_OPENED;
return Error::NOT_OPENED;
}
// TODO: Check for valid user IDs. Disabled until user manager is ready.
if ((userId < 0 || userId > 4) && false) {
// Maybe g_keyboard_handler should hold a user ID and I must compare it here?
LOG_ERROR(Lib_Ime, "Invalid userId: {}", userId);
return Error::INVALID_USER_ID;
} }
g_keyboard_handler.release(); g_keyboard_handler.release();
if (g_keyboard_handler) { return ORBIS_OK;
LOG_ERROR(Lib_Ime, "failed to close keyboard handler, it is still open");
return Error::INTERNAL;
}
LOG_INFO(Lib_Ime, "Keyboard handler closed successfully for user ID: {}", userId);
return Error::OK;
} }
int PS4_SYSV_ABI sceImeKeyboardGetInfo() { int PS4_SYSV_ABI sceImeKeyboardGetInfo() {
LOG_ERROR(Lib_Ime, "(STUBBED) called"); LOG_ERROR(Lib_Ime, "(STUBBED) called");
return ORBIS_OK; return ORBIS_OK;
} }
Error PS4_SYSV_ABI
sceImeKeyboardGetResourceId(Libraries::UserService::OrbisUserServiceUserId userId,
OrbisImeKeyboardResourceIdArray* resourceIdArray) {
LOG_INFO(Lib_Ime, "(partial) called");
if (!resourceIdArray) { int PS4_SYSV_ABI sceImeKeyboardGetResourceId() {
LOG_ERROR(Lib_Ime, "Invalid resourceIdArray: NULL"); LOG_ERROR(Lib_Ime, "(STUBBED) called");
return Error::INVALID_ADDRESS; return ORBIS_OK;
}
// TODO: Check for valid user IDs. Disabled until user manager is ready.
if ((userId < 0 || userId > 4) && false) {
LOG_ERROR(Lib_Ime, "Invalid userId: {}", userId);
resourceIdArray->user_id = userId;
for (u32& id : resourceIdArray->resource_id) {
id = 0;
}
return Error::INVALID_USER_ID;
}
if (!g_keyboard_handler) {
LOG_ERROR(Lib_Ime, "Keyboard handler not opened");
resourceIdArray->user_id = userId;
for (u32& id : resourceIdArray->resource_id) {
id = 0;
}
return Error::NOT_OPENED;
}
// Simulate "no USB keyboard connected", needed for some Unity engine games
resourceIdArray->user_id = userId;
for (u32& id : resourceIdArray->resource_id) {
id = 0;
}
LOG_INFO(Lib_Ime, "No USB keyboard connected (simulated)");
return Error::CONNECTION_FAILED;
// For future reference, if we had a real keyboard handler
return Error::OK;
} }
Error PS4_SYSV_ABI sceImeKeyboardOpen(Libraries::UserService::OrbisUserServiceUserId userId, s32 PS4_SYSV_ABI sceImeKeyboardOpen(s32 userId, const OrbisImeKeyboardParam* param) {
const OrbisImeKeyboardParam* param) {
LOG_INFO(Lib_Ime, "called"); LOG_INFO(Lib_Ime, "called");
if (!param) { if (!param) {
LOG_ERROR(Lib_Ime, "Invalid param: NULL"); return ORBIS_IME_ERROR_INVALID_ADDRESS;
return Error::INVALID_ADDRESS; }
if (!param->arg) {
return ORBIS_IME_ERROR_INVALID_ARG;
} }
if (!param->handler) { if (!param->handler) {
LOG_ERROR(Lib_Ime, "Invalid param->handler: NULL"); return ORBIS_IME_ERROR_INVALID_HANDLER;
return Error::INVALID_HANDLER;
}
// seems like arg is optional, need to check if it is used in the handler
// Todo: check if arg is used in the handler, temporarily disabled
if (!param->arg && false) {
LOG_ERROR(Lib_Ime, "Invalid param->arg: NULL");
return Error::INVALID_ARG;
}
if (static_cast<u32>(param->option) & ~kValidOrbisImeKeyboardOptionMask) {
LOG_ERROR(Lib_Ime,
"Invalid param->option\n"
"option: {:032b}\n"
"validMask: {:032b}",
static_cast<u32>(param->option), kValidOrbisImeKeyboardOptionMask);
return Error::INVALID_OPTION;
} }
// TODO: Check for valid user IDs. Disabled until user manager is ready.
if ((userId < 0 || userId > 4) && false) {
LOG_ERROR(Lib_Ime, "Invalid userId: {}", userId);
return Error::INVALID_USER_ID;
}
for (size_t i = 0; i < sizeof(param->reserved1); ++i) {
if (param->reserved1[i] != 0) {
LOG_ERROR(Lib_Ime, "Invalid reserved1: not zeroed");
return Error::INVALID_RESERVED;
}
}
for (size_t i = 0; i < sizeof(param->reserved2); ++i) {
if (param->reserved2[i] != 0) {
LOG_ERROR(Lib_Ime, "Invalid reserved2: not zeroed");
return Error::INVALID_RESERVED;
}
}
// Todo: figure out what it is, always false for now
if (false) {
LOG_ERROR(Lib_Ime, "USB keyboard some special kind of failure");
return Error::CONNECTION_FAILED;
}
if (g_keyboard_handler) { if (g_keyboard_handler) {
LOG_ERROR(Lib_Ime, "Keyboard handler is already open"); return ORBIS_IME_ERROR_BUSY;
return Error::BUSY;
} }
g_keyboard_handler = std::make_unique<ImeHandler>(param); g_keyboard_handler = std::make_unique<ImeHandler>(param);
if (!g_keyboard_handler) { return ORBIS_OK;
LOG_ERROR(Lib_Ime, "Failed to create keyboard handler");
return Error::INTERNAL; // or Error::NO_MEMORY;
}
LOG_INFO(Lib_Ime, "Keyboard handler created successfully for user ID: {}", userId);
return Error::OK;
} }
int PS4_SYSV_ABI sceImeKeyboardOpenInternal() { int PS4_SYSV_ABI sceImeKeyboardOpenInternal() {
@ -440,190 +304,18 @@ int PS4_SYSV_ABI sceImeKeyboardUpdate() {
return ORBIS_OK; return ORBIS_OK;
} }
Error PS4_SYSV_ABI sceImeOpen(const OrbisImeParam* param, const OrbisImeParamExtended* extended) { s32 PS4_SYSV_ABI sceImeOpen(const OrbisImeParam* param, const void* extended) {
LOG_INFO(Lib_Ime, "called"); LOG_INFO(Lib_Ime, "called");
if (!param) { if (!param) {
LOG_ERROR(Lib_Ime, "Invalid param: NULL"); return ORBIS_IME_ERROR_INVALID_ADDRESS;
return Error::INVALID_ADDRESS;
} else {
// LOG_DEBUG values for debugging purposes
LOG_DEBUG(Lib_Ime, "param->user_id: {}", param->user_id);
LOG_DEBUG(Lib_Ime, "param->type: {}", static_cast<u32>(param->type));
LOG_DEBUG(Lib_Ime, "param->supported_languages: {:064b}",
static_cast<u64>(param->supported_languages));
LOG_DEBUG(Lib_Ime, "param->enter_label: {}", static_cast<u32>(param->enter_label));
LOG_DEBUG(Lib_Ime, "param->input_method: {}", static_cast<u32>(param->input_method));
LOG_DEBUG(Lib_Ime, "param->filter: {:p}", reinterpret_cast<void*>(param->filter));
LOG_DEBUG(Lib_Ime, "param->option: {:032b}", static_cast<u32>(param->option));
LOG_DEBUG(Lib_Ime, "param->maxTextLength: {}", param->maxTextLength);
LOG_DEBUG(Lib_Ime, "param->inputTextBuffer: {:p}",
static_cast<const void*>(param->inputTextBuffer));
LOG_DEBUG(Lib_Ime, "param->posx: {}", param->posx);
LOG_DEBUG(Lib_Ime, "param->posy: {}", param->posy);
LOG_DEBUG(Lib_Ime, "param->horizontal_alignment: {}",
static_cast<u32>(param->horizontal_alignment));
LOG_DEBUG(Lib_Ime, "param->vertical_alignment: {}",
static_cast<u32>(param->vertical_alignment));
LOG_DEBUG(Lib_Ime, "param->work: {:p}", param->work);
LOG_DEBUG(Lib_Ime, "param->arg: {:p}", param->arg);
LOG_DEBUG(Lib_Ime, "param->handler: {:p}", reinterpret_cast<void*>(param->handler));
} }
if (!extended) {
LOG_INFO(Lib_Ime, "Not used extended: NULL");
} else {
LOG_DEBUG(Lib_Ime, "extended->option: {:032b}", static_cast<u32>(extended->option));
LOG_DEBUG(Lib_Ime, "extended->color_base: {{{},{},{},{}}}", extended->color_base.r,
extended->color_base.g, extended->color_base.b, extended->color_base.a);
LOG_DEBUG(Lib_Ime, "extended->color_line: {{{},{},{},{}}}", extended->color_line.r,
extended->color_line.g, extended->color_line.b, extended->color_line.a);
LOG_DEBUG(Lib_Ime, "extended->color_text_field: {{{},{},{},{}}}",
extended->color_text_field.r, extended->color_text_field.g,
extended->color_text_field.b, extended->color_text_field.a);
LOG_DEBUG(Lib_Ime, "extended->color_preedit: {{{},{},{},{}}}", extended->color_preedit.r,
extended->color_preedit.g, extended->color_preedit.b, extended->color_preedit.a);
LOG_DEBUG(Lib_Ime, "extended->color_button_default: {{{},{},{},{}}}",
extended->color_button_default.r, extended->color_button_default.g,
extended->color_button_default.b, extended->color_button_default.a);
LOG_DEBUG(Lib_Ime, "extended->color_button_function: {{{},{},{},{}}}",
extended->color_button_function.r, extended->color_button_function.g,
extended->color_button_function.b, extended->color_button_function.a);
LOG_DEBUG(Lib_Ime, "extended->color_button_symbol: {{{},{},{},{}}}",
extended->color_button_symbol.r, extended->color_button_symbol.g,
extended->color_button_symbol.b, extended->color_button_symbol.a);
LOG_DEBUG(Lib_Ime, "extended->color_text: {{{},{},{},{}}}", extended->color_text.r,
extended->color_text.g, extended->color_text.b, extended->color_text.a);
LOG_DEBUG(Lib_Ime, "extended->color_special: {{{},{},{},{}}}", extended->color_special.r,
extended->color_special.g, extended->color_special.b, extended->color_special.a);
LOG_DEBUG(Lib_Ime, "extended->priority: {}", static_cast<u32>(extended->priority));
LOG_DEBUG(Lib_Ime, "extended->additional_dictionary_path: {:p}",
static_cast<const void*>(extended->additional_dictionary_path));
LOG_DEBUG(Lib_Ime, "extended->ext_keyboard_filter: {:p}",
reinterpret_cast<void*>(extended->ext_keyboard_filter));
LOG_DEBUG(Lib_Ime, "extended->disable_device: {:032b}",
static_cast<u32>(extended->disable_device));
LOG_DEBUG(Lib_Ime, "extended->ext_keyboard_mode: {}", extended->ext_keyboard_mode);
}
if (param->user_id < 1 || param->user_id > 4) { // Todo: check valid user IDs
LOG_ERROR(Lib_Ime, "Invalid user_id: {}", static_cast<u32>(param->user_id));
return Error::INVALID_USER_ID;
}
if (!magic_enum::enum_contains(param->type)) {
LOG_ERROR(Lib_Ime, "Invalid type: {}", static_cast<u32>(param->type));
return Error::INVALID_TYPE;
}
if (static_cast<u64>(param->supported_languages) & ~kValidOrbisImeLanguageMask) {
LOG_ERROR(Lib_Ime,
"Invalid supported_languages\n"
"supported_languages: {:064b}\n"
"valid_mask: {:064b}",
static_cast<u64>(param->supported_languages), kValidOrbisImeLanguageMask);
return Error::INVALID_SUPPORTED_LANGUAGES;
}
if (!magic_enum::enum_contains(param->enter_label)) {
LOG_ERROR(Lib_Ime, "Invalid enter_label: {}", static_cast<u32>(param->enter_label));
return Error::INVALID_ENTER_LABEL;
}
if (!magic_enum::enum_contains(param->input_method)) {
LOG_ERROR(Lib_Ime, "Invalid input_method: {}", static_cast<u32>(param->input_method));
return Error::INVALID_INPUT_METHOD;
}
if (static_cast<u32>(param->option) & ~kValidImeOptionMask) {
LOG_ERROR(Lib_Ime, "option has invalid bits set (0x{:X}), mask=(0x{:X})",
static_cast<u32>(param->option), kValidImeOptionMask);
return Error::INVALID_OPTION;
}
if (param->maxTextLength == 0 || param->maxTextLength > ORBIS_IME_DIALOG_MAX_TEXT_LENGTH) {
LOG_ERROR(Lib_Ime, "Invalid maxTextLength: {}", param->maxTextLength);
return Error::INVALID_MAX_TEXT_LENGTH;
}
if (!param->inputTextBuffer) {
LOG_ERROR(Lib_Ime, "Invalid inputTextBuffer: NULL");
return Error::INVALID_INPUT_TEXT_BUFFER;
}
bool useHighRes = True(param->option & OrbisImeOption::USE_OVER_2K_COORDINATES);
const float maxWidth = useHighRes ? 3840.0f : 1920.0f;
const float maxHeight = useHighRes ? 2160.0f : 1080.0f;
if (param->posx < 0.0f || param->posx >= maxWidth) {
LOG_ERROR(Lib_Ime, "Invalid posx: {}, range: 0.0 - {}", param->posx, maxWidth);
return Error::INVALID_POSX;
}
if (param->posy < 0.0f || param->posy >= maxHeight) {
LOG_ERROR(Lib_Ime, "Invalid posy: {}, range: 0.0 - {}", param->posy, maxHeight);
return Error::INVALID_POSY;
}
if (!magic_enum::enum_contains(param->horizontal_alignment)) {
LOG_ERROR(Lib_Ime, "Invalid horizontal_alignment: {}",
static_cast<u32>(param->horizontal_alignment));
return Error::INVALID_HORIZONTALIGNMENT;
}
if (!magic_enum::enum_contains(param->vertical_alignment)) {
LOG_ERROR(Lib_Ime, "Invalid vertical_alignment: {}",
static_cast<u32>(param->vertical_alignment));
return Error::INVALID_VERTICALALIGNMENT;
}
if (extended) {
u32 ext_option_value = static_cast<u32>(extended->option);
if (ext_option_value & ~kValidImeExtOptionMask) {
LOG_ERROR(Lib_Ime,
"Invalid extended->option\n"
"option: {:032b}\n"
"valid_mask: {:032b}",
ext_option_value, kValidImeExtOptionMask);
return Error::INVALID_EXTENDED;
}
}
if (!param->work) {
LOG_ERROR(Lib_Ime, "Invalid work: NULL");
return Error::INVALID_WORK;
}
// Todo: validate arg
if (false) {
LOG_ERROR(Lib_Ime, "Invalid arg: NULL");
return Error::INVALID_ARG;
}
// Todo: validate handler
if (false) {
LOG_ERROR(Lib_Ime, "Invalid handler: NULL");
return Error::INVALID_HANDLER;
}
for (size_t i = 0; i < sizeof(param->reserved); ++i) {
if (param->reserved[i] != 0) {
LOG_ERROR(Lib_Ime, "Invalid reserved: not zeroed");
return Error::INVALID_RESERVED;
}
}
if (g_ime_handler) { if (g_ime_handler) {
LOG_ERROR(Lib_Ime, "IME handler is already open"); return ORBIS_IME_ERROR_BUSY;
return Error::BUSY;
} }
g_ime_handler = std::make_unique<ImeHandler>(param); g_ime_handler = std::make_unique<ImeHandler>(param);
if (!g_ime_handler) { return ORBIS_OK;
LOG_ERROR(Lib_Ime, "Failed to create IME handler");
return Error::NO_MEMORY; // or Error::INTERNAL
}
LOG_INFO(Lib_Ime, "IME handler created successfully");
return Error::OK;
} }
int PS4_SYSV_ABI sceImeOpenInternal() { int PS4_SYSV_ABI sceImeOpenInternal() {
@ -632,7 +324,7 @@ int PS4_SYSV_ABI sceImeOpenInternal() {
} }
void PS4_SYSV_ABI sceImeParamInit(OrbisImeParam* param) { void PS4_SYSV_ABI sceImeParamInit(OrbisImeParam* param) {
LOG_INFO(Lib_Ime, "sceImeParamInit called"); LOG_INFO(Lib_Ime, "called");
if (!param) { if (!param) {
return; return;
@ -647,27 +339,27 @@ int PS4_SYSV_ABI sceImeSetCandidateIndex() {
return ORBIS_OK; return ORBIS_OK;
} }
Error PS4_SYSV_ABI sceImeSetCaret(const OrbisImeCaret* caret) { int PS4_SYSV_ABI sceImeSetCaret(const OrbisImeCaret* caret) {
LOG_TRACE(Lib_Ime, "called"); LOG_TRACE(Lib_Ime, "called");
if (!g_ime_handler) { if (!g_ime_handler) {
return Error::NOT_OPENED; return ORBIS_IME_ERROR_NOT_OPENED;
} }
if (!caret) { if (!caret) {
return Error::INVALID_ADDRESS; return ORBIS_IME_ERROR_INVALID_ADDRESS;
} }
return g_ime_handler->SetCaret(caret); return g_ime_handler->SetCaret(caret);
} }
Error PS4_SYSV_ABI sceImeSetText(const char16_t* text, u32 length) { s32 PS4_SYSV_ABI sceImeSetText(const char16_t* text, u32 length) {
LOG_TRACE(Lib_Ime, "called"); LOG_TRACE(Lib_Ime, "called");
if (!g_ime_handler) { if (!g_ime_handler) {
return Error::NOT_OPENED; return ORBIS_IME_ERROR_NOT_OPENED;
} }
if (!text) { if (!text) {
return Error::INVALID_ADDRESS; return ORBIS_IME_ERROR_INVALID_ADDRESS;
} }
return g_ime_handler->SetText(text, length); return g_ime_handler->SetText(text, length);
@ -678,7 +370,7 @@ int PS4_SYSV_ABI sceImeSetTextGeometry() {
return ORBIS_OK; return ORBIS_OK;
} }
Error PS4_SYSV_ABI sceImeUpdate(OrbisImeEventHandler handler) { s32 PS4_SYSV_ABI sceImeUpdate(OrbisImeEventHandler handler) {
if (g_ime_handler) { if (g_ime_handler) {
g_ime_handler->Update(handler); g_ime_handler->Update(handler);
} }
@ -688,10 +380,10 @@ Error PS4_SYSV_ABI sceImeUpdate(OrbisImeEventHandler handler) {
} }
if (!g_ime_handler || !g_keyboard_handler) { if (!g_ime_handler || !g_keyboard_handler) {
return Error::NOT_OPENED; return ORBIS_IME_ERROR_NOT_OPENED;
} }
return Error::OK; return ORBIS_OK;
} }
int PS4_SYSV_ABI sceImeVshClearPreedit() { int PS4_SYSV_ABI sceImeVshClearPreedit() {
@ -789,7 +481,7 @@ int PS4_SYSV_ABI sceImeVshUpdateContext2() {
return ORBIS_OK; return ORBIS_OK;
} }
void RegisterLib(Core::Loader::SymbolsResolver* sym) { void RegisterlibSceIme(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("mN+ZoSN-8hQ", "libSceIme", 1, "libSceIme", 1, 1, FinalizeImeModule); LIB_FUNCTION("mN+ZoSN-8hQ", "libSceIme", 1, "libSceIme", 1, 1, FinalizeImeModule);
LIB_FUNCTION("uTW+63goeJs", "libSceIme", 1, "libSceIme", 1, 1, InitializeImeModule); LIB_FUNCTION("uTW+63goeJs", "libSceIme", 1, "libSceIme", 1, 1, InitializeImeModule);
LIB_FUNCTION("Lf3DeGWC6xg", "libSceIme", 1, "libSceIme", 1, 1, sceImeCheckFilterText); LIB_FUNCTION("Lf3DeGWC6xg", "libSceIme", 1, "libSceIme", 1, 1, sceImeCheckFilterText);

View File

@ -13,12 +13,78 @@ class SymbolsResolver;
namespace Libraries::Ime { namespace Libraries::Ime {
constexpr u32 ORBIS_IME_MAX_TEXT_LENGTH = 2048;
enum class OrbisImeKeyboardOption : u32 {
Default = 0,
Repeat = 1,
RepeatEachKey = 2,
AddOsk = 4,
EffectiveWithIme = 8,
DisableResume = 16,
DisableCapslockWithoutShift = 32,
};
DECLARE_ENUM_FLAG_OPERATORS(OrbisImeKeyboardOption)
enum class OrbisImeOption : u32 {
DEFAULT = 0,
MULTILINE = 1,
NO_AUTO_CAPITALIZATION = 2,
PASSWORD = 4,
LANGUAGES_FORCED = 8,
EXT_KEYBOARD = 16,
NO_LEARNING = 32,
FIXED_POSITION = 64,
DISABLE_RESUME = 256,
DISABLE_AUTO_SPACE = 512,
DISABLE_POSITION_ADJUSTMENT = 2048,
EXPANDED_PREEDIT_BUFFER = 4096,
USE_JAPANESE_EISUU_KEY_AS_CAPSLOCK = 8192,
USE_2K_COORDINATES = 16384,
};
DECLARE_ENUM_FLAG_OPERATORS(OrbisImeOption)
struct OrbisImeKeyboardParam {
OrbisImeKeyboardOption option;
s8 reserved1[4];
void* arg;
OrbisImeEventHandler handler;
s8 reserved2[8];
};
struct OrbisImeParam {
s32 user_id;
OrbisImeType type;
u64 supported_languages;
OrbisImeEnterLabel enter_label;
OrbisImeInputMethod input_method;
OrbisImeTextFilter filter;
OrbisImeOption option;
u32 maxTextLength;
char16_t* inputTextBuffer;
float posx;
float posy;
OrbisImeHorizontalAlignment horizontal_alignment;
OrbisImeVerticalAlignment vertical_alignment;
void* work;
void* arg;
OrbisImeEventHandler handler;
s8 reserved[8];
};
struct OrbisImeCaret {
f32 x;
f32 y;
u32 height;
u32 index;
};
int PS4_SYSV_ABI FinalizeImeModule(); int PS4_SYSV_ABI FinalizeImeModule();
int PS4_SYSV_ABI InitializeImeModule(); int PS4_SYSV_ABI InitializeImeModule();
int PS4_SYSV_ABI sceImeCheckFilterText(); int PS4_SYSV_ABI sceImeCheckFilterText();
int PS4_SYSV_ABI sceImeCheckRemoteEventParam(); int PS4_SYSV_ABI sceImeCheckRemoteEventParam();
int PS4_SYSV_ABI sceImeCheckUpdateTextInfo(); int PS4_SYSV_ABI sceImeCheckUpdateTextInfo();
Error PS4_SYSV_ABI sceImeClose(); int PS4_SYSV_ABI sceImeClose();
int PS4_SYSV_ABI sceImeConfigGet(); int PS4_SYSV_ABI sceImeConfigGet();
int PS4_SYSV_ABI sceImeConfigSet(); int PS4_SYSV_ABI sceImeConfigSet();
int PS4_SYSV_ABI sceImeConfirmCandidate(); int PS4_SYSV_ABI sceImeConfirmCandidate();
@ -32,25 +98,22 @@ int PS4_SYSV_ABI sceImeDisableController();
int PS4_SYSV_ABI sceImeFilterText(); int PS4_SYSV_ABI sceImeFilterText();
int PS4_SYSV_ABI sceImeForTestFunction(); int PS4_SYSV_ABI sceImeForTestFunction();
int PS4_SYSV_ABI sceImeGetPanelPositionAndForm(); int PS4_SYSV_ABI sceImeGetPanelPositionAndForm();
Error PS4_SYSV_ABI sceImeGetPanelSize(const OrbisImeParam* param, u32* width, u32* height); s32 PS4_SYSV_ABI sceImeGetPanelSize(const OrbisImeParam* param, u32* width, u32* height);
Error PS4_SYSV_ABI sceImeKeyboardClose(Libraries::UserService::OrbisUserServiceUserId userId); s32 PS4_SYSV_ABI sceImeKeyboardClose(s32 userId);
int PS4_SYSV_ABI sceImeKeyboardGetInfo(); int PS4_SYSV_ABI sceImeKeyboardGetInfo();
Error PS4_SYSV_ABI int PS4_SYSV_ABI sceImeKeyboardGetResourceId();
sceImeKeyboardGetResourceId(Libraries::UserService::OrbisUserServiceUserId userId, s32 PS4_SYSV_ABI sceImeKeyboardOpen(s32 userId, const OrbisImeKeyboardParam* param);
OrbisImeKeyboardResourceIdArray* resourceIdArray);
Error PS4_SYSV_ABI sceImeKeyboardOpen(Libraries::UserService::OrbisUserServiceUserId userId,
const OrbisImeKeyboardParam* param);
int PS4_SYSV_ABI sceImeKeyboardOpenInternal(); int PS4_SYSV_ABI sceImeKeyboardOpenInternal();
int PS4_SYSV_ABI sceImeKeyboardSetMode(); int PS4_SYSV_ABI sceImeKeyboardSetMode();
int PS4_SYSV_ABI sceImeKeyboardUpdate(); int PS4_SYSV_ABI sceImeKeyboardUpdate();
Error PS4_SYSV_ABI sceImeOpen(const OrbisImeParam* param, const OrbisImeParamExtended* extended); s32 PS4_SYSV_ABI sceImeOpen(const OrbisImeParam* param, const void* extended);
int PS4_SYSV_ABI sceImeOpenInternal(); int PS4_SYSV_ABI sceImeOpenInternal();
void PS4_SYSV_ABI sceImeParamInit(OrbisImeParam* param); void PS4_SYSV_ABI sceImeParamInit(OrbisImeParam* param);
int PS4_SYSV_ABI sceImeSetCandidateIndex(); int PS4_SYSV_ABI sceImeSetCandidateIndex();
Error PS4_SYSV_ABI sceImeSetCaret(const OrbisImeCaret* caret); s32 PS4_SYSV_ABI sceImeSetCaret(const OrbisImeCaret* caret);
Error PS4_SYSV_ABI sceImeSetText(const char16_t* text, u32 length); s32 PS4_SYSV_ABI sceImeSetText(const char16_t* text, u32 length);
int PS4_SYSV_ABI sceImeSetTextGeometry(); int PS4_SYSV_ABI sceImeSetTextGeometry();
Error PS4_SYSV_ABI sceImeUpdate(OrbisImeEventHandler handler); s32 PS4_SYSV_ABI sceImeUpdate(OrbisImeEventHandler handler);
int PS4_SYSV_ABI sceImeVshClearPreedit(); int PS4_SYSV_ABI sceImeVshClearPreedit();
int PS4_SYSV_ABI sceImeVshClose(); int PS4_SYSV_ABI sceImeVshClose();
int PS4_SYSV_ABI sceImeVshConfirmPreedit(); int PS4_SYSV_ABI sceImeVshConfirmPreedit();
@ -71,6 +134,6 @@ int PS4_SYSV_ABI sceImeVshUpdate();
int PS4_SYSV_ABI sceImeVshUpdateContext(); int PS4_SYSV_ABI sceImeVshUpdateContext();
int PS4_SYSV_ABI sceImeVshUpdateContext2(); int PS4_SYSV_ABI sceImeVshUpdateContext2();
void RegisterLib(Core::Loader::SymbolsResolver* sym); void RegisterlibSceIme(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::Ime } // namespace Libraries::Ime

View File

@ -3,273 +3,9 @@
#pragma once #pragma once
#include <core/libraries/system/userservice.h>
#include <magic_enum/magic_enum.hpp>
#include "common/enum.h"
#include "common/types.h" #include "common/types.h"
#include "core/libraries/rtc/rtc.h" #include "core/libraries/rtc/rtc.h"
constexpr u32 ORBIS_IME_MAX_TEXT_LENGTH = 2048;
constexpr u32 ORBIS_IME_DIALOG_MAX_TEXT_LENGTH = 2048;
template <typename E>
const std::underlying_type_t<E> generate_full_mask() {
static_assert(std::is_enum_v<E>, "E must be an enum type.");
static_assert(magic_enum::customize::enum_range<E>::is_flags,
"E must be marked as is_flags = true.");
using U = std::underlying_type_t<E>;
const auto values = magic_enum::enum_values<E>();
U mask = 0;
// Use index-based loop for better constexpr compatibility
for (std::size_t i = 0; i < values.size(); ++i) {
mask |= static_cast<U>(values[i]);
}
return mask;
}
enum class Error : u32 {
OK = 0x0,
// ImeDialog library
BUSY = 0x80bc0001,
NOT_OPENED = 0x80bc0002,
NO_MEMORY = 0x80bc0003,
CONNECTION_FAILED = 0x80bc0004,
TOO_MANY_REQUESTS = 0x80bc0005,
INVALID_TEXT = 0x80bc0006,
EVENT_OVERFLOW = 0x80bc0007,
NOT_ACTIVE = 0x80bc0008,
IME_SUSPENDING = 0x80bc0009,
DEVICE_IN_USE = 0x80bc000a,
INVALID_USER_ID = 0x80bc0010,
INVALID_TYPE = 0x80bc0011,
INVALID_SUPPORTED_LANGUAGES = 0x80bc0012,
INVALID_ENTER_LABEL = 0x80bc0013,
INVALID_INPUT_METHOD = 0x80bc0014,
INVALID_OPTION = 0x80bc0015,
INVALID_MAX_TEXT_LENGTH = 0x80bc0016,
INVALID_INPUT_TEXT_BUFFER = 0x80bc0017,
INVALID_POSX = 0x80bc0018,
INVALID_POSY = 0x80bc0019,
INVALID_HORIZONTALIGNMENT = 0x80bc001a,
INVALID_VERTICALALIGNMENT = 0x80bc001b,
INVALID_EXTENDED = 0x80bc001c,
INVALID_KEYBOARD_TYPE = 0x80bc001d,
INVALID_WORK = 0x80bc0020,
INVALID_ARG = 0x80bc0021,
INVALID_HANDLER = 0x80bc0022,
NO_RESOURCE_ID = 0x80bc0023,
INVALID_MODE = 0x80bc0024,
INVALID_PARAM = 0x80bc0030,
INVALID_ADDRESS = 0x80bc0031,
INVALID_RESERVED = 0x80bc0032,
INVALID_TIMING = 0x80bc0033,
INTERNAL = 0x80bc00ff,
// Ime library
DIALOG_INVALID_TITLE = 0x80bc0101,
DIALOG_NOT_RUNNING = 0x80bc0105,
DIALOG_NOT_FINISHED = 0x80bc0106,
DIALOG_NOT_IN_USE = 0x80bc0107
};
enum class OrbisImeOption : u32 {
DEFAULT = 0,
MULTILINE = 1,
NO_AUTO_CAPITALIZATION = 2,
PASSWORD = 4,
LANGUAGES_FORCED = 8,
EXT_KEYBOARD = 16,
NO_LEARNING = 32,
FIXED_POSITION = 64,
DISABLE_COPY_PASTE = 128,
DISABLE_RESUME = 256,
DISABLE_AUTO_SPACE = 512,
DISABLE_POSITION_ADJUSTMENT = 2048,
EXPANDED_PREEDIT_BUFFER = 4096,
USE_JAPANESE_EISUU_KEY_AS_CAPSLOCK = 8192,
USE_OVER_2K_COORDINATES = 16384,
};
DECLARE_ENUM_FLAG_OPERATORS(OrbisImeOption);
template <>
struct magic_enum::customize::enum_range<OrbisImeOption> {
static constexpr bool is_flags = true;
};
const u32 kValidImeOptionMask = generate_full_mask<OrbisImeOption>();
enum class OrbisImeExtOption : u32 {
DEFAULT = 0x00000000,
SET_PRIORITY = 0x00000002,
PRIORITY_FULL_WIDTH = 0x00000008,
PRIORITY_FIXED_PANEL = 0x00000010,
DISABLE_POINTER = 0x00000040,
ENABLE_ADDITIONAL_DICTIONARY = 0x00000080,
DISABLE_STARTUP_SE = 0x00000100,
DISABLE_LIST_FOR_EXT_KEYBOARD = 0x00000200,
HIDE_KEYPANEL_IF_EXT_KEYBOARD = 0x00000400,
INIT_EXT_KEYBOARD_MODE = 0x00000800,
ENABLE_ACCESSIBILITY = 0x00001000, // ImeDialog unly
ADDITIONAL_DICTIONARY_PRIORITY_MODE = 0x00004000, // ImeDialog only
};
DECLARE_ENUM_FLAG_OPERATORS(OrbisImeExtOption);
constexpr u32 kValidImeExtOptionMask = static_cast<u32>(
OrbisImeExtOption::SET_PRIORITY | OrbisImeExtOption::PRIORITY_FULL_WIDTH |
OrbisImeExtOption::PRIORITY_FIXED_PANEL | OrbisImeExtOption::DISABLE_POINTER |
OrbisImeExtOption::ENABLE_ADDITIONAL_DICTIONARY | OrbisImeExtOption::DISABLE_STARTUP_SE |
OrbisImeExtOption::DISABLE_LIST_FOR_EXT_KEYBOARD |
OrbisImeExtOption::HIDE_KEYPANEL_IF_EXT_KEYBOARD | OrbisImeExtOption::INIT_EXT_KEYBOARD_MODE);
template <>
struct magic_enum::customize::enum_range<OrbisImeExtOption> {
static constexpr bool is_flags = true;
};
const u32 kValidImeDialogExtOptionMask = generate_full_mask<OrbisImeExtOption>();
enum class OrbisImeLanguage : u64 {
DANISH = 0x0000000000000001,
GERMAN = 0x0000000000000002,
ENGLISH_US = 0x0000000000000004,
SPANISH = 0x0000000000000008,
FRENCH = 0x0000000000000010,
ITALIAN = 0x0000000000000020,
DUTCH = 0x0000000000000040,
NORWEGIAN = 0x0000000000000080,
POLISH = 0x0000000000000100,
PORTUGUESE_PT = 0x0000000000000200,
RUSSIAN = 0x0000000000000400,
FINNISH = 0x0000000000000800,
SWEDISH = 0x0000000000001000,
JAPANESE = 0x0000000000002000,
KOREAN = 0x0000000000004000,
SIMPLIFIED_CHINESE = 0x0000000000008000,
TRADITIONAL_CHINESE = 0x0000000000010000,
PORTUGUESE_BR = 0x0000000000020000,
ENGLISH_GB = 0x0000000000040000,
TURKISH = 0x0000000000080000,
SPANISH_LA = 0x0000000000100000,
ARABIC = 0x0000000001000000,
FRENCH_CA = 0x0000000002000000,
THAI = 0x0000000004000000,
CZECH = 0x0000000008000000,
GREEK = 0x0000000010000000,
INDONESIAN = 0x0000000020000000,
VIETNAMESE = 0x0000000040000000,
ROMANIAN = 0x0000000080000000,
HUNGARIAN = 0x0000000100000000,
};
DECLARE_ENUM_FLAG_OPERATORS(OrbisImeLanguage);
template <>
struct magic_enum::customize::enum_range<OrbisImeLanguage> {
static constexpr bool is_flags = true;
};
const u64 kValidOrbisImeLanguageMask = generate_full_mask<OrbisImeLanguage>();
enum class OrbisImeDisableDevice : u32 {
DEFAULT = 0x00000000,
CONTROLLER = 0x00000001,
EXT_KEYBOARD = 0x00000002,
REMOTE_OSK = 0x00000004,
};
DECLARE_ENUM_FLAG_OPERATORS(OrbisImeDisableDevice);
template <>
struct magic_enum::customize::enum_range<OrbisImeDisableDevice> {
static constexpr bool is_flags = true;
};
const u32 kValidOrbisImeDisableDeviceMask = generate_full_mask<OrbisImeDisableDevice>();
enum class OrbisImeInputMethodState : u32 {
PREEDIT = 0x01000000,
SELECTED = 0x02000000,
NATIVE = 0x04000000,
NATIVE2 = 0x08000000,
FULL_WIDTH = 0x10000000,
};
DECLARE_ENUM_FLAG_OPERATORS(OrbisImeInputMethodState);
template <>
struct magic_enum::customize::enum_range<OrbisImeInputMethodState> {
static constexpr bool is_flags = true;
};
const u32 kValidOrbisImeInputMethodStateMask = generate_full_mask<OrbisImeInputMethodState>();
enum class OrbisImeInitExtKeyboardMode : u32 {
ISABLE_ARABIC_INDIC_NUMERALS = 0x00000001,
ENABLE_FORMAT_CHARACTERS = 0x00000002,
INPUT_METHOD_STATE_NATIVE = 0x04000000,
INPUT_METHOD_STATE_NATIVE2 = 0x08000000,
INPUT_METHOD_STATE_FULL_WIDTH = 0x10000000,
};
DECLARE_ENUM_FLAG_OPERATORS(OrbisImeInitExtKeyboardMode);
template <>
struct magic_enum::customize::enum_range<OrbisImeInitExtKeyboardMode> {
static constexpr bool is_flags = true;
};
const u32 kValidOrbisImeInitExtKeyboardModeMask = generate_full_mask<OrbisImeInitExtKeyboardMode>();
enum class OrbisImeKeycodeState : u32 {
KEYCODE_VALID = 0x00000001,
CHARACTER_VALID = 0x00000002,
WITH_IME = 0x00000004,
FROM_OSK = 0x00000008,
FROM_OSK_SHORTCUT = 0x00000010,
FROM_IME_OPERATION = 0x00000020,
REPLACE_CHARACTER = 0x00000040,
CONTINUOUS_EVENT = 0x00000080,
MODIFIER_L_CTRL = 0x00000100,
MODIFIER_L_SHIFT = 0x00000200,
MODIFIER_L_ALT = 0x00000400,
MODIFIER_L_GUI = 0x00000800,
MODIFIER_R_CTRL = 0x00001000,
MODIFIER_R_SHIFT = 0x00002000,
MODIFIER_R_ALT = 0x00004000,
MODIFIER_R_GUI = 0x00008000,
LED_NUM_LOCK = 0x00010000,
LED_CAPS_LOCK = 0x00020000,
LED_SCROLL_LOCK = 0x00040000,
RESERVED1 = 0x00080000,
RESERVED2 = 0x00100000,
FROM_IME_INPUT = 0x00200000,
};
DECLARE_ENUM_FLAG_OPERATORS(OrbisImeKeycodeState);
template <>
struct magic_enum::customize::enum_range<OrbisImeKeycodeState> {
static constexpr bool is_flags = true;
};
const u32 kValidOrbisImeKeycodeStateMask = generate_full_mask<OrbisImeKeycodeState>();
enum class OrbisImeKeyboardOption : u32 {
Default = 0,
Repeat = 1,
RepeatEachKey = 2,
AddOsk = 4,
EffectiveWithIme = 8,
DisableResume = 16,
DisableCapslockWithoutShift = 32,
};
DECLARE_ENUM_FLAG_OPERATORS(OrbisImeKeyboardOption)
template <>
struct magic_enum::customize::enum_range<OrbisImeKeyboardOption> {
static constexpr bool is_flags = true;
};
const u32 kValidOrbisImeKeyboardOptionMask = generate_full_mask<OrbisImeKeyboardOption>();
enum class OrbisImeKeyboardMode : u32 {
Auto = 0,
Manual = 1,
Alphabet = 0,
Native = 2,
Part = 4,
Katakana = 8,
Hkana = 16,
ArabicIndicNumerals = 32,
DisableFormatCharacters = 64,
};
enum class OrbisImeType : u32 { enum class OrbisImeType : u32 {
Default = 0, Default = 0,
BasicLatin = 1, BasicLatin = 1,
@ -305,7 +41,6 @@ enum class OrbisImeEventId : u32 {
Open = 0, Open = 0,
UpdateText = 1, UpdateText = 1,
UpdateCaret = 2, UpdateCaret = 2,
ChangeSize = 3,
PressClose = 4, PressClose = 4,
PressEnter = 5, PressEnter = 5,
Abort = 6, Abort = 6,
@ -316,14 +51,10 @@ enum class OrbisImeEventId : u32 {
CandidateDone = 11, CandidateDone = 11,
CandidateCancel = 12, CandidateCancel = 12,
ChangeDevice = 14, ChangeDevice = 14,
JumpToNextObject = 15,
JumpToBeforeObject = 16,
ChangeWindowType = 17,
ChangeInputMethodState = 18, ChangeInputMethodState = 18,
KeyboardOpen = 256, KeyboardOpen = 256,
KeyboardKeycodeDown = 257, KeyboardKeycodeDoen = 257,
KeyboardKeycodeUp = 258, KeyboardKeycodeUp = 258,
KeyboardKeycodeRepeat = 259, KeyboardKeycodeRepeat = 259,
KeyboardConnection = 260, KeyboardConnection = 260,
@ -379,13 +110,6 @@ enum class OrbisImeDeviceType : u32 {
RemoteOsk = 3, RemoteOsk = 3,
}; };
enum class OrbisImePanelPriority : u32 {
Default = 0,
Alphabet = 1,
Symbol = 2,
Accent = 3,
};
struct OrbisImeRect { struct OrbisImeRect {
f32 x; f32 x;
f32 y; f32 y;
@ -393,22 +117,8 @@ struct OrbisImeRect {
u32 height; u32 height;
}; };
struct OrbisImeColor {
u8 r;
u8 g;
u8 b;
u8 a;
};
enum class OrbisImeTextAreaMode : u32 {
Disable = 0,
Edit = 1,
Preedit = 2,
Select = 3,
};
struct OrbisImeTextAreaProperty { struct OrbisImeTextAreaProperty {
OrbisImeTextAreaMode mode; u32 mode; // OrbisImeTextAreaMode
u32 index; u32 index;
s32 length; s32 length;
}; };
@ -425,14 +135,14 @@ struct OrbisImeKeycode {
char16_t character; char16_t character;
u32 status; u32 status;
OrbisImeKeyboardType type; OrbisImeKeyboardType type;
Libraries::UserService::OrbisUserServiceUserId user_id; s32 user_id;
u32 resource_id; u32 resource_id;
Libraries::Rtc::OrbisRtcTick timestamp; Libraries::Rtc::OrbisRtcTick timestamp;
}; };
struct OrbisImeKeyboardResourceIdArray { struct OrbisImeKeyboardResourceIdArray {
Libraries::UserService::OrbisUserServiceUserId user_id; s32 userId;
u32 resource_id[5]; u32 resourceId[5];
}; };
enum class OrbisImeCaretMovementDirection : u32 { enum class OrbisImeCaretMovementDirection : u32 {
@ -449,16 +159,6 @@ enum class OrbisImeCaretMovementDirection : u32 {
Bottom = 10, Bottom = 10,
}; };
enum class OrbisImePanelType : u32 {
Hide = 0,
Osk = 1,
Dialog = 2,
Candidate = 3,
Edit = 4,
EditAndCandidate = 5,
Accessibility = 6,
};
union OrbisImeEventParam { union OrbisImeEventParam {
OrbisImeRect rect; OrbisImeRect rect;
OrbisImeEditText text; OrbisImeEditText text;
@ -468,7 +168,6 @@ union OrbisImeEventParam {
char16_t* candidate_word; char16_t* candidate_word;
s32 candidate_index; s32 candidate_index;
OrbisImeDeviceType device_type; OrbisImeDeviceType device_type;
OrbisImePanelType panel_type;
u32 input_method_state; u32 input_method_state;
s8 reserved[64]; s8 reserved[64];
}; };
@ -478,84 +177,7 @@ struct OrbisImeEvent {
OrbisImeEventParam param; OrbisImeEventParam param;
}; };
using OrbisImeExtKeyboardFilter = PS4_SYSV_ABI int (*)(const OrbisImeKeycode* srcKeycode,
u16* outKeycode, u32* outStatus,
void* reserved);
using OrbisImeTextFilter = PS4_SYSV_ABI int (*)(char16_t* outText, u32* outTextLength, using OrbisImeTextFilter = PS4_SYSV_ABI int (*)(char16_t* outText, u32* outTextLength,
const char16_t* srcText, u32 srcTextLength); const char16_t* srcText, u32 srcTextLength);
using OrbisImeEventHandler = PS4_SYSV_ABI void (*)(void* arg, const OrbisImeEvent* e); using OrbisImeEventHandler = PS4_SYSV_ABI void (*)(void* arg, const OrbisImeEvent* e);
struct OrbisImeKeyboardParam {
OrbisImeKeyboardOption option;
s8 reserved1[4];
void* arg;
OrbisImeEventHandler handler;
s8 reserved2[8];
};
struct OrbisImeParam {
Libraries::UserService::OrbisUserServiceUserId user_id;
OrbisImeType type;
OrbisImeLanguage supported_languages;
OrbisImeEnterLabel enter_label;
OrbisImeInputMethod input_method;
OrbisImeTextFilter filter;
OrbisImeOption option;
u32 maxTextLength;
char16_t* inputTextBuffer;
f32 posx;
f32 posy;
OrbisImeHorizontalAlignment horizontal_alignment;
OrbisImeVerticalAlignment vertical_alignment;
void* work;
void* arg;
OrbisImeEventHandler handler;
s8 reserved[8];
};
struct OrbisImeCaret {
f32 x;
f32 y;
u32 height;
u32 index;
};
struct OrbisImeDialogParam {
Libraries::UserService::OrbisUserServiceUserId user_id;
OrbisImeType type;
OrbisImeLanguage supported_languages;
OrbisImeEnterLabel enter_label;
OrbisImeInputMethod input_method;
OrbisImeTextFilter filter;
OrbisImeOption option;
u32 max_text_length;
char16_t* input_text_buffer;
f32 posx;
f32 posy;
OrbisImeHorizontalAlignment horizontal_alignment;
OrbisImeVerticalAlignment vertical_alignment;
const char16_t* placeholder;
const char16_t* title;
s8 reserved[16];
};
struct OrbisImeParamExtended {
OrbisImeExtOption option;
OrbisImeColor color_base;
OrbisImeColor color_line;
OrbisImeColor color_text_field;
OrbisImeColor color_preedit;
OrbisImeColor color_button_default;
OrbisImeColor color_button_function;
OrbisImeColor color_button_symbol;
OrbisImeColor color_text;
OrbisImeColor color_special;
OrbisImePanelPriority priority;
char* additional_dictionary_path;
OrbisImeExtKeyboardFilter ext_keyboard_filter;
OrbisImeDisableDevice disable_device;
u32 ext_keyboard_mode;
s8 reserved[60];
};

View File

@ -20,19 +20,19 @@ static OrbisImeDialogResult g_ime_dlg_result{};
static ImeDialogState g_ime_dlg_state{}; static ImeDialogState g_ime_dlg_state{};
static ImeDialogUi g_ime_dlg_ui; static ImeDialogUi g_ime_dlg_ui;
static bool IsValidOption(OrbisImeOption option, OrbisImeType type) { static bool IsValidOption(OrbisImeDialogOption option, OrbisImeType type) {
if (False(~option & (OrbisImeOption::MULTILINE | if (False(~option &
OrbisImeOption::NO_AUTO_CAPITALIZATION /* NoAutoCompletion */))) { (OrbisImeDialogOption::Multiline | OrbisImeDialogOption::NoAutoCompletion))) {
return false; return false;
} }
if (True(option & OrbisImeOption::MULTILINE) && type != OrbisImeType::Default && if (True(option & OrbisImeDialogOption::Multiline) && type != OrbisImeType::Default &&
type != OrbisImeType::BasicLatin) { type != OrbisImeType::BasicLatin) {
return false; return false;
} }
if (True(option & OrbisImeOption::NO_AUTO_CAPITALIZATION /* NoAutoCompletion */) && if (True(option & OrbisImeDialogOption::NoAutoCompletion) && type != OrbisImeType::Number &&
type != OrbisImeType::Number && type != OrbisImeType::BasicLatin) { type != OrbisImeType::BasicLatin) {
return false; return false;
} }
@ -57,7 +57,6 @@ Error PS4_SYSV_ABI sceImeDialogAbort() {
} }
Error PS4_SYSV_ABI sceImeDialogForceClose() { Error PS4_SYSV_ABI sceImeDialogForceClose() {
LOG_INFO(Lib_ImeDialog, "called");
if (g_ime_dlg_status == OrbisImeDialogStatus::None) { if (g_ime_dlg_status == OrbisImeDialogStatus::None) {
LOG_INFO(Lib_ImeDialog, "IME dialog not in use"); LOG_INFO(Lib_ImeDialog, "IME dialog not in use");
return Error::DIALOG_NOT_IN_USE; return Error::DIALOG_NOT_IN_USE;
@ -97,7 +96,7 @@ Error PS4_SYSV_ABI sceImeDialogGetPanelSize(const OrbisImeDialogParam* param, u3
case OrbisImeType::Url: case OrbisImeType::Url:
case OrbisImeType::Mail: case OrbisImeType::Mail:
*width = 500; // original: 793 *width = 500; // original: 793
if (True(param->option & OrbisImeOption::MULTILINE)) { if (True(param->option & OrbisImeDialogOption::Multiline)) {
*height = 300; // original: 576 *height = 300; // original: 576
} else { } else {
*height = 150; // original: 476 *height = 150; // original: 476
@ -150,40 +149,18 @@ OrbisImeDialogStatus PS4_SYSV_ABI sceImeDialogGetStatus() {
} }
Error PS4_SYSV_ABI sceImeDialogInit(OrbisImeDialogParam* param, OrbisImeParamExtended* extended) { Error PS4_SYSV_ABI sceImeDialogInit(OrbisImeDialogParam* param, OrbisImeParamExtended* extended) {
LOG_INFO(Lib_ImeDialog, "called, param={}, extended={}", static_cast<void*>(param),
static_cast<void*>(extended));
if (param == nullptr) {
LOG_ERROR(Lib_ImeDialog, "param is null");
return Error::INVALID_ADDRESS;
} else {
LOG_INFO(Lib_ImeDialog, "param.user_id = {}", static_cast<u32>(param->user_id));
LOG_INFO(Lib_ImeDialog, "param.type: {}", static_cast<u32>(param->type));
LOG_INFO(Lib_ImeDialog, "param.supported_languages: {:064b}",
static_cast<u64>(param->supported_languages));
LOG_INFO(Lib_ImeDialog, "param.enter_label: {}", static_cast<u32>(param->enter_label));
LOG_INFO(Lib_ImeDialog, "param.input_method: {}", static_cast<u32>(param->input_method));
LOG_INFO(Lib_ImeDialog, "param.filter: {}", (void*)param->filter);
LOG_INFO(Lib_ImeDialog, "param.option: {:032b}", static_cast<u32>(param->option));
LOG_INFO(Lib_ImeDialog, "param.max_text_length: {}", param->max_text_length);
LOG_INFO(Lib_ImeDialog, "param.input_text_buffer: {}", (void*)param->input_text_buffer);
LOG_INFO(Lib_ImeDialog, "param.posx: {}", param->posx);
LOG_INFO(Lib_ImeDialog, "param.posy: {}", param->posy);
LOG_INFO(Lib_ImeDialog, "param.horizontal_alignment: {}",
static_cast<u32>(param->horizontal_alignment));
LOG_INFO(Lib_ImeDialog, "param.vertical_alignment: {}",
static_cast<u32>(param->vertical_alignment));
LOG_INFO(Lib_ImeDialog, "param.placeholder: {}",
param->placeholder ? "<non-null>" : "NULL");
LOG_INFO(Lib_ImeDialog, "param.title: {}", param->title ? "<non-null>" : "NULL");
}
if (g_ime_dlg_status != OrbisImeDialogStatus::None) { if (g_ime_dlg_status != OrbisImeDialogStatus::None) {
LOG_ERROR(Lib_ImeDialog, "busy (status={})", (u32)g_ime_dlg_status); LOG_INFO(Lib_ImeDialog, "IME dialog is already running");
return Error::BUSY; return Error::BUSY;
} }
if (param == nullptr) {
LOG_INFO(Lib_ImeDialog, "called with param (NULL)");
return Error::INVALID_ADDRESS;
}
if (!magic_enum::enum_contains(param->type)) { if (!magic_enum::enum_contains(param->type)) {
LOG_ERROR(Lib_ImeDialog, "invalid param->type={}", (u32)param->type); LOG_INFO(Lib_ImeDialog, "Invalid param->type");
return Error::INVALID_ADDRESS; return Error::INVALID_ADDRESS;
} }
@ -192,44 +169,41 @@ Error PS4_SYSV_ABI sceImeDialogInit(OrbisImeDialogParam* param, OrbisImeParamExt
if (param->posx < 0.0f || if (param->posx < 0.0f ||
param->posx >= param->posx >=
MAX_X_POSITIONS[False(param->option & OrbisImeOption::USE_OVER_2K_COORDINATES)]) { MAX_X_POSITIONS[False(param->option & OrbisImeDialogOption::LargeResolution)]) {
LOG_ERROR(Lib_ImeDialog, "Invalid posx: {}", param->posx); LOG_INFO(Lib_ImeDialog, "Invalid param->posx");
return Error::INVALID_POSX; return Error::INVALID_POSX;
} }
if (param->posy < 0.0f || if (param->posy < 0.0f ||
param->posy >= param->posy >=
MAX_Y_POSITIONS[False(param->option & OrbisImeOption::USE_OVER_2K_COORDINATES)]) { MAX_Y_POSITIONS[False(param->option & OrbisImeDialogOption::LargeResolution)]) {
LOG_ERROR(Lib_ImeDialog, "invalid posy: {}", param->posy); LOG_INFO(Lib_ImeDialog, "Invalid param->posy");
return Error::INVALID_POSY; return Error::INVALID_POSY;
} }
if (!magic_enum::enum_contains(param->horizontal_alignment)) { if (!magic_enum::enum_contains(param->horizontal_alignment)) {
LOG_INFO(Lib_ImeDialog, "Invalid param->horizontalAlignment: {}", LOG_INFO(Lib_ImeDialog, "Invalid param->horizontalAlignment");
(u32)param->horizontal_alignment);
return Error::INVALID_HORIZONTALIGNMENT; return Error::INVALID_HORIZONTALIGNMENT;
} }
if (!magic_enum::enum_contains(param->vertical_alignment)) { if (!magic_enum::enum_contains(param->vertical_alignment)) {
LOG_INFO(Lib_ImeDialog, "Invalid param->verticalAlignment: {}", LOG_INFO(Lib_ImeDialog, "Invalid param->verticalAlignment");
(u32)param->vertical_alignment);
return Error::INVALID_VERTICALALIGNMENT; return Error::INVALID_VERTICALALIGNMENT;
} }
if (!IsValidOption(param->option, param->type)) { if (!IsValidOption(param->option, param->type)) {
LOG_ERROR(Lib_ImeDialog, "Invalid option: {:032b} for type={}", LOG_INFO(Lib_ImeDialog, "Invalid param->option");
static_cast<u32>(param->option), (u32)param->type);
return Error::INVALID_PARAM; return Error::INVALID_PARAM;
} }
if (param->input_text_buffer == nullptr) { if (param->input_text_buffer == nullptr) {
LOG_ERROR(Lib_ImeDialog, "Invalid input_text_buffer: null"); LOG_INFO(Lib_ImeDialog, "Invalid param->inputTextBuffer");
return Error::INVALID_INPUT_TEXT_BUFFER; return Error::INVALID_INPUT_TEXT_BUFFER;
} }
if (extended) { if (extended) {
if (!magic_enum::enum_contains(extended->priority)) { if (!magic_enum::enum_contains(extended->priority)) {
LOG_INFO(Lib_ImeDialog, "Invalid extended->priority: {}", (u32)extended->priority); LOG_INFO(Lib_ImeDialog, "Invalid extended->priority");
return Error::INVALID_EXTENDED; return Error::INVALID_EXTENDED;
} }
@ -240,32 +214,22 @@ Error PS4_SYSV_ABI sceImeDialogInit(OrbisImeDialogParam* param, OrbisImeParamExt
return Error::INVALID_EXTENDED; return Error::INVALID_EXTENDED;
} }
if (static_cast<u32>(extended->disable_device) & ~kValidOrbisImeDisableDeviceMask) { if (extended->disable_device > 7) {
LOG_ERROR(Lib_ImeDialog, LOG_INFO(Lib_ImeDialog, "Invalid extended->disableDevice");
"sceImeDialogInit: disable_device has invalid bits set (0x{:X})",
static_cast<u32>(extended->disable_device));
return Error::INVALID_EXTENDED; return Error::INVALID_EXTENDED;
} }
} }
if (param->max_text_length == 0 || param->max_text_length > ORBIS_IME_MAX_TEXT_LENGTH) { if (param->max_text_length > ORBIS_IME_DIALOG_MAX_TEXT_LENGTH) {
LOG_ERROR(Lib_ImeDialog, "sceImeDialogInit: invalid max_text_length={}", LOG_INFO(Lib_ImeDialog, "Invalid param->maxTextLength");
param->max_text_length);
return Error::INVALID_MAX_TEXT_LENGTH; return Error::INVALID_MAX_TEXT_LENGTH;
} }
// Title string validation
if (param->title != nullptr && !std::char_traits<char16_t>::length(param->title)) {
LOG_ERROR(Lib_ImeDialog, "sceImeDialogInit: title is empty");
return Error::INVALID_PARAM;
}
g_ime_dlg_result = {}; g_ime_dlg_result = {};
g_ime_dlg_state = ImeDialogState(param, extended); g_ime_dlg_state = ImeDialogState(param, extended);
g_ime_dlg_status = OrbisImeDialogStatus::Running; g_ime_dlg_status = OrbisImeDialogStatus::Running;
g_ime_dlg_ui = ImeDialogUi(&g_ime_dlg_state, &g_ime_dlg_status, &g_ime_dlg_result); g_ime_dlg_ui = ImeDialogUi(&g_ime_dlg_state, &g_ime_dlg_status, &g_ime_dlg_result);
LOG_INFO(Lib_ImeDialog, "sceImeDialogInit: successful, status now=Running");
return Error::OK; return Error::OK;
} }
@ -290,7 +254,6 @@ int PS4_SYSV_ABI sceImeDialogSetPanelPosition() {
} }
Error PS4_SYSV_ABI sceImeDialogTerm() { Error PS4_SYSV_ABI sceImeDialogTerm() {
LOG_INFO(Lib_ImeDialog, "called");
if (g_ime_dlg_status == OrbisImeDialogStatus::None) { if (g_ime_dlg_status == OrbisImeDialogStatus::None) {
LOG_INFO(Lib_ImeDialog, "IME dialog not in use"); LOG_INFO(Lib_ImeDialog, "IME dialog not in use");
return Error::DIALOG_NOT_IN_USE; return Error::DIALOG_NOT_IN_USE;
@ -308,7 +271,7 @@ Error PS4_SYSV_ABI sceImeDialogTerm() {
return Error::OK; return Error::OK;
} }
void RegisterLib(Core::Loader::SymbolsResolver* sym) { void RegisterlibSceImeDialog(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("oBmw4xrmfKs", "libSceImeDialog", 1, "libSceImeDialog", 1, 1, sceImeDialogAbort); LIB_FUNCTION("oBmw4xrmfKs", "libSceImeDialog", 1, "libSceImeDialog", 1, 1, sceImeDialogAbort);
LIB_FUNCTION("bX4H+sxPI-o", "libSceImeDialog", 1, "libSceImeDialog", 1, 1, LIB_FUNCTION("bX4H+sxPI-o", "libSceImeDialog", 1, "libSceImeDialog", 1, 1,
sceImeDialogForceClose); sceImeDialogForceClose);

View File

@ -13,6 +13,50 @@ class SymbolsResolver;
namespace Libraries::ImeDialog { namespace Libraries::ImeDialog {
constexpr u32 ORBIS_IME_DIALOG_MAX_TEXT_LENGTH = 2048;
enum class Error : u32 {
OK = 0x0,
BUSY = 0x80bc0001,
NOT_OPENED = 0x80bc0002,
NO_MEMORY = 0x80bc0003,
CONNECTION_FAILED = 0x80bc0004,
TOO_MANY_REQUESTS = 0x80bc0005,
INVALID_TEXT = 0x80bc0006,
EVENT_OVERFLOW = 0x80bc0007,
NOT_ACTIVE = 0x80bc0008,
IME_SUSPENDING = 0x80bc0009,
DEVICE_IN_USE = 0x80bc000a,
INVALID_USER_ID = 0x80bc0010,
INVALID_TYPE = 0x80bc0011,
INVALID_SUPPORTED_LANGUAGES = 0x80bc0012,
INVALID_ENTER_LABEL = 0x80bc0013,
INVALID_INPUT_METHOD = 0x80bc0014,
INVALID_OPTION = 0x80bc0015,
INVALID_MAX_TEXT_LENGTH = 0x80bc0016,
INVALID_INPUT_TEXT_BUFFER = 0x80bc0017,
INVALID_POSX = 0x80bc0018,
INVALID_POSY = 0x80bc0019,
INVALID_HORIZONTALIGNMENT = 0x80bc001a,
INVALID_VERTICALALIGNMENT = 0x80bc001b,
INVALID_EXTENDED = 0x80bc001c,
INVALID_KEYBOARD_TYPE = 0x80bc001d,
INVALID_WORK = 0x80bc0020,
INVALID_ARG = 0x80bc0021,
INVALID_HANDLER = 0x80bc0022,
NO_RESOURCE_ID = 0x80bc0023,
INVALID_MODE = 0x80bc0024,
INVALID_PARAM = 0x80bc0030,
INVALID_ADDRESS = 0x80bc0031,
INVALID_RESERVED = 0x80bc0032,
INVALID_TIMING = 0x80bc0033,
INTERNAL = 0x80bc00ff,
DIALOG_INVALID_TITLE = 0x80bc0101,
DIALOG_NOT_RUNNING = 0x80bc0105,
DIALOG_NOT_FINISHED = 0x80bc0106,
DIALOG_NOT_IN_USE = 0x80bc0107,
};
enum class OrbisImeDialogStatus : u32 { enum class OrbisImeDialogStatus : u32 {
None = 0, None = 0,
Running = 1, Running = 1,
@ -25,11 +69,87 @@ enum class OrbisImeDialogEndStatus : u32 {
Aborted = 2, Aborted = 2,
}; };
enum class OrbisImeDialogOption : u32 {
Default = 0,
Multiline = 1,
NoAutoCorrection = 2,
NoAutoCompletion = 4,
// TODO: Document missing options
LargeResolution = 1024,
};
DECLARE_ENUM_FLAG_OPERATORS(OrbisImeDialogOption)
enum class OrbisImePanelPriority : u32 {
Default = 0,
Alphabet = 1,
Symbol = 2,
Accent = 3,
};
struct OrbisImeColor {
u8 r;
u8 g;
u8 b;
u8 a;
};
struct OrbisImeDialogResult { struct OrbisImeDialogResult {
OrbisImeDialogEndStatus endstatus; OrbisImeDialogEndStatus endstatus;
s32 reserved[12]; s32 reserved[12];
}; };
struct OrbisImeKeycode {
u16 keycode;
char16_t character;
u32 status;
OrbisImeKeyboardType type;
s32 user_id;
u32 resource_id;
u64 timestamp;
};
using OrbisImeExtKeyboardFilter = PS4_SYSV_ABI int (*)(const OrbisImeKeycode* srcKeycode,
u16* outKeycode, u32* outStatus,
void* reserved);
struct OrbisImeDialogParam {
s32 user_id;
OrbisImeType type;
u64 supported_languages;
OrbisImeEnterLabel enter_label;
OrbisImeInputMethod input_method;
OrbisImeTextFilter filter;
OrbisImeDialogOption option;
u32 max_text_length;
char16_t* input_text_buffer;
float posx;
float posy;
OrbisImeHorizontalAlignment horizontal_alignment;
OrbisImeVerticalAlignment vertical_alignment;
const char16_t* placeholder;
const char16_t* title;
s8 reserved[16];
};
struct OrbisImeParamExtended {
u32 option; // OrbisImeDialogOptionExtended
OrbisImeColor color_base;
OrbisImeColor color_line;
OrbisImeColor color_text_field;
OrbisImeColor color_preedit;
OrbisImeColor color_button_default;
OrbisImeColor color_button_function;
OrbisImeColor color_button_symbol;
OrbisImeColor color_text;
OrbisImeColor color_special;
OrbisImePanelPriority priority;
char* additional_dictionary_path;
OrbisImeExtKeyboardFilter ext_keyboard_filter;
uint32_t disable_device;
uint32_t ext_keyboard_mode;
int8_t reserved[60];
};
Error PS4_SYSV_ABI sceImeDialogAbort(); Error PS4_SYSV_ABI sceImeDialogAbort();
Error PS4_SYSV_ABI sceImeDialogForceClose(); Error PS4_SYSV_ABI sceImeDialogForceClose();
Error PS4_SYSV_ABI sceImeDialogForTestFunction(); Error PS4_SYSV_ABI sceImeDialogForTestFunction();
@ -47,5 +167,5 @@ int PS4_SYSV_ABI sceImeDialogInitInternal3();
int PS4_SYSV_ABI sceImeDialogSetPanelPosition(); int PS4_SYSV_ABI sceImeDialogSetPanelPosition();
Error PS4_SYSV_ABI sceImeDialogTerm(); Error PS4_SYSV_ABI sceImeDialogTerm();
void RegisterLib(Core::Loader::SymbolsResolver* sym); void RegisterlibSceImeDialog(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::ImeDialog } // namespace Libraries::ImeDialog

View File

@ -18,23 +18,15 @@ using namespace ImGui;
static constexpr ImVec2 BUTTON_SIZE{100.0f, 30.0f}; static constexpr ImVec2 BUTTON_SIZE{100.0f, 30.0f};
namespace Libraries::ImeDialog { namespace Libraries::ImeDialog {
ImeDialogState::ImeDialogState()
: input_changed(false), user_id(-1), is_multi_line(false), is_numeric(false),
type(OrbisImeType::Default), enter_label(OrbisImeEnterLabel::Default), text_filter(nullptr),
keyboard_filter(nullptr), max_text_length(ORBIS_IME_DIALOG_MAX_TEXT_LENGTH),
text_buffer(nullptr), title(), placeholder(), current_text() {}
ImeDialogState::ImeDialogState(const OrbisImeDialogParam* param, ImeDialogState::ImeDialogState(const OrbisImeDialogParam* param,
const OrbisImeParamExtended* extended) { const OrbisImeParamExtended* extended) {
LOG_INFO(Lib_ImeDialog, "param={}, text_buffer={}", static_cast<const void*>(param),
static_cast<void*>(param ? param->input_text_buffer : nullptr));
if (!param) { if (!param) {
LOG_ERROR(Lib_ImeDialog, "param==nullptr, returning without init");
return; return;
} }
user_id = param->user_id; user_id = param->user_id;
is_multi_line = True(param->option & OrbisImeOption::MULTILINE); is_multi_line = True(param->option & OrbisImeDialogOption::Multiline);
is_numeric = param->type == OrbisImeType::Number; is_numeric = param->type == OrbisImeType::Number;
type = param->type; type = param->type;
enter_label = param->enter_label; enter_label = param->enter_label;
@ -227,7 +219,7 @@ void ImeDialogUi::Free() {
} }
void ImeDialogUi::Draw() { void ImeDialogUi::Draw() {
std::unique_lock<std::mutex> lock{draw_mutex}; std::unique_lock lock{draw_mutex};
if (!state) { if (!state) {
return; return;
@ -324,7 +316,7 @@ void ImeDialogUi::DrawInputText() {
} }
const char* placeholder = state->placeholder.empty() ? nullptr : state->placeholder.data(); const char* placeholder = state->placeholder.empty() ? nullptr : state->placeholder.data();
if (InputTextEx("##ImeDialogInput", placeholder, state->current_text.begin(), if (InputTextEx("##ImeDialogInput", placeholder, state->current_text.begin(),
state->max_text_length + 1, input_size, ImGuiInputTextFlags_CallbackCharFilter, state->max_text_length, input_size, ImGuiInputTextFlags_CallbackCharFilter,
InputTextCallback, this)) { InputTextCallback, this)) {
state->input_changed = true; state->input_changed = true;
} }
@ -340,7 +332,7 @@ void ImeDialogUi::DrawMultiLineInputText() {
} }
const char* placeholder = state->placeholder.empty() ? nullptr : state->placeholder.data(); const char* placeholder = state->placeholder.empty() ? nullptr : state->placeholder.data();
if (InputTextEx("##ImeDialogInput", placeholder, state->current_text.begin(), if (InputTextEx("##ImeDialogInput", placeholder, state->current_text.begin(),
state->max_text_length + 1, input_size, flags, InputTextCallback, this)) { state->max_text_length, input_size, flags, InputTextCallback, this)) {
state->input_changed = true; state->input_changed = true;
} }
} }
@ -349,19 +341,13 @@ int ImeDialogUi::InputTextCallback(ImGuiInputTextCallbackData* data) {
ImeDialogUi* ui = static_cast<ImeDialogUi*>(data->UserData); ImeDialogUi* ui = static_cast<ImeDialogUi*>(data->UserData);
ASSERT(ui); ASSERT(ui);
LOG_DEBUG(Lib_ImeDialog, ">> InputTextCallback: EventFlag={}, EventChar={}", data->EventFlag,
data->EventChar);
// Should we filter punctuation? // Should we filter punctuation?
if (ui->state->is_numeric && (data->EventChar < '0' || data->EventChar > '9') && if (ui->state->is_numeric && (data->EventChar < '0' || data->EventChar > '9') &&
data->EventChar != '\b' && data->EventChar != ',' && data->EventChar != '.') { data->EventChar != '\b' && data->EventChar != ',' && data->EventChar != '.') {
LOG_INFO(Lib_ImeDialog, "InputTextCallback: rejecting non-digit char '{}'",
static_cast<char>(data->EventChar));
return 1; return 1;
} }
if (!ui->state->keyboard_filter) { if (!ui->state->keyboard_filter) {
LOG_DEBUG(Lib_ImeDialog, "InputTextCallback: no keyboard_filter, accepting char");
return 0; return 0;
} }
@ -377,24 +363,20 @@ int ImeDialogUi::InputTextCallback(ImGuiInputTextCallbackData* data) {
// the current language?) // the current language?)
.user_id = ui->state->user_id, .user_id = ui->state->user_id,
.resource_id = 0, .resource_id = 0,
.timestamp = {0}, .timestamp = 0,
}; };
if (!ui->state->ConvertUTF8ToOrbis(event_char, 4, &src_keycode.character, 1)) { if (!ui->state->ConvertUTF8ToOrbis(event_char, 4, &src_keycode.character, 1)) {
LOG_ERROR(Lib_ImeDialog, "InputTextCallback: ConvertUTF8ToOrbis failed"); LOG_ERROR(Lib_ImeDialog, "Failed to convert orbis char to utf8");
return 0; return 0;
} }
LOG_DEBUG(Lib_ImeDialog, "InputTextCallback: converted to Orbis char={:#X}",
static_cast<uint16_t>(src_keycode.character));
src_keycode.keycode = src_keycode.character; // TODO set this to the correct value src_keycode.keycode = src_keycode.character; // TODO set this to the correct value
u16 out_keycode; u16 out_keycode;
u32 out_status; u32 out_status;
bool keep = ui->state->CallKeyboardFilter(&src_keycode, &out_keycode, &out_status); ui->state->CallKeyboardFilter(&src_keycode, &out_keycode, &out_status);
LOG_DEBUG(Lib_ImeDialog,
"InputTextCallback: CallKeyboardFilter returned %s (keycode=0x%X, status=0x%X)",
keep ? "true" : "false", out_keycode, out_status);
// TODO. set the keycode // TODO. set the keycode
return 0; return 0;

View File

@ -36,14 +36,8 @@ class ImeDialogState final {
Common::CString<ORBIS_IME_DIALOG_MAX_TEXT_LENGTH * 4> current_text; Common::CString<ORBIS_IME_DIALOG_MAX_TEXT_LENGTH * 4> current_text;
public: public:
/* ImeDialogState(const OrbisImeDialogParam* param = nullptr,
* Use default constructor ImeDialogState() to initialize default values instead of const OrbisImeParamExtended* extended = nullptr);
* ImeDialogState(const OrbisImeDialogParam* param = nullptr,const OrbisImeParamExtended*
* extended = nullptr) to avoid validation errors in log
*/
ImeDialogState();
ImeDialogState(const OrbisImeDialogParam* param /*= nullptr*/,
const OrbisImeParamExtended* extended /*= nullptr*/);
ImeDialogState(const ImeDialogState& other) = delete; ImeDialogState(const ImeDialogState& other) = delete;
ImeDialogState(ImeDialogState&& other) noexcept; ImeDialogState(ImeDialogState&& other) noexcept;
ImeDialogState& operator=(ImeDialogState&& other); ImeDialogState& operator=(ImeDialogState&& other);

View File

@ -44,7 +44,7 @@ ImeState& ImeState::operator=(ImeState&& other) noexcept {
} }
void ImeState::SendEvent(OrbisImeEvent* event) { void ImeState::SendEvent(OrbisImeEvent* event) {
std::unique_lock<std::mutex> lock{queue_mutex}; std::unique_lock lock{queue_mutex};
event_queue.push(*event); event_queue.push(*event);
} }
@ -108,7 +108,7 @@ ImeUi& ImeUi::operator=(ImeUi&& other) {
} }
void ImeUi::Draw() { void ImeUi::Draw() {
std::unique_lock<std::mutex> lock{draw_mutex}; std::unique_lock lock{draw_mutex};
if (!state) { if (!state) {
return; return;
@ -199,7 +199,7 @@ int ImeUi::InputTextCallback(ImGuiInputTextCallbackData* data) {
eventParam.caret_index = data->CursorPos; eventParam.caret_index = data->CursorPos;
eventParam.area_num = 1; eventParam.area_num = 1;
eventParam.text_area[0].mode = OrbisImeTextAreaMode::Edit; eventParam.text_area[0].mode = 1; // Edit mode
eventParam.text_area[0].index = data->CursorPos; eventParam.text_area[0].index = data->CursorPos;
eventParam.text_area[0].length = data->BufTextLen; eventParam.text_area[0].length = data->BufTextLen;

View File

@ -197,7 +197,7 @@ s32 PS4_SYSV_ABI sceJpegEncQueryMemorySize(const OrbisJpegEncCreateParam* param)
return ORBIS_JPEG_ENC_MINIMUM_MEMORY_SIZE; return ORBIS_JPEG_ENC_MINIMUM_MEMORY_SIZE;
} }
void RegisterLib(Core::Loader::SymbolsResolver* sym) { void RegisterlibSceJpegEnc(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("K+rocojkr-I", "libSceJpegEnc", 1, "libSceJpegEnc", 1, 1, sceJpegEncCreate); LIB_FUNCTION("K+rocojkr-I", "libSceJpegEnc", 1, "libSceJpegEnc", 1, 1, sceJpegEncCreate);
LIB_FUNCTION("j1LyMdaM+C0", "libSceJpegEnc", 1, "libSceJpegEnc", 1, 1, sceJpegEncDelete); LIB_FUNCTION("j1LyMdaM+C0", "libSceJpegEnc", 1, "libSceJpegEnc", 1, 1, sceJpegEncDelete);
LIB_FUNCTION("QbrU0cUghEM", "libSceJpegEnc", 1, "libSceJpegEnc", 1, 1, sceJpegEncEncode); LIB_FUNCTION("QbrU0cUghEM", "libSceJpegEnc", 1, "libSceJpegEnc", 1, 1, sceJpegEncEncode);

View File

@ -80,5 +80,5 @@ s32 PS4_SYSV_ABI sceJpegEncEncode(OrbisJpegEncHandle handle, const OrbisJpegEncE
OrbisJpegEncOutputInfo* output_info); OrbisJpegEncOutputInfo* output_info);
s32 PS4_SYSV_ABI sceJpegEncQueryMemorySize(const OrbisJpegEncCreateParam* param); s32 PS4_SYSV_ABI sceJpegEncQueryMemorySize(const OrbisJpegEncCreateParam* param);
void RegisterLib(Core::Loader::SymbolsResolver* sym); void RegisterlibSceJpegEnc(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::JpegEnc } // namespace Libraries::JpegEnc

View File

@ -118,16 +118,14 @@ s32 PS4_SYSV_ABI open(const char* raw_path, s32 flags, u16 mode) {
return -1; return -1;
} }
if (!exists) { if (read_only) {
if (read_only) { // Can't create files in a read only directory
// Can't create files in a read only directory h->DeleteHandle(handle);
h->DeleteHandle(handle); *__Error() = POSIX_EROFS;
*__Error() = POSIX_EROFS; return -1;
return -1;
}
// Create a file if it doesn't exist
Common::FS::IOFile out(file->m_host_name, Common::FS::FileAccessMode::Write);
} }
// Create a file if it doesn't exist
Common::FS::IOFile out(file->m_host_name, Common::FS::FileAccessMode::Write);
} 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
h->DeleteHandle(handle); h->DeleteHandle(handle);
@ -1093,8 +1091,6 @@ void RegisterFileSystem(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("kBwCPsYX-m4", "libkernel", 1, "libkernel", 1, 1, sceKernelFstat); LIB_FUNCTION("kBwCPsYX-m4", "libkernel", 1, "libkernel", 1, 1, sceKernelFstat);
LIB_FUNCTION("ih4CD9-gghM", "libkernel", 1, "libkernel", 1, 1, posix_ftruncate); LIB_FUNCTION("ih4CD9-gghM", "libkernel", 1, "libkernel", 1, 1, posix_ftruncate);
LIB_FUNCTION("VW3TVZiM4-E", "libkernel", 1, "libkernel", 1, 1, sceKernelFtruncate); LIB_FUNCTION("VW3TVZiM4-E", "libkernel", 1, "libkernel", 1, 1, sceKernelFtruncate);
LIB_FUNCTION("NN01qLRhiqU", "libScePosix", 1, "libkernel", 1, 1, posix_rename);
LIB_FUNCTION("NN01qLRhiqU", "libkernel", 1, "libkernel", 1, 1, posix_rename);
LIB_FUNCTION("52NcYU9+lEo", "libkernel", 1, "libkernel", 1, 1, sceKernelRename); LIB_FUNCTION("52NcYU9+lEo", "libkernel", 1, "libkernel", 1, 1, sceKernelRename);
LIB_FUNCTION("yTj62I7kw4s", "libkernel", 1, "libkernel", 1, 1, sceKernelPreadv); LIB_FUNCTION("yTj62I7kw4s", "libkernel", 1, "libkernel", 1, 1, sceKernelPreadv);
LIB_FUNCTION("ezv-RSBNKqI", "libScePosix", 1, "libkernel", 1, 1, posix_pread); LIB_FUNCTION("ezv-RSBNKqI", "libScePosix", 1, "libkernel", 1, 1, posix_pread);

View File

@ -6,7 +6,6 @@
#include "common/assert.h" #include "common/assert.h"
#include "common/debug.h" #include "common/debug.h"
#include "common/elf_info.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/polyfill_thread.h" #include "common/polyfill_thread.h"
#include "common/thread.h" #include "common/thread.h"
@ -91,13 +90,6 @@ s32 ErrnoToSceKernelError(s32 error) {
return error + ORBIS_KERNEL_ERROR_UNKNOWN; return error + ORBIS_KERNEL_ERROR_UNKNOWN;
} }
s32 PS4_SYSV_ABI sceKernelError(s32 posix_error) {
if (posix_error == 0) {
return 0;
}
return posix_error + ORBIS_KERNEL_ERROR_UNKNOWN;
}
void SetPosixErrno(s32 e) { void SetPosixErrno(s32 e) {
// Some error numbers are different between supported OSes // Some error numbers are different between supported OSes
switch (e) { switch (e) {
@ -251,20 +243,7 @@ s32 PS4_SYSV_ABI sceKernelSetGPO() {
return ORBIS_OK; return ORBIS_OK;
} }
s32 PS4_SYSV_ABI sceKernelGetSystemSwVersion(SwVersionStruct* ret) { void RegisterKernel(Core::Loader::SymbolsResolver* sym) {
if (ret == nullptr) {
return ORBIS_OK; // but why?
}
ASSERT(ret->struct_size == 40);
u32 fake_fw = Common::ElfInfo::Instance().RawFirmwareVer();
ret->hex_representation = fake_fw;
std::snprintf(ret->text_representation, 28, "%2x.%03x.%03x", fake_fw >> 0x18,
fake_fw >> 0xc & 0xfff, fake_fw & 0xfff); // why %2x?
LOG_INFO(Lib_Kernel, "called, returned sw version: {}", ret->text_representation);
return ORBIS_OK;
}
void RegisterLib(Core::Loader::SymbolsResolver* sym) {
service_thread = std::jthread{KernelServiceThread}; service_thread = std::jthread{KernelServiceThread};
Libraries::Kernel::RegisterFileSystem(sym); Libraries::Kernel::RegisterFileSystem(sym);
@ -279,8 +258,6 @@ void RegisterLib(Core::Loader::SymbolsResolver* sym) {
Libraries::Kernel::RegisterDebug(sym); Libraries::Kernel::RegisterDebug(sym);
LIB_OBJ("f7uOxY9mM1U", "libkernel", 1, "libkernel", 1, 1, &g_stack_chk_guard); LIB_OBJ("f7uOxY9mM1U", "libkernel", 1, "libkernel", 1, 1, &g_stack_chk_guard);
LIB_FUNCTION("D4yla3vx4tY", "libkernel", 1, "libkernel", 1, 1, sceKernelError);
LIB_FUNCTION("Mv1zUObHvXI", "libkernel", 1, "libkernel", 1, 1, sceKernelGetSystemSwVersion);
LIB_FUNCTION("PfccT7qURYE", "libkernel", 1, "libkernel", 1, 1, kernel_ioctl); LIB_FUNCTION("PfccT7qURYE", "libkernel", 1, "libkernel", 1, 1, kernel_ioctl);
LIB_FUNCTION("JGfTMBOdUJo", "libkernel", 1, "libkernel", 1, 1, sceKernelGetFsSandboxRandomWord); LIB_FUNCTION("JGfTMBOdUJo", "libkernel", 1, "libkernel", 1, 1, sceKernelGetFsSandboxRandomWord);
LIB_FUNCTION("6xVpy0Fdq+I", "libkernel", 1, "libkernel", 1, 1, _sigprocmask); LIB_FUNCTION("6xVpy0Fdq+I", "libkernel", 1, "libkernel", 1, 1, _sigprocmask);
@ -301,13 +278,9 @@ void RegisterLib(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("TU-d9PfIHPM", "libScePosix", 1, "libkernel", 1, 1, Libraries::Net::sys_socket); LIB_FUNCTION("TU-d9PfIHPM", "libScePosix", 1, "libkernel", 1, 1, Libraries::Net::sys_socket);
LIB_FUNCTION("oBr313PppNE", "libScePosix", 1, "libkernel", 1, 1, Libraries::Net::sys_sendto); LIB_FUNCTION("oBr313PppNE", "libScePosix", 1, "libkernel", 1, 1, Libraries::Net::sys_sendto);
LIB_FUNCTION("lUk6wrGXyMw", "libScePosix", 1, "libkernel", 1, 1, Libraries::Net::sys_recvfrom); LIB_FUNCTION("lUk6wrGXyMw", "libScePosix", 1, "libkernel", 1, 1, Libraries::Net::sys_recvfrom);
LIB_FUNCTION("TXFFFiNldU8", "libScePosix", 1, "libkernel", 1, 1,
Libraries::Net::sys_getpeername);
LIB_FUNCTION("6O8EwYOgH9Y", "libScePosix", 1, "libkernel", 1, 1,
Libraries::Net::sys_getsockopt);
LIB_FUNCTION("fFxGkxF2bVo", "libScePosix", 1, "libkernel", 1, 1, LIB_FUNCTION("fFxGkxF2bVo", "libScePosix", 1, "libkernel", 1, 1,
Libraries::Net::sys_setsockopt); Libraries::Net::sys_setsockopt);
LIB_FUNCTION("RenI1lL1WFk", "libScePosix", 1, "libkernel", 1, 1, posix_getsockname); // LIB_FUNCTION("RenI1lL1WFk", "libScePosix", 1, "libkernel", 1, 1, posix_getsockname);
LIB_FUNCTION("KuOmgKoqCdY", "libScePosix", 1, "libkernel", 1, 1, Libraries::Net::sys_bind); LIB_FUNCTION("KuOmgKoqCdY", "libScePosix", 1, "libkernel", 1, 1, Libraries::Net::sys_bind);
LIB_FUNCTION("5jRCs2axtr4", "libScePosix", 1, "libkernel", 1, 1, LIB_FUNCTION("5jRCs2axtr4", "libScePosix", 1, "libkernel", 1, 1,
Libraries::Net::sceNetInetNtop); // TODO fix it to sys_ ... Libraries::Net::sceNetInetNtop); // TODO fix it to sys_ ...

View File

@ -35,12 +35,6 @@ struct OrbisWrapperImpl<PS4_SYSV_ABI R (*)(Args...), f> {
s32* PS4_SYSV_ABI __Error(); s32* PS4_SYSV_ABI __Error();
struct SwVersionStruct { void RegisterKernel(Core::Loader::SymbolsResolver* sym);
u64 struct_size;
char text_representation[0x1c];
u32 hex_representation;
};
void RegisterLib(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::Kernel } // namespace Libraries::Kernel

View File

@ -318,11 +318,6 @@ s32 PS4_SYSV_ABI sceKernelIsStack(void* addr, void** start, void** end) {
return memory->IsStack(std::bit_cast<VAddr>(addr), start, end); return memory->IsStack(std::bit_cast<VAddr>(addr), start, end);
} }
u32 PS4_SYSV_ABI sceKernelIsAddressSanitizerEnabled() {
LOG_DEBUG(Kernel, "called");
return false;
}
s32 PS4_SYSV_ABI sceKernelBatchMap(OrbisKernelBatchMapEntry* entries, s32 numEntries, s32 PS4_SYSV_ABI sceKernelBatchMap(OrbisKernelBatchMapEntry* entries, s32 numEntries,
s32* numEntriesOut) { s32* numEntriesOut) {
return sceKernelBatchMap2(entries, numEntries, numEntriesOut, return sceKernelBatchMap2(entries, numEntries, numEntriesOut,
@ -578,12 +573,11 @@ void* PS4_SYSV_ABI posix_mmap(void* addr, u64 len, s32 prot, s32 flags, s32 fd,
auto* memory = Core::Memory::Instance(); auto* memory = Core::Memory::Instance();
const auto mem_prot = static_cast<Core::MemoryProt>(prot); const auto mem_prot = static_cast<Core::MemoryProt>(prot);
const auto mem_flags = static_cast<Core::MemoryMapFlags>(flags); const auto mem_flags = static_cast<Core::MemoryMapFlags>(flags);
const auto is_exec = True(mem_prot & Core::MemoryProt::CpuExec);
s32 result = ORBIS_OK; s32 result = ORBIS_OK;
if (fd == -1) { if (fd == -1) {
result = memory->MapMemory(&addr_out, std::bit_cast<VAddr>(addr), len, mem_prot, mem_flags, result = memory->MapMemory(&addr_out, std::bit_cast<VAddr>(addr), len, mem_prot, mem_flags,
Core::VMAType::Flexible, "anon", is_exec); Core::VMAType::Flexible);
} else { } else {
result = memory->MapFile(&addr_out, std::bit_cast<VAddr>(addr), len, mem_prot, mem_flags, result = memory->MapFile(&addr_out, std::bit_cast<VAddr>(addr), len, mem_prot, mem_flags,
fd, phys_addr); fd, phys_addr);
@ -694,8 +688,6 @@ void RegisterMemory(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("BC+OG5m9+bw", "libkernel", 1, "libkernel", 1, 1, sceKernelGetDirectMemoryType); LIB_FUNCTION("BC+OG5m9+bw", "libkernel", 1, "libkernel", 1, 1, sceKernelGetDirectMemoryType);
LIB_FUNCTION("pO96TwzOm5E", "libkernel", 1, "libkernel", 1, 1, sceKernelGetDirectMemorySize); LIB_FUNCTION("pO96TwzOm5E", "libkernel", 1, "libkernel", 1, 1, sceKernelGetDirectMemorySize);
LIB_FUNCTION("yDBwVAolDgg", "libkernel", 1, "libkernel", 1, 1, sceKernelIsStack); LIB_FUNCTION("yDBwVAolDgg", "libkernel", 1, "libkernel", 1, 1, sceKernelIsStack);
LIB_FUNCTION("jh+8XiK4LeE", "libkernel", 1, "libkernel", 1, 1,
sceKernelIsAddressSanitizerEnabled);
LIB_FUNCTION("NcaWUxfMNIQ", "libkernel", 1, "libkernel", 1, 1, sceKernelMapNamedDirectMemory); LIB_FUNCTION("NcaWUxfMNIQ", "libkernel", 1, "libkernel", 1, 1, sceKernelMapNamedDirectMemory);
LIB_FUNCTION("L-Q3LEjIbgA", "libkernel", 1, "libkernel", 1, 1, sceKernelMapDirectMemory); LIB_FUNCTION("L-Q3LEjIbgA", "libkernel", 1, "libkernel", 1, 1, sceKernelMapDirectMemory);
LIB_FUNCTION("BQQniolj9tQ", "libkernel", 1, "libkernel", 1, 1, sceKernelMapDirectMemory2); LIB_FUNCTION("BQQniolj9tQ", "libkernel", 1, "libkernel", 1, 1, sceKernelMapDirectMemory2);
@ -719,7 +711,6 @@ void RegisterMemory(Core::Loader::SymbolsResolver* sym) {
sceKernelConfiguredFlexibleMemorySize); sceKernelConfiguredFlexibleMemorySize);
LIB_FUNCTION("vSMAm3cxYTY", "libkernel", 1, "libkernel", 1, 1, sceKernelMprotect); LIB_FUNCTION("vSMAm3cxYTY", "libkernel", 1, "libkernel", 1, 1, sceKernelMprotect);
LIB_FUNCTION("YQOfxL4QfeU", "libkernel", 1, "libkernel", 1, 1, posix_mprotect);
LIB_FUNCTION("YQOfxL4QfeU", "libScePosix", 1, "libkernel", 1, 1, posix_mprotect); LIB_FUNCTION("YQOfxL4QfeU", "libScePosix", 1, "libkernel", 1, 1, posix_mprotect);
LIB_FUNCTION("9bfdLIyuwCY", "libkernel", 1, "libkernel", 1, 1, sceKernelMtypeprotect); LIB_FUNCTION("9bfdLIyuwCY", "libkernel", 1, "libkernel", 1, 1, sceKernelMtypeprotect);

View File

@ -341,8 +341,6 @@ void RegisterCond(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("mKoTx03HRWA", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_condattr_init); LIB_FUNCTION("mKoTx03HRWA", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_condattr_init);
LIB_FUNCTION("dJcuQVn6-Iw", "libScePosix", 1, "libkernel", 1, 1, LIB_FUNCTION("dJcuQVn6-Iw", "libScePosix", 1, "libkernel", 1, 1,
posix_pthread_condattr_destroy); posix_pthread_condattr_destroy);
LIB_FUNCTION("EjllaAqAPZo", "libScePosix", 1, "libkernel", 1, 1,
posix_pthread_condattr_setclock);
LIB_FUNCTION("0TyVk4MSLt0", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_cond_init); LIB_FUNCTION("0TyVk4MSLt0", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_cond_init);
LIB_FUNCTION("2MOy+rUfuhQ", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_cond_signal); LIB_FUNCTION("2MOy+rUfuhQ", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_cond_signal);
LIB_FUNCTION("RXXqi4CtF8w", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_cond_destroy); LIB_FUNCTION("RXXqi4CtF8w", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_cond_destroy);

View File

@ -324,10 +324,6 @@ PthreadT PS4_SYSV_ABI posix_pthread_self() {
return g_curthread; return g_curthread;
} }
void PS4_SYSV_ABI posix_pthread_set_name_np(PthreadT thread, const char* name) {
Common::SetCurrentThreadName(name);
}
void PS4_SYSV_ABI posix_pthread_yield() { void PS4_SYSV_ABI posix_pthread_yield() {
std::this_thread::yield(); std::this_thread::yield();
} }
@ -336,10 +332,6 @@ void PS4_SYSV_ABI sched_yield() {
std::this_thread::yield(); std::this_thread::yield();
} }
int PS4_SYSV_ABI posix_getpid() {
return g_curthread->tid;
}
int PS4_SYSV_ABI posix_pthread_once(PthreadOnce* once_control, int PS4_SYSV_ABI posix_pthread_once(PthreadOnce* once_control,
void PS4_SYSV_ABI (*init_routine)()) { void PS4_SYSV_ABI (*init_routine)()) {
for (;;) { for (;;) {
@ -652,11 +644,9 @@ void RegisterThread(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("Jmi+9w9u0E4", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_create_name_np); LIB_FUNCTION("Jmi+9w9u0E4", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_create_name_np);
LIB_FUNCTION("lZzFeSxPl08", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_setcancelstate); LIB_FUNCTION("lZzFeSxPl08", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_setcancelstate);
LIB_FUNCTION("a2P9wYGeZvc", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_setprio); LIB_FUNCTION("a2P9wYGeZvc", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_setprio);
LIB_FUNCTION("9vyP6Z7bqzc", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_rename_np);
LIB_FUNCTION("FIs3-UQT9sg", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_getschedparam); LIB_FUNCTION("FIs3-UQT9sg", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_getschedparam);
LIB_FUNCTION("Xs9hdiD7sAA", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_setschedparam); LIB_FUNCTION("Xs9hdiD7sAA", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_setschedparam);
LIB_FUNCTION("6XG4B33N09g", "libScePosix", 1, "libkernel", 1, 1, sched_yield); LIB_FUNCTION("6XG4B33N09g", "libScePosix", 1, "libkernel", 1, 1, sched_yield);
LIB_FUNCTION("HoLVWNanBBc", "libScePosix", 1, "libkernel", 1, 1, posix_getpid);
// Posix-Kernel // Posix-Kernel
LIB_FUNCTION("Z4QosVuAsA0", "libkernel", 1, "libkernel", 1, 1, posix_pthread_once); LIB_FUNCTION("Z4QosVuAsA0", "libkernel", 1, "libkernel", 1, 1, posix_pthread_once);
@ -679,7 +669,6 @@ void RegisterThread(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("How7B8Oet6k", "libkernel", 1, "libkernel", 1, 1, ORBIS(posix_pthread_getname_np)); LIB_FUNCTION("How7B8Oet6k", "libkernel", 1, "libkernel", 1, 1, ORBIS(posix_pthread_getname_np));
LIB_FUNCTION("3kg7rT0NQIs", "libkernel", 1, "libkernel", 1, 1, posix_pthread_exit); LIB_FUNCTION("3kg7rT0NQIs", "libkernel", 1, "libkernel", 1, 1, posix_pthread_exit);
LIB_FUNCTION("aI+OeCz8xrQ", "libkernel", 1, "libkernel", 1, 1, posix_pthread_self); LIB_FUNCTION("aI+OeCz8xrQ", "libkernel", 1, "libkernel", 1, 1, posix_pthread_self);
LIB_FUNCTION("oxMp8uPqa+U", "libkernel", 1, "libkernel", 1, 1, posix_pthread_set_name_np);
LIB_FUNCTION("3PtV6p3QNX4", "libkernel", 1, "libkernel", 1, 1, posix_pthread_equal); LIB_FUNCTION("3PtV6p3QNX4", "libkernel", 1, "libkernel", 1, 1, posix_pthread_equal);
LIB_FUNCTION("T72hz6ffq08", "libkernel", 1, "libkernel", 1, 1, posix_pthread_yield); LIB_FUNCTION("T72hz6ffq08", "libkernel", 1, "libkernel", 1, 1, posix_pthread_yield);
LIB_FUNCTION("EI-5-jlq2dE", "libkernel", 1, "libkernel", 1, 1, posix_pthread_getthreadid_np); LIB_FUNCTION("EI-5-jlq2dE", "libkernel", 1, "libkernel", 1, 1, posix_pthread_getthreadid_np);
@ -687,7 +676,6 @@ void RegisterThread(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("W0Hpm2X0uPE", "libkernel", 1, "libkernel", 1, 1, ORBIS(posix_pthread_setprio)); LIB_FUNCTION("W0Hpm2X0uPE", "libkernel", 1, "libkernel", 1, 1, ORBIS(posix_pthread_setprio));
LIB_FUNCTION("rNhWz+lvOMU", "libkernel", 1, "libkernel", 1, 1, _sceKernelSetThreadDtors); LIB_FUNCTION("rNhWz+lvOMU", "libkernel", 1, "libkernel", 1, 1, _sceKernelSetThreadDtors);
LIB_FUNCTION("6XG4B33N09g", "libkernel", 1, "libkernel", 1, 1, sched_yield); LIB_FUNCTION("6XG4B33N09g", "libkernel", 1, "libkernel", 1, 1, sched_yield);
LIB_FUNCTION("HoLVWNanBBc", "libkernel", 1, "libkernel", 1, 1, posix_getpid);
LIB_FUNCTION("rcrVFJsQWRY", "libkernel", 1, "libkernel", 1, 1, ORBIS(scePthreadGetaffinity)); LIB_FUNCTION("rcrVFJsQWRY", "libkernel", 1, "libkernel", 1, 1, ORBIS(scePthreadGetaffinity));
LIB_FUNCTION("bt3CTBKmGyI", "libkernel", 1, "libkernel", 1, 1, ORBIS(scePthreadSetaffinity)); LIB_FUNCTION("bt3CTBKmGyI", "libkernel", 1, "libkernel", 1, 1, ORBIS(scePthreadSetaffinity));
} }

View File

@ -289,14 +289,10 @@ int PS4_SYSV_ABI scePthreadAttrSetaffinity(PthreadAttrT* attr, const u64 mask) {
void RegisterThreadAttr(Core::Loader::SymbolsResolver* sym) { void RegisterThreadAttr(Core::Loader::SymbolsResolver* sym) {
// Posix // Posix
LIB_FUNCTION("wtkt-teR1so", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_attr_init); LIB_FUNCTION("wtkt-teR1so", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_attr_init);
LIB_FUNCTION("vQm4fDEsWi8", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_attr_getstack);
LIB_FUNCTION("2Q0z6rnBrTE", "libScePosix", 1, "libkernel", 1, 1, LIB_FUNCTION("2Q0z6rnBrTE", "libScePosix", 1, "libkernel", 1, 1,
posix_pthread_attr_setstacksize); posix_pthread_attr_setstacksize);
LIB_FUNCTION("Ucsu-OK+els", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_attr_get_np);
LIB_FUNCTION("RtLRV-pBTTY", "libScePosix", 1, "libkernel", 1, 1, LIB_FUNCTION("RtLRV-pBTTY", "libScePosix", 1, "libkernel", 1, 1,
posix_pthread_attr_getschedpolicy); posix_pthread_attr_getschedpolicy);
LIB_FUNCTION("JarMIy8kKEY", "libkernel", 1, "libkernel", 1, 1,
posix_pthread_attr_setschedpolicy);
LIB_FUNCTION("E+tyo3lp5Lw", "libScePosix", 1, "libkernel", 1, 1, LIB_FUNCTION("E+tyo3lp5Lw", "libScePosix", 1, "libkernel", 1, 1,
posix_pthread_attr_setdetachstate); posix_pthread_attr_setdetachstate);
LIB_FUNCTION("zHchY8ft5pk", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_attr_destroy); LIB_FUNCTION("zHchY8ft5pk", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_attr_destroy);

View File

@ -261,7 +261,7 @@ s32 PS4_SYSV_ABI scePngDecQueryMemorySize(const OrbisPngDecCreateParam* param) {
return sizeof(PngHandler); return sizeof(PngHandler);
} }
void RegisterLib(Core::Loader::SymbolsResolver* sym) { void RegisterlibScePngDec(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("m0uW+8pFyaw", "libScePngDec", 1, "libScePngDec", 1, 1, scePngDecCreate); LIB_FUNCTION("m0uW+8pFyaw", "libScePngDec", 1, "libScePngDec", 1, 1, scePngDecCreate);
LIB_FUNCTION("WC216DD3El4", "libScePngDec", 1, "libScePngDec", 1, 1, scePngDecDecode); LIB_FUNCTION("WC216DD3El4", "libScePngDec", 1, "libScePngDec", 1, 1, scePngDecDecode);
LIB_FUNCTION("cJ--1xAbj-I", "libScePngDec", 1, "libScePngDec", 1, 1, LIB_FUNCTION("cJ--1xAbj-I", "libScePngDec", 1, "libScePngDec", 1, 1,

View File

@ -79,5 +79,5 @@ s32 PS4_SYSV_ABI scePngDecParseHeader(const OrbisPngDecParseParam* param,
OrbisPngDecImageInfo* imageInfo); OrbisPngDecImageInfo* imageInfo);
s32 PS4_SYSV_ABI scePngDecQueryMemorySize(const OrbisPngDecCreateParam* param); s32 PS4_SYSV_ABI scePngDecQueryMemorySize(const OrbisPngDecCreateParam* param);
void RegisterLib(Core::Loader::SymbolsResolver* sym); void RegisterlibScePngDec(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::PngDec } // namespace Libraries::PngDec

View File

@ -70,66 +70,66 @@ namespace Libraries {
void InitHLELibs(Core::Loader::SymbolsResolver* sym) { void InitHLELibs(Core::Loader::SymbolsResolver* sym) {
LOG_INFO(Lib_Kernel, "Initializing HLE libraries"); LOG_INFO(Lib_Kernel, "Initializing HLE libraries");
Libraries::Kernel::RegisterLib(sym); Libraries::Kernel::RegisterKernel(sym);
Libraries::GnmDriver::RegisterLib(sym); Libraries::GnmDriver::RegisterlibSceGnmDriver(sym);
Libraries::VideoOut::RegisterLib(sym); Libraries::VideoOut::RegisterLib(sym);
Libraries::UserService::RegisterLib(sym); Libraries::UserService::RegisterlibSceUserService(sym);
Libraries::SystemService::RegisterLib(sym); Libraries::SystemService::RegisterlibSceSystemService(sym);
Libraries::CommonDialog::RegisterLib(sym); Libraries::CommonDialog::RegisterlibSceCommonDialog(sym);
Libraries::MsgDialog::RegisterLib(sym); Libraries::MsgDialog::RegisterlibSceMsgDialog(sym);
Libraries::AudioOut::RegisterLib(sym); Libraries::AudioOut::RegisterlibSceAudioOut(sym);
Libraries::Http::RegisterLib(sym); Libraries::Http::RegisterlibSceHttp(sym);
Libraries::Http2::RegisterLib(sym); Libraries::Http2::RegisterlibSceHttp2(sym);
Libraries::Net::RegisterLib(sym); Libraries::Net::RegisterlibSceNet(sym);
Libraries::NetCtl::RegisterLib(sym); Libraries::NetCtl::RegisterlibSceNetCtl(sym);
Libraries::SaveData::RegisterLib(sym); Libraries::SaveData::RegisterlibSceSaveData(sym);
Libraries::SaveData::Dialog::RegisterLib(sym); Libraries::SaveData::Dialog::RegisterlibSceSaveDataDialog(sym);
Libraries::Ssl::RegisterLib(sym); Libraries::Ssl::RegisterlibSceSsl(sym);
Libraries::Ssl2::RegisterLib(sym); Libraries::Ssl2::RegisterlibSceSsl2(sym);
Libraries::SysModule::RegisterLib(sym); Libraries::SysModule::RegisterlibSceSysmodule(sym);
Libraries::Posix::RegisterLib(sym); Libraries::Posix::Registerlibsceposix(sym);
Libraries::AudioIn::RegisterLib(sym); Libraries::AudioIn::RegisterlibSceAudioIn(sym);
Libraries::NpCommon::RegisterLib(sym); Libraries::NpCommon::RegisterlibSceNpCommon(sym);
Libraries::NpManager::RegisterLib(sym); Libraries::NpManager::RegisterlibSceNpManager(sym);
Libraries::NpScore::RegisterLib(sym); Libraries::NpScore::RegisterlibSceNpScore(sym);
Libraries::NpTrophy::RegisterLib(sym); Libraries::NpTrophy::RegisterlibSceNpTrophy(sym);
Libraries::NpWebApi::RegisterLib(sym); Libraries::NpWebApi::RegisterlibSceNpWebApi(sym);
Libraries::NpAuth::RegisterLib(sym); Libraries::NpAuth::RegisterlibSceNpAuth(sym);
Libraries::ScreenShot::RegisterLib(sym); Libraries::ScreenShot::RegisterlibSceScreenShot(sym);
Libraries::AppContent::RegisterLib(sym); Libraries::AppContent::RegisterlibSceAppContent(sym);
Libraries::PngDec::RegisterLib(sym); Libraries::PngDec::RegisterlibScePngDec(sym);
Libraries::PlayGo::RegisterLib(sym); Libraries::PlayGo::RegisterlibScePlayGo(sym);
Libraries::PlayGo::Dialog::RegisterLib(sym); Libraries::PlayGo::Dialog::RegisterlibScePlayGoDialog(sym);
Libraries::Random::RegisterLib(sym); Libraries::Random::RegisterlibSceRandom(sym);
Libraries::Usbd::RegisterLib(sym); Libraries::Usbd::RegisterlibSceUsbd(sym);
Libraries::Pad::RegisterLib(sym); Libraries::Pad::RegisterlibScePad(sym);
Libraries::Ajm::RegisterLib(sym); Libraries::Ajm::RegisterlibSceAjm(sym);
Libraries::ErrorDialog::RegisterLib(sym); Libraries::ErrorDialog::RegisterlibSceErrorDialog(sym);
Libraries::ImeDialog::RegisterLib(sym); Libraries::ImeDialog::RegisterlibSceImeDialog(sym);
Libraries::AvPlayer::RegisterLib(sym); Libraries::AvPlayer::RegisterlibSceAvPlayer(sym);
Libraries::Vdec2::RegisterLib(sym); Libraries::Vdec2::RegisterlibSceVdec2(sym);
Libraries::Audio3d::RegisterLib(sym); Libraries::Audio3d::RegisterlibSceAudio3d(sym);
Libraries::Ime::RegisterLib(sym); Libraries::Ime::RegisterlibSceIme(sym);
Libraries::GameLiveStreaming::RegisterLib(sym); Libraries::GameLiveStreaming::RegisterlibSceGameLiveStreaming(sym);
Libraries::SharePlay::RegisterLib(sym); Libraries::SharePlay::RegisterlibSceSharePlay(sym);
Libraries::Remoteplay::RegisterLib(sym); Libraries::Remoteplay::RegisterlibSceRemoteplay(sym);
Libraries::Videodec::RegisterLib(sym); Libraries::Videodec::RegisterlibSceVideodec(sym);
Libraries::RazorCpu::RegisterLib(sym); Libraries::RazorCpu::RegisterlibSceRazorCpu(sym);
Libraries::Move::RegisterLib(sym); Libraries::Move::RegisterlibSceMove(sym);
Libraries::Fiber::RegisterLib(sym); Libraries::Fiber::RegisterlibSceFiber(sym);
Libraries::JpegEnc::RegisterLib(sym); Libraries::JpegEnc::RegisterlibSceJpegEnc(sym);
Libraries::Mouse::RegisterLib(sym); Libraries::Mouse::RegisterlibSceMouse(sym);
Libraries::WebBrowserDialog::RegisterLib(sym); Libraries::WebBrowserDialog::RegisterlibSceWebBrowserDialog(sym);
Libraries::NpParty::RegisterLib(sym); Libraries::NpParty::RegisterlibSceNpParty(sym);
Libraries::Zlib::RegisterLib(sym); Libraries::Zlib::RegisterlibSceZlib(sym);
Libraries::Hmd::RegisterLib(sym); Libraries::Hmd::RegisterlibSceHmd(sym);
Libraries::DiscMap::RegisterLib(sym); Libraries::DiscMap::RegisterlibSceDiscMap(sym);
Libraries::Ulobjmgr::RegisterLib(sym); Libraries::Ulobjmgr::RegisterlibSceUlobjmgr(sym);
Libraries::SigninDialog::RegisterLib(sym); Libraries::SigninDialog::RegisterlibSceSigninDialog(sym);
Libraries::Camera::RegisterLib(sym); Libraries::Camera::RegisterlibSceCamera(sym);
Libraries::CompanionHttpd::RegisterLib(sym); Libraries::CompanionHttpd::RegisterlibSceCompanionHttpd(sym);
Libraries::CompanionUtil::RegisterLib(sym); Libraries::CompanionUtil::RegisterlibSceCompanionUtil(sym);
Libraries::Voice::RegisterLib(sym); Libraries::Voice::RegisterlibSceVoice(sym);
} }
} // namespace Libraries } // namespace Libraries

View File

@ -79,7 +79,7 @@ int PS4_SYSV_ABI sceMouseSetProcessPrivilege() {
return ORBIS_OK; return ORBIS_OK;
} }
void RegisterLib(Core::Loader::SymbolsResolver* sym) { void RegisterlibSceMouse(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("cAnT0Rw-IwU", "libSceMouse", 1, "libSceMouse", 1, 1, sceMouseClose); LIB_FUNCTION("cAnT0Rw-IwU", "libSceMouse", 1, "libSceMouse", 1, 1, sceMouseClose);
LIB_FUNCTION("Ymyy1HSSJLQ", "libSceMouse", 1, "libSceMouse", 1, 1, sceMouseConnectPort); LIB_FUNCTION("Ymyy1HSSJLQ", "libSceMouse", 1, "libSceMouse", 1, 1, sceMouseConnectPort);
LIB_FUNCTION("BRXOoXQtb+k", "libSceMouse", 1, "libSceMouse", 1, 1, sceMouseDebugGetDeviceId); LIB_FUNCTION("BRXOoXQtb+k", "libSceMouse", 1, "libSceMouse", 1, 1, sceMouseDebugGetDeviceId);

View File

@ -25,5 +25,5 @@ int PS4_SYSV_ABI sceMouseSetHandType();
int PS4_SYSV_ABI sceMouseSetPointerSpeed(); int PS4_SYSV_ABI sceMouseSetPointerSpeed();
int PS4_SYSV_ABI sceMouseSetProcessPrivilege(); int PS4_SYSV_ABI sceMouseSetProcessPrivilege();
void RegisterLib(Core::Loader::SymbolsResolver* sym); void RegisterlibSceMouse(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::Mouse } // namespace Libraries::Mouse

View File

@ -38,7 +38,7 @@ int PS4_SYSV_ABI sceMoveInit() {
return ORBIS_OK; return ORBIS_OK;
} }
void RegisterLib(Core::Loader::SymbolsResolver* sym) { void RegisterlibSceMove(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("HzC60MfjJxU", "libSceMove", 1, "libSceMove", 1, 1, sceMoveOpen); LIB_FUNCTION("HzC60MfjJxU", "libSceMove", 1, "libSceMove", 1, 1, sceMoveOpen);
LIB_FUNCTION("GWXTyxs4QbE", "libSceMove", 1, "libSceMove", 1, 1, sceMoveGetDeviceInfo); LIB_FUNCTION("GWXTyxs4QbE", "libSceMove", 1, "libSceMove", 1, 1, sceMoveGetDeviceInfo);
LIB_FUNCTION("ttU+JOhShl4", "libSceMove", 1, "libSceMove", 1, 1, sceMoveReadStateLatest); LIB_FUNCTION("ttU+JOhShl4", "libSceMove", 1, "libSceMove", 1, 1, sceMoveReadStateLatest);

View File

@ -17,5 +17,5 @@ int PS4_SYSV_ABI sceMoveReadStateRecent();
int PS4_SYSV_ABI sceMoveTerm(); int PS4_SYSV_ABI sceMoveTerm();
int PS4_SYSV_ABI sceMoveInit(); int PS4_SYSV_ABI sceMoveInit();
void RegisterLib(Core::Loader::SymbolsResolver* sym); void RegisterlibSceMove(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::Move } // namespace Libraries::Move

View File

@ -186,7 +186,7 @@ int PS4_SYSV_ABI sceHttpGetAcceptEncodingGZIPEnabled() {
int PS4_SYSV_ABI sceHttpGetAllResponseHeaders() { int PS4_SYSV_ABI sceHttpGetAllResponseHeaders() {
LOG_ERROR(Lib_Http, "(STUBBED) called"); LOG_ERROR(Lib_Http, "(STUBBED) called");
return ORBIS_FAIL; return ORBIS_OK;
} }
int PS4_SYSV_ABI sceHttpGetAuthEnabled() { int PS4_SYSV_ABI sceHttpGetAuthEnabled() {
@ -492,9 +492,8 @@ int PS4_SYSV_ABI sceHttpsFreeCaList() {
return ORBIS_OK; return ORBIS_OK;
} }
int PS4_SYSV_ABI sceHttpsGetCaList(int httpCtxId, OrbisHttpsCaList* list) { int PS4_SYSV_ABI sceHttpsGetCaList() {
LOG_ERROR(Lib_Http, "(DUMMY) called, httpCtxId = {}", httpCtxId); LOG_ERROR(Lib_Http, "(STUBBED) called");
list->certsNum = 0;
return ORBIS_OK; return ORBIS_OK;
} }
@ -848,7 +847,7 @@ int PS4_SYSV_ABI sceHttpWaitRequest() {
return ORBIS_OK; return ORBIS_OK;
} }
void RegisterLib(Core::Loader::SymbolsResolver* sym) { void RegisterlibSceHttp(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("hvG6GfBMXg8", "libSceHttp", 1, "libSceHttp", 1, 1, sceHttpAbortRequest); LIB_FUNCTION("hvG6GfBMXg8", "libSceHttp", 1, "libSceHttp", 1, 1, sceHttpAbortRequest);
LIB_FUNCTION("JKl06ZIAl6A", "libSceHttp", 1, "libSceHttp", 1, 1, sceHttpAbortRequestForce); LIB_FUNCTION("JKl06ZIAl6A", "libSceHttp", 1, "libSceHttp", 1, 1, sceHttpAbortRequestForce);
LIB_FUNCTION("sWQiqKvYTVA", "libSceHttp", 1, "libSceHttp", 1, 1, sceHttpAbortWaitRequest); LIB_FUNCTION("sWQiqKvYTVA", "libSceHttp", 1, "libSceHttp", 1, 1, sceHttpAbortWaitRequest);

View File

@ -4,7 +4,6 @@
#pragma once #pragma once
#include "common/types.h" #include "common/types.h"
#include "core/libraries/network/ssl.h"
namespace Core::Loader { namespace Core::Loader {
class SymbolsResolver; class SymbolsResolver;
@ -25,8 +24,6 @@ struct OrbisHttpUriElement {
u8 reserved[10]; u8 reserved[10];
}; };
using OrbisHttpsCaList = Libraries::Ssl::OrbisSslCaList;
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();
@ -123,7 +120,7 @@ int PS4_SYSV_ABI sceHttpSetResponseHeaderMaxSize();
int PS4_SYSV_ABI sceHttpSetSendTimeOut(); int PS4_SYSV_ABI sceHttpSetSendTimeOut();
int PS4_SYSV_ABI sceHttpSetSocketCreationCallback(); int PS4_SYSV_ABI sceHttpSetSocketCreationCallback();
int PS4_SYSV_ABI sceHttpsFreeCaList(); int PS4_SYSV_ABI sceHttpsFreeCaList();
int PS4_SYSV_ABI sceHttpsGetCaList(int httpCtxId, OrbisHttpsCaList* list); int PS4_SYSV_ABI sceHttpsGetCaList();
int PS4_SYSV_ABI sceHttpsGetSslError(); int PS4_SYSV_ABI sceHttpsGetSslError();
int PS4_SYSV_ABI sceHttpsLoadCert(); int PS4_SYSV_ABI sceHttpsLoadCert();
int PS4_SYSV_ABI sceHttpsSetMinSslVersion(); int PS4_SYSV_ABI sceHttpsSetMinSslVersion();
@ -144,5 +141,5 @@ int PS4_SYSV_ABI sceHttpUriSweepPath(char* dst, const char* src, size_t srcSize)
int PS4_SYSV_ABI sceHttpUriUnescape(char* out, size_t* require, size_t prepare, const char* in); int PS4_SYSV_ABI sceHttpUriUnescape(char* out, size_t* require, size_t prepare, const char* in);
int PS4_SYSV_ABI sceHttpWaitRequest(); int PS4_SYSV_ABI sceHttpWaitRequest();
void RegisterLib(Core::Loader::SymbolsResolver* sym); void RegisterlibSceHttp(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::Http } // namespace Libraries::Http

View File

@ -289,7 +289,7 @@ int PS4_SYSV_ABI sceHttp2WaitAsync() {
return ORBIS_OK; return ORBIS_OK;
} }
void RegisterLib(Core::Loader::SymbolsResolver* sym) { void RegisterlibSceHttp2(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("AS45QoYHjc4", "libSceHttp2", 1, "libSceHttp2", 1, 1, _Z5dummyv); LIB_FUNCTION("AS45QoYHjc4", "libSceHttp2", 1, "libSceHttp2", 1, 1, _Z5dummyv);
LIB_FUNCTION("IZ-qjhRqvjk", "libSceHttp2", 1, "libSceHttp2", 1, 1, sceHttp2AbortRequest); LIB_FUNCTION("IZ-qjhRqvjk", "libSceHttp2", 1, "libSceHttp2", 1, 1, sceHttp2AbortRequest);
LIB_FUNCTION("flPxnowtvWY", "libSceHttp2", 1, "libSceHttp2", 1, 1, sceHttp2AddCookie); LIB_FUNCTION("flPxnowtvWY", "libSceHttp2", 1, "libSceHttp2", 1, 1, sceHttp2AddCookie);

View File

@ -68,5 +68,5 @@ int PS4_SYSV_ABI sceHttp2SslEnableOption();
int PS4_SYSV_ABI sceHttp2Term(); int PS4_SYSV_ABI sceHttp2Term();
int PS4_SYSV_ABI sceHttp2WaitAsync(); int PS4_SYSV_ABI sceHttp2WaitAsync();
void RegisterLib(Core::Loader::SymbolsResolver* sym); void RegisterlibSceHttp2(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::Http2 } // namespace Libraries::Http2

View File

@ -20,7 +20,6 @@
#include "net_error.h" #include "net_error.h"
#include "net_util.h" #include "net_util.h"
#include "netctl.h" #include "netctl.h"
#include "sockets.h"
#include "sys_net.h" #include "sys_net.h"
namespace Libraries::Net { namespace Libraries::Net {
@ -29,17 +28,6 @@ static thread_local int32_t net_errno = 0;
static bool g_isNetInitialized = true; // TODO init it properly static bool g_isNetInitialized = true; // TODO init it properly
static int ConvertFamilies(int family) {
switch (family) {
case ORBIS_NET_AF_INET:
return AF_INET;
case ORBIS_NET_AF_INET6:
return AF_INET6;
default:
UNREACHABLE_MSG("unsupported socket family {}", family);
}
}
int PS4_SYSV_ABI in6addr_any() { int PS4_SYSV_ABI in6addr_any() {
LOG_ERROR(Lib_Net, "(STUBBED) called"); LOG_ERROR(Lib_Net, "(STUBBED) called");
return ORBIS_OK; return ORBIS_OK;
@ -983,7 +971,7 @@ u64 strlcpy(char* dst, const char* src, u64 size) {
#endif #endif
const char* freebsd_inet_ntop4(const unsigned char* src, char* dst, u64 size) { const char* freebsd_inet_ntop4(const char* src, char* dst, u64 size) {
static const char fmt[] = "%u.%u.%u.%u"; static const char fmt[] = "%u.%u.%u.%u";
char tmp[sizeof "255.255.255.255"]; char tmp[sizeof "255.255.255.255"];
int l; int l;
@ -996,7 +984,7 @@ const char* freebsd_inet_ntop4(const unsigned char* src, char* dst, u64 size) {
return (dst); return (dst);
} }
const char* freebsd_inet_ntop6(const unsigned char* src, char* dst, u64 size) { const char* freebsd_inet_ntop6(const char* src, char* dst, u64 size) {
/* /*
* Note that int32_t and int16_t need only be "at least" large enough * Note that int32_t and int16_t need only be "at least" large enough
* to contain a value of the specified size. On some systems, like * to contain a value of the specified size. On some systems, like
@ -1094,10 +1082,10 @@ const char* PS4_SYSV_ABI sceNetInetNtop(int af, const void* src, char* dst, u32
const char* returnvalue = nullptr; const char* returnvalue = nullptr;
switch (af) { switch (af) {
case ORBIS_NET_AF_INET: case ORBIS_NET_AF_INET:
returnvalue = freebsd_inet_ntop4((const unsigned char*)src, dst, size); returnvalue = freebsd_inet_ntop4((const char*)src, dst, size);
break; break;
case ORBIS_NET_AF_INET6: case ORBIS_NET_AF_INET6:
returnvalue = freebsd_inet_ntop6((const unsigned char*)src, dst, size); returnvalue = freebsd_inet_ntop6((const char*)src, dst, size);
break; break;
default: default:
*sceNetErrnoLoc() = ORBIS_NET_EAFNOSUPPORT; *sceNetErrnoLoc() = ORBIS_NET_EAFNOSUPPORT;
@ -1118,19 +1106,19 @@ int PS4_SYSV_ABI sceNetInetNtopWithScopeId() {
int PS4_SYSV_ABI sceNetInetPton(int af, const char* src, void* dst) { int PS4_SYSV_ABI sceNetInetPton(int af, const char* src, void* dst) {
#ifdef WIN32 #ifdef WIN32
int res = InetPtonA(ConvertFamilies(af), src, dst); int res = InetPtonA(af, src, dst);
#else #else
int res = inet_pton(ConvertFamilies(af), src, dst); int res = inet_pton(af, src, dst);
#endif #endif
if (res < 0) { if (res < 0) {
UNREACHABLE_MSG("af = {}, src = {}, dst = {}", af, src, fmt::ptr(dst)); UNREACHABLE();
} }
return res; return res;
} }
int PS4_SYSV_ABI sceNetInetPtonEx(int af, const char* src, void* dst, int flags) { int PS4_SYSV_ABI sceNetInetPtonEx() {
LOG_WARNING(Lib_Net, "ignored flags, redirecting to sceNetInetPton"); LOG_ERROR(Lib_Net, "(STUBBED) called");
return sceNetInetPton(af, src, dst); return ORBIS_OK;
} }
int PS4_SYSV_ABI sceNetInetPtonWithScopeId() { int PS4_SYSV_ABI sceNetInetPtonWithScopeId() {
@ -1400,13 +1388,12 @@ int PS4_SYSV_ABI sceNetResolverConnectDestroy() {
return ORBIS_OK; return ORBIS_OK;
} }
int PS4_SYSV_ABI sceNetResolverCreate(const char* name, int poolid, int flags) { int PS4_SYSV_ABI sceNetResolverCreate() {
LOG_ERROR(Lib_Net, "(STUBBED) called, name = {}, poolid = {}, flags = {}", name, poolid, flags); LOG_ERROR(Lib_Net, "(STUBBED) called");
static int id = 1; return ORBIS_OK;
return id++;
} }
int PS4_SYSV_ABI sceNetResolverDestroy(OrbisNetId resolverid) { int PS4_SYSV_ABI sceNetResolverDestroy() {
LOG_ERROR(Lib_Net, "(STUBBED) called"); LOG_ERROR(Lib_Net, "(STUBBED) called");
return ORBIS_OK; return ORBIS_OK;
} }
@ -1426,43 +1413,9 @@ int PS4_SYSV_ABI sceNetResolverStartAton6() {
return ORBIS_OK; return ORBIS_OK;
} }
int PS4_SYSV_ABI sceNetResolverStartNtoa(OrbisNetId resolverid, const char* hostname, int PS4_SYSV_ABI sceNetResolverStartNtoa() {
OrbisNetInAddr* addr, int timeout, int retry, int flags) { LOG_ERROR(Lib_Net, "(STUBBED) called");
LOG_INFO(Lib_Net, return ORBIS_OK;
"called, resolverid = {}, hostname = {}, timeout = {}, retry = {}, flags = {}",
resolverid, hostname, timeout, retry, flags);
if ((flags & ORBIS_NET_RESOLVER_ASYNC) != 0) {
// moves processing to EpollWait
LOG_ERROR(Lib_Net, "async resolution is not implemented");
*sceNetErrnoLoc() = ORBIS_NET_RESOLVER_EINTERNAL;
auto ret = -ORBIS_NET_RESOLVER_EINTERNAL | ORBIS_NET_ERROR_BASE;
return ret;
}
const addrinfo hints = {
.ai_flags = AI_V4MAPPED | AI_ADDRCONFIG,
.ai_family = AF_INET,
};
addrinfo* info = nullptr;
auto gai_result = getaddrinfo(hostname, nullptr, &hints, &info);
auto ret = ORBIS_OK;
if (gai_result != 0) {
// handle more errors
LOG_ERROR(Lib_Net, "address resolution for {} failed: {}", hostname, gai_result);
*sceNetErrnoLoc() = ORBIS_NET_ERETURN;
ret = -ORBIS_NET_ERETURN | ORBIS_NET_ERROR_BASE;
} else {
ASSERT(info && info->ai_addr);
in_addr resolved_addr = ((sockaddr_in*)info->ai_addr)->sin_addr;
LOG_DEBUG(Lib_Net, "resolved address for {}: {}", hostname, inet_ntoa(resolved_addr));
addr->inaddr_addr = resolved_addr.s_addr;
}
freeaddrinfo(info);
return ret;
} }
int PS4_SYSV_ABI sceNetResolverStartNtoa6() { int PS4_SYSV_ABI sceNetResolverStartNtoa6() {
@ -1470,21 +1423,9 @@ int PS4_SYSV_ABI sceNetResolverStartNtoa6() {
return ORBIS_OK; return ORBIS_OK;
} }
int PS4_SYSV_ABI sceNetResolverStartNtoaMultipleRecords(OrbisNetId resolverid, const char* hostname, int PS4_SYSV_ABI sceNetResolverStartNtoaMultipleRecords() {
OrbisNetResolverInfo* info, int timeout, LOG_ERROR(Lib_Net, "(STUBBED) called");
int retry, int flags) { return ORBIS_OK;
LOG_WARNING(Lib_Net, "redirected to sceNetResolverStartNtoa");
OrbisNetInAddr addr{};
auto result = sceNetResolverStartNtoa(resolverid, hostname, &addr, timeout, retry, flags);
if (result == ORBIS_OK) {
info->addrs[0] = {.u = {.addr = addr}, .af = ORBIS_NET_AF_INET};
info->records = 1;
info->recordsv4 = 1;
}
return result;
} }
int PS4_SYSV_ABI sceNetResolverStartNtoaMultipleRecordsEx() { int PS4_SYSV_ABI sceNetResolverStartNtoaMultipleRecordsEx() {
@ -2001,7 +1942,7 @@ int PS4_SYSV_ABI sceNetEmulationSet() {
return ORBIS_OK; return ORBIS_OK;
} }
void RegisterLib(Core::Loader::SymbolsResolver* sym) { void RegisterlibSceNet(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("ZRAJo-A-ukc", "libSceNet", 1, "libSceNet", 1, 1, in6addr_any); LIB_FUNCTION("ZRAJo-A-ukc", "libSceNet", 1, "libSceNet", 1, 1, in6addr_any);
LIB_FUNCTION("XCuA-GqjA-k", "libSceNet", 1, "libSceNet", 1, 1, in6addr_loopback); LIB_FUNCTION("XCuA-GqjA-k", "libSceNet", 1, "libSceNet", 1, 1, in6addr_loopback);
LIB_FUNCTION("VZgoeBxPXUQ", "libSceNet", 1, "libSceNet", 1, 1, sce_net_dummy); LIB_FUNCTION("VZgoeBxPXUQ", "libSceNet", 1, "libSceNet", 1, 1, sce_net_dummy);

View File

@ -81,25 +81,6 @@ enum OrbisNetSocketOption : u32 {
ORBIS_NET_SO_PRIORITY = 0x1203 ORBIS_NET_SO_PRIORITY = 0x1203
}; };
enum OrbisNetEpollFlag : u32 {
ORBIS_NET_EPOLL_CTL_ADD = 1,
ORBIS_NET_EPOLL_CTL_MOD = 2,
ORBIS_NET_EPOLL_CTL_DEL = 3,
};
enum OrbisNetEpollEvents : u32 {
ORBIS_NET_EPOLLIN = 0x1,
ORBIS_NET_EPOLLOUT = 0x2,
ORBIS_NET_EPOLLERR = 0x8,
ORBIS_NET_EPOLLHUP = 0x10,
ORBIS_NET_EPOLLDESCID = 0x10000,
};
enum OrbisNetResolverFlag : u32 {
ORBIS_NET_RESOLVER_ASYNC = 0x1,
ORBIS_NET_RESOLVER_START_NTOA_DISABLE_IPADDRESS = 0x10000,
};
using OrbisNetId = s32; using OrbisNetId = s32;
struct OrbisNetSockaddr { struct OrbisNetSockaddr {
@ -117,12 +98,6 @@ struct OrbisNetSockaddrIn {
char sin_zero[6]; char sin_zero[6];
}; };
using OrbisNetInAddr_t = u32;
struct OrbisNetInAddr {
OrbisNetInAddr_t inaddr_addr;
};
struct OrbisNetIovec { struct OrbisNetIovec {
void* iov_base; void* iov_base;
u64 iov_len; u64 iov_len;
@ -138,38 +113,6 @@ struct OrbisNetMsghdr {
int msg_flags; int msg_flags;
}; };
union OrbisNetEpollData {
void* ptr;
u32 data_u32;
int fd;
u64 data_u64;
};
struct OrbisNetEpollEvent {
u32 events;
u32 pad;
u64 ident;
OrbisNetEpollData data;
};
union OrbisNetAddrUnion {
OrbisNetInAddr addr;
u8 addr6[16];
};
struct OrbisNetResolverAddr {
OrbisNetAddrUnion u;
u32 af;
u32 pad[3];
};
struct OrbisNetResolverInfo {
OrbisNetResolverAddr addrs[10];
u32 records;
u32 recordsv4;
u32 pad[14];
};
int PS4_SYSV_ABI in6addr_any(); int PS4_SYSV_ABI in6addr_any();
int PS4_SYSV_ABI in6addr_loopback(); int PS4_SYSV_ABI in6addr_loopback();
int PS4_SYSV_ABI sce_net_dummy(); int PS4_SYSV_ABI sce_net_dummy();
@ -313,7 +256,7 @@ u16 PS4_SYSV_ABI sceNetHtons(u16 host16);
const char* PS4_SYSV_ABI sceNetInetNtop(int af, const void* src, char* dst, u32 size); const char* PS4_SYSV_ABI sceNetInetNtop(int af, const void* src, char* dst, u32 size);
int PS4_SYSV_ABI sceNetInetNtopWithScopeId(); int PS4_SYSV_ABI sceNetInetNtopWithScopeId();
int PS4_SYSV_ABI sceNetInetPton(int af, const char* src, void* dst); int PS4_SYSV_ABI sceNetInetPton(int af, const char* src, void* dst);
int PS4_SYSV_ABI sceNetInetPtonEx(int af, const char* src, void* dst, int flags); int PS4_SYSV_ABI sceNetInetPtonEx();
int PS4_SYSV_ABI sceNetInetPtonWithScopeId(); int PS4_SYSV_ABI sceNetInetPtonWithScopeId();
int PS4_SYSV_ABI sceNetInfoDumpStart(); int PS4_SYSV_ABI sceNetInfoDumpStart();
int PS4_SYSV_ABI sceNetInfoDumpStop(); int PS4_SYSV_ABI sceNetInfoDumpStop();
@ -339,17 +282,14 @@ int PS4_SYSV_ABI sceNetResolverConnect();
int PS4_SYSV_ABI sceNetResolverConnectAbort(); int PS4_SYSV_ABI sceNetResolverConnectAbort();
int PS4_SYSV_ABI sceNetResolverConnectCreate(); int PS4_SYSV_ABI sceNetResolverConnectCreate();
int PS4_SYSV_ABI sceNetResolverConnectDestroy(); int PS4_SYSV_ABI sceNetResolverConnectDestroy();
int PS4_SYSV_ABI sceNetResolverCreate(const char* name, int poolid, int flags); int PS4_SYSV_ABI sceNetResolverCreate();
int PS4_SYSV_ABI sceNetResolverDestroy(OrbisNetId resolverid); int PS4_SYSV_ABI sceNetResolverDestroy();
int PS4_SYSV_ABI sceNetResolverGetError(); int PS4_SYSV_ABI sceNetResolverGetError();
int PS4_SYSV_ABI sceNetResolverStartAton(); int PS4_SYSV_ABI sceNetResolverStartAton();
int PS4_SYSV_ABI sceNetResolverStartAton6(); int PS4_SYSV_ABI sceNetResolverStartAton6();
int PS4_SYSV_ABI sceNetResolverStartNtoa(OrbisNetId resolverid, const char* hostname, int PS4_SYSV_ABI sceNetResolverStartNtoa();
OrbisNetInAddr* addr, int timeout, int retry, int flags);
int PS4_SYSV_ABI sceNetResolverStartNtoa6(); int PS4_SYSV_ABI sceNetResolverStartNtoa6();
int PS4_SYSV_ABI sceNetResolverStartNtoaMultipleRecords(OrbisNetId resolverid, const char* hostname, int PS4_SYSV_ABI sceNetResolverStartNtoaMultipleRecords();
OrbisNetResolverInfo* info, int timeout,
int retry, int flags);
int PS4_SYSV_ABI sceNetResolverStartNtoaMultipleRecordsEx(); int PS4_SYSV_ABI sceNetResolverStartNtoaMultipleRecordsEx();
int PS4_SYSV_ABI sceNetSend(OrbisNetId s, const void* buf, u64 len, int flags); int PS4_SYSV_ABI sceNetSend(OrbisNetId s, const void* buf, u64 len, int flags);
int PS4_SYSV_ABI sceNetSendmsg(OrbisNetId s, const OrbisNetMsghdr* msg, int flags); int PS4_SYSV_ABI sceNetSendmsg(OrbisNetId s, const OrbisNetMsghdr* msg, int flags);
@ -396,5 +336,5 @@ int PS4_SYSV_ABI Func_0E707A589F751C68();
int PS4_SYSV_ABI sceNetEmulationGet(); int PS4_SYSV_ABI sceNetEmulationGet();
int PS4_SYSV_ABI sceNetEmulationSet(); int PS4_SYSV_ABI sceNetEmulationSet();
void RegisterLib(Core::Loader::SymbolsResolver* sym); void RegisterlibSceNet(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::Net } // namespace Libraries::Net

View File

@ -2,8 +2,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include <algorithm> #include <algorithm>
#include "common/config.h"
#include "common/logging/log.h"
#include "core/libraries/network/net_ctl_codes.h" #include "core/libraries/network/net_ctl_codes.h"
#include "core/libraries/network/net_ctl_obj.h" #include "core/libraries/network/net_ctl_obj.h"
#include "core/tls.h" #include "core/tls.h"
@ -46,22 +44,18 @@ s32 NetCtlInternal::RegisterNpToolkitCallback(OrbisNetCtlCallbackForNpToolkit fu
void NetCtlInternal::CheckCallback() { void NetCtlInternal::CheckCallback() {
std::scoped_lock lock{m_mutex}; std::scoped_lock lock{m_mutex};
const auto event = Config::getIsConnectedToNetwork() ? ORBIS_NET_CTL_EVENT_TYPE_IPOBTAINED
: ORBIS_NET_CTL_EVENT_TYPE_DISCONNECTED;
for (const auto [func, arg] : callbacks) { for (const auto [func, arg] : callbacks) {
if (func != nullptr) { if (func != nullptr) {
Core::ExecuteGuest(func, event, arg); Core::ExecuteGuest(func, ORBIS_NET_CTL_EVENT_TYPE_DISCONNECTED, arg);
} }
} }
} }
void NetCtlInternal::CheckNpToolkitCallback() { void NetCtlInternal::CheckNpToolkitCallback() {
std::scoped_lock lock{m_mutex}; std::scoped_lock lock{m_mutex};
const auto event = Config::getIsConnectedToNetwork() ? ORBIS_NET_CTL_EVENT_TYPE_IPOBTAINED
: ORBIS_NET_CTL_EVENT_TYPE_DISCONNECTED;
for (const auto [func, arg] : nptool_callbacks) { for (const auto [func, arg] : nptool_callbacks) {
if (func != nullptr) { if (func != nullptr) {
Core::ExecuteGuest(func, event, arg); Core::ExecuteGuest(func, ORBIS_NET_CTL_EVENT_TYPE_DISCONNECTED, arg);
} }
} }
} }

View File

@ -11,7 +11,6 @@ typedef int socklen_t;
#else #else
#include <cerrno> #include <cerrno>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <ifaddrs.h>
#include <net/if.h> #include <net/if.h>
#include <netdb.h> #include <netdb.h>
#include <netinet/in.h> #include <netinet/in.h>
@ -22,13 +21,8 @@ typedef int socklen_t;
typedef int net_socket; typedef int net_socket;
#endif #endif
#if defined(__APPLE__) #if defined(__APPLE__)
#include <ifaddrs.h>
#include <net/if_dl.h> #include <net/if_dl.h>
#include <net/route.h>
#endif
#if __linux__
#include <fstream>
#include <iostream>
#include <sstream>
#endif #endif
#include <map> #include <map>
@ -106,8 +100,6 @@ bool NetUtilInternal::RetrieveEthernetAddr() {
} }
} }
close(sock);
if (success) { if (success) {
memcpy(ether_address.data(), ifr.ifr_hwaddr.sa_data, 6); memcpy(ether_address.data(), ifr.ifr_hwaddr.sa_data, 6);
return true; return true;
@ -115,201 +107,4 @@ bool NetUtilInternal::RetrieveEthernetAddr() {
#endif #endif
return false; return false;
} }
const std::string& NetUtilInternal::GetDefaultGateway() const {
return default_gateway;
}
bool NetUtilInternal::RetrieveDefaultGateway() {
std::scoped_lock lock{m_mutex};
#ifdef _WIN32
ULONG flags = GAA_FLAG_INCLUDE_GATEWAYS;
ULONG family = AF_INET; // Only IPv4
ULONG buffer_size = 15000;
std::vector<BYTE> buffer(buffer_size);
PIP_ADAPTER_ADDRESSES adapter_addresses =
reinterpret_cast<PIP_ADAPTER_ADDRESSES>(buffer.data());
DWORD result = GetAdaptersAddresses(family, flags, nullptr, adapter_addresses, &buffer_size);
if (result != NO_ERROR) {
return false;
}
for (PIP_ADAPTER_ADDRESSES adapter = adapter_addresses; adapter != nullptr;
adapter = adapter->Next) {
if (adapter->OperStatus != IfOperStatusUp)
continue;
IP_ADAPTER_GATEWAY_ADDRESS_LH* gateway = adapter->FirstGatewayAddress;
while (gateway) {
sockaddr* sa = gateway->Address.lpSockaddr;
if (sa->sa_family == AF_INET) {
char str[INET_ADDRSTRLEN];
sockaddr_in* sa_in = reinterpret_cast<sockaddr_in*>(sa);
if (inet_ntop(AF_INET, &sa_in->sin_addr, str, sizeof(str))) {
this->default_gateway = str;
return true;
}
}
gateway = gateway->Next;
}
}
return false;
#elif defined(__APPLE__)
// adapted from
// https://github.com/seladb/PcapPlusPlus/blob/a49a79e0b67b402ad75ffa96c1795def36df75c8/Pcap%2B%2B/src/PcapLiveDevice.cpp#L1236
// route message struct for communication in APPLE device
struct BSDRoutingMessage {
struct rt_msghdr header;
char messageSpace[512];
};
struct BSDRoutingMessage routingMessage;
// It creates a raw socket that can be used for routing-related operations
int sockfd = socket(PF_ROUTE, SOCK_RAW, 0);
if (sockfd < 0) {
return false;
}
memset(reinterpret_cast<char*>(&routingMessage), 0, sizeof(routingMessage));
routingMessage.header.rtm_msglen = sizeof(struct rt_msghdr);
routingMessage.header.rtm_version = RTM_VERSION;
routingMessage.header.rtm_type = RTM_GET;
routingMessage.header.rtm_addrs = RTA_DST | RTA_NETMASK;
routingMessage.header.rtm_flags = RTF_UP | RTF_GATEWAY | RTF_STATIC;
routingMessage.header.rtm_msglen += 2 * sizeof(sockaddr_in);
if (write(sockfd, reinterpret_cast<char*>(&routingMessage), routingMessage.header.rtm_msglen) <
0) {
return false;
}
// Read the response from the route socket
if (read(sockfd, reinterpret_cast<char*>(&routingMessage), sizeof(routingMessage)) < 0) {
return false;
}
struct in_addr* gateAddr = nullptr;
struct sockaddr* sa = nullptr;
char* spacePtr = (reinterpret_cast<char*>(&routingMessage.header + 1));
auto rtmAddrs = routingMessage.header.rtm_addrs;
int index = 1;
auto roundUpClosestMultiple = [](int multiple, int num) {
return ((num + multiple - 1) / multiple) * multiple;
};
while (rtmAddrs) {
if (rtmAddrs & 1) {
sa = reinterpret_cast<sockaddr*>(spacePtr);
if (index == RTA_GATEWAY) {
gateAddr = &((sockaddr_in*)sa)->sin_addr;
break;
}
spacePtr += sa->sa_len > 0 ? roundUpClosestMultiple(sizeof(uint32_t), sa->sa_len)
: sizeof(uint32_t);
}
index++;
rtmAddrs >>= 1;
}
if (gateAddr == nullptr) {
return false;
}
char str[INET_ADDRSTRLEN];
inet_ntop(AF_INET, gateAddr, str, sizeof(str));
this->default_gateway = str;
return true;
#else
std::ifstream route{"/proc/net/route"};
std::string line;
std::getline(route, line);
while (std::getline(route, line)) {
std::istringstream iss{line};
std::string iface, destination, gateway;
int flags;
iss >> iface >> destination >> gateway >> std::hex >> flags;
if (destination == "00000000") {
u64 default_gateway{};
std::stringstream ss;
ss << std::hex << gateway;
ss >> default_gateway;
char str[INET_ADDRSTRLEN];
in_addr addr;
addr.s_addr = default_gateway;
inet_ntop(AF_INET, &addr, str, sizeof(str));
this->default_gateway = str;
return true;
}
}
#endif
return false;
}
const std::string& NetUtilInternal::GetNetmask() const {
return netmask;
}
bool NetUtilInternal::RetrieveNetmask() {
std::scoped_lock lock{m_mutex};
char netmaskStr[INET_ADDRSTRLEN];
auto success = false;
#ifdef _WIN32
std::vector<u8> adapter_addresses(sizeof(IP_ADAPTER_ADDRESSES));
ULONG size_infos = sizeof(IP_ADAPTER_ADDRESSES);
if (GetAdaptersAddresses(AF_INET, 0, NULL,
reinterpret_cast<PIP_ADAPTER_ADDRESSES>(adapter_addresses.data()),
&size_infos) == ERROR_BUFFER_OVERFLOW)
adapter_addresses.resize(size_infos);
if (GetAdaptersAddresses(AF_INET, 0, NULL,
reinterpret_cast<PIP_ADAPTER_ADDRESSES>(adapter_addresses.data()),
&size_infos) == NO_ERROR &&
size_infos) {
PIP_ADAPTER_ADDRESSES adapter;
for (adapter = reinterpret_cast<PIP_ADAPTER_ADDRESSES>(adapter_addresses.data()); adapter;
adapter = adapter->Next) {
PIP_ADAPTER_UNICAST_ADDRESS unicast = adapter->FirstUnicastAddress;
if (unicast) {
ULONG prefix_length = unicast->OnLinkPrefixLength;
ULONG mask = prefix_length == 0 ? 0 : 0xFFFFFFFF << (32 - prefix_length);
in_addr addr{};
addr.S_un.S_addr = htonl(mask);
inet_ntop(AF_INET, &addr, netmaskStr, INET_ADDRSTRLEN);
success = true;
}
}
}
#else
ifaddrs* ifap;
if (getifaddrs(&ifap) == 0) {
ifaddrs* p;
for (p = ifap; p; p = p->ifa_next) {
if (p->ifa_addr && p->ifa_addr->sa_family == AF_INET) {
auto sa = reinterpret_cast<sockaddr_in*>(p->ifa_netmask);
inet_ntop(AF_INET, &sa->sin_addr, netmaskStr, INET_ADDRSTRLEN);
success = true;
}
}
}
freeifaddrs(ifap);
#endif
if (success) {
netmask = netmaskStr;
}
return success;
}
} // namespace NetUtil } // namespace NetUtil

View File

@ -15,16 +15,10 @@ public:
private: private:
std::array<u8, 6> ether_address{}; std::array<u8, 6> ether_address{};
std::string default_gateway{};
std::string netmask{};
std::mutex m_mutex; std::mutex m_mutex;
public: public:
const std::array<u8, 6>& GetEthernetAddr() const; const std::array<u8, 6>& GetEthernetAddr() const;
const std::string& GetDefaultGateway() const;
const std::string& GetNetmask() const;
bool RetrieveEthernetAddr(); bool RetrieveEthernetAddr();
bool RetrieveDefaultGateway();
bool RetrieveNetmask();
}; };
} // namespace NetUtil } // namespace NetUtil

View File

@ -13,7 +13,6 @@
#endif #endif
#include <common/singleton.h> #include <common/singleton.h>
#include "common/config.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/libraries/error_codes.h" #include "core/libraries/error_codes.h"
#include "core/libraries/libs.h" #include "core/libraries/libs.h"
@ -161,14 +160,12 @@ int PS4_SYSV_ABI sceNetCtlGetIfStat() {
} }
int PS4_SYSV_ABI sceNetCtlGetInfo(int code, OrbisNetCtlInfo* info) { int PS4_SYSV_ABI sceNetCtlGetInfo(int code, OrbisNetCtlInfo* info) {
LOG_DEBUG(Lib_NetCtl, "code = {}", code);
auto* netinfo = Common::Singleton<NetUtil::NetUtilInternal>::Instance();
switch (code) { switch (code) {
case ORBIS_NET_CTL_INFO_DEVICE: case ORBIS_NET_CTL_INFO_DEVICE:
info->device = ORBIS_NET_CTL_DEVICE_WIRED; info->device = ORBIS_NET_CTL_DEVICE_WIRED;
break; break;
case ORBIS_NET_CTL_INFO_ETHER_ADDR: { case ORBIS_NET_CTL_INFO_ETHER_ADDR: {
auto* netinfo = Common::Singleton<NetUtil::NetUtilInternal>::Instance();
netinfo->RetrieveEthernetAddr(); netinfo->RetrieveEthernetAddr();
memcpy(info->ether_addr.data, netinfo->GetEthernetAddr().data(), 6); memcpy(info->ether_addr.data, netinfo->GetEthernetAddr().data(), 6);
} break; } break;
@ -176,8 +173,7 @@ int PS4_SYSV_ABI sceNetCtlGetInfo(int code, OrbisNetCtlInfo* info) {
info->mtu = 1500; // default value info->mtu = 1500; // default value
break; break;
case ORBIS_NET_CTL_INFO_LINK: case ORBIS_NET_CTL_INFO_LINK:
info->link = Config::getIsConnectedToNetwork() ? ORBIS_NET_CTL_LINK_CONNECTED info->link = ORBIS_NET_CTL_LINK_DISCONNECTED;
: ORBIS_NET_CTL_LINK_DISCONNECTED;
break; break;
case ORBIS_NET_CTL_INFO_IP_ADDRESS: { case ORBIS_NET_CTL_INFO_IP_ADDRESS: {
strcpy(info->ip_address, strcpy(info->ip_address,
@ -197,29 +193,11 @@ int PS4_SYSV_ABI sceNetCtlGetInfo(int code, OrbisNetCtlInfo* info) {
} }
break; break;
} }
case ORBIS_NET_CTL_INFO_NETMASK: {
auto success = netinfo->RetrieveNetmask();
if (success) {
strncpy(info->netmask, netinfo->GetNetmask().data(), sizeof(info->netmask));
LOG_DEBUG(Lib_NetCtl, "netmask: {}", info->netmask);
} else {
LOG_WARNING(Lib_NetCtl, "netmask: failed to retrieve");
}
break;
}
case ORBIS_NET_CTL_INFO_DEFAULT_ROUTE: {
auto success = netinfo->RetrieveDefaultGateway();
if (success) {
strncpy(info->netmask, netinfo->GetDefaultGateway().data(), sizeof(info->netmask));
LOG_DEBUG(Lib_NetCtl, "default gateway: {}", info->netmask);
} else {
LOG_WARNING(Lib_NetCtl, "default gateway: failed to retrieve");
}
break;
}
default: default:
LOG_ERROR(Lib_NetCtl, "{} unsupported code", code); LOG_ERROR(Lib_NetCtl, "{} unsupported code", code);
} }
LOG_DEBUG(Lib_NetCtl, "(STUBBED) called");
return ORBIS_OK; return ORBIS_OK;
} }
@ -293,11 +271,7 @@ int PS4_SYSV_ABI sceNetCtlGetScanInfoForSsidScanIpcInt() {
} }
int PS4_SYSV_ABI sceNetCtlGetState(int* state) { int PS4_SYSV_ABI sceNetCtlGetState(int* state) {
const auto connected = Config::getIsConnectedToNetwork(); *state = ORBIS_NET_CTL_STATE_DISCONNECTED;
LOG_DEBUG(Lib_NetCtl, "connected = {}", connected);
const auto current_state =
connected ? ORBIS_NET_CTL_STATE_IPOBTAINED : ORBIS_NET_CTL_STATE_DISCONNECTED;
*state = current_state;
return ORBIS_OK; return ORBIS_OK;
} }
@ -573,7 +547,7 @@ int PS4_SYSV_ABI sceNetCtlApRpUnregisterCallback() {
return ORBIS_OK; return ORBIS_OK;
} }
void RegisterLib(Core::Loader::SymbolsResolver* sym) { void RegisterlibSceNetCtl(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("XtClSOC1xcU", "libSceNetBwe", 1, "libSceNetCtl", 1, 1, LIB_FUNCTION("XtClSOC1xcU", "libSceNetBwe", 1, "libSceNetCtl", 1, 1,
sceNetBweCheckCallbackIpcInt); sceNetBweCheckCallbackIpcInt);
LIB_FUNCTION("YALqoY4aeY0", "libSceNetBwe", 1, "libSceNetCtl", 1, 1, sceNetBweClearEventIpcInt); LIB_FUNCTION("YALqoY4aeY0", "libSceNetBwe", 1, "libSceNetCtl", 1, 1, sceNetBweClearEventIpcInt);

View File

@ -165,5 +165,5 @@ int PS4_SYSV_ABI sceNetCtlApRpStartWithRetry();
int PS4_SYSV_ABI sceNetCtlApRpStop(); int PS4_SYSV_ABI sceNetCtlApRpStop();
int PS4_SYSV_ABI sceNetCtlApRpUnregisterCallback(); int PS4_SYSV_ABI sceNetCtlApRpUnregisterCallback();
void RegisterLib(Core::Loader::SymbolsResolver* sym); void RegisterlibSceNetCtl(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::NetCtl } // namespace Libraries::NetCtl

View File

@ -257,14 +257,13 @@ int PosixSocket::SetSocketOptions(int level, int optname, const void* optval, u3
CASE_SETSOCKOPT(SO_RCVTIMEO); CASE_SETSOCKOPT(SO_RCVTIMEO);
CASE_SETSOCKOPT(SO_ERROR); CASE_SETSOCKOPT(SO_ERROR);
CASE_SETSOCKOPT(SO_TYPE); CASE_SETSOCKOPT(SO_TYPE);
CASE_SETSOCKOPT_VALUE(ORBIS_NET_SO_CONNECTTIMEO, &sockopt_so_connecttimeo);
CASE_SETSOCKOPT_VALUE(ORBIS_NET_SO_REUSEPORT, &sockopt_so_reuseport); CASE_SETSOCKOPT_VALUE(ORBIS_NET_SO_REUSEPORT, &sockopt_so_reuseport);
CASE_SETSOCKOPT_VALUE(ORBIS_NET_SO_ONESBCAST, &sockopt_so_onesbcast); CASE_SETSOCKOPT_VALUE(ORBIS_NET_SO_ONESBCAST, &sockopt_so_onesbcast);
CASE_SETSOCKOPT_VALUE(ORBIS_NET_SO_USECRYPTO, &sockopt_so_usecrypto); CASE_SETSOCKOPT_VALUE(ORBIS_NET_SO_USECRYPTO, &sockopt_so_usecrypto);
CASE_SETSOCKOPT_VALUE(ORBIS_NET_SO_USESIGNATURE, &sockopt_so_usesignature); CASE_SETSOCKOPT_VALUE(ORBIS_NET_SO_USESIGNATURE, &sockopt_so_usesignature);
case ORBIS_NET_SO_LINGER: { case ORBIS_NET_SO_LINGER: {
if (socket_type != ORBIS_NET_SOCK_STREAM) { if (socket_type != ORBIS_NET_SOCK_STREAM) {
return ORBIS_NET_ERROR_EPROCUNAVAIL; return ORBIS_NET_EPROCUNAVAIL;
} }
if (optlen < sizeof(OrbisNetLinger)) { if (optlen < sizeof(OrbisNetLinger)) {
LOG_ERROR(Lib_Net, "size missmatched! optlen = {} OrbisNetLinger={}", optlen, LOG_ERROR(Lib_Net, "size missmatched! optlen = {} OrbisNetLinger={}", optlen,
@ -310,7 +309,7 @@ int PosixSocket::SetSocketOptions(int level, int optname, const void* optval, u3
CASE_SETSOCKOPT_VALUE(ORBIS_NET_IP_MAXTTL, &sockopt_ip_maxttl); CASE_SETSOCKOPT_VALUE(ORBIS_NET_IP_MAXTTL, &sockopt_ip_maxttl);
case ORBIS_NET_IP_HDRINCL: { case ORBIS_NET_IP_HDRINCL: {
if (socket_type != ORBIS_NET_SOCK_RAW) { if (socket_type != ORBIS_NET_SOCK_RAW) {
return ORBIS_NET_ERROR_EPROCUNAVAIL; return ORBIS_NET_EPROCUNAVAIL;
} }
return ConvertReturnErrorCode( return ConvertReturnErrorCode(
setsockopt(sock, level, optname, (const char*)optval, optlen)); setsockopt(sock, level, optname, (const char*)optval, optlen));
@ -362,7 +361,6 @@ int PosixSocket::GetSocketOptions(int level, int optname, void* optval, u32* opt
CASE_GETSOCKOPT(SO_ERROR); CASE_GETSOCKOPT(SO_ERROR);
CASE_GETSOCKOPT(SO_TYPE); CASE_GETSOCKOPT(SO_TYPE);
CASE_GETSOCKOPT_VALUE(ORBIS_NET_SO_NBIO, sockopt_so_nbio); CASE_GETSOCKOPT_VALUE(ORBIS_NET_SO_NBIO, sockopt_so_nbio);
CASE_GETSOCKOPT_VALUE(ORBIS_NET_SO_CONNECTTIMEO, sockopt_so_connecttimeo);
CASE_GETSOCKOPT_VALUE(ORBIS_NET_SO_REUSEPORT, sockopt_so_reuseport); CASE_GETSOCKOPT_VALUE(ORBIS_NET_SO_REUSEPORT, sockopt_so_reuseport);
CASE_GETSOCKOPT_VALUE(ORBIS_NET_SO_ONESBCAST, sockopt_so_onesbcast); CASE_GETSOCKOPT_VALUE(ORBIS_NET_SO_ONESBCAST, sockopt_so_onesbcast);
CASE_GETSOCKOPT_VALUE(ORBIS_NET_SO_USECRYPTO, sockopt_so_usecrypto); CASE_GETSOCKOPT_VALUE(ORBIS_NET_SO_USECRYPTO, sockopt_so_usecrypto);

View File

@ -56,7 +56,6 @@ struct Socket {
struct PosixSocket : public Socket { struct PosixSocket : public Socket {
net_socket sock; net_socket sock;
int sockopt_so_connecttimeo = 0;
int sockopt_so_reuseport = 0; int sockopt_so_reuseport = 0;
int sockopt_so_onesbcast = 0; int sockopt_so_onesbcast = 0;
int sockopt_so_usecrypto = 0; int sockopt_so_usecrypto = 0;

View File

@ -633,17 +633,8 @@ int PS4_SYSV_ABI sceSslFreeSslCertName() {
return ORBIS_OK; return ORBIS_OK;
} }
struct OrbisSslCaCerts { int PS4_SYSV_ABI sceSslGetCaCerts() {
void* certs;
u64 num;
void* pool;
};
int PS4_SYSV_ABI sceSslGetCaCerts(int sslCtxId, OrbisSslCaCerts* certs) {
LOG_ERROR(Lib_Ssl, "(STUBBED) called"); LOG_ERROR(Lib_Ssl, "(STUBBED) called");
certs->certs = nullptr;
certs->num = 0;
certs->pool = nullptr;
return ORBIS_OK; return ORBIS_OK;
} }
@ -1059,7 +1050,7 @@ int PS4_SYSV_ABI Func_28F8791A771D39C7() {
return ORBIS_OK; return ORBIS_OK;
} }
void RegisterLib(Core::Loader::SymbolsResolver* sym) { void RegisterlibSceSsl(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("Pgt0gg14ewU", "libSceSsl", 1, "libSceSsl", 1, 1, LIB_FUNCTION("Pgt0gg14ewU", "libSceSsl", 1, "libSceSsl", 1, 1,
CA_MGMT_allocCertDistinguishedName); CA_MGMT_allocCertDistinguishedName);
LIB_FUNCTION("wJ5jCpkCv-c", "libSceSsl", 1, "libSceSsl", 1, 1, LIB_FUNCTION("wJ5jCpkCv-c", "libSceSsl", 1, "libSceSsl", 1, 1,

View File

@ -11,13 +11,6 @@ class SymbolsResolver;
namespace Libraries::Ssl { namespace Libraries::Ssl {
struct OrbisSslCaCerts;
struct OrbisSslCaList {
void* certs;
int certsNum;
};
int PS4_SYSV_ABI CA_MGMT_allocCertDistinguishedName(); int PS4_SYSV_ABI CA_MGMT_allocCertDistinguishedName();
int PS4_SYSV_ABI CA_MGMT_certDistinguishedNameCompare(); int PS4_SYSV_ABI CA_MGMT_certDistinguishedNameCompare();
int PS4_SYSV_ABI CA_MGMT_convertKeyBlobToPKCS8Key(); int PS4_SYSV_ABI CA_MGMT_convertKeyBlobToPKCS8Key();
@ -143,7 +136,7 @@ int PS4_SYSV_ABI sceSslEnableOptionInternal();
int PS4_SYSV_ABI sceSslFreeCaCerts(); int PS4_SYSV_ABI sceSslFreeCaCerts();
int PS4_SYSV_ABI sceSslFreeCaList(); int PS4_SYSV_ABI sceSslFreeCaList();
int PS4_SYSV_ABI sceSslFreeSslCertName(); int PS4_SYSV_ABI sceSslFreeSslCertName();
int PS4_SYSV_ABI sceSslGetCaCerts(int sslCtxId, OrbisSslCaCerts* certs); int PS4_SYSV_ABI sceSslGetCaCerts();
int PS4_SYSV_ABI sceSslGetCaList(); int PS4_SYSV_ABI sceSslGetCaList();
int PS4_SYSV_ABI sceSslGetIssuerName(); int PS4_SYSV_ABI sceSslGetIssuerName();
int PS4_SYSV_ABI sceSslGetMemoryPoolStats(); int PS4_SYSV_ABI sceSslGetMemoryPoolStats();
@ -227,5 +220,5 @@ int PS4_SYSV_ABI VLONG_freeVlongQueue();
int PS4_SYSV_ABI Func_22E76E60BC0587D7(); int PS4_SYSV_ABI Func_22E76E60BC0587D7();
int PS4_SYSV_ABI Func_28F8791A771D39C7(); int PS4_SYSV_ABI Func_28F8791A771D39C7();
void RegisterLib(Core::Loader::SymbolsResolver* sym); void RegisterlibSceSsl(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::Ssl } // namespace Libraries::Ssl

View File

@ -128,18 +128,8 @@ int PS4_SYSV_ABI sceSslGetAlpnSelected() {
return ORBIS_OK; return ORBIS_OK;
} }
struct OrbisSslCaCerts { int PS4_SYSV_ABI sceSslGetCaCerts() {
void* certs; LOG_ERROR(Lib_Ssl2, "(STUBBED) called");
u64 num;
void* pool;
};
int PS4_SYSV_ABI sceSslGetCaCerts(int sslCtxId, OrbisSslCaCerts* certs) {
// check if it is same as libSceSsl
LOG_ERROR(Lib_Ssl2, "(DUMMY) called");
certs->certs = nullptr;
certs->num = 0;
certs->pool = nullptr;
return ORBIS_OK; return ORBIS_OK;
} }
@ -300,7 +290,7 @@ int PS4_SYSV_ABI Func_28F8791A771D39C7() {
return ORBIS_OK; return ORBIS_OK;
} }
void RegisterLib(Core::Loader::SymbolsResolver* sym) { void RegisterlibSceSsl2(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("Md+HYkCBZB4", "libSceSsl", 1, "libSceSsl", 2, 1, CA_MGMT_extractKeyBlobEx); LIB_FUNCTION("Md+HYkCBZB4", "libSceSsl", 1, "libSceSsl", 2, 1, CA_MGMT_extractKeyBlobEx);
LIB_FUNCTION("9bKYzKP6kYU", "libSceSsl", 1, "libSceSsl", 2, 1, CA_MGMT_extractPublicKeyInfo); LIB_FUNCTION("9bKYzKP6kYU", "libSceSsl", 1, "libSceSsl", 2, 1, CA_MGMT_extractPublicKeyInfo);
LIB_FUNCTION("ipLIammTj2Q", "libSceSsl", 1, "libSceSsl", 2, 1, CA_MGMT_freeKeyBlob); LIB_FUNCTION("ipLIammTj2Q", "libSceSsl", 1, "libSceSsl", 2, 1, CA_MGMT_freeKeyBlob);

View File

@ -10,5 +10,5 @@ class SymbolsResolver;
} }
namespace Libraries::Ssl2 { namespace Libraries::Ssl2 {
void RegisterLib(Core::Loader::SymbolsResolver* sym); void RegisterlibSceSsl2(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::Ssl2 } // namespace Libraries::Ssl2

View File

@ -73,7 +73,7 @@ s32 PS4_SYSV_ABI sceNpAuthWaitAsync() {
return ORBIS_OK; return ORBIS_OK;
} }
void RegisterLib(Core::Loader::SymbolsResolver* sym) { void RegisterlibSceNpAuth(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("KxGkOrQJTqY", "libSceNpAuthCompat", 1, "libSceNpAuth", 1, 1, LIB_FUNCTION("KxGkOrQJTqY", "libSceNpAuthCompat", 1, "libSceNpAuth", 1, 1,
sceNpAuthGetAuthorizationCode); sceNpAuthGetAuthorizationCode);
LIB_FUNCTION("uaB-LoJqHis", "libSceNpAuthCompat", 1, "libSceNpAuth", 1, 1, sceNpAuthGetIdToken); LIB_FUNCTION("uaB-LoJqHis", "libSceNpAuthCompat", 1, "libSceNpAuth", 1, 1, sceNpAuthGetIdToken);

View File

@ -25,5 +25,5 @@ s32 PS4_SYSV_ABI sceNpAuthPollAsync();
s32 PS4_SYSV_ABI sceNpAuthSetTimeout(); s32 PS4_SYSV_ABI sceNpAuthSetTimeout();
s32 PS4_SYSV_ABI sceNpAuthWaitAsync(); s32 PS4_SYSV_ABI sceNpAuthWaitAsync();
void RegisterLib(Core::Loader::SymbolsResolver* sym); void RegisterlibSceNpAuth(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::NpAuth } // namespace Libraries::NpAuth

View File

@ -6129,7 +6129,7 @@ int PS4_SYSV_ABI Func_FFF4A3E279FB44A7() {
return ORBIS_OK; return ORBIS_OK;
} }
void RegisterLib(Core::Loader::SymbolsResolver* sym) { void RegisterlibSceNpCommon(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("i8UmXTSq7N4", "libSceNpCommonCompat", 1, "libSceNpCommon", 1, 1, sceNpCmpNpId); LIB_FUNCTION("i8UmXTSq7N4", "libSceNpCommonCompat", 1, "libSceNpCommon", 1, 1, sceNpCmpNpId);
LIB_FUNCTION("TcwEFnakiSc", "libSceNpCommonCompat", 1, "libSceNpCommon", 1, 1, LIB_FUNCTION("TcwEFnakiSc", "libSceNpCommonCompat", 1, "libSceNpCommon", 1, 1,
sceNpCmpNpIdInOrder); sceNpCmpNpIdInOrder);

View File

@ -1241,5 +1241,5 @@ int PS4_SYSV_ABI Func_FE55EE32098D0D58();
int PS4_SYSV_ABI Func_FE79841022E1DA1C(); int PS4_SYSV_ABI Func_FE79841022E1DA1C();
int PS4_SYSV_ABI Func_FFF4A3E279FB44A7(); int PS4_SYSV_ABI Func_FFF4A3E279FB44A7();
void RegisterLib(Core::Loader::SymbolsResolver* sym); void RegisterlibSceNpCommon(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::NpCommon } // namespace Libraries::NpCommon

View File

@ -2563,7 +2563,7 @@ int PS4_SYSV_ABI sceNpUnregisterStateCallbackForToolkit() {
return ORBIS_OK; return ORBIS_OK;
} }
void RegisterLib(Core::Loader::SymbolsResolver* sym) { void RegisterlibSceNpManager(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("70N4VzVCpQg", "libSceNpManagerForSys", 1, "libSceNpManager", 1, 1, LIB_FUNCTION("70N4VzVCpQg", "libSceNpManagerForSys", 1, "libSceNpManager", 1, 1,
Func_EF4378573542A508); Func_EF4378573542A508);
LIB_FUNCTION("pHLjntY0psg", "libSceNpManager", 1, "libSceNpManager", 1, 1, LIB_FUNCTION("pHLjntY0psg", "libSceNpManager", 1, "libSceNpManager", 1, 1,

View File

@ -542,5 +542,5 @@ int PS4_SYSV_ABI sceNpRegisterStateCallbackForToolkit(OrbisNpStateCallbackForNpT
void* userdata); void* userdata);
int PS4_SYSV_ABI sceNpUnregisterStateCallbackForToolkit(); int PS4_SYSV_ABI sceNpUnregisterStateCallbackForToolkit();
void RegisterLib(Core::Loader::SymbolsResolver* sym); void RegisterlibSceNpManager(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::NpManager } // namespace Libraries::NpManager

View File

@ -138,7 +138,7 @@ s32 PS4_SYSV_ABI sceNpPartyUnregisterPrivateHandler() {
return ORBIS_OK; return ORBIS_OK;
} }
void RegisterLib(Core::Loader::SymbolsResolver* sym) { void RegisterlibSceNpParty(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("3e4k2mzLkmc", "libSceNpParty", 1, "libSceNpParty", 1, 1, sceNpPartyCheckCallback); LIB_FUNCTION("3e4k2mzLkmc", "libSceNpParty", 1, "libSceNpParty", 1, 1, sceNpPartyCheckCallback);
LIB_FUNCTION("nOZRy-slBoA", "libSceNpParty", 1, "libSceNpParty", 1, 1, sceNpPartyCreate); LIB_FUNCTION("nOZRy-slBoA", "libSceNpParty", 1, "libSceNpParty", 1, 1, sceNpPartyCreate);
LIB_FUNCTION("XQSUbbnpPBA", "libSceNpParty", 1, "libSceNpParty", 1, 1, sceNpPartyCreateA); LIB_FUNCTION("XQSUbbnpPBA", "libSceNpParty", 1, "libSceNpParty", 1, 1, sceNpPartyCreateA);

View File

@ -40,5 +40,5 @@ s32 PS4_SYSV_ABI sceNpPartyUnregisterPrivateHandler();
s32 PS4_SYSV_ABI module_start(); s32 PS4_SYSV_ABI module_start();
s32 PS4_SYSV_ABI module_stop(); s32 PS4_SYSV_ABI module_stop();
void RegisterLib(Core::Loader::SymbolsResolver* sym); void RegisterlibSceNpParty(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::NpParty } // namespace Libraries::NpParty

Some files were not shown because too many files have changed in this diff Show More