Browse Source

Added updates by Cheburat0rr

master
surkeh 4 years ago
parent
commit
0b069ab7ee
  1. BIN
      DMCTextureTool.exe
  2. 28
      PacExtract.py
  3. 7
      PacRepack.py
  4. 2
      README.md

BIN
DMCTextureTool.exe

Binary file not shown.

28
PacExtract.py

@ -1,6 +1,8 @@ @@ -1,6 +1,8 @@
#PAC Extractor
#coded by James
#! python2
#import
import sys, os
from struct import *
@ -25,8 +27,8 @@ def getType(str): @@ -25,8 +27,8 @@ def getType(str):
try:
if str[:4].encode("hex").upper() == "4D4F4420" or str[:3] == "MOD":
suf = "mod"
elif str[:4] == "TIM2":
suf = "tm2"
elif str[:4].encode("hex").upper() == "44445320" or str[:3] == "DDS":
suf = "dds"
elif str[:4].encode("hex").upper() == "53485720" or str[:3] == "SHW":
suf = "shw"
elif str[:3] == "MOT" or str[:4].encode("hex").upper() == "50000000":
@ -59,7 +61,7 @@ def getType(str): @@ -59,7 +61,7 @@ def getType(str):
suf = "tsb"
elif str[:2] == "# ":
suf = "txt"
# elif str[:4] == "ff&A":
# elif str[:4] == "ff&A":
# suf = "ff"
elif str[:1] == ";":
suf = "txt"
@ -80,11 +82,15 @@ def PTX(str, ptx_name, pac_name): @@ -80,11 +82,15 @@ def PTX(str, ptx_name, pac_name):
num_files = unpack("<I", str[:4])[0] #number of files
offsets = []
last = 0
trail_str=str[2056:2160]
trail_open = open("%s\\%s.trail" % (pac_name, ptx_name), "wb")
trail_open.write(trail_str)
trail_open.close()
#too lazy to properly write it, just searched
for i in range(num_files):
offsets.append(str.find("TIM2", last))
last = str.find("TIM2", last)+4
offsets.append(str.find("DDS", last))
last = str.find("DDS", last)+4
#make another sub directory
try:
@ -99,14 +105,14 @@ def PTX(str, ptx_name, pac_name): @@ -99,14 +105,14 @@ def PTX(str, ptx_name, pac_name):
except IndexError:
file_str = str[offsets[i]:]
#index files, and writing contents
index_file.write("%s_%.3d.tm2\n" % (ptx_name, i))
print "\tWriting: %s_%.3d.tm2" % (ptx_name, i)
index_file.write("%s_%.3d.dds\n" % (ptx_name, i))
print "\tWriting: %s_%.3d.dds" % (ptx_name, i)
try:
file_open = open("%s\\%s\\%s_%.3d.tm2" % (pac_name, ptx_name, ptx_name, i), "wb")
file_open = open("%s\\%s\\%s_%.3d.dds" % (pac_name, ptx_name, ptx_name, i), "wb")
file_open.write(file_str)
file_open.close()
except:
print "\tError Writing %s_%.3d.tm2" % (ptx_name, i)
print "\tError Writing %s_%.3d.dds" % (ptx_name, i)
return 0
def main():
@ -159,7 +165,7 @@ def main(): @@ -159,7 +165,7 @@ def main():
except IndexError:
file_str = pac_str[offsets[i]:]
if "TIM2" in file_str[4:] and "PAC" not in file_str and "PNST" not in file_str:
if "DDS" in file_str[4:] and "PAC" not in file_str and "PNST" not in file_str:
print "%X" % offsets[i]
PTX(file_str, "%s_%.3d" % (pac_name, i), pac_name)
index_file.write("%s folder\n" % ("%s_%.3d"% (pac_name, i)))

7
PacRepack.py

@ -43,6 +43,9 @@ def PTX(file, folder): @@ -43,6 +43,9 @@ def PTX(file, folder):
num_files = len(files)
header = pack("<I", num_files)
body = ""
trailer_open = open("%s\\%s.trail" % (folder, file), "rb")
#trailer_open.seek(2048)
trailer = trailer_open.read(2160)
outfile = open("%s\\%s.ptx" % (folder, file), "wb")
for i in range(num_files):
@ -51,7 +54,7 @@ def PTX(file, folder): @@ -51,7 +54,7 @@ def PTX(file, folder):
header += pack("<I", len(bin_str)/1024/2)
body += bin_str
header += ("00000000".decode("hex"))*(511-num_files) #cushion
header += ("00000000".decode("hex"))*(513-num_files) + trailer #cushion
outfile.write(header+body)
print ""
return 0
@ -105,7 +108,7 @@ def main(): @@ -105,7 +108,7 @@ def main():
#greetings
print "\n=================================\nDevil May Cry 3 \nPac Repacker\nvBETA\nCoded by James aka Jamesuminator\n=================================\n---------------------------------\n"
#if not enough args, usage
#if not enough args, usage
if len(sys.argv) < 2:
print "Usage: %s [folder] {outfile}\nif no outfile given, outfile is [folder].pac" % sys.argv[0]
return -1

2
README.md

@ -1,3 +1,3 @@ @@ -1,3 +1,3 @@
# PacTools
Cross-platform update of Jamesuminator's DMC3 Pac Tools
Cross-platform update of Jamesuminator's DMC3 Pac Tools and Cheburat0rr's updates

Loading…
Cancel
Save