Version 1.2.7 Release
1. Now supports UV for ESO static meshes
2. Added Support for Bauldrs Gate 3 .PAK files archive - has known issue with LowTex.pak - files are extracted but they arent usable , seem to be missing headers at the very least, anyway i dont have any plans to try and get them working.
edit:
I forgot to add that in order to get UV for ESO static meshes i added a game tag,
GAME_TAG_ESO_STATIC = 1 since there was no way for the script to tell the diffrence between these meshes and any other.
its currently on by deafult and should not cause any issues for most games, but if any game get distorted UV try diabling it.
The Support for BG3 .PAK was added, to make script a bit more about BG3 which was my main reason for making it, and to get some practice with Archives and lz4 compression.
I have a weird issue with extractor, maybe someone can help me figure out what the issue is.
as you can see in gif below, when i double click file for export in runs thru the entire script without actually exporting the data.
i can then export normaly, and when i close the extractor it again runs thru the entire script without actually exporting the data.
as you can imagine for big files it causes a huge delay in loading and when closing as we actually run thru the file 3 times.
Extractor code:
Code: Select all
from os.path import *
from math import *
from inc_noesis import *
import struct
import os
import io
def registerNoesisTypes():
handle = noesis.register("Bauldrs Gate 3 Archive", ".pak")
noesis.setHandlerExtractArc(handle, extractPAK)
#opens debug consle
noesis.logPopup()
return 1
def noepyCheckType(data):
'''Verify that the format is supported by this plugin. Default yes'''
return 1
#get file and directory names from string
def getfilename(name):
array = name.split('/')
filename = array[len(array)-1]
num = len(name) - len(filename)
directoryname = name[:num]
return filename, directoryname
def extractPAK(fileName, fileLen, justChecking):
def extractPAK(fileName, fileLen, justChecking):
with open(fileName, "rb") as f:
if justChecking:
return 1
f.seek(4,0) # magic
version = struct.unpack("<I",f.read(4))[0]
#Get file names and parameters
table_offset = struct.unpack("<Q",f.read(8))[0]
f.seek(table_offset,0)
NumFiles = struct.unpack("<I",f.read(4))[0]
CompressedSize = struct.unpack("<I",f.read(4))[0]
#Save current location
TableOffset = f.tell()
UncompressedSize = NumFiles * 296
#Decompress using lz4.block format
DecompressedData = rapi.decompLZ4(f.read(CompressedSize),UncompressedSize)
#Convert data to IO format
DecompressStream = NoeBitStream(bytes(DecompressedData), NOE_LITTLEENDIAN)
for i in range(NumFiles):
string = noeStrFromBytes(DecompressStream.readBytes(256), "UTF8")
offset = DecompressStream.readUInt64()
CompressedSize = DecompressStream.readUInt64()
UncompressedSize = DecompressStream.readUInt64()
dummy = DecompressStream.readUInt64()
crc = DecompressStream.readUInt()
dummy = DecompressStream.readUInt()
f.seek(offset,0)
#if file is compressed
if UncompressedSize != 0 and fileName[-10:] != 'LowTex.pak':
FileDecompressedData = rapi.decompLZ4(f.read(CompressedSize),UncompressedSize)
else:
#data is not compressed
#print("uncompressed file" + string)
FileDecompressedData = f.read(CompressedSize)
filename, directoryname = getfilename(string)
print("{} {}".format(i,directoryname + filename))
rapi.exportArchiveFile(directoryname + filename , FileDecompressedData)
return 1