Make function linkage use unmangled names
This commit is contained in:
@@ -106,6 +106,13 @@ public class FunctionDumper {
|
||||
String sanitizedFunctionName = Utils.sanitizeIdentifier(function.getName());
|
||||
String fileName = sanitizedFunctionName + ".cxx";
|
||||
|
||||
// Remove the stub file, since we now use the decompiled file
|
||||
File stubFile = new File(RecompileConfig.INSTANCE.dirDecompStub, fileName);
|
||||
if (stubFile.exists()) {
|
||||
script.println("Removing function stub " + stubFile);
|
||||
stubFile.delete();
|
||||
}
|
||||
|
||||
File f0 = new File(RecompileConfig.INSTANCE.dirDecompFix, fileName);
|
||||
if (f0.exists()) {
|
||||
script.println("Func " + function.getName() + " skipped (gh_fix)");
|
||||
@@ -130,6 +137,7 @@ public class FunctionDumper {
|
||||
writer2.println("#include <gh_auto_binder.h>");
|
||||
writer2.println("#include \"../gh_global.h\"");
|
||||
writer2.println();
|
||||
writer2.println("extern \"C\" {");
|
||||
|
||||
HighFunction highFunction = decompRes.getHighFunction();
|
||||
|
||||
@@ -216,7 +224,7 @@ public class FunctionDumper {
|
||||
if (calledFunction != null) {
|
||||
if (isValidFunction(calledFunction)) {
|
||||
String proto = calledFunction.getSignature().getPrototypeString(false);
|
||||
headers.add("extern " + proto
|
||||
headers.add("" + proto
|
||||
+ "; // " + calledFunction.getEntryPoint() + " // "
|
||||
+ calledFunction.getName());
|
||||
externalFunctionCalls.add(calledFunction);
|
||||
@@ -239,16 +247,21 @@ public class FunctionDumper {
|
||||
writer2.println(header);
|
||||
}
|
||||
writer2.println();
|
||||
writer2.println("// " + function.getEntryPoint());
|
||||
writer2.print("// " + function.getEntryPoint());
|
||||
writer2.print(codeWriter.toString());
|
||||
writer2.println("}");
|
||||
writer2.println();
|
||||
}
|
||||
|
||||
// Possibly generate stubs for external functions
|
||||
for (Function externalFunction : externalFunctionCalls) {
|
||||
String sanitizedExtFunctionName = Utils.sanitizeIdentifier(externalFunction.getName());
|
||||
fileName = sanitizedExtFunctionName + ".cxx";
|
||||
File f2 = new File(RecompileConfig.INSTANCE.dirDecompFix, fileName);
|
||||
File f3 = new File(RecompileConfig.INSTANCE.dirDecompAuto, fileName);
|
||||
if (f2.exists() || f3.exists()) {
|
||||
// script.println("Skipping external function: " + externalFunction.getName() +
|
||||
// " - " + externalFunction.getEntryPoint());
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -266,7 +279,7 @@ public class FunctionDumper {
|
||||
writer2.println();
|
||||
writer2.println("// " + externalFunction.getEntryPoint());
|
||||
writer2.println("// " + externalFunction.getName());
|
||||
writer2.println(externalFunction.getSignature().getPrototypeString(false) + " {");
|
||||
writer2.println("extern \"C\" " + externalFunction.getSignature().getPrototypeString(false) + " {");
|
||||
writer2.println(" // TODO: Implement this function");
|
||||
writer2
|
||||
.println(" throw std::runtime_error(\"Function not implemented: " + externalFunction.getName() + "\");");
|
||||
|
Reference in New Issue
Block a user