@@ -17,21 +17,21 @@ object ExtractCommand : Command("extract", "e") {
17
17
18
18
override val commandInfo: CommandInfo =
19
19
CommandInfo (" [flags] <code file> [output dir]" ,
20
- listOf (" Extract binary files from a decrypted code.bin file and output them to the directory specified." ,
21
- " File must be with the file's extension .bin (little-endian)" ,
22
- " Files will be overwritten without warning." ,
23
- " If the output is not specified, the directory will have the same name as the file." ,
24
- " A base.bin file will also be created in the output directory. This is a base C00.bin file." ),
25
- listOf (
26
- FlagInfo (listOf (" -a" ),
27
- listOf (" Extract all subroutines of game engines, as opposed to only ones used by the games." ,
28
- " Note that this potentially includes sequels and prequels to the game." )),
29
- FlagInfo (listOf (" -d" ),
30
- listOf (" Immediately decompile all extracted games, with enhanced features such as meaningful marker names." ,
31
- " Will be extracted into a \" decompiled\" directory in the output directory." )),
32
- FlagInfo (listOf (" -t" ),
33
- listOf (" Extract tempo files. These will be written as .tempo files in a \" tempo\" folder in the output directory." ))
34
- ))
20
+ listOf (" Extract binary files from a decrypted code.bin file and output them to the directory specified." ,
21
+ " File must be with the file's extension .bin (little-endian)" ,
22
+ " Files will be overwritten without warning." ,
23
+ " If the output is not specified, the directory will have the same name as the file." ,
24
+ " A base.bin file will also be created in the output directory. This is a base C00.bin file." ),
25
+ listOf (
26
+ FlagInfo (listOf (" -a" ),
27
+ listOf (" Extract all subroutines of game engines, as opposed to only ones used by the games." ,
28
+ " Note that this potentially includes sequels and prequels to the game." )),
29
+ FlagInfo (listOf (" -d" ),
30
+ listOf (" Immediately decompile all extracted games, with enhanced features such as meaningful marker names." ,
31
+ " Will be extracted into a \" decompiled\" directory in the output directory." )),
32
+ FlagInfo (listOf (" -t" ),
33
+ listOf (" Extract tempo files. These will be written as .tempo files in a \" tempo\" folder in the output directory." ))
34
+ ))
35
35
36
36
override fun execute (args : List <String >, flagsObj : Commands .Flags , flags : List <String >, indexOfFirstArgument : Int ,
37
37
output : PrintStream ) {
@@ -41,9 +41,9 @@ object ExtractCommand : Command("extract", "e") {
41
41
val codebin = File (args[indexOfFirstArgument])
42
42
val codeBuffer = ByteBuffer .wrap(Files .readAllBytes(codebin.toPath())).order(ByteOrder .LITTLE_ENDIAN )
43
43
val folder = File (when {
44
- indexOfFirstArgument + 1 < args.size -> args[indexOfFirstArgument + 1 ]
45
- else -> codebin.nameWithoutExtension
46
- })
44
+ indexOfFirstArgument + 1 < args.size -> args[indexOfFirstArgument + 1 ]
45
+ else -> codebin.nameWithoutExtension
46
+ })
47
47
folder.mkdirs()
48
48
val decompiledFolder = File (folder, " decompiled" )
49
49
if (flags.contains(" -d" )) {
@@ -65,7 +65,7 @@ object ExtractCommand : Command("extract", "e") {
65
65
if (flags.contains(" -d" )) {
66
66
val decompiler = Decompiler (arr, ByteOrder .LITTLE_ENDIAN , MegamixFunctions )
67
67
output.println (" Decompiling ${codeBuffer.getName(i)} " )
68
- val r = decompiler.decompile(CommentType .NORMAL , true , " " , result.first)
68
+ val r = decompiler.decompile(CommentType .NORMAL , true , macros = result.first)
69
69
val f = FileOutputStream (File (decompiledFolder, codeBuffer.getName(i) + " .tickflow" ))
70
70
f.write(r.second.toByteArray(Charset .forName(" UTF-8" )))
71
71
f.close()
@@ -87,7 +87,7 @@ object ExtractCommand : Command("extract", "e") {
87
87
if (flags.contains(" -d" )) {
88
88
val decompiler = Decompiler (arr, ByteOrder .LITTLE_ENDIAN , MegamixFunctions )
89
89
output.println (" Decompiling ${codeBuffer.getGateName(i)} " )
90
- val r = decompiler.decompile(CommentType .NORMAL , true , " " , result.first)
90
+ val r = decompiler.decompile(CommentType .NORMAL , true , macros = result.first)
91
91
val f = FileOutputStream (File (decompiledFolder, codeBuffer.getGateName(i) + " .tickflow" ))
92
92
f.write(r.second.toByteArray(Charset .forName(" UTF-8" )))
93
93
f.close()
0 commit comments