This repository has been archived by the owner on Jun 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
moho.h
586 lines (491 loc) · 9.68 KB
/
moho.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
/**
MohoEngine.dll Disassembling notes
*/
// Nothing here is concrete.
typedef unsigned int uint;
struct string
{
// 0x1c bytes
void* ptr1;
void* m_data; // SSO space start
void* ptr3;
void* ptr4;
void* ptr5;
void* ptr6;
// at 0x18
int size; // size < 0x10 => SSO
#ifdef CXX_BUILD
const char* data()
{
if(size < 0x10)
return (const char*)&m_data;
else
return (const char*)m_data;
}
#endif
};
struct vector
{
void* unknown1;
void** objects_begin;
void** objects_end;
void** objects_capacity_end;
#ifdef CXX_BUILD
void* operator[](int index)
{
if(index >= size())
return 0;
return objects_begin[index];
}
int size()
{
return objects_end - objects_begin;
}
#endif
};
struct list // probably not from visual c++, but made by gpg
// considering, it's not capacity based, probably made by gpg
{
void* objects_start; // 0 if empty
void* objects_end;
};
typedef int SOCKET;
// GPGCore
struct Stream
{
};
struct PipeStream // : Stream
{
// 0x48 bytes
char iDontSeeANeedToKnowTheStructure[0x48];
};
struct gpg_mutex
{
int vooodoo;
};
// LuaPlus
struct lua_state
{
int dummy;
};
struct LuaState
{
lua_state* _lua_state;
void* unknown1;
void* unknown2;
void* unknown3;
void* important1;
};
struct LuaStackObject
{
// 0x8 bytes
LuaState* state;
int stack_index;
};
struct LuaObject
{
// 0x14 bytes
void* unknown1; // objects_end?
void* unknown2; // objects_start?
LuaState* m_state;
int type;
void* unknown5; // n_objects??
/* Types:
-1 - None
0 - Nil
1 - Boolean
2 - LightUserData // || UserData
3 - Number // || Integer
4 - String
5 - Table
6 - CFunction
7 - Function
8 - UserData
*/
};
// Moho
struct linked_list
{
void* not_sure;
};
struct moho_set
{
int set_base; // integer_base >> 5 (bits in dword)
int unknown2;
uint* items_begin;
uint* items_end;
uint* items_capacity_end;
void* unknown6;
void* unknown7; // Used as memory for Short Set 'Optimization'
void* unknown8;
#ifdef CXX_BUILD
void add(int item)
{
items_begin[item>>5] |= 1 << (item & 0x1f);
}
void remove(int item)
{
items_begin[item>>5] &= ~( 1 << (item & 0x1f) );
}
bool operator[](int item)
{
return items_begin[item>>5] & (1 << (item & 0x1f));
}
#endif
};
struct Unknown1 // from WLD_SetupSessionInfo
{
// 0xA4 bytes
void* vtable;
void* self1;
void* self2;
// at 0xC
string lua_gameMods;
// at 0x28
string str2;
// at 0x60
int unknown1;
int unknown2;
int unknown3; // = -1
// at 0x6C
string str3;
// at 0x88
bool boolean1;
char _pad1[3];
int unknown4;
};
struct IClientManager
{
void* vtable;
};
struct RRuleGameRules
{
int dummy;
};
struct CWldMap
{
void* zero1;
void* zero2;
void* zero3;
};
struct SWldSessionInfo
{
// 0x30 bytes
string map_name;
// at 0x1C
int unknown1;
// at 0x20
int unknown2;
bool b1; // = true
bool b2;
bool b3;
char _pad1;
IClientManager* clientManager;
int unknown4; // = 255 possibly cmdSourceIndex
};
struct UserArmy
{
void* unknown1; // vtable?
string name;
// at 0x20
string nickname;
#ifndef FORGED_ALLIANCE
char datas[0xf4];
#else
char datas[0xec];
#endif
// at 0x130 Moho | at 0x128 FA
moho_set mValidCommandSources;
// at 0x148 FA
uint color;
// at 0x16C FA
int faction;
};
struct SimArmy
{
#ifdef FORGED_ALLIANCE
// Forged Alliance Code
void* vtable;
int unknown3;
int unknown4;
string name;
string nickname;
char datas[0xec];
// at 0x138 Moho | at 0x130 FA
moho_set mValidCommandSources;
// at 0x158 FA
string mArmyType; //? 'human' for players
// at 0x1C4 FA
struct{
float funknown1;
float funknown2;
} float_struct;
// at 0x1F0 FA
int unknown1;
int unknown2;
// at 0x1F8 FA
string unknown5;
#else
// Moho Code
// at 0x138 Moho | at 0x130 FA
moho_set mValidCommandSources;
#endif
};
struct Sim
{
// 0xAF8 bytes
#ifdef FORGED_ALLIANCE
char datas[0x90C];
// at 0x91C Moho | at 0x90C FA
vector armies;// <class Moho::SimArmy *>
// at 0x93C Moho | at 0x92C FA
int ourCmdSource; // possibly just current in simulation.
// at 0x984 FA
void* thing;
#else
#endif
};
struct CWldSession
{
// 0x508 bytes
// Information about values is from constructor.
CWldSession* self1; // = this
CWldSession* self2; // = this
void* self_weird1; // = this + 0x8
void* self_weird2; // = this + 0x8
// at 0x10
LuaState* state; // sim? set from constructor argument
void* zero1;
RRuleGameRules* rules;
CWldMap* map;
// at 0x20
void* zero2;
void* zero3;
string map_name;
char stuff[0x3ac];
// at 0x3f0
list /*?*/ armies; // <UserArmy*>
// at 0x470
vector cmdSources; // <SSTICommandSource>
// at 0x480
int ourCmdSource;
bool isReplay;
bool isBeingRecorded;
bool isMultiplayer;
// at 0x487
bool bool1; // set as true in Constructor.
int focusArmyIndex; // focused army, -1 = observer
bool isGameOver;
// at 0x4d4
bool cheatsEnabled;
};
struct STIDriver // : ISTIDriver
{
// 0x230 bytes
};
struct STIMap
{
// 0x1548 bytes
};
struct SSTICommandSource
{
// 0x24 bytes
int index;
string name;
int protocol;
};
struct CPushTask
{
char datas[0x24];
};
typedef CPushTask CPullTask;
struct INetConnector
{
void* vtable;
};
struct CLobby
{
// 0xC8 bytes
// at 0x20
LuaObject unknown0;
int unknown1;
int unknown2;
int unknown3;
int unknown4;
// at 0x44
CPushTask pushTask;
// at 0x60
CPullTask pullTask;
// at 0x84
bool hosted_or_joined; // Has CLobby been used to host/join yet?
// at 0x88
void* not_host; // 0 if we're host
// at 0x90
string our_name;
// at 0xAC
int our_UID;
// at 0xB0
struct
{
INetConnector* first_element;
INetConnector* last_element; // It will probably always be our CNetXXXConnector
} peer_list; // Probably singly-linked list
};
/// Tres Importante
struct sub_10392B10_ret
{
// 0x20 bytes
void* zero1; // self in CLobbyPeer.unknown2
void* zero2; // self in CLobbyPeer.unknown2
void* zero3; // self in CLobbyPeer.unknown2
int unknown1;
// at 0x10
char one1;
char zero4; // 1 in CLobbyPeer.unknown2
};
struct CLobbyPeer
{
// 0x50 bytes
CLobbyPeer* next; // Doubly linked list pointers
CLobbyPeer* prev;
string playerName;
// at 0x24
int ownerID; // User UID
int constant1;
short constant2;
char _pad1[2];
// at 0x30
int constant3; // enum?
float constant4; // = 0
int constant5;
int unknown1;
// at 0x40
sub_10392B10_ret* unknown2; // made in sub_10394180
int zero1;
int cmdSourceIndex; // == 255 => Unassigned
int playerNo;
/*
constant1, constant2, constant3, constant5
specially define the CLobbyUser
constant3:
1 - Host for a lobby we joined?
3 - Peer who connected to us?
6 - Game Peer of a Launched Game?
*/
};
struct CClientManagerImpl // : IClientManager
{
// 0x184D0 bytes
void* vtable;
// at 0x40C
gpg_mutex mLock;
// at 0x420
list mClients; // <IClient*>
INetConnector* mConnector;
// at 0x434
bool mWeAreReady;
bool mEveryoneIsReady;
char _pad1[2];
int mDispatchedBeat;
int mAvailableBeat;
int mFullyQueuedBeat;
int mPartiallyQueuedBeat;
int mGameSpeedClock;
int mGameSpeedRequester; // misspelling? :D
int mGameSpeed;
};
struct CClientBase // : IClient
{
// 0xD8 bytes
void* vtable;
string mNickname;
// at 0x20
int mIndex; // client index
int mUID;
IClientManager* clientManager;
// at 0x30
/**
+-------------------------------------------------------+
| |
| GOOD NEWS EVERYONE, IT'S A MOHO::SET*** |
| |
| ( It's still a really weird structure |
| due to the magical optimizations |
| possible for AABB Sets via bit manipulation. ) |
| |
| *** Probably |
+-------------------------------------------------------+
Actually, a shitty bitvector
*/
struct Unknown
{
int set_base; // integer_base >> 5 (bits in dword)
int unknown2;
void* memory;
void* memory_end;
void* unknown5;
void* unknown6;
void* unknown7;
void* unknown8;
} thisIsTheWeirdestStructureIHaveSeen;
//vector mValidCommandSources; // <int>?
//int unknwon3;
//int unknown4;
//int unknwon5;
//int unknown6;
// at 0x50
int mCommandSource;
bool mReady;
char _pad1[3];
PipeStream mPipe;
// at 0xA0
int mQueuedBeat;
int mDispatchedBeat;
int mAvailableBeatRemote;
vector mLatestAckReceived;
int mLatestBeatDispatchedRemote;
// at 0xC0
bool mEjectPending;
bool mEjected;
char _pad2[2];
list mEjectRequests; // <struct{ IClient* mRequester; int mAfterBeat;}>
void* unknown;
// at 0xD0
void* uknown;
};
struct CNetUDPConnetor // : INetConnector
{
INetConnector _base;
void* smth; // listen socket fd?
gpg_mutex mMutex;
// at 0x14
SOCKET mSocket;
// at 0x24
linked_list mConnections;// CNetUDPConnection*
};
struct ISTIDriver
{
void* vtable;
};
struct CSTIDriver // : ISTIDriver
{
ISTIDriver _base;
void* notcarenow;
IClientManager* clientManager;
};
/** Game Types
Multiplayer - CLobby::LaunchGame
Replay - VCR_SetupReplaySession
SinglePlayer - WLD_SetupSessionInfo
Saved Game - CSavedGame::CreateSinglePlayerSession
*/
/** Session State
0 - None?
1 - Loading?
2 - Started?
3 - SIM Initialized
4 - SIM Started
5 - Game Started
7 - Restart Requested
8 - Session Halted
*/