From f2c7d26ec200438466818c13c8efb4fba45b7e25 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 20 Jul 2014 18:03:19 +0300 Subject: [PATCH] 2820b4 --- a2065.cpp | 9 +- a2091.cpp | 455 ++++++++++++++++-- akiko.cpp | 40 +- cfgfile.cpp | 28 +- custom.cpp | 17 +- debug.cpp | 2 +- disk.cpp | 33 +- drawing.cpp | 39 +- expansion.cpp | 191 +++++--- filesys.cpp | 8 + gencpu.cpp | 4 +- gfxboard.cpp | 34 +- include/a2065.h | 2 +- include/a2091.h | 18 +- include/autoconf.h | 1 + include/filesys.h | 7 +- include/fsdb.h | 1 + include/gfxboard.h | 6 +- include/inputdevice.h | 3 +- include/memory.h | 1 + include/ncr_scsi.h | 5 +- include/options.h | 5 + include/rommgr.h | 3 +- include/statusline.h | 15 +- include/uae.h | 1 + include/uaeipc.h | 2 - inputdevice.cpp | 54 ++- main.cpp | 25 +- memory.cpp | 45 +- ncr_scsi.cpp | 196 ++++++-- newcpu.cpp | 6 +- od-win32/direct3d.cpp | 6 +- od-win32/fsdb_mywin32.cpp | 13 + .../genlinetoscr_msvc.vcxproj | 1 + od-win32/parser.cpp | 10 +- od-win32/parser.h | 6 + od-win32/picasso96_win.cpp | 5 +- od-win32/resources/resource.h | 8 +- od-win32/resources/winuae.rc | 53 +- od-win32/serial_win32.cpp | 301 +++++++++--- od-win32/statusline_win32.cpp | 147 ++++++ od-win32/win32.cpp | 72 ++- od-win32/win32.h | 4 +- od-win32/win32_scaler.cpp | 1 + od-win32/win32gfx.cpp | 52 +- od-win32/win32gfx.h | 5 +- od-win32/win32gui.cpp | 206 ++++++-- od-win32/winuae_msvc11/winuae_msvc.vcxproj | 11 +- .../winuae_msvc11/winuae_msvc.vcxproj.filters | 12 +- rommgr.cpp | 12 +- statusline.cpp | 115 +++++ 51 files changed, 1833 insertions(+), 463 deletions(-) create mode 100644 od-win32/statusline_win32.cpp diff --git a/a2065.cpp b/a2065.cpp index 9632cf93..156e7449 100644 --- a/a2065.cpp +++ b/a2065.cpp @@ -884,7 +884,7 @@ static addrbank a2065_bank = { a2065_lgeti, a2065_wgeti, ABFLAG_IO }; -static void a2065_config (void) +static addrbank *a2065_config (void) { memset (config, 0xff, sizeof config); ew (0x00, 0xc0 | 0x01); @@ -927,8 +927,9 @@ static void a2065_config (void) map_banks (&a2065_bank, configured, 0x10000 >> 16, 0x10000); } else { /* KS autoconfig handles the rest */ - map_banks (&a2065_bank, 0xe80000 >> 16, 0x10000 >> 16, 0x10000); + return &a2065_bank; } + return NULL; } uae_u8 *save_a2065 (int *len, uae_u8 *dstptr) @@ -963,8 +964,8 @@ void restore_a2065_finish (void) a2065_config (); } -void a2065_init (void) +addrbank *a2065_init (void) { configured = 0; - a2065_config (); + return a2065_config (); } diff --git a/a2091.cpp b/a2091.cpp index 78e0f322..0a7048d4 100644 --- a/a2091.cpp +++ b/a2091.cpp @@ -2,13 +2,15 @@ * UAE - The Un*x Amiga Emulator * * A590/A2091/A3000/CDTV SCSI expansion (DMAC/SuperDMAC + WD33C93) emulation +* Includes A590 + XT drive emulation. * -* Copyright 2007-2013 Toni Wilen +* Copyright 2007-2014 Toni Wilen * */ #define A2091_DEBUG 0 #define A2091_DEBUG_IO 0 +#define XT_DEBUG 0 #define A3000_DEBUG 0 #define A3000_DEBUG_IO 0 #define WD33C93_DEBUG 0 @@ -52,9 +54,8 @@ #define CNTR_INTEN (1<<4) #define CNTR_DDIR (1<<3) /* ISTR bits. */ -#define ISTR_INTX (1<<8) /* XT/AT Interrupt pending */ #define ISTR_INT_F (1<<7) /* Interrupt Follow */ -#define ISTR_INTS (1<<6) /* SCSI Peripheral Interrupt */ +#define ISTR_INTS (1<<6) /* SCSI or XT Peripheral Interrupt */ #define ISTR_E_INT (1<<5) /* End-Of-Process Interrupt */ #define ISTR_INT_P (1<<4) /* Interrupt Pending */ #define ISTR_UE_INT (1<<3) /* Under-Run FIFO Error Interrupt */ @@ -67,17 +68,29 @@ #define WD_CONTROL 0x01 #define WD_TIMEOUT_PERIOD 0x02 #define WD_CDB_1 0x03 +#define WD_T_SECTORS 0x03 #define WD_CDB_2 0x04 +#define WD_T_HEADS 0x04 #define WD_CDB_3 0x05 +#define WD_T_CYLS_0 0x05 #define WD_CDB_4 0x06 +#define WD_T_CYLS_1 0x06 #define WD_CDB_5 0x07 +#define WD_L_ADDR_0 0x07 #define WD_CDB_6 0x08 +#define WD_L_ADDR_1 0x08 #define WD_CDB_7 0x09 +#define WD_L_ADDR_2 0x09 #define WD_CDB_8 0x0a +#define WD_L_ADDR_3 0x0a #define WD_CDB_9 0x0b +#define WD_SECTOR 0x0b #define WD_CDB_10 0x0c +#define WD_HEAD 0x0c #define WD_CDB_11 0x0d +#define WD_CYL_0 0x0d #define WD_CDB_12 0x0e +#define WD_CYL_1 0x0e #define WD_TARGET_LUN 0x0f #define WD_COMMAND_PHASE 0x10 #define WD_SYNCHRONOUS_TRANSFER 0x11 @@ -120,6 +133,7 @@ /* successful completion interrupts */ #define CSR_RESELECT 0x10 #define CSR_SELECT 0x11 +#define CSR_TRANS_ADDR 0x15 #define CSR_SEL_XFER_DONE 0x16 #define CSR_XFER_DONE 0x18 /* terminated interrupts */ @@ -176,6 +190,48 @@ #define MSG_NOP 0x08 #define MSG_IDENTIFY 0x80 +/* XT hard disk controller registers */ +#define XD_DATA 0x00 /* data RW register */ +#define XD_RESET 0x01 /* reset WO register */ +#define XD_STATUS 0x01 /* status RO register */ +#define XD_SELECT 0x02 /* select WO register */ +#define XD_JUMPER 0x02 /* jumper RO register */ +#define XD_CONTROL 0x03 /* DMAE/INTE WO register */ +#define XD_RESERVED 0x03 /* reserved */ + +/* XT hard disk controller commands (incomplete list) */ +#define XT_CMD_TESTREADY 0x00 /* test drive ready */ +#define XT_CMD_RECALIBRATE 0x01 /* recalibrate drive */ +#define XT_CMD_SENSE 0x03 /* request sense */ +#define XT_CMD_FORMATDRV 0x04 /* format drive */ +#define XT_CMD_VERIFY 0x05 /* read verify */ +#define XT_CMD_FORMATTRK 0x06 /* format track */ +#define XT_CMD_FORMATBAD 0x07 /* format bad track */ +#define XT_CMD_READ 0x08 /* read */ +#define XT_CMD_WRITE 0x0A /* write */ +#define XT_CMD_SEEK 0x0B /* seek */ +/* Controller specific commands */ +#define XT_CMD_DTCSETPARAM 0x0C /* set drive parameters (DTC 5150X & CX only?) */ + +/* Bits for command status byte */ +#define XT_CSB_ERROR 0x02 /* error */ +#define XT_CSB_LUN 0x20 /* logical Unit Number */ + +/* XT hard disk controller status bits */ +#define XT_STAT_READY 0x01 /* controller is ready */ +#define XT_STAT_INPUT 0x02 /* data flowing from controller to host */ +#define XT_STAT_COMMAND 0x04 /* controller in command phase */ +#define XT_STAT_SELECT 0x08 /* controller is selected */ +#define XT_STAT_REQUEST 0x10 /* controller requesting data */ +#define XT_STAT_INTERRUPT 0x20 /* controller requesting interrupt */ + +/* XT hard disk controller control bits */ +#define XT_INT 0x02 /* Interrupt enable */ +#define XT_DMA_MODE 0x01 /* DMA enable */ + +#define XT_UNIT 7 +#define XT_SECTORS 17 /* hardwired */ + static struct wd_state wd_a2091; static struct wd_state wd_a2091_2; static struct wd_state wd_a3000; @@ -199,9 +255,15 @@ static int isirq (struct wd_state *wd) if (!wd->enabled) return 0; if (wd->superdmac) { + if (wd->auxstatus & ASR_INT) + wd->dmac_istr |= ISTR_INTS; if ((wd->dmac_cntr & SCNTR_INTEN) && (wd->dmac_istr & (ISTR_INTS | ISTR_E_INT))) return 1; } else { + if (wd->xt_irq) + wd->dmac_istr |= ISTR_INTS; + if (wd->auxstatus & ASR_INT) + wd->dmac_istr |= ISTR_INTS; if ((wd->dmac_cntr & CNTR_INTEN) && (wd->dmac_istr & (ISTR_INTS | ISTR_E_INT))) return 1; } @@ -220,17 +282,25 @@ void rethink_a2091 (void) } } -static void INT2 (struct wd_state *wd) +static void dmac_scsi_int(struct wd_state *wd) { if (!wd->enabled) return; if (!(wd->auxstatus & ASR_INT)) return; - wd->dmac_istr |= ISTR_INTS; if (isirq (wd)) uae_int_requested |= 2; } +static void dmac_xt_int(struct wd_state *wd) +{ + if (!wd->enabled) + return; + wd->xt_irq = true; + if (isirq(wd)) + uae_int_requested |= 2; +} + void scsi_dmac_start_dma (struct wd_state *wd) { #if A3000_DEBUG > 0 || A2091_DEBUG > 0 @@ -283,7 +353,7 @@ static void doscsistatus (struct wd_state *wd, uae_u8 status) cdtv_scsi_int (); return; } - INT2(wd); + dmac_scsi_int(wd); #if A2091_DEBUG > 2 || A3000_DEBUG > 2 write_log (_T("Interrupt\n")); #endif @@ -722,22 +792,6 @@ static void wd_cmd_trans_info (struct wd_state *wd) settc (wd, 1); wd->wd_dataoffset = 0; - -// if (wd->wdregs[WD_COMMAND_PHASE] >= 0x36 && wd->wdregs[WD_COMMAND_PHASE] <= 0x3f) { -// wd->wdregs[WD_COMMAND_PHASE] = 0x45; -// } else if (wd->wdregs[WD_COMMAND_PHASE] == 0x41) { -// wd->wdregs[WD_COMMAND_PHASE] = 0x46; -// } - -#if 0 - if (wd->wdregs[WD_COMMAND_PHASE] >= 0x40 && wd->scsi->direction < 0) { - if (wd->wd_tc > wd->scsi->data_len) { - wd->wd_tc = wd->scsi->data_len; - if (wd->wd_tc < 0) - wd->wd_tc = 0; - } - } -#endif if (wd->wdregs[WD_COMMAND_PHASE] == 0x30) { wd->scsi->direction = 2; // command wd->scsi->cmd_len = wd->scsi->data_len = gettc (wd); @@ -769,6 +823,40 @@ static void wd_cmd_trans_info (struct wd_state *wd) } +/* Weird stuff, XT driver (which has nothing to do with SCSI or WD33C93) uses this WD33C93 command! */ +static void wd_cmd_trans_addr(struct wd_state *wd) +{ + uae_u32 tcyls = (wd->wdregs[WD_T_CYLS_0] << 8) | wd->wdregs[WD_T_CYLS_1]; + uae_u32 theads = wd->wdregs[WD_T_HEADS]; + uae_u32 tsectors = wd->wdregs[WD_T_SECTORS]; + uae_u32 lba = (wd->wdregs[WD_L_ADDR_0] << 24) | (wd->wdregs[WD_L_ADDR_1] << 16) | + (wd->wdregs[WD_L_ADDR_2] << 8) | (wd->wdregs[WD_L_ADDR_3] << 0); + uae_u32 cyls, heads, sectors; + + cyls = lba / (theads * tsectors); + heads = (lba - ((cyls * theads * tsectors))) / tsectors; + sectors = (lba - ((cyls * theads * tsectors))) % tsectors; + + //write_log(_T("WD TRANS ADDR: LBA=%d TC=%d TH=%d TS=%d -> C=%d H=%d S=%d\n"), lba, tcyls, theads, tsectors, cyls, heads, sectors); + + wd->wdregs[WD_CYL_0] = cyls >> 8; + wd->wdregs[WD_CYL_1] = cyls; + wd->wdregs[WD_HEAD] = heads; + wd->wdregs[WD_SECTOR] = sectors; + + // This is cheating, sector value hardwired on MFM drives. This hack allows to mount hardfiles + // that are created using incompatible geometry. (XT MFM/RLL drives have real physical geometry) + if (wd->xt_sectors != tsectors && wd->scsis[XT_UNIT]) { + write_log(_T("XT drive sector value patched from %d to %d\n"), wd->xt_sectors, tsectors); + wd->xt_sectors = tsectors; + } + + if (cyls >= tcyls) + set_status(wd, CSR_BAD_STATUS); + else + set_status(wd, CSR_TRANS_ADDR); +} + static void wd_cmd_sel (struct wd_state *wd, bool atn) { #if WD33C93_DEBUG > 0 @@ -778,7 +866,7 @@ static void wd_cmd_sel (struct wd_state *wd, bool atn) wd->wdregs[WD_COMMAND_PHASE] = 0; wd->scsi = wd->scsis[wd->wdregs[WD_DESTINATION_ID] & 7]; - if (!wd->scsi) { + if (!wd->scsi || (wd->wdregs[WD_DESTINATION_ID] & 7) == 7) { #if WD33C93_DEBUG > 0 write_log (_T("%s no drive\n"), WD33C93); #endif @@ -832,8 +920,11 @@ static void wd_cmd_abort (struct wd_state *wd) #endif } +static void xt_command_done(struct wd_state *wd); + static void scsi_hsync2 (struct wd_state *wd) { + bool irq = false; if (!wd->enabled) return; if (wd->wd_data_avail < 0 && wd->dmac_dma > 0) { @@ -854,6 +945,13 @@ static void scsi_hsync2 (struct wd_state *wd) wd->dmac_dma = -1; } } + if (wd->dmac_dma > 0 && (wd->xt_status & (XT_STAT_INPUT | XT_STAT_REQUEST))) { + wd->scsi = wd->scsis[XT_UNIT]; + if (do_dma(wd)) { + xt_command_done(wd); + } + } + if (wd->auxstatus & ASR_INT) return; for (int i = 0; i < WD_STATUS_QUEUE; i++) { @@ -948,7 +1046,7 @@ void wdscsi_put (struct wd_state *wd, uae_u8 d) } } else if (wd->sasr == WD_COMMAND) { wd->wd_busy = true; - write_comm_pipe_u32 (&wd->requests, makecmd (wd->scsi, 0, d), 1); + write_comm_pipe_u32(&wd->requests, makecmd(wd->scsis[wd->wdregs[WD_DESTINATION_ID] & 7], 0, d), 1); if (wd->scsi && wd->scsi->cd_emu_unit >= 0) gui_flicker_led (LED_CD, wd->scsi->id, 1); } @@ -1015,6 +1113,254 @@ uae_u8 wdscsi_get (struct wd_state *wd) return v; } +/* XT */ + +static void xt_default_geometry(struct wd_state *wd) +{ + wd->xt_cyls = wd->scsi->hfd->cyls > 1023 ? 1023 : wd->scsi->hfd->cyls; + wd->xt_heads = wd->scsi->hfd->heads > 31 ? 31 : wd->scsi->hfd->heads; +} + + +static void xt_set_status(struct wd_state *wd, uae_u8 state) +{ + wd->xt_status = state; + wd->xt_status |= XT_STAT_SELECT; + wd->xt_status |= XT_STAT_READY; +} + +static void xt_reset(struct wd_state *wd) +{ + wd->scsi = wd->scsis[XT_UNIT]; + if (!wd->scsi) + return; + wd->xt_control = 0; + wd->xt_datalen = 0; + wd->xt_status = 0; + xt_default_geometry(wd); + write_log(_T("XT reset\n")); +} + +static void xt_command_done(struct wd_state *wd) +{ + switch (wd->xt_cmd[0]) + { + case XT_CMD_DTCSETPARAM: + wd->xt_heads = wd->scsi->buffer[2] & 0x1f; + wd->xt_cyls = ((wd->scsi->buffer[0] & 3) << 8) | (wd->scsi->buffer[1]); + wd->xt_sectors = XT_SECTORS; + if (!wd->xt_heads || !wd->xt_cyls) + xt_default_geometry(wd); + write_log(_T("XT SETPARAM: cyls=%d heads=%d\n"), wd->xt_cyls, wd->xt_heads); + break; + case XT_CMD_WRITE: + scsi_emulate_cmd(wd->scsi); + break; + + } + + xt_set_status(wd, XT_STAT_INTERRUPT); + if (wd->xt_control & XT_INT) + dmac_xt_int(wd); + wd->xt_datalen = 0; + wd->xt_statusbyte = 0; +#if XT_DEBUG > 0 + write_log(_T("XT command %02x done\n"), wd->xt_cmd[0]); +#endif +} + +static void xt_wait_data(struct wd_state *wd, int len) +{ + xt_set_status(wd, XT_STAT_REQUEST); + wd->xt_offset = 0; + wd->xt_datalen = len; +} + +static void xt_sense(struct wd_state *wd) +{ + wd->xt_datalen = 4; + wd->xt_offset = 0; + memset(wd->scsi->buffer, 0, wd->xt_datalen); +} + +static void xt_readwrite(struct wd_state *wd, int rw) +{ + struct scsi_data *scsi = wd->scsis[XT_UNIT]; + int transfer_len; + uae_u32 lba; + // 1 = head + // 2 = bits 6,7: cyl high, bits 0-5: sectors + // 3 = cyl (low) + // 4 = transfer count + lba = ((wd->xt_cmd[3] | ((wd->xt_cmd[2] << 2) & 0x300))) * (wd->xt_heads * wd->xt_sectors) + + (wd->xt_cmd[1] & 0x1f) * wd->xt_sectors + + (wd->xt_cmd[2] & 0x3f); + + wd->scsi = scsi; + wd->xt_offset = 0; + transfer_len = wd->xt_cmd[4] == 0 ? 256 : wd->xt_cmd[4]; + wd->xt_datalen = transfer_len * 512; + +#if XT_DEBUG > 0 + write_log(_T("XT %s block %d, %d\n"), rw ? _T("WRITE") : _T("READ"), lba, transfer_len); +#endif + + scsi->cmd[0] = rw ? 0x0a : 0x08; /* WRITE(6) / READ (6) */ + scsi->cmd[1] = lba >> 16; + scsi->cmd[2] = lba >> 8; + scsi->cmd[3] = lba >> 0; + scsi->cmd[4] = transfer_len; + scsi->cmd[5] = 0; + scsi_emulate_analyze(wd->scsi); + if (rw) { + wd->scsi->direction = 1; + xt_set_status(wd, XT_STAT_REQUEST); + } else { + wd->scsi->direction = -1; + scsi_emulate_cmd(scsi); + xt_set_status(wd, XT_STAT_INPUT); + } + scsi_start_transfer(scsi); + settc(wd, scsi->data_len); + + if (!(wd->xt_control & XT_DMA_MODE)) + xt_command_done(wd); +} + +static void xt_command(struct wd_state *wd) +{ + wd->scsi = wd->scsis[XT_UNIT]; + switch(wd->xt_cmd[0]) + { + case XT_CMD_READ: + xt_readwrite(wd, 0); + break; + case XT_CMD_WRITE: + xt_readwrite(wd, 1); + break; + case XT_CMD_SEEK: + xt_command_done(wd); + break; + case XT_CMD_VERIFY: + xt_command_done(wd); + break; + case XT_CMD_FORMATBAD: + case XT_CMD_FORMATTRK: + xt_command_done(wd); + break; + case XT_CMD_TESTREADY: + xt_command_done(wd); + break; + case XT_CMD_RECALIBRATE: + xt_command_done(wd); + break; + case XT_CMD_SENSE: + xt_sense(wd); + break; + case XT_CMD_DTCSETPARAM: + xt_wait_data(wd, 8); + break; + default: + write_log(_T("XT unknown command %02X\n"), wd->xt_cmd[0]); + xt_command_done(wd); + wd->xt_status |= XT_STAT_INPUT; + wd->xt_datalen = 1; + wd->xt_statusbyte = XT_CSB_ERROR; + break; + } +} + +static uae_u8 read_xt_reg(struct wd_state *wd, int reg) +{ + uae_u8 v = 0xff; + + wd->scsi = wd->scsis[XT_UNIT]; + if (!wd->scsi) + return v; + + switch(reg) + { + case XD_DATA: + if (wd->xt_status & XT_STAT_INPUT) { + v = wd->scsi->buffer[wd->xt_offset]; + wd->xt_offset++; + if (wd->xt_offset >= wd->xt_datalen) { + xt_command_done(wd); + } + } else { + v = wd->xt_statusbyte; + } + break; + case XD_STATUS: + v = wd->xt_status; + break; + case XD_JUMPER: + // 20M: 0 40M: 2, xt.device checks it. + v = wd->scsi->hfd->size >= 41615 * 2 * 512 ? 2 : 0; + break; + case XD_RESERVED: + break; + } +#if XT_DEBUG > 2 + write_log(_T("XT read %d: %02X\n"), reg, v); +#endif + return v; +} + +static void write_xt_reg(struct wd_state *wd, int reg, uae_u8 v) +{ + wd->scsi = wd->scsis[XT_UNIT]; + if (!wd->scsi) + return; + +#if XT_DEBUG > 2 + write_log(_T("XT write %d: %02X\n"), reg, v); +#endif + + switch (reg) + { + case XD_DATA: +#if XT_DEBUG > 1 + write_log(_T("XT data write %02X\n"), v); +#endif + if (!(wd->xt_status & XT_STAT_REQUEST)) { + wd->xt_offset = 0; + xt_set_status(wd, XT_STAT_COMMAND | XT_STAT_REQUEST); + } + if (wd->xt_status & XT_STAT_REQUEST) { + if (wd->xt_status & XT_STAT_COMMAND) { + wd->xt_cmd[wd->xt_offset++] = v; + xt_set_status(wd, XT_STAT_COMMAND | XT_STAT_REQUEST); + if (wd->xt_offset == 6) { + xt_command(wd); + } + } else { + wd->scsi->buffer[wd->xt_offset] = v; + wd->xt_offset++; + if (wd->xt_offset >= wd->xt_datalen) { + xt_command_done(wd); + } + } + } + break; + case XD_RESET: + xt_reset(wd); + break; + case XD_SELECT: +#if XT_DEBUG > 1 + write_log(_T("XT select %02X\n"), v); +#endif + xt_set_status(wd, XT_STAT_SELECT); + break; + case XD_CONTROL: + wd->xt_control = v; + wd->xt_irq = 0; + break; + } +} + +/* DMAC */ + static uae_u32 dmac_read_word (struct wd_state *wd, uaecptr addr) { uae_u32 v = 0; @@ -1037,7 +1383,7 @@ static uae_u32 dmac_read_word (struct wd_state *wd, uaecptr addr) { case 0x40: v = wd->dmac_istr; - if (v) + if (v && (wd->dmac_cntr & CNTR_INTEN)) v |= ISTR_INT_P; wd->dmac_istr &= ~0xf; break; @@ -1055,15 +1401,9 @@ static uae_u32 dmac_read_word (struct wd_state *wd, uaecptr addr) case 0xc0: v = 0xf8 | (1 << 0) | (1 << 1) | (1 << 2); // bits 0-2 = dip-switches break; - /* XT IO */ - case 0xa0: - case 0xa2: - case 0xa4: - case 0xa6: case 0xc2: case 0xc4: case 0xc6: - write_log(_T("READ XT IO %02x PC=%08x\n"), addr, M68K_GETPC); v = 0xffff; break; case 0xe0: @@ -1113,6 +1453,12 @@ static uae_u32 dmac_read_byte (struct wd_state *wd, uaecptr addr) case 0x93: v = wdscsi_get (wd); break; + case 0xa1: + case 0xa3: + case 0xa5: + case 0xa7: + v = read_xt_reg(wd, (addr - 0xa0) / 2); + break; default: v = dmac_read_word (wd, addr); if (!(addr & 1)) @@ -1166,14 +1512,9 @@ static void dmac_write_word (struct wd_state *wd, uaecptr addr, uae_u32 b) wd->dmac_dawr = b; break; break; - case 0xa0: - case 0xa2: - case 0xa4: - case 0xa6: case 0xc2: case 0xc4: case 0xc6: - write_log(_T("WRITE XT IO %02x = %04x PC=%08x\n"), addr, b, M68K_GETPC); break; case 0xe0: if (wd->dmac_dma <= 0) @@ -1211,6 +1552,12 @@ static void dmac_write_byte (struct wd_state *wd, uaecptr addr, uae_u32 b) case 0x93: wdscsi_put (wd, b); break; + case 0xa1: + case 0xa3: + case 0xa5: + case 0xa7: + write_xt_reg(wd, (addr - 0xa0) / 2, b); + break; default: if (addr & 1) dmac_write_word (wd, addr, b); @@ -1696,6 +2043,7 @@ static void *scsi_thread (void *wdv) int cmd = v & 0x7f; int msg = (v >> 8) & 0xff; int unit = (v >> 24) & 0xff; + wd->scsi = wd->scsis[unit]; //write_log (_T("scsi_thread got msg=%d cmd=%d\n"), msg, cmd); if (msg == 0) { if (WD33C93_DEBUG > 0) @@ -1723,6 +2071,9 @@ static void *scsi_thread (void *wdv) case WD_CMD_TRANS_INFO: wd_cmd_trans_info (wd); break; + case WD_CMD_TRANS_ADDR: + wd_cmd_trans_addr(wd); + break; default: wd->wd_busy = false; write_log (_T("%s unimplemented/unknown command %02X\n"), WD33C93, cmd); @@ -1797,7 +2148,7 @@ int add_wd_scsi_tape (struct wd_state *wd, int ch, const TCHAR *tape_directory, static void freenativescsi (struct wd_state *wd) { int i; - for (i = 0; i < 7; i++) { + for (i = 0; i < 8; i++) { freescsi (wd->scsis[i]); wd->scsis[i] = NULL; } @@ -1886,15 +2237,16 @@ void a3000scsi_free (void) } } -int a2091_add_scsi_unit (int ch, struct uaedev_config_info *ci, int devnum) +int a2091_add_scsi_unit(int ch, struct uaedev_config_info *ci, int devnum) { struct wd_state *wd = wda2091[devnum]; + if (ci->type == UAEDEV_CD) - return add_wd_scsi_cd (wd, ch, ci->device_emu_unit); + return add_wd_scsi_cd(wd, ch, ci->device_emu_unit); else if (ci->type == UAEDEV_TAPE) - return add_wd_scsi_tape (wd, ch, ci->rootdir, ci->readonly); + return add_wd_scsi_tape(wd, ch, ci->rootdir, ci->readonly); else - return add_wd_scsi_hd (wd, ch, NULL, ci, 1); + return add_wd_scsi_hd(wd, ch, NULL, ci, 1); } void a2091_free_device (struct wd_state *wd) @@ -1923,6 +2275,7 @@ static void a2091_reset_device(struct wd_state *wd) wd->name = _T("A2091/A590"); if (wd == &wd_a2091_2) wd->name = _T("A2091/A590 #2"); + xt_reset(wd); } void a2091_reset (void) @@ -1931,7 +2284,7 @@ void a2091_reset (void) a2091_reset_device(&wd_a2091_2); } -void a2091_init (int devnum) +addrbank *a2091_init (int devnum) { struct wd_state *wd = wda2091[devnum]; int roms[6]; @@ -1940,7 +2293,7 @@ void a2091_init (int devnum) if (devnum > 0 && !wd->enabled) { expamem_next(); - return; + return NULL; } init_scsi(wd); @@ -2003,7 +2356,7 @@ void a2091_init (int devnum) romwarning (roms); } } - map_banks (wd == &wd_a2091 ? &dmaca2091_bank : &dmaca2091_2_bank, 0xe80000 >> 16, 0x10000 >> 16, 0x10000); + return wd == &wd_a2091 ? &dmaca2091_bank : &dmaca2091_2_bank; } uae_u8 *save_scsi_dmac (int wdtype, int *len, uae_u8 *dstptr) @@ -2081,6 +2434,13 @@ uae_u8 *save_scsi_device (int wdtype, int num, int *len, uae_u8 *dstptr) save_u32 (s->hfd->hfd.ci.reserved); save_u32 (s->hfd->hfd.ci.bootpri); save_u32 (s->hfd->ansi_version); + if (num == 7) { + save_u16(wd->xt_cyls); + save_u16(wd->xt_heads); + save_u16(wd->xt_sectors); + save_u8(wd->xt_status); + save_u8(wd->xt_control); + } break; case UAEDEV_CD: save_u32 (s->cd_emu_unit); @@ -2131,6 +2491,13 @@ uae_u8 *restore_scsi_device (int wdtype, uae_u8 *src) s->hfd->hfd.ci.bootpri = restore_u32 (); s->hfd->ansi_version = restore_u32 (); s->hfd->hfd.ci.blocksize = blocksize; + if (num == 7) { + wd->xt_cyls = restore_u16(); + wd->xt_heads = restore_u8(); + wd->xt_sectors = restore_u8(); + wd->xt_status = restore_u8(); + wd->xt_control = restore_u8(); + } if (size) add_wd_scsi_hd (wd, num, hfd, NULL, s->hfd->ansi_version); xfree (path); diff --git a/akiko.cpp b/akiko.cpp index 284946d7..d6586571 100644 --- a/akiko.cpp +++ b/akiko.cpp @@ -462,7 +462,6 @@ static int cdrom_command_length; static int cdrom_checksum_error, cdrom_unknown_command; static int cdrom_data_offset, cdrom_speed, cdrom_sector_counter; static int cdrom_current_sector, cdrom_seek_delay; -static int cdrom_data_end; static int cdrom_audiotimeout; static int cdrom_led; static int cdrom_receive_length, cdrom_receive_offset; @@ -722,7 +721,6 @@ static int get_cdrom_toc (void) if (!sys_command_cd_toc (unitnum, &cdrom_toc_cd_buffer)) return 1; memset (cdrom_toc_buffer, 0, MAX_TOC_ENTRIES * 13); - cdrom_data_end = -1; for (j = 0; j < cdrom_toc_cd_buffer.points; j++) { struct cd_toc *s = &cdrom_toc_cd_buffer.toc[j]; uae_u8 *d = &cdrom_toc_buffer[j * 13]; @@ -741,14 +739,22 @@ static int get_cdrom_toc (void) secondtrack = addr; } cdrom_toc_crc = get_crc32 (cdrom_toc_buffer, cdrom_toc_cd_buffer.points * 13); - if (datatrack) { - if (secondtrack) - cdrom_data_end = secondtrack; - else - cdrom_data_end = cdrom_toc_cd_buffer.lastaddress; - } return 0; } +static bool is_valid_data_sector(int sector) +{ + for (int i = 0; i < cdrom_toc_cd_buffer.points; i++) { + struct cd_toc *s = &cdrom_toc_cd_buffer.toc[i]; + if (s->point < 1 || s->point > 99) + continue; + if ((s->control & 0x0c) != 4) + continue; + if (sector >= s->paddress && (sector < s[1].paddress || s[1].point >= 0xa1)) + return true; + } + return false; +} + /* open device */ static int sys_cddev_open (void) @@ -1439,24 +1445,29 @@ static void *akiko_thread (void *null) if (sector_buffer_info_1[i] == 0xff) break; } - if (cdrom_data_end > 0 && sector >= 0 && + if (sector >= 0 && is_valid_data_sector(sector) && (sector_buffer_sector_1 < 0 || sector < sector_buffer_sector_1 || sector >= sector_buffer_sector_1 + SECTOR_BUFFER_SIZE * 2 / 3 || i != SECTOR_BUFFER_SIZE)) { int blocks; memset (sector_buffer_info_2, 0, SECTOR_BUFFER_SIZE); #if AKIKO_DEBUG_IO_CMD - write_log (_T("filling buffer sector=%d (max=%d)\n"), sector, cdrom_data_end); + write_log (_T("filling buffer sector=%d\n"), sector); #endif sector_buffer_sector_2 = sector; - if (sector + SECTOR_BUFFER_SIZE >= cdrom_data_end) - blocks = cdrom_data_end - sector; - else + if (!is_valid_data_sector(sector + SECTOR_BUFFER_SIZE)) { + for (blocks = SECTOR_BUFFER_SIZE; blocks > 0; blocks--) { + if (is_valid_data_sector(sector + blocks)) + break; + } + } else { blocks = SECTOR_BUFFER_SIZE; + } + if (blocks) { int ok = sys_command_cd_rawread (unitnum, sector_buffer_2, sector, blocks, 2352); if (!ok) { int offset = 0; while (offset < SECTOR_BUFFER_SIZE) { int ok = 0; - if (sector < cdrom_data_end) + if (is_valid_data_sector(sector)) ok = sys_command_cd_rawread (unitnum, sector_buffer_2 + offset * 2352, sector, 1, 2352); sector_buffer_info_2[offset] = ok ? 3 : 0; offset++; @@ -1475,6 +1486,7 @@ static void *akiko_thread (void *null) tmp3 = sector_buffer_sector_1; sector_buffer_sector_1 = sector_buffer_sector_2; sector_buffer_sector_2 = tmp3; + } } uae_sem_post (&akiko_sem); sleep_millis (10); diff --git a/cfgfile.cpp b/cfgfile.cpp index 5f051d28..99fb6086 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -205,6 +205,7 @@ static const TCHAR *rtgtype[] = { _T("Spectrum28/24_Z2"), _T("Spectrum28/24_Z3"), _T("PicassoIV_Z2"), _T("PicassoIV_Z3"), 0 }; +static const TCHAR *cpuboards[] = { _T("none"), _T("Blizzard1230IV"), _T("Blizzard1260"), _T("Blizzard2060"), _T("WarpEngineA4000"), NULL }; static const TCHAR *waitblits[] = { _T("disabled"), _T("automatic"), _T("noidleonly"), _T("always"), 0 }; static const TCHAR *autoext2[] = { _T("disabled"), _T("copy"), _T("replace"), 0 }; static const TCHAR *leds[] = { _T("power"), _T("df0"), _T("df1"), _T("df2"), _T("df3"), _T("hd"), _T("cd"), _T("fps"), _T("cpu"), _T("snd"), _T("md"), 0 }; @@ -213,7 +214,8 @@ static const TCHAR *lacer[] = { _T("off"), _T("i"), _T("p"), 0 }; static const TCHAR *hdcontrollers[] = { _T("uae"), _T("ide%d"), - _T("scsi%d"), _T("scsi%d_a2091"), _T("scsi%d_a2091-2"), _T("scsi%d_a4091"), _T("scsi%d_a4091-2"), _T("scsi%d_a3000"), _T("scsi%d_a4000t"), _T("scsi%d_cdtv"), + _T("scsi%d"), _T("scsi%d_a2091"), _T("scsi%d_a2091-2"), _T("scsi%d_a4091"), _T("scsi%d_a4091-2"), + _T("scsi%d_a3000"), _T("scsi%d_a4000t"), _T("scsi%d_cdtv"), _T("scsi%d_warpengine"), _T("scsram"), _T("scide") }; static const TCHAR *obsolete[] = { @@ -1431,10 +1433,13 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_write (f, _T("z3mem_size"), _T("%d"), p->z3fastmem_size / 0x100000); cfgfile_dwrite (f, _T("z3mem2_size"), _T("%d"), p->z3fastmem2_size / 0x100000); cfgfile_write (f, _T("z3mem_start"), _T("0x%x"), p->z3fastmem_start); - cfgfile_write (f, _T("bogomem_size"), _T("%d"), p->bogomem_size / 0x40000); - cfgfile_write (f, _T("gfxcard_size"), _T("%d"), p->rtgmem_size / 0x100000); - cfgfile_write_str (f, _T("gfxcard_type"), rtgtype[p->rtgmem_type]); - cfgfile_write_bool (f, _T("gfxcard_hardware_vblank"), p->rtg_hardwareinterrupt); + cfgfile_write(f, _T("bogomem_size"), _T("%d"), p->bogomem_size / 0x40000); + cfgfile_dwrite_str(f, _T("cpuboard_type"), cpuboards[p->cpuboard_type]); + cfgfile_dwrite(f, _T("cpuboardmem1_size"), _T("%d"), p->cpuboardmem1_size / 0x100000); + cfgfile_dwrite(f, _T("cpuboardmem2_size"), _T("%d"), p->cpuboardmem2_size / 0x100000); + cfgfile_write(f, _T("gfxcard_size"), _T("%d"), p->rtgmem_size / 0x100000); + cfgfile_write_str(f, _T("gfxcard_type"), rtgtype[p->rtgmem_type]); + cfgfile_write_bool(f, _T("gfxcard_hardware_vblank"), p->rtg_hardwareinterrupt); cfgfile_write_bool (f, _T("gfxcard_hardware_sprite"), p->rtg_hardwaresprite); cfgfile_write (f, _T("chipmem_size"), _T("%d"), p->chipmem_size == 0x20000 ? -1 : (p->chipmem_size == 0x40000 ? 0 : p->chipmem_size / 0x80000)); cfgfile_dwrite (f, _T("megachipmem_size"), _T("%d"), p->z3chipmem_size / 0x100000); @@ -3032,6 +3037,8 @@ static void get_filesys_controller (const TCHAR *hdc, int *type, int *num) hdcv = HD_CONTROLLER_TYPE_SCSI_A4000T; if (!_tcsicmp(ext, _T("cdtv"))) hdcv = HD_CONTROLLER_TYPE_SCSI_CDTV; + if (!_tcsicmp(ext, _T("warpengine"))) + hdcv = HD_CONTROLLER_TYPE_SCSI_WARPENGINE; } } else if (_tcslen (hdc) >= 6 && !_tcsncmp (hdc, _T("scsram"), 6)) { hdcv = HD_CONTROLLER_TYPE_PCMCIA_SRAM; @@ -3577,8 +3584,10 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, const TCHAR *option, TCH || cfgfile_intval (option, value, _T("fatgary"), &p->cs_fatgaryrev, 1) || cfgfile_intval (option, value, _T("ramsey"), &p->cs_ramseyrev, 1) || cfgfile_doubleval (option, value, _T("chipset_refreshrate"), &p->chipset_refreshrate) - || cfgfile_intval (option, value, _T("fastmem_size"), &p->fastmem_size, 0x100000) - || cfgfile_intval (option, value, _T("fastmem_size_k"), &p->fastmem_size, 1024) + || cfgfile_intval(option, value, _T("cpuboardmem1_size"), &p->cpuboardmem1_size, 0x100000) + || cfgfile_intval(option, value, _T("cpuboardmem2_size"), &p->cpuboardmem2_size, 0x100000) + || cfgfile_intval(option, value, _T("fastmem_size"), &p->fastmem_size, 0x100000) + || cfgfile_intval(option, value, _T("fastmem_size_k"), &p->fastmem_size, 1024) || cfgfile_intval (option, value, _T("fastmem2_size"), &p->fastmem2_size, 0x100000) || cfgfile_intval (option, value, _T("fastmem2_size_k"), &p->fastmem2_size, 1024) || cfgfile_intval (option, value, _T("a3000mem_size"), &p->mbresmem_low_size, 0x100000) @@ -3589,8 +3598,9 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, const TCHAR *option, TCH || cfgfile_intval (option, value, _T("z3mem_start"), &p->z3fastmem_start, 1) || cfgfile_intval (option, value, _T("bogomem_size"), &p->bogomem_size, 0x40000) || cfgfile_intval (option, value, _T("gfxcard_size"), &p->rtgmem_size, 0x100000) - || cfgfile_strval (option, value, _T("gfxcard_type"), &p->rtgmem_type, rtgtype, 0) - || cfgfile_intval (option, value, _T("rtg_modes"), &p->picasso96_modeflags, 1) + || cfgfile_strval(option, value, _T("gfxcard_type"), &p->rtgmem_type, rtgtype, 0) + || cfgfile_strval(option, value, _T("cpuboard_type"), &p->cpuboard_type, cpuboards, 0) + || cfgfile_intval(option, value, _T("rtg_modes"), &p->picasso96_modeflags, 1) || cfgfile_intval (option, value, _T("floppy_speed"), &p->floppy_speed, 1) || cfgfile_intval (option, value, _T("floppy_write_length"), &p->floppy_write_length, 1) || cfgfile_intval (option, value, _T("floppy_random_bits_min"), &p->floppy_random_bits_min, 1) diff --git a/custom.cpp b/custom.cpp index 78a19687..0d782dc1 100644 --- a/custom.cpp +++ b/custom.cpp @@ -59,10 +59,12 @@ #include "blkdev.h" #include "sampler.h" #include "clipboard.h" +#include "cpuboard.h" #ifdef RETROPLATFORM #include "rp.h" #endif #include "luascript.h" +#include "statusline.h" #define CUSTOM_DEBUG 0 #define SPRITE_DEBUG 0 @@ -76,6 +78,8 @@ #define SPRBORDER 0 +extern uae_u16 serper; + STATIC_INLINE bool nocustom (void) { if (picasso_on && currprefs.picasso96_nocustom) @@ -7074,6 +7078,8 @@ static void vsync_handler_pre (void) #ifdef CD32 cd32_fmv_vsync_handler(); #endif + cpuboard_vsync(); + statusline_vsync(); if (!vsync_rendered) { frame_time_t start, end; @@ -8108,6 +8114,9 @@ void custom_reset (bool hardreset, bool keyboardreset) CLXCON (clxcon); CLXCON2 (clxcon2); calcdiw (); + v = serper; + serper = 0; + SERPER(v); for (i = 0; i < 8; i++) { SPRxCTLPOS (i); nr_armed += spr[i].armed != 0; @@ -8773,7 +8782,7 @@ uae_u8 *restore_custom (uae_u8 *src) RW; /* 02C VHPOSW */ COPCON (RW); /* 02E COPCON */ RW; /* 030 SERDAT* */ - RW; /* 032 SERPER* */ + serper = RW; /* 032 SERPER* */ potgo_value = 0; POTGO (RW); /* 034 POTGO */ RW; /* 036 JOYTEST* */ RW; /* 038 STREQU */ @@ -8889,8 +8898,6 @@ uae_u8 *restore_custom (uae_u8 *src) #define SW save_u16 #define SL save_u32 -extern uae_u16 serper; - uae_u8 *save_custom (int *len, uae_u8 *dstptr, int full) { uae_u8 *dstbak, *dst; @@ -8929,8 +8936,8 @@ uae_u8 *save_custom (int *len, uae_u8 *dstptr, int full) SW ((lof_store ? 0x8001 : 0) | (lol ? 0x0080 : 0));/* 02A VPOSW */ SW (0); /* 02C VHPOSW */ SW (copcon); /* 02E COPCON */ - SW (serper); /* 030 SERDAT * */ - SW (serdat); /* 032 SERPER * */ + SW (serdat); /* 030 SERDAT * */ + SW (serper); /* 032 SERPER * */ SW (potgo_value); /* 034 POTGO */ SW (0); /* 036 JOYTEST * */ SW (0); /* 038 STREQU */ diff --git a/debug.cpp b/debug.cpp index 9e91c9e9..ce529629 100644 --- a/debug.cpp +++ b/debug.cpp @@ -2930,7 +2930,7 @@ static void memory_map_dump_2 (int log) size = (i - j) << (16 - 10); size_out = size; size_ext = 'K'; - if (j >= 256) { + if (j >= 256 && size_out >= 1024) { size_out /= 1024; size_ext = 'M'; } diff --git a/disk.cpp b/disk.cpp index 596417db..6c2edbf8 100644 --- a/disk.cpp +++ b/disk.cpp @@ -54,6 +54,7 @@ int disk_debug_track = -1; #include "rp.h" #endif #include "fsdb.h" +#include "statusline.h" #undef CATWEASEL @@ -179,6 +180,7 @@ typedef struct { int trackspeed; int num_tracks, write_num_tracks, num_secs; int hard_num_cyls; + bool dskeject; bool dskchange; int dskchange_time; bool dskready; @@ -635,9 +637,9 @@ static void drive_image_free (drive *drv) } drv->filetype = ADF_NONE; zfile_fclose (drv->diskfile); - drv->diskfile = 0; + drv->diskfile = NULL; zfile_fclose (drv->writediskfile); - drv->writediskfile = 0; + drv->writediskfile = NULL; } static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR *fname, bool fake, bool writeprotected); @@ -981,6 +983,8 @@ static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR drv->tracktiming[0] = 0; drv->useturbo = 0; drv->indexoffset = 0; + if (!fake) + drv->dskeject = false; gui_disk_image_change (dnum, fname, drv->wrprot); @@ -1247,6 +1251,7 @@ static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR #endif update_drive_gui (drv - floppy, false); } + statusline_add_message(_T("DF%d: %s"), drv - floppy, my_getfilepart(fname)); return 1; } @@ -2294,8 +2299,11 @@ static void drive_eject (drive * drv) if (isfloppysound (drv)) driveclick_insert (drv - floppy, 1); #endif - gui_disk_image_change (drv - floppy, NULL, drv->wrprot); + if (drv->diskfile || drv->filetype) + statusline_add_message(_T("DF%d: -"), drv - floppy); + gui_disk_image_change(drv - floppy, NULL, drv->wrprot); drive_image_free (drv); + drv->dskeject = false; drv->dskchange = true; drv->ddhd = 1; drv->dskchange_time = 0; @@ -2632,7 +2640,8 @@ static void disk_insert_2 (int num, const TCHAR *name, bool forced, bool forcedw } if (!_tcscmp (currprefs.floppyslots[num].df, name)) return; - _tcscpy (drv->newname, name); + drv->dskeject = false; + _tcscpy(drv->newname, name); drv->newnamewriteprotected = forcedwriteprotect; _tcscpy (currprefs.floppyslots[num].df, name); currprefs.floppyslots[num].forcedwriteprotect = forcedwriteprotect; @@ -2640,12 +2649,8 @@ static void disk_insert_2 (int num, const TCHAR *name, bool forced, bool forcedw if (name[0] == 0) { disk_eject (num); } else if (!drive_empty(drv) || drv->dskchange_time > 0) { - drive_eject (drv); - /* set dskchange_time, disk_insert() will be - * called from DISK_check_change() after 2 second delay - * this makes sure that all programs detect disk change correctly - */ - setdskchangetime (drv, 2 * 50 * 312); + // delay eject so that it is always called when emulation is active + drv->dskeject = true; } else { setdskchangetime (drv, 1 * 312); } @@ -2677,6 +2682,14 @@ static void DISK_check_change (void) currprefs.floppy_read_only = changed_prefs.floppy_read_only; for (int i = 0; i < MAX_FLOPPY_DRIVES; i++) { drive *drv = floppy + i; + if (drv->dskeject) { + drive_eject(drv); + /* set dskchange_time, disk_insert() will be + * called from DISK_check_change() after 2 second delay + * this makes sure that all programs detect disk change correctly + */ + setdskchangetime(drv, 2 * 50 * 312); + } if (currprefs.floppyslots[i].dfxtype != changed_prefs.floppyslots[i].dfxtype) { currprefs.floppyslots[i].dfxtype = changed_prefs.floppyslots[i].dfxtype; reset_drive (i); diff --git a/drawing.cpp b/drawing.cpp index e9a1d487..0ea4b09e 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -2910,6 +2910,9 @@ static void init_drawing_frame (void) drawing_color_matches = -1; } +static int lightpen_y1, lightpen_y2; +static int statusbar_y1, statusbar_y2; + void putpixel (uae_u8 *buf, int bpp, int x, xcolnr c8, int opaq) { if (x <= 0) @@ -2949,20 +2952,26 @@ void putpixel (uae_u8 *buf, int bpp, int x, xcolnr c8, int opaq) } } -static void draw_status_line (int line, int statusy) +static uae_u8 *status_line_ptr(int line) { - int bpp, y; - uae_u8 *buf; + int y; - if (!(currprefs.leds_on_screen & STATUSLINE_CHIPSET) || (currprefs.leds_on_screen & STATUSLINE_TARGET)) - return; - bpp = gfxvidinfo.drawbuffer.pixbytes; y = line - (gfxvidinfo.drawbuffer.outheight - TD_TOTAL_HEIGHT); xlinebuffer = gfxvidinfo.drawbuffer.linemem; if (xlinebuffer == 0) xlinebuffer = row_map[line]; - buf = xlinebuffer; - draw_status_line_single (buf, bpp, statusy, gfxvidinfo.drawbuffer.outwidth, xredcolors, xgreencolors, xbluecolors, NULL); + return xlinebuffer; +} + +static void draw_status_line (int line, int statusy) +{ + uae_u8 *buf = status_line_ptr(line); + if (!buf) + return; + if (statusy < 0) + statusline_render(buf, gfxvidinfo.drawbuffer.pixbytes, gfxvidinfo.drawbuffer.rowbytes, gfxvidinfo.drawbuffer.outwidth, TD_TOTAL_HEIGHT, xredcolors, xgreencolors, xbluecolors, NULL); + else + draw_status_line_single(buf, gfxvidinfo.drawbuffer.pixbytes, statusy, gfxvidinfo.drawbuffer.outwidth, xredcolors, xgreencolors, xbluecolors, NULL); } static void draw_debug_status_line (int line) @@ -3011,8 +3020,6 @@ static void draw_lightpen_cursor (int x, int y, int line, int onscreen) } } -static int lightpen_y1, lightpen_y2; - static void lightpen_update (struct vidbuffer *vb) { int i; @@ -3160,9 +3167,12 @@ static void finish_drawing_frame (void) draw_frame2 (vb, vb); - if (currprefs.leds_on_screen) { + if (currprefs.leds_on_screen && ((currprefs.leds_on_screen & STATUSLINE_CHIPSET) && !(currprefs.leds_on_screen & STATUSLINE_TARGET))) { int slx, sly; - statusline_getpos (&slx, &sly, vb->outwidth, vb->outheight); + statusline_getpos(&slx, &sly, vb->outwidth, vb->outheight); + statusbar_y1 = sly + min_ypos_for_screen - 1; + statusbar_y2 = statusbar_y1 + TD_TOTAL_HEIGHT + 1; + draw_status_line(sly, -1); for (i = 0; i < TD_TOTAL_HEIGHT; i++) { int line = sly + i; draw_status_line (line, i); @@ -3349,7 +3359,10 @@ void hsync_record_line_state (int lineno, enum nln_how how, int changed) return; state = linestate + lineno; - changed += frame_redraw_necessary + ((lineno >= lightpen_y1 && lineno <= lightpen_y2) ? 1 : 0); + changed += frame_redraw_necessary + (( + (lineno >= lightpen_y1 && lineno < lightpen_y2) || + (lineno >= statusbar_y1 && lineno < statusbar_y2)) + ? 1 : 0); switch (how) { case nln_normal: diff --git a/expansion.cpp b/expansion.cpp index 25d3dc5c..92bb49df 100644 --- a/expansion.cpp +++ b/expansion.cpp @@ -31,6 +31,7 @@ #include "ncr_scsi.h" #include "debug.h" #include "gayle.h" +#include "cpuboard.h" #define MAX_EXPANSION_BOARDS 8 @@ -139,12 +140,13 @@ static bool chipdone; /* ********************************************************** */ -static void (*card_init[MAX_EXPANSION_BOARDS]) (void); +static addrbank* (*card_init[MAX_EXPANSION_BOARDS]) (void); static void (*card_map[MAX_EXPANSION_BOARDS]) (void); static TCHAR *card_name[MAX_EXPANSION_BOARDS]; static int card_flags[MAX_EXPANSION_BOARDS]; static int ecard, cardno, z3num; +static addrbank *expamem_bank_current; static uae_u16 uae_id; @@ -282,30 +284,50 @@ static void expamem_init_clear2 (void) ecard = cardno; } -static void expamem_init_last (void) +static addrbank *expamem_init_last (void) { expamem_init_clear2 (); write_log (_T("Memory map after autoconfig:\n")); memory_map_dump (); + return NULL; } -void expamem_next (void) -{ - expamem_init_clear (); - ++ecard; - - if ((card_flags[ecard] & 1) && currprefs.cs_z3autoconfig) { - map_banks (&expamemz3_bank, 0xff000000 >> 16, 1, 0); - map_banks (&dummy_bank, 0xE8, 1, 0); +static void call_card_init(int index) +{ + addrbank *ab; + expamem_bank.name = card_name[ecard] ? card_name[ecard] : (TCHAR*)_T("None"); + ab = (*card_init[ecard]) (); + if (ab) { + // non-NULL: not using expamem_bank + if ((card_flags[ecard] & 1) && currprefs.cs_z3autoconfig) { + map_banks(&expamemz3_bank, 0xff000000 >> 16, 1, 0); + map_banks(&dummy_bank, 0xE8, 1, 0); + expamem_bank_current = ab; + } else { + map_banks(ab, 0xE8, 1, 0); + if (currprefs.address_space_24) + map_banks(&dummy_bank, 0xff000000 >> 16, 1, 0); + } } else { - map_banks (&expamem_bank, 0xE8, 1, 0); - if (currprefs.address_space_24) - map_banks (&dummy_bank, 0xff000000 >> 16, 1, 0); + if ((card_flags[ecard] & 1) && currprefs.cs_z3autoconfig) { + map_banks(&expamemz3_bank, 0xff000000 >> 16, 1, 0); + map_banks(&dummy_bank, 0xE8, 1, 0); + expamem_bank_current = &expamem_bank; + } else { + map_banks(&expamem_bank, 0xE8, 1, 0); + if (currprefs.address_space_24) + map_banks(&dummy_bank, 0xff000000 >> 16, 1, 0); + } } +} +void expamem_next (void) +{ + expamem_init_clear(); + expamem_init_clear_zero(); + ++ecard; if (ecard < cardno) { - expamem_bank.name = card_name[ecard] ? card_name[ecard] : (TCHAR*) _T("None"); - (*card_init[ecard]) (); + call_card_init(ecard); } else { expamem_init_clear2 (); } @@ -479,10 +501,12 @@ static void REGPARAM2 expamem_bput (uaecptr addr, uae_u32 value) static uae_u32 REGPARAM2 expamemz3_bget (uaecptr addr) { int reg = addr & 0xff; + if (!expamem_bank_current) + return 0; if (addr & 0x100) - return expamem_bget(reg + 2); + return expamem_bank_current->bget(reg + 2); else - return expamem_bget(reg + 0); + return expamem_bank_current->bget(reg + 0); } static uae_u32 REGPARAM2 expamemz3_wget (uaecptr addr) { @@ -498,18 +522,22 @@ static uae_u32 REGPARAM2 expamemz3_lget (uaecptr addr) static void REGPARAM2 expamemz3_bput (uaecptr addr, uae_u32 value) { int reg = addr & 0xff; + if (!expamem_bank_current) + return; if (addr & 0x100) - expamem_bget(reg + 2); + expamem_bank_current->bput(reg + 2, value); else - expamem_bget(reg + 0); + expamem_bank_current->bput(reg + 0, value); } static void REGPARAM2 expamemz3_wput (uaecptr addr, uae_u32 value) { int reg = addr & 0xff; + if (!expamem_bank_current) + return; if (addr & 0x100) - expamem_wput(reg + 2, value); + expamem_bank_current->wput(reg + 2, value); else - expamem_wput(reg + 0, value); + expamem_bank_current->wput(reg + 0, value); } static void REGPARAM2 expamemz3_lput (uaecptr addr, uae_u32 value) { @@ -527,7 +555,7 @@ static void expamem_map_cd32fmv (void) cd32_fmv_init (start); } -static void expamem_init_cd32fmv (void) +static addrbank *expamem_init_cd32fmv (void) { int ids[] = { 23, -1 }; struct romlist *rl = getromlistbyids (ids); @@ -536,7 +564,7 @@ static void expamem_init_cd32fmv (void) expamem_init_clear (); if (!rl) - return; + return NULL; write_log (_T("CD32 FMV ROM '%s' %d.%d\n"), rl->path, rl->rd->ver, rl->rd->rev); rd = rl->rd; z = read_rom (rd); @@ -544,6 +572,7 @@ static void expamem_init_cd32fmv (void) zfile_fread (expamem, 128, 1, z); zfile_fclose (z); } + return NULL; } #endif @@ -692,7 +721,7 @@ static void expamem_map_catweasel (void) } } -static void expamem_init_catweasel (void) +static addrbank *expamem_init_catweasel (void) { uae_u8 productid = cwc.type >= CATWEASEL_TYPE_MK3 ? 66 : 200; uae_u16 vendorid = cwc.type >= CATWEASEL_TYPE_MK3 ? 4626 : 5001; @@ -719,6 +748,7 @@ static void expamem_init_catweasel (void) expamem_write (0x2c, 0x00); /* ROM-Offset lo */ expamem_write (0x40, 0x00); /* Ctrl/Statusreg.*/ + return NULL; } #endif @@ -865,10 +895,10 @@ static void expamem_map_fastcard_2 (int boardnum) } } -static void expamem_init_fastcard_2 (int boardnum) +static addrbank *expamem_init_fastcard_2 (int boardnum) { uae_u16 mid = (currprefs.a2091 || currprefs.uae_hide) ? commodore : uae_id; - uae_u8 pid = (currprefs.a2091 || currprefs.uae_hide) ? commodore_a2091_ram : (currprefs.maprom ? 1 : 81); + uae_u8 pid = (currprefs.a2091 || currprefs.uae_hide) ? commodore_a2091_ram : (currprefs.maprom && !currprefs.cpuboard_type ? 1 : 81); uae_u8 type = add_memory | zorroII | (currprefs.a2091 && !boardnum ? chainedconfig : 0); int allocated = boardnum ? fastmem2_bank.allocated : fastmem_bank.allocated; @@ -908,6 +938,7 @@ static void expamem_init_fastcard_2 (int boardnum) expamem_write (0x2c, 0x00); /* ROM-Offset lo */ expamem_write (0x40, 0x00); /* Ctrl/Statusreg.*/ + return NULL; } static void expamem_map_fastcard (void) @@ -918,13 +949,13 @@ static void expamem_map_fastcard2 (void) { expamem_map_fastcard_2 (1); } -static void expamem_init_fastcard (void) +static addrbank *expamem_init_fastcard(void) { - expamem_init_fastcard_2 (0); + return expamem_init_fastcard_2 (0); } -static void expamem_init_fastcard2 (void) +static addrbank *expamem_init_fastcard2(void) { - expamem_init_fastcard_2 (1); + return expamem_init_fastcard_2 (1); } /* ********************************************************** */ @@ -953,7 +984,7 @@ static void expamem_map_filesys (void) #define FILESYS_BOOTPOINT 0x01e6 #define FILESYS_DIAGAREA 0x2000 -static void expamem_init_filesys (void) +static addrbank* expamem_init_filesys (void) { /* struct DiagArea - the size has to be large enough to store several device ROMTags */ uae_u8 diagarea[] = { 0x90, 0x00, /* da_Config, da_Flags */ @@ -967,7 +998,7 @@ static void expamem_init_filesys (void) expamem_write (0x08, no_shutup); - expamem_write (0x04, currprefs.maprom ? 2 : 82); + expamem_write (0x04, currprefs.maprom && !currprefs.cpuboard_type ? 2 : 82); expamem_write (0x10, uae_id >> 8); expamem_write (0x14, uae_id & 0xff); @@ -994,6 +1025,7 @@ static void expamem_init_filesys (void) do_put_mem_long ((uae_u32 *)(expamem + FILESYS_DIAGAREA + FILESYS_BOOTPOINT + 2), EXPANSION_bootcode); memcpy (filesysory, expamem, 0x3000); + return NULL; } #endif @@ -1032,7 +1064,7 @@ static void expamem_map_z3fastmem2 (void) expamem_map_z3fastmem_2 (&z3fastmem2_bank, &z3fastmem2_bank.start, currprefs.z3fastmem2_size, z3fastmem2_bank.allocated, 0); } -static void expamem_init_z3fastmem_2 (addrbank *bank, uae_u32 start, uae_u32 size, uae_u32 allocated) +static addrbank *expamem_init_z3fastmem_2(addrbank *bank, uae_u32 start, uae_u32 size, uae_u32 allocated) { int code = (allocated == 0x100000 ? Z2_MEM_1MB : allocated == 0x200000 ? Z2_MEM_2MB @@ -1059,7 +1091,7 @@ static void expamem_init_z3fastmem_2 (addrbank *bank, uae_u32 start, uae_u32 siz expamem_write (0x08, care_addr | force_z3 | (allocated > 0x800000 ? ext_size : subsize)); - expamem_write (0x04, currprefs.maprom ? 3 : 83); + expamem_write (0x04, currprefs.maprom && !currprefs.cpuboard_type ? 3 : 83); expamem_write (0x10, uae_id >> 8); expamem_write (0x14, uae_id & 0xff); @@ -1075,15 +1107,15 @@ static void expamem_init_z3fastmem_2 (addrbank *bank, uae_u32 start, uae_u32 siz expamem_write (0x40, 0x00); /* Ctrl/Statusreg.*/ map_banks (bank, start >> 16, size >> 16, allocated); - + return NULL; } -static void expamem_init_z3fastmem (void) +static addrbank *expamem_init_z3fastmem (void) { - expamem_init_z3fastmem_2 (&z3fastmem_bank, z3fastmem_bank.start, currprefs.z3fastmem_size, z3fastmem_bank.allocated); + return expamem_init_z3fastmem_2 (&z3fastmem_bank, z3fastmem_bank.start, currprefs.z3fastmem_size, z3fastmem_bank.allocated); } -static void expamem_init_z3fastmem2 (void) +static addrbank *expamem_init_z3fastmem2(void) { - expamem_init_z3fastmem_2 (&z3fastmem2_bank, z3fastmem2_bank.start, currprefs.z3fastmem2_size, z3fastmem2_bank.allocated); + return expamem_init_z3fastmem_2 (&z3fastmem2_bank, z3fastmem2_bank.start, currprefs.z3fastmem2_size, z3fastmem2_bank.allocated); } #ifdef PICASSO96 @@ -1100,7 +1132,7 @@ static void expamem_map_gfxcard (void) } } -static void expamem_init_gfxcard (bool z3) +static addrbank *expamem_init_gfxcard (bool z3) { int code = (gfxmem_bank.allocated == 0x100000 ? Z2_MEM_1MB : gfxmem_bank.allocated == 0x200000 ? Z2_MEM_2MB @@ -1140,14 +1172,15 @@ static void expamem_init_gfxcard (bool z3) expamem_write (0x2c, 0x00); /* ROM-Offset lo */ expamem_write (0x40, 0x00); /* Ctrl/Statusreg.*/ + return NULL; } -static void expamem_init_gfxcard_z3 (void) +static addrbank *expamem_init_gfxcard_z3(void) { - expamem_init_gfxcard (true); + return expamem_init_gfxcard (true); } -static void expamem_init_gfxcard_z2 (void) +static addrbank *expamem_init_gfxcard_z2 (void) { - expamem_init_gfxcard (false); + return expamem_init_gfxcard (false); } #endif @@ -1350,7 +1383,7 @@ static uaecptr check_boot_rom (void) if (currprefs.cs_cdtvcd || currprefs.cs_cdtvscsi || currprefs.uae_hide > 1) b = RTAREA_BACKUP; - if (currprefs.cs_mbdmac == 1) + if (currprefs.cs_mbdmac == 1 || currprefs.cpuboard_type) b = RTAREA_BACKUP; ab = &get_mem_bank (RTAREA_DEFAULT); if (ab) { @@ -1397,52 +1430,74 @@ uaecptr need_uae_boot_rom (void) return v; } -static void expamem_init_a2065 (void) +static addrbank *expamem_init_a2065(void) { #ifdef A2065 a2065_init (); #endif + return NULL; } -static void expamem_init_cdtv (void) +static addrbank *expamem_init_cdtv(void) { #ifdef CDTV cdtv_init (); #endif + return NULL; } -static void expamem_init_a2091 (void) +static addrbank *expamem_init_a2091(void) { #ifdef A2091 - a2091_init (0); + return a2091_init (0); +#else + return NULL; #endif } -static void expamem_init_a2091_2 (void) +static addrbank *expamem_init_a2091_2(void) { #ifdef A2091 - a2091_init (1); + return a2091_init (1); +#else + return NULL; +#endif +} +static addrbank *expamem_init_a4091(void) +{ +#ifdef NCR + return ncr_a4091_autoconfig_init (0); +#else + return NULL; #endif } -static void expamem_init_a4091 (void) +static addrbank *expamem_init_a4091_2(void) { #ifdef NCR - ncr_autoconfig_init (0); + return ncr_a4091_autoconfig_init (1); +#else + return NULL; #endif } -static void expamem_init_a4091_2 (void) +static addrbank *expamem_init_warpengine(void) { #ifdef NCR - ncr_autoconfig_init (1); + return ncr_warpengine_autoconfig_init(); +#else + return NULL; #endif } -static void expamem_init_gfxboard_memory (void) +static addrbank *expamem_init_gfxboard_memory(void) { #ifdef GFXBOARD - gfxboard_init_memory (); + return gfxboard_init_memory (); +#else + return NULL; #endif } -static void expamem_init_gfxboard_registers (void) +static addrbank *expamem_init_gfxboard_registers(void) { #ifdef GFXBOARD - gfxboard_init_registers (); + return gfxboard_init_registers (); +#else + return NULL; #endif } @@ -1476,6 +1531,14 @@ void expamem_reset (void) if (need_uae_boot_rom () == 0) do_mount = 0; + if (currprefs.cpuboard_type == BOARD_BLIZZARD_1230_IV || currprefs.cpuboard_type == BOARD_BLIZZARD_1260) { + // This requires first 128k slot. + card_flags[cardno] = 1; + card_name[cardno] = _T("Blizzard"); + card_init[cardno] = cpuboard_autoconfig_init; + card_map[cardno++] = NULL; + } + if (currprefs.fastmem_autoconfig) { if (fastmem_bank.baseaddr != NULL && (fastmem_bank.allocated <= 262144 || currprefs.chipmem_size <= 2 * 1024 * 1024)) { card_flags[cardno] = 0; @@ -1579,7 +1642,13 @@ void expamem_reset (void) } } #endif + /* Z3 boards last */ + if (currprefs.cpuboard_type == BOARD_WARPENGINE_A4000) { + card_flags[cardno] = 1; + card_name[cardno] = _T("Warp Engine"); + card_init[cardno++] = expamem_init_warpengine; + } if (z3fastmem_bank.baseaddr != NULL) { z3num = 0; @@ -1610,7 +1679,7 @@ void expamem_reset (void) #endif #ifdef GFXBOARD if (currprefs.rtgmem_type >= GFXBOARD_HARDWARE && gfxboard_is_z3 (currprefs.rtgmem_type)) { - card_flags[cardno] = 1; + card_flags[cardno] = 0; card_name[cardno] = _T ("Gfxboard VRAM Zorro III"); card_init[cardno] = expamem_init_gfxboard_memory; card_map[cardno++] = NULL; @@ -1640,7 +1709,7 @@ void expamem_reset (void) if (cardno == 0 || savestate_state) expamem_init_clear_zero (); else - (*card_init[0]) (); + call_card_init(0); } void expansion_init (void) diff --git a/filesys.cpp b/filesys.cpp index 49dc65c5..6e6b475e 100644 --- a/filesys.cpp +++ b/filesys.cpp @@ -58,6 +58,7 @@ #include "scsi.h" #include "uaenative.h" #include "tabletlibrary.h" +#include "cpuboard.h" #ifdef RETROPLATFORM #include "rp.h" #endif @@ -868,6 +869,13 @@ static void initialize_mountinfo (void) a4091_add_scsi_unit (unit, uci, 1); added = true; } +#endif + } else if (type == HD_CONTROLLER_TYPE_SCSI_WARPENGINE) { +#ifdef NCR + if (currprefs.cpuboard_type == BOARD_WARPENGINE_A4000) { + warpengine_add_scsi_unit(unit, uci); + added = true; + } #endif } else if (type == HD_CONTROLLER_TYPE_SCSI_A4000T) { #ifdef NCR diff --git a/gencpu.cpp b/gencpu.cpp index 76942a7f..b0a66ad4 100644 --- a/gencpu.cpp +++ b/gencpu.cpp @@ -2258,12 +2258,12 @@ static void genflags_normal (flagtypes type, wordsizes size, char *value, char * case flag_add: start_brace (); - printf ("uae_u32 %s = %s + %s;\n", value, dstr, sstr); + printf ("uae_u32 %s = %s + %s;\n", value, udstr, usstr); break; case flag_sub: case flag_cmp: start_brace (); - printf ("uae_u32 %s = %s - %s;\n", value, dstr, sstr); + printf ("uae_u32 %s = %s - %s;\n", value, udstr, usstr); break; } diff --git a/gfxboard.cpp b/gfxboard.cpp index 456e42ca..54b52076 100644 --- a/gfxboard.cpp +++ b/gfxboard.cpp @@ -394,14 +394,16 @@ void gfxboard_vsync_handler (void) gfx_unlock_picasso (true); gfxboard_surface = NULL; - // Vertical Sync End Register, 0x20 = Disable Vertical Intgerrupt, 0x10 = Clear Vertical Interrupt. - if (board->irq && (!(vga.vga.cr[0x11] & 0x20) && (vga.vga.cr[0x11] & 0x10) && !(vga.vga.gr[0x17] & 4))) { - if (gfxboard_intena) { - gfxboard_vblank = true; - if (board->irq == 2) - INTREQ (0x8000 | 0x0008); - else - INTREQ (0x8000 | 0x2000); + // Vertical Sync End Register, 0x20 = Disable Vertical Interrupt, 0x10 = Clear Vertical Interrupt. + if (board->irq) { + if ((!(vga.vga.cr[0x11] & 0x20) && (vga.vga.cr[0x11] & 0x10) && !(vga.vga.gr[0x17] & 4))) { + if (gfxboard_intena) { + gfxboard_vblank = true; + if (board->irq == 2) + INTREQ (0x8000 | 0x0008); + else + INTREQ (0x8000 | 0x2000); + } } } @@ -2036,7 +2038,7 @@ static void ew (int addr, uae_u32 value) } } -void gfxboard_init_memory (void) +addrbank *gfxboard_init_memory (void) { int bank; uae_u8 z2_flags, z3_flags, type; @@ -2120,24 +2122,24 @@ void gfxboard_init_memory (void) gfxboard_bank_memory.bget = gfxboard_bget_mem_autoconfig; gfxboard_bank_memory.bput = gfxboard_bput_mem_autoconfig; - map_banks (&gfxboard_bank_memory, 0xe80000 >> 16, 0x10000 >> 16, 0x10000); + return &gfxboard_bank_memory; } -void gfxboard_init_memory_p4_z2 (void) +addrbank *gfxboard_init_memory_p4_z2 (void) { if (board->z3) { expamem_next (); - return; + return NULL; } copyp4autoconfig (64); - map_banks (&gfxboard_bank_memory, 0xe80000 >> 16, 0x10000 >> 16, 0x10000); + return &gfxboard_bank_memory; } -void gfxboard_init_registers (void) +addrbank *gfxboard_init_registers (void) { if (!board->model_registers) { expamem_next (); - return; + return NULL; } memset (automemory, 0xff, GFXBOARD_AUTOCONFIG_SIZE); ew (0x00, 0xc0 | 0x01); // 64k Z2 @@ -2164,5 +2166,5 @@ void gfxboard_init_registers (void) gfxboard_bank_registers.bget = gfxboard_bget_regs_autoconfig; gfxboard_bank_registers.bput = gfxboard_bput_regs_autoconfig; - map_banks (&gfxboard_bank_registers, 0xe80000 >> 16, 0x10000 >> 16, 0x10000); + return &gfxboard_bank_registers; } diff --git a/include/a2065.h b/include/a2065.h index 79f5d6c8..87db1a71 100644 --- a/include/a2065.h +++ b/include/a2065.h @@ -1,7 +1,7 @@ #ifdef A2065 -extern void a2065_init (void); +extern addrbank *a2065_init (void); extern void a2065_free (void); extern void a2065_reset (void); extern void a2065_hsync_handler (void); diff --git a/include/a2091.h b/include/a2091.h index 22ee2d70..57a4303a 100644 --- a/include/a2091.h +++ b/include/a2091.h @@ -38,6 +38,17 @@ struct wd_state { int superdmac; int wd33c93_ver;// 0 or 1 + uae_u8 xt_control; + uae_u8 xt_status; + uae_u16 xt_cyls, xt_heads, xt_sectors; + + bool xt_irq; + int xt_offset; + int xt_datalen; + uae_u8 xt_cmd[6]; + uae_u8 xt_statusbyte; + + // unit 7 = XT struct scsi_data *scsis[8]; struct scsi_data *scsi; @@ -51,7 +62,7 @@ extern void init_scsi (struct wd_state*); extern void scsi_dmac_start_dma (struct wd_state*); extern void scsi_dmac_stop_dma (struct wd_state*); -extern void a2091_init (int devnum); +extern addrbank *a2091_init (int devnum); extern void a2091_free (void); extern void a2091_reset (void); @@ -74,9 +85,8 @@ extern void scsi_hsync (void); #define WD33C93 _T("WD33C93") -extern int a2091_add_scsi_unit (int ch, struct uaedev_config_info *ci, int devnum); -extern int a3000_add_scsi_unit (int ch, struct uaedev_config_info *ci); - +extern int a2091_add_scsi_unit(int ch, struct uaedev_config_info *ci, int devnum); +extern int a3000_add_scsi_unit(int ch, struct uaedev_config_info *ci); extern int add_wd_scsi_hd (struct wd_state *wd, int ch, struct hd_hardfiledata *hfd, struct uaedev_config_info *ci, int scsi_level); extern int add_wd_scsi_cd (struct wd_state *wd, int ch, int unitnum); diff --git a/include/autoconf.h b/include/autoconf.h index 63d4a845..fb440798 100644 --- a/include/autoconf.h +++ b/include/autoconf.h @@ -92,6 +92,7 @@ extern void emulib_install (void); extern void expansion_init (void); extern void expansion_cleanup (void); extern void expansion_clear (void); +extern void expansion_autoconfig_put(int, uae_u8); extern void uaegfx_install_code (uaecptr); diff --git a/include/filesys.h b/include/filesys.h index 1327d80b..73f38d01 100644 --- a/include/filesys.h +++ b/include/filesys.h @@ -99,13 +99,14 @@ struct hd_hardfiledata { #define HD_CONTROLLER_TYPE_SCSI_A3000 7 #define HD_CONTROLLER_TYPE_SCSI_A4000T 8 #define HD_CONTROLLER_TYPE_SCSI_CDTV 9 -#define HD_CONTROLLER_TYPE_PCMCIA_SRAM 10 -#define HD_CONTROLLER_TYPE_PCMCIA_IDE 11 +#define HD_CONTROLLER_TYPE_SCSI_WARPENGINE 10 +#define HD_CONTROLLER_TYPE_PCMCIA_SRAM 11 +#define HD_CONTROLLER_TYPE_PCMCIA_IDE 12 #define HD_CONTROLLER_TYPE_IDE_FIRST 1 #define HD_CONTROLLER_TYPE_IDE_LAST 1 #define HD_CONTROLLER_TYPE_SCSI_FIRST 2 -#define HD_CONTROLLER_TYPE_SCSI_LAST 9 +#define HD_CONTROLLER_TYPE_SCSI_LAST 10 #define FILESYS_VIRTUAL 0 #define FILESYS_HARDFILE 1 diff --git a/include/fsdb.h b/include/fsdb.h index adb144e1..a3223b4d 100644 --- a/include/fsdb.h +++ b/include/fsdb.h @@ -162,6 +162,7 @@ extern bool my_chmod (const TCHAR *name, uae_u32 mode); extern bool my_resolveshortcut(TCHAR *linkfile, int size); extern bool my_resolvessymboliclink(TCHAR *linkfile, int size); extern bool my_resolvesoftlink(TCHAR *linkfile, int size); +extern const TCHAR *my_getfilepart(const TCHAR *filename); extern void my_canonicalize_path(const TCHAR *path, TCHAR *out, int size); extern int my_issamevolume(const TCHAR *path1, const TCHAR *path2, TCHAR *path); extern bool my_issamepath(const TCHAR *path1, const TCHAR *path2); diff --git a/include/gfxboard.h b/include/gfxboard.h index 9930be90..1de866f1 100644 --- a/include/gfxboard.h +++ b/include/gfxboard.h @@ -2,9 +2,9 @@ extern addrbank gfxboard_bank_memory; extern addrbank gfxboard_bank_registers; -extern void gfxboard_init_memory (void); -extern void gfxboard_init_memory_p4_z2 (void); -extern void gfxboard_init_registers (void); +extern addrbank *gfxboard_init_memory (void); +extern addrbank *gfxboard_init_memory_p4_z2(void); +extern addrbank *gfxboard_init_registers(void); extern void gfxboard_free (void); extern void gfxboard_reset (void); extern void gfxboard_vsync_handler (void); diff --git a/include/inputdevice.h b/include/inputdevice.h index 25d80dc2..3b4cf481 100644 --- a/include/inputdevice.h +++ b/include/inputdevice.h @@ -278,7 +278,8 @@ extern void inputdevice_close (void); extern void inputdevice_default_prefs (struct uae_prefs *p); extern void inputdevice_acquire (int allmode); -extern void inputdevice_unacquire (void); +extern void inputdevice_unacquire(void); +extern void inputdevice_unacquire(bool emulationactive, int inputmask); extern void indicator_leds (int num, int state); diff --git a/include/memory.h b/include/memory.h index d0aa3e55..b461bb0c 100644 --- a/include/memory.h +++ b/include/memory.h @@ -359,6 +359,7 @@ extern void memory_init (void); extern void memory_cleanup (void); extern void map_banks (addrbank *bank, int first, int count, int realsize); extern void map_banks_quick (addrbank *bank, int first, int count, int realsize); +extern void map_banks_nojitdirect (addrbank *bank, int first, int count, int realsize); extern void map_banks_cond (addrbank *bank, int first, int count, int realsize); extern void map_overlay (int chip); extern void memory_hardreset (int); diff --git a/include/ncr_scsi.h b/include/ncr_scsi.h index 0c4b4984..18b05589 100644 --- a/include/ncr_scsi.h +++ b/include/ncr_scsi.h @@ -3,9 +3,12 @@ void ncr_io_bput_a4000t(uaecptr, uae_u32); uae_u32 ncr_io_bget_a4000t(uaecptr); extern void ncr_init(void); -extern void ncr_autoconfig_init(int devnum); +extern addrbank *ncr_a4091_autoconfig_init(int devnum); +extern addrbank *ncr_warpengine_autoconfig_init(void); extern void ncr_free(void); extern void ncr_reset(void); extern int a4000t_add_scsi_unit (int ch, struct uaedev_config_info *ci); +extern int warpengine_add_scsi_unit (int ch, struct uaedev_config_info *ci); extern int a4091_add_scsi_unit (int ch, struct uaedev_config_info *ci, int devnum); + diff --git a/include/options.h b/include/options.h index 11c7e45c..27691cfe 100644 --- a/include/options.h +++ b/include/options.h @@ -505,6 +505,9 @@ struct uae_prefs { uae_u32 mbresmem_low_size; uae_u32 mbresmem_high_size; uae_u32 rtgmem_size; + int cpuboard_type; + uae_u32 cpuboardmem1_size; + uae_u32 cpuboardmem2_size; bool rtg_hardwareinterrupt; bool rtg_hardwaresprite; int rtgmem_type; @@ -554,9 +557,11 @@ struct uae_prefs { int win32_inactive_priority; bool win32_inactive_pause; bool win32_inactive_nosound; + int win32_inactive_input; int win32_iconified_priority; bool win32_iconified_pause; bool win32_iconified_nosound; + int win32_iconified_input; bool win32_rtgmatchdepth; bool win32_rtgallowscaling; diff --git a/include/rommgr.h b/include/rommgr.h index f8bb513d..b7bddd2e 100644 --- a/include/rommgr.h +++ b/include/rommgr.h @@ -17,8 +17,7 @@ extern int decode_cloanto_rom_do (uae_u8 *mem, int size, int real_size); #define ROMTYPE_CD32CART 0x00004000 #define ROMTYPE_SPECIALKICK 0x00008000 #define ROMTYPE_PIV 0x00010000 -#define ROMTYPE_BLIZ1230 0x00020000 -#define ROMTYPE_BLIZ1240 0x00040000 +#define ROMTYPE_CPUBOARD 0x00020000 #define ROMTYPE_MASK 0x001fffff #define ROMTYPE_EVEN 0x02000000 #define ROMTYPE_ODD 0x04000000 diff --git a/include/statusline.h b/include/statusline.h index 0077f169..f4c197b3 100644 --- a/include/statusline.h +++ b/include/statusline.h @@ -8,7 +8,7 @@ #define TD_RIGHT 1 #define TD_BOTTOM 2 -static int td_pos = (TD_RIGHT|TD_BOTTOM); +static int td_pos = (TD_RIGHT | TD_BOTTOM); #define TD_NUM_WIDTH 7 #define TD_NUM_HEIGHT 7 @@ -24,4 +24,15 @@ static int td_pos = (TD_RIGHT|TD_BOTTOM); #define STATUSLINE_TARGET 0x80 extern void draw_status_line_single (uae_u8 *buf, int bpp, int y, int totalwidth, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc, uae_u32 *alpha); -extern void statusline_getpos (int *x, int *y, int width, int height); +extern void statusline_single_erase(uae_u8 *buf, int bpp, int y, int totalwidth); +extern void statusline_getpos(int *x, int *y, int width, int height); + +extern bool createstatusline(void); +extern void deletestatusline(void); +extern void statusline_render(uae_u8 *buf, int bpp, int pitch, int width, int height, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc, uae_u32 *alpha); +extern void statusline_add_message(const TCHAR *format, ...); +extern void statusline_clear(void); +extern void statusline_vsync(void); +extern void statusline_updated(void); +extern bool has_statusline_updated(void); +extern const TCHAR *statusline_fetch(void); diff --git a/include/uae.h b/include/uae.h index a402be73..fa974a03 100644 --- a/include/uae.h +++ b/include/uae.h @@ -39,6 +39,7 @@ extern void fullpath (TCHAR *path, int size); extern void getpathpart (TCHAR *outpath, int size, const TCHAR *inpath); extern void getfilepart (TCHAR *out, int size, const TCHAR *path); extern uae_u32 getlocaltime (void); +extern bool isguiactive(void); extern int quit_program; extern bool console_emulation; diff --git a/include/uaeipc.h b/include/uaeipc.h index cf8d1f7d..94b6af2a 100644 --- a/include/uaeipc.h +++ b/include/uaeipc.h @@ -1,6 +1,4 @@ -#define COMPIPENAME _T("WinUAE_COM") - extern void *createIPC (const TCHAR *name, int); extern void closeIPC (void*); extern int checkIPC (void*,struct uae_prefs*); diff --git a/inputdevice.cpp b/inputdevice.cpp index 3da3c42f..b54b7cf9 100644 --- a/inputdevice.cpp +++ b/inputdevice.cpp @@ -55,6 +55,7 @@ #include "avioutput.h" #endif #include "tabletlibrary.h" +#include "statusline.h" // 01 = host events // 02 = joystick @@ -3582,7 +3583,7 @@ static int switchdevice (struct uae_input_device *id, int num, bool buttonmode) int ismouse = 0; int newport = 0; int flags = 0; - TCHAR *name = NULL; + TCHAR *name = NULL, *fname = NULL; int otherbuttonpressed = 0; int acc = input_acquired; @@ -3596,9 +3597,12 @@ static int switchdevice (struct uae_input_device *id, int num, bool buttonmode) if (rp_isactive ()) return 0; #endif + if (!ismouseactive()) + return 0; for (i = 0; i < MAX_INPUT_DEVICES; i++) { if (id == &joysticks[i]) { name = idev[IDTYPE_JOYSTICK].get_uniquename (i); + fname = idev[IDTYPE_JOYSTICK].get_friendlyname (i); newport = num == 0 ? 1 : 0; flags = idev[IDTYPE_JOYSTICK].get_flags (i); for (j = 0; j < MAX_INPUT_DEVICES; j++) { @@ -3612,6 +3616,7 @@ static int switchdevice (struct uae_input_device *id, int num, bool buttonmode) if (id == &mice[i]) { ismouse = 1; name = idev[IDTYPE_MOUSE].get_uniquename (i); + fname = idev[IDTYPE_MOUSE].get_friendlyname (i); newport = num == 0 ? 0 : 1; flags = idev[IDTYPE_MOUSE].get_flags (i); } @@ -3672,6 +3677,7 @@ static int switchdevice (struct uae_input_device *id, int num, bool buttonmode) if (supermouse >= 0 && nummouse == 1) { TCHAR *oldname = name; name = idev[IDTYPE_MOUSE].get_uniquename (supermouse); + fname = idev[IDTYPE_MOUSE].get_friendlyname(supermouse); issupermouse = true; #if SWITCHDEBUG_DEBUG write_log (_T("inputdevice gameports change '%s' -> '%s'\n"), oldname, name); @@ -3679,10 +3685,12 @@ static int switchdevice (struct uae_input_device *id, int num, bool buttonmode) } } #endif -#if SWITCHDEBUG_DEBUG +#if 1 write_log (_T("inputdevice gameports change '%s':%d->%d %d,%d\n"), name, num, newport, currprefs.input_selected_setting, currprefs.jports[newport].id); #endif inputdevice_unacquire (); + if (fname) + statusline_add_message(_T("Port %d: %s"), newport, fname); if (currprefs.input_selected_setting != GAMEPORT_INPUT_SETTINGS && currprefs.jports[newport].id > JPORT_NONE) { // disable old device @@ -3815,6 +3823,8 @@ static int switchdevice (struct uae_input_device *id, int num, bool buttonmode) } write_log (_T("inputdevice input change '%s':%d->%d\n"), name, num, newport); inputdevice_unacquire (); + if (fname) + statusline_add_message(_T("Port %d: %s"), newport, fname); inputdevice_copyconfig (&currprefs, &changed_prefs); inputdevice_validate_jports (&changed_prefs, -1); inputdevice_copyconfig (&changed_prefs, &currprefs); @@ -6742,26 +6752,44 @@ void inputdevice_acquire (int allmode) input_acquired = 1; } -void inputdevice_unacquire (void) +void inputdevice_unacquire(bool emulationactive, int inputmask) { int i; - //write_log (_T("inputdevice_unacquire\n")); + //write_log (_T("inputdevice_unacquire %d %d\n"), emulationactive, inputmask); + + if (!emulationactive) + inputmask = 0; - for (i = 0; i < MAX_INPUT_DEVICES; i++) - idev[IDTYPE_JOYSTICK].unacquire (i); - for (i = 0; i < MAX_INPUT_DEVICES; i++) - idev[IDTYPE_MOUSE].unacquire (i); - for (i = 0; i < MAX_INPUT_DEVICES; i++) - idev[IDTYPE_KEYBOARD].unacquire (i); + + if (!(inputmask & 4)) { + for (i = 0; i < MAX_INPUT_DEVICES; i++) + idev[IDTYPE_JOYSTICK].unacquire(i); + } + if (!(inputmask & 2)) { + for (i = 0; i < MAX_INPUT_DEVICES; i++) + idev[IDTYPE_MOUSE].unacquire(i); + } + if (!(inputmask & 1)) { + for (i = 0; i < MAX_INPUT_DEVICES; i++) + idev[IDTYPE_KEYBOARD].unacquire(i); + } if (!input_acquired) return; input_acquired = 0; - idev[IDTYPE_JOYSTICK].unacquire (-1); - idev[IDTYPE_MOUSE].unacquire (-1); - idev[IDTYPE_KEYBOARD].unacquire (-1); + if (!(inputmask & 4)) + idev[IDTYPE_JOYSTICK].unacquire(-1); + if (!(inputmask & 2)) + idev[IDTYPE_MOUSE].unacquire(-1); + if (!(inputmask & 1)) + idev[IDTYPE_KEYBOARD].unacquire(-1); +} + +void inputdevice_unacquire(void) +{ + inputdevice_unacquire(false, 0); } void inputdevice_testrecord (int type, int num, int wtype, int wnum, int state, int max) diff --git a/main.cpp b/main.cpp index b886b577..7ac6f51c 100644 --- a/main.cpp +++ b/main.cpp @@ -295,6 +295,21 @@ void fixup_cpu (struct uae_prefs *p) } if (p->cpu_cycle_exact) p->cpu_compatible = true; + + if (p->cpuboard_type && !p->comptrustbyte) { + error_log(_T("JIT direct is not compatible with emulated accelerator boards.")); + p->comptrustbyte = 1; + p->comptrustlong = 1; + p->comptrustlong = 1; + p->comptrustnaddr = 1; + } + if (!p->jit_direct_compatible_memory && !p->comptrustbyte) { + error_log(_T("JIT direct compatible memory option is disabled, disabling JIT direct.")); + p->comptrustbyte = 1; + p->comptrustlong = 1; + p->comptrustlong = 1; + p->comptrustnaddr = 1; + } } void fixup_prefs (struct uae_prefs *p) @@ -472,14 +487,6 @@ void fixup_prefs (struct uae_prefs *p) p->cachesize = 0; err = 1; } - if (!p->jit_direct_compatible_memory && p->comptrustbyte) { - error_log(_T("JIT direct compatible memory option is disabled, disabling JIT direct.")); - p->comptrustbyte = 0; - p->comptrustlong = 0; - p->comptrustlong = 0; - p->comptrustnaddr = 0; - err = 1; - } if ((p->z3fastmem_size || p->z3fastmem2_size || p->z3chipmem_size) && (p->address_space_24 || p->cpu_model < 68020)) { error_log (_T("Z3 fast memory can't be used with a 68000/68010 emulation. Turning off Z3 fast memory.")); p->z3fastmem_size = 0; @@ -550,7 +557,7 @@ void fixup_prefs (struct uae_prefs *p) p->genlock = false; } if (p->cs_hacks) { - error_log (_T("chipset_hacks is nonzero.")); + error_log (_T("chipset_hacks is nonzero (0x%04x)."), p->cs_hacks); } fixup_prefs_dimensions (p); diff --git a/memory.cpp b/memory.cpp index 368fbfec..94367d1a 100644 --- a/memory.cpp +++ b/memory.cpp @@ -34,6 +34,7 @@ #include "gayle.h" #include "debug.h" #include "gfxboard.h" +#include "cpuboard.h" bool canbang; int candirect = -1; @@ -180,7 +181,7 @@ static void dummylog (int rw, uaecptr addr, int size, uae_u32 val, int ins) } // 250ms delay -static void gary_wait(uaecptr addr, int size) +static void gary_wait(uaecptr addr, int size, bool write) { static int cnt = 50; @@ -191,7 +192,7 @@ static void gary_wait(uaecptr addr, int size) #endif if (cnt > 0) { - write_log (_T("Gary timeout: %08x %d\n"), addr, size); + write_log (_T("Gary timeout: %08x %d %c PC=%08x\n"), addr, size, write ? 'W' : 'R', M68K_GETPC); cnt--; } } @@ -217,7 +218,7 @@ void dummy_put (uaecptr addr, int size, uae_u32 val) { if (gary_nonrange(addr) || (size > 1 && gary_nonrange(addr + size - 1))) { if (gary_timeout) - gary_wait (addr, size); + gary_wait (addr, size, true); if (gary_toenb && currprefs.mmu_model) exception2 (addr, true, size, regs.s ? 4 : 0); } @@ -227,9 +228,21 @@ uae_u32 dummy_get (uaecptr addr, int size, bool inst) { uae_u32 v = NONEXISTINGDATA; +#if 0 + if (addr == 0xf00000 && size < 2) { + return 0xff; + } + if (addr >= 0xf60000 && addr < 0xf80000 && size < 2) { + //activate_debugger(); + if (addr == 0xf60020) + return 0x8; + return v; + } +#endif + if (gary_nonrange(addr) || (size > 1 && gary_nonrange(addr + size - 1))) { if (gary_timeout) - gary_wait (addr, size); + gary_wait (addr, size, false); if (gary_toenb && currprefs.mmu_model) exception2 (addr, false, size, (regs.s ? 4 : 0) | (inst ? 0 : 1)); return v; @@ -1900,6 +1913,7 @@ static void allocate_memory (void) bogo_filepos = 0; a3000lmem_filepos = 0; a3000hmem_filepos = 0; + cpuboard_init(); } static void fill_ce_banks (void) @@ -2045,6 +2059,7 @@ void memory_clear (void) if (a3000hmem_bank.baseaddr) memset (a3000hmem_bank.baseaddr, 0, a3000hmem_bank.allocated); expansion_clear (); + cpuboard_clear(); } void memory_reset (void) @@ -2076,6 +2091,7 @@ void memory_reset (void) currprefs.cs_ide = changed_prefs.cs_ide; currprefs.cs_fatgaryrev = changed_prefs.cs_fatgaryrev; currprefs.cs_ramseyrev = changed_prefs.cs_ramseyrev; + cpuboard_reset(mem_hardreset > 2); gayleorfatgary = (currprefs.chipset_mask & CSMASK_AGA) || currprefs.cs_pcmcia || currprefs.cs_ide > 0 || currprefs.cs_mbdmac; @@ -2230,10 +2246,12 @@ void memory_reset (void) if (cardmem_bank.baseaddr) map_banks (&cardmem_bank, cardmem_bank.start >> 16, cardmem_bank.allocated >> 16, 0); #endif - + cpuboard_map(); map_banks (&kickmem_bank, 0xF8, 8, 0); - if (currprefs.maprom) - map_banks (&kickram_bank, currprefs.maprom >> 16, extendedkickmem2_bank.allocated ? 32 : (extendedkickmem_bank.allocated ? 16 : 8), 0); + if (currprefs.maprom) { + if (!cpuboard_maprom()) + map_banks (&kickram_bank, currprefs.maprom >> 16, extendedkickmem2_bank.allocated ? 32 : (extendedkickmem_bank.allocated ? 16 : 8), 0); + } /* map beta Kickstarts at 0x200000/0xC00000/0xF00000 */ if (kickmem_bank.baseaddr[0] == 0x11 && kickmem_bank.baseaddr[2] == 0x4e && kickmem_bank.baseaddr[3] == 0xf9 && kickmem_bank.baseaddr[4] == 0x00) { uae_u32 addr = kickmem_bank.baseaddr[5]; @@ -2364,6 +2382,7 @@ void memory_init (void) memset (kickmem_bank.baseaddr, 0, ROM_SIZE_512); _tcscpy (currprefs.romfile, _T("")); currprefs.romextfile[0] = 0; + cpuboard_reset(0); #ifdef ACTION_REPLAY action_replay_unload (0); @@ -2402,6 +2421,7 @@ void memory_cleanup (void) custmem1_bank.baseaddr = NULL; custmem2_bank.baseaddr = NULL; + cpuboard_cleanup(); #ifdef ACTION_REPLAY action_replay_cleanup(); #endif @@ -2441,7 +2461,7 @@ static void map_banks2 (addrbank *bank, int start, int size, int realsize, int q addrbank *orgbank = bank; uae_u32 realstart = start; - if (!quick) + if (quick <= 0) old = debug_bankchange (-1); flush_icache (0, 3); /* Sure don't want to keep any old mappings around! */ #ifdef NATMEM_OFFSET @@ -2472,7 +2492,7 @@ static void map_banks2 (addrbank *bank, int start, int size, int realsize, int q put_mem_bank (bnr << 16, bank, realstart << 16); real_left--; } - if (!quick) + if (quick <= 0) debug_bankchange (old); return; } @@ -2497,7 +2517,7 @@ static void map_banks2 (addrbank *bank, int start, int size, int realsize, int q real_left--; } } - if (!quick) + if (quick <= 0) debug_bankchange (old); fill_ce_banks (); } @@ -2510,7 +2530,10 @@ void map_banks_quick (addrbank *bank, int start, int size, int realsize) { map_banks2 (bank, start, size, realsize, 1); } - +void map_banks_nojitdirect (addrbank *bank, int start, int size, int realsize) +{ + map_banks2 (bank, start, size, realsize, -1); +} #ifdef SAVESTATE diff --git a/ncr_scsi.cpp b/ncr_scsi.cpp index 52ce69fc..4256fb9b 100644 --- a/ncr_scsi.cpp +++ b/ncr_scsi.cpp @@ -28,19 +28,23 @@ #include "qemuvga\queue.h" #include "qemuvga\scsi\scsi.h" -#define ROM_VECTOR 0x0200 -#define ROM_OFFSET 0x0000 -#define ROM_SIZE 32768 -#define ROM_MASK (ROM_SIZE - 1) #define BOARD_SIZE 16777216 +#define IO_MASK 0xff + +#define A4091_ROM_VECTOR 0x0200 +#define A4091_ROM_OFFSET 0x0000 +#define A4091_ROM_SIZE 32768 +#define A4091_ROM_MASK (A4091_ROM_SIZE - 1) #define A4091_IO_OFFSET 0x00800000 #define A4091_IO_ALT 0x00840000 #define A4091_IO_END 0x00880000 -#define A4091_IO_MASK 0xff #define A4091_DIP_OFFSET 0x008c0003 +#define WARP_ENGINE_IO_OFFSET 0x40000 +#define WARP_ENGINE_IO_END 0x80000 + struct ncr_state { TCHAR *name; @@ -54,11 +58,24 @@ struct ncr_state uae_u32 expamem_lo; int configured; bool enabled; + int rom_start, rom_end, rom_offset; + int io_start, io_end; + addrbank *bank; }; static struct ncr_state ncr_a4091; static struct ncr_state ncr_a4091_2; static struct ncr_state ncr_a4000t; +static struct ncr_state ncr_we; + +static struct ncr_state *ncrs[] = +{ + &ncr_a4091, + &ncr_a4091_2, + &ncr_a4000t, + &ncr_we, + NULL +}; static struct ncr_state *ncra4091[] = { @@ -169,7 +186,7 @@ static uaecptr beswap (uaecptr addr) void ncr_io_bput (struct ncr_state *ncr, uaecptr addr, uae_u32 val) { - addr &= A4091_IO_MASK; + addr &= IO_MASK; lsi_mmio_write (ncr->devobject.lsistate, beswap (addr), val, 1); } @@ -177,14 +194,14 @@ static void ncr_bput2 (struct ncr_state *ncr, uaecptr addr, uae_u32 val) { uae_u32 v = val; addr &= ncr->board_mask; - if (addr < A4091_IO_OFFSET || addr >= A4091_IO_END) + if (addr < ncr->io_start || addr >= ncr->io_end) return; ncr_io_bput (ncr, addr, val); } uae_u32 ncr_io_bget (struct ncr_state *ncr, uaecptr addr) { - addr &= A4091_IO_MASK; + addr &= IO_MASK; return lsi_mmio_read (ncr->devobject.lsistate, beswap (addr), 1); } @@ -193,13 +210,13 @@ static uae_u32 ncr_bget2 (struct ncr_state *ncr, uaecptr addr) uae_u32 v = 0; addr &= ncr->board_mask; - if (ncr->rom && addr >= ROM_VECTOR && addr < A4091_IO_OFFSET) - return read_rombyte (ncr, addr); + if (ncr->rom && addr >= ncr->rom_start && addr < ncr->rom_end) + return read_rombyte (ncr, addr - ncr->rom_offset); if (addr == A4091_DIP_OFFSET) return 0xff; - if (addr < A4091_IO_OFFSET || addr >= A4091_IO_END) + if (addr < ncr->io_start || addr >= ncr->io_end) return v; - addr &= A4091_IO_MASK; + addr &= IO_MASK; return ncr_io_bget (ncr, addr); } @@ -302,7 +319,7 @@ static void REGPARAM2 ncr_wput (struct ncr_state *ncr, uaecptr addr, uae_u32 w) ncr->expamem_hi = w & 0xff00; value = ncr->expamem_hi | (ncr->expamem_lo >> 4); } - map_banks (ncr == &ncr_a4091 ? &ncr_bank_a4091 : &ncr_bank_a4091_2, value, BOARD_SIZE >> 16, 0); + map_banks (ncr->bank, value, BOARD_SIZE >> 16, 0); ncr->board_mask = 0x00ffffff; write_log (_T("%s Z3 autoconfigured at %04X0000\n"), ncr->name, value); ncr->configured = 1; @@ -398,6 +415,31 @@ static uae_u32 REGPARAM2 ncr42_lget (uaecptr addr) return ncr_lget(&ncr_a4091_2, addr); } +static void REGPARAM2 we_bput (uaecptr addr, uae_u32 b) +{ + ncr_bput(&ncr_we, addr, b); +} +static void REGPARAM2 we_wput (uaecptr addr, uae_u32 b) +{ + ncr_wput(&ncr_we, addr, b); +} +static void REGPARAM2 we_lput (uaecptr addr, uae_u32 b) +{ + ncr_lput(&ncr_we, addr, b); +} +static uae_u32 REGPARAM2 we_bget (uaecptr addr) +{ + return ncr_bget(&ncr_we, addr); +} +static uae_u32 REGPARAM2 we_wget (uaecptr addr) +{ + return ncr_wget(&ncr_we, addr); +} +static uae_u32 REGPARAM2 we_lget (uaecptr addr) +{ + return ncr_lget(&ncr_we, addr); +} + static addrbank ncr_bank_a4091 = { ncr4_lget, ncr4_wget, ncr4_bget, ncr4_lput, ncr4_wput, ncr4_bput, @@ -412,8 +454,15 @@ static addrbank ncr_bank_a4091_2 = { dummy_lgeti, dummy_wgeti, ABFLAG_IO }; +static addrbank ncr_bank_warpengine = { + we_lget, we_wget, we_bget, + we_lput, we_wput, we_bput, + default_xlate, default_check, NULL, _T("Warp Engine"), + dummy_lgeti, dummy_wgeti, ABFLAG_IO +}; + -static void ew (struct ncr_state *ncr, int addr, uae_u32 value) +static void ew (struct ncr_state *ncr, int addr, uae_u8 value) { if (addr == 00 || addr == 02 || addr == 0x40 || addr == 0x42) { ncr->acmemory[addr] = (value & 0xf0); @@ -426,12 +475,10 @@ static void ew (struct ncr_state *ncr, int addr, uae_u32 value) void ncr_init (void) { - if (!ncr_a4091.devobject.lsistate) - lsi_scsi_init (&ncr_a4091.devobject); - if (!ncr_a4091_2.devobject.lsistate) - lsi_scsi_init (&ncr_a4091_2.devobject); - if (!ncr_a4000t.devobject.lsistate) - lsi_scsi_init (&ncr_a4000t.devobject); + for (int i = 0; ncrs[i]; i++) { + if (!ncrs[i]->devobject.lsistate) + lsi_scsi_init (&ncrs[i]->devobject); + } } static void ncr_reset_board (struct ncr_state *ncr) @@ -440,31 +487,97 @@ static void ncr_reset_board (struct ncr_state *ncr) ncr->board_mask = 0xffff; if (ncr->devobject.lsistate) lsi_scsi_reset (&ncr->devobject, ncr); - if (ncr == &ncr_a4000t) + if (ncr == &ncr_a4000t) { ncr->name = _T("A4000T NCR SCSI"); - if (ncr == &ncr_a4091) + ncr->bank = NULL; + } + if (ncr == &ncr_a4091) { ncr->name = _T("A4091 SCSI"); - if (ncr == &ncr_a4091_2) + ncr->bank = &ncr_bank_a4091; + } + if (ncr == &ncr_a4091_2) { ncr->name = _T("A4091 SCSI #2"); + ncr->bank = &ncr_bank_a4091_2; + } + if (ncr == &ncr_we) { + ncr->name = _T("Warp Engine"); + ncr->bank = &ncr_bank_warpengine; + } +} + +static const uae_u8 warpengine_a4000_autoconfig[16] = { + 0x90, 0x13, 0x75, 0x00, 0x08, 0x9b, 0x00, 0x19, 0x01, 0x01, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00 +}; +#define WARP_ENGINE_ROM_SIZE 32768 + +addrbank *ncr_warpengine_autoconfig_init(void) +{ + int roms[2]; + struct ncr_state *ncr = &ncr_we; + struct zfile *z = NULL; + + roms[0] = 93; + roms[1] = -1; + + ncr->enabled = true; + memset (ncr->acmemory, 0xff, sizeof ncr->acmemory); + ncr->rom_start = 0x10; + ncr->rom_offset = 0; + ncr->rom_end = WARP_ENGINE_ROM_SIZE * 4; + ncr->io_start = WARP_ENGINE_IO_OFFSET; + ncr->io_start = WARP_ENGINE_IO_END; + + struct romlist *rl = getromlistbyids(roms); + if (rl) { + struct romdata *rd = rl->rd; + z = read_rom (rd); + } + for (int i = 0; i < 16; i++) { + uae_u8 b = warpengine_a4000_autoconfig[i]; + ew(ncr, i * 4, b); + } + ncr->rom = xcalloc (uae_u8, WARP_ENGINE_ROM_SIZE * 4); + if (z) { + for (int i = 0; i < WARP_ENGINE_ROM_SIZE; i++) { + uae_u8 b; + zfile_fread(&b, 1, 1, z); + ncr->rom[i * 4 + 0] = b | 0x0f; + ncr->rom[i * 4 + 1] = 0xff; + ncr->rom[i * 4 + 2] = (b << 4) | 0x0f; + ncr->rom[i * 4 + 3] = 0xff; + } + zfile_fclose(z); + } else { + romwarning (roms); + } + + ncr_init (); + ncr_reset_board(ncr); + + return &ncr_bank_warpengine; } -void ncr_autoconfig_init (int devnum) +addrbank *ncr_a4091_autoconfig_init (int devnum) { struct ncr_state *ncr = ncra4091[devnum]; int roms[3]; - int i; if (!ncr->enabled && devnum > 0) { expamem_next(); - return; + return NULL; } - ncr->enabled = true; roms[0] = 58; roms[1] = 57; roms[2] = -1; + ncr->enabled = true; memset (ncr->acmemory, 0xff, sizeof ncr->acmemory); + ncr->rom_start = A4091_ROM_VECTOR; + ncr->rom_offset = A4091_ROM_OFFSET; + ncr->rom_end = A4091_IO_OFFSET; + ncr->io_start = A4091_IO_OFFSET; + ncr->io_end = A4091_IO_END; struct zfile *z = read_rom_name (devnum && currprefs.a4091romfile2[0] ? currprefs.a4091romfile2 : currprefs.a4091romfile); if (!z) { @@ -476,8 +589,8 @@ void ncr_autoconfig_init (int devnum) } if (z) { write_log (_T("%s BOOT ROM '%s'\n"), ncr->name, zfile_getname (z)); - ncr->rom = xmalloc (uae_u8, ROM_SIZE * 4); - for (i = 0; i < ROM_SIZE; i++) { + ncr->rom = xmalloc (uae_u8, A4091_ROM_SIZE * 4); + for (int i = 0; i < A4091_ROM_SIZE; i++) { uae_u8 b; zfile_fread (&b, 1, 1, z); ncr->rom[i * 4 + 0] = b; @@ -495,7 +608,8 @@ void ncr_autoconfig_init (int devnum) ncr_init (); ncr_reset_board(ncr); - map_banks (ncr == &ncr_a4091 ? &ncr_bank_a4091 : &ncr_bank_a4091_2, 0xe80000 >> 16, 65536 >> 16, 0); + + return ncr == &ncr_a4091 ? &ncr_bank_a4091 : &ncr_bank_a4091_2; } static void freescsi_hdf (struct scsi_data *sd) @@ -524,16 +638,16 @@ void ncr_free2(struct ncr_state *ncr) void ncr_free(void) { - ncr_free2(&ncr_a4000t); - ncr_free2(&ncr_a4091); - ncr_free2(&ncr_a4091_2); + for (int i = 0; ncrs[i]; i++) { + ncr_free2(ncrs[i]); + } } void ncr_reset (void) { - ncr_reset_board(&ncr_a4091); - ncr_reset_board(&ncr_a4091_2); - ncr_reset_board(&ncr_a4000t); + for (int i = 0; ncrs[i]; i++) { + ncr_reset_board(ncrs[i]); + } if (currprefs.cs_mbdmac & 2) { ncr_a4000t.configured = -1; ncr_a4000t.enabled = true; @@ -604,6 +718,16 @@ int a4000t_add_scsi_unit (int ch, struct uaedev_config_info *ci) return add_ncr_scsi_hd (&ncr_a4000t, ch, NULL, ci, 1); } +int warpengine_add_scsi_unit (int ch, struct uaedev_config_info *ci) +{ + if (ci->type == UAEDEV_CD) + return add_ncr_scsi_cd (&ncr_we, ch, ci->device_emu_unit); + else if (ci->type == UAEDEV_TAPE) + return add_ncr_scsi_tape (&ncr_we, ch, ci->rootdir, ci->readonly); + else + return add_ncr_scsi_hd (&ncr_we, ch, NULL, ci, 1); +} + int a4091_add_scsi_unit (int ch, struct uaedev_config_info *ci, int devnum) { struct ncr_state *ncr = ncra4091[devnum]; diff --git a/newcpu.cpp b/newcpu.cpp index 9d55aa53..1d88a40c 100644 --- a/newcpu.cpp +++ b/newcpu.cpp @@ -36,6 +36,7 @@ #include "inputdevice.h" #include "audio.h" #include "md-fpp.h" +#include "statusline.h" #ifdef JIT #include "jit/compemu.h" #include @@ -1398,7 +1399,7 @@ void init_m68k (void) struct regstruct regs, mmu_backup_regs; struct flag_struct regflags; -static long int m68kpc_offset; +static int m68kpc_offset; #if 0 #define get_ibyte_1(o) get_byte (regs.pc + (regs.pc_p - regs.pc_oldp) + (o) + 1) @@ -4263,6 +4264,7 @@ void m68k_go (int may_quit) savestate_check (); if (input_record == INPREC_RECORD_START) input_record = INPREC_RECORD_NORMAL; + statusline_clear(); } else { if (input_record == INPREC_RECORD_START) { input_record = INPREC_RECORD_NORMAL; @@ -4348,8 +4350,6 @@ void m68k_go (int may_quit) } #endif unset_special(SPCFLAG_MODE_CHANGE); - unset_special(SPCFLAG_BRK); - //activate_debugger(); run_func(); } protect_roms (false); diff --git a/od-win32/direct3d.cpp b/od-win32/direct3d.cpp index 58c14f62..a945bfa6 100644 --- a/od-win32/direct3d.cpp +++ b/od-win32/direct3d.cpp @@ -1287,7 +1287,11 @@ static void updateleds (void) } for (y = 0; y < TD_TOTAL_HEIGHT; y++) { uae_u8 *buf = (uae_u8*)locked.pBits + y * locked.Pitch; - memset (buf, 0, ledwidth * 4); + statusline_single_erase(buf, 32 / 8, y, ledwidth); + } + statusline_render((uae_u8*)locked.pBits, 32 / 8, locked.Pitch, ledwidth, ledheight, rc, gc, bc, a); + for (y = 0; y < TD_TOTAL_HEIGHT; y++) { + uae_u8 *buf = (uae_u8*)locked.pBits + y * locked.Pitch; draw_status_line_single (buf, 32 / 8, y, ledwidth, rc, gc, bc, a); } ledtexture->UnlockRect (0); diff --git a/od-win32/fsdb_mywin32.cpp b/od-win32/fsdb_mywin32.cpp index b5328708..d59cc99b 100644 --- a/od-win32/fsdb_mywin32.cpp +++ b/od-win32/fsdb_mywin32.cpp @@ -1018,3 +1018,16 @@ bool my_resolvesoftlink(TCHAR *linkfile, int size) } return false; } + +const TCHAR *my_getfilepart(const TCHAR *filename) +{ + const TCHAR *p; + + p = _tcsrchr(filename, '\\'); + if (p) + return p + 1; + p = _tcsrchr(filename, '/'); + if (p) + return p + 1; + return p; +} \ No newline at end of file diff --git a/od-win32/genlinetoscr_msvc/genlinetoscr_msvc.vcxproj b/od-win32/genlinetoscr_msvc/genlinetoscr_msvc.vcxproj index 547e83db..95480729 100644 --- a/od-win32/genlinetoscr_msvc/genlinetoscr_msvc.vcxproj +++ b/od-win32/genlinetoscr_msvc/genlinetoscr_msvc.vcxproj @@ -112,6 +112,7 @@ Level3 ProgramDatabase + ..\..\include;..\..;..\ deleteing linetoscr.cpp diff --git a/od-win32/parser.cpp b/od-win32/parser.cpp index fab2388f..dedf2754 100644 --- a/od-win32/parser.cpp +++ b/od-win32/parser.cpp @@ -1111,7 +1111,7 @@ void writeser (int c) BYTE outchar = (BYTE)c; Midi_Parse (midi_output, &outchar); } else { - if (!currprefs.use_serial) + if (hCom == INVALID_HANDLE_VALUE || !currprefs.use_serial) return; if (datainoutput + 1 < sizeof (outputbuffer)) { outputbuffer[datainoutput++] = c; @@ -1517,6 +1517,14 @@ int enumserialports (void) } + if (cnt < MAX_SERPAR_PORTS) { + comports[cnt] = xcalloc(struct serparportinfo, 1); + comports[cnt]->dev = my_strdup (SERIAL_INTERNAL); + comports[cnt]->cfgname = my_strdup (comports[cnt]->dev); + comports[cnt]->name = my_strdup (_T("WinUAE inter-process serial port")); + cnt++; + } + if (cnt < MAX_SERPAR_PORTS) { comports[cnt] = xcalloc(struct serparportinfo, 1); comports[cnt]->dev = my_strdup (_T("TCP://0.0.0.0:1234")); diff --git a/od-win32/parser.h b/od-win32/parser.h index 1317ccfb..367ad527 100644 --- a/od-win32/parser.h +++ b/od-win32/parser.h @@ -23,6 +23,12 @@ void flushprinter (void); int checkserwrite (void); void serialuartbreak (int); +void shmem_serial_delete(void); +bool shmem_serial_create(void); +int shmem_serial_state(void); + +#define SERIAL_INTERNAL _T("INTERNAL_SERIAL") + #define TIOCM_CAR 1 #define TIOCM_DSR 2 #define TIOCM_RI 4 diff --git a/od-win32/picasso96_win.cpp b/od-win32/picasso96_win.cpp index 0595c32f..1acc2740 100644 --- a/od-win32/picasso96_win.cpp +++ b/od-win32/picasso96_win.cpp @@ -3766,6 +3766,8 @@ void picasso_statusline (uae_u8 *dst) dst_width = picasso_vidinfo.width; pitch = picasso_vidinfo.rowbytes; statusline_getpos (&slx, &sly, picasso96_state.Width, dst_height); + if (currprefs.gfx_api) + statusline_render(dst + sly * pitch, picasso_vidinfo.pixbytes, pitch, dst_width, dst_height, p96rc, p96gc, p96bc, NULL); yy = 0; for (y = 0; y < TD_TOTAL_HEIGHT; y++) { uae_u8 *buf = dst + (y + sly) * pitch; @@ -4249,8 +4251,9 @@ bool picasso_flushpixels (uae_u8 *src, int off) lock = 1; } if (dst) { - if (!(currprefs.leds_on_screen & STATUSLINE_TARGET)) + if (!(currprefs.leds_on_screen & STATUSLINE_TARGET)) { picasso_statusline (dst); + } maxy = picasso_vidinfo.height; if (miny > picasso_vidinfo.height - TD_TOTAL_HEIGHT) miny = picasso_vidinfo.height - TD_TOTAL_HEIGHT; diff --git a/od-win32/resources/resource.h b/od-win32/resources/resource.h index b3397d9d..ead52eb1 100644 --- a/od-win32/resources/resource.h +++ b/od-win32/resources/resource.h @@ -459,6 +459,7 @@ #define IDC_Z3CHIPMEM 1052 #define IDC_Z3CHIPRAM 1053 #define IDC_MAX32RAM 1054 +#define IDC_CPUBOARDRAM 1055 #define IDC_UAEHOME 1070 #define IDC_PICASSOHOME 1071 #define IDC_AMIGAHOME 1072 @@ -738,11 +739,13 @@ #define IDC_MINIMIZED_NOSOUND 1530 #define IDC_MINIMIZED_PAUSE 1531 #define IDC_STATEREC_RECORD 1532 +#define IDC_INACTIVE_NOJOY 1532 #define IDC_KBLED_USB 1533 #define IDC_ACTIVE_PAUSE 1534 #define IDC_KBLED_USB2 1534 #define IDC_ACTIVE_NOSOUND 1535 #define IDC_STATECLEAR 1536 +#define IDC_MINIMIZED_NOJOY 1537 #define IDC_SER_SHARED 1553 #define IDC_GUI_RESIZE 1553 #define IDC_SER_CTSRTS 1554 @@ -910,6 +913,7 @@ #define IDC_SOUNDCARDLIST 1651 #define IDC_STATE_BUFFERSIZE2 1651 #define IDC_STATEREC_BUFFERSIZE 1651 +#define IDC_DISKLISTREMOVEALL 1651 #define IDC_SOUNDFREQ 1652 #define IDC_STATEREC_AUTOPLAY 1652 #define IDC_SOUNDFREQTXT 1653 @@ -1196,6 +1200,8 @@ #define IDC_FILTER_NATIVERTG 1839 #define IDC_P96MEM 1840 #define IDC_DA_SLIDER 1841 +#define IDC_CPUBOARD_TYPE 1842 +#define IDC_CPUBOARDMEM 1843 #define ID__FLOPPYDRIVES 40004 #define ID_FLOPPYDRIVES_DF0 40005 #define ID_ST_CONFIGURATION 40010 @@ -1247,7 +1253,7 @@ #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 398 #define _APS_NEXT_COMMAND_VALUE 40050 -#define _APS_NEXT_CONTROL_VALUE 1840 +#define _APS_NEXT_CONTROL_VALUE 1841 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index 2e33091d..582f25c8 100644 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -170,7 +170,7 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,155,154,124,10 END -IDD_MEMORY DIALOGEX 0, 0, 396, 242 +IDD_MEMORY DIALOGEX 0, 0, 396, 290 STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD EXSTYLE WS_EX_CONTEXTHELP FONT 8, "MS Sans Serif", 0, 0, 0x1 @@ -193,18 +193,23 @@ BEGIN CONTROL "",IDC_Z3CHIPMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,248,71,60,20 EDITTEXT IDC_Z3CHIPRAM,311,76,40,12,ES_CENTER | ES_READONLY EDITTEXT IDC_MAX32RAM,14,99,366,12,ES_CENTER | ES_READONLY - GROUPBOX "Advanced Memory Settings",IDC_STATIC,0,130,393,109 - RTEXT "Motherboard Fast:",IDC_STATIC,14,149,129,10,SS_CENTERIMAGE - CONTROL "",IDC_MBMEM1,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,149,145,68,20 - EDITTEXT IDC_MBRAM1,224,148,40,12,ES_CENTER | ES_READONLY - RTEXT "Processor Slot Fast:",IDC_STATIC,14,172,129,10,SS_CENTERIMAGE - CONTROL "",IDC_MBMEM2,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,149,168,68,20 - EDITTEXT IDC_MBRAM2,224,171,40,12,ES_CENTER | ES_READONLY - CONTROL "",IDC_FASTMEM2,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,149,193,68,20 - EDITTEXT IDC_FASTRAM2,224,196,40,12,ES_CENTER | ES_READONLY - RTEXT "Second Z2 Fast RAM board:",IDC_STATIC,27,194,116,15,SS_CENTERIMAGE + GROUPBOX "Advanced Memory Settings",IDC_STATIC,0,133,393,147 + RTEXT "Motherboard Fast:",IDC_STATIC,116,149,129,10,SS_CENTERIMAGE + CONTROL "",IDC_MBMEM1,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,251,145,68,20 + EDITTEXT IDC_MBRAM1,326,148,40,12,ES_CENTER | ES_READONLY + RTEXT "Processor Slot Fast:",IDC_STATIC,116,172,129,10,SS_CENTERIMAGE + CONTROL "",IDC_MBMEM2,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,251,168,68,20 + EDITTEXT IDC_MBRAM2,326,171,40,12,ES_CENTER | ES_READONLY + CONTROL "",IDC_FASTMEM2,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,251,193,68,20 + EDITTEXT IDC_FASTRAM2,326,196,40,12,ES_CENTER | ES_READONLY CONTROL "JIT Direct compatible Z3 memory mapping",IDC_Z3REALMAPPING, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,180,220,186,10 + COMBOBOX IDC_CPUBOARD_TYPE,25,257,89,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + RTEXT "Second Z2 Fast RAM board:",IDC_STATIC,129,194,116,15,SS_CENTERIMAGE + RTEXT "Accelerator board memory:",IDC_STATIC,129,257,116,15,SS_CENTERIMAGE + CONTROL "",IDC_CPUBOARDMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,251,253,68,20 + EDITTEXT IDC_CPUBOARDRAM,326,256,40,12,ES_CENTER | ES_READONLY + CTEXT "Accelerator board emulation is not JIT Direct compatible.",IDC_STATIC,25,238,341,15,SS_CENTERIMAGE END IDD_CPU DIALOGEX 0, 0, 396, 283 @@ -861,40 +866,43 @@ BEGIN COMBOBOX IDC_HDF_CONTROLLER_UNIT,179,89,25,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP END -IDD_MISC2 DIALOGEX 0, 0, 396, 263 +IDD_MISC2 DIALOGEX 0, 0, 396, 278 STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN - GROUPBOX "When Active",IDC_STATIC,1,7,125,91 + GROUPBOX "When Active",IDC_STATIC,1,7,125,105 CTEXT "Run at priority:",IDC_ACTIVE_PRI,10,18,108,10,SS_CENTERIMAGE | WS_TABSTOP COMBOBOX IDC_ACTIVE_PRIORITY,10,33,108,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CTEXT "Mouse uncaptured:",IDC_STATIC,10,50,101,15,SS_CENTERIMAGE CONTROL "Pause emulation",IDC_ACTIVE_PAUSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,67,109,10 CONTROL "Disable sound",IDC_ACTIVE_NOSOUND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,81,109,10 - GROUPBOX "When Inactive",IDC_STATIC,133,7,126,90 + GROUPBOX "When Inactive",IDC_STATIC,133,7,126,105 CTEXT "Run at priority:",IDC_INACTIVE_PRI,144,18,107,10,SS_CENTERIMAGE | WS_TABSTOP COMBOBOX IDC_INACTIVE_PRIORITY,144,33,108,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "Pause emulation",IDC_INACTIVE_PAUSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,143,67,109,10 CONTROL "Disable sound",IDC_INACTIVE_NOSOUND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,143,81,109,10 - GROUPBOX "When Minimized",IDC_STATIC,269,7,125,89 + GROUPBOX "When Minimized",IDC_STATIC,269,7,125,105 CTEXT "Run at priority:",IDC_MINIMIZED_PRI,278,19,109,10,SS_CENTERIMAGE | WS_TABSTOP COMBOBOX IDC_MINIMIZED_PRIORITY,278,33,108,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "Pause emulation",IDC_MINIMIZED_PAUSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,280,67,108,10 CONTROL "Disable sound",IDC_MINIMIZED_NOSOUND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,280,81,108,10 - GROUPBOX "File Extension Associations",IDC_STATIC,0,107,260,155 - CONTROL "",IDC_ASSOCIATELIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,9,124,238,108 - PUSHBUTTON "Associate all",IDC_ASSOCIATE_ON,36,240,85,14 - PUSHBUTTON "Deassociate all",IDC_ASSOCIATE_OFF,125,240,85,14 + GROUPBOX "File Extension Associations",IDC_STATIC,0,120,260,155 + CONTROL "",IDC_ASSOCIATELIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,9,137,238,108 + PUSHBUTTON "Associate all",IDC_ASSOCIATE_ON,36,253,85,14 + PUSHBUTTON "Deassociate all",IDC_ASSOCIATE_OFF,125,253,85,14 + CONTROL "Disable game controllers",IDC_INACTIVE_NOJOY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,143,95,109,10 + CONTROL "Disable game controllers",IDC_MINIMIZED_NOJOY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,280,95,107,10 END IDD_DISK DIALOGEX 0, 0, 396, 318 STYLE DS_LOCALEDIT | DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_CONTROL | DS_CENTER | DS_CENTERMOUSE | WS_CHILD FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN - PUSHBUTTON "Insert floppy disk image",IDC_DISKLISTINSERT,72,299,121,15 - PUSHBUTTON "Remove floppy disk image",IDC_DISKLISTREMOVE,202,299,121,15 + PUSHBUTTON "Insert floppy disk image",IDC_DISKLISTINSERT,8,299,121,15 + PUSHBUTTON "Remove floppy disk image",IDC_DISKLISTREMOVE,137,299,121,15 COMBOBOX IDC_DISKTEXT,1,281,393,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP CONTROL "",IDC_DISKLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,1,4,393,275 + PUSHBUTTON "Remove all",IDC_DISKLISTREMOVEALL,266,299,121,15 END IDD_PANEL DIALOGEX 0, 0, 530, 345 @@ -1364,7 +1372,7 @@ BEGIN IDD_MEMORY, DIALOG BEGIN - BOTTOMMARGIN, 239 + BOTTOMMARGIN, 287 END IDD_CPU, DIALOG @@ -1451,6 +1459,7 @@ BEGIN IDD_MISC2, DIALOG BEGIN + BOTTOMMARGIN, 263 END IDD_DISK, DIALOG diff --git a/od-win32/serial_win32.cpp b/od-win32/serial_win32.cpp index 5be24773..e4633b64 100644 --- a/od-win32/serial_win32.cpp +++ b/od-win32/serial_win32.cpp @@ -26,6 +26,131 @@ #include "od-win32/parser.h" +#define SERMAP_SIZE 256 +struct sermap_buffer +{ + volatile ULONG version; + volatile uae_u32 active_read; + volatile uae_u32 active_write; + volatile uae_u32 read_offset; + volatile uae_u32 write_offset; + volatile uae_u16 data[SERMAP_SIZE]; +}; +static struct sermap_buffer *sermap1, *sermap2; +static HANDLE sermap_handle; +static uae_u8 *sermap_data; +static bool sermap_master; +static bool sermap_enabled; + +#define SER_MEMORY_MAPPING _T("WinUAE_Serial") + +static void shmem_serial_send(uae_u16 data) +{ + uae_u32 v; + + sermap1->active_write = true; + if (!sermap1->active_read) + return; + v = sermap1->write_offset; + if (((v + 1) & (SERMAP_SIZE - 1)) == sermap1->read_offset) { + write_log(_T("Shared serial port memory overflow!\n")); + return; + } + sermap1->data[v] = data; + v++; + v &= (SERMAP_SIZE - 1); + sermap1->write_offset = v; +} +static uae_u16 shmem_serial_receive(void) +{ + uae_u32 v; + uae_u16 data; + sermap2->active_read = true; + if (!sermap2->active_write) + return 0xffff; + v = sermap2->read_offset; + if (v == sermap2->write_offset) + return 0xffff; + data = sermap2->data[v]; + v++; + v &= (SERMAP_SIZE - 1); + sermap2->read_offset = v; + return data; +} + +static void sermap_deactivate(void) +{ + sermap_enabled = false; + if (sermap1) { + sermap1->active_write = 0; + sermap1->write_offset = sermap1->read_offset; + } + if (sermap2) { + sermap2->active_read = 0; + sermap2->read_offset = sermap2->write_offset; + } +} + +int shmem_serial_state(void) +{ + if (!sermap_handle) + return 0; + if (sermap_master) + return 1; + return 2; +} + +void shmem_serial_delete(void) +{ + sermap_deactivate(); + sermap_master = false; + if (sermap_data) + UnmapViewOfFile(sermap_data); + if (sermap_handle) + CloseHandle(sermap_handle); + sermap_data = NULL; + sermap_handle = NULL; + sermap1 = sermap2 = NULL; +} + +bool shmem_serial_create(void) +{ + shmem_serial_delete(); + sermap_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, SER_MEMORY_MAPPING); + if (!sermap_handle) { + sermap_handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(struct sermap_buffer) * 2, SER_MEMORY_MAPPING); + if (!sermap_handle) { + write_log(_T("Failed to create shared serial port memory: %d\n"), GetLastError()); + return false; + } + sermap_master = true; + write_log(_T("Created internal serial port shared memory\n")); + } else { + write_log(_T("Found already existing serial port shared memory\n")); + } + sermap_data = (uae_u8*)MapViewOfFile(sermap_handle, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(struct sermap_buffer) * 2); + if (!sermap_data) { + write_log(_T("Shared serial port memory MapViewOfFile() failed: %d\n"), GetLastError()); + return false; + } + if (sermap_master) { + sermap1 = (struct sermap_buffer*)sermap_data; + sermap2 = (struct sermap_buffer*)(sermap_data + sizeof(struct sermap_buffer)); + sermap1->version = version; + sermap2->version = version; + } + else { + sermap2 = (struct sermap_buffer*)sermap_data; + sermap1 = (struct sermap_buffer*)(sermap_data + sizeof(struct sermap_buffer)); + if (sermap2->version != version || sermap1->version != version) { + write_log(_T("Shared serial port memory version mismatch %08x != %08x\n"), sermap1->version, version); + shmem_serial_delete(); + return false; + } + } + return true; +} + #define SERIALLOGGING 0 #define SERIALDEBUG 0 /* 0, 1, 2 3 */ #define SERIALHSDEBUG 0 @@ -39,6 +164,8 @@ static int ovrun; static int dtr; static int serial_period_hsyncs, serial_period_hsync_counter; static int ninebit; +static int lastbitcycle_active_hsyncs; +static unsigned int lastbitcycle; int serdev; int seriallog = 0, log_sercon = 0; int serial_enet; @@ -80,7 +207,7 @@ void SERPER (uae_u16 w) i++; baud = allowed_baudrates[i]; - serial_period_hsyncs = (((serper & 0x7fff) + 1) * 10) / maxhpos; + serial_period_hsyncs = (((serper & 0x7fff) + 1) * (1 + 8 + ninebit + 1 - 1)) / maxhpos; if (serial_period_hsyncs <= 0) serial_period_hsyncs = 1; @@ -122,23 +249,10 @@ static TCHAR dochar (int v) static void checkreceive_enet (int mode) { #ifdef SERIAL_ENET - static uae_u32 lastchartime; - struct timeval tv; uae_u16 recdata; if (!enet_readseravail ()) return; - if (data_in_serdatr) { - /* probably not needed but there may be programs that expect OVRUNs.. */ - gettimeofday (&tv, NULL); - if (tv.tv_sec > lastchartime) { - ovrun = 1; - INTREQ (0x8000 | 0x0800); - while (enet_readser (&recdata)); - write_log (_T("SERIAL: overrun\n")); - } - return; - } if (!enet_readser (&recdata)) return; serdatr = recdata & 0x1ff; @@ -146,8 +260,6 @@ static void checkreceive_enet (int mode) serdatr |= 0x200; else serdatr |= 0x100; - gettimeofday (&tv, NULL); - lastchartime = tv.tv_sec + 5; data_in_serdatr = 1; serial_check_irq (); #if SERIALDEBUG > 2 @@ -159,25 +271,11 @@ static void checkreceive_enet (int mode) static void checkreceive_serial (int mode) { #ifdef SERIAL_PORT - static uae_u32 lastchartime; static int ninebitdata; - struct timeval tv; int recdata; - if (!readseravail ()) - return; - - if (data_in_serdatr) { - /* probably not needed but there may be programs that expect OVRUNs.. */ - gettimeofday (&tv, NULL); - if (tv.tv_sec > lastchartime) { - ovrun = 1; - INTREQ (0x8000 | 0x0800); - while (readser (&recdata)); - write_log (_T("SERIAL: overrun\n")); - } + if (!readseravail()) return; - } if (ninebit) { for (;;) { @@ -205,8 +303,6 @@ static void checkreceive_serial (int mode) serdatr = recdata; serdatr |= 0x100; } - gettimeofday (&tv, NULL); - lastchartime = tv.tv_sec + 5; data_in_serdatr = 1; serial_check_irq (); #if SERIALDEBUG > 2 @@ -215,42 +311,89 @@ static void checkreceive_serial (int mode) #endif } -static void checksend (int mode) -{ - int bufstate = 0; -#ifdef SERIAL_PORT - bufstate = checkserwrite (); -#endif -#ifdef SERIAL_ENET - if (serial_enet) - bufstate = 1; -#endif - if (!data_in_serdat && !data_in_sershift) - return; +static void serdatcopy(void); - if (data_in_sershift && mode == 0 && bufstate) - data_in_sershift = 0; +static void checksend(void) +{ + if (data_in_sershift != 1) + return; - if (data_in_serdat && !data_in_sershift) { - data_in_sershift = 1; - serdatshift = serdat; + if (sermap_data && sermap_enabled) + shmem_serial_send(serdatshift); #ifdef SERIAL_ENET - if (serial_enet) { - enet_writeser (serdatshift); - } + if (serial_enet) + enet_writeser(serdatshift); #endif #ifdef SERIAL_PORT + if (checkserwrite()) { if (ninebit) - writeser (((serdatshift >> 8) & 1) | 0xa8); - writeser (serdatshift); + writeser(((serdatshift >> 8) & 1) | 0xa8); + writeser(serdatshift); + } #endif - data_in_serdat = 0; - INTREQ (0x8000 | 0x0001); + data_in_sershift = 2; + #if SERIALDEBUG > 2 - write_log (_T("SERIAL: send %04X (%c)\n"), serdatshift, dochar (serdatshift)); + write_log(_T("SERIAL: send %04X (%c)\n"), serdatshift, dochar(serdatshift)); #endif +} + +static void sersend_ce(uae_u32 v) +{ + checksend(); + data_in_sershift = 0; + serdatcopy(); + lastbitcycle = get_cycles() + ((serper & 0x7fff) + 1) * CYCLE_UNIT; + lastbitcycle_active_hsyncs = ((serper & 0x7fff) + 1) / maxhpos + 2; +} + +static void serdatcopy(void) +{ + if (data_in_sershift || !data_in_serdat) + return; + serdatshift = serdat; + data_in_sershift = 1; + data_in_serdat = 0; + INTREQ(0x8000 | 0x0001); // Transmit buffer empty + checksend(); + + if (seriallog) + write_log(_T("%c"), dochar(serdatshift)); + + if (serper == 372) { + if (enforcermode & 2) { + console_out_f(_T("%c"), dochar(serdatshift)); + if (serdatshift == 256 + 10) + console_out(_T("\n")); + } } + + // if someone uses serial port as some kind of timer.. + if (currprefs.cpu_cycle_exact) { + int per, bits; + + bits = 16 + 1; + for (int i = 15; i >= 0; i--) { + if (serdatshift & (1 << i)) + break; + bits--; + } + // assuming when last bit goes out, transmit buffer + // becomes empty, not when last bit has finished + // transmitting. + per = ((serper & 0x7fff) + 1) * (bits - 1); + if (lastbitcycle_active_hsyncs) { + // if last bit still transmitting, add remaining time. + int extraper = (lastbitcycle - get_cycles()) / CYCLE_UNIT; + if (extraper > 0) + per += extraper; + } + if (per < 4) + per = 4; + event2_newevent_x(-1, per, 0, sersend_ce); + } + } void serial_hsynchandler (void) @@ -259,6 +402,16 @@ void serial_hsynchandler (void) extern void hsyncstuff(void); hsyncstuff(); #endif + if (lastbitcycle_active_hsyncs > 0) + lastbitcycle_active_hsyncs--; + if (sermap2 && sermap_enabled && !data_in_serdatr) { + uae_u16 v = shmem_serial_receive(); + if (v != 0xffff) { + serdatr = v; + data_in_serdatr = 1; + serial_check_irq(); + } + } if (serial_period_hsyncs == 0) return; serial_period_hsync_counter++; @@ -266,15 +419,20 @@ void serial_hsynchandler (void) checkreceive_serial (0); checkreceive_enet (0); } - if ((serial_period_hsync_counter % serial_period_hsyncs) == 0) - checksend (0); + if ((serial_period_hsync_counter % serial_period_hsyncs) == 0 && !currprefs.cpu_cycle_exact) { + checksend(); + if (data_in_sershift == 2) { + data_in_sershift = 0; + serdatcopy(); + } + } } void SERDAT (uae_u16 w) { serdat = w; - if (!(w & 0x3ff)) { + if (!w) { #if SERIALDEBUG > 1 write_log (_T("SERIAL: zero serial word written?! PC=%x\n"), M68K_GETPC); #endif @@ -287,26 +445,12 @@ void SERDAT (uae_u16 w) } #endif - if (seriallog) - write_log (_T("%c"), dochar (w)); - - if (serper == 372) { - if (enforcermode & 2) { - console_out_f (_T("%c"), dochar (w)); - if (w == 256 + 10) - console_out (_T("\n")); - } - } - data_in_serdat = 1; - if (!data_in_sershift) - checksend (1); + serdatcopy(); #if SERIALDEBUG > 2 write_log (_T("SERIAL: wrote 0x%04x (%c) PC=%x\n"), w, dochar (w), M68K_GETPC); #endif - - return; } uae_u16 SERDATR (void) @@ -511,6 +655,8 @@ void serial_open (void) serper = 0; if (enet_is (currprefs.sername)) { enet_open (currprefs.sername); + } else if (!_tcsicmp(currprefs.sername, SERIAL_INTERNAL)) { + sermap_enabled = true; } else { if(!openser (currprefs.sername)) { write_log (_T("SERIAL: Could not open device %s\n"), currprefs.sername); @@ -527,6 +673,7 @@ void serial_close (void) closeser (); enet_close (); serdev = 0; + sermap_deactivate(); #endif } @@ -771,4 +918,4 @@ int enet_readser (uae_u16 *data) enet_receive_off_r &= 0xff; return 1; } -#endif \ No newline at end of file +#endif diff --git a/od-win32/statusline_win32.cpp b/od-win32/statusline_win32.cpp new file mode 100644 index 00000000..de9d344d --- /dev/null +++ b/od-win32/statusline_win32.cpp @@ -0,0 +1,147 @@ +#include "sysconfig.h" + +#include +#include + +#include "sysdeps.h" + +#include "options.h" +#include "uae.h" +#include "win32.h" +#include "picasso96_win.h" +#include "win32gfx.h" +#include "statusline.h" + +static HDC statusline_hdc; +static HBITMAP statusline_bitmap; +static void *statusline_bm; +static int statusline_width; +static int statusline_height = TD_TOTAL_HEIGHT; +static HFONT statusline_font; +static HPALETTE statusline_palette; +static bool statusline_was_updated; + +void deletestatusline(void) +{ + if (!statusline_hdc) + return; + if (!statusline_bitmap) + DeleteObject(statusline_bitmap); + if (statusline_hdc) + ReleaseDC(NULL, statusline_hdc); + if (statusline_font) + DeleteObject(statusline_font); + if (statusline_palette) + DeleteObject(statusline_palette); + statusline_bitmap = NULL; + statusline_hdc = NULL; + statusline_font = NULL; + statusline_palette = NULL; + statusline_clear(); +} + +bool createstatusline(void) +{ + BITMAPINFO *bi; + BITMAPINFOHEADER *bih; + LOGPALETTE *lp; + + deletestatusline(); + statusline_hdc = CreateCompatibleDC(NULL); + if (!statusline_hdc) + return false; + lp = (LOGPALETTE*)xcalloc(uae_u8, sizeof(LOGPALETTE) + 3 * sizeof(PALETTEENTRY)); + lp->palNumEntries = 4; + lp->palVersion = 0x300; + lp->palPalEntry[1].peBlue = lp->palPalEntry[1].peGreen = lp->palPalEntry[0].peRed = 0x10; + lp->palPalEntry[2].peBlue = lp->palPalEntry[2].peGreen = lp->palPalEntry[2].peRed = 0xff; + lp->palPalEntry[3].peBlue = lp->palPalEntry[3].peGreen = lp->palPalEntry[3].peRed = 0x7f; + statusline_palette = CreatePalette(lp); + SelectPalette(statusline_hdc, statusline_palette, FALSE); + statusline_width = (WIN32GFX_GetWidth() + 31) & ~31; + bi = (BITMAPINFO*)xcalloc(uae_u8, sizeof(BITMAPINFOHEADER) + 4 * sizeof(RGBQUAD)); + bih = &bi->bmiHeader; + bih->biSize = sizeof(BITMAPINFOHEADER); + bih->biWidth = statusline_width; + bih->biHeight = -statusline_height; + bih->biPlanes = 1; + bih->biBitCount = 8; + bih->biCompression = BI_RGB; + bih->biClrUsed = 4; + bih->biClrImportant = 4; + bi->bmiColors[1].rgbBlue = bi->bmiColors[1].rgbGreen = bi->bmiColors[1].rgbRed = 0x10; + bi->bmiColors[2].rgbBlue = bi->bmiColors[2].rgbGreen = bi->bmiColors[2].rgbRed = 0xff; + bi->bmiColors[3].rgbBlue = bi->bmiColors[3].rgbGreen = bi->bmiColors[3].rgbRed = 0x7f; + statusline_bitmap = CreateDIBSection(statusline_hdc, bi, DIB_RGB_COLORS, &statusline_bm, NULL, 0); + xfree(bi); + if (!statusline_bitmap) { + deletestatusline(); + return false; + } + SelectObject(statusline_hdc, statusline_bitmap); + RealizePalette(statusline_hdc); + + statusline_font = CreateFont(-10, 0, + 0, 0, + FW_NORMAL, + FALSE, + FALSE, + FALSE, + DEFAULT_CHARSET, + OUT_TT_PRECIS, + CLIP_DEFAULT_PRECIS, + PROOF_QUALITY, + VARIABLE_PITCH | FF_DONTCARE, + _T("Verdana")); + SelectObject(statusline_hdc, statusline_font); + SetTextColor(statusline_hdc, PALETTEINDEX(2)); + SetBkColor(statusline_hdc, PALETTEINDEX(1)); + SetBkMode(statusline_hdc, OPAQUE); + return true; +} + +void statusline_updated(void) +{ + statusline_was_updated = true; + if (hStatusWnd) + PostMessage(hStatusWnd, SB_SETTEXT, (WPARAM)((window_led_msg_start) | SBT_OWNERDRAW), (LPARAM)_T("")); +} + +void statusline_render(uae_u8 *buf, int bpp, int pitch, int width, int height, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc, uae_u32 *alpha) +{ + uae_u32 white = rc[0xff] | gc[0xff] | bc[0xff] | (alpha ? alpha[0xff] : 0); + uae_u32 back = rc[0x00] | gc[0x00] | bc[0x00] | (alpha ? alpha[0xa0] : 0); + const TCHAR *text; + int y = -1; + int x = 10; + + if (currprefs.gf[WIN32GFX_IsPicassoScreen()].gfx_filter == 0) + return; + text = statusline_fetch(); + //text = _T("Testing string 123!"); + if (!text) + return; + BitBlt(statusline_hdc, 0, 0, statusline_width, statusline_height, NULL, 0, 0, BLACKNESS); +#if 0 + SIZE size; + if (GetTextExtentPoint32(statusline_hdc, text, _tcslen(text), &size)) { + int w = size.cx; + } +#endif + TextOut(statusline_hdc, x, y, text, _tcslen(text)); + + for (int y = 0; y < height && y < statusline_height; y++) { + uae_u8 *src = (uae_u8*)statusline_bm + y * statusline_width; + uae_u32 *dst2 = (uae_u32*)(buf + pitch * y); + for (int x = 0; x < width && x < statusline_width; x++) { + uae_u8 b = *src++; + if (b) { + if (b == 2) + *dst2 = white; + else if (b == 1) + *dst2 = back; + } + dst2++; + } + } +} diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index 396fd72e..ca6f74d4 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -87,6 +87,7 @@ #include "blkdev.h" #include "inputrecord.h" #include "gfxboard.h" +#include "statusline.h" #ifdef RETROPLATFORM #include "rp.h" #include "cloanto/RetroPlatformIPC.h" @@ -114,7 +115,7 @@ static int logging_started; static MINIDUMP_TYPE minidumpmode = MiniDumpNormal; static int doquit; static int console_started; -void *globalipc, *serialipc; +void *globalipc; int qpcdivisor = 0; int cpu_mmx = 1; @@ -848,19 +849,23 @@ static void winuae_inactive (HWND hWnd, int minimized) wait_keyrelease (); setmouseactive (0); clipboard_active (hAmigaWnd, 0); - inputdevice_unacquire (); pri = &priorities[currprefs.win32_inactive_priority]; if (!quit_program) { if (minimized) { pri = &priorities[currprefs.win32_iconified_priority]; if (currprefs.win32_iconified_pause) { - setpaused (1); + inputdevice_unacquire(); + setpaused(1); sound_closed = 1; } else if (currprefs.win32_iconified_nosound) { - setsoundpaused (); + inputdevice_unacquire(true, currprefs.win32_iconified_input); + setsoundpaused(); sound_closed = -1; + } else { + inputdevice_unacquire(true, currprefs.win32_iconified_input); } } else if (mouseactive) { + inputdevice_unacquire(); if (currprefs.win32_active_nocapture_pause) { setpaused (2); sound_closed = 1; @@ -870,13 +875,19 @@ static void winuae_inactive (HWND hWnd, int minimized) } } else { if (currprefs.win32_inactive_pause) { - setpaused (2); + inputdevice_unacquire(); + setpaused(2); sound_closed = 1; } else if (currprefs.win32_inactive_nosound) { - setsoundpaused (); + inputdevice_unacquire(true, currprefs.win32_inactive_input); + setsoundpaused(); sound_closed = -1; + } else { + inputdevice_unacquire(true, currprefs.win32_inactive_input); } } + } else { + inputdevice_unacquire(); } setpriority (pri); #ifdef FILESYS @@ -1821,7 +1832,21 @@ static LRESULT CALLBACK MainWindowProc (HWND hWnd, UINT message, WPARAM wParam, { LPDRAWITEMSTRUCT lpDIS = (LPDRAWITEMSTRUCT)lParam; if (lpDIS->hwndItem == hStatusWnd) { - if (lpDIS->itemID > 0 && lpDIS->itemID <= window_led_joy_start) { + if (lpDIS->itemID == window_led_msg_start) { + COLORREF oc; + int x = lpDIS->rcItem.left + 1; + int y = (lpDIS->rcItem.bottom - lpDIS->rcItem.top + 1) / 2 + lpDIS->rcItem.top - 1; + const TCHAR *txt = statusline_fetch(); + int flags = DT_VCENTER | DT_SINGLELINE | DT_LEFT; + + FillRect(lpDIS->hDC, &lpDIS->rcItem, (HBRUSH)(COLOR_3DFACE + 1)); + if (txt) { + SetBkMode(lpDIS->hDC, TRANSPARENT); + oc = SetTextColor(lpDIS->hDC, RGB(0x00, 0x00, 0x00)); + DrawText(lpDIS->hDC, txt, _tcslen(txt), &lpDIS->rcItem, flags); + SetTextColor(lpDIS->hDC, oc); + } + } else if (lpDIS->itemID > 0 && lpDIS->itemID <= window_led_joy_start) { int port = lpDIS->itemID - 1; int x = (lpDIS->rcItem.right - lpDIS->rcItem.left + 1) / 2 + lpDIS->rcItem.left - 1; int y = (lpDIS->rcItem.bottom - lpDIS->rcItem.top + 1) / 2 + lpDIS->rcItem.top - 1; @@ -3029,19 +3054,24 @@ void target_fixup_options (struct uae_prefs *p) p->scsi = UAESCSI_SPTI; bool paused = false; bool nosound = false; + bool nojoy = true; if (!paused) { paused = p->win32_active_nocapture_pause; nosound = p->win32_active_nocapture_nosound; } else { p->win32_active_nocapture_pause = p->win32_active_nocapture_nosound = true; nosound = true; + nojoy = false; } if (!paused) { paused = p->win32_inactive_pause; nosound = p->win32_inactive_nosound; + nojoy = (p->win32_inactive_input & 4) == 0; } else { p->win32_inactive_pause = p->win32_inactive_nosound = true; + p->win32_inactive_input = 0; nosound = true; + nojoy = true; } struct MultiDisplay *md = getdisplay (p); @@ -3094,8 +3124,10 @@ void target_default_options (struct uae_prefs *p, int type) p->win32_active_nocapture_nosound = 0; p->win32_iconified_nosound = 1; p->win32_iconified_pause = 1; + p->win32_iconified_input = 0; p->win32_inactive_nosound = 0; p->win32_inactive_pause = 0; + p->win32_inactive_input = 0; p->win32_ctrl_F11_is_quit = 0; p->win32_soundcard = 0; p->win32_samplersoundcard = -1; @@ -3190,11 +3222,13 @@ void target_save_options (struct zfile *f, struct uae_prefs *p) cfgfile_target_dwrite_bool (f, _T("active_not_captured_pause"), p->win32_active_nocapture_pause); cfgfile_target_dwrite (f, _T("inactive_priority"), _T("%d"), priorities[p->win32_inactive_priority].value); cfgfile_target_dwrite_bool (f, _T("inactive_nosound"), p->win32_inactive_nosound); - cfgfile_target_dwrite_bool (f, _T("inactive_pause"), p->win32_inactive_pause); - cfgfile_target_dwrite (f, _T("iconified_priority"), _T("%d"), priorities[p->win32_iconified_priority].value); + cfgfile_target_dwrite_bool(f, _T("inactive_pause"), p->win32_inactive_pause); + cfgfile_target_dwrite(f, _T("inactive_input"), _T("%d"), p->win32_inactive_input); + cfgfile_target_dwrite(f, _T("iconified_priority"), _T("%d"), priorities[p->win32_iconified_priority].value); cfgfile_target_dwrite_bool (f, _T("iconified_nosound"), p->win32_iconified_nosound); - cfgfile_target_dwrite_bool (f, _T("iconified_pause"), p->win32_iconified_pause); - cfgfile_target_dwrite_bool (f, _T("inactive_iconify"), p->win32_minimize_inactive); + cfgfile_target_dwrite_bool(f, _T("iconified_pause"), p->win32_iconified_pause); + cfgfile_target_dwrite(f, _T("iconified_input"), _T("%d"), p->win32_iconified_input); + cfgfile_target_dwrite_bool(f, _T("inactive_iconify"), p->win32_minimize_inactive); cfgfile_target_dwrite_bool (f, _T("start_iconified"), p->win32_start_minimized); cfgfile_target_dwrite_bool (f, _T("start_not_captured"), p->win32_start_uncaptured); @@ -3320,9 +3354,11 @@ int target_parse_option (struct uae_prefs *p, const TCHAR *option, const TCHAR * || cfgfile_yesno (option, value, _T("active_not_captured_nosound"), &p->win32_active_nocapture_nosound) || cfgfile_yesno (option, value, _T("inactive_pause"), &p->win32_inactive_pause) || cfgfile_yesno (option, value, _T("inactive_nosound"), &p->win32_inactive_nosound) - || cfgfile_yesno (option, value, _T("iconified_pause"), &p->win32_iconified_pause) + || cfgfile_intval(option, value, _T("inactive_input"), &p->win32_inactive_input, 1) + || cfgfile_yesno(option, value, _T("iconified_pause"), &p->win32_iconified_pause) || cfgfile_yesno (option, value, _T("iconified_nosound"), &p->win32_iconified_nosound) - || cfgfile_yesno (option, value, _T("ctrl_f11_is_quit"), &p->win32_ctrl_F11_is_quit) + || cfgfile_intval(option, value, _T("iconified_input"), &p->win32_iconified_input, 1) + || cfgfile_yesno(option, value, _T("ctrl_f11_is_quit"), &p->win32_ctrl_F11_is_quit) || cfgfile_yesno (option, value, _T("no_recyclebin"), &p->win32_norecyclebin) || cfgfile_intval (option, value, _T("midi_device"), &p->win32_midioutdev, 1) || cfgfile_intval (option, value, _T("midiout_device"), &p->win32_midioutdev, 1) @@ -5582,7 +5618,7 @@ static int PASCAL WinMain2 (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR paraport_mask = paraport_init (); #endif globalipc = createIPC (_T("WinUAE"), 0); - serialipc = createIPC (COMPIPENAME, 1); + shmem_serial_create(); enumserialports (); enummidiports (); real_main (argc, argv); @@ -5590,7 +5626,7 @@ static int PASCAL WinMain2 (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR } end: closeIPC (globalipc); - closeIPC (serialipc); + shmem_serial_delete(); write_disk_history (); timeend (); #ifdef AVIOUTPUT @@ -6323,11 +6359,15 @@ int PASCAL wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdL #endif log_open (NULL, 0, -1, NULL); - + +#ifdef NDEBUG __try { +#endif WinMain2 (hInstance, hPrevInstance, lpCmdLine, nCmdShow); +#ifdef NDEBUG } __except(WIN32_ExceptionFilter (GetExceptionInformation (), GetExceptionCode ())) { } +#endif //SetThreadAffinityMask (thread, original_affinity); return FALSE; } diff --git a/od-win32/win32.h b/od-win32/win32.h index 9e66accd..56bf8b66 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -20,12 +20,12 @@ #define LANG_DLL_FULL_VERSION_MATCH 1 #if WINUAEPUBLICBETA -#define WINUAEBETA _T("3") +#define WINUAEBETA _T("4") #else #define WINUAEBETA _T("") #endif -#define WINUAEDATE MAKEBD(2014, 7, 11) +#define WINUAEDATE MAKEBD(2014, 7, 20) //#define WINUAEEXTRA _T("AmiKit Preview") //#define WINUAEEXTRA _T("Amiga Forever Edition") diff --git a/od-win32/win32_scaler.cpp b/od-win32/win32_scaler.cpp index 11a86c0a..fdb7adc0 100644 --- a/od-win32/win32_scaler.cpp +++ b/od-win32/win32_scaler.cpp @@ -703,6 +703,7 @@ static void statusline (void) SetRect (&dr, slx, sly, slx + lx, sly + TD_TOTAL_HEIGHT); DirectDraw_BlitRect (tempsurf, &sr, NULL, &dr); if (DirectDraw_LockSurface (tempsurf, &desc)) { + statusline_render((uae_u8*)desc.lpSurface, dst_depth / 8, desc.lPitch, lx, ly, rc, gc, bc, NULL); for (y = 0; y < TD_TOTAL_HEIGHT; y++) { uae_u8 *buf = (uae_u8*)desc.lpSurface + y * desc.lPitch; draw_status_line_single (buf, dst_depth / 8, y, lx, rc, gc, bc, NULL); diff --git a/od-win32/win32gfx.cpp b/od-win32/win32gfx.cpp index 1b0f1843..3665205a 100644 --- a/od-win32/win32gfx.cpp +++ b/od-win32/win32gfx.cpp @@ -55,6 +55,7 @@ #ifdef RETROPLATFORM #include "rp.h" #endif +#include "statusline.h" #define DM_DX_FULLSCREEN 1 #define DM_W_FULLSCREEN 2 @@ -100,6 +101,7 @@ static int display_change_requested; int window_led_drives, window_led_drives_end; int window_led_hd, window_led_hd_end; int window_led_joys, window_led_joys_end, window_led_joy_start; +int window_led_msg, window_led_msg_end, window_led_msg_start; extern int console_logging; int window_extra_width, window_extra_height; @@ -199,7 +201,7 @@ static void changevblankthreadmode_fast (int newmode) int WIN32GFX_IsPicassoScreen (void) { - return screen_is_picasso; + return screen_is_picasso ? 1 : 0; } int isscreen (void) @@ -1421,6 +1423,7 @@ static void close_hwnds (void) rp_set_hwnd (NULL); #endif closeblankwindows (); + deletestatusline(); if (hStatusWnd) { ShowWindow (hStatusWnd, SW_HIDE); DestroyWindow (hStatusWnd); @@ -1646,22 +1649,26 @@ static int open_windows (bool mousecapture) bool startactive = (started && mouseactive) || (!started && !currprefs.win32_start_uncaptured && !currprefs.win32_start_minimized); bool startpaused = !started && ((currprefs.win32_start_minimized && currprefs.win32_iconified_pause) || (currprefs.win32_start_uncaptured && currprefs.win32_inactive_pause && isfullscreen () <= 0)); bool startminimized = !started && currprefs.win32_start_minimized && isfullscreen () <= 0; + int input = 0; if (!rp_isactive () && mousecapture && startactive) setmouseactive (-1); - bool upd = false; + int upd = 0; if (startactive) { setpriority (&priorities[currprefs.win32_active_capture_priority]); - upd = true; + upd = 2; } else if (startminimized) { setpriority (&priorities[currprefs.win32_iconified_priority]); setminimized (); + input = currprefs.win32_inactive_input; + upd = 1; } else { setpriority (&priorities[currprefs.win32_inactive_priority]); - upd = true; + input = currprefs.win32_inactive_input; + upd = 2; } - if (upd) { + if (upd > 1) { for (i = 0; i < NUM_LEDS; i++) gui_flicker_led (i, -1, -1); gui_led (LED_POWER, gui_data.powerled); @@ -1670,8 +1677,11 @@ static int open_windows (bool mousecapture) if (currprefs.floppyslots[i].dfxtype >= 0) gui_led (LED_DF0 + i, 0); } - if (isfocus ()) - inputdevice_acquire (TRUE); + } + if (upd > 0) { + inputdevice_acquire(TRUE); + if (!isfocus()) + inputdevice_unacquire(true, input); } if (startpaused) @@ -2027,8 +2037,10 @@ int check_prefs_changed_gfx (void) currprefs.win32_active_nocapture_pause != changed_prefs.win32_active_nocapture_pause || currprefs.win32_inactive_nosound != changed_prefs.win32_inactive_nosound || currprefs.win32_inactive_pause != changed_prefs.win32_inactive_pause || + currprefs.win32_inactive_input != changed_prefs.win32_inactive_input || currprefs.win32_iconified_nosound != changed_prefs.win32_iconified_nosound || currprefs.win32_iconified_pause != changed_prefs.win32_iconified_pause || + currprefs.win32_iconified_input != changed_prefs.win32_iconified_input || currprefs.win32_ctrl_F11_is_quit != changed_prefs.win32_ctrl_F11_is_quit) { currprefs.win32_minimize_inactive = changed_prefs.win32_minimize_inactive; @@ -2044,8 +2056,10 @@ int check_prefs_changed_gfx (void) currprefs.win32_active_nocapture_pause = changed_prefs.win32_active_nocapture_pause; currprefs.win32_inactive_nosound = changed_prefs.win32_inactive_nosound; currprefs.win32_inactive_pause = changed_prefs.win32_inactive_pause; + currprefs.win32_inactive_input = changed_prefs.win32_inactive_input; currprefs.win32_iconified_nosound = changed_prefs.win32_iconified_nosound; currprefs.win32_iconified_pause = changed_prefs.win32_iconified_pause; + currprefs.win32_iconified_input = changed_prefs.win32_iconified_input; currprefs.win32_ctrl_F11_is_quit = changed_prefs.win32_ctrl_F11_is_quit; inputdevice_unacquire (); currprefs.keyboard_leds_in_use = changed_prefs.keyboard_leds_in_use = (currprefs.keyboard_leds[0] | currprefs.keyboard_leds[1] | currprefs.keyboard_leds[2]) != 0; @@ -2601,7 +2615,7 @@ static void createstatuswindow (void) LPINT lpParts; int drive_width, hd_width, cd_width, power_width, fps_width, idle_width, snd_width, joy_width; int joys = currprefs.win32_statusbar > 1 ? 2 : 0; - int num_parts = 11 + joys; + int num_parts = 11 + joys + 1; double scaleX, scaleY; WINDOWINFO wi; int extra; @@ -2644,6 +2658,10 @@ static void createstatuswindow (void) if (hloc) { int i = 0, i1, j; lpParts = (LPINT)LocalLock (hloc); + // left side, msg area + lpParts[i] = rc.left + 2; + i++; + window_led_msg_start = i; /* Calculate the right edge coordinate for each part, and copy the coords to the array. */ int startx = rc.right - (drive_width * 4) - power_width - idle_width - fps_width - cd_width - hd_width - snd_width - joys * joy_width - extra; for (j = 0; j < joys; j++) { @@ -2652,6 +2670,8 @@ static void createstatuswindow (void) startx += joy_width; } window_led_joy_start = i; + if (lpParts[0] >= startx) + lpParts[0] = startx - 1; // snd lpParts[i] = startx; i++; @@ -2686,8 +2706,10 @@ static void createstatuswindow (void) // edge lpParts[i] = lpParts[i - 1] + drive_width; - window_led_joys = lpParts[0]; - window_led_joys_end = lpParts[1]; + window_led_msg = lpParts[window_led_msg_start - 1]; + window_led_msg_end = lpParts[window_led_msg_start - 1 + 1]; + window_led_joys = lpParts[window_led_joy_start - joys]; + window_led_joys_end = lpParts[window_led_joy_start - joys + 1]; window_led_hd = lpParts[i1]; window_led_hd_end = lpParts[i1 + 1]; window_led_drives = lpParts[i1 + 2]; @@ -3806,7 +3828,8 @@ static int create_windows_2 (void) x = nx; y = ny; } - createstatuswindow (); + createstatuswindow(); + createstatusline(); updatewinrect (false); GetWindowRect (hMainWnd, &mainwin_rect); if (d3dfs || dxfs) @@ -3900,7 +3923,8 @@ static int create_windows_2 (void) GetWindowRect (hMainWnd, &rc2); window_extra_width = rc2.right - rc2.left - currentmode->current_width; window_extra_height = rc2.bottom - rc2.top - currentmode->current_height; - createstatuswindow (); + createstatuswindow(); + createstatusline(); } else { x = rc.left; y = rc.top; @@ -4218,6 +4242,7 @@ static BOOL doInit (void) } screen_is_initialized = 1; + createstatusline(); picasso_refresh (); #ifdef RETROPLATFORM rp_set_hwnd_delayed (); @@ -4424,3 +4449,6 @@ void releasehdc (HDC hdc) #endif DirectDraw_ReleaseDC (hdc); } + + + diff --git a/od-win32/win32gfx.h b/od-win32/win32gfx.h index 7fde4519..15965b00 100644 --- a/od-win32/win32gfx.h +++ b/od-win32/win32gfx.h @@ -24,9 +24,10 @@ extern HCURSOR normalcursor; extern HWND hStatusWnd; extern int default_freq; extern int normal_display_change_starting; -extern int window_led_drives, window_led_drives_end, window_led_joy_start; +extern int window_led_drives, window_led_drives_end; extern int window_led_hd, window_led_hd_end; -extern int window_led_joys, window_led_joys_end; +extern int window_led_joys, window_led_joys_end, window_led_joy_start; +extern int window_led_msg, window_led_msg_end, window_led_msg_start; extern int scalepicasso; extern HDC gethdc (void); diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index 4f05bd5f..92e14427 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -141,6 +141,11 @@ static TCHAR stored_path[MAX_DPATH]; static int gui_size_changed; static int filterstackpos = 2 * MAX_FILTERSHADERS; +bool isguiactive(void) +{ + return gui_active > 0; +} + static const int defaultaspectratios[] = { 5, 4, 4, 3, 16, 10, 15, 9, 27, 16, 128, 75, 16, 9, 256, 135, 21, 9, 16, 3, -1 @@ -1307,6 +1312,8 @@ static int msi_gfx[] = { 0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; #define MIN_MB_MEM 0 #define MAX_MBL_MEM 7 #define MAX_MBH_MEM 8 +#define MIN_CB_MEM 0 +#define MAX_CB_MEM 8 #define MIN_M68K_PRIORITY 1 #define MAX_M68K_PRIORITY 16 @@ -4205,18 +4212,24 @@ void InitializeListView (HWND hDlg) harddisktype (volname_str, ci); _tcscpy (bootpri_str, _T("n/a")); } else if (ctype >= HD_CONTROLLER_TYPE_SCSI_FIRST && ctype <= HD_CONTROLLER_TYPE_SCSI_LAST) { + TCHAR sid[8]; const TCHAR *scsidevs[] = { - _T("SCSI:%d"), - _T("A2091:%d"), - _T("A2091 2nd:%d"), - _T("A4091:%d"), - _T("A4091 2nd:%d"), - _T("A3000:%d"), - _T("A4000T:%d"), - _T("CDTV:%d") + _T("SCSI:%s"), + _T("A2091:%s"), + _T("A2091 2nd:%s"), + _T("A4091:%s"), + _T("A4091 2nd:%s"), + _T("A3000:%s"), + _T("A4000T:%s"), + _T("CDTV:%s"), + _T("WarpEngine:%s") }; + if (ci->controller_unit == 7 && (ctype == HD_CONTROLLER_TYPE_SCSI_A2091 || ctype == HD_CONTROLLER_TYPE_SCSI_A2091_2)) + _tcscpy(sid, _T("XT")); + else + _stprintf(sid, _T("%d"), ci->controller_unit); _stprintf (blocksize_str, _T("%d"), ci->blocksize); - _stprintf (devname_str, scsidevs[ctype - HD_CONTROLLER_TYPE_SCSI_FIRST], ci->controller_unit); + _stprintf (devname_str, scsidevs[ctype - HD_CONTROLLER_TYPE_SCSI_FIRST], sid); harddisktype (volname_str, ci); _tcscpy (bootpri_str, _T("n/a")); } else if (ctype == HD_CONTROLLER_TYPE_PCMCIA_SRAM) { @@ -7326,6 +7339,9 @@ static void enable_for_memorydlg (HWND hDlg) ew (hDlg, IDC_MBMEM1, z3); ew (hDlg, IDC_MBRAM2, z3); ew (hDlg, IDC_MBMEM2, z3); + ew(hDlg, IDC_CPUBOARDMEM, workprefs.cpuboard_type > 0); + ew(hDlg, IDC_CPUBOARDRAM, workprefs.cpuboard_type > 0); + ew(hDlg, IDC_CPUBOARD_TYPE, workprefs.address_space_24 == false); } extern uae_u32 natmem_size; @@ -7632,6 +7648,22 @@ static void values_to_memorydlg (HWND hDlg) SendDlgItemMessage (hDlg, IDC_MBMEM2, TBM_SETPOS, TRUE, mem_size); SetDlgItemText (hDlg, IDC_MBRAM2, memsize_names[msi_gfx[mem_size]]); + mem_size = 0; + switch (workprefs.cpuboardmem1_size) { + case 0x00000000: mem_size = 0; break; + case 0x00100000: mem_size = 1; break; + case 0x00200000: mem_size = 2; break; + case 0x00400000: mem_size = 3; break; + case 0x00800000: mem_size = 4; break; + case 0x01000000: mem_size = 5; break; + case 0x02000000: mem_size = 6; break; + case 0x04000000: mem_size = 7; break; + case 0x08000000: mem_size = 8; break; + } + SendDlgItemMessage (hDlg, IDC_CPUBOARDMEM, TBM_SETPOS, TRUE, mem_size); + SetDlgItemText (hDlg, IDC_CPUBOARDRAM, memsize_names[msi_gfx[mem_size]]); + SendDlgItemMessage (hDlg, IDC_CPUBOARD_TYPE, CB_SETCURSEL, workprefs.cpuboard_type, 0); + setmax32bitram (hDlg); } @@ -8100,6 +8132,7 @@ static INT_PTR CALLBACK ExpansionDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LP static INT_PTR CALLBACK MemoryDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { static int recursive = 0; + int v; switch (msg) { @@ -8114,9 +8147,15 @@ static INT_PTR CALLBACK MemoryDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARA SendDlgItemMessage (hDlg, IDC_Z3CHIPMEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_Z3_MEM, MAX_Z3_CHIPMEM)); SendDlgItemMessage (hDlg, IDC_MBMEM1, TBM_SETRANGE, TRUE, MAKELONG (MIN_MB_MEM, MAX_MBL_MEM)); SendDlgItemMessage (hDlg, IDC_MBMEM2, TBM_SETRANGE, TRUE, MAKELONG (MIN_MB_MEM, MAX_MBH_MEM)); + SendDlgItemMessage (hDlg, IDC_CPUBOARDMEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_CB_MEM, MAX_CB_MEM)); CheckDlgButton(hDlg, IDC_FASTMEMAUTOCONFIG, workprefs.fastmem_autoconfig); CheckDlgButton(hDlg, IDC_Z3REALMAPPING, workprefs.jit_direct_compatible_memory); - + SendDlgItemMessage (hDlg, IDC_CPUBOARD_TYPE, CB_RESETCONTENT, 0, 0); + SendDlgItemMessage (hDlg, IDC_CPUBOARD_TYPE, CB_ADDSTRING, 0, (LPARAM)_T("-")); + SendDlgItemMessage (hDlg, IDC_CPUBOARD_TYPE, CB_ADDSTRING, 0, (LPARAM)_T("Blizzard 1230 IV")); + SendDlgItemMessage (hDlg, IDC_CPUBOARD_TYPE, CB_ADDSTRING, 0, (LPARAM)_T("Blizzard 1260")); + SendDlgItemMessage (hDlg, IDC_CPUBOARD_TYPE, CB_ADDSTRING, 0, (LPARAM)_T("Blizzard 2060 (Do not use)")); + SendDlgItemMessage (hDlg, IDC_CPUBOARD_TYPE, CB_ADDSTRING, 0, (LPARAM)_T("Warp Engine A4000")); case WM_USER: workprefs.fastmem_autoconfig = ischecked (hDlg, IDC_FASTMEMAUTOCONFIG); @@ -8129,6 +8168,18 @@ static INT_PTR CALLBACK MemoryDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARA case WM_COMMAND: recursive++; + if (HIWORD (wParam) == CBN_SELCHANGE || HIWORD (wParam) == CBN_KILLFOCUS) { + switch (LOWORD (wParam)) + { + case IDC_CPUBOARD_TYPE: + v = SendDlgItemMessage (hDlg, IDC_CPUBOARD_TYPE, CB_GETCURSEL, 0, 0L); + if (v != CB_ERR) { + workprefs.cpuboard_type = v; + enable_for_memorydlg(hDlg); + } + break; + } + } workprefs.fastmem_autoconfig = ischecked (hDlg, IDC_FASTMEMAUTOCONFIG); workprefs.jit_direct_compatible_memory = ischecked (hDlg, IDC_Z3REALMAPPING); recursive--; @@ -8144,6 +8195,7 @@ static INT_PTR CALLBACK MemoryDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARA workprefs.z3chipmem_size = memsizes[msi_z3chip[SendMessage (GetDlgItem (hDlg, IDC_Z3CHIPMEM), TBM_GETPOS, 0, 0)]]; workprefs.mbresmem_low_size = memsizes[msi_gfx[SendMessage (GetDlgItem (hDlg, IDC_MBMEM1), TBM_GETPOS, 0, 0)]]; workprefs.mbresmem_high_size = memsizes[msi_gfx[SendMessage (GetDlgItem (hDlg, IDC_MBMEM2), TBM_GETPOS, 0, 0)]]; + workprefs.cpuboardmem1_size = memsizes[msi_gfx[SendMessage (GetDlgItem (hDlg, IDC_CPUBOARDMEM), TBM_GETPOS, 0, 0)]]; fix_values_memorydlg (); values_to_memorydlg (hDlg); enable_for_memorydlg (hDlg); @@ -8413,6 +8465,7 @@ static void enable_for_miscdlg (HWND hDlg) bool paused = false; bool nosound = false; + bool nojoy = (workprefs.win32_inactive_input & 4) == 0; ew (hDlg, IDC_ACTIVE_PAUSE, paused == false); ew (hDlg, IDC_ACTIVE_NOSOUND, nosound == false && paused == false); if (!paused) { @@ -8424,29 +8477,42 @@ static void enable_for_miscdlg (HWND hDlg) } else { workprefs.win32_active_nocapture_pause = workprefs.win32_active_nocapture_nosound = true; nosound = true; + nojoy = true; } if (paused) CheckDlgButton (hDlg, IDC_INACTIVE_PAUSE, TRUE); if (nosound || paused) - CheckDlgButton (hDlg, IDC_INACTIVE_NOSOUND, TRUE); - ew (hDlg, IDC_INACTIVE_PAUSE, paused == false); - ew (hDlg, IDC_INACTIVE_NOSOUND, nosound == false && paused == false); + CheckDlgButton(hDlg, IDC_INACTIVE_NOSOUND, TRUE); + if (paused || nojoy) + CheckDlgButton(hDlg, IDC_INACTIVE_NOJOY, TRUE); + ew(hDlg, IDC_INACTIVE_PAUSE, paused == false); + ew(hDlg, IDC_INACTIVE_NOSOUND, nosound == false && paused == false); + ew(hDlg, IDC_INACTIVE_NOJOY, paused == false); if (!paused) { paused = workprefs.win32_inactive_pause; if (!nosound) nosound = workprefs.win32_inactive_nosound; else workprefs.win32_inactive_nosound = true; + if (!nojoy) + nojoy = (workprefs.win32_inactive_input & 4) == 0; + else + workprefs.win32_inactive_input = 0; } else { workprefs.win32_inactive_pause = workprefs.win32_inactive_nosound = true; + workprefs.win32_inactive_input = workprefs.win32_inactive_input = 0; nosound = true; + nojoy = true; } if (paused) CheckDlgButton (hDlg, IDC_MINIMIZED_PAUSE, TRUE); if (nosound || paused) CheckDlgButton (hDlg, IDC_MINIMIZED_NOSOUND, TRUE); - ew (hDlg, IDC_MINIMIZED_PAUSE, paused == false); - ew (hDlg, IDC_MINIMIZED_NOSOUND, nosound == false && paused == false); + if (paused || nojoy) + CheckDlgButton(hDlg, IDC_MINIMIZED_NOJOY, TRUE); + ew(hDlg, IDC_MINIMIZED_PAUSE, paused == false); + ew(hDlg, IDC_MINIMIZED_NOSOUND, nosound == false && paused == false); + ew(hDlg, IDC_MINIMIZED_NOJOY, nojoy == false && paused == false); if (!paused) { paused = workprefs.win32_iconified_pause; if (!nosound) @@ -8455,7 +8521,9 @@ static void enable_for_miscdlg (HWND hDlg) workprefs.win32_iconified_nosound = true; } else { workprefs.win32_iconified_pause = workprefs.win32_iconified_nosound = true; + workprefs.win32_iconified_input = workprefs.win32_iconified_input = 0; nosound = true; + nojoy = true; } } @@ -8641,15 +8709,17 @@ static void values_to_miscdlg (HWND hDlg) } else if (currentpage == MISC2_ID) { - CheckDlgButton (hDlg, IDC_ACTIVE_PAUSE, workprefs.win32_active_nocapture_pause); - CheckDlgButton (hDlg, IDC_ACTIVE_NOSOUND, workprefs.win32_active_nocapture_nosound || workprefs.win32_active_nocapture_pause); - CheckDlgButton (hDlg, IDC_INACTIVE_PAUSE, workprefs.win32_inactive_pause); - CheckDlgButton (hDlg, IDC_INACTIVE_NOSOUND, workprefs.win32_inactive_nosound || workprefs.win32_inactive_pause); - CheckDlgButton (hDlg, IDC_MINIMIZED_PAUSE, workprefs.win32_iconified_pause); - CheckDlgButton (hDlg, IDC_MINIMIZED_NOSOUND, workprefs.win32_iconified_nosound || workprefs.win32_iconified_pause); - misc_addpri (hDlg, IDC_ACTIVE_PRIORITY, workprefs.win32_active_capture_priority); - misc_addpri (hDlg, IDC_INACTIVE_PRIORITY, workprefs.win32_inactive_priority); - misc_addpri (hDlg, IDC_MINIMIZED_PRIORITY, workprefs.win32_iconified_priority); + CheckDlgButton(hDlg, IDC_ACTIVE_PAUSE, workprefs.win32_active_nocapture_pause); + CheckDlgButton(hDlg, IDC_ACTIVE_NOSOUND, workprefs.win32_active_nocapture_nosound || workprefs.win32_active_nocapture_pause); + CheckDlgButton(hDlg, IDC_INACTIVE_PAUSE, workprefs.win32_inactive_pause); + CheckDlgButton(hDlg, IDC_INACTIVE_NOSOUND, workprefs.win32_inactive_nosound || workprefs.win32_inactive_pause); + CheckDlgButton(hDlg, IDC_INACTIVE_NOJOY, (workprefs.win32_inactive_input & 4) == 0 || workprefs.win32_inactive_pause); + CheckDlgButton(hDlg, IDC_MINIMIZED_PAUSE, workprefs.win32_iconified_pause); + CheckDlgButton(hDlg, IDC_MINIMIZED_NOSOUND, workprefs.win32_iconified_nosound || workprefs.win32_iconified_pause); + CheckDlgButton(hDlg, IDC_MINIMIZED_NOJOY, (workprefs.win32_iconified_input & 4) == 0 || workprefs.win32_iconified_pause); + misc_addpri(hDlg, IDC_ACTIVE_PRIORITY, workprefs.win32_active_capture_priority); + misc_addpri(hDlg, IDC_INACTIVE_PRIORITY, workprefs.win32_inactive_priority); + misc_addpri(hDlg, IDC_MINIMIZED_PRIORITY, workprefs.win32_iconified_priority); } } @@ -8873,15 +8943,21 @@ static INT_PTR MiscDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) _tcscpy (workprefs.statefile, savestate_fname); setstatefilename (hDlg); break; + case IDC_INACTIVE_NOJOY: + if (!ischecked(hDlg, IDC_INACTIVE_NOJOY)) + CheckDlgButton(hDlg, IDC_INACTIVE_PAUSE, BST_UNCHECKED); case IDC_INACTIVE_NOSOUND: - if (!ischecked (hDlg, IDC_INACTIVE_NOSOUND)) - CheckDlgButton (hDlg, IDC_INACTIVE_PAUSE, BST_UNCHECKED); + if (!ischecked(hDlg, IDC_INACTIVE_NOSOUND)) + CheckDlgButton(hDlg, IDC_INACTIVE_PAUSE, BST_UNCHECKED); case IDC_INACTIVE_PAUSE: workprefs.win32_inactive_pause = ischecked (hDlg, IDC_INACTIVE_PAUSE); - if (workprefs.win32_inactive_pause) - CheckDlgButton (hDlg, IDC_INACTIVE_NOSOUND, BST_CHECKED); - workprefs.win32_inactive_nosound = ischecked (hDlg, IDC_INACTIVE_NOSOUND); - enable_for_miscdlg (hDlg); + if (workprefs.win32_inactive_pause) { + CheckDlgButton(hDlg, IDC_INACTIVE_NOSOUND, BST_CHECKED); + CheckDlgButton(hDlg, IDC_INACTIVE_NOJOY, BST_CHECKED); + } + workprefs.win32_inactive_nosound = ischecked(hDlg, IDC_INACTIVE_NOSOUND); + workprefs.win32_inactive_input = ischecked(hDlg, IDC_INACTIVE_NOJOY) ? 0 : 4; + enable_for_miscdlg(hDlg); break; case IDC_ACTIVE_NOSOUND: if (!ischecked (hDlg, IDC_ACTIVE_NOSOUND)) @@ -8893,15 +8969,21 @@ static INT_PTR MiscDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) workprefs.win32_active_nocapture_nosound = ischecked (hDlg, IDC_ACTIVE_NOSOUND); enable_for_miscdlg (hDlg); break; + case IDC_MINIMIZED_NOJOY: + if (!ischecked(hDlg, IDC_MINIMIZED_NOJOY)) + CheckDlgButton(hDlg, IDC_MINIMIZED_PAUSE, BST_UNCHECKED); case IDC_MINIMIZED_NOSOUND: - if (!ischecked (hDlg, IDC_MINIMIZED_NOSOUND)) - CheckDlgButton (hDlg, IDC_MINIMIZED_PAUSE, BST_UNCHECKED); + if (!ischecked(hDlg, IDC_MINIMIZED_NOSOUND)) + CheckDlgButton(hDlg, IDC_MINIMIZED_PAUSE, BST_UNCHECKED); case IDC_MINIMIZED_PAUSE: workprefs.win32_iconified_pause = ischecked (hDlg, IDC_MINIMIZED_PAUSE); - if (workprefs.win32_iconified_pause) - CheckDlgButton (hDlg, IDC_MINIMIZED_NOSOUND, BST_CHECKED); - workprefs.win32_iconified_nosound = ischecked (hDlg, IDC_MINIMIZED_NOSOUND); - enable_for_miscdlg (hDlg); + if (workprefs.win32_iconified_pause) { + CheckDlgButton(hDlg, IDC_MINIMIZED_NOSOUND, BST_CHECKED); + CheckDlgButton(hDlg, IDC_MINIMIZED_NOJOY, BST_CHECKED); + } + workprefs.win32_iconified_nosound = ischecked(hDlg, IDC_MINIMIZED_NOSOUND); + workprefs.win32_iconified_input = ischecked(hDlg, IDC_MINIMIZED_NOJOY) ? 0 : 4; + enable_for_miscdlg(hDlg); break; case IDC_KBLED_USB: workprefs.win32_kbledmode = ischecked (hDlg, IDC_KBLED_USB) ? 1 : 0; @@ -10004,7 +10086,7 @@ static void sethardfile (HWND hDlg) SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_UNIT, CB_SETCURSEL, current_hfdlg.ci.controller_unit, 0); } -static void inithdcontroller (HWND hDlg, int ctype) +static void inithdcontroller (HWND hDlg, int ctype, int devtype) { SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_RESETCONTENT, 0, 0); SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("UAE")); @@ -10017,6 +10099,7 @@ static void inithdcontroller (HWND hDlg, int ctype) SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("A3000 SCSI")); SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("A4000T SCSI")); SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("CDTV SCSI")); + SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("Warp Engine SCSI")); SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("PCMCIA SRAM")); SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_ADDSTRING, 0, (LPARAM)_T("PCMCIA IDE")); SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_SETCURSEL, ctype, 0); @@ -10031,6 +10114,8 @@ static void inithdcontroller (HWND hDlg, int ctype) SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_UNIT, CB_ADDSTRING, 0, (LPARAM)_T("4")); SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_UNIT, CB_ADDSTRING, 0, (LPARAM)_T("5")); SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_UNIT, CB_ADDSTRING, 0, (LPARAM)_T("6")); + if (devtype == UAEDEV_HDF && (ctype == HD_CONTROLLER_TYPE_SCSI_A2091 || ctype == HD_CONTROLLER_TYPE_SCSI_A2091_2)) + SendDlgItemMessage(hDlg, IDC_HDF_CONTROLLER_UNIT, CB_ADDSTRING, 0, (LPARAM)_T("XT")); } ew(hDlg, IDC_HDF_CONTROLLER_UNIT, TRUE); } else { @@ -10044,7 +10129,7 @@ static void inithardfile (HWND hDlg) ew (hDlg, IDC_HF_DOSTYPE, FALSE); ew (hDlg, IDC_HF_CREATE, FALSE); - inithdcontroller (hDlg, current_hfdlg.ci.controller_type); + inithdcontroller (hDlg, current_hfdlg.ci.controller_type, UAEDEV_HDF); SendDlgItemMessage (hDlg, IDC_HF_TYPE, CB_RESETCONTENT, 0, 0); WIN32GUI_LoadUIString (IDS_HF_FS_CUSTOM, tmp, sizeof (tmp) / sizeof (TCHAR)); SendDlgItemMessage (hDlg, IDC_HF_TYPE, CB_ADDSTRING, 0, (LPARAM)_T("RDB/OFS/FFS")); @@ -10222,7 +10307,7 @@ static INT_PTR CALLBACK TapeDriveSettingsProc (HWND hDlg, UINT msg, WPARAM wPara recursive++; if (current_tapedlg.ci.controller_type < HD_CONTROLLER_TYPE_SCSI_AUTO) current_tapedlg.ci.controller_type = HD_CONTROLLER_TYPE_SCSI_AUTO; - inithdcontroller (hDlg, current_tapedlg.ci.controller_type); + inithdcontroller(hDlg, current_tapedlg.ci.controller_type, UAEDEV_TAPE); SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_UNIT, CB_SETCURSEL, current_tapedlg.ci.controller_unit, 0); setautocomplete (hDlg, IDC_PATH_NAME); addhistorymenu(hDlg, current_tapedlg.ci.rootdir, IDC_PATH_NAME, HISTORY_TAPE, false); @@ -10280,7 +10365,7 @@ static INT_PTR CALLBACK TapeDriveSettingsProc (HWND hDlg, UINT msg, WPARAM wPara posn = SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_GETCURSEL, 0, 0); if (posn != CB_ERR) { current_tapedlg.ci.controller_type = posn; - inithdcontroller (hDlg, current_tapedlg.ci.controller_type); + inithdcontroller(hDlg, current_tapedlg.ci.controller_type, UAEDEV_TAPE); SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_UNIT, CB_SETCURSEL, current_tapedlg.ci.controller_unit, 0); } break; @@ -10308,7 +10393,7 @@ static INT_PTR CALLBACK CDDriveSettingsProc (HWND hDlg, UINT msg, WPARAM wParam, recursive++; if (current_cddlg.ci.controller_type == HD_CONTROLLER_TYPE_UAE) current_cddlg.ci.controller_type = (workprefs.a2091 || workprefs.a4091 || workprefs.cs_cdtvscsi || (workprefs.cs_mbdmac & 3)) ? HD_CONTROLLER_TYPE_SCSI_AUTO : HD_CONTROLLER_TYPE_IDE_AUTO; - inithdcontroller (hDlg, current_cddlg.ci.controller_type); + inithdcontroller(hDlg, current_cddlg.ci.controller_type, UAEDEV_CD); SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_UNIT, CB_SETCURSEL, current_cddlg.ci.controller_unit, 0); InitializeListView (hDlg); recursive--; @@ -10338,7 +10423,7 @@ static INT_PTR CALLBACK CDDriveSettingsProc (HWND hDlg, UINT msg, WPARAM wParam, posn = SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_GETCURSEL, 0, 0); if (posn != CB_ERR) { current_cddlg.ci.controller_type = posn; - inithdcontroller (hDlg, current_cddlg.ci.controller_type); + inithdcontroller(hDlg, current_cddlg.ci.controller_type, UAEDEV_CD); SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_UNIT, CB_SETCURSEL, current_cddlg.ci.controller_unit, 0); } break; @@ -10425,7 +10510,8 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam posn = SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_GETCURSEL, 0, 0); if (posn != CB_ERR) { current_hfdlg.ci.controller_type = posn; - sethardfile (hDlg); + inithdcontroller(hDlg, current_hfdlg.ci.controller_type, UAEDEV_HDF); + sethardfile(hDlg); } break; case IDC_HDF_CONTROLLER_UNIT: @@ -10579,7 +10665,7 @@ static INT_PTR CALLBACK HarddriveSettingsProc (HWND hDlg, UINT msg, WPARAM wPara oposn = -1; hdf_init_target (); recursive++; - inithdcontroller (hDlg, current_hfdlg.ci.controller_type); + inithdcontroller(hDlg, current_hfdlg.ci.controller_type, UAEDEV_HDF); CheckDlgButton (hDlg, IDC_HDF_RW, !current_hfdlg.ci.readonly); SendDlgItemMessage (hDlg, IDC_HARDDRIVE, CB_RESETCONTENT, 0, 0); ew (hDlg, IDC_HARDDRIVE_IMAGE, FALSE); @@ -10667,7 +10753,7 @@ static INT_PTR CALLBACK HarddriveSettingsProc (HWND hDlg, UINT msg, WPARAM wPara SetDlgItemText (hDlg, IDC_HDFINFO, _T("")); SetDlgItemText (hDlg, IDC_HDFINFO2, _T("")); updatehdfinfo (hDlg, true, true); - inithdcontroller (hDlg, current_hfdlg.ci.controller_type); + inithdcontroller(hDlg, current_hfdlg.ci.controller_type, UAEDEV_HDF); SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER_UNIT, CB_SETCURSEL, current_hfdlg.ci.controller_unit, 0); } } else if (LOWORD(wParam) == IDC_HDF_CONTROLLER_UNIT) { @@ -11851,7 +11937,7 @@ static void addswapperfile (HWND hDlg, int entry, TCHAR *newpath) TCHAR dpath[MAX_DPATH]; loopmulti (path, NULL); while (loopmulti (path, dpath) && entry < MAX_SPARE_DRIVES) { - diskswapper_addfile (&workprefs, path); + diskswapper_addfile (&workprefs, dpath); lastentry = entry; entry++; } @@ -12005,7 +12091,6 @@ static INT_PTR CALLBACK SwapperDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR } } break; - case IDC_DISKLISTREMOVE: if (entry >= 0) { workprefs.dfxlist[entry][0] = 0; @@ -12013,6 +12098,15 @@ static INT_PTR CALLBACK SwapperDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR swapperhili (hDlg, entry); } break; + case IDC_DISKLISTREMOVEALL: + { + for (int i = 0; i < MAX_SPARE_DRIVES; i++) { + workprefs.dfxlist[i][0] = 0; + } + InitializeListView (hDlg); + swapperhili (hDlg, entry); + break; + } case IDC_UP: if (entry > 0) { _tcscpy (tmp, workprefs.dfxlist[entry - 1]); @@ -12524,7 +12618,23 @@ static void init_portsdlg (HWND hDlg) SendDlgItemMessage (hDlg, IDC_SERIAL, CB_RESETCONTENT, 0, 0L); SendDlgItemMessage (hDlg, IDC_SERIAL, CB_ADDSTRING, 0, (LPARAM)szNone.c_str()); for (port = 0; port < MAX_SERPAR_PORTS && comports[port]; port++) { - SendDlgItemMessage (hDlg, IDC_SERIAL, CB_ADDSTRING, 0, (LPARAM)comports[port]->name); + if (!_tcsicmp(comports[port]->dev, SERIAL_INTERNAL)) { + _tcscpy(tmp, comports[port]->name); + if (!shmem_serial_state()) + shmem_serial_create(); + switch(shmem_serial_state()) + { + case 1: + _tcscat(tmp, _T(" [Master]")); + break; + case 2: + _tcscat(tmp, _T(" [Slave]")); + break; + } + SendDlgItemMessage (hDlg, IDC_SERIAL, CB_ADDSTRING, 0, (LPARAM)tmp); + } else { + SendDlgItemMessage (hDlg, IDC_SERIAL, CB_ADDSTRING, 0, (LPARAM)comports[port]->name); + } } SendDlgItemMessage (hDlg, IDC_PRINTERTYPELIST, CB_RESETCONTENT, 0, 0L); diff --git a/od-win32/winuae_msvc11/winuae_msvc.vcxproj b/od-win32/winuae_msvc11/winuae_msvc.vcxproj index 591beec2..404b20e4 100644 --- a/od-win32/winuae_msvc11/winuae_msvc.vcxproj +++ b/od-win32/winuae_msvc11/winuae_msvc.vcxproj @@ -398,7 +398,7 @@ false false ..\..\include;..\..;..\;..\resources;..\osdep;..\sounddep;..\..\prowizard\include;..\..\slirp;%(AdditionalIncludeDirectories) - WINVER=0x0500;NDEBUG;_WIN32_IE=0x0700;WIN32;%(PreprocessorDefinitions) + WINVER=0x0500;_WIN32_IE=0x0700;WIN32;%(PreprocessorDefinitions) true Sync Default @@ -505,13 +505,13 @@ 0x0409 - ws2_32.lib;ddraw.lib;dxguid.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;dxerr.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;packet.lib;wpcap.lib;openal32.lib;libpng15.lib;lglcd.lib;wtsapi32.lib;wntab32x.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;libFLAC_static.lib;avrt.lib;hid.lib;Iphlpapi.lib;luastatic.lib;libmpeg2_ff;%(AdditionalDependencies) + ws2_32.lib;ddraw.lib;dxguid.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;dxerr.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;packet.lib;wpcap.lib;openal32.lib;libpng15.lib;lglcd.lib;wtsapi32.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;libFLAC_static.lib;avrt.lib;hid.lib;Iphlpapi.lib;luastatic.lib;libmpeg2_ff.lib;%(AdditionalDependencies) NotSet $(OutDir)$(TargetName)$(TargetExt) true %(AdditionalLibraryDirectories);$(SolutionDir)\..\lib\ LIBCMT;%(IgnoreSpecificDefaultLibraries) - wpcap.dll;packet.dll;d3dx9_43.dll;openal32.dll;wintab32.dll;portaudio_x64.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;avrt.dll;Dwmapi.dll;Iphlpapi.dll;%(DelayLoadDLLs) + wpcap.dll;packet.dll;d3dx9_43.dll;openal32.dll;portaudio_x64.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;avrt.dll;Dwmapi.dll;Iphlpapi.dll;%(DelayLoadDLLs) true $(Platform)\$(Configuration)\winuae.pdb Windows @@ -525,6 +525,7 @@ false true MachineX64 + true ..\resources\winuae64.exe.manifest @@ -723,7 +724,7 @@ 0x0409 - ws2_32.lib;ddraw.lib;dxguid.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;dxerr.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;packet.lib;wpcap.lib;openal32.lib;libpng15.lib;lglcd.lib;wtsapi32.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;libFLAC_static.lib;avrt.lib;hid.lib;Iphlpapi.lib;luastatic.lib;libmpeg2_ff;%(AdditionalDependencies) + ws2_32.lib;ddraw.lib;dxguid.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;dxerr.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;packet.lib;wpcap.lib;openal32.lib;libpng15.lib;lglcd.lib;wtsapi32.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;libFLAC_static.lib;avrt.lib;hid.lib;Iphlpapi.lib;luastatic.lib;libmpeg2_ff.lib;%(AdditionalDependencies) NotSet $(OutDir)$(TargetName)$(TargetExt) true @@ -787,6 +788,7 @@ + @@ -864,6 +866,7 @@ + diff --git a/od-win32/winuae_msvc11/winuae_msvc.vcxproj.filters b/od-win32/winuae_msvc11/winuae_msvc.vcxproj.filters index 02d5ea87..3fb0ad54 100644 --- a/od-win32/winuae_msvc11/winuae_msvc.vcxproj.filters +++ b/od-win32/winuae_msvc11/winuae_msvc.vcxproj.filters @@ -370,9 +370,6 @@ common - - common - common @@ -652,6 +649,15 @@ common + + common + + + win32 + + + win32 + diff --git a/rommgr.cpp b/rommgr.cpp index e1550564..7b556900 100644 --- a/rommgr.cpp +++ b/rommgr.cpp @@ -93,7 +93,7 @@ struct romdata *getromdatabypath (const TCHAR *path) return NULL; } -#define NEXT_ROM_ID 92 +#define NEXT_ROM_ID 94 static struct romheader romheaders[] = { { _T("Freezer Cartridges"), 1 }, @@ -292,10 +292,16 @@ static struct romdata roms[] = { { _T("A4091 ROM 40.13"), 40, 13, 40, 13, _T("A4091\0"), 32768, 58, 0, 0, ROMTYPE_A4091BOOT, 0, 0, _T("391592-02"), 0x54cb9e85, 0x3CE66919,0xF6FD6797,0x4923A12D,0x91B730F1,0xFFB4A7BA }, - { _T("Blizzard 1230-IV ROM"), 0, 0, 0, 0, _T("B1230\0"), 32768, 89, 0, 0, ROMTYPE_BLIZ1230, 0, 0, NULL, + { _T("Blizzard 1230-IV ROM"), 0, 0, 0, 0, _T("B1230\0"), 32768, 89, 0, 0, ROMTYPE_CPUBOARD, 0, 0, NULL, 0x3078dbdc, 0x4d3e7fd0,0xa1a4c3ae,0xe17c5de3,0xcbe1af03,0x447aff92 }, - { _T("Blizzard 1240/1260 ROM"), 0, 0, 0, 0, _T("B1240\0B1260\0"), 32768, 90, 0, 0, ROMTYPE_BLIZ1240, 0, 0, NULL, + { _T("Blizzard 1240/1260 ROM"), 0, 0, 0, 0, _T("B1240\0B1260\0"), 32768, 90, 0, 0, ROMTYPE_CPUBOARD, 0, 0, NULL, 0xf88ae0f1, 0xf69aca4b,0xb13e3389,0x04676f0c,0x8616f8db,0x074c313d }, + { _T("Blizzard 2060 ROM"), 8, 5, 8, 5, _T("B2060\0"), 65536, 92, 0, 0, ROMTYPE_CPUBOARD, 0, 0, NULL, + 0xce270bc0, 0xe043c1aa,0x3bb06e06,0xd4dabff3,0x0a8c6317,0xabfef2bb }, + ALTROMPN(92, 1, 1, 32768, ROMTYPE_ODD | ROMTYPE_8BIT, NULL, 0xa6023f20, 0xdfb048d6, 0xbdc03587, 0x241e8121, 0x26aba603, 0xd69b0238) + ALTROMPN(92, 1, 2, 32768, ROMTYPE_EVEN | ROMTYPE_8BIT, NULL, 0x9635a9cd, 0x47578b27, 0xc4ba6e54, 0x891930dd, 0xcb4b6a45, 0x5d6b31b2) + { _T("Warp Engine A4000 ROM"), 0, 0, 0, 0, _T("WARPENGINE\0WARPENGINEA4000\0"), 32768, 93, 0, 0, ROMTYPE_CPUBOARD, 0, 0, NULL, + 0x4deb574a, 0x6e6c95ff,0xe8448391,0xd36c5b68,0xc9065cb0,0x702a7d27 }, { _T("Picasso IV ROM"), 7, 4, 7, 4, _T("PIV\0"), 131072, 91, 0, 0, ROMTYPE_PIV, 0, 0, NULL, 0xa8133e7e, 0xcafafb91,0x6f16b9f3,0xec9b49aa,0x4b40eb4e,0xeceb5b5b }, diff --git a/statusline.cpp b/statusline.cpp index f3f462b9..67979552 100644 --- a/statusline.cpp +++ b/statusline.cpp @@ -12,6 +12,8 @@ #include "drawing.h" #include "statusline.h" +#define STATUSLINE_MS 3000 + /* * Some code to put status information on the screen. */ @@ -257,3 +259,116 @@ void draw_status_line_single (uae_u8 *buf, int bpp, int y, int totalwidth, uae_u } } } + +#define MAX_STATUSLINE_QUEUE 8 +static TCHAR *statusline_text[MAX_STATUSLINE_QUEUE]; +static TCHAR *statusline_text_active; +static int statusline_delay; +static bool statusline_had_changed; + +bool has_statusline_updated(void) +{ + bool v = statusline_had_changed; + statusline_had_changed = false; + return v; +} + +static void statusline_update_notification(void) +{ + statusline_had_changed = true; + statusline_updated(); +} + +void statusline_clear(void) +{ + statusline_text_active = NULL; + statusline_delay = 0; + for (int i = 0; i < MAX_STATUSLINE_QUEUE; i++) { + xfree(statusline_text[i]); + statusline_text[i] = NULL; + } + statusline_update_notification(); +} + +const TCHAR *statusline_fetch(void) +{ + return statusline_text_active; +} + +void statusline_add_message(const TCHAR *format, ...) +{ + va_list parms; + TCHAR buffer[256]; + + if (isguiactive()) + return; + + va_start(parms, format); + buffer[0] = ' '; + _vsntprintf(buffer + 1, 256 - 2, format, parms); + _tcscat(buffer, _T(" ")); + + if (statusline_text[1]) { + for (int i = 0; i < MAX_STATUSLINE_QUEUE; i++) { + if (statusline_text[i] && !_tcscmp(statusline_text[i], buffer)) { + xfree(statusline_text[i]); + for (int j = i + 1; j < MAX_STATUSLINE_QUEUE; j++) { + statusline_text[j - 1] = statusline_text[j]; + } + statusline_text[MAX_STATUSLINE_QUEUE - 1] = NULL; + i = 0; + } + } + } else if (statusline_text[0]) { + if (!_tcscmp(statusline_text[0], buffer)) + return; + } + + for (int i = 0; i < MAX_STATUSLINE_QUEUE; i++) { + if (statusline_text[i] == NULL) { + statusline_text[i] = my_strdup(buffer); + if (i == 0) + statusline_delay = STATUSLINE_MS * vblank_hz / (1000 * 1); + statusline_text_active = statusline_text[0]; + statusline_update_notification(); + return; + } + } + statusline_text_active = NULL; + xfree(statusline_text[0]); + for (int i = 1; i < MAX_STATUSLINE_QUEUE; i++) { + statusline_text[i - 1] = statusline_text[i]; + } + statusline_text[MAX_STATUSLINE_QUEUE - 1] = my_strdup(buffer); + statusline_text_active = statusline_text[0]; + statusline_update_notification(); + va_end(parms); +} + +void statusline_vsync(void) +{ + if (!statusline_text[0]) + return; + if (statusline_delay == 0) + statusline_delay = STATUSLINE_MS * vblank_hz / (1000 * 1); + if (statusline_delay > STATUSLINE_MS * vblank_hz / (1000 * 1)) + statusline_delay = STATUSLINE_MS * vblank_hz / (1000 * 1); + if (statusline_delay > STATUSLINE_MS * vblank_hz / (1000 * 2) && statusline_text[1]) + statusline_delay = STATUSLINE_MS * vblank_hz / (1000 * 2); + statusline_delay--; + if (statusline_delay) + return; + statusline_text_active = NULL; + xfree(statusline_text[0]); + for (int i = 1; i < MAX_STATUSLINE_QUEUE; i++) { + statusline_text[i - 1] = statusline_text[i]; + } + statusline_text[MAX_STATUSLINE_QUEUE - 1] = NULL; + statusline_text_active = statusline_text[0]; + statusline_update_notification(); +} + +void statusline_single_erase(uae_u8 *buf, int bpp, int y, int totalwidth) +{ + memset(buf, 0, bpp * totalwidth); +} -- 2.47.3