Created
February 2, 2013 20:10
-
-
Save Vesnica/4699054 to your computer and use it in GitHub Desktop.
.xfl extractor (Liar Soft)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(xfl). | |
-author("Wisher"). | |
-email("[email protected]"). | |
-export([extract/1]). | |
% All bgm is ogg format, but have a 66 bytes fake wave header.(Liar...) | |
extract(File) -> | |
{ok, Bin} = file:read_file(File), | |
<<_:32, Size:32/little, Items:32/little, Rest/binary>> = Bin, | |
lists:foldl(fun(_, B) -> | |
<<N:32/binary, S:32/little, Len:32/little, B1/binary>> = B, | |
Fake = lists:takewhile(fun(A) -> A =/= 0 end, binary_to_list(N)), | |
Name = re:replace(Fake, ".wav", ".ogg", [{return, list}]), | |
io:format("Name:~p~n", [Name]), | |
file:write_file(Name, binary_part(Rest, S + Size + 66, Len - 66)), | |
B1 | |
end, Rest, lists:duplicate(Items, 0)). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment