diff --git a/src/psu/psu_game.erl b/src/psu/psu_game.erl index 4e5add2..0f94121 100644 --- a/src/psu/psu_game.erl +++ b/src/psu/psu_game.erl @@ -94,14 +94,8 @@ process() -> case psu_proto:packet_recv(get(socket), 5000) of {ok, Orig} -> case psu_proto:parse(Orig) of - {command, Command, Channel, _Data} -> - log("(process) dismissed command ~4.16.0b channel ~b", [Command, Channel]), - ?MODULE:process(); - ignore -> - ignore, - ?MODULE:process(); - Event -> - process_event(Event) + ignore -> ?MODULE:process(); + Event -> process_event(Event) end; {error, timeout} -> reload, @@ -110,6 +104,10 @@ process() -> closed end. +%% @todo Check the client version info here too. Not just in psu_login. +process_event({system_client_version_info, _Language, _Platform, _Version}) -> + ?MODULE:process(); + process_event({system_key_auth_request, AuthGID, AuthKey}) -> CSocket = get(socket), case egs_user_model:read(AuthGID) of @@ -131,7 +129,11 @@ process_event({system_key_auth_request, AuthGID, AuthKey}) -> log("quit, auth failed"), ssl:close(CSocket) end - end. + end; + +process_event({command, Command, Channel, _Data}) -> + log("process_event: dismissed command ~4.16.0b channel ~b", [Command, Channel]), + ?MODULE:process(). %% @doc Character selection screen loop. char_select() -> diff --git a/src/psu/psu_proto.erl b/src/psu/psu_proto.erl index 1503c5f..1f6b52c 100644 --- a/src/psu/psu_proto.erl +++ b/src/psu/psu_proto.erl @@ -385,6 +385,44 @@ parse(Size, 16#080d, Channel, Data) -> ?ASSERT_EQ(VarI, 0), ignore; +%% @todo Make sure the Language field is the right one. +parse(Size, 16#080e, Channel, Data) -> + << LID:16/little, VarA:16/little, VarB:32/little, VarC:32/little, VarD:32/little, VarE:32/little, VarF:32/little, VarG:32/little, VarH:32/little, VarI:32/little, + VarJ:8, Language:8, VarK:8, VarL:8, Platform:8, VarM:24/little, Revision:8, Minor:4, _VarN:12, Major:4, _VarO:4, VarP:32/little, VarQ:32/little, VarR:32/little >> = Data, + ?ASSERT_EQ(Size, 68), + ?ASSERT_EQ(Channel, 2), + ?ASSERT_EQ(LID, 16#ffff), + ?ASSERT_EQ(VarA, 0), + ?ASSERT_EQ(VarB, 0), + ?ASSERT_EQ(VarC, 0), + ?ASSERT_EQ(VarD, 0), + ?ASSERT_EQ(VarE, 0), + ?ASSERT_EQ(VarF, 0), + ?ASSERT_EQ(VarG, 0), + ?ASSERT_EQ(VarH, 0), + ?ASSERT_EQ(VarI, 0), + ?ASSERT_EQ(VarJ, 0), + ?ASSERT_EQ(VarK, 1), + ?ASSERT_EQ(VarL, 1), + ?ASSERT_EQ(VarM, 0), + ?ASSERT_EQ(VarP, 0), + ?ASSERT_EQ(VarQ, 0), + ?ASSERT_EQ(VarR, 0), + AtomLanguage = case Language of + 0 -> japanese; + 1 -> english; + 3 -> french; + 4 -> german; + _ -> log("unknown 080e Language ~p", [Language]), unknown + end, + AtomPlatform = case Platform of + 0 -> ps2; + 1 -> pc; + _ -> log("unknown 080e Platform ~p", [Platform]), unknown + end, + Version = Major * 1000000 + Minor * 1000 + Revision, + {system_client_version_info, AtomLanguage, AtomPlatform, Version}; + %% @todo Find out what it's really doing! parse(Size, 16#080f, Channel, Data) -> << _LID:16/little, VarA:16/little, VarB:32/little, VarC:32/little, VarD:32/little, VarE:32/little,