-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} |