diff --git a/getting_dialog.py b/getting_dialog.py index 319e244..90f472d 100644 --- a/getting_dialog.py +++ b/getting_dialog.py @@ -12,6 +12,16 @@ def read_until_null(indx: int, data: tuple) -> int: end += 2 return end +def read_until_space(indx: int, data: tuple) -> int: + end = indx + while end + 1 < len(data): + ## Read 2 bytes at a time until null found + if data[end:end+2] == b"\x4F\x00": + break + end += 2 + return end + + # 8 bytes at a time cd_db = {} def get_props(): @@ -65,6 +75,10 @@ j_name_data = Path(f"YGO_2020/main/howto_db/howtoplay_{language_code}.bin").read print("now what?") +count_of_items = int.from_bytes(e_name_data[0:4], byteorder='big') # 202 +## 202 * 8 = 1616 (Thats about where this started) + + help_dump = {} i_e = 1624 i_j = 1624 @@ -100,6 +114,30 @@ for r in range(0,len(name_data),8): read_until_null(1624,name_data) name_data[1624:read_until_null(1624,name_data)].decode("utf-16be", errors="replace") + +language_code = 'E' +script_data = Path(f"YGO_2020/main/scriptdata_{language_code}.bin").read_bytes() # Get all the bytes + + +offset = struct.unpack(" bytes; +# file.read((char*)(bytes.data()),4); +# value = bytes[0] | (bytes[1]<<8) | (bytes[2]<<16) | (bytes[3]<<24); +# return value; +# } +# Long ReadLong(std::ifstream &file){ +# Long value; +# std::array bytes; +# file.read((char*)(bytes.data()),8); +# value = bytes[0] | (bytes[1]<<8) | (bytes[2]<<16) | (bytes[3]<<24) | (bytes[4]<<32) | (bytes[5]<<40) | (bytes[6]<<48) | (bytes[7]<<56); +# return value; +# } + + # if (scriptFile.is_open()){ + # Long pointerToPointers=ReadLong(scriptFile); + # Int titleCount=ReadInt(scriptFile); + # Int scriptBlockCount=ReadInt(scriptFile); + # std::vector titleStartPos; + # std::vector titleEndPos; + # std::vector titlePointer; + # for (Int i=0; i titleNames; + # for (Int i=0; i > script; + # for (Int i=0; i< titleCount; i++){ + # std::vector scriptBlocks; + # Int blockCount=titleEndPos[i]-titleStartPos[i]+1; + # int pointer; + # for (Int j=0; j