mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-04-20 19:44:46 +00:00
Merge branch 'main' into core/more-ime
This commit is contained in:
commit
074b3910c1
165 changed files with 3453 additions and 2719 deletions
8
.github/workflows/build.yml
vendored
8
.github/workflows/build.yml
vendored
|
@ -92,7 +92,7 @@ jobs:
|
|||
run: cmake --fresh -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
|
||||
- name: Build
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel $env:NUMBER_OF_PROCESSORS
|
||||
|
||||
- name: Upload Windows SDL artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
|
@ -146,7 +146,7 @@ jobs:
|
|||
run: cmake --fresh -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DENABLE_QT_GUI=ON -DENABLE_UPDATER=ON -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
|
||||
- name: Build
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel $env:NUMBER_OF_PROCESSORS
|
||||
|
||||
- name: Deploy and Package
|
||||
run: |
|
||||
|
@ -315,7 +315,7 @@ jobs:
|
|||
run: cmake --fresh -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
|
||||
- name: Build
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel $(nproc)
|
||||
|
||||
- name: Package and Upload Linux(ubuntu64) SDL artifact
|
||||
run: |
|
||||
|
@ -371,7 +371,7 @@ jobs:
|
|||
run: cmake --fresh -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DENABLE_QT_GUI=ON -DENABLE_UPDATER=ON -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
|
||||
- name: Build
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel3
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel $(nproc)
|
||||
|
||||
- name: Run AppImage packaging script
|
||||
run: ./.github/linux-appimage-qt.sh
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
# SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
cmake_minimum_required(VERSION 3.16.3)
|
||||
# Version 3.24 needed for FetchContent OVERRIDE_FIND_PACKAGE
|
||||
cmake_minimum_required(VERSION 3.24)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
|
@ -110,9 +111,10 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/common/scm_rev.cpp.in" "${CMAKE_
|
|||
find_package(Boost 1.84.0 CONFIG)
|
||||
find_package(FFmpeg 5.1.2 MODULE)
|
||||
find_package(fmt 10.2.0 CONFIG)
|
||||
find_package(glslang 14.2.0 CONFIG)
|
||||
find_package(glslang 15 CONFIG)
|
||||
find_package(half 1.12.0 MODULE)
|
||||
find_package(magic_enum 0.9.6 CONFIG)
|
||||
find_package(PNG 1.6 MODULE)
|
||||
find_package(RenderDoc 1.6.0 MODULE)
|
||||
find_package(SDL3 3.1.2 CONFIG)
|
||||
find_package(toml11 4.2.0 CONFIG)
|
||||
|
@ -121,7 +123,7 @@ find_package(VulkanHeaders 1.3.289 CONFIG)
|
|||
find_package(VulkanMemoryAllocator 3.1.0 CONFIG)
|
||||
find_package(xbyak 7.07 CONFIG)
|
||||
find_package(xxHash 0.8.2 MODULE)
|
||||
find_package(zlib-ng 2.1.7 MODULE)
|
||||
find_package(ZLIB 1.3 MODULE)
|
||||
find_package(Zydis 5.0.0 CONFIG)
|
||||
find_package(pugixml 1.14 CONFIG)
|
||||
|
||||
|
@ -176,10 +178,6 @@ if(ENABLE_QT_GUI)
|
|||
qt_add_resources(TRANSLATIONS ${TRANSLATIONS_QRC})
|
||||
endif()
|
||||
|
||||
set(AUDIO_CORE src/audio_core/sdl_audio.cpp
|
||||
src/audio_core/sdl_audio.h
|
||||
)
|
||||
|
||||
set(AJM_LIB src/core/libraries/ajm/ajm.cpp
|
||||
src/core/libraries/ajm/ajm.h
|
||||
src/core/libraries/ajm/ajm_at9.cpp
|
||||
|
@ -199,6 +197,9 @@ set(AUDIO_LIB src/core/libraries/audio/audioin.cpp
|
|||
src/core/libraries/audio/audioin.h
|
||||
src/core/libraries/audio/audioout.cpp
|
||||
src/core/libraries/audio/audioout.h
|
||||
src/core/libraries/audio/sdl_audio.cpp
|
||||
src/core/libraries/audio/sdl_audio.h
|
||||
src/core/libraries/audio/audioout_error.h
|
||||
src/core/libraries/ngs2/ngs2.cpp
|
||||
src/core/libraries/ngs2/ngs2.h
|
||||
)
|
||||
|
@ -240,6 +241,8 @@ set(KERNEL_LIB src/core/libraries/kernel/threads/condvar.cpp
|
|||
src/core/libraries/kernel/threads.h
|
||||
src/core/libraries/kernel/time.cpp
|
||||
src/core/libraries/kernel/time.h
|
||||
src/core/libraries/kernel/orbis_error.h
|
||||
src/core/libraries/kernel/posix_error.h
|
||||
)
|
||||
|
||||
set(NETWORK_LIBS src/core/libraries/network/http.cpp
|
||||
|
@ -255,6 +258,21 @@ set(NETWORK_LIBS src/core/libraries/network/http.cpp
|
|||
src/core/libraries/network/ssl.h
|
||||
)
|
||||
|
||||
set(AVPLAYER_LIB src/core/libraries/avplayer/avplayer_common.cpp
|
||||
src/core/libraries/avplayer/avplayer_common.h
|
||||
src/core/libraries/avplayer/avplayer_file_streamer.cpp
|
||||
src/core/libraries/avplayer/avplayer_file_streamer.h
|
||||
src/core/libraries/avplayer/avplayer_impl.cpp
|
||||
src/core/libraries/avplayer/avplayer_impl.h
|
||||
src/core/libraries/avplayer/avplayer_source.cpp
|
||||
src/core/libraries/avplayer/avplayer_source.h
|
||||
src/core/libraries/avplayer/avplayer_state.cpp
|
||||
src/core/libraries/avplayer/avplayer_state.h
|
||||
src/core/libraries/avplayer/avplayer.cpp
|
||||
src/core/libraries/avplayer/avplayer.h
|
||||
src/core/libraries/avplayer/avplayer_error.h
|
||||
)
|
||||
|
||||
set(SYSTEM_LIBS src/core/libraries/system/commondialog.cpp
|
||||
src/core/libraries/system/commondialog.h
|
||||
src/core/libraries/system/msgdialog.cpp
|
||||
|
@ -279,28 +297,19 @@ set(SYSTEM_LIBS src/core/libraries/system/commondialog.cpp
|
|||
src/core/libraries/system/system_error.h
|
||||
src/core/libraries/system/systemservice.cpp
|
||||
src/core/libraries/system/systemservice.h
|
||||
src/core/libraries/system/systemservice_error.h
|
||||
src/core/libraries/system/userservice.cpp
|
||||
src/core/libraries/system/userservice.h
|
||||
src/core/libraries/system/userservice_error.h
|
||||
src/core/libraries/app_content/app_content.cpp
|
||||
src/core/libraries/app_content/app_content.h
|
||||
src/core/libraries/app_content/app_content_error.h
|
||||
src/core/libraries/rtc/rtc.cpp
|
||||
src/core/libraries/rtc/rtc.h
|
||||
src/core/libraries/rtc/rtc_error.h
|
||||
src/core/libraries/disc_map/disc_map.cpp
|
||||
src/core/libraries/disc_map/disc_map.h
|
||||
src/core/libraries/disc_map/disc_map_codes.h
|
||||
src/core/libraries/avplayer/avplayer_common.cpp
|
||||
src/core/libraries/avplayer/avplayer_common.h
|
||||
src/core/libraries/avplayer/avplayer_file_streamer.cpp
|
||||
src/core/libraries/avplayer/avplayer_file_streamer.h
|
||||
src/core/libraries/avplayer/avplayer_impl.cpp
|
||||
src/core/libraries/avplayer/avplayer_impl.h
|
||||
src/core/libraries/avplayer/avplayer_source.cpp
|
||||
src/core/libraries/avplayer/avplayer_source.h
|
||||
src/core/libraries/avplayer/avplayer_state.cpp
|
||||
src/core/libraries/avplayer/avplayer_state.h
|
||||
src/core/libraries/avplayer/avplayer.cpp
|
||||
src/core/libraries/avplayer/avplayer.h
|
||||
src/core/libraries/ngs2/ngs2.cpp
|
||||
src/core/libraries/ngs2/ngs2.h
|
||||
src/core/libraries/ngs2/ngs2_error.h
|
||||
|
@ -327,6 +336,7 @@ set(VIDEOOUT_LIB src/core/libraries/videoout/buffer.h
|
|||
src/core/libraries/videoout/driver.h
|
||||
src/core/libraries/videoout/video_out.cpp
|
||||
src/core/libraries/videoout/video_out.h
|
||||
src/core/libraries/videoout/videoout_error.h
|
||||
)
|
||||
|
||||
set(LIBC_SOURCES src/core/libraries/libc_internal/libc_internal.cpp
|
||||
|
@ -344,18 +354,28 @@ set(IME_LIB src/core/libraries/ime/error_dialog.cpp
|
|||
src/core/libraries/ime/ime_ui.h
|
||||
src/core/libraries/ime/ime.cpp
|
||||
src/core/libraries/ime/ime.h
|
||||
src/core/libraries/ime/ime_error.h
|
||||
)
|
||||
|
||||
set(PAD_LIB src/core/libraries/pad/pad.cpp
|
||||
src/core/libraries/pad/pad.h
|
||||
src/core/libraries/pad/pad_errors.h
|
||||
)
|
||||
|
||||
set(PNG_LIB src/core/libraries/libpng/pngdec.cpp
|
||||
src/core/libraries/libpng/pngdec.h
|
||||
src/core/libraries/libpng/pngdec_error.h
|
||||
)
|
||||
|
||||
set(JPEG_LIB src/core/libraries/jpeg/jpeg_error.h
|
||||
src/core/libraries/jpeg/jpegenc.cpp
|
||||
src/core/libraries/jpeg/jpegenc.h
|
||||
)
|
||||
|
||||
set(PLAYGO_LIB src/core/libraries/playgo/playgo.cpp
|
||||
src/core/libraries/playgo/playgo.h
|
||||
src/core/libraries/playgo/playgo_dialog.cpp
|
||||
src/core/libraries/playgo/playgo_dialog.h
|
||||
src/core/libraries/playgo/playgo_types.h
|
||||
)
|
||||
|
||||
|
@ -370,6 +390,7 @@ set(USBD_LIB src/core/libraries/usbd/usbd.cpp
|
|||
|
||||
set(FIBER_LIB src/core/libraries/fiber/fiber.cpp
|
||||
src/core/libraries/fiber/fiber.h
|
||||
src/core/libraries/fiber/fiber_error.h
|
||||
)
|
||||
|
||||
set(VDEC_LIB src/core/libraries/videodec/videodec2_impl.cpp
|
||||
|
@ -379,6 +400,7 @@ set(VDEC_LIB src/core/libraries/videodec/videodec2_impl.cpp
|
|||
src/core/libraries/videodec/videodec2_avc.h
|
||||
src/core/libraries/videodec/videodec.cpp
|
||||
src/core/libraries/videodec/videodec.h
|
||||
src/core/libraries/videodec/videodec_error.h
|
||||
src/core/libraries/videodec/videodec_impl.cpp
|
||||
src/core/libraries/videodec/videodec_impl.h
|
||||
)
|
||||
|
@ -391,6 +413,7 @@ set(NP_LIBS src/core/libraries/np_manager/np_manager.cpp
|
|||
src/core/libraries/np_trophy/np_trophy.h
|
||||
src/core/libraries/np_trophy/trophy_ui.cpp
|
||||
src/core/libraries/np_trophy/trophy_ui.h
|
||||
src/core/libraries/np_trophy/np_trophy_error.h
|
||||
)
|
||||
|
||||
set(MISC_LIBS src/core/libraries/screenshot/screenshot.cpp
|
||||
|
@ -412,10 +435,14 @@ set(DEV_TOOLS src/core/devtools/layer.cpp
|
|||
src/core/devtools/widget/frame_graph.cpp
|
||||
src/core/devtools/widget/frame_graph.h
|
||||
src/core/devtools/widget/imgui_memory_editor.h
|
||||
src/core/devtools/widget/memory_map.cpp
|
||||
src/core/devtools/widget/memory_map.h
|
||||
src/core/devtools/widget/reg_popup.cpp
|
||||
src/core/devtools/widget/reg_popup.h
|
||||
src/core/devtools/widget/reg_view.cpp
|
||||
src/core/devtools/widget/reg_view.h
|
||||
src/core/devtools/widget/shader_list.cpp
|
||||
src/core/devtools/widget/shader_list.h
|
||||
src/core/devtools/widget/text_editor.cpp
|
||||
src/core/devtools/widget/text_editor.h
|
||||
)
|
||||
|
@ -522,10 +549,10 @@ set(CORE src/core/aerolib/stubs.cpp
|
|||
src/core/loader/elf.h
|
||||
src/core/loader/symbols_resolver.h
|
||||
src/core/loader/symbols_resolver.cpp
|
||||
src/core/libraries/error_codes.h
|
||||
src/core/libraries/libs.h
|
||||
src/core/libraries/libs.cpp
|
||||
${AJM_LIB}
|
||||
${AVPLAYER_LIB}
|
||||
${AUDIO_LIB}
|
||||
${GNM_LIB}
|
||||
${KERNEL_LIB}
|
||||
|
@ -536,6 +563,7 @@ set(CORE src/core/aerolib/stubs.cpp
|
|||
${VIDEOOUT_LIB}
|
||||
${NP_LIBS}
|
||||
${PNG_LIB}
|
||||
${JPEG_LIB}
|
||||
${PLAYGO_LIB}
|
||||
${RANDOM_LIB}
|
||||
${USBD_LIB}
|
||||
|
@ -559,8 +587,6 @@ set(CORE src/core/aerolib/stubs.cpp
|
|||
src/core/thread.h
|
||||
src/core/tls.cpp
|
||||
src/core/tls.h
|
||||
src/core/virtual_memory.cpp
|
||||
src/core/virtual_memory.h
|
||||
)
|
||||
|
||||
if (ARCHITECTURE STREQUAL "x86_64")
|
||||
|
@ -833,7 +859,7 @@ endif()
|
|||
|
||||
create_target_directory_groups(shadps4)
|
||||
|
||||
target_link_libraries(shadps4 PRIVATE magic_enum::magic_enum fmt::fmt toml11::toml11 tsl::robin_map xbyak::xbyak Tracy::TracyClient RenderDoc::API FFmpeg::ffmpeg Dear_ImGui gcn half::half zlib-ng::zlib png_static)
|
||||
target_link_libraries(shadps4 PRIVATE magic_enum::magic_enum fmt::fmt toml11::toml11 tsl::robin_map xbyak::xbyak Tracy::TracyClient RenderDoc::API FFmpeg::ffmpeg Dear_ImGui gcn half::half ZLIB::ZLIB PNG::PNG)
|
||||
target_link_libraries(shadps4 PRIVATE Boost::headers GPUOpen::VulkanMemoryAllocator LibAtrac9 sirit Vulkan::Headers xxHash::xxhash Zydis::Zydis glslang::SPIRV glslang::glslang SDL3::SDL3 pugixml::pugixml)
|
||||
|
||||
target_compile_definitions(shadps4 PRIVATE IMGUI_USER_CONFIG="imgui/imgui_config.h")
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
# SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_search_module(ZLIB_NG QUIET IMPORTED_TARGET zlib-ng)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(zlib-ng
|
||||
REQUIRED_VARS ZLIB_NG_LINK_LIBRARIES
|
||||
VERSION_VAR ZLIB_NG_VERSION
|
||||
)
|
||||
|
||||
if (zlib-ng_FOUND AND NOT TARGET zlib-ng::zlib)
|
||||
add_library(zlib-ng::zlib ALIAS PkgConfig::ZLIB_NG)
|
||||
endif()
|
19
documents/patching-shader.md
Normal file
19
documents/patching-shader.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
<!--
|
||||
SPDX-FileCopyrightText: 2024 shadPS4 Emulator Project
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
-->
|
||||
|
||||
### Install Vulkan SDK and \*ensure `spirv-cross` and `glslc` are in PATH\*.
|
||||
|
||||
1. Enable `dumpShaders` in config.toml
|
||||
|
||||
2. Run `spirv-cross -V fs_0x000000.spv --output fs_0x000000.glsl` to decompile the SPIR-V IR to GLSL.
|
||||
|
||||
3. Edit the GLSL file as you wish
|
||||
|
||||
4. To compile back to SPIR-V, run (change the _**-fshader-stage**_ to correct stage):
|
||||
`glslc --target-env=vulkan1.3 --target-spv=spv1.6 -fshader-stage=frag fs_0x000000.glsl -o fs_0x000000.spv`
|
||||
|
||||
5. Put the updated .spv file to `shader/patch` folder with the same name as the original shader
|
||||
|
||||
6. Enable `patchShaders` in config.toml
|
36
externals/CMakeLists.txt
vendored
36
externals/CMakeLists.txt
vendored
|
@ -38,7 +38,8 @@ else()
|
|||
set(CRYPTOPP_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/)
|
||||
add_subdirectory(cryptopp-cmake)
|
||||
file(COPY cryptopp DESTINATION cryptopp FILES_MATCHING PATTERN "*.h")
|
||||
target_include_directories(cryptopp INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/cryptopp")
|
||||
# remove externals/cryptopp from include directories because it contains a conflicting zlib.h file
|
||||
set_target_properties(cryptopp PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/cryptopp")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -52,16 +53,23 @@ file(GLOB LIBATRAC9_SOURCES LibAtrac9/C/src/*.c)
|
|||
add_library(LibAtrac9 STATIC ${LIBATRAC9_SOURCES})
|
||||
target_include_directories(LibAtrac9 INTERFACE LibAtrac9/C/src)
|
||||
|
||||
# Zlib-Ng
|
||||
if (NOT TARGET zlib-ng::zlib)
|
||||
# zlib
|
||||
if (NOT TARGET ZLIB::ZLIB)
|
||||
set(ZLIB_ENABLE_TESTS OFF)
|
||||
set(WITH_GTEST OFF)
|
||||
set(WITH_NEW_STRATEGIES ON)
|
||||
set(WITH_NATIVE_INSTRUCTIONS ON)
|
||||
set(ZLIB_COMPAT ON CACHE BOOL "" FORCE)
|
||||
add_subdirectory(zlib-ng)
|
||||
add_library(zlib-ng::zlib ALIAS zlib)
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
ZLIB
|
||||
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/zlib-ng"
|
||||
OVERRIDE_FIND_PACKAGE
|
||||
)
|
||||
FetchContent_MakeAvailable(ZLIB)
|
||||
add_library(ZLIB::ZLIB ALIAS zlib)
|
||||
# libpng expects this variable to exist after its find_package(ZLIB)
|
||||
set(ZLIB_INCLUDE_DIRS "${FETCHCONTENT_BASE_DIR}/zlib-build")
|
||||
endif()
|
||||
|
||||
# SDL3
|
||||
|
@ -156,15 +164,15 @@ if (NOT TARGET half::half)
|
|||
endif()
|
||||
|
||||
# libpng
|
||||
set(PNG_SHARED OFF CACHE BOOL "" FORCE)
|
||||
set(PNG_STATIC ON CACHE BOOL "" FORCE)
|
||||
set(PNG_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set(PNG_TOOLS OFF CACHE BOOL "" FORCE)
|
||||
set(SKIP_INSTALL_ALL OFF CACHE BOOL "" FORCE)
|
||||
set(ZLIB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/zlib-ng" CACHE STRING "" FORCE)
|
||||
set(ZLIB_LIBRARY "${CMAKE_CURRENT_BINARY_DIR}/zlib-ng/zlibstatic-ngd" CACHE STRING "" FORCE)
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/libpng/zlib.h" "#include \"../zlib-ng/zlib.h\"")
|
||||
add_subdirectory(libpng)
|
||||
if (NOT TARGET PNG::PNG)
|
||||
set(PNG_SHARED OFF CACHE BOOL "" FORCE)
|
||||
set(PNG_STATIC ON CACHE BOOL "" FORCE)
|
||||
set(PNG_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set(PNG_TOOLS OFF CACHE BOOL "" FORCE)
|
||||
set(SKIP_INSTALL_ALL OFF CACHE BOOL "" FORCE)
|
||||
add_subdirectory(libpng)
|
||||
add_library(PNG::PNG ALIAS png_static)
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
# date
|
||||
|
|
2
externals/ffmpeg-core
vendored
2
externals/ffmpeg-core
vendored
|
@ -1 +1 @@
|
|||
Subproject commit e30b7d7fe228bfb3f6e41ce1040b44a15eb7d5e0
|
||||
Subproject commit 27de97c826b6b40c255891c37ac046a25836a575
|
|
@ -1,166 +0,0 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "sdl_audio.h"
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
|
||||
#include <SDL3/SDL_audio.h>
|
||||
#include <SDL3/SDL_init.h>
|
||||
#include <SDL3/SDL_timer.h>
|
||||
|
||||
#include <mutex> // std::unique_lock
|
||||
|
||||
namespace Audio {
|
||||
|
||||
constexpr int AUDIO_STREAM_BUFFER_THRESHOLD = 65536; // Define constant for buffer threshold
|
||||
|
||||
s32 SDLAudio::AudioOutOpen(int type, u32 samples_num, u32 freq,
|
||||
Libraries::AudioOut::OrbisAudioOutParamFormat format) {
|
||||
using Libraries::AudioOut::OrbisAudioOutParamFormat;
|
||||
std::unique_lock lock{m_mutex};
|
||||
for (int id = 0; id < portsOut.size(); id++) {
|
||||
auto& port = portsOut[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 OrbisAudioOutParamFormat::ORBIS_AUDIO_OUT_PARAM_FORMAT_S16_MONO:
|
||||
sampleFormat = SDL_AUDIO_S16;
|
||||
port.channels_num = 1;
|
||||
port.sample_size = 2;
|
||||
break;
|
||||
case OrbisAudioOutParamFormat::ORBIS_AUDIO_OUT_PARAM_FORMAT_FLOAT_MONO:
|
||||
sampleFormat = SDL_AUDIO_F32;
|
||||
port.channels_num = 1;
|
||||
port.sample_size = 4;
|
||||
break;
|
||||
case OrbisAudioOutParamFormat::ORBIS_AUDIO_OUT_PARAM_FORMAT_S16_STEREO:
|
||||
sampleFormat = SDL_AUDIO_S16;
|
||||
port.channels_num = 2;
|
||||
port.sample_size = 2;
|
||||
break;
|
||||
case OrbisAudioOutParamFormat::ORBIS_AUDIO_OUT_PARAM_FORMAT_FLOAT_STEREO:
|
||||
sampleFormat = SDL_AUDIO_F32;
|
||||
port.channels_num = 2;
|
||||
port.sample_size = 4;
|
||||
break;
|
||||
case OrbisAudioOutParamFormat::ORBIS_AUDIO_OUT_PARAM_FORMAT_S16_8CH:
|
||||
sampleFormat = SDL_AUDIO_S16;
|
||||
port.channels_num = 8;
|
||||
port.sample_size = 2;
|
||||
break;
|
||||
case OrbisAudioOutParamFormat::ORBIS_AUDIO_OUT_PARAM_FORMAT_FLOAT_8CH:
|
||||
sampleFormat = SDL_AUDIO_F32;
|
||||
port.channels_num = 8;
|
||||
port.sample_size = 4;
|
||||
break;
|
||||
case OrbisAudioOutParamFormat::ORBIS_AUDIO_OUT_PARAM_FORMAT_S16_8CH_STD:
|
||||
sampleFormat = SDL_AUDIO_S16;
|
||||
port.channels_num = 8;
|
||||
port.sample_size = 2;
|
||||
break;
|
||||
case OrbisAudioOutParamFormat::ORBIS_AUDIO_OUT_PARAM_FORMAT_FLOAT_8CH_STD:
|
||||
sampleFormat = SDL_AUDIO_F32;
|
||||
port.channels_num = 8;
|
||||
port.sample_size = 4;
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE_MSG("Unknown format");
|
||||
}
|
||||
|
||||
for (int i = 0; i < port.channels_num; i++) {
|
||||
port.volume[i] = Libraries::AudioOut::SCE_AUDIO_OUT_VOLUME_0DB;
|
||||
}
|
||||
|
||||
SDL_AudioSpec fmt;
|
||||
SDL_zero(fmt);
|
||||
fmt.format = sampleFormat;
|
||||
fmt.channels = port.channels_num;
|
||||
fmt.freq = freq; // Set frequency from the argument
|
||||
port.stream =
|
||||
SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &fmt, NULL, NULL);
|
||||
SDL_ResumeAudioDevice(SDL_GetAudioStreamDevice(port.stream));
|
||||
return id + 1;
|
||||
}
|
||||
}
|
||||
|
||||
LOG_ERROR(Lib_AudioOut, "Audio ports are full");
|
||||
return ORBIS_AUDIO_OUT_ERROR_PORT_FULL; // all ports are used
|
||||
}
|
||||
|
||||
s32 SDLAudio::AudioOutOutput(s32 handle, const void* ptr) {
|
||||
std::shared_lock lock{m_mutex};
|
||||
auto& port = portsOut[handle - 1];
|
||||
if (!port.isOpen) {
|
||||
return ORBIS_AUDIO_OUT_ERROR_INVALID_PORT;
|
||||
}
|
||||
|
||||
const size_t data_size = port.samples_num * port.sample_size * port.channels_num;
|
||||
|
||||
bool result = SDL_PutAudioStreamData(port.stream, ptr, data_size);
|
||||
|
||||
lock.unlock(); // Unlock only after necessary operations
|
||||
|
||||
while (SDL_GetAudioStreamAvailable(port.stream) > AUDIO_STREAM_BUFFER_THRESHOLD) {
|
||||
SDL_Delay(0);
|
||||
}
|
||||
|
||||
return result ? ORBIS_OK : -1;
|
||||
}
|
||||
|
||||
s32 SDLAudio::AudioOutSetVolume(s32 handle, s32 bitflag, s32* volume) {
|
||||
using Libraries::AudioOut::OrbisAudioOutParamFormat;
|
||||
std::shared_lock lock{m_mutex};
|
||||
auto& port = portsOut[handle - 1];
|
||||
if (!port.isOpen) {
|
||||
return ORBIS_AUDIO_OUT_ERROR_INVALID_PORT;
|
||||
}
|
||||
|
||||
for (int i = 0; i < port.channels_num; i++, bitflag >>= 1u) {
|
||||
auto bit = bitflag & 0x1u;
|
||||
|
||||
if (bit == 1) {
|
||||
int src_index = i;
|
||||
if (port.format ==
|
||||
OrbisAudioOutParamFormat::ORBIS_AUDIO_OUT_PARAM_FORMAT_FLOAT_8CH_STD ||
|
||||
port.format == OrbisAudioOutParamFormat::ORBIS_AUDIO_OUT_PARAM_FORMAT_S16_8CH_STD) {
|
||||
switch (i) {
|
||||
case 4:
|
||||
src_index = 6;
|
||||
break;
|
||||
case 5:
|
||||
src_index = 7;
|
||||
break;
|
||||
case 6:
|
||||
src_index = 4;
|
||||
break;
|
||||
case 7:
|
||||
src_index = 5;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
port.volume[i] = volume[src_index];
|
||||
}
|
||||
}
|
||||
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
s32 SDLAudio::AudioOutGetStatus(s32 handle, int* type, int* channels_num) {
|
||||
std::shared_lock lock{m_mutex};
|
||||
auto& port = portsOut[handle - 1];
|
||||
*type = port.type;
|
||||
*channels_num = port.channels_num;
|
||||
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
} // namespace Audio
|
|
@ -1,39 +0,0 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <shared_mutex>
|
||||
#include <SDL3/SDL_audio.h>
|
||||
#include "core/libraries/audio/audioout.h"
|
||||
|
||||
namespace Audio {
|
||||
|
||||
class SDLAudio {
|
||||
public:
|
||||
SDLAudio() = default;
|
||||
virtual ~SDLAudio() = default;
|
||||
|
||||
s32 AudioOutOpen(int type, u32 samples_num, u32 freq,
|
||||
Libraries::AudioOut::OrbisAudioOutParamFormat format);
|
||||
s32 AudioOutOutput(s32 handle, const void* ptr);
|
||||
s32 AudioOutSetVolume(s32 handle, s32 bitflag, s32* volume);
|
||||
s32 AudioOutGetStatus(s32 handle, int* type, int* channels_num);
|
||||
|
||||
private:
|
||||
struct PortOut {
|
||||
SDL_AudioStream* stream = nullptr;
|
||||
u32 samples_num = 0;
|
||||
u32 freq = 0;
|
||||
u32 format = -1;
|
||||
int type = 0;
|
||||
int channels_num = 0;
|
||||
int volume[8] = {};
|
||||
u8 sample_size = 0;
|
||||
bool isOpen = false;
|
||||
};
|
||||
std::shared_mutex m_mutex;
|
||||
std::array<PortOut, Libraries::AudioOut::SCE_AUDIO_OUT_NUM_PORTS> portsOut;
|
||||
};
|
||||
|
||||
} // namespace Audio
|
|
@ -22,6 +22,12 @@ template <typename T>
|
|||
return static_cast<T>(value - value % size);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
requires std::is_integral_v<T>
|
||||
[[nodiscard]] constexpr bool IsAligned(T value, std::size_t alignment) {
|
||||
return (value & (alignment - 1)) == 0;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
requires std::is_integral_v<T>
|
||||
[[nodiscard]] constexpr bool Is16KBAligned(T value) {
|
||||
|
|
|
@ -47,11 +47,13 @@ static std::string backButtonBehavior = "left";
|
|||
static bool useSpecialPad = false;
|
||||
static int specialPadClass = 1;
|
||||
static bool isDebugDump = false;
|
||||
static bool isShaderDebug = false;
|
||||
static bool isShowSplash = false;
|
||||
static bool isAutoUpdate = false;
|
||||
static bool isNullGpu = false;
|
||||
static bool shouldCopyGPUBuffers = false;
|
||||
static bool shouldDumpShaders = false;
|
||||
static bool shouldPatchShaders = true;
|
||||
static u32 vblankDivider = 1;
|
||||
static bool vkValidation = false;
|
||||
static bool vkValidationSync = false;
|
||||
|
@ -158,6 +160,10 @@ bool debugDump() {
|
|||
return isDebugDump;
|
||||
}
|
||||
|
||||
bool collectShadersForDebug() {
|
||||
return isShaderDebug;
|
||||
}
|
||||
|
||||
bool showSplash() {
|
||||
return isShowSplash;
|
||||
}
|
||||
|
@ -178,6 +184,10 @@ bool dumpShaders() {
|
|||
return shouldDumpShaders;
|
||||
}
|
||||
|
||||
bool patchShaders() {
|
||||
return shouldPatchShaders;
|
||||
}
|
||||
|
||||
bool isRdocEnabled() {
|
||||
return rdocEnable;
|
||||
}
|
||||
|
@ -230,6 +240,10 @@ void setDebugDump(bool enable) {
|
|||
isDebugDump = enable;
|
||||
}
|
||||
|
||||
void setCollectShaderForDebug(bool enable) {
|
||||
isShaderDebug = enable;
|
||||
}
|
||||
|
||||
void setShowSplash(bool enable) {
|
||||
isShowSplash = enable;
|
||||
}
|
||||
|
@ -546,6 +560,7 @@ void load(const std::filesystem::path& path) {
|
|||
isNullGpu = toml::find_or<bool>(gpu, "nullGpu", false);
|
||||
shouldCopyGPUBuffers = toml::find_or<bool>(gpu, "copyGPUBuffers", false);
|
||||
shouldDumpShaders = toml::find_or<bool>(gpu, "dumpShaders", false);
|
||||
shouldPatchShaders = toml::find_or<bool>(gpu, "patchShaders", true);
|
||||
vblankDivider = toml::find_or<int>(gpu, "vblankDivider", 1);
|
||||
}
|
||||
|
||||
|
@ -565,6 +580,7 @@ void load(const std::filesystem::path& path) {
|
|||
const toml::value& debug = data.at("Debug");
|
||||
|
||||
isDebugDump = toml::find_or<bool>(debug, "DebugDump", false);
|
||||
isShaderDebug = toml::find_or<bool>(debug, "CollectShader", false);
|
||||
}
|
||||
|
||||
if (data.contains("GUI")) {
|
||||
|
@ -646,6 +662,7 @@ void save(const std::filesystem::path& path) {
|
|||
data["GPU"]["nullGpu"] = isNullGpu;
|
||||
data["GPU"]["copyGPUBuffers"] = shouldCopyGPUBuffers;
|
||||
data["GPU"]["dumpShaders"] = shouldDumpShaders;
|
||||
data["GPU"]["patchShaders"] = shouldPatchShaders;
|
||||
data["GPU"]["vblankDivider"] = vblankDivider;
|
||||
data["Vulkan"]["gpuId"] = gpuId;
|
||||
data["Vulkan"]["validation"] = vkValidation;
|
||||
|
@ -655,6 +672,7 @@ void save(const std::filesystem::path& path) {
|
|||
data["Vulkan"]["rdocMarkersEnable"] = vkMarkers;
|
||||
data["Vulkan"]["crashDiagnostic"] = vkCrashDiagnostic;
|
||||
data["Debug"]["DebugDump"] = isDebugDump;
|
||||
data["Debug"]["CollectShader"] = isShaderDebug;
|
||||
data["GUI"]["theme"] = mw_themes;
|
||||
data["GUI"]["iconSize"] = m_icon_size;
|
||||
data["GUI"]["sliderPos"] = m_slider_pos;
|
||||
|
@ -710,6 +728,7 @@ void setDefaultValues() {
|
|||
useSpecialPad = false;
|
||||
specialPadClass = 1;
|
||||
isDebugDump = false;
|
||||
isShaderDebug = false;
|
||||
isShowSplash = false;
|
||||
isAutoUpdate = false;
|
||||
isNullGpu = false;
|
||||
|
|
|
@ -37,15 +37,18 @@ u32 getScreenHeight();
|
|||
s32 getGpuId();
|
||||
|
||||
bool debugDump();
|
||||
bool collectShadersForDebug();
|
||||
bool showSplash();
|
||||
bool autoUpdate();
|
||||
bool nullGpu();
|
||||
bool copyGPUCmdBuffers();
|
||||
bool dumpShaders();
|
||||
bool patchShaders();
|
||||
bool isRdocEnabled();
|
||||
u32 vblankDiv();
|
||||
|
||||
void setDebugDump(bool enable);
|
||||
void setCollectShaderForDebug(bool enable);
|
||||
void setShowSplash(bool enable);
|
||||
void setAutoUpdate(bool enable);
|
||||
void setNullGpu(bool enable);
|
||||
|
|
|
@ -105,7 +105,9 @@ bool ParseFilterRule(Filter& instance, Iterator begin, Iterator end) {
|
|||
SUB(Lib, Rtc) \
|
||||
SUB(Lib, DiscMap) \
|
||||
SUB(Lib, Png) \
|
||||
SUB(Lib, Jpeg) \
|
||||
SUB(Lib, PlayGo) \
|
||||
SUB(Lib, PlayGoDialog) \
|
||||
SUB(Lib, Random) \
|
||||
SUB(Lib, Usbd) \
|
||||
SUB(Lib, Ajm) \
|
||||
|
|
|
@ -72,7 +72,9 @@ enum class Class : u8 {
|
|||
Lib_Rtc, ///< The LibSceRtc implementation.
|
||||
Lib_DiscMap, ///< The LibSceDiscMap implementation.
|
||||
Lib_Png, ///< The LibScePng implementation.
|
||||
Lib_Jpeg, ///< The LibSceJpeg implementation.
|
||||
Lib_PlayGo, ///< The LibScePlayGo implementation.
|
||||
Lib_PlayGoDialog, ///< The LibScePlayGoDialog implementation.
|
||||
Lib_Random, ///< The libSceRandom implementation.
|
||||
Lib_Usbd, ///< The LibSceUsbd implementation.
|
||||
Lib_Ajm, ///< The LibSceAjm implementation.
|
||||
|
|
|
@ -28,7 +28,7 @@ std::string g_game_serial;
|
|||
std::string patchFile;
|
||||
std::vector<patchInfo> pending_patches;
|
||||
|
||||
std::string toHex(unsigned long long value, size_t byteSize) {
|
||||
std::string toHex(u64 value, size_t byteSize) {
|
||||
std::stringstream ss;
|
||||
ss << std::hex << std::setfill('0') << std::setw(byteSize * 2) << value;
|
||||
return ss.str();
|
||||
|
@ -38,16 +38,16 @@ std::string convertValueToHex(const std::string type, const std::string valueStr
|
|||
std::string result;
|
||||
|
||||
if (type == "byte") {
|
||||
unsigned int value = std::stoul(valueStr, nullptr, 16);
|
||||
const u32 value = std::stoul(valueStr, nullptr, 16);
|
||||
result = toHex(value, 1);
|
||||
} else if (type == "bytes16") {
|
||||
unsigned int value = std::stoul(valueStr, nullptr, 16);
|
||||
const u32 value = std::stoul(valueStr, nullptr, 16);
|
||||
result = toHex(value, 2);
|
||||
} else if (type == "bytes32") {
|
||||
unsigned long value = std::stoul(valueStr, nullptr, 16);
|
||||
const u32 value = std::stoul(valueStr, nullptr, 16);
|
||||
result = toHex(value, 4);
|
||||
} else if (type == "bytes64") {
|
||||
unsigned long long value = std::stoull(valueStr, nullptr, 16);
|
||||
const u64 value = std::stoull(valueStr, nullptr, 16);
|
||||
result = toHex(value, 8);
|
||||
} else if (type == "float32") {
|
||||
union {
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "common/types.h"
|
||||
|
||||
namespace Core {
|
||||
|
||||
/// Initializes a stack for the current thread for use by patch implementations.
|
||||
|
|
|
@ -157,7 +157,7 @@ void DebugStateImpl::PushRegsDump(uintptr_t base_addr, uintptr_t header_addr,
|
|||
if (is_compute) {
|
||||
dump.is_compute = true;
|
||||
const auto& cs = dump.regs.cs_program;
|
||||
dump.cs_data = ComputerShaderDump{
|
||||
dump.cs_data = PipelineComputerProgramDump{
|
||||
.cs_program = cs,
|
||||
.code = std::vector<u32>{cs.Code().begin(), cs.Code().end()},
|
||||
};
|
||||
|
@ -167,7 +167,7 @@ void DebugStateImpl::PushRegsDump(uintptr_t base_addr, uintptr_t header_addr,
|
|||
auto stage = regs.ProgramForStage(i);
|
||||
if (stage->address_lo != 0) {
|
||||
auto code = stage->Code();
|
||||
dump.stages[i] = ShaderDump{
|
||||
dump.stages[i] = PipelineShaderProgramDump{
|
||||
.user_data = *stage,
|
||||
.code = std::vector<u32>{code.begin(), code.end()},
|
||||
};
|
||||
|
@ -176,3 +176,10 @@ void DebugStateImpl::PushRegsDump(uintptr_t base_addr, uintptr_t header_addr,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DebugStateImpl::CollectShader(const std::string& name, std::span<const u32> spv,
|
||||
std::span<const u32> raw_code) {
|
||||
shader_dump_list.emplace_back(name, std::vector<u32>{spv.begin(), spv.end()},
|
||||
std::vector<u32>{raw_code.begin(), raw_code.end()});
|
||||
std::ranges::sort(shader_dump_list, {}, &ShaderDump::name);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,8 @@ namespace Core::Devtools {
|
|||
class Layer;
|
||||
namespace Widget {
|
||||
class FrameGraph;
|
||||
}
|
||||
class ShaderList;
|
||||
} // namespace Widget
|
||||
} // namespace Core::Devtools
|
||||
|
||||
namespace DebugStateType {
|
||||
|
@ -49,12 +50,12 @@ struct QueueDump {
|
|||
uintptr_t base_addr;
|
||||
};
|
||||
|
||||
struct ShaderDump {
|
||||
struct PipelineShaderProgramDump {
|
||||
Vulkan::Liverpool::ShaderProgram user_data{};
|
||||
std::vector<u32> code{};
|
||||
};
|
||||
|
||||
struct ComputerShaderDump {
|
||||
struct PipelineComputerProgramDump {
|
||||
Vulkan::Liverpool::ComputeProgram cs_program{};
|
||||
std::vector<u32> code{};
|
||||
};
|
||||
|
@ -63,8 +64,8 @@ struct RegDump {
|
|||
bool is_compute{false};
|
||||
static constexpr size_t MaxShaderStages = 5;
|
||||
Vulkan::Liverpool::Regs regs{};
|
||||
std::array<ShaderDump, MaxShaderStages> stages{};
|
||||
ComputerShaderDump cs_data{};
|
||||
std::array<PipelineShaderProgramDump, MaxShaderStages> stages{};
|
||||
PipelineComputerProgramDump cs_data{};
|
||||
};
|
||||
|
||||
struct FrameDump {
|
||||
|
@ -73,9 +74,41 @@ struct FrameDump {
|
|||
std::unordered_map<uintptr_t, RegDump> regs; // address -> reg dump
|
||||
};
|
||||
|
||||
struct ShaderDump {
|
||||
std::string name;
|
||||
std::vector<u32> spv;
|
||||
std::vector<u32> raw_code;
|
||||
|
||||
std::string cache_spv_disasm{};
|
||||
std::string cache_raw_disasm{};
|
||||
|
||||
ShaderDump(std::string name, std::vector<u32> spv, std::vector<u32> raw_code)
|
||||
: name(std::move(name)), spv(std::move(spv)), raw_code(std::move(raw_code)) {}
|
||||
|
||||
ShaderDump(const ShaderDump& other) = delete;
|
||||
ShaderDump(ShaderDump&& other) noexcept
|
||||
: name{std::move(other.name)}, spv{std::move(other.spv)},
|
||||
raw_code{std::move(other.raw_code)}, cache_spv_disasm{std::move(other.cache_spv_disasm)},
|
||||
cache_raw_disasm{std::move(other.cache_raw_disasm)} {}
|
||||
ShaderDump& operator=(const ShaderDump& other) = delete;
|
||||
ShaderDump& operator=(ShaderDump&& other) noexcept {
|
||||
if (this == &other)
|
||||
return *this;
|
||||
name = std::move(other.name);
|
||||
spv = std::move(other.spv);
|
||||
raw_code = std::move(other.raw_code);
|
||||
cache_spv_disasm = std::move(other.cache_spv_disasm);
|
||||
cache_raw_disasm = std::move(other.cache_raw_disasm);
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
class DebugStateImpl {
|
||||
friend class Core::Devtools::Layer;
|
||||
friend class Core::Devtools::Widget::FrameGraph;
|
||||
friend class Core::Devtools::Widget::ShaderList;
|
||||
|
||||
std::queue<std::string> debug_message_popup;
|
||||
|
||||
std::mutex guest_threads_mutex{};
|
||||
std::vector<ThreadID> guest_threads{};
|
||||
|
@ -94,7 +127,7 @@ class DebugStateImpl {
|
|||
std::shared_mutex frame_dump_list_mutex;
|
||||
std::vector<FrameDump> frame_dump_list{};
|
||||
|
||||
std::queue<std::string> debug_message_popup;
|
||||
std::vector<ShaderDump> shader_dump_list{};
|
||||
|
||||
public:
|
||||
void ShowDebugMessage(std::string message) {
|
||||
|
@ -152,6 +185,9 @@ public:
|
|||
|
||||
void PushRegsDump(uintptr_t base_addr, uintptr_t header_addr,
|
||||
const AmdGpu::Liverpool::Regs& regs, bool is_compute = false);
|
||||
|
||||
void CollectShader(const std::string& name, std::span<const u32> spv,
|
||||
std::span<const u32> raw_code);
|
||||
};
|
||||
} // namespace DebugStateType
|
||||
|
||||
|
|
|
@ -289,6 +289,16 @@ const char* GetContextRegName(u32 reg_offset) {
|
|||
return "mmSPI_PS_INPUT_CNTL_2";
|
||||
case mmSPI_PS_INPUT_CNTL_3:
|
||||
return "mmSPI_PS_INPUT_CNTL_3";
|
||||
case mmPA_SU_POLY_OFFSET_FRONT_SCALE:
|
||||
return "mmPA_SU_POLY_OFFSET_FRONT_SCALE";
|
||||
case mmPA_SU_POLY_OFFSET_FRONT_OFFSET:
|
||||
return "mmPA_SU_POLY_OFFSET_FRONT_OFFSET";
|
||||
case mmPA_SU_POLY_OFFSET_BACK_SCALE:
|
||||
return "mmPA_SU_POLY_OFFSET_BACK_SCALE";
|
||||
case mmPA_SU_POLY_OFFSET_BACK_OFFSET:
|
||||
return "mmPA_SU_POLY_OFFSET_BACK_OFFSET";
|
||||
case mmPA_SU_POLY_OFFSET_CLAMP:
|
||||
return "mmPA_SU_POLY_OFFSET_CLAMP";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "layer.h"
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
#include "common/config.h"
|
||||
|
@ -9,11 +11,12 @@
|
|||
#include "core/debug_state.h"
|
||||
#include "imgui/imgui_std.h"
|
||||
#include "imgui_internal.h"
|
||||
#include "layer.h"
|
||||
#include "options.h"
|
||||
#include "video_core/renderer_vulkan/vk_presenter.h"
|
||||
#include "widget/frame_dump.h"
|
||||
#include "widget/frame_graph.h"
|
||||
#include "widget/memory_map.h"
|
||||
#include "widget/shader_list.h"
|
||||
|
||||
extern std::unique_ptr<Vulkan::Presenter> presenter;
|
||||
|
||||
|
@ -35,6 +38,9 @@ static float debug_popup_timing = 3.0f;
|
|||
|
||||
static bool just_opened_options = false;
|
||||
|
||||
static Widget::MemoryMapViewer memory_map;
|
||||
static Widget::ShaderList shader_list;
|
||||
|
||||
// clang-format off
|
||||
static std::string help_text =
|
||||
#include "help.txt"
|
||||
|
@ -63,6 +69,7 @@ void L::DrawMenuBar() {
|
|||
}
|
||||
if (BeginMenu("GPU Tools")) {
|
||||
MenuItem("Show frame info", nullptr, &frame_graph.is_open);
|
||||
MenuItem("Show loaded shaders", nullptr, &shader_list.open);
|
||||
if (BeginMenu("Dump frames")) {
|
||||
SliderInt("Count", &dump_frame_count, 1, 5);
|
||||
if (MenuItem("Dump", "Ctrl+Alt+F9", nullptr, !DebugState.DumpingCurrentFrame())) {
|
||||
|
@ -81,6 +88,12 @@ void L::DrawMenuBar() {
|
|||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
if (BeginMenu("Debug")) {
|
||||
if (MenuItem("Memory map")) {
|
||||
memory_map.open = true;
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
EndMainMenuBar();
|
||||
}
|
||||
|
||||
|
@ -175,19 +188,29 @@ void L::DrawAdvanced() {
|
|||
bool close_popup_options = true;
|
||||
if (BeginPopupModal("GPU Tools Options", &close_popup_options,
|
||||
ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings)) {
|
||||
static char disassembly_cli[512];
|
||||
static char disassembler_cli_isa[512];
|
||||
static char disassembler_cli_spv[512];
|
||||
static bool frame_dump_render_on_collapse;
|
||||
|
||||
if (just_opened_options) {
|
||||
just_opened_options = false;
|
||||
auto s = Options.disassembly_cli.copy(disassembly_cli, sizeof(disassembly_cli) - 1);
|
||||
disassembly_cli[s] = '\0';
|
||||
auto s = Options.disassembler_cli_isa.copy(disassembler_cli_isa,
|
||||
sizeof(disassembler_cli_isa) - 1);
|
||||
disassembler_cli_isa[s] = '\0';
|
||||
s = Options.disassembler_cli_spv.copy(disassembler_cli_spv,
|
||||
sizeof(disassembler_cli_spv) - 1);
|
||||
disassembler_cli_spv[s] = '\0';
|
||||
frame_dump_render_on_collapse = Options.frame_dump_render_on_collapse;
|
||||
}
|
||||
|
||||
InputText("Shader disassembler: ", disassembly_cli, sizeof(disassembly_cli));
|
||||
InputText("Shader isa disassembler: ", disassembler_cli_isa, sizeof(disassembler_cli_isa));
|
||||
if (IsItemHovered()) {
|
||||
SetTooltip(R"(Command to disassemble shaders. Example "dis.exe" --raw "{src}")");
|
||||
SetTooltip(R"(Command to disassemble shaders. Example: dis.exe --raw "{src}")");
|
||||
}
|
||||
InputText("Shader SPIRV disassembler: ", disassembler_cli_spv,
|
||||
sizeof(disassembler_cli_spv));
|
||||
if (IsItemHovered()) {
|
||||
SetTooltip(R"(Command to disassemble shaders. Example: spirv-cross -V "{src}")");
|
||||
}
|
||||
Checkbox("Show frame dump popups even when collapsed", &frame_dump_render_on_collapse);
|
||||
if (IsItemHovered()) {
|
||||
|
@ -196,7 +219,8 @@ void L::DrawAdvanced() {
|
|||
}
|
||||
|
||||
if (Button("Save")) {
|
||||
Options.disassembly_cli = disassembly_cli;
|
||||
Options.disassembler_cli_isa = disassembler_cli_isa;
|
||||
Options.disassembler_cli_spv = disassembler_cli_spv;
|
||||
Options.frame_dump_render_on_collapse = frame_dump_render_on_collapse;
|
||||
SaveIniSettingsToDisk(io.IniFilename);
|
||||
CloseCurrentPopup();
|
||||
|
@ -219,6 +243,13 @@ void L::DrawAdvanced() {
|
|||
|
||||
EndPopup();
|
||||
}
|
||||
|
||||
if (memory_map.open) {
|
||||
memory_map.Draw();
|
||||
}
|
||||
if (shader_list.open) {
|
||||
shader_list.Draw();
|
||||
}
|
||||
}
|
||||
|
||||
void L::DrawSimple() {
|
||||
|
|
|
@ -12,8 +12,12 @@ TOptions Options;
|
|||
void LoadOptionsConfig(const char* line) {
|
||||
char str[512];
|
||||
int i;
|
||||
if (sscanf(line, "disassembly_cli=%511[^\n]", str) == 1) {
|
||||
Options.disassembly_cli = str;
|
||||
if (sscanf(line, "disassembler_cli_isa=%511[^\n]", str) == 1) {
|
||||
Options.disassembler_cli_isa = str;
|
||||
return;
|
||||
}
|
||||
if (sscanf(line, "disassembler_cli_spv=%511[^\n]", str) == 1) {
|
||||
Options.disassembler_cli_spv = str;
|
||||
return;
|
||||
}
|
||||
if (sscanf(line, "frame_dump_render_on_collapse=%d", &i) == 1) {
|
||||
|
@ -23,7 +27,8 @@ void LoadOptionsConfig(const char* line) {
|
|||
}
|
||||
|
||||
void SerializeOptionsConfig(ImGuiTextBuffer* buf) {
|
||||
buf->appendf("disassembly_cli=%s\n", Options.disassembly_cli.c_str());
|
||||
buf->appendf("disassembler_cli_isa=%s\n", Options.disassembler_cli_isa.c_str());
|
||||
buf->appendf("disassembler_cli_spv=%s\n", Options.disassembler_cli_spv.c_str());
|
||||
buf->appendf("frame_dump_render_on_collapse=%d\n", Options.frame_dump_render_on_collapse);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,8 @@ struct ImGuiTextBuffer;
|
|||
namespace Core::Devtools {
|
||||
|
||||
struct TOptions {
|
||||
std::string disassembly_cli{};
|
||||
std::string disassembler_cli_isa{"clrxdisasm --raw \"{src}\""};
|
||||
std::string disassembler_cli_spv{"spirv-cross -V \"{src}\""};
|
||||
bool frame_dump_render_on_collapse{false};
|
||||
};
|
||||
|
||||
|
|
|
@ -1306,7 +1306,7 @@ void CmdListViewer::Draw(bool only_batches_view) {
|
|||
if (batch.id == batch_bp) { // highlight batch at breakpoint
|
||||
PushStyleColor(ImGuiCol_Header, ImVec4{1.0f, 0.5f, 0.5f, 0.5f});
|
||||
}
|
||||
if (batch.id == highlight_batch) {
|
||||
if (batch.id == highlight_batch && !group_batches) {
|
||||
PushStyleColor(ImGuiCol_Text, ImVec4{1.0f, 0.7f, 0.7f, 1.0f});
|
||||
}
|
||||
|
||||
|
@ -1459,7 +1459,7 @@ void CmdListViewer::Draw(bool only_batches_view) {
|
|||
}
|
||||
}
|
||||
|
||||
if (batch.id == highlight_batch) {
|
||||
if (batch.id == highlight_batch && !group_batches) {
|
||||
PopStyleColor();
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <variant>
|
||||
|
@ -10,9 +11,16 @@
|
|||
#include <magic_enum.hpp>
|
||||
|
||||
#include "common/bit_field.h"
|
||||
#include "common/io_file.h"
|
||||
#include "common/types.h"
|
||||
#include "core/debug_state.h"
|
||||
#include "video_core/amdgpu/pm4_opcodes.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define popen _popen
|
||||
#define pclose _pclose
|
||||
#endif
|
||||
|
||||
namespace Core::Devtools::Widget {
|
||||
/*
|
||||
* Generic PM4 header
|
||||
|
@ -106,4 +114,53 @@ static bool IsDrawCall(AmdGpu::PM4ItOpcode opcode) {
|
|||
}
|
||||
}
|
||||
|
||||
inline std::optional<std::string> exec_cli(const char* cli) {
|
||||
std::array<char, 64> buffer{};
|
||||
std::string output;
|
||||
const auto f = popen(cli, "r");
|
||||
if (!f) {
|
||||
pclose(f);
|
||||
return {};
|
||||
}
|
||||
while (fgets(buffer.data(), buffer.size(), f)) {
|
||||
output += buffer.data();
|
||||
}
|
||||
pclose(f);
|
||||
return output;
|
||||
}
|
||||
|
||||
inline std::string RunDisassembler(const std::string& disassembler_cli,
|
||||
const std::vector<u32>& shader_code) {
|
||||
std::string shader_dis;
|
||||
|
||||
if (disassembler_cli.empty()) {
|
||||
shader_dis = "No disassembler set";
|
||||
} else {
|
||||
auto bin_path = std::filesystem::temp_directory_path() / "shadps4_tmp_shader.bin";
|
||||
|
||||
constexpr std::string_view src_arg = "{src}";
|
||||
std::string cli = disassembler_cli;
|
||||
const auto pos = cli.find(src_arg);
|
||||
if (pos == std::string::npos) {
|
||||
DebugState.ShowDebugMessage("Disassembler CLI does not contain {src} argument\n" +
|
||||
disassembler_cli);
|
||||
} else {
|
||||
cli.replace(pos, src_arg.size(), "\"" + bin_path.string() + "\"");
|
||||
Common::FS::IOFile file(bin_path, Common::FS::FileAccessMode::Write);
|
||||
file.Write(shader_code);
|
||||
file.Close();
|
||||
|
||||
auto result = exec_cli(cli.c_str());
|
||||
shader_dis = result.value_or("Could not disassemble shader");
|
||||
if (shader_dis.empty()) {
|
||||
shader_dis = "Disassembly empty or failed";
|
||||
}
|
||||
|
||||
std::filesystem::remove(bin_path);
|
||||
}
|
||||
}
|
||||
|
||||
return shader_dis;
|
||||
}
|
||||
|
||||
} // namespace Core::Devtools::Widget
|
|
@ -458,7 +458,7 @@ struct MemoryEditor {
|
|||
data_write = data_next = true;
|
||||
if (data_editing_addr_next != (size_t)-1)
|
||||
data_write = data_next = false;
|
||||
unsigned int data_input_value = 0;
|
||||
u32 data_input_value = 0;
|
||||
if (!ReadOnly && data_write &&
|
||||
sscanf(DataInputBuf, "%X", &data_input_value) == 1) {
|
||||
if (WriteFn)
|
||||
|
|
135
src/core/devtools/widget/memory_map.cpp
Normal file
135
src/core/devtools/widget/memory_map.cpp
Normal file
|
@ -0,0 +1,135 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <cinttypes>
|
||||
#include <imgui.h>
|
||||
#include <magic_enum.hpp>
|
||||
|
||||
#include "core/debug_state.h"
|
||||
#include "core/memory.h"
|
||||
#include "memory_map.h"
|
||||
|
||||
using namespace ImGui;
|
||||
|
||||
namespace Core::Devtools::Widget {
|
||||
|
||||
bool MemoryMapViewer::Iterator::DrawLine() {
|
||||
if (is_vma) {
|
||||
if (vma.it == vma.end) {
|
||||
return false;
|
||||
}
|
||||
auto m = vma.it->second;
|
||||
if (m.type == VMAType::Free) {
|
||||
++vma.it;
|
||||
return DrawLine();
|
||||
}
|
||||
TableNextColumn();
|
||||
Text("%" PRIXPTR, m.base);
|
||||
TableNextColumn();
|
||||
Text("%zX", m.size);
|
||||
TableNextColumn();
|
||||
Text("%s", magic_enum::enum_name(m.type).data());
|
||||
TableNextColumn();
|
||||
Text("%s", magic_enum::enum_name(m.prot).data());
|
||||
TableNextColumn();
|
||||
if (m.is_exec) {
|
||||
Text("X");
|
||||
}
|
||||
TableNextColumn();
|
||||
Text("%s", m.name.c_str());
|
||||
++vma.it;
|
||||
return true;
|
||||
}
|
||||
if (dmem.it == dmem.end) {
|
||||
return false;
|
||||
}
|
||||
auto m = dmem.it->second;
|
||||
if (m.is_free) {
|
||||
++dmem.it;
|
||||
return DrawLine();
|
||||
}
|
||||
TableNextColumn();
|
||||
Text("%" PRIXPTR, m.base);
|
||||
TableNextColumn();
|
||||
Text("%zX", m.size);
|
||||
TableNextColumn();
|
||||
auto type = static_cast<::Libraries::Kernel::MemoryTypes>(m.memory_type);
|
||||
Text("%s", magic_enum::enum_name(type).data());
|
||||
TableNextColumn();
|
||||
Text("%d", m.is_pooled);
|
||||
++dmem.it;
|
||||
return true;
|
||||
}
|
||||
|
||||
void MemoryMapViewer::Draw() {
|
||||
SetNextWindowSize({600.0f, 500.0f}, ImGuiCond_FirstUseEver);
|
||||
if (!Begin("Memory map", &open)) {
|
||||
End();
|
||||
return;
|
||||
}
|
||||
|
||||
auto mem = Memory::Instance();
|
||||
std::scoped_lock lck{mem->mutex};
|
||||
|
||||
{
|
||||
bool next_showing_vma = showing_vma;
|
||||
if (showing_vma) {
|
||||
PushStyleColor(ImGuiCol_Button, ImVec4{1.0f, 0.7f, 0.7f, 1.0f});
|
||||
}
|
||||
if (Button("VMem")) {
|
||||
next_showing_vma = true;
|
||||
}
|
||||
if (showing_vma) {
|
||||
PopStyleColor();
|
||||
}
|
||||
SameLine();
|
||||
if (!showing_vma) {
|
||||
PushStyleColor(ImGuiCol_Button, ImVec4{1.0f, 0.7f, 0.7f, 1.0f});
|
||||
}
|
||||
if (Button("DMem")) {
|
||||
next_showing_vma = false;
|
||||
}
|
||||
if (!showing_vma) {
|
||||
PopStyleColor();
|
||||
}
|
||||
showing_vma = next_showing_vma;
|
||||
}
|
||||
|
||||
Iterator it{};
|
||||
if (showing_vma) {
|
||||
it.is_vma = true;
|
||||
it.vma.it = mem->vma_map.begin();
|
||||
it.vma.end = mem->vma_map.end();
|
||||
} else {
|
||||
it.is_vma = false;
|
||||
it.dmem.it = mem->dmem_map.begin();
|
||||
it.dmem.end = mem->dmem_map.end();
|
||||
}
|
||||
|
||||
if (BeginTable("memory_view_table", showing_vma ? 6 : 4,
|
||||
ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_RowBg |
|
||||
ImGuiTableFlags_SizingFixedFit)) {
|
||||
if (showing_vma) {
|
||||
TableSetupColumn("Address");
|
||||
TableSetupColumn("Size");
|
||||
TableSetupColumn("Type");
|
||||
TableSetupColumn("Prot");
|
||||
TableSetupColumn("Is Exec");
|
||||
TableSetupColumn("Name");
|
||||
} else {
|
||||
TableSetupColumn("Address");
|
||||
TableSetupColumn("Size");
|
||||
TableSetupColumn("Type");
|
||||
TableSetupColumn("Pooled");
|
||||
}
|
||||
TableHeadersRow();
|
||||
|
||||
while (it.DrawLine())
|
||||
;
|
||||
EndTable();
|
||||
}
|
||||
|
||||
End();
|
||||
}
|
||||
|
||||
} // namespace Core::Devtools::Widget
|
33
src/core/devtools/widget/memory_map.h
Normal file
33
src/core/devtools/widget/memory_map.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/memory.h"
|
||||
|
||||
namespace Core::Devtools::Widget {
|
||||
|
||||
class MemoryMapViewer {
|
||||
struct Iterator {
|
||||
bool is_vma;
|
||||
struct {
|
||||
MemoryManager::DMemMap::iterator it;
|
||||
MemoryManager::DMemMap::iterator end;
|
||||
} dmem;
|
||||
struct {
|
||||
MemoryManager::VMAMap::iterator it;
|
||||
MemoryManager::VMAMap::iterator end;
|
||||
} vma;
|
||||
|
||||
bool DrawLine();
|
||||
};
|
||||
|
||||
bool showing_vma = true;
|
||||
|
||||
public:
|
||||
bool open = false;
|
||||
|
||||
void Draw();
|
||||
};
|
||||
|
||||
} // namespace Core::Devtools::Widget
|
|
@ -25,21 +25,6 @@ using magic_enum::enum_name;
|
|||
|
||||
constexpr auto depth_id = 0xF3;
|
||||
|
||||
static std::optional<std::string> exec_cli(const char* cli) {
|
||||
std::array<char, 64> buffer{};
|
||||
std::string output;
|
||||
const auto f = popen(cli, "r");
|
||||
if (!f) {
|
||||
pclose(f);
|
||||
return {};
|
||||
}
|
||||
while (fgets(buffer.data(), buffer.size(), f)) {
|
||||
output += buffer.data();
|
||||
}
|
||||
pclose(f);
|
||||
return output;
|
||||
}
|
||||
|
||||
namespace Core::Devtools::Widget {
|
||||
|
||||
void RegView::ProcessShader(int shader_id) {
|
||||
|
@ -54,38 +39,12 @@ void RegView::ProcessShader(int shader_id) {
|
|||
user_data = s.user_data.user_data;
|
||||
}
|
||||
|
||||
std::string shader_dis;
|
||||
|
||||
if (Options.disassembly_cli.empty()) {
|
||||
shader_dis = "No disassembler set";
|
||||
} else {
|
||||
auto bin_path = std::filesystem::temp_directory_path() / "shadps4_tmp_shader.bin";
|
||||
|
||||
constexpr std::string_view src_arg = "{src}";
|
||||
std::string cli = Options.disassembly_cli;
|
||||
const auto pos = cli.find(src_arg);
|
||||
if (pos == std::string::npos) {
|
||||
DebugState.ShowDebugMessage("Disassembler CLI does not contain {src} argument");
|
||||
} else {
|
||||
cli.replace(pos, src_arg.size(), "\"" + bin_path.string() + "\"");
|
||||
Common::FS::IOFile file(bin_path, Common::FS::FileAccessMode::Write);
|
||||
file.Write(shader_code);
|
||||
file.Close();
|
||||
|
||||
auto result = exec_cli(cli.c_str());
|
||||
shader_dis = result.value_or("Could not disassemble shader");
|
||||
if (shader_dis.empty()) {
|
||||
shader_dis = "Disassembly empty or failed";
|
||||
}
|
||||
|
||||
std::filesystem::remove(bin_path);
|
||||
}
|
||||
}
|
||||
std::string shader_dis = RunDisassembler(Options.disassembler_cli_isa, shader_code);
|
||||
|
||||
MemoryEditor hex_view;
|
||||
hex_view.Open = true;
|
||||
hex_view.ReadOnly = true;
|
||||
hex_view.Cols = 8;
|
||||
hex_view.Cols = 16;
|
||||
hex_view.OptShowAscii = false;
|
||||
hex_view.OptShowOptions = false;
|
||||
|
||||
|
@ -376,7 +335,9 @@ void RegView::Draw() {
|
|||
if (!shader) {
|
||||
Text("Stage not selected");
|
||||
} else {
|
||||
shader->hex_view.DrawContents(shader->user_data.data(), shader->user_data.size());
|
||||
shader->hex_view.DrawContents(shader->user_data.data(),
|
||||
shader->user_data.size() *
|
||||
sizeof(Vulkan::Liverpool::UserData::value_type));
|
||||
}
|
||||
}
|
||||
End();
|
||||
|
|
95
src/core/devtools/widget/shader_list.cpp
Normal file
95
src/core/devtools/widget/shader_list.cpp
Normal file
|
@ -0,0 +1,95 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "shader_list.h"
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "common/config.h"
|
||||
#include "core/debug_state.h"
|
||||
#include "core/devtools/options.h"
|
||||
#include "imgui/imgui_std.h"
|
||||
|
||||
using namespace ImGui;
|
||||
|
||||
namespace Core::Devtools::Widget {
|
||||
|
||||
void ShaderList::DrawShader(DebugStateType::ShaderDump& value) {
|
||||
if (!loaded_data) {
|
||||
loaded_data = true;
|
||||
if (value.cache_raw_disasm.empty()) {
|
||||
value.cache_raw_disasm = RunDisassembler(Options.disassembler_cli_isa, value.raw_code);
|
||||
}
|
||||
isa_editor.SetText(value.cache_raw_disasm);
|
||||
|
||||
if (value.cache_spv_disasm.empty()) {
|
||||
value.cache_spv_disasm = RunDisassembler(Options.disassembler_cli_spv, value.spv);
|
||||
}
|
||||
spv_editor.SetText(value.cache_spv_disasm);
|
||||
}
|
||||
|
||||
if (SmallButton("<-")) {
|
||||
selected_shader = -1;
|
||||
}
|
||||
SameLine();
|
||||
Text("%s", value.name.c_str());
|
||||
SameLine(0.0f, 7.0f);
|
||||
if (BeginCombo("Shader type", showing_isa ? "ISA" : "SPIRV", ImGuiComboFlags_WidthFitPreview)) {
|
||||
if (Selectable("SPIRV")) {
|
||||
showing_isa = false;
|
||||
}
|
||||
if (Selectable("ISA")) {
|
||||
showing_isa = true;
|
||||
}
|
||||
EndCombo();
|
||||
}
|
||||
|
||||
if (showing_isa) {
|
||||
isa_editor.Render("ISA", GetContentRegionAvail());
|
||||
} else {
|
||||
spv_editor.Render("SPIRV", GetContentRegionAvail());
|
||||
}
|
||||
}
|
||||
|
||||
ShaderList::ShaderList() {
|
||||
isa_editor.SetPalette(TextEditor::GetDarkPalette());
|
||||
isa_editor.SetReadOnly(true);
|
||||
spv_editor.SetPalette(TextEditor::GetDarkPalette());
|
||||
spv_editor.SetReadOnly(true);
|
||||
spv_editor.SetLanguageDefinition(TextEditor::LanguageDefinition::GLSL());
|
||||
}
|
||||
|
||||
void ShaderList::Draw() {
|
||||
SetNextWindowSize({500.0f, 600.0f}, ImGuiCond_FirstUseEver);
|
||||
if (!Begin("Shader list", &open)) {
|
||||
End();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Config::collectShadersForDebug()) {
|
||||
DrawCenteredText("Enable 'CollectShader' in config to see shaders");
|
||||
End();
|
||||
return;
|
||||
}
|
||||
|
||||
if (selected_shader >= 0) {
|
||||
DrawShader(DebugState.shader_dump_list[selected_shader]);
|
||||
End();
|
||||
return;
|
||||
}
|
||||
|
||||
auto width = GetContentRegionAvail().x;
|
||||
int i = 0;
|
||||
for (const auto& shader : DebugState.shader_dump_list) {
|
||||
if (ButtonEx(shader.name.c_str(), {width, 20.0f}, ImGuiButtonFlags_NoHoveredOnFocus)) {
|
||||
selected_shader = i;
|
||||
loaded_data = false;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
End();
|
||||
}
|
||||
|
||||
} // namespace Core::Devtools::Widget
|
28
src/core/devtools/widget/shader_list.h
Normal file
28
src/core/devtools/widget/shader_list.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/debug_state.h"
|
||||
#include "text_editor.h"
|
||||
|
||||
namespace Core::Devtools::Widget {
|
||||
|
||||
class ShaderList {
|
||||
int selected_shader = -1;
|
||||
TextEditor isa_editor{};
|
||||
TextEditor spv_editor{};
|
||||
bool loaded_data = false;
|
||||
bool showing_isa = false;
|
||||
|
||||
void DrawShader(DebugStateType::ShaderDump& value);
|
||||
|
||||
public:
|
||||
ShaderList();
|
||||
|
||||
bool open = false;
|
||||
|
||||
void Draw();
|
||||
};
|
||||
|
||||
} // namespace Core::Devtools::Widget
|
|
@ -131,7 +131,7 @@ static int UTF8CharLength(TextEditor::Char c) {
|
|||
}
|
||||
|
||||
// "Borrowed" from ImGui source
|
||||
static inline int ImTextCharToUtf8(char* buf, int buf_size, unsigned int c) {
|
||||
static inline int ImTextCharToUtf8(char* buf, int buf_size, u32 c) {
|
||||
if (c < 0x80) {
|
||||
buf[0] = (char)c;
|
||||
return 1;
|
||||
|
|
|
@ -97,24 +97,22 @@ struct PlaygoChunk {
|
|||
|
||||
class PlaygoFile {
|
||||
public:
|
||||
bool initialized;
|
||||
OrbisPlayGoHandle handle;
|
||||
OrbisPlayGoChunkId id;
|
||||
OrbisPlayGoLocus locus;
|
||||
OrbisPlayGoInstallSpeed speed;
|
||||
s64 speed_tick;
|
||||
OrbisPlayGoEta eta;
|
||||
OrbisPlayGoLanguageMask langMask;
|
||||
OrbisPlayGoHandle handle = 0;
|
||||
OrbisPlayGoChunkId id = 0;
|
||||
OrbisPlayGoLocus locus = OrbisPlayGoLocus::NotDownloaded;
|
||||
OrbisPlayGoInstallSpeed speed = OrbisPlayGoInstallSpeed::Trickle;
|
||||
s64 speed_tick = 0;
|
||||
OrbisPlayGoEta eta = 0;
|
||||
OrbisPlayGoLanguageMask langMask = 0;
|
||||
std::vector<PlaygoChunk> chunks;
|
||||
|
||||
public:
|
||||
PlaygoFile()
|
||||
: initialized(false), handle(0), id(0), locus(0), speed(ORBIS_PLAYGO_INSTALL_SPEED_TRICKLE),
|
||||
speed_tick(0), eta(0), langMask(0), playgoHeader{0} {}
|
||||
explicit PlaygoFile() = default;
|
||||
~PlaygoFile() = default;
|
||||
|
||||
bool Open(const std::filesystem::path& filepath);
|
||||
bool LoadChunks(const Common::FS::IOFile& file);
|
||||
|
||||
PlaygoHeader& GetPlaygoHeader() {
|
||||
return playgoHeader;
|
||||
}
|
||||
|
|
|
@ -6,34 +6,30 @@
|
|||
#include "app_content.h"
|
||||
#include "common/assert.h"
|
||||
#include "common/config.h"
|
||||
#include "common/io_file.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/path_util.h"
|
||||
#include "common/singleton.h"
|
||||
#include "common/string_util.h"
|
||||
#include "core/file_format/psf.h"
|
||||
#include "core/file_sys/fs.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/app_content/app_content_error.h"
|
||||
#include "core/libraries/libs.h"
|
||||
|
||||
namespace Libraries::AppContent {
|
||||
|
||||
int32_t addcont_count = 0;
|
||||
|
||||
struct AddContInfo {
|
||||
char entitlementLabel[ORBIS_NP_UNIFIED_ENTITLEMENT_LABEL_SIZE];
|
||||
char entitlement_label[ORBIS_NP_UNIFIED_ENTITLEMENT_LABEL_SIZE];
|
||||
OrbisAppContentAddcontDownloadStatus status;
|
||||
OrbisAppContentGetEntitlementKey key;
|
||||
};
|
||||
|
||||
std::array<AddContInfo, ORBIS_APP_CONTENT_INFO_LIST_MAX_SIZE> addcont_info = {{
|
||||
static std::array<AddContInfo, ORBIS_APP_CONTENT_INFO_LIST_MAX_SIZE> addcont_info = {{
|
||||
{"0000000000000000",
|
||||
ORBIS_APP_CONTENT_ADDCONT_DOWNLOAD_STATUS_INSTALLED,
|
||||
OrbisAppContentAddcontDownloadStatus::Installed,
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00}},
|
||||
}};
|
||||
|
||||
std::string title_id;
|
||||
static s32 addcont_count = 0;
|
||||
static std::string title_id;
|
||||
|
||||
int PS4_SYSV_ABI _Z5dummyv() {
|
||||
LOG_ERROR(Lib_AppContent, "(STUBBED) called");
|
||||
|
@ -64,12 +60,11 @@ int PS4_SYSV_ABI sceAppContentAddcontMount(u32 service_label,
|
|||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||
|
||||
for (int i = 0; i < addcont_count; i++) {
|
||||
if (strncmp(entitlement_label->data, addcont_info[i].entitlementLabel,
|
||||
if (strncmp(entitlement_label->data, addcont_info[i].entitlement_label,
|
||||
ORBIS_NP_UNIFIED_ENTITLEMENT_LABEL_SIZE - 1) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (addcont_info[i].status != ORBIS_APP_CONTENT_ADDCONT_DOWNLOAD_STATUS_INSTALLED) {
|
||||
if (addcont_info[i].status != OrbisAppContentAddcontDownloadStatus::Installed) {
|
||||
return ORBIS_APP_CONTENT_ERROR_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
@ -170,14 +165,14 @@ int PS4_SYSV_ABI sceAppContentGetAddcontInfo(u32 service_label,
|
|||
}
|
||||
|
||||
for (auto i = 0; i < addcont_count; i++) {
|
||||
if (strncmp(entitlementLabel->data, addcont_info[i].entitlementLabel,
|
||||
if (strncmp(entitlementLabel->data, addcont_info[i].entitlement_label,
|
||||
ORBIS_NP_UNIFIED_ENTITLEMENT_LABEL_SIZE - 1) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
LOG_INFO(Lib_AppContent, "found DLC {}", entitlementLabel->data);
|
||||
|
||||
strncpy(info->entitlement_label.data, addcont_info[i].entitlementLabel,
|
||||
strncpy(info->entitlement_label.data, addcont_info[i].entitlement_label,
|
||||
ORBIS_NP_UNIFIED_ENTITLEMENT_LABEL_SIZE);
|
||||
info->status = addcont_info[i].status;
|
||||
return ORBIS_OK;
|
||||
|
@ -202,7 +197,7 @@ int PS4_SYSV_ABI sceAppContentGetAddcontInfoList(u32 service_label,
|
|||
|
||||
int dlcs_to_list = addcont_count < list_num ? addcont_count : list_num;
|
||||
for (int i = 0; i < dlcs_to_list; i++) {
|
||||
strncpy(list[i].entitlement_label.data, addcont_info[i].entitlementLabel,
|
||||
strncpy(list[i].entitlement_label.data, addcont_info[i].entitlement_label,
|
||||
ORBIS_NP_UNIFIED_ENTITLEMENT_LABEL_SIZE);
|
||||
list[i].status = addcont_info[i].status;
|
||||
}
|
||||
|
@ -224,7 +219,7 @@ int PS4_SYSV_ABI sceAppContentGetEntitlementKey(
|
|||
}
|
||||
|
||||
for (int i = 0; i < addcont_count; i++) {
|
||||
if (strncmp(entitlement_label->data, addcont_info[i].entitlementLabel,
|
||||
if (strncmp(entitlement_label->data, addcont_info[i].entitlement_label,
|
||||
ORBIS_NP_UNIFIED_ENTITLEMENT_LABEL_SIZE - 1) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
@ -252,21 +247,19 @@ int PS4_SYSV_ABI sceAppContentInitialize(const OrbisAppContentInitParam* initPar
|
|||
} else {
|
||||
UNREACHABLE_MSG("Failed to get TITLE_ID");
|
||||
}
|
||||
auto addon_path = addons_dir / title_id;
|
||||
if (std::filesystem::exists(addon_path)) {
|
||||
for (const auto& entry : std::filesystem::directory_iterator(addon_path)) {
|
||||
if (entry.is_directory()) {
|
||||
auto entitlement_label = entry.path().filename().string();
|
||||
|
||||
AddContInfo info{};
|
||||
info.status = ORBIS_APP_CONTENT_ADDCONT_DOWNLOAD_STATUS_INSTALLED;
|
||||
strcpy(info.entitlementLabel, entitlement_label.c_str());
|
||||
|
||||
addcont_info[addcont_count++] = info;
|
||||
}
|
||||
}
|
||||
const auto addon_path = addons_dir / title_id;
|
||||
if (!std::filesystem::exists(addon_path)) {
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
for (const auto& entry : std::filesystem::directory_iterator(addon_path)) {
|
||||
if (entry.is_directory()) {
|
||||
auto entitlement_label = entry.path().filename().string();
|
||||
auto& info = addcont_info[addcont_count++];
|
||||
info.status = OrbisAppContentAddcontDownloadStatus::Installed;
|
||||
entitlement_label.copy(info.entitlement_label, sizeof(info.entitlement_label));
|
||||
}
|
||||
}
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
|
@ -314,9 +307,11 @@ int PS4_SYSV_ABI sceAppContentTemporaryDataMount() {
|
|||
|
||||
int PS4_SYSV_ABI sceAppContentTemporaryDataMount2(OrbisAppContentTemporaryDataOption option,
|
||||
OrbisAppContentMountPoint* mountPoint) {
|
||||
if (mountPoint == nullptr)
|
||||
if (mountPoint == nullptr) {
|
||||
return ORBIS_APP_CONTENT_ERROR_PARAMETER;
|
||||
strncpy(mountPoint->data, "/temp0", 16);
|
||||
}
|
||||
static constexpr std::string_view TmpMount = "/temp0";
|
||||
TmpMount.copy(mountPoint->data, sizeof(mountPoint->data));
|
||||
LOG_INFO(Lib_AppContent, "sceAppContentTemporaryDataMount2: option = {}, mountPoint = {}",
|
||||
option, mountPoint->data);
|
||||
return ORBIS_OK;
|
||||
|
|
|
@ -30,7 +30,7 @@ struct OrbisAppContentBootParam {
|
|||
char reserved2[32];
|
||||
};
|
||||
|
||||
typedef u32 OrbisAppContentTemporaryDataOption;
|
||||
using OrbisAppContentTemporaryDataOption = u32;
|
||||
|
||||
constexpr int ORBIS_APP_CONTENT_MOUNTPOINT_DATA_MAXSIZE = 16;
|
||||
|
||||
|
@ -44,12 +44,12 @@ constexpr int ORBIS_NP_UNIFIED_ENTITLEMENT_LABEL_SIZE = 17;
|
|||
constexpr int ORBIS_APP_CONTENT_ENTITLEMENT_KEY_SIZE = 16;
|
||||
constexpr int ORBIS_APP_CONTENT_INFO_LIST_MAX_SIZE = 2500;
|
||||
|
||||
enum OrbisAppContentAddcontDownloadStatus : u32 {
|
||||
ORBIS_APP_CONTENT_ADDCONT_DOWNLOAD_STATUS_NO_EXTRA_DATA = 0,
|
||||
ORBIS_APP_CONTENT_ADDCONT_DOWNLOAD_STATUS_NO_IN_QUEUE = 1,
|
||||
ORBIS_APP_CONTENT_ADDCONT_DOWNLOAD_STATUS_DOWNLOADING = 2,
|
||||
ORBIS_APP_CONTENT_ADDCONT_DOWNLOAD_STATUS_DOWNLOAD_SUSPENDED = 3,
|
||||
ORBIS_APP_CONTENT_ADDCONT_DOWNLOAD_STATUS_INSTALLED = 4
|
||||
enum class OrbisAppContentAddcontDownloadStatus : u32 {
|
||||
NoExtraData = 0,
|
||||
NoInQueue = 1,
|
||||
Downloading = 2,
|
||||
DownloadSuspended = 3,
|
||||
Installed = 4
|
||||
};
|
||||
|
||||
struct OrbisNpUnifiedEntitlementLabel {
|
||||
|
@ -57,11 +57,11 @@ struct OrbisNpUnifiedEntitlementLabel {
|
|||
char padding[3];
|
||||
};
|
||||
|
||||
typedef u32 OrbisAppContentAppParamId;
|
||||
using OrbisAppContentAppParamId = u32;
|
||||
|
||||
struct OrbisAppContentAddcontInfo {
|
||||
OrbisNpUnifiedEntitlementLabel entitlement_label;
|
||||
u32 status;
|
||||
OrbisAppContentAddcontDownloadStatus status;
|
||||
};
|
||||
|
||||
struct OrbisAppContentGetEntitlementKey {
|
||||
|
@ -119,4 +119,4 @@ int PS4_SYSV_ABI sceAppContentGetAddcontInfoListByIroTag();
|
|||
int PS4_SYSV_ABI sceAppContentGetDownloadedStoreCountry();
|
||||
|
||||
void RegisterlibSceAppContent(Core::Loader::SymbolsResolver* sym);
|
||||
} // namespace Libraries::AppContent
|
||||
} // namespace Libraries::AppContent
|
||||
|
|
11
src/core/libraries/app_content/app_content_error.h
Normal file
11
src/core/libraries/app_content/app_content_error.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/libraries/error_codes.h"
|
||||
|
||||
// AppContent library
|
||||
constexpr int ORBIS_APP_CONTENT_ERROR_PARAMETER = 0x80D90002;
|
||||
constexpr int ORBIS_APP_CONTENT_ERROR_DRM_NO_ENTITLEMENT = 0x80D90007;
|
||||
constexpr int ORBIS_APP_CONTENT_ERROR_NOT_FOUND = 0x80D90005;
|
|
@ -4,30 +4,30 @@
|
|||
#include <memory>
|
||||
#include <magic_enum.hpp>
|
||||
|
||||
#include "audio_core/sdl_audio.h"
|
||||
#include "common/assert.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "core/libraries/audio/audioout.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/audio/audioout_error.h"
|
||||
#include "core/libraries/audio/sdl_audio.h"
|
||||
#include "core/libraries/libs.h"
|
||||
|
||||
namespace Libraries::AudioOut {
|
||||
|
||||
static std::unique_ptr<Audio::SDLAudio> audio;
|
||||
static std::unique_ptr<SDLAudioOut> audio;
|
||||
|
||||
static std::string_view GetAudioOutPort(u32 port) {
|
||||
static std::string_view GetAudioOutPort(OrbisAudioOutPort port) {
|
||||
switch (port) {
|
||||
case ORBIS_AUDIO_OUT_PORT_TYPE_MAIN:
|
||||
case OrbisAudioOutPort::Main:
|
||||
return "MAIN";
|
||||
case ORBIS_AUDIO_OUT_PORT_TYPE_BGM:
|
||||
case OrbisAudioOutPort::Bgm:
|
||||
return "BGM";
|
||||
case ORBIS_AUDIO_OUT_PORT_TYPE_VOICE:
|
||||
case OrbisAudioOutPort::Voice:
|
||||
return "VOICE";
|
||||
case ORBIS_AUDIO_OUT_PORT_TYPE_PERSONAL:
|
||||
case OrbisAudioOutPort::Personal:
|
||||
return "PERSONAL";
|
||||
case ORBIS_AUDIO_OUT_PORT_TYPE_PADSPK:
|
||||
case OrbisAudioOutPort::Padspk:
|
||||
return "PADSPK";
|
||||
case ORBIS_AUDIO_OUT_PORT_TYPE_AUX:
|
||||
case OrbisAudioOutPort::Aux:
|
||||
return "AUX";
|
||||
default:
|
||||
return "INVALID";
|
||||
|
@ -36,21 +36,21 @@ static std::string_view GetAudioOutPort(u32 port) {
|
|||
|
||||
static std::string_view GetAudioOutParamFormat(OrbisAudioOutParamFormat param) {
|
||||
switch (param) {
|
||||
case ORBIS_AUDIO_OUT_PARAM_FORMAT_S16_MONO:
|
||||
case OrbisAudioOutParamFormat::S16Mono:
|
||||
return "S16_MONO";
|
||||
case ORBIS_AUDIO_OUT_PARAM_FORMAT_S16_STEREO:
|
||||
case OrbisAudioOutParamFormat::S16Stereo:
|
||||
return "S16_STEREO";
|
||||
case ORBIS_AUDIO_OUT_PARAM_FORMAT_S16_8CH:
|
||||
case OrbisAudioOutParamFormat::S16_8CH:
|
||||
return "S16_8CH";
|
||||
case ORBIS_AUDIO_OUT_PARAM_FORMAT_FLOAT_MONO:
|
||||
case OrbisAudioOutParamFormat::FloatMono:
|
||||
return "FLOAT_MONO";
|
||||
case ORBIS_AUDIO_OUT_PARAM_FORMAT_FLOAT_STEREO:
|
||||
case OrbisAudioOutParamFormat::FloatStereo:
|
||||
return "FLOAT_STEREO";
|
||||
case ORBIS_AUDIO_OUT_PARAM_FORMAT_FLOAT_8CH:
|
||||
case OrbisAudioOutParamFormat::Float_8CH:
|
||||
return "FLOAT_8CH";
|
||||
case ORBIS_AUDIO_OUT_PARAM_FORMAT_S16_8CH_STD:
|
||||
case OrbisAudioOutParamFormat::S16_8CH_Std:
|
||||
return "S16_8CH_STD";
|
||||
case ORBIS_AUDIO_OUT_PARAM_FORMAT_FLOAT_8CH_STD:
|
||||
case OrbisAudioOutParamFormat::Float_8CH_Std:
|
||||
return "FLOAT_8CH_STD";
|
||||
default:
|
||||
return "INVALID";
|
||||
|
@ -59,11 +59,11 @@ static std::string_view GetAudioOutParamFormat(OrbisAudioOutParamFormat param) {
|
|||
|
||||
static std::string_view GetAudioOutParamAttr(OrbisAudioOutParamAttr attr) {
|
||||
switch (attr) {
|
||||
case ORBIS_AUDIO_OUT_PARAM_ATTR_NONE:
|
||||
case OrbisAudioOutParamAttr::None:
|
||||
return "NONE";
|
||||
case ORBIS_AUDIO_OUT_PARAM_ATTR_RESTRICTED:
|
||||
case OrbisAudioOutParamAttr::Restricted:
|
||||
return "RESTRICTED";
|
||||
case ORBIS_AUDIO_OUT_PARAM_ATTR_MIX_TO_MAIN:
|
||||
case OrbisAudioOutParamAttr::MixToMain:
|
||||
return "MIX_TO_MAIN";
|
||||
default:
|
||||
return "INVALID";
|
||||
|
@ -180,29 +180,23 @@ int PS4_SYSV_ABI sceAudioOutGetPortState(s32 handle, OrbisAudioOutPortState* sta
|
|||
return ORBIS_AUDIO_OUT_ERROR_INVALID_PORT;
|
||||
}
|
||||
|
||||
int type = 0;
|
||||
int channels_num = 0;
|
||||
|
||||
if (const auto err = audio->AudioOutGetStatus(handle, &type, &channels_num); err != ORBIS_OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
const auto [type, channels_num] = audio->GetStatus(handle);
|
||||
state->rerouteCounter = 0;
|
||||
state->volume = 127; // max volume
|
||||
state->volume = 127;
|
||||
|
||||
switch (type) {
|
||||
case ORBIS_AUDIO_OUT_PORT_TYPE_MAIN:
|
||||
case ORBIS_AUDIO_OUT_PORT_TYPE_BGM:
|
||||
case ORBIS_AUDIO_OUT_PORT_TYPE_VOICE:
|
||||
case OrbisAudioOutPort::Main:
|
||||
case OrbisAudioOutPort::Bgm:
|
||||
case OrbisAudioOutPort::Voice:
|
||||
state->output = 1;
|
||||
state->channel = (channels_num > 2 ? 2 : channels_num);
|
||||
break;
|
||||
case ORBIS_AUDIO_OUT_PORT_TYPE_PERSONAL:
|
||||
case ORBIS_AUDIO_OUT_PORT_TYPE_PADSPK:
|
||||
case OrbisAudioOutPort::Personal:
|
||||
case OrbisAudioOutPort::Padspk:
|
||||
state->output = 4;
|
||||
state->channel = 1;
|
||||
break;
|
||||
case ORBIS_AUDIO_OUT_PORT_TYPE_AUX:
|
||||
case OrbisAudioOutPort::Aux:
|
||||
state->output = 0;
|
||||
state->channel = 0;
|
||||
break;
|
||||
|
@ -243,7 +237,7 @@ int PS4_SYSV_ABI sceAudioOutInit() {
|
|||
if (audio != nullptr) {
|
||||
return ORBIS_AUDIO_OUT_ERROR_ALREADY_INIT;
|
||||
}
|
||||
audio = std::make_unique<Audio::SDLAudio>();
|
||||
audio = std::make_unique<SDLAudioOut>();
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
|
@ -287,7 +281,8 @@ s32 PS4_SYSV_ABI sceAudioOutOpen(UserService::OrbisUserServiceUserId user_id,
|
|||
user_id, GetAudioOutPort(port_type), index, length, sample_rate,
|
||||
GetAudioOutParamFormat(param_type.data_format),
|
||||
GetAudioOutParamAttr(param_type.attributes));
|
||||
if ((port_type < 0 || port_type > 4) && (port_type != 127)) {
|
||||
if ((port_type < OrbisAudioOutPort::Main || port_type > OrbisAudioOutPort::Padspk) &&
|
||||
(port_type != OrbisAudioOutPort::Aux)) {
|
||||
LOG_ERROR(Lib_AudioOut, "Invalid port type");
|
||||
return ORBIS_AUDIO_OUT_ERROR_INVALID_PORT_TYPE;
|
||||
}
|
||||
|
@ -303,18 +298,19 @@ s32 PS4_SYSV_ABI sceAudioOutOpen(UserService::OrbisUserServiceUserId user_id,
|
|||
if (index != 0) {
|
||||
LOG_ERROR(Lib_AudioOut, "index is not valid !=0 {}", index);
|
||||
}
|
||||
OrbisAudioOutParamFormat format = param_type.data_format;
|
||||
if (format < 0 || format > 7) {
|
||||
const auto format = param_type.data_format.Value();
|
||||
if (format < OrbisAudioOutParamFormat::S16Mono ||
|
||||
format > OrbisAudioOutParamFormat::Float_8CH_Std) {
|
||||
LOG_ERROR(Lib_AudioOut, "Invalid format");
|
||||
return ORBIS_AUDIO_OUT_ERROR_INVALID_FORMAT;
|
||||
}
|
||||
OrbisAudioOutParamAttr attr = param_type.attributes;
|
||||
if (attr < 0 || attr > 2) {
|
||||
const auto attr = param_type.attributes;
|
||||
if (attr < OrbisAudioOutParamAttr::None || attr > OrbisAudioOutParamAttr::MixToMain) {
|
||||
// TODO Handle attributes in output audio device
|
||||
LOG_ERROR(Lib_AudioOut, "Invalid format attribute");
|
||||
return ORBIS_AUDIO_OUT_ERROR_INVALID_FORMAT;
|
||||
}
|
||||
return audio->AudioOutOpen(port_type, length, sample_rate, format);
|
||||
return audio->Open(port_type, length, sample_rate, format);
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceAudioOutOpenEx() {
|
||||
|
@ -330,7 +326,7 @@ s32 PS4_SYSV_ABI sceAudioOutOutput(s32 handle, const void* ptr) {
|
|||
// Nothing to output
|
||||
return ORBIS_OK;
|
||||
}
|
||||
return audio->AudioOutOutput(handle, ptr);
|
||||
return audio->Output(handle, ptr);
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceAudioOutOutputs(OrbisAudioOutOutputParam* param, u32 num) {
|
||||
|
@ -435,7 +431,7 @@ s32 PS4_SYSV_ABI sceAudioOutSetVolume(s32 handle, s32 flag, s32* vol) {
|
|||
if (handle < 1 || handle > SCE_AUDIO_OUT_NUM_PORTS) {
|
||||
return ORBIS_AUDIO_OUT_ERROR_INVALID_PORT;
|
||||
}
|
||||
return audio->AudioOutSetVolume(handle, flag, vol);
|
||||
return audio->SetVolume(handle, flag, vol);
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceAudioOutSetVolumeDown() {
|
||||
|
|
|
@ -9,46 +9,36 @@
|
|||
|
||||
namespace Libraries::AudioOut {
|
||||
|
||||
constexpr int SCE_AUDIO_OUT_VOLUME_0DB = 32768; // max volume value
|
||||
|
||||
// main up to 8 ports, BGM 1 port, voice up to 4 ports,
|
||||
// Main up to 8 ports, BGM 1 port, voice up to 4 ports,
|
||||
// personal up to 4 ports, padspk up to 5 ports, aux 1 port
|
||||
constexpr int SCE_AUDIO_OUT_NUM_PORTS = 22;
|
||||
constexpr int SCE_AUDIO_OUT_VOLUME_0DB = 32768; // max volume value
|
||||
|
||||
enum OrbisAudioOutPort {
|
||||
ORBIS_AUDIO_OUT_PORT_TYPE_MAIN = 0,
|
||||
ORBIS_AUDIO_OUT_PORT_TYPE_BGM = 1,
|
||||
ORBIS_AUDIO_OUT_PORT_TYPE_VOICE = 2,
|
||||
ORBIS_AUDIO_OUT_PORT_TYPE_PERSONAL = 3,
|
||||
ORBIS_AUDIO_OUT_PORT_TYPE_PADSPK = 4,
|
||||
ORBIS_AUDIO_OUT_PORT_TYPE_AUX = 127
|
||||
enum class OrbisAudioOutPort { Main = 0, Bgm = 1, Voice = 2, Personal = 3, Padspk = 4, Aux = 127 };
|
||||
|
||||
enum class OrbisAudioOutParamFormat {
|
||||
S16Mono = 0,
|
||||
S16Stereo = 1,
|
||||
S16_8CH = 2,
|
||||
FloatMono = 3,
|
||||
FloatStereo = 4,
|
||||
Float_8CH = 5,
|
||||
S16_8CH_Std = 6,
|
||||
Float_8CH_Std = 7
|
||||
};
|
||||
|
||||
enum OrbisAudioOutParamFormat {
|
||||
ORBIS_AUDIO_OUT_PARAM_FORMAT_S16_MONO = 0,
|
||||
ORBIS_AUDIO_OUT_PARAM_FORMAT_S16_STEREO = 1,
|
||||
ORBIS_AUDIO_OUT_PARAM_FORMAT_S16_8CH = 2,
|
||||
ORBIS_AUDIO_OUT_PARAM_FORMAT_FLOAT_MONO = 3,
|
||||
ORBIS_AUDIO_OUT_PARAM_FORMAT_FLOAT_STEREO = 4,
|
||||
ORBIS_AUDIO_OUT_PARAM_FORMAT_FLOAT_8CH = 5,
|
||||
ORBIS_AUDIO_OUT_PARAM_FORMAT_S16_8CH_STD = 6,
|
||||
ORBIS_AUDIO_OUT_PARAM_FORMAT_FLOAT_8CH_STD = 7
|
||||
enum class OrbisAudioOutParamAttr {
|
||||
None = 0,
|
||||
Restricted = 1,
|
||||
MixToMain = 2,
|
||||
};
|
||||
|
||||
enum OrbisAudioOutParamAttr {
|
||||
ORBIS_AUDIO_OUT_PARAM_ATTR_NONE = 0,
|
||||
ORBIS_AUDIO_OUT_PARAM_ATTR_RESTRICTED = 1,
|
||||
ORBIS_AUDIO_OUT_PARAM_ATTR_MIX_TO_MAIN = 2,
|
||||
};
|
||||
|
||||
struct OrbisAudioOutParamExtendedInformation {
|
||||
union {
|
||||
BitField<0, 8, OrbisAudioOutParamFormat> data_format;
|
||||
BitField<8, 8, u32> reserve0;
|
||||
BitField<16, 4, OrbisAudioOutParamAttr> attributes;
|
||||
BitField<20, 10, u32> reserve1;
|
||||
BitField<31, 1, u32> unused;
|
||||
};
|
||||
union OrbisAudioOutParamExtendedInformation {
|
||||
BitField<0, 8, OrbisAudioOutParamFormat> data_format;
|
||||
BitField<8, 8, u32> reserve0;
|
||||
BitField<16, 4, OrbisAudioOutParamAttr> attributes;
|
||||
BitField<20, 10, u32> reserve1;
|
||||
BitField<31, 1, u32> unused;
|
||||
};
|
||||
|
||||
struct OrbisAudioOutOutputParam {
|
||||
|
|
34
src/core/libraries/audio/audioout_error.h
Normal file
34
src/core/libraries/audio/audioout_error.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/libraries/error_codes.h"
|
||||
|
||||
// AudioOut library
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_NOT_OPENED = 0x80260001;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_BUSY = 0x80260002;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_PORT = 0x80260003;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_POINTER = 0x80260004;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_PORT_FULL = 0x80260005;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_SIZE = 0x80260006;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_FORMAT = 0x80260007;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_SAMPLE_FREQ = 0x80260008;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_VOLUME = 0x80260009;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_PORT_TYPE = 0x8026000A;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_CONF_TYPE = 0x8026000C;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_OUT_OF_MEMORY = 0x8026000D;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_ALREADY_INIT = 0x8026000E;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_NOT_INIT = 0x8026000F;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_MEMORY = 0x80260010;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_SYSTEM_RESOURCE = 0x80260011;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_TRANS_EVENT = 0x80260012;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_FLAG = 0x80260013;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_MIXLEVEL = 0x80260014;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_ARG = 0x80260015;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_PARAM = 0x80260016;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_MASTERING_FATAL = 0x80260200;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_MASTERING_INVALID_API_PARAM = 0x80260201;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_MASTERING_INVALID_CONFIG = 0x80260202;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_MASTERING_NOT_INITIALIZED = 0x80260203;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_MASTERING_INVALID_STATES_ID = 0x80260204;
|
141
src/core/libraries/audio/sdl_audio.cpp
Normal file
141
src/core/libraries/audio/sdl_audio.cpp
Normal file
|
@ -0,0 +1,141 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <mutex>
|
||||
#include <SDL3/SDL_audio.h>
|
||||
#include <SDL3/SDL_init.h>
|
||||
#include <SDL3/SDL_timer.h>
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "core/libraries/audio/audioout_error.h"
|
||||
#include "core/libraries/audio/sdl_audio.h"
|
||||
|
||||
namespace Libraries::AudioOut {
|
||||
|
||||
constexpr int AUDIO_STREAM_BUFFER_THRESHOLD = 65536; // Define constant for buffer threshold
|
||||
|
||||
s32 SDLAudioOut::Open(OrbisAudioOutPort type, u32 samples_num, u32 freq,
|
||||
OrbisAudioOutParamFormat format) {
|
||||
std::scoped_lock lock{m_mutex};
|
||||
const auto port = std::ranges::find(ports_out, false, &PortOut::is_open);
|
||||
if (port == ports_out.end()) {
|
||||
LOG_ERROR(Lib_AudioOut, "Audio ports are full");
|
||||
return ORBIS_AUDIO_OUT_ERROR_PORT_FULL;
|
||||
}
|
||||
|
||||
port->is_open = true;
|
||||
port->type = type;
|
||||
port->samples_num = samples_num;
|
||||
port->freq = freq;
|
||||
port->format = format;
|
||||
SDL_AudioFormat sampleFormat;
|
||||
switch (format) {
|
||||
case OrbisAudioOutParamFormat::S16Mono:
|
||||
sampleFormat = SDL_AUDIO_S16;
|
||||
port->channels_num = 1;
|
||||
port->sample_size = 2;
|
||||
break;
|
||||
case OrbisAudioOutParamFormat::FloatMono:
|
||||
sampleFormat = SDL_AUDIO_F32;
|
||||
port->channels_num = 1;
|
||||
port->sample_size = 4;
|
||||
break;
|
||||
case OrbisAudioOutParamFormat::S16Stereo:
|
||||
sampleFormat = SDL_AUDIO_S16;
|
||||
port->channels_num = 2;
|
||||
port->sample_size = 2;
|
||||
break;
|
||||
case OrbisAudioOutParamFormat::FloatStereo:
|
||||
sampleFormat = SDL_AUDIO_F32;
|
||||
port->channels_num = 2;
|
||||
port->sample_size = 4;
|
||||
break;
|
||||
case OrbisAudioOutParamFormat::S16_8CH:
|
||||
sampleFormat = SDL_AUDIO_S16;
|
||||
port->channels_num = 8;
|
||||
port->sample_size = 2;
|
||||
break;
|
||||
case OrbisAudioOutParamFormat::Float_8CH:
|
||||
sampleFormat = SDL_AUDIO_F32;
|
||||
port->channels_num = 8;
|
||||
port->sample_size = 4;
|
||||
break;
|
||||
case OrbisAudioOutParamFormat::S16_8CH_Std:
|
||||
sampleFormat = SDL_AUDIO_S16;
|
||||
port->channels_num = 8;
|
||||
port->sample_size = 2;
|
||||
break;
|
||||
case OrbisAudioOutParamFormat::Float_8CH_Std:
|
||||
sampleFormat = SDL_AUDIO_F32;
|
||||
port->channels_num = 8;
|
||||
port->sample_size = 4;
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE_MSG("Unknown format");
|
||||
}
|
||||
|
||||
port->volume.fill(Libraries::AudioOut::SCE_AUDIO_OUT_VOLUME_0DB);
|
||||
|
||||
SDL_AudioSpec fmt;
|
||||
SDL_zero(fmt);
|
||||
fmt.format = sampleFormat;
|
||||
fmt.channels = port->channels_num;
|
||||
fmt.freq = freq;
|
||||
port->stream = SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &fmt, NULL, NULL);
|
||||
SDL_ResumeAudioDevice(SDL_GetAudioStreamDevice(port->stream));
|
||||
return std::distance(ports_out.begin(), port) + 1;
|
||||
}
|
||||
|
||||
s32 SDLAudioOut::Output(s32 handle, const void* ptr) {
|
||||
auto& port = ports_out.at(handle - 1);
|
||||
if (!port.is_open) {
|
||||
return ORBIS_AUDIO_OUT_ERROR_INVALID_PORT;
|
||||
}
|
||||
|
||||
const size_t data_size = port.samples_num * port.sample_size * port.channels_num;
|
||||
bool result = SDL_PutAudioStreamData(port.stream, ptr, data_size);
|
||||
while (SDL_GetAudioStreamAvailable(port.stream) > AUDIO_STREAM_BUFFER_THRESHOLD) {
|
||||
SDL_Delay(0);
|
||||
}
|
||||
return result ? ORBIS_OK : -1;
|
||||
}
|
||||
|
||||
s32 SDLAudioOut::SetVolume(s32 handle, s32 bitflag, s32* volume) {
|
||||
using Libraries::AudioOut::OrbisAudioOutParamFormat;
|
||||
auto& port = ports_out.at(handle - 1);
|
||||
if (!port.is_open) {
|
||||
return ORBIS_AUDIO_OUT_ERROR_INVALID_PORT;
|
||||
}
|
||||
|
||||
for (int i = 0; i < port.channels_num; i++, bitflag >>= 1u) {
|
||||
auto bit = bitflag & 0x1u;
|
||||
|
||||
if (bit == 1) {
|
||||
int src_index = i;
|
||||
if (port.format == OrbisAudioOutParamFormat::Float_8CH_Std ||
|
||||
port.format == OrbisAudioOutParamFormat::S16_8CH_Std) {
|
||||
switch (i) {
|
||||
case 4:
|
||||
src_index = 6;
|
||||
break;
|
||||
case 5:
|
||||
src_index = 7;
|
||||
break;
|
||||
case 6:
|
||||
src_index = 4;
|
||||
break;
|
||||
case 7:
|
||||
src_index = 5;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
port.volume[i] = volume[src_index];
|
||||
}
|
||||
}
|
||||
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
} // namespace Libraries::AudioOut
|
42
src/core/libraries/audio/sdl_audio.h
Normal file
42
src/core/libraries/audio/sdl_audio.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <shared_mutex>
|
||||
#include <SDL3/SDL_audio.h>
|
||||
#include "core/libraries/audio/audioout.h"
|
||||
|
||||
namespace Libraries::AudioOut {
|
||||
|
||||
class SDLAudioOut {
|
||||
public:
|
||||
explicit SDLAudioOut() = default;
|
||||
~SDLAudioOut() = default;
|
||||
|
||||
s32 Open(OrbisAudioOutPort type, u32 samples_num, u32 freq, OrbisAudioOutParamFormat format);
|
||||
s32 Output(s32 handle, const void* ptr);
|
||||
s32 SetVolume(s32 handle, s32 bitflag, s32* volume);
|
||||
|
||||
constexpr std::pair<OrbisAudioOutPort, int> GetStatus(s32 handle) const {
|
||||
const auto& port = ports_out.at(handle - 1);
|
||||
return std::make_pair(port.type, port.channels_num);
|
||||
}
|
||||
|
||||
private:
|
||||
struct PortOut {
|
||||
SDL_AudioStream* stream;
|
||||
u32 samples_num;
|
||||
u32 freq;
|
||||
OrbisAudioOutParamFormat format;
|
||||
OrbisAudioOutPort type;
|
||||
int channels_num;
|
||||
std::array<int, 8> volume;
|
||||
u8 sample_size;
|
||||
bool is_open;
|
||||
};
|
||||
std::shared_mutex m_mutex;
|
||||
std::array<PortOut, Libraries::AudioOut::SCE_AUDIO_OUT_NUM_PORTS> ports_out{};
|
||||
};
|
||||
|
||||
} // namespace Libraries::AudioOut
|
|
@ -1,19 +1,15 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "audio3d.h"
|
||||
#include "audio3d_error.h"
|
||||
#include "audio3d_impl.h"
|
||||
|
||||
#include "common/logging/log.h"
|
||||
#include "core/libraries/audio/audioout.h"
|
||||
#include "core/libraries/audio3d/audio3d.h"
|
||||
#include "core/libraries/audio3d/audio3d_error.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/libs.h"
|
||||
|
||||
namespace Libraries::Audio3d {
|
||||
|
||||
// Audio3d
|
||||
|
||||
int PS4_SYSV_ABI sceAudio3dInitialize(s64 iReserved) {
|
||||
LOG_INFO(Lib_Audio3d, "iReserved = {}", iReserved);
|
||||
return ORBIS_OK;
|
||||
|
@ -25,18 +21,19 @@ int PS4_SYSV_ABI sceAudio3dTerminate() {
|
|||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
void PS4_SYSV_ABI sceAudio3dGetDefaultOpenParameters(OrbisAudio3dOpenParameters* sParameters) {
|
||||
if (sParameters != NULL) {
|
||||
sParameters->szSizeThis = sizeof(OrbisAudio3dOpenParameters);
|
||||
sParameters->uiGranularity = 256;
|
||||
sParameters->eRate = ORBIS_AUDIO3D_RATE_48000;
|
||||
sParameters->uiMaxObjects = 512;
|
||||
sParameters->uiQueueDepth = 2;
|
||||
sParameters->eBufferMode = ORBIS_AUDIO3D_BUFFER_ADVANCE_AND_PUSH;
|
||||
sParameters->uiNumBeds = 2;
|
||||
} else {
|
||||
void PS4_SYSV_ABI sceAudio3dGetDefaultOpenParameters(OrbisAudio3dOpenParameters* parameters) {
|
||||
if (parameters == nullptr) {
|
||||
LOG_ERROR(Lib_Audio3d, "Invalid OpenParameters ptr");
|
||||
return;
|
||||
}
|
||||
|
||||
parameters->size_this = sizeof(OrbisAudio3dOpenParameters);
|
||||
parameters->granularity = 256;
|
||||
parameters->rate = OrbisAudio3dRate::Rate48000;
|
||||
parameters->max_objects = 512;
|
||||
parameters->queue_depth = 2;
|
||||
parameters->buffer_mode = OrbisAudio3dBufferMode::AdvanceAndPush;
|
||||
parameters->num_beds = 2;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceAudio3dPortOpen(OrbisUserServiceUserId iUserId,
|
||||
|
@ -76,13 +73,13 @@ int PS4_SYSV_ABI sceAudio3dPortPush(OrbisAudio3dPortId uiPortId, OrbisAudio3dBlo
|
|||
|
||||
int PS4_SYSV_ABI sceAudio3dPortGetAttributesSupported(OrbisAudio3dPortId uiPortId,
|
||||
OrbisAudio3dAttributeId* pCapabilities,
|
||||
unsigned int* pNumCapabilities) {
|
||||
u32* pNumCapabilities) {
|
||||
LOG_INFO(Lib_Audio3d, "uiPortId = {}", uiPortId);
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceAudio3dPortGetQueueLevel(OrbisAudio3dPortId uiPortId, unsigned int* pQueueLevel,
|
||||
unsigned int* pQueueAvailable) {
|
||||
int PS4_SYSV_ABI sceAudio3dPortGetQueueLevel(OrbisAudio3dPortId uiPortId, u32* pQueueLevel,
|
||||
u32* pQueueAvailable) {
|
||||
LOG_INFO(Lib_Audio3d, "uiPortId = {}", uiPortId);
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
@ -107,24 +104,24 @@ int PS4_SYSV_ABI sceAudio3dObjectSetAttributes(OrbisAudio3dPortId uiPortId,
|
|||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceAudio3dBedWrite(OrbisAudio3dPortId uiPortId, unsigned int uiNumChannels,
|
||||
int PS4_SYSV_ABI sceAudio3dBedWrite(OrbisAudio3dPortId uiPortId, u32 uiNumChannels,
|
||||
OrbisAudio3dFormat eFormat, const void* pBuffer,
|
||||
unsigned int uiNumSamples) {
|
||||
u32 uiNumSamples) {
|
||||
LOG_TRACE(Lib_Audio3d, "uiPortId = {}, uiNumChannels = {}, uiNumSamples = {}", uiPortId,
|
||||
uiNumChannels, uiNumSamples);
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceAudio3dBedWrite2(OrbisAudio3dPortId uiPortId, unsigned int uiNumChannels,
|
||||
int PS4_SYSV_ABI sceAudio3dBedWrite2(OrbisAudio3dPortId uiPortId, u32 uiNumChannels,
|
||||
OrbisAudio3dFormat eFormat, const void* pBuffer,
|
||||
unsigned int uiNumSamples,
|
||||
OrbisAudio3dOutputRoute eOutputRoute, bool bRestricted) {
|
||||
u32 uiNumSamples, OrbisAudio3dOutputRoute eOutputRoute,
|
||||
bool bRestricted) {
|
||||
LOG_INFO(Lib_Audio3d, "uiPortId = {}, uiNumChannels = {}, uiNumSamples = {}, bRestricted = {}",
|
||||
uiPortId, uiNumChannels, uiNumSamples, bRestricted);
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
size_t PS4_SYSV_ABI sceAudio3dGetSpeakerArrayMemorySize(unsigned int uiNumSpeakers, bool bIs3d) {
|
||||
size_t PS4_SYSV_ABI sceAudio3dGetSpeakerArrayMemorySize(u32 uiNumSpeakers, bool bIs3d) {
|
||||
LOG_INFO(Lib_Audio3d, "uiNumSpeakers = {}, bIs3d = {}", uiNumSpeakers, bIs3d);
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
@ -152,7 +149,7 @@ int PS4_SYSV_ABI sceAudio3dDeleteSpeakerArray(OrbisAudio3dSpeakerArrayHandle han
|
|||
int PS4_SYSV_ABI sceAudio3dGetSpeakerArrayMixCoefficients(OrbisAudio3dSpeakerArrayHandle handle,
|
||||
OrbisAudio3dPosition pos, float fSpread,
|
||||
float* pCoefficients,
|
||||
unsigned int uiNumCoefficients) {
|
||||
u32 uiNumCoefficients) {
|
||||
LOG_INFO(Lib_Audio3d, "fSpread = {}, uiNumCoefficients = {}", fSpread, uiNumCoefficients);
|
||||
if (handle == nullptr) {
|
||||
LOG_ERROR(Lib_Audio3d, "invalid SpeakerArrayHandle");
|
||||
|
@ -164,8 +161,7 @@ int PS4_SYSV_ABI sceAudio3dGetSpeakerArrayMixCoefficients(OrbisAudio3dSpeakerArr
|
|||
int PS4_SYSV_ABI sceAudio3dGetSpeakerArrayMixCoefficients2(OrbisAudio3dSpeakerArrayHandle handle,
|
||||
OrbisAudio3dPosition pos, float fSpread,
|
||||
float* pCoefficients,
|
||||
unsigned int uiNumCoefficients,
|
||||
bool bHeightAware,
|
||||
u32 uiNumCoefficients, bool bHeightAware,
|
||||
float fDownmixSpreadRadius) {
|
||||
LOG_INFO(Lib_Audio3d,
|
||||
"fSpread = {}, uiNumCoefficients = {}, bHeightAware = {}, fDownmixSpreadRadius = {}",
|
||||
|
@ -209,8 +205,8 @@ s32 PS4_SYSV_ABI sceAudio3dAudioOutOutputs(::Libraries::AudioOut::OrbisAudioOutO
|
|||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceAudio3dPortCreate(unsigned int uiGranularity, OrbisAudio3dRate eRate,
|
||||
s64 iReserved, OrbisAudio3dPortId* pId) {
|
||||
int PS4_SYSV_ABI sceAudio3dPortCreate(u32 uiGranularity, OrbisAudio3dRate eRate, s64 iReserved,
|
||||
OrbisAudio3dPortId* pId) {
|
||||
LOG_INFO(Lib_Audio3d, "uiGranularity = {}, iReserved = {}", uiGranularity, iReserved);
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
@ -341,4 +337,4 @@ void RegisterlibSceAudio3d(Core::Loader::SymbolsResolver* sym) {
|
|||
sceAudio3dSetGpuRenderer);
|
||||
};
|
||||
|
||||
} // namespace Libraries::Audio3d
|
||||
} // namespace Libraries::Audio3d
|
||||
|
|
|
@ -15,56 +15,57 @@ namespace Libraries::Audio3d {
|
|||
|
||||
class Audio3d;
|
||||
|
||||
typedef int OrbisUserServiceUserId;
|
||||
typedef unsigned int OrbisAudio3dPortId;
|
||||
typedef unsigned int OrbisAudio3dObjectId;
|
||||
typedef unsigned int OrbisAudio3dAttributeId;
|
||||
using OrbisUserServiceUserId = s32;
|
||||
using OrbisAudio3dPortId = u32;
|
||||
using OrbisAudio3dObjectId = u32;
|
||||
using OrbisAudio3dAttributeId = u32;
|
||||
|
||||
enum OrbisAudio3dFormat {
|
||||
ORBIS_AUDIO3D_FORMAT_S16 = 0, // s16
|
||||
ORBIS_AUDIO3D_FORMAT_FLOAT = 1 // f32
|
||||
enum class OrbisAudio3dFormat {
|
||||
S16 = 0,
|
||||
Float = 1,
|
||||
};
|
||||
|
||||
enum OrbisAudio3dRate { ORBIS_AUDIO3D_RATE_48000 = 0 };
|
||||
|
||||
enum OrbisAudio3dBufferMode {
|
||||
ORBIS_AUDIO3D_BUFFER_NO_ADVANCE = 0,
|
||||
ORBIS_AUDIO3D_BUFFER_ADVANCE_NO_PUSH = 1,
|
||||
ORBIS_AUDIO3D_BUFFER_ADVANCE_AND_PUSH = 2
|
||||
enum class OrbisAudio3dRate {
|
||||
Rate48000 = 0,
|
||||
};
|
||||
|
||||
enum OrbisAudio3dBlocking { ORBIS_AUDIO3D_BLOCKING_ASYNC = 0, ORBIS_AUDIO3D_BLOCKING_SYNC = 1 };
|
||||
enum class OrbisAudio3dBufferMode { NoAdvance = 0, AdvanceNoPush = 1, AdvanceAndPush = 2 };
|
||||
|
||||
enum OrbisAudio3dPassthrough {
|
||||
ORBIS_AUDIO3D_PASSTHROUGH_NONE = 0,
|
||||
ORBIS_AUDIO3D_PASSTHROUGH_LEFT = 1,
|
||||
ORBIS_AUDIO3D_PASSTHROUGH_RIGHT = 2
|
||||
enum class OrbisAudio3dBlocking {
|
||||
Async = 0,
|
||||
Sync = 1,
|
||||
};
|
||||
|
||||
enum OrbisAudio3dOutputRoute {
|
||||
ORBIS_AUDIO3D_OUTPUT_BOTH = 0,
|
||||
ORBIS_AUDIO3D_OUTPUT_HMU_ONLY = 1,
|
||||
ORBIS_AUDIO3D_OUTPUT_TV_ONLY = 2
|
||||
enum class OrbisAudio3dPassthrough {
|
||||
None = 0,
|
||||
Left = 1,
|
||||
Right = 2,
|
||||
};
|
||||
|
||||
enum OrbisAudio3dAmbisonics {
|
||||
ORBIS_AUDIO3D_AMBISONICS_NONE = ~0,
|
||||
ORBIS_AUDIO3D_AMBISONICS_W = 0,
|
||||
ORBIS_AUDIO3D_AMBISONICS_X = 1,
|
||||
ORBIS_AUDIO3D_AMBISONICS_Y = 2,
|
||||
ORBIS_AUDIO3D_AMBISONICS_Z = 3,
|
||||
ORBIS_AUDIO3D_AMBISONICS_R = 4,
|
||||
ORBIS_AUDIO3D_AMBISONICS_S = 5,
|
||||
ORBIS_AUDIO3D_AMBISONICS_T = 6,
|
||||
ORBIS_AUDIO3D_AMBISONICS_U = 7,
|
||||
ORBIS_AUDIO3D_AMBISONICS_V = 8,
|
||||
ORBIS_AUDIO3D_AMBISONICS_K = 9,
|
||||
ORBIS_AUDIO3D_AMBISONICS_L = 10,
|
||||
ORBIS_AUDIO3D_AMBISONICS_M = 11,
|
||||
ORBIS_AUDIO3D_AMBISONICS_N = 12,
|
||||
ORBIS_AUDIO3D_AMBISONICS_O = 13,
|
||||
ORBIS_AUDIO3D_AMBISONICS_P = 14,
|
||||
ORBIS_AUDIO3D_AMBISONICS_Q = 15
|
||||
enum class OrbisAudio3dOutputRoute {
|
||||
Both = 0,
|
||||
HmuOnly = 1,
|
||||
TvOnly = 2,
|
||||
};
|
||||
|
||||
enum class OrbisAudio3dAmbisonics : u32 {
|
||||
None = ~0U,
|
||||
W = 0,
|
||||
X = 1,
|
||||
Y = 2,
|
||||
Z = 3,
|
||||
R = 4,
|
||||
S = 5,
|
||||
T = 6,
|
||||
U = 7,
|
||||
V = 8,
|
||||
K = 9,
|
||||
L = 10,
|
||||
M = 11,
|
||||
N = 12,
|
||||
O = 13,
|
||||
P = 14,
|
||||
Q = 15
|
||||
};
|
||||
|
||||
static const OrbisAudio3dAttributeId s_sceAudio3dAttributePcm = 0x00000001;
|
||||
|
@ -86,21 +87,21 @@ struct OrbisAudio3dSpeakerArray;
|
|||
using OrbisAudio3dSpeakerArrayHandle = OrbisAudio3dSpeakerArray*; // head
|
||||
|
||||
struct OrbisAudio3dOpenParameters {
|
||||
size_t szSizeThis;
|
||||
unsigned int uiGranularity;
|
||||
OrbisAudio3dRate eRate;
|
||||
unsigned int uiMaxObjects;
|
||||
unsigned int uiQueueDepth;
|
||||
OrbisAudio3dBufferMode eBufferMode;
|
||||
size_t size_this;
|
||||
u32 granularity;
|
||||
OrbisAudio3dRate rate;
|
||||
u32 max_objects;
|
||||
u32 queue_depth;
|
||||
OrbisAudio3dBufferMode buffer_mode;
|
||||
char padding[32];
|
||||
unsigned int uiNumBeds;
|
||||
u32 num_beds;
|
||||
};
|
||||
|
||||
struct OrbisAudio3dAttribute {
|
||||
OrbisAudio3dAttributeId uiAttributeId;
|
||||
OrbisAudio3dAttributeId attribute_id;
|
||||
char padding[32];
|
||||
const void* pValue;
|
||||
size_t szValue;
|
||||
const void* p_value;
|
||||
size_t value;
|
||||
};
|
||||
|
||||
struct OrbisAudio3dPosition {
|
||||
|
@ -110,25 +111,25 @@ struct OrbisAudio3dPosition {
|
|||
};
|
||||
|
||||
struct OrbisAudio3dPcm {
|
||||
OrbisAudio3dFormat eFormat;
|
||||
const void* pSampleBuffer;
|
||||
unsigned int uiNumSamples;
|
||||
OrbisAudio3dFormat format;
|
||||
const void* sample_buffer;
|
||||
u32 num_samples;
|
||||
};
|
||||
|
||||
struct OrbisAudio3dSpeakerArrayParameters {
|
||||
OrbisAudio3dPosition* pSpeakerPosition;
|
||||
unsigned int uiNumSpeakers;
|
||||
bool bIs3d;
|
||||
void* pBuffer;
|
||||
size_t szSize;
|
||||
OrbisAudio3dPosition* speaker_position;
|
||||
u32 num_speakers;
|
||||
bool is_3d;
|
||||
void* buffer;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
struct OrbisAudio3dApplicationSpecific {
|
||||
size_t szSizeThis;
|
||||
u8 cApplicationSpecific[32];
|
||||
size_t size_this;
|
||||
u8 application_specific[32];
|
||||
};
|
||||
|
||||
void PS4_SYSV_ABI sceAudio3dGetDefaultOpenParameters(OrbisAudio3dOpenParameters* sParameters);
|
||||
|
||||
void RegisterlibSceAudio3d(Core::Loader::SymbolsResolver* sym);
|
||||
} // namespace Libraries::Audio3d
|
||||
} // namespace Libraries::Audio3d
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "core/libraries/error_codes.h"
|
||||
|
||||
constexpr int ORBIS_AUDIO3D_ERROR_UNKNOWN = 0x80EA0001;
|
||||
constexpr int ORBIS_AUDIO3D_ERROR_INVALID_PORT = 0x80EA0002;
|
||||
constexpr int ORBIS_AUDIO3D_ERROR_INVALID_OBJECT = 0x80EA0003;
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Libraries::Audio3d {
|
|||
class Audio3d {
|
||||
public:
|
||||
private:
|
||||
typedef unsigned int OrbisAudio3dPluginId;
|
||||
using OrbisAudio3dPluginId = u32;
|
||||
};
|
||||
|
||||
} // namespace Libraries::Audio3d
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
#include "common/logging/log.h"
|
||||
#include "core/libraries/avplayer/avplayer.h"
|
||||
#include "core/libraries/avplayer/avplayer_error.h"
|
||||
#include "core/libraries/avplayer/avplayer_impl.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/libs.h"
|
||||
|
||||
namespace Libraries::AvPlayer {
|
||||
|
|
|
@ -18,17 +18,26 @@ class AvPlayer;
|
|||
|
||||
using SceAvPlayerHandle = AvPlayer*;
|
||||
|
||||
enum SceAvPlayerUriType { SCE_AVPLAYER_URI_TYPE_SOURCE = 0 };
|
||||
enum class SceAvPlayerUriType : u32 {
|
||||
Source = 0,
|
||||
};
|
||||
|
||||
struct SceAvPlayerUri {
|
||||
const char* name;
|
||||
u32 length;
|
||||
};
|
||||
|
||||
enum SceAvPlayerSourceType {
|
||||
SCE_AVPLAYER_SOURCE_TYPE_UNKNOWN = 0,
|
||||
SCE_AVPLAYER_SOURCE_TYPE_FILE_MP4 = 1,
|
||||
SCE_AVPLAYER_SOURCE_TYPE_HLS = 8
|
||||
enum class SceAvPlayerSourceType {
|
||||
Unknown = 0,
|
||||
FileMp4 = 1,
|
||||
Hls = 8,
|
||||
};
|
||||
|
||||
enum class SceAvPlayerStreamType : u32 {
|
||||
Video,
|
||||
Audio,
|
||||
TimedText,
|
||||
Unknown,
|
||||
};
|
||||
|
||||
struct SceAvPlayerSourceDetails {
|
||||
|
@ -50,7 +59,7 @@ struct SceAvPlayerVideo {
|
|||
u32 width;
|
||||
u32 height;
|
||||
f32 aspect_ratio;
|
||||
u8 language_code[4];
|
||||
char language_code[4];
|
||||
};
|
||||
|
||||
struct SceAvPlayerTextPosition {
|
||||
|
@ -82,7 +91,7 @@ struct SceAvPlayerFrameInfo {
|
|||
};
|
||||
|
||||
struct SceAvPlayerStreamInfo {
|
||||
u32 type;
|
||||
SceAvPlayerStreamType type;
|
||||
u8 reserved[4];
|
||||
SceAvPlayerStreamDetails details;
|
||||
u64 duration;
|
||||
|
@ -135,10 +144,10 @@ struct SceAvPlayerFrameInfoEx {
|
|||
SceAvPlayerStreamDetailsEx details;
|
||||
};
|
||||
|
||||
typedef void* PS4_SYSV_ABI (*SceAvPlayerAllocate)(void* p, u32 align, u32 size);
|
||||
typedef void PS4_SYSV_ABI (*SceAvPlayerDeallocate)(void* p, void* mem);
|
||||
typedef void* PS4_SYSV_ABI (*SceAvPlayerAllocateTexture)(void* p, u32 align, u32 size);
|
||||
typedef void PS4_SYSV_ABI (*SceAvPlayerDeallocateTexture)(void* p, void* mem);
|
||||
using SceAvPlayerAllocate = void* PS4_SYSV_ABI (*)(void* p, u32 align, u32 size);
|
||||
using SceAvPlayerDeallocate = void PS4_SYSV_ABI (*)(void* p, void* mem);
|
||||
using SceAvPlayerAllocateTexture = void* PS4_SYSV_ABI (*)(void* p, u32 align, u32 size);
|
||||
using SceAvPlayerDeallocateTexture = void PS4_SYSV_ABI (*)(void* p, void* mem);
|
||||
|
||||
struct SceAvPlayerMemAllocator {
|
||||
void* object_ptr;
|
||||
|
@ -148,10 +157,10 @@ struct SceAvPlayerMemAllocator {
|
|||
SceAvPlayerDeallocateTexture deallocate_texture;
|
||||
};
|
||||
|
||||
typedef s32 PS4_SYSV_ABI (*SceAvPlayerOpenFile)(void* p, const char* name);
|
||||
typedef s32 PS4_SYSV_ABI (*SceAvPlayerCloseFile)(void* p);
|
||||
typedef s32 PS4_SYSV_ABI (*SceAvPlayerReadOffsetFile)(void* p, u8* buf, u64 pos, u32 len);
|
||||
typedef u64 PS4_SYSV_ABI (*SceAvPlayerSizeFile)(void* p);
|
||||
using SceAvPlayerOpenFile = s32 PS4_SYSV_ABI (*)(void* p, const char* name);
|
||||
using SceAvPlayerCloseFile = s32 PS4_SYSV_ABI (*)(void* p);
|
||||
using SceAvPlayerReadOffsetFile = s32 PS4_SYSV_ABI (*)(void* p, u8* buf, u64 pos, u32 len);
|
||||
using SceAvPlayerSizeFile = u64 PS4_SYSV_ABI (*)(void* p);
|
||||
|
||||
struct SceAvPlayerFileReplacement {
|
||||
void* object_ptr;
|
||||
|
@ -161,31 +170,31 @@ struct SceAvPlayerFileReplacement {
|
|||
SceAvPlayerSizeFile size;
|
||||
};
|
||||
|
||||
enum SceAvPlayerEvents {
|
||||
SCE_AVPLAYER_STATE_STOP = 0x01,
|
||||
SCE_AVPLAYER_STATE_READY = 0x02,
|
||||
SCE_AVPLAYER_STATE_PLAY = 0x03,
|
||||
SCE_AVPLAYER_STATE_PAUSE = 0x04,
|
||||
SCE_AVPLAYER_STATE_BUFFERING = 0x05,
|
||||
SCE_AVPLAYER_TIMED_TEXT_DELIVERY = 0x10,
|
||||
SCE_AVPLAYER_WARNING_ID = 0x20,
|
||||
SCE_AVPLAYER_ENCRYPTION = 0x30,
|
||||
SCE_AVPLAYER_DRM_ERROR = 0x40
|
||||
enum class SceAvPlayerEvents {
|
||||
StateStop = 0x01,
|
||||
StateReady = 0x02,
|
||||
StatePlay = 0x03,
|
||||
StatePause = 0x04,
|
||||
StateBuffering = 0x05,
|
||||
TimedTextDelivery = 0x10,
|
||||
WarningId = 0x20,
|
||||
Encryption = 0x30,
|
||||
DrmError = 0x40,
|
||||
};
|
||||
|
||||
typedef void PS4_SYSV_ABI (*SceAvPlayerEventCallback)(void* p, SceAvPlayerEvents event, s32 src_id,
|
||||
void* data);
|
||||
using SceAvPlayerEventCallback = void PS4_SYSV_ABI (*)(void* p, SceAvPlayerEvents event, s32 src_id,
|
||||
void* data);
|
||||
|
||||
struct SceAvPlayerEventReplacement {
|
||||
void* object_ptr;
|
||||
SceAvPlayerEventCallback event_callback;
|
||||
};
|
||||
|
||||
enum SceAvPlayerDebuglevels {
|
||||
SCE_AVPLAYER_DBG_NONE,
|
||||
SCE_AVPLAYER_DBG_INFO,
|
||||
SCE_AVPLAYER_DBG_WARNINGS,
|
||||
SCE_AVPLAYER_DBG_ALL
|
||||
enum class SceAvPlayerDebuglevels {
|
||||
None,
|
||||
Info,
|
||||
Warnings,
|
||||
All,
|
||||
};
|
||||
|
||||
struct SceAvPlayerInitData {
|
||||
|
@ -224,24 +233,17 @@ struct SceAvPlayerInitDataEx {
|
|||
u8 reserved[3];
|
||||
};
|
||||
|
||||
enum SceAvPlayerStreamType {
|
||||
SCE_AVPLAYER_VIDEO,
|
||||
SCE_AVPLAYER_AUDIO,
|
||||
SCE_AVPLAYER_TIMEDTEXT,
|
||||
SCE_AVPLAYER_UNKNOWN
|
||||
enum class SceAvPlayerVideoDecoderType {
|
||||
Default = 0,
|
||||
Reserved1,
|
||||
Software,
|
||||
Software2,
|
||||
};
|
||||
|
||||
enum SceAvPlayerVideoDecoderType {
|
||||
SCE_AVPLAYER_VIDEO_DECODER_TYPE_DEFAULT = 0,
|
||||
SCE_AVPLAYER_VIDEO_DECODER_TYPE_RESERVED1,
|
||||
SCE_AVPLAYER_VIDEO_DECODER_TYPE_SOFTWARE,
|
||||
SCE_AVPLAYER_VIDEO_DECODER_TYPE_SOFTWARE2
|
||||
};
|
||||
|
||||
enum SceAvPlayerAudioDecoderType {
|
||||
SCE_AVPLAYER_AUDIO_DECODER_TYPE_DEFAULT = 0,
|
||||
SCE_AVPLAYER_AUDIO_DECODER_TYPE_RESERVED1,
|
||||
SCE_AVPLAYER_AUDIO_DECODER_TYPE_RESERVED2
|
||||
enum class SceAvPlayerAudioDecoderType {
|
||||
Default = 0,
|
||||
Reserved1,
|
||||
Reserved2,
|
||||
};
|
||||
|
||||
struct SceAvPlayerDecoderInit {
|
||||
|
@ -281,12 +283,12 @@ struct SceAvPlayerPostInitData {
|
|||
u8 reserved[56];
|
||||
};
|
||||
|
||||
enum SceAvPlayerAvSyncMode {
|
||||
SCE_AVPLAYER_AV_SYNC_MODE_DEFAULT = 0,
|
||||
SCE_AVPLAYER_AV_SYNC_MODE_NONE
|
||||
enum class SceAvPlayerAvSyncMode {
|
||||
Default = 0,
|
||||
None,
|
||||
};
|
||||
|
||||
typedef int PS4_SYSV_ABI (*SceAvPlayerLogCallback)(void* p, const char* format, va_list args);
|
||||
using SceAvPlayerLogCallback = int PS4_SYSV_ABI (*)(void* p, const char* format, va_list args);
|
||||
|
||||
void RegisterlibSceAvPlayer(Core::Loader::SymbolsResolver* sym);
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ static bool iequals(std::string_view l, std::string_view r) {
|
|||
|
||||
SceAvPlayerSourceType GetSourceType(std::string_view path) {
|
||||
if (path.empty()) {
|
||||
return SCE_AVPLAYER_SOURCE_TYPE_UNKNOWN;
|
||||
return SceAvPlayerSourceType::Unknown;
|
||||
}
|
||||
|
||||
std::string_view name = path;
|
||||
|
@ -25,14 +25,14 @@ SceAvPlayerSourceType GetSourceType(std::string_view path) {
|
|||
// -> schema://server.domain/path/to/file.ext/and/beyond
|
||||
name = path.substr(0, path.find_first_of("?#"));
|
||||
if (name.empty()) {
|
||||
return SCE_AVPLAYER_SOURCE_TYPE_UNKNOWN;
|
||||
return SceAvPlayerSourceType::Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
// schema://server.domain/path/to/file.ext/and/beyond -> .ext/and/beyond
|
||||
auto ext = name.substr(name.rfind('.'));
|
||||
if (ext.empty()) {
|
||||
return SCE_AVPLAYER_SOURCE_TYPE_UNKNOWN;
|
||||
return SceAvPlayerSourceType::Unknown;
|
||||
}
|
||||
|
||||
// .ext/and/beyond -> .ext
|
||||
|
@ -40,14 +40,14 @@ SceAvPlayerSourceType GetSourceType(std::string_view path) {
|
|||
|
||||
if (iequals(ext, ".mp4") || iequals(ext, ".m4v") || iequals(ext, ".m3d") ||
|
||||
iequals(ext, ".m4a") || iequals(ext, ".mov")) {
|
||||
return SCE_AVPLAYER_SOURCE_TYPE_FILE_MP4;
|
||||
return SceAvPlayerSourceType::FileMp4;
|
||||
}
|
||||
|
||||
if (iequals(ext, ".m3u8")) {
|
||||
return SCE_AVPLAYER_SOURCE_TYPE_HLS;
|
||||
return SceAvPlayerSourceType::Hls;
|
||||
}
|
||||
|
||||
return SCE_AVPLAYER_SOURCE_TYPE_UNKNOWN;
|
||||
return SceAvPlayerSourceType::Unknown;
|
||||
}
|
||||
|
||||
} // namespace Libraries::AvPlayer
|
||||
|
|
19
src/core/libraries/avplayer/avplayer_error.h
Normal file
19
src/core/libraries/avplayer/avplayer_error.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/libraries/error_codes.h"
|
||||
|
||||
// AvPlayer library
|
||||
constexpr int ORBIS_AVPLAYER_ERROR_INVALID_PARAMS = 0x806A0001;
|
||||
constexpr int ORBIS_AVPLAYER_ERROR_OPERATION_FAILED = 0x806A0002;
|
||||
constexpr int ORBIS_AVPLAYER_ERROR_NO_MEMORY = 0x806A0003;
|
||||
constexpr int ORBIS_AVPLAYER_ERROR_NOT_SUPPORTED = 0x806A0004;
|
||||
constexpr int ORBIS_AVPLAYER_ERROR_WAR_FILE_NONINTERLEAVED = 0x806A00A0;
|
||||
constexpr int ORBIS_AVPLAYER_ERROR_WAR_LOOPING_BACK = 0x806A00A1;
|
||||
constexpr int ORBIS_AVPLAYER_ERROR_WAR_JUMP_COMPLETE = 0x806A00A3;
|
||||
constexpr int ORBIS_AVPLAYER_ERROR_INFO_MARLIN_ENCRY = 0x806A00B0;
|
||||
constexpr int ORBIS_AVPLAYER_ERROR_INFO_PLAYREADY_ENCRY = 0x806A00B4;
|
||||
constexpr int ORBIS_AVPLAYER_ERROR_INFO_AES_ENCRY = 0x806A00B5;
|
||||
constexpr int ORBIS_AVPLAYER_ERROR_INFO_OTHER_ENCRY = 0x806A00BF;
|
|
@ -2,8 +2,8 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "core/libraries/avplayer/avplayer_common.h"
|
||||
#include "core/libraries/avplayer/avplayer_error.h"
|
||||
#include "core/libraries/avplayer/avplayer_impl.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/tls.h"
|
||||
|
||||
namespace Libraries::AvPlayer {
|
||||
|
|
|
@ -85,17 +85,17 @@ s32 AvPlayerSource::GetStreamCount() {
|
|||
return m_avformat_context->nb_streams;
|
||||
}
|
||||
|
||||
static s32 CodecTypeToStreamType(AVMediaType codec_type) {
|
||||
static SceAvPlayerStreamType CodecTypeToStreamType(AVMediaType codec_type) {
|
||||
switch (codec_type) {
|
||||
case AVMediaType::AVMEDIA_TYPE_VIDEO:
|
||||
return SCE_AVPLAYER_VIDEO;
|
||||
return SceAvPlayerStreamType::Video;
|
||||
case AVMediaType::AVMEDIA_TYPE_AUDIO:
|
||||
return SCE_AVPLAYER_AUDIO;
|
||||
return SceAvPlayerStreamType::Audio;
|
||||
case AVMediaType::AVMEDIA_TYPE_SUBTITLE:
|
||||
return SCE_AVPLAYER_TIMEDTEXT;
|
||||
return SceAvPlayerStreamType::TimedText;
|
||||
default:
|
||||
LOG_ERROR(Lib_AvPlayer, "Unexpected AVMediaType {}", magic_enum::enum_name(codec_type));
|
||||
return -1;
|
||||
return SceAvPlayerStreamType::Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ bool AvPlayerSource::GetStreamInfo(u32 stream_index, SceAvPlayerStreamInfo& info
|
|||
LOG_WARNING(Lib_AvPlayer, "Stream {} language is unknown", stream_index);
|
||||
}
|
||||
switch (info.type) {
|
||||
case SCE_AVPLAYER_VIDEO: {
|
||||
case SceAvPlayerStreamType::Video: {
|
||||
LOG_INFO(Lib_AvPlayer, "Stream {} is a video stream.", stream_index);
|
||||
info.details.video.aspect_ratio =
|
||||
f32(p_stream->codecpar->width) / p_stream->codecpar->height;
|
||||
|
@ -142,7 +142,7 @@ bool AvPlayerSource::GetStreamInfo(u32 stream_index, SceAvPlayerStreamInfo& info
|
|||
}
|
||||
break;
|
||||
}
|
||||
case SCE_AVPLAYER_AUDIO: {
|
||||
case SceAvPlayerStreamType::Audio: {
|
||||
LOG_INFO(Lib_AvPlayer, "Stream {} is an audio stream.", stream_index);
|
||||
info.details.audio.channel_count = p_stream->codecpar->ch_layout.nb_channels;
|
||||
info.details.audio.sample_rate = p_stream->codecpar->sample_rate;
|
||||
|
@ -153,7 +153,7 @@ bool AvPlayerSource::GetStreamInfo(u32 stream_index, SceAvPlayerStreamInfo& info
|
|||
}
|
||||
break;
|
||||
}
|
||||
case SCE_AVPLAYER_TIMEDTEXT: {
|
||||
case SceAvPlayerStreamType::TimedText: {
|
||||
LOG_WARNING(Lib_AvPlayer, "Stream {} is a timedtext stream.", stream_index);
|
||||
info.details.subs.font_size = 12;
|
||||
info.details.subs.text_size = 12;
|
||||
|
@ -164,7 +164,8 @@ bool AvPlayerSource::GetStreamInfo(u32 stream_index, SceAvPlayerStreamInfo& info
|
|||
break;
|
||||
}
|
||||
default: {
|
||||
LOG_ERROR(Lib_AvPlayer, "Stream {} type is unknown: {}.", stream_index, info.type);
|
||||
LOG_ERROR(Lib_AvPlayer, "Stream {} type is unknown: {}.", stream_index,
|
||||
magic_enum::enum_name(info.type));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
#include "common/logging/log.h"
|
||||
#include "common/thread.h"
|
||||
#include "core/libraries/avplayer/avplayer_error.h"
|
||||
#include "core/libraries/avplayer/avplayer_source.h"
|
||||
#include "core/libraries/avplayer/avplayer_state.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/tls.h"
|
||||
|
||||
#include <magic_enum.hpp>
|
||||
|
@ -16,7 +16,7 @@ void PS4_SYSV_ABI AvPlayerState::AutoPlayEventCallback(void* opaque, SceAvPlayer
|
|||
s32 source_id, void* event_data) {
|
||||
auto const self = reinterpret_cast<AvPlayerState*>(opaque);
|
||||
|
||||
if (event_id == SCE_AVPLAYER_STATE_READY) {
|
||||
if (event_id == SceAvPlayerEvents::StateReady) {
|
||||
s32 video_stream_index = -1;
|
||||
s32 audio_stream_index = -1;
|
||||
s32 timedtext_stream_index = -1;
|
||||
|
@ -36,36 +36,37 @@ void PS4_SYSV_ABI AvPlayerState::AutoPlayEventCallback(void* opaque, SceAvPlayer
|
|||
return;
|
||||
}
|
||||
|
||||
const std::string_view default_language(
|
||||
reinterpret_cast<char*>(self->m_default_language));
|
||||
const std::string_view default_language{self->m_default_language};
|
||||
switch (info.type) {
|
||||
case SCE_AVPLAYER_VIDEO:
|
||||
case SceAvPlayerStreamType::Video:
|
||||
if (video_stream_index == -1) {
|
||||
video_stream_index = stream_index;
|
||||
}
|
||||
if (!default_language.empty() &&
|
||||
default_language == reinterpret_cast<char*>(info.details.video.language_code)) {
|
||||
default_language == info.details.video.language_code) {
|
||||
video_stream_index = stream_index;
|
||||
}
|
||||
break;
|
||||
case SCE_AVPLAYER_AUDIO:
|
||||
case SceAvPlayerStreamType::Audio:
|
||||
if (audio_stream_index == -1) {
|
||||
audio_stream_index = stream_index;
|
||||
}
|
||||
if (!default_language.empty() &&
|
||||
default_language == reinterpret_cast<char*>(info.details.video.language_code)) {
|
||||
default_language == info.details.video.language_code) {
|
||||
audio_stream_index = stream_index;
|
||||
}
|
||||
break;
|
||||
case SCE_AVPLAYER_TIMEDTEXT:
|
||||
case SceAvPlayerStreamType::TimedText:
|
||||
if (default_language.empty()) {
|
||||
timedtext_stream_index = stream_index;
|
||||
break;
|
||||
}
|
||||
if (default_language == reinterpret_cast<char*>(info.details.video.language_code)) {
|
||||
if (default_language == info.details.video.language_code) {
|
||||
timedtext_stream_index = stream_index;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,7 +142,7 @@ bool AvPlayerState::AddSource(std::string_view path, SceAvPlayerSourceType sourc
|
|||
|
||||
m_up_source = std::make_unique<AvPlayerSource>(
|
||||
*this, m_post_init_data.video_decoder_init.decoderType.video_type ==
|
||||
SCE_AVPLAYER_VIDEO_DECODER_TYPE_SOFTWARE2);
|
||||
SceAvPlayerVideoDecoderType::Software2);
|
||||
if (!m_up_source->Init(m_init_data, path)) {
|
||||
SetState(AvState::Error);
|
||||
m_up_source.reset();
|
||||
|
@ -317,23 +318,23 @@ void AvPlayerState::OnEOF() {
|
|||
void AvPlayerState::OnPlaybackStateChanged(AvState state) {
|
||||
switch (state) {
|
||||
case AvState::Ready: {
|
||||
EmitEvent(SCE_AVPLAYER_STATE_READY);
|
||||
EmitEvent(SceAvPlayerEvents::StateReady);
|
||||
break;
|
||||
}
|
||||
case AvState::Play: {
|
||||
EmitEvent(SCE_AVPLAYER_STATE_PLAY);
|
||||
EmitEvent(SceAvPlayerEvents::StatePlay);
|
||||
break;
|
||||
}
|
||||
case AvState::Stop: {
|
||||
EmitEvent(SCE_AVPLAYER_STATE_STOP);
|
||||
EmitEvent(SceAvPlayerEvents::StateStop);
|
||||
break;
|
||||
}
|
||||
case AvState::Pause: {
|
||||
EmitEvent(SCE_AVPLAYER_STATE_PAUSE);
|
||||
EmitEvent(SceAvPlayerEvents::StatePause);
|
||||
break;
|
||||
}
|
||||
case AvState::Buffering: {
|
||||
EmitEvent(SCE_AVPLAYER_STATE_BUFFERING);
|
||||
EmitEvent(SceAvPlayerEvents::StateBuffering);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -69,7 +69,7 @@ private:
|
|||
SceAvPlayerPostInitData m_post_init_data{};
|
||||
SceAvPlayerEventReplacement m_event_replacement{};
|
||||
bool m_auto_start{};
|
||||
u8 m_default_language[4]{};
|
||||
char m_default_language[4]{};
|
||||
|
||||
std::atomic<AvState> m_current_state;
|
||||
std::atomic<AvState> m_previous_state;
|
||||
|
|
|
@ -3,626 +3,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
// posix error codes
|
||||
constexpr int POSIX_EPERM = 1;
|
||||
constexpr int POSIX_ENOENT = 2;
|
||||
constexpr int POSIX_ESRCH = 3;
|
||||
constexpr int POSIX_EINTR = 4;
|
||||
constexpr int POSIX_EIO = 5;
|
||||
constexpr int POSIX_ENXIO = 6;
|
||||
constexpr int POSIX_E2BIG = 7;
|
||||
constexpr int POSIX_ENOEXEC = 8;
|
||||
constexpr int POSIX_EBADF = 9;
|
||||
constexpr int POSIX_ECHILD = 10;
|
||||
constexpr int POSIX_EDEADLK = 11;
|
||||
constexpr int POSIX_ENOMEM = 12;
|
||||
constexpr int POSIX_EACCES = 13;
|
||||
constexpr int POSIX_EFAULT = 14;
|
||||
constexpr int POSIX_ENOTBLK = 15;
|
||||
constexpr int POSIX_EBUSY = 16;
|
||||
constexpr int POSIX_EEXIST = 17;
|
||||
constexpr int POSIX_EXDEV = 18;
|
||||
constexpr int POSIX_ENODEV = 19;
|
||||
constexpr int POSIX_ENOTDIR = 20;
|
||||
constexpr int POSIX_EISDIR = 21;
|
||||
constexpr int POSIX_EINVAL = 22;
|
||||
constexpr int POSIX_ENFILE = 23;
|
||||
constexpr int POSIX_EMFILE = 24;
|
||||
constexpr int POSIX_ENOTTY = 25;
|
||||
constexpr int POSIX_ETXTBSY = 26;
|
||||
constexpr int POSIX_EFBIG = 27;
|
||||
constexpr int POSIX_ENOSPC = 28;
|
||||
constexpr int POSIX_ESPIPE = 29;
|
||||
constexpr int POSIX_EROFS = 30;
|
||||
constexpr int POSIX_EMLINK = 31;
|
||||
constexpr int POSIX_EPIPE = 32;
|
||||
constexpr int POSIX_EDOM = 33;
|
||||
constexpr int POSIX_ERANGE = 34;
|
||||
constexpr int POSIX_EAGAIN = 35;
|
||||
constexpr int POSIX_EWOULDBLOCK = 35;
|
||||
constexpr int POSIX_EINPROGRESS = 36;
|
||||
constexpr int POSIX_EALREADY = 37;
|
||||
constexpr int POSIX_ENOTSOCK = 38;
|
||||
constexpr int POSIX_EDESTADDRREQ = 39;
|
||||
constexpr int POSIX_EMSGSIZE = 40;
|
||||
constexpr int POSIX_EPROTOTYPE = 41;
|
||||
constexpr int POSIX_ENOPROTOOPT = 42;
|
||||
constexpr int POSIX_EPROTONOSUPPORT = 43;
|
||||
constexpr int POSIX_ESOCKTNOSUPPORT = 44;
|
||||
constexpr int POSIX_EOPNOTSUPP = 45;
|
||||
constexpr int POSIX_ENOTSUP = 45;
|
||||
constexpr int POSIX_EPFNOSUPPORT = 46;
|
||||
constexpr int POSIX_EAFNOSUPPORT = 47;
|
||||
constexpr int POSIX_EADDRINUSE = 48;
|
||||
constexpr int POSIX_EADDRNOTAVAIL = 49;
|
||||
constexpr int POSIX_ENETDOWN = 50;
|
||||
constexpr int POSIX_ENETUNREACH = 51;
|
||||
constexpr int POSIX_ENETRESET = 52;
|
||||
constexpr int POSIX_ECONNABORTED = 53;
|
||||
constexpr int POSIX_ECONNRESET = 54;
|
||||
constexpr int POSIX_ENOBUFS = 55;
|
||||
constexpr int POSIX_EISCONN = 56;
|
||||
constexpr int POSIX_ENOTCONN = 57;
|
||||
constexpr int POSIX_ESHUTDOWN = 58;
|
||||
constexpr int POSIX_ETOOMANYREFS = 59;
|
||||
constexpr int POSIX_ETIMEDOUT = 60;
|
||||
constexpr int POSIX_ECONNREFUSED = 61;
|
||||
constexpr int POSIX_ELOOP = 62;
|
||||
constexpr int POSIX_ENAMETOOLONG = 63;
|
||||
constexpr int POSIX_EHOSTDOWN = 64;
|
||||
constexpr int POSIX_EHOSTUNREACH = 65;
|
||||
constexpr int POSIX_ENOTEMPTY = 66;
|
||||
constexpr int POSIX_EPROCLIM = 67;
|
||||
constexpr int POSIX_EUSERS = 68;
|
||||
constexpr int POSIX_EDQUOT = 69;
|
||||
constexpr int POSIX_ESTALE = 70;
|
||||
constexpr int POSIX_EREMOTE = 71;
|
||||
constexpr int POSIX_EBADRPC = 72;
|
||||
constexpr int POSIX_ERPCMISMATCH = 73;
|
||||
constexpr int POSIX_EPROGUNAVAIL = 74;
|
||||
constexpr int POSIX_EPROGMISMATCH = 75;
|
||||
constexpr int POSIX_EPROCUNAVAIL = 76;
|
||||
constexpr int POSIX_ENOLCK = 77;
|
||||
constexpr int POSIX_ENOSYS = 78;
|
||||
constexpr int POSIX_EFTYPE = 79;
|
||||
constexpr int POSIX_EAUTH = 80;
|
||||
constexpr int POSIX_ENEEDAUTH = 81;
|
||||
constexpr int POSIX_EIDRM = 82;
|
||||
constexpr int POSIX_ENOMSG = 83;
|
||||
constexpr int POSIX_EOVERFLOW = 84;
|
||||
constexpr int POSIX_ECANCELED = 85;
|
||||
constexpr int POSIX_EILSEQ = 86;
|
||||
constexpr int POSIX_ENOATTR = 87;
|
||||
constexpr int POSIX_EDOOFUS = 88;
|
||||
constexpr int POSIX_EBADMSG = 89;
|
||||
constexpr int POSIX_EMULTIHOP = 90;
|
||||
constexpr int POSIX_ENOLINK = 91;
|
||||
constexpr int POSIX_EPROTO = 92;
|
||||
constexpr int POSIX_ENOTCAPABLE = 93;
|
||||
constexpr int POSIX_ECAPMODE = 94;
|
||||
constexpr int POSIX_ENOBLK = 95;
|
||||
constexpr int POSIX_EICV = 96;
|
||||
constexpr int POSIX_ENOPLAYGOENT = 97;
|
||||
constexpr int POSIX_EREVOKE = 98;
|
||||
constexpr int POSIX_ESDKVERSION = 99;
|
||||
constexpr int POSIX_ESTART = 100;
|
||||
constexpr int POSIX_ESTOP = 101;
|
||||
constexpr int POSIX_EINVALID2MB = 102;
|
||||
constexpr int POSIX_ELAST = 102;
|
||||
constexpr int POSIX_EADHOC = 160;
|
||||
constexpr int POSIX_EINACTIVEDISABLED = 163;
|
||||
constexpr int POSIX_ENETNODATA = 164;
|
||||
constexpr int POSIX_ENETDESC = 165;
|
||||
constexpr int POSIX_ENETDESCTIMEDOUT = 166;
|
||||
constexpr int POSIX_ENETINTR = 167;
|
||||
constexpr int POSIX_ERETURN = 205;
|
||||
constexpr int POSIX_EFPOS = 152;
|
||||
constexpr int POSIX_ENODATA = 1040;
|
||||
constexpr int POSIX_ENOSR = 1050;
|
||||
constexpr int POSIX_ENOSTR = 1051;
|
||||
constexpr int POSIX_ENOTRECOVERABLE = 1056;
|
||||
constexpr int POSIX_EOTHER = 1062;
|
||||
constexpr int POSIX_EOWNERDEAD = 1064;
|
||||
constexpr int POSIX_ETIME = 1074;
|
||||
|
||||
constexpr int SCE_OK = 0;
|
||||
|
||||
// kernel error codes
|
||||
constexpr int SCE_KERNEL_ERROR_UNKNOWN = 0x80020000;
|
||||
constexpr int SCE_KERNEL_ERROR_EPERM = 0x80020001;
|
||||
constexpr int SCE_KERNEL_ERROR_ENOENT = 0x80020002;
|
||||
constexpr int SCE_KERNEL_ERROR_ESRCH = 0x80020003;
|
||||
constexpr int SCE_KERNEL_ERROR_EINTR = 0x80020004;
|
||||
constexpr int SCE_KERNEL_ERROR_EIO = 0x80020005;
|
||||
constexpr int SCE_KERNEL_ERROR_ENXIO = 0x80020006;
|
||||
constexpr int SCE_KERNEL_ERROR_E2BIG = 0x80020007;
|
||||
constexpr int SCE_KERNEL_ERROR_ENOEXEC = 0x80020008;
|
||||
constexpr int SCE_KERNEL_ERROR_EBADF = 0x80020009;
|
||||
constexpr int SCE_KERNEL_ERROR_ECHILD = 0x8002000A;
|
||||
constexpr int SCE_KERNEL_ERROR_EDEADLK = 0x8002000B;
|
||||
constexpr int SCE_KERNEL_ERROR_ENOMEM = 0x8002000C;
|
||||
constexpr int SCE_KERNEL_ERROR_EACCES = 0x8002000D;
|
||||
constexpr int SCE_KERNEL_ERROR_EFAULT = 0x8002000E;
|
||||
constexpr int SCE_KERNEL_ERROR_ENOTBLK = 0x8002000F;
|
||||
constexpr int SCE_KERNEL_ERROR_EBUSY = 0x80020010;
|
||||
constexpr int SCE_KERNEL_ERROR_EEXIST = 0x80020011;
|
||||
constexpr int SCE_KERNEL_ERROR_EXDEV = 0x80020012;
|
||||
constexpr int SCE_KERNEL_ERROR_ENODEV = 0x80020013;
|
||||
constexpr int SCE_KERNEL_ERROR_ENOTDIR = 0x80020014;
|
||||
constexpr int SCE_KERNEL_ERROR_EISDIR = 0x80020015;
|
||||
constexpr int SCE_KERNEL_ERROR_EINVAL = 0x80020016;
|
||||
constexpr int SCE_KERNEL_ERROR_ENFILE = 0x80020017;
|
||||
constexpr int SCE_KERNEL_ERROR_EMFILE = 0x80020018;
|
||||
constexpr int SCE_KERNEL_ERROR_ENOTTY = 0x80020019;
|
||||
constexpr int SCE_KERNEL_ERROR_ETXTBSY = 0x8002001A;
|
||||
constexpr int SCE_KERNEL_ERROR_EFBIG = 0x8002001B;
|
||||
constexpr int SCE_KERNEL_ERROR_ENOSPC = 0x8002001C;
|
||||
constexpr int SCE_KERNEL_ERROR_ESPIPE = 0x8002001D;
|
||||
constexpr int SCE_KERNEL_ERROR_EROFS = 0x8002001E;
|
||||
constexpr int SCE_KERNEL_ERROR_EMLINK = 0x8002001F;
|
||||
constexpr int SCE_KERNEL_ERROR_EPIPE = 0x80020020;
|
||||
constexpr int SCE_KERNEL_ERROR_EDOM = 0x80020021;
|
||||
constexpr int SCE_KERNEL_ERROR_ERANGE = 0x80020022;
|
||||
constexpr int SCE_KERNEL_ERROR_EAGAIN = 0x80020023;
|
||||
constexpr int SCE_KERNEL_ERROR_EWOULDBLOCK = 0x80020023;
|
||||
constexpr int SCE_KERNEL_ERROR_EINPROGRESS = 0x80020024;
|
||||
constexpr int SCE_KERNEL_ERROR_EALREADY = 0x80020025;
|
||||
constexpr int SCE_KERNEL_ERROR_ENOTSOCK = 0x80020026;
|
||||
constexpr int SCE_KERNEL_ERROR_EDESTADDRREQ = 0x80020027;
|
||||
constexpr int SCE_KERNEL_ERROR_EMSGSIZE = 0x80020028;
|
||||
constexpr int SCE_KERNEL_ERROR_EPROTOTYPE = 0x80020029;
|
||||
constexpr int SCE_KERNEL_ERROR_ENOPROTOOPT = 0x8002002A;
|
||||
constexpr int SCE_KERNEL_ERROR_EPROTONOSUPPORT = 0x8002002B;
|
||||
constexpr int SCE_KERNEL_ERROR_ESOCKTNOSUPPORT = 0x8002002C;
|
||||
constexpr int SCE_KERNEL_ERROR_EOPNOTSUPP = 0x8002002D;
|
||||
constexpr int SCE_KERNEL_ERROR_ENOTSUP = 0x8002002D;
|
||||
constexpr int SCE_KERNEL_ERROR_EPFNOSUPPORT = 0x8002002E;
|
||||
constexpr int SCE_KERNEL_ERROR_EAFNOSUPPORT = 0x8002002F;
|
||||
constexpr int SCE_KERNEL_ERROR_EADDRINUSE = 0x80020030;
|
||||
constexpr int SCE_KERNEL_ERROR_EADDRNOTAVAIL = 0x80020031;
|
||||
constexpr int SCE_KERNEL_ERROR_ENETDOWN = 0x80020032;
|
||||
constexpr int SCE_KERNEL_ERROR_ENETUNREACH = 0x80020033;
|
||||
constexpr int SCE_KERNEL_ERROR_ENETRESET = 0x80020034;
|
||||
constexpr int SCE_KERNEL_ERROR_ECONNABORTED = 0x80020035;
|
||||
constexpr int SCE_KERNEL_ERROR_ECONNRESET = 0x80020036;
|
||||
constexpr int SCE_KERNEL_ERROR_ENOBUFS = 0x80020037;
|
||||
constexpr int SCE_KERNEL_ERROR_EISCONN = 0x80020038;
|
||||
constexpr int SCE_KERNEL_ERROR_ENOTCONN = 0x80020039;
|
||||
constexpr int SCE_KERNEL_ERROR_ESHUTDOWN = 0x8002003A;
|
||||
constexpr int SCE_KERNEL_ERROR_ETOOMANYREFS = 0x8002003B;
|
||||
constexpr int SCE_KERNEL_ERROR_ETIMEDOUT = 0x8002003C;
|
||||
constexpr int SCE_KERNEL_ERROR_ECONNREFUSED = 0x8002003D;
|
||||
constexpr int SCE_KERNEL_ERROR_ELOOP = 0x8002003E;
|
||||
constexpr int SCE_KERNEL_ERROR_ENAMETOOLONG = 0x8002003F;
|
||||
constexpr int SCE_KERNEL_ERROR_EHOSTDOWN = 0x80020040;
|
||||
constexpr int SCE_KERNEL_ERROR_EHOSTUNREACH = 0x80020041;
|
||||
constexpr int SCE_KERNEL_ERROR_ENOTEMPTY = 0x80020042;
|
||||
constexpr int SCE_KERNEL_ERROR_EPROCLIM = 0x80020043;
|
||||
constexpr int SCE_KERNEL_ERROR_EUSERS = 0x80020044;
|
||||
constexpr int SCE_KERNEL_ERROR_EDQUOT = 0x80020045;
|
||||
constexpr int SCE_KERNEL_ERROR_ESTALE = 0x80020046;
|
||||
constexpr int SCE_KERNEL_ERROR_EREMOTE = 0x80020047;
|
||||
constexpr int SCE_KERNEL_ERROR_EBADRPC = 0x80020048;
|
||||
constexpr int SCE_KERNEL_ERROR_ERPCMISMATCH = 0x80020049;
|
||||
constexpr int SCE_KERNEL_ERROR_EPROGUNAVAIL = 0x8002004A;
|
||||
constexpr int SCE_KERNEL_ERROR_EPROGMISMATCH = 0x8002004B;
|
||||
constexpr int SCE_KERNEL_ERROR_EPROCUNAVAIL = 0x8002004C;
|
||||
constexpr int SCE_KERNEL_ERROR_ENOLCK = 0x8002004D;
|
||||
constexpr int SCE_KERNEL_ERROR_ENOSYS = 0x8002004E;
|
||||
constexpr int SCE_KERNEL_ERROR_EFTYPE = 0x8002004F;
|
||||
constexpr int SCE_KERNEL_ERROR_EAUTH = 0x80020050;
|
||||
constexpr int SCE_KERNEL_ERROR_ENEEDAUTH = 0x80020051;
|
||||
constexpr int SCE_KERNEL_ERROR_EIDRM = 0x80020052;
|
||||
constexpr int SCE_KERNEL_ERROR_ENOMSG = 0x80020053;
|
||||
constexpr int SCE_KERNEL_ERROR_EOVERFLOW = 0x80020054;
|
||||
constexpr int SCE_KERNEL_ERROR_ECANCELED = 0x80020055;
|
||||
constexpr int SCE_KERNEL_ERROR_EILSEQ = 0x80020056;
|
||||
constexpr int SCE_KERNEL_ERROR_ENOATTR = 0x80020057;
|
||||
constexpr int SCE_KERNEL_ERROR_EDOOFUS = 0x80020058;
|
||||
constexpr int SCE_KERNEL_ERROR_EBADMSG = 0x80020059;
|
||||
constexpr int SCE_KERNEL_ERROR_EMULTIHOP = 0x8002005A;
|
||||
constexpr int SCE_KERNEL_ERROR_ENOLINK = 0x8002005B;
|
||||
constexpr int SCE_KERNEL_ERROR_EPROTO = 0x8002005C;
|
||||
constexpr int SCE_KERNEL_ERROR_ENOTCAPABLE = 0x8002005D;
|
||||
constexpr int SCE_KERNEL_ERROR_ECAPMODE = 0x8002005E;
|
||||
constexpr int SCE_KERNEL_ERROR_ENOBLK = 0x8002005F;
|
||||
constexpr int SCE_KERNEL_ERROR_EICV = 0x80020060;
|
||||
constexpr int SCE_KERNEL_ERROR_ENOPLAYGOENT = 0x80020061;
|
||||
constexpr int SCE_KERNEL_ERROR_EREVOKE = 0x80020062;
|
||||
constexpr int SCE_KERNEL_ERROR_ESDKVERSION = 0x80020063;
|
||||
constexpr int SCE_KERNEL_ERROR_ESTART = 0x80020064;
|
||||
constexpr int SCE_KERNEL_ERROR_ESTOP = 0x80020065;
|
||||
|
||||
// videoOut
|
||||
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_VALUE = 0x80290001; // invalid argument
|
||||
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_ADDRESS = 0x80290002; // invalid addresses
|
||||
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_TILING_MODE = 0x80290007; // invalid tiling mode
|
||||
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_ASPECT_RATIO = 0x80290008; // invalid aspect ration
|
||||
constexpr int SCE_VIDEO_OUT_ERROR_RESOURCE_BUSY = 0x80290009; // already opened
|
||||
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_INDEX = 0x8029000A; // invalid buffer index
|
||||
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_HANDLE = 0x8029000B; // invalid handle
|
||||
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_EVENT_QUEUE = 0x8029000C; // Invalid event queue
|
||||
constexpr int SCE_VIDEO_OUT_ERROR_SLOT_OCCUPIED = 0x80290010; // slot already used
|
||||
constexpr int SCE_VIDEO_OUT_ERROR_FLIP_QUEUE_FULL = 0x80290012; // flip queue is full
|
||||
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_OPTION = 0x8029001A; // Invalid buffer attribute option
|
||||
|
||||
// Generic
|
||||
constexpr int ORBIS_OK = 0x00000000;
|
||||
constexpr int ORBIS_FAIL = 0xFFFFFFFF;
|
||||
|
||||
// Libkernel library
|
||||
constexpr int ORBIS_KERNEL_ERROR_UNKNOWN = 0x80020000;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EPERM = 0x80020001;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOENT = 0x80020002;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ESRCH = 0x80020003;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EINTR = 0x80020004;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EIO = 0x80020005;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENXIO = 0x80020006;
|
||||
constexpr int ORBIS_KERNEL_ERROR_E2BIG = 0x80020007;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOEXEC = 0x80020008;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EBADF = 0x80020009;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ECHILD = 0x8002000A;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EDEADLK = 0x8002000B;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOMEM = 0x8002000C;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EACCES = 0x8002000D;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EFAULT = 0x8002000E;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOTBLK = 0x8002000F;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EBUSY = 0x80020010;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EEXIST = 0x80020011;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EXDEV = 0x80020012;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENODEV = 0x80020013;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOTDIR = 0x80020014;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EISDIR = 0x80020015;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EINVAL = 0x80020016;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENFILE = 0x80020017;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EMFILE = 0x80020018;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOTTY = 0x80020019;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ETXTBSY = 0x8002001A;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EFBIG = 0x8002001B;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOSPC = 0x8002001C;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ESPIPE = 0x8002001D;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EROFS = 0x8002001E;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EMLINK = 0x8002001F;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EPIPE = 0x80020020;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EDOM = 0x80020021;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ERANGE = 0x80020022;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EAGAIN = 0x80020023;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EWOULDBLOCK = 0x80020023;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EINPROGRESS = 0x80020024;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EALREADY = 0x80020025;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOTSOCK = 0x80020026;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EDESTADDRREQ = 0x80020027;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EMSGSIZE = 0x80020028;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EPROTOTYPE = 0x80020029;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOPROTOOPT = 0x8002002A;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EPROTONOSUPPORT = 0x8002002B;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ESOCKTNOSUPPORT = 0x8002002C;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOTSUP = 0x8002002D;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EOPNOTSUPP = 0x8002002D;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EPFNOSUPPORT = 0x8002002E;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EAFNOSUPPORT = 0x8002002F;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EADDRINUSE = 0x80020030;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EADDRNOTAVAIL = 0x80020031;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENETDOWN = 0x80020032;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENETUNREACH = 0x80020033;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENETRESET = 0x80020034;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ECONNABORTED = 0x80020035;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ECONNRESET = 0x80020036;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOBUFS = 0x80020037;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EISCONN = 0x80020038;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOTCONN = 0x80020039;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ESHUTDOWN = 0x8002003A;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ETOOMANYREFS = 0x8002003B;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ETIMEDOUT = 0x8002003C;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ECONNREFUSED = 0x8002003D;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ELOOP = 0x8002003E;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENAMETOOLONG = 0x8002003F;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EHOSTDOWN = 0x80020040;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EHOSTUNREACH = 0x80020041;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOTEMPTY = 0x80020042;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EPROCLIM = 0x80020043;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EUSERS = 0x80020044;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EDQUOT = 0x80020045;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ESTALE = 0x80020046;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EREMOTE = 0x80020047;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EBADRPC = 0x80020048;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ERPCMISMATCH = 0x80020049;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EPROGUNAVAIL = 0x8002004A;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EPROGMISMATCH = 0x8002004B;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EPROCUNAVAIL = 0x8002004C;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOLCK = 0x8002004D;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOSYS = 0x8002004E;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EFTYPE = 0x8002004F;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EAUTH = 0x80020050;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENEEDAUTH = 0x80020051;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EIDRM = 0x80020052;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOMSG = 0x80020053;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EOVERFLOW = 0x80020054;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ECANCELED = 0x80020055;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EILSEQ = 0x80020056;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOATTR = 0x80020057;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EDOOFUS = 0x80020058;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EBADMSG = 0x80020059;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EMULTIHOP = 0x8002005A;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOLINK = 0x8002005B;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EPROTO = 0x8002005C;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOTCAPABLE = 0x8002005D;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ECAPMODE = 0x8002005E;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOBLK = 0x8002005F;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EICV = 0x80020060;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOPLAYGOENT = 0x80020061;
|
||||
|
||||
// AudioOut library
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_NOT_OPENED = 0x80260001;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_BUSY = 0x80260002;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_PORT = 0x80260003;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_POINTER = 0x80260004;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_PORT_FULL = 0x80260005;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_SIZE = 0x80260006;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_FORMAT = 0x80260007;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_SAMPLE_FREQ = 0x80260008;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_VOLUME = 0x80260009;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_PORT_TYPE = 0x8026000A;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_CONF_TYPE = 0x8026000C;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_OUT_OF_MEMORY = 0x8026000D;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_ALREADY_INIT = 0x8026000E;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_NOT_INIT = 0x8026000F;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_MEMORY = 0x80260010;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_SYSTEM_RESOURCE = 0x80260011;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_TRANS_EVENT = 0x80260012;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_FLAG = 0x80260013;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_MIXLEVEL = 0x80260014;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_ARG = 0x80260015;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_INVALID_PARAM = 0x80260016;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_MASTERING_FATAL = 0x80260200;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_MASTERING_INVALID_API_PARAM = 0x80260201;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_MASTERING_INVALID_CONFIG = 0x80260202;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_MASTERING_NOT_INITIALIZED = 0x80260203;
|
||||
constexpr int ORBIS_AUDIO_OUT_ERROR_MASTERING_INVALID_STATES_ID = 0x80260204;
|
||||
|
||||
// VideoOut library
|
||||
constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_VALUE = 0x80290001;
|
||||
constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_ADDRESS = 0x80290002;
|
||||
constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_PIXEL_FORMAT = 0x80290003;
|
||||
constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_PITCH = 0x80290004;
|
||||
constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_RESOLUTION = 0x80290005;
|
||||
constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_FLIP_MODE = 0x80290006;
|
||||
constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_TILING_MODE = 0x80290007;
|
||||
constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_ASPECT_RATIO = 0x80290008;
|
||||
constexpr int ORBIS_VIDEO_OUT_ERROR_RESOURCE_BUSY = 0x80290009;
|
||||
constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_INDEX = 0x8029000A;
|
||||
constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_HANDLE = 0x8029000B;
|
||||
constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_EVENT_QUEUE = 0x8029000C;
|
||||
constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_EVENT = 0x8029000D;
|
||||
constexpr int ORBIS_VIDEO_OUT_ERROR_NO_EMPTY_SLOT = 0x8029000F;
|
||||
constexpr int ORBIS_VIDEO_OUT_ERROR_SLOT_OCCUPIED = 0x80290010;
|
||||
constexpr int ORBIS_VIDEO_OUT_ERROR_FLIP_QUEUE_FULL = 0x80290012;
|
||||
constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_MEMORY = 0x80290013;
|
||||
constexpr int ORBIS_VIDEO_OUT_ERROR_MEMORY_NOT_PHYSICALLY_CONTIGUOUS = 0x80290014;
|
||||
constexpr int ORBIS_VIDEO_OUT_ERROR_MEMORY_INVALID_ALIGNMENT = 0x80290015;
|
||||
constexpr int ORBIS_VIDEO_OUT_ERROR_UNSUPPORTED_OUTPUT_MODE = 0x80290016;
|
||||
constexpr int ORBIS_VIDEO_OUT_ERROR_OVERFLOW = 0x80290017;
|
||||
constexpr int ORBIS_VIDEO_OUT_ERROR_NO_DEVICE = 0x80290018;
|
||||
constexpr int ORBIS_VIDEO_OUT_ERROR_UNAVAILABLE_OUTPUT_MODE = 0x80290019;
|
||||
constexpr int ORBIS_VIDEO_OUT_ERROR_INVALID_OPTION = 0x8029001A;
|
||||
constexpr int ORBIS_VIDEO_OUT_ERROR_UNKNOWN = 0x802900FE;
|
||||
constexpr int ORBIS_VIDEO_OUT_ERROR_FATAL = 0x802900FF;
|
||||
constexpr int ORBIS_VIDEO_OUT_ERROR_ENOMEM = 0x8029100C;
|
||||
|
||||
// Pad library
|
||||
constexpr int ORBIS_PAD_ERROR_INVALID_ARG = 0x80920001;
|
||||
constexpr int ORBIS_PAD_ERROR_INVALID_PORT = 0x80920002;
|
||||
constexpr int ORBIS_PAD_ERROR_INVALID_HANDLE = 0x80920003;
|
||||
constexpr int ORBIS_PAD_ERROR_ALREADY_OPENED = 0x80920004;
|
||||
constexpr int ORBIS_PAD_ERROR_NOT_INITIALIZED = 0x80920005;
|
||||
constexpr int ORBIS_PAD_ERROR_INVALID_LIGHTBAR_SETTING = 0x80920006;
|
||||
constexpr int ORBIS_PAD_ERROR_DEVICE_NOT_CONNECTED = 0x80920007;
|
||||
constexpr int ORBIS_PAD_ERROR_DEVICE_NO_HANDLE = 0x80920008;
|
||||
constexpr int ORBIS_PAD_ERROR_FATAL = 0x809200FF;
|
||||
constexpr int ORBIS_PAD_ERROR_NOT_PERMITTED = 0x80920101;
|
||||
constexpr int ORBIS_PAD_ERROR_INVALID_BUFFER_LENGTH = 0x80920102;
|
||||
constexpr int ORBIS_PAD_ERROR_INVALID_REPORT_LENGTH = 0x80920103;
|
||||
constexpr int ORBIS_PAD_ERROR_INVALID_REPORT_ID = 0x80920104;
|
||||
constexpr int ORBIS_PAD_ERROR_SEND_AGAIN = 0x80920105;
|
||||
|
||||
// UserService library
|
||||
constexpr int ORBIS_USER_SERVICE_ERROR_INTERNAL = 0x80960001;
|
||||
constexpr int ORBIS_USER_SERVICE_ERROR_NOT_INITIALIZED = 0x80960002;
|
||||
constexpr int ORBIS_USER_SERVICE_ERROR_ALREADY_INITIALIZED = 0x80960003;
|
||||
constexpr int ORBIS_USER_SERVICE_ERROR_NO_MEMORY = 0x80960004;
|
||||
constexpr int ORBIS_USER_SERVICE_ERROR_INVALID_ARGUMENT = 0x80960005;
|
||||
constexpr int ORBIS_USER_SERVICE_ERROR_OPERATION_NOT_SUPPORTED = 0x80960006;
|
||||
constexpr int ORBIS_USER_SERVICE_ERROR_NO_EVENT = 0x80960007;
|
||||
constexpr int ORBIS_USER_SERVICE_ERROR_NOT_LOGGED_IN = 0x80960009;
|
||||
constexpr int ORBIS_USER_SERVICE_ERROR_BUFFER_TOO_SHORT = 0x8096000A;
|
||||
|
||||
// SystemService library
|
||||
constexpr int ORBIS_SYSTEM_SERVICE_ERROR_PARAMETER = 0x80A10003;
|
||||
constexpr int ORBIS_SYSTEM_SERVICE_ERROR_NO_EVENT = 0x80A10004;
|
||||
|
||||
// NpTrophy library
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_UNKNOWN = 0x80551600;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_NOT_INITIALIZED = 0x80551601;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_ALREADY_INITIALIZED = 0x80551602;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_OUT_OF_MEMORY = 0x80551603;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_INVALID_ARGUMENT = 0x80551604;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_INSUFFICIENT_BUFFER = 0x80551605;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_EXCEEDS_MAX = 0x80551606;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_ABORT = 0x80551607;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_INVALID_HANDLE = 0x80551608;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_INVALID_CONTEXT = 0x80551609;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_INVALID_TROPHY_ID = 0x8055160A;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_INVALID_GROUP_ID = 0x8055160B;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_TROPHY_ALREADY_UNLOCKED = 0x8055160C;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_PLATINUM_CANNOT_UNLOCK = 0x8055160D;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_ACCOUNTID_NOT_MATCH = 0x8055160E;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_NOT_REGISTERED = 0x8055160F;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_ALREADY_REGISTERED = 0x80551610;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_BROKEN_DATA = 0x80551611;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_INSUFFICIENT_SPACE = 0x80551612;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_CONTEXT_ALREADY_EXISTS = 0x80551613;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_ICON_FILE_NOT_FOUND = 0x80551614;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_INVALID_TRP_FILE_FORMAT = 0x80551616;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_UNSUPPORTED_TRP_FILE = 0x80551617;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_INVALID_TROPHY_CONF_FORMAT = 0x80551618;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_UNSUPPORTED_TROPHY_CONF = 0x80551619;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_TROPHY_NOT_UNLOCKED = 0x8055161A;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_USER_NOT_FOUND = 0x8055161C;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_USER_NOT_LOGGED_IN = 0x8055161D;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_CONTEXT_USER_LOGOUT = 0x8055161E;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_USE_TRP_FOR_DEVELOPMENT = 0x8055161F;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_INVALID_NP_SERVICE_LABEL = 0x80551621;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_NOT_SUPPORTED = 0x80551622;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_CONTEXT_EXCEEDS_MAX = 0x80551623;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_HANDLE_EXCEEDS_MAX = 0x80551624;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_INVALID_USER_ID = 0x80551625;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_TITLE_CONF_NOT_INSTALLED = 0x80551626;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_BROKEN_TITLE_CONF = 0x80551627;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_INCONSISTENT_TITLE_CONF = 0x80551628;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_TITLE_BACKGROUND = 0x80551629;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_SCREENSHOT_DISABLED = 0x8055162B;
|
||||
constexpr int ORBIS_NP_TROPHY_ERROR_SCREENSHOT_DISPLAY_BUFFER_NOT_IN_USE = 0x8055162D;
|
||||
|
||||
// AvPlayer library
|
||||
constexpr int ORBIS_AVPLAYER_ERROR_INVALID_PARAMS = 0x806A0001;
|
||||
constexpr int ORBIS_AVPLAYER_ERROR_OPERATION_FAILED = 0x806A0002;
|
||||
constexpr int ORBIS_AVPLAYER_ERROR_NO_MEMORY = 0x806A0003;
|
||||
constexpr int ORBIS_AVPLAYER_ERROR_NOT_SUPPORTED = 0x806A0004;
|
||||
constexpr int ORBIS_AVPLAYER_ERROR_WAR_FILE_NONINTERLEAVED = 0x806A00A0;
|
||||
constexpr int ORBIS_AVPLAYER_ERROR_WAR_LOOPING_BACK = 0x806A00A1;
|
||||
constexpr int ORBIS_AVPLAYER_ERROR_WAR_JUMP_COMPLETE = 0x806A00A3;
|
||||
constexpr int ORBIS_AVPLAYER_ERROR_INFO_MARLIN_ENCRY = 0x806A00B0;
|
||||
constexpr int ORBIS_AVPLAYER_ERROR_INFO_PLAYREADY_ENCRY = 0x806A00B4;
|
||||
constexpr int ORBIS_AVPLAYER_ERROR_INFO_AES_ENCRY = 0x806A00B5;
|
||||
constexpr int ORBIS_AVPLAYER_ERROR_INFO_OTHER_ENCRY = 0x806A00BF;
|
||||
|
||||
// AppContent library
|
||||
constexpr int ORBIS_APP_CONTENT_ERROR_PARAMETER = 0x80D90002;
|
||||
constexpr int ORBIS_APP_CONTENT_ERROR_DRM_NO_ENTITLEMENT = 0x80D90007;
|
||||
constexpr int ORBIS_APP_CONTENT_ERROR_NOT_FOUND = 0x80D90005;
|
||||
|
||||
// Fiber library
|
||||
constexpr int ORBIS_FIBER_ERROR_NULL = 0x80590001;
|
||||
constexpr int ORBIS_FIBER_ERROR_ALIGNMENT = 0x80590002;
|
||||
constexpr int ORBIS_FIBER_ERROR_RANGE = 0x80590003;
|
||||
constexpr int ORBIS_FIBER_ERROR_INVALID = 0x80590004;
|
||||
constexpr int ORBIS_FIBER_ERROR_PERMISSION = 0x80590005;
|
||||
constexpr int ORBIS_FIBER_ERROR_STATE = 0x80590006;
|
||||
|
||||
// ImeDialog library
|
||||
constexpr int ORBIS_ERROR_DIALOG_ERROR_NOT_INITIALIZED = 0x80ED0001;
|
||||
constexpr int ORBIS_ERROR_DIALOG_ERROR_ALREADY_INITIALIZED = 0x80ED0002;
|
||||
constexpr int ORBIS_ERROR_DIALOG_ERROR_PARAM_INVALID = 0x80ED0003;
|
||||
constexpr int ORBIS_ERROR_DIALOG_ERROR_UNEXPECTED_FATAL = 0x80ED0004;
|
||||
constexpr int ORBIS_ERROR_DIALOG_ERROR_INVALID_STATE = 0x80ED0005;
|
||||
constexpr int ORBIS_ERROR_DIALOG_ERROR_SERVICE_BUSY = 0x80ED0006;
|
||||
constexpr int ORBIS_ERROR_DIALOG_ERROR_INVALID_USER_ID = 0x80ED0007;
|
||||
|
||||
// Ime library
|
||||
constexpr int ORBIS_IME_ERROR_BUSY = 0x80BC0001;
|
||||
constexpr int ORBIS_IME_ERROR_NOT_OPENED = 0x80BC0002;
|
||||
constexpr int ORBIS_IME_ERROR_NO_MEMORY = 0x80BC0003;
|
||||
constexpr int ORBIS_IME_ERROR_CONNECTION_FAILED = 0x80BC0004;
|
||||
constexpr int ORBIS_IME_ERROR_TOO_MANY_REQUESTS = 0x80BC0005;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_TEXT = 0x80BC0006;
|
||||
constexpr int ORBIS_IME_ERROR_EVENT_OVERFLOW = 0x80BC0007;
|
||||
constexpr int ORBIS_IME_ERROR_NOT_ACTIVE = 0x80BC0008;
|
||||
constexpr int ORBIS_IME_ERROR_IME_SUSPENDING = 0x80BC0009;
|
||||
constexpr int ORBIS_IME_ERROR_DEVICE_IN_USE = 0x80BC000A;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_USER_ID = 0x80BC0010;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_TYPE = 0x80BC0011;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_SUPPORTED_LANGUAGES = 0x80BC0012;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_ENTER_LABEL = 0x80BC0013;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_INPUT_METHOD = 0x80BC0014;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_OPTION = 0x80BC0015;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_MAX_TEXT_LENGTH = 0x80BC0016;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_INPUT_TEXT_BUFFER = 0x80BC0017;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_POSX = 0x80BC0018;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_POSY = 0x80BC0019;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_HORIZONTAL_ALIGNMENT = 0x80BC001A;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_VERTICAL_ALIGNMENT = 0x80BC001B;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_EXTENDED = 0x80BC001C;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_KEYBOARD_TYPE = 0x80BC001D;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_WORK = 0x80BC0020;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_ARG = 0x80BC0021;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_HANDLER = 0x80BC0022;
|
||||
constexpr int ORBIS_IME_ERROR_NO_RESOURCE_ID = 0x80BC0023;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_MODE = 0x80BC0024;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_PARAM = 0x80BC0030;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_ADDRESS = 0x80BC0031;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_RESERVED = 0x80BC0032;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_TIMING = 0x80BC0033;
|
||||
constexpr int ORBIS_IME_ERROR_INTERNAL = 0x80BC00FF;
|
||||
|
||||
// Videodec2 library
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_API_FAIL = 0x811D0100;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_STRUCT_SIZE = 0x811D0101;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_ARGUMENT_POINTER = 0x811D0102;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_DECODER_INSTANCE = 0x811D0103;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_MEMORY_SIZE = 0x811D0104;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_MEMORY_POINTER = 0x811D0105;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_FRAME_BUFFER_SIZE = 0x811D0106;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_FRAME_BUFFER_POINTER = 0x811D0107;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_FRAME_BUFFER_ALIGNMENT = 0x811D0108;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_NOT_ONION_MEMORY = 0x811D0109;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_NOT_GARLIC_MEMORY = 0x811D010A;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_NOT_DIRECT_MEMORY = 0x811D010B;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_MEMORY_INFO = 0x811D010C;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_ACCESS_UNIT_SIZE = 0x811D010D;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_ACCESS_UNIT_POINTER = 0x811D010E;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_OUTPUT_INFO = 0x811D010F;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_COMPUTE_QUEUE = 0x811D0110;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_FATAL_STATE = 0x811D0111;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_PRESET_VALUE = 0x811D0112;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_CONFIG_INFO = 0x811D0200;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_COMPUTE_PIPE_ID = 0x811D0201;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_COMPUTE_QUEUE_ID = 0x811D0202;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_RESOURCE_TYPE = 0x811D0203;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_CODEC_TYPE = 0x811D0204;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_PROFILE_LEVEL = 0x811D0205;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_PIPELINE_DEPTH = 0x811D0206;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_AFFINITY_MASK = 0x811D0207;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_THREAD_PRIORITY = 0x811D0208;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_DPB_FRAME_COUNT = 0x811D0209;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_FRAME_WIDTH_HEIGHT = 0x811D020A;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_EXTRA_CONFIG_INFO = 0x811D020B;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_NEW_SEQUENCE = 0x811D0300;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_ACCESS_UNIT = 0x811D0301;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_OVERSIZE_DECODE = 0x811D0302;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_INVALID_SEQUENCE = 0x811D0303;
|
||||
constexpr int ORBIS_VIDEODEC2_ERROR_FATAL_STREAM = 0x811D0304;
|
||||
|
||||
// Videodec library
|
||||
constexpr int ORBIS_VIDEODEC_ERROR_API_FAIL = 0x80C10000;
|
||||
constexpr int ORBIS_VIDEODEC_ERROR_CODEC_TYPE = 0x80C10001;
|
||||
constexpr int ORBIS_VIDEODEC_ERROR_STRUCT_SIZE = 0x80C10002;
|
||||
constexpr int ORBIS_VIDEODEC_ERROR_HANDLE = 0x80C10003;
|
||||
constexpr int ORBIS_VIDEODEC_ERROR_CPU_MEMORY_SIZE = 0x80C10004;
|
||||
constexpr int ORBIS_VIDEODEC_ERROR_CPU_MEMORY_POINTER = 0x80C10005;
|
||||
constexpr int ORBIS_VIDEODEC_ERROR_CPU_GPU_MEMORY_SIZE = 0x80C10006;
|
||||
constexpr int ORBIS_VIDEODEC_ERROR_CPU_GPU_MEMORY_POINTER = 0x80C10007;
|
||||
constexpr int ORBIS_VIDEODEC_ERROR_SHADER_CONTEXT_POINTER = 0x80C10008;
|
||||
constexpr int ORBIS_VIDEODEC_ERROR_AU_SIZE = 0x80C10009;
|
||||
constexpr int ORBIS_VIDEODEC_ERROR_AU_POINTER = 0x80C1000A;
|
||||
constexpr int ORBIS_VIDEODEC_ERROR_FRAME_BUFFER_SIZE = 0x80C1000B;
|
||||
constexpr int ORBIS_VIDEODEC_ERROR_FRAME_BUFFER_POINTER = 0x80C1000C;
|
||||
constexpr int ORBIS_VIDEODEC_ERROR_FRAME_BUFFER_ALIGNMENT = 0x80C1000D;
|
||||
constexpr int ORBIS_VIDEODEC_ERROR_CONFIG_INFO = 0x80C1000E;
|
||||
constexpr int ORBIS_VIDEODEC_ERROR_ARGUMENT_POINTER = 0x80C1000F;
|
||||
constexpr int ORBIS_VIDEODEC_ERROR_NEW_SEQUENCE = 0x80C10010;
|
||||
constexpr int ORBIS_VIDEODEC_ERROR_DECODE_AU = 0x80C10011;
|
||||
constexpr int ORBIS_VIDEODEC_ERROR_MISMATCH_SPEC = 0x80C10012;
|
||||
constexpr int ORBIS_VIDEODEC_ERROR_INVALID_SEQUENCE = 0x80C10013;
|
||||
constexpr int ORBIS_VIDEODEC_ERROR_FATAL_STREAM = 0x80C10014;
|
||||
constexpr int ORBIS_VIDEODEC_ERROR_FATAL_STATE = 0x80C10015;
|
||||
|
||||
// PngDec library
|
||||
constexpr int ORBIS_PNG_DEC_ERROR_INVALID_ADDR = 0x80690001;
|
||||
constexpr int ORBIS_PNG_DEC_ERROR_INVALID_SIZE = 0x80690002;
|
||||
constexpr int ORBIS_PNG_DEC_ERROR_INVALID_PARAM = 0x80690003;
|
||||
constexpr int ORBIS_PNG_DEC_ERROR_INVALID_HANDLE = 0x80690004;
|
||||
constexpr int ORBIS_PNG_DEC_ERROR_INVALID_WORK_MEMORY = 0x80690005;
|
||||
constexpr int ORBIS_PNG_DEC_ERROR_INVALID_DATA = 0x80690010;
|
||||
constexpr int ORBIS_PNG_DEC_ERROR_UNSUPPORT_DATA = 0x80690011;
|
||||
constexpr int ORBIS_PNG_DEC_ERROR_DECODE_ERROR = 0x80690012;
|
||||
constexpr int ORBIS_PNG_DEC_ERROR_FATAL = 0x80690020;
|
|
@ -4,7 +4,7 @@
|
|||
#include "fiber.h"
|
||||
|
||||
#include "common/logging/log.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/fiber/fiber_error.h"
|
||||
#include "core/libraries/libs.h"
|
||||
#include "core/tls.h"
|
||||
|
||||
|
|
|
@ -26,17 +26,12 @@ struct SceFiber {
|
|||
u64 signature;
|
||||
FiberState state;
|
||||
SceFiberEntry entry;
|
||||
|
||||
u64 argOnInitialize;
|
||||
|
||||
u64 argRun;
|
||||
u64* pArgRun;
|
||||
|
||||
u64 argReturn;
|
||||
u64* pArgReturn;
|
||||
|
||||
u64 sizeContext;
|
||||
|
||||
char name[ORBIS_FIBER_MAX_NAME_LENGTH];
|
||||
void* handle;
|
||||
};
|
||||
|
@ -53,7 +48,7 @@ struct SceFiberInfo {
|
|||
};
|
||||
static_assert(sizeof(SceFiberInfo) <= 128);
|
||||
|
||||
typedef void* SceFiberOptParam;
|
||||
using SceFiberOptParam = void*;
|
||||
|
||||
s32 PS4_SYSV_ABI sceFiberInitialize(SceFiber* fiber, const char* name, SceFiberEntry entry,
|
||||
u64 argOnInitialize, void* addrContext, u64 sizeContext,
|
||||
|
|
14
src/core/libraries/fiber/fiber_error.h
Normal file
14
src/core/libraries/fiber/fiber_error.h
Normal file
|
@ -0,0 +1,14 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/libraries/error_codes.h"
|
||||
|
||||
// Fiber library
|
||||
constexpr int ORBIS_FIBER_ERROR_NULL = 0x80590001;
|
||||
constexpr int ORBIS_FIBER_ERROR_ALIGNMENT = 0x80590002;
|
||||
constexpr int ORBIS_FIBER_ERROR_RANGE = 0x80590003;
|
||||
constexpr int ORBIS_FIBER_ERROR_INVALID = 0x80590004;
|
||||
constexpr int ORBIS_FIBER_ERROR_PERMISSION = 0x80590005;
|
||||
constexpr int ORBIS_FIBER_ERROR_STATE = 0x80590006;
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "core/libraries/error_codes.h"
|
||||
|
||||
constexpr int ORBIS_GNM_ERROR_SUBMISSION_FAILED_INVALID_ARGUMENT = 0x80D11000;
|
||||
constexpr int ORBIS_GNM_ERROR_SUBMISSION_NOT_ENOUGH_RESOURCES = 0x80D11001;
|
||||
constexpr int ORBIS_GNM_ERROR_SUBMISSION_AND_FLIP_FAILED_INVALID_COMMAND_BUFFER = 0x80D11080;
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
#include "common/slot_vector.h"
|
||||
#include "core/address_space.h"
|
||||
#include "core/debug_state.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/gnmdriver/gnm_error.h"
|
||||
#include "core/libraries/kernel/orbis_error.h"
|
||||
#include "core/libraries/kernel/process.h"
|
||||
#include "core/libraries/libs.h"
|
||||
#include "core/libraries/videoout/video_out.h"
|
||||
|
|
|
@ -2,14 +2,12 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <queue>
|
||||
#include "ime.h"
|
||||
#include "ime_ui.h"
|
||||
|
||||
#include "common/logging/log.h"
|
||||
#include "common/singleton.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/ime/ime.h"
|
||||
#include "core/libraries/ime/ime_error.h"
|
||||
#include "core/libraries/ime/ime_ui.h"
|
||||
#include "core/libraries/libs.h"
|
||||
#include "core/linker.h"
|
||||
#include "core/tls.h"
|
||||
|
||||
namespace Libraries::Ime {
|
||||
|
||||
|
@ -37,7 +35,7 @@ public:
|
|||
|
||||
// Open an event to let the game know the IME has started
|
||||
OrbisImeEvent openEvent{};
|
||||
openEvent.id = (ime_mode ? OrbisImeEventId::OPEN : OrbisImeEventId::KEYBOARD_OPEN);
|
||||
openEvent.id = (ime_mode ? OrbisImeEventId::Open : OrbisImeEventId::KeyboardOpen);
|
||||
|
||||
if (ime_mode) {
|
||||
sceImeGetPanelSize(&m_param.ime, &openEvent.param.rect.width,
|
||||
|
@ -45,8 +43,8 @@ public:
|
|||
openEvent.param.rect.x = m_param.ime.posx;
|
||||
openEvent.param.rect.y = m_param.ime.posy;
|
||||
} else {
|
||||
openEvent.param.resourceIdArray.userId = 1;
|
||||
openEvent.param.resourceIdArray.resourceId[0] = 1;
|
||||
openEvent.param.resource_id_array.userId = 1;
|
||||
openEvent.param.resource_id_array.resource_id[0] = 1;
|
||||
}
|
||||
|
||||
// Are we supposed to call the event handler on init with
|
||||
|
@ -232,15 +230,15 @@ s32 PS4_SYSV_ABI sceImeGetPanelSize(const OrbisImeParam* param, u32* width, u32*
|
|||
}
|
||||
|
||||
switch (param->type) {
|
||||
case OrbisImeType::DEFAULT:
|
||||
case OrbisImeType::BASIC_LATIN:
|
||||
case OrbisImeType::URL:
|
||||
case OrbisImeType::MAIL:
|
||||
case OrbisImeType::Default:
|
||||
case OrbisImeType::BasicLatin:
|
||||
case OrbisImeType::Url:
|
||||
case OrbisImeType::Mail:
|
||||
// We set our custom sizes, commented sizes are the original ones
|
||||
*width = 500; // 793
|
||||
*height = 100; // 408
|
||||
break;
|
||||
case OrbisImeType::NUMBER:
|
||||
case OrbisImeType::Number:
|
||||
*width = 370;
|
||||
*height = 402;
|
||||
break;
|
||||
|
@ -326,7 +324,7 @@ void PS4_SYSV_ABI sceImeParamInit(OrbisImeParam* param) {
|
|||
}
|
||||
|
||||
memset(param, 0, sizeof(OrbisImeParam));
|
||||
param->userId = -1;
|
||||
param->user_id = -1;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceImeSetCandidateIndex() {
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "common/enum.h"
|
||||
#include "common/types.h"
|
||||
|
||||
#include "ime_common.h"
|
||||
#include "core/libraries/ime/ime_common.h"
|
||||
|
||||
namespace Core::Loader {
|
||||
class SymbolsResolver;
|
||||
|
@ -16,13 +16,13 @@ namespace Libraries::Ime {
|
|||
constexpr u32 ORBIS_IME_MAX_TEXT_LENGTH = 2048;
|
||||
|
||||
enum class OrbisImeKeyboardOption : u32 {
|
||||
DEFAULT = 0,
|
||||
REPEAT = 1,
|
||||
REPEAT_EACH_KEY = 2,
|
||||
ADD_OSK = 4,
|
||||
EFFECTIVE_WITH_TIME = 8,
|
||||
DISABLE_RESUME = 16,
|
||||
DISABLE_CAPSLOCK_WITHOUT_SHIFT = 32,
|
||||
Default = 0,
|
||||
Repeat = 1,
|
||||
RepeatEachKey = 2,
|
||||
AddOsk = 4,
|
||||
EffectiveWithTime = 8,
|
||||
DisableResume = 16,
|
||||
DisableCapslockWithoutShift = 32,
|
||||
};
|
||||
DECLARE_ENUM_FLAG_OPERATORS(OrbisImeKeyboardOption)
|
||||
|
||||
|
@ -53,19 +53,19 @@ struct OrbisImeKeyboardParam {
|
|||
};
|
||||
|
||||
struct OrbisImeParam {
|
||||
s32 userId;
|
||||
s32 user_id;
|
||||
OrbisImeType type;
|
||||
u64 supportedLanguages;
|
||||
OrbisImeEnterLabel enterLabel;
|
||||
OrbisImeInputMethod inputMethod;
|
||||
u64 supported_languages;
|
||||
OrbisImeEnterLabel enter_label;
|
||||
OrbisImeInputMethod input_method;
|
||||
OrbisImeTextFilter filter;
|
||||
OrbisImeOption option;
|
||||
u32 maxTextLength;
|
||||
char16_t* inputTextBuffer;
|
||||
float posx;
|
||||
float posy;
|
||||
OrbisImeHorizontalAlignment horizontalAlignment;
|
||||
OrbisImeVerticalAlignment verticalAlignment;
|
||||
OrbisImeHorizontalAlignment horizontal_alignment;
|
||||
OrbisImeVerticalAlignment vertical_alignment;
|
||||
void* work;
|
||||
void* arg;
|
||||
OrbisImeEventHandler handler;
|
||||
|
@ -135,4 +135,5 @@ int PS4_SYSV_ABI sceImeVshUpdateContext();
|
|||
int PS4_SYSV_ABI sceImeVshUpdateContext2();
|
||||
|
||||
void RegisterlibSceIme(Core::Loader::SymbolsResolver* sym);
|
||||
} // namespace Libraries::Ime
|
||||
|
||||
} // namespace Libraries::Ime
|
||||
|
|
|
@ -2,65 +2,64 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
#include <sys/types.h>
|
||||
#include "common/enum.h"
|
||||
|
||||
#include "common/types.h"
|
||||
#include "core/libraries/rtc/rtc.h"
|
||||
|
||||
enum class OrbisImeType : u32 {
|
||||
DEFAULT = 0,
|
||||
BASIC_LATIN = 1,
|
||||
URL = 2,
|
||||
MAIL = 3,
|
||||
NUMBER = 4,
|
||||
Default = 0,
|
||||
BasicLatin = 1,
|
||||
Url = 2,
|
||||
Mail = 3,
|
||||
Number = 4,
|
||||
};
|
||||
|
||||
enum class OrbisImeHorizontalAlignment : u32 {
|
||||
LEFT = 0,
|
||||
CENTER = 1,
|
||||
RIGHT = 2,
|
||||
Left = 0,
|
||||
Center = 1,
|
||||
Right = 2,
|
||||
};
|
||||
|
||||
enum class OrbisImeVerticalAlignment : u32 {
|
||||
TOP = 0,
|
||||
CENTER = 1,
|
||||
BOTTOM = 2,
|
||||
Top = 0,
|
||||
Center = 1,
|
||||
Bottom = 2,
|
||||
};
|
||||
|
||||
enum class OrbisImeEnterLabel : u32 {
|
||||
DEFAULT = 0,
|
||||
SEND = 1,
|
||||
SEARCH = 2,
|
||||
GO = 3,
|
||||
Default = 0,
|
||||
Send = 1,
|
||||
Search = 2,
|
||||
Go = 3,
|
||||
};
|
||||
|
||||
enum class OrbisImeInputMethod : u32 {
|
||||
DEFAULT = 0,
|
||||
Default = 0,
|
||||
};
|
||||
|
||||
enum class OrbisImeEventId : u32 {
|
||||
OPEN = 0,
|
||||
UPDATE_TEXT = 1,
|
||||
UPDATE_CARET = 2,
|
||||
PRESS_CLOSE = 4,
|
||||
PRESS_ENTER = 5,
|
||||
ABORT = 6,
|
||||
CANDIDATE_LIST_START = 7,
|
||||
CANDIDATE_LIST_END = 8,
|
||||
CANDIDATE_WORD = 9,
|
||||
CANDIDATE_INDEX = 10,
|
||||
CANDIDATE_DONE = 11,
|
||||
CANDIDATE_CANCEL = 12,
|
||||
CHANGE_DEVICE = 14,
|
||||
CHANGE_INPUT_METHOD_STATE = 18,
|
||||
Open = 0,
|
||||
UpdateText = 1,
|
||||
UpdateCaret = 2,
|
||||
PressClose = 4,
|
||||
PressEnter = 5,
|
||||
Abort = 6,
|
||||
CandidateListStart = 7,
|
||||
CandidateListEnd = 8,
|
||||
CandidateWord = 9,
|
||||
CandidateIndex = 10,
|
||||
CandidateDone = 11,
|
||||
CandidateCancel = 12,
|
||||
ChangeDevice = 14,
|
||||
ChangeInputMethodState = 18,
|
||||
|
||||
KEYBOARD_OPEN = 256,
|
||||
KEYBOARD_KEYCODE_DOWN = 257,
|
||||
KEYBOARD_KEYCODE_UP = 258,
|
||||
KEYBOARD_KEYCODE_REPEAT = 259,
|
||||
KEYBOARD_CONNECTION = 260,
|
||||
KEYBOARD_DISCONNECTION = 261,
|
||||
KEYBOARD_ABORT = 262,
|
||||
KeyboardOpen = 256,
|
||||
KeyboardKeycodeDoen = 257,
|
||||
KeyboardKeycodeUp = 258,
|
||||
KeyboardKeycodeRepeat = 259,
|
||||
KeyboardConnection = 260,
|
||||
KeyboardDisconnection = 261,
|
||||
KeyboardAbort = 262,
|
||||
};
|
||||
|
||||
enum class OrbisImeKeyboardType : u32 {
|
||||
|
@ -105,10 +104,10 @@ enum class OrbisImeKeyboardType : u32 {
|
|||
};
|
||||
|
||||
enum class OrbisImeDeviceType : u32 {
|
||||
NONE = 0,
|
||||
CONTROLLER = 1,
|
||||
EXT_KEYBOARD = 2,
|
||||
REMOTE_OSK = 3,
|
||||
None = 0,
|
||||
Controller = 1,
|
||||
ExtKeyboard = 2,
|
||||
RemoteOsk = 3,
|
||||
};
|
||||
|
||||
struct OrbisImeRect {
|
||||
|
@ -126,9 +125,9 @@ struct OrbisImeTextAreaProperty {
|
|||
|
||||
struct OrbisImeEditText {
|
||||
char16_t* str;
|
||||
u32 caretIndex;
|
||||
u32 areaNum;
|
||||
OrbisImeTextAreaProperty textArea[4];
|
||||
u32 caret_index;
|
||||
u32 area_num;
|
||||
OrbisImeTextAreaProperty text_area[4];
|
||||
};
|
||||
|
||||
struct OrbisImeKeycode {
|
||||
|
@ -136,8 +135,8 @@ struct OrbisImeKeycode {
|
|||
char16_t character;
|
||||
u32 status;
|
||||
OrbisImeKeyboardType type;
|
||||
s32 userId;
|
||||
u32 resourceId;
|
||||
s32 user_id;
|
||||
u32 resource_id;
|
||||
Libraries::Rtc::OrbisRtcTick timestamp;
|
||||
};
|
||||
|
||||
|
@ -147,29 +146,29 @@ struct OrbisImeKeyboardResourceIdArray {
|
|||
};
|
||||
|
||||
enum class OrbisImeCaretMovementDirection : u32 {
|
||||
STILL = 0,
|
||||
LEFT = 1,
|
||||
RIGHT = 2,
|
||||
UP = 3,
|
||||
DOWN = 4,
|
||||
HOME = 5,
|
||||
END = 6,
|
||||
PAGE_UP = 7,
|
||||
PAGE_DOWN = 8,
|
||||
TOP = 9,
|
||||
BOTTOM = 10,
|
||||
Still = 0,
|
||||
Left = 1,
|
||||
Right = 2,
|
||||
Up = 3,
|
||||
Down = 4,
|
||||
Home = 5,
|
||||
End = 6,
|
||||
PageUp = 7,
|
||||
PageDown = 8,
|
||||
Top = 9,
|
||||
Bottom = 10,
|
||||
};
|
||||
|
||||
union OrbisImeEventParam {
|
||||
OrbisImeRect rect;
|
||||
OrbisImeEditText text;
|
||||
OrbisImeCaretMovementDirection caretMove;
|
||||
OrbisImeCaretMovementDirection caret_move;
|
||||
OrbisImeKeycode keycode;
|
||||
OrbisImeKeyboardResourceIdArray resourceIdArray;
|
||||
char16_t* candidateWord;
|
||||
s32 candidateIndex;
|
||||
OrbisImeDeviceType deviceType;
|
||||
u32 inputMethodState;
|
||||
OrbisImeKeyboardResourceIdArray resource_id_array;
|
||||
char16_t* candidate_word;
|
||||
s32 candidate_index;
|
||||
OrbisImeDeviceType device_type;
|
||||
u32 input_method_state;
|
||||
s8 reserved[64];
|
||||
};
|
||||
|
||||
|
@ -178,7 +177,7 @@ struct OrbisImeEvent {
|
|||
OrbisImeEventParam param;
|
||||
};
|
||||
|
||||
typedef PS4_SYSV_ABI int (*OrbisImeTextFilter)(char16_t* outText, u32* outTextLength,
|
||||
const char16_t* srcText, u32 srcTextLength);
|
||||
using OrbisImeTextFilter = PS4_SYSV_ABI int (*)(char16_t* outText, u32* outTextLength,
|
||||
const char16_t* srcText, u32 srcTextLength);
|
||||
|
||||
typedef PS4_SYSV_ABI void (*OrbisImeEventHandler)(void* arg, const OrbisImeEvent* e);
|
||||
using OrbisImeEventHandler = PS4_SYSV_ABI void (*)(void* arg, const OrbisImeEvent* e);
|
||||
|
|
|
@ -14,24 +14,24 @@ static constexpr std::array<float, 2> MAX_Y_POSITIONS = {2160.0f, 1080.0f};
|
|||
|
||||
namespace Libraries::ImeDialog {
|
||||
|
||||
static OrbisImeDialogStatus g_ime_dlg_status = OrbisImeDialogStatus::NONE;
|
||||
static OrbisImeDialogStatus g_ime_dlg_status = OrbisImeDialogStatus::None;
|
||||
static OrbisImeDialogResult g_ime_dlg_result{};
|
||||
static ImeDialogState g_ime_dlg_state{};
|
||||
static ImeDialogUi g_ime_dlg_ui;
|
||||
|
||||
static bool IsValidOption(OrbisImeDialogOption option, OrbisImeType type) {
|
||||
if (False(~option &
|
||||
(OrbisImeDialogOption::MULTILINE | OrbisImeDialogOption::NO_AUTO_COMPLETION))) {
|
||||
(OrbisImeDialogOption::Multiline | OrbisImeDialogOption::NoAutoCompletion))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (True(option & OrbisImeDialogOption::MULTILINE) && type != OrbisImeType::DEFAULT &&
|
||||
type != OrbisImeType::BASIC_LATIN) {
|
||||
if (True(option & OrbisImeDialogOption::Multiline) && type != OrbisImeType::Default &&
|
||||
type != OrbisImeType::BasicLatin) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (True(option & OrbisImeDialogOption::NO_AUTO_COMPLETION) && type != OrbisImeType::NUMBER &&
|
||||
type != OrbisImeType::BASIC_LATIN) {
|
||||
if (True(option & OrbisImeDialogOption::NoAutoCompletion) && type != OrbisImeType::Number &&
|
||||
type != OrbisImeType::BasicLatin) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -39,29 +39,29 @@ static bool IsValidOption(OrbisImeDialogOption option, OrbisImeType type) {
|
|||
}
|
||||
|
||||
Error PS4_SYSV_ABI sceImeDialogAbort() {
|
||||
if (g_ime_dlg_status == OrbisImeDialogStatus::NONE) {
|
||||
if (g_ime_dlg_status == OrbisImeDialogStatus::None) {
|
||||
LOG_INFO(Lib_ImeDialog, "IME dialog not in use");
|
||||
return Error::DIALOG_NOT_IN_USE;
|
||||
}
|
||||
|
||||
if (g_ime_dlg_status != OrbisImeDialogStatus::RUNNING) {
|
||||
if (g_ime_dlg_status != OrbisImeDialogStatus::Running) {
|
||||
LOG_INFO(Lib_ImeDialog, "IME dialog not running");
|
||||
return Error::DIALOG_NOT_RUNNING;
|
||||
}
|
||||
|
||||
g_ime_dlg_status = OrbisImeDialogStatus::FINISHED;
|
||||
g_ime_dlg_result.endstatus = OrbisImeDialogEndStatus::ABORTED;
|
||||
g_ime_dlg_status = OrbisImeDialogStatus::Finished;
|
||||
g_ime_dlg_result.endstatus = OrbisImeDialogEndStatus::Aborted;
|
||||
|
||||
return Error::OK;
|
||||
}
|
||||
|
||||
Error PS4_SYSV_ABI sceImeDialogForceClose() {
|
||||
if (g_ime_dlg_status == OrbisImeDialogStatus::NONE) {
|
||||
if (g_ime_dlg_status == OrbisImeDialogStatus::None) {
|
||||
LOG_INFO(Lib_ImeDialog, "IME dialog not in use");
|
||||
return Error::DIALOG_NOT_IN_USE;
|
||||
}
|
||||
|
||||
g_ime_dlg_status = OrbisImeDialogStatus::NONE;
|
||||
g_ime_dlg_status = OrbisImeDialogStatus::None;
|
||||
g_ime_dlg_ui = ImeDialogUi();
|
||||
g_ime_dlg_state = ImeDialogState();
|
||||
|
||||
|
@ -93,7 +93,7 @@ int PS4_SYSV_ABI sceImeDialogGetPanelSizeExtended() {
|
|||
}
|
||||
|
||||
Error PS4_SYSV_ABI sceImeDialogGetResult(OrbisImeDialogResult* result) {
|
||||
if (g_ime_dlg_status == OrbisImeDialogStatus::NONE) {
|
||||
if (g_ime_dlg_status == OrbisImeDialogStatus::None) {
|
||||
LOG_INFO(Lib_ImeDialog, "IME dialog is not running");
|
||||
return Error::DIALOG_NOT_IN_USE;
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ Error PS4_SYSV_ABI sceImeDialogGetResult(OrbisImeDialogResult* result) {
|
|||
|
||||
result->endstatus = g_ime_dlg_result.endstatus;
|
||||
|
||||
if (g_ime_dlg_status == OrbisImeDialogStatus::RUNNING) {
|
||||
if (g_ime_dlg_status == OrbisImeDialogStatus::Running) {
|
||||
return Error::DIALOG_NOT_FINISHED;
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ Error PS4_SYSV_ABI sceImeDialogGetResult(OrbisImeDialogResult* result) {
|
|||
}
|
||||
|
||||
OrbisImeDialogStatus PS4_SYSV_ABI sceImeDialogGetStatus() {
|
||||
if (g_ime_dlg_status == OrbisImeDialogStatus::RUNNING) {
|
||||
if (g_ime_dlg_status == OrbisImeDialogStatus::Running) {
|
||||
g_ime_dlg_state.CallTextFilter();
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ OrbisImeDialogStatus PS4_SYSV_ABI sceImeDialogGetStatus() {
|
|||
}
|
||||
|
||||
Error PS4_SYSV_ABI sceImeDialogInit(OrbisImeDialogParam* param, OrbisImeParamExtended* extended) {
|
||||
if (g_ime_dlg_status != OrbisImeDialogStatus::NONE) {
|
||||
if (g_ime_dlg_status != OrbisImeDialogStatus::None) {
|
||||
LOG_INFO(Lib_ImeDialog, "IME dialog is already running");
|
||||
return Error::BUSY;
|
||||
}
|
||||
|
@ -142,24 +142,24 @@ Error PS4_SYSV_ABI sceImeDialogInit(OrbisImeDialogParam* param, OrbisImeParamExt
|
|||
|
||||
if (param->posx < 0.0f ||
|
||||
param->posx >=
|
||||
MAX_X_POSITIONS[False(param->option & OrbisImeDialogOption::LARGE_RESOLUTION)]) {
|
||||
MAX_X_POSITIONS[False(param->option & OrbisImeDialogOption::LargeResolution)]) {
|
||||
LOG_INFO(Lib_ImeDialog, "Invalid param->posx");
|
||||
return Error::INVALID_POSX;
|
||||
}
|
||||
|
||||
if (param->posy < 0.0f ||
|
||||
param->posy >=
|
||||
MAX_Y_POSITIONS[False(param->option & OrbisImeDialogOption::LARGE_RESOLUTION)]) {
|
||||
MAX_Y_POSITIONS[False(param->option & OrbisImeDialogOption::LargeResolution)]) {
|
||||
LOG_INFO(Lib_ImeDialog, "Invalid param->posy");
|
||||
return Error::INVALID_POSY;
|
||||
}
|
||||
|
||||
if (!magic_enum::enum_contains(param->horizontalAlignment)) {
|
||||
if (!magic_enum::enum_contains(param->horizontal_alignment)) {
|
||||
LOG_INFO(Lib_ImeDialog, "Invalid param->horizontalAlignment");
|
||||
return Error::INVALID_HORIZONTALIGNMENT;
|
||||
}
|
||||
|
||||
if (!magic_enum::enum_contains(param->verticalAlignment)) {
|
||||
if (!magic_enum::enum_contains(param->vertical_alignment)) {
|
||||
LOG_INFO(Lib_ImeDialog, "Invalid param->verticalAlignment");
|
||||
return Error::INVALID_VERTICALALIGNMENT;
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ Error PS4_SYSV_ABI sceImeDialogInit(OrbisImeDialogParam* param, OrbisImeParamExt
|
|||
return Error::INVALID_PARAM;
|
||||
}
|
||||
|
||||
if (param->inputTextBuffer == nullptr) {
|
||||
if (param->input_text_buffer == nullptr) {
|
||||
LOG_INFO(Lib_ImeDialog, "Invalid param->inputTextBuffer");
|
||||
return Error::INVALID_INPUT_TEXT_BUFFER;
|
||||
}
|
||||
|
@ -182,25 +182,25 @@ Error PS4_SYSV_ABI sceImeDialogInit(OrbisImeDialogParam* param, OrbisImeParamExt
|
|||
|
||||
// TODO: do correct extended->option validation
|
||||
|
||||
if ((extended->extKeyboardMode & 0xe3fffffc) != 0) {
|
||||
if ((extended->ext_keyboard_mode & 0xe3fffffc) != 0) {
|
||||
LOG_INFO(Lib_ImeDialog, "Invalid extended->extKeyboardMode");
|
||||
return Error::INVALID_EXTENDED;
|
||||
}
|
||||
|
||||
if (extended->disableDevice > 7) {
|
||||
if (extended->disable_device > 7) {
|
||||
LOG_INFO(Lib_ImeDialog, "Invalid extended->disableDevice");
|
||||
return Error::INVALID_EXTENDED;
|
||||
}
|
||||
}
|
||||
|
||||
if (param->maxTextLength > ORBIS_IME_DIALOG_MAX_TEXT_LENGTH) {
|
||||
if (param->max_text_length > ORBIS_IME_DIALOG_MAX_TEXT_LENGTH) {
|
||||
LOG_INFO(Lib_ImeDialog, "Invalid param->maxTextLength");
|
||||
return Error::INVALID_MAX_TEXT_LENGTH;
|
||||
}
|
||||
|
||||
g_ime_dlg_result = {};
|
||||
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);
|
||||
|
||||
return Error::OK;
|
||||
|
@ -227,17 +227,17 @@ int PS4_SYSV_ABI sceImeDialogSetPanelPosition() {
|
|||
}
|
||||
|
||||
Error PS4_SYSV_ABI sceImeDialogTerm() {
|
||||
if (g_ime_dlg_status == OrbisImeDialogStatus::NONE) {
|
||||
if (g_ime_dlg_status == OrbisImeDialogStatus::None) {
|
||||
LOG_INFO(Lib_ImeDialog, "IME dialog not in use");
|
||||
return Error::DIALOG_NOT_IN_USE;
|
||||
}
|
||||
|
||||
if (g_ime_dlg_status == OrbisImeDialogStatus::RUNNING) {
|
||||
if (g_ime_dlg_status == OrbisImeDialogStatus::Running) {
|
||||
LOG_INFO(Lib_ImeDialog, "IME dialog is still running");
|
||||
return Error::DIALOG_NOT_FINISHED;
|
||||
}
|
||||
|
||||
g_ime_dlg_status = OrbisImeDialogStatus::NONE;
|
||||
g_ime_dlg_status = OrbisImeDialogStatus::None;
|
||||
g_ime_dlg_ui = ImeDialogUi();
|
||||
g_ime_dlg_state = ImeDialogState();
|
||||
|
||||
|
@ -274,4 +274,4 @@ void RegisterlibSceImeDialog(Core::Loader::SymbolsResolver* sym) {
|
|||
LIB_FUNCTION("gyTyVn+bXMw", "libSceImeDialog", 1, "libSceImeDialog", 1, 1, sceImeDialogTerm);
|
||||
};
|
||||
|
||||
} // namespace Libraries::ImeDialog
|
||||
} // namespace Libraries::ImeDialog
|
||||
|
|
|
@ -58,32 +58,32 @@ enum class Error : u32 {
|
|||
};
|
||||
|
||||
enum class OrbisImeDialogStatus : u32 {
|
||||
NONE = 0,
|
||||
RUNNING = 1,
|
||||
FINISHED = 2,
|
||||
None = 0,
|
||||
Running = 1,
|
||||
Finished = 2,
|
||||
};
|
||||
|
||||
enum class OrbisImeDialogEndStatus : u32 {
|
||||
OK = 0,
|
||||
USER_CANCELED = 1,
|
||||
ABORTED = 2,
|
||||
Ok = 0,
|
||||
UserCanceled = 1,
|
||||
Aborted = 2,
|
||||
};
|
||||
|
||||
enum class OrbisImeDialogOption : u32 {
|
||||
DEFAULT = 0,
|
||||
MULTILINE = 1,
|
||||
NO_AUTO_CORRECTION = 2,
|
||||
NO_AUTO_COMPLETION = 4,
|
||||
Default = 0,
|
||||
Multiline = 1,
|
||||
NoAutoCorrection = 2,
|
||||
NoAutoCompletion = 4,
|
||||
// TODO: Document missing options
|
||||
LARGE_RESOLUTION = 1024,
|
||||
LargeResolution = 1024,
|
||||
};
|
||||
DECLARE_ENUM_FLAG_OPERATORS(OrbisImeDialogOption)
|
||||
|
||||
enum class OrbisImePanelPriority : u32 {
|
||||
DEFAULT = 0,
|
||||
ALPHABET = 1,
|
||||
SYMBOL = 2,
|
||||
ACCENT = 3,
|
||||
Default = 0,
|
||||
Alphabet = 1,
|
||||
Symbol = 2,
|
||||
Accent = 3,
|
||||
};
|
||||
|
||||
struct OrbisImeColor {
|
||||
|
@ -103,29 +103,29 @@ struct OrbisImeKeycode {
|
|||
char16_t character;
|
||||
u32 status;
|
||||
OrbisImeKeyboardType type;
|
||||
s32 userId;
|
||||
u32 resourceId;
|
||||
s32 user_id;
|
||||
u32 resource_id;
|
||||
u64 timestamp;
|
||||
};
|
||||
|
||||
typedef PS4_SYSV_ABI int (*OrbisImeExtKeyboardFilter)(const OrbisImeKeycode* srcKeycode,
|
||||
u16* outKeycode, u32* outStatus,
|
||||
void* reserved);
|
||||
using OrbisImeExtKeyboardFilter = PS4_SYSV_ABI int (*)(const OrbisImeKeycode* srcKeycode,
|
||||
u16* outKeycode, u32* outStatus,
|
||||
void* reserved);
|
||||
|
||||
struct OrbisImeDialogParam {
|
||||
s32 userId;
|
||||
s32 user_id;
|
||||
OrbisImeType type;
|
||||
u64 supportedLanguages;
|
||||
OrbisImeEnterLabel enterLabel;
|
||||
OrbisImeInputMethod inputMethod;
|
||||
u64 supported_languages;
|
||||
OrbisImeEnterLabel enter_label;
|
||||
OrbisImeInputMethod input_method;
|
||||
OrbisImeTextFilter filter;
|
||||
OrbisImeDialogOption option;
|
||||
u32 maxTextLength;
|
||||
char16_t* inputTextBuffer;
|
||||
u32 max_text_length;
|
||||
char16_t* input_text_buffer;
|
||||
float posx;
|
||||
float posy;
|
||||
OrbisImeHorizontalAlignment horizontalAlignment;
|
||||
OrbisImeVerticalAlignment verticalAlignment;
|
||||
OrbisImeHorizontalAlignment horizontal_alignment;
|
||||
OrbisImeVerticalAlignment vertical_alignment;
|
||||
const char16_t* placeholder;
|
||||
const char16_t* title;
|
||||
s8 reserved[16];
|
||||
|
@ -133,20 +133,20 @@ struct OrbisImeDialogParam {
|
|||
|
||||
struct OrbisImeParamExtended {
|
||||
u32 option; // OrbisImeDialogOptionExtended
|
||||
OrbisImeColor colorBase;
|
||||
OrbisImeColor colorLine;
|
||||
OrbisImeColor colorTextField;
|
||||
OrbisImeColor colorPreedit;
|
||||
OrbisImeColor colorButtonDefault;
|
||||
OrbisImeColor colorButtonFunction;
|
||||
OrbisImeColor colorButtonSymbol;
|
||||
OrbisImeColor colorText;
|
||||
OrbisImeColor colorSpecial;
|
||||
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* additionalDictionaryPath;
|
||||
OrbisImeExtKeyboardFilter extKeyboardFilter;
|
||||
uint32_t disableDevice;
|
||||
uint32_t extKeyboardMode;
|
||||
char* additional_dictionary_path;
|
||||
OrbisImeExtKeyboardFilter ext_keyboard_filter;
|
||||
uint32_t disable_device;
|
||||
uint32_t ext_keyboard_mode;
|
||||
int8_t reserved[60];
|
||||
};
|
||||
|
||||
|
@ -167,4 +167,4 @@ int PS4_SYSV_ABI sceImeDialogSetPanelPosition();
|
|||
Error PS4_SYSV_ABI sceImeDialogTerm();
|
||||
|
||||
void RegisterlibSceImeDialog(Core::Loader::SymbolsResolver* sym);
|
||||
} // namespace Libraries::ImeDialog
|
||||
} // namespace Libraries::ImeDialog
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
#include "common/assert.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/singleton.h"
|
||||
#include "core/libraries/ime/ime_dialog.h"
|
||||
#include "core/libraries/ime/ime_dialog_ui.h"
|
||||
#include "core/tls.h"
|
||||
|
@ -26,15 +25,15 @@ ImeDialogState::ImeDialogState(const OrbisImeDialogParam* param,
|
|||
return;
|
||||
}
|
||||
|
||||
userId = param->userId;
|
||||
is_multiLine = True(param->option & OrbisImeDialogOption::MULTILINE);
|
||||
is_numeric = param->type == OrbisImeType::NUMBER;
|
||||
user_id = param->user_id;
|
||||
is_multi_line = True(param->option & OrbisImeDialogOption::Multiline);
|
||||
is_numeric = param->type == OrbisImeType::Number;
|
||||
type = param->type;
|
||||
enter_label = param->enterLabel;
|
||||
enter_label = param->enter_label;
|
||||
text_filter = param->filter;
|
||||
keyboard_filter = extended ? extended->extKeyboardFilter : nullptr;
|
||||
max_text_length = param->maxTextLength;
|
||||
text_buffer = param->inputTextBuffer;
|
||||
keyboard_filter = extended ? extended->ext_keyboard_filter : nullptr;
|
||||
max_text_length = param->max_text_length;
|
||||
text_buffer = param->input_text_buffer;
|
||||
|
||||
if (param->title) {
|
||||
std::size_t title_len = std::char_traits<char16_t>::length(param->title);
|
||||
|
@ -65,12 +64,12 @@ ImeDialogState::ImeDialogState(const OrbisImeDialogParam* param,
|
|||
}
|
||||
|
||||
ImeDialogState::ImeDialogState(ImeDialogState&& other) noexcept
|
||||
: input_changed(other.input_changed), userId(other.userId), is_multiLine(other.is_multiLine),
|
||||
is_numeric(other.is_numeric), type(other.type), enter_label(other.enter_label),
|
||||
text_filter(other.text_filter), keyboard_filter(other.keyboard_filter),
|
||||
max_text_length(other.max_text_length), text_buffer(other.text_buffer),
|
||||
title(std::move(other.title)), placeholder(std::move(other.placeholder)),
|
||||
current_text(other.current_text) {
|
||||
: input_changed(other.input_changed), user_id(other.user_id),
|
||||
is_multi_line(other.is_multi_line), is_numeric(other.is_numeric), type(other.type),
|
||||
enter_label(other.enter_label), text_filter(other.text_filter),
|
||||
keyboard_filter(other.keyboard_filter), max_text_length(other.max_text_length),
|
||||
text_buffer(other.text_buffer), title(std::move(other.title)),
|
||||
placeholder(std::move(other.placeholder)), current_text(other.current_text) {
|
||||
|
||||
other.text_buffer = nullptr;
|
||||
}
|
||||
|
@ -78,8 +77,8 @@ ImeDialogState::ImeDialogState(ImeDialogState&& other) noexcept
|
|||
ImeDialogState& ImeDialogState::operator=(ImeDialogState&& other) {
|
||||
if (this != &other) {
|
||||
input_changed = other.input_changed;
|
||||
userId = other.userId;
|
||||
is_multiLine = other.is_multiLine;
|
||||
user_id = other.user_id;
|
||||
is_multi_line = other.is_multi_line;
|
||||
is_numeric = other.is_numeric;
|
||||
type = other.type;
|
||||
enter_label = other.enter_label;
|
||||
|
@ -171,7 +170,7 @@ ImeDialogUi::ImeDialogUi(ImeDialogState* state, OrbisImeDialogStatus* status,
|
|||
OrbisImeDialogResult* result)
|
||||
: state(state), status(status), result(result) {
|
||||
|
||||
if (state && *status == OrbisImeDialogStatus::RUNNING) {
|
||||
if (state && *status == OrbisImeDialogStatus::Running) {
|
||||
AddLayer(this);
|
||||
}
|
||||
}
|
||||
|
@ -191,7 +190,7 @@ ImeDialogUi::ImeDialogUi(ImeDialogUi&& other) noexcept
|
|||
other.status = nullptr;
|
||||
other.result = nullptr;
|
||||
|
||||
if (state && *status == OrbisImeDialogStatus::RUNNING) {
|
||||
if (state && *status == OrbisImeDialogStatus::Running) {
|
||||
AddLayer(this);
|
||||
}
|
||||
}
|
||||
|
@ -208,7 +207,7 @@ ImeDialogUi& ImeDialogUi::operator=(ImeDialogUi&& other) {
|
|||
other.status = nullptr;
|
||||
other.result = nullptr;
|
||||
|
||||
if (state && *status == OrbisImeDialogStatus::RUNNING) {
|
||||
if (state && *status == OrbisImeDialogStatus::Running) {
|
||||
AddLayer(this);
|
||||
}
|
||||
|
||||
|
@ -226,7 +225,7 @@ void ImeDialogUi::Draw() {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!status || *status != OrbisImeDialogStatus::RUNNING) {
|
||||
if (!status || *status != OrbisImeDialogStatus::Running) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -235,7 +234,7 @@ void ImeDialogUi::Draw() {
|
|||
|
||||
ImVec2 window_size;
|
||||
|
||||
if (state->is_multiLine) {
|
||||
if (state->is_multi_line) {
|
||||
window_size = {500.0f, 300.0f};
|
||||
} else {
|
||||
window_size = {500.0f, 150.0f};
|
||||
|
@ -259,7 +258,7 @@ void ImeDialogUi::Draw() {
|
|||
SetWindowFontScale(1.0f);
|
||||
}
|
||||
|
||||
if (state->is_multiLine) {
|
||||
if (state->is_multi_line) {
|
||||
DrawMultiLineInputText();
|
||||
} else {
|
||||
DrawInputText();
|
||||
|
@ -270,16 +269,16 @@ void ImeDialogUi::Draw() {
|
|||
const char* button_text;
|
||||
|
||||
switch (state->enter_label) {
|
||||
case OrbisImeEnterLabel::GO:
|
||||
case OrbisImeEnterLabel::Go:
|
||||
button_text = "Go##ImeDialogOK";
|
||||
break;
|
||||
case OrbisImeEnterLabel::SEARCH:
|
||||
case OrbisImeEnterLabel::Search:
|
||||
button_text = "Search##ImeDialogOK";
|
||||
break;
|
||||
case OrbisImeEnterLabel::SEND:
|
||||
case OrbisImeEnterLabel::Send:
|
||||
button_text = "Send##ImeDialogOK";
|
||||
break;
|
||||
case OrbisImeEnterLabel::DEFAULT:
|
||||
case OrbisImeEnterLabel::Default:
|
||||
default:
|
||||
button_text = "OK##ImeDialogOK";
|
||||
break;
|
||||
|
@ -292,16 +291,16 @@ void ImeDialogUi::Draw() {
|
|||
SetCursorPosX(button_start_pos);
|
||||
|
||||
if (Button(button_text, BUTTON_SIZE) ||
|
||||
(!state->is_multiLine && IsKeyPressed(ImGuiKey_Enter))) {
|
||||
*status = OrbisImeDialogStatus::FINISHED;
|
||||
result->endstatus = OrbisImeDialogEndStatus::OK;
|
||||
(!state->is_multi_line && IsKeyPressed(ImGuiKey_Enter))) {
|
||||
*status = OrbisImeDialogStatus::Finished;
|
||||
result->endstatus = OrbisImeDialogEndStatus::Ok;
|
||||
}
|
||||
|
||||
SameLine(0.0f, button_spacing);
|
||||
|
||||
if (Button("Cancel##ImeDialogCancel", BUTTON_SIZE)) {
|
||||
*status = OrbisImeDialogStatus::FINISHED;
|
||||
result->endstatus = OrbisImeDialogEndStatus::USER_CANCELED;
|
||||
*status = OrbisImeDialogStatus::Finished;
|
||||
result->endstatus = OrbisImeDialogEndStatus::UserCanceled;
|
||||
}
|
||||
}
|
||||
End();
|
||||
|
@ -362,9 +361,10 @@ int ImeDialogUi::InputTextCallback(ImGuiInputTextCallbackData* data) {
|
|||
.status = 1, // ??? 1 = key pressed, 0 = key released
|
||||
.type = OrbisImeKeyboardType::ENGLISH_US, // TODO set this to the correct value (maybe use
|
||||
// the current language?)
|
||||
.userId = ui->state->userId,
|
||||
.resourceId = 0,
|
||||
.timestamp = 0};
|
||||
.user_id = ui->state->user_id,
|
||||
.resource_id = 0,
|
||||
.timestamp = 0,
|
||||
};
|
||||
|
||||
if (!ui->state->ConvertUTF8ToOrbis(event_char, 4, &src_keycode.character, 1)) {
|
||||
LOG_ERROR(Lib_ImeDialog, "Failed to convert orbis char to utf8");
|
||||
|
|
|
@ -20,8 +20,8 @@ class ImeDialogState final {
|
|||
|
||||
bool input_changed = false;
|
||||
|
||||
s32 userId{};
|
||||
bool is_multiLine{};
|
||||
s32 user_id{};
|
||||
bool is_multi_line{};
|
||||
bool is_numeric{};
|
||||
OrbisImeType type{};
|
||||
OrbisImeEnterLabel enter_label{};
|
||||
|
|
51
src/core/libraries/ime/ime_error.h
Normal file
51
src/core/libraries/ime/ime_error.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/libraries/error_codes.h"
|
||||
|
||||
// ImeDialog library
|
||||
constexpr int ORBIS_ERROR_DIALOG_ERROR_NOT_INITIALIZED = 0x80ED0001;
|
||||
constexpr int ORBIS_ERROR_DIALOG_ERROR_ALREADY_INITIALIZED = 0x80ED0002;
|
||||
constexpr int ORBIS_ERROR_DIALOG_ERROR_PARAM_INVALID = 0x80ED0003;
|
||||
constexpr int ORBIS_ERROR_DIALOG_ERROR_UNEXPECTED_FATAL = 0x80ED0004;
|
||||
constexpr int ORBIS_ERROR_DIALOG_ERROR_INVALID_STATE = 0x80ED0005;
|
||||
constexpr int ORBIS_ERROR_DIALOG_ERROR_SERVICE_BUSY = 0x80ED0006;
|
||||
constexpr int ORBIS_ERROR_DIALOG_ERROR_INVALID_USER_ID = 0x80ED0007;
|
||||
|
||||
// Ime library
|
||||
constexpr int ORBIS_IME_ERROR_BUSY = 0x80BC0001;
|
||||
constexpr int ORBIS_IME_ERROR_NOT_OPENED = 0x80BC0002;
|
||||
constexpr int ORBIS_IME_ERROR_NO_MEMORY = 0x80BC0003;
|
||||
constexpr int ORBIS_IME_ERROR_CONNECTION_FAILED = 0x80BC0004;
|
||||
constexpr int ORBIS_IME_ERROR_TOO_MANY_REQUESTS = 0x80BC0005;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_TEXT = 0x80BC0006;
|
||||
constexpr int ORBIS_IME_ERROR_EVENT_OVERFLOW = 0x80BC0007;
|
||||
constexpr int ORBIS_IME_ERROR_NOT_ACTIVE = 0x80BC0008;
|
||||
constexpr int ORBIS_IME_ERROR_IME_SUSPENDING = 0x80BC0009;
|
||||
constexpr int ORBIS_IME_ERROR_DEVICE_IN_USE = 0x80BC000A;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_USER_ID = 0x80BC0010;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_TYPE = 0x80BC0011;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_SUPPORTED_LANGUAGES = 0x80BC0012;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_ENTER_LABEL = 0x80BC0013;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_INPUT_METHOD = 0x80BC0014;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_OPTION = 0x80BC0015;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_MAX_TEXT_LENGTH = 0x80BC0016;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_INPUT_TEXT_BUFFER = 0x80BC0017;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_POSX = 0x80BC0018;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_POSY = 0x80BC0019;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_HORIZONTAL_ALIGNMENT = 0x80BC001A;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_VERTICAL_ALIGNMENT = 0x80BC001B;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_EXTENDED = 0x80BC001C;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_KEYBOARD_TYPE = 0x80BC001D;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_WORK = 0x80BC0020;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_ARG = 0x80BC0021;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_HANDLER = 0x80BC0022;
|
||||
constexpr int ORBIS_IME_ERROR_NO_RESOURCE_ID = 0x80BC0023;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_MODE = 0x80BC0024;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_PARAM = 0x80BC0030;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_ADDRESS = 0x80BC0031;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_RESERVED = 0x80BC0032;
|
||||
constexpr int ORBIS_IME_ERROR_INVALID_TIMING = 0x80BC0033;
|
||||
constexpr int ORBIS_IME_ERROR_INTERNAL = 0x80BC00FF;
|
|
@ -16,7 +16,7 @@ ImeState::ImeState(const OrbisImeParam* param) {
|
|||
}
|
||||
|
||||
work_buffer = param->work;
|
||||
text_buffer = param->inputTextBuffer;
|
||||
text_buffer = param->input_text_buffer;
|
||||
|
||||
std::size_t text_len = std::char_traits<char16_t>::length(text_buffer);
|
||||
if (!ConvertOrbisToUTF8(text_buffer, text_len, current_text.begin(),
|
||||
|
@ -50,13 +50,13 @@ void ImeState::SendEvent(OrbisImeEvent* event) {
|
|||
|
||||
void ImeState::SendEnterEvent() {
|
||||
OrbisImeEvent enterEvent{};
|
||||
enterEvent.id = OrbisImeEventId::PRESS_ENTER;
|
||||
enterEvent.id = OrbisImeEventId::PressEnter;
|
||||
SendEvent(&enterEvent);
|
||||
}
|
||||
|
||||
void ImeState::SendCloseEvent() {
|
||||
OrbisImeEvent closeEvent{};
|
||||
closeEvent.id = OrbisImeEventId::PRESS_CLOSE;
|
||||
closeEvent.id = OrbisImeEventId::PressClose;
|
||||
closeEvent.param.text.str = reinterpret_cast<char16_t*>(work_buffer);
|
||||
SendEvent(&closeEvent);
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ void ImeUi::DrawInputText() {
|
|||
if (first_render) {
|
||||
SetKeyboardFocusHere();
|
||||
}
|
||||
if (InputTextEx("##ImeInput", nullptr, state->current_text.begin(), ime_param->maxTextLength,
|
||||
if (InputTextEx("##ImeInput", nullptr, state->current_text.begin(), ime_param->max_text_length,
|
||||
input_size, ImGuiInputTextFlags_CallbackAlways, InputTextCallback, this)) {
|
||||
}
|
||||
}
|
||||
|
@ -196,28 +196,28 @@ int ImeUi::InputTextCallback(ImGuiInputTextCallbackData* data) {
|
|||
if (currentText != lastText) {
|
||||
OrbisImeEditText eventParam{};
|
||||
eventParam.str = reinterpret_cast<char16_t*>(ui->ime_param->work);
|
||||
eventParam.caretIndex = data->CursorPos;
|
||||
eventParam.areaNum = 1;
|
||||
eventParam.caret_index = data->CursorPos;
|
||||
eventParam.area_num = 1;
|
||||
|
||||
eventParam.textArea[0].mode = 1; // Edit mode
|
||||
eventParam.textArea[0].index = data->CursorPos;
|
||||
eventParam.textArea[0].length = data->BufTextLen;
|
||||
eventParam.text_area[0].mode = 1; // Edit mode
|
||||
eventParam.text_area[0].index = data->CursorPos;
|
||||
eventParam.text_area[0].length = data->BufTextLen;
|
||||
|
||||
if (!ui->state->ConvertUTF8ToOrbis(data->Buf, data->BufTextLen, eventParam.str,
|
||||
ui->ime_param->maxTextLength)) {
|
||||
ui->ime_param->max_text_length)) {
|
||||
LOG_ERROR(Lib_ImeDialog, "Failed to convert Orbis char to UTF-8");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!ui->state->ConvertUTF8ToOrbis(data->Buf, data->BufTextLen,
|
||||
ui->ime_param->inputTextBuffer,
|
||||
ui->ime_param->maxTextLength)) {
|
||||
ui->ime_param->input_text_buffer,
|
||||
ui->ime_param->max_text_length)) {
|
||||
LOG_ERROR(Lib_ImeDialog, "Failed to convert Orbis char to UTF-8");
|
||||
return 0;
|
||||
}
|
||||
|
||||
OrbisImeEvent event{};
|
||||
event.id = OrbisImeEventId::UPDATE_TEXT;
|
||||
event.id = OrbisImeEventId::UpdateText;
|
||||
event.param.text = eventParam;
|
||||
|
||||
lastText = currentText;
|
||||
|
@ -250,4 +250,4 @@ void ImeUi::Free() {
|
|||
RemoveLayer(this);
|
||||
}
|
||||
|
||||
}; // namespace Libraries::Ime
|
||||
}; // namespace Libraries::Ime
|
||||
|
|
9
src/core/libraries/jpeg/jpeg_error.h
Normal file
9
src/core/libraries/jpeg/jpeg_error.h
Normal file
|
@ -0,0 +1,9 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
constexpr int ORBIS_JPEG_ENC_ERROR_INVALID_ADDR = 0x80650101;
|
||||
constexpr int ORBIS_JPEG_ENC_ERROR_INVALID_SIZE = 0x80650102;
|
||||
constexpr int ORBIS_JPEG_ENC_ERROR_INVALID_PARAM = 0x80650103;
|
||||
constexpr int ORBIS_JPEG_ENC_ERROR_INVALID_HANDLE = 0x80650104;
|
207
src/core/libraries/jpeg/jpegenc.cpp
Normal file
207
src/core/libraries/jpeg/jpegenc.cpp
Normal file
|
@ -0,0 +1,207 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <magic_enum.hpp>
|
||||
#include "common/alignment.h"
|
||||
#include "common/assert.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/libs.h"
|
||||
#include "jpeg_error.h"
|
||||
#include "jpegenc.h"
|
||||
|
||||
namespace Libraries::JpegEnc {
|
||||
|
||||
constexpr s32 ORBIS_JPEG_ENC_MINIMUM_MEMORY_SIZE = 0x800;
|
||||
constexpr u32 ORBIS_JPEG_ENC_MAX_IMAGE_DIMENSION = 0xFFFF;
|
||||
constexpr u32 ORBIS_JPEG_ENC_MAX_IMAGE_PITCH = 0xFFFFFFF;
|
||||
constexpr u32 ORBIS_JPEG_ENC_MAX_IMAGE_SIZE = 0x7FFFFFFF;
|
||||
|
||||
static s32 ValidateJpegEncCreateParam(const OrbisJpegEncCreateParam* param) {
|
||||
if (!param) {
|
||||
return ORBIS_JPEG_ENC_ERROR_INVALID_ADDR;
|
||||
}
|
||||
if (param->size != sizeof(OrbisJpegEncCreateParam)) {
|
||||
return ORBIS_JPEG_ENC_ERROR_INVALID_SIZE;
|
||||
}
|
||||
if (param->attr != ORBIS_JPEG_ENC_ATTRIBUTE_NONE) {
|
||||
return ORBIS_JPEG_ENC_ERROR_INVALID_PARAM;
|
||||
}
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
static s32 ValidateJpegEncMemory(const void* memory, const u32 memory_size) {
|
||||
if (!memory) {
|
||||
return ORBIS_JPEG_ENC_ERROR_INVALID_ADDR;
|
||||
}
|
||||
if (memory_size < ORBIS_JPEG_ENC_MINIMUM_MEMORY_SIZE) {
|
||||
return ORBIS_JPEG_ENC_ERROR_INVALID_SIZE;
|
||||
}
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
static s32 ValidateJpegEncEncodeParam(const OrbisJpegEncEncodeParam* param) {
|
||||
|
||||
// Validate addresses
|
||||
if (!param) {
|
||||
return ORBIS_JPEG_ENC_ERROR_INVALID_ADDR;
|
||||
}
|
||||
if (!param->image || (param->pixel_format != ORBIS_JPEG_ENC_PIXEL_FORMAT_Y8 &&
|
||||
!Common::IsAligned(reinterpret_cast<VAddr>(param->image), 4))) {
|
||||
return ORBIS_JPEG_ENC_ERROR_INVALID_ADDR;
|
||||
}
|
||||
if (!param->jpeg) {
|
||||
return ORBIS_JPEG_ENC_ERROR_INVALID_ADDR;
|
||||
}
|
||||
|
||||
// Validate sizes
|
||||
if (param->image_size == 0 || param->jpeg_size == 0) {
|
||||
return ORBIS_JPEG_ENC_ERROR_INVALID_SIZE;
|
||||
}
|
||||
|
||||
// Validate parameters
|
||||
if (param->image_width > ORBIS_JPEG_ENC_MAX_IMAGE_DIMENSION ||
|
||||
param->image_height > ORBIS_JPEG_ENC_MAX_IMAGE_DIMENSION) {
|
||||
return ORBIS_JPEG_ENC_ERROR_INVALID_PARAM;
|
||||
}
|
||||
if (param->image_pitch == 0 || param->image_pitch > ORBIS_JPEG_ENC_MAX_IMAGE_PITCH ||
|
||||
(param->pixel_format != ORBIS_JPEG_ENC_PIXEL_FORMAT_Y8 &&
|
||||
!Common::IsAligned(param->image_pitch, 4))) {
|
||||
return ORBIS_JPEG_ENC_ERROR_INVALID_PARAM;
|
||||
}
|
||||
const auto calculated_size = param->image_height * param->image_pitch;
|
||||
if (calculated_size > ORBIS_JPEG_ENC_MAX_IMAGE_SIZE || calculated_size > param->image_size) {
|
||||
return ORBIS_JPEG_ENC_ERROR_INVALID_PARAM;
|
||||
}
|
||||
if (param->encode_mode != ORBIS_JPEG_ENC_ENCODE_MODE_NORMAL &&
|
||||
param->encode_mode != ORBIS_JPEG_ENC_ENCODE_MODE_MJPEG) {
|
||||
return ORBIS_JPEG_ENC_ERROR_INVALID_PARAM;
|
||||
}
|
||||
if (param->color_space != ORBIS_JPEG_ENC_COLOR_SPACE_YCC &&
|
||||
param->color_space != ORBIS_JPEG_ENC_COLOR_SPACE_GRAYSCALE) {
|
||||
return ORBIS_JPEG_ENC_ERROR_INVALID_PARAM;
|
||||
}
|
||||
if (param->sampling_type != ORBIS_JPEG_ENC_SAMPLING_TYPE_FULL &&
|
||||
param->sampling_type != ORBIS_JPEG_ENC_SAMPLING_TYPE_422 &&
|
||||
param->sampling_type != ORBIS_JPEG_ENC_SAMPLING_TYPE_420) {
|
||||
return ORBIS_JPEG_ENC_ERROR_INVALID_PARAM;
|
||||
}
|
||||
if (param->restart_interval > ORBIS_JPEG_ENC_MAX_IMAGE_DIMENSION) {
|
||||
return ORBIS_JPEG_ENC_ERROR_INVALID_PARAM;
|
||||
}
|
||||
switch (param->pixel_format) {
|
||||
case ORBIS_JPEG_ENC_PIXEL_FORMAT_R8G8B8A8:
|
||||
case ORBIS_JPEG_ENC_PIXEL_FORMAT_B8G8R8A8:
|
||||
if (param->image_pitch >> 2 < param->image_width ||
|
||||
param->color_space != ORBIS_JPEG_ENC_COLOR_SPACE_YCC ||
|
||||
param->sampling_type == ORBIS_JPEG_ENC_SAMPLING_TYPE_FULL) {
|
||||
return ORBIS_JPEG_ENC_ERROR_INVALID_PARAM;
|
||||
}
|
||||
break;
|
||||
case ORBIS_JPEG_ENC_PIXEL_FORMAT_Y8U8Y8V8:
|
||||
if (param->image_pitch >> 1 < Common::AlignUp(param->image_width, 2) ||
|
||||
param->color_space != ORBIS_JPEG_ENC_COLOR_SPACE_YCC ||
|
||||
param->sampling_type == ORBIS_JPEG_ENC_SAMPLING_TYPE_FULL) {
|
||||
return ORBIS_JPEG_ENC_ERROR_INVALID_PARAM;
|
||||
}
|
||||
break;
|
||||
case ORBIS_JPEG_ENC_PIXEL_FORMAT_Y8:
|
||||
if (param->image_pitch < param->image_width ||
|
||||
param->color_space != ORBIS_JPEG_ENC_COLOR_SPACE_GRAYSCALE ||
|
||||
param->sampling_type != ORBIS_JPEG_ENC_SAMPLING_TYPE_FULL) {
|
||||
return ORBIS_JPEG_ENC_ERROR_INVALID_PARAM;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return ORBIS_JPEG_ENC_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
static s32 ValidateJpecEngHandle(OrbisJpegEncHandle handle) {
|
||||
if (!handle || !Common::IsAligned(reinterpret_cast<VAddr>(handle), 0x20) ||
|
||||
handle->handle != handle) {
|
||||
return ORBIS_JPEG_ENC_ERROR_INVALID_HANDLE;
|
||||
}
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
s32 PS4_SYSV_ABI sceJpegEncCreate(const OrbisJpegEncCreateParam* param, void* memory,
|
||||
const u32 memory_size, OrbisJpegEncHandle* handle) {
|
||||
if (auto param_ret = ValidateJpegEncCreateParam(param); param_ret != ORBIS_OK) {
|
||||
LOG_ERROR(Lib_Jpeg, "Invalid create param");
|
||||
return param_ret;
|
||||
}
|
||||
if (auto memory_ret = ValidateJpegEncMemory(memory, memory_size); memory_ret != ORBIS_OK) {
|
||||
LOG_ERROR(Lib_Jpeg, "Invalid memory");
|
||||
return memory_ret;
|
||||
}
|
||||
if (!handle) {
|
||||
LOG_ERROR(Lib_Jpeg, "Invalid handle output");
|
||||
return ORBIS_JPEG_ENC_ERROR_INVALID_ADDR;
|
||||
}
|
||||
|
||||
auto* handle_internal = reinterpret_cast<OrbisJpegEncHandleInternal*>(
|
||||
Common::AlignUp(reinterpret_cast<VAddr>(memory), 0x20));
|
||||
handle_internal->handle = handle_internal;
|
||||
handle_internal->handle_size = sizeof(OrbisJpegEncHandleInternal*);
|
||||
*handle = handle_internal;
|
||||
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
s32 PS4_SYSV_ABI sceJpegEncDelete(OrbisJpegEncHandle handle) {
|
||||
if (auto handle_ret = ValidateJpecEngHandle(handle); handle_ret != ORBIS_OK) {
|
||||
LOG_ERROR(Lib_Jpeg, "Invalid handle");
|
||||
return handle_ret;
|
||||
}
|
||||
handle->handle = nullptr;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
s32 PS4_SYSV_ABI sceJpegEncEncode(OrbisJpegEncHandle handle, const OrbisJpegEncEncodeParam* param,
|
||||
OrbisJpegEncOutputInfo* output_info) {
|
||||
if (auto handle_ret = ValidateJpecEngHandle(handle); handle_ret != ORBIS_OK) {
|
||||
LOG_ERROR(Lib_Jpeg, "Invalid handle");
|
||||
return handle_ret;
|
||||
}
|
||||
if (auto param_ret = ValidateJpegEncEncodeParam(param); param_ret != ORBIS_OK) {
|
||||
LOG_ERROR(Lib_Jpeg, "Invalid encode param");
|
||||
return param_ret;
|
||||
}
|
||||
|
||||
LOG_ERROR(Lib_Jpeg,
|
||||
"(STUBBED) image_size = {} , jpeg_size = {} , image_width = {} , image_height = {} , "
|
||||
"image_pitch = {} , pixel_format = {} , encode_mode = {} , color_space = {} , "
|
||||
"sampling_type = {} , compression_ratio = {} , restart_interval = {}",
|
||||
param->image_size, param->jpeg_size, param->image_width, param->image_height,
|
||||
param->image_pitch, magic_enum::enum_name(param->pixel_format),
|
||||
magic_enum::enum_name(param->encode_mode), magic_enum::enum_name(param->color_space),
|
||||
magic_enum::enum_name(param->sampling_type), param->compression_ratio,
|
||||
param->restart_interval);
|
||||
|
||||
if (output_info) {
|
||||
output_info->size = param->jpeg_size;
|
||||
output_info->height = param->image_height;
|
||||
}
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
s32 PS4_SYSV_ABI sceJpegEncQueryMemorySize(const OrbisJpegEncCreateParam* param) {
|
||||
if (auto param_ret = ValidateJpegEncCreateParam(param); param_ret != ORBIS_OK) {
|
||||
LOG_ERROR(Lib_Jpeg, "Invalid create param");
|
||||
return param_ret;
|
||||
}
|
||||
return ORBIS_JPEG_ENC_MINIMUM_MEMORY_SIZE;
|
||||
}
|
||||
|
||||
void RegisterlibSceJpegEnc(Core::Loader::SymbolsResolver* sym) {
|
||||
LIB_FUNCTION("K+rocojkr-I", "libSceJpegEnc", 1, "libSceJpegEnc", 1, 1, sceJpegEncCreate);
|
||||
LIB_FUNCTION("j1LyMdaM+C0", "libSceJpegEnc", 1, "libSceJpegEnc", 1, 1, sceJpegEncDelete);
|
||||
LIB_FUNCTION("QbrU0cUghEM", "libSceJpegEnc", 1, "libSceJpegEnc", 1, 1, sceJpegEncEncode);
|
||||
LIB_FUNCTION("o6ZgXfFdWXQ", "libSceJpegEnc", 1, "libSceJpegEnc", 1, 1,
|
||||
sceJpegEncQueryMemorySize);
|
||||
};
|
||||
|
||||
} // namespace Libraries::JpegEnc
|
84
src/core/libraries/jpeg/jpegenc.h
Normal file
84
src/core/libraries/jpeg/jpegenc.h
Normal file
|
@ -0,0 +1,84 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/types.h"
|
||||
|
||||
namespace Core::Loader {
|
||||
class SymbolsResolver;
|
||||
}
|
||||
|
||||
namespace Libraries::JpegEnc {
|
||||
|
||||
enum OrbisJpegEncCreateParamAttributes : u32 { ORBIS_JPEG_ENC_ATTRIBUTE_NONE = 0 };
|
||||
|
||||
enum OrbisJpegEncEncodeParamPixelFormat : u16 {
|
||||
ORBIS_JPEG_ENC_PIXEL_FORMAT_R8G8B8A8 = 0,
|
||||
ORBIS_JPEG_ENC_PIXEL_FORMAT_B8G8R8A8 = 1,
|
||||
ORBIS_JPEG_ENC_PIXEL_FORMAT_Y8U8Y8V8 = 10,
|
||||
ORBIS_JPEG_ENC_PIXEL_FORMAT_Y8 = 11
|
||||
};
|
||||
|
||||
enum OrbisJpengEncEncodeParamEncodeMode : u16 {
|
||||
ORBIS_JPEG_ENC_ENCODE_MODE_NORMAL = 0,
|
||||
ORBIS_JPEG_ENC_ENCODE_MODE_MJPEG = 1
|
||||
};
|
||||
|
||||
enum OrbisJpengEncEncodeParamColorSpace : u16 {
|
||||
ORBIS_JPEG_ENC_COLOR_SPACE_YCC = 1,
|
||||
ORBIS_JPEG_ENC_COLOR_SPACE_GRAYSCALE = 2
|
||||
};
|
||||
|
||||
enum OrbisJpengEncEncodeParamSamplingType : u8 {
|
||||
ORBIS_JPEG_ENC_SAMPLING_TYPE_FULL = 0,
|
||||
ORBIS_JPEG_ENC_SAMPLING_TYPE_422 = 1,
|
||||
ORBIS_JPEG_ENC_SAMPLING_TYPE_420 = 2
|
||||
};
|
||||
|
||||
struct OrbisJpegEncHandleInternal {
|
||||
OrbisJpegEncHandleInternal* handle;
|
||||
u32 handle_size;
|
||||
};
|
||||
static_assert(sizeof(OrbisJpegEncHandleInternal) == 0x10);
|
||||
|
||||
typedef OrbisJpegEncHandleInternal* OrbisJpegEncHandle;
|
||||
|
||||
struct OrbisJpegEncCreateParam {
|
||||
u32 size;
|
||||
OrbisJpegEncCreateParamAttributes attr;
|
||||
};
|
||||
static_assert(sizeof(OrbisJpegEncCreateParam) == 0x8);
|
||||
|
||||
struct OrbisJpegEncEncodeParam {
|
||||
void* image;
|
||||
void* jpeg;
|
||||
u32 image_size;
|
||||
u32 jpeg_size;
|
||||
u32 image_width;
|
||||
u32 image_height;
|
||||
u32 image_pitch;
|
||||
OrbisJpegEncEncodeParamPixelFormat pixel_format;
|
||||
OrbisJpengEncEncodeParamEncodeMode encode_mode;
|
||||
OrbisJpengEncEncodeParamColorSpace color_space;
|
||||
OrbisJpengEncEncodeParamSamplingType sampling_type;
|
||||
u8 compression_ratio;
|
||||
s32 restart_interval;
|
||||
};
|
||||
static_assert(sizeof(OrbisJpegEncEncodeParam) == 0x30);
|
||||
|
||||
struct OrbisJpegEncOutputInfo {
|
||||
u32 size;
|
||||
u32 height;
|
||||
};
|
||||
static_assert(sizeof(OrbisJpegEncOutputInfo) == 0x8);
|
||||
|
||||
s32 PS4_SYSV_ABI sceJpegEncCreate(const OrbisJpegEncCreateParam* param, void* memory,
|
||||
u32 memory_size, OrbisJpegEncHandle* handle);
|
||||
s32 PS4_SYSV_ABI sceJpegEncDelete(OrbisJpegEncHandle handle);
|
||||
s32 PS4_SYSV_ABI sceJpegEncEncode(OrbisJpegEncHandle handle, const OrbisJpegEncEncodeParam* param,
|
||||
OrbisJpegEncOutputInfo* output_info);
|
||||
s32 PS4_SYSV_ABI sceJpegEncQueryMemorySize(const OrbisJpegEncCreateParam* param);
|
||||
|
||||
void RegisterlibSceJpegEnc(Core::Loader::SymbolsResolver* sym);
|
||||
} // namespace Libraries::JpegEnc
|
|
@ -4,8 +4,8 @@
|
|||
#include "common/assert.h"
|
||||
#include "common/debug.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/kernel/equeue.h"
|
||||
#include "core/libraries/kernel/orbis_error.h"
|
||||
#include "core/libraries/libs.h"
|
||||
|
||||
namespace Libraries::Kernel {
|
||||
|
@ -77,9 +77,8 @@ bool EqueueInternal::TriggerEvent(u64 ident, s16 filter, void* trigger_data) {
|
|||
bool has_found = false;
|
||||
{
|
||||
std::scoped_lock lock{m_mutex};
|
||||
|
||||
for (auto& event : m_events) {
|
||||
if ((event.event.ident == ident) && (event.event.filter == filter)) {
|
||||
if (event.event.ident == ident && event.event.filter == filter) {
|
||||
event.Trigger(trigger_data);
|
||||
has_found = true;
|
||||
}
|
||||
|
@ -91,7 +90,6 @@ bool EqueueInternal::TriggerEvent(u64 ident, s16 filter, void* trigger_data) {
|
|||
|
||||
int EqueueInternal::GetTriggeredEvents(SceKernelEvent* ev, int num) {
|
||||
int count = 0;
|
||||
|
||||
for (auto& event : m_events) {
|
||||
if (event.IsTriggered()) {
|
||||
if (event.event.flags & SceKernelEvent::Flags::Clear) {
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
#include "common/scope_exit.h"
|
||||
#include "common/singleton.h"
|
||||
#include "core/file_sys/fs.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/kernel/file_system.h"
|
||||
#include "core/libraries/kernel/orbis_error.h"
|
||||
#include "core/libraries/libs.h"
|
||||
#include "kernel.h"
|
||||
|
||||
|
@ -128,12 +128,12 @@ int PS4_SYSV_ABI sceKernelClose(int d) {
|
|||
return ORBIS_KERNEL_ERROR_EPERM;
|
||||
}
|
||||
if (d == 2003) { // dev/urandom case
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
auto* h = Common::Singleton<Core::FileSys::HandleTable>::Instance();
|
||||
auto* file = h->GetFile(d);
|
||||
if (file == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EBADF;
|
||||
return ORBIS_KERNEL_ERROR_EBADF;
|
||||
}
|
||||
if (!file->is_directory) {
|
||||
file->f.Close();
|
||||
|
@ -141,7 +141,7 @@ int PS4_SYSV_ABI sceKernelClose(int d) {
|
|||
file->is_opened = false;
|
||||
LOG_INFO(Kernel_Fs, "Closing {}", file->m_guest_name);
|
||||
h->DeleteHandle(d);
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI posix_close(int d) {
|
||||
|
@ -166,7 +166,7 @@ size_t PS4_SYSV_ABI sceKernelWrite(int d, const void* buf, size_t nbytes) {
|
|||
auto* h = Common::Singleton<Core::FileSys::HandleTable>::Instance();
|
||||
auto* file = h->GetFile(d);
|
||||
if (file == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EBADF;
|
||||
return ORBIS_KERNEL_ERROR_EBADF;
|
||||
}
|
||||
|
||||
std::scoped_lock lk{file->m_mutex};
|
||||
|
@ -175,7 +175,7 @@ size_t PS4_SYSV_ABI sceKernelWrite(int d, const void* buf, size_t nbytes) {
|
|||
|
||||
int PS4_SYSV_ABI sceKernelUnlink(const char* path) {
|
||||
if (path == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
auto* h = Common::Singleton<Core::FileSys::HandleTable>::Instance();
|
||||
|
@ -184,15 +184,15 @@ int PS4_SYSV_ABI sceKernelUnlink(const char* path) {
|
|||
bool ro = false;
|
||||
const auto host_path = mnt->GetHostPath(path, &ro);
|
||||
if (host_path.empty()) {
|
||||
return SCE_KERNEL_ERROR_EACCES;
|
||||
return ORBIS_KERNEL_ERROR_EACCES;
|
||||
}
|
||||
|
||||
if (ro) {
|
||||
return SCE_KERNEL_ERROR_EROFS;
|
||||
return ORBIS_KERNEL_ERROR_EROFS;
|
||||
}
|
||||
|
||||
if (std::filesystem::is_directory(host_path)) {
|
||||
return SCE_KERNEL_ERROR_EPERM;
|
||||
return ORBIS_KERNEL_ERROR_EPERM;
|
||||
}
|
||||
|
||||
auto* file = h->GetFile(host_path);
|
||||
|
@ -201,7 +201,7 @@ int PS4_SYSV_ABI sceKernelUnlink(const char* path) {
|
|||
}
|
||||
|
||||
LOG_INFO(Kernel_Fs, "Unlinked {}", path);
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
size_t PS4_SYSV_ABI _readv(int d, const SceKernelIovec* iov, int iovcnt) {
|
||||
|
@ -231,7 +231,7 @@ s64 PS4_SYSV_ABI sceKernelLseek(int d, s64 offset, int whence) {
|
|||
std::scoped_lock lk{file->m_mutex};
|
||||
if (!file->f.Seek(offset, origin)) {
|
||||
LOG_CRITICAL(Kernel_Fs, "sceKernelLseek: failed to seek");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
return file->f.Tell();
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ s64 PS4_SYSV_ABI sceKernelRead(int d, void* buf, size_t nbytes) {
|
|||
auto* h = Common::Singleton<Core::FileSys::HandleTable>::Instance();
|
||||
auto* file = h->GetFile(d);
|
||||
if (file == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EBADF;
|
||||
return ORBIS_KERNEL_ERROR_EBADF;
|
||||
}
|
||||
|
||||
std::scoped_lock lk{file->m_mutex};
|
||||
|
@ -277,7 +277,7 @@ int PS4_SYSV_ABI posix_read(int d, void* buf, size_t nbytes) {
|
|||
int PS4_SYSV_ABI sceKernelMkdir(const char* path, u16 mode) {
|
||||
LOG_INFO(Kernel_Fs, "path = {} mode = {}", path, mode);
|
||||
if (path == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||
|
||||
|
@ -285,21 +285,21 @@ int PS4_SYSV_ABI sceKernelMkdir(const char* path, u16 mode) {
|
|||
const auto dir_name = mnt->GetHostPath(path, &ro);
|
||||
|
||||
if (std::filesystem::exists(dir_name)) {
|
||||
return SCE_KERNEL_ERROR_EEXIST;
|
||||
return ORBIS_KERNEL_ERROR_EEXIST;
|
||||
}
|
||||
|
||||
if (ro) {
|
||||
return SCE_KERNEL_ERROR_EROFS;
|
||||
return ORBIS_KERNEL_ERROR_EROFS;
|
||||
}
|
||||
|
||||
// CUSA02456: path = /aotl after sceSaveDataMount(mode = 1)
|
||||
std::error_code ec;
|
||||
if (dir_name.empty() || !std::filesystem::create_directory(dir_name, ec)) {
|
||||
return SCE_KERNEL_ERROR_EIO;
|
||||
return ORBIS_KERNEL_ERROR_EIO;
|
||||
}
|
||||
|
||||
if (!std::filesystem::exists(dir_name)) {
|
||||
return SCE_KERNEL_ERROR_ENOENT;
|
||||
return ORBIS_KERNEL_ERROR_ENOENT;
|
||||
}
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
@ -323,13 +323,13 @@ int PS4_SYSV_ABI sceKernelRmdir(const char* path) {
|
|||
if (dir_name.empty()) {
|
||||
LOG_ERROR(Kernel_Fs, "Failed to remove directory: {}, permission denied",
|
||||
fmt::UTF(dir_name.u8string()));
|
||||
return SCE_KERNEL_ERROR_EACCES;
|
||||
return ORBIS_KERNEL_ERROR_EACCES;
|
||||
}
|
||||
|
||||
if (ro) {
|
||||
LOG_ERROR(Kernel_Fs, "Failed to remove directory: {}, directory is read only",
|
||||
fmt::UTF(dir_name.u8string()));
|
||||
return SCE_KERNEL_ERROR_EROFS;
|
||||
return ORBIS_KERNEL_ERROR_EROFS;
|
||||
}
|
||||
|
||||
if (!std::filesystem::is_directory(dir_name)) {
|
||||
|
@ -411,7 +411,7 @@ int PS4_SYSV_ABI sceKernelCheckReachability(const char* path) {
|
|||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||
const auto path_name = mnt->GetHostPath(path);
|
||||
if (!std::filesystem::exists(path_name)) {
|
||||
return SCE_KERNEL_ERROR_ENOENT;
|
||||
return ORBIS_KERNEL_ERROR_ENOENT;
|
||||
}
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
@ -514,15 +514,15 @@ int PS4_SYSV_ABI sceKernelFtruncate(int fd, s64 length) {
|
|||
auto* file = h->GetFile(fd);
|
||||
|
||||
if (file == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EBADF;
|
||||
return ORBIS_KERNEL_ERROR_EBADF;
|
||||
}
|
||||
|
||||
if (file->m_host_name.empty()) {
|
||||
return SCE_KERNEL_ERROR_EACCES;
|
||||
return ORBIS_KERNEL_ERROR_EACCES;
|
||||
}
|
||||
|
||||
file->f.SetSize(length);
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
static int GetDents(int fd, char* buf, int nbytes, s64* basep) {
|
||||
|
@ -605,11 +605,11 @@ s32 PS4_SYSV_ABI sceKernelRename(const char* from, const char* to) {
|
|||
return ORBIS_KERNEL_ERROR_ENOENT;
|
||||
}
|
||||
if (ro) {
|
||||
return SCE_KERNEL_ERROR_EROFS;
|
||||
return ORBIS_KERNEL_ERROR_EROFS;
|
||||
}
|
||||
const auto dst_path = mnt->GetHostPath(to, &ro);
|
||||
if (ro) {
|
||||
return SCE_KERNEL_ERROR_EROFS;
|
||||
return ORBIS_KERNEL_ERROR_EROFS;
|
||||
}
|
||||
const bool src_is_dir = std::filesystem::is_directory(src_path);
|
||||
const bool dst_is_dir = std::filesystem::is_directory(dst_path);
|
||||
|
|
|
@ -37,8 +37,8 @@ struct OrbisKernelStat {
|
|||
u32 st_gen;
|
||||
s32 st_lspare;
|
||||
OrbisKernelTimespec st_birthtim;
|
||||
unsigned int : (8 / 2) * (16 - static_cast<int>(sizeof(OrbisKernelTimespec)));
|
||||
unsigned int : (8 / 2) * (16 - static_cast<int>(sizeof(OrbisKernelTimespec)));
|
||||
u32 : (8 / 2) * (16 - static_cast<int>(sizeof(OrbisKernelTimespec)));
|
||||
u32 : (8 / 2) * (16 - static_cast<int>(sizeof(OrbisKernelTimespec)));
|
||||
};
|
||||
|
||||
struct OrbisKernelDirent {
|
||||
|
|
|
@ -2,36 +2,27 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <thread>
|
||||
|
||||
#include <boost/asio/io_context.hpp>
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "common/debug.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/polyfill_thread.h"
|
||||
#include "common/singleton.h"
|
||||
#include "common/thread.h"
|
||||
#include "core/file_sys/fs.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/kernel/equeue.h"
|
||||
#include "core/libraries/kernel/file_system.h"
|
||||
#include "core/libraries/kernel/kernel.h"
|
||||
#include "core/libraries/kernel/memory.h"
|
||||
#include "core/libraries/kernel/orbis_error.h"
|
||||
#include "core/libraries/kernel/posix_error.h"
|
||||
#include "core/libraries/kernel/process.h"
|
||||
#include "core/libraries/kernel/threads.h"
|
||||
#include "core/libraries/kernel/threads/exception.h"
|
||||
#include "core/libraries/kernel/time.h"
|
||||
#include "core/libraries/libs.h"
|
||||
#include "core/linker.h"
|
||||
|
||||
#ifdef _WIN64
|
||||
#include <io.h>
|
||||
#include <objbase.h>
|
||||
#include <windows.h>
|
||||
#else
|
||||
#ifdef __APPLE__
|
||||
#include <date/tz.h>
|
||||
#endif
|
||||
#include <Rpc.h>
|
||||
#endif
|
||||
|
||||
namespace Libraries::Kernel {
|
||||
|
@ -39,10 +30,10 @@ namespace Libraries::Kernel {
|
|||
static u64 g_stack_chk_guard = 0xDEADBEEF54321ABC; // dummy return
|
||||
|
||||
boost::asio::io_context io_context;
|
||||
std::mutex m_asio_req;
|
||||
std::condition_variable_any cv_asio_req;
|
||||
std::atomic<u32> asio_requests;
|
||||
std::jthread service_thread;
|
||||
static std::mutex m_asio_req;
|
||||
static std::condition_variable_any cv_asio_req;
|
||||
static std::atomic<u32> asio_requests;
|
||||
static std::jthread service_thread;
|
||||
|
||||
void KernelSignalRequest() {
|
||||
std::unique_lock lock{m_asio_req};
|
||||
|
@ -93,16 +84,12 @@ int* PS4_SYSV_ABI __Error() {
|
|||
return &g_posix_errno;
|
||||
}
|
||||
|
||||
void ErrSceToPosix(int result) {
|
||||
const int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
|
||||
? result + -SCE_KERNEL_ERROR_UNKNOWN
|
||||
: POSIX_EOTHER;
|
||||
g_posix_errno = rt;
|
||||
void ErrSceToPosix(int error) {
|
||||
g_posix_errno = error - ORBIS_KERNEL_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
int ErrnoToSceKernelError(int e) {
|
||||
const auto res = SCE_KERNEL_ERROR_UNKNOWN + e;
|
||||
return res > SCE_KERNEL_ERROR_ESTOP ? SCE_KERNEL_ERROR_UNKNOWN : res;
|
||||
int ErrnoToSceKernelError(int error) {
|
||||
return error + ORBIS_KERNEL_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
void SetPosixErrno(int e) {
|
||||
|
|
|
@ -5,9 +5,8 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <fmt/core.h>
|
||||
#include "common/logging/log.h"
|
||||
#include "common/types.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/kernel/orbis_error.h"
|
||||
|
||||
namespace Core::Loader {
|
||||
class SymbolsResolver;
|
||||
|
@ -38,7 +37,7 @@ struct WrapperImpl<name, PS4_SYSV_ABI R (*)(Args...), f> {
|
|||
u32 ret = f(args...);
|
||||
if (ret != 0) {
|
||||
// LOG_ERROR(Lib_Kernel, "Function {} returned {}", std::string_view{name.value}, ret);
|
||||
ret += SCE_KERNEL_ERROR_UNKNOWN;
|
||||
ret += ORBIS_KERNEL_ERROR_UNKNOWN;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
#include "common/scope_exit.h"
|
||||
#include "common/singleton.h"
|
||||
#include "core/file_sys/fs.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/kernel/kernel.h"
|
||||
#include "core/libraries/kernel/memory.h"
|
||||
#include "core/libraries/kernel/orbis_error.h"
|
||||
#include "core/libraries/libs.h"
|
||||
#include "core/linker.h"
|
||||
#include "core/memory.h"
|
||||
|
@ -28,20 +28,20 @@ int PS4_SYSV_ABI sceKernelAllocateDirectMemory(s64 searchStart, s64 searchEnd, u
|
|||
u64 alignment, int memoryType, s64* physAddrOut) {
|
||||
if (searchStart < 0 || searchEnd <= searchStart) {
|
||||
LOG_ERROR(Kernel_Vmm, "Provided address range is invalid!");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
const bool is_in_range = searchEnd - searchStart >= len;
|
||||
if (len <= 0 || !Common::Is16KBAligned(len) || !is_in_range) {
|
||||
LOG_ERROR(Kernel_Vmm, "Provided address range is invalid!");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
if (alignment != 0 && !Common::Is16KBAligned(alignment)) {
|
||||
LOG_ERROR(Kernel_Vmm, "Alignment value is invalid!");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
if (physAddrOut == nullptr) {
|
||||
LOG_ERROR(Kernel_Vmm, "Result physical address pointer is null!");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
auto* memory = Core::Memory::Instance();
|
||||
|
@ -53,7 +53,7 @@ int PS4_SYSV_ABI sceKernelAllocateDirectMemory(s64 searchStart, s64 searchEnd, u
|
|||
"alignment = {:#x}, memoryType = {:#x}, physAddrOut = {:#x}",
|
||||
searchStart, searchEnd, len, alignment, memoryType, phys_addr);
|
||||
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
s32 PS4_SYSV_ABI sceKernelAllocateMainDirectMemory(size_t len, size_t alignment, int memoryType,
|
||||
|
@ -111,7 +111,7 @@ s32 PS4_SYSV_ABI sceKernelVirtualQuery(const void* addr, int flags, OrbisVirtual
|
|||
size_t infoSize) {
|
||||
LOG_INFO(Kernel_Vmm, "called addr = {}, flags = {:#x}", fmt::ptr(addr), flags);
|
||||
if (!addr) {
|
||||
return SCE_KERNEL_ERROR_EACCES;
|
||||
return ORBIS_KERNEL_ERROR_EACCES;
|
||||
}
|
||||
auto* memory = Core::Memory::Instance();
|
||||
return memory->VirtualQuery(std::bit_cast<VAddr>(addr), flags, info);
|
||||
|
@ -123,16 +123,16 @@ s32 PS4_SYSV_ABI sceKernelReserveVirtualRange(void** addr, u64 len, int flags, u
|
|||
|
||||
if (addr == nullptr) {
|
||||
LOG_ERROR(Kernel_Vmm, "Address is invalid!");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
if (len == 0 || !Common::Is16KBAligned(len)) {
|
||||
LOG_ERROR(Kernel_Vmm, "Map size is either zero or not 16KB aligned!");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
if (alignment != 0) {
|
||||
if ((!std::has_single_bit(alignment) && !Common::Is16KBAligned(alignment))) {
|
||||
LOG_ERROR(Kernel_Vmm, "Alignment value is invalid!");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ s32 PS4_SYSV_ABI sceKernelReserveVirtualRange(void** addr, u64 len, int flags, u
|
|||
const auto map_flags = static_cast<Core::MemoryMapFlags>(flags);
|
||||
memory->Reserve(addr, in_addr, len, map_flags, alignment);
|
||||
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceKernelMapNamedDirectMemory(void** addr, u64 len, int prot, int flags,
|
||||
|
@ -149,16 +149,16 @@ int PS4_SYSV_ABI sceKernelMapNamedDirectMemory(void** addr, u64 len, int prot, i
|
|||
const char* name) {
|
||||
if (len == 0 || !Common::Is16KBAligned(len)) {
|
||||
LOG_ERROR(Kernel_Vmm, "Map size is either zero or not 16KB aligned!");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
if (!Common::Is16KBAligned(directMemoryStart)) {
|
||||
LOG_ERROR(Kernel_Vmm, "Start address is not 16KB aligned!");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
if (alignment != 0) {
|
||||
if ((!std::has_single_bit(alignment) && !Common::Is16KBAligned(alignment))) {
|
||||
LOG_ERROR(Kernel_Vmm, "Alignment value is invalid!");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -357,20 +357,20 @@ s32 PS4_SYSV_ABI sceKernelMemoryPoolExpand(u64 searchStart, u64 searchEnd, size_
|
|||
size_t alignment, u64* physAddrOut) {
|
||||
if (searchStart < 0 || searchEnd <= searchStart) {
|
||||
LOG_ERROR(Kernel_Vmm, "Provided address range is invalid!");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
const bool is_in_range = searchEnd - searchStart >= len;
|
||||
if (len <= 0 || !Common::Is64KBAligned(len) || !is_in_range) {
|
||||
LOG_ERROR(Kernel_Vmm, "Provided address range is invalid!");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
if (alignment != 0 && !Common::Is64KBAligned(alignment)) {
|
||||
LOG_ERROR(Kernel_Vmm, "Alignment value is invalid!");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
if (physAddrOut == nullptr) {
|
||||
LOG_ERROR(Kernel_Vmm, "Result physical address pointer is null!");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
auto* memory = Core::Memory::Instance();
|
||||
|
@ -391,16 +391,16 @@ s32 PS4_SYSV_ABI sceKernelMemoryPoolReserve(void* addrIn, size_t len, size_t ali
|
|||
|
||||
if (addrIn == nullptr) {
|
||||
LOG_ERROR(Kernel_Vmm, "Address is invalid!");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
if (len == 0 || !Common::Is2MBAligned(len)) {
|
||||
LOG_ERROR(Kernel_Vmm, "Map size is either zero or not 2MB aligned!");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
if (alignment != 0) {
|
||||
if ((!std::has_single_bit(alignment) && !Common::Is2MBAligned(alignment))) {
|
||||
LOG_ERROR(Kernel_Vmm, "Alignment value is invalid!");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -415,11 +415,11 @@ s32 PS4_SYSV_ABI sceKernelMemoryPoolReserve(void* addrIn, size_t len, size_t ali
|
|||
s32 PS4_SYSV_ABI sceKernelMemoryPoolCommit(void* addr, size_t len, int type, int prot, int flags) {
|
||||
if (addr == nullptr) {
|
||||
LOG_ERROR(Kernel_Vmm, "Address is invalid!");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
if (len == 0 || !Common::Is64KBAligned(len)) {
|
||||
LOG_ERROR(Kernel_Vmm, "Map size is either zero or not 64KB aligned!");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
LOG_INFO(Kernel_Vmm, "addr = {}, len = {:#x}, type = {:#x}, prot = {:#x}, flags = {:#x}",
|
||||
|
@ -434,11 +434,11 @@ s32 PS4_SYSV_ABI sceKernelMemoryPoolCommit(void* addr, size_t len, int type, int
|
|||
s32 PS4_SYSV_ABI sceKernelMemoryPoolDecommit(void* addr, size_t len, int flags) {
|
||||
if (addr == nullptr) {
|
||||
LOG_ERROR(Kernel_Vmm, "Address is invalid!");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
if (len == 0 || !Common::Is64KBAligned(len)) {
|
||||
LOG_ERROR(Kernel_Vmm, "Map size is either zero or not 64KB aligned!");
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
LOG_INFO(Kernel_Vmm, "addr = {}, len = {:#x}, flags = {:#x}", fmt::ptr(addr), len, flags);
|
||||
|
@ -493,7 +493,7 @@ int PS4_SYSV_ABI sceKernelMunmap(void* addr, size_t len) {
|
|||
}
|
||||
auto* memory = Core::Memory::Instance();
|
||||
memory->UnmapMemory(std::bit_cast<VAddr>(addr), len);
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI posix_munmap(void* addr, size_t len) {
|
||||
|
|
108
src/core/libraries/kernel/orbis_error.h
Normal file
108
src/core/libraries/kernel/orbis_error.h
Normal file
|
@ -0,0 +1,108 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/libraries/error_codes.h"
|
||||
|
||||
// Libkernel library
|
||||
constexpr int ORBIS_KERNEL_ERROR_UNKNOWN = 0x80020000;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EPERM = 0x80020001;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOENT = 0x80020002;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ESRCH = 0x80020003;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EINTR = 0x80020004;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EIO = 0x80020005;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENXIO = 0x80020006;
|
||||
constexpr int ORBIS_KERNEL_ERROR_E2BIG = 0x80020007;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOEXEC = 0x80020008;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EBADF = 0x80020009;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ECHILD = 0x8002000A;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EDEADLK = 0x8002000B;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOMEM = 0x8002000C;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EACCES = 0x8002000D;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EFAULT = 0x8002000E;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOTBLK = 0x8002000F;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EBUSY = 0x80020010;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EEXIST = 0x80020011;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EXDEV = 0x80020012;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENODEV = 0x80020013;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOTDIR = 0x80020014;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EISDIR = 0x80020015;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EINVAL = 0x80020016;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENFILE = 0x80020017;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EMFILE = 0x80020018;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOTTY = 0x80020019;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ETXTBSY = 0x8002001A;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EFBIG = 0x8002001B;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOSPC = 0x8002001C;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ESPIPE = 0x8002001D;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EROFS = 0x8002001E;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EMLINK = 0x8002001F;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EPIPE = 0x80020020;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EDOM = 0x80020021;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ERANGE = 0x80020022;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EAGAIN = 0x80020023;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EWOULDBLOCK = 0x80020023;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EINPROGRESS = 0x80020024;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EALREADY = 0x80020025;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOTSOCK = 0x80020026;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EDESTADDRREQ = 0x80020027;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EMSGSIZE = 0x80020028;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EPROTOTYPE = 0x80020029;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOPROTOOPT = 0x8002002A;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EPROTONOSUPPORT = 0x8002002B;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ESOCKTNOSUPPORT = 0x8002002C;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOTSUP = 0x8002002D;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EOPNOTSUPP = 0x8002002D;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EPFNOSUPPORT = 0x8002002E;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EAFNOSUPPORT = 0x8002002F;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EADDRINUSE = 0x80020030;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EADDRNOTAVAIL = 0x80020031;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENETDOWN = 0x80020032;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENETUNREACH = 0x80020033;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENETRESET = 0x80020034;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ECONNABORTED = 0x80020035;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ECONNRESET = 0x80020036;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOBUFS = 0x80020037;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EISCONN = 0x80020038;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOTCONN = 0x80020039;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ESHUTDOWN = 0x8002003A;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ETOOMANYREFS = 0x8002003B;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ETIMEDOUT = 0x8002003C;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ECONNREFUSED = 0x8002003D;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ELOOP = 0x8002003E;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENAMETOOLONG = 0x8002003F;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EHOSTDOWN = 0x80020040;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EHOSTUNREACH = 0x80020041;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOTEMPTY = 0x80020042;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EPROCLIM = 0x80020043;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EUSERS = 0x80020044;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EDQUOT = 0x80020045;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ESTALE = 0x80020046;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EREMOTE = 0x80020047;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EBADRPC = 0x80020048;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ERPCMISMATCH = 0x80020049;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EPROGUNAVAIL = 0x8002004A;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EPROGMISMATCH = 0x8002004B;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EPROCUNAVAIL = 0x8002004C;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOLCK = 0x8002004D;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOSYS = 0x8002004E;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EFTYPE = 0x8002004F;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EAUTH = 0x80020050;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENEEDAUTH = 0x80020051;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EIDRM = 0x80020052;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOMSG = 0x80020053;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EOVERFLOW = 0x80020054;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ECANCELED = 0x80020055;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EILSEQ = 0x80020056;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOATTR = 0x80020057;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EDOOFUS = 0x80020058;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EBADMSG = 0x80020059;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EMULTIHOP = 0x8002005A;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOLINK = 0x8002005B;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EPROTO = 0x8002005C;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOTCAPABLE = 0x8002005D;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ECAPMODE = 0x8002005E;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOBLK = 0x8002005F;
|
||||
constexpr int ORBIS_KERNEL_ERROR_EICV = 0x80020060;
|
||||
constexpr int ORBIS_KERNEL_ERROR_ENOPLAYGOENT = 0x80020061;
|
128
src/core/libraries/kernel/posix_error.h
Normal file
128
src/core/libraries/kernel/posix_error.h
Normal file
|
@ -0,0 +1,128 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/libraries/error_codes.h"
|
||||
|
||||
// Posix error codes
|
||||
constexpr int POSIX_EPERM = 1;
|
||||
constexpr int POSIX_ENOENT = 2;
|
||||
constexpr int POSIX_ESRCH = 3;
|
||||
constexpr int POSIX_EINTR = 4;
|
||||
constexpr int POSIX_EIO = 5;
|
||||
constexpr int POSIX_ENXIO = 6;
|
||||
constexpr int POSIX_E2BIG = 7;
|
||||
constexpr int POSIX_ENOEXEC = 8;
|
||||
constexpr int POSIX_EBADF = 9;
|
||||
constexpr int POSIX_ECHILD = 10;
|
||||
constexpr int POSIX_EDEADLK = 11;
|
||||
constexpr int POSIX_ENOMEM = 12;
|
||||
constexpr int POSIX_EACCES = 13;
|
||||
constexpr int POSIX_EFAULT = 14;
|
||||
constexpr int POSIX_ENOTBLK = 15;
|
||||
constexpr int POSIX_EBUSY = 16;
|
||||
constexpr int POSIX_EEXIST = 17;
|
||||
constexpr int POSIX_EXDEV = 18;
|
||||
constexpr int POSIX_ENODEV = 19;
|
||||
constexpr int POSIX_ENOTDIR = 20;
|
||||
constexpr int POSIX_EISDIR = 21;
|
||||
constexpr int POSIX_EINVAL = 22;
|
||||
constexpr int POSIX_ENFILE = 23;
|
||||
constexpr int POSIX_EMFILE = 24;
|
||||
constexpr int POSIX_ENOTTY = 25;
|
||||
constexpr int POSIX_ETXTBSY = 26;
|
||||
constexpr int POSIX_EFBIG = 27;
|
||||
constexpr int POSIX_ENOSPC = 28;
|
||||
constexpr int POSIX_ESPIPE = 29;
|
||||
constexpr int POSIX_EROFS = 30;
|
||||
constexpr int POSIX_EMLINK = 31;
|
||||
constexpr int POSIX_EPIPE = 32;
|
||||
constexpr int POSIX_EDOM = 33;
|
||||
constexpr int POSIX_ERANGE = 34;
|
||||
constexpr int POSIX_EAGAIN = 35;
|
||||
constexpr int POSIX_EWOULDBLOCK = 35;
|
||||
constexpr int POSIX_EINPROGRESS = 36;
|
||||
constexpr int POSIX_EALREADY = 37;
|
||||
constexpr int POSIX_ENOTSOCK = 38;
|
||||
constexpr int POSIX_EDESTADDRREQ = 39;
|
||||
constexpr int POSIX_EMSGSIZE = 40;
|
||||
constexpr int POSIX_EPROTOTYPE = 41;
|
||||
constexpr int POSIX_ENOPROTOOPT = 42;
|
||||
constexpr int POSIX_EPROTONOSUPPORT = 43;
|
||||
constexpr int POSIX_ESOCKTNOSUPPORT = 44;
|
||||
constexpr int POSIX_EOPNOTSUPP = 45;
|
||||
constexpr int POSIX_ENOTSUP = 45;
|
||||
constexpr int POSIX_EPFNOSUPPORT = 46;
|
||||
constexpr int POSIX_EAFNOSUPPORT = 47;
|
||||
constexpr int POSIX_EADDRINUSE = 48;
|
||||
constexpr int POSIX_EADDRNOTAVAIL = 49;
|
||||
constexpr int POSIX_ENETDOWN = 50;
|
||||
constexpr int POSIX_ENETUNREACH = 51;
|
||||
constexpr int POSIX_ENETRESET = 52;
|
||||
constexpr int POSIX_ECONNABORTED = 53;
|
||||
constexpr int POSIX_ECONNRESET = 54;
|
||||
constexpr int POSIX_ENOBUFS = 55;
|
||||
constexpr int POSIX_EISCONN = 56;
|
||||
constexpr int POSIX_ENOTCONN = 57;
|
||||
constexpr int POSIX_ESHUTDOWN = 58;
|
||||
constexpr int POSIX_ETOOMANYREFS = 59;
|
||||
constexpr int POSIX_ETIMEDOUT = 60;
|
||||
constexpr int POSIX_ECONNREFUSED = 61;
|
||||
constexpr int POSIX_ELOOP = 62;
|
||||
constexpr int POSIX_ENAMETOOLONG = 63;
|
||||
constexpr int POSIX_EHOSTDOWN = 64;
|
||||
constexpr int POSIX_EHOSTUNREACH = 65;
|
||||
constexpr int POSIX_ENOTEMPTY = 66;
|
||||
constexpr int POSIX_EPROCLIM = 67;
|
||||
constexpr int POSIX_EUSERS = 68;
|
||||
constexpr int POSIX_EDQUOT = 69;
|
||||
constexpr int POSIX_ESTALE = 70;
|
||||
constexpr int POSIX_EREMOTE = 71;
|
||||
constexpr int POSIX_EBADRPC = 72;
|
||||
constexpr int POSIX_ERPCMISMATCH = 73;
|
||||
constexpr int POSIX_EPROGUNAVAIL = 74;
|
||||
constexpr int POSIX_EPROGMISMATCH = 75;
|
||||
constexpr int POSIX_EPROCUNAVAIL = 76;
|
||||
constexpr int POSIX_ENOLCK = 77;
|
||||
constexpr int POSIX_ENOSYS = 78;
|
||||
constexpr int POSIX_EFTYPE = 79;
|
||||
constexpr int POSIX_EAUTH = 80;
|
||||
constexpr int POSIX_ENEEDAUTH = 81;
|
||||
constexpr int POSIX_EIDRM = 82;
|
||||
constexpr int POSIX_ENOMSG = 83;
|
||||
constexpr int POSIX_EOVERFLOW = 84;
|
||||
constexpr int POSIX_ECANCELED = 85;
|
||||
constexpr int POSIX_EILSEQ = 86;
|
||||
constexpr int POSIX_ENOATTR = 87;
|
||||
constexpr int POSIX_EDOOFUS = 88;
|
||||
constexpr int POSIX_EBADMSG = 89;
|
||||
constexpr int POSIX_EMULTIHOP = 90;
|
||||
constexpr int POSIX_ENOLINK = 91;
|
||||
constexpr int POSIX_EPROTO = 92;
|
||||
constexpr int POSIX_ENOTCAPABLE = 93;
|
||||
constexpr int POSIX_ECAPMODE = 94;
|
||||
constexpr int POSIX_ENOBLK = 95;
|
||||
constexpr int POSIX_EICV = 96;
|
||||
constexpr int POSIX_ENOPLAYGOENT = 97;
|
||||
constexpr int POSIX_EREVOKE = 98;
|
||||
constexpr int POSIX_ESDKVERSION = 99;
|
||||
constexpr int POSIX_ESTART = 100;
|
||||
constexpr int POSIX_ESTOP = 101;
|
||||
constexpr int POSIX_EINVALID2MB = 102;
|
||||
constexpr int POSIX_ELAST = 102;
|
||||
constexpr int POSIX_EADHOC = 160;
|
||||
constexpr int POSIX_EINACTIVEDISABLED = 163;
|
||||
constexpr int POSIX_ENETNODATA = 164;
|
||||
constexpr int POSIX_ENETDESC = 165;
|
||||
constexpr int POSIX_ENETDESCTIMEDOUT = 166;
|
||||
constexpr int POSIX_ENETINTR = 167;
|
||||
constexpr int POSIX_ERETURN = 205;
|
||||
constexpr int POSIX_EFPOS = 152;
|
||||
constexpr int POSIX_ENODATA = 1040;
|
||||
constexpr int POSIX_ENOSR = 1050;
|
||||
constexpr int POSIX_ENOSTR = 1051;
|
||||
constexpr int POSIX_ENOTRECOVERABLE = 1056;
|
||||
constexpr int POSIX_EOTHER = 1062;
|
||||
constexpr int POSIX_EOWNERDEAD = 1064;
|
||||
constexpr int POSIX_ETIME = 1074;
|
|
@ -5,7 +5,7 @@
|
|||
#include "common/elf_info.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "core/file_sys/fs.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/kernel/orbis_error.h"
|
||||
#include "core/libraries/kernel/process.h"
|
||||
#include "core/libraries/libs.h"
|
||||
#include "core/linker.h"
|
||||
|
@ -91,7 +91,7 @@ s32 PS4_SYSV_ABI sceKernelGetModuleInfoForUnwind(VAddr addr, int flags,
|
|||
OrbisModuleInfoForUnwind* info) {
|
||||
if (flags >= 3) {
|
||||
std::memset(info, 0, sizeof(OrbisModuleInfoForUnwind));
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
if (!info) {
|
||||
return ORBIS_KERNEL_ERROR_EFAULT;
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
#include <cstring>
|
||||
#include "common/assert.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/kernel/kernel.h"
|
||||
#include "core/libraries/kernel/posix_error.h"
|
||||
#include "core/libraries/kernel/threads/pthread.h"
|
||||
#include "core/libraries/kernel/threads/sleepq.h"
|
||||
#include "core/libraries/libs.h"
|
||||
|
@ -122,7 +122,7 @@ int PthreadCond::Wait(PthreadMutexT* mutex, const OrbisKernelTimespec* abstime,
|
|||
SleepqUnlock(this);
|
||||
|
||||
//_thr_cancel_enter2(curthread, 0);
|
||||
int error = curthread->Sleep(abstime, usec) ? 0 : POSIX_ETIMEDOUT;
|
||||
error = curthread->Sleep(abstime, usec) ? 0 : POSIX_ETIMEDOUT;
|
||||
//_thr_cancel_leave(curthread, 0);
|
||||
|
||||
SleepqLock(this);
|
||||
|
@ -145,7 +145,10 @@ int PthreadCond::Wait(PthreadMutexT* mutex, const OrbisKernelTimespec* abstime,
|
|||
}
|
||||
SleepqUnlock(this);
|
||||
curthread->mutex_obj = nullptr;
|
||||
mp->CvLock(recurse);
|
||||
int error2 = mp->CvLock(recurse);
|
||||
if (error == 0) {
|
||||
error = error2;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "common/assert.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/kernel/orbis_error.h"
|
||||
#include "core/libraries/libs.h"
|
||||
|
||||
namespace Libraries::Kernel {
|
||||
|
|
|
@ -3,10 +3,9 @@
|
|||
|
||||
#include <thread>
|
||||
#include "common/assert.h"
|
||||
#include "common/scope_exit.h"
|
||||
#include "common/types.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/kernel/kernel.h"
|
||||
#include "core/libraries/kernel/posix_error.h"
|
||||
#include "core/libraries/kernel/threads/pthread.h"
|
||||
#include "core/libraries/libs.h"
|
||||
|
||||
|
@ -121,6 +120,7 @@ int PthreadMutex::SelfTryLock() {
|
|||
switch (Type()) {
|
||||
case PthreadMutexType::ErrorCheck:
|
||||
case PthreadMutexType::Normal:
|
||||
case PthreadMutexType::AdaptiveNp:
|
||||
return POSIX_EBUSY;
|
||||
case PthreadMutexType::Recursive: {
|
||||
/* Increment the lock count: */
|
||||
|
@ -224,7 +224,7 @@ int PthreadMutex::Lock(const OrbisKernelTimespec* abstime, u64 usec) {
|
|||
[[unlikely]] {
|
||||
ret = POSIX_EINVAL;
|
||||
} else {
|
||||
if (THR_RELTIME) {
|
||||
if (abstime == THR_RELTIME) {
|
||||
ret = m_lock.try_lock_for(std::chrono::microseconds(usec)) ? 0 : POSIX_ETIMEDOUT;
|
||||
} else {
|
||||
ret = m_lock.try_lock_until(abstime->TimePoint()) ? 0 : POSIX_ETIMEDOUT;
|
||||
|
@ -336,7 +336,7 @@ int PS4_SYSV_ABI posix_pthread_mutex_isowned_np(PthreadMutexT* mutex) {
|
|||
return m->m_owner == g_curthread;
|
||||
}
|
||||
|
||||
bool PthreadMutex::IsOwned(Pthread* curthread) const {
|
||||
int PthreadMutex::IsOwned(Pthread* curthread) const {
|
||||
if (this <= THR_MUTEX_DESTROYED) [[unlikely]] {
|
||||
if (this == THR_MUTEX_DESTROYED) {
|
||||
return POSIX_EINVAL;
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
#include "common/assert.h"
|
||||
#include "common/thread.h"
|
||||
#include "core/debug_state.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/kernel/kernel.h"
|
||||
#include "core/libraries/kernel/posix_error.h"
|
||||
#include "core/libraries/kernel/threads/pthread.h"
|
||||
#include "core/libraries/kernel/threads/thread_state.h"
|
||||
#include "core/libraries/libs.h"
|
||||
|
@ -380,7 +380,7 @@ int PS4_SYSV_ABI posix_sched_get_priority_min() {
|
|||
int PS4_SYSV_ABI posix_pthread_rename_np(PthreadT thread, const char* name) {
|
||||
LOG_INFO(Kernel_Pthread, "name = {}", name);
|
||||
thread->name = name;
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI posix_pthread_getschedparam(PthreadT pthread, SchedPolicy* policy,
|
||||
|
|
|
@ -79,7 +79,7 @@ struct PthreadMutex {
|
|||
return Unlock();
|
||||
}
|
||||
|
||||
bool IsOwned(Pthread* curthread) const;
|
||||
int IsOwned(Pthread* curthread) const;
|
||||
};
|
||||
using PthreadMutexT = PthreadMutex*;
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/kernel/kernel.h"
|
||||
#include "core/libraries/kernel/posix_error.h"
|
||||
#include "core/libraries/kernel/threads/pthread.h"
|
||||
#include "core/libraries/kernel/threads/thread_state.h"
|
||||
#include "core/libraries/libs.h"
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/kernel/kernel.h"
|
||||
#include "core/libraries/kernel/posix_error.h"
|
||||
#include "core/libraries/kernel/threads/pthread.h"
|
||||
#include "core/libraries/libs.h"
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/kernel/kernel.h"
|
||||
#include "core/libraries/kernel/posix_error.h"
|
||||
#include "core/libraries/kernel/threads/pthread.h"
|
||||
#include "core/libraries/libs.h"
|
||||
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
#include <list>
|
||||
#include <mutex>
|
||||
#include <semaphore>
|
||||
|
||||
#include "common/logging/log.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/kernel/kernel.h"
|
||||
#include "core/libraries/kernel/orbis_error.h"
|
||||
#include "core/libraries/kernel/posix_error.h"
|
||||
#include "core/libraries/kernel/threads/pthread.h"
|
||||
#include "core/libraries/kernel/time.h"
|
||||
#include "core/libraries/libs.h"
|
||||
|
@ -41,7 +43,7 @@ public:
|
|||
}
|
||||
|
||||
if (timeout && *timeout == 0) {
|
||||
return SCE_KERNEL_ERROR_ETIMEDOUT;
|
||||
return ORBIS_KERNEL_ERROR_ETIMEDOUT;
|
||||
}
|
||||
|
||||
// Create waiting thread object and add it into the list of waiters.
|
||||
|
@ -49,10 +51,8 @@ public:
|
|||
const auto it = AddWaiter(&waiter);
|
||||
|
||||
// Perform the wait.
|
||||
lk.unlock();
|
||||
const s32 result = waiter.Wait(timeout);
|
||||
lk.lock();
|
||||
if (result == SCE_KERNEL_ERROR_ETIMEDOUT) {
|
||||
const s32 result = waiter.Wait(lk, timeout);
|
||||
if (result == ORBIS_KERNEL_ERROR_ETIMEDOUT) {
|
||||
wait_list.erase(it);
|
||||
}
|
||||
return result;
|
||||
|
@ -74,7 +74,8 @@ public:
|
|||
}
|
||||
it = wait_list.erase(it);
|
||||
token_count -= waiter->need_count;
|
||||
waiter->sema.release();
|
||||
waiter->was_signaled = true;
|
||||
waiter->cv.notify_one();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -87,7 +88,7 @@ public:
|
|||
}
|
||||
for (auto* waiter : wait_list) {
|
||||
waiter->was_cancled = true;
|
||||
waiter->sema.release();
|
||||
waiter->cv.notify_one();
|
||||
}
|
||||
wait_list.clear();
|
||||
token_count = set_count < 0 ? init_count : set_count;
|
||||
|
@ -98,20 +99,21 @@ public:
|
|||
std::scoped_lock lk{mutex};
|
||||
for (auto* waiter : wait_list) {
|
||||
waiter->was_deleted = true;
|
||||
waiter->sema.release();
|
||||
waiter->cv.notify_one();
|
||||
}
|
||||
wait_list.clear();
|
||||
}
|
||||
|
||||
public:
|
||||
struct WaitingThread {
|
||||
std::binary_semaphore sema;
|
||||
std::condition_variable cv;
|
||||
u32 priority;
|
||||
s32 need_count;
|
||||
bool was_signaled{};
|
||||
bool was_deleted{};
|
||||
bool was_cancled{};
|
||||
|
||||
explicit WaitingThread(s32 need_count, bool is_fifo) : sema{0}, need_count{need_count} {
|
||||
explicit WaitingThread(s32 need_count, bool is_fifo) : need_count{need_count} {
|
||||
// Retrieve calling thread priority for sorting into waiting threads list.
|
||||
if (!is_fifo) {
|
||||
priority = g_curthread->attr.prio;
|
||||
|
@ -120,35 +122,36 @@ public:
|
|||
|
||||
int GetResult(bool timed_out) {
|
||||
if (timed_out) {
|
||||
return SCE_KERNEL_ERROR_ETIMEDOUT;
|
||||
return ORBIS_KERNEL_ERROR_ETIMEDOUT;
|
||||
}
|
||||
if (was_deleted) {
|
||||
return SCE_KERNEL_ERROR_EACCES;
|
||||
return ORBIS_KERNEL_ERROR_EACCES;
|
||||
}
|
||||
if (was_cancled) {
|
||||
return SCE_KERNEL_ERROR_ECANCELED;
|
||||
return ORBIS_KERNEL_ERROR_ECANCELED;
|
||||
}
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int Wait(u32* timeout) {
|
||||
int Wait(std::unique_lock<std::mutex>& lk, u32* timeout) {
|
||||
if (!timeout) {
|
||||
// Wait indefinitely until we are woken up.
|
||||
sema.acquire();
|
||||
cv.wait(lk);
|
||||
return GetResult(false);
|
||||
}
|
||||
// Wait until timeout runs out, recording how much remaining time there was.
|
||||
const auto start = std::chrono::high_resolution_clock::now();
|
||||
const auto sema_timeout = !sema.try_acquire_for(std::chrono::microseconds(*timeout));
|
||||
const auto signaled = cv.wait_for(lk, std::chrono::microseconds(*timeout),
|
||||
[this] { return was_signaled; });
|
||||
const auto end = std::chrono::high_resolution_clock::now();
|
||||
const auto time =
|
||||
std::chrono::duration_cast<std::chrono::microseconds>(end - start).count();
|
||||
if (sema_timeout) {
|
||||
*timeout = 0;
|
||||
} else {
|
||||
if (signaled) {
|
||||
*timeout -= time;
|
||||
} else {
|
||||
*timeout = 0;
|
||||
}
|
||||
return GetResult(sema_timeout);
|
||||
return GetResult(!signaled);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -222,13 +225,13 @@ int PS4_SYSV_ABI sceKernelCancelSema(OrbisKernelSema sem, s32 setCount, s32* pNu
|
|||
|
||||
int PS4_SYSV_ABI sceKernelDeleteSema(OrbisKernelSema sem) {
|
||||
if (!sem) {
|
||||
return SCE_KERNEL_ERROR_ESRCH;
|
||||
return ORBIS_KERNEL_ERROR_ESRCH;
|
||||
}
|
||||
sem->Delete();
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI posix_sem_init(PthreadSem** sem, int pshared, unsigned int value) {
|
||||
int PS4_SYSV_ABI posix_sem_init(PthreadSem** sem, int pshared, u32 value) {
|
||||
if (value > ORBIS_KERNEL_SEM_VALUE_MAX) {
|
||||
*__Error() = POSIX_EINVAL;
|
||||
return -1;
|
||||
|
|
|
@ -2,14 +2,13 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <forward_list>
|
||||
#include <list>
|
||||
#include <boost/intrusive/list.hpp>
|
||||
#include <boost/intrusive/list_hook.hpp>
|
||||
#include "common/types.h"
|
||||
|
||||
namespace Libraries::Kernel {
|
||||
|
||||
struct Pthread;
|
||||
struct SleepQueue;
|
||||
|
||||
using ListBaseHook =
|
||||
boost::intrusive::list_base_hook<boost::intrusive::link_mode<boost::intrusive::auto_unlink>>;
|
||||
|
@ -17,7 +16,7 @@ using ListBaseHook =
|
|||
using SleepqList = boost::intrusive::list<SleepQueue, boost::intrusive::constant_time_size<false>>;
|
||||
|
||||
struct SleepQueue : public ListBaseHook {
|
||||
std::list<Pthread*> sq_blocked;
|
||||
std::forward_list<Pthread*> sq_blocked;
|
||||
SleepqList sq_freeq;
|
||||
void* sq_wchan;
|
||||
int sq_type;
|
||||
|
@ -35,4 +34,4 @@ int SleepqRemove(SleepQueue* sq, Pthread* td);
|
|||
|
||||
void SleepqDrop(SleepQueue* sq, void (*callback)(Pthread*, void*), void* arg);
|
||||
|
||||
} // namespace Libraries::Kernel
|
||||
} // namespace Libraries::Kernel
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <boost/container/small_vector.hpp>
|
||||
#include "common/alignment.h"
|
||||
#include "common/scope_exit.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/kernel/posix_error.h"
|
||||
#include "core/libraries/kernel/threads/pthread.h"
|
||||
#include "core/libraries/kernel/threads/sleepq.h"
|
||||
#include "core/libraries/kernel/threads/thread_state.h"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include "common/assert.h"
|
||||
#include "common/native_clock.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/kernel/orbis_error.h"
|
||||
#include "core/libraries/kernel/time.h"
|
||||
#include "core/libraries/libs.h"
|
||||
|
||||
|
@ -80,7 +80,7 @@ u32 PS4_SYSV_ABI sceKernelSleep(u32 seconds) {
|
|||
|
||||
int PS4_SYSV_ABI sceKernelClockGettime(s32 clock_id, OrbisKernelTimespec* tp) {
|
||||
if (tp == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EFAULT;
|
||||
return ORBIS_KERNEL_ERROR_EFAULT;
|
||||
}
|
||||
clockid_t pclock_id = CLOCK_REALTIME;
|
||||
switch (clock_id) {
|
||||
|
@ -105,9 +105,9 @@ int PS4_SYSV_ABI sceKernelClockGettime(s32 clock_id, OrbisKernelTimespec* tp) {
|
|||
tp->tv_sec = t.tv_sec;
|
||||
tp->tv_nsec = t.tv_nsec;
|
||||
if (result == 0) {
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI posix_clock_gettime(s32 clock_id, OrbisKernelTimespec* time) {
|
||||
|
@ -126,11 +126,11 @@ int PS4_SYSV_ABI posix_nanosleep(const OrbisKernelTimespec* rqtp, OrbisKernelTim
|
|||
|
||||
int PS4_SYSV_ABI sceKernelNanosleep(const OrbisKernelTimespec* rqtp, OrbisKernelTimespec* rmtp) {
|
||||
if (!rqtp || !rmtp) {
|
||||
return SCE_KERNEL_ERROR_EFAULT;
|
||||
return ORBIS_KERNEL_ERROR_EFAULT;
|
||||
}
|
||||
|
||||
if (rqtp->tv_sec < 0 || rqtp->tv_nsec < 0) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
return posix_nanosleep(rqtp, rmtp);
|
||||
|
@ -197,7 +197,7 @@ s32 PS4_SYSV_ABI sceKernelGettimezone(OrbisKernelTimezone* tz) {
|
|||
|
||||
int PS4_SYSV_ABI posix_clock_getres(u32 clock_id, OrbisKernelTimespec* res) {
|
||||
if (res == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EFAULT;
|
||||
return ORBIS_KERNEL_ERROR_EFAULT;
|
||||
}
|
||||
clockid_t pclock_id = CLOCK_REALTIME;
|
||||
switch (clock_id) {
|
||||
|
@ -221,9 +221,9 @@ int PS4_SYSV_ABI posix_clock_getres(u32 clock_id, OrbisKernelTimespec* res) {
|
|||
res->tv_sec = t.tv_sec;
|
||||
res->tv_nsec = t.tv_nsec;
|
||||
if (result == 0) {
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceKernelConvertLocaltimeToUtc(time_t param_1, int64_t param_2, time_t* seconds,
|
||||
|
@ -237,9 +237,9 @@ int PS4_SYSV_ABI sceKernelConvertLocaltimeToUtc(time_t param_1, int64_t param_2,
|
|||
if (dst_seconds)
|
||||
*dst_seconds = timezone->tz_dsttime * 60;
|
||||
} else {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
return SCE_OK;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
namespace Dev {
|
||||
|
@ -254,7 +254,7 @@ Common::NativeClock* GetClock() {
|
|||
} // namespace Dev
|
||||
|
||||
int PS4_SYSV_ABI sceKernelConvertUtcToLocaltime(time_t time, time_t* local_time,
|
||||
struct OrbisTimesec* st, unsigned long* dst_sec) {
|
||||
struct OrbisTimesec* st, u64* dst_sec) {
|
||||
LOG_TRACE(Kernel, "Called");
|
||||
#ifdef __APPLE__
|
||||
// std::chrono::current_zone() not available yet.
|
||||
|
|
|
@ -81,7 +81,7 @@ int PS4_SYSV_ABI sceKernelConvertLocaltimeToUtc(time_t param_1, int64_t param_2,
|
|||
OrbisKernelTimezone* timezone, int* dst_seconds);
|
||||
|
||||
int PS4_SYSV_ABI sceKernelConvertUtcToLocaltime(time_t time, time_t* local_time, OrbisTimesec* st,
|
||||
unsigned long* dst_sec);
|
||||
u64* dst_sec);
|
||||
|
||||
void RegisterTime(Core::Loader::SymbolsResolver* sym);
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
#include <png.h>
|
||||
#include "common/assert.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/libpng/pngdec.h"
|
||||
#include "core/libraries/libpng/pngdec_error.h"
|
||||
#include "core/libraries/libs.h"
|
||||
#include "pngdec.h"
|
||||
|
||||
namespace Libraries::PngDec {
|
||||
|
||||
|
@ -15,24 +15,25 @@ struct PngHandler {
|
|||
png_infop info_ptr;
|
||||
};
|
||||
|
||||
struct PngStruct {
|
||||
const u8* data;
|
||||
size_t size;
|
||||
u64 offset;
|
||||
};
|
||||
|
||||
static inline OrbisPngDecColorSpace MapPngColor(int color) {
|
||||
switch (color) {
|
||||
case PNG_COLOR_TYPE_GRAY:
|
||||
return OrbisPngDecColorSpace::ORBIS_PNG_DEC_COLOR_SPACE_GRAYSCALE;
|
||||
|
||||
return OrbisPngDecColorSpace::Grayscale;
|
||||
case PNG_COLOR_TYPE_GRAY_ALPHA:
|
||||
return OrbisPngDecColorSpace::ORBIS_PNG_DEC_COLOR_SPACE_GRAYSCALE_ALPHA;
|
||||
|
||||
return OrbisPngDecColorSpace::GrayscaleAlpha;
|
||||
case PNG_COLOR_TYPE_PALETTE:
|
||||
return OrbisPngDecColorSpace::ORBIS_PNG_DEC_COLOR_SPACE_CLUT;
|
||||
|
||||
return OrbisPngDecColorSpace::Clut;
|
||||
case PNG_COLOR_TYPE_RGB:
|
||||
return OrbisPngDecColorSpace::ORBIS_PNG_DEC_COLOR_SPACE_RGB;
|
||||
|
||||
return OrbisPngDecColorSpace::Rgb;
|
||||
case PNG_COLOR_TYPE_RGB_ALPHA:
|
||||
return OrbisPngDecColorSpace::ORBIS_PNG_DEC_COLOR_SPACE_RGBA;
|
||||
return OrbisPngDecColorSpace::Rgba;
|
||||
}
|
||||
|
||||
UNREACHABLE_MSG("unknown png color type");
|
||||
}
|
||||
|
||||
|
@ -54,8 +55,8 @@ s32 PS4_SYSV_ABI scePngDecCreate(const OrbisPngDecCreateParam* param, void* memo
|
|||
LOG_ERROR(Lib_Png, "Invalid memory address!");
|
||||
return ORBIS_PNG_DEC_ERROR_INVALID_ADDR;
|
||||
}
|
||||
if (param->maxImageWidth - 1 > 1000000) {
|
||||
LOG_ERROR(Lib_Png, "Invalid size! width = {}", param->maxImageWidth);
|
||||
if (param->max_image_width - 1 > 1000000) {
|
||||
LOG_ERROR(Lib_Png, "Invalid size! width = {}", param->max_image_width);
|
||||
return ORBIS_PNG_DEC_ERROR_INVALID_SIZE;
|
||||
}
|
||||
auto pngh = (PngHandler*)memoryAddress;
|
||||
|
@ -86,88 +87,86 @@ s32 PS4_SYSV_ABI scePngDecDecode(OrbisPngDecHandle handle, const OrbisPngDecDeco
|
|||
LOG_ERROR(Lib_Png, "Invalid param!");
|
||||
return ORBIS_PNG_DEC_ERROR_INVALID_PARAM;
|
||||
}
|
||||
if (param->pngMemAddr == nullptr || param->pngMemAddr == nullptr) {
|
||||
if (param->png_mem_addr == nullptr || param->image_mem_addr == nullptr) {
|
||||
LOG_ERROR(Lib_Png, "invalid image address!");
|
||||
return ORBIS_PNG_DEC_ERROR_INVALID_ADDR;
|
||||
}
|
||||
LOG_TRACE(Lib_Png,
|
||||
"pngMemSize = {} , imageMemSize = {} , pixelFormat = {} , alphaValue = {} , "
|
||||
"imagePitch = {}",
|
||||
param->pngMemSize, param->imageMemSize, param->pixelFormat, param->alphaValue,
|
||||
param->imagePitch);
|
||||
param->png_mem_size, param->image_mem_size, int(param->pixel_format),
|
||||
param->alpha_value, param->image_pitch);
|
||||
|
||||
auto pngh = (PngHandler*)handle;
|
||||
|
||||
struct pngstruct {
|
||||
const u8* data;
|
||||
size_t size;
|
||||
u64 offset;
|
||||
} pngdata = {
|
||||
.data = (const u8*)param->pngMemAddr,
|
||||
.size = param->pngMemSize,
|
||||
const auto pngdata = PngStruct{
|
||||
.data = param->png_mem_addr,
|
||||
.size = param->png_mem_size,
|
||||
.offset = 0,
|
||||
};
|
||||
|
||||
// Read png from memory
|
||||
png_set_read_fn(pngh->png_ptr, (void*)&pngdata,
|
||||
[](png_structp ps, png_bytep data, png_size_t len) {
|
||||
if (len == 0)
|
||||
return;
|
||||
auto pngdata = (pngstruct*)png_get_io_ptr(ps);
|
||||
auto pngdata = (PngStruct*)png_get_io_ptr(ps);
|
||||
::memcpy(data, pngdata->data + pngdata->offset, len);
|
||||
pngdata->offset += len;
|
||||
});
|
||||
|
||||
u32 width, height;
|
||||
int color_type, bit_depth;
|
||||
png_read_info(pngh->png_ptr, pngh->info_ptr);
|
||||
|
||||
width = png_get_image_width(pngh->png_ptr, pngh->info_ptr);
|
||||
height = png_get_image_height(pngh->png_ptr, pngh->info_ptr);
|
||||
color_type = MapPngColor(png_get_color_type(pngh->png_ptr, pngh->info_ptr));
|
||||
bit_depth = png_get_bit_depth(pngh->png_ptr, pngh->info_ptr);
|
||||
const u32 width = png_get_image_width(pngh->png_ptr, pngh->info_ptr);
|
||||
const u32 height = png_get_image_height(pngh->png_ptr, pngh->info_ptr);
|
||||
const auto color_type = MapPngColor(png_get_color_type(pngh->png_ptr, pngh->info_ptr));
|
||||
const auto bit_depth = png_get_bit_depth(pngh->png_ptr, pngh->info_ptr);
|
||||
|
||||
if (imageInfo != nullptr) {
|
||||
imageInfo->bitDepth = bit_depth;
|
||||
imageInfo->imageWidth = width;
|
||||
imageInfo->imageHeight = height;
|
||||
imageInfo->colorSpace = color_type;
|
||||
imageInfo->imageFlag = 0;
|
||||
imageInfo->bit_depth = bit_depth;
|
||||
imageInfo->image_width = width;
|
||||
imageInfo->image_height = height;
|
||||
imageInfo->color_space = color_type;
|
||||
imageInfo->image_flag = OrbisPngDecImageFlag::None;
|
||||
if (png_get_interlace_type(pngh->png_ptr, pngh->info_ptr) == 1) {
|
||||
imageInfo->imageFlag |= OrbisPngDecImageFlag::ORBIS_PNG_DEC_IMAGE_FLAG_ADAM7_INTERLACE;
|
||||
imageInfo->image_flag |= OrbisPngDecImageFlag::Adam7Interlace;
|
||||
}
|
||||
if (png_get_valid(pngh->png_ptr, pngh->info_ptr, PNG_INFO_tRNS)) {
|
||||
|
||||
imageInfo->imageFlag |= ORBIS_PNG_DEC_IMAGE_FLAG_TRNS_CHUNK_EXIST;
|
||||
imageInfo->image_flag |= OrbisPngDecImageFlag::TrnsChunkExist;
|
||||
}
|
||||
}
|
||||
|
||||
if (bit_depth == 16)
|
||||
if (bit_depth == 16) {
|
||||
png_set_strip_16(pngh->png_ptr);
|
||||
if (color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
}
|
||||
if (color_type == OrbisPngDecColorSpace::Clut) {
|
||||
png_set_palette_to_rgb(pngh->png_ptr);
|
||||
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
|
||||
}
|
||||
if (color_type == OrbisPngDecColorSpace::Grayscale && bit_depth < 8) {
|
||||
png_set_expand_gray_1_2_4_to_8(pngh->png_ptr);
|
||||
if (png_get_valid(pngh->png_ptr, pngh->info_ptr, PNG_INFO_tRNS))
|
||||
}
|
||||
if (png_get_valid(pngh->png_ptr, pngh->info_ptr, PNG_INFO_tRNS)) {
|
||||
png_set_tRNS_to_alpha(pngh->png_ptr);
|
||||
if (color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||
}
|
||||
if (color_type == OrbisPngDecColorSpace::Grayscale ||
|
||||
color_type == OrbisPngDecColorSpace::GrayscaleAlpha) {
|
||||
png_set_gray_to_rgb(pngh->png_ptr);
|
||||
if (param->pixelFormat == OrbisPngDecPixelFormat::ORBIS_PNG_DEC_PIXEL_FORMAT_B8G8R8A8)
|
||||
}
|
||||
if (param->pixel_format == OrbisPngDecPixelFormat::B8G8R8A8) {
|
||||
png_set_bgr(pngh->png_ptr);
|
||||
if (color_type == PNG_COLOR_TYPE_RGB || color_type == PNG_COLOR_TYPE_GRAY ||
|
||||
color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
png_set_add_alpha(pngh->png_ptr, param->alphaValue, PNG_FILLER_AFTER);
|
||||
}
|
||||
if (color_type == OrbisPngDecColorSpace::Rgb ||
|
||||
color_type == OrbisPngDecColorSpace::Grayscale ||
|
||||
color_type == OrbisPngDecColorSpace::Clut) {
|
||||
png_set_add_alpha(pngh->png_ptr, param->alpha_value, PNG_FILLER_AFTER);
|
||||
}
|
||||
|
||||
int pass = png_set_interlace_handling(pngh->png_ptr);
|
||||
const s32 pass = png_set_interlace_handling(pngh->png_ptr);
|
||||
png_read_update_info(pngh->png_ptr, pngh->info_ptr);
|
||||
|
||||
auto const numChannels = png_get_channels(pngh->png_ptr, pngh->info_ptr);
|
||||
auto horizontal_bytes = numChannels * width;
|
||||
const s32 num_channels = png_get_channels(pngh->png_ptr, pngh->info_ptr);
|
||||
const s32 horizontal_bytes = num_channels * width;
|
||||
const s32 stride = param->image_pitch > 0 ? param->image_pitch : horizontal_bytes;
|
||||
|
||||
int stride = param->imagePitch > 0 ? param->imagePitch : horizontal_bytes;
|
||||
|
||||
for (int j = 0; j < pass; j++) { // interlaced
|
||||
auto ptr = (png_bytep)param->imageMemAddr;
|
||||
for (int j = 0; j < pass; j++) {
|
||||
auto ptr = reinterpret_cast<png_bytep>(param->image_mem_addr);
|
||||
for (int y = 0; y < height; y++) {
|
||||
png_read_row(pngh->png_ptr, ptr, nullptr);
|
||||
ptr += stride;
|
||||
|
@ -196,7 +195,7 @@ s32 PS4_SYSV_ABI scePngDecParseHeader(const OrbisPngDecParseParam* param,
|
|||
}
|
||||
|
||||
u8 header[8];
|
||||
memcpy(header, param->pngMemAddr, 8);
|
||||
memcpy(header, param->png_mem_addr, 8);
|
||||
// Check if the header indicates a valid PNG file
|
||||
if (png_sig_cmp(header, 0, 8)) {
|
||||
LOG_ERROR(Lib_Png, "Memory doesn't contain a valid png file");
|
||||
|
@ -209,18 +208,14 @@ s32 PS4_SYSV_ABI scePngDecParseHeader(const OrbisPngDecParseParam* param,
|
|||
// Create a libpng info structure
|
||||
auto info_ptr = png_create_info_struct(png_ptr);
|
||||
|
||||
struct pngstruct {
|
||||
const u8* data;
|
||||
size_t size;
|
||||
u64 offset;
|
||||
} pngdata = {
|
||||
.data = (const u8*)param->pngMemAddr,
|
||||
.size = param->pngMemSize,
|
||||
const auto pngdata = PngStruct{
|
||||
.data = param->png_mem_addr,
|
||||
.size = param->png_mem_size,
|
||||
.offset = 0,
|
||||
};
|
||||
|
||||
png_set_read_fn(png_ptr, (void*)&pngdata, [](png_structp ps, png_bytep data, png_size_t len) {
|
||||
auto pngdata = (pngstruct*)png_get_io_ptr(ps);
|
||||
auto pngdata = (PngStruct*)png_get_io_ptr(ps);
|
||||
::memcpy(data, pngdata->data + pngdata->offset, len);
|
||||
pngdata->offset += len;
|
||||
});
|
||||
|
@ -229,25 +224,24 @@ s32 PS4_SYSV_ABI scePngDecParseHeader(const OrbisPngDecParseParam* param,
|
|||
// info.
|
||||
png_read_info(png_ptr, info_ptr);
|
||||
|
||||
imageInfo->imageWidth = png_get_image_width(png_ptr, info_ptr);
|
||||
imageInfo->imageHeight = png_get_image_height(png_ptr, info_ptr);
|
||||
imageInfo->colorSpace = MapPngColor(png_get_color_type(png_ptr, info_ptr));
|
||||
imageInfo->bitDepth = png_get_bit_depth(png_ptr, info_ptr);
|
||||
imageInfo->imageFlag = 0;
|
||||
imageInfo->image_width = png_get_image_width(png_ptr, info_ptr);
|
||||
imageInfo->image_height = png_get_image_height(png_ptr, info_ptr);
|
||||
imageInfo->color_space = MapPngColor(png_get_color_type(png_ptr, info_ptr));
|
||||
imageInfo->bit_depth = png_get_bit_depth(png_ptr, info_ptr);
|
||||
imageInfo->image_flag = OrbisPngDecImageFlag::None;
|
||||
if (png_get_interlace_type(png_ptr, info_ptr) == 1) {
|
||||
imageInfo->imageFlag |= OrbisPngDecImageFlag::ORBIS_PNG_DEC_IMAGE_FLAG_ADAM7_INTERLACE;
|
||||
imageInfo->image_flag |= OrbisPngDecImageFlag::Adam7Interlace;
|
||||
}
|
||||
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
|
||||
|
||||
imageInfo->imageFlag |= ORBIS_PNG_DEC_IMAGE_FLAG_TRNS_CHUNK_EXIST;
|
||||
imageInfo->image_flag |= OrbisPngDecImageFlag::TrnsChunkExist;
|
||||
}
|
||||
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, nullptr);
|
||||
LOG_TRACE(
|
||||
Lib_Png,
|
||||
"imageWidth = {} , imageHeight = {} , colorSpace = {} , bitDepth = {} , imageFlag = {}",
|
||||
imageInfo->imageWidth, imageInfo->imageHeight, imageInfo->colorSpace, imageInfo->bitDepth,
|
||||
imageInfo->imageFlag);
|
||||
imageInfo->image_width, imageInfo->image_height, int(imageInfo->color_space),
|
||||
imageInfo->bit_depth, int(imageInfo->image_flag));
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
|
@ -260,8 +254,8 @@ s32 PS4_SYSV_ABI scePngDecQueryMemorySize(const OrbisPngDecCreateParam* param) {
|
|||
LOG_ERROR(Lib_Png, "Invalid attribute! attribute = {}", param->attribute);
|
||||
return ORBIS_PNG_DEC_ERROR_INVALID_ADDR;
|
||||
}
|
||||
if (param->maxImageWidth - 1 > 1000000) {
|
||||
LOG_ERROR(Lib_Png, "Invalid size! width = {}", param->maxImageWidth);
|
||||
if (param->max_image_width - 1 > 1000000) {
|
||||
LOG_ERROR(Lib_Png, "Invalid size! width = {}", param->max_image_width);
|
||||
return ORBIS_PNG_DEC_ERROR_INVALID_SIZE;
|
||||
}
|
||||
return sizeof(PngHandler);
|
||||
|
@ -279,4 +273,4 @@ void RegisterlibScePngDec(Core::Loader::SymbolsResolver* sym) {
|
|||
scePngDecDecodeWithInputControl);
|
||||
};
|
||||
|
||||
} // namespace Libraries::PngDec
|
||||
} // namespace Libraries::PngDec
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "common/enum.h"
|
||||
#include "common/types.h"
|
||||
|
||||
namespace Core::Loader {
|
||||
|
@ -11,59 +12,61 @@ class SymbolsResolver;
|
|||
|
||||
namespace Libraries::PngDec {
|
||||
|
||||
enum OrbisPngDecColorSpace {
|
||||
ORBIS_PNG_DEC_COLOR_SPACE_GRAYSCALE = 2,
|
||||
ORBIS_PNG_DEC_COLOR_SPACE_RGB,
|
||||
ORBIS_PNG_DEC_COLOR_SPACE_CLUT,
|
||||
ORBIS_PNG_DEC_COLOR_SPACE_GRAYSCALE_ALPHA = 18,
|
||||
ORBIS_PNG_DEC_COLOR_SPACE_RGBA
|
||||
enum class OrbisPngDecColorSpace : u16 {
|
||||
Grayscale = 2,
|
||||
Rgb,
|
||||
Clut,
|
||||
GrayscaleAlpha = 18,
|
||||
Rgba,
|
||||
};
|
||||
|
||||
enum OrbisPngDecImageFlag {
|
||||
ORBIS_PNG_DEC_IMAGE_FLAG_ADAM7_INTERLACE = 1,
|
||||
ORBIS_PNG_DEC_IMAGE_FLAG_TRNS_CHUNK_EXIST = 2
|
||||
enum class OrbisPngDecImageFlag : u32 {
|
||||
None = 0,
|
||||
Adam7Interlace = 1,
|
||||
TrnsChunkExist = 2,
|
||||
};
|
||||
DECLARE_ENUM_FLAG_OPERATORS(OrbisPngDecImageFlag)
|
||||
|
||||
enum class OrbisPngDecPixelFormat : u16 {
|
||||
R8G8B8A8 = 0,
|
||||
B8G8R8A8,
|
||||
};
|
||||
|
||||
enum OrbisPngDecPixelFormat {
|
||||
ORBIS_PNG_DEC_PIXEL_FORMAT_R8G8B8A8 = 0,
|
||||
ORBIS_PNG_DEC_PIXEL_FORMAT_B8G8R8A8
|
||||
};
|
||||
|
||||
enum OrbisPngDecAttribute {
|
||||
ORBIS_PNG_DEC_ATTRIBUTE_NONE = 0,
|
||||
ORBIS_PNG_DEC_ATTRIBUTE_BIT_DEPTH_16
|
||||
enum class OrbisPngDecAttribute {
|
||||
None = 0,
|
||||
BitDepth16,
|
||||
};
|
||||
|
||||
struct OrbisPngDecParseParam {
|
||||
const void* pngMemAddr;
|
||||
u32 pngMemSize;
|
||||
const u8* png_mem_addr;
|
||||
u32 png_mem_size;
|
||||
u32 reserved;
|
||||
};
|
||||
|
||||
struct OrbisPngDecImageInfo {
|
||||
u32 imageWidth;
|
||||
u32 imageHeight;
|
||||
u16 colorSpace;
|
||||
u16 bitDepth;
|
||||
u32 imageFlag;
|
||||
u32 image_width;
|
||||
u32 image_height;
|
||||
OrbisPngDecColorSpace color_space;
|
||||
u16 bit_depth;
|
||||
OrbisPngDecImageFlag image_flag;
|
||||
};
|
||||
|
||||
struct OrbisPngDecCreateParam {
|
||||
u32 thisSize;
|
||||
u32 this_size;
|
||||
u32 attribute;
|
||||
u32 maxImageWidth;
|
||||
u32 max_image_width;
|
||||
};
|
||||
|
||||
typedef void* OrbisPngDecHandle;
|
||||
using OrbisPngDecHandle = void*;
|
||||
|
||||
struct OrbisPngDecDecodeParam {
|
||||
const void* pngMemAddr;
|
||||
void* imageMemAddr;
|
||||
u32 pngMemSize;
|
||||
u32 imageMemSize;
|
||||
u16 pixelFormat;
|
||||
u16 alphaValue;
|
||||
u32 imagePitch;
|
||||
const u8* png_mem_addr;
|
||||
u8* image_mem_addr;
|
||||
u32 png_mem_size;
|
||||
u32 image_mem_size;
|
||||
OrbisPngDecPixelFormat pixel_format;
|
||||
u16 alpha_value;
|
||||
u32 image_pitch;
|
||||
};
|
||||
|
||||
s32 PS4_SYSV_ABI scePngDecCreate(const OrbisPngDecCreateParam* param, void* memoryAddress,
|
||||
|
@ -77,4 +80,4 @@ s32 PS4_SYSV_ABI scePngDecParseHeader(const OrbisPngDecParseParam* param,
|
|||
s32 PS4_SYSV_ABI scePngDecQueryMemorySize(const OrbisPngDecCreateParam* param);
|
||||
|
||||
void RegisterlibScePngDec(Core::Loader::SymbolsResolver* sym);
|
||||
} // namespace Libraries::PngDec
|
||||
} // namespace Libraries::PngDec
|
||||
|
|
17
src/core/libraries/libpng/pngdec_error.h
Normal file
17
src/core/libraries/libpng/pngdec_error.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/libraries/error_codes.h"
|
||||
|
||||
// PngDec library
|
||||
constexpr int ORBIS_PNG_DEC_ERROR_INVALID_ADDR = 0x80690001;
|
||||
constexpr int ORBIS_PNG_DEC_ERROR_INVALID_SIZE = 0x80690002;
|
||||
constexpr int ORBIS_PNG_DEC_ERROR_INVALID_PARAM = 0x80690003;
|
||||
constexpr int ORBIS_PNG_DEC_ERROR_INVALID_HANDLE = 0x80690004;
|
||||
constexpr int ORBIS_PNG_DEC_ERROR_INVALID_WORK_MEMORY = 0x80690005;
|
||||
constexpr int ORBIS_PNG_DEC_ERROR_INVALID_DATA = 0x80690010;
|
||||
constexpr int ORBIS_PNG_DEC_ERROR_UNSUPPORT_DATA = 0x80690011;
|
||||
constexpr int ORBIS_PNG_DEC_ERROR_DECODE_ERROR = 0x80690012;
|
||||
constexpr int ORBIS_PNG_DEC_ERROR_FATAL = 0x80690020;
|
|
@ -27,6 +27,7 @@
|
|||
#include "core/libraries/np_trophy/np_trophy.h"
|
||||
#include "core/libraries/pad/pad.h"
|
||||
#include "core/libraries/playgo/playgo.h"
|
||||
#include "core/libraries/playgo/playgo_dialog.h"
|
||||
#include "core/libraries/random/random.h"
|
||||
#include "core/libraries/razor_cpu/razor_cpu.h"
|
||||
#include "core/libraries/remote_play/remoteplay.h"
|
||||
|
@ -74,6 +75,7 @@ void InitHLELibs(Core::Loader::SymbolsResolver* sym) {
|
|||
Libraries::AppContent::RegisterlibSceAppContent(sym);
|
||||
Libraries::PngDec::RegisterlibScePngDec(sym);
|
||||
Libraries::PlayGo::RegisterlibScePlayGo(sym);
|
||||
Libraries::PlayGo::Dialog::RegisterlibScePlayGoDialog(sym);
|
||||
Libraries::Random::RegisterlibSceRandom(sym);
|
||||
Libraries::Usbd::RegisterlibSceUsbd(sym);
|
||||
Libraries::Pad::RegisterlibScePad(sym);
|
||||
|
|
|
@ -23,7 +23,7 @@ constexpr int ORBIS_NET_CTL_HOSTNAME_LEN = 255 + 1;
|
|||
constexpr int ORBIS_NET_CTL_AUTH_NAME_LEN = 127 + 1;
|
||||
constexpr int ORBIS_NET_CTL_IPV4_ADDR_STR_LEN = 16;
|
||||
|
||||
typedef union OrbisNetCtlInfo {
|
||||
union OrbisNetCtlInfo {
|
||||
u32 device;
|
||||
OrbisNetEtherAddr ether_addr;
|
||||
u32 mtu;
|
||||
|
@ -45,7 +45,7 @@ typedef union OrbisNetCtlInfo {
|
|||
u32 http_proxy_config;
|
||||
char http_proxy_server[ORBIS_NET_CTL_HOSTNAME_LEN];
|
||||
u16 http_proxy_port;
|
||||
} SceNetCtlInfo;
|
||||
};
|
||||
|
||||
// GetInfo codes
|
||||
constexpr int ORBIS_NET_CTL_INFO_DEVICE = 1;
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "ngs2.h"
|
||||
#include "ngs2_error.h"
|
||||
#include "ngs2_impl.h"
|
||||
|
||||
#include "common/logging/log.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/libs.h"
|
||||
#include "core/libraries/ngs2/ngs2.h"
|
||||
#include "core/libraries/ngs2/ngs2_error.h"
|
||||
#include "core/libraries/ngs2/ngs2_impl.h"
|
||||
|
||||
namespace Libraries::Ngs2 {
|
||||
|
||||
|
@ -416,4 +415,4 @@ void RegisterlibSceNgs2(Core::Loader::SymbolsResolver* sym) {
|
|||
LIB_FUNCTION("AbYvTOZ8Pts", "libSceNgs2", 1, "libSceNgs2", 1, 1, sceNgs2VoiceRunCommands);
|
||||
};
|
||||
|
||||
} // namespace Libraries::Ngs2
|
||||
} // namespace Libraries::Ngs2
|
||||
|
|
|
@ -3,10 +3,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "common/types.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
#include "common/types.h"
|
||||
|
||||
namespace Core::Loader {
|
||||
class SymbolsResolver;
|
||||
|
@ -18,7 +16,9 @@ class Ngs2;
|
|||
|
||||
using SceNgs2Handle = Ngs2*;
|
||||
|
||||
enum SceNgs2HandleType { SCE_NGS2_HANDLE_TYPE_SYSTEM = 0 };
|
||||
enum class SceNgs2HandleType : u32 {
|
||||
System = 0,
|
||||
};
|
||||
|
||||
struct Ngs2Handle {
|
||||
void* selfPointer;
|
||||
|
@ -69,4 +69,5 @@ struct StackBuffer {
|
|||
};
|
||||
|
||||
void RegisterlibSceNgs2(Core::Loader::SymbolsResolver* sym);
|
||||
} // namespace Libraries::Ngs2
|
||||
|
||||
} // namespace Libraries::Ngs2
|
||||
|
|
|
@ -971,12 +971,11 @@ int PS4_SYSV_ABI sceNpGetGamePresenceStatusA() {
|
|||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceNpGetNpId(OrbisUserServiceUserId userId, OrbisNpId* npId) {
|
||||
LOG_INFO(Lib_NpManager, "userId {}", userId);
|
||||
std::string name = Config::getUserName();
|
||||
// Fill the unused stuffs to 0
|
||||
memset(npId, 0, sizeof(*npId));
|
||||
strcpy(npId->handle.data, name.c_str());
|
||||
int PS4_SYSV_ABI sceNpGetNpId(OrbisUserServiceUserId user_id, OrbisNpId* np_id) {
|
||||
LOG_INFO(Lib_NpManager, "user_id {}", user_id);
|
||||
const auto name = Config::getUserName();
|
||||
std::memset(np_id, 0, sizeof(OrbisNpId));
|
||||
name.copy(np_id->handle.data, sizeof(np_id->handle.data));
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
|
@ -985,12 +984,11 @@ int PS4_SYSV_ABI sceNpGetNpReachabilityState() {
|
|||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceNpGetOnlineId(s32 userId, OrbisNpOnlineId* onlineId) {
|
||||
LOG_DEBUG(Lib_NpManager, "userId {}", userId);
|
||||
std::string name = Config::getUserName();
|
||||
// Fill the unused stuffs to 0
|
||||
memset(onlineId, 0, sizeof(*onlineId));
|
||||
strcpy(onlineId->data, name.c_str());
|
||||
int PS4_SYSV_ABI sceNpGetOnlineId(s32 user_id, OrbisNpOnlineId* online_id) {
|
||||
LOG_DEBUG(Lib_NpManager, "user_id {}", user_id);
|
||||
const auto name = Config::getUserName();
|
||||
std::memset(online_id, 0, sizeof(OrbisNpOnlineId));
|
||||
name.copy(online_id->data, sizeof(online_id->data));
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
|
@ -1005,7 +1003,7 @@ int PS4_SYSV_ABI sceNpGetParentalControlInfoA() {
|
|||
}
|
||||
|
||||
int PS4_SYSV_ABI sceNpGetState(s32 userId, OrbisNpState* state) {
|
||||
*state = ORBIS_NP_STATE_SIGNED_OUT;
|
||||
*state = OrbisNpState::SignedOut;
|
||||
LOG_DEBUG(Lib_NpManager, "Signed out");
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
@ -2518,7 +2516,7 @@ struct NpStateCallbackForNpToolkit {
|
|||
NpStateCallbackForNpToolkit NpStateCbForNp;
|
||||
|
||||
int PS4_SYSV_ABI sceNpCheckCallbackForLib() {
|
||||
Core::ExecuteGuest(NpStateCbForNp.func, 1, ORBIS_NP_STATE_SIGNED_OUT, NpStateCbForNp.userdata);
|
||||
Core::ExecuteGuest(NpStateCbForNp.func, 1, OrbisNpState::SignedOut, NpStateCbForNp.userdata);
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,18 +13,14 @@ namespace Libraries::NpManager {
|
|||
|
||||
constexpr int ORBIS_NP_ERROR_SIGNED_OUT = 0x80550006;
|
||||
|
||||
enum OrbisNpState {
|
||||
ORBIS_NP_STATE_UNKNOWN = 0,
|
||||
ORBIS_NP_STATE_SIGNED_OUT,
|
||||
ORBIS_NP_STATE_SIGNED_IN
|
||||
};
|
||||
enum class OrbisNpState : u32 { Unknown = 0, SignedOut, SignedIn };
|
||||
|
||||
using OrbisNpStateCallbackForNpToolkit = PS4_SYSV_ABI void (*)(s32 userId, OrbisNpState state,
|
||||
void* userdata);
|
||||
|
||||
constexpr int ORBIS_NP_ONLINEID_MAX_LENGTH = 16;
|
||||
|
||||
typedef int OrbisUserServiceUserId;
|
||||
using OrbisUserServiceUserId = s32;
|
||||
|
||||
struct OrbisNpOnlineId {
|
||||
char data[ORBIS_NP_ONLINEID_MAX_LENGTH];
|
||||
|
@ -542,4 +538,4 @@ int PS4_SYSV_ABI sceNpRegisterStateCallbackForToolkit(OrbisNpStateCallbackForNpT
|
|||
int PS4_SYSV_ABI sceNpUnregisterStateCallbackForToolkit();
|
||||
|
||||
void RegisterlibSceNpManager(Core::Loader::SymbolsResolver* sym);
|
||||
} // namespace Libraries::NpManager
|
||||
} // namespace Libraries::NpManager
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue