diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 88a0ed1..f1d4706 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -9,8 +9,9 @@
-
+
+
@@ -175,7 +176,15 @@
1728338443139
-
+
+
+ 1728338552620
+
+
+
+ 1728338552620
+
+
@@ -190,6 +199,7 @@
-
+
+
\ No newline at end of file
diff --git a/src/net/screwgravity/vitality4j/standalone.java b/src/net/screwgravity/vitality4j/standalone.java
index f50c340..6d64b04 100644
--- a/src/net/screwgravity/vitality4j/standalone.java
+++ b/src/net/screwgravity/vitality4j/standalone.java
@@ -151,11 +151,6 @@ public class standalone {
i++;
}
- if (verbosity != Verbosities.QUIET) {
- System.out.println("INFO: absolute mode is " + makeAbsolute);
- System.out.println("INFO: case insensitive mode is " + makeCaseInsensitive);
- }
-
if (operation.isEmpty()) {
operation = "-i";
}
@@ -164,10 +159,26 @@ public class standalone {
case "-i":
try {
PSARC psarc = new PSARC(new File (targetPath)); // System.getProperty("user.dir") + File.separator +
- System.out.println("PSARC version " + psarc.version[0] + "." + psarc.version[1] + "." + psarc.version[2] + "." + psarc.version[3]);
- String comp = "nothing";
- if (psarc.algorithm == CompressionFormats.ZLIB) {comp = "ZLIB";} else if (psarc.algorithm == CompressionFormats.LZMA) {comp = "LZMA";}
- System.out.println("Compressed with " + comp);
+ if (verbosity != Verbosities.QUIET) {
+ System.out.println("PSARC version " + psarc.version[0] + "." + psarc.version[1] + "." + psarc.version[2] + "." + psarc.version[3]);
+ boolean isAbsolute = false;
+ boolean isCaseInsensitive = false;
+ if (psarc.mode == tools.Scotty.PathModes.ABSOLUTE ||
+ psarc.mode == tools.Scotty.PathModes.IGNORE_CASE_ABSOLUTE) {isAbsolute = true;}
+ if (psarc.mode == tools.Scotty.PathModes.IGNORE_CASE ||
+ psarc.mode == tools.Scotty.PathModes.IGNORE_CASE_ABSOLUTE) {isCaseInsensitive = true;}
+ System.out.println("INFO: absolute mode is " + isAbsolute);
+ System.out.println("INFO: case insensitive mode is " + isCaseInsensitive);
+ String comp = "nothing";
+ if (psarc.algorithm == CompressionFormats.ZLIB) {comp = "ZLIB";} else if (psarc.algorithm == CompressionFormats.LZMA) {comp = "LZMA";}
+ System.out.println("INFO: Compressed with " + comp);
+ if (verbosity == Verbosities.VERBOSE) {
+ System.out.println("INFO: block size at " + psarc.blockSize);
+ System.out.println("INFO: TOC is " + psarc.toc_length + " bytes total containing " +
+ psarc.toc_number_of_entries + " files.\nINFO: Each TOC entry is " +
+ psarc.toc_entry_length + " bytes long.");
+ }
+ }
System.exit(0);
} catch (Exception e) {
System.out.println("Error reading file \"" + targetPath + "\".\n" + e.getMessage());
diff --git a/src/net/screwgravity/vitality4j/tools.java b/src/net/screwgravity/vitality4j/tools.java
index 42d79b2..e8febf5 100644
--- a/src/net/screwgravity/vitality4j/tools.java
+++ b/src/net/screwgravity/vitality4j/tools.java
@@ -32,7 +32,8 @@ public class tools {
public enum PathModes {
RELATIVE(0),
IGNORE_CASE(1),
- ABSOLUTE(2);
+ ABSOLUTE(2),
+ IGNORE_CASE_ABSOLUTE(3);
private final int value;
PathModes(final int value) {this.value = value;}
@@ -69,11 +70,13 @@ public class tools {
public byte[] version = new byte[]{0, 0, 0, 0}; // fixed length of 32 bits
public CompressionFormats algorithm = CompressionFormats.ZLIB; // the algorithm used to compress the files
public byte strength = 9; // intensity of the compression algorithm from 0 to 9
- public long blockSize = 65536;
+ public int blockSize = 65536;
public PathModes mode = PathModes.RELATIVE;
private RandomAccessFile fromDisk = null; // if NULL then file is a new file
- private List files = new ArrayList();
- private int toc_length = 0;
+ public List files = new ArrayList();
+ public int toc_length = 0;
+ public int toc_entry_length = 30;
+ public int toc_number_of_entries = 0;
public PSARC() { // new w/ defaults
// use defaults, do nothing
@@ -93,8 +96,9 @@ public class tools {
// ok, it is safe to continue
fromDisk.seek(4);
- fromDisk.read(version);
+ fromDisk.read(version); // get version
+ // get algorithm
byte[] algorithm_cast = new byte[]{0, 0, 0, 0};
byte[] header_zlib = new byte[]{0x7A, 0x6C, 0x69, 0x62};
byte[] header_lzma = new byte[]{0x6C, 0x7A, 0x6D, 0x61};
@@ -103,9 +107,27 @@ public class tools {
else if (Arrays.equals(algorithm_cast, header_lzma)) {algorithm = CompressionFormats.LZMA;}
else {throw new IncorrectFileTypeException("Unrecognized or unimplemented compression algorithm.");}
- byte[] toc_length_cast = new byte[]{0, 0, 0, 0};
- fromDisk.read(toc_length_cast);
- //toc_length = (int)toc_length_cast;
+ // get toc size and entry size
+ toc_length = fromDisk.readInt();
+ toc_entry_length = fromDisk.readInt();
+ toc_number_of_entries = fromDisk.readInt();
+ blockSize = fromDisk.readInt();
+ int raw_af = fromDisk.readInt(); // RAW AS FUCK!!!!!!!!!!!!!!!!!!!!!!!!!
+ switch (raw_af) { // thanks java for not allowing me to use my int -> enum cast for no reason
+ case 0:
+ mode = PathModes.RELATIVE;
+ break;
+ case 1:
+ mode = PathModes.IGNORE_CASE;
+ break;
+ case 2:
+ mode = PathModes.ABSOLUTE;
+ break;
+ case 3:
+ mode = PathModes.IGNORE_CASE_ABSOLUTE;
+ break;
+ }
+
}
public PSARC(CompressionFormats algorithm, byte strength) { // new
@@ -113,7 +135,7 @@ public class tools {
this.strength = strength;
}
- public PSARC(CompressionFormats algorithm, byte strength, long blockSize) { // new
+ public PSARC(CompressionFormats algorithm, byte strength, int blockSize) { // new
this.algorithm = algorithm;
this.strength = strength;
this.blockSize = blockSize;