Merge
This commit is contained in:
BIN
src/86box.cfg
BIN
src/86box.cfg
Binary file not shown.
@@ -3,3 +3,5 @@
|
||||
*/
|
||||
#define emulator_version "1.20"
|
||||
#define emulator_version_w L"1.20"
|
||||
|
||||
#define CONFIG_FILE L"86box.cfg"
|
||||
|
||||
42
src/Makefile.local
Normal file
42
src/Makefile.local
Normal 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.
|
||||
@@ -8,7 +8,7 @@
|
||||
#
|
||||
# Modified Makefile for Win32 MinGW 32-bit environment.
|
||||
#
|
||||
# Version: @(#)Makefile.mingw 1.0.13 2017/05/17
|
||||
# Version: @(#)Makefile.mingw 1.0.16 2017/05/23
|
||||
#
|
||||
# Authors: Kotori, <oubattler@gmail.com>
|
||||
# Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
@@ -17,24 +17,37 @@
|
||||
#
|
||||
|
||||
# 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
|
||||
<<<<<<< HEAD
|
||||
STUFF = -DDEV_BRANCH
|
||||
=======
|
||||
ifndef STUFF
|
||||
STUFF =
|
||||
endif
|
||||
>>>>>>> master
|
||||
|
||||
# Add feature selections here.
|
||||
# -DBUGGER adds the ISA BusBugger emulation.
|
||||
ifndef EXTRAS
|
||||
EXTRAS =
|
||||
endif
|
||||
|
||||
# Do we want a debugging build?
|
||||
DEBUG = y
|
||||
OPTIM = n
|
||||
ifndef DEBUG
|
||||
DEBUG = n
|
||||
endif
|
||||
ifndef OPTIM
|
||||
OPTIM = y
|
||||
endif
|
||||
ifndef X64
|
||||
X64 = n
|
||||
|
||||
# Where is the WinPcap DLL ?
|
||||
PCAPDLL = C:\\Windows\\System32\\wpcap.dll
|
||||
endif
|
||||
|
||||
|
||||
#########################################################################
|
||||
@@ -53,20 +66,26 @@ 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
|
||||
@@ -105,17 +124,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 \
|
||||
@@ -136,54 +155,54 @@ 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_nv_riva128.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_nv_riva128.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_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)
|
||||
@@ -201,7 +220,7 @@ LIBS = -mwindows -lcomctl32 -lwinmm -lopenal.dll -lopenal -lddraw \
|
||||
# Build rules.
|
||||
%.o: %.c
|
||||
@echo $<
|
||||
$(CC) $(CFLAGS) -c $<
|
||||
@$(CC) $(CFLAGS) -c $<
|
||||
|
||||
%.o: %.cc
|
||||
@echo $<
|
||||
@@ -218,7 +237,7 @@ $(PROG).exe: $(OBJ) $(LZFOBJ) $(SLIRPOBJ)
|
||||
@echo Linking $(PROG).exe ..
|
||||
@$(CC) -o $(PROG).exe \
|
||||
$(OBJ) $(LZFOBJ) $(SLIRPOBJ) \
|
||||
$(LIBS) -static -Lpcap -lwpcapdelay
|
||||
$(LIBS) #-static -Lpcap -lwpcapdelay
|
||||
ifneq ($(DEBUG), y)
|
||||
@strip $(PROG).exe
|
||||
endif
|
||||
@@ -242,10 +261,6 @@ clean:
|
||||
@echo Processing $<
|
||||
@$(WINDRES) $(RFLAGS) -i win/86Box.rc -o 86Box.res
|
||||
|
||||
libwpcapdelay.a: $(PCAPDLL)
|
||||
@dlltool --export-all-symbols --output-def wpcap.def $(PCAPDLL)
|
||||
@dlltool --def wpcap.def --output-delaylib libwpcapdelay.a
|
||||
|
||||
pcap_if.res: pcap_if.rc
|
||||
@echo Processing $<
|
||||
@$(WINDRES) $(RFLAGS) -i win/pcap_if.rc -o pcap_if.res
|
||||
|
||||
@@ -1010,6 +1010,7 @@ BEGIN
|
||||
2201 "SCSI removable disk: %ws"
|
||||
2202 "<Placeholder string>"
|
||||
2203 "English (United States)"
|
||||
2204 "Pcap Library Not Available"
|
||||
END
|
||||
|
||||
|
||||
|
||||
30
src/WIN/plat_dynld.h
Normal file
30
src/WIN/plat_dynld.h
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* Define the Dynamic Module Loader interface.
|
||||
*
|
||||
* Version: @(#)plat_dynld.h 1.0.1 2017/05/21
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Copyright 2017 Fred N. van Kempen
|
||||
*/
|
||||
#ifndef PLAT_DYNLD_H
|
||||
# define PLAT_DYNLD_H
|
||||
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
void *func;
|
||||
} dllimp_t;
|
||||
|
||||
|
||||
extern void *dynld_module(const char *, dllimp_t *);
|
||||
extern void dynld_close(void *);
|
||||
|
||||
|
||||
#endif /*PLAT_DYNLD_H*/
|
||||
@@ -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"
|
||||
|
||||
|
||||
|
||||
@@ -1,53 +1,75 @@
|
||||
/*
|
||||
* This should be named 'plat.h' and then include any
|
||||
* Windows-specific header files needed, to keep them
|
||||
* out of the main code.
|
||||
*/
|
||||
/* Copyright holders: Sarah Walker
|
||||
see COPYING for more details
|
||||
*/
|
||||
extern HINSTANCE hinstance;
|
||||
extern HWND ghwnd;
|
||||
extern int mousecapture;
|
||||
#ifndef BOX_WIN_H
|
||||
# define BOX_WIN_H
|
||||
# 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
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define szClassName L"86BoxMainWnd"
|
||||
#define szSubClassName L"86BoxSubWnd"
|
||||
#define szStatusBarClassName L"86BoxStatusBar"
|
||||
|
||||
void leave_fullscreen();
|
||||
|
||||
extern HINSTANCE hinstance;
|
||||
extern HWND ghwnd;
|
||||
extern HWND status_hwnd;
|
||||
extern HWND hwndStatus;
|
||||
extern int status_is_open;
|
||||
extern int mousecapture;
|
||||
|
||||
extern char openfilestring[260];
|
||||
extern WCHAR wopenfilestring[260];
|
||||
|
||||
extern int pause;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void leave_fullscreen(void);
|
||||
|
||||
extern void status_open(HWND hwnd);
|
||||
|
||||
extern void deviceconfig_open(HWND hwnd, struct device_t *device);
|
||||
extern void joystickconfig_open(HWND hwnd, int joy_nr, int type);
|
||||
|
||||
extern int getfile(HWND hwnd, char *f, char *fn);
|
||||
extern int getsfile(HWND hwnd, char *f, char *fn);
|
||||
|
||||
extern void get_executable_name(WCHAR *s, int size);
|
||||
extern void set_window_title(WCHAR *s);
|
||||
|
||||
extern void startblit(void);
|
||||
extern void endblit(void);
|
||||
|
||||
extern void win_settings_open(HWND hwnd);
|
||||
extern void win_menu_update();
|
||||
|
||||
extern void update_status_bar_panes(HWND hwnds);
|
||||
|
||||
extern int fdd_type_to_icon(int type);
|
||||
|
||||
extern void hard_disk_add_open(HWND hwnd, int is_existing);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void status_open(HWND hwnd);
|
||||
extern HWND status_hwnd;
|
||||
extern int status_is_open;
|
||||
|
||||
void deviceconfig_open(HWND hwnd, struct device_t *device);
|
||||
void joystickconfig_open(HWND hwnd, int joy_nr, int type);
|
||||
|
||||
extern char openfilestring[260];
|
||||
extern WCHAR wopenfilestring[260];
|
||||
|
||||
int getfile(HWND hwnd, char *f, char *fn);
|
||||
int getsfile(HWND hwnd, char *f, char *fn);
|
||||
|
||||
void get_executable_name(WCHAR *s, int size);
|
||||
void set_window_title(WCHAR *s);
|
||||
|
||||
void startblit();
|
||||
void endblit();
|
||||
|
||||
extern int pause;
|
||||
|
||||
void win_settings_open(HWND hwnd);
|
||||
void win_menu_update();
|
||||
|
||||
void update_status_bar_panes(HWND hwnds);
|
||||
|
||||
int fdd_type_to_icon(int type);
|
||||
|
||||
extern HWND hwndStatus;
|
||||
|
||||
void hard_disk_add_open(HWND hwnd, int is_existing);
|
||||
#endif /*BOX_WIN_H*/
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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*/
|
||||
|
||||
@@ -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;
|
||||
@@ -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
|
||||
@@ -1,4 +0,0 @@
|
||||
/* Copyright holders: Tenshi
|
||||
see COPYING for more details
|
||||
*/
|
||||
void ddraw_common_take_screenshot(wchar_t *fn, IDirectDrawSurface7 *pDDSurface);
|
||||
@@ -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"
|
||||
|
||||
|
||||
|
||||
@@ -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*/
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
|
||||
64
src/WIN/win_dynld.c
Normal file
64
src/WIN/win_dynld.c
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* Try to load a support DLL.
|
||||
*
|
||||
* Version: @(#)win_dynld.c 1.0.1 2017/05/21
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Copyright 2017 Fred N. van Kempen
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <pcap.h>
|
||||
#include "plat_dynld.h"
|
||||
#include "../ibm.h"
|
||||
|
||||
|
||||
void *
|
||||
dynld_module(const char *name, dllimp_t *table)
|
||||
{
|
||||
HANDLE h;
|
||||
dllimp_t *imp;
|
||||
void *func;
|
||||
char **foo;
|
||||
|
||||
/* See if we can load the desired module. */
|
||||
if ((h = LoadLibrary(name)) == NULL) {
|
||||
pclog("DynLd(\"%s\"): library not found!\n", name);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* Now load the desired function pointers. */
|
||||
for (imp=table; imp->name!=NULL; imp++) {
|
||||
func = GetProcAddress(h, imp->name);
|
||||
if (func == NULL) {
|
||||
pclog("DynLd(\"%s\"): function '%s' not found!\n",
|
||||
name, imp->name);
|
||||
CloseHandle(h);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* To overcome typing issues.. */
|
||||
*(char **)imp->func = (char *)func;
|
||||
}
|
||||
|
||||
/* All good. */
|
||||
return((void *)h);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dynld_close(void *handle)
|
||||
{
|
||||
if (handle != NULL)
|
||||
CloseHandle((HANDLE *)handle);
|
||||
}
|
||||
@@ -21,7 +21,7 @@ LCID dwLanguage;
|
||||
|
||||
uint32_t dwLangID, dwSubLangID;
|
||||
|
||||
#define STRINGS_NUM 154
|
||||
#define STRINGS_NUM 157 /* FIXME: should be in resource.h !! --FvK */
|
||||
|
||||
WCHAR lpResourceString[STRINGS_NUM][512];
|
||||
|
||||
|
||||
13
src/config.c
13
src/config.c
@@ -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];
|
||||
@@ -971,9 +962,9 @@ static void loadconfig_hard_disks(void)
|
||||
{
|
||||
hdc[c].spt = 99;
|
||||
}
|
||||
if (hdc[c].hpc > 64)
|
||||
if (hdc[c].hpc > 255)
|
||||
{
|
||||
hdc[c].hpc = 64;
|
||||
hdc[c].hpc = 255;
|
||||
}
|
||||
if (hdc[c].tracks > 266305)
|
||||
{
|
||||
|
||||
474
src/net_ne2000.c
474
src/net_ne2000.c
File diff suppressed because it is too large
Load Diff
198
src/net_pcap.c
198
src/net_pcap.c
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* 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.
|
||||
*
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Handle WinPcap library processing.
|
||||
*
|
||||
* Version: @(#)net_pcap.c 1.0.2 2017/05/17
|
||||
* Version: @(#)net_pcap.c 1.0.4 2017/05/23
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*/
|
||||
@@ -22,59 +22,61 @@
|
||||
#include "thread.h"
|
||||
#include "device.h"
|
||||
#include "network.h"
|
||||
#include "plat_dynld.h"
|
||||
|
||||
|
||||
static void *pcap_handle; /* handle to WinPcap DLL */
|
||||
static pcap_t *pcap; /* handle to WinPcap library */
|
||||
static thread_t *poll_tid;
|
||||
static NETRXCB poll_rx; /* network RX function to call */
|
||||
static void *poll_arg; /* network RX function arg */
|
||||
|
||||
|
||||
#ifdef WALTJE
|
||||
int pcap_do_log = 1;
|
||||
# define ENABLE_PCAP_LOG
|
||||
#else
|
||||
int pcap_do_log = 0;
|
||||
#endif
|
||||
/* Pointers to the real functions. */
|
||||
static const char *(*f_pcap_lib_version)(void);
|
||||
static int (*f_pcap_findalldevs)(pcap_if_t **,char *);
|
||||
static void (*f_pcap_freealldevs)(pcap_if_t *);
|
||||
static pcap_t *(*f_pcap_open_live)(const char *,int,int,int,char *);
|
||||
static int (*f_pcap_compile)(pcap_t *,struct bpf_program *,
|
||||
const char *,int,bpf_u_int32);
|
||||
static int (*f_pcap_setfilter)(pcap_t *,struct bpf_program *);
|
||||
static const u_char *(*f_pcap_next)(pcap_t *,struct pcap_pkthdr *);
|
||||
static int (*f_pcap_sendpacket)(pcap_t *,const u_char *,int);
|
||||
static void (*f_pcap_close)(pcap_t *);
|
||||
static dllimp_t pcap_imports[] = {
|
||||
{ "pcap_lib_version", &f_pcap_lib_version },
|
||||
{ "pcap_findalldevs", &f_pcap_findalldevs },
|
||||
{ "pcap_freealldevs", &f_pcap_freealldevs },
|
||||
{ "pcap_open_live", &f_pcap_open_live },
|
||||
{ "pcap_compile", &f_pcap_compile },
|
||||
{ "pcap_setfilter", &f_pcap_setfilter },
|
||||
{ "pcap_next", &f_pcap_next },
|
||||
{ "pcap_sendpacket", &f_pcap_sendpacket },
|
||||
{ "pcap_close", &f_pcap_close },
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
pcap_log(const char *format, ...)
|
||||
{
|
||||
#ifdef ENABLE_PCAP_LOG
|
||||
va_list ap;
|
||||
|
||||
if (pcap_do_log) {
|
||||
va_start(ap, format);
|
||||
vprintf(format, ap);
|
||||
va_end(ap);
|
||||
fflush(stdout);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#define pclog pcap_log
|
||||
|
||||
|
||||
/* Check if the interface has a packet for us. */
|
||||
/* Handle the receiving of frames from the channel. */
|
||||
static void
|
||||
poll_thread(void *arg)
|
||||
{
|
||||
const unsigned char *data;
|
||||
uint8_t *mac = (uint8_t *)arg;
|
||||
const uint8_t *data = NULL;
|
||||
struct pcap_pkthdr h;
|
||||
event_t *evt;
|
||||
uint32_t mac_cmp32[2];
|
||||
uint16_t mac_cmp16[2];
|
||||
event_t *evt;
|
||||
|
||||
pclog("PCAP: polling thread started, arg %08lx\n", arg);
|
||||
|
||||
/* Create a waitable event. */
|
||||
evt = thread_create_event();
|
||||
pclog("PCAP: poll event is %08lx\n", evt);
|
||||
|
||||
/* As long as the channel is open.. */
|
||||
while (pcap != NULL) {
|
||||
/* Wait for the next packet to arrive. */
|
||||
data = pcap_next(pcap, &h);
|
||||
data = f_pcap_next(pcap, &h);
|
||||
if (data != NULL) {
|
||||
/* Received MAC. */
|
||||
mac_cmp32[0] = *(uint32_t *)(data+6);
|
||||
@@ -105,30 +107,59 @@ poll_thread(void *arg)
|
||||
}
|
||||
|
||||
|
||||
/* Initialize the (Win)Pcap module for use. */
|
||||
int
|
||||
network_pcap_init(netdev_t *list)
|
||||
{
|
||||
char errbuf[PCAP_ERRBUF_SIZE];
|
||||
pcap_if_t *devlist, *dev;
|
||||
int i = 0;
|
||||
|
||||
/* Local variables. */
|
||||
pcap = NULL;
|
||||
|
||||
/* Try loading the DLL. */
|
||||
pcap_handle = dynld_module("wpcap.dll", pcap_imports);
|
||||
if (pcap_handle == NULL) return(-1);
|
||||
|
||||
/* Retrieve the device list from the local machine */
|
||||
if (f_pcap_findalldevs(&devlist, errbuf) == -1) {
|
||||
pclog("PCAP: error in pcap_findalldevs: %s\n", errbuf);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
for (dev=devlist; dev!=NULL; dev=dev->next) {
|
||||
strcpy(list->device, dev->name);
|
||||
if (dev->description)
|
||||
strcpy(list->description, dev->description);
|
||||
else
|
||||
memset(list->description, '\0', sizeof(list->description));
|
||||
list++; i++;
|
||||
}
|
||||
|
||||
/* Release the memory. */
|
||||
f_pcap_freealldevs(devlist);
|
||||
|
||||
return(i);
|
||||
}
|
||||
|
||||
|
||||
/* Initialize WinPcap for us. */
|
||||
int
|
||||
network_pcap_setup(uint8_t *mac, NETRXCB func, void *arg)
|
||||
{
|
||||
int rc;
|
||||
char temp[PCAP_ERRBUF_SIZE];
|
||||
char filter_exp[255];
|
||||
struct bpf_program fp;
|
||||
char *dev;
|
||||
|
||||
/* Messy, but gets rid of a lot of useless info. */
|
||||
dev = (char *)pcap_lib_version();
|
||||
if (dev == NULL) {
|
||||
/* Hmm, WinPcap doesn't seem to be alive.. */
|
||||
pclog("PCAP: WinPcap library not found, disabling network!\n");
|
||||
network_type = -1;
|
||||
return(-1);
|
||||
}
|
||||
/* Did we already load the DLL? */
|
||||
if (pcap_handle == NULL) return(-1);
|
||||
|
||||
/* OK, good for now.. */
|
||||
strcpy(temp, dev);
|
||||
strcpy(temp, f_pcap_lib_version());
|
||||
dev = strchr(temp, '(');
|
||||
if (dev != NULL) *(dev-1) = '\0';
|
||||
pclog("Initializing WinPcap, version %s\n", temp);
|
||||
pclog("PCAP: initializing, %s\n", temp);
|
||||
|
||||
/* Get the value of our capture interface. */
|
||||
dev = network_pcap;
|
||||
@@ -138,38 +169,35 @@ network_pcap_setup(uint8_t *mac, NETRXCB func, void *arg)
|
||||
}
|
||||
pclog(" Network interface: '%s'\n", dev);
|
||||
|
||||
pcap = pcap_open_live(dev, /* interface name */
|
||||
1518, /* maximum packet size */
|
||||
1, /* promiscuous mode? */
|
||||
15, /* timeout in msec */
|
||||
temp); /* error buffer */
|
||||
pcap = f_pcap_open_live(dev, /* interface name */
|
||||
1518, /* maximum packet size */
|
||||
1, /* promiscuous mode? */
|
||||
10, /* timeout in msec */
|
||||
temp); /* error buffer */
|
||||
if (pcap == NULL) {
|
||||
pclog("Unable to open WinPcap: %s!\n", temp);
|
||||
pclog(" Unable to open device: %s!\n", temp);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* Create a MAC address based packet filter. */
|
||||
pclog("Building packet filter ...");
|
||||
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) )",
|
||||
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5],
|
||||
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||
if (pcap_compile(pcap, &fp, filter_exp, 0, 0xffffffff) != -1) {
|
||||
pclog("...");
|
||||
if (pcap_setfilter(pcap, &fp) == -1) {
|
||||
pclog(" error installing filter!\n");
|
||||
} else {
|
||||
pclog("!\nUsing filter\t[%s]\n", filter_exp);
|
||||
}
|
||||
if (f_pcap_compile(pcap, &fp, filter_exp, 0, 0xffffffff) != -1) {
|
||||
if (f_pcap_setfilter(pcap, &fp) == -1)
|
||||
pclog(" Error installing filter (%s) !\n", filter_exp);
|
||||
} else {
|
||||
pclog(" could not compile filter!\n");
|
||||
pclog(" Could not compile filter (%s) !\n", filter_exp);
|
||||
}
|
||||
|
||||
/* Save the callback info. */
|
||||
poll_rx = func;
|
||||
poll_arg = arg;
|
||||
|
||||
pclog("PCAP: creating thread..\n");
|
||||
pclog(" Starting thread..\n");
|
||||
poll_tid = thread_create(poll_thread, mac);
|
||||
|
||||
return(0);
|
||||
@@ -200,7 +228,13 @@ network_pcap_close(void)
|
||||
#endif
|
||||
|
||||
/* OK, now shut down WinPcap itself. */
|
||||
pcap_close(pc);
|
||||
f_pcap_close(pc);
|
||||
|
||||
/* Unload the DLL if possible. */
|
||||
if (pcap_handle != NULL) {
|
||||
dynld_close(pcap_handle);
|
||||
pcap_handle = NULL;
|
||||
}
|
||||
}
|
||||
poll_rx = NULL;
|
||||
poll_arg = NULL;
|
||||
@@ -212,49 +246,5 @@ void
|
||||
network_pcap_in(uint8_t *bufp, int len)
|
||||
{
|
||||
if (pcap != NULL)
|
||||
pcap_sendpacket(pcap, bufp, len);
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve an easy-to-use list of devices. */
|
||||
int
|
||||
network_devlist(netdev_t *list)
|
||||
{
|
||||
char errbuf[PCAP_ERRBUF_SIZE];
|
||||
char *temp_dev;
|
||||
pcap_if_t *devlist, *dev;
|
||||
int i = 0;
|
||||
|
||||
/* Create a first entry that's always there - needed by UI. */
|
||||
strcpy(list->device, "none");
|
||||
strcpy(list->description, "None");
|
||||
list++; i++;
|
||||
|
||||
/* See if WinPcap is even present, and get out of here if it's not. */
|
||||
temp_dev = (char *)pcap_lib_version();
|
||||
if (temp_dev == NULL) {
|
||||
/* Hmm, WinPcap doesn't seem to be alive.. */
|
||||
pclog("PCAP: WinPcap library not found, not processing the networks list further!\n");
|
||||
return(i);
|
||||
}
|
||||
|
||||
/* Retrieve the device list from the local machine */
|
||||
if (pcap_findalldevs(&devlist, errbuf) == -1) {
|
||||
pclog("NETWORK: error in pcap_findalldevs: %s\n", errbuf);
|
||||
return(i);
|
||||
}
|
||||
|
||||
for (dev=devlist; dev!=NULL; dev=dev->next) {
|
||||
strcpy(list->device, dev->name);
|
||||
if (dev->description)
|
||||
strcpy(list->description, dev->description);
|
||||
else
|
||||
memset(list->description, '\0', sizeof(list->description));
|
||||
list++; i++;
|
||||
}
|
||||
|
||||
/* Release the memory. */
|
||||
pcap_freealldevs(devlist);
|
||||
|
||||
return(i);
|
||||
f_pcap_sendpacket(pcap, bufp, len);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Handle SLiRP library processing.
|
||||
*
|
||||
* Version: @(#)net_slirp.c 1.0.2 2017/05/17
|
||||
* Version: @(#)net_slirp.c 1.0.3 2017/05/21
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*/
|
||||
@@ -63,7 +63,7 @@ slirp_tic(void)
|
||||
}
|
||||
|
||||
|
||||
/* Check if the interface has a packet for us. */
|
||||
/* Handle the receiving of frames. */
|
||||
static void
|
||||
poll_thread(void *arg)
|
||||
{
|
||||
@@ -75,7 +75,6 @@ poll_thread(void *arg)
|
||||
|
||||
/* Create a waitable event. */
|
||||
evt = thread_create_event();
|
||||
pclog("SLiRP: poll event is %08lx\n", evt);
|
||||
|
||||
while (slirpq != NULL) {
|
||||
/* See if there is any work. */
|
||||
@@ -90,8 +89,10 @@ poll_thread(void *arg)
|
||||
|
||||
/* Grab a packet from the queue. */
|
||||
qp = QueueDelete(slirpq);
|
||||
#if 0
|
||||
pclog("SLiRP: inQ:%d got a %dbyte packet @%08lx\n",
|
||||
QueuePeek(slirpq), qp->len, qp);
|
||||
#endif
|
||||
|
||||
if (poll_rx != NULL)
|
||||
poll_rx(poll_arg, (uint8_t *)&qp->data, qp->len);
|
||||
@@ -113,7 +114,7 @@ network_slirp_setup(uint8_t *mac, NETRXCB func, void *arg)
|
||||
{
|
||||
int rc;
|
||||
|
||||
pclog("Initializing SLiRP\n");
|
||||
pclog("SLiRP: initializing..\n");
|
||||
|
||||
if (slirp_init() != 0) {
|
||||
pclog("SLiRP could not be initialized!\n");
|
||||
@@ -127,7 +128,7 @@ network_slirp_setup(uint8_t *mac, NETRXCB func, void *arg)
|
||||
poll_rx = func;
|
||||
poll_arg = arg;
|
||||
|
||||
pclog("SLiRP: creating thread..\n");
|
||||
pclog("SLiRP: starting thread..\n");
|
||||
poll_tid = thread_create(poll_thread, mac);
|
||||
|
||||
return(0);
|
||||
|
||||
@@ -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.4 2017/05/17
|
||||
* Version: @(#)network.c 1.0.6 2017/05/22
|
||||
*
|
||||
* Authors: Kotori, <oubattler@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
@@ -25,6 +25,8 @@
|
||||
#include "device.h"
|
||||
#include "network.h"
|
||||
#include "net_ne2000.h"
|
||||
#include "win.h"
|
||||
#include "win_language.h"
|
||||
|
||||
|
||||
static netcard_t net_cards[] = {
|
||||
@@ -59,11 +61,20 @@ char network_pcap[512];
|
||||
void
|
||||
network_init(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
network_type = NET_TYPE_NONE;
|
||||
network_card = 0;
|
||||
|
||||
/* Initialize list of PCap devices. */
|
||||
network_ndev = network_devlist(network_devs);
|
||||
/* Create a first device entry that's always there, as needed by UI. */
|
||||
strcpy(network_devs[0].device, "none");
|
||||
strcpy(network_devs[0].description, "None");
|
||||
network_ndev = 1;
|
||||
|
||||
/* Initialize the Pcap system module, if present. */
|
||||
i = network_pcap_init(&network_devs[network_ndev]);
|
||||
if (i > 0)
|
||||
network_ndev += i;
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +90,7 @@ network_attach(void *dev, uint8_t *mac, NETRXCB rx)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
if (! network_card) return(ret);
|
||||
if (network_card == 0) return(ret);
|
||||
|
||||
/* Save the card's callback info. */
|
||||
net_cards[network_card].private = dev;
|
||||
@@ -89,6 +100,10 @@ network_attach(void *dev, uint8_t *mac, NETRXCB rx)
|
||||
switch(network_type) {
|
||||
case NET_TYPE_PCAP:
|
||||
ret = network_pcap_setup(mac, rx, dev);
|
||||
if (ret < 0) {
|
||||
msgbox_error(ghwnd, 2202);
|
||||
network_type = NET_TYPE_NONE;
|
||||
}
|
||||
break;
|
||||
|
||||
case NET_TYPE_SLIRP:
|
||||
@@ -128,7 +143,7 @@ network_close(void)
|
||||
void
|
||||
network_reset(void)
|
||||
{
|
||||
pclog("NETWORK: reset (type=%d, card=%d\n", network_type, network_card);
|
||||
pclog("NETWORK: reset (type=%d, card=%d)\n", network_type, network_card);
|
||||
|
||||
/* Just in case.. */
|
||||
network_close();
|
||||
@@ -136,11 +151,10 @@ network_reset(void)
|
||||
/* If no active card, we're done. */
|
||||
if ((network_type==NET_TYPE_NONE) || (network_card==0)) return;
|
||||
|
||||
pclog("NETWORK: set up for %s, card=%s\n",
|
||||
pclog("NETWORK: set up for %s, card='%s'\n",
|
||||
(network_type==NET_TYPE_SLIRP)?"SLiRP":"WinPcap",
|
||||
net_cards[network_card].name);
|
||||
|
||||
pclog("NETWORK: reset (card=%d)\n", network_card);
|
||||
/* Add the (new?) card to the I/O system. */
|
||||
if (net_cards[network_card].device) {
|
||||
pclog("NETWORK: adding device '%s'\n",
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Definitions for the network module.
|
||||
*
|
||||
* Version: @(#)network.h 1.0.4 2017/05/17
|
||||
* Version: @(#)network.h 1.0.5 2017/05/21
|
||||
*
|
||||
* Authors: Kotori, <oubattler@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
@@ -62,16 +62,15 @@ extern void network_close(void);
|
||||
extern void network_reset(void);
|
||||
extern void network_tx(uint8_t *, int);
|
||||
|
||||
extern int network_pcap_init(netdev_t *);
|
||||
extern int network_pcap_setup(uint8_t *, NETRXCB, void *);
|
||||
extern void network_pcap_close(void);
|
||||
extern void network_pcap_in(uint8_t *, int);
|
||||
extern int network_devlist(netdev_t *);
|
||||
|
||||
extern int network_slirp_setup(uint8_t *, NETRXCB, void *);
|
||||
extern void network_slirp_close(void);
|
||||
extern void network_slirp_in(uint8_t *, int);
|
||||
|
||||
extern int network_devlist(netdev_t *);
|
||||
extern int network_dev_to_id(char *);
|
||||
extern int network_card_available(int);
|
||||
extern char *network_card_getname(int);
|
||||
|
||||
12
src/pc.c
12
src/pc.c
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user