1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-28 19:25:27 +00:00

Fix misc 14 (#1279)

* Remove fake temp in `BossDodongo_DrawEffects`

* `OS_WRITE` for `__osSpRawStartDma` `direction`

* remove outdated comment

* fixup osRecvMesg

* make sShopkeeperStores static

* `PHYSICAL_TO_VIRTUAL(gSegments[0])` -> `SEGMENTED_TO_VIRTUAL(NULL)` (mimics `CollisionHeader_SegmentedToVirtual`)

* Run formatter

* Remove assets from include path in suggested vscode properties

* Fix `osCreateMesgQueue` getting `OS_MESG_BLOCK` as `count` instead of `1`
This commit is contained in:
Dragorn421 2022-06-13 08:38:20 -07:00 committed by GitHub
parent 93a6a1eb9a
commit 0832b5af68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 29 additions and 32 deletions

View file

@ -50,7 +50,6 @@ You can create a `.vscode/c_cpp_properties.json` file with `C/C++: Edit Configur
"includePath": [ // Matches makefile's includes
"${workspaceFolder}/**",
"src",
"assets",
"build",
"include"
],

View file

@ -283,10 +283,9 @@ void AudioHeap_InitMainPools(s32 initPoolSize) {
void AudioHeap_SessionPoolsInit(AudioSessionPoolSplit* split) {
gAudioContext.sessionPool.curRamAddr = gAudioContext.sessionPool.startRamAddr;
AudioHeap_AllocPoolInit(&gAudioContext.miscPool,
AudioHeap_Alloc(&gAudioContext.sessionPool, split->miscPoolSize), split->miscPoolSize);
AudioHeap_AllocPoolInit(&gAudioContext.cachePool,
AudioHeap_Alloc(&gAudioContext.sessionPool, split->cachePoolSize),
AudioHeap_AllocPoolInit(&gAudioContext.miscPool, AudioHeap_Alloc(&gAudioContext.sessionPool, split->miscPoolSize),
split->miscPoolSize);
AudioHeap_AllocPoolInit(&gAudioContext.cachePool, AudioHeap_Alloc(&gAudioContext.sessionPool, split->cachePoolSize),
split->cachePoolSize);
}

View file

@ -5,7 +5,7 @@ void Sleep_Cycles(OSTime cycles) {
OSMesg msg;
OSTimer timer;
osCreateMesgQueue(&mq, &msg, OS_MESG_BLOCK);
osCreateMesgQueue(&mq, &msg, 1);
osSetTimer(&timer, cycles, 0, &mq, NULL);
osRecvMesg(&mq, NULL, OS_MESG_BLOCK);
}

View file

@ -3822,7 +3822,7 @@ u32 SurfaceType_GetData(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId,
return 0;
}
surfaceTypes = colHeader->surfaceTypeList;
if (surfaceTypes == PHYSICAL_TO_VIRTUAL(gSegments[0])) {
if (surfaceTypes == SEGMENTED_TO_VIRTUAL(NULL)) {
return 0;
}
return surfaceTypes[poly->type].data[dataIdx];
@ -3865,11 +3865,11 @@ u16 SurfaceType_GetCameraSType(CollisionContext* colCtx, CollisionPoly* poly, s3
return 0;
}
camData = colHeader->cameraDataList;
if (camData == PHYSICAL_TO_VIRTUAL(gSegments[0])) {
if (camData == SEGMENTED_TO_VIRTUAL(NULL)) {
return 0;
}
surfaceTypes = colHeader->surfaceTypeList;
if (surfaceTypes == PHYSICAL_TO_VIRTUAL(gSegments[0])) {
if (surfaceTypes == SEGMENTED_TO_VIRTUAL(NULL)) {
return 0;
}
return func_80041A4C(colCtx, SurfaceType_GetCamDataIndex(colCtx, poly, bgId), bgId);
@ -3887,7 +3887,7 @@ u16 func_80041B24(CollisionContext* colCtx, u32 camId, s32 bgId) {
}
camData = colHeader->cameraDataList;
if (camData == PHYSICAL_TO_VIRTUAL(gSegments[0])) {
if (camData == SEGMENTED_TO_VIRTUAL(NULL)) {
return 0;
}
return camData[camId].numCameras;
@ -3905,11 +3905,11 @@ u16 SurfaceType_GetNumCameras(CollisionContext* colCtx, CollisionPoly* poly, s32
return 0;
}
camData = colHeader->cameraDataList;
if (camData == PHYSICAL_TO_VIRTUAL(gSegments[0])) {
if (camData == SEGMENTED_TO_VIRTUAL(NULL)) {
return 0;
}
surfaceTypes = colHeader->surfaceTypeList;
if (surfaceTypes == PHYSICAL_TO_VIRTUAL(gSegments[0])) {
if (surfaceTypes == SEGMENTED_TO_VIRTUAL(NULL)) {
return 0;
}
return func_80041B24(colCtx, SurfaceType_GetCamDataIndex(colCtx, poly, bgId), bgId);
@ -3926,7 +3926,7 @@ Vec3s* func_80041C10(CollisionContext* colCtx, s32 camId, s32 bgId) {
return NULL;
}
cameraDataList = colHeader->cameraDataList;
if (cameraDataList == PHYSICAL_TO_VIRTUAL(gSegments[0])) {
if (cameraDataList == SEGMENTED_TO_VIRTUAL(NULL)) {
return NULL;
}
return (Vec3s*)SEGMENTED_TO_VIRTUAL(cameraDataList[camId].camPosData);
@ -3944,11 +3944,11 @@ Vec3s* SurfaceType_GetCamPosData(CollisionContext* colCtx, CollisionPoly* poly,
return NULL;
}
camData = colHeader->cameraDataList;
if (camData == PHYSICAL_TO_VIRTUAL(gSegments[0])) {
if (camData == SEGMENTED_TO_VIRTUAL(NULL)) {
return NULL;
}
surfaceTypes = colHeader->surfaceTypeList;
if (surfaceTypes == PHYSICAL_TO_VIRTUAL(gSegments[0])) {
if (surfaceTypes == SEGMENTED_TO_VIRTUAL(NULL)) {
return NULL;
}
return func_80041C10(colCtx, SurfaceType_GetCamDataIndex(colCtx, poly, bgId), bgId);
@ -4195,7 +4195,7 @@ s32 WaterBox_GetSurfaceImpl(PlayState* play, CollisionContext* colCtx, f32 x, f3
u32 room;
WaterBox* curWaterBox;
if (colHeader->numWaterBoxes == 0 || colHeader->waterBoxes == PHYSICAL_TO_VIRTUAL(gSegments[0])) {
if (colHeader->numWaterBoxes == 0 || colHeader->waterBoxes == SEGMENTED_TO_VIRTUAL(NULL)) {
return false;
}
@ -4231,7 +4231,7 @@ s32 WaterBox_GetSurface2(PlayState* play, CollisionContext* colCtx, Vec3f* pos,
WaterBox* waterBox;
WaterBox* waterBoxList = colHeader->waterBoxes; // unused, needed for matching
if (colHeader->numWaterBoxes == 0 || colHeader->waterBoxes == PHYSICAL_TO_VIRTUAL(gSegments[0])) {
if (colHeader->numWaterBoxes == 0 || colHeader->waterBoxes == SEGMENTED_TO_VIRTUAL(NULL)) {
*outWaterBox = NULL;
return -1;
}
@ -4278,7 +4278,7 @@ u16 WaterBox_GetCameraSType(CollisionContext* colCtx, WaterBox* waterBox) {
s32 camId = WaterBox_GetCamDataIndex(colCtx, waterBox);
CamData* camData = colCtx->colHeader->cameraDataList;
if (camData == PHYSICAL_TO_VIRTUAL(gSegments[0])) {
if (camData == SEGMENTED_TO_VIRTUAL(NULL)) {
return 0;
}
@ -4305,7 +4305,7 @@ s32 func_800425B0(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32*
u32 room;
WaterBox* curWaterBox;
if (colHeader->numWaterBoxes == 0 || colHeader->waterBoxes == PHYSICAL_TO_VIRTUAL(gSegments[0])) {
if (colHeader->numWaterBoxes == 0 || colHeader->waterBoxes == SEGMENTED_TO_VIRTUAL(NULL)) {
return false;
}

View file

@ -365,7 +365,8 @@ void EnItem00_Destroy(Actor* thisx, PlayState* play) {
}
void func_8001DFC8(EnItem00* this, PlayState* play) {
if ((this->actor.params <= ITEM00_RUPEE_RED) || ((this->actor.params == ITEM00_HEART) && (this->despawnTimer < 0)) ||
if ((this->actor.params <= ITEM00_RUPEE_RED) ||
((this->actor.params == ITEM00_HEART) && (this->despawnTimer < 0)) ||
(this->actor.params == ITEM00_HEART_PIECE)) {
this->actor.shape.rot.y += 960;
} else {

View file

@ -1275,7 +1275,7 @@ void func_800849EC(PlayState* play) {
void Interface_LoadItemIcon1(PlayState* play, u16 button) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;
osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, OS_MESG_BLOCK);
osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, 1);
DmaMgr_SendRequest2(&interfaceCtx->dmaRequest_160, interfaceCtx->iconItemSegment + button * 0x1000,
(u32)_icon_item_staticSegmentRomStart + (gSaveContext.equips.buttonItems[button] * 0x1000),
0x1000, 0, &interfaceCtx->loadQueue, NULL, "../z_parameter.c", 1171);
@ -1285,7 +1285,7 @@ void Interface_LoadItemIcon1(PlayState* play, u16 button) {
void Interface_LoadItemIcon2(PlayState* play, u16 button) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;
osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, OS_MESG_BLOCK);
osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, 1);
DmaMgr_SendRequest2(&interfaceCtx->dmaRequest_180, interfaceCtx->iconItemSegment + button * 0x1000,
(u32)_icon_item_staticSegmentRomStart + (gSaveContext.equips.buttonItems[button] * 0x1000),
0x1000, 0, &interfaceCtx->loadQueue, NULL, "../z_parameter.c", 1193);
@ -2082,7 +2082,7 @@ void Interface_LoadActionLabel(InterfaceContext* interfaceCtx, u16 action, s16 l
if ((action != DO_ACTION_NONE) && (action != DO_ACTION_MAX + DO_ACTION_NONE) &&
(action != 2 * DO_ACTION_MAX + DO_ACTION_NONE)) {
osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, OS_MESG_BLOCK);
osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, 1);
DmaMgr_SendRequest2(&interfaceCtx->dmaRequest_160,
interfaceCtx->doActionSegment + (loadOffset * DO_ACTION_TEX_SIZE),
(u32)_do_action_staticSegmentRomStart + (action * DO_ACTION_TEX_SIZE), DO_ACTION_TEX_SIZE,
@ -2146,7 +2146,7 @@ void Interface_LoadActionLabelB(PlayState* play, u16 action) {
interfaceCtx->unk_1FC = action;
osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, OS_MESG_BLOCK);
osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, 1);
DmaMgr_SendRequest2(&interfaceCtx->dmaRequest_160, interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE,
(u32)_do_action_staticSegmentRomStart + (action * DO_ACTION_TEX_SIZE), DO_ACTION_TEX_SIZE, 0,
&interfaceCtx->loadQueue, NULL, "../z_parameter.c", 2228);

View file

@ -448,7 +448,6 @@ void Sram_OpenSave(SramContext* sramCtx) {
}
}
// check for owning master sword.. to restore master sword? bug or debug feature?
if (LINK_AGE_IN_YEARS == YEARS_ADULT && !CHECK_OWNED_EQUIP(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_MASTER)) {
gSaveContext.inventory.equipment |= OWNED_EQUIP_FLAG(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_MASTER);
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER;

View file

@ -41,13 +41,13 @@ void osSpTaskLoad(OSTask* intp) {
while (__osSpSetPc((void*)SP_IMEM_START) == -1) {
;
}
while (__osSpRawStartDma(1, (void*)(SP_IMEM_START - sizeof(*tp)), tp, sizeof(OSTask)) == -1) {
while (__osSpRawStartDma(OS_WRITE, (void*)(SP_IMEM_START - sizeof(*tp)), tp, sizeof(OSTask)) == -1) {
;
}
while (__osSpDeviceBusy()) {
;
}
while (__osSpRawStartDma(1, (void*)SP_IMEM_START, tp->t.ucode_boot, tp->t.ucode_boot_size) == -1) {
while (__osSpRawStartDma(OS_WRITE, (void*)SP_IMEM_START, tp->t.ucode_boot, tp->t.ucode_boot_size) == -1) {
;
}
}

View file

@ -9,7 +9,7 @@ s32 osRecvMesg(OSMesgQueue* mq, OSMesg* msg, s32 flag) {
return -1;
}
__osRunningThread->state = OS_STATE_WAITING;
__osEnqueueAndYield((OSThread**)mq);
__osEnqueueAndYield(&mq->mtqueue);
}
if (msg != NULL) {

View file

@ -1667,7 +1667,7 @@ void BossDodongo_UpdateEffects(PlayState* play) {
}
void BossDodongo_DrawEffects(PlayState* play) {
MtxF* unkMtx;
s32 pad;
s16 i;
u8 materialFlag = 0;
BossDodongoEffect* eff;
@ -1678,7 +1678,6 @@ void BossDodongo_DrawEffects(PlayState* play) {
OPEN_DISPS(gfxCtx, "../z_boss_dodongo.c", 5228);
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
unkMtx = &play->billboardMtxF;
for (i = 0; i < BOSS_DODONGO_EFFECT_COUNT; i++, eff++) {
if (eff->unk_24 == 1) {
@ -1691,7 +1690,7 @@ void BossDodongo_DrawEffects(PlayState* play) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, eff->color.r, eff->color.g, eff->color.b, eff->alpha);
Matrix_Translate(eff->unk_00.x, eff->unk_00.y, eff->unk_00.z, MTXMODE_NEW);
Matrix_ReplaceRotation(unkMtx);
Matrix_ReplaceRotation(&play->billboardMtxF);
Matrix_Scale(eff->unk_2C, eff->unk_2C, 1.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_dodongo.c", 5253),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);

View file

@ -193,7 +193,7 @@ typedef struct {
/* 0x06 */ s16 zOffset;
} ShopItem; // size 0x08
ShopItem sShopkeeperStores[][8] = {
static ShopItem sShopkeeperStores[][8] = {
{ { SI_DEKU_SHIELD, 50, 52, -20 },
{ SI_DEKU_NUTS_5, 50, 76, -20 },
{ SI_DEKU_NUTS_10, 80, 52, -3 },