Merge branch '86Box:master' into master

This commit is contained in:
starfrost
2025-01-03 01:08:11 +00:00
committed by GitHub
14 changed files with 788 additions and 276 deletions

View File

@@ -207,7 +207,7 @@ int video_fullscreen_scale_maximized = 0; /* (C) Whether
also apply when maximized. */
int do_auto_pause = 0; /* (C) Auto-pause the emulator on focus
loss */
int raw_input = 0; /* (C) Use raw input */
int hook_enabled = 1; /* (C) Keyboard hook is enabled */
char uuid[MAX_UUID_LEN] = { '\0' }; /* (C) UUID or machine identifier */
int other_ide_present = 0; /* IDE controllers from non-IDE cards are
@@ -454,6 +454,8 @@ delete_nvr_file(uint8_t flash)
fn = NULL;
}
extern void device_find_all_descs(void);
/*
* Perform initial startup of the PC.
*
@@ -563,7 +565,7 @@ usage:
printf("-S or --settings - show only the settings dialog\n");
#endif
printf("-V or --vmname name - overrides the name of the running VM\n");
printf("-W or --raw - uses raw input (compatibility-only outside Windows)\n");
printf("-W or --nohook - disables keyboard hook (compatibility-only outside Windows)\n");
printf("-X or --clear what - clears the 'what' (cmos/flash/both)\n");
printf("-Y or --donothing - do not show any UI or run the emulation\n");
printf("-Z or --lastvmpath - the last parameter is VM path rather than config\n");
@@ -639,8 +641,8 @@ usage:
dump_missing = 1;
} else if (!strcasecmp(argv[c], "--donothing") || !strcasecmp(argv[c], "-Y")) {
do_nothing = 1;
} else if (!strcasecmp(argv[c], "--raw") || !strcasecmp(argv[c], "-W")) {
raw_input = 1;
} else if (!strcasecmp(argv[c], "--nohook") || !strcasecmp(argv[c], "-W")) {
hook_enabled = 0;
} else if (!strcasecmp(argv[c], "--keycodes") || !strcasecmp(argv[c], "-K")) {
if ((c + 1) == argc)
goto usage;

View File

@@ -1426,33 +1426,11 @@ cdrom_get_track_buffer(cdrom_t *dev, uint8_t *buf)
buf[8] = 0x00;
}
/* TODO: Actually implement this properly. */
void
cdrom_get_q(cdrom_t *dev, uint8_t *buf, int *curtoctrk, uint8_t mode)
{
track_info_t ti;
int first_track;
int last_track;
if (dev != NULL) {
dev->ops->get_tracks(dev, &first_track, &last_track);
dev->ops->get_track_info(dev, *curtoctrk, 0, &ti);
buf[0] = (ti.attr << 4) & 0xf0;
buf[1] = ti.number;
buf[2] = bin2bcd(*curtoctrk + 1);
buf[3] = ti.m;
buf[4] = ti.s;
buf[5] = ti.f;
buf[6] = 0x00;
dev->ops->get_track_info(dev, 1, 0, &ti);
buf[7] = ti.m;
buf[8] = ti.s;
buf[9] = ti.f;
if (*curtoctrk >= (last_track + 1))
*curtoctrk = 0;
else if (mode)
*curtoctrk = *curtoctrk + 1;
} else
memset(buf, 0x00, 10);
memset(buf, 0x00, 10);
}
uint8_t
@@ -2196,7 +2174,7 @@ cdrom_exit(uint8_t id)
memset(dev->image_path, 0, sizeof(dev->image_path));
pclog("cdrom_exit(%i): cdrom_insert(%i)\n", id, id);
cdrom_log("cdrom_exit(%i): cdrom_insert(%i)\n", id, id);
cdrom_insert(id);
}
@@ -2274,7 +2252,7 @@ cdrom_reload(uint8_t id)
#endif
/* Signal media change to the emulated machine. */
pclog("cdrom_reload(%i): cdrom_insert(%i)\n", id, id);
cdrom_log("cdrom_reload(%i): cdrom_insert(%i)\n", id, id);
cdrom_insert(id);
/* The drive was previously empty, transition directly to UNIT ATTENTION. */

View File

@@ -436,7 +436,7 @@ cdi_read_sector(cd_img_t *cdi, uint8_t *buffer, int raw, uint32_t sector)
const uint64_t seek = (sect + 150 - idx->start + idx->file_start) * trk->sector_size;
cdrom_image_backend_log("cdrom_read_sector(%08X): track %02X, index %02X, %016" PRIX64 ", %016" PRIX64 ", %i\n",
sector, track, index, trk->start, trk->sector_size);
sector, track, index, idx->start, trk->sector_size);
if (track_is_raw)
raw_size = trk->sector_size;
@@ -1477,12 +1477,18 @@ cdi_close(cd_img_t *cdi)
int
cdi_set_device(cd_img_t *cdi, const char *path)
{
int ret;
uintptr_t ext = path + strlen(path) - strrchr(path, '.');
int ret;
if ((ret = cdi_load_cue(cdi, path)))
return ret;
cdrom_image_backend_log("cdi_set_device(): %" PRIu64 ", %lli, %s\n",
ext, strlen(path), path + strlen(path) - ext + 1);
cdi_clear_tracks(cdi);
if ((ext == 4) && !stricmp(path + strlen(path) - ext + 1, "CUE")) {
if ((ret = cdi_load_cue(cdi, path)))
return ret;
cdi_clear_tracks(cdi);
}
if ((ret = cdi_load_iso(cdi, path)))
return ret;

View File

@@ -165,7 +165,7 @@ extern _Atomic double mouse_y_error; /* Mouse error accumulator - Y */
#endif
extern int pit_mode; /* (C) force setting PIT mode */
extern int fm_driver; /* (C) select FM sound driver */
extern int raw_input; /* (C) Use raw input */
extern int hook_enabled; /* (C) Keyboard hook is enabled */
/* Keyboard variables for future key combination redefinition. */
extern uint16_t key_prefix_1_1;

View File

@@ -593,6 +593,7 @@ extern int machine_at_pcm5330_init(const machine_t *);
extern int machine_at_ecs486_init(const machine_t *);
extern int machine_at_hot433a_init(const machine_t *);
extern int machine_at_pl4600c_init(const machine_t *);
extern int machine_at_atc1415_init(const machine_t *);
extern int machine_at_actionpc2600_init(const machine_t *);
extern int machine_at_actiontower8400_init(const machine_t *);

View File

@@ -0,0 +1,22 @@
/*
* 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.
*
* Ensoniq AudioPCI family emulation.
*
* Authors: Cacodemon345
*
* Copyright 2024-2025 Cacodemon345.
*/
struct akm4531_t
{
unsigned char registers[256];
};
typedef struct akm4531_t akm4531_t;
double akm4531_apply_master_vol(unsigned short sample);

View File

@@ -185,6 +185,7 @@ extern const device_t ess_soundpiper_32_mca_device;
extern const device_t ess_chipchat_16_mca_device;
/* Ensoniq AudioPCI */
extern const device_t es1370_device;
extern const device_t es1371_device;
extern const device_t es1371_onboard_device;
extern const device_t es1373_device;

View File

@@ -48,6 +48,7 @@
#include <86box/hwm.h>
#include <86box/machine.h>
#include <86box/plat_unused.h>
#include <86box/sound.h>
int
machine_at_acc386_init(const machine_t *model)
@@ -1962,6 +1963,48 @@ machine_at_hot433a_init(const machine_t *model)
return ret;
}
int
machine_at_pl4600c_init(const machine_t *model)
{
int ret;
ret = bios_load_linear("roms/machines/pl4600c/SST29EE010.BIN",
0x000e0000, 131072, 0);
if (bios_only || !ret)
return ret;
machine_at_common_init(model);
pci_init(PCI_CONFIG_TYPE_1);
pci_register_slot(0x0C, PCI_CARD_NORMAL, 1, 2, 3, 4); /* Slot 01 */
pci_register_slot(0x0D, PCI_CARD_NORMAL, 4, 1, 2, 3); /* Slot 02 */
pci_register_slot(0x10, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0);
pci_register_slot(0x12, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0); /* Onboard */
pci_register_slot(0x13, PCI_CARD_VIDEO, 0, 0, 0, 0); /* Onboard */
device_add(&umc_hb4_device);
device_add(&umc_8886af_device);
device_add(&um8663af_device);
device_add(&sst_flash_29ee010_device);
device_add(&keyboard_ps2_ami_pci_device);
if (gfxcard[0] == VID_INTERNAL)
device_add(&gd5430_onboard_pci_device);
if (sound_card_current[0] == SOUND_INTERNAL)
device_add(&ess_1688_device);
if (fdc_current[0] == FDC_INTERNAL){
fdd_set_turbo(0, 1);
fdd_set_turbo(1, 1);
}
return ret;
}
int
machine_at_atc1415_init(const machine_t *model)
{

View File

@@ -8668,6 +8668,47 @@ const machine_t machines[] = {
.snd_device = NULL,
.net_device = NULL
},
/* Compaq Presario 7100 / 7200 Series, using MiTAC/Trigon PL4600C (486). */
/* Has a VIA VT82C42N KBC. */
{
.name = "[UMC 8881] Compaq Presario 7100/7200 Series 486",
.internal_name = "pl4600c",
.type = MACHINE_TYPE_486_S3,
.chipset = MACHINE_CHIPSET_UMC_UM8881,
.init = machine_at_pl4600c_init,
.p1_handler = NULL,
.gpio_handler = NULL,
.available_flag = MACHINE_AVAILABLE,
.gpio_acpi_handler = NULL,
.cpu = {
.package = CPU_PKG_SOCKET3,
.block = CPU_BLOCK_NONE,
.min_bus = 0,
.max_bus = 0,
.min_voltage = 0,
.max_voltage = 0,
.min_multi = 0,
.max_multi = 0
},
.bus_flags = MACHINE_PCI,
.flags = MACHINE_IDE_DUAL | MACHINE_VIDEO | MACHINE_SOUND | MACHINE_APM,
.ram = {
.min = 1024,
.max = 65536,
.step = 1024
},
.nvrmask = 255,
.kbc_device = NULL,
.kbc_p1 = 0xff,
.gpio = 0xffffffff,
.gpio_acpi = 0xffffffff,
.device = NULL,
.fdc_device = NULL,
.sio_device = NULL,
.vid_device = &gd5430_onboard_pci_device,
.snd_device = &ess_1688_device,
.net_device = NULL
},
/* Has a VIA VT82C406 KBC+RTC that likely has identical commands to the VT82C42N. */
{
.name = "[VIA VT82C496G] DFI G486VPA",

View File

@@ -43,6 +43,7 @@ Q_IMPORT_PLUGIN(QWindowsVistaStylePlugin)
#endif
#ifdef Q_OS_WINDOWS
# include "qt_rendererstack.hpp"
# include "qt_winrawinputfilter.hpp"
# include "qt_winmanagerfilter.hpp"
# include <86box/win.h>
@@ -143,50 +144,21 @@ keyboard_getkeymap()
}
}
static void
kbd_handle(uint16_t scancode, uint16_t flags)
{
if (flags & LLKHF_EXTENDED)
scancode |= 0x100;
/* Translate the scan code to 9-bit */
scancode = convert_scan_code(scancode);
/* Remap it according to the list from the Registry */
if ((scancode < (sizeof(scancode_map) / sizeof(scancode_map[0]))) && (scancode != scancode_map[scancode])) {
// pclog("Scan code remap: %03X -> %03X\n", scancode, scancode_map[scancode]);
scancode = scancode_map[scancode];
}
/* If it's not 0xFFFF, send it to the emulated
keyboard.
We use scan code 0xFFFF to mean a mapping that
has a prefix other than E0 and that is not E1 1D,
which is, for our purposes, invalid. */
/* Translate right CTRL to left ALT if the user has so
chosen. */
if ((scancode == 0x11d) && rctrl_is_lalt)
scancode = 0x038;
/* Normal scan code pass through, pass it through as is if
it's not an invalid scan code. */
if (scancode != 0xFFFF)
keyboard_input(!(flags & LLKHF_UP), scancode);
main_window->checkFullscreenHotkey();
}
static LRESULT CALLBACK
emu_LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
{
LPKBDLLHOOKSTRUCT lpKdhs = (LPKBDLLHOOKSTRUCT) lParam;
/* Checks if CTRL was pressed. */
BOOL bCtrlDown = GetAsyncKeyState (VK_CONTROL) >> ((sizeof(SHORT) * 8) - 1);
BOOL is_over_window = (GetForegroundWindow() == ((HWND) main_window->winId()));
if ((GetForegroundWindow() == ((HWND) main_window->winId())) && !(lpKdhs->scanCode & 0xff00))
kbd_handle(lpKdhs->scanCode, lpKdhs->flags);
if (show_second_monitors) for (int monitor_index = 1; monitor_index < MONITORS_NUM; monitor_index++) {
const auto &secondaryRenderer = main_window->renderers[monitor_index];
is_over_window = is_over_window && (secondaryRenderer != nullptr) &&
(GetForegroundWindow() == ((HWND) secondaryRenderer->winId()));
}
if ((nCode < 0) || (nCode != HC_ACTION) || (!mouse_capture && !video_fullscreen))
if ((nCode < 0) || (nCode != HC_ACTION)/* || (!mouse_capture && !video_fullscreen)*/ || !is_over_window)
return CallNextHookEx(NULL, nCode, wParam, lParam);
else if ((lpKdhs->scanCode == 0x01) && (lpKdhs->flags & LLKHF_ALTDOWN) &&
!(lpKdhs->flags & (LLKHF_UP | LLKHF_EXTENDED)))
@@ -480,7 +452,7 @@ main(int argc, char *argv[])
/* Force raw input if a debugger is present. */
if (IsDebuggerPresent()) {
pclog("WARNING: Debugged detected, forcing raw input\n");
raw_input = 1;
hook_enabled = 0;
}
/* Setup raw input */
@@ -547,7 +519,8 @@ main(int argc, char *argv[])
});
#ifdef Q_OS_WINDOWS
if (!raw_input) {
if (hook_enabled) {
/* Yes, low-level hooks *DO* work raw input, at least global ones. */
llhook = SetWindowsHookEx(WH_KEYBOARD_LL, emu_LowLevelKeyboardProc, NULL, 0);
atexit([] () -> void {
if (llhook)

View File

@@ -64,9 +64,7 @@ WindowsRawInputFilter::Register(MainWindow *window)
.hwndTarget = nullptr}
};
if (raw_input && (RegisterRawInputDevices(rid, 2, sizeof(rid[0])) == FALSE))
return std::unique_ptr<WindowsRawInputFilter>(nullptr);
else if (!raw_input && RegisterRawInputDevices(&(rid[1]), 1, sizeof(rid[0])) == FALSE)
if (RegisterRawInputDevices(rid, 2, sizeof(rid[0])) == FALSE)
return std::unique_ptr<WindowsRawInputFilter>(nullptr);
std::unique_ptr<WindowsRawInputFilter> inputfilter(new WindowsRawInputFilter(window));
@@ -97,10 +95,7 @@ WindowsRawInputFilter::~WindowsRawInputFilter()
.hwndTarget = NULL}
};
if (raw_input)
RegisterRawInputDevices(rid, 2, sizeof(rid[0]));
else
RegisterRawInputDevices(&(rid[1]), 1, sizeof(rid[0]));
RegisterRawInputDevices(rid, 2, sizeof(rid[0]));
}
bool

View File

@@ -509,6 +509,9 @@ t128_init(const device_t *info)
if (!t128->bios_enabled && !(info->flags & DEVICE_MCA))
t128->status |= 0x80;
if (info->flags & DEVICE_MCA)
t128->status |= 0x08;
if (info->local == 0)
timer_add(&t128->timer, t128_callback, t128, 0);

File diff suppressed because it is too large Load Diff

View File

@@ -153,6 +153,7 @@ static const SOUND_CARD sound_cards[] = {
{ &ess_soundpiper_32_mca_device },
{ &cmi8338_device },
{ &cmi8738_device },
{ &es1370_device },
{ &es1371_device },
{ &es1373_device },
{ &ct5880_device },