]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
imported winuaesrc1330b2.zip
authorToni Wilen <twilen@winuae.net>
Thu, 21 Sep 2006 16:09:34 +0000 (19:09 +0300)
committerToni Wilen <twilen@winuae.net>
Mon, 22 Feb 2010 19:29:38 +0000 (21:29 +0200)
32 files changed:
arcadia.c
audio.c
bsdsocket.c
custom.c
drawing.c
filesys.c
filesys_bootrom.c
fpp.c
gencpu.c
gfxutil.c
hardfile.c
include/gui.h
include/options.h
inputdevice.c
memory.c
od-win32/dinput.c
od-win32/keyboard_win32.c
od-win32/machdep/maccess.h
od-win32/machdep/rpt.h
od-win32/machdep/support.c
od-win32/opengl.c
od-win32/posixemu.c
od-win32/resources/winuae.rc
od-win32/sounddep/sound.c
od-win32/sounddep/sound.h
od-win32/sounddep/sound3.c [new file with mode: 0755]
od-win32/win32.c
od-win32/win32.h
od-win32/win32gfx.c
od-win32/win32gui.c
od-win32/writelog.c
scsiemul.c

index fbb66490cbf8fd7dc07643d4011e84c22eb2e216..efccddd6ec4c3382bd28edc916d1f4d2fc09be92 100755 (executable)
--- a/arcadia.c
+++ b/arcadia.c
@@ -50,9 +50,7 @@ static struct arcadiarom roms[]       = {
     { "ar_ldrba.zip", "scpa211", "ldrb_", 1, 2, 3, 4, 1, 0, 7, 5, 6 },
     { "ar_ninj.zip", "scpa211", "ninj_", 1, 1, 6, 5, 7, 4, 2, 0, 3 },
     { "ar_rdwr.zip", "scpa211", "rdwr_", 1, 3, 1, 6, 4, 0, 5, 2, 7 },
-
     { "ar_socc.zip", "scpav3_0.1", "socc30.", 2, 0, 7, 1, 6, 5, 4, 3, 2 },
-
     { "ar_sdwr.zip", "scpa211", "sdwr_", 1, 6, 3, 4, 5, 2, 1, 0, 7 },
     { "ar_spot.zip", "scpav3_0.1", "spotv2.", 0, 7, 6, 5, 4, 3, 2, 1, 0 },
     { "ar_sprg.zip", "scpa211", "sprg_", 1, 4, 7, 3, 0, 6, 5, 2, 1 },
diff --git a/audio.c b/audio.c
index c490ecfe1a0fab50df4fdc03a515e7b8d1e6e4e0..1e7437b6ca646c2eab443aca9c07dadb4deb57ad 100755 (executable)
--- a/audio.c
+++ b/audio.c
@@ -36,6 +36,7 @@
 #include "traps.h"
 #include "ahidsound.h"
 #endif
+#include "threaddep/thread.h"
 
 #include <math.h>
 
index 67e8fe82029e57cf0814c561bb68ac65184508f1..7069094ec71499e4be95e81c34bd6e88c6da1ea3 100755 (executable)
@@ -793,8 +793,63 @@ static uae_u32 REGPARAM2 bsdsocklib_ReleaseSocket (TrapContext *context)
 /* ReleaseCopyOfSocket(fd, id)(d0/d1) */
 static uae_u32 REGPARAM2 bsdsocklib_ReleaseCopyOfSocket (TrapContext *context)
 {
-    write_log ("bsdsocket: UNSUPPORTED: ReleaseCopyOfSocket()\n");
-    return 0;
+   struct socketbase *sb = get_socketbase (context);
+   int sd;
+   long id;
+   SOCKET_TYPE s;
+   int i;
+   uae_u32 flags;
+
+   sd = m68k_dreg (&context->regs, 0);
+   id = m68k_dreg (&context->regs, 1);
+
+   sd++;
+   TRACE (("ReleaseSocket(%d,%d) -> ", sd, id));
+
+   s = getsock (sb, sd);
+
+    if (s != -1) {
+       flags = sb->ftable[sd - 1];
+
+       if (flags & REP_ALL) {
+           write_log ("bsdsocket: ERROR: ReleaseCopyOfSocket() is not supported for sockets with async event notification enabled!\n");
+           return -1;
+       }
+       if (id == UNIQUE_ID) {
+           for (;;) {
+               if (sockpoolindex (curruniqid) == -1)
+                   break;
+               curruniqid += 129;
+               if ((unsigned long) (curruniqid + 1) < 65536)
+                   curruniqid += 65537;
+           }
+           id = curruniqid;
+       } else if (id < 0 && id > 65535) {
+           if (sockpoolindex (id) != -1) {
+               TRACE (("[unique ID already exists]\n"));
+               return -1;
+           }
+       }
+       i = sockpoolindex (-1);
+
+       if (i == -1) {
+           TRACE (("-1\n"));
+           write_log (("bsdsocket: ERROR: Global socket pool overflow\n"));
+           return -1;
+       }
+       sockpoolids[i] = id;
+       sockpoolsocks[i] = s;
+       sockpoolflags[i] = flags;
+
+       TRACE (("id %d s 0x%x\n", id,s));
+
+    } else {
+
+       TRACE (("[invalid socket descriptor]\n"));
+       return -1;
+    }
+
+    return id;
 }
 
 /* Errno()() */
index 16ccd6dd0d22e241a0fb46936efcee4b3108fb3e..2064ea60f882fabc6ccd67efe3e5b5d9592d13d7 100755 (executable)
--- a/custom.c
+++ b/custom.c
@@ -4108,6 +4108,7 @@ void fpscounter_reset (void)
 static void fpscounter (void)
 {
     frame_time_t now, last;
+    int mcnt = 10;
 
     now = read_processor_time ();
     last = now - lastframetime;
@@ -4119,9 +4120,9 @@ static void fpscounter (void)
     frametime += last;
     frametime2 += last;
     timeframes++;
-    if ((timeframes & 31) == 0) {
-       double idle = 1000 - (idletime == 0 ? 0.0 : (double)idletime * 1000.0 / (vsynctime * 32.0));
-       int fps = frametime2 == 0 ? 0 : (syncbase * 32) / (frametime2 / 10);
+    if ((timeframes % mcnt) == 0) {
+       double idle = 1000 - (idletime == 0 ? 0.0 : (double)idletime * 1000.0 / (vsynctime * mcnt));
+       int fps = frametime2 == 0 ? 0 : (syncbase * mcnt) / (frametime2 / 10);
        if (fps > 9999)
            fps = 9999;
        if (idle < 0)
index 304e3ed6e37382907e350a123a1e0e0e908888f6..df9586af4175852807125344ece69bba20b675cd 100755 (executable)
--- a/drawing.c
+++ b/drawing.c
@@ -1747,18 +1747,18 @@ static int td_pos = (TD_RIGHT|TD_BOTTOM);
 
 #define TD_TOTAL_HEIGHT (TD_PADY * 2 + TD_NUM_HEIGHT)
 
-#define NUMBERS_NUM 14
+#define NUMBERS_NUM 16
 
 #define TD_BORDER 0x333
 
-static const char *numbers = { /* ugly  0123456789CHD% */
-"+++++++--++++-+++++++++++++++++-++++++++++++++++++++++++++++++++++++++++++++-++++++-++++----++---+"
-"+xxxxx+--+xx+-+xxxxx++xxxxx++x+-+x++xxxxx++xxxxx++xxxxx++xxxxx++xxxxx++xxxx+-+x++x+-+xxx++-+xx+-+x"
-"+x+++x+--++x+-+++++x++++++x++x+++x++x++++++x++++++++++x++x+++x++x+++x++x++++-+x++x+-+x++x+--+x++x+"
-"+x+-+x+---+x+-+xxxxx++xxxxx++xxxxx++xxxxx++xxxxx+--++x+-+xxxxx++xxxxx++x+----+xxxx+-+x++x+----+x+-"
-"+x+++x+---+x+-+x++++++++++x++++++x++++++x++x+++x+--+x+--+x+++x++++++x++x++++-+x++x+-+x++x+---+x+x+"
-"+xxxxx+---+x+-+xxxxx++xxxxx+----+x++xxxxx++xxxxx+--+x+--+xxxxx++xxxxx++xxxx+-+x++x+-+xxx+---+x++xx"
-"+++++++---+++-++++++++++++++----+++++++++++++++++--+++--++++++++++++++++++++-++++++-++++----------"
+static const char *numbers = { /* ugly  0123456789CHD%+- */
+"+++++++--++++-+++++++++++++++++-++++++++++++++++++++++++++++++++++++++++++++-++++++-++++----++---+--------------"
+"+xxxxx+--+xx+-+xxxxx++xxxxx++x+-+x++xxxxx++xxxxx++xxxxx++xxxxx++xxxxx++xxxx+-+x++x+-+xxx++-+xx+-+x---+----------"
+"+x+++x+--++x+-+++++x++++++x++x+++x++x++++++x++++++++++x++x+++x++x+++x++x++++-+x++x+-+x++x+--+x++x+--+x+----+++--"
+"+x+-+x+---+x+-+xxxxx++xxxxx++xxxxx++xxxxx++xxxxx+--++x+-+xxxxx++xxxxx++x+----+xxxx+-+x++x+----+x+--+xxx+--+xxx+-"
+"+x+++x+---+x+-+x++++++++++x++++++x++++++x++x+++x+--+x+--+x+++x++++++x++x++++-+x++x+-+x++x+---+x+x+--+x+----+++--"
+"+xxxxx+---+x+-+xxxxx++xxxxx+----+x++xxxxx++xxxxx+--+x+--+xxxxx++xxxxx++xxxx+-+x++x+-+xxx+---+x++xx--------------"
+"+++++++---+++-++++++++++++++----+++++++++++++++++--+++--++++++++++++++++++++-++++++-++++------------------------"
 };
 
 STATIC_INLINE void putpixel (int x, xcolnr c8)
@@ -1821,7 +1821,7 @@ static void draw_status_line (int line)
        if (led >= 1 && led <= 4) {
            int pled = led - 1;
            int track = gui_data.drive_track[pled];
-           pos = 5 + pled;
+           pos = 6 + pled;
            on_rgb = 0x0c0;
            off_rgb = 0x030;
            if (!gui_data.drive_disabled[pled]) {
@@ -1834,12 +1834,12 @@ static void draw_status_line (int line)
            }
            side = gui_data.drive_side;
        } else if (led == 0) {
-           pos = 2;
+           pos = 3;
            on = gui_data.powerled;
            on_rgb = 0xc00;
            off_rgb = 0x300;
        } else if (led == 5) {
-           pos = 4;
+           pos = 5;
            on = gui_data.cd;
            on_rgb = 0x00c;
            off_rgb = 0x003;
@@ -1847,7 +1847,7 @@ static void draw_status_line (int line)
            num2 = 10;
            num3 = 12;
        } else if (led == 6) {
-           pos = 3;
+           pos = 4;
            on = gui_data.hd;
            on_rgb = on == 2 ? 0xc00 : 0x00c;
            off_rgb = 0x003;
@@ -1856,7 +1856,7 @@ static void draw_status_line (int line)
            num3 = 12;
        } else if (led == 7) {
            int fps = (gui_data.fps + 5) / 10;
-           pos = 1;
+           pos = 2;
            on_rgb = 0x000;
            off_rgb = 0x000;
            num1 = fps / 100;
@@ -1867,7 +1867,7 @@ static void draw_status_line (int line)
                am = 2;
        } else if (led == 8) {
            int idle = (gui_data.idle + 5) / 10;
-           pos = 0;
+           pos = 1;
            on = framecnt;
            on_rgb = 0xc00;
            off_rgb = 0x000;
@@ -1876,8 +1876,19 @@ static void draw_status_line (int line)
            num3 = idle % 10;
            num4 = num1 == 0 ? 13 : -1;
            am = 3;
+       } else if (led == 9) {
+           int snd = abs(gui_data.sndbuf + 5) / 10;
+           if (snd > 99)
+               snd = 99;
+           pos = 0;
+           on = framecnt;
+           on_rgb = 0xc00;
+           off_rgb = 0x000;
+           num1 = gui_data.sndbuf < 0 ? 15 : 14;
+           num2 = snd / 10;
+           num3 = snd % 10;
+           am = 3;
        }
-
        c = xcolors[on ? on_rgb : off_rgb];
        if (y == 0 || y == TD_TOTAL_HEIGHT - 1)
            c = xcolors[TD_BORDER];
index 1a665fee2f61afcbf4e31c66e07c30426b2a60ef..7ed8073ab7b14228fc0424122514368994935d06 100755 (executable)
--- a/filesys.c
+++ b/filesys.c
@@ -3267,6 +3267,12 @@ action_flush (Unit *unit, dpacket packet)
     PUT_PCK_RES1 (packet, DOS_TRUE);
 }
 
+int last_n, last_n2;
+void blehint(void)
+{
+    do_uae_int_requested();
+}
+
 /* We don't want multiple interrupts to be active at the same time. I don't
  * know whether AmigaOS takes care of that, but this does. */
 static uae_sem_t singlethread_int_sem;
@@ -3275,9 +3281,13 @@ static uae_u32 REGPARAM2 exter_int_helper (TrapContext *context)
 {
     UnitInfo *uip = current_mountinfo.ui;
     uaecptr port;
+    int n = m68k_dreg (&context->regs, 0);
     static int unit_no;
 
-    switch (m68k_dreg (&context->regs, 0)) {
+    last_n = n;
+    last_n2 = -1;
+
+    switch (n) {
      case 0:
        /* Determine whether a given EXTER interrupt is for us. */
        if (uae_int_requested) {
@@ -3301,7 +3311,7 @@ static uae_u32 REGPARAM2 exter_int_helper (TrapContext *context)
         * in this switch statement which are called from the interrupt handler.
         */
 #ifdef UAE_FILESYS_THREADS
-       {
+        {
            Unit *unit = find_unit (m68k_areg (&context->regs, 5));
            uaecptr msg = m68k_areg (&context->regs, 4);
            unit->cmds_complete = unit->cmds_acked;
@@ -3396,6 +3406,9 @@ static uae_u32 REGPARAM2 exter_int_helper (TrapContext *context)
            return 1;
        }
        break;
+     case 3:
+        uae_sem_wait (&singlethread_int_sem);
+        break;
      case 4:
        /* Exit the interrupt, and release the single-threading lock. */
        uae_sem_post (&singlethread_int_sem);
index fdf17df14a8ea3aee3afff87c83b18d735272bfd..30267c1c1974c1170893d04067cc42d536771fd1 100755 (executable)
@@ -2,15 +2,15 @@
  db(0x60); db(0x00); db(0x04); db(0xf6); db(0x00); db(0x00); db(0x03); db(0xb2);
  db(0x00); db(0x00); db(0x00); db(0x34); db(0x00); db(0x00); db(0x00); db(0xd4);
  db(0x00); db(0x00); db(0x00); db(0x20); db(0x00); db(0x00); db(0x01); db(0x8e);
- db(0x00); db(0x00); db(0x06); db(0xb6); db(0x00); db(0x00); db(0x07); db(0xda);
- db(0x43); db(0xfa); db(0x09); db(0xa6); db(0x4e); db(0xae); db(0xff); db(0xa0);
+ db(0x00); db(0x00); db(0x06); db(0xb8); db(0x00); db(0x00); db(0x07); db(0xdc);
+ db(0x43); db(0xfa); db(0x09); db(0xa8); db(0x4e); db(0xae); db(0xff); db(0xa0);
  db(0x20); db(0x40); db(0x20); db(0x28); db(0x00); db(0x16); db(0x20); db(0x40);
  db(0x4e); db(0x90); db(0x4e); db(0x75); db(0x48); db(0xe7); db(0xff); db(0xfe);
  db(0x2c); db(0x78); db(0x00); db(0x04); db(0x30); db(0x3c); db(0xff); db(0xfc);
- db(0x61); db(0x00); db(0x06); db(0x64); db(0x2a); db(0x50); db(0x43); db(0xfa);
- db(0x09); db(0x9e); db(0x70); db(0x24); db(0x7a); db(0x00); db(0x4e); db(0xae);
+ db(0x61); db(0x00); db(0x06); db(0x66); db(0x2a); db(0x50); db(0x43); db(0xfa);
+ db(0x09); db(0xa0); db(0x70); db(0x24); db(0x7a); db(0x00); db(0x4e); db(0xae);
  db(0xfd); db(0xd8); db(0x4a); db(0x80); db(0x66); db(0x0c); db(0x43); db(0xfa);
- db(0x09); db(0x8e); db(0x70); db(0x00); db(0x7a); db(0x01); db(0x4e); db(0xae);
+ db(0x09); db(0x90); db(0x70); db(0x00); db(0x7a); db(0x01); db(0x4e); db(0xae);
  db(0xfd); db(0xd8); db(0x28); db(0x40); db(0x20); db(0x3c); db(0x00); db(0x00);
  db(0x02); db(0x2c); db(0x72); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a);
  db(0x26); db(0x40); db(0x27); db(0x4c); db(0x01); db(0x9c); db(0x7c); db(0x00);
  db(0x48); db(0x46); db(0x60); db(0xe4); db(0x2c); db(0x1f); db(0x52); db(0x46);
  db(0x60); db(0xd6); db(0x2c); db(0x78); db(0x00); db(0x04); db(0x22); db(0x4c);
  db(0x4e); db(0xae); db(0xfe); db(0x62); db(0x30); db(0x3c); db(0xff); db(0x80);
- db(0x61); db(0x00); db(0x05); db(0xf4); db(0x4e); db(0x90); db(0x72); db(0x03);
+ db(0x61); db(0x00); db(0x05); db(0xf6); db(0x4e); db(0x90); db(0x72); db(0x03);
  db(0x74); db(0xf6); db(0x20); db(0x7c); db(0x00); db(0x20); db(0x00); db(0x00);
  db(0x90); db(0x88); db(0x65); db(0x0a); db(0x67); db(0x08); db(0x78); db(0x00);
  db(0x22); db(0x44); db(0x4e); db(0xae); db(0xfd); db(0x96); db(0x4c); db(0xdf);
  db(0x7f); db(0xff); db(0x4e); db(0x75); db(0x48); db(0xe7); db(0x00); db(0x20);
- db(0x30); db(0x3c); db(0xff); db(0x50); db(0x61); db(0x00); db(0x05); db(0xc8);
+ db(0x30); db(0x3c); db(0xff); db(0x50); db(0x61); db(0x00); db(0x05); db(0xca);
  db(0x70); db(0x00); db(0x4e); db(0x90); db(0x4a); db(0x80); db(0x67); db(0x00);
  db(0x00); db(0xa0); db(0x2c); db(0x78); db(0x00); db(0x04); db(0x30); db(0x3c);
- db(0xff); db(0x50); db(0x61); db(0x00); db(0x05); db(0xb2); db(0x70); db(0x02);
+ db(0xff); db(0x50); db(0x61); db(0x00); db(0x05); db(0xb4); db(0x70); db(0x02);
  db(0x4e); db(0x90); db(0x0c); db(0x40); db(0x00); db(0x01); db(0x6d); db(0x7a);
  db(0x6e); db(0x06); db(0x4e); db(0xae); db(0xfe); db(0x92); db(0x60); db(0xe6);
  db(0x0c); db(0x40); db(0x00); db(0x02); db(0x6e); db(0x08); db(0x20); db(0x01);
  db(0x25); db(0x49); db(0x00); db(0x1a); db(0x20); db(0x69); db(0x00); db(0x10);
  db(0x22); db(0x4a); db(0x4e); db(0xae); db(0xfe); db(0x92); db(0x60); db(0x00);
  db(0xff); db(0x76); db(0x30); db(0x3c); db(0xff); db(0x50); db(0x61); db(0x00);
- db(0x05); db(0x26); db(0x70); db(0x04); db(0x4e); db(0x90); db(0x70); db(0x01);
+ db(0x05); db(0x28); db(0x70); db(0x04); db(0x4e); db(0x90); db(0x70); db(0x01);
  db(0x4c); db(0xdf); db(0x04); db(0x00); db(0x4e); db(0x75); db(0x48); db(0xe7);
  db(0xc0); db(0xc0); db(0x70); db(0x1a); db(0x22); db(0x3c); db(0x00); db(0x01);
  db(0x00); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x22); db(0x40);
- db(0x41); db(0xfa); db(0x08); db(0x17); db(0x23); db(0x48); db(0x00); db(0x0a);
+ db(0x41); db(0xfa); db(0x08); db(0x19); db(0x23); db(0x48); db(0x00); db(0x0a);
  db(0x41); db(0xfa); db(0xff); db(0x2a); db(0x23); db(0x48); db(0x00); db(0x0e);
  db(0x41); db(0xfa); db(0xff); db(0x22); db(0x23); db(0x48); db(0x00); db(0x12);
  db(0x33); db(0x7c); db(0x02); db(0x14); db(0x00); db(0x08); db(0x70); db(0x03);
@@ -64,7 +64,7 @@
  db(0x00); db(0x00); db(0x00); db(0x0e); db(0x52); db(0x40); db(0x0c); db(0x40);
  db(0x00); db(0x8c); db(0x66); db(0xf2); db(0x20); db(0x0a); db(0xe4); db(0x88);
  db(0x21); db(0x40); db(0x00); db(0x36); db(0x22); db(0x48); db(0x41); db(0xfa);
- db(0x07); db(0xb1); db(0x23); db(0x48); db(0x00); db(0x0a); db(0x20); db(0x6b);
+ db(0x07); db(0xb3); db(0x23); db(0x48); db(0x00); db(0x0a); db(0x20); db(0x6b);
  db(0x01); db(0x98); db(0x41); db(0xe8); db(0x00); db(0x12); db(0x4e); db(0xae);
  db(0xff); db(0x10); db(0x4c); db(0xdf); db(0x4f); db(0x03); db(0x4e); db(0x75);
  db(0x48); db(0xe7); db(0x7f); db(0x7e); db(0x2c); db(0x78); db(0x00); db(0x04);
  db(0x60); db(0xd4); db(0x48); db(0xe7); db(0x40); db(0xe2); db(0x2c); db(0x78);
  db(0x00); db(0x04); db(0x41); db(0xee); db(0x01); db(0x50); db(0x20); db(0x50);
  db(0x4a); db(0x90); db(0x67); db(0x1a); db(0x22); db(0x68); db(0x00); db(0x0a);
- db(0x45); db(0xfa); db(0x06); db(0x9e); db(0x10); db(0x19); db(0x12); db(0x1a);
+ db(0x45); db(0xfa); db(0x06); db(0xa0); db(0x10); db(0x19); db(0x12); db(0x1a);
  db(0xb0); db(0x01); db(0x66); db(0x06); db(0x4a); db(0x00); db(0x67); db(0x42);
  db(0x60); db(0xf2); db(0x20); db(0x50); db(0x60); db(0xe2); db(0x70); db(0x20);
  db(0x22); db(0x3c); db(0x00); db(0x01); db(0x00); db(0x01); db(0x4e); db(0xae);
  db(0xff); db(0x3a); db(0x24); db(0x40); db(0x15); db(0x7c); db(0x00); db(0x08);
- db(0x00); db(0x08); db(0x41); db(0xfa); db(0x06); db(0x74); db(0x25); db(0x48);
- db(0x00); db(0x0a); db(0x41); db(0xfa); db(0x06); db(0x2d); db(0x25); db(0x48);
+ db(0x00); db(0x08); db(0x41); db(0xfa); db(0x06); db(0x76); db(0x25); db(0x48);
+ db(0x00); db(0x0a); db(0x41); db(0xfa); db(0x06); db(0x2f); db(0x25); db(0x48);
  db(0x00); db(0x0e); db(0x41); db(0xea); db(0x00); db(0x12); db(0x20); db(0x88);
  db(0x58); db(0x90); db(0x21); db(0x48); db(0x00); db(0x08); db(0x41); db(0xee);
  db(0x01); db(0x50); db(0x22); db(0x4a); db(0x4e); db(0xae); db(0xff); db(0x0a);
  db(0x20); db(0x4a); db(0x20); db(0x08); db(0x4c); db(0xdf); db(0x47); db(0x02);
  db(0x4e); db(0x75); db(0x61); db(0x00); db(0xff); db(0x8e); db(0x21); db(0x40);
  db(0x01); db(0x98); db(0x2f); db(0x08); db(0x30); db(0x3c); db(0xff); db(0xfc);
- db(0x61); db(0x00); db(0x02); db(0xe4); db(0x2a); db(0x50); db(0x30); db(0x3c);
- db(0xff); db(0x28); db(0x61); db(0x00); db(0x02); db(0xda); db(0x22); db(0x48);
+ db(0x61); db(0x00); db(0x02); db(0xe6); db(0x2a); db(0x50); db(0x30); db(0x3c);
+ db(0xff); db(0x28); db(0x61); db(0x00); db(0x02); db(0xdc); db(0x22); db(0x48);
  db(0x20); db(0x5f); db(0x42); db(0xa8); db(0x01); db(0x90); db(0x42); db(0xa8);
  db(0x01); db(0x94); db(0x4e); db(0x91); db(0x26); db(0x00); db(0x0c); db(0x83);
  db(0xff); db(0xff); db(0xff); db(0xfe); db(0x67); db(0x00); db(0xfc); db(0xec);
  db(0x00); db(0x04); db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x20); db(0x5f);
  db(0x21); db(0x40); db(0x01); db(0x94); db(0x4a); db(0x83); db(0x6a); db(0x10);
  db(0x22); db(0x48); db(0x30); db(0x3c); db(0xff); db(0x20); db(0x61); db(0x00);
- db(0x02); db(0x86); db(0x4e); db(0x90); db(0x60); db(0x00); db(0x00); db(0x28);
+ db(0x02); db(0x88); db(0x4e); db(0x90); db(0x60); db(0x00); db(0x00); db(0x28);
  db(0x2c); db(0x4c); db(0x2f); db(0x08); db(0x4e); db(0xae); db(0xff); db(0x70);
  db(0x20); db(0x5f); db(0x22); db(0x48); db(0x26); db(0x40); db(0x30); db(0x3c);
- db(0xff); db(0x20); db(0x61); db(0x00); db(0x02); db(0x6a); db(0x4e); db(0x90);
+ db(0xff); db(0x20); db(0x61); db(0x00); db(0x02); db(0x6c); db(0x4e); db(0x90);
  db(0x70); db(0x00); db(0x27); db(0x40); db(0x00); db(0x08); db(0x27); db(0x40);
  db(0x00); db(0x10); db(0x27); db(0x40); db(0x00); db(0x20); db(0x4a); db(0xa9);
  db(0x01); db(0x94); db(0x67); db(0x28); db(0x20); db(0x69); db(0x01); db(0x94);
  db(0x4c); db(0xdf); db(0x03); db(0x01); db(0x4a); db(0x80); db(0x67); db(0x04);
  db(0x61); db(0x00); db(0xfd); db(0x50); db(0x4a); db(0x83); db(0x6b); db(0x00);
  db(0xfc); db(0x52); db(0x30); db(0x3c); db(0xff); db(0x18); db(0x61); db(0x00);
- db(0x02); db(0x1e); db(0x4e); db(0x90); db(0x20); db(0x03); db(0x16); db(0x29);
+ db(0x02); db(0x20); db(0x4e); db(0x90); db(0x20); db(0x03); db(0x16); db(0x29);
  db(0x00); db(0x4f); db(0x4a); db(0x80); db(0x66); db(0x1a); db(0x27); db(0x7c);
  db(0x00); db(0x00); db(0x0f); db(0xa0); db(0x00); db(0x14); db(0x43); db(0xfa);
  db(0xfb); db(0x5c); db(0x20); db(0x09); db(0xe4); db(0x88); db(0x27); db(0x40);
  db(0x70); db(0xff); db(0x2c); db(0x4c); db(0x4e); db(0xee); db(0xff); db(0x6a);
  db(0x2c); db(0x78); db(0x00); db(0x04); db(0x70); db(0x00); db(0x22); db(0x40);
  db(0x4e); db(0xae); db(0xfe); db(0xda); db(0x20); db(0x40); db(0x4b); db(0xe8);
- db(0x00); db(0x5c); db(0x43); db(0xfa); db(0x04); db(0xbc); db(0x70); db(0x00);
+ db(0x00); db(0x5c); db(0x43); db(0xfa); db(0x04); db(0xbe); db(0x70); db(0x00);
  db(0x4e); db(0xae); db(0xfd); db(0xd8); db(0x24); db(0x40); db(0x20); db(0x3c);
  db(0x00); db(0x00); db(0x00); db(0x9e); db(0x22); db(0x3c); db(0x00); db(0x01);
  db(0x00); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x26); db(0x40);
  db(0x27); db(0x46); db(0x00); db(0x08); db(0x7a); db(0x00); db(0x20); db(0x4d);
  db(0x4e); db(0xae); db(0xfe); db(0x80); db(0x20); db(0x4d); db(0x4e); db(0xae);
  db(0xfe); db(0x8c); db(0x28); db(0x40); db(0x26); db(0x2c); db(0x00); db(0x0a);
- db(0x30); db(0x3c); db(0xff); db(0x40); db(0x61); db(0x00); db(0x01); db(0x58);
- db(0x70); db(0x00); db(0x4e); db(0x90); db(0x61); db(0x00); db(0x02); db(0x88);
- db(0x60); db(0x00); db(0x00); db(0xd8); db(0x61); db(0x00); db(0x02); db(0x80);
+ db(0x30); db(0x3c); db(0xff); db(0x40); db(0x61); db(0x00); db(0x01); db(0x5a);
+ db(0x70); db(0x00); db(0x4e); db(0x90); db(0x61); db(0x00); db(0x02); db(0x8a);
+ db(0x60); db(0x00); db(0x00); db(0xda); db(0x61); db(0x00); db(0x02); db(0x82);
  db(0x20); db(0x4d); db(0x4e); db(0xae); db(0xfe); db(0x80); db(0x20); db(0x4d);
  db(0x4e); db(0xae); db(0xfe); db(0x8c); db(0x28); db(0x40); db(0x0c); db(0x6c);
  db(0x00); db(0x26); db(0x00); db(0x12); db(0x66); db(0x4a); db(0x0c); db(0xac);
  db(0x00); db(0x10); db(0x22); db(0x4c); db(0x12); db(0xbc); db(0x00); db(0x08);
  db(0x4e); db(0xae); db(0xfe); db(0x92); db(0x60); db(0xa6); db(0x22); db(0x4c);
  db(0x70); db(0x26); db(0x4e); db(0xae); db(0xff); db(0x2e); db(0x60); db(0x9c);
- db(0x26); db(0x2c); db(0x00); db(0x0a); db(0x66); db(0x3c); db(0x30); db(0x3c);
- db(0xff); db(0x50); db(0x61); db(0x00); db(0x00); db(0xda); db(0x70); db(0x01);
+ db(0x26); db(0x2c); db(0x00); db(0x0a); db(0x66); db(0x3e); db(0x30); db(0x3c);
+ db(0xff); db(0x50); db(0x61); db(0x00); db(0x00); db(0xdc); db(0x70); db(0x01);
  db(0x4e); db(0x90); db(0x45); db(0xeb); db(0x00); db(0x04); db(0x20); db(0x52);
- db(0x20); db(0x08); db(0x67); db(0x80); db(0x22); db(0x50); db(0x20); db(0x40);
- db(0x20); db(0x28); db(0x00); db(0x04); db(0x6a); db(0x16); db(0x48); db(0xe7);
- db(0x00); db(0xc0); db(0x28); db(0x68); db(0x00); db(0x0a); db(0x61); db(0x4a);
- db(0x53); db(0x85); db(0x4c); db(0xdf); db(0x03); db(0x00); db(0x24); db(0x89);
- db(0x20); db(0x49); db(0x60); db(0xdc); db(0x24); db(0x48); db(0x20); db(0x49);
- db(0x60); db(0xd6); db(0x0c); db(0x85); db(0x00); db(0x00); db(0x00); db(0x14);
- db(0x65); db(0x00); db(0x00); db(0x0a); db(0x70); db(0x01); db(0x29); db(0x40);
- db(0x00); db(0x04); db(0x60); db(0x12); db(0x61); db(0x32); db(0x30); db(0x3c);
- db(0xff); db(0x30); db(0x61); db(0x00); db(0x00); db(0x8a); db(0x4e); db(0x90);
- db(0x4a); db(0x80); db(0x67); db(0x0e); db(0x52); db(0x85); db(0x28); db(0xab);
- db(0x00); db(0x04); db(0x27); db(0x4c); db(0x00); db(0x04); db(0x60); db(0x00);
- db(0xff); db(0x2c); db(0x28); db(0x43); db(0x61); db(0x04); db(0x60); db(0x00);
- db(0xff); db(0x24); db(0x22); db(0x54); db(0x20); db(0x6c); db(0x00); db(0x04);
- db(0x29); db(0x4d); db(0x00); db(0x04); db(0x4e); db(0xee); db(0xfe); db(0x92);
- db(0x2f); db(0x05); db(0x7a); db(0xfc); db(0x24); db(0x53); db(0x2e); db(0x0a);
- db(0x22); db(0x0a); db(0x67); db(0x00); db(0x00); db(0x0c); db(0x52); db(0x85);
- db(0x67); db(0x1e); db(0x22); db(0x4a); db(0x24); db(0x52); db(0x60); db(0xf0);
- db(0x52); db(0x85); db(0x67); db(0x3c); db(0x24); db(0x47); db(0x70); db(0x18);
- db(0x72); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x52); db(0x46);
- db(0x24); db(0x40); db(0x24); db(0x87); db(0x2e); db(0x0a); db(0x60); db(0xe8);
- db(0x20); db(0x12); db(0x67); db(0x24); db(0x20); db(0x40); db(0x20); db(0x10);
- db(0x67); db(0x1e); db(0x20); db(0x40); db(0x20); db(0x10); db(0x67); db(0x18);
- db(0x70); db(0x00); db(0x22); db(0x80); db(0x22); db(0x4a); db(0x24); db(0x51);
- db(0x70); db(0x18); db(0x4e); db(0xae); db(0xff); db(0x2e); db(0x06); db(0x86);
- db(0x00); db(0x01); db(0x00); db(0x00); db(0x20); db(0x0a); db(0x66); db(0xec);
- db(0x26); db(0x87); db(0x2a); db(0x1f); db(0x4e); db(0x75); db(0x41); db(0xfa);
- db(0xf9); db(0x4c); db(0x02); db(0x80); db(0x00); db(0x00); db(0xff); db(0xff);
- db(0xd1); db(0xc0); db(0x4e); db(0x75); db(0x00); db(0x00); db(0x0c); db(0xaf);
- db(0x00); db(0x00); db(0x00); db(0x22); db(0x00); db(0x08); db(0x66); db(0x30);
- db(0x48); db(0xe7); db(0xc0); db(0xe2); db(0x2c); db(0x78); db(0x00); db(0x04);
- db(0x93); db(0xc9); db(0x4e); db(0xae); db(0xfe); db(0xda); db(0x24); db(0x40);
- db(0x22); db(0x4a); db(0x70); db(0xec); db(0x4e); db(0xae); db(0xfe); db(0xd4);
- db(0x41); db(0xfa); db(0xff); db(0xda); db(0x32); db(0x10); db(0xb2); db(0x50);
- db(0x67); db(0xfc); db(0x22); db(0x4a); db(0x4e); db(0xae); db(0xfe); db(0xd4);
- db(0x72); db(0x01); db(0x4c); db(0xdf); db(0x47); db(0x03); db(0x58); db(0x8f);
- db(0x4e); db(0x75); db(0x20); db(0x88); db(0x58); db(0x90); db(0x42); db(0xa8);
- db(0x00); db(0x04); db(0x21); db(0x48); db(0x00); db(0x08); db(0x4e); db(0x75);
- db(0x48); db(0xe7); db(0x20); db(0x22); db(0x2c); db(0x79); db(0x00); db(0x00);
+ db(0x20); db(0x08); db(0x67); db(0x00); db(0xff); db(0x80); db(0x22); db(0x50);
+ db(0x20); db(0x40); db(0x20); db(0x28); db(0x00); db(0x04); db(0x6a); db(0x16);
+ db(0x48); db(0xe7); db(0x00); db(0xc0); db(0x28); db(0x68); db(0x00); db(0x0a);
+ db(0x61); db(0x4a); db(0x53); db(0x85); db(0x4c); db(0xdf); db(0x03); db(0x00);
+ db(0x24); db(0x89); db(0x20); db(0x49); db(0x60); db(0xda); db(0x24); db(0x48);
+ db(0x20); db(0x49); db(0x60); db(0xd4); db(0x0c); db(0x85); db(0x00); db(0x00);
+ db(0x00); db(0x14); db(0x65); db(0x00); db(0x00); db(0x0a); db(0x70); db(0x01);
+ db(0x29); db(0x40); db(0x00); db(0x04); db(0x60); db(0x12); db(0x61); db(0x32);
+ db(0x30); db(0x3c); db(0xff); db(0x30); db(0x61); db(0x00); db(0x00); db(0x8a);
+ db(0x4e); db(0x90); db(0x4a); db(0x80); db(0x67); db(0x0e); db(0x52); db(0x85);
+ db(0x28); db(0xab); db(0x00); db(0x04); db(0x27); db(0x4c); db(0x00); db(0x04);
+ db(0x60); db(0x00); db(0xff); db(0x2a); db(0x28); db(0x43); db(0x61); db(0x04);
+ db(0x60); db(0x00); db(0xff); db(0x22); db(0x22); db(0x54); db(0x20); db(0x6c);
+ db(0x00); db(0x04); db(0x29); db(0x4d); db(0x00); db(0x04); db(0x4e); db(0xee);
+ db(0xfe); db(0x92); db(0x2f); db(0x05); db(0x7a); db(0xfc); db(0x24); db(0x53);
+ db(0x2e); db(0x0a); db(0x22); db(0x0a); db(0x67); db(0x00); db(0x00); db(0x0c);
+ db(0x52); db(0x85); db(0x67); db(0x1e); db(0x22); db(0x4a); db(0x24); db(0x52);
+ db(0x60); db(0xf0); db(0x52); db(0x85); db(0x67); db(0x3c); db(0x24); db(0x47);
+ db(0x70); db(0x18); db(0x72); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a);
+ db(0x52); db(0x46); db(0x24); db(0x40); db(0x24); db(0x87); db(0x2e); db(0x0a);
+ db(0x60); db(0xe8); db(0x20); db(0x12); db(0x67); db(0x24); db(0x20); db(0x40);
+ db(0x20); db(0x10); db(0x67); db(0x1e); db(0x20); db(0x40); db(0x20); db(0x10);
+ db(0x67); db(0x18); db(0x70); db(0x00); db(0x22); db(0x80); db(0x22); db(0x4a);
+ db(0x24); db(0x51); db(0x70); db(0x18); db(0x4e); db(0xae); db(0xff); db(0x2e);
+ db(0x06); db(0x86); db(0x00); db(0x01); db(0x00); db(0x00); db(0x20); db(0x0a);
+ db(0x66); db(0xec); db(0x26); db(0x87); db(0x2a); db(0x1f); db(0x4e); db(0x75);
+ db(0x41); db(0xfa); db(0xf9); db(0x4a); db(0x02); db(0x80); db(0x00); db(0x00);
+ db(0xff); db(0xff); db(0xd1); db(0xc0); db(0x4e); db(0x75); db(0x00); db(0x00);
+ db(0x0c); db(0xaf); db(0x00); db(0x00); db(0x00); db(0x22); db(0x00); db(0x08);
+ db(0x66); db(0x30); db(0x48); db(0xe7); db(0xc0); db(0xe2); db(0x2c); db(0x78);
+ db(0x00); db(0x04); db(0x93); db(0xc9); db(0x4e); db(0xae); db(0xfe); db(0xda);
+ db(0x24); db(0x40); db(0x22); db(0x4a); db(0x70); db(0xec); db(0x4e); db(0xae);
+ db(0xfe); db(0xd4); db(0x41); db(0xfa); db(0xff); db(0xda); db(0x32); db(0x10);
+ db(0xb2); db(0x50); db(0x67); db(0xfc); db(0x22); db(0x4a); db(0x4e); db(0xae);
+ db(0xfe); db(0xd4); db(0x72); db(0x01); db(0x4c); db(0xdf); db(0x47); db(0x03);
+ db(0x58); db(0x8f); db(0x4e); db(0x75); db(0x20); db(0x88); db(0x58); db(0x90);
+ db(0x42); db(0xa8); db(0x00); db(0x04); db(0x21); db(0x48); db(0x00); db(0x08);
+ db(0x4e); db(0x75); db(0x48); db(0xe7); db(0x20); db(0x22); db(0x2c); db(0x79);
+ db(0x00); db(0x00); db(0x00); db(0x04); db(0x70); db(0xff); db(0x4e); db(0xae);
+ db(0xfe); db(0xb6); db(0x91); db(0xc8); db(0x24); db(0x00); db(0x6b); db(0x32);
+ db(0x70); db(0x22); db(0x22); db(0x3c); db(0x00); db(0x01); db(0x00); db(0x01);
+ db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x91); db(0xc8); db(0x24); db(0x40);
+ db(0x4a); db(0x80); db(0x67); db(0x1e); db(0x15); db(0x7c); db(0x00); db(0x04);
+ db(0x00); db(0x08); db(0x15); db(0x42); db(0x00); db(0x0f); db(0x93); db(0xc9);
+ db(0x4e); db(0xae); db(0xfe); db(0xda); db(0x25); db(0x40); db(0x00); db(0x10);
+ db(0x41); db(0xea); db(0x00); db(0x14); db(0x61); db(0x00); db(0xff); db(0xae);
+ db(0x20); db(0x4a); db(0x20); db(0x08); db(0x4c); db(0xdf); db(0x44); db(0x04);
+ db(0x4e); db(0x75); db(0x48); db(0xe7); db(0x20); db(0x22); db(0x2c); db(0x79);
+ db(0x00); db(0x00); db(0x00); db(0x04); db(0x4a); db(0x80); db(0x67); db(0x20);
+ db(0x24); db(0x40); db(0x74); db(0x30); db(0x20); db(0x02); db(0x22); db(0x3c);
+ db(0x00); db(0x01); db(0x00); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a);
+ db(0x20); db(0x40); db(0x11); db(0x7c); db(0x00); db(0x0a); db(0x00); db(0x08);
+ db(0x21); db(0x42); db(0x00); db(0x12); db(0x21); db(0x4a); db(0x00); db(0x0e);
+ db(0x4c); db(0xdf); db(0x44); db(0x04); db(0x4e); db(0x75); db(0x48); db(0xe7);
+ db(0x30); db(0x32); db(0x2c); db(0x79); db(0x00); db(0x00); db(0x00); db(0x04);
+ db(0x24); db(0x08); db(0x26); db(0x09); db(0x20); db(0x3c); db(0x00); db(0x00);
+ db(0x08); db(0x5c); db(0x22); db(0x3c); db(0x00); db(0x01); db(0x00); db(0x01);
+ db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x4a); db(0x80); db(0x67); db(0x00);
+ db(0x00); db(0x2c); db(0x24); db(0x40); db(0x15); db(0x7c); db(0x00); db(0x01);
+ db(0x00); db(0x08); db(0x25); db(0x42); db(0x00); db(0x0a); db(0x47); db(0xea);
+ db(0x00); db(0x5c); db(0x25); db(0x4b); db(0x00); db(0x3a); db(0x47); db(0xeb);
+ db(0x08); db(0x00); db(0x25); db(0x4b); db(0x00); db(0x3e); db(0x25); db(0x4b);
+ db(0x00); db(0x36); db(0x22); db(0x4a); db(0x24); db(0x43); db(0x97); db(0xcb);
+ db(0x4e); db(0xae); db(0xfe); db(0xe6); db(0x4c); db(0xdf); db(0x4c); db(0x0c);
+ db(0x4e); db(0x75); db(0x00); db(0x00); db(0x00); db(0x00); db(0x00); db(0x00);
+ db(0x2f); db(0x08); db(0x4a); db(0x2b); db(0x00); db(0x9d); db(0x66); db(0x18);
+ db(0x41); db(0xfa); db(0xff); db(0xf0); db(0x4a); db(0x50); db(0x67); db(0x10);
+ db(0x41); db(0xfa); db(0x01); db(0xba); db(0x43); db(0xfa); db(0x00); db(0x0e);
+ db(0x61); db(0x00); db(0xff); db(0x8c); db(0x50); db(0xeb); db(0x00); db(0x9d);
+ db(0x20); db(0x5f); db(0x4e); db(0x75); db(0x2c); db(0x79); db(0x00); db(0x00);
  db(0x00); db(0x04); db(0x70); db(0xff); db(0x4e); db(0xae); db(0xfe); db(0xb6);
- db(0x91); db(0xc8); db(0x24); db(0x00); db(0x6b); db(0x32); db(0x70); db(0x22);
- db(0x22); db(0x3c); db(0x00); db(0x01); db(0x00); db(0x01); db(0x4e); db(0xae);
- db(0xff); db(0x3a); db(0x91); db(0xc8); db(0x24); db(0x40); db(0x4a); db(0x80);
- db(0x67); db(0x1e); db(0x15); db(0x7c); db(0x00); db(0x04); db(0x00); db(0x08);
- db(0x15); db(0x42); db(0x00); db(0x0f); db(0x93); db(0xc9); db(0x4e); db(0xae);
- db(0xfe); db(0xda); db(0x25); db(0x40); db(0x00); db(0x10); db(0x41); db(0xea);
- db(0x00); db(0x14); db(0x61); db(0x00); db(0xff); db(0xae); db(0x20); db(0x4a);
- db(0x20); db(0x08); db(0x4c); db(0xdf); db(0x44); db(0x04); db(0x4e); db(0x75);
- db(0x48); db(0xe7); db(0x20); db(0x22); db(0x2c); db(0x79); db(0x00); db(0x00);
- db(0x00); db(0x04); db(0x4a); db(0x80); db(0x67); db(0x20); db(0x24); db(0x40);
- db(0x74); db(0x30); db(0x20); db(0x02); db(0x22); db(0x3c); db(0x00); db(0x01);
- db(0x00); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x20); db(0x40);
- db(0x11); db(0x7c); db(0x00); db(0x0a); db(0x00); db(0x08); db(0x21); db(0x42);
- db(0x00); db(0x12); db(0x21); db(0x4a); db(0x00); db(0x0e); db(0x4c); db(0xdf);
- db(0x44); db(0x04); db(0x4e); db(0x75); db(0x48); db(0xe7); db(0x30); db(0x32);
- db(0x2c); db(0x79); db(0x00); db(0x00); db(0x00); db(0x04); db(0x24); db(0x08);
- db(0x26); db(0x09); db(0x20); db(0x3c); db(0x00); db(0x00); db(0x08); db(0x5c);
- db(0x22); db(0x3c); db(0x00); db(0x01); db(0x00); db(0x01); db(0x4e); db(0xae);
- db(0xff); db(0x3a); db(0x4a); db(0x80); db(0x67); db(0x00); db(0x00); db(0x2c);
- db(0x24); db(0x40); db(0x15); db(0x7c); db(0x00); db(0x01); db(0x00); db(0x08);
- db(0x25); db(0x42); db(0x00); db(0x0a); db(0x47); db(0xea); db(0x00); db(0x5c);
- db(0x25); db(0x4b); db(0x00); db(0x3a); db(0x47); db(0xeb); db(0x08); db(0x00);
- db(0x25); db(0x4b); db(0x00); db(0x3e); db(0x25); db(0x4b); db(0x00); db(0x36);
- db(0x22); db(0x4a); db(0x24); db(0x43); db(0x97); db(0xcb); db(0x4e); db(0xae);
- db(0xfe); db(0xe6); db(0x4c); db(0xdf); db(0x4c); db(0x0c); db(0x4e); db(0x75);
- db(0x00); db(0x00); db(0x00); db(0x00); db(0x00); db(0x00); db(0x2f); db(0x08);
- db(0x4a); db(0x2b); db(0x00); db(0x9d); db(0x66); db(0x18); db(0x41); db(0xfa);
- db(0xff); db(0xf0); db(0x4a); db(0x50); db(0x67); db(0x10); db(0x41); db(0xfa);
- db(0x01); db(0xba); db(0x43); db(0xfa); db(0x00); db(0x0e); db(0x61); db(0x00);
- db(0xff); db(0x8c); db(0x50); db(0xeb); db(0x00); db(0x9d); db(0x20); db(0x5f);
- db(0x4e); db(0x75); db(0x2c); db(0x79); db(0x00); db(0x00); db(0x00); db(0x04);
- db(0x70); db(0xff); db(0x4e); db(0xae); db(0xfe); db(0xb6); db(0x74); db(0x00);
- db(0x01); db(0xc2); db(0x93); db(0xc9); db(0x4e); db(0xae); db(0xfe); db(0xda);
- db(0x28); db(0x40); db(0x70); db(0x14); db(0x22); db(0x4c); db(0x4e); db(0xae);
- db(0xfe); db(0xd4); db(0x70); db(0x00); db(0x43); db(0xfa); db(0x01); db(0xae);
- db(0x4e); db(0xae); db(0xfd); db(0xd8); db(0x2e); db(0x00); db(0x70); db(0x00);
- db(0x30); db(0x3c); db(0x00); db(0x44); db(0x22); db(0x3c); db(0x00); db(0x01);
- db(0x00); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a); db(0x2a); db(0x40);
- db(0x61); db(0x00); db(0xfe); db(0xbe); db(0x61); db(0x00); db(0xff); db(0x0a);
- db(0x2b); db(0x40); db(0x00); db(0x3c); db(0x67); db(0x00); db(0x00); db(0x7a);
- db(0x22); db(0x40); db(0x41); db(0xfa); db(0x01); db(0x3c); db(0x70); db(0x00);
- db(0x72); db(0x00); db(0x4e); db(0xae); db(0xfe); db(0x44); db(0x4a); db(0x80);
- db(0x66); db(0x00); db(0x00); db(0x66); db(0x61); db(0x00); db(0xfe); db(0x9a);
- db(0x61); db(0x00); db(0xfe); db(0xe6); db(0x2b); db(0x40); db(0x00); db(0x40);
- db(0x67); db(0x00); db(0x00); db(0x56); db(0x22); db(0x40); db(0x41); db(0xfa);
- db(0x01); db(0x25); db(0x70); db(0x00); db(0x72); db(0x00); db(0x4e); db(0xae);
- db(0xfe); db(0x44); db(0x4a); db(0x80); db(0x66); db(0x00); db(0x00); db(0x42);
- db(0x47); db(0xed); db(0x00); db(0x16); db(0x27); db(0x4c); db(0x00); db(0x0c);
- db(0x27); db(0x42); db(0x00); db(0x08); db(0x70); db(0xff); db(0x26); db(0x80);
- db(0x27); db(0x40); db(0x00); db(0x04); db(0x43); db(0xed); db(0x00); db(0x00);
- db(0x13); db(0x7c); db(0x00); db(0x02); db(0x00); db(0x08); db(0x13); db(0x7c);
- db(0x00); db(0x05); db(0x00); db(0x09); db(0x41); db(0xfa); db(0x00); db(0xfc);
- db(0x23); db(0x48); db(0x00); db(0x0a); db(0x41); db(0xfa); db(0x00); db(0xa0);
- db(0x23); db(0x48); db(0x00); db(0x12); db(0x23); db(0x4b); db(0x00); db(0x0e);
- db(0x70); db(0x05); db(0x4e); db(0xae); db(0xff); db(0x58); db(0x60); db(0x02);
- db(0x4e); db(0x75); db(0x20); db(0x02); db(0x4e); db(0xae); db(0xfe); db(0xc2);
- db(0x22); db(0x6d); db(0x00); db(0x3c); db(0x45); db(0xed); db(0x00); db(0x26);
- db(0x33); db(0x7c); db(0x00); db(0x0b); db(0x00); db(0x1c); db(0x23); db(0x7c);
- db(0x00); db(0x00); db(0x00); db(0x16); db(0x00); db(0x24); db(0x23); db(0x4a);
- db(0x00); db(0x28); db(0x13); db(0x7c); db(0x00); db(0x01); db(0x00); db(0x1e);
- db(0x15); db(0x7c); db(0x00); db(0x04); db(0x00); db(0x04); db(0x42); db(0x2a);
- db(0x00); db(0x05); db(0x42); db(0x6a); db(0x00); db(0x06); db(0x42); db(0x6a);
- db(0x00); db(0x08); db(0x20); db(0x47); db(0x20); db(0x2d); db(0x00); db(0x16);
- db(0x32); db(0x28); db(0x00); db(0x30); db(0xd2); db(0x41); db(0x90); db(0x41);
- db(0x35); db(0x40); db(0x00); db(0x0a); db(0x20); db(0x2d); db(0x00); db(0x1a);
- db(0x32); db(0x28); db(0x00); db(0x2e); db(0xd2); db(0x41); db(0x90); db(0x41);
- db(0x48); db(0xc0); db(0x35); db(0x40); db(0x00); db(0x0c); db(0x22); db(0x6d);
- db(0x00); db(0x40); db(0x33); db(0x7c); db(0x00); db(0x0a); db(0x00); db(0x1c);
- db(0x13); db(0x7c); db(0x00); db(0x01); db(0x00); db(0x1e); db(0x4e); db(0xae);
- db(0xfe); db(0x38); db(0x22); db(0x6d); db(0x00); db(0x40); db(0x25); db(0x69);
- db(0x00); db(0x20); db(0x00); db(0x0e); db(0x25); db(0x69); db(0x00); db(0x24);
- db(0x00); db(0x12); db(0x22); db(0x6d); db(0x00); db(0x3c); db(0x4e); db(0xae);
- db(0xfe); db(0x38); db(0x60); db(0x00); db(0xff); db(0x76); db(0x30); db(0x3a);
- db(0xfe); db(0x82); db(0x48); db(0xc0); db(0x32); db(0x3a); db(0xfe); db(0x7e);
- db(0x48); db(0xc1); db(0xb0); db(0x91); db(0x66); db(0x00); db(0x00); db(0x0a);
- db(0xb2); db(0xa9); db(0x00); db(0x04); db(0x67); db(0x00); db(0x00); db(0x18);
- db(0x23); db(0x41); db(0x00); db(0x04); db(0x22); db(0x80); db(0x20); db(0x29);
- db(0x00); db(0x08); db(0x22); db(0x69); db(0x00); db(0x0c); db(0x2c); db(0x78);
- db(0x00); db(0x04); db(0x4e); db(0xae); db(0xfe); db(0xbc); db(0x41); db(0xf9);
- db(0x00); db(0xdf); db(0xf0); db(0x00); db(0x70); db(0x00); db(0x4e); db(0x75);
- db(0x69); db(0x6e); db(0x70); db(0x75); db(0x74); db(0x2e); db(0x64); db(0x65);
- db(0x76); db(0x69); db(0x63); db(0x65); db(0x00); db(0x74); db(0x69); db(0x6d);
- db(0x65); db(0x72); db(0x2e); db(0x64); db(0x65); db(0x76); db(0x69); db(0x63);
- db(0x65); db(0x00); db(0x55); db(0x41); db(0x45); db(0x20); db(0x6d); db(0x6f);
- db(0x75); db(0x73); db(0x65); db(0x20); db(0x68); db(0x61); db(0x63); db(0x6b);
- db(0x00); db(0x55); db(0x41); db(0x45); db(0x20); db(0x66); db(0x69); db(0x6c);
- db(0x65); db(0x73); db(0x79); db(0x73); db(0x74); db(0x65); db(0x6d); db(0x00);
- db(0x64); db(0x6f); db(0x73); db(0x2e); db(0x6c); db(0x69); db(0x62); db(0x72);
- db(0x61); db(0x72); db(0x79); db(0x00); db(0x69); db(0x6e); db(0x74); db(0x75);
- db(0x69); db(0x74); db(0x69); db(0x6f); db(0x6e); db(0x2e); db(0x6c); db(0x69);
- db(0x62); db(0x72); db(0x61); db(0x72); db(0x79); db(0x00); db(0x65); db(0x78);
- db(0x70); db(0x61); db(0x6e); db(0x73); db(0x69); db(0x6f); db(0x6e); db(0x2e);
+ db(0x74); db(0x00); db(0x01); db(0xc2); db(0x93); db(0xc9); db(0x4e); db(0xae);
+ db(0xfe); db(0xda); db(0x28); db(0x40); db(0x70); db(0x14); db(0x22); db(0x4c);
+ db(0x4e); db(0xae); db(0xfe); db(0xd4); db(0x70); db(0x00); db(0x43); db(0xfa);
+ db(0x01); db(0xae); db(0x4e); db(0xae); db(0xfd); db(0xd8); db(0x2e); db(0x00);
+ db(0x70); db(0x00); db(0x30); db(0x3c); db(0x00); db(0x44); db(0x22); db(0x3c);
+ db(0x00); db(0x01); db(0x00); db(0x01); db(0x4e); db(0xae); db(0xff); db(0x3a);
+ db(0x2a); db(0x40); db(0x61); db(0x00); db(0xfe); db(0xbe); db(0x61); db(0x00);
+ db(0xff); db(0x0a); db(0x2b); db(0x40); db(0x00); db(0x3c); db(0x67); db(0x00);
+ db(0x00); db(0x7a); db(0x22); db(0x40); db(0x41); db(0xfa); db(0x01); db(0x3c);
+ db(0x70); db(0x00); db(0x72); db(0x00); db(0x4e); db(0xae); db(0xfe); db(0x44);
+ db(0x4a); db(0x80); db(0x66); db(0x00); db(0x00); db(0x66); db(0x61); db(0x00);
+ db(0xfe); db(0x9a); db(0x61); db(0x00); db(0xfe); db(0xe6); db(0x2b); db(0x40);
+ db(0x00); db(0x40); db(0x67); db(0x00); db(0x00); db(0x56); db(0x22); db(0x40);
+ db(0x41); db(0xfa); db(0x01); db(0x25); db(0x70); db(0x00); db(0x72); db(0x00);
+ db(0x4e); db(0xae); db(0xfe); db(0x44); db(0x4a); db(0x80); db(0x66); db(0x00);
+ db(0x00); db(0x42); db(0x47); db(0xed); db(0x00); db(0x16); db(0x27); db(0x4c);
+ db(0x00); db(0x0c); db(0x27); db(0x42); db(0x00); db(0x08); db(0x70); db(0xff);
+ db(0x26); db(0x80); db(0x27); db(0x40); db(0x00); db(0x04); db(0x43); db(0xed);
+ db(0x00); db(0x00); db(0x13); db(0x7c); db(0x00); db(0x02); db(0x00); db(0x08);
+ db(0x13); db(0x7c); db(0x00); db(0x05); db(0x00); db(0x09); db(0x41); db(0xfa);
+ db(0x00); db(0xfc); db(0x23); db(0x48); db(0x00); db(0x0a); db(0x41); db(0xfa);
+ db(0x00); db(0xa0); db(0x23); db(0x48); db(0x00); db(0x12); db(0x23); db(0x4b);
+ db(0x00); db(0x0e); db(0x70); db(0x05); db(0x4e); db(0xae); db(0xff); db(0x58);
+ db(0x60); db(0x02); db(0x4e); db(0x75); db(0x20); db(0x02); db(0x4e); db(0xae);
+ db(0xfe); db(0xc2); db(0x22); db(0x6d); db(0x00); db(0x3c); db(0x45); db(0xed);
+ db(0x00); db(0x26); db(0x33); db(0x7c); db(0x00); db(0x0b); db(0x00); db(0x1c);
+ db(0x23); db(0x7c); db(0x00); db(0x00); db(0x00); db(0x16); db(0x00); db(0x24);
+ db(0x23); db(0x4a); db(0x00); db(0x28); db(0x13); db(0x7c); db(0x00); db(0x01);
+ db(0x00); db(0x1e); db(0x15); db(0x7c); db(0x00); db(0x04); db(0x00); db(0x04);
+ db(0x42); db(0x2a); db(0x00); db(0x05); db(0x42); db(0x6a); db(0x00); db(0x06);
+ db(0x42); db(0x6a); db(0x00); db(0x08); db(0x20); db(0x47); db(0x20); db(0x2d);
+ db(0x00); db(0x16); db(0x32); db(0x28); db(0x00); db(0x30); db(0xd2); db(0x41);
+ db(0x90); db(0x41); db(0x35); db(0x40); db(0x00); db(0x0a); db(0x20); db(0x2d);
+ db(0x00); db(0x1a); db(0x32); db(0x28); db(0x00); db(0x2e); db(0xd2); db(0x41);
+ db(0x90); db(0x41); db(0x48); db(0xc0); db(0x35); db(0x40); db(0x00); db(0x0c);
+ db(0x22); db(0x6d); db(0x00); db(0x40); db(0x33); db(0x7c); db(0x00); db(0x0a);
+ db(0x00); db(0x1c); db(0x13); db(0x7c); db(0x00); db(0x01); db(0x00); db(0x1e);
+ db(0x4e); db(0xae); db(0xfe); db(0x38); db(0x22); db(0x6d); db(0x00); db(0x40);
+ db(0x25); db(0x69); db(0x00); db(0x20); db(0x00); db(0x0e); db(0x25); db(0x69);
+ db(0x00); db(0x24); db(0x00); db(0x12); db(0x22); db(0x6d); db(0x00); db(0x3c);
+ db(0x4e); db(0xae); db(0xfe); db(0x38); db(0x60); db(0x00); db(0xff); db(0x76);
+ db(0x30); db(0x3a); db(0xfe); db(0x82); db(0x48); db(0xc0); db(0x32); db(0x3a);
+ db(0xfe); db(0x7e); db(0x48); db(0xc1); db(0xb0); db(0x91); db(0x66); db(0x00);
+ db(0x00); db(0x0a); db(0xb2); db(0xa9); db(0x00); db(0x04); db(0x67); db(0x00);
+ db(0x00); db(0x18); db(0x23); db(0x41); db(0x00); db(0x04); db(0x22); db(0x80);
+ db(0x20); db(0x29); db(0x00); db(0x08); db(0x22); db(0x69); db(0x00); db(0x0c);
+ db(0x2c); db(0x78); db(0x00); db(0x04); db(0x4e); db(0xae); db(0xfe); db(0xbc);
+ db(0x41); db(0xf9); db(0x00); db(0xdf); db(0xf0); db(0x00); db(0x70); db(0x00);
+ db(0x4e); db(0x75); db(0x69); db(0x6e); db(0x70); db(0x75); db(0x74); db(0x2e);
+ db(0x64); db(0x65); db(0x76); db(0x69); db(0x63); db(0x65); db(0x00); db(0x74);
+ db(0x69); db(0x6d); db(0x65); db(0x72); db(0x2e); db(0x64); db(0x65); db(0x76);
+ db(0x69); db(0x63); db(0x65); db(0x00); db(0x55); db(0x41); db(0x45); db(0x20);
+ db(0x6d); db(0x6f); db(0x75); db(0x73); db(0x65); db(0x20); db(0x68); db(0x61);
+ db(0x63); db(0x6b); db(0x00); db(0x55); db(0x41); db(0x45); db(0x20); db(0x66);
+ db(0x69); db(0x6c); db(0x65); db(0x73); db(0x79); db(0x73); db(0x74); db(0x65);
+ db(0x6d); db(0x00); db(0x64); db(0x6f); db(0x73); db(0x2e); db(0x6c); db(0x69);
+ db(0x62); db(0x72); db(0x61); db(0x72); db(0x79); db(0x00); db(0x69); db(0x6e);
+ db(0x74); db(0x75); db(0x69); db(0x74); db(0x69); db(0x6f); db(0x6e); db(0x2e);
  db(0x6c); db(0x69); db(0x62); db(0x72); db(0x61); db(0x72); db(0x79); db(0x00);
- db(0x46); db(0x69); db(0x6c); db(0x65); db(0x53); db(0x79); db(0x73); db(0x74);
- db(0x65); db(0x6d); db(0x2e); db(0x72); db(0x65); db(0x73); db(0x6f); db(0x75);
- db(0x72); db(0x63); db(0x65); db(0x00); db(0x00); db(0x00); db(0x03); db(0xf2);
+ db(0x65); db(0x78); db(0x70); db(0x61); db(0x6e); db(0x73); db(0x69); db(0x6f);
+ db(0x6e); db(0x2e); db(0x6c); db(0x69); db(0x62); db(0x72); db(0x61); db(0x72);
+ db(0x79); db(0x00); db(0x46); db(0x69); db(0x6c); db(0x65); db(0x53); db(0x79);
+ db(0x73); db(0x74); db(0x65); db(0x6d); db(0x2e); db(0x72); db(0x65); db(0x73);
+ db(0x6f); db(0x75); db(0x72); db(0x63); db(0x65); db(0x00); db(0x00); db(0x00);
+ db(0x00); db(0x00); db(0x03); db(0xf2);
 
diff --git a/fpp.c b/fpp.c
index ca2a986c9a728d962772d91f268ff2f09b77daa9..7eb57a3b5175e5158e08ee260a1bde45d430ffd3 100755 (executable)
--- a/fpp.c
+++ b/fpp.c
@@ -8,6 +8,7 @@
    */
 
 #define __USE_ISOC9X  /* We might be able to pick up a NaN */
+
 #include <math.h>
 
 #include "sysconfig.h"
 #include "md-fpp.h"
 #include "savestate.h"
 
+#define DEBUG_FPP 0
+
+STATIC_INLINE int isinrom (void)
+{
+    return (munge24 (m68k_getpc (&regs)) & 0xFFF80000) == 0xF80000;
+}
+
 static uae_u32 xhex_pi[]    ={0x2168c235, 0xc90fdaa2, 0x4000};
 uae_u32 xhex_exp_1[] ={0xa2bb4a9a, 0xadf85458, 0x4000};
 static uae_u32 xhex_l2_e[]  ={0x5c17f0bc, 0xb8aa3b29, 0x3fff};
@@ -96,15 +104,6 @@ static double *fp_nan    = (double *)dhex_nan;
 double fp_1e8 = 1.0e8;
 float  fp_1e0 = 1, fp_1e1 = 10, fp_1e2 = 100, fp_1e4 = 10000;
 
-#if 1
-
-STATIC_INLINE int isinrom (void)
-{
-    return (munge24 (m68k_getpc (&regs)) & 0xFFF80000) == 0xF80000;
-}
-
-#define DEBUG_FPP 0
-
 #define FFLAG_Z            0x4000
 #define FFLAG_N            0x0100
 #define FFLAG_NAN   0x0400
@@ -692,7 +691,7 @@ void fdbcc_opp (uae_u32 opcode, struct regstruct *regs, uae_u16 extra)
 
 #if DEBUG_FPP
     if (!isinrom ())
-       write_log ("fdbcc_opp at %08lx\n", m68k_getpc ());
+       write_log ("fdbcc_opp at %08lx\n", m68k_getpc (regs));
 #endif
     cc = fpp_cond (opcode, extra & 0x3f);
     if (cc == -1) {
@@ -715,7 +714,7 @@ void fscc_opp (uae_u32 opcode, struct regstruct *regs, uae_u16 extra)
 
 #if DEBUG_FPP
     if (!isinrom ())
-       write_log ("fscc_opp at %08lx\n", m68k_getpc ());
+       write_log ("fscc_opp at %08lx\n", m68k_getpc (regs));
 #endif
     cc = fpp_cond (opcode, extra & 0x3f);
     if (cc == -1) {
@@ -738,7 +737,7 @@ void ftrapcc_opp (uae_u32 opcode, struct regstruct *regs, uaecptr oldpc)
 
 #if DEBUG_FPP
     if (!isinrom ())
-       write_log ("ftrapcc_opp at %08lx\n", m68k_getpc ());
+       write_log ("ftrapcc_opp at %08lx\n", m68k_getpc (regs));
 #endif
     cc = fpp_cond (opcode, opcode & 0x3f);
     if (cc == -1) {
@@ -755,7 +754,7 @@ void fbcc_opp (uae_u32 opcode, struct regstruct *regs, uaecptr pc, uae_u32 extra
 
 #if DEBUG_FPP
     if (!isinrom ())
-       write_log ("fbcc_opp at %08lx\n", m68k_getpc ());
+       write_log ("fbcc_opp at %08lx\n", m68k_getpc (regs));
 #endif
     cc = fpp_cond (opcode, opcode & 0x3f);
     if (cc == -1) {
@@ -779,7 +778,7 @@ void fsave_opp (uae_u32 opcode, struct regstruct *regs)
 
 #if DEBUG_FPP
     if (!isinrom ())
-       write_log ("fsave_opp at %08lx\n", m68k_getpc ());
+       write_log ("fsave_opp at %08lx\n", m68k_getpc (regs));
 #endif
     if (get_fp_ad (opcode, &ad) == 0) {
        m68k_setpc (regs, m68k_getpc (regs) - 2);
@@ -787,6 +786,18 @@ void fsave_opp (uae_u32 opcode, struct regstruct *regs)
        return;
     }
 
+#if 0
+    if (currprefs.cpu_level >= 6) {
+       /* 6 byte 68060 IDLE frame.  */
+       if (incr < 0) {
+           ad -= 6;
+           put_long (ad, 0x00006000);
+       } else {
+           put_long (ad, 0x00006000);
+           ad += 6;
+       }
+    } else
+#endif
     if (currprefs.cpu_level >= 4) {
        /* 4 byte 68040 IDLE frame.  */
        if (incr < 0) {
@@ -831,13 +842,24 @@ void frestore_opp (uae_u32 opcode, struct regstruct *regs)
 
 #if DEBUG_FPP
     if (!isinrom ())
-       write_log ("frestore_opp at %08lx\n", m68k_getpc ());
+       write_log ("frestore_opp at %08lx\n", m68k_getpc (regs));
 #endif
     if (get_fp_ad (opcode, &ad) == 0) {
        m68k_setpc (regs, m68k_getpc (regs) - 2);
        op_illg (opcode, regs);
        return;
     }
+#if 0
+    if (currprefs.cpu_level >= 6) {
+       /* 68060 */
+        d = get_long (ad);
+       if (incr < 0) {
+           ad -= 6;
+           d = get_long (ad);
+       } else
+           ad += 6;
+    } else
+#endif
     if (currprefs.cpu_level >= 4) {
        /* 68040 */
        if (incr < 0) {
@@ -907,7 +929,7 @@ void fpp_opp (uae_u32 opcode, struct regstruct *regs, uae_u16 extra)
 
 #if DEBUG_FPP
     if (!isinrom ())
-       write_log ("FPP %04lx %04x at %08lx\n", opcode & 0xffff, extra, m68k_getpc () - 4);
+       write_log ("FPP %04lx %04x at %08lx\n", opcode & 0xffff, extra, m68k_getpc (regs) - 4);
 #endif
     switch ((extra >> 13) & 0x7) {
     case 3:
@@ -1452,8 +1474,6 @@ void fpp_opp (uae_u32 opcode, struct regstruct *regs, uae_u16 extra)
     op_illg (opcode, regs);
 }
 
-#endif
-
 uae_u8 *restore_fpu (uae_u8 *src)
 {
     int model, i;
index 47cf46c52a2675773dea233cf4a701ed429b9b72..cbb4a206f58ec2f170152b074977aebdc91eaa9b 100755 (executable)
--- a/gencpu.c
+++ b/gencpu.c
@@ -34,6 +34,8 @@ static int using_exception_3;
 static int using_ce;
 static int cpu_level;
 
+static int optimized_flags;
+
 #define GF_APDI 1
 #define GF_AD8R 2
 #define GF_PC8R 4
@@ -390,16 +392,15 @@ static void genamode2 (amodes mode, char *reg, wordsizes size, char *name, int g
        if (getv == 1)
            switch (size) {
            case sz_byte:
-#if defined(AMIGA) && !defined(WARPUP)
-               /* sam: I don't know why gcc.2.7.2.1 produces a code worse */
-               /* if it is not done like that: */
-               printf ("\tuae_s8 %s = ((uae_u8*)&m68k_dreg(regs, %s))[3];\n", name, reg);
+#ifdef USE_DUBIOUS_BIGENDIAN_OPTIMIZATION
+               /* This causes the target compiler to generate better code on few systems */
+               printf ("\tuae_s8 %s = ((uae_u8*)&m68k_dreg (regs, %s))[3];\n", name, reg);
 #else
-               printf ("\tuae_s8 %s = m68k_dreg(regs, %s);\n", name, reg);
+               printf ("\tuae_s8 %s = m68k_dreg (regs, %s);\n", name, reg);
 #endif
                break;
            case sz_word:
-#if defined(AMIGA) && !defined(WARPUP)
+#ifdef USE_DUBIOUS_BIGENDIAN_OPTIMIZATION
                printf ("\tuae_s16 %s = ((uae_s16*)&m68k_dreg(regs, %s))[1];\n", name, reg);
 #else
                printf ("\tuae_s16 %s = m68k_dreg(regs, %s);\n", name, reg);
@@ -971,7 +972,7 @@ static void genflags_normal (flagtypes type, wordsizes size, char *value, char *
        printf ("\tSET_VFLG (&regs->ccrflags, (flgs ^ flgo) & (flgn ^ flgo));\n");
        break;
      case flag_zn:
-       printf ("\tSET_ZFLG (&regs->ccrflags, GET_ZFLG (&regs->ccrflags) & (%s == 0));\n", vstr);
+       printf ("\tSET_ZFLG (&regs->ccrflags, GET_ZFLG (&(regs->ccrflags)) & (%s == 0));\n", vstr);
        printf ("\tSET_NFLG (&regs->ccrflags, %s < 0);\n", vstr);
        break;
      case flag_add:
@@ -1012,7 +1013,7 @@ static void genflags (flagtypes type, wordsizes size, char *value, char *src, ch
     /* Temporarily deleted 68k/ARM flag optimizations.  I'd prefer to have
        them in the appropriate m68k.h files and use just one copy of this
        code here.  The API can be changed if necessary.  */
-#ifdef OPTIMIZED_FLAGS
+    if (optimized_flags) {
     switch (type) {
      case flag_add:
      case flag_sub:
@@ -1029,57 +1030,57 @@ static void genflags (flagtypes type, wordsizes size, char *value, char *src, ch
      case flag_logical_noclobber:
        printf ("\t{uae_u32 oldcznv = GET_CZNV & ~(FLAGVAL_Z | FLAGVAL_N);\n");
        if (strcmp (value, "0") == 0) {
-           printf ("\tSET_CZNV (olcznv | FLAGVAL_Z);\n");
+           printf ("\tSET_CZNV (&regs->ccrflags, olcznv | FLAGVAL_Z);\n");
        } else {
            switch (size) {
-            case sz_byte: printf ("\toptflag_testb ((uae_s8)(%s));\n", value); break;
-            case sz_word: printf ("\toptflag_testw ((uae_s16)(%s));\n", value); break;
-            case sz_long: printf ("\toptflag_testl ((uae_s32)(%s));\n", value); break;
+            case sz_byte: printf ("\toptflag_testb (regs, (uae_s8)(%s));\n", value); break;
+            case sz_word: printf ("\toptflag_testw (regs, (uae_s16)(%s));\n", value); break;
+            case sz_long: printf ("\toptflag_testl (regs, (uae_s32)(%s));\n", value); break;
            }
-           printf ("\tIOR_CZNV (oldcznv);\n");
+           printf ("\tIOR_CZNV (&regs->ccrflags, oldcznv);\n");
        }
        printf ("\t}\n");
        return;
      case flag_logical:
        if (strcmp (value, "0") == 0) {
-           printf ("\tSET_CZNV (FLAGVAL_Z);\n");
+           printf ("\tSET_CZNV (&regs->ccrflags, FLAGVAL_Z);\n");
        } else {
            switch (size) {
-            case sz_byte: printf ("\toptflag_testb ((uae_s8)(%s));\n", value); break;
-            case sz_word: printf ("\toptflag_testw ((uae_s16)(%s));\n", value); break;
-            case sz_long: printf ("\toptflag_testl ((uae_s32)(%s));\n", value); break;
+            case sz_byte: printf ("\toptflag_testb (regs, (uae_s8)(%s));\n", value); break;
+            case sz_word: printf ("\toptflag_testw (regs, (uae_s16)(%s));\n", value); break;
+            case sz_long: printf ("\toptflag_testl (regs, (uae_s32)(%s));\n", value); break;
            }
        }
        return;
 
      case flag_add:
        switch (size) {
-        case sz_byte: printf ("\toptflag_addb (%s, (uae_s8)(%s), (uae_s8)(%s));\n", value, src, dst); break;
-        case sz_word: printf ("\toptflag_addw (%s, (uae_s16)(%s), (uae_s16)(%s));\n", value, src, dst); break;
-        case sz_long: printf ("\toptflag_addl (%s, (uae_s32)(%s), (uae_s32)(%s));\n", value, src, dst); break;
+        case sz_byte: printf ("\toptflag_addb (regs, %s, (uae_s8)(%s), (uae_s8)(%s));\n", value, src, dst); break;
+        case sz_word: printf ("\toptflag_addw (regs, %s, (uae_s16)(%s), (uae_s16)(%s));\n", value, src, dst); break;
+        case sz_long: printf ("\toptflag_addl (regs, %s, (uae_s32)(%s), (uae_s32)(%s));\n", value, src, dst); break;
        }
        return;
 
      case flag_sub:
        switch (size) {
-        case sz_byte: printf ("\toptflag_subb (%s, (uae_s8)(%s), (uae_s8)(%s));\n", value, src, dst); break;
-        case sz_word: printf ("\toptflag_subw (%s, (uae_s16)(%s), (uae_s16)(%s));\n", value, src, dst); break;
-        case sz_long: printf ("\toptflag_subl (%s, (uae_s32)(%s), (uae_s32)(%s));\n", value, src, dst); break;
+        case sz_byte: printf ("\toptflag_subb (regs, %s, (uae_s8)(%s), (uae_s8)(%s));\n", value, src, dst); break;
+        case sz_word: printf ("\toptflag_subw (regs, %s, (uae_s16)(%s), (uae_s16)(%s));\n", value, src, dst); break;
+        case sz_long: printf ("\toptflag_subl (regs, %s, (uae_s32)(%s), (uae_s32)(%s));\n", value, src, dst); break;
        }
        return;
 
      case flag_cmp:
        switch (size) {
-        case sz_byte: printf ("\toptflag_cmpb ((uae_s8)(%s), (uae_s8)(%s));\n", src, dst); break;
-        case sz_word: printf ("\toptflag_cmpw ((uae_s16)(%s), (uae_s16)(%s));\n", src, dst); break;
-        case sz_long: printf ("\toptflag_cmpl ((uae_s32)(%s), (uae_s32)(%s));\n", src, dst); break;
+        case sz_byte: printf ("\toptflag_cmpb (regs, (uae_s8)(%s), (uae_s8)(%s));\n", src, dst); break;
+        case sz_word: printf ("\toptflag_cmpw (regs, (uae_s16)(%s), (uae_s16)(%s));\n", src, dst); break;
+        case sz_long: printf ("\toptflag_cmpl (regs, (uae_s32)(%s), (uae_s32)(%s));\n", src, dst); break;
        }
        return;
 
      default:
        break;
     }
-#endif
+    }
 
     genflags_normal (type, size, value, src, dst);
 }
@@ -1932,7 +1933,7 @@ static void gen_opcode (unsigned long int opcode)
        printf ("\t\t\tSET_VFLG (&regs->ccrflags, 1);\n");
 #ifdef UNDEF68020
        if (cpu_level >= 2)
-           printf ("\t\t\tif (currprefs.cpu_level == 0 || dst < 0) SET_NFLG (1);\n");
+           printf ("\t\t\tif (currprefs.cpu_level == 0 || dst < 0) SET_NFLG (&regs, 1);\n");
        else /* ??? some 68000 revisions may not set NFLG when overflow happens.. */
 #endif
            printf ("\t\t\tSET_NFLG (&regs->ccrflags, 1);\n");
@@ -1974,7 +1975,7 @@ static void gen_opcode (unsigned long int opcode)
        printf ("\t\t\tSET_VFLG (&regs->ccrflags, 1);\n");
 #ifdef UNDEF68020
        if (cpu_level > 0)
-           printf ("\t\t\tif (currprefs.cpu_level == 0) SET_NFLG (1);\n");
+           printf ("\t\t\tif (currprefs.cpu_level == 0) SET_NFLG (&regs, 1);\n");
        else
 #endif
            printf ("\t\t\tSET_NFLG (&regs->ccrflags, 1);\n");
index 7fd6f64c5564818f17c852eb6c3e4a86721a4655..8bca5e6c1a47123b062122116b4ab684dce3b424 100755 (executable)
--- a/gfxutil.c
+++ b/gfxutil.c
@@ -74,7 +74,10 @@ unsigned int doMask256 (int p, int bits, int shift)
 static unsigned int doColor (int i, int bits, int shift)
 {
     int shift2;
-    if(bits >= 8) shift2 = 0; else shift2 = 8 - bits;
+    if(bits >= 8)
+       shift2 = 0;
+    else
+       shift2 = 8 - bits;
     return (i >> shift2) << shift;
 }
 
@@ -156,25 +159,25 @@ void alloc_colors64k (int rw, int gw, int bw, int rs, int gs, int bs, int aw, in
        xredcolors[i] = greyscale (doColor (i, rw, rs)) | doAlpha (alpha, aw, as);
        xgreencolors[i] = greyscale (doColor (i, gw, gs)) | doAlpha (alpha, aw, as);
        xbluecolors[i] = greyscale (doColor (i, bw, bs)) | doAlpha (alpha, aw, as);
-    }
-    if (byte_swap) {
+       if (byte_swap) {
+           if (bpp <= 16) {
+               xredcolors  [i] = bswap_16 (xredcolors[i]);
+               xgreencolors[i] = bswap_16 (xgreencolors[i]);
+               xbluecolors [i] = bswap_16 (xbluecolors[i]);
+           } else {
+               xredcolors  [i] = bswap_32 (xredcolors[i]);
+               xgreencolors[i] = bswap_32 (xgreencolors[i]);
+               xbluecolors [i] = bswap_32 (xbluecolors[i]);
+           }
+       }
        if (bpp <= 16) {
-           xredcolors  [i] = bswap_16 (xredcolors[i]);
-           xgreencolors[i] = bswap_16 (xgreencolors[i]);
-           xbluecolors [i] = bswap_16 (xbluecolors[i]);
-       } else {
-           xredcolors  [i] = bswap_32 (xredcolors[i]);
-           xgreencolors[i] = bswap_32 (xgreencolors[i]);
-           xbluecolors [i] = bswap_32 (xbluecolors[i]);
+           /* Fill upper 16 bits of each colour value with
+            * a copy of the colour. */
+           xredcolors  [i] = xredcolors  [i] * 0x00010001;
+           xgreencolors[i] = xgreencolors[i] * 0x00010001;
+           xbluecolors [i] = xbluecolors [i] * 0x00010001;
        }
     }
-    if (bpp <= 16) {
-        /* Fill upper 16 bits of each colour value with
-         * a copy of the colour. */
-        xredcolors  [i] = xredcolors  [i] * 0x00010001;
-        xgreencolors[i] = xgreencolors[i] * 0x00010001;
-        xbluecolors [i] = xbluecolors [i] * 0x00010001;
-    }
 
 #endif
     xredcolor_b = rw;
index 3546e8de54efc43d33a911330b0ca61c81a585b8..633363d6b00cf558819d06132c984501c5d1ada5 100755 (executable)
@@ -612,7 +612,7 @@ static uae_u32 hardfile_do_io (struct hardfiledata *hfd, struct hardfileprivdata
            put_long (dataptr + 20, tracksec);
            put_long (dataptr + 24, 0); /* bufmemtype */
            put_byte (dataptr + 28, 0); /* type = DG_DIRECT_ACCESS */
-           put_long (dataptr + 29, 0); /* flags */
+           put_byte (dataptr + 29, 0); /* flags */
        }
        break;
 
index ed4a5652ab559d67afdf156df980692bd92fb132..3ea5be943bcbbdb76a00f0ee70f05d0a07216a2e 100755 (executable)
@@ -33,11 +33,11 @@ struct gui_info
     uae_u8 drive_side;             /* floppy side */
     uae_u8 hd;                     /* harddrive */
     uae_u8 cd;                     /* CD */
-    int fps, idle;
+    int fps, idle, sndbuf;
     char df[4][256];               /* inserted image */
     uae_u32 crc32[4];              /* crc32 of image */
 };
-#define NUM_LEDS (1 + 1 + 1 + 1 + 1 + 4)
+#define NUM_LEDS (1 + 1 + 1 + 1 + 1 + 1 + 4)
 
 extern struct gui_info gui_data;
 
index d045b9109a14992ee018b7c7c17ab21c83f834a0..c400f3903edd8bdd3c6b66cb7cd40918a612150e 100755 (executable)
@@ -8,8 +8,8 @@
   */
 
 #define UAEMAJOR 1
-#define UAEMINOR 4
-#define UAESUBREV 0
+#define UAEMINOR 3
+#define UAESUBREV 3
 
 typedef enum { KBD_LANG_US, KBD_LANG_DK, KBD_LANG_DE, KBD_LANG_SE, KBD_LANG_FR, KBD_LANG_IT, KBD_LANG_ES } KbdLang;
 
index 67d64a81e11761ec21aa16e0f663172701812579..d8133e5a17c3d958505be8c1c93c3e59b99000b0 100755 (executable)
@@ -452,7 +452,7 @@ static void kbrlabel (char *s)
 static void write_kbr_config (struct zfile *f, int idnum, int devnum, struct uae_input_device *kbr)
 {
     char tmp1[200], tmp2[200], tmp3[200], *p;
-    int i, j, k, event, skip;
+    int i, j, k, evt, skip;
 
     if (!keyboard_default)
        return;
@@ -483,8 +483,8 @@ static void write_kbr_config (struct zfile *f, int idnum, int devnum, struct uae
        p[0] = 0;
        for (j = 0; j < MAX_INPUT_SUB_EVENT; j++) {
            char *custom = kbr->custom[i][j];
-           event = kbr->eventid[i][j];
-           if (custom == NULL && event <= 0) {
+           evt = kbr->eventid[i][j];
+           if (custom == NULL && evt <= 0) {
                for (k = j + 1; k < MAX_INPUT_SUB_EVENT; k++) {
                    if (kbr->eventid[i][k] > 0) break;
                }
@@ -497,8 +497,8 @@ static void write_kbr_config (struct zfile *f, int idnum, int devnum, struct uae
            }
            if (custom)
                sprintf (p, "'%s'.%d", custom, kbr->flags[i][j]);
-           else if (event > 0)
-               sprintf (p, "%s.%d", events[event].confname, kbr->flags[i][j]);
+           else if (evt > 0)
+               sprintf (p, "%s.%d", events[evt].confname, kbr->flags[i][j]);
            else
                strcat (p, "NULL");
            p += strlen(p);
@@ -506,7 +506,7 @@ static void write_kbr_config (struct zfile *f, int idnum, int devnum, struct uae
        sprintf (tmp3, "%d", kbr->extra[i][0]);
        kbrlabel (tmp3);
        sprintf (tmp1, "keyboard.%d.button.%s", devnum, tmp3);
-       cfgfile_write (f, "input.%d.%s=%s\n", idnum, tmp1, tmp2);
+       cfgfile_write (f, "input.%d.%s=%s\n", idnum, tmp1, tmp2[0] ? tmp2 : "NULL");
        i++;
     }
 }
@@ -689,8 +689,13 @@ void read_inputdevice_config (struct uae_prefs *pr, char *option, char *value)
            }
        }
        flags = getnum (&p);
-       if (custom == NULL && ie->name == NULL)
+       if (custom == NULL && ie->name == NULL) {
+           if (!strcmp(p2,"NULL")) {
+               id->eventid[keynum][subnum] = 0;
+               id->flags[keynum][subnum] = 0;
+           }
            continue;
+       }
        if (joystick < 0) {
            if (!(ie->allow_mask & AM_K))
                continue;
index a3a47440eb7287508e3d853e2ccf5bfc0c0e64fb..e6bfb11de62b39a0cb396b6c3271e71b08cf0bb0 100755 (executable)
--- a/memory.c
+++ b/memory.c
@@ -88,6 +88,7 @@ void romlist_clear (void)
 
 static struct romdata roms[] = {
     { "Cloanto Amiga Forever ROM key", 0, 0, 0, 0, 0, 0x869ae1b1, 2069, 0, 0, 1, ROMTYPE_KEY },
+    { "Cloanto Amiga Forever 2006 ROM key", 0, 0, 0, 0, 0, 0xb01c4b56, 750, 48, 0, 1, ROMTYPE_KEY },
 
     { "KS ROM v1.0 (A1000)(NTSC)", 1, 0, 1, 0, "A1000\0", 0x299790ff, 262144, 1, 0, 0, ROMTYPE_KICK },
     { "KS ROM v1.1 (A1000)(NTSC)", 1, 1, 31, 34, "A1000\0", 0xd060572a, 262144, 2, 0, 0, ROMTYPE_KICK },
@@ -272,10 +273,17 @@ uae_u8 *load_keyfile (struct uae_prefs *p, char *path, int *size)
     f = zfile_fopen (tmp, "rb");
     {
        if (!f) {
-           struct romdata *rd = getromdatabyid (0);
-           char *s = romlist_get (rd);
-           if (s)
-               f = zfile_fopen (s, "rb");
+           struct romdata *rd;
+           char *s;
+
+           rd = getromdatabyid (48);
+           if (!rd)
+               rd = getromdatabyid (0);
+           s = romlist_get (rd);
+           if (s) {
+               strcpy (tmp, s);
+               f = zfile_fopen (tmp, "rb");
+           }
            if (!f) {
                strcpy (tmp, p->path_rom);
                strcat (tmp, "rom.key");
index 86422c6e9d67a0e65ac9695f49dcc8044ea9176c..77022be919eeb180ac53f51eff040f920b641315 100755 (executable)
@@ -268,8 +268,8 @@ static int initialize_rawinput (void)
 
     gotnum = pGetRawInputDeviceList(ridl, &num, sizeof (RAWINPUTDEVICELIST));
     if (gotnum <= 0) {
-       write_log ("RAWINPUT didn't find any devices");
-       goto error;
+       write_log ("RAWINPUT didn't find any devices\n");
+       goto error2;
     }
     write_log ("RAWINPUT: found %d devices\n", gotnum);
     rnum_raw = rnum_mouse = rnum_kb = 0;
@@ -376,8 +376,9 @@ static int initialize_rawinput (void)
        rawinput_available = 1;
     return 1;
 
-    error:
+error:
     write_log ("RAWINPUT not available or failed to initialize\n");
+error2:
     free (ridl);
     free (buf);
     return 0;
index 4d747775e80d5966052e123cc5f08fcf9df5e57d..13b0dba1bb314064222c8dd95b4da3860b35837b 100755 (executable)
@@ -310,6 +310,15 @@ void my_kbd_handler (int keyboard, int scancode, int newstate)
     int code = 0;
     static int swapperdrive = 0;
 
+    extern int last_n, last_n2;
+    extern void blehint(void);
+    if (newstate && scancode == DIK_F1)
+       write_log("%d %d\n", last_n, last_n2);
+    if (newstate && scancode == DIK_F2) {
+       blehint();
+       write_log("INT\n");
+    }
+
     //write_log( "keyboard = %d scancode = 0x%02.2x state = %d\n", keyboard, scancode, newstate ); 
     if (newstate) {
        switch (scancode)
index e7dfa73ce9369f6323cedc9df20c05a1a2e74e68..369606529bbe30d9419a5af5419bfea4dc48febb 100755 (executable)
@@ -8,162 +8,7 @@
   * Copyright 1996 Bernd Schmidt
   */
 
-#if defined( __GNUC__ ) && defined( X86_ASSEMBLY )
-
-#define X86_PPRO_OPT
-
-static __inline__ uae_u32 do_get_mem_long (uae_u32 *a)
-{
-    uae_u32 retval;
-
-    __asm__ ("bswap %0" : "=r" (retval) : "0" (*a) : "cc");
-    return retval;
-}
-
-static __inline__ uae_u32 do_get_mem_word (uae_u16 *a)
-{
-    uae_u32 retval;
-
-#ifdef X86_PPRO_OPT
-    __asm__ ("movzwl %w1,%k0\n\tshll $16,%k0\n\tbswap %k0\n" : "=&r" (retval) : "m" (*a) : "cc");
-#else
-    __asm__ ("xorl %k0,%k0\n\tmovw %w1,%w0\n\trolw $8,%w0" : "=&r" (retval) : "m" (*a) : "cc");
-#endif
-    return retval;
-}
-
-#define do_get_mem_byte(a) ((uae_u32)*(uae_u8 *)(a))
-
-static __inline__ void do_put_mem_long (uae_u32 *a, uae_u32 v)
-{
-    __asm__ ("bswap %0" : "=r" (v) : "0" (v) : "cc");
-    *a = v;
-}
-
-static __inline__ void do_put_mem_word (uae_u16 *a, uae_u32 v)
-{
-#ifdef X86_PPRO_OPT
-    __asm__ ("bswap %0" : "=&r" (v) : "0" (v << 16) : "cc");
-#else
-    __asm__ ("rolw $8,%w0" : "=r" (v) : "0" (v) : "cc");
-#endif
-    *a = v;
-}
-
-#define do_put_mem_byte(a,v) (*(uae_u8 *)(a) = (v))
-
-#if 0
-static __inline__ uae_u32 call_mem_get_func(mem_get_func func, uae_cptr addr)
-{
-    uae_u32 result;
-    __asm__("call %1"
-           : "=a" (result) : "r" (func), "a" (addr) : "cc", "edx", "ecx");
-    return result;
-}
-
-static __inline__ void call_mem_put_func(mem_put_func func, uae_cptr addr, uae_u32 v)
-{
-    __asm__("call %2"
-           : : "a" (addr), "d" (v), "r" (func) : "cc", "eax", "edx", "ecx", "memory");
-}
-#else
-
-#define call_mem_get_func(func,addr) ((*func)(addr))
-#define call_mem_put_func(func,addr,v) ((*func)(addr,v))
-
-#endif
-
-#undef NO_INLINE_MEMORY_ACCESS
-#undef MD_HAVE_MEM_1_FUNCS
-
-#ifdef MD_HAVE_MEM_1_FUNCS
-static __inline__ uae_u32 longget_1 (uae_cptr addr)
-{
-    uae_u32 result;
-
-    __asm__ ("andl $0x00FFFFFF,%1\n"
-            "\tcmpb $0,(%1,%3)\n"
-            "\tleal 1f,%%ecx\n"
-            "\tje longget_stub\n"
-            "\taddl address_space,%1\n"
-            "\tmovl (%1),%0\n"
-            "\tbswap %0\n"
-            "\t1:"
-            : "=c" (result), "=d" (addr) : "1" (addr), "r" (good_address_map) : "cc");
-    return result;
-}
-static __inline__ uae_u32 wordget_1 (uae_cptr addr)
-{
-    uae_u32 result;
-
-    __asm__ ("andl $0x00FFFFFF,%1\n"
-            "\tcmpb $0,(%1,%3)\n"
-            "\tleal 1f,%%ecx\n"
-            "\tje wordget_stub\n"
-            "\taddl address_space,%1\n"
-            "\tmovzwl (%1),%0\n"
-            "\trolw $8,%w0\n"
-            "\t1:"
-            : "=c" (result), "=d" (addr) : "1" (addr), "r" (good_address_map) : "cc");
-    return result;
-}
-static __inline__ uae_u32 byteget_1 (uae_cptr addr) 
-{
-    uae_u32 result;
-
-    __asm__ ("andl $0x00FFFFFF,%1\n"
-            "\tcmpb $0,(%1,%3)\n"
-            "\tleal 1f,%%ecx\n"
-            "\tje byteget_stub\n"
-            "\taddl address_space,%1\n"
-            "\tmovzbl (%1),%0\n"
-            "\t1:"
-            : "=c" (result), "=d" (addr) : "1" (addr), "r" (good_address_map) : "cc");
-    return result;
-}
-static __inline__ void longput_1 (uae_cptr addr, uae_u32 l)
-{
-    __asm__ __volatile__("andl $0x00FFFFFF,%0\n"
-            "\tcmpb $0,(%0,%3)\n"
-            "\tleal 1f,%%ecx\n"
-            "\tje longput_stub\n"
-            "\taddl address_space,%0\n"
-            "\tbswap %1\n"
-            "\tmovl %1,(%0)\n"
-            "\t1:"
-            : "=d" (addr), "=b" (l) : "0" (addr), "r" (good_address_map), "1" (l) : "cc", "memory", "ecx");
-}
-static __inline__ void wordput_1 (uae_cptr addr, uae_u32 w)
-{
-    __asm__ __volatile__("andl $0x00FFFFFF,%0\n"
-            "\tcmpb $0,(%0,%3)\n"
-            "\tleal 1f,%%ecx\n"
-            "\tje wordput_stub\n"
-            "\taddl address_space,%0\n"
-            "\trolw $8,%1\n"
-            "\tmovw %w1,(%0)\n"
-            "\t1:"
-            : "=d" (addr), "=b" (w) : "0" (addr), "r" (good_address_map), "1" (w) : "cc", "memory", "ecx");
-}
-static __inline__ void byteput_1 (uae_cptr addr, uae_u32 b)
-{
-    __asm__ __volatile__("andl $0x00FFFFFF,%0\n"
-            "\tcmpb $0,(%0,%3)\n"
-            "\tleal 1f,%%ecx\n"
-            "\tje byteput_stub\n"
-            "\taddl address_space,%0\n"
-            "\tmovb %b1,(%0)\n"
-            "\t1:"
-            : "=d" (addr), "=b" (b) : "0" (addr), "r" (good_address_map), "1" (b) : "cc", "memory", "ecx");
-}
-
-#endif
-
-#define ALIGN_POINTER_TO32(p) ((~(unsigned long)(p)) & 3)
-
-#else
-
-static __inline__ uae_u32 do_get_mem_long(uae_u32 *a)
+STATIC_INLINE uae_u32 do_get_mem_long(uae_u32 *a)
 {
 #if !defined(X86_MSVC_ASSEMBLY)
     uae_u8 *b = (uae_u8 *)a;
@@ -181,7 +26,7 @@ static __inline__ uae_u32 do_get_mem_long(uae_u32 *a)
 #endif
 }
 
-static __inline__ uae_u16 do_get_mem_word(uae_u16 *a)
+STATIC_INLINE uae_u16 do_get_mem_word(uae_u16 *a)
 {
     uae_u8 *b = (uae_u8 *)a;
     
@@ -190,7 +35,7 @@ static __inline__ uae_u16 do_get_mem_word(uae_u16 *a)
 
 #define do_get_mem_byte(a) ((uae_u32)*(uae_u8 *)(a))
 
-static __inline__ void do_put_mem_long(uae_u32 *a, uae_u32 v)
+STATIC_INLINE void do_put_mem_long(uae_u32 *a, uae_u32 v)
 {
 #if !defined(X86_MSVC_ASSEMBLY)
     uae_u8 *b = (uae_u8 *)a;
@@ -210,20 +55,7 @@ static __inline__ void do_put_mem_long(uae_u32 *a, uae_u32 v)
 #endif
 }
 
-static __inline__ void do_put_mem_long_long(uae_u64 *a, uae_u64 v)
-{
-    uae_u8 *b = (uae_u8 *)a;
-    *b = (uae_u8)(v >> 56);
-    *(b+1) = (uae_u8)(v >> 48);
-    *(b+2) = (uae_u8)(v >> 40);
-    *(b+3) = (uae_u8)(v >> 32);
-    *(b+4) = (uae_u8)(v >> 24);
-    *(b+5) = (uae_u8)(v >> 16);
-    *(b+6) = (uae_u8)(v >> 8);
-    *(b+7) = (uae_u8)(v);
-}
-
-static __inline__ void do_put_mem_word(uae_u16 *a, uae_u16 v)
+STATIC_INLINE void do_put_mem_word(uae_u16 *a, uae_u16 v)
 {
     uae_u8 *b = (uae_u8 *)a;
     
@@ -231,7 +63,7 @@ static __inline__ void do_put_mem_word(uae_u16 *a, uae_u16 v)
     *(b+1) = (uae_u8)v;
 }
 
-static __inline__ void do_put_mem_byte(uae_u8 *a, uae_u8 v)
+STATIC_INLINE void do_put_mem_byte(uae_u8 *a, uae_u8 v)
 {
     *a = v;
 }
@@ -239,9 +71,4 @@ static __inline__ void do_put_mem_byte(uae_u8 *a, uae_u8 v)
 #define call_mem_get_func(func, addr) ((*func)(addr))
 #define call_mem_put_func(func, addr, v) ((*func)(addr, v))
 
-#undef NO_INLINE_MEMORY_ACCESS
-#undef MD_HAVE_MEM_1_FUNCS
-
 #endif
-
-#endif
\ No newline at end of file
index c22b76dfe58e1b7db21a6a13d71e21bdd5681296..424e98cd502ebf584d7e08bb914907c2edc71112 100755 (executable)
@@ -16,29 +16,9 @@ extern int rpt_skip_trigger;
 typedef unsigned long frame_time_t;
 
 /* For CPUs that lack the rdtsc instruction or systems that change CPU frequency on the fly (most laptops) */
-extern frame_time_t read_processor_time_qpc( void );
+extern frame_time_t read_processor_time_qpc(void);
 extern int useqpc;
 
-#if defined( __GNUC__ )
-static inline frame_time_t read_processor_time (void)
-{
-    frame_time_t foo;
-    int dummy;
-
-    if( useqpc )
-        return read_processor_time_cyrix();
-
-    /* Don't assume the assembler knows rdtsc */
-    __asm__ __volatile__ (".byte 0x0f,0x31" : "=a" (foo), "=d" (dummy) :);
-    return foo;
-}
-#elif defined( __WATCOMC__ )
-extern frame_time_t read_processor_time (void);
-#pragma aux read_processor_time = \
- "rdtsc" \
- modify [eax edx] value [eax];
-#elif defined( _MSC_VER ) && !defined( _WIN32_WCE )
-
 STATIC_INLINE frame_time_t read_processor_time_qpc (void)
 {
     LARGE_INTEGER counter;
@@ -79,11 +59,5 @@ STATIC_INLINE frame_time_t read_processor_time (void)
 #endif
     return foo;
 }
-#else
-static __inline__ frame_time_t read_processor_time (void)
-{
-    return 0;
-}
-#endif
 
 #endif
index 0e13f24f28ed13a83fb43eeeb0241f5eca92bc04..5bb9514c3688f46d76d5c31cfc1dd97552e08ff2 100755 (executable)
@@ -7,288 +7,3 @@
   */
 
 
-#include "sysconfig.h"
-#include "sysdeps.h"
-
-#include "config.h"
-#include "options.h"
-#include "machdep/m68k.h"
-#include "events.h"
-
-#ifdef X86_ASSEMBLY
-
-#ifndef USE_UNDERSCORE
-#define LARGE_ALIGNMENT ".align 16\n"
-#else
-#define LARGE_ALIGNMENT ".align 4,0x90\n"
-#endif
-
-struct flag_struct regflags;
-
-/*
- * Careful: No unique labels. Unfortunately, not each installation of GCC 
- * comes with GAS. Bletch.
- */
-
-int fast_memcmp(const void *foo, const void *bar, int len)
-{
-    int differs, baz;
-    __asm__ __volatile__ ("subl $4, %2\n"
-                         "jc  LLA2\n"
-                         "LLA1:\n"
-                         "movl (%0),%%ebx\n"
-                         "cmpl (%1),%%ebx\n"
-                         "jne LLA5\n"
-                         "addl $4, %0\n"
-                         "addl $4, %1\n"
-                         "subl $4, %2\n"
-                         "jnc  LLA1\n"
-                         "LLA2:\n"
-                         "addl $4, %2\n"
-                         "jz LLA4\n"
-                         "LLA3:\n"
-                         "movb (%0),%%bl\n"
-                         "cmpb (%1),%%bl\n"
-                         "jne LLA5\n"
-                         "incl %0\n"
-                         "incl %1\n"
-                         "decl %2\n"
-                         "jnz LLA3\n"
-                         "LLA4:\n"
-                         "movl $0, %3\n"
-                         "jmp LLA6\n"
-                         "LLA5:\n"
-                         "movl $1, %3\n"
-                         "LLA6:\n"
-                         : "=&r" (foo), "=&r" (bar), "=&rm" (len), "=rm" (differs),
-                           "=&b" (baz)
-                         : "0" (foo), "1" (bar), "2" (len), "3" (baz) : "cc");
-    return differs;
-}
-
-int memcmpy(void *foo, const void *bar, int len)
-{
-    int differs = 0, baz = 0, uupzuq = 0;
-
-    __asm__ __volatile__ ("subl %1, %2\n"
-                         "subl $16, %3\n"
-                         "jc LLB7\n"
-                         LARGE_ALIGNMENT
-                         "LLB8:\n"
-                         "movl (%2,%1),%%ebx\n"
-                         "movl (%1),%%ecx\n"
-                         "cmpl %%ebx, %%ecx\n"
-                         "jne LLC1\n"
-                         
-                         "movl 4(%2,%1),%%ebx\n"
-                         "movl 4(%1),%%ecx\n"
-                         "cmpl %%ebx, %%ecx\n"
-                         "jne LLC2\n"
-                         
-                         "movl 8(%2,%1),%%ebx\n"
-                         "movl 8(%1),%%ecx\n"
-                         "cmpl %%ebx, %%ecx\n"
-                         "jne LLC3\n"
-                         
-                         "movl 12(%2,%1),%%ebx\n"
-                         "movl 12(%1),%%ecx\n"
-                         "cmpl %%ebx, %%ecx\n"
-                         "jne LLC4\n"
-                         
-                         "addl $16, %1\n"
-                         "subl $16, %3\n"
-                         "jnc  LLB8\n"
-                         
-                         "LLB7:\n"
-                         "addl $16, %3\n"
-                         "subl $4, %3\n"
-                         "jc  LLB2\n"
-
-                         "LLB1:\n"
-                         "movl (%2,%1),%%ebx\n"
-                         "movl (%1),%%ecx\n"
-                         "cmpl %%ebx, %%ecx\n"
-                         "jne LLC5\n"
-                         "addl $4, %1\n"
-                         "subl $4, %3\n"
-                         "jnc  LLB1\n"
-                         
-                         "LLB2:\n"
-                         "addl $4, %3\n"
-                         "jz LLB9\n"
-                         
-                         "LLB3:\n"
-                         "movb (%2,%1),%%bl\n"
-                         "movb (%1),%%cl\n"
-                         "cmpb %%bl,%%cl\n"
-                         "jne LLC6\n"
-                         "incl %1\n"
-                         "decl %3\n"
-                         "jnz LLB3\n"
-                         
-                         "jmp LLB9\n"
-
-                         LARGE_ALIGNMENT
-                         /* Once we find a difference, we switch to plain memcpy() */
-                         "LLC01:\n"
-                         "movl (%2,%1),%%ebx\n"
-                         "LLC1:\n"
-                         "movl %%ebx, (%1)\n"
-                         
-                         "movl 4(%2,%1),%%ebx\n"
-                         "LLC2:\n"
-                         "movl %%ebx, 4(%1)\n"
-                         
-                         "movl 8(%2,%1),%%ebx\n"
-                         "LLC3:\n"
-                         "movl %%ebx, 8(%1)\n"
-                         
-                         "movl 12(%2,%1),%%ebx\n"
-                         "LLC4:\n"
-                         "movl %%ebx, 12(%1)\n"
-                         
-                         "addl $16, %1\n"
-#if 0
-                         "movl $1,%0\n"
-                         
-                         "addl %1,%2\n"
-                         "movl %3,%%ecx\n"
-                         "shrl $2,%%ecx\n"
-                         "je LLC02a\n"
-                         "rep\n"
-                         "movsl\n"
-                         "andl $3,%3\n"
-                         "je LLB9\n"
-                         "LLC02a:\n"
-                         "movb (%2),%%bl\n"
-                         
-                         "movb %%bl,(%1)\n"
-                         "incl %1\n"
-                         "decl %3\n"
-                         "jnz LLC02a\n"
-                         "jmp LLB9\n"
-#else
-#if 0
-                         "movl $1,%0\n"
-                         "jnc  LLB8\n"
-#else
-                         "subl $16, %3\n"
-                         "jnc LLC01\n"
-#endif
-
-                         "addl $16, %3\n"
-                         "subl $4, %3\n"
-                         "jc  LLC03\n"
-#endif
-                         
-                         "LLC02:\n"
-                         "movl (%2,%1),%%ebx\n"
-                         "LLC5:\n"
-                         "movl %%ebx, (%1)\n"
-                         "addl $4, %1\n"
-                         "subl $4, %3\n"
-                         "jnc  LLC02\n"
-                         
-                         "LLC03:\n"
-                         "addl $4, %3\n"
-                         "jz LLC05\n"
-                         
-                         "LLC04:\n"
-                         "movb (%2,%1),%%bl\n"
-                         "LLC6:\n"
-                         "movb %%bl,(%1)\n"
-                         "incl %1\n"
-                         "decl %3\n"
-                         "jnz LLC04\n"
-                         
-                         "LLC05:\n"
-                         "movl $1,%0\n"
-                         "LLB9:"
-                         : "=m" (differs)
-                         : "D" (foo), "S" (bar), "r" (len), "b" (baz), "c" (uupzuq), "0" (differs) : "cc", "memory");
-    /* Now tell the compiler that foo, bar and len have been modified 
-     * If someone finds a way to express all this cleaner in constraints that
-     * GCC 2.7.2 understands, please FIXME */
-    __asm__ __volatile__ ("" : "=rm" (foo), "=rm" (bar), "=rm" (len) : :  "ebx", "ecx", "edx", "eax", "esi", "memory");
-
-    return differs;
-}
-
-#else
-struct flag_struct regflags;
-
-int fast_memcmp(const void *foo, const void *bar, int len)
-{
-    return memcmp(foo, bar, len);
-}
-
-int memcmpy(void *foo, const void *bar, int len)
-{
-    int differs = memcmp(foo, bar, len);
-    memcpy(foo, bar, len);
-    return differs;
-}
-
-#endif
-
-/* All the Win32 configurations handle this in od-win32/win32.c */
-#ifndef _WIN32
-
-#include <signal.h>
-
-static volatile frame_time_t last_time, best_time;
-static volatile int loops_to_go;
-
-#ifdef __cplusplus
-static RETSIGTYPE alarmhandler(...)
-#else
-static RETSIGTYPE alarmhandler(int foo)
-#endif
-{
-    frame_time_t bar;
-    bar = read_processor_time ();
-    if (bar - last_time < best_time)
-       best_time = bar - last_time;
-    if (--loops_to_go > 0) {
-       signal (SIGALRM, alarmhandler);
-       last_time = read_processor_time();
-       alarm (1);
-    }
-}
-
-#ifdef __cplusplus
-static RETSIGTYPE illhandler(...)
-#else
-static RETSIGTYPE illhandler(int foo)
-#endif
-{
-    rpt_available = 0;
-}
-
-void machdep_init (void)
-{
-    rpt_available = 1;
-    signal (SIGILL, illhandler);
-    read_processor_time ();
-    signal (SIGILL, SIG_DFL);
-    if (! rpt_available) {
-       fprintf (stderr, "Your processor does not support the RDTSC instruction.\n");
-       return;
-    }
-    fprintf (stderr, "Calibrating delay loop.. ");
-    fflush (stderr);
-    best_time = (frame_time_t)-1;
-    loops_to_go = 5;
-    signal (SIGALRM, alarmhandler);
-    /* We want exact values... */
-    sync (); sync (); sync ();
-    last_time = read_processor_time();
-    alarm (1);
-    while (loops_to_go != 0)
-       usleep (1000000);
-    fprintf (stderr, "ok - %.2f BogoMIPS\n",
-            ((double)best_time / 1000000), best_time);
-    vsynctime = best_time / 50;
-}
-
-#endif
index 8588e309b2e08520302b39e119629bfa14a18bde..e57042c3ad41f99454ad7e2a5f340391132c1212 100755 (executable)
@@ -289,10 +289,11 @@ const char *OGL_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth)
     ti2d_type = -1;
     if (depth == 15 || depth == 16) {
        if (!packed_pixels) {
-           gui_message (
-               "OPENGL: can't use 15/16 bit screen depths because EXT_packed_pixels extension was not found.\n"
-               "Falling back to 32-bit mode");
-           depth = 32;
+           gui_message(
+               "OPENGL: can't use 15/16 bit screen depths because EXT_packed_pixels\n"
+               "extension was not found. Falling back to 32-bit mode");
+           OGL_free();
+           return OGL_init(ahwnd, w_w, w_h, t_w, t_h, 32);
        }   
        ti2d_internalformat = GL_RGB5_A1;
         ti2d_format = GL_RGBA;
index c05328d7cc9014325bcc52ac5856a63cbd0c6887..1c28d23526e7a65e3dafb6bb600c4d85c6848e97 100755 (executable)
@@ -80,7 +80,6 @@ static DWORD getattr(const char *name, LPFILETIME lpft, size_t *size)
         fd.dwFileAttributes = GetFileAttributes(name);
         return fd.dwFileAttributes;
     }
-
     FindClose(hFind);
 
     if (lpft)
@@ -122,7 +121,7 @@ int posixemu_chmod(const char *name, int mode)
     return -1;
 }
 
-static void tmToSystemTime( struct tm *tmtime, LPSYSTEMTIME systime )
+static void tmToSystemTime(struct tm *tmtime, LPSYSTEMTIME systime)
 {
     if (tmtime == NULL) {
         GetSystemTime (systime);
@@ -143,14 +142,14 @@ static int setfiletime(const char *name, unsigned int days, int minute, int tick
     FILETIME LocalFileTime, FileTime;
     HANDLE hFile;
     int success;
-    if ((hFile = CreateFile(name, GENERIC_WRITE,FILE_SHARE_READ | FILE_SHARE_WRITE,NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS, NULL)) == INVALID_HANDLE_VALUE) {
+    if ((hFile = CreateFile(name, GENERIC_WRITE,FILE_SHARE_READ | FILE_SHARE_WRITE,NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS, NULL)) == INVALID_HANDLE_VALUE)
        return 0;
-    }
 
     *(__int64 *)&LocalFileTime = (((__int64)(377*365+91+days)*(__int64)1440+(__int64)minute)*(__int64)(60*50)+(__int64)tick)*(__int64)200000;
     
     if (tolocal) {
-       if (!LocalFileTimeToFileTime(&LocalFileTime,&FileTime)) FileTime = LocalFileTime;
+       if (!LocalFileTimeToFileTime(&LocalFileTime,&FileTime))
+           FileTime = LocalFileTime;
     } else {
        FileTime = LocalFileTime;
     }
@@ -181,7 +180,6 @@ int posixemu_utime( const char *name, struct utimbuf *ttime )
        return result;
 }
 
-/* pthread Win32 emulation */
 void uae_sem_init (uae_sem_t * event, int manual_reset, int initial_state)
 {
     if(*event) {
@@ -211,9 +209,8 @@ int uae_sem_trywait (uae_sem_t * event)
 
 void uae_sem_destroy (uae_sem_t * event)
 {
-    if( *event )
-    {
-       CloseHandle( *event );
+    if(*event) {
+       CloseHandle(*event);
        *event = NULL;
     }
 }
index 6da88d12ee6449221ab1acb713becb2bb3dab731..f27eae78a6bfe60fcda25cc5ba7a4a462876fe22 100755 (executable)
@@ -1131,7 +1131,7 @@ BEGIN
     IDS_SOUND_4CHANNEL      "4 Channels"
     IDS_HF_FS_CUSTOM        "Custom"
     IDS_SELECTFS            "Select file system handler (FastFileSystem, SmartFilesystem, etc.)"
-    IDS_KEYJOY              "Keyboard Layout A (Numeric keypad, 0 and 5 = Fire)\nKeyboard Layout B (Cursor keys, Right CTRL and ALT = Fire)\nKeyboard Layout C (T=Up B=Down F=Left H=Right, Left ALT = Fire)\nX-Arcade (Left)\nX-Arcade (Right)"
+    IDS_KEYJOY              "Keyboard Layout A (Numeric keypad, 0 and 5 = Fire)\nKeyboard Layout B (Cursor keys, Right CTRL and ALT = Fire)\nKeyboard Layout C (W=Up S=Down A=Left D=Right, Left ALT = Fire)\nX-Arcade (Left)\nX-Arcade (Right)"
     IDS_STATEFILE_UNCOMPRESSED "Uncompressed"
     IDS_STATEFILE_RAMDUMP   "RAM dump"
     IDS_STATEFILE_WAVE      "Wave audio dump"
index cb98e5d3410713806ce5ab4d3cab2f94a07fa313..7b98ad11fd3c911b3dc2234400d9ca2002713812 100755 (executable)
 
 #include <math.h>
 
-#define ADJUST_SIZE 10
+#define ADJUST_SIZE 20
 #define EXP 1.3
 
-//#define SOUND_DEBUG
+int sound_debug;
 
 static int obtainedfreq;
 static int have_sound;
@@ -51,6 +51,8 @@ uae_u16 *sndbufpt;
 int sndbufsize;
 
 static int max_sndbufsize, snd_configsize, dsoundbuf;
+static int snd_writeoffset, snd_maxoffset, snd_totalmaxoffset;
+static int waiting_for_buffer;
 
 static uae_sem_t sound_sem, sound_init_sem;
 
@@ -60,9 +62,9 @@ static char *sound_devices[MAX_SOUND_DEVICES];
 GUID sound_device_guid[MAX_SOUND_DEVICES];
 static int num_sound_devices;
 
-static LPDIRECTSOUND lpDS;
+static LPDIRECTSOUND8 lpDS;
 static LPDIRECTSOUNDBUFFER lpDSBprimary;
-static LPDIRECTSOUNDBUFFER lpDSBsecondary;
+static LPDIRECTSOUNDBUFFER8 lpDSBsecondary;
 
 static DWORD writepos;
 
@@ -113,29 +115,25 @@ static void clearbuffer (void)
 
 static void pause_audio_ds (void)
 {
+    waiting_for_buffer = 0;
     IDirectSoundBuffer_Stop (lpDSBsecondary);
+    IDirectSoundBuffer_SetCurrentPosition (lpDSBsecondary, 0);
     clearbuffer ();
 }
 
 static void resume_audio_ds (void)
 {
-    HRESULT hr;
-    
     paused = 0;
     clearbuffer ();
-    hr = IDirectSoundBuffer_Play (lpDSBsecondary, 0, 0, DSBPLAY_LOOPING);
-    if (FAILED(hr))
-       write_log ("SOUND: play failed: %s\n", DXError (hr));
-    writepos = snd_configsize;
+    waiting_for_buffer = 1;
 }
 
 static int restore (DWORD hr)
 {
     if (hr != DSERR_BUFFERLOST)
        return 0;
-#ifdef SOUND_DEBUG
-    write_log ("sound buffer lost\n");
-#endif
+    if (sound_debug)
+       write_log ("sound buffer lost\n");
     hr = IDirectSoundBuffer_Restore (lpDSBsecondary);
     if (FAILED(hr)) {
        write_log ("SOUND: restore failed %s\n", DXError (hr));
@@ -177,6 +175,7 @@ static int calibrate (void)
     int pos, lastpos, tpos, expected, diff;
     int mult = (currprefs.sound_stereo == 3) ? 8 : (currprefs.sound_stereo ? 4 : 2);
     double qv, pct;
+    HRESULT hr;
 
     if (!QueryPerformanceFrequency(&qpf)) {
        write_log ("SOUND: no QPF, can't calibrate\n");
@@ -185,6 +184,9 @@ static int calibrate (void)
     pos = 1000;
     pause_audio_ds ();
     resume_audio_ds ();
+    hr = IDirectSoundBuffer_Play (lpDSBsecondary, 0, 0, DSBPLAY_LOOPING);
+    if (FAILED(hr)) 
+       return 100 * 10;
     while (pos >= 1000)
         pos = getpos();
     while (pos < 1000)
@@ -212,11 +214,13 @@ static int calibrate (void)
 
 static void close_audio_ds (void)
 {
+    waiting_for_buffer = 0;
     if (lpDSBsecondary)
        IDirectSound_Release (lpDSBsecondary);
     if (lpDSBprimary)
        IDirectSound_Release (lpDSBprimary);
-    lpDSBsecondary = lpDSBprimary = 0;
+    lpDSBsecondary = 0;
+    lpDSBprimary = 0;
     if (lpDS) {
        IDirectSound_Release (lpDS);
        write_log ("SOUND: DirectSound driver freed\n");
@@ -246,6 +250,7 @@ static int open_audio_ds (int size)
     DSBCAPS DSBCaps;
     WAVEFORMATEX wavfmt;
     int freq = currprefs.sound_freq;
+    LPDIRECTSOUNDBUFFER pdsb;
     
     enumerate_sound_devices (0);
     if (currprefs.sound_stereo == 3) {
@@ -260,7 +265,7 @@ static int open_audio_ds (int size)
     if (sndbufsize > SND_MAX_BUFFER)
         sndbufsize = SND_MAX_BUFFER;
 
-    hr = DirectSoundCreate (&sound_device_guid[currprefs.win32_soundcard], &lpDS, NULL);
+    hr = DirectSoundCreate8 (&sound_device_guid[currprefs.win32_soundcard], &lpDS, NULL);
     if (FAILED(hr))  {
         write_log ("SOUND: DirectSoundCreate() failure: %s\n", DXError (hr));
         return 0;
@@ -319,6 +324,7 @@ static int open_audio_ds (int size)
     if (max_sndbufsize > SND_MAX_BUFFER2)
         max_sndbufsize = SND_MAX_BUFFER2;
     dsoundbuf = max_sndbufsize * 2;
+
     hr = IDirectSound_SetCooperativeLevel (lpDS, hMainWnd, DSSCL_PRIORITY);
     if (FAILED(hr)) {
         write_log ("SOUND: Can't set cooperativelevel: %s\n", DXError (hr));
@@ -331,18 +337,28 @@ static int open_audio_ds (int size)
     if (max_sndbufsize > dsoundbuf)
         max_sndbufsize = dsoundbuf;
 
+    snd_writeoffset = max_sndbufsize * 3 / 4;
+    snd_maxoffset = max_sndbufsize;
+    snd_totalmaxoffset = max_sndbufsize + (dsoundbuf - max_sndbufsize) / 2;
+
     memset (&sound_buffer, 0, sizeof (sound_buffer));
     sound_buffer.dwSize = sizeof (sound_buffer);
     sound_buffer.dwBufferBytes = dsoundbuf;
     sound_buffer.lpwfxFormat = &wavfmt;
-    sound_buffer.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_GLOBALFOCUS | DSBCAPS_STATIC;
-    sound_buffer.dwFlags |= DSBCAPS_CTRLVOLUME;
+    sound_buffer.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_GLOBALFOCUS;
+    sound_buffer.dwFlags |= DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLPOSITIONNOTIFY;
 
-    hr = IDirectSound_CreateSoundBuffer(lpDS, &sound_buffer, &lpDSBsecondary, NULL);
+    hr = IDirectSound_CreateSoundBuffer(lpDS, &sound_buffer, &pdsb, NULL);
     if (FAILED(hr)) {
         write_log ("SOUND: Secondary CreateSoundBuffer() failure: %s\n", DXError (hr));
         goto error;
     }
+    hr = IDirectSound_QueryInterface(pdsb, &IID_IDirectSoundBuffer8, (LPVOID*)&lpDSBsecondary);
+    if (FAILED(hr))  {
+        write_log ("SOUND: Primary QueryInterface() failure: %s\n", DXError (hr));
+       goto error;
+    }
+    IDirectSound_Release(pdsb);
 
     hr = IDirectSoundBuffer_SetFormat (lpDSBprimary, &wavfmt);
     if (FAILED(hr))  {
@@ -350,9 +366,7 @@ static int open_audio_ds (int size)
         goto error;
     }
     setvolume ();
-
     clearbuffer ();
-
     init_sound_table16 ();
     if (currprefs.sound_stereo == 3)
        sample_handler = sample16ss_handler;
@@ -475,7 +489,8 @@ void sound_setadjust (double v)
        vsynctime = (long)(((double)vsynctime_orig) * mult / 1000.0);
        scaled_sample_evtime = scaled_sample_evtime_orig;
     } else {
-       vsynctime = vsynctime_orig * 9 / 10;
+       vsynctime = vsynctime_orig * mult / 1000.0;
+       scaled_sample_evtime = scaled_sample_evtime_orig;
     }
 }
 
@@ -489,6 +504,37 @@ static void finish_sound_buffer_ds (void)
     int counter = 1000;
     double vdiff, m, skipmode;
 
+    if (!waiting_for_buffer)
+       return;
+    if (waiting_for_buffer == 1) {
+        int safedist;
+       hr = IDirectSoundBuffer_Play (lpDSBsecondary, 0, 0, DSBPLAY_LOOPING);
+       if (FAILED(hr)) {
+           write_log ("SOUND: Play failed: %s\n", DXError (hr));
+           restore (DSERR_BUFFERLOST);
+           waiting_for_buffer = 0;
+           return;
+       }
+       hr = IDirectSoundBuffer_GetCurrentPosition (lpDSBsecondary, &playpos, &safedist);
+       if (FAILED(hr)) {
+           write_log ("SOUND: 1st GetCurrentPosition failed: %s\n", DXError (hr));
+           restore (DSERR_BUFFERLOST);
+           waiting_for_buffer = 0;
+           return;
+       }
+       safedist -= playpos;
+       if (safedist < 0)
+           safedist += dsoundbuf;
+       safedist += sndbufsize;
+       snd_totalmaxoffset += safedist;
+       snd_maxoffset += safedist;
+       snd_writeoffset += safedist;
+       writepos = snd_writeoffset + safedist;
+       waiting_for_buffer = -1;
+       write_log("SOUND: safedist=%d snd_total=%d snd_max=%d snd_write=%d\n",
+           safedist, snd_totalmaxoffset, snd_maxoffset, snd_writeoffset);
+    }
+
     hr = IDirectSoundBuffer_GetStatus (lpDSBsecondary, &status);
     if (FAILED(hr)) {
        write_log ("SOUND: GetStatus() failed: %s\n", DXError(hr));
@@ -520,16 +566,16 @@ static void finish_sound_buffer_ds (void)
        else
            diff = dsoundbuf - playpos + writepos;
 
-       if (diff >= max_sndbufsize) {
-           writepos = safepos + snd_configsize;
+       if (diff >= snd_totalmaxoffset) {
+           writepos = safepos + snd_writeoffset;
            if (writepos >= dsoundbuf)
                writepos -= dsoundbuf;
-           diff = snd_configsize;
+           diff = snd_writeoffset;
            break;
        }
 
-       if (diff > max_sndbufsize * 6 / 8) {
-           sleep_millis_busy (1);
+       if (diff > snd_maxoffset) {
+           sleep_millis(1);
            counter--;
            if (counter < 0) {
                write_log ("SOUND: sound system got stuck!?\n");
@@ -548,31 +594,38 @@ static void finish_sound_buffer_ds (void)
        write_log ("SOUND: lock failed: %s (%d %d)\n", DXError (hr), writepos, sndbufsize);
         return;
     }
-    memcpy (b1, sndbuffer, sndbufsize >= s1 ? s1 : sndbufsize);
+    memcpy (b1, sndbuffer, s1);
     if (b2)
-        memcpy (b2, (uae_u8*)sndbuffer + s1, sndbufsize - s1);
+        memcpy (b2, (uae_u8*)sndbuffer + s1, s2);
     IDirectSoundBuffer_Unlock (lpDSBsecondary, b1, s1, b2, s2);
 
-    vdiff = diff - snd_configsize;
+    vdiff = diff - snd_writeoffset;
     m = 100.0 * vdiff / max_sndbufsize;
-    skipmode = pow (m < 0 ? -m : m, EXP)/ 10.0;
-
-    if (m < 0) skipmode = -skipmode;
-    if (skipmode < -ADJUST_SIZE) skipmode = -ADJUST_SIZE;
-    if (skipmode > ADJUST_SIZE) skipmode = ADJUST_SIZE;
-
-#ifdef SOUND_DEBUG
-    if (!(timeframes % 10)) {
-       write_log ("b=%5d,%5d,%5d,%5d diff=%5d vdiff=%5.0f vdiff2=%5d skip=%+02.1f\n",
-           sndbufsize, snd_configsize, max_sndbufsize, dsoundbuf, diff, vdiff, diff - snd_configsize, skipmode);
+    skipmode = pow (m < 0 ? -m : m, EXP) / 2.0;
+
+    if (m < 0)
+       skipmode = -skipmode;
+    if (skipmode < -ADJUST_SIZE)
+       skipmode = -ADJUST_SIZE;
+    if (skipmode > ADJUST_SIZE)
+       skipmode = ADJUST_SIZE;
+
+    if (sound_debug) {
+       static int tfprev;
+       if (tfprev != timeframes && !(timeframes % 10)) {
+           write_log ("b=%5d,%5d,%5d,%5d d=%5d vd=%5.0f s=%+02.1f\n",
+               sndbufsize, snd_configsize, max_sndbufsize, dsoundbuf, diff, vdiff, skipmode);
+       }
+       tfprev = timeframes;
     }
-#endif
 
     writepos += sndbufsize;
     if (writepos >= dsoundbuf)
        writepos -= dsoundbuf;
 
     sound_setadjust (skipmode);
+
+    gui_data.sndbuf = vdiff * 1000 / snd_maxoffset;
 }
 
 static void channelswap(uae_s16 *sndbuffer, int len)
index b3b2550223665ff2fa854ff61c73ccfa657eb111..f707528e28a457d8853c0ecdd7c7511f7b741038 100755 (executable)
@@ -23,7 +23,7 @@ extern int drivesound_init (void);
 extern void drivesound_free (void);
 extern void sound_volume (int);
 
-static __inline__ void check_sound_buffers (void)
+STATIC_INLINE void check_sound_buffers (void)
 {
     if (currprefs.sound_stereo == 2) {
        ((uae_u16*)sndbufpt)[0] = ((uae_u16*)sndbufpt)[-2];
diff --git a/od-win32/sounddep/sound3.c b/od-win32/sounddep/sound3.c
new file mode 100755 (executable)
index 0000000..c9cc9a1
--- /dev/null
@@ -0,0 +1,856 @@
+ /* 
+  * UAE - The Un*x Amiga Emulator
+  * 
+  * Win32 sound interface (DirectSound)
+  *
+  * Copyright 1997 Mathias Ortmann
+  * Copyright 1997-2001 Brian King
+  * Copyright 2000-2002 Bernd Roesch
+  * Copyright 2002-2003 Toni Wilen
+  */
+
+#include "sysconfig.h"
+#include "sysdeps.h"
+
+#include "options.h"
+#include "memory.h"
+#include "events.h"
+#include "custom.h"
+#include "gensound.h"
+#include "sounddep/sound.h"
+#include "threaddep/thread.h"
+#include "avioutput.h"
+#include "gui.h"
+#include "dxwrap.h"
+#include "win32.h"
+#include "savestate.h"
+#include "driveclick.h"
+#include "audio.h"
+
+#include <windows.h>
+#include <mmsystem.h>
+#include <dsound.h>
+#include <process.h>
+
+#include <math.h>
+
+#define ADJUST_SIZE 10
+#define EXP 1.3
+
+static int sndbuffer_slot_size = 4000;
+static int sndbuffer_slot_num = 16;
+
+//#define SOUND_DEBUG
+
+static int obtainedfreq;
+static int have_sound;
+static int paused;
+static int mute;
+
+static int sndbuffer_size;
+
+uae_u16 sndbuffer[262144];
+uae_u16 *sndbufpt;
+int sndbufsize;
+
+static uae_sem_t sound_sem, sound_init_sem;
+
+#define MAX_SOUND_DEVICES 10
+
+static char *sound_devices[MAX_SOUND_DEVICES];
+GUID sound_device_guid[MAX_SOUND_DEVICES];
+static int num_sound_devices;
+
+static LPDIRECTSOUND8 lpDS;
+static LPDIRECTSOUNDBUFFER lpDSBprimary;
+static LPDIRECTSOUNDBUFFER8 lpDSBsecondary;
+
+int setup_sound (void)
+{
+    sound_available = 1;
+    return 1;
+}
+
+int scaled_sample_evtime_orig;
+static int lastfreq;
+void update_sound (int freq)
+{
+    if (freq < 0)
+       freq = lastfreq;
+    lastfreq = freq;
+    if (have_sound) {
+       if ((currprefs.gfx_vsync && currprefs.gfx_afullscreen) || currprefs.chipset_refreshrate) {
+           if (currprefs.ntscmode)
+               scaled_sample_evtime_orig = (unsigned long)(MAXHPOS_NTSC * MAXVPOS_NTSC * freq * CYCLE_UNIT + obtainedfreq - 1) / obtainedfreq;
+           else
+               scaled_sample_evtime_orig = (unsigned long)(MAXHPOS_PAL * MAXVPOS_PAL * freq * CYCLE_UNIT + obtainedfreq - 1) / obtainedfreq;
+       } else {
+           scaled_sample_evtime_orig = (unsigned long)(312.0 * 50 * CYCLE_UNIT / (obtainedfreq  / 227.5));
+       }
+       scaled_sample_evtime = scaled_sample_evtime_orig;
+    }
+}
+
+static int prevplayslot, writeslot, writeoffset;
+uae_sem_t audiosem;
+
+static void clearbuffer (void)
+{
+    void *buffer;
+    DWORD size;
+    HRESULT hr;
+
+    uae_sem_wait(&audiosem);
+    prevplayslot = 0;
+    writeslot = sndbuffer_slot_num / 3 + 2;
+    memset (sndbuffer, 0, sndbuffer_size);
+    hr = IDirectSoundBuffer_Lock (lpDSBsecondary, 0, sndbuffer_size, &buffer, &size, NULL, NULL, 0);
+    if (hr == DSERR_BUFFERLOST) {
+       IDirectSoundBuffer_Restore (lpDSBsecondary);
+       hr = IDirectSoundBuffer_Lock (lpDSBsecondary, 0, sndbuffer_size, &buffer, &size, NULL, NULL, 0);
+    }
+    if (FAILED(hr)) {
+       write_log ("SOUND: failed to Lock sound buffer (clear): %s\n", DXError (hr));
+        uae_sem_post(&audiosem);
+       return;
+    }
+    memset (buffer, 0, size);
+    IDirectSoundBuffer_Unlock (lpDSBsecondary, buffer, size, NULL, 0);
+    uae_sem_post(&audiosem);
+}
+
+static void pause_audio_ds (void)
+{
+    IDirectSoundBuffer_Stop (lpDSBsecondary);
+    clearbuffer ();
+}
+
+static void resume_audio_ds (void)
+{
+    HRESULT hr;
+    
+    paused = 0;
+    clearbuffer ();
+    hr = IDirectSoundBuffer_SetCurrentPosition (lpDSBsecondary, 0);
+    hr = IDirectSoundBuffer_Play (lpDSBsecondary, 0, 0, DSBPLAY_LOOPING);
+    if (FAILED(hr))
+       write_log ("SOUND: play failed: %s\n", DXError (hr));
+}
+
+static int restore (DWORD hr)
+{
+    if (hr != DSERR_BUFFERLOST)
+       return 0;
+#ifdef SOUND_DEBUG
+    write_log ("sound buffer lost\n");
+#endif
+    hr = IDirectSoundBuffer_Restore (lpDSBsecondary);
+    if (FAILED(hr)) {
+       write_log ("SOUND: restore failed %s\n", DXError (hr));
+       return 1;
+    }
+    pause_audio_ds ();
+    resume_audio_ds ();
+    return 1;
+}
+
+static LARGE_INTEGER qpfc, qpf;
+static void storeqpf (void)
+{
+    QueryPerformanceCounter(&qpfc);
+}
+static double getqpf (void)
+{
+    LARGE_INTEGER qpfc2;
+    QueryPerformanceCounter(&qpfc2);
+    return (qpfc2.QuadPart - qpfc.QuadPart) / (qpf.QuadPart / 1000.0);
+}
+
+static int getpos (void)
+{
+    DWORD playpos, safepos;
+    HRESULT hr;
+
+    hr = IDirectSoundBuffer_GetCurrentPosition (lpDSBsecondary, &playpos, &safepos);
+    if (FAILED(hr)) {
+       write_log ("SOUND: GetCurrentPosition failed: %s\n", DXError (hr));
+       return -1;
+    }
+    return playpos;
+}
+
+static int calibrate (void)
+{
+    int len = 1000;
+    int pos, lastpos, tpos, expected, diff;
+    int mult = (currprefs.sound_stereo == 3) ? 8 : (currprefs.sound_stereo ? 4 : 2);
+    double qv, pct;
+
+    if (!QueryPerformanceFrequency(&qpf)) {
+       write_log ("SOUND: no QPF, can't calibrate\n");
+       return 100 * 10;
+    }
+    pos = 1000;
+    pause_audio_ds ();
+    resume_audio_ds ();
+    while (pos >= 1000)
+        pos = getpos();
+    while (pos < 1000)
+        pos = getpos();
+    lastpos = getpos();
+    storeqpf ();
+    tpos = 0;
+    do {
+       pos = getpos();
+       if (pos < lastpos) {
+           tpos += sndbuffer_size - lastpos + pos;
+       } else {
+           tpos += pos - lastpos;
+       }
+       lastpos = pos;
+        qv = getqpf();
+    } while (qv < len);
+    expected = (int)(len / 1000.0 * currprefs.sound_freq);
+    tpos /= mult;
+    diff = tpos - expected;
+    pct = tpos * 100.0 / expected;
+    write_log ("SOUND: calibration: %d %d (%d %.2f%%)\n", tpos, expected, diff, pct);
+    return (int)(pct * 10);
+}
+
+extern HWND hMainWnd;
+
+static void setvolume (void)
+{
+    HRESULT hr;
+    LONG vol = DSBVOLUME_MIN;
+
+    if (currprefs.sound_volume < 100 && !mute)
+        vol = (LONG)((DSBVOLUME_MIN / 2) + (-DSBVOLUME_MIN / 2) * log (1 + (2.718281828 - 1) * (1 - currprefs.sound_volume / 100.0)));
+    hr = IDirectSoundBuffer_SetVolume (lpDSBsecondary, vol);
+    if (FAILED(hr))
+        write_log ("SOUND: SetVolume(%d) failed: %s\n", vol, DXError (hr));
+}
+
+static volatile int notificationthread_mode;
+static HANDLE notifyevent, notifyevent2;
+
+static unsigned __stdcall notifythread(void *data)
+{
+    notificationthread_mode = 2;
+    write_log("SOUND: notificationthread running\n");
+    while (notificationthread_mode == 2) {
+       HRESULT hr;
+       DWORD status, playpos, safepos;
+       int slot, cnt, incoming, usedslot;
+       void *b1, *b2;
+       DWORD s1, s2;
+       double skipmode;
+
+       WaitForSingleObject(notifyevent, INFINITE);
+       if (!have_sound)
+           continue;
+
+       uae_sem_wait (&audiosem);
+       hr = IDirectSoundBuffer_GetStatus (lpDSBsecondary, &status);
+       if (FAILED(hr)) {
+           write_log ("SOUND: GetStatus() failed: %s\n", DXError(hr));
+           goto nreset;
+       }
+       if (status & DSBSTATUS_BUFFERLOST) {
+           write_log ("SOUND: buffer lost\n");
+           restore (DSERR_BUFFERLOST);
+           goto nreset;
+       }
+       if ((status & (DSBSTATUS_PLAYING | DSBSTATUS_LOOPING)) != (DSBSTATUS_PLAYING | DSBSTATUS_LOOPING)) {
+           write_log ("SOUND: status = %08.8X\n", status);
+           restore (DSERR_BUFFERLOST);
+           goto nreset;
+       }
+       hr = IDirectSoundBuffer_GetCurrentPosition (lpDSBsecondary, &playpos, &safepos);
+       if (FAILED(hr)) {
+           write_log ("SOUND: GetCurrentPosition failed: %s\n", DXError (hr));
+           restore (hr);
+           goto nreset;
+       }
+       slot = playpos / sndbuffer_slot_size;
+
+       usedslot = prevplayslot;
+       while (slot != prevplayslot) {
+           if (writeslot == prevplayslot) {
+               write_log ("UF: missed\n");
+               writeslot = prevplayslot + 1;
+               writeslot %= sndbuffer_slot_num;
+               writeoffset = 0;
+           }
+           prevplayslot++;
+           prevplayslot %= sndbuffer_slot_num;
+       }
+
+       incoming = (uae_u8*)sndbufpt - (uae_u8*)sndbuffer;
+       //write_log ("%d.%d.%d.%d ", playslot, slot, writeslot, incoming);
+       //write_log ("%d ", incoming);
+
+       // handle possible buffer underflow
+       if (slot == writeslot) {
+           writeslot++;
+           writeslot %= sndbuffer_slot_num;
+           if (incoming <= sndbuffer_slot_size) {
+               write_log ("UF: skipped\n");
+               writeslot++;
+               writeslot %= sndbuffer_slot_num;
+               writeoffset = 0;
+           } else if (incoming < sndbuffer_slot_size + (sndbuffer_slot_size - writeoffset)) {
+               write_log ("UF: miniskip\n");
+               writeoffset = sndbuffer_slot_size - (incoming - sndbuffer_slot_size);
+           }
+       }
+
+       // copy new data if available
+       if (incoming > 0) {
+           IDirectSoundBuffer_Lock (lpDSBsecondary, writeslot * sndbuffer_slot_size + writeoffset, incoming,
+               &b1, &s1, &b2, &s2, 0);
+           memcpy (b1, sndbuffer, s1);
+           if (b2)
+               memcpy (b2, (uae_u8*)sndbuffer + s1, s2);
+           IDirectSoundBuffer_Unlock (lpDSBsecondary, b1, s1, b2, s2);
+           writeslot += (writeoffset + incoming) / sndbuffer_slot_size;
+           writeslot %= sndbuffer_slot_num;
+           writeoffset = (writeoffset + incoming) % sndbuffer_slot_size;
+       }
+
+       // clear already played slot(s)
+       cnt = (usedslot >= slot ? sndbuffer_slot_num - usedslot + slot : slot - usedslot) - 1;
+       if (0 && cnt > 0) {
+           IDirectSoundBuffer_Lock (lpDSBsecondary, usedslot * sndbuffer_slot_size, cnt * sndbuffer_slot_size,
+               &b1, &s1, &b2, &s2, 0);
+           if (FAILED(hr)) {
+               write_log ("SOUND: lock failed: %s (%d %d)\n", DXError (hr), usedslot, cnt);
+               goto nreset;
+           }
+           memset (b1, 0, s1);
+           if (b2)
+               memset (b2, 0, s2);
+           IDirectSoundBuffer_Unlock (lpDSBsecondary, b1, s1, b2, s2);
+       }
+
+       cnt = (writeslot > slot ? sndbuffer_slot_num - writeslot + slot : slot - writeslot) - 1;
+       write_log ("%d ", cnt);
+       if (cnt <= 0)
+           cnt = 0;
+       sndbufsize = cnt * sndbuffer_slot_size;
+       sndbufpt = sndbuffer;
+       uae_sem_post(&audiosem);
+       SetEvent(notifyevent2);
+        //sound_setadjust (-50);
+       continue;
+nreset:
+       write_log ("SOUND: reset\n");
+       sndbufpt = sndbuffer;
+       sndbufsize = sndbuffer_size;
+       clearbuffer();
+       uae_sem_post(&audiosem);
+       SetEvent(notifyevent2);
+       continue;
+    }
+    write_log("SOUND: notificationthread exiting\n");
+    notificationthread_mode = 4;
+    return 0;
+}
+
+#if 0
+
+    DWORD playpos, safepos, status;
+    HRESULT hr;
+    void *b1, *b2;
+    DWORD s1, s2;
+    int diff;
+    int counter = 1000;
+    double vdiff, m, skipmode;
+
+    hr = IDirectSoundBuffer_GetStatus (lpDSBsecondary, &status);
+    if (FAILED(hr)) {
+       write_log ("SOUND: GetStatus() failed: %s\n", DXError(hr));
+       return;
+    }
+    if (status & DSBSTATUS_BUFFERLOST) {
+       write_log ("SOUND: buffer lost\n");
+       restore (DSERR_BUFFERLOST);
+       return;
+    }
+    if ((status & (DSBSTATUS_PLAYING | DSBSTATUS_LOOPING)) != (DSBSTATUS_PLAYING | DSBSTATUS_LOOPING)) {
+       write_log ("SOUND: status = %08.8X\n", status);
+       restore (DSERR_BUFFERLOST);
+       return;
+    }
+    for (;;) {
+       hr = IDirectSoundBuffer_GetCurrentPosition (lpDSBsecondary, &playpos, &safepos);
+       if (FAILED(hr)) {
+           restore (hr);
+           write_log ("SOUND: GetCurrentPosition failed: %s\n", DXError (hr));
+           return;
+       }
+
+       if (savestate_state)
+           return;
+
+       if (writepos >= playpos)
+           diff = writepos - playpos;
+       else
+           diff = dsoundbuf - playpos + writepos;
+
+       if (diff >= max_sndbufsize) {
+           writepos = safepos + snd_configsize;
+           if (writepos >= dsoundbuf)
+               writepos -= dsoundbuf;
+           diff = snd_configsize;
+           break;
+       }
+
+       if (diff > max_sndbufsize * 6 / 8) {
+           sleep_millis_busy (1);
+           counter--;
+           if (counter < 0) {
+               write_log ("SOUND: sound system got stuck!?\n");
+               restore (DSERR_BUFFERLOST);
+               return;
+           }
+           continue;
+       }
+       break;
+    }
+
+    hr = IDirectSoundBuffer_Lock (lpDSBsecondary, writepos, sndbufsize, &b1, &s1, &b2, &s2, 0);
+    if (restore (hr))
+       return;
+    if (FAILED(hr)) {
+       write_log ("SOUND: lock failed: %s (%d %d)\n", DXError (hr), writepos, sndbufsize);
+        return;
+    }
+    memcpy (b1, sndbuffer, sndbufsize >= s1 ? s1 : sndbufsize);
+    if (b2)
+        memcpy (b2, (uae_u8*)sndbuffer + s1, sndbufsize - s1);
+    IDirectSoundBuffer_Unlock (lpDSBsecondary, b1, s1, b2, s2);
+
+    vdiff = diff - snd_configsize;
+    m = 100.0 * vdiff / max_sndbufsize;
+    skipmode = pow (m < 0 ? -m : m, EXP)/ 10.0;
+
+    if (m < 0) skipmode = -skipmode;
+    if (skipmode < -ADJUST_SIZE) skipmode = -ADJUST_SIZE;
+    if (skipmode > ADJUST_SIZE) skipmode = ADJUST_SIZE;
+
+#ifdef SOUND_DEBUG
+    if (!(timeframes % 10)) {
+       write_log ("b=%5d,%5d,%5d,%5d diff=%5d vdiff=%5.0f vdiff2=%5d skip=%+02.1f\n",
+           sndbufsize, snd_configsize, max_sndbufsize, dsoundbuf, diff, vdiff, diff - snd_configsize, skipmode);
+    }
+#endif
+
+    writepos += sndbufsize;
+    if (writepos >= dsoundbuf)
+       writepos -= dsoundbuf;
+
+    sound_setadjust (skipmode);
+}
+
+#endif
+
+static void close_audio_ds (void)
+{
+    uae_sem_wait (&audiosem);
+    if (notificationthread_mode == 2) {
+       notificationthread_mode = 3;
+       SetEvent(notifyevent);
+       while (notificationthread_mode == 3)
+           Sleep(10);
+       notificationthread_mode = 0;
+    }
+    if (notifyevent)
+       CloseHandle(notifyevent);
+    notifyevent = NULL;
+    if (notifyevent2)
+       CloseHandle(notifyevent2);
+    notifyevent2 = NULL;
+
+    if (lpDSBsecondary)
+       IDirectSound_Release (lpDSBsecondary);
+    if (lpDSBprimary)
+       IDirectSound_Release (lpDSBprimary);
+    lpDSBsecondary = 0;
+    lpDSBprimary = 0;
+    if (lpDS) {
+       IDirectSound_Release (lpDS);
+       write_log ("SOUND: DirectSound driver freed\n");
+    }
+    lpDS = 0;
+    uae_sem_post (&audiosem);
+}
+
+static int open_audio_ds (int size)
+{
+    int i;
+    HRESULT hr;
+    DSBUFFERDESC sound_buffer;
+    DSCAPS DSCaps;
+    DSBCAPS DSBCaps;
+    WAVEFORMATEX wavfmt;
+    int freq = currprefs.sound_freq;
+    LPDIRECTSOUNDBUFFER pdsb;
+    DSBPOSITIONNOTIFY *dsbpn;
+    LPDIRECTSOUNDNOTIFY8 lpDsNotify;
+    HANDLE thread;
+    unsigned ttid;
+    
+    enumerate_sound_devices (0);
+    if (currprefs.sound_stereo == 3) {
+       size <<= 3;
+    } else {
+       size <<= 1;
+       if (currprefs.sound_stereo)
+           size <<= 1;
+    }
+    sndbuffer_size = sndbuffer_slot_size * sndbuffer_slot_num;
+    sndbufsize = sndbuffer_size;
+
+    hr = DirectSoundCreate8 (&sound_device_guid[currprefs.win32_soundcard], &lpDS, NULL);
+    if (FAILED(hr))  {
+        write_log ("SOUND: DirectSoundCreate() failure: %s\n", DXError (hr));
+        return 0;
+    }
+    memset (&DSCaps, 0, sizeof (DSCaps));
+    DSCaps.dwSize = sizeof (DSCaps);
+    hr = IDirectSound_GetCaps (lpDS, &DSCaps);
+    if (FAILED(hr)) {
+       write_log ("SOUND: Error getting DirectSound capabilities: %s\n", DXError (hr));
+       goto error;
+    }
+    if (DSCaps.dwFlags & DSCAPS_EMULDRIVER) {
+       write_log ("SOUND: Emulated DirectSound driver detected, don't complain if sound quality is crap :)\n");
+    }
+    if (DSCaps.dwFlags & DSCAPS_CONTINUOUSRATE) {
+       int minfreq = DSCaps.dwMinSecondarySampleRate;
+       int maxfreq = DSCaps.dwMaxSecondarySampleRate;
+       if (minfreq > freq && freq < 22050) {
+           freq = minfreq;
+           changed_prefs.sound_freq = currprefs.sound_freq = freq;
+           write_log("SOUND: minimum supported frequency: %d\n", minfreq);
+       }
+       if (maxfreq < freq && freq > 44100) {
+           freq = maxfreq;
+           changed_prefs.sound_freq = currprefs.sound_freq = freq;
+           write_log("SOUND: maximum supported frequency: %d\n", maxfreq);
+       }
+    }
+    
+    memset (&sound_buffer, 0, sizeof (sound_buffer));
+    sound_buffer.dwSize = sizeof (sound_buffer);
+    sound_buffer.dwFlags = DSBCAPS_PRIMARYBUFFER | DSBCAPS_GETCURRENTPOSITION2;
+    hr = IDirectSound_CreateSoundBuffer (lpDS, &sound_buffer, &lpDSBprimary, NULL);
+    if (FAILED(hr))  {
+        write_log ("SOUND: Primary CreateSoundBuffer() failure: %s\n", DXError (hr));
+       goto error;
+    }
+
+    memset(&DSBCaps, 0, sizeof(DSBCaps));
+    DSBCaps.dwSize = sizeof(DSBCaps);
+    hr = IDirectSoundBuffer_GetCaps(lpDSBprimary, &DSBCaps);
+    if (FAILED(hr)) {
+       write_log ("SOUND: Primary GetCaps() failure: %s\n",  DXError (hr));
+       goto error;
+    }
+
+    wavfmt.wFormatTag = WAVE_FORMAT_PCM;
+    wavfmt.nChannels = (currprefs.sound_stereo == 3 || currprefs.sound_stereo == 2) ? 4 : (currprefs.sound_stereo ? 2 : 1);
+    wavfmt.nSamplesPerSec = freq;
+    wavfmt.wBitsPerSample = 16;
+    wavfmt.nBlockAlign = 16 / 8 * wavfmt.nChannels;
+    wavfmt.nAvgBytesPerSec = wavfmt.nBlockAlign * freq;
+    wavfmt.cbSize = 0;
+
+    hr = IDirectSound_SetCooperativeLevel (lpDS, hMainWnd, DSSCL_PRIORITY);
+    if (FAILED(hr)) {
+        write_log ("SOUND: Can't set cooperativelevel: %s\n", DXError (hr));
+        goto error;
+    }
+
+    memset (&sound_buffer, 0, sizeof (sound_buffer));
+    sound_buffer.dwSize = sizeof (sound_buffer);
+    sound_buffer.dwBufferBytes = sndbuffer_size;
+    sound_buffer.lpwfxFormat = &wavfmt;
+    sound_buffer.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_GLOBALFOCUS;
+    sound_buffer.dwFlags |= DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLPOSITIONNOTIFY;
+
+    hr = IDirectSound_CreateSoundBuffer(lpDS, &sound_buffer, &pdsb, NULL);
+    if (FAILED(hr)) {
+        write_log ("SOUND: Secondary CreateSoundBuffer() failure: %s\n", DXError (hr));
+        goto error;
+    }
+    hr = IDirectSound_QueryInterface(pdsb, &IID_IDirectSoundBuffer8, (LPVOID*)&lpDSBsecondary);
+    if (FAILED(hr))  {
+        write_log ("SOUND: QueryInterface(DirectSoundBuffer8) failure: %s\n", DXError (hr));
+       goto error;
+    }
+    IDirectSound_Release(pdsb);
+
+    hr = IDirectSoundBuffer_SetFormat (lpDSBprimary, &wavfmt);
+    if (FAILED(hr))  {
+        write_log ("SOUND: Primary SetFormat() failure: %s\n", DXError (hr));
+        goto error;
+    }
+
+    hr = IDirectSound_QueryInterface(lpDSBsecondary, &IID_IDirectSoundNotify8, (LPVOID*)&lpDsNotify);
+    if (FAILED(hr)) {
+       write_log ("SOUND: QueryInterface(DirectSoundNotify8) failed: %s\n", DXError (hr));
+       goto error;
+    }
+    uae_sem_init(&audiosem, 0, 1);
+    notifyevent = CreateEvent(NULL, FALSE, FALSE, NULL);
+    notifyevent2 = CreateEvent(NULL, FALSE, FALSE, NULL);
+    dsbpn = xmalloc (sizeof (DSBPOSITIONNOTIFY) * sndbuffer_slot_num);
+    for (i = 0; i < sndbuffer_slot_num; i++) {
+       dsbpn[i].dwOffset = i * sndbuffer_slot_size;
+       dsbpn[i].hEventNotify = notifyevent;
+    }
+    IDirectSoundNotify_SetNotificationPositions(lpDsNotify, sndbuffer_slot_num, dsbpn);
+    IDirectSound_Release(lpDsNotify);
+
+    notificationthread_mode = 1;
+    thread = (HANDLE)_beginthreadex(NULL, 0, notifythread, NULL, 0, &ttid);
+    if (thread == NULL) {
+       write_log(" SOUND: NotificationThread failed to start: %d\n", GetLastError());
+       goto error;
+    }
+    SetThreadPriority (thread, THREAD_PRIORITY_HIGHEST);
+    SetThreadPriority (thread, THREAD_PRIORITY_TIME_CRITICAL);
+
+    setvolume ();
+    clearbuffer ();
+
+    init_sound_table16 ();
+    if (currprefs.sound_stereo == 3)
+       sample_handler = sample16ss_handler;
+    else
+       sample_handler = currprefs.sound_stereo ? sample16s_handler : sample16_handler;
+
+    write_log ("DS driver '%s'/%d/%d bits/%d Hz/buffer %d*%d=%d\n",
+       sound_devices[currprefs.win32_soundcard],
+       currprefs.sound_stereo,
+       16, freq, sndbuffer_slot_num, sndbuffer_slot_size, sndbuffer_size);
+    obtainedfreq = currprefs.sound_freq;
+
+    return 1;
+
+error:
+    close_audio_ds ();
+    return 0;
+}
+
+static int open_sound (void)
+{
+    int ret;
+    int size = currprefs.sound_maxbsiz;
+
+    if (!currprefs.produce_sound)
+       return 0;
+    /* Always interpret buffer size as number of samples, not as actual
+       buffer size.  Of course, since 8192 is the default, we'll have to
+       scale that to a sane value (assuming that otherwise 16 bits and
+       stereo would have been enabled and we'd have done the shift by
+       two anyway).  */
+    size >>= 2;
+    if (size & (size - 1))
+       size = DEFAULT_SOUND_MAXB;
+    if (size < 512)
+       size = 512;
+
+    ret = open_audio_ds (size);
+    if (!ret)
+       return 0;
+
+    have_sound = 1;
+    sound_available = 1;
+    update_sound (fake_vblank_hz);
+    sndbufpt = sndbuffer;
+    driveclick_init ();
+
+    return 1;
+}
+
+void close_sound (void)
+{
+    if (! have_sound)
+       return;
+    have_sound = 0;
+    pause_sound ();
+    close_audio_ds ();
+}
+
+int init_sound (void)
+{
+    if (have_sound)
+       return 1;
+    if (!open_sound ())
+       return 0;
+    paused = 1;
+    driveclick_reset ();
+    resume_sound ();
+    return 1;
+}
+
+void pause_sound (void)
+{
+    if (paused)
+       return;
+    paused = 1;
+    if (!have_sound)
+       return;
+    pause_audio_ds ();
+    clearbuffer();
+}
+
+void resume_sound (void)
+{
+    if (!paused)
+       return;
+    if (!have_sound)
+       return;
+    clearbuffer ();
+    resume_audio_ds ();
+}
+
+void reset_sound (void)
+{
+    if (!have_sound)
+       return;
+    clearbuffer ();
+}
+
+#ifdef JIT
+extern uae_u8* compiled_code;
+#else
+static int compiled_code;
+#endif
+extern int vsynctime_orig;
+
+#ifndef AVIOUTPUT
+static int avioutput_audio;
+#endif
+
+void sound_setadjust (double v)
+{
+    double mult;
+
+    mult = (1000.0 + currprefs.sound_adjust + v);
+    if ((currprefs.gfx_vsync && currprefs.gfx_afullscreen) || (avioutput_audio && !compiled_code)) {
+       vsynctime = vsynctime_orig;
+       scaled_sample_evtime = (long)(((double)scaled_sample_evtime_orig) * mult / 1000.0);
+    } else if (compiled_code || currprefs.m68k_speed != 0) {
+       vsynctime = (long)(((double)vsynctime_orig) * mult / 1000.0);
+       scaled_sample_evtime = scaled_sample_evtime_orig;
+    } else {
+       vsynctime = (long)(((double)vsynctime_orig) * mult / 1000.0);
+       scaled_sample_evtime = scaled_sample_evtime_orig;
+    }
+}
+
+static void finish_sound_buffer_ds (void)
+{
+    uae_sem_post(&audiosem);
+    ResetEvent(notifyevent2);
+    for (;;) {
+       SetEvent(notifyevent);
+       WaitForSingleObject(notifyevent2, INFINITE);
+       if (sndbufpt == sndbuffer && sndbufsize > 0)
+           break;
+    }
+    uae_sem_wait(&audiosem);
+}
+
+static void channelswap(uae_s16 *sndbuffer, int len)
+{
+    int i;
+    for (i = 0; i < len; i += 2) {
+       uae_s16 t = sndbuffer[i];
+       sndbuffer[i] = sndbuffer[i + 1];
+       sndbuffer[i + 1] = t;
+    }
+}
+
+void finish_sound_buffer (void)
+{
+    if (turbo_emulation)
+       return;
+    if (ISSTEREO(currprefs) && currprefs.sound_stereo_swap_paula)
+        channelswap((uae_s16*)sndbuffer, sndbufsize / 2);
+#ifdef DRIVESOUND
+    driveclick_mix ((uae_s16*)sndbuffer, sndbufsize / 2);
+#endif
+#ifdef AVIOUTPUT
+    if (avioutput_audio)
+        AVIOutput_WriteAudio ((uae_u8*)sndbuffer, sndbufsize);
+    if (avioutput_enabled && (!avioutput_framelimiter || avioutput_nosoundoutput))
+       return;
+#endif
+    if (!have_sound)
+       return;
+    finish_sound_buffer_ds ();
+}
+
+static BOOL CALLBACK DSEnumProc(LPGUID lpGUID, LPCTSTR lpszDesc, LPCTSTR lpszDrvName,  LPVOID lpContext)
+{
+    int i = num_sound_devices;
+    if (i == MAX_SOUND_DEVICES)
+       return TRUE;
+    if (lpGUID != NULL)
+       memcpy (&sound_device_guid[i], lpGUID, sizeof (GUID));
+    sound_devices[i] = my_strdup (lpszDesc);
+    num_sound_devices++;
+    return TRUE;
+}
+
+char **enumerate_sound_devices (int *total)
+{
+    if (!num_sound_devices)
+        DirectSoundEnumerate ((LPDSENUMCALLBACK)DSEnumProc, 0);
+    if (total)
+       *total = num_sound_devices;
+    if (currprefs.win32_soundcard >= num_sound_devices)
+       currprefs.win32_soundcard = 0;
+    if (num_sound_devices)
+       return sound_devices;
+    return 0;
+}
+
+int sound_calibrate (HWND hwnd, struct uae_prefs *p)
+{
+    HWND old = hMainWnd;
+    int pct = 100 * 10;
+
+    hMainWnd = hwnd;
+    currprefs.sound_freq = p->sound_freq;
+    currprefs.sound_stereo = p->sound_stereo;
+    if (open_sound ()) {
+        SetThreadPriority (GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
+       pct = calibrate ();
+        SetThreadPriority (GetCurrentThread(), THREAD_PRIORITY_NORMAL);
+       close_sound ();
+    }
+    if (pct > 995 && pct < 1005)
+       pct = 1000;
+    hMainWnd = old;
+    return pct;
+}
+
+void sound_volume (int dir)
+{
+    if (dir == 0)
+       mute = mute ? 0 : 1;
+    currprefs.sound_volume -= dir * 10;
+    if (currprefs.sound_volume < 0)
+       currprefs.sound_volume = 0;
+    if (currprefs.sound_volume > 100)
+       currprefs.sound_volume = 100;
+    changed_prefs.sound_volume = currprefs.sound_volume;
+    setvolume ();
+}
index 7be54525bb1fe221b7327024b4575144b75a4958..779963ea5f16e268d9c88faf033347667babc9cc 100755 (executable)
@@ -532,14 +532,6 @@ static void winuae_inactive (HWND hWnd, int minimized)
     write_log ("WinUAE now inactive via WM_ACTIVATE\n");
     wait_keyrelease ();
     setmouseactive (0);
-    close_sound ();
-#ifdef AHI
-    ahi_close_sound ();
-#endif
-    set_audio ();
-#ifdef AHI
-    ahi_open_sound ();
-#endif
     pri = &priorities[currprefs.win32_inactive_priority];
     if (!quit_program) {
        if (minimized) {
@@ -573,6 +565,16 @@ static void winuae_inactive (HWND hWnd, int minimized)
     setpriority (pri);
 #ifdef FILESYS
     filesys_flush_cache ();
+#endif
+    close_sound ();
+#ifdef AHI
+    ahi_close_sound ();
+#endif
+     if (gui_active)
+       return;
+    set_audio ();
+#ifdef AHI
+    ahi_open_sound ();
 #endif
 }
 
@@ -2350,7 +2352,7 @@ static void getstartpaths(int start_data)
 }
 
 extern void test (void);
-extern int screenshotmode, b0rken_ati_overlay,postscript_print_debugging;
+extern int screenshotmode, b0rken_ati_overlay,postscript_print_debugging,sound_debug;
 
 static int PASCAL WinMain2 (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
                    int nCmdShow)
@@ -2408,6 +2410,7 @@ static int PASCAL WinMain2 (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
        if (!strcmp (arg, "-legacypaths")) start_data = -1;
        if (!strcmp (arg, "-screenshotbmp")) screenshotmode = 0;
        if (!strcmp (arg, "-psprintdebug")) postscript_print_debugging = 1;
+       if (!strcmp (arg, "-sounddebug")) sound_debug = 1;
        if (!strcmp (arg, "-datapath") && i + 1 < argc) {
            strcpy(start_path_data, argv[i + 1]);
            start_data = 1;
index 561ee344d638dc75b9b7fd1f9ae08a01af7217a9..36d51b097d16dcd4ab1ab158726435f6cbb68f24 100755 (executable)
@@ -22,7 +22,7 @@ extern int manual_palette_refresh_needed;
 extern int mouseactive, focus;
 extern int ignore_messages_all;
 #define WINUAEBETA 1
-#define WINUAEBETASTR " Beta 1"
+#define WINUAEBETASTR " Beta 2"
 
 extern char start_path_exe[MAX_DPATH];
 extern char start_path_data[MAX_DPATH];
index 8d4bef607138eaa6861b1eb5b821528ac8cb36b9..ea713b60110f325834e5a5d824a9b981f6695c31 100755 (executable)
@@ -1789,8 +1789,8 @@ static void createstatuswindow (void)
     RECT rc;
     HLOCAL hloc;
     LPINT lpParts;
-    int drive_width, hd_width, cd_width, power_width, fps_width, idle_width;
-    int num_parts = 10;
+    int drive_width, hd_width, cd_width, power_width, fps_width, idle_width, snd_width;
+    int num_parts = 11;
     double scaleX, scaleY;
 
     hStatusWnd = CreateWindowEx(
@@ -1809,6 +1809,7 @@ static void createstatuswindow (void)
     power_width = (int)(42 * scaleX);
     fps_width = (int)(64 * scaleX);
     idle_width = (int)(64 * scaleX);
+    snd_width = (int)(64 * scaleX);
     GetClientRect (hMainWnd, &rc);
     /* Allocate an array for holding the right edge coordinates. */
     hloc = LocalAlloc (LHND, sizeof (int) * num_parts);
@@ -1816,18 +1817,19 @@ static void createstatuswindow (void)
        lpParts = LocalLock (hloc);
        /* Calculate the right edge coordinate for each part, and copy the coords
         * to the array.  */
-       lpParts[0] = rc.right - (drive_width * 4) - power_width - idle_width - fps_width - cd_width - hd_width - 2;
-       lpParts[1] = lpParts[0] + idle_width;
-       lpParts[2] = lpParts[1] + fps_width;
-       lpParts[3] = lpParts[2] + power_width;
-       lpParts[4] = lpParts[3] + cd_width;
-       lpParts[5] = lpParts[4] + hd_width;
-       lpParts[6] = lpParts[5] + drive_width;
+       lpParts[0] = rc.right - (drive_width * 4) - power_width - idle_width - fps_width - cd_width - hd_width - snd_width - 2;
+       lpParts[1] = lpParts[0] + snd_width;
+       lpParts[2] = lpParts[1] + idle_width;
+       lpParts[3] = lpParts[2] + fps_width;
+       lpParts[4] = lpParts[3] + power_width;
+       lpParts[5] = lpParts[4] + cd_width;
+       lpParts[6] = lpParts[5] + hd_width;
        lpParts[7] = lpParts[6] + drive_width;
        lpParts[8] = lpParts[7] + drive_width;
        lpParts[9] = lpParts[8] + drive_width;
-       window_led_drives = lpParts[5];
-       window_led_drives_end = lpParts[9];
+       lpParts[10] = lpParts[9] + drive_width;
+       window_led_drives = lpParts[6];
+       window_led_drives_end = lpParts[10];
 
        /* Create the parts */
        SendMessage (hStatusWnd, SB_SETPARTS, (WPARAM) num_parts, (LPARAM) lpParts);
index 5cb9b73053b443b735dcaad9d7f5221a3272cfcc..b3d077fb81f33d5f94fcdde7d154b11d88e1a560 100755 (executable)
@@ -602,7 +602,6 @@ static int scan_roms_2 (char *pathp)
        fetch_path ("KickstartPath", path, sizeof (path));
     else
        strcpy (path, pathp);
-    keybuf = load_keyfile (&workprefs, path, &keysize);
     strcpy (buf, path);
     strcat (buf, "*.*");
     if (!hWinUAEKey)
@@ -612,6 +611,7 @@ static int scan_roms_2 (char *pathp)
        KEY_READ | KEY_WRITE, NULL, &fkey, NULL);
     if (fkey == NULL)
        goto end;
+    keybuf = load_keyfile (&workprefs, path, &keysize);
     ret = 0;
     for (;;) {
        handle = FindFirstFile (buf, &find_data);
@@ -628,9 +628,9 @@ static int scan_roms_2 (char *pathp)
                break;
            }
        }
-       if (!keybuf && ret) { /* did previous scan detect keyfile? */
+       if (!keybuf) { /* did previous scan detect keyfile? */
            keybuf = load_keyfile (&workprefs, path, &keysize);
-           if (keybuf) /* ok, maybe we now find more roms.. */
+           if (keybuf) /* ok, maybe we can now find more roms.. */
                continue;
        }
        break;
@@ -775,6 +775,7 @@ void gui_display(int shortcut)
     if (here)
        return;
     here++;
+    gui_active++;
     screenshot_prepare();
 #ifdef D3D
     D3D_guimode (TRUE);
@@ -854,6 +855,7 @@ void gui_display(int shortcut)
 #endif
     screenshot_free();
     write_disk_history();
+    gui_active--;
     here--;
 }
 
@@ -9126,7 +9128,7 @@ static int GetSettings (int all_options, HWND hwnd)
     int psresult;
     HWND dhwnd;
 
-    gui_active = 1;
+    gui_active++;
 
     full_property_sheet = all_options;
     allow_quit = all_options;
@@ -9219,7 +9221,7 @@ static int GetSettings (int all_options, HWND hwnd)
 
     qs_request_reset = 0;
     full_property_sheet = 0;
-    gui_active = 0;
+    gui_active--;
     return psresult;
 }
 
@@ -9307,6 +9309,7 @@ void gui_fps (int fps, int idle)
     gui_data.idle = idle;
     gui_led (7, 0);
     gui_led (8, 0);
+    gui_led (9, 0);
 }
 
 void gui_led (int led, int on)
@@ -9329,7 +9332,7 @@ void gui_led (int led, int on)
        type = 0;
     tt = NULL;
     if (led >= 1 && led <= 4) {
-       pos = 5 + (led - 1);
+       pos = 6 + (led - 1);
        ptr = drive_text + pos * 16;
        if (gui_data.drive_disabled[led - 1])
            strcpy (ptr, "");
@@ -9349,22 +9352,26 @@ void gui_led (int led, int on)
        if (strlen (p + j) > 0)
            sprintf (tt, "%s (CRC=%08.8X)", p + j, gui_data.crc32[led - 1]);
     } else if (led == 0) {
-       pos = 2;
+       pos = 3;
        ptr = strcpy (drive_text + pos * 16, "Power");
     } else if (led == 5) {
-       pos = 3;
+       pos = 4;
        ptr = strcpy (drive_text + pos * 16, "HD");
     } else if (led == 6) {
-       pos = 4;
+       pos = 5;
        ptr = strcpy (drive_text + pos * 16, "CD");
     } else if (led == 7) {
-       pos = 1;
+       pos = 2;
        ptr = drive_text + pos * 16;
        sprintf(ptr, "FPS: %.1f", (double)(gui_data.fps  / 10.0));
     } else if (led == 8) {
-       pos = 0;
+       pos = 1;
        ptr = drive_text + pos * 16;
        sprintf(ptr, "CPU: %.0f%%", (double)((gui_data.idle) / 10.0));
+    } else if (led == 9) {
+       pos = 0;
+       ptr = drive_text + pos * 16;
+       sprintf(ptr, "SND: %.0f%%", (double)((gui_data.sndbuf) / 10.0));
     }
     if (pos >= 0) {
        PostMessage (hStatusWnd, SB_SETTEXT, (WPARAM) ((pos + 1) | type), (LPARAM) ptr);
index 97d84441cc9690afdaef0145082a56f7969f75d4..f7e5625bd4fe8d3fa61a2dcc4f954df37ec915b1 100755 (executable)
@@ -160,14 +160,14 @@ void f_out (void *f, const char *format, ...)
 {
     int count;
     DWORD numwritten;
-    char buffer[ WRITE_LOG_BUF_SIZE ];
+    char buffer[WRITE_LOG_BUF_SIZE];
     va_list parms;
     va_start (parms, format);
 
     if (f == NULL)
        return;
-    count = _vsnprintf( buffer, WRITE_LOG_BUF_SIZE-1, format, parms );
-    openconsole();
-    WriteConsole(stdoutput,buffer,strlen(buffer),&numwritten,0);
+    count = _vsnprintf (buffer, WRITE_LOG_BUF_SIZE-1, format, parms);
+    openconsole ();
+    WriteConsole(stdoutput, buffer, strlen(buffer), &numwritten,0);
     va_end (parms);
 }
index 7a9e69069fd1372d3a5b99d8df6dab9286e3198a..9b7f4569f46f03fe3dfc62e47bea1567365b5030 100755 (executable)
@@ -562,6 +562,8 @@ static int dev_do_io (struct devstruct *dev, uaecptr request)
            io_error = sys_command_scsi_direct (dev->unitnum, sdd);
            if (log_scsi)
                write_log ("scsidev: did io: sdd %p request %p error %d\n", sdd, request, get_byte (request + 31));
+       } else {
+           io_error = -3;
        }
        break;
        default:
@@ -906,19 +908,19 @@ void scsidev_install (void)
 
     /* initcode */
     initcode = here ();
-    calltrap (deftrap (diskdev_init)); dw (RTS);
+    calltrap (deftrap (dev_init)); dw (RTS);
 
     /* Open */
     openfunc = here ();
-    calltrap (deftrap (diskdev_open)); dw (RTS);
+    calltrap (deftrap (dev_open)); dw (RTS);
 
     /* Close */
     closefunc = here ();
-    calltrap (deftrap (diskdev_close)); dw (RTS);
+    calltrap (deftrap (dev_close)); dw (RTS);
 
     /* Expunge */
     expungefunc = here ();
-    calltrap (deftrap (diskdev_expunge)); dw (RTS);
+    calltrap (deftrap (dev_expunge)); dw (RTS);
 
     /* BeginIO */
     beginiofunc = here ();