-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.java
59 lines (53 loc) · 2.61 KB
/
main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import swg.APTFile;
import swg.LODFile;
import swg.SSAFile;
import java.io.File;
import java.io.IOException;
public class main {
private static String clientDataRoot = "E:/Games/SWG-Extracted/"; // this should be the folder where the client side files are expanded into.
public static void main(String[] args)
{
if(args != null){
switch(args.length){
case 0:
File f = new File(clientDataRoot + "/appearance");
for(File file : f.listFiles()){
if(!file.getName().contains(".apt")) continue;
APTFile aptFile = new APTFile(clientDataRoot + "appearance/" + file.getName());
aptFile.read();
if(aptFile.getFullName().contains(".lod")){
try {
SSAFile ssaFile = new SSAFile(aptFile.getFullName());
String ssaFileName = "appearance/" + file.getName().replace(".apt", ".ssa");
// first, see if we have an SSA file that we can use
File ssaFileCheck = new File(clientDataRoot + ssaFileName);
// if it doesn't exist, try to create it from an LOD file.
if(!ssaFileCheck.exists()) {
// try to create the SSA file from the LOD file
LODFile lodFile = new LODFile(clientDataRoot + aptFile.getFullName());
if (!lodFile.read()) {
System.out.println("Can't read file (" + aptFile.getFullName() + ")!!");
continue;
}
ssaFile.setApprBytes(lodFile.getApprBytes());
ssaFile.write();
}
// change the redirector in the APT
aptFile.setFullName("appearance/" + file.getName().replace(".apt", ".ssa"));
// Create the SSA
aptFile.write();
}
catch (IOException e){
System.out.println("ERROR: " + e.getMessage());
}
}
}
break;
case 1:
break;
default:
break;
}
}
}
}