mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-09-29 11:53:24 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cabccad296 |
@@ -28,13 +28,13 @@ object NativeConfig {
|
|||||||
* Reads values in the global config file and saves them.
|
* Reads values in the global config file and saves them.
|
||||||
*/
|
*/
|
||||||
@Synchronized
|
@Synchronized
|
||||||
external fun reloadGlobalConfig()
|
external fun reloadGlobalConfig(): Boolean
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves global settings values in memory to disk.
|
* Saves global settings values in memory to disk.
|
||||||
*/
|
*/
|
||||||
@Synchronized
|
@Synchronized
|
||||||
external fun saveGlobalConfig()
|
external fun saveGlobalConfig(): Boolean
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates per-game config for the specified parameters. Must be unloaded once per-game config
|
* Creates per-game config for the specified parameters. Must be unloaded once per-game config
|
||||||
@@ -54,7 +54,7 @@ object NativeConfig {
|
|||||||
* Saves per-game settings values in memory to disk.
|
* Saves per-game settings values in memory to disk.
|
||||||
*/
|
*/
|
||||||
@Synchronized
|
@Synchronized
|
||||||
external fun savePerGameConfig()
|
external fun savePerGameConfig(): Boolean
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys the stored per-game config object. This does not save the config.
|
* Destroys the stored per-game config object. This does not save the config.
|
||||||
|
|||||||
@@ -58,13 +58,18 @@ void Java_org_yuzu_yuzu_1emu_utils_NativeConfig_unloadGlobalConfig(JNIEnv* env,
|
|||||||
global_config.reset();
|
global_config.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Java_org_yuzu_yuzu_1emu_utils_NativeConfig_reloadGlobalConfig(JNIEnv* env, jobject obj) {
|
jboolean Java_org_yuzu_yuzu_1emu_utils_NativeConfig_reloadGlobalConfig(JNIEnv* env, jobject obj) {
|
||||||
global_config->AndroidConfig::ReloadAllValues();
|
if (global_config) {
|
||||||
ResetFxChainToGlobal();
|
global_config->AndroidConfig::ReloadAllValues();
|
||||||
|
ResetFxChainToGlobal();
|
||||||
|
}
|
||||||
|
return global_config != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Java_org_yuzu_yuzu_1emu_utils_NativeConfig_saveGlobalConfig(JNIEnv* env, jobject obj) {
|
jboolean Java_org_yuzu_yuzu_1emu_utils_NativeConfig_saveGlobalConfig(JNIEnv* env, jobject obj) {
|
||||||
global_config->AndroidConfig::SaveAllValues();
|
if (global_config)
|
||||||
|
global_config->AndroidConfig::SaveAllValues();
|
||||||
|
return global_config != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Java_org_yuzu_yuzu_1emu_utils_NativeConfig_initializePerGameConfig(JNIEnv* env, jobject obj,
|
void Java_org_yuzu_yuzu_1emu_utils_NativeConfig_initializePerGameConfig(JNIEnv* env, jobject obj,
|
||||||
@@ -77,13 +82,14 @@ void Java_org_yuzu_yuzu_1emu_utils_NativeConfig_initializePerGameConfig(JNIEnv*
|
|||||||
std::make_unique<AndroidConfig>(config_file_name, Config::ConfigType::PerGameConfig);
|
std::make_unique<AndroidConfig>(config_file_name, Config::ConfigType::PerGameConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
jboolean Java_org_yuzu_yuzu_1emu_utils_NativeConfig_isPerGameConfigLoaded(JNIEnv* env,
|
jboolean Java_org_yuzu_yuzu_1emu_utils_NativeConfig_isPerGameConfigLoaded(JNIEnv* env, jobject obj) {
|
||||||
jobject obj) {
|
|
||||||
return per_game_config != nullptr;
|
return per_game_config != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Java_org_yuzu_yuzu_1emu_utils_NativeConfig_savePerGameConfig(JNIEnv* env, jobject obj) {
|
jboolean Java_org_yuzu_yuzu_1emu_utils_NativeConfig_savePerGameConfig(JNIEnv* env, jobject obj) {
|
||||||
per_game_config->AndroidConfig::SaveAllValues();
|
if (per_game_config)
|
||||||
|
per_game_config->AndroidConfig::SaveAllValues();
|
||||||
|
return per_game_config != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Java_org_yuzu_yuzu_1emu_utils_NativeConfig_unloadPerGameConfig(JNIEnv* env, jobject obj) {
|
void Java_org_yuzu_yuzu_1emu_utils_NativeConfig_unloadPerGameConfig(JNIEnv* env, jobject obj) {
|
||||||
|
|||||||
@@ -16,10 +16,6 @@
|
|||||||
#include "core/hle/service/ro/ro_types.h"
|
#include "core/hle/service/ro/ro_types.h"
|
||||||
#include "core/hle/service/server_manager.h"
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
#ifdef HAS_NCE
|
|
||||||
#include "core/arm/nce/patcher.h"
|
|
||||||
#include "core/hle/kernel/k_shared_memory.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace Service::RO {
|
namespace Service::RO {
|
||||||
|
|
||||||
@@ -390,7 +386,7 @@ public:
|
|||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result MapManualLoadModuleMemory(Kernel::KernelCore& kernel, u64* out_address, size_t context_id, u64 nro_address,
|
Result MapManualLoadModuleMemory(u64* out_address, size_t context_id, u64 nro_address,
|
||||||
u64 nro_size, u64 bss_address, u64 bss_size) {
|
u64 nro_size, u64 bss_address, u64 bss_size) {
|
||||||
// Get context.
|
// Get context.
|
||||||
ProcessContext* context = this->GetContextById(context_id);
|
ProcessContext* context = this->GetContextById(context_id);
|
||||||
@@ -425,31 +421,7 @@ public:
|
|||||||
R_TRY(context->ValidateNro(std::addressof(nro_info->module_id), std::addressof(rx_size),
|
R_TRY(context->ValidateNro(std::addressof(nro_info->module_id), std::addressof(rx_size),
|
||||||
std::addressof(ro_size), std::addressof(rw_size),
|
std::addressof(ro_size), std::addressof(rw_size),
|
||||||
nro_info->base_address, nro_size, bss_size));
|
nro_info->base_address, nro_size, bss_size));
|
||||||
#ifdef HAS_NCE
|
|
||||||
if (Settings::IsNceEnabled()) {
|
|
||||||
auto* process = context->GetProcess();
|
|
||||||
auto& memory = process->GetMemory();
|
|
||||||
|
|
||||||
std::vector<u8> image(total_size);
|
|
||||||
memory.ReadBlock(nro_info->base_address, image.data(), rx_size);
|
|
||||||
|
|
||||||
Kernel::CodeSet::Segment code{.size = static_cast<u32>(rx_size)};
|
|
||||||
Core::NCE::Patcher patch;
|
|
||||||
patch.PatchText(image, code);
|
|
||||||
patch.RelocateAndCopy(nro_info->base_address, code, image, nullptr);
|
|
||||||
|
|
||||||
const u64 patch_address = nro_info->base_address + total_size;
|
|
||||||
const size_t patch_size = patch.GetSectionSize();
|
|
||||||
constexpr auto permission = Kernel::Svc::MemoryPermission::ReadExecute;
|
|
||||||
|
|
||||||
auto* patch_memory = Kernel::KSharedMemory::Create(kernel);
|
|
||||||
R_TRY(patch_memory->Initialize(kernel, kernel.System().DeviceMemory(), process, permission, permission, patch_size));
|
|
||||||
std::memcpy(patch_memory->GetPointer(), image.data() + total_size, patch_size);
|
|
||||||
R_TRY(process->AddSharedMemory(kernel, patch_memory, patch_address, patch_size));
|
|
||||||
R_TRY(patch_memory->Map(*process, patch_address, patch_size, permission));
|
|
||||||
memory.WriteBlock(nro_info->base_address, image.data(), rx_size);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
// Set NRO perms.
|
// Set NRO perms.
|
||||||
R_TRY(SetNroPerms(context->GetProcess(), nro_info->base_address, rx_size, ro_size,
|
R_TRY(SetNroPerms(context->GetProcess(), nro_info->base_address, rx_size, ro_size,
|
||||||
rw_size + bss_size));
|
rw_size + bss_size));
|
||||||
@@ -559,7 +531,7 @@ public:
|
|||||||
Result MapManualLoadModuleMemory(Out<u64> out_load_address, ClientProcessId client_pid,
|
Result MapManualLoadModuleMemory(Out<u64> out_load_address, ClientProcessId client_pid,
|
||||||
u64 nro_address, u64 nro_size, u64 bss_address, u64 bss_size) {
|
u64 nro_address, u64 nro_size, u64 bss_address, u64 bss_size) {
|
||||||
R_TRY(m_ro->ValidateProcess(m_context_id, *client_pid));
|
R_TRY(m_ro->ValidateProcess(m_context_id, *client_pid));
|
||||||
R_RETURN(m_ro->MapManualLoadModuleMemory(system.Kernel(), out_load_address.Get(), m_context_id, nro_address,
|
R_RETURN(m_ro->MapManualLoadModuleMemory(out_load_address.Get(), m_context_id, nro_address,
|
||||||
nro_size, bss_address, bss_size));
|
nro_size, bss_address, bss_size));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user