Skip to content

Commit aff3994

Browse files
committed
Add libbti and bti packaging, start libjaudio
1 parent e707193 commit aff3994

10 files changed

+1466
-1
lines changed

tools/extract_game_assets.py

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from pathlib import Path
55
import libyaz0
66
import libstage
7+
import libbti
78

89
"""
910
Extracts the game assets and stores them in the game folder
@@ -144,6 +145,9 @@ def writeFolder(parsedFstBin, i):
144145
},
145146
".dzr": {
146147
"function": libstage.extract_to_json
148+
},
149+
".bti": {
150+
"function": libbti.bti_to_png
147151
}
148152
}
149153

@@ -167,6 +171,7 @@ def writeFile(name, data):
167171
file.close()
168172
else:
169173
name = extractDef["function"](name, data, writeFile)
174+
# print(name)
170175
return name
171176

172177

tools/libarc/arc.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ def getNodeIdent(fullName):
283283
def parseDirForPack(
284284
fileDataLines, path, convertFunction, nodes, dirs, currentNode, stringTable, data
285285
):
286+
# print(currentNode.directory_index)
286287
for i in range(
287288
currentNode.directory_index,
288289
currentNode.directory_count + currentNode.directory_index,
@@ -400,12 +401,21 @@ def convert_dir_to_arc(sourceDir, convertFunction):
400401
nodes = []
401402
dirs = [None] * len(fileDataLines)
402403
stringTable = ".\0..\0"
404+
405+
numRootEntries = 0
406+
for line in fileDataLines:
407+
entry = line.split(":")[1]
408+
# Only count files and directories under the root
409+
# print(entry)
410+
if entry.startswith(rootName + "/") and entry[:len(entry)-1].count("/") == 1:
411+
numRootEntries += 1
412+
403413
nodes.append(
404414
Node(
405415
getNodeIdent("ROOT"),
406416
len(stringTable),
407417
computeHash(rootName),
408-
len(os.listdir(sourceDir / rootName)) + 2,
418+
numRootEntries,
409419
0,
410420
rootName,
411421
)

tools/libbti/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .libbti import *

0 commit comments

Comments
 (0)