-
Notifications
You must be signed in to change notification settings - Fork 524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add hack to load bss texture in ovl_En_Jsjutan (fixes #69) #1482
Conversation
@@ -402,7 +402,7 @@ void EnJsjutan_Draw(Actor* thisx, GlobalContext* globalCtx2) { | |||
this->unk_164 = false; | |||
u8* carpTex = ResourceMgr_LoadTexByName(sCarpetTex); | |||
u8* shadTex = sShadowTex; | |||
for (i = 0; i < ARRAY_COUNT(shadTex); i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no idea why this worked before (IDO being bad?). But for the array size to be calculated correctly, it needed to be changed to something that was, well, an array
@@ -2110,11 +2110,6 @@ unsigned int dListBP; | |||
int matrixBP; | |||
uintptr_t clearMtx; | |||
|
|||
extern "C" | |||
{ | |||
uintptr_t jsjutanShadowTex = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing SoH code from LUS 👋
…) (HarbourMasters#1482) * Add hack to load bss texture in ovl_En_Jsjutan * Remove (debug?) reference to jsjutanShadowTex in LUS
…sters#1482) * Add hack to load bss texture in ovl_En_Jsjutan * Remove (debug?) reference to jsjutanShadowTex in LUS
#69
The carpet shadow texture is (I think) the only texture that sources from an overlay's bss. This means it does does occupy any space in the ROM and therefore does not have a name in the OTR. This causes an issue when extracting it, since a proper reference can not be placed in the DL.
This PR adds a hack that replaces the reference in the DL to a texture in segment
0C
, and modifies the actor to load the texture into segment0C
. This is a scratch segment that actors can use (indeed, see that later on this actor uses it to load vertices into), so this is safe.There is a potential issue further down the road. Because this is a dynamically generated texture based on the carpet texture, if the carpet texture were to change (say, from a texture mod), the shadow would not be calculated correctly. Therefore, I think the long term solution would be to render the shadow with a shader based on the carpet texture. This is out-of-scope of this PR, however.
This will require a regen of the OTR. Do we have a process for this yet? Is there anything this PR should do accordingly?