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. # 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> # Authors: Kotori, <oubattler@gmail.com>
# Fred N. van Kempen, <decwiz@yahoo.com> # Fred N. van Kempen, <decwiz@yahoo.com>
@@ -17,21 +17,33 @@
# #
# Name of the executable. # Name of the executable.
ifndef PROG
PROG = 86Box PROG = 86Box
endif
# Various compile-time options. # Various compile-time options.
# -DROM_TRACE=0xcd800 traces ROM access from segment C800 # -DROM_TRACE=0xcd800 traces ROM access from segment C800
# -DIO_TACE=0x66 traces I/O on port 0x66 # -DIO_TACE=0x66 traces I/O on port 0x66
ifndef STUFF
STUFF = STUFF =
endif
# Add feature selections here. # Add feature selections here.
# -DBUGGER adds the ISA BusBugger emulation. # -DBUGGER adds the ISA BusBugger emulation.
EXTRAS = ifndef EXTRAS
EXTRAS = lala
endif
# Do we want a debugging build? # Do we want a debugging build?
ifndef DEBUG
DEBUG = n DEBUG = n
endif
ifndef OPTIM
OPTIM = y OPTIM = y
endif
ifndef X64
X64 = n X64 = n
endif
######################################################################### #########################################################################
@@ -43,27 +55,33 @@ CPP = g++.exe
CC = gcc.exe CC = gcc.exe
WINDRES = windres.exe WINDRES = windres.exe
OPTS = -DWIN32 -I$(PLAT) -I$(X64INC) $(EXTRAS) $(STUFF) OPTS = -DWIN32 -I$(PLAT) $(EXTRAS) $(STUFF)
ifeq ($(DEBUG), y) ifeq ($(DEBUG), y)
ifeq ($(VRAMDUMP), y) ifeq ($(VRAMDUMP), y)
DFLAGS = -march=i686 -ggdb -DDEBUG -DENABLE_VRAM_DUMP DFLAGS = -march=i686 -ggdb -DDEBUG -DENABLE_VRAM_DUMP
else else
DFLAGS = -march=i686 -ggdb -DDEBUG DFLAGS = -march=i686 -ggdb -DDEBUG
endif endif
ifndef COPTIM
COPTIM = -Og COPTIM = -Og
endif
else else
ifeq ($(OPTIM), y) ifeq ($(OPTIM), y)
DFLAGS = -march=native DFLAGS = -march=native
ifndef COPTIM
COPTIM = -O6 COPTIM = -O6
endif
else else
ifeq ($(X64), y) ifeq ($(X64), y)
DFLAGS = DFLAGS =
else else
DFLAGS = -march=i686 DFLAGS = -march=i686
endif endif
ifndef COPTIM
COPTIM = -O3 COPTIM = -O3
endif endif
endif endif
endif
ifeq ($(OPTIM), y) ifeq ($(OPTIM), y)
AOPTIM = -mtune=native AOPTIM = -mtune=native
else else
@@ -174,8 +192,8 @@ VIDOBJ = video.o \
vid_pc1512.o vid_pc1640.o vid_pc200.o \ vid_pc1512.o vid_pc1640.o vid_pc200.o \
vid_tandy.o vid_tandysl.o vid_tandy.o vid_tandysl.o
WINOBJ = win.o \ WINOBJ = win.o \
win_d3d.o win_d3d-fs.o \ win_ddraw.o win_ddraw_fs.o win_ddraw_screenshot.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_language.o win_status.o win_opendir.o win_dynld.o \
win_video.o win_serial.o win_mouse.o \ win_video.o win_serial.o win_mouse.o \
win_joystick.o win_midi.o \ win_joystick.o win_midi.o \
@@ -197,7 +215,7 @@ LIBS = -mwindows -lcomctl32 -lwinmm -lopenal.dll -lopenal -lddraw \
# Build rules. # Build rules.
%.o: %.c %.o: %.c
@echo $< @echo $<
@$(CC) $(CFLAGS) -c $< $(CC) $(CFLAGS) -c $<
%.o: %.cc %.o: %.cc
@echo $< @echo $<

View File

@@ -1,21 +1,10 @@
/* Copyright holders: Sarah Walker, Tenshi /* Copyright holders: Sarah Walker, Tenshi
see COPYING for more details 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 <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../86box.h" #include "../86box.h"
#include "../device.h" #include "../device.h"
#include "../disc.h" #include "../disc.h"
@@ -45,10 +34,12 @@
#include "win.h" #include "win.h"
#include "win_ddraw.h" #include "win_ddraw.h"
#include "win_ddraw-fs.h"
#include "win_d3d.h" #include "win_d3d.h"
#include "win_d3d-fs.h"
#include "win_language.h" #include "win_language.h"
#include <windowsx.h>
#include <commctrl.h>
#include <commdlg.h>
#include <process.h>
#include "resource.h" #include "resource.h"

View File

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

View File

@@ -12,46 +12,71 @@
#include "../86box.h" #include "../86box.h"
#include "win_crashdump.h" #include "win_crashdump.h"
PVOID hExceptionHandler;
char* ExceptionHandlerBuffer;
#define ExceptionHandlerBufferSize (10240) #define ExceptionHandlerBufferSize (10240)
LONG CALLBACK MakeCrashDump(PEXCEPTION_POINTERS ExceptionInfo) { static PVOID hExceptionHandler;
// Win32-specific functions will be used wherever possible, just in case the C stdlib-equivalents try to allocate memory. static char *ExceptionHandlerBuffer;
// (The Win32-specific functions are generally just wrappers over NT system calls anyway.)
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) { 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 * ExceptionCode is not a fatal exception (high 4b of
return EXCEPTION_CONTINUE_SEARCH; * 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. * 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; * First, get the path to the executable.
*/
GetModuleFileName(NULL,ExceptionHandlerBuffer,ExceptionHandlerBufferSize); GetModuleFileName(NULL,ExceptionHandlerBuffer,ExceptionHandlerBufferSize);
if (GetLastError() != ERROR_SUCCESS) { if (GetLastError() != ERROR_SUCCESS) {
// Could not get the full path of 86Box.exe. Just create the file in the current directory. /* Could not get full path, create in current directory. */
CurrentBufferPointer = ExceptionHandlerBuffer; BufPtr = ExceptionHandlerBuffer;
} else { } 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)]; * Walk through the string backwards looking for the
for (; CurrentBufferPointer > ExceptionHandlerBuffer; CurrentBufferPointer--) { * last backslash, so as to remove the "86Box.exe"
if (CurrentBufferPointer[0] == '\\') { * filename from the string.
// Found the backslash, null terminate the string after it. */
CurrentBufferPointer[1] = 0; BufPtr = &ExceptionHandlerBuffer[strlen(ExceptionHandlerBuffer)];
for (; BufPtr > ExceptionHandlerBuffer; BufPtr--) {
if (BufPtr[0] == '\\') {
/* Found backslash, terminate the string after it. */
BufPtr[1] = 0;
break; break;
} }
} }
CurrentBufferPointer = &ExceptionHandlerBuffer[strlen(ExceptionHandlerBuffer)]; BufPtr = &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; * What would a good filename be?
*
* It should contain the current date and time so as
* to be (hopefully!) unique.
*/
GetSystemTime(&SystemTime); GetSystemTime(&SystemTime);
sprintf(CurrentBufferPointer, sprintf(CurrentBufferPointer,
"86box-%d%02d%02d-%02d-%02d-%02d-%03d.dmp", "86box-%d%02d%02d-%02d-%02d-%02d-%03d.dmp",
@@ -63,22 +88,24 @@ LONG CALLBACK MakeCrashDump(PEXCEPTION_POINTERS ExceptionInfo) {
SystemTime.wSecond, SystemTime.wSecond,
SystemTime.wMilliseconds); SystemTime.wMilliseconds);
DWORD Error; /* Now the filename is in the buffer, the file can be created. */
hDumpFile = CreateFile(
// Now the filename is in the buffer, the file can be created.
HANDLE hDumpFile = CreateFile(
ExceptionHandlerBuffer, // The filename of the file to open. ExceptionHandlerBuffer, // The filename of the file to open.
GENERIC_WRITE, // The permissions to request. GENERIC_WRITE, // The permissions to request.
0, // Make sure other processes can't touch the crash dump at all while it's open. 0, // Make sure other processes can't
NULL, // Leave the security descriptor undefined, it doesn't matter. // touch the crash dump at all
OPEN_ALWAYS, // Opens the file if it exists, creates a new file if it doesn't. // 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. FILE_ATTRIBUTE_NORMAL, // File attributes / etc don't matter.
NULL); // A template file is not being used. NULL); // A template file is not being used.
// Check to make sure the file was actually created. /* Check to make sure the file was actually created. */
if (hDumpFile == INVALID_HANDLE_VALUE) { if (hDumpFile == INVALID_HANDLE_VALUE) {
// CreateFile() failed, so just do nothing more. /* CreateFile() failed, so just do nothing more. */
return EXCEPTION_CONTINUE_SEARCH; return(EXCEPTION_CONTINUE_SEARCH);
} }
// Now the file is open, let's write the data we were passed out in a human-readable format. // Now the file is open, let's write the data we were passed out in a human-readable format.
@@ -88,17 +115,20 @@ LONG CALLBACK MakeCrashDump(PEXCEPTION_POINTERS ExceptionInfo) {
MODULEINFO modInfo; MODULEINFO modInfo;
HMODULE ipModule = 0; HMODULE ipModule = 0;
DWORD cbNeeded; DWORD cbNeeded;
// Try to get a list of all loaded modules. // Try to get a list of all loaded modules.
if (EnumProcessModules(GetCurrentProcess(), hMods, sizeof(hMods), &cbNeeded)) { if (EnumProcessModules(GetCurrentProcess(),
hMods, sizeof(hMods), &cbNeeded)) {
// The list was obtained, walk through each of the modules. // The list was obtained, walk through each of the modules.
for (DWORD i = 0; i < (cbNeeded / sizeof(HMODULE)); i++) { for (DWORD i = 0; i < (cbNeeded / sizeof(HMODULE)); i++) {
// For each module, get the module information (base address, size, entry point) // For each module, get the module information
GetModuleInformation(GetCurrentProcess(), hMods[i], &modInfo, sizeof(MODULEINFO)); // (base address, size, entry point)
// If the exception address is located in the range of where this module is loaded... GetModuleInformation(GetCurrentProcess(),
if ( hMods[i], &modInfo, sizeof(MODULEINFO));
(ExceptionInfo->ExceptionRecord->ExceptionAddress >= modInfo.lpBaseOfDll) && // If the exception address is located in the range of
(ExceptionInfo->ExceptionRecord->ExceptionAddress < (modInfo.lpBaseOfDll + modInfo.SizeOfImage)) // 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! // ...this is the module we're looking for!
ipModule = hMods[i]; ipModule = hMods[i];
break; break;
@@ -107,33 +137,34 @@ LONG CALLBACK MakeCrashDump(PEXCEPTION_POINTERS ExceptionInfo) {
} }
// Start to put the crash-dump string into the buffer. // Start to put the crash-dump string into the buffer.
sprintf(ExceptionHandlerBuffer, sprintf(ExceptionHandlerBuffer,
"86Box version %s crashed on %d-%02d-%02d %02d:%02d:%02d.%03d\r\n\r\n" "86Box version %s crashed on %d-%02d-%02d %02d:%02d:%02d.%03d\r\n\r\n"
"" ""
"Exception details:\r\n" "Exception details:\r\n"
"Exception NTSTATUS code: 0x%08x\r\n" "Exception NTSTATUS code: 0x%08x\r\n"
"Occured at address: 0x%p", "Occured at address: 0x%p",
emulator_version, SystemTime.wYear, SystemTime.wMonth, SystemTime.wDay, SystemTime.wHour, SystemTime.wMinute, SystemTime.wSecond, SystemTime.wMilliseconds, emulator_version,
SystemTime.wYear, SystemTime.wMonth, SystemTime.wDay,
SystemTime.wHour, SystemTime.wMinute, SystemTime.wSecond,
SystemTime.wMilliseconds,
ExceptionInfo->ExceptionRecord->ExceptionCode, ExceptionInfo->ExceptionRecord->ExceptionCode,
ExceptionInfo->ExceptionRecord->ExceptionAddress); 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. // 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)]; BufPtr = &ExceptionHandlerBuffer[strlen(ExceptionHandlerBuffer)];
if (ipModule != 0) { if (ipModule != 0) {
sprintf(CurrentBufferPointer," ["); sprintf(BufPtr," [");
GetModuleFileName(ipModule,&CurrentBufferPointer[2],ExceptionHandlerBufferSize - strlen(ExceptionHandlerBuffer)); GetModuleFileName(ipModule, &BufPtr[2],
ExceptionHandlerBufferSize - strlen(ExceptionHandlerBuffer));
if (GetLastError() == ERROR_SUCCESS) { if (GetLastError() == ERROR_SUCCESS) {
CurrentBufferPointer = &ExceptionHandlerBuffer[strlen(ExceptionHandlerBuffer)]; BufPtr = &ExceptionHandlerBuffer[strlen(ExceptionHandlerBuffer)];
sprintf(CurrentBufferPointer,"]"); sprintf(BufPtr,"]");
CurrentBufferPointer += 1; BufPtr += 1;
} }
} }
// Continue to create the crash-dump string. // Continue to create the crash-dump string.
sprintf(CurrentBufferPointer, sprintf(BufPtr,
"\r\n" "\r\n"
"Number of parameters: %d\r\n" "Number of parameters: %d\r\n"
"Exception parameters: ", "Exception parameters: ",
@@ -141,17 +172,17 @@ LONG CALLBACK MakeCrashDump(PEXCEPTION_POINTERS ExceptionInfo) {
// Add the exception parameters to the crash-dump string. // Add the exception parameters to the crash-dump string.
for (int i = 0; i < ExceptionInfo->ExceptionRecord->NumberParameters; i++) { for (int i = 0; i < ExceptionInfo->ExceptionRecord->NumberParameters; i++) {
CurrentBufferPointer = &ExceptionHandlerBuffer[strlen(ExceptionHandlerBuffer)]; BufPtr = &ExceptionHandlerBuffer[strlen(ExceptionHandlerBuffer)];
sprintf(CurrentBufferPointer,"0x%p ",ExceptionInfo->ExceptionRecord->ExceptionInformation[i]); sprintf(BufPtr,"0x%p ",
ExceptionInfo->ExceptionRecord->ExceptionInformation[i]);
} }
BufPtr = &ExceptionHandlerBuffer[strlen(ExceptionHandlerBuffer) - 1];
CurrentBufferPointer = &ExceptionHandlerBuffer[strlen(ExceptionHandlerBuffer) - 1];
PCONTEXT Registers = ExceptionInfo->ContextRecord; PCONTEXT Registers = ExceptionInfo->ContextRecord;
#if defined(__i386__) && !defined(__x86_64) #if defined(__i386__) && !defined(__x86_64)
// This binary is being compiled for x86, include a register dump. // This binary is being compiled for x86, include a register dump.
sprintf(CurrentBufferPointer, sprintf(BufPtr,
"\r\n" "\r\n"
"Register dump:\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" "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"
@@ -159,27 +190,36 @@ LONG CALLBACK MakeCrashDump(PEXCEPTION_POINTERS ExceptionInfo) {
Registers->Eax, Registers->Ebx, Registers->Ecx, Registers->Edx, Registers->Ebp, Registers->Esp, Registers->Esi, Registers->Edi, Registers->Eip); Registers->Eax, Registers->Ebx, Registers->Ecx, Registers->Edx, Registers->Ebp, Registers->Esp, Registers->Esi, Registers->Edi, Registers->Eip);
#else #else
// Register dump is supported by no other architectures right now. MinGW headers seem to lack the x64 CONTEXT structure definition. // Register dump is supported by no other architectures right now. MinGW headers seem to lack the x64 CONTEXT structure definition.
sprintf(CurrentBufferPointer,"\r\n"); sprintf(BufPtr,"\r\n");
#endif #endif
// The crash-dump string has been created, write it to disk. // The crash-dump string has been created, write it to disk.
WriteFile(hDumpFile, WriteFile(hDumpFile, ExceptionHandlerBuffer,
ExceptionHandlerBuffer, strlen(ExceptionHandlerBuffer), NULL, NULL);
strlen(ExceptionHandlerBuffer),
NULL,
NULL);
// Finally, close the file. // Finally, close the file.
CloseHandle(hDumpFile); CloseHandle(hDumpFile);
// And return, therefore causing the crash, but only after the crash dump has been created. // And return, therefore causing the crash,
// but only after the crash dump has been created.
return EXCEPTION_CONTINUE_SEARCH; 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. 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); 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.
/*
* 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); 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 see COPYING for more details
*/ */
#include <stdint.h> #include <stdint.h>
#define UNICODE #include "../video/video.h"
#define BITMAP WINDOWS_BITMAP
#include <d3d9.h>
#undef BITMAP
#include <D3dx9tex.h>
#include "win.h" #include "win.h"
#include "win_d3d.h" #include "win_d3d.h"
#include "../video/video.h"
#include "win_cgapal.h" #include "win_cgapal.h"
#include "resource.h" #include "resource.h"

View File

@@ -1,13 +1,32 @@
/* Copyright holders: Sarah Walker, Tenshi /* Copyright holders: Sarah Walker, Tenshi
see COPYING for more details 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 #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
int d3d_init(HWND h);
void d3d_close(); extern int d3d_init(HWND h);
void d3d_reset(); extern void d3d_close(void);
void d3d_resize(int x, int y); 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 #ifdef __cplusplus
} }
#endif #endif
#endif /*WIN_D3D_H*/

View File

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

View File

@@ -1,12 +1,30 @@
/* Copyright holders: Sarah Walker, Tenshi /* Copyright holders: Sarah Walker, Tenshi
see COPYING for more details 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 #ifdef __cplusplus
extern "C" { extern "C" {
#endif #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 #ifdef __cplusplus
} }
#endif #endif
#endif /*WIN_DDRAW_H*/

View File

@@ -2,16 +2,22 @@
see COPYING for more details see COPYING for more details
*/ */
#include <stdint.h> #include <stdint.h>
#define UNICODE
#define BITMAP WINDOWS_BITMAP
#include <ddraw.h>
#undef BITMAP
#include "../video/video.h" #include "../video/video.h"
#include "win_ddraw-fs.h" #include "win_ddraw.h"
#include "win_ddraw-screenshot.h"
#include "win_cgapal.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 fatal(const char *format, ...);
extern "C" void pclog(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); 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(int, int, int, int, int, int);
static void ddraw_fs_blit_memtoscreen_8(int x, int y, int w, int h); 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) int ddraw_fs_init(HWND h)
{ {

View File

@@ -5,25 +5,20 @@
#include <stdint.h> #include <stdint.h>
#define UNICODE #define UNICODE
#define BITMAP WINDOWS_BITMAP #define BITMAP WINDOWS_BITMAP
#include <ddraw.h> #include <windows.h>
#undef BITMAP #undef BITMAP
#include "../video/video.h" #include "../video/video.h"
#include "win.h" #include "win.h"
#include "win_ddraw-screenshot.h" #include "win_ddraw.h"
#include "win_language.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 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) void CopySurface(IDirectDrawSurface7 *pDDSurface)
{ {
@@ -58,6 +53,7 @@ void CopySurface(IDirectDrawSurface7 *pDDSurface)
return ; return ;
} }
void DoubleLines(uint8_t *dst, uint8_t *src) void DoubleLines(uint8_t *dst, uint8_t *src)
{ {
int i = 0; int i = 0;

View File

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

View File

@@ -6,8 +6,6 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <wchar.h>
#include "cdrom.h" #include "cdrom.h"
#include "config.h" #include "config.h"
#include "device.h" #include "device.h"
@@ -30,15 +28,8 @@
#include "sound/snd_opl.h" #include "sound/snd_opl.h"
#include "sound/sound.h" #include "sound/sound.h"
#include "video/video.h" #include "video/video.h"
#ifndef __unix
#define UNICODE
#define BITMAP WINDOWS_BITMAP
#include <windows.h>
#undef BITMAP
#include "win.h" #include "win.h"
#include "win_language.h" #include "win_language.h"
#endif
wchar_t config_file_default[256]; 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. * 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> * 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. */ /* 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]); mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
sprintf(filter_exp, 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) )", "( ((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. * it should be malloc'ed and then linked to the NETCARD def.
* Will be done later. * 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> * Authors: Kotori, <oubattler@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com> * Fred N. van Kempen, <decwiz@yahoo.com>
@@ -25,14 +25,8 @@
#include "device.h" #include "device.h"
#include "network.h" #include "network.h"
#include "net_ne2000.h" #include "net_ne2000.h"
#ifndef unix
# define UNICODE
# define BITMAP WINDOWS_BITMAP
# include <windows.h>
# undef BITMAP
#include "win.h" #include "win.h"
#include "win_language.h" #include "win_language.h"
#endif
static netcard_t net_cards[] = { static netcard_t net_cards[] = {

View File

@@ -57,18 +57,10 @@
#include "video/video.h" #include "video/video.h"
#include "video/vid_voodoo.h" #include "video/vid_voodoo.h"
#include "amstrad.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.h"
#include "win_language.h" #include "win_language.h"
#ifdef WALTJE
# include "plat_dir.h"
#endif #endif