]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
imported winuaesrc1500b19.zip
authorToni Wilen <twilen@winuae.net>
Sat, 17 May 2008 10:49:45 +0000 (13:49 +0300)
committerToni Wilen <twilen@winuae.net>
Mon, 22 Feb 2010 19:40:21 +0000 (21:40 +0200)
27 files changed:
ar.c
archivers/lha/uae_lha.c
autoconf.c
custom.c
fpp.c
gayle.c
include/autoconf.h
include/memory.h
include/savestate.h
inputdevice.c
memory.c
od-win32/ahidsound.c
od-win32/dxwrap.c
od-win32/dxwrap.h
od-win32/mman.c
od-win32/picasso96_win.c
od-win32/picasso96_win.h
od-win32/sys/mman.h
od-win32/win32.c
od-win32/win32.h
od-win32/win32gfx.c
od-win32/win32gui.c
od-win32/winuae_msvc/winuae_msvc.vcproj
od-win32/winuaechangelog.txt
savestate.c
uaeserial.c
zfile.c

diff --git a/ar.c b/ar.c
index 78c094b58a344a75eee8674c0435c616ad0edee2..4adafc7a6c20a638f79ca971ce392f4cde5ca5ab 100755 (executable)
--- a/ar.c
+++ b/ar.c
 #endif
 
 static char *cart_memnames[] = { NULL, "hrtmon", "arhrtmon", "superiv" };
-static char *cart_memnames2[] = { NULL, NULL, NULL, "superiv_2" };
-static char *cart_memnames3[] = { NULL, NULL, NULL, "superiv_3" };
 
 #define ARMODE_FREEZE 0 /* AR2/3 The action replay 'freeze' button has been pressed.  */
 #define ARMODE_BREAKPOINT_AR2 2 /* AR2: The action replay is activated via a breakpoint. */
@@ -1515,6 +1513,9 @@ static int superiv_init (struct romdata *rd, struct zfile *f)
     uae_u32 chip = currprefs.chipmem_size - 0x10000;
     int subtype = rd->id;
     int flags = rd->type;
+    char *memname1, *memname2, *memname3;
+
+    memname1 = memname2 = memname3 = NULL;
 
     cart_type = CART_SUPER4;
 
@@ -1528,6 +1529,8 @@ static int superiv_init (struct romdata *rd, struct zfile *f)
        hrtmem2_start = 0xf20000;
        hrtmem2_size =  0x10000;
        hrtmem_rom = 1;
+       memname1 = "xpower_e2";
+       memname2 = "xpower_f2";
     } else if (flags & ROMTYPE_NORDIC) { /* nordic */
        hrtmem_start = 0xf00000;
        hrtmem_size = 0x10000;
@@ -1536,9 +1539,12 @@ static int superiv_init (struct romdata *rd, struct zfile *f)
        hrtmem2_end = 0xf60000;
        hrtmem2_size =  0x10000;
        hrtmem_rom = 1;
+       memname1 = "nordic_f0";
+       memname2 = "nordic_f4";
        if (subtype == 70) {
            hrtmem_start += 0x60000;
            hrtmem_end += 0x60000;
+           memname1 = "nordic_f6";
        }
     } else { /* super4 */
        hrtmem_start = 0xd00000;
@@ -1548,11 +1554,14 @@ static int superiv_init (struct romdata *rd, struct zfile *f)
        hrtmem2_size2 = 0x0c0000;
        hrtmem3_start = 0xe00000;
        hrtmem3_size = 0x80000;
+       memname1 = "superiv_d0";
+       memname2 = "superiv_b0";
+       memname3 = "superiv_e0";
     }
     if (hrtmem2_size && !hrtmem2_size2)
        hrtmem2_size2 = hrtmem2_size;
 
-    hrtmemory = mapped_malloc (hrtmem_size, cart_memnames[cart_type]);
+    hrtmemory = mapped_malloc (hrtmem_size, memname1);
     memset (hrtmemory, 0x00, hrtmem_size);
     if (f) {
        zfile_fseek (f, 0, SEEK_SET);
@@ -1564,11 +1573,11 @@ static int superiv_init (struct romdata *rd, struct zfile *f)
     hrtmem2_mask = hrtmem2_size - 1;
     hrtmem3_mask = hrtmem3_size - 1;
     if (hrtmem2_size) {
-       hrtmemory2 = mapped_malloc (hrtmem2_size, cart_memnames2[cart_type]);
+       hrtmemory2 = mapped_malloc (hrtmem2_size, memname2);
        memset(hrtmemory2, 0, hrtmem2_size);
     }
     if (hrtmem3_size) {
-       hrtmemory3 = mapped_malloc (hrtmem3_size, cart_memnames3[cart_type]);
+       hrtmemory3 = mapped_malloc (hrtmem3_size, memname3);
        memset(hrtmemory3, 0, hrtmem3_size);
     }
     hrtmem3_bank.baseaddr = hrtmemory3;
@@ -1817,7 +1826,7 @@ int hrtmon_load (void)
        #endif
        cart_type = CART_HRTMON;
     }
-    hrtmemory = mapped_malloc (hrtmem_size, cart_memnames[cart_type]);
+    hrtmemory = mapped_malloc (hrtmem_size, "hrtmem");
     memset (hrtmemory, 0xff, 0x80000);
     zfile_fseek (f, 0, SEEK_SET);
     zfile_fread (hrtmemory, 1, 524288, f);
@@ -1826,12 +1835,14 @@ int hrtmon_load (void)
     hrtmon_custom = hrtmemory + 0x08f000;
     hrtmon_ciaa = hrtmemory + 0x08e000;
     hrtmon_ciab = hrtmemory + 0x08d000;
+#if 0
     if (hrtmem2_size) {
        hrtmem2_mask = hrtmem2_size - 1;
        hrtmemory2 = mapped_malloc (hrtmem2_size, cart_memnames2[cart_type]);
        memset(hrtmemory2, 0, hrtmem2_size);
        hrtmem2_bank.baseaddr = hrtmemory2;
     }
+#endif
     hrtmem_bank.baseaddr = hrtmemory;
     hrtmon_flag = ACTION_REPLAY_IDLE;
     write_log ("%s installed at %08.8X\n", cart_memnames[cart_type], hrtmem_start);
index b48b85b5b3e72593a00994a4611ed18e9126ef61..af9497e3c941751e77658aec81fedfe30703d630 100755 (executable)
@@ -30,6 +30,12 @@ struct zvolume *archive_directory_lha(struct zfile *zf)
     zv = zvolume_alloc(zf, ArchiveFormatLHA, NULL);
     while (get_header(zf, &hdr)) {
        struct znode *zn;
+       int method;
+
+       for (i = 0; methods[i]; i++) {
+           if (!strcmp(methods[i], hdr.method))
+               method = i;
+       }
        memset(&zai, 0, sizeof zai);
        zai.name = hdr.name;
        zai.size = hdr.original_size;
@@ -37,12 +43,13 @@ struct zvolume *archive_directory_lha(struct zfile *zf)
        zai.t = hdr.unix_last_modified_stamp -= _timezone;
        if (hdr.name[strlen(hdr.name) + 1] != 0)
            zai.comment = &hdr.name[strlen(hdr.name) + 1];
-       zn = zvolume_addfile_abs(zv, &zai);
-       zn->offset = zfile_ftell(zf);
-       zn->packedsize = hdr.packed_size;
-       for (i = 0; methods[i]; i++) {
-           if (!strcmp(methods[i], hdr.method))
-               zn->method = i;
+       if (method == LZHDIRS_METHOD_NUM) {
+           zvolume_adddir_abs(zv, &zai);
+       } else {
+           zn = zvolume_addfile_abs(zv, &zai);
+           zn->offset = zfile_ftell(zf);
+           zn->packedsize = hdr.packed_size;
+           zn->method = method;
        }
        zfile_fseek(zf, hdr.packed_size, SEEK_CUR);
 
index ed8b6dd7ff21cb99d96a0a013b34148ac99a1672..316e84494bd4d11ada6596b22637f0cf93710553 100755 (executable)
@@ -245,6 +245,9 @@ void rtarea_init (void)
 #ifdef FILESYS
     filesys_install_code ();
 #endif
+#ifdef PICASSO96
+    uaegfx_install_code ();
+#endif
 
     uae_boot_rom_size = here() - rtarea_base;
     init_extended_traps ();
index a58ff2daacf41f0db0208a7a6bbffba85018a6f5..1a2f1061c808a429ed1adc2c5acb1722c17f5263 100755 (executable)
--- a/custom.c
+++ b/custom.c
@@ -2052,19 +2052,22 @@ static int tospritexddf (int ddf)
 
 static void calcsprite (void)
 {
-    int min, max;
-
     sprite_maxx = max_diwlastword;
     sprite_minx = 0;
     if (thisline_decision.diwlastword >= 0)
        sprite_maxx = tospritexdiw (thisline_decision.diwlastword);
     if (thisline_decision.diwfirstword >= 0)
        sprite_minx = tospritexdiw (thisline_decision.diwfirstword);
-    min = tospritexddf (thisline_decision.plfleft);
-    max = tospritexddf (thisline_decision.plfright);
-    if (min > sprite_minx && min < max) /* min < max = full line ddf */
-       sprite_minx = min;
-    /* sprites are visible from DDFSTRT to end of line (another undocumented feature) */
+    if (thisline_decision.plfleft >= 0) {
+       int min, max;
+       min = tospritexddf (thisline_decision.plfleft);
+       max = tospritexddf (thisline_decision.plfright);
+       if (min > sprite_minx && min < max) /* min < max = full line ddf */
+           sprite_minx = min;
+       /* sprites are visible from first BPL0DAT write to end of line
+        * (another undocumented feature)
+        */
+    }
 }
 
 static void decide_sprites (int hpos)
diff --git a/fpp.c b/fpp.c
index 04c8b7ff27c4fad01e356af9fcdf6c5627317af5..4aebb38c0de4fdbf3778ce465bfea2b72999d9e8 100755 (executable)
--- a/fpp.c
+++ b/fpp.c
@@ -146,7 +146,8 @@ static void fpu_op_illg (uae_u32 opcode, struct regstruct *regs, int pcoffset)
         * Line F exception with different stack frame.. */
        uaecptr newpc = m68k_getpc (regs);
        uaecptr oldpc = newpc - pcoffset;
-       MakeSR(regs);
+       regs->t0 = regs->t1 = 0;
+       MakeSR (regs);
        if (!regs->s) {
            regs->usp = m68k_areg (regs, 7);
            m68k_areg (regs, 7) = regs->isp;
diff --git a/gayle.c b/gayle.c
index 116da4ffde1b48d426ad5bef8d8f293e5f1c1bc7..0d204c50e6bd40589b95a7216f139009ca6d2c03 100755 (executable)
--- a/gayle.c
+++ b/gayle.c
@@ -49,7 +49,7 @@ DE0000 to DEFFFF      64 KB Motherboard resources
 
 #define NCR_OFFSET 0x40
 
-/* Gayle definitions from Linux drivers */
+/* Gayle definitions from Linux drivers and preliminary Gayle datasheet */
 
 /* PCMCIA stuff */
 
@@ -677,7 +677,7 @@ static void ide_do_command (uae_u8 cmd)
        ide_set_features ();
     } else if (cmd == 0x00) { /* nop */
        ide_fail ();
-    } else if (cmd == 0xe0 || cmd == 0xe1 || cmd == 0xe7 || cmd == 0xea) { /* standy now/idle/flush cache/flush cache ext */
+    } else if (cmd == 0xe0 || cmd == 0xe1 || cmd == 0xe7 || cmd == 0xea) { /* standby now/idle/flush cache/flush cache ext */
        ide_interrupt ();
     } else if (cmd == 0xe5) { /* check power mode */
        ide_nsector = 0xff;
index 753de894d9d064b991b5969872a79f6948b6b68d..3d03b4f58e6c9f44a74fd85236ea8557eaa1a6c2 100755 (executable)
@@ -85,6 +85,8 @@ extern void expansion_init (void);
 extern void expansion_cleanup (void);
 extern void expansion_clear (void);
 
+extern void uaegfx_install_code (void);
+
 #define TRAPFLAG_NO_REGSAVE 1
 #define TRAPFLAG_NO_RETVAL 2
 #define TRAPFLAG_EXTRA_STACK 4
index d730582d2229cba207d11437333d6fe709aff67c..6571203277338b9916d15c71b47c2e59782154fb 100755 (executable)
@@ -322,7 +322,7 @@ extern shmpiece *shm_start;
 
 #endif
 
-extern uae_u8 *mapped_malloc (size_t, char *);
+extern uae_u8 *mapped_malloc (size_t, const char *);
 extern void mapped_free (uae_u8 *);
 extern void clearexec (void);
 extern void mapkick (void);
index b296e10515d244df79a5c74d3c7af040b7dec862..a804b73544e3b62f2a9d1fb8e9eaf2da34a9be7f 100755 (executable)
@@ -77,6 +77,7 @@ extern uae_u8 *save_expansion (int *, uae_u8 *);
 
 extern uae_u8 *restore_p96 (uae_u8 *);
 extern uae_u8 *save_p96 (int *, uae_u8 *);
+extern void restore_p96_finish (void);
 
 extern uae_u8 *restore_keyboard (uae_u8 *);
 extern uae_u8 *save_keyboard (int *);
index 2f21f08594f5a4b80ef89e3015a6dc17d6684998..fed440c8939583b110c50967499ea2abba5634d5 100755 (executable)
@@ -1908,6 +1908,30 @@ int handle_input_event (int nr, int state, int max, int autofire)
     return 1;
 }
 
+static void inputdevice_checkconfig (void)
+{
+    if (currprefs.jports[0].id != changed_prefs.jports[0].id ||
+       currprefs.jports[1].id != changed_prefs.jports[1].id ||
+       currprefs.input_selected_setting != changed_prefs.input_selected_setting ||
+       currprefs.input_joymouse_multiplier != changed_prefs.input_joymouse_multiplier ||
+       currprefs.input_joymouse_deadzone != changed_prefs.input_joymouse_deadzone ||
+       currprefs.input_joystick_deadzone != changed_prefs.input_joystick_deadzone ||
+       currprefs.input_joymouse_speed != changed_prefs.input_joymouse_speed ||
+       currprefs.input_autofire_framecnt != changed_prefs.input_autofire_framecnt ||
+       currprefs.input_mouse_speed != changed_prefs.input_mouse_speed) {
+
+       currprefs.input_selected_setting = changed_prefs.input_selected_setting;
+       currprefs.input_joymouse_multiplier = changed_prefs.input_joymouse_multiplier;
+       currprefs.input_joymouse_deadzone = changed_prefs.input_joymouse_deadzone;
+       currprefs.input_joystick_deadzone = changed_prefs.input_joystick_deadzone;
+       currprefs.input_joymouse_speed = changed_prefs.input_joymouse_speed;
+       currprefs.input_autofire_framecnt = changed_prefs.input_autofire_framecnt;
+       currprefs.input_mouse_speed = changed_prefs.input_mouse_speed;
+
+       inputdevice_updateconfig (&currprefs);
+    }
+}
+
 void inputdevice_vsync (void)
 {
     struct input_queue_struct *iq;
@@ -1943,6 +1967,7 @@ void inputdevice_vsync (void)
 #endif
     if (mouseedge ())
        mouseedge_alive = 10;
+    inputdevice_checkconfig ();
 }
 
 void inputdevice_reset (void)
index f118efb9a7f249e27151295f45a76a8a0bbf945c..ab67a7aa8c442b92d07d46c66946a4542d6578a0 100755 (executable)
--- a/memory.c
+++ b/memory.c
@@ -37,6 +37,11 @@ int candirect = -1;
 int special_mem;
 #endif
 
+static int isdirectjit (void)
+{
+    return currprefs.cachesize && !currprefs.comptrustbyte;
+}
+
 static int canjit (void)
 {
     return 1;
@@ -1342,6 +1347,52 @@ void REGPARAM2 chipmem_bput (uaecptr addr, uae_u32 b)
     chipmemory[addr] = b;
 }
 
+/* cpu chipmem access inside agnus addressable ram but no ram available */
+static uae_u32 chipmem_dummy (void)
+{
+    /* not really right but something random that has more ones than zeros.. */
+    return rand () | rand ();
+}
+void REGPARAM2 chipmem_dummy_bput (uaecptr addr, uae_u32 b)
+{
+#ifdef JIT
+    special_mem |= S_WRITE;
+#endif
+}
+void REGPARAM2 chipmem_dummy_wput (uaecptr addr, uae_u32 b)
+{
+#ifdef JIT
+    special_mem |= S_WRITE;
+#endif
+}
+void REGPARAM2 chipmem_dummy_lput (uaecptr addr, uae_u32 b)
+{
+#ifdef JIT
+    special_mem |= S_WRITE;
+#endif
+}
+static uae_u32 REGPARAM2 chipmem_dummy_bget (uaecptr addr)
+{
+#ifdef JIT
+    special_mem |= S_READ;
+#endif
+    return chipmem_dummy ();
+}
+static uae_u32 REGPARAM2 chipmem_dummy_wget (uaecptr addr)
+{
+#ifdef JIT
+    special_mem |= S_READ;
+#endif
+    return chipmem_dummy ();
+}
+static uae_u32 REGPARAM2 chipmem_dummy_lget (uaecptr addr)
+{
+#ifdef JIT
+    special_mem |= S_READ;
+#endif
+    return chipmem_dummy ();
+}
+
 static uae_u32 REGPARAM2 chipmem_agnus_lget (uaecptr addr)
 {
     uae_u32 *m;
@@ -2053,6 +2104,13 @@ addrbank chipmem_bank = {
     chipmem_lget, chipmem_wget, ABFLAG_RAM
 };
 
+addrbank chipmem_dummy_bank = {
+    chipmem_dummy_lget, chipmem_dummy_wget, chipmem_dummy_bget,
+    chipmem_dummy_lput, chipmem_dummy_wput, chipmem_dummy_bput,
+    default_xlate, dummy_check, NULL, "Dummy Chip memory",
+    dummy_lgeti, dummy_wgeti, ABFLAG_IO
+};
+
 
 #ifdef AGA
 addrbank chipmem_bank_ce2 = {
@@ -2879,11 +2937,15 @@ static void delete_shmmaps (uae_u32 start, uae_u32 size)
                return;
 
            if (x->size > size) {
-               write_log ("NATMEM: Failure to delete mapping at %08x(size %08x, delsize %08x)\n",start,x->size,size);
-               dumplist ();
+               write_log ("NATMEM WARNING: size mismatch mapping at %08x (size %08x, delsize %08x)\n",start,x->size,size);
+               size = x->size;
+           }
+#if 0
+           dumplist ();
                nocanbang ();
                return;
            }
+#endif
            shmdt (x->native_address);
            size -= x->size;
            start += x->size;
@@ -2932,7 +2994,7 @@ static void add_shmmaps (uae_u32 start, addrbank *what)
     shm_start = y;
 }
 
-uae_u8 *mapped_malloc (size_t s, char *file)
+uae_u8 *mapped_malloc (size_t s, const char *file)
 {
     int id;
     void *answer;
@@ -3154,10 +3216,22 @@ void map_overlay (int chip)
 #endif
     if (chip) {
        map_banks (&dummy_bank, 0, 32, 0);
-       if (currprefs.cpu_model < 68020 || currprefs.address_space_24)
+       if (!isdirectjit ()) {
            map_banks (cb, 0, size, allocated_chipmem);
-       else
+           if (currprefs.chipset_mask & CSMASK_ECS_AGNUS) {
+               int start = allocated_chipmem >> 16;
+               if (allocated_chipmem < 0x100000) {
+                   int dummy = (0x100000 - allocated_chipmem) >> 16;
+                   map_banks (&chipmem_dummy_bank, start, dummy, 0);
+                   map_banks (&chipmem_dummy_bank, start + 16, dummy, 0);
+               } else if (allocated_chipmem < 0x200000 && allocated_chipmem > 0x100000) {
+                   int dummy = (0x200000 - allocated_chipmem) >> 16;
+                   map_banks (&chipmem_dummy_bank, start, dummy, 0);
+               }
+           }
+       } else {
            map_banks (cb, 0, allocated_chipmem >> 16, 0);
+       }
     } else {
        addrbank *rb = NULL;
        if (size < 32)
index 00271b526cf1c6368c56ea66430d67ef3670a15b..b4bf6018eeca356a4636937284ba5884239dea4b 100755 (executable)
@@ -329,38 +329,43 @@ static int ahi_init_sound_win32 (void)
     wavfmt.nAvgBytesPerSec = wavfmt.nBlockAlign * sound_freq_ahi;
     wavfmt.cbSize = 0;
 
+    write_log ("AHI: Init AHI Sound Rate %d, Channels %d, Bits %d, Buffsize %d\n",
+       sound_freq_ahi, sound_channels_ahi, sound_bits_ahi, amigablksize);
+
+    if (!amigablksize)
+       return 0;
     soundneutral = 0;
     ahisndbufsize = (amigablksize * 4) * NATIVBUFFNUM;  // use 4 native buffer
     ahisndbuffer = malloc(ahisndbufsize + 32);
     if (!ahisndbuffer)
        return 0;
-    hr = DirectSoundCreate(&sound_device_guid[currprefs.win32_soundcard], &lpDS2, NULL);
-    if (FAILED(hr)) {
-       write_log ( "AHI: DirectSoundCreate() failure: %s\n", DXError(hr));
+    hr = DirectSoundCreate (&sound_device_guid[currprefs.win32_soundcard], &lpDS2, NULL);
+    if (FAILED (hr)) {
+       write_log ( "AHI: DirectSoundCreate() failure: %s\n", DXError (hr));
        return 0;
     }
-    memset (&sound_buffer, 0, sizeof(DSBUFFERDESC));
-    sound_buffer.dwSize = sizeof(DSBUFFERDESC);
+    memset (&sound_buffer, 0, sizeof (DSBUFFERDESC));
+    sound_buffer.dwSize = sizeof (DSBUFFERDESC);
     sound_buffer.dwFlags = DSBCAPS_PRIMARYBUFFER;
     sound_buffer.dwBufferBytes = 0;
     sound_buffer.lpwfxFormat = NULL;
 
     DSCaps.dwSize = sizeof(DSCAPS);
     hr = IDirectSound_GetCaps(lpDS2, &DSCaps);
-    if(SUCCEEDED(hr)) {
-       if(DSCaps.dwFlags & DSCAPS_EMULDRIVER)
-           write_log ( "AHI: Your DirectSound Driver is emulated via WaveOut - yuck!\n" );
+    if (SUCCEEDED(hr)) {
+       if (DSCaps.dwFlags & DSCAPS_EMULDRIVER)
+           write_log ( "AHI: Your DirectSound Driver is emulated via WaveOut - yuck!\n");
     }
-    if FAILED(IDirectSound_SetCooperativeLevel(lpDS2, hMainWnd, DSSCL_PRIORITY))
+    if (FAILED (IDirectSound_SetCooperativeLevel (lpDS2, hMainWnd, DSSCL_PRIORITY)))
        return 0;
-    hr = IDirectSound_CreateSoundBuffer(lpDS2, &sound_buffer, &lpDSBprimary2, NULL);
-    if(FAILED(hr)) {
+    hr = IDirectSound_CreateSoundBuffer (lpDS2, &sound_buffer, &lpDSBprimary2, NULL);
+    if (FAILED (hr)) {
        write_log ("AHI: CreateSoundBuffer() failure: %s\n", DXError(hr));
        return 0;
     }
-    hr = IDirectSoundBuffer_SetFormat(lpDSBprimary2, &wavfmt);
-    if(FAILED(hr)) {
-       write_log ( "AHI: SetFormat() failure: %s\n", DXError(hr));
+    hr = IDirectSoundBuffer_SetFormat (lpDSBprimary2, &wavfmt);
+    if (FAILED (hr)) {
+       write_log ( "AHI: SetFormat() failure: %s\n", DXError (hr));
        return 0;
     }
     sound_buffer.dwBufferBytes = ahisndbufsize;
@@ -369,8 +374,8 @@ static int ahi_init_sound_win32 (void)
        | DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_GLOBALFOCUS | DSBCAPS_LOCSOFTWARE;
     sound_buffer.guid3DAlgorithm = GUID_NULL;
     hr = IDirectSound_CreateSoundBuffer(lpDS2, &sound_buffer, &lpDSB2, NULL);
-    if (FAILED(hr)) {
-       write_log ("AHI: CreateSoundBuffer() failure: %s\n", DXError(hr));
+    if (FAILED (hr)) {
+       write_log ("AHI: CreateSoundBuffer() failure: %s\n", DXError (hr));
        return 0;
     }
 
@@ -385,8 +390,6 @@ static int ahi_init_sound_win32 (void)
     ahisndbufpt =(int*)ahisndbuffer;
     sndptrmax = ahisndbuffer + ahisndbufsize;
     memset(ahisndbuffer,  soundneutral, amigablksize * 8);
-    write_log ("AHI: Init AHI Sound Rate %d, Channels %d, Bits %d, Buffsize %d\n",
-       sound_freq_ahi, sound_channels_ahi, sound_bits_ahi, amigablksize);
     ahi_on = 1;
     return sound_freq_ahi;
 }
index b5a53f5d3d0ab9e7134cd9cf993101dc06d1faa4..3427c08f099c7c4918542ca0230a4be3987b75fe 100755 (executable)
@@ -817,6 +817,7 @@ void DirectDraw_Release (void)
 {
     if (!dxdata.ddinit)
        return;
+    dxdata.islost = 0;
     dxdata.ddinit = 0;
     freemainsurface ();
     if (dxdata.fsmodeset)
@@ -834,6 +835,7 @@ int DirectDraw_Start (GUID *guid)
     LPDIRECT3D9 d3d;
     D3DCAPS9 d3dCaps;
 
+    dxdata.islost = 0;
     if (dxdata.ddinit) {
        if (guid == NULL && dxdata.ddzeroguid)
            return -1;
@@ -885,3 +887,20 @@ int DirectDraw_Start (GUID *guid)
     DirectDraw_Release();
     return 0;
 }
+
+int dx_islost (void)
+{
+    return dxdata.islost;
+}
+
+void dx_check (void)
+{
+    dxdata.islost = 0;
+    if (dxdata.fsmodeset == 0)
+       return;
+    if (IDirectDrawSurface7_IsLost (dxdata.primary) != DDERR_SURFACELOST)
+       return;
+    if (IDirectDrawSurface7_Restore (dxdata.primary) != DDERR_WRONGMODE)
+       return;
+    dxdata.islost = 1;
+}
index 55e22da3b368b68e281f3b3e15eaf95d8a49e1b8..515e071092957c91717f7754704e5452dd306b89 100755 (executable)
@@ -26,6 +26,7 @@ struct ddstuff
     HWND hwnd;
     int maxwidth, maxheight;
     uae_u32 colorkey;
+    int islost;
 
     LPDIRECTDRAWSURFACE7 cursorsurface1;
     LPDIRECTDRAWSURFACE7 cursorsurface2;
@@ -122,6 +123,8 @@ HRESULT DirectDraw_SetPaletteEntries (int start, int count, PALETTEENTRY *palett
 HRESULT DirectDraw_SetPalette (int remove);
 HRESULT DirectDraw_CreatePalette (LPPALETTEENTRY pal);
 
+void dx_check (void);
+int dx_islost (void);
 
 #define DDFORCED_NONLOCAL 0
 #define DDFORCED_DEFAULT 1
index 4a4afb57e010da0ed7e60d742b0930fc065bbd84..5d1e633eaa12509f043c0c90e56d8c16eefb47b7 100755 (executable)
@@ -540,32 +540,62 @@ void *shmat (int shmid, void *shmaddr, int shmflg)
            shmids[shmid].attached = result;
            return result;
        }
+       if(!strcmp(shmids[shmid].name,"custmem1")) {
+           shmaddr=natmem_offset + currprefs.custom_memory_addrs[0];
+           got = TRUE;
+       }
+       if(!strcmp(shmids[shmid].name,"custmem2")) {
+           shmaddr=natmem_offset + currprefs.custom_memory_addrs[1];
+           got = TRUE;
+       }
+
        if(!strcmp(shmids[shmid].name,"hrtmon")) {
            shmaddr=natmem_offset + 0x00a10000;
            got = TRUE;
        }
        if(!strcmp(shmids[shmid].name,"arhrtmon")) {
            shmaddr=natmem_offset + 0x00800000;
+           size += BARRIER;
            got = TRUE;
        }
-       if(!strcmp(shmids[shmid].name,"superiv")) {
-           shmaddr=natmem_offset + 0x00d00000;
+       if(!strcmp(shmids[shmid].name,"xpower_e2")) {
+           shmaddr=natmem_offset + 0x00e20000;
+           size += BARRIER;
            got = TRUE;
        }
-       if(!strcmp(shmids[shmid].name,"superiv_2")) {
-           shmaddr=natmem_offset + 0x00b00000;
+       if(!strcmp(shmids[shmid].name,"xpower_f2")) {
+           shmaddr=natmem_offset + 0x00f20000;
+           size += BARRIER;
            got = TRUE;
        }
-       if(!strcmp(shmids[shmid].name,"superiv_3")) {
-           shmaddr=natmem_offset + 0x00e00000;
+       if(!strcmp(shmids[shmid].name,"nordic_f0")) {
+           shmaddr=natmem_offset + 0x00f00000;
+           size += BARRIER;
            got = TRUE;
        }
-       if(!strcmp(shmids[shmid].name,"custmem1")) {
-           shmaddr=natmem_offset + currprefs.custom_memory_addrs[0];
+       if(!strcmp(shmids[shmid].name,"nordic_f4")) {
+           shmaddr=natmem_offset + 0x00f40000;
+           size += BARRIER;
            got = TRUE;
        }
-       if(!strcmp(shmids[shmid].name,"custmem2")) {
-           shmaddr=natmem_offset + currprefs.custom_memory_addrs[1];
+       if(!strcmp(shmids[shmid].name,"nordic_f6")) {
+           shmaddr=natmem_offset + 0x00f60000;
+           size += BARRIER;
+           got = TRUE;
+       }
+       if(!strcmp(shmids[shmid].name,"superiv_b0")) {
+           shmaddr=natmem_offset + 0x00b00000;
+           size += BARRIER;
+           got = TRUE;
+       }
+       if(!strcmp(shmids[shmid].name,"superiv_d0")) {
+           shmaddr=natmem_offset + 0x00d00000;
+           size += BARRIER;
+           got = TRUE;
+       }
+       if(!strcmp(shmids[shmid].name,"superiv_e0")) {
+           shmaddr=natmem_offset + 0x00e00000;
+           size += BARRIER;
            got = TRUE;
        }
 }
@@ -597,13 +627,13 @@ int shmdt (const void *shmaddr)
     return 0;
 }
 
-int shmget (key_t key, size_t size, int shmflg, char *name)
+int shmget (key_t key, size_t size, int shmflg, const char *name)
 {
     int result = -1;
 
-    if((key == IPC_PRIVATE) || ((shmflg & IPC_CREAT) && (find_shmkey(key) == -1))) {
+    if((key == IPC_PRIVATE) || ((shmflg & IPC_CREAT) && (find_shmkey (key) == -1))) {
        write_log ("shmget of size %d (%dk) for %s\n", size, size >> 10, name);
-       if ((result = get_next_shmkey()) != -1) {
+       if ((result = get_next_shmkey ()) != -1) {
            shmids[result].size = size;
            strcpy(shmids[result].name, name);
        } else {
@@ -618,7 +648,7 @@ int shmctl (int shmid, int cmd, struct shmid_ds *buf)
     int result = -1;
 
     if ((find_shmkey (shmid) != -1) && buf) {
-       switch(cmd)
+       switch (cmd)
        {
            case IPC_STAT:
                *buf = shmids[shmid];
index b6684d963fc267f955e50646054bee5763edf071..e4e44780b1a46cc1927763a240b2088bf540e42d 100755 (executable)
@@ -121,13 +121,14 @@ static LPDIRECTDRAWSURFACE7 p96surface;
 static int cursorwidth, cursorheight, cursorok;
 static uae_u32 cursorrgb[4], cursorrgbn[4];
 static int reloadcursor, cursorvisible, cursordeactivate;
-static uaecptr cursorbi;
+static uaecptr boardinfo;
 
 
 static uaecptr uaegfx_resname,
     uaegfx_resid,
     uaegfx_init,
-    uaegfx_base;
+    uaegfx_base,
+    uaegfx_rom;
 
 typedef enum {
     BLIT_FALSE,
@@ -660,6 +661,8 @@ void picasso_handle_vsync (void)
 
     if (!picasso_on)
        return;
+    if (dx_islost ())
+       return;
 
     framecnt++;
     mouseupdate ();
@@ -726,7 +729,7 @@ static void recursor (void)
     clearsurface (dxdata.cursorsurface2);
     reloadcursor = 1;
     cursorok = FALSE;
-    setspriteimage (cursorbi);
+    setspriteimage (boardinfo);
 }
 
 static void setconvert (void)
@@ -1582,7 +1585,6 @@ static uae_u32 REGPARAM2 picasso_SetSpriteImage (TrapContext *ctx)
 {
     struct regstruct *regs = &ctx->regs;
     uaecptr bi = m68k_areg (regs, 0);
-    cursorbi = bi;
     return setspriteimage (bi);
 }
 
@@ -1637,6 +1639,7 @@ static uae_u32 REGPARAM2 picasso_FindCard (TrapContext *ctx)
     if (!uaegfx_base)
        return 0;
     put_long (uaegfx_base + CARD_BOARDINFO, AmigaBoardInfo);
+    boardinfo = AmigaBoardInfo;
 #endif
     if (allocated_gfxmem && !picasso96_state.CardFound) {
        /* Fill in MemoryBase, MemorySize */
@@ -1795,6 +1798,25 @@ static void CopyLibResolutionStructureU2A (struct LibResolution *libres, uaecptr
     put_long (amigamemptr + PSSO_LibResolution_BoardInfo, libres->BoardInfo);
 }
 
+static void init_alloc (void)
+{
+    SYSTEM_INFO si;
+
+    picasso96_amem = picasso96_amemend = 0;
+    if (uaegfx_base) {
+       int size = get_long (uaegfx_base + CARD_RESLISTSIZE);
+       picasso96_amem = get_long (uaegfx_base + CARD_RESLIST);
+       picasso96_amemend = picasso96_amem + size;
+       write_log("P96 RESINFO: %08X-%08X (%d,%d)\n", picasso96_amem, picasso96_amemend, size / PSSO_ModeInfo_sizeof, size);
+    }
+    xfree (gwwbuf);
+    GetSystemInfo (&si);
+    gwwpagesize = si.dwPageSize;
+    gwwbufsize = allocated_gfxmem / gwwpagesize + 1;
+    gwwpagemask = gwwpagesize - 1;
+    gwwbuf = xmalloc (gwwbufsize * sizeof (void*));
+}
+
 static int p96depth (int depth)
 {
     uae_u32 f = currprefs.picasso96_modeflags;
@@ -1822,7 +1844,6 @@ void picasso96_alloc (TrapContext *ctx)
 {
     int i, j, size, cnt;
     int misscnt, depths;
-    SYSTEM_INFO si;
 
     uaegfx_resname = ds ("uaegfx.card");
     xfree (newmodes);
@@ -1929,12 +1950,8 @@ void picasso96_alloc (TrapContext *ctx)
     ShowSupportedResolutions ();
 #endif
 #ifdef UAEGFX_INTERNAL
-    picasso96_amem = 0;
-    if (uaegfx_card_install (ctx, size)) {
-       picasso96_amem = get_long (uaegfx_base + CARD_RESLIST);
-       picasso96_amemend = picasso96_amem + size;
-       write_log("P96 RESINFO: %08X-%08X (%d,%d)\n", picasso96_amem, picasso96_amemend, cnt, size);
-    }
+    uaegfx_card_install (ctx, size);
+    init_alloc ();
 #else
     m68k_dreg (&ctx->regs, 0) = size;
     m68k_dreg (&ctx->regs, 1) = 65536 + 1;
@@ -1952,12 +1969,6 @@ void picasso96_alloc (TrapContext *ctx)
     }
 #endif
 
-    xfree (gwwbuf);
-    GetSystemInfo (&si);
-    gwwpagesize = si.dwPageSize;
-    gwwbufsize = allocated_gfxmem / gwwpagesize + 1;
-    gwwpagemask = gwwpagesize - 1;
-    gwwbuf = xmalloc (gwwbufsize * sizeof (void*));
 }
 
 #ifndef UAEGFX_INTERNAL
@@ -2012,7 +2023,7 @@ static void uaegfxversion (uaecptr bi)
 }
 #endif
 
-static void inituaegfxfuncs (uaecptr ABI);
+static uaecptr inituaegfxfuncs (uaecptr start, uaecptr ABI);
 static void inituaegfx (uaecptr ABI)
 {
     uae_u32 flags;
@@ -2083,7 +2094,7 @@ static void inituaegfx (uaecptr ABI)
     put_word (ABI + PSSO_BoardInfo_MaxVerResolution + 6, truecolour.height);
     put_word (ABI + PSSO_BoardInfo_MaxVerResolution + 8, alphacolour.height);
 #ifdef UAEGFX_INTERNAL
-    inituaegfxfuncs (ABI);
+    inituaegfxfuncs (uaegfx_rom, ABI);
 #endif
 }
 
@@ -3646,7 +3657,7 @@ static void flushpixels (void)
            full_refresh = 1;
            if (picasso_palette ()) {
                reloadcursor = 1;
-               setspriteimage (cursorbi);
+               setspriteimage (boardinfo);
            }
            for (i = 0; i < gwwcnt; i++)
                gwwbuf[i] = src_start + i * gwwpagesize;
@@ -3844,76 +3855,16 @@ void InitPicasso96 (void)
     }
 }
 
-uae_u8 *restore_p96 (uae_u8 *src)
-{
-    uae_u32 flags;
-    if (restore_u32 () != 1)
-       return src;
-    InitPicasso96();
-    flags = restore_u32();
-    picasso_requested_on = !!(flags & 1);
-    picasso96_state.SwitchState = picasso_requested_on;
-    picasso_on = 0;
-    init_picasso_screen_called = 0;
-    set_gc_called = !!(flags & 2);
-    set_panning_called = !!(flags & 4);
-    changed_prefs.gfxmem_size = restore_u32();
-    picasso96_state.Address = restore_u32();
-    picasso96_state.RGBFormat = restore_u32();
-    picasso96_state.Width = restore_u16();
-    picasso96_state.Height = restore_u16();
-    picasso96_state.VirtualWidth = restore_u16();
-    picasso96_state.VirtualHeight = restore_u16();
-    picasso96_state.XOffset = restore_u16();
-    picasso96_state.YOffset = restore_u16();
-    picasso96_state.GC_Depth = restore_u8();
-    picasso96_state.GC_Flags = restore_u8();
-    picasso96_state.BytesPerRow = restore_u16();
-    picasso96_state.BytesPerPixel = restore_u8();
-    picasso96_state.HostAddress = NULL;
-    picasso_SetPanningInit();
-    picasso96_state.Extent = picasso96_state.Address + picasso96_state.BytesPerRow * picasso96_state.VirtualHeight;
-    if (set_gc_called) {
-       init_picasso_screen ();
-       init_hz_p96 ();
-    }
-    return src;
-}
-
-uae_u8 *save_p96 (int *len, uae_u8 *dstptr)
-{
-    uae_u8 *dstbak, *dst;
-
-    if (currprefs.gfxmem_size == 0)
-       return NULL;
-    if (dstptr)
-       dstbak = dst = dstptr;
-    else
-       dstbak = dst = malloc (1000);
-    save_u32 (1);
-    save_u32 ((picasso_on ? 1 : 0) | (set_gc_called ? 2 : 0) | (set_panning_called ? 4 : 0));
-    save_u32 (currprefs.gfxmem_size);
-    save_u32 (picasso96_state.Address);
-    save_u32 (picasso96_state.RGBFormat);
-    save_u16 (picasso96_state.Width);
-    save_u16 (picasso96_state.Height);
-    save_u16 (picasso96_state.VirtualWidth);
-    save_u16 (picasso96_state.VirtualHeight);
-    save_u16 (picasso96_state.XOffset);
-    save_u16 (picasso96_state.YOffset);
-    save_u8 (picasso96_state.GC_Depth);
-    save_u8 (picasso96_state.GC_Flags);
-    save_u16 (picasso96_state.BytesPerRow);
-    save_u8 (picasso96_state.BytesPerPixel);
-    *len = dst - dstbak;
-    return dstbak;
-}
-
 #endif
 
 #ifdef UAEGFX_INTERNAL
-#define RTGCALL(ABI,func,funcdef,call) \
-    put_long (ABI + func, here ()); \
+
+#define PUTABI(func) \
+    if (ABI) \
+       put_long (ABI + func, here ());
+
+#define RTGCALL(func,funcdef,call) \
+    PUTABI (func); \
     dl (0x48e78000); \
     calltrap (deftrap (call)); \
     dw (0x4a80); \
@@ -3923,23 +3874,28 @@ uae_u8 *save_p96 (int *len, uae_u8 *dstptr)
     dw (funcdef); \
     dw (RTS);
 
-#define RTGCALL2(ABI,func,call) \
-    put_long (ABI + func, here ()); \
+#define RTGCALL2(func,call) \
+    PUTABI (func); \
     calltrap (deftrap (call)); \
     dw (RTS);
 
-#define RTGCALLDEFAULT(ABI,func,funcdef) \
-    put_long (ABI + func, here ()); \
+#define RTGCALLDEFAULT(func,funcdef) \
+    PUTABI (func); \
     dw (0x2f28); \
     dw (funcdef); \
     dw (RTS);
 
-#define RTGNONE(ABI,func) \
-    put_long (ABI + func, start);
+#define RTGNONE(func) \
+    if (ABI) \
+       put_long (ABI + func, start);
 
-static void inituaegfxfuncs (uaecptr ABI)
+
+static uaecptr inituaegfxfuncs (uaecptr start, uaecptr ABI)
 {
-    uaecptr start = here ();
+    uaecptr old = here ();
+    uaecptr ptr;
+
+    org (start);
 
     dw (RTS);
     /* ResolvePixelClock
@@ -3949,7 +3905,7 @@ static void inituaegfxfuncs (uaecptr ABI)
        move.b  #14,gmi_Denominator(a1) ; whatever
        rts
     */
-    put_long (ABI + PSSO_BoardInfo_ResolvePixelClock, here ());
+    PUTABI (PSSO_BoardInfo_ResolvePixelClock);
     dl (0x2340002c);
     dw (0x7000);
     dl (0x137c0062); dw (0x002a);
@@ -3960,7 +3916,7 @@ static void inituaegfxfuncs (uaecptr ABI)
        move.l #CLOCK,D0 ; fill in D0 with our one true pixel clock
        rts
     */
-    put_long (ABI + PSSO_BoardInfo_GetPixelClock, here ());
+    PUTABI (PSSO_BoardInfo_GetPixelClock);
     dw (0x203c);
     dl (100227260);
     dw (RTS);
@@ -3970,7 +3926,7 @@ static void inituaegfxfuncs (uaecptr ABI)
        move.l  a1,d0
        rts
     */
-    put_long (ABI + PSSO_BoardInfo_CalculateMemory, here ());
+    PUTABI (PSSO_BoardInfo_CalculateMemory);
     dw (0x2009);
     dw (RTS);
 
@@ -3979,13 +3935,13 @@ static void inituaegfxfuncs (uaecptr ABI)
        move.l  #~RGBFF_PLANAR,d0
        rts
     */
-    put_long (ABI + PSSO_BoardInfo_GetCompatibleFormats, here ());
+    PUTABI (PSSO_BoardInfo_GetCompatibleFormats);
     dw (0x203c);
     dl (0xfffffffe);
     dw (RTS);
 
     /* CalculateBytesPerRow (optimized) */
-    put_long (ABI + PSSO_BoardInfo_CalculateBytesPerRow, here ());
+    PUTABI (PSSO_BoardInfo_CalculateBytesPerRow);
     dl (0x0c400140); // cmp.w #320,d0
     dw (0x6504); // bcs.s .l1
     calltrap (deftrap (picasso_CalculateBytesPerRow));
@@ -4006,47 +3962,58 @@ static void inituaegfxfuncs (uaecptr ABI)
     dl (0x02020101);
     dl (0x01010100);
 
-    RTGNONE(ABI, PSSO_BoardInfo_SetClock);
-    RTGNONE(ABI, PSSO_BoardInfo_SetMemoryMode);
-    RTGNONE(ABI, PSSO_BoardInfo_SetWriteMask);
-    RTGNONE(ABI, PSSO_BoardInfo_SetClearMask);
-    RTGNONE(ABI, PSSO_BoardInfo_SetReadPlane);
+    RTGNONE(PSSO_BoardInfo_SetClock);
+    RTGNONE(PSSO_BoardInfo_SetMemoryMode);
+    RTGNONE(PSSO_BoardInfo_SetWriteMask);
+    RTGNONE(PSSO_BoardInfo_SetClearMask);
+    RTGNONE(PSSO_BoardInfo_SetReadPlane);
 
-    RTGNONE(ABI, PSSO_BoardInfo_WaitVerticalSync); /* FIXME */
-    RTGNONE(ABI, PSSO_BoardInfo_WaitBlitter);
+    RTGNONE(PSSO_BoardInfo_WaitVerticalSync); /* FIXME */
+    RTGNONE(PSSO_BoardInfo_WaitBlitter);
 
 #if 0
-    RTGCALL2(ABI, PSSO_BoardInfo_, picasso_);
-    RTGCALL(ABI, PSSO_BoardInfo_, PSSO_BoardInfo_Default, picasso_);
-    RTGCALLDEFAULT(ABI, PSSO_BoardInfo_, PSSO_BoardInfo_Default);
+    RTGCALL2(PSSO_BoardInfo_, picasso_);
+    RTGCALL(PSSO_BoardInfo_, PSSO_BoardInfo_Default, picasso_);
+    RTGCALLDEFAULT(PSSO_BoardInfo_, PSSO_BoardInfo_Default);
 #endif
 
-    RTGCALL(ABI, PSSO_BoardInfo_BlitPlanar2Direct, PSSO_BoardInfo_BlitPlanar2DirectDefault, picasso_BlitPlanar2Direct);
-    RTGCALL(ABI, PSSO_BoardInfo_FillRect, PSSO_BoardInfo_FillRectDefault, picasso_FillRect);
-    RTGCALL(ABI, PSSO_BoardInfo_BlitRect, PSSO_BoardInfo_BlitRectDefault, picasso_BlitRect);
-    RTGCALL(ABI, PSSO_BoardInfo_BlitPlanar2Chunky, PSSO_BoardInfo_BlitPlanar2ChunkyDefault, picasso_BlitPlanar2Chunky);
-    RTGCALL(ABI, PSSO_BoardInfo_BlitTemplate, PSSO_BoardInfo_BlitTemplateDefault, picasso_BlitTemplate);
-    RTGCALL(ABI, PSSO_BoardInfo_InvertRect, PSSO_BoardInfo_InvertRectDefault, picasso_InvertRect);
-    RTGCALL(ABI, PSSO_BoardInfo_BlitRectNoMaskComplete, PSSO_BoardInfo_BlitRectNoMaskCompleteDefault, picasso_BlitRectNoMaskComplete);
-    RTGCALL(ABI, PSSO_BoardInfo_BlitPattern, PSSO_BoardInfo_BlitPatternDefault, picasso_BlitPattern);
-
-    RTGCALL2(ABI, PSSO_BoardInfo_SetSwitch, picasso_SetSwitch);
-    RTGCALL2(ABI, PSSO_BoardInfo_SetColorArray, picasso_SetColorArray);
-    RTGCALL2(ABI, PSSO_BoardInfo_SetDAC, picasso_SetDAC);
-    RTGCALL2(ABI, PSSO_BoardInfo_SetGC, picasso_SetGC);
-    RTGCALL2(ABI, PSSO_BoardInfo_SetPanning, picasso_SetPanning);
-    RTGCALL2(ABI, PSSO_BoardInfo_SetDisplay, picasso_SetDisplay);
-
-    RTGCALL2(ABI, PSSO_BoardInfo_SetSprite, picasso_SetSprite);
-    RTGCALL2(ABI, PSSO_BoardInfo_SetSpritePosition, picasso_SetSpritePosition);
-    RTGCALL2(ABI, PSSO_BoardInfo_SetSpriteImage, picasso_SetSpriteImage);
-    RTGCALL2(ABI, PSSO_BoardInfo_SetSpriteColor, picasso_SetSpriteColor);
-
-    RTGCALLDEFAULT(ABI, PSSO_BoardInfo_ScrollPlanar, PSSO_BoardInfo_ScrollPlanarDefault);
-    RTGCALLDEFAULT(ABI, PSSO_BoardInfo_UpdatePlanar, PSSO_BoardInfo_UpdatePlanarDefault);
-    RTGCALLDEFAULT(ABI, PSSO_BoardInfo_DrawLine, PSSO_BoardInfo_DrawLineDefault);
+    RTGCALL(PSSO_BoardInfo_BlitPlanar2Direct, PSSO_BoardInfo_BlitPlanar2DirectDefault, picasso_BlitPlanar2Direct);
+    RTGCALL(PSSO_BoardInfo_FillRect, PSSO_BoardInfo_FillRectDefault, picasso_FillRect);
+    RTGCALL(PSSO_BoardInfo_BlitRect, PSSO_BoardInfo_BlitRectDefault, picasso_BlitRect);
+    RTGCALL(PSSO_BoardInfo_BlitPlanar2Chunky, PSSO_BoardInfo_BlitPlanar2ChunkyDefault, picasso_BlitPlanar2Chunky);
+    RTGCALL(PSSO_BoardInfo_BlitTemplate, PSSO_BoardInfo_BlitTemplateDefault, picasso_BlitTemplate);
+    RTGCALL(PSSO_BoardInfo_InvertRect, PSSO_BoardInfo_InvertRectDefault, picasso_InvertRect);
+    RTGCALL(PSSO_BoardInfo_BlitRectNoMaskComplete, PSSO_BoardInfo_BlitRectNoMaskCompleteDefault, picasso_BlitRectNoMaskComplete);
+    RTGCALL(PSSO_BoardInfo_BlitPattern, PSSO_BoardInfo_BlitPatternDefault, picasso_BlitPattern);
+
+    RTGCALL2(PSSO_BoardInfo_SetSwitch, picasso_SetSwitch);
+    RTGCALL2(PSSO_BoardInfo_SetColorArray, picasso_SetColorArray);
+    RTGCALL2(PSSO_BoardInfo_SetDAC, picasso_SetDAC);
+    RTGCALL2(PSSO_BoardInfo_SetGC, picasso_SetGC);
+    RTGCALL2(PSSO_BoardInfo_SetPanning, picasso_SetPanning);
+    RTGCALL2(PSSO_BoardInfo_SetDisplay, picasso_SetDisplay);
+
+    RTGCALL2(PSSO_BoardInfo_SetSprite, picasso_SetSprite);
+    RTGCALL2(PSSO_BoardInfo_SetSpritePosition, picasso_SetSpritePosition);
+    RTGCALL2(PSSO_BoardInfo_SetSpriteImage, picasso_SetSpriteImage);
+    RTGCALL2(PSSO_BoardInfo_SetSpriteColor, picasso_SetSpriteColor);
+
+    RTGCALLDEFAULT(PSSO_BoardInfo_ScrollPlanar, PSSO_BoardInfo_ScrollPlanarDefault);
+    RTGCALLDEFAULT(PSSO_BoardInfo_UpdatePlanar, PSSO_BoardInfo_UpdatePlanarDefault);
+    RTGCALLDEFAULT(PSSO_BoardInfo_DrawLine, PSSO_BoardInfo_DrawLineDefault);
 
     write_log ("uaegfx.card magic code: %08X-%08X\n", start, here ());
+
+    ptr = here ();
+    org (old);
+    return ptr;
+}
+
+void uaegfx_install_code (void)
+{
+    uaecptr start = here ();
+    uaegfx_rom = start;
+    org (inituaegfxfuncs (start, 0));
 }
 
 #define UAEGFX_VERSION 3
@@ -4125,6 +4092,7 @@ static uaecptr uaegfx_card_install (TrapContext *ctx, uae_u32 extrasize)
     put_long (uaegfx_base + CARD_EXECBASE, exec);
     put_long (uaegfx_base + CARD_NAME, uaegfx_resname);
     put_long (uaegfx_base + CARD_RESLIST, uaegfx_base + CARD_SIZEOF);
+    put_long (uaegfx_base + CARD_RESLISTSIZE, extrasize);
 
     write_log ("uaegfx.card %d.%d init @%08X\n", UAEGFX_VERSION, UAEGFX_REVISION, uaegfx_base);
     return uaegfx_base;
@@ -4164,6 +4132,95 @@ uae_u32 picasso_demux (uae_u32 arg, TrapContext *context)
 }
 #endif
 
+void restore_p96_finish (void)
+{
+    init_alloc ();
+    if (uaegfx_rom && boardinfo)
+       inituaegfxfuncs (uaegfx_rom, boardinfo);
+    if (set_gc_called) {
+       init_picasso_screen ();
+       init_hz_p96 ();
+    }
+}
+
+uae_u8 *restore_p96 (uae_u8 *src)
+{
+    uae_u32 flags;
+    int i;
+
+    if (restore_u32 () != 2)
+       return src;
+    InitPicasso96 ();
+    flags = restore_u32 ();
+    picasso_requested_on = !!(flags & 1);
+    hwsprite = !!(flags & 8);
+    cursorvisible = !!(flags & 16);
+    picasso96_state.SwitchState = picasso_requested_on;
+    picasso_on = 0;
+    init_picasso_screen_called = 0;
+    set_gc_called = !!(flags & 2);
+    set_panning_called = !!(flags & 4);
+    changed_prefs.gfxmem_size = restore_u32 ();
+    picasso96_state.Address = restore_u32 ();
+    picasso96_state.RGBFormat = restore_u32 ();
+    picasso96_state.Width = restore_u16 ();
+    picasso96_state.Height = restore_u16 ();
+    picasso96_state.VirtualWidth = restore_u16 ();
+    picasso96_state.VirtualHeight = restore_u16 ();
+    picasso96_state.XOffset = restore_u16 ();
+    picasso96_state.YOffset = restore_u16 ();
+    picasso96_state.GC_Depth = restore_u8 ();
+    picasso96_state.GC_Flags = restore_u8 ();
+    picasso96_state.BytesPerRow = restore_u16 ();
+    picasso96_state.BytesPerPixel = restore_u8 ();
+    uaegfx_base = restore_u32 ();
+    uaegfx_rom = restore_u32 ();
+    boardinfo = restore_u32 ();
+    for (i = 0; i < 4; i++)
+       cursorrgb[i] = restore_u32 ();
+    picasso96_state.HostAddress = NULL;
+    picasso_SetPanningInit();
+    picasso96_state.Extent = picasso96_state.Address + picasso96_state.BytesPerRow * picasso96_state.VirtualHeight;
+    return src;
+}
+
+uae_u8 *save_p96 (int *len, uae_u8 *dstptr)
+{
+    uae_u8 *dstbak, *dst;
+    int i;
+
+    if (currprefs.gfxmem_size == 0)
+       return NULL;
+    if (dstptr)
+       dstbak = dst = dstptr;
+    else
+       dstbak = dst = malloc (1000);
+    save_u32 (2);
+    save_u32 ((picasso_on ? 1 : 0) | (set_gc_called ? 2 : 0) | (set_panning_called ? 4 : 0) |
+       (hwsprite ? 8 : 0) | (cursorvisible ? 16 : 0));
+    save_u32 (currprefs.gfxmem_size);
+    save_u32 (picasso96_state.Address);
+    save_u32 (picasso96_state.RGBFormat);
+    save_u16 (picasso96_state.Width);
+    save_u16 (picasso96_state.Height);
+    save_u16 (picasso96_state.VirtualWidth);
+    save_u16 (picasso96_state.VirtualHeight);
+    save_u16 (picasso96_state.XOffset);
+    save_u16 (picasso96_state.YOffset);
+    save_u8 (picasso96_state.GC_Depth);
+    save_u8 (picasso96_state.GC_Flags);
+    save_u16 (picasso96_state.BytesPerRow);
+    save_u8 (picasso96_state.BytesPerPixel);
+    save_u32 (uaegfx_base);
+    save_u32 (uaegfx_rom);
+    save_u32 (boardinfo);
+    for (i = 0; i < 4; i++)
+       save_u32 (cursorrgb[i]);
+    *len = dst - dstbak;
+    return dstbak;
+}
+
+
 #endif
 
 
index 441ca55502f1c8d44d22926b059c29e46d06c5e3..5a8646115628560894b9ce1d0d4921d4dd0bb301 100755 (executable)
@@ -582,14 +582,16 @@ extern int p96hsync_counter;
 
 #define LIB_SIZE 34
 #define CARD_FLAGS LIB_SIZE
-#define CARD_EXECBASE CARD_FLAGS + 2
-#define CARD_EXPANSIONBASE CARD_EXECBASE + 4
-#define CARD_SEGMENTLIST CARD_EXPANSIONBASE + 4
-#define CARD_NAME CARD_SEGMENTLIST + 4
+#define CARD_EXECBASE (CARD_FLAGS + 2)
+#define CARD_EXPANSIONBASE (CARD_EXECBASE + 4)
+#define CARD_SEGMENTLIST (CARD_EXPANSIONBASE + 4)
+#define CARD_NAME (CARD_SEGMENTLIST + 4)
 /* uae specific stuff */
-#define CARD_RESLIST CARD_NAME + 4
-#define CARD_BOARDINFO CARD_RESLIST + 4
-#define CARD_SIZEOF CARD_BOARDINFO + 4
+#define CARD_RESLIST (CARD_NAME + 4)
+#define CARD_RESLISTSIZE (CARD_RESLIST + 4)
+#define CARD_BOARDINFO (CARD_RESLISTSIZE + 4)
+#define CARD_END (CARD_BOARDINFO + 4)
+#define CARD_SIZEOF CARD_END
 
 #endif
 
index fee4ced1607dcb910678253927eea78c70a410db..534476b88b548d7b6afe334d8ad2fc7873fd4440 100755 (executable)
@@ -31,7 +31,7 @@ struct shmid_ds {
 int mprotect (void *addr, size_t len, int prot);
 void *shmat (int shmid, LPVOID shmaddr, int shmflg);
 int shmdt (const void *shmaddr);
-int shmget (key_t key, size_t size, int shmflg, char*);
+int shmget (key_t key, size_t size, int shmflg, const char*);
 int shmctl (int shmid, int cmd, struct shmid_ds *buf);
 int init_shm (void);
 
index b05ed31863fb6de6969cca275b425be3640bfe28..53efd59339e108061ec1d258901982e5db0a3c87 100755 (executable)
@@ -86,6 +86,7 @@ static DWORD minidumpmode = MiniDumpNormal;
 
 int qpcdivisor = 0;
 int cpu_mmx = 1;
+static int userdtsc = 0;
 
 HINSTANCE hInst = NULL;
 HMODULE hUIDLL = NULL;
@@ -187,7 +188,7 @@ void sleep_millis (int ms)
     idletime += read_processor_time () - start;
 }
 
-frame_time_t read_processor_time (void)
+frame_time_t read_processor_time_qpf (void)
 {
     LARGE_INTEGER counter;
     QueryPerformanceCounter (&counter);
@@ -195,8 +196,80 @@ frame_time_t read_processor_time (void)
        return (frame_time_t)(counter.LowPart);
     return (frame_time_t)(counter.QuadPart >> qpcdivisor);
 }
+frame_time_t read_processor_time_rdtsc (void)
+{
+    frame_time_t foo = 0;
+#if defined(X86_MSVC_ASSEMBLY)
+    frame_time_t bar;
+    __asm
+    {
+        rdtsc
+        mov foo, eax
+        mov bar, edx
+    }
+    /* very high speed CPU's RDTSC might overflow without this.. */
+    foo >>= 6;
+    foo |= bar << 26;
+#endif
+    return foo;
+}
+frame_time_t read_processor_time (void)
+{
+    if (userdtsc)
+       return read_processor_time_rdtsc ();
+    else
+       return read_processor_time_qpf ();
+}
 
-static void figure_processor_speed (void)
+#include <process.h>
+static volatile int dummythread_die;
+static void dummythread (void *dummy)
+{
+    SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_LOWEST);
+    while (!dummythread_die);
+}
+static uae_u64 win32_read_processor_time (void)
+{
+#if defined(X86_MSVC_ASSEMBLY)
+    uae_u32 foo, bar;
+    __asm
+    {
+       cpuid
+       rdtsc
+       mov foo, eax
+       mov bar, edx
+    }
+    return (((uae_u64)bar) << 32) | foo;
+#else
+    return 0;
+#endif
+}
+static void figure_processor_speed_rdtsc (void)
+{
+    static int freqset;
+    uae_u64 clockrate;
+    int oldpri;
+    HANDLE th;
+
+    if (freqset)
+       return;
+    th = GetCurrentThread ();
+    freqset = 1;
+    oldpri = GetThreadPriority (th);
+    SetThreadPriority (th, THREAD_PRIORITY_HIGHEST);
+    dummythread_die = -1;
+    _beginthread (&dummythread, 0, 0);
+    sleep_millis (500);
+    clockrate = win32_read_processor_time ();
+    sleep_millis (500);
+    clockrate = (win32_read_processor_time () - clockrate) * 2;
+    dummythread_die = 0;
+    SetThreadPriority (th, oldpri);
+    write_log ("CLOCKFREQ: RDTSC %.2fMHz\n", clockrate / 1000000.0);
+    syncbase = clockrate >> 6;
+}
+
+static void figure_processor_speed_qpf (void)
 {
     LARGE_INTEGER freq;
     static LARGE_INTEGER freq2;
@@ -219,6 +292,16 @@ static void figure_processor_speed (void)
     syncbase = (unsigned long)qpfrate;
 }
 
+static void figure_processor_speed (void)
+{
+    if (SystemInfo.dwNumberOfProcessors > 1)
+       userdtsc = 0;
+    if (userdtsc)
+       figure_processor_speed_rdtsc ();
+    if (!userdtsc)
+       figure_processor_speed_qpf ();
+}
+
 static void setcursor(int oldx, int oldy)
 {
     int x = (amigawin_rect.right - amigawin_rect.left) / 2;
@@ -565,18 +648,21 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
     case WM_SETFOCUS:
         winuae_active (hWnd, minimized);
         minimized = 0;
+       dx_check ();
        return 0;
     case WM_ACTIVATE:
         if (LOWORD (wParam) == WA_INACTIVE) {
            minimized = HIWORD (wParam) ? 1 : 0;
            winuae_inactive (hWnd, minimized);
        }
+       dx_check ();
        return 0;
-#ifdef RETROPLATFORM
     case WM_ACTIVATEAPP:
+#ifdef RETROPLATFORM
        rp_activate (wParam, lParam);
-       return 0;
 #endif
+       dx_check ();
+       return 0;
 
     case WM_PALETTECHANGED:
        if ((HWND)wParam != hWnd)
@@ -1195,7 +1281,7 @@ void handle_events (void)
     if (cnt <= 0) {
        figure_processor_speed ();
        flush_log ();
-       cnt = 50 * 10;
+       cnt = 50 * 5;
     }
 }
 
@@ -2282,10 +2368,10 @@ static void WIN32_HandleRegistryStuff(void)
        if (y < 10)
            y = 10;
         /* Create and initialize all our sub-keys to the default values */
-        regsetint(NULL, "MainPosX", x);
-        regsetint(NULL, "MainPosY", y);
-        regsetint(NULL, "GUIPosX", x);
-        regsetint(NULL, "GUIPosY", y);
+        regsetint (NULL, "MainPosX", x);
+        regsetint (NULL, "MainPosY", y);
+        regsetint (NULL, "GUIPosX", x);
+        regsetint (NULL, "GUIPosY", y);
     }
     size = sizeof (version);
     if (regquerystr (NULL, "Version", version, &size)) {
@@ -2297,9 +2383,9 @@ static void WIN32_HandleRegistryStuff(void)
     size = sizeof (version);
     if (regquerystr (NULL, "ROMCheckVersion", version, &size)) {
         if (checkversion (version)) {
-       if (regsetstr (NULL, "ROMCheckVersion", VersionStr))
-           forceroms = 1;
-        }
+           if (regsetstr (NULL, "ROMCheckVersion", VersionStr))
+               forceroms = 1;
+       }
     } else {
         if (regsetstr (NULL, "ROMCheckVersion", VersionStr))
        forceroms = 1;
@@ -2384,14 +2470,14 @@ static int betamessage (void)
 
        dwType = REG_DWORD;
        size = sizeof data;
-       if (hWinUAEKey && RegQueryValueEx(hWinUAEKey, "Beta_Just_Shut_Up", 0, &dwType, (LPBYTE)&data, &size) == ERROR_SUCCESS) {
+       if (hWinUAEKey && RegQueryValueEx (hWinUAEKey, "Beta_Just_Shut_Up", 0, &dwType, (LPBYTE)&data, &size) == ERROR_SUCCESS) {
            if (data == 68000) {
                write_log ("I was told to shut up :(\n");
                return 1;
            }
        }
 
-       _time64(&ltime);
+       _time64 (&ltime);
        t = _gmtime64 (&ltime);
        /* "expire" in 1 month */
        if (MAKEBD(t->tm_year + 1900, t->tm_mon + 1, t->tm_mday) > WINUAEDATE + 100)
@@ -2461,7 +2547,7 @@ static int isadminpriv (void)
 
     // Call GetTokenInformation again to get the group information.
     if (!GetTokenInformation (hToken, TokenGroups, pGroupInfo, dwSize, &dwSize)) {
-       write_log ("GetTokenInformation Error %u\n", GetLastError());
+       write_log ("GetTokenInformation Error %u\n", GetLastError ());
        return FALSE;
     }
 
@@ -2642,8 +2728,8 @@ static void getstartpaths (void)
            strcat (tmp, "WinUAE");
            v = GetFileAttributes (tmp);
            if (v == INVALID_FILE_ATTRIBUTES || (v & FILE_ATTRIBUTE_DIRECTORY)) {
-               strcpy(xstart_path_new1, tmp2);
-               strcat(xstart_path_new1, "WinUAE\\");
+               strcpy (xstart_path_new1, tmp2);
+               strcat (xstart_path_new1, "WinUAE\\");
                strcpy (xstart_path_uae, start_path_exe);
                strcpy (start_path_new1, xstart_path_new1);
                strcat(tmp2, "System");
@@ -2682,7 +2768,7 @@ static void getstartpaths (void)
            if (af_path_2005 & 2) {
                strcpy (tmp, xstart_path_new2);
                strcat (tmp, "system\\rom");
-               if (isfilesindir(tmp))
+               if (isfilesindir (tmp))
                    path_type = PATH_TYPE_AMIGAFOREVERDATA;
                else
                    path_type = PATH_TYPE_NEWWINUAE;
@@ -2812,6 +2898,10 @@ static int process_arg(char **xargv)
                force_direct_catweasel = getval (argv[++i]);
            continue;
        }
+        if (!strcmp (arg, "-forcerdtsc")) {
+           userdtsc = 1;
+           continue;
+       }
 
        if (i + 1 < argc) {
            char *np = argv[i + 1];
@@ -2829,7 +2919,7 @@ static int process_arg(char **xargv)
                i++;
                if (cpu_affinity == 0)
                    cpu_affinity = original_affinity;
-               SetThreadAffinityMask (GetCurrentThread(), cpu_affinity);
+               SetThreadAffinityMask (GetCurrentThread (), cpu_affinity);
                continue;
            }
            if (!strcmp (arg, "-paffinity")) {
@@ -2837,7 +2927,7 @@ static int process_arg(char **xargv)
                i++;
                if (cpu_paffinity == 0)
                    cpu_paffinity = original_affinity;
-               SetProcessAffinityMask (GetCurrentProcess(), cpu_paffinity);
+               SetProcessAffinityMask (GetCurrentProcess (), cpu_paffinity);
                continue;
            }
            if (!strcmp (arg, "-datapath")) {
@@ -2929,9 +3019,9 @@ static int PASCAL WinMain2 (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
     }
 #endif
 
-    if (!osdetect())
+    if (!osdetect ())
        return 0;
-    if (!dxdetect())
+    if (!dxdetect ())
        return 0;
 
     hInst = hInstance;
@@ -2979,7 +3069,7 @@ static int PASCAL WinMain2 (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
        if (betamessage ()) {
            keyboard_settrans ();
 #ifdef CATWEASEL
-           catweasel_init();
+           catweasel_init ();
 #endif
 #ifdef PARALLEL_PORT
            paraport_mask = paraport_init ();
@@ -3057,7 +3147,7 @@ int driveclick_loadresource (struct drvsample *sp, int drivetype)
     ok = 1;
     for (i = 0; drvsampleres[i] >= 0; i += 2) {
        struct drvsample *s = sp + drvsampleres[i + 1];
-       HRSRC res = FindResource (NULL, MAKEINTRESOURCE(drvsampleres[i + 0]), "WAVE");
+       HRSRC res = FindResource (NULL, MAKEINTRESOURCE (drvsampleres[i + 0]), "WAVE");
        if (res != 0) {
            HANDLE h = LoadResource (NULL, res);
            int len = SizeofResource (NULL, res);
@@ -3356,7 +3446,7 @@ void systraymenu (HWND hwnd)
 
 static void LLError(const char *s)
 {
-    DWORD err = GetLastError();
+    DWORD err = GetLastError ();
 
     if (err == ERROR_MOD_NOT_FOUND || err == ERROR_DLL_NOT_FOUND)
        return;
index b4004c62db662cdd3336d197af5a630dc348e285..7b179c72630f015a0db3a5eb01189e94d3ba1468 100755 (executable)
@@ -15,9 +15,9 @@
 #define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100)
 #define GETBDD(x) ((x) % 100)
 
-#define WINUAEBETA 18
+#define WINUAEBETA 19
 #define WINUAEPUBLICBETA 1
-#define WINUAEDATE MAKEBD(2008, 5, 11)
+#define WINUAEDATE MAKEBD(2008, 5, 17)
 #define WINUAEEXTRA ""
 #define WINUAEREV ""
 
index df33dd1000254ee54bc63696f4b196b8b5bb4407..014adb51710e126fe5448c0771ff617580199712 100755 (executable)
@@ -604,6 +604,8 @@ void flush_block (int a, int b)
 
 void flush_screen (int a, int b)
 {
+    if (dx_islost ())
+       return;
     if (currentmode->flags & DM_OPENGL) {
 #ifdef OPENGL
        OGL_render ();
@@ -622,9 +624,9 @@ void flush_screen (int a, int b)
 
 static uae_u8 *ddraw_dolock (void)
 {
-    if (!DirectDraw_SurfaceLock())
+    if (!DirectDraw_SurfaceLock ())
        return 0;
-    gfxvidinfo.bufmem = DirectDraw_GetSurfacePointer();
+    gfxvidinfo.bufmem = DirectDraw_GetSurfacePointer ();
     init_row_map ();
     clear_inhibit_frame (IHF_WINDOWHIDDEN);
     return gfxvidinfo.bufmem;
@@ -643,7 +645,7 @@ int lockscr (void)
     } else if (currentmode->flags & DM_SWSCALE) {
        return 1;
     } else if (currentmode->flags & DM_DDRAW) {
-       return ddraw_dolock() != 0;
+       return ddraw_dolock () != 0;
     }
     return 1;
 }
@@ -663,7 +665,7 @@ void unlockscr (void)
 
 void flush_clear_screen (void)
 {
-    if (WIN32GFX_IsPicassoScreen())
+    if (WIN32GFX_IsPicassoScreen ())
        return;
     if (lockscr ()) {
        int y;
@@ -1182,6 +1184,8 @@ void DX_Invalidate (int x, int y, int width, int height)
 {
     int last, lastx;
 
+    if (width == 0 || height == 0)
+       return;
     if (y < 0 || height < 0) {
        y = 0;
        height = picasso_vidinfo.height;
@@ -2039,6 +2043,8 @@ void updatedisplayarea (void)
        return;
     if (picasso_on)
        return;
+    if (dx_islost ())
+       return;
 #if defined (GFXFILTER)
     if (currentmode->flags & DM_OPENGL) {
 #if defined (OPENGL)
index 32b09196119ce47ef8539b7b88cf7531839bae3d..3b162b8da626cb10a164cb96c030475098085248 100755 (executable)
@@ -616,7 +616,7 @@ static int drag_move (HWND hWnd, LPARAM lParam)
 static HWND cachedlist = NULL;
 
 #define MIN_CHIP_MEM 0
-#define MAX_CHIP_MEM 5
+#define MAX_CHIP_MEM 6
 #define MIN_FAST_MEM 0
 #define MAX_FAST_MEM 4
 #define MIN_SLOW_MEM 0
@@ -6944,7 +6944,7 @@ static void updatehdfinfo (HWND hDlg, int force)
        if (!cyls || !blocks) {
            sprintf (tmp, "%dMB", bsize / (1024 * 1024));
        } else {
-           sprintf (tmp, "%d cyls, %d blocks, %.1fMB/%.1fMB",
+           sprintf (tmp, "%u cyls, %u blocks, %.1fMB/%.1fMB",
                cyls, blocks,
                (double)blocks * 1.0 * current_hfdlg.blocksize / (1024.0 * 1024.0),
                (double)bsize / (1024.0 * 1024.0));
@@ -6962,7 +6962,7 @@ static void hardfileselecthdf (HWND hDlg, char *newpath)
 {
     DiskSelection (hDlg, IDC_PATH_NAME, 2, &workprefs, newpath);
     GetDlgItemText (hDlg, IDC_PATH_NAME, current_hfdlg.filename, sizeof current_hfdlg.filename);
-    inithardfile(hDlg);
+    inithardfile (hDlg);
     hardfile_testrdb (hDlg, &current_hfdlg);
     updatehdfinfo (hDlg, 1);
 }
@@ -6976,7 +6976,7 @@ static void hardfilecreatehdf (HWND hDlg, char *newpath)
     res = SendDlgItemMessage (hDlg, IDC_HF_TYPE, CB_GETCURSEL, 0, 0);
     if (res == 0)
         dostype[0] = 0;
-    CreateHardFile(hDlg, setting, dostype, newpath);
+    CreateHardFile (hDlg, setting, dostype, newpath);
 }
 
 static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -7048,12 +7048,12 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam
                DiskSelection (hDlg, IDC_PATH_FILESYS, 12, &workprefs, 0);
                break;
            case IDOK:
-               if(strlen(current_hfdlg.filename) == 0) {
+               if (strlen (current_hfdlg.filename) == 0) {
                    char szMessage[MAX_DPATH];
                    char szTitle[MAX_DPATH];
-                   WIN32GUI_LoadUIString(IDS_MUSTSELECTFILE, szMessage, MAX_DPATH);
-                   WIN32GUI_LoadUIString(IDS_SETTINGSERROR, szTitle, MAX_DPATH);
-                   MessageBoxhDlg, szMessage, szTitle, MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
+                   WIN32GUI_LoadUIString (IDS_MUSTSELECTFILE, szMessage, MAX_DPATH);
+                   WIN32GUI_LoadUIString (IDS_SETTINGSERROR, szTitle, MAX_DPATH);
+                   MessageBox (hDlg, szMessage, szTitle, MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND);
                    break;
                }
                EndDialog (hDlg, 1);
@@ -7083,11 +7083,11 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam
                break;
        }
 
-       current_hfdlg.sectors   = GetDlgItemInt(hDlg, IDC_SECTORS, NULL, FALSE);
-       current_hfdlg.reserved  = GetDlgItemInt(hDlg, IDC_RESERVED, NULL, FALSE);
-       current_hfdlg.surfaces  = GetDlgItemInt(hDlg, IDC_HEADS, NULL, FALSE);
-       current_hfdlg.blocksize = GetDlgItemInt(hDlg, IDC_BLOCKSIZE, NULL, FALSE);
-       current_hfdlg.bootpri = GetDlgItemInt(hDlg, IDC_HARDFILE_BOOTPRI, NULL, TRUE);
+       current_hfdlg.sectors   = GetDlgItemInt (hDlg, IDC_SECTORS, NULL, FALSE);
+       current_hfdlg.reserved  = GetDlgItemInt (hDlg, IDC_RESERVED, NULL, FALSE);
+       current_hfdlg.surfaces  = GetDlgItemInt (hDlg, IDC_HEADS, NULL, FALSE);
+       current_hfdlg.blocksize = GetDlgItemInt (hDlg, IDC_BLOCKSIZE, NULL, FALSE);
+       current_hfdlg.bootpri = GetDlgItemInt (hDlg, IDC_HARDFILE_BOOTPRI, NULL, TRUE);
        GetDlgItemText (hDlg, IDC_PATH_NAME, tmp, sizeof tmp);
        if (strcmp (tmp, current_hfdlg.filename)) {
            strcpy (current_hfdlg.filename, tmp);
@@ -7106,7 +7106,7 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam
     return FALSE;
 }
 
-extern int harddrive_to_hdf(HWND, struct uae_prefs*, int);
+extern int harddrive_to_hdf (HWND, struct uae_prefs*, int);
 static INT_PTR CALLBACK HarddriveSettingsProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
 {
     static int recursive = 0;
@@ -7123,14 +7123,14 @@ static INT_PTR CALLBACK HarddriveSettingsProc (HWND hDlg, UINT msg, WPARAM wPara
        recursive++;
        inithdcontroller (hDlg);
        CheckDlgButton (hDlg, IDC_HDF_RW, current_hfdlg.rw);
-       SendDlgItemMessage(hDlg, IDC_HARDDRIVE, CB_RESETCONTENT, 0, 0);
+       SendDlgItemMessage (hDlg, IDC_HARDDRIVE, CB_RESETCONTENT, 0, 0);
        ew (hDlg, IDC_HARDDRIVE_IMAGE, FALSE);
        ew (hDlg, IDOK, FALSE);
        ew (hDlg, IDC_HDF_RW, FALSE);
        ew (hDlg, IDC_HDF_CONTROLLER, FALSE);
        index = -1;
-       for (i = 0; i < hdf_getnumharddrives(); i++) {
-           SendDlgItemMessage(hDlg, IDC_HARDDRIVE, CB_ADDSTRING, 0, (LPARAM)hdf_getnameharddrive(i, 1, NULL));
+       for (i = 0; i < hdf_getnumharddrives (); i++) {
+           SendDlgItemMessage (hDlg, IDC_HARDDRIVE, CB_ADDSTRING, 0, (LPARAM)hdf_getnameharddrive (i, 1, NULL));
            if (!strcmp (current_hfdlg.filename, hdf_getnameharddrive (i, 0, NULL)))
                index = i;
        }
@@ -7291,8 +7291,7 @@ static void harddisk_edit (HWND hDlg)
        current_hfdlg.bootpri = uci->bootpri;
        current_hfdlg.autoboot = uci->autoboot;
        current_hfdlg.donotmount = uci->donotmount;
-       if (CustomDialogBox(IDD_HARDFILE, hDlg, HardfileSettingsProc))
-       {
+       if (CustomDialogBox (IDD_HARDFILE, hDlg, HardfileSettingsProc)) {
            new_hardfile (hDlg, entry);
        }
     }
@@ -7302,28 +7301,27 @@ static void harddisk_edit (HWND hDlg)
        current_hfdlg.rw = !uci->readonly;
        strncpy (current_hfdlg.filename, uci->rootdir, (sizeof current_hfdlg.filename) - 1);
        current_hfdlg.filename[(sizeof current_hfdlg.filename) - 1] = '\0';
-       if (CustomDialogBox(IDD_HARDDRIVE, hDlg, HarddriveSettingsProc))
-       {
+       if (CustomDialogBox(IDD_HARDDRIVE, hDlg, HarddriveSettingsProc)) {
            new_harddrive (hDlg, entry);
        }
     }
     else /* Filesystem */
     {
        strncpy (current_fsvdlg.rootdir, uci->rootdir, (sizeof current_fsvdlg.rootdir) - 1);
-       current_fsvdlg.rootdir[(sizeof current_fsvdlg.rootdir) - 1] = '\0';
+       current_fsvdlg.rootdir[sizeof (current_fsvdlg.rootdir) - 1] = '\0';
        strncpy (current_fsvdlg.volume, uci->volname, (sizeof current_fsvdlg.volume) - 1);
-       current_fsvdlg.volume[(sizeof current_fsvdlg.volume) - 1] = '\0';
+       current_fsvdlg.volume[sizeof (current_fsvdlg.volume) - 1] = '\0';
        current_fsvdlg.device[0] = 0;
        if (uci->devname) {
            strncpy (current_fsvdlg.device, uci->devname, (sizeof current_fsvdlg.device) - 1);
-           current_fsvdlg.device[(sizeof current_fsvdlg.device) - 1] = '\0';
+           current_fsvdlg.device[sizeof (current_fsvdlg.device) - 1] = '\0';
        }
        current_fsvdlg.rw = !uci->readonly;
        current_fsvdlg.bootpri = uci->bootpri;
        current_fsvdlg.autoboot = uci->autoboot;
        current_fsvdlg.donotmount = uci->donotmount;
        archivehd = -1;
-       if (CustomDialogBox(IDD_FILESYS, hDlg, VolumeSettingsProc)) {
+       if (CustomDialogBox (IDD_FILESYS, hDlg, VolumeSettingsProc)) {
            new_filesys (hDlg, entry);
        }
     }
@@ -7342,13 +7340,13 @@ static void harddiskdlg_button (HWND hDlg, int button)
      case IDC_NEW_FS:
        current_fsvdlg = empty_fsvdlg;
        archivehd = 0;
-       if (CustomDialogBox(IDD_FILESYS, hDlg, VolumeSettingsProc))
+       if (CustomDialogBox (IDD_FILESYS, hDlg, VolumeSettingsProc))
            new_filesys (hDlg, -1);
        break;
      case IDC_NEW_FSARCH:
         archivehd = 1;
        current_fsvdlg = empty_fsvdlg;
-       if (CustomDialogBox(IDD_FILESYS, hDlg, VolumeSettingsProc))
+       if (CustomDialogBox (IDD_FILESYS, hDlg, VolumeSettingsProc))
            new_filesys (hDlg, -1);
        break;
 
@@ -7389,27 +7387,27 @@ static void harddiskdlg_button (HWND hDlg, int button)
        break;
 
      case IDC_MAPDRIVES_AUTO:
-       workprefs.win32_automount_removable = IsDlgButtonChecked(hDlg, IDC_MAPDRIVES_AUTO);
+       workprefs.win32_automount_removable = IsDlgButtonChecked (hDlg, IDC_MAPDRIVES_AUTO);
        break;
 
      case IDC_MAPDRIVES:
-       workprefs.win32_automount_drives = IsDlgButtonChecked(hDlg, IDC_MAPDRIVES);
+       workprefs.win32_automount_drives = IsDlgButtonChecked (hDlg, IDC_MAPDRIVES);
        break;
 
      case IDC_MAPDRIVES_CD:
-       workprefs.win32_automount_cddrives = IsDlgButtonChecked(hDlg, IDC_MAPDRIVES_CD);
+       workprefs.win32_automount_cddrives = IsDlgButtonChecked (hDlg, IDC_MAPDRIVES_CD);
        break;
 
      case IDC_MAPDRIVES_NET:
-       workprefs.win32_automount_netdrives = IsDlgButtonChecked(hDlg, IDC_MAPDRIVES_NET);
+       workprefs.win32_automount_netdrives = IsDlgButtonChecked (hDlg, IDC_MAPDRIVES_NET);
        break;
 
     case IDC_NOUAEFSDB:
-       workprefs.filesys_no_uaefsdb = IsDlgButtonChecked(hDlg, IDC_NOUAEFSDB);
+       workprefs.filesys_no_uaefsdb = IsDlgButtonChecked (hDlg, IDC_NOUAEFSDB);
        break;
 
     case IDC_NORECYCLEBIN:
-       workprefs.win32_norecyclebin = IsDlgButtonChecked(hDlg, IDC_NORECYCLEBIN);
+       workprefs.win32_norecyclebin = IsDlgButtonChecked (hDlg, IDC_NORECYCLEBIN);
        break;
 
     }
@@ -7452,7 +7450,7 @@ static void hilitehd (void)
        clicked_entry = 0;
     if (clicked_entry >= total)
        clicked_entry = total;
-    ListView_SetItemState( cachedlist, clicked_entry, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED );
+    ListView_SetItemState (cachedlist, clicked_entry, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
 }
 
 static INT_PTR CALLBACK HarddiskDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -7462,7 +7460,7 @@ static INT_PTR CALLBACK HarddiskDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPA
        clicked_entry = 0;
        pages[HARDDISK_ID] = hDlg;
        currentpage = HARDDISK_ID;
-       EnableWindow (GetDlgItem(hDlg, IDC_NEW_HD), os_winnt_admin > 1 ? TRUE : FALSE);
+       EnableWindow (GetDlgItem (hDlg, IDC_NEW_HD), os_winnt_admin > 1 ? TRUE : FALSE);
 
     case WM_USER:
        CheckDlgButton (hDlg, IDC_MAPDRIVES_AUTO, workprefs.win32_automount_removable);
@@ -7584,8 +7582,8 @@ static void addfloppyhistory_2 (HWND hDlg, UAEREG *fkey, int n, int f_text)
 
     if (f_text < 0)
        return;
-    SendDlgItemMessage(hDlg, f_text, CB_RESETCONTENT, 0, 0);
-    SendDlgItemMessage(hDlg, f_text, WM_SETTEXT, 0, (LPARAM)workprefs.df[n]);
+    SendDlgItemMessage (hDlg, f_text, CB_RESETCONTENT, 0, 0);
+    SendDlgItemMessage (hDlg, f_text, WM_SETTEXT, 0, (LPARAM)workprefs.df[n]);
     i = 0;
     while (s = DISK_history_get (i)) {
        char tmpname[MAX_DPATH], tmppath[MAX_DPATH], *p, *p2;
@@ -7593,7 +7591,7 @@ static void addfloppyhistory_2 (HWND hDlg, UAEREG *fkey, int n, int f_text)
            break;
        i++;
        strcpy (tmppath, s);
-       p = tmppath + strlen(tmppath) - 1;
+       p = tmppath + strlen (tmppath) - 1;
        for (j = 0; uae_archive_extensions[j]; j++) {
            p2 = strstr (tmppath, uae_archive_extensions[j]);
            if (p2) {
@@ -7624,7 +7622,7 @@ static void addfloppyhistory_2 (HWND hDlg, UAEREG *fkey, int n, int f_text)
     }
 }
 
-static void addfloppyhistory(HWND hDlg)
+static void addfloppyhistory (HWND hDlg)
 {
     UAEREG *fkey;
     int f_text, max, n;
@@ -7760,8 +7758,8 @@ static int getfloppybox (HWND hDlg, int f_text, char *out, int maxlen)
     }
     xfree (tmp);
     i = 0;
-    while ((p = DISK_history_get(i))) {
-       if (!strcmp(p, out)) {
+    while ((p = DISK_history_get (i))) {
+       if (!strcmp (p, out)) {
            DISK_history_add (out, -1);
            break;
        }
@@ -7819,7 +7817,7 @@ static void diskselect (HWND hDlg, WPARAM wParam, struct uae_prefs *p, int drv,
 
 static int diskselectmenu (HWND hDlg, WPARAM wParam)
 {
-    int id = GetDlgCtrlID((HWND)wParam);
+    int id = GetDlgCtrlID ((HWND)wParam);
     int num = -1;
     switch (id)
     {
@@ -7865,11 +7863,11 @@ static INT_PTR CALLBACK FloppyDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARA
        char ft35dd[20], ft35hd[20], ft525sd[20], ftdis[20], ft35ddescom[20];
        int df0texts[] = { IDC_DF0TEXT, IDC_DF1TEXT, IDC_DF2TEXT, IDC_DF3TEXT, -1 };
 
-       WIN32GUI_LoadUIString(IDS_FLOPPYTYPE35DD, ft35dd, sizeof ft35dd);
-       WIN32GUI_LoadUIString(IDS_FLOPPYTYPE35HD, ft35hd, sizeof ft35hd);
-       WIN32GUI_LoadUIString(IDS_FLOPPYTYPE525SD, ft525sd, sizeof ft525sd);
-       WIN32GUI_LoadUIString(IDS_FLOPPYTYPE35DDESCOM, ft35ddescom, sizeof ft35ddescom);
-       WIN32GUI_LoadUIString(IDS_FLOPPYTYPEDISABLED, ftdis, sizeof ftdis);
+       WIN32GUI_LoadUIString (IDS_FLOPPYTYPE35DD, ft35dd, sizeof ft35dd);
+       WIN32GUI_LoadUIString (IDS_FLOPPYTYPE35HD, ft35hd, sizeof ft35hd);
+       WIN32GUI_LoadUIString (IDS_FLOPPYTYPE525SD, ft525sd, sizeof ft525sd);
+       WIN32GUI_LoadUIString (IDS_FLOPPYTYPE35DDESCOM, ft35ddescom, sizeof ft35ddescom);
+       WIN32GUI_LoadUIString (IDS_FLOPPYTYPEDISABLED, ftdis, sizeof ftdis);
        pages[FLOPPY_ID] = hDlg;
        if (workprefs.floppy_speed > 0 && workprefs.floppy_speed < 10)
            workprefs.floppy_speed = 100;
@@ -8090,7 +8088,7 @@ static void addswapperfile (HWND hDlg, int entry, char *newpath)
     if (MultiDiskSelection (hDlg, -1, 0, &changed_prefs, path)) {
        char dpath[MAX_DPATH];
        loopmulti (path, NULL);
-       while (loopmulti(path, dpath) && entry < MAX_SPARE_DRIVES) {
+       while (loopmulti (path, dpath) && entry < MAX_SPARE_DRIVES) {
            strcpy (workprefs.dfxlist[entry], dpath);
            lastentry = entry;
            entry++;
@@ -8111,7 +8109,7 @@ static INT_PTR CALLBACK SwapperDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR
     case WM_INITDIALOG:
        pages[DISK_ID] = hDlg;
        currentpage = DISK_ID;
-       InitializeListView(hDlg);
+       InitializeListView (hDlg);
        addfloppyhistory (hDlg);
        entry = 0;
        swapperhili (hDlg, entry);
@@ -8144,7 +8142,7 @@ static INT_PTR CALLBACK SwapperDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR
        return TRUE;
     break;
     case WM_CONTEXTMENU:
-       if (GetDlgCtrlID((HWND)wParam) == IDC_DISKLISTINSERT && entry >= 0) {
+       if (GetDlgCtrlID ((HWND)wParam) == IDC_DISKLISTINSERT && entry >= 0) {
            char *s = favoritepopup (hDlg);
            if (s) {
                addswapperfile (hDlg, entry, s);
@@ -8154,7 +8152,7 @@ static INT_PTR CALLBACK SwapperDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR
     break;
     case WM_COMMAND:
     {
-       switch (LOWORD(wParam))
+       switch (LOWORD (wParam))
        {
            case 10001:
            case 10002:
@@ -8341,7 +8339,7 @@ static int ghostscript_available;
 static int joy0previous, joy1previous;
 static BOOL bNoMidiIn = FALSE;
 
-static void enable_for_portsdlg( HWND hDlg )
+static void enable_for_portsdlg (HWND hDlg)
 {
     int v;
 
@@ -8626,7 +8624,7 @@ static void values_to_portsdlg (HWND hDlg)
        LRESULT result = -1;
        for (i = 0; i < MAX_SERIAL_PORTS && comports[i].name; i++) {
            if (!strcmp (comports[i].dev, workprefs.sername)) {
-               result = SendDlgItemMessage(hDlg, IDC_SERIAL, CB_SETCURSEL, i + 1, 0L);
+               result = SendDlgItemMessage (hDlg, IDC_SERIAL, CB_SETCURSEL, i + 1, 0L);
                break;
            }
        }
@@ -8636,7 +8634,7 @@ static void values_to_portsdlg (HWND hDlg)
            WIN32GUI_LoadUIString (IDS_INVALIDCOMPORT, szMessage, MAX_DPATH);
            pre_gui_message (szMessage);
            // Select "none" as the COM-port
-           SendDlgItemMessage(hDlg, IDC_SERIAL, CB_SETCURSEL, 0L, 0L);
+           SendDlgItemMessage (hDlg, IDC_SERIAL, CB_SETCURSEL, 0L, 0L);
            // Disable the chosen serial-port selection
            workprefs.sername[0] = 0;
            workprefs.use_serial = 0;
@@ -8669,7 +8667,7 @@ static void init_portsdlg( HWND hDlg )
     SendDlgItemMessage (hDlg, IDC_SERIAL, CB_RESETCONTENT, 0, 0L);
     SendDlgItemMessage (hDlg, IDC_SERIAL, CB_ADDSTRING, 0, (LPARAM)szNone);
     for (port = 0; port < MAX_SERIAL_PORTS && comports[port].name; port++) {
-       SendDlgItemMessage(hDlg, IDC_SERIAL, CB_ADDSTRING, 0, (LPARAM)comports[port].name);
+       SendDlgItemMessage (hDlg, IDC_SERIAL, CB_ADDSTRING, 0, (LPARAM)comports[port].name);
     }
 
     SendDlgItemMessage (hDlg, IDC_PRINTERLIST, CB_RESETCONTENT, 0, 0L);
@@ -8680,18 +8678,18 @@ static void init_portsdlg( HWND hDlg )
        EnumPrinters(flags, NULL, 1, (LPBYTE)pInfo, 0, &needed, &dwEnumeratedPrinters);
        if (needed > 0) {
            DWORD size = needed;
-           pInfo = calloc(1, size);
+           pInfo = xcalloc (1, size);
            dwEnumeratedPrinters = 0;
            EnumPrinters(flags, NULL, 1, (LPBYTE)pInfo, size, &needed, &dwEnumeratedPrinters);
        }
        if (dwEnumeratedPrinters == 0) {
-           free (pInfo);
+           xfree (pInfo);
            pInfo = 0;
        }
     }
     if (pInfo) {
        for(port = 0; port < (int)dwEnumeratedPrinters; port++)
-           SendDlgItemMessage(hDlg, IDC_PRINTERLIST, CB_ADDSTRING, 0, (LPARAM)pInfo[port].pName);
+           SendDlgItemMessage (hDlg, IDC_PRINTERLIST, CB_ADDSTRING, 0, (LPARAM)pInfo[port].pName);
     } else {
        ew (hDlg, IDC_PRINTERLIST, FALSE);
     }
@@ -8711,28 +8709,28 @@ static void init_portsdlg( HWND hDlg )
 
     SendDlgItemMessage (hDlg, IDC_MIDIOUTLIST, CB_RESETCONTENT, 0, 0L);
     SendDlgItemMessage (hDlg, IDC_MIDIOUTLIST, CB_ADDSTRING, 0, (LPARAM)szNone);
-    if((numdevs = midiOutGetNumDevs()) == 0) {
+    if ((numdevs = midiOutGetNumDevs ()) == 0) {
        ew (hDlg, IDC_MIDIOUTLIST, FALSE);
     } else {
        char szMidiOut[MAX_DPATH];
-       WIN32GUI_LoadUIString(IDS_DEFAULTMIDIOUT, szMidiOut, MAX_DPATH);
-       SendDlgItemMessage(hDlg, IDC_MIDIOUTLIST, CB_ADDSTRING, 0, (LPARAM)szMidiOut);
+       WIN32GUI_LoadUIString (IDS_DEFAULTMIDIOUT, szMidiOut, MAX_DPATH);
+       SendDlgItemMessage (hDlg, IDC_MIDIOUTLIST, CB_ADDSTRING, 0, (LPARAM)szMidiOut);
 
        for(port = 0; port < numdevs; port++) {
-           if(midiOutGetDevCaps(port, &midiOutCaps, sizeof(midiOutCaps)) == MMSYSERR_NOERROR)
-               SendDlgItemMessage(hDlg, IDC_MIDIOUTLIST, CB_ADDSTRING, 0, (LPARAM)midiOutCaps.szPname);
+           if (midiOutGetDevCaps (port, &midiOutCaps, sizeof(midiOutCaps)) == MMSYSERR_NOERROR)
+               SendDlgItemMessage (hDlg, IDC_MIDIOUTLIST, CB_ADDSTRING, 0, (LPARAM)midiOutCaps.szPname);
        }
        ew (hDlg, IDC_MIDIOUTLIST, TRUE);
     }
 
-    SendDlgItemMessage(hDlg, IDC_MIDIINLIST, CB_RESETCONTENT, 0, 0L);
-    if((numdevs = midiInGetNumDevs()) == 0) {
+    SendDlgItemMessage (hDlg, IDC_MIDIINLIST, CB_RESETCONTENT, 0, 0L);
+    if ((numdevs = midiInGetNumDevs ()) == 0) {
        ew (hDlg, IDC_MIDIINLIST, FALSE);
        bNoMidiIn = TRUE;
     } else {
        for(port = 0; port < numdevs; port++) {
-           if(midiInGetDevCaps(port, &midiInCaps, sizeof(midiInCaps)) == MMSYSERR_NOERROR)
-               SendDlgItemMessage(hDlg, IDC_MIDIINLIST, CB_ADDSTRING, 0, (LPARAM)midiInCaps.szPname);
+           if (midiInGetDevCaps (port, &midiInCaps, sizeof(midiInCaps)) == MMSYSERR_NOERROR)
+               SendDlgItemMessage (hDlg, IDC_MIDIINLIST, CB_ADDSTRING, 0, (LPARAM)midiInCaps.szPname);
        }
     }
 }
@@ -8749,10 +8747,10 @@ static INT_PTR CALLBACK PortsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
        recursive++;
        pages[PORTS_ID] = hDlg;
        currentpage = PORTS_ID;
-       init_portsdlg(hDlg);
-       enable_for_portsdlg(hDlg);
-       values_to_portsdlg(hDlg);
-       updatejoyport(hDlg);
+       init_portsdlg (hDlg);
+       enable_for_portsdlg (hDlg);
+       values_to_portsdlg (hDlg);
+       updatejoyport (hDlg);
        recursive--;
        break;
     case WM_USER:
@@ -8815,7 +8813,7 @@ static void values_to_inputdlg (HWND hDlg)
 }
 
 static int stringboxdialogactive;
-static INT_PTR CALLBACK StringBoxDialogProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK StringBoxDialogProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
 {
     switch(msg)
     {
@@ -8824,12 +8822,12 @@ static INT_PTR CALLBACK StringBoxDialogProc(HWND hDlg, UINT msg, WPARAM wParam,
        return TRUE;
        case WM_CLOSE:
        stringboxdialogactive = 0;
-       DestroyWindow(hDlg);
+       DestroyWindow (hDlg);
        return TRUE;
        case WM_INITDIALOG:
            return TRUE;
        case WM_COMMAND:
-           switch (LOWORD(wParam))
+           switch (LOWORD (wParam))
            {
                case IDOK:
                    stringboxdialogactive = -1;
@@ -8845,7 +8843,7 @@ static INT_PTR CALLBACK StringBoxDialogProc(HWND hDlg, UINT msg, WPARAM wParam,
     return FALSE;
 }
 
-static int askinputcustom(HWND hDlg, char *custom, int maxlen)
+static int askinputcustom (HWND hDlg, char *custom, int maxlen)
 {
     HWND hwnd;
     char txt[MAX_DPATH];
@@ -8854,8 +8852,8 @@ static int askinputcustom(HWND hDlg, char *custom, int maxlen)
     hwnd = CustomCreateDialog (IDD_STRINGBOX, hDlg, StringBoxDialogProc);
     if (hwnd == NULL)
        return 0;
-    SendMessage(GetDlgItem(hwnd, IDC_STRINGBOXEDIT), WM_SETTEXT, 0, (LPARAM)custom);
-    SetFocus(GetDlgItem(hwnd, IDC_STRINGBOXEDIT));
+    SendMessage (GetDlgItem (hwnd, IDC_STRINGBOXEDIT), WM_SETTEXT, 0, (LPARAM)custom);
+    SetFocus (GetDlgItem (hwnd, IDC_STRINGBOXEDIT));
     while (stringboxdialogactive == 1) {
        MSG msg;
        int ret;
@@ -8863,11 +8861,11 @@ static int askinputcustom(HWND hDlg, char *custom, int maxlen)
        while ((ret = GetMessage (&msg, NULL, 0, 0))) {
            if (ret == -1)
                break;
-           if (!IsWindow(hwnd) || !IsDialogMessage(hwnd, &msg)) {
+           if (!IsWindow (hwnd) || !IsDialogMessage (hwnd, &msg)) {
                TranslateMessage (&msg);
                DispatchMessage (&msg);
            }
-           SendMessage(GetDlgItem(hwnd, IDC_STRINGBOXEDIT), WM_GETTEXT, sizeof txt, (LPARAM)txt);
+           SendMessage (GetDlgItem (hwnd, IDC_STRINGBOXEDIT), WM_GETTEXT, sizeof txt, (LPARAM)txt);
        }
        if (stringboxdialogactive == -1) {
            strcpy (custom, txt);
@@ -8884,9 +8882,9 @@ static void init_inputdlg_2(HWND hDlg)
     int cnt, index, af, aftmp;
 
     if (input_selected_widget < 0 || workprefs.input_selected_setting == 0) {
-       EnableWindow(GetDlgItem(hDlg, IDC_INPUTAMIGA), FALSE);
+       EnableWindow (GetDlgItem (hDlg, IDC_INPUTAMIGA), FALSE);
     } else {
-       EnableWindow(GetDlgItem(hDlg, IDC_INPUTAMIGA), TRUE);
+       EnableWindow (GetDlgItem (hDlg, IDC_INPUTAMIGA), TRUE);
     }
     SendDlgItemMessage (hDlg, IDC_INPUTAMIGA, CB_RESETCONTENT, 0, 0L);
     SendDlgItemMessage (hDlg, IDC_INPUTAMIGA, CB_ADDSTRING, 0, (LPARAM)szNone);
@@ -8909,8 +8907,8 @@ static void init_inputdlg_2(HWND hDlg)
        if (strlen(custom1) > 0)
            index = 1;
        if (index >= 0) {
-           SendDlgItemMessage(hDlg, IDC_INPUTAMIGA, CB_SETCURSEL, index, 0);
-           SendDlgItemMessage(hDlg, IDC_INPUTAMIGACNT, CB_SETCURSEL, input_selected_sub_num, 0);
+           SendDlgItemMessage (hDlg, IDC_INPUTAMIGA, CB_SETCURSEL, index, 0);
+           SendDlgItemMessage (hDlg, IDC_INPUTAMIGACNT, CB_SETCURSEL, input_selected_sub_num, 0);
        }
     }
 }
@@ -8961,7 +8959,7 @@ static void init_inputdlg( HWND hDlg )
        inputdevice_get_device_total (IDTYPE_KEYBOARD);
     if (input_selected_device >= input_total_devices)
        input_selected_device = 0;
-    InitializeListView(hDlg);
+    InitializeListView (hDlg);
     init_inputdlg_2 (hDlg);
     values_to_inputdlg (hDlg);
 }
@@ -8985,10 +8983,10 @@ static void enable_for_inputdlg (HWND hDlg)
 
 static void clearinputlistview (HWND hDlg)
 {
-    ListView_DeleteAllItems(GetDlgItem(hDlg, IDC_INPUTLIST));
+    ListView_DeleteAllItems (GetDlgItem (hDlg, IDC_INPUTLIST));
 }
 
-static void doinputcustom(HWND hDlg, int newcustom)
+static void doinputcustom (HWND hDlg, int newcustom)
 {
     char custom1[MAX_DPATH];
     int flags;
@@ -8996,7 +8994,7 @@ static void doinputcustom(HWND hDlg, int newcustom)
     inputdevice_get_mapped_name (input_selected_device, input_selected_widget,
        &flags, 0, custom1, input_selected_sub_num);
     if (strlen(custom1) > 0 || newcustom) {
-       if (askinputcustom(hDlg, custom1, sizeof custom1)) {
+       if (askinputcustom (hDlg, custom1, sizeof custom1)) {
            inputdevice_set_mapping (input_selected_device, input_selected_widget,
                0, custom1, (flags & IDEV_MAPPED_AUTOFIRE_SET) ? 1 : 0, input_selected_sub_num);
        }
@@ -9009,25 +9007,25 @@ static void values_from_inputdlg (HWND hDlg)
     BOOL success;
     LRESULT item;
 
-    v  = GetDlgItemInt(hDlg, IDC_INPUTDEADZONE, &success, FALSE);
+    v  = GetDlgItemInt (hDlg, IDC_INPUTDEADZONE, &success, FALSE);
     if (success) {
        currprefs.input_joystick_deadzone = workprefs.input_joystick_deadzone = v;
        currprefs.input_joystick_deadzone = workprefs.input_joymouse_deadzone = v;
     }
-    v  = GetDlgItemInt(hDlg, IDC_INPUTAUTOFIRERATE, &success, FALSE);
+    v  = GetDlgItemInt (hDlg, IDC_INPUTAUTOFIRERATE, &success, FALSE);
     if (success)
        currprefs.input_autofire_framecnt = workprefs.input_autofire_framecnt = v;
-    v  = GetDlgItemInt(hDlg, IDC_INPUTSPEEDD, &success, FALSE);
+    v  = GetDlgItemInt (hDlg, IDC_INPUTSPEEDD, &success, FALSE);
     if (success)
        currprefs.input_joymouse_speed = workprefs.input_joymouse_speed = v;
-    v  = GetDlgItemInt(hDlg, IDC_INPUTSPEEDA, &success, FALSE);
+    v  = GetDlgItemInt (hDlg, IDC_INPUTSPEEDA, &success, FALSE);
     if (success)
        currprefs.input_joymouse_multiplier = workprefs.input_joymouse_multiplier = v;
-    v  = GetDlgItemInt(hDlg, IDC_INPUTSPEEDM, &success, FALSE);
+    v  = GetDlgItemInt (hDlg, IDC_INPUTSPEEDM, &success, FALSE);
     if (success)
        currprefs.input_mouse_speed = workprefs.input_mouse_speed = v;
 
-    item = SendDlgItemMessage(hDlg, IDC_INPUTAMIGACNT, CB_GETCURSEL, 0, 0L);
+    item = SendDlgItemMessage (hDlg, IDC_INPUTAMIGACNT, CB_GETCURSEL, 0, 0L);
     if (item != CB_ERR && input_selected_sub_num != item) {
        input_selected_sub_num = (int)item;
        doselect = 0;
@@ -9036,18 +9034,18 @@ static void values_from_inputdlg (HWND hDlg)
        return;
     }
 
-    item = SendDlgItemMessage(hDlg, IDC_INPUTTYPE, CB_GETCURSEL, 0, 0L);
+    item = SendDlgItemMessage (hDlg, IDC_INPUTTYPE, CB_GETCURSEL, 0, 0L);
     if(item != CB_ERR) {
        if (item != workprefs.input_selected_setting) {
            workprefs.input_selected_setting = (int)item;
            input_selected_widget = -1;
            inputdevice_updateconfig (&workprefs);
-           enable_for_inputdlg( hDlg );
+           enable_for_inputdlg (hDlg);
            InitializeListView (hDlg);
            doselect = 1;
        }
     }
-    item = SendDlgItemMessage(hDlg, IDC_INPUTDEVICE, CB_GETCURSEL, 0, 0L);
+    item = SendDlgItemMessage (hDlg, IDC_INPUTDEVICE, CB_GETCURSEL, 0, 0L);
     if(item != CB_ERR) {
        if (item != input_selected_device) {
            input_selected_device = (int)item;
@@ -9059,11 +9057,11 @@ static void values_from_inputdlg (HWND hDlg)
            doselect = 1;
        }
     }
-    item = SendDlgItemMessage(hDlg, IDC_INPUTAMIGA, CB_GETCURSEL, 0, 0L);
+    item = SendDlgItemMessage (hDlg, IDC_INPUTAMIGA, CB_GETCURSEL, 0, 0L);
     if(item != CB_ERR) {
        if (item == 1) {
            if (item != input_selected_event)
-               doinputcustom(hDlg, 1);
+               doinputcustom (hDlg, 1);
        }
        input_selected_event = (int)item;
        doselect = 1;
@@ -9094,7 +9092,7 @@ static void input_swap (HWND hDlg)
 static void input_copy (HWND hDlg)
 {
     int dst = workprefs.input_selected_setting;
-    LRESULT src = SendDlgItemMessage(hDlg, IDC_INPUTCOPYFROM, CB_GETCURSEL, 0, 0L);
+    LRESULT src = SendDlgItemMessage (hDlg, IDC_INPUTCOPYFROM, CB_GETCURSEL, 0, 0L);
     if (src == CB_ERR)
        return;
     inputdevice_copy_single_config (&workprefs, (int)src, workprefs.input_selected_setting, input_selected_device);
@@ -9117,7 +9115,7 @@ static void input_toggleautofire (void)
        name, custom, af, input_selected_sub_num);
 }
 
-static INT_PTR CALLBACK InputDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK InputDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
 {
     char name_buf[MAX_DPATH] = "", desc_buf[128] = "";
     char *posn = NULL;
@@ -9135,7 +9133,7 @@ static INT_PTR CALLBACK InputDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
        inputdevice_updateconfig (&workprefs);
        inputdevice_config_change ();
        input_selected_widget = -1;
-       init_inputdlg(hDlg);
+       init_inputdlg (hDlg);
 
     case WM_USER:
        recursive++;
@@ -9188,13 +9186,13 @@ static INT_PTR CALLBACK InputDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
                        input_selected_sub_num++;
                        if (input_selected_sub_num >= MAX_INPUT_SUB_EVENT)
                            input_selected_sub_num = 0;
-                       SendDlgItemMessage(hDlg, IDC_INPUTAMIGACNT, CB_SETCURSEL, input_selected_sub_num, 0);
+                       SendDlgItemMessage (hDlg, IDC_INPUTAMIGACNT, CB_SETCURSEL, input_selected_sub_num, 0);
                    }
                } else {
                    input_selected_widget = -1;
                }
                if (dblclick)
-                   doinputcustom(hDlg, 0);
+                   doinputcustom (hDlg, 0);
                update_listview_input (hDlg);
                init_inputdlg_2 (hDlg);
            }
@@ -9235,7 +9233,7 @@ static void enable_for_hw3ddlg (HWND hDlg)
        vv4 = TRUE;
     ew (hDlg, IDC_FILTERENABLE, TRUE);
     ew (hDlg, IDC_FILTERMODE, v);
-    CheckDlgButton(hDlg, IDC_FILTERENABLE, v);
+    CheckDlgButton (hDlg, IDC_FILTERENABLE, v);
     ew (hDlg, IDC_FILTERHZ, v);
     ew (hDlg, IDC_FILTERVZ, v);
     ew (hDlg, IDC_FILTERHZMULT, v);
@@ -9326,17 +9324,17 @@ static void values_to_hw3ddlg (HWND hDlg)
     struct uae_filter *uf;
     UAEREG *fkey;
 
-    CheckDlgButton(hDlg, IDC_FILTERASPECT, workprefs.gfx_filter_aspect);
-    CheckDlgButton(hDlg, IDC_FILTERAUTORES, workprefs.gfx_autoresolution);
+    CheckDlgButton (hDlg, IDC_FILTERASPECT, workprefs.gfx_filter_aspect);
+    CheckDlgButton (hDlg, IDC_FILTERAUTORES, workprefs.gfx_autoresolution);
 
-    SendDlgItemMessage(hDlg, IDC_FILTERHZ, TBM_SETRANGE, TRUE, MAKELONG (-999, +999));
-    SendDlgItemMessage(hDlg, IDC_FILTERHZ, TBM_SETPAGESIZE, 0, 1);
-    SendDlgItemMessage(hDlg, IDC_FILTERVZ, TBM_SETRANGE, TRUE, MAKELONG (-999, +999));
-    SendDlgItemMessage(hDlg, IDC_FILTERVZ, TBM_SETPAGESIZE, 0, 1);
-    SendDlgItemMessage(hDlg, IDC_FILTERHO, TBM_SETRANGE, TRUE, MAKELONG (-999, +999));
-    SendDlgItemMessage(hDlg, IDC_FILTERHO, TBM_SETPAGESIZE, 0, 1);
-    SendDlgItemMessage(hDlg, IDC_FILTERVO, TBM_SETRANGE, TRUE, MAKELONG (-999, +999));
-    SendDlgItemMessage(hDlg, IDC_FILTERVO, TBM_SETPAGESIZE, 0, 1);
+    SendDlgItemMessage (hDlg, IDC_FILTERHZ, TBM_SETRANGE, TRUE, MAKELONG (-999, +999));
+    SendDlgItemMessage (hDlg, IDC_FILTERHZ, TBM_SETPAGESIZE, 0, 1);
+    SendDlgItemMessage (hDlg, IDC_FILTERVZ, TBM_SETRANGE, TRUE, MAKELONG (-999, +999));
+    SendDlgItemMessage (hDlg, IDC_FILTERVZ, TBM_SETPAGESIZE, 0, 1);
+    SendDlgItemMessage (hDlg, IDC_FILTERHO, TBM_SETRANGE, TRUE, MAKELONG (-999, +999));
+    SendDlgItemMessage (hDlg, IDC_FILTERHO, TBM_SETPAGESIZE, 0, 1);
+    SendDlgItemMessage (hDlg, IDC_FILTERVO, TBM_SETRANGE, TRUE, MAKELONG (-999, +999));
+    SendDlgItemMessage (hDlg, IDC_FILTERVO, TBM_SETPAGESIZE, 0, 1);
 
     SendDlgItemMessage (hDlg, IDC_FILTERMODE, CB_RESETCONTENT, 0, 0L);
     uf = &uaefilters[0];
@@ -9401,8 +9399,8 @@ static void values_to_hw3ddlg (HWND hDlg)
            filter_extra = filter_pal_extra;
        }
     }
-    SendDlgItemMessage(hDlg, IDC_FILTERXL, TBM_SETRANGE, TRUE, MAKELONG (   0, +1000));
-    SendDlgItemMessage(hDlg, IDC_FILTERXL, TBM_SETPAGESIZE, 0, 1);
+    SendDlgItemMessage (hDlg, IDC_FILTERXL, TBM_SETRANGE, TRUE, MAKELONG (   0, +1000));
+    SendDlgItemMessage (hDlg, IDC_FILTERXL, TBM_SETPAGESIZE, 0, 1);
     if (filter_extra) {
        int idx2 = -1;
        int idx = SendDlgItemMessage (hDlg, IDC_FILTERXTRA, CB_GETCURSEL, 0, 0L);
@@ -9421,8 +9419,8 @@ static void values_to_hw3ddlg (HWND hDlg)
        else
            filter_selected = &filter_extra[0];
        SendDlgItemMessage (hDlg, IDC_FILTERXTRA, CB_SETCURSEL, filter_selected - &filter_extra[0], 0);
-       SendDlgItemMessage(hDlg, IDC_FILTERXL, TBM_SETRANGE, TRUE, MAKELONG (filter_selected->min, filter_selected->max));
-       SendDlgItemMessage(hDlg, IDC_FILTERXL, TBM_SETPAGESIZE, 0, filter_selected->step);
+       SendDlgItemMessage (hDlg, IDC_FILTERXL, TBM_SETRANGE, TRUE, MAKELONG (filter_selected->min, filter_selected->max));
+       SendDlgItemMessage (hDlg, IDC_FILTERXL, TBM_SETPAGESIZE, 0, filter_selected->step);
        if (filter_selected) {
            SendDlgItemMessage (hDlg, IDC_FILTERXL, TBM_SETPOS, TRUE, *(filter_selected->varw));
            SetDlgItemInt (hDlg, IDC_FILTERXLV, *(filter_selected->varw), TRUE);
@@ -9629,7 +9627,7 @@ static int getfiltermult(HWND hDlg, DWORD dlg)
     return filtermults[v];
 }
 
-static INT_PTR CALLBACK hw3dDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
 {
     static int recursive;
     LRESULT item;
@@ -9648,7 +9646,7 @@ static INT_PTR CALLBACK hw3dDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
            if(recursive > 0)
                break;
            recursive++;
-           enable_for_hw3ddlg( hDlg );
+           enable_for_hw3ddlg (hDlg);
            values_to_hw3ddlg (hDlg);
            recursive--;
            return TRUE;
@@ -9705,13 +9703,13 @@ static INT_PTR CALLBACK hw3dDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
                        filter_handle (hDlg);
                        break;
                        case IDC_FILTERHZMULT:
-                       currprefs.gfx_filter_horiz_zoom_mult = workprefs.gfx_filter_horiz_zoom_mult = getfiltermult(hDlg, IDC_FILTERHZMULT);
+                       currprefs.gfx_filter_horiz_zoom_mult = workprefs.gfx_filter_horiz_zoom_mult = getfiltermult (hDlg, IDC_FILTERHZMULT);
                        updatedisplayarea ();
                        WIN32GFX_WindowMove ();
                        break;
 
                        case IDC_FILTERVZMULT:
-                       currprefs.gfx_filter_vert_zoom_mult = workprefs.gfx_filter_vert_zoom_mult = getfiltermult(hDlg, IDC_FILTERVZMULT);
+                       currprefs.gfx_filter_vert_zoom_mult = workprefs.gfx_filter_vert_zoom_mult = getfiltermult (hDlg, IDC_FILTERVZMULT);
                        updatedisplayarea ();
                        WIN32GFX_WindowMove ();
                        break;
@@ -9749,7 +9747,7 @@ static INT_PTR CALLBACK hw3dDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
            if (filter_selected) {
                int *pw = filter_selected->varw;
                int *pc = filter_selected->varc;
-               int v = (int)SendMessage(GetDlgItem(hDlg, IDC_FILTERXL), TBM_GETPOS, 0, 0);
+               int v = (int)SendMessage (GetDlgItem(hDlg, IDC_FILTERXL), TBM_GETPOS, 0, 0);
                if (v < filter_selected->min)
                    v = filter_selected->min;
                if (v > filter_selected->max)
@@ -9762,9 +9760,9 @@ static INT_PTR CALLBACK hw3dDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
            SetDlgItemInt (hDlg, IDC_FILTERVZV, workprefs.gfx_filter_vert_zoom, TRUE);
            SetDlgItemInt (hDlg, IDC_FILTERHOV, workprefs.gfx_filter_horiz_offset, TRUE);
            SetDlgItemInt (hDlg, IDC_FILTERVOV, workprefs.gfx_filter_vert_offset, TRUE);
-           init_colors();
-           notice_new_xcolors();
-           reset_drawing();
+           init_colors ();
+           notice_new_xcolors ();
+           reset_drawing ();
            updatedisplayarea ();
            WIN32GFX_WindowMove ();
            recursive--;
@@ -9776,32 +9774,32 @@ static INT_PTR CALLBACK hw3dDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
 #endif
 
 #ifdef AVIOUTPUT
-static void values_to_avioutputdlg(HWND hDlg)
+static void values_to_avioutputdlg (HWND hDlg)
 {
     char tmpstr[256];
 
     updatewinfsmode (&workprefs);
-    SetDlgItemText(hDlg, IDC_AVIOUTPUT_FILETEXT, avioutput_filename);
+    SetDlgItemText (hDlg, IDC_AVIOUTPUT_FILETEXT, avioutput_filename);
 
-    sprintf(tmpstr, "%d fps", avioutput_fps);
-    SendMessage(GetDlgItem(hDlg, IDC_AVIOUTPUT_FPS_STATIC), WM_SETTEXT, (WPARAM) 0, (LPARAM) tmpstr);
+    sprintf (tmpstr, "%d fps", avioutput_fps);
+    SendMessage (GetDlgItem(hDlg, IDC_AVIOUTPUT_FPS_STATIC), WM_SETTEXT, (WPARAM) 0, (LPARAM) tmpstr);
 
-    sprintf(tmpstr, "Actual: %d x %d", workprefs.gfx_size.width, workprefs.gfx_size.height);
-    SendMessage(GetDlgItem(hDlg, IDC_AVIOUTPUT_DIMENSIONS_STATIC), WM_SETTEXT, (WPARAM) 0, (LPARAM) tmpstr);
+    sprintf (tmpstr, "Actual: %d x %d", workprefs.gfx_size.width, workprefs.gfx_size.height);
+    SendMessage (GetDlgItem(hDlg, IDC_AVIOUTPUT_DIMENSIONS_STATIC), WM_SETTEXT, (WPARAM) 0, (LPARAM) tmpstr);
 
     switch(avioutput_fps)
     {
        case VBLANK_HZ_PAL:
-           CheckRadioButton(hDlg, IDC_AVIOUTPUT_PAL, IDC_AVIOUTPUT_NTSC, IDC_AVIOUTPUT_PAL);
+           CheckRadioButton (hDlg, IDC_AVIOUTPUT_PAL, IDC_AVIOUTPUT_NTSC, IDC_AVIOUTPUT_PAL);
        break;
 
        case VBLANK_HZ_NTSC:
-           CheckRadioButton(hDlg, IDC_AVIOUTPUT_PAL, IDC_AVIOUTPUT_NTSC, IDC_AVIOUTPUT_NTSC);
+           CheckRadioButton (hDlg, IDC_AVIOUTPUT_PAL, IDC_AVIOUTPUT_NTSC, IDC_AVIOUTPUT_NTSC);
        break;
 
        default:
-           CheckDlgButton(hDlg, IDC_AVIOUTPUT_PAL, BST_UNCHECKED);
-           CheckDlgButton(hDlg, IDC_AVIOUTPUT_NTSC, BST_UNCHECKED);
+           CheckDlgButton (hDlg, IDC_AVIOUTPUT_PAL, BST_UNCHECKED);
+           CheckDlgButton (hDlg, IDC_AVIOUTPUT_NTSC, BST_UNCHECKED);
        break;
     }
 
@@ -9811,12 +9809,12 @@ static void values_to_avioutputdlg(HWND hDlg)
     CheckDlgButton (hDlg, IDC_SAMPLERIPPER_ACTIVATED, sampleripper_enabled ? BST_CHECKED : BST_UNCHECKED);
 }
 
-static void values_from_avioutputdlg(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static void values_from_avioutputdlg (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
 {
        LRESULT tmp;
 
        updatewinfsmode (&workprefs);
-       tmp = SendMessage(GetDlgItem(hDlg, IDC_AVIOUTPUT_FPS), TBM_GETPOS, 0, 0);
+       tmp = SendMessage (GetDlgItem (hDlg, IDC_AVIOUTPUT_FPS), TBM_GETPOS, 0, 0);
        if (tmp < 1)
            tmp = 1;
        if (tmp != avioutput_fps) {
@@ -9854,21 +9852,21 @@ static void enable_for_avioutputdlg(HWND hDlg)
     if (avioutput_audio == AVIAUDIO_WAV) {
        strcpy (tmp, "Wave (internal)");
     } else {
-       avioutput_audio = AVIOutput_GetAudioCodec(tmp, sizeof tmp);
+       avioutput_audio = AVIOutput_GetAudioCodec (tmp, sizeof tmp);
     }
     if(!avioutput_audio) {
-       CheckDlgButton(hDlg, IDC_AVIOUTPUT_AUDIO, BST_UNCHECKED);
+       CheckDlgButton (hDlg, IDC_AVIOUTPUT_AUDIO, BST_UNCHECKED);
        WIN32GUI_LoadUIString (IDS_AVIOUTPUT_NOCODEC, tmp, sizeof tmp);
     }
-    SetWindowText(GetDlgItem(hDlg, IDC_AVIOUTPUT_AUDIO_STATIC), tmp);
+    SetWindowText (GetDlgItem (hDlg, IDC_AVIOUTPUT_AUDIO_STATIC), tmp);
 
     if (avioutput_audio != AVIAUDIO_WAV)
-       avioutput_video = AVIOutput_GetVideoCodec(tmp, sizeof tmp);
+       avioutput_video = AVIOutput_GetVideoCodec (tmp, sizeof tmp);
     if(!avioutput_video) {
-       CheckDlgButton(hDlg, IDC_AVIOUTPUT_VIDEO, BST_UNCHECKED);
+       CheckDlgButton (hDlg, IDC_AVIOUTPUT_VIDEO, BST_UNCHECKED);
        WIN32GUI_LoadUIString (IDS_AVIOUTPUT_NOCODEC, tmp, sizeof tmp);
     }
-    SetWindowText(GetDlgItem(hDlg, IDC_AVIOUTPUT_VIDEO_STATIC), tmp);
+    SetWindowText (GetDlgItem (hDlg, IDC_AVIOUTPUT_VIDEO_STATIC), tmp);
 
     ew (hDlg, IDC_AVIOUTPUT_NOSOUNDOUTPUT, avioutput_framelimiter ? TRUE : FALSE);
 
@@ -9880,13 +9878,13 @@ static void enable_for_avioutputdlg(HWND hDlg)
     ew (hDlg, IDC_AVIOUTPUT_ACTIVATED, (!avioutput_audio && !avioutput_video) ? FALSE : TRUE);
 
     ew (hDlg, IDC_INPREC_RECORD, input_recording >= 0);
-    CheckDlgButton(hDlg, IDC_INPREC_RECORD, input_recording > 0 ? BST_CHECKED : BST_UNCHECKED);
+    CheckDlgButton (hDlg, IDC_INPREC_RECORD, input_recording > 0 ? BST_CHECKED : BST_UNCHECKED);
     ew (hDlg, IDC_INPREC_PLAY, input_recording <= 0);
-    CheckDlgButton(hDlg, IDC_INPREC_PLAY, input_recording < 0 ? BST_CHECKED : BST_UNCHECKED);
+    CheckDlgButton (hDlg, IDC_INPREC_PLAY, input_recording < 0 ? BST_CHECKED : BST_UNCHECKED);
     ew (hDlg, IDC_INPREC_PLAYMODE, input_recording == 0);
 }
 
-static INT_PTR CALLBACK AVIOutputDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK AVIOutputDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
 {
     static int recursive = 0;
     char tmp[1000];
@@ -9896,11 +9894,11 @@ static INT_PTR CALLBACK AVIOutputDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPA
        case WM_INITDIALOG:
            pages[AVIOUTPUT_ID] = hDlg;
            currentpage = AVIOUTPUT_ID;
-           AVIOutput_GetSettings();
-           enable_for_avioutputdlg(hDlg);
-           SendDlgItemMessage(hDlg, IDC_AVIOUTPUT_FPS, TBM_SETRANGE, TRUE, MAKELONG(1, VBLANK_HZ_NTSC));
-           SendDlgItemMessage(hDlg, IDC_AVIOUTPUT_FPS, TBM_SETPOS, TRUE, avioutput_fps);
-           SendMessage(hDlg, WM_HSCROLL, (WPARAM) NULL, (LPARAM) NULL);
+           AVIOutput_GetSettings ();
+           enable_for_avioutputdlg (hDlg);
+           SendDlgItemMessage (hDlg, IDC_AVIOUTPUT_FPS, TBM_SETRANGE, TRUE, MAKELONG(1, VBLANK_HZ_NTSC));
+           SendDlgItemMessage (hDlg, IDC_AVIOUTPUT_FPS, TBM_SETPOS, TRUE, avioutput_fps);
+           SendMessage (hDlg, WM_HSCROLL, (WPARAM) NULL, (LPARAM) NULL);
            if (!avioutput_filename[0]) {
                fetch_path ("VideoPath", avioutput_filename, sizeof (avioutput_filename));
                strcat (avioutput_filename, "output.avi");
@@ -9908,17 +9906,17 @@ static INT_PTR CALLBACK AVIOutputDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPA
 
        case WM_USER:
            recursive++;
-           values_to_avioutputdlg(hDlg);
-           enable_for_avioutputdlg(hDlg);
+           values_to_avioutputdlg (hDlg);
+           enable_for_avioutputdlg (hDlg);
            recursive--;
        return TRUE;
 
        case WM_HSCROLL:
        {
            recursive++;
-           values_from_avioutputdlg(hDlg, msg, wParam, lParam);
-           values_to_avioutputdlg(hDlg);
-           enable_for_avioutputdlg(hDlg);
+           values_from_avioutputdlg (hDlg, msg, wParam, lParam);
+           values_to_avioutputdlg (hDlg);
+           enable_for_avioutputdlg (hDlg);
            recursive--;
            return TRUE;
        }
@@ -9964,12 +9962,12 @@ static INT_PTR CALLBACK AVIOutputDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPA
 #endif
                case IDC_SAMPLERIPPER_ACTIVATED:
                    sampleripper_enabled = !sampleripper_enabled;
-                   audio_sampleripper(-1);
+                   audio_sampleripper (-1);
                break;
 
                case IDC_AVIOUTPUT_ACTIVATED:
                    avioutput_requested = !avioutput_requested;
-                   SendMessage(hDlg, WM_HSCROLL, (WPARAM) NULL, (LPARAM) NULL);
+                   SendMessage (hDlg, WM_HSCROLL, (WPARAM) NULL, (LPARAM) NULL);
                    if (!avioutput_requested)
                        AVIOutput_End ();
                break;
@@ -10052,9 +10050,9 @@ static INT_PTR CALLBACK AVIOutputDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPA
 
            }
 
-           values_from_avioutputdlg(hDlg, msg, wParam, lParam);
-           values_to_avioutputdlg(hDlg);
-           enable_for_avioutputdlg(hDlg);
+           values_from_avioutputdlg (hDlg, msg, wParam, lParam);
+           values_to_avioutputdlg (hDlg);
+           enable_for_avioutputdlg (hDlg);
 
            recursive--;
 
@@ -10251,14 +10249,14 @@ static BOOL CALLBACK childenumproc (HWND hwnd, LPARAM lParam)
                SetWindowLongPtr (ToolTipHWND2, GWLP_WNDPROC, (LONG_PTR)ToolTipWndProc);
                SetWindowPos (ToolTipHWND2, HWND_TOPMOST, 0, 0, 0, 0,
                    SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
-               SendMessage(ToolTipHWND2, TTM_SETDELAYTIME, (WPARAM)TTDT_AUTOPOP, (LPARAM)MAKELONG(20000, 0));
-               SendMessage(ToolTipHWND2, TTM_SETMAXTIPWIDTH, 0, 400);
-               SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM)tmp);
-               v = SendMessage(ToolTipHWND2, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti);
+               SendMessage (ToolTipHWND2, TTM_SETDELAYTIME, (WPARAM)TTDT_AUTOPOP, (LPARAM)MAKELONG(20000, 0));
+               SendMessage (ToolTipHWND2, TTM_SETMAXTIPWIDTH, 0, 400);
+               SendMessage (hwnd, WM_SETTEXT, 0, (LPARAM)tmp);
+               v = SendMessage (ToolTipHWND2, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti);
            }
        } else {
-           v = SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM)tmp);
-           v = SendMessage(ToolTipHWND, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti);
+           v = SendMessage (hwnd, WM_SETTEXT, 0, (LPARAM)tmp);
+           v = SendMessage (ToolTipHWND, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti);
        }
        return 1;
     }
@@ -10270,7 +10268,7 @@ static BOOL CALLBACK childenumproc (HWND hwnd, LPARAM lParam)
        if (p[0] == ' ')
            *p++;
        tmp[strlen(tmp) - 1] = 0;
-       SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM)tmp);
+       SendMessage (hwnd, WM_SETTEXT, 0, (LPARAM)tmp);
        ti.cbSize = sizeof (TOOLINFO);
        ti.uFlags = TTF_SUBCLASS;
        ti.hwnd = GetParent (hwnd);
@@ -10283,7 +10281,7 @@ static BOOL CALLBACK childenumproc (HWND hwnd, LPARAM lParam)
        ti.rect.left -= r.left;
        ti.rect.right -= r.left;
        ti.rect.bottom -= r.top;
-       SendMessage(ToolTipHWND, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti);
+       SendMessage (ToolTipHWND, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti);
     }
     return 1;
 }
@@ -10340,7 +10338,7 @@ static HWND updatePanel (HWND hDlg, int id)
     GetClientRect (hDlg, &r2c);
     gui_width = r2c.right;
     gui_height = r2c.bottom;
-    tres = scaleresource(ppage[id].nres, hDlg);
+    tres = scaleresource (ppage[id].nres, hDlg);
     panelDlg = CreateDialogIndirectParam (tres->inst, tres->resource, hDlg, ppage[id].dlgproc, id);
     freescaleresource(tres);
     GetWindowRect (hDlg, &r3w);
@@ -10361,9 +10359,9 @@ static HWND updatePanel (HWND hDlg, int id)
        SetWindowPos (panelDlg, HWND_TOP, x + (pw - w) / 2, y + (ph - h) / 2, 0, 0,
            SWP_NOSIZE | SWP_NOOWNERZORDER);
     }
-    ShowWindow(GetDlgItem(hDlg, IDC_PANEL_FRAME), SW_HIDE);
-    ShowWindow(GetDlgItem(hDlg, IDC_PANEL_FRAME_OUTER), !fullpanel ? SW_SHOW : SW_HIDE);
-    ShowWindow(GetDlgItem(hDlg, IDC_PANELTREE), !fullpanel ? SW_SHOW : SW_HIDE);
+    ShowWindow (GetDlgItem (hDlg, IDC_PANEL_FRAME), SW_HIDE);
+    ShowWindow (GetDlgItem (hDlg, IDC_PANEL_FRAME_OUTER), !fullpanel ? SW_SHOW : SW_HIDE);
+    ShowWindow (GetDlgItem (hDlg, IDC_PANELTREE), !fullpanel ? SW_SHOW : SW_HIDE);
     ShowWindow (panelDlg, SW_SHOW);
     ew (hDlg, IDHELP, pHtmlHelp && ppage[currentpage].help ? TRUE : FALSE);
 
@@ -10379,8 +10377,8 @@ static HWND updatePanel (HWND hDlg, int id)
     SendMessage(ToolTipHWND, TTM_SETDELAYTIME, (WPARAM)TTDT_INITIAL, (LPARAM)MAKELONG(100, 0));
     SendMessage(ToolTipHWND, TTM_SETDELAYTIME, (WPARAM)TTDT_RESHOW, (LPARAM)MAKELONG(0, 0));
 #endif
-    SendMessage(ToolTipHWND, TTM_SETDELAYTIME, (WPARAM)TTDT_AUTOPOP, (LPARAM)MAKELONG(20000, 0));
-    SendMessage(ToolTipHWND, TTM_SETMAXTIPWIDTH, 0, 400);
+    SendMessage (ToolTipHWND, TTM_SETDELAYTIME, (WPARAM)TTDT_AUTOPOP, (LPARAM)MAKELONG(20000, 0));
+    SendMessage (ToolTipHWND, TTM_SETMAXTIPWIDTH, 0, 400);
 
     EnumChildWindows (panelDlg, &childenumproc, (LPARAM)ppage[currentpage].nres->tmpl);
     SendMessage (panelDlg, WM_NULL, 0, 0);
@@ -10446,37 +10444,37 @@ static void createTreeView (HWND hDlg, int currentpage)
        icon = LoadIcon (hInst, MAKEINTRESOURCE (IDI_ROOT));
        ImageList_AddIcon (himl, icon);
     }
-    TVhDlg = GetDlgItem(hDlg, IDC_PANELTREE);
+    TVhDlg = GetDlgItem (hDlg, IDC_PANELTREE);
     TreeView_SetImageList (TVhDlg, himl, TVSIL_NORMAL);
 
     p = root = CreateFolderNode (TVhDlg, IDS_TREEVIEW_SETTINGS, NULL, ABOUT_ID, 0);
-    CN(ABOUT_ID);
-    CN(PATHS_ID);
-    CN(QUICKSTART_ID);
-    CN(LOADSAVE_ID);
+    CN (ABOUT_ID);
+    CN (PATHS_ID);
+    CN (QUICKSTART_ID);
+    CN (LOADSAVE_ID);
 #if FRONTEND == 1
-    CN(FRONTEND_ID);
+    CN (FRONTEND_ID);
 #endif
 
     p = CreateFolderNode (TVhDlg, IDS_TREEVIEW_HARDWARE, root, LOADSAVE_ID, CONFIG_TYPE_HARDWARE);
-    CN(CPU_ID);
-    CN(CHIPSET_ID);
-    CN(CHIPSET2_ID);
-    CN(KICKSTART_ID);
-    CN(MEMORY_ID);
-    CN(FLOPPY_ID);
-    CN(HARDDISK_ID);
+    CN (CPU_ID);
+    CN (CHIPSET_ID);
+    CN (CHIPSET2_ID);
+    CN (KICKSTART_ID);
+    CN (MEMORY_ID);
+    CN (FLOPPY_ID);
+    CN (HARDDISK_ID);
 
     p = CreateFolderNode (TVhDlg, IDS_TREEVIEW_HOST, root, LOADSAVE_ID, CONFIG_TYPE_HOST);
-    CN(DISPLAY_ID);
-    CN(SOUND_ID);
-    CN(PORTS_ID);
-    CN(INPUT_ID);
-    CN(AVIOUTPUT_ID);
-    CN(HW3D_ID);
-    CN(DISK_ID);
-    CN(MISC1_ID);
-    CN(MISC2_ID);
+    CN (DISPLAY_ID);
+    CN (SOUND_ID);
+    CN (PORTS_ID);
+    CN (INPUT_ID);
+    CN (AVIOUTPUT_ID);
+    CN (HW3D_ID);
+    CN (DISK_ID);
+    CN (MISC1_ID);
+    CN (MISC2_ID);
 
     TreeView_SelectItem (TVhDlg, ppage[currentpage].tv);
 }
@@ -10491,7 +10489,7 @@ static void centerWindow (HWND hDlg)
     POINT pt1, pt2;
 
     if (owner == NULL)
-       owner = GetDesktopWindow();
+       owner = GetDesktopWindow ();
     if (isfullscreen () <= 0) {
        regqueryint (NULL, "GUIPosX", &x);
        regqueryint (NULL, "GUIPosY", &y);
@@ -10499,9 +10497,9 @@ static void centerWindow (HWND hDlg)
        GetWindowRect (owner, &rcOwner);
        GetWindowRect (hDlg, &rcDlg);
        CopyRect (&rc, &rcOwner);
-       OffsetRect(&rcDlg, -rcDlg.left, -rcDlg.top);
-       OffsetRect(&rc, -rc.left, -rc.top);
-       OffsetRect(&rc, -rcDlg.right, -rcDlg.bottom);
+       OffsetRect (&rcDlg, -rcDlg.left, -rcDlg.top);
+       OffsetRect (&rc, -rc.left, -rc.top);
+       OffsetRect (&rc, -rcDlg.right, -rcDlg.bottom);
        x = rcOwner.left + (rc.right / 2);
        y = rcOwner.top + (rc.bottom / 2);
     }
@@ -10511,7 +10509,7 @@ static void centerWindow (HWND hDlg)
     pt2.x = x + 16;
     pt2.y = y + GetSystemMetrics (SM_CYMENU) + GetSystemMetrics (SM_CYBORDER);
     if (MonitorFromPoint (pt1, MONITOR_DEFAULTTONULL) == NULL || MonitorFromPoint (pt2, MONITOR_DEFAULTTONULL) == NULL) {
-       if (isfullscreen() > 0) {
+       if (isfullscreen () > 0) {
            x = 0;
            y = 0;
        } else {
@@ -10548,8 +10546,8 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage)
        return 0;
     drv = 0;
     if (currentpage < 0) {
-       GetClientRect(hMainWnd, &r2);
-       GetClientRect(hStatusWnd, &r);
+       GetClientRect (hMainWnd, &r2);
+       GetClientRect (hStatusWnd, &r);
        if (pt.y >= r2.bottom && pt.y < r2.bottom + r.bottom) {
            if (pt.x >= window_led_drives && pt.x < window_led_drives_end && window_led_drives > 0) {
                drv = pt.x - window_led_drives;
@@ -10578,7 +10576,7 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage)
        int type = -1;
 
        DragQueryFile (hd, i, file, sizeof (file));
-       flags = GetFileAttributes(file);
+       flags = GetFileAttributes (file);
        if (flags & FILE_ATTRIBUTE_DIRECTORY)
            type = ZFILE_HDF;
        if (type < 0) {
@@ -10698,7 +10696,7 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage)
 }
 
 static int dialogreturn;
-static INT_PTR CALLBACK DialogProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK DialogProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
 {
     static int recursive = 0;
     static int waitfornext;
@@ -10745,7 +10743,7 @@ static INT_PTR CALLBACK DialogProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP
        case WM_INITDIALOG:
            waitfornext = 0;
            guiDlg = hDlg;
-           SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon (GetModuleHandle (NULL), MAKEINTRESOURCE(IDI_APPICON)));
+           SendMessage (hDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon (GetModuleHandle (NULL), MAKEINTRESOURCE(IDI_APPICON)));
            if (full_property_sheet) {
                char tmp[100];
                WIN32GUI_LoadUIString (IDS_STARTEMULATION, tmp, sizeof (tmp));
@@ -10799,7 +10797,7 @@ static INT_PTR CALLBACK DialogProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP
                    return TRUE;
                case IDC_RESTARTEMU:
                    uae_restart (-1, NULL);
-                   exit_gui(1);
+                   exit_gui (1);
                    return TRUE;
                case IDHELP:
                    if (pHtmlHelp && ppage[currentpage].help)
@@ -10834,7 +10832,7 @@ static ACCEL EmptyAccel[] = {
     { 0, 0, 0 }
 };
 
-struct newresource *getresource(int tmpl)
+struct newresource *getresource (int tmpl)
 {
     char rid[10];
     HRSRC hrsrc;
@@ -10844,7 +10842,7 @@ struct newresource *getresource(int tmpl)
     struct newresource *nr;
     int size;
 
-    sprintf(rid,"#%d", tmpl);
+    sprintf (rid,"#%d", tmpl);
     hrsrc = FindResource (inst, rid, RT_DIALOG);
     if (!hrsrc) {
        inst = hInst;
@@ -10852,11 +10850,11 @@ struct newresource *getresource(int tmpl)
     }
     if (!hrsrc)
        return NULL;
-    res = LoadResource(inst, hrsrc);
+    res = LoadResource (inst, hrsrc);
     if (!res)
        return NULL;
-    resdata = LockResource(res);
-    size = SizeofResource(inst, hrsrc);
+    resdata = LockResource (res);
+    size = SizeofResource (inst, hrsrc);
     nr = xcalloc (sizeof (struct newresource), 1);
     newres = xmalloc (size);
     memcpy (newres, resdata, size);
@@ -10867,7 +10865,7 @@ struct newresource *getresource(int tmpl)
     return nr;
 }
 
-INT_PTR CustomDialogBox(int templ, HWND hDlg, DLGPROC proc)
+INT_PTR CustomDialogBox (int templ, HWND hDlg, DLGPROC proc)
 {
     struct newresource *res, *r;
     INT_PTR h = -1;
@@ -10909,7 +10907,7 @@ static int init_page (int tmpl, int icon, int title,
     int i = -1;
     struct newresource *res;
 
-    res = getresource(tmpl);
+    res = getresource (tmpl);
     if (!res)
        return -1;
     ppage[id].nres = res;
@@ -10933,7 +10931,7 @@ static int init_page (int tmpl, int icon, int title,
 
 static RECT dialog_rect;
 
-static void dialogmousemove(HWND hDlg)
+static void dialogmousemove (HWND hDlg)
 {
     static int newmx, newmy;
     RECT rc;
@@ -10941,17 +10939,25 @@ static void dialogmousemove(HWND hDlg)
     static POINT pt2;
     int dx, dy;
     int sw, sh;
+    int xstart, ystart;
+    MONITORINFOEX pmi;
 
-    if (full_property_sheet || isfullscreen() <= 0)
+    if (full_property_sheet || isfullscreen () <= 0)
        return;
-    GetCursorPos(&pt);
+    pmi.cbSize = sizeof (pmi);
+    GetMonitorInfo (MonitorFromWindow (hAmigaWnd, MONITOR_DEFAULTTOPRIMARY), (LPMONITORINFO)&pmi);
+    xstart = pmi.rcMonitor.left;
+    ystart = pmi.rcMonitor.top;
+    GetCursorPos (&pt);
+    pt.x -= xstart;
+    pt.y -= ystart;
     if (pt.x == pt2.x && pt.y == pt2.y)
        return;
-    sw = WIN32GFX_GetWidth();
-    sh = WIN32GFX_GetHeight();
+    sw = pmi.rcMonitor.right - pmi.rcMonitor.left;
+    sh = pmi.rcMonitor.bottom - pmi.rcMonitor.top;
     dx = dialog_x_offset;
     dy = dialog_y_offset;
-    GetWindowRect(hDlg, &rc);
+    GetWindowRect (hDlg, &rc);
     rc.right -= rc.left;
     rc.bottom -= rc.top;
     rc.left = 0;
@@ -10976,7 +10982,9 @@ static void dialogmousemove(HWND hDlg)
     if (dx != dialog_x_offset || dy != dialog_y_offset) {
        dialog_x_offset = dx;
        dialog_y_offset = dy;
-       SetWindowPos(hDlg, 0, dialog_x_offset, dialog_y_offset, 0, 0,
+       dx += xstart;
+       dy += ystart;
+       SetWindowPos (hDlg, 0, dx, dy, 0, 0,
            SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE);
     }
 }
@@ -11043,7 +11051,7 @@ static int GetSettings (int all_options, HWND hwnd)
 
     dialogreturn = -1;
     hAccelTable = NULL;
-    DragAcceptFiles(hwnd, TRUE);
+    DragAcceptFiles (hwnd, TRUE);
     if (first)
        write_log ("Entering GUI idle loop\n");
 
@@ -11110,9 +11118,9 @@ int gui_init (void)
 {
     int ret;
 
-    read_rom_list();
+    read_rom_list ();
     for (;;) {
-       ret = GetSettings(1, currprefs.win32_notaskbarbutton ? hHiddenWnd : NULL);
+       ret = GetSettings (1, currprefs.win32_notaskbarbutton ? hHiddenWnd : NULL);
        if (!restart_requested)
            break;
        restart_requested = 0;
@@ -11141,14 +11149,14 @@ void gui_exit (void)
     }
     FreeConfigStore ();
 #ifdef PARALLEL_PORT
-    closeprinter(); // Bernd Roesch
+    closeprinter (); // Bernd Roesch
 #endif
 }
 
 extern HWND hStatusWnd;
 struct gui_info gui_data;
 
-void check_prefs_changed_gui( void )
+void check_prefs_changed_gui (void)
 {
 }
 
@@ -11259,12 +11267,12 @@ void gui_led (int led, int on)
     } else if (led == 8) {
        pos = 1;
        ptr = drive_text + pos * 16;
-       sprintf(ptr, "CPU: %.0f%%", (double)((gui_data.idle) / 10.0));
+       sprintf (ptr, "CPU: %.0f%%", (double)((gui_data.idle) / 10.0));
     } else if (led == 9) {
        pos = 0;
        ptr = drive_text + pos * 16;
        if (gui_data.sndbuf_status < 3) {
-           sprintf(ptr, "SND: %+.0f%%", (double)((gui_data.sndbuf) / 10.0));
+           sprintf (ptr, "SND: %+.0f%%", (double)((gui_data.sndbuf) / 10.0));
        } else {
            strcpy (ptr, "SND: -");
            on = 0;
@@ -11299,7 +11307,7 @@ static int fsdialog (HWND *hwnd, DWORD *flags)
     if (isfullscreen () <= 0)
        return 0;
     hr = DirectDraw_FlipToGDISurface ();
-    if (FAILED(hr))
+    if (FAILED (hr))
        write_log ("FlipToGDISurface failed, %s\n", DXError (hr));
     *flags |= MB_SETFOREGROUND;
     *flags |= MB_TOPMOST;
@@ -11341,10 +11349,10 @@ int gui_message_multibutton (int flags, const char *format,...)
        ShowWindow (hAmigaWnd, SW_MINIMIZE);
 
     va_start (parms, format);
-    vsprintf( msg, format, parms );
+    vsprintf (msg, format, parms);
     va_end (parms);
-    write_log ( msg );
-    if (msg[strlen(msg)-1]!='\n')
+    write_log (msg);
+    if (msg[strlen (msg)-1]!='\n')
        write_log ("\n");
 
     WIN32GUI_LoadUIString (IDS_ERRORTITLE, szTitle, MAX_DPATH);
@@ -11379,7 +11387,7 @@ void gui_message (const char *format,...)
     HWND hwnd;
 
     va_start (parms, format);
-    vsprintf(msg, format, parms);
+    vsprintf (msg, format, parms);
     va_end (parms);
     if (full_property_sheet) {
        pre_gui_message (msg);
@@ -11401,7 +11409,7 @@ void gui_message (const char *format,...)
 
     if (flipflop)
        ShowWindow (hAmigaWnd, SW_RESTORE);
-    resume_sound();
+    resume_sound ();
     setmouseactive (focuso);
 }
 
@@ -11422,7 +11430,7 @@ void pre_gui_message (const char *format,...)
     vsprintf (msg, format, parms);
     va_end (parms);
     write_log (msg);
-    if (msg[strlen(msg)-1]!='\n')
+    if (msg[strlen (msg)-1]!='\n')
        write_log ("\n");
 
     WIN32GUI_LoadUIString (IDS_ERRORTITLE, szTitle, MAX_DPATH);
index 421bf5bf7bc9666ec02f77faab2164c0a44b12b0..3760d62066e36ed91506d5f035245b81563dfe76 100755 (executable)
                        <Tool
                                Name="VCCLCompilerTool"
                                Optimization="3"
-                               InlineFunctionExpansion="1"
+                               InlineFunctionExpansion="2"
                                EnableIntrinsicFunctions="true"
                                FavorSizeOrSpeed="1"
                                OmitFramePointers="true"
                        <Tool
                                Name="VCCLCompilerTool"
                                Optimization="3"
-                               InlineFunctionExpansion="1"
+                               InlineFunctionExpansion="2"
                                EnableIntrinsicFunctions="true"
                                FavorSizeOrSpeed="1"
                                OmitFramePointers="true"
index 7486573a988dc713e9143c397f30267576c11a71..1a9ec9bfcc571b58d9ccce64fc53a67043d9c260 100755 (executable)
@@ -1,10 +1,32 @@
 
+Beta 19:
+
+- lha/lzh archives with directory entries ("-lhd-") crash fix
+- GUI chip ram 8M option was unavailable (b17)
+- joyportx and input panel parameters (except input mappings)
+  supported via uae-configuration
+- less useless logging in fullscreen alt-tab
+- GUI autoscroll fixed when using fullscreen mode smaller than 640x480
+  on non-primary monitor 
+- non-AR cartridge emulation problems fixed
+- dont emulate chip ram mirroring if JIT direct is enabled at startup
+  (OS can detect wrong chip ram size, JIT does not support mirroring)
+- emulate "bus noise" (very far from real thing currently) when ECS
+  Agnus but only 512M RAM configuration (512k chip ram, 512k bus noise,
+  512k chip ram, 512k bus noise) In theory 1M/2M Agnus configuration
+  should be implemented because 1M Agnus + 1M chip = 1M chip ram + 1M
+  chip ram mirror but 2M Agnus + 1M chip = 1M chip ram + 1M of "bus
+  noise" (for example A500Plus) Later..
+- Picasso96 state file support fixed (not compatible with old states)
+- development PC CPU updated to Q9450 quad core CPU, 3.2GHz
+  currently, more/less overclock later :) (old CPU was E6600)
+
 Beta 18:
 
 - sprites were visible when they were outside of DDFSTRT/DDFSTOP range
   (which really is DDFSTRT - end of line, another undocumented
-  feature) "Fixes" demo Blittersweet (looks broken but it does look
-  exact same on real A500) This update may not be 100% correct yet,
+  feature) "Fixes" demo Blittersweet (looks more broken now but it does
+  look exact same on real A500) This update may not be 100% correct yet,
   it can break other programs. Test and complain :)
 - some archives mounted as a harddrive crashed
 
index eaf6079961194e71ebf5978b273864a413373b6c..942048fb15c7d3c0f031344d261bb345339243f7 100755 (executable)
@@ -556,9 +556,10 @@ void restore_state (char *filename)
                       name, len, end - chunk);
        xfree (chunk);
     }
-    restore_disk_finish();
-    restore_blitter_finish();
-    restore_akiko_finish();
+    restore_disk_finish ();
+    restore_blitter_finish ();
+    restore_akiko_finish ();
+    restore_p96_finish ();
     return;
 
     error:
@@ -633,8 +634,8 @@ int save_state (char *filename, char *description)
     int comp = savestate_docompress;
 
     if (!savestate_specialdump) {
-       state_incompatible_warn();
-       if (!save_filesys_cando()) {
+       state_incompatible_warn ();
+       if (!save_filesys_cando ()) {
            gui_message("Filesystem active. Try again later");
            return -1;
        }
index 2e43dae65cb447510f15fd2bf29bc81d4f39790e..633818a2a7f1c3a8923990b1a69100b2f7a0b851 100755 (executable)
@@ -739,7 +739,7 @@ void uaeserialdev_install (void)
     dw (0x0004); /* 0.4 */
     dw (0xD000); /* INITWORD */
     dw (0x0016); /* LIB_REVISION */
-    dw (0x0000); /* end of table already ??? */
+    dw (0x0000);
     dw (0xC000); /* INITLONG */
     dw (0x0018); /* LIB_IDSTRING */
     dl (ROM_uaeserialdev_resid);
diff --git a/zfile.c b/zfile.c
index 5970ee6956d923a9f1adbe4c3e114c5414fa4a76..e87af8e17c2214358b2e3c521b5bf77291cab66e 100755 (executable)
--- a/zfile.c
+++ b/zfile.c
@@ -1189,6 +1189,13 @@ struct znode *zvolume_adddir_abs(struct zvolume *zv, struct zarchive_info *zai)
     char *p, *p2;
     int i;
 
+    if (strlen (path) > 0) {
+       /* remove possible trailing / or \ */
+       char last;
+       last = path[strlen (path) - 1];
+       if (last == '/' || last == '\\')
+           path[strlen (path) - 1] = 0;
+    }
     zn2 = &zv->root;
     p = p2 = path;
     for (i = 0; path[i]; i++) {