back from taco hell

This commit is contained in:
Downforce Agent 2024-08-12 22:39:15 -05:00
parent cf2875af3f
commit 20e31468b3
2 changed files with 107 additions and 13 deletions

View File

@ -9,13 +9,9 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="cf74c012-cc69-4732-ac79-9ddfcbf803ee" name="Changes" comment="rebase; move to package, prepare header read io">
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/artifacts/vitality4j_jar.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/artifacts/vitality4j_jar.xml" afterDir="false" />
<list default="true" id="cf74c012-cc69-4732-ac79-9ddfcbf803ee" name="Changes" comment="brb, eating">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/net/screwgravity/vitality4j/Scotty.java" beforeDir="false" afterPath="$PROJECT_DIR$/net/screwgravity/vitality4j/Scotty.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/net/screwgravity/vitality4j/standalone.java" beforeDir="false" afterPath="$PROJECT_DIR$/net/screwgravity/vitality4j/standalone.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/vitality4j/META-INF/MANIFEST.MF" beforeDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -95,7 +91,15 @@
<option name="project" value="LOCAL" />
<updated>1723512022104</updated>
</task>
<option name="localTasksCounter" value="4" />
<task id="LOCAL-00004" summary="brb, eating">
<option name="closed" value="true" />
<created>1723514215355</created>
<option name="number" value="00004" />
<option name="presentableId" value="LOCAL-00004" />
<option name="project" value="LOCAL" />
<updated>1723514215355</updated>
</task>
<option name="localTasksCounter" value="5" />
<servers />
</component>
<component name="VcsManagerConfiguration">
@ -103,6 +107,7 @@
<MESSAGE value="help screen" />
<MESSAGE value="initial structuring" />
<MESSAGE value="rebase; move to package, prepare header read io" />
<option name="LAST_COMMIT_MESSAGE" value="rebase; move to package, prepare header read io" />
<MESSAGE value="brb, eating" />
<option name="LAST_COMMIT_MESSAGE" value="brb, eating" />
</component>
</project>

View File

@ -2,7 +2,36 @@ package net.screwgravity.vitality4j;
public class standalone {
public static boolean fromTerminal = false;
public static final int[] version = new int[]{0, 0, 0};
public static final int[] version = new int[]{0, 0, 1};
public static Verbosities verbosity = Verbosities.NORMAL;
// args parser
static boolean argIsTakingParam = false;
static String argWhichIsTakingParam = null;
// parsed instructions to be sent to Scotty
static String operation = "";
static String targetPath; // psarc file
static String sourcePath; // folder contents to import when using -c, list of files to export when using -x
static Scotty.CompressionFormats targetFormat = Scotty.CompressionFormats.ZLIB;
static byte targetStrength = 9;
static long targetBlockSize = 65536; // in bytes
static boolean makeAbsolute = false;
static boolean makeCaseInsensitive = false;
public enum Verbosities {
QUIET(0),
NORMAL(1),
VERBOSE(2);
private final int value;
Verbosities(final int value) {this.value = value;}
public int getValue() {
return value;
}
}
// This is used when Vitality4J is run from the terminal.
// Don't make calls to anything in the standalone class when using Vitality4j as a library.
//
@ -11,16 +40,76 @@ public class standalone {
public static void main (String[] args) {
fromTerminal = true;
boolean makeAbsolute = false;
boolean makeCaseInsensitive = false;
if (args.length == 0) {
printHelpScreen();
} else if (args.length > 0) {
if (args[0].equals("-h")) {
printHelpScreen();
if (args.length > 1 && args[1].equals("-j")) {
printAboutScreen();
}
System.exit(0);
}
for (String s : args) {
if (!argIsTakingParam) {
switch (s) {
case "-j":
argIsTakingParam = false;
printAboutScreen();
break;
case "-h":
if (argWhichIsTakingParam == null) {
printHelpScreen();
} else {
System.out.println("WARNING: Argument \"-h\" provided but other commands were already given first, ignoring.");
}
break;
case "-q":
argIsTakingParam = false;
argWhichIsTakingParam = s;
verbosity = Verbosities.QUIET;
break;
case "-v":
argIsTakingParam = false;
argWhichIsTakingParam = s;
verbosity = Verbosities.VERBOSE;
break;
case "-i", "-t", "-e":
argIsTakingParam = false;
argWhichIsTakingParam = s;
setOperation(s);
break;
case "-I", "-c", "-E", "-x":
argIsTakingParam = true;
argWhichIsTakingParam = s;
setOperation(s);
break;
default:
System.out.println("invalid option: " + s);
break;
}
} else {
}
}
}
}
private static void setOperation(String str) {
if (!operation.isEmpty()) {System.out.println("WARNING: duplicate operation " + str + " replaces previous argument.");}
operation = str;
}
private static void printAboutScreen() {
System.out.println(
"Vitality4j " + version[0] + "." + version[1] + "." + version[2] + "\n" +
"Developed by bonkmaykr, Canithesis Interactive (screwgravity.net)\n" +
"\n" +
"Your copy of vita4j should have come with a license. If not, see:\n" +
"https://git.worlio.com/bonkmaykr/vitality4j/src/branch/master/LICENSE"
);
}
private static void printHelpScreen() {
System.out.println(
"usage: vita4j [options] <file>\n" +
@ -35,14 +124,14 @@ public class standalone {
" -x <file> 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" +
" -q Quiet, avoid printing to stdout until an emergency.\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 <size> Sets the blocksize in bytes when creating a new archive. (default = 64 KB)\n" +
" -g <none|zlib|lzma> Sets the compression algorithm used\n" +
" -g <none|zlib|lzma> Sets the compression algorithm used. (default = zlib)\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" +