#pragma once #pragma warning(disable: 4996) #include "../src/GWLPLog.h" #include "../src/ConfigLoader.h" #include "../src/NetServer.h" #include "../src/timer.h" #include "../src/Utility.h" #include "GwArchive.h" //------Program Options-----// //The following must both be equal to a power of 2 #define ORIGINAL_SEGMENT_SIZE gFsConfig.originalSegmentSize #define EXPANDED_SEGMENT_SIZE gFsConfig.expandedSegmentSize //Packet size #define CHUNK_SIZE gFsConfig.chunkSize//1460//2920 //End options enum { FS_UPDATE =2, FS_DETAILS =5, FS_NOTFOUND =4, FS_RESPONSE =6 }; struct FS_CONFIG { bool automaticIp; unsigned char ipAddress[4]; unsigned short port; bool logAllMessages; bool useArchive; char archivePath[200]; bool useArenaNet; bool disableArchiveFFNA; int originalSegmentSize; int expandedSegmentSize; int chunkSize; int timeWait; //Build version stuff unsigned long unknown1; unsigned long depFile; unsigned long exeFile; unsigned long unknown2; unsigned long unknown3; bool disableFileLog; }; struct FsFile { unsigned char* pFileData; unsigned long hash; unsigned long decompressedSize; unsigned long compressedSize; char fileName[150]; unsigned long crc32; bool archiveFile; }; struct LocalData { short networkId; vector hashes; bool sendingData; unsigned long segmentLength; unsigned long filePos; unsigned long bytesRemainingInSegment; int queuedSends; bool stupidSwitch; //Variables that help handle the weird first byte of all server packets unsigned char wtfByte; }; struct OPCODE { unsigned short opcode; char name[100]; int (*handler)(NetMessage*, LocalData*); }; extern GWLPLog gCoreLog; extern FS_CONFIG gFsConfig; extern Server* gpFileServer; extern hash_map gClientOpcodesTable; extern hash_map gData; extern hash_map gFiles; extern GwArchive gGwArchive; extern unsigned long gAnetIps[15]; extern bool gIgnoreFileWarning; void SendData(LocalData* pLir); void SendDataHeader(LocalData* pLir, unsigned long segmentLength); void RegisterFile(char* pFileName, unsigned long hash, unsigned long decompressedSize); void RegisterFile(char* pFileName, unsigned long hash); void FreeFile(unsigned long hash); bool GetFileFromAnet(unsigned long hash);