- New Release Build (2651)

- Removed test code for multiplayer file transfer (we have now a new branch for multiplayer: https://81.169.133.124/source/ja2/branches/Wanne/JA2 1.13 MP)


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2653 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2009-04-01 13:49:36 +00:00
parent 335747c3ff
commit 538c62455a
5 changed files with 12 additions and 242 deletions
+2 -2
View File
@@ -28,11 +28,11 @@ CHAR16 zVersionLabel[256] = { L"Beta v. 0.98" };
#else
//RELEASE BUILD VERSION
CHAR16 zVersionLabel[256] = { L"Release v1.13.2637" };
CHAR16 zVersionLabel[256] = { L"Release v1.13.2651" };
#endif
CHAR8 czVersionNumber[16] = { "Build 09.03.28" }; //YY.MM.DD
CHAR8 czVersionNumber[16] = { "Build 09.04.01" }; //YY.MM.DD
CHAR16 zTrackingNumber[16] = { L"Z" };
+3 -157
View File
@@ -76,14 +76,6 @@
#include "RakPeerInterface.h"
#include "RakNetStatistics.h"
#include "RakNetTypes.h"
#include "RakSleep.h"
#include "FileListTransfer.h"
#include "FileListTransferCBInterface.h"
#include "FileOperations.h"
#include "SuperFastHash.h"
#include "RakAssert.h"
#include "IncrementalReadInterface.h"
#include "BitStream.h"
#include <assert.h>
@@ -100,109 +92,6 @@
#include "tactical placement gui.h"
#include "prebattle interface.h"
// WANNE: FILE TRANSFER
STRING512 client_executableDirectory; // the clients executable dir
STRING512 server_executableDirectory; // the server executable dir
class ClientTransferCB : public FileListTransferCBInterface
{
public:
// This method gets called when all the data is received on the client.
// Now the file will be saved on the client
bool OnFile(OnFileStruct *onFileStruct)
{
STRING512 targetFileName;
ScreenMsg( FONT_BCOLOR_ORANGE, MSG_CHAT, L"(100%%) Got file from server: %S", onFileStruct->fileName);
//ScreenMsg( FONT_BCOLOR_ORANGE, MSG_CHAT, L"%i. (100%%) %i/%i %S %ib->%ib / %ib->%ib\n", onFileStruct->setID, onFileStruct->fileIndex+1, onFileStruct->setCount, onFileStruct->fileName, onFileStruct->compressedTransmissionLength, onFileStruct->finalDataLength, onFileStruct->setTotalCompressedTransmissionLength, onFileStruct->setTotalFinalLength);
// Replace server executable directory with client executable directory then we have the correct path
char* file = ReplaceString(onFileStruct->fileName, server_executableDirectory, client_executableDirectory);
/*
// Save the file in the clients executable dir!
strcpy(targetFileName, client_executableDirectory);
strcat(targetFileName, "\\");
// Only get the filename
char* file = ExtractFilename(onFileStruct->fileName);
*/
//strcat(targetFileName, file);
FILE *fp = fopen(file, "wb");
fwrite(onFileStruct->fileData, onFileStruct->finalDataLength, 1, fp);
fclose(fp);
/*
// Make sure it worked
unsigned int hash1 = SuperFastHashFile(fileToSend);
if (RakNet::BitStream::DoEndianSwap())
RakNet::BitStream::ReverseBytesInPlace((unsigned char*) &hash1, sizeof(hash1));
unsigned int hash2 = SuperFastHashFile(targetFileName);
if (RakNet::BitStream::DoEndianSwap())
RakNet::BitStream::ReverseBytesInPlace((unsigned char*) &hash2, sizeof(hash2));
RakAssert(hash1==hash2);
*/
ScreenMsg( FONT_BCOLOR_ORANGE, MSG_CHAT, L"Saved file local in %S", file);
// Return true to have RakNet delete the memory allocated to hold this file.
// False if you hold onto the memory, and plan to delete it yourself later
return true;
}
virtual void OnFileProgress(OnFileStruct *onFileStruct,unsigned int partCount,unsigned int partTotal,unsigned int partLength, char *firstDataChunk)
{
//ScreenMsg( FONT_BLUE, MSG_CHAT, L"(%i%%) %S", 100*partCount/partTotal, onFileStruct->fileName);
//ScreenMsg( FONT_BLUE, MSG_CHAT, L"%i (%i%%) %i/%i %S %ib->%ib / %ib->%ib\n", onFileStruct->setID, 100*partCount/partTotal, onFileStruct->fileIndex+1, onFileStruct->setCount, onFileStruct->fileName, onFileStruct->compressedTransmissionLength, onFileStruct->finalDataLength, onFileStruct->setTotalCompressedTransmissionLength, onFileStruct->setTotalFinalLength, firstDataChunk);
//printf("%i (%i%%) %i/%i %s %ib->%ib / %ib->%ib\n", onFileStruct->setID, 100*partCount/partTotal, onFileStruct->fileIndex+1, onFileStruct->setCount, onFileStruct->fileName, onFileStruct->compressedTransmissionLength, onFileStruct->finalDataLength, onFileStruct->setTotalCompressedTransmissionLength, onFileStruct->setTotalFinalLength, firstDataChunk);
}
virtual bool OnDownloadComplete(void)
{
//printf("Download complete.\n");
ScreenMsg( FONT_RED, MSG_CHAT, L"Download complete");
// Returning false automatically deallocates the automatically allocated handler that was created by DirectoryDeltaTransfer
return false;
}
private:
char *ExtractFilename(char *pathname)
{
char *s;
if ((s=strrchr(pathname, '\\')) != NULL) s++;
else if ((s=strrchr(pathname, '/')) != NULL) s++;
else if ((s=strrchr(pathname, ':')) != NULL) s++;
else s = pathname;
return s;
}
char *ReplaceString(char *str, char *orig, char *rep)
{
static char buffer[4096];
char *p;
if(!(p = strstr(str, orig))) // Is 'orig' even in 'str'?
return str;
strncpy(buffer, str, p-str); // Copy characters from 'str' start to 'orig' st$
buffer[p-str] = '\0';
sprintf(buffer+(p-str), "%s%s", rep, p+strlen(orig));
return buffer;
}
} transferCallback;
unsigned char GetPacketIdentifier(Packet *p);
unsigned char packetIdentifier;
@@ -235,11 +124,6 @@ unsigned char packetIdentifier;
extern INT8 SquadMovementGroups[ ];
RakPeerInterface *client;
// WANNE: FILE TRANSFER
FileListTransfer fltClient; // flt2
ClientTransferCB transferCBClient;
typedef struct
{
UINT8 ubProfileID;
@@ -442,9 +326,6 @@ UINT32 iCCStartGameTime = 0;
bool is_game_started = false;
// OJW - added 20081130
// <TODO> - add retry timer and notification
void NetworkAutoStart()
@@ -2087,11 +1968,6 @@ void overide_callback( UINT8 ubResult )
}
}
void requestEXECUTABLE_DIR(void)
{
client->RPC("requestEXECUTABLE_DIR","", 0, HIGH_PRIORITY, RELIABLE, 0, UNASSIGNED_SYSTEM_ADDRESS, true, 0, UNASSIGNED_NETWORK_ID,0);
}
void requestSETTINGS(void)
{
client_info cl_name;
@@ -2106,18 +1982,7 @@ void requestSETTINGS(void)
}
// Get executable Directory from Server. This is used to get corret file location on client side
void recieveEXECUTABLE_DIR (RPCParameters *rpcParameters)
{
//unsigned char* test = rpcParameters->input;
// Now get directory
strcpy( server_executableDirectory, (const char*)rpcParameters->input );
//GetExecutableDirectory()
//server_executableDirectory = "TEST1";
//GetExecutableDirectory(server_executableDirectory);
}
void recieveSETTINGS (RPCParameters *rpcParameters) //recive settings from server
@@ -2336,8 +2201,6 @@ void recieveSETTINGS (RPCParameters *rpcParameters) //recive settings from serve
}
}
void recieveTEAMCHANGE( RPCParameters *rpcParameters )
@@ -3489,7 +3352,6 @@ void connect_client ( void )
REGISTER_STATIC_RPC(client, recieveREADY);
REGISTER_STATIC_RPC(client, recieveGUI);
REGISTER_STATIC_RPC(client, recieveSETTINGS);
REGISTER_STATIC_RPC(client, recieveEXECUTABLE_DIR);
REGISTER_STATIC_RPC(client, recieveTEAMCHANGE);
REGISTER_STATIC_RPC(client, recieveEDGECHANGE);
REGISTER_STATIC_RPC(client, recieveMAPCHANGE);
@@ -3517,12 +3379,7 @@ void connect_client ( void )
{
//ScreenMsg( FONT_LTGREEN, MSG_CHAT, L"Client started, waiting for connections...");
is_client=true;
GetExecutableDirectory(client_executableDirectory);
// WANNE: FILE TRANSFER
client->AttachPlugin(&fltClient);
client->SetSplitMessageProgressInterval(1);
/*repo=0;*/
}
else
{
@@ -3680,8 +3537,6 @@ void connect_client ( void )
MPDebugMsg( String ( "connect_client()\n" ) );
#endif
}
else if (is_connecting)
@@ -3774,18 +3629,10 @@ void client_packet ( void )
ScreenMsg( FONT_LTGREEN, MSG_CHAT, L"ID_CONNECTION_REQUEST_ACCEPTED");
is_connected=true;
is_connecting=false;
// WANNE: FILE TRANSFER
// Get the server executable dir
requestEXECUTABLE_DIR();
requestSETTINGS();
// WANNE: FILE TRANSFER
Sleep(1000);
setID = fltClient.SetupReceive(&transferCBClient, false, p->systemAddress);
//request_settings();//ask server for game settings...
break;
case ID_NEW_INCOMING_CONNECTION:
case ID_NEW_INCOMING_CONNECTION:
//tells server client has connected
ScreenMsg( FONT_LTGREEN, MSG_CHAT, L"ID_NEW_INCOMING_CONNECTION");
break;
@@ -3855,7 +3702,6 @@ void client_disconnect (void)
allowlaptop=false;
// clear local client cache
memset(client_names,0,sizeof(char)*4*30);
memset(client_edges,0,sizeof(int)*4);
-4
View File
@@ -6,10 +6,6 @@ extern char CLIENT_NAME[30];
extern char SERVER_NAME[30];
extern bool Sawarded;
//extern char *fileToSend;
extern unsigned int setID;
//extern char *fileToSendCopy;
typedef struct
{
+5 -77
View File
@@ -5,14 +5,6 @@
#include "RakNetStatistics.h"
#include "RakNetTypes.h"
#include "FileListTransfer.h"
#include "FileListTransferCBInterface.h"
#include "FileOperations.h"
#include "SuperFastHash.h"
#include "RakAssert.h"
#include "IncrementalReadInterface.h"
#include "BitStream.h"
#include "RakSleep.h"
#include <assert.h>
@@ -24,25 +16,9 @@
#include <time.h>
#include <list>
#include "connect.h"
#include "types.h"
#include "gamesettings.h"
// WANNE: FILE TRANSFER
unsigned int setID;
// Sender progress notification
class ServerFileListProgress : public FileListProgress
{
virtual void OnFilePush(const char *fileName, unsigned int fileLengthBytes, unsigned int offset, unsigned int bytesBeingSent, bool done, SystemAddress targetSystem)
{
printf("Sending %s bytes=%i offset=%i\n", fileName, bytesBeingSent, offset);
}
} serverFileListProgress;
char kbag[100];
char net_div[30];
INT32 gsMAX_MERCS;
@@ -53,7 +29,7 @@ int gsREPORT_NAME;
#include "text.h"
#include "network.h"
#include "connect.h"
#include "message.h"
#include "overhead.h"
#include "fresh_header.h"
@@ -85,16 +61,6 @@ unsigned char SpacketIdentifier;
RakPeerInterface *server;
// WANNE: FILE TRANSFER
FileListTransfer fltServer; // flt1
IncrementalReadInterface incrementalReadInterface;
FileList fileList;
int numreadyteams;
int readyteamreg[10];
@@ -517,15 +483,6 @@ void rSortArray(int* arr, int len)
}
}
void requestEXECUTABLE_DIR(RPCParameters *rpcParameters)
{
SystemAddress sender = rpcParameters->sender;//get senders address
STRING512 executableDir;
GetExecutableDirectory(executableDir);
server->RPC("recieveEXECUTABLE_DIR",(const char*)&executableDir, (int)sizeof(STRING512), HIGH_PRIORITY, RELIABLE, 0, UNASSIGNED_SYSTEM_ADDRESS, true, 0, UNASSIGNED_NETWORK_ID,0);
}
//************************* //UNASSIGNED_SYSTEM_ADDRESS
//START INTERNAL SERVER
@@ -627,9 +584,6 @@ void requestSETTINGS(RPCParameters *rpcParameters )
server->RPC("recieveSETTINGS",(const char*)&lan, (int)sizeof(settings_struct)*8, HIGH_PRIORITY, RELIABLE, 0, UNASSIGNED_SYSTEM_ADDRESS, true, 0, UNASSIGNED_NETWORK_ID,0);
} // end if(can_joingame)
}
@@ -850,7 +804,6 @@ void start_server (void)
REGISTER_STATIC_RPC(server, sendGUI);
REGISTER_STATIC_RPC(server, sendBULLET);
REGISTER_STATIC_RPC(server, requestSETTINGS);
REGISTER_STATIC_RPC(server, requestEXECUTABLE_DIR);
REGISTER_STATIC_RPC(server, sendSTATE);
REGISTER_STATIC_RPC(server, sendDEATH);
REGISTER_STATIC_RPC(server, sendhitSTRUCT);
@@ -873,35 +826,14 @@ void start_server (void)
REGISTER_STATIC_RPC(server, sendCHATMSG);
//REGISTER_STATIC_RPC(server, rINT);
//
if (b)
{
ScreenMsg( FONT_LTBLUE, MSG_CHAT, MPServerMessage[1]);
ScreenMsg( FONT_LTBLUE, MSG_CHAT, MPServerMessage[2]);
is_server = true;
// WANNE: FILE TRANSFER
server->AttachPlugin(&fltServer);
server->SetSplitMessageProgressInterval(1);
fltServer.SetCallback(&serverFileListProgress);
STRING512 executableDir;
STRING512 fileToSend;
GetExecutableDirectory(executableDir);
// 1st Testfile to send to the client
strcpy(fileToSend, executableDir);
strcat(fileToSend, "\\Data-1.13\\TableData\\Items.xml");
unsigned int fileLength = GetFileLength(fileToSend);
fileList.AddFile(fileToSend, 0, fileLength, fileLength, FileListNodeContext(0,0), true);
// 2nd Testfile to send to the client
strcpy(fileToSend, executableDir);
strcat(fileToSend, "\\Data-1.13\\TableData\\German.Items.xml");
fileLength = GetFileLength(fileToSend);
fileList.AddFile(fileToSend, 0, fileLength, fileLength, FileListNodeContext(0,0), true);
connect_client();//connect client to server
}
else
@@ -985,9 +917,6 @@ void server_packet ( void )
// make sure they can connect
CheckIncomingConnection(p);
//send_settings();//send off server set settings
// TODO.RW: Send the files to the connect clients
fltServer.Send(&fileList,server,p->systemAddress,setID,HIGH_PRIORITY,0,false, &incrementalReadInterface, 5000);
break;
case ID_MODIFIED_PACKET:
// Cheater!
@@ -1029,7 +958,6 @@ void server_disconnect (void)
{
server->Shutdown(300);
is_server = false;
fileList.Clear();
// We're done with the network
RakNetworkFactory::DestroyRakPeerInterface(server);
ScreenMsg( FONT_LTBLUE, MSG_CHAT, MPServerMessage[6]);
@@ -1038,4 +966,4 @@ void server_disconnect (void)
{
ScreenMsg( FONT_LTBLUE, MSG_CHAT, MPServerMessage[7]);
}
}
}
+2 -2
View File
@@ -66,7 +66,7 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStaticDebug.lib ws2_32.lib"
OutputFile="$(OutDir)\JA2_v1.13.2634_EN_Debug.exe"
OutputFile="$(OutDir)\JA2_v1.13.2651_EN_Debug.exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
@@ -145,7 +145,7 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStatic.lib ws2_32.lib"
OutputFile="$(OutDir)\JA2_v1.13.2634_EN_Release.exe"
OutputFile="$(OutDir)\JA2_v1.13.2651_EN_Release.exe"
LinkIncremental="1"
GenerateDebugInformation="true"
GenerateMapFile="true"