Remove NPFTE preprocessor stuff
This commit is contained in:
parent
8adffcecfa
commit
a024a82b89
7 changed files with 11 additions and 172 deletions
|
@ -1567,9 +1567,7 @@ static void VARGS png_onerror(png_structp png_ptr, png_const_charp error_msg)
|
||||||
static void VARGS png_onwarning(png_structp png_ptr, png_const_charp warning_msg)
|
static void VARGS png_onwarning(png_structp png_ptr, png_const_charp warning_msg)
|
||||||
{
|
{
|
||||||
struct pngerr *err = qpng_get_error_ptr(png_ptr);
|
struct pngerr *err = qpng_get_error_ptr(png_ptr);
|
||||||
#ifndef NPFTE
|
|
||||||
Con_DPrintf("libpng %s: %s\n", err->fname, warning_msg);
|
Con_DPrintf("libpng %s: %s\n", err->fname, warning_msg);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qbyte *ReadPNGFile(const char *fname, qbyte *buf, int length, int *width, int *height, uploadfmt_t *format, qboolean force_rgb32)
|
qbyte *ReadPNGFile(const char *fname, qbyte *buf, int length, int *width, int *height, uploadfmt_t *format, qboolean force_rgb32)
|
||||||
|
@ -1792,7 +1790,6 @@ error:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef NPFTE
|
|
||||||
int Image_WritePNG (const char *filename, enum fs_relative fsroot, int compression, void **buffers, int numbuffers, qintptr_t bufferstride, int width, int height, enum uploadfmt fmt, qboolean writemetadata)
|
int Image_WritePNG (const char *filename, enum fs_relative fsroot, int compression, void **buffers, int numbuffers, qintptr_t bufferstride, int width, int height, enum uploadfmt fmt, qboolean writemetadata)
|
||||||
{
|
{
|
||||||
char name[MAX_OSPATH];
|
char name[MAX_OSPATH];
|
||||||
|
@ -2035,7 +2032,6 @@ err:
|
||||||
Con_Printf("File error writing %s\n", filename);
|
Con_Printf("File error writing %s\n", filename);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -2453,7 +2449,6 @@ badjpeg:
|
||||||
|
|
||||||
}
|
}
|
||||||
/*end read*/
|
/*end read*/
|
||||||
#ifndef NPFTE
|
|
||||||
/*begin write*/
|
/*begin write*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -2664,7 +2659,6 @@ qboolean screenshotJPEG(char *filename, enum fs_relative fsroot, int compression
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IMAGEFMT_PCX
|
#ifdef IMAGEFMT_PCX
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -411,7 +411,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#define SQL
|
#define SQL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(AVAIL_GZDEC) && (!defined(AVAIL_ZLIB) || defined(NPFTE) || defined(NO_ZLIB))
|
#if defined(AVAIL_GZDEC) && (!defined(AVAIL_ZLIB) || defined(NO_ZLIB))
|
||||||
//gzip needs zlib to work (pk3s can still contain non-compressed files)
|
//gzip needs zlib to work (pk3s can still contain non-compressed files)
|
||||||
#undef AVAIL_GZDEC
|
#undef AVAIL_GZDEC
|
||||||
#endif
|
#endif
|
||||||
|
@ -428,16 +428,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#undef PACKAGE_DZIP
|
#undef PACKAGE_DZIP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//fix things a little...
|
|
||||||
#ifdef NPFTE
|
|
||||||
/*plugins require threads and stuff now, and http download support*/
|
|
||||||
#ifndef MULTITHREAD
|
|
||||||
#define MULTITHREAD
|
|
||||||
#define WEBCLIENT
|
|
||||||
#endif
|
|
||||||
#undef SUBSERVERS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (defined(NOLOADERTHREAD) || !defined(MULTITHREAD)) && defined(LOADERTHREAD)
|
#if (defined(NOLOADERTHREAD) || !defined(MULTITHREAD)) && defined(LOADERTHREAD)
|
||||||
#undef LOADERTHREAD
|
#undef LOADERTHREAD
|
||||||
#endif
|
#endif
|
||||||
|
@ -459,13 +449,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NPFTE
|
|
||||||
#undef TEXTEDITOR
|
|
||||||
#undef WEBSERVER //http server
|
|
||||||
#undef FTPSERVER //ftp server
|
|
||||||
#undef FTPCLIENT //ftp client.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef AVAIL_ZLIB
|
#ifndef AVAIL_ZLIB
|
||||||
#undef SUPPORT_ICE //depends upon zlib's crc32 for fingerprinting. I cba writing my own.
|
#undef SUPPORT_ICE //depends upon zlib's crc32 for fingerprinting. I cba writing my own.
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -5529,7 +5529,7 @@ qboolean Sys_FindGameData(const char *poshname, const char *gamename, char *base
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(NPFTE) && defined(HAVE_CLIENT) //this is *really* unfortunate, but doing this crashes the browser
|
#if defined(HAVE_CLIENT) //this is *really* unfortunate, but doing this crashes the browser
|
||||||
if (allowprompts && poshname && *gamename && !COM_CheckParm("-manifest"))
|
if (allowprompts && poshname && *gamename && !COM_CheckParm("-manifest"))
|
||||||
{
|
{
|
||||||
if (Sys_DoDirectoryPrompt(basepath, basepathlen, poshname, gamename))
|
if (Sys_DoDirectoryPrompt(basepath, basepathlen, poshname, gamename))
|
||||||
|
@ -5689,7 +5689,7 @@ qboolean Sys_FindGameData(const char *poshname, const char *gamename, char *base
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(NPFTE) && defined(HAVE_CLIENT) //this is *really* unfortunate, but doing this crashes the browser
|
#if defined(HAVE_CLIENT) //this is *really* unfortunate, but doing this crashes the browser
|
||||||
if (allowprompts && poshname && *gamename && !COM_CheckParm("-manifest"))
|
if (allowprompts && poshname && *gamename && !COM_CheckParm("-manifest"))
|
||||||
{
|
{
|
||||||
if (Sys_DoDirectoryPrompt(basepath, basepathlen, poshname, gamename))
|
if (Sys_DoDirectoryPrompt(basepath, basepathlen, poshname, gamename))
|
||||||
|
@ -7610,18 +7610,11 @@ static qboolean FS_GetBestHomeDir(ftemanifest_t *manifest)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NPFTE
|
|
||||||
if (!*com_homepath)
|
|
||||||
Q_snprintfz(com_homepath, sizeof(com_homepath), "/%s/", HOMESUBDIR);
|
|
||||||
//as a browser plugin, always use their home directory
|
|
||||||
return true;
|
|
||||||
#else
|
|
||||||
/*would it not be better to just check to see if we have write permission to the basedir?*/
|
/*would it not be better to just check to see if we have write permission to the basedir?*/
|
||||||
if (winver >= 0x6) // Windows Vista and above
|
if (winver >= 0x6) // Windows Vista and above
|
||||||
usehome = true; // always use home directory by default, as Vista+ mimics this behavior anyway
|
usehome = true; // always use home directory by default, as Vista+ mimics this behavior anyway
|
||||||
else if (winver >= 0x5) // Windows 2000/XP/2003
|
else if (winver >= 0x5) // Windows 2000/XP/2003
|
||||||
usehome = true; //might as well follow this logic. We use .manifest stuff to avoid getting redirected to obscure locations, so access rights is all that is relevant, not whether we're an admin or not.
|
usehome = true; //might as well follow this logic. We use .manifest stuff to avoid getting redirected to obscure locations, so access rights is all that is relevant, not whether we're an admin or not.
|
||||||
#endif
|
|
||||||
|
|
||||||
if (usehome && manifest)
|
if (usehome && manifest)
|
||||||
{
|
{
|
||||||
|
|
|
@ -200,10 +200,6 @@ void *Sys_CreateMutexNamed(char *file, int line);
|
||||||
|
|
||||||
void Sys_Sleep(double seconds);
|
void Sys_Sleep(double seconds);
|
||||||
|
|
||||||
#ifdef NPFTE
|
|
||||||
qboolean NPQTV_Sys_Startup(int argc, char *argv[]);
|
|
||||||
void NPQTV_Sys_MainLoop(void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define UPD_OFF 0
|
#define UPD_OFF 0
|
||||||
#define UPD_STABLE 1
|
#define UPD_STABLE 1
|
||||||
|
|
|
@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "winquake.h"
|
#include "winquake.h"
|
||||||
#include <conio.h>
|
#include <conio.h>
|
||||||
|
|
||||||
#if (defined(_DEBUG) || defined(DEBUG)) && !defined(NPFTE)
|
#if (defined(_DEBUG) || defined(DEBUG))
|
||||||
#if !defined(_MSC_VER) || _MSC_VER > 1200
|
#if !defined(_MSC_VER) || _MSC_VER > 1200
|
||||||
#define CATCHCRASH
|
#define CATCHCRASH
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1440,9 +1440,7 @@ static int GLVID_SetMode (rendererstate_t *info, unsigned char *palette)
|
||||||
{
|
{
|
||||||
int temp;
|
int temp;
|
||||||
qboolean stat;
|
qboolean stat;
|
||||||
#ifndef NPFTE
|
|
||||||
MSG msg;
|
MSG msg;
|
||||||
#endif
|
|
||||||
// HDC hdc;
|
// HDC hdc;
|
||||||
|
|
||||||
vrsetup_t setup = {sizeof(setup)};
|
vrsetup_t setup = {sizeof(setup)};
|
||||||
|
@ -1623,7 +1621,6 @@ static int GLVID_SetMode (rendererstate_t *info, unsigned char *palette)
|
||||||
// Who knows if it helps, but it probably doesn't hurt
|
// Who knows if it helps, but it probably doesn't hurt
|
||||||
SetForegroundWindow (mainwindow);
|
SetForegroundWindow (mainwindow);
|
||||||
|
|
||||||
#ifndef NPFTE
|
|
||||||
/*I don't like this, but if we */
|
/*I don't like this, but if we */
|
||||||
Sleep (100);
|
Sleep (100);
|
||||||
while (PeekMessage (&msg, mainwindow, 0, 0, PM_REMOVE))
|
while (PeekMessage (&msg, mainwindow, 0, 0, PM_REMOVE))
|
||||||
|
@ -1632,7 +1629,6 @@ static int GLVID_SetMode (rendererstate_t *info, unsigned char *palette)
|
||||||
DispatchMessage (&msg);
|
DispatchMessage (&msg);
|
||||||
}
|
}
|
||||||
Sleep (100);
|
Sleep (100);
|
||||||
#endif
|
|
||||||
|
|
||||||
SetWindowPos (mainwindow, HWND_TOP, 0, 0, 0, 0,
|
SetWindowPos (mainwindow, HWND_TOP, 0, 0, 0, 0,
|
||||||
SWP_DRAWFRAME | SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW |
|
SWP_DRAWFRAME | SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW |
|
||||||
|
|
|
@ -6,9 +6,7 @@
|
||||||
#include "fs.h"
|
#include "fs.h"
|
||||||
|
|
||||||
#if defined(WEBCLIENT)
|
#if defined(WEBCLIENT)
|
||||||
#ifndef NPFTE
|
|
||||||
static struct dl_download *activedownloads;
|
static struct dl_download *activedownloads;
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(FTE_TARGET_WEB)
|
#if defined(FTE_TARGET_WEB)
|
||||||
|
|
||||||
|
@ -148,10 +146,6 @@ typedef struct cookie_s
|
||||||
} cookie_t;
|
} cookie_t;
|
||||||
cookie_t *cookies;
|
cookie_t *cookies;
|
||||||
|
|
||||||
#ifdef NPFTE
|
|
||||||
#define Z_Malloc malloc
|
|
||||||
#define Z_Free free
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//set a specific cookie.
|
//set a specific cookie.
|
||||||
void Cookie_Feed(char *domain, int secure, char *name, char *value)
|
void Cookie_Feed(char *domain, int secure, char *name, char *value)
|
||||||
|
@ -284,12 +278,8 @@ void Cookie_Regurgitate(char *domain, int secure, char *buffer, size_t buffersiz
|
||||||
struct http_dl_ctx_s {
|
struct http_dl_ctx_s {
|
||||||
// struct dl_download *dlctx;
|
// struct dl_download *dlctx;
|
||||||
|
|
||||||
#ifndef NPFTE
|
|
||||||
vfsfile_t *stream;
|
vfsfile_t *stream;
|
||||||
SOCKET sock; //so we can wait on it when multithreaded.
|
SOCKET sock; //so we can wait on it when multithreaded.
|
||||||
#else
|
|
||||||
SOCKET sock; //FIXME: support https.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
char *buffer;
|
char *buffer;
|
||||||
|
|
||||||
|
@ -317,15 +307,9 @@ void HTTP_Cleanup(struct dl_download *dl)
|
||||||
struct http_dl_ctx_s *con = dl->ctx;
|
struct http_dl_ctx_s *con = dl->ctx;
|
||||||
dl->ctx = NULL;
|
dl->ctx = NULL;
|
||||||
|
|
||||||
#ifndef NPFTE
|
|
||||||
if (con->stream)
|
if (con->stream)
|
||||||
VFS_CLOSE(con->stream);
|
VFS_CLOSE(con->stream);
|
||||||
con->stream = NULL;
|
con->stream = NULL;
|
||||||
#else
|
|
||||||
if (con->sock != INVALID_SOCKET)
|
|
||||||
closesocket(con->sock);
|
|
||||||
con->sock = INVALID_SOCKET;
|
|
||||||
#endif
|
|
||||||
free(con->buffer);
|
free(con->buffer);
|
||||||
free(con);
|
free(con);
|
||||||
|
|
||||||
|
@ -413,7 +397,7 @@ static qboolean HTTP_DL_Work(struct dl_download *dl)
|
||||||
switch(con->state)
|
switch(con->state)
|
||||||
{
|
{
|
||||||
case HC_REQUESTING:
|
case HC_REQUESTING:
|
||||||
#ifndef NPFTE
|
|
||||||
ammount = VFS_WRITE(con->stream, con->buffer, con->bufferused);
|
ammount = VFS_WRITE(con->stream, con->buffer, con->bufferused);
|
||||||
if (!ammount)
|
if (!ammount)
|
||||||
return true;
|
return true;
|
||||||
|
@ -423,19 +407,6 @@ static qboolean HTTP_DL_Work(struct dl_download *dl)
|
||||||
dl->replycode = VFSError_To_HTTP(ammount);
|
dl->replycode = VFSError_To_HTTP(ammount);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
ammount = send(con->sock, con->buffer, con->bufferused, 0);
|
|
||||||
|
|
||||||
if (!ammount)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (ammount < 0)
|
|
||||||
{
|
|
||||||
if (neterrno() != NET_EWOULDBLOCK)
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
con->bufferused -= ammount;
|
con->bufferused -= ammount;
|
||||||
memmove(con->buffer, con->buffer+ammount, con->bufferused);
|
memmove(con->buffer, con->buffer+ammount, con->bufferused);
|
||||||
|
@ -447,7 +418,6 @@ static qboolean HTTP_DL_Work(struct dl_download *dl)
|
||||||
if (con->bufferlen - con->bufferused < 1530)
|
if (con->bufferlen - con->bufferused < 1530)
|
||||||
ExpandBuffer(con, 1530);
|
ExpandBuffer(con, 1530);
|
||||||
|
|
||||||
#ifndef NPFTE
|
|
||||||
ammount = VFS_READ(con->stream, con->buffer+con->bufferused, con->bufferlen-con->bufferused-15);
|
ammount = VFS_READ(con->stream, con->buffer+con->bufferused, con->bufferlen-con->bufferused-15);
|
||||||
if (!ammount)
|
if (!ammount)
|
||||||
return true;
|
return true;
|
||||||
|
@ -457,17 +427,6 @@ static qboolean HTTP_DL_Work(struct dl_download *dl)
|
||||||
dl->replycode = VFSError_To_HTTP(ammount);
|
dl->replycode = VFSError_To_HTTP(ammount);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
ammount = recv(con->sock, con->buffer+con->bufferused, con->bufferlen-con->bufferused-15, 0);
|
|
||||||
if (!ammount)
|
|
||||||
return false;
|
|
||||||
if (ammount < 0)
|
|
||||||
{
|
|
||||||
if (neterrno() != NET_EWOULDBLOCK)
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
con->bufferused+=ammount;
|
con->bufferused+=ammount;
|
||||||
con->buffer[con->bufferused] = '\0';
|
con->buffer[con->bufferused] = '\0';
|
||||||
|
@ -686,7 +645,6 @@ static qboolean HTTP_DL_Work(struct dl_download *dl)
|
||||||
|
|
||||||
if (!dl->file)
|
if (!dl->file)
|
||||||
{
|
{
|
||||||
#ifndef NPFTE
|
|
||||||
if (*dl->localname)
|
if (*dl->localname)
|
||||||
{
|
{
|
||||||
FS_CreatePath(dl->localname, dl->fsroot);
|
FS_CreatePath(dl->localname, dl->fsroot);
|
||||||
|
@ -694,7 +652,7 @@ static qboolean HTTP_DL_Work(struct dl_download *dl)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
dl->file = FS_OpenTemp();
|
dl->file = FS_OpenTemp();
|
||||||
#endif
|
|
||||||
if (!dl->file)
|
if (!dl->file)
|
||||||
{
|
{
|
||||||
if (*dl->localname)
|
if (*dl->localname)
|
||||||
|
@ -725,21 +683,11 @@ static qboolean HTTP_DL_Work(struct dl_download *dl)
|
||||||
if (con->bufferlen - con->bufferused < 1530)
|
if (con->bufferlen - con->bufferused < 1530)
|
||||||
ExpandBuffer(con, 1530);
|
ExpandBuffer(con, 1530);
|
||||||
|
|
||||||
#ifndef NPFTE
|
|
||||||
ammount = VFS_READ(con->stream, con->buffer+con->bufferused, con->bufferlen-con->bufferused-1);
|
ammount = VFS_READ(con->stream, con->buffer+con->bufferused, con->bufferlen-con->bufferused-1);
|
||||||
if (ammount == 0)
|
if (ammount == 0)
|
||||||
return true; //no data yet
|
return true; //no data yet
|
||||||
else if (ammount < 0)
|
else if (ammount < 0)
|
||||||
ammount = 0; //error (EOF?)
|
ammount = 0; //error (EOF?)
|
||||||
#else
|
|
||||||
ammount = recv(con->sock, con->buffer+con->bufferused, con->bufferlen-con->bufferused-1, 0);
|
|
||||||
if (ammount < 0)
|
|
||||||
{
|
|
||||||
if (neterrno() != NET_EWOULDBLOCK)
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
con->bufferused+=ammount;
|
con->bufferused+=ammount;
|
||||||
|
|
||||||
|
@ -886,12 +834,6 @@ firstread:
|
||||||
|
|
||||||
void HTTPDL_Establish(struct dl_download *dl)
|
void HTTPDL_Establish(struct dl_download *dl)
|
||||||
{
|
{
|
||||||
#ifdef NPFTE
|
|
||||||
unsigned long _true = true;
|
|
||||||
struct sockaddr_qstorage serveraddr;
|
|
||||||
int addressfamily;
|
|
||||||
int addresssize;
|
|
||||||
#endif
|
|
||||||
struct http_dl_ctx_s *con;
|
struct http_dl_ctx_s *con;
|
||||||
qboolean https = false;
|
qboolean https = false;
|
||||||
|
|
||||||
|
@ -935,7 +877,6 @@ void HTTPDL_Establish(struct dl_download *dl)
|
||||||
|
|
||||||
dl->status = DL_RESOLVING;
|
dl->status = DL_RESOLVING;
|
||||||
|
|
||||||
#ifndef NPFTE
|
|
||||||
con->sock = INVALID_SOCKET;
|
con->sock = INVALID_SOCKET;
|
||||||
con->stream = NULL;
|
con->stream = NULL;
|
||||||
con->secure = false;
|
con->secure = false;
|
||||||
|
@ -968,53 +909,6 @@ void HTTPDL_Establish(struct dl_download *dl)
|
||||||
dl->status = DL_FAILED;
|
dl->status = DL_FAILED;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
con->secure = false;
|
|
||||||
if (https || !NET_StringToSockaddr(con->server, 80, &serveraddr, &addressfamily, &addresssize))
|
|
||||||
{
|
|
||||||
dl->status = DL_FAILED;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
dl->status = DL_QUERY;
|
|
||||||
|
|
||||||
if ((con->sock = socket (addressfamily, SOCK_STREAM, IPPROTO_TCP)) == -1)
|
|
||||||
{
|
|
||||||
dl->status = DL_FAILED;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//don't bother binding. its optional.
|
|
||||||
|
|
||||||
//FIXME: make the connect call with a non-blocking socket.
|
|
||||||
//FIXME: use a vfsfile_t instead of a direct socket to support https
|
|
||||||
|
|
||||||
//not yet blocking.
|
|
||||||
if (connect(con->sock, (struct sockaddr *)&serveraddr, addresssize) == -1)
|
|
||||||
{
|
|
||||||
int err = neterrno();
|
|
||||||
switch(err)
|
|
||||||
{
|
|
||||||
case NET_EACCES:
|
|
||||||
Con_Printf("HTTP: connect(%s): access denied. Check firewall.\n", con->server);
|
|
||||||
break;
|
|
||||||
case NET_ETIMEDOUT:
|
|
||||||
Con_Printf("HTTP: connect(%s): timed out.\n", con->server);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
Con_Printf("HTTP: connect(%s): %s", con->server, strerror(neterrno()));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
dl->status = DL_FAILED;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ioctlsocket (con->sock, FIONBIO, &_true) == -1) //now make it non blocking.
|
|
||||||
{
|
|
||||||
dl->status = DL_FAILED;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef COOKIECOOKIECOOKIE
|
#ifdef COOKIECOOKIECOOKIE
|
||||||
Cookie_Regurgitate(con->server, con->secure, cookies, sizeof(cookies));
|
Cookie_Regurgitate(con->server, con->secure, cookies, sizeof(cookies));
|
||||||
#endif
|
#endif
|
||||||
|
@ -1227,7 +1121,6 @@ qboolean DataScheme_Decode(struct dl_download *dl)
|
||||||
|
|
||||||
if (!dl->file)
|
if (!dl->file)
|
||||||
{
|
{
|
||||||
#ifndef NPFTE
|
|
||||||
if (*dl->localname)
|
if (*dl->localname)
|
||||||
{
|
{
|
||||||
FS_CreatePath(dl->localname, dl->fsroot);
|
FS_CreatePath(dl->localname, dl->fsroot);
|
||||||
|
@ -1235,7 +1128,6 @@ qboolean DataScheme_Decode(struct dl_download *dl)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
dl->file = FS_OpenTemp();
|
dl->file = FS_OpenTemp();
|
||||||
#endif
|
|
||||||
if (!dl->file)
|
if (!dl->file)
|
||||||
{
|
{
|
||||||
if (*dl->localname)
|
if (*dl->localname)
|
||||||
|
@ -1290,7 +1182,7 @@ qboolean DL_Decide(struct dl_download *dl)
|
||||||
#ifdef MULTITHREAD
|
#ifdef MULTITHREAD
|
||||||
static unsigned int dlthreads = 0;
|
static unsigned int dlthreads = 0;
|
||||||
#define MAXDOWNLOADTHREADS 4
|
#define MAXDOWNLOADTHREADS 4
|
||||||
#if defined(LOADERTHREAD) && !defined(NPFTE)
|
#if defined(LOADERTHREAD)
|
||||||
static void HTTP_Wake_Think(void *ctx, void *data, size_t a, size_t b)
|
static void HTTP_Wake_Think(void *ctx, void *data, size_t a, size_t b)
|
||||||
{
|
{
|
||||||
dlthreads--;
|
dlthreads--;
|
||||||
|
@ -1305,25 +1197,14 @@ static int DL_Thread_Work(void *arg)
|
||||||
{
|
{
|
||||||
if (!dl->poll(dl))
|
if (!dl->poll(dl))
|
||||||
{
|
{
|
||||||
#ifdef NPFTE
|
|
||||||
//the plugin doesn't have a download loop
|
|
||||||
if (dl->notifycomplete)
|
|
||||||
{
|
|
||||||
dl->notifycomplete(dl);
|
|
||||||
dl->notifycomplete = NULL;
|
|
||||||
}
|
|
||||||
if (dl->file)
|
|
||||||
VFS_CLOSE(dl->file);
|
|
||||||
#else
|
|
||||||
if (dl->status != DL_FAILED && dl->status != DL_FINISHED)
|
if (dl->status != DL_FAILED && dl->status != DL_FINISHED)
|
||||||
dl->status = DL_FAILED;
|
dl->status = DL_FAILED;
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dl->threadenable = false;
|
dl->threadenable = false;
|
||||||
|
|
||||||
#if defined(LOADERTHREAD) && !defined(NPFTE)
|
#if defined(LOADERTHREAD)
|
||||||
COM_AddWork(WG_MAIN, HTTP_Wake_Think, NULL, NULL, 0, 0);
|
COM_AddWork(WG_MAIN, HTTP_Wake_Think, NULL, NULL, 0, 0);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1345,7 +1226,7 @@ qboolean DL_CreateThread(struct dl_download *dl, vfsfile_t *file, void (*NotifyF
|
||||||
dl->notifycomplete = NotifyFunction;
|
dl->notifycomplete = NotifyFunction;
|
||||||
|
|
||||||
dl->threadenable = true;
|
dl->threadenable = true;
|
||||||
#if defined(LOADERTHREAD) && !defined(NPFTE)
|
#if defined(LOADERTHREAD)
|
||||||
if (dlthreads < 4)
|
if (dlthreads < 4)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
@ -1385,7 +1266,7 @@ struct dl_download *DL_Create(const char *url)
|
||||||
newdl->poll = DL_Decide;
|
newdl->poll = DL_Decide;
|
||||||
newdl->fsroot = FS_GAMEONLY;
|
newdl->fsroot = FS_GAMEONLY;
|
||||||
newdl->sizelimit = 0x80000000u; //some sanity limit.
|
newdl->sizelimit = 0x80000000u; //some sanity limit.
|
||||||
#if !defined(NPFTE) && !defined(SERVERONLY)
|
#if !defined(SERVERONLY)
|
||||||
newdl->qdownload.method = DL_HTTP;
|
newdl->qdownload.method = DL_HTTP;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1403,7 +1284,6 @@ void DL_Close(struct dl_download *dl)
|
||||||
{
|
{
|
||||||
struct dl_download **link = NULL;
|
struct dl_download **link = NULL;
|
||||||
|
|
||||||
#ifndef NPFTE
|
|
||||||
for (link = &activedownloads; *link; link = &(*link)->next)
|
for (link = &activedownloads; *link; link = &(*link)->next)
|
||||||
{
|
{
|
||||||
if (*link == dl)
|
if (*link == dl)
|
||||||
|
@ -1412,9 +1292,8 @@ void DL_Close(struct dl_download *dl)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(NPFTE) && !defined(SERVERONLY)
|
#if !defined(SERVERONLY)
|
||||||
if (cls.download == &dl->qdownload)
|
if (cls.download == &dl->qdownload)
|
||||||
cls.download = NULL;
|
cls.download = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1440,7 +1319,6 @@ void DL_Close(struct dl_download *dl)
|
||||||
free(dl);
|
free(dl);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NPFTE
|
|
||||||
void DL_DeThread(void)
|
void DL_DeThread(void)
|
||||||
{
|
{
|
||||||
#ifdef MULTITHREAD
|
#ifdef MULTITHREAD
|
||||||
|
@ -1639,7 +1517,6 @@ void HTTP_CL_Terminate(void)
|
||||||
Cookie_Monster();
|
Cookie_Monster();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#endif /*WEBCLIENT*/
|
#endif /*WEBCLIENT*/
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue