mirror of
https://github.com/krystalgamer/spidey-decomp.git
synced 2024-11-26 23:00:30 +00:00
Pack_Pack
This commit is contained in:
parent
07336347d0
commit
6d77ff10b4
60
pack.cpp
60
pack.cpp
@ -3,6 +3,7 @@
|
||||
#include "validate.h"
|
||||
|
||||
EXPORT SPack Pack_pFull;
|
||||
EXPORT u32 gPackRelated;
|
||||
|
||||
// @SMALLTODO
|
||||
void Pack_Init(void)
|
||||
@ -10,10 +11,58 @@ void Pack_Init(void)
|
||||
printf("Pack_Init(void)");
|
||||
}
|
||||
|
||||
// @SMALLTODO
|
||||
void Pack_Pack(i32,i32,i32,i32 *,i32 *,i32,i32,u32)
|
||||
// @Ok
|
||||
SPack* Pack_Pack(
|
||||
i32 Type,
|
||||
i32 WW,
|
||||
i32 H,
|
||||
i32 *X,
|
||||
i32 *Y,
|
||||
i32 BPP,
|
||||
i32,
|
||||
u32)
|
||||
{
|
||||
printf("Pack_Pack(i32,i32,i32,i32 *,i32 *,i32,i32,u32)");
|
||||
i32 v6 = WW;
|
||||
|
||||
print_if_false(Type < 0 || WW <= 512, "width out of range");
|
||||
print_if_false(H <= 512, "height out of range");
|
||||
|
||||
if (BPP == 4 || BPP == 8 || BPP == 16)
|
||||
print_if_false(1u, "Bad BPP param in pack_pack().");
|
||||
else
|
||||
print_if_false(0, "Bad BPP param in pack_pack().");
|
||||
|
||||
SPack* pPack = static_cast<SPack*>(
|
||||
DCMem_New(sizeof(SPack), 0, 1, 0, 1));
|
||||
|
||||
*X = 0;
|
||||
pPack->X = 0;
|
||||
|
||||
gPackRelated += 256;
|
||||
*Y = gPackRelated;
|
||||
pPack->Y = gPackRelated;
|
||||
pPack->pNext = 0;
|
||||
|
||||
if (BPP != 4)
|
||||
{
|
||||
if (BPP == 8)
|
||||
{
|
||||
v6 >>= 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
v6 >>= 2;
|
||||
}
|
||||
|
||||
print_if_false(v6 > 0, "width too small");
|
||||
|
||||
pPack->W = v6;
|
||||
pPack->H = H;
|
||||
pPack->pNext = Pack_pFull.pNext;
|
||||
Pack_pFull.pNext = pPack;
|
||||
|
||||
return pPack;
|
||||
}
|
||||
|
||||
// @Ok
|
||||
@ -42,5 +91,10 @@ void Pack_Unpack(SPack* a1)
|
||||
void validate_SPack(void)
|
||||
{
|
||||
VALIDATE_SIZE(SPack, 0xC);
|
||||
|
||||
VALIDATE(SPack, X, 0x0);
|
||||
VALIDATE(SPack, Y, 0x2);
|
||||
VALIDATE(SPack, W, 0x4);
|
||||
VALIDATE(SPack, H, 0x6);
|
||||
VALIDATE(SPack, pNext, 0x8);
|
||||
}
|
||||
|
7
pack.h
7
pack.h
@ -7,12 +7,15 @@
|
||||
|
||||
struct SPack
|
||||
{
|
||||
u8 padTop[8];
|
||||
u16 X;
|
||||
u16 Y;
|
||||
u16 W;
|
||||
u16 H;
|
||||
SPack* pNext;
|
||||
};
|
||||
|
||||
EXPORT void Pack_Init(void);
|
||||
EXPORT void Pack_Pack(i32,i32,i32,i32 *,i32 *,i32,i32,u32);
|
||||
EXPORT SPack* Pack_Pack(i32,i32,i32,i32 *,i32 *,i32,i32,u32);
|
||||
EXPORT void Pack_Unpack(SPack *);
|
||||
|
||||
void validate_SPack(void);
|
||||
|
Loading…
Reference in New Issue
Block a user