-
Notifications
You must be signed in to change notification settings - Fork 0
/
swfpreview.as
444 lines (314 loc) · 8.59 KB
/
swfpreview.as
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
#ifdef __hsp26__
;swfpreview (05/09/07)
#module "swfpreview"
#define IID_IShockwaveFlash "{D27CDB6C-AE6D-11CF-96B8-444553540000}"
#define IShockwaveFlash_get_ReadyState 7
#define IShockwaveFlash_get_TotalFrames 8
#define IShockwaveFlash_get_Playing 9
#define IShockwaveFlash_put_Playing 10
#define IShockwaveFlash_get_Quality 11
#define IShockwaveFlash_put_Quality 12
#define IShockwaveFlash_get_ScaleMode 13
#define IShockwaveFlash_put_ScaleMode 14
#define IShockwaveFlash_get_AlignMode 15
#define IShockwaveFlash_put_AlignMode 16
#define IShockwaveFlash_get_BackgroundColor 17
#define IShockwaveFlash_put_BackgroundColor 18
#define IShockwaveFlash_get_Loop 19
#define IShockwaveFlash_put_Loop 20
#define IShockwaveFlash_get_Movie 21
#define IShockwaveFlash_put_Movie 22
#define IShockwaveFlash_get_FrameNum 23
#define IShockwaveFlash_put_FrameNum 24
#define IShockwaveFlash_SetZoomRect 25
#define IShockwaveFlash_Zoom 26
#define IShockwaveFlash_Pan 27
#define IShockwaveFlash_Play 28
#define IShockwaveFlash_Stop 29
#define IShockwaveFlash_Back 30
#define IShockwaveFlash_Forward 31
#define IShockwaveFlash_Rewind 32
#define IShockwaveFlash_StopPlay 33
#define IShockwaveFlash_GotoFrame 34
#define IShockwaveFlash_CurrentFrame 35
#define IShockwaveFlash_IsPlaying 36
#define IShockwaveFlash_PercentLoaded 37
#define IShockwaveFlash_FrameLoaded 38
#define IShockwaveFlash_FlashVersion 39
#define IShockwaveFlash_get_WMode 40
#define IShockwaveFlash_put_WMode 41
#define IShockwaveFlash_get_SAlign 42
#define IShockwaveFlash_put_SAlign 43
#define IShockwaveFlash_get_Menu 44
#define IShockwaveFlash_put_Menu 45
#define IShockwaveFlash_get_Base 46
#define IShockwaveFlash_put_Base 47
#define IShockwaveFlash_get_Scale 48
#define IShockwaveFlash_put_Scale 49
#define IShockwaveFlash_get_DeviceFont 50
#define IShockwaveFlash_put_DeviceFont 51
#define IShockwaveFlash_get_EmbedMovie 52
#define IShockwaveFlash_put_EmbedMovie 53
#define IShockwaveFlash_get_BGColor 54
#define IShockwaveFlash_put_BGColor 55
#define IShockwaveFlash_get_Quality2 56
#define IShockwaveFlash_put_Quality2 57
#define IShockwaveFlash_LoadMovie 58
#define IShockwaveFlash_TGotoFrame 59
#define IShockwaveFlash_TGotoLabel 60
#define IShockwaveFlash_TCurrentFrame 61
#define IShockwaveFlash_TCurrentLabel 62
#define IShockwaveFlash_TPlay 63
#define IShockwaveFlash_TStopPlay 64
#define IShockwaveFlash_SetVariable 65
#define IShockwaveFlash_GetVariable 66
#define IShockwaveFlash_TSetProperty 67
#define IShockwaveFlash_TGetProperty 68
#define IShockwaveFlash_TCallFrame 69
#define IShockwaveFlash_TCallLabel 70
#define IShockwaveFlash_TSetPropertyNum 71
#define IShockwaveFlash_TGetPropertyNum 72
#define IShockwaveFlash_TGetPropertyAsNumber 73
#define IShockwaveFlash_get_SWRemote 74
#define IShockwaveFlash_put_SWRemote 75
#define IShockwaveFlash_get_FlashVars 76
#define IShockwaveFlash_put_FlashVars 77
#define IShockwaveFlash_get_AllowScriptAccess 78
#define IShockwaveFlash_put_AllowScriptAccess 79
#define IShockwaveFlash_get_MovieData 80
#define IShockwaveFlash_put_MovieData 81
#define IShockwaveFlash_get_InlineData 82
#define IShockwaveFlash_put_InlineData 83
#define IShockwaveFlash_get_SeamlessTabbing 84
#define IShockwaveFlash_put_SeamlessTabbing 85
#deffunc swfpreview str,int,int
mref fname,32
mref x,1
mref y,2
mref stt,64
if hwnd :stt=1 :return
axinit
if stat :stt=2 :return
exist fname
if strsize<16 :stt=3 :return
bload fname,swf,16
compressed=0
peek data,swf
if data='C' :compressed=1
peek data,swf,1
if data!'W'{
peek data,swf,2
if data!'S'{
stt=3
return
}
}
index=8
peek data,swf,index
bits=data&0xff>>3
bindex=5
data=data<<5
rindex=0 :tmp=0 :i=0
repeat
if rindex=bits{
rect.i=tmp
if i=3 :break
i+
rindex=0
tmp=0
}
if bindex=8{
bindex=0
index+
peek data,swf,index
}
tmp=data&0x80>>7|(tmp<<1)
data=data<<1&0xff
bindex+
rindex+
loop
swfx=rect.1-rect/20 :swfy=rect.3-rect.2/20
if compressed :swfx=winx-csrx :swfy=winy-csry
if x :swfx=x
if y :swfy=y
axcreate hwnd,"ShockwaveFlash.ShockwaveFlash.1",csrx,csry,swfx,swfy
pos csrx,csry+swfy
axgetcontrol pSWF,hwnd,IID_IShockwaveFlash
peek data,fname,1
if data!':' :fname=curdir+"\\"+fname
bstrset bstrvar,fname
param=0,bstrvar
icall pSWF,IShockwaveFlash_LoadMovie,param,2
bstrfree bstrvar
if compressed :stt=0 :else :stt=swfx|swfy<<16
return
#deffunc swf_totalframes val
mref retval,16
dispget retval,pSWF,"TotalFrames"
return
#deffunc swf_get_quality val
mref retval,16
dispget retval,pSWF,"Quality"
return
#deffunc swf_set_quality int
mref quality
dispput pSWF,"Quality",quality
return
#deffunc swf_get_loop val
mref isloop,16
dispget isloop,pSWF,"Loop"
return
#deffunc swf_set_loop int
mref isloop
dispput pSWF,"Loop",isloop
return
#deffunc swf_play
icall pSWF,IShockwaveFlash_Play
return
#deffunc swf_back
icall pSWF,IShockwaveFlash_Back
return
#deffunc swf_forword
icall pSWF,IShockwaveFlash_Forword
return
#deffunc swf_rewind
icall pSWF,IShockwaveFlash_Rewind
return
#deffunc swf_gotoframe int
mref frame
icall pSWF,IShockwaveFlash_GotoFrame,frame,1
return
#deffunc swf_stopplay
icall pSWF,IShockwaveFlash_StopPlay
return
#deffunc swf_currentframe val
mref retval,16
dispget retval,pSWF,"CurrentFrame"
return
#deffunc swf_isplaying
mref stt,64
str retstr
dispget retstr,pSWF,"IsPlaying"
if retstr="True" :stt=1 :else :stt=0
return
#deffunc swf_cleanup onexit
axdestroy hwnd
hwnd=0
if pSWF :release pSWF :pSWF=0
return
#global
#endif
#ifdef __hsp30__
;swfpreview3 (05/09/07)
#module swfpreview3
#ifndef __KERNEL32__
#uselib "kernel32.dll"
#define GetFullPathName GetFullPathNameA
#func GetFullPathNameA "GetFullPathNameA" sptr,sptr,sptr,sptr
#endif
*atlerror
if wparam=21 :stt=2 ;サポートされない機能を実行しました
return
#deffunc swfpreview str flash,int x,int y
if objid!-1 :stt=1 :return
mref stt,64
fname=flash
exist fname
if strsize<16 :stt=3 :return
sdim buf,16
bload fname,buf
compressed=0
if peek(buf, 0)='C' :compressed=1
if peek(buf, 1)!'W'|peek(buf, 2)!'S' :stt=3 :return
index=8
data=peek(buf, index)
bits=(data&0xff)>>3
bindex=5
data=data<<5
rindex=0 :tmp=0 :i=0
repeat
if rindex=bits{
rect.i=tmp
if i=3 :break
i+
rindex=0
tmp=0
}
if bindex=8{
bindex=0
index+
data=peek(buf,index)
}
tmp=(data&0x80)>>7|(tmp<<1)
data=data<<1&0xff
bindex+
rindex+
loop
swfx=(rect.1-rect)/20 :swfy=(rect.3-rect.2)/20
if compressed :swfx=ginfo(12)-ginfo(22) :swfy=ginfo(13)-ginfo(23)
if x :swfx=x
if y :swfy=y
onerror gosub *atlerror
axobj swf,"ShockwaveFlash.ShockwaveFlash.1",swfx,swfy
objid=stat
onerror 0
if stt=1 :return
if peek(fname, 1)!':' :GetFullPathName fname,1024,varptr(fname),0
swf->"LoadMovie" 0,fname
if compressed :stt=0 :else :stt=swfx|swfy<<16
return
#deffunc swf_totalframes var retval
retval=swf("TotalFrames")
return
#deffunc swf_get_quality var quality
quality=swf("Quality")
return
#deffunc swf_set_quality int quality
swf("Quality")=quality
return
#deffunc swf_get_loop var isloop
isloop=swf("Loop")
return
#deffunc swf_set_loop int isloop
swf("Loop")=isloop
return
#deffunc swf_play
swf->"Play"
return
#deffunc swf_back
swf->"Back"
return
#deffunc swf_forword
swf->"Forword"
return
#deffunc swf_rewind
swf->"Rewind"
return
#deffunc swf_gotoframe int frame
swf->"GotoFrame" frame
return
#deffunc swf_stopplay
swf->"StopPlay"
return
#deffunc swf_currentframe var retval
comres retval
swf->"CurrentFrame"
return
#deffunc swf_isplaying
mref stt,64
comres retval
swf->"IsPlaying"
if retval=0 :stt=0 :else :stt=1
return
#deffunc swf_cleanup onexit
if objid!-1{
delcom swf
clrobj objid,objid
objid=-1
}
else :return
return
#global
sdim fname@swfpreview3,1024
objid@swfpreview3=-1
#endif