From 45204a1508b07c52686caf66e2bae6c576895050 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Mon, 5 Mar 2012 16:59:26 +0200 Subject: [PATCH] 2400b20 --- akiko.cpp | 22 +- cfgfile.cpp | 2 + cia.cpp | 16 +- custom.cpp | 14 +- drawing.cpp | 12 +- expansion.cpp | 99 ++--- gayle.cpp | 11 - include/memory.h | 2 + include/options.h | 1 - main.cpp | 14 +- memory.cpp | 44 ++- od-win32/direct3d.cpp | 126 +++++-- od-win32/dxwrap.cpp | 11 +- od-win32/dxwrap.h | 2 - od-win32/keyboard_win32.cpp | 7 + od-win32/win32.h | 4 +- od-win32/win32_scaler.cpp | 412 ++++++++++++++++++++- od-win32/win32gfx.cpp | 11 +- od-win32/winuae_msvc10/winuae_msvc.vcxproj | 1 + od-win32/winuaechangelog.txt | 13 + 20 files changed, 672 insertions(+), 152 deletions(-) diff --git a/akiko.cpp b/akiko.cpp index 0ba5d430..b75328cd 100644 --- a/akiko.cpp +++ b/akiko.cpp @@ -772,11 +772,14 @@ static void sys_cddev_close (void) static int command_lengths[] = { 1,2,1,1,12,2,1,1,4,1,-1,-1,-1,-1,-1,-1 }; -static void cdrom_start_return_data (int len) +static int cdrom_start_return_data (int len) { - if (len <= 0 || cdrom_receive_started > 0) - return; + if (cdrom_receive_started > 0) + return 0; + if (len <= 0) + return -1; cdrom_receive_started = len; + return 1; } static void cdrom_return_data (void) @@ -831,7 +834,6 @@ static int cdrom_command_idle_status (void) { cdrom_result_buffer[0] = 0x0a; cdrom_result_buffer[1] = 0x70; - write_log (L"X"); return 2; } @@ -1186,11 +1188,13 @@ static void akiko_handler (void) return; if (mediachanged) { - mediachanged = 0; - cdrom_start_return_data (cdrom_command_media_status ()); - get_cdrom_toc (); - /* do not remove! first try may fail */ - get_cdrom_toc (); + if (cdrom_start_return_data (0) < 0) { + cdrom_start_return_data (cdrom_command_media_status ()); + mediachanged = 0; + get_cdrom_toc (); + /* do not remove! first try may fail */ + get_cdrom_toc (); + } return; } if (cdrom_audiotimeout > 1) diff --git a/cfgfile.cpp b/cfgfile.cpp index 128986e9..ed6083f4 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -4837,6 +4837,7 @@ int built_in_chipset_prefs (struct uae_prefs *p) p->cs_fatgaryrev = 0; p->cs_ramseyrev = 0x0d; p->cs_mbdmac = 1; + p->cs_ksmirror_e0 = 0; p->cs_ciaatod = p->ntscmode ? 2 : 1; break; case CP_A3000T: // A3000T @@ -4844,6 +4845,7 @@ int built_in_chipset_prefs (struct uae_prefs *p) p->cs_fatgaryrev = 0; p->cs_ramseyrev = 0x0d; p->cs_mbdmac = 1; + p->cs_ksmirror_e0 = 0; p->cs_ciaatod = p->ntscmode ? 2 : 1; break; case CP_A4000: // A4000 diff --git a/cia.cpp b/cia.cpp index c3591ffc..51f2971a 100644 --- a/cia.cpp +++ b/cia.cpp @@ -1387,12 +1387,12 @@ addrbank cia_bank = { cia_lgeti, cia_wgeti, ABFLAG_IO }; -// Gayle does not enable CIA /CS lines if both CIAs are selected -// Non-Gayle based Amigas enable both CIAs in this situation +// Gayle or Fat Gary does not enable CIA /CS lines if both CIAs are selected +// Old Gary based Amigas enable both CIAs in this situation -STATIC_INLINE int isgayle (void) +STATIC_INLINE int issinglecia (void) { - return (currprefs.cs_ide == IDE_A600A1200 || currprefs.cs_pcmcia); + return currprefs.cs_ide || currprefs.cs_pcmcia || currprefs.cs_mbdmac; } static void cia_wait_pre (void) @@ -1448,7 +1448,7 @@ static uae_u32 REGPARAM2 cia_bget (uaecptr addr) v = 0xff; switch ((addr >> 12) & 3) { case 0: - if (!isgayle ()) + if (!issinglecia ()) v = (addr & 1) ? ReadCIAA (r) : ReadCIAB (r); break; case 1: @@ -1484,7 +1484,7 @@ static uae_u32 REGPARAM2 cia_wget (uaecptr addr) switch ((addr >> 12) & 3) { case 0: - if (!isgayle ()) + if (!issinglecia ()) v = (ReadCIAB (r) << 8) | ReadCIAA (r); break; case 1: @@ -1535,7 +1535,7 @@ static void REGPARAM2 cia_bput (uaecptr addr, uae_u32 value) special_mem |= S_WRITE; #endif cia_wait_pre (); - if (!isgayle () || (addr & 0x3000) != 0) { + if (!issinglecia () || (addr & 0x3000) != 0) { if ((addr & 0x2000) == 0) WriteCIAB (r, value); if ((addr & 0x1000) == 0) @@ -1556,7 +1556,7 @@ static void REGPARAM2 cia_wput (uaecptr addr, uae_u32 value) special_mem |= S_WRITE; #endif cia_wait_pre (); - if (!isgayle () || (addr & 0x3000) != 0) { + if (!issinglecia () || (addr & 0x3000) != 0) { if ((addr & 0x2000) == 0) WriteCIAB (r, value >> 8); if ((addr & 0x1000) == 0) diff --git a/custom.cpp b/custom.cpp index 2a24910e..f45fa27b 100644 --- a/custom.cpp +++ b/custom.cpp @@ -2791,12 +2791,12 @@ static void checklacecount (bool lace) if (nlace_cnt >= NLACE_CNT_NEEDED && lace) { lof_togglecnt_lace = LOF_TOGGLES_NEEDED; lof_togglecnt_nlace = 0; - write_log (L"immediate lace\n"); + //write_log (L"immediate lace\n"); nlace_cnt = 0; } else if (nlace_cnt <= -NLACE_CNT_NEEDED && !lace) { lof_togglecnt_nlace = LOF_TOGGLES_NEEDED; lof_togglecnt_lace = 0; - write_log (L"immediate nlace\n"); + //write_log (L"immediate nlace\n"); nlace_cnt = 0; } } @@ -2967,7 +2967,7 @@ void init_hz (bool fullinit) double ovblank = vblank_hz; int hzc = 0; - if (fullinit) + if (fullinit || (vpos_count_prev && abs (vpos_count - vpos_count_prev) <= 1)) vpos_count = vpos_count_prev = 0; doublescan = 0; @@ -5423,6 +5423,9 @@ static void vsync_handler_post (void) lof_current = lof_store; if (lof_togglecnt_lace >= LOF_TOGGLES_NEEDED) { interlace_changed = notice_interlace_seen (true); + if (interlace_changed) { + notice_screen_contents_lost (); + } } else if (lof_togglecnt_nlace >= LOF_TOGGLES_NEEDED) { interlace_changed = notice_interlace_seen (false); if (interlace_changed) { @@ -5446,10 +5449,11 @@ static void vsync_handler_post (void) vpos_count = p96refresh_active; vtotal = vpos_count; } - if ((beamcon0 & (0x20 | 0x80)) != (new_beamcon0 & (0x20 | 0x80)) || (abs (vpos_count - vpos_count_prev) > 1) || lof_changed) + if ((beamcon0 & (0x20 | 0x80)) != (new_beamcon0 & (0x20 | 0x80)) || (vpos_count_prev && (abs (vpos_count - vpos_count_prev) > 1)) || lof_changed) { init_hz (); - else if (interlace_changed || changed_chipset_refresh ()) + } else if (interlace_changed || changed_chipset_refresh ()) { compute_framesync (); + } vpos_count_prev = vpos_count; diff --git a/drawing.cpp b/drawing.cpp index 9ae901fe..d3160fc4 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -2610,7 +2610,8 @@ void finish_drawing_frame (void) xlinebuffer = row_map[where2]; xlinebuffer -= linetoscr_x_adjust_bytes; fill_line (); - linestate[line] = LINE_UNDECIDED; + if (line < max_ypos_thisframe) + linestate[line] = LINE_UNDECIDED; do_flush_line (vb, where2); } @@ -2813,7 +2814,7 @@ void hsync_record_line_state (int lineno, enum nln_how how, int changed) break; case nln_lower: if (state[-1] == LINE_UNDECIDED) - state[-1] = LINE_BLACK; + state[-1] = LINE_DECIDED; //LINE_BLACK; *state = changed ? LINE_DECIDED : LINE_DONE; break; case nln_upper: @@ -2821,7 +2822,7 @@ void hsync_record_line_state (int lineno, enum nln_how how, int changed) if (state[1] == LINE_UNDECIDED || state[1] == LINE_REMEMBERED_AS_PREVIOUS || state[1] == LINE_AS_PREVIOUS) - state[1] = LINE_BLACK; + state[1] = LINE_DECIDED; //LINE_BLACK; break; } } @@ -2867,15 +2868,14 @@ bool notice_interlace_seen (bool lace) // non-lace to lace switch (non-lace active at least one frame)? if (lace) { if (interlace_seen == 0) { - frame_redraw_necessary = 2; changed = true; - write_log (L"->lace PC=%x\n", m68k_getpc ()); + //write_log (L"->lace PC=%x\n", m68k_getpc ()); } interlace_seen = currprefs.gfx_vresolution ? 1 : -1; } else { if (interlace_seen) { changed = true; - write_log (L"->non-lace PC=%x\n", m68k_getpc ()); + //write_log (L"->non-lace PC=%x\n", m68k_getpc ()); } interlace_seen = 0; } diff --git a/expansion.cpp b/expansion.cpp index ab41c0a6..2786eeb4 100644 --- a/expansion.cpp +++ b/expansion.cpp @@ -47,13 +47,13 @@ #define Z2_MEM_128KB 0x02 #define Z2_MEM_64KB 0x01 /* extended definitions */ -#define Z2_MEM_16MB 0x00 -#define Z2_MEM_32MB 0x01 -#define Z2_MEM_64MB 0x02 -#define Z2_MEM_128MB 0x03 -#define Z2_MEM_256MB 0x04 -#define Z2_MEM_512MB 0x05 -#define Z2_MEM_1GB 0x06 +#define Z3_MEM_16MB 0x00 +#define Z3_MEM_32MB 0x01 +#define Z3_MEM_64MB 0x02 +#define Z3_MEM_128MB 0x03 +#define Z3_MEM_256MB 0x04 +#define Z3_MEM_512MB 0x05 +#define Z3_MEM_1GB 0x06 #define chainedconfig 0x08 /* Next config is part of the same card */ #define rom_card 0x10 /* ROM vector is valid */ @@ -84,22 +84,22 @@ /* ********************************************************** */ /* 08 - 0A */ /* er_Flags */ -#define Z3_MEM_64KB 0x02 -#define Z3_MEM_128KB 0x03 -#define Z3_MEM_256KB 0x04 -#define Z3_MEM_512KB 0x05 -#define Z3_MEM_1MB 0x06 /* Zorro III card subsize */ -#define Z3_MEM_2MB 0x07 -#define Z3_MEM_4MB 0x08 -#define Z3_MEM_6MB 0x09 -#define Z3_MEM_8MB 0x0a -#define Z3_MEM_10MB 0x0b -#define Z3_MEM_12MB 0x0c -#define Z3_MEM_14MB 0x0d -#define Z3_MEM_16MB 0x00 -#define Z3_MEM_AUTO 0x01 -#define Z3_MEM_defunct1 0x0e -#define Z3_MEM_defunct2 0x0f +#define Z3_SS_MEM_SAME 0x00 +#define Z3_SS_MEM_AUTO 0x01 +#define Z3_SS_MEM_64KB 0x02 +#define Z3_SS_MEM_128KB 0x03 +#define Z3_SS_MEM_256KB 0x04 +#define Z3_SS_MEM_512KB 0x05 +#define Z3_SS_MEM_1MB 0x06 /* Zorro III card subsize */ +#define Z3_SS_MEM_2MB 0x07 +#define Z3_SS_MEM_4MB 0x08 +#define Z3_SS_MEM_6MB 0x09 +#define Z3_SS_MEM_8MB 0x0a +#define Z3_SS_MEM_10MB 0x0b +#define Z3_SS_MEM_12MB 0x0c +#define Z3_SS_MEM_14MB 0x0d +#define Z3_SS_MEM_defunct1 0x0e +#define Z3_SS_MEM_defunct2 0x0f #define force_z3 0x10 /* *MUST* be set if card is Z3 */ #define ext_size 0x20 /* Use extended size table for bits 0-2 of er_Type */ @@ -1086,18 +1086,26 @@ static void expamem_init_z3fastmem_2 (addrbank *bank, uae_u32 start, uae_u32 siz : allocated == 0x200000 ? Z2_MEM_2MB : allocated == 0x400000 ? Z2_MEM_4MB : allocated == 0x800000 ? Z2_MEM_8MB - : allocated == 0x1000000 ? Z2_MEM_16MB - : allocated == 0x2000000 ? Z2_MEM_32MB - : allocated == 0x4000000 ? Z2_MEM_64MB - : allocated == 0x8000000 ? Z2_MEM_128MB - : allocated == 0x10000000 ? Z2_MEM_256MB - : allocated == 0x20000000 ? Z2_MEM_512MB - : Z2_MEM_1GB); + : allocated == 0x1000000 ? Z3_MEM_16MB + : allocated == 0x2000000 ? Z3_MEM_32MB + : allocated == 0x4000000 ? Z3_MEM_64MB + : allocated == 0x8000000 ? Z3_MEM_128MB + : allocated == 0x10000000 ? Z3_MEM_256MB + : allocated == 0x20000000 ? Z3_MEM_512MB + : Z3_MEM_1GB); + int subsize = (allocated == 0x100000 ? Z3_SS_MEM_1MB + : allocated == 0x200000 ? Z3_SS_MEM_2MB + : allocated == 0x400000 ? Z3_SS_MEM_4MB + : allocated == 0x800000 ? Z3_SS_MEM_8MB + : Z3_SS_MEM_SAME); + + if (allocated < 0x1000000) + code = Z3_MEM_16MB; /* Z3 physical board size is always at least 16M */ expamem_init_clear (); expamem_write (0x00, add_memory | zorroIII | code); - expamem_write (0x08, care_addr | force_z3 | (allocated > 0x800000 ? ext_size : Z3_MEM_AUTO)); + expamem_write (0x08, care_addr | force_z3 | (allocated > 0x800000 ? ext_size : subsize)); expamem_write (0x04, currprefs.maprom ? 3 : 83); @@ -1148,23 +1156,26 @@ static void expamem_init_gfxcard (bool z3) : allocated_gfxmem == 0x200000 ? Z2_MEM_2MB : allocated_gfxmem == 0x400000 ? Z2_MEM_4MB : allocated_gfxmem == 0x800000 ? Z2_MEM_8MB - : allocated_gfxmem == 0x1000000 ? Z2_MEM_16MB - : allocated_gfxmem == 0x2000000 ? Z2_MEM_32MB - : allocated_gfxmem == 0x4000000 ? Z2_MEM_64MB - : allocated_gfxmem == 0x8000000 ? Z2_MEM_128MB - : allocated_gfxmem == 0x10000000 ? Z2_MEM_256MB - : allocated_gfxmem == 0x20000000 ? Z2_MEM_512MB - : Z2_MEM_1GB); - int subsize = (allocated_gfxmem == 0x100000 ? Z3_MEM_1MB - : allocated_gfxmem == 0x200000 ? Z3_MEM_2MB - : allocated_gfxmem == 0x400000 ? Z3_MEM_4MB - : allocated_gfxmem == 0x800000 ? Z3_MEM_8MB - : 0); + : allocated_gfxmem == 0x1000000 ? Z3_MEM_16MB + : allocated_gfxmem == 0x2000000 ? Z3_MEM_32MB + : allocated_gfxmem == 0x4000000 ? Z3_MEM_64MB + : allocated_gfxmem == 0x8000000 ? Z3_MEM_128MB + : allocated_gfxmem == 0x10000000 ? Z3_MEM_256MB + : allocated_gfxmem == 0x20000000 ? Z3_MEM_512MB + : Z3_MEM_1GB); + int subsize = (allocated_gfxmem == 0x100000 ? Z3_SS_MEM_1MB + : allocated_gfxmem == 0x200000 ? Z3_SS_MEM_2MB + : allocated_gfxmem == 0x400000 ? Z3_SS_MEM_4MB + : allocated_gfxmem == 0x800000 ? Z3_SS_MEM_8MB + : Z3_SS_MEM_SAME); + + if (allocated_gfxmem < 0x1000000 && z3) + code = Z3_MEM_16MB; /* Z3 physical board size is always at least 16M */ expamem_init_clear (); expamem_write (0x00, (z3 ? zorroIII : zorroII) | code); - expamem_write (0x08, care_addr | (z3 ? force_z3 | ext_size | subsize : 0)); + expamem_write (0x08, care_addr | (z3 ? (force_z3 | (allocated_gfxmem > 0x800000 ? ext_size: subsize)) : 0)); expamem_write (0x04, 96); expamem_write (0x10, uae_id >> 8); diff --git a/gayle.cpp b/gayle.cpp index edd9c225..ca11af81 100644 --- a/gayle.cpp +++ b/gayle.cpp @@ -2162,17 +2162,6 @@ static void REGPARAM2 gayle_common_bput (uaecptr addr, uae_u32 value) gayle_common_write (addr, value); } -static ULONG getz2endaddr (void) -{ - ULONG start; - start = currprefs.fastmem_size; - if (currprefs.rtgmem_size && !currprefs.rtgmem_type) { - while (start & (currprefs.rtgmem_size - 1) && start < 4 * 1024 * 1024) - start += 1024 * 1024; - } - return start + 2 * 1024 * 1024; -} - void gayle_map_pcmcia (void) { if (currprefs.cs_pcmcia == 0) diff --git a/include/memory.h b/include/memory.h index 7e5a0670..55f8e50d 100644 --- a/include/memory.h +++ b/include/memory.h @@ -362,3 +362,5 @@ extern void memcpyha (uaecptr dst, const uae_u8 *src, int size); extern void memcpyah_safe (uae_u8 *dst, uaecptr src, int size); extern void memcpyah (uae_u8 *dst, uaecptr src, int size); +extern uae_s32 getz2size (struct uae_prefs *p); +extern ULONG getz2endaddr (void); \ No newline at end of file diff --git a/include/options.h b/include/options.h index c747ccad..bf74f805 100644 --- a/include/options.h +++ b/include/options.h @@ -560,7 +560,6 @@ extern int cfgfile_configuration_change (int); extern void fixup_prefs_dimensions (struct uae_prefs *prefs); extern void fixup_prefs (struct uae_prefs *prefs); extern void fixup_cpu (struct uae_prefs *prefs); -extern uae_s32 getz2size (struct uae_prefs *p); extern void check_prefs_changed_custom (void); extern void check_prefs_changed_cpu (void); diff --git a/main.cpp b/main.cpp index c6bd75ee..f8774c09 100644 --- a/main.cpp +++ b/main.cpp @@ -207,19 +207,7 @@ void fixup_cpu (struct uae_prefs *p) p->immediate_blits = false; } -uae_s32 getz2size (struct uae_prefs *p) -{ - ULONG start; - start = p->fastmem_size; - if (p->rtgmem_size && !p->rtgmem_type) { - while (start & (p->rtgmem_size - 1) && start < 8 * 1024 * 1024) - start += 1024 * 1024; - if (start + p->rtgmem_size > 8 * 1024 * 1024) - return -1; - } - start += p->rtgmem_size; - return start; -} + void fixup_prefs (struct uae_prefs *p) { diff --git a/memory.cpp b/memory.cpp index 4105eb66..03717d6c 100644 --- a/memory.cpp +++ b/memory.cpp @@ -2349,10 +2349,38 @@ void map_overlay (int chip) m68k_setpc (m68k_getpc ()); } +uae_s32 getz2size (struct uae_prefs *p) +{ + ULONG start; + start = p->fastmem_size; + if (p->rtgmem_size && !p->rtgmem_type) { + while (start & (p->rtgmem_size - 1) && start < 8 * 1024 * 1024) + start += 1024 * 1024; + if (start + p->rtgmem_size > 8 * 1024 * 1024) + return -1; + } + start += p->rtgmem_size; + return start; +} + +ULONG getz2endaddr (void) +{ + ULONG start; + start = currprefs.fastmem_size; + if (currprefs.rtgmem_size && !currprefs.rtgmem_type) { + if (!start) + start = 0x00200000; + while (start & (currprefs.rtgmem_size - 1) && start < 4 * 1024 * 1024) + start += 1024 * 1024; + } + return start + 2 * 1024 * 1024; +} + + void memory_reset (void) { int bnk, bnk_end; - int gayle; + bool gayleorfatgary; be_cnt = 0; currprefs.chipmem_size = changed_prefs.chipmem_size; @@ -2369,7 +2397,7 @@ void memory_reset (void) currprefs.cs_fatgaryrev = changed_prefs.cs_fatgaryrev; currprefs.cs_ramseyrev = changed_prefs.cs_ramseyrev; - gayle = (currprefs.chipset_mask & CSMASK_AGA) || currprefs.cs_pcmcia || currprefs.cs_ide > 0; + gayleorfatgary = (currprefs.chipset_mask & CSMASK_AGA) || currprefs.cs_pcmcia || currprefs.cs_ide > 0 || currprefs.cs_mbdmac; need_hardreset = 0; /* Use changed_prefs, as m68k_reset is called later. */ @@ -2448,23 +2476,21 @@ void memory_reset (void) if (cloanto_rom && currprefs.maprom < 0x01000000) currprefs.maprom = changed_prefs.maprom = 0; - gayle = currprefs.cs_ksmirror_a8 || currprefs.cs_pcmcia || currprefs.cs_ide > 0; - map_banks (&custom_bank, 0xC0, 0xE0 - 0xC0, 0); map_banks (&cia_bank, 0xA0, 32, 0); if (!currprefs.cs_a1000ram) /* D80000 - DDFFFF not mapped (A1000 = custom chips) */ map_banks (&dummy_bank, 0xD8, 6, 0); - /* map "nothing" to 0x200000 - 0x9FFFFF (0xBEFFFF if Gayle) */ + /* map "nothing" to 0x200000 - 0x9FFFFF (0xBEFFFF if Gayle or Fat Gary) */ bnk = allocated_chipmem >> 16; if (bnk < 0x20 + (currprefs.fastmem_size >> 16)) bnk = 0x20 + (currprefs.fastmem_size >> 16); - bnk_end = gayle ? 0xBF : 0xA0; + bnk_end = gayleorfatgary ? 0xBF : 0xA0; map_banks (&dummy_bank, bnk, bnk_end - bnk, 0); - if (gayle) { - // a4000 = custom chips from 0xc0 to 0xd0 - if (currprefs.cs_ide == IDE_A4000) + if (gayleorfatgary) { + // a3000 or a4000 = custom chips from 0xc0 to 0xd0 + if (currprefs.cs_ide == IDE_A4000 || currprefs.cs_mbdmac) map_banks (&dummy_bank, 0xd0, 8, 0); else map_banks (&dummy_bank, 0xc0, 0xd8 - 0xc0, 0); diff --git a/od-win32/direct3d.cpp b/od-win32/direct3d.cpp index cc60108f..bad41817 100644 --- a/od-win32/direct3d.cpp +++ b/od-win32/direct3d.cpp @@ -40,6 +40,8 @@ extern int D3DEX, d3ddebug; static TCHAR *D3DHEAD = L"-"; static int psEnabled, psActive, psPreProcess, shaderon; +static bool showoverlay = true; + static D3DFORMAT tformat; static int d3d_enabled, d3d_ex; static IDirect3D9 *d3d; @@ -54,6 +56,7 @@ static LPDIRECT3DTEXTURE9 texture, sltexture, ledtexture, masktexture, mask2text static IDirect3DQuery9 *query; 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, lpWorkTexture2, lpTempTexture; LPDIRECT3DTEXTURE9 cursorsurfaced3d; @@ -65,7 +68,7 @@ static int devicelost; static int locked, fulllocked; static int cursor_offset_x, cursor_offset_y, cursor_offset2_x, cursor_offset2_y; static float maskmult_x, maskmult_y; -static RECT mask2rect; +RECT mask2rect; static bool wasstilldrawing_broken; static HANDLE filenotificationhandle; @@ -525,7 +528,7 @@ static const char *fx10 = { "//\n" "// WinUAE Direct3D post processing shader\n" "//\n" -"// by Toni Wilen 2010\n" +"// by Toni Wilen 2012\n" "\n" "uniform extern float4x4 mtx;\n" "uniform extern float2 maskmult;\n" @@ -631,7 +634,7 @@ static const char *fx20 = { "//\n" "// WinUAE Direct3D post processing shader\n" "//\n" -"// by Toni Wilen 2010\n" +"// by Toni Wilen 2012\n" "\n" "uniform extern float4x4 mtx;\n" "uniform extern float2 maskmult;\n" @@ -1280,6 +1283,10 @@ static int createmask2texture (const TCHAR *filename) D3DXIMAGE_INFO dinfo; TCHAR tmp[MAX_DPATH]; + if (mask2texture) + mask2texture->Release(); + mask2texture = NULL; + if (filename[0] == 0 || WIN32GFX_IsPicassoScreen ()) return 0; @@ -1394,11 +1401,37 @@ static int createmask2texture (const TCHAR *filename) mask2texture_offsetw = (window_w - mask2texture_ww) / 2; - blanktexture = createtext (mask2texture_offsetw + 1, window_h, D3DFMT_X8R8G8B8); + if (mask2texture_offsetw > 0) + blanktexture = createtext (mask2texture_offsetw + 1, window_h, D3DFMT_X8R8G8B8); + + float xmult = mask2texture_multx; + float ymult = mask2texture_multy; + + mask2rect.left *= xmult; + mask2rect.right *= xmult; + mask2rect.top *= ymult; + mask2rect.bottom *= ymult; + mask2texture_wwx = mask2texture_w * xmult; + if (mask2texture_wwx > window_w) + mask2texture_wwx = window_w; + if (mask2texture_wwx < mask2rect.right - mask2rect.left) + mask2texture_wwx = mask2rect.right - mask2rect.left; + if (mask2texture_wwx > mask2texture_ww) + mask2texture_wwx = mask2texture_ww; + + mask2texture_minusx = - ((window_w - mask2rect.right) + mask2rect.left); + if (mask2texture_offsetw > 0) + mask2texture_minusx += mask2texture_offsetw * xmult; + + + mask2texture_minusy = -(window_h - (mask2rect.bottom - mask2rect.top)); + + mask2texture_hhx = mask2texture_h * ymult; - write_log (L"%s: overlay '%s' %.0f*%.0f (%d*%d - %d*%d)\n", + write_log (L"%s: overlay '%s' %.0f*%.0f (%d*%d - %d*%d) (%d*%d)\n", D3DHEAD, tmp, mask2texture_w, mask2texture_h, - mask2rect.left, mask2rect.top, mask2rect.right, mask2rect.bottom); + mask2rect.left, mask2rect.top, mask2rect.right, mask2rect.bottom, + mask2rect.right - mask2rect.left, mask2rect.bottom - mask2rect.top); return 1; end: @@ -1511,6 +1544,29 @@ end: return 0; } +bool getscalerect (float *mx, float *my, float *sx, float *sy) +{ + if (!mask2texture) + return false; + + float mw = mask2rect.right - mask2rect.left; + float mh = mask2rect.bottom - mask2rect.top; + + float mxt = (float)mw / gfxvidinfo.outbuffer->inwidth2; + float myt = (float)mh / gfxvidinfo.outbuffer->inheight2; + + *mx = mask2texture_minusx / mxt; + *my = mask2texture_minusy / myt; + + *sx = -((mask2texture_ww - mask2rect.right) - (mask2rect.left)) / 2; + *sy = -((mask2texture_wh - mask2rect.bottom) - (mask2rect.top)) / 2; + + *sx /= mxt; + *sy /= myt; + + return true; +} + static void setupscenecoords (void) { RECT sr, dr, zr; @@ -1521,9 +1577,6 @@ static void setupscenecoords (void) //write_log (L"%dx%d %dx%d %dx%d\n", tin_w, tin_h, tin_w, tin_h, window_w, window_h); - float mw = mask2rect.right - mask2rect.left; - float mh = mask2rect.bottom - mask2rect.top; - resmult = 1 << (gfxvidinfo.gfx_resolution_reserved - currprefs.gfx_resolution); vresmult = 1 << (gfxvidinfo.gfx_vresolution_reserved - currprefs.gfx_vresolution); @@ -1549,37 +1602,47 @@ static void setupscenecoords (void) float tx, ty; float sw, sh; - if (mask2texture) { + if (0 && mask2texture) { - float winw = mw * mask2texture_multx; - float winh = mh * mask2texture_multy; - dw *= winw / window_w; - dh *= winh / window_h; - tx = -0.5f + dw * tin_w / winw / 2; - ty = +0.5f + dh * tin_h / winh / 2; + float mw = mask2rect.right - mask2rect.left; + float mh = mask2rect.bottom - mask2rect.top; - float xshift = -zr.left - sr.left; - float yshift = +zr.top + sr.top - (tin_h - h); + tx = -0.5f + dw * tin_w / mw / 2; + ty = +0.5f + dh * tin_h / mh / 2; - sw = dw * tin_w / window_w; - sh = dh * tin_h / window_h; + float xshift = -zr.left; + float yshift = -zr.top; + + sw = dw * tin_w / gfxvidinfo.outbuffer->inwidth2; + sw *= mw / window_w; + + tx = -0.5f + window_w / 2; + + sh = dh * tin_h / gfxvidinfo.outbuffer->inheight2; + sh *= mh / window_h; + + ty = +0.5f + window_h / 2; tx += xshift; ty += yshift; - } else { tx = -0.5f + dw * tin_w / window_w / 2; ty = +0.5f + dh * tin_h / window_h / 2; - tx += - zr.left - sr.left; // - (tin_w - 2 * zr.left - w), - ty += + zr.top + sr.top - (tin_h - h); + float xshift = - zr.left - sr.left; // - (tin_w - 2 * zr.left - w), + float yshift = + zr.top + sr.top - (tin_h - h); sw = dw * tin_w / window_w; sh = dh * tin_h / window_h; + + tx += xshift; + ty += yshift; + } + MatrixTranslation (&m_matView, tx, ty, 1.0f); MatrixScaling (&m_matWorld, sw, sh, 1.0f); @@ -1593,8 +1656,8 @@ static void setupscenecoords (void) float sw2 = dw * tin_w / window_w; float sh2 = dh * tin_h / window_h; - maskmult.x = sw2 * maskmult_x / w; - maskmult.y = sh2 * maskmult_y / h; + maskmult.x = 1; //sw2 * maskmult_x / w; + maskmult.y = 1; //sh2 * maskmult_y / h; maskshift.x = 1.0f / maskmult_x; maskshift.y = 1.0f / maskmult_y; @@ -2139,6 +2202,8 @@ const TCHAR *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth if (!shaderon) write_log (L"Using non-shader version\n"); + window_w = w_w; + window_h = w_h; multx = mmult; mult = S2X_getmult (); tin_w = t_w * mult; @@ -2181,8 +2246,6 @@ const TCHAR *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth tformat = D3DFMT_R5G6B5; break; } - window_w = w_w; - window_h = w_h; changed_prefs.leds_on_screen = currprefs.leds_on_screen = currprefs.leds_on_screen | STATUSLINE_TARGET; @@ -2557,10 +2620,11 @@ static void D3D_render2 (void) r.top = 0; r.right = mask2texture_w; r.bottom = mask2texture_h; - - sprite->SetTransform (&t); - sprite->Draw (mask2texture, &r, NULL, &v, 0xffffffff); - sprite->Flush (); + if (showoverlay) { + sprite->SetTransform (&t); + sprite->Draw (mask2texture, &r, NULL, &v, 0xffffffff); + sprite->Flush (); + } MatrixScaling (&t, 1, 1, 0); sprite->SetTransform (&t); diff --git a/od-win32/dxwrap.cpp b/od-win32/dxwrap.cpp index 241886d5..a212eb12 100644 --- a/od-win32/dxwrap.cpp +++ b/od-win32/dxwrap.cpp @@ -16,6 +16,8 @@ struct ddstuff dxdata; struct ddcaps dxcaps; static int flipinterval_supported = 1; int ddforceram = DDFORCED_DEFAULT; +static int statuswidth = 800; +static int statusheight = TD_TOTAL_HEIGHT; HRESULT DirectDraw_GetDisplayMode (void) { @@ -324,7 +326,7 @@ int dx_testck (void) static void createstatussurface (void) { releaser (dxdata.statussurface, IDirectDrawSurface7_Release); - dxdata.statussurface = allocsurface_2 (dxdata.statuswidth, dxdata.statusheight, FALSE); + dxdata.statussurface = allocsurface_2 (statuswidth, statusheight, FALSE); if (dxdata.statussurface) clearsurf (dxdata.statussurface, 0); } @@ -1122,6 +1124,7 @@ static BOOL CALLBACK displaysCallback (GUID *guid, char *adesc, char *aname, LPV pt.y = (md->rect.bottom - md->rect.top) / 2 + md->rect.top; winmon = MonitorFromPoint (pt, MONITOR_DEFAULTTONEAREST); if (hm == winmon) { + write_log(L"%s = %s\n", md->fullname, outGUID (guid)); memcpy (&monitorguids[i], guid, sizeof GUID); memcpy (&md->ddguid, guid, sizeof GUID); return TRUE; @@ -1136,7 +1139,9 @@ void DirectDraw_get_GUIDs (void) if (guidsenumerated) return; guidsenumerated = true; + write_log (L"DirectDraw displays:\n"); DirectDrawEnumerateExA (displaysCallback, 0, DDENUM_DETACHEDSECONDARYDEVICES | DDENUM_ATTACHEDSECONDARYDEVICES); + write_log (L"End\n"); } int DirectDraw_Start (void) @@ -1148,9 +1153,6 @@ int DirectDraw_Start (void) HINSTANCE d3dDLL; GUID *guid; - dxdata.statuswidth = 800; - dxdata.statusheight = TD_TOTAL_HEIGHT; - if (!first) { d3dDLL = LoadLibrary (L"D3D9.DLL"); if (d3dDLL) { @@ -1232,6 +1234,7 @@ int DirectDraw_Start (void) dxdata.ddzeroguid = 0; memcpy (&dxdata.ddguid, guid, sizeof (GUID)); } + write_log (L"DirectDraw Display GUID = %s\n", outGUID (guid)); return 1; } oops: diff --git a/od-win32/dxwrap.h b/od-win32/dxwrap.h index 6f332b3e..5b977cfa 100644 --- a/od-win32/dxwrap.h +++ b/od-win32/dxwrap.h @@ -33,8 +33,6 @@ struct ddstuff int islost, isoverlay; LPDIRECTDRAWSURFACE7 statussurface; - int statuswidth, statusheight; - }; struct ddcaps { diff --git a/od-win32/keyboard_win32.cpp b/od-win32/keyboard_win32.cpp index 8d08b0f6..7a906e3a 100644 --- a/od-win32/keyboard_win32.cpp +++ b/od-win32/keyboard_win32.cpp @@ -399,6 +399,13 @@ void my_kbd_handler (int keyboard, int scancode, int newstate) return; } #endif +#if 0 + if (scancode == DIK_F10) { + extern bool showoverlay; + showoverlay = !showoverlay; + return; + } +#endif if (amode && scancode == DIK_F11 && currprefs.win32_ctrl_F11_is_quit && ctrlpressed ()) code = AKS_QUIT; diff --git a/od-win32/win32.h b/od-win32/win32.h index bd8866be..79349436 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -19,8 +19,8 @@ #define LANG_DLL 1 //#define WINUAEBETA L"" -#define WINUAEBETA L"Beta 19" -#define WINUAEDATE MAKEBD(2012, 2, 25) +#define WINUAEBETA L"Beta 20" +#define WINUAEDATE MAKEBD(2012, 3, 4) #define WINUAEEXTRA L"" //#define WINUAEEXTRA L"AmiKit Preview" #define WINUAEREV L"" diff --git a/od-win32/win32_scaler.cpp b/od-win32/win32_scaler.cpp index 133c31b0..c7c443c7 100644 --- a/od-win32/win32_scaler.cpp +++ b/od-win32/win32_scaler.cpp @@ -197,6 +197,7 @@ static void getmanualpos (int *cxp, int *cyp, int *cwp, int *chp) *chp = ch; } +#if 0 void getfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height, int aw, int ah, int scale, int temp_width, int temp_height) { @@ -206,8 +207,6 @@ void getfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height int v; int extraw, extrah; int fpuv; - bool specialmode = !isnativevidbuf (); - int filter_horiz_zoom = currprefs.gfx_filter_horiz_zoom; int filter_vert_zoom = currprefs.gfx_filter_vert_zoom; @@ -244,6 +243,406 @@ void getfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height dr->left = (temp_width - aws) / 2; dr->top = (temp_height - ahs) / 2; + filteroffsetx = 0; + filteroffsety = 0; + float xmult = filter_horiz_zoom_mult; + float ymult = filter_vert_zoom_mult; + + dr->left -= (dst_width - aws) / 2; + dr->top -= (dst_height - ahs) / 2; + dr->right = dr->left + dst_width; + dr->bottom = dr->top + dst_height; + + srcratio = 4.0 / 3.0; + if (currprefs.gfx_filter_aspect > 0) { + dstratio = (currprefs.gfx_filter_aspect >> 8) * 1.0 / (currprefs.gfx_filter_aspect & 0xff); + } else if (currprefs.gfx_filter_aspect < 0) { + if (isfullscreen () && deskw > 0 && deskh > 0) + dstratio = 1.0 * deskw / deskh; + else + dstratio = 1.0 * dst_width / dst_height; + } else { + dstratio = srcratio; + } + + int scalemode = currprefs.gfx_filter_autoscale; + + if (scalemode == AUTOSCALE_STATIC_AUTO) { + if (0) { + scalemode = AUTOSCALE_STATIC_NOMINAL; + } else { + int w1 = (800 / 2) << currprefs.gfx_resolution; + int w2 = (640 / 2) << currprefs.gfx_resolution; + int h1 = (600 / 2) << currprefs.gfx_vresolution; + int h2 = (400 / 2) << currprefs.gfx_vresolution; + int w = currprefs.gfx_size_win.width; + int h = currprefs.gfx_size_win.height; + if (w <= w1 && h <= h1 && w >= w2 && h >= h2) + scalemode = AUTOSCALE_NONE; + else + scalemode = AUTOSCALE_STATIC_NOMINAL; + } + } + + if (scalemode) { + int cw, ch, cx, cy, cv; + static int oxmult, oymult; + + filterxmult = 1000 / scale; + filterymult = 1000 / scale; + + if (scalemode == AUTOSCALE_STATIC_MAX || scalemode == AUTOSCALE_STATIC_NOMINAL || scalemode == AUTOSCALE_INTEGER) { + cw = AMIGA_WIDTH_MAX << currprefs.gfx_resolution; + ch = AMIGA_HEIGHT_MAX << currprefs.gfx_vresolution; + cx = 0; + cy = 0; + cv = 1; + if (scalemode == AUTOSCALE_STATIC_NOMINAL || scalemode == AUTOSCALE_INTEGER) { + cw -= 40 << currprefs.gfx_resolution; + ch -= 25 << currprefs.gfx_vresolution; + cx = 28 << currprefs.gfx_resolution; + cy = 10 << currprefs.gfx_vresolution; + } + + if (scalemode == AUTOSCALE_INTEGER) { + int maxw = currprefs.gfx_size.width; + int maxh = currprefs.gfx_size.height; + int mult = 1; + + if (currprefs.gfx_xcenter_pos > 0 || currprefs.gfx_xcenter_size > 0) + getmanualpos (&cx, &cy, &cw, &ch); + + if (cw > maxw || ch > maxh) { + while (cw / mult > maxw || ch / mult > maxh) + mult *= 2; + maxw = maxw * mult; + maxh = maxh * mult; + } else { + while (cw * (mult * 2) <= maxw && ch * (mult * 2) <= maxh) + mult *= 2; + maxw = (maxw + mult - 1) / mult; + maxh = (maxh + mult - 1) / mult; + } + //write_log(L"(%dx%d) (%dx%d) ww=%d hh=%d w=%d h=%d m=%d\n", cx, cy, cw, ch, currprefs.gfx_size.width, currprefs.gfx_size.height, maxw, maxh, mult); + cx -= (maxw - cw) / 2; + cw = maxw; + cy -= (maxh - ch) / 2; + ch = maxh; + } + + } else if (scalemode == AUTOSCALE_MANUAL) { + + changed_prefs.gfx_filter_horiz_offset = currprefs.gfx_filter_horiz_offset = 0; + changed_prefs.gfx_filter_vert_offset = currprefs.gfx_filter_vert_offset = 0; + filter_horiz_offset = 0; + filter_vert_offset = 0; + + get_custom_topedge (&cx, &cy); + //write_log (L"%dx%d %dx%d\n", cx, cy, currprefs.gfx_resolution, currprefs.gfx_vresolution); + + getmanualpos (&cx, &cy, &cw, &ch); + + //write_log (L"%dx%d %dx%d %dx%d\n", currprefs.gfx_xcenter_pos, currprefs.gfx_ycenter_pos, cx, cy, cw, ch); + + cv = 1; + + } else { + + cv = get_custom_limits (&cw, &ch, &cx, &cy); + + } + + if (currprefs.gfx_api == 0) { + if (cx < 0) + cx = 0; + if (cy < 0) + cy = 0; + } + + if (cv) { + int diff; + + if (scalemode == AUTOSCALE_CENTER) { + + int ww = cw * scale; + int hh = ch * scale; + SetRect (sr, 0, 0, dst_width, dst_height); + SetRect (zr, 0, 0, 0, 0); + dr->left = dr->top = 0; + dr->right = dr->left + dst_width; + dr->bottom = dr->top + dst_height; + OffsetRect (zr, cx * scale - (dst_width - ww) / 2, cy * scale - (dst_height - hh) / 2); + goto cont; + + } else if (scalemode == AUTOSCALE_RESIZE && isfullscreen () == 0 && !currprefs.gfx_filteroverlay[0]) { + + static int lastresize = 0; + static int lastdelay = 1; + static int ocw, och, ocx, ocy, lcw, lch, lcx, lcy; + int useold = 0; + + lastresize--; + if (lastresize > 0) { + if (cw != lcw || ch != lch || cx != lcx || cy != lcy) + lastresize = 10; + useold = 1; + } else if (lastdelay == 0) { + lastdelay = 2; + useold = 1; + } else if (lastdelay > 0) { + lastdelay--; + useold = 1; + if (lastdelay == 0) { + lastdelay = -1; + useold = 0; + } + } + + lcw = cw; + lch = ch; + lcx = cx; + lcy = cy; + if (useold && !config_changed) { + cw = ocw; + ch = och; + cx = ocx; + cy = ocy; + } else { + ocw = cw; + och = ch; + ocx = cx; + ocy = cy; + lastresize = 10; + lastdelay = 0; + } + double scalex = currprefs.gfx_filter_horiz_zoom_mult > 0 ? 1000.0 / currprefs.gfx_filter_horiz_zoom_mult : 1.0; + double scaley = currprefs.gfx_filter_vert_zoom_mult > 0 ? 1000.0 / currprefs.gfx_filter_vert_zoom_mult : 1.0; + SetRect (sr, 0, 0, cw * scale * scalex, ch * scale * scaley); + dr->left = (temp_width - aws) /2; + dr->top = (temp_height - ahs) / 2; + dr->right = dr->left + cw * scale; + dr->bottom = dr->top + ch * scale; + OffsetRect (zr, cx * scale, cy * scale); + int ww = (dr->right - dr->left) * scalex; + int hh = (dr->bottom - dr->top) * scaley; + if (currprefs.gfx_xcenter_size >= 0) + ww = currprefs.gfx_xcenter_size; + if (currprefs.gfx_ycenter_size >= 0) + hh = currprefs.gfx_ycenter_size; + int oldwinw = currprefs.gfx_size_win.width; + int oldwinh = currprefs.gfx_size_win.width; + changed_prefs.gfx_size_win.width = ww; + changed_prefs.gfx_size_win.height = hh; + fixup_prefs_dimensions (&changed_prefs); + if (oldwinw != changed_prefs.gfx_size_win.width || oldwinh != changed_prefs.gfx_size_win.height) + config_changed = 1; + OffsetRect (zr, -(changed_prefs.gfx_size_win.width - ww + 1) / 2, -(changed_prefs.gfx_size_win.height - hh + 1) / 2); + filteroffsetx = -zr->left / scale; + filteroffsety = -zr->top / scale; + goto end; + } + + dr->left = (temp_width - aws) /2; + dr->top = (temp_height - ahs) / 2; + dr->right = dr->left + dst_width * scale; + dr->bottom = dr->top + dst_height * scale; + + OffsetRect (zr, cx * scale, cy * scale); + + sizeoffset (dr, zr, extraw, extrah); + + dr->right -= (dst_width - cw) * scale; + dr->bottom -= (dst_height - ch) * scale; + + filteroffsetx = -zr->left / scale; + filteroffsety = -zr->top / scale; + + if (currprefs.gfx_filter_keep_aspect || currprefs.gfx_filter_aspect != 0) { + int diffx = dr->right - dr->left; + int diffy = dr->bottom - dr->top; + float xmult = 1.0; + float ymult = 1.0; + + if (currprefs.gfx_filter_keep_aspect) { + if (currprefs.ntscmode) { + dstratio = dstratio * 1.21; + if (currprefs.gfx_filter_keep_aspect == 2 && ispal ()) + dstratio = dstratio * 0.93; + else if (currprefs.gfx_filter_keep_aspect == 1 && !ispal ()) + dstratio = dstratio * 0.98; + } else { + if (currprefs.gfx_filter_keep_aspect == 2 && ispal ()) + dstratio = dstratio * 0.95; + else if (currprefs.gfx_filter_keep_aspect == 1 && !ispal ()) + dstratio = dstratio * 0.95; + } + } + + if (srcratio > dstratio) { + ymult = ymult * srcratio / dstratio; + } else { + xmult = xmult * dstratio / srcratio; + } + + diff = diffx - diffx * xmult; + sizeoffset (dr, zr, diff, 0); + filteroffsetx += diff / 2; + + diff = diffy - diffy * ymult; + sizeoffset (dr, zr, 0, diff); + filteroffsety += diff / 2; + } + + v = filter_horiz_offset; + OffsetRect (zr, (int)(-v * aws / 1000.0), 0); + v = filter_vert_offset; + OffsetRect (zr, 0, (int)(-v * ahs / 1000.0)); + + diff = dr->right - dr->left; + filterxmult = diff * 1000 / (dst_width * scale); + diff = dr->bottom - dr->top; + filterymult = diff * 1000 / (dst_height * scale); + goto end; + } + + } +cont: + if (!filter_horiz_zoom_mult && !filter_vert_zoom_mult) { + + sizeoffset (dr, zr, extraw, extrah); + + if (currprefs.gfx_filter_keep_aspect) { + float xm, ym, m; + + xm = 1.0 * aws / dst_width; + ym = 1.0 * ahs / dst_height; + if (xm < ym) + xm = ym; + else + ym = xm; + xmult = ymult = xm * 1000.0; + + m = (aws * 1.0 / dst_width) / (ahs * 1.0 / dst_height); + dstratio = dstratio * m; + } + + } + + if (currprefs.ntscmode) { + if (currprefs.gfx_filter_keep_aspect == 2 && ispal ()) + dstratio = dstratio * 0.93; + else if (currprefs.gfx_filter_keep_aspect == 1 && !ispal ()) + dstratio = dstratio * 0.98; + } else { + if (currprefs.gfx_filter_keep_aspect == 2 && ispal ()) + dstratio = dstratio * 0.95; + else if (currprefs.gfx_filter_keep_aspect == 1 && !ispal ()) + dstratio = dstratio * 0.95; + } + + if (srcratio > dstratio) { + ymult = ymult * srcratio / dstratio; + } else { + xmult = xmult * dstratio / srcratio; + } + + if (xmult <= 0.01) + xmult = aws * 1000 / dst_width; + else + xmult = xmult + xmult * filter_horiz_zoom / 2000; + if (ymult <= 0.01) + ymult = ahs * 1000 / dst_height; + else + ymult = ymult + ymult * filter_vert_zoom / 2000; + + if (!filter_horiz_zoom_mult && !filter_vert_zoom_mult) { + if (currprefs.ntscmode) { + int v = vblscale2 (ahs); + ymult /= 1.21; + OffsetRect (dr, 0, (v - ahs2) / 2); + } + } + + ymult = vblscale (ymult); + OffsetRect (dr, 0, (ahs2 - ahs) / 2); + + v = filter_horiz_offset; + OffsetRect (zr, (int)(-v * aws / 1000.0), 0); + v = filter_vert_offset; + OffsetRect (zr, 0, (int)(-v * ahs / 1000.0)); + + xs = dst_width - dst_width * xmult / 1000; + ys = dst_height - dst_height * ymult / 1000; + sizeoffset (dr, zr, xs, ys); + + filterxmult = xmult; + filterymult = ymult; + filteroffsetx += (dst_width - aw * 1000 / filterxmult) / 2; + filteroffsety += (dst_height - ah * 1000 / filterymult) / 2; + +end: + fpux_restore (&fpuv); + +} + +#else + +extern bool getscalerect (float *mx, float *my, float *sx, float *sy); + +void getfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height, int aw, int ah, int scale, int temp_width, int temp_height) +{ + float srcratio, dstratio; + int aws, ahs, ahs2; + int xs, ys; + int v; + int extraw, extrah; + int fpuv; + bool specialmode = !isnativevidbuf (); + float mrmx, mrmy, mrsx, mrsy; + int extraw2; + + + int filter_horiz_zoom = currprefs.gfx_filter_horiz_zoom; + int filter_vert_zoom = currprefs.gfx_filter_vert_zoom; + float filter_horiz_zoom_mult = currprefs.gfx_filter_horiz_zoom_mult; + float filter_vert_zoom_mult = currprefs.gfx_filter_vert_zoom_mult; + int filter_horiz_offset = currprefs.gfx_filter_horiz_offset; + int filter_vert_offset = currprefs.gfx_filter_vert_offset; + + if (!usedfilter && !currprefs.gfx_api) { + filter_horiz_zoom = filter_vert_zoom = 0; + filter_horiz_zoom_mult = filter_vert_zoom_mult = 1000; + filter_horiz_offset = filter_vert_offset = 0; + } + + if (screen_is_picasso) { + getrtgfilterrect2 (sr, dr, zr, dst_width, dst_height); + return; + } + + fpux_save (&fpuv); + + fixh (&ah, dst_height); + + getinit (); + ahs2 = vblscale (ah) * scale; + aws = aw * scale; + ahs = ah * scale; + //write_log (L"%d %d %d\n", dst_width, temp_width, aws); + extraw = -aws * (filter_horiz_zoom - currprefs.gfx_filteroverlay_overscan * 10) / 2000; + extrah = -ahs * (filter_vert_zoom - currprefs.gfx_filteroverlay_overscan * 10) / 2000; + + extraw2 = 0; + if (getscalerect (&mrmx, &mrmy, &mrsx, &mrsy)) { + extraw2 = mrmx; + //extrah -= mrmy; + } + + SetRect (sr, 0, 0, dst_width, dst_height); + SetRect (zr, 0, 0, 0, 0); + dr->left = (temp_width - aws) / 2; + dr->top = (temp_height - ahs) / 2; + dr->left -= (dst_width - gfxvidinfo.outbuffer->inwidth2) / 2; dr->top -= (dst_height - gfxvidinfo.outbuffer->inheight2) / 2; @@ -591,9 +990,18 @@ cont: filteroffsety += (dst_height - ah * 1000 / filterymult) / 2; end: + + if (getscalerect (&mrmx, &mrmy, &mrsx, &mrsy)) { + sizeoffset (dr, zr, mrmx, mrmy); + OffsetRect (dr, mrsx, mrsy); + } + + + fpux_restore (&fpuv); } +#endif uae_u8 *getfilterbuffer (int *widthp, int *heightp, int *pitch, int *depth) { diff --git a/od-win32/win32gfx.cpp b/od-win32/win32gfx.cpp index 7799bf3d..0f1b8b1f 100644 --- a/od-win32/win32gfx.cpp +++ b/od-win32/win32gfx.cpp @@ -3264,12 +3264,13 @@ static BOOL doInit (void) gfxvidinfo.inbuffer = &gfxvidinfo.drawbuffer; if (!screen_is_picasso) { - allocsoftbuffer(&gfxvidinfo.drawbuffer, currentmode->flags, + + allocsoftbuffer (&gfxvidinfo.drawbuffer, currentmode->flags, currentmode->current_width > currentmode->amiga_width ? currentmode->current_width : currentmode->amiga_width, currentmode->current_height > currentmode->amiga_height ? currentmode->current_height : currentmode->amiga_height, currentmode->current_depth); if (currprefs.monitoremu) - allocsoftbuffer(&gfxvidinfo.tempbuffer, currentmode->flags, + allocsoftbuffer (&gfxvidinfo.tempbuffer, currentmode->flags, currentmode->amiga_width > 1024 ? currentmode->amiga_width : 1024, currentmode->amiga_height > 1024 ? currentmode->amiga_height : 1024, currentmode->current_depth); @@ -3291,9 +3292,6 @@ static BOOL doInit (void) #if defined (GFXFILTER) S2X_free (); - if (currentmode->flags & DM_SWSCALE) { - S2X_init (currentmode->native_width, currentmode->native_height, currentmode->native_depth); - } #ifdef D3D if (currentmode->flags & DM_D3D) { const TCHAR *err = D3D_init (hAmigaWnd, currentmode->native_width, currentmode->native_height, @@ -3312,6 +3310,9 @@ static BOOL doInit (void) } } #endif + if (currentmode->flags & DM_SWSCALE) { + S2X_init (currentmode->native_width, currentmode->native_height, currentmode->native_depth); + } #endif screen_is_initialized = 1; picasso_refresh (); diff --git a/od-win32/winuae_msvc10/winuae_msvc.vcxproj b/od-win32/winuae_msvc10/winuae_msvc.vcxproj index 0e22a545..451de041 100644 --- a/od-win32/winuae_msvc10/winuae_msvc.vcxproj +++ b/od-win32/winuae_msvc10/winuae_msvc.vcxproj @@ -116,6 +116,7 @@ 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\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) diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index 02deafe7..239ba863 100644 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,4 +1,17 @@ +Beta 20: + +- Fixed DirectDraw on screen led status bar surface allocation error when switching modes in some situations. +- A3000 quickstart CIA mapping fixed (no mirrors, can't enable both CIAs at the same time, only original Gary does this) + and 0xc0-0xcf added (same as A4000) Only affects very badly behaving programs, programs that most likely wouldn't run + on A3000 or A4000, with or without this change. +- Do not fully recalculate display parameters if only long/short field state changes. +- Lace<>non-lace mode switch scanline flashing effect hopefully fixed (may also break something else..) +- Overlay graphics Direct3D mode should have more correct positioning again (still not exactly right) +- Z3 board <16M RAM size autoconfig data makes more sense. +- Upper half of 8M RTG Z2 board was overridden by Gayle PCMCIA address space if enabled. +- Windows 8 Consumer Preview tested, didn't notice any problems. WARNING: No Windows 8 discussion here! + Beta 19: - Triple buffered native chipset low latency vsync uses slightly different flipping method -- 2.47.3