2014-03-15 16:59:03 +00:00
|
|
|
// SONIC ROBO BLAST 2
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
2016-05-18 00:42:11 +00:00
|
|
|
// Copyright (C) 1999-2016 by Sonic Team Junior.
|
2014-03-15 16:59:03 +00:00
|
|
|
//
|
|
|
|
// This program is free software distributed under the
|
|
|
|
// terms of the GNU General Public License, version 2.
|
|
|
|
// See the 'LICENSE' file for more details.
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/// \file d_netfil.h
|
|
|
|
/// \brief File transferring related structs and functions.
|
|
|
|
|
|
|
|
#ifndef __D_NETFIL__
|
|
|
|
#define __D_NETFIL__
|
|
|
|
|
|
|
|
#include "w_wad.h"
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
SF_FILE,
|
|
|
|
SF_Z_RAM,
|
|
|
|
SF_RAM,
|
|
|
|
SF_NOFREERAM
|
|
|
|
} freemethod_t;
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
FS_NOTFOUND,
|
|
|
|
FS_FOUND,
|
|
|
|
FS_REQUESTED,
|
|
|
|
FS_DOWNLOADING,
|
2016-12-31 18:26:33 +00:00
|
|
|
FS_OPEN, // Is opened and used in w_wad
|
2014-03-15 16:59:03 +00:00
|
|
|
FS_MD5SUMBAD
|
|
|
|
} filestatus_t;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
UINT8 important;
|
2016-12-31 18:26:33 +00:00
|
|
|
UINT8 willsend; // Is the server willing to send it?
|
2014-03-15 16:59:03 +00:00
|
|
|
char filename[MAX_WADPATH];
|
|
|
|
UINT8 md5sum[16];
|
2016-12-31 18:26:33 +00:00
|
|
|
// Used only for download
|
|
|
|
FILE *file;
|
2014-03-15 16:59:03 +00:00
|
|
|
UINT32 currentsize;
|
|
|
|
UINT32 totalsize;
|
2016-12-31 18:26:33 +00:00
|
|
|
filestatus_t status; // The value returned by recsearch
|
2014-03-15 16:59:03 +00:00
|
|
|
} fileneeded_t;
|
|
|
|
|
|
|
|
extern INT32 fileneedednum;
|
|
|
|
extern fileneeded_t fileneeded[MAX_WADFILES];
|
2018-11-14 21:50:52 +00:00
|
|
|
extern char downloaddir[512];
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
#ifdef CLIENT_LOADINGSCREEN
|
|
|
|
extern INT32 lastfilenum;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
UINT8 *PutFileNeeded(void);
|
|
|
|
void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr);
|
|
|
|
void CL_PrepareDownloadSaveGame(const char *tmpsave);
|
|
|
|
|
|
|
|
INT32 CL_CheckFiles(void);
|
|
|
|
void CL_LoadServerFiles(void);
|
2016-12-31 18:26:33 +00:00
|
|
|
void SV_SendRam(INT32 node, void *data, size_t size, freemethod_t freemethod,
|
2014-03-15 16:59:03 +00:00
|
|
|
UINT8 fileid);
|
|
|
|
|
2016-12-31 18:26:33 +00:00
|
|
|
void SV_FileSendTicker(void);
|
2014-03-15 16:59:03 +00:00
|
|
|
void Got_Filetxpak(void);
|
2017-01-13 19:53:52 +00:00
|
|
|
boolean SV_SendingFile(INT32 node);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
boolean CL_CheckDownloadable(void);
|
|
|
|
boolean CL_SendRequestFile(void);
|
2017-05-26 12:39:54 +00:00
|
|
|
boolean Got_RequestFilePak(INT32 node);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2016-12-31 18:26:33 +00:00
|
|
|
void SV_AbortSendFiles(INT32 node);
|
2014-03-15 16:59:03 +00:00
|
|
|
void CloseNetFile(void);
|
|
|
|
|
|
|
|
boolean fileexist(char *filename, time_t ptime);
|
|
|
|
|
2016-12-31 18:26:33 +00:00
|
|
|
// Search a file in the wadpath, return FS_FOUND when found
|
2014-03-15 16:59:03 +00:00
|
|
|
filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum,
|
|
|
|
boolean completepath);
|
|
|
|
filestatus_t checkfilemd5(char *filename, const UINT8 *wantedmd5sum);
|
|
|
|
|
|
|
|
void nameonly(char *s);
|
|
|
|
size_t nameonlylength(const char *s);
|
|
|
|
|
|
|
|
#endif // __D_NETFIL__
|