mirror of https://github.com/zeldaret/tmc.git
True Match sub_080A5F48
matched sub_080A5F48 using typecast on Div.
This commit is contained in:
parent
d8a9e54fa9
commit
ba7be37093
|
@ -1232,15 +1232,26 @@ bool32 sub_080A5F24(void) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_080A5F48(Item item, u32 param_2) {
|
typedef union{
|
||||||
extern u32 gSprite_082E68F4[];
|
struct{
|
||||||
u32 ammoCount;
|
s32 v1;
|
||||||
u32 tensDigit;
|
s32 v2;
|
||||||
u8* puVar2;
|
} values;
|
||||||
u32 temp1;
|
u64 raw;
|
||||||
|
} DoubleReturnValue;
|
||||||
|
|
||||||
|
void sub_080A5F48(Item item, u32 offset) {
|
||||||
|
//this funcitons signature allows the div function to return a u64 (2x 32 bit registers)
|
||||||
|
//with the result in one register and the remainder in the other
|
||||||
|
typedef u64 DivRem (u32, u32);
|
||||||
|
|
||||||
|
s32 ammoCount;
|
||||||
|
s32 onesDigit;
|
||||||
|
s32 tensDigit;
|
||||||
|
void* dest;
|
||||||
u16* temp2;
|
u16* temp2;
|
||||||
u32 temp3;
|
u32 index;
|
||||||
register u32 rem asm("r1");
|
DoubleReturnValue ret;
|
||||||
|
|
||||||
switch (item) {
|
switch (item) {
|
||||||
case ITEM_BOTTLE1:
|
case ITEM_BOTTLE1:
|
||||||
|
@ -1248,17 +1259,14 @@ void sub_080A5F48(Item item, u32 param_2) {
|
||||||
case ITEM_BOTTLE3:
|
case ITEM_BOTTLE3:
|
||||||
case ITEM_BOTTLE4:
|
case ITEM_BOTTLE4:
|
||||||
item = gSave.stats.bottles[item - ITEM_BOTTLE1];
|
item = gSave.stats.bottles[item - ITEM_BOTTLE1];
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dest = OBJ_VRAM0 + (offset * 0x20);
|
||||||
|
index = gSpriteAnimations_322[item]->index;
|
||||||
|
temp2 = &gMoreSpritePtrs[1][index * 2];
|
||||||
|
DmaCopy32(3, &gMoreSpritePtrs[2][temp2[1] * 0x10], dest, 0x40 * 4);
|
||||||
|
|
||||||
temp1 = param_2 * 0x20 + 0x6010000;
|
|
||||||
temp3 = gSpriteAnimations_322[item]->index;
|
|
||||||
temp2 = &gMoreSpritePtrs[1][temp3 * 2];
|
|
||||||
DmaCopy32(3, &gMoreSpritePtrs[2][temp2[1] * 0x10], temp1, 0x40 * 4);
|
|
||||||
ammoCount = -1;
|
ammoCount = -1;
|
||||||
|
|
||||||
switch (item) {
|
switch (item) {
|
||||||
case 7:
|
case 7:
|
||||||
case 8:
|
case 8:
|
||||||
|
@ -1270,15 +1278,16 @@ void sub_080A5F48(Item item, u32 param_2) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (-1 < (int)ammoCount) {
|
if (ammoCount < 0) return;
|
||||||
tensDigit = Div(ammoCount, 10);
|
|
||||||
item = rem;
|
ret.raw = ((DivRem*)Div)(ammoCount,10); //by casting to DivRem, we can recover the remainder from the Div call
|
||||||
if ((int)tensDigit >= 10) {
|
onesDigit = ret.values.v2;
|
||||||
tensDigit = 9;
|
tensDigit = ret.values.v1;
|
||||||
}
|
|
||||||
DmaCopy32(3, gUnk_085C4620 + tensDigit * 0x8, temp1, 0x8 * 4);
|
if (tensDigit >= 10) tensDigit = 9;
|
||||||
DmaCopy32(3, gUnk_085C4620 + (item + 10) * 0x8, temp1 + 0x20, 0x8 * 4);
|
|
||||||
}
|
DmaCopy32(3, gUnk_085C4620 + tensDigit * 0x8, dest, 0x8 * 4);
|
||||||
|
DmaCopy32(3, gUnk_085C4620 + (onesDigit + 10) * 0x8, dest + 0x20, 0x8 * 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PauseMenu_Screen_7(void) {
|
void PauseMenu_Screen_7(void) {
|
||||||
|
|
Loading…
Reference in New Issue