-
Notifications
You must be signed in to change notification settings - Fork 3
/
modExtractor.bas
327 lines (220 loc) · 6.53 KB
/
modExtractor.bas
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
Attribute VB_Name = "modExtractor"
'###########################################
'modExtractor.bas
'vbgamer45
'###########################################
Dim Filecount As Integer
Dim WavCount As Integer
Global Finalkey43 As String * 256
Global Finalkey50 As String * 256
Global Finalkey51 As String * 256
Global Finalkey52 As String * 256
Global Finalkey53Beta As String * 256
Global Finalkey53A As String * 256
Global Finalkey54 As String * 256
Global Finalkey60 As String * 256
Sub GetBitmap(Filename As String, Offset As Long)
Dim Height As Long
Dim Width As Long
Dim EndofBmp As Long
Dim bmpHeader As String * 55
'BM6 VERSION
Dim f As Long
f = 19
Close
Open Filename For Binary Access Read Lock Read As f
Seek f, Offset
Get f, Offset, bmpHeader
Seek f, Offset + 18
'get height
Get f, Offset + 18, Height
'Get width
Get f, Offset + 22, Width
If Height > 2000 Then Exit Sub
If Width > 2000 Then Exit Sub
If Height < 0 Then Exit Sub
If Width < 0 Then Exit Sub
'Calcute end of bmp
EndofBmp = 55 + (Height * Width * 3)
Dim k As String * 1
Dim i As Long
g = FreeFile
Open App.Path & "\dump\images\img" & Filecount & ".bmp" For Binary Access Write Lock Write As g
Put g, , bmpHeader
Seek f, Offset + 55
For i = 55 To EndofBmp
Get f, Offset + i, k
Put g, , k
Next i
Close g
Close f
'Keep track bmp nubmer
Filecount = Filecount + 1
End Sub
Sub GetWav(Filename As String, Offset As Long)
Dim Size As Long
'RIFF VERSION
Dim f As Long
f = 20
Close
Open Filename For Binary Access Read Lock Read As f
Seek f, Offset
'get size
Get f, Offset + 4, Size
Size = Size + 7
If Size > 1000000 Then Exit Sub
If Size < 0 Then Exit Sub
'Calcute end of bmp
Dim k As String * 1
Dim i As Long
g = FreeFile
KillOldWavs (App.Path & "\dump\sounds\wav" & WavCount & ".wav")
Open App.Path & "\dump\sounds\wav" & WavCount & ".wav" For Binary Access Write Lock Write As g
For i = 0 To Size
Get f, Offset + i, k
Put g, , k
Next i
Close g
Close f
'Keep track wav nubmer
WavCount = WavCount + 1
End Sub
Sub Get52Key(Filename As String, Offset As Long)
Dim f As Long
f = 20
Close
Open Filename For Binary Access Read Lock Read As f
Seek f, Offset
'Get f, Offset + 40, modExtractor.Finalkey52
Get f, Offset + 56, modExtractor.Finalkey52
Close f
Open App.Path & "\final52.txt" For Binary Access Write Lock Write As f
Put f, , modExtractor.Finalkey52
Close f
End Sub
Sub Get51Key(Filename As String, Offset As Long)
Dim f As Long
f = 20
Close
Open Filename For Binary Access Read Lock Read As f
Seek f, Offset
' Get f, Offset + 40, modExtractor.Finalkey51
Get f, Offset + 56, modExtractor.Finalkey51
Close f
Open App.Path & "\final51.txt" For Binary Access Write Lock Write As f
Put f, , modExtractor.Finalkey51
Close f
End Sub
Sub Get43Key(Filename As String, Offset As Long)
Dim f As Long
f = 20
Close
Open Filename For Binary Access Read Lock Read As f
Seek f, Offset
'Get f, Offset + 124, modExtractor.Finalkey50
Get f, Offset + 120, modExtractor.Finalkey43
Close f
Open App.Path & "\final43.txt" For Binary Access Write Lock Write As f
Put f, , modExtractor.Finalkey43
Close f
End Sub
Sub Get50Key(Filename As String, Offset As Long)
Dim f As Long
f = 20
Close
Open Filename For Binary Access Read Lock Read As f
Seek f, Offset
'Get f, Offset + 124, modExtractor.Finalkey50
Get f, Offset + 204, modExtractor.Finalkey50
Close f
Open App.Path & "\final50.txt" For Binary Access Write Lock Write As f
Put f, , modExtractor.Finalkey50
Close f
End Sub
Sub Get53BetaKey(Filename As String, Offset As Long)
Dim f As Long
f = 20
Close
Open Filename For Binary Access Read Lock Read As f
Seek f, Offset
'Get f, Offset + 40, modExtractor.Finalkey53Beta
Get f, Offset + 56, modExtractor.Finalkey53Beta
Close f
Open App.Path & "\final53Beta.txt" For Binary Access Write Lock Write As f
Put f, , modExtractor.Finalkey53Beta
Close f
End Sub
Sub Get53AKey(Filename As String, Offset As Long)
Dim f As Long
f = 20
Close
Open Filename For Binary Access Read Lock Read As f
Seek f, Offset
'Get f, Offset + 40, modExtractor.Finalkey53Beta
Get f, Offset + 56, modExtractor.Finalkey53A
Close f
Open App.Path & "\final53A.txt" For Binary Access Write Lock Write As f
Put f, , modExtractor.Finalkey53A
Close f
End Sub
Sub Get54Key(Filename As String, Offset As Long)
Dim f As Long
f = 20
Close
Open Filename For Binary Access Read Lock Read As f
Seek f, Offset
Get f, Offset + 56, modExtractor.Finalkey54
Close f
Open App.Path & "\final54.txt" For Binary Access Write Lock Write As f
Put f, , modExtractor.Finalkey54
Close f
End Sub
Sub Get60Key(Filename As String, Offset As Long)
Dim f As Long
f = 20
Close
Open Filename For Binary Access Read Lock Read As f
Seek f, Offset
'Get F, Offset + 41, modExtractor.Finalkey60
Get f, Offset + 41, modExtractor.Finalkey60
Close f
Open App.Path & "\final60.txt" For Binary Access Write Lock Write As f
Put f, , modExtractor.Finalkey60
Close f
End Sub
Sub KillOldWavs(Filename As String)
On Error Resume Next
Kill (App.Path & "\dump\sounds\wav" & WavCount & ".wav")
End Sub
Sub ExtractGmd(Offset As Long)
'On Error GoTo nofile:
Dim Temp As Byte
Open App.Path & "\temp\game.enc" For Binary Access Read Lock Read As #2
Filesize = LOF(2)
'Now Decrypt the file
Open App.Path & "\temp\game.gmd" For Binary Access Write Lock Write As #3
Seek #2, Offset
Do Until EOF(2)
Get #2, , Temp
If LOF(2) <> Loc(2) - 1 Then
Put #3, , Temp
End If
Loop
Dim d As String
d = vbCrLf & "This gmd was made from the GameMaker 5.x Decompiler" & vbCrLf
Put #3, , d
d = "It was decompiled on : " & Date & vbCrLf
Put #3, , d1
d = "By: " & Environ("USERNAME") & vbCrLf
Put #3, , d
d = "Version of GmDecompiler=" & Version & vbCrLf
Put #3, , d
d = "To stop decompilers get the antidecompiler at gmupload"
Put #3, , d
Close #3
Close #2
'Exit Sub
'nofile:
' MsgBox err.Description
'Exit Sub
End Sub