diff options
| author | Anghelo Carvajal <angheloalf95@gmail.com> | 2021-05-18 20:00:36 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-18 20:00:36 -0400 |
| commit | c56934038a7b0bf7257b3355be2811e9d37a6b6a (patch) | |
| tree | 675ad734af876b072506a6a453fb1b415956c568 /src/boot_O2 | |
| parent | 091219d742adb529f0a34f985c3ce1b0e916726d (diff) | |
Format everything (#141)
* Add trailing comma
* Run format and add some missing trailing commas
* Enforce the same clang-format version for everybody
* z_en_m_fire1
Diffstat (limited to 'src/boot_O2')
| -rw-r--r-- | src/boot_O2/__osMalloc.c | 6 | ||||
| -rw-r--r-- | src/boot_O2/gfxprint.c | 12 | ||||
| -rw-r--r-- | src/boot_O2/loadfragment2.c | 67 | ||||
| -rw-r--r-- | src/boot_O2/mtxuty-cvt.c | 2 | ||||
| -rw-r--r-- | src/boot_O2/padutils.c | 1 | ||||
| -rw-r--r-- | src/boot_O2/stackcheck.c | 5 |
6 files changed, 47 insertions, 46 deletions
diff --git a/src/boot_O2/__osMalloc.c b/src/boot_O2/__osMalloc.c index 0a418a2d9..8286a545e 100644 --- a/src/boot_O2/__osMalloc.c +++ b/src/boot_O2/__osMalloc.c @@ -82,7 +82,6 @@ void __osMallocAddBlock(Arena* arena, void* start, s32 size) { } } - void __osMallocCleanup(Arena* arena) { bzero(arena, sizeof(*arena)); } @@ -97,11 +96,11 @@ void* __osMalloc(Arena* arena, u32 size) { void* alloc; u32 blockSize; alloc = NULL; - + size = ALIGN16(size); ArenaImpl_Lock(arena); iter = arena->head; - + while (iter != NULL) { if (iter->isFree && iter->size >= size) { ArenaNode* next; @@ -134,7 +133,6 @@ void* __osMalloc(Arena* arena, u32 size) { return alloc; } - void* __osMallocR(Arena* arena, u32 size) { ArenaNode* iter; ArenaNode* newNode; diff --git a/src/boot_O2/gfxprint.c b/src/boot_O2/gfxprint.c index 2d4331bb9..bcb9ee31a 100644 --- a/src/boot_O2/gfxprint.c +++ b/src/boot_O2/gfxprint.c @@ -99,15 +99,12 @@ void GfxPrint_PrintCharImpl(GfxPrint* this, u8 c) { gSPTextureRectangle(this->dlist++, this->posX + 4, this->posY + 4, this->posX + 4 + 32, this->posY + 4 + 32, (c & 3) << 1, (u16)(c & 4) * 64, (u16)(c >> 3) * 256, 1024, 1024); - gDPSetPrimColorMod(this->dlist++, 0, 0, this->color.rgba); - } - + } gSPTextureRectangle(this->dlist++, this->posX, this->posY, this->posX + 32, this->posY + 32, (u16)(tile & 7), (u16)(c & 4) * 64, (u16)(c >> 3) * 256, 1024, 1024); - this->posX += 32; } @@ -133,7 +130,7 @@ void GfxPrint_PrintString(GfxPrint* this, const char* str) { } } -GfxPrint* GfxPrint_Callback(GfxPrint* this, const char* str, size_t size) { +GfxPrint* GfxPrint_Callback(GfxPrint* this, const char* str, size_t size) { GfxPrint_PrintStringWithSize(this, str, sizeof(char), size); return this; } @@ -142,7 +139,7 @@ void GfxPrint_Init(GfxPrint* this) { this->flag &= ~GFXPRINT_OPEN; this->callback = GfxPrint_Callback; - + this->dlist = NULL; this->posX = 0; this->posY = 0; @@ -156,7 +153,6 @@ void GfxPrint_Init(GfxPrint* this) { } void GfxPrint_Destroy(GfxPrint* this) { - } void GfxPrint_Open(GfxPrint* this, Gfx* dlist) { @@ -164,7 +160,7 @@ void GfxPrint_Open(GfxPrint* this, Gfx* dlist) { this->flag |= GFXPRINT_OPEN; this->dlist = dlist; GfxPrint_InitDlist(this); - } + } } Gfx* GfxPrint_Close(GfxPrint* this) { diff --git a/src/boot_O2/loadfragment2.c b/src/boot_O2/loadfragment2.c index ba382dbd0..5f44c34c4 100644 --- a/src/boot_O2/loadfragment2.c +++ b/src/boot_O2/loadfragment2.c @@ -4,9 +4,10 @@ UNK_TYPE4 D_80096C30 = 2; #ifdef NON_MATCHING -// This needs lots of work. Mostly regalloc and getting the address of D_80096C30 placed in s5 at the beginning of the function +// This needs lots of work. Mostly regalloc and getting the address of D_80096C30 placed in s5 at the beginning of the +// function void Load2_Relocate(u32 allocatedVRamAddr, OverlayBlockSizes* overlayInfo, u32 vRamStart) { - s32 sectionLocations [4]; + s32 sectionLocations[4]; u32* regReferences[32]; u32 regValues[32]; u32 i; @@ -24,34 +25,36 @@ void Load2_Relocate(u32 allocatedVRamAddr, OverlayBlockSizes* overlayInfo, u32 v for (i = 0, relocationIndex = 0; i < overlayInfo->amountOfRelocations; relocationIndex++) { relocation = overlayInfo->relocations[relocationIndex]; i++; - inst = (u32 *)(sectionLocations[relocation >> 0x1e] + (relocation & 0xffffff)); + inst = (u32*)(sectionLocations[relocation >> 0x1e] + (relocation & 0xffffff)); switch (relocation & 0x3f000000) { - case 0x2000000: - if ((*inst & 0xf000000) == 0) { - *inst = (*inst - vRamStart) + allocatedVRamAddr; - } else { - if (D_80096C30 > 2); - } - break; - case 0x4000000: - *inst = (*inst & 0xfc000000) | - (((((*inst & 0x3ffffff) << 2 | 0x80000000) - vRamStart) + allocatedVRamAddr & 0xfffffff) >> 2); - break; - case 0x5000000: - regReferences[*inst >> 0x10 & 0x1f] = inst; - regValues[*inst >> 0x10 & 0x1f] = *inst; - break; - case 0x6000000: - lastInst = regReferences[*inst >> 0x15 & 0x1f]; - signedOffset = (s16)*inst; - if ((signedOffset + *lastInst * 0x10000 & 0xf000000) == 0) { - relocatedAddress = ((signedOffset + regValues[*inst >> 0x15 & 0x1f] * 0x10000) - vRamStart) + allocatedVRamAddr; - *lastInst = (((relocatedAddress >> 0x10) & 0xFFFF) + ((relocatedAddress & 0x8000)? 1 : 0)) | - (*lastInst & 0xffff0000); - *inst = *inst & 0xffff0000 | relocatedAddress & 0xffff; - } - break; + case 0x2000000: + if ((*inst & 0xf000000) == 0) { + *inst = (*inst - vRamStart) + allocatedVRamAddr; + } else { + if (D_80096C30 > 2) + ; + } + break; + case 0x4000000: + *inst = (*inst & 0xfc000000) | + (((((*inst & 0x3ffffff) << 2 | 0x80000000) - vRamStart) + allocatedVRamAddr & 0xfffffff) >> 2); + break; + case 0x5000000: + regReferences[*inst >> 0x10 & 0x1f] = inst; + regValues[*inst >> 0x10 & 0x1f] = *inst; + break; + case 0x6000000: + lastInst = regReferences[*inst >> 0x15 & 0x1f]; + signedOffset = (s16)*inst; + if ((signedOffset + *lastInst * 0x10000 & 0xf000000) == 0) { + relocatedAddress = + ((signedOffset + regValues[*inst >> 0x15 & 0x1f] * 0x10000) - vRamStart) + allocatedVRamAddr; + *lastInst = (((relocatedAddress >> 0x10) & 0xFFFF) + ((relocatedAddress & 0x8000) ? 1 : 0)) | + (*lastInst & 0xffff0000); + *inst = *inst & 0xffff0000 | relocatedAddress & 0xffff; + } + break; } } } @@ -70,14 +73,18 @@ s32 Load2_LoadOverlay(u32 vRomStart, u32 vRomEnd, u32 vRamStart, u32 vRamEnd, u3 size = vRomEnd - vRomStart; - if(1); + if (1) { + ; + } DmaMgr_SendRequest0(allocatedVRamAddr, vRomStart, size); end = (void*)(allocatedVRamAddr + size); overlayInfo = (OverlayBlockSizes*)((int)end - *(int*)((int)end + -4)); - if(1); + if (1) { + ; + } Load2_Relocate(allocatedVRamAddr, overlayInfo, vRamStart); diff --git a/src/boot_O2/mtxuty-cvt.c b/src/boot_O2/mtxuty-cvt.c index 78be5e3b5..f34c1e518 100644 --- a/src/boot_O2/mtxuty-cvt.c +++ b/src/boot_O2/mtxuty-cvt.c @@ -15,5 +15,5 @@ void MtxConv_F2L(MatrixInternal* m1, MtxF* m2) { } void MtxConv_L2F(MtxF* m1, MatrixInternal* m2) { - guMtxL2F(m1, (Mtx *)m2); + guMtxL2F(m1, (Mtx*)m2); } diff --git a/src/boot_O2/padutils.c b/src/boot_O2/padutils.c index ea51b3dc1..cdd789f1b 100644 --- a/src/boot_O2/padutils.c +++ b/src/boot_O2/padutils.c @@ -92,4 +92,3 @@ void PadUtils_UpdateRelXY(Input* input) { PadUtils_SetRelXY(input, relX, relY); } - diff --git a/src/boot_O2/stackcheck.c b/src/boot_O2/stackcheck.c index 142f824a7..7079eff8e 100644 --- a/src/boot_O2/stackcheck.c +++ b/src/boot_O2/stackcheck.c @@ -4,7 +4,8 @@ StackEntry* sStackInfoListStart = NULL; StackEntry* sStackInfoListEnd = NULL; -void StackCheck_Init(StackEntry* entry, void* stackTop, void* stackBottom, u32 initValue, s32 minSpace, const char* name) { +void StackCheck_Init(StackEntry* entry, void* stackTop, void* stackBottom, u32 initValue, s32 minSpace, + const char* name) { StackEntry* iter; u32* addr; @@ -99,7 +100,7 @@ u32 StackCheck_CheckAll() { u32 ret = 0; StackEntry* iter = sStackInfoListStart; - while(iter) { + while (iter) { u32 state = StackCheck_GetState(iter); if (state) { ret = 1; |
