Compare commits
12 Commits
Author | SHA1 | Date |
---|---|---|
georgemoralis | 1dfe491b7d | |
georgemoralis | 3f987b375f | |
georgemoralis | b1a66807a2 | |
georgemoralis | 24194e738f | |
georgemoralis | 20bd6b4c4b | |
georgemoralis | 2bf8eea333 | |
georgemoralis | 1613e22d99 | |
georgemoralis | 5c7545198e | |
georgemoralis | ebf3a27998 | |
georgemoralis | 2c1d455942 | |
georgemoralis | 27f6f6bfd6 | |
georgemoralis | 7ef3fe608a |
|
@ -55,3 +55,6 @@
|
||||||
[submodule "externals/zlib-ng-win"]
|
[submodule "externals/zlib-ng-win"]
|
||||||
path = externals/zlib-ng-win
|
path = externals/zlib-ng-win
|
||||||
url = https://github.com/shadps4-emu/ext-zlib-ng-win.git
|
url = https://github.com/shadps4-emu/ext-zlib-ng-win.git
|
||||||
|
[submodule "third-party/spdlog"]
|
||||||
|
path = third-party/spdlog
|
||||||
|
url = https://github.com/gabime/spdlog
|
||||||
|
|
|
@ -95,8 +95,16 @@ include_directories(src)
|
||||||
|
|
||||||
set(LIBRARIES src/core/libraries/library_common.h
|
set(LIBRARIES src/core/libraries/library_common.h
|
||||||
src/core/libraries/error_codes.h
|
src/core/libraries/error_codes.h
|
||||||
|
src/core/libraries/libscecommondialog.cpp
|
||||||
|
src/core/libraries/libscecommondialog.h
|
||||||
src/core/libraries/libscegnmdriver.cpp
|
src/core/libraries/libscegnmdriver.cpp
|
||||||
src/core/libraries/libscegnmdriver.h
|
src/core/libraries/libscegnmdriver.h
|
||||||
|
src/core/libraries/libscemsgdialog.cpp
|
||||||
|
src/core/libraries/libscemsgdialog.h
|
||||||
|
src/core/libraries/libscesystemservice.cpp
|
||||||
|
src/core/libraries/libscesystemservice.h
|
||||||
|
src/core/libraries/libsceuserservice.cpp
|
||||||
|
src/core/libraries/libsceuserservice.h
|
||||||
)
|
)
|
||||||
set(LIBC_SOURCES src/core/hle/libraries/libc/libc.cpp
|
set(LIBC_SOURCES src/core/hle/libraries/libc/libc.cpp
|
||||||
src/core/hle/libraries/libc/libc.h
|
src/core/hle/libraries/libc/libc.h
|
||||||
|
@ -113,18 +121,11 @@ set(LIBC_SOURCES src/core/hle/libraries/libc/libc.cpp
|
||||||
src/core/hle/libraries/libc/libc_stdlib.cpp
|
src/core/hle/libraries/libc/libc_stdlib.cpp
|
||||||
src/core/hle/libraries/libc/libc_stdlib.h
|
src/core/hle/libraries/libc/libc_stdlib.h
|
||||||
)
|
)
|
||||||
set(USERSERVICE_SOURCES src/core/hle/libraries/libuserservice/libuserservice.cpp
|
|
||||||
src/core/hle/libraries/libuserservice/libuserservice.h
|
|
||||||
)
|
|
||||||
|
|
||||||
set(PAD_SOURCES src/core/hle/libraries/libpad/pad.cpp
|
set(PAD_SOURCES src/core/hle/libraries/libpad/pad.cpp
|
||||||
src/core/hle/libraries/libpad/pad.h
|
src/core/hle/libraries/libpad/pad.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(SYSTEMSERVICE_SOURCES src/core/hle/libraries/libsystemservice/system_service.cpp
|
|
||||||
src/core/hle/libraries/libsystemservice/system_service.h
|
|
||||||
)
|
|
||||||
|
|
||||||
set(FILESYSTEM_SOURCES src/core/hle/libraries/libkernel/file_system.cpp
|
set(FILESYSTEM_SOURCES src/core/hle/libraries/libkernel/file_system.cpp
|
||||||
src/core/hle/libraries/libkernel/file_system.h
|
src/core/hle/libraries/libkernel/file_system.h
|
||||||
src/core/file_sys/fs.cpp
|
src/core/file_sys/fs.cpp
|
||||||
|
@ -172,21 +173,7 @@ qt_add_resources(RESOURCE_FILES src/shadps4.qrc)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(COMMON src/common/logging/backend.cpp
|
set(COMMON src/common/debug.h
|
||||||
src/common/logging/backend.h
|
|
||||||
src/common/logging/filter.cpp
|
|
||||||
src/common/logging/filter.h
|
|
||||||
src/common/logging/formatter.h
|
|
||||||
src/common/logging/log_entry.h
|
|
||||||
src/common/logging/log.h
|
|
||||||
src/common/logging/text_formatter.cpp
|
|
||||||
src/common/logging/text_formatter.h
|
|
||||||
src/common/logging/types.h
|
|
||||||
src/common/assert.cpp
|
|
||||||
src/common/assert.h
|
|
||||||
src/common/bounded_threadsafe_queue.h
|
|
||||||
src/common/concepts.h
|
|
||||||
src/common/debug.h
|
|
||||||
src/common/disassembler.cpp
|
src/common/disassembler.cpp
|
||||||
src/common/disassembler.h
|
src/common/disassembler.h
|
||||||
src/common/discord.cpp
|
src/common/discord.cpp
|
||||||
|
@ -194,22 +181,22 @@ set(COMMON src/common/logging/backend.cpp
|
||||||
src/common/endian.h
|
src/common/endian.h
|
||||||
src/common/io_file.cpp
|
src/common/io_file.cpp
|
||||||
src/common/io_file.h
|
src/common/io_file.h
|
||||||
src/common/error.cpp
|
|
||||||
src/common/error.h
|
|
||||||
src/common/native_clock.cpp
|
src/common/native_clock.cpp
|
||||||
src/common/native_clock.h
|
src/common/native_clock.h
|
||||||
src/common/path_util.cpp
|
|
||||||
src/common/path_util.h
|
|
||||||
src/common/rdtsc.cpp
|
src/common/rdtsc.cpp
|
||||||
src/common/rdtsc.h
|
src/common/rdtsc.h
|
||||||
src/common/singleton.h
|
src/common/singleton.h
|
||||||
src/common/string_util.cpp
|
src/common/string_util.cpp
|
||||||
src/common/string_util.h
|
src/common/string_util.h
|
||||||
src/common/thread.cpp
|
|
||||||
src/common/thread.h
|
|
||||||
src/common/types.h
|
src/common/types.h
|
||||||
src/common/uint128.h
|
src/common/uint128.h
|
||||||
src/common/version.h
|
src/common/version.h
|
||||||
|
src/common/fs_file.cpp
|
||||||
|
src/common/fs_file.h
|
||||||
|
src/common/log.cpp
|
||||||
|
src/common/log.h
|
||||||
|
src/common/io_file.cpp
|
||||||
|
src/common/io_file.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(CORE src/core/loader.cpp
|
set(CORE src/core/loader.cpp
|
||||||
|
@ -245,9 +232,7 @@ qt_add_executable(shadps4
|
||||||
else()
|
else()
|
||||||
add_executable(shadps4
|
add_executable(shadps4
|
||||||
${LIBC_SOURCES}
|
${LIBC_SOURCES}
|
||||||
${USERSERVICE_SOURCES}
|
|
||||||
${PAD_SOURCES}
|
${PAD_SOURCES}
|
||||||
${SYSTEMSERVICE_SOURCES}
|
|
||||||
${FILESYSTEM_SOURCES}
|
${FILESYSTEM_SOURCES}
|
||||||
${HOST_SOURCES}
|
${HOST_SOURCES}
|
||||||
${LIBRARIES}
|
${LIBRARIES}
|
||||||
|
@ -302,8 +287,6 @@ add_executable(shadps4
|
||||||
src/core/PS4/GPU/tile_manager.h
|
src/core/PS4/GPU/tile_manager.h
|
||||||
src/core/hle/libraries/libkernel/time_management.cpp
|
src/core/hle/libraries/libkernel/time_management.cpp
|
||||||
src/core/hle/libraries/libkernel/time_management.h
|
src/core/hle/libraries/libkernel/time_management.h
|
||||||
src/core/tls.cpp
|
|
||||||
src/core/tls.h
|
|
||||||
${COMMON}
|
${COMMON}
|
||||||
${CORE}
|
${CORE}
|
||||||
${CRYPTO}
|
${CRYPTO}
|
||||||
|
@ -314,7 +297,7 @@ endif()
|
||||||
|
|
||||||
create_target_directory_groups(shadps4)
|
create_target_directory_groups(shadps4)
|
||||||
|
|
||||||
target_link_libraries(shadps4 PRIVATE magic_enum::magic_enum fmt::fmt toml11::toml11)
|
target_link_libraries(shadps4 PRIVATE magic_enum::magic_enum fmt::fmt toml11::toml11 spdlog::spdlog)
|
||||||
target_link_libraries(shadps4 PRIVATE discord-rpc vulkan-1 xxhash Zydis)
|
target_link_libraries(shadps4 PRIVATE discord-rpc vulkan-1 xxhash Zydis)
|
||||||
|
|
||||||
if(NOT ENABLE_QT_GUI)
|
if(NOT ENABLE_QT_GUI)
|
||||||
|
|
|
@ -12,22 +12,19 @@ namespace Config {
|
||||||
bool isNeo = false;
|
bool isNeo = false;
|
||||||
u32 screenWidth = 1280;
|
u32 screenWidth = 1280;
|
||||||
u32 screenHeight = 720;
|
u32 screenHeight = 720;
|
||||||
std::string logFilter;
|
u32 logLevel = 0; // TRACE = 0 , DEBUG = 1 , INFO = 2 , WARN = 3 , ERROR = 4 , CRITICAL = 5, OFF = 6
|
||||||
|
|
||||||
bool isNeoMode() {
|
bool isNeoMode() {
|
||||||
return isNeo;
|
return isNeo;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 getScreenWidth() {
|
u32 getScreenWidth() {
|
||||||
return screenWidth;
|
return screenWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 getScreenHeight() {
|
u32 getScreenHeight() {
|
||||||
return screenHeight;
|
return screenHeight;
|
||||||
}
|
}
|
||||||
|
u32 getLogLevel() {
|
||||||
std::string getLogFilter() {
|
return logLevel;
|
||||||
return logFilter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void load(const std::filesystem::path& path) {
|
void load(const std::filesystem::path& path) {
|
||||||
|
@ -53,7 +50,7 @@ void load(const std::filesystem::path& path) {
|
||||||
auto general = generalResult.unwrap();
|
auto general = generalResult.unwrap();
|
||||||
|
|
||||||
isNeo = toml::find_or<toml::boolean>(general, "isPS4Pro", false);
|
isNeo = toml::find_or<toml::boolean>(general, "isPS4Pro", false);
|
||||||
logFilter = toml::find_or<toml::string>(general, "logFilter", "");
|
logLevel = toml::find_or<toml::integer>(general, "logLevel", false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (data.contains("GPU")) {
|
if (data.contains("GPU")) {
|
||||||
|
@ -65,6 +62,7 @@ void load(const std::filesystem::path& path) {
|
||||||
screenHeight = toml::find_or<toml::integer>(general, "screenHeight", false);
|
screenHeight = toml::find_or<toml::integer>(general, "screenHeight", false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
int k = 0;
|
||||||
}
|
}
|
||||||
void save(const std::filesystem::path& path) {
|
void save(const std::filesystem::path& path) {
|
||||||
toml::basic_value<toml::preserve_comments> data;
|
toml::basic_value<toml::preserve_comments> data;
|
||||||
|
@ -86,7 +84,7 @@ void save(const std::filesystem::path& path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
data["General"]["isPS4Pro"] = isNeo;
|
data["General"]["isPS4Pro"] = isNeo;
|
||||||
data["General"]["logFilter"] = logFilter;
|
data["General"]["logLevel"] = logLevel;
|
||||||
data["GPU"]["screenWidth"] = screenWidth;
|
data["GPU"]["screenWidth"] = screenWidth;
|
||||||
data["GPU"]["screenHeight"] = screenHeight;
|
data["GPU"]["screenHeight"] = screenHeight;
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ void load(const std::filesystem::path& path);
|
||||||
void save(const std::filesystem::path& path);
|
void save(const std::filesystem::path& path);
|
||||||
|
|
||||||
bool isNeoMode();
|
bool isNeoMode();
|
||||||
std::string getLogFilter();
|
u32 getLogLevel();
|
||||||
|
|
||||||
u32 getScreenWidth();
|
u32 getScreenWidth();
|
||||||
u32 getScreenHeight();
|
u32 getScreenHeight();
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/logging/backend.h"
|
|
||||||
|
|
||||||
#define Crash() __asm__ __volatile__("int $3")
|
|
||||||
|
|
||||||
void assert_fail_impl() {
|
|
||||||
Common::Log::Stop();
|
|
||||||
Crash();
|
|
||||||
}
|
|
||||||
|
|
||||||
[[noreturn]] void unreachable_impl() {
|
|
||||||
Common::Log::Stop();
|
|
||||||
Crash();
|
|
||||||
throw std::runtime_error("Unreachable code");
|
|
||||||
}
|
|
|
@ -1,84 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: 2013 Dolphin Emulator Project
|
|
||||||
// SPDX-FileCopyrightText: 2014 Citra Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "common/logging/log.h"
|
|
||||||
|
|
||||||
// Sometimes we want to try to continue even after hitting an assert.
|
|
||||||
// However touching this file yields a global recompilation as this header is included almost
|
|
||||||
// everywhere. So let's just move the handling of the failed assert to a single cpp file.
|
|
||||||
|
|
||||||
void assert_fail_impl();
|
|
||||||
[[noreturn]] void unreachable_impl();
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#define SHAD_NO_INLINE __declspec(noinline)
|
|
||||||
#else
|
|
||||||
#define SHAD_NO_INLINE __attribute__((noinline))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ASSERT(_a_) \
|
|
||||||
([&]() SHAD_NO_INLINE { \
|
|
||||||
if (!(_a_)) [[unlikely]] { \
|
|
||||||
LOG_CRITICAL(Debug, "Assertion Failed!"); \
|
|
||||||
assert_fail_impl(); \
|
|
||||||
} \
|
|
||||||
}())
|
|
||||||
|
|
||||||
#define ASSERT_MSG(_a_, ...) \
|
|
||||||
([&]() SHAD_NO_INLINE { \
|
|
||||||
if (!(_a_)) [[unlikely]] { \
|
|
||||||
LOG_CRITICAL(Debug, "Assertion Failed!\n" __VA_ARGS__); \
|
|
||||||
assert_fail_impl(); \
|
|
||||||
} \
|
|
||||||
}())
|
|
||||||
|
|
||||||
#define UNREACHABLE() \
|
|
||||||
do { \
|
|
||||||
LOG_CRITICAL(Debug, "Unreachable code!"); \
|
|
||||||
unreachable_impl(); \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define UNREACHABLE_MSG(...) \
|
|
||||||
do { \
|
|
||||||
LOG_CRITICAL(Debug, "Unreachable code!\n" __VA_ARGS__); \
|
|
||||||
unreachable_impl(); \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
|
||||||
#define DEBUG_ASSERT(_a_) ASSERT(_a_)
|
|
||||||
#define DEBUG_ASSERT_MSG(_a_, ...) ASSERT_MSG(_a_, __VA_ARGS__)
|
|
||||||
#else // not debug
|
|
||||||
#define DEBUG_ASSERT(_a_) \
|
|
||||||
do { \
|
|
||||||
} while (0)
|
|
||||||
#define DEBUG_ASSERT_MSG(_a_, _desc_, ...) \
|
|
||||||
do { \
|
|
||||||
} while (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define UNIMPLEMENTED() ASSERT_MSG(false, "Unimplemented code!")
|
|
||||||
#define UNIMPLEMENTED_MSG(...) ASSERT_MSG(false, __VA_ARGS__)
|
|
||||||
|
|
||||||
#define UNIMPLEMENTED_IF(cond) ASSERT_MSG(!(cond), "Unimplemented code!")
|
|
||||||
#define UNIMPLEMENTED_IF_MSG(cond, ...) ASSERT_MSG(!(cond), __VA_ARGS__)
|
|
||||||
|
|
||||||
// If the assert is ignored, execute _b_
|
|
||||||
#define ASSERT_OR_EXECUTE(_a_, _b_) \
|
|
||||||
do { \
|
|
||||||
ASSERT(_a_); \
|
|
||||||
if (!(_a_)) [[unlikely]] { \
|
|
||||||
_b_ \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
// If the assert is ignored, execute _b_
|
|
||||||
#define ASSERT_OR_EXECUTE_MSG(_a_, _b_, ...) \
|
|
||||||
do { \
|
|
||||||
ASSERT_MSG(_a_, __VA_ARGS__); \
|
|
||||||
if (!(_a_)) [[unlikely]] { \
|
|
||||||
_b_ \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
|
@ -1,248 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <atomic>
|
|
||||||
#include <condition_variable>
|
|
||||||
#include <cstddef>
|
|
||||||
#include <memory>
|
|
||||||
#include <mutex>
|
|
||||||
#include <new>
|
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
|
|
||||||
namespace detail {
|
|
||||||
constexpr std::size_t DefaultCapacity = 0x1000;
|
|
||||||
} // namespace detail
|
|
||||||
|
|
||||||
template <typename T, std::size_t Capacity = detail::DefaultCapacity>
|
|
||||||
class SPSCQueue {
|
|
||||||
static_assert((Capacity & (Capacity - 1)) == 0, "Capacity must be a power of two.");
|
|
||||||
|
|
||||||
public:
|
|
||||||
template <typename... Args>
|
|
||||||
bool TryEmplace(Args&&... args) {
|
|
||||||
return Emplace<PushMode::Try>(std::forward<Args>(args)...);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename... Args>
|
|
||||||
void EmplaceWait(Args&&... args) {
|
|
||||||
Emplace<PushMode::Wait>(std::forward<Args>(args)...);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TryPop(T& t) {
|
|
||||||
return Pop<PopMode::Try>(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PopWait(T& t) {
|
|
||||||
Pop<PopMode::Wait>(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PopWait(T& t, std::stop_token stop_token) {
|
|
||||||
Pop<PopMode::WaitWithStopToken>(t, stop_token);
|
|
||||||
}
|
|
||||||
|
|
||||||
T PopWait() {
|
|
||||||
T t;
|
|
||||||
Pop<PopMode::Wait>(t);
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
|
|
||||||
T PopWait(std::stop_token stop_token) {
|
|
||||||
T t;
|
|
||||||
Pop<PopMode::WaitWithStopToken>(t, stop_token);
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
enum class PushMode {
|
|
||||||
Try,
|
|
||||||
Wait,
|
|
||||||
Count,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class PopMode {
|
|
||||||
Try,
|
|
||||||
Wait,
|
|
||||||
WaitWithStopToken,
|
|
||||||
Count,
|
|
||||||
};
|
|
||||||
|
|
||||||
template <PushMode Mode, typename... Args>
|
|
||||||
bool Emplace(Args&&... args) {
|
|
||||||
const std::size_t write_index = m_write_index.load(std::memory_order::relaxed);
|
|
||||||
|
|
||||||
if constexpr (Mode == PushMode::Try) {
|
|
||||||
// Check if we have free slots to write to.
|
|
||||||
if ((write_index - m_read_index.load(std::memory_order::acquire)) == Capacity) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if constexpr (Mode == PushMode::Wait) {
|
|
||||||
// Wait until we have free slots to write to.
|
|
||||||
std::unique_lock lock{producer_cv_mutex};
|
|
||||||
producer_cv.wait(lock, [this, write_index] {
|
|
||||||
return (write_index - m_read_index.load(std::memory_order::acquire)) < Capacity;
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
static_assert(Mode < PushMode::Count, "Invalid PushMode.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determine the position to write to.
|
|
||||||
const std::size_t pos = write_index % Capacity;
|
|
||||||
|
|
||||||
// Emplace into the queue.
|
|
||||||
new (std::addressof(m_data[pos])) T(std::forward<Args>(args)...);
|
|
||||||
|
|
||||||
// Increment the write index.
|
|
||||||
++m_write_index;
|
|
||||||
|
|
||||||
// Notify the consumer that we have pushed into the queue.
|
|
||||||
std::scoped_lock lock{consumer_cv_mutex};
|
|
||||||
consumer_cv.notify_one();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <PopMode Mode>
|
|
||||||
bool Pop(T& t, [[maybe_unused]] std::stop_token stop_token = {}) {
|
|
||||||
const std::size_t read_index = m_read_index.load(std::memory_order::relaxed);
|
|
||||||
|
|
||||||
if constexpr (Mode == PopMode::Try) {
|
|
||||||
// Check if the queue is empty.
|
|
||||||
if (read_index == m_write_index.load(std::memory_order::acquire)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if constexpr (Mode == PopMode::Wait) {
|
|
||||||
// Wait until the queue is not empty.
|
|
||||||
std::unique_lock lock{consumer_cv_mutex};
|
|
||||||
consumer_cv.wait(lock, [this, read_index] {
|
|
||||||
return read_index != m_write_index.load(std::memory_order::acquire);
|
|
||||||
});
|
|
||||||
} else if constexpr (Mode == PopMode::WaitWithStopToken) {
|
|
||||||
// Wait until the queue is not empty.
|
|
||||||
std::unique_lock lock{consumer_cv_mutex};
|
|
||||||
consumer_cv.wait(lock, stop_token, [this, read_index] {
|
|
||||||
return read_index != m_write_index.load(std::memory_order::acquire);
|
|
||||||
});
|
|
||||||
if (stop_token.stop_requested()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
static_assert(Mode < PopMode::Count, "Invalid PopMode.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determine the position to read from.
|
|
||||||
const std::size_t pos = read_index % Capacity;
|
|
||||||
|
|
||||||
// Pop the data off the queue, moving it.
|
|
||||||
t = std::move(m_data[pos]);
|
|
||||||
|
|
||||||
// Increment the read index.
|
|
||||||
++m_read_index;
|
|
||||||
|
|
||||||
// Notify the producer that we have popped off the queue.
|
|
||||||
std::scoped_lock lock{producer_cv_mutex};
|
|
||||||
producer_cv.notify_one();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
alignas(128) std::atomic_size_t m_read_index{0};
|
|
||||||
alignas(128) std::atomic_size_t m_write_index{0};
|
|
||||||
|
|
||||||
std::array<T, Capacity> m_data;
|
|
||||||
|
|
||||||
std::condition_variable_any producer_cv;
|
|
||||||
std::mutex producer_cv_mutex;
|
|
||||||
std::condition_variable_any consumer_cv;
|
|
||||||
std::mutex consumer_cv_mutex;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T, std::size_t Capacity = detail::DefaultCapacity>
|
|
||||||
class MPSCQueue {
|
|
||||||
public:
|
|
||||||
template <typename... Args>
|
|
||||||
bool TryEmplace(Args&&... args) {
|
|
||||||
std::scoped_lock lock{write_mutex};
|
|
||||||
return spsc_queue.TryEmplace(std::forward<Args>(args)...);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename... Args>
|
|
||||||
void EmplaceWait(Args&&... args) {
|
|
||||||
std::scoped_lock lock{write_mutex};
|
|
||||||
spsc_queue.EmplaceWait(std::forward<Args>(args)...);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TryPop(T& t) {
|
|
||||||
return spsc_queue.TryPop(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PopWait(T& t) {
|
|
||||||
spsc_queue.PopWait(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PopWait(T& t, std::stop_token stop_token) {
|
|
||||||
spsc_queue.PopWait(t, stop_token);
|
|
||||||
}
|
|
||||||
|
|
||||||
T PopWait() {
|
|
||||||
return spsc_queue.PopWait();
|
|
||||||
}
|
|
||||||
|
|
||||||
T PopWait(std::stop_token stop_token) {
|
|
||||||
return spsc_queue.PopWait(stop_token);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
SPSCQueue<T, Capacity> spsc_queue;
|
|
||||||
std::mutex write_mutex;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T, std::size_t Capacity = detail::DefaultCapacity>
|
|
||||||
class MPMCQueue {
|
|
||||||
public:
|
|
||||||
template <typename... Args>
|
|
||||||
bool TryEmplace(Args&&... args) {
|
|
||||||
std::scoped_lock lock{write_mutex};
|
|
||||||
return spsc_queue.TryEmplace(std::forward<Args>(args)...);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename... Args>
|
|
||||||
void EmplaceWait(Args&&... args) {
|
|
||||||
std::scoped_lock lock{write_mutex};
|
|
||||||
spsc_queue.EmplaceWait(std::forward<Args>(args)...);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TryPop(T& t) {
|
|
||||||
std::scoped_lock lock{read_mutex};
|
|
||||||
return spsc_queue.TryPop(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PopWait(T& t) {
|
|
||||||
std::scoped_lock lock{read_mutex};
|
|
||||||
spsc_queue.PopWait(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PopWait(T& t, std::stop_token stop_token) {
|
|
||||||
std::scoped_lock lock{read_mutex};
|
|
||||||
spsc_queue.PopWait(t, stop_token);
|
|
||||||
}
|
|
||||||
|
|
||||||
T PopWait() {
|
|
||||||
std::scoped_lock lock{read_mutex};
|
|
||||||
return spsc_queue.PopWait();
|
|
||||||
}
|
|
||||||
|
|
||||||
T PopWait(std::stop_token stop_token) {
|
|
||||||
std::scoped_lock lock{read_mutex};
|
|
||||||
return spsc_queue.PopWait(stop_token);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
SPSCQueue<T, Capacity> spsc_queue;
|
|
||||||
std::mutex write_mutex;
|
|
||||||
std::mutex read_mutex;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Common
|
|
|
@ -1,57 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: 2013 Dolphin Emulator Project
|
|
||||||
// SPDX-FileCopyrightText: 2014 Citra Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#include <cstddef>
|
|
||||||
#ifdef _WIN32
|
|
||||||
#include <windows.h>
|
|
||||||
#else
|
|
||||||
#include <cerrno>
|
|
||||||
#include <cstring>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "common/error.h"
|
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
|
|
||||||
std::string NativeErrorToString(int e) {
|
|
||||||
#ifdef _WIN32
|
|
||||||
LPSTR err_str;
|
|
||||||
|
|
||||||
DWORD res = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
|
||||||
FORMAT_MESSAGE_IGNORE_INSERTS,
|
|
||||||
nullptr, e, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
|
||||||
reinterpret_cast<LPSTR>(&err_str), 1, nullptr);
|
|
||||||
if (!res) {
|
|
||||||
return "(FormatMessageA failed to format error)";
|
|
||||||
}
|
|
||||||
std::string ret(err_str);
|
|
||||||
LocalFree(err_str);
|
|
||||||
return ret;
|
|
||||||
#else
|
|
||||||
char err_str[255];
|
|
||||||
#if defined(__GLIBC__) && (_GNU_SOURCE || (_POSIX_C_SOURCE < 200112L && _XOPEN_SOURCE < 600)) || \
|
|
||||||
defined(ANDROID)
|
|
||||||
// Thread safe (GNU-specific)
|
|
||||||
const char* str = strerror_r(e, err_str, sizeof(err_str));
|
|
||||||
return std::string(str);
|
|
||||||
#else
|
|
||||||
// Thread safe (XSI-compliant)
|
|
||||||
int second_err = strerror_r(e, err_str, sizeof(err_str));
|
|
||||||
if (second_err != 0) {
|
|
||||||
return "(strerror_r failed to format error)";
|
|
||||||
}
|
|
||||||
return std::string(err_str);
|
|
||||||
#endif // GLIBC etc.
|
|
||||||
#endif // _WIN32
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string GetLastErrorMsg() {
|
|
||||||
#ifdef _WIN32
|
|
||||||
return NativeErrorToString(GetLastError());
|
|
||||||
#else
|
|
||||||
return NativeErrorToString(errno);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Common
|
|
|
@ -1,21 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: 2013 Dolphin Emulator Project
|
|
||||||
// SPDX-FileCopyrightText: 2014 Citra Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
|
|
||||||
// Generic function to get last error message.
|
|
||||||
// Call directly after the command or use the error num.
|
|
||||||
// This function might change the error code.
|
|
||||||
// Defined in error.cpp.
|
|
||||||
[[nodiscard]] std::string GetLastErrorMsg();
|
|
||||||
|
|
||||||
// Like GetLastErrorMsg(), but passing an explicit error code.
|
|
||||||
// Defined in error.cpp.
|
|
||||||
[[nodiscard]] std::string NativeErrorToString(int e);
|
|
||||||
|
|
||||||
} // namespace Common
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "common/fs_file.h"
|
||||||
|
|
||||||
|
namespace Common::FS {
|
||||||
|
|
||||||
|
File::File() = default;
|
||||||
|
|
||||||
|
File::File(const std::string& path, OpenMode mode) {
|
||||||
|
open(path, mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
File::~File() {
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool File::open(const std::string& path, OpenMode mode) {
|
||||||
|
close();
|
||||||
|
#ifdef _WIN64
|
||||||
|
fopen_s(&m_file, path.c_str(), getOpenMode(mode));
|
||||||
|
#else
|
||||||
|
m_file = std::fopen(path.c_str(), getOpenMode(mode));
|
||||||
|
#endif
|
||||||
|
return isOpen();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool File::close() {
|
||||||
|
if (!isOpen() || std::fclose(m_file) != 0) [[unlikely]] {
|
||||||
|
m_file = nullptr;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_file = nullptr;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool File::write(std::span<const u8> data) {
|
||||||
|
return isOpen() && std::fwrite(data.data(), 1, data.size(), m_file) == data.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool File::read(void* data, u64 size) const {
|
||||||
|
return isOpen() && std::fread(data, 1, size, m_file) == size;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool File::seek(s64 offset, SeekMode mode) {
|
||||||
|
#ifdef _WIN64
|
||||||
|
if (!isOpen() || _fseeki64(m_file, offset, getSeekMode(mode)) != 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if (!isOpen() || fseeko64(m_file, offset, getSeekMode(mode)) != 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
u64 File::tell() const {
|
||||||
|
if (isOpen()) [[likely]] {
|
||||||
|
#ifdef _WIN64
|
||||||
|
return _ftelli64(m_file);
|
||||||
|
#else
|
||||||
|
return ftello64(m_file);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
u64 File::getFileSize() {
|
||||||
|
#ifdef _WIN64
|
||||||
|
const u64 pos = _ftelli64(m_file);
|
||||||
|
if (_fseeki64(m_file, 0, SEEK_END) != 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const u64 size = _ftelli64(m_file);
|
||||||
|
if (_fseeki64(m_file, pos, SEEK_SET) != 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
const u64 pos = ftello64(m_file);
|
||||||
|
if (fseeko64(m_file, 0, SEEK_END) != 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const u64 size = ftello64(m_file);
|
||||||
|
if (fseeko64(m_file, pos, SEEK_SET) != 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Common::FS
|
|
@ -0,0 +1,86 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <bit>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <span>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "common/types.h"
|
||||||
|
|
||||||
|
namespace Common::FS {
|
||||||
|
|
||||||
|
enum class OpenMode : u32 { Read = 0x1, Write = 0x2, ReadWrite = Read | Write };
|
||||||
|
|
||||||
|
enum class SeekMode : u32 {
|
||||||
|
Set,
|
||||||
|
Cur,
|
||||||
|
End,
|
||||||
|
};
|
||||||
|
|
||||||
|
class File {
|
||||||
|
public:
|
||||||
|
File();
|
||||||
|
explicit File(const std::string& path, OpenMode mode = OpenMode::Read);
|
||||||
|
~File();
|
||||||
|
|
||||||
|
bool open(const std::string& path, OpenMode mode = OpenMode::Read);
|
||||||
|
bool close();
|
||||||
|
bool read(void* data, u64 size) const;
|
||||||
|
bool write(std::span<const u8> data);
|
||||||
|
bool seek(s64 offset, SeekMode mode);
|
||||||
|
u64 getFileSize();
|
||||||
|
u64 tell() const;
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool read(T& data) const {
|
||||||
|
return read(&data, sizeof(T));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool read(std::vector<T>& data) const {
|
||||||
|
return read(data.data(), data.size() * sizeof(T));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isOpen() const {
|
||||||
|
return m_file != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* getOpenMode(OpenMode mode) const {
|
||||||
|
switch (mode) {
|
||||||
|
case OpenMode::Read:
|
||||||
|
return "rb";
|
||||||
|
case OpenMode::Write:
|
||||||
|
return "wb";
|
||||||
|
case OpenMode::ReadWrite:
|
||||||
|
return "r+b";
|
||||||
|
default:
|
||||||
|
return "r";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int getSeekMode(SeekMode mode) const {
|
||||||
|
switch (mode) {
|
||||||
|
case SeekMode::Set:
|
||||||
|
return SEEK_SET;
|
||||||
|
case SeekMode::Cur:
|
||||||
|
return SEEK_CUR;
|
||||||
|
case SeekMode::End:
|
||||||
|
return SEEK_END;
|
||||||
|
default:
|
||||||
|
return SEEK_SET;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] std::FILE* fileDescr() const {
|
||||||
|
return m_file;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::FILE* m_file{};
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Common::FS
|
|
@ -4,8 +4,8 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "common/io_file.h"
|
#include "common/io_file.h"
|
||||||
#include "common/logging/log.h"
|
// #include "common/logging/log.h"
|
||||||
#include "common/path_util.h"
|
// #include "common/path_util.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
@ -184,8 +184,8 @@ void IOFile::Open(const fs::path& path, FileAccessMode mode, FileType type, File
|
||||||
|
|
||||||
if (!IsOpen()) {
|
if (!IsOpen()) {
|
||||||
const auto ec = std::error_code{errno, std::generic_category()};
|
const auto ec = std::error_code{errno, std::generic_category()};
|
||||||
LOG_ERROR(Common_Filesystem, "Failed to open the file at path={}, ec_message={}",
|
// LOG_ERROR(Common_Filesystem, "Failed to open the file at path={}, ec_message={}",
|
||||||
PathToUTF8String(file_path), ec.message());
|
// PathToUTF8String(file_path), ec.message());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,8 +200,8 @@ void IOFile::Close() {
|
||||||
|
|
||||||
if (!close_result) {
|
if (!close_result) {
|
||||||
const auto ec = std::error_code{errno, std::generic_category()};
|
const auto ec = std::error_code{errno, std::generic_category()};
|
||||||
LOG_ERROR(Common_Filesystem, "Failed to close the file at path={}, ec_message={}",
|
// LOG_ERROR(Common_Filesystem, "Failed to close the file at path={}, ec_message={}",
|
||||||
PathToUTF8String(file_path), ec.message());
|
// PathToUTF8String(file_path), ec.message());
|
||||||
}
|
}
|
||||||
|
|
||||||
file = nullptr;
|
file = nullptr;
|
||||||
|
@ -231,8 +231,8 @@ bool IOFile::Flush() const {
|
||||||
|
|
||||||
if (!flush_result) {
|
if (!flush_result) {
|
||||||
const auto ec = std::error_code{errno, std::generic_category()};
|
const auto ec = std::error_code{errno, std::generic_category()};
|
||||||
LOG_ERROR(Common_Filesystem, "Failed to flush the file at path={}, ec_message={}",
|
// LOG_ERROR(Common_Filesystem, "Failed to flush the file at path={}, ec_message={}",
|
||||||
PathToUTF8String(file_path), ec.message());
|
// PathToUTF8String(file_path), ec.message());
|
||||||
}
|
}
|
||||||
|
|
||||||
return flush_result;
|
return flush_result;
|
||||||
|
@ -253,8 +253,8 @@ bool IOFile::Commit() const {
|
||||||
|
|
||||||
if (!commit_result) {
|
if (!commit_result) {
|
||||||
const auto ec = std::error_code{errno, std::generic_category()};
|
const auto ec = std::error_code{errno, std::generic_category()};
|
||||||
LOG_ERROR(Common_Filesystem, "Failed to commit the file at path={}, ec_message={}",
|
// LOG_ERROR(Common_Filesystem, "Failed to commit the file at path={}, ec_message={}",
|
||||||
PathToUTF8String(file_path), ec.message());
|
// PathToUTF8String(file_path), ec.message());
|
||||||
}
|
}
|
||||||
|
|
||||||
return commit_result;
|
return commit_result;
|
||||||
|
@ -275,8 +275,9 @@ bool IOFile::SetSize(u64 size) const {
|
||||||
|
|
||||||
if (!set_size_result) {
|
if (!set_size_result) {
|
||||||
const auto ec = std::error_code{errno, std::generic_category()};
|
const auto ec = std::error_code{errno, std::generic_category()};
|
||||||
LOG_ERROR(Common_Filesystem, "Failed to resize the file at path={}, size={}, ec_message={}",
|
// LOG_ERROR(Common_Filesystem, "Failed to resize the file at path={}, size={},
|
||||||
PathToUTF8String(file_path), size, ec.message());
|
// ec_message={}",
|
||||||
|
// PathToUTF8String(file_path), size, ec.message());
|
||||||
}
|
}
|
||||||
|
|
||||||
return set_size_result;
|
return set_size_result;
|
||||||
|
@ -295,8 +296,9 @@ u64 IOFile::GetSize() const {
|
||||||
const auto file_size = fs::file_size(file_path, ec);
|
const auto file_size = fs::file_size(file_path, ec);
|
||||||
|
|
||||||
if (ec) {
|
if (ec) {
|
||||||
LOG_ERROR(Common_Filesystem, "Failed to retrieve the file size of path={}, ec_message={}",
|
// LOG_ERROR(Common_Filesystem, "Failed to retrieve the file size of path={},
|
||||||
PathToUTF8String(file_path), ec.message());
|
// ec_message={}",
|
||||||
|
// PathToUTF8String(file_path), ec.message());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,9 +316,9 @@ bool IOFile::Seek(s64 offset, SeekOrigin origin) const {
|
||||||
|
|
||||||
if (!seek_result) {
|
if (!seek_result) {
|
||||||
const auto ec = std::error_code{errno, std::generic_category()};
|
const auto ec = std::error_code{errno, std::generic_category()};
|
||||||
LOG_ERROR(Common_Filesystem,
|
// LOG_ERROR(Common_Filesystem,
|
||||||
"Failed to seek the file at path={}, offset={}, origin={}, ec_message={}",
|
// "Failed to seek the file at path={}, offset={}, origin={}, ec_message={}",
|
||||||
PathToUTF8String(file_path), offset, static_cast<u32>(origin), ec.message());
|
// PathToUTF8String(file_path), offset, static_cast<u32>(origin), ec.message());
|
||||||
}
|
}
|
||||||
|
|
||||||
return seek_result;
|
return seek_result;
|
||||||
|
|
|
@ -0,0 +1,159 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <Util/config.h>
|
||||||
|
#include <spdlog/common.h>
|
||||||
|
#include <spdlog/pattern_formatter.h>
|
||||||
|
#include <spdlog/sinks/basic_file_sink.h>
|
||||||
|
#include <spdlog/sinks/stdout_color_sinks.h>
|
||||||
|
#include <spdlog/spdlog.h>
|
||||||
|
#include "common/log.h"
|
||||||
|
#ifdef _WIN64
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace Common::Log {
|
||||||
|
|
||||||
|
std::vector<spdlog::sink_ptr> sinks;
|
||||||
|
constexpr bool log_file_exceptions = true;
|
||||||
|
|
||||||
|
void Flush() {
|
||||||
|
spdlog::details::registry::instance().flush_all();
|
||||||
|
}
|
||||||
|
|
||||||
|
thread_local uint8_t TLS[1024];
|
||||||
|
|
||||||
|
uint64_t tls_access(int64_t tls_offset) {
|
||||||
|
if (tls_offset == 0) {
|
||||||
|
return (uint64_t)TLS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef _WIN64
|
||||||
|
static LONG WINAPI ExceptionHandler(PEXCEPTION_POINTERS pExp) noexcept {
|
||||||
|
auto orig_rip = pExp->ContextRecord->Rip;
|
||||||
|
while (*(uint8_t*)pExp->ContextRecord->Rip == 0x66)
|
||||||
|
pExp->ContextRecord->Rip++;
|
||||||
|
|
||||||
|
if (*(uint8_t*)pExp->ContextRecord->Rip == 0xcd) {
|
||||||
|
int reg = *(uint8_t*)(pExp->ContextRecord->Rip + 1) - 0x80;
|
||||||
|
int sizes = *(uint8_t*)(pExp->ContextRecord->Rip + 2);
|
||||||
|
int pattern_size = sizes & 0xF;
|
||||||
|
int imm_size = sizes >> 4;
|
||||||
|
|
||||||
|
int64_t tls_offset;
|
||||||
|
if (imm_size == 4)
|
||||||
|
tls_offset = *(int32_t*)(pExp->ContextRecord->Rip + pattern_size);
|
||||||
|
else
|
||||||
|
tls_offset = *(int64_t*)(pExp->ContextRecord->Rip + pattern_size);
|
||||||
|
|
||||||
|
(&pExp->ContextRecord->Rax)[reg] = tls_access(tls_offset); /* TLS_ACCESS */
|
||||||
|
pExp->ContextRecord->Rip += pattern_size + imm_size;
|
||||||
|
|
||||||
|
return EXCEPTION_CONTINUE_EXECUTION;
|
||||||
|
}
|
||||||
|
|
||||||
|
pExp->ContextRecord->Rip = orig_rip;
|
||||||
|
const u32 ec = pExp->ExceptionRecord->ExceptionCode;
|
||||||
|
switch (ec) {
|
||||||
|
case EXCEPTION_ACCESS_VIOLATION: {
|
||||||
|
LOG_CRITICAL_IF(log_file_exceptions, "Exception EXCEPTION_ACCESS_VIOLATION ({:#x}). ", ec);
|
||||||
|
const auto info = pExp->ExceptionRecord->ExceptionInformation;
|
||||||
|
switch (info[0]) {
|
||||||
|
case 0:
|
||||||
|
LOG_CRITICAL_IF(log_file_exceptions, "Read violation at address {:#x}.", info[1]);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
LOG_CRITICAL_IF(log_file_exceptions, "Write violation at address {:#x}.", info[1]);
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
LOG_CRITICAL_IF(log_file_exceptions, "DEP violation at address {:#x}.", info[1]);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
|
||||||
|
LOG_CRITICAL_IF(log_file_exceptions, "Exception EXCEPTION_ARRAY_BOUNDS_EXCEEDED ({:#x}). ",
|
||||||
|
ec);
|
||||||
|
break;
|
||||||
|
case EXCEPTION_DATATYPE_MISALIGNMENT:
|
||||||
|
LOG_CRITICAL_IF(log_file_exceptions, "Exception EXCEPTION_DATATYPE_MISALIGNMENT ({:#x}). ",
|
||||||
|
ec);
|
||||||
|
break;
|
||||||
|
case EXCEPTION_FLT_DIVIDE_BY_ZERO:
|
||||||
|
LOG_CRITICAL_IF(log_file_exceptions, "Exception EXCEPTION_FLT_DIVIDE_BY_ZERO ({:#x}). ",
|
||||||
|
ec);
|
||||||
|
break;
|
||||||
|
case EXCEPTION_ILLEGAL_INSTRUCTION:
|
||||||
|
LOG_CRITICAL_IF(log_file_exceptions, "Exception EXCEPTION_ILLEGAL_INSTRUCTION ({:#x}). ",
|
||||||
|
ec);
|
||||||
|
break;
|
||||||
|
case EXCEPTION_IN_PAGE_ERROR:
|
||||||
|
LOG_CRITICAL_IF(log_file_exceptions, "Exception EXCEPTION_IN_PAGE_ERROR ({:#x}). ", ec);
|
||||||
|
break;
|
||||||
|
case EXCEPTION_INT_DIVIDE_BY_ZERO:
|
||||||
|
LOG_CRITICAL_IF(log_file_exceptions, "Exception EXCEPTION_INT_DIVIDE_BY_ZERO ({:#x}). ",
|
||||||
|
ec);
|
||||||
|
break;
|
||||||
|
case EXCEPTION_PRIV_INSTRUCTION:
|
||||||
|
LOG_CRITICAL_IF(log_file_exceptions, "Exception EXCEPTION_PRIV_INSTRUCTION ({:#x}). ", ec);
|
||||||
|
break;
|
||||||
|
case EXCEPTION_STACK_OVERFLOW:
|
||||||
|
LOG_CRITICAL_IF(log_file_exceptions, "Exception EXCEPTION_STACK_OVERFLOW ({:#x}). ", ec);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return EXCEPTION_CONTINUE_SEARCH;
|
||||||
|
}
|
||||||
|
Flush();
|
||||||
|
return EXCEPTION_CONTINUE_SEARCH;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int Init(bool use_stdout) {
|
||||||
|
sinks.clear();
|
||||||
|
if (use_stdout) {
|
||||||
|
sinks.push_back(std::make_shared<spdlog::sinks::stdout_color_sink_mt>());
|
||||||
|
}
|
||||||
|
#ifdef _WIN64
|
||||||
|
sinks.push_back(std::make_shared<spdlog::sinks::basic_file_sink_mt>(L"shadps4.txt", true));
|
||||||
|
#else
|
||||||
|
sinks.push_back(std::make_shared<spdlog::sinks::basic_file_sink_mt>("shadps4.txt", true));
|
||||||
|
#endif
|
||||||
|
spdlog::set_default_logger(
|
||||||
|
std::make_shared<spdlog::logger>("shadps4 logger", begin(sinks), end(sinks)));
|
||||||
|
auto f = std::make_unique<spdlog::pattern_formatter>(
|
||||||
|
"%^|%L|: %v%$", spdlog::pattern_time_type::local, std::string("")); // disable eol
|
||||||
|
spdlog::set_formatter(std::move(f));
|
||||||
|
spdlog::set_level(static_cast<spdlog::level::level_enum>(Config::getLogLevel()));
|
||||||
|
|
||||||
|
#ifdef _WIN64
|
||||||
|
if (!AddVectoredExceptionHandler(0, ExceptionHandler)) {
|
||||||
|
LOG_CRITICAL_IF(log_file_exceptions, "Failed to register an exception handler");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static std::terminate_handler old_terminate = nullptr;
|
||||||
|
old_terminate = std::set_terminate([]() {
|
||||||
|
try {
|
||||||
|
std::rethrow_exception(std::current_exception());
|
||||||
|
} catch (const std::exception& e) {
|
||||||
|
LOG_CRITICAL_IF(log_file_exceptions, "Unhandled C++ exception. {}", e.what());
|
||||||
|
} catch (...) {
|
||||||
|
LOG_CRITICAL_IF(log_file_exceptions, "Unhandled C++ exception. UNKNOWN");
|
||||||
|
}
|
||||||
|
Flush();
|
||||||
|
if (old_terminate)
|
||||||
|
old_terminate();
|
||||||
|
});
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetLevel(spdlog::level::level_enum log_level) {
|
||||||
|
spdlog::set_level(log_level);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Common::Log
|
|
@ -0,0 +1,42 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_TRACE
|
||||||
|
|
||||||
|
#include <spdlog/spdlog.h>
|
||||||
|
|
||||||
|
namespace Common::Log {
|
||||||
|
|
||||||
|
#define LOG_TRACE SPDLOG_TRACE
|
||||||
|
#define LOG_DEBUG SPDLOG_DEBUG
|
||||||
|
#define LOG_INFO SPDLOG_INFO
|
||||||
|
#define LOG_WARN SPDLOG_WARN
|
||||||
|
#define LOG_ERROR SPDLOG_ERROR
|
||||||
|
#define LOG_CRITICAL SPDLOG_CRITICAL
|
||||||
|
|
||||||
|
#define LOG_TRACE_IF(flag, ...) \
|
||||||
|
if (flag) \
|
||||||
|
LOG_TRACE(__VA_ARGS__)
|
||||||
|
#define LOG_DEBUG_IF(flag, ...) \
|
||||||
|
if (flag) \
|
||||||
|
LOG_DEBUG(__VA_ARGS__)
|
||||||
|
#define LOG_INFO_IF(flag, ...) \
|
||||||
|
if (flag) \
|
||||||
|
LOG_INFO(__VA_ARGS__)
|
||||||
|
#define LOG_WARN_IF(flag, ...) \
|
||||||
|
if (flag) \
|
||||||
|
LOG_WARN(__VA_ARGS__)
|
||||||
|
#define LOG_ERROR_IF(flag, ...) \
|
||||||
|
if (flag) \
|
||||||
|
LOG_ERROR(__VA_ARGS__)
|
||||||
|
#define LOG_CRITICAL_IF(flag, ...) \
|
||||||
|
if (flag) \
|
||||||
|
LOG_CRITICAL(__VA_ARGS__)
|
||||||
|
|
||||||
|
int Init(bool use_stdout);
|
||||||
|
|
||||||
|
void SetLevel(spdlog::level::level_enum log_level);
|
||||||
|
|
||||||
|
} // namespace Common::Log
|
|
@ -1,277 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2014 Citra Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#include <chrono>
|
|
||||||
#include <filesystem>
|
|
||||||
#include <thread>
|
|
||||||
|
|
||||||
#include <fmt/format.h>
|
|
||||||
#include "Util/config.h"
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#include <windows.h> // For OutputDebugStringW
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "common/bounded_threadsafe_queue.h"
|
|
||||||
#include "common/io_file.h"
|
|
||||||
#include "common/logging/backend.h"
|
|
||||||
#include "common/logging/log.h"
|
|
||||||
#include "common/logging/log_entry.h"
|
|
||||||
#include "common/logging/text_formatter.h"
|
|
||||||
#include "common/path_util.h"
|
|
||||||
#include "common/string_util.h"
|
|
||||||
#include "common/thread.h"
|
|
||||||
|
|
||||||
namespace Common::Log {
|
|
||||||
|
|
||||||
using namespace Common::FS;
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Backend that writes to stderr and with color
|
|
||||||
*/
|
|
||||||
class ColorConsoleBackend {
|
|
||||||
public:
|
|
||||||
explicit ColorConsoleBackend() = default;
|
|
||||||
|
|
||||||
~ColorConsoleBackend() = default;
|
|
||||||
|
|
||||||
void Write(const Entry& entry) {
|
|
||||||
if (enabled.load(std::memory_order_relaxed)) {
|
|
||||||
PrintColoredMessage(entry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Flush() {
|
|
||||||
// stderr shouldn't be buffered
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetEnabled(bool enabled_) {
|
|
||||||
enabled = enabled_;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::atomic_bool enabled{true};
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Backend that writes to a file passed into the constructor
|
|
||||||
*/
|
|
||||||
class FileBackend {
|
|
||||||
public:
|
|
||||||
explicit FileBackend(const std::filesystem::path& filename)
|
|
||||||
: file{filename, FS::FileAccessMode::Write, FS::FileType::TextFile} {}
|
|
||||||
|
|
||||||
~FileBackend() = default;
|
|
||||||
|
|
||||||
void Write(const Entry& entry) {
|
|
||||||
if (!enabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
bytes_written += file.WriteString(FormatLogMessage(entry).append(1, '\n'));
|
|
||||||
|
|
||||||
// Prevent logs from exceeding a set maximum size in the event that log entries are spammed.
|
|
||||||
const auto write_limit = 100_MB;
|
|
||||||
const bool write_limit_exceeded = bytes_written > write_limit;
|
|
||||||
if (entry.log_level >= Level::Error || write_limit_exceeded) {
|
|
||||||
if (write_limit_exceeded) {
|
|
||||||
// Stop writing after the write limit is exceeded.
|
|
||||||
// Don't close the file so we can print a stacktrace if necessary
|
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
file.Flush();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Flush() {
|
|
||||||
file.Flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
Common::FS::IOFile file;
|
|
||||||
bool enabled = true;
|
|
||||||
std::size_t bytes_written = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Backend that writes to Visual Studio's output window
|
|
||||||
*/
|
|
||||||
class DebuggerBackend {
|
|
||||||
public:
|
|
||||||
explicit DebuggerBackend() = default;
|
|
||||||
|
|
||||||
~DebuggerBackend() = default;
|
|
||||||
|
|
||||||
void Write(const Entry& entry) {
|
|
||||||
#ifdef _WIN32
|
|
||||||
::OutputDebugStringW(UTF8ToUTF16W(FormatLogMessage(entry).append(1, '\n')).c_str());
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void Flush() {}
|
|
||||||
|
|
||||||
void EnableForStacktrace() {}
|
|
||||||
};
|
|
||||||
|
|
||||||
bool initialization_in_progress_suppress_logging = true;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Static state as a singleton.
|
|
||||||
*/
|
|
||||||
class Impl {
|
|
||||||
public:
|
|
||||||
static Impl& Instance() {
|
|
||||||
if (!instance) {
|
|
||||||
throw std::runtime_error("Using Logging instance before its initialization");
|
|
||||||
}
|
|
||||||
return *instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Initialize(std::string_view log_file) {
|
|
||||||
if (instance) {
|
|
||||||
LOG_WARNING(Log, "Reinitializing logging backend");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const auto& log_dir = GetUserPath(PathType::LogDir);
|
|
||||||
std::filesystem::create_directory(log_dir);
|
|
||||||
Filter filter;
|
|
||||||
filter.ParseFilterString(Config::getLogFilter());
|
|
||||||
instance = std::unique_ptr<Impl, decltype(&Deleter)>(new Impl(log_dir / LOG_FILE, filter),
|
|
||||||
Deleter);
|
|
||||||
initialization_in_progress_suppress_logging = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Start() {
|
|
||||||
instance->StartBackendThread();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Stop() {
|
|
||||||
instance->StopBackendThread();
|
|
||||||
}
|
|
||||||
|
|
||||||
Impl(const Impl&) = delete;
|
|
||||||
Impl& operator=(const Impl&) = delete;
|
|
||||||
|
|
||||||
Impl(Impl&&) = delete;
|
|
||||||
Impl& operator=(Impl&&) = delete;
|
|
||||||
|
|
||||||
void SetGlobalFilter(const Filter& f) {
|
|
||||||
filter = f;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetColorConsoleBackendEnabled(bool enabled) {
|
|
||||||
color_console_backend.SetEnabled(enabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PushEntry(Class log_class, Level log_level, const char* filename, unsigned int line_num,
|
|
||||||
const char* function, std::string message) {
|
|
||||||
if (!filter.CheckMessage(log_class, log_level)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
using std::chrono::duration_cast;
|
|
||||||
using std::chrono::microseconds;
|
|
||||||
using std::chrono::steady_clock;
|
|
||||||
|
|
||||||
message_queue.EmplaceWait(Entry{
|
|
||||||
.timestamp = duration_cast<microseconds>(steady_clock::now() - time_origin),
|
|
||||||
.log_class = log_class,
|
|
||||||
.log_level = log_level,
|
|
||||||
.filename = filename,
|
|
||||||
.line_num = line_num,
|
|
||||||
.function = function,
|
|
||||||
.message = std::move(message),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
Impl(const std::filesystem::path& file_backend_filename, const Filter& filter_)
|
|
||||||
: filter{filter_}, file_backend{file_backend_filename} {}
|
|
||||||
|
|
||||||
~Impl() = default;
|
|
||||||
|
|
||||||
void StartBackendThread() {
|
|
||||||
backend_thread = std::jthread([this](std::stop_token stop_token) {
|
|
||||||
Common::SetCurrentThreadName("shadPS4:Log");
|
|
||||||
Entry entry;
|
|
||||||
const auto write_logs = [this, &entry]() {
|
|
||||||
ForEachBackend([&entry](auto& backend) { backend.Write(entry); });
|
|
||||||
};
|
|
||||||
while (!stop_token.stop_requested()) {
|
|
||||||
message_queue.PopWait(entry, stop_token);
|
|
||||||
if (entry.filename != nullptr) {
|
|
||||||
write_logs();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Drain the logging queue. Only writes out up to MAX_LOGS_TO_WRITE to prevent a
|
|
||||||
// case where a system is repeatedly spamming logs even on close.
|
|
||||||
int max_logs_to_write = filter.IsDebug() ? std::numeric_limits<s32>::max() : 100;
|
|
||||||
while (max_logs_to_write-- && message_queue.TryPop(entry)) {
|
|
||||||
write_logs();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void StopBackendThread() {
|
|
||||||
backend_thread.request_stop();
|
|
||||||
if (backend_thread.joinable()) {
|
|
||||||
backend_thread.join();
|
|
||||||
}
|
|
||||||
|
|
||||||
ForEachBackend([](auto& backend) { backend.Flush(); });
|
|
||||||
}
|
|
||||||
|
|
||||||
void ForEachBackend(auto lambda) {
|
|
||||||
lambda(debugger_backend);
|
|
||||||
lambda(color_console_backend);
|
|
||||||
lambda(file_backend);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Deleter(Impl* ptr) {
|
|
||||||
delete ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline std::unique_ptr<Impl, decltype(&Deleter)> instance{nullptr, Deleter};
|
|
||||||
|
|
||||||
Filter filter;
|
|
||||||
DebuggerBackend debugger_backend{};
|
|
||||||
ColorConsoleBackend color_console_backend{};
|
|
||||||
FileBackend file_backend;
|
|
||||||
|
|
||||||
MPSCQueue<Entry> message_queue{};
|
|
||||||
std::chrono::steady_clock::time_point time_origin{std::chrono::steady_clock::now()};
|
|
||||||
std::jthread backend_thread;
|
|
||||||
};
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
void Initialize(std::string_view log_file) {
|
|
||||||
Impl::Initialize(log_file.empty() ? LOG_FILE : log_file);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Start() {
|
|
||||||
Impl::Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Stop() {
|
|
||||||
Impl::Stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetGlobalFilter(const Filter& filter) {
|
|
||||||
Impl::Instance().SetGlobalFilter(filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetColorConsoleBackendEnabled(bool enabled) {
|
|
||||||
Impl::Instance().SetColorConsoleBackendEnabled(enabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
void FmtLogMessageImpl(Class log_class, Level log_level, const char* filename,
|
|
||||||
unsigned int line_num, const char* function, const char* format,
|
|
||||||
const fmt::format_args& args) {
|
|
||||||
if (!initialization_in_progress_suppress_logging) [[likely]] {
|
|
||||||
Impl::Instance().PushEntry(log_class, log_level, filename, line_num, function,
|
|
||||||
fmt::vformat(format, args));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // namespace Common::Log
|
|
|
@ -1,27 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2014 Citra Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <string_view>
|
|
||||||
#include "common/logging/filter.h"
|
|
||||||
|
|
||||||
namespace Common::Log {
|
|
||||||
|
|
||||||
class Filter;
|
|
||||||
|
|
||||||
/// Initializes the logging system. This should be the first thing called in main.
|
|
||||||
void Initialize(std::string_view log_file = "");
|
|
||||||
|
|
||||||
/// Starts the logging threads.
|
|
||||||
void Start();
|
|
||||||
|
|
||||||
/// Explictily stops the logger thread and flushes the buffers
|
|
||||||
void Stop();
|
|
||||||
|
|
||||||
/// The global filter will prevent any messages from even being processed if they are filtered.
|
|
||||||
void SetGlobalFilter(const Filter& filter);
|
|
||||||
|
|
||||||
void SetColorConsoleBackendEnabled(bool enabled);
|
|
||||||
|
|
||||||
} // namespace Common::Log
|
|
|
@ -1,173 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2014 Citra Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/logging/filter.h"
|
|
||||||
|
|
||||||
namespace Common::Log {
|
|
||||||
namespace {
|
|
||||||
template <typename It>
|
|
||||||
Level GetLevelByName(const It begin, const It end) {
|
|
||||||
for (u8 i = 0; i < static_cast<u8>(Level::Count); ++i) {
|
|
||||||
const char* level_name = GetLevelName(static_cast<Level>(i));
|
|
||||||
if (std::string_view(begin, end).compare(level_name) == 0) {
|
|
||||||
return static_cast<Level>(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Level::Count;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename It>
|
|
||||||
Class GetClassByName(const It begin, const It end) {
|
|
||||||
for (u8 i = 0; i < static_cast<u8>(Class::Count); ++i) {
|
|
||||||
const char* level_name = GetLogClassName(static_cast<Class>(i));
|
|
||||||
if (std::string_view(begin, end).compare(level_name) == 0) {
|
|
||||||
return static_cast<Class>(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Class::Count;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Iterator>
|
|
||||||
bool ParseFilterRule(Filter& instance, Iterator begin, Iterator end) {
|
|
||||||
auto level_separator = std::find(begin, end, ':');
|
|
||||||
if (level_separator == end) {
|
|
||||||
LOG_ERROR(Log, "Invalid log filter. Must specify a log level after `:`: {}",
|
|
||||||
std::string_view(begin, end));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const Level level = GetLevelByName(level_separator + 1, end);
|
|
||||||
if (level == Level::Count) {
|
|
||||||
LOG_ERROR(Log, "Unknown log level in filter: {}", std::string_view(begin, end));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (std::string_view(begin, level_separator).compare("*") == 0) {
|
|
||||||
instance.ResetAll(level);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const Class log_class = GetClassByName(begin, level_separator);
|
|
||||||
if (log_class == Class::Count) {
|
|
||||||
LOG_ERROR(Log, "Unknown log class in filter: {}", std::string(begin, end));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
instance.SetClassLevel(log_class, level);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} // Anonymous namespace
|
|
||||||
|
|
||||||
/// Macro listing all log classes. Code should define CLS and SUB as desired before invoking this.
|
|
||||||
#define ALL_LOG_CLASSES() \
|
|
||||||
CLS(Log) \
|
|
||||||
CLS(Common) \
|
|
||||||
SUB(Common, Filesystem) \
|
|
||||||
SUB(Common, Memory) \
|
|
||||||
CLS(Core) \
|
|
||||||
SUB(Core, Linker) \
|
|
||||||
CLS(Config) \
|
|
||||||
CLS(Debug) \
|
|
||||||
CLS(Kernel) \
|
|
||||||
SUB(Kernel, Pthread) \
|
|
||||||
SUB(Kernel, Vmm) \
|
|
||||||
SUB(Kernel, Fs) \
|
|
||||||
SUB(Kernel, Event) \
|
|
||||||
SUB(Kernel, Sce) \
|
|
||||||
CLS(Lib) \
|
|
||||||
SUB(Lib, LibC) \
|
|
||||||
SUB(Lib, Kernel) \
|
|
||||||
SUB(Lib, Pad) \
|
|
||||||
SUB(Lib, GnmDriver) \
|
|
||||||
SUB(Lib, SystemService) \
|
|
||||||
SUB(Lib, UserService) \
|
|
||||||
SUB(Lib, VideoOut) \
|
|
||||||
CLS(Frontend) \
|
|
||||||
CLS(Render) \
|
|
||||||
SUB(Render, Vulkan) \
|
|
||||||
CLS(Input) \
|
|
||||||
CLS(Loader)
|
|
||||||
|
|
||||||
// GetClassName is a macro defined by Windows.h, grrr...
|
|
||||||
const char* GetLogClassName(Class log_class) {
|
|
||||||
switch (log_class) {
|
|
||||||
#define CLS(x) \
|
|
||||||
case Class::x: \
|
|
||||||
return #x;
|
|
||||||
#define SUB(x, y) \
|
|
||||||
case Class::x##_##y: \
|
|
||||||
return #x "." #y;
|
|
||||||
ALL_LOG_CLASSES()
|
|
||||||
#undef CLS
|
|
||||||
#undef SUB
|
|
||||||
case Class::Count:
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
UNREACHABLE();
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* GetLevelName(Level log_level) {
|
|
||||||
#define LVL(x) \
|
|
||||||
case Level::x: \
|
|
||||||
return #x
|
|
||||||
switch (log_level) {
|
|
||||||
LVL(Trace);
|
|
||||||
LVL(Debug);
|
|
||||||
LVL(Info);
|
|
||||||
LVL(Warning);
|
|
||||||
LVL(Error);
|
|
||||||
LVL(Critical);
|
|
||||||
case Level::Count:
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#undef LVL
|
|
||||||
UNREACHABLE();
|
|
||||||
}
|
|
||||||
|
|
||||||
Filter::Filter(Level default_level) {
|
|
||||||
ResetAll(default_level);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Filter::ResetAll(Level level) {
|
|
||||||
class_levels.fill(level);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Filter::SetClassLevel(Class log_class, Level level) {
|
|
||||||
class_levels[static_cast<std::size_t>(log_class)] = level;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Filter::ParseFilterString(std::string_view filter_view) {
|
|
||||||
auto clause_begin = filter_view.cbegin();
|
|
||||||
while (clause_begin != filter_view.cend()) {
|
|
||||||
auto clause_end = std::find(clause_begin, filter_view.cend(), ' ');
|
|
||||||
|
|
||||||
// If clause isn't empty
|
|
||||||
if (clause_end != clause_begin) {
|
|
||||||
ParseFilterRule(*this, clause_begin, clause_end);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (clause_end != filter_view.cend()) {
|
|
||||||
// Skip over the whitespace
|
|
||||||
++clause_end;
|
|
||||||
}
|
|
||||||
clause_begin = clause_end;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Filter::CheckMessage(Class log_class, Level level) const {
|
|
||||||
return static_cast<u8>(level) >=
|
|
||||||
static_cast<u8>(class_levels[static_cast<std::size_t>(log_class)]);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Filter::IsDebug() const {
|
|
||||||
return std::any_of(class_levels.begin(), class_levels.end(), [](const Level& l) {
|
|
||||||
return static_cast<u8>(l) <= static_cast<u8>(Level::Debug);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Common::Log
|
|
|
@ -1,66 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2014 Citra Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <array>
|
|
||||||
#include <cstddef>
|
|
||||||
#include <string_view>
|
|
||||||
#include "common/logging/types.h"
|
|
||||||
|
|
||||||
namespace Common::Log {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the name of the passed log class as a C-string. Subclasses are separated by periods
|
|
||||||
* instead of underscores as in the enumeration.
|
|
||||||
*/
|
|
||||||
const char* GetLogClassName(Class log_class);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the name of the passed log level as a C-string.
|
|
||||||
*/
|
|
||||||
const char* GetLevelName(Level log_level);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implements a log message filter which allows different log classes to have different minimum
|
|
||||||
* severity levels. The filter can be changed at runtime and can be parsed from a string to allow
|
|
||||||
* editing via the interface or loading from a configuration file.
|
|
||||||
*/
|
|
||||||
class Filter {
|
|
||||||
public:
|
|
||||||
/// Initializes the filter with all classes having `default_level` as the minimum level.
|
|
||||||
explicit Filter(Level default_level = Level::Info);
|
|
||||||
|
|
||||||
/// Resets the filter so that all classes have `level` as the minimum displayed level.
|
|
||||||
void ResetAll(Level level);
|
|
||||||
|
|
||||||
/// Sets the minimum level of `log_class` (and not of its subclasses) to `level`.
|
|
||||||
void SetClassLevel(Class log_class, Level level);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parses a filter string and applies it to this filter.
|
|
||||||
*
|
|
||||||
* A filter string consists of a space-separated list of filter rules, each of the format
|
|
||||||
* `<class>:<level>`. `<class>` is a log class name, with subclasses separated using periods.
|
|
||||||
* `*` is allowed as a class name and will reset all filters to the specified level. `<level>`
|
|
||||||
* a severity level name which will be set as the minimum logging level of the matched classes.
|
|
||||||
* Rules are applied left to right, with each rule overriding previous ones in the sequence.
|
|
||||||
*
|
|
||||||
* A few examples of filter rules:
|
|
||||||
* - `*:Info` -- Resets the level of all classes to Info.
|
|
||||||
* - `Service:Info` -- Sets the level of Service to Info.
|
|
||||||
* - `Service.FS:Trace` -- Sets the level of the Service.FS class to Trace.
|
|
||||||
*/
|
|
||||||
void ParseFilterString(std::string_view filter_view);
|
|
||||||
|
|
||||||
/// Matches class/level combination against the filter, returning true if it passed.
|
|
||||||
bool CheckMessage(Class log_class, Level level) const;
|
|
||||||
|
|
||||||
/// Returns true if any logging classes are set to debug
|
|
||||||
bool IsDebug() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::array<Level, static_cast<std::size_t>(Class::Count)> class_levels;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Common::Log
|
|
|
@ -1,21 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2014 Citra Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <type_traits>
|
|
||||||
#include <fmt/format.h>
|
|
||||||
|
|
||||||
// Adapted from https://github.com/fmtlib/fmt/issues/2704
|
|
||||||
// a generic formatter for enum classes
|
|
||||||
#if FMT_VERSION >= 80100
|
|
||||||
template <typename T>
|
|
||||||
struct fmt::formatter<T, std::enable_if_t<std::is_enum_v<T>, char>>
|
|
||||||
: formatter<std::underlying_type_t<T>> {
|
|
||||||
template <typename FormatContext>
|
|
||||||
auto format(const T& value, FormatContext& ctx) -> decltype(ctx.out()) {
|
|
||||||
return fmt::formatter<std::underlying_type_t<T>>::format(
|
|
||||||
static_cast<std::underlying_type_t<T>>(value), ctx);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
#endif
|
|
|
@ -1,70 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2014 Citra Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <array>
|
|
||||||
#include <string_view>
|
|
||||||
|
|
||||||
#include "common/logging/formatter.h"
|
|
||||||
#include "common/logging/types.h"
|
|
||||||
|
|
||||||
namespace Common::Log {
|
|
||||||
|
|
||||||
constexpr const char* TrimSourcePath(std::string_view source) {
|
|
||||||
const auto rfind = [source](const std::string_view match) {
|
|
||||||
return source.rfind(match) == source.npos ? 0 : (source.rfind(match) + match.size());
|
|
||||||
};
|
|
||||||
auto idx = std::max({rfind("/"), rfind("\\")});
|
|
||||||
return source.data() + idx;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Logs a message to the global logger, using fmt
|
|
||||||
void FmtLogMessageImpl(Class log_class, Level log_level, const char* filename,
|
|
||||||
unsigned int line_num, const char* function, const char* format,
|
|
||||||
const fmt::format_args& args);
|
|
||||||
|
|
||||||
template <typename... Args>
|
|
||||||
void FmtLogMessage(Class log_class, Level log_level, const char* filename, unsigned int line_num,
|
|
||||||
const char* function, const char* format, const Args&... args) {
|
|
||||||
FmtLogMessageImpl(log_class, log_level, filename, line_num, function, format,
|
|
||||||
fmt::make_format_args(args...));
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Common::Log
|
|
||||||
|
|
||||||
// Define the fmt lib macros
|
|
||||||
#define LOG_GENERIC(log_class, log_level, ...) \
|
|
||||||
Common::Log::FmtLogMessage(log_class, log_level, Common::Log::TrimSourcePath(__FILE__), \
|
|
||||||
__LINE__, __func__, __VA_ARGS__)
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
|
||||||
#define LOG_TRACE(log_class, ...) \
|
|
||||||
Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Trace, \
|
|
||||||
Common::Log::TrimSourcePath(__FILE__), __LINE__, __func__, \
|
|
||||||
__VA_ARGS__)
|
|
||||||
#else
|
|
||||||
#define LOG_TRACE(log_class, fmt, ...) (void(0))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define LOG_DEBUG(log_class, ...) \
|
|
||||||
Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Debug, \
|
|
||||||
Common::Log::TrimSourcePath(__FILE__), __LINE__, __func__, \
|
|
||||||
__VA_ARGS__)
|
|
||||||
#define LOG_INFO(log_class, ...) \
|
|
||||||
Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Info, \
|
|
||||||
Common::Log::TrimSourcePath(__FILE__), __LINE__, __func__, \
|
|
||||||
__VA_ARGS__)
|
|
||||||
#define LOG_WARNING(log_class, ...) \
|
|
||||||
Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Warning, \
|
|
||||||
Common::Log::TrimSourcePath(__FILE__), __LINE__, __func__, \
|
|
||||||
__VA_ARGS__)
|
|
||||||
#define LOG_ERROR(log_class, ...) \
|
|
||||||
Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Error, \
|
|
||||||
Common::Log::TrimSourcePath(__FILE__), __LINE__, __func__, \
|
|
||||||
__VA_ARGS__)
|
|
||||||
#define LOG_CRITICAL(log_class, ...) \
|
|
||||||
Common::Log::FmtLogMessage(Common::Log::Class::log_class, Common::Log::Level::Critical, \
|
|
||||||
Common::Log::TrimSourcePath(__FILE__), __LINE__, __func__, \
|
|
||||||
__VA_ARGS__)
|
|
|
@ -1,26 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2014 Citra Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <chrono>
|
|
||||||
|
|
||||||
#include "common/logging/types.h"
|
|
||||||
|
|
||||||
namespace Common::Log {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A log entry. Log entries are store in a structured format to permit more varied output
|
|
||||||
* formatting on different frontends, as well as facilitating filtering and aggregation.
|
|
||||||
*/
|
|
||||||
struct Entry {
|
|
||||||
std::chrono::microseconds timestamp;
|
|
||||||
Class log_class{};
|
|
||||||
Level log_level{};
|
|
||||||
const char* filename = nullptr;
|
|
||||||
u32 line_num = 0;
|
|
||||||
std::string function;
|
|
||||||
std::string message;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Common::Log
|
|
|
@ -1,109 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2014 Citra Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#include <array>
|
|
||||||
#include <cstdio>
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#include <windows.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/logging/filter.h"
|
|
||||||
#include "common/logging/log.h"
|
|
||||||
#include "common/logging/log_entry.h"
|
|
||||||
#include "common/logging/text_formatter.h"
|
|
||||||
|
|
||||||
namespace Common::Log {
|
|
||||||
|
|
||||||
std::string FormatLogMessage(const Entry& entry) {
|
|
||||||
const u32 time_seconds = static_cast<u32>(entry.timestamp.count() / 1000000);
|
|
||||||
const u32 time_fractional = static_cast<u32>(entry.timestamp.count() % 1000000);
|
|
||||||
|
|
||||||
const char* class_name = GetLogClassName(entry.log_class);
|
|
||||||
const char* level_name = GetLevelName(entry.log_level);
|
|
||||||
|
|
||||||
return fmt::format("[{}] <{}> {}:{}:{}: {}", class_name, level_name, entry.filename,
|
|
||||||
entry.function, entry.line_num, entry.message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PrintMessage(const Entry& entry) {
|
|
||||||
const auto str = FormatLogMessage(entry).append(1, '\n');
|
|
||||||
fputs(str.c_str(), stdout);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PrintColoredMessage(const Entry& entry) {
|
|
||||||
#ifdef _WIN32
|
|
||||||
HANDLE console_handle = GetStdHandle(STD_ERROR_HANDLE);
|
|
||||||
if (console_handle == INVALID_HANDLE_VALUE) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CONSOLE_SCREEN_BUFFER_INFO original_info{};
|
|
||||||
GetConsoleScreenBufferInfo(console_handle, &original_info);
|
|
||||||
|
|
||||||
WORD color = 0;
|
|
||||||
switch (entry.log_level) {
|
|
||||||
case Level::Trace: // Grey
|
|
||||||
color = FOREGROUND_INTENSITY;
|
|
||||||
break;
|
|
||||||
case Level::Debug: // Cyan
|
|
||||||
color = FOREGROUND_GREEN | FOREGROUND_BLUE;
|
|
||||||
break;
|
|
||||||
case Level::Info: // Bright gray
|
|
||||||
color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE;
|
|
||||||
break;
|
|
||||||
case Level::Warning: // Bright yellow
|
|
||||||
color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY;
|
|
||||||
break;
|
|
||||||
case Level::Error: // Bright red
|
|
||||||
color = FOREGROUND_RED | FOREGROUND_INTENSITY;
|
|
||||||
break;
|
|
||||||
case Level::Critical: // Bright magenta
|
|
||||||
color = FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY;
|
|
||||||
break;
|
|
||||||
case Level::Count:
|
|
||||||
UNREACHABLE();
|
|
||||||
}
|
|
||||||
|
|
||||||
SetConsoleTextAttribute(console_handle, color);
|
|
||||||
#else
|
|
||||||
#define ESC "\x1b"
|
|
||||||
const char* color = "";
|
|
||||||
switch (entry.log_level) {
|
|
||||||
case Level::Trace: // Grey
|
|
||||||
color = ESC "[1;30m";
|
|
||||||
break;
|
|
||||||
case Level::Debug: // Cyan
|
|
||||||
color = ESC "[0;36m";
|
|
||||||
break;
|
|
||||||
case Level::Info: // Bright gray
|
|
||||||
color = ESC "[0;37m";
|
|
||||||
break;
|
|
||||||
case Level::Warning: // Bright yellow
|
|
||||||
color = ESC "[1;33m";
|
|
||||||
break;
|
|
||||||
case Level::Error: // Bright red
|
|
||||||
color = ESC "[1;31m";
|
|
||||||
break;
|
|
||||||
case Level::Critical: // Bright magenta
|
|
||||||
color = ESC "[1;35m";
|
|
||||||
break;
|
|
||||||
case Level::Count:
|
|
||||||
UNREACHABLE();
|
|
||||||
}
|
|
||||||
|
|
||||||
fputs(color, stdout);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PrintMessage(entry);
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
SetConsoleTextAttribute(console_handle, original_info.wAttributes);
|
|
||||||
#else
|
|
||||||
fputs(ESC "[0m", stdout);
|
|
||||||
#undef ESC
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Common::Log
|
|
|
@ -1,21 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2014 Citra Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
namespace Common::Log {
|
|
||||||
|
|
||||||
struct Entry;
|
|
||||||
|
|
||||||
/// Formats a log entry into the provided text buffer.
|
|
||||||
std::string FormatLogMessage(const Entry& entry);
|
|
||||||
|
|
||||||
/// Formats and prints a log entry to stderr.
|
|
||||||
void PrintMessage(const Entry& entry);
|
|
||||||
|
|
||||||
/// Prints the same message as `PrintMessage`, but colored according to the severity level.
|
|
||||||
void PrintColoredMessage(const Entry& entry);
|
|
||||||
|
|
||||||
} // namespace Common::Log
|
|
|
@ -1,63 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2023 Citra Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "common/types.h"
|
|
||||||
|
|
||||||
namespace Common::Log {
|
|
||||||
|
|
||||||
/// Specifies the severity or level of detail of the log message.
|
|
||||||
enum class Level : u8 {
|
|
||||||
Trace, ///< Extremely detailed and repetitive debugging information that is likely to
|
|
||||||
///< pollute logs.
|
|
||||||
Debug, ///< Less detailed debugging information.
|
|
||||||
Info, ///< Status information from important points during execution.
|
|
||||||
Warning, ///< Minor or potential problems found during execution of a task.
|
|
||||||
Error, ///< Major problems found during execution of a task that prevent it from being
|
|
||||||
///< completed.
|
|
||||||
Critical, ///< Major problems during execution that threaten the stability of the entire
|
|
||||||
///< application.
|
|
||||||
|
|
||||||
Count, ///< Total number of logging levels
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies the sub-system that generated the log message.
|
|
||||||
*
|
|
||||||
* @note If you add a new entry here, also add a corresponding one to `ALL_LOG_CLASSES` in
|
|
||||||
* backend.cpp.
|
|
||||||
*/
|
|
||||||
enum class Class : u8 {
|
|
||||||
Log, ///< Messages about the log system itself
|
|
||||||
Common, ///< Library routines
|
|
||||||
Common_Filesystem, ///< Filesystem interface library
|
|
||||||
Common_Memory, ///< Memory mapping and management functions
|
|
||||||
Core, ///< LLE emulation core
|
|
||||||
Core_Linker, ///< The module linker
|
|
||||||
Config, ///< Emulator configuration (including commandline)
|
|
||||||
Debug, ///< Debugging tools
|
|
||||||
Kernel, ///< The HLE implementation of the PS4 kernel.
|
|
||||||
Kernel_Pthread, ///< The pthread implementation of the kernel.
|
|
||||||
Kernel_Fs, ///< The filesystem implementation of the kernel.
|
|
||||||
Kernel_Vmm, ///< The virtual memory implementation of the kernel.
|
|
||||||
Kernel_Event, ///< The event management implementation of the kernel.
|
|
||||||
Kernel_Sce, ///< The sony specific interfaces provided by the kernel.
|
|
||||||
Lib, ///< HLE implementation of system library. Each major library
|
|
||||||
///< should have its own subclass.
|
|
||||||
Lib_LibC, ///< The LibC implementation.
|
|
||||||
Lib_Kernel, ///< The LibKernel implementation.
|
|
||||||
Lib_Pad, ///< The LibScePad implementation.
|
|
||||||
Lib_GnmDriver, ///< The LibSceGnmDriver implementation.
|
|
||||||
Lib_SystemService, ///< The LibSceSystemService implementation.
|
|
||||||
Lib_UserService, ///< The LibSceUserService implementation.
|
|
||||||
Lib_VideoOut, ///< The LibSceVideoOut implementation.
|
|
||||||
Frontend, ///< Emulator UI
|
|
||||||
Render, ///< Video Core
|
|
||||||
Render_Vulkan, ///< Vulkan backend
|
|
||||||
Loader, ///< ROM loader
|
|
||||||
Input, ///< Input emulation
|
|
||||||
Count ///< Total number of logging classes
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Common::Log
|
|
|
@ -1,87 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <sstream>
|
|
||||||
#include <unordered_map>
|
|
||||||
|
|
||||||
#include "common/logging/log.h"
|
|
||||||
#include "common/path_util.h"
|
|
||||||
|
|
||||||
#ifndef MAX_PATH
|
|
||||||
#ifdef _WIN32
|
|
||||||
// This is the maximum number of UTF-16 code units permissible in Windows file paths
|
|
||||||
#define MAX_PATH 260
|
|
||||||
#else
|
|
||||||
// This is the maximum number of UTF-8 code units permissible in all other OSes' file paths
|
|
||||||
#define MAX_PATH 1024
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace Common::FS {
|
|
||||||
|
|
||||||
namespace fs = std::filesystem;
|
|
||||||
|
|
||||||
static auto UserPaths = [] {
|
|
||||||
std::unordered_map<PathType, fs::path> paths;
|
|
||||||
const auto user_dir = std::filesystem::current_path() / PORTABLE_DIR;
|
|
||||||
|
|
||||||
const auto create_path = [&](PathType shad_path, const fs::path& new_path) {
|
|
||||||
std::filesystem::create_directory(new_path);
|
|
||||||
paths.insert_or_assign(shad_path, new_path);
|
|
||||||
};
|
|
||||||
|
|
||||||
create_path(PathType::UserDir, user_dir);
|
|
||||||
create_path(PathType::LogDir, user_dir / LOG_DIR);
|
|
||||||
create_path(PathType::ScreenshotsDir, user_dir / SCREENSHOTS_DIR);
|
|
||||||
create_path(PathType::ShaderDir, user_dir / SHADER_DIR);
|
|
||||||
create_path(PathType::App0, user_dir / APP0_DIR);
|
|
||||||
|
|
||||||
return paths;
|
|
||||||
}();
|
|
||||||
|
|
||||||
bool ValidatePath(const fs::path& path) {
|
|
||||||
if (path.empty()) {
|
|
||||||
LOG_ERROR(Common_Filesystem, "Input path is empty, path={}", PathToUTF8String(path));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
if (path.u16string().size() >= MAX_PATH) {
|
|
||||||
LOG_ERROR(Common_Filesystem, "Input path is too long, path={}", PathToUTF8String(path));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if (path.u8string().size() >= MAX_PATH) {
|
|
||||||
LOG_ERROR(Common_Filesystem, "Input path is too long, path={}", PathToUTF8String(path));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string PathToUTF8String(const std::filesystem::path& path) {
|
|
||||||
const auto u8_string = path.u8string();
|
|
||||||
return std::string{u8_string.begin(), u8_string.end()};
|
|
||||||
}
|
|
||||||
|
|
||||||
const fs::path& GetUserPath(PathType shad_path) {
|
|
||||||
return UserPaths.at(shad_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string GetUserPathString(PathType shad_path) {
|
|
||||||
return PathToUTF8String(GetUserPath(shad_path));
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetUserPath(PathType shad_path, const fs::path& new_path) {
|
|
||||||
if (!std::filesystem::is_directory(new_path)) {
|
|
||||||
LOG_ERROR(Common_Filesystem, "Filesystem object at new_path={} is not a directory",
|
|
||||||
PathToUTF8String(new_path));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
UserPaths.insert_or_assign(shad_path, new_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Common::FS
|
|
|
@ -1,79 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <filesystem>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace Common::FS {
|
|
||||||
|
|
||||||
enum class PathType {
|
|
||||||
UserDir, // Where shadPS4 stores its data.
|
|
||||||
LogDir, // Where log files are stored.
|
|
||||||
ScreenshotsDir, // Where screenshots are stored.
|
|
||||||
ShaderDir, // Where shaders are stored.
|
|
||||||
App0, // Where guest application data is stored.
|
|
||||||
};
|
|
||||||
|
|
||||||
constexpr auto PORTABLE_DIR = "user";
|
|
||||||
|
|
||||||
// Sub-directories contained within a user data directory
|
|
||||||
constexpr auto LOG_DIR = "log";
|
|
||||||
constexpr auto SCREENSHOTS_DIR = "screenshots";
|
|
||||||
constexpr auto SHADER_DIR = "shader";
|
|
||||||
constexpr auto APP0_DIR = "app0";
|
|
||||||
|
|
||||||
// Filenames
|
|
||||||
constexpr auto LOG_FILE = "shad_log.txt";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validates a given path.
|
|
||||||
*
|
|
||||||
* A given path is valid if it meets these conditions:
|
|
||||||
* - The path is not empty
|
|
||||||
* - The path is not too long
|
|
||||||
*
|
|
||||||
* @param path Filesystem path
|
|
||||||
*
|
|
||||||
* @returns True if the path is valid, false otherwise.
|
|
||||||
*/
|
|
||||||
[[nodiscard]] bool ValidatePath(const std::filesystem::path& path);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts a filesystem path to a UTF-8 encoded std::string.
|
|
||||||
*
|
|
||||||
* @param path Filesystem path
|
|
||||||
*
|
|
||||||
* @returns UTF-8 encoded std::string.
|
|
||||||
*/
|
|
||||||
[[nodiscard]] std::string PathToUTF8String(const std::filesystem::path& path);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the filesystem path associated with the PathType enum.
|
|
||||||
*
|
|
||||||
* @param user_path PathType enum
|
|
||||||
*
|
|
||||||
* @returns The filesystem path associated with the PathType enum.
|
|
||||||
*/
|
|
||||||
[[nodiscard]] const std::filesystem::path& GetUserPath(PathType user_path);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the filesystem path associated with the PathType enum as a UTF-8 encoded std::string.
|
|
||||||
*
|
|
||||||
* @param user_path PathType enum
|
|
||||||
*
|
|
||||||
* @returns The filesystem path associated with the PathType enum as a UTF-8 encoded std::string.
|
|
||||||
*/
|
|
||||||
[[nodiscard]] std::string GetUserPathString(PathType user_path);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets a new filesystem path associated with the PathType enum.
|
|
||||||
* If the filesystem object at new_path is not a directory, this function will not do anything.
|
|
||||||
*
|
|
||||||
* @param user_path PathType enum
|
|
||||||
* @param new_path New filesystem path
|
|
||||||
*/
|
|
||||||
void SetUserPath(PathType user_path, const std::filesystem::path& new_path);
|
|
||||||
|
|
||||||
} // namespace Common::FS
|
|
|
@ -1,123 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: 2013 Dolphin Emulator Project
|
|
||||||
// SPDX-FileCopyrightText: 2014 Citra Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include "common/error.h"
|
|
||||||
#include "common/logging/log.h"
|
|
||||||
#include "common/thread.h"
|
|
||||||
#ifdef __APPLE__
|
|
||||||
#include <mach/mach.h>
|
|
||||||
#elif defined(_WIN32)
|
|
||||||
#include <windows.h>
|
|
||||||
#include "common/string_util.h"
|
|
||||||
#else
|
|
||||||
#if defined(__Bitrig__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
|
||||||
#include <pthread_np.h>
|
|
||||||
#else
|
|
||||||
#include <pthread.h>
|
|
||||||
#endif
|
|
||||||
#include <sched.h>
|
|
||||||
#endif
|
|
||||||
#ifndef _WIN32
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
#define cpu_set_t cpuset_t
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
|
|
||||||
void SetCurrentThreadPriority(ThreadPriority new_priority) {
|
|
||||||
auto handle = GetCurrentThread();
|
|
||||||
int windows_priority = 0;
|
|
||||||
switch (new_priority) {
|
|
||||||
case ThreadPriority::Low:
|
|
||||||
windows_priority = THREAD_PRIORITY_BELOW_NORMAL;
|
|
||||||
break;
|
|
||||||
case ThreadPriority::Normal:
|
|
||||||
windows_priority = THREAD_PRIORITY_NORMAL;
|
|
||||||
break;
|
|
||||||
case ThreadPriority::High:
|
|
||||||
windows_priority = THREAD_PRIORITY_ABOVE_NORMAL;
|
|
||||||
break;
|
|
||||||
case ThreadPriority::VeryHigh:
|
|
||||||
windows_priority = THREAD_PRIORITY_HIGHEST;
|
|
||||||
break;
|
|
||||||
case ThreadPriority::Critical:
|
|
||||||
windows_priority = THREAD_PRIORITY_TIME_CRITICAL;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
windows_priority = THREAD_PRIORITY_NORMAL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
SetThreadPriority(handle, windows_priority);
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
void SetCurrentThreadPriority(ThreadPriority new_priority) {
|
|
||||||
pthread_t this_thread = pthread_self();
|
|
||||||
|
|
||||||
const auto scheduling_type = SCHED_OTHER;
|
|
||||||
s32 max_prio = sched_get_priority_max(scheduling_type);
|
|
||||||
s32 min_prio = sched_get_priority_min(scheduling_type);
|
|
||||||
u32 level = std::max(static_cast<u32>(new_priority) + 1, 4U);
|
|
||||||
|
|
||||||
struct sched_param params;
|
|
||||||
if (max_prio > min_prio) {
|
|
||||||
params.sched_priority = min_prio + ((max_prio - min_prio) * level) / 4;
|
|
||||||
} else {
|
|
||||||
params.sched_priority = min_prio - ((min_prio - max_prio) * level) / 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
pthread_setschedparam(this_thread, scheduling_type, ¶ms);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
|
|
||||||
// Sets the debugger-visible name of the current thread.
|
|
||||||
void SetCurrentThreadName(const char* name) {
|
|
||||||
SetThreadDescription(GetCurrentThread(), UTF8ToUTF16W(name).data());
|
|
||||||
}
|
|
||||||
|
|
||||||
#else // !MSVC_VER, so must be POSIX threads
|
|
||||||
|
|
||||||
// MinGW with the POSIX threading model does not support pthread_setname_np
|
|
||||||
#if !defined(_WIN32) || defined(_MSC_VER)
|
|
||||||
void SetCurrentThreadName(const char* name) {
|
|
||||||
#ifdef __APPLE__
|
|
||||||
pthread_setname_np(name);
|
|
||||||
#elif defined(__Bitrig__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
|
||||||
pthread_set_name_np(pthread_self(), name);
|
|
||||||
#elif defined(__NetBSD__)
|
|
||||||
pthread_setname_np(pthread_self(), "%s", (void*)name);
|
|
||||||
#elif defined(__linux__)
|
|
||||||
// Linux limits thread names to 15 characters and will outright reject any
|
|
||||||
// attempt to set a longer name with ERANGE.
|
|
||||||
std::string truncated(name, std::min(strlen(name), static_cast<std::size_t>(15)));
|
|
||||||
if (int e = pthread_setname_np(pthread_self(), truncated.c_str())) {
|
|
||||||
errno = e;
|
|
||||||
LOG_ERROR(Common, "Failed to set thread name to '{}': {}", truncated, GetLastErrorMsg());
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
pthread_setname_np(pthread_self(), name);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
|
||||||
void SetCurrentThreadName(const char*) {
|
|
||||||
// Do Nothing on MingW
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace Common
|
|
|
@ -1,23 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: 2013 Dolphin Emulator Project
|
|
||||||
// SPDX-FileCopyrightText: 2014 Citra Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "common/types.h"
|
|
||||||
|
|
||||||
namespace Common {
|
|
||||||
|
|
||||||
enum class ThreadPriority : u32 {
|
|
||||||
Low = 0,
|
|
||||||
Normal = 1,
|
|
||||||
High = 2,
|
|
||||||
VeryHigh = 3,
|
|
||||||
Critical = 4,
|
|
||||||
};
|
|
||||||
|
|
||||||
void SetCurrentThreadPriority(ThreadPriority new_priority);
|
|
||||||
|
|
||||||
void SetCurrentThreadName(const char* name);
|
|
||||||
|
|
||||||
} // namespace Common
|
|
|
@ -1,12 +1,14 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/debug.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/log.h"
|
||||||
#include "core/PS4/GPU/tile_manager.h"
|
#include "core/PS4/GPU/tile_manager.h"
|
||||||
#include "core/PS4/GPU/video_out_buffer.h"
|
#include "core/PS4/GPU/video_out_buffer.h"
|
||||||
#include "vulkan_util.h"
|
#include "vulkan_util.h"
|
||||||
|
|
||||||
|
constexpr bool log_file_videoOutBuffer = true; // disable it to disable logging
|
||||||
|
|
||||||
static void update_func(HLE::Libs::Graphics::GraphicCtx* ctx, const u64* params, void* obj,
|
static void update_func(HLE::Libs::Graphics::GraphicCtx* ctx, const u64* params, void* obj,
|
||||||
const u64* virtual_addr, const u64* size, int virtual_addr_num) {
|
const u64* virtual_addr, const u64* size, int virtual_addr_num) {
|
||||||
|
|
||||||
|
@ -53,7 +55,8 @@ static void* create_func(HLE::Libs::Graphics::GraphicCtx* ctx, const u64* params
|
||||||
vk_format = VK_FORMAT_B8G8R8A8_SRGB;
|
vk_format = VK_FORMAT_B8G8R8A8_SRGB;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE_MSG("Unknown pixelFormat = {}", pixel_format);
|
LOG_CRITICAL_IF(log_file_videoOutBuffer, "unknown pixelFormat = {}\n", pixel_format);
|
||||||
|
std::exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
vk_obj->extent.width = width;
|
vk_obj->extent.width = width;
|
||||||
|
@ -88,7 +91,8 @@ static void* create_func(HLE::Libs::Graphics::GraphicCtx* ctx, const u64* params
|
||||||
vkCreateImage(ctx->m_device, &image_info, nullptr, &vk_obj->image);
|
vkCreateImage(ctx->m_device, &image_info, nullptr, &vk_obj->image);
|
||||||
|
|
||||||
if (vk_obj->image == nullptr) {
|
if (vk_obj->image == nullptr) {
|
||||||
UNREACHABLE_MSG("vk_obj->image is null");
|
LOG_CRITICAL_IF(log_file_videoOutBuffer, "vk_obj->image is null\n");
|
||||||
|
std::exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
vkGetImageMemoryRequirements(ctx->m_device, vk_obj->image, &mem->requirements);
|
vkGetImageMemoryRequirements(ctx->m_device, vk_obj->image, &mem->requirements);
|
||||||
|
@ -98,15 +102,19 @@ static void* create_func(HLE::Libs::Graphics::GraphicCtx* ctx, const u64* params
|
||||||
bool allocated = GPU::vulkanAllocateMemory(ctx, mem);
|
bool allocated = GPU::vulkanAllocateMemory(ctx, mem);
|
||||||
|
|
||||||
if (!allocated) {
|
if (!allocated) {
|
||||||
UNREACHABLE_MSG("Can't allocate vulkan memory");
|
LOG_CRITICAL_IF(log_file_videoOutBuffer, "can't allocate vulkan memory\n");
|
||||||
|
std::exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
vkBindImageMemory(ctx->m_device, vk_obj->image, mem->memory, mem->offset);
|
vkBindImageMemory(ctx->m_device, vk_obj->image, mem->memory, mem->offset);
|
||||||
|
|
||||||
vk_obj->memory = *mem;
|
vk_obj->memory = *mem;
|
||||||
|
|
||||||
LOG_INFO(Lib_VideoOut, "videoOutBuffer create object width = {}, height = {}, size = {}", width,
|
LOG_INFO_IF(log_file_videoOutBuffer, "videoOutBuffer create object\n");
|
||||||
height, *size);
|
LOG_INFO_IF(log_file_videoOutBuffer, "mem requirements.size = {}\n", mem->requirements.size);
|
||||||
|
LOG_INFO_IF(log_file_videoOutBuffer, "width = {}\n", width);
|
||||||
|
LOG_INFO_IF(log_file_videoOutBuffer, "height = {}\n", height);
|
||||||
|
LOG_INFO_IF(log_file_videoOutBuffer, "size = {}\n", *size);
|
||||||
|
|
||||||
update_func(ctx, params, vk_obj, virtual_addr, size, virtual_addr_num);
|
update_func(ctx, params, vk_obj, virtual_addr, size, virtual_addr_num);
|
||||||
|
|
||||||
|
@ -131,7 +139,8 @@ static void* create_func(HLE::Libs::Graphics::GraphicCtx* ctx, const u64* params
|
||||||
&vk_obj->image_view[HLE::Libs::Graphics::VulkanImage::VIEW_DEFAULT]);
|
&vk_obj->image_view[HLE::Libs::Graphics::VulkanImage::VIEW_DEFAULT]);
|
||||||
|
|
||||||
if (vk_obj->image_view[HLE::Libs::Graphics::VulkanImage::VIEW_DEFAULT] == nullptr) {
|
if (vk_obj->image_view[HLE::Libs::Graphics::VulkanImage::VIEW_DEFAULT] == nullptr) {
|
||||||
UNREACHABLE_MSG("vk_obj->image_view is null");
|
LOG_CRITICAL_IF(log_file_videoOutBuffer, "vk_obj->image_view is null\n");
|
||||||
|
std::exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return vk_obj;
|
return vk_obj;
|
||||||
|
|
|
@ -3,10 +3,11 @@
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <magic_enum.hpp>
|
||||||
#include "Objects/video_out_ctx.h"
|
#include "Objects/video_out_ctx.h"
|
||||||
#include "Util/config.h"
|
#include "Util/config.h"
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/log.h"
|
||||||
#include "common/singleton.h"
|
#include "common/singleton.h"
|
||||||
#include "core/PS4/GPU/gpu_memory.h"
|
#include "core/PS4/GPU/gpu_memory.h"
|
||||||
#include "core/PS4/GPU/video_out_buffer.h"
|
#include "core/PS4/GPU/video_out_buffer.h"
|
||||||
|
@ -15,7 +16,6 @@
|
||||||
#include "core/hle/error_codes.h"
|
#include "core/hle/error_codes.h"
|
||||||
#include "core/hle/libraries/libs.h"
|
#include "core/hle/libraries/libs.h"
|
||||||
#include "core/hle/libraries/libscegnmdriver/libscegnmdriver.h"
|
#include "core/hle/libraries/libscegnmdriver/libscegnmdriver.h"
|
||||||
#include "core/hle/libraries/libuserservice/usr_mng_codes.h"
|
|
||||||
#include "core/loader/symbols_resolver.h"
|
#include "core/loader/symbols_resolver.h"
|
||||||
#include "emulator.h"
|
#include "emulator.h"
|
||||||
|
|
||||||
|
@ -57,11 +57,17 @@ std::string getPixelFormatString(s32 format) {
|
||||||
void PS4_SYSV_ABI sceVideoOutSetBufferAttribute(SceVideoOutBufferAttribute* attribute,
|
void PS4_SYSV_ABI sceVideoOutSetBufferAttribute(SceVideoOutBufferAttribute* attribute,
|
||||||
u32 pixelFormat, u32 tilingMode, u32 aspectRatio,
|
u32 pixelFormat, u32 tilingMode, u32 aspectRatio,
|
||||||
u32 width, u32 height, u32 pitchInPixel) {
|
u32 width, u32 height, u32 pitchInPixel) {
|
||||||
LOG_INFO(Lib_VideoOut,
|
PRINT_FUNCTION_NAME();
|
||||||
"pixelFormat = {}, tilingMode = {}, aspectRatio = {}, width = {}, height = {}, "
|
|
||||||
"pitchInPixel = {}",
|
auto tileMode = magic_enum::enum_cast<SceVideoOutTilingMode>(tilingMode);
|
||||||
getPixelFormatString(pixelFormat), tilingMode, aspectRatio, width, height,
|
auto aspectR = magic_enum::enum_cast<AspectRatioMode>(aspectRatio);
|
||||||
pitchInPixel);
|
|
||||||
|
LOG_INFO_IF(log_file_videoout, "pixelFormat = {}\n", getPixelFormatString(pixelFormat));
|
||||||
|
LOG_INFO_IF(log_file_videoout, "tilingMode = {}\n", magic_enum::enum_name(tileMode.value()));
|
||||||
|
LOG_INFO_IF(log_file_videoout, "aspectRatio = {}\n", magic_enum::enum_name(aspectR.value()));
|
||||||
|
LOG_INFO_IF(log_file_videoout, "width = {}\n", width);
|
||||||
|
LOG_INFO_IF(log_file_videoout, "height = {}\n", height);
|
||||||
|
LOG_INFO_IF(log_file_videoout, "pitchInPixel = {}\n", pitchInPixel);
|
||||||
|
|
||||||
std::memset(attribute, 0, sizeof(SceVideoOutBufferAttribute));
|
std::memset(attribute, 0, sizeof(SceVideoOutBufferAttribute));
|
||||||
|
|
||||||
|
@ -93,8 +99,7 @@ static void flip_delete_event_func(Core::Kernel::SceKernelEqueue eq,
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceVideoOutAddFlipEvent(Core::Kernel::SceKernelEqueue eq, s32 handle,
|
s32 PS4_SYSV_ABI sceVideoOutAddFlipEvent(Core::Kernel::SceKernelEqueue eq, s32 handle,
|
||||||
void* udata) {
|
void* udata) {
|
||||||
LOG_INFO(Lib_VideoOut, "handle = {}", handle);
|
PRINT_FUNCTION_NAME();
|
||||||
|
|
||||||
auto* videoOut = Common::Singleton<HLE::Graphics::Objects::VideoOutCtx>::Instance();
|
auto* videoOut = Common::Singleton<HLE::Graphics::Objects::VideoOutCtx>::Instance();
|
||||||
|
|
||||||
auto* ctx = videoOut->getCtx(handle);
|
auto* ctx = videoOut->getCtx(handle);
|
||||||
|
@ -130,43 +135,46 @@ s32 PS4_SYSV_ABI sceVideoOutAddFlipEvent(Core::Kernel::SceKernelEqueue eq, s32 h
|
||||||
s32 PS4_SYSV_ABI sceVideoOutRegisterBuffers(s32 handle, s32 startIndex, void* const* addresses,
|
s32 PS4_SYSV_ABI sceVideoOutRegisterBuffers(s32 handle, s32 startIndex, void* const* addresses,
|
||||||
s32 bufferNum,
|
s32 bufferNum,
|
||||||
const SceVideoOutBufferAttribute* attribute) {
|
const SceVideoOutBufferAttribute* attribute) {
|
||||||
|
PRINT_FUNCTION_NAME();
|
||||||
auto* videoOut = Common::Singleton<HLE::Graphics::Objects::VideoOutCtx>::Instance();
|
auto* videoOut = Common::Singleton<HLE::Graphics::Objects::VideoOutCtx>::Instance();
|
||||||
auto* ctx = videoOut->getCtx(handle);
|
auto* ctx = videoOut->getCtx(handle);
|
||||||
|
|
||||||
if (handle == 1) { // main port
|
if (handle == 1) { // main port
|
||||||
if (startIndex < 0 || startIndex > 15) {
|
if (startIndex < 0 || startIndex > 15) {
|
||||||
LOG_ERROR(Lib_VideoOut, "Invalid startIndex = {}", startIndex);
|
LOG_TRACE_IF(log_file_videoout, "invalid startIndex = {}\n", startIndex);
|
||||||
return SCE_VIDEO_OUT_ERROR_INVALID_VALUE;
|
return SCE_VIDEO_OUT_ERROR_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
if (bufferNum < 1 || bufferNum > 16) {
|
if (bufferNum < 1 || bufferNum > 16) {
|
||||||
LOG_ERROR(Lib_VideoOut, "Invalid bufferNum = {}", bufferNum);
|
LOG_TRACE_IF(log_file_videoout, "invalid bufferNum = {}\n", bufferNum);
|
||||||
return SCE_VIDEO_OUT_ERROR_INVALID_VALUE;
|
return SCE_VIDEO_OUT_ERROR_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (addresses == nullptr) {
|
if (addresses == nullptr) {
|
||||||
LOG_ERROR(Lib_VideoOut, "Addresses are null");
|
LOG_TRACE_IF(log_file_videoout, "addresses are null\n");
|
||||||
return SCE_VIDEO_OUT_ERROR_INVALID_ADDRESS;
|
return SCE_VIDEO_OUT_ERROR_INVALID_ADDRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attribute == nullptr) {
|
if (attribute == nullptr) {
|
||||||
LOG_ERROR(Lib_VideoOut, "Attribute is null");
|
LOG_TRACE_IF(log_file_videoout, "attribute is null\n");
|
||||||
return SCE_VIDEO_OUT_ERROR_INVALID_OPTION;
|
return SCE_VIDEO_OUT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
if (attribute->aspectRatio != 0) {
|
if (attribute->aspectRatio != 0) {
|
||||||
LOG_ERROR(Lib_VideoOut, "Invalid aspect ratio = {}", attribute->aspectRatio);
|
LOG_TRACE_IF(log_file_videoout, "invalid aspect ratio = {}\n", attribute->aspectRatio);
|
||||||
return SCE_VIDEO_OUT_ERROR_INVALID_ASPECT_RATIO;
|
return SCE_VIDEO_OUT_ERROR_INVALID_ASPECT_RATIO;
|
||||||
}
|
}
|
||||||
if (attribute->tilingMode < 0 || attribute->tilingMode > 1) {
|
if (attribute->tilingMode < 0 || attribute->tilingMode > 1) {
|
||||||
LOG_ERROR(Lib_VideoOut, "Invalid tilingMode = {}", attribute->tilingMode);
|
LOG_TRACE_IF(log_file_videoout, "invalid tilingMode = {}\n", attribute->tilingMode);
|
||||||
return SCE_VIDEO_OUT_ERROR_INVALID_TILING_MODE;
|
return SCE_VIDEO_OUT_ERROR_INVALID_TILING_MODE;
|
||||||
}
|
}
|
||||||
|
LOG_INFO_IF(log_file_videoout, "startIndex = {}\n", startIndex);
|
||||||
LOG_INFO(Lib_VideoOut,
|
LOG_INFO_IF(log_file_videoout, "bufferNum = {}\n", bufferNum);
|
||||||
"handle = {}, startIndex = {}, bufferNum = {}, pixelFormat = {:#x}, aspectRatio = {}, "
|
LOG_INFO_IF(log_file_videoout, "pixelFormat = {:#x}\n", attribute->pixelFormat);
|
||||||
"tilingMode = {}, width = {}, height = {}, pitchInPixel = {}, option = {:#x}",
|
LOG_INFO_IF(log_file_videoout, "tilingMode = {}\n", attribute->tilingMode);
|
||||||
handle, startIndex, bufferNum, attribute->pixelFormat, attribute->aspectRatio,
|
LOG_INFO_IF(log_file_videoout, "aspectRatio = {}\n", attribute->aspectRatio);
|
||||||
attribute->tilingMode, attribute->width, attribute->height, attribute->pitchInPixel,
|
LOG_INFO_IF(log_file_videoout, "width = {}\n", attribute->width);
|
||||||
attribute->option);
|
LOG_INFO_IF(log_file_videoout, "height = {}\n", attribute->height);
|
||||||
|
LOG_INFO_IF(log_file_videoout, "pitchInPixel = {}\n", attribute->pitchInPixel);
|
||||||
|
LOG_INFO_IF(log_file_videoout, "option = {}\n", attribute->option);
|
||||||
|
|
||||||
int registration_index = ctx->buffers_registration_index++;
|
int registration_index = ctx->buffers_registration_index++;
|
||||||
|
|
||||||
|
@ -205,7 +213,7 @@ s32 PS4_SYSV_ABI sceVideoOutRegisterBuffers(s32 handle, s32 startIndex, void* co
|
||||||
|
|
||||||
for (int i = 0; i < bufferNum; i++) {
|
for (int i = 0; i < bufferNum; i++) {
|
||||||
if (ctx->buffers[i + startIndex].buffer != nullptr) {
|
if (ctx->buffers[i + startIndex].buffer != nullptr) {
|
||||||
LOG_ERROR(Lib_VideoOut, "Buffer slot {} is occupied!", i + startIndex);
|
LOG_TRACE_IF(log_file_videoout, "buffer slot {} is occupied!\n", i + startIndex);
|
||||||
return SCE_VIDEO_OUT_ERROR_SLOT_OCCUPIED;
|
return SCE_VIDEO_OUT_ERROR_SLOT_OCCUPIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,7 +226,7 @@ s32 PS4_SYSV_ABI sceVideoOutRegisterBuffers(s32 handle, s32 startIndex, void* co
|
||||||
0, videoOut->getGraphicCtx(), nullptr, reinterpret_cast<uint64_t>(addresses[i]),
|
0, videoOut->getGraphicCtx(), nullptr, reinterpret_cast<uint64_t>(addresses[i]),
|
||||||
buffer_size, buffer_info));
|
buffer_size, buffer_info));
|
||||||
|
|
||||||
LOG_INFO(Lib_VideoOut, "buffers[{}] = {:#x}", i + startIndex,
|
LOG_INFO_IF(log_file_videoout, "buffers[{}] = {:#x}\n", i + startIndex,
|
||||||
reinterpret_cast<u64>(addresses[i]));
|
reinterpret_cast<u64>(addresses[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,41 +234,43 @@ s32 PS4_SYSV_ABI sceVideoOutRegisterBuffers(s32 handle, s32 startIndex, void* co
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceVideoOutSetFlipRate(s32 handle, s32 rate) {
|
s32 PS4_SYSV_ABI sceVideoOutSetFlipRate(s32 handle, s32 rate) {
|
||||||
LOG_INFO(Lib_VideoOut, "called");
|
PRINT_FUNCTION_NAME();
|
||||||
auto* videoOut = Common::Singleton<HLE::Graphics::Objects::VideoOutCtx>::Instance();
|
auto* videoOut = Common::Singleton<HLE::Graphics::Objects::VideoOutCtx>::Instance();
|
||||||
videoOut->getCtx(handle)->m_flip_rate = rate;
|
videoOut->getCtx(handle)->m_flip_rate = rate;
|
||||||
return SCE_OK;
|
return SCE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceVideoOutIsFlipPending(s32 handle) {
|
s32 PS4_SYSV_ABI sceVideoOutIsFlipPending(s32 handle) {
|
||||||
LOG_INFO(Lib_VideoOut, "called");
|
PRINT_FUNCTION_NAME();
|
||||||
auto* videoOut = Common::Singleton<HLE::Graphics::Objects::VideoOutCtx>::Instance();
|
auto* videoOut = Common::Singleton<HLE::Graphics::Objects::VideoOutCtx>::Instance();
|
||||||
s32 pending = videoOut->getCtx(handle)->m_flip_status.flipPendingNum;
|
s32 pending = videoOut->getCtx(handle)->m_flip_status.flipPendingNum;
|
||||||
return pending;
|
return pending;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceVideoOutSubmitFlip(s32 handle, s32 bufferIndex, s32 flipMode, s64 flipArg) {
|
s32 PS4_SYSV_ABI sceVideoOutSubmitFlip(s32 handle, s32 bufferIndex, s32 flipMode, s64 flipArg) {
|
||||||
|
PRINT_FUNCTION_NAME();
|
||||||
auto* videoOut = Common::Singleton<HLE::Graphics::Objects::VideoOutCtx>::Instance();
|
auto* videoOut = Common::Singleton<HLE::Graphics::Objects::VideoOutCtx>::Instance();
|
||||||
auto* ctx = videoOut->getCtx(handle);
|
auto* ctx = videoOut->getCtx(handle);
|
||||||
|
|
||||||
if (flipMode != 1) {
|
if (flipMode != 1) {
|
||||||
// BREAKPOINT(); // only flipmode==1 is supported
|
// BREAKPOINT(); // only flipmode==1 is supported
|
||||||
LOG_WARNING(Lib_VideoOut, "flipmode = {}",
|
LOG_TRACE_IF(log_file_videoout, "sceVideoOutSubmitFlip flipmode {}\n",
|
||||||
flipMode); // openBOR needs 2 but seems to work
|
bufferIndex); // openBOR needs 2 but seems to work
|
||||||
}
|
}
|
||||||
if (bufferIndex == -1) {
|
if (bufferIndex == -1) {
|
||||||
BREAKPOINT(); // blank output not supported
|
BREAKPOINT(); // blank output not supported
|
||||||
}
|
}
|
||||||
if (bufferIndex < -1 || bufferIndex > 15) {
|
if (bufferIndex < -1 || bufferIndex > 15) {
|
||||||
LOG_ERROR(Lib_VideoOut, "Invalid bufferIndex = {}", bufferIndex);
|
LOG_TRACE_IF(log_file_videoout, "sceVideoOutSubmitFlip invalid bufferIndex {}\n",
|
||||||
|
bufferIndex);
|
||||||
return SCE_VIDEO_OUT_ERROR_INVALID_INDEX;
|
return SCE_VIDEO_OUT_ERROR_INVALID_INDEX;
|
||||||
}
|
}
|
||||||
|
LOG_INFO_IF(log_file_videoout, "bufferIndex = {}\n", bufferIndex);
|
||||||
LOG_INFO(Lib_VideoOut, "bufferIndex = {}, flipMode = {}, flipArg = {}", bufferIndex, flipMode,
|
LOG_INFO_IF(log_file_videoout, "flipMode = {}\n", flipMode);
|
||||||
flipArg);
|
LOG_INFO_IF(log_file_videoout, "flipArg = {}\n", flipArg);
|
||||||
|
|
||||||
if (!videoOut->getFlipQueue().submitFlip(ctx, bufferIndex, flipArg)) {
|
if (!videoOut->getFlipQueue().submitFlip(ctx, bufferIndex, flipArg)) {
|
||||||
LOG_ERROR(Lib_VideoOut, "Flip queue is full");
|
LOG_TRACE_IF(log_file_videoout, "sceVideoOutSubmitFlip flip queue is full\n");
|
||||||
return SCE_VIDEO_OUT_ERROR_FLIP_QUEUE_FULL;
|
return SCE_VIDEO_OUT_ERROR_FLIP_QUEUE_FULL;
|
||||||
}
|
}
|
||||||
Core::Libraries::LibSceGnmDriver::sceGnmFlushGarlic(); // hackish should be done that neccesary
|
Core::Libraries::LibSceGnmDriver::sceGnmFlushGarlic(); // hackish should be done that neccesary
|
||||||
|
@ -269,20 +279,24 @@ s32 PS4_SYSV_ABI sceVideoOutSubmitFlip(s32 handle, s32 bufferIndex, s32 flipMode
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceVideoOutGetFlipStatus(s32 handle, SceVideoOutFlipStatus* status) {
|
s32 PS4_SYSV_ABI sceVideoOutGetFlipStatus(s32 handle, SceVideoOutFlipStatus* status) {
|
||||||
|
PRINT_FUNCTION_NAME();
|
||||||
auto* videoOut = Common::Singleton<HLE::Graphics::Objects::VideoOutCtx>::Instance();
|
auto* videoOut = Common::Singleton<HLE::Graphics::Objects::VideoOutCtx>::Instance();
|
||||||
auto* ctx = videoOut->getCtx(handle);
|
auto* ctx = videoOut->getCtx(handle);
|
||||||
videoOut->getFlipQueue().getFlipStatus(ctx, status);
|
videoOut->getFlipQueue().getFlipStatus(ctx, status);
|
||||||
|
|
||||||
LOG_INFO(Lib_VideoOut,
|
LOG_INFO_IF(log_file_videoout, "count = {}\n", status->count);
|
||||||
"count = {}, processTime = {}, tsc = {}, submitTsc = {}, flipArg = {}, gcQueueNum = "
|
LOG_INFO_IF(log_file_videoout, "processTime = {}\n", status->processTime);
|
||||||
"{}, flipPendingNum = {}, currentBuffer = {}",
|
LOG_INFO_IF(log_file_videoout, "tsc = {}\n", status->tsc);
|
||||||
status->count, status->processTime, status->tsc, status->submitTsc, status->flipArg,
|
LOG_INFO_IF(log_file_videoout, "submitTsc = {}\n", status->submitTsc);
|
||||||
status->gcQueueNum, status->flipPendingNum, status->currentBuffer);
|
LOG_INFO_IF(log_file_videoout, "flipArg = {}\n", status->flipArg);
|
||||||
|
LOG_INFO_IF(log_file_videoout, "gcQueueNum = {}\n", status->gcQueueNum);
|
||||||
|
LOG_INFO_IF(log_file_videoout, "flipPendingNum = {}\n", status->flipPendingNum);
|
||||||
|
LOG_INFO_IF(log_file_videoout, "currentBuffer = {}\n", status->currentBuffer);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceVideoOutGetResolutionStatus(s32 handle, SceVideoOutResolutionStatus* status) {
|
s32 PS4_SYSV_ABI sceVideoOutGetResolutionStatus(s32 handle, SceVideoOutResolutionStatus* status) {
|
||||||
LOG_INFO(Lib_VideoOut, "called");
|
PRINT_FUNCTION_NAME();
|
||||||
auto* videoOut = Common::Singleton<HLE::Graphics::Objects::VideoOutCtx>::Instance();
|
auto* videoOut = Common::Singleton<HLE::Graphics::Objects::VideoOutCtx>::Instance();
|
||||||
*status = videoOut->getCtx(handle)->m_resolution;
|
*status = videoOut->getCtx(handle)->m_resolution;
|
||||||
return SCE_OK;
|
return SCE_OK;
|
||||||
|
@ -290,15 +304,15 @@ s32 PS4_SYSV_ABI sceVideoOutGetResolutionStatus(s32 handle, SceVideoOutResolutio
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceVideoOutOpen(SceUserServiceUserId userId, s32 busType, s32 index,
|
s32 PS4_SYSV_ABI sceVideoOutOpen(SceUserServiceUserId userId, s32 busType, s32 index,
|
||||||
const void* param) {
|
const void* param) {
|
||||||
LOG_INFO(Lib_VideoOut, "called");
|
PRINT_FUNCTION_NAME();
|
||||||
if (userId != SCE_USER_SERVICE_USER_ID_SYSTEM && userId != 0) {
|
if (userId != 255 && userId != 0) {
|
||||||
BREAKPOINT();
|
BREAKPOINT();
|
||||||
}
|
}
|
||||||
if (busType != SCE_VIDEO_OUT_BUS_TYPE_MAIN) {
|
if (busType != SCE_VIDEO_OUT_BUS_TYPE_MAIN) {
|
||||||
BREAKPOINT();
|
BREAKPOINT();
|
||||||
}
|
}
|
||||||
if (index != 0) {
|
if (index != 0) {
|
||||||
LOG_ERROR(Lib_VideoOut, "Index != 0");
|
LOG_TRACE_IF(log_file_videoout, "sceVideoOutOpen index!=0\n");
|
||||||
return SCE_VIDEO_OUT_ERROR_INVALID_VALUE;
|
return SCE_VIDEO_OUT_ERROR_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
if (param != nullptr) {
|
if (param != nullptr) {
|
||||||
|
@ -308,7 +322,7 @@ s32 PS4_SYSV_ABI sceVideoOutOpen(SceUserServiceUserId userId, s32 busType, s32 i
|
||||||
int handle = videoOut->Open();
|
int handle = videoOut->Open();
|
||||||
|
|
||||||
if (handle < 0) {
|
if (handle < 0) {
|
||||||
LOG_ERROR(Lib_VideoOut, "All available handles are open");
|
LOG_TRACE_IF(log_file_videoout, "sceVideoOutOpen all available handles are open\n");
|
||||||
return SCE_VIDEO_OUT_ERROR_RESOURCE_BUSY; // it is alreadyOpened
|
return SCE_VIDEO_OUT_ERROR_RESOURCE_BUSY; // it is alreadyOpened
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,6 +341,7 @@ s32 PS4_SYSV_ABI sceVideoOutUnregisterBuffers(s32 handle, s32 attributeIndex) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void videoOutRegisterLib(Core::Loader::SymbolsResolver* sym) {
|
void videoOutRegisterLib(Core::Loader::SymbolsResolver* sym) {
|
||||||
|
using namespace Core;
|
||||||
LIB_FUNCTION("SbU3dwp80lQ", "libSceVideoOut", 1, "libSceVideoOut", 0, 0,
|
LIB_FUNCTION("SbU3dwp80lQ", "libSceVideoOut", 1, "libSceVideoOut", 0, 0,
|
||||||
sceVideoOutGetFlipStatus);
|
sceVideoOutGetFlipStatus);
|
||||||
LIB_FUNCTION("U46NwOiJpys", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutSubmitFlip);
|
LIB_FUNCTION("U46NwOiJpys", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutSubmitFlip);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "common/logging/log.h"
|
#include "common/log.h"
|
||||||
#include "core/aerolib/aerolib.h"
|
#include "core/aerolib/aerolib.h"
|
||||||
#include "core/aerolib/stubs.h"
|
#include "core/aerolib/stubs.h"
|
||||||
|
|
||||||
|
@ -19,15 +19,16 @@ namespace Core::AeroLib {
|
||||||
// and to longer compile / CI times
|
// and to longer compile / CI times
|
||||||
//
|
//
|
||||||
// Must match STUBS_LIST define
|
// Must match STUBS_LIST define
|
||||||
constexpr u32 MAX_STUBS = 128;
|
constexpr u32 MAX_STUBS = 512;
|
||||||
|
|
||||||
u64 UnresolvedStub() {
|
u64 UnresolvedStub() {
|
||||||
LOG_ERROR(Core, "Returning zero to {}", __builtin_return_address(0));
|
LOG_ERROR("Unresolved Stub: called, returning zero to {}\n", __builtin_return_address(0));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u64 UnknownStub() {
|
static u64 UnknownStub() {
|
||||||
LOG_ERROR(Core, "Returning zero to {}", __builtin_return_address(0));
|
LOG_ERROR("Stub: Unknown (nid: Unknown) called, returning zero to {}\n",
|
||||||
|
__builtin_return_address(0));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,10 +39,10 @@ template <int stub_index>
|
||||||
static u64 CommonStub() {
|
static u64 CommonStub() {
|
||||||
auto entry = stub_nids[stub_index];
|
auto entry = stub_nids[stub_index];
|
||||||
if (entry) {
|
if (entry) {
|
||||||
LOG_ERROR(Core, "Stub: {} (nid: {}) called, returning zero to {}", entry->name, entry->nid,
|
LOG_ERROR("Stub: {} (nid: {}) called, returning zero to {}\n", entry->name, entry->nid,
|
||||||
__builtin_return_address(0));
|
__builtin_return_address(0));
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR(Core, "Stub: Unknown (nid: {}) called, returning zero to {}",
|
LOG_ERROR("Stub: Unknown (nid: {}) called, returning zero to {}\n",
|
||||||
stub_nids_unknown[stub_index], __builtin_return_address(0));
|
stub_nids_unknown[stub_index], __builtin_return_address(0));
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -61,7 +62,7 @@ static u32 UsedStubEntries;
|
||||||
#define XREP_256(x) XREP_128(x) XREP_128(x + 128)
|
#define XREP_256(x) XREP_128(x) XREP_128(x + 128)
|
||||||
#define XREP_512(x) XREP_256(x) XREP_256(x + 256)
|
#define XREP_512(x) XREP_256(x) XREP_256(x + 256)
|
||||||
|
|
||||||
#define STUBS_LIST XREP_128(0)
|
#define STUBS_LIST XREP_512(0)
|
||||||
|
|
||||||
static u64 (*stub_handlers[MAX_STUBS])() = {STUBS_LIST};
|
static u64 (*stub_handlers[MAX_STUBS])() = {STUBS_LIST};
|
||||||
|
|
||||||
|
|
|
@ -8,24 +8,21 @@ namespace Core::FileSys {
|
||||||
|
|
||||||
constexpr int RESERVED_HANDLES = 3; // First 3 handles are stdin,stdout,stderr
|
constexpr int RESERVED_HANDLES = 3; // First 3 handles are stdin,stdout,stderr
|
||||||
|
|
||||||
void MntPoints::Mount(const std::filesystem::path& host_folder, const std::string& guest_folder) {
|
void MntPoints::mount(const std::string& host_folder, const std::string& guest_folder) {
|
||||||
std::scoped_lock lock{m_mutex};
|
std::scoped_lock lock{m_mutex};
|
||||||
|
|
||||||
MntPair pair;
|
MntPair pair;
|
||||||
pair.host_path = host_folder.string();
|
pair.host_path = host_folder;
|
||||||
pair.guest_path = guest_folder;
|
pair.guest_path = guest_folder;
|
||||||
|
|
||||||
m_mnt_pairs.push_back(pair);
|
m_mnt_pairs.push_back(pair);
|
||||||
}
|
}
|
||||||
|
void MntPoints::unmount(const std::string& path) {} // TODO!
|
||||||
void MntPoints::Unmount(const std::string& path) {} // TODO!
|
void MntPoints::unmountAll() {
|
||||||
|
|
||||||
void MntPoints::UnmountAll() {
|
|
||||||
std::scoped_lock lock{m_mutex};
|
std::scoped_lock lock{m_mutex};
|
||||||
m_mnt_pairs.clear();
|
m_mnt_pairs.clear();
|
||||||
}
|
}
|
||||||
|
std::string MntPoints::getHostDirectory(const std::string& guest_directory) {
|
||||||
std::string MntPoints::GetHostDirectory(const std::string& guest_directory) {
|
|
||||||
std::scoped_lock lock{m_mutex};
|
std::scoped_lock lock{m_mutex};
|
||||||
for (auto& pair : m_mnt_pairs) {
|
for (auto& pair : m_mnt_pairs) {
|
||||||
if (pair.guest_path.starts_with(guest_directory)) {
|
if (pair.guest_path.starts_with(guest_directory)) {
|
||||||
|
@ -41,8 +38,7 @@ std::string MntPoints::GetHostDirectory(const std::string& guest_directory) {
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
std::string MntPoints::getHostFile(const std::string& guest_file) {
|
||||||
std::string MntPoints::GetHostFile(const std::string& guest_file) {
|
|
||||||
std::scoped_lock lock{m_mutex};
|
std::scoped_lock lock{m_mutex};
|
||||||
|
|
||||||
for (auto& pair : m_mnt_pairs) {
|
for (auto& pair : m_mnt_pairs) {
|
||||||
|
@ -56,13 +52,11 @@ std::string MntPoints::GetHostFile(const std::string& guest_file) {
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
int HandleTable::createHandle() {
|
||||||
int HandleTable::CreateHandle() {
|
|
||||||
std::scoped_lock lock{m_mutex};
|
std::scoped_lock lock{m_mutex};
|
||||||
|
|
||||||
auto* file = new File{};
|
auto* file = new File{};
|
||||||
file->is_directory = false;
|
file->isDirectory = false;
|
||||||
file->is_opened = false;
|
file->isOpened = false;
|
||||||
|
|
||||||
int existingFilesNum = m_files.size();
|
int existingFilesNum = m_files.size();
|
||||||
|
|
||||||
|
@ -74,20 +68,19 @@ int HandleTable::CreateHandle() {
|
||||||
}
|
}
|
||||||
|
|
||||||
m_files.push_back(file);
|
m_files.push_back(file);
|
||||||
|
|
||||||
return m_files.size() + RESERVED_HANDLES - 1;
|
return m_files.size() + RESERVED_HANDLES - 1;
|
||||||
}
|
}
|
||||||
|
void HandleTable::deleteHandle(int d) {
|
||||||
void HandleTable::DeleteHandle(int d) {
|
|
||||||
std::scoped_lock lock{m_mutex};
|
std::scoped_lock lock{m_mutex};
|
||||||
delete m_files.at(d - RESERVED_HANDLES);
|
delete m_files.at(d - RESERVED_HANDLES);
|
||||||
m_files[d - RESERVED_HANDLES] = nullptr;
|
m_files[d - RESERVED_HANDLES] = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
File* HandleTable::GetFile(int d) {
|
File* HandleTable::getFile(int d) {
|
||||||
std::scoped_lock lock{m_mutex};
|
std::scoped_lock lock{m_mutex};
|
||||||
return m_files.at(d - RESERVED_HANDLES);
|
return m_files.at(d - RESERVED_HANDLES);
|
||||||
}
|
}
|
||||||
|
|
||||||
File* HandleTable::getFile(const std::string& host_name) {
|
File* HandleTable::getFile(const std::string& host_name) {
|
||||||
std::scoped_lock lock{m_mutex};
|
std::scoped_lock lock{m_mutex};
|
||||||
for (auto* file : m_files) {
|
for (auto* file : m_files) {
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include "common/fs_file.h"
|
||||||
#include "common/io_file.h"
|
#include "common/io_file.h"
|
||||||
|
|
||||||
namespace Core::FileSys {
|
namespace Core::FileSys {
|
||||||
|
@ -20,12 +21,11 @@ public:
|
||||||
|
|
||||||
MntPoints() = default;
|
MntPoints() = default;
|
||||||
virtual ~MntPoints() = default;
|
virtual ~MntPoints() = default;
|
||||||
|
void mount(const std::string& host_folder, const std::string& guest_folder);
|
||||||
void Mount(const std::filesystem::path& host_folder, const std::string& guest_folder);
|
void unmount(const std::string& path);
|
||||||
void Unmount(const std::string& path);
|
void unmountAll();
|
||||||
void UnmountAll();
|
std::string getHostDirectory(const std::string& guest_directory);
|
||||||
std::string GetHostDirectory(const std::string& guest_directory);
|
std::string getHostFile(const std::string& guest_file);
|
||||||
std::string GetHostFile(const std::string& guest_file);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<MntPair> m_mnt_pairs;
|
std::vector<MntPair> m_mnt_pairs;
|
||||||
|
@ -33,8 +33,8 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
struct File {
|
struct File {
|
||||||
std::atomic_bool is_opened{};
|
std::atomic_bool isOpened;
|
||||||
std::atomic_bool is_directory{};
|
std::atomic_bool isDirectory;
|
||||||
std::string m_host_name;
|
std::string m_host_name;
|
||||||
std::string m_guest_name;
|
std::string m_guest_name;
|
||||||
Common::FS::IOFile f;
|
Common::FS::IOFile f;
|
||||||
|
@ -42,15 +42,13 @@ struct File {
|
||||||
u32 dirents_index;
|
u32 dirents_index;
|
||||||
std::mutex m_mutex;
|
std::mutex m_mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
class HandleTable {
|
class HandleTable {
|
||||||
public:
|
public:
|
||||||
HandleTable() = default;
|
HandleTable() {}
|
||||||
virtual ~HandleTable() = default;
|
virtual ~HandleTable() {}
|
||||||
|
int createHandle();
|
||||||
int CreateHandle();
|
void deleteHandle(int d);
|
||||||
void DeleteHandle(int d);
|
File* getFile(int d);
|
||||||
File* GetFile(int d);
|
|
||||||
File* getFile(const std::string& host_name);
|
File* getFile(const std::string& host_name);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -2,13 +2,14 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "Util/config.h"
|
#include "Util/config.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/log.h"
|
||||||
#include "core/hle/kernel/cpu_management.h"
|
#include "core/hle/kernel/cpu_management.h"
|
||||||
|
#include "core/hle/libraries/libs.h"
|
||||||
|
|
||||||
namespace Core::Kernel {
|
namespace Core::Kernel {
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceKernelIsNeoMode() {
|
int PS4_SYSV_ABI sceKernelIsNeoMode() {
|
||||||
LOG_INFO(Kernel_Sce, "called");
|
PRINT_FUNCTION_NAME();
|
||||||
return Config::isNeoMode();
|
return Config::isNeoMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,44 +1,51 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/debug.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/log.h"
|
||||||
#include "core/hle/error_codes.h"
|
#include "core/hle/error_codes.h"
|
||||||
#include "core/hle/kernel/event_queues.h"
|
#include "core/hle/kernel/event_queues.h"
|
||||||
|
#include "core/hle/libraries/libs.h"
|
||||||
|
|
||||||
namespace Core::Kernel {
|
namespace Core::Kernel {
|
||||||
|
|
||||||
|
constexpr bool log_file_equeues = true; // disable it to disable logging
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceKernelCreateEqueue(SceKernelEqueue* eq, const char* name) {
|
int PS4_SYSV_ABI sceKernelCreateEqueue(SceKernelEqueue* eq, const char* name) {
|
||||||
|
PRINT_FUNCTION_NAME();
|
||||||
|
|
||||||
if (eq == nullptr) {
|
if (eq == nullptr) {
|
||||||
LOG_ERROR(Kernel_Event, "Event queue is null!");
|
LOG_TRACE_IF(log_file_equeues,
|
||||||
|
"sceKernelCreateEqueue returned SCE_KERNEL_ERROR_EINVAL eq invalid\n");
|
||||||
return SCE_KERNEL_ERROR_EINVAL;
|
return SCE_KERNEL_ERROR_EINVAL;
|
||||||
}
|
}
|
||||||
if (name == nullptr) {
|
if (name == nullptr) {
|
||||||
LOG_ERROR(Kernel_Event, "Event queue name is invalid!");
|
LOG_TRACE_IF(log_file_equeues,
|
||||||
|
"sceKernelCreateEqueue returned SCE_KERNEL_ERROR_EFAULT name invalid\n");
|
||||||
return SCE_KERNEL_ERROR_EFAULT;
|
return SCE_KERNEL_ERROR_EFAULT;
|
||||||
}
|
}
|
||||||
if (name == NULL) {
|
if (name == NULL) {
|
||||||
LOG_ERROR(Kernel_Event, "Event queue name is null!");
|
LOG_TRACE_IF(log_file_equeues,
|
||||||
|
"sceKernelCreateEqueue returned SCE_KERNEL_ERROR_EINVAL name is null\n");
|
||||||
return SCE_KERNEL_ERROR_EINVAL;
|
return SCE_KERNEL_ERROR_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Maximum is 32 including null terminator
|
if (strlen(name) > 31) { // max is 32 including null terminator
|
||||||
static constexpr size_t MaxEventQueueNameSize = 32;
|
LOG_TRACE_IF(log_file_equeues,
|
||||||
if (std::strlen(name) > MaxEventQueueNameSize) {
|
"sceKernelCreateEqueue returned SCE_KERNEL_ERROR_ENAMETOOLONG name size "
|
||||||
LOG_ERROR(Kernel_Event, "Event queue name exceeds 32 bytes!");
|
"exceeds 32 bytes\n");
|
||||||
return SCE_KERNEL_ERROR_ENAMETOOLONG;
|
return SCE_KERNEL_ERROR_ENAMETOOLONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INFO(Kernel_Event, "name = {}", name);
|
|
||||||
|
|
||||||
*eq = new EqueueInternal;
|
*eq = new EqueueInternal;
|
||||||
(*eq)->setName(std::string(name));
|
(*eq)->setName(std::string(name));
|
||||||
|
|
||||||
|
LOG_INFO_IF(log_file_equeues, "sceKernelCreateEqueue created with name \"{}\"\n", name);
|
||||||
return SCE_OK;
|
return SCE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceKernelWaitEqueue(SceKernelEqueue eq, SceKernelEvent* ev, int num, int* out,
|
int PS4_SYSV_ABI sceKernelWaitEqueue(SceKernelEqueue eq, SceKernelEvent* ev, int num, int* out,
|
||||||
SceKernelUseconds* timo) {
|
SceKernelUseconds* timo) {
|
||||||
LOG_INFO(Kernel_Event, "num = {}", num);
|
PRINT_FUNCTION_NAME();
|
||||||
|
|
||||||
if (eq == nullptr) {
|
if (eq == nullptr) {
|
||||||
return SCE_KERNEL_ERROR_EBADF;
|
return SCE_KERNEL_ERROR_EBADF;
|
||||||
|
@ -59,10 +66,10 @@ int PS4_SYSV_ABI sceKernelWaitEqueue(SceKernelEqueue eq, SceKernelEvent* ev, int
|
||||||
if (timo != nullptr) {
|
if (timo != nullptr) {
|
||||||
// Only events that have already arrived at the time of this function call can be received
|
// Only events that have already arrived at the time of this function call can be received
|
||||||
if (*timo == 0) {
|
if (*timo == 0) {
|
||||||
UNREACHABLE();
|
BREAKPOINT();
|
||||||
} else {
|
} else {
|
||||||
// Wait until an event arrives with timing out
|
// Wait until an event arrives with timing out
|
||||||
UNREACHABLE();
|
BREAKPOINT();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,85 +2,106 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include <bit>
|
#include <bit>
|
||||||
#include "common/assert.h"
|
#include <magic_enum.hpp>
|
||||||
#include "common/logging/log.h"
|
#include "common/debug.h"
|
||||||
|
#include "common/log.h"
|
||||||
#include "common/singleton.h"
|
#include "common/singleton.h"
|
||||||
#include "core/PS4/GPU/gpu_memory.h"
|
#include "core/PS4/GPU/gpu_memory.h"
|
||||||
#include "core/hle/error_codes.h"
|
#include "core/hle/error_codes.h"
|
||||||
#include "core/hle/kernel/Objects/physical_memory.h"
|
#include "core/hle/kernel/Objects/physical_memory.h"
|
||||||
#include "core/hle/kernel/memory_management.h"
|
#include "core/hle/kernel/memory_management.h"
|
||||||
|
#include "core/hle/libraries/libs.h"
|
||||||
#include "core/virtual_memory.h"
|
#include "core/virtual_memory.h"
|
||||||
|
|
||||||
namespace Core::Kernel {
|
namespace Core::Kernel {
|
||||||
|
|
||||||
|
constexpr bool log_file_memory = true; // disable it to disable logging
|
||||||
|
|
||||||
bool is16KBAligned(u64 n) {
|
bool is16KBAligned(u64 n) {
|
||||||
return ((n % (16ull * 1024) == 0));
|
return ((n % (16ull * 1024) == 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 PS4_SYSV_ABI sceKernelGetDirectMemorySize() {
|
u64 PS4_SYSV_ABI sceKernelGetDirectMemorySize() {
|
||||||
LOG_WARNING(Kernel_Vmm, "(STUBBED) called");
|
PRINT_FUNCTION_NAME();
|
||||||
return SCE_KERNEL_MAIN_DMEM_SIZE;
|
return SCE_KERNEL_MAIN_DMEM_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceKernelAllocateDirectMemory(s64 searchStart, s64 searchEnd, u64 len,
|
int PS4_SYSV_ABI sceKernelAllocateDirectMemory(s64 searchStart, s64 searchEnd, u64 len,
|
||||||
u64 alignment, int memoryType, s64* physAddrOut) {
|
u64 alignment, int memoryType, s64* physAddrOut) {
|
||||||
LOG_INFO(Kernel_Vmm,
|
PRINT_FUNCTION_NAME();
|
||||||
"searchStart = {:#x}, searchEnd = {:#x}, len = {:#x}, alignment = {:#x}, memoryType = "
|
|
||||||
"{:#x}",
|
|
||||||
searchStart, searchEnd, len, alignment, memoryType);
|
|
||||||
|
|
||||||
if (searchStart < 0 || searchEnd <= searchStart) {
|
if (searchStart < 0 || searchEnd <= searchStart) {
|
||||||
LOG_ERROR(Kernel_Vmm, "Provided address range is invalid!");
|
LOG_TRACE_IF(log_file_memory, "sceKernelAllocateDirectMemory returned "
|
||||||
|
"SCE_KERNEL_ERROR_EINVAL searchStart,searchEnd invalid\n");
|
||||||
return SCE_KERNEL_ERROR_EINVAL;
|
return SCE_KERNEL_ERROR_EINVAL;
|
||||||
}
|
}
|
||||||
const bool is_in_range = (searchStart < len && searchEnd > len);
|
bool isInRange = (searchStart < len && searchEnd > len);
|
||||||
if (len <= 0 || !is16KBAligned(len) || !is_in_range) {
|
if (len <= 0 || !is16KBAligned(len) || !isInRange) {
|
||||||
LOG_ERROR(Kernel_Vmm, "Provided address range is invalid!");
|
LOG_TRACE_IF(log_file_memory, "sceKernelAllocateDirectMemory returned "
|
||||||
|
"SCE_KERNEL_ERROR_EINVAL memory range invalid\n");
|
||||||
return SCE_KERNEL_ERROR_EINVAL;
|
return SCE_KERNEL_ERROR_EINVAL;
|
||||||
}
|
}
|
||||||
if ((alignment != 0 || is16KBAligned(alignment)) && !std::has_single_bit(alignment)) {
|
if ((alignment != 0 || is16KBAligned(alignment)) && !std::has_single_bit(alignment)) {
|
||||||
LOG_ERROR(Kernel_Vmm, "Alignment value is invalid!");
|
LOG_TRACE_IF(
|
||||||
|
log_file_memory,
|
||||||
|
"sceKernelAllocateDirectMemory returned SCE_KERNEL_ERROR_EINVAL alignment invalid\n");
|
||||||
return SCE_KERNEL_ERROR_EINVAL;
|
return SCE_KERNEL_ERROR_EINVAL;
|
||||||
}
|
}
|
||||||
if (physAddrOut == nullptr) {
|
if (physAddrOut == nullptr) {
|
||||||
LOG_ERROR(Kernel_Vmm, "Result physical address pointer is null!");
|
LOG_TRACE_IF(
|
||||||
|
log_file_memory,
|
||||||
|
"sceKernelAllocateDirectMemory returned SCE_KERNEL_ERROR_EINVAL physAddrOut is null\n");
|
||||||
return SCE_KERNEL_ERROR_EINVAL;
|
return SCE_KERNEL_ERROR_EINVAL;
|
||||||
}
|
}
|
||||||
|
auto memtype = magic_enum::enum_cast<MemoryTypes>(memoryType);
|
||||||
|
|
||||||
|
LOG_INFO_IF(log_file_memory, "search_start = {:#x}\n", searchStart);
|
||||||
|
LOG_INFO_IF(log_file_memory, "search_end = {:#x}\n", searchEnd);
|
||||||
|
LOG_INFO_IF(log_file_memory, "len = {:#x}\n", len);
|
||||||
|
LOG_INFO_IF(log_file_memory, "alignment = {:#x}\n", alignment);
|
||||||
|
LOG_INFO_IF(log_file_memory, "memory_type = {}\n", magic_enum::enum_name(memtype.value()));
|
||||||
|
|
||||||
u64 physical_addr = 0;
|
u64 physical_addr = 0;
|
||||||
auto* physical_memory = Common::Singleton<PhysicalMemory>::Instance();
|
auto* physical_memory = Common::Singleton<PhysicalMemory>::Instance();
|
||||||
if (!physical_memory->Alloc(searchStart, searchEnd, len, alignment, &physical_addr,
|
if (!physical_memory->Alloc(searchStart, searchEnd, len, alignment, &physical_addr,
|
||||||
memoryType)) {
|
memoryType)) {
|
||||||
LOG_CRITICAL(Kernel_Vmm, "Unable to allocate physical memory");
|
LOG_TRACE_IF(log_file_memory, "sceKernelAllocateDirectMemory returned "
|
||||||
|
"SCE_KERNEL_ERROR_EAGAIN can't allocate physical memory\n");
|
||||||
return SCE_KERNEL_ERROR_EAGAIN;
|
return SCE_KERNEL_ERROR_EAGAIN;
|
||||||
}
|
}
|
||||||
*physAddrOut = static_cast<s64>(physical_addr);
|
*physAddrOut = static_cast<s64>(physical_addr);
|
||||||
LOG_INFO(Kernel_Vmm, "physAddrOut = {:#x}", physical_addr);
|
LOG_INFO_IF(true, "physAddrOut = {:#x}\n", physical_addr);
|
||||||
return SCE_OK;
|
return SCE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceKernelMapDirectMemory(void** addr, u64 len, int prot, int flags,
|
int PS4_SYSV_ABI sceKernelMapDirectMemory(void** addr, u64 len, int prot, int flags,
|
||||||
s64 directMemoryStart, u64 alignment) {
|
s64 directMemoryStart, u64 alignment) {
|
||||||
LOG_INFO(
|
PRINT_FUNCTION_NAME();
|
||||||
Kernel_Vmm,
|
|
||||||
"len = {:#x}, prot = {:#x}, flags = {:#x}, directMemoryStart = {:#x}, alignment = {:#x}",
|
|
||||||
len, prot, flags, directMemoryStart, alignment);
|
|
||||||
|
|
||||||
if (len == 0 || !is16KBAligned(len)) {
|
if (len == 0 || !is16KBAligned(len)) {
|
||||||
LOG_ERROR(Kernel_Vmm, "Map size is either zero or not 16KB aligned!");
|
LOG_TRACE_IF(log_file_memory,
|
||||||
|
"sceKernelMapDirectMemory returned SCE_KERNEL_ERROR_EINVAL len invalid\n");
|
||||||
return SCE_KERNEL_ERROR_EINVAL;
|
return SCE_KERNEL_ERROR_EINVAL;
|
||||||
}
|
}
|
||||||
if (!is16KBAligned(directMemoryStart)) {
|
if (!is16KBAligned(directMemoryStart)) {
|
||||||
LOG_ERROR(Kernel_Vmm, "Start address is not 16KB aligned!");
|
LOG_TRACE_IF(log_file_memory, "sceKernelMapDirectMemory returned SCE_KERNEL_ERROR_EINVAL "
|
||||||
|
"directMemoryStart invalid\n");
|
||||||
return SCE_KERNEL_ERROR_EINVAL;
|
return SCE_KERNEL_ERROR_EINVAL;
|
||||||
}
|
}
|
||||||
if (alignment != 0) {
|
if (alignment != 0) {
|
||||||
if ((!std::has_single_bit(alignment) && !is16KBAligned(alignment))) {
|
if ((!std::has_single_bit(alignment) && !is16KBAligned(alignment))) {
|
||||||
LOG_ERROR(Kernel_Vmm, "Alignment value is invalid!");
|
LOG_TRACE_IF(
|
||||||
|
log_file_memory,
|
||||||
|
"sceKernelMapDirectMemory returned SCE_KERNEL_ERROR_EINVAL alignment invalid\n");
|
||||||
return SCE_KERNEL_ERROR_EINVAL;
|
return SCE_KERNEL_ERROR_EINVAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOG_INFO_IF(log_file_memory, "len = {:#x}\n", len);
|
||||||
|
LOG_INFO_IF(log_file_memory, "prot = {:#x}\n", prot);
|
||||||
|
LOG_INFO_IF(log_file_memory, "flags = {:#x}\n", flags);
|
||||||
|
LOG_INFO_IF(log_file_memory, "directMemoryStart = {:#x}\n", directMemoryStart);
|
||||||
|
LOG_INFO_IF(log_file_memory, "alignment = {:#x}\n", alignment);
|
||||||
|
|
||||||
VirtualMemory::MemoryMode cpu_mode = VirtualMemory::MemoryMode::NoAccess;
|
VirtualMemory::MemoryMode cpu_mode = VirtualMemory::MemoryMode::NoAccess;
|
||||||
GPU::MemoryMode gpu_mode = GPU::MemoryMode::NoAccess;
|
GPU::MemoryMode gpu_mode = GPU::MemoryMode::NoAccess;
|
||||||
|
|
||||||
|
@ -91,7 +112,7 @@ int PS4_SYSV_ABI sceKernelMapDirectMemory(void** addr, u64 len, int prot, int fl
|
||||||
gpu_mode = GPU::MemoryMode::ReadWrite;
|
gpu_mode = GPU::MemoryMode::ReadWrite;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
BREAKPOINT();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto in_addr = reinterpret_cast<u64>(*addr);
|
auto in_addr = reinterpret_cast<u64>(*addr);
|
||||||
|
@ -100,7 +121,8 @@ int PS4_SYSV_ABI sceKernelMapDirectMemory(void** addr, u64 len, int prot, int fl
|
||||||
if (flags == 0) {
|
if (flags == 0) {
|
||||||
out_addr = VirtualMemory::memory_alloc_aligned(in_addr, len, cpu_mode, alignment);
|
out_addr = VirtualMemory::memory_alloc_aligned(in_addr, len, cpu_mode, alignment);
|
||||||
}
|
}
|
||||||
LOG_INFO(Kernel_Vmm, "in_addr = {:#x}, out_addr = {:#x}", in_addr, out_addr);
|
LOG_INFO_IF(log_file_memory, "in_addr = {:#x}\n", in_addr);
|
||||||
|
LOG_INFO_IF(log_file_memory, "out_addr = {:#x}\n", out_addr);
|
||||||
|
|
||||||
*addr = reinterpret_cast<void*>(out_addr); // return out_addr to first functions parameter
|
*addr = reinterpret_cast<void*>(out_addr); // return out_addr to first functions parameter
|
||||||
|
|
||||||
|
@ -110,7 +132,7 @@ int PS4_SYSV_ABI sceKernelMapDirectMemory(void** addr, u64 len, int prot, int fl
|
||||||
|
|
||||||
auto* physical_memory = Common::Singleton<PhysicalMemory>::Instance();
|
auto* physical_memory = Common::Singleton<PhysicalMemory>::Instance();
|
||||||
if (!physical_memory->Map(out_addr, directMemoryStart, len, prot, cpu_mode, gpu_mode)) {
|
if (!physical_memory->Map(out_addr, directMemoryStart, len, prot, cpu_mode, gpu_mode)) {
|
||||||
UNREACHABLE();
|
BREAKPOINT();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gpu_mode != GPU::MemoryMode::NoAccess) {
|
if (gpu_mode != GPU::MemoryMode::NoAccess) {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/log.h"
|
||||||
#include "common/singleton.h"
|
#include "common/singleton.h"
|
||||||
#include "core/hle/libraries/libc/libc.h"
|
#include "core/hle/libraries/libc/libc.h"
|
||||||
#include "core/hle/libraries/libc/libc_cxa.h"
|
#include "core/hle/libraries/libc/libc_cxa.h"
|
||||||
|
@ -49,15 +49,15 @@ void PS4_SYSV_ABI ps4___cxa_pure_virtual() {
|
||||||
}
|
}
|
||||||
|
|
||||||
static PS4_SYSV_ABI void ps4_init_env() {
|
static PS4_SYSV_ABI void ps4_init_env() {
|
||||||
LOG_INFO(Lib_LibC, "called");
|
PRINT_DUMMY_FUNCTION_NAME();
|
||||||
}
|
}
|
||||||
|
|
||||||
static PS4_SYSV_ABI void ps4_catchReturnFromMain(int status) {
|
static PS4_SYSV_ABI void ps4_catchReturnFromMain(int status) {
|
||||||
LOG_INFO(Lib_LibC, "returned = {}", status);
|
LOG_INFO_IF(log_file_libc, "catchReturnFromMain returned ={}\n", status);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PS4_SYSV_ABI void ps4__Assert() {
|
static PS4_SYSV_ABI void ps4__Assert() {
|
||||||
LOG_INFO(Lib_LibC, "called");
|
PRINT_DUMMY_FUNCTION_NAME();
|
||||||
BREAKPOINT();
|
BREAKPOINT();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,18 +66,18 @@ PS4_SYSV_ABI void ps4__ZdlPv(void* ptr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
PS4_SYSV_ABI void ps4__ZSt11_Xbad_allocv() {
|
PS4_SYSV_ABI void ps4__ZSt11_Xbad_allocv() {
|
||||||
LOG_INFO(Lib_LibC, "called");
|
PRINT_DUMMY_FUNCTION_NAME();
|
||||||
BREAKPOINT();
|
BREAKPOINT();
|
||||||
}
|
}
|
||||||
|
|
||||||
PS4_SYSV_ABI void ps4__ZSt14_Xlength_errorPKc() {
|
PS4_SYSV_ABI void ps4__ZSt14_Xlength_errorPKc() {
|
||||||
LOG_INFO(Lib_LibC, "called");
|
PRINT_DUMMY_FUNCTION_NAME();
|
||||||
BREAKPOINT();
|
BREAKPOINT();
|
||||||
}
|
}
|
||||||
|
|
||||||
PS4_SYSV_ABI void* ps4__Znwm(u64 count) {
|
PS4_SYSV_ABI void* ps4__Znwm(u64 count) {
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
LOG_INFO(Lib_LibC, "_Znwm count ={}", count);
|
LOG_ERROR_IF(log_file_libc, "_Znwm count ={}\n", count);
|
||||||
BREAKPOINT();
|
BREAKPOINT();
|
||||||
}
|
}
|
||||||
void* ptr = std::malloc(count);
|
void* ptr = std::malloc(count);
|
||||||
|
@ -457,7 +457,6 @@ void libcSymbolsRegister(Loader::SymbolsResolver* sym) {
|
||||||
LIB_FUNCTION("8zTFvBIAIN8", "libc", 1, "libc", 1, 1, ps4_memset);
|
LIB_FUNCTION("8zTFvBIAIN8", "libc", 1, "libc", 1, 1, ps4_memset);
|
||||||
|
|
||||||
// stdio functions
|
// stdio functions
|
||||||
LIB_FUNCTION("xeYO4u7uyJ0", "libc", 1, "libc", 1, 1, ps4_fopen);
|
|
||||||
LIB_FUNCTION("hcuQgD53UxM", "libc", 1, "libc", 1, 1, ps4_printf);
|
LIB_FUNCTION("hcuQgD53UxM", "libc", 1, "libc", 1, 1, ps4_printf);
|
||||||
LIB_FUNCTION("Q2V+iqvjgC0", "libc", 1, "libc", 1, 1, ps4_vsnprintf);
|
LIB_FUNCTION("Q2V+iqvjgC0", "libc", 1, "libc", 1, 1, ps4_vsnprintf);
|
||||||
LIB_FUNCTION("YQ0navp+YIc", "libc", 1, "libc", 1, 1, ps4_puts);
|
LIB_FUNCTION("YQ0navp+YIc", "libc", 1, "libc", 1, 1, ps4_puts);
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "common/logging/log.h"
|
#include "common/debug.h"
|
||||||
|
#include "common/log.h"
|
||||||
#include "core/hle/libraries/libc/libc_cxa.h"
|
#include "core/hle/libraries/libc/libc_cxa.h"
|
||||||
|
|
||||||
// adapted from
|
// adapted from
|
||||||
|
@ -9,6 +10,8 @@
|
||||||
|
|
||||||
namespace Core::Libraries::LibC {
|
namespace Core::Libraries::LibC {
|
||||||
|
|
||||||
|
constexpr bool log_file_cxa = true; // disable it to disable logging
|
||||||
|
|
||||||
// This file implements the __cxa_guard_* functions as defined at:
|
// This file implements the __cxa_guard_* functions as defined at:
|
||||||
// http://www.codesourcery.com/public/cxx-abi/abi.html
|
// http://www.codesourcery.com/public/cxx-abi/abi.html
|
||||||
//
|
//
|
||||||
|
@ -100,7 +103,8 @@ int PS4_SYSV_ABI ps4___cxa_guard_acquire(u64* guard_object) {
|
||||||
|
|
||||||
int result = ::pthread_mutex_lock(guard_mutex());
|
int result = ::pthread_mutex_lock(guard_mutex());
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
LOG_ERROR(Lib_LibC, "pthread_mutex_lock failed with {}", result);
|
LOG_TRACE_IF(log_file_cxa, "__cxa_guard_acquire(): pthread_mutex_lock failed with {}\n",
|
||||||
|
result);
|
||||||
}
|
}
|
||||||
// At this point all other threads will block in __cxa_guard_acquire()
|
// At this point all other threads will block in __cxa_guard_acquire()
|
||||||
|
|
||||||
|
@ -108,7 +112,8 @@ int PS4_SYSV_ABI ps4___cxa_guard_acquire(u64* guard_object) {
|
||||||
if (initializerHasRun(guard_object)) {
|
if (initializerHasRun(guard_object)) {
|
||||||
int result = ::pthread_mutex_unlock(guard_mutex());
|
int result = ::pthread_mutex_unlock(guard_mutex());
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
LOG_ERROR(Lib_LibC, "pthread_mutex_lock failed with {}", result);
|
LOG_TRACE_IF(log_file_cxa,
|
||||||
|
"__cxa_guard_acquire(): pthread_mutex_unlock failed with {}\n", result);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -118,8 +123,8 @@ int PS4_SYSV_ABI ps4___cxa_guard_acquire(u64* guard_object) {
|
||||||
// But if the same thread can call __cxa_guard_acquire() on the
|
// But if the same thread can call __cxa_guard_acquire() on the
|
||||||
// *same* guard object again, we call abort();
|
// *same* guard object again, we call abort();
|
||||||
if (inUse(guard_object)) {
|
if (inUse(guard_object)) {
|
||||||
LOG_ERROR(Lib_LibC,
|
LOG_TRACE_IF(log_file_cxa, "__cxa_guard_acquire(): initializer for function local static "
|
||||||
"initializer for function local static variable called enclosing function");
|
"variable called enclosing function\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// mark this guard object as being in use
|
// mark this guard object as being in use
|
||||||
|
@ -141,7 +146,8 @@ void PS4_SYSV_ABI ps4___cxa_guard_release(u64* guard_object) {
|
||||||
// release global mutex
|
// release global mutex
|
||||||
int result = ::pthread_mutex_unlock(guard_mutex());
|
int result = ::pthread_mutex_unlock(guard_mutex());
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
LOG_ERROR(Lib_LibC, "pthread_mutex_unlock failed with {}", result);
|
LOG_TRACE_IF(log_file_cxa, "__cxa_guard_acquire(): pthread_mutex_unlock failed with {}\n",
|
||||||
|
result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +157,8 @@ void PS4_SYSV_ABI ps4___cxa_guard_release(u64* guard_object) {
|
||||||
void PS4_SYSV_ABI ps4___cxa_guard_abort(u64* guard_object) {
|
void PS4_SYSV_ABI ps4___cxa_guard_abort(u64* guard_object) {
|
||||||
int result = ::pthread_mutex_unlock(guard_mutex());
|
int result = ::pthread_mutex_unlock(guard_mutex());
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
LOG_ERROR(Lib_LibC, "pthread_mutex_unlock failed with {}", result);
|
LOG_TRACE_IF(log_file_cxa, "__cxa_guard_abort(): pthread_mutex_unlock failed with {}\n",
|
||||||
|
result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// now reset state, so possible to try to initialize again
|
// now reset state, so possible to try to initialize again
|
||||||
|
|
|
@ -1,17 +1,13 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/debug.h"
|
||||||
#include "common/singleton.h"
|
#include "common/log.h"
|
||||||
#include "core/file_sys/fs.h"
|
|
||||||
#include "core/hle/libraries/libc/libc_stdio.h"
|
#include "core/hle/libraries/libc/libc_stdio.h"
|
||||||
|
|
||||||
namespace Core::Libraries::LibC {
|
namespace Core::Libraries::LibC {
|
||||||
|
|
||||||
std::FILE* PS4_SYSV_ABI ps4_fopen(const char* filename, const char* mode) {
|
constexpr bool log_file_libc = true; // disable it to disable logging
|
||||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
|
||||||
return std::fopen(mnt->GetHostFile(filename).c_str(), mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
int PS4_SYSV_ABI ps4_printf(VA_ARGS) {
|
int PS4_SYSV_ABI ps4_printf(VA_ARGS) {
|
||||||
VA_CTX(ctx);
|
VA_CTX(ctx);
|
||||||
|
@ -24,8 +20,8 @@ int PS4_SYSV_ABI ps4_fprintf(FILE* file, VA_ARGS) {
|
||||||
VA_CTX(ctx);
|
VA_CTX(ctx);
|
||||||
return printf_ctx(&ctx);
|
return printf_ctx(&ctx);
|
||||||
}
|
}
|
||||||
|
LOG_ERROR_IF(log_file_libc, "libc:Unimplemented fprintf case\n");
|
||||||
UNREACHABLE_MSG("Unimplemented fprintf case");
|
BREAKPOINT();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
namespace Core::Libraries::LibC {
|
namespace Core::Libraries::LibC {
|
||||||
|
|
||||||
std::FILE* PS4_SYSV_ABI ps4_fopen(const char* filename, const char* mode);
|
|
||||||
int PS4_SYSV_ABI ps4_printf(VA_ARGS);
|
int PS4_SYSV_ABI ps4_printf(VA_ARGS);
|
||||||
int PS4_SYSV_ABI ps4_vsnprintf(char* s, size_t n, const char* format, VaList* arg);
|
int PS4_SYSV_ABI ps4_vsnprintf(char* s, size_t n, const char* format, VaList* arg);
|
||||||
int PS4_SYSV_ABI ps4_puts(const char* s);
|
int PS4_SYSV_ABI ps4_puts(const char* s);
|
||||||
|
|
|
@ -2,18 +2,24 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include "common/assert.h"
|
#include "common/debug.h"
|
||||||
|
#include "common/log.h"
|
||||||
#include "core/hle/libraries/libc/libc_stdlib.h"
|
#include "core/hle/libraries/libc/libc_stdlib.h"
|
||||||
|
|
||||||
namespace Core::Libraries::LibC {
|
namespace Core::Libraries::LibC {
|
||||||
|
|
||||||
|
constexpr bool log_file_libc = true; // disable it to disable logging
|
||||||
|
|
||||||
void PS4_SYSV_ABI ps4_exit(int code) {
|
void PS4_SYSV_ABI ps4_exit(int code) {
|
||||||
std::exit(code);
|
std::exit(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI ps4_atexit(void (*func)()) {
|
int PS4_SYSV_ABI ps4_atexit(void (*func)()) {
|
||||||
int rt = std::atexit(func);
|
int rt = std::atexit(func);
|
||||||
ASSERT_MSG(rt == 0, "atexit returned {}", rt);
|
if (rt != 0) {
|
||||||
|
LOG_ERROR_IF(log_file_libc, "atexit returned {}\n", rt);
|
||||||
|
BREAKPOINT();
|
||||||
|
}
|
||||||
return rt;
|
return rt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,6 @@
|
||||||
#include <cstdbool>
|
#include <cstdbool>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstring>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "va_ctx.h"
|
#include "va_ctx.h"
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/debug.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/log.h"
|
||||||
#include "common/singleton.h"
|
#include "common/singleton.h"
|
||||||
#include "core/file_sys/fs.h"
|
#include "core/file_sys/fs.h"
|
||||||
#include "core/hle/error_codes.h"
|
#include "core/hle/error_codes.h"
|
||||||
|
@ -11,37 +11,41 @@
|
||||||
|
|
||||||
namespace Core::Libraries::LibKernel {
|
namespace Core::Libraries::LibKernel {
|
||||||
|
|
||||||
|
constexpr bool log_file_fs = true; // disable it to disable logging
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceKernelOpen(const char* path, int flags, u16 mode) {
|
int PS4_SYSV_ABI sceKernelOpen(const char* path, int flags, u16 mode) {
|
||||||
LOG_INFO(Kernel_Fs, "path = {} flags = {:#x} mode = {:#x}", path, flags, mode);
|
LOG_INFO_IF(log_file_fs, "sceKernelOpen path = {} flags = {:#x} mode = {:#x}\n", path, flags,
|
||||||
|
mode);
|
||||||
auto* h = Common::Singleton<Core::FileSys::HandleTable>::Instance();
|
auto* h = Common::Singleton<Core::FileSys::HandleTable>::Instance();
|
||||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||||
|
|
||||||
// only open files support!
|
// only open files support!
|
||||||
u32 handle = h->CreateHandle();
|
u32 handle = h->createHandle();
|
||||||
auto* file = h->GetFile(handle);
|
auto* file = h->getFile(handle);
|
||||||
file->m_guest_name = path;
|
file->m_guest_name = path;
|
||||||
file->m_host_name = mnt->GetHostFile(file->m_guest_name);
|
file->m_host_name = mnt->getHostFile(file->m_guest_name);
|
||||||
|
|
||||||
file->f.Open(file->m_host_name, Common::FS::FileAccessMode::Read);
|
file->f.Open(file->m_host_name, Common::FS::FileAccessMode::Read);
|
||||||
if (!file->f.IsOpen()) {
|
if (!file->f.IsOpen()) {
|
||||||
h->DeleteHandle(handle);
|
h->deleteHandle(handle);
|
||||||
return SCE_KERNEL_ERROR_EACCES;
|
return SCE_KERNEL_ERROR_EACCES;
|
||||||
}
|
}
|
||||||
file->is_opened = true;
|
file->isOpened = true;
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI posix_open(const char* path, int flags, /* SceKernelMode*/ u16 mode) {
|
int PS4_SYSV_ABI posix_open(const char* path, int flags, /* SceKernelMode*/ u16 mode) {
|
||||||
LOG_INFO(Kernel_Fs, "posix open redirect to sceKernelOpen\n");
|
LOG_INFO_IF(log_file_fs, "posix open redirect to sceKernelOpen\n");
|
||||||
int result = sceKernelOpen(path, flags, mode);
|
int result = sceKernelOpen(path, flags, mode);
|
||||||
// Posix calls different only for their return values
|
if (result < 0) {
|
||||||
ASSERT(result >= 0);
|
BREAKPOINT(); // posix calls different only for their return values
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t PS4_SYSV_ABI _readv(int d, const SceKernelIovec* iov, int iovcnt) {
|
size_t PS4_SYSV_ABI _readv(int d, const SceKernelIovec* iov, int iovcnt) {
|
||||||
auto* h = Common::Singleton<Core::FileSys::HandleTable>::Instance();
|
auto* h = Common::Singleton<Core::FileSys::HandleTable>::Instance();
|
||||||
auto* file = h->GetFile(d);
|
auto* file = h->getFile(d);
|
||||||
size_t total_read = 0;
|
size_t total_read = 0;
|
||||||
file->m_mutex.lock();
|
file->m_mutex.lock();
|
||||||
for (int i = 0; i < iovcnt; i++) {
|
for (int i = 0; i < iovcnt; i++) {
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace Core::Libraries::LibKernel {
|
||||||
|
|
||||||
struct SceKernelIovec {
|
struct SceKernelIovec {
|
||||||
void* iov_base;
|
void* iov_base;
|
||||||
std::size_t iov_len;
|
size_t iov_len;
|
||||||
};
|
};
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceKernelOpen(const char* path, int flags, /* SceKernelMode*/ u16 mode);
|
int PS4_SYSV_ABI sceKernelOpen(const char* path, int flags, /* SceKernelMode*/ u16 mode);
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/debug.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/log.h"
|
||||||
|
#include "common/singleton.h"
|
||||||
|
#include "core/hle/kernel/Objects/physical_memory.h"
|
||||||
#include "core/hle/kernel/cpu_management.h"
|
#include "core/hle/kernel/cpu_management.h"
|
||||||
#include "core/hle/kernel/event_queues.h"
|
#include "core/hle/kernel/event_queues.h"
|
||||||
#include "core/hle/kernel/memory_management.h"
|
#include "core/hle/kernel/memory_management.h"
|
||||||
|
@ -22,19 +24,21 @@
|
||||||
|
|
||||||
namespace Core::Libraries::LibKernel {
|
namespace Core::Libraries::LibKernel {
|
||||||
|
|
||||||
|
constexpr bool log_libkernel_file = true; // disable it to disable logging
|
||||||
|
|
||||||
static u64 g_stack_chk_guard = 0xDEADBEEF54321ABC; // dummy return
|
static u64 g_stack_chk_guard = 0xDEADBEEF54321ABC; // dummy return
|
||||||
|
|
||||||
int32_t PS4_SYSV_ABI sceKernelReleaseDirectMemory(off_t start, size_t len) {
|
int32_t PS4_SYSV_ABI sceKernelReleaseDirectMemory(off_t start, size_t len) {
|
||||||
UNREACHABLE();
|
BREAKPOINT();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PS4_SYSV_ABI void stack_chk_fail() {
|
static PS4_SYSV_ABI void stack_chk_fail() {
|
||||||
UNREACHABLE();
|
BREAKPOINT();
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceKernelMunmap(void* addr, size_t len) {
|
int PS4_SYSV_ABI sceKernelMunmap(void* addr, size_t len) {
|
||||||
UNREACHABLE();
|
BREAKPOINT();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PS4_SYSV_ABI sceKernelUsleep(unsigned int microseconds) {
|
void PS4_SYSV_ABI sceKernelUsleep(unsigned int microseconds) {
|
||||||
|
@ -67,9 +71,10 @@ int* PS4_SYSV_ABI __Error() {
|
||||||
int PS4_SYSV_ABI sceKernelMmap(void* addr, u64 len, int prot, int flags, int fd, off_t offset,
|
int PS4_SYSV_ABI sceKernelMmap(void* addr, u64 len, int prot, int flags, int fd, off_t offset,
|
||||||
void** res) {
|
void** res) {
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
LOG_INFO(Kernel_Vmm, "called");
|
PRINT_FUNCTION_NAME();
|
||||||
if (prot > 3) {
|
if (prot > 3) // READ,WRITE or bitwise READ | WRITE supported
|
||||||
LOG_ERROR(Kernel_Vmm, "prot = {} not supported", prot);
|
{
|
||||||
|
LOG_ERROR_IF(log_libkernel_file, "sceKernelMmap prot ={} not supported\n", prot);
|
||||||
}
|
}
|
||||||
DWORD flProtect;
|
DWORD flProtect;
|
||||||
if (prot & PROT_WRITE) {
|
if (prot & PROT_WRITE) {
|
||||||
|
@ -109,11 +114,13 @@ int PS4_SYSV_ABI sceKernelMmap(void* addr, u64 len, int prot, int flags, int fd,
|
||||||
|
|
||||||
PS4_SYSV_ABI void* posix_mmap(void* addr, u64 len, int prot, int flags, int fd, u64 offset) {
|
PS4_SYSV_ABI void* posix_mmap(void* addr, u64 len, int prot, int flags, int fd, u64 offset) {
|
||||||
void* ptr;
|
void* ptr;
|
||||||
LOG_INFO(Kernel_Vmm, "posix mmap redirect to sceKernelMmap\n");
|
LOG_INFO_IF(log_libkernel_file, "posix mmap redirect to sceKernelMmap\n");
|
||||||
// posix call the difference is that there is a different behaviour when it doesn't return 0 or
|
// posix call the difference is that there is a different behaviour when it doesn't return 0 or
|
||||||
// SCE_OK
|
// SCE_OK
|
||||||
int result = sceKernelMmap(addr, len, prot, flags, fd, offset, &ptr);
|
int result = sceKernelMmap(addr, len, prot, flags, fd, offset, &ptr);
|
||||||
ASSERT(result == 0);
|
if (result != 0) {
|
||||||
|
BREAKPOINT();
|
||||||
|
}
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/debug.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/log.h"
|
||||||
#include "core/hle/error_codes.h"
|
#include "core/hle/error_codes.h"
|
||||||
#include "core/hle/libraries/libkernel/thread_management.h"
|
#include "core/hle/libraries/libkernel/thread_management.h"
|
||||||
#include "core/hle/libraries/libs.h"
|
#include "core/hle/libraries/libs.h"
|
||||||
|
@ -12,6 +12,8 @@ namespace Core::Libraries::LibKernel {
|
||||||
thread_local ScePthread g_pthread_self{};
|
thread_local ScePthread g_pthread_self{};
|
||||||
PThreadCxt* g_pthread_cxt = nullptr;
|
PThreadCxt* g_pthread_cxt = nullptr;
|
||||||
|
|
||||||
|
constexpr bool log_pthread_file = true; // disable it to disable logging
|
||||||
|
|
||||||
void init_pthreads() {
|
void init_pthreads() {
|
||||||
g_pthread_cxt = new PThreadCxt{};
|
g_pthread_cxt = new PThreadCxt{};
|
||||||
// default mutex init
|
// default mutex init
|
||||||
|
@ -71,7 +73,9 @@ int PS4_SYSV_ABI scePthreadAttrSetdetachstate(ScePthreadAttr* attr, int detachst
|
||||||
pstate = PTHREAD_CREATE_DETACHED;
|
pstate = PTHREAD_CREATE_DETACHED;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE_MSG("Invalid detachstate: {}", detachstate);
|
LOG_TRACE_IF(log_pthread_file, "scePthreadAttrSetdetachstate invalid detachstate: {}\n",
|
||||||
|
detachstate);
|
||||||
|
std::exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// int result = pthread_attr_setdetachstate(&(*attr)->pth_attr, pstate); doesn't seem to work
|
// int result = pthread_attr_setdetachstate(&(*attr)->pth_attr, pstate); doesn't seem to work
|
||||||
|
@ -97,7 +101,9 @@ int PS4_SYSV_ABI scePthreadAttrSetinheritsched(ScePthreadAttr* attr, int inherit
|
||||||
pinherit_sched = PTHREAD_INHERIT_SCHED;
|
pinherit_sched = PTHREAD_INHERIT_SCHED;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE_MSG("Invalid inheritSched: {}", inheritSched);
|
LOG_TRACE_IF(log_pthread_file, "scePthreadAttrSetinheritsched invalid inheritSched: {}\n",
|
||||||
|
inheritSched);
|
||||||
|
std::exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int result = pthread_attr_setinheritsched(&(*attr)->pth_attr, pinherit_sched);
|
int result = pthread_attr_setinheritsched(&(*attr)->pth_attr, pinherit_sched);
|
||||||
|
@ -132,7 +138,9 @@ int PS4_SYSV_ABI scePthreadAttrSetschedpolicy(ScePthreadAttr* attr, int policy)
|
||||||
|
|
||||||
int ppolicy = SCHED_OTHER; // winpthreads only supports SCHED_OTHER
|
int ppolicy = SCHED_OTHER; // winpthreads only supports SCHED_OTHER
|
||||||
if (policy != SCHED_OTHER) {
|
if (policy != SCHED_OTHER) {
|
||||||
LOG_ERROR(Kernel_Pthread, "policy={} not supported by winpthreads\n", policy);
|
LOG_TRACE_IF(log_pthread_file,
|
||||||
|
"scePthreadAttrSetschedpolicy policy={} not supported by winpthreads\n",
|
||||||
|
policy);
|
||||||
}
|
}
|
||||||
(*attr)->policy = policy;
|
(*attr)->policy = policy;
|
||||||
|
|
||||||
|
@ -146,7 +154,7 @@ ScePthread PS4_SYSV_ABI scePthreadSelf() {
|
||||||
|
|
||||||
int PS4_SYSV_ABI scePthreadAttrSetaffinity(ScePthreadAttr* pattr,
|
int PS4_SYSV_ABI scePthreadAttrSetaffinity(ScePthreadAttr* pattr,
|
||||||
const /*SceKernelCpumask*/ u64 mask) {
|
const /*SceKernelCpumask*/ u64 mask) {
|
||||||
LOG_INFO(Kernel_Pthread, "called");
|
PRINT_FUNCTION_NAME();
|
||||||
|
|
||||||
if (pattr == nullptr || *pattr == nullptr) {
|
if (pattr == nullptr || *pattr == nullptr) {
|
||||||
return SCE_KERNEL_ERROR_EINVAL;
|
return SCE_KERNEL_ERROR_EINVAL;
|
||||||
|
@ -158,7 +166,7 @@ int PS4_SYSV_ABI scePthreadAttrSetaffinity(ScePthreadAttr* pattr,
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI scePthreadSetaffinity(ScePthread thread, const /*SceKernelCpumask*/ u64 mask) {
|
int PS4_SYSV_ABI scePthreadSetaffinity(ScePthread thread, const /*SceKernelCpumask*/ u64 mask) {
|
||||||
LOG_INFO(Kernel_Pthread, "called");
|
PRINT_FUNCTION_NAME();
|
||||||
|
|
||||||
if (thread == nullptr) {
|
if (thread == nullptr) {
|
||||||
return SCE_KERNEL_ERROR_ESRCH;
|
return SCE_KERNEL_ERROR_ESRCH;
|
||||||
|
@ -170,10 +178,12 @@ int PS4_SYSV_ABI scePthreadSetaffinity(ScePthread thread, const /*SceKernelCpuma
|
||||||
}
|
}
|
||||||
int PS4_SYSV_ABI scePthreadCreate(ScePthread* thread, const ScePthreadAttr* attr,
|
int PS4_SYSV_ABI scePthreadCreate(ScePthread* thread, const ScePthreadAttr* attr,
|
||||||
pthreadEntryFunc start_routine, void* arg, const char* name) {
|
pthreadEntryFunc start_routine, void* arg, const char* name) {
|
||||||
LOG_INFO(Kernel_Pthread, "(STUBBED) called");
|
PRINT_DUMMY_FUNCTION_NAME();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
/****
|
||||||
|
* Mutex calls
|
||||||
|
*/
|
||||||
void* createMutex(void* addr) {
|
void* createMutex(void* addr) {
|
||||||
if (addr == nullptr || *static_cast<ScePthreadMutex*>(addr) != nullptr) {
|
if (addr == nullptr || *static_cast<ScePthreadMutex*>(addr) != nullptr) {
|
||||||
return addr;
|
return addr;
|
||||||
|
@ -187,7 +197,7 @@ void* createMutex(void* addr) {
|
||||||
|
|
||||||
int PS4_SYSV_ABI scePthreadMutexInit(ScePthreadMutex* mutex, const ScePthreadMutexattr* attr,
|
int PS4_SYSV_ABI scePthreadMutexInit(ScePthreadMutex* mutex, const ScePthreadMutexattr* attr,
|
||||||
const char* name) {
|
const char* name) {
|
||||||
LOG_INFO(Kernel_Pthread, "called");
|
PRINT_FUNCTION_NAME();
|
||||||
if (mutex == nullptr) {
|
if (mutex == nullptr) {
|
||||||
return SCE_KERNEL_ERROR_EINVAL;
|
return SCE_KERNEL_ERROR_EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -205,7 +215,7 @@ int PS4_SYSV_ABI scePthreadMutexInit(ScePthreadMutex* mutex, const ScePthreadMut
|
||||||
int result = pthread_mutex_init(&(*mutex)->pth_mutex, &(*attr)->pth_mutex_attr);
|
int result = pthread_mutex_init(&(*mutex)->pth_mutex, &(*attr)->pth_mutex_attr);
|
||||||
|
|
||||||
if (name != nullptr) {
|
if (name != nullptr) {
|
||||||
LOG_INFO(Kernel_Pthread, "name={}, result={}", name, result);
|
LOG_INFO_IF(log_pthread_file, "mutex_init name={},result={}\n", name, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (result) {
|
switch (result) {
|
||||||
|
@ -254,7 +264,8 @@ int PS4_SYSV_ABI scePthreadMutexattrSettype(ScePthreadMutexattr* attr, int type)
|
||||||
ptype = PTHREAD_MUTEX_NORMAL;
|
ptype = PTHREAD_MUTEX_NORMAL;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE_MSG("Invalid type: {}", type);
|
LOG_TRACE_IF(log_pthread_file, "scePthreadMutexattrSettype invalid type: {}\n", type);
|
||||||
|
std::exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int result = pthread_mutexattr_settype(&(*attr)->pth_mutex_attr, ptype);
|
int result = pthread_mutexattr_settype(&(*attr)->pth_mutex_attr, ptype);
|
||||||
|
@ -275,7 +286,9 @@ int PS4_SYSV_ABI scePthreadMutexattrSetprotocol(ScePthreadMutexattr* attr, int p
|
||||||
pprotocol = PTHREAD_PRIO_PROTECT;
|
pprotocol = PTHREAD_PRIO_PROTECT;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE_MSG("Invalid protocol: {}", protocol);
|
LOG_TRACE_IF(log_pthread_file, "scePthreadMutexattrSetprotocol invalid protocol: {}\n",
|
||||||
|
protocol);
|
||||||
|
std::exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int result = 0; // pthread_mutexattr_setprotocol(&(*attr)->p, pprotocol); //it appears that
|
int result = 0; // pthread_mutexattr_setprotocol(&(*attr)->p, pprotocol); //it appears that
|
||||||
|
@ -285,7 +298,7 @@ int PS4_SYSV_ABI scePthreadMutexattrSetprotocol(ScePthreadMutexattr* attr, int p
|
||||||
return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL;
|
return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL;
|
||||||
}
|
}
|
||||||
int PS4_SYSV_ABI scePthreadMutexLock(ScePthreadMutex* mutex) {
|
int PS4_SYSV_ABI scePthreadMutexLock(ScePthreadMutex* mutex) {
|
||||||
LOG_INFO(Kernel_Pthread, "called");
|
PRINT_FUNCTION_NAME();
|
||||||
mutex = static_cast<ScePthreadMutex*>(createMutex(mutex));
|
mutex = static_cast<ScePthreadMutex*>(createMutex(mutex));
|
||||||
|
|
||||||
if (mutex == nullptr) {
|
if (mutex == nullptr) {
|
||||||
|
@ -293,7 +306,8 @@ int PS4_SYSV_ABI scePthreadMutexLock(ScePthreadMutex* mutex) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int result = pthread_mutex_lock(&(*mutex)->pth_mutex);
|
int result = pthread_mutex_lock(&(*mutex)->pth_mutex);
|
||||||
LOG_INFO(Kernel_Pthread, "name={}, result={}", (*mutex)->name, result);
|
LOG_INFO_IF(log_pthread_file, "scePthreadMutexLock name={} result={}\n", (*mutex)->name,
|
||||||
|
result);
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case 0:
|
case 0:
|
||||||
return SCE_OK;
|
return SCE_OK;
|
||||||
|
@ -308,14 +322,15 @@ int PS4_SYSV_ABI scePthreadMutexLock(ScePthreadMutex* mutex) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int PS4_SYSV_ABI scePthreadMutexUnlock(ScePthreadMutex* mutex) {
|
int PS4_SYSV_ABI scePthreadMutexUnlock(ScePthreadMutex* mutex) {
|
||||||
LOG_INFO(Kernel_Pthread, "called");
|
PRINT_FUNCTION_NAME();
|
||||||
mutex = static_cast<ScePthreadMutex*>(createMutex(mutex));
|
mutex = static_cast<ScePthreadMutex*>(createMutex(mutex));
|
||||||
if (mutex == nullptr) {
|
if (mutex == nullptr) {
|
||||||
return SCE_KERNEL_ERROR_EINVAL;
|
return SCE_KERNEL_ERROR_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int result = pthread_mutex_unlock(&(*mutex)->pth_mutex);
|
int result = pthread_mutex_unlock(&(*mutex)->pth_mutex);
|
||||||
LOG_INFO(Kernel_Pthread, "name={}, result={}", (*mutex)->name, result);
|
LOG_INFO_IF(log_pthread_file, "scePthreadMutexUnlock name={} result={}\n", (*mutex)->name,
|
||||||
|
result);
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case 0:
|
case 0:
|
||||||
return SCE_OK;
|
return SCE_OK;
|
||||||
|
@ -329,6 +344,9 @@ int PS4_SYSV_ABI scePthreadMutexUnlock(ScePthreadMutex* mutex) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****
|
||||||
|
* Cond calls
|
||||||
|
*/
|
||||||
void* createCond(void* addr) {
|
void* createCond(void* addr) {
|
||||||
if (addr == nullptr || *static_cast<ScePthreadCond*>(addr) != nullptr) {
|
if (addr == nullptr || *static_cast<ScePthreadCond*>(addr) != nullptr) {
|
||||||
return addr;
|
return addr;
|
||||||
|
@ -361,7 +379,7 @@ int PS4_SYSV_ABI scePthreadCondInit(ScePthreadCond* cond, const ScePthreadCondat
|
||||||
int result = pthread_cond_init(&(*cond)->cond, &(*attr)->cond_attr);
|
int result = pthread_cond_init(&(*cond)->cond, &(*attr)->cond_attr);
|
||||||
|
|
||||||
if (name != nullptr) {
|
if (name != nullptr) {
|
||||||
LOG_INFO(Kernel_Pthread, "name={}, result={}", (*cond)->name, result);
|
LOG_INFO_IF(log_pthread_file, "cond init name={},result={}\n", (*cond)->name, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (result) {
|
switch (result) {
|
||||||
|
@ -394,7 +412,7 @@ int PS4_SYSV_ABI scePthreadCondattrInit(ScePthreadCondattr* attr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI scePthreadCondBroadcast(ScePthreadCond* cond) {
|
int PS4_SYSV_ABI scePthreadCondBroadcast(ScePthreadCond* cond) {
|
||||||
LOG_INFO(Kernel_Pthread, "called");
|
PRINT_FUNCTION_NAME();
|
||||||
cond = static_cast<ScePthreadCond*>(createCond(cond));
|
cond = static_cast<ScePthreadCond*>(createCond(cond));
|
||||||
|
|
||||||
if (cond == nullptr) {
|
if (cond == nullptr) {
|
||||||
|
@ -403,13 +421,15 @@ int PS4_SYSV_ABI scePthreadCondBroadcast(ScePthreadCond* cond) {
|
||||||
|
|
||||||
int result = pthread_cond_broadcast(&(*cond)->cond);
|
int result = pthread_cond_broadcast(&(*cond)->cond);
|
||||||
|
|
||||||
LOG_INFO(Kernel_Pthread, "name={}, result={}", (*cond)->name, result);
|
LOG_INFO_IF(log_pthread_file, "cond broadcast name={},result={}\n", (*cond)->name, result);
|
||||||
|
|
||||||
return (result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL);
|
return (result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL);
|
||||||
}
|
}
|
||||||
|
/****
|
||||||
|
* Posix calls
|
||||||
|
*/
|
||||||
int PS4_SYSV_ABI posix_pthread_mutex_init(ScePthreadMutex* mutex, const ScePthreadMutexattr* attr) {
|
int PS4_SYSV_ABI posix_pthread_mutex_init(ScePthreadMutex* mutex, const ScePthreadMutexattr* attr) {
|
||||||
LOG_INFO(Kernel_Pthread, "posix pthread_mutex_init redirect to scePthreadMutexInit");
|
LOG_INFO_IF(log_pthread_file, "posix pthread_mutex_init redirect to scePthreadMutexInit\n");
|
||||||
int result = scePthreadMutexInit(mutex, attr, nullptr);
|
int result = scePthreadMutexInit(mutex, attr, nullptr);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
|
int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
|
||||||
|
@ -421,7 +441,7 @@ int PS4_SYSV_ABI posix_pthread_mutex_init(ScePthreadMutex* mutex, const ScePthre
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI posix_pthread_mutex_lock(ScePthreadMutex* mutex) {
|
int PS4_SYSV_ABI posix_pthread_mutex_lock(ScePthreadMutex* mutex) {
|
||||||
LOG_INFO(Kernel_Pthread, "posix pthread_mutex_lock redirect to scePthreadMutexLock");
|
LOG_INFO_IF(log_pthread_file, "posix pthread_mutex_lock redirect to scePthreadMutexLock\n");
|
||||||
int result = scePthreadMutexLock(mutex);
|
int result = scePthreadMutexLock(mutex);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
|
int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
|
||||||
|
@ -433,7 +453,7 @@ int PS4_SYSV_ABI posix_pthread_mutex_lock(ScePthreadMutex* mutex) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI posix_pthread_mutex_unlock(ScePthreadMutex* mutex) {
|
int PS4_SYSV_ABI posix_pthread_mutex_unlock(ScePthreadMutex* mutex) {
|
||||||
LOG_INFO(Kernel_Pthread, "posix pthread_mutex_unlock redirect to scePthreadMutexUnlock");
|
LOG_INFO_IF(log_pthread_file, "posix pthread_mutex_unlock redirect to scePthreadMutexUnlock\n");
|
||||||
int result = scePthreadMutexUnlock(mutex);
|
int result = scePthreadMutexUnlock(mutex);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
|
int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
|
||||||
|
@ -445,8 +465,8 @@ int PS4_SYSV_ABI posix_pthread_mutex_unlock(ScePthreadMutex* mutex) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI posix_pthread_cond_broadcast(ScePthreadCond* cond) {
|
int PS4_SYSV_ABI posix_pthread_cond_broadcast(ScePthreadCond* cond) {
|
||||||
LOG_INFO(Kernel_Pthread,
|
LOG_INFO_IF(log_pthread_file,
|
||||||
"posix posix_pthread_cond_broadcast redirect to scePthreadCondBroadcast");
|
"posix posix_pthread_cond_broadcast redirect to scePthreadCondBroadcast\n");
|
||||||
int result = scePthreadCondBroadcast(cond);
|
int result = scePthreadCondBroadcast(cond);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
|
int rt = result > SCE_KERNEL_ERROR_UNKNOWN && result <= SCE_KERNEL_ERROR_ESTOP
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "Emulator/Host/controller.h"
|
#include "Emulator/Host/controller.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/log.h"
|
||||||
#include "common/singleton.h"
|
#include "common/singleton.h"
|
||||||
#include "core/hle/error_codes.h"
|
#include "core/hle/error_codes.h"
|
||||||
#include "core/hle/libraries/libpad/pad.h"
|
#include "core/hle/libraries/libpad/pad.h"
|
||||||
|
@ -10,14 +10,14 @@
|
||||||
|
|
||||||
namespace Core::Libraries::LibPad {
|
namespace Core::Libraries::LibPad {
|
||||||
|
|
||||||
|
constexpr bool log_file_pad = true; // disable it to disable logging
|
||||||
|
|
||||||
int PS4_SYSV_ABI scePadInit() {
|
int PS4_SYSV_ABI scePadInit() {
|
||||||
LOG_WARNING(Lib_Pad, "(STUBBED) called");
|
|
||||||
return SCE_OK;
|
return SCE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI scePadOpen(Core::Libraries::LibUserService::SceUserServiceUserId user_id, s32 type,
|
int PS4_SYSV_ABI scePadOpen(s32 userId, s32 type, s32 index, const ScePadOpenParam* pParam) {
|
||||||
s32 index, const ScePadOpenParam* pParam) {
|
LOG_INFO_IF(log_file_pad, "scePadOpen userid = {} type = {} index = {}\n", userId, type, index);
|
||||||
LOG_INFO(Lib_Pad, "(STUBBED) called user_id = {} type = {} index = {}", user_id, type, index);
|
|
||||||
return 1; // dummy
|
return 1; // dummy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "common/types.h"
|
#include "common/types.h"
|
||||||
#include "core/hle/libraries/libuserservice/libuserservice.h"
|
|
||||||
|
namespace Core::Loader {
|
||||||
|
class SymbolsResolver;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Core::Libraries::LibPad {
|
namespace Core::Libraries::LibPad {
|
||||||
|
|
||||||
|
@ -92,8 +95,7 @@ struct ScePadData {
|
||||||
};
|
};
|
||||||
|
|
||||||
int PS4_SYSV_ABI scePadInit();
|
int PS4_SYSV_ABI scePadInit();
|
||||||
int PS4_SYSV_ABI scePadOpen(LibUserService::SceUserServiceUserId userId, s32 type, s32 index,
|
int PS4_SYSV_ABI scePadOpen(s32 userId, s32 type, s32 index, const ScePadOpenParam* pParam);
|
||||||
const ScePadOpenParam* pParam);
|
|
||||||
int PS4_SYSV_ABI scePadReadState(int32_t handle, ScePadData* pData);
|
int PS4_SYSV_ABI scePadReadState(int32_t handle, ScePadData* pData);
|
||||||
|
|
||||||
void padSymbolsRegister(Loader::SymbolsResolver* sym);
|
void padSymbolsRegister(Loader::SymbolsResolver* sym);
|
||||||
|
|
|
@ -7,19 +7,24 @@
|
||||||
#include "core/hle/libraries/libpad/pad.h"
|
#include "core/hle/libraries/libpad/pad.h"
|
||||||
#include "core/hle/libraries/libs.h"
|
#include "core/hle/libraries/libs.h"
|
||||||
#include "core/hle/libraries/libscegnmdriver/libscegnmdriver.h"
|
#include "core/hle/libraries/libscegnmdriver/libscegnmdriver.h"
|
||||||
#include "core/hle/libraries/libsystemservice/system_service.h"
|
#include "src/core/libraries/libscecommondialog.h"
|
||||||
#include "core/hle/libraries/libuserservice/libuserservice.h"
|
#include "src/core/libraries/libscemsgdialog.h"
|
||||||
|
#include "src/core/libraries/libscesystemservice.h"
|
||||||
|
#include "src/core/libraries/libsceuserservice.h"
|
||||||
|
|
||||||
namespace Core::Libraries {
|
namespace OldLibraries {
|
||||||
|
|
||||||
void InitHLELibs(Loader::SymbolsResolver* sym) {
|
void InitHLELibs(Core::Loader::SymbolsResolver* sym) {
|
||||||
LibKernel::LibKernel_Register(sym);
|
Core::Libraries::LibKernel::LibKernel_Register(sym);
|
||||||
HLE::Libs::Graphics::VideoOut::videoOutRegisterLib(sym);
|
HLE::Libs::Graphics::VideoOut::videoOutRegisterLib(sym);
|
||||||
LibSceGnmDriver::LibSceGnmDriver_Register(sym);
|
Core::Libraries::LibSceGnmDriver::LibSceGnmDriver_Register(sym);
|
||||||
LibUserService::userServiceSymbolsRegister(sym);
|
Core::Libraries::LibPad::padSymbolsRegister(sym);
|
||||||
LibPad::padSymbolsRegister(sym);
|
Core::Libraries::LibC::libcSymbolsRegister(sym);
|
||||||
LibSystemService::systemServiceSymbolsRegister(sym);
|
|
||||||
LibC::libcSymbolsRegister(sym);
|
Libraries::UserService::RegisterlibSceUserService(sym);
|
||||||
|
Libraries::SystemService::RegisterlibSceSystemService(sym);
|
||||||
|
Libraries::CommonDialog::RegisterlibSceCommonDialog(sym);
|
||||||
|
Libraries::MsgDialog::RegisterlibSceMsgDialog(sym);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Core::Libraries
|
} // namespace OldLibraries
|
||||||
|
|
|
@ -34,8 +34,17 @@
|
||||||
sym->AddSymbol(sr, func); \
|
sym->AddSymbol(sr, func); \
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Core::Libraries {
|
#define PRINT_FUNCTION_NAME() \
|
||||||
|
{ LOG_INFO_IF(true, "{}()\n", __func__); }
|
||||||
|
|
||||||
void InitHLELibs(Loader::SymbolsResolver* sym);
|
#define PRINT_DUMMY_FUNCTION_NAME() \
|
||||||
|
{ LOG_WARN_IF(true, "dummy {}()\n", __func__); }
|
||||||
|
|
||||||
} // namespace Core::Libraries
|
#define PRINT_UNIMPLEMENTED_FUNCTION_NAME() \
|
||||||
|
{ LOG_ERROR_IF(true, "Unimplemented {}()\n", __func__); }
|
||||||
|
|
||||||
|
namespace OldLibraries {
|
||||||
|
|
||||||
|
void InitHLELibs(Core::Loader::SymbolsResolver* sym);
|
||||||
|
|
||||||
|
} // namespace OldLibraries
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "common/logging/log.h"
|
#include "common/log.h"
|
||||||
#include "core/PS4/GPU/gpu_memory.h"
|
#include "core/PS4/GPU/gpu_memory.h"
|
||||||
#include "core/hle/libraries/libs.h"
|
#include "core/hle/libraries/libs.h"
|
||||||
#include "core/hle/libraries/libscegnmdriver/libscegnmdriver.h"
|
#include "core/hle/libraries/libscegnmdriver/libscegnmdriver.h"
|
||||||
|
@ -10,12 +10,12 @@
|
||||||
namespace Core::Libraries::LibSceGnmDriver {
|
namespace Core::Libraries::LibSceGnmDriver {
|
||||||
|
|
||||||
int32_t sceGnmSubmitDone() {
|
int32_t sceGnmSubmitDone() {
|
||||||
LOG_WARNING(Lib_GnmDriver, "(STUBBED) called");
|
PRINT_DUMMY_FUNCTION_NAME();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sceGnmFlushGarlic() {
|
void sceGnmFlushGarlic() {
|
||||||
LOG_WARNING(Lib_GnmDriver, "(STUBBED) called");
|
PRINT_FUNCTION_NAME();
|
||||||
GPU::flushGarlic(Emu::getGraphicCtx());
|
GPU::flushGarlic(Emu::getGraphicCtx());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#include "common/logging/log.h"
|
|
||||||
#include "core/hle/error_codes.h"
|
|
||||||
#include "core/hle/libraries/libs.h"
|
|
||||||
#include "core/hle/libraries/libsystemservice/system_service.h"
|
|
||||||
|
|
||||||
namespace Core::Libraries::LibSystemService {
|
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceSystemServiceHideSplashScreen() {
|
|
||||||
LOG_WARNING(Lib_SystemService, "(STUBBED) called");
|
|
||||||
return SCE_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceSystemServiceGetStatus(SceSystemServiceStatus* status) {
|
|
||||||
SceSystemServiceStatus st = {};
|
|
||||||
st.eventNum = 0;
|
|
||||||
st.isSystemUiOverlaid = false;
|
|
||||||
st.isInBackgroundExecution = false;
|
|
||||||
st.isCpuMode7CpuNormal = true;
|
|
||||||
st.isGameLiveStreamingOnAir = false;
|
|
||||||
st.isOutOfVrPlayArea = false;
|
|
||||||
*status = st;
|
|
||||||
return SCE_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void systemServiceSymbolsRegister(Loader::SymbolsResolver* sym) {
|
|
||||||
LIB_FUNCTION("Vo5V8KAwCmk", "libSceSystemService", 1, "libSceSystemService", 1, 1,
|
|
||||||
sceSystemServiceHideSplashScreen);
|
|
||||||
LIB_FUNCTION("rPo6tV8D9bM", "libSceSystemService", 1, "libSceSystemService", 1, 1,
|
|
||||||
sceSystemServiceGetStatus);
|
|
||||||
}
|
|
||||||
|
|
||||||
}; // namespace Core::Libraries::LibSystemService
|
|
|
@ -1,29 +0,0 @@
|
||||||
// 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 Core::Libraries::LibSystemService {
|
|
||||||
|
|
||||||
struct SceSystemServiceStatus {
|
|
||||||
s32 eventNum;
|
|
||||||
bool isSystemUiOverlaid;
|
|
||||||
bool isInBackgroundExecution;
|
|
||||||
bool isCpuMode7CpuNormal;
|
|
||||||
bool isGameLiveStreamingOnAir;
|
|
||||||
bool isOutOfVrPlayArea;
|
|
||||||
u8 reserved[];
|
|
||||||
};
|
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceSystemServiceHideSplashScreen();
|
|
||||||
s32 PS4_SYSV_ABI sceSystemServiceGetStatus(SceSystemServiceStatus* status);
|
|
||||||
|
|
||||||
void systemServiceSymbolsRegister(Loader::SymbolsResolver* sym);
|
|
||||||
|
|
||||||
}; // namespace Core::Libraries::LibSystemService
|
|
|
@ -1,33 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#include "common/logging/log.h"
|
|
||||||
#include "core/hle/error_codes.h"
|
|
||||||
#include "core/hle/libraries/libs.h"
|
|
||||||
#include "core/hle/libraries/libuserservice/libuserservice.h"
|
|
||||||
|
|
||||||
namespace Core::Libraries::LibUserService {
|
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceUserServiceInitialize(const SceUserServiceInitializeParams* initParams) {
|
|
||||||
LOG_WARNING(Lib_UserService, "(STUBBED) called");
|
|
||||||
return SCE_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceUserServiceGetLoginUserIdList(SceUserServiceLoginUserIdList* userIdList) {
|
|
||||||
LOG_WARNING(Lib_UserService, "(STUBBED) called");
|
|
||||||
userIdList->user_id[0] = 1;
|
|
||||||
userIdList->user_id[1] = -1;
|
|
||||||
userIdList->user_id[2] = -1;
|
|
||||||
userIdList->user_id[3] = -1;
|
|
||||||
|
|
||||||
return SCE_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void userServiceSymbolsRegister(Loader::SymbolsResolver* sym) {
|
|
||||||
LIB_FUNCTION("j3YMu1MVNNo", "libSceUserService", 1, "libSceUserService", 1, 1,
|
|
||||||
sceUserServiceInitialize);
|
|
||||||
LIB_FUNCTION("fPhymKNvK-A", "libSceUserService", 1, "libSceUserService", 1, 1,
|
|
||||||
sceUserServiceGetLoginUserIdList);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Core::Libraries::LibUserService
|
|
|
@ -1,29 +0,0 @@
|
||||||
// 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 Core::Libraries::LibUserService {
|
|
||||||
|
|
||||||
using SceUserServiceUserId = s32;
|
|
||||||
|
|
||||||
struct SceUserServiceInitializeParams {
|
|
||||||
s32 priority;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SceUserServiceLoginUserIdList {
|
|
||||||
int user_id[4];
|
|
||||||
};
|
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceUserServiceInitialize(const SceUserServiceInitializeParams* initParams);
|
|
||||||
s32 PS4_SYSV_ABI sceUserServiceGetLoginUserIdList(SceUserServiceLoginUserIdList* userIdList);
|
|
||||||
|
|
||||||
void userServiceSymbolsRegister(Loader::SymbolsResolver* sym);
|
|
||||||
|
|
||||||
}; // namespace Core::Libraries::LibUserService
|
|
|
@ -1,12 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
constexpr int SCE_USER_SERVICE_MAX_LOGIN_USERS = 4; // Max users logged in at once
|
|
||||||
constexpr int SCE_USER_SERVICE_MAX_USER_NAME_LENGTH = 16; // Max length for user name
|
|
||||||
|
|
||||||
constexpr int SCE_USER_SERVICE_USER_ID_INVALID = -1; // Invalid user ID
|
|
||||||
constexpr int SCE_USER_SERVICE_USER_ID_SYSTEM = 255; // Generic id for device
|
|
||||||
constexpr int SCE_USER_SERVICE_USER_ID_EVERYONE =
|
|
||||||
254; // Generic id for user (mostly used in common dialogs)
|
|
|
@ -2,7 +2,192 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
// TODO placeholder until port finishes
|
|
||||||
#include "core/hle/error_codes.h"
|
|
||||||
|
|
||||||
constexpr int ORBIS_OK = 0;
|
// Generic
|
||||||
|
#define ORBIS_OK 0x00000000
|
||||||
|
#define ORBIS_FAIL 0xFFFFFFFF
|
||||||
|
|
||||||
|
// Libkernel library
|
||||||
|
#define ORBIS_KERNEL_ERROR_EPERM 0x80020001
|
||||||
|
#define ORBIS_KERNEL_ERROR_ENOENT 0x80020002
|
||||||
|
#define ORBIS_KERNEL_ERROR_ESRCH 0x80020003
|
||||||
|
#define ORBIS_KERNEL_ERROR_EINTR 0x80020004
|
||||||
|
#define ORBIS_KERNEL_ERROR_EIO 0x80020005
|
||||||
|
#define ORBIS_KERNEL_ERROR_ENXIO 0x80020006
|
||||||
|
#define ORBIS_KERNEL_ERROR_E2BIG 0x80020007
|
||||||
|
#define ORBIS_KERNEL_ERROR_ENOEXEC 0x80020008
|
||||||
|
#define ORBIS_KERNEL_ERROR_EBADF 0x80020009
|
||||||
|
#define ORBIS_KERNEL_ERROR_ECHILD 0x8002000A
|
||||||
|
#define ORBIS_KERNEL_ERROR_EDEADLK 0x8002000B
|
||||||
|
#define ORBIS_KERNEL_ERROR_ENOMEM 0x8002000C
|
||||||
|
#define ORBIS_KERNEL_ERROR_EACCES 0x8002000D
|
||||||
|
#define ORBIS_KERNEL_ERROR_EFAULT 0x8002000E
|
||||||
|
#define ORBIS_KERNEL_ERROR_ENOTBLK 0x8002000F
|
||||||
|
#define ORBIS_KERNEL_ERROR_EBUSY 0x80020010
|
||||||
|
#define ORBIS_KERNEL_ERROR_EEXIST 0x80020011
|
||||||
|
#define ORBIS_KERNEL_ERROR_EXDEV 0x80020012
|
||||||
|
#define ORBIS_KERNEL_ERROR_ENODEV 0x80020013
|
||||||
|
#define ORBIS_KERNEL_ERROR_ENOTDIR 0x80020014
|
||||||
|
#define ORBIS_KERNEL_ERROR_EISDIR 0x80020015
|
||||||
|
#define ORBIS_KERNEL_ERROR_EINVAL 0x80020016
|
||||||
|
#define ORBIS_KERNEL_ERROR_ENFILE 0x80020017
|
||||||
|
#define ORBIS_KERNEL_ERROR_EMFILE 0x80020018
|
||||||
|
#define ORBIS_KERNEL_ERROR_ENOTTY 0x80020019
|
||||||
|
#define ORBIS_KERNEL_ERROR_ETXTBSY 0x8002001A
|
||||||
|
#define ORBIS_KERNEL_ERROR_EFBIG 0x8002001B
|
||||||
|
#define ORBIS_KERNEL_ERROR_ENOSPC 0x8002001C
|
||||||
|
#define ORBIS_KERNEL_ERROR_ESPIPE 0x8002001D
|
||||||
|
#define ORBIS_KERNEL_ERROR_EROFS 0x8002001E
|
||||||
|
#define ORBIS_KERNEL_ERROR_EMLINK 0x8002001F
|
||||||
|
#define ORBIS_KERNEL_ERROR_EPIPE 0x80020020
|
||||||
|
#define ORBIS_KERNEL_ERROR_EDOM 0x80020021
|
||||||
|
#define ORBIS_KERNEL_ERROR_ERANGE 0x80020022
|
||||||
|
#define ORBIS_KERNEL_ERROR_EAGAIN 0x80020023
|
||||||
|
#define ORBIS_KERNEL_ERROR_EWOULDBLOCK 0x80020023
|
||||||
|
#define ORBIS_KERNEL_ERROR_EINPROGRESS 0x80020024
|
||||||
|
#define ORBIS_KERNEL_ERROR_EALREADY 0x80020025
|
||||||
|
#define ORBIS_KERNEL_ERROR_ENOTSOCK 0x80020026
|
||||||
|
#define ORBIS_KERNEL_ERROR_EDESTADDRREQ 0x80020027
|
||||||
|
#define ORBIS_KERNEL_ERROR_EMSGSIZE 0x80020028
|
||||||
|
#define ORBIS_KERNEL_ERROR_EPROTOTYPE 0x80020029
|
||||||
|
#define ORBIS_KERNEL_ERROR_ENOPROTOOPT 0x8002002A
|
||||||
|
#define ORBIS_KERNEL_ERROR_EPROTONOSUPPORT 0x8002002B
|
||||||
|
#define ORBIS_KERNEL_ERROR_ESOCKTNOSUPPORT 0x8002002C
|
||||||
|
#define ORBIS_KERNEL_ERROR_ENOTSUP 0x8002002D
|
||||||
|
#define ORBIS_KERNEL_ERROR_EOPNOTSUPP 0x8002002D
|
||||||
|
#define ORBIS_KERNEL_ERROR_EPFNOSUPPORT 0x8002002E
|
||||||
|
#define ORBIS_KERNEL_ERROR_EAFNOSUPPORT 0x8002002F
|
||||||
|
#define ORBIS_KERNEL_ERROR_EADDRINUSE 0x80020030
|
||||||
|
#define ORBIS_KERNEL_ERROR_EADDRNOTAVAIL 0x80020031
|
||||||
|
#define ORBIS_KERNEL_ERROR_ENETDOWN 0x80020032
|
||||||
|
#define ORBIS_KERNEL_ERROR_ENETUNREACH 0x80020033
|
||||||
|
#define ORBIS_KERNEL_ERROR_ENETRESET 0x80020034
|
||||||
|
#define ORBIS_KERNEL_ERROR_ECONNABORTED 0x80020035
|
||||||
|
#define ORBIS_KERNEL_ERROR_ECONNRESET 0x80020036
|
||||||
|
#define ORBIS_KERNEL_ERROR_ENOBUFS 0x80020037
|
||||||
|
#define ORBIS_KERNEL_ERROR_EISCONN 0x80020038
|
||||||
|
#define ORBIS_KERNEL_ERROR_ENOTCONN 0x80020039
|
||||||
|
#define ORBIS_KERNEL_ERROR_ESHUTDOWN 0x8002003A
|
||||||
|
#define ORBIS_KERNEL_ERROR_ETOOMANYREFS 0x8002003B
|
||||||
|
#define ORBIS_KERNEL_ERROR_ETIMEDOUT 0x8002003C
|
||||||
|
#define ORBIS_KERNEL_ERROR_ECONNREFUSED 0x8002003D
|
||||||
|
#define ORBIS_KERNEL_ERROR_ELOOP 0x8002003E
|
||||||
|
#define ORBIS_KERNEL_ERROR_ENAMETOOLONG 0x8002003F
|
||||||
|
#define ORBIS_KERNEL_ERROR_EHOSTDOWN 0x80020040
|
||||||
|
#define ORBIS_KERNEL_ERROR_EHOSTUNREACH 0x80020041
|
||||||
|
#define ORBIS_KERNEL_ERROR_ENOTEMPTY 0x80020042
|
||||||
|
#define ORBIS_KERNEL_ERROR_EPROCLIM 0x80020043
|
||||||
|
#define ORBIS_KERNEL_ERROR_EUSERS 0x80020044
|
||||||
|
#define ORBIS_KERNEL_ERROR_EDQUOT 0x80020045
|
||||||
|
#define ORBIS_KERNEL_ERROR_ESTALE 0x80020046
|
||||||
|
#define ORBIS_KERNEL_ERROR_EREMOTE 0x80020047
|
||||||
|
#define ORBIS_KERNEL_ERROR_EBADRPC 0x80020048
|
||||||
|
#define ORBIS_KERNEL_ERROR_ERPCMISMATCH 0x80020049
|
||||||
|
#define ORBIS_KERNEL_ERROR_EPROGUNAVAIL 0x8002004A
|
||||||
|
#define ORBIS_KERNEL_ERROR_EPROGMISMATCH 0x8002004B
|
||||||
|
#define ORBIS_KERNEL_ERROR_EPROCUNAVAIL 0x8002004C
|
||||||
|
#define ORBIS_KERNEL_ERROR_ENOLCK 0x8002004D
|
||||||
|
#define ORBIS_KERNEL_ERROR_ENOSYS 0x8002004E
|
||||||
|
#define ORBIS_KERNEL_ERROR_EFTYPE 0x8002004F
|
||||||
|
#define ORBIS_KERNEL_ERROR_EAUTH 0x80020050
|
||||||
|
#define ORBIS_KERNEL_ERROR_ENEEDAUTH 0x80020051
|
||||||
|
#define ORBIS_KERNEL_ERROR_EIDRM 0x80020052
|
||||||
|
#define ORBIS_KERNEL_ERROR_ENOMSG 0x80020053
|
||||||
|
#define ORBIS_KERNEL_ERROR_EOVERFLOW 0x80020054
|
||||||
|
#define ORBIS_KERNEL_ERROR_ECANCELED 0x80020055
|
||||||
|
#define ORBIS_KERNEL_ERROR_EILSEQ 0x80020056
|
||||||
|
#define ORBIS_KERNEL_ERROR_ENOATTR 0x80020057
|
||||||
|
#define ORBIS_KERNEL_ERROR_EDOOFUS 0x80020058
|
||||||
|
#define ORBIS_KERNEL_ERROR_EBADMSG 0x80020059
|
||||||
|
#define ORBIS_KERNEL_ERROR_EMULTIHOP 0x8002005A
|
||||||
|
#define ORBIS_KERNEL_ERROR_ENOLINK 0x8002005B
|
||||||
|
#define ORBIS_KERNEL_ERROR_EPROTO 0x8002005C
|
||||||
|
#define ORBIS_KERNEL_ERROR_ENOTCAPABLE 0x8002005D
|
||||||
|
#define ORBIS_KERNEL_ERROR_ECAPMODE 0x8002005E
|
||||||
|
#define ORBIS_KERNEL_ERROR_ENOBLK 0x8002005F
|
||||||
|
#define ORBIS_KERNEL_ERROR_EICV 0x80020060
|
||||||
|
#define ORBIS_KERNEL_ERROR_ENOPLAYGOENT 0x80020061
|
||||||
|
|
||||||
|
// AudioOut library
|
||||||
|
#define ORBIS_AUDIO_OUT_ERROR_NOT_OPENED 0x80260001
|
||||||
|
#define ORBIS_AUDIO_OUT_ERROR_BUSY 0x80260002
|
||||||
|
#define ORBIS_AUDIO_OUT_ERROR_INVALID_PORT 0x80260003
|
||||||
|
#define ORBIS_AUDIO_OUT_ERROR_INVALID_POINTER 0x80260004
|
||||||
|
#define ORBIS_AUDIO_OUT_ERROR_PORT_FULL 0x80260005
|
||||||
|
#define ORBIS_AUDIO_OUT_ERROR_INVALID_SIZE 0x80260006
|
||||||
|
#define ORBIS_AUDIO_OUT_ERROR_INVALID_FORMAT 0x80260007
|
||||||
|
#define ORBIS_AUDIO_OUT_ERROR_INVALID_SAMPLE_FREQ 0x80260008
|
||||||
|
#define ORBIS_AUDIO_OUT_ERROR_INVALID_VOLUME 0x80260009
|
||||||
|
#define ORBIS_AUDIO_OUT_ERROR_INVALID_PORT_TYPE 0x8026000A
|
||||||
|
#define ORBIS_AUDIO_OUT_ERROR_INVALID_CONF_TYPE 0x8026000C
|
||||||
|
#define ORBIS_AUDIO_OUT_ERROR_OUT_OF_MEMORY 0x8026000D
|
||||||
|
#define ORBIS_AUDIO_OUT_ERROR_ALREADY_INIT 0x8026000E
|
||||||
|
#define ORBIS_AUDIO_OUT_ERROR_NOT_INIT 0x8026000F
|
||||||
|
#define ORBIS_AUDIO_OUT_ERROR_MEMORY 0x80260010
|
||||||
|
#define ORBIS_AUDIO_OUT_ERROR_SYSTEM_RESOURCE 0x80260011
|
||||||
|
#define ORBIS_AUDIO_OUT_ERROR_TRANS_EVENT 0x80260012
|
||||||
|
#define ORBIS_AUDIO_OUT_ERROR_INVALID_FLAG 0x80260013
|
||||||
|
#define ORBIS_AUDIO_OUT_ERROR_INVALID_MIXLEVEL 0x80260014
|
||||||
|
#define ORBIS_AUDIO_OUT_ERROR_INVALID_ARG 0x80260015
|
||||||
|
#define ORBIS_AUDIO_OUT_ERROR_INVALID_PARAM 0x80260016
|
||||||
|
#define ORBIS_AUDIO_OUT_ERROR_MASTERING_FATAL 0x80260200
|
||||||
|
#define ORBIS_AUDIO_OUT_ERROR_MASTERING_INVALID_API_PARAM 0x80260201
|
||||||
|
#define ORBIS_AUDIO_OUT_ERROR_MASTERING_INVALID_CONFIG 0x80260202
|
||||||
|
#define ORBIS_AUDIO_OUT_ERROR_MASTERING_NOT_INITIALIZED 0x80260203
|
||||||
|
#define ORBIS_AUDIO_OUT_ERROR_MASTERING_INVALID_STATES_ID 0x80260204
|
||||||
|
|
||||||
|
// VideoOut library
|
||||||
|
#define ORBIS_VIDEO_OUT_ERROR_INVALID_VALUE 0x80290001
|
||||||
|
#define ORBIS_VIDEO_OUT_ERROR_INVALID_ADDRESS 0x80290002
|
||||||
|
#define ORBIS_VIDEO_OUT_ERROR_INVALID_PIXEL_FORMAT 0x80290003
|
||||||
|
#define ORBIS_VIDEO_OUT_ERROR_INVALID_PITCH 0x80290004
|
||||||
|
#define ORBIS_VIDEO_OUT_ERROR_INVALID_RESOLUTION 0x80290005
|
||||||
|
#define ORBIS_VIDEO_OUT_ERROR_INVALID_FLIP_MODE 0x80290006
|
||||||
|
#define ORBIS_VIDEO_OUT_ERROR_INVALID_TILING_MODE 0x80290007
|
||||||
|
#define ORBIS_VIDEO_OUT_ERROR_INVALID_ASPECT_RATIO 0x80290008
|
||||||
|
#define ORBIS_VIDEO_OUT_ERROR_RESOURCE_BUSY 0x80290009
|
||||||
|
#define ORBIS_VIDEO_OUT_ERROR_INVALID_INDEX 0x8029000A
|
||||||
|
#define ORBIS_VIDEO_OUT_ERROR_INVALID_HANDLE 0x8029000B
|
||||||
|
#define ORBIS_VIDEO_OUT_ERROR_INVALID_EVENT_QUEUE 0x8029000C
|
||||||
|
#define ORBIS_VIDEO_OUT_ERROR_INVALID_EVENT 0x8029000D
|
||||||
|
#define ORBIS_VIDEO_OUT_ERROR_NO_EMPTY_SLOT 0x8029000F
|
||||||
|
#define ORBIS_VIDEO_OUT_ERROR_SLOT_OCCUPIED 0x80290010
|
||||||
|
#define ORBIS_VIDEO_OUT_ERROR_FLIP_QUEUE_FULL 0x80290012
|
||||||
|
#define ORBIS_VIDEO_OUT_ERROR_INVALID_MEMORY 0x80290013
|
||||||
|
#define ORBIS_VIDEO_OUT_ERROR_MEMORY_NOT_PHYSICALLY_CONTIGUOUS 0x80290014
|
||||||
|
#define ORBIS_VIDEO_OUT_ERROR_MEMORY_INVALID_ALIGNMENT 0x80290015
|
||||||
|
#define ORBIS_VIDEO_OUT_ERROR_UNSUPPORTED_OUTPUT_MODE 0x80290016
|
||||||
|
#define ORBIS_VIDEO_OUT_ERROR_OVERFLOW 0x80290017
|
||||||
|
#define ORBIS_VIDEO_OUT_ERROR_NO_DEVICE 0x80290018
|
||||||
|
#define ORBIS_VIDEO_OUT_ERROR_UNAVAILABLE_OUTPUT_MODE 0x80290019
|
||||||
|
#define ORBIS_VIDEO_OUT_ERROR_INVALID_OPTION 0x8029001A
|
||||||
|
#define ORBIS_VIDEO_OUT_ERROR_UNKNOWN 0x802900FE
|
||||||
|
#define ORBIS_VIDEO_OUT_ERROR_FATAL 0x802900FF
|
||||||
|
#define ORBIS_VIDEO_OUT_ERROR_ENOMEM 0x8029100C
|
||||||
|
|
||||||
|
// Pad library
|
||||||
|
#define ORBIS_PAD_ERROR_INVALID_ARG 0x80920001
|
||||||
|
#define ORBIS_PAD_ERROR_INVALID_PORT 0x80920002
|
||||||
|
#define ORBIS_PAD_ERROR_INVALID_HANDLE 0x80920003
|
||||||
|
#define ORBIS_PAD_ERROR_ALREADY_OPENED 0x80920004
|
||||||
|
#define ORBIS_PAD_ERROR_NOT_INITIALIZED 0x80920005
|
||||||
|
#define ORBIS_PAD_ERROR_INVALID_LIGHTBAR_SETTING 0x80920006
|
||||||
|
#define ORBIS_PAD_ERROR_DEVICE_NOT_CONNECTED 0x80920007
|
||||||
|
#define ORBIS_PAD_ERROR_DEVICE_NO_HANDLE 0x80920008
|
||||||
|
#define ORBIS_PAD_ERROR_FATAL 0x809200FF
|
||||||
|
#define ORBIS_PAD_ERROR_NOT_PERMITTED 0x80920101
|
||||||
|
#define ORBIS_PAD_ERROR_INVALID_BUFFER_LENGTH 0x80920102
|
||||||
|
#define ORBIS_PAD_ERROR_INVALID_REPORT_LENGTH 0x80920103
|
||||||
|
#define ORBIS_PAD_ERROR_INVALID_REPORT_ID 0x80920104
|
||||||
|
#define ORBIS_PAD_ERROR_SEND_AGAIN 0x80920105
|
||||||
|
|
||||||
|
// UserService library
|
||||||
|
#define ORBIS_USER_SERVICE_ERROR_INTERNAL 0x80960001
|
||||||
|
#define ORBIS_USER_SERVICE_ERROR_NOT_INITIALIZED 0x80960002
|
||||||
|
#define ORBIS_USER_SERVICE_ERROR_ALREADY_INITIALIZED 0x80960003
|
||||||
|
#define ORBIS_USER_SERVICE_ERROR_NO_MEMORY 0x80960004
|
||||||
|
#define ORBIS_USER_SERVICE_ERROR_INVALID_ARGUMENT 0x80960005
|
||||||
|
#define ORBIS_USER_SERVICE_ERROR_OPERATION_NOT_SUPPORTED 0x80960006
|
||||||
|
#define ORBIS_USER_SERVICE_ERROR_NO_EVENT 0x80960007
|
||||||
|
#define ORBIS_USER_SERVICE_ERROR_NOT_LOGGED_IN 0x80960009
|
||||||
|
#define ORBIS_USER_SERVICE_ERROR_BUFFER_TOO_SHORT 0x8096000A
|
|
@ -0,0 +1,210 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
// Generated By moduleGenerator
|
||||||
|
#include "common/log.h"
|
||||||
|
#include "error_codes.h"
|
||||||
|
#include "libscecommondialog.h"
|
||||||
|
|
||||||
|
namespace Libraries::CommonDialog {
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZN3sce16CommonDialogUtil12getSelfAppIdEv() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZN3sce16CommonDialogUtil6Client11closeModuleEv() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZN3sce16CommonDialogUtil6Client11updateStateEv() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZN3sce16CommonDialogUtil6Client15launchCmnDialogEv() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZN3sce16CommonDialogUtil6ClientD0Ev() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZN3sce16CommonDialogUtil6ClientD1Ev() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZN3sce16CommonDialogUtil6ClientD2Ev() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZNK3sce16CommonDialogUtil6Client10isCloseReqEv() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZNK3sce16CommonDialogUtil6Client13getFinishDataEPvm() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZNK3sce16CommonDialogUtil6Client14getClientStateEv() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZNK3sce16CommonDialogUtil6Client19isInitializedStatusEv() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZNK3sce16CommonDialogUtil6Client8getAppIdEv() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZNK3sce16CommonDialogUtil6Client8isFinishEv() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZNK3sce16CommonDialogUtil6Client9getResultEv() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZTVN3sce16CommonDialogUtil6ClientE() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI sceCommonDialogInitialize() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI sceCommonDialogIsUsed() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI Func_0FF577E4E8457883() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI Func_41716C2CE379416C() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI Func_483A427D8F6E0748() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI Func_6944B83E02727BDF() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI Func_69F2DD23A8B4950C() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI Func_9954673DEAC170AD() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI Func_A7D4D3AB86CB7455() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI Func_ADE4C51256B8350C() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI Func_B71349CF15FACAB0() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI Func_CB18E00EFA946C64() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI Func_F2AEE270605622B0() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RegisterlibSceCommonDialog(Core::Loader::SymbolsResolver* sym) {
|
||||||
|
LIB_FUNCTION("2RdicdHhtGA", "libSceCommonDialog", 1, "libSceCommonDialog", 1, 1,
|
||||||
|
_ZN3sce16CommonDialogUtil12getSelfAppIdEv);
|
||||||
|
LIB_FUNCTION("I+tdxsCap08", "libSceCommonDialog", 1, "libSceCommonDialog", 1, 1,
|
||||||
|
_ZN3sce16CommonDialogUtil6Client11closeModuleEv);
|
||||||
|
LIB_FUNCTION("v4+gzuTkv6k", "libSceCommonDialog", 1, "libSceCommonDialog", 1, 1,
|
||||||
|
_ZN3sce16CommonDialogUtil6Client11updateStateEv);
|
||||||
|
LIB_FUNCTION("CwCzG0nnLg8", "libSceCommonDialog", 1, "libSceCommonDialog", 1, 1,
|
||||||
|
_ZN3sce16CommonDialogUtil6Client15launchCmnDialogEv);
|
||||||
|
LIB_FUNCTION("Ib1SMmbr07k", "libSceCommonDialog", 1, "libSceCommonDialog", 1, 1,
|
||||||
|
_ZN3sce16CommonDialogUtil6ClientD0Ev);
|
||||||
|
LIB_FUNCTION("6TIMpGvsrC4", "libSceCommonDialog", 1, "libSceCommonDialog", 1, 1,
|
||||||
|
_ZN3sce16CommonDialogUtil6ClientD1Ev);
|
||||||
|
LIB_FUNCTION("+UyKxWAnqIU", "libSceCommonDialog", 1, "libSceCommonDialog", 1, 1,
|
||||||
|
_ZN3sce16CommonDialogUtil6ClientD2Ev);
|
||||||
|
LIB_FUNCTION("bUCx72-9f0g", "libSceCommonDialog", 1, "libSceCommonDialog", 1, 1,
|
||||||
|
_ZNK3sce16CommonDialogUtil6Client10isCloseReqEv);
|
||||||
|
LIB_FUNCTION("xZtXq554Lbg", "libSceCommonDialog", 1, "libSceCommonDialog", 1, 1,
|
||||||
|
_ZNK3sce16CommonDialogUtil6Client13getFinishDataEPvm);
|
||||||
|
LIB_FUNCTION("C-EZ3PkhibQ", "libSceCommonDialog", 1, "libSceCommonDialog", 1, 1,
|
||||||
|
_ZNK3sce16CommonDialogUtil6Client14getClientStateEv);
|
||||||
|
LIB_FUNCTION("70niEKUAnZ0", "libSceCommonDialog", 1, "libSceCommonDialog", 1, 1,
|
||||||
|
_ZNK3sce16CommonDialogUtil6Client19isInitializedStatusEv);
|
||||||
|
LIB_FUNCTION("mdJgdwoM0Mo", "libSceCommonDialog", 1, "libSceCommonDialog", 1, 1,
|
||||||
|
_ZNK3sce16CommonDialogUtil6Client8getAppIdEv);
|
||||||
|
LIB_FUNCTION("87GekE1nowg", "libSceCommonDialog", 1, "libSceCommonDialog", 1, 1,
|
||||||
|
_ZNK3sce16CommonDialogUtil6Client8isFinishEv);
|
||||||
|
LIB_FUNCTION("6ljeTSi+fjs", "libSceCommonDialog", 1, "libSceCommonDialog", 1, 1,
|
||||||
|
_ZNK3sce16CommonDialogUtil6Client9getResultEv);
|
||||||
|
LIB_FUNCTION("W2MzrWix2mM", "libSceCommonDialog", 1, "libSceCommonDialog", 1, 1,
|
||||||
|
_ZTVN3sce16CommonDialogUtil6ClientE);
|
||||||
|
LIB_FUNCTION("uoUpLGNkygk", "libSceCommonDialog", 1, "libSceCommonDialog", 1, 1,
|
||||||
|
sceCommonDialogInitialize);
|
||||||
|
LIB_FUNCTION("BQ3tey0JmQM", "libSceCommonDialog", 1, "libSceCommonDialog", 1, 1,
|
||||||
|
sceCommonDialogIsUsed);
|
||||||
|
LIB_FUNCTION("D-V35OhFeIM", "libSceCommonDialog", 1, "libSceCommonDialog", 1, 1,
|
||||||
|
Func_0FF577E4E8457883);
|
||||||
|
LIB_FUNCTION("QXFsLON5QWw", "libSceCommonDialog", 1, "libSceCommonDialog", 1, 1,
|
||||||
|
Func_41716C2CE379416C);
|
||||||
|
LIB_FUNCTION("SDpCfY9uB0g", "libSceCommonDialog", 1, "libSceCommonDialog", 1, 1,
|
||||||
|
Func_483A427D8F6E0748);
|
||||||
|
LIB_FUNCTION("aUS4PgJye98", "libSceCommonDialog", 1, "libSceCommonDialog", 1, 1,
|
||||||
|
Func_6944B83E02727BDF);
|
||||||
|
LIB_FUNCTION("afLdI6i0lQw", "libSceCommonDialog", 1, "libSceCommonDialog", 1, 1,
|
||||||
|
Func_69F2DD23A8B4950C);
|
||||||
|
LIB_FUNCTION("mVRnPerBcK0", "libSceCommonDialog", 1, "libSceCommonDialog", 1, 1,
|
||||||
|
Func_9954673DEAC170AD);
|
||||||
|
LIB_FUNCTION("p9TTq4bLdFU", "libSceCommonDialog", 1, "libSceCommonDialog", 1, 1,
|
||||||
|
Func_A7D4D3AB86CB7455);
|
||||||
|
LIB_FUNCTION("reTFEla4NQw", "libSceCommonDialog", 1, "libSceCommonDialog", 1, 1,
|
||||||
|
Func_ADE4C51256B8350C);
|
||||||
|
LIB_FUNCTION("txNJzxX6yrA", "libSceCommonDialog", 1, "libSceCommonDialog", 1, 1,
|
||||||
|
Func_B71349CF15FACAB0);
|
||||||
|
LIB_FUNCTION("yxjgDvqUbGQ", "libSceCommonDialog", 1, "libSceCommonDialog", 1, 1,
|
||||||
|
Func_CB18E00EFA946C64);
|
||||||
|
LIB_FUNCTION("8q7icGBWIrA", "libSceCommonDialog", 1, "libSceCommonDialog", 1, 1,
|
||||||
|
Func_F2AEE270605622B0);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Libraries::CommonDialog
|
|
@ -0,0 +1,46 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "library_common.h"
|
||||||
|
|
||||||
|
namespace Libraries::CommonDialog {
|
||||||
|
|
||||||
|
struct OrbisCommonDialogBaseParam {
|
||||||
|
std::size_t size;
|
||||||
|
u8 reserved[36];
|
||||||
|
u32 magic;
|
||||||
|
};
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZN3sce16CommonDialogUtil12getSelfAppIdEv();
|
||||||
|
int PS4_SYSV_ABI _ZN3sce16CommonDialogUtil6Client11closeModuleEv();
|
||||||
|
int PS4_SYSV_ABI _ZN3sce16CommonDialogUtil6Client11updateStateEv();
|
||||||
|
int PS4_SYSV_ABI _ZN3sce16CommonDialogUtil6Client15launchCmnDialogEv();
|
||||||
|
int PS4_SYSV_ABI _ZN3sce16CommonDialogUtil6ClientD0Ev();
|
||||||
|
int PS4_SYSV_ABI _ZN3sce16CommonDialogUtil6ClientD1Ev();
|
||||||
|
int PS4_SYSV_ABI _ZN3sce16CommonDialogUtil6ClientD2Ev();
|
||||||
|
int PS4_SYSV_ABI _ZNK3sce16CommonDialogUtil6Client10isCloseReqEv();
|
||||||
|
int PS4_SYSV_ABI _ZNK3sce16CommonDialogUtil6Client13getFinishDataEPvm();
|
||||||
|
int PS4_SYSV_ABI _ZNK3sce16CommonDialogUtil6Client14getClientStateEv();
|
||||||
|
int PS4_SYSV_ABI _ZNK3sce16CommonDialogUtil6Client19isInitializedStatusEv();
|
||||||
|
int PS4_SYSV_ABI _ZNK3sce16CommonDialogUtil6Client8getAppIdEv();
|
||||||
|
int PS4_SYSV_ABI _ZNK3sce16CommonDialogUtil6Client8isFinishEv();
|
||||||
|
int PS4_SYSV_ABI _ZNK3sce16CommonDialogUtil6Client9getResultEv();
|
||||||
|
int PS4_SYSV_ABI _ZTVN3sce16CommonDialogUtil6ClientE();
|
||||||
|
int PS4_SYSV_ABI sceCommonDialogInitialize();
|
||||||
|
int PS4_SYSV_ABI sceCommonDialogIsUsed();
|
||||||
|
int PS4_SYSV_ABI Func_0FF577E4E8457883();
|
||||||
|
int PS4_SYSV_ABI Func_41716C2CE379416C();
|
||||||
|
int PS4_SYSV_ABI Func_483A427D8F6E0748();
|
||||||
|
int PS4_SYSV_ABI Func_6944B83E02727BDF();
|
||||||
|
int PS4_SYSV_ABI Func_69F2DD23A8B4950C();
|
||||||
|
int PS4_SYSV_ABI Func_9954673DEAC170AD();
|
||||||
|
int PS4_SYSV_ABI Func_A7D4D3AB86CB7455();
|
||||||
|
int PS4_SYSV_ABI Func_ADE4C51256B8350C();
|
||||||
|
int PS4_SYSV_ABI Func_B71349CF15FACAB0();
|
||||||
|
int PS4_SYSV_ABI Func_CB18E00EFA946C64();
|
||||||
|
int PS4_SYSV_ABI Func_F2AEE270605622B0();
|
||||||
|
|
||||||
|
void RegisterlibSceCommonDialog(Core::Loader::SymbolsResolver* sym);
|
||||||
|
} // namespace Libraries::CommonDialog
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,85 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
// Generated By moduleGenerator
|
||||||
|
#include "common/log.h"
|
||||||
|
#include "error_codes.h"
|
||||||
|
#include "libscemsgdialog.h"
|
||||||
|
|
||||||
|
namespace Libraries::MsgDialog {
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogClose() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogGetResult() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogGetStatus() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogInitialize() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 PS4_SYSV_ABI sceMsgDialogOpen(const OrbisMsgDialogParam* param) {
|
||||||
|
PRINT_DUMMY_FUNCTION_NAME();
|
||||||
|
OrbisMsgDialogUserMessageParam* userMsgParam = param->userMsgParam;
|
||||||
|
const char* msg = userMsgParam->msg;
|
||||||
|
printf("sceMsgDialogOpen msg : %s", msg);
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogProgressBarInc() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogProgressBarSetMsg() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogProgressBarSetValue() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogTerminate() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogUpdateStatus() {
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RegisterlibSceMsgDialog(Core::Loader::SymbolsResolver* sym) {
|
||||||
|
LIB_FUNCTION("HTrcDKlFKuM", "libSceMsgDialog", 1, "libSceMsgDialog", 1, 1, sceMsgDialogClose);
|
||||||
|
LIB_FUNCTION("Lr8ovHH9l6A", "libSceMsgDialog", 1, "libSceMsgDialog", 1, 1,
|
||||||
|
sceMsgDialogGetResult);
|
||||||
|
LIB_FUNCTION("CWVW78Qc3fI", "libSceMsgDialog", 1, "libSceMsgDialog", 1, 1,
|
||||||
|
sceMsgDialogGetStatus);
|
||||||
|
LIB_FUNCTION("lDqxaY1UbEo", "libSceMsgDialog", 1, "libSceMsgDialog", 1, 1,
|
||||||
|
sceMsgDialogInitialize);
|
||||||
|
LIB_FUNCTION("b06Hh0DPEaE", "libSceMsgDialog", 1, "libSceMsgDialog", 1, 1, sceMsgDialogOpen);
|
||||||
|
LIB_FUNCTION("Gc5k1qcK4fs", "libSceMsgDialog", 1, "libSceMsgDialog", 1, 1,
|
||||||
|
sceMsgDialogProgressBarInc);
|
||||||
|
LIB_FUNCTION("6H-71OdrpXM", "libSceMsgDialog", 1, "libSceMsgDialog", 1, 1,
|
||||||
|
sceMsgDialogProgressBarSetMsg);
|
||||||
|
LIB_FUNCTION("wTpfglkmv34", "libSceMsgDialog", 1, "libSceMsgDialog", 1, 1,
|
||||||
|
sceMsgDialogProgressBarSetValue);
|
||||||
|
LIB_FUNCTION("ePw-kqZmelo", "libSceMsgDialog", 1, "libSceMsgDialog", 1, 1,
|
||||||
|
sceMsgDialogTerminate);
|
||||||
|
LIB_FUNCTION("6fIC3XKt2k0", "libSceMsgDialog", 1, "libSceMsgDialog", 1, 1,
|
||||||
|
sceMsgDialogUpdateStatus);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Libraries::MsgDialog
|
|
@ -0,0 +1,95 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "library_common.h"
|
||||||
|
#include "libscecommondialog.h"
|
||||||
|
|
||||||
|
namespace Libraries::MsgDialog {
|
||||||
|
|
||||||
|
using OrbisUserServiceUserId = s32;
|
||||||
|
|
||||||
|
enum OrbisMsgDialogMode {
|
||||||
|
ORBIS_MSG_DIALOG_MODE_USER_MSG = 1,
|
||||||
|
ORBIS_MSG_DIALOG_MODE_PROGRESS_BAR = 2,
|
||||||
|
ORBIS_MSG_DIALOG_MODE_SYSTEM_MSG = 3,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum OrbisMsgDialogButtonType {
|
||||||
|
ORBIS_MSG_DIALOG_BUTTON_TYPE_OK = 0,
|
||||||
|
ORBIS_MSG_DIALOG_BUTTON_TYPE_YESNO = 1,
|
||||||
|
ORBIS_MSG_DIALOG_BUTTON_TYPE_NONE = 2,
|
||||||
|
ORBIS_MSG_DIALOG_BUTTON_TYPE_OK_CANCEL = 3,
|
||||||
|
ORBIS_MSG_DIALOG_BUTTON_TYPE_WAIT = 5,
|
||||||
|
ORBIS_MSG_DIALOG_BUTTON_TYPE_WAIT_CANCEL = 6,
|
||||||
|
ORBIS_MSG_DIALOG_BUTTON_TYPE_YESNO_FOCUS_NO = 7,
|
||||||
|
ORBIS_MSG_DIALOG_BUTTON_TYPE_OK_CANCEL_FOCUS_CANCEL = 8,
|
||||||
|
ORBIS_MSG_DIALOG_BUTTON_TYPE_2BUTTONS = 9,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum OrbisMsgDialogProgressBarType {
|
||||||
|
ORBIS_MSG_DIALOG_PROGRESSBAR_TYPE_PERCENTAGE = 0,
|
||||||
|
ORBIS_MSG_DIALOG_PROGRESSBAR_TYPE_PERCENTAGE_CANCEL = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum OrbisMsgDialogSystemMessageType {
|
||||||
|
ORBIS_MSG_DIALOG_SYSMSG_TYPE_TRC_EMPTY_STORE = 0,
|
||||||
|
ORBIS_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION = 1,
|
||||||
|
ORBIS_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_UGC_RESTRICTION = 2,
|
||||||
|
ORBIS_MSG_DIALOG_SYSMSG_TYPE_CAMERA_NOT_CONNECTED = 4,
|
||||||
|
ORBIS_MSG_DIALOG_SYSMSG_TYPE_WARNING_PROFILE_PICTURE_AND_NAME_NOT_SHARED = 5,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct OrbisMsgDialogButtonsParam {
|
||||||
|
const char* msg1;
|
||||||
|
const char* msg2;
|
||||||
|
char reserved[32];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct OrbisMsgDialogUserMessageParam {
|
||||||
|
OrbisMsgDialogButtonType buttonType;
|
||||||
|
s32 : 32;
|
||||||
|
const char* msg;
|
||||||
|
OrbisMsgDialogButtonsParam* buttonsParam;
|
||||||
|
char reserved[24];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct OrbisMsgDialogProgressBarParam {
|
||||||
|
OrbisMsgDialogProgressBarType barType;
|
||||||
|
int32_t : 32;
|
||||||
|
const char* msg;
|
||||||
|
char reserved[64];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct OrbisMsgDialogSystemMessageParam {
|
||||||
|
OrbisMsgDialogSystemMessageType sysMsgType;
|
||||||
|
char reserved[32];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct OrbisMsgDialogParam {
|
||||||
|
CommonDialog::OrbisCommonDialogBaseParam baseParam;
|
||||||
|
std::size_t size;
|
||||||
|
OrbisMsgDialogMode mode;
|
||||||
|
s32 : 32;
|
||||||
|
OrbisMsgDialogUserMessageParam* userMsgParam;
|
||||||
|
OrbisMsgDialogProgressBarParam* progBarParam;
|
||||||
|
OrbisMsgDialogSystemMessageParam* sysMsgParam;
|
||||||
|
OrbisUserServiceUserId userId;
|
||||||
|
char reserved[40];
|
||||||
|
s32 : 32;
|
||||||
|
};
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogClose();
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogGetResult();
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogGetStatus();
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogInitialize();
|
||||||
|
s32 PS4_SYSV_ABI sceMsgDialogOpen(const OrbisMsgDialogParam* param);
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogProgressBarInc();
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogProgressBarSetMsg();
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogProgressBarSetValue();
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogTerminate();
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogUpdateStatus();
|
||||||
|
|
||||||
|
void RegisterlibSceMsgDialog(Core::Loader::SymbolsResolver* sym);
|
||||||
|
} // namespace Libraries::MsgDialog
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,573 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
// reference
|
||||||
|
// https://github.com/OpenOrbis/OpenOrbis-PS4-Toolchain/blob/master/include/orbis/_types/sys_service.h
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "library_common.h"
|
||||||
|
|
||||||
|
namespace Libraries::SystemService {
|
||||||
|
|
||||||
|
enum OrbisSystemServiceParamId {
|
||||||
|
ORBIS_SYSTEM_SERVICE_PARAM_ID_LANG = 1,
|
||||||
|
ORBIS_SYSTEM_SERVICE_PARAM_ID_DATE_FORMAT = 2,
|
||||||
|
ORBIS_SYSTEM_SERVICE_PARAM_ID_TIME_FORMAT = 3,
|
||||||
|
ORBIS_SYSTEM_SERVICE_PARAM_ID_TIME_ZONE = 4,
|
||||||
|
ORBIS_SYSTEM_SERVICE_PARAM_ID_SUMMERTIME = 5,
|
||||||
|
ORBIS_SYSTEM_SERVICE_PARAM_ID_SYSTEM_NAME = 6,
|
||||||
|
ORBIS_SYSTEM_SERVICE_PARAM_ID_GAME_PARENTAL_LEVEL = 7,
|
||||||
|
ORBIS_SYSTEM_SERVICE_PARAM_ID_ENTER_BUTTON_ASSIGN = 1000
|
||||||
|
};
|
||||||
|
|
||||||
|
enum OrbisSystemParamDateFormat {
|
||||||
|
ORBIS_SYSTEM_PARAM_DATE_FORMAT_YYYYMMDD = 0,
|
||||||
|
ORBIS_SYSTEM_PARAM_DATE_FORMAT_DDMMYYYY = 1,
|
||||||
|
ORBIS_SYSTEM_PARAM_DATE_FORMAT_MMDDYYYY = 2
|
||||||
|
};
|
||||||
|
|
||||||
|
enum OrbisSystemParamTimeFormat {
|
||||||
|
ORBIS_SYSTEM_PARAM_TIME_FORMAT_12HOUR = 0,
|
||||||
|
ORBIS_SYSTEM_PARAM_TIME_FORMAT_24HOUR = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
enum OrbisSystemParamGameParentalLevel {
|
||||||
|
ORBIS_SYSTEM_PARAM_GAME_PARENTAL_OFF = 0,
|
||||||
|
ORBIS_SYSTEM_PARAM_GAME_PARENTAL_LEVEL01 = 1,
|
||||||
|
ORBIS_SYSTEM_PARAM_GAME_PARENTAL_LEVEL02 = 2,
|
||||||
|
ORBIS_SYSTEM_PARAM_GAME_PARENTAL_LEVEL03 = 3,
|
||||||
|
ORBIS_SYSTEM_PARAM_GAME_PARENTAL_LEVEL04 = 4,
|
||||||
|
ORBIS_SYSTEM_PARAM_GAME_PARENTAL_LEVEL05 = 5,
|
||||||
|
ORBIS_SYSTEM_PARAM_GAME_PARENTAL_LEVEL06 = 6,
|
||||||
|
ORBIS_SYSTEM_PARAM_GAME_PARENTAL_LEVEL07 = 7,
|
||||||
|
ORBIS_SYSTEM_PARAM_GAME_PARENTAL_LEVEL08 = 8,
|
||||||
|
ORBIS_SYSTEM_PARAM_GAME_PARENTAL_LEVEL09 = 9,
|
||||||
|
ORBIS_SYSTEM_PARAM_GAME_PARENTAL_LEVEL10 = 10,
|
||||||
|
ORBIS_SYSTEM_PARAM_GAME_PARENTAL_LEVEL11 = 11
|
||||||
|
};
|
||||||
|
|
||||||
|
enum OrbisSystemParamEnterButtonAssign {
|
||||||
|
ORBIS_SYSTEM_PARAM_ENTER_BUTTON_ASSIGN_CIRCLE = 0,
|
||||||
|
ORBIS_SYSTEM_PARAM_ENTER_BUTTON_ASSIGN_CROSS = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
enum OrbisSystemParamLanguage {
|
||||||
|
ORBIS_SYSTEM_PARAM_LANG_JAPANESE = 0,
|
||||||
|
ORBIS_SYSTEM_PARAM_LANG_ENGLISH_US = 1,
|
||||||
|
ORBIS_SYSTEM_PARAM_LANG_FRENCH = 2,
|
||||||
|
ORBIS_SYSTEM_PARAM_LANG_SPANISH = 3,
|
||||||
|
ORBIS_SYSTEM_PARAM_LANG_GERMAN = 4,
|
||||||
|
ORBIS_SYSTEM_PARAM_LANG_ITALIAN = 5,
|
||||||
|
ORBIS_SYSTEM_PARAM_LANG_DUTCH = 6,
|
||||||
|
ORBIS_SYSTEM_PARAM_LANG_PORTUGUESE_PT = 7,
|
||||||
|
ORBIS_SYSTEM_PARAM_LANG_RUSSIAN = 8,
|
||||||
|
ORBIS_SYSTEM_PARAM_LANG_KOREAN = 9,
|
||||||
|
ORBIS_SYSTEM_PARAM_LANG_CHINESE_T = 10,
|
||||||
|
ORBIS_SYSTEM_PARAM_LANG_CHINESE_S = 11,
|
||||||
|
ORBIS_SYSTEM_PARAM_LANG_FINNISH = 12,
|
||||||
|
ORBIS_SYSTEM_PARAM_LANG_SWEDISH = 13,
|
||||||
|
ORBIS_SYSTEM_PARAM_LANG_DANISH = 14,
|
||||||
|
ORBIS_SYSTEM_PARAM_LANG_NORWEGIAN = 15,
|
||||||
|
ORBIS_SYSTEM_PARAM_LANG_POLISH = 16,
|
||||||
|
ORBIS_SYSTEM_PARAM_LANG_PORTUGUESE_BR = 17,
|
||||||
|
ORBIS_SYSTEM_PARAM_LANG_ENGLISH_GB = 18,
|
||||||
|
ORBIS_SYSTEM_PARAM_LANG_TURKISH = 19,
|
||||||
|
ORBIS_SYSTEM_PARAM_LANG_SPANISH_LA = 20,
|
||||||
|
ORBIS_SYSTEM_PARAM_LANG_ARABIC = 21,
|
||||||
|
ORBIS_SYSTEM_PARAM_LANG_FRENCH_CA = 22,
|
||||||
|
ORBIS_SYSTEM_PARAM_LANG_CZECH = 23,
|
||||||
|
ORBIS_SYSTEM_PARAM_LANG_HUNGARIAN = 24,
|
||||||
|
ORBIS_SYSTEM_PARAM_LANG_GREEK = 25,
|
||||||
|
ORBIS_SYSTEM_PARAM_LANG_ROMANIAN = 26,
|
||||||
|
ORBIS_SYSTEM_PARAM_LANG_THAI = 27,
|
||||||
|
ORBIS_SYSTEM_PARAM_LANG_VIETNAMESE = 28,
|
||||||
|
ORBIS_SYSTEM_PARAM_LANG_INDONESIAN = 29
|
||||||
|
};
|
||||||
|
|
||||||
|
struct OrbisSystemServiceStatus {
|
||||||
|
s32 eventNum;
|
||||||
|
bool isSystemUiOverlaid;
|
||||||
|
bool isInBackgroundExecution;
|
||||||
|
bool isCpuMode7CpuNormal;
|
||||||
|
bool isGameLiveStreamingOnAir;
|
||||||
|
bool isOutOfVrPlayArea;
|
||||||
|
u8 reserved[];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct OrbisSystemServiceDisplaySafeAreaInfo {
|
||||||
|
float ratio;
|
||||||
|
uint8_t reserved[128];
|
||||||
|
};
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI sceAppMessagingClearEventFlag();
|
||||||
|
int PS4_SYSV_ABI sceAppMessagingReceiveMsg();
|
||||||
|
int PS4_SYSV_ABI sceAppMessagingSendMsg();
|
||||||
|
int PS4_SYSV_ABI sceAppMessagingSendMsgToShellCore();
|
||||||
|
int PS4_SYSV_ABI sceAppMessagingSendMsgToShellUI();
|
||||||
|
int PS4_SYSV_ABI sceAppMessagingSetEventFlag();
|
||||||
|
int PS4_SYSV_ABI sceAppMessagingTryGetEventFlag();
|
||||||
|
int PS4_SYSV_ABI sceAppMessagingTryReceiveMsg();
|
||||||
|
int PS4_SYSV_ABI Func_C8E899ABEF7F64C4();
|
||||||
|
int PS4_SYSV_ABI Func_F74BA759B9C8D2A1();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilAcquireCpuBudgetOfExtraAudioDevices();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilAcquireCpuBudgetOfImeForBigApp();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilAcquireCpuBudgetOfInGameStore();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilActivateCdlg();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilAddLocalProcess();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilBlockAppSuspend();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilBlockingGetEventForDaemon();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilContinueApp();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilCrashSyscore();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilDeactivateCdlg();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilDeclareReadyForSuspend();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilDisableSuspendNotification();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilEnableSuspendNotification();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilFinishSpecialResume();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilForceKillApp();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilForceKillLocalProcess();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilGetApp0DirPath();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilGetAppCategory();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilGetAppFocusedAppStatus();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilGetAppId();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilGetAppIdOfBigApp();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilGetAppIdOfMiniApp();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilGetAppLaunchedUser();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilGetAppStatus();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilGetAppStatusListForShellUIReboot();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilGetAppTitleId();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilGetAppType();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilGetCdlgExec();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilGetCoredumpState();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilGetDbgExecutablePath();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilGetEventForDaemon();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilGetEventForShellUI();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilGetGpuCrashFullDumpAppStatus();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilGetLocalProcessStatusList();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilGetParentSocket();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilGetResultKillApp();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilGetResultLaunchAppByTitleId();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilInitialize();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilIsActiveCdlg();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilIsAppLaunched();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilIsAppSuspended();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilIsCpuBudgetOfExtraAudioDevicesAvailable();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilIsPs2Emu();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilIsShellUiFgAndGameBgCpuMode();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilKickCoredumpOnlyProcMem();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilKillApp();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilKillAppWithReason();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilKillLocalProcess();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilLaunchApp();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilLoadExec();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilNotifyCoredumpRequestEnd();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilNotifyCoredumpRequestProgress();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilNotifyVshReady();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilRaiseException();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilRaiseExceptionLocalProcess();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilRegisterCdlgSharedMemoryName();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilRegisterDaemon();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilRegisterShellUI();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilReleaseCpuBudgetOfExtraAudioDevices();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilReleaseCpuBudgetOfImeForBigApp();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilReleaseCpuBudgetOfInGameStore();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilResumeApp();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilResumeLocalProcess();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilSetAppFocus();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilSetCdlgExec();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilSetControllerFocus();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilSetControllerFocusPermission();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilStartKillApp();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilStartLaunchAppByTitleId();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilSuspendApp();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilSuspendBackgroundApp();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilSuspendLocalProcess();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilSystemSuspend();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilTerminate();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilTryBlockAppSuspend();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilUnblockAppSuspend();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilUnregisterCdlgSharedMemoryName();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilUnregisterDaemon();
|
||||||
|
int PS4_SYSV_ABI sceLncUtilUnregisterShellUI();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceActivateHevcSoft();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceActivateHevcSoftAbort();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceActivateHevcSoftGetStatus();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceActivateHevcSoftInit();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceActivateHevcSoftIsActivated();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceActivateHevcSoftStart();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceActivateHevcSoftTerm();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilAccessibilityZoomLock();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilAccessibilityZoomUnlock();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilAcquireBgmCpuBudget();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilAcquireRemotePlayCpuBudget();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilAcquireSharePlayCpuBudget();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilActivateAbort();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilActivateGetStatus();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilActivateInit();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilActivateIsActivated();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilActivateRecordActivation();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilActivateStart();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilActivateStartAsync();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilActivateTerm();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilChangeRunLevel();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilChangeToStaffModeForIDU();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilCheckerAbort();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilCleanupCrashReport();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilClearAppData();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilClearPsnAccountInfo();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilCrashReportRequestCancel();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilDeclareBeginOfExternalStorageAppMove();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilDeclareEndOfExternalStorageAppMove();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilDeleteDiscInstalledTitleWorkaroundFile();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilDeleteDownloadedHidConfigFile();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilDeleteDownloadedNetEvConfigFile();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilDeleteDownloadedTitleWorkaroundFile();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilDeleteSmrHddDummyData();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilDoFsck();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilDownloadHidConfigFileFromServer();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilDownloadNetEvConfigFileFromServer();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilDownloadTitleWorkaroundFileFromServer();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilEnterPowerLockSection();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilExecuteCrashReport();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilExfatFormatExternalHdd();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilExitMiniApp();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilExitMiniAppWithValue();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilFillUpSpaceOnSmrHdd();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilFormatExternalHdd();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilFormatHddForRestore();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilFreeUpSpaceOnSmrHdd();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetAppData();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetAppEnableTTS();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetAppEnterButtonAssign();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetAppLaunchedParamInt();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetAppLaunchedParamIntByBudgetType();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetAppLaunchedParamString();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetAppLaunchedParamStringByBudgetType();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetAppLaunchTypeInfo();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetAutoPowerDownRemainingSeconds();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetBasicProductShape();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetCheckerString();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetCheckerStringEx();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetCloudClientStatus();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetCrashReportCoreFileSetSize();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetCrashReportFilterInfoStart();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetCrashReportInfoForBoot();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetCrashReportInfoForBootStart();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetCrashReportInfoStart();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreutilGetCrashReportProcessInformation();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetCrashReportResult();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetCrashReportStatus();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetCrashReportUploadStatus();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetDeviceIndexBehavior();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetDeviceIndexBehaviorWithTimeout();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetEffectiveTotalSizeOfUserPartition();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetFreeSizeOfAvContentsTmp();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetFreeSizeOfUserPartition();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetFsckProgress();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetGameLiveStreamingStatus();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetGnmCompositorOnScreenProfilerFlag();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetGpuLoadEmulationMode();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetGpuLoadEmulationModeByAppId();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetHidConfigFileInfoString();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetHidConfigFileString();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetHidConfigName();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetHidConfigNum();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetIDUMode();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetImposeMenuFlagForPs2Emu();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetManifestFileStatus();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetNeedSizeOfAppContent();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetNetEvConfigFileInfoString();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetOptimizationStatus();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetOutOfVrPlayZoneWarning();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetPapcGamePcl();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetPbtcUserInfoList();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetPlatformPrivacyDefinitionEventData();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetPlatformPrivacySetting();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetProgressOfFormatExternalHdd();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetProgressOfFsck();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetPsnAccountInfo();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetPsStoreIconLayout();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetPsStoreIconState();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetRegion();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetRemotePlayStatus();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetRunLevel();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetSharePlayStatus();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetShellUIVMStats();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetSmrHddInfoString();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetSocialScreenStatus();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetSplashScreenState();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetSupportSiteURL();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetSuspendConfirmationDialogFlag();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetSystemBGState();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetSystemBGWaveColor();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetSystemBGWaveState();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetTitleWorkaroundFileInfoString();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetTitleWorkaroundFileString();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetUIStatus();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetUserFocus();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetUserIdOfMorpheusUser();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGetVersionNumberOfCameraCalibrationData();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilGoBackToKratosCurrentSessionGame();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilHideBlocksFromUser();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilIncrementVersionNumberOfCameraCalibrationData();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilIsAccessibilityZoomLocked();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilIsBgmCpuBudgetAcquired();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilIsBgmCpuBudgetAvailable();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilIsBgmPlaying();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilIsExternalStorageAppMoveInProgress();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilIsEyeToEyeDistanceAdjusted();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilIsGameLiveStreamingOnAir();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilIsImposeScreenOverlaid();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilIsInSystemSuspendBlackList();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilIsInternalKratosUser();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilIsKilledOrSuspendedByLogout();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilIsNeededCrashReport();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilIsPowerSaveAlertRequested();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilIsRemotePlayCpuBudgetAcquired();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilIsScreenSaverOn();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilIsSharePlayCpuBudgetAcquired();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilIsShowCrashReport();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilIsTemperatureDanger();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilIsTitleWorkaroundEnabled();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilIsUsbMassStorageMounted();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilLaunchByUri();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilLeavePowerLockSection();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilLog();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilMakeManifestFile();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilMountAppRight();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilMountDownloadDataForShellUI();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilMountHddForBackup();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilMountHddForRestore();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilNavigateToAnotherApp();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilNavigateToGoHome();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilNavigateToLaunchedApp();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilNotificationCancelForIDU();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilNotificationRequestedForIDU();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilNotifyBgmCoreTermination();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilNotifyFarsightUIDone();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilNotifyFsReadError();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilNotifyPsnAccountInfoReceived();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilNotifyYouTubeAccountLinkStatusChanged();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilPfAuthClientConsoleTokenClearCache();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilPostActivityForPsNow();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilPostErrorLog();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilPostLaunchConfirmResult();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilPostPsmEventToShellUI();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilPreNotifyOfGameLiveStreaming();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilPreNotifyOfRemotePlay();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilPreNotifyOfSharePlay();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilReleaseBgmCpuBudget();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilReleaseRemotePlayCpuBudget();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilReleaseSharePlayCpuBudget();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilReportSessionErrorToGaikaiController();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilReportUnexpectedFatalErrorToSystemTelemetry();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilRequestCameraCalibration();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilRequestEjectDevice();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilRequestRebootApp();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilRequestShutdown();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilResetAutoPowerDownTimer();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilResetBgdcConfig();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilSetAppData();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilSetBgmProhibition();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilSetDeviceIndexBehavior();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilSetGameLiveStreamingOnAirFlag();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilSetGameLiveStreamingStatus();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilSetGnmCompositorOnScreenProfilerFlag();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilSetGpuLoadEmulationMode();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilSetGpuLoadEmulationModeByAppId();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilSetIDUMode();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilSetImposeStatusFlag();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilSetPsStoreIconLayout();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilSetPsStoreIconState();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilSetRemotePlayStatus();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilSetSharePlayStatus();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilSetSkipUpdateCheck();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilSetSocialScreenStatus();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilSetSplashScreenState();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilSetSystemBGState();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilSetSystemBGWaveColor();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilSetSystemBGWaveState();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilSetUIStatus();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilSetUserFocus();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilShowCriticalErrorDialog();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilShowErrorDialog();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilShowErrorDialogWithFormatArgs();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilShowErrorDialogWithParam();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilShowPsUnderLockIndicator();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilSignalUserInput();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilStartOptimization();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilStartPsNowGame();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilStopOptimization();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilStopPsNowGame();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilTestBusTransferSpeed();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilTickHeartBeat();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilTriggerPapcRecalculation();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilTriggerPapcUpdate();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilTurnOffScreenSaver();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilUnmountAppRight();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilUnmountDownloadDataForShellUI();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilUnmountHddForBackup();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilUnmountHddForRestore();
|
||||||
|
int PS4_SYSV_ABI sceShellCoreUtilWriteSmrHddDummyData();
|
||||||
|
int PS4_SYSV_ABI Func_1E5CA5A71FA7F028();
|
||||||
|
int PS4_SYSV_ABI Func_6D43644F75C38346();
|
||||||
|
int PS4_SYSV_ABI Func_739FB849CB28F445();
|
||||||
|
int PS4_SYSV_ABI Func_B20628FF35C74111();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceAddLocalProcessForJvm();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceGetParentSocketForJvm();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceKillLocalProcessForJvm();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceAcquireFb0();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceAddLocalProcess();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceAddLocalProcessForPsmKit();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceChangeAcpClock();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceChangeCpuClock();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceChangeGpuClock();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceChangeMemoryClock();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceChangeMemoryClockToBaseMode();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceChangeMemoryClockToDefault();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceChangeMemoryClockToMultiMediaMode();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceChangeNumberOfGpuCu();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceChangeSamuClock();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceChangeUvdClock();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceChangeVceClock();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceDisableMusicPlayer();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceDisablePersonalEyeToEyeDistanceSetting();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceDisableSuspendConfirmationDialog();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceEnablePersonalEyeToEyeDistanceSetting();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceEnableSuspendConfirmationDialog();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceGetAppFocusedAppStatus();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceGetAppIdOfBigApp();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceGetAppIdOfMiniApp();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceGetAppStatus();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceGetAppType();
|
||||||
|
s32 PS4_SYSV_ABI
|
||||||
|
sceSystemServiceGetDisplaySafeAreaInfo(OrbisSystemServiceDisplaySafeAreaInfo* info);
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceGetEventForDaemon();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceGetGpuLoadEmulationMode();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceGetHdrToneMapLuminance();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceGetLocalProcessStatusList();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceGetParentSocket();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceGetParentSocketForPsmKit();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceGetPSButtonEvent();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceGetRenderingMode();
|
||||||
|
s32 PS4_SYSV_ABI sceSystemServiceGetStatus(OrbisSystemServiceStatus* status);
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceGetTitleWorkaroundInfo();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceGetVersionNumberOfCameraCalibrationData();
|
||||||
|
s32 PS4_SYSV_ABI sceSystemServiceHideSplashScreen();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceIsAppSuspended();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceIsBgmPlaying();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceIsEyeToEyeDistanceAdjusted();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceIsScreenSaverOn();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceIsShellUiFgAndGameBgCpuMode();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceKillApp();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceKillLocalProcess();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceKillLocalProcessForPsmKit();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceLaunchApp();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceLaunchEventDetails();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceLaunchTournamentList();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceLaunchTournamentsTeamProfile();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceLaunchWebBrowser();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceLoadExec();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceNavigateToAnotherApp();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceNavigateToGoBack();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceNavigateToGoBackWithValue();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceNavigateToGoHome();
|
||||||
|
s32 PS4_SYSV_ABI sceSystemServiceParamGetInt(int param_id, int* value);
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceParamGetString();
|
||||||
|
int PS4_SYSV_ABI sceSystemServicePowerTick();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceRaiseExceptionLocalProcess();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceReceiveEvent();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceReenableMusicPlayer();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceRegisterDaemon();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceReleaseFb0();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceReportAbnormalTermination();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceRequestCameraCalibration();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceRequestToChangeRenderingMode();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceResumeLocalProcess();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceSetControllerFocusPermission();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceSetGpuLoadEmulationMode();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceSetOutOfVrPlayAreaFlag();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceSetOutOfVrPlayZoneWarning();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceShowControllerSettings();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceShowDisplaySafeAreaSettings();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceShowEyeToEyeDistanceSetting();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceSuspendBackgroundApp();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceSuspendLocalProcess();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceTickVideoPlayback();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceTurnOffScreenSaver();
|
||||||
|
int PS4_SYSV_ABI Func_9031A344CB540F1A();
|
||||||
|
int PS4_SYSV_ABI Func_A9D4CF2568EAB837();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceLaunchWebApp();
|
||||||
|
int PS4_SYSV_ABI Func_B8495C766861FDCF();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceGetDbgExecutablePath();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceActivateHevc();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceActivateHevcAbort();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceActivateHevcGetStatus();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceActivateHevcInit();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceActivateHevcIsActivated();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceActivateHevcStart();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceActivateHevcTerm();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceActivateMpeg2Abort();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceActivateMpeg2GetStatus();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceActivateMpeg2Init();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceActivateMpeg2IsActivated();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceActivateMpeg2Start();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceActivateMpeg2Term();
|
||||||
|
int PS4_SYSV_ABI sceSystemStateMgrCancelShutdownTimer();
|
||||||
|
int PS4_SYSV_ABI sceSystemStateMgrEnterMediaPlaybackMode();
|
||||||
|
int PS4_SYSV_ABI sceSystemStateMgrEnterStandby();
|
||||||
|
int PS4_SYSV_ABI sceSystemStateMgrExtendShutdownTimer();
|
||||||
|
int PS4_SYSV_ABI sceSystemStateMgrExtendShutdownTimerForPostAutoUpdateProcess();
|
||||||
|
int PS4_SYSV_ABI sceSystemStateMgrGetCurrentState();
|
||||||
|
int PS4_SYSV_ABI sceSystemStateMgrGetTriggerCode();
|
||||||
|
int PS4_SYSV_ABI sceSystemStateMgrIsBdDriveReady();
|
||||||
|
int PS4_SYSV_ABI sceSystemStateMgrIsGpuPerformanceNormal();
|
||||||
|
int PS4_SYSV_ABI sceSystemStateMgrIsShellUIShutdownInProgress();
|
||||||
|
int PS4_SYSV_ABI sceSystemStateMgrIsStandbyModeEnabled();
|
||||||
|
int PS4_SYSV_ABI sceSystemStateMgrLeaveMediaPlaybackMode();
|
||||||
|
int PS4_SYSV_ABI sceSystemStateMgrNotifySystemSuspendResumeProgress();
|
||||||
|
int PS4_SYSV_ABI sceSystemStateMgrReboot();
|
||||||
|
int PS4_SYSV_ABI sceSystemStateMgrSendCecOneTouchPlayCommand();
|
||||||
|
int PS4_SYSV_ABI sceSystemStateMgrStartRebootTimer();
|
||||||
|
int PS4_SYSV_ABI sceSystemStateMgrStartShutdownTimer();
|
||||||
|
int PS4_SYSV_ABI sceSystemStateMgrStartStadbyTimer();
|
||||||
|
int PS4_SYSV_ABI sceSystemStateMgrStartVshAutoUpdateTimer();
|
||||||
|
int PS4_SYSV_ABI sceSystemStateMgrTickMusicPlayback();
|
||||||
|
int PS4_SYSV_ABI sceSystemStateMgrTickPartyChat();
|
||||||
|
int PS4_SYSV_ABI sceSystemStateMgrTurnOff();
|
||||||
|
int PS4_SYSV_ABI sceSystemStateMgrVshAutoUpdate();
|
||||||
|
int PS4_SYSV_ABI sceSystemStateMgrWaitVshAutoUpdateVerifyDone();
|
||||||
|
int PS4_SYSV_ABI sceSystemStateMgrWakeUp();
|
||||||
|
int PS4_SYSV_ABI Func_89F262179C22B49E();
|
||||||
|
int PS4_SYSV_ABI Func_AC8A8FAB4A1696B8();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceInvokeAppLaunchLink();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceShowClosedCaptionAdvancedSettings();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceShowClosedCaptionSettings();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceSetPowerSaveLevel();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceInitializeForShellCore();
|
||||||
|
int PS4_SYSV_ABI Func_7C1183FC73629929();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceDisablePartyVoice();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceReenablePartyVoice();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceGetPlatformPrivacyDefinitionData();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceGetPlatformPrivacyDefinitionVersion();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceGetPlatformPrivacySetting();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceDeclareReadyForSuspend();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceDisableSuspendNotification();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceEnableSuspendNotification();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceRequestPowerOff();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceRequestReboot();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceAddLocalProcessForPs2Emu();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceGetParentSocketForPs2Emu();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceKillLocalProcessForPs2Emu();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceShowImposeMenuForPs2Emu();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceSaveVideoToken();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceLaunchStore();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceTelemetrySetData();
|
||||||
|
int PS4_SYSV_ABI Func_C67FC780F5B6F71E();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceLaunchUdsApp();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceLoadExecVideoServiceWebApp();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceDisableVoiceRecognition();
|
||||||
|
int PS4_SYSV_ABI sceSystemServiceReenableVoiceRecognition();
|
||||||
|
int PS4_SYSV_ABI Func_6B1CDB955F0EBD65();
|
||||||
|
int PS4_SYSV_ABI Func_CB5E885E225F69F0();
|
||||||
|
|
||||||
|
void RegisterlibSceSystemService(Core::Loader::SymbolsResolver* sym);
|
||||||
|
} // namespace Libraries::SystemService
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,481 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
// reference :
|
||||||
|
// https://github.com/OpenOrbis/OpenOrbis-PS4-Toolchain/blob/master/include/orbis/_types/user.h
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "library_common.h"
|
||||||
|
|
||||||
|
namespace Libraries::UserService {
|
||||||
|
|
||||||
|
// Maximum number of users that can be logged in at once
|
||||||
|
constexpr int ORBIS_USER_SERVICE_MAX_LOGIN_USERS = 4;
|
||||||
|
// Maximum number of users that can be registered in the system
|
||||||
|
constexpr int ORBIS_USER_SERVICE_MAX_REGISTER_USERS = 16;
|
||||||
|
// Maximum user name length
|
||||||
|
constexpr int ORBIS_USER_SERVICE_MAX_USER_NAME_LENGTH = 16;
|
||||||
|
|
||||||
|
constexpr int ORBIS_USER_SERVICE_USER_ID_SYSTEM = 0xFF;
|
||||||
|
constexpr int ORBIS_USER_SERVICE_USER_ID_INVALID = -1;
|
||||||
|
|
||||||
|
using OrbisUserServiceUserId = s32;
|
||||||
|
|
||||||
|
constexpr int ORBIS_KERNEL_PRIO_FIFO_LOWEST = 0x2FF;
|
||||||
|
constexpr int ORBIS_KERNEL_PRIO_FIFO_NORMAL = 0x2BC;
|
||||||
|
constexpr int ORBIS_KERNEL_PRIO_FIFO_HIGHEST = 0x100;
|
||||||
|
|
||||||
|
struct OrbisUserServiceInitializeParams {
|
||||||
|
s32 priority;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct OrbisUserServiceLoginUserIdList {
|
||||||
|
int user_id[ORBIS_USER_SERVICE_MAX_LOGIN_USERS];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct OrbisUserServiceRegisteredUserIdList {
|
||||||
|
OrbisUserServiceUserId userId[ORBIS_USER_SERVICE_MAX_REGISTER_USERS];
|
||||||
|
};
|
||||||
|
|
||||||
|
enum OrbisUserServiceUserColor {
|
||||||
|
ORBIS_USER_SERVICE_USER_COLOR_BLUE = 0,
|
||||||
|
ORBIS_USER_SERVICE_USER_COLOR_RED = 1,
|
||||||
|
ORBIS_USER_SERVICE_USER_COLOR_GREEN = 2,
|
||||||
|
ORBIS_USER_SERVICE_USER_COLOR_PINK = 3,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum OrbisUserServiceEventType {
|
||||||
|
SCE_USER_SERVICE_EVENT_TYPE_LOGIN = 0, // Login event
|
||||||
|
SCE_USER_SERVICE_EVENT_TYPE_LOGOUT = 1, // Logout event
|
||||||
|
};
|
||||||
|
|
||||||
|
struct OrbisUserServiceEvent {
|
||||||
|
OrbisUserServiceEventType event;
|
||||||
|
OrbisUserServiceUserId userId;
|
||||||
|
};
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI sceUserServiceInitializeForShellCore();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceTerminateForShellCore();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceDestroyUser();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetAccessibilityKeyremapData();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetAccessibilityKeyremapEnable();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetAccessibilityPressAndHoldDelay();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetAccessibilityVibration();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetAccessibilityZoom();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetAccessibilityZoomEnabled();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetAccountRemarks();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetAgeVerified();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetAppearOfflineSetting();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetAppSortOrder();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetAutoLoginEnabled();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetCreatedVersion();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetCurrentUserGroupIndex();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetDefaultNewUserGroupName();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetDeletedUserInfo();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetDiscPlayerFlag();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetEvent();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetEventCalendarType();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetEventFilterTeamEvent();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetEventSortEvent();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetEventSortTitle();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetEventUiFlag();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetEventVsh();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetFaceRecognitionDeleteCount();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetFaceRecognitionRegisterCount();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetFileBrowserFilter();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetFileBrowserSortContent();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetFileBrowserSortTitle();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetFileSelectorFilter();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetFileSelectorSortContent();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetFileSelectorSortTitle();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetForegroundUser();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetFriendCustomListLastFocus();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetFriendFlag();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsAccessTokenNiconicoLive();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsAccessTokenTwitch();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsAccessTokenUstream();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsAnonymousUserId();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsBcTags();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsBcTitle();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsBroadcastChannel();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsBroadcastersComment();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsBroadcastersCommentColor();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsBroadcastService();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsBroadcastUiLayout();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsCamCrop();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsCameraBgFilter();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsCameraBrightness();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsCameraChromaKeyLevel();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsCameraContrast();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsCameraDepthLevel();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsCameraEdgeLevel();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsCameraEffect();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsCameraEliminationLevel();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsCameraPosition();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsCameraReflection();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsCameraSize();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsCameraTransparency();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsCommunityId();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsFloatingMessage();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsHintFlag();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsInitSpectating();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsIsCameraHidden();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsIsFacebookEnabled();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsIsMuteEnabled();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsIsRecDisabled();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsIsRecievedMessageHidden();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsIsTwitterEnabled();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsLanguageFilter();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsLfpsSortOrder();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsLiveQuality();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsLiveQuality2();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsLiveQuality3();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsLiveQuality4();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsLiveQuality5();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsMessageFilterLevel();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsTtsFlags();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsTtsPitch();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsTtsSpeed();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetGlsTtsVolume();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetHmuBrightness();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetHmuZoom();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetHoldAudioOutDevice();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetHomeDirectory();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetImeAutoCapitalEnabled();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetImeInitFlag();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetImeInputType();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetImeLastUnit();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetImePointerMode();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetImePredictiveTextEnabled();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetImeRunCount();
|
||||||
|
s32 PS4_SYSV_ABI sceUserServiceGetInitialUser(int* user_id);
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetIPDLeft();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetIPDRight();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetIsFakePlus();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetIsQuickSignup();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetIsRemotePlayAllowed();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetJapaneseInputType();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetKeyboardType();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetKeyRepeatSpeed();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetKeyRepeatStartingTime();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetKratosPrimaryUser();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetLastLoginOrder();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetLightBarBaseBrightness();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetLoginFlag();
|
||||||
|
s32 PS4_SYSV_ABI sceUserServiceGetLoginUserIdList(OrbisUserServiceLoginUserIdList* userIdList);
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetMicLevel();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetMouseHandType();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetMousePointerSpeed();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetNotificationBehavior();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetNotificationSettings();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetNpAccountId();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetNpAccountUpgradeFlag();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetNpAge();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetNpAuthErrorFlag();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetNpCountryCode();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetNpDateOfBirth();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetNpEnv();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetNpLanguageCode();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetNpLanguageCode2();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetNpLoginId();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetNpMAccountId();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetNpNpId();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetNpOfflineAccountAdult();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetNpOfflineAccountId();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetNpOnlineId();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetNpSubAccount();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPadSpeakerVolume();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetParentalBdAge();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetParentalBrowser();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetParentalDvd();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetParentalDvdRegion();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetParentalGame();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetParentalGameAgeLevel();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetParentalMorpheus();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPartyMuteList();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPartyMuteListA();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPartySettingFlags();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPasscode();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPbtcAdditionalTime();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPbtcFlag();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPbtcFridayDuration();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPbtcFridayHoursEnd();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPbtcFridayHoursStart();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPbtcMode();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPbtcMondayDuration();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPbtcMondayHoursEnd();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPbtcMondayHoursStart();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPbtcPlayTime();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPbtcPlayTimeLastUpdated();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPbtcSaturdayDuration();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPbtcSaturdayHoursEnd();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPbtcSaturdayHoursStart();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPbtcSundayDuration();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPbtcSundayHoursEnd();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPbtcSundayHoursStart();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPbtcThursdayDuration();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPbtcThursdayHoursEnd();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPbtcThursdayHoursStart();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPbtcTuesdayDuration();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPbtcTuesdayHoursEnd();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPbtcTuesdayHoursStart();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPbtcTzOffset();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPbtcWednesdayDuration();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPbtcWednesdayHoursEnd();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPbtcWednesdayHoursStart();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPlayTogetherFlags();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetPsnPasswordForDebug();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetRegisteredHomeUserIdList();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetRegisteredUserIdList();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetSaveDataAutoUpload();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetSaveDataSort();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetSaveDataTutorialFlag();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetSecureHomeDirectory();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetShareButtonAssign();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetShareDailymotionAccessToken();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetShareDailymotionRefreshToken();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetSharePlayFlags();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetSharePlayFramerateHost();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetSharePlayResolutionHost();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetShareStatus();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetShareStatus2();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetSystemLoggerHashedAccountId();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetSystemLoggerHashedAccountIdClockType();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetSystemLoggerHashedAccountIdParam();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetSystemLoggerHashedAccountIdTtl();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetTeamShowAboutTeam();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetThemeBgImageDimmer();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetThemeBgImageWaveColor();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetThemeBgImageZoom();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetThemeEntitlementId();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetThemeHomeShareOwner();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetThemeTextShadow();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetThemeWaveColor();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetTopMenuLimitItem();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetTopMenuNotificationFlag();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetTopMenuTutorialFlag();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetTraditionalChineseInputType();
|
||||||
|
s32 PS4_SYSV_ABI sceUserServiceGetUserColor(int user_id, int* color);
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetUserGroupName();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetUserGroupNameList();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetUserGroupNum();
|
||||||
|
s32 PS4_SYSV_ABI sceUserServiceGetUserName(int user_id, char* user_name, std::size_t size);
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetUserStatus();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetVibrationEnabled();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetVoiceRecognitionLastUsedOsk();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetVoiceRecognitionTutorialState();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetVolumeForController();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetVolumeForGenericUSB();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetVolumeForMorpheusSidetone();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceGetVolumeForSidetone();
|
||||||
|
s32 PS4_SYSV_ABI sceUserServiceInitialize(const OrbisUserServiceInitializeParams* initParams);
|
||||||
|
int PS4_SYSV_ABI sceUserServiceInitialize2();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceIsGuestUser();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceIsKratosPrimaryUser();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceIsKratosUser();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceIsLoggedIn();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceIsLoggedInWithoutLock();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceIsSharePlayClientUser();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceIsUserStorageAccountBound();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceLogin();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceLogout();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceRegisterEventCallback();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetAccessibilityKeyremapData();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetAccessibilityKeyremapEnable();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetAccessibilityZoom();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetAccountRemarks();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetAgeVerified();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetAppearOfflineSetting();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetAppSortOrder();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetAutoLoginEnabled();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetCreatedVersion();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetDiscPlayerFlag();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetEventCalendarType();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetEventFilterTeamEvent();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetEventSortEvent();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetEventSortTitle();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetEventUiFlag();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetFaceRecognitionDeleteCount();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetFaceRecognitionRegisterCount();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetFileBrowserFilter();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetFileBrowserSortContent();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetFileBrowserSortTitle();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetFileSelectorFilter();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetFileSelectorSortContent();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetFileSelectorSortTitle();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetForegroundUser();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetFriendCustomListLastFocus();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetFriendFlag();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsAccessTokenNiconicoLive();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsAccessTokenTwitch();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsAccessTokenUstream();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsAnonymousUserId();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsBcTags();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsBcTitle();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsBroadcastChannel();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsBroadcastersComment();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsBroadcastersCommentColor();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsBroadcastService();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsBroadcastUiLayout();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsCamCrop();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsCameraBgFilter();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsCameraBrightness();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsCameraChromaKeyLevel();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsCameraContrast();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsCameraDepthLevel();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsCameraEdgeLevel();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsCameraEffect();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsCameraEliminationLevel();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsCameraPosition();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsCameraReflection();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsCameraSize();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsCameraTransparency();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsCommunityId();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsFloatingMessage();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsHintFlag();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsInitSpectating();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsIsCameraHidden();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsIsFacebookEnabled();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsIsMuteEnabled();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsIsRecDisabled();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsIsRecievedMessageHidden();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsIsTwitterEnabled();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsLanguageFilter();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsLfpsSortOrder();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsLiveQuality();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsLiveQuality2();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsLiveQuality3();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsLiveQuality4();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsLiveQuality5();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsMessageFilterLevel();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsTtsFlags();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsTtsPitch();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsTtsSpeed();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetGlsTtsVolume();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetHmuBrightness();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetHmuZoom();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetHoldAudioOutDevice();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetImeAutoCapitalEnabled();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetImeInitFlag();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetImeInputType();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetImeLastUnit();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetImePointerMode();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetImePredictiveTextEnabled();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetImeRunCount();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetIPDLeft();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetIPDRight();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetIsFakePlus();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetIsQuickSignup();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetIsRemotePlayAllowed();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetJapaneseInputType();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetKeyboardType();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetKeyRepeatSpeed();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetKeyRepeatStartingTime();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetLightBarBaseBrightness();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetLoginFlag();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetMicLevel();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetMouseHandType();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetMousePointerSpeed();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetNotificationBehavior();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetNotificationSettings();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetNpAccountUpgradeFlag();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetNpAge();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetNpAuthErrorFlag();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetNpCountryCode();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetNpDateOfBirth();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetNpEnv();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetNpLanguageCode();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetNpLanguageCode2();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetNpLoginId();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetNpMAccountId();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetNpNpId();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetNpOfflineAccountAdult();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetNpOnlineId();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetNpSubAccount();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPadSpeakerVolume();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetParentalBdAge();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetParentalBrowser();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetParentalDvd();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetParentalDvdRegion();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetParentalGame();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetParentalGameAgeLevel();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetParentalMorpheus();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPartyMuteList();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPartyMuteListA();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPartySettingFlags();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPasscode();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPbtcAdditionalTime();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPbtcFlag();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPbtcFridayDuration();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPbtcFridayHoursEnd();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPbtcFridayHoursStart();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPbtcMode();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPbtcMondayDuration();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPbtcMondayHoursEnd();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPbtcMondayHoursStart();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPbtcPlayTime();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPbtcPlayTimeLastUpdated();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPbtcSaturdayDuration();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPbtcSaturdayHoursEnd();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPbtcSaturdayHoursStart();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPbtcSundayDuration();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPbtcSundayHoursEnd();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPbtcSundayHoursStart();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPbtcThursdayDuration();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPbtcThursdayHoursEnd();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPbtcThursdayHoursStart();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPbtcTuesdayDuration();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPbtcTuesdayHoursEnd();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPbtcTuesdayHoursStart();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPbtcTzOffset();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPbtcWednesdayDuration();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPbtcWednesdayHoursEnd();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPbtcWednesdayHoursStart();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPlayTogetherFlags();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetPsnPasswordForDebug();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetSaveDataAutoUpload();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetSaveDataSort();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetSaveDataTutorialFlag();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetShareButtonAssign();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetShareDailymotionAccessToken();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetShareDailymotionRefreshToken();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetSharePlayFlags();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetSharePlayFramerateHost();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetSharePlayResolutionHost();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetShareStatus();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetShareStatus2();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetSystemLoggerHashedAccountId();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetSystemLoggerHashedAccountIdClockType();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetSystemLoggerHashedAccountIdParam();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetSystemLoggerHashedAccountIdTtl();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetTeamShowAboutTeam();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetThemeBgImageDimmer();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetThemeBgImageWaveColor();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetThemeBgImageZoom();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetThemeEntitlementId();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetThemeHomeShareOwner();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetThemeTextShadow();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetThemeWaveColor();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetTopMenuLimitItem();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetTopMenuNotificationFlag();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetTopMenuTutorialFlag();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetTraditionalChineseInputType();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetUserGroupIndex();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetUserGroupName();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetUserName();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetUserStatus();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetVibrationEnabled();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetVoiceRecognitionLastUsedOsk();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetVoiceRecognitionTutorialState();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetVolumeForController();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetVolumeForGenericUSB();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetVolumeForMorpheusSidetone();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceSetVolumeForSidetone();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceTerminate();
|
||||||
|
int PS4_SYSV_ABI sceUserServiceUnregisterEventCallback();
|
||||||
|
int PS4_SYSV_ABI Func_8AC6DC4168D5FEA5();
|
||||||
|
int PS4_SYSV_ABI Func_A6BDC9DFDAFD02B4();
|
||||||
|
int PS4_SYSV_ABI Func_BB9491DFE6B4953C();
|
||||||
|
int PS4_SYSV_ABI Func_D2B814603E7B4477();
|
||||||
|
|
||||||
|
void RegisterlibSceUserService(Core::Loader::SymbolsResolver* sym);
|
||||||
|
} // namespace Libraries::UserService
|
|
@ -2,29 +2,31 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include <Zydis/Zydis.h>
|
#include <Zydis/Zydis.h>
|
||||||
#include "common/logging/log.h"
|
#include <fmt/core.h>
|
||||||
|
#include "common/log.h"
|
||||||
#include "common/string_util.h"
|
#include "common/string_util.h"
|
||||||
#include "core/aerolib/aerolib.h"
|
#include "core/aerolib/aerolib.h"
|
||||||
#include "core/aerolib/stubs.h"
|
#include "core/aerolib/stubs.h"
|
||||||
#include "core/hle/libraries/libkernel/thread_management.h"
|
#include "core/hle/libraries/libkernel/thread_management.h"
|
||||||
#include "core/linker.h"
|
#include "core/linker.h"
|
||||||
#include "core/tls.h"
|
|
||||||
#include "core/virtual_memory.h"
|
#include "core/virtual_memory.h"
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
static constexpr u64 LoadAddress = SYSTEM_RESERVED + CODE_BASE_OFFSET;
|
constexpr bool debug_loader = true;
|
||||||
|
|
||||||
static u64 GetAlignedSize(const elf_program_header& phdr) {
|
static u64 g_load_addr = SYSTEM_RESERVED + CODE_BASE_OFFSET;
|
||||||
|
|
||||||
|
static u64 get_aligned_size(const elf_program_header& phdr) {
|
||||||
return (phdr.p_align != 0 ? (phdr.p_memsz + (phdr.p_align - 1)) & ~(phdr.p_align - 1)
|
return (phdr.p_align != 0 ? (phdr.p_memsz + (phdr.p_align - 1)) & ~(phdr.p_align - 1)
|
||||||
: phdr.p_memsz);
|
: phdr.p_memsz);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u64 CalculateBaseSize(const elf_header& ehdr, std::span<const elf_program_header> phdr) {
|
static u64 calculate_base_size(const elf_header& ehdr, std::span<const elf_program_header> phdr) {
|
||||||
u64 base_size = 0;
|
u64 base_size = 0;
|
||||||
for (u16 i = 0; i < ehdr.e_phnum; i++) {
|
for (u16 i = 0; i < ehdr.e_phnum; i++) {
|
||||||
if (phdr[i].p_memsz != 0 && (phdr[i].p_type == PT_LOAD || phdr[i].p_type == PT_SCE_RELRO)) {
|
if (phdr[i].p_memsz != 0 && (phdr[i].p_type == PT_LOAD || phdr[i].p_type == PT_SCE_RELRO)) {
|
||||||
u64 last_addr = phdr[i].p_vaddr + GetAlignedSize(phdr[i]);
|
u64 last_addr = phdr[i].p_vaddr + get_aligned_size(phdr[i]);
|
||||||
if (last_addr > base_size) {
|
if (last_addr > base_size) {
|
||||||
base_size = last_addr;
|
base_size = last_addr;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +35,7 @@ static u64 CalculateBaseSize(const elf_header& ehdr, std::span<const elf_program
|
||||||
return base_size;
|
return base_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string EncodeId(u64 nVal) {
|
static std::string encodeId(u64 nVal) {
|
||||||
std::string enc;
|
std::string enc;
|
||||||
const char pCodes[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-";
|
const char pCodes[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-";
|
||||||
if (nVal < 0x40u) {
|
if (nVal < 0x40u) {
|
||||||
|
@ -55,37 +57,97 @@ Linker::Linker() = default;
|
||||||
|
|
||||||
Linker::~Linker() = default;
|
Linker::~Linker() = default;
|
||||||
|
|
||||||
Module* Linker::LoadModule(const std::filesystem::path& elf_name) {
|
Module* Linker::LoadModule(const std::string& elf_name) {
|
||||||
std::scoped_lock lock{m_mutex};
|
std::scoped_lock lock{m_mutex};
|
||||||
|
|
||||||
if (!std::filesystem::exists(elf_name)) {
|
|
||||||
LOG_ERROR(Core_Linker, "Provided module {} does not exist", elf_name.string());
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto& m = m_modules.emplace_back();
|
auto& m = m_modules.emplace_back();
|
||||||
m = std::make_unique<Module>();
|
m.linker = this;
|
||||||
m->elf.Open(elf_name);
|
m.elf.Open(elf_name);
|
||||||
|
|
||||||
if (m->elf.IsElfFile()) {
|
if (m.elf.isElfFile()) {
|
||||||
LoadModuleToMemory(m.get());
|
LoadModuleToMemory(&m);
|
||||||
LoadDynamicInfo(m.get());
|
LoadDynamicInfo(&m);
|
||||||
LoadSymbols(m.get());
|
LoadSymbols(&m);
|
||||||
Relocate(m.get());
|
Relocate(&m);
|
||||||
} else {
|
} else {
|
||||||
m_modules.pop_back();
|
m_modules.pop_back();
|
||||||
return nullptr; // It is not a valid elf file //TODO check it why!
|
return nullptr; // It is not a valid elf file //TODO check it why!
|
||||||
}
|
}
|
||||||
|
|
||||||
return m.get();
|
return &m;
|
||||||
}
|
}
|
||||||
|
|
||||||
Module* Linker::FindModule(u32 id) {
|
Module* Linker::FindModule(/*u32 id*/) {
|
||||||
// TODO atm we only have 1 module so we don't need to iterate on vector
|
// TODO atm we only have 1 module so we don't need to iterate on vector
|
||||||
if (m_modules.empty()) [[unlikely]] {
|
if (m_modules.empty()) [[unlikely]] {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return m_modules[0].get();
|
return &m_modules[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
struct TLSPattern {
|
||||||
|
uint8_t pattern[5];
|
||||||
|
uint8_t pattern_size;
|
||||||
|
uint8_t imm_size;
|
||||||
|
uint8_t target_reg;
|
||||||
|
};
|
||||||
|
|
||||||
|
constexpr TLSPattern tls_patterns[] = {
|
||||||
|
{{0x64, 0x48, 0xA1},
|
||||||
|
3,
|
||||||
|
8,
|
||||||
|
0}, // 64 48 A1 | 00 00 00 00 00 00 00 00 # mov rax, qword ptr fs:[64b imm]
|
||||||
|
|
||||||
|
{{0x64, 0x48, 0x8B, 0x4, 0x25},
|
||||||
|
5,
|
||||||
|
4,
|
||||||
|
0}, // 64 48 8B 04 25 | 00 00 00 00 # mov rax,qword ptr fs:[0]
|
||||||
|
{{0x64, 0x48, 0x8B, 0xC, 0x25}, 5, 4, 1}, // rcx
|
||||||
|
{{0x64, 0x48, 0x8B, 0x14, 0x25}, 5, 4, 2}, // rdx
|
||||||
|
{{0x64, 0x48, 0x8B, 0x1C, 0x25}, 5, 4, 3}, // rbx
|
||||||
|
{{0x64, 0x48, 0x8B, 0x24, 0x25}, 5, 4, 4}, // rsp
|
||||||
|
{{0x64, 0x48, 0x8B, 0x2C, 0x25}, 5, 4, 5}, // rbp
|
||||||
|
{{0x64, 0x48, 0x8B, 0x34, 0x25}, 5, 4, 6}, // rsi
|
||||||
|
{{0x64, 0x48, 0x8B, 0x3C, 0x25}, 5, 4, 7}, // rdi
|
||||||
|
{{0x64, 0x4C, 0x8B, 0x4, 0x25}, 5, 4, 8}, // r8
|
||||||
|
{{0x64, 0x4C, 0x8B, 0xC, 0x25}, 5, 4, 9}, // r9
|
||||||
|
{{0x64, 0x4C, 0x8B, 0x14, 0x25}, 5, 4, 10}, // r10
|
||||||
|
{{0x64, 0x4C, 0x8B, 0x1C, 0x25}, 5, 4, 11}, // r11
|
||||||
|
{{0x64, 0x4C, 0x8B, 0x24, 0x25}, 5, 4, 12}, // r12
|
||||||
|
{{0x64, 0x4C, 0x8B, 0x2C, 0x25}, 5, 4, 13}, // r13
|
||||||
|
{{0x64, 0x4C, 0x8B, 0x34, 0x25}, 5, 4, 14}, // r14
|
||||||
|
{{0x64, 0x4C, 0x8B, 0x3C, 0x25}, 5, 4, 15}, // r15
|
||||||
|
};
|
||||||
|
|
||||||
|
void PatchTLS(u64 segment_addr, u64 segment_size) {
|
||||||
|
uint8_t* code = (uint8_t*)segment_addr;
|
||||||
|
auto remaining_size = segment_size;
|
||||||
|
|
||||||
|
while (remaining_size) {
|
||||||
|
for (auto& tls_pattern : tls_patterns) {
|
||||||
|
auto total_size = tls_pattern.pattern_size + tls_pattern.imm_size;
|
||||||
|
if (remaining_size >= total_size) {
|
||||||
|
if (memcmp(code, tls_pattern.pattern, tls_pattern.pattern_size) == 0) {
|
||||||
|
if (tls_pattern.imm_size == 4)
|
||||||
|
printf("PATTERN32 FOUND @ %p, reg: %d offset: %X\n", code,
|
||||||
|
tls_pattern.target_reg,
|
||||||
|
*(uint32_t*)(code + tls_pattern.pattern_size));
|
||||||
|
else
|
||||||
|
printf("PATTERN64 FOUND @ %p, reg: %d offset: %lX\n", code,
|
||||||
|
tls_pattern.target_reg,
|
||||||
|
*(uint64_t*)(code + tls_pattern.pattern_size));
|
||||||
|
code[0] = 0xcd;
|
||||||
|
code[1] = 0x80 + tls_pattern.target_reg;
|
||||||
|
code[2] = tls_pattern.pattern_size | (tls_pattern.imm_size << 4);
|
||||||
|
code += total_size - 1;
|
||||||
|
remaining_size -= total_size - 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
code++;
|
||||||
|
remaining_size--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Linker::LoadModuleToMemory(Module* m) {
|
void Linker::LoadModuleToMemory(Module* m) {
|
||||||
|
@ -93,18 +155,18 @@ void Linker::LoadModuleToMemory(Module* m) {
|
||||||
const auto elf_header = m->elf.GetElfHeader();
|
const auto elf_header = m->elf.GetElfHeader();
|
||||||
const auto elf_pheader = m->elf.GetProgramHeader();
|
const auto elf_pheader = m->elf.GetProgramHeader();
|
||||||
|
|
||||||
u64 base_size = CalculateBaseSize(elf_header, elf_pheader);
|
u64 base_size = calculate_base_size(elf_header, elf_pheader);
|
||||||
m->aligned_base_size = (base_size & ~(static_cast<u64>(0x1000) - 1)) +
|
m->aligned_base_size = (base_size & ~(static_cast<u64>(0x1000) - 1)) +
|
||||||
0x1000; // align base size to 0x1000 block size (TODO is that the default
|
0x1000; // align base size to 0x1000 block size (TODO is that the default
|
||||||
// block size or it can be changed?
|
// block size or it can be changed?
|
||||||
|
|
||||||
m->base_virtual_addr = VirtualMemory::memory_alloc(LoadAddress, m->aligned_base_size,
|
m->base_virtual_addr = VirtualMemory::memory_alloc(g_load_addr, m->aligned_base_size,
|
||||||
VirtualMemory::MemoryMode::ExecuteReadWrite);
|
VirtualMemory::MemoryMode::ExecuteReadWrite);
|
||||||
|
|
||||||
LOG_INFO(Core_Linker, "====Load Module to Memory ========");
|
LOG_INFO_IF(debug_loader, "====Load Module to Memory ========\n");
|
||||||
LOG_INFO(Core_Linker, "base_virtual_addr ......: {:#018x}", m->base_virtual_addr);
|
LOG_INFO_IF(debug_loader, "base_virtual_addr ......: {:#018x}\n", m->base_virtual_addr);
|
||||||
LOG_INFO(Core_Linker, "base_size ..............: {:#018x}", base_size);
|
LOG_INFO_IF(debug_loader, "base_size ..............: {:#018x}\n", base_size);
|
||||||
LOG_INFO(Core_Linker, "aligned_base_size ......: {:#018x}", m->aligned_base_size);
|
LOG_INFO_IF(debug_loader, "aligned_base_size ......: {:#018x}\n", m->aligned_base_size);
|
||||||
|
|
||||||
for (u16 i = 0; i < elf_header.e_phnum; i++) {
|
for (u16 i = 0; i < elf_header.e_phnum; i++) {
|
||||||
switch (elf_pheader[i].p_type) {
|
switch (elf_pheader[i].p_type) {
|
||||||
|
@ -113,14 +175,14 @@ void Linker::LoadModuleToMemory(Module* m) {
|
||||||
if (elf_pheader[i].p_memsz != 0) {
|
if (elf_pheader[i].p_memsz != 0) {
|
||||||
u64 segment_addr = elf_pheader[i].p_vaddr + m->base_virtual_addr;
|
u64 segment_addr = elf_pheader[i].p_vaddr + m->base_virtual_addr;
|
||||||
u64 segment_file_size = elf_pheader[i].p_filesz;
|
u64 segment_file_size = elf_pheader[i].p_filesz;
|
||||||
u64 segment_memory_size = GetAlignedSize(elf_pheader[i]);
|
u64 segment_memory_size = get_aligned_size(elf_pheader[i]);
|
||||||
auto segment_mode = m->elf.ElfPheaderFlagsStr(elf_pheader[i].p_flags);
|
auto segment_mode = m->elf.ElfPheaderFlagsStr(elf_pheader[i].p_flags);
|
||||||
LOG_INFO(Core_Linker, "program header = [{}] type = {}", i,
|
LOG_INFO_IF(debug_loader, "program header = [{}] type = {}\n", i,
|
||||||
m->elf.ElfPheaderTypeStr(elf_pheader[i].p_type));
|
m->elf.ElfPheaderTypeStr(elf_pheader[i].p_type));
|
||||||
LOG_INFO(Core_Linker, "segment_addr ..........: {:#018x}", segment_addr);
|
LOG_INFO_IF(debug_loader, "segment_addr ..........: {:#018x}\n", segment_addr);
|
||||||
LOG_INFO(Core_Linker, "segment_file_size .....: {}", segment_file_size);
|
LOG_INFO_IF(debug_loader, "segment_file_size .....: {}\n", segment_file_size);
|
||||||
LOG_INFO(Core_Linker, "segment_memory_size ...: {}", segment_memory_size);
|
LOG_INFO_IF(debug_loader, "segment_memory_size ...: {}\n", segment_memory_size);
|
||||||
LOG_INFO(Core_Linker, "segment_mode ..........: {}", segment_mode);
|
LOG_INFO_IF(debug_loader, "segment_mode ..........: {}\n", segment_mode);
|
||||||
|
|
||||||
m->elf.LoadSegment(segment_addr, elf_pheader[i].p_offset, segment_file_size);
|
m->elf.LoadSegment(segment_addr, elf_pheader[i].p_offset, segment_file_size);
|
||||||
|
|
||||||
|
@ -128,7 +190,7 @@ void Linker::LoadModuleToMemory(Module* m) {
|
||||||
PatchTLS(segment_addr, segment_file_size);
|
PatchTLS(segment_addr, segment_file_size);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR(Core_Linker, "p_memsz==0 in type {}",
|
LOG_ERROR_IF(debug_loader, "p_memsz==0 in type {}\n",
|
||||||
m->elf.ElfPheaderTypeStr(elf_pheader[i].p_type));
|
m->elf.ElfPheaderTypeStr(elf_pheader[i].p_type));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -138,7 +200,7 @@ void Linker::LoadModuleToMemory(Module* m) {
|
||||||
m->elf.LoadSegment(reinterpret_cast<u64>(m->m_dynamic.data()),
|
m->elf.LoadSegment(reinterpret_cast<u64>(m->m_dynamic.data()),
|
||||||
elf_pheader[i].p_offset, elf_pheader[i].p_filesz);
|
elf_pheader[i].p_offset, elf_pheader[i].p_filesz);
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR(Core_Linker, "p_filesz==0 in type {}",
|
LOG_ERROR_IF(debug_loader, "p_filesz==0 in type {}\n",
|
||||||
m->elf.ElfPheaderTypeStr(elf_pheader[i].p_type));
|
m->elf.ElfPheaderTypeStr(elf_pheader[i].p_type));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -148,22 +210,22 @@ void Linker::LoadModuleToMemory(Module* m) {
|
||||||
m->elf.LoadSegment(reinterpret_cast<u64>(m->m_dynamic_data.data()),
|
m->elf.LoadSegment(reinterpret_cast<u64>(m->m_dynamic_data.data()),
|
||||||
elf_pheader[i].p_offset, elf_pheader[i].p_filesz);
|
elf_pheader[i].p_offset, elf_pheader[i].p_filesz);
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR(Core_Linker, "p_filesz==0 in type {}",
|
LOG_ERROR_IF(debug_loader, "p_filesz==0 in type {}\n",
|
||||||
m->elf.ElfPheaderTypeStr(elf_pheader[i].p_type));
|
m->elf.ElfPheaderTypeStr(elf_pheader[i].p_type));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PT_TLS:
|
case PT_TLS:
|
||||||
m->tls.image_virtual_addr = elf_pheader[i].p_vaddr + m->base_virtual_addr;
|
m->tls.image_virtual_addr = elf_pheader[i].p_vaddr + m->base_virtual_addr;
|
||||||
m->tls.image_size = GetAlignedSize(elf_pheader[i]);
|
m->tls.image_size = get_aligned_size(elf_pheader[i]);
|
||||||
LOG_INFO(Core_Linker, "tls virtual address ={:#x}", m->tls.image_virtual_addr);
|
LOG_INFO_IF(debug_loader, "tls virtual address ={:#x}\n", m->tls.image_virtual_addr);
|
||||||
LOG_INFO(Core_Linker, "tls image size ={}", m->tls.image_size);
|
LOG_INFO_IF(debug_loader, "tls image size ={}\n", m->tls.image_size);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG_ERROR(Core_Linker, "Unimplemented type {}",
|
LOG_ERROR_IF(debug_loader, "Unimplemented type {}\n",
|
||||||
m->elf.ElfPheaderTypeStr(elf_pheader[i].p_type));
|
m->elf.ElfPheaderTypeStr(elf_pheader[i].p_type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG_INFO(Core_Linker, "program entry addr ..........: {:#018x}",
|
LOG_INFO_IF(debug_loader, "program entry addr ..........: {:#018x}\n",
|
||||||
m->elf.GetElfEntry() + m->base_virtual_addr);
|
m->elf.GetElfEntry() + m->base_virtual_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,7 +273,7 @@ void Linker::LoadDynamicInfo(Module* m) {
|
||||||
case DT_SCE_PLTREL: // The type of relocations in the relocation table. Should be DT_RELA
|
case DT_SCE_PLTREL: // The type of relocations in the relocation table. Should be DT_RELA
|
||||||
m->dynamic_info.jmp_relocation_type = dyn->d_un.d_val;
|
m->dynamic_info.jmp_relocation_type = dyn->d_un.d_val;
|
||||||
if (m->dynamic_info.jmp_relocation_type != DT_RELA) {
|
if (m->dynamic_info.jmp_relocation_type != DT_RELA) {
|
||||||
LOG_WARNING(Core_Linker, "DT_SCE_PLTREL is NOT DT_RELA should check!");
|
LOG_WARN_IF(debug_loader, "DT_SCE_PLTREL is NOT DT_RELA should check!");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DT_SCE_RELA: // Offset of the relocation table.
|
case DT_SCE_RELA: // Offset of the relocation table.
|
||||||
|
@ -226,7 +288,7 @@ void Linker::LoadDynamicInfo(Module* m) {
|
||||||
if (m->dynamic_info.relocation_table_entries_size !=
|
if (m->dynamic_info.relocation_table_entries_size !=
|
||||||
0x18) // this value should always be 0x18
|
0x18) // this value should always be 0x18
|
||||||
{
|
{
|
||||||
LOG_WARNING(Core_Linker, "DT_SCE_RELAENT is NOT 0x18 should check!");
|
LOG_WARN_IF(debug_loader, "DT_SCE_RELAENT is NOT 0x18 should check!");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DT_INIT_ARRAY: // Address of the array of pointers to initialization functions
|
case DT_INIT_ARRAY: // Address of the array of pointers to initialization functions
|
||||||
|
@ -252,7 +314,7 @@ void Linker::LoadDynamicInfo(Module* m) {
|
||||||
if (m->dynamic_info.symbol_table_entries_size !=
|
if (m->dynamic_info.symbol_table_entries_size !=
|
||||||
0x18) // this value should always be 0x18
|
0x18) // this value should always be 0x18
|
||||||
{
|
{
|
||||||
LOG_WARNING(Core_Linker, "DT_SCE_SYMENT is NOT 0x18 should check!");
|
LOG_WARN_IF(debug_loader, "DT_SCE_SYMENT is NOT 0x18 should check!");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DT_DEBUG:
|
case DT_DEBUG:
|
||||||
|
@ -265,7 +327,7 @@ void Linker::LoadDynamicInfo(Module* m) {
|
||||||
m->dynamic_info.flags = dyn->d_un.d_val;
|
m->dynamic_info.flags = dyn->d_un.d_val;
|
||||||
if (m->dynamic_info.flags != 0x04) // this value should always be DF_TEXTREL (0x04)
|
if (m->dynamic_info.flags != 0x04) // this value should always be DF_TEXTREL (0x04)
|
||||||
{
|
{
|
||||||
LOG_WARNING(Core_Linker, "DT_FLAGS is NOT 0x04 should check!");
|
LOG_WARN_IF(debug_loader, "DT_FLAGS is NOT 0x04 should check!");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DT_NEEDED: // Offset of the library string in the string table to be linked in.
|
case DT_NEEDED: // Offset of the library string in the string table to be linked in.
|
||||||
|
@ -274,21 +336,21 @@ void Linker::LoadDynamicInfo(Module* m) {
|
||||||
{
|
{
|
||||||
m->dynamic_info.needed.push_back(m->dynamic_info.str_table + dyn->d_un.d_val);
|
m->dynamic_info.needed.push_back(m->dynamic_info.str_table + dyn->d_un.d_val);
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR(Core_Linker, "DT_NEEDED str table is not loaded should check!");
|
LOG_ERROR_IF(debug_loader, "DT_NEEDED str table is not loaded should check!");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DT_SCE_NEEDED_MODULE: {
|
case DT_SCE_NEEDED_MODULE: {
|
||||||
ModuleInfo info{};
|
ModuleInfo info{};
|
||||||
info.value = dyn->d_un.d_val;
|
info.value = dyn->d_un.d_val;
|
||||||
info.name = m->dynamic_info.str_table + info.name_offset;
|
info.name = m->dynamic_info.str_table + info.name_offset;
|
||||||
info.enc_id = EncodeId(info.id);
|
info.enc_id = encodeId(info.id);
|
||||||
m->dynamic_info.import_modules.push_back(info);
|
m->dynamic_info.import_modules.push_back(info);
|
||||||
} break;
|
} break;
|
||||||
case DT_SCE_IMPORT_LIB: {
|
case DT_SCE_IMPORT_LIB: {
|
||||||
LibraryInfo info{};
|
LibraryInfo info{};
|
||||||
info.value = dyn->d_un.d_val;
|
info.value = dyn->d_un.d_val;
|
||||||
info.name = m->dynamic_info.str_table + info.name_offset;
|
info.name = m->dynamic_info.str_table + info.name_offset;
|
||||||
info.enc_id = EncodeId(info.id);
|
info.enc_id = encodeId(info.id);
|
||||||
m->dynamic_info.import_libs.push_back(info);
|
m->dynamic_info.import_libs.push_back(info);
|
||||||
} break;
|
} break;
|
||||||
case DT_SCE_FINGERPRINT:
|
case DT_SCE_FINGERPRINT:
|
||||||
|
@ -296,13 +358,15 @@ void Linker::LoadDynamicInfo(Module* m) {
|
||||||
// the given app. How exactly this is generated isn't known, however it is not necessary
|
// the given app. How exactly this is generated isn't known, however it is not necessary
|
||||||
// to have a valid fingerprint. While an invalid fingerprint will cause a warning to be
|
// to have a valid fingerprint. While an invalid fingerprint will cause a warning to be
|
||||||
// printed to the kernel log, the ELF will still load and run.
|
// printed to the kernel log, the ELF will still load and run.
|
||||||
LOG_INFO(Core_Linker, "unsupported DT_SCE_FINGERPRINT value = ..........: {:#018x}",
|
LOG_INFO_IF(debug_loader,
|
||||||
|
"unsupported DT_SCE_FINGERPRINT value = ..........: {:#018x}\n",
|
||||||
dyn->d_un.d_val);
|
dyn->d_un.d_val);
|
||||||
break;
|
break;
|
||||||
case DT_SCE_IMPORT_LIB_ATTR:
|
case DT_SCE_IMPORT_LIB_ATTR:
|
||||||
// The upper 32-bits should contain the module index multiplied by 0x10000. The lower
|
// The upper 32-bits should contain the module index multiplied by 0x10000. The lower
|
||||||
// 32-bits should be a constant 0x9.
|
// 32-bits should be a constant 0x9.
|
||||||
LOG_INFO(Core_Linker, "unsupported DT_SCE_IMPORT_LIB_ATTR value = ......: {:#018x}",
|
LOG_INFO_IF(debug_loader,
|
||||||
|
"unsupported DT_SCE_IMPORT_LIB_ATTR value = ......: {:#018x}\n",
|
||||||
dyn->d_un.d_val);
|
dyn->d_un.d_val);
|
||||||
break;
|
break;
|
||||||
case DT_SCE_ORIGINAL_FILENAME:
|
case DT_SCE_ORIGINAL_FILENAME:
|
||||||
|
@ -313,23 +377,24 @@ void Linker::LoadDynamicInfo(Module* m) {
|
||||||
ModuleInfo info{};
|
ModuleInfo info{};
|
||||||
info.value = dyn->d_un.d_val;
|
info.value = dyn->d_un.d_val;
|
||||||
info.name = m->dynamic_info.str_table + info.name_offset;
|
info.name = m->dynamic_info.str_table + info.name_offset;
|
||||||
info.enc_id = EncodeId(info.id);
|
info.enc_id = encodeId(info.id);
|
||||||
m->dynamic_info.export_modules.push_back(info);
|
m->dynamic_info.export_modules.push_back(info);
|
||||||
} break;
|
} break;
|
||||||
case DT_SCE_MODULE_ATTR:
|
case DT_SCE_MODULE_ATTR:
|
||||||
// TODO?
|
// TODO?
|
||||||
LOG_INFO(Core_Linker, "unsupported DT_SCE_MODULE_ATTR value = ..........: {:#018x}",
|
LOG_INFO_IF(debug_loader,
|
||||||
|
"unsupported DT_SCE_MODULE_ATTR value = ..........: {:#018x}\n",
|
||||||
dyn->d_un.d_val);
|
dyn->d_un.d_val);
|
||||||
break;
|
break;
|
||||||
case DT_SCE_EXPORT_LIB: {
|
case DT_SCE_EXPORT_LIB: {
|
||||||
LibraryInfo info{};
|
LibraryInfo info{};
|
||||||
info.value = dyn->d_un.d_val;
|
info.value = dyn->d_un.d_val;
|
||||||
info.name = m->dynamic_info.str_table + info.name_offset;
|
info.name = m->dynamic_info.str_table + info.name_offset;
|
||||||
info.enc_id = EncodeId(info.id);
|
info.enc_id = encodeId(info.id);
|
||||||
m->dynamic_info.export_libs.push_back(info);
|
m->dynamic_info.export_libs.push_back(info);
|
||||||
} break;
|
} break;
|
||||||
default:
|
default:
|
||||||
LOG_INFO(Core_Linker, "unsupported dynamic tag ..........: {:#018x}", dyn->d_tag);
|
LOG_INFO_IF(debug_loader, "unsupported dynamic tag ..........: {:#018x}\n", dyn->d_tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -377,7 +442,7 @@ const LibraryInfo* Linker::FindLibrary(const Module& m, const std::string& id) {
|
||||||
void Linker::LoadSymbols(Module* m) {
|
void Linker::LoadSymbols(Module* m) {
|
||||||
if (m->dynamic_info.symbol_table == nullptr || m->dynamic_info.str_table == nullptr ||
|
if (m->dynamic_info.symbol_table == nullptr || m->dynamic_info.str_table == nullptr ||
|
||||||
m->dynamic_info.symbol_table_total_size == 0) {
|
m->dynamic_info.symbol_table_total_size == 0) {
|
||||||
LOG_INFO(Core_Linker, "Symbol table not found!");
|
LOG_INFO_IF(debug_loader, "Symbol table not found!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,7 +466,7 @@ void Linker::LoadSymbols(Module* m) {
|
||||||
case STB_WEAK:
|
case STB_WEAK:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG_INFO(Core_Linker, "Unsupported bind {} for name symbol {}", bind,
|
LOG_INFO_IF(debug_loader, "Unsupported bind {} for name symbol {} \n", bind,
|
||||||
ids.at(0));
|
ids.at(0));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -410,7 +475,7 @@ void Linker::LoadSymbols(Module* m) {
|
||||||
case STT_FUN:
|
case STT_FUN:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG_INFO(Core_Linker, "Unsupported type {} for name symbol {}", type,
|
LOG_INFO_IF(debug_loader, "Unsupported type {} for name symbol {} \n", type,
|
||||||
ids.at(0));
|
ids.at(0));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -418,7 +483,7 @@ void Linker::LoadSymbols(Module* m) {
|
||||||
case STV_DEFAULT:
|
case STV_DEFAULT:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG_INFO(Core_Linker, "Unsupported visibility {} for name symbol {}",
|
LOG_INFO_IF(debug_loader, "Unsupported visibility {} for name symbol {} \n",
|
||||||
visibility, ids.at(0));
|
visibility, ids.at(0));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -450,17 +515,15 @@ void Linker::LoadSymbols(Module* m) {
|
||||||
m->import_sym.AddSymbol(sym_r, 0);
|
m->import_sym.AddSymbol(sym_r, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INFO(Core_Linker,
|
LOG_INFO_IF(
|
||||||
"name = {}, function = {}, library = {}, module = {}, bind = {}, type = "
|
debug_loader,
|
||||||
"{}, visibility = {}",
|
"name {} function {} library {} module {} bind {} type {} visibility {}\n",
|
||||||
ids.at(0), nidName, library->name, module->name, bind, type, visibility);
|
ids.at(0), nidName, library->name, module->name, bind, type, visibility);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static void relocate(u32 idx, elf_relocation* rel, Module* m, bool isJmpRel) {
|
||||||
void Linker::Relocate(Module* m) {
|
|
||||||
const auto relocate = [this](u32 idx, elf_relocation* rel, Module* m, bool isJmpRel) {
|
|
||||||
auto type = rel->GetType();
|
auto type = rel->GetType();
|
||||||
auto symbol = rel->GetSymbol();
|
auto symbol = rel->GetSymbol();
|
||||||
auto addend = rel->rel_addend;
|
auto addend = rel->rel_addend;
|
||||||
|
@ -478,7 +541,7 @@ void Linker::Relocate(Module* m) {
|
||||||
case R_X86_64_RELATIVE:
|
case R_X86_64_RELATIVE:
|
||||||
if (symbol != 0) // should be always zero
|
if (symbol != 0) // should be always zero
|
||||||
{
|
{
|
||||||
// LOG_INFO(Core_Linker, "R_X86_64_RELATIVE symbol not zero = {:#010x}\n", type,
|
// LOG_INFO_IF(debug_loader, "R_X86_64_RELATIVE symbol not zero = {:#010x}\n", type,
|
||||||
// symbol);//found it openorbis but i am not sure it worth logging
|
// symbol);//found it openorbis but i am not sure it worth logging
|
||||||
}
|
}
|
||||||
rel_value = rel_base_virtual_addr + addend;
|
rel_value = rel_base_virtual_addr + addend;
|
||||||
|
@ -501,16 +564,16 @@ void Linker::Relocate(Module* m) {
|
||||||
rel_sym_type = 1;
|
rel_sym_type = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG_INFO(Core_Linker, "unknown symbol type {}", sym_type);
|
LOG_INFO_IF(debug_loader, "unknown symbol type {}\n", sym_type);
|
||||||
}
|
}
|
||||||
if (sym_visibility != 0) // should be zero log if else
|
if (sym_visibility != 0) // should be zero log if else
|
||||||
{
|
{
|
||||||
LOG_INFO(Core_Linker, "symbol visilibity !=0");
|
LOG_INFO_IF(debug_loader, "symbol visilibity !=0\n");
|
||||||
}
|
}
|
||||||
switch (sym_bind) {
|
switch (sym_bind) {
|
||||||
case STB_GLOBAL:
|
case STB_GLOBAL:
|
||||||
rel_name = namesTlb + sym.st_name;
|
rel_name = namesTlb + sym.st_name;
|
||||||
Resolve(rel_name, rel_sym_type, m, &symrec);
|
m->linker->Resolve(rel_name, rel_sym_type, m, &symrec);
|
||||||
symbol_vitrual_addr = symrec.virtual_address;
|
symbol_vitrual_addr = symrec.virtual_address;
|
||||||
rel_isResolved = (symbol_vitrual_addr != 0);
|
rel_isResolved = (symbol_vitrual_addr != 0);
|
||||||
|
|
||||||
|
@ -520,28 +583,29 @@ void Linker::Relocate(Module* m) {
|
||||||
}
|
}
|
||||||
rel_value = (rel_isResolved ? symbol_vitrual_addr + addend : 0);
|
rel_value = (rel_isResolved ? symbol_vitrual_addr + addend : 0);
|
||||||
if (!rel_isResolved) {
|
if (!rel_isResolved) {
|
||||||
LOG_INFO(Core_Linker,
|
LOG_INFO_IF(debug_loader,
|
||||||
"R_X86_64_64-R_X86_64_JUMP_SLOT sym_type {} bind STB_GLOBAL symbol : "
|
"R_X86_64_64-R_X86_64_JUMP_SLOT sym_type {} bind STB_GLOBAL symbol : "
|
||||||
"{:#010x}",
|
"{:#010x}\n",
|
||||||
sym_type, symbol);
|
sym_type, symbol);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG_INFO(Core_Linker, "UNK bind {}", sym_bind);
|
LOG_INFO_IF(debug_loader, "UNK bind {}\n", sym_bind);
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
default:
|
default:
|
||||||
LOG_INFO(Core_Linker, "UNK type {:#010x} rel symbol : {:#010x}", type, symbol);
|
LOG_INFO_IF(debug_loader, "UNK type {:#010x} rel symbol : {:#010x}\n", type, symbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rel_isResolved) {
|
if (rel_isResolved) {
|
||||||
VirtualMemory::memory_patch(rel_virtual_addr, rel_value);
|
VirtualMemory::memory_patch(rel_virtual_addr, rel_value);
|
||||||
} else {
|
} else {
|
||||||
LOG_INFO(Core_Linker, "function not patched! {}", rel_name);
|
LOG_INFO_IF(debug_loader, "function not patched! {}\n", rel_name);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
|
void Linker::Relocate(Module* m) {
|
||||||
u32 idx = 0;
|
u32 idx = 0;
|
||||||
for (auto* rel = m->dynamic_info.relocation_table;
|
for (auto* rel = m->dynamic_info.relocation_table;
|
||||||
reinterpret_cast<u8*>(rel) < reinterpret_cast<u8*>(m->dynamic_info.relocation_table) +
|
reinterpret_cast<u8*>(rel) < reinterpret_cast<u8*>(m->dynamic_info.relocation_table) +
|
||||||
|
@ -590,8 +654,8 @@ void Linker::Resolve(const std::string& name, int Symtype, Module* m,
|
||||||
return_info->virtual_address = AeroLib::GetStub(sr.name.c_str());
|
return_info->virtual_address = AeroLib::GetStub(sr.name.c_str());
|
||||||
return_info->name = "Unknown !!!";
|
return_info->name = "Unknown !!!";
|
||||||
}
|
}
|
||||||
LOG_ERROR(Core_Linker, "Linker: Stub resolved {} as {} (lib: {}, mod: {})", sr.name,
|
LOG_ERROR_IF(debug_loader, "Linker: Stub resolved {} as {} (lib: {}, mod: {}) \n",
|
||||||
return_info->name, library->name, module->name);
|
sr.name, return_info->name, library->name, module->name);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//__debugbreak();//den tha prepei na ftasoume edo
|
//__debugbreak();//den tha prepei na ftasoume edo
|
||||||
|
@ -608,7 +672,7 @@ static PS4_SYSV_ABI void ProgramExitFunc() {
|
||||||
fmt::print("exit function called\n");
|
fmt::print("exit function called\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void RunMainEntry(u64 addr, EntryParams* params, exit_func_t exit_func) {
|
static void run_main_entry(u64 addr, EntryParams* params, exit_func_t exit_func) {
|
||||||
// reinterpret_cast<entry_func_t>(addr)(params, exit_func); // can't be used, stack has to have
|
// reinterpret_cast<entry_func_t>(addr)(params, exit_func); // can't be used, stack has to have
|
||||||
// a specific layout
|
// a specific layout
|
||||||
|
|
||||||
|
@ -638,7 +702,7 @@ void Linker::Execute() {
|
||||||
p.argv[0] = "eboot.bin"; // hmm should be ok?
|
p.argv[0] = "eboot.bin"; // hmm should be ok?
|
||||||
|
|
||||||
const auto& module = m_modules.at(0);
|
const auto& module = m_modules.at(0);
|
||||||
RunMainEntry(module->elf.GetElfEntry() + module->base_virtual_addr, &p, ProgramExitFunc);
|
run_main_entry(module.elf.GetElfEntry() + module.base_virtual_addr, &p, ProgramExitFunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
|
|
@ -51,7 +51,6 @@ struct PS4ThreadLocal {
|
||||||
u64 image_size = 0;
|
u64 image_size = 0;
|
||||||
u64 handler_virtual_addr = 0;
|
u64 handler_virtual_addr = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DynamicModuleInfo {
|
struct DynamicModuleInfo {
|
||||||
void* hash_table = nullptr;
|
void* hash_table = nullptr;
|
||||||
u64 hash_table_size = 0;
|
u64 hash_table_size = 0;
|
||||||
|
@ -98,7 +97,9 @@ struct DynamicModuleInfo {
|
||||||
struct Module {
|
struct Module {
|
||||||
Loader::Elf elf;
|
Loader::Elf elf;
|
||||||
u64 aligned_base_size = 0;
|
u64 aligned_base_size = 0;
|
||||||
u64 base_virtual_addr = 0;
|
u64 base_virtual_addr = 0; // Base virtual address
|
||||||
|
|
||||||
|
Linker* linker = nullptr;
|
||||||
|
|
||||||
std::vector<u8> m_dynamic;
|
std::vector<u8> m_dynamic;
|
||||||
std::vector<u8> m_dynamic_data;
|
std::vector<u8> m_dynamic_data;
|
||||||
|
@ -115,8 +116,8 @@ public:
|
||||||
Linker();
|
Linker();
|
||||||
virtual ~Linker();
|
virtual ~Linker();
|
||||||
|
|
||||||
Module* LoadModule(const std::filesystem::path& elf_name);
|
Module* LoadModule(const std::string& elf_name);
|
||||||
Module* FindModule(u32 id = 0);
|
Module* FindModule(/*u32 id*/);
|
||||||
void LoadModuleToMemory(Module* m);
|
void LoadModuleToMemory(Module* m);
|
||||||
void LoadDynamicInfo(Module* m);
|
void LoadDynamicInfo(Module* m);
|
||||||
void LoadSymbols(Module* m);
|
void LoadSymbols(Module* m);
|
||||||
|
@ -132,7 +133,7 @@ private:
|
||||||
const ModuleInfo* FindModule(const Module& m, const std::string& id);
|
const ModuleInfo* FindModule(const Module& m, const std::string& id);
|
||||||
const LibraryInfo* FindLibrary(const Module& program, const std::string& id);
|
const LibraryInfo* FindLibrary(const Module& program, const std::string& id);
|
||||||
|
|
||||||
std::vector<std::unique_ptr<Module>> m_modules;
|
std::vector<Module> m_modules;
|
||||||
Loader::SymbolsResolver m_hle_symbols{};
|
Loader::SymbolsResolver m_hle_symbols{};
|
||||||
std::mutex m_mutex;
|
std::mutex m_mutex;
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,15 +2,15 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include <fmt/core.h>
|
#include <fmt/core.h>
|
||||||
#include "common/assert.h"
|
#include "common/debug.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/log.h"
|
||||||
#include "core/loader/elf.h"
|
#include "core/loader/elf.h"
|
||||||
|
|
||||||
namespace Core::Loader {
|
namespace Core::Loader {
|
||||||
|
|
||||||
using namespace Common::FS;
|
constexpr bool log_file_loader = false; // disable it to disable logging
|
||||||
|
|
||||||
static std::string_view GetProgramTypeName(program_type_es type) {
|
static std::string_view getProgramTypeName(program_type_es type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case PT_FAKE:
|
case PT_FAKE:
|
||||||
return "PT_FAKE";
|
return "PT_FAKE";
|
||||||
|
@ -33,7 +33,7 @@ static std::string_view GetProgramTypeName(program_type_es type) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string_view GetIdentClassName(ident_class_es elf_class) {
|
static std::string_view getIdentClassName(ident_class_es elf_class) {
|
||||||
switch (elf_class) {
|
switch (elf_class) {
|
||||||
case ELF_CLASS_NONE:
|
case ELF_CLASS_NONE:
|
||||||
return "ELF_CLASS_NONE";
|
return "ELF_CLASS_NONE";
|
||||||
|
@ -48,7 +48,7 @@ static std::string_view GetIdentClassName(ident_class_es elf_class) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string_view GetIdentEndianName(ident_endian_es endian) {
|
static std::string_view getIdentEndianName(ident_endian_es endian) {
|
||||||
switch (endian) {
|
switch (endian) {
|
||||||
case ELF_DATA_NONE:
|
case ELF_DATA_NONE:
|
||||||
return "ELF_DATA_NONE";
|
return "ELF_DATA_NONE";
|
||||||
|
@ -63,7 +63,7 @@ static std::string_view GetIdentEndianName(ident_endian_es endian) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string_view GetIdentVersionName(ident_version_es version) {
|
static std::string_view getIdentVersionName(ident_version_es version) {
|
||||||
switch (version) {
|
switch (version) {
|
||||||
case ELF_VERSION_NONE:
|
case ELF_VERSION_NONE:
|
||||||
return "ELF_VERSION_NONE";
|
return "ELF_VERSION_NONE";
|
||||||
|
@ -76,7 +76,7 @@ static std::string_view GetIdentVersionName(ident_version_es version) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string_view GetIdentOsabiName(ident_osabi_es osabi) {
|
static std::string_view getIdentOsabiName(ident_osabi_es osabi) {
|
||||||
switch (osabi) {
|
switch (osabi) {
|
||||||
case ELF_OSABI_NONE:
|
case ELF_OSABI_NONE:
|
||||||
return "ELF_OSABI_NONE";
|
return "ELF_OSABI_NONE";
|
||||||
|
@ -117,7 +117,7 @@ static std::string_view GetIdentOsabiName(ident_osabi_es osabi) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string_view GetIdentAbiversionName(ident_abiversion_es version) {
|
static std::string_view getIdentAbiversionName(ident_abiversion_es version) {
|
||||||
switch (version) {
|
switch (version) {
|
||||||
case ELF_ABI_VERSION_AMDGPU_HSA_V2:
|
case ELF_ABI_VERSION_AMDGPU_HSA_V2:
|
||||||
return "ELF_ABI_VERSION_AMDGPU_HSA_V2";
|
return "ELF_ABI_VERSION_AMDGPU_HSA_V2";
|
||||||
|
@ -131,7 +131,7 @@ static std::string_view GetIdentAbiversionName(ident_abiversion_es version) {
|
||||||
return "INVALID";
|
return "INVALID";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static std::string_view GetVersion(e_version_es version) {
|
static std::string_view getVersion(e_version_es version) {
|
||||||
switch (version) {
|
switch (version) {
|
||||||
case EV_NONE:
|
case EV_NONE:
|
||||||
return "EV_NONE";
|
return "EV_NONE";
|
||||||
|
@ -142,7 +142,7 @@ static std::string_view GetVersion(e_version_es version) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string_view GetType(e_type_s type) {
|
static std::string_view getType(e_type_s type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ET_NONE:
|
case ET_NONE:
|
||||||
return "ET_NONE";
|
return "ET_NONE";
|
||||||
|
@ -167,7 +167,7 @@ static std::string_view GetType(e_type_s type) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string_view GetMachine(e_machine_es machine) {
|
static std::string_view getMachine(e_machine_es machine) {
|
||||||
switch (machine) {
|
switch (machine) {
|
||||||
case EM_X86_64:
|
case EM_X86_64:
|
||||||
return "EM_X86_64";
|
return "EM_X86_64";
|
||||||
|
@ -176,25 +176,30 @@ static std::string_view GetMachine(e_machine_es machine) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Elf::~Elf() = default;
|
Elf::~Elf() {
|
||||||
|
Reset();
|
||||||
|
}
|
||||||
|
|
||||||
void Elf::Open(const std::filesystem::path& file_name) {
|
void Elf::Reset() {
|
||||||
m_f.Open(file_name, FileAccessMode::Read);
|
m_f.close();
|
||||||
if (!m_f.ReadObject(m_self)) {
|
}
|
||||||
LOG_ERROR(Loader, "Unable to read self header!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_self = IsSelfFile(); !is_self) {
|
void Elf::Open(const std::string& file_name) {
|
||||||
m_f.Seek(0, SeekOrigin::SetOrigin);
|
Reset();
|
||||||
|
|
||||||
|
m_f.open(file_name, Common::FS::OpenMode::Read);
|
||||||
|
m_f.read(m_self);
|
||||||
|
|
||||||
|
if (is_self = isSelfFile(); !is_self) {
|
||||||
|
m_f.seek(0, Common::FS::SeekMode::Set);
|
||||||
} else {
|
} else {
|
||||||
m_self_segments.resize(m_self.segment_count);
|
m_self_segments.resize(m_self.segment_count);
|
||||||
m_f.Read(m_self_segments);
|
m_f.read(m_self_segments);
|
||||||
}
|
}
|
||||||
|
|
||||||
const u64 elf_header_pos = m_f.Tell();
|
const u64 elf_header_pos = m_f.tell();
|
||||||
m_f.Read(m_elf_header);
|
m_f.read(m_elf_header);
|
||||||
if (!IsElfFile()) {
|
if (!isElfFile()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,8 +209,8 @@ void Elf::Open(const std::filesystem::path& file_name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
out.resize(num);
|
out.resize(num);
|
||||||
m_f.Seek(offset, SeekOrigin::SetOrigin);
|
m_f.seek(offset, Common::FS::SeekMode::Set);
|
||||||
m_f.Read(out);
|
m_f.read(out);
|
||||||
};
|
};
|
||||||
|
|
||||||
load_headers(m_elf_phdr, elf_header_pos + m_elf_header.e_phoff, m_elf_header.e_phnum);
|
load_headers(m_elf_phdr, elf_header_pos + m_elf_header.e_phoff, m_elf_header.e_phnum);
|
||||||
|
@ -222,95 +227,96 @@ void Elf::Open(const std::filesystem::path& file_name) {
|
||||||
header_size &= ~15; // Align
|
header_size &= ~15; // Align
|
||||||
|
|
||||||
if (m_elf_header.e_ehsize - header_size >= sizeof(elf_program_id_header)) {
|
if (m_elf_header.e_ehsize - header_size >= sizeof(elf_program_id_header)) {
|
||||||
m_f.Seek(header_size, SeekOrigin::SetOrigin);
|
m_f.seek(header_size, Common::FS::SeekMode::Set);
|
||||||
m_f.ReadObject(m_self_id_header);
|
m_f.read(m_self_id_header);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugDump();
|
DebugDump();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Elf::IsSelfFile() const {
|
bool Elf::isSelfFile() const {
|
||||||
if (m_self.magic != self_header::signature) [[unlikely]] {
|
if (m_self.magic != self_header::signature) [[unlikely]] {
|
||||||
LOG_INFO(Loader, "Not a SELF file. Magic mismatch current = {:#x} expected = {:#x}",
|
LOG_ERROR_IF(log_file_loader,
|
||||||
|
"Not a SELF file.Magic file mismatched !current = {:#x} required = {:#x}\n ",
|
||||||
m_self.magic, self_header::signature);
|
m_self.magic, self_header::signature);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_self.version != 0x00 || m_self.mode != 0x01 || m_self.endian != 0x01 ||
|
if (m_self.version != 0x00 || m_self.mode != 0x01 || m_self.endian != 0x01 ||
|
||||||
m_self.attributes != 0x12) [[unlikely]] {
|
m_self.attributes != 0x12) [[unlikely]] {
|
||||||
LOG_INFO(Loader, "Unknown SELF file");
|
LOG_ERROR_IF(log_file_loader, "Unknown SELF file\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_self.category != 0x01 || m_self.program_type != 0x01) [[unlikely]] {
|
if (m_self.category != 0x01 || m_self.program_type != 0x01) [[unlikely]] {
|
||||||
LOG_INFO(Loader, "Unknown SELF file");
|
LOG_ERROR_IF(log_file_loader, "Unknown SELF file\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Elf::IsElfFile() const {
|
bool Elf::isElfFile() const {
|
||||||
if (m_elf_header.e_ident.magic[EI_MAG0] != ELFMAG0 ||
|
if (m_elf_header.e_ident.magic[EI_MAG0] != ELFMAG0 ||
|
||||||
m_elf_header.e_ident.magic[EI_MAG1] != ELFMAG1 ||
|
m_elf_header.e_ident.magic[EI_MAG1] != ELFMAG1 ||
|
||||||
m_elf_header.e_ident.magic[EI_MAG2] != ELFMAG2 ||
|
m_elf_header.e_ident.magic[EI_MAG2] != ELFMAG2 ||
|
||||||
m_elf_header.e_ident.magic[EI_MAG3] != ELFMAG3) {
|
m_elf_header.e_ident.magic[EI_MAG3] != ELFMAG3) {
|
||||||
LOG_INFO(Loader, "Not an ELF file magic is wrong!");
|
LOG_ERROR_IF(log_file_loader, "Not an ELF file magic is wrong!\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (m_elf_header.e_ident.ei_class != ELF_CLASS_64) {
|
if (m_elf_header.e_ident.ei_class != ELF_CLASS_64) {
|
||||||
LOG_INFO(Loader, "e_ident[EI_CLASS] expected 0x02 is ({:#x})",
|
LOG_ERROR_IF(log_file_loader, "e_ident[EI_CLASS] expected 0x02 is ({:#x})\n",
|
||||||
static_cast<u32>(m_elf_header.e_ident.ei_class));
|
static_cast<u32>(m_elf_header.e_ident.ei_class));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_elf_header.e_ident.ei_data != ELF_DATA_2LSB) {
|
if (m_elf_header.e_ident.ei_data != ELF_DATA_2LSB) {
|
||||||
LOG_INFO(Loader, "e_ident[EI_DATA] expected 0x01 is ({:#x})",
|
LOG_ERROR_IF(log_file_loader, "e_ident[EI_DATA] expected 0x01 is ({:#x})\n",
|
||||||
static_cast<u32>(m_elf_header.e_ident.ei_data));
|
static_cast<u32>(m_elf_header.e_ident.ei_data));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_elf_header.e_ident.ei_version != ELF_VERSION_CURRENT) {
|
if (m_elf_header.e_ident.ei_version != ELF_VERSION_CURRENT) {
|
||||||
LOG_INFO(Loader, "e_ident[EI_VERSION] expected 0x01 is ({:#x})",
|
LOG_ERROR_IF(log_file_loader, "e_ident[EI_VERSION] expected 0x01 is ({:#x})\n",
|
||||||
static_cast<u32>(m_elf_header.e_ident.ei_version));
|
static_cast<u32>(m_elf_header.e_ident.ei_version));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_elf_header.e_ident.ei_osabi != ELF_OSABI_FREEBSD) {
|
if (m_elf_header.e_ident.ei_osabi != ELF_OSABI_FREEBSD) {
|
||||||
LOG_INFO(Loader, "e_ident[EI_OSABI] expected 0x09 is ({:#x})",
|
LOG_ERROR_IF(log_file_loader, "e_ident[EI_OSABI] expected 0x09 is ({:#x})\n",
|
||||||
static_cast<u32>(m_elf_header.e_ident.ei_osabi));
|
static_cast<u32>(m_elf_header.e_ident.ei_osabi));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_elf_header.e_ident.ei_abiversion != ELF_ABI_VERSION_AMDGPU_HSA_V2) {
|
if (m_elf_header.e_ident.ei_abiversion != ELF_ABI_VERSION_AMDGPU_HSA_V2) {
|
||||||
LOG_INFO(Loader, "e_ident[EI_ABIVERSION] expected 0x00 is ({:#x})",
|
LOG_ERROR_IF(log_file_loader, "e_ident[EI_ABIVERSION] expected 0x00 is ({:#x})\n",
|
||||||
static_cast<u32>(m_elf_header.e_ident.ei_abiversion));
|
static_cast<u32>(m_elf_header.e_ident.ei_abiversion));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_elf_header.e_type != ET_SCE_DYNEXEC && m_elf_header.e_type != ET_SCE_DYNAMIC &&
|
if (m_elf_header.e_type != ET_SCE_DYNEXEC && m_elf_header.e_type != ET_SCE_DYNAMIC &&
|
||||||
m_elf_header.e_type != ET_SCE_EXEC) {
|
m_elf_header.e_type != ET_SCE_EXEC) {
|
||||||
LOG_INFO(Loader, "e_type expected 0xFE10 OR 0xFE18 OR 0xfe00 is ({:#x})",
|
LOG_ERROR_IF(log_file_loader, "e_type expected 0xFE10 OR 0xFE18 OR 0xfe00 is ({:#x})\n",
|
||||||
static_cast<u32>(m_elf_header.e_type));
|
static_cast<u32>(m_elf_header.e_type));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_elf_header.e_machine != EM_X86_64) {
|
if (m_elf_header.e_machine != EM_X86_64) {
|
||||||
LOG_INFO(Loader, "e_machine expected 0x3E is ({:#x})",
|
LOG_ERROR_IF(log_file_loader, "e_machine expected 0x3E is ({:#x})\n",
|
||||||
static_cast<u32>(m_elf_header.e_machine));
|
static_cast<u32>(m_elf_header.e_machine));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_elf_header.e_version != EV_CURRENT) {
|
if (m_elf_header.e_version != EV_CURRENT) {
|
||||||
LOG_INFO(Loader, "m_elf_header.e_version expected 0x01 is ({:#x})",
|
LOG_ERROR_IF(log_file_loader, "m_elf_header.e_version expected 0x01 is ({:#x})\n",
|
||||||
static_cast<u32>(m_elf_header.e_version));
|
static_cast<u32>(m_elf_header.e_version));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_elf_header.e_phentsize != sizeof(elf_program_header)) {
|
if (m_elf_header.e_phentsize != sizeof(elf_program_header)) {
|
||||||
LOG_INFO(Loader, "e_phentsize ({}) != sizeof(elf_program_header)",
|
LOG_ERROR_IF(log_file_loader, "e_phentsize ({}) != sizeof(elf_program_header)\n",
|
||||||
m_elf_header.e_phentsize);
|
static_cast<u32>(m_elf_header.e_phentsize));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,7 +324,7 @@ bool Elf::IsElfFile() const {
|
||||||
m_elf_header.e_shentsize !=
|
m_elf_header.e_shentsize !=
|
||||||
sizeof(elf_section_header)) // Commercial games doesn't appear to have section headers
|
sizeof(elf_section_header)) // Commercial games doesn't appear to have section headers
|
||||||
{
|
{
|
||||||
LOG_INFO(Loader, "e_shentsize ({}) != sizeof(elf_section_header)",
|
LOG_ERROR_IF(log_file_loader, "e_shentsize ({}) != sizeof(elf_section_header)\n",
|
||||||
m_elf_header.e_shentsize);
|
m_elf_header.e_shentsize);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -328,49 +334,50 @@ bool Elf::IsElfFile() const {
|
||||||
|
|
||||||
void Elf::DebugDump() {
|
void Elf::DebugDump() {
|
||||||
if (is_self) { // If we load elf instead
|
if (is_self) { // If we load elf instead
|
||||||
LOG_INFO(Loader, "{}", SElfHeaderStr());
|
LOG_INFO_IF(log_file_loader, (SElfHeaderStr()));
|
||||||
for (u16 i = 0; i < m_self.segment_count; i++) {
|
for (u16 i = 0; i < m_self.segment_count; i++) {
|
||||||
LOG_INFO(Loader, "{}", SELFSegHeader(i));
|
LOG_INFO_IF(log_file_loader, SELFSegHeader(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INFO(Loader, "{}", ElfHeaderStr());
|
LOG_INFO_IF(log_file_loader, ElfHeaderStr());
|
||||||
|
|
||||||
if (m_elf_header.e_phentsize > 0) {
|
if (m_elf_header.e_phentsize > 0) {
|
||||||
LOG_INFO(Loader, "Program headers:");
|
LOG_INFO_IF(log_file_loader, "Program headers:\n");
|
||||||
for (u16 i = 0; i < m_elf_header.e_phnum; i++) {
|
for (u16 i = 0; i < m_elf_header.e_phnum; i++) {
|
||||||
LOG_INFO(Loader, "{}", ElfPHeaderStr(i));
|
LOG_INFO_IF(log_file_loader, ElfPHeaderStr(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_elf_header.e_shentsize > 0) {
|
if (m_elf_header.e_shentsize > 0) {
|
||||||
LOG_INFO(Loader, "Section headers:");
|
LOG_INFO_IF(log_file_loader, "Section headers:\n");
|
||||||
for (u16 i = 0; i < m_elf_header.e_shnum; i++) {
|
for (u16 i = 0; i < m_elf_header.e_shnum; i++) {
|
||||||
LOG_INFO(Loader, "--- shdr {} --", i);
|
LOG_INFO_IF(log_file_loader, "--- shdr {} --\n", i);
|
||||||
LOG_INFO(Loader, "sh_name ........: {}", m_elf_shdr[i].sh_name);
|
LOG_INFO_IF(log_file_loader, "sh_name ........: {}\n", m_elf_shdr[i].sh_name);
|
||||||
LOG_INFO(Loader, "sh_type ........: {:#010x}", m_elf_shdr[i].sh_type);
|
LOG_INFO_IF(log_file_loader, "sh_type ........: {:#010x}\n", m_elf_shdr[i].sh_type);
|
||||||
LOG_INFO(Loader, "sh_flags .......: {:#018x}", m_elf_shdr[i].sh_flags);
|
LOG_INFO_IF(log_file_loader, "sh_flags .......: {:#018x}\n", m_elf_shdr[i].sh_flags);
|
||||||
LOG_INFO(Loader, "sh_addr ........: {:#018x}", m_elf_shdr[i].sh_addr);
|
LOG_INFO_IF(log_file_loader, "sh_addr ........: {:#018x}\n", m_elf_shdr[i].sh_addr);
|
||||||
LOG_INFO(Loader, "sh_offset ......: {:#018x}", m_elf_shdr[i].sh_offset);
|
LOG_INFO_IF(log_file_loader, "sh_offset ......: {:#018x}\n", m_elf_shdr[i].sh_offset);
|
||||||
LOG_INFO(Loader, "sh_size ........: {:#018x}", m_elf_shdr[i].sh_size);
|
LOG_INFO_IF(log_file_loader, "sh_size ........: {:#018x}\n", m_elf_shdr[i].sh_size);
|
||||||
LOG_INFO(Loader, "sh_link ........: {:#010x}", m_elf_shdr[i].sh_link);
|
LOG_INFO_IF(log_file_loader, "sh_link ........: {:#010x}\n", m_elf_shdr[i].sh_link);
|
||||||
LOG_INFO(Loader, "sh_info ........: {:#010x}", m_elf_shdr[i].sh_info);
|
LOG_INFO_IF(log_file_loader, "sh_info ........: {:#010x}\n", m_elf_shdr[i].sh_info);
|
||||||
LOG_INFO(Loader, "sh_addralign ...: {:#018x}", m_elf_shdr[i].sh_addralign);
|
LOG_INFO_IF(log_file_loader, "sh_addralign ...: {:#018x}\n",
|
||||||
LOG_INFO(Loader, "sh_entsize .....: {:#018x}", m_elf_shdr[i].sh_entsize);
|
m_elf_shdr[i].sh_addralign);
|
||||||
|
LOG_INFO_IF(log_file_loader, "sh_entsize .....: {:#018x}\n", m_elf_shdr[i].sh_entsize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_self) {
|
if (is_self) {
|
||||||
LOG_INFO(Loader, "SELF info:");
|
LOG_INFO_IF(log_file_loader, "SELF info:\n");
|
||||||
LOG_INFO(Loader, "auth id ............: {:#018x}", m_self_id_header.authid);
|
LOG_INFO_IF(log_file_loader, "auth id ............: {:#018x}\n", m_self_id_header.authid);
|
||||||
LOG_INFO(Loader, "program type .......: {}",
|
LOG_INFO_IF(log_file_loader, "program type .......: {}\n",
|
||||||
GetProgramTypeName(m_self_id_header.program_type));
|
getProgramTypeName(m_self_id_header.program_type));
|
||||||
LOG_INFO(Loader, "app version ........: {:#018x}", m_self_id_header.appver);
|
LOG_INFO_IF(log_file_loader, "app version ........: {:#018x}\n", m_self_id_header.appver);
|
||||||
LOG_INFO(Loader, "fw version .........: {:#018x}", m_self_id_header.firmver);
|
LOG_INFO_IF(log_file_loader, "fw version .........: {:#018x}\n", m_self_id_header.firmver);
|
||||||
std::string digest;
|
std::string digest;
|
||||||
for (int i = 0; i < 32; i++) {
|
for (int i = 0; i < 32; i++) {
|
||||||
digest += fmt::format("{:02X}", m_self_id_header.digest[i]);
|
digest += fmt::format("{:02X}", m_self_id_header.digest[i]);
|
||||||
}
|
}
|
||||||
LOG_INFO(Loader, "digest..............: 0x{}", digest);
|
LOG_INFO_IF(log_file_loader, "digest..............: 0x{}\n", digest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,15 +420,15 @@ std::string Elf::ElfHeaderStr() {
|
||||||
header += fmt::format("\n");
|
header += fmt::format("\n");
|
||||||
|
|
||||||
header +=
|
header +=
|
||||||
fmt::format("ident class.......: {}\n", GetIdentClassName(m_elf_header.e_ident.ei_class));
|
fmt::format("ident class.......: {}\n", getIdentClassName(m_elf_header.e_ident.ei_class));
|
||||||
header +=
|
header +=
|
||||||
fmt::format("ident data .......: {}\n", GetIdentEndianName(m_elf_header.e_ident.ei_data));
|
fmt::format("ident data .......: {}\n", getIdentEndianName(m_elf_header.e_ident.ei_data));
|
||||||
header += fmt::format("ident version.....: {}\n",
|
header += fmt::format("ident version.....: {}\n",
|
||||||
GetIdentVersionName(m_elf_header.e_ident.ei_version));
|
getIdentVersionName(m_elf_header.e_ident.ei_version));
|
||||||
header +=
|
header +=
|
||||||
fmt::format("ident osabi .....: {}\n", GetIdentOsabiName(m_elf_header.e_ident.ei_osabi));
|
fmt::format("ident osabi .....: {}\n", getIdentOsabiName(m_elf_header.e_ident.ei_osabi));
|
||||||
header += fmt::format("ident abiversion..: {}\n",
|
header += fmt::format("ident abiversion..: {}\n",
|
||||||
GetIdentAbiversionName(m_elf_header.e_ident.ei_abiversion));
|
getIdentAbiversionName(m_elf_header.e_ident.ei_abiversion));
|
||||||
|
|
||||||
header += fmt::format("ident UNK ........: 0x");
|
header += fmt::format("ident UNK ........: 0x");
|
||||||
for (auto i : m_elf_header.e_ident.pad) {
|
for (auto i : m_elf_header.e_ident.pad) {
|
||||||
|
@ -429,9 +436,9 @@ std::string Elf::ElfHeaderStr() {
|
||||||
}
|
}
|
||||||
header += fmt::format("\n");
|
header += fmt::format("\n");
|
||||||
|
|
||||||
header += fmt::format("type ............: {}\n", GetType(m_elf_header.e_type));
|
header += fmt::format("type ............: {}\n", getType(m_elf_header.e_type));
|
||||||
header += fmt::format("machine ..........: {}\n", GetMachine(m_elf_header.e_machine));
|
header += fmt::format("machine ..........: {}\n", getMachine(m_elf_header.e_machine));
|
||||||
header += fmt::format("version ..........: {}\n", GetVersion(m_elf_header.e_version));
|
header += fmt::format("version ..........: {}\n", getVersion(m_elf_header.e_version));
|
||||||
header += fmt::format("entry ............: {:#018x}\n", m_elf_header.e_entry);
|
header += fmt::format("entry ............: {:#018x}\n", m_elf_header.e_entry);
|
||||||
header += fmt::format("phoff ............: {:#018x}\n", m_elf_header.e_phoff);
|
header += fmt::format("phoff ............: {:#018x}\n", m_elf_header.e_phoff);
|
||||||
header += fmt::format("shoff ............: {:#018x}\n", m_elf_header.e_shoff);
|
header += fmt::format("shoff ............: {:#018x}\n", m_elf_header.e_shoff);
|
||||||
|
@ -515,8 +522,8 @@ std::string Elf::ElfPHeaderStr(u16 no) {
|
||||||
void Elf::LoadSegment(u64 virtual_addr, u64 file_offset, u64 size) {
|
void Elf::LoadSegment(u64 virtual_addr, u64 file_offset, u64 size) {
|
||||||
if (!is_self) {
|
if (!is_self) {
|
||||||
// It's elf file
|
// It's elf file
|
||||||
m_f.Seek(file_offset, SeekOrigin::SetOrigin);
|
m_f.seek(file_offset, Common::FS::SeekMode::Set);
|
||||||
m_f.ReadRaw<u8>(reinterpret_cast<u8*>(virtual_addr), size);
|
m_f.read(reinterpret_cast<void*>(static_cast<uintptr_t>(virtual_addr)), size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -529,13 +536,13 @@ void Elf::LoadSegment(u64 virtual_addr, u64 file_offset, u64 size) {
|
||||||
|
|
||||||
if (file_offset >= phdr.p_offset && file_offset < phdr.p_offset + phdr.p_filesz) {
|
if (file_offset >= phdr.p_offset && file_offset < phdr.p_offset + phdr.p_filesz) {
|
||||||
auto offset = file_offset - phdr.p_offset;
|
auto offset = file_offset - phdr.p_offset;
|
||||||
m_f.Seek(offset + seg.file_offset, SeekOrigin::SetOrigin);
|
m_f.seek(offset + seg.file_offset, Common::FS::SeekMode::Set);
|
||||||
m_f.ReadRaw<u8>(reinterpret_cast<u8*>(virtual_addr), size);
|
m_f.read(reinterpret_cast<void*>(static_cast<uintptr_t>(virtual_addr)), size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UNREACHABLE();
|
BREAKPOINT(); // Hmm we didn't return something...
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Core::Loader
|
} // namespace Core::Loader
|
||||||
|
|
|
@ -8,11 +8,11 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "common/io_file.h"
|
#include "common/fs_file.h"
|
||||||
#include "common/types.h"
|
#include "common/types.h"
|
||||||
|
|
||||||
struct self_header {
|
struct self_header {
|
||||||
static constexpr u32 signature = 0x1D3D154Fu;
|
static const u32 signature = 0x1D3D154Fu;
|
||||||
|
|
||||||
u32 magic;
|
u32 magic;
|
||||||
u8 version;
|
u8 version;
|
||||||
|
@ -455,11 +455,11 @@ namespace Core::Loader {
|
||||||
class Elf {
|
class Elf {
|
||||||
public:
|
public:
|
||||||
Elf() = default;
|
Elf() = default;
|
||||||
~Elf();
|
virtual ~Elf();
|
||||||
|
|
||||||
void Open(const std::filesystem::path& file_name);
|
void Open(const std::string& file_name);
|
||||||
bool IsSelfFile() const;
|
bool isSelfFile() const;
|
||||||
bool IsElfFile() const;
|
bool isElfFile() const;
|
||||||
void DebugDump();
|
void DebugDump();
|
||||||
|
|
||||||
[[nodiscard]] self_header GetSElfHeader() const {
|
[[nodiscard]] self_header GetSElfHeader() const {
|
||||||
|
@ -492,7 +492,10 @@ public:
|
||||||
void LoadSegment(u64 virtual_addr, u64 file_offset, u64 size);
|
void LoadSegment(u64 virtual_addr, u64 file_offset, u64 size);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Common::FS::IOFile m_f{};
|
void Reset();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Common::FS::File m_f{};
|
||||||
bool is_self{};
|
bool is_self{};
|
||||||
self_header m_self{};
|
self_header m_self{};
|
||||||
std::vector<self_segment_header> m_self_segments;
|
std::vector<self_segment_header> m_self_segments;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "common/logging/log.h"
|
#include "common/log.h"
|
||||||
#include "common/types.h"
|
#include "common/types.h"
|
||||||
#include "core/loader/symbols_resolver.h"
|
#include "core/loader/symbols_resolver.h"
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ const SymbolRecord* SymbolsResolver::FindSymbol(const SymbolRes& s) const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INFO(Core_Linker, "Unresolved! {}", name);
|
LOG_INFO("Unresolved! {}\n", name);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
177
src/core/tls.cpp
177
src/core/tls.cpp
|
@ -1,177 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/types.h"
|
|
||||||
#include "core/tls.h"
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#include <windows.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace Core {
|
|
||||||
|
|
||||||
thread_local u8 TLS[1024];
|
|
||||||
|
|
||||||
struct TLSPattern {
|
|
||||||
uint8_t pattern[5];
|
|
||||||
uint8_t pattern_size;
|
|
||||||
uint8_t imm_size;
|
|
||||||
uint8_t target_reg;
|
|
||||||
};
|
|
||||||
|
|
||||||
constexpr static TLSPattern TlsPatterns[] = {
|
|
||||||
{{0x64, 0x48, 0xA1},
|
|
||||||
3,
|
|
||||||
8,
|
|
||||||
0}, // 64 48 A1 | 00 00 00 00 00 00 00 00 # mov rax, qword ptr fs:[64b imm]
|
|
||||||
|
|
||||||
{{0x64, 0x48, 0x8B, 0x4, 0x25},
|
|
||||||
5,
|
|
||||||
4,
|
|
||||||
0}, // 64 48 8B 04 25 | 00 00 00 00 # mov rax,qword ptr fs:[0]
|
|
||||||
{{0x64, 0x48, 0x8B, 0xC, 0x25}, 5, 4, 1}, // rcx
|
|
||||||
{{0x64, 0x48, 0x8B, 0x14, 0x25}, 5, 4, 2}, // rdx
|
|
||||||
{{0x64, 0x48, 0x8B, 0x1C, 0x25}, 5, 4, 3}, // rbx
|
|
||||||
{{0x64, 0x48, 0x8B, 0x24, 0x25}, 5, 4, 4}, // rsp
|
|
||||||
{{0x64, 0x48, 0x8B, 0x2C, 0x25}, 5, 4, 5}, // rbp
|
|
||||||
{{0x64, 0x48, 0x8B, 0x34, 0x25}, 5, 4, 6}, // rsi
|
|
||||||
{{0x64, 0x48, 0x8B, 0x3C, 0x25}, 5, 4, 7}, // rdi
|
|
||||||
{{0x64, 0x4C, 0x8B, 0x4, 0x25}, 5, 4, 8}, // r8
|
|
||||||
{{0x64, 0x4C, 0x8B, 0xC, 0x25}, 5, 4, 9}, // r9
|
|
||||||
{{0x64, 0x4C, 0x8B, 0x14, 0x25}, 5, 4, 10}, // r10
|
|
||||||
{{0x64, 0x4C, 0x8B, 0x1C, 0x25}, 5, 4, 11}, // r11
|
|
||||||
{{0x64, 0x4C, 0x8B, 0x24, 0x25}, 5, 4, 12}, // r12
|
|
||||||
{{0x64, 0x4C, 0x8B, 0x2C, 0x25}, 5, 4, 13}, // r13
|
|
||||||
{{0x64, 0x4C, 0x8B, 0x34, 0x25}, 5, 4, 14}, // r14
|
|
||||||
{{0x64, 0x4C, 0x8B, 0x3C, 0x25}, 5, 4, 15}, // r15
|
|
||||||
};
|
|
||||||
|
|
||||||
uintptr_t GetGuestTls(s64 tls_offset) {
|
|
||||||
if (tls_offset == 0) {
|
|
||||||
return reinterpret_cast<uintptr_t>(TLS);
|
|
||||||
}
|
|
||||||
UNREACHABLE_MSG("Unimplemented offset info tls");
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef _WIN64
|
|
||||||
static LONG WINAPI ExceptionHandler(PEXCEPTION_POINTERS pExp) noexcept {
|
|
||||||
auto orig_rip = pExp->ContextRecord->Rip;
|
|
||||||
while (*(u8*)pExp->ContextRecord->Rip == 0x66) {
|
|
||||||
pExp->ContextRecord->Rip++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*(u8*)pExp->ContextRecord->Rip == 0xcd) {
|
|
||||||
int reg = *(u8*)(pExp->ContextRecord->Rip + 1) - 0x80;
|
|
||||||
int sizes = *(u8*)(pExp->ContextRecord->Rip + 2);
|
|
||||||
int pattern_size = sizes & 0xF;
|
|
||||||
int imm_size = sizes >> 4;
|
|
||||||
|
|
||||||
int64_t tls_offset;
|
|
||||||
if (imm_size == 4) {
|
|
||||||
tls_offset = *(s32*)(pExp->ContextRecord->Rip + pattern_size);
|
|
||||||
} else {
|
|
||||||
tls_offset = *(s64*)(pExp->ContextRecord->Rip + pattern_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
(&pExp->ContextRecord->Rax)[reg] = GetGuestTls(tls_offset); /* GetGuestTls */
|
|
||||||
pExp->ContextRecord->Rip += pattern_size + imm_size;
|
|
||||||
|
|
||||||
return EXCEPTION_CONTINUE_EXECUTION;
|
|
||||||
}
|
|
||||||
|
|
||||||
pExp->ContextRecord->Rip = orig_rip;
|
|
||||||
const u32 ec = pExp->ExceptionRecord->ExceptionCode;
|
|
||||||
switch (ec) {
|
|
||||||
case EXCEPTION_ACCESS_VIOLATION: {
|
|
||||||
LOG_CRITICAL(Core, "Exception EXCEPTION_ACCESS_VIOLATION ({:#x})", ec);
|
|
||||||
const auto info = pExp->ExceptionRecord->ExceptionInformation;
|
|
||||||
switch (info[0]) {
|
|
||||||
case 0:
|
|
||||||
LOG_CRITICAL(Core, "Read violation at address {:#x}", info[1]);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
LOG_CRITICAL(Core, "Write violation at address {:#x}", info[1]);
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
LOG_CRITICAL(Core, "DEP violation at address {:#x}", info[1]);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
|
|
||||||
LOG_CRITICAL(Core, "Exception EXCEPTION_ARRAY_BOUNDS_EXCEEDED ({:#x})", ec);
|
|
||||||
break;
|
|
||||||
case EXCEPTION_DATATYPE_MISALIGNMENT:
|
|
||||||
LOG_CRITICAL(Core, "Exception EXCEPTION_DATATYPE_MISALIGNMENT ({:#x})", ec);
|
|
||||||
break;
|
|
||||||
case EXCEPTION_FLT_DIVIDE_BY_ZERO:
|
|
||||||
LOG_CRITICAL(Core, "Exception EXCEPTION_FLT_DIVIDE_BY_ZERO ({:#x})", ec);
|
|
||||||
break;
|
|
||||||
case EXCEPTION_ILLEGAL_INSTRUCTION:
|
|
||||||
LOG_CRITICAL(Core, "Exception EXCEPTION_ILLEGAL_INSTRUCTION ({:#x})", ec);
|
|
||||||
break;
|
|
||||||
case EXCEPTION_IN_PAGE_ERROR:
|
|
||||||
LOG_CRITICAL(Core, "Exception EXCEPTION_IN_PAGE_ERROR ({:#x})", ec);
|
|
||||||
break;
|
|
||||||
case EXCEPTION_INT_DIVIDE_BY_ZERO:
|
|
||||||
LOG_CRITICAL(Core, "Exception EXCEPTION_INT_DIVIDE_BY_ZERO ({:#x})", ec);
|
|
||||||
break;
|
|
||||||
case EXCEPTION_PRIV_INSTRUCTION:
|
|
||||||
LOG_CRITICAL(Core, "Exception EXCEPTION_PRIV_INSTRUCTION ({:#x})", ec);
|
|
||||||
break;
|
|
||||||
case EXCEPTION_STACK_OVERFLOW:
|
|
||||||
LOG_CRITICAL(Core, "Exception EXCEPTION_STACK_OVERFLOW ({:#x})", ec);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return EXCEPTION_CONTINUE_SEARCH;
|
|
||||||
}
|
|
||||||
return EXCEPTION_CONTINUE_SEARCH;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void InstallTlsHandler() {
|
|
||||||
#ifdef _WIN64
|
|
||||||
if (!AddVectoredExceptionHandler(0, ExceptionHandler)) {
|
|
||||||
LOG_CRITICAL(Core, "Failed to register an exception handler");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void PatchTLS(u64 segment_addr, u64 segment_size) {
|
|
||||||
u8* code = reinterpret_cast<u8*>(segment_addr);
|
|
||||||
auto remaining_size = segment_size;
|
|
||||||
|
|
||||||
while (remaining_size) {
|
|
||||||
for (const auto& tls_pattern : TlsPatterns) {
|
|
||||||
const auto total_size = tls_pattern.pattern_size + tls_pattern.imm_size;
|
|
||||||
if (remaining_size < total_size) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (std::memcmp(code, tls_pattern.pattern, tls_pattern.pattern_size) != 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (tls_pattern.imm_size == 4) {
|
|
||||||
LOG_INFO(Core_Linker, "PATTERN32 FOUND at {}, reg: {} offset: {:#x}",
|
|
||||||
fmt::ptr(code), tls_pattern.target_reg,
|
|
||||||
*(u32*)(code + tls_pattern.pattern_size));
|
|
||||||
} else {
|
|
||||||
LOG_INFO(Core_Linker, "PATTERN64 FOUND at {}, reg: {} offset: {:#x}",
|
|
||||||
fmt::ptr(code), tls_pattern.target_reg,
|
|
||||||
*(u32*)(code + tls_pattern.pattern_size));
|
|
||||||
}
|
|
||||||
code[0] = 0xcd;
|
|
||||||
code[1] = 0x80 + tls_pattern.target_reg;
|
|
||||||
code[2] = tls_pattern.pattern_size | (tls_pattern.imm_size << 4);
|
|
||||||
code += total_size - 1;
|
|
||||||
remaining_size -= total_size - 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
code++;
|
|
||||||
remaining_size--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Core
|
|
|
@ -1,16 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "common/types.h"
|
|
||||||
|
|
||||||
namespace Core {
|
|
||||||
|
|
||||||
/// Installs a host exception handler to handle guest TLS access.
|
|
||||||
void InstallTlsHandler();
|
|
||||||
|
|
||||||
/// Patches any instructions that access TLS to trigger the exception handler.
|
|
||||||
void PatchTLS(u64 segment_addr, u64 segment_size);
|
|
||||||
|
|
||||||
} // namespace Core
|
|
|
@ -1,11 +1,10 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/error.h"
|
|
||||||
#include "common/logging/log.h"
|
|
||||||
#include "core/virtual_memory.h"
|
#include "core/virtual_memory.h"
|
||||||
|
|
||||||
|
#include "common/log.h"
|
||||||
|
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#else
|
#else
|
||||||
|
@ -73,7 +72,7 @@ u64 memory_alloc(u64 address, u64 size, MemoryMode mode) {
|
||||||
|
|
||||||
if (ptr == 0) {
|
if (ptr == 0) {
|
||||||
auto err = static_cast<u32>(GetLastError());
|
auto err = static_cast<u32>(GetLastError());
|
||||||
LOG_ERROR(Common_Memory, "VirtualAlloc() failed: 0x{:X}", err);
|
LOG_ERROR_IF(true, "VirtualAlloc() failed: 0x{:X}\n", err);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
auto ptr = reinterpret_cast<uintptr_t>(
|
auto ptr = reinterpret_cast<uintptr_t>(
|
||||||
|
@ -81,7 +80,7 @@ u64 memory_alloc(u64 address, u64 size, MemoryMode mode) {
|
||||||
PROT_EXEC | PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0));
|
PROT_EXEC | PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0));
|
||||||
|
|
||||||
if (ptr == reinterpret_cast<uintptr_t> MAP_FAILED) {
|
if (ptr == reinterpret_cast<uintptr_t> MAP_FAILED) {
|
||||||
LOG_ERROR(Common_Memory, "mmap() failed: {}", std::strerror(errno));
|
LOG_ERROR_IF(true, "mmap() failed: {}\n", std::strerror(errno));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return ptr;
|
return ptr;
|
||||||
|
@ -92,7 +91,7 @@ bool memory_protect(u64 address, u64 size, MemoryMode mode, MemoryMode* old_mode
|
||||||
if (VirtualProtect(reinterpret_cast<LPVOID>(static_cast<uintptr_t>(address)), size,
|
if (VirtualProtect(reinterpret_cast<LPVOID>(static_cast<uintptr_t>(address)), size,
|
||||||
convertMemoryMode(mode), &old_protect) == 0) {
|
convertMemoryMode(mode), &old_protect) == 0) {
|
||||||
auto err = static_cast<u32>(GetLastError());
|
auto err = static_cast<u32>(GetLastError());
|
||||||
LOG_ERROR(Common_Memory, "VirtualProtect() failed: 0x{:X}", err);
|
LOG_ERROR_IF(true, "VirtualProtect() failed: 0x{:X}\n", err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (old_mode != nullptr) {
|
if (old_mode != nullptr) {
|
||||||
|
@ -101,10 +100,6 @@ bool memory_protect(u64 address, u64 size, MemoryMode mode, MemoryMode* old_mode
|
||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
int ret = mprotect(reinterpret_cast<void*>(address), size, convertMemoryMode(mode));
|
int ret = mprotect(reinterpret_cast<void*>(address), size, convertMemoryMode(mode));
|
||||||
if (ret != 0) {
|
|
||||||
const auto error = Common::GetLastErrorMsg();
|
|
||||||
ASSERT(false);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -115,7 +110,7 @@ bool memory_flush(u64 address, u64 size) {
|
||||||
reinterpret_cast<LPVOID>(static_cast<uintptr_t>(address)),
|
reinterpret_cast<LPVOID>(static_cast<uintptr_t>(address)),
|
||||||
size) == 0) {
|
size) == 0) {
|
||||||
auto err = static_cast<u32>(GetLastError());
|
auto err = static_cast<u32>(GetLastError());
|
||||||
LOG_ERROR(Common_Memory, "FlushInstructionCache() failed: 0x{:X}", err);
|
LOG_ERROR_IF(true, "FlushInstructionCache() failed: 0x{:X}\n", err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -125,7 +120,7 @@ bool memory_flush(u64 address, u64 size) {
|
||||||
}
|
}
|
||||||
bool memory_patch(u64 vaddr, u64 value) {
|
bool memory_patch(u64 vaddr, u64 value) {
|
||||||
MemoryMode old_mode{};
|
MemoryMode old_mode{};
|
||||||
// memory_protect(vaddr, 8, MemoryMode::ReadWrite, &old_mode);
|
memory_protect(vaddr, 8, MemoryMode::ReadWrite, &old_mode);
|
||||||
|
|
||||||
auto* ptr = reinterpret_cast<uint64_t*>(vaddr);
|
auto* ptr = reinterpret_cast<uint64_t*>(vaddr);
|
||||||
|
|
||||||
|
@ -133,7 +128,7 @@ bool memory_patch(u64 vaddr, u64 value) {
|
||||||
|
|
||||||
*ptr = value;
|
*ptr = value;
|
||||||
|
|
||||||
// memory_protect(vaddr, 8, old_mode, nullptr);
|
memory_protect(vaddr, 8, old_mode, nullptr);
|
||||||
|
|
||||||
// if mode is executable flush it so insure that cpu finds it
|
// if mode is executable flush it so insure that cpu finds it
|
||||||
if (containsExecuteMode(old_mode)) {
|
if (containsExecuteMode(old_mode)) {
|
||||||
|
@ -166,13 +161,15 @@ u64 memory_alloc_aligned(u64 address, u64 size, MemoryMode mode, u64 alignment)
|
||||||
|
|
||||||
if (ptr == 0) {
|
if (ptr == 0) {
|
||||||
auto err = static_cast<u32>(GetLastError());
|
auto err = static_cast<u32>(GetLastError());
|
||||||
LOG_ERROR(Common_Memory, "VirtualAlloc2() failed: 0x{:X}", err);
|
LOG_ERROR_IF(true, "VirtualAlloc2() failed: 0x{:X}\n", err);
|
||||||
}
|
}
|
||||||
return ptr;
|
return ptr;
|
||||||
#else
|
#else
|
||||||
void* hint_address = reinterpret_cast<void*>(AlignUp(address, alignment));
|
void* hint_address = reinterpret_cast<void*>(AlignUp(address, alignment));
|
||||||
void* ptr = mmap(hint_address, size, convertMemoryMode(mode), MAP_ANON | MAP_PRIVATE, -1, 0);
|
void* ptr = mmap(hint_address, size, convertMemoryMode(mode), MAP_ANON | MAP_PRIVATE, -1, 0);
|
||||||
ASSERT(ptr != MAP_FAILED);
|
if (ptr == MAP_FAILED) {
|
||||||
|
std::abort();
|
||||||
|
}
|
||||||
return reinterpret_cast<u64>(ptr);
|
return reinterpret_cast<u64>(ptr);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,6 +197,7 @@ void emuRun() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
std::exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
HLE::Libs::Graphics::GraphicCtx* getGraphicCtx() {
|
HLE::Libs::Graphics::GraphicCtx* getGraphicCtx() {
|
||||||
|
|
15
src/main.cpp
15
src/main.cpp
|
@ -12,15 +12,13 @@
|
||||||
#include <core/hle/libraries/libkernel/thread_management.h>
|
#include <core/hle/libraries/libkernel/thread_management.h>
|
||||||
#include "Util/config.h"
|
#include "Util/config.h"
|
||||||
#include "common/discord.h"
|
#include "common/discord.h"
|
||||||
#include "common/logging/backend.h"
|
#include "common/log.h"
|
||||||
#include "common/path_util.h"
|
|
||||||
#include "common/singleton.h"
|
#include "common/singleton.h"
|
||||||
#include "common/types.h"
|
#include "common/types.h"
|
||||||
#include "core/PS4/HLE/Graphics/video_out.h"
|
#include "core/PS4/HLE/Graphics/video_out.h"
|
||||||
#include "core/file_sys/fs.h"
|
#include "core/file_sys/fs.h"
|
||||||
#include "core/hle/libraries/libs.h"
|
#include "core/hle/libraries/libs.h"
|
||||||
#include "core/linker.h"
|
#include "core/linker.h"
|
||||||
#include "core/tls.h"
|
|
||||||
#include "emulator.h"
|
#include "emulator.h"
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
|
@ -28,10 +26,8 @@ int main(int argc, char* argv[]) {
|
||||||
fmt::print("Usage: {} <elf or eboot.bin path>\n", argv[0]);
|
fmt::print("Usage: {} <elf or eboot.bin path>\n", argv[0]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
const auto config_dir = Common::FS::GetUserPath(Common::FS::PathType::UserDir);
|
Config::load("config.toml");
|
||||||
Config::load(config_dir / "config.toml");
|
Common::Log::Init(true);
|
||||||
Common::Log::Initialize();
|
|
||||||
Common::Log::Start();
|
|
||||||
Core::Libraries::LibKernel::init_pthreads();
|
Core::Libraries::LibKernel::init_pthreads();
|
||||||
auto width = Config::getScreenWidth();
|
auto width = Config::getScreenWidth();
|
||||||
auto height = Config::getScreenHeight();
|
auto height = Config::getScreenHeight();
|
||||||
|
@ -43,11 +39,10 @@ int main(int argc, char* argv[]) {
|
||||||
|
|
||||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||||
std::filesystem::path p = std::string(path);
|
std::filesystem::path p = std::string(path);
|
||||||
mnt->Mount(p.parent_path(), "/app0");
|
mnt->mount(p.parent_path().string(), "/app0");
|
||||||
|
|
||||||
auto linker = Common::Singleton<Core::Linker>::Instance();
|
auto linker = Common::Singleton<Core::Linker>::Instance();
|
||||||
Core::Libraries::InitHLELibs(&linker->getHLESymbols());
|
OldLibraries::InitHLELibs(&linker->getHLESymbols());
|
||||||
Core::InstallTlsHandler();
|
|
||||||
linker->LoadModule(path);
|
linker->LoadModule(path);
|
||||||
std::jthread mainthread([linker](std::stop_token stop_token, void*) { linker->Execute(); },
|
std::jthread mainthread([linker](std::stop_token stop_token, void*) { linker->Execute(); },
|
||||||
nullptr);
|
nullptr);
|
||||||
|
|
|
@ -6,14 +6,15 @@
|
||||||
#include <fmt/core.h>
|
#include <fmt/core.h>
|
||||||
#include <vulkan/vk_enum_string_helper.h>
|
#include <vulkan/vk_enum_string_helper.h>
|
||||||
#include <vulkan/vulkan_core.h>
|
#include <vulkan/vulkan_core.h>
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/log.h"
|
||||||
#include "common/singleton.h"
|
#include "common/singleton.h"
|
||||||
#include "vulkan_util.h"
|
#include "vulkan_util.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
constexpr bool log_file_vulkanutil = true; // disable it to disable logging
|
||||||
|
|
||||||
void Graphics::Vulkan::vulkanCreate(Emu::WindowCtx* ctx) {
|
void Graphics::Vulkan::vulkanCreate(Emu::WindowCtx* ctx) {
|
||||||
Emu::VulkanExt ext;
|
Emu::VulkanExt ext;
|
||||||
vulkanGetInstanceExtensions(&ext);
|
vulkanGetInstanceExtensions(&ext);
|
||||||
|
@ -37,12 +38,19 @@ void Graphics::Vulkan::vulkanCreate(Emu::WindowCtx* ctx) {
|
||||||
inst_info.enabledLayerCount = 0;
|
inst_info.enabledLayerCount = 0;
|
||||||
inst_info.ppEnabledLayerNames = nullptr;
|
inst_info.ppEnabledLayerNames = nullptr;
|
||||||
|
|
||||||
const VkResult result = vkCreateInstance(&inst_info, nullptr, &ctx->m_graphic_ctx.m_instance);
|
VkResult result = vkCreateInstance(&inst_info, nullptr, &ctx->m_graphic_ctx.m_instance);
|
||||||
ASSERT_MSG(result == VK_SUCCESS, "Can't create an vulkan instance");
|
if (result == VK_ERROR_INCOMPATIBLE_DRIVER) {
|
||||||
|
LOG_CRITICAL_IF(log_file_vulkanutil, "Can't find an compatiblie vulkan driver\n");
|
||||||
|
std::exit(0);
|
||||||
|
} else if (result != VK_SUCCESS) {
|
||||||
|
LOG_CRITICAL_IF(log_file_vulkanutil, "Can't create an vulkan instance\n");
|
||||||
|
std::exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
if (SDL_Vulkan_CreateSurface(ctx->m_window, ctx->m_graphic_ctx.m_instance, &ctx->m_surface) ==
|
if (SDL_Vulkan_CreateSurface(ctx->m_window, ctx->m_graphic_ctx.m_instance, &ctx->m_surface) ==
|
||||||
SDL_FALSE) {
|
SDL_FALSE) {
|
||||||
UNREACHABLE_MSG("Can't create an vulkan surface");
|
LOG_CRITICAL_IF(log_file_vulkanutil, "Can't create an vulkan surface\n");
|
||||||
|
std::exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO i am not sure if it's that it is neccesary or if it needs more
|
// TODO i am not sure if it's that it is neccesary or if it needs more
|
||||||
|
@ -56,16 +64,22 @@ void Graphics::Vulkan::vulkanCreate(Emu::WindowCtx* ctx) {
|
||||||
device_extensions, &ctx->m_surface_capabilities,
|
device_extensions, &ctx->m_surface_capabilities,
|
||||||
&ctx->m_graphic_ctx.m_physical_device, &queues);
|
&ctx->m_graphic_ctx.m_physical_device, &queues);
|
||||||
|
|
||||||
ASSERT_MSG(ctx->m_graphic_ctx.m_physical_device, "Can't find compatible vulkan device");
|
if (ctx->m_graphic_ctx.m_physical_device == nullptr) {
|
||||||
|
LOG_CRITICAL_IF(log_file_vulkanutil, "Can't find compatible vulkan device\n");
|
||||||
|
std::exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
VkPhysicalDeviceProperties device_properties{};
|
VkPhysicalDeviceProperties device_properties{};
|
||||||
vkGetPhysicalDeviceProperties(ctx->m_graphic_ctx.m_physical_device, &device_properties);
|
vkGetPhysicalDeviceProperties(ctx->m_graphic_ctx.m_physical_device, &device_properties);
|
||||||
|
|
||||||
LOG_INFO(Render_Vulkan, "GFX device to be used : {}", device_properties.deviceName);
|
LOG_INFO_IF(log_file_vulkanutil, "GFX device to be used : {}\n", device_properties.deviceName);
|
||||||
|
|
||||||
ctx->m_graphic_ctx.m_device = vulkanCreateDevice(
|
ctx->m_graphic_ctx.m_device = vulkanCreateDevice(
|
||||||
ctx->m_graphic_ctx.m_physical_device, ctx->m_surface, &ext, queues, device_extensions);
|
ctx->m_graphic_ctx.m_physical_device, ctx->m_surface, &ext, queues, device_extensions);
|
||||||
ASSERT_MSG(ctx->m_graphic_ctx.m_device, "Can't create vulkan device");
|
if (ctx->m_graphic_ctx.m_device == nullptr) {
|
||||||
|
LOG_CRITICAL_IF(log_file_vulkanutil, "Can't create vulkan device\n");
|
||||||
|
std::exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
vulkanCreateQueues(&ctx->m_graphic_ctx, queues);
|
vulkanCreateQueues(&ctx->m_graphic_ctx, queues);
|
||||||
ctx->swapchain = vulkanCreateSwapchain(&ctx->m_graphic_ctx, 2);
|
ctx->swapchain = vulkanCreateSwapchain(&ctx->m_graphic_ctx, 2);
|
||||||
|
@ -146,8 +160,11 @@ Emu::VulkanSwapchain Graphics::Vulkan::vulkanCreateSwapchain(HLE::Libs::Graphics
|
||||||
|
|
||||||
vkCreateImageView(ctx->m_device, &create_info, nullptr, &s.swapchain_image_views[i]);
|
vkCreateImageView(ctx->m_device, &create_info, nullptr, &s.swapchain_image_views[i]);
|
||||||
}
|
}
|
||||||
|
if (s.swapchain == nullptr) {
|
||||||
|
LOG_CRITICAL_IF(log_file_vulkanutil, "Could not create swapchain\n");
|
||||||
|
std::exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
ASSERT_MSG(s.swapchain, "Could not create swapchain");
|
|
||||||
s.current_index = static_cast<uint32_t>(-1);
|
s.current_index = static_cast<uint32_t>(-1);
|
||||||
|
|
||||||
VkSemaphoreCreateInfo present_complete_info{};
|
VkSemaphoreCreateInfo present_complete_info{};
|
||||||
|
@ -164,7 +181,10 @@ Emu::VulkanSwapchain Graphics::Vulkan::vulkanCreateSwapchain(HLE::Libs::Graphics
|
||||||
fence_info.flags = 0;
|
fence_info.flags = 0;
|
||||||
|
|
||||||
result = vkCreateFence(ctx->m_device, &fence_info, nullptr, &s.present_complete_fence);
|
result = vkCreateFence(ctx->m_device, &fence_info, nullptr, &s.present_complete_fence);
|
||||||
ASSERT_MSG(result == VK_SUCCESS, "Can't create vulkan fence");
|
if (result != VK_SUCCESS) {
|
||||||
|
LOG_CRITICAL_IF(log_file_vulkanutil, "Can't create vulkan fence\n");
|
||||||
|
std::exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
@ -262,18 +282,18 @@ void Graphics::Vulkan::vulkanGetInstanceExtensions(Emu::VulkanExt* ext) {
|
||||||
vkEnumerateInstanceLayerProperties(&available_layers_count, ext->available_layers.data());
|
vkEnumerateInstanceLayerProperties(&available_layers_count, ext->available_layers.data());
|
||||||
|
|
||||||
for (const char* ext : ext->required_extensions) {
|
for (const char* ext : ext->required_extensions) {
|
||||||
LOG_INFO(Render_Vulkan, "Vulkan required extension = {}", ext);
|
LOG_INFO_IF(log_file_vulkanutil, "Vulkan required extension = {}\n", ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto& ext : ext->available_extensions) {
|
for (const auto& ext : ext->available_extensions) {
|
||||||
LOG_INFO(Render_Vulkan, "Vulkan available extension: {}, version = {}", ext.extensionName,
|
LOG_INFO_IF(log_file_vulkanutil, "Vulkan available extension: {}, version = {}\n",
|
||||||
ext.specVersion);
|
ext.extensionName, ext.specVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto& l : ext->available_layers) {
|
for (const auto& l : ext->available_layers) {
|
||||||
LOG_INFO(Render_Vulkan,
|
LOG_INFO_IF(log_file_vulkanutil,
|
||||||
"Vulkan available layer: {}, specVersion = {}, implVersion = {}, {}", l.layerName,
|
"Vulkan available layer: {}, specVersion = {}, implVersion = {}, {}\n",
|
||||||
l.specVersion, l.implementationVersion, l.description);
|
l.layerName, l.specVersion, l.implementationVersion, l.description);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,7 +320,7 @@ void Graphics::Vulkan::vulkanFindCompatiblePhysicalDevice(
|
||||||
continue; // we don't want integrated gpu for now .Later we will check the requirements
|
continue; // we don't want integrated gpu for now .Later we will check the requirements
|
||||||
// and see what we can support (TODO fix me)
|
// and see what we can support (TODO fix me)
|
||||||
}
|
}
|
||||||
LOG_INFO(Render_Vulkan, "Vulkan device: {}", device_properties.deviceName);
|
LOG_INFO_IF(log_file_vulkanutil, "Vulkan device: {}\n", device_properties.deviceName);
|
||||||
|
|
||||||
auto qs = vulkanFindQueues(device, surface);
|
auto qs = vulkanFindQueues(device, surface);
|
||||||
|
|
||||||
|
@ -329,7 +349,7 @@ Emu::VulkanQueues Graphics::Vulkan::vulkanFindQueues(VkPhysicalDevice device,
|
||||||
VkBool32 presentation_supported = VK_FALSE;
|
VkBool32 presentation_supported = VK_FALSE;
|
||||||
vkGetPhysicalDeviceSurfaceSupportKHR(device, family, surface, &presentation_supported);
|
vkGetPhysicalDeviceSurfaceSupportKHR(device, family, surface, &presentation_supported);
|
||||||
|
|
||||||
LOG_INFO(Render_Vulkan, "queue family: {}, count = {}, present = {}",
|
LOG_INFO_IF(log_file_vulkanutil, "queue family: {}, count = {}, present = {}\n",
|
||||||
string_VkQueueFlags(f.queueFlags).c_str(), f.queueCount,
|
string_VkQueueFlags(f.queueFlags).c_str(), f.queueCount,
|
||||||
(presentation_supported == VK_TRUE ? "true" : "false"));
|
(presentation_supported == VK_TRUE ? "true" : "false"));
|
||||||
for (uint32_t i = 0; i < f.queueCount; i++) {
|
for (uint32_t i = 0; i < f.queueCount; i++) {
|
||||||
|
|
|
@ -12,10 +12,16 @@ add_subdirectory(fmt EXCLUDE_FROM_ALL)
|
||||||
# MagicEnum
|
# MagicEnum
|
||||||
add_subdirectory(magic_enum EXCLUDE_FROM_ALL)
|
add_subdirectory(magic_enum EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
if(NOT ENABLE_QT_GUI)
|
# Spdlog
|
||||||
|
set(SPDLOG_WCHAR_FILENAMES ON CACHE BOOL "")
|
||||||
|
set(SPDLOG_NO_THREAD_ID ON CACHE BOOL "")
|
||||||
|
set(SPDLOG_FMT_EXTERNAL ON CACHE BOOL "")
|
||||||
|
add_subdirectory(spdlog EXCLUDE_FROM_ALL)
|
||||||
|
add_library(stb INTERFACE)
|
||||||
|
target_include_directories(stb INTERFACE ./stb)
|
||||||
|
|
||||||
# SDL3
|
# SDL3
|
||||||
add_subdirectory(SDL EXCLUDE_FROM_ALL)
|
add_subdirectory(SDL EXCLUDE_FROM_ALL)
|
||||||
endif()
|
|
||||||
|
|
||||||
# Toml11
|
# Toml11
|
||||||
add_subdirectory(toml11 EXCLUDE_FROM_ALL)
|
add_subdirectory(toml11 EXCLUDE_FROM_ALL)
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 5532231bbc31bbdf95ac15febdac0413ee1d07ad
|
|
@ -0,0 +1,210 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
// Generated By moduleGenerator
|
||||||
|
#include "libscecommondialog.h"
|
||||||
|
#include "common/log.h"
|
||||||
|
#include "error_codes.h"
|
||||||
|
|
||||||
|
namespace Libraries::CommonDialog{
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZN3sce16CommonDialogUtil12getSelfAppIdEv()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZN3sce16CommonDialogUtil6Client11closeModuleEv()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZN3sce16CommonDialogUtil6Client11updateStateEv()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZN3sce16CommonDialogUtil6Client15launchCmnDialogEv()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZN3sce16CommonDialogUtil6ClientD0Ev()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZN3sce16CommonDialogUtil6ClientD1Ev()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZN3sce16CommonDialogUtil6ClientD2Ev()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZNK3sce16CommonDialogUtil6Client10isCloseReqEv()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZNK3sce16CommonDialogUtil6Client13getFinishDataEPvm()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZNK3sce16CommonDialogUtil6Client14getClientStateEv()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZNK3sce16CommonDialogUtil6Client19isInitializedStatusEv()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZNK3sce16CommonDialogUtil6Client8getAppIdEv()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZNK3sce16CommonDialogUtil6Client8isFinishEv()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZNK3sce16CommonDialogUtil6Client9getResultEv()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZTVN3sce16CommonDialogUtil6ClientE()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI sceCommonDialogInitialize()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI sceCommonDialogIsUsed()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI Func_0FF577E4E8457883()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI Func_41716C2CE379416C()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI Func_483A427D8F6E0748()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI Func_6944B83E02727BDF()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI Func_69F2DD23A8B4950C()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI Func_9954673DEAC170AD()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI Func_A7D4D3AB86CB7455()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI Func_ADE4C51256B8350C()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI Func_B71349CF15FACAB0()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI Func_CB18E00EFA946C64()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI Func_F2AEE270605622B0()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RegisterlibSceCommonDialog(Core::Loader::SymbolsResolver * sym) {
|
||||||
|
LIB_FUNCTION("2RdicdHhtGA", "libSceCommonDialog" , 1 , "libSceCommonDialog", 1, 1 , _ZN3sce16CommonDialogUtil12getSelfAppIdEv );
|
||||||
|
LIB_FUNCTION("I+tdxsCap08", "libSceCommonDialog" , 1 , "libSceCommonDialog", 1, 1 , _ZN3sce16CommonDialogUtil6Client11closeModuleEv );
|
||||||
|
LIB_FUNCTION("v4+gzuTkv6k", "libSceCommonDialog" , 1 , "libSceCommonDialog", 1, 1 , _ZN3sce16CommonDialogUtil6Client11updateStateEv );
|
||||||
|
LIB_FUNCTION("CwCzG0nnLg8", "libSceCommonDialog" , 1 , "libSceCommonDialog", 1, 1 , _ZN3sce16CommonDialogUtil6Client15launchCmnDialogEv );
|
||||||
|
LIB_FUNCTION("Ib1SMmbr07k", "libSceCommonDialog" , 1 , "libSceCommonDialog", 1, 1 , _ZN3sce16CommonDialogUtil6ClientD0Ev );
|
||||||
|
LIB_FUNCTION("6TIMpGvsrC4", "libSceCommonDialog" , 1 , "libSceCommonDialog", 1, 1 , _ZN3sce16CommonDialogUtil6ClientD1Ev );
|
||||||
|
LIB_FUNCTION("+UyKxWAnqIU", "libSceCommonDialog" , 1 , "libSceCommonDialog", 1, 1 , _ZN3sce16CommonDialogUtil6ClientD2Ev );
|
||||||
|
LIB_FUNCTION("bUCx72-9f0g", "libSceCommonDialog" , 1 , "libSceCommonDialog", 1, 1 , _ZNK3sce16CommonDialogUtil6Client10isCloseReqEv );
|
||||||
|
LIB_FUNCTION("xZtXq554Lbg", "libSceCommonDialog" , 1 , "libSceCommonDialog", 1, 1 , _ZNK3sce16CommonDialogUtil6Client13getFinishDataEPvm );
|
||||||
|
LIB_FUNCTION("C-EZ3PkhibQ", "libSceCommonDialog" , 1 , "libSceCommonDialog", 1, 1 , _ZNK3sce16CommonDialogUtil6Client14getClientStateEv );
|
||||||
|
LIB_FUNCTION("70niEKUAnZ0", "libSceCommonDialog" , 1 , "libSceCommonDialog", 1, 1 , _ZNK3sce16CommonDialogUtil6Client19isInitializedStatusEv );
|
||||||
|
LIB_FUNCTION("mdJgdwoM0Mo", "libSceCommonDialog" , 1 , "libSceCommonDialog", 1, 1 , _ZNK3sce16CommonDialogUtil6Client8getAppIdEv );
|
||||||
|
LIB_FUNCTION("87GekE1nowg", "libSceCommonDialog" , 1 , "libSceCommonDialog", 1, 1 , _ZNK3sce16CommonDialogUtil6Client8isFinishEv );
|
||||||
|
LIB_FUNCTION("6ljeTSi+fjs", "libSceCommonDialog" , 1 , "libSceCommonDialog", 1, 1 , _ZNK3sce16CommonDialogUtil6Client9getResultEv );
|
||||||
|
LIB_FUNCTION("W2MzrWix2mM", "libSceCommonDialog" , 1 , "libSceCommonDialog", 1, 1 , _ZTVN3sce16CommonDialogUtil6ClientE );
|
||||||
|
LIB_FUNCTION("uoUpLGNkygk", "libSceCommonDialog" , 1 , "libSceCommonDialog", 1, 1 , sceCommonDialogInitialize );
|
||||||
|
LIB_FUNCTION("BQ3tey0JmQM", "libSceCommonDialog" , 1 , "libSceCommonDialog", 1, 1 , sceCommonDialogIsUsed );
|
||||||
|
LIB_FUNCTION("D-V35OhFeIM", "libSceCommonDialog" , 1 , "libSceCommonDialog", 1, 1 , Func_0FF577E4E8457883 );
|
||||||
|
LIB_FUNCTION("QXFsLON5QWw", "libSceCommonDialog" , 1 , "libSceCommonDialog", 1, 1 , Func_41716C2CE379416C );
|
||||||
|
LIB_FUNCTION("SDpCfY9uB0g", "libSceCommonDialog" , 1 , "libSceCommonDialog", 1, 1 , Func_483A427D8F6E0748 );
|
||||||
|
LIB_FUNCTION("aUS4PgJye98", "libSceCommonDialog" , 1 , "libSceCommonDialog", 1, 1 , Func_6944B83E02727BDF );
|
||||||
|
LIB_FUNCTION("afLdI6i0lQw", "libSceCommonDialog" , 1 , "libSceCommonDialog", 1, 1 , Func_69F2DD23A8B4950C );
|
||||||
|
LIB_FUNCTION("mVRnPerBcK0", "libSceCommonDialog" , 1 , "libSceCommonDialog", 1, 1 , Func_9954673DEAC170AD );
|
||||||
|
LIB_FUNCTION("p9TTq4bLdFU", "libSceCommonDialog" , 1 , "libSceCommonDialog", 1, 1 , Func_A7D4D3AB86CB7455 );
|
||||||
|
LIB_FUNCTION("reTFEla4NQw", "libSceCommonDialog" , 1 , "libSceCommonDialog", 1, 1 , Func_ADE4C51256B8350C );
|
||||||
|
LIB_FUNCTION("txNJzxX6yrA", "libSceCommonDialog" , 1 , "libSceCommonDialog", 1, 1 , Func_B71349CF15FACAB0 );
|
||||||
|
LIB_FUNCTION("yxjgDvqUbGQ", "libSceCommonDialog" , 1 , "libSceCommonDialog", 1, 1 , Func_CB18E00EFA946C64 );
|
||||||
|
LIB_FUNCTION("8q7icGBWIrA", "libSceCommonDialog" , 1 , "libSceCommonDialog", 1, 1 , Func_F2AEE270605622B0 );
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "library_common.h"
|
||||||
|
|
||||||
|
namespace Libraries::CommonDialog{
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI _ZN3sce16CommonDialogUtil12getSelfAppIdEv();
|
||||||
|
int PS4_SYSV_ABI _ZN3sce16CommonDialogUtil6Client11closeModuleEv();
|
||||||
|
int PS4_SYSV_ABI _ZN3sce16CommonDialogUtil6Client11updateStateEv();
|
||||||
|
int PS4_SYSV_ABI _ZN3sce16CommonDialogUtil6Client15launchCmnDialogEv();
|
||||||
|
int PS4_SYSV_ABI _ZN3sce16CommonDialogUtil6ClientD0Ev();
|
||||||
|
int PS4_SYSV_ABI _ZN3sce16CommonDialogUtil6ClientD1Ev();
|
||||||
|
int PS4_SYSV_ABI _ZN3sce16CommonDialogUtil6ClientD2Ev();
|
||||||
|
int PS4_SYSV_ABI _ZNK3sce16CommonDialogUtil6Client10isCloseReqEv();
|
||||||
|
int PS4_SYSV_ABI _ZNK3sce16CommonDialogUtil6Client13getFinishDataEPvm();
|
||||||
|
int PS4_SYSV_ABI _ZNK3sce16CommonDialogUtil6Client14getClientStateEv();
|
||||||
|
int PS4_SYSV_ABI _ZNK3sce16CommonDialogUtil6Client19isInitializedStatusEv();
|
||||||
|
int PS4_SYSV_ABI _ZNK3sce16CommonDialogUtil6Client8getAppIdEv();
|
||||||
|
int PS4_SYSV_ABI _ZNK3sce16CommonDialogUtil6Client8isFinishEv();
|
||||||
|
int PS4_SYSV_ABI _ZNK3sce16CommonDialogUtil6Client9getResultEv();
|
||||||
|
int PS4_SYSV_ABI _ZTVN3sce16CommonDialogUtil6ClientE();
|
||||||
|
int PS4_SYSV_ABI sceCommonDialogInitialize();
|
||||||
|
int PS4_SYSV_ABI sceCommonDialogIsUsed();
|
||||||
|
int PS4_SYSV_ABI Func_0FF577E4E8457883();
|
||||||
|
int PS4_SYSV_ABI Func_41716C2CE379416C();
|
||||||
|
int PS4_SYSV_ABI Func_483A427D8F6E0748();
|
||||||
|
int PS4_SYSV_ABI Func_6944B83E02727BDF();
|
||||||
|
int PS4_SYSV_ABI Func_69F2DD23A8B4950C();
|
||||||
|
int PS4_SYSV_ABI Func_9954673DEAC170AD();
|
||||||
|
int PS4_SYSV_ABI Func_A7D4D3AB86CB7455();
|
||||||
|
int PS4_SYSV_ABI Func_ADE4C51256B8350C();
|
||||||
|
int PS4_SYSV_ABI Func_B71349CF15FACAB0();
|
||||||
|
int PS4_SYSV_ABI Func_CB18E00EFA946C64();
|
||||||
|
int PS4_SYSV_ABI Func_F2AEE270605622B0();
|
||||||
|
|
||||||
|
void RegisterlibSceCommonDialog(Core::Loader::SymbolsResolver * sym);
|
||||||
|
}
|
|
@ -0,0 +1,84 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
// Generated By moduleGenerator
|
||||||
|
#include "libscemsgdialog.h"
|
||||||
|
#include "common/log.h"
|
||||||
|
#include "error_codes.h"
|
||||||
|
|
||||||
|
namespace Libraries::MsgDialog{
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogClose()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogGetResult()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogGetStatus()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogInitialize()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogOpen()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogProgressBarInc()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogProgressBarSetMsg()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogProgressBarSetValue()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogTerminate()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogUpdateStatus()
|
||||||
|
{
|
||||||
|
PRINT_UNIMPLEMENTED_FUNCTION_NAME();
|
||||||
|
return ORBIS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RegisterlibSceMsgDialog(Core::Loader::SymbolsResolver * sym) {
|
||||||
|
LIB_FUNCTION("HTrcDKlFKuM", "libSceMsgDialog" , 1 , "libSceMsgDialog", 1, 1 , sceMsgDialogClose );
|
||||||
|
LIB_FUNCTION("Lr8ovHH9l6A", "libSceMsgDialog" , 1 , "libSceMsgDialog", 1, 1 , sceMsgDialogGetResult );
|
||||||
|
LIB_FUNCTION("CWVW78Qc3fI", "libSceMsgDialog" , 1 , "libSceMsgDialog", 1, 1 , sceMsgDialogGetStatus );
|
||||||
|
LIB_FUNCTION("lDqxaY1UbEo", "libSceMsgDialog" , 1 , "libSceMsgDialog", 1, 1 , sceMsgDialogInitialize );
|
||||||
|
LIB_FUNCTION("b06Hh0DPEaE", "libSceMsgDialog" , 1 , "libSceMsgDialog", 1, 1 , sceMsgDialogOpen );
|
||||||
|
LIB_FUNCTION("Gc5k1qcK4fs", "libSceMsgDialog" , 1 , "libSceMsgDialog", 1, 1 , sceMsgDialogProgressBarInc );
|
||||||
|
LIB_FUNCTION("6H-71OdrpXM", "libSceMsgDialog" , 1 , "libSceMsgDialog", 1, 1 , sceMsgDialogProgressBarSetMsg );
|
||||||
|
LIB_FUNCTION("wTpfglkmv34", "libSceMsgDialog" , 1 , "libSceMsgDialog", 1, 1 , sceMsgDialogProgressBarSetValue );
|
||||||
|
LIB_FUNCTION("ePw-kqZmelo", "libSceMsgDialog" , 1 , "libSceMsgDialog", 1, 1 , sceMsgDialogTerminate );
|
||||||
|
LIB_FUNCTION("6fIC3XKt2k0", "libSceMsgDialog" , 1 , "libSceMsgDialog", 1, 1 , sceMsgDialogUpdateStatus );
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "library_common.h"
|
||||||
|
|
||||||
|
namespace Libraries::MsgDialog{
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogClose();
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogGetResult();
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogGetStatus();
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogInitialize();
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogOpen();
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogProgressBarInc();
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogProgressBarSetMsg();
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogProgressBarSetValue();
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogTerminate();
|
||||||
|
int PS4_SYSV_ABI sceMsgDialogUpdateStatus();
|
||||||
|
|
||||||
|
void RegisterlibSceMsgDialog(Core::Loader::SymbolsResolver * sym);
|
||||||
|
}
|
|
@ -166,7 +166,8 @@ int main(int argc, char* argv[]) {
|
||||||
modules_to_generate.push_back(std::string("libSceVideoOut"));
|
modules_to_generate.push_back(std::string("libSceVideoOut"));
|
||||||
modules_to_generate.push_back(std::string("libkernel"));
|
modules_to_generate.push_back(std::string("libkernel"));
|
||||||
modules_to_generate.push_back(std::string("libSceSystemService"));
|
modules_to_generate.push_back(std::string("libSceSystemService"));
|
||||||
modules_to_generate.push_back(std::string("libSceUserService"));
|
modules_to_generate.push_back(std::string("libSceCommonDialog"));
|
||||||
|
modules_to_generate.push_back(std::string("libSceMsgDialog"));
|
||||||
GetSymbolsFromLibDoc(modules_to_generate);
|
GetSymbolsFromLibDoc(modules_to_generate);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue