psu_parser: Make it work on all zone files, even lobbies. Many unknowns.
This commit is contained in:
parent
799583f4eb
commit
3e97dd50a3
@ -24,7 +24,7 @@
|
|||||||
-define(NBL, "./nbl").
|
-define(NBL, "./nbl").
|
||||||
|
|
||||||
run() ->
|
run() ->
|
||||||
List = [{QuestID, parse_quest(QuestID)} || {QuestID, _} <- ?QUESTS, QuestID < 1100000],
|
List = [{QuestID, parse_quest(QuestID)} || {QuestID, _} <- ?QUESTS],
|
||||||
Begin = "%% This file is automatically generated by EGS.
|
Begin = "%% This file is automatically generated by EGS.
|
||||||
%% Please do not edit it manually, as you would risk losing your changes.
|
%% Please do not edit it manually, as you would risk losing your changes.
|
||||||
|
|
||||||
@ -43,14 +43,22 @@ parse_zone(NblFilename) ->
|
|||||||
log("~p", [Files]),
|
log("~p", [Files]),
|
||||||
nbl_extract_files(NblFilename),
|
nbl_extract_files(NblFilename),
|
||||||
Filename = "set_r0.rel",
|
Filename = "set_r0.rel",
|
||||||
BasePtr = calc_base_ptr(Filename, Files, 0),
|
case filelib:is_file(io_lib:format("tmp/~s", [Filename])) of
|
||||||
{ok, << $N, $X, $R, 0, EndRelPtr:32/little-unsigned-integer, AreaIDListRelPtr:32/little-unsigned-integer, 0:32, Data/bits >>} = file:read_file(io_lib:format("tmp/~s", [Filename])),
|
false ->
|
||||||
log("header: end ptr(~b) areaid list ptr(~b)", [EndRelPtr, AreaIDListRelPtr]),
|
io:format("ignoring ~s (no set file)~n", [NblFilename]),
|
||||||
{ok, _AreaCode, NbMaps, MapsListPtr} = parse_areaid_list(Data, AreaIDListRelPtr - 16),
|
nbl_cleanup(),
|
||||||
MapList = parse_mapnumbers_list(Data, NbMaps, MapsListPtr - BasePtr - 16),
|
[];
|
||||||
ObjList = [{MapID, parse_object_list_headers(BasePtr, Data, NbHeaders, ObjListHeadersPtr - BasePtr - 16)} || {MapID, NbHeaders, ObjListHeadersPtr} <- MapList],
|
true ->
|
||||||
nbl_cleanup(),
|
io:format("parsing ~s~n", [NblFilename]),
|
||||||
ObjList.
|
BasePtr = calc_base_ptr(Filename, Files, 0),
|
||||||
|
{ok, << $N, $X, $R, 0, EndRelPtr:32/little-unsigned-integer, AreaIDListRelPtr:32/little-unsigned-integer, 0:32, Data/bits >>} = file:read_file(io_lib:format("tmp/~s", [Filename])),
|
||||||
|
log("header: end ptr(~b) areaid list ptr(~b)", [EndRelPtr, AreaIDListRelPtr]),
|
||||||
|
{ok, _AreaCode, NbMaps, MapsListPtr} = parse_areaid_list(Data, AreaIDListRelPtr - 16),
|
||||||
|
MapList = parse_mapnumbers_list(Data, NbMaps, MapsListPtr - BasePtr - 16),
|
||||||
|
ObjList = [{MapID, parse_object_list_headers(BasePtr, Data, NbHeaders, ObjListHeadersPtr - BasePtr - 16)} || {MapID, NbHeaders, ObjListHeadersPtr} <- MapList],
|
||||||
|
nbl_cleanup(),
|
||||||
|
ObjList
|
||||||
|
end.
|
||||||
|
|
||||||
nbl_list_files(NblFilename) ->
|
nbl_list_files(NblFilename) ->
|
||||||
StdOut = os:cmd(io_lib:format("~s -t ~s", [?NBL, NblFilename])),
|
StdOut = os:cmd(io_lib:format("~s -t ~s", [?NBL, NblFilename])),
|
||||||
@ -103,9 +111,11 @@ parse_object_list_headers(BasePtr, Data, NbHeaders, Ptr) ->
|
|||||||
parse_object_list_headers_rec(_Data, 0, Acc) ->
|
parse_object_list_headers_rec(_Data, 0, Acc) ->
|
||||||
lists:reverse(Acc);
|
lists:reverse(Acc);
|
||||||
parse_object_list_headers_rec(Data, NbHeaders, Acc) ->
|
parse_object_list_headers_rec(Data, NbHeaders, Acc) ->
|
||||||
<< 16#ffffffff:32, UnknownBinary:144/bits, 16#ffff:16, 0:32,
|
%~ << Log:320/bits, _/bits >> = Data,
|
||||||
|
%~ io:format("~p~n", [Log]),
|
||||||
|
<< 16#ffffffff:32, UnknownA:144/bits, UnknownB:16/little-unsigned-integer, UnknownC:32/little-unsigned-integer,
|
||||||
ObjListNumber:16/little-unsigned-integer, 0:32, NbObjects:16/little-unsigned-integer, ObjListPtr:32/little-unsigned-integer, Rest/bits >> = Data,
|
ObjListNumber:16/little-unsigned-integer, 0:32, NbObjects:16/little-unsigned-integer, ObjListPtr:32/little-unsigned-integer, Rest/bits >> = Data,
|
||||||
log("object list headers: bin(~p) list nb(~b) nb obj(~b) obj list ptr(~b)", [UnknownBinary, ObjListNumber, NbObjects, ObjListPtr]),
|
log("object list headers: a(~p) b(~p) c(~p) list nb(~b) nb obj(~b) obj list ptr(~b)", [UnknownA, UnknownB, UnknownC, ObjListNumber, NbObjects, ObjListPtr]),
|
||||||
parse_object_list_headers_rec(Rest, NbHeaders - 1, [{ObjListNumber, NbObjects, ObjListPtr}|Acc]).
|
parse_object_list_headers_rec(Rest, NbHeaders - 1, [{ObjListNumber, NbObjects, ObjListPtr}|Acc]).
|
||||||
|
|
||||||
parse_object_list(BasePtr, Data, NbObjects, Ptr) ->
|
parse_object_list(BasePtr, Data, NbObjects, Ptr) ->
|
||||||
@ -231,6 +241,13 @@ parse_object_args(33, _Params, _Data) ->
|
|||||||
parse_object_args(35, _Params, _Data) ->
|
parse_object_args(35, _Params, _Data) ->
|
||||||
boss;
|
boss;
|
||||||
|
|
||||||
|
%% @todo Really save sphere? Colony zone 0. Uni cube maybe?
|
||||||
|
parse_object_args(40, _Params, _Data) ->
|
||||||
|
unknown_object_40;
|
||||||
|
|
||||||
|
parse_object_args(42, _Params, _Data) ->
|
||||||
|
unknown_object_42;
|
||||||
|
|
||||||
parse_object_args(43, _Params, _Data) ->
|
parse_object_args(43, _Params, _Data) ->
|
||||||
shoot_button;
|
shoot_button;
|
||||||
|
|
||||||
@ -242,6 +259,10 @@ parse_object_args(44, _Params, _Data) ->
|
|||||||
parse_object_args(45, _Params, _Data) ->
|
parse_object_args(45, _Params, _Data) ->
|
||||||
npc_talk;
|
npc_talk;
|
||||||
|
|
||||||
|
%% @todo Might be more than just this counter.
|
||||||
|
parse_object_args(47, _Params, _Data) ->
|
||||||
|
type_counter_npc_talk;
|
||||||
|
|
||||||
parse_object_args(48, _Params, _Data) ->
|
parse_object_args(48, _Params, _Data) ->
|
||||||
boss_gate;
|
boss_gate;
|
||||||
|
|
||||||
@ -257,16 +278,44 @@ parse_object_args(51, _Params, _Data) ->
|
|||||||
parse_object_args(53, _Params, _Data) ->
|
parse_object_args(53, _Params, _Data) ->
|
||||||
label;
|
label;
|
||||||
|
|
||||||
|
parse_object_args(56, _Params, _Data) ->
|
||||||
|
chair;
|
||||||
|
|
||||||
%% @todo Find out! Only used in the cake sisters shop so far.
|
%% @todo Find out! Only used in the cake sisters shop so far.
|
||||||
parse_object_args(59, _Params, _Data) ->
|
parse_object_args(59, _Params, _Data) ->
|
||||||
unknown_object_59;
|
unknown_object_59;
|
||||||
|
|
||||||
|
%% @todo Find out! Only used in colony zone 0 so far.
|
||||||
|
parse_object_args(60, _Params, _Data) ->
|
||||||
|
unknown_object_60;
|
||||||
|
|
||||||
|
parse_object_args(61, _Params, _Data) ->
|
||||||
|
ghosts_generator;
|
||||||
|
|
||||||
parse_object_args(62, _Params, _Data) ->
|
parse_object_args(62, _Params, _Data) ->
|
||||||
pp_cube;
|
pp_cube;
|
||||||
|
|
||||||
|
parse_object_args(63, _Params, _Data) ->
|
||||||
|
unknown_object_63;
|
||||||
|
|
||||||
parse_object_args(64, _Params, _Data) ->
|
parse_object_args(64, _Params, _Data) ->
|
||||||
hidden_minimap_section;
|
hidden_minimap_section;
|
||||||
|
|
||||||
|
parse_object_args(65, _Params, _Data) ->
|
||||||
|
unknown_object_65;
|
||||||
|
|
||||||
|
parse_object_args(66, _Params, _Data) ->
|
||||||
|
unknown_object_66;
|
||||||
|
|
||||||
|
parse_object_args(67, _Params, _Data) ->
|
||||||
|
unknown_object_67;
|
||||||
|
|
||||||
|
parse_object_args(68, _Params, _Data) ->
|
||||||
|
unknown_object_68;
|
||||||
|
|
||||||
|
parse_object_args(69, _Params, _Data) ->
|
||||||
|
unknown_object_69;
|
||||||
|
|
||||||
%% @todo Seems to be a megid turret "trap".
|
%% @todo Seems to be a megid turret "trap".
|
||||||
|
|
||||||
parse_object_args(70, _Params, _Data) ->
|
parse_object_args(70, _Params, _Data) ->
|
||||||
|
Loading…
Reference in New Issue
Block a user