Added a readme file and bumped to JDK 17

main
Nes370 2024-07-25 14:56:59 -07:00
parent 21efae2c2a
commit 3095cd02b7
4 changed files with 153 additions and 12 deletions

View File

@ -2,11 +2,7 @@
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="res"/> <classpathentry kind="src" path="res"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-12"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"/>
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/javaFlacEncoder"/> <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/javaFlacEncoder"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Apache Commons IO"/> <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Apache Commons IO"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/JColor"/> <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/JColor"/>

View File

@ -1,8 +1,8 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=12 org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=12 org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@ -11,4 +11,4 @@ org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=12 org.eclipse.jdt.core.compiler.source=17

64
README.md Normal file
View File

@ -0,0 +1,64 @@
## Ridge Racer 6 Audio Extractor
*RR6AudioExtractor* is a tool to extract, convert, and repackage audio from Ridge Racer 6 audio packs.
### Requirements
- *RR6AudioExtractor* requires that you have Java SE 17 or higher installed to run.
- To install, download the latest JRE (recommended) or JDK from [Adoptium](https://adoptium.net/temurin/archive/?version=17), or JDK from [Oracle](https://www.oracle.com/java/technologies/downloads/#java17).
### Usage
Launch console interface
```
java -jar RR6AudioExtractor.java
```
Identify a file
```
java -jar RR6AudioExtractor.java identify <file>
```
Extract audio files from a RR6 audio pack (`BIN` → `WAV`/`XMA`)
```
java -jar RR6AudioExtractor.java extract <package file>
```
Convert audio files between supported formats (`WAV` ↔ `XMA``FLAC`)
```
java -jar RR6AudioExtractor.java convert <audio file> <format>
```
Patch an audio file to repeat (`WAV`)
```
java - jar RR6AudioExtractor.java patch <audio file>
```
Pack audio files into a RR6 audio pack (`WAV`/`XMA` → `BIN`)
```
java -jar RR6AudioExtractor.java pack <audio directory>
```
Print a Ridge Racer 6 style ASCII logo
```
java -jar RR6AudioExtractor.java print <color> <text>
```
### About
*RR6AudioExtractor* is developed by [Nes](https://gitea.goblincave.synology.me/Nes).
### Referenced Libraries
*RR6AudioExtractor* makes use of several Java libraries:
- [Apache Commons Codec](https://commons.apache.org/proper/commons-codec/) v1.17.1
- [Apache Commons CSV](https://commons.apache.org/proper/commons-csv/) v1.11.0
- [Apache Commons IO](https://commons.apache.org/proper/commons-io/) v2.16.1
- [javaFlacEncoder](https://javaflacencoder.sourceforge.net/) v0.3.2
- [JColor](https://github.com/dialex/JColor) v5.5.1
### Recommended Software
- [*Xbox Image Browser*](https://digiex.net/threads/xbox-360-image-browser-2-9-0-350-xiso-browser-and-extractor.3136/) by Redline99
- For extracting and replacing files from Xbox Disc Images (`ISO`).

View File

@ -129,9 +129,14 @@ public class AudioExtractor {
} }
case "convert": { case "convert": {
// File audioFile = retrieveAudio(reader); File audioFile = retrieveAudio(reader); // Confirms file has WAV/XMA/FLAC extension + header
// if(audioFile.isFile()) if(audioFile.isFile()) {
String extension = FilenameUtils.getExtension(audioFile.getName());
// Ensure file has the right encoding (differentiate between WAV/XMA)
int encoding = 0;
// RandomAccessFile raf = new RandomAccessFile(audioFile, "r");
// convert(audioFile, encoding); // convert(audioFile, encoding);
}
} }
@ -162,6 +167,81 @@ public class AudioExtractor {
} }
/**
* Helper function to prompt user to select a convertible audio file.
*
* @param reader
* @return audio file
*/
private static File retrieveAudio(BufferedReader reader) {
File file = null;
String input = null;
boolean valid = false;
do {
System.out.print("Please enter the path of a file\t" + ANSI_BEIGE);
try {
input = reader.readLine();
file = new File(input);
if(file.exists()) {
if(file.isFile()) {
String name = file.getName().toLowerCase();
String extension = FilenameUtils.getExtension(name);
if(extension.equals("wav") || extension.equals("xma")) {
// check for RIFF header
byte[] bytes = new byte[4];
RandomAccessFile raf = new RandomAccessFile(file, "r");
raf.seek(0x0);
if(raf.readInt() == ASCII_RIFF) {
raf.seek(0x14);
raf.read(bytes);
int encoding = littleEndianToInt(bytes);
if(encoding == 0x0001)
valid = true;
else if(encoding == 0x0165)
valid = true;
else {
System.out.println("Unsupported encoding" + identifyEncoding(encoding) + ".");
}
}
else System.out.println("Not a valid RIFF file.");
} else if (name.endsWith(".flac")) {
// check for FLAC header
byte[] bytes = new byte[4];
RandomAccessFile raf = new RandomAccessFile(file, "r");
raf.seek(0);
if(raf.readInt() == ASCII_fLaC)
valid = true;
else System.out.println("Not a valid FLAC file.");
} else System.out.println(Ansi.colorize("File does not have a supported file extension."));
}
} else System.out.println(Ansi.colorize("File does not exist."));
} catch (IOException e) {
System.out.println(Ansi.colorize("Invalid file."));
}
} while(!valid);
return file;
}
/**
* Get the name of a WAVE encoding from its value.
*
* @param encoding
* @return
*/
private static String identifyEncoding(int encoding) {
// TODO Auto-generated method stub
return null;
}
/** /**
* Examines a given file and reads some of its properties. * Examines a given file and reads some of its properties.
* *
@ -253,7 +333,8 @@ public class AudioExtractor {
RandomAccessFile file = new RandomAccessFile(packageFile, "r"); RandomAccessFile file = new RandomAccessFile(packageFile, "r");
LinkedHashMap<Integer, Integer> tracklist = findAudioTracks(file); LinkedHashMap<Integer, Integer> tracklist = findAudioTracks(file);
File dir = new File(packageFile.getAbsoluteFile().getParentFile().toPath() + "/" + FilenameUtils.removeExtension(packageFile.getName())); File dir = new File(packageFile.getAbsoluteFile().getParentFile().toPath() + "/"
+ FilenameUtils.removeExtension(packageFile.getName()));
if(!dir.exists()) if(!dir.exists())
dir.mkdir(); dir.mkdir();
@ -622,7 +703,7 @@ public class AudioExtractor {
boolean valid = false; boolean valid = false;
do { do {
// Retrieve an audio file // Retrieve a file or folder
packageFile = retrieveFileOrFolder(reader, prompt); packageFile = retrieveFileOrFolder(reader, prompt);
if(packageFile.isFile()) { if(packageFile.isFile()) {