mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-18 11:09:56 -04:00
Port Ocarina of Time (Switch 2) to the recomp host
The NVN2 front end and the SM86 to Maxwell shader lowering (tools/xlate/AmpereLowering.cs, mesh and task stages, bindless texture pools, BRX jump tables, the NVN2 compute c0 layout) with four translator patches (0017-0020) bring the opening of the game to 58-60 fps on the Vulkan renderer. This round fixes the haze: SM86 IPA is lowered as a plain Maxwell IPA.PASS (texture coordinates were corrected for perspective twice); LDSM, TXD, both F2IP byte forms, HMMA, MOVM and HFMA2.RELU are lowered and spill mode has eight uniform register groups; conditional rendering keeps the newest counter report per address and treats a report as pending until its value is in guest memory, so occlusion tests and the depth clears around the depth copy behave; and the upscaler stand-in decodes the post pass's sRGB picture before writing the linear target. Tensor-core programs keep the stand-in unless NX2NAVI_NATIVE_TENSOR=1, because their lowering does not match the hardware yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -111,7 +111,7 @@ static void get_info(Cpu *c, uint64_t pc) {
|
||||
return;
|
||||
}
|
||||
switch (id) {
|
||||
case 0: v = 7; break; // core mask
|
||||
case 0: v = 0x3f; break; // core mask: cores 0-5 (Switch 2 application cores; see kernel.c NCORE)
|
||||
case 1: v = 0x0ffffffff0000000ull; break; // priority mask
|
||||
case 8: v = 0; break; // debugger attached
|
||||
case 10: v = 0; break; // idle tick count
|
||||
@@ -121,6 +121,9 @@ static void get_info(Cpu *c, uint64_t pc) {
|
||||
case 18: v = PROGRAM_ID; break;
|
||||
case 20: v = user_exception_context(); break; // the SDK keeps e.g. the dying message at +0x1C0
|
||||
case 23: v = 1; break;
|
||||
case 29: // region the SDK records at nnosInitialize (address, then
|
||||
case 30: v = 0; break;
|
||||
case 33: v = 0x1000; break; // VAMM control region size: mapped at 0x300000000 and made into a unit heap
|
||||
default: {
|
||||
char why[64];
|
||||
snprintf(why, sizeof why, "GetInfo id %u (handle %#x, sub id %#llx)", id, (uint32_t)c->x[2],
|
||||
@@ -197,6 +200,33 @@ static void svc_body(Cpu *c, uint32_t imm, uint64_t pc) {
|
||||
x[0] = R_OK;
|
||||
return;
|
||||
}
|
||||
{ // the SDK keeps the abort text in the user exception context: show any readable run
|
||||
const char *ctx = (const char *)(uintptr_t)user_exception_context();
|
||||
char run[161];
|
||||
int n = 0;
|
||||
for (int i = 0; i < 0x400; i++) {
|
||||
unsigned char ch = (unsigned char)ctx[i];
|
||||
if (ch >= 0x20 && ch < 0x7f) {
|
||||
if (n < 160) run[n++] = (char)ch;
|
||||
} else if (n >= 4) {
|
||||
run[n] = 0;
|
||||
rt_log("guest abort text at ctx+%#x: %s", i - n, run);
|
||||
n = 0;
|
||||
} else {
|
||||
n = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
{ // the object the aborting code was working on: its first bytes carry the state machine's byte
|
||||
uint64_t obj = c->x[19];
|
||||
if (obj && readable(obj, 32)) {
|
||||
const unsigned char *p = (const unsigned char *)(uintptr_t)obj;
|
||||
rt_log("guest abort object %#llx: %02x %02x %02x %02x %02x %02x %02x %02x "
|
||||
"%02x %02x %02x %02x %02x %02x %02x %02x", (unsigned long long)obj,
|
||||
p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7],
|
||||
p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
|
||||
}
|
||||
}
|
||||
svc_fatal(c, imm, pc, "Break (the SDK aborted)");
|
||||
}
|
||||
case 0x27: { // OutputDebugString(x0 text, x1 size)
|
||||
|
||||
Reference in New Issue
Block a user