]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
2500b18
authorToni Wilen <twilen@winuae.net>
Sun, 23 Sep 2012 13:00:25 +0000 (16:00 +0300)
committerToni Wilen <twilen@winuae.net>
Sun, 23 Sep 2012 13:00:25 +0000 (16:00 +0300)
22 files changed:
cfgfile.cpp
custom.cpp
drawing.cpp
gencpu.cpp
gfxutil.cpp
include/newcpu.h
include/options.h
inputdevice.cpp
newcpu.cpp
od-win32/dinput.cpp
od-win32/direct3d.cpp
od-win32/midi.cpp
od-win32/resources/resource.h
od-win32/resources/winuae.rc
od-win32/win32.cpp
od-win32/win32.h
od-win32/win32_scaler.cpp
od-win32/win32gfx.cpp
od-win32/win32gui.cpp
od-win32/win32gui_extra.cpp
od-win32/winuaechangelog.txt
table68k

index ef171a91ab2a45a2e0e5f88a8a4ebedd274228f0..49eb037d1f80eeee15882f9c1f6ba0ea2bda9ae7 100644 (file)
@@ -4060,7 +4060,7 @@ uae_u8 *save_configuration (int *len, bool fullconfig)
                        char *out;
                        if (!fullconfig && !_tcsncmp (tmpout, _T("input."), 6))
                                continue;
-                       write_log (_T("'%s'\n"), tmpout);
+                       //write_log (_T("'%s'\n"), tmpout);
                        out = uutf8 (tmpout);
                        strcpy ((char*)p, out);
                        xfree (out);
index 52735ecf53db5720c1d957d30214a51d8973b074..0d903dec27d7c1b72cce439d3a3db1cd1ed748a1 100644 (file)
@@ -5366,18 +5366,25 @@ static void rtg_vsynccheck (void)
 
 
 // moving average algorithm
-#define MAVG_SIZE 128
+#define MAVG_MAX_SIZE 128
 struct mavg_data
 {
-       int values[MAVG_SIZE];
+       int values[MAVG_MAX_SIZE];
        int size;
        int offset;
        int mavg;
 };
 
-static int mavg (struct mavg_data *md, int newval)
+static void mavg_clear (struct mavg_data *md)
 {
-       if (md->size < MAVG_SIZE) {
+       md->size = 0;
+       md->offset = 0;
+       md->mavg = 0;
+}
+
+static int mavg (struct mavg_data *md, int newval, int size)
+{
+       if (md->size < size) {
                md->values[md->size++] = newval;
                md->mavg += newval;
        } else {
@@ -5385,12 +5392,14 @@ static int mavg (struct mavg_data *md, int newval)
                md->values[md->offset] = newval;
                md->mavg += newval;
                md->offset++;
-               if (md->offset >= MAVG_SIZE)
-                       md->offset -= MAVG_SIZE;
+               if (md->offset >= size)
+                       md->offset -= size;
        }
        return md->mavg / md->size;
 }
 
+#define MAVG_VSYNC_SIZE 128
+
 extern int log_vsync, debug_vsync_min_delay, debug_vsync_forced_delay;
 static bool framewait (void)
 {
@@ -5402,7 +5411,7 @@ static bool framewait (void)
        is_syncline = 0;
 
        static struct mavg_data ma_frameskipt;
-       int frameskipt_avg = mavg (&ma_frameskipt, frameskiptime);
+       int frameskipt_avg = mavg (&ma_frameskipt, frameskiptime, MAVG_VSYNC_SIZE);
 
        frameskiptime = 0;
 
@@ -5425,7 +5434,7 @@ static bool framewait (void)
                if (!frame_shown)
                        show_screen ();
 
-               int legacy_avg = mavg (&ma_legacy, t);
+               int legacy_avg = mavg (&ma_legacy, t, MAVG_VSYNC_SIZE);
                if (t > legacy_avg)
                        legacy_avg = t;
                t = legacy_avg;
@@ -5492,11 +5501,11 @@ static bool framewait (void)
                        if (adjust > vsynctimebase * 2 / 3)
                                adjust = vsynctimebase * 2 / 3;
                        
-                       int adjust_avg = mavg (&ma_adjust, adjust);
+                       int adjust_avg = mavg (&ma_adjust, adjust, MAVG_VSYNC_SIZE);
                        
                        val += adjust_avg;
 
-                       int flipdelay_avg = mavg (&ma_skip, flipdelay);
+                       int flipdelay_avg = mavg (&ma_skip, flipdelay, MAVG_VSYNC_SIZE);
                        if (flipdelay > flipdelay_avg)
                                flipdelay_avg = flipdelay;
                        if (currprefs.gfx_apmode[0].gfx_vflip == 0) {
@@ -5568,7 +5577,7 @@ static bool framewait (void)
                        vsyncwaittime = curr_time + vsynctimebase;
 
                        if (currprefs.gfx_apmode[0].gfx_vflip == 0) {
-                               flipdelay_avg = mavg (&ma_skip, flipdelay);
+                               flipdelay_avg = mavg (&ma_skip, flipdelay, MAVG_VSYNC_SIZE);
                                if (flipdelay > flipdelay_avg)
                                        flipdelay_avg = flipdelay;
                        } else {
@@ -5710,36 +5719,41 @@ static bool framewait (void)
        return status != 0;
 }
 
-
-static frame_time_t frametime2;
+#define FPSCOUNTER_MAVG_SIZE 10
+static struct mavg_data fps_mavg, idle_mavg;
 
 void fpscounter_reset (void)
 {
        timeframes = 0;
-       frametime2 = 0;
+       mavg_clear (&fps_mavg);
+       mavg_clear (&idle_mavg);
        bogusframe = 2;
        lastframetime = read_processor_time ();
        idletime = 0;
 }
 
+
 static void fpscounter (bool frameok)
 {
        frame_time_t now, last;
-       int mcnt = 10;
 
        now = read_processor_time ();
        last = now - lastframetime;
        lastframetime = now;
 
-       if (bogusframe)
+       if (bogusframe || (int)last < 0)
                return;
 
+       mavg (&fps_mavg, last / 10, FPSCOUNTER_MAVG_SIZE);
+       mavg (&idle_mavg, idletime / 10, FPSCOUNTER_MAVG_SIZE);
+       idletime = 0;
+
        frametime += last;
-       frametime2 += last;
        timeframes++;
-       if ((timeframes % mcnt) == 0) {
-               double idle = 1000 - (idletime == 0 ? 0.0 : (double)idletime * 1000.0 / (vsynctimebase * mcnt));
-               int fps = frametime2 == 0 ? 0 : (syncbase * mcnt) / (frametime2 / 10);
+
+       if ((timeframes & 7) == 0) {
+               double idle = 1000 - (idle_mavg.mavg == 0 ? 0.0 : (double)idle_mavg.mavg * 1000.0 / vsynctimebase);
+               int fps = fps_mavg.mavg == 0 ? 0 : syncbase * 10 / fps_mavg.mavg;
                if (fps > 9999)
                        fps = 9999;
                if (idle < 0)
@@ -5752,9 +5766,12 @@ static void fpscounter (bool frameok)
                }
                if (currprefs.turbo_emulation && idle < 100 * 10)
                        idle = 100 * 10;
-               gui_fps (fps, (int)idle, frameok ? 0 : 1);
-               frametime2 = 0;
-               idletime = 0;
+               gui_data.fps = fps;
+               gui_data.idle = (int)idle;
+               gui_data.fps_color = frameok ? 0 : 1;
+               if ((timeframes & 15) == 0) {
+                       gui_fps (fps, (int)idle, frameok ? 0 : 1);
+               }
        }
 }
 
index fc46466bcc99ab55ca505c3e6bc8a00353527267..ffb2c583f49699f57fddabfe1e7c84164e06ec69 100644 (file)
@@ -85,6 +85,7 @@ static int linedbl, linedbld;
 int interlace_seen = 0;
 #define AUTO_LORES_FRAMES 10
 static int can_use_lores = 0, frame_res, frame_res_lace, last_max_ypos;
+static bool center_reset;
 
 /* Lookup tables for dual playfields.  The dblpf_*1 versions are for the case
 that playfield 1 has the priority, dbplpf_*2 are used if playfield 2 has
@@ -544,6 +545,7 @@ int get_custom_limits (int *pw, int *ph, int *pdx, int *pdy, int *prealh)
                plffirstline_total, plflastline_total,
                first_planes_vpos, last_planes_vpos, minfirstline);
 #endif
+       center_reset = true;
        return 1;
 }
 
@@ -2333,7 +2335,7 @@ static void center_image (void)
                /* Would the old value be good enough? If so, leave it as it is if we want to
                * be clever. */
                if (currprefs.gfx_xcenter == 2) {
-                       if (visible_left_border < prev_x_adjust && prev_x_adjust < min_diwstart && min_diwstart - visible_left_border <= 32)
+                       if (center_reset || (visible_left_border < prev_x_adjust && prev_x_adjust < min_diwstart && min_diwstart - visible_left_border <= 32))
                                visible_left_border = prev_x_adjust;
                }
        } else if (gfxvidinfo.drawbuffer.extrawidth) {
@@ -2373,9 +2375,9 @@ static void center_image (void)
                /* Would the old value be good enough? If so, leave it as it is if we want to
                * be clever. */
                if (currprefs.gfx_ycenter == 2) {
-                       if (thisframe_y_adjust != prev_y_adjust
+                       if (center_reset || (thisframe_y_adjust != prev_y_adjust
                                && prev_y_adjust <= thisframe_first_drawn_line
-                               && prev_y_adjust + max_drawn_amiga_line > thisframe_last_drawn_line)
+                               && prev_y_adjust + max_drawn_amiga_line > thisframe_last_drawn_line))
                                thisframe_y_adjust = prev_y_adjust;
                }
        }
@@ -2405,6 +2407,7 @@ static void center_image (void)
 
        gfxvidinfo.drawbuffer.xoffset = (DISPLAY_LEFT_SHIFT << RES_MAX) + (visible_left_border << (RES_MAX - currprefs.gfx_resolution));
        gfxvidinfo.drawbuffer.yoffset = thisframe_y_adjust << VRES_MAX;
+       center_reset = false;
 }
 
 #define FRAMES_UNTIL_RES_SWITCH 1
@@ -3057,6 +3060,8 @@ void reset_drawing (void)
 
        clearbuffer (&gfxvidinfo.drawbuffer);
        clearbuffer (&gfxvidinfo.tempbuffer);
+
+       center_reset = true;
 }
 
 void drawing_init (void)
index 0145d2f169c0752036df7da4a08974ca1b632b83..31fc9373e14a7cf986dc2aa083e1c4f5dcd6c00c 100644 (file)
@@ -2370,11 +2370,19 @@ static void gen_opcode (unsigned long int opcode)
        case i_BSR:
                // .b and .w confirmed
                printf ("\tuae_s32 s;\n");
-               genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, GF_AA|GF_NOREFILL);
+               if (curi->size == sz_long) {
+                       if (next_cpu_level < 1)
+                               next_cpu_level = 1;
+               }
+               if (curi->size == sz_long && cpu_level < 2) {
+                       printf ("\tuae_u32 src = 0xffffffff;\n");
+               } else {
+                       genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, GF_AA|GF_NOREFILL);
+               }
                printf ("\ts = (uae_s32)src + 2;\n");
                if (using_exception_3) {
                        printf ("\tif (src & 1) {\n");
-                       printf ("\t\texception3i (opcode, m68k_getpc () + s);\n");
+                       printf ("\t\texception3 (opcode, m68k_getpc () + s, 0, 1, m68k_getpc () + s);\n");
                        printf ("\t\tgoto %s;\n", endlabelstr);
                        printf ("\t}\n");
                        need_endlabel = 1;
@@ -3229,9 +3237,9 @@ static void gen_opcode (unsigned long int opcode)
                                printf ("\t} else {\n");
                                genastore ("src", Dreg, "(extra >> 12) & 7", curi->size, "");
                                printf ("\t}\n");
-                               sync_m68k_pc ();
                                pop_braces (old_brace_level);
                        }
+                       sync_m68k_pc ();
                }
                break;
        case i_BKPT:            /* only needed for hardware emulators */
index 9c3e7ccd663427794e6ae5d4b0394a335c6dc1d9..204310fd04f73d08f1a88e36f27eb29b724ef7b1 100644 (file)
@@ -140,8 +140,7 @@ static void video_calc_gammatable (void)
        float bri, con, gam, v;
        uae_u32 vi;
 
-       bri = ((float)(currprefs.gfx_luminance))
-               * (128.0f / 1000.0f);
+       bri = ((float)(currprefs.gfx_luminance)) * (128.0f / 1000.0f);
        con = ((float)(currprefs.gfx_contrast + 1000)) / 1000.0f;
        gam = ((float)(1000 - currprefs.gfx_gamma)) / 1000.0f;
 
index 35d225958fe3a3e0fb92f0e7d3ef0f5a27575fcc..eb08b6a02bf97e1bf74bebf350027333a206f05f 100644 (file)
@@ -411,6 +411,7 @@ extern void fpux_restore (int*);
 
 extern void exception3 (uae_u32 opcode, uaecptr addr);
 extern void exception3i (uae_u32 opcode, uaecptr addr);
+extern void exception3 (uae_u32 opcode, uaecptr addr, int w, int i, uaecptr pc);
 extern void exception2 (uaecptr addr);
 extern void cpureset (void);
 
index 49b7d6c60603d5934eedabaa49290cc04ec6ed54..eabe1307458bfacb300f01eed7e1cf735a06d509 100644 (file)
@@ -475,6 +475,7 @@ struct uae_prefs {
        bool win32_automount_removabledrives;
        int win32_midioutdev;
        int win32_midiindev;
+       bool win32_midirouter;
        int win32_uaescsimode;
        int win32_soundcard;
        int win32_samplersoundcard;
index 3d86e3e444ad20e5875d193d81ba28d2d9ca8a89..5d75ceea7bbc11579a3eda902fa00895e567e3c6 100644 (file)
@@ -61,7 +61,7 @@ extern int bootrom_header, bootrom_items;
 // 32 = vsync
 
 int inputdevice_logging = 0;
-
+extern int tablet_log;
 
 #define ID_FLAG_CANRELEASE 0x1000
 #define ID_FLAG_TOGGLED 0x2000
@@ -1366,6 +1366,19 @@ void inputdevice_tablet (int x, int y, int z, int pressure, uae_u32 buttonbits,
 
        if (!memcmp (tmp, p + MH_START, MH_END - MH_START))
                return;
+
+       if (tablet_log & 1) {
+               static int obuttonbits, oinproximity;
+               if (inproximity != oinproximity || buttonbits != obuttonbits) {
+                       obuttonbits = buttonbits;
+                       oinproximity = inproximity;
+                       write_log (_T("TABLET: B=%08x P=%d\n"), buttonbits, inproximity);
+               }
+       }
+       if (tablet_log & 2) {
+               write_log (_T("TABLET: X=%d Y=%d Z=%d AX=%d AY=%d AZ=%d\n"), x, y, z, ax, ay, az);
+       }
+
        p[MH_E] = 0xc0 | 2;
        p[MH_CNT]++;
 }
@@ -6063,6 +6076,8 @@ void inputdevice_acquire (int allmode)
 {
        int i;
 
+       //write_log (_T("inputdevice_acquire\n"));
+
        for (i = 0; i < MAX_INPUT_DEVICES; i++)
                idev[IDTYPE_JOYSTICK].unacquire (i);
        for (i = 0; i < MAX_INPUT_DEVICES; i++)
@@ -6098,6 +6113,8 @@ void inputdevice_unacquire (void)
 {
        int i;
 
+       //write_log (_T("inputdevice_unacquire\n"));
+
        for (i = 0; i < MAX_INPUT_DEVICES; i++)
                idev[IDTYPE_JOYSTICK].unacquire (i);
        for (i = 0; i < MAX_INPUT_DEVICES; i++)
index 786b82174a92848f760c1e0a340ad610c3c470c5..2659ad4afed0db89b126b904a4da5389f94697d4 100644 (file)
@@ -1262,8 +1262,16 @@ void init_m68k (void)
                        write_log (_T(" prefetch and cycle-exact"));
                else
                        write_log (_T(" ~cycle-exact"));
-       } else if (currprefs.cpu_compatible)
-               write_log (_T(" prefetch"));
+       } else if (currprefs.cpu_compatible) {
+               if (currprefs.cpu_model <= 68020) {
+                       write_log (_T(" prefetch"));
+               } else {
+                       write_log (_T(" fake prefetch"));
+               }
+               if (currprefs.cpu_model == 68060) {
+                       write_log (_T(" no unimplemented integer instructions"));
+               }
+       }
        if (currprefs.address_space_24) {
                regs.address_space_mask = 0x00ffffff;
                write_log (_T(" 24-bit"));
@@ -3166,6 +3174,7 @@ static TCHAR *mmu30regs[] = { _T("TCR"), _T(""), _T("SRP"), _T("CRP"), _T(""), _
 
 static void mmu_op30_pmove (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra)
 {
+       int mode = (opcode >> 3) & 7;
        int preg = (next >> 10) & 31;
        int rw = (next >> 9) & 1;
        int fd = (next >> 8) & 1;
@@ -3173,6 +3182,12 @@ static void mmu_op30_pmove (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr ex
        uae_u32 otc = tc_030;
        int siz;
 
+       // Dn, An, (An)+, -(An), abs and indirect
+       if (mode == 0 || mode == 1 || mode == 3 || mode == 4 || mode >= 6) {
+               op_illg (opcode);
+               return;
+       }
+
        switch (preg)
        {
        case 0x10: // TC
@@ -3281,19 +3296,59 @@ static void mmu_op30_ptest (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr ex
 
 static void mmu_op30_pflush (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra)
 {
+       int mode = (opcode >> 3) & 7;
+       int reg = opcode & 7;
+       int flushmode = (next >> 10) & 7;
+       int fc = next & 31;
+       int mask = (next >> 5) & 3;
+       TCHAR fname[100];
+
+       switch (flushmode)
+       {
+       case 6:
+               // Dn, An, (An)+, -(An), abs and indirect
+               if (mode == 0 || mode == 1 || mode == 3 || mode == 4 || mode >= 6) {
+                       op_illg (opcode);
+                       return;
+               }
+               _stprintf (fname, _T("FC=%x MASK=%x EA=%08x"), fc, mask, 0);
+               break;
+       case 4:
+               _stprintf (fname, _T("FC=%x MASK=%x"), fc, mask);
+               break;
+       case 1:
+               _tcscpy (fname, _T("ALL"));
+               break;
+       default:
+               op_illg (opcode);
+               return;
+       }
 #if MMUOP_DEBUG > 0
-       write_log (_T("PFLUSH PC=%08X\n"), pc);
+       write_log (_T("PFLUSH %s PC=%08X\n"), fname, pc);
 #endif
 }
 
 void mmu_op30 (uaecptr pc, uae_u32 opcode, uae_u16 extra, uaecptr extraa)
 {
-       if (extra & 0x8000)
-               mmu_op30_ptest (pc, opcode, extra, extraa);
-       else if (extra & 0x2000)
-               mmu_op30_pflush (pc, opcode, extra, extraa);
-       else
+       int type = extra >> 13;
+
+       switch (type)
+       {
+       case 0:
+       case 2:
+       case 3:
                mmu_op30_pmove (pc, opcode, extra, extraa);
+       break;
+       case 1:
+               mmu_op30_pflush (pc, opcode, extra, extraa);
+       break;
+       case 4:
+               mmu_op30_ptest (pc, opcode, extra, extraa);
+       break;
+       default:
+               op_illg (opcode);
+       break;
+       }
 }
 
 void mmu_op (uae_u32 opcode, uae_u32 extra)
@@ -3804,6 +3859,41 @@ cont:
 
 #endif
 
+#ifdef CPUEMU_20
+// emulate simple prefetch
+static uae_u32 get_word_020_prefetchf (uae_u32 pc)
+{
+       if (pc == regs.prefetch020addr) {
+               uae_u32 v = regs.prefetch020[0];
+               regs.prefetch020[0] = regs.prefetch020[1];
+               regs.prefetch020[1] = regs.prefetch020[2];
+               regs.prefetch020[2] = x_get_word (pc + 6);
+               regs.prefetch020addr += 2;
+               return v;
+       } else if (pc == regs.prefetch020addr + 2) {
+               uae_u32 v = regs.prefetch020[1];
+               regs.prefetch020[0] = regs.prefetch020[2];
+               regs.prefetch020[1] = x_get_word (pc + 4);
+               regs.prefetch020[2] = x_get_word (pc + 6);
+               regs.prefetch020addr += 4;
+               return v;
+       } else if (pc == regs.prefetch020addr + 4) {
+               uae_u32 v = regs.prefetch020[2];
+               regs.prefetch020[0] = x_get_word (pc + 2);
+               regs.prefetch020[1] = x_get_word (pc + 4);
+               regs.prefetch020[2] = x_get_word (pc + 6);
+               regs.prefetch020addr += 6;
+               return v;
+       } else {
+               regs.prefetch020addr = pc + 2;
+               regs.prefetch020[0] = x_get_word (pc + 2);
+               regs.prefetch020[1] = x_get_word (pc + 4);
+               regs.prefetch020[2] = x_get_word (pc + 6);
+               return x_get_word (pc);
+       }
+}
+#endif
+
 #ifdef JIT  /* Completely different run_2 replacement */
 
 void do_nothing (void)
@@ -3847,7 +3937,13 @@ void execute_normal (void)
        start_pc = r->pc;
        for (;;) {
                /* Take note: This is the do-it-normal loop */
-               uae_u16 opcode = get_iword (0);
+               uae_u16 opcode;
+
+               if (currprefs.cpu_compatible) {
+                       opcode = get_word_020_prefetchf (m68k_getpc ());
+               } else {
+                       opcode = get_iword (0);
+               }
 
                special_mem = DISTRUST_CONSISTENT_MEM;
                pc_hist[blocklen].location = (uae_u16*)r->pc_p;
@@ -4142,7 +4238,34 @@ cont:
 
 #ifdef CPUEMU_20
 
-/* emulate simple prefetch  */
+// only opcode fetch prefetch
+static void m68k_run_2pf (void)
+{
+       struct regstruct *r = &regs;
+
+       for (;;) {
+               uae_u16 opcode;
+
+               r->instruction_pc = m68k_getpc ();
+
+#if DEBUG_CD32CDTVIO
+               out_cd32io (m68k_getpc ());
+#endif
+
+               x_do_cycles (cpu_cycles);
+
+               opcode = get_word_020_prefetchf (r->instruction_pc);
+
+               count_instr (opcode);
+
+               cpu_cycles = (*cpufunctbl[opcode])(opcode);
+               cpu_cycles = adjust_cycles (cpu_cycles);
+               if (r->spcflags) {
+                       if (do_specialties (cpu_cycles))
+                               return;
+               }
+       }
+}
 
 uae_u32 get_word_020_prefetch (int o)
 {
@@ -4164,6 +4287,7 @@ uae_u32 get_word_020_prefetch (int o)
        }
 }
 
+// full prefetch
 static void m68k_run_2p (void)
 {
        struct regstruct *r = &regs;
@@ -4391,7 +4515,7 @@ void m68k_go (int may_quit)
 #endif
                                (currprefs.cpu_model == 68040 || currprefs.cpu_model == 68060) && currprefs.mmu_model ? m68k_run_mmu040 :
                                currprefs.cpu_model >= 68020 && currprefs.cpu_cycle_exact ? m68k_run_2ce :
-                               currprefs.cpu_compatible ? m68k_run_2p : m68k_run_2;
+                               currprefs.cpu_compatible ? (currprefs.cpu_model <= 68020 ? m68k_run_2p : m68k_run_2pf) : m68k_run_2;
                }
                protect_roms (true);
                run_func ();
@@ -4891,8 +5015,6 @@ uae_u8 *restore_cpu (uae_u8 *src)
        changed_prefs.address_space_24 = 0;
        if (flags & CPUTYPE_EC)
                changed_prefs.address_space_24 = 1;
-       if (model > 68020)
-               changed_prefs.cpu_compatible = 0;
        currprefs.address_space_24 = changed_prefs.address_space_24;
        currprefs.cpu_compatible = changed_prefs.cpu_compatible;
        currprefs.cpu_cycle_exact = changed_prefs.cpu_cycle_exact;
@@ -5302,14 +5424,17 @@ uae_u8 *restore_mmu (uae_u8 *src)
 
 #endif /* SAVESTATE */
 
-static void exception3f (uae_u32 opcode, uaecptr addr, int writeaccess, int instructionaccess)
+static void exception3f (uae_u32 opcode, uaecptr addr, int writeaccess, int instructionaccess, uae_u32 pc)
 {
        if (currprefs.cpu_model >= 68040)
                addr &= ~1;
-       if (currprefs.cpu_model <= 68010)
-               last_addr_for_exception_3 = m68k_getpc () + 2;
-       else
+       if (currprefs.cpu_model >= 68020) {
                last_addr_for_exception_3 = regs.instruction_pc;
+       } else if (pc == 0xffffffff) {
+               last_addr_for_exception_3 = m68k_getpc () + 2;
+       } else {
+               last_addr_for_exception_3 = pc;
+       }
        last_fault_for_exception_3 = addr;
        last_op_for_exception_3 = opcode;
        last_writeaccess_for_exception_3 = writeaccess;
@@ -5322,12 +5447,15 @@ static void exception3f (uae_u32 opcode, uaecptr addr, int writeaccess, int inst
 
 void exception3 (uae_u32 opcode, uaecptr addr)
 {
-       exception3f (opcode, addr, 0, 0);
+       exception3f (opcode, addr, 0, 0, 0xffffffff);
 }
-
 void exception3i (uae_u32 opcode, uaecptr addr)
 {
-       exception3f (opcode, addr, 0, 1);
+       exception3f (opcode, addr, 0, 1, 0xffffffff);
+}
+void exception3 (uae_u32 opcode, uaecptr addr, int w, int i, uaecptr pc)
+{
+       exception3f (opcode, addr, w, i, pc);
 }
 
 void exception2 (uaecptr addr)
@@ -5351,7 +5479,7 @@ void cpureset (void)
        uae_u16 ins;
 
        send_internalevent (INTERNALEVENT_CPURESET);
-       if (currprefs.cpu_compatible || currprefs.cpu_cycle_exact) {
+       if ((currprefs.cpu_compatible || currprefs.cpu_cycle_exact) && currprefs.cpu_model <= 68020) {
                custom_reset (0);
                return;
        }
index 4aedd87d65801fde74e2b8e6ad671d7791e6f919..54d0c432f95c1254bca1140dfc3a9839f6638a18 100644 (file)
@@ -11,6 +11,7 @@ int rawinput_enabled_hid = -1;
 // 2 = mouse
 // 4 = joystick
 int rawinput_log = 0;
+int tablet_log = 0;
 
 #define _WIN32_WINNT 0x501 /* enable RAWINPUT support */
 
@@ -606,6 +607,7 @@ static int maxpres;
 static TCHAR *tabletname;
 static int tablet_x, tablet_y, tablet_z, tablet_pressure, tablet_buttons, tablet_proximity;
 static int tablet_ax, tablet_ay, tablet_az, tablet_flags;
+static int tablet_div;
 
 static void tablet_send (void)
 {
@@ -632,12 +634,15 @@ void send_tablet_proximity (int inproxi)
        if (!tablet_proximity) {
                tablet_flags &= ~TPS_INVERT;
        }
+       if (tablet_log & 4)
+               write_log (_T("TABLET: Proximity=%d\n"), inproxi);
        tablet_send ();
 }
 
 void send_tablet (int x, int y, int z, int pres, uae_u32 buttons, int flags, int ax, int ay, int az, int rx, int ry, int rz, RECT *r)
 {
-       //write_log (_T("%d %d %d (%d,%d,%d), %08X %d\n"), x, y, pres, ax, ay, az, buttons, proxi);
+       if (tablet_log & 4)
+               write_log (_T("TABLET: B=%08X F=%08X X=%d Y=%d P=%d (%d,%d,%d)\n"), buttons, flags, x, y, pres, ax, ay, az);
        if (axmax > 0)
                ax = ax * 255 / axmax;
        else
@@ -652,8 +657,8 @@ void send_tablet (int x, int y, int z, int pres, uae_u32 buttons, int flags, int
                az = 0;
        pres = pres * 255 / maxpres;
 
-       tablet_x = x;
-       tablet_y = ymax - y;
+       tablet_x = (x + tablet_div / 2) / tablet_div;
+       tablet_y = ymax - (y + tablet_div / 2) / tablet_div;
        tablet_z = z;
        tablet_pressure = pres;
        tablet_buttons = buttons;
@@ -724,6 +729,17 @@ void *open_tablet (HWND hwnd)
        maxpres = pres.axMax;
        xres = gettabletres (&tx);
        yres = gettabletres (&ty);
+       tablet_div = 1;
+       while (xmax / tablet_div > 4095 || ymax / tablet_div > 4095) {
+               tablet_div *= 2;
+       }
+       xmax /= tablet_div;
+       ymax /= tablet_div;
+       xres /= tablet_div;
+       yres /= tablet_div;
+
+       if (tablet_div > 1)
+               write_log (_T("Divisor: %d (%d,%d)\n"), tablet_div, xmax, ymax);
        tablet_proximity = -1;
        tablet_x = -1;
        inputdevice_tablet_info (xmax, ymax, zmax, axmax, aymax, azmax, xres, yres);
index a1f484f912cd3d93dc113ddafc733d9c6ee3e290..842b20a4099b0e5e2dc10056b34687c0dadbdcad 100644 (file)
@@ -1200,8 +1200,8 @@ static int createsltexture (void)
        if (!sltexture)
                return 0;
        write_log (_T("%s: SL %d*%d texture allocated\n"), D3DHEAD, required_sl_texture_w, required_sl_texture_h);
-       maskmult_x = 1.0;
-       maskmult_y = 1.0;
+       maskmult_x = 1.0f;
+       maskmult_y = 1.0f;
        return 1;
 }
 
@@ -1478,6 +1478,7 @@ static int createmasktexture (const TCHAR *filename)
        D3DLOCKED_RECT lock, slock;
        D3DXIMAGE_INFO dinfo;
        TCHAR tmp[MAX_DPATH];
+       int maskwidth, maskheight;
 
        if (filename[0] == 0)
                return 0;
@@ -1511,12 +1512,21 @@ static int createmasktexture (const TCHAR *filename)
        }
        masktexture_w = dinfo.Width;
        masktexture_h = dinfo.Height;
-       if (txdesc.Width == masktexture_w && txdesc.Height == masktexture_h && psEnabled) {
+       if (0 && txdesc.Width == masktexture_w && txdesc.Height == masktexture_h && psEnabled) {
                // texture size == image size, no need to tile it (Wrap sampler does the rest)
-               masktexture = tx;
-               tx = NULL;
+               if (masktexture_w < window_w || masktexture_h < window_h) {
+                       maskwidth = window_w;
+                       maskheight = window_h;
+               } else {
+                       masktexture = tx;
+                       tx = NULL;
+               }
        } else {
-               masktexture = createtext (window_w, window_h, D3DFMT_X8R8G8B8);
+               maskwidth = window_w;
+               maskheight = window_h;
+       }
+       if (tx) {
+               masktexture = createtext (maskwidth, maskheight, D3DFMT_X8R8G8B8);
                if (FAILED (hr)) {
                        write_log (_T("%s: mask texture creation failed: %s\n"), D3DHEAD, D3D_ErrorString (hr));
                        goto end;
index 2416af63846e588f2fe60d15d34a5f61016f2a54..52a8d424378c8d95db6700a1ca747be91bef4df5 100644 (file)
@@ -417,6 +417,16 @@ int Midi_Parse(midi_direction_e direction, BYTE *dataptr)
        return result;
 }
 
+static void putmidibytes(uae_u8 *data, int len)
+{
+       if (!currprefs.win32_midirouter || !midi_ready)
+               return;
+       for (int i = 0; i < len; i++) {
+               BYTE b = data[i];
+               Midi_Parse(midi_output, &b);
+       }
+}
+
 /*
 * FUNCTION:   MidiIn support and Callback function
 *
@@ -435,7 +445,9 @@ static void add1byte(DWORD_PTR w) //put 1 Byte to Midibuffer
                TRACE((_T("add1byte buffer full %d %d (%02X)\n"), midi_inlast, midi_inptr, w));
                return;
        }
-       midibuf[midi_inlast++] = (uae_u8)w;
+       midibuf[midi_inlast] = (uae_u8)w;
+       putmidibytes (&midibuf[midi_inlast], 1);
+       midi_inlast++;
 }
 static void add2byte(DWORD_PTR w) //put 2 Byte to Midibuffer
 {
@@ -443,9 +455,11 @@ static void add2byte(DWORD_PTR w) //put 2 Byte to Midibuffer
                TRACE((_T("add2byte buffer full %d %d (%04X)\n"), midi_inlast, midi_inptr, w));
                return;
        }
-       midibuf[midi_inlast++] = (uae_u8)w;
+       midibuf[midi_inlast+0] = (uae_u8)w;
        w = w >> 8;
-       midibuf[midi_inlast++] = (uae_u8)w;
+       midibuf[midi_inlast+1] = (uae_u8)w;
+       putmidibytes (&midibuf[midi_inlast], 2);
+       midi_inlast+=2;
 }
 static void add3byte(DWORD_PTR w) //put 3 Byte to Midibuffer
 {
@@ -453,11 +467,13 @@ static void add3byte(DWORD_PTR w) //put 3 Byte to Midibuffer
                TRACE((_T("add3byte buffer full %d %d (%08X)\n"), midi_inlast, midi_inptr, w));
                return;
        }
-       midibuf[midi_inlast++] = (uae_u8)w;
+       midibuf[midi_inlast+0] = (uae_u8)w;
        w = w >> 8;
-       midibuf[midi_inlast++] = (uae_u8)w;
+       midibuf[midi_inlast+1] = (uae_u8)w;
        w = w >> 8;
-       midibuf[midi_inlast++] = (uae_u8)w;
+       midibuf[midi_inlast+2] = (uae_u8)w;
+       putmidibytes (&midibuf[midi_inlast], 3);
+       midi_inlast+=3;
 }
 
 int ismidibyte(void)
@@ -523,6 +539,7 @@ static void CALLBACK MidiInProc(HMIDIIN hMidiIn,UINT wMsg,DWORD_PTR dwInstance,D
                        goto end;
                }
                memcpy(&midibuf[midi_inlast], midiin->lpData, midiin->dwBytesRecorded);
+               putmidibytes(&midibuf[midi_inlast], midiin->dwBytesRecorded);
                midi_inlast = midi_inlast + midiin->dwBytesRecorded;
        }
 
index 135edfce1ec7602b1b55dc2b57e3f384bcc765d0..273d87b62a882529da160dfc3a1c3abada7a55f9 100644 (file)
 #define IDC_SAMPLER_STEREO              1812
 #define IDC_LISTDIALOG_LIST             1813
 #define IDC_LOGPATH                     1814
+#define IDC_MIDIROUTER                  1815
 #define ID__FLOPPYDRIVES                40004
 #define ID_FLOPPYDRIVES_DF0             40005
 #define ID_ST_CONFIGURATION             40010
index f0d8db9bdbedd40bede5a24d29b4a7cc3d03b37b..fd93b270c8abd45c441ec5e47d2b0c2a04ce37b1 100644 (file)
@@ -387,7 +387,7 @@ BEGIN
     PUSHBUTTON      "Delete",IDC_DELETE,335,301,60,15\r
 END\r
 \r
-IDD_IOPORTS DIALOGEX 0, 0, 396, 275\r
+IDD_IOPORTS DIALOGEX 0, 0, 396, 295\r
 STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD\r
 FONT 8, "MS Sans Serif", 0, 0, 0x1\r
 BEGIN\r
@@ -415,9 +415,10 @@ BEGIN
     COMBOBOX        IDC_MIDIOUTLIST,58,204,145,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
     RTEXT           "In:",IDC_MIDI2,204,201,31,15,SS_CENTERIMAGE\r
     COMBOBOX        IDC_MIDIINLIST,239,203,145,134,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
-    GROUPBOX        "Protection Dongle",IDC_STATIC,1,227,393,41,BS_LEFT\r
-    GROUPBOX        "MIDI",IDC_STATIC,1,191,393,34,BS_LEFT\r
-    COMBOBOX        IDC_DONGLELIST,58,245,232,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
+    GROUPBOX        "Protection Dongle",IDC_STATIC,1,252,393,41,BS_LEFT\r
+    GROUPBOX        "MIDI",IDC_STATIC,1,191,393,54,BS_LEFT\r
+    COMBOBOX        IDC_DONGLELIST,58,270,232,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
+    CONTROL         "Route MIDI In to MIDI Out",IDC_MIDIROUTER,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,41,227,170,12\r
 END\r
 \r
 IDD_GAMEPORTS DIALOGEX 0, 0, 396, 288\r
@@ -470,8 +471,8 @@ IDD_ABOUT DIALOGEX 0, 0, 345, 258
 STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD\r
 FONT 8, "MS Sans Serif", 0, 0, 0x0\r
 BEGIN\r
-    CONTROL         "",IDC_RICHEDIT1,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,65,10,210,21\r
-    CONTROL         "",IDC_RICHEDIT2,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,43,41,260,20\r
+    CONTROL         "",IDC_RICHEDIT1,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,65,10,210,35\r
+    CONTROL         "",IDC_RICHEDIT2,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,43,59,260,20\r
     PUSHBUTTON      "Contributors",IDC_CONTRIBUTORS,132,100,80,15\r
     CONTROL         "",IDC_UAEHOME,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_DISABLED,2,196,112,24\r
     CONTROL         "",IDC_PICASSOHOME,"RICHEDIT",TCS_SCROLLOPPOSITE | TCS_RAGGEDRIGHT | TCS_MULTISELECT | NOT WS_VISIBLE | WS_DISABLED,211,131,112,24\r
@@ -893,16 +894,16 @@ BEGIN
     PUSHBUTTON      "...",IDC_PATHS_RIPS,383,189,11,15\r
     PUSHBUTTON      "Reset to defaults",IDC_PATHS_DEFAULT,2,212,92,14\r
     PUSHBUTTON      "Rescan ROMs",IDC_ROM_RESCAN,2,229,92,14\r
-    PUSHBUTTON      "Clear disk history",IDC_RESETDISKHISTORY,2,246,92,14\r
+    PUSHBUTTON      "Clear disk history",IDC_RESETDISKHISTORY,99,229,92,14\r
     COMBOBOX        IDC_PATHS_DEFAULTTYPE,99,213,163,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    PUSHBUTTON      "Clear registry",IDC_RESETREGISTRY,99,229,92,14\r
-    CONTROL         "Use relative paths",IDC_PATHS_RELATIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,101,248,161,11\r
-    EDITTEXT        IDC_LOGPATH,3,289,336,13,ES_READONLY\r
-    LTEXT           "Log:",IDC_STATIC,5,273,67,10,SS_CENTERIMAGE\r
-    PUSHBUTTON      "Open [] Open selected file.",IDC_LOGOPEN,343,288,51,14\r
-    COMBOBOX        IDC_LOGSELECT,54,271,119,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    CONTROL         "Enable full logging (temporary)",IDC_LOGENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,182,272,145,12\r
-    PUSHBUTTON      "Save All [] Save and open both logs and config file.",IDC_LOGSAVE,343,272,51,14\r
+    PUSHBUTTON      "Clear registry",IDC_RESETREGISTRY,302,212,92,14\r
+    CONTROL         "Use relative paths",IDC_PATHS_RELATIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,199,231,189,11\r
+    EDITTEXT        IDC_LOGPATH,7,281,324,13,ES_READONLY\r
+    PUSHBUTTON      "Open [] Open selected file.",IDC_LOGOPEN,337,280,51,14\r
+    COMBOBOX        IDC_LOGSELECT,7,263,169,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
+    CONTROL         "Enable full logging (temporary)",IDC_LOGENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,264,140,12\r
+    PUSHBUTTON      "Save All [] Save and open both logs and config file.",IDC_LOGSAVE,337,264,51,14\r
+    GROUPBOX        "Debug logging",IDC_STATIC,1,248,393,53\r
 END\r
 \r
 IDD_QUICKSTART DIALOGEX 0, 0, 396, 262\r
@@ -1280,6 +1281,7 @@ BEGIN
 \r
     IDD_IOPORTS, DIALOG\r
     BEGIN\r
+        BOTTOMMARGIN, 275\r
     END\r
 \r
     IDD_GAMEPORTS, DIALOG\r
index 13ee13d07238e71206620a80268c6bf122ab5e3c..3730452e119342abad02c1ea48f1fa943a325575 100644 (file)
@@ -2960,6 +2960,7 @@ void target_default_options (struct uae_prefs *p, int type)
                p->win32_uaescsimode = UAESCSI_CDEMU;
                p->win32_midioutdev = -2;
                p->win32_midiindev = 0;
+               p->win32_midirouter = false;
                p->win32_automount_removable = 0;
                p->win32_automount_drives = 0;
                p->win32_automount_removabledrives = 0;
@@ -3032,6 +3033,7 @@ void target_save_options (struct zfile *f, struct uae_prefs *p)
                cfgfile_target_dwrite_str (f, _T("midiin_device_name"), _T("none"));
        else
                cfgfile_target_dwrite_str (f, _T("midiin_device_name"), midp->name);
+       cfgfile_target_dwrite_bool (f, _T("midirouter"), p->win32_midirouter);
                        
        cfgfile_target_dwrite_bool (f, _T("rtg_match_depth"), p->win32_rtgmatchdepth);
        cfgfile_target_dwrite_bool (f, _T("rtg_scale_small"), p->win32_rtgscaleifsmall);
@@ -3131,6 +3133,7 @@ int target_parse_option (struct uae_prefs *p, const TCHAR *option, const TCHAR *
                || cfgfile_intval (option, value, _T("midi_device"), &p->win32_midioutdev, 1)
                || cfgfile_intval (option, value, _T("midiout_device"), &p->win32_midioutdev, 1)
                || cfgfile_intval (option, value, _T("midiin_device"), &p->win32_midiindev, 1)
+               || cfgfile_yesno (option, value, _T("midirouter"), &p->win32_midirouter)
                || cfgfile_intval (option, value, _T("samplersoundcard"), &p->win32_samplersoundcard, 1)
                || cfgfile_yesno (option, value, _T("notaskbarbutton"), &p->win32_notaskbarbutton)
                || cfgfile_yesno (option, value, _T("nonotificationicon"), &p->win32_nonotificationicon)
@@ -4633,6 +4636,7 @@ extern int log_bsd;
 extern int inputdevice_logging;
 extern int vsync_modechangetimeout;
 extern int forcedframelatency;
+extern int tablet_log;
 
 extern DWORD_PTR cpu_affinity, cpu_paffinity;
 static DWORD_PTR original_affinity = -1;
@@ -4931,6 +4935,10 @@ static int parseargs (const TCHAR *argx, const TCHAR *np, const TCHAR *np2)
                debug_vsync_forced_delay = getval (np);
                return 2;
        }
+       if (!_tcscmp (arg, _T("tabletlog"))) {
+               tablet_log = getval (np);
+               return 2;
+       }
        if (!_tcscmp (arg, _T("inputlog"))) {
                rawinput_log = getval (np);
                return 2;
index e43bfa7957d745b319a126d8ae319816ca1962d4..ad1a01ea864165a29cc9c79061e3f709df5b657c 100644 (file)
@@ -19,8 +19,8 @@
 #define LANG_DLL 1
 
 //#define WINUAEBETA _T("")
-#define WINUAEBETA _T("17")
-#define WINUAEDATE MAKEBD(2012, 9, 10)
+#define WINUAEBETA _T("18")
+#define WINUAEDATE MAKEBD(2012, 9, 23)
 #define WINUAEEXTRA _T("")
 //#define WINUAEEXTRA _T("AmiKit Preview")
 #define WINUAEREV _T("")
index ce5d6847d6ae3f36235406ca781c48613637e52b..d25ed51e4c6995f4c61c7f47b387572184240116 100644 (file)
@@ -374,11 +374,15 @@ void getfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height
 
                                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;
+
+                               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 - (dst_width - ww) / 2, cy * scale - (dst_height - hh) / 2);
                                goto cont;
 
index 607031ee962ef4cb105dc0ee5159c5f27fab7ab3..9488271e6ad40bb73c1c23ce3515a78a73805798 100644 (file)
@@ -112,7 +112,7 @@ int vsync_modechangetimeout = 10;
 
 int screen_is_picasso = 0;
 
-extern int reopen (int);
+extern int reopen (int, bool);
 
 #define VBLANKTH_KILL 0
 #define VBLANKTH_CALIBRATE 1
@@ -1570,9 +1570,9 @@ int check_prefs_changed_gfx (void)
        c |= currprefs.gfx_filter_gamma != changed_prefs.gfx_filter_gamma ? (1|8) : 0;
        //c |= currprefs.gfx_filter_ != changed_prefs.gfx_filter_ ? (1|8) : 0;
 
-       c |= currprefs.gfx_luminance != changed_prefs.gfx_luminance ? (1|8) : 0;
-       c |= currprefs.gfx_contrast != changed_prefs.gfx_contrast ? (1|8) : 0;
-       c |= currprefs.gfx_gamma != changed_prefs.gfx_gamma ? (1|8) : 0;
+       c |= currprefs.gfx_luminance != changed_prefs.gfx_luminance ? (1 | 256) : 0;
+       c |= currprefs.gfx_contrast != changed_prefs.gfx_contrast ? (1 | 256) : 0;
+       c |= currprefs.gfx_gamma != changed_prefs.gfx_gamma ? (1 | 256) : 0;
 
        c |= currprefs.gfx_resolution != changed_prefs.gfx_resolution ? (128) : 0;
        c |= currprefs.gfx_vresolution != changed_prefs.gfx_vresolution ? (128) : 0;
@@ -1677,11 +1677,19 @@ int check_prefs_changed_gfx (void)
                currprefs.win32_rtgscaleaspectratio = changed_prefs.win32_rtgscaleaspectratio;
                currprefs.win32_rtgvblankrate = changed_prefs.win32_rtgvblankrate;
 
-               inputdevice_unacquire ();
+               bool unacquired = false;
                if (c & 64) {
+                       if (!unacquired) {
+                               inputdevice_unacquire ();
+                               unacquired = true;
+                       }
                        DirectDraw_Fill (NULL, 0);
                        DirectDraw_BlitToPrimary (NULL);
                }
+               if (c & 256) {
+                       init_colors ();
+                       drawing_init ();
+               }
                if (c & 128) {
                        if (currprefs.gfx_autoresolution) {
                                c |= 2 | 8;
@@ -1692,11 +1700,18 @@ int check_prefs_changed_gfx (void)
                        }
                }
                if ((c & 16) || ((c & 8) && keepfsmode)) {
-                       if (reopen (c & 2))
+                       if (reopen (c & 2, unacquired == false)) {
                                c |= 2;
+                       } else {
+                               unacquired = true;
+                       }
                        graphics_mode_changed = 1;
                }
                if ((c & 32) || ((c & 2) && !keepfsmode)) {
+                       if (!unacquired) {
+                               inputdevice_unacquire ();
+                               unacquired = true;
+                       }
                        close_windows ();
                        graphics_init ();
                        graphics_mode_changed = 1;
@@ -1707,7 +1722,8 @@ int check_prefs_changed_gfx (void)
                        reset_sound ();
                        resume_sound ();
                }
-               inputdevice_acquire (TRUE);
+               if (unacquired)
+                       inputdevice_acquire (TRUE);
                return 1;
        }
 
@@ -1842,10 +1858,12 @@ int check_prefs_changed_gfx (void)
 #endif
        }
        if (currprefs.win32_midiindev != changed_prefs.win32_midiindev ||
-               currprefs.win32_midioutdev != changed_prefs.win32_midioutdev)
+               currprefs.win32_midioutdev != changed_prefs.win32_midioutdev ||
+               currprefs.win32_midirouter != changed_prefs.win32_midirouter)
        {
                currprefs.win32_midiindev = changed_prefs.win32_midiindev;
                currprefs.win32_midioutdev = changed_prefs.win32_midioutdev;
+               currprefs.win32_midirouter = changed_prefs.win32_midirouter;
 #ifdef SERIAL_PORT
                if (midi_ready) {
                        Midi_Close ();
@@ -1969,7 +1987,7 @@ static int ifs (struct uae_prefs *p)
        return p->gfx_apmode[idx].gfx_fullscreen == GFX_FULLSCREEN ? 1 : (p->gfx_apmode[idx].gfx_fullscreen == GFX_FULLWINDOW ? -1 : 0);
 }
 
-static int reopen (int full)
+static int reopen (int full, bool unacquire)
 {
        int quick = 0;
        int idx = screen_is_picasso ? 1 : 0;
@@ -2014,6 +2032,10 @@ static int reopen (int full)
        if (!quick)
                return 1;
 
+       if (unacquire) {
+               inputdevice_unacquire ();
+       }
+
        open_windows (0);
 
        if (isvsync () < 0)
index 181e42c4558eb20e374bffd55a6fab0321f2d94f..75e33db41919ee00510c76ad986ebd8548ccfe73 100644 (file)
@@ -1771,6 +1771,7 @@ int target_cfgfile_load (struct uae_prefs *p, const TCHAR *filename, int type, i
 
 static int gui_width, gui_height;
 static bool gui_resize;
+static bool gui_resize_allowed;
 // Internal panel max size: 396, 318
 
 static int mm = 0;
@@ -5548,22 +5549,22 @@ static void init_aboutdlg (HWND hDlg)
        SendDlgItemMessage (hDlg, IDC_RICHEDIT1, EM_GETCHARFORMAT, 0, (LPARAM) & CharFormat);
        CharFormat.dwMask |= CFM_BOLD | CFM_SIZE | CFM_FACE;
        CharFormat.dwEffects = CFE_BOLD;
-       CharFormat.yHeight = 18 * 20; /* height in twips, where a twip is 1/20th of a point - for a pt.size of 18 */
+       CharFormat.yHeight = 24 * 20; /* height in twips, where a twip is 1/20th of a point */
 
-       _tcscpy (CharFormat.szFaceName, _T("Times New Roman"));
+       _tcscpy (CharFormat.szFaceName,  os_vista ? _T("Segoe UI") : _T("Tahoma"));
        SendDlgItemMessage (hDlg, IDC_RICHEDIT1, EM_SETCHARFORMAT, SCF_ALL, (LPARAM) & CharFormat);
        SendDlgItemMessage (hDlg, IDC_RICHEDIT1, EM_SETBKGNDCOLOR, 0, GetSysColor (COLOR_3DFACE));
 
        SetDlgItemText (hDlg, IDC_RICHEDIT2, VersionStr );
        SendDlgItemMessage (hDlg, IDC_RICHEDIT2, EM_GETCHARFORMAT, 0, (LPARAM) & CharFormat);
        CharFormat.dwMask |= CFM_SIZE | CFM_FACE;
-       CharFormat.yHeight = 10 * 20;
-       _tcscpy (CharFormat.szFaceName, _T("Times New Roman"));
+       CharFormat.yHeight = 12 * 20;
+       _tcscpy (CharFormat.szFaceName,  os_vista ? _T("Segoe UI") : _T("Tahoma"));
        SendDlgItemMessage (hDlg, IDC_RICHEDIT2, EM_SETCHARFORMAT, SCF_ALL, (LPARAM) & CharFormat);
        SendDlgItemMessage (hDlg, IDC_RICHEDIT2, EM_SETBKGNDCOLOR, 0, GetSysColor (COLOR_3DFACE));
 
        for(i = 0; urls[i].id >= 0; i++)
-               SetupRichText(hDlg, &urls[i]);
+               SetupRichText (hDlg, &urls[i]);
 }
 
 static INT_PTR CALLBACK AboutDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -5760,6 +5761,8 @@ static int *getp_da (void)
 static void set_da (HWND hDlg)
 {
        int *p = getp_da ();
+       if (!p)
+               return;
        TCHAR buf[10];
        SendDlgItemMessage (hDlg, IDC_DA_SLIDER, TBM_SETPOS, TRUE, (*p) / 10);
        _stprintf(buf, _T("%.1f"), (double)((*p) / 10.0));
@@ -7945,6 +7948,7 @@ static void values_to_miscdlg (HWND hDlg)
                misc_kbled (hDlg, IDC_KBLED3, workprefs.keyboard_leds[2]);
                CheckDlgButton (hDlg, IDC_KBLED_USB, workprefs.win32_kbledmode);
                CheckDlgButton (hDlg, IDC_GUI_RESIZE, gui_resize);
+               ew (hDlg, IDC_GUI_RESIZE, gui_resize_allowed);
 
                misc_scsi (hDlg);
                misc_lang (hDlg);
@@ -8297,7 +8301,7 @@ static void enable_for_cpudlg (HWND hDlg)
        ew (hDlg, IDC_CS_CACHE_TEXT, enable);
        ew (hDlg, IDC_CACHE, enable);
        ew (hDlg, IDC_JITENABLE, jitenable);
-       ew (hDlg, IDC_COMPATIBLE, (!workprefs.cpu_cycle_exact && !workprefs.cachesize) || workprefs.cpu_model >= 68040);
+       ew (hDlg, IDC_COMPATIBLE, !workprefs.cpu_cycle_exact);
        ew (hDlg, IDC_COMPATIBLE_FPU, workprefs.fpu_model > 0);
 #if 0
        ew (hDlg, IDC_CPU_MULTIPLIER, workprefs.cpu_cycle_exact);
@@ -11329,6 +11333,8 @@ static void values_from_portsdlg (HWND hDlg)
        }
        ew (hDlg, IDC_MIDIINLIST, workprefs.win32_midioutdev < -1 ? FALSE : TRUE);
 
+       workprefs.win32_midirouter = ischecked (hDlg, IDC_MIDIROUTER);
+
        item = SendDlgItemMessage (hDlg, IDC_SERIAL, CB_GETCURSEL, 0, 0L);
        if (item != CB_ERR && item > 0) {
                workprefs.use_serial = 1;
@@ -11413,6 +11419,8 @@ static void values_to_portsdlg (HWND hDlg)
        else
                SendDlgItemMessage (hDlg, IDC_MIDIINLIST, CB_SETCURSEL, 0, 0);
        ew (hDlg, IDC_MIDIINLIST, workprefs.win32_midioutdev < -1 ? FALSE : TRUE);
+       ew (hDlg, IDC_MIDIROUTER, workprefs.win32_midioutdev >= -1 && workprefs.win32_midiindev >= -1);
+       CheckDlgButton (hDlg, IDC_MIDIROUTER, workprefs.win32_midirouter);
 
        CheckDlgButton (hDlg, IDC_UAESERIAL, workprefs.uaeserial);
        CheckDlgButton (hDlg, IDC_SER_SHARED, workprefs.serial_demand);
@@ -11753,7 +11761,7 @@ static INT_PTR CALLBACK IOPortsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR
                        if (isprinter ()) {
                                closeprinter ();
                        }
-               } else if (wParam == IDC_UAESERIAL || wParam == IDC_SER_SHARED || wParam == IDC_SER_DIRECT || wParam == IDC_SER_CTSRTS || wParam == IDC_PRINTERAUTOFLUSH || wParam == IDC_SAMPLER_STEREO) {
+               } else if (wParam == IDC_UAESERIAL || wParam == IDC_SER_SHARED || wParam == IDC_SER_DIRECT || wParam == IDC_SER_CTSRTS || wParam == IDC_PRINTERAUTOFLUSH || wParam == IDC_SAMPLER_STEREO || wParam == IDC_MIDIROUTER) {
                        values_from_portsdlg (hDlg);
                } else {
                        if (HIWORD (wParam) == CBN_SELCHANGE) {
@@ -14600,7 +14608,7 @@ static bool dodialogmousemove (void)
 {
        if (full_property_sheet || isfullscreen () <= 0)
                return false;
-       if (currprefs.gfx_size_fs.width >= gui_width && currprefs.gfx_size.height >= gui_height)
+       if (isfullscreen () > 0 && currprefs.gfx_size_fs.width > gui_width && currprefs.gfx_size.height > gui_height)
                return false;
        struct MultiDisplay *mdc = getdisplay (&currprefs);
        for (int i = 0; Displays[i].monitorid; i++) {
@@ -14614,10 +14622,11 @@ static bool dodialogmousemove (void)
 static void centerWindow (HWND hDlg)
 {
        RECT rc, rcDlg, rcOwner;
-       HWND owner = GetParent(hDlg);
        int x = 0, y = 0;
        POINT pt1, pt2;
+       struct MultiDisplay *mdc = getdisplay (&currprefs);
 
+       HWND owner = GetParent (hDlg);
        if (owner == NULL)
                owner = GetDesktopWindow ();
        if (isfullscreen () == 0) {
@@ -14630,8 +14639,8 @@ static void centerWindow (HWND hDlg)
                regqueryint (NULL, _T("GUIPosFSX"), &x);
                regqueryint (NULL, _T("GUIPosFSY"), &y);
                if (dodialogmousemove ()) {
-                       x = 0;
-                       y = 0;
+                       x = mdc->rect.left;
+                       y = mdc->rect.top;
                }
        }
        SetForegroundWindow (hDlg);
@@ -14654,14 +14663,15 @@ static void centerWindow (HWND hDlg)
                        pt2.x = x + 16;
                        pt2.y = y + GetSystemMetrics (SM_CYMENU) + GetSystemMetrics (SM_CYBORDER);
                        if (MonitorFromPoint (pt1, MONITOR_DEFAULTTONULL) == NULL && MonitorFromPoint (pt2, MONITOR_DEFAULTTONULL) == NULL) {
-                               x = 0;
-                               y = 0;
+                               x = mdc->rect.left;
+                               y = mdc->rect.top;
                        }
                } else {
-                       x = 16;
-                       y = 16;
+                       x = mdc->rect.left + 16;
+                       y = mdc->rect.top + 16;
                }
        }
+       //write_log (_T("centerwindow %dx%d\n"), x, y);
        dialog_x_offset = x;
        dialog_y_offset = y;
        SetWindowPos (hDlg,  HWND_TOP, x, y, 0, 0, SWP_NOSIZE);
@@ -14911,7 +14921,7 @@ static INT_PTR CALLBACK DialogProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
        {
        case WM_SIZING:
        {
-               if (!recursive) {
+               if (!recursive && gui_resize_allowed) {
                        RECT *r = (RECT*)lParam;
                        if (r->right - r->left < MIN_GUI_INTERNAL_WIDTH)
                                r->right = r->left + MIN_GUI_INTERNAL_WIDTH;
@@ -14922,13 +14932,13 @@ static INT_PTR CALLBACK DialogProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
                break;
        }
        case WM_ENTERSIZEMOVE:
-               if (!recursive) {
+               if (!recursive && gui_resize_allowed) {
                        getguisize (hDlg, &oldwidth, &oldheight);
                        return FALSE;
                }
                break;
        case WM_EXITSIZEMOVE:
-               if (!recursive) {
+               if (!recursive && gui_resize_allowed) {
                        int w, h;
                        getguisize (hDlg, &w, &h);
                        if (w != oldwidth || h != oldheight) {
@@ -15213,6 +15223,9 @@ static void dialogmousemove (HWND hDlg)
        rc.bottom -= rc.top;
        rc.left = 0;
        rc.top = 0;
+
+       //write_log (_T("SW=%d SH=%d %dx%d\n"), sw, sh, rc.right, rc.bottom);
+
        if (rc.right <= sw && rc.bottom <= sh)
                return;
        pt2.x = pt.x;
@@ -15329,7 +15342,7 @@ static int GetSettings (int all_options, HWND hwnd)
                int v = 0;
                setdefaultguisize ();
                regqueryint (NULL, _T("GUIResize"), &v);
-               gui_resize = v != 0;
+               gui_resize_allowed = gui_resize = v != 0;
                if (full_property_sheet || isfullscreen () == 0) {
                        regqueryint (NULL, _T("GUISizeX"), &gui_width);
                        regqueryint (NULL, _T("GUISizeY"), &gui_height);
@@ -15347,6 +15360,7 @@ static int GetSettings (int all_options, HWND hwnd)
                        scaleresource_setdefaults ();
                        setdefaultguisize ();
                        fmultx = 0;
+                       write_log (_T("GUI size reset\n"));
                }
 
                if (all_options || !configstore)
@@ -15362,9 +15376,16 @@ static int GetSettings (int all_options, HWND hwnd)
                        scaleresource_setmult (hwnd, -fmultx, -fmulty);
                } else {
                        scaleresource_setmult (hwnd, gui_width, gui_height);
-                       write_log (_T("Requested GUI size = %dx%d\n"), gui_width, gui_height);
+                       write_log (_T("Requested GUI size = %dx%d (%dx%d)\n"), gui_width, gui_height, workprefs.gfx_size.width, workprefs.gfx_size.height);
+                       if (dodialogmousemove () && isfullscreen() > 0) {
+                               if (gui_width >= workprefs.gfx_size.width || gui_height >= workprefs.gfx_size.height) {
+                                       write_log (_T("GUI larger than screen, resize disabled\n"));
+                                       gui_resize_allowed = false;
+                               }
+                       }
                }
-               tres = scaleresource (panelresource, hwnd, gui_resize);
+
+               tres = scaleresource (panelresource, hwnd, gui_resize_allowed);
                dhwnd = CreateDialogIndirect (tres->inst, tres->resource, hwnd, DialogProc);
                dialog_rect.top = dialog_rect.left = 0;
                dialog_rect.right = tres->width;
index 5820c36d3057b6c09626be0e0c45a13fd6f5472f..a546bfcffb5c4ab07d1486d5cb51a47a54c360c7 100644 (file)
@@ -423,6 +423,9 @@ void scaleresource_init (const TCHAR *prefix)
        regqueryfont (NULL, fontprefix, fontreg[0], fontname_gui, &fontsize_gui, &fontstyle_gui, &fontweight_gui);
        regqueryfont (NULL, fontprefix, fontreg[1], fontname_list, &fontsize_list, &fontstyle_list, &fontweight_list);
 
+       //write_log (_T("GUI font %s:%d:%d:%d\n"), fontname_gui, fontsize_gui, fontstyle_gui, fontweight_gui);
+       //write_log (_T("List font %s:%d:%d:%d\n"), fontname_list, fontsize_list, fontstyle_list, fontweight_list);
+
        openfont (true);
 }
 
@@ -485,6 +488,7 @@ void scaleresource_setmult (HWND hDlg, int w, int h)
        if (multy < 50)
                multy = 50;
 
+       //write_log (_T("MX=%f MY=%f\n"), multx, multy);
 }
 
 void scaleresource_getmult (int *mx, int *my)
index 0b0262073924b3cde444a6f7c1956151ba182d98..ba2d27d3d4b330b77b9a1e08f1d16ebe46a1320e 100644 (file)
@@ -5,6 +5,23 @@
 
 - restore only single input target to default.
 
+Beta 18:
+
+- FPS and CPU% react quicker now. Can Show previously hidden CPU usage spikes. NOTE: CPU% now showing "myserious" usage spikes does not mean emulation has become slower!
+- Automatically limit tablet mode X and Y coordinate range to prevent 16-bit signed overflows if tablet has large resolution. (not confirmed)
+- Always generate full size mask texture, workaround for mask pixel mapping errors in some scaling modes.
+- Only release pressed keys if window or screen gets reopened (prevents stuck keys), not when any graphics related config option changes.
+- Do not allow GUI resize if GUI is larger than fullscreen resolution because Windows may automatically resize it to fit on screen, making GUI completely unusable.
+- Always recalculate Display panel horiz/vert centering option internal values when configuration changes.
+- 68030+ CPU and more compatible checkbox checked: enable very basic prefetch emulation, only 68000-68020 have more complex prefetch emulation.
+- JIT + more compatible also enables basic prefetch. Only works if code is not yet translated. (Not much point but it was easy to do)
+- Added route all MIDI In data to MIDI Out configuration option.
+- Improved 68030 MMU instruction decoding. WHDLoad + MMU option enabled + 68030 CPU does not crash anymore. (No, there still is no 68030 MMU emulation, it is
+  only emulating 68EC030 without MMU circuitry which probably does not exist in real world + hack for A3000 1.4 ROM)
+- Few (rare) variants of MOVES didn't increase PC correctly.
+- BSR.L was emulated as 68020+ instruction on 68000/010. (BCC.L was correct)
+- For some reason 68000 BSR.B and BSR.W address exception stack frame PC field points to new odd PC, instead of address of BSR opcode.
+
 Beta 17:
 
 - Enabled windowed mode window maximize button.
index 6ddaad4cb74b0d5277bc36f5d19ad1fe3bb5684c..07c5036f425dfd2082748ed2546a44329e8de289 100644 (file)
--- a/table68k
+++ b/table68k
 1111 0011 01ss sSSS:202:?????:?????:10: FRESTORE s[!Dreg,Areg,Apdi,Immd]
 
 % 68030 MMU (allowed addressing modes not checked!)
-1111 0000 00ss sSSS:342:?????:?????:11: MMUOP030 s[Aind,Ad16,Ad8r,absl,absw],#1
+1111 0000 00ss sSSS:342:?????:?????:11: MMUOP030 s[Dreg,Areg,Apdi,Aipi,Aind,Ad16,Ad8r,absl,absw],#1
 
 % 68040/68060 instructions
 1111 0100 pp00 1rrr:402:-----:-----:02: CINVL    #p,Ar