diff options
| author | jdflyer <jdflyer10@gmail.com> | 2023-02-15 07:02:56 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-15 07:02:56 -0700 |
| commit | 5ce19327dbd64b0dab2afd41aed260a297ce9a2a (patch) | |
| tree | cf0e91e5216fc43de4022dde192f2825ec205f78 /tools | |
| parent | 82ff815386f2ab07481d11ecfe3730849eb4e2ec (diff) | |
Fix REL Spelling + Tool Improvements (#285)
* AST conversion library
* Improved Shifted lcf
* copydate and frameworkF.str
* Fix REL Capitalization
* Fix Packaging
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/lcf.py | 215 | ||||
| -rw-r--r-- | tools/libast/__init__.py | 1 | ||||
| -rw-r--r-- | tools/libast/libast.py | 417 | ||||
| -rw-r--r-- | tools/makerel.py | 2 | ||||
| -rw-r--r-- | tools/package_game_assets.py | 32 |
5 files changed, 615 insertions, 52 deletions
diff --git a/tools/lcf.py b/tools/lcf.py index c75d96877b..04856d09ac 100644 --- a/tools/lcf.py +++ b/tools/lcf.py @@ -32,6 +32,130 @@ VERSION = "1.0" # load the symbol definition file for main.dol sys.path.append("defs") +FUNCITON_SYMBOLS = """func_802A3C3C +func_802E9368 +func_802FAED0 +func_802A2474 +func_80339CB0 +func_802F5DD0 +func_802E9260 +func_8001505C +func_8027EEB0 +func_802A4A80 +func_8007914C +func_802BF660 +func_802A2328 +func_80280588 +func_8027833C +func_802D2DF0 +func_80078B78 +func_802A0A8C +func_802F5E88 +func_802D1F50 +func_80282200 +func_80048970 +func_802C0074 +func_80078B80 +func_802E9488 +func_802F7264 +func_802F6D18 +func_802BF890 +func_80271BA8 +func_802E90C0 +func_802E1D08 +func_80267F80 +func_8028421C +func_80284204 +func_802A9EE8 +func_80273724 +func_80078D5C +func_80278320 +func_80078B70 +func_802E9564 +func_802BD338 +func_8027936C +func_802E1C54 +func_8029F03C +func_80267D54 +func_802C4928 +func_802BDCB0 +func_802FFBC4 +func_803012CC +func_802AABF4 +func_802E90E4 +func_802BBCDC +func_80301FC8 +func_80304EF0 +func_802A2FEC +func_80070018 +func_802BBD18 +func_802A69D8 +func_802D45E4 +func_802A69F8 +func_802BF898 +func_802E4194 +func_802BBD94 +func_802FDF88 +func_802841F8 +func_80279364 +func_80078D54 +func_802807E0 +func_8029F650 +func_80264A5C +func_802D9B44 +func_80015084 +func_80077574 +func_802AB538 +func_8028202C +func_80281E5C +func_802FED84 +func_802E980C +func_802DCCD0 +func_80079154 +func_80281EC8 +func_8027DEBC +func_802C0190 +func_802E9B0C +func_802FB338 +func_802F5D40 +func_80041488 +func_802841EC +func_802D32B0 +func_802A1B48 +func_802FA928 +func_802AAC3C +func_80078D4C +func_802E9BE8 +func_802C5284 +func_802A319C +func_80282094 +func_802D1EFC +func_802585A4 +func_80078B88 +func_80264A54 +func_80264A64 +func_802F5F08 +func_802E987C +func_802A0768 +func_80284234 +func_802CCFF8 +func_80302164 +func_80282118 +func_80264A4C +func_802782B4 +func_80284210 +func_802782EC +func_80284228 +func_80280808 +func_80041480 +func_802A0B64 +func_8007915C +func_802A3104 +func_802FC800 +func_802FAA5C +func_802782D0 +func_80301994 +func_80282284""" def lcf_generate(output_path,shiftable,map_file): """Script for generating .lcf files""" @@ -43,6 +167,8 @@ def lcf_generate(output_path,shiftable,map_file): map_file = open(map_file,'r') map_file = map_file.read() map_file = map_file.splitlines() + else: + print("Generating LCF") # load symbols from compiled files symbols = [] @@ -94,31 +220,32 @@ def lcf_generate(output_path,shiftable,map_file): base_names = set(module0.SYMBOL_NAMES.keys()) main_names = set([sym.name for sym in symbols]) names = base_names - main_names - for name in names: - symbol = module0.SYMBOLS[module0.SYMBOL_NAMES[name]] - if symbol["type"] == "StringBase": # @stringBase0 is handled below - continue - if symbol["type"] == "LinkerGenerated": # linker handles these symbols - continue - - addr = symbol['addr'] - if shiftable==True: - for line in map_file: - literals_found = [] - if type(symbol['name'])==str and line.find(' '+symbol['name']+' ')!=-1 and symbol['name'][0] != "@" or type(symbol['label']) == str and line.find(' '+symbol['label']+' ')!=-1: - linesplit = line.split() - if len(linesplit) > 3 and linesplit[2]!="NOT": - if line.find("lit_")!=-1: - lbl = symbol['label'] - for literal in literals_found: - if literal == lbl: - print("Warning! two literals with the same name found!\n"+lbl) - literals_found.append(symbol['label']) - addr = int(linesplit[2],16) - file.write(f"\t\"{symbol['label']}\" = 0x{addr:08X};\n") - else: + if shiftable == False: + for name in names: + symbol = module0.SYMBOLS[module0.SYMBOL_NAMES[name]] + if symbol["type"] == "StringBase": # @stringBase0 is handled below + continue + if symbol["type"] == "LinkerGenerated": # linker handles these symbols + continue + + addr = symbol['addr'] file.write(f"\t\"{symbol['label']}\" = 0x{addr:08X};\n") - + elif shiftable == True: + realNames = [] + symInfo = [] + for func in FUNCITON_SYMBOLS.splitlines(): + symbol = module0.SYMBOLS[module0.SYMBOL_NAMES[func]] + realNames.append(symbol['name']) + symInfo.append({'func': func, 'symbol': symbol['name']}) + for line in map_file: + split = line.split() + if len(split) >5 and split[2] != 'NOT': + sym = split[5] + if sym in realNames: + #print(line) + file.write(f"\t\"{symInfo[realNames.index(sym)]['func']}\" = 0x{int(split[2],16):08X};\n") + + file.write("\n") # @stringBase0 is generated by the compiler. The dol2asm is using a trick to @@ -127,20 +254,32 @@ def lcf_generate(output_path,shiftable,map_file): # So all references will be to the new symbol, thus the linker will think # that the @stringBase0 symbol is never used and strip it. file.write("\t/* @stringBase0 */\n") - for x in module0.SYMBOLS: - if x["type"] == "StringBase": - addr = x['addr'] - if shiftable==True: - obj = (module0.TRANSLATION_UNITS[x['tu']].split('/')[-1])+'.o' - #print(obj) - for line in map_file: - if line.find(' '+obj)!=-1 and line.find(' '+x['name']+' ')!=-1 or line.find('\t'+obj)!=-1 and line.find(' '+x['name']+' ')!=-1: - linesplit = line.split() - if len(linesplit) > 3: - addr = int(linesplit[2],16) - file.write("\t\"%s\" = 0x%08X;\n" % (x['label'], addr)) - else: + if shiftable == False: + for x in module0.SYMBOLS: + if x["type"] == "StringBase": + addr = x['addr'] file.write("\t\"%s\" = 0x%08X;\n" % (x['label'], addr)) + elif shiftable == True: + stringBaseObjs = [] + stringBaseSyms = [] + for x in module0.SYMBOLS: + if x['type'] == 'StringBase': + #print(x) + stringBaseObjs.append((module0.TRANSLATION_UNITS[x['tu']].split('/')[-1])+'.o') + stringBaseSyms.append(x['label']) + for line in map_file: + split = line.split() + if len(split) > 6 and split[2] != 'NOT': + sym = split[5] + tu = split[6] + if tu[-2:] == '.a': + tu = split[7] + if sym == '@stringBase0' and tu in stringBaseObjs: + addr = int(split[2],16) + #print(tu) + file.write("\t\"%s\" = 0x%08X;\n" % (stringBaseSyms[stringBaseObjs.index(tu)], addr)) + + file.write("}\n") file.write("\n") @@ -307,7 +446,7 @@ def get_symbols_from_object_file(obj): def load_archive(ar_path): symbols = [] - print(ar_path) + #print(ar_path) archive = libar.read(ar_path) for path, data in archive.files: obj = libelf.load_object_from_file(None, path, io.BytesIO(data)) diff --git a/tools/libast/__init__.py b/tools/libast/__init__.py new file mode 100644 index 0000000000..5f47cb0b32 --- /dev/null +++ b/tools/libast/__init__.py @@ -0,0 +1 @@ +from .libast import *
\ No newline at end of file diff --git a/tools/libast/libast.py b/tools/libast/libast.py new file mode 100644 index 0000000000..955f0dfa69 --- /dev/null +++ b/tools/libast/libast.py @@ -0,0 +1,417 @@ +# adpcm encoding currently doesn't work well, so this isn't being integrated into the assets scripts +# however, this can be used to convert all ast files to a wav file and to encode a wav file to a pcm16 ast file +import struct +import os +import sys +import dataclasses +import json + +DSPADPCM_FILTER = [ + [0, 0], + [2048, 0], + [0, 2048], + [1024, 1024], + [4096, -2048], + [3584, -1536], + [3072, -1024], + [4608, -2560], + [4200, -2248], + [4800, -2300], + [5120, -3072], + [2048, -2048], + [1024, -1024], + [-1024, 1024], + [-1024, 0], + [-2048, 0], +] + + +@dataclasses.dataclass +class AST_Header: + identifier: int + fileSize: int + format: int # 0 = ADPCM, 1 = PCM16 + bitDepth: int + numChannels: int + unk_1: int + sampleRate: int + totalSamples: int + loopStartSample: int + loopEndSample: int + blockSize: int + unk_2: int + unk_3: int + + +@dataclasses.dataclass +class AST_Json: + blockSize: int + loopStartSample: int + loopEndSample: int + encodingFormat: int + loops: bool + + +def testWriteFunction(name, data): + open(name, "wb").write(data) + + +def clampSample(sample): + if sample > 32767: + sample = 32767 + elif sample < -32767: + sample = -32767 + return sample + + +def convert_to_wav(name, astData, writeFunction): + header = struct.unpack(">IIHHHHIIIIIII", astData[:44]) + astHeader = AST_Header(*header) + print(astHeader) + if astHeader.bitDepth != 16: + print("Error: libast only supports 16 bit audio!") + return None + nextBlockPosition = 0x40 + audioData = [] + for channel in range(astHeader.numChannels): + audioData.append([]) + while nextBlockPosition < astHeader.fileSize + 0x40: + currentBlockPosition = nextBlockPosition + blockHeader = struct.unpack( + ">II", astData[currentBlockPosition : currentBlockPosition + 8] + ) + if blockHeader[0] != 1112294219: + print("Block not found at position " + hex(currentBlockPosition)) + break + blockSize = blockHeader[1] + + nextBlockPosition = ( + currentBlockPosition + 32 + (blockSize * astHeader.numChannels) + ) + print( + "current is " + + str(currentBlockPosition) + + " next is " + + str(nextBlockPosition) + + " full is " + + str(astHeader.fileSize + 0x40) + + " size is " + + str(blockSize) + ) + for channel in range(astHeader.numChannels): + blockDataIndex = currentBlockPosition + 32 + (blockSize * channel) + if astHeader.format == 0: # adcpm + endIndex = blockDataIndex + ((blockSize // 9) * 9) + for i in range(blockDataIndex, endIndex, 9): + delta = 1 << ((astData[i] >> 4) & 0b1111) + id = astData[i] & 0b1111 + data = [] + for j in range(8): + data.append((astData[i + 1 + j] >> 4) & 0b1111) + data.append((astData[i + 1 + j]) & 0b1111) + for nibble in data: + if nibble >= 8: + nibble = nibble - 16 + hist = 0 + hist2 = 0 + if len(audioData[channel]) == 1: + hist = audioData[channel][-1] + elif len(audioData[channel]) > 1: + hist = audioData[channel][-1] + hist2 = audioData[channel][-2] + sample = (delta * nibble) << 11 + sample = sample + ( + (hist * DSPADPCM_FILTER[id][0]) + + (hist2 * DSPADPCM_FILTER[id][1]) + ) + sample = sample >> 11 + sample = clampSample(sample) + audioData[channel].append(sample) + elif astHeader.format == 1: # pcm16 + for i in range(blockDataIndex, blockDataIndex + blockSize, 2): + audioData[channel].append( + struct.unpack(">h", astData[i : i + 2])[0] + ) + if nextBlockPosition == astHeader.fileSize + 0x40: + break + + # done parsing data + + subChunk2Size = len(audioData[0]) * 2 * astHeader.numChannels + wavHeader = struct.pack( + "<ccccIccccccccIHHIIHHccccI", + bytes("R", "ascii"), + bytes("I", "ascii"), + bytes("F", "ascii"), + bytes("F", "ascii"), + 36 + subChunk2Size, + bytes("W", "ascii"), + bytes("A", "ascii"), + bytes("V", "ascii"), + bytes("E", "ascii"), + bytes("f", "ascii"), + bytes("m", "ascii"), + bytes("t", "ascii"), + bytes(" ", "ascii"), + 16, + 1, + astHeader.numChannels, + astHeader.sampleRate, + 2 * astHeader.numChannels * astHeader.sampleRate, + 2 * astHeader.numChannels, + 16, + bytes("d", "ascii"), + bytes("a", "ascii"), + bytes("t", "ascii"), + bytes("a", "ascii"), + subChunk2Size, + ) + + wavFile = bytearray(wavHeader) + + print("writing") + + for i in range(len(audioData[0])): + if i % 100000 == 0: + print(i) + for channel in audioData: + wavFile.append(channel[i] & 0xFF) + wavFile.append((channel[i] >> 8) & 0xFF) + + loops = False + if astHeader.unk_1 == 0xFFFF: + loops = True + jsonData = AST_Json( + astHeader.blockSize, + astHeader.loopStartSample, + astHeader.loopEndSample, + astHeader.format, + loops, + ) + jsonDataString = json.dumps(dataclasses.asdict(jsonData)) + + split = os.path.splitext(name) + open(split[0] + ".json", "w").write(jsonDataString) + writeFunction(split[0] + ".wav", wavFile) + + +def wav_to_ast(sourceWav, convertFunction): + wavData = open(sourceWav, "rb").read() + jsonDataString = open(os.path.splitext(sourceWav)[0] + ".json", "r").read() + jsonData = json.loads(jsonDataString) + print(jsonData) + headerData = struct.unpack("<HI", wavData[0x16:0x1C]) + blockSize = jsonData["blockSize"] + loopStartSample = jsonData["loopStartSample"] + loopEndSample = jsonData["loopEndSample"] + encodingFormat = jsonData["encodingFormat"] + numChannels = headerData[0] + sampleRate = headerData[1] + astData = bytearray(20) + wavDataPos = 0x2C + + loops = 0 + if jsonData["loops"] == True: + loops = 0xFFFF + + sampleNum = 0 + if encodingFormat == 1: # pcm16 + exitLoop = False + while exitLoop == False: + thisBlockSize = blockSize + if len(wavData) - wavDataPos < (blockSize * numChannels): + thisBlockSize = (len(wavData) - wavDataPos) // numChannels + exitLoop = True + astData.append(ord("B")) + astData.append(ord("L")) + astData.append(ord("C")) + astData.append(ord("K")) + # doing this is faster than adding two bytearrays together + astData.append((thisBlockSize >> 24) & 0xFF) + astData.append((thisBlockSize >> 16) & 0xFF) + astData.append((thisBlockSize >> 8) & 0xFF) + astData.append((thisBlockSize) & 0xFF) # Write as big endian + print(thisBlockSize) + for i in range(24): + astData.append(0) + sampleNum = sampleNum + (thisBlockSize // 2) + for channel in range(numChannels): + for i in range( + 0, thisBlockSize * numChannels, 2 * numChannels + ): # convert little to big endian + astData.append(wavData[wavDataPos + i + 1 + (channel * 2)]) + astData.append(wavData[wavDataPos + i + (channel * 2)]) + wavDataPos = wavDataPos + (thisBlockSize * numChannels) + elif encodingFormat == 0: # adpcm + exitLoop = False + sampleList = [] + for channel in range(numChannels): + sampleList.append([]) + for i in range( + 0, len(wavData) - wavDataPos, 2 * numChannels + ): # convert little to big endian + sampleList[channel].append( + (wavData[i + 1 + (channel * 2)] << 8) | (wavData[i + (channel * 2)]) + ) + for i in range(16 - (len(sampleList) % 16)): + sampleList[channel].append(0) + + last = 0 + penult = 0 + while exitLoop == False: + thisBlockSize = blockSize + if loopEndSample - sampleNum <= ((blockSize // 9) * 16): + thisBlockSize = ((loopEndSample - sampleNum) // 16) * 9 + exitLoop = True + astData.append(ord("B")) + astData.append(ord("L")) + astData.append(ord("C")) + astData.append(ord("K")) + # doing this is faster than adding two bytearrays together + astData.append((thisBlockSize >> 24) & 0xFF) + astData.append((thisBlockSize >> 16) & 0xFF) + astData.append((thisBlockSize >> 8) & 0xFF) + astData.append((thisBlockSize) & 0xFF) # Write as big endian + print(thisBlockSize) + for i in range(24): + astData.append(0) + sampleNum = sampleNum + ((thisBlockSize // 9) * 16) + print(sampleNum) + for channel in range(numChannels): + for sample in range( + sampleNum, sampleNum + ((thisBlockSize // 9) * 16), 16 + ): + + def getSample(sampleIndex): + if len(sampleList[channel]) > sampleIndex: + return sampleList[channel][sampleIndex] + else: + return 0 + + # code ported from https://github.com/XAYRGA/wsystool/blob/37eb357b11b2e2b80f50784d4e993713e5e00508/wsystool/bananapeel/banan_flaaf.cs#L393 + + isBlank = True + for i in range(16): + if getSample(sample + i) != 0: + isBlank = False + break + if isBlank: + for i in range(9): + astData.append(0) + continue + + coeffIndex = -1 + minerror = 0xFFFFFFFF + for coeff in range(16): + lastCoeff = DSPADPCM_FILTER[coeff][0] + penultCoeff = DSPADPCM_FILTER[coeff][1] + foundScale = -1 + coeff_error = 0 + + for current_scale in range(16): + step = 1 << current_scale + nibbleCoeff = 2048 << current_scale + success = True + coeff_error = 0 + + _last = lastCoeff + _penult = penultCoeff + + for i in range(16): + prediction = clampSample( + ((lastCoeff * _last) + (penultCoeff * _penult)) + >> 11 + ) + difference = -(prediction - getSample(sample + i)) + nibble = difference // step + + if nibble < -8 or nibble > 7: + success = False + break + + nibbleSample = nibble * nibbleCoeff + decoded = clampSample( + ( + (nibbleSample) + + (lastCoeff * _last) + + (penultCoeff * _penult) + ) + >> 11 + ) + + _penult = _last + _last = decoded + + coeff_error = coeff_error + abs(difference) + + if success: + foundScale = current_scale + break + + if foundScale < 0: + continue + + if coeff_error < minerror: + minerror = coeff_error + coeffIndex = coeff + scale = foundScale + + lastCoeff = DSPADPCM_FILTER[coeffIndex][0] + penultCoeff = DSPADPCM_FILTER[coeffIndex][1] + + step = 1 << scale + + nibbles = [int] * 16 + for i in range(16): + prediction = clampSample( + ((lastCoeff * last) + (penultCoeff * penult)) >> 11 + ) + difference = -(prediction - getSample(sample + i)) + nibbles[i] = difference // step + nibbleSample = nibbles[i] * (2048 << scale) + decoded = clampSample( + nibbleSample + (lastCoeff * last) + (penultCoeff * penult) + >> 11 + ) + + penult = last + last = decoded + + astData.append(((scale & 0xF) << 4) | coeffIndex) + for i in range(8): + astData.append( + ((nibbles[i * 2] & 0xF) << 4) + | ((nibbles[(i * 2) + 1] & 0xF)) + ) + + astHeader = struct.pack( + ">IIHHHHIIIIIII", + 1398035021, + len(astData) - 20, + encodingFormat, + 16, + numChannels, + loops, + sampleRate, + loopEndSample, + loopStartSample, + loopEndSample, + blockSize, + 0, + 0x7F000000, + ) + + astFile = astHeader + astData + split = os.path.splitext(sourceWav) + convertFunction(split[0] + ".ast", astFile) + + +if __name__ == "__main__": + if len(sys.argv) >= 2: + split = os.path.splitext(sys.argv[1]) + if split[1] == ".ast": + convert_to_wav( + sys.argv[1], open(sys.argv[1], "rb").read(), testWriteFunction + ) + elif split[1] == ".wav": + wav_to_ast(sys.argv[1], testWriteFunction) diff --git a/tools/makerel.py b/tools/makerel.py index 4ed4fb3050..1a1a41ace1 100644 --- a/tools/makerel.py +++ b/tools/makerel.py @@ -213,7 +213,7 @@ class StringList: def write(self): if len(self.data) > 0: with open(self.output_path, "w") as file: - file.write(self.data) + file.write(self.data.replace(' ','\0')) @dataclass diff --git a/tools/package_game_assets.py b/tools/package_game_assets.py index d8f186c5f0..c359605a39 100644 --- a/tools/package_game_assets.py +++ b/tools/package_game_assets.py @@ -5,7 +5,7 @@ import extract_game_assets from pathlib import Path import libyaz0 import libarc -import threading +from datetime import datetime def getMaxDateFromDir(path): @@ -99,9 +99,9 @@ aMemRels = """d_a_alldie.rel d_a_andsw2.rel d_a_bd.rel d_a_canoe.rel -d_a_cstaf.rel +d_a_cstaF.rel d_a_demo_item.rel -d_a_door_bossl1.rel +d_a_door_bossL1.rel d_a_econt.rel d_a_e_dn.rel d_a_e_fm.rel @@ -133,15 +133,15 @@ d_a_obj_cboard.rel d_a_obj_digplace.rel d_a_obj_eff.rel d_a_obj_fmobj.rel -d_a_obj_gptaru.rel +d_a_obj_gpTaru.rel d_a_obj_hhashi.rel d_a_obj_kanban2.rel d_a_obj_kbacket.rel d_a_obj_kgate.rel d_a_obj_klift00.rel -d_a_obj_ktonfire.rel +d_a_obj_ktOnFire.rel d_a_obj_ladder.rel -d_a_obj_lv2candle.rel +d_a_obj_lv2Candle.rel d_a_obj_magne_arm.rel d_a_obj_metalbox.rel d_a_obj_mgate.rel @@ -149,8 +149,8 @@ d_a_obj_nameplate.rel d_a_obj_ornament_cloth.rel d_a_obj_rope_bridge.rel d_a_obj_stick.rel -d_a_obj_stonemark.rel -d_a_obj_swallshutter.rel +d_a_obj_stoneMark.rel +d_a_obj_sWallShutter.rel d_a_obj_swpropeller.rel d_a_obj_swpush5.rel d_a_obj_yobikusa.rel @@ -160,7 +160,7 @@ d_a_sq.rel d_a_swc00.rel d_a_tag_ajnot.rel d_a_tag_attack_item.rel -d_a_tag_cstasw.rel +d_a_tag_CstaSw.rel d_a_tag_gstart.rel d_a_tag_hinit.rel d_a_tag_hjump.rel @@ -274,24 +274,24 @@ def copyRelFiles(gamePath, buildPath, aMemList, mMemList): "Folder:rels/amem/\nFolder:rels/mmem/\nFolder:rels/./\nFolder:rels/../\n" ) for i, rel in enumerate(aMemRels.splitlines()): - filesTxtData = filesTxtData + str(i + 4) + ":rels/amem/" + rel + ":0xa500\n" + filesTxtData = filesTxtData + str(i + 4) + ":rels/amem/" + rel.lower() + ":0xa500\n" filesTxtData = filesTxtData + "Folder:rels/amem/./\nFolder:rels/amem/../\n" for i, rel in enumerate(mMemRels.splitlines()): - filesTxtData = filesTxtData + str(i + 83) + ":rels/mmem/" + rel + ":0xa500\n" + filesTxtData = filesTxtData + str(i + 83) + ":rels/mmem/" + rel.lower() + ":0xa500\n" filesTxtData = filesTxtData + "Folder:rels/mmem/./\nFolder:rels/mmem/../\n" open(buildPath / "RELS.arc/_files.txt", "w").write(filesTxtData) for rel in relArcPaths: for rel2 in aMemRels.splitlines(): if str(rel).find(rel2) != -1: sourceRel = open(rel, "rb").read() - open(buildPath / "RELS.arc/rels/amem/" / rel2, "wb").write( + open(buildPath / "RELS.arc/rels/amem/" / rel2.lower(), "wb").write( libyaz0.compress(sourceRel) ) break for rel2 in mMemRels.splitlines(): if str(rel).find(rel2) != -1: sourceRel = open(rel, "rb").read() - open(buildPath / "RELS.arc/rels/mmem/" / rel2, "wb").write( + open(buildPath / "RELS.arc/rels/mmem/" / rel2.lower(), "wb").write( libyaz0.compress(sourceRel) ) break @@ -338,6 +338,12 @@ def main(gamePath, buildPath, copyCode): copyRelFiles(gamePath, buildPath, aMemRels.splitlines(), mMemRels.splitlines()) + shutil.copy(buildPath/"dolzel2/frameworkF.str",buildPath/"dolzel2/game/files/str/Final/Release/frameworkF.str") + + now = datetime.now() + copydate = str(now.year)+"/"+str(now.month).zfill(2)+"/"+str(now.day).zfill(2)+" "+str(now.hour).zfill(2)+":"+str(now.minute).zfill(2)+"\n" + open(buildPath/"dolzel2/game/files/str/Final/Release/COPYDATE","w").write(copydate) + if __name__ == "__main__": pass |
