fix vector arrays.
try to fix some misc issues. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4872 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
31506617f0
commit
03919e0dd4
17 changed files with 199 additions and 155 deletions
|
@ -137,8 +137,6 @@ void IN_DeviceIDs_Enumerate(void *ctx, char *type, char *devicename, int *qdevid
|
|||
|
||||
void IN_DeviceIDs_f(void)
|
||||
{
|
||||
int i;
|
||||
char *s;
|
||||
struct remapctx ctx;
|
||||
|
||||
if (Cmd_Argc() > 3)
|
||||
|
|
|
@ -4891,6 +4891,7 @@ static struct {
|
|||
{"bound", PF_bound, 96}, // #96 float(float minimum, float val, float maximum) bound (DP_QC_MINMAXBOUND)
|
||||
{"pow", PF_pow, 97}, // #97 float(float value) pow (DP_QC_SINCOSSQRTPOW)
|
||||
{"findfloat", PF_FindFloat, 98}, // #98 entity(entity start, .float fld, float match) findfloat (DP_QC_FINDFLOAT)
|
||||
{"findentity", PF_FindFloat, 98}, // #98 entity(entity start, .float fld, float match) findfloat (DP_QC_FINDFLOAT)
|
||||
{"checkextension", PF_checkextension, 99}, // #99 float(string extname) checkextension (EXT_CSQC)
|
||||
{"anglemod", PF_anglemod, 102},
|
||||
|
||||
|
|
|
@ -1848,6 +1848,7 @@ static struct {
|
|||
{"remove", PF_Remove_, 23},
|
||||
{"find", PF_FindString, 24},
|
||||
{"findfloat", PF_FindFloat, 25},
|
||||
{"findentity", PF_FindFloat, 25},
|
||||
{"findchain", PF_menu_findchain, 26},
|
||||
{"findchainfloat", PF_menu_findchainfloat, 27},
|
||||
{"precache_file", PF_CL_precache_file, 28},
|
||||
|
|
|
@ -714,7 +714,6 @@ qboolean R2D_Font_WasAdded(char *buffer, char *fontfilename)
|
|||
return true;
|
||||
}
|
||||
extern qboolean WinNT;
|
||||
qboolean MyRegGetStringValueMultiSz(HKEY base, char *keyname, char *valuename, void *data, int datalen);
|
||||
void R2D_Font_AddFontLink(char *buffer, int buffersize, char *fontname)
|
||||
{
|
||||
char link[1024];
|
||||
|
|
|
@ -71,6 +71,7 @@ int sys_parenttop;
|
|||
int sys_parentwidth;
|
||||
int sys_parentheight;
|
||||
long sys_parentwindow;
|
||||
qboolean sys_gracefulexit;
|
||||
|
||||
qboolean X11_GetDesktopParameters(int *width, int *height, int *bpp, int *refreshrate);
|
||||
|
||||
|
@ -625,6 +626,7 @@ static void Friendly_Crash_Handler(int sig, siginfo_t *info, void *vcontext)
|
|||
|
||||
switch(sig)
|
||||
{
|
||||
case SIGINT: strcpy(signame, "SIGINT"); break;
|
||||
case SIGILL: strcpy(signame, "SIGILL"); break;
|
||||
case SIGFPE: strcpy(signame, "SIGFPE"); break;
|
||||
case SIGBUS: strcpy(signame, "SIGBUS"); break;
|
||||
|
@ -649,6 +651,9 @@ static void Friendly_Crash_Handler(int sig, siginfo_t *info, void *vcontext)
|
|||
fprintf(stderr, "Error: signal %s:\n", signame);
|
||||
backtrace_symbols_fd(array+firstframe, size-firstframe, 2);
|
||||
|
||||
if (sig == SIGINT)
|
||||
fd = -1; //don't write out crash logs on ctrl+c
|
||||
else
|
||||
fd = open("crash.log", O_WRONLY|O_CREAT|O_APPEND, S_IRUSR | S_IWUSR | S_IRGRP);
|
||||
if (fd != -1)
|
||||
{
|
||||
|
@ -765,6 +770,7 @@ int main (int c, const char **v)
|
|||
sigaction(SIGILL, &act, NULL);
|
||||
sigaction(SIGSEGV, &act, NULL);
|
||||
sigaction(SIGBUS, &act, NULL);
|
||||
sigaction(SIGINT, &act, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -596,7 +596,7 @@ qboolean MyRegGetStringValue(HKEY base, const char *keyname, const char *valuena
|
|||
return result;
|
||||
}
|
||||
|
||||
void MyRegSetValue(HKEY base, char *keyname, char *valuename, int type, void *data, DWORD datalen)
|
||||
qboolean MyRegSetValue(void *base, const char *keyname, const char *valuename, int type, const void *data, int datalen)
|
||||
{
|
||||
HKEY subkey;
|
||||
if (RegCreateKeyEx(base, keyname, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &subkey, NULL) == ERROR_SUCCESS)
|
||||
|
@ -604,8 +604,9 @@ void MyRegSetValue(HKEY base, char *keyname, char *valuename, int type, void *da
|
|||
RegSetValueEx(subkey, valuename, 0, type, data, datalen);
|
||||
RegCloseKey (subkey);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
void MyRegDeleteKeyValue(HKEY base, char *keyname, char *valuename)
|
||||
void MyRegDeleteKeyValue(void *base, const char *keyname, const char *valuename)
|
||||
{
|
||||
HKEY subkey;
|
||||
if (RegOpenKeyEx(base, keyname, 0, KEY_WRITE, &subkey) == ERROR_SUCCESS)
|
||||
|
|
|
@ -2507,6 +2507,7 @@ void Win7_TaskListInit(void)
|
|||
}
|
||||
}
|
||||
|
||||
//#define SVNREVISION 1
|
||||
#if defined(SVNREVISION) && !defined(MINIMAL)
|
||||
#define SVNREVISIONSTR STRINGIFY(SVNREVISION)
|
||||
#if defined(OFFICIAL_RELEASE)
|
||||
|
@ -2546,126 +2547,26 @@ void Win7_TaskListInit(void)
|
|||
#define EXETYPE "qw"
|
||||
#endif
|
||||
|
||||
|
||||
int MyRegGetIntValue(HKEY base, char *keyname, char *valuename, int defaultval)
|
||||
{
|
||||
int result = defaultval;
|
||||
DWORD datalen = sizeof(result);
|
||||
HKEY subkey;
|
||||
DWORD type = REG_NONE;
|
||||
wchar_t wide[MAX_PATH];
|
||||
if (RegOpenKeyExW(base, widen(wide, sizeof(wide), keyname), 0, KEY_READ, &subkey) == ERROR_SUCCESS)
|
||||
{
|
||||
if (ERROR_SUCCESS != RegQueryValueExW(subkey, widen(wide, sizeof(wide), valuename), NULL, &type, (void*)&result, &datalen) || type != REG_DWORD)
|
||||
result = defaultval;
|
||||
RegCloseKey (subkey);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
//result is utf-8
|
||||
qboolean MyRegGetStringValue(HKEY base, const char *keyname, const char *valuename, void *data, size_t datalen)
|
||||
{
|
||||
qboolean result = false;
|
||||
HKEY subkey;
|
||||
DWORD type = REG_NONE;
|
||||
wchar_t wide[MAX_PATH];
|
||||
wchar_t wdata[MAX_PATH];
|
||||
DWORD dwlen = sizeof(wdata) - sizeof(wdata[0]);
|
||||
if (RegOpenKeyExW(base, widen(wide, sizeof(wide), keyname), 0, KEY_READ, &subkey) == ERROR_SUCCESS)
|
||||
{
|
||||
result = ERROR_SUCCESS == RegQueryValueExW(subkey, widen(wide, sizeof(wide), valuename), NULL, &type, (BYTE*)wdata, &dwlen);
|
||||
RegCloseKey (subkey);
|
||||
}
|
||||
|
||||
if (result && (type == REG_SZ || type == REG_EXPAND_SZ))
|
||||
{
|
||||
wdata[dwlen/sizeof(wchar_t)] = 0;
|
||||
narrowen(data, datalen, wdata);
|
||||
}
|
||||
else
|
||||
((char*)data)[0] = 0;
|
||||
return result;
|
||||
}
|
||||
qboolean MyRegGetStringValueMultiSz(HKEY base, char *keyname, char *valuename, void *data, int datalen)
|
||||
{
|
||||
qboolean result = false;
|
||||
HKEY subkey;
|
||||
DWORD type = REG_NONE;
|
||||
if (RegOpenKeyEx(base, keyname, 0, KEY_READ, &subkey) == ERROR_SUCCESS)
|
||||
{
|
||||
DWORD dwlen = datalen;
|
||||
result = ERROR_SUCCESS == RegQueryValueEx(subkey, valuename, NULL, &type, data, &dwlen);
|
||||
datalen = dwlen;
|
||||
RegCloseKey (subkey);
|
||||
}
|
||||
|
||||
if (type == REG_MULTI_SZ)
|
||||
return result;
|
||||
return false;
|
||||
}
|
||||
|
||||
qboolean MyRegSetValue(HKEY base, char *keyname, char *valuename, int type, void *data, int datalen)
|
||||
{
|
||||
qboolean result = false;
|
||||
HKEY subkey;
|
||||
|
||||
//'trivially' return success if its already set.
|
||||
//this allows success even when we don't have write access.
|
||||
if (RegOpenKeyEx(base, keyname, 0, KEY_READ, &subkey) == ERROR_SUCCESS)
|
||||
{
|
||||
DWORD oldtype;
|
||||
char olddata[2048];
|
||||
DWORD olddatalen = sizeof(olddata);
|
||||
result = ERROR_SUCCESS == RegQueryValueEx(subkey, valuename, NULL, &oldtype, olddata, &olddatalen);
|
||||
RegCloseKey (subkey);
|
||||
|
||||
if (oldtype == REG_SZ || oldtype == REG_EXPAND_SZ)
|
||||
{
|
||||
while(olddatalen > 0 && olddata[olddatalen-1] == 0)
|
||||
olddatalen--;
|
||||
}
|
||||
|
||||
if (result && datalen == olddatalen && type == oldtype && !memcmp(data, olddata, datalen))
|
||||
return result;
|
||||
result = false;
|
||||
}
|
||||
|
||||
if (RegCreateKeyEx(base, keyname, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &subkey, NULL) == ERROR_SUCCESS)
|
||||
{
|
||||
if (ERROR_SUCCESS == RegSetValueEx(subkey, valuename, 0, type, data, datalen))
|
||||
result = true;
|
||||
RegCloseKey (subkey);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
void MyRegDeleteKeyValue(HKEY base, char *keyname, char *valuename)
|
||||
{
|
||||
HKEY subkey;
|
||||
if (RegOpenKeyEx(base, keyname, 0, KEY_WRITE, &subkey) == ERROR_SUCCESS)
|
||||
{
|
||||
RegDeleteValue(subkey, valuename);
|
||||
RegCloseKey (subkey);
|
||||
}
|
||||
}
|
||||
#ifdef UPDATE_URL_ROOT
|
||||
|
||||
int sys_autoupdatesetting;
|
||||
|
||||
qboolean Update_GetHomeDirectory(char *homedir, int homedirsize)
|
||||
{
|
||||
HMODULE shfolder = LoadLibrary("shfolder.dll");
|
||||
HMODULE shfolder = LoadLibraryA("shfolder.dll");
|
||||
|
||||
if (shfolder)
|
||||
{
|
||||
HRESULT (WINAPI *dSHGetFolderPath) (HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPTSTR pszPath);
|
||||
dSHGetFolderPath = (void *)GetProcAddress(shfolder, "SHGetFolderPathA");
|
||||
if (dSHGetFolderPath)
|
||||
HRESULT (WINAPI *dSHGetFolderPathW) (HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath);
|
||||
dSHGetFolderPathW = (void *)GetProcAddress(shfolder, "SHGetFolderPathW");
|
||||
if (dSHGetFolderPathW)
|
||||
{
|
||||
char folder[MAX_PATH];
|
||||
wchar_t folderw[MAX_PATH];
|
||||
// 0x5 == CSIDL_PERSONAL
|
||||
if (dSHGetFolderPath(NULL, 0x5, NULL, 0, folder) == S_OK)
|
||||
if (dSHGetFolderPathW(NULL, 0x5, NULL, 0, folderw) == S_OK)
|
||||
{
|
||||
Q_snprintfz(homedir, homedirsize, "%s/My Games/%s/", folder, FULLENGINENAME);
|
||||
narrowen(homedir, homedirsize, folderw);
|
||||
Q_strncatz(homedir, "/My Games/"FULLENGINENAME"/", homedirsize);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -2695,7 +2596,10 @@ void Update_PromptedDownloaded(void *ctx, int foo)
|
|||
if (foo == 0 && ctx)
|
||||
{
|
||||
PROCESS_INFORMATION childinfo;
|
||||
STARTUPINFO startinfo = {sizeof(startinfo)};
|
||||
STARTUPINFOW startinfo = {sizeof(startinfo)};
|
||||
wchar_t widearg[2048];
|
||||
wchar_t wideexe[2048];
|
||||
char cmdline[2048];
|
||||
|
||||
#ifndef SERVERONLY
|
||||
SetHookState(false);
|
||||
|
@ -2707,7 +2611,11 @@ void Update_PromptedDownloaded(void *ctx, int foo)
|
|||
#endif
|
||||
TL_Shutdown();
|
||||
|
||||
CreateProcess(ctx, va("\"%s\" %s", (char*)ctx, COM_Parse(GetCommandLineA())), NULL, NULL, TRUE, 0, NULL, NULL, &startinfo, &childinfo);
|
||||
narrowen(cmdline, sizeof(cmdline), GetCommandLineW());
|
||||
widen(wideexe, sizeof(wideexe), ctx);
|
||||
widen(widearg, sizeof(widearg), va("\"%s\" %s", ctx, COM_Parse(cmdline)));
|
||||
|
||||
CreateProcessW(wideexe, widearg, NULL, NULL, TRUE, 0, NULL, NULL, &startinfo, &childinfo);
|
||||
Z_Free(ctx);
|
||||
exit(1);
|
||||
}
|
||||
|
@ -2749,10 +2657,12 @@ void Update_Version_Updated(struct dl_download *dl)
|
|||
//figure out the original binary that was executed, so we can start from scratch.
|
||||
//this is to attempt to avoid the new process appearing as 'foo.tmp'. which needlessly confuses firewall rules etc.
|
||||
int ffe = COM_CheckParm("--fromfrontend");
|
||||
char binarypath[MAX_PATH];
|
||||
wchar_t wbinarypath[MAX_PATH];
|
||||
char ubinarypath[MAX_PATH];
|
||||
char *ffp;
|
||||
GetModuleFileName(NULL, binarypath, sizeof(binarypath)-1);
|
||||
ffp = Z_StrDup(ffe?com_argv[ffe+2]:binarypath);
|
||||
GetModuleFileNameW(NULL, wbinarypath, countof(wbinarypath)-1);
|
||||
narrowen(ubinarypath, sizeof(ubinarypath), wbinarypath);
|
||||
ffp = Z_StrDup(ffe?com_argv[ffe+2]:ubinarypath);
|
||||
|
||||
//make it pending
|
||||
MyRegSetValue(HKEY_CURRENT_USER, "Software\\"FULLENGINENAME, "pending" UPD_BUILDTYPE EXETYPE, REG_SZ, pendingname, strlen(pendingname)+1);
|
||||
|
@ -2772,7 +2682,7 @@ void Update_PromptedForUpdate(void *ctx, int foo)
|
|||
{
|
||||
struct dl_download *dl;
|
||||
Con_Printf("Downloading update\n");
|
||||
dl = HTTP_CL_Get(va(UPDATE_URL_BUILD, ctx), NULL, Update_Version_Updated);
|
||||
dl = HTTP_CL_Get(va(UPDATE_URL_BUILD, (char*)ctx), NULL, Update_Version_Updated);
|
||||
dl->file = FS_OpenTemp();
|
||||
#ifdef MULTITHREAD
|
||||
DL_CreateThread(dl, NULL, NULL);
|
||||
|
@ -2852,6 +2762,18 @@ void Sys_SetAutoUpdateSetting(int newval)
|
|||
Update_Check();
|
||||
}
|
||||
|
||||
BOOL DeleteFileU(const char *path)
|
||||
{
|
||||
wchar_t wide[2048];
|
||||
return DeleteFileW(widen(wide, sizeof(wide), path));
|
||||
}
|
||||
BOOL MoveFileU(const char *src, const char *dst)
|
||||
{
|
||||
wchar_t wide1[2048];
|
||||
wchar_t wide2[2048];
|
||||
return MoveFileW(widen(wide1, sizeof(wide1), src), widen(wide2, sizeof(wide2), dst));
|
||||
}
|
||||
|
||||
qboolean Sys_CheckUpdated(char *bindir, size_t bindirsize)
|
||||
{
|
||||
int ffe = COM_CheckParm("--fromfrontend");
|
||||
|
@ -2896,20 +2818,20 @@ qboolean Sys_CheckUpdated(char *bindir, size_t bindirsize)
|
|||
Update_GetHomeDirectory(updatedpath, sizeof(updatedpath));
|
||||
Update_CreatePath(updatedpath);
|
||||
Q_strncatz(updatedpath, "cur" UPD_BUILDTYPE EXETYPE".exe", sizeof(updatedpath));
|
||||
DeleteFile(updatedpath);
|
||||
okay = MoveFile(pendingpath, updatedpath);
|
||||
DeleteFileU(updatedpath);
|
||||
okay = MoveFileU(pendingpath, updatedpath);
|
||||
if (!okay)
|
||||
{ //if we just downloaded an update, we may need to wait for the existing process to close.
|
||||
//sadly I'm too lazy to provide any sync mechanism (and wouldn't trust any auto-released handles or whatever), so lets just retry after a delay.
|
||||
Sleep(2000);
|
||||
okay = MoveFile(pendingpath, updatedpath);
|
||||
okay = MoveFileU(pendingpath, updatedpath);
|
||||
}
|
||||
if (okay)
|
||||
MyRegSetValue(HKEY_CURRENT_USER, "Software\\"FULLENGINENAME, UPD_BUILDTYPE EXETYPE, REG_SZ, updatedpath, strlen(updatedpath)+1);
|
||||
else
|
||||
{
|
||||
MessageBox(NULL, va("Unable to rename %s to %s", pendingpath, updatedpath), FULLENGINENAME" autoupdate", 0);
|
||||
DeleteFile(pendingpath);
|
||||
DeleteFileU(pendingpath);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3381,7 +3303,7 @@ void FS_Directorize(char *fname, size_t fnamesize)
|
|||
size_t l = strlen(fname);
|
||||
if (!l) //technically already a directory
|
||||
return;
|
||||
if (fname[l-1] == '\\' || fname[l-1] == '//')
|
||||
if (fname[l-1] == '\\' || fname[l-1] == '/')
|
||||
return; //already a directory
|
||||
Q_strncatz(fname, "/", fnamesize);
|
||||
}
|
||||
|
|
|
@ -465,7 +465,11 @@ char *narrowen(char *out, size_t outlen, wchar_t *wide);
|
|||
wchar_t *widen(wchar_t *out, size_t outbytes, const char *utf8);
|
||||
#define __L(x) L ## x
|
||||
#define _L(x) __L(x)
|
||||
qboolean MyRegGetStringValue(void *hkey_base, const char *keyname, const char *valuename, void *data, size_t datalen);
|
||||
int MyRegGetIntValue(void *base, const char *keyname, const char *valuename, int defaultval);
|
||||
qboolean MyRegGetStringValue(void *base, const char *keyname, const char *valuename, void *data, size_t datalen); //data is utf8
|
||||
qboolean MyRegGetStringValueMultiSz(void *base, const char *keyname, const char *valuename, void *data, int datalen);
|
||||
qboolean MyRegSetValue(void *base, const char *keyname, const char *valuename, int type, const void *data, int datalen); //string values are utf8
|
||||
void MyRegDeleteKeyValue(void *base, const char *keyname, const char *valuename);
|
||||
#endif
|
||||
|
||||
void FS_UnloadPackFiles(void);
|
||||
|
|
|
@ -341,7 +341,7 @@ static qboolean FS_Manifest_ParsePackage(ftemanifest_t *man, int type, char *pat
|
|||
{
|
||||
if (!strchr(path, '/') || strchr(path, ':') || strchr(path, '\\'))
|
||||
{
|
||||
Con_Printf("invalid package path specified in manifest\n");
|
||||
Con_Printf("invalid package path specified in manifest (%s)\n", path);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
#include "fs.h"
|
||||
#include "winquake.h"
|
||||
|
||||
//FIXME: find somewhere better for this win32 utility code.
|
||||
//(its here instead of sys_win.c because dedicated servers don't use sys_win.c)
|
||||
|
||||
//outlen is the size of out in _BYTES_.
|
||||
wchar_t *widen(wchar_t *out, size_t outbytes, const char *utf8)
|
||||
{
|
||||
|
@ -72,6 +75,119 @@ char *narrowen(char *out, size_t outlen, wchar_t *wide)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int MyRegGetIntValue(void *base, const char *keyname, const char *valuename, int defaultval)
|
||||
{
|
||||
int result = defaultval;
|
||||
DWORD datalen = sizeof(result);
|
||||
HKEY subkey;
|
||||
DWORD type = REG_NONE;
|
||||
wchar_t wide[MAX_PATH];
|
||||
if (RegOpenKeyExW(base, widen(wide, sizeof(wide), keyname), 0, KEY_READ, &subkey) == ERROR_SUCCESS)
|
||||
{
|
||||
if (ERROR_SUCCESS != RegQueryValueExW(subkey, widen(wide, sizeof(wide), valuename), NULL, &type, (void*)&result, &datalen) || type != REG_DWORD)
|
||||
result = defaultval;
|
||||
RegCloseKey (subkey);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
//result is utf-8
|
||||
qboolean MyRegGetStringValue(void *base, const char *keyname, const char *valuename, void *data, size_t datalen)
|
||||
{
|
||||
qboolean result = false;
|
||||
HKEY subkey;
|
||||
DWORD type = REG_NONE;
|
||||
wchar_t wide[MAX_PATH];
|
||||
wchar_t wdata[2048];
|
||||
DWORD dwlen = sizeof(wdata) - sizeof(wdata[0]);
|
||||
if (RegOpenKeyExW(base, widen(wide, sizeof(wide), keyname), 0, KEY_READ, &subkey) == ERROR_SUCCESS)
|
||||
{
|
||||
result = ERROR_SUCCESS == RegQueryValueExW(subkey, widen(wide, sizeof(wide), valuename), NULL, &type, (BYTE*)wdata, &dwlen);
|
||||
RegCloseKey (subkey);
|
||||
}
|
||||
|
||||
if (result && (type == REG_SZ || type == REG_EXPAND_SZ))
|
||||
{
|
||||
wdata[dwlen/sizeof(wchar_t)] = 0;
|
||||
narrowen(data, datalen, wdata);
|
||||
}
|
||||
else
|
||||
((char*)data)[0] = 0;
|
||||
return result;
|
||||
}
|
||||
qboolean MyRegGetStringValueMultiSz(HKEY base, const char *keyname, const char *valuename, void *data, int datalen)
|
||||
{
|
||||
qboolean result = false;
|
||||
HKEY subkey;
|
||||
wchar_t wide[MAX_PATH];
|
||||
DWORD type = REG_NONE;
|
||||
if (RegOpenKeyExW(base, widen(wide, sizeof(wide), keyname), 0, KEY_READ, &subkey) == ERROR_SUCCESS)
|
||||
{
|
||||
DWORD dwlen = datalen;
|
||||
result = ERROR_SUCCESS == RegQueryValueEx(subkey, valuename, NULL, &type, data, &dwlen);
|
||||
datalen = dwlen;
|
||||
RegCloseKey (subkey);
|
||||
}
|
||||
|
||||
if (type == REG_MULTI_SZ)
|
||||
return result;
|
||||
return false;
|
||||
}
|
||||
|
||||
qboolean MyRegSetValue(void *base, const char *keyname, const char *valuename, int type, const void *data, int datalen)
|
||||
{
|
||||
qboolean result = false;
|
||||
HKEY subkey;
|
||||
wchar_t wide[MAX_PATH];
|
||||
wchar_t wided[2048];
|
||||
|
||||
if (type == REG_SZ)
|
||||
{
|
||||
data = widen(wided, sizeof(wided), data);
|
||||
datalen = wcslen(wided)*2;
|
||||
}
|
||||
|
||||
//'trivially' return success if its already set.
|
||||
//this allows success even when we don't have write access.
|
||||
if (RegOpenKeyExW(base, widen(wide, sizeof(wide), keyname), 0, KEY_READ, &subkey) == ERROR_SUCCESS)
|
||||
{
|
||||
DWORD oldtype;
|
||||
char olddata[2048];
|
||||
DWORD olddatalen = sizeof(olddata);
|
||||
result = ERROR_SUCCESS == RegQueryValueExW(subkey, widen(wide, sizeof(wide), valuename), NULL, &oldtype, olddata, &olddatalen);
|
||||
RegCloseKey (subkey);
|
||||
|
||||
if (oldtype == REG_SZ || oldtype == REG_EXPAND_SZ)
|
||||
{ //ignore any null terminators that may have come along for the ride
|
||||
while(olddatalen > 1 && olddata[olddatalen-2] && olddata[olddatalen-1] == 0)
|
||||
olddatalen-=2;
|
||||
}
|
||||
|
||||
if (result && datalen == olddatalen && type == oldtype && !memcmp(data, olddata, datalen))
|
||||
return result;
|
||||
result = false;
|
||||
}
|
||||
|
||||
if (RegCreateKeyExW(base, widen(wide, sizeof(wide), keyname), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &subkey, NULL) == ERROR_SUCCESS)
|
||||
{
|
||||
result = ERROR_SUCCESS == RegSetValueExW(subkey, widen(wide, sizeof(wide), valuename), 0, type, data, datalen);
|
||||
RegCloseKey (subkey);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
void MyRegDeleteKeyValue(HKEY base, const char *keyname, const char *valuename)
|
||||
{
|
||||
HKEY subkey;
|
||||
wchar_t wide[MAX_PATH];
|
||||
if (RegOpenKeyExW(base, widen(wide, sizeof(wide), keyname), 0, KEY_WRITE, &subkey) == ERROR_SUCCESS)
|
||||
{
|
||||
RegDeleteValueW(subkey, widen(wide, sizeof(wide), valuename));
|
||||
RegCloseKey (subkey);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef WINRT //winrt is too annoying. lets just use stdio.
|
||||
|
||||
|
|
|
@ -363,7 +363,7 @@ noheader:
|
|||
}
|
||||
|
||||
|
||||
n->strm.next_in = buffer;
|
||||
n->strm.next_in = (char*)buffer;
|
||||
n->strm.avail_in = len;
|
||||
|
||||
while(n->strm.avail_in)
|
||||
|
|
|
@ -5558,8 +5558,8 @@ void NET_Init (void)
|
|||
#ifdef IPPROTO_IPV6
|
||||
dllfunction_t fncs[] =
|
||||
{
|
||||
{(void**)&pfreeaddrinfo, "getaddrinfo"},
|
||||
{(void**)&pgetaddrinfo, "freeaddrinfo"},
|
||||
{(void**)&pgetaddrinfo, "getaddrinfo"},
|
||||
{(void**)&pfreeaddrinfo, "freeaddrinfo"},
|
||||
{NULL, NULL}
|
||||
};
|
||||
Sys_LoadLibrary("ws2_32.dll", fncs);
|
||||
|
|
|
@ -512,7 +512,7 @@ static qboolean XI2_Init(void)
|
|||
//qboolean is8bit = false;
|
||||
//qboolean isPermedia = false;
|
||||
qboolean ActiveApp = false;
|
||||
static qboolean gracefulexit;
|
||||
extern qboolean sys_gracefulexit;
|
||||
|
||||
#define SYS_CLIPBOARD_SIZE 512
|
||||
char clipboard_buffer[SYS_CLIPBOARD_SIZE];
|
||||
|
@ -1270,18 +1270,6 @@ void GLVID_DeInit(void) //FIXME:....
|
|||
GLVID_Shutdown();
|
||||
}
|
||||
|
||||
|
||||
void signal_handler_graceful(int sig)
|
||||
{
|
||||
gracefulexit = true;
|
||||
// signal(sig, signal_handler);
|
||||
}
|
||||
|
||||
void InitSig(void)
|
||||
{
|
||||
signal(SIGINT, signal_handler_graceful);
|
||||
}
|
||||
|
||||
static Cursor CreateNullCursor(Display *display, Window root)
|
||||
{
|
||||
Pixmap cursormask;
|
||||
|
@ -1809,8 +1797,6 @@ qboolean X11VID_Init (rendererstate_t *info, unsigned char *palette, int psl)
|
|||
break;
|
||||
}
|
||||
|
||||
InitSig(); // trap evil signals
|
||||
|
||||
//probably going to be resized in the event handler
|
||||
vid.pixelwidth = fullscreenwidth = width;
|
||||
vid.pixelheight = fullscreenheight = height;
|
||||
|
@ -1872,10 +1858,10 @@ void Sys_SendKeyEvents(void)
|
|||
//this is stupid
|
||||
SV_GetConsoleCommands();
|
||||
#endif
|
||||
if (gracefulexit)
|
||||
if (sys_gracefulexit)
|
||||
{
|
||||
Cbuf_AddText("\nquit\n", RESTRICT_LOCAL);
|
||||
gracefulexit = false;
|
||||
sys_gracefulexit = false;
|
||||
}
|
||||
if (vid_dpy && vid_window)
|
||||
{
|
||||
|
|
|
@ -1608,7 +1608,7 @@ static QCC_sref_t QCC_GetTemp(QCC_type_t *type)
|
|||
|
||||
void QCC_FinaliseTemps(void)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
for (i = 0; i < tempsused; )
|
||||
{
|
||||
tempsinfo[i].def->ofs = numpr_globals;
|
||||
|
@ -4026,7 +4026,7 @@ static QCC_sref_t QCC_PR_InlineFindDef(struct inlinectx_s *ctx, QCC_sref_t src,
|
|||
{
|
||||
//if its a parm, use that
|
||||
QCC_def_t *local;
|
||||
for (local = ctx->func->firstlocal, p = 0; local && p < MAX_PARMS && p < ctx->func->type->num_parms; local = local->deftail->nextlocal, p++)
|
||||
for (local = ctx->func->firstlocal, p = 0; local && p < MAX_PARMS && (unsigned int)p < ctx->func->type->num_parms; local = local->deftail->nextlocal, p++)
|
||||
{
|
||||
if (src.sym->symbolheader == local)
|
||||
{
|
||||
|
@ -6937,6 +6937,12 @@ void QCC_StoreToArray(QCC_sref_t base, QCC_sref_t index, QCC_sref_t source, QCC_
|
|||
if (source.cast->type != t->type)
|
||||
QCC_PR_ParseErrorPrintSRef(ERR_TYPEMISMATCH, base, "Type Mismatch on array assignment");
|
||||
|
||||
if (base.cast->type == ev_vector)
|
||||
{
|
||||
//FIXME: we may very well have a *3 already, dividing by 3 again is crazy.
|
||||
index = QCC_PR_Statement(&pr_opcodes[OP_DIV_F], index, QCC_MakeFloatConst(3), NULL);
|
||||
}
|
||||
|
||||
args[0] = QCC_SupplyConversion(index, ev_float, true);
|
||||
args[1] = source;
|
||||
qcc_usefulstatement=true;
|
||||
|
@ -10814,6 +10820,7 @@ void QCC_PR_EmitArraySetFunction(QCC_def_t *scope, QCC_def_t *arraydef, char *ar
|
|||
if (numfunctions >= MAX_FUNCTIONS)
|
||||
QCC_Error(ERR_INTERNAL, "Too many function defs");
|
||||
|
||||
s_file = arraydef->s_file;
|
||||
pr_scope = QCC_PR_GenerateQCFunction(scope, scope->type);
|
||||
pr_source_line = pr_token_line_last = pr_scope->line = thearray.sym->s_line; //thankfully these functions are emitted after compilation.
|
||||
pr_scope->s_file = thearray.sym->s_file;
|
||||
|
@ -12005,18 +12012,19 @@ void QCC_PR_ParseDefs (char *classname)
|
|||
|
||||
if (!def->initialized)
|
||||
{
|
||||
unsigned int u;
|
||||
def->initialized = 1;
|
||||
for (i = 0; i < def->type->size*(def->arraysize?def->arraysize:1); i++) //make arrays of fields work.
|
||||
for (u = 0; u < def->type->size*(def->arraysize?def->arraysize:1); u++) //make arrays of fields work.
|
||||
{
|
||||
if (*(int *)&def->symboldata[def->ofs+i])
|
||||
if (*(int *)&def->symboldata[def->ofs+u])
|
||||
{
|
||||
QCC_PR_ParseWarning(0, "Field def already has a value:");
|
||||
QCC_PR_ParsePrintDef(0, def);
|
||||
}
|
||||
*(int *)&def->symboldata[def->ofs+i] = pr.size_fields+i;
|
||||
*(int *)&def->symboldata[def->ofs+u] = pr.size_fields+u;
|
||||
}
|
||||
|
||||
pr.size_fields += i;
|
||||
pr.size_fields += u;
|
||||
}
|
||||
|
||||
QCC_PR_Expect (";");
|
||||
|
|
|
@ -4320,7 +4320,8 @@ void RunCompiler(char *args, pbool quick)
|
|||
if (!quick)
|
||||
{
|
||||
EngineGiveFocus();
|
||||
EngineCommandf("qcresume\nmenu_restart\nrestart\n");
|
||||
EngineCommandf("qcresume\nqcreload\n");
|
||||
// EngineCommandf("qcresume\nmenu_restart\nrestart\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9416,6 +9416,7 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
|
|||
{"tj_cvar_string", PF_cvar_string, 0, 0, 0, 97, D("string(string cvarname)",NULL), true}, //telejano
|
||||
//DP_QC_FINDFLOAT
|
||||
{"findfloat", PF_FindFloat, 0, 0, 0, 98, D("entity(entity start, .float fld, float match)", "Equivelent to the find builtin, but instead of comparing strings, this builtin compares floats. This builtin requires multiple calls in order to scan all entities - set start to the previous call's return value.\nworld is returned when there are no more entities.")}, // #98 (DP_QC_FINDFLOAT)
|
||||
{"findentity", PF_FindFloat, 0, 0, 0, 98, D("entity(entity start, .entity fld, entity match)", "Equivelent to the find builtin, but instead of comparing strings, this builtin compares entities. This builtin requires multiple calls in order to scan all entities - set start to the previous call's return value.\nworld is returned when there are no more entities.")}, // #98 (DP_QC_FINDFLOAT)
|
||||
|
||||
{"checkextension", PF_checkextension, 99, 99, 0, 99, D("float(string extname)", "Checks for an extension by its name (eg: checkextension(\"FRIK_FILE\") says that its okay to go ahead and use strcat).\nUse cvar(\"pr_checkextension\") to see if this builtin exists.")}, // #99 //darkplaces system - query a string to see if the mod supports X Y and Z.
|
||||
{"builtin_find", PF_builtinsupported,100, 100, 0, 100, D("float(string builtinname)", "Looks to see if the named builtin is valid, and returns the builtin number it exists at.")}, // #100 //per builtin system.
|
||||
|
|
|
@ -2512,9 +2512,9 @@ qbool HUD_Editor_MouseEvent(float x, float y)
|
|||
void HUD_Editor_Key(int key, int unichar, qbool down)
|
||||
{
|
||||
static int planmode = 1;
|
||||
#ifdef HAXX
|
||||
int togglekeys[2];
|
||||
|
||||
#ifdef HAXX
|
||||
EZ_tree_KeyEvent(&help_control_tree, key, unichar, down);
|
||||
|
||||
M_FindKeysForCommand("toggleconsole", togglekeys);
|
||||
|
|
Loading…
Reference in a new issue