Merge branch 'shadps4-emu:main' into Cheats_Patches
This commit is contained in:
commit
7717e09959
|
@ -95,10 +95,6 @@ check_symbol_exists(pthread_mutex_timedlock "pthread.h" HAVE_PTHREAD_MUTEX_TIMED
|
||||||
if(HAVE_PTHREAD_MUTEX_TIMEDLOCK OR WIN32)
|
if(HAVE_PTHREAD_MUTEX_TIMEDLOCK OR WIN32)
|
||||||
add_compile_options(-DHAVE_PTHREAD_MUTEX_TIMEDLOCK)
|
add_compile_options(-DHAVE_PTHREAD_MUTEX_TIMEDLOCK)
|
||||||
endif()
|
endif()
|
||||||
check_symbol_exists(sem_timedwait "semaphore.h" HAVE_SEM_TIMEDWAIT)
|
|
||||||
if(HAVE_SEM_TIMEDWAIT OR WIN32)
|
|
||||||
add_compile_options(-DHAVE_SEM_TIMEDWAIT)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||||
# libc++ requires -fexperimental-library to enable std::jthread and std::stop_token support.
|
# libc++ requires -fexperimental-library to enable std::jthread and std::stop_token support.
|
||||||
|
@ -152,6 +148,7 @@ set(AUDIO_LIB src/core/libraries/audio/audioin.cpp
|
||||||
|
|
||||||
set(GNM_LIB src/core/libraries/gnmdriver/gnmdriver.cpp
|
set(GNM_LIB src/core/libraries/gnmdriver/gnmdriver.cpp
|
||||||
src/core/libraries/gnmdriver/gnmdriver.h
|
src/core/libraries/gnmdriver/gnmdriver.h
|
||||||
|
src/core/libraries/gnmdriver/gnm_error.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(KERNEL_LIB
|
set(KERNEL_LIB
|
||||||
|
@ -233,6 +230,7 @@ set(SYSTEM_LIBS src/core/libraries/system/commondialog.cpp
|
||||||
src/core/libraries/ngs2/ngs2_error.h
|
src/core/libraries/ngs2/ngs2_error.h
|
||||||
src/core/libraries/ngs2/ngs2_impl.cpp
|
src/core/libraries/ngs2/ngs2_impl.cpp
|
||||||
src/core/libraries/ngs2/ngs2_impl.h
|
src/core/libraries/ngs2/ngs2_impl.h
|
||||||
|
src/core/libraries/ajm/ajm_error.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(VIDEOOUT_LIB src/core/libraries/videoout/buffer.h
|
set(VIDEOOUT_LIB src/core/libraries/videoout/buffer.h
|
||||||
|
@ -268,6 +266,7 @@ set(PLAYGO_LIB src/core/libraries/playgo/playgo.cpp
|
||||||
|
|
||||||
set(RANDOM_LIB src/core/libraries/random/random.cpp
|
set(RANDOM_LIB src/core/libraries/random/random.cpp
|
||||||
src/core/libraries/random/random.h
|
src/core/libraries/random/random.h
|
||||||
|
src/core/libraries/random/random_error.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(USBD_LIB src/core/libraries/usbd/usbd.cpp
|
set(USBD_LIB src/core/libraries/usbd/usbd.cpp
|
||||||
|
|
|
@ -17,34 +17,53 @@ Note: **ARM64 is not supported!** As of writing, it will not build nor run. The
|
||||||
Once you are within the installer:
|
Once you are within the installer:
|
||||||
1. Select `Desktop development with C++`
|
1. Select `Desktop development with C++`
|
||||||
2. Go to "Individual Components" tab
|
2. Go to "Individual Components" tab
|
||||||
3. Make sure `C++ Clang Compiler for Windows`, `MSBuild support for LLVM` and `C++ CMake Tools for Windows` are selected
|
3. Search and select `C++ Clang Compiler for Windows` and `MSBuild support for LLVM`
|
||||||
4. Continue the installation
|
4. Continue the installation
|
||||||
|
|
||||||
### (Prerequisite) Download [**Qt**](https://doc.qt.io/qt-6/get-and-install-qt.html)
|
### (Prerequisite) Download [**Qt**](https://doc.qt.io/qt-6/get-and-install-qt.html)
|
||||||
|
|
||||||
Beware, this requires you to create a Qt account. If you do not want to do this, please follow the MSYS2/MinGW compilation method instead.
|
Beware, this requires you to create a Qt account. If you do not want to do this, please follow the MSYS2/MinGW compilation method instead.
|
||||||
|
|
||||||
1. Select Qt for Visual Studio plugin
|
1. Under the current, non beta version of Qt (at the time of writing 6.7.2), select the option `MSVC 2019 64-bit` or similar.
|
||||||
2. Select `msvc2019_64` option or similar. If you are on Windows on ARM / Qualcomm Snapdragon Elite X, select `msvc2019_arm64`
|
If you are on Windows on ARM / Qualcomm Snapdragon Elite X, select `MSVC 2019 ARM64` instead.
|
||||||
|
|
||||||
Go through the installation normally. If you do not know what components to select, just select the newest Qt version it gives you.
|
Go through the installation normally. If you know what you are doing, you may unselect individual components that eat up too much disk space.
|
||||||
If you know what you are doing, you may unselect individual components that eat up too much disk space.
|
|
||||||
|
|
||||||
|
2. Download and install [Qt Visual Studio Tools](https://marketplace.visualstudio.com/items?itemName=TheQtCompany.QtVisualStudioTools2022)
|
||||||
|
|
||||||
Once you are finished, you will have to configure Qt within Visual Studio:
|
Once you are finished, you will have to configure Qt within Visual Studio:
|
||||||
1. Tools -> Options -> Qt -> Versions
|
1. Tools -> Options -> Qt -> Versions
|
||||||
2. Add a new Qt version and navigate it to the correct folder. Should look like so: `C:\Qt\6.7.1\msvc2019_64`
|
2. Add a new Qt version and navigate it to the correct folder. Should look like so: `C:\Qt\6.7.2\msvc2019_64`
|
||||||
3. Enable the default checkmark on the new version you just created.
|
3. Enable the default checkmark on the new version you just created.
|
||||||
|
|
||||||
### (Prerequisite) Download [**Git for Windows**](https://git-scm.com/download/win)
|
### (Prerequisite) Download [**Git for Windows**](https://git-scm.com/download/win)
|
||||||
|
|
||||||
Go through the Git for Windows installation as normal
|
Go through the Git for Windows installation as normal
|
||||||
|
|
||||||
### Compiling with Visual Studio GUI
|
### Cloning the source code
|
||||||
|
|
||||||
1. Open Git for Windows, navigate to a place where you want to store the shadPS4 source code folder
|
1. Open Git for Windows, navigate to a place where you want to store the shadPS4 source code folder
|
||||||
2. Run `git clone --depth 1 --recursive https://github.com/shadps4-emu/shadPS4`
|
2. Clone the repository by running
|
||||||
3. Open up Visual Studio, select `Open a local folder` and select the folder with the shadPS4 source code. The folder should contain `CMakeLists.txt`
|
`git clone --depth 1 --recursive https://github.com/shadps4-emu/shadPS4`
|
||||||
4. Build -> Build All
|
|
||||||
|
### Compiling with Visual Studio GUI
|
||||||
|
|
||||||
|
1. Open up Visual Studio, select `Open a local folder` and select the folder with the shadPS4 source code. The folder should contain `CMakeLists.txt`
|
||||||
|
2. Change x64-Clang-Debug to x64-Clang-Release if you want a regular, non-debug build.
|
||||||
|
3. If you want to build shadPS4 with the Qt Gui:
|
||||||
|
1. Click x64-Clang-Release and select "Manage Configurations"
|
||||||
|
2. Look for "CMake command arguments" and add to the text field
|
||||||
|
`-DENABLE_QT_GUI=ON -DCMAKE_PREFIX_PATH=C:\Qt\6.7.2\msvc2019_64`
|
||||||
|
(Change Qt path if you've installed it to non-default path)
|
||||||
|
3. Press CTRL+S to save and wait a moment for CMake generation
|
||||||
|
4. Change the project to build to shadps4.exe
|
||||||
|
5. Build -> Build All
|
||||||
|
|
||||||
|
Your shadps4.exe will be in `c:\path\to\source\Build\x64-Clang-Release\`
|
||||||
|
|
||||||
|
To automatically populate the necessary files to run shadPS4.exe, run in a command prompt or terminal:
|
||||||
|
`C:\Qt\6.7.2\msvc2019_64\bin\windeployqt.exe c:\path\to\shadps4.exe`
|
||||||
|
(Change Qt path if you've installed it to non-default path)
|
||||||
|
|
||||||
## Option 2: MSYS2/MinGW
|
## Option 2: MSYS2/MinGW
|
||||||
|
|
||||||
|
|
|
@ -17,9 +17,12 @@ static s32 gpuId = -1; // Vulkan physical device index. Set to negative for auto
|
||||||
static std::string logFilter;
|
static std::string logFilter;
|
||||||
static std::string logType = "async";
|
static std::string logType = "async";
|
||||||
static std::string userName = "shadPS4";
|
static std::string userName = "shadPS4";
|
||||||
|
static bool useSpecialPad = false;
|
||||||
|
static int specialPadClass = 1;
|
||||||
static bool isDebugDump = false;
|
static bool isDebugDump = false;
|
||||||
static bool isShowSplash = false;
|
static bool isShowSplash = false;
|
||||||
static bool isNullGpu = false;
|
static bool isNullGpu = false;
|
||||||
|
static bool shouldCopyGPUBuffers = false;
|
||||||
static bool shouldDumpShaders = false;
|
static bool shouldDumpShaders = false;
|
||||||
static bool shouldDumpPM4 = false;
|
static bool shouldDumpPM4 = false;
|
||||||
static u32 vblankDivider = 1;
|
static u32 vblankDivider = 1;
|
||||||
|
@ -81,6 +84,14 @@ std::string getUserName() {
|
||||||
return userName;
|
return userName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool getUseSpecialPad() {
|
||||||
|
return useSpecialPad;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getSpecialPadClass() {
|
||||||
|
return specialPadClass;
|
||||||
|
}
|
||||||
|
|
||||||
bool debugDump() {
|
bool debugDump() {
|
||||||
return isDebugDump;
|
return isDebugDump;
|
||||||
}
|
}
|
||||||
|
@ -93,6 +104,10 @@ bool nullGpu() {
|
||||||
return isNullGpu;
|
return isNullGpu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool copyGPUCmdBuffers() {
|
||||||
|
return shouldCopyGPUBuffers;
|
||||||
|
}
|
||||||
|
|
||||||
bool dumpShaders() {
|
bool dumpShaders() {
|
||||||
return shouldDumpShaders;
|
return shouldDumpShaders;
|
||||||
}
|
}
|
||||||
|
@ -149,6 +164,10 @@ void setNullGpu(bool enable) {
|
||||||
isNullGpu = enable;
|
isNullGpu = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setCopyGPUCmdBuffers(bool enable) {
|
||||||
|
shouldCopyGPUBuffers = enable;
|
||||||
|
}
|
||||||
|
|
||||||
void setDumpShaders(bool enable) {
|
void setDumpShaders(bool enable) {
|
||||||
shouldDumpShaders = enable;
|
shouldDumpShaders = enable;
|
||||||
}
|
}
|
||||||
|
@ -197,6 +216,14 @@ void setUserName(const std::string& type) {
|
||||||
userName = type;
|
userName = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setUseSpecialPad(bool use) {
|
||||||
|
useSpecialPad = use;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setSpecialPadClass(int type) {
|
||||||
|
specialPadClass = type;
|
||||||
|
}
|
||||||
|
|
||||||
void setMainWindowGeometry(u32 x, u32 y, u32 w, u32 h) {
|
void setMainWindowGeometry(u32 x, u32 y, u32 w, u32 h) {
|
||||||
main_window_geometry_x = x;
|
main_window_geometry_x = x;
|
||||||
main_window_geometry_y = y;
|
main_window_geometry_y = y;
|
||||||
|
@ -330,12 +357,20 @@ void load(const std::filesystem::path& path) {
|
||||||
isShowSplash = toml::find_or<bool>(general, "showSplash", true);
|
isShowSplash = toml::find_or<bool>(general, "showSplash", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data.contains("Input")) {
|
||||||
|
const toml::value& input = data.at("Input");
|
||||||
|
|
||||||
|
useSpecialPad = toml::find_or<bool>(input, "useSpecialPad", false);
|
||||||
|
specialPadClass = toml::find_or<int>(input, "specialPadClass", 1);
|
||||||
|
}
|
||||||
|
|
||||||
if (data.contains("GPU")) {
|
if (data.contains("GPU")) {
|
||||||
const toml::value& gpu = data.at("GPU");
|
const toml::value& gpu = data.at("GPU");
|
||||||
|
|
||||||
screenWidth = toml::find_or<int>(gpu, "screenWidth", screenWidth);
|
screenWidth = toml::find_or<int>(gpu, "screenWidth", screenWidth);
|
||||||
screenHeight = toml::find_or<int>(gpu, "screenHeight", screenHeight);
|
screenHeight = toml::find_or<int>(gpu, "screenHeight", screenHeight);
|
||||||
isNullGpu = toml::find_or<bool>(gpu, "nullGpu", false);
|
isNullGpu = toml::find_or<bool>(gpu, "nullGpu", false);
|
||||||
|
shouldCopyGPUBuffers = toml::find_or<bool>(gpu, "copyGPUBuffers", false);
|
||||||
shouldDumpShaders = toml::find_or<bool>(gpu, "dumpShaders", false);
|
shouldDumpShaders = toml::find_or<bool>(gpu, "dumpShaders", false);
|
||||||
shouldDumpPM4 = toml::find_or<bool>(gpu, "dumpPM4", false);
|
shouldDumpPM4 = toml::find_or<bool>(gpu, "dumpPM4", false);
|
||||||
vblankDivider = toml::find_or<int>(gpu, "vblankDivider", 1);
|
vblankDivider = toml::find_or<int>(gpu, "vblankDivider", 1);
|
||||||
|
@ -411,9 +446,12 @@ void save(const std::filesystem::path& path) {
|
||||||
data["General"]["logType"] = logType;
|
data["General"]["logType"] = logType;
|
||||||
data["General"]["userName"] = userName;
|
data["General"]["userName"] = userName;
|
||||||
data["General"]["showSplash"] = isShowSplash;
|
data["General"]["showSplash"] = isShowSplash;
|
||||||
|
data["Input"]["useSpecialPad"] = useSpecialPad;
|
||||||
|
data["Input"]["specialPadClass"] = specialPadClass;
|
||||||
data["GPU"]["screenWidth"] = screenWidth;
|
data["GPU"]["screenWidth"] = screenWidth;
|
||||||
data["GPU"]["screenHeight"] = screenHeight;
|
data["GPU"]["screenHeight"] = screenHeight;
|
||||||
data["GPU"]["nullGpu"] = isNullGpu;
|
data["GPU"]["nullGpu"] = isNullGpu;
|
||||||
|
data["GPU"]["copyGPUBuffers"] = shouldCopyGPUBuffers;
|
||||||
data["GPU"]["dumpShaders"] = shouldDumpShaders;
|
data["GPU"]["dumpShaders"] = shouldDumpShaders;
|
||||||
data["GPU"]["dumpPM4"] = shouldDumpPM4;
|
data["GPU"]["dumpPM4"] = shouldDumpPM4;
|
||||||
data["GPU"]["vblankDivider"] = vblankDivider;
|
data["GPU"]["vblankDivider"] = vblankDivider;
|
||||||
|
@ -457,6 +495,8 @@ void setDefaultValues() {
|
||||||
logFilter = "";
|
logFilter = "";
|
||||||
logType = "async";
|
logType = "async";
|
||||||
userName = "shadPS4";
|
userName = "shadPS4";
|
||||||
|
useSpecialPad = false;
|
||||||
|
specialPadClass = 1;
|
||||||
isDebugDump = false;
|
isDebugDump = false;
|
||||||
isShowSplash = false;
|
isShowSplash = false;
|
||||||
isNullGpu = false;
|
isNullGpu = false;
|
||||||
|
|
|
@ -17,6 +17,9 @@ std::string getLogFilter();
|
||||||
std::string getLogType();
|
std::string getLogType();
|
||||||
std::string getUserName();
|
std::string getUserName();
|
||||||
|
|
||||||
|
bool getUseSpecialPad();
|
||||||
|
int getSpecialPadClass();
|
||||||
|
|
||||||
u32 getScreenWidth();
|
u32 getScreenWidth();
|
||||||
u32 getScreenHeight();
|
u32 getScreenHeight();
|
||||||
s32 getGpuId();
|
s32 getGpuId();
|
||||||
|
@ -24,6 +27,7 @@ s32 getGpuId();
|
||||||
bool debugDump();
|
bool debugDump();
|
||||||
bool showSplash();
|
bool showSplash();
|
||||||
bool nullGpu();
|
bool nullGpu();
|
||||||
|
bool copyGPUCmdBuffers();
|
||||||
bool dumpShaders();
|
bool dumpShaders();
|
||||||
bool dumpPM4();
|
bool dumpPM4();
|
||||||
bool isRdocEnabled();
|
bool isRdocEnabled();
|
||||||
|
@ -33,6 +37,7 @@ u32 vblankDiv();
|
||||||
void setDebugDump(bool enable);
|
void setDebugDump(bool enable);
|
||||||
void setShowSplash(bool enable);
|
void setShowSplash(bool enable);
|
||||||
void setNullGpu(bool enable);
|
void setNullGpu(bool enable);
|
||||||
|
void setCopyGPUCmdBuffers(bool enable);
|
||||||
void setDumpShaders(bool enable);
|
void setDumpShaders(bool enable);
|
||||||
void setDumpPM4(bool enable);
|
void setDumpPM4(bool enable);
|
||||||
void setVblankDiv(u32 value);
|
void setVblankDiv(u32 value);
|
||||||
|
@ -44,6 +49,9 @@ void setLanguage(u32 language);
|
||||||
void setNeoMode(bool enable);
|
void setNeoMode(bool enable);
|
||||||
void setUserName(const std::string& type);
|
void setUserName(const std::string& type);
|
||||||
|
|
||||||
|
void setUseSpecialPad(bool use);
|
||||||
|
void setSpecialPadClass(int type);
|
||||||
|
|
||||||
void setLogType(const std::string& type);
|
void setLogType(const std::string& type);
|
||||||
void setLogFilter(const std::string& type);
|
void setLogFilter(const std::string& type);
|
||||||
|
|
||||||
|
|
|
@ -6,18 +6,18 @@
|
||||||
|
|
||||||
CryptoPP::RSA::PrivateKey Crypto::key_pkg_derived_key3_keyset_init() {
|
CryptoPP::RSA::PrivateKey Crypto::key_pkg_derived_key3_keyset_init() {
|
||||||
CryptoPP::InvertibleRSAFunction params;
|
CryptoPP::InvertibleRSAFunction params;
|
||||||
params.SetPrime1(CryptoPP::Integer(pkg_derived_key3_keyset.Prime1, 0x80));
|
params.SetPrime1(CryptoPP::Integer(PkgDerivedKey3Keyset::Prime1, 0x80));
|
||||||
params.SetPrime2(CryptoPP::Integer(pkg_derived_key3_keyset.Prime2, 0x80));
|
params.SetPrime2(CryptoPP::Integer(PkgDerivedKey3Keyset::Prime2, 0x80));
|
||||||
|
|
||||||
params.SetPublicExponent(CryptoPP::Integer(pkg_derived_key3_keyset.PublicExponent, 4));
|
params.SetPublicExponent(CryptoPP::Integer(PkgDerivedKey3Keyset::PublicExponent, 4));
|
||||||
params.SetPrivateExponent(CryptoPP::Integer(pkg_derived_key3_keyset.PrivateExponent, 0x100));
|
params.SetPrivateExponent(CryptoPP::Integer(PkgDerivedKey3Keyset::PrivateExponent, 0x100));
|
||||||
|
|
||||||
params.SetModPrime1PrivateExponent(CryptoPP::Integer(pkg_derived_key3_keyset.Exponent1, 0x80));
|
params.SetModPrime1PrivateExponent(CryptoPP::Integer(PkgDerivedKey3Keyset::Exponent1, 0x80));
|
||||||
params.SetModPrime2PrivateExponent(CryptoPP::Integer(pkg_derived_key3_keyset.Exponent2, 0x80));
|
params.SetModPrime2PrivateExponent(CryptoPP::Integer(PkgDerivedKey3Keyset::Exponent2, 0x80));
|
||||||
|
|
||||||
params.SetModulus(CryptoPP::Integer(pkg_derived_key3_keyset.Modulus, 0x100));
|
params.SetModulus(CryptoPP::Integer(PkgDerivedKey3Keyset::Modulus, 0x100));
|
||||||
params.SetMultiplicativeInverseOfPrime2ModPrime1(
|
params.SetMultiplicativeInverseOfPrime2ModPrime1(
|
||||||
CryptoPP::Integer(pkg_derived_key3_keyset.Coefficient, 0x80));
|
CryptoPP::Integer(PkgDerivedKey3Keyset::Coefficient, 0x80));
|
||||||
|
|
||||||
CryptoPP::RSA::PrivateKey privateKey(params);
|
CryptoPP::RSA::PrivateKey privateKey(params);
|
||||||
|
|
||||||
|
@ -26,18 +26,18 @@ CryptoPP::RSA::PrivateKey Crypto::key_pkg_derived_key3_keyset_init() {
|
||||||
|
|
||||||
CryptoPP::RSA::PrivateKey Crypto::FakeKeyset_keyset_init() {
|
CryptoPP::RSA::PrivateKey Crypto::FakeKeyset_keyset_init() {
|
||||||
CryptoPP::InvertibleRSAFunction params;
|
CryptoPP::InvertibleRSAFunction params;
|
||||||
params.SetPrime1(CryptoPP::Integer(FakeKeyset_keyset.Prime1, 0x80));
|
params.SetPrime1(CryptoPP::Integer(FakeKeyset::Prime1, 0x80));
|
||||||
params.SetPrime2(CryptoPP::Integer(FakeKeyset_keyset.Prime2, 0x80));
|
params.SetPrime2(CryptoPP::Integer(FakeKeyset::Prime2, 0x80));
|
||||||
|
|
||||||
params.SetPublicExponent(CryptoPP::Integer(FakeKeyset_keyset.PublicExponent, 4));
|
params.SetPublicExponent(CryptoPP::Integer(FakeKeyset::PublicExponent, 4));
|
||||||
params.SetPrivateExponent(CryptoPP::Integer(FakeKeyset_keyset.PrivateExponent, 0x100));
|
params.SetPrivateExponent(CryptoPP::Integer(FakeKeyset::PrivateExponent, 0x100));
|
||||||
|
|
||||||
params.SetModPrime1PrivateExponent(CryptoPP::Integer(FakeKeyset_keyset.Exponent1, 0x80));
|
params.SetModPrime1PrivateExponent(CryptoPP::Integer(FakeKeyset::Exponent1, 0x80));
|
||||||
params.SetModPrime2PrivateExponent(CryptoPP::Integer(FakeKeyset_keyset.Exponent2, 0x80));
|
params.SetModPrime2PrivateExponent(CryptoPP::Integer(FakeKeyset::Exponent2, 0x80));
|
||||||
|
|
||||||
params.SetModulus(CryptoPP::Integer(FakeKeyset_keyset.Modulus, 0x100));
|
params.SetModulus(CryptoPP::Integer(FakeKeyset::Modulus, 0x100));
|
||||||
params.SetMultiplicativeInverseOfPrime2ModPrime1(
|
params.SetMultiplicativeInverseOfPrime2ModPrime1(
|
||||||
CryptoPP::Integer(FakeKeyset_keyset.Coefficient, 0x80));
|
CryptoPP::Integer(FakeKeyset::Coefficient, 0x80));
|
||||||
|
|
||||||
CryptoPP::RSA::PrivateKey privateKey(params);
|
CryptoPP::RSA::PrivateKey privateKey(params);
|
||||||
|
|
||||||
|
@ -46,25 +46,22 @@ CryptoPP::RSA::PrivateKey Crypto::FakeKeyset_keyset_init() {
|
||||||
|
|
||||||
CryptoPP::RSA::PrivateKey Crypto::DebugRifKeyset_init() {
|
CryptoPP::RSA::PrivateKey Crypto::DebugRifKeyset_init() {
|
||||||
CryptoPP::InvertibleRSAFunction params;
|
CryptoPP::InvertibleRSAFunction params;
|
||||||
params.SetPrime1(
|
params.SetPrime1(CryptoPP::Integer(DebugRifKeyset::Prime1, sizeof(DebugRifKeyset::Prime1)));
|
||||||
CryptoPP::Integer(DebugRifKeyset_keyset.Prime1, sizeof(DebugRifKeyset_keyset.Prime1)));
|
params.SetPrime2(CryptoPP::Integer(DebugRifKeyset::Prime2, sizeof(DebugRifKeyset::Prime2)));
|
||||||
params.SetPrime2(
|
|
||||||
CryptoPP::Integer(DebugRifKeyset_keyset.Prime2, sizeof(DebugRifKeyset_keyset.Prime2)));
|
|
||||||
|
|
||||||
params.SetPublicExponent(CryptoPP::Integer(DebugRifKeyset_keyset.PublicExponent,
|
params.SetPublicExponent(
|
||||||
sizeof(DebugRifKeyset_keyset.PublicExponent)));
|
CryptoPP::Integer(DebugRifKeyset::PublicExponent, sizeof(DebugRifKeyset::PublicExponent)));
|
||||||
params.SetPrivateExponent(CryptoPP::Integer(DebugRifKeyset_keyset.PrivateExponent,
|
params.SetPrivateExponent(CryptoPP::Integer(DebugRifKeyset::PrivateExponent,
|
||||||
sizeof(DebugRifKeyset_keyset.PrivateExponent)));
|
sizeof(DebugRifKeyset::PrivateExponent)));
|
||||||
|
|
||||||
params.SetModPrime1PrivateExponent(CryptoPP::Integer(DebugRifKeyset_keyset.Exponent1,
|
params.SetModPrime1PrivateExponent(
|
||||||
sizeof(DebugRifKeyset_keyset.Exponent1)));
|
CryptoPP::Integer(DebugRifKeyset::Exponent1, sizeof(DebugRifKeyset::Exponent1)));
|
||||||
params.SetModPrime2PrivateExponent(CryptoPP::Integer(DebugRifKeyset_keyset.Exponent2,
|
params.SetModPrime2PrivateExponent(
|
||||||
sizeof(DebugRifKeyset_keyset.Exponent2)));
|
CryptoPP::Integer(DebugRifKeyset::Exponent2, sizeof(DebugRifKeyset::Exponent2)));
|
||||||
|
|
||||||
params.SetModulus(
|
params.SetModulus(CryptoPP::Integer(DebugRifKeyset::Modulus, sizeof(DebugRifKeyset::Modulus)));
|
||||||
CryptoPP::Integer(DebugRifKeyset_keyset.Modulus, sizeof(DebugRifKeyset_keyset.Modulus)));
|
params.SetMultiplicativeInverseOfPrime2ModPrime1(
|
||||||
params.SetMultiplicativeInverseOfPrime2ModPrime1(CryptoPP::Integer(
|
CryptoPP::Integer(DebugRifKeyset::Coefficient, sizeof(DebugRifKeyset::Coefficient)));
|
||||||
DebugRifKeyset_keyset.Coefficient, sizeof(DebugRifKeyset_keyset.Coefficient)));
|
|
||||||
|
|
||||||
CryptoPP::RSA::PrivateKey privateKey(params);
|
CryptoPP::RSA::PrivateKey privateKey(params);
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,6 @@
|
||||||
|
|
||||||
class Crypto {
|
class Crypto {
|
||||||
public:
|
public:
|
||||||
PkgDerivedKey3Keyset pkg_derived_key3_keyset;
|
|
||||||
FakeKeyset FakeKeyset_keyset;
|
|
||||||
DebugRifKeyset DebugRifKeyset_keyset;
|
|
||||||
|
|
||||||
CryptoPP::RSA::PrivateKey key_pkg_derived_key3_keyset_init();
|
CryptoPP::RSA::PrivateKey key_pkg_derived_key3_keyset_init();
|
||||||
CryptoPP::RSA::PrivateKey FakeKeyset_keyset_init();
|
CryptoPP::RSA::PrivateKey FakeKeyset_keyset_init();
|
||||||
CryptoPP::RSA::PrivateKey DebugRifKeyset_init();
|
CryptoPP::RSA::PrivateKey DebugRifKeyset_init();
|
||||||
|
|
|
@ -7,384 +7,299 @@
|
||||||
class FakeKeyset {
|
class FakeKeyset {
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
const CryptoPP::byte* Exponent1;
|
static constexpr CryptoPP::byte Exponent1[] = {
|
||||||
|
0x6D, 0x48, 0xE0, 0x54, 0x40, 0x25, 0xC8, 0x41, 0x29, 0x52, 0x42, 0x27, 0xEB, 0xD2, 0xC7,
|
||||||
|
0xAB, 0x6B, 0x9C, 0x27, 0x0A, 0xB4, 0x1F, 0x94, 0x4E, 0xFA, 0x42, 0x1D, 0xB7, 0xBC, 0xB9,
|
||||||
|
0xAE, 0xBC, 0x04, 0x6F, 0x75, 0x8F, 0x10, 0x5F, 0x89, 0xAC, 0xAB, 0x9C, 0xD2, 0xFA, 0xE6,
|
||||||
|
0xA4, 0x13, 0x83, 0x68, 0xD4, 0x56, 0x38, 0xFE, 0xE5, 0x2B, 0x78, 0x44, 0x9C, 0x34, 0xE6,
|
||||||
|
0x5A, 0xA0, 0xBE, 0x05, 0x70, 0xAD, 0x15, 0xC3, 0x2D, 0x31, 0xAC, 0x97, 0x5D, 0x88, 0xFC,
|
||||||
|
0xC1, 0x62, 0x3D, 0xE2, 0xED, 0x11, 0xDB, 0xB6, 0x9E, 0xFC, 0x5A, 0x5A, 0x03, 0xF6, 0xCF,
|
||||||
|
0x08, 0xD4, 0x5D, 0x90, 0xC9, 0x2A, 0xB9, 0x9B, 0xCF, 0xC8, 0x1A, 0x65, 0xF3, 0x5B, 0xE8,
|
||||||
|
0x7F, 0xCF, 0xA5, 0xA6, 0x4C, 0x5C, 0x2A, 0x12, 0x0F, 0x92, 0xA5, 0xE3, 0xF0, 0x17, 0x1E,
|
||||||
|
0x9A, 0x97, 0x45, 0x86, 0xFD, 0xDB, 0x54, 0x25};
|
||||||
// exponent2 = d mod (q - 1)
|
// exponent2 = d mod (q - 1)
|
||||||
const CryptoPP::byte* Exponent2;
|
static constexpr CryptoPP::byte Exponent2[] = {
|
||||||
|
0x2A, 0x51, 0xCE, 0x02, 0x44, 0x28, 0x50, 0xE8, 0x30, 0x20, 0x7C, 0x9C, 0x55, 0xBF, 0x60,
|
||||||
|
0x39, 0xBC, 0xD1, 0xF0, 0xE7, 0x68, 0xF8, 0x08, 0x5B, 0x61, 0x1F, 0xA7, 0xBF, 0xD0, 0xE8,
|
||||||
|
0x8B, 0xB5, 0xB1, 0xD5, 0xD9, 0x16, 0xAC, 0x75, 0x0C, 0x6D, 0xF2, 0xE0, 0xB5, 0x97, 0x75,
|
||||||
|
0xD2, 0x68, 0x16, 0x1F, 0x00, 0x7D, 0x8B, 0x17, 0xE8, 0x78, 0x48, 0x41, 0x71, 0x2B, 0x18,
|
||||||
|
0x96, 0x80, 0x11, 0xDB, 0x68, 0x39, 0x9C, 0xD6, 0xE0, 0x72, 0x42, 0x86, 0xF0, 0x1B, 0x16,
|
||||||
|
0x0D, 0x3E, 0x12, 0x94, 0x3D, 0x25, 0xA8, 0xA9, 0x30, 0x9E, 0x54, 0x5A, 0xD6, 0x36, 0x6C,
|
||||||
|
0xD6, 0x8C, 0x20, 0x62, 0x8F, 0xA1, 0x6B, 0x1F, 0x7C, 0x6D, 0xB2, 0xB1, 0xC1, 0x2E, 0xAD,
|
||||||
|
0x36, 0x02, 0x9C, 0x3A, 0xCA, 0x2F, 0x09, 0xD2, 0x45, 0x9E, 0xEB, 0xF2, 0xBC, 0x6C, 0xAA,
|
||||||
|
0x3B, 0x3E, 0x90, 0xBC, 0x38, 0x67, 0x35, 0x4D};
|
||||||
// e
|
// e
|
||||||
const CryptoPP::byte* PublicExponent;
|
static constexpr CryptoPP::byte PublicExponent[] = {0, 1, 0, 1};
|
||||||
// (InverseQ)(q) = 1 mod p
|
// (InverseQ)(q) = 1 mod p
|
||||||
const CryptoPP::byte* Coefficient;
|
static constexpr CryptoPP::byte Coefficient[] = {
|
||||||
|
0x0B, 0x67, 0x1C, 0x0D, 0x6C, 0x57, 0xD3, 0xE7, 0x05, 0x65, 0x94, 0x31, 0x56, 0x55, 0xFD,
|
||||||
|
0x28, 0x08, 0xFA, 0x05, 0x8A, 0xCC, 0x55, 0x39, 0x61, 0x97, 0x63, 0xA0, 0x16, 0x27, 0x3D,
|
||||||
|
0xED, 0xC1, 0x16, 0x40, 0x2A, 0x12, 0xEA, 0x6F, 0xD9, 0xD8, 0x58, 0x56, 0xA8, 0x56, 0x8B,
|
||||||
|
0x0D, 0x38, 0x5E, 0x1E, 0x80, 0x3B, 0x5F, 0x40, 0x80, 0x6F, 0x62, 0x4F, 0x28, 0xA2, 0x69,
|
||||||
|
0xF3, 0xD3, 0xF7, 0xFD, 0xB2, 0xC3, 0x52, 0x43, 0x20, 0x92, 0x9D, 0x97, 0x8D, 0xA0, 0x15,
|
||||||
|
0x07, 0x15, 0x6E, 0xA4, 0x0D, 0x56, 0xD3, 0x37, 0x1A, 0xC4, 0x9E, 0xDF, 0x02, 0x49, 0xB8,
|
||||||
|
0x0A, 0x84, 0x62, 0xF5, 0xFA, 0xB9, 0x3F, 0xA4, 0x09, 0x76, 0xCC, 0xAA, 0xB9, 0x9B, 0xA6,
|
||||||
|
0x4F, 0xC1, 0x6A, 0x64, 0xCE, 0xD8, 0x77, 0xAB, 0x4B, 0xF9, 0xA0, 0xAE, 0xDA, 0xF1, 0x67,
|
||||||
|
0x87, 0x7C, 0x98, 0x5C, 0x7E, 0xB8, 0x73, 0xF5};
|
||||||
// n = p * q
|
// n = p * q
|
||||||
const CryptoPP::byte* Modulus;
|
static constexpr CryptoPP::byte Modulus[] = {
|
||||||
|
0xC6, 0xCF, 0x71, 0xE7, 0xE5, 0x9A, 0xF0, 0xD1, 0x2A, 0x2C, 0x45, 0x8B, 0xF9, 0x2A, 0x0E,
|
||||||
|
0xC1, 0x43, 0x05, 0x8B, 0xC3, 0x71, 0x17, 0x80, 0x1D, 0xCD, 0x49, 0x7D, 0xDE, 0x35, 0x9D,
|
||||||
|
0x25, 0x9B, 0xA0, 0xD7, 0xA0, 0xF2, 0x7D, 0x6C, 0x08, 0x7E, 0xAA, 0x55, 0x02, 0x68, 0x2B,
|
||||||
|
0x23, 0xC6, 0x44, 0xB8, 0x44, 0x18, 0xEB, 0x56, 0xCF, 0x16, 0xA2, 0x48, 0x03, 0xC9, 0xE7,
|
||||||
|
0x4F, 0x87, 0xEB, 0x3D, 0x30, 0xC3, 0x15, 0x88, 0xBF, 0x20, 0xE7, 0x9D, 0xFF, 0x77, 0x0C,
|
||||||
|
0xDE, 0x1D, 0x24, 0x1E, 0x63, 0xA9, 0x4F, 0x8A, 0xBF, 0x5B, 0xBE, 0x60, 0x19, 0x68, 0x33,
|
||||||
|
0x3B, 0xFC, 0xED, 0x9F, 0x47, 0x4E, 0x5F, 0xF8, 0xEA, 0xCB, 0x3D, 0x00, 0xBD, 0x67, 0x01,
|
||||||
|
0xF9, 0x2C, 0x6D, 0xC6, 0xAC, 0x13, 0x64, 0xE7, 0x67, 0x14, 0xF3, 0xDC, 0x52, 0x69, 0x6A,
|
||||||
|
0xB9, 0x83, 0x2C, 0x42, 0x30, 0x13, 0x1B, 0xB2, 0xD8, 0xA5, 0x02, 0x0D, 0x79, 0xED, 0x96,
|
||||||
|
0xB1, 0x0D, 0xF8, 0xCC, 0x0C, 0xDF, 0x81, 0x95, 0x4F, 0x03, 0x58, 0x09, 0x57, 0x0E, 0x80,
|
||||||
|
0x69, 0x2E, 0xFE, 0xFF, 0x52, 0x77, 0xEA, 0x75, 0x28, 0xA8, 0xFB, 0xC9, 0xBE, 0xBF, 0x9F,
|
||||||
|
0xBB, 0xB7, 0x79, 0x8E, 0x18, 0x05, 0xE1, 0x80, 0xBD, 0x50, 0x34, 0x94, 0x81, 0xD3, 0x53,
|
||||||
|
0xC2, 0x69, 0xA2, 0xD2, 0x4C, 0xCF, 0x6C, 0xF4, 0x57, 0x2C, 0x10, 0x4A, 0x3F, 0xFB, 0x22,
|
||||||
|
0xFD, 0x8B, 0x97, 0xE2, 0xC9, 0x5B, 0xA6, 0x2B, 0xCD, 0xD6, 0x1B, 0x6B, 0xDB, 0x68, 0x7F,
|
||||||
|
0x4B, 0xC2, 0xA0, 0x50, 0x34, 0xC0, 0x05, 0xE5, 0x8D, 0xEF, 0x24, 0x67, 0xFF, 0x93, 0x40,
|
||||||
|
0xCF, 0x2D, 0x62, 0xA2, 0xA0, 0x50, 0xB1, 0xF1, 0x3A, 0xA8, 0x3D, 0xFD, 0x80, 0xD1, 0xF9,
|
||||||
|
0xB8, 0x05, 0x22, 0xAF, 0xC8, 0x35, 0x45, 0x90, 0x58, 0x8E, 0xE3, 0x3A, 0x7C, 0xBD, 0x3E,
|
||||||
|
0x27};
|
||||||
// p
|
// p
|
||||||
const CryptoPP::byte* Prime1;
|
static constexpr CryptoPP::byte Prime1[] = {
|
||||||
|
0xFE, 0xF6, 0xBF, 0x1D, 0x69, 0xAB, 0x16, 0x25, 0x08, 0x47, 0x55, 0x6B, 0x86, 0xE4, 0x35,
|
||||||
|
0x88, 0x72, 0x2A, 0xB1, 0x3D, 0xF8, 0xB6, 0x44, 0xCA, 0xB3, 0xAB, 0x19, 0xD1, 0x04, 0x24,
|
||||||
|
0x28, 0x0A, 0x74, 0x55, 0xB8, 0x15, 0x45, 0x09, 0xCC, 0x13, 0x1C, 0xF2, 0xBA, 0x37, 0xA9,
|
||||||
|
0x03, 0x90, 0x8F, 0x02, 0x10, 0xFF, 0x25, 0x79, 0x86, 0xCC, 0x18, 0x50, 0x9A, 0x10, 0x5F,
|
||||||
|
0x5B, 0x4C, 0x1C, 0x4E, 0xB0, 0xA7, 0xE3, 0x59, 0xB1, 0x2D, 0xA0, 0xC6, 0xB0, 0x20, 0x2C,
|
||||||
|
0x21, 0x33, 0x12, 0xB3, 0xAF, 0x72, 0x34, 0x83, 0xCD, 0x52, 0x2F, 0xAF, 0x0F, 0x20, 0x5A,
|
||||||
|
0x1B, 0xC0, 0xE2, 0xA3, 0x76, 0x34, 0x0F, 0xD7, 0xFC, 0xC1, 0x41, 0xC9, 0xF9, 0x79, 0x40,
|
||||||
|
0x17, 0x42, 0x21, 0x3E, 0x9D, 0xFD, 0xC7, 0xC1, 0x50, 0xDE, 0x44, 0x5A, 0xC9, 0x31, 0x89,
|
||||||
|
0x6A, 0x78, 0x05, 0xBE, 0x65, 0xB4, 0xE8, 0x2D};
|
||||||
// q
|
// q
|
||||||
const CryptoPP::byte* Prime2;
|
static constexpr CryptoPP::byte Prime2[] = {
|
||||||
const CryptoPP::byte* PrivateExponent;
|
0xC7, 0x9E, 0x47, 0x58, 0x00, 0x7D, 0x62, 0x82, 0xB0, 0xD2, 0x22, 0x81, 0xD4, 0xA8, 0x97,
|
||||||
|
0x1B, 0x79, 0x0C, 0x3A, 0xB0, 0xD7, 0xC9, 0x30, 0xE3, 0xC3, 0x53, 0x8E, 0x57, 0xEF, 0xF0,
|
||||||
// Constructor
|
0x9B, 0x9F, 0xB3, 0x90, 0x52, 0xC6, 0x94, 0x22, 0x36, 0xAA, 0xE6, 0x4A, 0x5F, 0x72, 0x1D,
|
||||||
FakeKeyset() {
|
0x70, 0xE8, 0x76, 0x58, 0xC8, 0xB2, 0x91, 0xCE, 0x9C, 0xC3, 0xE9, 0x09, 0x7F, 0x2E, 0x47,
|
||||||
// Initialize PrivateExponent
|
0x97, 0xCC, 0x90, 0x39, 0x15, 0x35, 0x31, 0xDE, 0x1F, 0x0C, 0x8C, 0x0D, 0xC1, 0xC2, 0x92,
|
||||||
PrivateExponent = new CryptoPP::byte[0x100]{
|
0xBE, 0x97, 0xBF, 0x2F, 0x91, 0xA1, 0x8C, 0x7D, 0x50, 0xA8, 0x21, 0x2F, 0xD7, 0xA2, 0x9A,
|
||||||
0x7F, 0x76, 0xCD, 0x0E, 0xE2, 0xD4, 0xDE, 0x05, 0x1C, 0xC6, 0xD9, 0xA8, 0x0E, 0x8D,
|
0x7E, 0xB5, 0xA7, 0x2A, 0x90, 0x02, 0xD9, 0xF3, 0x3D, 0xD1, 0xEB, 0xB8, 0xE0, 0x5A, 0x79,
|
||||||
0xFA, 0x7B, 0xCA, 0x1E, 0xAA, 0x27, 0x1A, 0x40, 0xF8, 0xF1, 0x22, 0x87, 0x35, 0xDD,
|
0x9E, 0x7D, 0x8D, 0xCA, 0x18, 0x6D, 0xBD, 0x9E, 0xA1, 0x80, 0x28, 0x6B, 0x2A, 0xFE, 0x51,
|
||||||
0xDB, 0xFD, 0xEE, 0xF8, 0xC2, 0xBC, 0xBD, 0x01, 0xFB, 0x8B, 0xE2, 0x3E, 0x63, 0xB2,
|
0x24, 0x9B, 0x6F, 0x4D, 0x84, 0x77, 0x80, 0x23};
|
||||||
0xB1, 0x22, 0x5C, 0x56, 0x49, 0x6E, 0x11, 0xBE, 0x07, 0x44, 0x0B, 0x9A, 0x26, 0x66,
|
static constexpr CryptoPP::byte PrivateExponent[] = {
|
||||||
0xD1, 0x49, 0x2C, 0x8F, 0xD3, 0x1B, 0xCF, 0xA4, 0xA1, 0xB8, 0xD1, 0xFB, 0xA4, 0x9E,
|
0x7F, 0x76, 0xCD, 0x0E, 0xE2, 0xD4, 0xDE, 0x05, 0x1C, 0xC6, 0xD9, 0xA8, 0x0E, 0x8D, 0xFA,
|
||||||
0xD2, 0x21, 0x28, 0x83, 0x09, 0x8A, 0xF6, 0xA0, 0x0B, 0xA3, 0xD6, 0x0F, 0x9B, 0x63,
|
0x7B, 0xCA, 0x1E, 0xAA, 0x27, 0x1A, 0x40, 0xF8, 0xF1, 0x22, 0x87, 0x35, 0xDD, 0xDB, 0xFD,
|
||||||
0x68, 0xCC, 0xBC, 0x0C, 0x4E, 0x14, 0x5B, 0x27, 0xA4, 0xA9, 0xF4, 0x2B, 0xB9, 0xB8,
|
0xEE, 0xF8, 0xC2, 0xBC, 0xBD, 0x01, 0xFB, 0x8B, 0xE2, 0x3E, 0x63, 0xB2, 0xB1, 0x22, 0x5C,
|
||||||
0x7B, 0xC0, 0xE6, 0x51, 0xAD, 0x1D, 0x77, 0xD4, 0x6B, 0xB9, 0xCE, 0x20, 0xD1, 0x26,
|
0x56, 0x49, 0x6E, 0x11, 0xBE, 0x07, 0x44, 0x0B, 0x9A, 0x26, 0x66, 0xD1, 0x49, 0x2C, 0x8F,
|
||||||
0x66, 0x7E, 0x5E, 0x9E, 0xA2, 0xE9, 0x6B, 0x90, 0xF3, 0x73, 0xB8, 0x52, 0x8F, 0x44,
|
0xD3, 0x1B, 0xCF, 0xA4, 0xA1, 0xB8, 0xD1, 0xFB, 0xA4, 0x9E, 0xD2, 0x21, 0x28, 0x83, 0x09,
|
||||||
0x11, 0x03, 0x0C, 0x13, 0x97, 0x39, 0x3D, 0x13, 0x22, 0x58, 0xD5, 0x43, 0x82, 0x49,
|
0x8A, 0xF6, 0xA0, 0x0B, 0xA3, 0xD6, 0x0F, 0x9B, 0x63, 0x68, 0xCC, 0xBC, 0x0C, 0x4E, 0x14,
|
||||||
0xDA, 0x6E, 0x7C, 0xA1, 0xC5, 0x8C, 0xA5, 0xB0, 0x09, 0xE0, 0xCE, 0x3D, 0xDF, 0xF4,
|
0x5B, 0x27, 0xA4, 0xA9, 0xF4, 0x2B, 0xB9, 0xB8, 0x7B, 0xC0, 0xE6, 0x51, 0xAD, 0x1D, 0x77,
|
||||||
0x9D, 0x3C, 0x97, 0x15, 0xE2, 0x6A, 0xC7, 0x2B, 0x3C, 0x50, 0x93, 0x23, 0xDB, 0xBA,
|
0xD4, 0x6B, 0xB9, 0xCE, 0x20, 0xD1, 0x26, 0x66, 0x7E, 0x5E, 0x9E, 0xA2, 0xE9, 0x6B, 0x90,
|
||||||
0x4A, 0x22, 0x66, 0x44, 0xAC, 0x78, 0xBB, 0x0E, 0x1A, 0x27, 0x43, 0xB5, 0x71, 0x67,
|
0xF3, 0x73, 0xB8, 0x52, 0x8F, 0x44, 0x11, 0x03, 0x0C, 0x13, 0x97, 0x39, 0x3D, 0x13, 0x22,
|
||||||
0xAF, 0xF4, 0xAB, 0x48, 0x46, 0x93, 0x73, 0xD0, 0x42, 0xAB, 0x93, 0x63, 0xE5, 0x6C,
|
0x58, 0xD5, 0x43, 0x82, 0x49, 0xDA, 0x6E, 0x7C, 0xA1, 0xC5, 0x8C, 0xA5, 0xB0, 0x09, 0xE0,
|
||||||
0x9A, 0xDE, 0x50, 0x24, 0xC0, 0x23, 0x7D, 0x99, 0x79, 0x3F, 0x22, 0x07, 0xE0, 0xC1,
|
0xCE, 0x3D, 0xDF, 0xF4, 0x9D, 0x3C, 0x97, 0x15, 0xE2, 0x6A, 0xC7, 0x2B, 0x3C, 0x50, 0x93,
|
||||||
0x48, 0x56, 0x1B, 0xDF, 0x83, 0x09, 0x12, 0xB4, 0x2D, 0x45, 0x6B, 0xC9, 0xC0, 0x68,
|
0x23, 0xDB, 0xBA, 0x4A, 0x22, 0x66, 0x44, 0xAC, 0x78, 0xBB, 0x0E, 0x1A, 0x27, 0x43, 0xB5,
|
||||||
0x85, 0x99, 0x90, 0x79, 0x96, 0x1A, 0xD7, 0xF5, 0x4D, 0x1F, 0x37, 0x83, 0x40, 0x4A,
|
0x71, 0x67, 0xAF, 0xF4, 0xAB, 0x48, 0x46, 0x93, 0x73, 0xD0, 0x42, 0xAB, 0x93, 0x63, 0xE5,
|
||||||
0xEC, 0x39, 0x37, 0xA6, 0x80, 0x92, 0x7D, 0xC5, 0x80, 0xC7, 0xD6, 0x6F, 0xFE, 0x8A,
|
0x6C, 0x9A, 0xDE, 0x50, 0x24, 0xC0, 0x23, 0x7D, 0x99, 0x79, 0x3F, 0x22, 0x07, 0xE0, 0xC1,
|
||||||
0x79, 0x89, 0xC6, 0xB1};
|
0x48, 0x56, 0x1B, 0xDF, 0x83, 0x09, 0x12, 0xB4, 0x2D, 0x45, 0x6B, 0xC9, 0xC0, 0x68, 0x85,
|
||||||
|
0x99, 0x90, 0x79, 0x96, 0x1A, 0xD7, 0xF5, 0x4D, 0x1F, 0x37, 0x83, 0x40, 0x4A, 0xEC, 0x39,
|
||||||
// Initialize Exponent1
|
0x37, 0xA6, 0x80, 0x92, 0x7D, 0xC5, 0x80, 0xC7, 0xD6, 0x6F, 0xFE, 0x8A, 0x79, 0x89, 0xC6,
|
||||||
Exponent1 = new CryptoPP::byte[0x80]{
|
0xB1};
|
||||||
0x6D, 0x48, 0xE0, 0x54, 0x40, 0x25, 0xC8, 0x41, 0x29, 0x52, 0x42, 0x27, 0xEB,
|
|
||||||
0xD2, 0xC7, 0xAB, 0x6B, 0x9C, 0x27, 0x0A, 0xB4, 0x1F, 0x94, 0x4E, 0xFA, 0x42,
|
|
||||||
0x1D, 0xB7, 0xBC, 0xB9, 0xAE, 0xBC, 0x04, 0x6F, 0x75, 0x8F, 0x10, 0x5F, 0x89,
|
|
||||||
0xAC, 0xAB, 0x9C, 0xD2, 0xFA, 0xE6, 0xA4, 0x13, 0x83, 0x68, 0xD4, 0x56, 0x38,
|
|
||||||
0xFE, 0xE5, 0x2B, 0x78, 0x44, 0x9C, 0x34, 0xE6, 0x5A, 0xA0, 0xBE, 0x05, 0x70,
|
|
||||||
0xAD, 0x15, 0xC3, 0x2D, 0x31, 0xAC, 0x97, 0x5D, 0x88, 0xFC, 0xC1, 0x62, 0x3D,
|
|
||||||
0xE2, 0xED, 0x11, 0xDB, 0xB6, 0x9E, 0xFC, 0x5A, 0x5A, 0x03, 0xF6, 0xCF, 0x08,
|
|
||||||
0xD4, 0x5D, 0x90, 0xC9, 0x2A, 0xB9, 0x9B, 0xCF, 0xC8, 0x1A, 0x65, 0xF3, 0x5B,
|
|
||||||
0xE8, 0x7F, 0xCF, 0xA5, 0xA6, 0x4C, 0x5C, 0x2A, 0x12, 0x0F, 0x92, 0xA5, 0xE3,
|
|
||||||
0xF0, 0x17, 0x1E, 0x9A, 0x97, 0x45, 0x86, 0xFD, 0xDB, 0x54, 0x25
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
Exponent2 = new CryptoPP::byte[0x80]{
|
|
||||||
0x2A, 0x51, 0xCE, 0x02, 0x44, 0x28, 0x50, 0xE8, 0x30, 0x20, 0x7C, 0x9C, 0x55,
|
|
||||||
0xBF, 0x60, 0x39, 0xBC, 0xD1, 0xF0, 0xE7, 0x68, 0xF8, 0x08, 0x5B, 0x61, 0x1F,
|
|
||||||
0xA7, 0xBF, 0xD0, 0xE8, 0x8B, 0xB5, 0xB1, 0xD5, 0xD9, 0x16, 0xAC, 0x75, 0x0C,
|
|
||||||
0x6D, 0xF2, 0xE0, 0xB5, 0x97, 0x75, 0xD2, 0x68, 0x16, 0x1F, 0x00, 0x7D, 0x8B,
|
|
||||||
0x17, 0xE8, 0x78, 0x48, 0x41, 0x71, 0x2B, 0x18, 0x96, 0x80, 0x11, 0xDB, 0x68,
|
|
||||||
0x39, 0x9C, 0xD6, 0xE0, 0x72, 0x42, 0x86, 0xF0, 0x1B, 0x16, 0x0D, 0x3E, 0x12,
|
|
||||||
0x94, 0x3D, 0x25, 0xA8, 0xA9, 0x30, 0x9E, 0x54, 0x5A, 0xD6, 0x36, 0x6C, 0xD6,
|
|
||||||
0x8C, 0x20, 0x62, 0x8F, 0xA1, 0x6B, 0x1F, 0x7C, 0x6D, 0xB2, 0xB1, 0xC1, 0x2E,
|
|
||||||
0xAD, 0x36, 0x02, 0x9C, 0x3A, 0xCA, 0x2F, 0x09, 0xD2, 0x45, 0x9E, 0xEB, 0xF2,
|
|
||||||
0xBC, 0x6C, 0xAA, 0x3B, 0x3E, 0x90, 0xBC, 0x38, 0x67, 0x35, 0x4D};
|
|
||||||
|
|
||||||
PublicExponent = new CryptoPP::byte[4]{0, 1, 0, 1};
|
|
||||||
|
|
||||||
Coefficient = new CryptoPP::byte[0x80]{
|
|
||||||
0x0B, 0x67, 0x1C, 0x0D, 0x6C, 0x57, 0xD3, 0xE7, 0x05, 0x65, 0x94, 0x31, 0x56,
|
|
||||||
0x55, 0xFD, 0x28, 0x08, 0xFA, 0x05, 0x8A, 0xCC, 0x55, 0x39, 0x61, 0x97, 0x63,
|
|
||||||
0xA0, 0x16, 0x27, 0x3D, 0xED, 0xC1, 0x16, 0x40, 0x2A, 0x12, 0xEA, 0x6F, 0xD9,
|
|
||||||
0xD8, 0x58, 0x56, 0xA8, 0x56, 0x8B, 0x0D, 0x38, 0x5E, 0x1E, 0x80, 0x3B, 0x5F,
|
|
||||||
0x40, 0x80, 0x6F, 0x62, 0x4F, 0x28, 0xA2, 0x69, 0xF3, 0xD3, 0xF7, 0xFD, 0xB2,
|
|
||||||
0xC3, 0x52, 0x43, 0x20, 0x92, 0x9D, 0x97, 0x8D, 0xA0, 0x15, 0x07, 0x15, 0x6E,
|
|
||||||
0xA4, 0x0D, 0x56, 0xD3, 0x37, 0x1A, 0xC4, 0x9E, 0xDF, 0x02, 0x49, 0xB8, 0x0A,
|
|
||||||
0x84, 0x62, 0xF5, 0xFA, 0xB9, 0x3F, 0xA4, 0x09, 0x76, 0xCC, 0xAA, 0xB9, 0x9B,
|
|
||||||
0xA6, 0x4F, 0xC1, 0x6A, 0x64, 0xCE, 0xD8, 0x77, 0xAB, 0x4B, 0xF9, 0xA0, 0xAE,
|
|
||||||
0xDA, 0xF1, 0x67, 0x87, 0x7C, 0x98, 0x5C, 0x7E, 0xB8, 0x73, 0xF5};
|
|
||||||
|
|
||||||
Modulus = new CryptoPP::byte[0x100]{
|
|
||||||
0xC6, 0xCF, 0x71, 0xE7, 0xE5, 0x9A, 0xF0, 0xD1, 0x2A, 0x2C, 0x45, 0x8B, 0xF9, 0x2A,
|
|
||||||
0x0E, 0xC1, 0x43, 0x05, 0x8B, 0xC3, 0x71, 0x17, 0x80, 0x1D, 0xCD, 0x49, 0x7D, 0xDE,
|
|
||||||
0x35, 0x9D, 0x25, 0x9B, 0xA0, 0xD7, 0xA0, 0xF2, 0x7D, 0x6C, 0x08, 0x7E, 0xAA, 0x55,
|
|
||||||
0x02, 0x68, 0x2B, 0x23, 0xC6, 0x44, 0xB8, 0x44, 0x18, 0xEB, 0x56, 0xCF, 0x16, 0xA2,
|
|
||||||
0x48, 0x03, 0xC9, 0xE7, 0x4F, 0x87, 0xEB, 0x3D, 0x30, 0xC3, 0x15, 0x88, 0xBF, 0x20,
|
|
||||||
0xE7, 0x9D, 0xFF, 0x77, 0x0C, 0xDE, 0x1D, 0x24, 0x1E, 0x63, 0xA9, 0x4F, 0x8A, 0xBF,
|
|
||||||
0x5B, 0xBE, 0x60, 0x19, 0x68, 0x33, 0x3B, 0xFC, 0xED, 0x9F, 0x47, 0x4E, 0x5F, 0xF8,
|
|
||||||
0xEA, 0xCB, 0x3D, 0x00, 0xBD, 0x67, 0x01, 0xF9, 0x2C, 0x6D, 0xC6, 0xAC, 0x13, 0x64,
|
|
||||||
0xE7, 0x67, 0x14, 0xF3, 0xDC, 0x52, 0x69, 0x6A, 0xB9, 0x83, 0x2C, 0x42, 0x30, 0x13,
|
|
||||||
0x1B, 0xB2, 0xD8, 0xA5, 0x02, 0x0D, 0x79, 0xED, 0x96, 0xB1, 0x0D, 0xF8, 0xCC, 0x0C,
|
|
||||||
0xDF, 0x81, 0x95, 0x4F, 0x03, 0x58, 0x09, 0x57, 0x0E, 0x80, 0x69, 0x2E, 0xFE, 0xFF,
|
|
||||||
0x52, 0x77, 0xEA, 0x75, 0x28, 0xA8, 0xFB, 0xC9, 0xBE, 0xBF, 0x9F, 0xBB, 0xB7, 0x79,
|
|
||||||
0x8E, 0x18, 0x05, 0xE1, 0x80, 0xBD, 0x50, 0x34, 0x94, 0x81, 0xD3, 0x53, 0xC2, 0x69,
|
|
||||||
0xA2, 0xD2, 0x4C, 0xCF, 0x6C, 0xF4, 0x57, 0x2C, 0x10, 0x4A, 0x3F, 0xFB, 0x22, 0xFD,
|
|
||||||
0x8B, 0x97, 0xE2, 0xC9, 0x5B, 0xA6, 0x2B, 0xCD, 0xD6, 0x1B, 0x6B, 0xDB, 0x68, 0x7F,
|
|
||||||
0x4B, 0xC2, 0xA0, 0x50, 0x34, 0xC0, 0x05, 0xE5, 0x8D, 0xEF, 0x24, 0x67, 0xFF, 0x93,
|
|
||||||
0x40, 0xCF, 0x2D, 0x62, 0xA2, 0xA0, 0x50, 0xB1, 0xF1, 0x3A, 0xA8, 0x3D, 0xFD, 0x80,
|
|
||||||
0xD1, 0xF9, 0xB8, 0x05, 0x22, 0xAF, 0xC8, 0x35, 0x45, 0x90, 0x58, 0x8E, 0xE3, 0x3A,
|
|
||||||
0x7C, 0xBD, 0x3E, 0x27};
|
|
||||||
|
|
||||||
Prime1 = new CryptoPP::byte[0x80]{
|
|
||||||
0xFE, 0xF6, 0xBF, 0x1D, 0x69, 0xAB, 0x16, 0x25, 0x08, 0x47, 0x55, 0x6B, 0x86,
|
|
||||||
0xE4, 0x35, 0x88, 0x72, 0x2A, 0xB1, 0x3D, 0xF8, 0xB6, 0x44, 0xCA, 0xB3, 0xAB,
|
|
||||||
0x19, 0xD1, 0x04, 0x24, 0x28, 0x0A, 0x74, 0x55, 0xB8, 0x15, 0x45, 0x09, 0xCC,
|
|
||||||
0x13, 0x1C, 0xF2, 0xBA, 0x37, 0xA9, 0x03, 0x90, 0x8F, 0x02, 0x10, 0xFF, 0x25,
|
|
||||||
0x79, 0x86, 0xCC, 0x18, 0x50, 0x9A, 0x10, 0x5F, 0x5B, 0x4C, 0x1C, 0x4E, 0xB0,
|
|
||||||
0xA7, 0xE3, 0x59, 0xB1, 0x2D, 0xA0, 0xC6, 0xB0, 0x20, 0x2C, 0x21, 0x33, 0x12,
|
|
||||||
0xB3, 0xAF, 0x72, 0x34, 0x83, 0xCD, 0x52, 0x2F, 0xAF, 0x0F, 0x20, 0x5A, 0x1B,
|
|
||||||
0xC0, 0xE2, 0xA3, 0x76, 0x34, 0x0F, 0xD7, 0xFC, 0xC1, 0x41, 0xC9, 0xF9, 0x79,
|
|
||||||
0x40, 0x17, 0x42, 0x21, 0x3E, 0x9D, 0xFD, 0xC7, 0xC1, 0x50, 0xDE, 0x44, 0x5A,
|
|
||||||
0xC9, 0x31, 0x89, 0x6A, 0x78, 0x05, 0xBE, 0x65, 0xB4, 0xE8, 0x2D};
|
|
||||||
|
|
||||||
Prime2 = new CryptoPP::byte[0x80]{
|
|
||||||
0xC7, 0x9E, 0x47, 0x58, 0x00, 0x7D, 0x62, 0x82, 0xB0, 0xD2, 0x22, 0x81, 0xD4,
|
|
||||||
0xA8, 0x97, 0x1B, 0x79, 0x0C, 0x3A, 0xB0, 0xD7, 0xC9, 0x30, 0xE3, 0xC3, 0x53,
|
|
||||||
0x8E, 0x57, 0xEF, 0xF0, 0x9B, 0x9F, 0xB3, 0x90, 0x52, 0xC6, 0x94, 0x22, 0x36,
|
|
||||||
0xAA, 0xE6, 0x4A, 0x5F, 0x72, 0x1D, 0x70, 0xE8, 0x76, 0x58, 0xC8, 0xB2, 0x91,
|
|
||||||
0xCE, 0x9C, 0xC3, 0xE9, 0x09, 0x7F, 0x2E, 0x47, 0x97, 0xCC, 0x90, 0x39, 0x15,
|
|
||||||
0x35, 0x31, 0xDE, 0x1F, 0x0C, 0x8C, 0x0D, 0xC1, 0xC2, 0x92, 0xBE, 0x97, 0xBF,
|
|
||||||
0x2F, 0x91, 0xA1, 0x8C, 0x7D, 0x50, 0xA8, 0x21, 0x2F, 0xD7, 0xA2, 0x9A, 0x7E,
|
|
||||||
0xB5, 0xA7, 0x2A, 0x90, 0x02, 0xD9, 0xF3, 0x3D, 0xD1, 0xEB, 0xB8, 0xE0, 0x5A,
|
|
||||||
0x79, 0x9E, 0x7D, 0x8D, 0xCA, 0x18, 0x6D, 0xBD, 0x9E, 0xA1, 0x80, 0x28, 0x6B,
|
|
||||||
0x2A, 0xFE, 0x51, 0x24, 0x9B, 0x6F, 0x4D, 0x84, 0x77, 0x80, 0x23};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DebugRifKeyset {
|
class DebugRifKeyset {
|
||||||
public:
|
public:
|
||||||
// Constructor
|
|
||||||
// std::uint8_t* PrivateExponent;
|
// std::uint8_t* PrivateExponent;
|
||||||
const CryptoPP::byte* Exponent1;
|
static constexpr CryptoPP::byte Exponent1[] = {
|
||||||
|
0xCD, 0x9A, 0x61, 0xB0, 0xB8, 0xD5, 0xB4, 0xE4, 0xE4, 0xF6, 0xAB, 0xF7, 0x27, 0xB7, 0x56,
|
||||||
|
0x59, 0x6B, 0xB9, 0x11, 0xE7, 0xF4, 0x83, 0xAF, 0xB9, 0x73, 0x99, 0x7F, 0x49, 0xA2, 0x9C,
|
||||||
|
0xF0, 0xB5, 0x6D, 0x37, 0x82, 0x14, 0x15, 0xF1, 0x04, 0x8A, 0xD4, 0x8E, 0xEB, 0x2E, 0x1F,
|
||||||
|
0xE2, 0x81, 0xA9, 0x62, 0x6E, 0xB1, 0x68, 0x75, 0x62, 0xF3, 0x0F, 0xFE, 0xD4, 0x91, 0x87,
|
||||||
|
0x98, 0x78, 0xBF, 0x26, 0xB5, 0x07, 0x58, 0xD0, 0xEE, 0x3F, 0x21, 0xE8, 0xC8, 0x0F, 0x5F,
|
||||||
|
0xFA, 0x1C, 0x64, 0x74, 0x49, 0x52, 0xEB, 0xE7, 0xEE, 0xDE, 0xBA, 0x23, 0x26, 0x4A, 0xF6,
|
||||||
|
0x9C, 0x1A, 0x09, 0x3F, 0xB9, 0x0B, 0x36, 0x26, 0x1A, 0xBE, 0xA9, 0x76, 0xE6, 0xF2, 0x69,
|
||||||
|
0xDE, 0xFF, 0xAF, 0xCC, 0x0C, 0x9A, 0x66, 0x03, 0x86, 0x0A, 0x1F, 0x49, 0xA4, 0x10, 0xB6,
|
||||||
|
0xBC, 0xC3, 0x7C, 0x88, 0xE8, 0xCE, 0x4B, 0xD9};
|
||||||
// exponent2 = d mod (q - 1)
|
// exponent2 = d mod (q - 1)
|
||||||
const CryptoPP::byte* Exponent2;
|
static constexpr CryptoPP::byte Exponent2[] = {
|
||||||
|
0xB3, 0x73, 0xA3, 0x59, 0xE6, 0x97, 0xC0, 0xAB, 0x3B, 0x68, 0xFC, 0x39, 0xAC, 0xDB, 0x44,
|
||||||
|
0xB1, 0xB4, 0x9E, 0x35, 0x4D, 0xBE, 0xC5, 0x36, 0x69, 0x6C, 0x3D, 0xC5, 0xFC, 0xFE, 0x4B,
|
||||||
|
0x2F, 0xDC, 0x86, 0x80, 0x46, 0x96, 0x40, 0x1A, 0x0D, 0x6E, 0xFA, 0x8C, 0xE0, 0x47, 0x91,
|
||||||
|
0xAC, 0xAD, 0x95, 0x2B, 0x8E, 0x1F, 0xF2, 0x0A, 0x45, 0xF8, 0x29, 0x95, 0x70, 0xC6, 0x88,
|
||||||
|
0x5F, 0x71, 0x03, 0x99, 0x79, 0xBC, 0x84, 0x71, 0xBD, 0xE8, 0x84, 0x8C, 0x0E, 0xD4, 0x7B,
|
||||||
|
0x30, 0x74, 0x57, 0x1A, 0x95, 0xE7, 0x90, 0x19, 0x8D, 0xAD, 0x8B, 0x4C, 0x4E, 0xC3, 0xE7,
|
||||||
|
0x6B, 0x23, 0x86, 0x01, 0xEE, 0x9B, 0xE0, 0x2F, 0x15, 0xA2, 0x2C, 0x4C, 0x39, 0xD3, 0xDF,
|
||||||
|
0x9C, 0x39, 0x01, 0xF1, 0x8C, 0x44, 0x4A, 0x15, 0x44, 0xDC, 0x51, 0xF7, 0x22, 0xD7, 0x7F,
|
||||||
|
0x41, 0x7F, 0x68, 0xFA, 0xEE, 0x56, 0xE8, 0x05};
|
||||||
// e
|
// e
|
||||||
const CryptoPP::byte* PublicExponent;
|
static constexpr CryptoPP::byte PublicExponent[] = {0x00, 0x01, 0x00, 0x01};
|
||||||
// (InverseQ)(q) = 1 mod p
|
// (InverseQ)(q) = 1 mod p
|
||||||
const CryptoPP::byte* Coefficient;
|
static constexpr CryptoPP::byte Coefficient[] = {
|
||||||
|
0xC0, 0x32, 0x43, 0xD3, 0x8C, 0x3D, 0xB4, 0xD2, 0x48, 0x8C, 0x42, 0x41, 0x24, 0x94, 0x6C,
|
||||||
|
0x80, 0xC9, 0xC1, 0x79, 0x36, 0x7F, 0xAC, 0xC3, 0xFF, 0x6A, 0x25, 0xEB, 0x2C, 0xFB, 0xD4,
|
||||||
|
0x2B, 0xA0, 0xEB, 0xFE, 0x25, 0xE9, 0xC6, 0x77, 0xCE, 0xFE, 0x2D, 0x23, 0xFE, 0xD0, 0xF4,
|
||||||
|
0x0F, 0xD9, 0x7E, 0xD5, 0xA5, 0x7D, 0x1F, 0xC0, 0xE8, 0xE8, 0xEC, 0x80, 0x5B, 0xC7, 0xFD,
|
||||||
|
0xE2, 0xBD, 0x94, 0xA6, 0x2B, 0xDD, 0x6A, 0x60, 0x45, 0x54, 0xAB, 0xCA, 0x42, 0x9C, 0x6A,
|
||||||
|
0x6C, 0xBF, 0x3C, 0x84, 0xF9, 0xA5, 0x0E, 0x63, 0x0C, 0x51, 0x58, 0x62, 0x6D, 0x5A, 0xB7,
|
||||||
|
0x3C, 0x3F, 0x49, 0x1A, 0xD0, 0x93, 0xB8, 0x4F, 0x1A, 0x6C, 0x5F, 0xC5, 0xE5, 0xA9, 0x75,
|
||||||
|
0xD4, 0x86, 0x9E, 0xDF, 0x87, 0x0F, 0x27, 0xB0, 0x26, 0x78, 0x4E, 0xFB, 0xC1, 0x8A, 0x4A,
|
||||||
|
0x24, 0x3F, 0x7F, 0x8F, 0x9A, 0x12, 0x51, 0xCB};
|
||||||
// n = p * q
|
// n = p * q
|
||||||
const CryptoPP::byte* Modulus;
|
static constexpr CryptoPP::byte Modulus[] = {
|
||||||
|
0xC2, 0xD2, 0x44, 0xBC, 0xDD, 0x84, 0x3F, 0xD9, 0xC5, 0x22, 0xAF, 0xF7, 0xFC, 0x88, 0x8A,
|
||||||
|
0x33, 0x80, 0xED, 0x8E, 0xE2, 0xCC, 0x81, 0xF7, 0xEC, 0xF8, 0x1C, 0x79, 0xBF, 0x02, 0xBB,
|
||||||
|
0x12, 0x8E, 0x61, 0x68, 0x29, 0x1B, 0x15, 0xB6, 0x5E, 0xC6, 0xF8, 0xBF, 0x5A, 0xE0, 0x3B,
|
||||||
|
0x6A, 0x6C, 0xD9, 0xD6, 0xF5, 0x75, 0xAB, 0xA0, 0x6F, 0x34, 0x81, 0x34, 0x9A, 0x5B, 0xAD,
|
||||||
|
0xED, 0x31, 0xE3, 0xC6, 0xEA, 0x1A, 0xD1, 0x13, 0x22, 0xBB, 0xB3, 0xDA, 0xB3, 0xB2, 0x53,
|
||||||
|
0xBD, 0x45, 0x79, 0x87, 0xAD, 0x0A, 0x01, 0x72, 0x18, 0x10, 0x29, 0x49, 0xF4, 0x41, 0x7F,
|
||||||
|
0xD6, 0x47, 0x0C, 0x72, 0x92, 0x9E, 0xE9, 0xBB, 0x95, 0xA9, 0x5D, 0x79, 0xEB, 0xE4, 0x30,
|
||||||
|
0x76, 0x90, 0x45, 0x4B, 0x9D, 0x9C, 0xCF, 0x92, 0x03, 0x60, 0x8C, 0x4B, 0x6C, 0xB3, 0x7A,
|
||||||
|
0x3A, 0x05, 0x39, 0xA0, 0x66, 0xA9, 0x35, 0xCF, 0xB9, 0xFA, 0xAD, 0x9C, 0xAB, 0xEB, 0xE4,
|
||||||
|
0x6A, 0x8C, 0xE9, 0x3B, 0xCC, 0x72, 0x12, 0x62, 0x63, 0xBD, 0x80, 0xC4, 0xEE, 0x37, 0x2B,
|
||||||
|
0x32, 0x03, 0xA3, 0x09, 0xF7, 0xA0, 0x61, 0x57, 0xAD, 0x0D, 0xCF, 0x15, 0x98, 0x9E, 0x4E,
|
||||||
|
0x49, 0xF8, 0xB5, 0xA3, 0x5C, 0x27, 0xEE, 0x45, 0x04, 0xEA, 0xE4, 0x4B, 0xBC, 0x8F, 0x87,
|
||||||
|
0xED, 0x19, 0x1E, 0x46, 0x75, 0x63, 0xC4, 0x5B, 0xD5, 0xBC, 0x09, 0x2F, 0x02, 0x73, 0x19,
|
||||||
|
0x3C, 0x58, 0x55, 0x49, 0x66, 0x4C, 0x11, 0xEC, 0x0F, 0x09, 0xFA, 0xA5, 0x56, 0x0A, 0x5A,
|
||||||
|
0x63, 0x56, 0xAD, 0xA0, 0x0D, 0x86, 0x08, 0xC1, 0xE6, 0xB6, 0x13, 0x22, 0x49, 0x2F, 0x7C,
|
||||||
|
0xDB, 0x4C, 0x56, 0x97, 0x0E, 0xC2, 0xD9, 0x2E, 0x87, 0xBC, 0x0E, 0x67, 0xC0, 0x1B, 0x58,
|
||||||
|
0xBC, 0x64, 0x2B, 0xC2, 0x6E, 0xE2, 0x93, 0x2E, 0xB5, 0x6B, 0x70, 0xA4, 0x42, 0x9F, 0x64,
|
||||||
|
0xC1};
|
||||||
// p
|
// p
|
||||||
const CryptoPP::byte* Prime1;
|
static constexpr CryptoPP::byte Prime1[] = {
|
||||||
|
0xE5, 0x62, 0xE1, 0x7F, 0x9F, 0x86, 0x08, 0xE2, 0x61, 0xD3, 0xD0, 0x42, 0xE2, 0xC4, 0xB6,
|
||||||
|
0xA8, 0x51, 0x09, 0x19, 0x14, 0xA4, 0x3A, 0x11, 0x4C, 0x33, 0xA5, 0x9C, 0x01, 0x5E, 0x34,
|
||||||
|
0xB6, 0x3F, 0x02, 0x1A, 0xCA, 0x47, 0xF1, 0x4F, 0x3B, 0x35, 0x2A, 0x07, 0x20, 0xEC, 0xD8,
|
||||||
|
0xC1, 0x15, 0xD9, 0xCA, 0x03, 0x4F, 0xB8, 0xE8, 0x09, 0x73, 0x3F, 0x85, 0xB7, 0x41, 0xD5,
|
||||||
|
0x51, 0x3E, 0x7B, 0xE3, 0x53, 0x2B, 0x48, 0x8B, 0x8E, 0xCB, 0xBA, 0xF7, 0xE0, 0x60, 0xF5,
|
||||||
|
0x35, 0x0E, 0x6F, 0xB0, 0xD9, 0x2A, 0x99, 0xD0, 0xFF, 0x60, 0x14, 0xED, 0x40, 0xEA, 0xF8,
|
||||||
|
0xD7, 0x0B, 0xC3, 0x8D, 0x8C, 0xE8, 0x81, 0xB3, 0x75, 0x93, 0x15, 0xB3, 0x7D, 0xF6, 0x39,
|
||||||
|
0x60, 0x1A, 0x00, 0xE7, 0xC3, 0x27, 0xAD, 0xA4, 0x33, 0xD5, 0x3E, 0xA4, 0x35, 0x48, 0x6F,
|
||||||
|
0x22, 0xEF, 0x5D, 0xDD, 0x7D, 0x7B, 0x61, 0x05};
|
||||||
// q
|
// q
|
||||||
const CryptoPP::byte* Prime2;
|
static constexpr CryptoPP::byte Prime2[] = {
|
||||||
const CryptoPP::byte* PrivateExponent;
|
0xD9, 0x6C, 0xC2, 0x0C, 0xF7, 0xAE, 0xD1, 0xF3, 0x3B, 0x3B, 0x49, 0x1E, 0x9F, 0x12, 0x9C,
|
||||||
|
0xA1, 0x78, 0x1F, 0x35, 0x1D, 0x98, 0x26, 0x13, 0x71, 0xF9, 0x09, 0xFD, 0xF0, 0xAD, 0x38,
|
||||||
// Constructor
|
0x55, 0xB7, 0xEE, 0x61, 0x04, 0x72, 0x51, 0x87, 0x2E, 0x05, 0x84, 0xB1, 0x1D, 0x0C, 0x0D,
|
||||||
DebugRifKeyset() {
|
0xDB, 0xD4, 0x25, 0x3E, 0x26, 0xED, 0xEA, 0xB8, 0xF7, 0x49, 0xFE, 0xA2, 0x94, 0xE6, 0xF2,
|
||||||
// Initialize PrivateExponent
|
0x08, 0x92, 0xA7, 0x85, 0xF5, 0x30, 0xB9, 0x84, 0x22, 0xBF, 0xCA, 0xF0, 0x5F, 0xCB, 0x31,
|
||||||
PrivateExponent = new CryptoPP::byte[0x100]{
|
0x20, 0x34, 0x49, 0x16, 0x76, 0x34, 0xCC, 0x7A, 0xCB, 0x96, 0xFE, 0x78, 0x7A, 0x41, 0xFE,
|
||||||
0x01, 0x61, 0xAD, 0xD8, 0x9C, 0x06, 0x89, 0xD0, 0x60, 0xC8, 0x41, 0xF0, 0xB3, 0x83,
|
0x9A, 0xA2, 0x23, 0xF7, 0x68, 0x80, 0xD6, 0xCE, 0x4A, 0x78, 0xA5, 0xB7, 0x05, 0x77, 0x81,
|
||||||
0x01, 0x5D, 0xE3, 0xA2, 0x6B, 0xA2, 0xBA, 0x9A, 0x0A, 0x58, 0xCD, 0x1A, 0xA0, 0x97,
|
0x1F, 0xDE, 0x5E, 0xA8, 0x6E, 0x3E, 0x87, 0xEC, 0x44, 0xD2, 0x69, 0xC6, 0x54, 0x91, 0x6B,
|
||||||
0x64, 0xEC, 0xD0, 0x31, 0x1F, 0xCA, 0x36, 0x0E, 0x69, 0xDD, 0x40, 0xF7, 0x4E, 0xC0,
|
0x5E, 0x13, 0x8A, 0x03, 0x87, 0x05, 0x31, 0x8D};
|
||||||
0xC6, 0xA3, 0x73, 0xF0, 0x69, 0x84, 0xB2, 0xF4, 0x4B, 0x29, 0x14, 0x2A, 0x6D, 0xB8,
|
static constexpr CryptoPP::byte PrivateExponent[] = {
|
||||||
0x23, 0xD8, 0x1B, 0x61, 0xD4, 0x9E, 0x87, 0xB3, 0xBB, 0xA9, 0xC4, 0x85, 0x4A, 0xF8,
|
0x01, 0x61, 0xAD, 0xD8, 0x9C, 0x06, 0x89, 0xD0, 0x60, 0xC8, 0x41, 0xF0, 0xB3, 0x83, 0x01,
|
||||||
0x03, 0x4A, 0xBF, 0xFE, 0xF9, 0xFE, 0x8B, 0xDD, 0x54, 0x83, 0xBA, 0xE0, 0x2F, 0x3F,
|
0x5D, 0xE3, 0xA2, 0x6B, 0xA2, 0xBA, 0x9A, 0x0A, 0x58, 0xCD, 0x1A, 0xA0, 0x97, 0x64, 0xEC,
|
||||||
0xB1, 0xEF, 0xA5, 0x05, 0x5D, 0x28, 0x8B, 0xAB, 0xB5, 0xD0, 0x23, 0x2F, 0x8A, 0xCF,
|
0xD0, 0x31, 0x1F, 0xCA, 0x36, 0x0E, 0x69, 0xDD, 0x40, 0xF7, 0x4E, 0xC0, 0xC6, 0xA3, 0x73,
|
||||||
0x48, 0x7C, 0xAA, 0xBB, 0xC8, 0x5B, 0x36, 0x27, 0xC5, 0x16, 0xA4, 0xB6, 0x61, 0xAC,
|
0xF0, 0x69, 0x84, 0xB2, 0xF4, 0x4B, 0x29, 0x14, 0x2A, 0x6D, 0xB8, 0x23, 0xD8, 0x1B, 0x61,
|
||||||
0x0C, 0x28, 0x47, 0x79, 0x3F, 0x38, 0xAE, 0x5E, 0x25, 0xC6, 0xAF, 0x35, 0xAE, 0xBC,
|
0xD4, 0x9E, 0x87, 0xB3, 0xBB, 0xA9, 0xC4, 0x85, 0x4A, 0xF8, 0x03, 0x4A, 0xBF, 0xFE, 0xF9,
|
||||||
0xB0, 0xF3, 0xBC, 0xBD, 0xFD, 0xA4, 0x87, 0x0D, 0x14, 0x3D, 0x90, 0xE4, 0xDE, 0x5D,
|
0xFE, 0x8B, 0xDD, 0x54, 0x83, 0xBA, 0xE0, 0x2F, 0x3F, 0xB1, 0xEF, 0xA5, 0x05, 0x5D, 0x28,
|
||||||
0x1D, 0x46, 0x81, 0xF1, 0x28, 0x6D, 0x2F, 0x2C, 0x5E, 0x97, 0x2D, 0x89, 0x2A, 0x51,
|
0x8B, 0xAB, 0xB5, 0xD0, 0x23, 0x2F, 0x8A, 0xCF, 0x48, 0x7C, 0xAA, 0xBB, 0xC8, 0x5B, 0x36,
|
||||||
0x72, 0x3C, 0x20, 0x02, 0x59, 0xB1, 0x98, 0x93, 0x05, 0x1E, 0x3F, 0xA1, 0x8A, 0x69,
|
0x27, 0xC5, 0x16, 0xA4, 0xB6, 0x61, 0xAC, 0x0C, 0x28, 0x47, 0x79, 0x3F, 0x38, 0xAE, 0x5E,
|
||||||
0x30, 0x0E, 0x70, 0x84, 0x8B, 0xAE, 0x97, 0xA1, 0x08, 0x95, 0x63, 0x4C, 0xC7, 0xE8,
|
0x25, 0xC6, 0xAF, 0x35, 0xAE, 0xBC, 0xB0, 0xF3, 0xBC, 0xBD, 0xFD, 0xA4, 0x87, 0x0D, 0x14,
|
||||||
0x5D, 0x59, 0xCA, 0x78, 0x2A, 0x23, 0x87, 0xAC, 0x6F, 0x04, 0x33, 0xB1, 0x61, 0xB9,
|
0x3D, 0x90, 0xE4, 0xDE, 0x5D, 0x1D, 0x46, 0x81, 0xF1, 0x28, 0x6D, 0x2F, 0x2C, 0x5E, 0x97,
|
||||||
0xF0, 0x95, 0xDA, 0x33, 0xCC, 0xE0, 0x4C, 0x82, 0x68, 0x82, 0x14, 0x51, 0xBE, 0x49,
|
0x2D, 0x89, 0x2A, 0x51, 0x72, 0x3C, 0x20, 0x02, 0x59, 0xB1, 0x98, 0x93, 0x05, 0x1E, 0x3F,
|
||||||
0x1C, 0x58, 0xA2, 0x8B, 0x05, 0x4E, 0x98, 0x37, 0xEB, 0x94, 0x0B, 0x01, 0x22, 0xDC,
|
0xA1, 0x8A, 0x69, 0x30, 0x0E, 0x70, 0x84, 0x8B, 0xAE, 0x97, 0xA1, 0x08, 0x95, 0x63, 0x4C,
|
||||||
0xB3, 0x19, 0xCA, 0x77, 0xA6, 0x6E, 0x97, 0xFF, 0x8A, 0x53, 0x5A, 0xC5, 0x24, 0xE4,
|
0xC7, 0xE8, 0x5D, 0x59, 0xCA, 0x78, 0x2A, 0x23, 0x87, 0xAC, 0x6F, 0x04, 0x33, 0xB1, 0x61,
|
||||||
0xAF, 0x6E, 0xA8, 0x2B, 0x53, 0xA4, 0xBE, 0x96, 0xA5, 0x7B, 0xCE, 0x22, 0x56, 0xA3,
|
0xB9, 0xF0, 0x95, 0xDA, 0x33, 0xCC, 0xE0, 0x4C, 0x82, 0x68, 0x82, 0x14, 0x51, 0xBE, 0x49,
|
||||||
0xF1, 0xCF, 0x14, 0xA5};
|
0x1C, 0x58, 0xA2, 0x8B, 0x05, 0x4E, 0x98, 0x37, 0xEB, 0x94, 0x0B, 0x01, 0x22, 0xDC, 0xB3,
|
||||||
|
0x19, 0xCA, 0x77, 0xA6, 0x6E, 0x97, 0xFF, 0x8A, 0x53, 0x5A, 0xC5, 0x24, 0xE4, 0xAF, 0x6E,
|
||||||
// Initialize Exponent1
|
0xA8, 0x2B, 0x53, 0xA4, 0xBE, 0x96, 0xA5, 0x7B, 0xCE, 0x22, 0x56, 0xA3, 0xF1, 0xCF, 0x14,
|
||||||
Exponent1 = new CryptoPP::byte[0x80]{
|
0xA5};
|
||||||
0xCD, 0x9A, 0x61, 0xB0, 0xB8, 0xD5, 0xB4, 0xE4, 0xE4, 0xF6, 0xAB, 0xF7, 0x27,
|
|
||||||
0xB7, 0x56, 0x59, 0x6B, 0xB9, 0x11, 0xE7, 0xF4, 0x83, 0xAF, 0xB9, 0x73, 0x99,
|
|
||||||
0x7F, 0x49, 0xA2, 0x9C, 0xF0, 0xB5, 0x6D, 0x37, 0x82, 0x14, 0x15, 0xF1, 0x04,
|
|
||||||
0x8A, 0xD4, 0x8E, 0xEB, 0x2E, 0x1F, 0xE2, 0x81, 0xA9, 0x62, 0x6E, 0xB1, 0x68,
|
|
||||||
0x75, 0x62, 0xF3, 0x0F, 0xFE, 0xD4, 0x91, 0x87, 0x98, 0x78, 0xBF, 0x26, 0xB5,
|
|
||||||
0x07, 0x58, 0xD0, 0xEE, 0x3F, 0x21, 0xE8, 0xC8, 0x0F, 0x5F, 0xFA, 0x1C, 0x64,
|
|
||||||
0x74, 0x49, 0x52, 0xEB, 0xE7, 0xEE, 0xDE, 0xBA, 0x23, 0x26, 0x4A, 0xF6, 0x9C,
|
|
||||||
0x1A, 0x09, 0x3F, 0xB9, 0x0B, 0x36, 0x26, 0x1A, 0xBE, 0xA9, 0x76, 0xE6, 0xF2,
|
|
||||||
0x69, 0xDE, 0xFF, 0xAF, 0xCC, 0x0C, 0x9A, 0x66, 0x03, 0x86, 0x0A, 0x1F, 0x49,
|
|
||||||
0xA4, 0x10, 0xB6, 0xBC, 0xC3, 0x7C, 0x88, 0xE8, 0xCE, 0x4B, 0xD9
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
Exponent2 = new CryptoPP::byte[0x80]{
|
|
||||||
0xB3, 0x73, 0xA3, 0x59, 0xE6, 0x97, 0xC0, 0xAB, 0x3B, 0x68, 0xFC, 0x39, 0xAC,
|
|
||||||
0xDB, 0x44, 0xB1, 0xB4, 0x9E, 0x35, 0x4D, 0xBE, 0xC5, 0x36, 0x69, 0x6C, 0x3D,
|
|
||||||
0xC5, 0xFC, 0xFE, 0x4B, 0x2F, 0xDC, 0x86, 0x80, 0x46, 0x96, 0x40, 0x1A, 0x0D,
|
|
||||||
0x6E, 0xFA, 0x8C, 0xE0, 0x47, 0x91, 0xAC, 0xAD, 0x95, 0x2B, 0x8E, 0x1F, 0xF2,
|
|
||||||
0x0A, 0x45, 0xF8, 0x29, 0x95, 0x70, 0xC6, 0x88, 0x5F, 0x71, 0x03, 0x99, 0x79,
|
|
||||||
0xBC, 0x84, 0x71, 0xBD, 0xE8, 0x84, 0x8C, 0x0E, 0xD4, 0x7B, 0x30, 0x74, 0x57,
|
|
||||||
0x1A, 0x95, 0xE7, 0x90, 0x19, 0x8D, 0xAD, 0x8B, 0x4C, 0x4E, 0xC3, 0xE7, 0x6B,
|
|
||||||
0x23, 0x86, 0x01, 0xEE, 0x9B, 0xE0, 0x2F, 0x15, 0xA2, 0x2C, 0x4C, 0x39, 0xD3,
|
|
||||||
0xDF, 0x9C, 0x39, 0x01, 0xF1, 0x8C, 0x44, 0x4A, 0x15, 0x44, 0xDC, 0x51, 0xF7,
|
|
||||||
0x22, 0xD7, 0x7F, 0x41, 0x7F, 0x68, 0xFA, 0xEE, 0x56, 0xE8, 0x05};
|
|
||||||
|
|
||||||
PublicExponent = new CryptoPP::byte[4]{0x00, 0x01, 0x00, 0x01};
|
|
||||||
|
|
||||||
Coefficient = new CryptoPP::byte[0x80]{
|
|
||||||
0xC0, 0x32, 0x43, 0xD3, 0x8C, 0x3D, 0xB4, 0xD2, 0x48, 0x8C, 0x42, 0x41, 0x24,
|
|
||||||
0x94, 0x6C, 0x80, 0xC9, 0xC1, 0x79, 0x36, 0x7F, 0xAC, 0xC3, 0xFF, 0x6A, 0x25,
|
|
||||||
0xEB, 0x2C, 0xFB, 0xD4, 0x2B, 0xA0, 0xEB, 0xFE, 0x25, 0xE9, 0xC6, 0x77, 0xCE,
|
|
||||||
0xFE, 0x2D, 0x23, 0xFE, 0xD0, 0xF4, 0x0F, 0xD9, 0x7E, 0xD5, 0xA5, 0x7D, 0x1F,
|
|
||||||
0xC0, 0xE8, 0xE8, 0xEC, 0x80, 0x5B, 0xC7, 0xFD, 0xE2, 0xBD, 0x94, 0xA6, 0x2B,
|
|
||||||
0xDD, 0x6A, 0x60, 0x45, 0x54, 0xAB, 0xCA, 0x42, 0x9C, 0x6A, 0x6C, 0xBF, 0x3C,
|
|
||||||
0x84, 0xF9, 0xA5, 0x0E, 0x63, 0x0C, 0x51, 0x58, 0x62, 0x6D, 0x5A, 0xB7, 0x3C,
|
|
||||||
0x3F, 0x49, 0x1A, 0xD0, 0x93, 0xB8, 0x4F, 0x1A, 0x6C, 0x5F, 0xC5, 0xE5, 0xA9,
|
|
||||||
0x75, 0xD4, 0x86, 0x9E, 0xDF, 0x87, 0x0F, 0x27, 0xB0, 0x26, 0x78, 0x4E, 0xFB,
|
|
||||||
0xC1, 0x8A, 0x4A, 0x24, 0x3F, 0x7F, 0x8F, 0x9A, 0x12, 0x51, 0xCB};
|
|
||||||
|
|
||||||
Modulus = new CryptoPP::byte[0x100]{
|
|
||||||
0xC2, 0xD2, 0x44, 0xBC, 0xDD, 0x84, 0x3F, 0xD9, 0xC5, 0x22, 0xAF, 0xF7, 0xFC, 0x88,
|
|
||||||
0x8A, 0x33, 0x80, 0xED, 0x8E, 0xE2, 0xCC, 0x81, 0xF7, 0xEC, 0xF8, 0x1C, 0x79, 0xBF,
|
|
||||||
0x02, 0xBB, 0x12, 0x8E, 0x61, 0x68, 0x29, 0x1B, 0x15, 0xB6, 0x5E, 0xC6, 0xF8, 0xBF,
|
|
||||||
0x5A, 0xE0, 0x3B, 0x6A, 0x6C, 0xD9, 0xD6, 0xF5, 0x75, 0xAB, 0xA0, 0x6F, 0x34, 0x81,
|
|
||||||
0x34, 0x9A, 0x5B, 0xAD, 0xED, 0x31, 0xE3, 0xC6, 0xEA, 0x1A, 0xD1, 0x13, 0x22, 0xBB,
|
|
||||||
0xB3, 0xDA, 0xB3, 0xB2, 0x53, 0xBD, 0x45, 0x79, 0x87, 0xAD, 0x0A, 0x01, 0x72, 0x18,
|
|
||||||
0x10, 0x29, 0x49, 0xF4, 0x41, 0x7F, 0xD6, 0x47, 0x0C, 0x72, 0x92, 0x9E, 0xE9, 0xBB,
|
|
||||||
0x95, 0xA9, 0x5D, 0x79, 0xEB, 0xE4, 0x30, 0x76, 0x90, 0x45, 0x4B, 0x9D, 0x9C, 0xCF,
|
|
||||||
0x92, 0x03, 0x60, 0x8C, 0x4B, 0x6C, 0xB3, 0x7A, 0x3A, 0x05, 0x39, 0xA0, 0x66, 0xA9,
|
|
||||||
0x35, 0xCF, 0xB9, 0xFA, 0xAD, 0x9C, 0xAB, 0xEB, 0xE4, 0x6A, 0x8C, 0xE9, 0x3B, 0xCC,
|
|
||||||
0x72, 0x12, 0x62, 0x63, 0xBD, 0x80, 0xC4, 0xEE, 0x37, 0x2B, 0x32, 0x03, 0xA3, 0x09,
|
|
||||||
0xF7, 0xA0, 0x61, 0x57, 0xAD, 0x0D, 0xCF, 0x15, 0x98, 0x9E, 0x4E, 0x49, 0xF8, 0xB5,
|
|
||||||
0xA3, 0x5C, 0x27, 0xEE, 0x45, 0x04, 0xEA, 0xE4, 0x4B, 0xBC, 0x8F, 0x87, 0xED, 0x19,
|
|
||||||
0x1E, 0x46, 0x75, 0x63, 0xC4, 0x5B, 0xD5, 0xBC, 0x09, 0x2F, 0x02, 0x73, 0x19, 0x3C,
|
|
||||||
0x58, 0x55, 0x49, 0x66, 0x4C, 0x11, 0xEC, 0x0F, 0x09, 0xFA, 0xA5, 0x56, 0x0A, 0x5A,
|
|
||||||
0x63, 0x56, 0xAD, 0xA0, 0x0D, 0x86, 0x08, 0xC1, 0xE6, 0xB6, 0x13, 0x22, 0x49, 0x2F,
|
|
||||||
0x7C, 0xDB, 0x4C, 0x56, 0x97, 0x0E, 0xC2, 0xD9, 0x2E, 0x87, 0xBC, 0x0E, 0x67, 0xC0,
|
|
||||||
0x1B, 0x58, 0xBC, 0x64, 0x2B, 0xC2, 0x6E, 0xE2, 0x93, 0x2E, 0xB5, 0x6B, 0x70, 0xA4,
|
|
||||||
0x42, 0x9F, 0x64, 0xC1};
|
|
||||||
|
|
||||||
Prime1 = new CryptoPP::byte[0x80]{
|
|
||||||
0xE5, 0x62, 0xE1, 0x7F, 0x9F, 0x86, 0x08, 0xE2, 0x61, 0xD3, 0xD0, 0x42, 0xE2,
|
|
||||||
0xC4, 0xB6, 0xA8, 0x51, 0x09, 0x19, 0x14, 0xA4, 0x3A, 0x11, 0x4C, 0x33, 0xA5,
|
|
||||||
0x9C, 0x01, 0x5E, 0x34, 0xB6, 0x3F, 0x02, 0x1A, 0xCA, 0x47, 0xF1, 0x4F, 0x3B,
|
|
||||||
0x35, 0x2A, 0x07, 0x20, 0xEC, 0xD8, 0xC1, 0x15, 0xD9, 0xCA, 0x03, 0x4F, 0xB8,
|
|
||||||
0xE8, 0x09, 0x73, 0x3F, 0x85, 0xB7, 0x41, 0xD5, 0x51, 0x3E, 0x7B, 0xE3, 0x53,
|
|
||||||
0x2B, 0x48, 0x8B, 0x8E, 0xCB, 0xBA, 0xF7, 0xE0, 0x60, 0xF5, 0x35, 0x0E, 0x6F,
|
|
||||||
0xB0, 0xD9, 0x2A, 0x99, 0xD0, 0xFF, 0x60, 0x14, 0xED, 0x40, 0xEA, 0xF8, 0xD7,
|
|
||||||
0x0B, 0xC3, 0x8D, 0x8C, 0xE8, 0x81, 0xB3, 0x75, 0x93, 0x15, 0xB3, 0x7D, 0xF6,
|
|
||||||
0x39, 0x60, 0x1A, 0x00, 0xE7, 0xC3, 0x27, 0xAD, 0xA4, 0x33, 0xD5, 0x3E, 0xA4,
|
|
||||||
0x35, 0x48, 0x6F, 0x22, 0xEF, 0x5D, 0xDD, 0x7D, 0x7B, 0x61, 0x05};
|
|
||||||
|
|
||||||
Prime2 = new CryptoPP::byte[0x80]{
|
|
||||||
0xD9, 0x6C, 0xC2, 0x0C, 0xF7, 0xAE, 0xD1, 0xF3, 0x3B, 0x3B, 0x49, 0x1E, 0x9F,
|
|
||||||
0x12, 0x9C, 0xA1, 0x78, 0x1F, 0x35, 0x1D, 0x98, 0x26, 0x13, 0x71, 0xF9, 0x09,
|
|
||||||
0xFD, 0xF0, 0xAD, 0x38, 0x55, 0xB7, 0xEE, 0x61, 0x04, 0x72, 0x51, 0x87, 0x2E,
|
|
||||||
0x05, 0x84, 0xB1, 0x1D, 0x0C, 0x0D, 0xDB, 0xD4, 0x25, 0x3E, 0x26, 0xED, 0xEA,
|
|
||||||
0xB8, 0xF7, 0x49, 0xFE, 0xA2, 0x94, 0xE6, 0xF2, 0x08, 0x92, 0xA7, 0x85, 0xF5,
|
|
||||||
0x30, 0xB9, 0x84, 0x22, 0xBF, 0xCA, 0xF0, 0x5F, 0xCB, 0x31, 0x20, 0x34, 0x49,
|
|
||||||
0x16, 0x76, 0x34, 0xCC, 0x7A, 0xCB, 0x96, 0xFE, 0x78, 0x7A, 0x41, 0xFE, 0x9A,
|
|
||||||
0xA2, 0x23, 0xF7, 0x68, 0x80, 0xD6, 0xCE, 0x4A, 0x78, 0xA5, 0xB7, 0x05, 0x77,
|
|
||||||
0x81, 0x1F, 0xDE, 0x5E, 0xA8, 0x6E, 0x3E, 0x87, 0xEC, 0x44, 0xD2, 0x69, 0xC6,
|
|
||||||
0x54, 0x91, 0x6B, 0x5E, 0x13, 0x8A, 0x03, 0x87, 0x05, 0x31, 0x8D};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PkgDerivedKey3Keyset {
|
class PkgDerivedKey3Keyset {
|
||||||
public:
|
public:
|
||||||
// PkgDerivedKey3Keyset();
|
|
||||||
//~PkgDerivedKey3Keyset();
|
|
||||||
|
|
||||||
// Constructor
|
|
||||||
// std::uint8_t* PrivateExponent;
|
// std::uint8_t* PrivateExponent;
|
||||||
const CryptoPP::byte* Exponent1;
|
static constexpr CryptoPP::byte Exponent1[] = {
|
||||||
|
0x52, 0xCC, 0x2D, 0xA0, 0x9C, 0x9E, 0x75, 0xE7, 0x28, 0xEE, 0x3D, 0xDE, 0xE3, 0x45, 0xD1,
|
||||||
|
0x4F, 0x94, 0x1C, 0xCC, 0xC8, 0x87, 0x29, 0x45, 0x3B, 0x8D, 0x6E, 0xAB, 0x6E, 0x2A, 0xA7,
|
||||||
|
0xC7, 0x15, 0x43, 0xA3, 0x04, 0x8F, 0x90, 0x5F, 0xEB, 0xF3, 0x38, 0x4A, 0x77, 0xFA, 0x36,
|
||||||
|
0xB7, 0x15, 0x76, 0xB6, 0x01, 0x1A, 0x8E, 0x25, 0x87, 0x82, 0xF1, 0x55, 0xD8, 0xC6, 0x43,
|
||||||
|
0x2A, 0xC0, 0xE5, 0x98, 0xC9, 0x32, 0xD1, 0x94, 0x6F, 0xD9, 0x01, 0xBA, 0x06, 0x81, 0xE0,
|
||||||
|
0x6D, 0x88, 0xF2, 0x24, 0x2A, 0x25, 0x01, 0x64, 0x5C, 0xBF, 0xF2, 0xD9, 0x99, 0x67, 0x3E,
|
||||||
|
0xF6, 0x72, 0xEE, 0xE4, 0xE2, 0x33, 0x5C, 0xF8, 0x00, 0x40, 0xE3, 0x2A, 0x9A, 0xF4, 0x3D,
|
||||||
|
0x22, 0x86, 0x44, 0x3C, 0xFB, 0x0A, 0xA5, 0x7C, 0x3F, 0xCC, 0xF5, 0xF1, 0x16, 0xC4, 0xAC,
|
||||||
|
0x88, 0xB4, 0xDE, 0x62, 0x94, 0x92, 0x6A, 0x13};
|
||||||
// exponent2 = d mod (q - 1)
|
// exponent2 = d mod (q - 1)
|
||||||
const CryptoPP::byte* Exponent2;
|
static constexpr CryptoPP::byte Exponent2[] = {
|
||||||
|
0x7C, 0x9D, 0xAD, 0x39, 0xE0, 0xD5, 0x60, 0x14, 0x94, 0x48, 0x19, 0x7F, 0x88, 0x95, 0xD5,
|
||||||
|
0x8B, 0x80, 0xAD, 0x85, 0x8A, 0x4B, 0x77, 0x37, 0x85, 0xD0, 0x77, 0xBB, 0xBF, 0x89, 0x71,
|
||||||
|
0x4A, 0x72, 0xCB, 0x72, 0x68, 0x38, 0xEC, 0x02, 0xC6, 0x7D, 0xC6, 0x44, 0x06, 0x33, 0x51,
|
||||||
|
0x1C, 0xC0, 0xFF, 0x95, 0x8F, 0x0D, 0x75, 0xDC, 0x25, 0xBB, 0x0B, 0x73, 0x91, 0xA9, 0x6D,
|
||||||
|
0x42, 0xD8, 0x03, 0xB7, 0x68, 0xD4, 0x1E, 0x75, 0x62, 0xA3, 0x70, 0x35, 0x79, 0x78, 0x00,
|
||||||
|
0xC8, 0xF5, 0xEF, 0x15, 0xB9, 0xFC, 0x4E, 0x47, 0x5A, 0xC8, 0x70, 0x70, 0x5B, 0x52, 0x98,
|
||||||
|
0xC0, 0xC2, 0x58, 0x4A, 0x70, 0x96, 0xCC, 0xB8, 0x10, 0xE1, 0x2F, 0x78, 0x8B, 0x2B, 0xA1,
|
||||||
|
0x7F, 0xF9, 0xAC, 0xDE, 0xF0, 0xBB, 0x2B, 0xE2, 0x66, 0xE3, 0x22, 0x92, 0x31, 0x21, 0x57,
|
||||||
|
0x92, 0xC4, 0xB8, 0xF2, 0x3E, 0x76, 0x20, 0x37};
|
||||||
// e
|
// e
|
||||||
const CryptoPP::byte* PublicExponent;
|
static constexpr CryptoPP::byte PublicExponent[] = {0, 1, 0, 1};
|
||||||
// (InverseQ)(q) = 1 mod p
|
// (InverseQ)(q) = 1 mod p
|
||||||
const CryptoPP::byte* Coefficient;
|
static constexpr CryptoPP::byte Coefficient[] = {
|
||||||
|
0x45, 0x97, 0x55, 0xD4, 0x22, 0x08, 0x5E, 0xF3, 0x5C, 0xB4, 0x05, 0x7A, 0xFD, 0xAA, 0x42,
|
||||||
|
0x42, 0xAD, 0x9A, 0x8C, 0xA0, 0x6C, 0xBB, 0x1D, 0x68, 0x54, 0x54, 0x6E, 0x3E, 0x32, 0xE3,
|
||||||
|
0x53, 0x73, 0x76, 0xF1, 0x3E, 0x01, 0xEA, 0xD3, 0xCF, 0xEB, 0xEB, 0x23, 0x3E, 0xC0, 0xBE,
|
||||||
|
0xCE, 0xEC, 0x2C, 0x89, 0x5F, 0xA8, 0x27, 0x3A, 0x4C, 0xB7, 0xE6, 0x74, 0xBC, 0x45, 0x4C,
|
||||||
|
0x26, 0xC8, 0x25, 0xFF, 0x34, 0x63, 0x25, 0x37, 0xE1, 0x48, 0x10, 0xC1, 0x93, 0xA6, 0xAF,
|
||||||
|
0xEB, 0xBA, 0xE3, 0xA2, 0xF1, 0x3D, 0xEF, 0x63, 0xD8, 0xF4, 0xFD, 0xD3, 0xEE, 0xE2, 0x5D,
|
||||||
|
0xE9, 0x33, 0xCC, 0xAD, 0xBA, 0x75, 0x5C, 0x85, 0xAF, 0xCE, 0xA9, 0x3D, 0xD1, 0xA2, 0x17,
|
||||||
|
0xF3, 0xF6, 0x98, 0xB3, 0x50, 0x8E, 0x5E, 0xF6, 0xEB, 0x02, 0x8E, 0xA1, 0x62, 0xA7, 0xD6,
|
||||||
|
0x2C, 0xEC, 0x91, 0xFF, 0x15, 0x40, 0xD2, 0xE3};
|
||||||
// n = p * q
|
// n = p * q
|
||||||
const CryptoPP::byte* Modulus;
|
static constexpr CryptoPP::byte Modulus[] = {
|
||||||
|
0xd2, 0x12, 0xfc, 0x33, 0x5f, 0x6d, 0xdb, 0x83, 0x16, 0x09, 0x62, 0x8b, 0x03, 0x56, 0x27,
|
||||||
|
0x37, 0x82, 0xd4, 0x77, 0x85, 0x35, 0x29, 0x39, 0x2d, 0x52, 0x6b, 0x8c, 0x4c, 0x8c, 0xfb,
|
||||||
|
0x06, 0xc1, 0x84, 0x5b, 0xe7, 0xd4, 0xf7, 0xbc, 0xd2, 0x4e, 0x62, 0x45, 0xcd, 0x2a, 0xbb,
|
||||||
|
0xd7, 0x77, 0x76, 0x45, 0x36, 0x55, 0x27, 0x3f, 0xb3, 0xf5, 0xf9, 0x8e, 0xda, 0x4b, 0xef,
|
||||||
|
0xaa, 0x59, 0xae, 0xb3, 0x9b, 0xea, 0x54, 0x98, 0xd2, 0x06, 0x32, 0x6a, 0x58, 0x31, 0x2a,
|
||||||
|
0xe0, 0xd4, 0x4f, 0x90, 0xb5, 0x0a, 0x7d, 0xec, 0xf4, 0x3a, 0x9c, 0x52, 0x67, 0x2d, 0x99,
|
||||||
|
0x31, 0x8e, 0x0c, 0x43, 0xe6, 0x82, 0xfe, 0x07, 0x46, 0xe1, 0x2e, 0x50, 0xd4, 0x1f, 0x2d,
|
||||||
|
0x2f, 0x7e, 0xd9, 0x08, 0xba, 0x06, 0xb3, 0xbf, 0x2e, 0x20, 0x3f, 0x4e, 0x3f, 0xfe, 0x44,
|
||||||
|
0xff, 0xaa, 0x50, 0x43, 0x57, 0x91, 0x69, 0x94, 0x49, 0x15, 0x82, 0x82, 0xe4, 0x0f, 0x4c,
|
||||||
|
0x8d, 0x9d, 0x2c, 0xc9, 0x5b, 0x1d, 0x64, 0xbf, 0x88, 0x8b, 0xd4, 0xc5, 0x94, 0xe7, 0x65,
|
||||||
|
0x47, 0x84, 0x1e, 0xe5, 0x79, 0x10, 0xfb, 0x98, 0x93, 0x47, 0xb9, 0x7d, 0x85, 0x12, 0xa6,
|
||||||
|
0x40, 0x98, 0x2c, 0xf7, 0x92, 0xbc, 0x95, 0x19, 0x32, 0xed, 0xe8, 0x90, 0x56, 0x0d, 0x65,
|
||||||
|
0xc1, 0xaa, 0x78, 0xc6, 0x2e, 0x54, 0xfd, 0x5f, 0x54, 0xa1, 0xf6, 0x7e, 0xe5, 0xe0, 0x5f,
|
||||||
|
0x61, 0xc1, 0x20, 0xb4, 0xb9, 0xb4, 0x33, 0x08, 0x70, 0xe4, 0xdf, 0x89, 0x56, 0xed, 0x01,
|
||||||
|
0x29, 0x46, 0x77, 0x5f, 0x8c, 0xb8, 0xa9, 0xf5, 0x1e, 0x2e, 0xb3, 0xb9, 0xbf, 0xe0, 0x09,
|
||||||
|
0xb7, 0x8d, 0x28, 0xd4, 0xa6, 0xc3, 0xb8, 0x1e, 0x1f, 0x07, 0xeb, 0xb4, 0x12, 0x0b, 0x95,
|
||||||
|
0xb8, 0x85, 0x30, 0xfd, 0xdc, 0x39, 0x13, 0xd0, 0x7c, 0xdc, 0x8f, 0xed, 0xf9, 0xc9, 0xa3,
|
||||||
|
0xc1};
|
||||||
// p
|
// p
|
||||||
const CryptoPP::byte* Prime1;
|
static constexpr CryptoPP::byte Prime1[] = {
|
||||||
|
0xF9, 0x67, 0xAD, 0x99, 0x12, 0x31, 0x0C, 0x56, 0xA2, 0x2E, 0x16, 0x1C, 0x46, 0xB3, 0x4D,
|
||||||
|
0x5B, 0x43, 0xBE, 0x42, 0xA2, 0xF6, 0x86, 0x96, 0x80, 0x42, 0xC3, 0xC7, 0x3F, 0xC3, 0x42,
|
||||||
|
0xF5, 0x87, 0x49, 0x33, 0x9F, 0x07, 0x5D, 0x6E, 0x2C, 0x04, 0xFD, 0xE3, 0xE1, 0xB2, 0xAE,
|
||||||
|
0x0A, 0x0C, 0xF0, 0xC7, 0xA6, 0x1C, 0xA1, 0x63, 0x50, 0xC8, 0x09, 0x9C, 0x51, 0x24, 0x52,
|
||||||
|
0x6C, 0x5E, 0x5E, 0xBD, 0x1E, 0x27, 0x06, 0xBB, 0xBC, 0x9E, 0x94, 0xE1, 0x35, 0xD4, 0x6D,
|
||||||
|
0xB3, 0xCB, 0x3C, 0x68, 0xDD, 0x68, 0xB3, 0xFE, 0x6C, 0xCB, 0x8D, 0x82, 0x20, 0x76, 0x23,
|
||||||
|
0x63, 0xB7, 0xE9, 0x68, 0x10, 0x01, 0x4E, 0xDC, 0xBA, 0x27, 0x5D, 0x01, 0xC1, 0x2D, 0x80,
|
||||||
|
0x5E, 0x2B, 0xAF, 0x82, 0x6B, 0xD8, 0x84, 0xB6, 0x10, 0x52, 0x86, 0xA7, 0x89, 0x8E, 0xAE,
|
||||||
|
0x9A, 0xE2, 0x89, 0xC6, 0xF7, 0xD5, 0x87, 0xFB};
|
||||||
// q
|
// q
|
||||||
const CryptoPP::byte* Prime2;
|
static constexpr CryptoPP::byte Prime2[] = {
|
||||||
const CryptoPP::byte* PrivateExponent;
|
0xD7, 0xA1, 0x0F, 0x9A, 0x8B, 0xF2, 0xC9, 0x11, 0x95, 0x32, 0x9A, 0x8C, 0xF0, 0xD9, 0x40,
|
||||||
|
0x47, 0xF5, 0x68, 0xA0, 0x0D, 0xBD, 0xC1, 0xFC, 0x43, 0x2F, 0x65, 0xF9, 0xC3, 0x61, 0x0F,
|
||||||
PkgDerivedKey3Keyset() {
|
0x25, 0x77, 0x54, 0xAD, 0xD7, 0x58, 0xAC, 0x84, 0x40, 0x60, 0x8D, 0x3F, 0xF3, 0x65, 0x89,
|
||||||
|
0x75, 0xB5, 0xC6, 0x2C, 0x51, 0x1A, 0x2F, 0x1F, 0x22, 0xE4, 0x43, 0x11, 0x54, 0xBE, 0xC9,
|
||||||
Prime1 = new CryptoPP::byte[0x80]{
|
0xB4, 0xC7, 0xB5, 0x1B, 0x05, 0x0B, 0xBC, 0x56, 0x9A, 0xCD, 0x4A, 0xD9, 0x73, 0x68, 0x5E,
|
||||||
0xF9, 0x67, 0xAD, 0x99, 0x12, 0x31, 0x0C, 0x56, 0xA2, 0x2E, 0x16, 0x1C, 0x46,
|
0x5C, 0xFB, 0x92, 0xB7, 0x8B, 0x0D, 0xFF, 0xF5, 0x07, 0xCA, 0xB4, 0xC8, 0x9B, 0x96, 0x3C,
|
||||||
0xB3, 0x4D, 0x5B, 0x43, 0xBE, 0x42, 0xA2, 0xF6, 0x86, 0x96, 0x80, 0x42, 0xC3,
|
0x07, 0x9E, 0x3E, 0x6B, 0x2A, 0x11, 0xF2, 0x8A, 0xB1, 0x8A, 0xD7, 0x2E, 0x1B, 0xA5, 0x53,
|
||||||
0xC7, 0x3F, 0xC3, 0x42, 0xF5, 0x87, 0x49, 0x33, 0x9F, 0x07, 0x5D, 0x6E, 0x2C,
|
0x24, 0x06, 0xED, 0x50, 0xB8, 0x90, 0x67, 0xB1, 0xE2, 0x41, 0xC6, 0x92, 0x01, 0xEE, 0x10,
|
||||||
0x04, 0xFD, 0xE3, 0xE1, 0xB2, 0xAE, 0x0A, 0x0C, 0xF0, 0xC7, 0xA6, 0x1C, 0xA1,
|
0xF0, 0x61, 0xBB, 0xFB, 0xB2, 0x7D, 0x4A, 0x73};
|
||||||
0x63, 0x50, 0xC8, 0x09, 0x9C, 0x51, 0x24, 0x52, 0x6C, 0x5E, 0x5E, 0xBD, 0x1E,
|
static constexpr CryptoPP::byte PrivateExponent[] = {
|
||||||
0x27, 0x06, 0xBB, 0xBC, 0x9E, 0x94, 0xE1, 0x35, 0xD4, 0x6D, 0xB3, 0xCB, 0x3C,
|
0x32, 0xD9, 0x03, 0x90, 0x8F, 0xBD, 0xB0, 0x8F, 0x57, 0x2B, 0x28, 0x5E, 0x0B, 0x8D, 0xB3,
|
||||||
0x68, 0xDD, 0x68, 0xB3, 0xFE, 0x6C, 0xCB, 0x8D, 0x82, 0x20, 0x76, 0x23, 0x63,
|
0xEA, 0x5C, 0xD1, 0x7E, 0xA8, 0x90, 0x88, 0x8C, 0xDD, 0x6A, 0x80, 0xBB, 0xB1, 0xDF, 0xC1,
|
||||||
0xB7, 0xE9, 0x68, 0x10, 0x01, 0x4E, 0xDC, 0xBA, 0x27, 0x5D, 0x01, 0xC1, 0x2D,
|
0xF7, 0x0D, 0xAA, 0x32, 0xF0, 0xB7, 0x7C, 0xCB, 0x88, 0x80, 0x0E, 0x8B, 0x64, 0xB0, 0xBE,
|
||||||
0x80, 0x5E, 0x2B, 0xAF, 0x82, 0x6B, 0xD8, 0x84, 0xB6, 0x10, 0x52, 0x86, 0xA7,
|
0x4C, 0xD6, 0x0E, 0x9B, 0x8C, 0x1E, 0x2A, 0x64, 0xE1, 0xF3, 0x5C, 0xD7, 0x76, 0x01, 0x41,
|
||||||
0x89, 0x8E, 0xAE, 0x9A, 0xE2, 0x89, 0xC6, 0xF7, 0xD5, 0x87, 0xFB};
|
0x5E, 0x93, 0x5C, 0x94, 0xFE, 0xDD, 0x46, 0x62, 0xC3, 0x1B, 0x5A, 0xE2, 0xA0, 0xBC, 0x2D,
|
||||||
|
0xEB, 0xC3, 0x98, 0x0A, 0xA7, 0xB7, 0x85, 0x69, 0x70, 0x68, 0x2B, 0x64, 0x4A, 0xB3, 0x1F,
|
||||||
Prime2 = new CryptoPP::byte[0x80]{
|
0xCC, 0x7D, 0xDC, 0x7C, 0x26, 0xF4, 0x77, 0xF6, 0x5C, 0xF2, 0xAE, 0x5A, 0x44, 0x2D, 0xD3,
|
||||||
0xD7, 0xA1, 0x0F, 0x9A, 0x8B, 0xF2, 0xC9, 0x11, 0x95, 0x32, 0x9A, 0x8C, 0xF0,
|
0xAB, 0x16, 0x62, 0x04, 0x19, 0xBA, 0xFB, 0x90, 0xFF, 0xE2, 0x30, 0x50, 0x89, 0x6E, 0xCB,
|
||||||
0xD9, 0x40, 0x47, 0xF5, 0x68, 0xA0, 0x0D, 0xBD, 0xC1, 0xFC, 0x43, 0x2F, 0x65,
|
0x56, 0xB2, 0xEB, 0xC0, 0x91, 0x16, 0x92, 0x5E, 0x30, 0x8E, 0xAE, 0xC7, 0x94, 0x5D, 0xFD,
|
||||||
0xF9, 0xC3, 0x61, 0x0F, 0x25, 0x77, 0x54, 0xAD, 0xD7, 0x58, 0xAC, 0x84, 0x40,
|
0x35, 0xE1, 0x20, 0xF8, 0xAD, 0x3E, 0xBC, 0x08, 0xBF, 0xC0, 0x36, 0x74, 0x9F, 0xD5, 0xBB,
|
||||||
0x60, 0x8D, 0x3F, 0xF3, 0x65, 0x89, 0x75, 0xB5, 0xC6, 0x2C, 0x51, 0x1A, 0x2F,
|
0x52, 0x08, 0xFD, 0x06, 0x66, 0xF3, 0x7A, 0xB3, 0x04, 0xF4, 0x75, 0x29, 0x5D, 0xE9, 0x5F,
|
||||||
0x1F, 0x22, 0xE4, 0x43, 0x11, 0x54, 0xBE, 0xC9, 0xB4, 0xC7, 0xB5, 0x1B, 0x05,
|
0xAA, 0x10, 0x30, 0xB2, 0x0F, 0x5A, 0x1A, 0xC1, 0x2A, 0xB3, 0xFE, 0xCB, 0x21, 0xAD, 0x80,
|
||||||
0x0B, 0xBC, 0x56, 0x9A, 0xCD, 0x4A, 0xD9, 0x73, 0x68, 0x5E, 0x5C, 0xFB, 0x92,
|
0xEC, 0x8F, 0x20, 0x09, 0x1C, 0xDB, 0xC5, 0x58, 0x94, 0xC2, 0x9C, 0xC6, 0xCE, 0x82, 0x65,
|
||||||
0xB7, 0x8B, 0x0D, 0xFF, 0xF5, 0x07, 0xCA, 0xB4, 0xC8, 0x9B, 0x96, 0x3C, 0x07,
|
0x3E, 0x57, 0x90, 0xBC, 0xA9, 0x8B, 0x06, 0xB4, 0xF0, 0x72, 0xF6, 0x77, 0xDF, 0x98, 0x64,
|
||||||
0x9E, 0x3E, 0x6B, 0x2A, 0x11, 0xF2, 0x8A, 0xB1, 0x8A, 0xD7, 0x2E, 0x1B, 0xA5,
|
0xF1, 0xEC, 0xFE, 0x37, 0x2D, 0xBC, 0xAE, 0x8C, 0x08, 0x81, 0x1F, 0xC3, 0xC9, 0x89, 0x1A,
|
||||||
0x53, 0x24, 0x06, 0xED, 0x50, 0xB8, 0x90, 0x67, 0xB1, 0xE2, 0x41, 0xC6, 0x92,
|
0xC7, 0x42, 0x82, 0x4B, 0x2E, 0xDC, 0x8E, 0x8D, 0x73, 0xCE, 0xB1, 0xCC, 0x01, 0xD9, 0x08,
|
||||||
0x01, 0xEE, 0x10, 0xF0, 0x61, 0xBB, 0xFB, 0xB2, 0x7D, 0x4A, 0x73};
|
0x70, 0x87, 0x3C, 0x44, 0x08, 0xEC, 0x49, 0x8F, 0x81, 0x5A, 0xE2, 0x40, 0xFF, 0x77, 0xFC,
|
||||||
PrivateExponent = new CryptoPP::byte[0x100]{
|
0x0D};
|
||||||
0x32, 0xD9, 0x03, 0x90, 0x8F, 0xBD, 0xB0, 0x8F, 0x57, 0x2B, 0x28, 0x5E, 0x0B, 0x8D,
|
|
||||||
0xB3, 0xEA, 0x5C, 0xD1, 0x7E, 0xA8, 0x90, 0x88, 0x8C, 0xDD, 0x6A, 0x80, 0xBB, 0xB1,
|
|
||||||
0xDF, 0xC1, 0xF7, 0x0D, 0xAA, 0x32, 0xF0, 0xB7, 0x7C, 0xCB, 0x88, 0x80, 0x0E, 0x8B,
|
|
||||||
0x64, 0xB0, 0xBE, 0x4C, 0xD6, 0x0E, 0x9B, 0x8C, 0x1E, 0x2A, 0x64, 0xE1, 0xF3, 0x5C,
|
|
||||||
0xD7, 0x76, 0x01, 0x41, 0x5E, 0x93, 0x5C, 0x94, 0xFE, 0xDD, 0x46, 0x62, 0xC3, 0x1B,
|
|
||||||
0x5A, 0xE2, 0xA0, 0xBC, 0x2D, 0xEB, 0xC3, 0x98, 0x0A, 0xA7, 0xB7, 0x85, 0x69, 0x70,
|
|
||||||
0x68, 0x2B, 0x64, 0x4A, 0xB3, 0x1F, 0xCC, 0x7D, 0xDC, 0x7C, 0x26, 0xF4, 0x77, 0xF6,
|
|
||||||
0x5C, 0xF2, 0xAE, 0x5A, 0x44, 0x2D, 0xD3, 0xAB, 0x16, 0x62, 0x04, 0x19, 0xBA, 0xFB,
|
|
||||||
0x90, 0xFF, 0xE2, 0x30, 0x50, 0x89, 0x6E, 0xCB, 0x56, 0xB2, 0xEB, 0xC0, 0x91, 0x16,
|
|
||||||
0x92, 0x5E, 0x30, 0x8E, 0xAE, 0xC7, 0x94, 0x5D, 0xFD, 0x35, 0xE1, 0x20, 0xF8, 0xAD,
|
|
||||||
0x3E, 0xBC, 0x08, 0xBF, 0xC0, 0x36, 0x74, 0x9F, 0xD5, 0xBB, 0x52, 0x08, 0xFD, 0x06,
|
|
||||||
0x66, 0xF3, 0x7A, 0xB3, 0x04, 0xF4, 0x75, 0x29, 0x5D, 0xE9, 0x5F, 0xAA, 0x10, 0x30,
|
|
||||||
0xB2, 0x0F, 0x5A, 0x1A, 0xC1, 0x2A, 0xB3, 0xFE, 0xCB, 0x21, 0xAD, 0x80, 0xEC, 0x8F,
|
|
||||||
0x20, 0x09, 0x1C, 0xDB, 0xC5, 0x58, 0x94, 0xC2, 0x9C, 0xC6, 0xCE, 0x82, 0x65, 0x3E,
|
|
||||||
0x57, 0x90, 0xBC, 0xA9, 0x8B, 0x06, 0xB4, 0xF0, 0x72, 0xF6, 0x77, 0xDF, 0x98, 0x64,
|
|
||||||
0xF1, 0xEC, 0xFE, 0x37, 0x2D, 0xBC, 0xAE, 0x8C, 0x08, 0x81, 0x1F, 0xC3, 0xC9, 0x89,
|
|
||||||
0x1A, 0xC7, 0x42, 0x82, 0x4B, 0x2E, 0xDC, 0x8E, 0x8D, 0x73, 0xCE, 0xB1, 0xCC, 0x01,
|
|
||||||
0xD9, 0x08, 0x70, 0x87, 0x3C, 0x44, 0x08, 0xEC, 0x49, 0x8F, 0x81, 0x5A, 0xE2, 0x40,
|
|
||||||
0xFF, 0x77, 0xFC, 0x0D};
|
|
||||||
Exponent1 = new CryptoPP::byte[0x80]{
|
|
||||||
0x52, 0xCC, 0x2D, 0xA0, 0x9C, 0x9E, 0x75, 0xE7, 0x28, 0xEE, 0x3D, 0xDE, 0xE3,
|
|
||||||
0x45, 0xD1, 0x4F, 0x94, 0x1C, 0xCC, 0xC8, 0x87, 0x29, 0x45, 0x3B, 0x8D, 0x6E,
|
|
||||||
0xAB, 0x6E, 0x2A, 0xA7, 0xC7, 0x15, 0x43, 0xA3, 0x04, 0x8F, 0x90, 0x5F, 0xEB,
|
|
||||||
0xF3, 0x38, 0x4A, 0x77, 0xFA, 0x36, 0xB7, 0x15, 0x76, 0xB6, 0x01, 0x1A, 0x8E,
|
|
||||||
0x25, 0x87, 0x82, 0xF1, 0x55, 0xD8, 0xC6, 0x43, 0x2A, 0xC0, 0xE5, 0x98, 0xC9,
|
|
||||||
0x32, 0xD1, 0x94, 0x6F, 0xD9, 0x01, 0xBA, 0x06, 0x81, 0xE0, 0x6D, 0x88, 0xF2,
|
|
||||||
0x24, 0x2A, 0x25, 0x01, 0x64, 0x5C, 0xBF, 0xF2, 0xD9, 0x99, 0x67, 0x3E, 0xF6,
|
|
||||||
0x72, 0xEE, 0xE4, 0xE2, 0x33, 0x5C, 0xF8, 0x00, 0x40, 0xE3, 0x2A, 0x9A, 0xF4,
|
|
||||||
0x3D, 0x22, 0x86, 0x44, 0x3C, 0xFB, 0x0A, 0xA5, 0x7C, 0x3F, 0xCC, 0xF5, 0xF1,
|
|
||||||
0x16, 0xC4, 0xAC, 0x88, 0xB4, 0xDE, 0x62, 0x94, 0x92, 0x6A, 0x13};
|
|
||||||
Exponent2 = new CryptoPP::byte[0x80]{
|
|
||||||
0x7C, 0x9D, 0xAD, 0x39, 0xE0, 0xD5, 0x60, 0x14, 0x94, 0x48, 0x19, 0x7F, 0x88,
|
|
||||||
0x95, 0xD5, 0x8B, 0x80, 0xAD, 0x85, 0x8A, 0x4B, 0x77, 0x37, 0x85, 0xD0, 0x77,
|
|
||||||
0xBB, 0xBF, 0x89, 0x71, 0x4A, 0x72, 0xCB, 0x72, 0x68, 0x38, 0xEC, 0x02, 0xC6,
|
|
||||||
0x7D, 0xC6, 0x44, 0x06, 0x33, 0x51, 0x1C, 0xC0, 0xFF, 0x95, 0x8F, 0x0D, 0x75,
|
|
||||||
0xDC, 0x25, 0xBB, 0x0B, 0x73, 0x91, 0xA9, 0x6D, 0x42, 0xD8, 0x03, 0xB7, 0x68,
|
|
||||||
0xD4, 0x1E, 0x75, 0x62, 0xA3, 0x70, 0x35, 0x79, 0x78, 0x00, 0xC8, 0xF5, 0xEF,
|
|
||||||
0x15, 0xB9, 0xFC, 0x4E, 0x47, 0x5A, 0xC8, 0x70, 0x70, 0x5B, 0x52, 0x98, 0xC0,
|
|
||||||
0xC2, 0x58, 0x4A, 0x70, 0x96, 0xCC, 0xB8, 0x10, 0xE1, 0x2F, 0x78, 0x8B, 0x2B,
|
|
||||||
0xA1, 0x7F, 0xF9, 0xAC, 0xDE, 0xF0, 0xBB, 0x2B, 0xE2, 0x66, 0xE3, 0x22, 0x92,
|
|
||||||
0x31, 0x21, 0x57, 0x92, 0xC4, 0xB8, 0xF2, 0x3E, 0x76, 0x20, 0x37};
|
|
||||||
Coefficient = new CryptoPP::byte[0x80]{
|
|
||||||
0x45, 0x97, 0x55, 0xD4, 0x22, 0x08, 0x5E, 0xF3, 0x5C, 0xB4, 0x05, 0x7A, 0xFD,
|
|
||||||
0xAA, 0x42, 0x42, 0xAD, 0x9A, 0x8C, 0xA0, 0x6C, 0xBB, 0x1D, 0x68, 0x54, 0x54,
|
|
||||||
0x6E, 0x3E, 0x32, 0xE3, 0x53, 0x73, 0x76, 0xF1, 0x3E, 0x01, 0xEA, 0xD3, 0xCF,
|
|
||||||
0xEB, 0xEB, 0x23, 0x3E, 0xC0, 0xBE, 0xCE, 0xEC, 0x2C, 0x89, 0x5F, 0xA8, 0x27,
|
|
||||||
0x3A, 0x4C, 0xB7, 0xE6, 0x74, 0xBC, 0x45, 0x4C, 0x26, 0xC8, 0x25, 0xFF, 0x34,
|
|
||||||
0x63, 0x25, 0x37, 0xE1, 0x48, 0x10, 0xC1, 0x93, 0xA6, 0xAF, 0xEB, 0xBA, 0xE3,
|
|
||||||
0xA2, 0xF1, 0x3D, 0xEF, 0x63, 0xD8, 0xF4, 0xFD, 0xD3, 0xEE, 0xE2, 0x5D, 0xE9,
|
|
||||||
0x33, 0xCC, 0xAD, 0xBA, 0x75, 0x5C, 0x85, 0xAF, 0xCE, 0xA9, 0x3D, 0xD1, 0xA2,
|
|
||||||
0x17, 0xF3, 0xF6, 0x98, 0xB3, 0x50, 0x8E, 0x5E, 0xF6, 0xEB, 0x02, 0x8E, 0xA1,
|
|
||||||
0x62, 0xA7, 0xD6, 0x2C, 0xEC, 0x91, 0xFF, 0x15, 0x40, 0xD2, 0xE3};
|
|
||||||
Modulus = new CryptoPP::byte[0x100]{
|
|
||||||
0xd2, 0x12, 0xfc, 0x33, 0x5f, 0x6d, 0xdb, 0x83, 0x16, 0x09, 0x62, 0x8b, 0x03, 0x56,
|
|
||||||
0x27, 0x37, 0x82, 0xd4, 0x77, 0x85, 0x35, 0x29, 0x39, 0x2d, 0x52, 0x6b, 0x8c, 0x4c,
|
|
||||||
0x8c, 0xfb, 0x06, 0xc1, 0x84, 0x5b, 0xe7, 0xd4, 0xf7, 0xbc, 0xd2, 0x4e, 0x62, 0x45,
|
|
||||||
0xcd, 0x2a, 0xbb, 0xd7, 0x77, 0x76, 0x45, 0x36, 0x55, 0x27, 0x3f, 0xb3, 0xf5, 0xf9,
|
|
||||||
0x8e, 0xda, 0x4b, 0xef, 0xaa, 0x59, 0xae, 0xb3, 0x9b, 0xea, 0x54, 0x98, 0xd2, 0x06,
|
|
||||||
0x32, 0x6a, 0x58, 0x31, 0x2a, 0xe0, 0xd4, 0x4f, 0x90, 0xb5, 0x0a, 0x7d, 0xec, 0xf4,
|
|
||||||
0x3a, 0x9c, 0x52, 0x67, 0x2d, 0x99, 0x31, 0x8e, 0x0c, 0x43, 0xe6, 0x82, 0xfe, 0x07,
|
|
||||||
0x46, 0xe1, 0x2e, 0x50, 0xd4, 0x1f, 0x2d, 0x2f, 0x7e, 0xd9, 0x08, 0xba, 0x06, 0xb3,
|
|
||||||
0xbf, 0x2e, 0x20, 0x3f, 0x4e, 0x3f, 0xfe, 0x44, 0xff, 0xaa, 0x50, 0x43, 0x57, 0x91,
|
|
||||||
0x69, 0x94, 0x49, 0x15, 0x82, 0x82, 0xe4, 0x0f, 0x4c, 0x8d, 0x9d, 0x2c, 0xc9, 0x5b,
|
|
||||||
0x1d, 0x64, 0xbf, 0x88, 0x8b, 0xd4, 0xc5, 0x94, 0xe7, 0x65, 0x47, 0x84, 0x1e, 0xe5,
|
|
||||||
0x79, 0x10, 0xfb, 0x98, 0x93, 0x47, 0xb9, 0x7d, 0x85, 0x12, 0xa6, 0x40, 0x98, 0x2c,
|
|
||||||
0xf7, 0x92, 0xbc, 0x95, 0x19, 0x32, 0xed, 0xe8, 0x90, 0x56, 0x0d, 0x65, 0xc1, 0xaa,
|
|
||||||
0x78, 0xc6, 0x2e, 0x54, 0xfd, 0x5f, 0x54, 0xa1, 0xf6, 0x7e, 0xe5, 0xe0, 0x5f, 0x61,
|
|
||||||
0xc1, 0x20, 0xb4, 0xb9, 0xb4, 0x33, 0x08, 0x70, 0xe4, 0xdf, 0x89, 0x56, 0xed, 0x01,
|
|
||||||
0x29, 0x46, 0x77, 0x5f, 0x8c, 0xb8, 0xa9, 0xf5, 0x1e, 0x2e, 0xb3, 0xb9, 0xbf, 0xe0,
|
|
||||||
0x09, 0xb7, 0x8d, 0x28, 0xd4, 0xa6, 0xc3, 0xb8, 0x1e, 0x1f, 0x07, 0xeb, 0xb4, 0x12,
|
|
||||||
0x0b, 0x95, 0xb8, 0x85, 0x30, 0xfd, 0xdc, 0x39, 0x13, 0xd0, 0x7c, 0xdc, 0x8f, 0xed,
|
|
||||||
0xf9, 0xc9, 0xa3, 0xc1};
|
|
||||||
PublicExponent = new CryptoPP::byte[4]{0, 1, 0, 1};
|
|
||||||
};
|
|
||||||
};
|
};
|
|
@ -1,9 +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
|
||||||
|
|
||||||
// Generated By moduleGenerator
|
#include "ajm.h"
|
||||||
|
#include "ajm_error.h"
|
||||||
|
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "core/libraries/ajm/ajm.h"
|
|
||||||
#include "core/libraries/error_codes.h"
|
#include "core/libraries/error_codes.h"
|
||||||
#include "core/libraries/libs.h"
|
#include "core/libraries/libs.h"
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
constexpr int ORBIS_AJM_ERROR_UNKNOWN = 0x80930001;
|
||||||
|
constexpr int ORBIS_AJM_ERROR_INVALID_CONTEXT = 0x80930002;
|
||||||
|
constexpr int ORBIS_AJM_ERROR_INVALID_INSTANCE = 0x80930003;
|
||||||
|
constexpr int ORBIS_AJM_ERROR_INVALID_BATCH = 0x80930004;
|
||||||
|
constexpr int ORBIS_AJM_ERROR_INVALID_PARAMETER = 0x80930005;
|
||||||
|
constexpr int ORBIS_AJM_ERROR_OUT_OF_MEMORY = 0x80930006;
|
||||||
|
constexpr int ORBIS_AJM_ERROR_OUT_OF_RESOURCES = 0x80930007;
|
||||||
|
constexpr int ORBIS_AJM_ERROR_CODEC_NOT_SUPPORTED = 0x80930008;
|
||||||
|
constexpr int ORBIS_AJM_ERROR_CODEC_ALREADY_REGISTERED = 0x80930009;
|
||||||
|
constexpr int ORBIS_AJM_ERROR_CODEC_NOT_REGISTERED = 0x8093000A;
|
||||||
|
constexpr int ORBIS_AJM_ERROR_WRONG_REVISION_FLAG = 0x8093000B;
|
||||||
|
constexpr int ORBIS_AJM_ERROR_FLAG_NOT_SUPPORTED = 0x8093000C;
|
||||||
|
constexpr int ORBIS_AJM_ERROR_BUSY = 0x8093000D;
|
||||||
|
constexpr int ORBIS_AJM_ERROR_BAD_PRIORITY = 0x8093000E;
|
||||||
|
constexpr int ORBIS_AJM_ERROR_IN_PROGRESS = 0x8093000F;
|
||||||
|
constexpr int ORBIS_AJM_ERROR_RETRY = 0x80930010;
|
||||||
|
constexpr int ORBIS_AJM_ERROR_MALFORMED_BATCH = 0x80930011;
|
||||||
|
constexpr int ORBIS_AJM_ERROR_JOB_CREATION = 0x80930012;
|
||||||
|
constexpr int ORBIS_AJM_ERROR_INVALID_OPCODE = 0x80930013;
|
||||||
|
constexpr int ORBIS_AJM_ERROR_PRIORITY_VIOLATION = 0x80930014;
|
||||||
|
constexpr int ORBIS_AJM_ERROR_BUFFER_TOO_BIG = 0x80930015;
|
||||||
|
constexpr int ORBIS_AJM_ERROR_INVALID_ADDRESS = 0x80930016;
|
||||||
|
constexpr int ORBIS_AJM_ERROR_CANCELLED = 0x80930017;
|
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
#include "common/types.h"
|
#include "common/types.h"
|
||||||
|
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
struct AVIOContext;
|
struct AVIOContext;
|
||||||
|
|
||||||
namespace Libraries::AvPlayer {
|
namespace Libraries::AvPlayer {
|
||||||
|
@ -14,6 +16,7 @@ namespace Libraries::AvPlayer {
|
||||||
class IDataStreamer {
|
class IDataStreamer {
|
||||||
public:
|
public:
|
||||||
virtual ~IDataStreamer() = default;
|
virtual ~IDataStreamer() = default;
|
||||||
|
virtual bool Init(std::string_view path) = 0;
|
||||||
virtual AVIOContext* GetContext() = 0;
|
virtual AVIOContext* GetContext() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -18,19 +18,8 @@ extern "C" {
|
||||||
|
|
||||||
namespace Libraries::AvPlayer {
|
namespace Libraries::AvPlayer {
|
||||||
|
|
||||||
AvPlayerFileStreamer::AvPlayerFileStreamer(const SceAvPlayerFileReplacement& file_replacement,
|
AvPlayerFileStreamer::AvPlayerFileStreamer(const SceAvPlayerFileReplacement& file_replacement)
|
||||||
std::string_view path)
|
: m_file_replacement(file_replacement) {}
|
||||||
: m_file_replacement(file_replacement) {
|
|
||||||
const auto ptr = m_file_replacement.object_ptr;
|
|
||||||
m_fd = m_file_replacement.open(ptr, path.data());
|
|
||||||
ASSERT(m_fd >= 0);
|
|
||||||
m_file_size = m_file_replacement.size(ptr);
|
|
||||||
// avio_buffer is deallocated in `avio_context_free`
|
|
||||||
const auto avio_buffer = reinterpret_cast<u8*>(av_malloc(AVPLAYER_AVIO_BUFFER_SIZE));
|
|
||||||
m_avio_context =
|
|
||||||
avio_alloc_context(avio_buffer, AVPLAYER_AVIO_BUFFER_SIZE, 0, this,
|
|
||||||
&AvPlayerFileStreamer::ReadPacket, nullptr, &AvPlayerFileStreamer::Seek);
|
|
||||||
}
|
|
||||||
|
|
||||||
AvPlayerFileStreamer::~AvPlayerFileStreamer() {
|
AvPlayerFileStreamer::~AvPlayerFileStreamer() {
|
||||||
if (m_avio_context != nullptr) {
|
if (m_avio_context != nullptr) {
|
||||||
|
@ -43,6 +32,21 @@ AvPlayerFileStreamer::~AvPlayerFileStreamer() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AvPlayerFileStreamer::Init(std::string_view path) {
|
||||||
|
const auto ptr = m_file_replacement.object_ptr;
|
||||||
|
m_fd = m_file_replacement.open(ptr, path.data());
|
||||||
|
if (m_fd < 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_file_size = m_file_replacement.size(ptr);
|
||||||
|
// avio_buffer is deallocated in `avio_context_free`
|
||||||
|
const auto avio_buffer = reinterpret_cast<u8*>(av_malloc(AVPLAYER_AVIO_BUFFER_SIZE));
|
||||||
|
m_avio_context =
|
||||||
|
avio_alloc_context(avio_buffer, AVPLAYER_AVIO_BUFFER_SIZE, 0, this,
|
||||||
|
&AvPlayerFileStreamer::ReadPacket, nullptr, &AvPlayerFileStreamer::Seek);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
s32 AvPlayerFileStreamer::ReadPacket(void* opaque, u8* buffer, s32 size) {
|
s32 AvPlayerFileStreamer::ReadPacket(void* opaque, u8* buffer, s32 size) {
|
||||||
const auto self = reinterpret_cast<AvPlayerFileStreamer*>(opaque);
|
const auto self = reinterpret_cast<AvPlayerFileStreamer*>(opaque);
|
||||||
if (self->m_position >= self->m_file_size) {
|
if (self->m_position >= self->m_file_size) {
|
||||||
|
|
|
@ -15,9 +15,11 @@ namespace Libraries::AvPlayer {
|
||||||
|
|
||||||
class AvPlayerFileStreamer : public IDataStreamer {
|
class AvPlayerFileStreamer : public IDataStreamer {
|
||||||
public:
|
public:
|
||||||
AvPlayerFileStreamer(const SceAvPlayerFileReplacement& file_replacement, std::string_view path);
|
AvPlayerFileStreamer(const SceAvPlayerFileReplacement& file_replacement);
|
||||||
~AvPlayerFileStreamer();
|
~AvPlayerFileStreamer();
|
||||||
|
|
||||||
|
bool Init(std::string_view path) override;
|
||||||
|
|
||||||
AVIOContext* GetContext() override {
|
AVIOContext* GetContext() override {
|
||||||
return m_avio_context;
|
return m_avio_context;
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@ s32 AvPlayer::AddSource(std::string_view path) {
|
||||||
if (path.empty()) {
|
if (path.empty()) {
|
||||||
return ORBIS_AVPLAYER_ERROR_INVALID_PARAMS;
|
return ORBIS_AVPLAYER_ERROR_INVALID_PARAMS;
|
||||||
}
|
}
|
||||||
if (AVPLAYER_IS_ERROR(m_state->AddSource(path, GetSourceType(path)))) {
|
if (!m_state->AddSource(path, GetSourceType(path))) {
|
||||||
return ORBIS_AVPLAYER_ERROR_OPERATION_FAILED;
|
return ORBIS_AVPLAYER_ERROR_OPERATION_FAILED;
|
||||||
}
|
}
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
|
@ -128,7 +128,7 @@ s32 AvPlayer::GetStreamCount() {
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 AvPlayer::GetStreamInfo(u32 stream_index, SceAvPlayerStreamInfo& info) {
|
s32 AvPlayer::GetStreamInfo(u32 stream_index, SceAvPlayerStreamInfo& info) {
|
||||||
if (AVPLAYER_IS_ERROR(m_state->GetStreamInfo(stream_index, info))) {
|
if (!m_state->GetStreamInfo(stream_index, info)) {
|
||||||
return ORBIS_AVPLAYER_ERROR_OPERATION_FAILED;
|
return ORBIS_AVPLAYER_ERROR_OPERATION_FAILED;
|
||||||
}
|
}
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
|
@ -145,7 +145,10 @@ s32 AvPlayer::EnableStream(u32 stream_index) {
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 AvPlayer::Start() {
|
s32 AvPlayer::Start() {
|
||||||
return m_state->Start();
|
if (!m_state->Start()) {
|
||||||
|
return ORBIS_AVPLAYER_ERROR_OPERATION_FAILED;
|
||||||
|
}
|
||||||
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AvPlayer::GetVideoData(SceAvPlayerFrameInfo& video_info) {
|
bool AvPlayer::GetVideoData(SceAvPlayerFrameInfo& video_info) {
|
||||||
|
|
|
@ -24,31 +24,39 @@ namespace Libraries::AvPlayer {
|
||||||
|
|
||||||
using namespace Kernel;
|
using namespace Kernel;
|
||||||
|
|
||||||
AvPlayerSource::AvPlayerSource(AvPlayerStateCallback& state, std::string_view path,
|
AvPlayerSource::AvPlayerSource(AvPlayerStateCallback& state) : m_state(state) {}
|
||||||
const SceAvPlayerInitData& init_data,
|
|
||||||
SceAvPlayerSourceType source_type)
|
|
||||||
: m_state(state), m_memory_replacement(init_data.memory_replacement),
|
|
||||||
m_num_output_video_framebuffers(
|
|
||||||
std::min(std::max(2, init_data.num_output_video_framebuffers), 16)) {
|
|
||||||
AVFormatContext* context = avformat_alloc_context();
|
|
||||||
if (init_data.file_replacement.open != nullptr) {
|
|
||||||
m_up_data_streamer =
|
|
||||||
std::make_unique<AvPlayerFileStreamer>(init_data.file_replacement, path);
|
|
||||||
context->pb = m_up_data_streamer->GetContext();
|
|
||||||
ASSERT(!AVPLAYER_IS_ERROR(avformat_open_input(&context, nullptr, nullptr, nullptr)));
|
|
||||||
} else {
|
|
||||||
const auto mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
|
||||||
const auto filepath = mnt->GetHostPath(path);
|
|
||||||
ASSERT(!AVPLAYER_IS_ERROR(
|
|
||||||
avformat_open_input(&context, filepath.string().c_str(), nullptr, nullptr)));
|
|
||||||
}
|
|
||||||
m_avformat_context = AVFormatContextPtr(context, &ReleaseAVFormatContext);
|
|
||||||
}
|
|
||||||
|
|
||||||
AvPlayerSource::~AvPlayerSource() {
|
AvPlayerSource::~AvPlayerSource() {
|
||||||
Stop();
|
Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AvPlayerSource::Init(const SceAvPlayerInitData& init_data, std::string_view path) {
|
||||||
|
m_memory_replacement = init_data.memory_replacement,
|
||||||
|
m_num_output_video_framebuffers =
|
||||||
|
std::min(std::max(2, init_data.num_output_video_framebuffers), 16);
|
||||||
|
|
||||||
|
AVFormatContext* context = avformat_alloc_context();
|
||||||
|
if (init_data.file_replacement.open != nullptr) {
|
||||||
|
m_up_data_streamer = std::make_unique<AvPlayerFileStreamer>(init_data.file_replacement);
|
||||||
|
if (!m_up_data_streamer->Init(path)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
context->pb = m_up_data_streamer->GetContext();
|
||||||
|
if (AVPLAYER_IS_ERROR(avformat_open_input(&context, nullptr, nullptr, nullptr))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const auto mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||||
|
const auto filepath = mnt->GetHostPath(path);
|
||||||
|
if (AVPLAYER_IS_ERROR(
|
||||||
|
avformat_open_input(&context, filepath.string().c_str(), nullptr, nullptr))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_avformat_context = AVFormatContextPtr(context, &ReleaseAVFormatContext);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool AvPlayerSource::FindStreamInfo() {
|
bool AvPlayerSource::FindStreamInfo() {
|
||||||
if (m_avformat_context == nullptr) {
|
if (m_avformat_context == nullptr) {
|
||||||
LOG_ERROR(Lib_AvPlayer, "Could not find stream info. NULL context.");
|
LOG_ERROR(Lib_AvPlayer, "Could not find stream info. NULL context.");
|
||||||
|
@ -87,16 +95,16 @@ static f32 AVRationalToF32(const AVRational rational) {
|
||||||
return f32(rational.num) / rational.den;
|
return f32(rational.num) / rational.den;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 AvPlayerSource::GetStreamInfo(u32 stream_index, SceAvPlayerStreamInfo& info) {
|
bool AvPlayerSource::GetStreamInfo(u32 stream_index, SceAvPlayerStreamInfo& info) {
|
||||||
info = {};
|
info = {};
|
||||||
if (m_avformat_context == nullptr || stream_index >= m_avformat_context->nb_streams) {
|
if (m_avformat_context == nullptr || stream_index >= m_avformat_context->nb_streams) {
|
||||||
LOG_ERROR(Lib_AvPlayer, "Could not get stream {} info.", stream_index);
|
LOG_ERROR(Lib_AvPlayer, "Could not get stream {} info.", stream_index);
|
||||||
return -1;
|
return false;
|
||||||
}
|
}
|
||||||
const auto p_stream = m_avformat_context->streams[stream_index];
|
const auto p_stream = m_avformat_context->streams[stream_index];
|
||||||
if (p_stream == nullptr || p_stream->codecpar == nullptr) {
|
if (p_stream == nullptr || p_stream->codecpar == nullptr) {
|
||||||
LOG_ERROR(Lib_AvPlayer, "Could not get stream {} info. NULL stream.", stream_index);
|
LOG_ERROR(Lib_AvPlayer, "Could not get stream {} info. NULL stream.", stream_index);
|
||||||
return -1;
|
return false;
|
||||||
}
|
}
|
||||||
info.type = CodecTypeToStreamType(p_stream->codecpar->codec_type);
|
info.type = CodecTypeToStreamType(p_stream->codecpar->codec_type);
|
||||||
info.start_time = p_stream->start_time;
|
info.start_time = p_stream->start_time;
|
||||||
|
@ -140,9 +148,9 @@ s32 AvPlayerSource::GetStreamInfo(u32 stream_index, SceAvPlayerStreamInfo& info)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG_ERROR(Lib_AvPlayer, "Stream {} type is unknown: {}.", stream_index, info.type);
|
LOG_ERROR(Lib_AvPlayer, "Stream {} type is unknown: {}.", stream_index, info.type);
|
||||||
return -1;
|
return false;
|
||||||
}
|
}
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AvPlayerSource::EnableStream(u32 stream_index) {
|
bool AvPlayerSource::EnableStream(u32 stream_index) {
|
||||||
|
@ -215,12 +223,12 @@ std::optional<bool> AvPlayerSource::HasFrames(u32 num_frames) {
|
||||||
return m_video_packets.Size() > num_frames || m_is_eof;
|
return m_video_packets.Size() > num_frames || m_is_eof;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 AvPlayerSource::Start() {
|
bool AvPlayerSource::Start() {
|
||||||
std::unique_lock lock(m_state_mutex);
|
std::unique_lock lock(m_state_mutex);
|
||||||
|
|
||||||
if (m_audio_codec_context == nullptr && m_video_codec_context == nullptr) {
|
if (m_audio_codec_context == nullptr && m_video_codec_context == nullptr) {
|
||||||
LOG_ERROR(Lib_AvPlayer, "Could not start playback. NULL context.");
|
LOG_ERROR(Lib_AvPlayer, "Could not start playback. NULL context.");
|
||||||
return -1;
|
return false;
|
||||||
}
|
}
|
||||||
m_demuxer_thread = std::jthread([this](std::stop_token stop) { this->DemuxerThread(stop); });
|
m_demuxer_thread = std::jthread([this](std::stop_token stop) { this->DemuxerThread(stop); });
|
||||||
m_video_decoder_thread =
|
m_video_decoder_thread =
|
||||||
|
@ -228,7 +236,7 @@ s32 AvPlayerSource::Start() {
|
||||||
m_audio_decoder_thread =
|
m_audio_decoder_thread =
|
||||||
std::jthread([this](std::stop_token stop) { this->AudioDecoderThread(stop); });
|
std::jthread([this](std::stop_token stop) { this->AudioDecoderThread(stop); });
|
||||||
m_start_time = std::chrono::high_resolution_clock::now();
|
m_start_time = std::chrono::high_resolution_clock::now();
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AvPlayerSource::Stop() {
|
bool AvPlayerSource::Stop() {
|
||||||
|
|
|
@ -120,17 +120,17 @@ private:
|
||||||
|
|
||||||
class AvPlayerSource {
|
class AvPlayerSource {
|
||||||
public:
|
public:
|
||||||
AvPlayerSource(AvPlayerStateCallback& state, std::string_view path,
|
AvPlayerSource(AvPlayerStateCallback& state);
|
||||||
const SceAvPlayerInitData& init_data, SceAvPlayerSourceType source_type);
|
|
||||||
~AvPlayerSource();
|
~AvPlayerSource();
|
||||||
|
|
||||||
|
bool Init(const SceAvPlayerInitData& init_data, std::string_view path);
|
||||||
bool FindStreamInfo();
|
bool FindStreamInfo();
|
||||||
s32 GetStreamCount();
|
s32 GetStreamCount();
|
||||||
s32 GetStreamInfo(u32 stream_index, SceAvPlayerStreamInfo& info);
|
bool GetStreamInfo(u32 stream_index, SceAvPlayerStreamInfo& info);
|
||||||
bool EnableStream(u32 stream_index);
|
bool EnableStream(u32 stream_index);
|
||||||
void SetLooping(bool is_looping);
|
void SetLooping(bool is_looping);
|
||||||
std::optional<bool> HasFrames(u32 num_frames);
|
std::optional<bool> HasFrames(u32 num_frames);
|
||||||
s32 Start();
|
bool Start();
|
||||||
bool Stop();
|
bool Stop();
|
||||||
bool GetAudioData(SceAvPlayerFrameInfo& audio_info);
|
bool GetAudioData(SceAvPlayerFrameInfo& audio_info);
|
||||||
bool GetVideoData(SceAvPlayerFrameInfo& video_info);
|
bool GetVideoData(SceAvPlayerFrameInfo& video_info);
|
||||||
|
|
|
@ -24,6 +24,7 @@ void PS4_SYSV_ABI AvPlayerState::AutoPlayEventCallback(void* opaque, s32 event_i
|
||||||
s32 timedtext_stream_index = -1;
|
s32 timedtext_stream_index = -1;
|
||||||
const s32 stream_count = self->GetStreamCount();
|
const s32 stream_count = self->GetStreamCount();
|
||||||
if (AVPLAYER_IS_ERROR(stream_count)) {
|
if (AVPLAYER_IS_ERROR(stream_count)) {
|
||||||
|
self->Stop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (stream_count == 0) {
|
if (stream_count == 0) {
|
||||||
|
@ -32,7 +33,10 @@ void PS4_SYSV_ABI AvPlayerState::AutoPlayEventCallback(void* opaque, s32 event_i
|
||||||
}
|
}
|
||||||
for (u32 stream_index = 0; stream_index < stream_count; ++stream_index) {
|
for (u32 stream_index = 0; stream_index < stream_count; ++stream_index) {
|
||||||
SceAvPlayerStreamInfo info{};
|
SceAvPlayerStreamInfo info{};
|
||||||
self->GetStreamInfo(stream_index, info);
|
if (!self->GetStreamInfo(stream_index, info)) {
|
||||||
|
self->Stop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const std::string_view default_language(
|
const std::string_view default_language(
|
||||||
reinterpret_cast<char*>(self->m_default_language));
|
reinterpret_cast<char*>(self->m_default_language));
|
||||||
|
@ -116,23 +120,28 @@ AvPlayerState::~AvPlayerState() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called inside GAME thread
|
// Called inside GAME thread
|
||||||
s32 AvPlayerState::AddSource(std::string_view path, SceAvPlayerSourceType source_type) {
|
bool AvPlayerState::AddSource(std::string_view path, SceAvPlayerSourceType source_type) {
|
||||||
if (path.empty()) {
|
if (path.empty()) {
|
||||||
LOG_ERROR(Lib_AvPlayer, "File path is empty.");
|
LOG_ERROR(Lib_AvPlayer, "File path is empty.");
|
||||||
return -1;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
std::unique_lock lock(m_source_mutex);
|
std::unique_lock lock(m_source_mutex);
|
||||||
if (m_up_source != nullptr) {
|
if (m_up_source != nullptr) {
|
||||||
LOG_ERROR(Lib_AvPlayer, "Only one source is supported.");
|
LOG_ERROR(Lib_AvPlayer, "Only one source is supported.");
|
||||||
return -1;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_up_source = std::make_unique<AvPlayerSource>(*this, path, m_init_data, source_type);
|
m_up_source = std::make_unique<AvPlayerSource>(*this);
|
||||||
|
if (!m_up_source->Init(m_init_data, path)) {
|
||||||
|
SetState(AvState::Error);
|
||||||
|
m_up_source.reset();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
AddSourceEvent();
|
AddSourceEvent();
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called inside GAME thread
|
// Called inside GAME thread
|
||||||
|
@ -146,25 +155,25 @@ s32 AvPlayerState::GetStreamCount() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called inside GAME thread
|
// Called inside GAME thread
|
||||||
s32 AvPlayerState::GetStreamInfo(u32 stream_index, SceAvPlayerStreamInfo& info) {
|
bool AvPlayerState::GetStreamInfo(u32 stream_index, SceAvPlayerStreamInfo& info) {
|
||||||
std::shared_lock lock(m_source_mutex);
|
std::shared_lock lock(m_source_mutex);
|
||||||
if (m_up_source == nullptr) {
|
if (m_up_source == nullptr) {
|
||||||
LOG_ERROR(Lib_AvPlayer, "Could not get stream {} info. No source.", stream_index);
|
LOG_ERROR(Lib_AvPlayer, "Could not get stream {} info. No source.", stream_index);
|
||||||
return -1;
|
return false;
|
||||||
}
|
}
|
||||||
return m_up_source->GetStreamInfo(stream_index, info);
|
return m_up_source->GetStreamInfo(stream_index, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called inside GAME thread
|
// Called inside GAME thread
|
||||||
s32 AvPlayerState::Start() {
|
bool AvPlayerState::Start() {
|
||||||
std::shared_lock lock(m_source_mutex);
|
std::shared_lock lock(m_source_mutex);
|
||||||
if (m_up_source == nullptr || m_up_source->Start() < 0) {
|
if (m_up_source == nullptr || !m_up_source->Start()) {
|
||||||
LOG_ERROR(Lib_AvPlayer, "Could not start playback.");
|
LOG_ERROR(Lib_AvPlayer, "Could not start playback.");
|
||||||
return -1;
|
return false;
|
||||||
}
|
}
|
||||||
SetState(AvState::Play);
|
SetState(AvState::Play);
|
||||||
OnPlaybackStateChanged(AvState::Play);
|
OnPlaybackStateChanged(AvState::Play);
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AvPlayerState::AvControllerThread(std::stop_token stop) {
|
void AvPlayerState::AvControllerThread(std::stop_token stop) {
|
||||||
|
@ -219,10 +228,10 @@ bool AvPlayerState::Stop() {
|
||||||
if (m_up_source == nullptr || m_current_state == AvState::Stop) {
|
if (m_up_source == nullptr || m_current_state == AvState::Stop) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!SetState(AvState::Stop)) {
|
if (!m_up_source->Stop()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!m_up_source->Stop()) {
|
if (!SetState(AvState::Stop)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
OnPlaybackStateChanged(AvState::Stop);
|
OnPlaybackStateChanged(AvState::Stop);
|
||||||
|
|
|
@ -24,11 +24,11 @@ public:
|
||||||
AvPlayerState(const SceAvPlayerInitData& init_data);
|
AvPlayerState(const SceAvPlayerInitData& init_data);
|
||||||
~AvPlayerState();
|
~AvPlayerState();
|
||||||
|
|
||||||
s32 AddSource(std::string_view filename, SceAvPlayerSourceType source_type);
|
bool AddSource(std::string_view filename, SceAvPlayerSourceType source_type);
|
||||||
s32 GetStreamCount();
|
s32 GetStreamCount();
|
||||||
s32 GetStreamInfo(u32 stream_index, SceAvPlayerStreamInfo& info);
|
bool GetStreamInfo(u32 stream_index, SceAvPlayerStreamInfo& info);
|
||||||
bool EnableStream(u32 stream_index);
|
bool EnableStream(u32 stream_index);
|
||||||
s32 Start();
|
bool Start();
|
||||||
bool Stop();
|
bool Stop();
|
||||||
bool GetAudioData(SceAvPlayerFrameInfo& audio_info);
|
bool GetAudioData(SceAvPlayerFrameInfo& audio_info);
|
||||||
bool GetVideoData(SceAvPlayerFrameInfo& video_info);
|
bool GetVideoData(SceAvPlayerFrameInfo& video_info);
|
||||||
|
|
|
@ -233,9 +233,6 @@ constexpr int SCE_KERNEL_ERROR_ESDKVERSION = 0x80020063;
|
||||||
constexpr int SCE_KERNEL_ERROR_ESTART = 0x80020064;
|
constexpr int SCE_KERNEL_ERROR_ESTART = 0x80020064;
|
||||||
constexpr int SCE_KERNEL_ERROR_ESTOP = 0x80020065;
|
constexpr int SCE_KERNEL_ERROR_ESTOP = 0x80020065;
|
||||||
|
|
||||||
// libSceRandom error codes
|
|
||||||
constexpr int SCE_RANDOM_ERROR_INVALID = 0x817C0016;
|
|
||||||
|
|
||||||
// videoOut
|
// videoOut
|
||||||
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_VALUE = 0x80290001; // invalid argument
|
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_VALUE = 0x80290001; // invalid argument
|
||||||
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_ADDRESS = 0x80290002; // invalid addresses
|
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_ADDRESS = 0x80290002; // invalid addresses
|
||||||
|
@ -249,14 +246,6 @@ constexpr int SCE_VIDEO_OUT_ERROR_SLOT_OCCUPIED = 0x80290010; // slot alr
|
||||||
constexpr int SCE_VIDEO_OUT_ERROR_FLIP_QUEUE_FULL = 0x80290012; // flip queue is full
|
constexpr int SCE_VIDEO_OUT_ERROR_FLIP_QUEUE_FULL = 0x80290012; // flip queue is full
|
||||||
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_OPTION = 0x8029001A; // Invalid buffer attribute option
|
constexpr int SCE_VIDEO_OUT_ERROR_INVALID_OPTION = 0x8029001A; // Invalid buffer attribute option
|
||||||
|
|
||||||
// GnmDriver
|
|
||||||
constexpr int ORBIS_GNM_ERROR_COMPUTEQUEUE_INVALID_PIPE_ID = 0x80D17000;
|
|
||||||
constexpr int ORBIS_GNM_ERROR_COMPUTEQUEUE_INVALID_QUEUE_ID = 0x80D17001;
|
|
||||||
constexpr int ORBIS_GNM_ERROR_COMPUTEQUEUE_INVALID_RING_BASE_ADDR = 0x80D17003;
|
|
||||||
constexpr int ORBIS_GNM_ERROR_COMPUTEQUEUE_INVALID_RING_SIZE = 0x80D17002;
|
|
||||||
constexpr int ORBIS_GNM_ERROR_COMPUTEQUEUE_INVALID_READ_PTR_ADDR = 0x80D17004;
|
|
||||||
constexpr int ORBIS_GNM_ERROR_FAILURE = 0x8EEE00FF;
|
|
||||||
|
|
||||||
// Generic
|
// Generic
|
||||||
constexpr int ORBIS_OK = 0x00000000;
|
constexpr int ORBIS_OK = 0x00000000;
|
||||||
constexpr int ORBIS_FAIL = 0xFFFFFFFF;
|
constexpr int ORBIS_FAIL = 0xFFFFFFFF;
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
constexpr int ORBIS_GNM_ERROR_SUBMISSION_FAILED_INVALID_ARGUMENT = 0x80D11000;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_SUBMISSION_NOT_ENOUGH_RESOURCES = 0x80D11001;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_SUBMISSION_AND_FLIP_FAILED_INVALID_COMMAND_BUFFER = 0x80D11080;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_SUBMISSION_AND_FLIP_FAILED_INVALID_QUEUE_FULL = 0x80D11081;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_SUBMISSION_AND_FLIP_FAILED_REQUEST_FAILED = 0x80D11082;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_SUBMISSION_FAILED_INTERNAL_ERROR = 0x80D110FF;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_WARNING = 0x80D12000;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_WARNING_RWBUFFER_ROTYPE = 0x80D12001;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_WARNING_BLENDING = 0x80D12002;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_WARNING_DRAW_CU_MASK = 0x80D12003;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_WARNING_MRT_SETUP = 0x80D12004;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_WARNING_DEPTH_RT_SETUP = 0x80D12005;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_WARNING_PS_AND_MRT_FORMAT = 0x80D1200F;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_ERROR = 0x80D13000;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_VSHARP = 0x80D13001;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_TSHARP = 0x80D13002;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_RESOURCE = 0x80D13003;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_TABLE_MEMORY = 0x80D13004;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_WRITE_EVENT_OP = 0x80D13005;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_INDEX_BUFFER = 0x80D13006;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_TESS_FACTOR_BUFFER = 0x80D13007;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_SCRATCH_RING = 0x80D13008;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_PRIMITIVE_TYPE = 0x80D13009;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_INDEX_SIZE = 0x80D1300A;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_INLINE_DRAW_SIZE = 0x80D1300B;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_NUM_INPUT_PATCHES = 0x80D1300C;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_GS_MODE = 0x80D1300D;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_SHADER_ADDRESS = 0x80D1300E;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_BORDER_COLOR_TABLE = 0x80D1300F;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_SSHARP = 0x80D13010;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_DISPATCH_DRAW = 0x80D13011;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_ACTIVE_SHADER_STAGE = 0x80D13012;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_DCB = 0x80D13013;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_MISMATCH_SHADER_STAGE = 0x80D13014;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_MRT_SETUP = 0x80D13015;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_BAD_OP_CODE = 0x80D13016;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_DEPTH_RT_SETUP = 0x80D13017;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_NUM_INSTANCES = 0x80D13018;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_SRT = 0x80D13019;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_INVALID_ARGUMENT = 0x80D13FFD;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_FAILED_INTERNAL_ERROR = 0x80D13FFE;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_VALIDATION_NOT_ENABLED = 0x80D13FFF;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_CAPTURE_FILE_IO = 0x80D15000;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_CAPTURE_RAZOR_NOT_LOADED = 0x80D15001;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_CAPTURE_NOTHING_TO_CAPTURE = 0x80D15002;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_CAPTURE_FAILED_INTERNAL = 0x80D1500F;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_COMPUTEQUEUE_INVALID_PIPE_ID = 0x80D17000;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_COMPUTEQUEUE_INVALID_QUEUE_ID = 0x80D17001;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_COMPUTEQUEUE_INVALID_RING_SIZE = 0x80D17002;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_COMPUTEQUEUE_INVALID_RING_BASE_ADDR = 0x80D17003;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_COMPUTEQUEUE_INVALID_READ_PTR_ADDR = 0x80D17004;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_COMPUTEQUEUE_INVALID_PIPE_PRIORITY = 0x80D17005;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_COMPUTEQUEUE_INTERNAL = 0x80D170FF;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_INVALID_ARGUMENT = 0x80D19000;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_INVALID_SHADER = 0x80D19001;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_STALE_HANDLE = 0x80D19002;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_FULL = 0x80D19003;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_NOT_PERMITTED = 0x80D19004;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_OUTPUT_ARGUMENT_IS_NULL = 0x80D19005;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_OWNER_HANDLE_INVALID = 0x80D19006;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_RESOURCE_HANDLE_INVALID = 0x80D19007;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_RESOURCE_TYPE_INVALID = 0x80D19008;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_GDS_RESOURCE_TYPE_INVALID = 0x80D19009;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_RESOURCE_SIZE_INVALID = 0x80D1900A;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_RESOURCE_ADDRESS_IS_NULL = 0x80D1900B;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_GDS_OFFSET_INVALID = 0x80D1900C;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_RESOURCE_NAME_IS_NULL = 0x80D1900D;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_OWNER_NAME_IS_NULL = 0x80D1900E;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_FIND_CALLBACK_IS_NULL = 0x80D1900F;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_RESOURCE_IS_NOT_SHADER = 0x80D19010;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_USER_MEMORY_PARAM_IS_NULL = 0x80D19011;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_USER_MEMORY_PARAM_NOT_ALIGNED = 0x80D19012;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_INVALID_NAME_LENGTH_PARAM = 0x80D19013;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_INVALID_SIZE_PARAM = 0x80D19014;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_INVALID_NUM_RESOURCES_PARAM = 0x80D19015;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_RESOURCE_REGISTRATION_INTERNAL = 0x80D19FFF;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_GET_GPU_INFO_PARAMETER_NULL = 0x80D1B000;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_GET_GPU_INFO_FAILED = 0x80D1B001;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_GET_GPU_INFO_PARAMETER_INVALID = 0x80D1B002;
|
||||||
|
constexpr int ORBIS_GNM_ERROR_FAILURE = 0x8EEE00FF;
|
|
@ -1,6 +1,9 @@
|
||||||
// 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 "gnm_error.h"
|
||||||
|
#include "gnmdriver.h"
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/config.h"
|
#include "common/config.h"
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
|
@ -9,7 +12,6 @@
|
||||||
#include "common/slot_vector.h"
|
#include "common/slot_vector.h"
|
||||||
#include "core/address_space.h"
|
#include "core/address_space.h"
|
||||||
#include "core/libraries/error_codes.h"
|
#include "core/libraries/error_codes.h"
|
||||||
#include "core/libraries/gnmdriver/gnmdriver.h"
|
|
||||||
#include "core/libraries/kernel/libkernel.h"
|
#include "core/libraries/kernel/libkernel.h"
|
||||||
#include "core/libraries/libs.h"
|
#include "core/libraries/libs.h"
|
||||||
#include "core/libraries/videoout/video_out.h"
|
#include "core/libraries/videoout/video_out.h"
|
||||||
|
|
|
@ -15,7 +15,8 @@ namespace Libraries::Kernel {
|
||||||
|
|
||||||
u64 PS4_SYSV_ABI sceKernelGetDirectMemorySize() {
|
u64 PS4_SYSV_ABI sceKernelGetDirectMemorySize() {
|
||||||
LOG_WARNING(Kernel_Vmm, "called");
|
LOG_WARNING(Kernel_Vmm, "called");
|
||||||
return SCE_KERNEL_MAIN_DMEM_SIZE;
|
const auto* memory = Core::Memory::Instance();
|
||||||
|
return memory->GetTotalDirectSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceKernelAllocateDirectMemory(s64 searchStart, s64 searchEnd, u64 len,
|
int PS4_SYSV_ABI sceKernelAllocateDirectMemory(s64 searchStart, s64 searchEnd, u64 len,
|
||||||
|
@ -52,8 +53,8 @@ int PS4_SYSV_ABI sceKernelAllocateDirectMemory(s64 searchStart, s64 searchEnd, u
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceKernelAllocateMainDirectMemory(size_t len, size_t alignment, int memoryType,
|
s32 PS4_SYSV_ABI sceKernelAllocateMainDirectMemory(size_t len, size_t alignment, int memoryType,
|
||||||
s64* physAddrOut) {
|
s64* physAddrOut) {
|
||||||
return sceKernelAllocateDirectMemory(0, SCE_KERNEL_MAIN_DMEM_SIZE, len, alignment, memoryType,
|
const auto searchEnd = static_cast<s64>(sceKernelGetDirectMemorySize());
|
||||||
physAddrOut);
|
return sceKernelAllocateDirectMemory(0, searchEnd, len, alignment, memoryType, physAddrOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceKernelCheckedReleaseDirectMemory(u64 start, size_t len) {
|
s32 PS4_SYSV_ABI sceKernelCheckedReleaseDirectMemory(u64 start, size_t len) {
|
||||||
|
@ -78,7 +79,7 @@ s32 PS4_SYSV_ABI sceKernelAvailableDirectMemorySize(u64 searchStart, u64 searchE
|
||||||
if (physAddrOut == nullptr || sizeOut == nullptr) {
|
if (physAddrOut == nullptr || sizeOut == nullptr) {
|
||||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||||
}
|
}
|
||||||
if (searchEnd > SCE_KERNEL_MAIN_DMEM_SIZE) {
|
if (searchEnd > sceKernelGetDirectMemorySize()) {
|
||||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||||
}
|
}
|
||||||
if (searchEnd <= searchStart) {
|
if (searchEnd <= searchStart) {
|
||||||
|
@ -254,46 +255,56 @@ int PS4_SYSV_ABI sceKernelMunmap(void* addr, size_t len);
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceKernelBatchMap2(OrbisKernelBatchMapEntry* entries, int numEntries,
|
s32 PS4_SYSV_ABI sceKernelBatchMap2(OrbisKernelBatchMapEntry* entries, int numEntries,
|
||||||
int* numEntriesOut, int flags) {
|
int* numEntriesOut, int flags) {
|
||||||
|
int result = ORBIS_OK;
|
||||||
int processed = 0;
|
int processed = 0;
|
||||||
int result = 0;
|
for (int i = 0; i < numEntries; i++, processed++) {
|
||||||
for (int i = 0; i < numEntries; i++) {
|
|
||||||
if (entries == nullptr || entries[i].length == 0 || entries[i].operation > 4) {
|
if (entries == nullptr || entries[i].length == 0 || entries[i].operation > 4) {
|
||||||
result = ORBIS_KERNEL_ERROR_EINVAL;
|
result = ORBIS_KERNEL_ERROR_EINVAL;
|
||||||
break; // break and assign a value to numEntriesOut.
|
break; // break and assign a value to numEntriesOut.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entries[i].operation == MemoryOpTypes::ORBIS_KERNEL_MAP_OP_MAP_DIRECT) {
|
switch (entries[i].operation) {
|
||||||
|
case MemoryOpTypes::ORBIS_KERNEL_MAP_OP_MAP_DIRECT: {
|
||||||
result = sceKernelMapNamedDirectMemory(&entries[i].start, entries[i].length,
|
result = sceKernelMapNamedDirectMemory(&entries[i].start, entries[i].length,
|
||||||
entries[i].protection, flags,
|
entries[i].protection, flags,
|
||||||
static_cast<s64>(entries[i].offset), 0, "");
|
static_cast<s64>(entries[i].offset), 0, "");
|
||||||
LOG_INFO(
|
LOG_INFO(Kernel_Vmm,
|
||||||
Kernel_Vmm,
|
"entry = {}, operation = {}, len = {:#x}, offset = {:#x}, type = {}, "
|
||||||
"BatchMap: entry = {}, operation = {}, len = {:#x}, offset = {:#x}, type = {}, "
|
"result = {}",
|
||||||
"result = {}",
|
i, entries[i].operation, entries[i].length, entries[i].offset,
|
||||||
i, entries[i].operation, entries[i].length, entries[i].offset, (u8)entries[i].type,
|
(u8)entries[i].type, result);
|
||||||
result);
|
break;
|
||||||
|
}
|
||||||
if (result == 0)
|
case MemoryOpTypes::ORBIS_KERNEL_MAP_OP_UNMAP: {
|
||||||
processed++;
|
|
||||||
} else if (entries[i].operation == MemoryOpTypes::ORBIS_KERNEL_MAP_OP_UNMAP) {
|
|
||||||
result = sceKernelMunmap(entries[i].start, entries[i].length);
|
result = sceKernelMunmap(entries[i].start, entries[i].length);
|
||||||
LOG_INFO(Kernel_Vmm, "BatchMap: entry = {}, operation = {}, len = {:#x}, result = {}",
|
LOG_INFO(Kernel_Vmm, "entry = {}, operation = {}, len = {:#x}, result = {}", i,
|
||||||
i, entries[i].operation, entries[i].length, result);
|
entries[i].operation, entries[i].length, result);
|
||||||
|
break;
|
||||||
if (result == 0)
|
}
|
||||||
processed++;
|
case MemoryOpTypes::ORBIS_KERNEL_MAP_OP_MAP_FLEXIBLE: {
|
||||||
} else if (entries[i].operation == MemoryOpTypes::ORBIS_KERNEL_MAP_OP_MAP_FLEXIBLE) {
|
|
||||||
result = sceKernelMapNamedFlexibleMemory(&entries[i].start, entries[i].length,
|
result = sceKernelMapNamedFlexibleMemory(&entries[i].start, entries[i].length,
|
||||||
entries[i].protection, flags, "");
|
entries[i].protection, flags, "");
|
||||||
LOG_INFO(Kernel_Vmm,
|
LOG_INFO(Kernel_Vmm,
|
||||||
"BatchMap: entry = {}, operation = {}, len = {:#x}, type = {}, "
|
"entry = {}, operation = {}, len = {:#x}, type = {}, "
|
||||||
"result = {}",
|
"result = {}",
|
||||||
i, entries[i].operation, entries[i].length, (u8)entries[i].type, result);
|
i, entries[i].operation, entries[i].length, (u8)entries[i].type, result);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MemoryOpTypes::ORBIS_KERNEL_MAP_OP_TYPE_PROTECT: {
|
||||||
|
// By now, ignore protection and log it instead
|
||||||
|
LOG_WARNING(Kernel_Vmm,
|
||||||
|
"entry = {}, operation = {}, len = {:#x}, type = {} "
|
||||||
|
"is UNSUPPORTED and skipped",
|
||||||
|
i, entries[i].operation, entries[i].length, (u8)entries[i].type);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
UNREACHABLE();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (result == 0)
|
if (result != ORBIS_OK) {
|
||||||
processed++;
|
break;
|
||||||
} else {
|
|
||||||
UNREACHABLE_MSG("called: Unimplemented Operation = {}", entries[i].operation);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (numEntriesOut != NULL) { // can be zero. do not return an error code.
|
if (numEntriesOut != NULL) { // can be zero. do not return an error code.
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "common/bit_field.h"
|
#include "common/bit_field.h"
|
||||||
#include "common/types.h"
|
#include "common/types.h"
|
||||||
|
|
||||||
constexpr u64 SCE_KERNEL_MAIN_DMEM_SIZE = 4608_MB; // ~ 4.5GB
|
constexpr u64 SCE_KERNEL_MAIN_DMEM_SIZE = 5056_MB; // ~ 5GB
|
||||||
|
|
||||||
namespace Libraries::Kernel {
|
namespace Libraries::Kernel {
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
#include <semaphore>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <semaphore.h>
|
|
||||||
#include "common/alignment.h"
|
#include "common/alignment.h"
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/error.h"
|
#include "common/error.h"
|
||||||
|
@ -510,23 +510,24 @@ int PS4_SYSV_ABI scePthreadMutexattrInit(ScePthreadMutexattr* attr) {
|
||||||
int PS4_SYSV_ABI scePthreadMutexattrSettype(ScePthreadMutexattr* attr, int type) {
|
int PS4_SYSV_ABI scePthreadMutexattrSettype(ScePthreadMutexattr* attr, int type) {
|
||||||
int ptype = PTHREAD_MUTEX_DEFAULT;
|
int ptype = PTHREAD_MUTEX_DEFAULT;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 1:
|
case ORBIS_PTHREAD_MUTEX_ERRORCHECK:
|
||||||
ptype = PTHREAD_MUTEX_ERRORCHECK;
|
ptype = PTHREAD_MUTEX_ERRORCHECK;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case ORBIS_PTHREAD_MUTEX_RECURSIVE:
|
||||||
ptype = PTHREAD_MUTEX_RECURSIVE;
|
ptype = PTHREAD_MUTEX_RECURSIVE;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case ORBIS_PTHREAD_MUTEX_NORMAL:
|
||||||
case 4:
|
case ORBIS_PTHREAD_MUTEX_ADAPTIVE:
|
||||||
ptype = PTHREAD_MUTEX_NORMAL;
|
ptype = PTHREAD_MUTEX_NORMAL;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE_MSG("Invalid type: {}", type);
|
return SCE_KERNEL_ERROR_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int result = pthread_mutexattr_settype(&(*attr)->pth_mutex_attr, ptype);
|
int result = pthread_mutexattr_settype(&(*attr)->pth_mutex_attr, ptype);
|
||||||
|
ASSERT(result == 0);
|
||||||
|
|
||||||
return result == 0 ? SCE_OK : SCE_KERNEL_ERROR_EINVAL;
|
return SCE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI scePthreadMutexattrSetprotocol(ScePthreadMutexattr* attr, int protocol) {
|
int PS4_SYSV_ABI scePthreadMutexattrSetprotocol(ScePthreadMutexattr* attr, int protocol) {
|
||||||
|
@ -1373,90 +1374,97 @@ int PS4_SYSV_ABI posix_pthread_detach(ScePthread thread) {
|
||||||
return pthread_detach(thread->pth);
|
return pthread_detach(thread->pth);
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI posix_sem_init(sem_t* sem, int pshared, unsigned int value) {
|
int PS4_SYSV_ABI posix_sem_init(PthreadSemInternal** sem, int pshared, unsigned int value) {
|
||||||
int result = sem_init(sem, pshared, value);
|
if (value > ORBIS_KERNEL_SEM_VALUE_MAX) {
|
||||||
if (result == -1) {
|
SetPosixErrno(EINVAL);
|
||||||
SetPosixErrno(errno);
|
return -1;
|
||||||
}
|
}
|
||||||
return result;
|
if (sem != nullptr) {
|
||||||
|
*sem = new PthreadSemInternal{
|
||||||
|
.semaphore = std::counting_semaphore<ORBIS_KERNEL_SEM_VALUE_MAX>{value},
|
||||||
|
.value = {static_cast<int>(value)},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI posix_sem_wait(sem_t* sem) {
|
int PS4_SYSV_ABI posix_sem_wait(PthreadSemInternal** sem) {
|
||||||
int result = sem_wait(sem);
|
if (sem == nullptr || *sem == nullptr) {
|
||||||
if (result == -1) {
|
SetPosixErrno(EINVAL);
|
||||||
SetPosixErrno(errno);
|
return -1;
|
||||||
}
|
}
|
||||||
return result;
|
(*sem)->semaphore.acquire();
|
||||||
|
--(*sem)->value;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI posix_sem_trywait(sem_t* sem) {
|
int PS4_SYSV_ABI posix_sem_trywait(PthreadSemInternal** sem) {
|
||||||
int result = sem_trywait(sem);
|
if (sem == nullptr || *sem == nullptr) {
|
||||||
if (result == -1) {
|
SetPosixErrno(EINVAL);
|
||||||
SetPosixErrno(errno);
|
return -1;
|
||||||
}
|
}
|
||||||
return result;
|
if (!(*sem)->semaphore.try_acquire()) {
|
||||||
|
SetPosixErrno(EAGAIN);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
--(*sem)->value;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HAVE_SEM_TIMEDWAIT
|
int PS4_SYSV_ABI posix_sem_timedwait(PthreadSemInternal** sem, const timespec* t) {
|
||||||
int sem_timedwait(sem_t* sem, const struct timespec* abstime) {
|
if (sem == nullptr || *sem == nullptr) {
|
||||||
int rc;
|
SetPosixErrno(EINVAL);
|
||||||
while ((rc = sem_trywait(sem)) == EAGAIN) {
|
return -1;
|
||||||
struct timespec curr_time;
|
|
||||||
clock_gettime(CLOCK_REALTIME, &curr_time);
|
|
||||||
|
|
||||||
s64 remaining_ns = 0;
|
|
||||||
remaining_ns +=
|
|
||||||
(static_cast<s64>(abstime->tv_sec) - static_cast<s64>(curr_time.tv_sec)) * 1000000000L;
|
|
||||||
remaining_ns += static_cast<s64>(abstime->tv_nsec) - static_cast<s64>(curr_time.tv_nsec);
|
|
||||||
|
|
||||||
if (remaining_ns <= 0) {
|
|
||||||
return ETIMEDOUT;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct timespec sleep_time;
|
|
||||||
sleep_time.tv_sec = 0;
|
|
||||||
if (remaining_ns < 5000000L) {
|
|
||||||
sleep_time.tv_nsec = remaining_ns;
|
|
||||||
} else {
|
|
||||||
sleep_time.tv_nsec = 5000000;
|
|
||||||
}
|
|
||||||
|
|
||||||
nanosleep(&sleep_time, nullptr);
|
|
||||||
}
|
}
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int PS4_SYSV_ABI posix_sem_timedwait(sem_t* sem, const timespec* t) {
|
using std::chrono::duration_cast;
|
||||||
int result = sem_timedwait(sem, t);
|
using std::chrono::nanoseconds;
|
||||||
if (result == -1) {
|
using std::chrono::seconds;
|
||||||
SetPosixErrno(errno);
|
using std::chrono::system_clock;
|
||||||
|
|
||||||
|
const system_clock::time_point time{
|
||||||
|
duration_cast<system_clock::duration>(seconds{t->tv_sec} + nanoseconds{t->tv_nsec})};
|
||||||
|
if (!(*sem)->semaphore.try_acquire_until(time)) {
|
||||||
|
SetPosixErrno(ETIMEDOUT);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
return result;
|
--(*sem)->value;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI posix_sem_post(sem_t* sem) {
|
int PS4_SYSV_ABI posix_sem_post(PthreadSemInternal** sem) {
|
||||||
int result = sem_post(sem);
|
if (sem == nullptr || *sem == nullptr) {
|
||||||
if (result == -1) {
|
SetPosixErrno(EINVAL);
|
||||||
SetPosixErrno(errno);
|
return -1;
|
||||||
}
|
}
|
||||||
return result;
|
if ((*sem)->value == ORBIS_KERNEL_SEM_VALUE_MAX) {
|
||||||
|
SetPosixErrno(EOVERFLOW);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
++(*sem)->value;
|
||||||
|
(*sem)->semaphore.release();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI posix_sem_destroy(sem_t* sem) {
|
int PS4_SYSV_ABI posix_sem_destroy(PthreadSemInternal** sem) {
|
||||||
int result = sem_destroy(sem);
|
if (sem == nullptr || *sem == nullptr) {
|
||||||
if (result == -1) {
|
SetPosixErrno(EINVAL);
|
||||||
SetPosixErrno(errno);
|
return -1;
|
||||||
}
|
}
|
||||||
return result;
|
delete *sem;
|
||||||
|
*sem = nullptr;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI posix_sem_getvalue(sem_t* sem, int* sval) {
|
int PS4_SYSV_ABI posix_sem_getvalue(PthreadSemInternal** sem, int* sval) {
|
||||||
int result = sem_getvalue(sem, sval);
|
if (sem == nullptr || *sem == nullptr) {
|
||||||
if (result == -1) {
|
SetPosixErrno(EINVAL);
|
||||||
SetPosixErrno(errno);
|
return -1;
|
||||||
}
|
}
|
||||||
return result;
|
if (sval) {
|
||||||
|
*sval = (*sem)->value;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI posix_pthread_attr_getstacksize(const pthread_attr_t* attr, size_t* size) {
|
int PS4_SYSV_ABI posix_pthread_attr_getstacksize(const pthread_attr_t* attr, size_t* size) {
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
#include <semaphore>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
@ -19,6 +20,12 @@ namespace Libraries::Kernel {
|
||||||
constexpr int ORBIS_KERNEL_PRIO_FIFO_DEFAULT = 700;
|
constexpr int ORBIS_KERNEL_PRIO_FIFO_DEFAULT = 700;
|
||||||
constexpr int ORBIS_KERNEL_PRIO_FIFO_HIGHEST = 256;
|
constexpr int ORBIS_KERNEL_PRIO_FIFO_HIGHEST = 256;
|
||||||
constexpr int ORBIS_KERNEL_PRIO_FIFO_LOWEST = 767;
|
constexpr int ORBIS_KERNEL_PRIO_FIFO_LOWEST = 767;
|
||||||
|
constexpr int ORBIS_KERNEL_SEM_VALUE_MAX = 0x7FFFFFFF;
|
||||||
|
|
||||||
|
constexpr int ORBIS_PTHREAD_MUTEX_ERRORCHECK = 1;
|
||||||
|
constexpr int ORBIS_PTHREAD_MUTEX_RECURSIVE = 2;
|
||||||
|
constexpr int ORBIS_PTHREAD_MUTEX_NORMAL = 3;
|
||||||
|
constexpr int ORBIS_PTHREAD_MUTEX_ADAPTIVE = 4;
|
||||||
|
|
||||||
struct PthreadInternal;
|
struct PthreadInternal;
|
||||||
struct PthreadAttrInternal;
|
struct PthreadAttrInternal;
|
||||||
|
@ -104,6 +111,11 @@ struct PthreadRwInternal {
|
||||||
std::string name;
|
std::string name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct PthreadSemInternal {
|
||||||
|
std::counting_semaphore<ORBIS_KERNEL_SEM_VALUE_MAX> semaphore;
|
||||||
|
std::atomic<s32> value;
|
||||||
|
};
|
||||||
|
|
||||||
class PThreadPool {
|
class PThreadPool {
|
||||||
public:
|
public:
|
||||||
ScePthread Create();
|
ScePthread Create();
|
||||||
|
|
|
@ -3,54 +3,116 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_PARAMETERS = 0x804A0001;
|
constexpr int ORBIS_NGS2_ERROR_FAIL = 0x804A0001;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_MAXIMUM_GRAIN_SAMPLES = 0x804A0050;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_GRAIN_SAMPLES = 0x804A0050;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_GRAIN_SAMPLES = 0x804A0051;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_NUM_GRAIN_SAMPLES = 0x804A0051;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_CHANNELS = 0x804A0052;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_NUM_CHANNELS = 0x804A0052;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALD_ADDRESS = 0x804A0053;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_OUT_ADDRESS = 0x804A0053;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALD_SIZE = 0x804A0054;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_OUT_SIZE = 0x804A0054;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_OPTION_ADDRESS = 0x804A0080;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_OPTION_SIZE = 0x804A0081;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_OPTION_SIZE = 0x804A0081;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_RACK_OPTION_MAX_MATRICES = 0x804A0100;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_OPTION_FLAG = 0x804A0082;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_RACK_OPTION_MAX_PORTS = 0x804A0101;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_MATRICES = 0x804A0100;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_RACK_OPTION_MAX_INPUT_DELAY_BLOCKS = 0x804A0102;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_PORTS = 0x804A0101;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_MATRIX_LEVELS = 0x804A0150;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_INPUT_DELAY_BLOCKS = 0x804A0102;
|
||||||
constexpr int ORBIS_NGS2_ERROR_SAMPLER_WAVEFORM_TERMINATED = 0x804A0151;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_VOICES = 0x804A0103;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_ENVELOPE_POINTS = 0x804A0152;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_CHANNELS = 0x804A0104;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_CHANNEL_WORKS = 0x804A0105;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_WAVEFORM_BLOCKS = 0x804A0106;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_ENVELOPE_POINTS = 0x804A0107;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_FILTERS = 0x804A0108;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_CODEC_CACHES = 0x804A0109;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_ATRAC9_DECODERS = 0x804A010A;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_ATRAC9_CHANNEL_WORKS = 0x804A010B;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_INPUTS = 0x804A010C;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_NUM_MATRIX_LEVELS = 0x804A0150;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_NUM_WAVEFORM_BLOCKS = 0x804A0151;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_NUM_ENVELOPE_POINTS = 0x804A0152;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_MATRIX_LEVEL_ADDRESS = 0x804A0153;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_MATRIX_LEVEL_ADDRESS = 0x804A0153;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_SAMPLER_WAVEFORM_BLOCK_ADDRESS = 0x804A0154;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_WAVEFORM_BLOCK_ADDRESS = 0x804A0154;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_ENVELOPE_POINT_ADDRESS = 0x804A0155;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_ENVELOPE_POINT_ADDRESS = 0x804A0155;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_NUM_PEAKMETER_BLOCKS = 0x804A0156;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_HANDLE = 0x804A0200;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_HANDLE = 0x804A0200;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_SAMPLE_RATE = 0x804A0201;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_SAMPLE_RATE = 0x804A0201;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_REPORT_TYPE = 0x804A0202;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_REPORT_HANDLER = 0x804A0203;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_REPORT_HANDLE = 0x804A0204;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_REPORT_HANDLE = 0x804A0204;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_EMPTY_REPORT_HANDLE = 0x804A0205;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_BUFFER_INFO = 0x804A0206;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_BUFFER_INFO = 0x804A0206;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_BUFFER_ADDRESS = 0x804A0207;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_BUFFER_ADDRESS = 0x804A0207;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_BUFFER_ALIGNMENT = 0x804A0208;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_BUFFER_ALIGN = 0x804A0208;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_BUFFER_SIZE = 0x804A0209;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_BUFFER_SIZE = 0x804A0209;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_BUFFER_ALLOCATOR = 0x804A020A;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_BUFFER_ALLOCATOR = 0x804A020A;
|
||||||
constexpr int ORBIS_NGS2_ERROR_BUFFER_VERIFY_FAILED = 0x804A020B;
|
constexpr int ORBIS_NGS2_ERROR_BUFFER_BROKEN = 0x804A020B;
|
||||||
constexpr int ORBIS_NGS2_ERROR_MODULE_PLAYER_DATA_EMPTY = 0x804A020C;
|
constexpr int ORBIS_NGS2_ERROR_EMPTY_BUFFER = 0x804A020C;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_SYSTEM_HANDLE = 0x804A0230;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_SYSTEM_HANDLE = 0x804A0230;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_RACK_ID = 0x804A0260;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_RACK_ID = 0x804A0260;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_RACK_HANDLE = 0x804A0261;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_RACK_HANDLE = 0x804A0261;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_VOICE_HANDLE = 0x804A0300;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_VOICE_HANDLE = 0x804A0300;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_UNINIT_VOICE = 0x804A0301;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_VOICE_INDEX = 0x804A0302;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_VOICE_INDEX = 0x804A0302;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_VOICE_EVENT = 0x804A0303;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_EVENT_TYPE = 0x804A0303;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_VOICE_PORT_INDEX = 0x804A0304;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_PORT_INDEX = 0x804A0304;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_VOICE_INPUT_OR_RACK_OCCUPIED = 0x804A0305;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_PATCH = 0x804A0305;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_CONTROL_ID = 0x804A0308;
|
constexpr int ORBIS_NGS2_ERROR_EMPTY_CHANNEL_WORK = 0x804A0306;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_VOICE_CONTROL_PARAMETER = 0x804A0309;
|
constexpr int ORBIS_NGS2_ERROR_EMPTY_CODEC_DECODER = 0x804A0307;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_PARAMETER_SIZE = 0x804A030A;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_VOICE_CONTROL_ID = 0x804A0308;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_VOICE_CONTROL_ADDRESS = 0x804A0309;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_VOICE_CONTROL_SIZE = 0x804A030A;
|
||||||
constexpr int ORBIS_NGS2_ERROR_DETECTED_CIRCULAR_VOICE_CONTROL = 0x804A030B;
|
constexpr int ORBIS_NGS2_ERROR_DETECTED_CIRCULAR_VOICE_CONTROL = 0x804A030B;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_SAMPLER_WAVEFORM_DATA = 0x804A0400;
|
constexpr int ORBIS_NGS2_ERROR_UNABLE_CALLBACK = 0x804A030C;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_SAMPLER_WAVEFORM_FORMAT = 0x804A0401;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_CALLBACK_FLAG = 0x804A030D;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_SAMPLER_WAVEFORM_TYPE_NO_ATRAC9_DECODERS = 0x804A0402;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_CALLBACK_HANDLER = 0x804A030E;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_SAMPLER_ATRAC9_CONFIG_DATA = 0x804A0403;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_OPERATION = 0x804A030F;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_SAMPLER_WAVEFORM_SAMPLE_RATE = 0x804A0404;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_WAVEFORM_FORMAT = 0x804A0400;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_SAMPLER_WAVEFORM_FRAME = 0x804A0405;
|
constexpr int ORBIS_NGS2_ERROR_UNKNOWN_WAVEFORM_FORMAT = 0x804A0401;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_SAMPLER_WAVEFORM_ADDRESS = 0x804A0406;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_WAVEFORM_TYPE = 0x804A0402;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_WAVEFORM_CONFIG = 0x804A0403;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_WAVEFORM_SAMPLE_RATE = 0x804A0404;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_WAVEFORM_FRAME = 0x804A0405;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_WAVEFORM_ADDRESS = 0x804A0406;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_WAVEFORM_SIZE = 0x804A0407;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_WAVEFORM_DATA = 0x804A0408;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_WAVEFORM_BLOCK_NUM_REPEATS = 0x804A0409;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_ENVELOPE_CURVE = 0x804A0500;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_ENVELOPE_CURVE = 0x804A0500;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_PEAKMETER_FLAG = 0x804A0510;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_CHORUS_PHASES = 0x804A0520;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_NUM_CHORUS_PHASES = 0x804A0521;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_DELAY_LENGTH = 0x804A0530;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_MAX_DELAY_TAPS = 0x804A0531;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_DELAY_TYPE = 0x804A0532;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_NUM_DELAY_TAPS = 0x804A0533;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_DELAY_TAP_INFO = 0x804A0534;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_PITCH_SHIFT_QUALITY = 0x804A0540;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_FILTER_INDEX = 0x804A0600;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_FILTER_INDEX = 0x804A0600;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_FILTER_TYPE = 0x804A0601;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_FILTER_TYPE = 0x804A0601;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_FILTER_LOCATION = 0x804A0602;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_FILTER_LOCATION = 0x804A0602;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_LFE_CUT_OFF_FREQUENCY = 0x804A0603;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_LFE_FC = 0x804A0603;
|
||||||
constexpr int ORBIS_NGS2_ERROR_INVALID_MATRIX_INDEX_OR_TYPE = 0x804A0700;
|
constexpr int ORBIS_NGS2_ERROR_INVALID_USER_FX_PARAM_SIZE = 0x804A0650;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_MATRIX_INDEX = 0x804A0700;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_CODEC_UNKNOWN_WAVEFORM = 0x804A0800;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_CODEC_EMPTY_INSTANCE = 0x804A0801;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_CODEC_EMPTY_CHANNEL = 0x804A0802;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_CODEC_SETUP_FAIL = 0x804A0803;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_CODEC_RESET_FAIL = 0x804A0804;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_CODEC_DECODE_FAIL = 0x804A0805;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_REVERB_SIZE = 0x804A0900;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_PAN_UNIT_ANGLE = 0x804A0910;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_PAN_SPEAKER = 0x804A0911;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_PAN_MATRIX_FORMAT = 0x804A0912;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_PAN_WORK = 0x804A0913;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_PAN_PARAM = 0x804A0914;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_GEOM_DISTANCE = 0x804A0920;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_GEOM_LISTENER_ADDRESS = 0x804A0921;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_GEOM_SOURCE_ADDRESS = 0x804A0922;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_GEOM_FLAG = 0x804A0923;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_GEOM_CONE = 0x804A0924;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_MODULE_ID = 0x804A0A00;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_NUM_MODULES = 0x804A0A01;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_NUM_MODULE_BUFFERS = 0x804A0A02;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_MODULE_BUFFER_ID = 0x804A0A03;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_MODULE_STATE_OFFSET = 0x804A0A04;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_MODULE_STATE_SIZE = 0x804A0A05;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_VOICE_STATE_SIZE = 0x804A0A06;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_MODULE_INDEX = 0x804A0B00;
|
||||||
|
constexpr int ORBIS_NGS2_ERROR_INVALID_MODULE_INFO_SIZE = 0x804A0B01;
|
|
@ -138,13 +138,13 @@ s32 Ngs2::SystemSetupCore(StackBuffer* buf, SystemOptions* options, Ngs2Handle**
|
||||||
// Validate maxGrainSamples
|
// Validate maxGrainSamples
|
||||||
if (maxGrainSamples < 64 || maxGrainSamples > 1024 || (maxGrainSamples & 0x3F) != 0) {
|
if (maxGrainSamples < 64 || maxGrainSamples > 1024 || (maxGrainSamples & 0x3F) != 0) {
|
||||||
LOG_ERROR(Lib_Ngs2, "Invalid system option (maxGrainSamples={},x64)", maxGrainSamples);
|
LOG_ERROR(Lib_Ngs2, "Invalid system option (maxGrainSamples={},x64)", maxGrainSamples);
|
||||||
return ORBIS_NGS2_ERROR_INVALID_MAXIMUM_GRAIN_SAMPLES;
|
return ORBIS_NGS2_ERROR_INVALID_MAX_GRAIN_SAMPLES;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate numGrainSamples
|
// Validate numGrainSamples
|
||||||
if (numGrainSamples < 64 || numGrainSamples > 1024 || (numGrainSamples & 0x3F) != 0) {
|
if (numGrainSamples < 64 || numGrainSamples > 1024 || (numGrainSamples & 0x3F) != 0) {
|
||||||
LOG_ERROR(Lib_Ngs2, "Invalid system option (numGrainSamples={},x64)", numGrainSamples);
|
LOG_ERROR(Lib_Ngs2, "Invalid system option (numGrainSamples={},x64)", numGrainSamples);
|
||||||
return ORBIS_NGS2_ERROR_INVALID_GRAIN_SAMPLES;
|
return ORBIS_NGS2_ERROR_INVALID_NUM_GRAIN_SAMPLES;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate sampleRate
|
// Validate sampleRate
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
// Generated By moduleGenerator
|
// Generated By moduleGenerator
|
||||||
#include <common/assert.h>
|
#include <common/assert.h>
|
||||||
#include <common/singleton.h>
|
#include <common/singleton.h>
|
||||||
|
#include "common/config.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "core/libraries/error_codes.h"
|
#include "core/libraries/error_codes.h"
|
||||||
#include "core/libraries/libs.h"
|
#include "core/libraries/libs.h"
|
||||||
|
@ -25,6 +26,9 @@ int PS4_SYSV_ABI scePadConnectPort() {
|
||||||
int PS4_SYSV_ABI scePadDeviceClassGetExtendedInformation(
|
int PS4_SYSV_ABI scePadDeviceClassGetExtendedInformation(
|
||||||
s32 handle, OrbisPadDeviceClassExtendedInformation* pExtInfo) {
|
s32 handle, OrbisPadDeviceClassExtendedInformation* pExtInfo) {
|
||||||
LOG_ERROR(Lib_Pad, "(STUBBED) called");
|
LOG_ERROR(Lib_Pad, "(STUBBED) called");
|
||||||
|
if (Config::getUseSpecialPad()) {
|
||||||
|
pExtInfo->deviceClass = (OrbisPadDeviceClass)Config::getSpecialPadClass();
|
||||||
|
}
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,6 +111,10 @@ int PS4_SYSV_ABI scePadGetControllerInformation(s32 handle, OrbisPadControllerIn
|
||||||
pInfo->connectedCount = 1;
|
pInfo->connectedCount = 1;
|
||||||
pInfo->connected = true;
|
pInfo->connected = true;
|
||||||
pInfo->deviceClass = ORBIS_PAD_DEVICE_CLASS_STANDARD;
|
pInfo->deviceClass = ORBIS_PAD_DEVICE_CLASS_STANDARD;
|
||||||
|
if (Config::getUseSpecialPad()) {
|
||||||
|
pInfo->connectionType = ORBIS_PAD_PORT_TYPE_SPECIAL;
|
||||||
|
pInfo->deviceClass = (OrbisPadDeviceClass)Config::getSpecialPadClass();
|
||||||
|
}
|
||||||
return SCE_OK;
|
return SCE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,11 +247,26 @@ int PS4_SYSV_ABI scePadMbusTerm() {
|
||||||
|
|
||||||
int PS4_SYSV_ABI scePadOpen(s32 userId, s32 type, s32 index, const OrbisPadOpenParam* pParam) {
|
int PS4_SYSV_ABI scePadOpen(s32 userId, s32 type, s32 index, const OrbisPadOpenParam* pParam) {
|
||||||
LOG_INFO(Lib_Pad, "(DUMMY) called user_id = {} type = {} index = {}", userId, type, index);
|
LOG_INFO(Lib_Pad, "(DUMMY) called user_id = {} type = {} index = {}", userId, type, index);
|
||||||
|
if (Config::getUseSpecialPad()) {
|
||||||
|
if (type != ORBIS_PAD_PORT_TYPE_SPECIAL)
|
||||||
|
return ORBIS_PAD_ERROR_DEVICE_NOT_CONNECTED;
|
||||||
|
} else {
|
||||||
|
if (type != ORBIS_PAD_PORT_TYPE_STANDARD)
|
||||||
|
return ORBIS_PAD_ERROR_DEVICE_NOT_CONNECTED;
|
||||||
|
}
|
||||||
return 1; // dummy
|
return 1; // dummy
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI scePadOpenExt() {
|
int PS4_SYSV_ABI scePadOpenExt(s32 userId, s32 type, s32 index,
|
||||||
|
const OrbisPadOpenExtParam* pParam) {
|
||||||
LOG_ERROR(Lib_Pad, "(STUBBED) called");
|
LOG_ERROR(Lib_Pad, "(STUBBED) called");
|
||||||
|
if (Config::getUseSpecialPad()) {
|
||||||
|
if (type != ORBIS_PAD_PORT_TYPE_SPECIAL)
|
||||||
|
return ORBIS_PAD_ERROR_DEVICE_NOT_CONNECTED;
|
||||||
|
} else {
|
||||||
|
if (type != ORBIS_PAD_PORT_TYPE_STANDARD)
|
||||||
|
return ORBIS_PAD_ERROR_DEVICE_NOT_CONNECTED;
|
||||||
|
}
|
||||||
return 1; // dummy
|
return 1; // dummy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,12 +309,13 @@ int PS4_SYSV_ABI scePadRead(s32 handle, OrbisPadData* pData, s32 num) {
|
||||||
pData[i].angularVelocity.x = 0.0f;
|
pData[i].angularVelocity.x = 0.0f;
|
||||||
pData[i].angularVelocity.y = 0.0f;
|
pData[i].angularVelocity.y = 0.0f;
|
||||||
pData[i].angularVelocity.z = 0.0f;
|
pData[i].angularVelocity.z = 0.0f;
|
||||||
pData[i].touchData.touchNum = 0;
|
pData[i].touchData.touchNum =
|
||||||
pData[i].touchData.touch[0].x = 0;
|
(states[i].touchpad[0].state ? 1 : 0) + (states[i].touchpad[1].state ? 1 : 0);
|
||||||
pData[i].touchData.touch[0].y = 0;
|
pData[i].touchData.touch[0].x = states[i].touchpad[0].x;
|
||||||
|
pData[i].touchData.touch[0].y = states[i].touchpad[0].y;
|
||||||
pData[i].touchData.touch[0].id = 1;
|
pData[i].touchData.touch[0].id = 1;
|
||||||
pData[i].touchData.touch[1].x = 0;
|
pData[i].touchData.touch[1].x = states[i].touchpad[1].x;
|
||||||
pData[i].touchData.touch[1].y = 0;
|
pData[i].touchData.touch[1].y = states[i].touchpad[1].y;
|
||||||
pData[i].touchData.touch[1].id = 2;
|
pData[i].touchData.touch[1].id = 2;
|
||||||
pData[i].connected = connected;
|
pData[i].connected = connected;
|
||||||
pData[i].timestamp = states[i].time;
|
pData[i].timestamp = states[i].time;
|
||||||
|
|
|
@ -229,6 +229,13 @@ struct OrbisPadOpenParam {
|
||||||
u8 reserve[8];
|
u8 reserve[8];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct OrbisPadOpenExtParam {
|
||||||
|
u16 vendorId;
|
||||||
|
u16 productId;
|
||||||
|
u16 productId_2;
|
||||||
|
u8 reserve[10];
|
||||||
|
};
|
||||||
|
|
||||||
struct OrbisPadLightBarParam {
|
struct OrbisPadLightBarParam {
|
||||||
u8 r;
|
u8 r;
|
||||||
u8 g;
|
u8 g;
|
||||||
|
@ -284,7 +291,7 @@ int PS4_SYSV_ABI scePadIsValidHandle();
|
||||||
int PS4_SYSV_ABI scePadMbusInit();
|
int PS4_SYSV_ABI scePadMbusInit();
|
||||||
int PS4_SYSV_ABI scePadMbusTerm();
|
int PS4_SYSV_ABI scePadMbusTerm();
|
||||||
int PS4_SYSV_ABI scePadOpen(s32 userId, s32 type, s32 index, const OrbisPadOpenParam* pParam);
|
int PS4_SYSV_ABI scePadOpen(s32 userId, s32 type, s32 index, const OrbisPadOpenParam* pParam);
|
||||||
int PS4_SYSV_ABI scePadOpenExt();
|
int PS4_SYSV_ABI scePadOpenExt(s32 userId, s32 type, s32 index, const OrbisPadOpenExtParam* pParam);
|
||||||
int PS4_SYSV_ABI scePadOpenExt2();
|
int PS4_SYSV_ABI scePadOpenExt2();
|
||||||
int PS4_SYSV_ABI scePadOutputReport();
|
int PS4_SYSV_ABI scePadOutputReport();
|
||||||
int PS4_SYSV_ABI scePadRead(s32 handle, OrbisPadData* pData, s32 num);
|
int PS4_SYSV_ABI scePadRead(s32 handle, OrbisPadData* pData, s32 num);
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
// 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 "random.h"
|
||||||
|
#include "random_error.h"
|
||||||
|
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "core/libraries/error_codes.h"
|
#include "core/libraries/error_codes.h"
|
||||||
#include "core/libraries/libs.h"
|
#include "core/libraries/libs.h"
|
||||||
#include "random.h"
|
|
||||||
|
|
||||||
namespace Libraries::Random {
|
namespace Libraries::Random {
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceRandomGetRandomNumber(u8* buf, size_t size) {
|
s32 PS4_SYSV_ABI sceRandomGetRandomNumber(u8* buf, std::size_t size) {
|
||||||
LOG_TRACE(Lib_Random, "called");
|
LOG_TRACE(Lib_Random, "called");
|
||||||
if (size > SCE_RANDOM_MAX_SIZE) {
|
if (size > SCE_RANDOM_MAX_SIZE) {
|
||||||
return SCE_RANDOM_ERROR_INVALID;
|
return SCE_RANDOM_ERROR_INVALID;
|
||||||
|
|
|
@ -11,7 +11,7 @@ class SymbolsResolver;
|
||||||
namespace Libraries::Random {
|
namespace Libraries::Random {
|
||||||
constexpr int32_t SCE_RANDOM_MAX_SIZE = 64;
|
constexpr int32_t SCE_RANDOM_MAX_SIZE = 64;
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceRandomGetRandomNumber(u8* buf, size_t size);
|
s32 PS4_SYSV_ABI sceRandomGetRandomNumber(u8* buf, std::size_t size);
|
||||||
|
|
||||||
void RegisterlibSceRandom(Core::Loader::SymbolsResolver* sym);
|
void RegisterlibSceRandom(Core::Loader::SymbolsResolver* sym);
|
||||||
} // namespace Libraries::Random
|
} // namespace Libraries::Random
|
|
@ -0,0 +1,8 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
constexpr int SCE_RANDOM_ERROR_INVALID = 0x817C0016;
|
||||||
|
constexpr int SCE_RANDOM_ERROR_OUT_OF_RESOURCES = 0x817C001C;
|
||||||
|
constexpr int SCE_RANDOM_ERROR_FATAL = 0x817C00FF;
|
|
@ -505,8 +505,11 @@ s32 saveDataMount(u32 user_id, char* dir_name, u32 mount_mode,
|
||||||
ORBIS_SAVE_DATA_MOUNT_MODE_DESTRUCT_OFF:
|
ORBIS_SAVE_DATA_MOUNT_MODE_DESTRUCT_OFF:
|
||||||
case ORBIS_SAVE_DATA_MOUNT_MODE_CREATE | ORBIS_SAVE_DATA_MOUNT_MODE_RDWR |
|
case ORBIS_SAVE_DATA_MOUNT_MODE_CREATE | ORBIS_SAVE_DATA_MOUNT_MODE_RDWR |
|
||||||
ORBIS_SAVE_DATA_MOUNT_MODE_COPY_ICON:
|
ORBIS_SAVE_DATA_MOUNT_MODE_COPY_ICON:
|
||||||
|
case ORBIS_SAVE_DATA_MOUNT_MODE_CREATE | ORBIS_SAVE_DATA_MOUNT_MODE_COPY_ICON:
|
||||||
case ORBIS_SAVE_DATA_MOUNT_MODE_CREATE | ORBIS_SAVE_DATA_MOUNT_MODE_DESTRUCT_OFF |
|
case ORBIS_SAVE_DATA_MOUNT_MODE_CREATE | ORBIS_SAVE_DATA_MOUNT_MODE_DESTRUCT_OFF |
|
||||||
ORBIS_SAVE_DATA_MOUNT_MODE_COPY_ICON: {
|
ORBIS_SAVE_DATA_MOUNT_MODE_COPY_ICON:
|
||||||
|
case ORBIS_SAVE_DATA_MOUNT_MODE_CREATE | ORBIS_SAVE_DATA_MOUNT_MODE_RDWR |
|
||||||
|
ORBIS_SAVE_DATA_MOUNT_MODE_DESTRUCT_OFF | ORBIS_SAVE_DATA_MOUNT_MODE_COPY_ICON: {
|
||||||
if (std::filesystem::exists(mount_dir)) {
|
if (std::filesystem::exists(mount_dir)) {
|
||||||
return ORBIS_SAVE_DATA_ERROR_EXISTS;
|
return ORBIS_SAVE_DATA_ERROR_EXISTS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,11 +68,19 @@ void Linker::Execute() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configure used flexible memory size.
|
// Configure used flexible memory size.
|
||||||
// if (auto* mem_param = GetProcParam()->mem_param) {
|
if (const auto* proc_param = GetProcParam()) {
|
||||||
// if (u64* flexible_size = mem_param->flexible_memory_size) {
|
if (proc_param->size >=
|
||||||
// memory->SetTotalFlexibleSize(*flexible_size);
|
offsetof(OrbisProcParam, mem_param) + sizeof(OrbisKernelMemParam*)) {
|
||||||
// }
|
if (const auto* mem_param = proc_param->mem_param) {
|
||||||
// }
|
if (mem_param->size >=
|
||||||
|
offsetof(OrbisKernelMemParam, flexible_memory_size) + sizeof(u64*)) {
|
||||||
|
if (const auto* flexible_size = mem_param->flexible_memory_size) {
|
||||||
|
memory->SetupMemoryRegions(*flexible_size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Init primary thread.
|
// Init primary thread.
|
||||||
Common::SetCurrentThreadName("GAME_MainThread");
|
Common::SetCurrentThreadName("GAME_MainThread");
|
||||||
|
|
|
@ -11,9 +11,11 @@
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
|
constexpr u64 SCE_DEFAULT_FLEXIBLE_MEMORY_SIZE = 448_MB;
|
||||||
|
|
||||||
MemoryManager::MemoryManager() {
|
MemoryManager::MemoryManager() {
|
||||||
// Insert an area that covers direct memory physical block.
|
// Set up the direct and flexible memory regions.
|
||||||
dmem_map.emplace(0, DirectMemoryArea{0, SCE_KERNEL_MAIN_DMEM_SIZE});
|
SetupMemoryRegions(SCE_DEFAULT_FLEXIBLE_MEMORY_SIZE);
|
||||||
|
|
||||||
// Insert a virtual memory area that covers the entire area we manage.
|
// Insert a virtual memory area that covers the entire area we manage.
|
||||||
const VAddr system_managed_base = impl.SystemManagedVirtualBase();
|
const VAddr system_managed_base = impl.SystemManagedVirtualBase();
|
||||||
|
@ -35,6 +37,19 @@ MemoryManager::MemoryManager() {
|
||||||
|
|
||||||
MemoryManager::~MemoryManager() = default;
|
MemoryManager::~MemoryManager() = default;
|
||||||
|
|
||||||
|
void MemoryManager::SetupMemoryRegions(u64 flexible_size) {
|
||||||
|
total_flexible_size = flexible_size;
|
||||||
|
total_direct_size = SCE_KERNEL_MAIN_DMEM_SIZE - flexible_size;
|
||||||
|
|
||||||
|
// Insert an area that covers direct memory physical block.
|
||||||
|
// Note that this should never be called after direct memory allocations have been made.
|
||||||
|
dmem_map.clear();
|
||||||
|
dmem_map.emplace(0, DirectMemoryArea{0, total_direct_size});
|
||||||
|
|
||||||
|
LOG_INFO(Kernel_Vmm, "Configured memory regions: flexible size = {:#x}, direct size = {:#x}",
|
||||||
|
total_flexible_size, total_direct_size);
|
||||||
|
}
|
||||||
|
|
||||||
PAddr MemoryManager::Allocate(PAddr search_start, PAddr search_end, size_t size, u64 alignment,
|
PAddr MemoryManager::Allocate(PAddr search_start, PAddr search_end, size_t size, u64 alignment,
|
||||||
int memory_type) {
|
int memory_type) {
|
||||||
std::scoped_lock lk{mutex};
|
std::scoped_lock lk{mutex};
|
||||||
|
@ -42,12 +57,17 @@ PAddr MemoryManager::Allocate(PAddr search_start, PAddr search_end, size_t size,
|
||||||
auto dmem_area = FindDmemArea(search_start);
|
auto dmem_area = FindDmemArea(search_start);
|
||||||
|
|
||||||
const auto is_suitable = [&] {
|
const auto is_suitable = [&] {
|
||||||
return dmem_area->second.is_free && dmem_area->second.size >= size;
|
const auto aligned_base = alignment > 0 ? Common::AlignUp(dmem_area->second.base, alignment)
|
||||||
|
: dmem_area->second.base;
|
||||||
|
const auto alignment_size = aligned_base - dmem_area->second.base;
|
||||||
|
const auto remaining_size =
|
||||||
|
dmem_area->second.size >= alignment_size ? dmem_area->second.size - alignment_size : 0;
|
||||||
|
return dmem_area->second.is_free && remaining_size >= size;
|
||||||
};
|
};
|
||||||
while (!is_suitable() && dmem_area->second.GetEnd() <= search_end) {
|
while (!is_suitable() && dmem_area->second.GetEnd() <= search_end) {
|
||||||
dmem_area++;
|
dmem_area++;
|
||||||
}
|
}
|
||||||
ASSERT_MSG(is_suitable(), "Unable to find free direct memory area");
|
ASSERT_MSG(is_suitable(), "Unable to find free direct memory area: size = {:#x}", size);
|
||||||
|
|
||||||
// Align free position
|
// Align free position
|
||||||
PAddr free_addr = dmem_area->second.base;
|
PAddr free_addr = dmem_area->second.base;
|
||||||
|
@ -333,14 +353,19 @@ int MemoryManager::DirectQueryAvailable(PAddr search_start, PAddr search_end, si
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dmem_area->second.size > max_size) {
|
const auto aligned_base = alignment > 0 ? Common::AlignUp(dmem_area->second.base, alignment)
|
||||||
paddr = dmem_area->second.base;
|
: dmem_area->second.base;
|
||||||
max_size = dmem_area->second.size;
|
const auto alignment_size = aligned_base - dmem_area->second.base;
|
||||||
|
const auto remaining_size =
|
||||||
|
dmem_area->second.size >= alignment_size ? dmem_area->second.size - alignment_size : 0;
|
||||||
|
if (remaining_size > max_size) {
|
||||||
|
paddr = aligned_base;
|
||||||
|
max_size = remaining_size;
|
||||||
}
|
}
|
||||||
dmem_area++;
|
dmem_area++;
|
||||||
}
|
}
|
||||||
|
|
||||||
*phys_addr_out = alignment > 0 ? Common::AlignUp(paddr, alignment) : paddr;
|
*phys_addr_out = paddr;
|
||||||
*size_out = max_size;
|
*size_out = max_size;
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
@ -418,7 +443,8 @@ MemoryManager::DMemHandle MemoryManager::CarveDmemArea(PAddr addr, size_t size)
|
||||||
|
|
||||||
const PAddr start_in_area = addr - area.base;
|
const PAddr start_in_area = addr - area.base;
|
||||||
const PAddr end_in_vma = start_in_area + size;
|
const PAddr end_in_vma = start_in_area + size;
|
||||||
ASSERT_MSG(end_in_vma <= area.size, "Mapping cannot fit inside free region");
|
ASSERT_MSG(end_in_vma <= area.size, "Mapping cannot fit inside free region: size = {:#x}",
|
||||||
|
size);
|
||||||
|
|
||||||
if (end_in_vma != area.size) {
|
if (end_in_vma != area.size) {
|
||||||
// Split VMA at the end of the allocated region
|
// Split VMA at the end of the allocated region
|
||||||
|
|
|
@ -130,8 +130,8 @@ public:
|
||||||
rasterizer = rasterizer_;
|
rasterizer = rasterizer_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetTotalFlexibleSize(u64 size) {
|
u64 GetTotalDirectSize() const {
|
||||||
total_flexible_size = size;
|
return total_direct_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 GetAvailableFlexibleSize() const {
|
u64 GetAvailableFlexibleSize() const {
|
||||||
|
@ -142,6 +142,8 @@ public:
|
||||||
return impl.SystemReservedVirtualBase();
|
return impl.SystemReservedVirtualBase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetupMemoryRegions(u64 flexible_size);
|
||||||
|
|
||||||
PAddr Allocate(PAddr search_start, PAddr search_end, size_t size, u64 alignment,
|
PAddr Allocate(PAddr search_start, PAddr search_end, size_t size, u64 alignment,
|
||||||
int memory_type);
|
int memory_type);
|
||||||
|
|
||||||
|
@ -217,7 +219,8 @@ private:
|
||||||
DMemMap dmem_map;
|
DMemMap dmem_map;
|
||||||
VMAMap vma_map;
|
VMAMap vma_map;
|
||||||
std::recursive_mutex mutex;
|
std::recursive_mutex mutex;
|
||||||
size_t total_flexible_size = 448_MB;
|
size_t total_direct_size{};
|
||||||
|
size_t total_flexible_size{};
|
||||||
size_t flexible_usage{};
|
size_t flexible_usage{};
|
||||||
Vulkan::Rasterizer* rasterizer{};
|
Vulkan::Rasterizer* rasterizer{};
|
||||||
};
|
};
|
||||||
|
|
|
@ -132,15 +132,29 @@ bool GameController::SetVibration(u8 smallMotor, u8 largeMotor) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameController::SetTouchpadState(int touchIndex, bool touchDown, float x, float y) {
|
||||||
|
if (touchIndex < 2) {
|
||||||
|
std::scoped_lock lock{m_mutex};
|
||||||
|
auto state = GetLastState();
|
||||||
|
state.time = Libraries::Kernel::sceKernelGetProcessTime();
|
||||||
|
|
||||||
|
state.touchpad[touchIndex].state = touchDown;
|
||||||
|
state.touchpad[touchIndex].x = static_cast<u16>(x * 1920);
|
||||||
|
state.touchpad[touchIndex].y = static_cast<u16>(y * 941);
|
||||||
|
|
||||||
|
AddState(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GameController::TryOpenSDLController() {
|
void GameController::TryOpenSDLController() {
|
||||||
if (m_sdl_gamepad == nullptr || !SDL_GamepadConnected(m_sdl_gamepad)) {
|
if (m_sdl_gamepad == nullptr || !SDL_GamepadConnected(m_sdl_gamepad)) {
|
||||||
int gamepad_count;
|
int gamepad_count;
|
||||||
SDL_JoystickID* gamepads = SDL_GetGamepads(&gamepad_count);
|
SDL_JoystickID* gamepads = SDL_GetGamepads(&gamepad_count);
|
||||||
m_sdl_gamepad = gamepad_count > 0 ? SDL_OpenGamepad(gamepads[0]) : nullptr;
|
m_sdl_gamepad = gamepad_count > 0 ? SDL_OpenGamepad(gamepads[0]) : nullptr;
|
||||||
SDL_free(gamepads);
|
SDL_free(gamepads);
|
||||||
}
|
|
||||||
|
|
||||||
SetLightBarRGB(0, 0, 255);
|
SetLightBarRGB(0, 0, 255);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Input
|
} // namespace Input
|
||||||
|
|
|
@ -21,10 +21,17 @@ enum class Axis {
|
||||||
AxisMax
|
AxisMax
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct TouchpadEntry {
|
||||||
|
bool state{};
|
||||||
|
u16 x{};
|
||||||
|
u16 y{};
|
||||||
|
};
|
||||||
|
|
||||||
struct State {
|
struct State {
|
||||||
u32 buttonsState = 0;
|
u32 buttonsState = 0;
|
||||||
u64 time = 0;
|
u64 time = 0;
|
||||||
int axes[static_cast<int>(Axis::AxisMax)] = {128, 128, 128, 128, 0, 0};
|
int axes[static_cast<int>(Axis::AxisMax)] = {128, 128, 128, 128, 0, 0};
|
||||||
|
TouchpadEntry touchpad[2] = {{false, 0, 0}, {false, 0, 0}};
|
||||||
};
|
};
|
||||||
|
|
||||||
inline int GetAxis(int min, int max, int value) {
|
inline int GetAxis(int min, int max, int value) {
|
||||||
|
@ -47,6 +54,7 @@ public:
|
||||||
void Axis(int id, Input::Axis axis, int value);
|
void Axis(int id, Input::Axis axis, int value);
|
||||||
void SetLightBarRGB(u8 r, u8 g, u8 b);
|
void SetLightBarRGB(u8 r, u8 g, u8 b);
|
||||||
bool SetVibration(u8 smallMotor, u8 largeMotor);
|
bool SetVibration(u8 smallMotor, u8 largeMotor);
|
||||||
|
void SetTouchpadState(int touchIndex, bool touchDown, float x, float y);
|
||||||
void TryOpenSDLController();
|
void TryOpenSDLController();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -98,6 +98,11 @@ void WindowSDL::waitEvent() {
|
||||||
case SDL_EVENT_GAMEPAD_BUTTON_DOWN:
|
case SDL_EVENT_GAMEPAD_BUTTON_DOWN:
|
||||||
case SDL_EVENT_GAMEPAD_BUTTON_UP:
|
case SDL_EVENT_GAMEPAD_BUTTON_UP:
|
||||||
case SDL_EVENT_GAMEPAD_AXIS_MOTION:
|
case SDL_EVENT_GAMEPAD_AXIS_MOTION:
|
||||||
|
case SDL_EVENT_GAMEPAD_ADDED:
|
||||||
|
case SDL_EVENT_GAMEPAD_REMOVED:
|
||||||
|
case SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN:
|
||||||
|
case SDL_EVENT_GAMEPAD_TOUCHPAD_UP:
|
||||||
|
case SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION:
|
||||||
onGamepadEvent(&event);
|
onGamepadEvent(&event);
|
||||||
break;
|
break;
|
||||||
case SDL_EVENT_QUIT:
|
case SDL_EVENT_QUIT:
|
||||||
|
@ -273,6 +278,15 @@ void WindowSDL::onKeyPress(const SDL_Event* event) {
|
||||||
case SDLK_SPACE:
|
case SDLK_SPACE:
|
||||||
button = OrbisPadButtonDataOffset::ORBIS_PAD_BUTTON_TOUCH_PAD;
|
button = OrbisPadButtonDataOffset::ORBIS_PAD_BUTTON_TOUCH_PAD;
|
||||||
break;
|
break;
|
||||||
|
case SDLK_F11:
|
||||||
|
if (event->type == SDL_EVENT_KEY_DOWN) {
|
||||||
|
{
|
||||||
|
SDL_WindowFlags flag = SDL_GetWindowFlags(window);
|
||||||
|
bool is_fullscreen = flag & SDL_WINDOW_FULLSCREEN;
|
||||||
|
SDL_SetWindowFullscreen(window, !is_fullscreen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -290,6 +304,17 @@ void WindowSDL::onGamepadEvent(const SDL_Event* event) {
|
||||||
u32 button = 0;
|
u32 button = 0;
|
||||||
Input::Axis axis = Input::Axis::AxisMax;
|
Input::Axis axis = Input::Axis::AxisMax;
|
||||||
switch (event->type) {
|
switch (event->type) {
|
||||||
|
case SDL_EVENT_GAMEPAD_ADDED:
|
||||||
|
case SDL_EVENT_GAMEPAD_REMOVED:
|
||||||
|
controller->TryOpenSDLController();
|
||||||
|
break;
|
||||||
|
case SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN:
|
||||||
|
case SDL_EVENT_GAMEPAD_TOUCHPAD_UP:
|
||||||
|
case SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION:
|
||||||
|
controller->SetTouchpadState(event->gtouchpad.finger,
|
||||||
|
event->type != SDL_EVENT_GAMEPAD_TOUCHPAD_UP,
|
||||||
|
event->gtouchpad.x, event->gtouchpad.y);
|
||||||
|
break;
|
||||||
case SDL_EVENT_GAMEPAD_BUTTON_DOWN:
|
case SDL_EVENT_GAMEPAD_BUTTON_DOWN:
|
||||||
case SDL_EVENT_GAMEPAD_BUTTON_UP:
|
case SDL_EVENT_GAMEPAD_BUTTON_UP:
|
||||||
button = sdlGamepadToOrbisButton(event->gbutton.button);
|
button = sdlGamepadToOrbisButton(event->gbutton.button);
|
||||||
|
|
|
@ -286,6 +286,7 @@ Id EmitShiftRightLogical64(EmitContext& ctx, Id base, Id shift);
|
||||||
Id EmitShiftRightArithmetic32(EmitContext& ctx, Id base, Id shift);
|
Id EmitShiftRightArithmetic32(EmitContext& ctx, Id base, Id shift);
|
||||||
Id EmitShiftRightArithmetic64(EmitContext& ctx, Id base, Id shift);
|
Id EmitShiftRightArithmetic64(EmitContext& ctx, Id base, Id shift);
|
||||||
Id EmitBitwiseAnd32(EmitContext& ctx, IR::Inst* inst, Id a, Id b);
|
Id EmitBitwiseAnd32(EmitContext& ctx, IR::Inst* inst, Id a, Id b);
|
||||||
|
Id EmitBitwiseAnd64(EmitContext& ctx, IR::Inst* inst, Id a, Id b);
|
||||||
Id EmitBitwiseOr32(EmitContext& ctx, IR::Inst* inst, Id a, Id b);
|
Id EmitBitwiseOr32(EmitContext& ctx, IR::Inst* inst, Id a, Id b);
|
||||||
Id EmitBitwiseOr64(EmitContext& ctx, IR::Inst* inst, Id a, Id b);
|
Id EmitBitwiseOr64(EmitContext& ctx, IR::Inst* inst, Id a, Id b);
|
||||||
Id EmitBitwiseXor32(EmitContext& ctx, IR::Inst* inst, Id a, Id b);
|
Id EmitBitwiseXor32(EmitContext& ctx, IR::Inst* inst, Id a, Id b);
|
||||||
|
|
|
@ -139,6 +139,13 @@ Id EmitBitwiseAnd32(EmitContext& ctx, IR::Inst* inst, Id a, Id b) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Id EmitBitwiseAnd64(EmitContext& ctx, IR::Inst* inst, Id a, Id b) {
|
||||||
|
const Id result{ctx.OpBitwiseAnd(ctx.U64, a, b)};
|
||||||
|
SetZeroFlag(ctx, inst, result);
|
||||||
|
SetSignFlag(ctx, inst, result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
Id EmitBitwiseOr32(EmitContext& ctx, IR::Inst* inst, Id a, Id b) {
|
Id EmitBitwiseOr32(EmitContext& ctx, IR::Inst* inst, Id a, Id b) {
|
||||||
const Id result{ctx.OpBitwiseOr(ctx.U32[1], a, b)};
|
const Id result{ctx.OpBitwiseOr(ctx.U32[1], a, b)};
|
||||||
SetZeroFlag(ctx, inst, result);
|
SetZeroFlag(ctx, inst, result);
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
|
@ -472,7 +472,7 @@ void Translator::S_MIN_U32(const GcnInst& inst) {
|
||||||
|
|
||||||
void Translator::S_CMPK_EQ_U32(const GcnInst& inst) {
|
void Translator::S_CMPK_EQ_U32(const GcnInst& inst) {
|
||||||
const s32 simm16 = inst.control.sopk.simm;
|
const s32 simm16 = inst.control.sopk.simm;
|
||||||
const IR::U32 src0{GetSrc(inst.src[0])};
|
const IR::U32 src0{GetSrc(inst.dst[0])};
|
||||||
const IR::U32 src1{ir.Imm32(simm16)};
|
const IR::U32 src1{ir.Imm32(simm16)};
|
||||||
ir.SetScc(ir.IEqual(src0, src1));
|
ir.SetScc(ir.IEqual(src0, src1));
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,6 +117,7 @@ public:
|
||||||
void V_AND_B32(const GcnInst& inst);
|
void V_AND_B32(const GcnInst& inst);
|
||||||
void V_LSHLREV_B32(const GcnInst& inst);
|
void V_LSHLREV_B32(const GcnInst& inst);
|
||||||
void V_LSHL_B32(const GcnInst& inst);
|
void V_LSHL_B32(const GcnInst& inst);
|
||||||
|
void V_LSHL_B64(const GcnInst& inst);
|
||||||
void V_ADD_I32(const GcnInst& inst);
|
void V_ADD_I32(const GcnInst& inst);
|
||||||
void V_ADDC_U32(const GcnInst& inst);
|
void V_ADDC_U32(const GcnInst& inst);
|
||||||
void V_CVT_F32_I32(const GcnInst& inst);
|
void V_CVT_F32_I32(const GcnInst& inst);
|
||||||
|
|
|
@ -11,6 +11,8 @@ void Translator::EmitVectorAlu(const GcnInst& inst) {
|
||||||
return V_LSHLREV_B32(inst);
|
return V_LSHLREV_B32(inst);
|
||||||
case Opcode::V_LSHL_B32:
|
case Opcode::V_LSHL_B32:
|
||||||
return V_LSHL_B32(inst);
|
return V_LSHL_B32(inst);
|
||||||
|
case Opcode::V_LSHL_B64:
|
||||||
|
return V_LSHL_B64(inst);
|
||||||
case Opcode::V_BFREV_B32:
|
case Opcode::V_BFREV_B32:
|
||||||
return V_BFREV_B32(inst);
|
return V_BFREV_B32(inst);
|
||||||
case Opcode::V_BFE_U32:
|
case Opcode::V_BFE_U32:
|
||||||
|
@ -390,6 +392,16 @@ void Translator::V_LSHL_B32(const GcnInst& inst) {
|
||||||
SetDst(inst.dst[0], ir.ShiftLeftLogical(src0, ir.BitwiseAnd(src1, ir.Imm32(0x1F))));
|
SetDst(inst.dst[0], ir.ShiftLeftLogical(src0, ir.BitwiseAnd(src1, ir.Imm32(0x1F))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Translator::V_LSHL_B64(const GcnInst& inst) {
|
||||||
|
const IR::U64 src0{GetSrc64(inst.src[0])};
|
||||||
|
const IR::U64 src1{GetSrc64(inst.src[1])};
|
||||||
|
const IR::VectorReg dst_reg{inst.dst[0].code};
|
||||||
|
ASSERT_MSG(src0.IsImmediate() && src0.U64() == 0 && src1.IsImmediate() && src1.U64() == 0,
|
||||||
|
"V_LSHL_B64 with non-zero src0 or src1 is not supported");
|
||||||
|
ir.SetVectorReg(dst_reg, ir.Imm32(0));
|
||||||
|
ir.SetVectorReg(dst_reg + 1, ir.Imm32(0));
|
||||||
|
}
|
||||||
|
|
||||||
void Translator::V_ADD_I32(const GcnInst& inst) {
|
void Translator::V_ADD_I32(const GcnInst& inst) {
|
||||||
const IR::U32 src0{GetSrc(inst.src[0])};
|
const IR::U32 src0{GetSrc(inst.src[0])};
|
||||||
const IR::U32 src1{ir.GetVectorReg(IR::VectorReg(inst.src[1].code))};
|
const IR::U32 src1{ir.GetVectorReg(IR::VectorReg(inst.src[1].code))};
|
||||||
|
|
|
@ -1115,8 +1115,18 @@ U32U64 IREmitter::ShiftRightArithmetic(const U32U64& base, const U32& shift) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
U32 IREmitter::BitwiseAnd(const U32& a, const U32& b) {
|
U32U64 IREmitter::BitwiseAnd(const U32U64& a, const U32U64& b) {
|
||||||
return Inst<U32>(Opcode::BitwiseAnd32, a, b);
|
if (a.Type() != b.Type()) {
|
||||||
|
UNREACHABLE_MSG("Mismatching types {} and {}", a.Type(), b.Type());
|
||||||
|
}
|
||||||
|
switch (a.Type()) {
|
||||||
|
case Type::U32:
|
||||||
|
return Inst<U32>(Opcode::BitwiseAnd32, a, b);
|
||||||
|
case Type::U64:
|
||||||
|
return Inst<U64>(Opcode::BitwiseAnd64, a, b);
|
||||||
|
default:
|
||||||
|
ThrowInvalidType(a.Type());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
U32U64 IREmitter::BitwiseOr(const U32U64& a, const U32U64& b) {
|
U32U64 IREmitter::BitwiseOr(const U32U64& a, const U32U64& b) {
|
||||||
|
|
|
@ -195,7 +195,7 @@ public:
|
||||||
[[nodiscard]] U32U64 ShiftLeftLogical(const U32U64& base, const U32& shift);
|
[[nodiscard]] U32U64 ShiftLeftLogical(const U32U64& base, const U32& shift);
|
||||||
[[nodiscard]] U32U64 ShiftRightLogical(const U32U64& base, const U32& shift);
|
[[nodiscard]] U32U64 ShiftRightLogical(const U32U64& base, const U32& shift);
|
||||||
[[nodiscard]] U32U64 ShiftRightArithmetic(const U32U64& base, const U32& shift);
|
[[nodiscard]] U32U64 ShiftRightArithmetic(const U32U64& base, const U32& shift);
|
||||||
[[nodiscard]] U32 BitwiseAnd(const U32& a, const U32& b);
|
[[nodiscard]] U32U64 BitwiseAnd(const U32U64& a, const U32U64& b);
|
||||||
[[nodiscard]] U32U64 BitwiseOr(const U32U64& a, const U32U64& b);
|
[[nodiscard]] U32U64 BitwiseOr(const U32U64& a, const U32U64& b);
|
||||||
[[nodiscard]] U32 BitwiseXor(const U32& a, const U32& b);
|
[[nodiscard]] U32 BitwiseXor(const U32& a, const U32& b);
|
||||||
[[nodiscard]] U32 BitFieldInsert(const U32& base, const U32& insert, const U32& offset,
|
[[nodiscard]] U32 BitFieldInsert(const U32& base, const U32& insert, const U32& offset,
|
||||||
|
|
|
@ -260,6 +260,7 @@ OPCODE(ShiftRightLogical64, U64, U64,
|
||||||
OPCODE(ShiftRightArithmetic32, U32, U32, U32, )
|
OPCODE(ShiftRightArithmetic32, U32, U32, U32, )
|
||||||
OPCODE(ShiftRightArithmetic64, U64, U64, U32, )
|
OPCODE(ShiftRightArithmetic64, U64, U64, U32, )
|
||||||
OPCODE(BitwiseAnd32, U32, U32, U32, )
|
OPCODE(BitwiseAnd32, U32, U32, U32, )
|
||||||
|
OPCODE(BitwiseAnd64, U64, U64, U64, )
|
||||||
OPCODE(BitwiseOr32, U32, U32, U32, )
|
OPCODE(BitwiseOr32, U32, U32, U32, )
|
||||||
OPCODE(BitwiseOr64, U64, U64, U64, )
|
OPCODE(BitwiseOr64, U64, U64, U64, )
|
||||||
OPCODE(BitwiseXor32, U32, U32, U32, )
|
OPCODE(BitwiseXor32, U32, U32, U32, )
|
||||||
|
|
|
@ -352,9 +352,15 @@ void ConstantPropagation(IR::Block& block, IR::Inst& inst) {
|
||||||
case IR::Opcode::BitwiseAnd32:
|
case IR::Opcode::BitwiseAnd32:
|
||||||
FoldWhenAllImmediates(inst, [](u32 a, u32 b) { return a & b; });
|
FoldWhenAllImmediates(inst, [](u32 a, u32 b) { return a & b; });
|
||||||
return;
|
return;
|
||||||
|
case IR::Opcode::BitwiseAnd64:
|
||||||
|
FoldWhenAllImmediates(inst, [](u64 a, u64 b) { return a & b; });
|
||||||
|
return;
|
||||||
case IR::Opcode::BitwiseOr32:
|
case IR::Opcode::BitwiseOr32:
|
||||||
FoldWhenAllImmediates(inst, [](u32 a, u32 b) { return a | b; });
|
FoldWhenAllImmediates(inst, [](u32 a, u32 b) { return a | b; });
|
||||||
return;
|
return;
|
||||||
|
case IR::Opcode::BitwiseOr64:
|
||||||
|
FoldWhenAllImmediates(inst, [](u64 a, u64 b) { return a | b; });
|
||||||
|
return;
|
||||||
case IR::Opcode::BitwiseXor32:
|
case IR::Opcode::BitwiseXor32:
|
||||||
FoldWhenAllImmediates(inst, [](u32 a, u32 b) { return a ^ b; });
|
FoldWhenAllImmediates(inst, [](u32 a, u32 b) { return a ^ b; });
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -293,10 +293,11 @@ std::pair<const IR::Inst*, bool> TryDisableAnisoLod0(const IR::Inst* inst) {
|
||||||
return not_found;
|
return not_found;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The bits range is for lods
|
// The bits range is for lods (note that constants are changed after constant propagation pass)
|
||||||
const auto* prod0_arg0 = prod0->Arg(0).InstRecursive();
|
const auto* prod0_arg0 = prod0->Arg(0).InstRecursive();
|
||||||
if (prod0_arg0->GetOpcode() != IR::Opcode::BitFieldUExtract ||
|
if (prod0_arg0->GetOpcode() != IR::Opcode::BitFieldUExtract ||
|
||||||
prod0_arg0->Arg(1).InstRecursive()->Arg(0).U32() != 0x0008000cu) {
|
!(prod0_arg0->Arg(1).IsIdentity() && prod0_arg0->Arg(1).U32() == 12) ||
|
||||||
|
!(prod0_arg0->Arg(2).IsIdentity() && prod0_arg0->Arg(2).U32() == 8)) {
|
||||||
return not_found;
|
return not_found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
|
#include "common/config.h"
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/polyfill_thread.h"
|
#include "common/polyfill_thread.h"
|
||||||
#include "common/thread.h"
|
#include "common/thread.h"
|
||||||
|
@ -175,294 +176,305 @@ Liverpool::Task Liverpool::ProcessGraphics(std::span<const u32> dcb, std::span<c
|
||||||
while (!dcb.empty()) {
|
while (!dcb.empty()) {
|
||||||
const auto* header = reinterpret_cast<const PM4Header*>(dcb.data());
|
const auto* header = reinterpret_cast<const PM4Header*>(dcb.data());
|
||||||
const u32 type = header->type;
|
const u32 type = header->type;
|
||||||
if (type != 3) {
|
|
||||||
// No other types of packets were spotted so far
|
|
||||||
UNREACHABLE_MSG("Invalid PM4 type {}", type);
|
|
||||||
}
|
|
||||||
|
|
||||||
const u32 count = header->type3.NumWords();
|
switch (type) {
|
||||||
const PM4ItOpcode opcode = header->type3.opcode;
|
case 0:
|
||||||
switch (opcode) {
|
case 1:
|
||||||
case PM4ItOpcode::Nop: {
|
UNREACHABLE_MSG("Unsupported PM4 type {}", type);
|
||||||
const auto* nop = reinterpret_cast<const PM4CmdNop*>(header);
|
break;
|
||||||
if (nop->header.count.Value() == 0) {
|
case 2:
|
||||||
break;
|
// Type-2 packet are used for padding purposes
|
||||||
}
|
dcb = dcb.subspan(1);
|
||||||
|
continue;
|
||||||
|
case 3:
|
||||||
|
const u32 count = header->type3.NumWords();
|
||||||
|
const PM4ItOpcode opcode = header->type3.opcode;
|
||||||
|
switch (opcode) {
|
||||||
|
case PM4ItOpcode::Nop: {
|
||||||
|
const auto* nop = reinterpret_cast<const PM4CmdNop*>(header);
|
||||||
|
if (nop->header.count.Value() == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
switch (nop->data_block[0]) {
|
switch (nop->data_block[0]) {
|
||||||
case PM4CmdNop::PayloadType::PatchedFlip: {
|
case PM4CmdNop::PayloadType::PatchedFlip: {
|
||||||
// There is no evidence that GPU CP drives flip events by parsing
|
// There is no evidence that GPU CP drives flip events by parsing
|
||||||
// special NOP packets. For convenience lets assume that it does.
|
// special NOP packets. For convenience lets assume that it does.
|
||||||
Platform::IrqC::Instance()->Signal(Platform::InterruptId::GfxFlip);
|
Platform::IrqC::Instance()->Signal(Platform::InterruptId::GfxFlip);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PM4CmdNop::PayloadType::DebugMarkerPush: {
|
||||||
|
const auto marker_sz = nop->header.count.Value() * 2;
|
||||||
|
const std::string_view label{reinterpret_cast<const char*>(&nop->data_block[1]),
|
||||||
|
marker_sz};
|
||||||
|
rasterizer->ScopeMarkerBegin(label);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PM4CmdNop::PayloadType::DebugMarkerPop: {
|
||||||
|
rasterizer->ScopeMarkerEnd();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PM4CmdNop::PayloadType::DebugMarkerPush: {
|
case PM4ItOpcode::ContextControl: {
|
||||||
const auto marker_sz = nop->header.count.Value() * 2;
|
|
||||||
const std::string_view label{reinterpret_cast<const char*>(&nop->data_block[1]),
|
|
||||||
marker_sz};
|
|
||||||
rasterizer->ScopeMarkerBegin(label);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PM4CmdNop::PayloadType::DebugMarkerPop: {
|
case PM4ItOpcode::ClearState: {
|
||||||
rasterizer->ScopeMarkerEnd();
|
regs.SetDefaults();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PM4ItOpcode::SetConfigReg: {
|
||||||
|
const auto* set_data = reinterpret_cast<const PM4CmdSetData*>(header);
|
||||||
|
const auto reg_addr = ConfigRegWordOffset + set_data->reg_offset;
|
||||||
|
const auto* payload = reinterpret_cast<const u32*>(header + 2);
|
||||||
|
std::memcpy(®s.reg_array[reg_addr], payload, (count - 1) * sizeof(u32));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PM4ItOpcode::SetContextReg: {
|
||||||
|
const auto* set_data = reinterpret_cast<const PM4CmdSetData*>(header);
|
||||||
|
const auto reg_addr = ContextRegWordOffset + set_data->reg_offset;
|
||||||
|
const auto* payload = reinterpret_cast<const u32*>(header + 2);
|
||||||
|
|
||||||
|
std::memcpy(®s.reg_array[reg_addr], payload, (count - 1) * sizeof(u32));
|
||||||
|
|
||||||
|
// In the case of HW, render target memory has alignment as color block operates on
|
||||||
|
// tiles. There is no information of actual resource extents stored in CB context
|
||||||
|
// regs, so any deduction of it from slices/pitch will lead to a larger surface
|
||||||
|
// created. The same applies to the depth targets. Fortunately, the guest always
|
||||||
|
// sends a trailing NOP packet right after the context regs setup, so we can use the
|
||||||
|
// heuristic below and extract the hint to determine actual resource dims.
|
||||||
|
|
||||||
|
switch (reg_addr) {
|
||||||
|
case ContextRegs::CbColor0Base:
|
||||||
|
case ContextRegs::CbColor1Base:
|
||||||
|
case ContextRegs::CbColor2Base:
|
||||||
|
case ContextRegs::CbColor3Base:
|
||||||
|
case ContextRegs::CbColor4Base:
|
||||||
|
case ContextRegs::CbColor5Base:
|
||||||
|
case ContextRegs::CbColor6Base:
|
||||||
|
case ContextRegs::CbColor7Base: {
|
||||||
|
const auto col_buf_id = (reg_addr - ContextRegs::CbColor0Base) /
|
||||||
|
(ContextRegs::CbColor1Base - ContextRegs::CbColor0Base);
|
||||||
|
ASSERT(col_buf_id < NumColorBuffers);
|
||||||
|
|
||||||
|
const auto nop_offset = header->type3.count;
|
||||||
|
if (nop_offset == 0x0e || nop_offset == 0x0d || nop_offset == 0x0b) {
|
||||||
|
ASSERT_MSG(payload[nop_offset] == 0xc0001000,
|
||||||
|
"NOP hint is missing in CB setup sequence");
|
||||||
|
last_cb_extent[col_buf_id].raw = payload[nop_offset + 1];
|
||||||
|
} else {
|
||||||
|
last_cb_extent[col_buf_id].raw = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ContextRegs::CbColor0Cmask:
|
||||||
|
case ContextRegs::CbColor1Cmask:
|
||||||
|
case ContextRegs::CbColor2Cmask:
|
||||||
|
case ContextRegs::CbColor3Cmask:
|
||||||
|
case ContextRegs::CbColor4Cmask:
|
||||||
|
case ContextRegs::CbColor5Cmask:
|
||||||
|
case ContextRegs::CbColor6Cmask:
|
||||||
|
case ContextRegs::CbColor7Cmask: {
|
||||||
|
const auto col_buf_id =
|
||||||
|
(reg_addr - ContextRegs::CbColor0Cmask) /
|
||||||
|
(ContextRegs::CbColor1Cmask - ContextRegs::CbColor0Cmask);
|
||||||
|
ASSERT(col_buf_id < NumColorBuffers);
|
||||||
|
|
||||||
|
const auto nop_offset = header->type3.count;
|
||||||
|
if (nop_offset == 0x04) {
|
||||||
|
ASSERT_MSG(payload[nop_offset] == 0xc0001000,
|
||||||
|
"NOP hint is missing in CB setup sequence");
|
||||||
|
last_cb_extent[col_buf_id].raw = payload[nop_offset + 1];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ContextRegs::DbZInfo: {
|
||||||
|
if (header->type3.count == 8) {
|
||||||
|
ASSERT_MSG(payload[20] == 0xc0001000,
|
||||||
|
"NOP hint is missing in DB setup sequence");
|
||||||
|
last_db_extent.raw = payload[21];
|
||||||
|
} else {
|
||||||
|
last_db_extent.raw = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PM4ItOpcode::SetShReg: {
|
||||||
|
const auto* set_data = reinterpret_cast<const PM4CmdSetData*>(header);
|
||||||
|
std::memcpy(®s.reg_array[ShRegWordOffset + set_data->reg_offset], header + 2,
|
||||||
|
(count - 1) * sizeof(u32));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PM4ItOpcode::SetUconfigReg: {
|
||||||
|
const auto* set_data = reinterpret_cast<const PM4CmdSetData*>(header);
|
||||||
|
std::memcpy(®s.reg_array[UconfigRegWordOffset + set_data->reg_offset],
|
||||||
|
header + 2, (count - 1) * sizeof(u32));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PM4ItOpcode::IndexType: {
|
||||||
|
const auto* index_type = reinterpret_cast<const PM4CmdDrawIndexType*>(header);
|
||||||
|
regs.index_buffer_type.raw = index_type->raw;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PM4ItOpcode::DrawIndex2: {
|
||||||
|
const auto* draw_index = reinterpret_cast<const PM4CmdDrawIndex2*>(header);
|
||||||
|
regs.max_index_size = draw_index->max_size;
|
||||||
|
regs.index_base_address.base_addr_lo = draw_index->index_base_lo;
|
||||||
|
regs.index_base_address.base_addr_hi.Assign(draw_index->index_base_hi);
|
||||||
|
regs.num_indices = draw_index->index_count;
|
||||||
|
regs.draw_initiator = draw_index->draw_initiator;
|
||||||
|
if (rasterizer) {
|
||||||
|
const auto cmd_address = reinterpret_cast<const void*>(header);
|
||||||
|
rasterizer->ScopeMarkerBegin(fmt::format("dcb:{}:DrawIndex2", cmd_address));
|
||||||
|
rasterizer->Breadcrumb(u64(cmd_address));
|
||||||
|
rasterizer->Draw(true);
|
||||||
|
rasterizer->ScopeMarkerEnd();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PM4ItOpcode::DrawIndexOffset2: {
|
||||||
|
const auto* draw_index_off =
|
||||||
|
reinterpret_cast<const PM4CmdDrawIndexOffset2*>(header);
|
||||||
|
regs.max_index_size = draw_index_off->max_size;
|
||||||
|
regs.num_indices = draw_index_off->index_count;
|
||||||
|
regs.draw_initiator = draw_index_off->draw_initiator;
|
||||||
|
if (rasterizer) {
|
||||||
|
const auto cmd_address = reinterpret_cast<const void*>(header);
|
||||||
|
rasterizer->ScopeMarkerBegin(
|
||||||
|
fmt::format("dcb:{}:DrawIndexOffset2", cmd_address));
|
||||||
|
rasterizer->Breadcrumb(u64(cmd_address));
|
||||||
|
rasterizer->Draw(true, draw_index_off->index_offset);
|
||||||
|
rasterizer->ScopeMarkerEnd();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PM4ItOpcode::DrawIndexAuto: {
|
||||||
|
const auto* draw_index = reinterpret_cast<const PM4CmdDrawIndexAuto*>(header);
|
||||||
|
regs.num_indices = draw_index->index_count;
|
||||||
|
regs.draw_initiator = draw_index->draw_initiator;
|
||||||
|
if (rasterizer) {
|
||||||
|
const auto cmd_address = reinterpret_cast<const void*>(header);
|
||||||
|
rasterizer->ScopeMarkerBegin(fmt::format("dcb:{}:DrawIndexAuto", cmd_address));
|
||||||
|
rasterizer->Breadcrumb(u64(cmd_address));
|
||||||
|
rasterizer->Draw(false);
|
||||||
|
rasterizer->ScopeMarkerEnd();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PM4ItOpcode::DispatchDirect: {
|
||||||
|
const auto* dispatch_direct = reinterpret_cast<const PM4CmdDispatchDirect*>(header);
|
||||||
|
regs.cs_program.dim_x = dispatch_direct->dim_x;
|
||||||
|
regs.cs_program.dim_y = dispatch_direct->dim_y;
|
||||||
|
regs.cs_program.dim_z = dispatch_direct->dim_z;
|
||||||
|
regs.cs_program.dispatch_initiator = dispatch_direct->dispatch_initiator;
|
||||||
|
if (rasterizer && (regs.cs_program.dispatch_initiator & 1)) {
|
||||||
|
const auto cmd_address = reinterpret_cast<const void*>(header);
|
||||||
|
rasterizer->ScopeMarkerBegin(fmt::format("dcb:{}:Dispatch", cmd_address));
|
||||||
|
rasterizer->Breadcrumb(u64(cmd_address));
|
||||||
|
rasterizer->DispatchDirect();
|
||||||
|
rasterizer->ScopeMarkerEnd();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PM4ItOpcode::NumInstances: {
|
||||||
|
const auto* num_instances = reinterpret_cast<const PM4CmdDrawNumInstances*>(header);
|
||||||
|
regs.num_instances.num_instances = num_instances->num_instances;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PM4ItOpcode::IndexBase: {
|
||||||
|
const auto* index_base = reinterpret_cast<const PM4CmdDrawIndexBase*>(header);
|
||||||
|
regs.index_base_address.base_addr_lo = index_base->addr_lo;
|
||||||
|
regs.index_base_address.base_addr_hi.Assign(index_base->addr_hi);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PM4ItOpcode::IndexBufferSize: {
|
||||||
|
const auto* index_size = reinterpret_cast<const PM4CmdDrawIndexBufferSize*>(header);
|
||||||
|
regs.num_indices = index_size->num_indices;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PM4ItOpcode::EventWrite: {
|
||||||
|
// const auto* event = reinterpret_cast<const PM4CmdEventWrite*>(header);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PM4ItOpcode::EventWriteEos: {
|
||||||
|
const auto* event_eos = reinterpret_cast<const PM4CmdEventWriteEos*>(header);
|
||||||
|
event_eos->SignalFence();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PM4ItOpcode::EventWriteEop: {
|
||||||
|
const auto* event_eop = reinterpret_cast<const PM4CmdEventWriteEop*>(header);
|
||||||
|
event_eop->SignalFence();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PM4ItOpcode::DmaData: {
|
||||||
|
const auto* dma_data = reinterpret_cast<const PM4DmaData*>(header);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PM4ItOpcode::WriteData: {
|
||||||
|
const auto* write_data = reinterpret_cast<const PM4CmdWriteData*>(header);
|
||||||
|
ASSERT(write_data->dst_sel.Value() == 2 || write_data->dst_sel.Value() == 5);
|
||||||
|
const u32 data_size = (header->type3.count.Value() - 2) * 4;
|
||||||
|
u64* address = write_data->Address<u64*>();
|
||||||
|
if (!write_data->wr_one_addr.Value()) {
|
||||||
|
std::memcpy(address, write_data->data, data_size);
|
||||||
|
} else {
|
||||||
|
UNREACHABLE();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PM4ItOpcode::AcquireMem: {
|
||||||
|
// const auto* acquire_mem = reinterpret_cast<PM4CmdAcquireMem*>(header);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PM4ItOpcode::WaitRegMem: {
|
||||||
|
const auto* wait_reg_mem = reinterpret_cast<const PM4CmdWaitRegMem*>(header);
|
||||||
|
// ASSERT(wait_reg_mem->engine.Value() == PM4CmdWaitRegMem::Engine::Me);
|
||||||
|
// Optimization: VO label waits are special because the emulator
|
||||||
|
// will write to the label when presentation is finished. So if
|
||||||
|
// there are no other submits to yield to we can sleep the thread
|
||||||
|
// instead and allow other tasks to run.
|
||||||
|
const u64* wait_addr = wait_reg_mem->Address<u64*>();
|
||||||
|
if (vo_port->IsVoLabel(wait_addr) && num_submits == 1) {
|
||||||
|
vo_port->WaitVoLabel([&] { return wait_reg_mem->Test(); });
|
||||||
|
}
|
||||||
|
while (!wait_reg_mem->Test()) {
|
||||||
|
mapped_queues[GfxQueueId].cs_state = regs.cs_program;
|
||||||
|
TracyFiberLeave;
|
||||||
|
co_yield {};
|
||||||
|
TracyFiberEnter(dcb_task_name);
|
||||||
|
regs.cs_program = mapped_queues[GfxQueueId].cs_state;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PM4ItOpcode::IncrementDeCounter: {
|
||||||
|
++cblock.de_count;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PM4ItOpcode::WaitOnCeCounter: {
|
||||||
|
while (cblock.ce_count <= cblock.de_count) {
|
||||||
|
TracyFiberLeave;
|
||||||
|
ce_task.handle.resume();
|
||||||
|
TracyFiberEnter(dcb_task_name);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PM4ItOpcode::PfpSyncMe: {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
UNREACHABLE_MSG("Unknown PM4 type 3 opcode {:#x} with count {}",
|
||||||
|
static_cast<u32>(opcode), count);
|
||||||
}
|
}
|
||||||
|
dcb = dcb.subspan(header->type3.NumWords() + 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PM4ItOpcode::ContextControl: {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PM4ItOpcode::ClearState: {
|
|
||||||
regs.SetDefaults();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PM4ItOpcode::SetConfigReg: {
|
|
||||||
const auto* set_data = reinterpret_cast<const PM4CmdSetData*>(header);
|
|
||||||
const auto reg_addr = ConfigRegWordOffset + set_data->reg_offset;
|
|
||||||
const auto* payload = reinterpret_cast<const u32*>(header + 2);
|
|
||||||
std::memcpy(®s.reg_array[reg_addr], payload, (count - 1) * sizeof(u32));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PM4ItOpcode::SetContextReg: {
|
|
||||||
const auto* set_data = reinterpret_cast<const PM4CmdSetData*>(header);
|
|
||||||
const auto reg_addr = ContextRegWordOffset + set_data->reg_offset;
|
|
||||||
const auto* payload = reinterpret_cast<const u32*>(header + 2);
|
|
||||||
|
|
||||||
std::memcpy(®s.reg_array[reg_addr], payload, (count - 1) * sizeof(u32));
|
|
||||||
|
|
||||||
// In the case of HW, render target memory has alignment as color block operates on
|
|
||||||
// tiles. There is no information of actual resource extents stored in CB context
|
|
||||||
// regs, so any deduction of it from slices/pitch will lead to a larger surface created.
|
|
||||||
// The same applies to the depth targets. Fortunately, the guest always sends
|
|
||||||
// a trailing NOP packet right after the context regs setup, so we can use the heuristic
|
|
||||||
// below and extract the hint to determine actual resource dims.
|
|
||||||
|
|
||||||
switch (reg_addr) {
|
|
||||||
case ContextRegs::CbColor0Base:
|
|
||||||
case ContextRegs::CbColor1Base:
|
|
||||||
case ContextRegs::CbColor2Base:
|
|
||||||
case ContextRegs::CbColor3Base:
|
|
||||||
case ContextRegs::CbColor4Base:
|
|
||||||
case ContextRegs::CbColor5Base:
|
|
||||||
case ContextRegs::CbColor6Base:
|
|
||||||
case ContextRegs::CbColor7Base: {
|
|
||||||
const auto col_buf_id = (reg_addr - ContextRegs::CbColor0Base) /
|
|
||||||
(ContextRegs::CbColor1Base - ContextRegs::CbColor0Base);
|
|
||||||
ASSERT(col_buf_id < NumColorBuffers);
|
|
||||||
|
|
||||||
const auto nop_offset = header->type3.count;
|
|
||||||
if (nop_offset == 0x0e || nop_offset == 0x0d || nop_offset == 0x0b) {
|
|
||||||
ASSERT_MSG(payload[nop_offset] == 0xc0001000,
|
|
||||||
"NOP hint is missing in CB setup sequence");
|
|
||||||
last_cb_extent[col_buf_id].raw = payload[nop_offset + 1];
|
|
||||||
} else {
|
|
||||||
last_cb_extent[col_buf_id].raw = 0;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case ContextRegs::CbColor0Cmask:
|
|
||||||
case ContextRegs::CbColor1Cmask:
|
|
||||||
case ContextRegs::CbColor2Cmask:
|
|
||||||
case ContextRegs::CbColor3Cmask:
|
|
||||||
case ContextRegs::CbColor4Cmask:
|
|
||||||
case ContextRegs::CbColor5Cmask:
|
|
||||||
case ContextRegs::CbColor6Cmask:
|
|
||||||
case ContextRegs::CbColor7Cmask: {
|
|
||||||
const auto col_buf_id = (reg_addr - ContextRegs::CbColor0Cmask) /
|
|
||||||
(ContextRegs::CbColor1Cmask - ContextRegs::CbColor0Cmask);
|
|
||||||
ASSERT(col_buf_id < NumColorBuffers);
|
|
||||||
|
|
||||||
const auto nop_offset = header->type3.count;
|
|
||||||
if (nop_offset == 0x04) {
|
|
||||||
ASSERT_MSG(payload[nop_offset] == 0xc0001000,
|
|
||||||
"NOP hint is missing in CB setup sequence");
|
|
||||||
last_cb_extent[col_buf_id].raw = payload[nop_offset + 1];
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case ContextRegs::DbZInfo: {
|
|
||||||
if (header->type3.count == 8) {
|
|
||||||
ASSERT_MSG(payload[20] == 0xc0001000,
|
|
||||||
"NOP hint is missing in DB setup sequence");
|
|
||||||
last_db_extent.raw = payload[21];
|
|
||||||
} else {
|
|
||||||
last_db_extent.raw = 0;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PM4ItOpcode::SetShReg: {
|
|
||||||
const auto* set_data = reinterpret_cast<const PM4CmdSetData*>(header);
|
|
||||||
std::memcpy(®s.reg_array[ShRegWordOffset + set_data->reg_offset], header + 2,
|
|
||||||
(count - 1) * sizeof(u32));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PM4ItOpcode::SetUconfigReg: {
|
|
||||||
const auto* set_data = reinterpret_cast<const PM4CmdSetData*>(header);
|
|
||||||
std::memcpy(®s.reg_array[UconfigRegWordOffset + set_data->reg_offset], header + 2,
|
|
||||||
(count - 1) * sizeof(u32));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PM4ItOpcode::IndexType: {
|
|
||||||
const auto* index_type = reinterpret_cast<const PM4CmdDrawIndexType*>(header);
|
|
||||||
regs.index_buffer_type.raw = index_type->raw;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PM4ItOpcode::DrawIndex2: {
|
|
||||||
const auto* draw_index = reinterpret_cast<const PM4CmdDrawIndex2*>(header);
|
|
||||||
regs.max_index_size = draw_index->max_size;
|
|
||||||
regs.index_base_address.base_addr_lo = draw_index->index_base_lo;
|
|
||||||
regs.index_base_address.base_addr_hi.Assign(draw_index->index_base_hi);
|
|
||||||
regs.num_indices = draw_index->index_count;
|
|
||||||
regs.draw_initiator = draw_index->draw_initiator;
|
|
||||||
if (rasterizer) {
|
|
||||||
const auto cmd_address = reinterpret_cast<const void*>(header);
|
|
||||||
rasterizer->ScopeMarkerBegin(fmt::format("dcb:{}:DrawIndex2", cmd_address));
|
|
||||||
rasterizer->Breadcrumb(u64(cmd_address));
|
|
||||||
rasterizer->Draw(true);
|
|
||||||
rasterizer->ScopeMarkerEnd();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PM4ItOpcode::DrawIndexOffset2: {
|
|
||||||
const auto* draw_index_off = reinterpret_cast<const PM4CmdDrawIndexOffset2*>(header);
|
|
||||||
regs.max_index_size = draw_index_off->max_size;
|
|
||||||
regs.num_indices = draw_index_off->index_count;
|
|
||||||
regs.draw_initiator = draw_index_off->draw_initiator;
|
|
||||||
if (rasterizer) {
|
|
||||||
const auto cmd_address = reinterpret_cast<const void*>(header);
|
|
||||||
rasterizer->ScopeMarkerBegin(fmt::format("dcb:{}:DrawIndexOffset2", cmd_address));
|
|
||||||
rasterizer->Breadcrumb(u64(cmd_address));
|
|
||||||
rasterizer->Draw(true, draw_index_off->index_offset);
|
|
||||||
rasterizer->ScopeMarkerEnd();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PM4ItOpcode::DrawIndexAuto: {
|
|
||||||
const auto* draw_index = reinterpret_cast<const PM4CmdDrawIndexAuto*>(header);
|
|
||||||
regs.num_indices = draw_index->index_count;
|
|
||||||
regs.draw_initiator = draw_index->draw_initiator;
|
|
||||||
if (rasterizer) {
|
|
||||||
const auto cmd_address = reinterpret_cast<const void*>(header);
|
|
||||||
rasterizer->ScopeMarkerBegin(fmt::format("dcb:{}:DrawIndexAuto", cmd_address));
|
|
||||||
rasterizer->Breadcrumb(u64(cmd_address));
|
|
||||||
rasterizer->Draw(false);
|
|
||||||
rasterizer->ScopeMarkerEnd();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PM4ItOpcode::DispatchDirect: {
|
|
||||||
const auto* dispatch_direct = reinterpret_cast<const PM4CmdDispatchDirect*>(header);
|
|
||||||
regs.cs_program.dim_x = dispatch_direct->dim_x;
|
|
||||||
regs.cs_program.dim_y = dispatch_direct->dim_y;
|
|
||||||
regs.cs_program.dim_z = dispatch_direct->dim_z;
|
|
||||||
regs.cs_program.dispatch_initiator = dispatch_direct->dispatch_initiator;
|
|
||||||
if (rasterizer && (regs.cs_program.dispatch_initiator & 1)) {
|
|
||||||
const auto cmd_address = reinterpret_cast<const void*>(header);
|
|
||||||
rasterizer->ScopeMarkerBegin(fmt::format("dcb:{}:Dispatch", cmd_address));
|
|
||||||
rasterizer->Breadcrumb(u64(cmd_address));
|
|
||||||
rasterizer->DispatchDirect();
|
|
||||||
rasterizer->ScopeMarkerEnd();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PM4ItOpcode::NumInstances: {
|
|
||||||
const auto* num_instances = reinterpret_cast<const PM4CmdDrawNumInstances*>(header);
|
|
||||||
regs.num_instances.num_instances = num_instances->num_instances;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PM4ItOpcode::IndexBase: {
|
|
||||||
const auto* index_base = reinterpret_cast<const PM4CmdDrawIndexBase*>(header);
|
|
||||||
regs.index_base_address.base_addr_lo = index_base->addr_lo;
|
|
||||||
regs.index_base_address.base_addr_hi.Assign(index_base->addr_hi);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PM4ItOpcode::IndexBufferSize: {
|
|
||||||
const auto* index_size = reinterpret_cast<const PM4CmdDrawIndexBufferSize*>(header);
|
|
||||||
regs.num_indices = index_size->num_indices;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PM4ItOpcode::EventWrite: {
|
|
||||||
// const auto* event = reinterpret_cast<const PM4CmdEventWrite*>(header);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PM4ItOpcode::EventWriteEos: {
|
|
||||||
const auto* event_eos = reinterpret_cast<const PM4CmdEventWriteEos*>(header);
|
|
||||||
event_eos->SignalFence();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PM4ItOpcode::EventWriteEop: {
|
|
||||||
const auto* event_eop = reinterpret_cast<const PM4CmdEventWriteEop*>(header);
|
|
||||||
event_eop->SignalFence();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PM4ItOpcode::DmaData: {
|
|
||||||
const auto* dma_data = reinterpret_cast<const PM4DmaData*>(header);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PM4ItOpcode::WriteData: {
|
|
||||||
const auto* write_data = reinterpret_cast<const PM4CmdWriteData*>(header);
|
|
||||||
ASSERT(write_data->dst_sel.Value() == 2 || write_data->dst_sel.Value() == 5);
|
|
||||||
const u32 data_size = (header->type3.count.Value() - 2) * 4;
|
|
||||||
u64* address = write_data->Address<u64*>();
|
|
||||||
if (!write_data->wr_one_addr.Value()) {
|
|
||||||
std::memcpy(address, write_data->data, data_size);
|
|
||||||
} else {
|
|
||||||
UNREACHABLE();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PM4ItOpcode::AcquireMem: {
|
|
||||||
// const auto* acquire_mem = reinterpret_cast<PM4CmdAcquireMem*>(header);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PM4ItOpcode::WaitRegMem: {
|
|
||||||
const auto* wait_reg_mem = reinterpret_cast<const PM4CmdWaitRegMem*>(header);
|
|
||||||
// ASSERT(wait_reg_mem->engine.Value() == PM4CmdWaitRegMem::Engine::Me);
|
|
||||||
// Optimization: VO label waits are special because the emulator
|
|
||||||
// will write to the label when presentation is finished. So if
|
|
||||||
// there are no other submits to yield to we can sleep the thread
|
|
||||||
// instead and allow other tasks to run.
|
|
||||||
const u64* wait_addr = wait_reg_mem->Address<u64*>();
|
|
||||||
if (vo_port->IsVoLabel(wait_addr) && num_submits == 1) {
|
|
||||||
vo_port->WaitVoLabel([&] { return wait_reg_mem->Test(); });
|
|
||||||
}
|
|
||||||
while (!wait_reg_mem->Test()) {
|
|
||||||
mapped_queues[GfxQueueId].cs_state = regs.cs_program;
|
|
||||||
TracyFiberLeave;
|
|
||||||
co_yield {};
|
|
||||||
TracyFiberEnter(dcb_task_name);
|
|
||||||
regs.cs_program = mapped_queues[GfxQueueId].cs_state;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PM4ItOpcode::IncrementDeCounter: {
|
|
||||||
++cblock.de_count;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PM4ItOpcode::WaitOnCeCounter: {
|
|
||||||
while (cblock.ce_count <= cblock.de_count) {
|
|
||||||
TracyFiberLeave;
|
|
||||||
ce_task.handle.resume();
|
|
||||||
TracyFiberEnter(dcb_task_name);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PM4ItOpcode::PfpSyncMe: {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
UNREACHABLE_MSG("Unknown PM4 type 3 opcode {:#x} with count {}",
|
|
||||||
static_cast<u32>(opcode), count);
|
|
||||||
}
|
|
||||||
dcb = dcb.subspan(header->type3.NumWords() + 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ce_task.handle) {
|
if (ce_task.handle) {
|
||||||
|
@ -568,9 +580,43 @@ Liverpool::Task Liverpool::ProcessCompute(std::span<const u32> acb, int vqid) {
|
||||||
TracyFiberLeave;
|
TracyFiberLeave;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::pair<std::span<const u32>, std::span<const u32>> Liverpool::CopyCmdBuffers(
|
||||||
|
std::span<const u32> dcb, std::span<const u32> ccb) {
|
||||||
|
auto& queue = mapped_queues[GfxQueueId];
|
||||||
|
|
||||||
|
queue.dcb_buffer.resize(
|
||||||
|
std::max(queue.dcb_buffer.size(), queue.dcb_buffer_offset + dcb.size()));
|
||||||
|
queue.ccb_buffer.resize(
|
||||||
|
std::max(queue.ccb_buffer.size(), queue.ccb_buffer_offset + ccb.size()));
|
||||||
|
|
||||||
|
u32 prev_dcb_buffer_offset = queue.dcb_buffer_offset;
|
||||||
|
u32 prev_ccb_buffer_offset = queue.ccb_buffer_offset;
|
||||||
|
if (!dcb.empty()) {
|
||||||
|
std::memcpy(queue.dcb_buffer.data() + queue.dcb_buffer_offset, dcb.data(),
|
||||||
|
dcb.size_bytes());
|
||||||
|
queue.dcb_buffer_offset += dcb.size();
|
||||||
|
dcb = std::span<const u32>{queue.dcb_buffer.begin() + prev_dcb_buffer_offset,
|
||||||
|
queue.dcb_buffer.begin() + queue.dcb_buffer_offset};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ccb.empty()) {
|
||||||
|
std::memcpy(queue.ccb_buffer.data() + queue.ccb_buffer_offset, ccb.data(),
|
||||||
|
ccb.size_bytes());
|
||||||
|
queue.ccb_buffer_offset += ccb.size();
|
||||||
|
ccb = std::span<const u32>{queue.ccb_buffer.begin() + prev_ccb_buffer_offset,
|
||||||
|
queue.ccb_buffer.begin() + queue.ccb_buffer_offset};
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::make_pair(dcb, ccb);
|
||||||
|
}
|
||||||
|
|
||||||
void Liverpool::SubmitGfx(std::span<const u32> dcb, std::span<const u32> ccb) {
|
void Liverpool::SubmitGfx(std::span<const u32> dcb, std::span<const u32> ccb) {
|
||||||
auto& queue = mapped_queues[GfxQueueId];
|
auto& queue = mapped_queues[GfxQueueId];
|
||||||
|
|
||||||
|
if (Config::copyGPUCmdBuffers()) {
|
||||||
|
std::tie(dcb, ccb) = CopyCmdBuffers(dcb, ccb);
|
||||||
|
}
|
||||||
|
|
||||||
auto task = ProcessGraphics(dcb, ccb);
|
auto task = ProcessGraphics(dcb, ccb);
|
||||||
{
|
{
|
||||||
std::scoped_lock lock{queue.m_access};
|
std::scoped_lock lock{queue.m_access};
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <span>
|
#include <span>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
#include <vector>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
|
@ -1047,6 +1048,8 @@ public:
|
||||||
|
|
||||||
void SubmitDone() noexcept {
|
void SubmitDone() noexcept {
|
||||||
std::scoped_lock lk{submit_mutex};
|
std::scoped_lock lk{submit_mutex};
|
||||||
|
mapped_queues[GfxQueueId].ccb_buffer_offset = 0;
|
||||||
|
mapped_queues[GfxQueueId].dcb_buffer_offset = 0;
|
||||||
submit_done = true;
|
submit_done = true;
|
||||||
submit_cv.notify_one();
|
submit_cv.notify_one();
|
||||||
}
|
}
|
||||||
|
@ -1108,6 +1111,8 @@ private:
|
||||||
Handle handle;
|
Handle handle;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::pair<std::span<const u32>, std::span<const u32>> CopyCmdBuffers(std::span<const u32> dcb,
|
||||||
|
std::span<const u32> ccb);
|
||||||
Task ProcessGraphics(std::span<const u32> dcb, std::span<const u32> ccb);
|
Task ProcessGraphics(std::span<const u32> dcb, std::span<const u32> ccb);
|
||||||
Task ProcessCeUpdate(std::span<const u32> ccb);
|
Task ProcessCeUpdate(std::span<const u32> ccb);
|
||||||
Task ProcessCompute(std::span<const u32> acb, int vqid);
|
Task ProcessCompute(std::span<const u32> acb, int vqid);
|
||||||
|
@ -1116,6 +1121,10 @@ private:
|
||||||
|
|
||||||
struct GpuQueue {
|
struct GpuQueue {
|
||||||
std::mutex m_access{};
|
std::mutex m_access{};
|
||||||
|
std::atomic<u32> dcb_buffer_offset;
|
||||||
|
std::atomic<u32> ccb_buffer_offset;
|
||||||
|
std::vector<u32> dcb_buffer;
|
||||||
|
std::vector<u32> ccb_buffer;
|
||||||
std::queue<Task::Handle> submits{};
|
std::queue<Task::Handle> submits{};
|
||||||
ComputeProgram cs_state{};
|
ComputeProgram cs_state{};
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
#include <optional>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "common/types.h"
|
#include "common/types.h"
|
||||||
|
|
|
@ -94,7 +94,7 @@ GraphicsPipeline::GraphicsPipeline(const Instance& instance_, Scheduler& schedul
|
||||||
.depthClampEnable = false,
|
.depthClampEnable = false,
|
||||||
.rasterizerDiscardEnable = false,
|
.rasterizerDiscardEnable = false,
|
||||||
.polygonMode = LiverpoolToVK::PolygonMode(key.polygon_mode),
|
.polygonMode = LiverpoolToVK::PolygonMode(key.polygon_mode),
|
||||||
.cullMode = vk::CullModeFlagBits::eNone /*LiverpoolToVK::CullMode(key.cull_mode)*/,
|
.cullMode = LiverpoolToVK::CullMode(key.cull_mode),
|
||||||
.frontFace = key.front_face == Liverpool::FrontFace::Clockwise
|
.frontFace = key.front_face == Liverpool::FrontFace::Clockwise
|
||||||
? vk::FrontFace::eClockwise
|
? vk::FrontFace::eClockwise
|
||||||
: vk::FrontFace::eCounterClockwise,
|
: vk::FrontFace::eCounterClockwise,
|
||||||
|
|
|
@ -34,6 +34,7 @@ static vk::ImageType ConvertImageType(AmdGpu::ImageType type) noexcept {
|
||||||
case AmdGpu::ImageType::Color1DArray:
|
case AmdGpu::ImageType::Color1DArray:
|
||||||
return vk::ImageType::e1D;
|
return vk::ImageType::e1D;
|
||||||
case AmdGpu::ImageType::Color2D:
|
case AmdGpu::ImageType::Color2D:
|
||||||
|
case AmdGpu::ImageType::Color2DMsaa:
|
||||||
case AmdGpu::ImageType::Cube:
|
case AmdGpu::ImageType::Cube:
|
||||||
case AmdGpu::ImageType::Color2DArray:
|
case AmdGpu::ImageType::Color2DArray:
|
||||||
return vk::ImageType::e2D;
|
return vk::ImageType::e2D;
|
||||||
|
|
|
@ -17,6 +17,7 @@ vk::ImageViewType ConvertImageViewType(AmdGpu::ImageType type) {
|
||||||
case AmdGpu::ImageType::Color1DArray:
|
case AmdGpu::ImageType::Color1DArray:
|
||||||
return vk::ImageViewType::e1DArray;
|
return vk::ImageViewType::e1DArray;
|
||||||
case AmdGpu::ImageType::Color2D:
|
case AmdGpu::ImageType::Color2D:
|
||||||
|
case AmdGpu::ImageType::Color2DMsaa:
|
||||||
return vk::ImageViewType::e2D;
|
return vk::ImageViewType::e2D;
|
||||||
case AmdGpu::ImageType::Cube:
|
case AmdGpu::ImageType::Cube:
|
||||||
return vk::ImageViewType::eCube;
|
return vk::ImageViewType::eCube;
|
||||||
|
|
Loading…
Reference in New Issue