]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
inputmerge wip
authorToni Wilen <twilen@winuae.net>
Fri, 4 Jun 2010 14:58:43 +0000 (17:58 +0300)
committerToni Wilen <twilen@winuae.net>
Fri, 4 Jun 2010 14:58:43 +0000 (17:58 +0300)
25 files changed:
cfgfile.cpp
cia.cpp
custom.cpp
debug.cpp
disk.cpp
drawing.cpp
driveclick.cpp
include/disk.h
include/events.h
include/events_jit.h
include/inputdevice.h
include/options.h
include/uae.h
inputdevice.cpp
jit/gencomp.cpp
newcpu.cpp
od-win32/dinput.cpp
od-win32/direct3d.cpp
od-win32/parser.cpp
od-win32/resources/winuae.rc
od-win32/sounddep/sound.cpp
od-win32/win32.cpp
od-win32/win32.h
od-win32/win32gui.cpp
savestate.cpp

index 9565d6419cabfb410d98c470e8dfb11e33a7360e..f990a9e7f11c55ad2821cdc7483370bb56685b18 100644 (file)
@@ -1774,6 +1774,8 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, TCHAR *option, TCHAR *va
                || cfgfile_intval (option, value, L"rtg_modes", &p->picasso96_modeflags, 1)
                || cfgfile_intval (option, value, L"floppy_speed", &p->floppy_speed, 1)
                || cfgfile_intval (option, value, L"floppy_write_length", &p->floppy_write_length, 1)
+               || cfgfile_intval (option, value, L"floppy_random_bits_min", &p->floppy_random_bits_min, 1)
+               || cfgfile_intval (option, value, L"floppy_random_bits_max", &p->floppy_random_bits_max, 1)
                || cfgfile_intval (option, value, L"nr_floppies", &p->nr_floppies, 1)
                || cfgfile_intval (option, value, L"floppy0type", &p->dfxtype[0], 1)
                || cfgfile_intval (option, value, L"floppy1type", &p->dfxtype[1], 1)
@@ -3506,6 +3508,8 @@ void default_prefs (struct uae_prefs *p, int type)
        p->dfxtype[3] = DRV_NONE;
        p->floppy_speed = 100;
        p->floppy_write_length = 0;
+       p->floppy_random_bits_min = 1;
+       p->floppy_random_bits_max = 3;
        p->dfxclickvolume = 33;
 
        p->statecapturebuffersize = 20 * 1024 * 1024;
diff --git a/cia.cpp b/cia.cpp
index 0a9060f3f7d63d6fe30338ea4cef91dcf3bb254a..03626be96dd1c73529d4f278047b9b858ca5d28b 100644 (file)
--- a/cia.cpp
+++ b/cia.cpp
@@ -561,6 +561,7 @@ static void led_vsync (void)
        if (led_old_brightness != gui_data.powerled_brightness) {
                gui_data.powerled = gui_data.powerled_brightness > 127;
                gui_led (LED_POWER, gui_data.powerled);
+               led_filter_audio ();
        }
        led_old_brightness = gui_data.powerled_brightness;
        led_cycle = get_cycles ();
@@ -591,7 +592,6 @@ static void bfe001_change (void)
                calc_led (led);
                led = led2;
                led_old_brightness = -1;
-               led_filter_audio ();
        }
        if (currprefs.cs_ciaoverlay && (v & 1) != oldovl) {
                oldovl = v & 1;
index 7f1ef72dc84343aa8c637fda96a18d74c0b8b845..9bccf37970dfbed1a1777e58cb1ef46af5d7864f 100644 (file)
@@ -129,10 +129,6 @@ struct ev2 eventtab2[ev2_max];
 
 volatile frame_time_t vsynctime, vsyncmintime;
 
-#ifdef JIT
-extern uae_u8* compiled_code;
-#endif
-
 int vpos;
 static int vpos_count, vpos_count_prev;
 static int lof_store; // real bit in custom registers
@@ -2986,9 +2982,9 @@ STATIC_INLINE int GETHPOS (void)
 }
 
 
-// DFF006 = 0.W must be valid result
+// DFF006 = 0.W must be valid result but better do this only in 68000 modes (whdload black screen!)
 
-#define HPOS_OFFSET 3
+#define HPOS_OFFSET (currprefs.cpu_model < 68020 ? 3 : 0)
 
 STATIC_INLINE uae_u16 VPOSR (void)
 {
@@ -3074,9 +3070,11 @@ STATIC_INLINE uae_u16 VHPOSR (void)
                if (vp >= maxvpos + lof_store)
                        vp = 0;
        }
-       hp += 1;
-       if (hp >= maxhpos)
-               hp -= maxhpos;
+       if (HPOS_OFFSET) {
+               hp += 1;
+               if (hp >= maxhpos)
+                       hp -= maxhpos;
+       }
 
        vp <<= 8;
        vp |= hp;
@@ -3439,8 +3437,8 @@ void INTREQ_f (uae_u16 v)
        if (use_eventmode (v)) {
                send_intreq_do (v);
        } else {
-               intreq |= v;
-               intreq_internal |= v;
+               setclr (&intreq, v);
+               setclr (&intreq_internal, v);
        }
 }
 
@@ -3489,6 +3487,7 @@ static void ADKCON (int hpos, uae_u16 v)
        if (currprefs.produce_sound > 0)
                update_audio ();
 
+       DISK_update_adkcon (hpos, v);
        setclr (&adkcon, v);
        audio_update_adkmasks ();
        DISK_update (hpos);
@@ -5021,7 +5020,7 @@ static void vsync_handler (void)
 #endif
                ) {
 #ifdef JIT
-                       if (!compiled_code) {
+                       if (!currprefs.cachesize) {
 #endif
                                if (currprefs.m68k_speed == -1) {
                                        frame_time_t curr_time = read_processor_time ();
@@ -5292,6 +5291,8 @@ static void hsync_handler (void)
        CDTV_hsync_handler ();
 #endif
        decide_blitter (-1);
+       DISK_hsync (maxhpos);
+
 #ifdef CPUEMU_12
        if (currprefs.cpu_cycle_exact || currprefs.blitter_cycle_exact) {
                memset (cycle_line, 0, sizeof cycle_line);
@@ -5413,12 +5414,11 @@ static void hsync_handler (void)
 #endif
 
 
-       DISK_hsync (maxhpos);
        if (currprefs.produce_sound)
                audio_hsync (-1);
 
 #ifdef JIT
-       if (compiled_code) {
+       if (currprefs.cachesize) {
                if (currprefs.m68k_speed == -1) {
                        static int count = 0;
                        count++;
index 54ec1941029eafd7c0c4d778ab01302849751831..606e71179b66f30d5fc07954cd3c6bfebf510b41 100644 (file)
--- a/debug.cpp
+++ b/debug.cpp
@@ -45,6 +45,7 @@ static int memwatch_enabled, memwatch_triggered;
 static uae_u16 sr_bpmask, sr_bpvalue;
 int debugging;
 int exception_debugging;
+int no_trace_exceptions;
 int debug_copper = 0;
 int debug_dma = 0;
 int debug_sprite_mask = 0xff;
@@ -3070,10 +3071,15 @@ static void debug_1 (void)
                                show_exec_lists (inptr[0]);
                        break;
                case 't':
-                       if (more_params (&inptr))
-                               skipaddr_doskip = readint (&inptr);
-                       if (skipaddr_doskip <= 0 || skipaddr_doskip > 10000)
-                               skipaddr_doskip = 1;
+                       no_trace_exceptions = 0;
+                       if (*inptr != 't') {
+                               if (more_params (&inptr))
+                                       skipaddr_doskip = readint (&inptr);
+                               if (skipaddr_doskip <= 0 || skipaddr_doskip > 10000)
+                                       skipaddr_doskip = 1;
+                       } else {
+                               no_trace_exceptions = 1;
+                       }
                        set_special (SPCFLAG_BRK);
                        exception_debugging = 1;
                        return;
index 07393ee556f1e97ccc94d98b1f24e182a39e4cc4..1a904127ed828ead3565e7e9af4505de103d9fd6 100644 (file)
--- a/disk.cpp
+++ b/disk.cpp
@@ -55,8 +55,8 @@ static int longwritemode = 0;
 #define FLOPPY_WRITE_MAXLEN 0x3800
 /* This works out to 350 */
 #define FLOPPY_GAP_LEN (FLOPPY_WRITE_LEN - 11 * 544)
-/* (cycles/bitcell) << 8, normal = ((2us/280ns)<<8) = ~1830 */
-#define NORMAL_FLOPPY_SPEED (currprefs.ntscmode ? 1810 : 1829)
+/* (cycles/bitcell) << 8, normal = ((2us/280ns)<<8) = ~1829.5714 */
+#define NORMAL_FLOPPY_SPEED (currprefs.ntscmode ? 1811 : 1829)
 /* max supported floppy drives, for small memory systems */
 #define MAX_FLOPPY_DRIVES 4
 
@@ -103,6 +103,8 @@ static uae_u16 dskbytr_val;
 static uae_u32 dskpt;
 static int dma_enable, bitoffset, syncoffset;
 static uae_u16 word, dsksync;
+static unsigned long dsksync_cycles;
+#define WORDSYNC_TIME 11
 /* Always carried through to the next line.  */
 static int disk_hpos;
 static int disk_jitter;
@@ -2363,7 +2365,7 @@ int disk_empty (int num)
        return drive_empty (floppy + num);
 }
 
-static TCHAR *tobin(uae_u8 v)
+static TCHAR *tobin (uae_u8 v)
 {
        int i;
        static TCHAR buf[10];
@@ -2720,13 +2722,19 @@ static void disk_doupdate_write (drive * drv, int floppybits)
        }
 }
 
+static void update_jitter (void)
+{
+       if (currprefs.floppy_random_bits_max > 0)
+               disk_jitter = ((uaerand () >> 4) % (currprefs.floppy_random_bits_max - currprefs.floppy_random_bits_min + 1)) + currprefs.floppy_random_bits_min;
+       else
+               disk_jitter = 0;
+}
+
 static void updatetrackspeed (drive *drv, int mfmpos)
 {
        if (dskdmaen < 3) {
-               uae_u16 *p = drv->tracktiming;
-               p += mfmpos / 8;
-               drv->trackspeed = get_floppy_speed2 (drv);
-               drv->trackspeed = drv->trackspeed * p[0] / 1000;
+               int t = drv->tracktiming[mfmpos / 8];
+               drv->trackspeed = get_floppy_speed2 (drv) * t / 1000;
                if (drv->trackspeed < 700 || drv->trackspeed > 3000) {
                        static int warned;
                        warned++;
@@ -2770,6 +2778,7 @@ static void disk_doupdate_predict (drive * drv, int startcycle)
                        indexhack = 0;
                }
                if (dskdmaen != 3 && mfmpos == drv->skipoffset) {
+                       update_jitter ();
                        int skipcnt = disk_jitter;
                        while (skipcnt-- > 0) {
                                mfmpos++;
@@ -2886,23 +2895,22 @@ static void disk_doupdate_read (drive * drv, int floppybits)
                        drv->indexhack = 0;
                }
                if (drv->mfmpos == drv->skipoffset) {
+                       update_jitter ();
                        drv->mfmpos += disk_jitter;
                        drv->mfmpos %= drv->tracklen;
                }
-               bool dmadone = doreaddma ();
+               doreaddma ();
                if ((bitoffset & 7) == 7) {
                        dskbytr_val = word & 0xff;
                        dskbytr_val |= 0x8000;
                }
                if (word == dsksync) {
+                       dsksync_cycles = get_cycles () + WORDSYNC_TIME * CYCLE_UNIT;
                        if (dskdmaen) {
                                if (disk_debug_logging && dma_enable == 0)
                                        write_log (L"Sync match, DMA started at %d PC=%08x\n", drv->mfmpos, M68K_GETPC);
                                dma_enable = 1;
                        }
-                       // start DMA immediately if bitoffset is already in sync instead of waiting for next word
-                       if (!dmadone)
-                               doreaddma ();
                        if (adkcon & 0x400)
                                bitoffset = 15;
                }
@@ -2948,7 +2956,7 @@ uae_u16 DSKBYTR (int hpos)
        DISK_update (hpos);
        v = dskbytr_val;
        dskbytr_val &= ~0x8000;
-       if (word == dsksync)
+       if (word == dsksync && cycles_in_range (dsksync_cycles))
                v |= 0x1000;
        if (dskdmaen && dmaen (DMA_DISK))
                v |= 0x4000;
@@ -3029,7 +3037,6 @@ void DISK_update (int tohpos)
        int startcycle = disk_hpos;
        int didread;
 
-       disk_jitter = ((uaerand () >> 4) & 3) + 1;
        if (cycles <= 0)
                return;
        disk_hpos += cycles;
@@ -3269,6 +3276,18 @@ void DSKLEN (uae_u16 v, int hpos)
        }
 }
 
+void DISK_update_adkcon (int hpos, uae_u16 v)
+{
+       uae_u16 vold = adkcon;
+       uae_u16 vnew = adkcon;
+       if (v & 0x8000)
+                vnew |= v & 0x7FFF;
+       else
+               vnew &= ~v;
+       if ((vnew & 0x400) && !(vold & 0x400))
+               bitoffset = 0;
+}
+
 void DSKSYNC (int hpos, uae_u16 v)
 {
        if (v == dsksync)
index 8a4e16465aab9b2c3df6ed5558688b4351c62fc2..9c80e9889e11a310fd7de147b28e1e6e313ea4f6 100644 (file)
@@ -2146,7 +2146,7 @@ static void center_image (void)
        int prev_y_adjust = thisframe_y_adjust;
        int tmp;
 
-       if (currprefs.gfx_xcenter && !currprefs.gfx_filter_autoscale) {
+       if (currprefs.gfx_xcenter && !currprefs.gfx_filter_autoscale && max_diwstop > 0) {
                int w = gfxvidinfo.width;
 
                if (max_diwstop - min_diwstart < w && currprefs.gfx_xcenter == 2)
@@ -2163,7 +2163,7 @@ static void center_image (void)
                                visible_left_border = prev_x_adjust;
                }
        } else {
-               if (beamcon0 & 0x80) {
+               if ((beamcon0 & 0x80) && max_diwstop > 0) {
                        int w = gfxvidinfo.width;
                        if (max_diwstop - min_diwstart < w)
                                visible_left_border = (max_diwstop - min_diwstart - w) / 2 + min_diwstart;
index a1e370902556b262ab42e015574892c1f4caa687..6e1b1093ddf7d9573d47617b9d9bb66687d8e293 100644 (file)
@@ -167,7 +167,7 @@ void driveclick_init (void)
                                wave_initialized = 1;
                                for (j = 0; j < CLICK_TRACKS; j++)
                                        drvs[i][DS_CLICK].lengths[j] = drvs[i][DS_CLICK].len;
-                               _stprintf (tmp, L"%splugins%cfloppysounds%c", start_path_data, FSDB_DIR_SEPARATOR, FSDB_DIR_SEPARATOR, FSDB_DIR_SEPARATOR);
+                               _stprintf (tmp, L"%splugins%cfloppysounds%c", start_path_plugins, FSDB_DIR_SEPARATOR, FSDB_DIR_SEPARATOR, FSDB_DIR_SEPARATOR);
                                if (my_existsdir (tmp))
                                        _tcscpy (path2, tmp);
                                else
index 8445ea7b8d98ec1478387ce0bd5f98b302b66374..dd4dbcb5fc047755b466fb2eaaa197a2512dbe3d 100644 (file)
@@ -23,6 +23,7 @@ extern void DISK_check_change (void);
 extern int DISK_validate_filename (const TCHAR *fname, int leave_open, bool *wrprot, uae_u32 *crc32, struct zfile **zf);
 extern void DISK_handler (uae_u32);
 extern void DISK_update (int hpos);
+extern void DISK_update_adkcon (int hpos, uae_u16 v);
 extern void DISK_hsync (int hpos);
 extern void DISK_reset (void);
 extern int disk_getwriteprotect (const TCHAR *name);
index 3446a9e7558cb849ac5c0947dcd9b5d59c634534..49a917e562823690f3d020bb82ff19252a4d6301 100644 (file)
@@ -82,4 +82,10 @@ STATIC_INLINE int current_hpos (void)
     return (get_cycles () - eventtab[ev_hsync].oldcycles) / CYCLE_UNIT;
 }
 
+STATIC_INLINE bool cycles_in_range (unsigned long endcycles)
+{
+       signed long c = get_cycles ();
+       return (signed long)endcycles - c > 0;
+}
+
 #endif
index 2e4da10bef1ace0e64f298e22fe8adc61ea7f3e8..5b54cc10382f982ec7d34410425dab60e9cd3275 100644 (file)
@@ -23,23 +23,19 @@ STATIC_INLINE void events_schedule (void)
        nextevent = currcycle + mintime;
 }
 
-#ifdef JIT
-extern uae_u8* compiled_code;
-#endif
 extern signed long pissoff;
 
 STATIC_INLINE void cycles_do_special (void)
 {
 #ifdef JIT
-       if (compiled_code) {
+       if (currprefs.cachesize) {
                if (pissoff >= 0)
                        pissoff = -1;
-       } else {
+       } else
+#endif
+       {
                pissoff = 0;
        }
-#else
-       pissoff = 0;
-#endif
 }
 
 STATIC_INLINE void do_extra_cycles (unsigned long cycles_to_add)
index 605ca574e3dd9084014c676a36df09fec730873d..d036c828d702de69b3e6f93bf63adc184b12c0f8 100644 (file)
@@ -50,6 +50,7 @@ struct inputevent {
 /* event flags */
 #define ID_FLAG_AUTOFIRE 1
 #define ID_FLAG_TOGGLE 2
+#define ID_FLAG_GAMEPORTSCUSTOM 4
 #define ID_FLAG_SAVE_MASK 0xff
 #define ID_FLAG_TOGGLED 0x100
 
@@ -62,6 +63,7 @@ struct inputevent {
 #define IDEV_MAPPED_AUTOFIRE_POSSIBLE 1
 #define IDEV_MAPPED_AUTOFIRE_SET 2
 #define IDEV_MAPPED_TOGGLE 4
+#define IDEV_MAPPED_GAMEPORTSCUSTOM 8
 
 #define ID_BUTTON_OFFSET 0
 #define ID_BUTTON_TOTAL 32
@@ -69,8 +71,8 @@ struct inputevent {
 #define ID_AXIS_TOTAL 32
 
 extern int inputdevice_iterate (int devnum, int num, TCHAR *name, int *af);
-extern int inputdevice_set_mapping (int devnum, int num, TCHAR *name, TCHAR *custom, int flags, int sub);
-extern int inputdevice_get_mapped_name (int devnum, int num, int *pflags, TCHAR *name, TCHAR *custom, int sub);
+extern int inputdevice_set_mapping (int devnum, int num, TCHAR *name, TCHAR *custom, int flags, int port, int sub);
+extern int inputdevice_get_mapped_name (int devnum, int num, int *pflags, int *port, TCHAR *name, TCHAR *custom, int sub);
 extern void inputdevice_copyconfig (const struct uae_prefs *src, struct uae_prefs *dst);
 extern void inputdevice_copy_single_config (struct uae_prefs *p, int src, int dst, int devnum);
 extern void inputdevice_swap_ports (struct uae_prefs *p, int devnum);
index b82e6147cc93c70a4423804e611557e7db1e9a26..a1694d4adcb7a459779dbc208c2cc7211cff6580 100644 (file)
@@ -38,6 +38,7 @@ struct uae_input_device {
        TCHAR *custom[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT];
        uae_u16 flags[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT];
        uae_s16 extra[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SIMULTANEOUS_KEYS];
+       uae_s8 port[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SIMULTANEOUS_KEYS];
        uae_s8 enabled;
 };
 
@@ -225,6 +226,8 @@ struct uae_prefs {
        bool blitter_cycle_exact;
        int floppy_speed;
        int floppy_write_length;
+       int floppy_random_bits_min;
+       int floppy_random_bits_max;
        bool tod_hack;
        uae_u32 maprom;
        int turbo_emulation;
index 43c92f3284aa5d630b81bfac201409a641ca837c..c6b72646f6af40f455a592cc8ffbb789c852a7e9 100644 (file)
@@ -32,6 +32,7 @@ extern bool console_emulation;
 extern TCHAR warning_buffer[256];
 extern TCHAR start_path_data[];
 extern TCHAR start_path_data_exe[];
+extern TCHAR start_path_plugins[];
 
 /* This structure is used to define menus. The val field can hold key
  * shortcuts, or one of these special codes:
index 4ad381cd95321f0640e0a63634ae9735af5174e5..0c42637455eae01ee296903c20e52cdd6ce835ec 100644 (file)
@@ -115,8 +115,9 @@ static struct uae_input_device2 joysticks2[MAX_INPUT_DEVICES];
 static struct uae_input_device2 mice2[MAX_INPUT_DEVICES];
 static uae_u8 scancodeused[MAX_INPUT_DEVICES][256];
 
-static int mouse_pullup = 1;
-static int joystick_pullup = 1;
+// fire/left mouse button pullup resistors enabled?
+static bool mouse_pullup = true;
+static bool joystick_pullup = true;
 
 static int input_acquired;
 static int testmode, testmode_read, testmode_toggle;
@@ -143,6 +144,10 @@ static int inprec_div;
 static uae_u32 oldbuttons[4];
 static uae_u16 oldjoy[2];
 
+static int bouncy;
+static signed long bouncy_cycles;
+#define BOUNCY_CYCLES 30
+
 int inprec_open (TCHAR *fname, int record)
 {
        uae_u32 t = (uae_u32)time(0);
@@ -686,7 +691,7 @@ void write_inputdevice_config (struct uae_prefs *p, struct zfile *f)
 {
        int i, id;
 
-       cfgfile_write (f, L"input.config", L"%d", p->input_selected_setting + 1);
+       cfgfile_write (f, L"input.config", L"%d", p->input_selected_setting == GAMEPORT_INPUT_SETTINGS ? 0 : p->input_selected_setting + 1);
        cfgfile_write (f, L"input.joymouse_speed_analog", L"%d", p->input_joymouse_multiplier);
        cfgfile_write (f, L"input.joymouse_speed_digital", L"%d", p->input_joymouse_speed);
        cfgfile_write (f, L"input.joymouse_deadzone", L"%d", p->input_joymouse_deadzone);
@@ -2070,6 +2075,7 @@ static void cap_check (void)
        }
 }
 
+
 uae_u8 handle_joystick_buttons (uae_u8 dra)
 {
        uae_u8 but = 0;
@@ -2077,18 +2083,28 @@ uae_u8 handle_joystick_buttons (uae_u8 dra)
 
        cap_check ();
        for (i = 0; i < 2; i++) {
+               int mask = 0x40 << i;
                if (cd32_pad_enabled[i]) {
                        uae_u16 p5dir = 0x0200 << (i * 4);
                        uae_u16 p5dat = 0x0100 << (i * 4);
                        but |= 0x40 << i;
                        if (!cd32padmode (p5dir, p5dat)) {
                                if (getbuttonstate (i, JOYBUTTON_CD32_RED))
-                                       but &= ~(0x40 << i);
+                                       but &= ~mask;
                        }
-               } else if (!getbuttonstate (i, JOYBUTTON_1)) {
-                       but |= 0x40 << i;
+               } else {
+                       if (!getbuttonstate (i, JOYBUTTON_1))
+                               but |= mask;
+                       if (bouncy && cycles_in_range (bouncy_cycles)) {
+                               but &= ~mask;
+                               if (uaerand () & 1)
+                                       but |= mask;
+                       }
+
                }
        }
+
+
        if (inputdevice_logging & 4)
                write_log (L"BFE001: %02X:%02X %x\n", dra, but, M68K_GETPC);
        return but;
@@ -2201,6 +2217,9 @@ void inputdevice_hsync (void)
                }
        }
 
+       if (bouncy && get_cycles () > bouncy_cycles)
+               bouncy = 0;
+
        if ((++cnt & 63) == 63 ) {
                inputdevice_read ();
        } else if (inputdelay > 0) {
@@ -2691,12 +2710,20 @@ int handle_input_event (int nr, int state, int max, int autofire)
        case 4: /* ->Parallel port joystick adapter port #2 */
                joy = ie->unit - 1;
                if (ie->type & 4) {
+                       int old = joybutton[joy] & (1 << ie->data);
 
                        if (state)
                                joybutton[joy] |= 1 << ie->data;
                        else
                                joybutton[joy] &= ~(1 << ie->data);
 
+                       if (ie->data == 0 && old != (joybutton[joy] & (1 << ie->data)) && currprefs.cpu_cycle_exact) {
+                               // emulate contact bounce, 1st button only, others have capacitors
+                               bouncy = 1;
+                               bouncy_cycles = get_cycles () + CYCLE_UNIT * BOUNCY_CYCLES;
+                       }
+
+
                } else if (ie->type & 8) {
 
                        /* real mouse / analog stick mouse emulation */
@@ -3506,7 +3533,7 @@ static void checkcompakb (int *kb, int *srcmap)
        }
 }
 
-static void setcompakb (int *kb, int *srcmap)
+static void setcompakb (int *kb, int *srcmap, int index)
 {
        int j, k;
        k = j = 0;
@@ -3518,7 +3545,8 @@ static void setcompakb (int *kb, int *srcmap)
                                for (int l = 0; l < MAX_INPUT_DEVICE_EVENTS; l++) {
                                        if (uid->extra[l][0] == id) {
                                                uid->eventid[l][0] = srcmap[k];
-                                               uid->flags[l][0] &= ID_FLAG_SAVE_MASK;
+                                               uid->flags[l][0] = 0;
+                                               uid->port[l][0] = index + 1;
                                                xfree (uid->custom[l][0]);
                                                uid->custom[l][0] = NULL;
                                                break;
@@ -3636,6 +3664,45 @@ static void remove_compa_config (struct uae_prefs *prefs, int index)
        }
 }
 
+static void cleardevgp (struct uae_input_device *uid, int num, int index)
+{
+       for (int i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) {
+               for (int j = 0; j < MAX_INPUT_SUB_EVENT; j++) {
+                       if (uid[num].port[i][j] == index + 1) {
+                               uid[num].eventid[i][j] = 0;
+                               uid[num].flags[i][j] = 0;
+                               xfree (uid[num].custom[i][j]);
+                               uid[num].custom[i][j] = NULL;
+                       }
+               }
+       }
+}
+static void cleardevkbrgp (struct uae_input_device *uid, int num, int index)
+{
+       for (int i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) {
+               for (int j = 0; j < MAX_INPUT_SUB_EVENT; j++) {
+                       if (uid[num].port[i][j] == index + 1) {
+                               uid[num].eventid[i][j] = 0;
+                               uid[num].flags[i][j] = 0;
+                               xfree (uid[num].custom[i][j]);
+                               uid[num].custom[i][j] = NULL;
+                               if (j == 0)
+                                       set_kbr_default_event (&uid[num], keyboard_default, i);
+                       }
+               }
+       }
+}
+
+static void remove_custom_config (struct uae_prefs *prefs, int index)
+{
+       for (int l = 0; l < MAX_INPUT_DEVICES; l++) {
+               cleardevgp (joysticks, l, index);
+               cleardevgp (mice, l, index);
+               cleardevkbrgp (keyboards, l, index);
+       }
+}
+
+
 // prepare port for custom mapping, remove all current Amiga side device mappings
 void inputdevice_compa_prepare_custom (struct uae_prefs *prefs, int index)
 {
@@ -3648,6 +3715,7 @@ void inputdevice_compa_prepare_custom (struct uae_prefs *prefs, int index)
        prefs->jports[index].id = -2;
 
        remove_compa_config (prefs, index);
+       remove_custom_config (prefs, index);
 }
 // clear device before switching to new one
 void inputdevice_compa_clear (struct uae_prefs *prefs, int index)
@@ -3657,7 +3725,6 @@ void inputdevice_compa_clear (struct uae_prefs *prefs, int index)
        remove_compa_config (prefs, index);
 }
 
-
 static void cleardev (struct uae_input_device *uid, int num)
 {
        for (int i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) {
@@ -3670,7 +3737,6 @@ static void cleardev (struct uae_input_device *uid, int num)
        }
 }
 
-
 static void enablejoydevice (struct uae_input_device *uid, int evtnum)
 {
        for (int i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) {
@@ -3754,6 +3820,7 @@ static void setautofire (struct uae_input_device *uid, int port, int af)
                }
        }
 }
+
 static void setautofires (struct uae_prefs *prefs, int port, int af)
 {
        for (int l = 0; l < MAX_INPUT_DEVICES; l++) {
@@ -3764,7 +3831,7 @@ static void setautofires (struct uae_prefs *prefs, int port, int af)
 }
 
 // merge gameport settings with current input configuration
-static void compatibility_copy (struct uae_prefs *prefs)
+static void compatibility_copy (struct uae_prefs *prefs, bool gameports)
 {
        int used[MAX_INPUT_DEVICES] = { 0 };
        int i, joy;
@@ -3773,8 +3840,12 @@ static void compatibility_copy (struct uae_prefs *prefs)
                joymodes[i] = prefs->jports[i].mode;
                joyinputs[i]= NULL;
                // remove all mappings from this port, except if custom
-               if (prefs->jports[i].id != JPORT_CUSTOM)
-                       remove_compa_config (prefs, i);
+               if (prefs->jports[i].id != JPORT_CUSTOM) {
+                       if (gameports) {
+                               remove_compa_config (prefs, i);
+                               remove_custom_config (prefs, i);
+                       }
+               }
                setjoyinputs (prefs, i);
        }
 
@@ -3919,17 +3990,19 @@ static void compatibility_copy (struct uae_prefs *prefs)
                }
        }
 
-       // replace possible old mappings with default keyboard mapping
-       for (i = KBR_DEFAULT_MAP_NP; i <= KBR_DEFAULT_MAP_SE; i++) {
-               checkcompakb (keyboard_default_kbmaps[i], ip_joy2);
-               checkcompakb (keyboard_default_kbmaps[i], ip_joy1);
-               checkcompakb (keyboard_default_kbmaps[i], ip_parjoy2);
-               checkcompakb (keyboard_default_kbmaps[i], ip_parjoy1);
-               checkcompakb (keyboard_default_kbmaps[i], ip_mouse2);
-               checkcompakb (keyboard_default_kbmaps[i], ip_mouse1);
+       if (gameports) {
+               // replace possible old mappings with default keyboard mapping
+               for (i = KBR_DEFAULT_MAP_NP; i <= KBR_DEFAULT_MAP_SE; i++) {
+                       checkcompakb (keyboard_default_kbmaps[i], ip_joy2);
+                       checkcompakb (keyboard_default_kbmaps[i], ip_joy1);
+                       checkcompakb (keyboard_default_kbmaps[i], ip_parjoy2);
+                       checkcompakb (keyboard_default_kbmaps[i], ip_parjoy1);
+                       checkcompakb (keyboard_default_kbmaps[i], ip_mouse2);
+                       checkcompakb (keyboard_default_kbmaps[i], ip_mouse1);
+               }
+               checkcompakb (keyboard_default_kbmaps[5], ip_joycd321);
+               checkcompakb (keyboard_default_kbmaps[5], ip_joycd322);
        }
-       checkcompakb (keyboard_default_kbmaps[5], ip_joycd321);
-       checkcompakb (keyboard_default_kbmaps[5], ip_joycd322);
 
        for (i = 0; i < 2; i++) {
                if (prefs->jports[i].id >= 0) {
@@ -3965,15 +4038,15 @@ static void compatibility_copy (struct uae_prefs *prefs)
                                        case JSEM_MODE_JOYSTICK_CD32:
                                        case JSEM_MODE_DEFAULT:
                                                if (cd32) {
-                                                       setcompakb (kb, i ? ip_joycd322 : ip_joycd321);
+                                                       setcompakb (kb, i ? ip_joycd322 : ip_joycd321, i);
                                                        joymodes[i] = JSEM_MODE_JOYSTICK_CD32;
                                                } else {
-                                                       setcompakb (kb, i ? ip_joy2 : ip_joy1);
+                                                       setcompakb (kb, i ? ip_joy2 : ip_joy1, i);
                                                        joymodes[i] = JSEM_MODE_JOYSTICK;
                                                }
                                                break;
                                        case JSEM_MODE_MOUSE:
-                                               setcompakb (kb, i ? ip_mouse2 : ip_mouse1);
+                                               setcompakb (kb, i ? ip_mouse2 : ip_mouse1, i);
                                                joymodes[i] = JSEM_MODE_MOUSE;
                                                break;
                                        }
@@ -3983,9 +4056,9 @@ static void compatibility_copy (struct uae_prefs *prefs)
                }
        }
        if (arcadia_bios) {
-               setcompakb (keyboard_default_kbmaps[KBR_DEFAULT_MAP_ARCADIA], ip_arcadia);
+               setcompakb (keyboard_default_kbmaps[KBR_DEFAULT_MAP_ARCADIA], ip_arcadia, 0);
                if (JSEM_ISXARCADE1 (i, prefs) || JSEM_ISXARCADE2 (i, prefs))
-                       setcompakb (keyboard_default_kbmaps[KBR_DEFAULT_MAP_ARCADIA_XA], ip_arcadiaxa);
+                       setcompakb (keyboard_default_kbmaps[KBR_DEFAULT_MAP_ARCADIA_XA], ip_arcadiaxa, JSEM_ISXARCADE2 (i, prefs) ? 1 : 0);
        }
 
        // parport
@@ -4019,13 +4092,14 @@ static void compatibility_copy (struct uae_prefs *prefs)
                                else if (JSEM_ISXARCADE2 (i, prefs))
                                        kb = keyboard_default_kbmaps[KBR_DEFAULT_MAP_XA2];
                                if (kb) {
-                                       setcompakb (kb, i == 3 ? ip_parjoy2 : ip_parjoy1);
+                                       setcompakb (kb, i == 3 ? ip_parjoy2 : ip_parjoy1, i);
                                        used[joy] = 1;
                                        joymodes[i] = JSEM_MODE_JOYSTICK;
                                }
                        }
                }
        }
+
        for (i = 0; i < MAX_JPORTS; i++)
                setautofires (prefs, i, prefs->jports[i].autofire);
 
@@ -4171,10 +4245,13 @@ void inputdevice_updateconfig (struct uae_prefs *prefs)
                joysticks[i].enabled = 0;
                mice[i].enabled = 0;
        }
-       compatibility_copy (prefs);
+       compatibility_copy (prefs, true);
        joysticks = prefs->joystick_settings[prefs->input_selected_setting];
        mice = prefs->mouse_settings[prefs->input_selected_setting];
        keyboards = prefs->keyboard_settings[prefs->input_selected_setting];
+       if (prefs->input_selected_setting != GAMEPORT_INPUT_SETTINGS) {
+               compatibility_copy (prefs, false);
+       }
 
        scanevents (prefs);
 
@@ -4432,7 +4509,7 @@ static struct uae_input_device *get_uid (const struct inputdevice_functions *id,
        return uid;
 }
 
-static int get_event_data (const struct inputdevice_functions *id, int devnum, int num, int *eventid, TCHAR **custom, int *flags, int sub)
+static int get_event_data (const struct inputdevice_functions *id, int devnum, int num, int *eventid, TCHAR **custom, int *flags, int *port, int sub)
 {
        const struct uae_input_device *uid = get_uid (id, devnum);
        int type = id->get_widget_type (devnum, num, 0, 0);
@@ -4441,25 +4518,28 @@ static int get_event_data (const struct inputdevice_functions *id, int devnum, i
                i = num - id->get_widget_first (devnum, IDEV_WIDGET_BUTTON) + ID_BUTTON_OFFSET;
                *eventid = uid->eventid[i][sub];
                *flags = uid->flags[i][sub];
+               *port = uid->port[i][sub];
                *custom = uid->custom[i][sub];
                return i;
        } else if (type == IDEV_WIDGET_AXIS) {
                i = num - id->get_widget_first (devnum, type) + ID_AXIS_OFFSET;
                *eventid = uid->eventid[i][sub];
                *flags = uid->flags[i][sub];
+               *port = uid->port[i][sub];
                *custom = uid->custom[i][sub];
                return i;
        } else if (type == IDEV_WIDGET_KEY) {
                i = num - id->get_widget_first (devnum, type);
                *eventid = uid->eventid[i][sub];
                *flags = uid->flags[i][sub];
+               *port = uid->port[i][sub];
                *custom = uid->custom[i][sub];
                return i;
        }
        return -1;
 }
 
-static int put_event_data (const struct inputdevice_functions *id, int devnum, int num, int eventid, TCHAR *custom, int flags, int sub)
+static int put_event_data (const struct inputdevice_functions *id, int devnum, int num, int eventid, TCHAR *custom, int flags, int port, int sub)
 {
        struct uae_input_device *uid = get_uid (id, devnum);
        int type = id->get_widget_type (devnum, num, 0, 0);
@@ -4468,6 +4548,7 @@ static int put_event_data (const struct inputdevice_functions *id, int devnum, i
                i = num - id->get_widget_first (devnum, IDEV_WIDGET_BUTTON) + ID_BUTTON_OFFSET;
                uid->eventid[i][sub] = eventid;
                uid->flags[i][sub] = flags;
+               uid->port[i][sub] = port;
                xfree (uid->custom[i][sub]);
                uid->custom[i][sub] = custom && _tcslen (custom) > 0 ? my_strdup (custom) : NULL;
                return i;
@@ -4475,6 +4556,7 @@ static int put_event_data (const struct inputdevice_functions *id, int devnum, i
                i = num - id->get_widget_first (devnum, type) + ID_AXIS_OFFSET;
                uid->eventid[i][sub] = eventid;
                uid->flags[i][sub] = flags;
+               uid->port[i][sub] = port;
                xfree (uid->custom[i][sub]);
                uid->custom[i][sub] = custom && _tcslen (custom) > 0 ? my_strdup (custom) : NULL;
                return i;
@@ -4482,6 +4564,7 @@ static int put_event_data (const struct inputdevice_functions *id, int devnum, i
                i = num - id->get_widget_first (devnum, type);
                uid->eventid[i][sub] = eventid;
                uid->flags[i][sub] = flags;
+               uid->port[i][sub] = port;
                xfree (uid->custom[i][sub]);
                uid->custom[i][sub] = custom && _tcslen (custom) > 0 ? my_strdup (custom) : NULL;
                return i;
@@ -4497,7 +4580,7 @@ static int is_event_used (const struct inputdevice_functions *id, int devnum, in
 
        for (num = 0; num < id->get_widget_num (devnum); num++) {
                for (sub = 0; sub < MAX_INPUT_SUB_EVENT; sub++) {
-                       if (get_event_data (id, devnum, num, &evt, &custom, &flag, sub) >= 0) {
+                       if (get_event_data (id, devnum, num, &evt, &custom, &flag, NULL, sub) >= 0) {
                                if (evt == isevent && isnum != num)
                                        return 1;
                        }
@@ -4671,7 +4754,7 @@ int inputdevice_iterate (int devnum, int num, TCHAR *name, int *af)
                }
                if (!(ie->allow_mask & mask))
                        continue;
-               get_event_data (idf, devindex, num, &data, &custom, &flags, 0);
+               get_event_data (idf, devindex, num, &data, &custom, &flags, NULL, 0);
                inputdevice_get_eventname (ie, name);
                *af = (flags & ID_FLAG_AUTOFIRE) ? 1 : 0;
                return 1;
@@ -4679,11 +4762,11 @@ int inputdevice_iterate (int devnum, int num, TCHAR *name, int *af)
 }
 
 // return mapped event from devnum/num/sub
-int inputdevice_get_mapped_name (int devnum, int num, int *pflags, TCHAR *name, TCHAR *custom, int sub)
+int inputdevice_get_mapped_name (int devnum, int num, int *pflags, int *pport, TCHAR *name, TCHAR *custom, int sub)
 {
        const struct inputdevice_functions *idf = getidf (devnum);
        const struct uae_input_device *uid = get_uid (idf, inputdevice_get_device_index (devnum));
-       int flags = 0, flag, data;
+       int flags = 0, flag, port, data;
        int devindex = inputdevice_get_device_index (devnum);
        TCHAR *customp = NULL;
 
@@ -4693,9 +4776,11 @@ int inputdevice_get_mapped_name (int devnum, int num, int *pflags, TCHAR *name,
                custom[0] = 0;
        if (pflags)
                *pflags = 0;
+       if (pport)
+               *pport = 0;
        if (uid == 0 || num < 0)
                return 0;
-       if (get_event_data (idf, devindex, num, &data, &customp, &flag, sub) < 0)
+       if (get_event_data (idf, devindex, num, &data, &customp, &flag, &port, sub) < 0)
                return 0;
        if (customp && custom)
                _tcscpy (custom, customp);
@@ -4703,22 +4788,26 @@ int inputdevice_get_mapped_name (int devnum, int num, int *pflags, TCHAR *name,
                flags |= IDEV_MAPPED_AUTOFIRE_SET;
        if (flag & ID_FLAG_TOGGLE)
                flags |= IDEV_MAPPED_TOGGLE;
+       if (flag & ID_FLAG_GAMEPORTSCUSTOM)
+               flags |= IDEV_MAPPED_GAMEPORTSCUSTOM;
        if (!data)
                return 0;
        if (events[data].allow_mask & AM_AF)
                flags |= IDEV_MAPPED_AUTOFIRE_POSSIBLE;
        if (pflags)
                *pflags = flags;
+       if (pport)
+               *pport = port;
        inputdevice_get_eventname (&events[data], name);
        return data;
 }
 
 // set event name/custom/flags to devnum/num/sub
-int inputdevice_set_mapping (int devnum, int num, TCHAR *name, TCHAR *custom, int flags, int sub)
+int inputdevice_set_mapping (int devnum, int num, TCHAR *name, TCHAR *custom, int flags, int port, int sub)
 {
        const struct inputdevice_functions *idf = getidf (devnum);
        const struct uae_input_device *uid = get_uid (idf, inputdevice_get_device_index (devnum));
-       int eid, data, flag, amask;
+       int eid, data, flag, portp, amask;
        TCHAR ename[256];
        int devindex = inputdevice_get_device_index (devnum);
        TCHAR *customp = NULL;
@@ -4729,7 +4818,8 @@ int inputdevice_set_mapping (int devnum, int num, TCHAR *name, TCHAR *custom, in
                eid = 1;
                while (events[eid].name) {
                        inputdevice_get_eventname (&events[eid], ename);
-                       if (!_tcscmp(ename, name)) break;
+                       if (!_tcscmp(ename, name))
+                               break;
                        eid++;
                }
                if (!events[eid].name)
@@ -4739,16 +4829,19 @@ int inputdevice_set_mapping (int devnum, int num, TCHAR *name, TCHAR *custom, in
        } else {
                eid = 0;
        }
-       if (get_event_data (idf, devindex, num, &data, &customp, &flag, sub) < 0)
+       if (get_event_data (idf, devindex, num, &data, &customp, &flag, &portp, sub) < 0)
                return 0;
        if (data >= 0) {
                amask = events[eid].allow_mask;
-               flag &= ~(ID_FLAG_AUTOFIRE | ID_FLAG_TOGGLE);
+               flag &= ~(ID_FLAG_AUTOFIRE | ID_FLAG_TOGGLE | ID_FLAG_GAMEPORTSCUSTOM);
                if (amask & AM_AF) {
                        flag |= (flags & IDEV_MAPPED_AUTOFIRE_SET) ? ID_FLAG_AUTOFIRE : 0;
                        flag |= (flags & IDEV_MAPPED_TOGGLE) ? ID_FLAG_TOGGLE : 0;
                }
-               put_event_data (idf, devindex, num, eid, custom, flag, sub);
+               flag |= (flags & IDEV_MAPPED_GAMEPORTSCUSTOM) ? ID_FLAG_GAMEPORTSCUSTOM : 0;
+               if (port >= 0)
+                       portp = port;
+               put_event_data (idf, devindex, num, eid, custom, flag, portp, sub);
                return 1;
        }
        return 0;
index 65df05372cea59d3d8508a72bdec2a8bba807e0d..0bb2b541596a879db33bab1e2611da680202b0b9 100644 (file)
@@ -3120,7 +3120,7 @@ main (int argc, char **argv)
     freopen ("jit/compemu.cpp", "wb", stdout);
 
     generate_includes (stdout, 1);
-    generate_includes (stblfile, 0);
+    generate_includes (stblfile, 1);
 
     printf("#include \"compemu.h\"\n");
 
index fa7b6cf71f6abf4cbaeb1ebe8aa0cd43de12e1bc..73d733cc8e11d1a4be8e1182f2ec1dafb61e9f04 100644 (file)
@@ -32,7 +32,6 @@
 #include "cia.h"
 
 #ifdef JIT
-extern uae_u8* compiled_code;
 #include "jit/compemu.h"
 #include <signal.h>
 #else
@@ -410,17 +409,8 @@ void fill_prefetch_slow (void)
 {
        if (currprefs.mmu_model)
                return;
-#ifdef CPUEMU_12
-       if (currprefs.cpu_cycle_exact) {
-               regs.ir = get_word_ce (m68k_getpc ());
-               regs.irc = get_word_ce (m68k_getpc () + 2);
-       } else {
-#endif
-               regs.ir = get_word (m68k_getpc ());
-               regs.irc = get_word (m68k_getpc () + 2);
-#ifdef CPUEMU_12
-       }
-#endif
+       regs.ir = x_get_word (m68k_getpc ());
+       regs.irc = x_get_word (m68k_getpc () + 2);
 }
 
 unsigned long cycles_mask, cycles_val;
@@ -449,7 +439,8 @@ static void update_68k_cycles (void)
        }
        if (cpucycleunit < 1)
                cpucycleunit = 1;
-       write_log (L"CPU cycleunit: %d (%.3f)\n", cpucycleunit, (float)cpucycleunit / CYCLE_UNIT);
+       if (currprefs.cpu_cycle_exact)
+               write_log (L"CPU cycleunit: %d (%.3f)\n", cpucycleunit, (float)cpucycleunit / CYCLE_UNIT);
        config_changed = 1;
 }
 
@@ -1971,8 +1962,7 @@ int m68k_movec2 (int regno, uae_u32 *regp)
        return 1;
 }
 
-STATIC_INLINE int
-       div_unsigned (uae_u32 src_hi, uae_u32 src_lo, uae_u32 div, uae_u32 *quot, uae_u32 *rem)
+STATIC_INLINE int div_unsigned (uae_u32 src_hi, uae_u32 src_lo, uae_u32 div, uae_u32 *quot, uae_u32 *rem)
 {
        uae_u32 q = 0, cbit = 0;
        int i;
@@ -2117,8 +2107,7 @@ void m68k_divl (uae_u32 opcode, uae_u32 src, uae_u16 extra, uaecptr oldpc)
 #endif
 }
 
-STATIC_INLINE void
-       mul_unsigned (uae_u32 src1, uae_u32 src2, uae_u32 *dst_hi, uae_u32 *dst_lo)
+STATIC_INLINE void mul_unsigned (uae_u32 src1, uae_u32 src2, uae_u32 *dst_hi, uae_u32 *dst_lo)
 {
        uae_u32 r0 = (src1 & 0xffff) * (src2 & 0xffff);
        uae_u32 r1 = ((src1 >> 16) & 0xffff) * (src2 & 0xffff);
@@ -2567,10 +2556,7 @@ static void do_trace (void)
                /* We can afford this to be inefficient... */
                m68k_setpc (m68k_getpc ());
                fill_prefetch_slow ();
-               if (currprefs.mmu_model)
-                       opcode = get_word_mmu (regs.pc);
-               else
-                       opcode = get_word (regs.pc);
+               opcode = x_get_word (regs.pc);
                if (opcode == 0x4e73                    /* RTE */
                        || opcode == 0x4e74             /* RTD */
                        || opcode == 0x4e75             /* RTS */
@@ -2725,7 +2711,7 @@ STATIC_INLINE int do_specialties (int cycles)
                                if (vpos != lvpos) {
                                        sleepcnt--;
 #ifdef JIT
-                                       if (pissoff == 0 && compiled_code && --zerocnt < 0) {
+                                       if (pissoff == 0 && currprefs.cachesize && --zerocnt < 0) {
                                                sleepcnt = -1;
                                                zerocnt = IDLETIME / 4;
                                        }
@@ -2952,8 +2938,6 @@ void exec_nostats (void)
 
 static int triggered;
 
-extern volatile int bsd_int_requested;
-
 void execute_normal (void)
 {
        struct regstruct *r = &regs;
@@ -3878,7 +3862,6 @@ void restore_cpu_finish (void)
        doint ();
        if (regs.stopped)
                set_special (SPCFLAG_STOP);
-
 }
 
 uae_u8 *restore_cpu_extra (uae_u8 *src)
index 25c752dda4b07a11dc694d1ff038beb249ce3484..3c2572b49398e8360fa5deeede591552ae8411c2 100644 (file)
@@ -2575,6 +2575,12 @@ int input_get_default_keyboard (int i)
        }
 }
 
+static void setid (struct uae_input_device *uid, int i, int slot, int sub, int port, int evt)
+{
+       uid[i].eventid[slot][sub] = evt;
+       uid[i].port[slot][sub] = port;
+}
+
 int input_get_default_mouse (struct uae_input_device *uid, int i, int port)
 {
        struct didata *did;
@@ -2582,19 +2588,19 @@ int input_get_default_mouse (struct uae_input_device *uid, int i, int port)
        if (i >= num_mouse)
                return 0;
        did = &di_mouse[i];
-       uid[i].eventid[ID_AXIS_OFFSET + 0][0] = port ? INPUTEVENT_MOUSE2_HORIZ : INPUTEVENT_MOUSE1_HORIZ;
-       uid[i].eventid[ID_AXIS_OFFSET + 1][0] = port ? INPUTEVENT_MOUSE2_VERT : INPUTEVENT_MOUSE1_VERT;
-       uid[i].eventid[ID_AXIS_OFFSET + 2][0] = port ? 0 : INPUTEVENT_MOUSE1_WHEEL;
-       uid[i].eventid[ID_BUTTON_OFFSET + 0][0] = port ? INPUTEVENT_JOY2_FIRE_BUTTON : INPUTEVENT_JOY1_FIRE_BUTTON;
-       uid[i].eventid[ID_BUTTON_OFFSET + 1][0] = port ? INPUTEVENT_JOY2_2ND_BUTTON : INPUTEVENT_JOY1_2ND_BUTTON;
-       uid[i].eventid[ID_BUTTON_OFFSET + 2][0] = port ? INPUTEVENT_JOY2_3RD_BUTTON : INPUTEVENT_JOY1_3RD_BUTTON;
+       setid (uid, i, ID_AXIS_OFFSET + 0, 0, port, port ? INPUTEVENT_MOUSE2_HORIZ : INPUTEVENT_MOUSE1_HORIZ);
+       setid (uid, i, ID_AXIS_OFFSET + 1, 0, port, port ? INPUTEVENT_MOUSE2_VERT : INPUTEVENT_MOUSE1_VERT);
+       setid (uid, i, ID_AXIS_OFFSET + 2, 0, port, port ? 0 : INPUTEVENT_MOUSE1_WHEEL);
+       setid (uid, i, ID_BUTTON_OFFSET + 0, 0, port, port ? INPUTEVENT_JOY2_FIRE_BUTTON : INPUTEVENT_JOY1_FIRE_BUTTON);
+       setid (uid, i, ID_BUTTON_OFFSET + 1, 0, port, port ? INPUTEVENT_JOY2_2ND_BUTTON : INPUTEVENT_JOY1_2ND_BUTTON);
+       setid (uid, i, ID_BUTTON_OFFSET + 2, 0, port, port ? INPUTEVENT_JOY2_3RD_BUTTON : INPUTEVENT_JOY1_3RD_BUTTON);
        if (port == 0) { /* map back and forward to ALT+LCUR and ALT+RCUR */
                if (isrealbutton (did, 3)) {
-                       uid[i].eventid[ID_BUTTON_OFFSET + 3][0] = INPUTEVENT_KEY_ALT_LEFT;
-                       uid[i].eventid[ID_BUTTON_OFFSET + 3][1] = INPUTEVENT_KEY_CURSOR_LEFT;
+                       setid (uid, i, ID_BUTTON_OFFSET + 3, 0, port, INPUTEVENT_KEY_ALT_LEFT);
+                       setid (uid, i, ID_BUTTON_OFFSET + 3, 1, port, INPUTEVENT_KEY_CURSOR_LEFT);
                        if (isrealbutton (did, 4)) {
-                               uid[i].eventid[ID_BUTTON_OFFSET + 4][0] = INPUTEVENT_KEY_ALT_LEFT;
-                               uid[i].eventid[ID_BUTTON_OFFSET + 4][1] = INPUTEVENT_KEY_CURSOR_RIGHT;
+                               setid (uid, i, ID_BUTTON_OFFSET + 4, 0, port, INPUTEVENT_KEY_ALT_LEFT);
+                               setid (uid, i, ID_BUTTON_OFFSET + 4, 1, port, INPUTEVENT_KEY_CURSOR_RIGHT);
                        }
                }
        }
@@ -2610,9 +2616,9 @@ int input_get_default_lightpen (struct uae_input_device *uid, int i, int port)
        if (i >= num_mouse)
                return 0;
        did = &di_mouse[i];
-       uid[i].eventid[ID_AXIS_OFFSET + 0][0] = INPUTEVENT_LIGHTPEN_HORIZ;
-       uid[i].eventid[ID_AXIS_OFFSET + 1][0] = INPUTEVENT_LIGHTPEN_VERT;
-       uid[i].eventid[ID_BUTTON_OFFSET + 0][0] = port ? INPUTEVENT_JOY2_3RD_BUTTON : INPUTEVENT_JOY1_3RD_BUTTON;
+       setid (uid, i, ID_AXIS_OFFSET + 0, 0, port, INPUTEVENT_LIGHTPEN_HORIZ);
+       setid (uid, i, ID_AXIS_OFFSET + 1, 0, port, INPUTEVENT_LIGHTPEN_VERT);
+       setid (uid, i, ID_BUTTON_OFFSET + 0, 0, port, port ? INPUTEVENT_JOY2_3RD_BUTTON : INPUTEVENT_JOY1_3RD_BUTTON);
        if (i == 0)
                return 1;
        return 0;
@@ -2637,44 +2643,44 @@ int input_get_default_joystick (struct uae_input_device *uid, int i, int port, i
                h = port ? INPUTEVENT_JOY2_HORIZ : INPUTEVENT_JOY1_HORIZ;;
                v = port ? INPUTEVENT_JOY2_VERT : INPUTEVENT_JOY1_VERT;
        }
-       uid[i].eventid[ID_AXIS_OFFSET + 0][0] = h;
-       uid[i].eventid[ID_AXIS_OFFSET + 1][0] = v;
+       setid (uid, i, ID_AXIS_OFFSET + 0, 0, port, h);
+       setid (uid, i, ID_AXIS_OFFSET + 1, 0, port, v);
 
        if (port >= 2) {
-               uid[i].eventid[ID_BUTTON_OFFSET + 0][0] = port == 3 ? INPUTEVENT_PAR_JOY2_FIRE_BUTTON : INPUTEVENT_PAR_JOY1_FIRE_BUTTON;
+               setid (uid, i, ID_BUTTON_OFFSET + 0, 0, port, port == 3 ? INPUTEVENT_PAR_JOY2_FIRE_BUTTON : INPUTEVENT_PAR_JOY1_FIRE_BUTTON);
        } else {
-               uid[i].eventid[ID_BUTTON_OFFSET + 0][0] = port ? INPUTEVENT_JOY2_FIRE_BUTTON : INPUTEVENT_JOY1_FIRE_BUTTON;
+               setid (uid, i, ID_BUTTON_OFFSET + 0, 0, port, port ? INPUTEVENT_JOY2_FIRE_BUTTON : INPUTEVENT_JOY1_FIRE_BUTTON);
                if (isrealbutton (did, 1))
-                       uid[i].eventid[ID_BUTTON_OFFSET + 1][0] = port ? INPUTEVENT_JOY2_2ND_BUTTON : INPUTEVENT_JOY1_2ND_BUTTON;
+                       setid (uid, i, ID_BUTTON_OFFSET + 1, 0, port, port ? INPUTEVENT_JOY2_2ND_BUTTON : INPUTEVENT_JOY1_2ND_BUTTON);
                if (isrealbutton (did, 2))
-                       uid[i].eventid[ID_BUTTON_OFFSET + 2][0] = port ? INPUTEVENT_JOY2_3RD_BUTTON : INPUTEVENT_JOY1_3RD_BUTTON;
+                       setid (uid, i, ID_BUTTON_OFFSET + 2, 0, port, port ? INPUTEVENT_JOY2_3RD_BUTTON : INPUTEVENT_JOY1_3RD_BUTTON);
        }
 
        for (j = 2; j < MAX_MAPPINGS - 1; j++) {
                int am = did->axismappings[j];
                if (am == DIJOFS_POV(0) || am == DIJOFS_POV(1) || am == DIJOFS_POV(2) || am == DIJOFS_POV(3)) {
-                       uid[i].eventid[ID_AXIS_OFFSET + j + 0][0] = h;
-                       uid[i].eventid[ID_AXIS_OFFSET + j + 1][0] = v;
+                       setid (uid, i, ID_AXIS_OFFSET + j + 0, 0, port, h);
+                       setid (uid, i, ID_AXIS_OFFSET + j + 1, 0, port, v);
                        j++;
                }
        }
        if (mode == JSEM_MODE_JOYSTICK_CD32) {
-               uid[i].eventid[ID_BUTTON_OFFSET + 0][0] = port ? INPUTEVENT_JOY2_CD32_RED : INPUTEVENT_JOY1_CD32_RED;
-                       uid[i].eventid[ID_BUTTON_OFFSET + 0][1] = port ? INPUTEVENT_JOY2_FIRE_BUTTON : INPUTEVENT_JOY1_FIRE_BUTTON;
+               setid (uid, i, ID_BUTTON_OFFSET + 0, 0, port, port ? INPUTEVENT_JOY2_CD32_RED : INPUTEVENT_JOY1_CD32_RED);
+               setid (uid, i, ID_BUTTON_OFFSET + 0, 1, port, port ? INPUTEVENT_JOY2_FIRE_BUTTON : INPUTEVENT_JOY1_FIRE_BUTTON);
                if (isrealbutton (did, 1)) {
-                       uid[i].eventid[ID_BUTTON_OFFSET + 1][0] = port ? INPUTEVENT_JOY2_CD32_BLUE : INPUTEVENT_JOY1_CD32_BLUE;
-                       uid[i].eventid[ID_BUTTON_OFFSET + 1][1] = port ? INPUTEVENT_JOY2_2ND_BUTTON : INPUTEVENT_JOY1_2ND_BUTTON;
+                       setid (uid, i, ID_BUTTON_OFFSET + 1, 0, port, port ? INPUTEVENT_JOY2_CD32_BLUE : INPUTEVENT_JOY1_CD32_BLUE);
+                       setid (uid, i, ID_BUTTON_OFFSET + 1, 1, port,  port ? INPUTEVENT_JOY2_2ND_BUTTON : INPUTEVENT_JOY1_2ND_BUTTON);
                }
                if (isrealbutton (did, 2))
-                       uid[i].eventid[ID_BUTTON_OFFSET + 2][0] = port ? INPUTEVENT_JOY2_CD32_GREEN : INPUTEVENT_JOY1_CD32_GREEN;
+                       setid (uid, i, ID_BUTTON_OFFSET + 2, 0, port, port ? INPUTEVENT_JOY2_CD32_GREEN : INPUTEVENT_JOY1_CD32_GREEN);
                if (isrealbutton (did, 3))
-                       uid[i].eventid[ID_BUTTON_OFFSET + 3][0] = port ? INPUTEVENT_JOY2_CD32_YELLOW : INPUTEVENT_JOY1_CD32_YELLOW;
+                       setid (uid, i, ID_BUTTON_OFFSET + 3, 0, port, port ? INPUTEVENT_JOY2_CD32_YELLOW : INPUTEVENT_JOY1_CD32_YELLOW);
                if (isrealbutton (did, 4))
-                       uid[i].eventid[ID_BUTTON_OFFSET + 4][0] = port ? INPUTEVENT_JOY2_CD32_RWD : INPUTEVENT_JOY1_CD32_RWD;
+                       setid (uid, i, ID_BUTTON_OFFSET + 4, 0, port, port ? INPUTEVENT_JOY2_CD32_RWD : INPUTEVENT_JOY1_CD32_RWD);
                if (isrealbutton (did, 5))
-                       uid[i].eventid[ID_BUTTON_OFFSET + 5][0] = port ? INPUTEVENT_JOY2_CD32_FFW : INPUTEVENT_JOY1_CD32_FFW;
+                       setid (uid, i, ID_BUTTON_OFFSET + 5, 0, port, port ? INPUTEVENT_JOY2_CD32_FFW : INPUTEVENT_JOY1_CD32_FFW);
                if (isrealbutton (did, 6))
-                       uid[i].eventid[ID_BUTTON_OFFSET + 6][0] = port ? INPUTEVENT_JOY2_CD32_PLAY :  INPUTEVENT_JOY1_CD32_PLAY;
+                       setid (uid, i, ID_BUTTON_OFFSET + 6, 0, port, port ? INPUTEVENT_JOY2_CD32_PLAY :  INPUTEVENT_JOY1_CD32_PLAY);
        }
        if (i == 0)
                return 1;
@@ -2689,20 +2695,20 @@ int input_get_default_joystick_analog (struct uae_input_device *uid, int i, int
        if (i >= num_joystick)
                return 0;
        did = &di_joystick[i];
-       uid[i].eventid[ID_AXIS_OFFSET + 0][0] = port ? INPUTEVENT_JOY2_HORIZ_POT : INPUTEVENT_JOY1_HORIZ_POT;
-       uid[i].eventid[ID_AXIS_OFFSET + 1][0] = port ? INPUTEVENT_JOY2_VERT_POT : INPUTEVENT_JOY1_VERT_POT;
-       uid[i].eventid[ID_BUTTON_OFFSET + 0][0] = port ? INPUTEVENT_JOY2_LEFT : INPUTEVENT_JOY1_LEFT;
+       setid (uid, i, ID_AXIS_OFFSET + 0, 0, port, port ? INPUTEVENT_JOY2_HORIZ_POT : INPUTEVENT_JOY1_HORIZ_POT);
+       setid (uid, i, ID_AXIS_OFFSET + 1, 0, port, port ? INPUTEVENT_JOY2_VERT_POT : INPUTEVENT_JOY1_VERT_POT);
+       setid (uid, i, ID_BUTTON_OFFSET + 0, 0, port, port ? INPUTEVENT_JOY2_LEFT : INPUTEVENT_JOY1_LEFT);
        if (isrealbutton (did, 1))
-               uid[i].eventid[ID_BUTTON_OFFSET + 1][0] = port ? INPUTEVENT_JOY2_RIGHT : INPUTEVENT_JOY1_RIGHT;
+               setid (uid, i, ID_BUTTON_OFFSET + 1, 0, port, port ? INPUTEVENT_JOY2_RIGHT : INPUTEVENT_JOY1_RIGHT);
        if (isrealbutton (did, 2))
-               uid[i].eventid[ID_BUTTON_OFFSET + 2][0] = port ? INPUTEVENT_JOY2_UP : INPUTEVENT_JOY1_UP;
+               setid (uid, i, ID_BUTTON_OFFSET + 2, 0, port, port ? INPUTEVENT_JOY2_UP : INPUTEVENT_JOY1_UP);
        if (isrealbutton (did, 3))
-               uid[i].eventid[ID_BUTTON_OFFSET + 3][0] = port ? INPUTEVENT_JOY2_DOWN : INPUTEVENT_JOY1_DOWN;
+               setid (uid, i, ID_BUTTON_OFFSET + 3, 0, port, port ? INPUTEVENT_JOY2_DOWN : INPUTEVENT_JOY1_DOWN);
        for (j = 2; j < MAX_MAPPINGS - 1; j++) {
                int am = did->axismappings[j];
                if (am == DIJOFS_POV(0) || am == DIJOFS_POV(1) || am == DIJOFS_POV(2) || am == DIJOFS_POV(3)) {
-                       uid[i].eventid[ID_AXIS_OFFSET + j + 0][0] = port ? INPUTEVENT_JOY2_HORIZ_POT : INPUTEVENT_JOY1_HORIZ_POT;
-                       uid[i].eventid[ID_AXIS_OFFSET + j + 1][0] = port ? INPUTEVENT_JOY2_VERT_POT : INPUTEVENT_JOY1_VERT_POT;
+                       setid (uid, i, ID_AXIS_OFFSET + j + 0, 0, port, port ? INPUTEVENT_JOY2_HORIZ_POT : INPUTEVENT_JOY1_HORIZ_POT);
+                       setid (uid, i, ID_AXIS_OFFSET + j + 1, 0, port, port ? INPUTEVENT_JOY2_VERT_POT : INPUTEVENT_JOY1_VERT_POT);
                        j++;
                }
        }
index 2bcb844a2ca6f81e786fe7a09618ba60788f3a0b..d32a3750c2079eb9605cddc6abae7cb12d3ab86c 100644 (file)
@@ -684,7 +684,7 @@ static LPD3DXEFFECT psEffect_LoadEffect (const TCHAR *shaderfile, int full)
        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);
+       _stprintf (tmp, L"%s%sfiltershaders\\direct3d\\%s", start_path_plugins, WIN32_PLUGINDIR, shaderfile);
        if (!full) {
                struct zfile *z = zfile_fopen (tmp, L"r", 0);
                if (z) {
index 2850ed0db7f3bca4f468b43da5b44cffc3441ce3..fb9efe6907a72872fd65ae31404655048179aeb8 100644 (file)
@@ -262,6 +262,8 @@ static void flushprtbuf (void)
                if (currprefs.parallel_matrix_emulation >= PARALLEL_MATRIX_EPSON) {
                        int i;
                        if (!prtopen) {
+                               if (!doflushprinter ())
+                                       return;
                                if (epson_init (currprefs.prtname, currprefs.parallel_matrix_emulation))
                                        prtopen = 1;
                        }
index 3c966501ce8229cab7233ef9d19c2abe5a95e12b..7f95da167b91049fbef324a54fbab7c73141fde1 100644 (file)
@@ -167,17 +167,17 @@ BEGIN
     CONTROL         "Slider1",IDC_Z3FASTMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,179,47,60,20\r
     EDITTEXT        IDC_Z3FASTRAM,243,50,34,12,ES_CENTER | ES_READONLY\r
     GROUPBOX        "A3000/A4000 Advanced Memory Settings",IDC_STATIC,14,110,274,65\r
-    RTEXT           "Motherboard Fast RAM:",IDC_STATIC,40,126,129,10,SS_CENTERIMAGE\r
+    RTEXT           "Motherboard Fast:",IDC_STATIC,48,126,129,10,SS_CENTERIMAGE\r
     CONTROL         "",IDC_MBMEM1,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,181,122,59,20\r
     EDITTEXT        IDC_MBRAM1,244,125,34,12,ES_CENTER | ES_READONLY\r
-    RTEXT           "Processor Slot Fast RAM:",IDC_STATIC,40,149,129,10,SS_CENTERIMAGE\r
+    RTEXT           "Processor Slot Fast:",IDC_STATIC,48,149,129,10,SS_CENTERIMAGE\r
     CONTROL         "",IDC_MBMEM2,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,181,145,59,20\r
     EDITTEXT        IDC_MBRAM2,244,148,34,12,ES_CENTER | ES_READONLY\r
     RTEXT           "Fast:",IDC_STATIC,19,49,32,15,SS_CENTERIMAGE\r
     RTEXT           "Chip:",IDC_STATIC,19,25,32,15,SS_CENTERIMAGE\r
     RTEXT           "Slow:",IDC_STATIC,144,25,32,15,SS_CENTERIMAGE\r
     RTEXT           "Z3 Fast:",IDC_STATIC,144,49,32,15,SS_CENTERIMAGE\r
-    RTEXT           "Z3 Fake Chip:",IDC_STATIC,123,73,54,15,SS_CENTERIMAGE\r
+    RTEXT           "Z3 Chip:",IDC_STATIC,123,73,54,15,SS_CENTERIMAGE\r
     CONTROL         "",IDC_Z3CHIPMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,179,71,60,20\r
     EDITTEXT        IDC_Z3CHIPRAM,243,76,34,12,ES_CENTER | ES_READONLY\r
 END\r
@@ -1186,7 +1186,6 @@ BEGIN
 \r
     IDD_MEMORY, DIALOG\r
     BEGIN\r
-        BOTTOMMARGIN, 158\r
     END\r
 \r
     IDD_CPU, DIALOG\r
@@ -1338,7 +1337,7 @@ BEGIN
     IDS_SELECTFILESYSROOT   "Please select the root directory of the file system..."\r
     IDS_DEFAULTMIDIOUT      "Default MIDI-Out Device"\r
     IDS_CONTRIBUTORS1       "Bernd Schmidt - The Grand-Master\nSam Jordan - Custom-chip, floppy-DMA, etc.\nMathias Ortmann - Original WinUAE Main Guy, BSD Socket support\nBrian King - Picasso96 Support, Integrated GUI for WinUAE, previous WinUAE Main Guy\nToni Wilen - Core updates, WinUAE Main Guy\nGustavo Goedert/Peter Remmers/Michael Sontheimer/Tomi Hakala/Tim Gunn/Nemo Pohle - DOS Port Stuff\nSamuel Devulder/Olaf Barthel/Sam Jordan - Amiga Ports\nKrister Bergman - XFree86 and OS/2 Port\nA. Blanchard/Ernesto Corvi - MacOS Port\nChristian Bauer - BeOS Port\nIan Stephenson - NextStep Port\nPeter Teichmann - Acorn/RiscOS Port\nStefan Reinauer - ZorroII/III AutoConfig, Serial Support\nChristian Schmitt/Chris Hames - Serial Support\nHerman ten Brugge - 68020/68881 Emulation Code\nTauno Taipaleenmaki - Various UAE-Control/UAE-Library Support\nBrett Eden/Tim Gunn/Paolo Besser/Nemo Pohle - Various Docs and Web-Sites\nGeorg Veichtlbauer - Help File coordinator, German GUI\nFulvio Leonardi - Italian translator for WinUAE\n"\r
-    IDS_CONTRIBUTORS2       "Bill Panagouleas - Hardware support\nSpecial thanks to Alexander Kneer and Tobias Abt (The Picasso96 Team)\nSteven Weiser  - Postscript printing emulation idea and testing.\nPéter Tóth /Balázs Rátkai/Iván Herczeg/András Arató - Hungarian translation.\nKarsten Bock, Gavin Fance, Dirk Trowe, Christoph Meier and Christian Schindler - Freezer cartridge hardware support.\nMikko Nieminen - Demo compatibility testing.\nArabuusimiehet - [This information is on a need-to-know basis]"\r
+    IDS_CONTRIBUTORS2       "Bill Panagouleas - Hardware support\nSpecial thanks to Alexander Kneer and Tobias Abt (The Picasso96 Team)\nSteven Weiser  - Postscript printing emulation idea and testing.\nPéter Tóth /Balázs Rátkai/Iván Herczeg/András Arató - Hungarian translation.\nKarsten Bock, Gavin Fance, Dirk Trowe and Christian Schindler - Freezer cartridge hardware support.\nMikko Nieminen - Demo compatibility testing.\nArabuusimiehet - [This information is on a need-to-know basis]"\r
     IDS_INVALIDPRTPORT      "The printer you have in this configuration is not valid on this machine.\n"\r
     IDS_RESTOREUSS          "Restore a WinUAE snapshot file"\r
     IDS_USS                 "WinUAE snapshot files"\r
@@ -1348,7 +1347,7 @@ BEGIN
     IDS_INPUTAMIGAEVENT     "Input target"\r
     IDS_INPUTAUTOFIRE       "Autofire"\r
     IDS_SAVEUSS             "Save a WinUAE snapshot file"\r
-    IDS_MIDIOVERFLOW        "Sysexbuffer overflow. Should not happen. Please report this to\nberndroesch1@compuserve.de"\r
+    IDS_MIDIOVERFLOW        "Sysexbuffer overflow. Should not happen."\r
 END\r
 \r
 STRINGTABLE\r
index a893c63c29aa0bf1794d4c1740e3fd661d6f36bb..7e9c5f17e1fbe029958505335b94e05887f43978 100644 (file)
@@ -1309,11 +1309,6 @@ static void reopen_sound (void)
 }
 
 
-#ifdef JIT
-extern uae_u8* compiled_code;
-#else
-static int compiled_code;
-#endif
 extern int vsynctime_orig;
 
 #ifndef AVIOUTPUT
@@ -1330,10 +1325,10 @@ void sound_setadjust (double v)
        mult = (1000.0 + v);
        if (avioutput_audio && avioutput_enabled && avioutput_nosoundsync)
                mult = 1000.0;
-       if (isvsync () || (avioutput_audio && avioutput_enabled && !compiled_code)) {
+       if (isvsync () || (avioutput_audio && avioutput_enabled && !currprefs.cachesize)) {
                vsynctime = vsynctime_orig;
                scaled_sample_evtime = scaled_sample_evtime_orig * mult / 1000.0;
-       } else if (compiled_code || currprefs.m68k_speed != 0) {
+       } else if (currprefs.cachesize || currprefs.m68k_speed != 0) {
                vsynctime = (long)(((double)vsynctime_orig) * mult / 1000.0);
                scaled_sample_evtime = scaled_sample_evtime_orig;
        } else {
index 1db7ef9907f19d7de084b316e59fc203f0e3b5c6..1b682aa3fbb32ec4b1a193dc3797f18169efe642 100644 (file)
@@ -159,6 +159,7 @@ static CRITICAL_SECTION cs_time;
 
 TCHAR start_path_data[MAX_DPATH];
 TCHAR start_path_exe[MAX_DPATH];
+TCHAR start_path_plugins[MAX_DPATH];
 TCHAR start_path_af[MAX_DPATH]; /* OLD AF */
 TCHAR start_path_new1[MAX_DPATH]; /* AF2005 */
 TCHAR start_path_new2[MAX_DPATH]; /* AMIGAFOREVERDATA */
@@ -2031,7 +2032,7 @@ void logging_init (void)
        tmp[0] = 0;
        GetModuleFileName (NULL, tmp, sizeof (tmp) / sizeof (TCHAR));
        write_log (L"'%s'\n", tmp);
-       write_log (L"EXE: '%s', DATA: '%s'\n", start_path_exe, start_path_data);
+       write_log (L"EXE: '%s', DATA: '%s', PLUGIN: '%s'\n", start_path_exe, start_path_data, start_path_plugins);
        regstatus ();
 }
 
@@ -3942,6 +3943,14 @@ static void getstartpaths (void)
        GetFullPathName (start_path_data, sizeof tmp / sizeof (TCHAR), tmp, NULL);
        _tcscpy (start_path_data, tmp);
        SetCurrentDirectory (start_path_data);
+
+       v = GetFileAttributes (start_path_plugins);
+       if (v == INVALID_FILE_ATTRIBUTES || !(v & FILE_ATTRIBUTE_DIRECTORY) || start_data == 0 || start_data == -2) {
+               _tcscpy (start_path_plugins, start_path_exe);
+       }
+       fixtrailing (start_path_plugins);
+       GetFullPathName (start_path_plugins, sizeof tmp / sizeof (TCHAR), tmp, NULL);
+       _tcscpy (start_path_plugins, tmp);
 }
 
 extern void test (void);
@@ -4150,6 +4159,10 @@ static int parseargs (const TCHAR *arg, const TCHAR *np, const TCHAR *np2)
                start_data = -1;
                return 2;
        }
+       if (!_tcscmp (arg, L"-pluginpath")) {
+               ExpandEnvironmentStrings (np, start_path_plugins, sizeof start_path_plugins / sizeof (TCHAR));
+               return 2;
+       }
        if (!_tcscmp (arg, L"-maxmem")) {
                maxmem = getval (np);
                return 2;
@@ -4877,16 +4890,16 @@ HMODULE WIN32_LoadLibrary_2 (const TCHAR *name, int expand)
                        break;
                }
 #endif
-               s = xmalloc (TCHAR, _tcslen (start_path_exe) + _tcslen (WIN32_PLUGINDIR) + _tcslen (newname) + 1);
+               s = xmalloc (TCHAR, _tcslen (start_path_plugins) + _tcslen (WIN32_PLUGINDIR) + _tcslen (newname) + 1);
                if (s) {
-                       _stprintf (s, L"%s%s%s", start_path_exe, WIN32_PLUGINDIR, newname);
+                       _stprintf (s, L"%s%s%s", start_path_plugins, WIN32_PLUGINDIR, newname);
                        m = LoadLibrary (s);
                        LLError (m, s);
                        if (m) {
                                xfree (s);
                                goto end;
                        }
-                       _stprintf (s, L"%s%s", start_path_exe, newname);
+                       _stprintf (s, L"%s%s", start_path_plugins, newname);
                        m = LoadLibrary (s);
                        LLError (m ,s);
                        if (m) {
index 6df2fd7f2785e9d41dbf3c86279585c83cccc25e..3d0ea08db64ce2cd1656a372428ca0d6024c41f3 100644 (file)
@@ -19,7 +19,7 @@
 #define LANG_DLL 1
 
 #define WINUAEBETA L"6"
-#define WINUAEDATE MAKEBD(2010, 5, 29)
+#define WINUAEDATE MAKEBD(2010, 6, 3)
 #define WINUAEEXTRA L""
 #define WINUAEREV L""
 
@@ -39,6 +39,7 @@ extern void *globalipc, *serialipc;
 
 extern TCHAR start_path_exe[MAX_DPATH];
 extern TCHAR start_path_data[MAX_DPATH];
+extern TCHAR start_path_plugins[MAX_DPATH];
 
 extern void my_kbd_handler (int, int, int);
 extern void clearallkeys (void);
index ab701857c74ed60cd8274e0dcd5bdb3b9343bb95..63ca48246a6504f5e4fe2e0d6f59247c8b941eaf 100644 (file)
@@ -3117,30 +3117,40 @@ static int input_selected_event, input_selected_sub_num;
 
 static void set_lventry_input (HWND list, int index)
 {
-       int flags, i, sub;
+       int flags, i, sub, port;
        TCHAR name[256];
        TCHAR custom[MAX_DPATH];
        TCHAR af[32], toggle[32];
 
-       inputdevice_get_mapped_name (input_selected_device, index, &flags, name, custom, input_selected_sub_num);
+       inputdevice_get_mapped_name (input_selected_device, index, &flags, &port, name, custom, input_selected_sub_num);
        if (flags & IDEV_MAPPED_AUTOFIRE_SET)
-               WIN32GUI_LoadUIString (IDS_YES, af, sizeof (af) / sizeof (TCHAR));
+               WIN32GUI_LoadUIString (IDS_YES, af, sizeof af / sizeof (TCHAR));
        else if (flags & IDEV_MAPPED_AUTOFIRE_POSSIBLE)
-               WIN32GUI_LoadUIString (IDS_NO, af, sizeof (af) / sizeof (TCHAR));
+               WIN32GUI_LoadUIString (IDS_NO, af, sizeof af / sizeof (TCHAR));
        else
                _tcscpy (af, L"-");
        if (flags & IDEV_MAPPED_TOGGLE)
-               WIN32GUI_LoadUIString (IDS_YES, toggle, sizeof (toggle) / sizeof (TCHAR));
+               WIN32GUI_LoadUIString (IDS_YES, toggle, sizeof toggle / sizeof (TCHAR));
        else if (flags & IDEV_MAPPED_AUTOFIRE_POSSIBLE)
-               WIN32GUI_LoadUIString (IDS_NO, toggle, sizeof (toggle) / sizeof (TCHAR));
+               WIN32GUI_LoadUIString (IDS_NO, toggle, sizeof toggle / sizeof (TCHAR));
        else
                _tcscpy (toggle, L"-");
+       if (port > 0) {
+               TCHAR tmp[256];
+               _tcscpy (tmp, name);
+               name[0] = 0;
+               _tcscat (name, L"[ ");
+               _tcscat (name, tmp);
+               _tcscat (name, L" ]");
+       }
+       ListView_SetItemState (list, index, port > 0 ? LVIS_DROPHILITED : 0, LVIS_DROPHILITED);
+
        ListView_SetItemText (list, index, 1, custom[0] ? custom : name);
        ListView_SetItemText (list, index, 2, af);
        ListView_SetItemText (list, index, 3, toggle);
        sub = 0;
        for (i = 0; i < MAX_INPUT_SUB_EVENT; i++) {
-               if (inputdevice_get_mapped_name (input_selected_device, index, &flags, name, custom, i) || custom[0])
+               if (inputdevice_get_mapped_name (input_selected_device, index, &flags, NULL, name, custom, i) || custom[0])
                        sub++;
        }
        _stprintf (name, L"%d", sub);
@@ -3210,7 +3220,10 @@ static int inputmap_handle (HWND list, int currentdevnum, int currentwidgetnum,
                                                if ((1 || status) && !found) {
                                                        for (int j = 0; j < inputdevice_get_widget_num (devnum); j++) {
                                                                for (int sub = 0; sub < MAX_INPUT_SUB_EVENT; sub++) {
-                                                                       if (inputdevice_get_mapped_name (devnum, j, &flags, NULL, NULL, sub) == evtnum) {
+                                                                       int port;
+                                                                       if (inputdevice_get_mapped_name (devnum, j, &flags, &port, NULL, NULL, sub) == evtnum) {
+                                                                               if (!port)
+                                                                                       continue;
                                                                                inputdevice_get_widget_type (devnum, j, name);
                                                                                if (list) {
                                                                                        if (_tcslen (target) < MAX_DPATH / 2) {
@@ -7779,10 +7792,10 @@ static void sound_loaddrivesamples (void)
 
        free (drivesounds);
        p = drivesounds = 0;
-       _stprintf (dirname, L"%s\\%sfloppysounds\\*.wav", start_path_data, WIN32_PLUGINDIR);
+       _stprintf (dirname, L"%s\\%sfloppysounds\\*.wav", start_path_plugins, WIN32_PLUGINDIR);
        h = FindFirstFile (dirname, &fd);
        if (h == INVALID_HANDLE_VALUE) {
-               _stprintf (dirname, L"%s\\uae_data\\*.wav", start_path_data);
+               _stprintf (dirname, L"%s\\uae_data\\*.wav", start_path_plugins);
                h = FindFirstFile (dirname, &fd);
                if (h == INVALID_HANDLE_VALUE)
                        return;
@@ -10205,23 +10218,18 @@ static void values_from_gameportsdlg (HWND hDlg, int d)
                if (idm >= 0) {
                        v = SendDlgItemMessage (hDlg, idm, CB_GETCURSEL, 0, 0L);
                        if (v != CB_ERR) {
-                               if (*portm != v)
-                                       workprefs.input_selected_setting = GAMEPORT_INPUT_SETTINGS;
                                *portm = v;
                        }
                                
                }
                if (joysaf[i] >= 0) {
                        int af = SendDlgItemMessage (hDlg, joysaf[i], CB_GETCURSEL, 0, 0L);
-                       if (af != CB_ERR && af != workprefs.jports[i].autofire)
-                               workprefs.input_selected_setting = GAMEPORT_INPUT_SETTINGS;
                        workprefs.jports[i].autofire = af;
                }
                if (*port != prevport)
                        changed = 1;
        }
        if (changed) {
-               workprefs.input_selected_setting = GAMEPORT_INPUT_SETTINGS;
                for (i = 0; i < MAX_JPORTS; i++) {
                        for (j = 0; j < MAX_JPORTS; j++) {
                                if (j != i)
@@ -10864,7 +10872,7 @@ static void init_inputdlg_2 (HWND hDlg)
        SendDlgItemMessage (hDlg, IDC_INPUTAMIGA, CB_ADDSTRING, 0, (LPARAM)tmp1);
        index = 0; af = 0;
        if (input_selected_widget >= 0) {
-               inputdevice_get_mapped_name (input_selected_device, input_selected_widget, 0, name1, custom1, input_selected_sub_num);
+               inputdevice_get_mapped_name (input_selected_device, input_selected_widget, NULL, NULL, name1, custom1, input_selected_sub_num);
                cnt = 2;
                while(inputdevice_iterate (input_selected_device, input_selected_widget, name2, &aftmp)) {
                        free (eventnames[cnt]);
@@ -10965,11 +10973,11 @@ static void doinputcustom (HWND hDlg, int newcustom)
        int flags;
        custom1[0] = 0;
        inputdevice_get_mapped_name (input_selected_device, input_selected_widget,
-               &flags, 0, custom1, input_selected_sub_num);
+               &flags, NULL, NULL, custom1, input_selected_sub_num);
        if (_tcslen (custom1) > 0 || newcustom) {
                if (askinputcustom (hDlg, custom1, sizeof custom1 / sizeof (TCHAR), IDS_SB_CUSTOMEVENT)) {
                        inputdevice_set_mapping (input_selected_device, input_selected_widget,
-                               0, custom1, flags, input_selected_sub_num);
+                               NULL, custom1, flags, -1, input_selected_sub_num);
                }
        }
 }
@@ -11047,12 +11055,12 @@ static void values_from_inputdlg (HWND hDlg, int inputchange)
                TCHAR custom[MAX_DPATH];
                custom[0] = 0;
                inputdevice_get_mapped_name (input_selected_device, input_selected_widget,
-                       &flags, 0, custom, input_selected_sub_num);
+                       &flags, NULL, 0, custom, input_selected_sub_num);
                if (input_selected_event != 1)
                        custom[0] = 0;
                inputdevice_set_mapping (input_selected_device, input_selected_widget,
                        eventnames[input_selected_event], _tcslen (custom) == 0 ? NULL : custom,
-                       flags, input_selected_sub_num);
+                       flags, -1, input_selected_sub_num);
                update_listview_input (hDlg);
                inputdevice_updateconfig (&workprefs);
        }
@@ -11162,13 +11170,13 @@ static void CALLBACK timerfunc (HWND hDlg, UINT uMsg, UINT_PTR idEvent, DWORD dw
                                int sub = 0;
                                if (inputdevice_get_widget_type (input_selected_device, input_selected_widget, NULL) != IDEV_WIDGET_KEY) {
                                        for (sub = 0; sub < MAX_INPUT_SUB_EVENT; sub++) {
-                                               if (!inputdevice_get_mapped_name (input_selected_device, input_selected_widget, NULL, NULL, NULL, sub))
+                                               if (!inputdevice_get_mapped_name (input_selected_device, input_selected_widget, NULL, NULL, NULL, NULL, sub))
                                                        break;
                                        }
                                }
                                if (sub >= MAX_INPUT_SUB_EVENT)
                                        sub = MAX_INPUT_SUB_EVENT - 1;
-                               inputdevice_set_mapping (input_selected_device, input_selected_widget, name, NULL, 0, sub);
+                               inputdevice_set_mapping (input_selected_device, input_selected_widget, name, NULL, 0, inputmap_port, sub);
                                InitializeListView (hDlg);
                                inputmap_remap_counter += cntadd;
                                ListView_EnsureVisible (h, inputmap_remap_counter, FALSE);
@@ -11310,7 +11318,6 @@ static void input_find (HWND hDlg, int mode, int set)
 
 static void ports_remap (HWND hDlg, int port)
 {
-       workprefs.input_selected_setting = GAMEPORT_INPUT_SETTINGS;
        inputmap_port_remap = port;
        inputmap_port = port;
        inputmap_remap_counter = 0;
@@ -11318,7 +11325,6 @@ static void ports_remap (HWND hDlg, int port)
 }
 static void input_test (HWND hDlg, int port)
 {
-       workprefs.input_selected_setting = GAMEPORT_INPUT_SETTINGS;
        inputmap_port_remap = -1;
        inputmap_port = port;
        inputmap_remap_counter = -1;
@@ -11456,11 +11462,11 @@ static void input_toggleautofire (void)
        if (input_selected_device < 0 || input_selected_widget < 0)
                return;
        evt = inputdevice_get_mapped_name (input_selected_device, input_selected_widget,
-               &flags, name, custom, input_selected_sub_num);
+               &flags, NULL, name, custom, input_selected_sub_num);
        if (evt <= 0)
                return;
        inputdevice_set_mapping (input_selected_device, input_selected_widget,
-               name, custom, flags ^ IDEV_MAPPED_AUTOFIRE_SET, input_selected_sub_num);
+               name, custom, flags ^ IDEV_MAPPED_AUTOFIRE_SET, -1, input_selected_sub_num);
 }
 static void input_toggletoggle (void)
 {
@@ -11470,11 +11476,11 @@ static void input_toggletoggle (void)
        if (input_selected_device < 0 || input_selected_widget < 0)
                return;
        evt = inputdevice_get_mapped_name (input_selected_device, input_selected_widget,
-               &flags, name, custom, input_selected_sub_num);
+               &flags, NULL, name, custom, input_selected_sub_num);
        if (evt <= 0)
                return;
        inputdevice_set_mapping (input_selected_device, input_selected_widget,
-               name, custom, flags ^ IDEV_MAPPED_TOGGLE, input_selected_sub_num);
+               name, custom, flags ^ IDEV_MAPPED_TOGGLE, -1, input_selected_sub_num);
 }
 
 static INT_PTR CALLBACK InputDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -11845,7 +11851,7 @@ static void values_to_hw3ddlg (HWND hDlg)
                HANDLE h;
                WIN32_FIND_DATA wfd;
                TCHAR tmp[MAX_DPATH];
-               _stprintf (tmp, L"%s%sfiltershaders\\direct3d\\*.fx", start_path_data, WIN32_PLUGINDIR);
+               _stprintf (tmp, L"%s%sfiltershaders\\direct3d\\*.fx", start_path_plugins, WIN32_PLUGINDIR);
                h = FindFirstFile (tmp, &wfd);
                while (h != INVALID_HANDLE_VALUE) {
                        if (wfd.cFileName[0] != '_') {
@@ -11871,7 +11877,7 @@ static void values_to_hw3ddlg (HWND hDlg)
                HANDLE h;
                WIN32_FIND_DATA wfd;
                TCHAR tmp[MAX_DPATH];
-               _stprintf (tmp, L"%s%soverlays\\*.*", start_path_data, WIN32_PLUGINDIR);
+               _stprintf (tmp, L"%s%soverlays\\*.*", start_path_plugins, WIN32_PLUGINDIR);
                h = FindFirstFile (tmp, &wfd);
                i = 0; j = 1;
                while (h != INVALID_HANDLE_VALUE) {
index 74226db6d9b35d79736fef44986a686c5d2a9ceb..0c049c0104a3fedc3d0fc077d2188efbdec36249 100644 (file)
@@ -332,6 +332,8 @@ static uae_u8 *restore_chunk (struct zfile *f, TCHAR *name, size_t *len, size_t
        {
                /* without zeros at the end old state files may not work */
                mem = xcalloc (uae_u8, *totallen + 32);
+               if (!mem)
+                       return NULL;
                if (flags & 1) {
                        zfile_zuncompress (mem, *totallen, f, len2);
                } else {