Merge branch 'master' of ssh://github.com/86Box/86Box into cleanup30

# Conflicts:
#	src/cdrom/cdrom_image.c
#	src/cdrom/cdrom_image_backend.c
This commit is contained in:
RichardG867
2022-04-21 13:35:15 -03:00
190 changed files with 7184 additions and 3732 deletions

View File

@@ -43,7 +43,7 @@
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
</application>
</compatibility>
</assembly>

View File

@@ -16,7 +16,7 @@
enable_language(RC)
add_library(plat OBJECT win.c win_dynld.c win_cdrom.c win_keyboard.c
win_crashdump.c win_mouse.c)
win_mouse.c)
add_library(ui OBJECT win_ui.c win_icon.c win_stbar.c win_sdl.c win_dialog.c win_about.c
win_settings.c win_devconf.c win_snd_gain.c win_specify_dim.c win_new_floppy.c

View File

@@ -37,9 +37,15 @@ ifeq ($(DEV_BUILD), y)
ifndef AMD_K5
AMD_K5 := y
endif
ifndef AN430TX
AN430TX := y
endif
ifndef CYRIX_6X86
CYRIX_6X86 := y
endif
ifndef DESKPRO386
DESKPRO386 := y
endif
ifndef GUSMAX
GUSMAX := y
endif
@@ -58,8 +64,8 @@ ifeq ($(DEV_BUILD), y)
ifndef MGA
MGA := y
endif
ifndef NO_SIO
NO_SIO := y
ifndef OLIVETTI
OLIVETTI := y
endif
ifndef OPEN_AT
OPEN_AT := y
@@ -70,21 +76,15 @@ ifeq ($(DEV_BUILD), y)
ifndef SIO_DETECT
SIO_DETECT := y
endif
ifndef VGAWONDER
VGAWONDER := y
endif
ifndef TANDY_ISA
TANDY_ISA := y
endif
ifndef VNC
VNC := y
ifndef VGAWONDER
VGAWONDER := y
endif
ifndef XL24
XL24 := y
endif
ifndef OLIVETTI
OLIVETTI := y
endif
ifndef NEW_KBC
NEW_KBC := n
endif
@@ -98,9 +98,15 @@ else
ifndef AMD_K5
AMD_K5 := n
endif
ifndef AN430TX
AN430TX := n
endif
ifndef CYRIX_6X86
CYRIX_6X86 := n
endif
ifndef DESKPRO386
DESKPRO386 := n
endif
ifndef GUSMAX
GUSMAX := n
endif
@@ -119,8 +125,8 @@ else
ifndef MGA
MGA := n
endif
ifndef NO_SIO
NO_SIO := n
ifndef OLIVETTI
OLIVETTI := n
endif
ifndef OPEN_AT
OPEN_AT := n
@@ -131,21 +137,15 @@ else
ifndef SIO_DETECT
SIO_DETECT := n
endif
ifndef VGAWONDER
VGAWONDER := n
endif
ifndef TANDY_ISA
TANDY_ISA := n
endif
ifndef VNC
VNC := n
ifndef VGAWONDER
VGAWONDER := n
endif
ifndef XL24
XL24 := n
endif
ifndef OLIVETTI
OLIVETTI := n
endif
ifndef NEW_KBC
NEW_KBC := n
endif
@@ -182,6 +182,9 @@ endif
ifndef MUNT
MUNT := y
endif
ifndef VNC
VNC := n
endif
ifndef NEW_DYNAREC
NEW_DYNAREC := n
endif
@@ -427,10 +430,18 @@ ifeq ($(AMD_K5), y)
OPTS += -DUSE_AMD_K5
endif
ifeq ($(AN430TX), y)
OPTS += -DUSE_AN430TX
endif
ifeq ($(CYRIX_6X86), y)
OPTS += -DUSE_CYRIX_6X86
endif
ifeq ($(DESKPRO386), y)
OPTS += -DUSE_DESKPRO386
endif
ifeq ($(GUSMAX), y)
OPTS += -DUSE_GUSMAX
endif
@@ -457,10 +468,6 @@ OPTS += -DUSE_MGA
DEVBROBJ += vid_mga.o
endif
ifeq ($(NO_SIO), y)
OPTS += -DNO_SIO
endif
ifeq ($(OPEN_AT), y)
OPTS += -DUSE_OPEN_AT
endif
@@ -720,7 +727,6 @@ VOODOOOBJ := vid_voodoo.o vid_voodoo_banshee.o \
PLATOBJ := win.o \
win_dynld.o \
win_cdrom.o win_keyboard.o \
win_crashdump.o \
win_mouse.o
UIOBJ := win_ui.o win_icon.o win_stbar.o discord.o \

View File

@@ -47,8 +47,10 @@
#include <86box/video.h>
#include <86box/mem.h>
#include <86box/rom.h>
#include <86box/path.h>
#define GLOBAL
#include <86box/plat.h>
#include <86box/thread.h>
#include <86box/ui.h>
#ifdef USE_VNC
# include <86box/vnc.h>
@@ -493,10 +495,6 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nCmdShow)
return(1);
}
/* Enable crash dump services. */
if (enable_crashdump)
InitCrashDump();
/* Create console window. */
if (force_debug) {
CreateConsole(1);
@@ -740,14 +738,14 @@ plat_remove(char *path)
}
void
plat_path_normalize(char* path)
path_normalize(char* path)
{
/* No-op */
}
/* Make sure a path ends with a trailing (back)slash. */
void
plat_path_slash(char *path)
path_slash(char *path)
{
if ((path[strlen(path)-1] != '\\') &&
(path[strlen(path)-1] != '/')) {
@@ -758,7 +756,7 @@ plat_path_slash(char *path)
/* Check if the given path is absolute or not. */
int
plat_path_abs(char *path)
path_abs(char *path)
{
if ((path[1] == ':') || (path[0] == '\\') || (path[0] == '/'))
return(1);
@@ -785,7 +783,7 @@ plat_get_basename(const char *path)
/* Return the 'directory' element of a pathname. */
void
plat_get_dirname(char *dest, const char *path)
path_get_dirname(char *dest, const char *path)
{
int c = (int)strlen(path);
char *ptr;
@@ -808,7 +806,7 @@ plat_get_dirname(char *dest, const char *path)
char *
plat_get_filename(char *s)
path_get_filename(char *s)
{
int c = strlen(s) - 1;
@@ -823,7 +821,7 @@ plat_get_filename(char *s)
char *
plat_get_extension(char *s)
path_get_extension(char *s)
{
int c = strlen(s) - 1;
@@ -841,10 +839,10 @@ plat_get_extension(char *s)
void
plat_append_filename(char *dest, const char *s1, const char *s2)
path_append_filename(char *dest, const char *s1, const char *s2)
{
strcpy(dest, s1);
plat_path_slash(dest);
path_slash(dest);
strcat(dest, s2);
}
@@ -917,22 +915,22 @@ plat_init_rom_paths()
{
wchar_t appdata_dir[1024] = { L'\0' };
if (_wgetenv("LOCALAPPDATA") && _wgetenv("LOCALAPPDATA")[0] != L'\0') {
if (_wgetenv(L"LOCALAPPDATA") && _wgetenv(L"LOCALAPPDATA")[0] != L'\0') {
char appdata_dir_a[1024] = { '\0' };
size_t len = 0;
wcsncpy(appdata_dir, _wgetenv("LOCALAPPDATA"), 1024);
wcsncpy(appdata_dir, _wgetenv(L"LOCALAPPDATA"), 1024);
len = wcslen(appdata_dir);
if (appdata_dir[len - 1] != L'\\') {
appdata_dir[len] = L'\\';
appdata_dir[len + 1] = L'\0';
}
wcscat(appdata_dir, "86box");
wcscat(appdata_dir, L"86box");
CreateDirectoryW(appdata_dir, NULL);
wcscat(appdata_dir, "\\roms");
wcscat(appdata_dir, L"\\roms");
CreateDirectoryW(appdata_dir, NULL);
wcscat(appdata_dir, "\\");
wcscat(appdata_dir, L"\\");
c16stombs(appdata_dir_a, appdata_dir, 1024);
add_rom_path(appdata_dir_a);
rom_add_path(appdata_dir_a);
}
}

View File

@@ -1,245 +0,0 @@
/*
* 86Box A hypervisor and IBM PC system emulator that specializes in
* running old operating systems and software designed for IBM
* PC systems and compatibles from 1981 through fairly recent
* system designs based on the PCI bus.
*
* This file is part of the 86Box distribution.
*
* Handle generation of crash-dump reports.
*
*
*
* Authors: Riley
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2016,2017 Riley.
* Copyright 2016,2017 Miran Grca.
* Copyright 2017 Fred N. van Kempen.
*/
#define _WIN32_WINNT 0x0501
#include <windows.h>
#include <psapi.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <86box/86box.h>
#include <86box/plat.h>
#include <86box/win.h>
#define ExceptionHandlerBufferSize (10240)
static PVOID hExceptionHandler;
static char *ExceptionHandlerBuffer,
*CurrentBufferPointer;
LONG CALLBACK MakeCrashDump(PEXCEPTION_POINTERS ExceptionInfo)
{
SYSTEMTIME SystemTime;
HANDLE hDumpFile;
char *BufPtr;
/*
* Win32-specific functions will be used wherever possible,
* just in case the C stdlib-equivalents try to allocate
* memory.
* (The Win32-specific functions are generally just wrappers
* over NT system calls anyway.)
*/
if ((ExceptionInfo->ExceptionRecord->ExceptionCode >> 28) != 0xC) {
/*
* ExceptionCode is not a fatal exception (high 4b of
* ntstatus = 0xC) Not going to crash, let's not make
* a crash dump.
*/
return(EXCEPTION_CONTINUE_SEARCH);
}
/*
* So, the program is about to crash. Oh no what do?
* Let's create a crash dump file as a debugging-aid.
*
* First, get the path to the executable.
*/
GetModuleFileName(NULL,ExceptionHandlerBuffer,ExceptionHandlerBufferSize);
if (GetLastError() != ERROR_SUCCESS) {
/* Could not get full path, create in current directory. */
BufPtr = ExceptionHandlerBuffer;
} else {
/*
* Walk through the string backwards looking for the
* last backslash, so as to remove the "86Box.exe"
* filename from the string.
*/
BufPtr = &ExceptionHandlerBuffer[strlen(ExceptionHandlerBuffer)];
for (; BufPtr > ExceptionHandlerBuffer; BufPtr--) {
if (BufPtr[0] == '\\') {
/* Found backslash, terminate the string after it. */
BufPtr[1] = 0;
break;
}
}
BufPtr = &ExceptionHandlerBuffer[strlen(ExceptionHandlerBuffer)];
}
/*
* What would a good filename be?
*
* It should contain the current date and time so as
* to be (hopefully!) unique.
*/
GetSystemTime(&SystemTime);
sprintf(CurrentBufferPointer,
"86box-%d%02d%02d-%02d-%02d-%02d-%03d.dmp",
SystemTime.wYear,
SystemTime.wMonth,
SystemTime.wDay,
SystemTime.wHour,
SystemTime.wMinute,
SystemTime.wSecond,
SystemTime.wMilliseconds);
/* Now the filename is in the buffer, the file can be created. */
hDumpFile = CreateFile(
ExceptionHandlerBuffer, // The filename of the file to open.
GENERIC_WRITE, // The permissions to request.
0, // Make sure other processes can't
// touch the crash dump at all
// while it's open.
NULL, // Leave the security descriptor
// undefined, it doesn't matter.
OPEN_ALWAYS, // Opens the file if it exists,
// creates a new file if it doesn't.
FILE_ATTRIBUTE_NORMAL, // File attributes / etc don't matter.
NULL); // A template file is not being used.
/* Check to make sure the file was actually created. */
if (hDumpFile == INVALID_HANDLE_VALUE) {
/* CreateFile() failed, so just do nothing more. */
return(EXCEPTION_CONTINUE_SEARCH);
}
/*
* Write the data we were passed out in a human-readable format.
*
* Get the name of the module where the exception occurred.
*/
HMODULE hMods[1024];
MODULEINFO modInfo;
HMODULE ipModule = 0;
DWORD cbNeeded;
/* Try to get a list of all loaded modules. */
if (EnumProcessModules(GetCurrentProcess(),
hMods, sizeof(hMods), &cbNeeded)) {
/* Got it, now walk through all modules.. */
for (DWORD i = 0; i < (cbNeeded / sizeof(HMODULE)); i++) {
/* For each module, get the module information. */
GetModuleInformation(GetCurrentProcess(),
hMods[i], &modInfo, sizeof(MODULEINFO));
/* If the exception address is in the range of this module.. */
if ( (ExceptionInfo->ExceptionRecord->ExceptionAddress >= modInfo.lpBaseOfDll) &&
(ExceptionInfo->ExceptionRecord->ExceptionAddress < (void*)((char*)modInfo.lpBaseOfDll + modInfo.SizeOfImage))) {
/* ...this is the module we're looking for! */
ipModule = hMods[i];
break;
}
}
}
/* Start to put the crash-dump string into the buffer. */
sprintf(ExceptionHandlerBuffer,
"#\r\n# %s\r\n#\r\n"
"# Crash on %d-%02d-%02d at %02d:%02d:%02d.%03d\r\n#\r\n"
"\r\n"
"Exception details:\r\n"
" NTSTATUS code: 0x%08lx\r\n Address: 0x%p",
emu_version,
SystemTime.wYear, SystemTime.wMonth, SystemTime.wDay,
SystemTime.wHour, SystemTime.wMinute, SystemTime.wSecond,
SystemTime.wMilliseconds,
ExceptionInfo->ExceptionRecord->ExceptionCode,
(void *)ExceptionInfo->ExceptionRecord->ExceptionAddress);
/*
* If we found the correct module, get the full path to
* the module the exception occured at and include it.
*/
BufPtr = &ExceptionHandlerBuffer[strlen(ExceptionHandlerBuffer)];
if (ipModule != 0) {
sprintf(BufPtr," [");
GetModuleFileName(ipModule, &BufPtr[2],
ExceptionHandlerBufferSize - strlen(ExceptionHandlerBuffer));
if (GetLastError() == ERROR_SUCCESS) {
BufPtr = &ExceptionHandlerBuffer[strlen(ExceptionHandlerBuffer)];
sprintf(BufPtr,"]");
BufPtr += 1;
}
}
sprintf(BufPtr,
"\r\nNumber of parameters: %lu\r\nException parameters: ",
ExceptionInfo->ExceptionRecord->NumberParameters);
for (int i = 0; i < ExceptionInfo->ExceptionRecord->NumberParameters; i++) {
BufPtr = &ExceptionHandlerBuffer[strlen(ExceptionHandlerBuffer)];
sprintf(BufPtr,"0x%p ",
(void *)ExceptionInfo->ExceptionRecord->ExceptionInformation[i]);
}
BufPtr = &ExceptionHandlerBuffer[strlen(ExceptionHandlerBuffer) - 1];
#if defined(__i386__) && !defined(__x86_64)
PCONTEXT Registers = ExceptionInfo->ContextRecord;
/* This binary is being compiled for x86, include a register dump. */
sprintf(BufPtr,
"\r\n\r\nRegister dump:\r\n\r\n"
"EIP:0x%08lx\r\n"
"EAX:0x%08lx EBX:0x%08lx ECX:0x%08lx EDX:0x%08lx\r\n"
"EBP:0x%08lx ESP:0x%08lx ESI:0x%08lx EDI:0x%08lx\r\n\r\n",
Registers->Eip,
Registers->Eax, Registers->Ebx, Registers->Ecx, Registers->Edx,
Registers->Ebp, Registers->Esp, Registers->Esi, Registers->Edi);
#else
/* Register dump not supported by this architecture. */
/* (MinGW headers seem to lack the x64 CONTEXT structure definition) */
sprintf(BufPtr, "\r\n");
#endif
/* Write the string to disk. */
WriteFile(hDumpFile, ExceptionHandlerBuffer,
strlen(ExceptionHandlerBuffer), NULL, NULL);
/* Close the file. */
CloseHandle(hDumpFile);
/* Return, therefore causing the crash. */
return(EXCEPTION_CONTINUE_SEARCH);
}
void
InitCrashDump(void)
{
/*
* An exception handler should not allocate memory,
* so allocate 10kb for it to use if it gets called,
* an amount which should be more than enough.
*/
ExceptionHandlerBuffer = malloc(ExceptionHandlerBufferSize);
CurrentBufferPointer = ExceptionHandlerBuffer;
/*
* Register the exception handler.
* Zero first argument means this exception handler gets
* called last, therefore, crash dump is only made, when
* a crash is going to happen.
*/
hExceptionHandler = AddVectoredExceptionHandler(0, MakeCrashDump);
}

View File

@@ -45,7 +45,10 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND h;
int val_int, id, c, d, num;
int val_int, id, c, d;
#ifdef USE_RTMIDI
int num;
#endif
int changed, cid;
const device_config_t *config;
const device_config_selection_t *selection;
@@ -81,7 +84,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
(char *) config->name, config->default_int);
c = 0;
while (selection->description && selection->description[0]) {
while (selection && selection->description && selection->description[0]) {
mbstowcs(lptsTemp, selection->description,
strlen(selection->description) + 1);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)lptsTemp);
@@ -146,7 +149,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
(char *) config->name, config->default_int);
c = 0;
while (selection->description && selection->description[0]) {
while (selection && selection->description && selection->description[0]) {
mbstowcs(lptsTemp, selection->description,
strlen(selection->description) + 1);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)lptsTemp);
@@ -163,7 +166,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
(char *) config->name, config->default_int);
c = 0;
while (selection->description && selection->description[0]) {
while (selection && selection->description && selection->description[0]) {
mbstowcs(lptsTemp, selection->description,
strlen(selection->description) + 1);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)lptsTemp);
@@ -391,6 +394,8 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
id++;
break;
case CONFIG_SELECTION:
case CONFIG_HEX16:
case CONFIG_HEX20:
case CONFIG_MIDI_OUT:
case CONFIG_MIDI_IN:
case CONFIG_SPINNER:

View File

@@ -23,6 +23,7 @@
#include <wchar.h>
#include <86box/86box.h>
#include <86box/config.h>
#include <86box/path.h>
#include <86box/plat.h>
#include <86box/ui.h>
#include <86box/win.h>
@@ -116,10 +117,10 @@ void win_get_icons_path(char* path_root)
if (rom_path[0])
strcpy(roms_root, rom_path);
else
plat_append_filename(roms_root, exe_path, "roms");
path_append_filename(roms_root, exe_path, "roms");
plat_append_filename(path_root, roms_root, "icons");
plat_path_slash(path_root);
path_append_filename(path_root, roms_root, "icons");
path_slash(path_root);
}
void win_load_icon_set()
@@ -137,13 +138,13 @@ void win_load_icon_set()
win_get_icons_path(path_root);
strcat(path_root, icon_set);
plat_path_slash(path_root);
path_slash(path_root);
int i, count = sizeof(icon_files) / sizeof(_ICON_DATA),
x = win_get_system_metrics(SM_CXSMICON, dpi), y = win_get_system_metrics(SM_CYSMICON, dpi);
for (i = 0; i < count; i++)
{
plat_append_filename(temp, path_root, icon_files[i].filename);
path_append_filename(temp, path_root, icon_files[i].filename);
mbstoc16s(wtemp, temp, strlen(temp) + 1);
HICON ictemp;

View File

@@ -54,6 +54,7 @@ typedef LONG atomic_flag;
#include <86box/86box.h>
#include <86box/plat.h>
#include <86box/thread.h>
#include <86box/video.h>
#include <86box/win.h>
#include <86box/language.h>

View File

@@ -29,6 +29,7 @@
#include <wchar.h>
#include <86box/86box.h>
#include <86box/plat.h>
#include <86box/thread.h>
typedef struct {