mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-13 05:11:01 +00:00
Legacy download code recieves more attention.
- Make all the I_Errors return false and print to the console instead. - New prints for missing files if you can't fit it all into one packet. - Make the startmessage warning less specific and direct you to the logfile, to accomodate all the different ways legacy downloads can fail.
This commit is contained in:
parent
5ab988dc3e
commit
a679e7a9e1
2 changed files with 36 additions and 15 deletions
|
@ -1335,8 +1335,10 @@ static inline void CL_DrawConnectionStatus(void)
|
||||||
strncpy(tempname, filename, sizeof(tempname)-1);
|
strncpy(tempname, filename, sizeof(tempname)-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-58-30, 0,
|
||||||
|
va(M_GetText("%s downloading"), ((cl_mode == CL_DOWNLOADHTTPFILES) ? "\x82""HTTP" : "\x85""Direct")));
|
||||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-58-22, V_YELLOWMAP,
|
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-58-22, V_YELLOWMAP,
|
||||||
va(M_GetText("Downloading \"%s\""), tempname));
|
va(M_GetText("\"%s\""), tempname));
|
||||||
V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-58, V_20TRANS|V_MONOSPACE,
|
V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-58, V_20TRANS|V_MONOSPACE,
|
||||||
va(" %4uK/%4uK",fileneeded[lastfilenum].currentsize>>10,file->totalsize>>10));
|
va(" %4uK/%4uK",fileneeded[lastfilenum].currentsize>>10,file->totalsize>>10));
|
||||||
V_DrawRightAlignedString(BASEVIDWIDTH/2+128, BASEVIDHEIGHT-58, V_20TRANS|V_MONOSPACE,
|
V_DrawRightAlignedString(BASEVIDWIDTH/2+128, BASEVIDHEIGHT-58, V_20TRANS|V_MONOSPACE,
|
||||||
|
@ -2483,9 +2485,8 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
|
||||||
CL_Reset();
|
CL_Reset();
|
||||||
D_StartTitle();
|
D_StartTitle();
|
||||||
M_StartMessage(M_GetText(
|
M_StartMessage(M_GetText(
|
||||||
"The legacy file downloader could not handle that many files.\n"
|
"The direct download encountered an error.\n"
|
||||||
"Ask the server host to set up a http source, or\n"
|
"See the logfile for more info.\n"
|
||||||
"locate and download the necessary files yourself.\n"
|
|
||||||
"\n"
|
"\n"
|
||||||
"Press ESC\n"
|
"Press ESC\n"
|
||||||
), NULL, MM_NOTHING);
|
), NULL, MM_NOTHING);
|
||||||
|
|
|
@ -300,7 +300,7 @@ boolean CL_CheckDownloadable(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// The following was written and then quickly deemed too fragile on paper to be worth testing.
|
// The following was written and then quickly deemed too fragile on paper to be worth testing.
|
||||||
//#DEFINE MORELEGACYDOWNLOADER
|
//#define MORELEGACYDOWNLOADER
|
||||||
|
|
||||||
/** Sends requests for files in the ::fileneeded table with a status of
|
/** Sends requests for files in the ::fileneeded table with a status of
|
||||||
* ::FS_NOTFOUND.
|
* ::FS_NOTFOUND.
|
||||||
|
@ -321,18 +321,21 @@ boolean CL_SendRequestFile(void)
|
||||||
|
|
||||||
#ifdef PARANOIA
|
#ifdef PARANOIA
|
||||||
if (M_CheckParm("-nodownload"))
|
if (M_CheckParm("-nodownload"))
|
||||||
I_Error("CL_SendRequestFile: Attempted to download files in -nodownload mode");
|
{
|
||||||
|
CONS_Printf("Direct download - Attempted to download files in -nodownload mode");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (i = 0; i < fileneedednum; i++)
|
for (i = 0; i < fileneedednum; i++)
|
||||||
{
|
{
|
||||||
#ifdef PARANOIA
|
|
||||||
if (fileneeded[i].status != FS_FOUND && fileneeded[i].status != FS_OPEN
|
if (fileneeded[i].status != FS_FOUND && fileneeded[i].status != FS_OPEN
|
||||||
&& (fileneeded[i].willsend == 0 || fileneeded[i].willsend == 2))
|
&& (fileneeded[i].willsend == 0 || fileneeded[i].willsend == 2))
|
||||||
{
|
{
|
||||||
I_Error("CL_SendRequestFile: Attempted to download files that were not sendable");
|
CONS_Printf("Direct download - attempted to download files that were not sendable\n");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if ((fileneeded[i].status == FS_NOTFOUND || fileneeded[i].status == FS_MD5SUMBAD || fileneeded[i].status == FS_FALLBACK))
|
if ((fileneeded[i].status == FS_NOTFOUND || fileneeded[i].status == FS_MD5SUMBAD || fileneeded[i].status == FS_FALLBACK))
|
||||||
{
|
{
|
||||||
// Error check for the first time around.
|
// Error check for the first time around.
|
||||||
|
@ -342,9 +345,13 @@ boolean CL_SendRequestFile(void)
|
||||||
|
|
||||||
I_GetDiskFreeSpace(&availablefreespace);
|
I_GetDiskFreeSpace(&availablefreespace);
|
||||||
if (totalfreespaceneeded > availablefreespace)
|
if (totalfreespaceneeded > availablefreespace)
|
||||||
I_Error("To play on this server you must download %s KB,\n"
|
{
|
||||||
|
CONS_Printf("Direct download -\n"
|
||||||
|
" To play on this server you must download %s KB,\n"
|
||||||
" but you have only %s KB free space on this drive\n",
|
" but you have only %s KB free space on this drive\n",
|
||||||
sizeu1((size_t)(totalfreespaceneeded>>10)), sizeu2((size_t)(availablefreespace>>10)));
|
sizeu1((size_t)(totalfreespaceneeded>>10)), sizeu2((size_t)(availablefreespace>>10)));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef MORELEGACYDOWNLOADER
|
#ifdef MORELEGACYDOWNLOADER
|
||||||
tryagain:
|
tryagain:
|
||||||
|
@ -386,20 +393,33 @@ tryagain:
|
||||||
#else
|
#else
|
||||||
// If we're not trying extralong legacy download requests, gotta bail.
|
// If we're not trying extralong legacy download requests, gotta bail.
|
||||||
if (skippedafile != -1)
|
if (skippedafile != -1)
|
||||||
|
{
|
||||||
|
#ifndef MORELEGACYDOWNLOADER
|
||||||
|
CONS_Printf("Direct download - missing files are as follows:\n");
|
||||||
|
for (i = 0; i < fileneedednum; i++)
|
||||||
|
{
|
||||||
|
if ((fileneeded[i].status == FS_NOTFOUND || fileneeded[i].status == FS_MD5SUMBAD || fileneeded[i].status == FS_FALLBACK || fileneeded[i].status == FS_REQUESTED)) // FS_REQUESTED added
|
||||||
|
CONS_Printf(" %s\n", fileneeded[i].filename);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return false;
|
return false;
|
||||||
else
|
}
|
||||||
#endif
|
#endif
|
||||||
I_mkdir(downloaddir, 0755);
|
I_mkdir(downloaddir, 0755);
|
||||||
|
|
||||||
#ifdef PARANOIA
|
|
||||||
// Couldn't fit a single one in?
|
// Couldn't fit a single one in?
|
||||||
if (p == (char *)netbuffer->u.textcmd)
|
if (p == (char *)netbuffer->u.textcmd)
|
||||||
I_Error("CL_SendRequestFile: Fileneeded name for %s (fileneeded[%d]) too long??", (p > 0 ? fileneeded[p].filename : NULL), p);
|
{
|
||||||
#endif
|
CONS_Printf("Direct download - fileneeded name for %s (fileneeded[%d]) too long??\n", (skippedafile != -1 ? fileneeded[skippedafile].filename : NULL), skippedafile);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
WRITEUINT8(p, 0xFF); // terminator
|
WRITEUINT8(p, 0xFF); // terminator
|
||||||
if (!HSendPacket(servernode, true, 0, p - (char *)netbuffer->u.textcmd))
|
if (!HSendPacket(servernode, true, 0, p - (char *)netbuffer->u.textcmd))
|
||||||
|
{
|
||||||
|
CONS_Printf("Direct download - unable to send packet.\n");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef MORELEGACYDOWNLOADER
|
#ifdef MORELEGACYDOWNLOADER
|
||||||
if (skippedafile != -1)
|
if (skippedafile != -1)
|
||||||
|
|
Loading…
Reference in a new issue