Fixed a number of bugs in the NCR 53C810 code;

64-bit Windows 86Box now compiles without warnings.
This commit is contained in:
OBattler
2017-12-13 22:39:41 +01:00
parent b297311ba3
commit 044559f4e9
23 changed files with 312 additions and 155 deletions

View File

@@ -8,7 +8,7 @@
#
# Makefile for Win32 (MinGW32) environment.
#
# Version: @(#)Makefile.mingw 1.0.83 2017/12/06
# Version: @(#)Makefile.mingw 1.0.84 2017/12/13
#
# Authors: Miran Grca, <mgrca8@gmail.com>
# Fred N. van Kempen, <decwiz@yahoo.com>
@@ -30,6 +30,7 @@ AUTODEP := n
endif
ifndef CRASHDUMP
CRASHDUMP := n
CRASHDUMPOBJ := win_crashdump.o
endif
ifndef DEBUG
DEBUG := n
@@ -445,7 +446,7 @@ VIDOBJ := video.o \
vid_voodoo.o
PLATOBJ := win.o \
win_crashdump.o win_dynld.o win_thread.o $(WSERIAL) \
$(CRASHDUMPOBJ) win_dynld.o win_thread.o $(WSERIAL) \
win_cdrom.o win_cdrom_ioctl.o win_keyboard.o \
win_mouse.o win_joystick.o win_midi.o
@@ -474,7 +475,9 @@ LIBS += $(WX_LIBS) -lz -lm
endif
LIBS += -lkernel32 -lwsock32 -liphlpapi -lpsapi
LIBS += -lpthread -static -lstdc++ -lgcc
ifneq ($(X64), y)
LIBS += -Wl,--large-address-aware
endif
# Build module rules.

View File

@@ -8,7 +8,7 @@
*
* Platform main support module for Windows.
*
* Version: @(#)win.c 1.0.40 2017/12/04
* Version: @(#)win.c 1.0.41 2017/12/13
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -241,13 +241,13 @@ CreateConsole(int init)
}
h = GetStdHandle(STD_OUTPUT_HANDLE);
i = _open_osfhandle((long)h, _O_TEXT);
i = _open_osfhandle((intptr_t)h, _O_TEXT);
fp = _fdopen(i, "w");
setvbuf(fp, NULL, _IONBF, 1);
*stdout = *fp;
h = GetStdHandle(STD_ERROR_HANDLE);
i = _open_osfhandle((long)h, _O_TEXT);
i = _open_osfhandle((intptr_t)h, _O_TEXT);
fp = _fdopen(i, "w");
setvbuf(fp, NULL, _IONBF, 1);
*stderr = *fp;
@@ -255,7 +255,7 @@ CreateConsole(int init)
#if 0
/* Set up stdin as well. */
h = GetStdHandle(STD_INPUT_HANDLE);
i = _open_osfhandle((long)h, _O_TEXT);
i = _open_osfhandle((intptr_t)h, _O_TEXT);
fp = _fdopen(i, "r");
setvbuf(fp, NULL, _IONBF, 128);
*stdin = *fp;

View File

@@ -8,7 +8,7 @@
*
* Platform support defintions for Win32.
*
* Version: @(#)win.h 1.0.11 2017/11/24
* Version: @(#)win.h 1.0.12 2017/12/13
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -85,7 +85,7 @@ extern void keyboard_handle(LPARAM lParam, int infocus);
extern void win_mouse_init(void);
extern void win_mouse_close(void);
extern int fdd_type_to_icon(int type);
extern intptr_t fdd_type_to_icon(int type);
#ifdef EMU_DEVICE_H
extern uint8_t deviceconfig_open(HWND hwnd, device_t *device);
@@ -116,7 +116,7 @@ extern void StatusWindowCreate(HWND hwnd);
/* Functions in win_stbar.c: */
extern HWND hwndSBAR;
extern void StatusBarCreate(HWND hwndParent, int idStatus, HINSTANCE hInst);
extern void StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst);
/* Functions in win_dialog.c: */

View File

@@ -8,7 +8,7 @@
*
* Handle the About dialog.
*
* Version: @(#)win_about.c 1.0.4 2017/10/16
* Version: @(#)win_about.c 1.0.5 2017/12/13
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -33,7 +33,11 @@
#include "win.h"
#ifdef __amd64__
static LRESULT CALLBACK
#else
static BOOL CALLBACK
#endif
AboutDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND h;

View File

@@ -8,7 +8,7 @@
*
* Handle generation of crash-dump reports.
*
* Version: @(#)win_crashdump.c 1.0.2 2017/11/12
* Version: @(#)win_crashdump.c 1.0.3 2017/12/13
*
* Authors: Riley
* Miran Grca, <mgrca8@gmail.com>
@@ -194,9 +194,9 @@ LONG CALLBACK MakeCrashDump(PEXCEPTION_POINTERS ExceptionInfo)
}
BufPtr = &ExceptionHandlerBuffer[strlen(ExceptionHandlerBuffer) - 1];
#if defined(__i386__) && !defined(__x86_64)
PCONTEXT Registers = ExceptionInfo->ContextRecord;
#if defined(__i386__) && !defined(__x86_64)
/* This binary is being compiled for x86, include a register dump. */
sprintf(BufPtr,
"\r\n\r\nRegister dump:\r\n\r\n"

View File

@@ -8,7 +8,7 @@
*
* Rendering module for Microsoft Direct3D 9.
*
* Version: @(#)win_d3d.cpp 1.0.6 2017/11/25
* Version: @(#)win_d3d.cpp 1.0.7 2017/12/13
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -360,8 +360,6 @@ d3d_init_objects(void)
int
d3d_init(HWND h)
{
int c;
d3d_hwnd = h;
cgapal_rebuild();
@@ -401,7 +399,6 @@ int
d3d_init_fs(HWND h)
{
WCHAR title[200];
int c;
cgapal_rebuild();

View File

@@ -8,7 +8,7 @@
*
* Windows device configuration dialog implementation.
*
* Version: @(#)win_devconf.c 1.0.10 2017/11/25
* Version: @(#)win_devconf.c 1.0.11 2017/12/13
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -35,7 +35,11 @@ static device_t *config_device;
static uint8_t deviceconfig_changed = 0;
#ifdef __amd64__
static LRESULT CALLBACK
#else
static BOOL CALLBACK
#endif
deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND h;
@@ -480,7 +484,7 @@ uint8_t deviceconfig_open(HWND hwnd, device_t *device)
*data++ = 9; /*Point*/
data += MultiByteToWideChar(CP_ACP, 0, "Segoe UI", -1, data, 50);
if (((unsigned long)data) & 2)
if (((uintptr_t)data) & 2)
data++;
while (config->type != -1)
@@ -530,7 +534,7 @@ uint8_t deviceconfig_open(HWND hwnd, device_t *device)
data += MultiByteToWideChar(CP_ACP, 0, config->description, -1, data, 256);
*data++ = 0; /* no creation data */
if (((unsigned long)data) & 2)
if (((uintptr_t)data) & 2)
data++;
/*Static text*/
@@ -551,7 +555,7 @@ uint8_t deviceconfig_open(HWND hwnd, device_t *device)
data += MultiByteToWideChar(CP_ACP, 0, config->description, -1, data, 256);
*data++ = 0; /* no creation data */
if (((unsigned long)data) & 2)
if (((uintptr_t)data) & 2)
data++;
y += 20;
@@ -674,7 +678,7 @@ uint8_t deviceconfig_open(HWND hwnd, device_t *device)
break;
}
if (((unsigned long)data) & 2)
if (((uintptr_t)data) & 2)
data++;
config++;
@@ -697,7 +701,7 @@ uint8_t deviceconfig_open(HWND hwnd, device_t *device)
data += MultiByteToWideChar(CP_ACP, 0, "OK", -1, data, 50);
*data++ = 0; /* no creation data */
if (((unsigned long)data) & 2)
if (((uintptr_t)data) & 2)
data++;
item = (DLGITEMTEMPLATE *)data;

View File

@@ -8,7 +8,7 @@
*
* Several dialogs for the application.
*
* Version: @(#)win_dialog.c 1.0.5 2017/11/18
* Version: @(#)win_dialog.c 1.0.6 2017/12/13
*
* Author: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
@@ -128,14 +128,8 @@ ui_msgbox(int flags, void *arg)
* higher than the numeric ID's. So, we guesswork
* that if the value of 'arg' is low, its an ID..
*/
#if defined(__gcc__) && defined(__x86_64__)
/* GCC, 64-bit mode. */
if (((int64_t)arg) < ((int64_t)65636))
#else
/* Assume 32-bit mode. */
if (((uint32_t)arg) < ((uint32_t)65636))
#endif
str = plat_get_string((int)arg);
if (((uintptr_t)arg) < ((uintptr_t)65636))
str = plat_get_string((intptr_t)arg);
}
/* At any rate, we do have a valid (wide) string now. */

View File

@@ -152,7 +152,12 @@ static int get_pov(HWND hdlg, int id)
return axis_sel - nr_povs;
}
static BOOL CALLBACK joystickconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
#ifdef __amd64__
static LRESULT CALLBACK
#else
static BOOL CALLBACK
#endif
joystickconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND h;
int c;
@@ -305,7 +310,7 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type)
*data++ = 8; /*Point*/
data += MultiByteToWideChar(CP_ACP, 0, "MS Sans Serif", -1, data, 50);
if (((unsigned long)data) & 2)
if (((uintptr_t)data) & 2)
data++;
@@ -327,7 +332,7 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type)
data += MultiByteToWideChar(CP_ACP, 0, "Device", -1, data, 256);
*data++ = 0; /* no creation data */
if (((unsigned long)data) & 2)
if (((uintptr_t)data) & 2)
data++;
/*Static text*/
@@ -348,7 +353,7 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type)
data += MultiByteToWideChar(CP_ACP, 0, "Device :", -1, data, 256);
*data++ = 0; /* no creation data */
if (((unsigned long)data) & 2)
if (((uintptr_t)data) & 2)
data++;
y += 20;
@@ -374,7 +379,7 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type)
data += MultiByteToWideChar(CP_ACP, 0, joystick_get_axis_name(type, c), -1, data, 256);
*data++ = 0; /* no creation data */
if (((unsigned long)data) & 2)
if (((uintptr_t)data) & 2)
data++;
/*Static text*/
@@ -395,7 +400,7 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type)
data += MultiByteToWideChar(CP_ACP, 0, joystick_get_axis_name(type, c), -1, data, 256);
*data++ = 0; /* no creation data */
if (((unsigned long)data) & 2)
if (((uintptr_t)data) & 2)
data++;
y += 20;
@@ -421,7 +426,7 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type)
data += MultiByteToWideChar(CP_ACP, 0, joystick_get_button_name(type, c), -1, data, 256);
*data++ = 0; /* no creation data */
if (((unsigned long)data) & 2)
if (((uintptr_t)data) & 2)
data++;
/*Static text*/
@@ -442,7 +447,7 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type)
data += MultiByteToWideChar(CP_ACP, 0, joystick_get_button_name(type, c), -1, data, 256);
*data++ = 0; /* no creation data */
if (((unsigned long)data) & 2)
if (((uintptr_t)data) & 2)
data++;
y += 20;
@@ -474,7 +479,7 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type)
data += MultiByteToWideChar(CP_ACP, 0, s, -1, data, 256);
*data++ = 0; /* no creation data */
if (((unsigned long)data) & 2)
if (((uintptr_t)data) & 2)
data++;
/*Static text*/
@@ -495,7 +500,7 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type)
data += MultiByteToWideChar(CP_ACP, 0, s, -1, data, 256);
*data++ = 0; /* no creation data */
if (((unsigned long)data) & 2)
if (((uintptr_t)data) & 2)
data++;
y += 20;
@@ -518,7 +523,7 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type)
data += MultiByteToWideChar(CP_ACP, 0, "OK", -1, data, 50);
*data++ = 0; /* no creation data */
if (((unsigned long)data) & 2)
if (((uintptr_t)data) & 2)
data++;
item = (DLGITEMTEMPLATE *)data;

View File

@@ -49,12 +49,12 @@ void plat_midi_init()
m_event = CreateEvent(NULL, TRUE, TRUE, NULL);
hr = midiOutOpen(&midi_out_device, midi_id, (DWORD) m_event,
hr = midiOutOpen(&midi_out_device, midi_id, (uintptr_t) m_event,
0, CALLBACK_EVENT);
if (hr != MMSYSERR_NOERROR) {
printf("midiOutOpen error - %08X\n",hr);
midi_id = 0;
hr = midiOutOpen(&midi_out_device, midi_id, (DWORD) m_event,
hr = midiOutOpen(&midi_out_device, midi_id, (uintptr_t) m_event,
0, CALLBACK_EVENT);
if (hr != MMSYSERR_NOERROR) {
printf("midiOutOpen error - %08X\n",hr);

View File

@@ -8,7 +8,7 @@
*
* Windows 86Box Settings dialog handler.
*
* Version: @(#)win_settings.c 1.0.26 2017/12/09
* Version: @(#)win_settings.c 1.0.27 2017/12/13
*
* Author: Miran Grca, <mgrca8@gmail.com>
*
@@ -578,7 +578,12 @@ static void win_settings_machine_recalc_machine(HWND hdlg)
}
static BOOL CALLBACK win_settings_machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
#ifdef __amd64__
static LRESULT CALLBACK
#else
static BOOL CALLBACK
#endif
win_settings_machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND h;
int c = 0;
@@ -785,7 +790,12 @@ static void recalc_vid_list(HWND hdlg)
}
static BOOL CALLBACK win_settings_video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
#ifdef __amd64__
static LRESULT CALLBACK
#else
static BOOL CALLBACK
#endif
win_settings_video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND h;
LPTSTR lptsTemp;
@@ -923,7 +933,12 @@ static int mouse_valid(int num, int m)
}
static BOOL CALLBACK win_settings_input_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
#ifdef __amd64__
static LRESULT CALLBACK
#else
static BOOL CALLBACK
#endif
win_settings_input_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
wchar_t str[128];
HWND h;
@@ -1081,7 +1096,12 @@ int mpu401_standalone_allow(void)
return 1;
}
static BOOL CALLBACK win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
#ifdef __amd64__
static LRESULT CALLBACK
#else
static BOOL CALLBACK
#endif
win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND h;
int c = 0;
@@ -1321,7 +1341,12 @@ static BOOL CALLBACK win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wPa
}
static BOOL CALLBACK win_settings_ports_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
#ifdef __amd64__
static LRESULT CALLBACK
#else
static BOOL CALLBACK
#endif
win_settings_ports_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND h;
int c = 0;
@@ -1496,7 +1521,12 @@ int find_irq_in_array(int irq, int def)
}
static BOOL CALLBACK win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
#ifdef __amd64__
static LRESULT CALLBACK
#else
static BOOL CALLBACK
#endif
win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND h;
int c = 0;
@@ -1726,7 +1756,12 @@ static void network_recalc_combos(HWND hdlg)
net_ignore_message = 0;
}
static BOOL CALLBACK win_settings_network_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
#ifdef __amd64__
static LRESULT CALLBACK
#else
static BOOL CALLBACK
#endif
win_settings_network_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND h;
int c = 0;
@@ -2556,7 +2591,12 @@ static void recalc_selection(HWND hdlg)
static int chs_enabled = 0;
static BOOL CALLBACK win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
#ifdef __amd64__
static LRESULT CALLBACK
#else
static BOOL CALLBACK
#endif
win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND h;
int64_t i = 0;
@@ -3285,7 +3325,12 @@ void hard_disk_add_open(HWND hwnd, int is_existing)
int ignore_change = 0;
static BOOL CALLBACK win_settings_hard_disks_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
#ifdef __amd64__
static LRESULT CALLBACK
#else
static BOOL CALLBACK
#endif
win_settings_hard_disks_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND h;
int old_sel = 0;
@@ -3951,7 +3996,12 @@ static void cdrom_recalc_location_controls(HWND hdlg)
int rd_ignore_change = 0;
static BOOL CALLBACK win_settings_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
#ifdef __amd64__
static LRESULT CALLBACK
#else
static BOOL CALLBACK
#endif
win_settings_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND h;
int i = 0;
@@ -4307,7 +4357,7 @@ static BOOL win_settings_main_image_list_init(HWND hwndList)
for (i = 0; i < 9; i++)
{
hiconItem = LoadIcon(hinstance, (LPCWSTR) (256 + i));
hiconItem = LoadIcon(hinstance, (LPCWSTR) (256 + (uintptr_t) i));
ImageList_AddIcon(hSmall, hiconItem);
DestroyIcon(hiconItem);
}
@@ -4338,7 +4388,12 @@ static BOOL win_settings_main_insert_categories(HWND hwndList)
return TRUE;
}
static BOOL CALLBACK win_settings_main_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
#ifdef __amd64__
static LRESULT CALLBACK
#else
static BOOL CALLBACK
#endif
win_settings_main_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND h;
int category;

View File

@@ -31,7 +31,11 @@ extern uint64_t main_time;
static uint64_t status_time;
#ifdef __amd64__
static LRESULT CALLBACK
#else
static BOOL CALLBACK
#endif
StatusWindowProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
char temp[4096];

View File

@@ -8,7 +8,7 @@
*
* Implement the application's Status Bar.
*
* Version: @(#)win_stbar.c 1.0.6 2017/11/04
* Version: @(#)win_stbar.c 1.0.7 2017/12/13
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
@@ -49,6 +49,10 @@
#include "../ui.h"
#include "win.h"
#ifndef GWL_WNDPROC
#define GWL_WNDPROC GWLP_WNDPROC
#endif
HWND hwndSBAR;
@@ -66,7 +70,7 @@ static int sb_ready = 0;
/* Also used by win_settings.c */
int
intptr_t
fdd_type_to_icon(int type)
{
int ret = 512;
@@ -789,7 +793,11 @@ StatusBarPopupMenu(HWND hwnd, POINT pt, int id)
/* Handle messages for the Status Bar window. */
#ifdef __amd64__
static LRESULT CALLBACK
#else
static BOOL CALLBACK
#endif
StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
WCHAR temp_path[1024];
@@ -1004,10 +1012,11 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
/* API: Create and set up the Status Bar window. */
void
StatusBarCreate(HWND hwndParent, int idStatus, HINSTANCE hInst)
StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst)
{
RECT rectDialog;
int dw, dh, i;
int dw, dh;
uintptr_t i;
/* Load our icons into the cache for faster access. */
for (i = 128; i < 130; i++)