Revert "[hle] constexpr handler dispatch maps, introduce version gating (#4480)" (#4532)

This reverts commit 218c6705d9.

- [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions).
- [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md).
- [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability.

-------------------

Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4532
Reviewed-by: lizzie <lizzie@eden-emu.dev>
Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
Reviewed-by: Maufeat <sahyno1996@gmail.com>
This commit is contained in:
PavelBARABANOV
2026-10-15 08:45:15 +02:00
committed by crueter
parent 14da4482a4
commit e255c20db4
588 changed files with 14723 additions and 12534 deletions
+165 -6
View File
@@ -8,22 +8,181 @@
namespace Service::SPL {
SPL::SPL(Core::System& system_, std::shared_ptr<Module> module_) : Interface(system_, std::move(module_), "spl:") {}
SPL::SPL(Core::System& system_, std::shared_ptr<Module> module_)
: Interface(system_, std::move(module_), "spl:") {
// clang-format off
static const FunctionInfo functions[] = {
{0, &SPL::GetConfig, "GetConfig"},
{1, &SPL::ModularExponentiate, "ModularExponentiate"},
{5, &SPL::SetConfig, "SetConfig"},
{7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"},
{11, &SPL::IsDevelopment, "IsDevelopment"},
{24, &SPL::SetBootReason, "SetBootReason"},
{25, &SPL::GetBootReason, "GetBootReason"},
};
// clang-format on
RegisterHandlers(functions);
}
SPL::~SPL() = default;
SPL_MIG::SPL_MIG(Core::System& system_, std::shared_ptr<Module> module_) : Interface(system_, std::move(module_), "spl:mig") {}
SPL_MIG::SPL_MIG(Core::System& system_, std::shared_ptr<Module> module_)
: Interface(system_, std::move(module_), "spl:mig") {
// clang-format off
static const FunctionInfo functions[] = {
{0, &SPL::GetConfig, "GetConfig"},
{1, &SPL::ModularExponentiate, "ModularExponentiate"},
{2, &SPL::GenerateAesKek, "GenerateAesKek"},
{3, nullptr, "LoadAesKey"},
{4, &SPL::GenerateAesKey, "GenerateAesKey"},
{5, &SPL::SetConfig, "SetConfig"},
{7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"},
{11, &SPL::IsDevelopment, "IsDevelopment"},
{14, nullptr, "DecryptAesKey"},
{15, nullptr, "CryptAesCtr"},
{16, nullptr, "ComputeCmac"},
{21, nullptr, "AllocateAesKeyslot"},
{22, nullptr, "DeallocateAesKeySlot"},
{23, nullptr, "GetAesKeyslotAvailableEvent"},
{24, &SPL::SetBootReason, "SetBootReason"},
{25, &SPL::GetBootReason, "GetBootReason"},
};
// clang-format on
RegisterHandlers(functions);
}
SPL_MIG::~SPL_MIG() = default;
SPL_FS::SPL_FS(Core::System& system_, std::shared_ptr<Module> module_) : Interface(system_, std::move(module_), "spl:fs") {}
SPL_FS::SPL_FS(Core::System& system_, std::shared_ptr<Module> module_)
: Interface(system_, std::move(module_), "spl:fs") {
// clang-format off
static const FunctionInfo functions[] = {
{0, &SPL::GetConfig, "GetConfig"},
{1, &SPL::ModularExponentiate, "ModularExponentiate"},
{2, nullptr, "GenerateAesKek"},
{3, nullptr, "LoadAesKey"},
{4, nullptr, "GenerateAesKey"},
{5, &SPL::SetConfig, "SetConfig"},
{7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"},
{9, nullptr, "ImportLotusKey"},
{10, nullptr, "DecryptLotusMessage"},
{11, &SPL::IsDevelopment, "IsDevelopment"},
{12, nullptr, "GenerateSpecificAesKey"},
{14, nullptr, "DecryptAesKey"},
{15, nullptr, "CryptAesCtr"},
{16, nullptr, "ComputeCmac"},
{19, nullptr, "LoadTitleKey"},
{21, nullptr, "AllocateAesKeyslot"},
{22, nullptr, "DeallocateAesKeySlot"},
{23, nullptr, "GetAesKeyslotAvailableEvent"},
{24, &SPL::SetBootReason, "SetBootReason"},
{25, &SPL::GetBootReason, "GetBootReason"},
{31, nullptr, "GetPackage2Hash"},
};
// clang-format on
RegisterHandlers(functions);
}
SPL_FS::~SPL_FS() = default;
SPL_SSL::SPL_SSL(Core::System& system_, std::shared_ptr<Module> module_) : Interface(system_, std::move(module_), "spl:ssl") {}
SPL_SSL::SPL_SSL(Core::System& system_, std::shared_ptr<Module> module_)
: Interface(system_, std::move(module_), "spl:ssl") {
// clang-format off
static const FunctionInfo functions[] = {
{0, &SPL::GetConfig, "GetConfig"},
{1, &SPL::ModularExponentiate, "ModularExponentiate"},
{2, nullptr, "GenerateAesKek"},
{3, nullptr, "LoadAesKey"},
{4, nullptr, "GenerateAesKey"},
{5, &SPL::SetConfig, "SetConfig"},
{7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"},
{11, &SPL::IsDevelopment, "IsDevelopment"},
{13, nullptr, "DecryptDeviceUniqueData"},
{14, nullptr, "DecryptAesKey"},
{15, nullptr, "CryptAesCtr"},
{16, nullptr, "ComputeCmac"},
{21, nullptr, "AllocateAesKeyslot"},
{22, nullptr, "DeallocateAesKeySlot"},
{23, nullptr, "GetAesKeyslotAvailableEvent"},
{24, &SPL::SetBootReason, "SetBootReason"},
{25, &SPL::GetBootReason, "GetBootReason"},
{26, nullptr, "DecryptAndStoreSslClientCertKey"},
{27, nullptr, "ModularExponentiateWithSslClientCertKey"},
};
// clang-format on
RegisterHandlers(functions);
}
SPL_SSL::~SPL_SSL() = default;
SPL_ES::SPL_ES(Core::System& system_, std::shared_ptr<Module> module_) : Interface(system_, std::move(module_), "spl:es") {}
SPL_ES::SPL_ES(Core::System& system_, std::shared_ptr<Module> module_)
: Interface(system_, std::move(module_), "spl:es") {
// clang-format off
static const FunctionInfo functions[] = {
{0, &SPL::GetConfig, "GetConfig"},
{1, &SPL::ModularExponentiate, "ModularExponentiate"},
{2, nullptr, "GenerateAesKek"},
{3, nullptr, "LoadAesKey"},
{4, nullptr, "GenerateAesKey"},
{5, &SPL::SetConfig, "SetConfig"},
{7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"},
{11, &SPL::IsDevelopment, "IsDevelopment"},
{13, nullptr, "DecryptDeviceUniqueData"},
{14, nullptr, "DecryptAesKey"},
{15, nullptr, "CryptAesCtr"},
{16, nullptr, "ComputeCmac"},
{17, nullptr, "ImportEsKey"},
{18, nullptr, "UnwrapTitleKey"},
{20, nullptr, "PrepareEsCommonKey"},
{21, nullptr, "AllocateAesKeyslot"},
{22, nullptr, "DeallocateAesKeySlot"},
{23, nullptr, "GetAesKeyslotAvailableEvent"},
{24, &SPL::SetBootReason, "SetBootReason"},
{25, &SPL::GetBootReason, "GetBootReason"},
{28, nullptr, "DecryptAndStoreDrmDeviceCertKey"},
{29, nullptr, "ModularExponentiateWithDrmDeviceCertKey"},
{31, nullptr, "PrepareEsArchiveKey"},
{32, nullptr, "LoadPreparedAesKey"},
};
// clang-format on
RegisterHandlers(functions);
}
SPL_ES::~SPL_ES() = default;
SPL_MANU::SPL_MANU(Core::System& system_, std::shared_ptr<Module> module_) : Interface(system_, std::move(module_), "spl:manu") {}
SPL_MANU::SPL_MANU(Core::System& system_, std::shared_ptr<Module> module_)
: Interface(system_, std::move(module_), "spl:manu") {
// clang-format off
static const FunctionInfo functions[] = {
{0, &SPL::GetConfig, "GetConfig"},
{1, &SPL::ModularExponentiate, "ModularExponentiate"},
{2, nullptr, "GenerateAesKek"},
{3, nullptr, "LoadAesKey"},
{4, nullptr, "GenerateAesKey"},
{5, &SPL::SetConfig, "SetConfig"},
{7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"},
{11, &SPL::IsDevelopment, "IsDevelopment"},
{13, nullptr, "DecryptDeviceUniqueData"},
{14, nullptr, "DecryptAesKey"},
{15, nullptr, "CryptAesCtr"},
{16, nullptr, "ComputeCmac"},
{21, nullptr, "AllocateAesKeyslot"},
{22, nullptr, "DeallocateAesKeySlot"},
{23, nullptr, "GetAesKeyslotAvailableEvent"},
{24, &SPL::SetBootReason, "SetBootReason"},
{25, &SPL::GetBootReason, "GetBootReason"},
{30, nullptr, "ReencryptDeviceUniqueData"},
};
// clang-format on
RegisterHandlers(functions);
}
SPL_MANU::~SPL_MANU() = default;
} // namespace Service::SPL
-141
View File
@@ -18,177 +18,36 @@ class SPL final : public Module::Interface {
public:
explicit SPL(Core::System& system_, std::shared_ptr<Module> module_);
~SPL() override;
std::optional<FunctionInfoBase> FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, &SPL::GetConfig, "GetConfig"},
FunctionInfo{1, &SPL::ModularExponentiate, "ModularExponentiate"},
FunctionInfo{5, &SPL::SetConfig, "SetConfig"},
FunctionInfo{7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"},
FunctionInfo{11, &SPL::IsDevelopment, "IsDevelopment"},
FunctionInfo{24, &SPL::SetBootReason, "SetBootReason"},
FunctionInfo{25, &SPL::GetBootReason, "GetBootReason"}
);
};
class SPL_MIG final : public Module::Interface {
public:
explicit SPL_MIG(Core::System& system_, std::shared_ptr<Module> module_);
~SPL_MIG() override;
std::optional<FunctionInfoBase> FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, &SPL::GetConfig, "GetConfig"},
FunctionInfo{1, &SPL::ModularExponentiate, "ModularExponentiate"},
FunctionInfo{2, &SPL::GenerateAesKek, "GenerateAesKek"},
FunctionInfo{3, nullptr, "LoadAesKey"},
FunctionInfo{4, &SPL::GenerateAesKey, "GenerateAesKey"},
FunctionInfo{5, &SPL::SetConfig, "SetConfig"},
FunctionInfo{7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"},
FunctionInfo{11, &SPL::IsDevelopment, "IsDevelopment"},
FunctionInfo{14, nullptr, "DecryptAesKey"},
FunctionInfo{15, nullptr, "CryptAesCtr"},
FunctionInfo{16, nullptr, "ComputeCmac"},
FunctionInfo{21, nullptr, "AllocateAesKeyslot"},
FunctionInfo{22, nullptr, "DeallocateAesKeySlot"},
FunctionInfo{23, nullptr, "GetAesKeyslotAvailableEvent"},
FunctionInfo{24, &SPL::SetBootReason, "SetBootReason"},
FunctionInfo{25, &SPL::GetBootReason, "GetBootReason"}
);
};
class SPL_FS final : public Module::Interface {
public:
explicit SPL_FS(Core::System& system_, std::shared_ptr<Module> module_);
~SPL_FS() override;
std::optional<FunctionInfoBase> FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, &SPL::GetConfig, "GetConfig"},
FunctionInfo{1, &SPL::ModularExponentiate, "ModularExponentiate"},
FunctionInfo{2, nullptr, "GenerateAesKek"},
FunctionInfo{3, nullptr, "LoadAesKey"},
FunctionInfo{4, nullptr, "GenerateAesKey"},
FunctionInfo{5, &SPL::SetConfig, "SetConfig"},
FunctionInfo{7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"},
FunctionInfo{9, nullptr, "ImportLotusKey"},
FunctionInfo{10, nullptr, "DecryptLotusMessage"},
FunctionInfo{11, &SPL::IsDevelopment, "IsDevelopment"},
FunctionInfo{12, nullptr, "GenerateSpecificAesKey"},
FunctionInfo{14, nullptr, "DecryptAesKey"},
FunctionInfo{15, nullptr, "CryptAesCtr"},
FunctionInfo{16, nullptr, "ComputeCmac"},
FunctionInfo{19, nullptr, "LoadTitleKey"},
FunctionInfo{21, nullptr, "AllocateAesKeyslot"},
FunctionInfo{22, nullptr, "DeallocateAesKeySlot"},
FunctionInfo{23, nullptr, "GetAesKeyslotAvailableEvent"},
FunctionInfo{24, &SPL::SetBootReason, "SetBootReason"},
FunctionInfo{25, &SPL::GetBootReason, "GetBootReason"},
FunctionInfo{31, nullptr, "GetPackage2Hash"}
);
};
class SPL_SSL final : public Module::Interface {
public:
explicit SPL_SSL(Core::System& system_, std::shared_ptr<Module> module_);
~SPL_SSL() override;
std::optional<FunctionInfoBase> FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, &SPL::GetConfig, "GetConfig"},
FunctionInfo{1, &SPL::ModularExponentiate, "ModularExponentiate"},
FunctionInfo{2, nullptr, "GenerateAesKek"},
FunctionInfo{3, nullptr, "LoadAesKey"},
FunctionInfo{4, nullptr, "GenerateAesKey"},
FunctionInfo{5, &SPL::SetConfig, "SetConfig"},
FunctionInfo{7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"},
FunctionInfo{11, &SPL::IsDevelopment, "IsDevelopment"},
FunctionInfo{13, nullptr, "DecryptDeviceUniqueData"},
FunctionInfo{14, nullptr, "DecryptAesKey"},
FunctionInfo{15, nullptr, "CryptAesCtr"},
FunctionInfo{16, nullptr, "ComputeCmac"},
FunctionInfo{21, nullptr, "AllocateAesKeyslot"},
FunctionInfo{22, nullptr, "DeallocateAesKeySlot"},
FunctionInfo{23, nullptr, "GetAesKeyslotAvailableEvent"},
FunctionInfo{24, &SPL::SetBootReason, "SetBootReason"},
FunctionInfo{25, &SPL::GetBootReason, "GetBootReason"},
FunctionInfo{26, nullptr, "DecryptAndStoreSslClientCertKey"},
FunctionInfo{27, nullptr, "ModularExponentiateWithSslClientCertKey"}
);
};
class SPL_ES final : public Module::Interface {
public:
explicit SPL_ES(Core::System& system_, std::shared_ptr<Module> module_);
~SPL_ES() override;
std::optional<FunctionInfoBase> FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, &SPL::GetConfig, "GetConfig"},
FunctionInfo{1, &SPL::ModularExponentiate, "ModularExponentiate"},
FunctionInfo{2, nullptr, "GenerateAesKek"},
FunctionInfo{3, nullptr, "LoadAesKey"},
FunctionInfo{4, nullptr, "GenerateAesKey"},
FunctionInfo{5, &SPL::SetConfig, "SetConfig"},
FunctionInfo{7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"},
FunctionInfo{11, &SPL::IsDevelopment, "IsDevelopment"},
FunctionInfo{13, nullptr, "DecryptDeviceUniqueData"},
FunctionInfo{14, nullptr, "DecryptAesKey"},
FunctionInfo{15, nullptr, "CryptAesCtr"},
FunctionInfo{16, nullptr, "ComputeCmac"},
FunctionInfo{17, nullptr, "ImportEsKey"},
FunctionInfo{18, nullptr, "UnwrapTitleKey"},
FunctionInfo{20, nullptr, "PrepareEsCommonKey"},
FunctionInfo{21, nullptr, "AllocateAesKeyslot"},
FunctionInfo{22, nullptr, "DeallocateAesKeySlot"},
FunctionInfo{23, nullptr, "GetAesKeyslotAvailableEvent"},
FunctionInfo{24, &SPL::SetBootReason, "SetBootReason"},
FunctionInfo{25, &SPL::GetBootReason, "GetBootReason"},
FunctionInfo{28, nullptr, "DecryptAndStoreDrmDeviceCertKey"},
FunctionInfo{29, nullptr, "ModularExponentiateWithDrmDeviceCertKey"},
FunctionInfo{31, nullptr, "PrepareEsArchiveKey"},
FunctionInfo{32, nullptr, "LoadPreparedAesKey"}
);
};
class SPL_MANU final : public Module::Interface {
public:
explicit SPL_MANU(Core::System& system_, std::shared_ptr<Module> module_);
~SPL_MANU() override;
std::optional<FunctionInfoBase> FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, &SPL::GetConfig, "GetConfig"},
FunctionInfo{1, &SPL::ModularExponentiate, "ModularExponentiate"},
FunctionInfo{2, nullptr, "GenerateAesKek"},
FunctionInfo{3, nullptr, "LoadAesKey"},
FunctionInfo{4, nullptr, "GenerateAesKey"},
FunctionInfo{5, &SPL::SetConfig, "SetConfig"},
FunctionInfo{7, &SPL::GenerateRandomBytes, "GenerateRandomBytes"},
FunctionInfo{11, &SPL::IsDevelopment, "IsDevelopment"},
FunctionInfo{13, nullptr, "DecryptDeviceUniqueData"},
FunctionInfo{14, nullptr, "DecryptAesKey"},
FunctionInfo{15, nullptr, "CryptAesCtr"},
FunctionInfo{16, nullptr, "ComputeCmac"},
FunctionInfo{21, nullptr, "AllocateAesKeyslot"},
FunctionInfo{22, nullptr, "DeallocateAesKeySlot"},
FunctionInfo{23, nullptr, "GetAesKeyslotAvailableEvent"},
FunctionInfo{24, &SPL::SetBootReason, "SetBootReason"},
FunctionInfo{25, &SPL::GetBootReason, "GetBootReason"},
FunctionInfo{30, nullptr, "ReencryptDeviceUniqueData"}
);
};
} // namespace Service::SPL
+7 -8
View File
@@ -204,15 +204,14 @@ Result Module::Interface::GetConfigImpl(u64* out_config, ConfigItem config_item)
class CSRNG final : public Module::Interface {
public:
explicit CSRNG(Core::System& system_, std::shared_ptr<Module> module_) : Interface(system_, std::move(module_), "csrng") {}
~CSRNG() override = default;
std::optional<FunctionInfoBase> FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
explicit CSRNG(Core::System& system_, std::shared_ptr<Module> module_)
: Interface(system_, std::move(module_), "csrng") {
static const FunctionInfo functions[] = {
{0, &CSRNG::GenerateRandomBytes, "GenerateRandomBytes"},
};
RegisterHandlers(functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, &CSRNG::GenerateRandomBytes, "GenerateRandomBytes"}
);
~CSRNG() override = default;
};
void LoopProcess(Core::System& system) {
+3
View File
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
+3
View File
@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later