Minor cleanups. Logfile now has a header. We no longer log the entire config file, use -C (--dumpcfg) to enable that.
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Main include file for the application.
|
* Main include file for the application.
|
||||||
*
|
*
|
||||||
* Version: @(#)86box.h 1.0.6 2017/10/18
|
* Version: @(#)86box.h 1.0.7 2017/10/21
|
||||||
*
|
*
|
||||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
@@ -58,6 +58,7 @@ extern "C" {
|
|||||||
|
|
||||||
/* Global variables. */
|
/* Global variables. */
|
||||||
extern int dump_on_exit; /* (O) dump regs on exit*/
|
extern int dump_on_exit; /* (O) dump regs on exit*/
|
||||||
|
extern int do_dump_config; /* (O) dump cfg after load */
|
||||||
extern int start_in_fullscreen; /* (O) start in fullscreen */
|
extern int start_in_fullscreen; /* (O) start in fullscreen */
|
||||||
|
|
||||||
extern int window_w, window_h, /* (C) window size and */
|
extern int window_w, window_h, /* (C) window size and */
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Configuration file handler.
|
* Configuration file handler.
|
||||||
*
|
*
|
||||||
* Version: @(#)config.c 1.0.25 2017/10/19
|
* Version: @(#)config.c 1.0.25 2017/10/21
|
||||||
*
|
*
|
||||||
* Authors: Sarah Walker,
|
* Authors: Sarah Walker,
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -329,6 +329,7 @@ config_read(wchar_t *fn)
|
|||||||
|
|
||||||
(void)fclose(f);
|
(void)fclose(f);
|
||||||
|
|
||||||
|
if (do_dump_config)
|
||||||
config_dump();
|
config_dump();
|
||||||
|
|
||||||
return(1);
|
return(1);
|
||||||
|
|||||||
53
src/pc.c
53
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.29 2017/10/19
|
* Version: @(#)pc.c 1.0.31 2017/10/21
|
||||||
*
|
*
|
||||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <time.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
#include "86box.h"
|
#include "86box.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@@ -79,6 +80,7 @@
|
|||||||
|
|
||||||
/* Commandline options. */
|
/* Commandline options. */
|
||||||
int dump_on_exit = 0; /* (O) dump regs on exit */
|
int dump_on_exit = 0; /* (O) dump regs on exit */
|
||||||
|
int do_dump_config = 0; /* (O) dump config on load */
|
||||||
int start_in_fullscreen = 0; /* (O) start in fullscreen */
|
int start_in_fullscreen = 0; /* (O) start in fullscreen */
|
||||||
|
|
||||||
/* Configuration values. */
|
/* Configuration values. */
|
||||||
@@ -286,6 +288,9 @@ int
|
|||||||
pc_init(int argc, wchar_t *argv[])
|
pc_init(int argc, wchar_t *argv[])
|
||||||
{
|
{
|
||||||
wchar_t *cfg = NULL, *p;
|
wchar_t *cfg = NULL, *p;
|
||||||
|
char temp[128];
|
||||||
|
struct tm *info;
|
||||||
|
time_t now;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
/* Grab the executable's full path. */
|
/* Grab the executable's full path. */
|
||||||
@@ -310,11 +315,15 @@ usage:
|
|||||||
printf("\nUsage: 86box [options] [cfg-file]\n\n");
|
printf("\nUsage: 86box [options] [cfg-file]\n\n");
|
||||||
printf("Valid options are:\n\n");
|
printf("Valid options are:\n\n");
|
||||||
printf("-? or --help - show this information\n");
|
printf("-? or --help - show this information\n");
|
||||||
|
printf("-C or --dumpcfg - dump config file after loading\n");
|
||||||
printf("-D or --dump - dump memory on exit\n");
|
printf("-D or --dump - dump memory on exit\n");
|
||||||
printf("-F or --fullscreen - start in fullscreen mode\n");
|
printf("-F or --fullscreen - start in fullscreen mode\n");
|
||||||
printf("-P or --vmpath path - set 'path' to be root for vm\n");
|
printf("-P or --vmpath path - set 'path' to be root for vm\n");
|
||||||
printf("\nA config file can be specified. If none is, the default file will be used.\n");
|
printf("\nA config file can be specified. If none is, the default file will be used.\n");
|
||||||
return(0);
|
return(0);
|
||||||
|
} else if (!wcscasecmp(argv[c], L"--dumpcfg") ||
|
||||||
|
!wcscasecmp(argv[c], L"-C")) {
|
||||||
|
do_dump_config = 1;
|
||||||
} else if (!wcscasecmp(argv[c], L"--dump") ||
|
} else if (!wcscasecmp(argv[c], L"--dump") ||
|
||||||
!wcscasecmp(argv[c], L"-D")) {
|
!wcscasecmp(argv[c], L"-D")) {
|
||||||
dump_on_exit = 1;
|
dump_on_exit = 1;
|
||||||
@@ -342,14 +351,7 @@ usage:
|
|||||||
cfg = argv[c++];
|
cfg = argv[c++];
|
||||||
if (c != argc) goto usage;
|
if (c != argc) goto usage;
|
||||||
|
|
||||||
/*
|
|
||||||
* This is where we start outputting to the log file,
|
|
||||||
* if there is one. Maybe we should log a header with
|
|
||||||
* application build info and such? --FvK
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Make sure cfg_path has a trailing backslash. */
|
/* Make sure cfg_path has a trailing backslash. */
|
||||||
pclog("exe_path=%ls\n", exe_path);
|
|
||||||
if ((cfg_path[wcslen(cfg_path)-1] != L'\\') &&
|
if ((cfg_path[wcslen(cfg_path)-1] != L'\\') &&
|
||||||
(cfg_path[wcslen(cfg_path)-1] != L'/')) {
|
(cfg_path[wcslen(cfg_path)-1] != L'/')) {
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@@ -358,7 +360,6 @@ usage:
|
|||||||
wcscat(cfg_path, L"/");
|
wcscat(cfg_path, L"/");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
pclog("cfg_path=%ls\n", cfg_path);
|
|
||||||
|
|
||||||
if (cfg != NULL) {
|
if (cfg != NULL) {
|
||||||
/*
|
/*
|
||||||
@@ -383,6 +384,19 @@ usage:
|
|||||||
plat_append_filename(config_file_default, cfg_path, CONFIG_FILE_W, 511);
|
plat_append_filename(config_file_default, cfg_path, CONFIG_FILE_W, 511);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is where we start outputting to the log file,
|
||||||
|
* if there is one. Create a little info header first.
|
||||||
|
*/
|
||||||
|
(void)time(&now);
|
||||||
|
info = localtime(&now);
|
||||||
|
strftime(temp, sizeof(temp), "%Y/%m/%d %H:%M:%S", info);
|
||||||
|
pclog("#\n# %ls v%ls logfile, created %s\n#\n",
|
||||||
|
EMU_NAME_W, EMU_VERSION_W, temp);
|
||||||
|
pclog("# Emulator path: %ls\n", exe_path);
|
||||||
|
pclog("# Userfiles path: %ls\n", cfg_path);
|
||||||
|
pclog("# Configuration file: %ls\n#\n\n", config_file_default);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We are about to read the configuration file, which MAY
|
* We are about to read the configuration file, which MAY
|
||||||
* put data into global variables (the hard- and floppy
|
* put data into global variables (the hard- and floppy
|
||||||
@@ -946,28 +960,7 @@ pc_thread(void *param)
|
|||||||
|
|
||||||
/* If needed, hand a screen resize. */
|
/* If needed, hand a screen resize. */
|
||||||
if (!video_fullscreen && doresize && (scrnsz_x>0) && (scrnsz_y>0)) {
|
if (!video_fullscreen && doresize && (scrnsz_x>0) && (scrnsz_y>0)) {
|
||||||
#if 1
|
|
||||||
plat_resize(scrnsz_x, scrnsz_y);
|
plat_resize(scrnsz_x, scrnsz_y);
|
||||||
#else
|
|
||||||
SendMessage(hwndSBAR, SB_GETBORDERS, 0, (LPARAM)sb_borders);
|
|
||||||
GetWindowRect(hwndMain, &r);
|
|
||||||
MoveWindow(hwndRender, 0, 0, scrnsz_x, scrnsz_y, TRUE);
|
|
||||||
GetWindowRect(hwndRender, &r);
|
|
||||||
MoveWindow(hwndSBAR,
|
|
||||||
0, r.bottom+GetSystemMetrics(SM_CYEDGE),
|
|
||||||
scrnsz_x, 17, TRUE);
|
|
||||||
GetWindowRect(hwndMain, &r);
|
|
||||||
|
|
||||||
MoveWindow(hwndMain, r.left, r.top,
|
|
||||||
scrnsz_x+(GetSystemMetrics(vid_resize ? SM_CXSIZEFRAME : SM_CXFIXEDFRAME) * 2),
|
|
||||||
scrnsz_y+(GetSystemMetrics(SM_CYEDGE)*2)+(GetSystemMetrics(vid_resize?SM_CYSIZEFRAME:SM_CYFIXEDFRAME)*2)+GetSystemMetrics(SM_CYMENUSIZE)+GetSystemMetrics(SM_CYCAPTION)+17+sb_borders[1]+1,
|
|
||||||
TRUE);
|
|
||||||
|
|
||||||
if (mousecapture) {
|
|
||||||
GetWindowRect(hwndRender, &r);
|
|
||||||
ClipCursor(&r);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
doresize = 0;
|
doresize = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
23
src/plat.h
23
src/plat.h
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Define the various platform support functions.
|
* Define the various platform support functions.
|
||||||
*
|
*
|
||||||
* Version: @(#)plat.h 1.0.11 2017/10/18
|
* Version: @(#)plat.h 1.0.12 2017/10/19
|
||||||
*
|
*
|
||||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
@@ -38,7 +38,6 @@ GLOBAL int dopause, /* system is paused */
|
|||||||
quited, /* system exit requested */
|
quited, /* system exit requested */
|
||||||
leave_fullscreen_flag; /* windowed-mode requested */
|
leave_fullscreen_flag; /* windowed-mode requested */
|
||||||
GLOBAL uint64_t timer_freq;
|
GLOBAL uint64_t timer_freq;
|
||||||
//GLOBAL int efwinsizey;
|
|
||||||
GLOBAL int infocus;
|
GLOBAL int infocus;
|
||||||
GLOBAL int mousecapture;
|
GLOBAL int mousecapture;
|
||||||
|
|
||||||
@@ -99,28 +98,24 @@ typedef void thread_t;
|
|||||||
typedef void event_t;
|
typedef void event_t;
|
||||||
typedef void mutex_t;
|
typedef void mutex_t;
|
||||||
|
|
||||||
extern thread_t *thread_create(void (*thread_rout)(void *param), void *param);
|
extern thread_t *thread_create(void (*thread_func)(void *param), void *param);
|
||||||
extern void thread_kill(thread_t *handle);
|
extern void thread_kill(thread_t *arg);
|
||||||
|
|
||||||
extern int thread_wait(thread_t *arg, int timeout);
|
extern int thread_wait(thread_t *arg, int timeout);
|
||||||
extern void thread_sleep(int t);
|
|
||||||
|
|
||||||
extern event_t *thread_create_event(void);
|
extern event_t *thread_create_event(void);
|
||||||
extern void thread_set_event(event_t *event);
|
extern void thread_set_event(event_t *arg);
|
||||||
extern void thread_reset_event(event_t *_event);
|
extern void thread_reset_event(event_t *arg);
|
||||||
extern int thread_wait_event(event_t *event, int timeout);
|
extern int thread_wait_event(event_t *arg, int timeout);
|
||||||
extern void thread_destroy_event(event_t *_event);
|
extern void thread_destroy_event(event_t *arg);
|
||||||
|
|
||||||
extern mutex_t *thread_create_mutex(wchar_t *name);
|
extern mutex_t *thread_create_mutex(wchar_t *name);
|
||||||
extern void thread_close_mutex(mutex_t *mutex);
|
extern void thread_close_mutex(mutex_t *arg);
|
||||||
extern int thread_wait_mutex(mutex_t *mutex);
|
extern int thread_wait_mutex(mutex_t *arg);
|
||||||
extern int thread_release_mutex(mutex_t *mutex);
|
extern int thread_release_mutex(mutex_t *mutex);
|
||||||
|
|
||||||
|
|
||||||
/* Other stuff. */
|
/* Other stuff. */
|
||||||
extern void startblit(void);
|
extern void startblit(void);
|
||||||
extern void endblit(void);
|
extern void endblit(void);
|
||||||
extern void leave_fullscreen(void);
|
|
||||||
extern void take_screenshot(void);
|
extern void take_screenshot(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Implement threads and mutexes for the Win32 platform.
|
* Implement threads and mutexes for the Win32 platform.
|
||||||
*
|
*
|
||||||
* Version: @(#)win_thread.c 1.0.4 2017/10/16
|
* Version: @(#)win_thread.c 1.0.5 2017/10/19
|
||||||
*
|
*
|
||||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
@@ -36,26 +36,19 @@ typedef struct {
|
|||||||
} win_event_t;
|
} win_event_t;
|
||||||
|
|
||||||
|
|
||||||
void *
|
thread_t *
|
||||||
thread_create(void (*thread_rout)(void *param), void *param)
|
thread_create(void (*func)(void *param), void *param)
|
||||||
{
|
{
|
||||||
return((void *)_beginthread(thread_rout, 0, param));
|
return((thread_t *)_beginthread(func, 0, param));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
thread_kill(void *handle)
|
thread_kill(void *arg)
|
||||||
{
|
{
|
||||||
if (handle == NULL) return;
|
if (arg == NULL) return;
|
||||||
|
|
||||||
TerminateThread(handle, 0);
|
TerminateThread(arg, 0);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
thread_sleep(int t)
|
|
||||||
{
|
|
||||||
Sleep(t);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user