diff --git a/asm/non_matchings/unknown_032760/func_8003B368.s b/asm/non_matchings/unknown_032760/func_8003B368.s index 3024ad1c..0c54edd2 100644 --- a/asm/non_matchings/unknown_032760/func_8003B368.s +++ b/asm/non_matchings/unknown_032760/func_8003B368.s @@ -1,3 +1,8 @@ +.rdata +glabel D_800E5FA0 +.asciz "Illegal door no!!!\n" + +.text glabel func_8003B368 /* 03BF68 8003B368 27BDFFE0 */ addiu $sp, $sp, -0x20 /* 03BF6C 8003B36C AFBF001C */ sw $ra, 0x1c($sp) diff --git a/asm/non_matchings/unknown_032760/func_8003B7CC.s b/asm/non_matchings/unknown_032760/func_8003B7CC.s index 44a1e1d2..d71d3ac2 100644 --- a/asm/non_matchings/unknown_032760/func_8003B7CC.s +++ b/asm/non_matchings/unknown_032760/func_8003B7CC.s @@ -1,3 +1,8 @@ +.rdata +glabel D_800E5FB4 +.asciz "Illegal door no!!!\n" + +.text glabel func_8003B7CC /* 03C3CC 8003B7CC 27BDFFD8 */ addiu $sp, $sp, -0x28 /* 03C3D0 8003B7D0 AFBF001C */ sw $ra, 0x1c($sp) diff --git a/asm/non_matchings/unknown_032760/func_8003C644.s b/asm/non_matchings/unknown_032760/func_8003C644.s index 90612073..ddda579e 100644 --- a/asm/non_matchings/unknown_032760/func_8003C644.s +++ b/asm/non_matchings/unknown_032760/func_8003C644.s @@ -1,3 +1,8 @@ +.rdata +glabel D_800E5FC8 +.asciz "Illegal door no!!!\n" + +.text glabel func_8003C644 /* 03D244 8003C644 27BDFFD8 */ addiu $sp, $sp, -0x28 /* 03D248 8003C648 AFBF001C */ sw $ra, 0x1c($sp) diff --git a/src/unknown_032760.c b/src/unknown_032760.c index 3f8d3ddc..e636a69b 100644 --- a/src/unknown_032760.c +++ b/src/unknown_032760.c @@ -116,14 +116,8 @@ const u32 D_800E5F80[] = { 0x80033BB4 }; -// Not sure if these are actually strings. Might just be padding. -const char D_800E5F94[] = ""; -const char D_800E5F98[] = ""; -const char D_800E5F9C[] = ""; - -const char D_800E5FA0[] = "Illegal door no!!!\n"; -const char D_800E5FB4[] = "Illegal door no!!!\n"; -const char D_800E5FC8[] = "Illegal door no!!!\n"; +// File boundary padding +const s32 padding[] = { 0, 0, 0 }; /*********************************/ diff --git a/tools/python/rodata_move.py b/tools/python/rodata_move.py index a2dfb749..51421cb0 100755 --- a/tools/python/rodata_move.py +++ b/tools/python/rodata_move.py @@ -57,12 +57,16 @@ def adjustAsmFile(asmFilepath, refs): raise Exception('Cannot add to file "' + asmFilepath + '" since it already has .late_rodata in it!') asmLines = asmFile.split('\n') replaces = [] - cur = 0 - asmLines.insert(cur, '.late_rodata'); cur += 1 + + rodata = '' + lateRodata = '' + for index, ref in enumerate(refs): - asmLines.insert(cur, 'glabel ' + ref[1]); cur += 1 - if ref[0] == 'double' or ref[0] == 'float' or ref[0] == 'asciz': - asmLines.insert(cur, '.' + ref[0] + ' ' + ref[2]); cur += 1 + if ref[0] == 'asciz': + rodata += 'glabel ' + ref[1] + '\n' + rodata += '.' + ref[0] + ' ' + ref[2] + '\n' + elif ref[0] == 'double' or ref[0] == 'float': + lateRodata += '.' + ref[0] + ' ' + ref[2] + '\n' elif ref[0] == 'table': replaces.append((ref[1], 'jpt' + ref[1][1:])) tblWords = '.word L' + ref[2][0] @@ -80,7 +84,7 @@ def adjustAsmFile(asmFilepath, refs): asmLines.insert(i, 'glabel L' + word) break doneWords.append(word) - asmLines.insert(cur, tblWords); cur += 1 + lateRodata += tblWords + '\n' if index < len(refs) - 1 and ref[0] != 'double' and refs[index + 1][0] == 'double': addPadding = False if ref[0] == 'float': @@ -92,9 +96,13 @@ def adjustAsmFile(asmFilepath, refs): else: addPadding = tableSizeAlignment == 0 or tableSizeAlignment == 2 if addPadding: - asmLines.insert(cur, '.word 0 # Padding'); cur += 1 # Insert padding before the next double. - asmLines.insert(cur, ''); cur += 1 - asmLines.insert(cur, '.text'); cur += 1 + lateRodata += '.word 0 # Padding\n' # Insert padding before the next double. + outData = '' + if len(rodata) > 0: + outData += '.rdata\n' + rodata + '\n' + if len(lateRodata) > 0: + outData += '.late_rodata\n' + lateRodata + '\n' + asmLines.insert(0, outData + '.text'); asmOut = '\n'.join(asmLines) for rep in replaces: asmOut = asmOut.replace(rep[0], rep[1]) @@ -128,20 +136,20 @@ def convertFile(cFilepath): if lineType == 0: pass elif lineType == 1: # Literal string - # try: - # strMatch = getMatches(line, C_STRING_REGEX)[0] - # strLabel = strMatch[1][0] - # strValue = strMatch[1][1] - # # Check if the string has a reference somewhere - # getAsmFileReferenceForLabel(filename, strLabel) - # hasProcessed = True - # bottomLine = curLine - # asmData.insert(0, ('asciz', strLabel, strValue, bottomLine)) - # except: - print('Currently cannot process literal string: ') - print(line) - stoppedPremature = True - break + try: + strMatch = getMatches(line, C_STRING_REGEX)[0] + strLabel = strMatch[1][0] + strValue = strMatch[1][1] + # Check if the string has a reference somewhere + getAsmFileReferenceForLabel(filename, strLabel) + hasProcessed = True + bottomLine = curLine + asmData.insert(0, ('asciz', strLabel, strValue, bottomLine)) + except: + print('Currently cannot process literal string: ') + print(line) + stoppedPremature = True + break elif lineType == 2: # Literal float floatMatch = getMatches(line, C_FLOAT_REGEX)[0] floatLabel = floatMatch[1][0] @@ -205,8 +213,9 @@ def convertFile(cFilepath): for ref in asmRefs[asmFilepath]: asmBottomLine = min(asmBottomLine, ref[3]) if ONLY_THE_FIRST_ASM_FILE: - # print(bottomLine, asmBottomLine) + print(bottomLine, asmBottomLine) bottomLine = asmBottomLine + stoppedPremature = True break # print(asmRefs) if hasProcessed and not NO_OUTPUT: