From 85f9252114fe5d1d7c7699d32f7daa8962eac3b3 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sat, 5 Apr 2008 11:36:34 +0300 Subject: [PATCH] imported winuaesrc1500b12.zip --- akiko.c | 8 +- debug.c | 92 +++--- gayle.c | 292 ++++++++++++------ include/debug.h | 2 +- inputdevice.c | 7 +- jit/compemu_support.c | 4 +- newcpu.c | 12 +- od-win32/ahidsound.c | 12 +- od-win32/cloanto/RetroPlatformIPC.h | 54 ++-- .../cloanto/RetroPlatformIPC_doc_draft.txt | 144 +++------ od-win32/dxwrap.c | 2 +- od-win32/hardfile_win32.c | 2 +- od-win32/parser.c | 16 +- od-win32/picasso96_win.c | 40 ++- od-win32/resources/resource | 1 + od-win32/resources/resource.h | 1 + od-win32/resources/winuae.rc | 14 +- od-win32/rp.c | 187 +++++------ od-win32/rp.h | 2 + od-win32/win32.c | 20 +- od-win32/win32.h | 4 +- od-win32/win32gfx.c | 15 +- od-win32/win32gui.c | 120 +++---- od-win32/winuae_msvc/winuae_msvc.vcproj | 4 - od-win32/winuaechangelog.txt | 14 + od-win32/writelog.c | 9 +- savestate.c | 2 +- 27 files changed, 594 insertions(+), 486 deletions(-) diff --git a/akiko.c b/akiko.c index d808262b..d561c59e 100755 --- a/akiko.c +++ b/akiko.c @@ -1062,6 +1062,7 @@ void AKIKO_hsync_handler (void) cdrom_run_read (); framecounter = 1000000 / (74 * 75 * cdrom_speed); set_status (CDSTATUS_FRAME); + cdrom_status3++; } if (cdrom_playing) { static int frame2counter; @@ -1386,7 +1387,12 @@ static void akiko_bput2 (uaecptr addr, uae_u32 v, int msg) akiko_put_long (&cdrom_address2, addr - 0x14, v); break; case 0x18: - cdrom_status3 = v; + if (cdrom_status3 > 7) + cdrom_status3 = 7; + if (cdrom_status3 > 0) + cdrom_status3--; + if (cdrom_status3 == 0) + cdrom_status1 &= ~CDSTATUS_FRAME; break; case 0x19: cdrom_command_offset_complete = v; diff --git a/debug.c b/debug.c index b38c7f4a..535afdcf 100755 --- a/debug.c +++ b/debug.c @@ -1374,8 +1374,6 @@ static int memwatch_func (uaecptr addr, int rwi, int size, uae_u32 *valp) brk = 0; if (m->size == 0) continue; - if (!m->frozen && m->val_enabled && m->val != val) - continue; if (!(rwi & rwi2)) continue; if (addr >= addr2 && addr < addr3) @@ -1384,7 +1382,28 @@ static int memwatch_func (uaecptr addr, int rwi, int size, uae_u32 *valp) brk = 1; if (!brk && size == 4 && ((addr + 2 >= addr2 && addr + 2 < addr3) || (addr + 3 >= addr2 && addr + 3 < addr3))) brk = 1; - if (brk && m->modval_written) { + + if (!brk) + continue; + + if (!m->frozen && m->val_enabled) { + int trigger = 0; + uae_u32 mask = ((1 << (m->size * 8)) - 1); + for (;;) { + if ((m->val & mask) == (val & mask)) + trigger = 1; + if (mask & 0x80000000) + break; + if (m->size == 1) + mask <<= 8; + else if (m->size == 2) + mask <<= 16; + } + if (!trigger) + continue; + } + + if (m->modval_written) { if (!rwi) { brk = 0; } else if (m->modval_written == 1) { @@ -1395,32 +1414,30 @@ static int memwatch_func (uaecptr addr, int rwi, int size, uae_u32 *valp) brk = 0; } } - if (brk) { - if (m->frozen) { - if (m->val_enabled) { - int shift = addr - m->addr; - int max = 0; - if (m->val > 256) - max = 1; - if (m->val > 65536) - max = 3; - shift &= max; - *valp = m->val >> ((max - shift) * 8); - } - return 0; + if (m->frozen) { + if (m->val_enabled) { + int shift = addr - m->addr; + int max = 0; + if (m->val > 256) + max = 1; + if (m->val > 65536) + max = 3; + shift &= max; + *valp = m->val >> ((max - shift) * 8); } - mwhit.pc = M68K_GETPC; - mwhit.addr = addr; - mwhit.rwi = rwi; - mwhit.size = size; - mwhit.val = 0; - if (mwhit.rwi & 2) - mwhit.val = val; - memwatch_triggered = i + 1; - debugging = 1; - set_special (®s, SPCFLAG_BRK); - return 1; + return 0; } + mwhit.pc = M68K_GETPC; + mwhit.addr = addr; + mwhit.rwi = rwi; + mwhit.size = size; + mwhit.val = 0; + if (mwhit.rwi & 2) + mwhit.val = val; + memwatch_triggered = i + 1; + debugging = 1; + set_special (®s, SPCFLAG_BRK); + return 1; } return 1; } @@ -2714,7 +2731,7 @@ static void debug_1 (void) case 'H': { - int count, temp, badly; + int count, temp, badly, skip; uae_u32 oldpc = m68k_getpc (®s); struct regstruct save_regs = regs; @@ -2725,26 +2742,31 @@ static void debug_1 (void) } if (more_params(&inptr)) - count = readhex(&inptr); + count = readint (&inptr); else count = 10; if (count < 0) break; + skip = count; + if (more_params (&inptr)) + skip = count - readint (&inptr); + temp = lasthist; while (count-- > 0 && temp != firsthist) { if (temp == 0) - temp = MAX_HIST-1; + temp = MAX_HIST - 1; else temp--; } while (temp != lasthist) { regs = history[temp]; m68k_setpc (®s, history[temp].pc); - if (badly) { - m68k_dumpstate(stdout, NULL); - } else { - m68k_disasm(stdout, history[temp].pc, NULL, 1); - } + if (badly) + m68k_dumpstate (stdout, NULL); + else + m68k_disasm (stdout, history[temp].pc, NULL, 1); + if (skip-- < 0) + break; if (++temp == MAX_HIST) temp = 0; } diff --git a/gayle.c b/gayle.c index 928130e0..b35a1f72 100755 --- a/gayle.c +++ b/gayle.c @@ -3,7 +3,7 @@ * * Gayle (and motherboard resources) memory bank * - * (c) 2006 - 2007 Toni Wilen + * (c) 2006 - 2008 Toni Wilen */ #define GAYLE_LOG 0 @@ -29,7 +29,7 @@ /* 600000 to 9FFFFF 4 MB Credit Card memory if CC present -AOOOOO to A1FFFF 128 KB Credit Card Attributes +A00000 to A1FFFF 128 KB Credit Card Attributes A20000 to A3FFFF 128 KB Credit Card I/O A40000 to A5FFFF 128 KB Credit Card Bits A60000 to A7FFFF 128 KB PC I/O @@ -88,7 +88,12 @@ DE0000 to DEFFFF 64 KB Motherboard resources #define IDE_STATUS_DRDY 0x40 #define IDE_STATUS_BSY 0x80 /* ERROR bits */ +#define IDE_ERR_UNC 0x40 +#define IDE_ERR_MC 0x20 +#define IDE_ERR_IDNF 0x10 +#define IDE_ERR_MCR 0x08 #define IDE_ERR_ABRT 0x04 +#define IDE_ERR_NM 0x02 /* * These are at different offsets from the base @@ -147,16 +152,17 @@ DE0000 to DEFFFF 64 KB Motherboard resources #define GAYLE_CFG_250NS 0x00 #define GAYLE_CFG_720NS 0x0c - +#define MAX_MULTIPLE_SECTORS 128 struct ide_hdf { struct hd_hardfiledata hdhfd; - uae_u8 secbuf[512 * 256]; + uae_u8 secbuf[512 * (MAX_MULTIPLE_SECTORS * 2)]; int data_offset; int data_size; int data_multi; + int lba48; uae_u8 multiple_mode; uae_u8 status; int irq_delay; @@ -203,6 +209,8 @@ static int isideirq (void) return 0; if (ide_devcon & 2) return 0; + if (idedrive[ide_drv] == NULL) + return 0; if (idedrive[ide_drv]->irq || idedrive[ide_drv + 2]->irq) { /* IDE killer feature. Do not eat interrupt to make booting faster. */ if (idedrive[ide_drv]->irq && idedrive[ide_drv]->hdhfd.size == 0) @@ -222,7 +230,7 @@ void rethink_gayle (void) if (isideirq ()) gayle_irq |= GAYLE_IRQ_IDE; if ((gayle_irq & GAYLE_IRQ_IDE) && !(intreq & 0x0008)) - INTREQ_0 (0x8000 | 0x0008); + INTREQ_0 (0x8000 | 0x0008); } if (currprefs.cs_ide != 1 && !currprefs.cs_pcmcia) @@ -358,14 +366,18 @@ static void ide_interrupt_do (struct ide_hdf *ide) rethink_gayle (); } -static void ide_fail (void) +static void ide_fail_err (uae_u8 err) { - ide_error |= IDE_ERR_ABRT; + ide_error |= err; if (ide_drv == 1 && idedrive[ide2 + 1]->hdhfd.size == 0) idedrive[ide2]->status |= IDE_STATUS_ERR; ide->status |= IDE_STATUS_ERR; ide_interrupt (); } +static void ide_fail (void) +{ + ide_fail_err (IDE_ERR_ABRT); +} static void ide_data_ready (int blocks) { @@ -387,7 +399,7 @@ static void ide_recalibrate (void) } static void ide_identify_drive (void) { - int totalsecs; + uae_u64 totalsecs; int v; uae_u8 *buf = ide->secbuf; @@ -395,11 +407,13 @@ static void ide_identify_drive (void) ide_fail (); return; } + memset (buf, 0, 512); if (IDE_LOG > 0) write_log ("IDE%d identify drive\n", ide->num); ide_data_ready (1); - pw (0, (1 << 10) | (1 << 6) | (1 << 2) | (1 << 3)); + pw (0, 1 << 6); pw (1, ide->hdhfd.cyls_def); + pw (2, 0xc837); pw (3, ide->hdhfd.heads_def); pw (4, 512 * ide->hdhfd.secspertrack_def); pw (5, 512); @@ -407,41 +421,61 @@ static void ide_identify_drive (void) ps (10, "68000", 20); /* serial */ pw (20, 3); pw (21, 512); - ps (23, "0.2", 8); /* firmware revision */ + pw (22, 4); + ps (23, "0.3", 8); /* firmware revision */ ps (27, "UAE-IDE", 40); /* model */ - pw (47, 128); /* max 128 sectors multiple mode */ + pw (47, MAX_MULTIPLE_SECTORS); /* max sectors in multiple mode */ pw (48, 1); pw (49, (1 << 9) | (1 << 8)); /* LBA and DMA supported */ - pw (51, 240 << 8); /* PIO0 to PIO2 supported */ - pw (53, 1 | 2); + pw (51, 0x200); /* PIO cycles */ + pw (52, 0x200); /* DMA cycles */ + pw (53, 1 | 2 | 4); pw (54, ide->hdhfd.cyls); pw (55, ide->hdhfd.heads); pw (56, ide->hdhfd.secspertrack); totalsecs = ide->hdhfd.cyls * ide->hdhfd.heads * ide->hdhfd.secspertrack; - pw (57, totalsecs); - pw (58, totalsecs >> 16); + pw (57, (uae_u16)totalsecs); + pw (58, (uae_u16)(totalsecs >> 16)); v = idedrive[ide_drv]->multiple_mode; pw (59, (v > 0 ? 0x100 : 0) | v); totalsecs = ide->hdhfd.size / 512; - pw (60, totalsecs); - pw (61, totalsecs >> 16); + if (totalsecs > 0x0fffffff) + totalsecs = 0x0fffffff; + pw (60, (uae_u16)totalsecs); + pw (61, (uae_u16)(totalsecs >> 16)); pw (62, 0x0f); pw (63, 0x0f); pw (64, 0x03); /* PIO3 and PIO4 */ - pw (65, 120 << 8); /* MDMA2 supported */ - pw (66, 120 << 8); - pw (67, 120 << 8); - pw (68, 120 << 8); - pw (80, (1 << 1) | (1 << 2) | (1 << 3)); /* ATA-1 to ATA-3 */ - pw (81, 0x000A); /* ATA revision */ + pw (65, 120); /* MDMA2 supported */ + pw (66, 120); + pw (67, 120); + pw (68, 120); + pw (80, (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6)); /* ATA-1 to ATA-6 */ + pw (81, 0x1c); /* ATA revision */ + pw (82, (1 << 14)); /* NOP command supported */ + pw (83, (1 << 14) | (1 << 13) | (1 << 12) | (ide->lba48 ? (1 << 10) : 0)); /* cache flushes, LBA 48 supported */ + pw (84, 1 << 14); + pw (85, 1 << 14); + pw (86, (1 << 14) | (1 << 13) | (1 << 12) | (ide->lba48 ? (1 << 10) : 0)); /* cache flushes, LBA 48 enabled */ + pw (87, 1 << 14); + pw (88, (1 << 5) | (1 << 4) | (1 << 3) | (1 << 2) | (1 << 1) | (1 << 0)); /* UDMA modes */ + pw (93, (1 << 14) | (1 << 13) | (1 << 0)); + if (ide->lba48) { + totalsecs = ide->hdhfd.size / 512; + pw (100, (uae_u16)(totalsecs >> 0)); + pw (101, (uae_u16)(totalsecs >> 16)); + pw (102, (uae_u16)(totalsecs >> 32)); + pw (103, (uae_u16)(totalsecs >> 48)); + } } + static void ide_initialize_drive_parameters (void) { if (ide->hdhfd.size) { ide->hdhfd.secspertrack = ide_nsector == 0 ? 256 : ide_nsector; ide->hdhfd.heads = (ide_select & 15) + 1; ide->hdhfd.cyls = (ide->hdhfd.size / 512) / (ide->hdhfd.secspertrack * ide->hdhfd.heads); - if (ide->hdhfd.heads * ide->hdhfd.cyls * ide->hdhfd.secspertrack > 16515072) { + if (ide->hdhfd.heads * ide->hdhfd.cyls * ide->hdhfd.secspertrack > 16515072 || ide->lba48) { ide->hdhfd.cyls = ide->hdhfd.cyls_def; ide->hdhfd.heads = ide->hdhfd.heads_def; ide->hdhfd.secspertrack = ide->hdhfd.secspertrack_def; @@ -462,102 +496,152 @@ static void ide_set_multiple_mode (void) } static void ide_set_features (void) { - write_log ("IDE%d set features %02.2X (%02.2X)\n", ide->num, ide_feat, ide_nsector); + int type = ide_nsector >> 3; + int mode = ide_nsector & 7; + + write_log ("IDE%d set features %02X (%02X)\n", ide->num, ide_feat, ide_nsector); ide_fail (); } -static void get_lbachs (struct ide_hdf *ide, unsigned int *lba, unsigned int *cyl, unsigned int *head, unsigned int *sec) +static void get_lbachs (struct ide_hdf *ide, uae_u64 *lbap, unsigned int *cyl, unsigned int *head, unsigned int *sec, int lba48) { - if (ide_select & 0x40) { - *lba = ((ide_select & 15) << 24) | (ide_hcyl << 16) | (ide_lcyl << 8) | ide_sector; + if (lba48 && (ide_select & 0x40)) { + uae_u64 lba; + lba = (ide_hcyl << 16) | (ide_lcyl << 8) | ide_sector; + lba |= ((ide_hcyl2 << 16) | (ide_lcyl2 << 8) | ide_sector2) << 24; + *lbap = lba; } else { - *cyl = (ide_hcyl << 8) | ide_lcyl; - *head = ide_select & 15; - *sec = ide_sector; - *lba = (((*cyl) * ide->hdhfd.heads + (*head)) * ide->hdhfd.secspertrack) + (*sec) - 1; + if (ide_select & 0x40) { + *lbap = ((ide_select & 15) << 24) | (ide_hcyl << 16) | (ide_lcyl << 8) | ide_sector; + } else { + *cyl = (ide_hcyl << 8) | ide_lcyl; + *head = ide_select & 15; + *sec = ide_sector; + *lbap = (((*cyl) * ide->hdhfd.heads + (*head)) * ide->hdhfd.secspertrack) + (*sec) - 1; + } } } -static void put_lbachs (struct ide_hdf *ide, unsigned int lba, unsigned int cyl, unsigned int head, unsigned int sec, unsigned int inc) + +static int get_nsec (int lba48) +{ + if (lba48) + return (ide_nsector == 0 && ide_nsector2 == 0) ? 65536 : (ide_nsector2 * 256 + ide_nsector); + else + return ide_nsector == 0 ? 256 : ide_nsector; +} + +static void put_lbachs (struct ide_hdf *ide, uae_u64 lba, unsigned int cyl, unsigned int head, unsigned int sec, unsigned int inc, int lba48) { - if (ide_select & 0x40) { + if (lba48) { lba += inc; - ide_select &= ~15; - ide_select |= (lba >> 24) & 15; ide_hcyl = (lba >> 16) & 0xff; ide_lcyl = (lba >> 8) & 0xff; ide_sector = lba & 0xff; + lba >>= 24; + ide_hcyl2 = (lba >> 16) & 0xff; + ide_lcyl2 = (lba >> 8) & 0xff; + ide_sector2 = lba & 0xff; } else { - sec += inc; - while (sec >= ide->hdhfd.secspertrack) { - sec -= ide->hdhfd.secspertrack; - head++; - if (head >= ide->hdhfd.heads) { - head -= ide->hdhfd.heads; - cyl++; + if (ide_select & 0x40) { + lba += inc; + ide_select &= ~15; + ide_select |= (lba >> 24) & 15; + ide_hcyl = (lba >> 16) & 0xff; + ide_lcyl = (lba >> 8) & 0xff; + ide_sector = lba & 0xff; + } else { + sec += inc; + while (sec >= ide->hdhfd.secspertrack) { + sec -= ide->hdhfd.secspertrack; + head++; + if (head >= ide->hdhfd.heads) { + head -= ide->hdhfd.heads; + cyl++; + } } + ide_select &= ~15; + ide_select |= head; + ide_sector = sec; + ide_hcyl = cyl >> 8; + ide_lcyl = (uae_u8)cyl; } - ide_select &= ~15; - ide_select |= head; - ide_sector = sec; - ide_hcyl = cyl >> 8; - ide_lcyl = (uae_u8)cyl; } ide_nsector = 0; } -static void ide_read_sectors (int multi) +static void ide_read_sectors (int flags) { - unsigned int cyl, head, sec, nsec, lba; + unsigned int cyl, head, sec, nsec; + uae_u64 lba; + int multi = flags & 1; + int lba48 = flags & 2; if (multi && ide->multiple_mode == 0) { ide_fail (); return; } gui_hd_led (ide->num, 1); - nsec = ide_nsector == 0 ? 256 : ide_nsector; - get_lbachs (ide, &lba, &cyl, &head, &sec); + nsec = get_nsec (lba48); + get_lbachs (ide, &lba, &cyl, &head, &sec, lba48); if (IDE_LOG > 0) - write_log ("IDE%d read offset=%d, sectors=%d (%d)\n", ide->num, lba, nsec, ide->multiple_mode); + write_log ("IDE%d read off=%d, sec=%d (%d) lba%d\n", ide->num, (uae_u32)lba, nsec, ide->multiple_mode, lba48 ? 48 : 28); if (multi && ide->multiple_mode > nsec) nsec = ide->multiple_mode; if (lba * 512 >= ide->hdhfd.size) { - ide_fail (); + ide_data_ready (1); + ide_fail_err (IDE_ERR_IDNF); return; } if (nsec * 512 > ide->hdhfd.size - lba * 512) nsec = (ide->hdhfd.size - lba * 512) / 512; + if (nsec <= 0) { + ide_data_ready (1); + ide_fail_err (IDE_ERR_IDNF); + return; + } ide_data_ready (nsec); - hdf_read (&ide->hdhfd.hfd, ide->secbuf, (uae_u64)lba * 512, nsec * 512); - put_lbachs (ide, lba, cyl, head, sec, nsec); + hdf_read (&ide->hdhfd.hfd, ide->secbuf, lba * 512, nsec * 512); + put_lbachs (ide, lba, cyl, head, sec, nsec, lba48); ide->data_multi = multi ? ide->multiple_mode : 1; } -static void ide_write_sectors (int multi) +static void ide_write_sectors (int flags) { - unsigned int cyl, head, sec, nsec, lba; + unsigned int cyl, head, sec, nsec; + uae_u64 lba; + int multi = flags & 1; + int lba48 = flags & 2; if (multi && ide->multiple_mode == 0) { ide_fail (); return; } gui_hd_led (ide->num, 2); - nsec = ide_nsector == 0 ? 256 : ide_nsector; - get_lbachs (ide, &lba, &cyl, &head, &sec); + nsec = get_nsec (lba48); + get_lbachs (ide, &lba, &cyl, &head, &sec, lba48); if (lba * 512 >= ide->hdhfd.size) { - ide_fail (); + ide_data_ready (1); + ide_fail_err (IDE_ERR_IDNF); return; } if (IDE_LOG > 0) - write_log ("IDE%d write offset=%d, sectors=%d (%d)\n", ide->num, lba, nsec, ide->multiple_mode); + write_log ("IDE%d write off=%d, sec=%d (%d) lba%d\n", ide->num, (uae_u32)lba, nsec, ide->multiple_mode, lba48 ? 48 : 28); if (nsec * 512 > ide->hdhfd.size - lba * 512) nsec = (ide->hdhfd.size - lba * 512) / 512; + if (nsec <= 0) { + ide_data_ready (1); + ide_fail_err (IDE_ERR_IDNF); + return; + } ide_data_ready (nsec); ide->data_multi = multi ? ide->multiple_mode : 1; } static void ide_do_command (uae_u8 cmd) { + int lba48 = ide->lba48; + if (IDE_LOG > 1) - write_log ("**** IDE%d command %02.2X\n", ide->num, cmd); + write_log ("**** IDE%d command %02X\n", ide->num, cmd); ide->status &= ~ (IDE_STATUS_DRDY | IDE_STATUS_DRQ | IDE_STATUS_ERR); ide_error = 0; @@ -571,18 +655,33 @@ static void ide_do_command (uae_u8 cmd) ide_set_multiple_mode (); } else if (cmd == 0x20 || cmd == 0x21) { /* read sectors */ ide_read_sectors (0); - } else if (cmd == 0x30 || cmd == 0x31) { /* write sectors */ - ide_write_sectors (0); + } else if (cmd == 0x24 && lba48) { /* read sectors ext */ + ide_read_sectors (2); } else if (cmd == 0xc4) { /* read multiple */ ide_read_sectors (1); + } else if (cmd == 0x29 && lba48) { /* read multiple ext */ + ide_read_sectors (1|2); + } else if (cmd == 0x30 || cmd == 0x31) { /* write sectors */ + ide_write_sectors (0); + } else if (cmd == 0x34 && lba48) { /* write sectors ext */ + ide_write_sectors (2); } else if (cmd == 0xc5) { /* write multiple */ ide_write_sectors (1); + } else if (cmd == 0x39 && lba48) { /* write multiple ext */ + ide_write_sectors (1|2); } else if (cmd == 0x50) { /* format track (nop) */ ide_interrupt (); } else if (cmd == 0xa1) { /* ATAPI identify (IDE HD is not ATAPI) */ ide_fail (); } else if (cmd == 0xef) { /* set features */ ide_set_features (); + } else if (cmd == 0x00) { /* nop */ + ide_fail (); + } else if (cmd == 0xe0 || cmd == 0xe1 || cmd == 0xe7 || cmd == 0xea) { /* standy now/idle/flush cache/flush cache ext */ + ide_interrupt (); + } else if (cmd == 0xe5) { /* check power mode */ + ide_nsector = 0xff; + ide_interrupt (); } else { ide_fail (); write_log ("IDE%d: unknown command %x\n", ide->num, cmd); @@ -602,8 +701,8 @@ static uae_u16 ide_get_data (void) return 0; } v = ide->secbuf[ide->data_offset + 1] | (ide->secbuf[ide->data_offset + 0] << 8); - ide->data_offset+=2; - ide->data_size-=2; + ide->data_offset += 2; + ide->data_size -= 2; if (((ide->data_offset % 512) == 0) && ((ide->data_offset / 512) % ide->data_multi) == 0) irq = 1; if (ide->data_size == 0) { @@ -625,22 +724,24 @@ static void ide_put_data (uae_u16 v) } ide->secbuf[ide->data_offset + 1] = v & 0xff; ide->secbuf[ide->data_offset + 0] = v >> 8; - ide->data_offset+=2; - ide->data_size-=2; + ide->data_offset += 2; + ide->data_size -= 2; if (((ide->data_offset % 512) == 0) && ((ide->data_offset / 512) % ide->data_multi) == 0) { if (IDE_LOG > 0) write_log ("IDE%d write interrupt, %d total bytes transferred so far\n", ide->num, ide->data_offset); irq = 1; } if (ide->data_size == 0) { - unsigned int lba, cyl, head, sec, nsec; + unsigned int cyl, head, sec, nsec; + uae_u64 lba; + ide->status &= ~IDE_STATUS_DRQ; nsec = ide->data_offset / 512; - get_lbachs (ide, &lba, &cyl, &head, &sec); + get_lbachs (ide, &lba, &cyl, &head, &sec, ide->lba48); if (IDE_LOG > 0) write_log ("IDE%d write finished, %d bytes (%d) written\n", ide->num, ide->data_offset, ide->data_offset / 512); - hdf_write (&ide->hdhfd.hfd, ide->secbuf, (uae_u64)lba * 512, ide->data_offset); - put_lbachs (ide, lba, cyl, head, sec, nsec); + hdf_write (&ide->hdhfd.hfd, ide->secbuf, lba * 512, ide->data_offset); + put_lbachs (ide, lba, cyl, head, sec, nsec, ide->lba48); irq = 1; } if (irq) @@ -672,8 +773,8 @@ static uae_u32 ide_read (uaecptr addr) uae_u8 v = 0; addr &= 0xffff; - if (IDE_LOG > 1 && addr != 0x2000 && addr != 0x2001 && addr != 0x2020 && addr != 0x2021 && addr != GAYLE_IRQ_1200) - write_log ("IDE_READ %08.8X PC=%X\n", addr, M68K_GETPC); + if (IDE_LOG > 2 && addr != 0x2000 && addr != 0x2001 && addr != 0x2020 && addr != 0x2021 && addr != GAYLE_IRQ_1200) + write_log ("IDE_READ %08X PC=%X\n", addr, M68K_GETPC); if (currprefs.cs_ide <= 0) { if (addr == 0x201c) // AR1200 IDE detection hack return 0x7f; @@ -740,11 +841,9 @@ static uae_u32 ide_read (uaecptr addr) case IDE_SELECT: v = ide_select; break; - case IDE_DEVCON: - v = ide_devcon; - break; case IDE_STATUS: - ide->irq = 0; + ide->irq = 0; /* fall through */ + case IDE_DEVCON: /* ALTSTATUS when reading */ if (ide->hdhfd.size == 0) { v = 0; if (ide_error) @@ -756,7 +855,7 @@ static uae_u32 ide_read (uaecptr addr) break; } if (IDE_LOG > 2 && ide_reg > 0) - write_log ("IDE%d register %d->%02.2X\n", ide->num, ide_reg, (uae_u32)v & 0xff); + write_log ("IDE%d register %d->%02X\n", ide->num, ide_reg, (uae_u32)v & 0xff); return v; } @@ -764,9 +863,8 @@ static void ide_write (uaecptr addr, uae_u32 val) { int ide_reg; - ide_devcon &= ~0x80; - if (IDE_LOG > 1 && addr != 0x2000 && addr != 0x2001 && addr != 0x2020 && addr != 0x2021 && addr != GAYLE_IRQ_1200) - write_log ("IDE_WRITE %08.8X=%02.2X PC=%X\n", addr, (uae_u32)val & 0xff, M68K_GETPC); + if (IDE_LOG > 2 && addr != 0x2000 && addr != 0x2001 && addr != 0x2020 && addr != 0x2021 && addr != GAYLE_IRQ_1200) + write_log ("IDE_WRITE %08X=%02X PC=%X\n", addr, (uae_u32)val & 0xff, M68K_GETPC); if (currprefs.cs_ide <= 0) return; if (currprefs.cs_ide == 1) { @@ -781,9 +879,10 @@ static void ide_write (uaecptr addr, uae_u32 val) } if (addr >= 0x4000) return; + ide_devcon &= ~0x80; /* clear HOB */ ide_reg = get_ide_reg (addr); if (IDE_LOG > 2 && ide_reg > 0) - write_log ("IDE%d register %d=%02.2X\n", ide->num, ide_reg, (uae_u32)val & 0xff); + write_log ("IDE%d register %d=%02X\n", ide->num, ide_reg, (uae_u32)val & 0xff); switch (ide_reg) { case IDE_DRVADDR: @@ -1647,6 +1746,24 @@ static void alloc_ide_mem (void) } } +#include "zfile.h" +static void dumphdf (struct hardfiledata *hfd) +{ + int i; + uae_u8 buf[512]; + int off; + struct zfile *zf; + + zf = zfile_fopen ("c:\\d\\tmp.dmp", "wb"); + off = 0; + for (i = 0; i < 128; i++) { + hdf_read (hfd, buf, off, 512); + zfile_fwrite (buf, 1, 512, zf); + off += 512; + } + zfile_fclose (zf); +} + int gayle_add_ide_unit (int ch, char *path, int blocksize, int readonly, char *devname, int sectors, int surfaces, int reserved, int bootpri, char *filesys) @@ -1656,13 +1773,16 @@ int gayle_add_ide_unit (int ch, char *path, int blocksize, int readonly, if (ch >= 4) return -1; alloc_ide_mem (); - ide = idedrive[ch] = xcalloc (sizeof (struct ide_hdf), 1); + ide = idedrive[ch]; if (!hdf_hd_open (&ide->hdhfd, path, blocksize, readonly, devname, sectors, surfaces, reserved, bootpri, filesys)) return -1; - write_log ("IDE%d ('%s'), CHS=%d,%d,%d\n", ch, path, ide->hdhfd.cyls, ide->hdhfd.heads, ide->hdhfd.secspertrack); + ide->lba48 = ide->hdhfd.size >= 128 * (uae_u64)0x40000000 ? 1 : 0; + write_log ("IDE%d '%s', CHS=%d,%d,%d. %uM. LBA48=%d\n", + ch, path, ide->hdhfd.cyls, ide->hdhfd.heads, ide->hdhfd.secspertrack, (int)(ide->hdhfd.size / (1024 * 1024)), ide->lba48); ide->status = 0; ide->data_offset = 0; ide->data_size = 0; + dumphdf (&ide->hdhfd.hfd); return 1; } diff --git a/include/debug.h b/include/debug.h index b431929a..e1272cba 100755 --- a/include/debug.h +++ b/include/debug.h @@ -9,7 +9,7 @@ #ifdef DEBUGGER -#define MAX_HIST 100 +#define MAX_HIST 500 #define MAX_LINEWIDTH 100 extern int debugging; diff --git a/inputdevice.c b/inputdevice.c index 43bccef0..aaed2ff7 100755 --- a/inputdevice.c +++ b/inputdevice.c @@ -804,7 +804,7 @@ static int lastmx, lastmy; static uae_u32 magicmouse_ibase = 0; #define intui "intuition.library" -static uaecptr get_intuitionbase(void) +static uaecptr get_intuitionbase (void) { uaecptr v = get_long (4); addrbank *b = &get_mem_bank(v); @@ -849,6 +849,7 @@ static void mousehack_enable (void) static void mousehack_setpos (int mousexpos, int mouseypos) { uae_u8 *p; + if (!uae_boot_rom) return; p = rtarea + get_long (rtarea_base + 40) + 12; @@ -2465,8 +2466,8 @@ void inputdevice_updateconfig (struct uae_prefs *prefs) cd32_pad_enabled[1] = 1; #endif - if (mousehack_allowed()) - mousehack_enable(); + if (mousehack_allowed ()) + mousehack_enable (); } /* called when devices get inserted or removed */ diff --git a/jit/compemu_support.c b/jit/compemu_support.c index 30ef9f3e..020d6be8 100755 --- a/jit/compemu_support.c +++ b/jit/compemu_support.c @@ -467,9 +467,7 @@ int check_prefs_changed_comp (void) currprefs.comp_midopt=changed_prefs.comp_midopt; currprefs.comp_lowopt=changed_prefs.comp_lowopt; - if ((!canbang || !currprefs.cachesize) && - currprefs.comptrustbyte != 1) - { + if ((!canbang || !currprefs.cachesize) && currprefs.comptrustbyte != 1) { // Set all of these to indirect when canbang == 0 // Basically, set the compforcesettings option... currprefs.comptrustbyte = 1; diff --git a/newcpu.c b/newcpu.c index 3da5ca8f..eecc4f5a 100755 --- a/newcpu.c +++ b/newcpu.c @@ -1686,7 +1686,7 @@ unsigned long REGPARAM2 op_illg (uae_u32 opcode, struct regstruct *regs) return 4; } if (warned < 20) { - write_log ("Illegal instruction: %04x at %08.8X -> %08.8X\n", opcode, pc, get_long (regs->vbr + 0x10)); + write_log ("Illegal instruction: %04x at %08X -> %08X\n", opcode, pc, get_long (regs->vbr + 0x10)); warned++; } @@ -2108,13 +2108,13 @@ static void out_cd32io (uae_u32 pc) cd32nextpc = get_long (m68k_areg (®s, 7)); write_log ("%s A1=%08.8X\n", out, request); if (ioreq) { - static int cnt = 26; + static int cnt = 0; int cmd = get_word (request + 28); -#if 0 - if (cmd == 2) { +#if 1 + if (cmd == 37) { cnt--; - if (cnt == 0) - activate_debugger (1); + if (cnt <= 0) + activate_debugger (); } #endif write_log ("CMD=%d DATA=%08.8X LEN=%d %OFF=%d PC=%x\n", diff --git a/od-win32/ahidsound.c b/od-win32/ahidsound.c index b499e61d..ef050a37 100755 --- a/od-win32/ahidsound.c +++ b/od-win32/ahidsound.c @@ -547,10 +547,10 @@ uae_u32 REGPARAM2 ahi_demux (TrapContext *context) return 1; case 10: - if (OpenClipboard(0)) { - clipdat=GetClipboardData(CF_TEXT); + if (OpenClipboard (0)) { + clipdat = GetClipboardData (CF_TEXT); if (clipdat) { - clipsize=strlen(clipdat); + clipsize = strlen (clipdat); clipsize++; return clipsize; } @@ -562,7 +562,7 @@ uae_u32 REGPARAM2 ahi_demux (TrapContext *context) int i; for (i = 0; i < clipsize; i++) put_byte (m68k_areg (&context->regs, 0) + i, clipdat[i]); - CloseClipboard(); + CloseClipboard (); } return 0; @@ -639,7 +639,7 @@ uae_u32 REGPARAM2 ahi_demux (TrapContext *context) m = (HMODULE) m68k_dreg (&context->regs, 1); funcname = (char *)m68k_areg (&context->regs, 0); funcname = (char *)get_real_address ((uae_u32)funcname); - return (uae_u32) GetProcAddress(m,funcname); + return (uae_u32) GetProcAddress (m,funcname); } case 102: //execute native code @@ -800,7 +800,7 @@ uae_u32 REGPARAM2 ahi_demux (TrapContext *context) case 108: //frees swap array bswap_buffer_size = 0; - free(bswap_buffer); + free (bswap_buffer); bswap_buffer = NULL; return 0; #endif diff --git a/od-win32/cloanto/RetroPlatformIPC.h b/od-win32/cloanto/RetroPlatformIPC.h index e1c1a516..98a6810a 100755 --- a/od-win32/cloanto/RetroPlatformIPC.h +++ b/od-win32/cloanto/RetroPlatformIPC.h @@ -7,7 +7,7 @@ : License version 2 as published by the Free Software Foundation. Authors : os, mcb Created : 2007-08-27 13:55:49 - Updated : 2008-03-25 18:49:00 + Updated : 2008-04-03 15:18:00 Comment : RP Player interprocess communication include file *****************************************************************************/ @@ -33,6 +33,8 @@ #define RPIPCGM_CLOSED (WM_APP + 2) #define RPIPCGM_ACTIVATED (WM_APP + 3) #define RPIPCGM_DEACTIVATED (WM_APP + 4) +#define RPIPCGM_ENABLED (WM_APP + 5) +#define RPIPCGM_DISABLED (WM_APP + 6) #define RPIPCGM_SCREENMODE (WM_APP + 9) #define RPIPCGM_POWERLED (WM_APP + 10) #define RPIPCGM_DEVICES (WM_APP + 11) @@ -65,7 +67,6 @@ #define RPIPCHM_ESCAPEKEY (WM_APP + 210) #define RPIPCHM_EVENT (WM_APP + 211) #define RPIPCHM_MOUSECAPTURE (WM_APP + 212) -#define RPIPCHM_SCREENCLIP (WM_APP + 213) // **************************************************************************** @@ -74,21 +75,36 @@ // Guest Features #define RP_FEATURE_POWERLED 0x00000001 // a power LED is emulated -#define RP_FEATURE_SCREEN1X 0x00000002 // 1x windowed mode is available -#define RP_FEATURE_SCREEN2X 0x00000004 // 2x windowed mode is available -#define RP_FEATURE_SCREEN4X 0x00000008 // 4x windowed mode is available -#define RP_FEATURE_FULLSCREEN 0x00000010 // full screen display is available -#define RP_FEATURE_SCREENCAPTURE 0x00000020 // screen capture functionality is available (see RPIPCHM_SCREENCAPTURE message) -#define RP_FEATURE_PAUSE 0x00000040 // pause functionality is available (see RPIPCHM_PAUSE message) -#define RP_FEATURE_TURBO 0x00000080 // turbo mode functionality is available (see RPIPCHM_TURBO message) -#define RP_FEATURE_VOLUME 0x00000100 // volume adjustment is possible (see RPIPCHM_VOLUME message) -#define RP_FEATURE_SCREENCLIP 0x00000200 // screen clipping is supported (see RPIPCHM_SCREENCLIP message) +#define RP_FEATURE_SCREEN1X 0x00000002 // 1x mode is available +#define RP_FEATURE_SCREEN2X 0x00000004 // 2x mode is available +#define RP_FEATURE_SCREEN3X 0x00000008 // 3x mode is available +#define RP_FEATURE_SCREEN4X 0x00000010 // 4x mode is available +#define RP_FEATURE_FULLSCREEN 0x00000020 // full screen display is available +#define RP_FEATURE_SCREENCAPTURE 0x00000040 // screen capture functionality is available (see RPIPCHM_SCREENCAPTURE message) +#define RP_FEATURE_PAUSE 0x00000080 // pause functionality is available (see RPIPCHM_PAUSE message) +#define RP_FEATURE_TURBO 0x00000100 // turbo mode functionality is available (see RPIPCHM_TURBO message) +#define RP_FEATURE_VOLUME 0x00000200 // volume adjustment is possible (see RPIPCHM_VOLUME message) // Screen Modes -#define RP_SCREENMODE_1X 0 // 1x windowed mode -#define RP_SCREENMODE_2X 1 // 2x windowed mode -#define RP_SCREENMODE_4X 2 // 4x windowed mode -#define RP_SCREENMODE_FULLSCREEN 3 // full screen +#define RP_SCREENMODE_1X 0x00000000 // 1x window or full-screen mode ("CGA mode") +#define RP_SCREENMODE_2X 0x00000001 // 2x window or full-screen mode ("VGA mode") +#define RP_SCREENMODE_3X 0x00000002 // 3x window or full-screen mode ("triple CGA mode") +#define RP_SCREENMODE_4X 0x00000003 // 4x window or full-screen mode ("double VGA mode") +#define RP_SCREENMODE_FULLSCREEN_1 0x00000100 // full screen on primary (default) display +#define RP_SCREENMODE_FULLSCREEN_2 0x00000200 // full screen on secondary display (fallback to 1 if unavailable) +#define RP_SCREENMODE_FULLWINDOW 0x00010000 // use "full window" when in fullscreen (no gfx card full screen) +#define RP_SCREENMODE_MODE(m) ((m) & 0x000000FF) // given a mode 'm' returns the #X mode +#define RP_SCREENMODE_DISPLAY(m) (((m) >> 8) & 0x000000FF) // given a mode 'm' returns the display number (1-255) or 0 if full screen is not active + +typedef struct RPScreenMode +{ + DWORD dwScreenMode; // RP_SCREENMODE_* values and flags + LONG lClipLeft; // 0 = reset, -1 = ignore + LONG lClipTop; // 0 = reset, -1 = ignore + LONG lClipWidth; // 0 = reset, -1 = ignore + LONG lClipHeight; // 0 = reset, -1 = ignore + HWND hGuestWindow; // only valid for RPIPCGM_SCREENMODE +} RPSCREENMODE; // Device Categories #define RP_DEVICE_FLOPPY 0 // floppy disk drive @@ -134,12 +150,4 @@ typedef struct RPDeviceContent #define RP_MOUSECAPTURE_CAPTURED 0x00000001 #define RP_MOUSECAPTURE_MAGICMOUSE 0x00000002 -typedef struct RPScreenClip -{ - LONG lLeft; - LONG lTop; - LONG lWidth; - LONG lHeight; -} RPSCREENCLIP; - #endif // __CLOANTO_RETROPLATFORMIPC_H__ diff --git a/od-win32/cloanto/RetroPlatformIPC_doc_draft.txt b/od-win32/cloanto/RetroPlatformIPC_doc_draft.txt index a867aea4..afab61a1 100755 --- a/od-win32/cloanto/RetroPlatformIPC_doc_draft.txt +++ b/od-win32/cloanto/RetroPlatformIPC_doc_draft.txt @@ -27,7 +27,7 @@ Description: RPIPCGM_DEVICECONTENT (one for each device with an image file or peripheral attached), RPIPCGM_TURBO (tells if some of the turbo modes are activated from the start), RPIPCGM_VOLUME (reports about starting volume level), - RPIPCGM_SCREENMODE (communicates the screen mode and the guest window handle); + RPIPCGM_SCREENMODE (communicates the screen mode, the clipping coordinates and the guest window handle); note that at startup time the guest should create a borderless and hidden window and send its handle using a RPIPCGM_SCREENMODE message, which must be the last of the initialization messages, since it displays the guest window @@ -71,11 +71,36 @@ Response: none +Message: + RPIPCGM_ENABLED +Description: + the guest sends this message to the host when its window is being enabled + (e.g. a WM_ENABLE message has been received with wParam set to TRUE); + this usually occurs when closing a modal dialog (with guest's window as parent) +Data sent: + none +Response: + none + + +Message: + RPIPCGM_DISABLED +Description: + the guest sends this message to the host when its window is being disabled + (e.g. a WM_ENABLE message has been received with wParam set to FALSE); + this usually occurs when opening a modal dialog (with guest's window as parent) +Data sent: + none +Response: + none + + Message: RPIPCGM_SCREENMODE Description: the guest sends a RPIPCGM_SCREENMODE message to notify the host - about a change in its "screen mode" (1x/2x/4x/full screen, etc.); + about a change in its "screen mode" + (1x/2x/3x/4x, full screen, clipping coordinates, etc.); screen mode changes requested by the host (see the RPIPCHM_SCREENMODE message) must not be notified, unless this is an asynchronous screen mode change @@ -88,8 +113,7 @@ Description: using this message; the host will then take care of preparing, positioning and showing the guest window Data sent: - WPARAM = new screen mode (RP_SCREENMODE_* value) - LPARAM = handle of the (new) guest window + pData = a RPSCREENMODE structure Response: none @@ -156,7 +180,10 @@ Description: the mouse should not be captured when the guest window gets the focus, but when a mouse button event is received Data sent: - WPARAM = mouse capture state (RP_MOUSECAPTURE_* value) + WPARAM = mouse capture state (RP_MOUSECAPTURE_* flags) + four possible states are currently possible + (i.e. the mouse can be captured or not + and the magic mouse feature can be active or not) Response: none @@ -310,11 +337,23 @@ Response: Message: RPIPCHM_SCREENMODE Description: - this message is sent to ask the guest to activate a specified screen mode; + this message is sent to ask the guest to activate a specified screen mode + and clipping coordinates; when switching to the new screen mode, the guest can resize (reuse) its window - or close its window and open a new one + or close its window and open a new one; + if output to a secondary display is requested, and only one + display is available, or more than two displays are available, + it is up to the guest to gracefully choose a display Data sent: - WPARAM = RP_SCREENMODE_* value + pData = a RPSCREENMODE structure, with screen mode values/flags + and clipping coordinates (the hGuestWindow field is ignored); + as regards the clipping coordinates, the fields set to 0 mean "reset" + (no offset for lClipLeft/lClipTop, maximum size if lClipWidth/lClipHeight) + and fields set to -1 are ignored (left unchanged); units are in pixels; + for Amiga systems, where pixels may have different sizes, horizontal + units are in superhires pixels (4 x lores) for Amiga modes, and + vertical units are in interlaced pixels (2 x non-interlaced), whereas + RTG pixels are always 1:1 Response: LRESULT = handle of the (new) guest window or NULL (the screen mode couldn't be changed) @@ -440,93 +479,8 @@ Message: RPIPCHM_MOUSECAPTURE Description: the host uses this message to ask the guest - to capture or release the mouse + to capture or release the mouse (and activate/deactivate the magic mouse functionality) Data sent: - WPARAM = mouse capture state being requested (RP_MOUSECAPTURE_* value) + WPARAM = mouse capture state being requested (RP_MOUSECAPTURE_* flags) Response: LRESULT = non-zero if the guest executed the command - - -Message: - RPIPCHM_SCREENCLIP -Description: - this command is used to set the clipping coordinates of the screen -Data sent: - pData = a RPSCREENCLIP structure -Response: - LRESULT = non-zero if the guest executed the command - - - -// **************************************************************************** -// Message Data Structures and Defines -// **************************************************************************** - -// Guest Features -#define RP_FEATURE_POWERLED 0x00000001 // a power LED is emulated -#define RP_FEATURE_SCREEN1X 0x00000002 // 1x windowed mode is available -#define RP_FEATURE_SCREEN2X 0x00000004 // 2x windowed mode is available -#define RP_FEATURE_SCREEN4X 0x00000008 // 4x windowed mode is available -#define RP_FEATURE_FULLSCREEN 0x00000010 // full screen display is available -#define RP_FEATURE_SCREENCAPTURE 0x00000020 // screen capture functionality is available (see RPIPCHM_SCREENCAPTURE message) -#define RP_FEATURE_PAUSE 0x00000040 // pause functionality is available (see RPIPCHM_PAUSE message) -#define RP_FEATURE_TURBO 0x00000080 // turbo mode functionality is available (see RPIPCHM_TURBO message) -#define RP_FEATURE_VOLUME 0x00000100 // volume adjustment is possible (see RPIPCHM_VOLUME message) - -// Screen Modes -#define RP_SCREENMODE_1X 0 // 1x windowed mode -#define RP_SCREENMODE_2X 1 // 2x windowed mode -#define RP_SCREENMODE_4X 2 // 4x windowed mode -#define RP_SCREENMODE_FULLSCREEN 3 // full screen - -// Device Categories -#define RP_DEVICE_FLOPPY 0 // floppy disk drive -#define RP_DEVICE_HD 1 // hard disk drive -#define RP_DEVICE_CD 2 // CD/DVD drive -#define RP_DEVICE_NET 3 // network card -#define RP_DEVICE_TAPE 4 // cassette tape drive -#define RP_DEVICE_CARTRIDGE 5 // expansion cartridge -#define RP_DEVICE_INPUTPORT 6 // input port - -typedef struct RPDeviceContent -{ - BYTE btDeviceCategory; // RP_DEVICE_* value - BYTE btDeviceNumber; // device number (range 0..31) - WCHAR szContent[1]; // full path and name of the image file to load, or input port device (Unicode, variable-sized field) -} RPDEVICECONTENT; - -// Input Port Devices -#define RP_IPD_MOUSE1 L"Mouse1" // first mouse type (e.g. Windows Mouse for WinUAE) -#define RP_IPD_MOUSE2 L"Mouse2" // second mouse type (e.g. Mouse for WinUAE) -#define RP_IPD_MOUSE3 L"Mouse3" // third mouse type (e.g. Mousehack Mouse for WinUAE) -#define RP_IPD_MOUSE4 L"Mouse4" // fourth mouse type (e.g. RAW Mouse for WinUAE) -#define RP_IPD_JOYSTICK1 L"Joystick1" // first joystick type (e.g. standard joystick for WinUAE, described as "Joystick1\ProductGUID\ProductName") -#define RP_IPD_JOYSTICK2 L"Joystick2" // second joystick type (e.g. X-Arcade (Left) joystick for WinUAE, described as "Joystick2\ProductGUID\ProductName") -#define RP_IPD_JOYSTICK3 L"Joystick3" // third joystick type (e.g. X-Arcade (Right) joystick for WinUAE, described as "Joystick3\ProductGUID\ProductName") -#define RP_IPD_KEYBDL1 L"KeyboardLayout1" // first joystick emulation keyboard layout (e.g. Keyboard Layout A for WinUAE) -#define RP_IPD_KEYBDL2 L"KeyboardLayout2" // second joystick emulation keyboard layout (e.g. Keyboard Layout B for WinUAE) -#define RP_IPD_KEYBDL3 L"KeyboardLayout3" // third joystick emulation keyboard layout (e.g. Keyboard Layout C for WinUAE) - -// Turbo Mode Functionalities -#define RP_TURBO_CPU 0x00000001 // CPU -#define RP_TURBO_FLOPPY 0x00000002 // floppy disk drive -#define RP_TURBO_TAPE 0x00000004 // cassette tape drive - -// Reset Type -#define RP_RESET_SOFT 0 // soft reset -#define RP_RESET_HARD 1 // hard reset - -// RPIPCGM_MOUSECAPTURE/RPIPCHM_MOUSECAPTURE -#define RP_MOUSECAPTURE_UNCAPTURED 0 -#define RP_MOUSECAPTURE_CAPTURED 1 -#define RP_MOUSECAPTURE_MAGICMOUSE 2 - -typedef struct RPScreenClip -{ - LONG lLeft; - LONG lTop; - LONG lWidth; - LONG lHeight; -} RPSCREENCLIP; - -#endif // __CLOANTO_RETROPLATFORMIPC_H__ diff --git a/od-win32/dxwrap.c b/od-win32/dxwrap.c index 7387f7bd..bec41a82 100755 --- a/od-win32/dxwrap.c +++ b/od-win32/dxwrap.c @@ -249,7 +249,7 @@ HRESULT DirectDraw_CreateMainSurface (int width, int height) return ddrval; } -HRESULT DirectDraw_SetDisplayMode(int width, int height, int bits, int freq) +HRESULT DirectDraw_SetDisplayMode (int width, int height, int bits, int freq) { HRESULT ddrval; diff --git a/od-win32/hardfile_win32.c b/od-win32/hardfile_win32.c index 5d841bf5..271acea5 100755 --- a/od-win32/hardfile_win32.c +++ b/od-win32/hardfile_win32.c @@ -374,7 +374,7 @@ static int hdf_seek (struct hardfiledata *hfd, uae_u64 offset) } offset += hfd->offset; if (offset & (hfd->blocksize - 1)) { - gui_message ("hd: poscheck failed, offset not aligned to blocksize! (%I64X & %04.4X = %04.4X)\n", offset, hfd->blocksize, offset & (hfd->blocksize - 1)); + gui_message ("hd: poscheck failed, offset not aligned to blocksize! (%I64X & %04X = %04X)\n", offset, hfd->blocksize, offset & (hfd->blocksize - 1)); abort (); } if (hfd->handle_valid == HDF_HANDLE_WIN32) { diff --git a/od-win32/parser.c b/od-win32/parser.c index 16b85788..1d015d9e 100755 --- a/od-win32/parser.c +++ b/od-win32/parser.c @@ -38,6 +38,8 @@ #include "od-win32/parser.h" #include "od-win32/midi.h" #include "od-win32/ahidsound.h" +#include "picasso96_win.h" +#include "win32gfx.h" #include "win32.h" #include "ioport.h" #include "parallel.h" @@ -1066,6 +1068,9 @@ void initparallel (void) } } +extern int flashscreen; +extern void DX_Fill (int dstx, int dsty, int width, int height, uae_u32 color); + void hsyncstuff(void) //only generate Interrupts when //writebuffer is complete flushed @@ -1088,18 +1093,19 @@ void hsyncstuff(void) #endif #ifdef PARALLEL_PORT keycheck++; - if(keycheck==1000) + if(keycheck >= 1000) { flushprtbuf (); { #if defined(AHI) - extern flashscreen; - int DX_Fill( int , int , int, int, uae_u32 , enum RGBFTYPE ); //extern int warned_JIT_0xF10000; //warned_JIT_0xF10000 = 0; - if (flashscreen) { - DX_Fill(0,0,300,40,0x000000,9); + if (flashscreen > 0) { + DX_Fill (0, 0, -1, 30, 0x000000); + DX_Invalidate (0, 0, -1, 30); flashscreen--; + if (flashscreen == 0) + picasso_refresh (); } #endif } diff --git a/od-win32/picasso96_win.c b/od-win32/picasso96_win.c index f978c711..4cc05c17 100755 --- a/od-win32/picasso96_win.c +++ b/od-win32/picasso96_win.c @@ -71,9 +71,9 @@ void mman_ResetWatch (PVOID lpBaseAddress, SIZE_T dwRegionSize); #define P96TRACING_ENABLED 0 int p96hack_vpos, p96hack_vpos2, p96refresh_active; -int have_done_picasso; /* For the JIT compiler */ +int have_done_picasso = 1; /* For the JIT compiler */ static int p96syncrate; -int p96hsync_counter, palette_changed; +int p96hsync_counter, full_refresh; #if defined(X86_MSVC_ASSEMBLY) #define SWAPSPEEDUP #endif @@ -794,6 +794,7 @@ static void setconvert (void) picasso_convert = v; host_mode = DirectDraw_GetSurfacePixelFormat (NULL); write_log ("RTG conversion: Depth=%d HostRGBF=%d P96RGBF=%d Mode=%d\n", d, host_mode, picasso96_state.RGBFormat, v); + full_refresh = 1; } /* Clear our screen, since we've got a new Picasso screen-mode, and refresh with the proper contents @@ -828,8 +829,7 @@ void picasso_refresh (void) } /* HACK until ntsc timing is fixed.. */ } //end for higher P96 mousedraw rate - have_done_picasso = 1; - palette_changed = 1; + full_refresh = 1; setconvert (); /* Make sure that the first time we show a Picasso video mode, we don't blit any crap. @@ -2254,7 +2254,7 @@ static uae_u32 REGPARAM2 picasso_SetColorArray (TrapContext *ctx) uaecptr boardinfo = m68k_areg (regs, 0); uaecptr clut = boardinfo + PSSO_BoardInfo_CLUT; if (updateclut (clut, start, count)) - palette_changed = 1; + full_refresh = 1; P96TRACE(("SetColorArray(%d,%d)\n", start, count)); return 1; } @@ -2417,7 +2417,7 @@ static uae_u32 REGPARAM2 picasso_SetPanning (TrapContext *ctx) picasso96_state.BytesPerRow = picasso96_state.VirtualWidth * picasso96_state.BytesPerPixel; picasso_SetPanningInit(); - palette_changed = 1; + full_refresh = 1; set_panning_called = 1; P96TRACE(("SetPanning(%d, %d, %d) Start 0x%x, BPR %d Bpp %d RGBF %d\n", Width, picasso96_state.XOffset, picasso96_state.YOffset, @@ -3290,14 +3290,13 @@ static uae_u32 REGPARAM2 picasso_BlitPlanar2Chunky (TrapContext *ctx) if (minterm != 0x0C) { write_log ("ERROR - BlitPlanar2Chunky() has minterm 0x%x, which I don't handle. Using fall-back routine.\n", minterm); - } else if(CopyRenderInfoStructureA2U (ri, &local_ri) && CopyBitMapStructureA2U (bm, &local_bm)) { + } else if (CopyRenderInfoStructureA2U (ri, &local_ri) && CopyBitMapStructureA2U (bm, &local_bm)) { P96TRACE(("BlitPlanar2Chunky(%d, %d, %d, %d, %d, %d) Minterm 0x%x, Mask 0x%x, Depth %d\n", srcx, srcy, dstx, dsty, width, height, minterm, mask, local_bm.Depth)); P96TRACE(("P2C - BitMap has %d BPR, %d rows\n", local_bm.BytesPerRow, local_bm.Rows)); PlanarToChunky (&local_ri, &local_bm, srcx, srcy, dstx, dsty, width, height, mask); result = 1; } - return result; } @@ -3431,12 +3430,10 @@ static uae_u32 REGPARAM2 picasso_BlitPlanar2Direct (TrapContext *ctx) if (NOBLITTER) return 0; if (minterm != 0x0C) { - write_log ("WARNING - BlitPlanar2Direct() has unhandled op-code 0x%x. Using fall-back routine.\n", - minterm); + write_log ("WARNING - BlitPlanar2Direct() has unhandled op-code 0x%x. Using fall-back routine.\n", minterm); + return 0; } - else if(CopyRenderInfoStructureA2U (ri, &local_ri) && - CopyBitMapStructureA2U (bm, &local_bm)) - { + if (CopyRenderInfoStructureA2U (ri, &local_ri) && CopyBitMapStructureA2U (bm, &local_bm)) { Mask = 0xFF; CopyColorIndexMappingA2U (cim, &local_cim, GetBytesPerPixel (local_ri.RGBFormat)); P96TRACE(("BlitPlanar2Direct(%d, %d, %d, %d, %d, %d) Minterm 0x%x, Mask 0x%x, Depth %d\n", @@ -3616,8 +3613,8 @@ static void flushpixels (void) if (!picasso_vidinfo.extra_mem || !gwwbuf || src_start >= src_end) return; - if (palette_changed) - palette_changed = -1; + if (full_refresh) + full_refresh = -1; for (;;) { int dofull; @@ -3627,15 +3624,15 @@ static void flushpixels (void) if (doskip () && p96skipmode == 1) break; - if (palette_changed < 0) { - palette_changed = 1; + if (full_refresh < 0) { + gwwcnt = (src_end - src_start) / gwwpagesize + 1; + full_refresh = 1; if (picasso_palette ()) { reloadcursor = 1; setspriteimage (cursorbi); } - gwwcnt = allocated_gfxmem / gwwpagesize; for (i = 0; i < gwwcnt; i++) - gwwbuf[i] = src + i * gwwpagesize; + gwwbuf[i] = src_start + i * gwwpagesize; } else { ULONG ps; gwwcnt = gwwbufsize; @@ -3723,7 +3720,7 @@ static void flushpixels (void) } else { mman_ResetWatch (src_start, src_end - src_start); } - palette_changed = 0; + full_refresh = 0; } if (maxy >= 0) { if (doskip () && p96skipmode == 4) { @@ -3813,8 +3810,7 @@ void InitPicasso96 (void) { int i; - have_done_picasso = 0; - palette_changed = 0; + full_refresh = 0; //fastscreen oldscr = 0; //fastscreen diff --git a/od-win32/resources/resource b/od-win32/resources/resource index da6adbee..a36fbbd4 100755 --- a/od-win32/resources/resource +++ b/od-win32/resources/resource @@ -926,6 +926,7 @@ #define IDC_HDF_RW 1778 #define IDC_HDFINFO 1779 #define IDC_DBG_AUTOSET 1780 +#define IDC_HF_SPARSE 1780 #define IDC_DBG_DASM2 1781 #define IDC_DBG_MEM2 1782 #define IDC_DBG_MEMINPUT2 1783 diff --git a/od-win32/resources/resource.h b/od-win32/resources/resource.h index da6adbee..a36fbbd4 100755 --- a/od-win32/resources/resource.h +++ b/od-win32/resources/resource.h @@ -926,6 +926,7 @@ #define IDC_HDF_RW 1778 #define IDC_HDFINFO 1779 #define IDC_DBG_AUTOSET 1780 +#define IDC_HF_SPARSE 1780 #define IDC_DBG_DASM2 1781 #define IDC_DBG_MEM2 1782 #define IDC_DBG_MEMINPUT2 1783 diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index 79af791b..4bf0fb51 100755 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -466,20 +466,20 @@ BEGIN RTEXT "Block size:",IDC_BLOCKSIZE_TEXT,197,113,35,10 EDITTEXT IDC_BLOCKSIZE,237,111,40,15,ES_NUMBER GROUPBOX "New hard disk image file",IDC_STATIC,10,156,280,62 - PUSHBUTTON "Create",IDC_HF_CREATE,60,171,80,14 - EDITTEXT IDC_HF_SIZE,156,171,61,15,ES_NUMBER + PUSHBUTTON "Create",IDC_HF_CREATE,23,171,80,14 + EDITTEXT IDC_HF_SIZE,119,171,61,15,ES_NUMBER PUSHBUTTON "OK",IDOK,102,226,50,14 PUSHBUTTON "Cancel",IDCANCEL,158,226,50,14 - EDITTEXT IDC_HF_DOSTYPE,156,194,61,15 - COMBOBOX IDC_HF_TYPE,60,195,80,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_HF_DOSTYPE,119,194,61,15 + COMBOBOX IDC_HF_TYPE,23,195,80,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_HDF_CONTROLLER,73,112,44,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP - RTEXT "DOS type",IDC_STATIC,224,196,32,10,SS_CENTERIMAGE - RTEXT "MB",IDC_STATIC,222,174,13,10,SS_CENTERIMAGE - RTEXT "Type:",IDC_STATIC,28,183,25,10,SS_CENTERIMAGE + RTEXT "DOS type",IDC_STATIC,187,196,32,10,SS_CENTERIMAGE + RTEXT "MB",IDC_STATIC,185,174,17,10,SS_CENTERIMAGE RTEXT "HD Controller:",IDC_STATIC,16,113,52,10,SS_CENTERIMAGE CONTROL "Bootable",IDC_HDF_AUTOBOOT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,136,74,53,10 CONTROL "Do not mount",IDC_HDF_DONOTMOUNT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,217,74,67,10 EDITTEXT IDC_HDFINFO,16,131,268,12,ES_CENTER | ES_READONLY + CONTROL "Sparse file",IDC_HF_SPARSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,220,174,62,10 END IDD_FILESYS DIALOGEX 15, 25, 299, 111 diff --git a/od-win32/rp.c b/od-win32/rp.c index 130760bd..4687ca4d 100755 --- a/od-win32/rp.c +++ b/od-win32/rp.c @@ -86,17 +86,6 @@ static const char *getmsg (int msg) case RPIPCGM_ACTIVATED: return "RPIPCGM_ACTIVATED"; case RPIPCGM_DEACTIVATED: return "RPIPCGM_DEACTIVATED"; case RPIPCGM_PARENT: return "RPIPCGM_PARENT"; -#if 0 - case RPIPCGM_ZORDER: return "RPIPCGM_ZORDER"; - case RPIPCGM_MINIMIZED: return "RPIPCGM_MINIMIZED"; - case RPIPCGM_RESTORED: return "RPIPCGM_RESTORED"; - case RPIPCGM_MOVED: return "RPIPCGM_MOVED"; - case RPIPCGM_DEVICEIMAGE: return "RPIPCGM_DEVICEIMAGE"; - case RPIPCGM_INPUTMODE: return "RPIPCGM_INPUTMODE"; - case RPIPCHM_MINIMIZE: return "RPIPCHM_MINIMIZE"; - case RPIPCHM_DEVICEIMAGE: return "RPIPCHM_DEVICEIMAGE"; - case RPIPCHM_INPUTMODE: return "RPIPCHM_INPUTMODE"; -#endif case RPIPCGM_SCREENMODE: return "RPIPCGM_SCREENMODE"; case RPIPCGM_POWERLED: return "RPIPCGM_POWERLED"; case RPIPCGM_DEVICES: return "RPIPCGM_DEVICES"; @@ -107,6 +96,7 @@ static const char *getmsg (int msg) case RPIPCGM_TURBO: return "RPIPCGM_TURBO"; case RPIPCGM_VOLUME: return "RPIPCGM_VOLUME"; case RPIPCGM_DEVICECONTENT: return "RPIPCGM_DEVICECONTENT"; + case RPIPCGM_DEVICESEEK: return "RPIPCGM_DEVICESEEK"; case RPIPCHM_CLOSE: return "RPIPCHM_CLOSE"; case RPIPCHM_SCREENMODE: return "RPIPCHM_SCREENMODE"; @@ -120,7 +110,6 @@ static const char *getmsg (int msg) case RPIPCHM_MOUSECAPTURE: return "RPIPCHM_MOUSECAPTURE"; case RPIPCHM_DEVICECONTENT: return "RPIPCHM_DEVICECONTENT"; case RPIPCHM_PING: return "RPIPCHM_PING"; - case RPIPCHM_SCREENCLIP: return "RPIPCHM_SCREENCLIP"; default: return "UNKNOWN"; } @@ -197,21 +186,63 @@ static int winok(void) return 1; } -static int get_x (void) +#define LORES_WIDTH 360 +#define LORES_HEIGHT 284 +static void get_screenmode (struct RPScreenMode *sm) { int res = currprefs.gfx_resolution; + int m = RP_SCREENMODE_1X; + int full = 0; if (WIN32GFX_IsPicassoScreen ()) { - return currprefs.gfx_pfullscreen ? RP_SCREENMODE_FULLSCREEN : RP_SCREENMODE_1X; + full = currprefs.gfx_pfullscreen; + sm->lClipTop = 0; + sm->lClipLeft = 0; + sm->lClipHeight = picasso96_state.Height; + sm->lClipWidth = picasso96_state.Width; } else { - if (currprefs.gfx_afullscreen) - return RP_SCREENMODE_FULLSCREEN; - if (res == 0) - return RP_SCREENMODE_1X; + full = currprefs.gfx_afullscreen; if (res == 1) - return RP_SCREENMODE_2X; - return RP_SCREENMODE_4X; + m = RP_SCREENMODE_2X; + if (res == 2) + m = RP_SCREENMODE_4X; + sm->lClipLeft = currprefs.gfx_xcenter_pos; + sm->lClipTop = currprefs.gfx_ycenter_pos; + sm->lClipWidth = LORES_WIDTH << currprefs.gfx_resolution; + sm->lClipHeight = LORES_HEIGHT << (currprefs.gfx_linedbl ? 1 : 0); + } + if (full) { + int d = (currprefs.gfx_display + 1) << 8; + m &= ~0x0000ff00; + m |= d; + } + sm->dwScreenMode = m; +} + +static void set_screenmode (struct RPScreenMode *sm) +{ + int res = RP_SCREENMODE_MODE (sm->dwScreenMode); + int fs = RP_SCREENMODE_DISPLAY (sm->dwScreenMode); + + minimized = 0; + if (fs) + changed_prefs.gfx_display = fs - 1; + if (WIN32GFX_IsPicassoScreen ()) { + changed_prefs.gfx_pfullscreen = fs; + } else { + changed_prefs.gfx_afullscreen = fs; + changed_prefs.gfx_resolution = res; + if (res == 0) + changed_prefs.gfx_linedbl = 0; + else + changed_prefs.gfx_linedbl = 1; + res = 1 << res; + changed_prefs.gfx_size_win.width = default_width * res; + changed_prefs.gfx_size_win.height = default_height * res; } + updatewinfsmode (&changed_prefs); + WIN32GFX_DisplayChangeRequested (); + hwndset = 0; } static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM lParam, @@ -261,23 +292,6 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM setmouseactive (0); } return TRUE; -#if 0 - case RPIPCHM_MINIMIZE: - minimized = 1; - if (ShowWindow (hAmigaWnd, SW_MINIMIZE)) - return TRUE; - break; - case RPIPCHM_DEVICEIMAGE: - { - RPDEVICEIMAGE *di = (RPDEVICEIMAGE*)pData; - if (di->btDeviceCategory == RP_DEVICE_FLOPPY) { - char *fn = ua (di->szImageFile); - disk_insert (di->btDeviceNumber, fn); - xfree (fn); - } - return TRUE; - } -#endif case RPIPCHM_DEVICECONTENT: { struct RPDeviceContent *dc = (struct RPDeviceContent*)pData; @@ -300,28 +314,8 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM } case RPIPCHM_SCREENMODE: { - int res = (BYTE)wParam; - minimized = 0; - if (WIN32GFX_IsPicassoScreen ()) { - changed_prefs.gfx_pfullscreen = res >= RP_SCREENMODE_FULLSCREEN ? 1 : 0; - } else { - changed_prefs.gfx_afullscreen = 0; - if (res >= RP_SCREENMODE_FULLSCREEN) { - res = 1; - changed_prefs.gfx_afullscreen = 1; - } - changed_prefs.gfx_resolution = res; - if (res == 0) - changed_prefs.gfx_linedbl = 0; - else - changed_prefs.gfx_linedbl = 1; - res = 1 << res; - changed_prefs.gfx_size_win.width = default_width * res; - changed_prefs.gfx_size_win.height = default_height * res; - } - updatewinfsmode (&changed_prefs); - WIN32GFX_DisplayChangeRequested (); - hwndset = 0; + struct RPScreenMode *sm = (struct RPScreenMode*)pData; + set_screenmode (sm); return (LRESULT)INVALID_HANDLE_VALUE; } case RPIPCHM_EVENT: @@ -352,30 +346,6 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM xfree (s); return ok ? TRUE : FALSE; } - case RPIPCHM_SCREENCLIP: - { - RPSCREENCLIP *sc = (RPSCREENCLIP*)pData; - - if (sc->lLeft < 0 || sc->lTop < 0) { - changed_prefs.gfx_xcenter_pos = -1; - changed_prefs.gfx_ycenter_pos = -1; - } else { - changed_prefs.gfx_xcenter_pos = sc->lLeft; - changed_prefs.gfx_ycenter_pos = sc->lTop; - } - if (sc->lWidth <= 0) { - changed_prefs.gfx_size_win.width = default_width; - } else { - changed_prefs.gfx_size_win.width = sc->lWidth << (RES_MAX - currprefs.gfx_resolution); - } - if (sc->lHeight <= 0) { - changed_prefs.gfx_size_win.height = default_height; - } else { - changed_prefs.gfx_size_win.height = sc->lHeight << (currprefs.gfx_linedbl ? 0 : 1); - } - fixup_prefs_dimensions (&changed_prefs); - } - return TRUE; } return FALSE; } @@ -439,39 +409,12 @@ static void sendfeatures (void) void rp_fixup_options (struct uae_prefs *p) { int i, v; - int res; - int p96; if (!initialized) return; write_log ("rp_fixup_options(rpescapekey=%d,rpescapeholdtime=%d,screenmode=%d,inputmode=%d)\n", rp_rpescapekey, rp_rpescapeholdtime, rp_screenmode, rp_inputmode); - p96 = WIN32GFX_IsPicassoScreen (); - res = 1 << currprefs.gfx_resolution; - default_width = currprefs.gfx_size_win.width / res; - default_height = currprefs.gfx_size_win.height / res; - - p->win32_borderless = -1; - p->gfx_afullscreen = p->gfx_pfullscreen = 0; - res = rp_screenmode; - if (res >= RP_SCREENMODE_FULLSCREEN) { - if (p96) - p->gfx_pfullscreen = 1; - else - p->gfx_afullscreen = 1; - res = 1; - } else { - int xres = 1 << res; - p->gfx_size_win.width = default_width * xres; - p->gfx_size_win.height = default_height * xres; - } - p->gfx_resolution = res; - if (res == 0) - p->gfx_linedbl = 0; - else - p->gfx_linedbl = 1; - sendfeatures (); /* floppy drives */ @@ -535,7 +478,7 @@ void rp_hd_change (int num, int removed) hd_mask &= ~(1 << num); else hd_mask |= 1 << num; - RPSendMessagex(RPIPCGM_DEVICES, RP_DEVICE_HD, hd_mask, NULL, 0, &guestinfo, NULL); + RPSendMessagex (RPIPCGM_DEVICES, RP_DEVICE_HD, hd_mask, NULL, 0, &guestinfo, NULL); } void rp_cd_change (int num, int removed) @@ -547,6 +490,13 @@ void rp_cd_change (int num, int removed) RPSendMessagex (RPIPCGM_DEVICES, RP_DEVICE_CD, cd_mask, NULL, 0, &guestinfo, NULL); } +void rp_floppy_track (int floppy, int track) +{ + if (!initialized) + return; + RPSendMessagex (RPIPCGM_DEVICESEEK, MAKEWORD (RP_DEVICE_FLOPPY, floppy), track, NULL, 0, &guestinfo, NULL); +} + void rp_update_leds (int led, int onoff) { if (!initialized) @@ -649,12 +599,21 @@ void rp_turbo (int active) void rp_set_hwnd (HWND hWnd) { - int rx; + struct RPScreenMode sm = { 0 }; + if (!initialized) return; - rx = get_x (); + get_screenmode (&sm); + sm.hGuestWindow = hWnd; hwndset = 1; - RPSendMessagex (RPIPCGM_SCREENMODE, rx, (LPARAM)hWnd, NULL, 0, &guestinfo, NULL); + RPSendMessagex (RPIPCGM_SCREENMODE, 0, 0, &sm, sizeof sm, &guestinfo, NULL); +} + +void rp_set_enabledisable (int enabled) +{ + if (!initialized) + return; + RPSendMessagex (enabled ? RPIPCGM_ENABLED : RPIPCGM_DISABLED, 0, 0, NULL, 0, &guestinfo, NULL); } void rp_rtg_switch (void) diff --git a/od-win32/rp.h b/od-win32/rp.h index 9f846c3e..056f780f 100755 --- a/od-win32/rp.h +++ b/od-win32/rp.h @@ -4,6 +4,7 @@ extern void rp_free (void); extern void rp_fixup_options (struct uae_prefs*); extern void rp_update_status (struct uae_prefs*); extern void rp_update_leds (int, int); +extern void rp_floppy_track (int floppy, int track); extern void rp_hd_activity (int, int); extern void rp_hd_change (int, int); extern void rp_cd_activity (int, int); @@ -13,6 +14,7 @@ extern void rp_mouse_capture (int); extern void rp_mouse_magic (int); extern void rp_turbo (int); extern void rp_set_hwnd (HWND); +extern void rp_set_enabledisable (int); extern int rp_checkesc (int, uae_u8*, int, int); extern int rp_isactive (void); extern void rp_vsync (void); diff --git a/od-win32/win32.c b/od-win32/win32.c index 64430b10..5dab085c 100755 --- a/od-win32/win32.c +++ b/od-win32/win32.c @@ -713,18 +713,19 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, mx -= mouseposx; my -= mouseposy; if (recapture && isfullscreen() <= 0) { - setmouseactive(1); - setamigamouse(mx, my); + setmouseactive (1); + setamigamouse (mx, my); return 0; } - if (dinput_winmouse () >= 0 && !focus) { + if (dinput_winmouse () >= 0) { if (dinput_winmousemode ()) { - /* absolete + mousehack */ + /* absolute + mousehack */ setmousestate (dinput_winmouse (), 0, mx, 1); setmousestate (dinput_winmouse (), 1, my, 1); return 0; } - return DefWindowProc (hWnd, message, wParam, lParam); + if (!focus) + return DefWindowProc (hWnd, message, wParam, lParam); } if (dinput_winmouse () >= 0) { if (dinput_winmousemode () == 0) { @@ -756,6 +757,10 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, WIN32GFX_WindowMove(); return FALSE; + case WM_ENABLE: + rp_set_enabledisable (wParam ? 1 : 0); + return FALSE; + #if 0 case WM_GETMINMAXINFO: { @@ -1052,6 +1057,7 @@ static LRESULT CALLBACK MainWindowProc (HWND hWnd, UINT message, WPARAM wParam, case WM_USER + 2: case WM_COMMAND: case WM_NOTIFY: + case WM_ENABLE: return AmigaWindowProc (hWnd, message, wParam, lParam); case WM_DISPLAYCHANGE: @@ -3057,6 +3063,7 @@ static void efix (DWORD *regp, void *p, void *ps, int *got) } } +extern void flush_log (void); LONG WINAPI WIN32_ExceptionFilter(struct _EXCEPTION_POINTERS *pExceptionPointers, DWORD ec) { static uae_u8 *prevpc; @@ -3135,9 +3142,10 @@ LONG WINAPI WIN32_ExceptionFilter(struct _EXCEPTION_POINTERS *pExceptionPointers exinfo.ClientPointers = 0; dump (GetCurrentProcess(), GetCurrentProcessId(), f, MiniDumpNormal, &exinfo, NULL, NULL); CloseHandle (f); + flush_log (); if (isfullscreen () <= 0) { sprintf (msg, "Crash detected. MiniDump saved as:\n%s\n", path2); - MessageBox( NULL, msg, "Crash", MB_OK | MB_ICONWARNING | MB_TASKMODAL | MB_SETFOREGROUND ); + MessageBox (NULL, msg, "Crash", MB_OK | MB_ICONWARNING | MB_TASKMODAL | MB_SETFOREGROUND ); } } } diff --git a/od-win32/win32.h b/od-win32/win32.h index 29fe4888..45466e42 100755 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -15,9 +15,9 @@ #define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100) #define GETBDD(x) ((x) % 100) -#define WINUAEBETA 11 +#define WINUAEBETA 12 #define WINUAEPUBLICBETA 1 -#define WINUAEDATE MAKEBD(2008, 3, 30) +#define WINUAEDATE MAKEBD(2008, 4, 5) #define WINUAEEXTRA "" #define WINUAEREV "" diff --git a/od-win32/win32gfx.c b/od-win32/win32gfx.c index d1a621ef..abb3221b 100755 --- a/od-win32/win32gfx.c +++ b/od-win32/win32gfx.c @@ -207,17 +207,12 @@ void centerdstrect (RECT *dr) void DX_Fill (int dstx, int dsty, int width, int height, uae_u32 color) { - int result = 0; RECT dstrect; - RECT srcrect; - - /* Set up our source rectangle. This NEVER needs to be adjusted for windowed display, since the - * source is ALWAYS in an offscreen buffer, or we're in full-screen mode. */ - SetRect (&srcrect, dstx, dsty, dstx + width, dsty + height); - - /* Set up our destination rectangle, and adjust for blit to windowed display (if necessary ) */ + if (width < 0) + width = currentmode->current_width; + if (height < 0) + height = currentmode->current_height; SetRect (&dstrect, dstx, dsty, dstx + width, dsty + height); - centerdstrect (&dstrect); DirectDraw_Fill (&dstrect, color); } @@ -1173,6 +1168,8 @@ void DX_Invalidate (int x, int y, int width, int height) if (y < 0 || height < 0) { y = 0; height = picasso_vidinfo.height; + } + if (x < 0 || width < 0) { x = 0; width = picasso_vidinfo.width; } diff --git a/od-win32/win32gui.c b/od-win32/win32gui.c index babd1eb2..a0c59700 100755 --- a/od-win32/win32gui.c +++ b/od-win32/win32gui.c @@ -1680,24 +1680,39 @@ static BOOL CreateHardFile (HWND hDlg, UINT hfsizem, char *dostype, char *newpat uae_u64 hfsize; uae_u32 dt; uae_u8 b; + int sparse; + sparse = 0; hfsize = (uae_u64)hfsizem * 1024 * 1024; + if (IsDlgButtonChecked (hDlg, IDC_HF_SPARSE) == BST_CHECKED) + sparse = -1; if (!DiskSelection (hDlg, IDC_PATH_NAME, 3, &workprefs, newpath)) return FALSE; GetDlgItemText (hDlg, IDC_PATH_NAME, init_path, MAX_DPATH); if (*init_path && hfsize) { SetCursor (LoadCursor(NULL, IDC_WAIT)); - if ((hf = CreateFile (init_path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL) ) != INVALID_HANDLE_VALUE) { + if ((hf = CreateFile (init_path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL) ) != INVALID_HANDLE_VALUE) { + DWORD mcl, fsf; + if (GetVolumeInformationByHandleW (hf, NULL, 0, NULL, &mcl, &fsf, NULL, 0)) { + if ((fsf & FILE_SUPPORTS_SPARSE_FILES) && sparse < 0) + sparse = 1; + } + if (sparse > 0) { + DWORD ret; + int ok = 0; + if (DeviceIoControl (hf, FSCTL_SET_SPARSE, NULL, 0, NULL, 0, &ret, NULL)) + result = 1; + } if (hfsize >= 0x80000000) { - highword = (DWORD)(hfsize >> 32); - ret = SetFilePointer (hf, (DWORD)hfsize, &highword, FILE_BEGIN); + highword = (DWORD)(hfsize >> 32); + ret = SetFilePointer (hf, (DWORD)hfsize, &highword, FILE_BEGIN); } else { - ret = SetFilePointer (hf, (DWORD)hfsize, NULL, FILE_BEGIN); + ret = SetFilePointer (hf, (DWORD)hfsize, NULL, FILE_BEGIN); } if (ret == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) - write_log ("SetFilePointer() failure for %s to posn %ud\n", init_path, hfsize); + write_log ("SetFilePointer() failure for %s to posn %ud\n", init_path, hfsize); else - result = SetEndOfFile (hf); + result = SetEndOfFile (hf); SetFilePointer (hf, 0, NULL, FILE_BEGIN); b = 0; WriteFile (hf, &b, 1, &written, NULL); @@ -5748,7 +5763,7 @@ static int trust_ids[] = { IDC_TRUST0, IDC_TRUST1, IDC_TRUST1, IDC_TRUST1 }; static void enable_for_cpudlg (HWND hDlg) { - BOOL enable = FALSE, enable2 = FALSE; + BOOL enable = FALSE; BOOL cpu_based_enable = FALSE; BOOL fpu; @@ -5777,17 +5792,16 @@ static void enable_for_cpudlg (HWND hDlg) #ifndef JIT enable = FALSE; #endif - enable2 = enable && workprefs.compforcesettings && candirect; - - ew (hDlg, IDC_TRUST0, enable2); - ew (hDlg, IDC_TRUST1, enable2); - ew (hDlg, IDC_HARDFLUSH, enable2); - ew (hDlg, IDC_CONSTJUMP, enable2); - ew (hDlg, IDC_JITFPU, enable2); - ew (hDlg, IDC_NOFLAGS, enable2); - ew (hDlg, IDC_CS_CACHE_TEXT, cpu_based_enable && workprefs.cachesize); - ew (hDlg, IDC_CACHE, cpu_based_enable && workprefs.cachesize); - ew (hDlg, IDC_CACHETEXT, cpu_based_enable && workprefs.cachesize); + + ew (hDlg, IDC_TRUST0, enable); + ew (hDlg, IDC_TRUST1, enable); + ew (hDlg, IDC_HARDFLUSH, enable); + ew (hDlg, IDC_CONSTJUMP, enable); + ew (hDlg, IDC_JITFPU, enable); + ew (hDlg, IDC_NOFLAGS, enable); + ew (hDlg, IDC_CS_CACHE_TEXT, enable); + ew (hDlg, IDC_CACHE, enable); + ew (hDlg, IDC_CACHETEXT, enable); ew (hDlg, IDC_FORCE, enable); ew (hDlg, IDC_JITENABLE, cpu_based_enable); ew (hDlg, IDC_COMPATIBLE, !workprefs.cpu_cycle_exact && !workprefs.cachesize); @@ -5861,25 +5875,25 @@ static void values_to_cpudlg (HWND hDlg) } #endif - if(!workprefs.compforcesettings) { + if (!workprefs.compforcesettings) { workprefs.comptrustbyte = 0; workprefs.comptrustword = 0; workprefs.comptrustlong = 0; workprefs.comptrustnaddr= 0; } - CheckRadioButton(hDlg, IDC_TRUST0, IDC_TRUST1, trust_ids[workprefs.comptrustbyte]); + CheckRadioButton (hDlg, IDC_TRUST0, IDC_TRUST1, trust_ids[workprefs.comptrustbyte]); - SendDlgItemMessage(hDlg, IDC_CACHE, TBM_SETPOS, TRUE, workprefs.cachesize / 1024); - sprintf(cache, "%d MB", workprefs.cachesize / 1024 ); - SetDlgItemText( hDlg, IDC_CACHETEXT, cache ); + SendDlgItemMessage (hDlg, IDC_CACHE, TBM_SETPOS, TRUE, workprefs.cachesize / 1024); + sprintf (cache, "%d MB", workprefs.cachesize / 1024 ); + SetDlgItemText (hDlg, IDC_CACHETEXT, cache); - CheckDlgButton(hDlg, IDC_FORCE, workprefs.compforcesettings); - CheckDlgButton(hDlg, IDC_NOFLAGS, workprefs.compnf); - CheckDlgButton(hDlg, IDC_JITFPU, workprefs.compfpu); - CheckDlgButton(hDlg, IDC_HARDFLUSH, workprefs.comp_hardflush); - CheckDlgButton(hDlg, IDC_CONSTJUMP, workprefs.comp_constjump); - CheckDlgButton(hDlg, IDC_JITENABLE, workprefs.cachesize > 0); + CheckDlgButton (hDlg, IDC_FORCE, workprefs.compforcesettings); + CheckDlgButton (hDlg, IDC_NOFLAGS, workprefs.compnf); + CheckDlgButton (hDlg, IDC_JITFPU, workprefs.compfpu); + CheckDlgButton (hDlg, IDC_HARDFLUSH, workprefs.comp_hardflush); + CheckDlgButton (hDlg, IDC_CONSTJUMP, workprefs.comp_constjump); + CheckDlgButton (hDlg, IDC_JITENABLE, workprefs.cachesize > 0); } static void values_from_cpudlg (HWND hDlg) @@ -5934,18 +5948,18 @@ static void values_from_cpudlg (HWND hDlg) workprefs.address_space_24 = 0; break; } - newtrust = (IsDlgButtonChecked(hDlg, IDC_TRUST0) ? 0 - : IsDlgButtonChecked(hDlg, IDC_TRUST1) ? 1 : 3); + newtrust = (IsDlgButtonChecked (hDlg, IDC_TRUST0) ? 0 + : IsDlgButtonChecked (hDlg, IDC_TRUST1) ? 1 : 3); workprefs.comptrustbyte = newtrust; workprefs.comptrustword = newtrust; workprefs.comptrustlong = newtrust; workprefs.comptrustnaddr= newtrust; - workprefs.compforcesettings = IsDlgButtonChecked(hDlg, IDC_FORCE); - workprefs.compnf = IsDlgButtonChecked(hDlg, IDC_NOFLAGS); - workprefs.compfpu = IsDlgButtonChecked(hDlg, IDC_JITFPU); - workprefs.comp_hardflush = IsDlgButtonChecked(hDlg, IDC_HARDFLUSH); - workprefs.comp_constjump = IsDlgButtonChecked(hDlg, IDC_CONSTJUMP); + workprefs.compforcesettings = IsDlgButtonChecked (hDlg, IDC_FORCE); + workprefs.compnf = IsDlgButtonChecked (hDlg, IDC_NOFLAGS); + workprefs.compfpu = IsDlgButtonChecked (hDlg, IDC_JITFPU); + workprefs.comp_hardflush = IsDlgButtonChecked (hDlg, IDC_HARDFLUSH); + workprefs.comp_constjump = IsDlgButtonChecked (hDlg, IDC_CONSTJUMP); #ifdef JIT oldcache = workprefs.cachesize; @@ -5973,18 +5987,18 @@ static void values_from_cpudlg (HWND hDlg) canbang = 0; #endif - workprefs.cpu_idle = SendMessage(GetDlgItem(hDlg, IDC_CPUIDLE), TBM_GETPOS, 0, 0); + workprefs.cpu_idle = SendMessage (GetDlgItem (hDlg, IDC_CPUIDLE), TBM_GETPOS, 0, 0); if (workprefs.cpu_idle > 0) workprefs.cpu_idle = (12 - workprefs.cpu_idle) * 15; if (workprefs.cachesize > 0) workprefs.cpu_compatible = 0; if (pages[KICKSTART_ID]) - SendMessage(pages[KICKSTART_ID], WM_USER, 0, 0 ); + SendMessage (pages[KICKSTART_ID], WM_USER, 0, 0); if (pages[DISPLAY_ID]) - SendMessage(pages[DISPLAY_ID], WM_USER, 0, 0 ); + SendMessage (pages[DISPLAY_ID], WM_USER, 0, 0); if (pages[MEMORY_ID]) - SendMessage(pages[MEMORY_ID], WM_USER, 0, 0 ); + SendMessage (pages[MEMORY_ID], WM_USER, 0, 0); } static INT_PTR CALLBACK CPUDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) @@ -6727,18 +6741,16 @@ static void updatehdfinfo (HWND hDlg, int force) if (force) { struct zfile *zf = zfile_fopen (current_hfdlg.filename, "rb"); if (zf) { + FILE *fp; memset (id, 0, sizeof (id)); zfile_fread (id, 1, sizeof (id), zf); zfile_fseek (zf, 0, SEEK_END); - bsize = zfile_ftell (zf); zfile_fclose (zf); - if (bsize == -1) { /* perhaps file is >=2G? */ - FILE *fp = fopen (current_hfdlg.filename, "rb"); - if (fp) { - _fseeki64 (fp, 0, SEEK_END); - bsize = _ftelli64 (fp); - fclose (fp); - } + fp = fopen (current_hfdlg.filename, "rb"); + if (fp) { + _fseeki64 (fp, 0, SEEK_END); + bsize = _ftelli64 (fp); + fclose (fp); } } } @@ -10945,8 +10957,9 @@ void check_prefs_changed_gui( void ) void gui_hd_led (int unitnum, int led) { static int resetcounter; - - int old = gui_data.hd; + int old; + + old = gui_data.hd; if (led == 0) { resetcounter--; if (resetcounter > 0) @@ -10964,8 +10977,9 @@ void gui_hd_led (int unitnum, int led) void gui_cd_led (int unitnum, int led) { static int resetcounter; - - int old = gui_data.cd; + int old; + + old = gui_data.cd; if (led == 0) { resetcounter--; if (resetcounter > 0) @@ -11003,6 +11017,8 @@ void gui_led (int led, int on) #endif #ifdef RETROPLATFORM rp_update_leds (led, on); + if (led >= 1 && led <= 4 && !gui_data.drive_disabled[led - 1]) + rp_floppy_track (led - 1, gui_data.drive_track[led - 1]); #endif if (!hStatusWnd) return; diff --git a/od-win32/winuae_msvc/winuae_msvc.vcproj b/od-win32/winuae_msvc/winuae_msvc.vcproj index a3d4c854..421bf5bf 100755 --- a/od-win32/winuae_msvc/winuae_msvc.vcproj +++ b/od-win32/winuae_msvc/winuae_msvc.vcproj @@ -2541,10 +2541,6 @@ RelativePath="..\hq4x32.obj" > - - diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index db554bd7..caa21f2e 100755 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,4 +1,18 @@ +Beta 12: + +- hardfile creation: sparse file option added (sparse file = non-written + parts of file do not take space on HD, NTFSv5+ required) +- IDE harddrive emulation LBA48 support implemented (>128G hardfiles) + NOTE! READ THIS: http://eab.abime.net/showthread.php?t=35801 +- memwatch breakpoints with value detection improved if size is word or + byte +- CD32 CD frame interrupt was not always cleared (Liberation CD32, perhaps + others, JIT still needs to be disabled) +- mousehack (tablet) mode fix, partially broken since 1.4.6 (not tested, + I need to borrow my brother's tablet first..) +- Picasso96 tweaks + Beta 11: - uaegfx.card is now WinUAE built-in, libs:picasso96/uaegfx.card is not diff --git a/od-win32/writelog.c b/od-win32/writelog.c index 660f7313..1dc9429f 100755 --- a/od-win32/writelog.c +++ b/od-win32/writelog.c @@ -258,7 +258,6 @@ void write_dlog (const char *format, ...) if (lfdetected && ts) fprintf(debugfile, ts); fprintf(debugfile, buffer); - //fflush(debugfile); } lfdetected = 0; if (strlen(buffer) > 0 && buffer[strlen(buffer) - 1] == '\n') @@ -303,8 +302,6 @@ void write_log (const char *format, ...) if (lfdetected && ts) fprintf(debugfile, ts); fprintf(debugfile, bufp); - if (!bootlogmode) - ;//fflush(debugfile); } lfdetected = 0; if (strlen(bufp) > 0 && bufp[strlen(bufp) - 1] == '\n') @@ -314,6 +311,12 @@ void write_log (const char *format, ...) xfree (bufp); } +void flush_log (void) +{ + if (debugfile) + fflush (debugfile); +} + void f_out (void *f, const char *format, ...) { int count; diff --git a/savestate.c b/savestate.c index 8146e4db..ad38484f 100755 --- a/savestate.c +++ b/savestate.c @@ -1149,7 +1149,7 @@ void savestate_init (void) frameextra = 0; if (currprefs.statecapture && currprefs.statecapturebuffersize && currprefs.statecapturerate) { replaybuffersize = currprefs.statecapturebuffersize; - replaybuffer = (uae_u8*)malloc (replaybuffersize); + replaybuffer = xmalloc (replaybuffersize); } } -- 2.47.3