]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
2100b19
authorToni Wilen <twilen@winuae.net>
Sat, 27 Mar 2010 10:21:22 +0000 (12:21 +0200)
committerToni Wilen <twilen@winuae.net>
Sat, 27 Mar 2010 10:21:22 +0000 (12:21 +0200)
21 files changed:
audio.cpp
cfgfile.cpp
cia.cpp
custom.cpp
debug.cpp
include/debug.h
include/options.h
include/sampler.h
inputdevice.cpp
main.cpp
od-win32/direct3d.cpp
od-win32/picasso96_win.cpp
od-win32/resources/resource
od-win32/resources/winuae.rc
od-win32/sounddep/sound.cpp
od-win32/sounddep/sound.h
od-win32/win32.cpp
od-win32/win32.h
od-win32/win32gui.cpp
sampler.cpp
zfile.cpp

index 518f23995cc539a8de9b62ce2330fc5fb2055afa..6a3ddb281451cbdc19d09c6ab5d9f408d32561c2 100644 (file)
--- a/audio.cpp
+++ b/audio.cpp
@@ -414,12 +414,15 @@ STATIC_INLINE void put_sound_word_left (uae_u32 w)
                lold = left_word_saved[saved_ptr] - SOUND16_BASE_VAL;
                tmp = (rnew * mixed_mul2 + lold * mixed_mul1) / MIXED_STEREO_SCALE;
                tmp += SOUND16_BASE_VAL;
-               PUT_SOUND_WORD_RIGHT (tmp);
 
                rold = right_word_saved[saved_ptr] - SOUND16_BASE_VAL;
                w = (lnew * mixed_mul2 + rold * mixed_mul1) / MIXED_STEREO_SCALE;
+
+               PUT_SOUND_WORD_LEFT (w);
+               PUT_SOUND_WORD_RIGHT (tmp);
+       } else {
+               PUT_SOUND_WORD_LEFT (w);
        }
-       PUT_SOUND_WORD_LEFT (w);
 }
 
 STATIC_INLINE void put_sound_word_right2 (uae_u32 w)
@@ -445,12 +448,15 @@ STATIC_INLINE void put_sound_word_left2 (uae_u32 w)
                lold = left2_word_saved[saved_ptr2] - SOUND16_BASE_VAL;
                tmp = (rnew * mixed_mul2 + lold * mixed_mul1) / MIXED_STEREO_SCALE;
                tmp += SOUND16_BASE_VAL;
-               PUT_SOUND_WORD_RIGHT2 (tmp);
 
                rold = right2_word_saved[saved_ptr2] - SOUND16_BASE_VAL;
                w = (lnew * mixed_mul2 + rold * mixed_mul1) / MIXED_STEREO_SCALE;
+
+               PUT_SOUND_WORD_LEFT2 (w);
+               PUT_SOUND_WORD_RIGHT2 (tmp);
+       } else {
+               PUT_SOUND_WORD_LEFT2 (w);
        }
-       PUT_SOUND_WORD_LEFT2 (w);
 }
 
 
index 7bb5f2cfec28ce6169a98b7c138d25c121aa9c65..6b58f43359076535c87202b2832d6c59b8c00d47 100644 (file)
@@ -155,6 +155,8 @@ static const TCHAR *cscompa[] = {
        L"-", L"Generic", L"CDTV", L"CD32", L"A500", L"A500+", L"A600",
        L"A1000", L"A1200", L"A2000", L"A3000", L"A3000T", L"A4000", L"A4000T", 0
 };
+static const TCHAR *qsmodes[] = {
+       L"A500", L"A500+", L"A600", L"A1000", L"A1200", L"A3000", L"A4000", L"", L"CD32", L"CDTV", L"ARCADIA", NULL };
 /* 3-state boolean! */
 static const TCHAR *fullmodes[] = { L"false", L"true", /* "FILE_NOT_FOUND", */ L"fullwindow", 0 };
 /* bleh for compatibility */
@@ -176,7 +178,6 @@ static const TCHAR *dongles[] =
        L"rugby coach", L"cricket captain", L"leviathan",
        NULL
 };
-static const TCHAR *parportsampler[] = { L"none", L"mono", L"stereo", NULL };
 
 static const TCHAR *obsolete[] = {
        L"accuracy", L"gfx_opengl", L"gfx_32bit_blits", L"32bit_blits",
@@ -625,7 +626,6 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
        cfgfile_write_bool (f, L"parallel_postscript_detection", p->parallel_postscript_detection);
        cfgfile_write_str (f, L"ghostscript_parameters", p->ghostscript_parameters);
        cfgfile_write (f, L"parallel_autoflush", L"%d", p->parallel_autoflush_time);
-       cfgfile_dwrite_str (f, L"parallel_sampler", parportsampler[p->parallel_sampler]);
        cfgfile_dwrite (f, L"uae_hide", L"%d", p->uae_hide);
        cfgfile_dwrite_bool (f, L"magic_mouse", p->input_magic_mouse);
        cfgfile_dwrite_str (f, L"magic_mousecursor", magiccursors[p->input_magic_mouse_cursor]);
@@ -1695,7 +1695,6 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, TCHAR *option, TCHAR *va
                || cfgfile_strval (option, value, L"comp_trustnaddr", &p->comptrustnaddr, compmode, 0)
                || cfgfile_strval (option, value, L"collision_level", &p->collision_level, collmode, 0)
                || cfgfile_strval (option, value, L"parallel_matrix_emulation", &p->parallel_matrix_emulation, epsonprinter, 0)
-               || cfgfile_strval (option, value, L"parallel_sampler", &p->parallel_sampler, parportsampler, 0)
                || cfgfile_strval (option, value, L"comp_flushmode", &p->comp_hardflush, flushmode, 0))
                return 1;
 
@@ -1837,6 +1836,23 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, TCHAR *option, TCHAR *va
                return 1;
        }
 
+       if (strcasecmp (option, L"quickstart") == 0) {
+               int model = -1;
+               TCHAR *tmpp = _tcschr (value, ',');
+               if (tmpp) {
+                       *tmpp++ = 0;
+                       TCHAR *tmpp2 = _tcschr (value, ',');
+                       if (tmpp2)
+                               *tmpp2 = 0;
+                       cfgfile_strval (option, value, option, &model, qsmodes,  0);
+                       if (model >= 0) {
+                               int config = _tstol (tmpp);
+                               built_in_prefs (p, model, config, 0, 0);
+                       }
+               }
+               return 1;
+       }
+
        for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
                TCHAR tmp[100];
                _stprintf (tmp, L"uaehf%d", i);
@@ -3198,7 +3214,6 @@ void default_prefs (struct uae_prefs *p, int type)
        p->parallel_postscript_emulation = 0;
        p->parallel_postscript_detection = 0;
        p->parallel_autoflush_time = 5;
-       p->parallel_sampler = 0;
        p->ghostscript_parameters[0] = 0;
        p->uae_hide = 0;
 
diff --git a/cia.cpp b/cia.cpp
index d1dcd0712605a79c612dee0209fef540c9fb7813..3109ab770510ee0d6a23fee54aaa3c752da854e1 100644 (file)
--- a/cia.cpp
+++ b/cia.cpp
@@ -641,7 +641,7 @@ static uae_u8 ReadCIAA (unsigned int addr)
                } else if (arcadia_bios) {
                        tmp = arcadia_parport (0, ciaaprb, ciaadrb);
 #endif
-               } else if (currprefs.parallel_sampler) {
+               } else if (currprefs.win32_samplersoundcard >= 0) {
 
                        tmp = sampler_getsample ();
 
index ff9a230368b4bc1474ef1daff204baeead1784c3..185900fbd82ed1cc4337be6aa5e3bf349d63185d 100644 (file)
@@ -52,6 +52,7 @@
 #include "a2065.h"
 #include "ncr_scsi.h"
 #include "blkdev.h"
+#include "sampler.h"
 
 #define CUSTOM_DEBUG 0
 #define SPRITE_DEBUG 0
@@ -134,7 +135,7 @@ extern uae_u8* compiled_code;
 
 int vpos;
 static int vpos_count, vpos_count_prev;
-static int lof, lol;
+static int lof_store, lof_current, lol;
 static int next_lineno, prev_lineno;
 static enum nln_how nextline_how;
 static int lof_changed = 0;
@@ -1789,11 +1790,11 @@ static void start_bpl_dma (int hpos, int hstart)
        if (doflickerfix () && interlace_seen && !scandoubled_line) {
                int i;
                for (i = 0; i < 8; i++) {
-                       prevbpl[lof][vpos][i] = bplptx[i];
-                       if (!lof && (bplcon0 & 4))
-                               bplpt[i] = prevbpl[1 - lof][vpos][i];
+                       prevbpl[lof_store][vpos][i] = bplptx[i];
+                       if (!lof_store && (bplcon0 & 4))
+                               bplpt[i] = prevbpl[1 - lof_store][vpos][i];
                        if (!(bplcon0 & 4) || interlace_seen  < 0)
-                               prevbpl[1 - lof][vpos][i] = prevbpl[lof][vpos][i] = 0;
+                               prevbpl[1 - lof_store][vpos][i] = prevbpl[lof_store][vpos][i] = 0;
                }
        }
 
@@ -2678,7 +2679,7 @@ void compute_vsynctime (void)
                updatedisplayarea ();
        }
        if (currprefs.produce_sound > 1)
-               update_sound (fake_vblank_hz, (bplcon0 & 4) ? -1 : lof, islinetoggle ());
+               update_sound (fake_vblank_hz, (bplcon0 & 4) ? -1 : lof_current, islinetoggle ());
 }
 
 
@@ -2976,7 +2977,7 @@ STATIC_INLINE uae_u16 VPOSR (void)
 
        if (hp + HPOS_OFFSET >= maxhpos) {
                vp++;
-               if (vp >= maxvpos + lof)
+               if (vp >= maxvpos + lof_current)
                        vp = 0;
        }
        vp = (vp >> 8) & 7;
@@ -2996,7 +2997,7 @@ STATIC_INLINE uae_u16 VPOSR (void)
 
        if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS))
                vp &= 1;
-       vp = vp | (lof ? 0x8000 : 0) | csbit;
+       vp = vp | (lof_current ? 0x8000 : 0) | csbit;
        if (currprefs.chipset_mask & CSMASK_ECS_AGNUS)
                vp |= lol ? 0x80 : 0;
 #if 0
@@ -3011,12 +3012,13 @@ STATIC_INLINE uae_u16 VPOSR (void)
 static void VPOSW (uae_u16 v)
 {
 #if 0
-       if (M68K_GETPC < 0xf00000)
+       if (M68K_GETPC < 0xf00000 || 1)
                write_log (L"VPOSW %04X PC=%08x\n", v, M68K_GETPC);
 #endif
-       if (lof != ((v & 0x8000) ? 1 : 0))
+       if (lof_current != ((v & 0x8000) ? 1 : 0)) {
                lof_changed = 1;
-       lof = (v & 0x8000) ? 1 : 0;
+               lof_current = (v & 0x8000) ? 1 : 0;
+       }
        if (currprefs.chipset_mask & CSMASK_ECS_AGNUS)
                lol = (v & 0x0080) ? 1 : 0;
        if (lof_changed)
@@ -3031,7 +3033,7 @@ static void VPOSW (uae_u16 v)
 static void VHPOSW (uae_u16 v)
 {
 #if 0
-       if (M68K_GETPC < 0xf00000)
+       if (M68K_GETPC < 0xf00000 || 1)
                write_log (L"VHPOSW %04X PC=%08x\n", v, M68K_GETPC);
 #endif
        v >>= 8; // lets ignore hpos for now
@@ -3048,7 +3050,7 @@ STATIC_INLINE uae_u16 VHPOSR (void)
        if (hp >= maxhpos) {
                hp -= maxhpos;
                vp++;
-               if (vp >= maxvpos + lof)
+               if (vp >= maxvpos + lof_current)
                        vp = 0;
        }
        hp += 1;
@@ -4007,7 +4009,7 @@ static void SPRxPTL (int hpos, uae_u16 v, int num)
        decide_sprites (hpos);
        if (hpos - 1 != spr[num].ptxhpos) {
                spr[num].pt &= ~0xffff;
-               spr[num].pt |= v;
+               spr[num].pt |= v & ~1;
        }
 #if SPRITE_DEBUG > 0
        if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) {
@@ -4192,7 +4194,7 @@ static int custom_wput_copper (int hpos, uaecptr addr, uae_u32 value, int noget)
 {
        int v;
 
-       debug_wputpeek (0xdff000 + addr, value);
+       debug_wputpeekdma (0xdff000 + addr, value);
        copper_access = 1;
        v = custom_wput_1 (hpos, addr, value, noget);
        copper_access = 0;
@@ -5033,7 +5035,8 @@ static void vsync_handler (void)
                write_log (L"vblank interrupt not cleared\n");
 #endif
        if (bplcon0 & 4)
-               lof ^= 1;
+               lof_current = lof_current ? 0 : 1;
+       lof_store = lof_current;
 
 #ifdef PICASSO96
        picasso_handle_vsync ();
@@ -5055,7 +5058,7 @@ static void vsync_handler (void)
        if (debug_dma)
                record_dma_reset ();
 
-       vsync_handle_redraw (lof, lof_changed);
+       vsync_handle_redraw (lof_store, lof_changed);
 
        if (p96refresh_active) {
                vpos_count = p96refresh_active;
@@ -5073,6 +5076,7 @@ static void vsync_handler (void)
                timehack_alive--;
        inputdevice_vsync ();
        filesys_vsync ();
+       sampler_vsync ();
 
        init_hardware_frame ();
 
@@ -5177,14 +5181,14 @@ static void hsync_scandoubler (void)
                int diff;
                bpltmp[i] = bplpt[i];
                bpltmpx[i] = bplptx[i];
-               if (prevbpl[lof][vpos][i] && prevbpl[1 - lof][vpos][i]) {
-                       diff = prevbpl[lof][vpos][i] - prevbpl[1 - lof][vpos][i];
-                       if (lof) {
+               if (prevbpl[lof_store][vpos][i] && prevbpl[1 - lof_store][vpos][i]) {
+                       diff = prevbpl[lof_store][vpos][i] - prevbpl[1 - lof_store][vpos][i];
+                       if (lof_store) {
                                if (bplcon0 & 4)
-                                       bplpt[i] = prevbpl[lof][vpos][i] - diff;
+                                       bplpt[i] = prevbpl[lof_store][vpos][i] - diff;
                        } else {
                                if (bplcon0 & 4)
-                                       bplpt[i] = prevbpl[lof][vpos][i];
+                                       bplpt[i] = prevbpl[lof_store][vpos][i];
                                else
                                        bplpt[i] = bplpt[i] - diff;
 
@@ -5315,7 +5319,7 @@ static void hsync_handler (void)
        vpos_count++;
        if (vpos >= maxvpos_total)
                vpos = 0;
-       if (vpos == maxvpos + lof || vpos == maxvpos + lof + 1 || vpos_count >= MAXVPOS) {
+       if (vpos == maxvpos + lof_current || vpos == maxvpos + lof_current + 1 || vpos_count >= MAXVPOS) {
                // vpos_count >= MAXVPOS just to not crash if VPOSW writes prevent vsync completely
                if ((bplcon0 & 8) && !lightpen_triggered) {
                        vpos_lpen = vpos - 1;
@@ -5365,7 +5369,7 @@ static void hsync_handler (void)
                                        strobe = 0x38;
                                else if (vpos < minfirstline)
                                        strobe = 0x3a;
-                               else if (vpos + 1 == maxvpos + lof)
+                               else if (vpos + 1 == maxvpos + lof_current)
                                        strobe = 0x38;
                                else if ((currprefs.chipset_mask & CSMASK_ECS_AGNUS) && lol)
                                        strobe = 0x3e;
@@ -5398,7 +5402,7 @@ static void hsync_handler (void)
                }
        } else {
 #endif
-               is_lastline = vpos + 1 == maxvpos + lof && currprefs.m68k_speed == -1;
+               is_lastline = vpos + 1 == maxvpos + lof_current && currprefs.m68k_speed == -1;
 #ifdef JIT
        }
 #endif
@@ -5415,8 +5419,8 @@ static void hsync_handler (void)
                } else if (currprefs.gfx_linedbl && (doublescan <= 0 || interlace_seen > 0)) {
                        lineno *= 2;
                        nextline_how = currprefs.gfx_linedbl == 1 ? nln_doubled : nln_nblack;
-                       if ((bplcon0 & 4) || (interlace_seen > 0 && !lof)) {
-                               if (!lof) {
+                       if ((bplcon0 & 4) || (interlace_seen > 0 && !lof_store)) {
+                               if (!lof_store) {
                                        lineno++;
                                        nextline_how = nln_lower;
                                } else {
@@ -5761,7 +5765,7 @@ void dumpcustom (void)
        console_out_f (L"COP1LC: %08lx, COP2LC: %08lx COPPTR: %08lx\n", (unsigned long)cop1lc, (unsigned long)cop2lc, cop_state.ip);
        console_out_f (L"DIWSTRT: %04x DIWSTOP: %04x DDFSTRT: %04x DDFSTOP: %04x\n",
                (unsigned int)diwstrt, (unsigned int)diwstop, (unsigned int)ddfstrt, (unsigned int)ddfstop);
-       console_out_f (L"BPLCON 0: %04x 1: %04x 2: %04x 3: %04x 4: %04x\n", bplcon0, bplcon1, bplcon2, bplcon3, bplcon4);
+       console_out_f (L"BPLCON 0: %04x 1: %04x 2: %04x 3: %04x 4: %04x LOF=%d/%d\n", bplcon0, bplcon1, bplcon2, bplcon3, bplcon4, lof_current, lof_store);
        if (timeframes) {
                console_out_f (L"Average frame time: %.2f ms [frames: %d time: %d]\n",
                        (double)frametime / timeframes, timeframes, frametime);
@@ -6328,7 +6332,7 @@ uae_u8 *restore_custom (uae_u8 *src)
        dsklen = RW;                    /* 024 DSKLEN */
        RW;                                             /* 026 DSKDAT */
        RW;                                             /* 028 REFPTR */
-       i = RW; lof = (i & 0x8000) ? 1 : 0; lol = (i & 0x0080) ? 1 : 0; /* 02A VPOSW */
+       i = RW; lof_current = (i & 0x8000) ? 1 : 0; lol = (i & 0x0080) ? 1 : 0; /* 02A VPOSW */
        RW;                                             /* 02C VHPOSW */
        COPCON (RW);                    /* 02E COPCON */
        RW;                                             /* 030 SERDAT* */
@@ -6486,7 +6490,7 @@ uae_u8 *save_custom (int *len, uae_u8 *dstptr, int full)
        SW (dsklen);            /* 024 DSKLEN */
        SW (0);                 /* 026 DSKDAT */
        SW (0);                 /* 028 REFPTR */
-       SW ((lof ? 0x8001 : 0) | (lol ? 0x0080 : 0));/* 02A VPOSW */
+       SW ((lof_current ? 0x8001 : 0) | (lol ? 0x0080 : 0));/* 02A VPOSW */
        SW (0);                 /* 02C VHPOSW */
        SW (copcon);            /* 02E COPCON */
        SW (serper);            /* 030 SERDAT * */
index adcf720c13e066d77edf71ddd11c57b4ebe68476..02773695573b5450fae3a511cde455420f9d5d14 100644 (file)
--- a/debug.cpp
+++ b/debug.cpp
@@ -1854,19 +1854,34 @@ static uae_u8 *REGPARAM2 debug_xlate (uaecptr addr)
 {
        return debug_mem_banks[munge24 (addr) >> 16]->xlateaddr (addr);
 }
-void debug_putlpeek(uaecptr addr, uae_u32 v)
+
+void debug_wputpeekdma (uaecptr addr, uae_u32 v)
+{
+       if (!memwatch_enabled)
+               return;
+       memwatch_func (addr, 2, 2, &v);
+}
+void debug_wgetpeekdma (uaecptr addr, uae_u32 v)
+{
+       uae_u32 vv = v;
+       if (!memwatch_enabled)
+               return;
+       memwatch_func (addr, 1, 2, &vv);
+}
+
+void debug_putlpeek (uaecptr addr, uae_u32 v)
 {
        if (!memwatch_enabled)
                return;
        memwatch_func (addr, 2, 4, &v);
 }
-void debug_wputpeek(uaecptr addr, uae_u32 v)
+void debug_wputpeek (uaecptr addr, uae_u32 v)
 {
        if (!memwatch_enabled)
                return;
        memwatch_func (addr, 2, 2, &v);
 }
-void debug_bputpeek(uaecptr addr, uae_u32 v)
+void debug_bputpeek (uaecptr addr, uae_u32 v)
 {
        if (!memwatch_enabled)
                return;
index 19860cc75721e0634268662a77896778cdfec09e..038322e873bb919289ae3f97fd262ea417bb267f 100644 (file)
@@ -64,6 +64,8 @@ extern struct memwatch_node mwnodes[MEMWATCH_TOTAL];
 
 extern void memwatch_dump2 (TCHAR *buf, int bufsize, int num);
 
+void debug_wgetpeekdma (uaecptr addr, uae_u32 v);
+void debug_wputpeekdma (uaecptr addr, uae_u32 v);
 void debug_lgetpeek (uaecptr addr, uae_u32 v);
 void debug_wgetpeek (uaecptr addr, uae_u32 v);
 void debug_bgetpeek (uaecptr addr, uae_u32 v);
index 9eb35415787f6a410eab5dfdfa62b8cfee89ecb2..795dd13d9930672fa199c61ef8b78eba73c96e2c 100644 (file)
@@ -111,7 +111,6 @@ struct uae_prefs {
     int parallel_postscript_emulation;
     int parallel_postscript_detection;
     int parallel_autoflush_time;
-       int parallel_sampler;
     TCHAR ghostscript_parameters[256];
     int use_gfxlib;
     int socket_emu;
@@ -353,6 +352,7 @@ struct uae_prefs {
     int win32_midiindev;
     int win32_uaescsimode;
     int win32_soundcard;
+       int win32_samplersoundcard;
     int win32_soundexclusive;
     int win32_norecyclebin;
     int win32_specialkey;
index 141e131ccc40912a34c94e2114164a732109435c..3b863212308fef7b6357da591a65790becb2671e 100644 (file)
@@ -2,5 +2,5 @@
 extern uae_u8 sampler_getsample (void);
 extern int sampler_init (void);
 extern void sampler_free (void);
-
+extern void sampler_vsync (void);
 
index d9bc0198d7ccfea1dfd65125da033a9d71e60b78..792b967bdadb349b6c4ac9c6366a824f351d2d4b 100644 (file)
@@ -3077,7 +3077,7 @@ static void scanevents (struct uae_prefs *p)
                                        ismouse (ei);
                                        isdigitalbutton (ei);
                                        if (ei > 0)
-                                               scancodeused[i][keyboards[i].extra[j][k]] = 1;
+                                               scancodeused[i][keyboards[i].extra[j][k]] = ei;
                                }
                                j++;
                        }
index 753cde877aa76884f4f27d0fde6ac221080940b2..48d1826241480c3fc3ed40c632fad6e379282bcc 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -508,6 +508,8 @@ static void parse_cmdline (int argc, TCHAR **argv)
                        TCHAR *txt = parsetext (argv[i] + 13);
                        parse_diskswapper (txt);
                        xfree (txt);
+               } else if (_tcsncmp (argv[i], L"-cfgparam=", 10) == 0) {
+                       ;
                } else if (_tcscmp (argv[i], L"-cfgparam") == 0) {
                        if (i + 1 < argc)
                                i++;
index d93aaa01b295149faf14439b2818d5301c9b6cd2..45c4bdfd66fec36536a2e41ef48d4af32802a36b 100644 (file)
@@ -1,10 +1,13 @@
 
 #include <windows.h>
+#include <resource>
+
 #include "sysconfig.h"
 #include "sysdeps.h"
 
 #if defined (D3D) && defined (GFXFILTER)
 
+#define EFFECT_VERSION 2
 
 #include "options.h"
 #include "xwin.h"
@@ -458,6 +461,216 @@ int D3D_canshaders (void)
        return d3d_yesno > 0 ? 1 : 0;
 }
 
+static const char *fx10 = {
+
+"// 2 (version)\n"
+"//\n"
+"// WinUAE Direct3D post processing shader\n"
+"//\n"
+"// by Toni Wilen 2010\n"
+"\n"
+"uniform extern float4x4 mtx;\n"
+"uniform extern float2 maskmult;\n"
+"uniform extern float2 maskshift;\n"
+"uniform extern int filtermode;\n"
+"\n"
+"// final possibly filtered Amiga output\n"
+"texture SourceTexture : SOURCETEXTURE;\n"
+"\n"
+"sampler       SourceSampler = sampler_state {\n"
+"      Texture   = (SourceTexture);\n"
+"      MinFilter = POINT;\n"
+"      MagFilter = POINT;\n"
+"      MipFilter = NONE;\n"
+"      AddressU  = Clamp;\n"
+"      AddressV  = Clamp;\n"
+"};\n"
+"\n"
+"\n"
+"texture OverlayTexture : OVERLAYTEXTURE;\n"
+"\n"
+"sampler       OverlaySampler = sampler_state {\n"
+"      Texture   = (OverlayTexture);\n"
+"      MinFilter = POINT;\n"
+"      MagFilter = POINT;\n"
+"      MipFilter = NONE;\n"
+"      AddressU  = Wrap;\n"
+"      AddressV  = Wrap;\n"
+"};\n"
+"\n"
+"struct VS_OUTPUT_POST\n"
+"{\n"
+"      float4 Position         : POSITION;\n"
+"      float2 CentreUV         : TEXCOORD0;\n"
+"      float2 Selector         : TEXCOORD1;\n"
+"};\n"
+"\n"
+"VS_OUTPUT_POST VS_Post(float3 pos : POSITION, float2 TexCoord : TEXCOORD0)\n"
+"{\n"
+"      VS_OUTPUT_POST Out = (VS_OUTPUT_POST)0;\n"
+"\n"
+"      Out.Position = mul(float4(pos, 1.0f), mtx);\n"
+"      Out.CentreUV = TexCoord;\n"
+"      Out.Selector = TexCoord * maskmult + maskshift;\n"
+"      return Out;\n"
+"}\n"
+"\n"
+"float4 PS_Post(in VS_OUTPUT_POST inp) : COLOR\n"
+"{\n"
+"      float4 s = tex2D(SourceSampler, inp.CentreUV);\n"
+"      float4 o = tex2D(OverlaySampler, inp.Selector);\n"
+"      return s * o;\n"
+"}\n"
+"\n"
+"float4 PS_PostAlpha(in VS_OUTPUT_POST inp) : COLOR\n"
+"{\n"
+"      float4 s = tex2D(SourceSampler, inp.CentreUV);\n"
+"      float4 o = tex2D(OverlaySampler, inp.Selector);\n"
+"      return s * (1 - o.a) + (o * o.a);\n"
+"}\n"
+"\n"
+"float4 PS_PostPlain(in VS_OUTPUT_POST inp) : COLOR\n"
+"{\n"
+"      float4 s = tex2D(SourceSampler, inp.CentreUV);\n"
+"      return s;\n"
+"}\n"
+"\n"
+"// source and overlay texture\n"
+"technique PostTechnique\n"
+"{\n"
+"    pass P0\n"
+"    {\n"
+"              VertexShader = compile vs_1_0 VS_Post();\n"
+"              PixelShader  = compile ps_1_0 PS_Post();\n"
+"    }  \n"
+"}\n"
+"\n"
+"// source and scanline texture with alpha\n"
+"technique PostTechniqueAlpha\n"
+"{\n"
+"      pass P0\n"
+"      {\n"
+"              VertexShader = compile vs_1_0 VS_Post();\n"
+"              PixelShader  = compile ps_1_0 PS_PostAlpha();\n"
+"    } \n"
+"}\n"
+"\n"
+"// only source texture\n"
+"technique PostTechniquePlain\n"
+"{\n"
+"      pass P0\n"
+"      {\n"
+"              VertexShader = compile vs_1_0 VS_Post();\n"
+"              PixelShader  = compile ps_1_0 PS_PostPlain();\n"
+"    }\n"
+"}\n"
+};
+
+static const char *fx20 = {
+
+"// 2 (version)\n"
+"//\n"
+"// WinUAE Direct3D post processing shader\n"
+"//\n"
+"// by Toni Wilen 2010\n"
+"\n"
+"uniform extern float4x4 mtx;\n"
+"uniform extern float2 maskmult;\n"
+"uniform extern float2 maskshift;\n"
+"uniform extern int filtermode;\n"
+"\n"
+"// final possibly filtered Amiga output\n"
+"texture SourceTexture : SOURCETEXTURE;\n"
+"\n"
+"sampler       SourceSampler = sampler_state {\n"
+"      Texture   = (SourceTexture);\n"
+"      MinFilter = filtermode;\n"
+"      MagFilter = filtermode;\n"
+"      MipFilter = NONE;\n"
+"      AddressU  = Clamp;\n"
+"      AddressV  = Clamp;\n"
+"};\n"
+"\n"
+"\n"
+"texture OverlayTexture : OVERLAYTEXTURE;\n"
+"\n"
+"sampler       OverlaySampler = sampler_state {\n"
+"      Texture   = (OverlayTexture);\n"
+"      MinFilter = POINT;\n"
+"      MagFilter = POINT;\n"
+"      MipFilter = NONE;\n"
+"      AddressU  = Wrap;\n"
+"      AddressV  = Wrap;\n"
+"};\n"
+"\n"
+"struct VS_OUTPUT_POST\n"
+"{\n"
+"      float4 Position         : POSITION;\n"
+"      float2 CentreUV         : TEXCOORD0;\n"
+"      float2 Selector         : TEXCOORD1;\n"
+"};\n"
+"\n"
+"VS_OUTPUT_POST VS_Post(float3 pos : POSITION, float2 TexCoord : TEXCOORD0)\n"
+"{\n"
+"      VS_OUTPUT_POST Out = (VS_OUTPUT_POST)0;\n"
+"\n"
+"      Out.Position = mul(float4(pos, 1.0f), mtx);\n"
+"      Out.CentreUV = TexCoord;\n"
+"      Out.Selector = TexCoord * maskmult + maskshift;\n"
+"      return Out;\n"
+"}\n"
+"\n"
+"float4 PS_Post(in VS_OUTPUT_POST inp) : COLOR\n"
+"{\n"
+"      float4 s = tex2D(SourceSampler, inp.CentreUV);\n"
+"      float4 o = tex2D(OverlaySampler, inp.Selector);\n"
+"      return s * o;\n"
+"}\n"
+"\n"
+"float4 PS_PostAlpha(in VS_OUTPUT_POST inp) : COLOR\n"
+"{\n"
+"      float4 s = tex2D(SourceSampler, inp.CentreUV);\n"
+"      float4 o = tex2D(OverlaySampler, inp.Selector);\n"
+"      return s * (1 - o.a) + (o * o.a);\n"
+"}\n"
+"\n"
+"float4 PS_PostPlain(in VS_OUTPUT_POST inp) : COLOR\n"
+"{\n"
+"      float4 s = tex2D(SourceSampler, inp.CentreUV);\n"
+"      return s;\n"
+"}\n"
+"\n"
+"// source and overlay texture\n"
+"technique PostTechnique\n"
+"{\n"
+"    pass P0\n"
+"    {\n"
+"              VertexShader = compile vs_1_0 VS_Post();\n"
+"              PixelShader  = compile ps_2_0 PS_Post();\n"
+"    }  \n"
+"}\n"
+"\n"
+"// source and scanline texture with alpha\n"
+"technique PostTechniqueAlpha\n"
+"{\n"
+"      pass P0\n"
+"      {\n"
+"              VertexShader = compile vs_1_0 VS_Post();\n"
+"              PixelShader  = compile ps_2_0 PS_PostAlpha();\n"
+"    } \n"
+"}\n"
+"\n"
+"// only source texture\n"
+"technique PostTechniquePlain\n"
+"{\n"
+"      pass P0\n"
+"      {\n"
+"              VertexShader = compile vs_1_0 VS_Post();\n"
+"              PixelShader  = compile ps_2_0 PS_PostPlain();\n"
+"    }\n"
+"}\n"
+};     
+
 static LPD3DXEFFECT psEffect_LoadEffect (const TCHAR *shaderfile, int full)
 {
        int ret = 0;
@@ -465,17 +678,57 @@ static LPD3DXEFFECT psEffect_LoadEffect (const TCHAR *shaderfile, int full)
        LPD3DXBUFFER Errors = NULL;
        LPD3DXBUFFER BufferEffect = NULL;
        HRESULT hr;
-       TCHAR tmp[MAX_DPATH];
+       TCHAR tmp[MAX_DPATH], tmp2[MAX_DPATH];
        LPD3DXEFFECT effect = NULL;
        static int first;
        DWORD compileflags = psEnabled ? 0 : D3DXSHADER_USE_LEGACY_D3DX9_31_DLL;
+       int canusefile = 0, existsfile = 0;
 
        _stprintf (tmp, L"%s%sfiltershaders\\direct3d\\%s", start_path_data, WIN32_PLUGINDIR, shaderfile);
-       hr = D3DXCreateEffectCompilerFromFile (tmp, NULL, NULL, compileflags, &EffectCompiler, &Errors);
-       if (FAILED (hr)) {
-               write_log (L"%s: D3DXCreateEffectCompilerFromFile failed: %s\n", D3DHEAD, D3DX_ErrorString (hr, Errors));
-               goto end;
+       if (!full) {
+               struct zfile *z = zfile_fopen (tmp, L"r", 0);
+               if (z) {
+                       existsfile = 1;
+                       zfile_fgets (tmp2, sizeof tmp2 / sizeof (TCHAR), z);
+                       zfile_fclose (z);
+                       int ver = _tstol (tmp2 + 2);
+                       if (ver == EFFECT_VERSION) {
+                               canusefile = 1;
+                       } else {
+                               write_log (L"'%s' mismatched version (%d != %d)\n", tmp, ver, EFFECT_VERSION);
+                       }
+               }
+               hr = E_FAIL;
+               if (canusefile) {
+                       write_log (L"%s: Attempting to load '%s'\n", D3DHEAD, tmp);
+                       hr = D3DXCreateEffectCompilerFromFile (tmp, NULL, NULL, compileflags, &EffectCompiler, &Errors);
+                       if (FAILED (hr))
+                               write_log (L"%s: D3DXCreateEffectCompilerFromFile failed: %s\n", D3DHEAD, D3DX_ErrorString (hr, Errors));
+               }
+               if (FAILED (hr)) {
+                       const char *str = psEnabled ? fx20 : fx10;
+                       int len = strlen (str);
+                       if (!existsfile) {
+                               struct zfile *z = zfile_fopen (tmp, L"w", 0);
+                               if (z) {
+                                       zfile_fwrite ((void*)str, len, 1, z);
+                                       zfile_fclose (z);
+                               }
+                       }
+                       hr = D3DXCreateEffectCompiler (str, len, NULL, NULL, compileflags, &EffectCompiler, &Errors);
+                       if (FAILED (hr)) {
+                               write_log (L"%s: D3DXCreateEffectCompilerFromResource failed: %s\n", D3DHEAD, D3DX_ErrorString (hr, Errors));
+                               goto end;
+                       }
+               }
+       } else {
+               hr = D3DXCreateEffectCompilerFromFile (tmp, NULL, NULL, compileflags, &EffectCompiler, &Errors);
+               if (FAILED (hr)) {
+                       write_log (L"%s: D3DXCreateEffectCompilerFromFile failed: %s\n", D3DHEAD, D3DX_ErrorString (hr, Errors));
+                       goto end;
+               }
        }
+
        hr = EffectCompiler->CompileEffect (0, &BufferEffect, &Errors);
        if (FAILED (hr)) {
                write_log (L"%s: CompileEffect failed: %s\n", D3DHEAD, D3DX_ErrorString (hr, Errors));
@@ -518,7 +771,7 @@ end:
                }
        }
        if (ret)
-               write_log (L"%s: pixelshader filter '%s' loaded\n", D3DHEAD, tmp);
+               write_log (L"%s: pixelshader filter '%s' enabled\n", D3DHEAD, tmp);
        else
                write_log (L"%s: pixelshader filter '%s' failed to initialize\n", D3DHEAD, tmp);
        return effect;
index b9b06775267090523d030a14473f00a9f5a4cf24..31cd571ec2d7c5fa47186920f21f66e76f58a36a 100644 (file)
@@ -126,7 +126,7 @@ uae_u32 p96rc[256], p96gc[256], p96bc[256];
 static int cursorwidth, cursorheight, cursorok;
 static uae_u8 *cursordata;
 static uae_u32 cursorrgb[4], cursorrgbn[4];
-static int cursorvisible, cursordeactivate;
+static int cursorvisible, cursordeactivate, setupcursor_needed;
 static HCURSOR wincursor;
 static int wincursor_shown;
 static uaecptr boardinfo, ABI_interrupt;
@@ -571,6 +571,34 @@ static void do_fillrect_frame_buffer (struct RenderInfo *ri, int X, int Y,
        }
 }
 
+static void setupcursor (void)
+{
+       uae_u8 *dptr = NULL;
+       int bpp = 4;
+       DWORD pitch;
+       D3DLOCKED_RECT locked;
+       HRESULT hr;
+
+       setupcursor_needed = 1;
+       if (cursorsurfaced3d && cursordata && cursorwidth && cursorheight) {
+               if (SUCCEEDED (hr = cursorsurfaced3d->LockRect (0, &locked, NULL, 0))) {
+                       dptr = (uae_u8*)locked.pBits;
+                       pitch = locked.Pitch;
+                       for (int y = 0; y < cursorheight; y++) {
+                               uae_u8 *p1 = cursordata + cursorwidth * bpp * y;
+                               uae_u8 *p2 = dptr + pitch * y;
+                               memcpy (p2, p1, cursorwidth * bpp);
+                       }
+                       cursorsurfaced3d->UnlockRect (0);
+                       setupcursor_needed = 0;
+                       P96TRACE_SPR((L"cursorsurface3d updated\n"));
+                       return;
+               } else {
+                       P96TRACE_SPR((L"cursorsurfaced3d LockRect() failed %08x\n", hr));
+               }
+       }
+}
+
 static void disablemouse (void)
 {
        cursorok = FALSE;
@@ -670,6 +698,8 @@ void picasso_handle_vsync (void)
                if (!flushed)
                        gfx_unlock_picasso ();
        }
+       if (setupcursor_needed)
+               setupcursor ();
 }
 
 static int set_panning_called = 0;
@@ -711,27 +741,6 @@ typedef enum {
        RGBFB_CLUT_8
 };
 
-static void setupcursor (void)
-{
-       uae_u8 *dptr = NULL;
-       int bpp = 4;
-       DWORD pitch;
-       D3DLOCKED_RECT locked;
-
-       if (cursorsurfaced3d == NULL)
-               return;
-       if (SUCCEEDED (cursorsurfaced3d->LockRect (0, &locked, NULL, 0))) {
-               dptr = (uae_u8*)locked.pBits;
-               pitch = locked.Pitch;
-               for (int y = 0; y < cursorheight; y++) {
-                       uae_u8 *p1 = cursordata + cursorwidth * bpp * y;
-                       uae_u8 *p2 = dptr + pitch * y;
-                       memcpy (p2, p1, cursorwidth * bpp);
-               }
-               cursorsurfaced3d->UnlockRect (0);
-       }
-}
-
 static uae_u32 setspriteimage (uaecptr bi);
 static void recursor (void)
 {
index 534fffdd5439fc5484d839bac748167b34cad851..f8dc8b3f48014e25f4c4dd4366fbaf6a68dece21 100644 (file)
 #define IDS_PRINTER_EPSON48             359
 #define IDS_SELECTCD                    360
 #define IDS_CD                          361
+#define IDS_PS_FX_10                    363
 #define IDS_QS_MODELS                   1000
 #define IDS_QS_MODEL_A500               1001
 #define IDS_QS_MODEL_A500P              1002
 #define IDC_MBMEM1                      1028
 #define IDC_PORT_TABLET_CURSOR          1028
 #define IDC_SHOWLEDSRTG                 1028
+#define IDC_SAMPLERLIST                 1028
 #define IDC_PORT0_JOYSMODE              1029
 #define IDC_SLOWMEM                     1030
 #define IDC_PORT1_JOYSMODE              1030
 #define IDC_PORT3_JOYS                  1032
 #define IDC_PARALLEL                    1033
 #define IDC_JULIAN                      1040
-#define IDC_JULIAN2                     1041
 #define IDC_FOCUSMINIMIZE               1041
 #define IDC_FASTTEXT                    1043
 #define IDC_FASTRAM                     1044
index fc6074497bb561c851648a0883541df9e24f365b..9c2899f0cb83d8ce3539f4d7359273989e2d1247 100644 (file)
@@ -372,7 +372,7 @@ IDD_IOPORTS DIALOGEX 0, 0, 300, 228
 STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD\r
 FONT 8, "MS Sans Serif", 0, 0, 0x1\r
 BEGIN\r
-    GROUPBOX        "Parallel Port",IDC_STATIC,5,2,291,86\r
+    GROUPBOX        "Parallel Port",IDC_STATIC,5,2,291,105\r
     RTEXT           "Printer:",IDC_STATIC,12,15,25,15,SS_CENTERIMAGE\r
     COMBOBOX        IDC_PRINTERLIST,49,15,232,134,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
     PUSHBUTTON      "Flush print job",IDC_FLUSHPRINTER,114,51,58,12\r
@@ -380,22 +380,24 @@ BEGIN
     EDITTEXT        IDC_PRINTERAUTOFLUSH,255,50,25,12,ES_NUMBER\r
     RTEXT           "Type:",IDC_STATIC,15,33,21,15,SS_CENTERIMAGE\r
     EDITTEXT        IDC_PS_PARAMS,114,67,167,12,ES_AUTOHSCROLL\r
-    GROUPBOX        "Serial Port",IDC_STATIC,4,92,292,48\r
-    COMBOBOX        IDC_SERIAL,49,104,232,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    CONTROL         "Shared",IDC_SER_SHARED,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,15,123,48,12\r
-    CONTROL         "RTS/CTS",IDC_SER_CTSRTS,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,75,123,55,12\r
-    RTEXT           "Out:",IDC_MIDI,10,154,34,15,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_MIDIOUTLIST,49,154,232,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    RTEXT           "In:",IDC_MIDI2,10,174,29,15,SS_CENTERIMAGE\r
-    COMBOBOX        IDC_MIDIINLIST,49,174,232,134,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
+    GROUPBOX        "Serial Port",IDC_STATIC,4,110,292,48\r
+    COMBOBOX        IDC_SERIAL,49,122,232,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
+    CONTROL         "Shared",IDC_SER_SHARED,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,15,141,48,12\r
+    CONTROL         "RTS/CTS",IDC_SER_CTSRTS,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,75,141,55,12\r
+    RTEXT           "Out:",IDC_MIDI,10,172,19,15,SS_CENTERIMAGE\r
+    COMBOBOX        IDC_MIDIOUTLIST,36,173,108,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
+    RTEXT           "In:",IDC_MIDI2,150,171,22,15,SS_CENTERIMAGE\r
+    COMBOBOX        IDC_MIDIINLIST,181,173,108,134,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
     CONTROL         "Direct []Use when emulating serial-link games on two PCs running WinUAE",IDC_SER_DIRECT,\r
-                    "Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,135,123,65,12\r
-    CONTROL         "uaeserial.device",IDC_UAESERIAL,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,200,123,78,12\r
+                    "Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,135,141,65,12\r
+    CONTROL         "uaeserial.device",IDC_UAESERIAL,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,200,141,78,12\r
     COMBOBOX        IDC_PRINTERTYPELIST,49,33,232,134,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
     RTEXT           "Ghostscript extra parameters:",IDC_STATIC,10,66,102,15,SS_CENTERIMAGE\r
-    GROUPBOX        "MIDI",IDC_STATIC,5,143,291,51,BS_LEFT\r
+    GROUPBOX        "MIDI",IDC_STATIC,5,161,291,34,BS_LEFT\r
     GROUPBOX        "Protection Dongle",IDC_STATIC,5,197,292,30,BS_LEFT\r
     COMBOBOX        IDC_DONGLELIST,50,208,232,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
+    RTEXT           "Sampler:",IDC_STATIC,12,84,31,15,SS_CENTERIMAGE\r
+    COMBOBOX        IDC_SAMPLERLIST,49,85,232,134,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
 END\r
 \r
 IDD_GAMEPORTS DIALOGEX 0, 0, 300, 236\r
@@ -1155,6 +1157,14 @@ BEGIN
     BEGIN\r
     END\r
 \r
+    IDD_IOPORTS, DIALOG\r
+    BEGIN\r
+    END\r
+\r
+    IDD_GAMEPORTS, DIALOG\r
+    BEGIN\r
+    END\r
+\r
     IDD_MISC1, DIALOG\r
     BEGIN\r
     END\r
@@ -1175,6 +1185,10 @@ BEGIN
     IDD_DISK, DIALOG\r
     BEGIN\r
     END\r
+\r
+    IDD_FRONTEND, DIALOG\r
+    BEGIN\r
+    END\r
 END\r
 #endif    // APSTUDIO_INVOKED\r
 \r
index 8fb89b66aa4484f34b5b11625a80fb89ec38a41c..77568615413bb7b890685f7993bb85297d72dfd8 100644 (file)
@@ -2085,8 +2085,8 @@ int enumerate_sound_devices (void)
                        wasapi_enum (sound_devices);
                if ((1 || force_directsound || !os_vista) && (sounddrivermask & SOUNDDRIVER_DS)) {
                        DirectSoundEnumerate ((LPDSENUMCALLBACK)DSEnumProc, sound_devices);
-                       //DirectSoundCaptureEnumerate ((LPDSENUMCALLBACK)DSEnumProc, record_devices);
                }
+               DirectSoundCaptureEnumerate ((LPDSENUMCALLBACK)DSEnumProc, record_devices);
                if (sounddrivermask & SOUNDDRIVER_OPENAL) {
                        __try {
                                if (isdllversion (L"openal32.dll", 6, 14, 357, 22)) {
index 1e6c97bcfa59c21bea7fc4aed1e437ef34c3aa62..ec49c6751f20370bd1f2eb020ff31263269ffacc 100644 (file)
@@ -1,10 +1,10 @@
 /*
-  * UAE - The Un*x Amiga Emulator
-  *
-  * Support for Linux/USS sound
-  *
-  * Copyright 1997 Bernd Schmidt
-  */
+* UAE - The Un*x Amiga Emulator
+*
+* Support for Linux/USS sound
+*
+* Copyright 1997 Bernd Schmidt
+*/
 
 #define SOUNDSTUFF 1
 
@@ -32,16 +32,16 @@ struct sound_dp;
 
 struct sound_data
 {
-    int waiting_for_buffer;
-    int devicetype;
-    int obtainedfreq;
-    int paused;
-    int mute;
-    int channels;
-    int freq;
-    int samplesize;
-    int sndbufsize;
-    struct sound_dp *data;
+       int waiting_for_buffer;
+       int devicetype;
+       int obtainedfreq;
+       int paused;
+       int mute;
+       int channels;
+       int freq;
+       int samplesize;
+       int sndbufsize;
+       struct sound_dp *data;
 };
 
 
@@ -63,65 +63,65 @@ static uae_u16 *paula_sndbufpt_prev, *paula_sndbufpt_start;
 STATIC_INLINE void set_sound_buffers (void)
 {
 #if SOUNDSTUFF > 1
-    paula_sndbufpt_prev = paula_sndbufpt_start;
-    paula_sndbufpt_start = paula_sndbufpt;
+       paula_sndbufpt_prev = paula_sndbufpt_start;
+       paula_sndbufpt_start = paula_sndbufpt;
 #endif
 }
 
 STATIC_INLINE void check_sound_buffers (void)
 {
 #if SOUNDSTUFF > 1
-    int len;
+       int len;
 #endif
 
-    if (currprefs.sound_stereo == SND_4CH_CLONEDSTEREO) {
-       ((uae_u16*)paula_sndbufpt)[0] = ((uae_u16*)paula_sndbufpt)[-2];
-       ((uae_u16*)paula_sndbufpt)[1] = ((uae_u16*)paula_sndbufpt)[-1];
-       paula_sndbufpt = (uae_u16 *)(((uae_u8 *)paula_sndbufpt) + 2 * 2);
-    } else if (currprefs.sound_stereo == SND_6CH_CLONEDSTEREO) {
-       uae_s16 *p = ((uae_s16*)paula_sndbufpt);
-       uae_s32 sum;
-       p[2] = p[-2];
-       p[3] = p[-1];
-       sum = (uae_s32)(p[-2]) + (uae_s32)(p[-1]) + (uae_s32)(p[2]) + (uae_s32)(p[3]);
-       p[0] = sum / 8;
-       p[1] = sum / 8;
-       paula_sndbufpt = (uae_u16 *)(((uae_u8 *)paula_sndbufpt) + 4 * 2);
-    }
+       if (currprefs.sound_stereo == SND_4CH_CLONEDSTEREO) {
+               ((uae_u16*)paula_sndbufpt)[0] = ((uae_u16*)paula_sndbufpt)[-2];
+               ((uae_u16*)paula_sndbufpt)[1] = ((uae_u16*)paula_sndbufpt)[-1];
+               paula_sndbufpt = (uae_u16 *)(((uae_u8 *)paula_sndbufpt) + 2 * 2);
+       } else if (currprefs.sound_stereo == SND_6CH_CLONEDSTEREO) {
+               uae_s16 *p = ((uae_s16*)paula_sndbufpt);
+               uae_s32 sum;
+               p[2] = p[-2];
+               p[3] = p[-1];
+               sum = (uae_s32)(p[-2]) + (uae_s32)(p[-1]) + (uae_s32)(p[2]) + (uae_s32)(p[3]);
+               p[0] = sum / 8;
+               p[1] = sum / 8;
+               paula_sndbufpt = (uae_u16 *)(((uae_u8 *)paula_sndbufpt) + 4 * 2);
+       }
 #if SOUNDSTUFF > 1
-    if (outputsample == 0)
-       return;
-    len = paula_sndbufpt - paula_sndbufpt_start;
-    if (outputsample < 0) {
-       int i;
-        uae_s16 *p1 = (uae_s16*)paula_sndbufpt_prev;
-        uae_s16 *p2 = (uae_s16*)paula_sndbufpt_start;
-       for (i = 0; i < len; i++) {
-           *p1 = (*p1 + *p2) / 2;
+       if (outputsample == 0)
+               return;
+       len = paula_sndbufpt - paula_sndbufpt_start;
+       if (outputsample < 0) {
+               int i;
+               uae_s16 *p1 = (uae_s16*)paula_sndbufpt_prev;
+               uae_s16 *p2 = (uae_s16*)paula_sndbufpt_start;
+               for (i = 0; i < len; i++) {
+                       *p1 = (*p1 + *p2) / 2;
+               }
+               paula_sndbufpt = paula_sndbufpt_start;
        }
-       paula_sndbufpt = paula_sndbufpt_start;
-    }
 #endif
-    if ((uae_u8*)paula_sndbufpt - (uae_u8*)paula_sndbuffer >= paula_sndbufsize) {
-       finish_sound_buffer ();
-       paula_sndbufpt = paula_sndbuffer;
-    }
-#if SOUNDSTUFF > 1
-    while (doublesample-- > 0) {
-       memcpy (paula_sndbufpt, paula_sndbufpt_start, len * 2);
-       paula_sndbufpt += len;
        if ((uae_u8*)paula_sndbufpt - (uae_u8*)paula_sndbuffer >= paula_sndbufsize) {
-           finish_sound_buffer ();
-           paula_sndbufpt = paula_sndbuffer;
+               finish_sound_buffer ();
+               paula_sndbufpt = paula_sndbuffer;
+       }
+#if SOUNDSTUFF > 1
+       while (doublesample-- > 0) {
+               memcpy (paula_sndbufpt, paula_sndbufpt_start, len * 2);
+               paula_sndbufpt += len;
+               if ((uae_u8*)paula_sndbufpt - (uae_u8*)paula_sndbuffer >= paula_sndbufsize) {
+                       finish_sound_buffer ();
+                       paula_sndbufpt = paula_sndbuffer;
+               }
        }
-    }
 #endif
 }
 
 STATIC_INLINE void clear_sound_buffers (void)
 {
-    memset (paula_sndbuffer, 0, paula_sndbufsize);
-    paula_sndbufpt = paula_sndbuffer;
+       memset (paula_sndbuffer, 0, paula_sndbufsize);
+       paula_sndbufpt = paula_sndbuffer;
 }
 
 #define PUT_SOUND_WORD(b) do { *(uae_u16 *)paula_sndbufpt = b; paula_sndbufpt = (uae_u16 *)(((uae_u8 *)paula_sndbufpt) + 2); } while (0)
@@ -148,8 +148,8 @@ STATIC_INLINE void clear_sound_buffers (void)
 #define FILTER_SOUND_TYPE_A1200 1
 
 struct dsaudiomodes {
-    int ch;
-    DWORD ksmode;
+       int ch;
+       DWORD ksmode;
 };
 
 extern int sounddrivermask;
index bed40be9faffea337411ea22dc3c7ad5d73dbaba..8337231bb62d0253d48b700b9adce79f25d0dad1 100644 (file)
@@ -2471,6 +2471,7 @@ void target_default_options (struct uae_prefs *p, int type)
                p->win32_inactive_pause = 0;
                p->win32_ctrl_F11_is_quit = 0;
                p->win32_soundcard = 0;
+               p->win32_samplersoundcard = -1;
                p->win32_soundexclusive = 0;
                p->win32_minimize_inactive = 0;
                p->win32_active_priority = 1;
@@ -2555,6 +2556,12 @@ void target_save_options (struct zfile *f, struct uae_prefs *p)
        if (sound_devices[p->win32_soundcard].cfgname)
                cfgfile_target_dwrite_str (f, L"soundcardname", sound_devices[p->win32_soundcard].cfgname);
        cfgfile_target_dwrite_bool (f, L"soundcard_exclusive", p->win32_soundexclusive);
+       if (p->win32_samplersoundcard >= 0) {
+               cfgfile_target_dwrite (f, L"samplersoundcard", L"%d", p->win32_samplersoundcard);
+               if (record_devices[p->win32_samplersoundcard].cfgname)
+                       cfgfile_target_dwrite_str (f, L"samplersoundcardname", record_devices[p->win32_samplersoundcard].cfgname);
+       }
+
        cfgfile_target_dwrite (f, L"cpu_idle", L"%d", p->cpu_idle);
        cfgfile_target_dwrite_bool (f, L"notaskbarbutton", p->win32_notaskbarbutton);
        cfgfile_target_dwrite_bool (f, L"always_on_top", p->win32_alwaysontop);
@@ -2610,6 +2617,7 @@ int target_parse_option (struct uae_prefs *p, TCHAR *option, TCHAR *value)
                || cfgfile_intval (option, value, L"midiout_device", &p->win32_midioutdev, 1)
                || cfgfile_intval (option, value, L"midiin_device", &p->win32_midiindev, 1)
                || cfgfile_intval (option, value, L"soundcard", &p->win32_soundcard, 1)
+               || cfgfile_intval (option, value, L"samplersoundcard", &p->win32_samplersoundcard, 1)
                || cfgfile_yesno (option, value, L"soundcard_exclusive", &p->win32_soundexclusive)
                || cfgfile_yesno (option, value, L"notaskbarbutton", &p->win32_notaskbarbutton)
                || cfgfile_yesno (option, value, L"always_on_top", &p->win32_alwaysontop)
@@ -2653,6 +2661,29 @@ int target_parse_option (struct uae_prefs *p, TCHAR *option, TCHAR *value)
                        p->win32_soundcard = num;
                return 1;
        }
+       if (cfgfile_string (option, value, L"samplersoundcardname", tmpbuf, sizeof tmpbuf / sizeof (TCHAR))) {
+               int i, num;
+
+               num = p->win32_samplersoundcard;
+               p->win32_samplersoundcard = -1;
+               for (i = 0; record_devices[i].cfgname; i++) {
+                       if (i < num)
+                               continue;
+                       if (!_tcscmp (record_devices[i].cfgname, tmpbuf)) {
+                               p->win32_samplersoundcard = i;
+                               break;
+                       }
+               }
+               if (p->win32_samplersoundcard < 0) {
+                       for (i = 0; record_devices[i].cfgname; i++) {
+                               if (!_tcscmp (record_devices[i].cfgname, tmpbuf)) {
+                                       p->win32_samplersoundcard = i;
+                                       break;
+                               }
+                       }
+               }
+               return 1;
+       }
 
        if (cfgfile_yesno (option, value, L"aspi", &v)) {
                p->win32_uaescsimode = 0;
@@ -3088,8 +3119,7 @@ static int shell_deassociate (const TCHAR *extension)
        _tcscpy (rpath1, L"Software\\Classes\\");
        _tcscpy (rpath2, rpath1);
        _tcscat (rpath2, extension);
-       if (RegDeleteKey (rkey, rpath2) != ERROR_SUCCESS)
-               return 0;
+       RegDeleteKey (rkey, rpath2);
        _tcscpy (rpath2, rpath1);
        _tcscat (rpath2, progid);
        if (!def)
@@ -3101,7 +3131,7 @@ static int shell_deassociate (const TCHAR *extension)
        return 1;
 }
 
-static int shell_associate_2 (const TCHAR *extension, const TCHAR *shellcommand, const TCHAR *command, const TCHAR *perceivedtype,
+static int shell_associate_2 (const TCHAR *extension, TCHAR *shellcommand, TCHAR *command, struct contextcommand *cc, const TCHAR *perceivedtype,
        const TCHAR *description, const TCHAR *ext2, int icon)
 {
        TCHAR rpath1[MAX_DPATH], rpath2[MAX_DPATH], progid2[MAX_DPATH];
@@ -3157,19 +3187,40 @@ static int shell_associate_2 (const TCHAR *extension, const TCHAR *shellcommand,
                        RegCloseKey (key1);
                }
        }
-       if (command) {
-               _tcscat (rpath2, L"\\shell\\");
-               if (shellcommand)
-                       _tcscat (rpath2, shellcommand);
-               else
-                       _tcscat (rpath2, L"open");
-               _tcscat (rpath2, L"\\command");
-               if (RegCreateKeyEx (rkey, rpath2, 0, NULL, REG_OPTION_NON_VOLATILE,
-                       KEY_WRITE | KEY_READ, NULL, &key1, &disposition) == ERROR_SUCCESS) {
-                               TCHAR path[MAX_DPATH];
-                               _stprintf (path, L"\"%sWinUAE.exe\" %s", start_path_exe, command);
-                               RegSetValueEx (key1, L"", 0, REG_SZ, (CONST BYTE *)path, (_tcslen (path) + 1) * sizeof (TCHAR));
-                               RegCloseKey (key1);
+       cc = NULL;
+       struct contextcommand ccs[2];
+       if ((command || shellcommand)) {
+               ccs[0].command = command;
+               ccs[0].shellcommand = shellcommand;
+               ccs[1].command = NULL;
+               cc = &ccs[0];
+       }
+       if (cc) {
+               TCHAR path2[MAX_DPATH];
+               for (int i = 0; cc[i].command; i++) {
+                       _tcscpy (path2, rpath2);
+                       _tcscat (path2, L"\\shell\\");
+                       if (cc[i].shellcommand)
+                               _tcscat (path2, cc[i].shellcommand);
+                       else
+                               _tcscat (path2, L"open");
+                       if (cc[i].icon) {
+                               if (RegCreateKeyEx (rkey, path2, 0, NULL, REG_OPTION_NON_VOLATILE,
+                                       KEY_WRITE | KEY_READ, NULL, &key1, &disposition) == ERROR_SUCCESS) {
+                                               TCHAR tmp[MAX_DPATH];
+                                               _stprintf (tmp, L"%s,%d", _wpgmptr, -cc[i].icon);
+                                               RegSetValueEx (key1, L"Icon", 0, REG_SZ, (CONST BYTE *)tmp, (_tcslen (tmp) + 1) * sizeof (TCHAR));
+                                               RegCloseKey (key1);
+                               }
+                       }
+                       _tcscat (path2, L"\\command");
+                       if (RegCreateKeyEx (rkey, path2, 0, NULL, REG_OPTION_NON_VOLATILE,
+                               KEY_WRITE | KEY_READ, NULL, &key1, &disposition) == ERROR_SUCCESS) {
+                                       TCHAR path[MAX_DPATH];
+                                       _stprintf (path, L"\"%sWinUAE.exe\" %s", start_path_exe, cc[i].command);
+                                       RegSetValueEx (key1, L"", 0, REG_SZ, (CONST BYTE *)path, (_tcslen (path) + 1) * sizeof (TCHAR));
+                                       RegCloseKey (key1);
+                       }
                }
        }
        fkey = regcreatetree (NULL, L"FileAssociations");
@@ -3177,11 +3228,11 @@ static int shell_associate_2 (const TCHAR *extension, const TCHAR *shellcommand,
        regclosetree (fkey);
        return 1;
 }
-static int shell_associate (const TCHAR *extension, const TCHAR *command, const TCHAR *perceivedtype, const TCHAR *description, const TCHAR *ext2, int icon)
+static int shell_associate (const TCHAR *extension, TCHAR *command, struct contextcommand *cc, const TCHAR *perceivedtype, const TCHAR *description, const TCHAR *ext2, int icon)
 {
-       int v = shell_associate_2 (extension, NULL, command, perceivedtype, description, ext2, icon);
+       int v = shell_associate_2 (extension, NULL, command, cc, perceivedtype, description, ext2, icon);
        if (!_tcscmp (extension, L".uae"))
-               shell_associate_2 (extension, L"edit", L"-f \"%1\" -s use_gui=yes", L"text", description, NULL, 0);
+               shell_associate_2 (extension, L"edit", L"-f \"%1\" -s use_gui=yes", NULL, L"text", description, NULL, 0);
        return v;
 }
 
@@ -3224,15 +3275,26 @@ static int shell_associate_is (const TCHAR *extension)
        }
        return 0;
 }
-
+static struct contextcommand cc_cd[] = {
+       { L"CDTV", L"-cdimage=\"%1\" -s use_gui=no -cfgparam=quickstart=CDTV,0", IDI_APPICON },
+       { L"CD32", L"-cdimage=\"%1\" -s use_gui=no -cfgparam=quickstart=CD32,0", IDI_APPICON },
+       { NULL }
+};
+static struct  contextcommand cc_disk[] = {
+       { L"A500", L"-0 \"%1\" -s use_gui=no -cfgparam=quickstart=A500,0", IDI_DISKIMAGE },
+       { L"A1200", L"-0 \"%1\" -s use_gui=no -cfgparam=quickstart=A1200,0", IDI_DISKIMAGE },
+       { NULL }
+};
 struct assext exts[] = {
-       { L".uae", L"-f \"%1\"", L"WinUAE configuration file", IDI_CONFIGFILE },
-       { L".adf", L"-0 \"%1\" -s use_gui=no", L"WinUAE floppy disk image", IDI_DISKIMAGE },
-       { L".adz", L"-0 \"%1\" -s use_gui=no", L"WinUAE floppy disk image", IDI_DISKIMAGE },
-       { L".dms", L"-0 \"%1\" -s use_gui=no", L"WinUAE floppy disk image", IDI_DISKIMAGE },
-       { L".fdi", L"-0 \"%1\" -s use_gui=no", L"WinUAE floppy disk image", IDI_DISKIMAGE },
-       { L".ipf", L"-0 \"%1\" -s use_gui=no", L"WinUAE floppy disk image", IDI_DISKIMAGE },
-       { L".uss", L"-s statefile=\"%1\" -s use_gui=no", L"WinUAE statefile", IDI_APPICON },
+//     { L".cue", L"-cdimage=\"%1\" -s use_gui=no", L"WinUAE CD image", IDI_DISKIMAGE, cc_cd },
+//     { L".iso", L"-cdimage=\"%1\" -s use_gui=no", L"WinUAE CD image", IDI_DISKIMAGE, cc_cd },
+       { L".uae", L"-f \"%1\"", L"WinUAE configuration file", IDI_CONFIGFILE, NULL },
+       { L".adf", L"-0 \"%1\" -s use_gui=no", L"WinUAE floppy disk image", IDI_DISKIMAGE, cc_disk },
+       { L".adz", L"-0 \"%1\" -s use_gui=no", L"WinUAE floppy disk image", IDI_DISKIMAGE, cc_disk },
+       { L".dms", L"-0 \"%1\" -s use_gui=no", L"WinUAE floppy disk image", IDI_DISKIMAGE, cc_disk },
+       { L".fdi", L"-0 \"%1\" -s use_gui=no", L"WinUAE floppy disk image", IDI_DISKIMAGE, cc_disk },
+       { L".ipf", L"-0 \"%1\" -s use_gui=no", L"WinUAE floppy disk image", IDI_DISKIMAGE, cc_disk },
+       { L".uss", L"-s statefile=\"%1\" -s use_gui=no", L"WinUAE statefile", IDI_APPICON, NULL },
        { NULL }
 };
 
@@ -3251,7 +3313,7 @@ static void associate_init_extensions (void)
        if (!regexiststree (NULL, L"FileAssociations")) {
                UAEREG *fkey;
                if (exts[0].enabled == 0) {
-                       shell_associate (exts[0].ext, exts[0].cmd, NULL, exts[0].desc, NULL, exts[0].icon);
+                       shell_associate (exts[0].ext, exts[0].cmd, exts[0].cc, NULL, exts[0].desc, NULL, exts[0].icon);
                        exts[0].enabled = shell_associate_is (exts[0].ext);
                }
                fkey = regcreatetree (NULL, L"FileAssociations");
@@ -3343,10 +3405,10 @@ void associate_file_extensions (void)
                        exts[i].enabled = shell_associate_is (exts[i].ext);
                        if (exts[i].enabled) {
                                modified = 1;
-                               shell_associate (exts[i].ext, exts[i].cmd, NULL, exts[i].desc, NULL, exts[i].icon);
+                               shell_associate (exts[i].ext, exts[i].cmd, exts[i].cc, NULL, exts[i].desc, NULL, exts[i].icon);
                        }
                } else if (exts[i].enabled) {
-                       shell_associate (exts[i].ext, exts[i].cmd, NULL, exts[i].desc, NULL, exts[i].icon);
+                       shell_associate (exts[i].ext, exts[i].cmd, exts[i].cc, NULL, exts[i].desc, NULL, exts[i].icon);
                        exts[i].enabled = shell_associate_is (exts[i].ext);
                        if (exts[i].enabled != already)
                                modified = 1;
@@ -4151,6 +4213,9 @@ static int process_arg (TCHAR *cmdline, TCHAR **xargv, TCHAR ***xargv3)
                        case ZFILE_STATEFILE:
                                _stprintf (tmp, L"-statefile=%s", f);
                                break;
+                       case ZFILE_CDIMAGE:
+                               _stprintf (tmp, L"-cdimage=%s", f);
+                               break;
                        case ZFILE_DISKIMAGE:
                                if (fd < 4)
                                        _stprintf (tmp, L"-cfgparam=floppy%d=%s", fd++, f);
index 42eb4bd2d5fb7d02a3be6e0f041a947be748ab6b..79f0cdf8bc2d7f0d3dc5c6eec067c190d442843a 100644 (file)
@@ -18,8 +18,8 @@
 #define WINUAEPUBLICBETA 1
 #define LANG_DLL 1
 
-#define WINUAEBETA L"18"
-#define WINUAEDATE MAKEBD(2010, 3, 20)
+#define WINUAEBETA L"19"
+#define WINUAEDATE MAKEBD(2010, 3, 27)
 #define WINUAEEXTRA L""
 #define WINUAEREV L""
 
@@ -172,11 +172,18 @@ struct sound_device
 extern struct sound_device sound_devices[MAX_SOUND_DEVICES];
 extern struct sound_device record_devices[MAX_SOUND_DEVICES];
 
+struct contextcommand
+{
+       TCHAR *shellcommand;
+       TCHAR *command;
+       int icon;
+};
 struct assext {
     TCHAR *ext;
     TCHAR *cmd;
     TCHAR *desc;
     int icon;
+       struct contextcommand *cc;
     int enabled;
 };
 struct assext exts[];
index d4bc039fed4fe18b78a88d18a7e2ef23bf361576..1bdb7d0bb36ec89ed23ede0266f5de1f4ce2d52c 100644 (file)
@@ -9779,6 +9779,7 @@ static void enable_for_gameportsdlg (HWND hDlg)
 static void enable_for_portsdlg (HWND hDlg)
 {
        int v;
+       int isprinter, issampler;
 
        v = workprefs.input_selected_setting > 0 ? FALSE : TRUE;
        ew (hDlg, IDC_SWAP, v);
@@ -9797,18 +9798,26 @@ static void enable_for_portsdlg (HWND hDlg)
        ew (hDlg, IDC_SER_DIRECT, v);
        ew (hDlg, IDC_UAESERIAL, full_property_sheet);
 #endif
+       isprinter = true;
+       issampler = true;
 #if !defined (PARALLEL_PORT)
-       ew (hDlg, IDC_PRINTERLIST, FALSE);
-       ew (hDlg, IDC_FLUSHPRINTER, FALSE);
-       ew (hDlg, IDC_PSPRINTER, FALSE);
-       ew (hDlg, IDC_PS_PARAMS, FALSE);
-       ew (hDlg, IDC_PRINTER_AUTOFLUSH, FALSE);
-#else
-       ew (hDlg, IDC_FLUSHPRINTER, isprinteropen () ? TRUE : FALSE);
-       ew (hDlg, IDC_PSPRINTER, full_property_sheet && ghostscript_available ? TRUE : FALSE);
-       ew (hDlg, IDC_PSPRINTERDETECT, full_property_sheet ? TRUE : FALSE);
-       ew (hDlg, IDC_PS_PARAMS, full_property_sheet && ghostscript_available);
+       isprinter = false;
+       issampler = false;
 #endif
+       if (workprefs.prtname[0]) {
+               issampler = false;
+               workprefs.win32_samplersoundcard = -1;
+       } else if (workprefs.win32_samplersoundcard >= 0) {
+               isprinter = false;
+       }
+       ew (hDlg, IDC_PRINTERLIST, isprinter);
+       ew (hDlg, IDC_SAMPLERLIST, issampler);
+       ew (hDlg, IDC_PRINTERAUTOFLUSH, isprinter);
+       ew (hDlg, IDC_PRINTERTYPELIST, isprinter);
+       ew (hDlg, IDC_FLUSHPRINTER, isprinteropen () && isprinter ? TRUE : FALSE);
+       ew (hDlg, IDC_PSPRINTER, full_property_sheet && ghostscript_available && isprinter ? TRUE : FALSE);
+       ew (hDlg, IDC_PSPRINTERDETECT, full_property_sheet && isprinter ? TRUE : FALSE);
+       ew (hDlg, IDC_PS_PARAMS, full_property_sheet && ghostscript_available && isprinter);
 }
 
 static int joys[] = { IDC_PORT0_JOYS, IDC_PORT1_JOYS, IDC_PORT2_JOYS, IDC_PORT3_JOYS };
@@ -9970,11 +9979,19 @@ static void values_from_portsdlg (HWND hDlg)
        BOOL success;
        LRESULT item;
 
+       item = SendDlgItemMessage (hDlg, IDC_SAMPLERLIST, CB_GETCURSEL, 0, 0L);
+       if(item != CB_ERR) {
+               workprefs.win32_samplersoundcard = item - 1;
+               if (item > 0)
+                       workprefs.prtname[0] = 0;
+       }
+
        item = SendDlgItemMessage (hDlg, IDC_PRINTERLIST, CB_GETCURSEL, 0, 0L);
        if(item != CB_ERR) {
                int got = 0;
                _tcscpy (tmp, workprefs.prtname);
                if (item > 0) {
+                       workprefs.win32_samplersoundcard = -1;
                        item--;
                        if (item < dwEnumeratedPrinters) {
                                _tcscpy (workprefs.prtname, pInfo[item].pName);
@@ -10045,9 +10062,12 @@ static void values_from_portsdlg (HWND hDlg)
 
 static void values_to_portsdlg (HWND hDlg)
 {
-       LRESULT result = 0;
+       LRESULT result;
        int idx;
 
+       SendDlgItemMessage (hDlg, IDC_SAMPLERLIST, CB_SETCURSEL, workprefs.win32_samplersoundcard + 1, 0);
+
+       result = 0;
        if(workprefs.prtname[0]) {
                int i, got = 1;
                TCHAR tmp[10];
@@ -10174,6 +10194,19 @@ static void init_portsdlg (HWND hDlg)
        WIN32GUI_LoadUIString (IDS_PRINTER_POSTSCRIPT_EMULATION, tmp, MAX_DPATH);
        SendDlgItemMessage (hDlg, IDC_PRINTERTYPELIST, CB_ADDSTRING, 0, (LPARAM)tmp);
 
+       SendDlgItemMessage (hDlg, IDC_SAMPLERLIST, CB_RESETCONTENT, 0, 0L);
+       SendDlgItemMessage (hDlg, IDC_SAMPLERLIST, CB_ADDSTRING, 0, (LPARAM)szNone);
+       enumerate_sound_devices ();
+       for (int card = 0; record_devices[card].type; card++) {
+               int type = record_devices[card].type;
+               TCHAR tmp[MAX_DPATH];
+               _stprintf (tmp, L"%s: %s",
+                       type == SOUND_DEVICE_DS ? L"DSOUND" : (type == SOUND_DEVICE_AL ? L"OpenAL" : (type == SOUND_DEVICE_PA ? L"PortAudio" : L"WASAPI")),
+                       record_devices[card].name);
+               if (type == SOUND_DEVICE_DS)
+                       SendDlgItemMessage (hDlg, IDC_SAMPLERLIST, CB_ADDSTRING, 0, (LPARAM)tmp);
+       }
+
        SendDlgItemMessage (hDlg, IDC_PRINTERLIST, CB_RESETCONTENT, 0, 0L);
        SendDlgItemMessage (hDlg, IDC_PRINTERLIST, CB_ADDSTRING, 0, (LPARAM)szNone);
        if(!pInfo) {
@@ -10380,6 +10413,7 @@ static INT_PTR CALLBACK IOPortsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR
                        if (HIWORD (wParam) == CBN_SELCHANGE) {
                                switch (LOWORD (wParam))
                                {
+                               case IDC_SAMPLERLIST:
                                case IDC_PRINTERLIST:
                                case IDC_SERIAL:
                                case IDC_MIDIOUTLIST:
@@ -10388,6 +10422,7 @@ static INT_PTR CALLBACK IOPortsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR
                                        values_from_portsdlg (hDlg);
                                        inputdevice_updateconfig (&workprefs);
                                        inputdevice_config_change ();
+                                       enable_for_portsdlg (hDlg);
                                        break;
                                case IDC_PRINTERTYPELIST:
                                        {
@@ -12038,7 +12073,7 @@ static int ignorewindows[] = {
        -1,
        IDD_PATHS, IDC_PATHS_ROM, IDC_PATHS_CONFIG, IDC_PATHS_SCREENSHOT, IDC_PATHS_SAVESTATE, IDC_PATHS_AVIOUTPUT, IDC_PATHS_SAVEIMAGE, IDC_PATHS_RIP,
        -1,
-       IDD_IOPORTS, IDC_PRINTERLIST, IDC_PS_PARAMS, IDC_SERIAL, IDC_MIDIOUTLIST, IDC_MIDIINLIST,
+       IDD_IOPORTS, IDC_PRINTERLIST, IDC_SAMPLERLIST, IDC_PS_PARAMS, IDC_SERIAL, IDC_MIDIOUTLIST, IDC_MIDIINLIST,
        -1,
        IDD_SOUND, IDC_SOUNDCARDLIST, IDC_SOUNDDRIVESELECT,
        -1,
index a54543a788aabfbdcade9c11858352a837491293..d5590305ebb5ecf33d4e332c0ea793f8a8cf04a8 100644 (file)
 #include "options.h"
 #include "events.h"
 #include "custom.h"
+#include "sampler.h"
 
 #include "dxwrap.h"
 
 #include <dsound.h>
 
+#include "win32.h"
+
 #define RECORDBUFFER (10000 * 4)
-#define SAMPLEBUFFER (1024 * 4)
+#define SAMPLEBUFFER (2048 * 4)
 
 static LPDIRECTSOUNDCAPTURE lpDS2r = NULL;
 static LPDIRECTSOUNDCAPTUREBUFFER lpDSBprimary2r = NULL;
@@ -25,6 +28,7 @@ static int inited;
 static uae_u8 *samplebuffer;
 static int samplerate = 44100;
 static float clockspersample;
+static int vsynccnt;
 
 static int capture_init (void)
 {
@@ -40,7 +44,7 @@ static int capture_init (void)
        wavfmt.nAvgBytesPerSec = wavfmt.nBlockAlign * wavfmt.nSamplesPerSec;
        wavfmt.cbSize = 0;
 
-       hr = DirectSoundCaptureCreate (NULL, &lpDS2r, NULL);
+       hr = DirectSoundCaptureCreate (&record_devices[currprefs.win32_samplersoundcard].guid, &lpDS2r, NULL);
        if (FAILED (hr)) {
                write_log (L"SAMPLER: DirectSoundCaptureCreate() failure: %s\n", DXError (hr));
                return 0;
@@ -72,6 +76,7 @@ static void capture_free (void)
        if (lpDSB2r) {
                lpDSB2r->Stop ();
                lpDSB2r->Release ();
+               write_log (L"SAMPLER: Parallel port sampler freed\n");
        }
        lpDSB2r = NULL;
        if (lpDS2r)
@@ -92,22 +97,33 @@ uae_u8 sampler_getsample (void)
        DWORD len1, len2;
        evt cycles;
        int offset;
-       int sample, samplecnt;
+       int sample, samplecnt, diff;
+       int channel = 0;
        uae_s16 *sbuf = (uae_s16*)samplebuffer;
 
        if (!inited) {
-               if (!capture_init ())
+               if (!capture_init ()) {
+                       capture_free ();
                        return 0;
+               }
                inited = 1;
+               oldcycles = get_cycles ();
+               oldoffset = -1;
+               hr = lpDSB2r->GetCurrentPosition (&t, &cap_pos);
+               if (FAILED (hr)) {
+                       sampler_free ();
+                       return 0;
+               }       
        }
+       vsynccnt = 0;
        sample = 0;
        samplecnt = 0;
        cycles = get_cycles () - oldcycles;
        offset = cycles / clockspersample;
-       if (offset >= SAMPLEBUFFER || offset < 0) {
-               if (offset >= SAMPLEBUFFER) {
+       if (oldoffset < 0 || offset >= SAMPLEBUFFER || offset < 0) {
+               if (oldoffset >= 0 && offset >= SAMPLEBUFFER) {
                        while (oldoffset < SAMPLEBUFFER) {
-                               sample += sbuf[oldoffset * 2];
+                               sample += sbuf[oldoffset * 2 + channel];
                                oldoffset++;
                                samplecnt++;
                        }
@@ -117,6 +133,16 @@ uae_u8 sampler_getsample (void)
                hr = lpDSB2r->GetCurrentPosition (&t, &cur_pos);
                if (FAILED (hr))
                        return 0;
+               write_log (L"%d\n", cur_pos - cap_pos);
+               if (cur_pos >= cap_pos)
+                       diff = cur_pos - cap_pos;
+               else
+                       diff = RECORDBUFFER - cap_pos + cur_pos;
+               if (diff > SAMPLEBUFFER * 4) {
+                       cap_pos = cur_pos;
+                       oldoffset = 0;
+                       oldcycles = get_cycles ();
+               }
                hr = lpDSB2r->Lock (cap_pos, SAMPLEBUFFER, &p1, &len1, &p2, &len2, 0);
                if (FAILED (hr))
                        return 0;
@@ -124,10 +150,18 @@ uae_u8 sampler_getsample (void)
                if (p2)
                        memcpy (samplebuffer + len1, p2, len2);
                lpDSB2r->Unlock (p1, len1, p2, len2);
+               cap_pos += SAMPLEBUFFER;
+               cap_pos += diff;
+               if (cap_pos >= RECORDBUFFER)
+                       cap_pos -= RECORDBUFFER;
+               if (cap_pos < 0)
+                       cap_pos = 0;
                offset = 0;
+               if (oldoffset < 0)
+                       oldoffset = 0;
        }
        while (oldoffset <= offset) {
-               sample += ((uae_s16*)samplebuffer)[oldoffset * 2];
+               sample += ((uae_s16*)samplebuffer)[oldoffset * 2 + channel];
                oldoffset++;
                samplecnt++;
        }
@@ -140,8 +174,7 @@ uae_u8 sampler_getsample (void)
 int sampler_init (void)
 {
        clockspersample = (float)maxvpos * maxhpos * vblank_hz * CYCLE_UNIT / samplerate;
-       oldcycles = get_cycles ();
-       if (!currprefs.parallel_sampler)
+       if (currprefs.win32_samplersoundcard < 0)
                return 0;
        return 1;
 }
@@ -149,6 +182,17 @@ int sampler_init (void)
 void sampler_free (void)
 {
        inited = 0;
+       vsynccnt = 0;
        capture_free ();
 }
 
+void sampler_vsync (void)
+{
+       if (!inited)
+               return;
+       vsynccnt++;
+       if (vsynccnt > 50) {
+               sampler_free ();
+               return;
+       }
+}
\ No newline at end of file
index 419f50d972ade90c91c53cffffd9ce6d6207ac35..094e0a520c4766f2c145804f6bf8000ec15de4d4 100644 (file)
--- a/zfile.cpp
+++ b/zfile.cpp
@@ -268,7 +268,7 @@ int zfile_gettype (struct zfile *z)
                        return ZFILE_NVR;
                if (strcasecmp (ext, L"uae") == 0)
                        return ZFILE_CONFIGURATION;
-               if (strcasecmp (ext, L"cue") == 0)
+               if (strcasecmp (ext, L"cue") == 0 || strcasecmp (ext, L"iso") == 0)
                        return ZFILE_CDIMAGE;
        }
        memset (buf, 0, sizeof (buf));