mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-12-22 19:30:05 +00:00
Report unhandled packets in string form.
This commit is contained in:
parent
0ac600e223
commit
43f2def80b
1
Makefile
1
Makefile
@ -23,6 +23,7 @@ SRC=\
|
||||
src/CNShardServer.cpp\
|
||||
src/CNShared.cpp\
|
||||
src/CNStructs.cpp\
|
||||
src/Defines.cpp\
|
||||
src/main.cpp\
|
||||
src/NanoManager.cpp\
|
||||
src/ItemManager.cpp\
|
||||
|
@ -278,11 +278,11 @@ void CNLoginServer::handlePacket(CNSocket* sock, CNPacketData* data) {
|
||||
break;
|
||||
}
|
||||
default:
|
||||
std::cerr << "OpenFusion: LOGIN UNIMPLM ERR. PacketType: " << data->type << std::endl;
|
||||
std::cerr << "OpenFusion: LOGIN UNIMPLM ERR. PacketType: " << Defines::p2str(CL2LS, data->type) << " (" << data->type << ")" << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CNLoginServer::killConnection(CNSocket* cns) {
|
||||
loginSessions.erase(cns);
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ void CNShardServer::handlePacket(CNSocket* sock, CNPacketData* data) {
|
||||
if (ShardPackets.find(data->type) != ShardPackets.end())
|
||||
ShardPackets[data->type](sock, data);
|
||||
else
|
||||
std::cerr << "OpenFusion: SHARD UNIMPLM ERR. PacketType: " << data->type << std::endl;
|
||||
std::cerr << "OpenFusion: SHARD UNIMPLM ERR. PacketType: " << Defines::p2str(CL2FE, data->type) << " (" << data->type << ")" << std::endl;
|
||||
}
|
||||
|
||||
void CNShardServer::killConnection(CNSocket* cns) {
|
||||
@ -46,4 +46,4 @@ void CNShardServer::onTimer() {
|
||||
sP_FE2CL_REQ_LIVE_CHECK* data = (sP_FE2CL_REQ_LIVE_CHECK*)xmalloc(sizeof(sP_FE2CL_REQ_LIVE_CHECK));
|
||||
pair.first->sendPacket(new CNPacketData((void*)data, P_FE2CL_REQ_LIVE_CHECK, sizeof(sP_FE2CL_REQ_LIVE_CHECK), pair.first->getFEKey()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
220
src/Defines.cpp
Normal file
220
src/Defines.cpp
Normal file
@ -0,0 +1,220 @@
|
||||
#include <string>
|
||||
|
||||
#include "Defines.hpp"
|
||||
|
||||
#define STRINGIFY(x) PacketMap(x, #x)
|
||||
|
||||
/*
|
||||
* Turns out there's not better way to do this...
|
||||
* We'll only support CL2* packets for now, since we only
|
||||
* need to print those.
|
||||
*/
|
||||
struct PacketMap {
|
||||
int val;
|
||||
std::string name;
|
||||
|
||||
PacketMap(int v, std::string n) : val(v), name(n) {};
|
||||
};
|
||||
|
||||
PacketMap cl2ls_map[] = {
|
||||
STRINGIFY(P_CL2LS_REQ_LOGIN),
|
||||
STRINGIFY(P_CL2LS_REQ_CHECK_CHAR_NAME),
|
||||
STRINGIFY(P_CL2LS_REQ_SAVE_CHAR_NAME),
|
||||
STRINGIFY(P_CL2LS_REQ_CHAR_CREATE),
|
||||
STRINGIFY(P_CL2LS_REQ_CHAR_SELECT),
|
||||
STRINGIFY(P_CL2LS_REQ_CHAR_DELETE),
|
||||
STRINGIFY(P_CL2LS_REQ_SHARD_SELECT),
|
||||
STRINGIFY(P_CL2LS_REQ_SHARD_LIST_INFO),
|
||||
STRINGIFY(P_CL2LS_CHECK_NAME_LIST),
|
||||
STRINGIFY(P_CL2LS_REQ_SAVE_CHAR_TUTOR),
|
||||
STRINGIFY(P_CL2LS_REQ_PC_EXIT_DUPLICATE),
|
||||
STRINGIFY(P_CL2LS_REP_LIVE_CHECK),
|
||||
STRINGIFY(P_CL2LS_REQ_CHANGE_CHAR_NAME),
|
||||
STRINGIFY(P_CL2LS_REQ_SERVER_SELECT),
|
||||
};
|
||||
|
||||
PacketMap cl2fe_map[] = {
|
||||
STRINGIFY(P_CL2FE_REQ_PC_ENTER),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_EXIT),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_MOVE),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_STOP),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_JUMP),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_ATTACK_NPCs),
|
||||
STRINGIFY(P_CL2FE_REQ_SEND_FREECHAT_MESSAGE),
|
||||
STRINGIFY(P_CL2FE_REQ_SEND_MENUCHAT_MESSAGE),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_REGEN),
|
||||
STRINGIFY(P_CL2FE_REQ_ITEM_MOVE),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_TASK_START),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_TASK_END),
|
||||
STRINGIFY(P_CL2FE_REQ_NANO_EQUIP),
|
||||
STRINGIFY(P_CL2FE_REQ_NANO_UNEQUIP),
|
||||
STRINGIFY(P_CL2FE_REQ_NANO_ACTIVE),
|
||||
STRINGIFY(P_CL2FE_REQ_NANO_TUNE),
|
||||
STRINGIFY(P_CL2FE_REQ_NANO_SKILL_USE),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_TASK_STOP),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_TASK_CONTINUE),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_GOTO),
|
||||
STRINGIFY(P_CL2FE_REQ_CHARGE_NANO_STAMINA),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_KILL_QUEST_NPCs),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_VENDOR_ITEM_BUY),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_VENDOR_ITEM_SELL),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_ITEM_DELETE),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_GIVE_ITEM),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_ROCKET_STYLE_READY),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_ROCKET_STYLE_FIRE),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_ROCKET_STYLE_HIT),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_GRENADE_STYLE_READY),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_GRENADE_STYLE_FIRE),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_GRENADE_STYLE_HIT),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_NANO_CREATE),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_TRADE_OFFER),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_TRADE_OFFER_CANCEL),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_TRADE_OFFER_ACCEPT),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_TRADE_OFFER_REFUSAL),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_TRADE_OFFER_ABORT),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_TRADE_CONFIRM),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_TRADE_CONFIRM_CANCEL),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_TRADE_CONFIRM_ABORT),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_TRADE_ITEM_REGISTER),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_TRADE_ITEM_UNREGISTER),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_TRADE_CASH_REGISTER),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_TRADE_EMOTES_CHAT),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_BANK_OPEN),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_BANK_CLOSE),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_VENDOR_START),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_VENDOR_TABLE_UPDATE),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_VENDOR_ITEM_RESTORE_BUY),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_COMBAT_BEGIN),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_COMBAT_END),
|
||||
STRINGIFY(P_CL2FE_REQ_REQUEST_MAKE_BUDDY),
|
||||
STRINGIFY(P_CL2FE_REQ_ACCEPT_MAKE_BUDDY),
|
||||
STRINGIFY(P_CL2FE_REQ_SEND_BUDDY_FREECHAT_MESSAGE),
|
||||
STRINGIFY(P_CL2FE_REQ_SEND_BUDDY_MENUCHAT_MESSAGE),
|
||||
STRINGIFY(P_CL2FE_REQ_GET_BUDDY_STYLE),
|
||||
STRINGIFY(P_CL2FE_REQ_SET_BUDDY_BLOCK),
|
||||
STRINGIFY(P_CL2FE_REQ_REMOVE_BUDDY),
|
||||
STRINGIFY(P_CL2FE_REQ_GET_BUDDY_STATE),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_JUMPPAD),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_LAUNCHER),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_ZIPLINE),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_MOVEPLATFORM),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_SLOPE),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_STATE_CHANGE),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_MAP_WARP),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_GIVE_NANO),
|
||||
STRINGIFY(P_CL2FE_REQ_NPC_SUMMON),
|
||||
STRINGIFY(P_CL2FE_REQ_NPC_UNSUMMON),
|
||||
STRINGIFY(P_CL2FE_REQ_ITEM_CHEST_OPEN),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_GIVE_NANO_SKILL),
|
||||
STRINGIFY(P_CL2FE_DOT_DAMAGE_ONOFF),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_VENDOR_BATTERY_BUY),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_WARP_USE_NPC),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_GROUP_INVITE),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_GROUP_INVITE_REFUSE),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_GROUP_JOIN),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_GROUP_LEAVE),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_AVATAR_EMOTES_CHAT),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_BUDDY_WARP),
|
||||
STRINGIFY(P_CL2FE_REQ_GET_MEMBER_STYLE),
|
||||
STRINGIFY(P_CL2FE_REQ_GET_GROUP_STYLE),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_CHANGE_MENTOR),
|
||||
STRINGIFY(P_CL2FE_REQ_GET_BUDDY_LOCATION),
|
||||
STRINGIFY(P_CL2FE_REQ_NPC_GROUP_SUMMON),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_WARP_TO_PC),
|
||||
STRINGIFY(P_CL2FE_REQ_EP_RANK_GET_LIST),
|
||||
STRINGIFY(P_CL2FE_REQ_EP_RANK_GET_DETAIL),
|
||||
STRINGIFY(P_CL2FE_REQ_EP_RANK_GET_PC_INFO),
|
||||
STRINGIFY(P_CL2FE_REQ_EP_RACE_START),
|
||||
STRINGIFY(P_CL2FE_REQ_EP_RACE_END),
|
||||
STRINGIFY(P_CL2FE_REQ_EP_RACE_CANCEL),
|
||||
STRINGIFY(P_CL2FE_REQ_EP_GET_RING),
|
||||
STRINGIFY(P_CL2FE_REQ_IM_CHANGE_SWITCH_STATUS),
|
||||
STRINGIFY(P_CL2FE_REQ_SHINY_PICKUP),
|
||||
STRINGIFY(P_CL2FE_REQ_SHINY_SUMMON),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_MOVETRANSPORTATION),
|
||||
STRINGIFY(P_CL2FE_REQ_SEND_ALL_GROUP_FREECHAT_MESSAGE),
|
||||
STRINGIFY(P_CL2FE_REQ_SEND_ANY_GROUP_FREECHAT_MESSAGE),
|
||||
STRINGIFY(P_CL2FE_REQ_BARKER),
|
||||
STRINGIFY(P_CL2FE_REQ_SEND_ALL_GROUP_MENUCHAT_MESSAGE),
|
||||
STRINGIFY(P_CL2FE_REQ_SEND_ANY_GROUP_MENUCHAT_MESSAGE),
|
||||
STRINGIFY(P_CL2FE_REQ_REGIST_TRANSPORTATION_LOCATION),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_WARP_USE_TRANSPORTATION),
|
||||
STRINGIFY(P_CL2FE_GM_REQ_PC_SPECIAL_STATE_SWITCH),
|
||||
STRINGIFY(P_CL2FE_GM_REQ_PC_SET_VALUE),
|
||||
STRINGIFY(P_CL2FE_GM_REQ_KICK_PLAYER),
|
||||
STRINGIFY(P_CL2FE_GM_REQ_TARGET_PC_TELEPORT),
|
||||
STRINGIFY(P_CL2FE_GM_REQ_PC_LOCATION),
|
||||
STRINGIFY(P_CL2FE_GM_REQ_PC_ANNOUNCE),
|
||||
STRINGIFY(P_CL2FE_REQ_SET_PC_BLOCK),
|
||||
STRINGIFY(P_CL2FE_REQ_REGIST_RXCOM),
|
||||
STRINGIFY(P_CL2FE_GM_REQ_PC_MOTD_REGISTER),
|
||||
STRINGIFY(P_CL2FE_REQ_ITEM_USE),
|
||||
STRINGIFY(P_CL2FE_REQ_WARP_USE_RECALL),
|
||||
STRINGIFY(P_CL2FE_REP_LIVE_CHECK),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_MISSION_COMPLETE),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_TASK_COMPLETE),
|
||||
STRINGIFY(P_CL2FE_REQ_NPC_INTERACTION),
|
||||
STRINGIFY(P_CL2FE_DOT_HEAL_ONOFF),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_SPECIAL_STATE_SWITCH),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_EMAIL_UPDATE_CHECK),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_READ_EMAIL),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_RECV_EMAIL_PAGE_LIST),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_DELETE_EMAIL),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_SEND_EMAIL),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_RECV_EMAIL_ITEM),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_RECV_EMAIL_CANDY),
|
||||
STRINGIFY(P_CL2FE_GM_REQ_TARGET_PC_SPECIAL_STATE_ONOFF),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_SET_CURRENT_MISSION_ID),
|
||||
STRINGIFY(P_CL2FE_REQ_NPC_GROUP_INVITE),
|
||||
STRINGIFY(P_CL2FE_REQ_NPC_GROUP_KICK),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_FIRST_USE_FLAG_SET),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_TRANSPORT_WARP),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_TIME_TO_GO_WARP),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_RECV_EMAIL_ITEM_ALL),
|
||||
STRINGIFY(P_CL2FE_REQ_CHANNEL_INFO),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_CHANNEL_NUM),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_WARP_CHANNEL),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_LOADING_COMPLETE),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_FIND_NAME_MAKE_BUDDY),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_FIND_NAME_ACCEPT_BUDDY),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_ATTACK_CHARs),
|
||||
STRINGIFY(P_CL2FE_PC_STREETSTALL_REQ_READY),
|
||||
STRINGIFY(P_CL2FE_PC_STREETSTALL_REQ_CANCEL),
|
||||
STRINGIFY(P_CL2FE_PC_STREETSTALL_REQ_REGIST_ITEM),
|
||||
STRINGIFY(P_CL2FE_PC_STREETSTALL_REQ_UNREGIST_ITEM),
|
||||
STRINGIFY(P_CL2FE_PC_STREETSTALL_REQ_SALE_START),
|
||||
STRINGIFY(P_CL2FE_PC_STREETSTALL_REQ_ITEM_LIST),
|
||||
STRINGIFY(P_CL2FE_PC_STREETSTALL_REQ_ITEM_BUY),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_ITEM_COMBINATION),
|
||||
STRINGIFY(P_CL2FE_GM_REQ_SET_PC_SKILL),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_SKILL_ADD),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_SKILL_DEL),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_SKILL_USE),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_ROPE),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_BELT),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_VEHICLE_ON),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_VEHICLE_OFF),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_REGIST_QUICK_SLOT),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_DISASSEMBLE_ITEM),
|
||||
STRINGIFY(P_CL2FE_GM_REQ_REWARD_RATE),
|
||||
STRINGIFY(P_CL2FE_REQ_PC_ITEM_ENCHANT),
|
||||
};
|
||||
|
||||
std::string Defines::p2str(int type, int val) {
|
||||
switch (type) {
|
||||
case CL2LS:
|
||||
val = val - CL2LS - 1;
|
||||
if (val > N_CL2LS)
|
||||
break;
|
||||
|
||||
return cl2ls_map[val].name;
|
||||
case CL2FE:
|
||||
val = val - CL2FE - 1;
|
||||
if (val > N_CL2FE)
|
||||
break;
|
||||
|
||||
return cl2fe_map[val].name;
|
||||
}
|
||||
|
||||
return "UNKNOWN";
|
||||
}
|
@ -838,3 +838,20 @@ enum {
|
||||
P_LS2CL_REP_CHANGE_CHAR_NAME_FAIL = 0x21000018, // 553648152
|
||||
P_LS2CL_REP_SHARD_LIST_INFO_SUCC = 0x21000019, // 553648153
|
||||
};
|
||||
|
||||
/*
|
||||
* Numbers of packets by type.
|
||||
* Each is the last packet - the upper bits + 1
|
||||
*/
|
||||
enum {
|
||||
N_CL2LS = 0xf,
|
||||
N_CL2FE = 0xa5,
|
||||
N_FE2CL = 0x12f,
|
||||
N_LS2CL = 0x1a,
|
||||
|
||||
N_PACKETS = N_CL2LS + N_CL2FE + N_FE2CL + N_LS2CL
|
||||
};
|
||||
|
||||
namespace Defines {
|
||||
std::string p2str(int type, int val);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user