1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-03 22:44:30 +00:00

Decompile N64 anti-piracy checks in overlays (#2042)

* Decompile N64 anti-piracy checks in overlays

* Fix BSS splits (I think)

* Use physical address and comment on meaning

Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com>

---------

Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com>
This commit is contained in:
cadmic 2024-08-15 20:44:05 -07:00 committed by GitHub
parent b734a159e3
commit b82f54bb95
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 50 additions and 8 deletions

View file

@ -71,6 +71,16 @@ s32 func_808C0CC8(BgZg* this) {
}
void func_808C0CD4(BgZg* this, PlayState* play) {
#if PLATFORM_N64
// Anti-piracy check, bars will not open if the check fails.
// The address 0x000002E8 is near the start of RDRAM, and is written when IPL3 copies itself to
// RDRAM after RDRAM has been initialized. Specifically, this is an instruction from some
// embedded RSP code at offset 0x7F8 into IPL3 (0xC86E2000 disassembles to `lqv $v14[0], ($3)`).
if (IO_READ(0x000002E8) != 0xC86E2000) {
return;
}
#endif
if (func_808C0C98(this, play) != 0) {
this->action = 1;
func_808C0C50(this);

View file

@ -447,17 +447,25 @@ void func_80B4F230(EnZl2* this, s16 arg1, s32 arg2) {
s32 func_80B4F45C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) {
s32 pad;
EnZl2* this = (EnZl2*)thisx;
Mtx* sp74;
MtxF sp34;
Vec3s sp2C;
s16 pad2;
s16* unk_1DC = this->unk_1DC;
if (limbIndex == 14) {
sp74 = GRAPH_ALLOC(play->state.gfxCtx, sizeof(Mtx) * 7);
Mtx* sp74 = GRAPH_ALLOC(play->state.gfxCtx, sizeof(Mtx) * 7);
MtxF sp34;
Vec3s sp2C;
s16 pad2;
s16* unk_1DC = this->unk_1DC;
gSPSegment((*gfx)++, 0x0C, sp74);
Matrix_Push();
#if PLATFORM_N64
// Anti-piracy check, Zelda's hair is misshapen if the check fails
if (osCicId != 6105) {
Matrix_Scale(2.0f, 0.5f, 2.0f, MTXMODE_APPLY);
}
#endif
Matrix_Translate(pos->x, pos->y, pos->z, MTXMODE_APPLY);
Matrix_RotateZYX(rot->x, rot->y, rot->z, MTXMODE_APPLY);
Matrix_Push();

View file

@ -10,8 +10,11 @@
#include "assets/objects/object_fish/object_fish.h"
#include "ichain.h"
#include "terminal.h"
#if PLATFORM_N64
#include "cic6105.h"
#endif
#pragma increment_block_number "gc-eu:205 gc-eu-mq:205 gc-jp:207 gc-jp-ce:207 gc-jp-mq:207 gc-us:207 gc-us-mq:207"
#pragma increment_block_number "gc-eu:204 gc-eu-mq:204 gc-jp:206 gc-jp-ce:206 gc-jp-mq:206 gc-us:206 gc-us-mq:206"
#define FLAGS ACTOR_FLAG_4
@ -852,7 +855,14 @@ void Fishing_Init(Actor* thisx, PlayState* play2) {
if (thisx->params < EN_FISH_PARAM) {
FishingGroupFish* fish;
#if PLATFORM_N64
// Anti-piracy check, if the check fails the line can't be reeled in if
// a fish is caught and the fish will always let go after 50 frames.
sReelLock = !(B_80008EE0 == 0xAD090010);
#else
sReelLock = 0;
#endif
sFishingMain = this;
Collider_InitJntSph(play, &sFishingMain->collider);
Collider_SetJntSph(play, &sFishingMain->collider, thisx, &sJntSphInit, sFishingMain->colliderElements);