mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-02-24 21:01:48 +00:00
Merge branch 'master' into minor-net-command-fixes
This commit is contained in:
commit
0ff5b851cd
4 changed files with 44 additions and 21 deletions
|
@ -842,8 +842,9 @@ boolean CON_Responder(event_t *ev)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't eat the key
|
// ...why shouldn't it eat the key? if it doesn't, it just means you
|
||||||
return false;
|
// can control Sonic from the console, which is silly
|
||||||
|
return true; //return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// command completion forward (tab) and backward (shift-tab)
|
// command completion forward (tab) and backward (shift-tab)
|
||||||
|
@ -1042,7 +1043,7 @@ boolean CON_Responder(event_t *ev)
|
||||||
|
|
||||||
// enter a char into the command prompt
|
// enter a char into the command prompt
|
||||||
if (key < 32 || key > 127)
|
if (key < 32 || key > 127)
|
||||||
return false;
|
return true; // even if key can't be printed, eat it anyway
|
||||||
|
|
||||||
// add key to cmd line here
|
// add key to cmd line here
|
||||||
if (key >= 'A' && key <= 'Z' && !shiftdown) //this is only really necessary for dedicated servers
|
if (key >= 'A' && key <= 'Z' && !shiftdown) //this is only really necessary for dedicated servers
|
||||||
|
|
|
@ -1156,22 +1156,37 @@ static inline void CL_DrawConnectionStatus(void)
|
||||||
if (lastfilenum != -1)
|
if (lastfilenum != -1)
|
||||||
{
|
{
|
||||||
INT32 dldlength;
|
INT32 dldlength;
|
||||||
static char tempname[32];
|
static char tempname[28];
|
||||||
|
fileneeded_t *file = &fileneeded[lastfilenum];
|
||||||
|
char *filename = file->filename;
|
||||||
|
|
||||||
Net_GetNetStat();
|
Net_GetNetStat();
|
||||||
dldlength = (INT32)((fileneeded[lastfilenum].currentsize/(double)fileneeded[lastfilenum].totalsize) * 256);
|
dldlength = (INT32)((file->currentsize/(double)file->totalsize) * 256);
|
||||||
if (dldlength > 256)
|
if (dldlength > 256)
|
||||||
dldlength = 256;
|
dldlength = 256;
|
||||||
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, 256, 8, 175);
|
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, 256, 8, 175);
|
||||||
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, dldlength, 8, 160);
|
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, dldlength, 8, 160);
|
||||||
|
|
||||||
memset(tempname, 0, sizeof(tempname));
|
memset(tempname, 0, sizeof(tempname));
|
||||||
nameonly(strncpy(tempname, fileneeded[lastfilenum].filename, 31));
|
// offset filename to just the name only part
|
||||||
|
filename += strlen(filename) - nameonlylength(filename);
|
||||||
|
|
||||||
|
if (strlen(filename) > sizeof(tempname)-1) // too long to display fully
|
||||||
|
{
|
||||||
|
size_t endhalfpos = strlen(filename)-10;
|
||||||
|
// display as first 14 chars + ... + last 10 chars
|
||||||
|
// which should add up to 27 if our math(s) is correct
|
||||||
|
snprintf(tempname, sizeof(tempname), "%.14s...%.10s", filename, filename+endhalfpos);
|
||||||
|
}
|
||||||
|
else // we can copy the whole thing in safely
|
||||||
|
{
|
||||||
|
strncpy(tempname, filename, sizeof(tempname)-1);
|
||||||
|
}
|
||||||
|
|
||||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-32, V_YELLOWMAP,
|
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24-32, V_YELLOWMAP,
|
||||||
va(M_GetText("Downloading \"%s\""), tempname));
|
va(M_GetText("Downloading \"%s\""), tempname));
|
||||||
V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE,
|
V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE,
|
||||||
va(" %4uK/%4uK",fileneeded[lastfilenum].currentsize>>10,fileneeded[lastfilenum].totalsize>>10));
|
va(" %4uK/%4uK",fileneeded[lastfilenum].currentsize>>10,file->totalsize>>10));
|
||||||
V_DrawRightAlignedString(BASEVIDWIDTH/2+128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE,
|
V_DrawRightAlignedString(BASEVIDWIDTH/2+128, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE,
|
||||||
va("%3.1fK/s ", ((double)getbps)/1024));
|
va("%3.1fK/s ", ((double)getbps)/1024));
|
||||||
}
|
}
|
||||||
|
|
|
@ -478,10 +478,10 @@ static const struct {
|
||||||
{NULL, ARCH_NULL}
|
{NULL, ARCH_NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
static UINT8 GetUserdataArchType(void)
|
static UINT8 GetUserdataArchType(int index)
|
||||||
{
|
{
|
||||||
UINT8 i;
|
UINT8 i;
|
||||||
lua_getmetatable(gL, -1);
|
lua_getmetatable(gL, index);
|
||||||
|
|
||||||
for (i = 0; meta2arch[i].meta; i++)
|
for (i = 0; meta2arch[i].meta; i++)
|
||||||
{
|
{
|
||||||
|
@ -560,7 +560,7 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LUA_TUSERDATA:
|
case LUA_TUSERDATA:
|
||||||
switch (GetUserdataArchType())
|
switch (GetUserdataArchType(myindex))
|
||||||
{
|
{
|
||||||
case ARCH_MOBJINFO:
|
case ARCH_MOBJINFO:
|
||||||
{
|
{
|
||||||
|
@ -777,6 +777,7 @@ static void ArchiveTables(void)
|
||||||
CONS_Alert(CONS_ERROR, "Type of value for table %d entry '%s' (%s) could not be archived!\n", i, lua_tostring(gL, -1), luaL_typename(gL, -1));
|
CONS_Alert(CONS_ERROR, "Type of value for table %d entry '%s' (%s) could not be archived!\n", i, lua_tostring(gL, -1), luaL_typename(gL, -1));
|
||||||
lua_pop(gL, 1);
|
lua_pop(gL, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
lua_pop(gL, 1);
|
lua_pop(gL, 1);
|
||||||
}
|
}
|
||||||
lua_pop(gL, 1);
|
lua_pop(gL, 1);
|
||||||
|
|
|
@ -2709,7 +2709,7 @@ const char *I_LocateWad(void)
|
||||||
return waddir;
|
return waddir;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(LINUX) || defined(LINUX64)
|
#ifdef __linux__
|
||||||
#define MEMINFO_FILE "/proc/meminfo"
|
#define MEMINFO_FILE "/proc/meminfo"
|
||||||
#define MEMTOTAL "MemTotal:"
|
#define MEMTOTAL "MemTotal:"
|
||||||
#define MEMFREE "MemFree:"
|
#define MEMFREE "MemFree:"
|
||||||
|
@ -2729,20 +2729,23 @@ UINT32 I_GetFreeMem(UINT32 *total)
|
||||||
};
|
};
|
||||||
if ((kd = kvm_open(NULL, NULL, NULL, O_RDONLY, "kvm_open")) == NULL)
|
if ((kd = kvm_open(NULL, NULL, NULL, O_RDONLY, "kvm_open")) == NULL)
|
||||||
{
|
{
|
||||||
*total = 0L;
|
if (total)
|
||||||
|
*total = 0L;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (kvm_nlist(kd, namelist) != 0)
|
if (kvm_nlist(kd, namelist) != 0)
|
||||||
{
|
{
|
||||||
kvm_close (kd);
|
kvm_close (kd);
|
||||||
*total = 0L;
|
if (total)
|
||||||
|
*total = 0L;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (kvm_read(kd, namelist[X_SUM].n_value, &sum,
|
if (kvm_read(kd, namelist[X_SUM].n_value, &sum,
|
||||||
sizeof (sum)) != sizeof (sum))
|
sizeof (sum)) != sizeof (sum))
|
||||||
{
|
{
|
||||||
kvm_close(kd);
|
kvm_close(kd);
|
||||||
*total = 0L;
|
if (total)
|
||||||
|
*total = 0L;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
kvm_close(kd);
|
kvm_close(kd);
|
||||||
|
@ -2773,7 +2776,7 @@ UINT32 I_GetFreeMem(UINT32 *total)
|
||||||
(PVOID) &pr_arena, sizeof (UINT32));
|
(PVOID) &pr_arena, sizeof (UINT32));
|
||||||
|
|
||||||
return pr_arena;
|
return pr_arena;
|
||||||
#elif defined (LINUX) || defined (LINUX64)
|
#elif defined (__linux__)
|
||||||
/* Linux */
|
/* Linux */
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
char *memTag;
|
char *memTag;
|
||||||
|
@ -2789,25 +2792,28 @@ UINT32 I_GetFreeMem(UINT32 *total)
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
{
|
{
|
||||||
// Error
|
// Error
|
||||||
*total = 0L;
|
if (total)
|
||||||
|
*total = 0L;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf[n] = '\0';
|
buf[n] = '\0';
|
||||||
if (NULL == (memTag = strstr(buf, MEMTOTAL)))
|
if ((memTag = strstr(buf, MEMTOTAL)) == NULL)
|
||||||
{
|
{
|
||||||
// Error
|
// Error
|
||||||
*total = 0L;
|
if (total)
|
||||||
|
*total = 0L;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
memTag += sizeof (MEMTOTAL);
|
memTag += sizeof (MEMTOTAL);
|
||||||
totalKBytes = atoi(memTag);
|
totalKBytes = atoi(memTag);
|
||||||
|
|
||||||
if (NULL == (memTag = strstr(buf, MEMFREE)))
|
if ((memTag = strstr(buf, MEMFREE)) == NULL)
|
||||||
{
|
{
|
||||||
// Error
|
// Error
|
||||||
*total = 0L;
|
if (total)
|
||||||
|
*total = 0L;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2822,7 +2828,7 @@ UINT32 I_GetFreeMem(UINT32 *total)
|
||||||
if (total)
|
if (total)
|
||||||
*total = 48<<20;
|
*total = 48<<20;
|
||||||
return 48<<20;
|
return 48<<20;
|
||||||
#endif /* LINUX */
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
const CPUInfoFlags *I_CPUInfo(void)
|
const CPUInfoFlags *I_CPUInfo(void)
|
||||||
|
|
Loading…
Reference in a new issue