Even more cleanups. Also renamed hdd/ to disk/ as that makes more sense. Machines with an Internal HDC (usually IDE) can now also select an alternative one instead.
This commit is contained in:
@@ -96,11 +96,11 @@ endif
|
||||
# Nothing should need changing from here on.. #
|
||||
#########################################################################
|
||||
VPATH := $(EXPATH) . cpu \
|
||||
cdrom floppy game hdd machine \
|
||||
cdrom disk floppy game machine \
|
||||
sound \
|
||||
sound/munt sound/munt/c_interface sound/munt/sha1 \
|
||||
sound/munt/srchelper \
|
||||
sound/resid-fp \
|
||||
sound/munt sound/munt/c_interface sound/munt/sha1 \
|
||||
sound/munt/srchelper \
|
||||
sound/resid-fp \
|
||||
scsi video lzf network network/slirp win
|
||||
PLAT := win/
|
||||
ifeq ($(X64), y)
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* Implementation of the CD-ROM drive with SCSI(-like)
|
||||
* commands, for both ATAPI and SCSI usage.
|
||||
*
|
||||
* Version: @(#)cdrom.c 1.0.8 2017/09/30
|
||||
* Version: @(#)cdrom.c 1.0.8 2017/10/01
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
@@ -27,8 +27,8 @@
|
||||
#include "../piix.h"
|
||||
#include "../scsi/scsi.h"
|
||||
#include "../nvr.h"
|
||||
#include "../hdd/hdc.h"
|
||||
#include "../hdd/hdc_ide.h"
|
||||
#include "../disk/hdc.h"
|
||||
#include "../disk/hdc_ide.h"
|
||||
#include "../win/plat_iodev.h"
|
||||
#include "cdrom.h"
|
||||
|
||||
|
||||
@@ -34,14 +34,14 @@
|
||||
#include "device.h"
|
||||
#include "lpt.h"
|
||||
#include "nvr.h"
|
||||
#include "game/gameport.h"
|
||||
#include "cdrom/cdrom.h"
|
||||
#include "disk/hdd.h"
|
||||
#include "disk/hdc.h"
|
||||
#include "disk/hdc_ide.h"
|
||||
#include "floppy/floppy.h"
|
||||
#include "floppy/fdc.h"
|
||||
#include "floppy/fdd.h"
|
||||
#include "hdd/hdd.h"
|
||||
#include "hdd/hdc.h"
|
||||
#include "hdd/hdc_ide.h"
|
||||
#include "game/gameport.h"
|
||||
#include "machine/machine.h"
|
||||
#include "mouse.h"
|
||||
#include "network/network.h"
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* Implementation of the generic device interface to handle
|
||||
* all devices attached to the emulator.
|
||||
*
|
||||
* Version: @(#)device.c 1.0.4 2017/09/24
|
||||
* Version: @(#)device.c 1.0.4 2017/10/01
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -49,7 +49,6 @@ void device_add(device_t *d)
|
||||
|
||||
while (devices[c] != NULL && c < 256)
|
||||
c++;
|
||||
|
||||
if (c >= DEVICE_MAX)
|
||||
fatal("device_add : too many devices\n");
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Common code to handle all sorts of disk controllers.
|
||||
*
|
||||
* Version: @(#)hdc.c 1.0.2 2017/09/30
|
||||
* Version: @(#)hdc.c 1.0.2 2017/10/01
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
@@ -26,8 +26,8 @@
|
||||
#include "hdc.h"
|
||||
|
||||
|
||||
char hdc_name[16];
|
||||
int hdc_current;
|
||||
char hdc_name[16]; /* configured HDC name */
|
||||
int hdc_current;
|
||||
|
||||
|
||||
static void *
|
||||
@@ -121,6 +121,36 @@ static struct {
|
||||
};
|
||||
|
||||
|
||||
/* Initialize the 'hdc_current' value based on configured HDC name. */
|
||||
void
|
||||
hdc_init(char *name)
|
||||
{
|
||||
int c;
|
||||
|
||||
pclog("HDC: initializing..\n");
|
||||
|
||||
for (c=0; controllers[c].device; c++) {
|
||||
if (! strcmp(name, controllers[c].internal_name)) {
|
||||
hdc_current = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Reset the HDC, whichever one that is. */
|
||||
void
|
||||
hdc_reset(void)
|
||||
{
|
||||
pclog("HDC: reset(current=%d, internal=%d)\n",
|
||||
hdc_current, (machines[machine].flags & MACHINE_HAS_HDC)?1:0);
|
||||
|
||||
/* If we have a valid controller, add its device. */
|
||||
if (hdc_current > 1)
|
||||
device_add(controllers[hdc_current].device);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
hdc_get_name(int hdc)
|
||||
{
|
||||
@@ -154,34 +184,3 @@ hdc_current_is_mfm(void)
|
||||
{
|
||||
return(controllers[hdc_current].is_mfm);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
hdc_init(void)
|
||||
{
|
||||
pclog("HDC: initializing..\n");
|
||||
|
||||
hdc_current = 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
hdc_reset(char *name)
|
||||
{
|
||||
int c;
|
||||
|
||||
pclog("HDC: reset(name='%s', internal=%d)\n", name,
|
||||
(machines[machine].flags & MACHINE_HAS_HDC)?1:0);
|
||||
|
||||
for (c=0; controllers[c].device; c++) {
|
||||
if (! strcmp(name, controllers[c].internal_name)) {
|
||||
hdc_current = c;
|
||||
|
||||
if (strcmp(name, "none") && strcmp(name, "internal")) {
|
||||
device_add(controllers[c].device);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Definitions for the common disk controller handler.
|
||||
*
|
||||
* Version: @(#)hdc.h 1.0.3 2017/09/30
|
||||
* Version: @(#)hdc.h 1.0.3 2017/10/01
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
@@ -44,8 +44,8 @@ extern device_t xtide_ps2_device; /* xtide_ps2 */
|
||||
extern device_t xtide_at_ps2_device; /* xtide_at_ps2 */
|
||||
|
||||
|
||||
extern void hdc_init(void);
|
||||
extern void hdc_reset(char *name);
|
||||
extern void hdc_init(char *name);
|
||||
extern void hdc_reset(void);
|
||||
|
||||
extern char *hdc_get_name(int hdc);
|
||||
extern char *hdc_get_internal_name(int hdc);
|
||||
@@ -632,7 +632,7 @@ void ide_reset(void)
|
||||
idecallback[2]=idecallback[3]=0;
|
||||
idecallback[4]=0;
|
||||
|
||||
pclog("IDE: start loading disks...\n");
|
||||
pclog("IDE: loading disks...\n");
|
||||
c = 0;
|
||||
for (d = 0; d < HDD_NUM; d++)
|
||||
{
|
||||
@@ -649,7 +649,7 @@ void ide_reset(void)
|
||||
if (++c >= (IDE_NUM+XTIDE_NUM)) break;
|
||||
}
|
||||
}
|
||||
pclog("IDE: done loading, %d disks.\n", c);
|
||||
pclog("IDE: done, loaded %d disks.\n", c);
|
||||
|
||||
for (d = 0; d < IDE_NUM; d++)
|
||||
{
|
||||
@@ -2309,8 +2309,6 @@ void ide_init_first(void)
|
||||
{
|
||||
int d;
|
||||
|
||||
pclog("IDE: initializing...\n");
|
||||
|
||||
memset(ide_drives, 0x00, sizeof(ide_drives));
|
||||
for (d = 0; d < (IDE_NUM+XTIDE_NUM); d++)
|
||||
{
|
||||
@@ -21,7 +21,7 @@
|
||||
* already on their way out, the newer IDE standard based on the
|
||||
* PC/AT controller and 16b design became the IDE we now know.
|
||||
*
|
||||
* Version: @(#)xtide.c 1.0.5 2017/09/29
|
||||
* Version: @(#)xtide.c 1.0.6 2017/10/10
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -44,10 +44,10 @@
|
||||
#include "hdc_ide.h"
|
||||
|
||||
|
||||
#define XT_ROM_PATH L"roms/hdd/xtide/ide_xt.bin"
|
||||
#define AT_ROM_PATH L"roms/hdd/xtide/ide_at.bin"
|
||||
#define PS2_ROM_PATH L"roms/hdd/xtide/SIDE1V12.BIN"
|
||||
#define PS2AT_ROM_PATH L"roms/hdd/xtide/ide_at_1_1_5.bin"
|
||||
#define ROM_PATH_XT L"roms/hdd/xtide/ide_xt.bin"
|
||||
#define ROM_PATH_AT L"roms/hdd/xtide/ide_at.bin"
|
||||
#define ROM_PATH_PS2 L"roms/hdd/xtide/SIDE1V12.BIN"
|
||||
#define ROM_PATH_PS2AT L"roms/hdd/xtide/ide_at_1_1_5.bin"
|
||||
|
||||
|
||||
typedef struct {
|
||||
@@ -91,13 +91,13 @@ static uint8_t
|
||||
xtide_read(uint16_t port, void *priv)
|
||||
{
|
||||
xtide_t *xtide = (xtide_t *)priv;
|
||||
uint16_t tempw;
|
||||
uint16_t tempw = 0xffff;
|
||||
|
||||
switch (port & 0xf) {
|
||||
case 0x0:
|
||||
tempw = readidew(4);
|
||||
xtide->data_high = tempw >> 8;
|
||||
return(tempw & 0xff);
|
||||
break;
|
||||
|
||||
case 0x1:
|
||||
case 0x2:
|
||||
@@ -106,17 +106,22 @@ xtide_read(uint16_t port, void *priv)
|
||||
case 0x5:
|
||||
case 0x6:
|
||||
case 0x7:
|
||||
return(readide(4, (port & 0xf) | 0x1f0));
|
||||
tempw = readide(4, (port & 0xf) | 0x1f0);
|
||||
break;
|
||||
|
||||
case 0x8:
|
||||
return(xtide->data_high);
|
||||
tempw = xtide->data_high;
|
||||
break;
|
||||
|
||||
case 0xe:
|
||||
return(readide(4, 0x3f6));
|
||||
tempw = readide(4, 0x3f6);
|
||||
break;
|
||||
|
||||
default:
|
||||
return(0xff);
|
||||
break;
|
||||
}
|
||||
|
||||
return(tempw & 0xff);
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +132,7 @@ xtide_init(void)
|
||||
|
||||
memset(xtide, 0x00, sizeof(xtide_t));
|
||||
|
||||
rom_init(&xtide->bios_rom, XT_ROM_PATH,
|
||||
rom_init(&xtide->bios_rom, ROM_PATH_XT,
|
||||
0xc8000, 0x4000, 0x3fff, 0, MEM_MAPPING_EXTERNAL);
|
||||
|
||||
ide_xtide_init();
|
||||
@@ -135,7 +140,7 @@ xtide_init(void)
|
||||
io_sethandler(0x0300, 16,
|
||||
xtide_read, NULL, NULL,
|
||||
xtide_write, NULL, NULL, xtide);
|
||||
|
||||
|
||||
return(xtide);
|
||||
}
|
||||
|
||||
@@ -143,7 +148,7 @@ xtide_init(void)
|
||||
static int
|
||||
xtide_available(void)
|
||||
{
|
||||
return(rom_present(XT_ROM_PATH));
|
||||
return(rom_present(ROM_PATH_XT));
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +159,7 @@ xtide_at_init(void)
|
||||
|
||||
memset(xtide, 0x00, sizeof(xtide_t));
|
||||
|
||||
rom_init(&xtide->bios_rom, AT_ROM_PATH,
|
||||
rom_init(&xtide->bios_rom, ROM_PATH_AT,
|
||||
0xc8000, 0x4000, 0x3fff, 0, MEM_MAPPING_EXTERNAL);
|
||||
|
||||
ide_init();
|
||||
@@ -166,7 +171,7 @@ xtide_at_init(void)
|
||||
static int
|
||||
xtide_at_available(void)
|
||||
{
|
||||
return(rom_present(AT_ROM_PATH));
|
||||
return(rom_present(ROM_PATH_AT));
|
||||
}
|
||||
|
||||
|
||||
@@ -177,7 +182,7 @@ xtide_ps2_init(void)
|
||||
|
||||
memset(xtide, 0x00, sizeof(xtide_t));
|
||||
|
||||
rom_init(&xtide->bios_rom, PS2_ROM_PATH,
|
||||
rom_init(&xtide->bios_rom, ROM_PATH_PS2,
|
||||
0xc8000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL);
|
||||
|
||||
ide_xtide_init();
|
||||
@@ -193,7 +198,7 @@ xtide_ps2_init(void)
|
||||
static int
|
||||
xtide_ps2_available(void)
|
||||
{
|
||||
return(rom_present(PS2_ROM_PATH));
|
||||
return(rom_present(ROM_PATH_PS2));
|
||||
}
|
||||
|
||||
|
||||
@@ -204,7 +209,7 @@ xtide_at_ps2_init(void)
|
||||
|
||||
memset(xtide, 0x00, sizeof(xtide_t));
|
||||
|
||||
rom_init(&xtide->bios_rom, PS2AT_ROM_PATH,
|
||||
rom_init(&xtide->bios_rom, ROM_PATH_PS2AT,
|
||||
0xc8000, 0x4000, 0x3fff, 0, MEM_MAPPING_EXTERNAL);
|
||||
|
||||
ide_init();
|
||||
@@ -216,7 +221,7 @@ xtide_at_ps2_init(void)
|
||||
static int
|
||||
xtide_at_ps2_available(void)
|
||||
{
|
||||
return(rom_present(PS2AT_ROM_PATH));
|
||||
return(rom_present(ROM_PATH_PS2AT));
|
||||
}
|
||||
|
||||
|
||||
36
src/ibm.h
36
src/ibm.h
@@ -10,7 +10,7 @@
|
||||
*
|
||||
* !!!NOTE!!! The goal is to GET RID of this file. Do NOT add stuff !!
|
||||
*
|
||||
* Version: @(#)ibm.h 1.0.6 2017/09/29
|
||||
* Version: @(#)ibm.h 1.0.7 2017/10/01
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -526,10 +526,6 @@ extern uint64_t timer_freq;
|
||||
|
||||
extern int infocus;
|
||||
|
||||
extern void onesec(void);
|
||||
|
||||
extern void resetpc_cad(void);
|
||||
extern void ctrl_alt_esc(void);
|
||||
|
||||
extern int dump_on_exit;
|
||||
extern int start_in_fullscreen;
|
||||
@@ -589,8 +585,24 @@ extern int scale;
|
||||
|
||||
|
||||
/* Function prototypes. */
|
||||
extern void pclog(const char *format, ...);
|
||||
extern void pclog_w(const wchar_t *format, ...);
|
||||
extern void fatal(const char *format, ...);
|
||||
extern void pc_init_modules(void);
|
||||
extern void pc_init(int argc, wchar_t *argv[]);
|
||||
extern void pc_close(void);
|
||||
extern void resetpchard_close(void);
|
||||
extern void resetpchard_init(void);
|
||||
extern void pc_reset_hard(void);
|
||||
extern void pc_full_speed(void);
|
||||
extern void pc_speed_changed(void);
|
||||
extern void pc_send_cad(void);
|
||||
extern void pc_send_cae(void);
|
||||
extern void pc_run(void);
|
||||
extern void onesec(void);
|
||||
|
||||
|
||||
extern int checkio(int port);
|
||||
extern void closepc(void);
|
||||
extern void codegen_block_end(void);
|
||||
extern void codegen_reset(void);
|
||||
extern void cpu_set_edx(void);
|
||||
@@ -602,12 +614,9 @@ extern void execx86(int cycs);
|
||||
extern void flushmmucache(void);
|
||||
extern void flushmmucache_cr3(void);
|
||||
extern int idivl(int32_t val);
|
||||
extern void initmodules(void);
|
||||
extern void initpc(int argc, wchar_t *argv[]);
|
||||
extern void loadcscall(uint16_t seg);
|
||||
extern void loadcsjmp(uint16_t seg, uint32_t oxpc);
|
||||
extern void mmu_invalidate(uint32_t addr);
|
||||
extern void pclog(const char *format, ...);
|
||||
extern void pmodeint(int num, int soft);
|
||||
extern void pmoderetf(int is32, uint16_t off);
|
||||
extern void pmodeiret(int is32);
|
||||
@@ -615,14 +624,9 @@ extern void port_92_clear_reset(void);
|
||||
extern uint8_t readdacfifo(void);
|
||||
extern void refreshread(void);
|
||||
extern void resetmcr(void);
|
||||
extern void resetpchard_close(void);
|
||||
extern void resetpchard_init(void);
|
||||
extern void resetpchard(void);
|
||||
extern void resetreadlookup(void);
|
||||
extern void resetx86(void);
|
||||
extern void runpc(void);
|
||||
extern void softresetx86(void);
|
||||
extern void speedchanged(void);
|
||||
extern void x86_int_sw(int num);
|
||||
extern int x86_int_sw_rm(int num);
|
||||
extern void x86gpf(char *s, uint16_t error);
|
||||
@@ -633,10 +637,6 @@ extern void x87_dumpregs(void);
|
||||
extern void x87_reset(void);
|
||||
|
||||
/* Platform functions. */
|
||||
extern void pclog(const char *format, ...);
|
||||
extern void pclog_w(const wchar_t *format, ...);
|
||||
extern void fatal(const char *format, ...);
|
||||
|
||||
extern void update_status_bar_icon(int tag, int active);
|
||||
extern void update_status_bar_icon_state(int tag, int state);
|
||||
extern void status_settextw(wchar_t *wstr);
|
||||
|
||||
2
src/io.c
2
src/io.c
@@ -120,11 +120,13 @@ void io_removehandler(uint16_t base, int size,
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
uint8_t cgamode,cgastat=0,cgacol;
|
||||
int hsync;
|
||||
uint8_t lpt2dat;
|
||||
int sw9;
|
||||
int t237=0;
|
||||
#endif
|
||||
uint8_t inb(uint16_t port)
|
||||
{
|
||||
uint8_t temp = 0xff;
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
#include "../game/gameport.h"
|
||||
#include "../keyboard_at.h"
|
||||
#include "../lpt.h"
|
||||
#include "../hdd/hdc.h"
|
||||
#include "../hdd/hdc_ide.h"
|
||||
#include "../disk/hdc.h"
|
||||
#include "../disk/hdc_ide.h"
|
||||
#include "machine_common.h"
|
||||
#include "machine_at.h"
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
#include "../io.h"
|
||||
#include "../mem.h"
|
||||
#include "../device.h"
|
||||
#include "../hdd/hdc.h"
|
||||
#include "../hdd/hdc_ide.h"
|
||||
#include "../disk/hdc.h"
|
||||
#include "../disk/hdc_ide.h"
|
||||
#include "machine_at.h"
|
||||
#include "machine_at_ali1429.h"
|
||||
|
||||
|
||||
@@ -24,11 +24,11 @@
|
||||
#include "../device.h"
|
||||
#include "../lpt.h"
|
||||
#include "../serial.h"
|
||||
#include "../disk/hdc.h"
|
||||
#include "../disk/hdc_ide.h"
|
||||
#include "../floppy/floppy.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../hdd/hdc.h"
|
||||
#include "../hdd/hdc_ide.h"
|
||||
#include "machine_at.h"
|
||||
#include "machine_at_sis_85c471.h"
|
||||
|
||||
|
||||
@@ -19,11 +19,11 @@
|
||||
#include "../lpt.h"
|
||||
#include "../serial.h"
|
||||
#include "../keyboard_at.h"
|
||||
#include "../disk/hdc.h"
|
||||
#include "../disk/hdc_ide.h"
|
||||
#include "../floppy/floppy.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../floppy/fdc.h"
|
||||
#include "../hdd/hdc.h"
|
||||
#include "../hdd/hdc_ide.h"
|
||||
#include "../sound/snd_ps1.h"
|
||||
#include "machine_common.h"
|
||||
#include "machine_ps1.h"
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
#include "device.h"
|
||||
#include "pci.h"
|
||||
#include "keyboard_at.h"
|
||||
#include "cdrom/cdrom.h"
|
||||
#include "disk/hdc.h"
|
||||
#include "disk/hdc_ide.h"
|
||||
#include "floppy/floppy.h"
|
||||
#include "floppy/fdc.h"
|
||||
#include "hdd/hdc.h"
|
||||
#include "hdd/hdc_ide.h"
|
||||
#include "cdrom/cdrom.h"
|
||||
|
||||
|
||||
static uint64_t pci_irq_hold[16];
|
||||
|
||||
17
src/piix.c
17
src/piix.c
@@ -12,7 +12,7 @@
|
||||
* word 0 - base address
|
||||
* word 1 - bits 1 - 15 = byte count, bit 31 = end of transfer
|
||||
*
|
||||
* Version: @(#)piix.c 1.0.4 2017/09/30
|
||||
* Version: @(#)piix.c 1.0.5 2017/10/01
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -30,8 +30,8 @@
|
||||
#include "keyboard_at.h"
|
||||
#include "mem.h"
|
||||
#include "pci.h"
|
||||
#include "hdd/hdc.h"
|
||||
#include "hdd/hdc_ide.h"
|
||||
#include "disk/hdc.h"
|
||||
#include "disk/hdc_ide.h"
|
||||
#include "piix.h"
|
||||
|
||||
|
||||
@@ -612,7 +612,9 @@ void piix_bus_master_set_irq(int channel)
|
||||
piix_busmaster[channel & 0x0F].status |= (channel >> 4);
|
||||
}
|
||||
|
||||
/* static int reset_reg = 0;
|
||||
|
||||
#if 0
|
||||
static int reset_reg = 0;
|
||||
|
||||
static uint8_t rc_read(uint16_t port, void *priv)
|
||||
{
|
||||
@@ -625,7 +627,7 @@ static void rc_write(uint16_t port, uint8_t val, void *priv)
|
||||
{
|
||||
if (reset_reg & 2)
|
||||
{
|
||||
resetpchard();
|
||||
pc_reset_hard();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -637,12 +639,13 @@ static void rc_write(uint16_t port, uint8_t val, void *priv)
|
||||
{
|
||||
piix_reset();
|
||||
}
|
||||
resetide();
|
||||
ide_reset();
|
||||
softresetx86();
|
||||
}
|
||||
}
|
||||
reset_reg = val;
|
||||
} */
|
||||
}
|
||||
#endif
|
||||
|
||||
void piix_reset(void)
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Handling of the SCSI controllers.
|
||||
*
|
||||
* Version: @(#)scsi.c 1.0.6 2017/09/30
|
||||
* Version: @(#)scsi.c 1.0.6 2017/10/01
|
||||
*
|
||||
* Authors: TheCollector1995, <mariogplayer@gmail.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "../timer.h"
|
||||
#include "../device.h"
|
||||
#include "../cdrom/cdrom.h"
|
||||
#include "../hdd/hdc.h"
|
||||
#include "../disk/hdc.h"
|
||||
#include "scsi.h"
|
||||
#include "scsi_aha154x.h"
|
||||
#include "scsi_buslogic.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* The generic SCSI device command handler.
|
||||
*
|
||||
* Version: @(#)scsi_device.c 1.0.4 2017/09/29
|
||||
* Version: @(#)scsi_device.c 1.0.4 2017/10/01
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <wchar.h>
|
||||
#include "../ibm.h"
|
||||
#include "../cdrom/cdrom.h"
|
||||
#include "../hdd/hdd.h"
|
||||
#include "../disk/hdd.h"
|
||||
#include "scsi.h"
|
||||
#include "scsi_disk.h"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* Emulation of SCSI fixed and removable disks.
|
||||
*
|
||||
* Version: @(#)scsi_disk.c 1.0.9 2017/09/30
|
||||
* Version: @(#)scsi_disk.c 1.0.9 2017/10/01
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2017 Miran Grca.
|
||||
@@ -23,9 +23,9 @@
|
||||
#include "../device.h"
|
||||
#include "../piix.h"
|
||||
#include "../cdrom/cdrom.h"
|
||||
#include "../hdd/hdd.h"
|
||||
#include "../hdd/hdc.h"
|
||||
#include "../hdd/hdc_ide.h"
|
||||
#include "../disk/hdd.h"
|
||||
#include "../disk/hdc.h"
|
||||
#include "../disk/hdc_ide.h"
|
||||
#include "../win/plat_iodev.h"
|
||||
#include "scsi.h"
|
||||
#include "scsi_disk.h"
|
||||
|
||||
@@ -24,11 +24,11 @@
|
||||
#include "device.h"
|
||||
#include "lpt.h"
|
||||
#include "serial.h"
|
||||
#include "disk/hdc.h"
|
||||
#include "disk/hdc_ide.h"
|
||||
#include "floppy/floppy.h"
|
||||
#include "floppy/fdc.h"
|
||||
#include "floppy/fdd.h"
|
||||
#include "hdd/hdc.h"
|
||||
#include "hdd/hdc_ide.h"
|
||||
#include "sio.h"
|
||||
|
||||
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
#include "device.h"
|
||||
#include "lpt.h"
|
||||
#include "serial.h"
|
||||
#include "disk/hdc.h"
|
||||
#include "disk/hdc_ide.h"
|
||||
#include "floppy/floppy.h"
|
||||
#include "floppy/fdc.h"
|
||||
#include "floppy/fdd.h"
|
||||
#include "hdd/hdc.h"
|
||||
#include "hdd/hdc_ide.h"
|
||||
#include "sio.h"
|
||||
|
||||
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
#include "device.h"
|
||||
#include "lpt.h"
|
||||
#include "serial.h"
|
||||
#include "disk/hdc.h"
|
||||
#include "disk/hdc_ide.h"
|
||||
#include "floppy/floppy.h"
|
||||
#include "floppy/fdc.h"
|
||||
#include "floppy/fdd.h"
|
||||
#include "hdd/hdc.h"
|
||||
#include "hdd/hdc_ide.h"
|
||||
#include "sio.h"
|
||||
|
||||
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
#include "device.h"
|
||||
#include "lpt.h"
|
||||
#include "serial.h"
|
||||
#include "disk/hdc.h"
|
||||
#include "disk/hdc_ide.h"
|
||||
#include "floppy/floppy.h"
|
||||
#include "floppy/fdc.h"
|
||||
#include "floppy/fdd.h"
|
||||
#include "hdd/hdc.h"
|
||||
#include "hdd/hdc_ide.h"
|
||||
#include "sio.h"
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Windows resource script.
|
||||
*
|
||||
* Version: @(#)86Box.rc 1.0.12 2017/10/01
|
||||
* Version: @(#)86Box.rc 1.0.13 2017/10/01
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
@@ -808,8 +808,10 @@ BEGIN
|
||||
IDS_2150 "Thrustmaster Flight Control System"
|
||||
IDS_2151 "Disabled"
|
||||
IDS_2152 "None"
|
||||
IDS_2153 "AT Fixed Disk Adapter"
|
||||
IDS_2154 "Internal Controller"
|
||||
#if UNUSED
|
||||
IDS_2153
|
||||
IDS_2154
|
||||
#endif
|
||||
IDS_2155 "IRQ %i"
|
||||
IDS_2156 "%" PRIu64
|
||||
IDS_2157 "%" PRIu64 " MB (CHS: %" PRIu64 ", %" PRIu64 ", %" PRIu64 ")"
|
||||
|
||||
@@ -10,8 +10,9 @@
|
||||
*
|
||||
* NOTE: FIXME: Strings 2176 and 2193 are same.
|
||||
* NOTE: FIXME: string 2095 not in use.
|
||||
* NOTE: FIXME: strings 2152-2154 not in use.
|
||||
*
|
||||
* Version: @(#)resource.h 1.0.6 2017/09/23
|
||||
* Version: @(#)resource.h 1.0.8 2017/10/01
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -308,8 +309,10 @@
|
||||
#define IDS_2150 2150 // "Thrustmaster Flight Control System"
|
||||
#define IDS_2151 2151 // "Disabled"
|
||||
#define IDS_2152 2152 // "None"
|
||||
#define IDS_2153 2153 // "AT Fixed Disk Adapter"
|
||||
#define IDS_2154 2154 // "Internal IDE"
|
||||
#if NOTUSED
|
||||
#define IDS_2153 2153
|
||||
#define IDS_2154 2154
|
||||
#endif
|
||||
#define IDS_2155 2155 // "IRQ %i"
|
||||
#define IDS_2156 2156 // "MFM (%01i:%01i)"
|
||||
#define IDS_2157 2157 // "IDE (PIO+DMA) (%01i:%01i)"
|
||||
|
||||
327
src/win/win.c
327
src/win/win.c
@@ -43,11 +43,11 @@
|
||||
#include "../cdrom/cdrom_ioctl.h"
|
||||
#include "../cdrom/cdrom_image.h"
|
||||
#include "../cdrom/cdrom_null.h"
|
||||
#include "../disk/hdd.h"
|
||||
#include "../disk/hdc.h"
|
||||
#include "../disk/hdc_ide.h"
|
||||
#include "../floppy/floppy.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../hdd/hdd.h"
|
||||
#include "../hdd/hdc.h"
|
||||
#include "../hdd/hdc_ide.h"
|
||||
#include "../scsi/scsi.h"
|
||||
#include "../scsi/scsi_disk.h"
|
||||
#include "../network/network.h"
|
||||
@@ -158,7 +158,6 @@ static int *sb_icon_flags;
|
||||
static int *sb_part_meanings;
|
||||
static int *sb_part_icons;
|
||||
static WCHAR **sbTips;
|
||||
|
||||
static int sb_parts = 0;
|
||||
static int sb_ready = 0;
|
||||
|
||||
@@ -334,7 +333,7 @@ void mainthread(LPVOID param)
|
||||
{
|
||||
start_time = timer_read();
|
||||
drawits-=10; if (drawits>50) drawits=0;
|
||||
runpc();
|
||||
pc_run();
|
||||
frames++;
|
||||
if (frames >= 200 && nvr_dosave)
|
||||
{
|
||||
@@ -496,7 +495,7 @@ static void init_cdrom_host_drives(void)
|
||||
}
|
||||
|
||||
|
||||
HMENU create_popup_menu(int part)
|
||||
static HMENU create_popup_menu(int part)
|
||||
{
|
||||
HMENU newHandle;
|
||||
newHandle = CreatePopupMenu();
|
||||
@@ -505,7 +504,7 @@ HMENU create_popup_menu(int part)
|
||||
}
|
||||
|
||||
|
||||
void create_floppy_submenu(HMENU m, int id)
|
||||
static void create_floppy_submenu(HMENU m, int id)
|
||||
{
|
||||
AppendMenu(m, MF_STRING, IDM_FLOPPY_IMAGE_NEW | id, win_language_get_string_from_id(IDS_2161));
|
||||
AppendMenu(m, MF_SEPARATOR, 0, 0);
|
||||
@@ -515,7 +514,7 @@ void create_floppy_submenu(HMENU m, int id)
|
||||
AppendMenu(m, MF_STRING, IDM_FLOPPY_EJECT | id, win_language_get_string_from_id(IDS_2164));
|
||||
}
|
||||
|
||||
void create_cdrom_submenu(HMENU m, int id)
|
||||
static void create_cdrom_submenu(HMENU m, int id)
|
||||
{
|
||||
int i = 0;
|
||||
WCHAR s[64];
|
||||
@@ -579,7 +578,7 @@ check_menu_items:
|
||||
}
|
||||
}
|
||||
|
||||
void create_removable_disk_submenu(HMENU m, int id)
|
||||
static void create_removable_disk_submenu(HMENU m, int id)
|
||||
{
|
||||
AppendMenu(m, MF_STRING, IDM_RDISK_EJECT | id, win_language_get_string_from_id(IDS_2166));
|
||||
AppendMenu(m, MF_STRING, IDM_RDISK_RELOAD | id, win_language_get_string_from_id(IDS_2167));
|
||||
@@ -1621,79 +1620,81 @@ void reset_menus(void)
|
||||
|
||||
int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil)
|
||||
{
|
||||
HWND hwnd; /* This is the handle for our window */
|
||||
MSG messages; /* Here messages to the application are saved */
|
||||
WNDCLASSEX wincl; /* Data structure for the windowclass */
|
||||
HWND hwnd; /* handle for our window */
|
||||
MSG messages; /* received-messages buffer */
|
||||
WNDCLASSEX wincl; /* buffer for main window's class */
|
||||
HACCEL haccel; /* handle to accelerator table */
|
||||
int c, d, bRet;
|
||||
WCHAR emulator_title[200];
|
||||
WCHAR title[200];
|
||||
LARGE_INTEGER qpc_freq;
|
||||
HACCEL haccel; /* Handle to accelerator table */
|
||||
|
||||
/* Process the command line for options. */
|
||||
process_command_line();
|
||||
|
||||
memset(recv_key, 0, sizeof(recv_key));
|
||||
|
||||
process_command_line();
|
||||
|
||||
win_language_load_common_strings();
|
||||
|
||||
hinstance=hThisInstance;
|
||||
/* The Window structure */
|
||||
/* The Window structure. */
|
||||
hinstance = hThisInstance;
|
||||
wincl.hInstance = hThisInstance;
|
||||
wincl.lpszClassName = szClassName;
|
||||
wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */
|
||||
wincl.style = CS_DBLCLKS; /* Catch double-clicks */
|
||||
wincl.lpfnWndProc = WindowProcedure; /* called by Windows */
|
||||
wincl.style = CS_DBLCLKS; /* Catch double-clicks */
|
||||
wincl.cbSize = sizeof (WNDCLASSEX);
|
||||
|
||||
/* Use default icon and mouse-pointer */
|
||||
/* Use default icon and mouse-pointer. */
|
||||
wincl.hIcon = LoadIcon(hinstance, (LPCTSTR) 100);
|
||||
wincl.hIconSm = LoadIcon(hinstance, (LPCTSTR) 100);
|
||||
wincl.hCursor = NULL;
|
||||
wincl.lpszMenuName = NULL; /* No menu */
|
||||
wincl.cbClsExtra = 0; /* No extra bytes after the window class */
|
||||
wincl.cbWndExtra = 0; /* structure or the window instance */
|
||||
/* Use Windows's default color as the background of the window */
|
||||
wincl.lpszMenuName = NULL; /* no menu */
|
||||
wincl.cbClsExtra = 0; /* no extra bytes after window class */
|
||||
wincl.cbWndExtra = 0; /* structure or the window instance */
|
||||
|
||||
/* Use Windows's default color as the background of the window. */
|
||||
wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
|
||||
|
||||
/* Register the window class, and if it fails quit the program */
|
||||
if (!RegisterClassEx(&wincl))
|
||||
{
|
||||
return 0;
|
||||
/* Register the window class, and if it fails quit the program. */
|
||||
if (! RegisterClassEx(&wincl)) {
|
||||
return(0);
|
||||
}
|
||||
|
||||
wincl.lpszClassName = szSubClassName;
|
||||
wincl.lpfnWndProc = subWindowProcedure; /* This function is called by windows */
|
||||
|
||||
if (!RegisterClassEx(&wincl))
|
||||
{
|
||||
return 0;
|
||||
wincl.lpfnWndProc = subWindowProcedure; /* called by Windows */
|
||||
if (! RegisterClassEx(&wincl)) {
|
||||
return(0);
|
||||
}
|
||||
|
||||
menu = LoadMenu(hThisInstance, TEXT("MainMenu"));
|
||||
|
||||
_swprintf(emulator_title, L"%s v%s", EMU_NAME_W, EMU_VERSION_W);
|
||||
_swprintf(title, L"%s v%s", EMU_NAME_W, EMU_VERSION_W);
|
||||
|
||||
/* The class is registered, let's create the program*/
|
||||
hwnd = CreateWindowEx (
|
||||
0, /* Extended possibilites for variation */
|
||||
szClassName, /* Classname */
|
||||
emulator_title, /* Title Text */
|
||||
(WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX)/* | DS_3DLOOK*/, /* default window */
|
||||
0, /* no extended possibilites */
|
||||
szClassName, /* class name */
|
||||
title, /* Title Text */
|
||||
#if 0
|
||||
(WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX), /* default window */
|
||||
#else
|
||||
(WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX) | DS_3DLOOK,
|
||||
#endif
|
||||
CW_USEDEFAULT, /* Windows decides the position */
|
||||
CW_USEDEFAULT, /* where the window ends up on the screen */
|
||||
640+(GetSystemMetrics(SM_CXFIXEDFRAME)*2), /* The programs width */
|
||||
480+(GetSystemMetrics(SM_CYFIXEDFRAME)*2)+GetSystemMetrics(SM_CYMENUSIZE)+GetSystemMetrics(SM_CYCAPTION)+1, /* and height in pixels */
|
||||
HWND_DESKTOP, /* The window is a child-window to desktop */
|
||||
menu, /* Menu */
|
||||
CW_USEDEFAULT, /* where window ends up on the screen */
|
||||
640+(GetSystemMetrics(SM_CXFIXEDFRAME)*2), /* width */
|
||||
480+(GetSystemMetrics(SM_CYFIXEDFRAME)*2)+GetSystemMetrics(SM_CYMENUSIZE)+GetSystemMetrics(SM_CYCAPTION)+1, /* and height in pixels */
|
||||
HWND_DESKTOP, /* window is a child to desktop */
|
||||
menu, /* menu */
|
||||
hThisInstance, /* Program Instance handler */
|
||||
NULL /* No Window Creation data */
|
||||
NULL /* no Window Creation data */
|
||||
);
|
||||
|
||||
/* Make the window visible on the screen */
|
||||
ShowWindow (hwnd, nFunsterStil);
|
||||
/* Make the window visible on the screen. */
|
||||
ShowWindow(hwnd, nFunsterStil);
|
||||
|
||||
/* Load the accelerator table */
|
||||
haccel = LoadAccelerators(hinstAcc, L"MainAccel");
|
||||
if (haccel == NULL)
|
||||
{
|
||||
if (haccel == NULL) {
|
||||
fatal("haccel is null\n");
|
||||
}
|
||||
|
||||
@@ -1701,38 +1702,37 @@ int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpsz
|
||||
device.usUsage = 0x06;
|
||||
device.dwFlags = RIDEV_NOHOTKEYS;
|
||||
device.hwndTarget = hwnd;
|
||||
|
||||
if (RegisterRawInputDevices(&device, 1, sizeof(device)))
|
||||
{
|
||||
if (RegisterRawInputDevices(&device, 1, sizeof(device))) {
|
||||
pclog("Raw input registered!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
pclog("Raw input registration failed!\n");
|
||||
}
|
||||
|
||||
get_registry_key_map();
|
||||
|
||||
ghwnd=hwnd;
|
||||
ghwnd = hwnd;
|
||||
|
||||
hwndRender = CreateWindow(L"STATIC", NULL, WS_VISIBLE | WS_CHILD | SS_BITMAP, 0, 0, 1, 1, ghwnd, NULL, hinstance, NULL);
|
||||
hwndRender = CreateWindow(L"STATIC", NULL,
|
||||
WS_VISIBLE|WS_CHILD|SS_BITMAP,
|
||||
0, 0, 1, 1, ghwnd, NULL, hinstance, NULL);
|
||||
|
||||
|
||||
/* FIXME: Kotori, code below should be moved to pc.c, as its not Win specific. */
|
||||
initpc(argc, argv);
|
||||
/* Pre-initialize the system, this loads the config file. */
|
||||
pc_init(argc, argv);
|
||||
|
||||
init_cdrom_host_drives();
|
||||
|
||||
network_init();
|
||||
|
||||
/* Now that we know our window sizes, adjust to that. */
|
||||
hwndStatus = EmulatorStatusBar(hwnd, IDC_STATUS, hThisInstance);
|
||||
|
||||
OriginalStatusBarProcedure = GetWindowLongPtr(hwndStatus, GWLP_WNDPROC);
|
||||
SetWindowLongPtr(hwndStatus, GWL_WNDPROC, (LONG_PTR) &StatusBarProcedure);
|
||||
|
||||
smenu = LoadMenu(hThisInstance, TEXT("StatusBarMenu"));
|
||||
|
||||
initmodules();
|
||||
pc_init_modules();
|
||||
|
||||
if (vid_apis[0][vid_api].init(hwndRender) == 0)
|
||||
{
|
||||
@@ -1746,8 +1746,12 @@ int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpsz
|
||||
}
|
||||
}
|
||||
|
||||
if (vid_resize) SetWindowLongPtr(hwnd, GWL_STYLE, (WS_OVERLAPPEDWINDOW&~WS_MINIMIZEBOX)|WS_VISIBLE);
|
||||
else SetWindowLongPtr(hwnd, GWL_STYLE, (WS_OVERLAPPEDWINDOW&~WS_SIZEBOX&~WS_THICKFRAME&~WS_MAXIMIZEBOX&~WS_MINIMIZEBOX)|WS_VISIBLE);
|
||||
if (vid_resize)
|
||||
SetWindowLongPtr(hwnd, GWL_STYLE,
|
||||
(WS_OVERLAPPEDWINDOW&~WS_MINIMIZEBOX)|WS_VISIBLE);
|
||||
else
|
||||
SetWindowLongPtr(hwnd, GWL_STYLE,
|
||||
(WS_OVERLAPPEDWINDOW&~WS_SIZEBOX&~WS_THICKFRAME&~WS_MAXIMIZEBOX&~WS_MINIMIZEBOX)|WS_VISIBLE);
|
||||
|
||||
reset_menus();
|
||||
|
||||
@@ -1771,7 +1775,16 @@ int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpsz
|
||||
}
|
||||
pclog("A total of %d ROM sets have been loaded.\n", d);
|
||||
|
||||
/* Load the ROMs for the selected machine. */
|
||||
/*
|
||||
* Load the ROMs for the selected machine.
|
||||
*
|
||||
* FIXME:
|
||||
* We should not do that here. If something turns out
|
||||
* to be wrong with the configuration (such as missing
|
||||
* ROM images, we should just display a fatal message
|
||||
* in the render window's center, let them click OK,
|
||||
* and then exit so they can remedy the situation.
|
||||
*/
|
||||
if (! rom_load_bios(romset)) {
|
||||
/* Whoops, ROMs not found. */
|
||||
if (romset!=-1)
|
||||
@@ -1787,17 +1800,14 @@ int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpsz
|
||||
romset = c;
|
||||
machine = machine_getmachine(romset);
|
||||
config_save();
|
||||
resetpchard();
|
||||
pc_reset_hard();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (c = 0; c < GFX_MAX; c++)
|
||||
{
|
||||
gfx_present[c] = video_card_available(video_old_to_new(c));
|
||||
}
|
||||
|
||||
if (!video_card_available(video_old_to_new(gfxcard)))
|
||||
{
|
||||
if (romset!=-1)
|
||||
@@ -1810,14 +1820,17 @@ int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpsz
|
||||
{
|
||||
gfxcard = c;
|
||||
config_save();
|
||||
resetpchard();
|
||||
pc_reset_hard();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Load the selected machine's BIOS. */
|
||||
rom_load_bios(romset);
|
||||
resetpchard();
|
||||
|
||||
/* Perform a hard reset to start the machine. */
|
||||
pc_reset_hard();
|
||||
|
||||
timeBeginPeriod(1);
|
||||
|
||||
@@ -1845,65 +1858,57 @@ int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpsz
|
||||
endblit();
|
||||
device_force_redraw();
|
||||
}
|
||||
if (window_remember)
|
||||
{
|
||||
MoveWindow(hwnd, window_x, window_y,
|
||||
window_w,
|
||||
window_h,
|
||||
TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveWindow(hwndRender, 0, 0,
|
||||
winsizex,
|
||||
winsizey,
|
||||
TRUE);
|
||||
MoveWindow(hwndStatus, 0, winsizey + 6,
|
||||
winsizex,
|
||||
17,
|
||||
TRUE);
|
||||
|
||||
if (window_remember) {
|
||||
MoveWindow(hwnd, window_x, window_y, window_w, window_h, TRUE);
|
||||
} else {
|
||||
MoveWindow(hwndRender, 0, 0, winsizex, winsizey, TRUE);
|
||||
MoveWindow(hwndStatus, 0, winsizey+6, winsizex, 17, TRUE);
|
||||
}
|
||||
|
||||
/* Run the message loop. It will run until GetMessage() returns 0 */
|
||||
while (!quited)
|
||||
while (! quited)
|
||||
{
|
||||
while (((bRet = GetMessage(&messages,NULL,0,0)) != 0) && !quited)
|
||||
{
|
||||
if (bRet == -1)
|
||||
{
|
||||
fatal("bRet is -1\n");
|
||||
}
|
||||
bRet = GetMessage(&messages, NULL, 0, 0);
|
||||
if ((bRet == 0) || quited) break;
|
||||
|
||||
if (messages.message==WM_QUIT) quited=1;
|
||||
if (!TranslateAccelerator(hwnd, haccel, &messages))
|
||||
{
|
||||
TranslateMessage(&messages);
|
||||
DispatchMessage(&messages);
|
||||
}
|
||||
|
||||
if (recv_key[0x58] && recv_key[0x42] && mousecapture)
|
||||
{
|
||||
ClipCursor(&oldclip);
|
||||
ShowCursor(TRUE);
|
||||
mousecapture=0;
|
||||
}
|
||||
|
||||
if ((recv_key[0x1D] || recv_key[0x9D]) && (recv_key[0x38] || recv_key[0xB8]) && (recv_key[0x51] || recv_key[0xD1]) &&
|
||||
video_fullscreen)
|
||||
{
|
||||
leave_fullscreen();
|
||||
}
|
||||
if (bRet == -1) {
|
||||
fatal("bRet is -1\n");
|
||||
}
|
||||
|
||||
quited=1;
|
||||
if (messages.message == WM_QUIT) {
|
||||
quited = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (! TranslateAccelerator(hwnd, haccel, &messages)) {
|
||||
TranslateMessage(&messages);
|
||||
DispatchMessage(&messages);
|
||||
}
|
||||
|
||||
if (recv_key[0x58] && recv_key[0x42] && mousecapture) {
|
||||
ClipCursor(&oldclip);
|
||||
ShowCursor(TRUE);
|
||||
mousecapture = 0;
|
||||
}
|
||||
|
||||
if ((recv_key[0x1D] || recv_key[0x9D]) &&
|
||||
(recv_key[0x38] || recv_key[0xB8]) &&
|
||||
(recv_key[0x51] || recv_key[0xD1]) && video_fullscreen) {
|
||||
leave_fullscreen();
|
||||
}
|
||||
}
|
||||
|
||||
startblit();
|
||||
|
||||
Sleep(200);
|
||||
TerminateThread(mainthreadh,0);
|
||||
TerminateThread(mainthreadh, 0);
|
||||
|
||||
savenvr();
|
||||
|
||||
config_save();
|
||||
closepc();
|
||||
|
||||
pc_close();
|
||||
|
||||
vid_apis[video_fullscreen][vid_api].close();
|
||||
|
||||
@@ -1917,9 +1922,10 @@ int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpsz
|
||||
UnregisterClass(szSubClassName, hinstance);
|
||||
UnregisterClass(szClassName, hinstance);
|
||||
|
||||
return messages.wParam;
|
||||
return(messages.wParam);
|
||||
}
|
||||
|
||||
|
||||
HHOOK hKeyboardHook;
|
||||
int hook_enabled = 0;
|
||||
|
||||
@@ -1935,30 +1941,44 @@ LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
p = (KBDLLHOOKSTRUCT*)lParam;
|
||||
|
||||
if (p->vkCode == VK_TAB && p->flags & LLKHF_ALTDOWN) return 1; /* disable alt-tab */
|
||||
if (p->vkCode == VK_SPACE && p->flags & LLKHF_ALTDOWN) return 1; /* disable alt-tab */
|
||||
if((p->vkCode == VK_LWIN) || (p->vkCode == VK_RWIN)) return 1; /* disable windows keys */
|
||||
if (p->vkCode == VK_ESCAPE && p->flags & LLKHF_ALTDOWN) return 1; /* disable alt-escape */
|
||||
bControlKeyDown = GetAsyncKeyState (VK_CONTROL) >> ((sizeof(SHORT) * 8) - 1); /* checks ctrl key pressed */
|
||||
if (p->vkCode == VK_ESCAPE && bControlKeyDown) return 1; /* disable ctrl-escape */
|
||||
/* disable alt-tab */
|
||||
if (p->vkCode == VK_TAB && p->flags & LLKHF_ALTDOWN) return 1;
|
||||
|
||||
/* disable alt-space */
|
||||
if (p->vkCode == VK_SPACE && p->flags & LLKHF_ALTDOWN) return 1;
|
||||
|
||||
/* disable alt-escape */
|
||||
if (p->vkCode == VK_ESCAPE && p->flags & LLKHF_ALTDOWN) return 1;
|
||||
|
||||
/* disable windows keys */
|
||||
if((p->vkCode == VK_LWIN) || (p->vkCode == VK_RWIN)) return 1;
|
||||
|
||||
/* checks ctrl key pressed */
|
||||
bControlKeyDown = GetAsyncKeyState(VK_CONTROL)>>((sizeof(SHORT)*8)-1);
|
||||
|
||||
/* disable ctrl-escape */
|
||||
if (p->vkCode == VK_ESCAPE && bControlKeyDown) return 1;
|
||||
|
||||
return CallNextHookEx( hKeyboardHook, nCode, wParam, lParam );
|
||||
}
|
||||
|
||||
void cdrom_close(uint8_t id)
|
||||
|
||||
void
|
||||
cdrom_close(uint8_t id)
|
||||
{
|
||||
switch (cdrom_drives[id].host_drive)
|
||||
{
|
||||
case 0:
|
||||
null_close(id);
|
||||
break;
|
||||
default:
|
||||
ioctl_close(id);
|
||||
break;
|
||||
case 200:
|
||||
image_close(id);
|
||||
break;
|
||||
}
|
||||
switch (cdrom_drives[id].host_drive) {
|
||||
case 0:
|
||||
null_close(id);
|
||||
break;
|
||||
|
||||
case 200:
|
||||
image_close(id);
|
||||
break;
|
||||
|
||||
default:
|
||||
ioctl_close(id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static BOOL CALLBACK about_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
@@ -1994,23 +2014,27 @@ void about_open(HWND hwnd)
|
||||
DialogBox(hinstance, (LPCTSTR)DLG_ABOUT, hwnd, about_dlgproc);
|
||||
}
|
||||
|
||||
static void win_pc_reset(int hard)
|
||||
|
||||
static void
|
||||
win_pc_reset(int hard)
|
||||
{
|
||||
pause=1;
|
||||
Sleep(100);
|
||||
savenvr();
|
||||
config_save();
|
||||
if (hard)
|
||||
{
|
||||
resetpchard();
|
||||
}
|
||||
else
|
||||
{
|
||||
resetpc_cad();
|
||||
}
|
||||
pause=0;
|
||||
pause = 1;
|
||||
|
||||
Sleep(100);
|
||||
|
||||
savenvr();
|
||||
|
||||
config_save();
|
||||
|
||||
if (hard)
|
||||
pc_reset_hard();
|
||||
else
|
||||
pc_send_cad();
|
||||
|
||||
pause = 0;
|
||||
}
|
||||
|
||||
|
||||
void video_toggle_option(HMENU hmenu, int *val, int id)
|
||||
{
|
||||
startblit();
|
||||
@@ -2022,6 +2046,7 @@ void video_toggle_option(HMENU hmenu, int *val, int id)
|
||||
device_force_redraw();
|
||||
}
|
||||
|
||||
|
||||
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static wchar_t wOldTitle[512];
|
||||
@@ -2054,11 +2079,11 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||
break;
|
||||
|
||||
case IDM_ACTION_EXIT:
|
||||
PostQuitMessage (0); /* send a WM_QUIT to the message queue */
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
|
||||
case IDM_ACTION_CTRL_ALT_ESC:
|
||||
ctrl_alt_esc();
|
||||
pc_send_cae();
|
||||
break;
|
||||
|
||||
case IDM_ACTION_PAUSE:
|
||||
|
||||
@@ -358,7 +358,7 @@ static BOOL CALLBACK deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam
|
||||
|
||||
config_save();
|
||||
|
||||
resetpchard();
|
||||
pc_reset_hard();
|
||||
|
||||
EndDialog(hdlg, 0);
|
||||
return TRUE;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Windows IO device menu handler.
|
||||
*
|
||||
* Version: @(#)win_iodev.c 1.0.4 2017/09/29
|
||||
* Version: @(#)win_iodev.c 1.0.4 2017/10/01
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "../cdrom/cdrom_image.h"
|
||||
#include "../cdrom/cdrom_ioctl.h"
|
||||
#include "../cdrom/cdrom_null.h"
|
||||
#include "../hdd/hdd.h"
|
||||
#include "../disk/hdd.h"
|
||||
#include "../scsi/scsi_disk.h"
|
||||
#include "plat_iodev.h"
|
||||
#include "win.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Windows 86Box Settings dialog handler.
|
||||
*
|
||||
* Version: @(#)win_settings.c 1.0.16 2017/10/01
|
||||
* Version: @(#)win_settings.c 1.0.17 2017/10/01
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
@@ -36,11 +36,11 @@
|
||||
#include "../lpt.h"
|
||||
#include "../mouse.h"
|
||||
#include "../cdrom/cdrom.h"
|
||||
#include "../disk/hdd.h"
|
||||
#include "../disk/hdc.h"
|
||||
#include "../disk/hdc_ide.h"
|
||||
#include "../floppy/floppy.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../hdd/hdd.h"
|
||||
#include "../hdd/hdc.h"
|
||||
#include "../hdd/hdc_ide.h"
|
||||
#include "../scsi/scsi.h"
|
||||
#include "../network/network.h"
|
||||
#include "../sound/sound.h"
|
||||
@@ -77,7 +77,7 @@ static char temp_lpt1_device_name[16];
|
||||
static int temp_serial[2], temp_lpt;
|
||||
|
||||
/* Peripherals category */
|
||||
static int temp_scsi_card, hdc_ignore, temp_ide_ter, temp_ide_ter_irq, temp_ide_qua, temp_ide_qua_irq;
|
||||
static int temp_scsi_card, temp_ide_ter, temp_ide_ter_irq, temp_ide_qua, temp_ide_qua_irq;
|
||||
static char temp_hdc_name[16];
|
||||
static char *hdc_names[16];
|
||||
static int temp_bugger;
|
||||
@@ -332,6 +332,7 @@ static void win_settings_save(void)
|
||||
/* Peripherals category */
|
||||
scsi_card_current = temp_scsi_card;
|
||||
strncpy(hdc_name, temp_hdc_name, sizeof(temp_hdc_name) - 1);
|
||||
hdc_init(hdc_name);
|
||||
ide_enable[2] = temp_ide_ter;
|
||||
ide_irq[2] = temp_ide_ter_irq;
|
||||
ide_enable[3] = temp_ide_qua;
|
||||
@@ -365,7 +366,7 @@ static void win_settings_save(void)
|
||||
|
||||
config_save();
|
||||
|
||||
speedchanged();
|
||||
pc_speed_changed();
|
||||
|
||||
if (joystick_type != 7) gameport_update_joystick_type();
|
||||
}
|
||||
@@ -1386,107 +1387,80 @@ static void recalc_hdc_list(HWND hdlg, int machine, int use_selected_hdc)
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_COMBO_HDC);
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* We do not ignore this entry, nor do we zap the selection
|
||||
* list, as we might want to override the internal controller
|
||||
* with an external one. --FvK
|
||||
*/
|
||||
if (machines[temp_machine].flags & MACHINE_HAS_HDC)
|
||||
valid = 0;
|
||||
|
||||
if (use_selected_hdc)
|
||||
{
|
||||
hdc_ignore = 1;
|
||||
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||
|
||||
SendMessage(h, CB_RESETCONTENT, 0, 0);
|
||||
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_language_get_string_from_id(IDS_2154));
|
||||
/* See above, don't disable it. */
|
||||
EnableWindow(h, FALSE);
|
||||
SendMessage(h, CB_SETCURSEL, 1, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
hdc_ignore = 0;
|
||||
|
||||
valid = 0;
|
||||
|
||||
if (use_selected_hdc)
|
||||
if (c != -1 && hdc_names[c])
|
||||
{
|
||||
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||
|
||||
if (c != -1 && hdc_names[c])
|
||||
{
|
||||
strncpy(old_name, hdc_names[c], sizeof(old_name) - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(old_name, "none");
|
||||
}
|
||||
strncpy(old_name, hdc_names[c], sizeof(old_name) - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
strncpy(old_name, temp_hdc_name, sizeof(old_name) - 1);
|
||||
strcpy(old_name, "none");
|
||||
}
|
||||
|
||||
SendMessage(h, CB_RESETCONTENT, 0, 0);
|
||||
c = d = 0;
|
||||
while (1)
|
||||
{
|
||||
s = hdc_get_name(c);
|
||||
if (s[0] == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if ((hdc_get_flags(c) & DEVICE_AT) && !(machines[machine].flags & MACHINE_AT))
|
||||
{
|
||||
c++;
|
||||
continue;
|
||||
}
|
||||
if ((hdc_get_flags(c) & DEVICE_PS2) && !(machines[machine].flags & MACHINE_PS2_HDD))
|
||||
{
|
||||
c++;
|
||||
continue;
|
||||
}
|
||||
if ((hdc_get_flags(c) & DEVICE_MCA) && !(machines[machine].flags & MACHINE_MCA))
|
||||
{
|
||||
c++;
|
||||
continue;
|
||||
}
|
||||
if (!hdc_available(c))
|
||||
{
|
||||
c++;
|
||||
continue;
|
||||
}
|
||||
#if 0
|
||||
if (c < 2)
|
||||
{
|
||||
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_language_get_string_from_id(2152 + c));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
mbstowcs(lptsTemp, s, strlen(s) + 1);
|
||||
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp);
|
||||
}
|
||||
hdc_names[d] = hdc_get_internal_name(c);
|
||||
if (!strcmp(old_name, hdc_names[d]))
|
||||
{
|
||||
SendMessage(h, CB_SETCURSEL, d, 0);
|
||||
valid = 1;
|
||||
}
|
||||
c++;
|
||||
d++;
|
||||
}
|
||||
|
||||
if (!valid)
|
||||
{
|
||||
SendMessage(h, CB_SETCURSEL, 0, 0);
|
||||
}
|
||||
|
||||
EnableWindow(h, TRUE);
|
||||
#if 0
|
||||
if (machines[temp_machine].flags & MACHINE_HAS_HDC)
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
strncpy(old_name, temp_hdc_name, sizeof(old_name) - 1);
|
||||
}
|
||||
|
||||
SendMessage(h, CB_RESETCONTENT, 0, 0);
|
||||
c = d = 0;
|
||||
while (1)
|
||||
{
|
||||
s = hdc_get_name(c);
|
||||
if (s[0] == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (c==1 && !(machines[temp_machine].flags&MACHINE_HAS_HDC))
|
||||
{
|
||||
/* Skip "Internal" if machine doesn't have one. */
|
||||
c++;
|
||||
continue;
|
||||
}
|
||||
if ((hdc_get_flags(c) & DEVICE_AT) && !(machines[machine].flags & MACHINE_AT))
|
||||
{
|
||||
c++;
|
||||
continue;
|
||||
}
|
||||
if ((hdc_get_flags(c) & DEVICE_PS2) && !(machines[machine].flags & MACHINE_PS2_HDD))
|
||||
{
|
||||
c++;
|
||||
continue;
|
||||
}
|
||||
if ((hdc_get_flags(c) & DEVICE_MCA) && !(machines[machine].flags & MACHINE_MCA))
|
||||
{
|
||||
c++;
|
||||
continue;
|
||||
}
|
||||
if (!hdc_available(c))
|
||||
{
|
||||
c++;
|
||||
continue;
|
||||
}
|
||||
mbstowcs(lptsTemp, s, strlen(s) + 1);
|
||||
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp);
|
||||
|
||||
hdc_names[d] = hdc_get_internal_name(c);
|
||||
if (!strcmp(old_name, hdc_names[d]))
|
||||
{
|
||||
SendMessage(h, CB_SETCURSEL, d, 0);
|
||||
valid = 1;
|
||||
}
|
||||
c++;
|
||||
d++;
|
||||
}
|
||||
|
||||
if (!valid)
|
||||
{
|
||||
SendMessage(h, CB_SETCURSEL, 0, 0);
|
||||
}
|
||||
|
||||
EnableWindow(h, TRUE);
|
||||
|
||||
free(lptsTemp);
|
||||
}
|
||||
@@ -1645,18 +1619,11 @@ static BOOL CALLBACK win_settings_peripherals_proc(HWND hdlg, UINT message, WPAR
|
||||
return FALSE;
|
||||
|
||||
case WM_SAVESETTINGS:
|
||||
if (hdc_ignore == 0)
|
||||
h = GetDlgItem(hdlg, IDC_COMBO_HDC);
|
||||
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||
if (hdc_names[c])
|
||||
{
|
||||
h = GetDlgItem(hdlg, IDC_COMBO_HDC);
|
||||
c = SendMessage(h, CB_GETCURSEL, 0, 0);
|
||||
if (hdc_names[c])
|
||||
{
|
||||
strncpy(temp_hdc_name, hdc_names[c], sizeof(temp_hdc_name) - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(temp_hdc_name, "none");
|
||||
}
|
||||
strncpy(temp_hdc_name, hdc_names[c], sizeof(temp_hdc_name) - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user