Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
YGOmod committed Dec 15, 2024
1 parent cca9274 commit 2724160
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 32 deletions.
6 changes: 3 additions & 3 deletions app/src/main/cpp/emu_jni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ jint Fps; //!< An approximation of the amount of frames being submitted every se
jfloat AverageFrametimeMs; //!< The average time it takes for a frame to be rendered and presented in milliseconds
jfloat AverageFrametimeDeviationMs; //!< The average deviation of the average frametimes in milliseconds

std::weak_ptr<skyline::kernel::OS> OsWeak;
std::weak_ptr<skyline::gpu::GPU> GpuWeak;
std::weak_ptr<skyline::kernel::OS> OsWeak;
std::weak_ptr<skyline::gpu::GPU> GpuWeak;
std::weak_ptr<skyline::audio::Audio> AudioWeak;
std::weak_ptr<skyline::input::Input> InputWeak;
std::weak_ptr<skyline::Settings> SettingsWeak;
std::weak_ptr<skyline::Settings> SettingsWeak;

// https://cs.android.com/android/platform/superproject/+/master:bionic/libc/tzcode/bionic.cpp;l=43;drc=master;bpv=1;bpt=1
static std::string GetTimeZoneName() {
Expand Down
36 changes: 18 additions & 18 deletions app/src/main/cpp/skyline/kernel/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,25 +143,25 @@ namespace skyline {

struct {
MemoryType type;
bool permissionChangeAllowed : 1; //!< If the application can use svcSetMemoryPermission on this block
bool permissionChangeAllowed : 1; //!< If the application can use svcSetMemoryPermission on this block
bool forceReadWritableByDebugSyscalls : 1; //!< If the application can use svcWriteDebugProcessMemory on this block
bool ipcSendAllowed : 1; //!< If this block is allowed to be sent as an IPC buffer with flags=0
bool nonDeviceIpcSendAllowed : 1; //!< If this block is allowed to be sent as an IPC buffer with flags=3
bool nonSecureIpcSendAllowed : 1; //!< If this block is allowed to be sent as an IPC buffer with flags=1
bool isMappedInKernel : 1; //!< If this block is mapped in kernel
bool processPermissionChangeAllowed : 1; //!< If the application can use svcSetProcessMemoryPermission on this block
bool mapAllowed : 1; //!< If the application can use svcMapMemory on this block
bool unmapProcessCodeMemoryAllowed : 1; //!< If the application can use svcUnmapProcessCodeMemory on this block
bool transferMemoryAllowed : 1; //!< If the application can use svcCreateTransferMemory on this block
bool queryPhysicalAddressAllowed : 1; //!< If the application can use svcQueryPhysicalAddress on this block
bool mapDeviceAllowed : 1; //!< If the application can use svcMapDeviceAddressSpace or svcMapDeviceAddressSpaceByForce on this block
bool mapDeviceAlignedAllowed : 1; //!< If the application can use svcMapDeviceAddressSpaceAligned on this block
bool ipcBufferAllowed : 1; //!< If the application can use this block with svcSendSyncRequestWithUserBuffer
bool isReferenceCounted : 1; //!< If the physical memory blocks backing this region are reference counted
bool mapProcessAllowed : 1; //!< If the application can use svcMapProcessMemory on this block
bool attributeChangeAllowed : 1; //!< If the application can use svcSetMemoryAttribute on this block
bool codeMemoryAllowed : 1; //!< If the application can use svcCreateCodeMemory on this block
bool isLinearMapped : 1; //!< If this block is mapped linearly
bool ipcSendAllowed : 1; //!< If this block is allowed to be sent as an IPC buffer with flags=0
bool nonDeviceIpcSendAllowed : 1; //!< If this block is allowed to be sent as an IPC buffer with flags=3
bool nonSecureIpcSendAllowed : 1; //!< If this block is allowed to be sent as an IPC buffer with flags=1
bool isMappedInKernel : 1; //!< If this block is mapped in kernel
bool processPermissionChangeAllowed : 1; //!< If the application can use svcSetProcessMemoryPermission on this block
bool mapAllowed : 1; //!< If the application can use svcMapMemory on this block
bool unmapProcessCodeMemoryAllowed : 1; //!< If the application can use svcUnmapProcessCodeMemory on this block
bool transferMemoryAllowed : 1; //!< If the application can use svcCreateTransferMemory on this block
bool queryPhysicalAddressAllowed : 1; //!< If the application can use svcQueryPhysicalAddress on this block
bool mapDeviceAllowed : 1; //!< If the application can use svcMapDeviceAddressSpace or svcMapDeviceAddressSpaceByForce on this block
bool mapDeviceAlignedAllowed : 1; //!< If the application can use svcMapDeviceAddressSpaceAligned on this block
bool ipcBufferAllowed : 1; //!< If the application can use this block with svcSendSyncRequestWithUserBuffer
bool isReferenceCounted : 1; //!< If the physical memory blocks backing this region are reference counted
bool mapProcessAllowed : 1; //!< If the application can use svcMapProcessMemory on this block
bool attributeChangeAllowed : 1; //!< If the application can use svcSetMemoryAttribute on this block
bool codeMemoryAllowed : 1; //!< If the application can use svcCreateCodeMemory on this block
bool isLinearMapped : 1; //!< If this block is mapped linearly
};
u32 value;
};
Expand Down
17 changes: 12 additions & 5 deletions app/src/main/cpp/skyline/kernel/svc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -960,8 +960,20 @@ namespace skyline::kernel::svc {
// 6.0.0+
TotalMemoryAvailableWithoutSystemResource = 21,
TotalMemoryUsageWithoutSystemResource = 22,
/*
// 9.0.0+
IsApplication = 23,
// 11.0.0+
FreeThreadCount = 24,
// 12.0.1
ThreadTickCount = 25,
// 14.0.0+
IsSvcPermitted = 26,
// 16.0.0+
IoRegionHint = 27,
// 18.0.0+
AliasRegionExtraSize = 28,
*/
};

InfoState info{static_cast<u32>(ctx.w1)};
Expand Down Expand Up @@ -1056,11 +1068,6 @@ namespace skyline::kernel::svc {
case InfoState::UserExceptionContextAddr:
out = state.process->memory.TranslateHostAddress(state.process->tlsExceptionContext);
break;

case InfoState::AliasRegionExtraSize:
out = 0; // We stub it for now
break;

default:
LOGW("Unimplemented case ID0: {}, ID1: {}", static_cast<u32>(info), id1);
ctx.w0 = result::InvalidEnumValue;
Expand Down
15 changes: 10 additions & 5 deletions app/src/main/cpp/skyline/loader/nsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,24 @@ namespace skyline::loader {
programNca = std::move(nca);
else if (nca.contentType == vfs::NcaContentType::Control && nca.romFs != nullptr)
controlNca = std::move(nca);
else if (nca.contentType == vfs::NcaContentType::Meta)
metaNca = std::move(nca);
} catch (const loader_exception &e) {
throw loader_exception(e.error);
} catch (const std::exception &e) {
continue;
}
}

if (!programNca || !controlNca)
throw exception("Incomplete NSP file");
if (programNca)
romFs = programNca->romFs;

romFs = programNca->romFs;
controlRomFs = std::make_shared<vfs::RomFileSystem>(controlNca->romFs);
nacp.emplace(controlRomFs->OpenFile("control.nacp"));
if (controlNca) {
controlRomFs = std::make_shared<vfs::RomFileSystem>(controlNca->romFs);
nacp.emplace(controlRomFs->OpenFile("control.nacp"));
}
if (metaNca)
cnmt = vfs::CNMT(metaNca->cnmt);
}

void *NspLoader::LoadProcessData(const std::shared_ptr<kernel::type::KProcess> &process, const DeviceState &state) {
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/cpp/skyline/loader/xci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ namespace skyline::loader {
programNca = std::move(nca);
else if (nca.contentType == vfs::NcaContentType::Control && nca.romFs != nullptr)
controlNca = std::move(nca);
else if (nca.contentType == vfs::NcaContentType::Meta)
metaNca = std::move(nca);
} catch (const loader_exception &e) {
throw loader_exception(e.error);
} catch (const std::exception &e) {
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/org/stratoemu/strato/KeyReader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ object KeyReader {
}

enum class KeyType(val keyName : String, val fileName : String) {
Title("title_keys", "title.keys"), Prod("prod_keys", "prod.keys");
Title("title_keys", "title.keys"),
Prod("prod_keys", "prod.keys");

companion object {
fun parse(keyName : String) = values().first { it.keyName == keyName }
Expand Down

0 comments on commit 2724160

Please sign in to comment.