-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmulti.cpp
205 lines (170 loc) · 6.09 KB
/
multi.cpp
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
// -----------------------------------------------------------------
// Multi Plug-in for Ragnarok Online Patcher Lite (codename: RSU)
// (c) 2009-2010 Ai4rei/AN
// Plugin by: Kisuka
// Allows for patching multiple RO GRF files + private server GRF using 1 patch client.
// -----------------------------------------------------------------
#include "rsu.plug.h" // Plug SDK
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
static PlugInterfaceQueryFunc Plug_InterfaceQuery = NULL;
static IPlugCommon* lpCommon = NULL;
static unsigned char PatchStep = 0;
enum
{
PATCH_KRO = 0,
PATCH_RE,
PATCH_CUSTOM,
};
// Set Patch Info for each patch step / GRF.
static bool __stdcall Set_Patch_Info(void* lpContext)
{
switch((unsigned char)lpContext)
{
// Set kRO Patch Settings
case PATCH_KRO:
lpCommon->SetPatchInfo(RSU_IPATCH_INFFILE, "patch.inf");
lpCommon->SetPatchInfo(RSU_IPATCH_GRFFILE, "data.grf");
lpCommon->SetPatchInfo(RSU_IPATCH_WEBSITE, "webpatch.ragnarok.co.kr");
lpCommon->SetPatchInfo(RSU_IPATCH_WEBPATH, "/patch");
lpCommon->SetPatchInfo(RSU_IPATCH_WEBDENY, "patch_allow.txt");
lpCommon->SetPatchInfo(RSU_IPATCH_WEBLIST, "patch.txt");
lpCommon->SetPatchInfo(RSU_IPATCH_FTPSITE, "ragnarok.nowcdn.co.kr");
lpCommon->SetPatchInfo(RSU_IPATCH_FTPUSER, "Anonymous");
lpCommon->SetPatchInfo(RSU_IPATCH_FTPPASS, "");
lpCommon->SetPatchInfo(RSU_IPATCH_FTPPATH, "/Patch");
lpCommon->SetPatchInfoNum(RSU_IPATCH_WEBPORT, 80);
lpCommon->SetPatchInfoNum(RSU_IPATCH_FTPPORT, 20021);
break;
// Set kRO:RE Patch Settings
case PATCH_RE:
lpCommon->SetPatchInfo(RSU_IPATCH_INFFILE, "patchRE.inf");
lpCommon->SetPatchInfo(RSU_IPATCH_GRFFILE, "rdata.grf");
lpCommon->SetPatchInfo(RSU_IPATCH_WEBSITE, "webpatch.ragnarok.co.kr");
lpCommon->SetPatchInfo(RSU_IPATCH_WEBPATH, "/patch");
lpCommon->SetPatchInfo(RSU_IPATCH_WEBDENY, "patch_allow_RE.txt");
lpCommon->SetPatchInfo(RSU_IPATCH_WEBLIST, "patchRE3.txt");
lpCommon->SetPatchInfo(RSU_IPATCH_FTPSITE, "ragnarok.nowcdn.co.kr");
lpCommon->SetPatchInfo(RSU_IPATCH_FTPUSER, "Anonymous");
lpCommon->SetPatchInfo(RSU_IPATCH_FTPPASS, "");
lpCommon->SetPatchInfo(RSU_IPATCH_FTPPATH, "/Patch");
lpCommon->SetPatchInfoNum(RSU_IPATCH_WEBPORT, 80);
lpCommon->SetPatchInfoNum(RSU_IPATCH_FTPPORT, 20021);
break;
// Set Private Server Patch Settings
case PATCH_CUSTOM:
// INF File to keep track of current patch (ex: PatchRRO.inf)
lpCommon->SetPatchInfo(RSU_IPATCH_INFFILE, "");
// GRF File where the data for this server's client is stored (ex: adata.grf)
lpCommon->SetPatchInfo(RSU_IPATCH_GRFFILE, "");
// HTTP Website where Patch list / allow is located
lpCommon->SetPatchInfo(RSU_IPATCH_WEBSITE, "");
// Port the HTTP Website is on, usually is 80.
lpCommon->SetPatchInfoNum(RSU_IPATCH_WEBPORT, 80);
// Directory the patch list / allow is located. Set to blank if in home. (ex: /patch)
lpCommon->SetPatchInfo(RSU_IPATCH_WEBPATH, "");
// Patch allow / deny txt file (ex: patch_allow.txt)
lpCommon->SetPatchInfo(RSU_IPATCH_WEBDENY, "");
// Patch list that lists of what patches to download (ex: patch.txt)
lpCommon->SetPatchInfo(RSU_IPATCH_WEBLIST, "");
// FTP Server where the patches are located.
lpCommon->SetPatchInfo(RSU_IPATCH_FTPSITE, "");
// Port the FTP server is on, usually is 21.
lpCommon->SetPatchInfoNum(RSU_IPATCH_FTPPORT, 21);
// Directory where the patches are stored on the FTP. leave blank if in home. (ex: /patch)
lpCommon->SetPatchInfo(RSU_IPATCH_FTPPATH, "");
// FTP user, may need to set as Anonymous if no user is set.
lpCommon->SetPatchInfo(RSU_IPATCH_FTPUSER, "");
// Password for FTP user.
lpCommon->SetPatchInfo(RSU_IPATCH_FTPPASS, "");
break;
// You had ONE job! What Happened?
default:
return false;
}
// All GREEN!
return true;
}
static bool __stdcall Plugin_OnEvent(unsigned long luEvent, unsigned long luData, void* lpData)
{
IPlugUI* lpUI;
switch(luEvent)
{
// Plug-in Initialized
case RSU_PLUG_EVENT_INITDONE:
// Set Client EXE & Command.
lpCommon->SetPatchInfo(RSU_IPATCH_EXEFILE, ""); // (ex: ragexe.exe)
lpCommon->SetPatchInfo(RSU_IPATCH_EXECMDL, ""); // (ex: 1rag1)
break;
// Interface is Ready
case RSU_PLUG_EVENT_UI_INITDONE:
// query for UI interface functions
if(Plug_InterfaceQuery(RSU_PLUG_VERSION1, RSU_PLUG_TYPE_UI, NULL, (void**)&lpUI))
{
// Set Status Text
lpUI->SetStatus("Press \"Start\" to Update.");
// Release Interface
lpUI->Release(lpUI);
}
break;
// Add Tasks to Queue
case RSU_PLUG_EVENT_QUERYTASK:
// Set kRO Settings
if(PatchStep == PATCH_KRO)
{
if(lpCommon->PushTask(&Set_Patch_Info, (unsigned char*)PATCH_KRO, RSU_TASK_FAIL_RETRYONCE|RSU_TASK_FAIL_CONTINUE))
PatchStep++;
}
// Set kRO:RE Settings
else if(PatchStep == PATCH_RE)
{
if(lpCommon->PushTask(&Set_Patch_Info, (unsigned char*)PATCH_RE, RSU_TASK_FAIL_RETRYONCE|RSU_TASK_FAIL_CONTINUE))
PatchStep++;
}
// Set Private Server Settings
else if(PatchStep == PATCH_CUSTOM)
{
if(lpCommon->PushTask(&Set_Patch_Info, (unsigned char*)PATCH_CUSTOM, RSU_TASK_FAIL_RETRYONCE|RSU_TASK_FAIL_ABORT))
PatchStep++;
}
// All Finished!
else
{
break;
}
// Perform Patching
lpCommon->PushTask(NULL, NULL, RSU_TASK_FAIL_RETRYONCE|RSU_TASK_FAIL_ABORT);
break;
// Not Processed
default:
return false;
}
return true; // Processed
// Unused
lpData;
luData;
}
void __stdcall Plugin_Quit(void)
{
lpCommon->Release(lpCommon);
}
bool __stdcall Plugin_Init(PlugInterfaceQueryFunc lpInterfaceQuery, PlugInterfaceOnEventFunc* lppOnEvent, void* lpReserved)
{
// store interface query function
Plug_InterfaceQuery = lpInterfaceQuery;
// pass notification function
*lppOnEvent = &Plugin_OnEvent;
if(!Plug_InterfaceQuery(RSU_PLUG_VERSION2, RSU_PLUG_TYPE_COMMON, NULL, (void**)&lpCommon))
{
return false;
}
return true;
lpReserved; // Unused
}
bool __stdcall Plugin_Load(unsigned long luAppVersion, unsigned long* luPlugVersion)
{
// pass plugin's version
*luPlugVersion = RSU_PLUG_VERSION_CURRENT;
return true;
luAppVersion; // Unused
}