-
Notifications
You must be signed in to change notification settings - Fork 0
/
Log.py
126 lines (110 loc) · 5.9 KB
/
Log.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#This module is meant to do cross module logging of stuff to look out for when importing to decomp
#and also go give general warnings and instructions for people who don't know much
import sys
from RM2CData import *
log = sys.path[0]
log = open(log+'//ImportInstructions.py','w')
log.write("""This file will contain instructions on how to import RM2C data into the sm64ex-alo repo.
First you should always copy the exported folders (/src,/levels,/sound,/text,/textures,/actors) into your repo.
Then make sure you set RM2C inside the makefile to 1
Then to build for PC use this input to terminal: "make clean && make RM2CPC"
Then to build for N64 use this input to terminal: "make clean && make -j4"
By default, due to their high variability and unique names, no actor data will be included from RM2C output, you must
go per actor and either copy data from a custom.model.inc.c file to the model.inc.c file, or change the includes in group files.
Level specific models will go into a folder inside of /actors/ with the name of the level they belong to. You must copy these folders
over to their level folders. The directory should match the target level dir, and not overwrite any files. Textures should be pre written
to the target level directories.
If you have exported custom behaviors, check the /data/ folder for exported custom behaviors with labels, and associated disassembled functions with matching labels.
These are provided for reference only, they must be manually integrated into the repo.
Below are some warnings generated by RM2C during extraction.
It is expected to have many warnings for editor files and for roms with lots of custom content.
""")
Spacer="*"*90
BadScroll=[]
Scrollerrs=[]
def InvalidScroll(level,area,scroll):
global BadScroll
global Scrollerrs
if (level,area,scroll) in BadScroll:
return
else:
BadScroll.append((level,area,scroll))
err = 'Texture Scroll Object in level {} area {} at {} has unrecognized address. Object Has been commented out.'.format(Num2Name[level],area,hex(scroll[2]))
print(err)
Scrollerrs.append(err+'\n')
LastFog=[]
Fogerrs=[]
def LevelFog(file):
global LastFog
global Fogerrs
if file in LastFog:
return
else:
LastFog.append(file)
err = 'Model file {} has fog, for editor, fog DLs are heavily edited, potential for gfx errors.'.format(file)
print(err)
Fogerrs.append(err+'\n')
UnkObjs = []
Objerrs=[]
def UnkObject(level,Area,bhv):
global UnkObjs
global Objerrs
if (level,Area,bhv) in UnkObjs:
return
else:
UnkObjs.append((level,Area,bhv))
err = 'Level {} Area {} has object {} with no known label.'.format(Num2Name[level],Area,bhv)
print(err)
Objerrs.append(err+'\n')
NewObjs = []
def NewObject(bhv):
global NewObjs
err = 'Behavior {} has custom values or new values inside of it.'.format(bhv)
print(err)
NewObjs.append(err+'\n')
UnkModels=[]
def UnkModel(id,fold):
global UnkModels
UnkModels.append("model {} in folder {} has a new model or new textures.\n".format(id,fold))
UnkCol=[]
def UnkCollision(id,fold,Bhv):
global UnkCol
UnkCol.append("Collision {} in folder {} is unkown or found to be new. Used with Behavior{}.\n".format(id,fold,Bhv))
def WriteWarnings():
global Objerrs
global NewObjs
global Fogerrs
global Scrollerrs
global UnkModels
global UnkCol
if Objerrs:
log.write(Spacer+"\n\nObjects without references must have behaviors created for them, be given an existing behavior, or be commented out.\n\n")
[log.write(' {}'.format(s)) for s in Objerrs]
if NewObjs:
log.write(Spacer+"\n\nUnlike above, these are behaviors that have been edited. These are not commented out because I cannot detect if they are custom until after writing the script.\nYou must add the following edited behaviors and collision from custom.behavior_data.inc.h to behavior_data.c for these to work properly.\nAssociated collision will be logged in a different section.\n\n")
[log.write(' {}'.format(s)) for s in NewObjs]
if Fogerrs:
log.write(Spacer+"\n\nLevels with fog in sm64 editor and likely early versions of Rom Manager are completely broken and destroy the levels graphics and most non opaque objects.\nI attempt to auto fix these, if there is any issue in these levels check fog first.\n\n")
[log.write(' {}'.format(s)) for s in Fogerrs]
if Scrollerrs:
log.write(Spacer+"\n\nTexture scrolls do not always follow the same format I assume, if this error appears it may have an invalid address which causes a crash.\nRM2C will try to find the correct address after noticing the one it has is wrong, if a crash occurs when entering the level check these objects first\n\n")
[log.write(' {}'.format(s)) for s in Scrollerrs]
if UnkModels:
log.write(Spacer+"\n\nNew models are detected by comparing the checksums of textures from the specific model.\nThe comparison models come from an unedited vanilla rom loaded into Rom Manager.\nIf a model is in this list, it has either an unrecognized ID or a new texture.\nIf a model is not in this list, it does not guarantee that it is unedited.\n\n")
[log.write(' {}'.format(m)) for m in UnkModels]
if UnkCol:
log.write(Spacer+"\n\nCollision models are loaded via behavior, not alongside the model. This means it can be more difficult to detect where exactly the collision belongs.\nI attempt to guess based on what model the collision is first used with, but if I'm not sure, it will be logged here.\n\n")
[log.write(' {}'.format(m)) for m in UnkCol]
log.write(Warnings)
log.close()
Warnings = """
Known methods of crashing:
*****************************************************************************
ALL BUILDS
IF CRASH ON BOOT - CHECK SEQUENCES
IF TITLE SCREEN LOOP - CHECK START LEVEL IN TWEAKS.H
IF TEXTURES ARE MESSED UP - ALWAYS CHECK LEVEL FOG FIRST
IF ONLY ALPHA TEXTURES MESSED UP - MOVE FOG GEO LAYOUT TO LAYER 1/4 FROM 4/6
IF CRASH UPON ENTERING A LEVEL, CHECK OBJECTS. IF EDITOR, CHECK SCROLLS FIRST. IF NO OBJECTS BAD CHECK SKYBOXES, THEN SEQUENCES
*****************************************************************************
"""