-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcommand-functions.cpp
More file actions
98 lines (86 loc) · 2.71 KB
/
command-functions.cpp
File metadata and controls
98 lines (86 loc) · 2.71 KB
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
#include <windows.h>
#include <stdio.h>
#include "text.h"
#include "operation.h"
#include "console.h"
#include "netconfig.h"
#include "quest.h"
#include "encryption.h"
#include "license.h"
#include "version.h"
#include "battleparamentry.h"
#include "itemraretable.h"
#include "player.h"
#include "map.h"
#include "client.h"
#include "listenthread.h"
#include "lobby.h"
#include "server.h"
#include "command-functions.h"
#include "command-input-structures.h"
// Translates a command from BB to DC/GC format
bool TranslateCommandBBDCGC(COMMAND_HEADER_BB* a,COMMAND_HEADER_DCGC* b)
{
memcpy((void*)((DWORD)b + sizeof(COMMAND_HEADER_DCGC)),
(void*)((DWORD)a + sizeof(COMMAND_HEADER_BB)),
a->size - sizeof(COMMAND_HEADER_BB));
b->size = a->size - 4;
b->command = a->command;
b->flag = a->flag;
return true;
}
// Translates a command from BB to PC format
bool TranslateCommandBBPC(COMMAND_HEADER_BB* a,COMMAND_HEADER_PC* b)
{
memcpy((void*)((DWORD)b + sizeof(COMMAND_HEADER_PC)),
(void*)((DWORD)a + sizeof(COMMAND_HEADER_BB)),
a->size - sizeof(COMMAND_HEADER_BB));
b->size = a->size - 4;
b->command = a->command;
b->flag = a->flag;
return true;
}
// Translates a command from DC/GC to BB format
bool TranslateCommandDCGCBB(COMMAND_HEADER_DCGC* a,COMMAND_HEADER_BB* b)
{
memcpy((void*)((DWORD)b + sizeof(COMMAND_HEADER_BB)),
(void*)((DWORD)a + sizeof(COMMAND_HEADER_DCGC)),
a->size - sizeof(COMMAND_HEADER_DCGC));
b->size = a->size + 4;
b->command = a->command;
b->flag = a->flag;
return true;
}
// Translates a command from DC/GC to PC format
bool TranslateCommandDCGCPC(COMMAND_HEADER_DCGC* a,COMMAND_HEADER_PC* b)
{
memcpy((void*)((DWORD)b + sizeof(COMMAND_HEADER_PC)),
(void*)((DWORD)a + sizeof(COMMAND_HEADER_DCGC)),
a->size - sizeof(COMMAND_HEADER_DCGC));
b->size = a->size;
b->command = a->command;
b->flag = a->flag;
return true;
}
// Translates a command from PC to BB format
bool TranslateCommandPCBB(COMMAND_HEADER_PC* a,COMMAND_HEADER_BB* b)
{
memcpy((void*)((DWORD)b + sizeof(COMMAND_HEADER_BB)),
(void*)((DWORD)a + sizeof(COMMAND_HEADER_PC)),
a->size - sizeof(COMMAND_HEADER_PC));
b->size = a->size + 4;
b->command = a->command;
b->flag = a->flag;
return true;
}
// Translates a command from PC to DC/GC format
bool TranslateCommandPCDCGC(COMMAND_HEADER_PC* a,COMMAND_HEADER_DCGC* b)
{
memcpy((void*)((DWORD)b + sizeof(COMMAND_HEADER_DCGC)),
(void*)((DWORD)a + sizeof(COMMAND_HEADER_PC)),
a->size - sizeof(COMMAND_HEADER_PC));
b->size = a->size;
b->command = a->command;
b->flag = a->flag;
return true;
}