Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
delltalal authored Mar 10, 2021
1 parent 3eaf9d8 commit 7c28fe4
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions TexturesMapper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package texturesmapper;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Scanner;

//@author Talal
public class TexturesMapper {

public static void main(String[] args) throws FileNotFoundException {

try {
Scanner myObj = new Scanner(System.in);
System.out.println("Enter ps2 game name in CRC32 format");
String EntCRC = myObj.nextLine();
Scanner myObj2 = new Scanner(System.in);
System.out.println("Enter game textures directory that you wish to load");
String dir = myObj2.nextLine();
String yamldir = dir.replace("\\", "/");

String sa = yamldir;
String[] split = sa.split("textures/");
String firstSubString = split[0];
String secondSubString = split[1];

File file = new File(EntCRC + ".yaml");
FileOutputStream fos = new FileOutputStream(file);
PrintStream ps = new PrintStream(fos);
System.setOut(ps);
System.out.println("ProcessTEX: ");
String[] fileNames
= Files.list(Paths.get(dir)).filter(
Files::isRegularFile).map(
p -> p.toFile().getName()).toArray(String[]::new);
char star = '"';

for (String s : fileNames) {

String str = s;
String search = ".dds";
int index = str.lastIndexOf(search);

if (index > 0) {
str = str.substring(0, index);
ps = new PrintStream(fos);
System.setOut(ps);
System.out.println(" 0x" + str + ": \"" + secondSubString + "/" + s + star);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

0 comments on commit 7c28fe4

Please sign in to comment.