Skip to content

Commit

Permalink
Fixed #1477 ffdec.exe unicode parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
jindrapetrik committed Apr 5, 2023
1 parent a516236 commit b8d9fb8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 10 deletions.
17 changes: 8 additions & 9 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@
<target name="-set-console-type">
<property name="exe.type" value="console" />
</target>
<target name="-exe-config" depends="-loadversion">
<!--<target name="-exe-config" depends="-loadversion">
<echoxml file="${exe.config}">
<launch4jConfig>
<dontWrapJar>true</dontWrapJar>
Expand All @@ -420,7 +420,6 @@
<jdkPreference>preferJre</jdkPreference>
<runtimeBits>64/32</runtimeBits>
<maxHeapPercent>${max.heap.size.percent}</maxHeapPercent>
<!-- <opt>-Xss${max.stack.size}m</opt> -->
<opt>-Djava.net.preferIPv4Stack=true</opt>
<opt>-Djna.nosys=true</opt>
</jre>
Expand All @@ -444,7 +443,7 @@
</versionInfo>
</launch4jConfig>
</echoxml>
</target>
</target>-->

<target name="-exe-translator-config">
<echoxml file="${translator_exe.config}">
Expand Down Expand Up @@ -487,18 +486,18 @@
</launch4jConfig>
</echoxml>
</target>
<target name="-exe-linux" unless="is_windows" depends="-load-tools,-exe-config,-exe-translator-config">
<java jar="${launch4j.path}/launch4j.jar" fork="true">
<target name="-exe-linux" unless="is_windows" depends="-load-tools,-exe-translator-config"> <!-- -exe-config -->
<!--<java jar="${launch4j.path}/launch4j.jar" fork="true">
<arg line="${exe.config}" />
</java>
</java>-->
<java jar="${launch4j.path}/launch4j.jar" fork="true">
<arg line="${translator_exe.config}" />
</java>
</target>
<target name="-exe-windows" if="is_windows" depends="-load-tools,-exe-config,-exe-translator-config">
<java jar="${launch4j.path}/launch4j.jar" fork="true">
<target name="-exe-windows" if="is_windows" depends="-load-tools,-exe-translator-config"> <!-- -exe-config -->
<!--<java jar="${launch4j.path}/launch4j.jar" fork="true">
<arg line="${exe.config}" />
</java>
</java>-->
<java jar="${launch4j.path}/launch4j.jar" fork="true">
<arg line="${translator_exe.config}" />
</java>
Expand Down
Binary file added resources/ffdec.exe
Binary file not shown.
20 changes: 19 additions & 1 deletion src/com/jpexs/decompiler/flash/gui/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
import java.net.Proxy;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLDecoder;
import java.nio.charset.Charset;
import java.nio.file.FileSystems;
import java.nio.file.StandardWatchEventKinds;
Expand Down Expand Up @@ -2649,11 +2650,28 @@ public boolean accept(File dir, String name) {
}
}

/**
* To bypass wrong encoded unicode characters coming from EXE,
* it Launch5j encodes characters using URLEncoder.
* @param args
*/
private static void decodeLaunch5jArgs(String[] args) {
String encargs = System.getProperty("l5j.encargs");
if ("true".equals(encargs) || "1".equals(encargs)) {
for (int i = 0; i < args.length; ++i) {
try {
args[i] = URLDecoder.decode(args[i], "UTF-8");
} catch (Exception e) { }
}
}
}

/**
* @param args the command line arguments
* @throws IOException On error
*/
public static void main(String[] args) throws IOException {
decodeLaunch5jArgs(args);
setSessionLoaded(false);

clearTemp();
Expand Down Expand Up @@ -2686,7 +2704,7 @@ public static void main(String[] args) throws IOException {
reloadLastSession();
}
});
} else {
} else {
checkLibraryVersion();
setSessionLoaded(true);
String[] filesToOpen = CommandLineArgumentParser.parseArguments(args);
Expand Down

0 comments on commit b8d9fb8

Please sign in to comment.