brb, eating

This commit is contained in:
Downforce Agent 2024-08-12 20:56:54 -05:00
parent 9ba6580409
commit cf2875af3f
6 changed files with 84 additions and 59 deletions

1
.gitignore vendored
View File

@ -59,3 +59,4 @@ build
/.idea/uiDesigner.xml
/.idea/vcs.xml
/.idea/vitality4j.iml
/META-INF/MANIFEST.MF

View File

@ -2,6 +2,9 @@
<artifact type="jar" build-on-make="true" name="vitality4j:jar">
<output-path>$PROJECT_DIR$/out/artifacts/vitality4j_jar</output-path>
<root id="archive" name="vitality4j.jar">
<element id="directory" name="META-INF">
<element id="file-copy" path="$PROJECT_DIR$/META-INF/MANIFEST.MF" />
</element>
<element id="module-output" name="vitality4j" />
</root>
</artifact>

View File

@ -1,15 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ArtifactsWorkspaceSettings">
<artifacts-to-build>
<artifact name="vitality4j:jar" />
</artifacts-to-build>
</component>
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="cf74c012-cc69-4732-ac79-9ddfcbf803ee" name="Changes" comment="initial structuring">
<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" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/June.java" beforeDir="false" afterPath="$PROJECT_DIR$/net/screwgravity/vitality4j/June.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/META-INF/MANIFEST.MF" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/Scotty.java" beforeDir="false" afterPath="$PROJECT_DIR$/net/screwgravity/vitality4j/Scotty.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/standalone.java" beforeDir="false" afterPath="$PROJECT_DIR$/net/screwgravity/vitality4j/standalone.java" 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" />
@ -49,7 +55,7 @@
<configuration name="Default CLI" type="Application" factoryName="Application">
<option name="ALTERNATIVE_JRE_PATH" value="17" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="MAIN_CLASS_NAME" value="standalone" />
<option name="MAIN_CLASS_NAME" value="net.screwgravity.vitality4j.standalone" />
<module name="vitality4j" />
<method v="2">
<option name="Make" enabled="true" />
@ -81,13 +87,22 @@
<option name="project" value="LOCAL" />
<updated>1723280881251</updated>
</task>
<option name="localTasksCounter" value="3" />
<task id="LOCAL-00003" summary="rebase; move to package, prepare header read io">
<option name="closed" value="true" />
<created>1723512022104</created>
<option name="number" value="00003" />
<option name="presentableId" value="LOCAL-00003" />
<option name="project" value="LOCAL" />
<updated>1723512022104</updated>
</task>
<option name="localTasksCounter" value="4" />
<servers />
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="eclipse compiler adjustments" />
<MESSAGE value="help screen" />
<MESSAGE value="initial structuring" />
<option name="LAST_COMMIT_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" />
</component>
</project>

View File

@ -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));
}

View File

@ -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] <file>\n" +
"\n" +
"Options:\n" +
" -i Displays info about a PSARC archive.\n" +
" -I <path> Displays info about a file inside a PSARC archive.\n" +
" -t Lists the Table of Contents from a PSARC archive.\n" +
" -c <path> Creates a new PSARC archive with the specified parameters.\n" +
" -e Extracts a PSARC archive to the current working directory.\n" +
" -E <path> Extracts one file from a PSARC archive to the current working directory.\n" +
" -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" +
" -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 <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" +
" -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 <strength> 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] <file>\n" +
"\n" +
"Options:\n" +
" -i Displays info about a PSARC archive.\n" +
" -I <path> Displays info about a file inside a PSARC archive.\n" +
" -t Lists the Table of Contents from a PSARC archive.\n" +
" -c <path> Creates a new PSARC archive with the specified parameters.\n" +
" -e Extracts a PSARC archive to the current working directory.\n" +
" -E <path> Extracts one file from a PSARC archive to the current working directory.\n" +
" -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" +
" -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" +
" -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 <strength> 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"
);
}
}

View File

@ -1,3 +0,0 @@
Manifest-Version: 1.0
Main-Class: standalone