android: Add cpu bakend gui toggle
This commit is contained in:
parent
9f91ba1f73
commit
8fab363237
|
@ -3,4 +3,4 @@
|
||||||
|
|
||||||
[codespell]
|
[codespell]
|
||||||
skip = ./.git,./build,./dist,./Doxyfile,./externals,./LICENSES,./src/android/app/src/main/res
|
skip = ./.git,./build,./dist,./Doxyfile,./externals,./LICENSES,./src/android/app/src/main/res
|
||||||
ignore-words-list = aci,allright,ba,canonicalizations,deques,froms,hda,inout,lod,masia,nam,nax,nd,optin,pullrequests,pullrequest,te,transfered,unstall,uscaled,vas,zink
|
ignore-words-list = aci,allright,ba,canonicalizations,deques,froms,hda,inout,lod,masia,nam,nax,nd,optin,pullrequests,pullrequest,te,transfered,unstall,uscaled,vas,zink,nce
|
||||||
|
|
|
@ -10,6 +10,7 @@ enum class IntSetting(
|
||||||
override val category: Settings.Category,
|
override val category: Settings.Category,
|
||||||
override val androidDefault: Int? = null
|
override val androidDefault: Int? = null
|
||||||
) : AbstractIntSetting {
|
) : AbstractIntSetting {
|
||||||
|
CPU_BACKEND("cpu_backend", Settings.Category.Cpu),
|
||||||
CPU_ACCURACY("cpu_accuracy", Settings.Category.Cpu),
|
CPU_ACCURACY("cpu_accuracy", Settings.Category.Cpu),
|
||||||
REGION_INDEX("region_index", Settings.Category.System),
|
REGION_INDEX("region_index", Settings.Category.System),
|
||||||
LANGUAGE_INDEX("language_index", Settings.Category.System),
|
LANGUAGE_INDEX("language_index", Settings.Category.System),
|
||||||
|
|
|
@ -77,6 +77,15 @@ abstract class SettingsItem(
|
||||||
"%"
|
"%"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
put(
|
||||||
|
SingleChoiceSetting(
|
||||||
|
IntSetting.CPU_BACKEND,
|
||||||
|
R.string.cpu_backend,
|
||||||
|
0,
|
||||||
|
R.array.cpuBackendNames,
|
||||||
|
R.array.cpuBackendValues
|
||||||
|
)
|
||||||
|
)
|
||||||
put(
|
put(
|
||||||
SingleChoiceSetting(
|
SingleChoiceSetting(
|
||||||
IntSetting.CPU_ACCURACY,
|
IntSetting.CPU_ACCURACY,
|
||||||
|
|
|
@ -269,6 +269,7 @@ class SettingsFragmentPresenter(
|
||||||
add(BooleanSetting.RENDERER_DEBUG.key)
|
add(BooleanSetting.RENDERER_DEBUG.key)
|
||||||
|
|
||||||
add(HeaderSetting(R.string.cpu))
|
add(HeaderSetting(R.string.cpu))
|
||||||
|
add(IntSetting.CPU_BACKEND.key)
|
||||||
add(IntSetting.CPU_ACCURACY.key)
|
add(IntSetting.CPU_ACCURACY.key)
|
||||||
add(BooleanSetting.CPU_DEBUG_MODE.key)
|
add(BooleanSetting.CPU_DEBUG_MODE.key)
|
||||||
add(SettingsItem.FASTMEM_COMBINED)
|
add(SettingsItem.FASTMEM_COMBINED)
|
||||||
|
|
|
@ -175,6 +175,16 @@
|
||||||
<item>2</item>
|
<item>2</item>
|
||||||
</integer-array>
|
</integer-array>
|
||||||
|
|
||||||
|
<string-array name="cpuBackendNames">
|
||||||
|
<item>@string/cpu_backend_dynarmic</item>
|
||||||
|
<item>@string/cpu_backend_nce</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<integer-array name="cpuBackendValues">
|
||||||
|
<item>0</item>
|
||||||
|
<item>1</item>
|
||||||
|
</integer-array>
|
||||||
|
|
||||||
<string-array name="cpuAccuracyNames">
|
<string-array name="cpuAccuracyNames">
|
||||||
<item>@string/auto</item>
|
<item>@string/auto</item>
|
||||||
<item>@string/cpu_accuracy_accurate</item>
|
<item>@string/cpu_accuracy_accurate</item>
|
||||||
|
|
|
@ -185,6 +185,7 @@
|
||||||
<string name="frame_limit_enable_description">Limits emulation speed to a specified percentage of normal speed.</string>
|
<string name="frame_limit_enable_description">Limits emulation speed to a specified percentage of normal speed.</string>
|
||||||
<string name="frame_limit_slider">Limit speed percent</string>
|
<string name="frame_limit_slider">Limit speed percent</string>
|
||||||
<string name="frame_limit_slider_description">Specifies the percentage to limit emulation speed. 100% is the normal speed. Values higher or lower will increase or decrease the speed limit.</string>
|
<string name="frame_limit_slider_description">Specifies the percentage to limit emulation speed. 100% is the normal speed. Values higher or lower will increase or decrease the speed limit.</string>
|
||||||
|
<string name="cpu_backend">CPU Backend</string>
|
||||||
<string name="cpu_accuracy">CPU accuracy</string>
|
<string name="cpu_accuracy">CPU accuracy</string>
|
||||||
<string name="value_with_units">%1$s%2$s</string>
|
<string name="value_with_units">%1$s%2$s</string>
|
||||||
|
|
||||||
|
@ -416,6 +417,10 @@
|
||||||
<string name="ratio_force_sixteen_ten">Force 16:10</string>
|
<string name="ratio_force_sixteen_ten">Force 16:10</string>
|
||||||
<string name="ratio_stretch">Stretch to window</string>
|
<string name="ratio_stretch">Stretch to window</string>
|
||||||
|
|
||||||
|
<!-- CPU Backend -->
|
||||||
|
<string name="cpu_backend_dynarmic">Dynarmic (Slow)</string>
|
||||||
|
<string name="cpu_backend_nce">Native code execution (NCE)</string>
|
||||||
|
|
||||||
<!-- CPU Accuracy -->
|
<!-- CPU Accuracy -->
|
||||||
<string name="cpu_accuracy_accurate">Accurate</string>
|
<string name="cpu_accuracy_accurate">Accurate</string>
|
||||||
<string name="cpu_accuracy_unsafe">Unsafe</string>
|
<string name="cpu_accuracy_unsafe">Unsafe</string>
|
||||||
|
|
|
@ -363,13 +363,13 @@ private:
|
||||||
|
|
||||||
#ifdef ARCHITECTURE_arm64
|
#ifdef ARCHITECTURE_arm64
|
||||||
|
|
||||||
uint64_t GetRandomU64() {
|
static uint64_t GetRandomU64() {
|
||||||
uint64_t ret;
|
uint64_t ret;
|
||||||
ASSERT(getrandom(&ret, sizeof(ret), 0) == 0);
|
ASSERT(getrandom(&ret, sizeof(ret), 0) == 0);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* ChooseVirtualBase(size_t virtual_size) {
|
static void* ChooseVirtualBase(size_t virtual_size) {
|
||||||
constexpr uintptr_t Map39BitSize = (1ULL << 39);
|
constexpr uintptr_t Map39BitSize = (1ULL << 39);
|
||||||
constexpr uintptr_t Map36BitSize = (1ULL << 36);
|
constexpr uintptr_t Map36BitSize = (1ULL << 36);
|
||||||
|
|
||||||
|
@ -410,7 +410,7 @@ void* ChooseVirtualBase(size_t virtual_size) {
|
||||||
return MAP_FAILED;
|
return MAP_FAILED;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void* ChooseVirtualBase(size_t virtual_size) {
|
static void* ChooseVirtualBase(size_t virtual_size) {
|
||||||
return mmap(nullptr, virtual_size, PROT_READ | PROT_WRITE,
|
return mmap(nullptr, virtual_size, PROT_READ | PROT_WRITE,
|
||||||
MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0);
|
MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,7 +159,13 @@ bool IsFastmemEnabled() {
|
||||||
static bool is_nce_enabled = false;
|
static bool is_nce_enabled = false;
|
||||||
|
|
||||||
void SetNceEnabled(bool is_39bit) {
|
void SetNceEnabled(bool is_39bit) {
|
||||||
is_nce_enabled = values.cpu_backend.GetValue() == CpuBackend::Nce && is_39bit;
|
const bool is_nce_selected = values.cpu_backend.GetValue() == CpuBackend::Nce;
|
||||||
|
is_nce_enabled = is_nce_selected && is_39bit;
|
||||||
|
if (is_nce_selected && !is_nce_enabled) {
|
||||||
|
LOG_WARNING(
|
||||||
|
Common,
|
||||||
|
"Program does not utilize 39-bit address space, unable to natively execute code");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsNceEnabled() {
|
bool IsNceEnabled() {
|
||||||
|
|
|
@ -18,7 +18,7 @@ T* LookupLibcSymbol(const char* name) {
|
||||||
UNREACHABLE_MSG("Failed to open libc!");
|
UNREACHABLE_MSG("Failed to open libc!");
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// For other operating environments, we assume the symbol is not overriden.
|
// For other operating environments, we assume the symbol is not overridden.
|
||||||
const char* base = nullptr;
|
const char* base = nullptr;
|
||||||
Common::DynamicLibrary provider(base);
|
Common::DynamicLibrary provider(base);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -129,8 +129,10 @@ AppLoader_DeconstructedRomDirectory::LoadResult AppLoader_DeconstructedRomDirect
|
||||||
}
|
}
|
||||||
metadata.Print();
|
metadata.Print();
|
||||||
|
|
||||||
// Enable NCE only for 64-bit programs.
|
// Enable NCE only for programs with 39-bit address space.
|
||||||
Settings::SetNceEnabled(metadata.Is64BitProgram());
|
const bool is_39bit =
|
||||||
|
metadata.GetAddressSpaceType() == FileSys::ProgramAddressSpaceType::Is39Bit;
|
||||||
|
Settings::SetNceEnabled(is_39bit);
|
||||||
|
|
||||||
const std::array static_modules = {"rtld", "main", "subsdk0", "subsdk1", "subsdk2",
|
const std::array static_modules = {"rtld", "main", "subsdk0", "subsdk1", "subsdk2",
|
||||||
"subsdk3", "subsdk4", "subsdk5", "subsdk6", "subsdk7",
|
"subsdk3", "subsdk4", "subsdk5", "subsdk6", "subsdk7",
|
||||||
|
|
|
@ -199,6 +199,7 @@ static bool LoadNroImpl(Core::System& system, Kernel::KProcess& process,
|
||||||
|
|
||||||
codeset.DataSegment().size += bss_size;
|
codeset.DataSegment().size += bss_size;
|
||||||
program_image.resize(static_cast<u32>(program_image.size()) + bss_size);
|
program_image.resize(static_cast<u32>(program_image.size()) + bss_size);
|
||||||
|
size_t image_size = program_image.size();
|
||||||
|
|
||||||
#ifdef ARCHITECTURE_arm64
|
#ifdef ARCHITECTURE_arm64
|
||||||
const auto& code = codeset.CodeSegment();
|
const auto& code = codeset.CodeSegment();
|
||||||
|
@ -208,7 +209,6 @@ static bool LoadNroImpl(Core::System& system, Kernel::KProcess& process,
|
||||||
|
|
||||||
// Create NCE patcher
|
// Create NCE patcher
|
||||||
Core::NCE::Patcher patch{};
|
Core::NCE::Patcher patch{};
|
||||||
size_t image_size = program_image.size();
|
|
||||||
|
|
||||||
if (Settings::IsNceEnabled()) {
|
if (Settings::IsNceEnabled()) {
|
||||||
// Patch SVCs and MRS calls in the guest code
|
// Patch SVCs and MRS calls in the guest code
|
||||||
|
|
Reference in New Issue