From 95ef5431c5a1ccd67b6e47aa8e48ad7db66efe9e Mon Sep 17 00:00:00 2001 From: EmulationEnjoyer Date: Tue, 12 Nov 2024 20:48:27 +0000 Subject: [PATCH 1/8] feat: update HLE API version constants to Horizon OS 19.0.0 - Updated Horizon OS version constants from 12.1.0 to 19.0.0. - Changed the version hash from `76b10c2dab7d3aa73fc162f8dff1655e6a21caf4` to `52971eebbba7ab9e6e23d73753aa63e0c3794b16`. - Updated `DISPLAY_TITLE` and `DISPLAY_VERSION` to reflect the new firmware version "NintendoSDK Firmware for NX 19.0.0-4.0". - Incremented Atmosphere release version constants to 1.8.0. ref: https://git.citron-emu.org/Citron/Citron/commit/3276bf8780e4d7a838efd4b5867f98ef03d30481 --- src/core/hle/api_version.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/hle/api_version.h b/src/core/hle/api_version.h index bd15606e13..bb8e51908e 100644 --- a/src/core/hle/api_version.h +++ b/src/core/hle/api_version.h @@ -11,8 +11,8 @@ namespace HLE::ApiVersion { // Horizon OS version constants. -constexpr u8 HOS_VERSION_MAJOR = 12; -constexpr u8 HOS_VERSION_MINOR = 1; +constexpr u8 HOS_VERSION_MAJOR = 19; +constexpr u8 HOS_VERSION_MINOR = 0; constexpr u8 HOS_VERSION_MICRO = 0; // NintendoSDK version constants. @@ -21,14 +21,14 @@ constexpr u8 SDK_REVISION_MAJOR = 1; constexpr u8 SDK_REVISION_MINOR = 0; constexpr char PLATFORM_STRING[] = "NX"; -constexpr char VERSION_HASH[] = "76b10c2dab7d3aa73fc162f8dff1655e6a21caf4"; -constexpr char DISPLAY_VERSION[] = "12.1.0"; -constexpr char DISPLAY_TITLE[] = "NintendoSDK Firmware for NX 12.1.0-1.0"; +constexpr char VERSION_HASH[] = "52971eebbba7ab9e6e23d73753aa63e0c3794b16"; +constexpr char DISPLAY_VERSION[] = "19.0.0"; +constexpr char DISPLAY_TITLE[] = "NintendoSDK Firmware for NX 19.0.0-4.0"; // Atmosphere version constants. constexpr u8 ATMOSPHERE_RELEASE_VERSION_MAJOR = 1; -constexpr u8 ATMOSPHERE_RELEASE_VERSION_MINOR = 0; +constexpr u8 ATMOSPHERE_RELEASE_VERSION_MINOR = 8; constexpr u8 ATMOSPHERE_RELEASE_VERSION_MICRO = 0; constexpr u32 AtmosphereTargetFirmwareWithRevision(u8 major, u8 minor, u8 micro, u8 rev) { From 05ccbaa8faadab0133a5c54a382d1bb47f7ca17d Mon Sep 17 00:00:00 2001 From: EmulationEnjoyer Date: Tue, 12 Nov 2024 20:53:26 +0000 Subject: [PATCH 2/8] Update src/audio_core/common/feature_support.h Updated AudioCore Revision from 11 -> 13 --- src/audio_core/common/feature_support.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/audio_core/common/feature_support.h b/src/audio_core/common/feature_support.h index 2eab789368..e4dd1737bd 100644 --- a/src/audio_core/common/feature_support.h +++ b/src/audio_core/common/feature_support.h @@ -13,7 +13,7 @@ #include "common/polyfill_ranges.h" namespace AudioCore { -constexpr u32 CurrentRevision = 12; // 11 +constexpr u32 CurrentRevision = 13; enum class SupportTags { CommandProcessingTimeEstimatorVersion4, From 56f062ac4db49f33ee3e2dc58b0e9d5a368e01ad Mon Sep 17 00:00:00 2001 From: EmulationEnjoyer Date: Tue, 12 Nov 2024 21:04:27 +0000 Subject: [PATCH 3/8] core: Add new error modules to ErrorModule enum - Add support for homebrew error modules to improve error handling --- src/core/hle/result.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/core/hle/result.h b/src/core/hle/result.h index 1697c5a76a..c6c9c653ba 100644 --- a/src/core/hle/result.h +++ b/src/core/hle/result.h @@ -185,16 +185,28 @@ enum class ErrorModule : u32 { Fst2 = 251, Nex = 306, NPLN = 321, + Libnx = 345, + HomebrewAbi = 346, + HomebrewLoader = 347, + LibnxNvidia = 348, + LibnxBinder = 349, TSPM = 499, DevMenu = 500, Nverpt = 520, Am_StuckMonitor = 521, Pia = 618, Eagle = 623, + LibAppletWeb = 800, + LibAppletAuth = 809, + LibAppletLns = 810, + LibAppletShop = 811, + + // NOTE(EmulationEnjoyer): Keeping old applet entry names in the case there's some lookup by name happening somewhere GeneralWebApplet = 800, WifiWebAuthApplet = 809, WhitelistedApplet = 810, ShopN = 811, + Coral = 815 }; From 154aab7c4b1986b3befee548e5b918782b4cf986 Mon Sep 17 00:00:00 2001 From: EmulationEnjoyer Date: Tue, 12 Nov 2024 21:21:24 +0000 Subject: [PATCH 4/8] feat(shader): implement geometry shader invocation info - Update EmitInvocationInfo in SPIRV backend to handle geometry shader stage ref: https://git.citron-emu.org/Citron/Citron/commit/1266fad68128b3779dcd9bbb6c5f77ec1055e2e6#diff-4cbf73a98ed4ad649a4a6f38b569bc31fcf68cf7 --- .../backend/spirv/emit_spirv_context_get_set.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp index 7a7eed4424..be65db7657 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp @@ -547,10 +547,9 @@ Id EmitInvocationInfo(EmitContext& ctx) { switch (ctx.stage) { case Stage::TessellationControl: case Stage::TessellationEval: - return ctx.OpShiftLeftLogical(ctx.U32[1], ctx.OpLoad(ctx.U32[1], ctx.patch_vertices_in), - ctx.Const(16u)); + return ctx.OpShiftLeftLogical(ctx.U32[1], ctx.OpLoad(ctx.U32[1], ctx.patch_vertices_in), ctx.Const(16u)); case Stage::Geometry: - return ctx.Const(InputTopologyVertices::vertices(ctx.runtime_info.input_topology) << 16); + return ctx.OpShiftLeftLogical(ctx.U32[1], ctx.Const(InputTopologyVertices::vertices(ctx.runtime_info.input_topology)), ctx.Const(16u)); default: LOG_WARNING(Shader, "(STUBBED) called"); return ctx.Const(0x00ff0000u); From 247f61e1f927b12d3c8a958d7441edecc515d8a2 Mon Sep 17 00:00:00 2001 From: EmulationEnjoyer Date: Tue, 12 Nov 2024 21:28:47 +0000 Subject: [PATCH 5/8] perf(VideoCore): Refactor DispatchIndirect - Added automatic safe or unsafe processing for better emulation accuracy. ref: https://git.citron-emu.org/Citron/Citron/commit/8cae0310e3aece0135e8c8e82e5fbeb379560b78 --- src/video_core/dma_pusher.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/video_core/dma_pusher.cpp b/src/video_core/dma_pusher.cpp index 9051ba0734..1db0081207 100644 --- a/src/video_core/dma_pusher.cpp +++ b/src/video_core/dma_pusher.cpp @@ -76,13 +76,7 @@ bool DmaPusher::Step() { return true; } - // Push buffer non-empty, read a word - if (dma_state.method >= MacroRegistersStart) { - if (subchannels[dma_state.subchannel]) { - subchannels[dma_state.subchannel]->current_dirty = memory_manager.IsMemoryDirty( - dma_state.dma_get, command_list_header.size * sizeof(u32)); - } - } + // Determine whether to use safe or unsafe processing const auto safe_process = [&] { Tegra::Memory::GpuGuestMemory @@ -90,6 +84,7 @@ bool DmaPusher::Step() { &command_headers); ProcessCommands(headers); }; + const auto unsafe_process = [&] { Tegra::Memory::GpuGuestMemory @@ -97,14 +92,13 @@ bool DmaPusher::Step() { &command_headers); ProcessCommands(headers); }; - if (Settings::IsGPULevelHigh()) { - if (dma_state.method >= MacroRegistersStart) { - unsafe_process(); - return true; - } + + if (Settings::IsGPULevelHigh() || (dma_state.method >= MacroRegistersStart)) { + safe_process(); return true; } + unsafe_process(); } return true; From d231c26e229eea526a1b4662ac008f589e2ef98a Mon Sep 17 00:00:00 2001 From: EmulationEnjoyer Date: Tue, 12 Nov 2024 21:32:29 +0000 Subject: [PATCH 6/8] chore(HLE): Update HLE API version constants - Updated Horizon OS version to 19.0.1 and NintendoSDK version to 1.0. Adjusted `VERSION_HASH`, `DISPLAY_VERSION`, and `DISPLAY_TITLE` to match the new firmware versions. ref: https://git.citron-emu.org/Citron/Citron/commit/fcb6444037373a76ebff8adc9e89eea2d60f7bdf --- src/core/hle/api_version.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/hle/api_version.h b/src/core/hle/api_version.h index bb8e51908e..4f75fc55c9 100644 --- a/src/core/hle/api_version.h +++ b/src/core/hle/api_version.h @@ -13,7 +13,7 @@ namespace HLE::ApiVersion { constexpr u8 HOS_VERSION_MAJOR = 19; constexpr u8 HOS_VERSION_MINOR = 0; -constexpr u8 HOS_VERSION_MICRO = 0; +constexpr u8 HOS_VERSION_MICRO = 1; // NintendoSDK version constants. @@ -21,9 +21,9 @@ constexpr u8 SDK_REVISION_MAJOR = 1; constexpr u8 SDK_REVISION_MINOR = 0; constexpr char PLATFORM_STRING[] = "NX"; -constexpr char VERSION_HASH[] = "52971eebbba7ab9e6e23d73753aa63e0c3794b16"; -constexpr char DISPLAY_VERSION[] = "19.0.0"; -constexpr char DISPLAY_TITLE[] = "NintendoSDK Firmware for NX 19.0.0-4.0"; +constexpr char VERSION_HASH[] = "835c78223df116284ef7e36e8441760edc81729c"; +constexpr char DISPLAY_VERSION[] = "19.0.1"; +constexpr char DISPLAY_TITLE[] = "NintendoSDK Firmware for NX 19.0.1-1.0"; // Atmosphere version constants. From 266eb0d31872bc487876e809ba75718e47b0bcc8 Mon Sep 17 00:00:00 2001 From: EmulationEnjoyer Date: Tue, 12 Nov 2024 21:38:09 +0000 Subject: [PATCH 7/8] arm: Skip duplicate consecutive addresses in backtrace output ref: https://git.citron-emu.org/Citron/Citron/commit/aa56430f2a3179068f77b865d4fd0179aa5cc4c4 --- src/core/arm/arm_interface.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/core/arm/arm_interface.cpp b/src/core/arm/arm_interface.cpp index 5dc7e5d59d..34acec9ebf 100644 --- a/src/core/arm/arm_interface.cpp +++ b/src/core/arm/arm_interface.cpp @@ -14,13 +14,22 @@ void ArmInterface::LogBacktrace(Kernel::KProcess* process) const { this->GetContext(ctx); LOG_ERROR(Core_ARM, "Backtrace, sp={:016X}, pc={:016X}", ctx.sp, ctx.pc); - LOG_ERROR(Core_ARM, "{:20}{:20}{:20}{:20}{}", "Module Name", "Address", "Original Address", - "Offset", "Symbol"); + LOG_ERROR(Core_ARM, "{:20}{:20}{:20}{:20}{}", "Module Name", "Address", "Original Address", "Offset", "Symbol"); LOG_ERROR(Core_ARM, ""); + const auto backtrace = GetBacktraceFromContext(process, ctx); + u64 last_address = 0; + for (const auto& entry : backtrace) { + + // Skip duplicate consecutive addresses + if (entry.address == last_address) + continue; + LOG_ERROR(Core_ARM, "{:20}{:016X} {:016X} {:016X} {}", entry.module, entry.address, entry.original_address, entry.offset, entry.name); + + last_address = entry.address; } } From bb142c965770e0f66eac5c7682defc7f26347a43 Mon Sep 17 00:00:00 2001 From: EmulationEnjoyer Date: Tue, 12 Nov 2024 21:49:49 +0000 Subject: [PATCH 8/8] shader/recompiler: Revert NVN storage buffer bias range - Return to original NVN bias values which better cover the full range of storage buffer accesses: - offset_begin: 0x110 -> 0x100 - offset_end: 0x610 -> 0x700 The wider range ensures we catch all valid storage buffer accesses while maintaining the same alignment requirements. ref: https://git.citron-emu.org/Citron/Citron/commit/2564e721df8b11e81df66c3fd5b04ae760e9550b --- .../ir_opt/global_memory_to_storage_buffer_pass.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shader_recompiler/ir_opt/global_memory_to_storage_buffer_pass.cpp b/src/shader_recompiler/ir_opt/global_memory_to_storage_buffer_pass.cpp index 0cea799455..2d4feca02c 100644 --- a/src/shader_recompiler/ir_opt/global_memory_to_storage_buffer_pass.cpp +++ b/src/shader_recompiler/ir_opt/global_memory_to_storage_buffer_pass.cpp @@ -372,8 +372,8 @@ void CollectStorageBuffers(IR::Block& block, IR::Inst& inst, StorageInfo& info) // avoid getting false positives static constexpr Bias nvn_bias{ .index = 0, - .offset_begin = 0x110, - .offset_end = 0x610, + .offset_begin = 0x100, + .offset_end = 0x700, .alignment = 16, }; // Track the low address of the instruction