[WIP] Fix assembler bugs

This commit is contained in:
Yoshi Askharoun
2025-01-28 15:36:23 -06:00
parent 26610d63e0
commit ac5ef6b127
8 changed files with 36 additions and 6 deletions
+1 -1
View File
@@ -73,7 +73,7 @@ public class DecompileCommand : CompilerCommandBase<DecompileCommand.Settings>
if (settings.Language == SourceLanguage.Asm)
{
foreach (var input in enumeratedInputs)
foreach (var input in enumeratedInputs.Where(f => !f.EndsWith(".uixa")))
{
try
{
+7 -1
View File
@@ -2,11 +2,17 @@
"profiles": {
"UIXC": {
"commandName": "Project",
"commandLineArgs": "compile \"D:\\Documents\\REProj\\Zune\\UIXA\\ZuneShell.dll!_DataTable.uixa\" -A ZuneShell.dll -A UIXControls.dll -A ZuneDBApi.dll -o D:\\Documents\\REProj\\Zune\\UIXA",
"commandLineArgs": "decompile C:\\Users\\jjask\\Documents\\Dump\\Zune\\ZuneShellResources -A ZuneShell.dll -A UIXControls.dll -A ZuneDBApi.dll -o C:\\Users\\jjask\\Documents\\Dump\\Zune\\ZuneShellResources_uixa -t C:\\Users\\jjask\\Documents\\Dump\\Zune\\ZuneShellResources_uixa\\_DATATABLE.uixa",
//"commandLineArgs": "compile C:\\Users\\jjask\\Documents\\Dump\\Zune\\ZuneShellResources\\CreatePassport.uixa -A ZuneShell.dll -A UIXControls.dll -A ZuneDBApi.dll -o C:\\Users\\jjask\\Documents\\Dump\\Zune",
//"commandLineArgs": "compile C:\\Users\\jjask\\Documents\\Dump\\Zune\\_DATATABLE.uixa -A ZuneShell.dll -A UIXControls.dll -A ZuneDBApi.dll -o C:\\Users\\jjask\\Documents\\Dump\\Zune",
//"commandLineArgs": "decompile C:\\Users\\jjask\\Documents\\Dump\\Zune\\ZuneShellResources\\_DATATABLE.UIB -A ZuneShell.dll -A UIXControls.dll -A ZuneDBApi.dll -o C:\\Users\\jjask\\Documents\\Dump\\Zune\\ZuneShellResources_uixa",
//"commandLineArgs": "compile \"D:\\Documents\\REProj\\Zune\\UIXA\\ZuneShell.dll!_DataTable.uixa\" -A ZuneShell.dll -A UIXControls.dll -A ZuneDBApi.dll -o D:\\Documents\\REProj\\Zune\\UIXA",
//"commandLineArgs": "compile \"D:\\Documents\\REProj\\Zune\\UIXA\\ZuneShellResources.dll!_DataTable.uixa\" -A ZuneShell.dll -A UIXControls.dll -A ZuneDBApi.dll -o D:\\Documents\\REProj\\Zune\\UIXA",
//"commandLineArgs": "decompile \"res://ZuneShellResources.dll!_DataTable.uib\" -A ZuneShell.dll -A UIXControls.dll -A ZuneDBApi.dll -o D:\\Documents\\REProj\\Zune\\UIXA",
//"commandLineArgs": "decompile \"res://ZuneShellResources.dll!TOOLTIP.uix\" -A ZuneShell.dll -A UIXControls.dll -A ZuneDBApi.dll -o D:\\Documents\\REProj\\Zune\\UIXA",
//"commandLineArgs": "compile \"D:\\Documents\\REProj\\Zune\\UIXA\\UIXControls!ComboBox.uixa\" -A ZuneShell.dll -A UIXControls.dll -A ZuneDBApi.dll -o D:\\Documents\\REProj\\Zune\\UIXA",
"workingDirectory": "C:\\Program Files\\Zune"
}
}
+10
View File
@@ -85,6 +85,16 @@ internal class AsmMarkupLoader
var type = result.FindType(typeName);
//if (type is null)
//{
// foreach (var tryResult in _importedNamespaces.Values)
// {
// type = tryResult.FindType(typeName);
// if (type is not null)
// break;
// }
//}
if (type is null)
{
ErrorManager.ReportError(qualifiedName.Line, qualifiedName.Column,
+8 -1
View File
@@ -153,10 +153,13 @@ public class Disassembler
foreach (var typeImport in _loadResult.ImportTables.TypeImports)
{
var typeName = typeImport.Name;
var uri = typeImport.Owner.Uri;
if (!_importedUris.TryGetValue(uri, out var namespacePrefix))
{
var baseNamespacePrefix = uri;
var ownerUri = uri;
var schemeLength = uri.IndexOf("://");
if (schemeLength > 0)
{
@@ -207,9 +210,13 @@ public class Disassembler
yield return new NamespaceImport(uri, namespacePrefix);
}
// Ensure that the original, un-normalized URI is saved too
if (!_importedUris.ContainsKey(ownerUri))
_importedUris.Add(ownerUri, namespacePrefix);
}
yield return new TypeImport(new(namespacePrefix, typeImport.Name));
yield return new TypeImport(new(namespacePrefix, typeName));
};
foreach (var constructorImport in _loadResult.ImportTables.ConstructorImports)
+1
View File
@@ -101,6 +101,7 @@ partial class Lexer
if (!ctorMemberTypeNameResult.WasSuccessful)
return Result.Failure<IImportDirective>(input, "Invalid constructor import", ["Expected qualified type name"]);
input = Parse.Char('.').Optional()(input).Remainder;
input = Parse.Char('(')(input).Remainder;
var ctorParameterTypesResult = Parse.Ref(() => QualifiedTypeName).DelimitedBy(Parse.Char(',').Token())(input);
+6
View File
@@ -99,6 +99,12 @@ public static partial class Lexer
}
}
// Capture arrays
var arrayMarkerResult = Parse.String("[]")(input);
input = arrayMarkerResult.Remainder;
if (arrayMarkerResult.WasSuccessful)
typeName += "[]";
QualifiedTypeName qualifiedName = new(typePrefix, typeName)
{
Line = line,
+1 -1
View File
@@ -59,7 +59,7 @@ public record ConstructorImport : ImportDirective
public IEnumerable<QualifiedTypeName> ParameterTypes { get; init; }
public override string ToString() => $"{base.ToString()} {QualifiedName}.({string.Join(", ", ParameterTypes)})";
public override string ToString() => $"{base.ToString()} {QualifiedName}({string.Join(", ", ParameterTypes)})";
}
public record MethodImport : ImportDirective
+2 -2
View File
@@ -23,8 +23,8 @@
</PropertyGroup>
<ItemGroup>
<!--<ProjectReference Include="..\..\..\ZuneShell.dll\libs\MicrosoftIris\UIX\UIX.csproj" />-->
<ProjectReference Include="..\MicrosoftIris\UIX\UIX.csproj" />
<ProjectReference Include="..\..\..\ZuneShell.dll\libs\MicrosoftIris\UIX\UIX.csproj" />
<!--<ProjectReference Include="..\MicrosoftIris\UIX\UIX.csproj" />-->
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
<PackageReference Include="Sprache" Version="2.3.1" />