]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
imported winuaesrc1300b3.zip
authorToni Wilen <twilen@winuae.net>
Tue, 16 May 2006 15:22:47 +0000 (18:22 +0300)
committerToni Wilen <twilen@winuae.net>
Mon, 22 Feb 2010 19:28:14 +0000 (21:28 +0200)
29 files changed:
audio.c
blitter.c
cfgfile.c
cia.c
compemu_support.c
custom.c
debug.c
disk.c
drawing.c
filesys.c
include/audio.h
include/debug.h
include/disk.h
include/drawing.h
include/events.h
include/options.h
include/savestate.h
memory.c
newcpu.c
od-win32/fsdb_win32.c
od-win32/resources/resource.h
od-win32/resources/winuae.rc
od-win32/sounddep/sound.c
od-win32/win32.c
od-win32/win32.h
od-win32/win32gfx.c
od-win32/win32gui.c
od-win32/writelog.c
savestate.c

diff --git a/audio.c b/audio.c
index 5ecdf5a5d57b21e03c4861583d63d4a1084cd307..e2c58f25079f976696f0e4db3eee19432b3fad82 100755 (executable)
--- a/audio.c
+++ b/audio.c
@@ -8,7 +8,7 @@
   * Copyright 1996 Manfred Thole
   * Copyright 2006 Toni Wilen
   *
-  * new filter algorithm and "anti" interpolator by Antti S. Lankila
+  * new filter algorithm and anti&sinc interpolators by Antti S. Lankila
   *
   */
 
@@ -247,11 +247,6 @@ static void do_samplerip(struct audio_channel_data *adp)
     audio_sampleripper(0);
 }
 
-STATIC_INLINE int current_hpos (void)
-{
-    return (get_cycles () - eventtab[ev_hsync].oldcycles) / CYCLE_UNIT;
-}
-
 static struct audio_channel_data audio_channel[4];
 int sound_available = 0;
 static int sound_table[64][256];
@@ -303,17 +298,24 @@ static int saved_ptr;
 #define        MIXED_STEREO_MAX 32
 static int mixed_on, mixed_stereo_size, mixed_mul1, mixed_mul2;
 static int led_filter_forced, sound_use_filter;
-static int sinc_on;
+static int sinc_on, led_filter_on;
+
+/* denormals are very small floating point numbers that force FPUs into slow
+   mode. All lowpass filters using floats are suspectible to denormals unless
+   a small offset is added to avoid very small floating point numbers. */
+#define DENORMAL_OFFSET (1E-10)
 
 static struct filter_state {
     float rc1, rc2, rc3, rc4, rc5;
 } sound_filter_state[2];
 
+static float a500e_filter1_a0;
+static float a500e_filter2_a0;
+static float filter_a0; /* a500 and a1200 use the same */
+
 enum {
   FILTER_MODEL_A500 = 1,
-  FILTER_MODEL_A1200,
-  FILTER_MODEL_A500E,
-  FILTER_MODEL_A1200E
+  FILTER_MODEL_A1200
 };
 
 /* Amiga has two separate filtering circuits per channel, a static RC filter
@@ -339,38 +341,36 @@ static int filter(int input, struct filter_state *fs)
 
     input = (uae_s16)input;
 
-    if (currprefs.sound_freq != 44100)
-       return input;
     if (sound_use_filter == 0)
        return input;
 
     switch (sound_use_filter) {
         
-    case FILTER_MODEL_A500E:
-       fs->rc1 = 0.52 * input   + 0.48 * fs->rc1;
-       fs->rc2 = 0.92 * fs->rc1 + 0.08 * fs->rc2;
+    case FILTER_MODEL_A500
+       fs->rc1 = a500e_filter1_a0 * input + (1 - a500e_filter1_a0) * fs->rc1 + DENORMAL_OFFSET;
+       fs->rc2 = a500e_filter2_a0 * fs->rc1 + (1-a500e_filter2_a0) * fs->rc2;
        normal_output = fs->rc2;
 
-       fs->rc3 = 0.48 * normal_output + 0.52 * fs->rc3;
-       fs->rc4 = 0.48 * fs->rc3       + 0.52 * fs->rc4;
-       fs->rc5 = 0.48 * fs->rc4       + 0.52 * fs->rc5;
+       fs->rc3 = filter_a0 * normal_output + (1 - filter_a0) * fs->rc3;
+       fs->rc4 = filter_a0 * fs->rc3       + (1 - filter_a0) * fs->rc4;
+       fs->rc5 = filter_a0 * fs->rc4       + (1 - filter_a0) * fs->rc5;
 
        led_output = fs->rc5;
         break;
         
-    case FILTER_MODEL_A1200E:
+    case FILTER_MODEL_A1200:
         normal_output = input;
 
-        fs->rc2 = 0.48 * normal_output + 0.52 * fs->rc2;
-        fs->rc3 = 0.48 * fs->rc2       + 0.52 * fs->rc3;
-        fs->rc4 = 0.48 * fs->rc3       + 0.52 * fs->rc4;
+        fs->rc2 = filter_a0 * normal_output + (1 - filter_a0) * fs->rc2 + DENORMAL_OFFSET;
+        fs->rc3 = filter_a0 * fs->rc2       + (1 - filter_a0) * fs->rc3;
+        fs->rc4 = filter_a0 * fs->rc3       + (1 - filter_a0) * fs->rc4;
 
         led_output = fs->rc4;
         break;
 
     }
 
-    if (led_filter_forced > 0 || (gui_data.powerled && led_filter_forced >= 0))
+    if (led_filter_on) 
        o = led_output;
     else
        o = normal_output;
@@ -416,7 +416,7 @@ STATIC_INLINE void put_sound_word_left (uae_u32     w)
 
 #define        DO_CHANNEL(v, c) do { (v) &= audio_channel[c].adk_mask; data += v; } while (0);
 
-static void anti_prehandler(unsigned long best_evtime)
+static void anti_sinc_prehandler(unsigned long best_evtime)
 {
     int i, j;
 
@@ -429,7 +429,7 @@ static void anti_prehandler(unsigned long best_evtime)
            /* if the output state changes, put the new state into the pipeline.
              * the first term is to prevent queue overflow when player routines use
              * low period values like 16 that produce ultrasonic sounds. */
-           if (acd->sinc_queue[0].age > SINC_QUEUE_MAX_AGE/SINC_QUEUE_LENGTH+1
+           if (acd->sinc_queue[0].age > SINC_QUEUE_MAX_AGE / SINC_QUEUE_LENGTH + 1
                     && acd->sinc_queue[0].output != output) {
                acd->sinc_queue_length += 1;
                if (acd->sinc_queue_length > SINC_QUEUE_LENGTH) {
@@ -445,9 +445,9 @@ static void anti_prehandler(unsigned long best_evtime)
            /* age the sinc queue and truncate it when necessary */
            for (j = 0; j < SINC_QUEUE_LENGTH; j += 1) {
                acd->sinc_queue[j].age += best_evtime;
-               if (acd->sinc_queue[j].age > SINC_QUEUE_MAX_AGE-1) {
-                    acd->sinc_queue[j].age = SINC_QUEUE_MAX_AGE-1;
-                   acd->sinc_queue_length = j+1;
+               if (acd->sinc_queue[j].age > SINC_QUEUE_MAX_AGE - 1) {
+                    acd->sinc_queue[j].age = SINC_QUEUE_MAX_AGE - 1;
+                   acd->sinc_queue_length = j + 1;
                    break;
                }
            }
@@ -1165,47 +1165,68 @@ STATIC_INLINE int sound_prefs_changed (void)
            || changed_prefs.sound_filter_type != currprefs.sound_filter_type);
 }
 
+/* This computes the 1st order low-pass filter term b0.
+ * The a1 term is 1.0 - b0. The center frequency marks the -3 dB point. */
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+static float rc_calculate_a0(int sample_rate, int cutoff_freq)
+{
+    float omega;
+    /* The BLT correction formula below blows up if the cutoff is above nyquist. */
+    if (cutoff_freq >= sample_rate / 2)
+        return 1.0;
+
+    omega = 2 * M_PI * cutoff_freq / sample_rate;
+    /* Compensate for the bilinear transformation. This allows us to specify the
+     * stop frequency more exactly, but the filter becomes less steep further
+     * from stopband. */
+    omega = tan(omega / 2) * 2;
+    return 1 / (1 + 1 / omega);
+}
+
 void check_prefs_changed_audio (void)
 {
 #ifdef DRIVESOUND
     driveclick_check_prefs ();
 #endif
-    if (sound_available && sound_prefs_changed ()) {
-       close_sound ();
+    if (!sound_available || !sound_prefs_changed ())
+       return;
+    close_sound ();
 #ifdef AVIOUTPUT
-       AVIOutput_Restart ();
+    AVIOutput_Restart ();
 #endif
 
-       currprefs.produce_sound = changed_prefs.produce_sound;
-       currprefs.win32_soundcard = changed_prefs.win32_soundcard;
-       currprefs.sound_stereo = changed_prefs.sound_stereo;
-       currprefs.sound_stereo_separation = changed_prefs.sound_stereo_separation;
-       currprefs.sound_mixed_stereo = changed_prefs.sound_mixed_stereo;
-       currprefs.sound_adjust = changed_prefs.sound_adjust;
-       currprefs.sound_interpol = changed_prefs.sound_interpol;
-       currprefs.sound_freq = changed_prefs.sound_freq;
-       currprefs.sound_maxbsiz = changed_prefs.sound_maxbsiz;
-       currprefs.sound_filter = changed_prefs.sound_filter;
-       currprefs.sound_filter_type = changed_prefs.sound_filter_type;
-       currprefs.sound_volume = changed_prefs.sound_volume;
-       currprefs.sound_stereo_swap_paula = changed_prefs.sound_stereo_swap_paula;
-       currprefs.sound_stereo_swap_ahi = changed_prefs.sound_stereo_swap_ahi;
-       if (currprefs.produce_sound >= 2) {
-           if (!init_audio ()) {
-               if (! sound_available) {
-                   write_log ("Sound is not supported.\n");
-               } else {
-                   write_log ("Sorry, can't initialize sound.\n");
-                   currprefs.produce_sound = 0;
-                   /* So we don't do this every frame */
-                   changed_prefs.produce_sound = 0;
-               }
+    currprefs.produce_sound = changed_prefs.produce_sound;
+    currprefs.win32_soundcard = changed_prefs.win32_soundcard;
+    currprefs.sound_stereo = changed_prefs.sound_stereo;
+    currprefs.sound_stereo_separation = changed_prefs.sound_stereo_separation;
+    currprefs.sound_mixed_stereo = changed_prefs.sound_mixed_stereo;
+    currprefs.sound_adjust = changed_prefs.sound_adjust;
+    currprefs.sound_interpol = changed_prefs.sound_interpol;
+    currprefs.sound_freq = changed_prefs.sound_freq;
+    currprefs.sound_maxbsiz = changed_prefs.sound_maxbsiz;
+    currprefs.sound_filter = changed_prefs.sound_filter;
+    currprefs.sound_filter_type = changed_prefs.sound_filter_type;
+    currprefs.sound_volume = changed_prefs.sound_volume;
+    currprefs.sound_stereo_swap_paula = changed_prefs.sound_stereo_swap_paula;
+    currprefs.sound_stereo_swap_ahi = changed_prefs.sound_stereo_swap_ahi;
+    if (currprefs.produce_sound >= 2) {
+        if (!init_audio ()) {
+           if (! sound_available) {
+               write_log ("Sound is not supported.\n");
+           } else {
+               write_log ("Sorry, can't initialize sound.\n");
+               currprefs.produce_sound = 0;
+               /* So we don't do this every frame */
+               changed_prefs.produce_sound = 0;
            }
        }
-       last_cycles = get_cycles () - 1;
-       next_sample_evtime = scaled_sample_evtime;
-       compute_vsynctime ();
     }
+    last_cycles = get_cycles () - 1;
+    next_sample_evtime = scaled_sample_evtime;
+    compute_vsynctime ();
+
     mixed_mul1 = MIXED_STEREO_MAX / 2 - ((currprefs.sound_stereo_separation * 3) / 2);
     mixed_mul2 = MIXED_STEREO_MAX / 2 + ((currprefs.sound_stereo_separation * 3) / 2);
     mixed_stereo_size = currprefs.sound_mixed_stereo > 0 ? (1 << (currprefs.sound_mixed_stereo - 1)) - 1 : 0;
@@ -1219,10 +1240,14 @@ void check_prefs_changed_audio (void)
        if (currprefs.sound_filter == FILTER_SOUND_EMUL)
            led_filter_forced = 0;
        if (currprefs.sound_filter_type == FILTER_SOUND_TYPE_A500)
-           sound_use_filter = FILTER_MODEL_A500E;
+           sound_use_filter = FILTER_MODEL_A500;
        else if (currprefs.sound_filter_type == FILTER_SOUND_TYPE_A1200)
-           sound_use_filter = FILTER_MODEL_A1200E;
+           sound_use_filter = FILTER_MODEL_A1200;
     }
+    a500e_filter1_a0 = rc_calculate_a0(currprefs.sound_freq, 6200);
+    a500e_filter2_a0 = rc_calculate_a0(currprefs.sound_freq, 20000);
+    filter_a0 = rc_calculate_a0(currprefs.sound_freq, 7000);
+    led_filter_audio();
 
     /* Select the right interpolation method.  */
     sample_prehandler = NULL;
@@ -1251,7 +1276,7 @@ void check_prefs_changed_audio (void)
     if (sample_handler == sample16si_sinc_handler || sample_handler == sample16i_sinc_handler)
        sinc_on = 1;
     if (sample_handler == sample16si_anti_handler || sample_handler == sample16i_anti_handler || sinc_on)
-       sample_prehandler = anti_prehandler;
+       sample_prehandler = anti_sinc_prehandler;
 
     if (currprefs.produce_sound == 0) {
        eventtab[ev_audio].active = 0;
@@ -1528,6 +1553,15 @@ int init_audio (void)
     return init_sound ();
 }
 
+
+void led_filter_audio (void)
+{
+    led_filter_on = 0;
+    if (led_filter_forced > 0 || (gui_data.powerled && led_filter_forced >= 0))
+       led_filter_on = 1;
+    gui_led (0, gui_data.powerled);
+}
+
 uae_u8 *restore_audio (int i, uae_u8 *src)
 {
     struct audio_channel_data *acd;
index b6d8c6a8f86a50b8511088b8aa0f0aca4abfce9f..c296120ce3c80bf6382c8a9ce4409fad353541f8 100755 (executable)
--- a/blitter.c
+++ b/blitter.c
@@ -1078,6 +1078,8 @@ void maybe_blit (int hpos, int hack)
 
     if (bltstate == BLT_done)
        return;
+    if (savestate_state)
+       return;
 
     if (!warned && dmaen (DMA_BLITTER)) {
 #ifndef BLITTER_DEBUG
index 058eb60574a59ccff1fbaf8a9f7fe7949bd411f6..9ee1b8381f8e15bb37c66df730d5fec15222cacb 100755 (executable)
--- a/cfgfile.c
+++ b/cfgfile.c
@@ -347,6 +347,8 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
     cfgfile_write (f, "gfx_framerate=%d\n", p->gfx_framerate);
     cfgfile_write (f, "gfx_width=%d\n", p->gfx_size_win.width); /* compatibility with old versions */
     cfgfile_write (f, "gfx_height=%d\n", p->gfx_size_win.height); /* compatibility with old versions */
+    cfgfile_write (f, "gfx_top_windowed=%d\n", p->gfx_size_win.x);
+    cfgfile_write (f, "gfx_left_windowed=%d\n", p->gfx_size_win.y);
     cfgfile_write (f, "gfx_width_windowed=%d\n", p->gfx_size_win.width);
     cfgfile_write (f, "gfx_height_windowed=%d\n", p->gfx_size_win.height);
     cfgfile_write (f, "gfx_width_fullscreen=%d\n", p->gfx_size_fs.width);
@@ -645,6 +647,8 @@ static int cfgfile_parse_host (struct uae_prefs *p, char *option, char *value)
        || cfgfile_intval (option, value, "gfx_framerate", &p->gfx_framerate, 1)
        || cfgfile_intval (option, value, "gfx_width_windowed", &p->gfx_size_win.width, 1)
        || cfgfile_intval (option, value, "gfx_height_windowed", &p->gfx_size_win.height, 1)
+       || cfgfile_intval (option, value, "gfx_top_windowed", &p->gfx_size_win.x, 1)
+       || cfgfile_intval (option, value, "gfx_left_windowed", &p->gfx_size_win.y, 1)
        || cfgfile_intval (option, value, "gfx_width_fullscreen", &p->gfx_size_fs.width, 1)
        || cfgfile_intval (option, value, "gfx_height_fullscreen", &p->gfx_size_fs.height, 1)
        || cfgfile_intval (option, value, "gfx_refreshrate", &p->gfx_refreshrate, 1)
diff --git a/cia.c b/cia.c
index 89e4bd747add97b2957082fa710b842fc2bf81d0..1e19f3e83d86ac7bb2c3c25a486c9ab20eaf5afd 100755 (executable)
--- a/cia.c
+++ b/cia.c
@@ -32,6 +32,7 @@
 #include "akiko.h"
 #include "debug.h"
 #include "arcadia.h"
+#include "audio.h"
 
 //#define CIA_DEBUG_R
 //#define CIA_DEBUG_W
@@ -73,8 +74,6 @@ static int oldled, oldovl;
 
 unsigned int ciabpra;
 
-unsigned int gui_ledstate;
-
 static unsigned long ciaala, ciaalb, ciabla, ciablb;
 static int ciaatodon, ciabtodon;
 static unsigned int ciaapra, ciaaprb, ciaadra, ciaadrb, ciaasdr, ciaasdr_cnt;
@@ -433,10 +432,8 @@ static void bfe001_change (void)
     if ((v & 2) != oldled) {
        int led = (v & 2) ? 0 : 1;
        oldled = v & 2;
-       gui_led (0, led);
-       gui_ledstate &= ~1;
        gui_data.powerled = led;
-       gui_ledstate |= led;
+       led_filter_audio();
     }
     if ((v & 1) != oldovl) {
        oldovl = v & 1;
index e6b0225f9642d5c413326b99dcbd12fc055d73d2..357392edf313452f96c6dc12e1eee52ccb999bc7 100755 (executable)
@@ -432,10 +432,11 @@ void check_prefs_changed_comp (void)
     currprefs.comptrustlong = changed_prefs.comptrustlong;
     currprefs.comptrustnaddr= changed_prefs.comptrustnaddr;
     currprefs.compnf = changed_prefs.compnf;
-    currprefs.comp_hardflush= changed_prefs.comp_hardflush;
-    currprefs.comp_constjump= changed_prefs.comp_constjump;
-    currprefs.comp_oldsegv= changed_prefs.comp_oldsegv;
-    currprefs.compfpu= changed_prefs.compfpu;
+    currprefs.comp_hardflush = changed_prefs.comp_hardflush;
+    currprefs.comp_constjump = changed_prefs.comp_constjump;
+    currprefs.comp_oldsegv = changed_prefs.comp_oldsegv;
+    currprefs.compfpu = changed_prefs.compfpu;
+    currprefs.fpu_strict = changed_prefs.fpu_strict;
 
     if (currprefs.cachesize!=changed_prefs.cachesize) {
        currprefs.cachesize = changed_prefs.cachesize;
index 9b3d92f95af0cf870401d553fb219fe6e5a63e88..26c59bd7f76e6a6715e4e60ca1269ea483d40b28 100755 (executable)
--- a/custom.c
+++ b/custom.c
@@ -383,11 +383,6 @@ static void hsyncdelay(void)
 #endif
 }
 
-STATIC_INLINE int current_hpos (void)
-{
-    return (get_cycles () - eventtab[ev_hsync].oldcycles) / CYCLE_UNIT;
-}
-
 STATIC_INLINE uae_u8 *pfield_xlateptr (uaecptr plpt, int bytecount)
 {
     if (!chipmem_bank.check (plpt, bytecount)) {
@@ -2057,6 +2052,7 @@ static void finish_decisions (void)
     dip = curr_drawinfo + next_lineno;
     dip_old = prev_drawinfo + next_lineno;
     dp = line_decisions + next_lineno;
+    dp->valid = 0;
     changed = thisline_changed + interlace_started;
 
     if (thisline_decision.plfleft != -1)
@@ -2088,6 +2084,7 @@ static void finish_decisions (void)
     if (changed) {
        thisline_changed = 1;
        *dp = thisline_decision;
+       dp->valid = 1;
     } else
        /* The only one that may differ: */
        dp->ctable = thisline_decision.ctable;
@@ -3225,6 +3222,25 @@ static uae_u16 CLXDAT (void)
 }
 
 #ifdef AGA
+
+void dump_aga_custom (void)
+{
+    int c1, c2, c3, c4;
+    uae_u32 rgb1, rgb2, rgb3, rgb4;
+
+    for (c1 = 0; c1 < 64; c1++) {
+       c2 = c1 + 64;
+       c3 = c2 + 64;
+       c4 = c3 + 64;
+       rgb1 = current_colors.acolors[c1];
+       rgb2 = current_colors.acolors[c2];
+       rgb3 = current_colors.acolors[c3];
+       rgb4 = current_colors.acolors[c4];
+       console_out("%3d %06.6X %3d %06.6X %3d %06.6X %3d %06.6X\n",
+           c1, rgb1, c2, rgb2, c3, rgb3, c4, rgb4);
+    }
+}
+
 static uae_u16 COLOR_READ (int num)
 {
     int cr, cg, cb, colreg;
diff --git a/debug.c b/debug.c
index 10d7297ae8e4c63bd2f74072e332aaed3d4cc414..4a79bf452ac566c917e409e2419c25d91c793deb 100755 (executable)
--- a/debug.c
+++ b/debug.c
@@ -261,11 +261,16 @@ static void dumpmem (uaecptr addr, uaecptr *nxmem, int lines)
     *nxmem = addr;
 }
 
-static void dump_custom_regs (void)
+static void dump_custom_regs (int aga)
 {
     int len, i, j, end;
     uae_u8 *p1, *p2, *p3, *p4;
 
+    if (aga) {
+       dump_aga_custom();
+       return;
+    }
+
     p1 = p2 = save_custom (&len, 0, 1);
     p1 += 4; // skip chipset type
     for (i = 0; i < 4; i++) {
@@ -1434,7 +1439,7 @@ static void debug_1 (void)
                addr = readhex (&inptr);
            dump_vectors (addr);
        break;
-       case 'e': dump_custom_regs (); break;
+       case 'e': dump_custom_regs (tolower(*inptr) == 'a'); break;
        case 'r': if (more_params(&inptr))
                    m68k_modify (&inptr);
                  else
diff --git a/disk.c b/disk.c
index cc2ebef8c338ad5ac82cab7264c6d33f54afc2b7..4d4f45c5c78c848091a830de0c05448e2d84c8ad 100755 (executable)
--- a/disk.c
+++ b/disk.c
@@ -182,7 +182,6 @@ int disk_debug_track = -1;
 
 static uae_u16 bigmfmbufw[0x4000 * DDHDMULT];
 static drive floppy[MAX_FLOPPY_DRIVES];
-#define MAX_PREVIOUS_FLOPPIES 99
 static char dfxhistory[MAX_PREVIOUS_FLOPPIES][MAX_DPATH];
 
 static uae_u8 exeheader[]={0x00,0x00,0x03,0xf3,0x00,0x00,0x00,0x00};
@@ -591,9 +590,6 @@ static void update_drive_gui (int num)
     gui_data.drive_track[num] = drv->cyl;
     gui_data.drive_side = side;
     gui_data.drive_writing[num] = writ;
-    gui_ledstate &= ~(2 << num);
-    if (drv->state)
-       gui_ledstate |= 2 << num;
     gui_led (num + 1, gui_data.drive_motor[num]);
 }
 
@@ -1943,6 +1939,12 @@ int DISK_history_add (const char *name, int idx)
 {
     int i;
 
+    if (idx >= MAX_PREVIOUS_FLOPPIES)
+       return 0;
+    if (name == NULL) {
+       dfxhistory[idx][0] = 0;
+       return 1;
+    }
     if (name[0] == 0)
        return 0;
     if (!zfile_exists (name))
index fcb085831143fd32f2a79b26a46661e7b2db3c66..066d634e6d9e69b8644446dc32ba4ac9b73c0021 100755 (executable)
--- a/drawing.c
+++ b/drawing.c
@@ -1558,20 +1558,13 @@ STATIC_INLINE void pfield_draw_line (int lineno, int gfx_ypos, int follow_ypos)
        return;
 
     case LINE_AS_PREVIOUS:
-       if (linestate[lineno - 1] == LINE_DONE)
-           /* this was missing. we must not update this line if previous
-            * line was LINE_DONE. Previously this line would have been
-            * drawn as a border (plfleft was -1..) which resulted in
-            * "scanline"-looking display in parts of interlaced screens.
-            * This was really old bug..
-            * (example: Pinball Illusions' score panel in hires)
-            */
-           return;
        dp_for_drawing--;
        dip_for_drawing--;
+       linestate[lineno] = LINE_DONE_AS_PREVIOUS;
+       if (!dp_for_drawing->valid)
+           return;
        if (dp_for_drawing->plfleft == -1)
            border = 1;
-       linestate[lineno] = LINE_DONE_AS_PREVIOUS;
        break;
 
     case LINE_DONE_AS_PREVIOUS:
@@ -2025,10 +2018,8 @@ static void draw_status_line (int line)
            num1 = idle / 100;
            num2 = (idle - num1 * 100) / 10;
            num3 = idle % 10;
-           num4 = 13;
-           am = 4;
-           if (num1 == 0)
-               am = 3;
+           num4 = num1 == 0 ? 13 : -1;
+           am = 3;
        }
 
        c = xcolors[on ? on_rgb : off_rgb];
@@ -2157,11 +2148,12 @@ void vsync_handle_redraw (int long_frame, int lof_changed)
     last_redraw_point++;
     if (lof_changed || ! interlace_seen || last_redraw_point >= 2 || long_frame) {
        last_redraw_point = 0;
-       interlace_seen = 0;
 
        if (framecnt == 0)
            finish_drawing_frame ();
 
+       interlace_seen = 0;
+
        /* At this point, we have finished both the hardware and the
         * drawing frame. Essentially, we are outside of all loops and
         * can do some things which would cause confusion if they were
index 8fe2be0cc9c57970419eb6f42c2c1520e5db0c6c..8d13145932ec3459e6d179971dc37d248039a604 100755 (executable)
--- a/filesys.c
+++ b/filesys.c
@@ -2275,7 +2275,6 @@ static void do_find (Unit *unit, dpacket packet, int mode, int create, int fallb
                | (create == 2 ? O_TRUNC : 0));
 
     fd = my_open (aino->nname, openmode | O_BINARY);
-
     if (fd == NULL) {
        if (aino_created)
            delete_aino (unit, aino);
@@ -2283,6 +2282,7 @@ static void do_find (Unit *unit, dpacket packet, int mode, int create, int fallb
        PUT_PCK_RES2 (packet, dos_errno ());
        return;
     }
+
     k = new_key (unit);
     k->fd = fd;
     k->aino = aino;
@@ -2290,6 +2290,9 @@ static void do_find (Unit *unit, dpacket packet, int mode, int create, int fallb
     k->createmode = create;
     k->notifyactive = create ? 1 : 0;
 
+    if (create)
+        fsdb_set_file_attrs (aino);
+
     put_long (fh+36, k->uniq);
     if (create == 2)
        aino->elock = 1;
@@ -2879,6 +2882,7 @@ action_create_dir (Unit *unit, dpacket packet)
        return;
     }
     aino->shlock = 1;
+    fsdb_set_file_attrs (aino);
     de_recycle_aino (unit, aino);
     notify_check (unit, aino);
     updatedirtime (aino, 0);
@@ -3205,6 +3209,7 @@ action_rename_object (Unit *unit, dpacket packet)
     if (a2->parent)
        fsdb_dir_writeback (a2->parent);
     updatedirtime (a2, 1);
+    fsdb_set_file_attrs (a2);
     if (a2->elock > 0 || a2->shlock > 0 || wehavekeys > 0)
        de_recycle_aino (unit, a2);
     PUT_PCK_RES1 (packet, DOS_TRUE);
index 58ef8ab4a042efeb82eaac90540e3acbce829964..88a8aed84d47ccdb0331daa7127770cde7878054 100755 (executable)
@@ -30,6 +30,7 @@ extern void audio_hsync (int);
 extern void audio_update_adkmasks (void);
 extern void audio_update_irq (uae_u16);
 extern void update_sound (int freq);
+extern void led_filter_audio (void);
 
 extern void audio_sampleripper(int);
 extern int sampleripper_enabled;
index b62c0e5db5363effe4214ca0883a447336ad43c6..36fb189013c55293a38bc36b5499a0a32e160491 100755 (executable)
@@ -23,6 +23,7 @@ extern const char *debuginfo(int);
 extern void record_copper (uaecptr addr, int hpos, int vpos);
 extern void record_copper_reset(void);
 extern int snooper(uaecptr);
+extern void dump_aga_custom (void);
 
 #else
 
index 1be447c6f1ca7308871264bc44880dcc988aaaf1..1125bf36fe0af8d0d77bf762e8f7f2505a74abec 100755 (executable)
@@ -46,3 +46,5 @@ extern int disk_debug_track;
 #define DISK_DEBUG_DMA_WRITE 2
 #define DISK_DEBUG_PIO 4
 
+#define MAX_PREVIOUS_FLOPPIES 99
+
index 9e097c8fb7208c6ff3eb58a1aac44084e2903669..c5c9f35e3ce8d27a40494d0c19636e3cea89b38d 100755 (executable)
@@ -211,6 +211,7 @@ struct decision {
     unsigned int any_hires_sprites:1;
     unsigned int ham_seen:1;
     unsigned int ham_at_start:1;
+    unsigned int valid:1;
 };
 
 /* Anything related to changes in hw registers during the DDF for one
index e65eba6a85cce0b9f8971bdac7b26e10dba26938..71b03ce1c6c959781bff0d3ab1dd585cdbc6930f 100755 (executable)
@@ -50,4 +50,9 @@ extern struct ev eventtab[ev_max];
 #include "events_normal.h"
 #endif
 
+STATIC_INLINE int current_hpos (void)
+{
+    return (get_cycles () - eventtab[ev_hsync].oldcycles) / CYCLE_UNIT;
+}
+
 #endif
index c0959f560902504299aba53520864462ce6c8e44..01e04b4a578538ce14c9d59180c042c7ac3d7e39 100755 (executable)
@@ -48,8 +48,8 @@ struct uae_input_device {
 #define CONFIG_BLEN 2560
 
 struct wh {
-    int width;
-    int height;
+    int x, y;
+    int width, height;
 };
 
 struct uae_prefs {
index 94713f495bfcd2d261a4378fa4dbf30100eca160..d757fb761cfa431f400f237bc6ca9b190dd3e8bc 100755 (executable)
@@ -39,6 +39,7 @@ extern char *restore_string_func (uae_u8 **);
 /* save, restore and initialize routines for Amiga's subsystems */
 
 extern uae_u8 *restore_cpu (uae_u8 *);
+extern void restore_cpu_finish (void);
 extern uae_u8 *save_cpu (int *, uae_u8 *);
 
 extern uae_u8 *restore_fpu (uae_u8 *);
index 274eeac50cfff4accc96026bd463d19221488fd5..f1d19000f4ce37c97071a51939e8fcabb4c22e58 100755 (executable)
--- a/memory.c
+++ b/memory.c
@@ -1470,10 +1470,11 @@ static int kickstart_checksum (uae_u8 *mem, int size)
     return 0;
 }
 
+static char *kickstring = "exec.library";
 int read_kickstart (struct zfile *f, uae_u8 *mem, int size, int dochecksum, int *cloanto_rom)
 {
     unsigned char buffer[20];
-    int i, cr = 0;
+    int i, j, cr = 0;
 
     if (cloanto_rom)
        *cloanto_rom = 0;
@@ -1513,7 +1514,14 @@ int read_kickstart (struct zfile *f, uae_u8 *mem, int size, int dochecksum, int
        i = 524288;
        dochecksum = 0;
     }
-    if (dochecksum && i >= 262144)
+    for (j = 0; j < 256 && i >= 262144; j++) {
+       if (!memcmp (kickmemory + j, kickstring, strlen (kickstring) + 1))
+           break;
+    }
+    if (j == 256 || i < 262144)
+       dochecksum = 0;
+
+    if (dochecksum)
        kickstart_checksum (mem, size);
     return i;
 }
index 31ce7f1aa46626904b8760b053acd97b76724476..96d695afe430e10dd2c9c314bfd2601e698b6a70 100755 (executable)
--- a/newcpu.c
+++ b/newcpu.c
@@ -2545,9 +2545,13 @@ uae_u8 *restore_cpu (uae_u8 *src)
     write_log ("CPU %d%s%03d, PC=%08.8X\n",
        model / 1000, flags & 1 ? "EC" : "", model % 1000, regs.pc);
 
+    return src;
+}
+
+void restore_cpu_finish(void)
+{
     init_m68k_full ();
     m68k_setpc (regs.pc);
-    return src;
 }
 
 static int cpumodel[] = { 68000, 68010, 68020, 68020, 68040, 68060 };
index 611ab4cbc30c18e85e49c5a5a2070878c38e8a6b..90840c518fcd53dd42230464f35ab30e690947dd 100755 (executable)
@@ -82,6 +82,18 @@ static int read_uaefsdb (const char *dir, const char *name, uae_u8 *fsdb)
     return 0;
 }
 
+static int delete_uaefsdb (const char *dir)
+{
+    char *p;
+    int ret;
+
+    p = make_uaefsdbpath (dir, NULL);
+    ret = DeleteFile(p);
+    write_log("delete FSDB stream '%s' = %d\n", p, ret);
+    xfree (p);
+    return ret;
+}
+
 static int write_uaefsdb (const char *dir, uae_u8 *fsdb)
 {
     char *p;
@@ -174,6 +186,12 @@ static a_inode *aino_from_buf (a_inode *base, uae_u8 *buf, int *winmode)
     aino->has_dbentry = 0;
     aino->dirty = 0;
     aino->db_offset = 0;
+    if((mode = GetFileAttributes(aino->nname)) == INVALID_FILE_ATTRIBUTES) {
+       write_log("xGetFileAttributes('%s') failed! error=%d, aino=%p\n",
+           aino->nname, GetLastError(), aino);
+       return aino;
+    }
+    aino->dir = (mode & FILE_ATTRIBUTE_DIRECTORY) ? 1 : 0;
     return aino;
 }
 
@@ -268,7 +286,7 @@ int fsdb_fill_file_attrs (a_inode *base, a_inode *aino)
     aino->amigaos_mode = A_FIBF_EXECUTE | A_FIBF_READ;
     if (!(FILE_ATTRIBUTE_ARCHIVE & mode))
        aino->amigaos_mode |= A_FIBF_ARCHIVE;
-    if (! (FILE_ATTRIBUTE_READONLY & mode))
+    if (!(FILE_ATTRIBUTE_READONLY & mode))
        aino->amigaos_mode |= A_FIBF_WRITE | A_FIBF_DELETE;
     if (FILE_ATTRIBUTE_SYSTEM & mode)
        aino->amigaos_mode |= A_FIBF_PURE;
@@ -276,15 +294,27 @@ int fsdb_fill_file_attrs (a_inode *base, a_inode *aino)
        aino->amigaos_mode |= A_FIBF_HIDDEN;
     aino->amigaos_mode = filesys_parse_mask(aino->amigaos_mode);
     aino->amigaos_mode |= oldamode & A_FIBF_SCRIPT;
-    if (reset) {
-       if (base->volflags & MYVOLUMEINFO_STREAMS) {
-           create_uaefsdb (aino, fsdb, mode);
-           write_uaefsdb (aino->nname, fsdb);
-       }
+    if (reset && (base->volflags & MYVOLUMEINFO_STREAMS)) {
+       create_uaefsdb (aino, fsdb, mode);
+       write_uaefsdb (aino->nname, fsdb);
     }
     return 1;
 }
 
+static int needs_fsdb (a_inode *aino)
+{
+    const char *nn_begin;
+
+    if (aino->deleted)
+       return 0;
+
+    if (!fsdb_mode_representable_p (aino) || aino->comment != 0)
+       return 1;
+
+    nn_begin = nname_begin (aino->nname);
+    return strcmp (nn_begin, aino->aname) != 0;
+}
+
 int fsdb_set_file_attrs (a_inode *aino)
 {
     uae_u32 tmpmask;
@@ -315,8 +345,12 @@ int fsdb_set_file_attrs (a_inode *aino)
 
     aino->dirty = 1;
     if (aino->volflags & MYVOLUMEINFO_STREAMS) {
-       create_uaefsdb (aino, fsdb, mode);
-       write_uaefsdb (aino->nname, fsdb);
+       if (needs_fsdb(aino)) {
+           create_uaefsdb (aino, fsdb, mode);
+           write_uaefsdb (aino->nname, fsdb);
+       } else {
+           delete_uaefsdb (aino->nname);
+       }
     }
     return 0;
 }
@@ -662,14 +696,17 @@ void *my_open (const char *name, int flags)
        SetFileAttributes (name, FILE_ATTRIBUTE_NORMAL);
     h = CreateFile (name, DesiredAccess, ShareMode, NULL, CreationDisposition, FlagsAndAttributes, NULL);
     if (h == INVALID_HANDLE_VALUE) {
-       if (GetLastError () == ERROR_ACCESS_DENIED && (DesiredAccess & GENERIC_WRITE)) {
+       DWORD err = GetLastError();
+       if (err == ERROR_ACCESS_DENIED && (DesiredAccess & GENERIC_WRITE)) {
            DesiredAccess &= ~GENERIC_WRITE;
            h = CreateFile (name, DesiredAccess, ShareMode, NULL, CreationDisposition, FlagsAndAttributes, NULL);
+           if (h == INVALID_HANDLE_VALUE)
+               err = GetLastError();
        }
        if (h == INVALID_HANDLE_VALUE) {
-           write_log ("failed to open '%s' %x %x\n", name, DesiredAccess, CreationDisposition);
+           write_log ("failed to open '%s' %x %x err=%d\n", name, DesiredAccess, CreationDisposition, err);
            xfree (mos);
-           mos = 0;
+           mos = NULL;
            goto err;
        }
     }
index 27685d632c091d09266ab0b23e888f083716c5dd..597865f5bb24907f33ae17973b8aa4ccc050afb9 100755 (executable)
 #define IDC_QUICKSTART_COMPATIBILITY    1676
 #define IDC_PATHS_AVIOUTPUTS            1676
 #define IDC_QUICKSTART_CONFIG           1677
+#define IDC_RESETREGISTRY2              1677
+#define IDC_RESETDISKHISTORY            1677
 #define IDC_DF0Q                        1678
 #define IDC_DF0QQ                       1678
 #define IDC_DF1Q                        1679
index 306adb582d26152888b40350ea6c235cc903ee3c..2995141b829812e489c5cf0b3ca22c27eabbaa5d 100755 (executable)
@@ -264,7 +264,7 @@ BEGIN
     EDITTEXT        IDC_SOUNDADJUSTNUM,124,224,40,12,ES_CENTER | ES_READONLY
     PUSHBUTTON      "Calibrate",IDC_SOUNDCALIBRATE,183,223,40,14
     COMBOBOX        IDC_SOUNDSWAP,73,144,62,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
-    LTEXT           "Swap channels:",IDC_SOUNDSWAPTXT,82,135,50,8,SS_CENTERIMAGE
+    LTEXT           "Swap channels:",IDC_SOUNDSWAPTXT,74,135,50,8,SS_CENTERIMAGE
 END
 
 IDD_LOADSAVE DIALOGEX 0, 0, 302, 241
@@ -672,8 +672,9 @@ BEGIN
     PUSHBUTTON      "...",IDC_PATHS_SAVEIMAGES,281,175,11,15
     PUSHBUTTON      "Reset to defaults",IDC_PATHS_DEFAULT,14,199,92,14
     PUSHBUTTON      "Rescan ROMs",IDC_ROM_RESCAN,14,218,92,14
-    PUSHBUTTON      "Clear registry",IDC_RESETREGISTRY,190,217,85,14
+    PUSHBUTTON      "Clear registry",IDC_RESETREGISTRY,112,218,77,14
     COMBOBOX        IDC_PATHS_DEFAULTTYPE,112,199,163,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    PUSHBUTTON      "Clear disk history",IDC_RESETDISKHISTORY,198,218,77,14
 END
 
 IDD_QUICKSTART DIALOGEX 0, 0, 300, 242
index 09e1ae80583e1d93d965e44bc1290adcc12e0fc9..b1765ae5288d9d4a86b021d8ee8afc0bff6a9af9 100755 (executable)
@@ -591,6 +591,7 @@ static void channelswap(uae_s16 *sndbuffer, int len)
     }
 }
 
+#if 0
 static void filtercheck (uae_s16 *sndbuffer, int len)
 {
     int ch = currprefs.sound_stereo == 2 ? 4 : (currprefs.sound_stereo ? 2 : 1);
@@ -626,13 +627,16 @@ static void filtercheck (uae_s16 *sndbuffer, int len)
        }
     }
 }
+#endif
 
 void finish_sound_buffer (void)
 {
     if (turbo_emulation)
        return;
+#if 0 /* done completely in audio.c now */
     if (currprefs.sound_filter && currprefs.sound_freq != 44100)
         filtercheck((uae_s16*)sndbuffer, sndbufsize / 2);
+#endif
     if (currprefs.sound_stereo == 1 && currprefs.sound_stereo_swap_paula)
         channelswap((uae_s16*)sndbuffer, sndbufsize / 2);
 #ifdef DRIVESOUND
index ebbd1943ff8981ea7ce7d50656e005e85bf44de8..4ed4fb8cac786b2a4ee52abb8db6b84db3c1f910 100755 (executable)
@@ -443,8 +443,8 @@ void setmouseactive (int active)
                    ClipCursor (&amigawin_rect);
                }
                mousecapture = 1;
+               setcursor (-1, -1);
            }
-           setcursor (-1, -1);
        }
        inputdevice_acquire ();
     }
@@ -596,6 +596,8 @@ static void handleXbutton (WPARAM wParam, int updown)
        setmousebuttonstate (dinput_winmouse(), num, updown);
 }
 
+#define MSGDEBUG 0
+
 static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
     PAINTSTRUCT ps;
@@ -604,6 +606,10 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
     static int mm;
     static int minimized;
 
+#if MSGDEBUG
+    write_log ("AWP: %x %d\n", hWnd, message);
+#endif
+
     if (ignore_messages_all)
        return DefWindowProc (hWnd, message, wParam, lParam);
 
@@ -612,10 +618,12 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
 
     switch (message)
     {
+    case WM_SETCURSOR:
+    return TRUE;
     case WM_SIZE:
     {
-#if 0
-       write_log ("WM_SIZE %d %d\n", wParam, minimized);
+#if MSGDEBUG
+       write_log ("WM_SIZE %x %d %d\n", hWnd, wParam, minimized);
 #endif
        if (isfullscreen ()) {
            v = minimized;
@@ -644,8 +652,8 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
     }
            
     case WM_ACTIVATE:
-#if 0
-       write_log ("WM_ACTIVE %d %d %d\n", HIWORD (wParam), LOWORD (wParam), minimized);
+#if MSGDEBUG
+       write_log ("WM_ACTIVE %x %d %d %d\n", hWnd, HIWORD (wParam), LOWORD (wParam), minimized);
 #endif
        if (!isfullscreen ()) {
            minimized = HIWORD (wParam);
@@ -668,8 +676,8 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
        break;
 
     case WM_ACTIVATEAPP:
-#if 0
-       write_log ("WM_ACTIVATEAPP %d %d\n", wParam, minimized);
+#if MSGDEBUG
+       write_log ("WM_ACTIVATEAPP %x %d %d\n", hWnd, wParam, minimized);
 #endif
        activateapp = wParam;
        if (!wParam) {
@@ -799,6 +807,10 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
 
     case WM_WINDOWPOSCHANGED:
        GetWindowRect (hWnd, &amigawin_rect);
+       if (!isfullscreen()) {
+           currprefs.gfx_size_win.x = amigawin_rect.left;
+           currprefs.gfx_size_win.y = amigawin_rect.top;
+       }
     break;
 
     case WM_MOUSEMOVE:
@@ -1011,6 +1023,10 @@ static LRESULT CALLBACK MainWindowProc (HWND hWnd, UINT message, WPARAM wParam,
     RECT rc;
     HDC hDC;
 
+#if MSGDEBUG
+    write_log ("MWP: %x %d\n", hWnd, message);
+#endif
+
     switch (message)
     {
      case WM_MOUSEMOVE:
@@ -1064,7 +1080,7 @@ static LRESULT CALLBACK MainWindowProc (HWND hWnd, UINT message, WPARAM wParam,
 
      case WM_WINDOWPOSCHANGED:
        WIN32GFX_WindowMove();
-       ifhAmigaWnd && GetWindowRect(hAmigaWnd, &amigawin_rect)) {
+       if (hAmigaWnd && GetWindowRect(hAmigaWnd, &amigawin_rect)) {
            if (in_sizemove > 0)
                break;
 
@@ -1072,17 +1088,19 @@ static LRESULT CALLBACK MainWindowProc (HWND hWnd, UINT message, WPARAM wParam,
                static int store_xy;
                RECT rc2;
                if (GetWindowRect(hMainWnd, &rc2)) {
+                   DWORD left = rc2.left - win_x_diff;
+                   DWORD top = rc2.top - win_y_diff;
                    if (amigawin_rect.left & 3) {
-                       MoveWindow (hMainWnd, rc2.left+ 4 - amigawin_rect.left % 4, rc2.top,
+                       MoveWindow (hMainWnd, rc2.left + 4 - amigawin_rect.left % 4, rc2.top,
                                    rc2.right - rc2.left, rc2.bottom - rc2.top, TRUE);
 
                    }
                    if (hWinUAEKey && store_xy++) {
-                       DWORD left = rc2.left - win_x_diff;
-                       DWORD top = rc2.top - win_y_diff;
                        RegSetValueEx(hWinUAEKey, "xPos", 0, REG_DWORD, (LPBYTE)&left, sizeof(LONG));
                        RegSetValueEx(hWinUAEKey, "yPos", 0, REG_DWORD, (LPBYTE)&top, sizeof(LONG));
                    }
+                   currprefs.gfx_size_win.x = left;
+                   currprefs.gfx_size_win.y = top;
                }
                return 0;
            }
@@ -1159,7 +1177,6 @@ void handle_events (void)
        emulation_paused = 0;
        manual_painting_needed--;
     }
-
 }
 
 /* We're not a console-app anymore! */
index 36d51b097d16dcd4ab1ab158726435f6cbb68f24..45f70315490c1cde44d85350a19e14b65bb480d4 100755 (executable)
@@ -22,7 +22,7 @@ extern int manual_palette_refresh_needed;
 extern int mouseactive, focus;
 extern int ignore_messages_all;
 #define WINUAEBETA 1
-#define WINUAEBETASTR " Beta 2"
+#define WINUAEBETASTR " Beta 3"
 
 extern char start_path_exe[MAX_DPATH];
 extern char start_path_data[MAX_DPATH];
index 41193b2fb06456d266c3f664cb92819cf3c654e2..4bafb65a2c8f90c83a531348dcb4b08db3db6d87 100755 (executable)
@@ -1026,6 +1026,8 @@ int check_prefs_changed_gfx (void)
     c |= currprefs.gfx_size_fs.height != changed_prefs.gfx_size_fs.height ? (1|8) : 0;
     c |= currprefs.gfx_size_win.width != changed_prefs.gfx_size_win.width ? (2|8) : 0;
     c |= currprefs.gfx_size_win.height != changed_prefs.gfx_size_win.height ? (2|8) : 0;
+    c |= currprefs.gfx_size_win.x != changed_prefs.gfx_size_win.x ? 16 : 0;
+    c |= currprefs.gfx_size_win.y != changed_prefs.gfx_size_win.y ? 16 : 0;
     c |= currprefs.color_mode != changed_prefs.color_mode ? (1|8) : 0;
     c |= currprefs.gfx_afullscreen != changed_prefs.gfx_afullscreen ? (2|8) : 0;
     c |= currprefs.gfx_pfullscreen != changed_prefs.gfx_pfullscreen ? (2|8) : 0;
@@ -1041,7 +1043,7 @@ int check_prefs_changed_gfx (void)
     c |= currprefs.gfx_lores != changed_prefs.gfx_lores ? 1 : 0;
     c |= currprefs.gfx_linedbl != changed_prefs.gfx_linedbl ? 1 : 0;
     c |= currprefs.gfx_lores_mode != changed_prefs.gfx_lores_mode ? 1 : 0;
-    c |= currprefs.gfx_display != changed_prefs.gfx_display ? 1 : 0;
+    c |= currprefs.gfx_display != changed_prefs.gfx_display ? (1|4|8) : 0;
     c |= currprefs.win32_alwaysontop != changed_prefs.win32_alwaysontop ? 1 : 0;
     c |= currprefs.win32_borderless != changed_prefs.win32_borderless ? 1 : 0;
     c |= currprefs.win32_no_overlay != changed_prefs.win32_no_overlay ? 1 : 0;
@@ -1057,6 +1059,8 @@ int check_prefs_changed_gfx (void)
        currprefs.gfx_size_fs.height = changed_prefs.gfx_size_fs.height;
        currprefs.gfx_size_win.width = changed_prefs.gfx_size_win.width;
        currprefs.gfx_size_win.height = changed_prefs.gfx_size_win.height;
+       currprefs.gfx_size_win.x = changed_prefs.gfx_size_win.x;
+       currprefs.gfx_size_win.y = changed_prefs.gfx_size_win.y;
        currprefs.color_mode = changed_prefs.color_mode;
        currprefs.gfx_afullscreen = changed_prefs.gfx_afullscreen;
        currprefs.gfx_pfullscreen = changed_prefs.gfx_pfullscreen;
index 3ea62ac0b63f4a221aa4934154270cdf3c238e0b..c94259c5ebcef9189cf711113340342792e3d82e 100755 (executable)
@@ -132,6 +132,81 @@ struct ToolTipHWNDS {
 };
 static struct ToolTipHWNDS ToolTipHWNDS2[MAX_IMAGETOOLTIPS + 1];
 
+void write_disk_history (void)
+{
+    int i, j;
+    char tmp[16];
+    HKEY fkey;
+
+    if (!hWinUAEKey)
+       return;
+    RegCreateKeyEx(hWinUAEKey , "DiskImageMRUList", 0, NULL, REG_OPTION_NON_VOLATILE,
+       KEY_READ | KEY_WRITE, NULL, &fkey, NULL);
+    if (fkey == NULL)
+       return;
+    j = 1;
+    for (i = 0; i <= MAX_PREVIOUS_FLOPPIES; i++) {
+       char *s = DISK_history_get(i);
+       if (s == 0 || strlen(s) == 0)
+           continue;
+       sprintf (tmp, "Image%02d", j);
+       RegSetValueEx (fkey, tmp, 0, REG_SZ, (CONST BYTE *)s, strlen(s) + 1);
+       j++;
+   }
+    while (j <= MAX_PREVIOUS_FLOPPIES) {
+       char *s = "";
+       sprintf (tmp, "Image%02d", j);
+       RegSetValueEx (fkey, tmp, 0, REG_SZ, (CONST BYTE *)s, strlen(s) + 1);
+       j++;
+    }
+    RegCloseKey(fkey);
+}
+
+void reset_disk_history (void)
+{
+    int i;
+
+    for (i = 0; i < MAX_PREVIOUS_FLOPPIES; i++)
+       DISK_history_add (NULL, i);
+    write_disk_history();
+}
+
+HKEY read_disk_history (void)
+{
+    static int regread;
+    char tmp2[1000];
+    DWORD size2;
+    int idx, idx2;
+    HKEY fkey;
+    char tmp[1000];
+    DWORD size;
+
+    if (!hWinUAEKey)
+       return NULL;
+    RegCreateKeyEx(hWinUAEKey , "DiskImageMRUList", 0, NULL, REG_OPTION_NON_VOLATILE,
+       KEY_READ | KEY_WRITE, NULL, &fkey, NULL);
+    if (fkey == NULL || regread)
+       return fkey;
+
+    idx = 0;
+    for (;;) {
+       int err;
+       size = sizeof (tmp);
+       size2 = sizeof (tmp2);
+       err = RegEnumValue (fkey, idx, tmp, &size, NULL, NULL, tmp2, &size2);
+       if (err != ERROR_SUCCESS)
+           break;
+       if (strlen (tmp) == 7) {
+           idx2 = atol (tmp + 5) - 1;
+           if (idx2 >= 0)
+               DISK_history_add (tmp2, idx2);
+       }
+       idx++;
+    }
+    regread = 1;
+    return fkey;
+}
+
 void exit_gui (int ok)
 {
     if (!gui_active)
@@ -774,6 +849,7 @@ void gui_display(int shortcut)
     DX_SetPalette (0, 256);
 #endif
     screenshot_free();
+    write_disk_history();
     here--;
 }
 
@@ -2813,6 +2889,9 @@ static INT_PTR CALLBACK PathsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
            case IDC_RESETREGISTRY:
            resetregistry ();
            break;
+           case IDC_RESETDISKHISTORY:
+           reset_disk_history ();
+           break;
        }
        recursive--;
     }
@@ -4510,10 +4589,6 @@ static void values_to_miscdlg (HWND hDlg)
        CheckDlgButton (hDlg, IDC_SHOWGUI, workprefs.start_gui);
        CheckDlgButton (hDlg, IDC_JULIAN, workprefs.win32_middle_mouse);
        CheckDlgButton (hDlg, IDC_CREATELOGFILE, workprefs.win32_logfile);
-       CheckDlgButton (hDlg, IDC_INACTIVE_PAUSE, workprefs.win32_inactive_pause);
-       CheckDlgButton (hDlg, IDC_INACTIVE_NOSOUND, workprefs.win32_inactive_nosound || workprefs.win32_inactive_pause);
-       CheckDlgButton (hDlg, IDC_MINIMIZED_PAUSE, workprefs.win32_iconified_pause);
-       CheckDlgButton (hDlg, IDC_MINIMIZED_NOSOUND, workprefs.win32_iconified_nosound || workprefs.win32_iconified_pause);
        CheckDlgButton (hDlg, IDC_CTRLF11, workprefs.win32_ctrl_F11_is_quit);
        CheckDlgButton (hDlg, IDC_NOOVERLAY, workprefs.win32_no_overlay);
        CheckDlgButton (hDlg, IDC_SHOWLEDS, workprefs.leds_on_screen);
@@ -4555,6 +4630,10 @@ static void values_to_miscdlg (HWND hDlg)
 
     } else if (currentpage == MISC2_ID) {
 
+       CheckDlgButton (hDlg, IDC_INACTIVE_PAUSE, workprefs.win32_inactive_pause);
+       CheckDlgButton (hDlg, IDC_INACTIVE_NOSOUND, workprefs.win32_inactive_nosound || workprefs.win32_inactive_pause);
+       CheckDlgButton (hDlg, IDC_MINIMIZED_PAUSE, workprefs.win32_iconified_pause);
+       CheckDlgButton (hDlg, IDC_MINIMIZED_NOSOUND, workprefs.win32_iconified_nosound || workprefs.win32_iconified_pause);
        misc_addpri (hDlg, IDC_ACTIVE_PRIORITY, workprefs.win32_active_priority);
        misc_addpri (hDlg, IDC_INACTIVE_PRIORITY, workprefs.win32_inactive_priority);
        misc_addpri (hDlg, IDC_MINIMIZED_PRIORITY, workprefs.win32_iconified_priority);
@@ -6076,72 +6155,6 @@ static INT_PTR CALLBACK HarddiskDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPA
 
 #endif
 
-void write_disk_history (void)
-{
-    int i, j;
-    char tmp[16];
-    HKEY fkey;
-
-    if (!hWinUAEKey)
-       return;
-    RegCreateKeyEx(hWinUAEKey , "DiskImageMRUList", 0, NULL, REG_OPTION_NON_VOLATILE,
-       KEY_READ | KEY_WRITE, NULL, &fkey, NULL);
-    if (fkey == NULL)
-       return;
-    j = 1;
-    for (i = 0; i < 100; i++) {
-       char *s = DISK_history_get(i);
-       if (s == 0 || strlen(s) == 0)
-           continue;
-       sprintf (tmp, "Image%02d", j);
-       RegSetValueEx (fkey, tmp, 0, REG_SZ, (CONST BYTE *)s, strlen(s) + 1);
-       j++;
-   }
-    while (j < 100) {
-       char *s = "";
-       sprintf (tmp, "Image%02d", j);
-       RegSetValueEx (fkey, tmp, 0, REG_SZ, (CONST BYTE *)s, strlen(s) + 1);
-       j++;
-    }
-    RegCloseKey(fkey);
-}
-
-HKEY read_disk_history (void)
-{
-    static int regread;
-    char tmp2[1000];
-    DWORD size2;
-    int idx, idx2;
-    HKEY fkey;
-    char tmp[1000];
-    DWORD size;
-
-    if (!hWinUAEKey)
-       return NULL;
-    RegCreateKeyEx(hWinUAEKey , "DiskImageMRUList", 0, NULL, REG_OPTION_NON_VOLATILE,
-       KEY_READ | KEY_WRITE, NULL, &fkey, NULL);
-    if (fkey == NULL || regread)
-       return fkey;
-
-    idx = 0;
-    for (;;) {
-       int err;
-       size = sizeof (tmp);
-       size2 = sizeof (tmp2);
-       err = RegEnumValue (fkey, idx, tmp, &size, NULL, NULL, tmp2, &size2);
-       if (err != ERROR_SUCCESS)
-           break;
-       if (strlen (tmp) == 7) {
-           idx2 = atol (tmp + 5) - 1;
-           if (idx2 >= 0)
-               DISK_history_add (tmp2, idx2);
-       }
-       idx++;
-    }
-    regread = 1;
-    return fkey;
-}
-
 static void out_floppyspeed (HWND hDlg)
 {
     char txt[30];
index ba331f3d6f30983a0e6b23930fe84ce2677e197e..97d84441cc9690afdaef0145082a56f7969f75d4 100755 (executable)
@@ -3,6 +3,10 @@
 #include "sysdeps.h"
 
 #include <windows.h>
+#include <sys/timeb.h>
+
+#include "custom.h"
+#include "events.h"
 
 #define SHOW_CONSOLE 0
 
@@ -20,8 +24,8 @@ static void openconsole(void)
 {
     if(consoleopen) return;
     AllocConsole();
-    stdinput=GetStdHandle(STD_INPUT_HANDLE);
-    stdoutput=GetStdHandle(STD_OUTPUT_HANDLE);
+    stdinput = GetStdHandle(STD_INPUT_HANDLE);
+    stdoutput = GetStdHandle(STD_OUTPUT_HANDLE);
     SetConsoleMode(stdinput,ENABLE_PROCESSED_INPUT|ENABLE_LINE_INPUT|ENABLE_ECHO_INPUT|ENABLE_PROCESSED_OUTPUT);
     consoleopen = 1;
 }
@@ -62,44 +66,93 @@ void console_flush (void)
 {
 }
 
+static int lfdetected = 1;
+
+static char *writets(void)
+{
+    struct tm *t;
+    struct _timeb tb;
+    static char out[100];
+    char *p;
+    static char lastts[100];
+    char curts[100];
+
+    _ftime(&tb);
+    t = localtime(&tb.time);
+    strftime(curts, sizeof curts, "%Y-%m-%d %H:%M:%S\n", t);
+    p = out;
+    *p = 0;
+    if (memcmp (curts, lastts, strlen (curts))) {
+       strcat (p, curts);
+       p += strlen (p);
+       strcpy (lastts, curts);
+    }
+    strftime(p, sizeof out - (p - out) , "%S-", t);
+    p += strlen(p);
+    sprintf(p, "%03d", tb.millitm);
+    p += strlen(p);
+    if (timeframes || vpos > 0 && current_hpos() > 0)
+       sprintf (p, " [%d %03dx%03d]", timeframes, current_hpos(), vpos);
+    strcat (p, ": ");
+    return out;
+}
+
+
 void write_dlog (const char *format, ...)
 {
     int count;
     DWORD numwritten;
     char buffer[WRITE_LOG_BUF_SIZE];
+    char *ts;
 
     va_list parms;
     va_start (parms, format);
-    count = _vsnprintf( buffer, WRITE_LOG_BUF_SIZE-1, format, parms );
+    count = _vsnprintf(buffer, WRITE_LOG_BUF_SIZE-1, format, parms);
+    ts = writets();
     if (SHOW_CONSOLE || console_logging) {
        openconsole();
-       WriteConsole(stdoutput,buffer,strlen(buffer),&numwritten,0);
+       if (lfdetected)
+           WriteConsole(stdoutput, ts, strlen(ts), &numwritten,0);
+       WriteConsole(stdoutput, buffer, strlen(buffer), &numwritten,0);
     }
     if (debugfile) {
-       fprintf( debugfile, buffer );
-       fflush (debugfile);
+       if (lfdetected)
+           fprintf(debugfile, ts);
+       fprintf(debugfile, buffer);
+       fflush(debugfile);
     }
+    lfdetected = 0;
+    if (strlen(buffer) > 0 && buffer[strlen(buffer) - 1] == '\n')
+       lfdetected = 1;
     va_end (parms);
 }
 void write_log (const char *format, ...)
 {
     int count, tmp;
     DWORD numwritten;
-    char buffer[WRITE_LOG_BUF_SIZE];
+    char buffer[WRITE_LOG_BUF_SIZE], *ts;
 
     va_list parms;
-    va_start (parms, format);
-    count = _vsnprintf( buffer, WRITE_LOG_BUF_SIZE-1, format, parms );
+    va_start(parms, format);
+    count = _vsnprintf(buffer, WRITE_LOG_BUF_SIZE-1, format, parms);
+    ts = writets();
     if (SHOW_CONSOLE || console_logging) {
        openconsole();
-       tmp = WriteConsole(stdoutput,buffer,strlen(buffer),&numwritten,0);
+       if (lfdetected)
+           WriteConsole(stdoutput, ts, strlen(ts), &numwritten,0);
+       tmp = WriteConsole(stdoutput, buffer, strlen(buffer), &numwritten, 0);
        if (!tmp)
            tmp = GetLastError();
     }
     if (debugfile) {
-       fprintf (debugfile, buffer);
-       fflush (debugfile);
+       if (lfdetected)
+           fprintf(debugfile, ts);
+       fprintf(debugfile, buffer);
+       fflush(debugfile);
     }
+    lfdetected = 0;
+    if (strlen(buffer) > 0 && buffer[strlen(buffer) - 1] == '\n')
+       lfdetected = 1;
     va_end (parms);
 }
 
index bfc54bcff430920e8f88553d7fb11b099b03d9a6..bb41d7913039bc4b89f1b80b75f43e4c8d4a41e0 100755 (executable)
@@ -479,6 +479,7 @@ void savestate_restore_finish (void)
     zfile_fclose (savestate_file);
     savestate_file = 0;
     savestate_state = 0;
+    restore_cpu_finish();
 }
 
 /* 1=compressed,2=not compressed,3=ram dump,4=audio dump */