CMenu::CMenu

This commit is contained in:
krystalgamer 2024-05-19 17:22:29 +02:00
parent c9b5f7568a
commit d4705f250f
4 changed files with 154 additions and 120 deletions

View File

@ -3,9 +3,54 @@
// @NotOk
// Missing reset call
CMenu::CMenu(int x,int y,unsigned char Justification,int HiScale,int LowScale, int LineSep)
{
this->mX = x;
this->mY = y;
this->mJustification = Justification;
this->mLineSep = LineSep;
for (int i = 0; i<40; i++)
{
this->mEntry[i].unk_c = 0x80;
this->mEntry[i].unk_d = 0x80;
this->mEntry[i].unk_e = 0x80;
this->mEntry[i].field_14 = 69;
this->mEntry[i].field_15 = 60;
this->mEntry[i].field_16 = 107;
this->mEntry[i].field_11 = 69;
this->mEntry[i].field_12 = 60;
this->mEntry[i].field_13 = 107;
this->mEntry[i].field_17 = 40;
this->mEntry[i].field_18 = 35;
this->mEntry[i].field_19 = 62;
this->mEntry[i].field_8 = HiScale;
this->mEntry[i].field_A = LowScale;
}
/*
this->scrollbar_one = 2;
this->field_1B = -1;
this->scrollbar_zero = 1;
this->field_32 = 0;
this->field_30 = 0;
this->field_34 = 0;
this->field_38 = 0;
*/
this->scrollbar_one = 2;
this->field_32 = 0;
this->field_30 = 0;
this->field_34 = 0;
this->field_38 = 0;
this->selected_index = 0;
this->field_1B = -1;
this->scrollbar_zero = 1;
// Reset
}
CMenu::~CMenu()
@ -30,16 +75,44 @@ void validate_CMenu(void)
VALIDATE(CMenu, mCursorLine, 0x15);
VALIDATE(CMenu, mNumLines, 0x1A);
VALIDATE(CMenu, field_1B, 0x1B);
VALIDATE(CMenu, field_1E, 0x1E);
VALIDATE(CMenu, mX, 0x24);
VALIDATE(CMenu, mY, 0x28);
VALIDATE(CMenu, mLineSep, 0x2C);
VALIDATE(CMenu, field_30, 0x30);
VALIDATE(CMenu, field_32, 0x32);
VALIDATE(CMenu, field_34, 0x34);
VALIDATE(CMenu, field_38, 0x38);
VALIDATE(CMenu, mEntry, 0x3C);
}
void validate_SEntry(void)
{
VALIDATE_SIZE(SEntry, 0x20);
VALIDATE(SEntry, name, 0x0);
VALIDATE(SEntry, val_a, 0x4);
VALIDATE(SEntry, val_b, 0x6);
VALIDATE(SEntry, field_8, 0x8);
VALIDATE(SEntry, field_A, 0xA);
VALIDATE(SEntry, unk_a, 0xC);
VALIDATE(SEntry, unk_b, 0xD);
VALIDATE(SEntry, unk_c, 0xE);
VALIDATE(SEntry, unk_d, 0xF);
VALIDATE(SEntry, unk_e, 0x10);
VALIDATE(SEntry, field_11, 0x11);
VALIDATE(SEntry, field_12, 0x12);
VALIDATE(SEntry, field_13, 0x13);
VALIDATE(SEntry, field_14, 0x14);
VALIDATE(SEntry, field_15, 0x15);
VALIDATE(SEntry, field_16, 0x16);
VALIDATE(SEntry, field_17, 0x17);
VALIDATE(SEntry, field_18, 0x18);
VALIDATE(SEntry, field_19, 0x19);
VALIDATE(SEntry, field_1A, 0x1A);
VALIDATE(SEntry, field_1B, 0x1B);
VALIDATE(SEntry, what, 0x1C);
}

30
front.h
View File

@ -7,7 +7,28 @@
struct SEntry
{
unsigned char fullPad[0x20];
int name;
__int16 val_a;
__int16 val_b;
__int16 field_8;
__int16 field_A;
unsigned char unk_a;
unsigned char unk_b;
unsigned char unk_c;
unsigned char unk_d;
unsigned char unk_e;
unsigned char field_11;
unsigned char field_12;
unsigned char field_13;
unsigned char field_14;
unsigned char field_15;
unsigned char field_16;
unsigned char field_17;
unsigned char field_18;
unsigned char field_19;
unsigned char field_1A;
unsigned char field_1B;
int what;
};
class CMenu {
@ -34,6 +55,7 @@ public:
unsigned char padAfterCursorLine[4];
unsigned char mNumLines;
char field_1B;
unsigned char padAfterNumLines[2];
__int16 field_1E;
@ -42,7 +64,11 @@ public:
int mX;
int mY;
int mLineSep;
unsigned char padAfterLineSep[0xC];
__int16 field_30;
__int16 field_32;
int field_34;
int field_38;
SEntry mEntry[40];
};

View File

@ -1,108 +1,22 @@
00000350 field_350 dd ?
00000354 field_354 dd ?
00000358 field_358 dd ?
0000035C field_35C dd ?
00000360 field_360 dd ?
00000364 field_364 dd ?
00000368 field_368 dd ?
0000036C field_36C dd ?
00000370 field_370 dd ?
00000374 field_374 dd ?
00000378 field_378 dd ?
0000037C field_37C dd ?
00000380 field_380 dd ?
00000384 field_384 dd ?
00000388 field_388 dd ?
0000038C field_38C dd ?
00000390 field_390 dd ?
00000394 field_394 dd ?
00000398 db ? ; undefined
00000399 db ? ; undefined
0000039A db ? ; undefined
0000039B db ? ; undefined
0000039C field_39C dd ?
000003A0 db ? ; undefined
000003A1 db ? ; undefined
000003A2 db ? ; undefined
000003A3 db ? ; undefined
000003A4 db ? ; undefined
000003A5 db ? ; undefined
000003A6 db ? ; undefined
000003A7 db ? ; undefined
000003A8 db ? ; undefined
000003A9 db ? ; undefined
000003AA db ? ; undefined
000003AB db ? ; undefined
000003AC db ? ; undefined
000003AD db ? ; undefined
000003AE db ? ; undefined
000003AF db ? ; undefined
000003B0 db ? ; undefined
000003B1 db ? ; undefined
000003B2 db ? ; undefined
000003B3 db ? ; undefined
000003B4 db ? ; undefined
000003B5 db ? ; undefined
000003B6 db ? ; undefined
000003B7 db ? ; undefined
000003B8 db ? ; undefined
000003B9 db ? ; undefined
000003BA db ? ; undefined
000003BB db ? ; undefined
000003BC db ? ; undefined
000003BD db ? ; undefined
000003BE db ? ; undefined
000003BF db ? ; undefined
000003C0 db ? ; undefined
000003C1 db ? ; undefined
000003C2 db ? ; undefined
000003C3 db ? ; undefined
000003C4 db ? ; undefined
000003C5 db ? ; undefined
000003C6 db ? ; undefined
000003C7 db ? ; undefined
000003C8 db ? ; undefined
000003C9 db ? ; undefined
000003CA db ? ; undefined
000003CB db ? ; undefined
000003CC db ? ; undefined
000003CD db ? ; undefined
000003CE db ? ; undefined
000003CF db ? ; undefined
000003D0 db ? ; undefined
000003D1 db ? ; undefined
000003D2 db ? ; undefined
000003D3 db ? ; undefined
000003D4 db ? ; undefined
000003D5 db ? ; undefined
000003D6 db ? ; undefined
000003D7 db ? ; undefined
000003D8 db ? ; undefined
000003D9 db ? ; undefined
000003DA db ? ; undefined
000003DB db ? ; undefined
000003DC field_3DC dd ?
000003E0 field_3E0 dd ?
000003E4 field_3E4 dd ?
000003E8 db ? ; undefined
000003E9 db ? ; undefined
000003EA db ? ; undefined
000003EB db ? ; undefined
000003EC db ? ; undefined
000003ED db ? ; undefined
000003EE db ? ; undefined
000003EF db ? ; undefined
000003F0 db ? ; undefined
000003F1 db ? ; undefined
000003F2 db ? ; undefined
000003F3 db ? ; undefined
000003F4 db ? ; undefined
000003F5 db ? ; undefined
000003F6 db ? ; undefined
000003F7 db ? ; undefined
000003F8 field_3F8 dd ?
000003FC field_3FC dd ?
00000400 field_400 dd ?
00000404 field_404 dd ?
00000408 field_408 dd ?
0000040C field_40C dd ?
00000000 name dd ? ; offset
00000004 val_a dw ?
00000006 val_b dw ?
00000008 field_8 dw ?
0000000A field_A dw ?
0000000C unk_a db ?
0000000D unk_b db ?
0000000E unk_c db ?
0000000F unk_d db ?
00000010 unk_e db ?
00000011 field_11 db ?
00000012 field_12 db ?
00000013 field_13 db ?
00000014 field_14 db ?
00000015 field_15 db ?
00000016 field_16 db ?
00000017 field_17 db ?
00000018 field_18 db ?
00000019 field_19 db ?
0000001A field_1A db ?
0000001B field_1B db ?
0000001C what dd ?

View File

@ -1,19 +1,37 @@
import sys
DECL = False
DECL = True
Debug = False
def to_decl(name, ty):
if ty == 'db':
print(f'unsigned char {name};')
return
elif ty == 'dw':
print(f'__int16 {name};')
return
elif ty == 'dd':
print(f'int {name};')
return
raise Exception(f"FUCK {name} {ty}")
def to_validate(name, cname, offset):
print(f'VALIDATE({cname}, {name}, {offset});')
def ida_filter(line):
if 'dd' in line:
return True
if 'dw' in line:
return True
if 'db' in line:
return True
return False
def main(argv, argc):
if argc != 2:
@ -24,22 +42,25 @@ def main(argv, argc):
with open(file, 'r') as fp:
lines = fp.readlines()
lines = filter(lambda x: 'field_' in x, lines)
lines = filter(ida_filter, lines)
lines = map(lambda x: x.strip(), lines)
lines = map(lambda x: x.split(), lines)
lines = map(lambda x: (x[1], x[2]), lines)
lines = map(lambda x: (x[1], x[2], int(x[0], 16)), lines)
lines = list(lines)
for (name, ty) in lines:
for (name, ty, offset) in lines:
if Debug:
print(name, ty, offset)
continue
if DECL:
to_decl(name, ty)
else:
offset = name.split('_')[1]
offset = f'0x{offset}'
to_validate(name, 'CSimby', offset)
h = f'{offset:x}'.upper()
to_validate(name, 'SEntry', f'0x{h}')