mirror of
https://github.com/zeldaret/oot.git
synced 2024-12-24 13:46:07 +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:
parent
b734a159e3
commit
b82f54bb95
8 changed files with 50 additions and 8 deletions
8
include/cic6105.h
Normal file
8
include/cic6105.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef CIC6105_H
|
||||
#define CIC6105_H
|
||||
|
||||
#include "ultra64.h"
|
||||
|
||||
extern u32 B_80008EE0;
|
||||
|
||||
#endif
|
|
@ -9,6 +9,7 @@ extern Mtx D_01000000;
|
|||
extern u32 osTvType;
|
||||
extern u32 osRomBase;
|
||||
extern u32 osResetType;
|
||||
extern u32 osCicId;
|
||||
extern u32 osMemSize;
|
||||
extern u8 osAppNMIBuffer[0x40];
|
||||
|
||||
|
|
3
spec
3
spec
|
@ -20,6 +20,9 @@ beginseg
|
|||
include "$(BUILD_DIR)/src/boot/z_std_dma.o"
|
||||
include "$(BUILD_DIR)/src/boot/yaz0.o"
|
||||
include "$(BUILD_DIR)/src/boot/z_locale.o"
|
||||
#if PLATFORM_N64
|
||||
include "$(BUILD_DIR)/src/boot/cic6105.o"
|
||||
#endif
|
||||
#if OOT_DEBUG
|
||||
include "$(BUILD_DIR)/src/boot/assert.o"
|
||||
#endif
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
#include "cic6105.h"
|
||||
|
||||
u32 B_80008EE0;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -126,7 +126,7 @@ offset,vram,.bss
|
|||
72F0,80007750,src/boot/idle
|
||||
7F00,80008360,src/boot/z_std_dma
|
||||
8670,80008AD0,src/boot/yaz0
|
||||
8A80,80008EE0,src/boot/z_locale
|
||||
8A80,80008EE0,src/boot/cic6105
|
||||
8AA0,80008F00,src/libultra/io/driverominit
|
||||
8B20,80008F80,src/libultra/io/piacs
|
||||
8B40,80008FA0,src/libultra/os/initialize
|
||||
|
|
|
Loading…
Reference in a new issue