Changes to allow the VARCem binaries and support DLLs to be in <root>/bin, to keep things clean.
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Main include file for the application.
|
* Main include file for the application.
|
||||||
*
|
*
|
||||||
* Version: @(#)emu.h 1.0.3 2018/02/28
|
* Version: @(#)emu.h 1.0.4 2018/03/02
|
||||||
*
|
*
|
||||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
*
|
*
|
||||||
@@ -155,7 +155,7 @@ extern int serial_do_log;
|
|||||||
extern int nic_do_log;
|
extern int nic_do_log;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern wchar_t exe_path[1024]; /* path (dir) of executable */
|
extern wchar_t emu_path[1024]; /* emu installation path */
|
||||||
extern wchar_t usr_path[1024]; /* path (dir) of user data */
|
extern wchar_t usr_path[1024]; /* path (dir) of user data */
|
||||||
extern wchar_t cfg_path[1024]; /* full path of config file */
|
extern wchar_t cfg_path[1024]; /* full path of config file */
|
||||||
extern FILE *stdlog; /* file to log output to */
|
extern FILE *stdlog; /* file to log output to */
|
||||||
|
|||||||
36
src/pc.c
36
src/pc.c
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Main emulator module where most things are controlled.
|
* Main emulator module where most things are controlled.
|
||||||
*
|
*
|
||||||
* Version: @(#)pc.c 1.0.3 2018/03/01
|
* Version: @(#)pc.c 1.0.4 2018/03/02
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -175,7 +175,7 @@ int clockrate;
|
|||||||
|
|
||||||
int gfx_present[GFX_MAX]; /* should not be here */
|
int gfx_present[GFX_MAX]; /* should not be here */
|
||||||
|
|
||||||
wchar_t exe_path[1024]; /* path (dir) of executable */
|
wchar_t emu_path[1024]; /* emu installation path */
|
||||||
wchar_t usr_path[1024]; /* path (dir) of user data */
|
wchar_t usr_path[1024]; /* path (dir) of user data */
|
||||||
wchar_t cfg_path[1024]; /* full path of config file */
|
wchar_t cfg_path[1024]; /* full path of config file */
|
||||||
FILE *stdlog = NULL; /* file to log output to */
|
FILE *stdlog = NULL; /* file to log output to */
|
||||||
@@ -307,9 +307,33 @@ pc_init(int argc, wchar_t *argv[])
|
|||||||
int c;
|
int c;
|
||||||
|
|
||||||
/* Grab the executable's full path. */
|
/* Grab the executable's full path. */
|
||||||
plat_get_exe_name(exe_path, sizeof(exe_path)-1);
|
plat_get_exe_name(emu_path, sizeof(emu_path)-1);
|
||||||
p = plat_get_filename(exe_path);
|
if ((p = plat_get_basename(emu_path)) != NULL)
|
||||||
*p = L'\0';
|
*p = L'\0';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* See if we are perhaps in a "bin/" subfolder of
|
||||||
|
* the installation path, in which case the real
|
||||||
|
* root of the installation is one level up. We
|
||||||
|
* can test this by looking for the 'roms' folder.
|
||||||
|
*/
|
||||||
|
wcscpy(path, emu_path);
|
||||||
|
p = plat_get_basename(path);
|
||||||
|
plat_path_slash(path);
|
||||||
|
wcscat(path, ROMS_PATH);
|
||||||
|
if (! plat_dir_check(path)) {
|
||||||
|
/* No 'roms' folder found, so go up one level. */
|
||||||
|
if (p != NULL)
|
||||||
|
*p = L'\0';
|
||||||
|
plat_path_slash(path);
|
||||||
|
wcscat(path, ROMS_PATH);
|
||||||
|
if (plat_dir_check(path)) {
|
||||||
|
if (p != NULL)
|
||||||
|
*p = L'\0';
|
||||||
|
plat_path_slash(path);
|
||||||
|
wcscpy(emu_path, path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the current working directory.
|
* Get the current working directory.
|
||||||
@@ -481,7 +505,7 @@ usage:
|
|||||||
strftime(temp, sizeof(temp), "%Y/%m/%d %H:%M:%S", info);
|
strftime(temp, sizeof(temp), "%Y/%m/%d %H:%M:%S", info);
|
||||||
pclog("#\n# %ls v%ls logfile, created %s\n#\n",
|
pclog("#\n# %ls v%ls logfile, created %s\n#\n",
|
||||||
EMU_NAME_W, EMU_VERSION_W, temp);
|
EMU_NAME_W, EMU_VERSION_W, temp);
|
||||||
pclog("# Emulator path: %ls\n", exe_path);
|
pclog("# Emulator path: %ls\n", emu_path);
|
||||||
pclog("# Userfiles path: %ls\n", usr_path);
|
pclog("# Userfiles path: %ls\n", usr_path);
|
||||||
pclog("# Configuration file: %ls\n#\n\n", cfg_path);
|
pclog("# Configuration file: %ls\n#\n\n", cfg_path);
|
||||||
|
|
||||||
|
|||||||
13
src/plat.h
13
src/plat.h
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Define the various platform support functions.
|
* Define the various platform support functions.
|
||||||
*
|
*
|
||||||
* Version: @(#)plat.h 1.0.2 2018/02/21
|
* Version: @(#)plat.h 1.0.3 2018/03/02
|
||||||
*
|
*
|
||||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
*
|
*
|
||||||
@@ -101,16 +101,17 @@ GLOBAL char emu_version[128]; /* version ID string */
|
|||||||
|
|
||||||
|
|
||||||
/* System-related functions. */
|
/* System-related functions. */
|
||||||
extern wchar_t *fix_exe_path(wchar_t *str);
|
extern wchar_t *fix_emu_path(wchar_t *str);
|
||||||
extern FILE *plat_fopen(wchar_t *path, wchar_t *mode);
|
extern FILE *plat_fopen(wchar_t *path, wchar_t *mode);
|
||||||
extern void plat_remove(wchar_t *path);
|
extern void plat_remove(wchar_t *path);
|
||||||
extern int plat_getcwd(wchar_t *bufp, int max);
|
extern int plat_getcwd(wchar_t *bufp, int max);
|
||||||
extern int plat_chdir(wchar_t *path);
|
extern int plat_chdir(wchar_t *path);
|
||||||
extern void plat_get_exe_name(wchar_t *s, int size);
|
extern void plat_get_exe_name(wchar_t *path, int size);
|
||||||
extern wchar_t *plat_get_filename(wchar_t *s);
|
extern wchar_t *plat_get_basename(wchar_t *path);
|
||||||
extern wchar_t *plat_get_extension(wchar_t *s);
|
extern wchar_t *plat_get_filename(wchar_t *path);
|
||||||
|
extern wchar_t *plat_get_extension(wchar_t *path);
|
||||||
extern void plat_append_filename(wchar_t *dest, wchar_t *s1, wchar_t *s2);
|
extern void plat_append_filename(wchar_t *dest, wchar_t *s1, wchar_t *s2);
|
||||||
extern void plat_put_backslash(wchar_t *s);
|
extern void plat_put_backslash(wchar_t *path);
|
||||||
extern void plat_path_slash(wchar_t *path);
|
extern void plat_path_slash(wchar_t *path);
|
||||||
extern int plat_path_abs(wchar_t *path);
|
extern int plat_path_abs(wchar_t *path);
|
||||||
extern int plat_dir_check(wchar_t *path);
|
extern int plat_dir_check(wchar_t *path);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
* - c386sx16 BIOS fails checksum
|
* - c386sx16 BIOS fails checksum
|
||||||
* - the loadfont() calls should be done elsewhere
|
* - the loadfont() calls should be done elsewhere
|
||||||
*
|
*
|
||||||
* Version: @(#)rom.c 1.0.4 2018/02/26
|
* Version: @(#)rom.c 1.0.5 2018/03/02
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -63,7 +63,7 @@ rom_fopen(wchar_t *fn)
|
|||||||
{
|
{
|
||||||
wchar_t temp[1024];
|
wchar_t temp[1024];
|
||||||
|
|
||||||
wcscpy(temp, exe_path);
|
wcscpy(temp, emu_path);
|
||||||
plat_put_backslash(temp);
|
plat_put_backslash(temp);
|
||||||
wcscat(temp, fn);
|
wcscat(temp, fn);
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ rom_getfile(wchar_t *fn, wchar_t *s, int size)
|
|||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
||||||
wcscpy(s, exe_path);
|
wcscpy(s, emu_path);
|
||||||
plat_put_backslash(s);
|
plat_put_backslash(s);
|
||||||
wcscat(s, fn);
|
wcscat(s, fn);
|
||||||
|
|
||||||
|
|||||||
@@ -47,89 +47,89 @@
|
|||||||
|
|
||||||
# Various compile-time options.
|
# Various compile-time options.
|
||||||
ifndef STUFF
|
ifndef STUFF
|
||||||
STUFF :=
|
STUFF :=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Add feature selections here.
|
# Add feature selections here.
|
||||||
ifndef EXTRAS
|
ifndef EXTRAS
|
||||||
EXTRAS :=
|
EXTRAS :=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Defaults for several build options (possibly defined in a chained file.)
|
# Defaults for several build options (possibly defined in a chained file.)
|
||||||
ifndef AUTODEP
|
ifndef AUTODEP
|
||||||
AUTODEP := n
|
AUTODEP := n
|
||||||
endif
|
endif
|
||||||
ifndef CRASHDUMP
|
ifndef CRASHDUMP
|
||||||
CRASHDUMP := n
|
CRASHDUMP := n
|
||||||
endif
|
endif
|
||||||
ifndef CROSS
|
ifndef CROSS
|
||||||
CROSS := n
|
CROSS := n
|
||||||
endif
|
endif
|
||||||
ifndef DEBUG
|
ifndef DEBUG
|
||||||
DEBUG := n
|
DEBUG := n
|
||||||
endif
|
endif
|
||||||
ifndef OPTIM
|
ifndef OPTIM
|
||||||
OPTIM := n
|
OPTIM := n
|
||||||
endif
|
endif
|
||||||
ifndef RELEASE
|
ifndef RELEASE
|
||||||
RELEASE := n
|
RELEASE := n
|
||||||
endif
|
endif
|
||||||
ifndef X64
|
ifndef X64
|
||||||
X64 := n
|
X64 := n
|
||||||
endif
|
|
||||||
ifndef WX
|
|
||||||
WX := n
|
|
||||||
endif
|
|
||||||
ifndef USB
|
|
||||||
USB := n
|
|
||||||
endif
|
|
||||||
ifndef VNC
|
|
||||||
VNC := n
|
|
||||||
endif
|
|
||||||
ifndef RDP
|
|
||||||
RDP := n
|
|
||||||
endif
|
|
||||||
ifndef DEV_BUILD
|
|
||||||
DEV_BUILD := n
|
|
||||||
endif
|
|
||||||
ifndef DEV_BRANCH
|
|
||||||
DEV_BRANCH := n
|
|
||||||
endif
|
|
||||||
ifndef GREENB
|
|
||||||
GREENB := n
|
|
||||||
endif
|
|
||||||
ifndef LASERXT
|
|
||||||
LASERXT := n
|
|
||||||
endif
|
|
||||||
ifndef I686
|
|
||||||
I686 := n
|
|
||||||
ifndef AMD_K
|
|
||||||
AMD_K := n
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
ifndef OPENAL
|
|
||||||
OPENAL := y
|
|
||||||
endif
|
|
||||||
ifndef PORTABLE3
|
|
||||||
PORTABLE3 := n
|
|
||||||
endif
|
|
||||||
ifndef FLUIDSYNTH
|
|
||||||
FLUIDSYNTH := y
|
|
||||||
endif
|
|
||||||
ifndef MUNT
|
|
||||||
MUNT := y
|
|
||||||
endif
|
|
||||||
ifndef PAS16
|
|
||||||
PAS16 := n
|
|
||||||
endif
|
|
||||||
ifndef STEALTH32
|
|
||||||
STEALTH32 := n
|
|
||||||
endif
|
|
||||||
ifndef XL24
|
|
||||||
XL24 := n
|
|
||||||
endif
|
endif
|
||||||
ifndef DYNAREC
|
ifndef DYNAREC
|
||||||
DYNAREC := y
|
DYNAREC := y
|
||||||
|
endif
|
||||||
|
ifndef WX
|
||||||
|
WX := n
|
||||||
|
endif
|
||||||
|
ifndef USB
|
||||||
|
USB := n
|
||||||
|
endif
|
||||||
|
ifndef VNC
|
||||||
|
VNC := n
|
||||||
|
endif
|
||||||
|
ifndef RDP
|
||||||
|
RDP := n
|
||||||
|
endif
|
||||||
|
ifndef DEV_BUILD
|
||||||
|
DEV_BUILD := n
|
||||||
|
endif
|
||||||
|
ifndef DEV_BRANCH
|
||||||
|
DEV_BRANCH := n
|
||||||
|
endif
|
||||||
|
ifndef GREENB
|
||||||
|
GREENB := n
|
||||||
|
endif
|
||||||
|
ifndef LASERXT
|
||||||
|
LASERXT := n
|
||||||
|
endif
|
||||||
|
ifndef I686
|
||||||
|
I686 := n
|
||||||
|
endif
|
||||||
|
ifndef AMD_K
|
||||||
|
AMD_K := n
|
||||||
|
endif
|
||||||
|
ifndef PORTABLE3
|
||||||
|
PORTABLE3 := n
|
||||||
|
endif
|
||||||
|
ifndef OPENAL
|
||||||
|
OPENAL := y
|
||||||
|
endif
|
||||||
|
ifndef FLUIDSYNTH
|
||||||
|
FLUIDSYNTH := y
|
||||||
|
endif
|
||||||
|
ifndef MUNT
|
||||||
|
MUNT := y
|
||||||
|
endif
|
||||||
|
ifndef PAS16
|
||||||
|
PAS16 := n
|
||||||
|
endif
|
||||||
|
ifndef STEALTH32
|
||||||
|
STEALTH32 := n
|
||||||
|
endif
|
||||||
|
ifndef XL24
|
||||||
|
XL24 := n
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
@@ -143,17 +143,16 @@ ifndef PROG
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(DEV_BUILD), y)
|
ifeq ($(DEV_BUILD), y)
|
||||||
DEBUG := y
|
CRASHDUMP := y
|
||||||
CRASHDUMP := y
|
DEV_BRANCH := y
|
||||||
DEV_BRANCH := y
|
I686 := y
|
||||||
I686 := y
|
AMD_K := y
|
||||||
AMD_K := y
|
GREENB := y
|
||||||
GREENB := y
|
PORTABLE3 := y
|
||||||
PORTABLE3 := y
|
LASERXT := y
|
||||||
LASERXT := y
|
PAS16 := y
|
||||||
PAS16 := y
|
STEALTH32 := y
|
||||||
STEALTH32 := y
|
XL24 := y
|
||||||
XL24 := y
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# WxWidgets basic info. Extract using the config program.
|
# WxWidgets basic info. Extract using the config program.
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Platform main support module for Windows.
|
* Platform main support module for Windows.
|
||||||
*
|
*
|
||||||
* Version: @(#)win.c 1.0.2 2018/03/02
|
* Version: @(#)win.c 1.0.3 2018/03/02
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -485,9 +485,9 @@ do_stop(void)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
plat_get_exe_name(wchar_t *s, int size)
|
plat_get_exe_name(wchar_t *bufp, int size)
|
||||||
{
|
{
|
||||||
GetModuleFileName(hinstance, s, size);
|
GetModuleFileName(hinstance, bufp, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -543,36 +543,52 @@ plat_path_abs(wchar_t *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Return the last element of a pathname. */
|
||||||
wchar_t *
|
wchar_t *
|
||||||
plat_get_filename(wchar_t *s)
|
plat_get_basename(wchar_t *path)
|
||||||
{
|
{
|
||||||
int c = wcslen(s) - 1;
|
int c = wcslen(path);
|
||||||
|
|
||||||
while (c > 0) {
|
while (c > 0) {
|
||||||
if (s[c] == L'/' || s[c] == L'\\')
|
if (path[c] == L'/' || path[c] == L'\\')
|
||||||
return(&s[c+1]);
|
return(&path[c]);
|
||||||
c--;
|
c--;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(s);
|
return(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wchar_t *
|
wchar_t *
|
||||||
plat_get_extension(wchar_t *s)
|
plat_get_filename(wchar_t *path)
|
||||||
{
|
{
|
||||||
int c = wcslen(s) - 1;
|
int c = wcslen(path) - 1;
|
||||||
|
|
||||||
|
while (c > 0) {
|
||||||
|
if (path[c] == L'/' || path[c] == L'\\')
|
||||||
|
return(&path[c+1]);
|
||||||
|
c--;
|
||||||
|
}
|
||||||
|
|
||||||
|
return(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wchar_t *
|
||||||
|
plat_get_extension(wchar_t *path)
|
||||||
|
{
|
||||||
|
int c = wcslen(path) - 1;
|
||||||
|
|
||||||
if (c <= 0)
|
if (c <= 0)
|
||||||
return(s);
|
return(path);
|
||||||
|
|
||||||
while (c && s[c] != L'.')
|
while (c && path[c] != L'.')
|
||||||
c--;
|
c--;
|
||||||
|
|
||||||
if (!c)
|
if (!c)
|
||||||
return(&s[wcslen(s)]);
|
return(&path[wcslen(path)]);
|
||||||
|
|
||||||
return(&s[c+1]);
|
return(&path[c+1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -585,12 +601,12 @@ plat_append_filename(wchar_t *dest, wchar_t *s1, wchar_t *s2)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
plat_put_backslash(wchar_t *s)
|
plat_put_backslash(wchar_t *path)
|
||||||
{
|
{
|
||||||
int c = wcslen(s) - 1;
|
int c = wcslen(path) - 1;
|
||||||
|
|
||||||
if (s[c] != L'/' && s[c] != L'\\')
|
if (path[c] != L'/' && path[c] != L'\\')
|
||||||
s[c] = L'/';
|
path[c] = L'/';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user