mirror of
https://github.com/dashr9230/SA-MP.git
synced 2025-07-18 09:28:07 +08:00
[saco] Refactor
This commit is contained in:
@ -8,6 +8,10 @@
|
||||
#include "TinyEncrypt.h"
|
||||
#include "Obfuscator.h"
|
||||
|
||||
#ifndef ARCTOOL
|
||||
#include "../outputdebugstring.h"
|
||||
#endif
|
||||
|
||||
//------------------------------------
|
||||
|
||||
DWORD CArchiveFS::ms_dwHashInit = OBFUSCATE_DATA(0x9E3779B9);
|
||||
@ -166,7 +170,7 @@ void CArchiveFS::LoadEntries()
|
||||
tinyEnc.SetKey((BYTE*)TEA_KEY, TEA_XOR_KEY);
|
||||
tinyEnc.DecryptData(sizeof(SAA_ENTRY)*m_dwNumEntries, reinterpret_cast<BYTE*>(m_pEntries));
|
||||
|
||||
// 5. Build a binary tree of the entries.. it makes searching for files faster (since we have a
|
||||
// 5. Build a binary tree of the entries.. it makes searching for files faster (since we have a
|
||||
// huge index with fake entries)
|
||||
for(i=0; i<m_dwNumEntries; i++) {
|
||||
m_EntryBTreeRoot.AddEntry(&m_pEntries[i]);
|
||||
@ -268,7 +272,7 @@ DWORD CArchiveFS::GetFileIndex(DWORD dwFileHash)
|
||||
|
||||
//------------------------------------
|
||||
|
||||
DWORD CArchiveFS::GetFileIndex(char* szFileName)
|
||||
DWORD CArchiveFS::GetFileIndex(char* szFileName)
|
||||
{
|
||||
// PRE: szFileName must be the filename only (no paths!)
|
||||
|
||||
@ -361,10 +365,11 @@ BYTE* CArchiveFS::GetFileData(DWORD dwFileIndex)
|
||||
}
|
||||
|
||||
return node->pbData;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------
|
||||
|
||||
void CArchiveFS::UnloadData(DWORD dwFileIndex)
|
||||
{
|
||||
AFS_ENTRYBT_NODE* node = *(reinterpret_cast<AFS_ENTRYBT_NODE**>(&dwFileIndex));
|
||||
@ -375,3 +380,5 @@ void CArchiveFS::UnloadData(DWORD dwFileIndex)
|
||||
node->pbData = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------
|
||||
|
@ -29,7 +29,6 @@ CCryptoContext::CCryptoContext(void)
|
||||
}
|
||||
|
||||
ms_dwRefCount++;
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------
|
||||
|
@ -10,19 +10,6 @@
|
||||
|
||||
#ifndef ARCTOOL
|
||||
|
||||
/*
|
||||
const CHAR* CRYPT_MODULE = "advapi32";
|
||||
const CHAR* CRYPT_FN_AcquireContext = "CryptAcquireContextA";
|
||||
const CHAR* CRYPT_FN_ReleaseContext = "CryptReleaseContext";
|
||||
const CHAR* CRYPT_FN_GenRandom = "CryptGenRandom";
|
||||
const CHAR* CRYPT_FN_CreateHash = "CryptCreateHash";
|
||||
const CHAR* CRYPT_FN_DestroyHash = "CryptDestroyHash";
|
||||
const CHAR* CRYPT_FN_HashData = "CryptHashData";
|
||||
const CHAR* CRYPT_FN_DestroyKey = "CryptDestroyKey";
|
||||
const CHAR* CRYPT_FN_ImportKey = "CryptImportKey";
|
||||
const CHAR* CRYPT_FN_VerifySignature = "CryptVerifySignatureA";
|
||||
*/
|
||||
|
||||
const CHAR CRYPT_MODULE[] = "41#4%<fgU";
|
||||
const CHAR CRYPT_FN_AcquireContext[] = {0x16,0x27,0x2C,0x25,0x21,0x14,0x36,0x24,
|
||||
0x20,0x3C,0x27,0x30,0x16,0x3A,0x3B,0x21,
|
||||
|
@ -1,7 +1,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
// This file defines a basic interface for data streams
|
||||
// and provides implementations for a filebased stream
|
||||
// as well as as a memory based stream.
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
class CAbstractStream
|
||||
{
|
||||
@ -249,5 +254,4 @@ public:
|
||||
{
|
||||
return m_nOffset;
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -1,4 +1,9 @@
|
||||
|
||||
//
|
||||
// This is a modified XTEA algorithm with a streaming
|
||||
// mode of operation -- specifically CBC
|
||||
//
|
||||
|
||||
#include "TinyEncrypt.h"
|
||||
#include "Obfuscator.h"
|
||||
#include <stdio.h>
|
||||
|
@ -1,6 +1,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
#define ADDR_HWND 0xC97C1C
|
||||
#define ADDR_ID3D9DEVICE 0xC97C28
|
||||
|
||||
@ -30,3 +32,5 @@
|
||||
#define ADDR_VEHICLE_TABLE 0xB74494 // Contains ptr to the vehicles table
|
||||
|
||||
#define ADDR_CAMERA 0xB6F99C
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
#define MAX_PLAYERS 1004
|
||||
#define MAX_ACTORS 1000
|
||||
#define MAX_VEHICLES 2000
|
||||
@ -58,6 +60,7 @@ typedef struct _MATRIX4X4 {
|
||||
#define IN_VEHICLE(x) ((x->dwStateFlags & 256) >> 8)
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
typedef struct _WEAPON_SLOT_TYPE
|
||||
{
|
||||
DWORD dwType;
|
||||
@ -71,6 +74,7 @@ typedef struct _WEAPON_SLOT_TYPE
|
||||
} WEAPON_SLOT_TYPE; // MUST BE EXACTLY ALIGNED TO 28 bytes
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct _PED_TASKS_TYPE
|
||||
{
|
||||
@ -95,6 +99,7 @@ typedef struct _PED_TASKS_TYPE
|
||||
} PED_TASKS_TYPE;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct _ENTITY_TYPE
|
||||
{
|
||||
@ -127,10 +132,11 @@ typedef struct _ENTITY_TYPE
|
||||
} ENTITY_TYPE;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct _PED_TYPE
|
||||
{
|
||||
ENTITY_TYPE entity;
|
||||
ENTITY_TYPE entity; // 0-184
|
||||
|
||||
char _gapB8[948];
|
||||
|
||||
@ -193,6 +199,8 @@ typedef struct _PED_TYPE
|
||||
} PED_TYPE;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct _VEHICLE_TYPE
|
||||
{
|
||||
ENTITY_TYPE entity; // 0-184
|
||||
|
@ -61,7 +61,7 @@ CHttpClient::~CHttpClient()
|
||||
|
||||
int CHttpClient::ProcessURL(int iType, char *szURL, char *szPostData, char *szReferer)
|
||||
{
|
||||
printf("CHttpClient::ProcessURL %s\n", szURL); // Thanks Kalcor!
|
||||
printf("CHttpClient::ProcessURL %s\n",szURL);
|
||||
|
||||
InitRequest(iType,szURL,szPostData,szReferer);
|
||||
|
||||
@ -187,6 +187,7 @@ void CHttpClient::InitRequest(int iType, char *szURL, char *szPostData, char *sz
|
||||
|
||||
// Copy hostname from URL
|
||||
slash_ptr = strchr(szUseURL,'/');
|
||||
|
||||
if(!slash_ptr) {
|
||||
strcat(szUseURL,"/");
|
||||
slash_ptr = strchr(szUseURL,'/');
|
||||
|
@ -53,6 +53,7 @@ char *Util_stristr(const char *String, const char *Pattern)
|
||||
return (starti);
|
||||
}
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@ -119,7 +120,6 @@ int Util_wildcmp(char *wild, char *string)
|
||||
|
||||
int Util_strnicmp(const char *s1, const char *s2, size_t n)
|
||||
{
|
||||
|
||||
if (n == 0) return 0;
|
||||
|
||||
do
|
||||
|
@ -1,4 +1,6 @@
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
void Util_UrlUnencode(char *enc);
|
||||
char Util_toupper(char c);
|
||||
char *Util_stristr(const char *String, const char *Pattern);
|
||||
@ -12,4 +14,4 @@ void Util_Base64Encode( char *cpInput, char *cpOutput );
|
||||
char * K_DecodeString(unsigned char *szInput);
|
||||
void K_EncodeString(char *szInput, char *szOutput);
|
||||
|
||||
//----------------------------------------------------
|
||||
//----------------------------------------------------
|
||||
|
Reference in New Issue
Block a user