int zero = 0;
reset_all_systems ();
- write_log ("Reset at %08.8X\n", m68k_getpc (®s));
+ write_log ("Reset at %08X\n", m68k_getpc (®s));
memory_map_dump();
hsync_counter = 0;
#include "xwin.h"
#include "resource.h"
#include "avioutput.h"
+#include "registry.h"
#define MAX_AVI_SIZE (0x80000000 - 0x1000000)
static WAVEFORMATEX wfxSrc; // source audio format
static LPWAVEFORMATEX pwfxDst = NULL; // pointer to destination audio format
+static DWORD wfxMaxFmtSize;
static FILE *wavfile;
static uae_u8 *lpVideo = NULL; // pointer to video data (bitmap bits)
-static HKEY openavikey(void)
+static UAEREG *openavikey(void)
{
- HKEY fkey = NULL;
- RegCreateKeyEx(hWinUAEKey , "AVConfiguration", 0, NULL, REG_OPTION_NON_VOLATILE,
- KEY_READ | KEY_WRITE, NULL, &fkey, NULL);
- return fkey;
+ return regcreatetree (NULL, "AVConfiguration");
}
-static void storesettings(HKEY avikey)
+static void storesettings(UAEREG *avikey)
{
- RegSetValueEx(avikey, "FrameLimiter", 0, REG_DWORD, (BYTE*)&avioutput_framelimiter, sizeof(DWORD));
- RegSetValueEx(avikey, "NoSoundOutput", 0, REG_DWORD, (BYTE*)&avioutput_nosoundoutput, sizeof(DWORD));
- RegSetValueEx(avikey, "FPS", 0, REG_DWORD, (BYTE*)&avioutput_fps, sizeof(DWORD));
+ regsetint (avikey, "FrameLimiter", avioutput_framelimiter);
+ regsetint (avikey, "NoSoundOutput", avioutput_nosoundoutput);
+ regsetint (avikey, "FPS", avioutput_fps);
}
-static void getsettings(HKEY avikey)
+static void getsettings(UAEREG *avikey)
{
DWORD val;
- DWORD ss = sizeof (DWORD);
- if (RegQueryValueEx(avikey, "NoSoundOutput", 0, NULL, (BYTE*)&val, &ss) == ERROR_SUCCESS)
+ if (regqueryint (avikey, "NoSoundOutput", &val))
avioutput_nosoundoutput = val;
- ss = sizeof (DWORD);
- if (RegQueryValueEx(avikey, "FrameLimiter", 0, NULL, (BYTE*)&val, &ss) == ERROR_SUCCESS)
+ if (regqueryint (avikey, "FrameLimiter", &val))
avioutput_framelimiter = val;
if (!avioutput_framelimiter)
avioutput_nosoundoutput = 1;
- ss = sizeof (DWORD);
- if (RegQueryValueEx(avikey, "FPS", 0, NULL, (BYTE*)&val, &ss) == ERROR_SUCCESS)
+ if (regqueryint (avikey, "FPS", &val))
avioutput_fps = val;
}
void AVIOutput_GetSettings(void)
{
- HKEY avikey = openavikey();
- if (avikey) {
+ UAEREG *avikey = openavikey();
+ if (avikey)
getsettings(avikey);
- RegCloseKey(avikey);
- }
+ regclosetree (avikey);
}
void AVIOutput_SetSettings(void)
{
- HKEY avikey = openavikey();
- if (avikey) {
+ UAEREG *avikey = openavikey();
+ if (avikey)
storesettings(avikey);
- RegCloseKey(avikey);
- }
+ regclosetree (avikey);
}
static UINT CALLBACK acmFilterChooseHookProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static int AVIOutput_AllocateAudio(void)
{
MMRESULT err;
- DWORD wfxMaxFmtSize;
AVIOutput_ReleaseAudio();
{
DWORD ss;
int ok = 0;
- HKEY avikey;
+ UAEREG *avikey;
avikey = openavikey();
if (!avikey)
return 0;
getsettings(avikey);
if (wft) {
- if (RegQueryValueEx(avikey, "AudioConfigurationVars", 0, NULL, NULL, &ss) == ERROR_SUCCESS) {
- if (ss <= sizeof(WAVEFORMATEX) + wft->cbSize) {
- if (RegQueryValueEx(avikey, "AudioConfigurationVars", 0, NULL, (BYTE*)wft, &ss) == ERROR_SUCCESS) {
- if (AVIOutput_ValidateAudio(wft, NULL, 0))
- ok = 1;
- }
- }
+ ss = wfxMaxFmtSize;
+ if (regquerydata (avikey, "AudioConfigurationVars", wft, &ss)) {
+ if (AVIOutput_ValidateAudio(wft, NULL, 0))
+ ok = 1;
}
}
if (!ok)
- RegDeleteValue(avikey, "AudioConfigurationVars");
- RegCloseKey(avikey);
+ regdelete (avikey, "AudioConfigurationVars");
+ regclosetree (avikey);
return ok;
}
{
case MMSYSERR_NOERROR:
{
- HKEY avikey;
+ UAEREG *avikey;
strcpy (s, acmopt.szFormatTag);
avikey = openavikey();
if (avikey) {
- RegSetValueEx(avikey, "AudioConfigurationVars", 0, REG_BINARY, (BYTE*)pwfxDst, pwfxDst->cbSize + sizeof(WAVEFORMATEX));
- storesettings(avikey);
- RegCloseKey(avikey);
+ regsetdata (avikey, "AudioConfigurationVars", pwfxDst, pwfxDst->cbSize + sizeof(WAVEFORMATEX));
+ storesettings (avikey);
+ regclosetree (avikey);
}
return 1;
}
static int AVIOutput_GetCOMPVARSFromRegistry(COMPVARS *pcv)
{
- HKEY avikey;
+ UAEREG *avikey;
DWORD ss;
int ok = 0;
if (pcv) {
ss = pcv->cbSize;
pcv->hic = 0;
- if (RegQueryValueEx(avikey, "VideoConfigurationVars", 0, NULL, (BYTE*)pcv, &ss) == ERROR_SUCCESS) {
+ if (regquerydata (avikey, "VideoConfigurationVars", pcv, &ss)) {
pcv->hic = 0;
pcv->lpbiIn = pcv->lpbiOut = 0;
pcv->cbState = 0;
- if (RegQueryValueEx(avikey, "VideoConfigurationState", 0, NULL, NULL, &ss) == ERROR_SUCCESS) {
+ if (regquerydatasize (avikey, "VideoConfigurationState", &ss)) {
if (ss > 0) {
LPBYTE state = xmalloc (ss);
- if (RegQueryValueEx(avikey, "VideoConfigurationState", 0, NULL, state, &ss) == ERROR_SUCCESS) {
+ if (regquerydata (avikey, "VideoConfigurationState", state, &ss)) {
pcv->hic = ICOpen(pcv->fccType, pcv->fccHandler, ICMODE_COMPRESS);
if (pcv->hic) {
ok = 1;
}
}
if (!ok) {
- RegDeleteValue(avikey, "VideoConfigurationVars");
- RegDeleteValue(avikey, "VideoConfigurationState");
+ regdelete (avikey, "VideoConfigurationVars");
+ regdelete (avikey, "VideoConfigurationState");
}
- RegCloseKey(avikey);
+ regclosetree (avikey);
return ok;
}
pcompvars->dwFlags = 0;
if(ICCompressorChoose(hwnd, ICMF_CHOOSE_DATARATE | ICMF_CHOOSE_KEYFRAME, lpbi, NULL, pcompvars, "Choose Video Codec") == TRUE) {
- HKEY avikey;
+ UAEREG *avikey;
int ss;
uae_u8 *state;
state = xmalloc (1);
avikey = openavikey();
if (avikey) {
- RegSetValueEx(avikey, "VideoConfigurationState", 0, REG_BINARY, state, ss);
- RegSetValueEx(avikey, "VideoConfigurationVars", 0, REG_BINARY, (BYTE*)pcompvars, pcompvars->cbSize);
+ regsetdata (avikey, "VideoConfigurationState", state, ss);
+ regsetdata (avikey, "VideoConfigurationVars", pcompvars, pcompvars->cbSize);
storesettings(avikey);
- RegCloseKey(avikey);
+ regclosetree (avikey);
}
xfree (state);
return AVIOutput_GetVideoCodecName(pcompvars, s, len);
#include "bsdsocket.h"
#include "threaddep/thread.h"
+#include "registry.h"
#include "native2amiga.h"
#include "resource.h"
#include "win32gui.h"
#include "savestate.h"
#include "debug_win32.h"
#include "win32.h"
+#include "registry.h"
#include "win32gui.h"
#include "uae.h"
{
int newpos = 0;
LONG x, y, w, h;
- DWORD regkeytype;
- DWORD regkeysize = sizeof(LONG);
RECT rw;
GetWindowRect(hDlg, &rw);
dbgwnd_minx = rw.right - rw.left;
dbgwnd_miny = rw.bottom - rw.top;
GetClientRect(hDlg, &dlgRect);
- if (hWinUAEKey) {
- newpos = 1;
- if (RegQueryValueEx (hWinUAEKey, "DebuggerPosX", 0, ®keytype, (LPBYTE)&x, ®keysize) != ERROR_SUCCESS)
- newpos = 0;
- if (RegQueryValueEx (hWinUAEKey, "DebuggerPosY", 0, ®keytype, (LPBYTE)&y, ®keysize) != ERROR_SUCCESS)
- newpos = 0;
- if (RegQueryValueEx (hWinUAEKey, "DebuggerPosW", 0, ®keytype, (LPBYTE)&w, ®keysize) != ERROR_SUCCESS)
- newpos = 0;
- if (RegQueryValueEx (hWinUAEKey, "DebuggerPosH", 0, ®keytype, (LPBYTE)&h, ®keysize) != ERROR_SUCCESS)
- newpos = 0;
- }
+ newpos = 1;
+ if (!regqueryint (NULL, "DebuggerPosX", &x))
+ newpos = 0;
+ if (!regqueryint (NULL, "DebuggerPosY", &y))
+ newpos = 0;
+ if (!regqueryint (NULL, "DebuggerPosW", &w))
+ newpos = 0;
+ if (!regqueryint (NULL, "DebuggerPosH", &h))
+ newpos = 0;
if (newpos) {
RECT rc;
rc.left = x;
case WM_DESTROY:
{
RECT r;
- if (GetWindowRect (hDlg, &r) && hWinUAEKey) {
+ if (GetWindowRect (hDlg, &r)) {
r.right -= r.left;
r.bottom -= r.top;
- RegSetValueEx (hWinUAEKey, "DebuggerPosX", 0, REG_DWORD, (LPBYTE)&r.left, sizeof(LONG));
- RegSetValueEx (hWinUAEKey, "DebuggerPosY", 0, REG_DWORD, (LPBYTE)&r.top, sizeof(LONG));
- RegSetValueEx (hWinUAEKey, "DebuggerPosW", 0, REG_DWORD, (LPBYTE)&r.right, sizeof(LONG));
- RegSetValueEx (hWinUAEKey, "DebuggerPosH", 0, REG_DWORD, (LPBYTE)&r.bottom, sizeof(LONG));
+ regsetint (NULL, "DebuggerPosX", r.left);
+ regsetint (NULL, "DebuggerPosY", r.top);
+ regsetint (NULL, "DebuggerPosW", r.right);
+ regsetint (NULL, "DebuggerPosH", r.bottom);
}
hDbgWnd = 0;
PostQuitMessage(0);
#include "threaddep/thread.h"
#include "filesys.h"
#include "blkdev.h"
+#include "registry.h"
#include "win32gui.h"
#include "zfile.h"
#include "options.h"
#include "parser.h"
#include "midi.h"
+#include "registry.h"
#include "resource.h"
#include "win32gui.h"
#include "autoconf.h"
#include "newcpu.h"
#include "traps.h"
+#include "registry.h"
#include "od-win32/win32gui.h"
#include "od-win32/parser.h"
#include "od-win32/midi.h"
#if defined(PICASSO96)
+#include "registry.h"
#include "dxwrap.h"
#include "picasso96_win.h"
#include "win32gfx.h"
--- /dev/null
+
+#include "sysconfig.h"
+#include "sysdeps.h"
+
+#include <windows.h>
+#include "win32.h"
+#include <shlwapi.h>
+#include "registry.h"
+#include "crc32.h"
+
+static int inimode = 0;
+static char *inipath;
+#define PUPPA "eitätäoo"
+
+static HKEY gr (UAEREG *root)
+{
+ if (!root)
+ return hWinUAEKey;
+ return root->fkey;
+}
+static char *gs (UAEREG *root)
+{
+ if (!root)
+ return "WinUAE";
+ return root->inipath;
+}
+static char *gsn (UAEREG *root, const char *name)
+{
+ char *r, *s;
+ if (!root)
+ return my_strdup (name);
+ r = gs (root);
+ s = xmalloc (strlen (r) + 1 + strlen (name) + 1);
+ sprintf (s, "%s/%s", r, name);
+ return s;
+}
+
+int regsetstr (UAEREG *root, const char *name, const char *str)
+{
+ if (inimode) {
+ DWORD ret;
+ ret = WritePrivateProfileString (gs (root), name, str, inipath);
+ return ret;
+ } else {
+ HKEY rk = gr (root);
+ if (!rk)
+ return 0;
+ return RegSetValueEx (rk, name, 0, REG_SZ, (CONST BYTE *)str, strlen (str) + 1) == ERROR_SUCCESS;
+ }
+}
+
+int regsetint (UAEREG *root, const char *name, int val)
+{
+ if (inimode) {
+ DWORD ret;
+ char tmp[100];
+ sprintf (tmp, "%d", val);
+ ret = WritePrivateProfileString (gs (root), name, tmp, inipath);
+ return ret;
+ } else {
+ DWORD v = val;
+ HKEY rk = gr (root);
+ if (!rk)
+ return 0;
+ return RegSetValueEx(rk, name, 0, REG_DWORD, (CONST BYTE*)&v, sizeof (DWORD)) == ERROR_SUCCESS;
+ }
+}
+
+int regqueryint (UAEREG *root, const char *name, int *val)
+{
+ if (inimode) {
+ int ret = 0;
+ char tmp[100];
+ GetPrivateProfileString (gs (root), name, PUPPA, tmp, sizeof (tmp), inipath);
+ if (strcmp (tmp, PUPPA)) {
+ *val = atol (tmp);
+ ret = 1;
+ }
+ return ret;
+ } else {
+ DWORD dwType = REG_DWORD;
+ DWORD size = sizeof (int);
+ HKEY rk = gr (root);
+ if (!rk)
+ return 0;
+ return RegQueryValueEx (rk, name, 0, &dwType, (LPBYTE)val, &size) == ERROR_SUCCESS;
+ }
+}
+
+int regquerystr (UAEREG *root, const char *name, char *str, int *size)
+{
+ if (inimode) {
+ int ret = 0;
+ char *tmp = xmalloc ((*size) + 1);
+ GetPrivateProfileString (gs (root), name, PUPPA, tmp, *size, inipath);
+ if (strcmp (tmp, PUPPA)) {
+ strcpy (str, tmp);
+ ret = 1;
+ }
+ xfree (tmp);
+ return ret;
+ } else {
+ HKEY rk = gr (root);
+ if (!rk)
+ return 0;
+ return RegQueryValueEx (rk, name, 0, NULL, str, size) == ERROR_SUCCESS;
+ }
+}
+
+int regenumstr (UAEREG *root, int idx, char *name, int *nsize, char *str, int *size)
+{
+ if (inimode) {
+ int ret = 0;
+ int tmpsize = 65536;
+ char *tmp = xmalloc (tmpsize);
+ if (GetPrivateProfileSection (gs (root), tmp, tmpsize, inipath) > 0) {
+ int i;
+ char *p = tmp, *p2;
+ for (i = 0; i < idx; i++) {
+ if (p[0] == 0)
+ break;
+ p += strlen (p) + 1;
+ }
+ if (p[0]) {
+ p2 = strchr (p, '=');
+ *p2++ = 0;
+ strcpy_s (name, *nsize, p);
+ strcpy_s (str, *size, p2);
+ ret = 1;
+ }
+ }
+ xfree (tmp);
+ return ret;
+ } else {
+ HKEY rk = gr (root);
+ if (!rk)
+ return 0;
+ return RegEnumValue (rk, idx, name, nsize, NULL, NULL, str, size) == ERROR_SUCCESS;
+ }
+}
+
+int regquerydatasize (UAEREG *root, const char *name, int *size)
+{
+ if (inimode) {
+ int ret = 0;
+ int csize = 65536;
+ char *tmp = xmalloc (csize);
+ if (regquerystr (root, name, tmp, &csize)) {
+ *size = strlen (tmp) / 2;
+ ret = 1;
+ }
+ xfree (tmp);
+ return ret;
+ } else {
+ HKEY rk = gr (root);
+ if (!rk)
+ return 0;
+ return RegQueryValueEx(rk, name, 0, NULL, NULL, size) == ERROR_SUCCESS;
+ }
+}
+
+int regsetdata (UAEREG *root, const char *name, void *str, int size)
+{
+ if (inimode) {
+ uae_u8 *in = str;
+ DWORD ret;
+ int i;
+ char *tmp = xmalloc (size * 2 + 1);
+ for (i = 0; i < size; i++)
+ sprintf (tmp + i * 2, "%02X", in[i]);
+ ret = WritePrivateProfileString (gs (root), name, tmp, inipath);
+ xfree (tmp);
+ return ret;
+ } else {
+ HKEY rk = gr (root);
+ if (!rk)
+ return 0;
+ return RegSetValueEx(rk, name, 0, REG_BINARY, (BYTE*)str, size) == ERROR_SUCCESS;
+ }
+}
+int regquerydata (UAEREG *root, const char *name, void *str, int *size)
+{
+ if (inimode) {
+ int csize = (*size) * 2 + 1;
+ int i, j;
+ int ret = 0;
+ char *tmp = xmalloc (csize);
+ uae_u8 *out = str;
+
+ if (!regquerystr (root, name, tmp, &csize))
+ goto err;
+ j = 0;
+ for (i = 0; i < strlen (tmp); i += 2) {
+ char c1 = toupper(tmp[i + 0]);
+ char c2 = toupper(tmp[i + 1]);
+ if (c1 >= 'A')
+ c1 -= 'A' - 10;
+ else if (c1 >= '0')
+ c1 -= '0';
+ if (c1 > 15)
+ goto err;
+ if (c2 >= 'A')
+ c2 -= 'A' - 10;
+ else if (c2 >= '0')
+ c2 -= '0';
+ if (c2 > 15)
+ goto err;
+ out[j++] = c1 * 16 + c2;
+ }
+ ret = 1;
+ err:
+ xfree (tmp);
+ return ret;
+ } else {
+ HKEY rk = gr (root);
+ if (!rk)
+ return 0;
+ return RegQueryValueEx(rk, name, 0, NULL, str, size) == ERROR_SUCCESS;
+ }
+}
+
+int regdelete (UAEREG *root, const char *name)
+{
+ if (inimode) {
+ WritePrivateProfileString (gs (root), name, NULL, inipath);
+ return 1;
+ } else {
+ HKEY rk = gr (root);
+ if (!rk)
+ return 0;
+ return RegDeleteValue (rk, name) == ERROR_SUCCESS;
+ }
+}
+
+int regexists (UAEREG *root, const char *name)
+{
+ if (inimode) {
+ int ret = 1;
+ char *tmp = xmalloc (strlen (PUPPA) + 1);
+ int size = strlen (PUPPA) + 1;
+ GetPrivateProfileString (gs (root), name, PUPPA, tmp, size, inipath);
+ if (!strcmp (tmp, PUPPA))
+ ret = 0;
+ xfree (tmp);
+ return ret;
+ } else {
+ HKEY rk = gr (root);
+ if (!rk)
+ return 0;
+ return RegQueryValueEx(rk, name, 0, NULL, NULL, NULL) == ERROR_SUCCESS;
+ }
+}
+
+void regdeletetree (UAEREG *root, const char *name)
+{
+ if (inimode) {
+ char *s = gsn (root, name);
+ if (!s)
+ return;
+ WritePrivateProfileSection (s, "", inipath);
+ xfree (s);
+ } else {
+ HKEY rk = gr (root);
+ if (!rk)
+ return;
+ SHDeleteKey (rk, name);
+ }
+}
+
+int regexiststree (UAEREG *root, const char *name)
+{
+ if (inimode) {
+ int ret = 0;
+ int tmpsize = 65536;
+ char *p, *tmp;
+ char *s = gsn (root, name);
+ if (!s)
+ return 0;
+ tmp = xmalloc (tmpsize);
+ tmp[0] = 0;
+ GetPrivateProfileSectionNames (tmp, tmpsize, inipath);
+ p = tmp;
+ while (p[0]) {
+ if (!strcmp (p, name)) {
+ ret = 1;
+ break;
+ }
+ p += strlen (p) + 1;
+ }
+ xfree (tmp);
+ xfree (s);
+ return ret;
+ } else {
+ int ret = 0;
+ HKEY k = NULL;
+ HKEY rk = gr (root);
+ if (!rk)
+ return 0;
+ if (RegOpenKeyEx (rk , name, 0, KEY_READ, &k) == ERROR_SUCCESS)
+ ret = 1;
+ if (k)
+ RegCloseKey (k);
+ return ret;
+ }
+}
+
+
+UAEREG *regcreatetree (UAEREG *root, const char *name)
+{
+ UAEREG *fkey;
+ HKEY rkey;
+
+ if (inimode) {
+ char *ininame;
+ if (!root) {
+ if (!name)
+ ininame = my_strdup (gs (NULL));
+ else
+ ininame = my_strdup (name);
+ } else {
+ ininame = xmalloc (strlen (root->inipath) + 1 + strlen (name) + 1);
+ sprintf (ininame, "%s/%s", root->inipath, name);
+ }
+ fkey = xcalloc (sizeof (UAEREG), 1);
+ fkey->inipath = ininame;
+ } else {
+ HKEY rk = gr (root);
+ if (!rk) {
+ rk = HKEY_CURRENT_USER;
+ name = "Software\\Arabuusimiehet\\WinUAE";
+ }
+ if (RegCreateKeyEx(rk, name, 0, NULL, REG_OPTION_NON_VOLATILE,
+ KEY_READ | KEY_WRITE, NULL, &rkey, NULL) != ERROR_SUCCESS)
+ return 0;
+ fkey = xcalloc (sizeof (UAEREG), 1);
+ fkey->fkey = rkey;
+ }
+ return fkey;
+}
+
+void regclosetree (UAEREG *key)
+{
+ if (!key)
+ return;
+ if (key->fkey)
+ RegCloseKey (key->fkey);
+ xfree (key->inipath);
+ xfree (key);
+}
+
+static uae_u8 crcok[20] = { 0xD3,0x34,0xDE,0x75,0x31,0x2B,0x44,0x51,0xA2,0xB8,0x8D,0xC3,0x52,0xFB,0x65,0x8F,0x95,0xCB,0x0C,0xF2 };
+
+int reginitializeinit (const char *ppath)
+{
+ UAEREG *r = NULL;
+ char tmp1[1000];
+ uae_u8 crc[20];
+ int s, v1, v2, v3;
+ char path[MAX_DPATH], fpath[MAX_PATH];
+
+ if (!ppath) {
+ char *posn;
+ strcpy (path, _pgmptr);
+ if((posn = strrchr (path, '\\')))
+ posn[1] = 0;
+ strcat (path, "winuae.ini");
+ if (GetFileAttributes (path) == INVALID_FILE_ATTRIBUTES)
+ return 0;
+ } else {
+ strcpy (path, ppath);
+ }
+
+ fpath[0] = 0;
+ GetFullPathName (path, sizeof fpath, fpath, NULL);
+ if (strlen (fpath) < 5 || stricmp (fpath + strlen (fpath) - 4, ".ini"))
+ return 0;
+
+ inimode = 1;
+ inipath = my_strdup (fpath);
+ if (!regexists (NULL, "Version"))
+ goto fail;
+ r = regcreatetree (NULL, "Warning");
+ if (!r)
+ goto fail;
+ memset (tmp1, 0, sizeof tmp1);
+ s = 200;
+ if (!regquerystr (r, "info1", tmp1, &s))
+ goto fail;
+ if (!regquerystr (r, "info2", tmp1 + 200, &s))
+ goto fail;
+ get_sha1 (tmp1, sizeof tmp1, crc);
+ if (memcmp (crc, crcok, sizeof crcok))
+ goto fail;
+ v1 = v2 = -1;
+ regsetint (r, "check", 1);
+ regqueryint (r, "check", &v1);
+ regsetint (r, "check", 3);
+ regqueryint (r, "check", &v2);
+ regdelete (r, "check");
+ if (regqueryint (r, "check", &v3))
+ goto fail;
+ if (v1 != 1 || v2 != 3)
+ goto fail;
+ regclosetree (r);
+ return 1;
+fail:
+ regclosetree (r);
+ if (GetFileAttributes (path) != INVALID_FILE_ATTRIBUTES)
+ DeleteFile (path);
+ if (GetFileAttributes (path) != INVALID_FILE_ATTRIBUTES)
+ goto end;
+ r = regcreatetree (NULL, "Warning");
+ if (!r)
+ goto end;
+ regsetstr (r, "info1", "This is unsupported file. Compatibility between versions is not guaranteed.");
+ regsetstr (r, "info2", "Incompatible ini-files may be re-created from scratch!");
+ regclosetree (r);
+ return 1;
+end:
+ inimode = 0;
+ xfree (inipath);
+ return 0;
+}
+
+void regstatus (void)
+{
+ if (inimode)
+ write_log ("WARNING: Unsupported '%s' enabled\n", inipath);
+}
--- /dev/null
+
+
+typedef struct UAEREG {
+ HKEY fkey;
+ char *inipath;
+} UAEREG;
+
+extern int reginitializeinit (const char *path);
+extern void regstatus (void);
+
+extern int regsetstr (UAEREG*, const char *name, const char *str);
+extern int regsetint (UAEREG*, const char *name, int val);
+extern int regqueryint (UAEREG*, const char *name, int *val);
+extern int regquerystr (UAEREG*, const char *name, char *str, int *size);
+
+extern int regdelete (UAEREG*, const char *name);
+extern void regdeletetree (UAEREG*, const char *name);
+
+extern int regexists (UAEREG*, const char *name);
+extern int regexiststree (UAEREG *, const char *name);
+
+extern int regquerydatasize (UAEREG *root, const char *name, int *size);
+extern int regsetdata (UAEREG*, const char *name, const void *str, int size);
+extern int regquerydata (UAEREG *root, const char *name, void *str, int *size);
+
+extern int regenumstr (UAEREG*, int idx, char *name, int *nsize, char *str, int *size);
+
+extern UAEREG *regcreatetree (UAEREG*, const char *name);
+extern void regclosetree (UAEREG *key);
+
#include "bsdsocket.h"
#include "win32.h"
#include "win32gfx.h"
+#include "registry.h"
#include "win32gui.h"
#include "resource.h"
#include "autoconf.h"
rc2.right - rc2.left, rc2.bottom - rc2.top, TRUE);
}
- if (hWinUAEKey && store_xy++) {
- RegSetValueEx(hWinUAEKey, "MainPosX", 0, REG_DWORD, (LPBYTE)&left, sizeof(LONG));
- RegSetValueEx(hWinUAEKey, "MainPosY", 0, REG_DWORD, (LPBYTE)&top, sizeof(LONG));
+ if (store_xy++) {
+ regsetint (NULL, "MainPosX", left);
+ regsetint (NULL, "MainPosY", top);
}
changed_prefs.gfx_size_win.x = left;
changed_prefs.gfx_size_win.y = top;
static void WIN32_InitLang(void)
{
+ int lid;
WORD langid = -1;
- if (hWinUAEKey) {
- DWORD regkeytype;
- DWORD regkeysize = sizeof(langid);
- RegQueryValueEx (hWinUAEKey, "Language", 0, ®keytype, (LPBYTE)&langid, ®keysize);
- }
+
+ if (regqueryint (NULL, "Language", &lid))
+ langid = (WORD)lid;
hUIDLL = language_load(langid);
pritransla ();
}
"\nEnd+F1 changes floppy 0, End+F2 changes floppy 1, etc."
"\n");
write_log ("EXE: '%s', DATA: '%s'\n", start_path_exe, start_path_data);
+ regstatus ();
}
void logging_cleanup( void )
strcat (out, "..\\shared\\rom\\");
if (!strcmp (name, "ConfigurationPath"))
strcat (out, "Configurations\\");
- if (hWinUAEKey && start_data >= 0)
- RegQueryValueEx (hWinUAEKey, name, 0, NULL, out, &size);
+ if (start_data >= 0)
+ regquerystr (NULL, name, out, &size);
if (out[0] == '\\' && (strlen(out) >= 2 && out[1] != '\\')) { /* relative? */
strcpy (out, start_path_data);
- if (hWinUAEKey && start_data >= 0) {
+ if (start_data >= 0) {
size2 -= strlen (out);
- RegQueryValueEx (hWinUAEKey, name, 0, NULL, out + strlen (out) - 1, &size2);
+ regquerystr (NULL, name, out, &size2);
}
}
strip_slashes (out);
}
}
fixtrailing (tmp);
-
- if (hWinUAEKey)
- RegSetValueEx (hWinUAEKey, name, 0, REG_SZ, (CONST BYTE *)tmp, strlen (tmp) + 1);
+ regsetstr (NULL, name, tmp);
}
static void initpath (char *name, char *path)
{
- if (!hWinUAEKey)
- return;
- if (RegQueryValueEx(hWinUAEKey, name, 0, NULL, NULL, NULL) == ERROR_SUCCESS)
+ if (regexists (NULL, name) == 0)
return;
set_path (name, NULL);
}
void read_rom_list (void)
{
char tmp2[1000];
- DWORD size2;
int idx, idx2;
- HKEY fkey;
+ UAEREG *fkey;
char tmp[1000];
- DWORD size, disp;
+ int size, size2, exists;
romlist_clear ();
- if (!hWinUAEKey)
- return;
- RegCreateKeyEx(hWinUAEKey , "DetectedROMs", 0, NULL, REG_OPTION_NON_VOLATILE,
- KEY_READ | KEY_WRITE, NULL, &fkey, &disp);
+ exists = regexiststree (NULL, "DetectedROMs");
+ fkey = regcreatetree (NULL, "DetectedROMs");
if (fkey == NULL)
return;
- if (disp == REG_CREATED_NEW_KEY || forceroms) {
+ if (!exists || forceroms) {
load_keyring (NULL, NULL);
scan_roms (forceroms ? 0 : 1);
}
forceroms = 0;
idx = 0;
for (;;) {
- int err;
size = sizeof (tmp);
size2 = sizeof (tmp2);
- err = RegEnumValue(fkey, idx, tmp, &size, NULL, NULL, tmp2, &size2);
- if (err != ERROR_SUCCESS)
+ if (!regenumstr (fkey, idx, tmp, &size, tmp2, &size2))
break;
if (strlen (tmp) == 6) {
idx2 = atol (tmp + 3);
}
idx++;
}
+ regclosetree (fkey);
}
static int parseversion (char **vs)
char path[MAX_DPATH] = "";
char version[100];
HKEY hWinUAEKeyLocal = NULL;
- HKEY fkey;
HKEY rkey;
char rpath1[MAX_DPATH], rpath2[MAX_DPATH], rpath3[MAX_DPATH];
// commands in. This way, we're always up to date.
/* Set our (default) sub-key to point to the "WinUAE" key, which we then create */
- RegSetValueEx(hWinUAEKey, "", 0, REG_SZ, (CONST BYTE *)"WinUAE", strlen( "WinUAE" ) + 1);
+ RegSetValueEx(hWinUAEKey, "", 0, REG_SZ, (CONST BYTE *)"WinUAE", strlen("WinUAE") + 1);
if((RegCreateKeyEx(rkey, rpath2, 0, "", REG_OPTION_NON_VOLATILE,
KEY_WRITE | KEY_READ, NULL, &hWinUAEKeyLocal, &disposition) == ERROR_SUCCESS))
hWinUAEKey = NULL;
/* Create/Open the hWinUAEKey which points our config-info */
- if (RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\Arabuusimiehet\\WinUAE", 0, "", REG_OPTION_NON_VOLATILE,
- KEY_WRITE | KEY_READ, NULL, &hWinUAEKey, &disposition) == ERROR_SUCCESS)
- {
- initpath ("FloppyPath", start_path_data);
- initpath ("KickstartPath", start_path_data);
- initpath ("hdfPath", start_path_data);
- initpath ("ConfigurationPath", start_path_data);
- initpath ("ScreenshotPath", start_path_data);
- initpath ("StatefilePath", start_path_data);
- initpath ("SaveimagePath", start_path_data);
- initpath ("VideoPath", start_path_data);
- initpath ("InputPath", start_path_data);
- if (disposition == REG_CREATED_NEW_KEY) {
- /* Create and initialize all our sub-keys to the default values */
- RegSetValueEx(hWinUAEKey, "MainPosX", 0, REG_DWORD, (CONST BYTE *)&colortype, sizeof(colortype));
- RegSetValueEx(hWinUAEKey, "MainPosY", 0, REG_DWORD, (CONST BYTE *)&colortype, sizeof(colortype));
- RegSetValueEx(hWinUAEKey, "GUIPosX", 0, REG_DWORD, (CONST BYTE *)&colortype, sizeof(colortype));
- RegSetValueEx(hWinUAEKey, "GUIPosY", 0, REG_DWORD, (CONST BYTE *)&colortype, sizeof(colortype));
- }
- size = sizeof (version);
- dwType = REG_SZ;
- if (RegQueryValueEx (hWinUAEKey, "Version", 0, &dwType, (LPBYTE)&version, &size) == ERROR_SUCCESS) {
- if (checkversion (version))
- RegSetValueEx (hWinUAEKey, "Version", 0, REG_SZ, (CONST BYTE *)VersionStr, strlen (VersionStr) + 1);
- } else {
- RegSetValueEx (hWinUAEKey, "Version", 0, REG_SZ, (CONST BYTE *)VersionStr, strlen (VersionStr) + 1);
- }
- size = sizeof (version);
- dwType = REG_SZ;
- if (RegQueryValueEx (hWinUAEKey, "ROMCheckVersion", 0, &dwType, (LPBYTE)&version, &size) == ERROR_SUCCESS) {
- if (checkversion (version)) {
- if (RegSetValueEx (hWinUAEKey, "ROMCheckVersion", 0, REG_SZ, (CONST BYTE *)VersionStr, strlen (VersionStr) + 1) == ERROR_SUCCESS)
- forceroms = 1;
- }
- } else {
- if (RegSetValueEx (hWinUAEKey, "ROMCheckVersion", 0, REG_SZ, (CONST BYTE *)VersionStr, strlen (VersionStr) + 1) == ERROR_SUCCESS)
- forceroms = 1;
- }
-
- size = sizeof (quickstart);
- dwType = REG_DWORD;
- RegQueryValueEx(hWinUAEKey, "QuickStartMode", 0, &dwType, (LPBYTE)&quickstart, &size);
+ RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\Arabuusimiehet\\WinUAE", 0, "", REG_OPTION_NON_VOLATILE,
+ KEY_WRITE | KEY_READ, NULL, &hWinUAEKey, &disposition);
+ initpath ("FloppyPath", start_path_data);
+ initpath ("KickstartPath", start_path_data);
+ initpath ("hdfPath", start_path_data);
+ initpath ("ConfigurationPath", start_path_data);
+ initpath ("ScreenshotPath", start_path_data);
+ initpath ("StatefilePath", start_path_data);
+ initpath ("SaveimagePath", start_path_data);
+ initpath ("VideoPath", start_path_data);
+ initpath ("InputPath", start_path_data);
+ if (!regexists (NULL, "MainPosX") || !regexists (NULL, "GUIPosX")) {
+ int x = GetSystemMetrics (SM_CXSCREEN);
+ int y = GetSystemMetrics (SM_CYSCREEN);
+ x = (x - 800) / 2;
+ y = (y - 600) / 2;
+ if (x < 10)
+ x = 10;
+ if (y < 10)
+ y = 10;
+ /* Create and initialize all our sub-keys to the default values */
+ regsetint(NULL, "MainPosX", x);
+ regsetint(NULL, "MainPosY", y);
+ regsetint(NULL, "GUIPosX", x);
+ regsetint(NULL, "GUIPosY", y);
+ }
+ size = sizeof (version);
+ if (regquerystr (NULL, "Version", version, &size)) {
+ if (checkversion (version))
+ regsetstr(NULL, "Version", VersionStr);
+ } else {
+ regsetstr (NULL, "Version", VersionStr);
+ }
+ size = sizeof (version);
+ if (regquerystr (NULL, "ROMCheckVersion", version, &size)) {
+ if (checkversion (version)) {
+ if (regsetstr (NULL, "ROMCheckVersion", VersionStr))
+ forceroms = 1;
+ }
+ } else {
+ if (regsetstr (NULL, "ROMCheckVersion", VersionStr))
+ forceroms = 1;
}
+ regsetint (NULL, "QuickStartMode", quickstart);
reopen_console();
fetch_path ("ConfigurationPath", path, sizeof (path));
path[strlen (path) - 1] = 0;
strcpy (savestate_fname, path);
fetch_path ("InputPath", path, sizeof (path));
CreateDirectory (path, NULL);
- fkey = read_disk_history ();
- if (fkey)
- RegCloseKey (fkey);
+ regclosetree (read_disk_history ());
read_rom_list ();
load_keyring(NULL, NULL);
}
char *posn, *p;
char tmp[MAX_DPATH], tmp2[MAX_DPATH], prevpath[MAX_DPATH];
DWORD v;
- HKEY key;
- DWORD dispo;
+ UAEREG *key;
char xstart_path_uae[MAX_DPATH], xstart_path_old[MAX_DPATH];
char xstart_path_new1[MAX_DPATH], xstart_path_new2[MAX_DPATH];
path_type = -1;
xstart_path_uae[0] = xstart_path_old[0] = xstart_path_new1[0] = xstart_path_new2[0] = 0;
- if (RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\Arabuusimiehet\\WinUAE", 0, "", REG_OPTION_NON_VOLATILE,
- KEY_WRITE | KEY_READ, NULL, &key, &dispo) == ERROR_SUCCESS)
- {
+ key = regcreatetree (NULL, NULL);
+ if (key) {
DWORD size = sizeof (prevpath);
- DWORD dwType = REG_SZ;
- if (RegQueryValueEx (key, "PathMode", 0, &dwType, (LPBYTE)&prevpath, &size) != ERROR_SUCCESS)
+ if (!regquerystr (NULL, "PathMode", prevpath, &size))
prevpath[0] = 0;
- RegCloseKey(key);
+ regclosetree (key);
}
if (!strcmp(prevpath, "WinUAE"))
path_type = PATH_TYPE_WINUAE;
GetModuleHandle("shell32.dll"), "SHGetFolderPathA");
pSHGetSpecialFolderPath = (SHGETSPECIALFOLDERPATH)GetProcAddress(
GetModuleHandle("shell32.dll"), "SHGetSpecialFolderPathA");
- strcpy (start_path_exe, _pgmptr );
+ strcpy (start_path_exe, _pgmptr);
if((posn = strrchr (start_path_exe, '\\')))
posn[1] = 0;
}
static int multi_display = 1;
+static char *inipath = NULL;
static int process_arg(char **xargv)
{
sound_mode_skip = getval (np);
continue;
}
+ if (!strcmp (arg, "-ini")) {
+ i++;
+ inipath = my_strdup (np);
+ continue;
+ }
}
xargv[xargc++] = my_strdup(arg);
}
argv = xcalloc (sizeof (char*), __argc);
argc = process_arg(argv);
+ reginitializeinit (inipath);
getstartpaths();
makeverstr(VersionStr);
SetCurrentDirectory (start_path_data);
#define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100)
#define GETBDD(x) ((x) % 100)
-#define WINUAEBETA 8
+#define WINUAEBETA 9
#define WINUAEPUBLICBETA 1
-#define WINUAEDATE MAKEBD(2007, 11, 8)
+#define WINUAEDATE MAKEBD(2007, 11, 10)
#define WINUAEEXTRA ""
#define WINUAEREV ""
#include "drawing.h"
#include "dxwrap.h"
#include "picasso96_win.h"
+#include "registry.h"
#include "win32.h"
#include "win32gfx.h"
#include "win32gui.h"
if (!dxfs) {
RECT rc;
LONG stored_x = 1, stored_y = cymenu + cyborder;
- DWORD regkeytype;
- DWORD regkeysize = sizeof (LONG);
int oldx, oldy;
int first = 2;
- RegQueryValueEx(hWinUAEKey, "MainPosX", 0, ®keytype, (LPBYTE)&stored_x, ®keysize);
- RegQueryValueEx(hWinUAEKey, "MainPosY", 0, ®keytype, (LPBYTE)&stored_y, ®keysize);
+ regqueryint (NULL, "MainPosX", &stored_x);
+ regqueryint (NULL, "MainPosY", &stored_y);
while (first) {
first--;
#include "dxwrap.h"
#include "win32.h"
+#include "registry.h"
#include "picasso96_win.h"
#include "win32gui.h"
#include "win32gfx.h"
{
int i, j;
char tmp[16];
- HKEY fkey;
+ UAEREG *fkey;
- if (!hWinUAEKey)
- return;
- RegCreateKeyEx(hWinUAEKey , "DiskImageMRUList", 0, NULL, REG_OPTION_NON_VOLATILE,
- KEY_READ | KEY_WRITE, NULL, &fkey, NULL);
+ fkey = regcreatetree (NULL, "DiskImageMRUList");
if (fkey == NULL)
return;
j = 1;
if (s == 0 || strlen(s) == 0)
continue;
sprintf (tmp, "Image%02d", j);
- RegSetValueEx (fkey, tmp, 0, REG_SZ, (CONST BYTE *)s, strlen(s) + 1);
+ regsetstr (fkey, tmp, s);
j++;
}
while (j <= MAX_PREVIOUS_FLOPPIES) {
char *s = "";
sprintf (tmp, "Image%02d", j);
- RegSetValueEx (fkey, tmp, 0, REG_SZ, (CONST BYTE *)s, strlen(s) + 1);
+ regsetstr (fkey, tmp, s);
j++;
}
- RegCloseKey(fkey);
+ regclosetree (fkey);
}
void reset_disk_history (void)
write_disk_history();
}
-HKEY read_disk_history (void)
+UAEREG *read_disk_history (void)
{
static int regread;
char tmp2[1000];
DWORD size2;
int idx, idx2;
- HKEY fkey;
+ UAEREG *fkey;
char tmp[1000];
DWORD size;
- if (!hWinUAEKey)
- return NULL;
- RegCreateKeyEx(hWinUAEKey , "DiskImageMRUList", 0, NULL, REG_OPTION_NON_VOLATILE,
- KEY_READ | KEY_WRITE, NULL, &fkey, NULL);
+ fkey = regcreatetree (NULL, "DiskImageMRUList");
if (fkey == NULL || regread)
return fkey;
idx = 0;
for (;;) {
- int err;
size = sizeof (tmp);
size2 = sizeof (tmp2);
- err = RegEnumValue (fkey, idx, tmp, &size, NULL, NULL, tmp2, &size2);
- if (err != ERROR_SUCCESS)
+ if (!regenumstr (fkey, idx, tmp, &size, tmp2, &size2))
break;
if (strlen (tmp) == 7) {
idx2 = atol (tmp + 5) - 1;
#define MAX_SOUND_MEM 6
struct romscandata {
- HKEY fkey;
+ UAEREG *fkey;
int got;
};
return scan_single_rom_2 (z);
}
-static int addrom (HKEY fkey, struct romdata *rd, char *name)
+static int addrom (UAEREG *fkey, struct romdata *rd, char *name)
{
char tmp1[MAX_DPATH], tmp2[MAX_DPATH];
char *p = tmp1 + strlen (tmp1);
sprintf (p, "_%02d_%02d", rd->group >> 16, rd->group & 65535);
}
- if (RegQueryValueEx (fkey, tmp1, 0, NULL, NULL, NULL) == ERROR_SUCCESS)
+ if (regexists (fkey, tmp1))
return 0;
tmp2[0] = 0;
if (name)
else
sprintf(tmp2, ":ROM%03d", rd->id);
}
- if (RegSetValueEx (fkey, tmp1, 0, REG_SZ, (CONST BYTE *)tmp2, strlen (tmp2) + 1) != ERROR_SUCCESS)
+ if (!regsetstr (fkey, tmp1, tmp2))
return 0;
return 1;
}
return 0;
}
-static int scan_rom (char *path, HKEY fkey)
+static int scan_rom (char *path, UAEREG *fkey)
{
struct romscandata rsd = { fkey, 0 };
struct romdata *rd;
free (p);
}
-static int scan_roms_2 (HKEY fkey, char *pathp)
+static int scan_roms_2 (UAEREG *fkey, char *pathp)
{
char buf[MAX_DPATH], path[MAX_DPATH];
WIN32_FIND_DATA find_data;
return ret;
}
-static int scan_roms_3(HKEY fkey, char **paths, int offset, char *path)
+static int scan_roms_3(void *fkey, char **paths, int offset, char *path)
{
int i, ret;
char path[MAX_DPATH];
static int recursive;
int id, i, ret, keys, cnt;
- HKEY fkey = NULL;
+ UAEREG *fkey, *fkey2;
char *paths[10];
if (recursive)
return 0;
recursive++;
- SHDeleteKey (hWinUAEKey, "DetectedROMs");
- RegCreateKeyEx(hWinUAEKey , "DetectedROMs", 0, NULL, REG_OPTION_NON_VOLATILE,
- KEY_READ | KEY_WRITE, NULL, &fkey, NULL);
+ regdeletetree (NULL, "DetectedROMs");
+ fkey = regcreatetree (NULL, "DetectedROMs");
if (fkey == NULL)
goto end;
for (i = 0; i < 10; i++)
xfree(paths[i]);
- RegCreateKeyEx(hWinUAEKey , "DetectedROMs", 0, NULL, REG_OPTION_NON_VOLATILE,
- KEY_READ | KEY_WRITE, NULL, &fkey, NULL);
- if (fkey) {
+ fkey2 = regcreatetree (NULL, "DetectedROMS");
+ if (fkey2) {
id = 1;
for (;;) {
struct romdata *rd = getromdatabyid(id);
addrom(fkey, rd, NULL);
id++;
}
- RegCloseKey(fkey);
+ regclosetree (fkey2);
}
end:
if (show)
show_rom_list ();
- if (fkey)
- RegCloseKey (fkey);
+ regclosetree (fkey);
recursive--;
return ret;
}
type2 = type;
if (type == 0)
default_prefs (p, type);
- RegQueryValueEx (hWinUAEKey, "ConfigFile_NoAuto", 0, NULL, (LPBYTE)&ct2, &size);
+ regqueryint (NULL, "ConfigFile_NoAuto", &ct2);
v = cfgfile_load (p, fname, &type2, ct2);
if (!v)
return v;
if (type != i) {
size = sizeof (ct);
ct = 0;
- RegQueryValueEx (hWinUAEKey, configreg2[i], 0, NULL, (LPBYTE)&ct, &size);
+ regqueryint (NULL, configreg2[i], &ct);
if (ct && ((i == 1 && p->config_hardware_path[0] == 0) || (i == 2 && p->config_host_path[0] == 0) || ct2)) {
size = sizeof (tmp1);
- RegQueryValueEx (hWinUAEKey, configreg[i], 0, NULL, (LPBYTE)tmp1, &size);
+ regquerystr (NULL, configreg[i], tmp1, &size);
fetch_path ("ConfigurationPath", tmp2, sizeof (tmp2));
strcat (tmp2, tmp1);
v = i;
amiga_path = strstr (openFileName.lpstrFile, openFileName.lpstrFileTitle);
if (amiga_path && amiga_path != openFileName.lpstrFile) {
*amiga_path = 0;
- if (hWinUAEKey)
- RegSetValueEx (hWinUAEKey, "FloppyPath", 0, REG_SZ, (CONST BYTE *)openFileName.lpstrFile, strlen(openFileName.lpstrFile) + 1);
+ regsetstr (NULL, "FloppyPath", openFileName.lpstrFile);
}
} else if (flag == 2 || flag == 3) {
amiga_path = strstr (openFileName.lpstrFile, openFileName.lpstrFileTitle);
if (amiga_path && amiga_path != openFileName.lpstrFile) {
*amiga_path = 0;
- if(hWinUAEKey)
- RegSetValueEx(hWinUAEKey, "hdfPath", 0, REG_SZ, (CONST BYTE *)openFileName.lpstrFile, strlen(openFileName.lpstrFile) + 1);
+ regsetstr (NULL, "hdfPath", openFileName.lpstrFile);
}
}
if (!multi)
static void ConfigToRegistry (struct ConfigStruct *config, int type)
{
- if (hWinUAEKey && config) {
+ if (config) {
char path[MAX_DPATH];
strcpy (path, config->Path);
strncat (path, config->Name, MAX_DPATH);
- RegSetValueEx (hWinUAEKey, configreg[type], 0, REG_SZ, (CONST BYTE *)path, strlen(path) + 1);
+ regsetstr (NULL, configreg[type], path);
}
}
static void ConfigToRegistry2 (DWORD ct, int type, DWORD noauto)
{
- if (!hWinUAEKey)
- return;
if (type > 0)
- RegSetValueEx (hWinUAEKey, configreg2[type], 0, REG_DWORD, (CONST BYTE *)&ct, sizeof (ct));
+ regsetint (NULL, configreg2[type], ct);
if (noauto == 0 || noauto == 1)
- RegSetValueEx (hWinUAEKey, "ConfigFile_NoAuto", 0, REG_DWORD, (CONST BYTE *)&noauto, sizeof (noauto));
+ regsetint (NULL, "ConfigFile_NoAuto", noauto);
}
static void checkautoload (HWND hDlg, struct ConfigStruct *config)
{
int ct = 0;
- DWORD dwType = REG_DWORD;
- DWORD dwRFPsize = sizeof (ct);
if (configtypepanel > 0)
- RegQueryValueEx (hWinUAEKey, configreg2[configtypepanel], 0, &dwType, (LPBYTE)&ct, &dwRFPsize);
+ regqueryint (NULL, configreg2[configtypepanel], &ct);
if (!config || config->Directory) {
ct = 0;
ConfigToRegistry2 (ct, configtypepanel, -1);
}
CheckDlgButton(hDlg, IDC_CONFIGAUTO, ct ? BST_CHECKED : BST_UNCHECKED);
ew (hDlg, IDC_CONFIGAUTO, configtypepanel > 0 && config && !config->Directory ? TRUE : FALSE);
- RegQueryValueEx (hWinUAEKey, "ConfigFile_NoAuto", 0, &dwType, (LPBYTE)&ct, &dwRFPsize);
+ regqueryint (NULL, "ConfigFile_NoAuto", &ct);
CheckDlgButton(hDlg, IDC_CONFIGNOLINK, ct ? BST_CHECKED : BST_UNCHECKED);
}
{
HTREEITEM root;
char name_buf[MAX_DPATH];
+ DWORD dwRFPsize = sizeof (name_buf);
+ char path[MAX_DPATH];
EnableWindow (GetDlgItem (hDlg, IDC_VIEWINFO), workprefs.info[0]);
SetDlgItemText (hDlg, IDC_EDITPATH, "");
SetDlgItemText (hDlg, IDC_EDITDESCRIPTION, workprefs.description);
root = InitializeConfigTreeView (hDlg);
- if (hWinUAEKey) {
- DWORD dwType = REG_SZ;
- DWORD dwRFPsize = sizeof (name_buf);
- char path[MAX_DPATH];
- if (RegQueryValueEx (hWinUAEKey, configreg[configtypepanel], 0, &dwType, (LPBYTE)name_buf, &dwRFPsize) == ERROR_SUCCESS) {
- struct ConfigStruct *config2 = getconfigstorefrompath (name_buf, path, configtypepanel);
- if (config2)
- config = config2;
- }
+ if (regquerystr (NULL, configreg[configtypepanel], name_buf, &dwRFPsize)) {
+ struct ConfigStruct *config2 = getconfigstorefrompath (name_buf, path, configtypepanel);
+ if (config2)
+ config = config2;
checkautoload (hDlg, config);
}
config = fixloadconfig (hDlg, config);
static void resetregistry (void)
{
- if (!hWinUAEKey)
- return;
- SHDeleteKey (hWinUAEKey, "DetectedROMs");
- RegDeleteValue (hWinUAEKey, "QuickStartMode");
- RegDeleteValue (hWinUAEKey, "ConfigFile");
- RegDeleteValue (hWinUAEKey, "ConfigFileHardware");
- RegDeleteValue (hWinUAEKey, "ConfigFileHost");
- RegDeleteValue (hWinUAEKey, "ConfigFileHardware_Auto");
- RegDeleteValue (hWinUAEKey, "ConfigFileHost_Auto");
- RegDeleteValue (hWinUAEKey, "ConfigurationPath");
- RegDeleteValue (hWinUAEKey, "SaveimagePath");
- RegDeleteValue (hWinUAEKey, "ScreenshotPath");
- RegDeleteValue (hWinUAEKey, "StatefilePath");
- RegDeleteValue (hWinUAEKey, "VideoPath");
- RegDeleteValue (hWinUAEKey, "QuickStartModel");
- RegDeleteValue (hWinUAEKey, "QuickStartConfiguration");
- RegDeleteValue (hWinUAEKey, "QuickStartCompatibility");
- RegDeleteValue (hWinUAEKey, "QuickStartHostConfig");
+ regdeletetree (NULL, "DetectedROMs");
+ regdelete (NULL, "QuickStartMode");
+ regdelete (NULL, "ConfigFile");
+ regdelete (NULL, "ConfigFileHardware");
+ regdelete (NULL, "ConfigFileHost");
+ regdelete (NULL, "ConfigFileHardware_Auto");
+ regdelete (NULL, "ConfigFileHost_Auto");
+ regdelete (NULL, "ConfigurationPath");
+ regdelete (NULL, "SaveimagePath");
+ regdelete (NULL, "ScreenshotPath");
+ regdelete (NULL, "StatefilePath");
+ regdelete (NULL, "VideoPath");
+ regdelete (NULL, "QuickStartModel");
+ regdelete (NULL, "QuickStartConfiguration");
+ regdelete (NULL, "QuickStartCompatibility");
+ regdelete (NULL, "QuickStartHostConfig");
}
int path_type;
strcpy (start_path_data, start_path_new1);
}
SetCurrentDirectory (start_path_data);
- if (hWinUAEKey)
- RegSetValueEx (hWinUAEKey, "PathMode", 0, REG_SZ, (CONST BYTE *)pathmode, strlen(pathmode) + 1);
+ regsetstr (NULL, "PathMode", pathmode);
set_path ("KickstartPath", NULL);
set_path ("ConfigurationPath", NULL);
set_path ("ScreenshotPath", NULL);
static void init_quickstartdlg (HWND hDlg)
{
static int firsttime;
- int i, j, idx, idx2;
- DWORD dwType, qssize;
+ int i, j, idx, idx2, qssize;
char tmp1[2 * MAX_DPATH], tmp2[MAX_DPATH], hostconf[MAX_DPATH];
char *p1, *p2;
qssize = sizeof (tmp1);
- RegQueryValueEx (hWinUAEKey, "QuickStartHostConfig", 0, &dwType, (LPBYTE)hostconf, &qssize);
+ regquerystr (NULL, "QuickStartHostConfig", hostconf, &qssize);
if (firsttime == 0) {
- if (hWinUAEKey) {
- qssize = sizeof (quickstart_model);
- RegQueryValueEx (hWinUAEKey, "QuickStartModel", 0, &dwType, (LPBYTE)&quickstart_model, &qssize);
- qssize = sizeof (quickstart_conf);
- RegQueryValueEx (hWinUAEKey, "QuickStartConfiguration", 0, &dwType, (LPBYTE)&quickstart_conf, &qssize);
- qssize = sizeof (quickstart_compa);
- RegQueryValueEx (hWinUAEKey, "QuickStartCompatibility", 0, &dwType, (LPBYTE)&quickstart_compa, &qssize);
- qssize = sizeof (quickstart_floppy);
- RegQueryValueEx (hWinUAEKey, "QuickStartFloppies", 0, &dwType, (LPBYTE)&quickstart_floppy, &qssize);
- }
+ regqueryint (NULL, "QuickStartModel", &quickstart_model);
+ regqueryint (NULL, "QuickStartConfiguration", &quickstart_conf);
+ regqueryint (NULL, "QuickStartCompatibility", &quickstart_compa);
+ regqueryint (NULL, "QuickStartFloppies", &quickstart_floppy);
if (quickstart) {
workprefs.df[0][0] = 0;
workprefs.df[1][0] = 0;
}
}
SendDlgItemMessage (hDlg, IDC_QUICKSTART_HOSTCONFIG, CB_SETCURSEL, idx, 0);
-
- if (hWinUAEKey) {
- RegSetValueEx (hWinUAEKey, "QuickStartModel", 0, REG_DWORD, (CONST BYTE *)&quickstart_model, sizeof(quickstart_model));
- RegSetValueEx (hWinUAEKey, "QuickStartConfiguration", 0, REG_DWORD, (CONST BYTE *)&quickstart_conf, sizeof(quickstart_conf));
- RegSetValueEx (hWinUAEKey, "QuickStartCompatibility", 0, REG_DWORD, (CONST BYTE *)&quickstart_compa, sizeof(quickstart_compa));
- }
+ regsetint (NULL, "QuickStartModel", quickstart_model);
+ regsetint (NULL, "QuickStartConfiguration", quickstart_conf);
+ regsetint (NULL, "QuickStartCompatibility", quickstart_compa);
}
static void floppytooltip (HWND hDlg, int num, uae_u32 crc32);
val = SendDlgItemMessage (hDlg, IDC_QUICKSTART_HOSTCONFIG, CB_GETCURSEL, 0, 0);
if (val != CB_ERR) {
SendDlgItemMessage (hDlg, IDC_QUICKSTART_HOSTCONFIG, CB_GETLBTEXT, (WPARAM)val, (LPARAM)tmp);
- if (hWinUAEKey)
- RegSetValueEx (hWinUAEKey, "QuickStartHostConfig", 0, REG_SZ, (CONST BYTE *)&tmp, strlen (tmp) + 1);
+ regsetstr (NULL, "QuickStartHostConfig", tmp);
quickstarthost (hDlg, tmp);
if (val == 0 && quickstart)
load_quickstart (hDlg, 0);
{
case IDC_QUICKSTARTMODE:
quickstart = IsDlgButtonChecked (hDlg, IDC_QUICKSTARTMODE);
- if (hWinUAEKey)
- RegSetValueEx( hWinUAEKey, "QuickStartMode", 0, REG_DWORD, (CONST BYTE *)&quickstart, sizeof(quickstart));
+ regsetint (NULL, "QuickStartMode", quickstart);
if (quickstart) {
init_quickstartdlg (hDlg);
load_quickstart (hDlg, 0);
return FALSE;
}
-static void addromfiles (HKEY fkey, HWND hDlg, DWORD d, char *path, int type)
+static void addromfiles (UAEREG *fkey, HWND hDlg, DWORD d, char *path, int type)
{
int idx, idx2;
char tmp[MAX_DPATH];
for (;fkey;) {
DWORD size = sizeof (tmp);
DWORD size2 = sizeof (tmp2);
- int err = RegEnumValue(fkey, idx, tmp, &size, NULL, NULL, tmp2, &size2);
- if (err != ERROR_SUCCESS)
+ if (!regenumstr (fkey, idx, tmp, &size, tmp2, &size2))
break;
if (strlen (tmp) == 6) {
idx2 = atol (tmp + 3);
static void values_to_kickstartdlg (HWND hDlg)
{
- HKEY fkey;
+ UAEREG *fkey;
- if (hWinUAEKey) {
- RegCreateKeyEx(hWinUAEKey , "DetectedROMs", 0, NULL, REG_OPTION_NON_VOLATILE,
- KEY_READ | KEY_WRITE, NULL, &fkey, NULL);
- load_keyring(&workprefs, NULL);
- addromfiles (fkey, hDlg, IDC_ROMFILE, workprefs.romfile,
- ROMTYPE_KICK | ROMTYPE_KICKCD32);
- addromfiles (fkey, hDlg, IDC_ROMFILE2, workprefs.romextfile,
- ROMTYPE_EXTCD32 | ROMTYPE_EXTCDTV | ROMTYPE_ARCADIABIOS);
- addromfiles (fkey, hDlg, IDC_CARTFILE, workprefs.cartfile,
- ROMTYPE_AR | ROMTYPE_SUPERIV | ROMTYPE_NORDIC | ROMTYPE_XPOWER | ROMTYPE_ARCADIAGAME | ROMTYPE_HRTMON);
- if (fkey)
- RegCloseKey (fkey);
- }
+ fkey = regcreatetree (NULL, "DetectedROMs");
+ load_keyring(&workprefs, NULL);
+ addromfiles (fkey, hDlg, IDC_ROMFILE, workprefs.romfile,
+ ROMTYPE_KICK | ROMTYPE_KICKCD32);
+ addromfiles (fkey, hDlg, IDC_ROMFILE2, workprefs.romextfile,
+ ROMTYPE_EXTCD32 | ROMTYPE_EXTCDTV | ROMTYPE_ARCADIABIOS);
+ addromfiles (fkey, hDlg, IDC_CARTFILE, workprefs.cartfile,
+ ROMTYPE_AR | ROMTYPE_SUPERIV | ROMTYPE_NORDIC | ROMTYPE_XPOWER | ROMTYPE_ARCADIAGAME | ROMTYPE_HRTMON);
+ regclosetree (fkey);
SetDlgItemText(hDlg, IDC_FLASHFILE, workprefs.flashfile);
CheckDlgButton(hDlg, IDC_KICKSHIFTER, workprefs.kickshifter);
static void init_kickstart (HWND hDlg)
{
- HKEY fkey;
-
#if !defined(AUTOCONFIG)
ew (hDlg, IDC_MAPROM), FALSE);
#endif
ew (hDlg, IDC_CARTCHOOSER), FALSE);
ew (hDlg, IDC_FLASHCHOOSER), FALSE);
#endif
- if (RegOpenKeyEx (hWinUAEKey , "DetectedROMs", 0, KEY_READ, &fkey) != ERROR_SUCCESS)
+ if (!regexiststree (NULL , "DetectedROMs"))
scan_roms (1);
- if (fkey)
- RegCloseKey (fkey);
}
static INT_PTR CALLBACK KickstartDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
static void misc_lang(HWND hDlg)
{
- int i, idx = 0, cnt = 0;
+ int i, idx = 0, cnt = 0, lid;
WORD langid = -1;
- if (hWinUAEKey) {
- DWORD regkeytype;
- DWORD regkeysize = sizeof(langid);
- RegQueryValueEx (hWinUAEKey, "Language", 0, ®keytype, (LPBYTE)&langid, ®keysize);
- }
+ if (regqueryint (NULL, "Language", &lid))
+ langid = (WORD)lid;
SendDlgItemMessage (hDlg, IDC_LANGUAGE, CB_RESETCONTENT, 0, 0);
SendDlgItemMessage (hDlg, IDC_LANGUAGE, CB_ADDSTRING, 0, (LPARAM)"Autodetect");
SendDlgItemMessage (hDlg, IDC_LANGUAGE, CB_ADDSTRING, 0, (LPARAM)"English (built-in)");
}
if (v == -2)
langid = -1;
- if (hWinUAEKey)
- RegSetValueEx (hWinUAEKey, "Language", 0, REG_DWORD, (CONST BYTE *)&langid, sizeof(langid));
+ regsetint (NULL, "Language", langid);
FreeLibrary(hUIDLL);
hUIDLL = NULL;
if (langid >= 0)
SendMessage (ToolTipHWND, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti);
}
-static void addfloppyhistory_2 (HWND hDlg, HKEY fkey, int n, int f_text)
+static void addfloppyhistory_2 (HWND hDlg, UAEREG *fkey, int n, int f_text)
{
int i, j;
char *s;
static void addfloppyhistory(HWND hDlg)
{
- HKEY fkey;
+ UAEREG *fkey;
int f_text, max, n;
if (currentpage == QUICKSTART_ID)
f_text = IDC_DISKTEXT;
addfloppyhistory_2 (hDlg, fkey, n, f_text);
}
- if (fkey)
- RegCloseKey (fkey);
+ regclosetree (fkey);
}
static void addfloppytype (HWND hDlg, int n)
quickstart_floppy = 2;
else
quickstart_floppy = 1;
- if (hWinUAEKey)
- RegSetValueEx (hWinUAEKey, "QuickStartFloppies", 0, REG_DWORD, (CONST BYTE *)&quickstart_floppy, sizeof(quickstart_floppy));
+ regsetint (NULL, "QuickStartFloppies", quickstart_floppy);
}
}
char txt[100], tmp[100];
int i, j, nofilter, fltnum, modenum;
struct uae_filter *uf;
- HKEY fkey;
+ UAEREG *fkey;
SendDlgItemMessage(hDlg, IDC_FILTERHZ, TBM_SETRANGE, TRUE, MAKELONG (-999, +999));
SendDlgItemMessage(hDlg, IDC_FILTERHZ, TBM_SETPAGESIZE, 0, 1);
sprintf(tmp, "* %s", filterpresets[i].name);
SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, CB_ADDSTRING, 0, (LPARAM)tmp);
}
- if (hWinUAEKey) {
- RegCreateKeyEx(hWinUAEKey , "FilterPresets", 0, NULL, REG_OPTION_NON_VOLATILE,
- KEY_READ, NULL, &fkey, NULL);
- if (fkey) {
- int idx = 0;
- char tmp[MAX_DPATH], tmp2[MAX_DPATH];
- DWORD size, size2;
-
- for (;;) {
- int err;
- size = sizeof (tmp);
- size2 = sizeof (tmp2);
- err = RegEnumValue(fkey, idx, tmp, &size, NULL, NULL, tmp2, &size2);
- if (err != ERROR_SUCCESS)
- break;
- SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, CB_ADDSTRING, 0, (LPARAM)tmp);
- idx++;
- }
- SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, CB_SETCURSEL, filterpreset_selected, 0);
- RegCloseKey (fkey);
+ fkey = regcreatetree (NULL, "FilterPresets");
+ if (fkey) {
+ int idx = 0;
+ char tmp[MAX_DPATH], tmp2[MAX_DPATH];
+ DWORD size, size2;
+
+ for (;;) {
+ size = sizeof (tmp);
+ size2 = sizeof (tmp2);
+ if (!regenumstr (fkey, idx, tmp, &size, tmp2, &size2))
+ break;
+ SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, CB_ADDSTRING, 0, (LPARAM)tmp);
+ idx++;
}
+ SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, CB_SETCURSEL, filterpreset_selected, 0);
+ regclosetree (fkey);
}
SendDlgItemMessage (hDlg, IDC_FILTERHZ, TBM_SETPOS, TRUE, workprefs.gfx_filter_horiz_zoom);
static void filter_preset (HWND hDlg, WPARAM wParam)
{
- int ok, err, load, i, builtin, userfilter;
+ int ok, load, i, builtin, userfilter;
char tmp1[MAX_DPATH], tmp2[MAX_DPATH];
DWORD outsize;
- HKEY fkey = NULL;
+ UAEREG *fkey;
LRESULT item;
load = 0;
ok = 0;
for (builtin = 0; filterpresets[builtin].name; builtin++);
- if (hWinUAEKey) {
- RegCreateKeyEx(hWinUAEKey , "FilterPresets", 0, NULL, REG_OPTION_NON_VOLATILE,
- KEY_READ | KEY_WRITE, NULL, &fkey, NULL);
- }
+ fkey = regcreatetree (NULL, "FilterPresets");
item = SendDlgItemMessage (hDlg, IDC_FILTERPRESETS, CB_GETCURSEL, 0, 0);
tmp1[0] = 0;
if (item != CB_ERR) {
if (filterpreset_builtin < 0) {
outsize = sizeof (tmp2);
- if (tmp1[0] && fkey && RegQueryValueEx (fkey, tmp1, NULL, NULL, tmp2, &outsize) == ERROR_SUCCESS)
+ if (tmp1[0] && regquerystr (fkey, tmp1, tmp2, &outsize))
ok = 1;
} else {
char *p = tmp2;
if (tmp1[0] == 0)
goto end;
}
- if (fkey)
- RegSetValueEx (fkey, tmp1, 0, REG_SZ, (CONST BYTE *)&tmp2, strlen (tmp2) + 1);
+ regsetstr (fkey, tmp1, tmp2);
values_to_hw3ddlg (hDlg);
}
if (ok) {
- if (wParam == IDC_FILTERPRESETDELETE && userfilter && fkey) {
- err = RegDeleteValue (fkey, tmp1);
+ if (wParam == IDC_FILTERPRESETDELETE && userfilter) {
+ regdelete (fkey, tmp1);
values_to_hw3ddlg (hDlg);
} else if (wParam == IDC_FILTERPRESETLOAD) {
char *s = tmp2;
}
}
end:
- if (fkey)
- RegCloseKey (fkey);
+ regclosetree (fkey);
if (load) {
values_to_hw3ddlg (hDlg);
SendMessage (hDlg, WM_HSCROLL, 0, 0);
if (id < 0) {
if (isfullscreen () <= 0) {
RECT r;
- if (GetWindowRect (hDlg, &r) && hWinUAEKey) {
+ if (GetWindowRect (hDlg, &r)) {
LONG left, top;
left = r.left;
top = r.top;
- RegSetValueEx (hWinUAEKey, "GUIPosX", 0, REG_DWORD, (LPBYTE)&left, sizeof(LONG));
- RegSetValueEx (hWinUAEKey, "GUIPosY", 0, REG_DWORD, (LPBYTE)&top, sizeof(LONG));
+ regsetint (NULL, "GUIPosX", left);
+ regsetint (NULL, "GUIPosY", top);
}
}
ew (hDlg, IDHELP, FALSE);
if (owner == NULL)
owner = GetDesktopWindow();
if (isfullscreen () <= 0) {
- DWORD regkeytype;
- DWORD regkeysize = sizeof(LONG);
- if (hWinUAEKey) {
- if (RegQueryValueEx (hWinUAEKey, "GUIPosX", 0, ®keytype, (LPBYTE)&x, ®keysize) != ERROR_SUCCESS)
- x = 0;
- if (RegQueryValueEx (hWinUAEKey, "GUIPosY", 0, ®keytype, (LPBYTE)&y, ®keysize) != ERROR_SUCCESS)
- y = 0;
- } else {
- x = y = 0;
- }
+ regqueryint (NULL, "GUIPosX", &x);
+ regqueryint (NULL, "GUIPosY", &y);
} else {
GetWindowRect (owner, &rcOwner);
GetWindowRect (hDlg, &rcDlg);
extern void pre_gui_message (const char*,...);
extern void gui_message_id (int id);
int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage);
-HKEY read_disk_history (void);
+UAEREG *read_disk_history (void);
void write_disk_history (void);
struct newresource
#include "sysdeps.h"
#include "resource.h"
+#include "registry.h"
#include "win32.h"
#include "win32gui.h"
RelativePath="..\posixemu.c"
>
</File>
+ <File
+ RelativePath="..\registry.c"
+ >
+ </File>
<File
RelativePath="..\cloanto\RetroPlatformGuestIPC.c"
>
RelativePath="..\posixemu.c"
>
</File>
+ <File
+ RelativePath="..\registry.c"
+ >
+ </File>
<File
RelativePath="..\cloanto\RetroPlatformGuestIPC.c"
>
+Beta 9:
+
+- default GUI and main window position is centered, not top/left corner
+- optional ini-file registry replacement.
+ * -ini <file> in command line: use <file>
+ * winuae.ini used if it is in same directory as winuae.exe
+ * file extension must be .ini or it will be ignored
+ * file will be silently deleted and re-created if
+ - it is read-only but not delete-protected
+ - if warning messages in ini-file are modified or deleted
+ - if it is not compatible with new version
+ * message will be added to both logs if registry replacement is
+ enabled. Bug reports without also testing in non-ini mode will be
+ ignored. Pointless Windows feature "discussions" won't be allowed.
+
Beta 8:
- AGA sprite doublescan fixed (b7)
- default hardware config (used by QS) clears pc drive mount checkboxes
- harddrive removal signal was not always send to uaehf.device if drive
was removed with disk still in drive (for example USB ZIP drive)
-- ACTION_SET_DATE notification check crashed if file didn't exist
+- directory filesystem ACTION_SET_DATE notification check crashed if
+ file didn't exist
- directory filesystem and hardfile slowdown fixed (b2)
- state save crashed if directory harddrives were configured but state
was saved before drive initialization, for example when booting
non-dos adf
-- always have empty memory space between Z3Fast and RTG RAM
+- always include empty memory space between Z3Fast and RTG RAM
Beta 7:
#include "debug.h"
#include "debug_win32.h"
#include "win32.h"
+#include "registry.h"
#define SHOW_CONSOLE 0
if (consoleopen > 0)
return;
if (debugger_type < 0) {
- DWORD regkeytype;
- DWORD regkeysize = sizeof(LONG);
- if (hWinUAEKey)
- RegQueryValueEx (hWinUAEKey, "DebuggerType", 0, ®keytype, (LPBYTE)&debugger_type, ®keysize);
+ regqueryint (NULL, "DebuggerType", &debugger_type);
if (debugger_type <= 0)
debugger_type = 2;
openconsole();
debugger_type = mode;
if (debugger_type != 1 && debugger_type != 2)
debugger_type = 2;
- if (hWinUAEKey)
- RegSetValueEx (hWinUAEKey, "DebuggerType", 0, REG_DWORD, (LPBYTE)&debugger_type, sizeof(LONG));
+ regsetint (NULL, "DebuggerType", debugger_type);
openconsole();
}
if (consoleopen >= 0)
return;
hwnd = myGetConsoleWindow();
- if (hwnd && hWinUAEKey) {
+ if (hwnd) {
int newpos = 1;
LONG x, y, w, h;
- DWORD regkeytype;
- DWORD regkeysize = sizeof(LONG);
- if (RegQueryValueEx (hWinUAEKey, "LoggerPosX", 0, ®keytype, (LPBYTE)&x, ®keysize) != ERROR_SUCCESS)
+ if (!regqueryint (NULL, "LoggerPosX", &x))
newpos = 0;
- if (RegQueryValueEx (hWinUAEKey, "LoggerPosY", 0, ®keytype, (LPBYTE)&y, ®keysize) != ERROR_SUCCESS)
+ if (!regqueryint (NULL, "LoggerPosY", &y))
newpos = 0;
- if (RegQueryValueEx (hWinUAEKey, "LoggerPosW", 0, ®keytype, (LPBYTE)&w, ®keysize) != ERROR_SUCCESS)
+ if (!regqueryint (NULL, "LoggerPosW", &w))
newpos = 0;
- if (RegQueryValueEx (hWinUAEKey, "LoggerPosH", 0, ®keytype, (LPBYTE)&h, ®keysize) != ERROR_SUCCESS)
+ if (!regqueryint (NULL, "LoggerPosH", &h))
newpos = 0;
if (newpos) {
RECT rc;
close_debug_window();
} else if (consoleopen < 0) {
HWND hwnd = myGetConsoleWindow();
- if (hwnd && hWinUAEKey) {
+ if (hwnd) {
RECT r;
if (GetWindowRect (hwnd, &r)) {
r.bottom -= r.top;
r.right -= r.left;
- RegSetValueEx (hWinUAEKey, "LoggerPosX", 0, REG_DWORD, (LPBYTE)&r.left, sizeof(LONG));
- RegSetValueEx (hWinUAEKey, "LoggerPosY", 0, REG_DWORD, (LPBYTE)&r.top, sizeof(LONG));
- RegSetValueEx (hWinUAEKey, "LoggerPosW", 0, REG_DWORD, (LPBYTE)&r.right, sizeof(LONG));
- RegSetValueEx (hWinUAEKey, "LoggerPosH", 0, REG_DWORD, (LPBYTE)&r.bottom, sizeof(LONG));
+ regsetint (NULL, "LoggerPosX", r.left);
+ regsetint (NULL, "LoggerPosY", r.top);
+ regsetint (NULL, "LoggerPosW", r.right);
+ regsetint (NULL, "LoggerPosH", r.bottom);
}
}
FreeConsole();