[raknet] Refactor

This commit is contained in:
RD42
2025-04-26 12:29:16 -07:00
parent 5e4c220377
commit a94c99af0f
3 changed files with 13 additions and 28 deletions

View File

@ -39,7 +39,7 @@ void RPCMap::Clear(void)
}
RPCNode *RPCMap::GetNodeFromIndex(RPCIndex index)
{
return rpcSet[(unsigned)index];;
return rpcSet[(unsigned)index];
}
RPCNode *RPCMap::GetNodeFromFunctionName(unsigned char uniqueIdentifier)
{
@ -62,4 +62,3 @@ void RPCMap::AddIdentifierWithFunction(unsigned char uniqueIdentifier, void *fun
rpcSet[uniqueIdentifier] = node;
}

View File

@ -1,3 +1,4 @@
#include "TEABlockEncryptor.h"
#include "CheckSum.h"
#include "Rand.h"
@ -90,12 +91,6 @@ void TEABlockEncryptor::Encrypt( unsigned char *input, int inputLength, unsigned
totalLength = inputLength + sizeof( checkSum ) + sizeof( encodedPad );
paddingBytes = 0;
/*if (totalLength < 16)
{
paddingBytes = 16 - totalLength;
}
else
*/
if ((totalLength % 8) != 0)
{
paddingBytes = 8 - (totalLength % 8);
@ -139,14 +134,11 @@ void TEABlockEncryptor::Encrypt( unsigned char *input, int inputLength, unsigned
unsigned int &V0 = *(reinterpret_cast<unsigned int*>(output+i));
unsigned int &V1 = *(reinterpret_cast<unsigned int*>(output+i+sizeof(unsigned int)));
EncryptBlock(V0, V1);
//*(reinterpret_cast<unsigned int*>(output+i)+0) = V0;
//*(reinterpret_cast<unsigned int*>(output+i)+1) = V1;
}
#ifdef _DEBUG
DumpMemory("PostEncrypt", output, *outputLength);
#endif
}
bool TEABlockEncryptor::Decrypt( unsigned char *input, int inputLength, unsigned char *output, int *outputLength )
@ -175,8 +167,6 @@ bool TEABlockEncryptor::Decrypt( unsigned char *input, int inputLength, unsigned
unsigned int &V0 = *(reinterpret_cast<unsigned int*>(input+i));
unsigned int &V1 = *(reinterpret_cast<unsigned int*>(input+i+sizeof(unsigned int)));
DecryptBlock(V0, V1);
//*(reinterpret_cast<unsigned int*>(input+i)+0) = V0;
//*(reinterpret_cast<unsigned int*>(input+i)+1) = V1;
}
#ifdef _DEBUG
@ -211,7 +201,6 @@ bool TEABlockEncryptor::Decrypt( unsigned char *input, int inputLength, unsigned
memcpy( output, input + sizeof( checkSum ) + sizeof( encodedPad ) + paddingBytes, *outputLength );
return true;
}
void TEABlockEncryptor::EncryptBlock(unsigned int &V0, unsigned int &V1)

View File

@ -9,9 +9,7 @@
class TEABlockEncryptor :
public DataBlockEncryptor
{
public:
TEABlockEncryptor();
~TEABlockEncryptor();
@ -30,7 +28,6 @@ protected:
void EncryptBlock(unsigned int &V0, unsigned int &V1);
void DecryptBlock(unsigned int &V0, unsigned int &V1);
};
#endif