diff --git a/fast64_internal/sm64_geolayout_constants.py b/fast64_internal/sm64_geolayout_constants.py index b821489..28a228e 100644 --- a/fast64_internal/sm64_geolayout_constants.py +++ b/fast64_internal/sm64_geolayout_constants.py @@ -88,8 +88,8 @@ nodeCmds = [ ] geoCmdStatic = { - 0x04: [0x00, 0x01, 0x03, 0x04, 0x05, 0x09, 0x0B, 0x0C, 0x17, 0x20], - 0x08: [0x02, 0x0D, 0x0E, 0x12, 0x14, 0x15, 0x16, 0x18, 0x19], + 0x04: [0x01, 0x03, 0x04, 0x05, 0x09, 0x0B, 0x0C, 0x17, 0x20], + 0x08: [0x00, 0x02, 0x0D, 0x0E, 0x12, 0x14, 0x15, 0x16, 0x18, 0x19], 0x0C: [0x08, 0x13, 0x1C], 0x14: [0x0F], } diff --git a/fast64_internal/sm64_geolayout_parser.py b/fast64_internal/sm64_geolayout_parser.py index 444de06..d9774b4 100644 --- a/fast64_internal/sm64_geolayout_parser.py +++ b/fast64_internal/sm64_geolayout_parser.py @@ -180,7 +180,12 @@ def parseNode(romfile, geoStartAddress, currentAddress, currentCmd, jumps, armatureObj = armatureMeshTuple[0] switchLevel = switchCount - if currentCmd[0] == GEO_BRANCH and not ignoreNode: # 0x02 + if currentCmd[0] == GEO_BRANCH_STORE and not ignoreNode: #0x00 + currentAddress = parseBranchStore(romfile, currentCmd, currentAddress, + jumps, segmentData = segmentData) + singleChildStack.append(False) + nodeIndex.append(0) + elif currentCmd[0] == GEO_BRANCH and not ignoreNode: # 0x02 currentAddress = parseBranch(romfile, currentCmd, currentAddress, jumps, segmentData = segmentData) singleChildStack.append(False) @@ -687,6 +692,19 @@ def parseBranch(romfile, currentCmd, currentAddress, jumps, return currentAddress +def parseBranchStore(romfile, currentCmd, currentAddress, jumps, + segmentData = None): + print("BRANCH AND STORE " + hex(currentAddress)) + romfile.seek(currentAddress) + postJumpAddr = currentAddress + getGeoLayoutCmdLength(*currentCmd) + currentCmd = romfile.read(getGeoLayoutCmdLength(*currentCmd)) + + jumps.append(postJumpAddr) + currentAddress = decodeSegmentedAddr(currentCmd[4:8], + segmentData = segmentData) + + return currentAddress + def parseReturn(currentCmd, currentAddress, jumps): print("RETURN " + hex(currentAddress)) currentAddress = jumps.pop()