This commit is contained in:
2024-10-01 01:07:16 +08:00
parent 0c34f29c51
commit 46d9e3fda0
475 changed files with 9031 additions and 855 deletions

View File

@@ -517,7 +517,7 @@ public class DataTypeWriter {
this.writer.write(EOL);
this.writer.write(EOL);
} else {
this.writer.write("typedef enum " + enumName + "_ {");
this.writer.write("enum " + enumName + " {");
String description = enumm.getDescription();
if (description != null && description.length() != 0) {
var10000 = this.writer;
@@ -549,7 +549,7 @@ public class DataTypeWriter {
this.writer.write(EOL);
}
this.writer.write("} " + enumName + ";");
this.writer.write("};");
this.writer.write(EOL);
this.writer.write(EOL);
}

View File

@@ -100,10 +100,14 @@ public class FunctionDatabase {
entries.add(entry);
}
public void applyDefaultFilters() throws Exception {
public void applyDefaultFilters(boolean rebuildAllGlobals) throws Exception {
GlobalDumper globalDumper = new GlobalDumper(script);
FunctionDumper dumper = new FunctionDumper(script, globalDumper);
if (rebuildAllGlobals) {
globalDumper.removeGlobalManifest();
}
boolean madeAnyChanges = false;
// Create a hash map to store symbol names
@@ -142,6 +146,10 @@ public class FunctionDatabase {
boolean pendingDelete = false;
boolean pendingRegenerate = false;
if (rebuildAllGlobals) {
pendingRegenerate = true;
}
// Remove CRT and other blacklisted functions
if (function == null || !dumper.isValidFunction(function)) {
// Remove the file
@@ -183,11 +191,13 @@ public class FunctionDatabase {
for (Dependency dependency : entry.dependencies) {
Function depFunction = script.getFunctionAt(dependency.address);
if (depFunction == null) {
script.println("Dependency not found: " + dependency.name + " at " + dependency.address + " in " + entry.file);
script.println(
"Dependency not found: " + dependency.name + " at " + dependency.address + " in " + entry.file);
pendingRegenerate = true;
} else if (!dumper.isValidFunction(depFunction) || !depFunction.getName().equals(dependency.name)) {
script
.println("Invalid dependency: " + dependency.name + " at " + dependency.address + " in " + entry.file + " should be " + dependency.name);
.println("Invalid dependency: " + dependency.name + " at " + dependency.address + " in " + entry.file
+ " should be " + dependency.name);
pendingRegenerate = true;
}
}

View File

@@ -56,6 +56,12 @@ public class GlobalDumper {
manifestFile = new File(RecompileConfig.INSTANCE.outputDir, "globals.txt");
}
public void removeGlobalManifest() {
if (manifestFile.exists()) {
manifestFile.delete();
}
}
public boolean loadGlobalManifest() throws Exception {
// Globals are stored in the format of
// <address> || <name> || <type>
@@ -117,7 +123,8 @@ public class GlobalDumper {
script.println("WARNING: Missing type for global: " + sym.getName() + " at " + addr);
return;
}
// script.println("Global: " + addr + " - " + sym.getName() + " - " + dt.getDisplayName());
// script.println("Global: " + addr + " - " + sym.getName() + " - " +
// dt.getDisplayName());
globalAddrs.put(addr, new GlobalRec(addr, sym.getName(), dt));
}
@@ -238,8 +245,11 @@ public class GlobalDumper {
throw new Exception("Failed to delete backup file: " + backupFile + ", globals will not be saved!");
}
}
if (!manifestFile.renameTo(backupFile))
throw new Exception("Failed to rename manifest file: " + manifestFile + ", globals will not be saved!");
if (manifestFile.exists()) {
if (!manifestFile.renameTo(backupFile))
throw new Exception("Failed to rename manifest file: " + manifestFile + ", globals will not be saved!");
}
try (PrintWriter writer = new PrintWriter(manifestFile)) {
script.println("Saving global manifest to " + manifestFile);

View File

@@ -80,7 +80,7 @@ public class TypeDumper {
if (catPath.getPathElements().length > 0 && categoryPathBlacklist.contains(catPath.getPathElements()[0]))
continue;
script.println("Type: " + dt.getDisplayName() + " - CatPath: " + dt.getCategoryPath());
// script.println("Type: " + dt.getDisplayName() + " - CatPath: " + dt.getCategoryPath());
// if (dt.getName().equals("ImageBaseOffset32"))
// throw new Exception("Found: " + dt.getDisplayName() + " - " + catPath.getPathElements()[0] + " - " + dt.getClass().getSimpleName());