From eb7e5f6f0b895faa9fac79e0a4c294d24fdc78f3 Mon Sep 17 00:00:00 2001 From: Yoshi Askharoun Date: Mon, 21 Jul 2025 02:26:32 -0500 Subject: [PATCH] Don't ignore non-void returns --- libs/UIX.DecompXml/Decompiler.Script.cs | 7 +++++-- test/STYLES_decomp.uix | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libs/UIX.DecompXml/Decompiler.Script.cs b/libs/UIX.DecompXml/Decompiler.Script.cs index a8ac477..6e6d6b6 100644 --- a/libs/UIX.DecompXml/Decompiler.Script.cs +++ b/libs/UIX.DecompXml/Decompiler.Script.cs @@ -55,8 +55,6 @@ partial class Decompiler // End of function if (i + 1 != methodBody.Length) throw new InvalidOperationException("Expected end of function!"); - - break; } } @@ -186,6 +184,11 @@ partial class Decompiler ); break; + case OpCode.ReturnValue: + var returnStatement = ReturnStatement(IrisExpression.ToSyntax(stack.Pop(), _context)); + blockStack.Peek().Statements.Add(returnStatement); + break; + case not OpCode.ReturnVoid: if (!TryDecompileExpression(instruction, stack, blockStack)) { diff --git a/test/STYLES_decomp.uix b/test/STYLES_decomp.uix index e196635..d7c4cbe 100644 --- a/test/STYLES_decomp.uix +++ b/test/STYLES_decomp.uix @@ -850,12 +850,14 @@ { // Unsupported instruction: CSYM 63 ; + return source; } // TODO: JMP 170 }// Unsupported instruction: VTC 960 ; source = FrameBackgrounds.get_Item(DefaultBackgroundIndex).Value; // Unsupported instruction: CSYM 63 ; + return source; }