M3dInit_FlagZeroWibbles

This commit is contained in:
krystalgamer 2024-05-09 18:46:44 +02:00
parent e69f0683fd
commit 12406d3dfc
3 changed files with 111 additions and 28 deletions

View File

@ -1,3 +1,77 @@
#include "m3dinit.h"
#include "validate.h"
// @Ok
// Hated this piece of shit, memoery accesses are fucked up on the original for some reason
// there might be a hidden struct or smth, it's not the first time I see something like this
// where pointers to the middle of the struct are used
void M3dInit_FlagZeroWibbles(STexWibItemInfo *pTexWibItemInfo)
{
print_if_false(pTexWibItemInfo != NULL, "NULL pTexWibItemInfo");
STexWibItemInfo *v1 = pTexWibItemInfo;
STexWibItemInfo *v3;
unsigned int v2;
while (v1->ItemOffset.Full)
{
v2 = 0;
v1->ZeroUAmplitudes = 1;
v2 = v1->field_C.Full;
v1->ZeroVAmplitudes = 1;
v3 = v1 + 1;
#define AmplitudeCheck(x, arg) {\
int tmp = 0;\
tmp = (x);\
if ( ((int)((tmp) & 0xFFFFFFF0)) > ((int)0x00000050) ) {\
v1->arg = 0; }\
}
#define UAmplitudeCheck(x) AmplitudeCheck(x, ZeroUAmplitudes)
#define VAmplitudeCheck(x) AmplitudeCheck(x, ZeroVAmplitudes)
while (v2)
{
UAmplitudeCheck(v3->ItemOffset.Byte[2]);
VAmplitudeCheck(v3->ItemOffset.Byte[3]);
UAmplitudeCheck(v3->field_6);
VAmplitudeCheck(v3->field_7);
UAmplitudeCheck(v3->field_8);
VAmplitudeCheck(v3->field_9);
UAmplitudeCheck(v3->ZeroUAmplitudes);
VAmplitudeCheck(v3->ZeroVAmplitudes);
v3++;
v2--;
}
v1 = v3;
}
}
void validate_STexWibItemInfo()
{
VALIDATE_SIZE(STexWibItemInfo, 0x10);
VALIDATE(STexWibItemInfo, ItemOffset, 0x0);
VALIDATE(STexWibItemInfo, field_6, 0x6);
VALIDATE(STexWibItemInfo, field_7, 0x7);
VALIDATE(STexWibItemInfo, field_8, 0x8);
VALIDATE(STexWibItemInfo, field_9, 0x9);
VALIDATE(STexWibItemInfo, field_C, 0xC);
VALIDATE(STexWibItemInfo, ZeroUAmplitudes, 0xE);
VALIDATE(STexWibItemInfo, ZeroVAmplitudes, 0xF);
}

View File

@ -5,4 +5,39 @@
#include "export.h"
union ItemOffsetUnion
{
unsigned Full;
unsigned char Byte[4];
};
union UnionItemInfo
{
unsigned __int16 Full;
unsigned char Byte[2];
};
struct STexWibItemInfo
{
ItemOffsetUnion ItemOffset;
unsigned char padAfterOffset[2];
unsigned char field_6;
unsigned char field_7;
unsigned char field_8;
unsigned char field_9;
unsigned char padAfter9[2];
UnionItemInfo field_C;
unsigned char ZeroUAmplitudes;
unsigned char ZeroVAmplitudes;
};
EXPORT void M3dInit_FlagZeroWibbles(STexWibItemInfo *pTexWibItemInfo);
void validate_STexWibItemInfo();
#endif

View File

@ -6,68 +6,41 @@
#include "vector.h"
#include "friction.h"
#include "bit.h"
#include "front.h"
#include "pshell.h"
#include "baddy.h"
#include "mj.h"
#include "submarin.h"
#include "venom.h"
#include "ps2funcs.h"
#include "blackcat.h"
#include "torch.h"
#include "hostage.h"
#include "cop.h"
#include "carnage.h"
#include "chopper.h"
#include "docock.h"
#include "jonah.h"
#include "lizard.h"
#include "lizman.h"
#include "mysterio.h"
#include "platform.h"
#include "rhino.h"
#include "scorpion.h"
#include "simby.h"
#include "spclone.h"
#include "superock.h"
#include "thug.h"
#include "turret.h"
#include "shell.h"
#include "web.h"
#include "bit2.h"
#include "camera.h"
#include "quat.h"
#include "mem.h"
#include "exp.h"
#include "m3dcolij.h"
#include "m3dinit.h"
template<bool b>
@ -232,6 +205,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
validate_SHandle();
validate_CItemFrag();
validate_SLineInfo();
validate_STexWibItemInfo();