mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-05-27 23:47:03 +02:00
[hle, core/loader] remove hbl.nsp specific workaround
Signed-off-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
parent
9b18d0b111
commit
b515dbd5ce
9 changed files with 25 additions and 32 deletions
|
|
@ -1174,8 +1174,7 @@ KProcess::KProcess(KernelCore& kernel)
|
||||||
|
|
||||||
KProcess::~KProcess() = default;
|
KProcess::~KProcess() = default;
|
||||||
|
|
||||||
Result KProcess::LoadFromMetadata(const FileSys::ProgramMetadata& metadata, std::size_t code_size,
|
Result KProcess::LoadFromMetadata(const FileSys::ProgramMetadata& metadata, std::size_t code_size, KProcessAddress aslr_space_start, size_t aslr_space_offset) {
|
||||||
KProcessAddress aslr_space_start, size_t aslr_space_offset, bool is_hbl) {
|
|
||||||
// Create a resource limit for the process.
|
// Create a resource limit for the process.
|
||||||
const auto pool = static_cast<KMemoryManager::Pool>(metadata.GetPoolPartition());
|
const auto pool = static_cast<KMemoryManager::Pool>(metadata.GetPoolPartition());
|
||||||
const auto physical_memory_size = m_kernel.MemoryManager().GetSize(pool);
|
const auto physical_memory_size = m_kernel.MemoryManager().GetSize(pool);
|
||||||
|
|
@ -1247,7 +1246,6 @@ Result KProcess::LoadFromMetadata(const FileSys::ProgramMetadata& metadata, std:
|
||||||
aslr_space_start));
|
aslr_space_start));
|
||||||
|
|
||||||
// Assign remaining properties.
|
// Assign remaining properties.
|
||||||
m_is_hbl = is_hbl;
|
|
||||||
m_ideal_core_id = metadata.GetMainThreadCore();
|
m_ideal_core_id = metadata.GetMainThreadCore();
|
||||||
|
|
||||||
// Set up emulation context.
|
// Set up emulation context.
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,6 @@ private:
|
||||||
bool m_is_initialized : 1 = false;
|
bool m_is_initialized : 1 = false;
|
||||||
bool m_is_application : 1 = false;
|
bool m_is_application : 1 = false;
|
||||||
bool m_is_default_application_system_resource : 1 = false;
|
bool m_is_default_application_system_resource : 1 = false;
|
||||||
bool m_is_hbl : 1 = false;
|
|
||||||
bool m_is_suspended : 1 = false;
|
bool m_is_suspended : 1 = false;
|
||||||
bool m_is_immortal : 1 = false;
|
bool m_is_immortal : 1 = false;
|
||||||
bool m_is_handle_table_initialized : 1 = false;
|
bool m_is_handle_table_initialized : 1 = false;
|
||||||
|
|
@ -277,10 +276,6 @@ public:
|
||||||
return m_capabilities.CanForceDebug();
|
return m_capabilities.CanForceDebug();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsHbl() const {
|
|
||||||
return m_is_hbl;
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 GetAllocateOption() const {
|
u32 GetAllocateOption() const {
|
||||||
return m_page_table.GetAllocateOption();
|
return m_page_table.GetAllocateOption();
|
||||||
}
|
}
|
||||||
|
|
@ -514,8 +509,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Result LoadFromMetadata(const FileSys::ProgramMetadata& metadata, std::size_t code_size,
|
Result LoadFromMetadata(const FileSys::ProgramMetadata& metadata, std::size_t code_size, KProcessAddress aslr_space_start, size_t aslr_space_offset);
|
||||||
KProcessAddress aslr_space_start, size_t aslr_space_offset, bool is_hbl);
|
|
||||||
|
|
||||||
void LoadModule(CodeSet code_set, KProcessAddress base_addr);
|
void LoadModule(CodeSet code_set, KProcessAddress base_addr);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,6 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
|
@ -106,9 +109,7 @@ void Break(Core::System& system, BreakReason reason, u64 info1, u64 info2) {
|
||||||
system.CurrentPhysicalCore().LogBacktrace();
|
system.CurrentPhysicalCore().LogBacktrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool is_hbl = GetCurrentProcess(system.Kernel()).IsHbl();
|
const bool should_break = !notification_only;
|
||||||
const bool should_break = is_hbl || !notification_only;
|
|
||||||
|
|
||||||
if (system.DebuggerEnabled() && should_break) {
|
if (system.DebuggerEnabled() && should_break) {
|
||||||
auto* thread = system.Kernel().GetCurrentEmuThread();
|
auto* thread = system.Kernel().GetCurrentEmuThread();
|
||||||
system.GetDebugger().NotifyThreadStopped(thread);
|
system.GetDebugger().NotifyThreadStopped(thread);
|
||||||
|
|
|
||||||
|
|
@ -71,9 +71,10 @@ struct PatchCollection {
|
||||||
std::array<s32, 13> module_patcher_indices{};
|
std::array<s32, 13> module_patcher_indices{};
|
||||||
};
|
};
|
||||||
|
|
||||||
AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileSys::VirtualFile file_,
|
AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileSys::VirtualFile file_, bool override_update_)
|
||||||
bool override_update_)
|
: AppLoader(std::move(file_))
|
||||||
: AppLoader(std::move(file_)), override_update(override_update_), is_hbl(false) {
|
, override_update(override_update_)
|
||||||
|
{
|
||||||
const auto file_dir = file->GetContainingDirectory();
|
const auto file_dir = file->GetContainingDirectory();
|
||||||
|
|
||||||
// Title ID
|
// Title ID
|
||||||
|
|
@ -124,9 +125,11 @@ AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileSys
|
||||||
}
|
}
|
||||||
|
|
||||||
AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(
|
AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(
|
||||||
FileSys::VirtualDir directory, bool override_update_, bool is_hbl_)
|
FileSys::VirtualDir directory, bool override_update_)
|
||||||
: AppLoader(directory->GetFile("main")), dir(std::move(directory)),
|
: AppLoader(directory->GetFile("main"))
|
||||||
override_update(override_update_), is_hbl(is_hbl_) {}
|
, dir(std::move(directory))
|
||||||
|
, override_update(override_update_)
|
||||||
|
{}
|
||||||
|
|
||||||
FileType AppLoader_DeconstructedRomDirectory::IdentifyType(const FileSys::VirtualFile& dir_file) {
|
FileType AppLoader_DeconstructedRomDirectory::IdentifyType(const FileSys::VirtualFile& dir_file) {
|
||||||
if (FileSys::IsDirectoryExeFS(dir_file->GetContainingDirectory())) {
|
if (FileSys::IsDirectoryExeFS(dir_file->GetContainingDirectory())) {
|
||||||
|
|
@ -232,7 +235,7 @@ AppLoader_DeconstructedRomDirectory::LoadResult AppLoader_DeconstructedRomDirect
|
||||||
? ::Settings::values.rng_seed.GetValue() : Common::Random::Random64(0)) << 12) & 0xfff000;
|
? ::Settings::values.rng_seed.GetValue() : Common::Random::Random64(0)) << 12) & 0xfff000;
|
||||||
|
|
||||||
// Setup the process code layout
|
// Setup the process code layout
|
||||||
if (process.LoadFromMetadata(metadata, code_size, fastmem_base, aslr_offset, is_hbl).IsError()) {
|
if (process.LoadFromMetadata(metadata, code_size, fastmem_base, aslr_offset).IsError()) {
|
||||||
return {ResultStatus::ErrorUnableToParseKernelMetadata, {}};
|
return {ResultStatus::ErrorUnableToParseKernelMetadata, {}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,6 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
|
@ -22,13 +25,9 @@ namespace Loader {
|
||||||
*/
|
*/
|
||||||
class AppLoader_DeconstructedRomDirectory final : public AppLoader {
|
class AppLoader_DeconstructedRomDirectory final : public AppLoader {
|
||||||
public:
|
public:
|
||||||
explicit AppLoader_DeconstructedRomDirectory(FileSys::VirtualFile main_file,
|
explicit AppLoader_DeconstructedRomDirectory(FileSys::VirtualFile main_file, bool override_update_ = false);
|
||||||
bool override_update_ = false);
|
|
||||||
|
|
||||||
// Overload to accept exefs directory. Must contain 'main' and 'main.npdm'
|
// Overload to accept exefs directory. Must contain 'main' and 'main.npdm'
|
||||||
explicit AppLoader_DeconstructedRomDirectory(FileSys::VirtualDir directory,
|
explicit AppLoader_DeconstructedRomDirectory(FileSys::VirtualDir directory, bool override_update_ = false);
|
||||||
bool override_update_ = false,
|
|
||||||
bool is_hbl_ = false);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifies whether or not the given file is a deconstructed ROM directory.
|
* Identifies whether or not the given file is a deconstructed ROM directory.
|
||||||
|
|
@ -63,7 +62,6 @@ private:
|
||||||
std::string name;
|
std::string name;
|
||||||
u64 title_id{};
|
u64 title_id{};
|
||||||
bool override_update;
|
bool override_update;
|
||||||
bool is_hbl;
|
|
||||||
|
|
||||||
Modules modules;
|
Modules modules;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ AppLoader::LoadResult AppLoader_KIP::Load(Kernel::KProcess& process,
|
||||||
? ::Settings::values.rng_seed.GetValue() : Common::Random::Random64(0)) << 12) & 0xfff000;
|
? ::Settings::values.rng_seed.GetValue() : Common::Random::Random64(0)) << 12) & 0xfff000;
|
||||||
|
|
||||||
// Setup the process code layout
|
// Setup the process code layout
|
||||||
if (process.LoadFromMetadata(FileSys::ProgramMetadata::GetDefault(), codeset.memory.size(), 0, aslr_offset, false).IsError()) {
|
if (process.LoadFromMetadata(FileSys::ProgramMetadata::GetDefault(), codeset.memory.size(), 0, aslr_offset).IsError()) {
|
||||||
return {ResultStatus::ErrorNotInitialized, {}};
|
return {ResultStatus::ErrorNotInitialized, {}};
|
||||||
}
|
}
|
||||||
const VAddr base_address = GetInteger(process.GetEntryPoint());
|
const VAddr base_address = GetInteger(process.GetEntryPoint());
|
||||||
|
|
|
||||||
|
|
@ -247,7 +247,7 @@ static bool LoadNroImpl(Core::System& system, Kernel::KProcess& process,
|
||||||
|
|
||||||
// Setup the process code layout
|
// Setup the process code layout
|
||||||
if (process
|
if (process
|
||||||
.LoadFromMetadata(FileSys::ProgramMetadata::GetDefault(), image_size, fastmem_base, aslr_offset, false)
|
.LoadFromMetadata(FileSys::ProgramMetadata::GetDefault(), image_size, fastmem_base, aslr_offset)
|
||||||
.IsError()) {
|
.IsError()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,7 @@ AppLoader_NSP::AppLoader_NSP(FileSys::VirtualFile file_,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nsp->IsExtractedType()) {
|
if (nsp->IsExtractedType()) {
|
||||||
secondary_loader = std::make_unique<AppLoader_DeconstructedRomDirectory>(
|
secondary_loader = std::make_unique<AppLoader_DeconstructedRomDirectory>(nsp->GetExeFS(), false);
|
||||||
nsp->GetExeFS(), false, file->GetName() == "hbl.nsp");
|
|
||||||
} else {
|
} else {
|
||||||
const auto control_nca =
|
const auto control_nca =
|
||||||
nsp->GetNCA(nsp->GetProgramTitleID(), FileSys::ContentRecordType::Control);
|
nsp->GetNCA(nsp->GetProgramTitleID(), FileSys::ContentRecordType::Control);
|
||||||
|
|
|
||||||
|
|
@ -581,7 +581,7 @@ MainWindow::MainWindow(bool has_broken_vulkan)
|
||||||
} else if (should_launch_hlaunch) {
|
} else if (should_launch_hlaunch) {
|
||||||
std::filesystem::path const sd_dir = Common::FS::GetEdenPathString(Common::FS::EdenPath::SDMCDir);
|
std::filesystem::path const sd_dir = Common::FS::GetEdenPathString(Common::FS::EdenPath::SDMCDir);
|
||||||
auto const hbl_path = (sd_dir / "atmosphere" / "hbl.nsp").string();
|
auto const hbl_path = (sd_dir / "atmosphere" / "hbl.nsp").string();
|
||||||
BootGame(QString::fromStdString(hbl_path), ApplicationAppletParameters());
|
BootGame(QString::fromStdString(hbl_path), LibraryAppletParameters(0x010000000000100Dull, Service::AM::AppletId::QLaunch));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue