-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathextract.cmd
100 lines (90 loc) · 3.69 KB
/
extract.cmd
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
@ECHO OFF
SETLOCAL
SET ME=%~n0
SET PARENT=%~dp0
ECHO Running %ME%
ECHO ---------------->CON
ECHO Extraction Start>CON
ECHO ---------------->CON
REM Export kanmusu sprites
CD "%PARENT%temp\kanmusu"
FOR %%f IN (*.swf) DO (
ECHO Extracting images in %%f>CON
ECHO Extracting images in %%f
java -jar "%PARENT%bin\ffdec\ffdec.jar" -format image:png -export image "%%f_images" "%%f"
)
REM Export abyssal sprites
CD "%PARENT%temp\abyssal"
FOR %%f IN (*.swf) DO (
ECHO Extracting images in %%f>CON
ECHO Extracting images in %%f
java -jar "%PARENT%bin\ffdec\ffdec.jar" -format image:png -export image "%%f_images" "%%f"
)
REM Export abyssal mod pack
CD "%PARENT%temp\abyssal_mod"
FOR %%f IN (*.swf) DO (
ECHO Extracting images in %%f>CON
ECHO Extracting images in %%f
java -jar "%PARENT%bin\ffdec\ffdec.jar" -format image:png -export image "%%f_images" "%%f"
)
REM Export kanmusu mod pack
CD "%PARENT%temp\kanmusu_mod"
FOR %%f IN (*.swf) DO (
ECHO Extracting images in %%f>CON
ECHO Extracting images in %%f
java -jar "%PARENT%bin\ffdec\ffdec.jar" -format image:png -export image "%%f_images" "%%f"
)
REM Export SHAPES from files
CD "%PARENT%temp\special"
FOR %%f IN (*.swf) DO (
ECHO Extracting images in %%f>CON
ECHO Extracting images in %%f
java -jar "%PARENT%bin\ffdec\ffdec.jar" -format shape:png -export shape "%%f_images" "%%f"
)
ENDLOCAL
:EXTRACT_SUCCESS
ENDLOCAL
ECHO --------------->CON
ECHO Extraction Done>CON
ECHO --------------->CON
EXIT /B 0
:FORCE_EXTRACT
REM If a regular file accidentally goes into this subroutine it will generate files that have .png suffix but are actually RGB JPEGs
MKDIR %FILENAME%_images
"%PARENT%bin\swfextract" "%FILENAME%" -j 1 -o "%FILENAME%_images\1.png"
"%PARENT%bin\swfextract" "%FILENAME%" -j 3 -o "%FILENAME%_images\3.png"
"%PARENT%bin\swfextract" "%FILENAME%" -j 5 -o "%FILENAME%_images\5.png"
"%PARENT%bin\swfextract" "%FILENAME%" -j 7 -o "%FILENAME%_images\7.png"
"%PARENT%bin\swfextract" "%FILENAME%" -j 9 -o "%FILENAME%_images\9.png"
"%PARENT%bin\swfextract" "%FILENAME%" -j 11 -o "%FILENAME%_images\11.png"
"%PARENT%bin\swfextract" "%FILENAME%" -j 13 -o "%FILENAME%_images\13.png"
"%PARENT%bin\swfextract" "%FILENAME%" -j 15 -o "%FILENAME%_images\15.png"
"%PARENT%bin\swfextract" "%FILENAME%" -j 17 -o "%FILENAME%_images\17.png"
"%PARENT%bin\swfextract" "%FILENAME%" -j 19 -o "%FILENAME%_images\19.png"
"%PARENT%bin\swfextract" "%FILENAME%" -j 21 -o "%FILENAME%_images\21.png"
"%PARENT%bin\swfextract" "%FILENAME%" -j 23 -o "%FILENAME%_images\23.png"
"%PARENT%bin\swfextract" "%FILENAME%" -j 25 -o "%FILENAME%_images\25.png"
"%PARENT%bin\swfextract" "%FILENAME%" -j 27 -o "%FILENAME%_images\27.png"
"%PARENT%bin\swfextract" "%FILENAME%" -j 29 -o "%FILENAME%_images\29.png"
REM Copy test set that should have transparency (Assuming extraction went okay)
REM Detect if the test image has transparency by asking convert.exe to print the colour value of the pixel [0,0]
REM Files with transparency should have no colour (in which corner?)
REM 2>nul needed to skip an irrelevant error message
IF EXIST "%FILENAME%_images\17.png" (
COPY "%FILENAME%_images\17.png" "%%f_images\alpha_test.png"
) ELSE IF EXIST "%FILENAME%_images\3.png"(
COPY "%FILENAME%_images\3.png" "%FILENAME%_images\alpha_test.png"
) ELSE (
ECHO Alternative Extraction failed for %FILENAME%
DEL "%FILENAME%_images\*.png"
GOTO:EOF
)
%PARENT%bin\convert "%FILENAME%_images\alpha_test.png" -format '%[pixel:s]' info:- 1>"%FILENAME%_images\alpha.txt" 2>nul
SET /p alpha=<"%FILENAME%_images\alpha.txt"
if %alpha% neq "none" (
ECHO Extraction failed for %FILENAME%: Alpha channels could not be extracted, removing the extracted images...
DEL "%FILENAME%_images\*.png"
) ELSE (
ECHO Alternative extraction succeeded for %FILENAME%
)
GOTO:EOF