java-topology/defects/decaf-0001/patch/decaf-0001.patch

58 lines
2.4 KiB
Diff

# UNDF: UNDF-2026-000001077
# UNDF: UNDF-2026-XXXXXXXXX
--- a/src/libdecaf/src/ios/mcp/ios_mcp_mcp_device.cpp
+++ b/src/libdecaf/src/ios/mcp/ios_mcp_mcp_device.cpp
@@ -1,5 +1,6 @@
#include "ios_mcp_config.h"
#include "ios_mcp_enum.h"
#include "ios_mcp_mcp_device.h"
#include "ios_mcp_mcp_types.h"
#include "ios_mcp_mcp_request.h"
#include "ios_mcp_mcp_response.h"
#include "ios_mcp_mcp_thread.h"
#include "ios_mcp_title.h"
#include "cafe/libraries/cafe_hle.h"
#include "decaf_config.h"
#include "ios/ios.h"
#include "ios/ios_stackobject.h"
#include "ios/fs/ios_fs_fsa_ipc.h"
#include "ios/kernel/ios_kernel_process.h"
#include "ios/kernel/ios_kernel_resourcemanager.h"
#include "vfs/vfs_host_device.h"
#include "vfs/vfs_virtual_device.h"
#include <common/log.h>
+#include <unordered_set>
namespace ios::mcp::internal
{
@@ -89,9 +90,9 @@ MCPError
mcpGetFileLength(phys_ptr<const MCPRequestGetFileLength> request)
{
auto path = std::string { };
auto name = std::string_view { phys_addrof(request->name).get() };
if (request->fileType == MCPFileType::CafeOS) {
- if (std::find(decaf::config()->system.lle_modules.begin(),
- decaf::config()->system.lle_modules.end(),
- name) == decaf::config()->system.lle_modules.end()) {
+ const auto &lleVec = decaf::config()->system.lle_modules;
+ static const auto sLleModuleSet = std::unordered_set<std::string>(lleVec.begin(), lleVec.end());
+ if (sLleModuleSet.find(std::string(name)) == sLleModuleSet.end()) {
auto library = cafe::hle::getLibrary(name);
if (library) {
auto &rpl = library->getGeneratedRpl();
@@ -155,9 +158,9 @@ mcpLoadFile(phys_ptr<const MCPRequestLoadFile> request,
auto name = std::string_view { phys_addrof(request->name).get() };
if (request->fileType == MCPFileType::CafeOS) {
- if (std::find(decaf::config()->system.lle_modules.begin(),
- decaf::config()->system.lle_modules.end(),
- name) == decaf::config()->system.lle_modules.end()) {
+ const auto &lleVec = decaf::config()->system.lle_modules;
+ static const auto sLleModuleSet = std::unordered_set<std::string>(lleVec.begin(), lleVec.end());
+ if (sLleModuleSet.find(std::string(name)) == sLleModuleSet.end()) {
auto library = cafe::hle::getLibrary(name);
if (library) {
auto &rpl = library->getGeneratedRpl();