mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-09-12 14:48:49 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 11639bbb64 | |||
| 5e425e4e9e |
@@ -1,4 +1,4 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: 2023 yuzu Emulator Project
|
// SPDX-FileCopyrightText: 2023 yuzu Emulator Project
|
||||||
@@ -37,7 +37,7 @@ class Game(
|
|||||||
|
|
||||||
val settingsName: String
|
val settingsName: String
|
||||||
get() {
|
get() {
|
||||||
val programIdLong = programId.toLongOrNull() ?: 0L
|
val programIdLong = programId.toLong()
|
||||||
return if (programIdLong == 0L) {
|
return if (programIdLong == 0L) {
|
||||||
FileUtil.getFilename(Uri.parse(path))
|
FileUtil.getFilename(Uri.parse(path))
|
||||||
} else {
|
} else {
|
||||||
@@ -47,7 +47,7 @@ class Game(
|
|||||||
|
|
||||||
val programIdHex: String
|
val programIdHex: String
|
||||||
get() {
|
get() {
|
||||||
val programIdLong = programId.toLongOrNull() ?: 0L
|
val programIdLong = programId.toLong()
|
||||||
return if (programIdLong == 0L) {
|
return if (programIdLong == 0L) {
|
||||||
"0"
|
"0"
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "common/scope_exit.h"
|
#include "common/scope_exit.h"
|
||||||
|
#include "common/literals.h"
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
#include <sys/random.h>
|
#include <sys/random.h>
|
||||||
@@ -526,7 +527,28 @@ public:
|
|||||||
#elif defined(__OpenBSD__)
|
#elif defined(__OpenBSD__)
|
||||||
fd = shm_open_anon(O_RDWR | O_CREAT | O_EXCL | O_NOFOLLOW, 0600);
|
fd = shm_open_anon(O_RDWR | O_CREAT | O_EXCL | O_NOFOLLOW, 0600);
|
||||||
#elif defined(__FreeBSD__)
|
#elif defined(__FreeBSD__)
|
||||||
fd = shm_open(SHM_ANON, O_RDWR, 0600);
|
int n_page_sizes = getpagesizes(nullptr, 0);
|
||||||
|
if (n_page_sizes > 0) {
|
||||||
|
std::vector<size_t> page_sizes(n_page_sizes);
|
||||||
|
if (getpagesizes(page_sizes.data(), n_page_sizes) > 0) {
|
||||||
|
size_t max_size = page_sizes[0];
|
||||||
|
size_t max_index = 0;
|
||||||
|
for (size_t i = 0; i < page_sizes.size(); ++i) {
|
||||||
|
using namespace Common::Literals;
|
||||||
|
if (page_sizes[i] <= 4_GiB) {
|
||||||
|
max_size = (std::max)(max_size, page_sizes[i]);
|
||||||
|
max_index = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LOG_WARNING(Common_Memory, "using largepage of size {} #{}", max_size, max_index);
|
||||||
|
// Do not use SHM_LARGEPAGE_ALLOC_HARD, will infinitely hang on vm_reclaim on most systems
|
||||||
|
fd = shm_create_largepage(SHM_ANON, O_RDWR, max_index, SHM_LARGEPAGE_ALLOC_DEFAULT, 0600);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (fd < 0) {
|
||||||
|
LOG_WARNING(Common_Memory, "unable to force largepage: {}", strerror(errno));
|
||||||
|
fd = shm_open(SHM_ANON, O_RDWR, 0600);
|
||||||
|
}
|
||||||
#elif defined(__APPLE__) || defined(__managarm__)
|
#elif defined(__APPLE__) || defined(__managarm__)
|
||||||
// macOS doesn't have memfd_create, use anonymous temporary file
|
// macOS doesn't have memfd_create, use anonymous temporary file
|
||||||
char template_path[] = "/tmp/eden_mem_XXXXXX";
|
char template_path[] = "/tmp/eden_mem_XXXXXX";
|
||||||
@@ -558,7 +580,12 @@ public:
|
|||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
backing_base = static_cast<u8*>(mmap(nullptr, backing_size, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_NOCORE, fd, 0));
|
int map_flags =MAP_SHARED | MAP_NOCORE;
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
// Prevent dirty tracking of memfd
|
||||||
|
map_flags |= MAP_NOSYNC;
|
||||||
|
#endif
|
||||||
|
backing_base = static_cast<u8*>(mmap(nullptr, backing_size, PROT_READ | PROT_WRITE, map_flags, fd, 0));
|
||||||
}
|
}
|
||||||
if (backing_base == MAP_FAILED) {
|
if (backing_base == MAP_FAILED) {
|
||||||
LOG_CRITICAL(HW_Memory, "mmap failed: {}", strerror(errno));
|
LOG_CRITICAL(HW_Memory, "mmap failed: {}", strerror(errno));
|
||||||
|
|||||||
@@ -73,20 +73,16 @@ Result DisplayLayerManager::CreateManagedDisplayLayer(u64* out_layer_id) {
|
|||||||
R_TRY(m_manager_display_service->CreateManagedLayer(
|
R_TRY(m_manager_display_service->CreateManagedLayer(
|
||||||
out_layer_id, 0, display_id, Service::AppletResourceUserId{m_process->GetProcessId()}));
|
out_layer_id, 0, display_id, Service::AppletResourceUserId{m_process->GetProcessId()}));
|
||||||
|
|
||||||
m_manager_display_service->SetLayerVisibility(m_visible, *out_layer_id);
|
|
||||||
(void)m_display_service->GetContainer()->SetLayerStackMask(*out_layer_id,
|
|
||||||
this->GetLayerStackMask());
|
|
||||||
|
|
||||||
if (m_applet_id != AppletId::Application) {
|
if (m_applet_id != AppletId::Application) {
|
||||||
(void)m_manager_display_service->SetLayerBlending(m_blending_enabled, *out_layer_id);
|
(void)m_manager_display_service->SetLayerBlending(m_blending_enabled, *out_layer_id);
|
||||||
if (m_applet_id == AppletId::OverlayDisplay) {
|
if (m_applet_id == AppletId::OverlayDisplay) {
|
||||||
(void)m_manager_display_service->SetLayerZIndex(Overlay, *out_layer_id);
|
(void)m_manager_display_service->SetLayerZIndex(-1, *out_layer_id);
|
||||||
|
(void)m_display_service->GetContainer()->SetLayerIsOverlay(*out_layer_id, true);
|
||||||
} else {
|
} else {
|
||||||
(void)m_manager_display_service->SetLayerZIndex(Foreground, *out_layer_id);
|
(void)m_manager_display_service->SetLayerZIndex(1, *out_layer_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
(void)m_display_service->GetContainer()->SetLayerZIndex(*out_layer_id, true);
|
||||||
m_display_service->GetContainer()->SetLayerZIndex(*out_layer_id, true);
|
|
||||||
m_managed_display_layers.emplace(*out_layer_id);
|
m_managed_display_layers.emplace(*out_layer_id);
|
||||||
|
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
@@ -126,16 +122,14 @@ Result DisplayLayerManager::IsSystemBufferSharingEnabled() {
|
|||||||
|
|
||||||
// Ensure the overlay layer is visible
|
// Ensure the overlay layer is visible
|
||||||
m_manager_display_service->SetLayerVisibility(m_visible, m_system_shared_layer_id);
|
m_manager_display_service->SetLayerVisibility(m_visible, m_system_shared_layer_id);
|
||||||
(void)m_manager_display_service->SetLayerBlending(m_blending_enabled, m_system_shared_layer_id);
|
m_manager_display_service->SetLayerBlending(m_blending_enabled, m_system_shared_layer_id);
|
||||||
s32 initial_z = Foreground;
|
s32 initial_z = 1;
|
||||||
|
(void)m_display_service->GetContainer()->SetLayerZIndex(m_system_shared_layer_id, true);
|
||||||
if (m_applet_id == AppletId::OverlayDisplay) {
|
if (m_applet_id == AppletId::OverlayDisplay) {
|
||||||
initial_z = Overlay;
|
initial_z = -1;
|
||||||
(void)m_manager_display_service->SetLayerZIndex(initial_z, m_system_shared_layer_id);
|
|
||||||
(void)m_display_service->GetContainer()->SetLayerIsOverlay(m_system_shared_layer_id, true);
|
(void)m_display_service->GetContainer()->SetLayerIsOverlay(m_system_shared_layer_id, true);
|
||||||
}
|
}
|
||||||
m_manager_display_service->SetLayerZIndex(initial_z, m_system_shared_layer_id);
|
m_manager_display_service->SetLayerZIndex(initial_z, m_system_shared_layer_id);
|
||||||
m_display_service->GetContainer()->SetLayerZIndex(m_system_shared_layer_id, true);
|
|
||||||
m_managed_display_layers.emplace(m_system_shared_layer_id);
|
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -142,7 +142,6 @@ IReadOnlyApplicationControlDataInterface::IReadOnlyApplicationControlDataInterfa
|
|||||||
{10, &IReadOnlyApplicationControlDataInterface::ListApplicationIcon, "ListApplicationIcon"},
|
{10, &IReadOnlyApplicationControlDataInterface::ListApplicationIcon, "ListApplicationIcon"},
|
||||||
{13, &IReadOnlyApplicationControlDataInterface::ListApplicationTitle, "ListApplicationTitle"},
|
{13, &IReadOnlyApplicationControlDataInterface::ListApplicationTitle, "ListApplicationTitle"},
|
||||||
{19, D<&IReadOnlyApplicationControlDataInterface::GetApplicationControlData3>, "GetApplicationControlData"},
|
{19, D<&IReadOnlyApplicationControlDataInterface::GetApplicationControlData3>, "GetApplicationControlData"},
|
||||||
{23, D<&IReadOnlyApplicationControlDataInterface::GetApplicationControlData3>, "GetApplicationControlData"},
|
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
|
|||||||
@@ -274,8 +274,8 @@ std::pair<oaknut::XReg, oaknut::XReg> InlinePageTableEmitVAddrLookup(oaknut::Cod
|
|||||||
code.LDR(Xscratch0, Xpagetable, Xscratch0);
|
code.LDR(Xscratch0, Xpagetable, Xscratch0);
|
||||||
|
|
||||||
if (ctx.conf.page_table_marked_bit) {
|
if (ctx.conf.page_table_marked_bit) {
|
||||||
code.TST(Xscratch0, 1ULL << *ctx.conf.page_table_marked_bit);
|
// check for marked bit
|
||||||
code.B(NE, *fallback);
|
code.TBNZ(Xscratch0, *ctx.conf.page_table_marked_bit, *fallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx.conf.page_table_pointer_mask != 0) {
|
if (ctx.conf.page_table_pointer_mask != 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user