diff --git a/.gitignore b/.gitignore index 2501eef..4cc09f4 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,4 @@ build /.idea/uiDesigner.xml /.idea/vcs.xml /.idea/vitality4j.iml +/META-INF/MANIFEST.MF diff --git a/.idea/artifacts/vitality4j_jar.xml b/.idea/artifacts/vitality4j_jar.xml index ffa1d76..e537080 100644 --- a/.idea/artifacts/vitality4j_jar.xml +++ b/.idea/artifacts/vitality4j_jar.xml @@ -2,6 +2,9 @@ $PROJECT_DIR$/out/artifacts/vitality4j_jar + + + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 3613958..6b9d453 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,15 +1,21 @@ + + + + + - + + + - - - - + + + - \ No newline at end of file diff --git a/net/screwgravity/vitality4j/Scotty.java b/net/screwgravity/vitality4j/Scotty.java index 76212f4..3994d5a 100644 --- a/net/screwgravity/vitality4j/Scotty.java +++ b/net/screwgravity/vitality4j/Scotty.java @@ -1,11 +1,8 @@ package net.screwgravity.vitality4j; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.InputStream; +import java.io.*; import java.util.ArrayList; import java.util.List; -import java.io.RandomAccessFile; public class Scotty { public enum CompressionFormats { @@ -70,13 +67,10 @@ public class Scotty { // use defaults, do nothing } - public PSARC(File location) { // existing + public PSARC(File location) throws IOException { // existing // todo: read psarc and set vars above - try {fromDisk = new RandomAccessFile(location, "read");} catch (FileNotFoundException e) { - if (standalone.fromTerminal) {System.out.println("File \"" + location.getAbsolutePath() +"\" not found.");System.exit(1);} - else {throw new RuntimeException(e);} - } - System.out.println(); + fromDisk = new RandomAccessFile(location, "r"); // mode will be changed retroactively with a new RandomAccessFile if we ever need to make writes + System.out.println(fromDisk.read(version, 4, 4)); } diff --git a/net/screwgravity/vitality4j/standalone.java b/net/screwgravity/vitality4j/standalone.java index 1859b4e..0f51fa6 100644 --- a/net/screwgravity/vitality4j/standalone.java +++ b/net/screwgravity/vitality4j/standalone.java @@ -10,45 +10,60 @@ public class standalone { // and/or for debugging purposes without another Java project as the interface. public static void main (String[] args) { fromTerminal = true; + + boolean makeAbsolute = false; + boolean makeCaseInsensitive = false; + if (args.length == 0) { - System.out.println( - "usage: vita4j [options] \n" + - "\n" + - "Options:\n" + - " -i Displays info about a PSARC archive.\n" + - " -I Displays info about a file inside a PSARC archive.\n" + - " -t Lists the Table of Contents from a PSARC archive.\n" + - " -c Creates a new PSARC archive with the specified parameters.\n" + - " -e Extracts a PSARC archive to the current working directory.\n" + - " -E Extracts one file from a PSARC archive to the current working directory.\n" + - " -x Extracts multiple files from a PSARC archive to the current working\n" + - " directory, from a TXT list of file paths. One file per line in the list.\n" + - " -y Overwrites conflicting files without asking.\n" + - " -q Quiet, avoid printing to stdout.\n" + - " -v Verbose. Prints additional information to stdout.\n" + - " -h Prints this help screen that you're reading right now.\n" + - " -a Displays version and licensing information about Vitality4j.\n" + - "\n" + - "Creating a new PSARC:\n" + - " -b Sets the blocksize in bytes when creating a new archive. (default = 64 KB)\n" + - " -g Sets the compression algorithm used\n" + - " -u Makes the PSARC uncompressed. Shorthand for \"-a none\".\n" + - " -z Compresses the PSARC with zlib. Shorthand for \"-a zlib\".\n" + - " -l Compresses the PSARC with LZMA. Shorthand for \"-a lzma\".\n" + - " -s Sets the intensity of the compression from 0 to 9. (default = 9)\n" + - "\n" + - "Examples:\n" + - " To extract an archive:\n" + - " vita4j -e data.psarc\n" + - "\n" + - " To create a new archive from a folder:\n" + - " vita4j -c ~/data/ data.psarc\n" + - "\n" + - " To create an archive with LZMA compression and a block size of 256 KB or 262144 B:\n" + - " vita4j -c ~/data/ -l -b 256 data.psarc\n" + - "\n" + - "If no options are specified, -i is presumed.\n" - ); + printHelpScreen(); + } else if (args.length > 0) { + } } + + private static void printHelpScreen() { + System.out.println( + "usage: vita4j [options] \n" + + "\n" + + "Options:\n" + + " -i Displays info about a PSARC archive.\n" + + " -I Displays info about a file inside a PSARC archive.\n" + + " -t Lists the Table of Contents from a PSARC archive.\n" + + " -c Creates a new PSARC archive with the specified parameters.\n" + + " -e Extracts a PSARC archive to the current working directory.\n" + + " -E Extracts one file from a PSARC archive to the current working directory.\n" + + " -x Extracts multiple files from a PSARC archive to the current working\n" + + " directory, from a TXT list of file paths. One file per line in the list.\n" + + " -y Overwrites conflicting files without asking.\n" + + " -q Quiet, avoid printing to stdout.\n" + + " -v Verbose. Prints additional information to stdout.\n" + + " -h Prints this help screen that you're reading right now.\n" + + " -j Displays version and licensing information about Vitality4j.\n" + + "\n" + + "Creating a new PSARC:\n" + + " -b Sets the blocksize in bytes when creating a new archive. (default = 64 KB)\n" + + " -g Sets the compression algorithm used\n" + + " -u Makes the PSARC uncompressed. Shorthand for \"-a none\".\n" + + " -z Compresses the PSARC with zlib. Shorthand for \"-a zlib\".\n" + + " -l Compresses the PSARC with LZMA. Shorthand for \"-a lzma\".\n" + + " -s Sets the intensity of the compression from 0 to 9. (default = 9)\n" + + " -r Makes all paths in the PSARC relative. (Default)\n" + + " -a Makes all paths in the PSARC absolute. Required for WipEout, Ratchet and Clank, God of War...\n" + + " -n Makes all paths in the PSARC case-insensitive, like DOS. Required for WipEout, Ratchet and Clank, Killzone...\n" + + " PS3, Vita and PS4 follow POSIX convention when handling file names. Windows does not, meaning something\n" + + " that is valid on a developer's computer isn't always appropriate on a console. The -n flag fixes this.\n" + + "\n" + + "Examples:\n" + + " To extract an archive:\n" + + " vita4j -e data.psarc\n" + + "\n" + + " To create a new archive from a folder:\n" + + " vita4j -c ~/data/ data.psarc\n" + + "\n" + + " To create an archive with LZMA compression and a block size of 256 KB or 262144 B:\n" + + " vita4j -c ~/data/ -l -b 256 data.psarc\n" + + "\n" + + "If no options are specified, -i is presumed.\n" + ); + } } diff --git a/out/production/vitality4j/META-INF/MANIFEST.MF b/out/production/vitality4j/META-INF/MANIFEST.MF deleted file mode 100644 index 6aba8f5..0000000 --- a/out/production/vitality4j/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Main-Class: standalone -