Another network cleaning (MAC address madness, BIOS stuff), WIN platform cleanup, Makefile[.local] cleanup.

This commit is contained in:
waltje
2017-05-24 00:27:42 -04:00
parent a4cd4b2866
commit 77430348fc
21 changed files with 653 additions and 561 deletions

42
src/Makefile.local Normal file
View File

@@ -0,0 +1,42 @@
#
# 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.
#
# Prefix for localizing the general Makefile.mingw for local
# settings, so we can avoid changing the main one for all of
# our local setups.
#
# Version: @(#)Makefile.local 1.0.2 2017/05/23
#
# Author: Fred N. van Kempen, <decwiz@yahoo.com>
#
#########################################################################
# Anything here will override defaults in Makefile.MinGW. #
#########################################################################
DEBUG = y
OPTIM = n
COPTIM = -O1
# Name of the executable.
PROG = yourexe
# Various compile-time options.
STUFF = #-DROM_TRACE=0xC800 -DIO_TRACE=0x70
EXTRAS = #-DYOURNAME
#########################################################################
# Include the master Makefile.MinGW for the rest. #
#########################################################################
include Makefile.mingw
# End of Makefile.local.

View File

@@ -8,7 +8,7 @@
#
# Modified Makefile for Win32 MinGW 32-bit environment.
#
# Version: @(#)Makefile.mingw 1.0.14 2017/05/21
# Version: @(#)Makefile.mingw 1.0.16 2017/05/22
#
# Authors: Kotori, <oubattler@gmail.com>
# Fred N. van Kempen, <decwiz@yahoo.com>
@@ -17,21 +17,33 @@
#
# Name of the executable.
ifndef PROG
PROG = 86Box
endif
# Various compile-time options.
# -DROM_TRACE=0xcd800 traces ROM access from segment C800
# -DIO_TACE=0x66 traces I/O on port 0x66
ifndef STUFF
STUFF =
endif
# Add feature selections here.
# -DBUGGER adds the ISA BusBugger emulation.
EXTRAS =
ifndef EXTRAS
EXTRAS = lala
endif
# Do we want a debugging build?
ifndef DEBUG
DEBUG = n
endif
ifndef OPTIM
OPTIM = y
endif
ifndef X64
X64 = n
endif
#########################################################################
@@ -43,27 +55,33 @@ CPP = g++.exe
CC = gcc.exe
WINDRES = windres.exe
OPTS = -DWIN32 -I$(PLAT) -I$(X64INC) $(EXTRAS) $(STUFF)
OPTS = -DWIN32 -I$(PLAT) $(EXTRAS) $(STUFF)
ifeq ($(DEBUG), y)
ifeq ($(VRAMDUMP), y)
DFLAGS = -march=i686 -ggdb -DDEBUG -DENABLE_VRAM_DUMP
else
DFLAGS = -march=i686 -ggdb -DDEBUG
endif
ifndef COPTIM
COPTIM = -Og
endif
else
ifeq ($(OPTIM), y)
DFLAGS = -march=native
ifndef COPTIM
COPTIM = -O6
endif
else
ifeq ($(X64), y)
DFLAGS =
else
DFLAGS = -march=i686
endif
ifndef COPTIM
COPTIM = -O3
endif
endif
endif
ifeq ($(OPTIM), y)
AOPTIM = -mtune=native
else
@@ -102,17 +120,17 @@ CPUOBJ = cpu.o 386.o 386_dynarec.o 386_dynarec_ops.o 808x.o \
codegen_timing_winchip.o $(PLATCG) \
x86seg.o x87.o
SYSOBJ = model.o \
headland.o \
i430hx.o i430lx.o i430fx.o i430nx.o i430vx.o i440fx.o \
neat.o \
ali1429.o \
opti495.o \
scat.o \
sis496.o \
wd76c10.o \
acer386sx.o acerm3a.o amstrad.o \
compaq.o olivetti_m24.o jim.o ps1.o ps2.o ps2_mca.o \
tandy_eeprom.o tandy_rom.o
headland.o \
i430hx.o i430lx.o i430fx.o i430nx.o i430vx.o i440fx.o \
neat.o \
ali1429.o \
opti495.o \
scat.o \
sis496.o \
wd76c10.o \
acer386sx.o acerm3a.o amstrad.o \
compaq.o olivetti_m24.o jim.o ps1.o ps2.o ps2_mca.o \
tandy_eeprom.o tandy_rom.o
DEVOBJ = bugger.o lpt.o serial.o \
um8669f.o pc87306.o sis85c471.o w83877f.o \
keyboard.o \
@@ -133,53 +151,53 @@ DEVOBJ = bugger.o lpt.o serial.o \
cdrom_dosbox.o cdrom_image.o cdrom_ioctl.o cdrom_null.o
USBOBJ = usb.o
NETOBJ = network.o \
net_pcap.o net_slirp.o \
net_ne2000.o
net_pcap.o net_slirp.o \
net_ne2000.o
SCSIOBJ = scsi.o scsi_disk.o scsi_buslogic.o scsi_aha154x.o
SNDOBJ = sound.o \
convolve.o convolve-sse.o envelope.o extfilt.o \
filter.o pot.o sid.o voice.o wave6581__ST.o \
wave6581_P_T.o wave6581_PS_.o wave6581_PST.o \
wave8580__ST.o wave8580_P_T.o wave8580_PS_.o \
wave8580_PST.o wave.o \
dbopl.o nukedopl.o openal.o \
snd_speaker.o snd_ps1.o snd_pssj.o \
snd_adlib.o snd_adlibgold.o snd_ad1848.o \
snd_sb.o snd_sb_dsp.o snd_cms.o snd_dbopl.o \
snd_emu8k.o snd_gus.o snd_opl.o \
snd_mpu401.o snd_pas16.o snd_resid.o \
snd_sn76489.o snd_ssi2001.o snd_wss.o \
snd_ym7128.o
convolve.o convolve-sse.o envelope.o extfilt.o \
filter.o pot.o sid.o voice.o wave6581__ST.o \
wave6581_P_T.o wave6581_PS_.o wave6581_PST.o \
wave8580__ST.o wave8580_P_T.o wave8580_PS_.o \
wave8580_PST.o wave.o \
dbopl.o nukedopl.o openal.o \
snd_speaker.o snd_ps1.o snd_pssj.o \
snd_adlib.o snd_adlibgold.o snd_ad1848.o \
snd_sb.o snd_sb_dsp.o snd_cms.o snd_dbopl.o \
snd_emu8k.o snd_gus.o snd_opl.o \
snd_mpu401.o snd_pas16.o snd_resid.o \
snd_sn76489.o snd_ssi2001.o snd_wss.o \
snd_ym7128.o
VIDOBJ = video.o \
vid_cga.o vid_cga_comp.o vid_mda.o vid_ega.o \
vid_vga.o vid_svga.o vid_svga_render.o \
vid_hercules.o vid_herculesplus.o vid_incolor.o \
vid_colorplus.o \
vid_genius.o \
vid_s3.o vid_s3_virge.o \
vid_et4000.o vid_et4000w32.o vid_icd2061.o \
vid_oti067.o \
vid_paradise.o \
vid_tvga.o vid_tgui9440.o vid_tkd8001_ramdac.o \
vid_ati_eeprom.o vid_ati18800.o vid_ati28800.o \
vid_ati68860_ramdac.o vid_ati_mach64.o \
vid_ics2595.o \
vid_sdac_ramdac.o \
vid_stg_ramdac.o \
vid_unk_ramdac.o \
vid_wy700.o \
vid_voodoo.o \
vid_pcjr.o vid_ps1_svga.o \
vid_olivetti_m24.o \
vid_pc1512.o vid_pc1640.o vid_pc200.o \
vid_tandy.o vid_tandysl.o
vid_cga.o vid_cga_comp.o vid_mda.o vid_ega.o \
vid_vga.o vid_svga.o vid_svga_render.o \
vid_hercules.o vid_herculesplus.o vid_incolor.o \
vid_colorplus.o \
vid_genius.o \
vid_s3.o vid_s3_virge.o \
vid_et4000.o vid_et4000w32.o vid_icd2061.o \
vid_oti067.o \
vid_paradise.o \
vid_tvga.o vid_tgui9440.o vid_tkd8001_ramdac.o \
vid_ati_eeprom.o vid_ati18800.o vid_ati28800.o \
vid_ati68860_ramdac.o vid_ati_mach64.o \
vid_ics2595.o \
vid_sdac_ramdac.o \
vid_stg_ramdac.o \
vid_unk_ramdac.o \
vid_wy700.o \
vid_voodoo.o \
vid_pcjr.o vid_ps1_svga.o \
vid_olivetti_m24.o \
vid_pc1512.o vid_pc1640.o vid_pc200.o \
vid_tandy.o vid_tandysl.o
WINOBJ = win.o \
win_d3d.o win_d3d-fs.o \
win_ddraw.o win_ddraw-fs.o win_ddraw-screenshot.o \
win_language.o win_status.o win_opendir.o win_dynld.o \
win_video.o win_serial.o win_mouse.o \
win_joystick.o win_midi.o \
win_settings.o win_deviceconfig.o win_joystickconfig.o \
win_ddraw.o win_ddraw_fs.o win_ddraw_screenshot.o \
win_d3d.o win_d3d_fs.o \
win_language.o win_status.o win_opendir.o win_dynld.o \
win_video.o win_serial.o win_mouse.o \
win_joystick.o win_midi.o \
win_settings.o win_deviceconfig.o win_joystickconfig.o \
86Box.res
OBJ = $(MAINOBJ) $(CPUOBJ) $(SYSOBJ) $(DEVOBJ) $(USBOBJ) \
$(NETOBJ) $(SCSIOBJ) $(SNDOBJ) $(VIDOBJ) $(WINOBJ)
@@ -197,7 +215,7 @@ LIBS = -mwindows -lcomctl32 -lwinmm -lopenal.dll -lopenal -lddraw \
# Build rules.
%.o: %.c
@echo $<
@$(CC) $(CFLAGS) -c $<
$(CC) $(CFLAGS) -c $<
%.o: %.cc
@echo $<

View File

@@ -1,21 +1,10 @@
/* Copyright holders: Sarah Walker, Tenshi
see COPYING for more details
*/
#define UNICODE
#define _WIN32_WINNT 0x0501
#define BITMAP WINDOWS_BITMAP
#include <windows.h>
#include <windowsx.h>
#undef BITMAP
#include <commctrl.h>
#include <commdlg.h>
#include <process.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../86box.h"
#include "../device.h"
#include "../disc.h"
@@ -45,10 +34,12 @@
#include "win.h"
#include "win_ddraw.h"
#include "win_ddraw-fs.h"
#include "win_d3d.h"
#include "win_d3d-fs.h"
#include "win_language.h"
#include <windowsx.h>
#include <commctrl.h>
#include <commdlg.h>
#include <process.h>
#include "resource.h"

View File

@@ -8,13 +8,16 @@
*/
#ifndef BOX_WIN_H
# define BOX_WIN_H
#if 0
# define UNICODE
# ifndef NO_UNICODE
# define UNICODE
# endif
# define BITMAP WINDOWS_BITMAP
//# ifdef _WIN32_WINNT
//# undef _WIN32_WINNT
//# define _WIN32_WINNT 0x0501
//# endif
# include <windows.h>
# undef BITMAP
#endif
#define szClassName L"86BoxMainWnd"

View File

@@ -12,174 +12,214 @@
#include "../86box.h"
#include "win_crashdump.h"
PVOID hExceptionHandler;
char* ExceptionHandlerBuffer;
#define ExceptionHandlerBufferSize (10240)
LONG CALLBACK MakeCrashDump(PEXCEPTION_POINTERS ExceptionInfo) {
// 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) {
// The exception code is not a fatal exception (highest 4 bits 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 86Box.exe.
char* CurrentBufferPointer;
GetModuleFileName(NULL,ExceptionHandlerBuffer,ExceptionHandlerBufferSize);
if (GetLastError() != ERROR_SUCCESS) {
// Could not get the full path of 86Box.exe. Just create the file in the current directory.
CurrentBufferPointer = ExceptionHandlerBuffer;
} else {
// Walk through the string backwards looking for the last backslash, so as to remove the "86Box.exe" filename from the string.
CurrentBufferPointer = &ExceptionHandlerBuffer[strlen(ExceptionHandlerBuffer)];
for (; CurrentBufferPointer > ExceptionHandlerBuffer; CurrentBufferPointer--) {
if (CurrentBufferPointer[0] == '\\') {
// Found the backslash, null terminate the string after it.
CurrentBufferPointer[1] = 0;
break;
}
}
CurrentBufferPointer = &ExceptionHandlerBuffer[strlen(ExceptionHandlerBuffer)];
}
// What would a good filename be? It should contain the current date and time so as to be (hopefully!) unique.
SYSTEMTIME SystemTime;
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);
DWORD Error;
// Now the filename is in the buffer, the file can be created.
HANDLE 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;
}
// Now the file is open, let's write the data we were passed out in a human-readable format.
// Let's get the name of the module where the exception occured.
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)) {
// The list was obtained, walk through each of the modules.
for (DWORD i = 0; i < (cbNeeded / sizeof(HMODULE)); i++) {
// For each module, get the module information (base address, size, entry point)
GetModuleInformation(GetCurrentProcess(), hMods[i], &modInfo, sizeof(MODULEINFO));
// If the exception address is located in the range of where this module is loaded...
if (
(ExceptionInfo->ExceptionRecord->ExceptionAddress >= modInfo.lpBaseOfDll) &&
(ExceptionInfo->ExceptionRecord->ExceptionAddress < (modInfo.lpBaseOfDll + modInfo.SizeOfImage))
) {
// ...this is the module we're looking for!
ipModule = hMods[i];
break;
}
static PVOID hExceptionHandler;
static char *ExceptionHandlerBuffer;
LONG CALLBACK MakeCrashDump(PEXCEPTION_POINTERS ExceptionInfo)
{
SYSTEMTIME SystemTime;
HANDLE hDumpFile;
DWORD Error;
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)];
}
// Start to put the crash-dump string into the buffer.
/*
* 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.
sprintf(ExceptionHandlerBuffer,
"86Box version %s crashed on %d-%02d-%02d %02d:%02d:%02d.%03d\r\n\r\n"
""
"Exception details:\r\n"
"Exception NTSTATUS code: 0x%08x\r\n"
"Occured at address: 0x%p",
emulator_version, SystemTime.wYear, SystemTime.wMonth, SystemTime.wDay, SystemTime.wHour, SystemTime.wMinute, SystemTime.wSecond, SystemTime.wMilliseconds,
ExceptionInfo->ExceptionRecord->ExceptionCode,
ExceptionInfo->ExceptionRecord->ExceptionAddress);
/* 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);
}
// If we found the module that the exception occured in, get the full path to the module the exception occured at and include it.
CurrentBufferPointer = &ExceptionHandlerBuffer[strlen(ExceptionHandlerBuffer)];
if (ipModule != 0) {
sprintf(CurrentBufferPointer," [");
GetModuleFileName(ipModule,&CurrentBufferPointer[2],ExceptionHandlerBufferSize - strlen(ExceptionHandlerBuffer));
if (GetLastError() == ERROR_SUCCESS) {
CurrentBufferPointer = &ExceptionHandlerBuffer[strlen(ExceptionHandlerBuffer)];
sprintf(CurrentBufferPointer,"]");
CurrentBufferPointer += 1;
// Now the file is open, let's write the data we were passed out in a human-readable format.
// Let's get the name of the module where the exception occured.
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)) {
// The list was obtained, walk through each of the modules.
for (DWORD i = 0; i < (cbNeeded / sizeof(HMODULE)); i++) {
// For each module, get the module information
// (base address, size, entry point)
GetModuleInformation(GetCurrentProcess(),
hMods[i], &modInfo, sizeof(MODULEINFO));
// If the exception address is located in the range of
// where this module is loaded...
if ( (ExceptionInfo->ExceptionRecord->ExceptionAddress >= modInfo.lpBaseOfDll) &&
(ExceptionInfo->ExceptionRecord->ExceptionAddress < (modInfo.lpBaseOfDll + modInfo.SizeOfImage))) {
// ...this is the module we're looking for!
ipModule = hMods[i];
break;
}
}
}
// Continue to create the crash-dump string.
sprintf(CurrentBufferPointer,
"\r\n"
"Number of parameters: %d\r\n"
"Exception parameters: ",
ExceptionInfo->ExceptionRecord->NumberParameters);
// Add the exception parameters to the crash-dump string.
for (int i = 0; i < ExceptionInfo->ExceptionRecord->NumberParameters; i++) {
CurrentBufferPointer = &ExceptionHandlerBuffer[strlen(ExceptionHandlerBuffer)];
sprintf(CurrentBufferPointer,"0x%p ",ExceptionInfo->ExceptionRecord->ExceptionInformation[i]);
// Start to put the crash-dump string into the buffer.
sprintf(ExceptionHandlerBuffer,
"86Box version %s crashed on %d-%02d-%02d %02d:%02d:%02d.%03d\r\n\r\n"
""
"Exception details:\r\n"
"Exception NTSTATUS code: 0x%08x\r\n"
"Occured at address: 0x%p",
emulator_version,
SystemTime.wYear, SystemTime.wMonth, SystemTime.wDay,
SystemTime.wHour, SystemTime.wMinute, SystemTime.wSecond,
SystemTime.wMilliseconds,
ExceptionInfo->ExceptionRecord->ExceptionCode,
ExceptionInfo->ExceptionRecord->ExceptionAddress);
// If we found the module that the exception occured in, 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;
}
}
CurrentBufferPointer = &ExceptionHandlerBuffer[strlen(ExceptionHandlerBuffer) - 1];
// Continue to create the crash-dump string.
sprintf(BufPtr,
"\r\n"
"Number of parameters: %d\r\n"
"Exception parameters: ",
ExceptionInfo->ExceptionRecord->NumberParameters);
PCONTEXT Registers = ExceptionInfo->ContextRecord;
// Add the exception parameters to the crash-dump string.
for (int i = 0; i < ExceptionInfo->ExceptionRecord->NumberParameters; i++) {
BufPtr = &ExceptionHandlerBuffer[strlen(ExceptionHandlerBuffer)];
sprintf(BufPtr,"0x%p ",
ExceptionInfo->ExceptionRecord->ExceptionInformation[i]);
}
BufPtr = &ExceptionHandlerBuffer[strlen(ExceptionHandlerBuffer) - 1];
PCONTEXT Registers = ExceptionInfo->ContextRecord;
#if defined(__i386__) && !defined(__x86_64)
// This binary is being compiled for x86, include a register dump.
sprintf(CurrentBufferPointer,
"\r\n"
"Register dump:\r\n"
"eax=0x%08x ebx=0x%08x ecx=0x%08x edx=0x%08x ebp=0x%08x esp=0x%08x esi=0x%08x edi=0x%08x eip=0x%08x\r\n"
"\r\n",
Registers->Eax, Registers->Ebx, Registers->Ecx, Registers->Edx, Registers->Ebp, Registers->Esp, Registers->Esi, Registers->Edi, Registers->Eip);
#else
// Register dump is supported by no other architectures right now. MinGW headers seem to lack the x64 CONTEXT structure definition.
sprintf(CurrentBufferPointer,"\r\n");
#endif
#if defined(__i386__) && !defined(__x86_64)
// This binary is being compiled for x86, include a register dump.
sprintf(BufPtr,
"\r\n"
"Register dump:\r\n"
"eax=0x%08x ebx=0x%08x ecx=0x%08x edx=0x%08x ebp=0x%08x esp=0x%08x esi=0x%08x edi=0x%08x eip=0x%08x\r\n"
"\r\n",
Registers->Eax, Registers->Ebx, Registers->Ecx, Registers->Edx, Registers->Ebp, Registers->Esp, Registers->Esi, Registers->Edi, Registers->Eip);
#else
// Register dump is supported by no other architectures right now. MinGW headers seem to lack the x64 CONTEXT structure definition.
sprintf(BufPtr,"\r\n");
#endif
// The crash-dump string has been created, write it to disk.
WriteFile(hDumpFile,
ExceptionHandlerBuffer,
strlen(ExceptionHandlerBuffer),
NULL,
NULL);
// Finally, close the file.
CloseHandle(hDumpFile);
// And return, therefore causing the crash, but only after the crash dump has been created.
return EXCEPTION_CONTINUE_SEARCH;
// The crash-dump string has been created, write it to disk.
WriteFile(hDumpFile, ExceptionHandlerBuffer,
strlen(ExceptionHandlerBuffer), NULL, NULL);
// Finally, close the file.
CloseHandle(hDumpFile);
// And return, therefore causing the crash,
// but only after the crash dump has been created.
return(EXCEPTION_CONTINUE_SEARCH);
}
void InitCrashDump() {
// 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);
// 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);
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);
/*
* 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

@@ -1,13 +0,0 @@
/* Copyright holders: Sarah Walker, Tenshi
see COPYING for more details
*/
#ifdef __cplusplus
extern "C" {
#endif
int d3d_fs_init(HWND h);
void d3d_fs_close();
void d3d_fs_reset();
void d3d_fs_resize(int x, int y);
#ifdef __cplusplus
}
#endif

View File

@@ -2,14 +2,9 @@
see COPYING for more details
*/
#include <stdint.h>
#define UNICODE
#define BITMAP WINDOWS_BITMAP
#include <d3d9.h>
#undef BITMAP
#include <D3dx9tex.h>
#include "../video/video.h"
#include "win.h"
#include "win_d3d.h"
#include "../video/video.h"
#include "win_cgapal.h"
#include "resource.h"

View File

@@ -1,13 +1,32 @@
/* Copyright holders: Sarah Walker, Tenshi
see COPYING for more details
*/
#ifndef WIN_D3D_H
# define WIN_D3D_H
# define UNICODE
# define BITMAP WINDOWS_BITMAP
# include <d3d9.h>
# include <d3dx9tex.h>
# undef BITMAP
#ifdef __cplusplus
extern "C" {
#endif
int d3d_init(HWND h);
void d3d_close();
void d3d_reset();
void d3d_resize(int x, int y);
extern int d3d_init(HWND h);
extern void d3d_close(void);
extern void d3d_reset(void);
extern void d3d_resize(int x, int y);
extern int d3d_fs_init(HWND h);
extern void d3d_fs_close(void);
extern void d3d_fs_reset(void);
extern void d3d_fs_resize(int x, int y);
#ifdef __cplusplus
}
#endif
#endif /*WIN_D3D_H*/

View File

@@ -3,15 +3,10 @@
*/
#include <stdint.h>
#include <stdio.h>
#define UNICODE
#define BITMAP WINDOWS_BITMAP
#include <d3d9.h>
#undef BITMAP
#include <D3dx9tex.h>
#include "../86box.h"
#include "../video/video.h"
#include "win.h"
#include "win_d3d-fs.h"
#include "win_d3d.h"
#include "win_cgapal.h"
#include "resource.h"
@@ -110,6 +105,7 @@ static CUSTOMVERTEX d3d_verts[] =
{2048.0f, 2048.0f, 1.0f, 1.0f, 1.0f, 1.0f},
};
void cgapal_rebuild(void)
{
int c;
@@ -133,6 +129,7 @@ void cgapal_rebuild(void)
}
}
int d3d_fs_init(HWND h)
{
HRESULT hr;
@@ -197,6 +194,7 @@ int d3d_fs_init(HWND h)
return 1;
}
static void d3d_fs_close_objects(void)
{
if (d3dTexture)
@@ -211,6 +209,7 @@ static void d3d_fs_close_objects(void)
}
}
static void d3d_fs_init_objects(void)
{
D3DLOCKED_RECT dr;
@@ -248,6 +247,7 @@ static void d3d_fs_init_objects(void)
d3ddev->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
}
/*void d3d_resize(int x, int y)
{
HRESULT hr;
@@ -258,6 +258,7 @@ static void d3d_fs_init_objects(void)
d3d_reset();
}*/
void d3d_fs_reset(void)
{
HRESULT hr;
@@ -293,6 +294,7 @@ void d3d_fs_reset(void)
device_force_redraw();
}
void d3d_fs_close(void)
{
if (d3dTexture)
@@ -318,6 +320,7 @@ void d3d_fs_close(void)
DestroyWindow(d3d_device_window);
}
static void d3d_fs_size(RECT window_rect, double *l, double *t, double *r, double *b, int w, int h)
{
int ratio_w, ratio_h;
@@ -368,6 +371,7 @@ static void d3d_fs_size(RECT window_rect, double *l, double *t, double *r, doubl
}
}
static void d3d_fs_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
{
HRESULT hr = D3D_OK;
@@ -466,6 +470,7 @@ static void d3d_fs_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
PostMessage(ghwnd, WM_RESETD3D, 0, 0);
}
static void d3d_fs_blit_memtoscreen_8(int x, int y, int w, int h)
{
HRESULT hr = D3D_OK;
@@ -573,6 +578,7 @@ static void d3d_fs_blit_memtoscreen_8(int x, int y, int w, int h)
PostMessage(ghwnd, WM_RESETD3D, 0, 0);
}
void d3d_fs_take_screenshot(wchar_t *fn)
{
LPDIRECT3DSURFACE9 d3dSurface = NULL;

View File

@@ -1,11 +0,0 @@
/* Copyright holders: Sarah Walker, Tenshi
see COPYING for more details
*/
#ifdef __cplusplus
extern "C" {
#endif
int ddraw_fs_init(HWND h);
void ddraw_fs_close();
#ifdef __cplusplus
}
#endif

View File

@@ -1,4 +0,0 @@
/* Copyright holders: Tenshi
see COPYING for more details
*/
void ddraw_common_take_screenshot(wchar_t *fn, IDirectDrawSurface7 *pDDSurface);

View File

@@ -3,13 +3,8 @@
*/
#include <stdio.h>
#include <stdint.h>
#define UNICODE
#define BITMAP WINDOWS_BITMAP
#include <ddraw.h>
#undef BITMAP
#include "../video/video.h"
#include "win_ddraw.h"
#include "win_ddraw-screenshot.h"
#include "win_cgapal.h"

View File

@@ -1,12 +1,30 @@
/* Copyright holders: Sarah Walker, Tenshi
see COPYING for more details
*/
#ifndef WIN_DDRAW_H
# define WIN_DDRAW_H
# define UNICODE
# define BITMAP WINDOWS_BITMAP
# include <ddraw.h>
# undef BITMAP
#ifdef __cplusplus
extern "C" {
#endif
int ddraw_init(HWND h);
void ddraw_close();
extern int ddraw_init(HWND h);
extern void ddraw_close(void);
extern int ddraw_fs_init(HWND h);
extern void ddraw_fs_close(void);
extern void ddraw_common_take_screenshot(wchar_t *fn,
IDirectDrawSurface7 *pDDSurface);
#ifdef __cplusplus
}
#endif
#endif /*WIN_DDRAW_H*/

View File

@@ -2,16 +2,22 @@
see COPYING for more details
*/
#include <stdint.h>
#define UNICODE
#define BITMAP WINDOWS_BITMAP
#include <ddraw.h>
#undef BITMAP
#include "../video/video.h"
#include "win_ddraw-fs.h"
#include "win_ddraw-screenshot.h"
#include "win_ddraw.h"
#include "win_cgapal.h"
static LPDIRECTDRAW lpdd = NULL;
static LPDIRECTDRAW7 lpdd7 = NULL;
static LPDIRECTDRAWSURFACE7 lpdds_pri = NULL;
static LPDIRECTDRAWSURFACE7 lpdds_back = NULL;
static LPDIRECTDRAWSURFACE7 lpdds_back2 = NULL;
static LPDIRECTDRAWCLIPPER lpdd_clipper = NULL;
static DDSURFACEDESC2 ddsd;
static HWND ddraw_hwnd;
static int ddraw_w, ddraw_h;
extern "C" void fatal(const char *format, ...);
extern "C" void pclog(const char *format, ...);
@@ -22,19 +28,9 @@ extern "C" void ddraw_fs_close(void);
extern "C" void video_blit_complete(void);
static void ddraw_fs_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h);
static void ddraw_fs_blit_memtoscreen_8(int x, int y, int w, int h);
static void ddraw_fs_blit_memtoscreen(int, int, int, int, int, int);
static void ddraw_fs_blit_memtoscreen_8(int, int, int, int);
static LPDIRECTDRAW lpdd = NULL;
static LPDIRECTDRAW7 lpdd7 = NULL;
static LPDIRECTDRAWSURFACE7 lpdds_pri = NULL;
static LPDIRECTDRAWSURFACE7 lpdds_back = NULL;
static LPDIRECTDRAWSURFACE7 lpdds_back2 = NULL;
static LPDIRECTDRAWCLIPPER lpdd_clipper = NULL;
static DDSURFACEDESC2 ddsd;
static HWND ddraw_hwnd;
static int ddraw_w, ddraw_h;
int ddraw_fs_init(HWND h)
{

View File

@@ -5,25 +5,20 @@
#include <stdint.h>
#define UNICODE
#define BITMAP WINDOWS_BITMAP
#include <ddraw.h>
#include <windows.h>
#undef BITMAP
#include "../video/video.h"
#include "win.h"
#include "win_ddraw-screenshot.h"
#include "win_ddraw.h"
#include "win_language.h"
extern "C" void fatal(const char *format, ...);
HBITMAP hbitmap;
int xs, ys, ys2;
extern "C" void pclog(const char *format, ...);
extern "C" void device_force_redraw(void);
extern "C" void ddraw_init(HWND h);
extern "C" void ddraw_close(void);
HBITMAP hbitmap;
int xs, ys, ys2;
void CopySurface(IDirectDrawSurface7 *pDDSurface)
{
@@ -58,6 +53,7 @@ void CopySurface(IDirectDrawSurface7 *pDDSurface)
return ;
}
void DoubleLines(uint8_t *dst, uint8_t *src)
{
int i = 0;

View File

@@ -1,19 +1,18 @@
/* Copyright holders: Sarah Walker
see COPYING for more details
*/
#define BITMAP WINDOWS_BITMAP
#include <windows.h>
#include <windowsx.h>
#undef BITMAP
#include "../ibm.h"
#include "../config.h"
#include "../device.h"
#include "resource.h"
#define NO_UNICODE /*FIXME: not Unicode? */
#include "win.h"
#include <windowsx.h>
static device_t *config_device;
static BOOL CALLBACK deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND h;

View File

@@ -6,8 +6,6 @@
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <wchar.h>
#include "cdrom.h"
#include "config.h"
#include "device.h"
@@ -30,15 +28,8 @@
#include "sound/snd_opl.h"
#include "sound/sound.h"
#include "video/video.h"
#ifndef __unix
#define UNICODE
#define BITMAP WINDOWS_BITMAP
#include <windows.h>
#undef BITMAP
#include "win.h"
#include "win_language.h"
#endif
wchar_t config_file_default[256];

File diff suppressed because it is too large Load Diff

View File

@@ -8,7 +8,7 @@
*
* Handle WinPcap library processing.
*
* Version: @(#)net_pcap.c 1.0.3 2017/05/21
* Version: @(#)net_pcap.c 1.0.4 2017/05/23
*
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
*/
@@ -180,7 +180,7 @@ network_pcap_setup(uint8_t *mac, NETRXCB func, void *arg)
}
/* Create a MAC address based packet filter. */
pclog(" Installing packet filter for MAC=%02x:%02x:%02x:%02x:%02x\n",
pclog(" Installing packet filter for MAC=%02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
sprintf(filter_exp,
"( ((ether dst ff:ff:ff:ff:ff:ff) or (ether dst %02x:%02x:%02x:%02x:%02x:%02x)) and not (ether src %02x:%02x:%02x:%02x:%02x:%02x) )",

View File

@@ -12,7 +12,7 @@
* it should be malloc'ed and then linked to the NETCARD def.
* Will be done later.
*
* Version: @(#)network.c 1.0.5 2017/05/21
* Version: @(#)network.c 1.0.6 2017/05/22
*
* Authors: Kotori, <oubattler@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
@@ -25,14 +25,8 @@
#include "device.h"
#include "network.h"
#include "net_ne2000.h"
#ifndef unix
# define UNICODE
# define BITMAP WINDOWS_BITMAP
# include <windows.h>
# undef BITMAP
# include "win.h"
# include "win_language.h"
#endif
#include "win.h"
#include "win_language.h"
static netcard_t net_cards[] = {

View File

@@ -57,18 +57,10 @@
#include "video/video.h"
#include "video/vid_voodoo.h"
#include "amstrad.h"
#ifdef WALTJE
# define UNICODE
# include "plat_dir.h"
#endif
#ifndef __unix
#define UNICODE
#define BITMAP WINDOWS_BITMAP
#include <windows.h>
#undef BITMAP
#include "win.h"
#include "win_language.h"
#ifdef WALTJE
# include "plat_dir.h"
#endif