@Znote may be happy to see someone taking an interest in POTCP, try pinging him.
POTCP has only been tested on the 10.97 and 7.6 protocols,
AFAIK nobody has ever tested it against the 8.0 protocol,
and given your experience, the login protocol probably changed between 8.0 and 10.96 (not surprising, they're years apart)
I know the login protocol changed significantly between the 7.6 protocol and 7.7 protocol, so
the 7.6 version probably won't help you.
Seems someone with the appropriate skills needs to adapt the 10.97 version to 8.0.. It's not easy to study, it's a custom binary protocol,
To get started, go to your
protocollogin.cpp and prop `ProtocolLogin::OnRecvFirstMessage full of debugging prints:
in
Code:
uint16_t version = msg.get<uint16_t>();
what version is POTCP sending?
Code:
uint16_t version = msg.get<uint16_t>();
std::cout << "version: " << version << std::endl;
check if RSA decryption is failing? add a debug print in
Code:
if (!Protocol::RSA_decrypt(msg)) {
disconnect();
return;
}
is the keys being read correctly? add debug prints in
Code:
uint32_t key[4];
key[0] = msg.get<uint32_t>();
key[1] = msg.get<uint32_t>();
key[2] = msg.get<uint32_t>();
key[3] = msg.get<uint32_t>();
and go in POTCP class Tibia_client_internal replace
PHP:
//<xtea_initialization>
if ($this->debugging) {
// nice keys for debugging (but insecure)
$this->xtea_key_binary = (new Tibia_binary_serializer())->add_string("xtea_key_12345")->str();
$this->xtea_key_binary = str_repeat((new Tibia_binary_serializer())->addU32(1337)->str(), 4);
$this->xtea_key_binary = str_repeat("\x00", 4 * 4);
} else {
// secure key, not good for debugging.
$this->xtea_key_binary = random_bytes(4 * 4);
}
with just
Code:
$this->xtea_key_binary = str_repeat("\x00", 4 * 4);
if tfs reads the key correctly, key[0]-key[3] should all be 0, is it?
and add a debug print in
Code:
if (version < CLIENT_VERSION_MIN || version > CLIENT_VERSION_MAX) {
std::ostringstream ss;
ss << "Only clients with protocol " << CLIENT_VERSION_STR << " allowed!";
is this being hit? add a debugging print basically everywhere it can possibly fail in
ProtocolLogin::OnRecvFirstMessage and find the failure, it's probably in onRecvFirstMessage somewhere