Skip to content
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

Merged
merged 2 commits into from
Sep 20, 2022

Conversation

Rozelette
Copy link
Contributor

@Rozelette Rozelette commented Sep 15, 2022

#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 segment 0C. 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?

@@ -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++) {
Copy link
Contributor Author

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

@louist103 louist103 requested a review from Kenix3 September 15, 2022 11:30
@@ -2110,11 +2110,6 @@ unsigned int dListBP;
int matrixBP;
uintptr_t clearMtx;

extern "C"
{
uintptr_t jsjutanShadowTex = 0;
Copy link
Contributor

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 👋

@Kenix3 Kenix3 merged commit c9aafcf into HarbourMasters:develop-zhora Sep 20, 2022
Kenix3 pushed a commit to Kenix3/Shipwright that referenced this pull request Oct 19, 2022
…) (HarbourMasters#1482)

* Add hack to load bss texture in ovl_En_Jsjutan

* Remove (debug?) reference to jsjutanShadowTex in LUS
dcvz pushed a commit to briaguya-ai/Shipwright that referenced this pull request Nov 12, 2022
…sters#1482)

* Add hack to load bss texture in ovl_En_Jsjutan

* Remove (debug?) reference to jsjutanShadowTex in LUS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants