Merge pull request #522 from hatal175/vram

This commit is contained in:
notyourav
2022-06-29 11:23:52 -07:00
committed by GitHub
3 changed files with 9 additions and 142 deletions
-91
View File
@@ -1,91 +0,0 @@
.syntax unified
.ifdef EU
push {r4, r5, r6, lr}
adds r6, r0, #0
adds r5, r1, #0
adds r4, r2, #0
cmp r4, #0
bne _080AD79C
adds r0, r5, #0
bl FindFreeGFXSlots
adds r4, r0, #0
cmp r4, #0
beq _080AD7C4
_080AD79C:
ldr r0, _080AD7D0 @ =gGFXSlots
lsls r1, r4, #1
adds r1, r1, r4
lsls r1, r1, #2
adds r1, r1, r0
ldrb r0, [r1, #4]
lsls r0, r0, #0x1c
lsrs r2, r0, #0x1c
cmp r2, #6
beq _080AD7BC
adds r0, r4, #0
movs r1, #0
adds r2, r5, #0
bl ReserveGFXSlots
movs r2, #5
_080AD7BC:
adds r0, r4, #0
adds r1, r6, #0
bl sub_080AE0C8
_080AD7C4:
adds r0, r4, #0
cmp r0, #0
beq _080AD7CC
movs r0, #1
_080AD7CC:
pop {r4, r5, r6, pc}
.align 2, 0
_080AD7D0: .4byte gGFXSlots
.else
push {r4, r5, r6, lr}
adds r6, r0, #0
adds r5, r1, #0
adds r4, r2, #0
cmp r4, #0
bne _080AE030
adds r0, r5, #0
bl FindFreeGFXSlots
adds r4, r0, #0
cmp r4, #0
bne _080AE030
bl CleanUpGFXSlots
adds r0, r5, #0
bl FindFreeGFXSlots
adds r4, r0, #0
cmp r4, #0
beq _080AE058
_080AE030:
ldr r0, _080AE064 @ =gGFXSlots
lsls r1, r4, #1
adds r1, r1, r4
lsls r1, r1, #2
adds r1, r1, r0
ldrb r0, [r1, #4]
lsls r0, r0, #0x1c
lsrs r2, r0, #0x1c
cmp r2, #6
beq _080AE050
adds r0, r4, #0
movs r1, #0
adds r2, r5, #0
bl ReserveGFXSlots
movs r2, #5
_080AE050:
adds r0, r4, #0
adds r1, r6, #0
bl sub_080AE0C8
_080AE058:
adds r0, r4, #0
cmp r0, #0
beq _080AE060
movs r0, #1
_080AE060:
pop {r4, r5, r6, pc}
.align 2, 0
_080AE064: .4byte gGFXSlots
.endif
.syntax divided
-39
View File
@@ -1,39 +0,0 @@
.syntax unified
push {lr}
adds r2, r1, #0
lsls r1, r0, #1
adds r1, r1, r0
lsls r1, r1, #2
ldr r0, _080ADDFC @ =gUnk_02024494
adds r3, r1, r0
ldr r0, _080ADE00 @ =0x00FFFFFC
ands r0, r2
ldr r1, _080ADE04 @ =gGlobalGfxAndPalettes
adds r0, r0, r1
str r0, [r3, #8]
movs r0, #1
ands r0, r2
cmp r0, #0
beq _080ADE0C
ldr r0, _080ADE08 @ =0x0000FFFF
b _080ADE14
.align 2, 0
_080ADDFC: .4byte gUnk_02024494
_080ADE00: .4byte 0x00FFFFFC
_080ADE04: .4byte gGlobalGfxAndPalettes
_080ADE08: .4byte 0x0000FFFF
_080ADE0C:
movs r0, #0xfe
lsls r0, r0, #0x17
ands r0, r2
lsrs r0, r0, #0x14
_080ADE14:
strh r0, [r3, #6]
ldrb r0, [r3]
movs r1, #0xf
ands r1, r0
movs r0, #0x30
orrs r1, r0
strb r1, [r3]
pop {pc}
.syntax divided
+9 -12
View File
@@ -64,18 +64,19 @@ void sub_080ADD70(void) {
}
}
NONMATCH("asm/non_matching/vram/sub_080ADDD8.inc", void sub_080ADDD8(u32 index, u32 paletteIndex)) {
void sub_080ADDD8(u32 index, u32 paletteIndex) {
GfxSlot* slot = &gGFXSlots.slots[index];
u32 temp;
slot->palettePointer = gGlobalGfxAndPalettes + (paletteIndex & 0xfffffc);
if ((paletteIndex & 1) != 0) {
slot->paletteIndex = 0xffff;
temp = 0xffff;
} else {
// TODO some cast here?
slot->paletteIndex = ((paletteIndex)&0x7f00) >> 4;
// @ TODO probably a bitfield
temp = ((paletteIndex)&0x7f000000) >> 0x14;
}
slot->paletteIndex = temp;
slot->vramStatus = GFX_VRAM_3;
}
END_NONMATCH
void sub_080ADE24(void) {
u32 index;
@@ -166,13 +167,13 @@ bool32 LoadFixedGFX(Entity* entity, u32 gfxIndex) {
}
// If slotIndex != 0 the gfx loaded starting from that slot, else in the first fitting free one.
NONMATCH("asm/non_matching/vram/LoadSwapGFX.inc", u32 LoadSwapGFX(Entity* entity, u32 count, u32 slotIndex)) {
bool32 LoadSwapGFX(Entity* entity, u32 count, u32 slotIndex) {
u32 status;
if ((slotIndex == 0) && (slotIndex = FindFreeGFXSlots(count), slotIndex == 0)) {
#ifndef EU
CleanUpGFXSlots();
#endif
slotIndex = FindFreeGFXSlots(count);
#endif
if (slotIndex == 0) {
goto _080AE058;
}
@@ -184,12 +185,8 @@ NONMATCH("asm/non_matching/vram/LoadSwapGFX.inc", u32 LoadSwapGFX(Entity* entity
}
sub_080AE0C8(slotIndex, entity, status);
_080AE058:
if (slotIndex != 0) {
slotIndex = 1;
}
return slotIndex;
return slotIndex != 0;
}
END_NONMATCH
void UnloadGFXSlots(Entity* param_1) {
u32 slotIndex;