From: Toni Wilen Date: Sun, 3 Feb 2013 13:50:51 +0000 (+0200) Subject: 2600b6 X-Git-Tag: 2600~15 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=8ef734f46eed9aece1bfa24f47ddd328f9c2e83d;p=francis%2Fwinuae.git 2600b6 --- diff --git a/a2091.cpp b/a2091.cpp index f63c2711..cfcda1b9 100644 --- a/a2091.cpp +++ b/a2091.cpp @@ -31,6 +31,7 @@ #include "autoconf.h" #include "cdtv.h" #include "savestate.h" +#include "threaddep/thread.h" #define ROM_VECTOR 0x2000 #define ROM_OFFSET 0x2000 @@ -185,19 +186,22 @@ static uae_u32 dmac_dawr; static uae_u32 dmac_acr; static uae_u32 dmac_wtc; static int dmac_dma; -static uae_u8 sasr, scmd, auxstatus; -static int wd_used; -static int wd_phase, wd_next_phase, wd_busy, wd_data_avail; -static bool wd_selected; -static int wd_dataoffset; -static uae_u8 wd_data[32]; +static volatile uae_u8 sasr, scmd, auxstatus; +static volatile int wd_used; +static volatile int wd_phase, wd_next_phase, wd_busy, wd_data_avail; +static volatile bool wd_selected; +static volatile int wd_dataoffset; +static volatile uae_u8 wd_data[32]; static int superdmac; #define WD_STATUS_QUEUE 2 -static int scsidelay_irq[WD_STATUS_QUEUE]; -static uae_u8 scsidelay_status[WD_STATUS_QUEUE]; -static int queue_index; +static volatile int scsidelay_irq[WD_STATUS_QUEUE]; +static volatile uae_u8 scsidelay_status[WD_STATUS_QUEUE]; +static volatile int queue_index; + +static smp_comm_pipe requests; +static volatile int scsi_thread_running; static int wd33c93_ver = 1; // A @@ -306,10 +310,13 @@ static void set_status (uae_u8 status, int delay) queue_index++; if (queue_index >= WD_STATUS_QUEUE) queue_index = 0; - scsidelay_irq[queue_index] = delay <= 2 ? 2 : delay; - if (scsidelay_irq[1] == scsidelay_irq[0]) - scsidelay_irq[1]++; scsidelay_status[queue_index] = status; + scsidelay_irq[queue_index] = delay == 0 ? 1 : (delay <= 2 ? 2 : delay); +} + +static void set_status (uae_u8 status) +{ + set_status (status, 0); } static uae_u32 gettc (void) @@ -398,7 +405,7 @@ static bool do_dma (void) break; } #if WD33C93_DEBUG > 0 - write_log (_T("%s DMA from WD, %d/%d %08X\n"), WD33C93, scsi->offset, scsi->data_len, odmac_acr); + write_log (_T("%s Done DMA from WD, %d/%d %08X\n"), WD33C93, scsi->offset, scsi->data_len, odmac_acr); #endif return true; } else if (scsi->direction > 0) { @@ -416,7 +423,7 @@ static bool do_dma (void) break; } #if WD33C93_DEBUG > 0 - write_log (_T("%s DMA to WD, %d/%d %08x\n"), WD33C93, scsi->offset, scsi->data_len, odmac_acr); + write_log (_T("%s Done DMA to WD, %d/%d %08x\n"), WD33C93, scsi->offset, scsi->data_len, odmac_acr); #endif return true; } @@ -539,6 +546,7 @@ static void wd_cmd_sel_xfer (bool atn) int i, tmp_tc; int delay = 0; + wd_data_avail = 0; tmp_tc = gettc (); scsi = scsis[wdregs[WD_DESTINATION_ID] & 7]; if (!scsi) { @@ -595,17 +603,23 @@ static void wd_cmd_sel_xfer (bool atn) } // target replied or start/continue data phase (if data available) - if (wdregs[WD_COMMAND_PHASE] == 0x44 || wdregs[WD_COMMAND_PHASE] == 0x45) { + if (wdregs[WD_COMMAND_PHASE] == 0x44) { + if (scsi->direction < 0) { + scsi_emulate_cmd (scsi); + } + scsi_start_transfer (scsi); + wdregs[WD_COMMAND_PHASE] = 0x45; + } + + if (wdregs[WD_COMMAND_PHASE] == 0x45) { settc (tmp_tc); wd_dataoffset = 0; setphase (0x45); - scsi_start_transfer (scsi); if (gettc () == 0) { if (scsi->direction != 0) { // TC = 0 but we may have data if (scsi->direction < 0) { - scsi_emulate_cmd (scsi); if (scsi->data_len == 0) { // no data, continue normally to status phase setphase (0x46); @@ -623,21 +637,37 @@ static void wd_cmd_sel_xfer (bool atn) } if (scsi->direction) { - scsi_start_transfer (scsi); if (canwddma ()) { - if (scsi->direction <= 0) { - scsi_emulate_cmd (scsi); + if (scsi->direction <= 0) { do_dma (); + if (scsi->offset < scsi->data_len) { + // buffer not completely retrieved? + wd_phase = CSR_UNEXP | PHS_DATA_IN; + set_status (wd_phase, 1); + return; + } + if (gettc () > 0) { + // requested more data than was available. + wd_phase = CSR_UNEXP | PHS_STATUS; + set_status (wd_phase, 1); + return; + } setphase (0x46); } else { if (do_dma ()) { setphase (0x46); + if (scsi->offset < scsi->data_len) { + // not enough data? + wd_phase = CSR_UNEXP | PHS_DATA_OUT; + set_status (wd_phase, 1); + return; + } + // got all data -> execute it scsi_emulate_cmd (scsi); } } } else { - if (scsi->direction < 0) - scsi_emulate_cmd (scsi); + // no dma = Service Request wd_phase = CSR_SRV_REQ; if (scsi->direction < 0) wd_phase |= PHS_DATA_IN; @@ -647,13 +677,12 @@ static void wd_cmd_sel_xfer (bool atn) return; } } else { + // TC > 0 but no data to transfer if (gettc ()) { wd_phase = CSR_UNEXP | PHS_STATUS; set_status (wd_phase, 1); return; } - - // there was nothing to transfer wdregs[WD_COMMAND_PHASE] = 0x46; } } @@ -757,6 +786,9 @@ static void wd_cmd_sel (bool atn) scsi = scsis[wdregs[WD_DESTINATION_ID] & 7]; if (!scsi) { +#if WD33C93_DEBUG > 0 + write_log (_T("%s no drive\n"), WD33C93); +#endif set_status (CSR_TIMEOUT, 1000); return; } @@ -765,11 +797,11 @@ static void wd_cmd_sel (bool atn) scsi->message[0] = 0x80; set_status (CSR_SELECT, 2); if (atn) { - set_status (CSR_SRV_REQ | PHS_MESS_OUT, 4); wdregs[WD_COMMAND_PHASE] = 0x10; + set_status (CSR_SRV_REQ | PHS_MESS_OUT, 4); } else { - set_status (CSR_SRV_REQ | PHS_COMMAND, 4); wdregs[WD_COMMAND_PHASE] = 0x10; // connected as an initiator + set_status (CSR_SRV_REQ | PHS_COMMAND, 4); } } @@ -836,6 +868,16 @@ static int writeonlyreg (int reg) return 0; } +static uae_u32 makecmd (struct scsi_data *s, int msg, uae_u8 cmd) +{ + uae_u32 v = 0; + if (s) + v |= s->id << 24; + v |= msg << 8; + v |= cmd; + return v; +} + static void writewdreg (int sasr, uae_u8 val) { switch (sasr) @@ -887,40 +929,15 @@ void wdscsi_put (uae_u8 d) wd_data_avail = 1; if (scsi_send_data (scsi, wdregs[sasr]) || gettc () == 0) { wd_data_avail = 0; - wd_do_transfer_out (); + write_comm_pipe_u32 (&requests, makecmd (scsi, 2, 0), 1); } } else if (sasr == WD_COMMAND) { wd_busy = true; - switch (d & 0x7f) - { - case WD_CMD_RESET: - wd_cmd_reset (true); - break; - case WD_CMD_ABORT: - wd_cmd_abort (); - break; - case WD_CMD_SEL: - wd_cmd_sel (false); - break; - case WD_CMD_SEL_ATN: - wd_cmd_sel (true); - break; - case WD_CMD_SEL_ATN_XFER: - wd_cmd_sel_xfer (true); - break; - case WD_CMD_SEL_XFER: - wd_cmd_sel_xfer (false); - break; - case WD_CMD_TRANS_INFO: - wd_cmd_trans_info (); - break; - default: - wd_busy = false; - write_log (_T("%s unimplemented/unknown command %02X\n"), WD33C93, d); - break; - } + write_comm_pipe_u32 (&requests, makecmd (scsi, 0, d), 1); + if (scsi && scsi->cd_emu_unit >= 0) + gui_flicker_led (LED_CD, scsi->id, 1); } - incsasr(1); + incsasr (1); } void wdscsi_sasr (uae_u8 b) @@ -957,7 +974,7 @@ uae_u8 wdscsi_get (void) wd_data_avail = 1; if (status || gettc () == 0) { wd_data_avail = 0; - wd_do_transfer_in (); + write_comm_pipe_u32 (&requests, makecmd (scsi, 1, 0), 1); } } else if (sasr == WD_SCSI_STATUS) { uae_int_requested &= ~2; @@ -1558,6 +1575,67 @@ static void ew (int addr, uae_u32 value) } } +static void *scsi_thread (void *null) +{ + for (;;) { + uae_u32 v = read_comm_pipe_u32_blocking (&requests); + if (scsi_thread_running == 0 || v == 0xfffffff) + break; + int cmd = v & 0x7f; + int msg = (v >> 8) & 0xff; + int unit = (v >> 24) & 0xff; + //write_log (_T("scsi_thread got msg=%d cmd=%d\n"), msg, cmd); + if (msg == 0) { + if (WD33C93_DEBUG > 0) + write_log (_T("%s command %02X\n"), WD33C93, cmd); + switch (cmd) + { + case WD_CMD_RESET: + wd_cmd_reset (true); + break; + case WD_CMD_ABORT: + wd_cmd_abort (); + break; + case WD_CMD_SEL: + wd_cmd_sel (false); + break; + case WD_CMD_SEL_ATN: + wd_cmd_sel (true); + break; + case WD_CMD_SEL_ATN_XFER: + wd_cmd_sel_xfer (true); + break; + case WD_CMD_SEL_XFER: + wd_cmd_sel_xfer (false); + break; + case WD_CMD_TRANS_INFO: + wd_cmd_trans_info (); + break; + default: + wd_busy = false; + write_log (_T("%s unimplemented/unknown command %02X\n"), WD33C93, cmd); + set_status (CSR_INVALID, 10); + break; + } + } else if (msg == 1) { + wd_do_transfer_in (); + } else if (msg == 2) { + wd_do_transfer_out (); + } + } + scsi_thread_running = -1; + return 0; +} + +static void init_scsi (void) +{ + if (!scsi_thread_running) { + scsi_thread_running = 1; + init_comm_pipe (&requests, 100, 1); + uae_start_thread (_T("scsi"), scsi_thread, 0, NULL); + } +} + static void freescsi (struct scsi_data *sd) { if (!sd) @@ -1647,6 +1725,7 @@ static void addnativescsi (void) int a3000_add_scsi_unit (int ch, struct uaedev_config_info *ci) { + init_scsi (); if (ci->cd_emu_unit >= 0) return add_scsi_cd (ch, ci->cd_emu_unit); else @@ -1662,10 +1741,18 @@ void a3000scsi_reset (void) void a3000scsi_free (void) { freenativescsi (); + if (scsi_thread_running > 0) { + scsi_thread_running = 0; + write_comm_pipe_u32 (&requests, 0xffffffff, 1); + while(scsi_thread_running == 0) + sleep_millis (10); + scsi_thread_running = 0; + } } int a2091_add_scsi_unit (int ch, struct uaedev_config_info *ci) { + init_scsi (); if (ci->cd_emu_unit >= 0) return add_scsi_cd (ch, ci->cd_emu_unit); else @@ -1697,6 +1784,7 @@ void a2091_init (void) struct romlist *rl; struct romdata *rd; + init_scsi (); configured = 0; memset (dmacmemory, 0xff, sizeof dmacmemory); ew (0x00, 0xc0 | 0x01 | 0x10); diff --git a/blkdev.cpp b/blkdev.cpp index 3b1490b9..a64b7d36 100644 --- a/blkdev.cpp +++ b/blkdev.cpp @@ -3,7 +3,7 @@ * * lowlevel cd device glue, scsi emulator * -* Copyright 2009-2010 Toni Wilen +* Copyright 2009-2013 Toni Wilen * */ @@ -19,6 +19,7 @@ #include "threaddep/thread.h" #include "execio.h" #include "zfile.h" +#include "scsi.h" #ifdef RETROPLATFORM #include "rp.h" #endif @@ -1154,6 +1155,7 @@ int scsi_cd_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len, int status = 0; struct device_info di; uae_u8 cmd = cmdbuf[0]; + int dlen = *data_len; *reply_len = *sense_len = 0; memset (r, 0, 256); @@ -1171,7 +1173,7 @@ int scsi_cd_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len, write_log (_T("SCSIEMU %d: %02X.%02X.%02X.%02X.%02X.%02X.%02X.%02X.%02X.%02X.%02X.%02X CMDLEN=%d DATA=%08X LEN=%d\n"), unitnum, cmdbuf[0], cmdbuf[1], cmdbuf[2], cmdbuf[3], cmdbuf[4], cmdbuf[5], cmdbuf[6], cmdbuf[7], cmdbuf[8], cmdbuf[9], cmdbuf[10], cmdbuf[11], - scsi_cmd_len, scsi_data, *data_len); + scsi_cmd_len, scsi_data, dlen); switch (cmdbuf[0]) { case 0x03: /* REQUEST SENSE */ @@ -1403,6 +1405,8 @@ int scsi_cd_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len, len = cmdbuf[4]; if (!len) len = 256; + if (len * di.bytespersector > SCSI_DATA_BUFFER_SIZE) + goto toolarge; scsi_len = (uae_u32)cmd_readx (unitnum, scsi_data, offset, len) * di.bytespersector;; } else { goto notdatatrack; @@ -1420,6 +1424,8 @@ int scsi_cd_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len, struct cd_toc *t = gettoc (&di.toc, offset); if ((t->control & 0x0c) == 0x04) { len = rl (cmdbuf + 7 - 2) & 0xffff; + if (len * di.bytespersector > SCSI_DATA_BUFFER_SIZE) + goto toolarge; scsi_len = cmd_readx (unitnum, scsi_data, offset, len) * di.bytespersector; } else { goto notdatatrack; @@ -1437,6 +1443,8 @@ int scsi_cd_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len, struct cd_toc *t = gettoc (&di.toc, offset); if ((t->control & 0x0c) == 0x04) { len = rl (cmdbuf + 6); + if (len * di.bytespersector > SCSI_DATA_BUFFER_SIZE) + goto toolarge; scsi_len = (uae_u32)cmd_readx (unitnum, scsi_data, offset, len) * di.bytespersector;; } else { goto notdatatrack; @@ -1804,8 +1812,16 @@ notdatatrack: s[12] = 0x64; /* ILLEGAL MODE FOR THIS TRACK */ ls = 0x12; break; +toolarge: + write_log (_T("CDEMU: too large scsi data tranfer %d > %d\n"), len, dlen); + status = 2; /* CHECK CONDITION */ + s[0] = 0x70; + s[2] = 2; /* NOT READY */ + s[12] = 0x11; /* UNRECOVERED READ ERROR */ + ls = 0x12; + break; - default: + default: err: write_log (_T("CDEMU: unsupported scsi command 0x%02X\n"), cmdbuf[0]); errreq: diff --git a/cfgfile.cpp b/cfgfile.cpp index b9437a63..4ad84cb0 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -906,8 +906,16 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_dwrite (f, _T("gfx_horizontal_tweak"), _T("%d"), p->gfx_extrawidth); #ifdef GFXFILTER - if (p->gfx_filtershader[0] && p->gfx_api) { - cfgfile_dwrite (f, _T("gfx_filter"), _T("D3D:%s"), p->gfx_filtershader); + for (int i = 0; i gfx_filtershader[i][0]) + cfgfile_write (f, _T("gfx_filter_pre"), _T("D3D:%s"), p->gfx_filtershader[i]); + } + for (int i = 0; i gfx_filtershader[i + MAX_FILTERSHADERS][0]) + cfgfile_write (f, _T("gfx_filter_post"), _T("D3D:%s"), p->gfx_filtershader[i + MAX_FILTERSHADERS]); + } + if (p->gfx_filtershader[0][0] && p->gfx_api) { + cfgfile_dwrite (f, _T("gfx_filter"), _T("D3D:%s"), p->gfx_filtershader[0]); } else if (p->gfx_filter > 0) { int i = 0; struct uae_filter *uf; @@ -1904,16 +1912,42 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) return 1; } + if (_tcscmp (option, _T("gfx_filter_pre")) == 0 || _tcscmp (option, _T("gfx_filter_post")) == 0) { + TCHAR *s = _tcschr (value, ':'); + if (s) { + *s++ = 0; + if (!_tcscmp (value, _T("D3D"))) { + p->gfx_api = 1; + if (_tcscmp (option, _T("gfx_filter_pre")) == 0) { + for (int i = 0; i < MAX_FILTERSHADERS; i++) { + if (p->gfx_filtershader[i][0] == 0) { + _tcscpy (p->gfx_filtershader[i], s); + break; + } + } + } else { + for (int i = 0; i < MAX_FILTERSHADERS; i++) { + if (p->gfx_filtershader[i + MAX_FILTERSHADERS][0] == 0) { + _tcscpy (p->gfx_filtershader[i + MAX_FILTERSHADERS], s); + break; + } + } + } + } + } + return 1; + } + if (_tcscmp (option, _T("gfx_filter")) == 0) { int i = 0; TCHAR *s = _tcschr (value, ':'); - p->gfx_filtershader[0] = 0; + p->gfx_filtershader[0][0] = 0; p->gfx_filter = 0; if (s) { *s++ = 0; if (!_tcscmp (value, _T("D3D"))) { p->gfx_api = 1; - _tcscpy (p->gfx_filtershader, s); + _tcscpy (p->gfx_filtershader[0], s); } } if (!_tcscmp (value, _T("direct3d"))) { @@ -2329,8 +2363,23 @@ struct uaedev_config_data *add_filesys_config (struct uae_prefs *p, int index, s if (ci->controller > HD_CONTROLLER_SCSI6 || ci->controller < HD_CONTROLLER_IDE0) return NULL; } - if (index < 0) { + if (ci->controller != HD_CONTROLLER_UAE) { + int ctrl = ci->controller; + for (;;) { + for (i = 0; i < p->mountitems; i++) { + if (p->mountconfig[i].ci.controller == ctrl) { + ctrl++; + if (ctrl == HD_CONTROLLER_IDE3 + 1 || ctrl == HD_CONTROLLER_SCSI6 + 1) + return 0; + } + } + if (i == p->mountitems) { + ci->controller = ctrl; + break; + } + } + } if (ci->type == UAEDEV_CD) { for (i = 0; i < p->mountitems; i++) { if (p->mountconfig[i].ci.type == UAEDEV_CD) @@ -4590,7 +4639,9 @@ void default_prefs (struct uae_prefs *p, int type) p->cs_resetwarning = 1; p->gfx_filter = 0; - p->gfx_filtershader[0] = 0; + for (int i = 0; i < 2 * MAX_FILTERSHADERS; i++) { + p->gfx_filtershader[i][0] = 0; + } p->gfx_filtermask[0] = 0; p->gfx_filter_horiz_zoom_mult = 1.0; p->gfx_filter_vert_zoom_mult = 1.0; diff --git a/cpummu.cpp b/cpummu.cpp index 6d0543d4..a0770cb1 100644 --- a/cpummu.cpp +++ b/cpummu.cpp @@ -300,7 +300,9 @@ static void mmu_bus_error(uaecptr addr, int fc, bool write, int size, bool rmw, ssw |= MMU_SSW_CM; regs.mmu_effective_addr = mmu040_movem_ea; mmu040_movem = 0; +#if MMUDEBUGMISC > 0 write_log (_T("040 MMU_SSW_CM EA=%08X\n"), mmu040_movem_ea); +#endif } if (locked_rmw_cycle) { ssw |= MMU_SSW_LK | MMU_SSW_RW; @@ -593,9 +595,6 @@ static void misalignednotfirst(uaecptr addr) static void misalignednotfirstcheck(uaecptr addr) { -#if MMUDEBUGMISC > 0 - write_log (_T("misalignednotfirstcheck %08x -> %08x %08X\n"), regs.mmu_fault_addr, addr, regs.instruction_pc); -#endif if (regs.mmu_fault_addr == addr) return; misalignednotfirst (addr); @@ -1131,7 +1130,9 @@ void m68k_do_rte_mmu040 (uaecptr a7) if (ssr & MMU_SSW_CM) { mmu040_movem = 1; mmu040_movem_ea = get_long_mmu040 (a7 + 8); +#if MMUDEBUGMISC > 0 write_log (_T("MMU restarted MOVEM EA=%08X\n"), mmu040_movem_ea); +#endif } } diff --git a/cpummu30.cpp b/cpummu30.cpp index 31a95590..e0c47b5b 100644 --- a/cpummu30.cpp +++ b/cpummu30.cpp @@ -1566,7 +1566,7 @@ static void mmu030_page_fault(uaecptr addr, bool read, int flags, uae_u32 fc) { regs.mmu_ssw |= fc; bBusErrorReadWrite = read; mm030_stageb_address = addr; -#if 1 +#if MMUDEBUG write_log(_T("MMU: page fault (logical addr=%08X SSW=%04x read=%d size=%d fc=%d pc=%08x ob=%08x ins=%04X)\n"), addr, regs.mmu_ssw, read, (flags & MMU030_SSW_SIZE_B) ? 1 : (flags & MMU030_SSW_SIZE_W) ? 2 : 4, fc, regs.instruction_pc, (mmu030_state[1] & MMU030_STATEFLAG1_MOVEM1) ? mmu030_data_buffer : mmu030_ad[mmu030_idx].val, mmu030_opcode & 0xffff); diff --git a/fpp.cpp b/fpp.cpp index c8c949ce..21787b38 100644 --- a/fpp.cpp +++ b/fpp.cpp @@ -1555,6 +1555,7 @@ static void fpuop_arithmetic2 (uae_u32 opcode, uae_u16 extra) case 0: case 2: /* Extremely common */ + regs.fpiar = pc; reg = (extra >> 7) & 7; if ((extra & 0xfc00) == 0x5c00) { if (fault_if_no_fpu (opcode, 0, pc)) diff --git a/gayle.cpp b/gayle.cpp index 6e6adcba..441a341c 100644 --- a/gayle.cpp +++ b/gayle.cpp @@ -3,7 +3,7 @@ * * Gayle (and motherboard resources) memory bank * -* (c) 2006 - 2011 Toni Wilen +* (c) 2006 - 2013 Toni Wilen */ #define GAYLE_LOG 0 @@ -167,8 +167,10 @@ read 1 byte to stop reset */ #define IDE_GAYLE 0 #define IDE_ADIDE 1 + +#define ATAPI_MAX_TRANSFER 32768 #define MAX_IDE_MULTIPLE_SECTORS 64 -#define SECBUF_SIZE (512 * (MAX_IDE_MULTIPLE_SECTORS * 2)) +#define SECBUF_SIZE (131072 * 2) struct ide_registers { @@ -189,6 +191,7 @@ struct ide_hdf int data_offset; int data_size; int data_multi; + int direction; // 0 = read, 1 = write int lba48; uae_u8 multiple_mode; int irq_delay; @@ -202,8 +205,10 @@ struct ide_hdf bool atapi; bool atapi_drdy; int cd_unit_num; - int packet_cnt; + int packet_state; int packet_data_size; + int packet_data_offset; + int packet_transfer_size; struct scsi_data scsi; }; @@ -433,6 +438,10 @@ static void ide_interrupt (void) { ide->irq_delay = 2; } +static void ide_fast_interrupt (void) +{ + ide->irq_delay = 1; +} static void ide_interrupt_do (struct ide_hdf *ide) { @@ -490,7 +499,7 @@ static void ide_identify_drive (void) if (IDE_LOG > 0) write_log (_T("IDE%d identify drive\n"), ide->num); ide_data_ready (); - ide->data_size *= -1; + ide->direction = 0; pw (0, atapi ? 0x85c0 : 1 << 6); pw (1, ide->hdhfd.cyls_def); pw (2, 0xc837); @@ -570,6 +579,7 @@ static void set_signature (struct ide_hdf *ide) ide->regs.ide_status = 0; } ide->regs.ide_error = 0x01; // device ok + ide->packet_state = 0; } static void reset_device (bool both) @@ -723,6 +733,177 @@ static void check_maxtransfer (int state) } } +static void process_rw_command (void) +{ + ide->regs.ide_status |= IDE_STATUS_BSY; + ide->regs.ide_status &= ~IDE_STATUS_DRQ; + write_comm_pipe_u32 (&requests, ide->num, 1); +} +static void process_packet_command (void) +{ + ide->regs.ide_status |= IDE_STATUS_BSY; + ide->regs.ide_status &= ~IDE_STATUS_DRQ; + write_comm_pipe_u32 (&requests, ide->num | 0x80, 1); +} + +static void atapi_data_done (void) +{ + ide->regs.ide_nsector = ATAPI_IO | ATAPI_CD; + ide->regs.ide_status = IDE_STATUS_DRDY; + ide->data_size = 0; + ide->packet_data_offset = 0; + ide->data_offset = 0; +} + +static bool atapi_set_size (struct ide_hdf *ide) +{ + int size; + size = ide->data_size; + ide->data_offset = 0; + if (!size) { + ide->packet_state = 0; + ide->packet_transfer_size = 0; + return true; + } + if (ide->packet_state == 2) { + if (size > ide->packet_data_size) + size = ide->packet_data_size; + if (size > ATAPI_MAX_TRANSFER) + size = ATAPI_MAX_TRANSFER; + ide->packet_transfer_size = size & ~1; + ide->regs.ide_lcyl = size & 0xff; + ide->regs.ide_hcyl = size >> 8; + } else { + ide->packet_transfer_size = 12; + } + ide->regs.ide_status = IDE_STATUS_DRQ; + write_log (_T("ATAPI data transfer %d/%d bytes\n"), ide->packet_transfer_size, ide->data_size); + return false; +} + +static void atapi_packet (void) +{ + ide->packet_data_offset = 0; + ide->packet_data_size = (ide->regs.ide_hcyl << 8) | ide->regs.ide_lcyl; + if (ide->packet_data_size == 65535) + ide->packet_data_size = 65534; + ide->data_size = 12; + if (IDE_LOG > 0) + write_log (_T("ATAPI packet command. Data size = %d\n"), ide->packet_data_size); + ide->packet_state = 1; + ide->data_multi = 1; + ide->data_offset = 0; + ide->regs.ide_nsector = ATAPI_CD; + ide->regs.ide_error = 0; + atapi_set_size (ide); +} + +static void do_packet_command (struct ide_hdf *ide) +{ + memcpy (ide->scsi.cmd, ide->secbuf, 12); + ide->scsi.cmd_len = 12; + if (IDE_LOG > 0) { + uae_u8 *c = ide->scsi.cmd; + write_log (_T("ATASCSI %02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x\n"), + c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], c[10], c[11], c[12]); + } + ide->direction = 0; + scsi_emulate_analyze (&ide->scsi); + if (ide->scsi.direction <= 0) { + // data in + ide->scsi.data_len = SECBUF_SIZE; + scsi_emulate_cmd (&ide->scsi); + ide->data_size = ide->scsi.data_len; + ide->regs.ide_status = 0; + if (ide->scsi.status) { + // error + ide->regs.ide_status = ATAPI_STATUS_CHK; + ide->regs.ide_error = ide->scsi.status << 4; + atapi_data_done (); + } else if (ide->scsi.data_len) { + // data in + memcpy (ide->secbuf, ide->scsi.buffer, ide->scsi.data_len); + ide->regs.ide_nsector = ATAPI_IO; + } else { + // no data + atapi_data_done (); + } + } else { + // data out + ide->direction = 1; + ide->regs.ide_nsector = 0; + ide->data_size = ide->scsi.data_len; + } + ide->packet_state = 2; // data phase + atapi_set_size (ide); +} + +static void do_process_packet_command (struct ide_hdf *ide) +{ + if (ide->packet_state == 1) { + do_packet_command (ide); + } else { + ide->packet_data_offset += ide->packet_transfer_size; + if (!ide->direction) { + // data still remaining, next transfer + atapi_set_size (ide); + } else { + if (atapi_set_size (ide)) { + memcpy (&ide->scsi.buffer, ide->secbuf, ide->data_size); + ide->scsi.data_len = ide->data_size; + scsi_emulate_cmd (&ide->scsi); + if (IDE_LOG > 1) + write_log (_T("IDE%d ATAPI write finished, %d bytes\n"), ide->num, ide->data_size); + } + } + } + ide->irq_delay = 1; +} + +static void do_process_rw_command (struct ide_hdf *ide) +{ + unsigned int cyl, head, sec, nsec; + uae_u64 lba; + bool last; + + ide->data_offset = 0; + get_lbachs (ide, &lba, &cyl, &head, &sec, ide->lba48); + nsec = get_nsec (ide->lba48); + if (nsec * ide->blocksize > ide->hdhfd.size - lba * ide->blocksize) + nsec = (ide->hdhfd.size - lba * ide->blocksize) / ide->blocksize; + if (nsec <= 0) { + ide_data_ready (); + ide_fail_err (IDE_ERR_IDNF); + return; + } + if (nsec > ide->data_multi) + nsec = ide->data_multi; + + if (ide->direction) { + hdf_write (&ide->hdhfd.hfd, ide->secbuf, lba * ide->blocksize, nsec * ide->blocksize); + if (IDE_LOG > 1) + write_log (_T("IDE%d write, %d bytes written\n"), ide->num, nsec * ide->blocksize); + } else { + hdf_read (&ide->hdhfd.hfd, ide->secbuf, lba * ide->blocksize, nsec * ide->blocksize); + if (IDE_LOG > 1) + write_log (_T("IDE%d read, read %d bytes\n"), ide->num, nsec * ide->blocksize); + } + ide->regs.ide_status |= IDE_STATUS_DRQ; + last = dec_nsec (ide->lba48, nsec) == 0; + put_lbachs (ide, lba, cyl, head, sec, last ? nsec - 1 : nsec, ide->lba48); + if (last) { + if (ide->direction) { + if (IDE_LOG > 1) + write_log (_T("IDE%d write finished\n"), ide->num); + ide->regs.ide_status &= ~IDE_STATUS_DRQ; + } else { + if (IDE_LOG > 1) + write_log (_T("IDE%d read finished\n"), ide->num); + } + } + ide->irq_delay = 1; +} + static void ide_read_sectors (int flags) { unsigned int cyl, head, sec, nsec; @@ -749,7 +930,9 @@ static void ide_read_sectors (int flags) ide->data_offset = 0; ide->regs.ide_status |= IDE_STATUS_DRQ; ide->data_size = nsec * ide->blocksize; - ide_interrupt (); + ide->direction = 0; + + process_rw_command (); } static void ide_write_sectors (int flags) @@ -785,24 +968,9 @@ static void ide_write_sectors (int flags) ide->data_offset = 0; ide->regs.ide_status |= IDE_STATUS_DRQ; ide->data_size = nsec * ide->blocksize; - ide_interrupt (); -} + ide->direction = 1; -static void atapi_packet (void) -{ - ide->data_size = (ide->regs.ide_hcyl << 8) | ide->regs.ide_lcyl; - if (ide->data_size == 65535) - ide->data_size = 65534; - ide->packet_data_size = (ide->data_size + 1) & ~1; - ide->data_size = 12; - if (IDE_LOG > 1) - write_log (_T("ATAPI packet command\n")); - ide->packet_cnt = 1; - ide->data_multi = 1; - ide->data_offset = 0; - ide->regs.ide_status = IDE_STATUS_DRQ; - ide->regs.ide_nsector = ATAPI_CD; - ide->regs.ide_error = 0; + ide_fast_interrupt (); } static void ide_do_command (uae_u8 cmd) @@ -816,8 +984,11 @@ static void ide_do_command (uae_u8 cmd) if (ide->atapi) { + gui_flicker_led (LED_CD, ide->num, 1); ide->atapi_drdy = true; - if (cmd == 0x08) { /* device reset */ + if (cmd == 0x00) { /* nop */ + ide_interrupt (); + } else if (cmd == 0x08) { /* device reset */ ide_execute_drive_diagnostics (true); } else if (cmd == 0xa1) { /* identify packet device */ ide_identify_drive (); @@ -878,63 +1049,8 @@ static void ide_do_command (uae_u8 cmd) } } -static void atapi_data_done (void) -{ - ide->regs.ide_nsector = ATAPI_IO | ATAPI_CD; - ide->regs.ide_status = IDE_STATUS_DRDY; -} - -static void do_packet_command (void) -{ - memcpy (ide->scsi.cmd, ide->secbuf, 12); - ide->scsi.cmd_len = 12; - if (IDE_LOG > 0) { - uae_u8 *c = ide->scsi.cmd; - write_log (_T("SCSI %02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x\n"), - c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], c[10], c[11], c[12]); - } - ide->packet_cnt = 0; - scsi_emulate_analyze (&ide->scsi); - if (ide->scsi.direction <= 0) { - // data in - scsi_emulate_cmd (&ide->scsi); - ide->data_size = ide->scsi.data_len; - if (ide->data_size > ide->packet_data_size) - ide->data_size = ide->packet_data_size; - ide->data_offset = 0; - ide->regs.ide_status = 0; - if (ide->scsi.status) { - // error - ide->regs.ide_status = ATAPI_STATUS_CHK; - ide->regs.ide_error = ide->scsi.status << 4; - atapi_data_done (); - } else if (ide->scsi.data_len) { - // data - ide->regs.ide_status = IDE_STATUS_DRQ; - memcpy (ide->secbuf, ide->scsi.buffer, ide->scsi.data_len); - ide->packet_cnt = -1; - ide->regs.ide_nsector = ATAPI_IO; - } else { - // no data - atapi_data_done (); - } - } else { - // data out - ide->regs.ide_status = IDE_STATUS_DRQ; - ide->packet_cnt = -1; - ide->regs.ide_nsector = 0; - ide->data_size = ide->scsi.data_len; - if (ide->data_size > ide->packet_data_size) - ide->data_size = ide->packet_data_size; - } - ide->regs.ide_lcyl = ide->data_size & 0xff; - ide->regs.ide_hcyl = ide->data_size >> 8; -} - static uae_u16 ide_get_data (void) { - unsigned int cyl, head, sec, nsec; - uae_u64 lba; bool irq = false; bool last = false; uae_u16 v; @@ -948,41 +1064,27 @@ static uae_u16 ide_get_data (void) return 0xffff; return 0; } - if (ide->packet_cnt) { - v = ide->secbuf[ide->data_offset + 1] | (ide->secbuf[ide->data_offset + 0] << 8); + if (ide->packet_state) { + v = ide->secbuf[ide->packet_data_offset + ide->data_offset + 1] | (ide->secbuf[ide->packet_data_offset + ide->data_offset + 0] << 8); ide->data_offset += 2; if (ide->data_size < 0) ide->data_size += 2; else ide->data_size -= 2; - if (ide->data_size == 0) { - ide->packet_cnt = 0; - atapi_data_done (); + if (ide->data_offset == ide->packet_transfer_size) { if (IDE_LOG > 1) - write_log (_T("IDE%d ATAPI read finished\n"), ide->num); - irq = true; - } - } else { - nsec = 0; - if (ide->data_offset == 0 && ide->data_size >= 0) { - get_lbachs (ide, &lba, &cyl, &head, &sec, ide->lba48); - nsec = get_nsec (ide->lba48); - if (nsec * ide->blocksize > ide->hdhfd.size - lba * ide->blocksize) - nsec = (ide->hdhfd.size - lba * ide->blocksize) / ide->blocksize; - if (nsec <= 0) { - ide_data_ready (); - ide_fail_err (IDE_ERR_IDNF); - return 0; + write_log (_T("IDE%d ATAPI partial read finished, %d bytes remaining\n"), ide->num, ide->data_size); + if (ide->data_size == 0) { + ide->packet_state = 0; + atapi_data_done (); + if (IDE_LOG > 1) + write_log (_T("IDE%d ATAPI read finished, %d bytes\n"), ide->num, ide->packet_data_offset + ide->data_offset); + irq = true; + } else { + process_packet_command (); } - if (nsec > ide->data_multi) - nsec = ide->data_multi; - hdf_read (&ide->hdhfd.hfd, ide->secbuf, lba * ide->blocksize, nsec * ide->blocksize); - if (!dec_nsec (ide->lba48, nsec)) - last = true; - if (IDE_LOG > 1) - write_log (_T("IDE%d read, read %d bytes to buffer\n"), ide->num, nsec * ide->blocksize); } - + } else { v = ide->secbuf[ide->data_offset + 1] | (ide->secbuf[ide->data_offset + 0] << 8); ide->data_offset += 2; if (ide->data_size < 0) { @@ -990,8 +1092,8 @@ static uae_u16 ide_get_data (void) } else { ide->data_size -= 2; if (((ide->data_offset % ide->blocksize) == 0) && ((ide->data_offset / ide->blocksize) % ide->data_multi) == 0) { - irq = true; - ide->data_offset = 0; + if (ide->data_size) + process_rw_command (); } } if (ide->data_size == 0) { @@ -999,37 +1101,14 @@ static uae_u16 ide_get_data (void) if (IDE_LOG > 1) write_log (_T("IDE%d read finished\n"), ide->num); } - if (nsec) { - put_lbachs (ide, lba, cyl, head, sec, last ? nsec - 1 : nsec, ide->lba48); - } - } - if (irq) { - ide_interrupt (); } + if (irq) + ide_fast_interrupt (); return v; } -static void ide_write_drive (bool last) -{ - unsigned int cyl, head, sec, nsec; - uae_u64 lba; - - nsec = ide->data_offset / ide->blocksize; - if (!nsec) - return; - get_lbachs (ide, &lba, &cyl, &head, &sec, ide->lba48); - hdf_write (&ide->hdhfd.hfd, ide->secbuf, lba * ide->blocksize, ide->data_offset); - put_lbachs (ide, lba, cyl, head, sec, last ? nsec - 1 : nsec, ide->lba48); - dec_nsec (ide->lba48, nsec); - if (IDE_LOG > 1) - write_log (_T("IDE%d write interrupt, %d bytes written\n"), ide->num, ide->data_offset); - ide->data_offset = 0; -} - static void ide_put_data (uae_u16 v) { - bool irq = false; - if (IDE_LOG > 4) write_log (_T("IDE%d DATA write %04x %d/%d\n"), ide->num, v, ide->data_offset, ide->data_size); if (ide->data_size == 0) { @@ -1037,38 +1116,25 @@ static void ide_put_data (uae_u16 v) write_log (_T("IDE%d DATA write without DRQ!? PC=%08X\n"), ide->num, m68k_getpc ()); return; } - ide->secbuf[ide->data_offset + 1] = v & 0xff; - ide->secbuf[ide->data_offset + 0] = v >> 8; + ide->secbuf[ide->packet_data_offset + ide->data_offset + 1] = v & 0xff; + ide->secbuf[ide->packet_data_offset + ide->data_offset + 0] = v >> 8; ide->data_offset += 2; ide->data_size -= 2; - if (ide->packet_cnt) { - if (ide->data_size == 0) { - if (ide->packet_cnt > 0) { - do_packet_command (); - } else if (ide->packet_cnt < 0) { - ide->packet_cnt = 0; - memcpy (&ide->scsi.buffer, ide->secbuf, ide->data_size); - ide->scsi.data_len = ide->data_size; - scsi_emulate_cmd (&ide->scsi); - if (IDE_LOG > 1) - write_log (_T("IDE%d ATAPI write finished\n"), ide->num); + if (ide->packet_state) { + if (ide->data_offset == ide->packet_transfer_size) { + if (IDE_LOG > 0) { + uae_u16 v = (ide->regs.ide_hcyl << 8) | ide->regs.ide_lcyl; + write_log (_T("Data size after command received = %d (%d)\n"), v, ide->packet_data_size); } - irq = true; + process_packet_command (); } } else { if (ide->data_size == 0) { - irq = true; - ide_write_drive (true); - ide->regs.ide_status &= ~IDE_STATUS_DRQ; - if (IDE_LOG > 1) - write_log (_T("IDE%d write finished\n"), ide->num); + process_rw_command (); } else if (((ide->data_offset % ide->blocksize) == 0) && ((ide->data_offset / ide->blocksize) % ide->data_multi) == 0) { - irq = 1; - ide_write_drive (false); + process_rw_command (); } } - if (irq) - ide_interrupt (); } static int get_gayle_ide_reg (uaecptr addr) @@ -1241,9 +1307,6 @@ static void ide_write_reg (int ide_reg, uae_u32 val) ide->regs.ide_status |= IDE_STATUS_BSY; ide_do_command (val); } -#if 0 - write_comm_pipe_u32 (&requests, (ide->num << 8) | val, 1); -#endif break; } } @@ -2549,10 +2612,15 @@ int gayle_modify_pcmcia_ide_unit (const TCHAR *path, int readonly, int insert) static void *ide_thread (void *null) { for (;;) { - uae_u32 command = read_comm_pipe_u32_blocking (&requests); - if (gayle_thread_running == 0 || command == 0xfffffff) + uae_u32 unit = read_comm_pipe_u32_blocking (&requests); + struct ide_hdf *ide; + if (gayle_thread_running == 0 || unit == 0xfffffff) break; - ide_do_command ((uae_u8)command); + ide = idedrive[unit & 0x7f]; + if (unit & 0x80) + do_process_packet_command (ide); + else + do_process_rw_command (ide); } gayle_thread_running = -1; return 0; diff --git a/include/mmu_common.h b/include/mmu_common.h index db1a7873..af7cbce2 100644 --- a/include/mmu_common.h +++ b/include/mmu_common.h @@ -2,7 +2,7 @@ #ifndef MMU_COMMON_H #define MMU_COMMON_H -#define MMUDEBUG 1 +#define MMUDEBUG 0 #define MMUINSDEBUG 0 #define MMUDEBUGMISC 0 diff --git a/include/options.h b/include/options.h index 0680b784..95963404 100644 --- a/include/options.h +++ b/include/options.h @@ -179,6 +179,8 @@ enum { CP_GENERIC = 1, CP_CDTV, CP_CD32, CP_A500, CP_A500P, CP_A600, CP_A1000, #define MONITOREMU_A2024 2 #define MONITOREMU_GRAFFITI 3 +#define MAX_FILTERSHADERS 4 + #define MAX_CHIPSET_REFRESH 10 #define MAX_CHIPSET_REFRESH_TOTAL (MAX_CHIPSET_REFRESH + 2) #define CHIPSET_REFRESH_PAL (MAX_CHIPSET_REFRESH + 0) @@ -311,7 +313,7 @@ struct uae_prefs { int gfx_extrawidth; int gfx_filter; - TCHAR gfx_filtershader[MAX_DPATH]; + TCHAR gfx_filtershader[2 * MAX_FILTERSHADERS][MAX_DPATH]; TCHAR gfx_filtermask[MAX_DPATH]; TCHAR gfx_filteroverlay[MAX_DPATH]; struct wh gfx_filteroverlay_pos; diff --git a/od-win32/build68k_msvc/build68k_msvc.vcxproj b/od-win32/build68k_msvc/build68k_msvc.vcxproj index b90f95b1..efb96115 100644 --- a/od-win32/build68k_msvc/build68k_msvc.vcxproj +++ b/od-win32/build68k_msvc/build68k_msvc.vcxproj @@ -17,6 +17,10 @@ TestRelease Win32 + + Test + Win32 + build68k @@ -47,6 +51,12 @@ Unicode v110 + + Application + false + Unicode + v110 + @@ -62,12 +72,18 @@ + + + <_ProjectFileVersion>10.0.30128.1 .\Release\ + .\Release\ .\Release\ + .\Release\ false + false .\Debug\ .\Debug\ true @@ -120,6 +136,51 @@ creating cpudefs.cpp build68k.exe >..\..\cpudefs.cpp <..\..\table68k del build68k.exe + + + + + + .\Release/build68k_msvc.tlb + + + %(AdditionalOptions) + OnlyExplicitInline + ..\..\include;..\..;..\;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + MultiThreaded + true + .\Release/build68k_msvc.pch + .\Release/ + .\Release/ + .\Release/ + Level3 + true + Default + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + deleting cpudefs.cpp + del ..\..\cpudefs.cpp + + + /MACHINE:I386 %(AdditionalOptions) + build68k.exe + true + .\Release/build68k.pdb + Console + false + + + + + creating cpudefs.cpp + build68k.exe >..\..\cpudefs.cpp <..\..\table68k +del build68k.exe diff --git a/od-win32/direct3d.cpp b/od-win32/direct3d.cpp index d3d2480b..8e8950ed 100644 --- a/od-win32/direct3d.cpp +++ b/od-win32/direct3d.cpp @@ -41,12 +41,50 @@ int forcedframelatency = -1; #include "direct3d.h" static TCHAR *D3DHEAD = _T("-"); -static int psEnabled, psActive, psPreProcess, shaderon; +static int psEnabled, psActive, shaderon; static bool showoverlay = true; #define MAX_PASSES 2 +#define SHADERTYPE_BEFORE 1 +#define SHADERTYPE_AFTER 2 +#define SHADERTYPE_POST 3 + +struct shaderdata +{ + int type; // 0 = before , 1 = after, 2 = post + int psPreProcess; + LPDIRECT3DTEXTURE9 lpWorkTexture1; + LPDIRECT3DTEXTURE9 lpWorkTexture2; + LPDIRECT3DTEXTURE9 lpTempTexture; + LPD3DXEFFECT pEffect; + D3DXEFFECT_DESC EffectDesc; + // Technique stuff + D3DXHANDLE m_PreprocessTechnique1EffectHandle; + D3DXHANDLE m_PreprocessTechnique2EffectHandle; + D3DXHANDLE m_CombineTechniqueEffectHandle; + // Matrix Handles + D3DXHANDLE m_MatWorldEffectHandle; + D3DXHANDLE m_MatViewEffectHandle; + D3DXHANDLE m_MatProjEffectHandle; + D3DXHANDLE m_MatWorldViewEffectHandle; + D3DXHANDLE m_MatViewProjEffectHandle; + D3DXHANDLE m_MatWorldViewProjEffectHandle; + // Texture Handles + D3DXHANDLE m_SourceDimsEffectHandle; + D3DXHANDLE m_TexelSizeEffectHandle; + D3DXHANDLE m_SourceTextureEffectHandle; + D3DXHANDLE m_WorkingTexture1EffectHandle; + D3DXHANDLE m_WorkingTexture2EffectHandle; +}; +static LPDIRECT3DVOLUMETEXTURE9 lpHq2xLookupTexture; +static LPDIRECT3DTEXTURE9 lpPostTempTexture; + +#define MAX_SHADERS 10 +#define SHADER_POST 0 +static struct shaderdata shaders[MAX_SHADERS]; + static D3DFORMAT tformat; static int d3d_enabled, d3d_ex; static IDirect3D9 *d3d; @@ -63,9 +101,7 @@ static int masktexture_w, masktexture_h; static float mask2texture_w, mask2texture_h, mask2texture_ww, mask2texture_wh; static float mask2texture_wwx, mask2texture_hhx, mask2texture_minusx, mask2texture_minusy; static float mask2texture_multx, mask2texture_multy, mask2texture_offsetw; -static LPDIRECT3DTEXTURE9 lpWorkTexture1[2], lpWorkTexture2[2], lpTempTexture; LPDIRECT3DTEXTURE9 cursorsurfaced3d; -static LPDIRECT3DVOLUMETEXTURE9 lpHq2xLookupTexture; static IDirect3DVertexBuffer9 *vertexBuffer; static ID3DXSprite *sprite; static HWND d3dhwnd; @@ -77,7 +113,6 @@ RECT mask2rect; static bool wasstilldrawing_broken; static bool renderdisabled; static HANDLE filenotificationhandle; -static int extrapasses; static bool fakemode; static uae_u8 *fakebitmap; @@ -217,12 +252,20 @@ static D3DXMATRIX* MatrixTranslation (D3DXMATRIXA16 *pOut, float tx, float ty, f static TCHAR *D3DX_ErrorString (HRESULT hr, LPD3DXBUFFER Errors) { - static TCHAR buffer[1000]; + static TCHAR *buffer; + static int buffersize; TCHAR *s = NULL; + int size = 0; - buffer[0] = 0; if (Errors) s = au ((char*)Errors->GetBufferPointer ()); + size = (s == NULL ? 0 : _tcslen (s)) + 1000; + if (size + 1000 > buffersize) { + xfree (buffer); + buffer = xmalloc (TCHAR, size); + buffersize = size; + } + buffer[0] = 0; if (hr != S_OK) _tcscpy (buffer, D3D_ErrorString (hr)); if (s) { @@ -241,7 +284,6 @@ static int isd3d (void) return 1; } -static LPD3DXEFFECT postEffect; static D3DXHANDLE postSourceTextureHandle; static D3DXHANDLE postMaskTextureHandle; static D3DXHANDLE postTechnique, postTechniquePlain, postTechniqueAlpha; @@ -250,31 +292,13 @@ static D3DXHANDLE postMaskMult, postMaskShift; static D3DXHANDLE postFilterMode; static D3DXHANDLE postTexelSize; -static LPD3DXEFFECT pEffect; -static D3DXEFFECT_DESC EffectDesc; static float m_scale; static LPCSTR m_strName; -// Matrix Handles -static D3DXHANDLE m_MatWorldEffectHandle; -static D3DXHANDLE m_MatViewEffectHandle; -static D3DXHANDLE m_MatProjEffectHandle; -static D3DXHANDLE m_MatWorldViewEffectHandle; -static D3DXHANDLE m_MatViewProjEffectHandle; -static D3DXHANDLE m_MatWorldViewProjEffectHandle; -// Texture Handles -static D3DXHANDLE m_SourceDimsEffectHandle; -static D3DXHANDLE m_TexelSizeEffectHandle; -static D3DXHANDLE m_SourceTextureEffectHandle; -static D3DXHANDLE m_WorkingTexture1EffectHandle; -static D3DXHANDLE m_WorkingTexture2EffectHandle; static D3DXHANDLE m_Hq2xLookupTextureHandle; -// Technique stuff -static D3DXHANDLE m_PreprocessTechnique1EffectHandle; -static D3DXHANDLE m_PreprocessTechnique2EffectHandle; -static D3DXHANDLE m_CombineTechniqueEffectHandle; + enum psEffect_Pass { psEffect_None, psEffect_PreProcess1, psEffect_PreProcess2, psEffect_Combine }; -static int postEffect_ParseParameters (LPD3DXEFFECTCOMPILER EffectCompiler, LPD3DXEFFECT effect) +static int postEffect_ParseParameters (LPD3DXEFFECTCOMPILER EffectCompiler, LPD3DXEFFECT effect, struct shaderdata *s) { postSourceTextureHandle = effect->GetParameterByName (NULL, "SourceTexture"); postMaskTextureHandle = effect->GetParameterByName (NULL, "OverlayTexture"); @@ -293,7 +317,7 @@ static int postEffect_ParseParameters (LPD3DXEFFECTCOMPILER EffectCompiler, LPD3 return true; } -static int psEffect_ParseParameters (LPD3DXEFFECTCOMPILER EffectCompiler, LPD3DXEFFECT effect) +static int psEffect_ParseParameters (LPD3DXEFFECTCOMPILER EffectCompiler, LPD3DXEFFECT effect, struct shaderdata *s) { HRESULT hr = S_OK; // Look at parameters for semantics and annotations that we know how to interpret @@ -307,7 +331,7 @@ static int psEffect_ParseParameters (LPD3DXEFFECTCOMPILER EffectCompiler, LPD3DX if(effect == NULL) return 0; - for(iParam = 0; iParam < EffectDesc.Parameters; iParam++) { + for(iParam = 0; iParam < s->EffectDesc.Parameters; iParam++) { LPCSTR pstrName = NULL; LPCSTR pstrFunction = NULL; D3DXHANDLE pstrFunctionHandle = NULL; @@ -327,45 +351,45 @@ static int psEffect_ParseParameters (LPD3DXEFFECTCOMPILER EffectCompiler, LPD3DX if(ParamDesc.Semantic != NULL) { if(ParamDesc.Class == D3DXPC_MATRIX_ROWS || ParamDesc.Class == D3DXPC_MATRIX_COLUMNS) { if(strcmpi(ParamDesc.Semantic, "world") == 0) - m_MatWorldEffectHandle = hParam; + s->m_MatWorldEffectHandle = hParam; else if(strcmpi(ParamDesc.Semantic, "view") == 0) - m_MatViewEffectHandle = hParam; + s->m_MatViewEffectHandle = hParam; else if(strcmpi(ParamDesc.Semantic, "projection") == 0) - m_MatProjEffectHandle = hParam; + s->m_MatProjEffectHandle = hParam; else if(strcmpi(ParamDesc.Semantic, "worldview") == 0) - m_MatWorldViewEffectHandle = hParam; + s->m_MatWorldViewEffectHandle = hParam; else if(strcmpi(ParamDesc.Semantic, "viewprojection") == 0) - m_MatViewProjEffectHandle = hParam; + s->m_MatViewProjEffectHandle = hParam; else if(strcmpi(ParamDesc.Semantic, "worldviewprojection") == 0) - m_MatWorldViewProjEffectHandle = hParam; + s->m_MatWorldViewProjEffectHandle = hParam; } else if(ParamDesc.Class == D3DXPC_VECTOR && ParamDesc.Type == D3DXPT_FLOAT) { if(strcmpi(ParamDesc.Semantic, "sourcedims") == 0) - m_SourceDimsEffectHandle = hParam; + s->m_SourceDimsEffectHandle = hParam; else if(strcmpi(ParamDesc.Semantic, "texelsize") == 0) - m_TexelSizeEffectHandle = hParam; + s->m_TexelSizeEffectHandle = hParam; } else if(ParamDesc.Class == D3DXPC_SCALAR && ParamDesc.Type == D3DXPT_FLOAT) { if(strcmpi(ParamDesc.Semantic, "SCALING") == 0) hr = effect->GetFloat(hParam, &m_scale); } else if(ParamDesc.Class == D3DXPC_OBJECT && ParamDesc.Type == D3DXPT_TEXTURE) { if(strcmpi(ParamDesc.Semantic, "SOURCETEXTURE") == 0) - m_SourceTextureEffectHandle = hParam; + s->m_SourceTextureEffectHandle = hParam; if(strcmpi(ParamDesc.Semantic, "WORKINGTEXTURE") == 0) - m_WorkingTexture1EffectHandle = hParam; + s->m_WorkingTexture1EffectHandle = hParam; if(strcmpi(ParamDesc.Semantic, "WORKINGTEXTURE1") == 0) - m_WorkingTexture2EffectHandle = hParam; + s->m_WorkingTexture2EffectHandle = hParam; if(strcmpi(ParamDesc.Semantic, "HQ2XLOOKUPTEXTURE") == 0) m_Hq2xLookupTextureHandle = hParam; } else if(ParamDesc.Class == D3DXPC_OBJECT && ParamDesc.Type == D3DXPT_STRING) { LPCSTR pstrTechnique = NULL; if(strcmpi(ParamDesc.Semantic, "COMBINETECHNIQUE") == 0) { hr = effect->GetString(hParam, &pstrTechnique); - m_CombineTechniqueEffectHandle = effect->GetTechniqueByName(pstrTechnique); + s->m_CombineTechniqueEffectHandle = effect->GetTechniqueByName(pstrTechnique); } else if(strcmpi(ParamDesc.Semantic, "PREPROCESSTECHNIQUE") == 0) { hr = effect->GetString(hParam, &pstrTechnique); - m_PreprocessTechnique1EffectHandle = effect->GetTechniqueByName(pstrTechnique); + s->m_PreprocessTechnique1EffectHandle = effect->GetTechniqueByName(pstrTechnique); } else if(strcmpi(ParamDesc.Semantic, "PREPROCESSTECHNIQUE1") == 0) { hr = effect->GetString(hParam, &pstrTechnique); - m_PreprocessTechnique2EffectHandle = effect->GetTechniqueByName(pstrTechnique); + s->m_PreprocessTechnique2EffectHandle = effect->GetTechniqueByName(pstrTechnique); } else if(strcmpi(ParamDesc.Semantic, "NAME") == 0) { hr = effect->GetString(hParam, &m_strName); } @@ -473,8 +497,8 @@ static int psEffect_ParseParameters (LPD3DXEFFECTCOMPILER EffectCompiler, LPD3DX return 1; } -static int psEffect_hasPreProcess (void) { return m_PreprocessTechnique1EffectHandle != 0; } -static int psEffect_hasPreProcess2 (void) { return m_PreprocessTechnique2EffectHandle != 0; } +static int psEffect_hasPreProcess (struct shaderdata *s) { return s->m_PreprocessTechnique1EffectHandle != 0; } +static int psEffect_hasPreProcess2 (struct shaderdata *s) { return s->m_PreprocessTechnique2EffectHandle != 0; } int D3D_goodenough (void) { @@ -749,7 +773,7 @@ static const char *fx20 = { "}\n" }; -static LPD3DXEFFECT psEffect_LoadEffect (const TCHAR *shaderfile, int full) +static bool psEffect_LoadEffect (const TCHAR *shaderfile, int full, struct shaderdata *s) { int ret = 0; LPD3DXEFFECTCOMPILER EffectCompiler = NULL; @@ -834,16 +858,16 @@ static LPD3DXEFFECT psEffect_LoadEffect (const TCHAR *shaderfile, int full) write_log (_T("%s: D3DXCreateEffect failed: %s\n"), D3DHEAD, D3DX_ErrorString (hr, Errors)); goto end; } - hr = effect->GetDesc (&EffectDesc); + hr = effect->GetDesc (&s->EffectDesc); if (FAILED (hr)) { write_log (_T("%s: effect->GetDesc() failed: %s\n"), D3DHEAD, D3DX_ErrorString (hr, Errors)); goto end; } if (full) { - if (!psEffect_ParseParameters (EffectCompiler, effect)) + if (!psEffect_ParseParameters (EffectCompiler, effect, s)) goto end; } else { - if (!postEffect_ParseParameters (EffectCompiler, effect)) + if (!postEffect_ParseParameters (EffectCompiler, effect, s)) goto end; } ret = 1; @@ -858,12 +882,11 @@ end: EffectCompiler->Release (); if (full) { - psActive = FALSE; - psPreProcess = FALSE; + s->psPreProcess = FALSE; if (ret) { psActive = TRUE; - if (psEffect_hasPreProcess ()) - psPreProcess = TRUE; + if (psEffect_hasPreProcess (s)) + s->psPreProcess = TRUE; } } @@ -871,57 +894,58 @@ end: write_log (_T("%s: pixelshader filter '%s' enabled\n"), D3DHEAD, tmp); else write_log (_T("%s: pixelshader filter '%s' failed to initialize\n"), D3DHEAD, tmp); - return effect; + s->pEffect = effect; + return effect != NULL; } -static int psEffect_SetMatrices (D3DXMATRIXA16 *matProj, D3DXMATRIXA16 *matView, D3DXMATRIXA16 *matWorld) +static int psEffect_SetMatrices (D3DXMATRIXA16 *matProj, D3DXMATRIXA16 *matView, D3DXMATRIXA16 *matWorld, struct shaderdata *s) { HRESULT hr; - if (m_MatWorldEffectHandle) { - hr = pEffect->SetMatrix (m_MatWorldEffectHandle, matWorld); + if (s->m_MatWorldEffectHandle) { + hr = s->pEffect->SetMatrix (s->m_MatWorldEffectHandle, matWorld); if (FAILED (hr)) { write_log (_T("%s: Create:SetMatrix:matWorld %s\n"), D3DHEAD, D3D_ErrorString (hr)); return 0; } } - if (m_MatViewEffectHandle) { - hr = pEffect->SetMatrix (m_MatViewEffectHandle, matView); + if (s->m_MatViewEffectHandle) { + hr = s->pEffect->SetMatrix (s->m_MatViewEffectHandle, matView); if (FAILED (hr)) { write_log (_T("%s: Create:SetMatrix:matView %s\n"), D3DHEAD, D3D_ErrorString (hr)); return 0; } } - if (m_MatProjEffectHandle) { - hr = pEffect->SetMatrix (m_MatProjEffectHandle, matProj); + if (s->m_MatProjEffectHandle) { + hr = s->pEffect->SetMatrix (s->m_MatProjEffectHandle, matProj); if (FAILED (hr)) { write_log (_T("%s: Create:SetMatrix:matProj %s\n"), D3DHEAD, D3D_ErrorString (hr)); return 0; } } - if (m_MatWorldViewEffectHandle) { + if (s->m_MatWorldViewEffectHandle) { D3DXMATRIXA16 matWorldView; D3DXMatrixMultiply (&matWorldView, matWorld, matView); - hr = pEffect->SetMatrix (m_MatWorldViewEffectHandle, &matWorldView); + hr = s->pEffect->SetMatrix (s->m_MatWorldViewEffectHandle, &matWorldView); if (FAILED (hr)) { write_log (_T("%s: Create:SetMatrix:matWorldView %s\n"), D3DHEAD, D3D_ErrorString (hr)); return 0; } } - if (m_MatViewProjEffectHandle) { + if (s->m_MatViewProjEffectHandle) { D3DXMATRIXA16 matViewProj; D3DXMatrixMultiply (&matViewProj, matView, matProj); - hr = pEffect->SetMatrix (m_MatViewProjEffectHandle, &matViewProj); + hr = s->pEffect->SetMatrix (s->m_MatViewProjEffectHandle, &matViewProj); if (FAILED (hr)) { write_log (_T("%s: Create:SetMatrix:matViewProj %s\n"), D3DHEAD, D3D_ErrorString (hr)); return 0; } } - if (m_MatWorldViewProjEffectHandle) { + if (s->m_MatWorldViewProjEffectHandle) { D3DXMATRIXA16 tmp, matWorldViewProj; D3DXMatrixMultiply (&tmp, matWorld, matView); D3DXMatrixMultiply (&matWorldViewProj, &tmp, matProj); - hr = pEffect->SetMatrix (m_MatWorldViewProjEffectHandle, &matWorldViewProj); + hr = s->pEffect->SetMatrix (s->m_MatWorldViewProjEffectHandle, &matWorldViewProj); if (FAILED (hr)) { write_log (_T("%s: Create:SetMatrix:matWorldViewProj %s\n"), D3DHEAD, D3D_ErrorString (hr)); return 0; @@ -930,37 +954,36 @@ static int psEffect_SetMatrices (D3DXMATRIXA16 *matProj, D3DXMATRIXA16 *matView, return 1; } -static int psEffect_SetTextures (LPDIRECT3DTEXTURE9 lpSource, LPDIRECT3DTEXTURE9 lpWorking1, - LPDIRECT3DTEXTURE9 lpWorking2, LPDIRECT3DVOLUMETEXTURE9 lpHq2xLookupTexture) +static int psEffect_SetTextures (LPDIRECT3DTEXTURE9 lpSource, LPDIRECT3DVOLUMETEXTURE9 lpHq2xLookupTexture, struct shaderdata *s) { HRESULT hr; D3DXVECTOR4 fDims, fTexelSize; - if (!m_SourceTextureEffectHandle) { + if (!s->m_SourceTextureEffectHandle) { write_log (_T("%s: Texture with SOURCETEXTURE semantic not found\n"), D3DHEAD); return 0; } - hr = pEffect->SetTexture (m_SourceTextureEffectHandle, lpSource); + hr = s->pEffect->SetTexture (s->m_SourceTextureEffectHandle, lpSource); if (FAILED (hr)) { write_log (_T("%s: SetTextures:lpSource %s\n"), D3DHEAD, D3D_ErrorString (hr)); return 0; } - if (m_WorkingTexture1EffectHandle) { - hr = pEffect->SetTexture (m_WorkingTexture1EffectHandle, lpWorking1); + if (s->m_WorkingTexture1EffectHandle) { + hr = s->pEffect->SetTexture (s->m_WorkingTexture1EffectHandle, s->lpWorkTexture1); if (FAILED (hr)) { write_log (_T("%s: SetTextures:lpWorking1 %s\n"), D3DHEAD, D3D_ErrorString (hr)); return 0; } } - if (m_WorkingTexture2EffectHandle) { - hr = pEffect->SetTexture (m_WorkingTexture2EffectHandle, lpWorking2); + if (s->m_WorkingTexture2EffectHandle) { + hr = s->pEffect->SetTexture (s->m_WorkingTexture2EffectHandle, s->lpWorkTexture2); if (FAILED (hr)) { write_log (_T("%s: SetTextures:lpWorking2 %s\n"), D3DHEAD, D3D_ErrorString (hr)); return 0; } } if (m_Hq2xLookupTextureHandle) { - hr = pEffect->SetTexture (m_Hq2xLookupTextureHandle, lpHq2xLookupTexture); + hr = s->pEffect->SetTexture (m_Hq2xLookupTextureHandle, lpHq2xLookupTexture); if (FAILED (hr)) { write_log (_T("%s: SetTextures:lpHq2xLookupTexture %s\n"), D3DHEAD, D3D_ErrorString (hr)); return 0; @@ -978,15 +1001,15 @@ static int psEffect_SetTextures (LPDIRECT3DTEXTURE9 lpSource, LPDIRECT3DTEXTURE9 fTexelSize.x = 1.0f / fDims.x; fTexelSize.y = 1.0f / fDims.y; - if (m_SourceDimsEffectHandle) { - hr = pEffect->SetVector (m_SourceDimsEffectHandle, &fDims); + if (s->m_SourceDimsEffectHandle) { + hr = s->pEffect->SetVector (s->m_SourceDimsEffectHandle, &fDims); if (FAILED (hr)) { write_log (_T("%s: SetTextures:SetVector:Source %s\n"), D3DHEAD, D3D_ErrorString (hr)); return 0; } } - if (m_TexelSizeEffectHandle) { - hr = pEffect->SetVector (m_TexelSizeEffectHandle, &fTexelSize); + if (s->m_TexelSizeEffectHandle) { + hr = s->pEffect->SetVector (s->m_TexelSizeEffectHandle, &fTexelSize); if (FAILED (hr)) { write_log (_T("%s: SetTextures:SetVector:Texel %s\n"), D3DHEAD, D3D_ErrorString (hr)); return 0; @@ -996,19 +1019,20 @@ static int psEffect_SetTextures (LPDIRECT3DTEXTURE9 lpSource, LPDIRECT3DTEXTURE9 return 1; } -static int psEffect_Begin (LPD3DXEFFECT effect, enum psEffect_Pass pass, UINT *pPasses) +static int psEffect_Begin (enum psEffect_Pass pass, UINT *pPasses, struct shaderdata *s) { HRESULT hr; + LPD3DXEFFECT effect = s->pEffect; switch (pass) { case psEffect_PreProcess1: - hr = effect->SetTechnique (m_PreprocessTechnique1EffectHandle); + hr = effect->SetTechnique (s->m_PreprocessTechnique1EffectHandle); break; case psEffect_PreProcess2: - hr = effect->SetTechnique (m_PreprocessTechnique2EffectHandle); + hr = effect->SetTechnique (s->m_PreprocessTechnique2EffectHandle); break; case psEffect_Combine: - hr = effect->SetTechnique (m_CombineTechniqueEffectHandle); + hr = effect->SetTechnique (s->m_CombineTechniqueEffectHandle); break; default: hr = S_OK; @@ -1096,14 +1120,14 @@ static LPDIRECT3DTEXTURE9 createtext (int w, int h, D3DFORMAT format) static int worktex_width, worktex_height; -static int allocextratextures (int index, int w, int h) +static int allocextratextures (struct shaderdata *s, int w, int h) { HRESULT hr; - if (FAILED (hr = d3ddev->CreateTexture (w, h, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpWorkTexture1[index], NULL))) { + if (FAILED (hr = d3ddev->CreateTexture (w, h, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &s->lpWorkTexture1, NULL))) { write_log (_T("%s: Failed to create temp texture: %s\n"), D3DHEAD, D3D_ErrorString (hr)); return 0; } - if (FAILED (hr = d3ddev->CreateTexture (w, h, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpWorkTexture2[index], NULL))) { + if (FAILED (hr = d3ddev->CreateTexture (w, h, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &s->lpWorkTexture2, NULL))) { write_log (_T("%s: Failed to create working texture2: %s\n"), D3DHEAD, D3D_ErrorString (hr)); return 0; } @@ -1120,8 +1144,12 @@ static int createamigatexture (int w, int h) write_log (_T("%s: %d*%d texture allocated, bits per pixel %d\n"), D3DHEAD, w, h, t_depth); if (psActive) { D3DLOCKED_BOX lockedBox; - if (!allocextratextures (0, w, h)) - return 0; + for (int i = 0; i < MAX_SHADERS; i++) { + if (shaders[i].type == SHADERTYPE_BEFORE) { + if (!allocextratextures (&shaders[i], w, h)) + return 0; + } + } if (FAILED (hr = lpHq2xLookupTexture->LockBox (0, &lockedBox, NULL, 0))) { write_log (_T("%s: Failed to lock box of volume texture: %s\n"), D3DHEAD, D3D_ErrorString (hr)); return 0; @@ -1137,6 +1165,7 @@ static int createtexture (int ow, int oh, int win_w, int win_h) HRESULT hr; int w, h; +#if 0 if (ow > win_w * multx && oh > win_h * multx) { w = ow; h = oh; @@ -1144,20 +1173,32 @@ static int createtexture (int ow, int oh, int win_w, int win_h) w = win_w * multx; h = win_h * multx; } +#else + w = ow; + h = oh; +#endif worktex_width = w; worktex_height = h; - if (FAILED (hr = d3ddev->CreateTexture (w, h, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpTempTexture, NULL))) { + for (int i = 0; i < MAX_SHADERS; i++) { + if (shaders[i].type == SHADERTYPE_BEFORE || shaders[i].type == SHADERTYPE_AFTER) { + if (FAILED (hr = d3ddev->CreateTexture (w, h, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &shaders[i].lpTempTexture, NULL))) { + write_log (_T("%s: Failed to create working texture1: %s\n"), D3DHEAD, D3D_ErrorString (hr)); + return 0; + } + if (shaders[i].type == SHADERTYPE_AFTER) { + if (!allocextratextures (&shaders[i], window_w, window_h)) + return 0; + } + } + } + if (FAILED (hr = d3ddev->CreateTexture (window_w, window_h, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpPostTempTexture, NULL))) { write_log (_T("%s: Failed to create working texture1: %s\n"), D3DHEAD, D3D_ErrorString (hr)); return 0; } - write_log (_T("%s: %d*%d working texture allocated, bits per pixel %d\n"), D3DHEAD, w, h, t_depth); + write_log (_T("%s: working texture allocated pre %d*%d, post %d*%d, bits per pixel %d\n"), D3DHEAD, w, h, window_w, window_h, t_depth); texelsize.x = 1.0f / w; texelsize.y = 1.0f / h; texelsize.z = 1; texelsize.w = 1; if (psActive) { - if (extrapasses) { - if (!allocextratextures (1, w, h)) - return 0; - } if (FAILED (hr = d3ddev->CreateVolumeTexture (256, 16, 256, 1, D3DUSAGE_DYNAMIC, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpHq2xLookupTexture, NULL))) { write_log (_T("%s: Failed to create volume texture: %s\n"), D3DHEAD, D3D_ErrorString (hr)); return 0; @@ -1792,7 +1833,7 @@ static void createvertex (void) write_log (_T("%s: Vertexbuffer unlock failed: %s\n"), D3DHEAD, D3D_ErrorString (hr)); } -static void settransform (void) +static void settransform (struct shaderdata *s) { // Projection is (0,0,0) -> (1,1,1) MatrixOrthoOffCenterLH (&m_matPreProj, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f); @@ -1800,7 +1841,6 @@ static void settransform (void) MatrixTranslation (&m_matPreView, -0.5f / tout_w, 0.5f / tout_h, 0.0f); // Identity for world D3DXMatrixIdentity (&m_matPreWorld); - psEffect_SetMatrices (&m_matProj, &m_matView, &m_matWorld); MatrixOrthoOffCenterLH (&m_matProj2, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f); @@ -1808,26 +1848,27 @@ static void settransform (void) D3DXMatrixIdentity (&m_matWorld2); } +static void settransform2 (struct shaderdata *s) +{ + // Projection is (0,0,0) -> (1,1,1) + MatrixOrthoOffCenterLH (&m_matPreProj, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f); + // Align texels with pixels + MatrixTranslation (&m_matPreView, -0.5f / window_w, 0.5f / window_h, 0.0f); + // Identity for world + D3DXMatrixIdentity (&m_matPreWorld); + + MatrixOrthoOffCenterLH (&m_matProj2, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f); + + MatrixTranslation (&m_matView2, 0.5f - 0.5f / window_w, 0.5f + 0.5f / window_h, 0.0f); + D3DXMatrixIdentity (&m_matWorld2); +} + static void freetextures (void) { if (texture) { texture->Release (); texture = NULL; } - if (lpTempTexture) { - lpTempTexture->Release (); - lpTempTexture = NULL; - } - for (int i = 0; i < MAX_PASSES; i++) { - if (lpWorkTexture1[i]) { - lpWorkTexture1[i]->Release (); - lpWorkTexture1[i] = NULL; - } - if (lpWorkTexture2[i]) { - lpWorkTexture2[i]->Release (); - lpWorkTexture2[i] = NULL; - } - } if (lpHq2xLookupTexture) { lpHq2xLookupTexture->Release (); lpHq2xLookupTexture = NULL; @@ -1882,13 +1923,28 @@ static void invalidatedeviceobjects (void) cursorsurfaced3d->Release (); cursorsurfaced3d = NULL; } - if (pEffect) { - pEffect->Release (); - pEffect = NULL; + for (int i = 0; i < MAX_SHADERS; i++) { + if (shaders[i].pEffect) { + shaders[i].pEffect->Release (); + shaders[i].pEffect = NULL; + } + if (shaders[i].lpTempTexture) { + shaders[i].lpTempTexture->Release (); + shaders[i].lpTempTexture = NULL; + } + if (shaders[i].lpWorkTexture1) { + shaders[i].lpWorkTexture1->Release (); + shaders[i].lpWorkTexture1 = NULL; + } + if (shaders[i].lpWorkTexture2) { + shaders[i].lpWorkTexture2->Release (); + shaders[i].lpWorkTexture2 = NULL; + } + memset (&shaders[i], 0, sizeof (struct shaderdata)); } - if (postEffect) { - postEffect->Release (); - postEffect = NULL; + if (lpPostTempTexture) { + lpPostTempTexture->Release(); + lpPostTempTexture = NULL; } if (d3ddev) d3ddev->SetStreamSource (0, NULL, 0, 0); @@ -1900,26 +1956,23 @@ static void invalidatedeviceobjects (void) d3dswapchain->Release (); d3dswapchain = NULL; } - m_MatWorldEffectHandle = NULL; - m_MatViewEffectHandle = NULL; - m_MatProjEffectHandle = NULL; - m_MatWorldViewEffectHandle = NULL; - m_MatViewProjEffectHandle = NULL; - m_MatWorldViewProjEffectHandle = NULL; - m_SourceDimsEffectHandle = NULL; - m_TexelSizeEffectHandle = NULL; - m_SourceTextureEffectHandle = NULL; - m_WorkingTexture1EffectHandle = NULL; - m_WorkingTexture2EffectHandle = NULL; m_Hq2xLookupTextureHandle = NULL; - m_PreprocessTechnique1EffectHandle = NULL; - m_PreprocessTechnique2EffectHandle = NULL; - m_CombineTechniqueEffectHandle = NULL; locked = 0; maskshift.x = maskshift.y = maskshift.z = maskshift.w = 0; maskmult.x = maskmult.y = maskmult.z = maskmult.w = 0; } +static struct shaderdata *allocshaderslot (int type) +{ + for (int i = 0; i < MAX_SHADERS; i++) { + if (shaders[i].type == 0) { + shaders[i].type = type; + return &shaders[i]; + } + } + return NULL; +} + static int restoredeviceobjects (void) { int vbsize; @@ -1930,15 +1983,27 @@ static int restoredeviceobjects (void) getswapchain (); while (shaderon > 0) { - postEffect = psEffect_LoadEffect (psEnabled ? _T("_winuae.fx") : _T("_winuae_old.fx"), false); - if (!postEffect) { + shaders[SHADER_POST].type = SHADERTYPE_POST; + if (!psEffect_LoadEffect (psEnabled ? _T("_winuae.fx") : _T("_winuae_old.fx"), false, &shaders[SHADER_POST])) { shaderon = 0; break; } - if (currprefs.gfx_filtershader[0]) { - if (!(pEffect = psEffect_LoadEffect (currprefs.gfx_filtershader, true))) { - currprefs.gfx_filtershader[0] = changed_prefs.gfx_filtershader[0] = 0; - break; + for (int i = 0; i < MAX_FILTERSHADERS; i++) { + if (currprefs.gfx_filtershader[i][0]) { + struct shaderdata *s = allocshaderslot (SHADERTYPE_BEFORE); + if (!psEffect_LoadEffect (currprefs.gfx_filtershader[i], true, s)) { + currprefs.gfx_filtershader[i][0] = changed_prefs.gfx_filtershader[i][0] = 0; + break; + } + } + } + for (int i = 0; i < MAX_FILTERSHADERS; i++) { + if (currprefs.gfx_filtershader[i + MAX_FILTERSHADERS][0]) { + struct shaderdata *s = allocshaderslot (SHADERTYPE_AFTER); + if (!psEffect_LoadEffect (currprefs.gfx_filtershader[i + MAX_FILTERSHADERS], true, s)) { + currprefs.gfx_filtershader[i + MAX_FILTERSHADERS][0] = changed_prefs.gfx_filtershader[i + MAX_FILTERSHADERS][0] = 0; + break; + } } } if (currprefs.gfx_filter_scanlines > 0) { @@ -1980,7 +2045,7 @@ static int restoredeviceobjects (void) hr = d3ddev->SetRenderState (D3DRS_CULLMODE, D3DCULL_NONE); hr = d3ddev->SetRenderState (D3DRS_LIGHTING, FALSE); - settransform (); + settransform (NULL); return 1; } @@ -1997,7 +2062,6 @@ static void D3D_free2 (void) d3d = NULL; } d3d_enabled = 0; - psPreProcess = 0; psActive = 0; resetcount = 0; devicelost = 0; @@ -2554,6 +2618,88 @@ void D3D_clear (void) } } +static LPDIRECT3DTEXTURE9 processshader(LPDIRECT3DTEXTURE9 srctex, struct shaderdata *s, bool rendertarget) +{ + HRESULT hr; + UINT uPasses, uPass; + LPDIRECT3DSURFACE9 lpRenderTarget; + LPDIRECT3DSURFACE9 lpNewRenderTarget; + LPDIRECT3DTEXTURE9 lpWorkTexture; + + if (!psEffect_SetTextures (srctex, lpHq2xLookupTexture, s)) + return NULL; + if (s->psPreProcess) { + if (!psEffect_SetMatrices (&m_matPreProj, &m_matPreView, &m_matPreWorld, s)) + return NULL; + + if (FAILED (hr = d3ddev->GetRenderTarget (0, &lpRenderTarget))) + write_log (_T("%s: GetRenderTarget: %s\n"), D3DHEAD, D3D_ErrorString (hr)); + lpWorkTexture = s->lpWorkTexture1; + lpNewRenderTarget = NULL; +pass2: + if (FAILED (hr = lpWorkTexture->GetSurfaceLevel (0, &lpNewRenderTarget))) + write_log (_T("%s: GetSurfaceLevel: %s\n"), D3DHEAD, D3D_ErrorString (hr)); + if (FAILED (hr = d3ddev->SetRenderTarget (0, lpNewRenderTarget))) + write_log (_T("%s: SetRenderTarget: %s\n"), D3DHEAD, D3D_ErrorString (hr)); + + uPasses = 0; + if (psEffect_Begin ((lpWorkTexture == s->lpWorkTexture1) ? psEffect_PreProcess1 : psEffect_PreProcess2, &uPasses, s)) { + for (uPass = 0; uPass < uPasses; uPass++) { + if (psEffect_BeginPass (s->pEffect, uPass)) { + if (FAILED (hr = d3ddev->DrawPrimitive (D3DPT_TRIANGLESTRIP, 4, 2))) { + write_log (_T("%s: Effect DrawPrimitive failed: %s\n"), D3DHEAD, D3D_ErrorString (hr)); + } + psEffect_EndPass (s->pEffect); + } + } + psEffect_End (s->pEffect); + } + if (FAILED (hr = d3ddev->SetRenderTarget (0, lpRenderTarget))) + write_log (_T("%s: Effect RenderTarget reset failed: %s\n"), D3DHEAD, D3D_ErrorString (hr)); + lpNewRenderTarget->Release (); + lpNewRenderTarget = NULL; + if (psEffect_hasPreProcess2 (s) && lpWorkTexture == s->lpWorkTexture1) { + lpWorkTexture = s->lpWorkTexture2; + goto pass2; + } + lpRenderTarget->Release (); + lpRenderTarget = NULL; + } + psEffect_SetMatrices (&m_matProj2, &m_matView2, &m_matWorld2, s); + + if (rendertarget) { +#if TWOPASS + if (FAILED (hr = d3ddev->GetRenderTarget (0, &lpRenderTarget))) + write_log (_T("%s: GetRenderTarget: %s\n"), D3DHEAD, D3D_ErrorString (hr)); + if (FAILED (hr = s->lpTempTexture->GetSurfaceLevel (0, &lpNewRenderTarget))) + write_log (_T("%s: GetSurfaceLevel: %s\n"), D3DHEAD, D3D_ErrorString (hr)); + if (FAILED (hr = d3ddev->SetRenderTarget (0, lpNewRenderTarget))) + write_log (_T("%s: SetRenderTarget: %s\n"), D3DHEAD, D3D_ErrorString (hr)); +#endif + } + + uPasses = 0; + if (psEffect_Begin (psEffect_Combine, &uPasses, s)) { + for (uPass = 0; uPass < uPasses; uPass++) { + if (!psEffect_BeginPass (s->pEffect, uPass)) + return NULL; + if (FAILED (hr = d3ddev->DrawPrimitive (D3DPT_TRIANGLESTRIP, 0, 2))) + write_log (_T("%s: Effect2 DrawPrimitive failed: %s\n"), D3DHEAD, D3D_ErrorString (hr)); + psEffect_EndPass (s->pEffect); + } + psEffect_End (s->pEffect); + } + if (rendertarget) { +#if TWOPASS + if (FAILED (hr = d3ddev->SetRenderTarget (0, lpRenderTarget))) + write_log (_T("%s: SetRenderTarget: %s\n"), D3DHEAD, D3D_ErrorString (hr)); + lpNewRenderTarget->Release (); + lpRenderTarget->Release (); +#endif + } + return s->lpTempTexture; +} + static void D3D_render2 (void) { HRESULT hr; @@ -2569,89 +2715,41 @@ static void D3D_render2 (void) write_log (_T("%s: BeginScene: %s\n"), D3DHEAD, D3D_ErrorString (hr)); return; } - if (shaderon > 0 && postEffect) { - if (psActive) { - LPDIRECT3DSURFACE9 lpRenderTarget; - LPDIRECT3DSURFACE9 lpNewRenderTarget; - LPDIRECT3DTEXTURE9 lpWorkTexture; - - settransform (); - if (!psEffect_SetTextures (texture, lpWorkTexture1[0], lpWorkTexture2[0], lpHq2xLookupTexture)) - return; - if (psPreProcess) { - if (!psEffect_SetMatrices (&m_matPreProj, &m_matPreView, &m_matPreWorld)) + if (shaderon > 0 && shaders[SHADER_POST].pEffect) { + for (int i = 0; i < MAX_SHADERS; i++) { + struct shaderdata *s = &shaders[i]; + if (s->type == SHADERTYPE_BEFORE) { + settransform (s); + srctex = processshader (srctex, s, true); + if (!srctex) return; - - if (FAILED (hr = d3ddev->GetRenderTarget (0, &lpRenderTarget))) - write_log (_T("%s: GetRenderTarget: %s\n"), D3DHEAD, D3D_ErrorString (hr)); - lpWorkTexture = lpWorkTexture1[0]; - lpNewRenderTarget = NULL; - pass2: - if (FAILED (hr = lpWorkTexture->GetSurfaceLevel (0, &lpNewRenderTarget))) - write_log (_T("%s: GetSurfaceLevel: %s\n"), D3DHEAD, D3D_ErrorString (hr)); - if (FAILED (hr = d3ddev->SetRenderTarget (0, lpNewRenderTarget))) - write_log (_T("%s: SetRenderTarget: %s\n"), D3DHEAD, D3D_ErrorString (hr)); - - uPasses = 0; - if (psEffect_Begin (pEffect, (lpWorkTexture == lpWorkTexture1[0]) ? psEffect_PreProcess1 : psEffect_PreProcess2, &uPasses)) { - for (uPass = 0; uPass < uPasses; uPass++) { - if (psEffect_BeginPass (pEffect, uPass)) { - if (FAILED (hr = d3ddev->DrawPrimitive (D3DPT_TRIANGLESTRIP, 4, 2))) { - write_log (_T("%s: Effect DrawPrimitive failed: %s\n"), D3DHEAD, D3D_ErrorString (hr)); - } - psEffect_EndPass (pEffect); - } - } - psEffect_End (pEffect); - } - if (FAILED (hr = d3ddev->SetRenderTarget (0, lpRenderTarget))) - write_log (_T("%s: Effect RenderTarget reset failed: %s\n"), D3DHEAD, D3D_ErrorString (hr)); - lpNewRenderTarget->Release (); - lpNewRenderTarget = NULL; - if (psEffect_hasPreProcess2 () && lpWorkTexture == lpWorkTexture1[0]) { - lpWorkTexture = lpWorkTexture2[0]; - goto pass2; - } - lpRenderTarget->Release (); - lpRenderTarget = NULL; } - psEffect_SetMatrices (&m_matProj2, &m_matView2, &m_matWorld2); + } + } #if TWOPASS - if (FAILED (hr = d3ddev->GetRenderTarget (0, &lpRenderTarget))) - write_log (_T("%s: GetRenderTarget: %s\n"), D3DHEAD, D3D_ErrorString (hr)); - if (FAILED (hr = lpTempTexture->GetSurfaceLevel (0, &lpNewRenderTarget))) - write_log (_T("%s: GetSurfaceLevel: %s\n"), D3DHEAD, D3D_ErrorString (hr)); - if (FAILED (hr = d3ddev->SetRenderTarget (0, lpNewRenderTarget))) - write_log (_T("%s: SetRenderTarget: %s\n"), D3DHEAD, D3D_ErrorString (hr)); -#endif - hr = d3ddev->Clear (0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, d3ddebug ? 0x80 : 0), 0, 0); - - uPasses = 0; - if (psEffect_Begin (pEffect, psEffect_Combine, &uPasses)) { - for (uPass = 0; uPass < uPasses; uPass++) { - if (!psEffect_BeginPass (pEffect, uPass)) - return; - if (FAILED (hr = d3ddev->DrawPrimitive (D3DPT_TRIANGLESTRIP, 0, 2))) - write_log (_T("%s: Effect2 DrawPrimitive failed: %s\n"), D3DHEAD, D3D_ErrorString (hr)); - psEffect_EndPass (pEffect); - } - psEffect_End (pEffect); - } -#if TWOPASS - if (FAILED (hr = d3ddev->SetRenderTarget (0, lpRenderTarget))) - write_log (_T("%s: SetRenderTarget: %s\n"), D3DHEAD, D3D_ErrorString (hr)); - lpNewRenderTarget->Release (); - lpRenderTarget->Release (); -#endif - srctex = lpTempTexture; + if (shaderon > 0 && shaders[SHADER_POST].pEffect) { + LPDIRECT3DSURFACE9 lpRenderTarget; + LPDIRECT3DSURFACE9 lpNewRenderTarget; + struct shaderdata *s = &shaders[SHADER_POST]; + LPD3DXEFFECT postEffect = s->pEffect; + int after = -1; + for (int i = 0; i < MAX_SHADERS; i++) { + struct shaderdata *s = &shaders[i]; + if (s->type == SHADERTYPE_AFTER) + after = i; } - } + setupscenecoords (); + hr = d3ddev->SetTransform (D3DTS_PROJECTION, &m_matProj); + hr = d3ddev->SetTransform (D3DTS_VIEW, &m_matView); + hr = d3ddev->SetTransform (D3DTS_WORLD, &m_matWorld); -#if TWOPASS - if (shaderon > 0 && postEffect) { + hr = postEffect->SetMatrix (postMatrixSource, &postproj); + hr = postEffect->SetVector (postMaskMult, &maskmult); + hr = postEffect->SetVector (postMaskShift, &maskshift); + hr = postEffect->SetVector (postTexelSize, &texelsize); if (masktexture) { if (FAILED (hr = postEffect->SetTechnique (postTechnique))) @@ -2671,14 +2769,18 @@ static void D3D_render2 (void) if (FAILED (hr = postEffect->SetTexture (postSourceTextureHandle, srctex))) write_log (_T("%s: SetTexture(srctex) failed: %s\n"), D3DHEAD, D3D_ErrorString (hr)); - setupscenecoords (); - hr = postEffect->SetMatrix (postMatrixSource, &postproj); - hr = postEffect->SetVector (postMaskMult, &maskmult); - hr = postEffect->SetVector (postMaskShift, &maskshift); - hr = postEffect->SetVector (postTexelSize, &texelsize); + + if (after >= 0) { + if (FAILED (hr = d3ddev->GetRenderTarget (0, &lpRenderTarget))) + write_log (_T("%s: GetRenderTarget: %s\n"), D3DHEAD, D3D_ErrorString (hr)); + if (FAILED (hr = lpPostTempTexture->GetSurfaceLevel (0, &lpNewRenderTarget))) + write_log (_T("%s: GetSurfaceLevel: %s\n"), D3DHEAD, D3D_ErrorString (hr)); + if (FAILED (hr = d3ddev->SetRenderTarget (0, lpNewRenderTarget))) + write_log (_T("%s: SetRenderTarget: %s\n"), D3DHEAD, D3D_ErrorString (hr)); + } uPasses = 0; - if (psEffect_Begin (postEffect, psEffect_None, &uPasses)) { + if (psEffect_Begin (psEffect_None, &uPasses, s)) { for (uPass = 0; uPass < uPasses; uPass++) { if (psEffect_BeginPass (postEffect, uPass)) { if (FAILED (hr = d3ddev->DrawPrimitive (D3DPT_TRIANGLESTRIP, 0, 2))) @@ -2689,6 +2791,24 @@ static void D3D_render2 (void) psEffect_End (postEffect); } + if (after >= 0) { + if (FAILED (hr = d3ddev->SetRenderTarget (0, lpRenderTarget))) + write_log (_T("%s: SetRenderTarget: %s\n"), D3DHEAD, D3D_ErrorString (hr)); + lpNewRenderTarget->Release (); + lpRenderTarget->Release (); + + srctex = lpPostTempTexture; + for (int i = 0; i < MAX_SHADERS; i++) { + struct shaderdata *s = &shaders[i]; + if (s->type == SHADERTYPE_AFTER) { + settransform2 (s); + srctex = processshader (srctex, s, i != after); + if (!srctex) + return; + } + } + } + } else { // non-shader version diff --git a/od-win32/genblitter_msvc/genblitter_msvc.vcxproj b/od-win32/genblitter_msvc/genblitter_msvc.vcxproj index 9bc77b76..b809cd2a 100644 --- a/od-win32/genblitter_msvc/genblitter_msvc.vcxproj +++ b/od-win32/genblitter_msvc/genblitter_msvc.vcxproj @@ -17,6 +17,10 @@ TestRelease Win32 + + Test + Win32 + genblitter @@ -47,6 +51,12 @@ Unicode v110 + + Application + false + Unicode + v110 + @@ -62,12 +72,18 @@ + + + <_ProjectFileVersion>10.0.30128.1 .\Release\ + .\Release\ .\Release\ + .\Release\ false + false .\Debug\ .\Debug\ true @@ -126,6 +142,57 @@ genblitter.exe f >..\..\blitfunc.cpp genblitter.exe h >..\..\blitfunc.h genblitter.exe t >..\..\blittable.cpp del genblitter.exe + + + + + + .\Release/genblitter_msvc.tlb + + + %(AdditionalOptions) + OnlyExplicitInline + ..\..\include;..\..;..\;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + MultiThreaded + true + .\Release/genblitter_msvc.pch + .\Release/ + .\Release/ + .\Release/ + Level3 + true + Default + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + deleting blitter files + del ..\..\blit.h +del ..\..\blitfunc.cpp +del ..\..\blitfunc.h +del ..\..\blittable.cpp + + + /MACHINE:I386 %(AdditionalOptions) + genblitter.exe + true + .\Release/genblitter.pdb + Console + false + + + + + generating blitter files + genblitter.exe i >..\..\blit.h +genblitter.exe f >..\..\blitfunc.cpp +genblitter.exe h >..\..\blitfunc.h +genblitter.exe t >..\..\blittable.cpp +del genblitter.exe diff --git a/od-win32/gencomp_msvc/gencomp_msvc.vcxproj b/od-win32/gencomp_msvc/gencomp_msvc.vcxproj index b55431e0..cd361aa4 100644 --- a/od-win32/gencomp_msvc/gencomp_msvc.vcxproj +++ b/od-win32/gencomp_msvc/gencomp_msvc.vcxproj @@ -17,6 +17,10 @@ TestRelease Win32 + + Test + Win32 + gencomp @@ -48,6 +52,13 @@ MultiByte v110 + + Application + false + false + MultiByte + v110 + @@ -63,12 +74,18 @@ + + + <_ProjectFileVersion>10.0.30128.1 .\Release\ + .\Release\ .\Release\ + .\Release\ false + false .\Debug\ .\Debug\ true @@ -119,6 +136,49 @@ od-win32\gencomp_msvc\gencomp.exe del od-win32\gencomp_msvc\gencomp.exe + + + + + + .\Release/gencomp_msvc.tlb + + + %(AdditionalOptions) + OnlyExplicitInline + ..\..\include;..\..;..\;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + MultiThreaded + true + .\Release/gencomp_msvc.pch + .\Release/ + .\Release/ + .\Release/ + Level3 + true + Default + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + /MACHINE:I386 %(AdditionalOptions) + gencomp.exe + true + .\Release/gencomp.pdb + Console + false + + + + + generating gencomp files + cd ..\.. +od-win32\gencomp_msvc\gencomp.exe +del od-win32\gencomp_msvc\gencomp.exe + diff --git a/od-win32/gencpu_msvc/gencpu_msvc.vcxproj b/od-win32/gencpu_msvc/gencpu_msvc.vcxproj index c886114f..51f9f42a 100644 --- a/od-win32/gencpu_msvc/gencpu_msvc.vcxproj +++ b/od-win32/gencpu_msvc/gencpu_msvc.vcxproj @@ -17,6 +17,10 @@ TestRelease Win32 + + Test + Win32 + gencpu @@ -41,6 +45,12 @@ Unicode v110 + + Application + false + Unicode + v110 + Application false @@ -59,6 +69,9 @@ + + + @@ -69,9 +82,13 @@ .\Debug\ true .\Release\ + .\Release\ .\Release\ + .\Release\ false + false false + false $(Configuration)\ $(Configuration)\ false @@ -158,6 +175,57 @@ del ..\..\cpustbl.cpp del ..\..\cpuemu.cpp + + + + /MACHINE:I386 %(AdditionalOptions) + gencpu.exe + true + .\Release/gencpu.pdb + Console + false + + + + + generating gencpu files + cd ..\.. +od-win32\gencpu_msvc\gencpu.exe +del od-win32\gencpu_msvc\gencpu.exe + + + + + + .\Release/gencpu_msvc.tlb + + + %(AdditionalOptions) + OnlyExplicitInline + ..\..\include;..\..;..\;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + MultiThreaded + true + .\Release/gencpu_msvc.pch + .\Release/ + .\Release/ + .\Release/ + Level3 + true + Default + Cdecl + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + deleting gencpu files + del ..\..\cputbl.h +del ..\..\cpustbl.cpp +del ..\..\cpuemu.cpp + diff --git a/od-win32/genlinetoscr_msvc/genlinetoscr_msvc.vcxproj b/od-win32/genlinetoscr_msvc/genlinetoscr_msvc.vcxproj index 349de0d6..f1ad0825 100644 --- a/od-win32/genlinetoscr_msvc/genlinetoscr_msvc.vcxproj +++ b/od-win32/genlinetoscr_msvc/genlinetoscr_msvc.vcxproj @@ -13,6 +13,10 @@ Release Win32 + + Test + Win32 + genlinetoscr @@ -33,6 +37,12 @@ true v110 + + Application + Unicode + true + v110 + Application Unicode @@ -47,6 +57,9 @@ + + + @@ -57,8 +70,11 @@ $(Configuration)\ true $(SolutionDir)$(Configuration)\ + $(SolutionDir)$(Configuration)\ $(Configuration)\ + $(Configuration)\ false + false $(SolutionDir)$(Configuration)\ $(Configuration)\ false @@ -117,6 +133,42 @@ generating linetoscr.c genlinetoscr.exe >..\..\linetoscr.cpp del genlinetoscr.exe + + + + + + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + deleteing linetoscr.cpp + del ..\..\linetoscr.cpp + + + + genlinetoscr.exe + true + Console + true + true + false + + + MachineX86 + + + generating linetoscr.c + genlinetoscr.exe >..\..\linetoscr.cpp +del genlinetoscr.exe diff --git a/od-win32/hardfile_win32.cpp b/od-win32/hardfile_win32.cpp index d2c000b8..971328c9 100644 --- a/od-win32/hardfile_win32.cpp +++ b/od-win32/hardfile_win32.cpp @@ -1903,9 +1903,14 @@ int harddrive_to_hdf (HWND hDlg, struct uae_prefs *p, int idx) goto ok; err: + DWORD err = GetLastError (); + LPWSTR pBuffer = NULL; WIN32GUI_LoadUIString (IDS_HDCLONE_FAIL, tmp, MAX_DPATH); - _stprintf (tmp2, tmp, progressdialogreturn, GetLastError()); + if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&pBuffer, 0, NULL)) + pBuffer = NULL; + _stprintf (tmp2, tmp, progressdialogreturn, err, pBuffer ? _T("") : pBuffer); gui_message (tmp2); + LocalFree (pBuffer); ok: if (h != INVALID_HANDLE_VALUE) diff --git a/od-win32/prowizard/prowizard.vcxproj b/od-win32/prowizard/prowizard.vcxproj index 9a7dac87..7b22e7ac 100644 --- a/od-win32/prowizard/prowizard.vcxproj +++ b/od-win32/prowizard/prowizard.vcxproj @@ -17,6 +17,14 @@ Release x64 + + Test + Win32 + + + Test + x64 + {8627DA33-98D1-4F60-B404-ECCEE0EE7BF9} @@ -30,6 +38,12 @@ false v110 + + StaticLibrary + Unicode + false + v110 + StaticLibrary Unicode @@ -41,6 +55,12 @@ true v110 + + StaticLibrary + Unicode + true + v110 + StaticLibrary Unicode @@ -52,12 +72,18 @@ + + + + + + @@ -67,12 +93,17 @@ $(SolutionDir)$(Configuration)\..\..\lib\ $(Configuration)\ $(SolutionDir)$(Configuration)\..\..\lib\ + $(SolutionDir)$(Configuration)\..\..\lib\ $(Configuration)\ + $(Configuration)\ $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ $(SolutionDir)$(Platform)\$(Configuration)\..\..\..\lib\ + $(SolutionDir)$(Platform)\$(Configuration)\..\..\..\lib\ $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ $(ProjectName)_x64 + $(ProjectName)_x64 @@ -120,6 +151,33 @@ false + + + MaxSpeed + true + false + ..\..\prowizard\include;..\..\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreaded + false + true + + + Level3 + ProgramDatabase + StdCall + Default + 4996;%(DisableSpecificWarnings) + + + $(OutDir)$(TargetName)$(TargetExt) + + + + + false + + X64 @@ -165,6 +223,35 @@ false + + + X64 + + + MaxSpeed + true + false + ..\..\prowizard\include;..\..\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreadedDLL + false + true + + + Level3 + ProgramDatabase + StdCall + Default + 4996;%(DisableSpecificWarnings) + + + $(OutDir)$(TargetName)$(TargetExt) + + + prowizard_search;%(ExportNamedFunctions) + false + + diff --git a/od-win32/resources/resource.h b/od-win32/resources/resource.h index 93f4ed6f..712d48f8 100644 --- a/od-win32/resources/resource.h +++ b/od-win32/resources/resource.h @@ -1120,8 +1120,10 @@ #define IDC_LISTDIALOG_LIST 1813 #define IDC_LOGPATH 1814 #define IDC_MIDIROUTER 1815 +#define IDC_CDLIST 1815 #define IDC_CS_IDE4 1816 #define IDC_CS_DF0IDHW 1817 +#define IDC_FILTERSTACK 1818 #define ID__FLOPPYDRIVES 40004 #define ID_FLOPPYDRIVES_DF0 40005 #define ID_ST_CONFIGURATION 40010 @@ -1172,7 +1174,7 @@ #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 388 #define _APS_NEXT_COMMAND_VALUE 40050 -#define _APS_NEXT_CONTROL_VALUE 1815 +#define _APS_NEXT_CONTROL_VALUE 1819 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index 056a6f7e..53361a72 100644 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -770,10 +770,10 @@ STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN GROUPBOX "Filter Settings",-1,1,1,393,146 - COMBOBOX IDC_FILTERMODE,20,15,188,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_FILTERMODE,9,15,167,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_FILTERFILTER,215,15,63,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Reset to defaults",IDC_FILTERDEFAULT,283,15,106,14 - COMBOBOX IDC_FILTEROVERLAYTYPE,20,36,108,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_FILTEROVERLAYTYPE,9,36,118,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_FILTEROVERLAY,134,36,145,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_FILTERAUTOSCALE,284,36,104,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP RTEXT "Horiz. size:",-1,7,63,81,10,SS_CENTERIMAGE @@ -806,6 +806,7 @@ BEGIN PUSHBUTTON "Load",IDC_FILTERPRESETLOAD,205,259,55,14 PUSHBUTTON "Save",IDC_FILTERPRESETSAVE,265,259,55,14 PUSHBUTTON "Delete",IDC_FILTERPRESETDELETE,325,259,55,14 + COMBOBOX IDC_FILTERSTACK,182,15,27,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP END IDD_HARDDRIVE DIALOGEX 0, 0, 396, 109 @@ -1108,7 +1109,7 @@ BEGIN CONTROL "",IDC_LISTDIALOG_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,7,302,171 END -IDD_CDDRIVE DIALOGEX 0, 0, 396, 109 +IDD_CDDRIVE DIALOGEX 0, 0, 395, 109 STYLE DS_LOCALEDIT | DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "CD Settings" FONT 8, "MS Sans Serif", 0, 0, 0x0 @@ -1117,6 +1118,7 @@ BEGIN COMBOBOX IDC_HDF_CONTROLLER,91,89,61,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP DEFPUSHBUTTON "Add CD Drive",IDOK,236,87,73,14 PUSHBUTTON "Cancel",IDCANCEL,316,87,73,14 + CONTROL "",IDC_CDLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,4,4,387,77 END @@ -1705,7 +1707,7 @@ BEGIN IDS_NUMSG_KICKREPNO "The floppy disk (image file) in DF0: is not compatible with the system ROM replacement functionality." IDS_NUMSG_NOROM "Could not load system ROM, trying system ROM replacement." IDS_HDCLONE_OK "Hard drive image file created succesfully." - IDS_HDCLONE_FAIL "Hard drive image file creation failed.\nError code %d:%d." + IDS_HDCLONE_FAIL "Hard drive image file creation failed.\nError %d:%d (%s)." IDS_NUMSG_KS68030 "The selected system ROM requires a 68030 CPU." IDS_NUMSG_EXPROMNEED "One of the following expansion boot ROMs is required:\n\n%s\n\nCheck the System ROM path in the Paths panel and click Rescan ROMs." IDS_SB_FAVORITENAME "Enter name..." diff --git a/od-win32/uaeunp/uaeunp.vcxproj b/od-win32/uaeunp/uaeunp.vcxproj index e58ae48b..1d7bf676 100644 --- a/od-win32/uaeunp/uaeunp.vcxproj +++ b/od-win32/uaeunp/uaeunp.vcxproj @@ -9,6 +9,10 @@ Release Win32 + + Test + Win32 + {6181E50C-5F32-42DC-BEF6-827AA8A5429D} @@ -22,6 +26,12 @@ true v110 + + Application + Unicode + true + v110 + Application Unicode @@ -33,6 +43,9 @@ + + + @@ -43,10 +56,15 @@ $(Configuration)\ true d:\amiga\ + d:\amiga\ $(Configuration)\ + $(Configuration)\ false + false C:\dev\include;$(IncludePath) + C:\dev\include;$(IncludePath) C:\dev\lib;$(LibraryPath) + C:\dev\lib;$(LibraryPath) C:\dev\include;$(IncludePath) C:\dev\lib;$(LibraryPath) @@ -103,6 +121,34 @@ $(SolutionDir)\..\lib\ + + + MaxSpeed + true + ..\..\include;..\..;..\;..\resources;..\osdep;..\sounddep;..\..\prowizard\include;..\tun;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;WIN32_IE=0x0700;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + MultiThreaded + true + + + Level3 + ProgramDatabase + StdCall + true + Sync + false + + + zlibstat.lib;wininet.lib;lzmalib.lib;%(AdditionalDependencies) + wininet.dll;%(DelayLoadDLLs) + true + Console + true + true + MachineX86 + $(SolutionDir)\..\lib\ + + diff --git a/od-win32/unpackers/unpackers.vcxproj b/od-win32/unpackers/unpackers.vcxproj index 501a452d..c10ff8ea 100644 --- a/od-win32/unpackers/unpackers.vcxproj +++ b/od-win32/unpackers/unpackers.vcxproj @@ -17,6 +17,14 @@ Release x64 + + Test + Win32 + + + Test + x64 + {98BA115B-829F-4085-9729-ABD0D779A60A} @@ -43,6 +51,13 @@ Unicode v110 + + StaticLibrary + false + false + Unicode + v110 + StaticLibrary false @@ -50,6 +65,13 @@ Unicode v110 + + StaticLibrary + false + true + Unicode + v110 + @@ -62,17 +84,30 @@ + + + + + + $(SolutionDir)$(Configuration)\..\..\lib\ + + $(SolutionDir)$(Configuration)\..\..\lib\ + $(SolutionDir)$(Platform)\$(Configuration)\..\..\..\lib\ $(ProjectName)_x64 + + $(SolutionDir)$(Platform)\$(Configuration)\..\..\..\lib\ + $(ProjectName)_x64 + $(SolutionDir)$(Configuration)\..\..\lib\ @@ -138,6 +173,30 @@ + + + Level3 + NotUsing + MaxSpeed + true + true + WINVER=0x0500;NDEBUG;_WIN32_IE=0x0700;WIN32;%(PreprocessorDefinitions) + MultiThreaded + StdCall + ..\..\include;..\;%(AdditionalIncludeDirectories) + false + + + Windows + true + true + true + + + + + + Level3 @@ -157,6 +216,25 @@ true + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreaded + StdCall + ..\..\include;..\..;..\;..\resources;..\osdep;..\sounddep;..\..\prowizard\include;%(AdditionalIncludeDirectories) + + + Windows + true + true + true + + diff --git a/od-win32/win32.h b/od-win32/win32.h index 105a1ec5..8c14b40e 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -19,11 +19,11 @@ #define LANG_DLL 1 #if WINUAEPUBLICBETA -#define WINUAEBETA _T("5") +#define WINUAEBETA _T("6") #else #define WINUAEBETA _T("") #endif -#define WINUAEDATE MAKEBD(2013, 2, 1) +#define WINUAEDATE MAKEBD(2013, 2, 3) #define WINUAEEXTRA _T("") //#define WINUAEEXTRA _T("AmiKit Preview") #define WINUAEREV _T("") diff --git a/od-win32/win32gfx.cpp b/od-win32/win32gfx.cpp index 84d675cb..1b8ccae7 100644 --- a/od-win32/win32gfx.cpp +++ b/od-win32/win32gfx.cpp @@ -1711,8 +1711,11 @@ int check_prefs_changed_gfx (void) c |= currprefs.gfx_autoresolution != changed_prefs.gfx_autoresolution ? (2|8|16) : 0; c |= currprefs.gfx_api != changed_prefs.gfx_api ? (1|8|32) : 0; + for (int i = 0; i < 2 * MAX_FILTERSHADERS; i++) { + c |= _tcscmp (currprefs.gfx_filtershader[i], changed_prefs.gfx_filtershader[i]) ? (2|8) : 0; + } + c |= currprefs.gfx_filter != changed_prefs.gfx_filter ? (2|8) : 0; - c |= _tcscmp (currprefs.gfx_filtershader, changed_prefs.gfx_filtershader) ? (2|8) : 0; c |= _tcscmp (currprefs.gfx_filtermask, changed_prefs.gfx_filtermask) ? (2|8) : 0; c |= _tcscmp (currprefs.gfx_filteroverlay, changed_prefs.gfx_filteroverlay) ? (2|8) : 0; c |= currprefs.gfx_filter_filtermode != changed_prefs.gfx_filter_filtermode ? (2|8) : 0; @@ -1797,8 +1800,10 @@ int check_prefs_changed_gfx (void) display_change_requested = 0; } + for (int i = 0; i < 2 * MAX_FILTERSHADERS; i++) { + _tcscpy (currprefs.gfx_filtershader[i], changed_prefs.gfx_filtershader[i]); + } currprefs.gfx_filter = changed_prefs.gfx_filter; - _tcscpy (currprefs.gfx_filtershader, changed_prefs.gfx_filtershader); _tcscpy (currprefs.gfx_filtermask, changed_prefs.gfx_filtermask); _tcscpy (currprefs.gfx_filteroverlay, changed_prefs.gfx_filteroverlay); currprefs.gfx_filter_filtermode = changed_prefs.gfx_filter_filtermode; diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index 29e52dac..ccdbc551 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -137,6 +137,7 @@ extern int mouseactive; TCHAR config_filename[256] = _T(""); static TCHAR stored_path[MAX_DPATH]; static int gui_size_changed; +static int filterstackpos = 0; #define Error(x) MessageBox (NULL, (x), _T("WinUAE Error"), MB_OK) @@ -3581,6 +3582,7 @@ static int clicked_entry = -1; #define INPUTMAP_COLUMNS 1 #define MISC1_COLUMNS 1 #define MAX_COLUMN_HEADING_WIDTH 20 +#define CD_COLUMNS 3 #define LV_LOADSAVE 1 #define LV_HARDDISK 2 @@ -3589,7 +3591,8 @@ static int clicked_entry = -1; #define LV_MISC2 5 #define LV_INPUTMAP 6 #define LV_MISC1 7 -#define LV_MAX 8 +#define LV_CD 8 +#define LV_MAX 9 static int lv_oldidx[LV_MAX]; static int lv_old_type = -1; @@ -3707,7 +3710,7 @@ void InitializeListView (HWND hDlg) list = GetDlgItem (hDlg, IDC_MISCLIST); extraflags = LVS_EX_CHECKBOXES; - } else { + } else if (hDlg == pages[DISK_ID]) { listview_num_columns = DISK_COLUMNS; lv_type = LV_DISK; @@ -3716,6 +3719,14 @@ void InitializeListView (HWND hDlg) WIN32GUI_LoadUIString (IDS_DISK_DRIVENAME, column_heading[2], MAX_COLUMN_HEADING_WIDTH); list = GetDlgItem (hDlg, IDC_DISK); + } else { + // CD dialog + listview_num_columns = CD_COLUMNS; + lv_type = LV_CD; + _tcscpy (column_heading[0], _T("*")); + WIN32GUI_LoadUIString (IDS_DEVICE, column_heading[1], MAX_COLUMN_HEADING_WIDTH); + WIN32GUI_LoadUIString (IDS_PATH, column_heading[2], MAX_COLUMN_HEADING_WIDTH); + list = GetDlgItem (hDlg, IDC_CDLIST); } int flags = LVS_EX_DOUBLEBUFFER | extraflags; @@ -3878,10 +3889,35 @@ void InitializeListView (HWND hDlg) listview_column_width[1] = 336; listview_column_width[2] = 50; + } else if (lv_type == LV_CD) { + + listview_column_width[2] = 450; + for (i = 0; i < MAX_TOTAL_SCSI_DEVICES; i++) { + TCHAR tmp[10]; + struct device_info di = { 0 }; + struct cdslot *cds = &workprefs.cdslots[i]; + + if (cds->inuse) + blkdev_get_info (&workprefs, i, &di); + _stprintf (tmp, _T("%d"), i); + lvstruct.mask = LVIF_TEXT | LVIF_PARAM; + lvstruct.pszText = cds->inuse ? (di.media_inserted ? _T("*") : _T("E")) : _T("-"); + lvstruct.lParam = 0; + lvstruct.iItem = i; + lvstruct.iSubItem = 0; + result = ListView_InsertItem (list, &lvstruct); + ListView_SetItemText(list, result, 1, tmp); + ListView_SetItemText(list, result, 2, cds->name); + width = ListView_GetStringWidth(list, cds->name) + 10; + if (width > listview_column_width[2]) + listview_column_width[2] = width; + break; + } + } else if (lv_type == LV_HARDDISK) { #ifdef FILESYS listview_column_width[1] = 60; - for(i = 0; i < workprefs.mountitems; i++) + for (i = 0; i < workprefs.mountitems; i++) { struct uaedev_config_data *uci = &workprefs.mountconfig[i]; struct uaedev_config_info *ci = &uci->ci; @@ -9183,10 +9219,12 @@ static void default_fsvdlg (struct fsvdlg_vals *f) } static void default_hfdlg (struct hfdlg_vals *f, bool rdb) { + int ctrl = f->ci.controller; memset (f, 0, sizeof (struct hfdlg_vals)); uci_set_defaults (&f->ci, rdb); f->original = true; f->ci.type = UAEDEV_HDF; + f->ci.controller = ctrl; } static void volumeselectfile (HWND hDlg) @@ -9576,11 +9614,21 @@ static INT_PTR CALLBACK CDDriveSettingsProc (HWND hDlg, UINT msg, WPARAM wParam, case WM_INITDIALOG: recursive++; inithdcontroller (hDlg); + if (current_cddlg.ci.controller < HD_CONTROLLER_IDE0) + current_cddlg.ci.controller = (workprefs.cs_a2091 || workprefs.cs_cdtvscsi || workprefs.cs_mbdmac == 1) ? HD_CONTROLLER_SCSI0 : HD_CONTROLLER_IDE0; SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_SETCURSEL, current_cddlg.ci.controller, 0); + InitializeListView (hDlg); recursive--; customDlgType = IDD_CDDRIVE; customDlg = hDlg; return TRUE; + case WM_NOTIFY: + if (((LPNMHDR) lParam)->idFrom == IDC_CDLIST) { + NM_LISTVIEW *nmlistview = (NM_LISTVIEW *)lParam; + if (nmlistview->hdr.code == NM_DBLCLK) + EndDialog (hDlg, 1); + } + break; case WM_COMMAND: if (recursive) break; @@ -13433,6 +13481,7 @@ static void enable_for_hw3ddlg (HWND hDlg) ew (hDlg, IDC_FILTERXTRA, vv2); ew (hDlg, IDC_FILTERDEFAULT, v); ew (hDlg, IDC_FILTERFILTER, workprefs.gfx_api); + ew (hDlg, IDC_FILTERSTACK, workprefs.gfx_api); ew (hDlg, IDC_FILTERKEEPASPECT, v); ew (hDlg, IDC_FILTERASPECT, v); ew (hDlg, IDC_FILTERASPECT2, v && workprefs.gfx_filter_keep_aspect); @@ -13623,6 +13672,14 @@ static void values_to_hw3ddlg (HWND hDlg) SendDlgItemMessage (hDlg, IDC_FILTERAUTOSCALE, CB_ADDSTRING, 0, (LPARAM)txt); SendDlgItemMessage (hDlg, IDC_FILTERAUTOSCALE, CB_SETCURSEL, workprefs.gfx_filter_autoscale, 0); + SendDlgItemMessage (hDlg, IDC_FILTERSTACK, CB_RESETCONTENT, 0, 0); + for (int i = -4; i <= 3; i++) { + int j = i < 0 ? i : i + 1; + _stprintf (tmp, _T("%d%s"), j, workprefs.gfx_filtershader[i + 4][0] ? _T(" *") : _T("")); + SendDlgItemMessage (hDlg, IDC_FILTERSTACK, CB_ADDSTRING, 0, (LPARAM)tmp); + } + SendDlgItemMessage (hDlg, IDC_FILTERSTACK, CB_SETCURSEL, filterstackpos, 0); + int range1 = workprefs.gfx_filter_autoscale == AUTOSCALE_MANUAL ? -1 : -9999; int range2 = workprefs.gfx_filter_autoscale == AUTOSCALE_MANUAL ? 1800 : 9999; @@ -13652,6 +13709,7 @@ static void values_to_hw3ddlg (HWND hDlg) i++; } if (workprefs.gfx_api && D3D_canshaders ()) { + bool gotit = false; HANDLE h; WIN32_FIND_DATA wfd; TCHAR tmp[MAX_DPATH]; @@ -13664,8 +13722,10 @@ static void values_to_hw3ddlg (HWND hDlg) _stprintf (tmp2, _T("D3D: %s"), wfd.cFileName); tmp2[_tcslen (tmp2) - 3] = 0; SendDlgItemMessage (hDlg, IDC_FILTERMODE, CB_ADDSTRING, 0, (LPARAM)tmp2); - if (workprefs.gfx_api && !_tcscmp (workprefs.gfx_filtershader, wfd.cFileName)) + if (workprefs.gfx_api && !_tcscmp (workprefs.gfx_filtershader[filterstackpos], wfd.cFileName)) { fltnum = j; + gotit = true; + } j++; } if (!FindNextFile (h, &wfd)) { @@ -13673,6 +13733,10 @@ static void values_to_hw3ddlg (HWND hDlg) h = INVALID_HANDLE_VALUE; } } + for (int i = 1; i < 2 * MAX_FILTERSHADERS; i++) { + if (workprefs.gfx_filtershader[i][0] && !gotit) + fltnum = UAE_FILTER_NULL; + } } int overlaytype = SendDlgItemMessage (hDlg, IDC_FILTEROVERLAYTYPE, CB_GETCURSEL, 0, 0L); if (workprefs.gfx_api && D3D_goodenough () > 1) { @@ -13954,9 +14018,9 @@ static void filter_handle (HWND hDlg) int of = workprefs.gfx_filter; int off = workprefs.gfx_filter_filtermode; tmp[0] = 0; - _tcscpy (oldsh, workprefs.gfx_filtershader); + _tcscpy (oldsh, workprefs.gfx_filtershader[filterstackpos]); SendDlgItemMessage (hDlg, IDC_FILTERMODE, CB_GETLBTEXT, (WPARAM)item, (LPARAM)tmp); - workprefs.gfx_filtershader[0] = 0; + workprefs.gfx_filtershader[filterstackpos][0] = 0; workprefs.gfx_filter = 0; workprefs.gfx_filter_filtermode = 0; if (workprefs.gfx_api) { @@ -13966,7 +14030,7 @@ static void filter_handle (HWND hDlg) } if (item > 0) { if (item > UAE_FILTER_LAST) { - _stprintf (workprefs.gfx_filtershader, _T("%s.fx"), tmp + 5); + _stprintf (workprefs.gfx_filtershader[filterstackpos], _T("%s.fx"), tmp + 5); } else { item--; workprefs.gfx_filter = uaefilters[item].type; @@ -13976,6 +14040,10 @@ static void filter_handle (HWND hDlg) hw3d_changed = 1; } } + for (int i = 1; i < MAX_FILTERSHADERS; i++) { + if (workprefs.gfx_filtershader[i][0]) + workprefs.gfx_filter = UAE_FILTER_NULL; + } if (workprefs.gfx_filter == 0 && !workprefs.gfx_api) workprefs.gfx_filter_autoscale = 0; } @@ -14104,6 +14172,14 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM if (HIWORD (wParam) == CBN_SELCHANGE || HIWORD (wParam) == CBN_KILLFOCUS) { switch (LOWORD (wParam)) { + case IDC_FILTERSTACK: + item = SendDlgItemMessage (hDlg, IDC_FILTERSTACK, CB_GETCURSEL, 0, 0L); + if (item != CB_ERR) { + filterstackpos = item; + values_to_hw3ddlg (hDlg); + enable_for_hw3ddlg (hDlg); + } + break; case IDC_FILTERAUTOSCALE: item = SendDlgItemMessage (hDlg, IDC_FILTERAUTOSCALE, CB_GETCURSEL, 0, 0L); if (item != CB_ERR) { diff --git a/od-win32/winuae_msvc11/winuae_msvc.sln b/od-win32/winuae_msvc11/winuae_msvc.sln index d54f5bc5..81261be7 100644 --- a/od-win32/winuae_msvc11/winuae_msvc.sln +++ b/od-win32/winuae_msvc11/winuae_msvc.sln @@ -1,5 +1,5 @@ -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winuae", "winuae_msvc.vcxproj", "{4ADAA943-1AC8-4FB5-82E5-4FB753B6C2DA}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gencpu", "..\gencpu_msvc\gencpu_msvc.vcxproj", "{DEF7ACF7-050E-4069-BB99-5B5D93F60521}" @@ -38,6 +38,8 @@ Global FullRelease|x64 = FullRelease|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 + Test|Win32 = Test|Win32 + Test|x64 = Test|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {4ADAA943-1AC8-4FB5-82E5-4FB753B6C2DA}.Debug|Win32.ActiveCfg = Debug|Win32 @@ -52,90 +54,122 @@ Global {4ADAA943-1AC8-4FB5-82E5-4FB753B6C2DA}.Release|Win32.Build.0 = Release|Win32 {4ADAA943-1AC8-4FB5-82E5-4FB753B6C2DA}.Release|x64.ActiveCfg = Release|x64 {4ADAA943-1AC8-4FB5-82E5-4FB753B6C2DA}.Release|x64.Build.0 = Release|x64 + {4ADAA943-1AC8-4FB5-82E5-4FB753B6C2DA}.Test|Win32.ActiveCfg = Test|Win32 + {4ADAA943-1AC8-4FB5-82E5-4FB753B6C2DA}.Test|Win32.Build.0 = Test|Win32 + {4ADAA943-1AC8-4FB5-82E5-4FB753B6C2DA}.Test|x64.ActiveCfg = Test|x64 + {4ADAA943-1AC8-4FB5-82E5-4FB753B6C2DA}.Test|x64.Build.0 = Test|x64 {DEF7ACF7-050E-4069-BB99-5B5D93F60521}.Debug|Win32.ActiveCfg = Debug|Win32 {DEF7ACF7-050E-4069-BB99-5B5D93F60521}.Debug|x64.ActiveCfg = Debug|Win32 {DEF7ACF7-050E-4069-BB99-5B5D93F60521}.FullRelease|Win32.ActiveCfg = FullRelease|Win32 {DEF7ACF7-050E-4069-BB99-5B5D93F60521}.FullRelease|x64.ActiveCfg = FullRelease|Win32 {DEF7ACF7-050E-4069-BB99-5B5D93F60521}.Release|Win32.ActiveCfg = Release|Win32 {DEF7ACF7-050E-4069-BB99-5B5D93F60521}.Release|x64.ActiveCfg = Release|Win32 + {DEF7ACF7-050E-4069-BB99-5B5D93F60521}.Test|Win32.ActiveCfg = Test|Win32 + {DEF7ACF7-050E-4069-BB99-5B5D93F60521}.Test|x64.ActiveCfg = Test|Win32 {54197DFF-9CAA-4A9F-B9C2-2881EA04EACB}.Debug|Win32.ActiveCfg = Debug|Win32 {54197DFF-9CAA-4A9F-B9C2-2881EA04EACB}.Debug|x64.ActiveCfg = Debug|Win32 {54197DFF-9CAA-4A9F-B9C2-2881EA04EACB}.FullRelease|Win32.ActiveCfg = FullRelease|Win32 {54197DFF-9CAA-4A9F-B9C2-2881EA04EACB}.FullRelease|x64.ActiveCfg = FullRelease|Win32 {54197DFF-9CAA-4A9F-B9C2-2881EA04EACB}.Release|Win32.ActiveCfg = Release|Win32 {54197DFF-9CAA-4A9F-B9C2-2881EA04EACB}.Release|x64.ActiveCfg = Release|Win32 + {54197DFF-9CAA-4A9F-B9C2-2881EA04EACB}.Test|Win32.ActiveCfg = Test|Win32 + {54197DFF-9CAA-4A9F-B9C2-2881EA04EACB}.Test|x64.ActiveCfg = Test|Win32 {765B0AF0-B8D3-4998-89AF-D6F939E1CD18}.Debug|Win32.ActiveCfg = Debug|Win32 {765B0AF0-B8D3-4998-89AF-D6F939E1CD18}.Debug|x64.ActiveCfg = Debug|Win32 {765B0AF0-B8D3-4998-89AF-D6F939E1CD18}.FullRelease|Win32.ActiveCfg = FullRelease|Win32 {765B0AF0-B8D3-4998-89AF-D6F939E1CD18}.FullRelease|x64.ActiveCfg = FullRelease|Win32 {765B0AF0-B8D3-4998-89AF-D6F939E1CD18}.Release|Win32.ActiveCfg = Release|Win32 {765B0AF0-B8D3-4998-89AF-D6F939E1CD18}.Release|x64.ActiveCfg = Release|Win32 + {765B0AF0-B8D3-4998-89AF-D6F939E1CD18}.Test|Win32.ActiveCfg = Test|Win32 + {765B0AF0-B8D3-4998-89AF-D6F939E1CD18}.Test|x64.ActiveCfg = Test|Win32 {AF3DBBDE-E006-4DC3-9A26-CB0D7D82AE3C}.Debug|Win32.ActiveCfg = Debug|Win32 {AF3DBBDE-E006-4DC3-9A26-CB0D7D82AE3C}.Debug|x64.ActiveCfg = Debug|Win32 {AF3DBBDE-E006-4DC3-9A26-CB0D7D82AE3C}.FullRelease|Win32.ActiveCfg = FullRelease|Win32 {AF3DBBDE-E006-4DC3-9A26-CB0D7D82AE3C}.FullRelease|x64.ActiveCfg = FullRelease|Win32 {AF3DBBDE-E006-4DC3-9A26-CB0D7D82AE3C}.Release|Win32.ActiveCfg = Release|Win32 {AF3DBBDE-E006-4DC3-9A26-CB0D7D82AE3C}.Release|x64.ActiveCfg = Release|Win32 + {AF3DBBDE-E006-4DC3-9A26-CB0D7D82AE3C}.Test|Win32.ActiveCfg = Test|Win32 + {AF3DBBDE-E006-4DC3-9A26-CB0D7D82AE3C}.Test|x64.ActiveCfg = Test|Win32 {DAF2EB1A-546A-41B3-9755-187562C01E3C}.Debug|Win32.ActiveCfg = Debug|Win32 {DAF2EB1A-546A-41B3-9755-187562C01E3C}.Debug|x64.ActiveCfg = Debug|Win32 {DAF2EB1A-546A-41B3-9755-187562C01E3C}.FullRelease|Win32.ActiveCfg = FullRelease|Win32 {DAF2EB1A-546A-41B3-9755-187562C01E3C}.FullRelease|x64.ActiveCfg = FullRelease|Win32 {DAF2EB1A-546A-41B3-9755-187562C01E3C}.Release|Win32.ActiveCfg = Release|Win32 {DAF2EB1A-546A-41B3-9755-187562C01E3C}.Release|x64.ActiveCfg = Release|Win32 + {DAF2EB1A-546A-41B3-9755-187562C01E3C}.Test|Win32.ActiveCfg = Test|Win32 + {DAF2EB1A-546A-41B3-9755-187562C01E3C}.Test|x64.ActiveCfg = Test|Win32 {C85288FB-A035-42CA-B5FB-8E6214319E97}.Debug|Win32.ActiveCfg = Debug|Win32 {C85288FB-A035-42CA-B5FB-8E6214319E97}.Debug|x64.ActiveCfg = Debug|Win32 {C85288FB-A035-42CA-B5FB-8E6214319E97}.FullRelease|Win32.ActiveCfg = FullRelease|Win32 {C85288FB-A035-42CA-B5FB-8E6214319E97}.FullRelease|x64.ActiveCfg = FullRelease|Win32 {C85288FB-A035-42CA-B5FB-8E6214319E97}.Release|Win32.ActiveCfg = Release|Win32 {C85288FB-A035-42CA-B5FB-8E6214319E97}.Release|x64.ActiveCfg = Release|Win32 + {C85288FB-A035-42CA-B5FB-8E6214319E97}.Test|Win32.ActiveCfg = Test|Win32 + {C85288FB-A035-42CA-B5FB-8E6214319E97}.Test|x64.ActiveCfg = Test|Win32 {960E83B5-9118-4EBD-AF50-18EFC1DC764B}.Debug|Win32.ActiveCfg = Debug|Win32 {960E83B5-9118-4EBD-AF50-18EFC1DC764B}.Debug|x64.ActiveCfg = Debug|Win32 {960E83B5-9118-4EBD-AF50-18EFC1DC764B}.FullRelease|Win32.ActiveCfg = FullRelease|Win32 {960E83B5-9118-4EBD-AF50-18EFC1DC764B}.FullRelease|x64.ActiveCfg = FullRelease|Win32 {960E83B5-9118-4EBD-AF50-18EFC1DC764B}.Release|Win32.ActiveCfg = Release|Win32 {960E83B5-9118-4EBD-AF50-18EFC1DC764B}.Release|x64.ActiveCfg = Release|Win32 + {960E83B5-9118-4EBD-AF50-18EFC1DC764B}.Test|Win32.ActiveCfg = Test|Win32 + {960E83B5-9118-4EBD-AF50-18EFC1DC764B}.Test|x64.ActiveCfg = Test|Win32 {79BDABE6-5308-4D64-8884-A5A35909D8D3}.Debug|Win32.ActiveCfg = Debug|Win32 {79BDABE6-5308-4D64-8884-A5A35909D8D3}.Debug|x64.ActiveCfg = Debug|Win32 {79BDABE6-5308-4D64-8884-A5A35909D8D3}.FullRelease|Win32.ActiveCfg = FullRelease|Win32 {79BDABE6-5308-4D64-8884-A5A35909D8D3}.FullRelease|x64.ActiveCfg = FullRelease|Win32 {79BDABE6-5308-4D64-8884-A5A35909D8D3}.Release|Win32.ActiveCfg = Release|Win32 {79BDABE6-5308-4D64-8884-A5A35909D8D3}.Release|x64.ActiveCfg = Release|Win32 + {79BDABE6-5308-4D64-8884-A5A35909D8D3}.Test|Win32.ActiveCfg = Test|Win32 + {79BDABE6-5308-4D64-8884-A5A35909D8D3}.Test|x64.ActiveCfg = Test|Win32 {E9F73E11-A463-45C6-A733-2BED75852BA1}.Debug|Win32.ActiveCfg = Debug|Win32 {E9F73E11-A463-45C6-A733-2BED75852BA1}.Debug|x64.ActiveCfg = Debug|Win32 {E9F73E11-A463-45C6-A733-2BED75852BA1}.FullRelease|Win32.ActiveCfg = FullRelease|Win32 {E9F73E11-A463-45C6-A733-2BED75852BA1}.FullRelease|x64.ActiveCfg = FullRelease|Win32 {E9F73E11-A463-45C6-A733-2BED75852BA1}.Release|Win32.ActiveCfg = Release|Win32 {E9F73E11-A463-45C6-A733-2BED75852BA1}.Release|x64.ActiveCfg = Release|Win32 + {E9F73E11-A463-45C6-A733-2BED75852BA1}.Test|Win32.ActiveCfg = Test|Win32 + {E9F73E11-A463-45C6-A733-2BED75852BA1}.Test|x64.ActiveCfg = Test|Win32 {38FAC3FB-A2B7-453F-8A6A-73B97201BB04}.Debug|Win32.ActiveCfg = Debug|Win32 {38FAC3FB-A2B7-453F-8A6A-73B97201BB04}.Debug|x64.ActiveCfg = Debug|Win32 {38FAC3FB-A2B7-453F-8A6A-73B97201BB04}.FullRelease|Win32.ActiveCfg = Release|Win32 {38FAC3FB-A2B7-453F-8A6A-73B97201BB04}.FullRelease|x64.ActiveCfg = Release|Win32 {38FAC3FB-A2B7-453F-8A6A-73B97201BB04}.Release|Win32.ActiveCfg = Release|Win32 {38FAC3FB-A2B7-453F-8A6A-73B97201BB04}.Release|x64.ActiveCfg = Release|Win32 + {38FAC3FB-A2B7-453F-8A6A-73B97201BB04}.Test|Win32.ActiveCfg = Test|Win32 + {38FAC3FB-A2B7-453F-8A6A-73B97201BB04}.Test|x64.ActiveCfg = Test|Win32 {6181E50C-5F32-42DC-BEF6-827AA8A5429D}.Debug|Win32.ActiveCfg = Debug|Win32 {6181E50C-5F32-42DC-BEF6-827AA8A5429D}.Debug|x64.ActiveCfg = Debug|Win32 {6181E50C-5F32-42DC-BEF6-827AA8A5429D}.FullRelease|Win32.ActiveCfg = Release|Win32 {6181E50C-5F32-42DC-BEF6-827AA8A5429D}.FullRelease|x64.ActiveCfg = Release|Win32 {6181E50C-5F32-42DC-BEF6-827AA8A5429D}.Release|Win32.ActiveCfg = Release|Win32 {6181E50C-5F32-42DC-BEF6-827AA8A5429D}.Release|x64.ActiveCfg = Release|Win32 + {6181E50C-5F32-42DC-BEF6-827AA8A5429D}.Test|Win32.ActiveCfg = Test|Win32 + {6181E50C-5F32-42DC-BEF6-827AA8A5429D}.Test|x64.ActiveCfg = Test|Win32 {2C44DD04-F5D6-4CC3-B0D6-1F4E51A0D962}.Debug|Win32.ActiveCfg = Debug|Win32 {2C44DD04-F5D6-4CC3-B0D6-1F4E51A0D962}.Debug|x64.ActiveCfg = Debug|Win32 {2C44DD04-F5D6-4CC3-B0D6-1F4E51A0D962}.FullRelease|Win32.ActiveCfg = Release|Win32 {2C44DD04-F5D6-4CC3-B0D6-1F4E51A0D962}.FullRelease|x64.ActiveCfg = Release|Win32 {2C44DD04-F5D6-4CC3-B0D6-1F4E51A0D962}.Release|Win32.ActiveCfg = Release|Win32 {2C44DD04-F5D6-4CC3-B0D6-1F4E51A0D962}.Release|x64.ActiveCfg = Release|x64 + {2C44DD04-F5D6-4CC3-B0D6-1F4E51A0D962}.Test|Win32.ActiveCfg = Test|Win32 + {2C44DD04-F5D6-4CC3-B0D6-1F4E51A0D962}.Test|x64.ActiveCfg = Test|x64 {8627DA33-98D1-4F60-B404-ECCEE0EE7BF9}.Debug|Win32.ActiveCfg = Debug|Win32 {8627DA33-98D1-4F60-B404-ECCEE0EE7BF9}.Debug|x64.ActiveCfg = Debug|Win32 {8627DA33-98D1-4F60-B404-ECCEE0EE7BF9}.FullRelease|Win32.ActiveCfg = Release|Win32 {8627DA33-98D1-4F60-B404-ECCEE0EE7BF9}.FullRelease|x64.ActiveCfg = Release|Win32 {8627DA33-98D1-4F60-B404-ECCEE0EE7BF9}.Release|Win32.ActiveCfg = Release|Win32 {8627DA33-98D1-4F60-B404-ECCEE0EE7BF9}.Release|x64.ActiveCfg = Release|x64 + {8627DA33-98D1-4F60-B404-ECCEE0EE7BF9}.Test|Win32.ActiveCfg = Test|Win32 + {8627DA33-98D1-4F60-B404-ECCEE0EE7BF9}.Test|x64.ActiveCfg = Test|x64 {98BA115B-829F-4085-9729-ABD0D779A60A}.Debug|Win32.ActiveCfg = Debug|Win32 {98BA115B-829F-4085-9729-ABD0D779A60A}.Debug|x64.ActiveCfg = Debug|Win32 {98BA115B-829F-4085-9729-ABD0D779A60A}.FullRelease|Win32.ActiveCfg = Release|Win32 {98BA115B-829F-4085-9729-ABD0D779A60A}.FullRelease|x64.ActiveCfg = Release|Win32 {98BA115B-829F-4085-9729-ABD0D779A60A}.Release|Win32.ActiveCfg = Release|Win32 {98BA115B-829F-4085-9729-ABD0D779A60A}.Release|x64.ActiveCfg = Release|x64 + {98BA115B-829F-4085-9729-ABD0D779A60A}.Test|Win32.ActiveCfg = Test|Win32 + {98BA115B-829F-4085-9729-ABD0D779A60A}.Test|x64.ActiveCfg = Test|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/od-win32/winuae_msvc11/winuae_msvc.vcxproj b/od-win32/winuae_msvc11/winuae_msvc.vcxproj index d4da9005..c831dd70 100644 --- a/od-win32/winuae_msvc11/winuae_msvc.vcxproj +++ b/od-win32/winuae_msvc11/winuae_msvc.vcxproj @@ -25,6 +25,14 @@ Release x64 + + Test + Win32 + + + Test + x64 + winuae @@ -45,6 +53,12 @@ Unicode v110_xp + + Application + false + Unicode + v110_xp + Application false @@ -64,6 +78,12 @@ Unicode v110 + + Application + false + Unicode + v110 + Application false @@ -79,6 +99,9 @@ + + + @@ -88,6 +111,9 @@ + + + @@ -103,12 +129,19 @@ true true d:\amiga\ + d:\amiga\ $(Configuration)\ + $(Configuration)\ false + false d:\amiga\ + d:\amiga\ $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ false + false true + true d:\amiga\ $(Configuration)\ false @@ -119,21 +152,27 @@ true winuae64 winuae64 + winuae64 winuae64 C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;C:\dev\include;$(IncludePath) + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;C:\dev\include;$(IncludePath) C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x86;C:\dev\lib;C:\dev\WinDDK\7600.16385.1\lib\win7\i386;$(LibraryPath) + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x86;C:\dev\lib;C:\dev\WinDDK\7600.16385.1\lib\win7\i386;$(LibraryPath) C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x86;C:\dev\lib;C:\dev\WinDDK\7600.16385.1\lib\win7\i386;$(LibraryPath) C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;C:\dev\include;$(IncludePath) C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;C:\dev\include;$(IncludePath) $(ReferencePath) C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x86;C:\dev\lib;$(LibraryPath) true + true true true C:\dev\include;C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;$(IncludePath) C:\dev\lib\x64;C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x64;$(LibraryPath) C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;C:\dev\include;$(IncludePath) + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;C:\dev\include;$(IncludePath) C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x64;C:\dev\lib\x64;$(LibraryPath) + C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x64;C:\dev\lib\x64;$(LibraryPath) C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;C:\dev\include;$(IncludePath) C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x64;C:\dev\lib\x64;$(LibraryPath) @@ -343,6 +382,84 @@ /validate_manifest %(AdditionalOptions) + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Release/winuae_msvc.tlb + + + Disabled + Disabled + true + Neither + false + false + ..\..\include;..\..;..\;..\resources;..\osdep;..\sounddep;..\..\prowizard\include;%(AdditionalIncludeDirectories) + WINVER=0x0500;NDEBUG;_WIN32_IE=0x0700;WIN32;%(PreprocessorDefinitions) + true + Sync + Default + MultiThreaded + false + true + NotSet + Precise + false + false + + + .\Test/winuae_msvc.pch + .\Test/ + .\Test/ + .\Test/ + Level3 + true + StdCall + Default + 4996;%(DisableSpecificWarnings) + %(ForcedIncludeFiles) + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + ws2_32.lib;ddraw.lib;dxguid.lib;winmm.lib;comctl32.lib;version.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;winio.lib;setupapi.lib;wininet.lib;dxerr.lib;shlwapi.lib;libpng15.lib;lglcd.lib;wpcap.lib;packet.lib;openal32.lib;wintab32.lib;portaudio_x86.lib;vfw32.lib;wtsapi32.lib;enet.lib;lzmalib.lib;prowizard.lib;libFLAC_static.lib;Avrt.lib;hid.lib;zlibstat.lib;%(AdditionalDependencies) + $(OutDir)$(TargetName)$(TargetExt) + true + %(AdditionalLibraryDirectories);$(SolutionDir)\..\lib\ + %(AdditionalManifestDependencies) + %(IgnoreSpecificDefaultLibraries) + wpcap.dll;packet.dll;d3dx9_43.dll;openal32.dll;wintab32.dll;portaudio_x86.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;wininet.dll;avrt.dll;ddraw.dll;%(DelayLoadDLLs) + true + .\Test/winuae.pdb + Windows + 2621440 + 2621440 + true + true + true + + + true + false + true + MachineX86 + 5.01 + + + + + ../resources/winuae.exe.manifest + true + $(IntDir)$(TargetName)$(TargetExt).embed.manifest + /validate_manifest %(AdditionalOptions) + + NDEBUG;%(PreprocessorDefinitions) @@ -414,6 +531,77 @@ true + + + NDEBUG;%(PreprocessorDefinitions) + true + true + X64 + .\Release/winuae_msvc.tlb + + + Full + OnlyExplicitInline + true + Speed + true + false + ..\..\include;..\..;..\;..\resources;..\osdep;..\sounddep;%(AdditionalIncludeDirectories) + WINVER=0x0500;NDEBUG;_WIN32_IE=0x0700;WIN32;WIN64;%(PreprocessorDefinitions) + true + Sync + Default + MultiThreadedDLL + false + true + NotSet + Precise + false + false + NotUsing + $(Platform)\$(Configuration)/winuae_msvc.pch + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + Level3 + true + StdCall + Default + 4996;%(DisableSpecificWarnings) + %(ForcedIncludeFiles) + true + + + NDEBUG;%(PreprocessorDefinitions) + 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;%(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.lib;%(DelayLoadDLLs) + true + $(Platform)\$(Configuration)\winuae.pdb + Windows + 0 + 0 + true + true + + + true + false + true + MachineX64 + + + ..\resources\winuae64.exe.manifest + true + + NDEBUG;%(PreprocessorDefinitions) @@ -773,7 +961,9 @@ \projects\winuae\src\od-win32\resources \projects\winuae\src\od-win32\resources \projects\winuae\src\od-win32\resources + \projects\winuae\src\od-win32\resources \projects\winuae\src\od-win32\resources + \projects\winuae\src\od-win32\resources @@ -781,36 +971,42 @@ true true true + true Document true true true + true Document true true true + true Document true true true + true Document true true true + true Document true true true + true Document diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index 5e3c84f2..6ee4bbf2 100644 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,6 +1,29 @@ - restore only single input target to default. +MMU emulation is now considered mostly done. Some minor bugs probably still exist but Amix, NetBSD, Debian +Linux, Enforcer and WHDLoad MMU option seem to work fine. + +Beta 6: + +- SCSI and IDE emulation HD and CD read and write commands are now executed in background thread, slow devices + (for example real optical drive) won't temporarily pause the emulation anymore. +- ATAPI CD emulation didn't support split data transfers. Fixes NetBSD installer unpack error. +- Show also error code converted to string if HD to HDF image creation fails. +- Added mostly useless CD list to CD drive GUI. (Someday there will be more than 1 option) +- Do not allow multiple identical HD/CD controllers (if not UAE). +- Increased size of ATAPI data buffer and added size checks. 65536 was too low. (Debian installer) +- SCSI emulation didn't handle WD33C93 Select-and-Transfer command scatter/gather DMA. (Debian installer) +- CD led didn't flicker during SCSI and ATAPI CD access. +- Fixed D3D shader error/warning string buffer overflow crash. Some shaders can output really long warning messages. +- D3D internal texture size was incorrect in some situations, causing some shaders to have incorrect geometry. +- Added support for "post" shader filters. Post = apply shader to final output (after scaling, D3D scanlines + and RGB masks), Pre = apply shader to internal Amiga display (same as in previous versions). +- D3D shaders can be "stacked", max 4 pre and post shaders supported. (-4 to -1 = pre, 1 to 4 = post), + Output of previous shader is input to next shader. Can be useful if you want to have "normal" filter and CRT + geometry filter active at the same time. Also stacking same filter multiple times makes interesting results :) + D3D only, software filters not supported. + Beta 5: - RDB hardfile dragndrop to hardfiles panel added empty hardfile. diff --git a/scsi.cpp b/scsi.cpp index 9045ede0..473e09ab 100644 --- a/scsi.cpp +++ b/scsi.cpp @@ -15,8 +15,8 @@ #include "filesys.h" #include "blkdev.h" -static int outcmd[] = { 0x0a, 0x2a, 0x2f, 0xaa, -1 }; -static int incmd[] = { 0x03, 0x08, 0x12, 0x1a, 0x25, 0x28, 0x37, 0x42, 0x43, 0xa8, 0x51, 0x52, -1 }; +static int outcmd[] = { 0x0a, 0x2a, 0x2f, 0xaa, 0x15, 0x55, -1 }; +static int incmd[] = { 0x03, 0x08, 0x12, 0x1a, 0x5a, 0x25, 0x28, 0x37, 0x42, 0x43, 0xa8, 0x51, 0x52, -1 }; static int nonecmd[] = { 0x00, 0x1b, 0x1e, 0x35, -1 }; static int scsicmdsizes[] = { 6, 10, 10, 12, 16, 12, 10, 10 };