]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
imported winuaesrc1610b2.zip
authorToni Wilen <twilen@winuae.net>
Sat, 6 Jun 2009 10:11:15 +0000 (13:11 +0300)
committerToni Wilen <twilen@winuae.net>
Mon, 22 Feb 2010 19:46:38 +0000 (21:46 +0200)
31 files changed:
catweasel.c
cfgfile.c
custom.c
include/custom.h
include/inputdevice.h
include/options.h
include/zarchive.h
include/zfile.h
inputdevice.c
main.c
memory.c
od-win32/blkdev_win32_aspi.c
od-win32/bsdsock.c
od-win32/clirun.c [new file with mode: 0644]
od-win32/debug_win32.c
od-win32/dinput.c
od-win32/direct3d.c
od-win32/dxwrap.c
od-win32/opengl.c
od-win32/resources/resource
od-win32/resources/winuae.rc
od-win32/rp.c
od-win32/sounddep/sound.c
od-win32/win32.c
od-win32/win32.h
od-win32/win32gfx.c
od-win32/win32gui.c
od-win32/winuaechangelog.txt
od-win32/writelog.c
zfile.c
zfile_archive.c

index 1e45a465361ec0d328768255582c6f951000d1cb..841c9b70714927b8e5bba7c628d689d0cbe09e8d 100644 (file)
@@ -193,7 +193,7 @@ void catweasel_hsync (void)
     cwhsync = 10;
     if (handshake) {
        /* keyboard handshake */
-       catweasel_do_bput(0xd0, 0);
+       catweasel_do_bput (0xd0, 0);
        handshake = 0;
     }
     if (hsync_requested < 0)
@@ -205,17 +205,17 @@ void catweasel_hsync (void)
        if (cwmk3buttonsync <= 0) {
            cwmk3buttonsync = 30;
            b = 0;
-           if (sid_read(0x19, 0) > 0x7f)
+           if (sid_read (0x19, 0) > 0x7f)
                b |= 2;
-           if (sid_read(0x1a, 0) > 0x7f)
+           if (sid_read (0x1a, 0) > 0x7f)
                b |= 1;
            if (cwmk3port == 0) {
                cwmk3port1 = b;
-               catweasel_do_bput(0xd4, 0); // select port2
+               catweasel_do_bput (0xd4, 0); // select port2
                cwmk3port = 1;
            } else {
                cwmk3port2 = b;
-               catweasel_do_bget(0xd4); // select port1
+               catweasel_do_bget (0xd4); // select port1
                cwmk3port = 0;
            }
        }
@@ -223,11 +223,11 @@ void catweasel_hsync (void)
     if (!cwc.can_mouse)
        return;
     /* read MK4 mouse counters */
-    catweasel_do_bput(3, 0x81);
+    catweasel_do_bput (3, 0x81);
     for (i = 0; i < 2; i++) {
        int x, y, dx, dy;
-       x = (uae_s8)catweasel_do_bget(0xc4 + i * 8);
-       y = (uae_s8)catweasel_do_bget(0xc0 + i * 8);
+       x = (uae_s8)catweasel_do_bget (0xc4 + i * 8);
+       y = (uae_s8)catweasel_do_bget (0xc0 + i * 8);
        dx = mouse_px[i] - x;
        if (dx > 127)
            dx = 255 - dx;
@@ -243,16 +243,16 @@ void catweasel_hsync (void)
        mouse_px[i] = x;
        mouse_py[i] = y;
     }
-    catweasel_do_bput(3, 0x41);
+    catweasel_do_bput (3, 0x41);
 }
 
 int catweasel_read_joystick (uae_u8 *dir, uae_u8 *buttons)
 {
     if (!cwc.can_joy || !cwc.direct_access)
        return 0;
-    hsync_request();
-    *dir = catweasel_do_bget(0xc0);
-    *buttons = get_buttons();
+    hsync_request ();
+    *dir = catweasel_do_bget (0xc0);
+    *buttons = get_buttons ();
     return 1;
 }
 
index 0c1aca1ea663bfd201c103d4015228e0816df767..200763757de878c9935a3b9bba5dafafcf94a655 100644 (file)
--- a/cfgfile.c
+++ b/cfgfile.c
@@ -1044,6 +1044,8 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
        || cfgfile_yesno (option, value, L"gfx_flickerfixer", &p->gfx_scandoubler)
        || cfgfile_yesno (option, value, L"synchronize_clock", &p->tod_hack)
        || cfgfile_yesno (option, value, L"magic_mouse", &p->input_magic_mouse)
+       || cfgfile_yesno (option, value, L"warp", &p->turbo_emulation)
+       || cfgfile_yesno (option, value, L"headless", &p->headless)
        || cfgfile_yesno (option, value, L"bsdsocket_emu", &p->socket_emu))
            return 1;
 
@@ -3189,6 +3191,8 @@ void default_prefs (struct uae_prefs *p, int type)
     p->scsi = 0;
     p->uaeserial = 0;
     p->cpu_idle = 0;
+    p->turbo_emulation = 0;
+    p->headless = 0;
     p->catweasel = 0;
     p->tod_hack = 0;
     p->maprom = 0;
@@ -3358,6 +3362,7 @@ static void buildin_default_prefs (struct uae_prefs *p)
     p->scsi = 0;
     p->uaeserial = 0;
     p->cpu_idle = 0;
+    p->turbo_emulation = 0;
     p->catweasel = 0;
     p->tod_hack = 0;
     p->maprom = 0;
index 232449c4ebaf83d14efea8340a20bcd7b3654c6c..f48e7f0d2fa377b433b8b3a5d5fc5460be9fd8a0 100644 (file)
--- a/custom.c
+++ b/custom.c
@@ -2529,7 +2529,6 @@ static int isvsync (void)
 }
 
 int vsynctime_orig;
-int turbo_emulation;
 
 void compute_vsynctime (void)
 {
@@ -2546,7 +2545,7 @@ void compute_vsynctime (void)
     }
     if (!fake_vblank_hz)
        fake_vblank_hz = vblank_hz;
-    if (turbo_emulation)
+    if (currprefs.turbo_emulation)
        vsynctime = vsynctime_orig = 1;
     else
        vsynctime = vsynctime_orig = syncbase / fake_vblank_hz;
@@ -4659,7 +4658,7 @@ static void fpscounter (void)
            double mult = (double)fake_vblank_hz * 10.0 / fps;
            idle *= mult;
        }
-       if (turbo_emulation && idle < 100 * 10)
+       if (currprefs.turbo_emulation && idle < 100 * 10)
            idle = 100 * 10;
        gui_fps (fps, (int)idle);
        frametime2 = 0;
@@ -4784,7 +4783,7 @@ static void frh_handler (void)
        /* Allow this to be one frame's worth of cycles out */
        while (diff32 (curr_time, vsyncmintime + vsynctime) > 0) {
            vsyncmintime += vsynctime * N_LINES / maxvpos;
-           if (turbo_emulation)
+           if (currprefs.turbo_emulation)
                break;
        }
     }
index fd7f241a958470728912d3f52556d1d0fcdb39fc..c4d8ed19d99d9a8304fe1c73b720b9e5349756b0 100644 (file)
@@ -32,7 +32,6 @@ extern void init_custom (void);
 
 extern int picasso_requested_on;
 extern int picasso_on;
-extern int turbo_emulation;
 
 /* Set to 1 to leave out the current frame in average frame time calculation.
  * Useful if the debugger was active.  */
index 8c6a295d6c796f49fd2ec65a519ecbd15a078c5c..7390c19d2ce6c3f0519acf23cbd3386cd45f53ae 100644 (file)
@@ -44,6 +44,7 @@ struct uae_input_device_kbr_default {
 
 #define IDEV_MAPPED_AUTOFIRE_POSSIBLE 1
 #define IDEV_MAPPED_AUTOFIRE_SET 2
+#define IDEV_MAPPED_TOGGLE 4
 
 #define ID_BUTTON_OFFSET 0
 #define ID_BUTTON_TOTAL 32
@@ -51,7 +52,7 @@ struct uae_input_device_kbr_default {
 #define ID_AXIS_TOTAL 32
 
 extern int inputdevice_iterate (int devnum, int num, TCHAR *name, int *af);
-extern int inputdevice_set_mapping (int devnum, int num, TCHAR *name, TCHAR *custom, int af, int sub);
+extern int inputdevice_set_mapping (int devnum, int num, TCHAR *name, TCHAR *custom, int flags, int sub);
 extern int inputdevice_get_mapped_name (int devnum, int num, int *pflags, TCHAR *name, TCHAR *custom, int sub);
 extern void inputdevice_copyconfig (const struct uae_prefs *src, struct uae_prefs *dst);
 extern void inputdevice_copy_single_config (struct uae_prefs *p, int src, int dst, int devnum);
index 6364dc2cf07a633078270349c9b186a0410d3340..c5d101d1ec6d186f8dff894d1860daeba2cfbbf2 100644 (file)
@@ -216,6 +216,8 @@ struct uae_prefs {
     int floppy_write_length;
     int tod_hack;
     uae_u32 maprom;
+    int turbo_emulation;
+    int headless;
 
     int cs_compatible;
     int cs_ciaatod;
index c7d59712662adad113d8ed4e5fb88ce03d494ee5..634b64a275cafed9c38e061dbe7bfae2e640ae01 100644 (file)
@@ -112,8 +112,8 @@ extern struct zfile *archive_access_rdb (struct znode *zn);
 extern struct zvolume *archive_directory_fat (struct zfile *z);
 extern struct zfile *archive_access_fat (struct znode *zn);
 
-extern struct zfile *archive_access_select (struct znode *parent, struct zfile *zf, unsigned int id, int doselect);
-extern struct zfile *archive_access_arcacc_select (struct zfile *zf, unsigned int id);
+extern struct zfile *archive_access_select (struct znode *parent, struct zfile *zf, unsigned int id, int doselect, int *retcode);
+extern struct zfile *archive_access_arcacc_select (struct zfile *zf, unsigned int id, int *retcode);
 extern int isfat (uae_u8*);
 
 extern void archive_access_scan (struct zfile *zf, zfile_callback zc, void *user, unsigned int id);
index 3c6e21bae86c33a445f3c54e52d01336e45e321d..1bace4ff4573ebece0039fc7361bb67ca0593e89 100644 (file)
@@ -44,7 +44,7 @@ extern struct zfile *zfile_gunzip (struct zfile *z);
 extern int zfile_isdiskimage (const TCHAR *name);
 extern int iszip (struct zfile *z);
 extern int zfile_convertimage (const TCHAR *src, const TCHAR *dst);
-extern struct zfile *zuncompress (struct znode*, struct zfile *z, int dodefault, int imgonly);
+extern struct zfile *zuncompress (struct znode*, struct zfile *z, int dodefault, int mask, int *retcode);
 extern void zfile_seterror (const TCHAR *format, ...);
 extern TCHAR *zfile_geterror (void);
 
index d9d6455a84bfba16c34aaf243d67cbb5e8f22997..cfcb2772203963ee9552a37f4e4101fb490e26eb 100644 (file)
@@ -107,6 +107,9 @@ struct inputevent {
 
 /* event flags */
 #define ID_FLAG_AUTOFIRE 1
+#define ID_FLAG_TOGGLE 2
+#define ID_FLAG_SAVE_MASK 0xff
+#define ID_FLAG_TOGGLED 0x100
 
 #define DEFEVENT(A, B, C, D, E, F) {L#A, B, C, D, E, F },
 struct inputevent events[] = {
@@ -186,7 +189,7 @@ int inprec_open (TCHAR *fname, int record)
        return 0;
     }
     input_recording = record;
-    srand(t);
+    srand (t);
     CIA_inprec_prepare ();
     write_log (L"inprec initialized '%s', mode=%d\n", fname, input_recording);
     return 1;
@@ -471,8 +474,8 @@ static void write_config2 (struct zfile *f, int idnum, int i, int offset, TCHAR
            *p++ = ',';
            *p = 0;
        }
-       if (custom)
-           _stprintf (p, L"'%s'.%d", custom, id->flags[i + offset][j] & 0xff);
+       if (custom && _tcslen (custom) > 0)
+           _stprintf (p, L"'%s'.%d", custom, id->flags[i + offset][j] & ID_FLAG_SAVE_MASK);
        else if (evt <= 0)
            _stprintf (p, L"NULL");
        else
@@ -538,8 +541,9 @@ static void write_config (struct zfile *f, int idnum, int devnum, TCHAR *name, s
 static void kbrlabel (TCHAR *s)
 {
     while (*s) {
-       *s = toupper(*s);
-       if (*s == ' ') *s = '_';
+       *s = _totupper (*s);
+       if (*s == ' ')
+           *s = '_';
        s++;
     }
 }
@@ -591,7 +595,7 @@ static void write_kbr_config (struct zfile *f, int idnum, int devnum, struct uae
                *p++ = ',';
                *p = 0;
            }
-           if (custom)
+           if (custom && _tcslen (custom) > 0)
                _stprintf (p, L"'%s'.%d", custom, kbr->flags[i][j] & 0xff);
            else if (evt > 0)
                _stprintf (p, L"%s.%d", events[evt].confname, kbr->flags[i][j]);
@@ -636,8 +640,10 @@ static int getnum (const TCHAR **pp)
     const TCHAR *p = *pp;
     int v = _tstol (p);
 
-    while (*p != 0 && *p !='.' && *p != ',') p++;
-    if (*p == '.' || *p == ',') p++;
+    while (*p != 0 && *p !='.' && *p != ',')
+       p++;
+    if (*p == '.' || *p == ',')
+       p++;
     *pp = p;
     return v;
 }
@@ -873,28 +879,28 @@ int mousehack_alive (void)
     return mousehack_alive_cnt > 0 ? mousehack_alive_cnt : 0;
 }
 
-static uaecptr get_base (const TCHAR *name)
+static uaecptr get_base (const uae_char *name)
 {
     uaecptr v = get_long (4);
     addrbank *b = &get_mem_bank(v);
 
-    if (!b || !b->check(v, 400) || b->flags != ABFLAG_RAM)
+    if (!b || !b->check (v, 400) || b->flags != ABFLAG_RAM)
        return 0;
     v += 378; // liblist
     while (v = get_long (v)) {
        uae_u32 v2;
        uae_u8 *p;
-       b = &get_mem_bank(v);
+       b = &get_mem_bank (v);
        if (!b || !b->check (v, 32) || b->flags != ABFLAG_RAM)
            return 0xffffffff;
        v2 = get_long (v + 10); // name
-       b = &get_mem_bank(v2);
+       b = &get_mem_bank (v2);
        if (!b || !b->check (v2, 20))
            return 0xffffffff;
        if (b->flags != ABFLAG_ROM && b->flags != ABFLAG_RAM)
            return 0;
-       p = b->xlateaddr(v2);
-       if (!memcmp (p, name, _tcslen (name) + 1))
+       p = b->xlateaddr (v2);
+       if (!memcmp (p, name, strlen (name) + 1))
            return v;
     }
     return 0;
@@ -906,7 +912,7 @@ static uaecptr get_intuitionbase (void)
        return 0;
     if (magicmouse_ibase)
        return magicmouse_ibase;
-    magicmouse_ibase = get_base (L"intuition.library");
+    magicmouse_ibase = get_base ("intuition.library");
     return magicmouse_ibase;
 }
 static uaecptr get_gfxbase (void)
@@ -915,7 +921,7 @@ static uaecptr get_gfxbase (void)
        return 0;
     if (magicmouse_gfxbase)
        return magicmouse_gfxbase;
-    magicmouse_gfxbase = get_base (L"graphics.library");
+    magicmouse_gfxbase = get_base ("graphics.library");
     return magicmouse_gfxbase;
 }
 
@@ -2741,7 +2747,7 @@ static void process_custom_event (struct uae_input_device *id, int offset, int s
 
 static void setbuttonstateall (struct uae_input_device *id, struct uae_input_device2 *id2, int button, int state)
 {
-    int evt, autofire, i;
+    int i;
     uae_u32 mask = 1 << button;
     uae_u32 omask = id2->buttonmask & mask;
     uae_u32 nmask = (state ? 1 : 0) << button;
@@ -2755,13 +2761,26 @@ static void setbuttonstateall (struct uae_input_device *id, struct uae_input_dev
        return;
 
     for (i = 0; i < MAX_INPUT_SUB_EVENT; i++) {
-       evt = id->eventid[ID_BUTTON_OFFSET + button][sublevdir[state <= 0 ? 1 : 0][i]];
-       autofire = (id->flags[ID_BUTTON_OFFSET + button][sublevdir[state <= 0 ? 1 : 0][i]] & ID_FLAG_AUTOFIRE) ? 1 : 0;
+       int evt = evt = id->eventid[ID_BUTTON_OFFSET + button][sublevdir[state <= 0 ? 1 : 0][i]];
+       int autofire = (id->flags[ID_BUTTON_OFFSET + button][sublevdir[state <= 0 ? 1 : 0][i]] & ID_FLAG_AUTOFIRE) ? 1 : 0;
+       int toggle = (id->flags[ID_BUTTON_OFFSET + button][sublevdir[state <= 0 ? 1 : 0][i]] & ID_FLAG_TOGGLE) ? 1 : 0;
+
        if (state < 0) {
            handle_input_event (evt, 1, 1, 0);
            queue_input_event (evt, 0, 1, 1, 0); /* send release event next frame */
            if (i == 0)
                process_custom_event (id, ID_BUTTON_OFFSET + button, state);
+       } else if (toggle) {
+           int toggled;
+           if (!state)
+               continue;
+           if (omask & mask)
+               continue;
+           id->flags[ID_BUTTON_OFFSET + button][sublevdir[state <= 0 ? 1 : 0][i]] ^= ID_FLAG_TOGGLED;
+           toggled = (id->flags[ID_BUTTON_OFFSET + button][sublevdir[state <= 0 ? 1 : 0][i]] & ID_FLAG_TOGGLED) ? 1 : 0;
+           handle_input_event (evt, toggled, 1, autofire);
+           if (i == 0)
+               process_custom_event (id, ID_BUTTON_OFFSET + button, toggled);
        } else {
            if ((omask ^ nmask) & mask) {
                handle_input_event (evt, state, 1, autofire);
@@ -3370,8 +3389,19 @@ static int inputdevice_translatekeycode_2 (int keyboard, int scancode, int state
        if (na->extra[j][0] == scancode) {
            for (k = 0; k < MAX_INPUT_SUB_EVENT; k++) {/* send key release events in reverse order */
                int autofire = (na->flags[j][sublevdir[state == 0 ? 1 : 0][k]] & ID_FLAG_AUTOFIRE) ? 1 : 0;
+               int toggle = (na->flags[j][sublevdir[state == 0 ? 1 : 0][k]] & ID_FLAG_TOGGLE) ? 1 : 0;
                int evt = na->eventid[j][sublevdir[state == 0 ? 1 : 0][k]];
-               handled |= handle_input_event (evt, state, 1, autofire);
+               int toggled;
+
+               if (toggle) {
+                   if (!state)
+                       continue;
+                   na->flags[j][sublevdir[state == 0 ? 1 : 0][k]] ^= ID_FLAG_TOGGLED;
+                   toggled = (na->flags[j][sublevdir[state == 0 ? 1 : 0][k]] & ID_FLAG_TOGGLED) ? 1 : 0;
+                   handled |= handle_input_event (evt, toggled, 1, autofire);
+               } else {
+                   handled |= handle_input_event (evt, state, 1, autofire);
+               }
            }
            process_custom_event (na, j, state);
            return handled;
@@ -3487,21 +3517,21 @@ static int put_event_data (const struct inputdevice_functions *id, int devnum, i
        uid->eventid[i][sub] = eventid;
        uid->flags[i][sub] = flags;
        xfree (uid->custom[i][sub]);
-       uid->custom[i][sub] = custom ? my_strdup (custom) : NULL;
+       uid->custom[i][sub] = custom && _tcslen (custom) > 0 ? my_strdup (custom) : NULL;
        return i;
     } else if (type == IDEV_WIDGET_AXIS) {
        i = num - id->get_widget_first (devnum, type) + ID_AXIS_OFFSET;
        uid->eventid[i][sub] = eventid;
        uid->flags[i][sub] = flags;
        xfree (uid->custom[i][sub]);
-       uid->custom[i][sub] = custom ? my_strdup (custom) : NULL;
+       uid->custom[i][sub] = custom && _tcslen (custom) > 0 ? my_strdup (custom) : NULL;
        return i;
     } else if (type == IDEV_WIDGET_KEY) {
        i = num - id->get_widget_first (devnum, type);
        uid->eventid[i][sub] = eventid;
        uid->flags[i][sub] = flags;
        xfree (uid->custom[i][sub]);
-       uid->custom[i][sub] = custom ? my_strdup (custom) : NULL;
+       uid->custom[i][sub] = custom && _tcslen (custom) > 0 ? my_strdup (custom) : NULL;
        return i;
     }
     return -1;
@@ -3684,6 +3714,8 @@ int inputdevice_get_mapped_name (int devnum, int num, int *pflags, TCHAR *name,
        _tcscpy (custom, customp);
     if (flag & ID_FLAG_AUTOFIRE)
        flags |= IDEV_MAPPED_AUTOFIRE_SET;
+    if (flag & ID_FLAG_TOGGLE)
+       flags |= IDEV_MAPPED_TOGGLE;
     if (!data)
        return 0;
     if (events[data].allow_mask & AM_AF)
@@ -3694,7 +3726,7 @@ int inputdevice_get_mapped_name (int devnum, int num, int *pflags, TCHAR *name,
     return data;
 }
 
-int inputdevice_set_mapping (int devnum, int num, TCHAR *name, TCHAR *custom, int af, int sub)
+int inputdevice_set_mapping (int devnum, int num, TCHAR *name, TCHAR *custom, int flags, int sub)
 {
     const struct inputdevice_functions *idf = getidf (devnum);
     const struct uae_input_device *uid = get_uid (idf, inputdevice_get_device_index (devnum));
@@ -3723,9 +3755,11 @@ int inputdevice_set_mapping (int devnum, int num, TCHAR *name, TCHAR *custom, in
        return 0;
     if (data >= 0) {
        amask = events[eid].allow_mask;
-       flag &= ~ID_FLAG_AUTOFIRE;
-       if (amask & AM_AF)
-           flag |= af ? ID_FLAG_AUTOFIRE : 0;
+       flag &= ~(ID_FLAG_AUTOFIRE | ID_FLAG_TOGGLE);
+       if (amask & AM_AF) {
+           flag |= (flags & IDEV_MAPPED_AUTOFIRE_SET) ? ID_FLAG_AUTOFIRE : 0;
+           flag |= (flags & IDEV_MAPPED_TOGGLE) ? ID_FLAG_TOGGLE : 0;
+       }
        put_event_data (idf, devindex, num, eid, custom, flag, sub);
        return 1;
     }
@@ -3932,7 +3966,7 @@ void do_fake_joystick (int nr, int *fake)
 
 void setjoybuttonstate (int joy, int button, int state)
 {
-    if (ignoreoldinput(joy)) {
+    if (ignoreoldinput (joy)) {
        if (state)
            switchdevice (&joysticks[joy], button, 1);
        return;
@@ -3946,7 +3980,7 @@ void setjoybuttonstateall (int joy, uae_u32 buttonbits, uae_u32 buttonmask)
 {
     int i;
 
-    if (ignoreoldinput(joy))
+    if (ignoreoldinput (joy))
        return;
     for (i = 0; i < ID_BUTTON_TOTAL; i++) {
        if (buttonmask & (1 << i))
@@ -4085,25 +4119,25 @@ void warpmode (int mode)
     fr = currprefs.gfx_framerate;
     if (fr == 0)
        fr = -1;
-    fr2 = turbo_emulation;
+    fr2 = currprefs.turbo_emulation;
     if (fr2 == -1)
        fr2 = 0;
 
     if (mode < 0) {
-       if (turbo_emulation) {
+       if (currprefs.turbo_emulation) {
            changed_prefs.gfx_framerate = currprefs.gfx_framerate = fr2;
-           turbo_emulation = 0;
+           currprefs.turbo_emulation = 0;
        } else {
-           turbo_emulation = fr;
+           currprefs.turbo_emulation = fr;
        }
-    } else if (mode == 0 && turbo_emulation) {
-       if (turbo_emulation > 0)
+    } else if (mode == 0 && currprefs.turbo_emulation) {
+       if (currprefs.turbo_emulation > 0)
            changed_prefs.gfx_framerate = currprefs.gfx_framerate = fr2;
-       turbo_emulation = 0;
-    } else if (mode > 0 && !turbo_emulation) {
-       turbo_emulation = fr;
+       currprefs.turbo_emulation = 0;
+    } else if (mode > 0 && !currprefs.turbo_emulation) {
+       currprefs.turbo_emulation = fr;
     }
-    if (turbo_emulation) {
+    if (currprefs.turbo_emulation) {
        if (!currprefs.cpu_cycle_exact && !currprefs.blitter_cycle_exact)
            changed_prefs.gfx_framerate = currprefs.gfx_framerate = 10;
        pause_sound ();
@@ -4112,7 +4146,7 @@ void warpmode (int mode)
     }
     compute_vsynctime ();
 #ifdef RETROPLATFORM
-    rp_turbo (turbo_emulation);
+    rp_turbo (currprefs.turbo_emulation);
 #endif
 }
 
diff --git a/main.c b/main.c
index 88dd7b33d1f18d3067169fbb4d9f36130239f18d..ee52c582344865fbd4c365fb7d9dba2fa02e089d 100644 (file)
--- a/main.c
+++ b/main.c
@@ -500,7 +500,7 @@ static void parse_cmdline (int argc, TCHAR **argv)
        } else if (_tcsncmp (argv[i], L"-config=", 8) == 0) {
            TCHAR *txt = parsetext (argv[i] + 8);
            currprefs.mountitems = 0;
-           target_cfgfile_load (&currprefs, txt, -1, 1);
+           target_cfgfile_load (&currprefs, txt, -1, 0);
            xfree (txt);
        } else if (_tcsncmp (argv[i], L"-statefile=", 11) == 0) {
            TCHAR *txt = parsetext (argv[i] + 11);
@@ -513,7 +513,7 @@ static void parse_cmdline (int argc, TCHAR **argv)
                write_log (L"Missing argument for '-f' option.\n");
            } else {
                currprefs.mountitems = 0;
-               target_cfgfile_load (&currprefs, argv[++i], -1, 1);
+               target_cfgfile_load (&currprefs, argv[++i], -1, 0);
            }
        } else if (_tcscmp (argv[i], L"-s") == 0) {
            if (i + 1 == argc)
index 6bbb100750d0e0c7742e1abff0c801816df34a31..bf9eeca42264294d536d94e1c56fa0e386ec10fd 100644 (file)
--- a/memory.c
+++ b/memory.c
@@ -394,7 +394,7 @@ void romlist_clear (void)
     }
 }
 
-/* remove rom entries that need 2 or more roms but not everyone is present */
+/* remove rom entries that need 2 or more roms but not everything required is present */
 static void romlist_cleanup (void)
 {
     int i = 0;
@@ -416,7 +416,7 @@ static void romlist_cleanup (void)
                struct romlist *rl = romlist_getrl (&roms[i]);
                if (rl) {
                    int cnt = romlist_cnt - i - 1;
-                   write_log (L"%d '%s' removed from romlist\n", roms[k].name, rl->path);
+                   write_log (L"%s '%s' removed from romlist\n", roms[k].name, rl->path);
                    xfree (rl->path);
                    if (cnt > 0)
                        memmove (rl, rl + 1, cnt * sizeof (struct romlist));
@@ -2591,6 +2591,15 @@ struct zfile *read_rom (struct romdata **prd)
     return NULL;
 }
 
+static struct zfile *rom_fopen (const TCHAR *name, const TCHAR *mode, int mask)
+{
+    struct zfile *f;
+    //write_log (L"attempting to load '%s'\n", name); 
+    f = zfile_fopen (name, mode, mask);
+    //write_log (L"=%p\n", f);
+    return f;
+}
+
 struct zfile *read_rom_name (const TCHAR *filename)
 {
     int i;
@@ -2604,7 +2613,7 @@ struct zfile *read_rom_name (const TCHAR *filename)
                return f;
        }
     }
-    f = zfile_fopen (filename, L"rb", ZFD_NORMAL);
+    f = rom_fopen (filename, L"rb", ZFD_NORMAL);
     if (f) {
        uae_u8 tmp[11];
        zfile_fread (tmp, sizeof tmp, 1, f);
@@ -2836,7 +2845,9 @@ static int patch_residents (uae_u8 *kickmemory, int size)
                j = 0;
                while (residents[j]) {
                    if (!memcmp (residents[j], kickmemory + addr - base, strlen (residents[j]) + 1)) {
-                       write_log (L"KSPatcher: '%s' at %08X disabled\n", residents[j], i + base);
+                       TCHAR *s = au (residents[j]);
+                       write_log (L"KSPatcher: '%s' at %08X disabled\n", s, i + base);
+                       xfree (s);
                        kickmemory[i] = 0x4b; /* destroy RTC_MATCHWORD */
                        patched++;
                        break;
@@ -2875,19 +2886,19 @@ static int load_kickstart (void)
     _tcscpy (tmprom, currprefs.romfile);
     if (f == NULL) {
        _stprintf (tmprom2, L"%s%s", start_path_data, currprefs.romfile);
-       f = zfile_fopen (tmprom2, L"rb", ZFD_NORMAL);
+       f = rom_fopen (tmprom2, L"rb", ZFD_NORMAL);
        if (f == NULL) {
            _stprintf (currprefs.romfile, L"%sroms/kick.rom", start_path_data);
-           f = zfile_fopen (currprefs.romfile, L"rb", ZFD_NORMAL);
+           f = rom_fopen (currprefs.romfile, L"rb", ZFD_NORMAL);
            if (f == NULL) {
                _stprintf (currprefs.romfile, L"%skick.rom", start_path_data);
-               f = zfile_fopen (currprefs.romfile, L"rb", ZFD_NORMAL);
+               f = rom_fopen (currprefs.romfile, L"rb", ZFD_NORMAL);
                if (f == NULL) {
                    _stprintf (currprefs.romfile, L"%s../shared/rom/kick.rom", start_path_data);
-                   f = zfile_fopen (currprefs.romfile, L"rb", ZFD_NORMAL);
+                   f = rom_fopen (currprefs.romfile, L"rb", ZFD_NORMAL);
                    if (f == NULL) {
                        _stprintf (currprefs.romfile, L"%s../System/rom/kick.rom", start_path_data);
-                       f = zfile_fopen (currprefs.romfile, L"rb", ZFD_NORMAL);
+                       f = rom_fopen (currprefs.romfile, L"rb", ZFD_NORMAL);
                    }
                }
            }
@@ -3094,7 +3105,7 @@ static void add_shmmaps (uae_u32 start, addrbank *what)
     base = ((uae_u8 *) NATMEM_OFFSET) + start;
     y->native_address = shmat (y->id, base, 0);
     if (y->native_address == (void *) -1) {
-       write_log (L"NATMEM: Failure to map existing at %08x(%p)\n", start, base);
+       write_log (L"NATMEM: Failure to map existing at %08x (%p)\n", start, base);
        dumplist ();
        nocanbang ();
        return;
@@ -3210,7 +3221,7 @@ static void allocate_memory (void)
            allocated_chipmem = 0;
        } else {
            need_hardreset = 1;
-           if (memsize != allocated_chipmem)
+           if (memsize > allocated_chipmem)
                memset (chipmemory + allocated_chipmem, 0xff, memsize - allocated_chipmem);
        }
        currprefs.chipset_mask = changed_prefs.chipset_mask;
@@ -3421,10 +3432,11 @@ void memory_reset (void)
 
     init_mem_banks ();
     allocate_memory ();
-
+    
     if (_tcscmp (currprefs.romfile, changed_prefs.romfile) != 0
        || _tcscmp (currprefs.romextfile, changed_prefs.romextfile) != 0)
     {
+       write_log (L"ROM loader..\n");
         kickstart_rom = 1;
        ersatzkickfile = 0;
        a1000_handle_kickstart (0);
@@ -3459,6 +3471,7 @@ void memory_reset (void)
        } else {
            struct romdata *rd = getromdatabydata (kickmemory, kickmem_size);
            if (rd) {
+               write_log (L"Known ROM '%s' loaded\n", rd->name);
                if ((rd->cpu & 3) == 3 && changed_prefs.cpu_model != 68030) {
                    notify_user (NUMSG_KS68030);
                    uae_restart (-1, NULL);
@@ -3482,9 +3495,12 @@ void memory_reset (void)
                    if (currprefs.cs_ide != IDE_A4000)
                        changed_prefs.cs_ide = currprefs.cs_ide = -1;
                }
+           } else {
+               write_log (L"Unknown ROM '%s' loaded\n", currprefs.romfile);
            }
        }
        patch_kick ();
+       write_log (L"ROM loader end\n");
     }
 
     if (cloanto_rom && currprefs.maprom < 0x01000000)
@@ -3644,6 +3660,7 @@ void memory_reset (void)
     }
 #endif
 #endif
+    write_log (L"memory init end\n");
 }
 
 void memory_init (void)
index 6b0398d30d1dad9c3dc71d1d1392934799f64432..aeeece0491e5c4f8272cc138ccd5f0f04139962c 100644 (file)
@@ -696,7 +696,7 @@ static void scan_scsi_bus (SCSI *scgp, int flags)
                    tmp[4] = 0;
                    rev = au (tmp);
 
-                   write_log (L"ASPI: %d:%d:%d '%s' '%s' '%s",
+                   write_log (L"ASPI: %d:%d:%d '%s' '%s' '%s",
                        scgp->addr.scsibus,scgp->addr.target,scgp->addr.lun, vend, prod, rev);
                    if (unitcnt < MAX_TOTAL_DEVICES) {
                        struct scsi_info *cis = &si[unitcnt];
index 243f6802d03de147eee9b4eba5d1e33ebcc6d6f0..4fde94facfa174d1dbe7b0851bdc99dd68132b4c 100644 (file)
@@ -592,7 +592,7 @@ int host_socket(SB, int af, int type, int protocol)
                BSDTRACE((L"failed (%d)\n",sb->sb_errno));
                return -1;
     } else
-               sd = getsd(sb,(int)s);
+               sd = getsd(sb,s);
 
        sb->ftable[sd-1] = SF_BLOCKING;
     ioctlsocket(s,FIONBIO,&nonblocking);
diff --git a/od-win32/clirun.c b/od-win32/clirun.c
new file mode 100644 (file)
index 0000000..5500b24
--- /dev/null
@@ -0,0 +1,173 @@
+
+#include <windows.h>
+
+#include <stdio.h>
+#include <tchar.h>
+
+static int runthread = 1;
+static HANDLE stdin_save, stdout_save, stderr_save;
+static PROCESS_INFORMATION pi;
+
+
+static DWORD WINAPI pipethread (LPVOID pipewr)
+{
+    TCHAR buff[256];
+    DWORD read, wrote;
+    HANDLE pipewrite = (HANDLE)pipewr;
+
+    while (runthread) {
+       read = 0;
+       ReadConsole (stdin_save, buff, 1, &read, NULL);
+       buff[read] = 0;
+       if (read > 0) {
+           if (!WriteFile (pipewrite, buff, read * sizeof (TCHAR), &wrote, NULL)) {
+               if (GetLastError () == ERROR_NO_DATA)
+                   break;
+           }
+       }
+    }
+    return 0;
+}
+
+static void HandleOutput (HANDLE piperead)
+{
+    TCHAR buffer[256];
+    DWORD read, wrote;
+
+    for (;;) {
+       read = 0;
+       if (!ReadFile (piperead, buffer, sizeof buffer, &read, NULL)) {
+           if (GetLastError () == ERROR_BROKEN_PIPE)
+               break;
+       }
+       if (read > 0) {
+           WriteConsole (stdout_save, buffer, read / sizeof (TCHAR), &wrote, NULL);
+       }
+    }
+}
+
+static BOOL WINAPI ctrlhandler (DWORD type)
+{
+    if (pi.hProcess)
+       TerminateProcess (pi.hProcess, 0);
+    ExitProcess (0);
+    return TRUE;
+}
+
+#define conpar L"-console"
+
+int wmain (int argc, wchar_t *argv[], wchar_t *envp[])
+{
+    CONSOLE_SCREEN_BUFFER_INFO csbi;
+    STARTUPINFO si;
+    TCHAR *cmd, *parms2;
+    int len, parmlen, i;
+    HANDLE cp;
+    HANDLE out_rd = NULL, out_wr = NULL, out_rd_tmp = NULL;
+    HANDLE in_rd = NULL, in_wr = NULL, in_wr_tmp = NULL;
+    HANDLE err_wr;
+    DWORD tid;
+    HANDLE thread;
+    SECURITY_ATTRIBUTES sa;
+
+    len = _tcslen (argv[0]);
+    if (len < 4)
+       return 0;
+    cmd = malloc ((len + 4 + 1) * sizeof (TCHAR));
+    _tcscpy (cmd, argv[0]);
+    if (_tcsicmp (cmd + len - 4, L".com"))
+       _tcscat (cmd + len, L".exe");
+    else
+       _tcscpy (cmd + len - 4, L".exe");
+
+    parmlen = 0;
+    for (i = 1; i < argc; i++) {
+       if (parmlen > 0)
+           parmlen ++;
+       parmlen += 1 + _tcslen (argv[i]) + 1;
+    }
+    parms2 = malloc ((_tcslen (cmd) + 1 + parmlen + 1 + _tcslen (conpar) + 1) * sizeof (TCHAR));
+    _tcscpy (parms2, cmd);
+    _tcscat (parms2, L" ");
+    _tcscat (parms2, conpar);
+    for (i = 1; i < argc; i++) {
+       int isspace = 0;
+       _tcscat (parms2, L" ");
+       if (_tcschr (argv[i], ' '))
+           isspace = 1;
+       if (isspace)
+           _tcscat (parms2, L"\"");
+       _tcscat (parms2, argv[i]);
+       if (isspace)
+           _tcscat (parms2, L"\"");
+    }
+       
+    cp = GetCurrentProcess ();
+    sa.nLength = sizeof sa;
+    sa.bInheritHandle = TRUE;
+    sa.lpSecurityDescriptor = NULL;
+
+    stdout_save = GetStdHandle (STD_OUTPUT_HANDLE);
+    stdin_save = GetStdHandle (STD_INPUT_HANDLE);
+    stderr_save = GetStdHandle (STD_ERROR_HANDLE);
+
+    SetConsoleMode (stdin_save, ENABLE_PROCESSED_INPUT|ENABLE_LINE_INPUT|ENABLE_ECHO_INPUT|ENABLE_PROCESSED_OUTPUT);
+    SetConsoleCP (65001);
+    SetConsoleOutputCP (65001);
+    if (GetConsoleScreenBufferInfo (stdout_save, &csbi)) {
+       if (csbi.dwMaximumWindowSize.Y < 900) {
+           csbi.dwMaximumWindowSize.Y = 900;
+           SetConsoleScreenBufferSize (stdout_save, csbi.dwMaximumWindowSize);
+       }
+    }
+
+    CreatePipe (&out_rd_tmp, &out_wr, &sa, 0);
+    CreatePipe (&in_rd, &in_wr_tmp, &sa, 0);
+
+    DuplicateHandle (cp, out_wr, cp, &err_wr, 0, TRUE, DUPLICATE_SAME_ACCESS);
+    DuplicateHandle (cp, out_rd_tmp, cp, &out_rd, 0, FALSE, DUPLICATE_SAME_ACCESS);
+    DuplicateHandle (cp, in_wr_tmp, cp, &in_wr, 0, FALSE, DUPLICATE_SAME_ACCESS);
+
+    CloseHandle (out_rd_tmp);
+    CloseHandle (in_wr_tmp);
+
+    memset (&si, 0, sizeof si);
+    si.cb = sizeof si;
+    si.dwFlags = STARTF_USESTDHANDLES;
+    si.hStdInput = in_rd;
+    si.hStdOutput = out_wr;
+    si.hStdError = err_wr;
+
+    SetConsoleCtrlHandler (&ctrlhandler, TRUE);
+
+    if (!CreateProcess (cmd, parms2,
+       NULL, NULL, TRUE,
+       CREATE_SUSPENDED | CREATE_NEW_CONSOLE | GetPriorityClass (GetCurrentProcess ()),
+       NULL, NULL, &si, &pi)) {
+           _tprintf (L"CreateProcess(%s) failed\n", cmd);
+           goto end;
+    }
+
+    CloseHandle (out_wr);
+    CloseHandle (in_rd);
+    CloseHandle (err_wr);
+
+    thread = CreateThread (NULL, 0, pipethread, (LPVOID)in_wr, 0, &tid);
+
+    ResumeThread (pi.hThread);
+
+    HandleOutput (out_rd);
+    runthread = 0;
+    CloseHandle (stdin_save);
+    WaitForSingleObject (thread, INFINITE);
+
+    CloseHandle (out_rd);
+    CloseHandle (in_wr);
+
+    CloseHandle (pi.hProcess);
+    CloseHandle (pi.hThread);
+end:
+    free (parms2);
+    free (cmd);
+    return 0;
+}
index 42c6b714d74af34fc8ce3f119b7f4f0cbc0f7408..101112019385cd84bd8d52fe7c9d9d7f0131b882 100644 (file)
@@ -2068,6 +2068,7 @@ int open_debug_window(void)
                maximized = 0;
        ShowWindow(hDbgWnd, maximized ? SW_SHOWMAXIMIZED : SW_SHOW);
     UpdateWindow(hDbgWnd);
+    SetForegroundWindow (hDbgWnd);
     update_debug_info();
     return 1;
 }
index 39220b694726a2fda40b60f9fdbb316c30005037..8746e43f3ae3d0b9b5db654a37392ab1a57486d4 100644 (file)
@@ -1612,8 +1612,8 @@ static int acquire_mouse (int num, int flags)
     unacquire (lpdi, L"mouse");
     if (did->connection == DIDC_DX && lpdi) {
        setcoop (&di_mouse[num], flags ? (DISCL_FOREGROUND | DISCL_EXCLUSIVE) : (DISCL_BACKGROUND | DISCL_NONEXCLUSIVE), L"mouse");
-       dipdw.diph.dwSize = sizeof(DIPROPDWORD);
-       dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER);
+       dipdw.diph.dwSize = sizeof (DIPROPDWORD);
+       dipdw.diph.dwHeaderSize = sizeof (DIPROPHEADER);
        dipdw.diph.dwObj = 0;
        dipdw.diph.dwHow = DIPH_DEVICE;
        dipdw.dwData = DI_BUFFER;
@@ -1662,7 +1662,7 @@ static void read_mouse (void)
     DWORD elements;
     HRESULT hr;
     int i, j, k;
-    int fs = isfullscreen() > 0 ? 1 : 0;
+    int fs = isfullscreen () > 0 ? 1 : 0;
     int istest = inputdevice_istest ();
    
     if (IGNOREEVERYTHING)
index 7424c43166ae15617443eede880e150cb49804dd..fd260bf8dc02613b861a4a58cc2e199c2d0c33df 100644 (file)
@@ -736,6 +736,21 @@ static void setupscenescaled (void)
     hr = IDirect3DDevice9_SetSamplerState (d3ddev, 0, D3DSAMP_MIPFILTER, D3DTEXF_NONE);
 }
 
+static void setupscenecoordssl (void)
+{
+    float w, h;
+
+    w = window_w;
+    h = window_h;
+
+    MatrixOrthoOffCenterLH (&m_matProj, 0.0f, (float)w, 0.0f, (float)h, 0.0f, 1.0f);
+    MatrixTranslation (&m_matView,
+       (float)w / 2 - 0.5,
+       (float)h / 2 + 0.5,
+       0.0f);
+    MatrixScaling (&m_matWorld, w, h, 1.0f);
+}
+
 static void setupscenecoords (void)
 {
     RECT sr, dr, zr;
@@ -820,6 +835,15 @@ static void createvertex (void)
     hr = IDirect3DVertexBuffer9_Unlock (vertexBuffer);
 }
 
+static void settransformsl (void)
+{
+    HRESULT hr;
+
+    hr = IDirect3DDevice9_SetTransform (d3ddev, D3DTS_PROJECTION, &m_matProj);
+    hr = IDirect3DDevice9_SetTransform (d3ddev, D3DTS_VIEW, &m_matView);
+    hr = IDirect3DDevice9_SetTransform (d3ddev, D3DTS_WORLD, &m_matWorld);
+}
+
 static void settransform (void)
 {
     HRESULT hr;
@@ -1270,6 +1294,7 @@ static void D3D_render2 (int clear)
        LPDIRECT3DSURFACE9 lpRenderTarget;
        LPDIRECT3DSURFACE9 lpNewRenderTarget;
        LPDIRECT3DTEXTURE9 lpWorkTexture;
+
        if (!psEffect_SetTextures (texture, lpWorkTexture1, lpWorkTexture2, lpHq2xLookupTexture))
            return;
        if (psPreProcess) {
@@ -1323,7 +1348,10 @@ static void D3D_render2 (int clear)
 
        hr = IDirect3DDevice9_SetTexture (d3ddev, 0, (IDirect3DBaseTexture9*)texture);
        hr = IDirect3DDevice9_DrawPrimitive (d3ddev, D3DPT_TRIANGLESTRIP, 0, 2);
+
        if (scanlines_ok) {
+           setupscenecoordssl ();
+           settransformsl ();
            hr = IDirect3DDevice9_SetTexture (d3ddev, 0, (IDirect3DBaseTexture9*)sltexture);
            hr = IDirect3DDevice9_DrawPrimitive (d3ddev, D3DPT_TRIANGLESTRIP, 0, 2);
        }
@@ -1350,7 +1378,7 @@ void D3D_unlocktexture (void)
     hr = IDirect3DTexture9_AddDirtyRect (texture, &r);
 
     D3D_render2 (0);
-    if (vsync2)
+    if (vsync2 && !currprefs.turbo_emulation)
        D3D_render2 (0);
 }
 
index 4cef88936e7e52848b70a8bb7098dc081fb1d350..ed4f414386ab2f7b725a4b41f3352d4b9acd891b 100644 (file)
@@ -921,19 +921,19 @@ void DirectDraw_FillPrimary (void)
     DirectDraw_FillSurface (dxdata.primary, NULL, 0);
 }
 
-extern int vblank_skip, turbo_emulation;
+extern int vblank_skip;
 static void flip (void)
 {
     int result = 0;
     HRESULT ddrval = DD_OK;
     DWORD flags = DDFLIP_WAIT;
 
-    if (turbo_emulation)
+    if (currprefs.turbo_emulation)
        flags |= DDFLIP_NOVSYNC;
     if (dxdata.backbuffers == 2) {
         DirectDraw_Blit (dxdata.flipping[1], dxdata.flipping[0]);
        if (currprefs.gfx_avsync) {
-           if (vblank_skip >= 0) {
+           if (vblank_skip >= 0 || currprefs.turbo_emulation) {
                ddrval = IDirectDrawSurface7_Flip (dxdata.primary, NULL, flags);
            } else {
                if (flipinterval_supported) {
index 5ef52c22f548243aa45fc1f04e1b151441863108..2621f30141f98aeea6a9faeb2f083e9344b1ac9f 100644 (file)
@@ -437,7 +437,7 @@ static void OGL_swapinterval (void)
     if (wglSwapIntervalEXT) {
        int i1, i2;
        i1 = (currprefs.gfx_avsync > 0 && isfullscreen() > 0) ? (abs (currprefs.gfx_refreshrate) > 85 ? 2 : 1) : 0;
-       if (turbo_emulation)
+       if (currprefs.turbo_emulation)
            i1 = 0;
        wglSwapIntervalEXT (i1);
        i2 = wglGetSwapIntervalEXT ();
index 1610e1aff6acdf1113f8b362601c58154cccd2f7..da475347494585c05bfafcd42ad08a12d491afa1 100644 (file)
 #define IDI_GAMEPORTS                   262
 #define IDS_ALL                         262
 #define IDD_GAMEPORTS                   263
+#define IDS_STRING22                    263
+#define IDS_INPUTTOGGLE                 263
 #define IDS_NUMSG_NEEDEXT2              300
 #define IDS_NUMSG_NOROMKEY              301
 #define IDS_NUMSG_KSROMCRCERROR         302
index 485348ad504d56d6d4e1bfdbee944ea480df9f0f..820a1358a05955c23094f880f0e2ab2eeedc7bfd 100644 (file)
@@ -1254,6 +1254,7 @@ BEGIN
     IDS_SOUND_51            "5.1 Channels"\r
     IDS_AUTOMATIC           "Automatic"\r
     IDS_ALL                 "All"\r
+    IDS_INPUTTOGGLE         "Toggle"\r
 END\r
 \r
 STRINGTABLE \r
index 6e3d4c62991ffb4997b641c64e7c60fe667c9e8b..69d7a7874d97459087423149f594b15e13a5103d 100644 (file)
@@ -759,7 +759,7 @@ void rp_fixup_options (struct uae_prefs *p)
     }
 
     rp_update_volume (&currprefs);
-    rp_turbo (turbo_emulation);
+    rp_turbo (currprefs.turbo_emulation);
     for (i = 0; i <= 4; i++)
        rp_update_leds (i, 0, 0);
 }
index 46cb251a99139dce84d40844889e91744c4e7940..c45d5481ee80b40f4458b907db5f9a8aa2921c07 100644 (file)
@@ -454,6 +454,7 @@ static int open_audio_pa (struct sound_data *sd, int index)
     PaStreamParameters p;
     PaError err;
     TCHAR *name;
+    TCHAR *errtxt;
 
     size = sd->sndbufsize;
     s->paframesperbuffer = size;
@@ -468,9 +469,14 @@ static int open_audio_pa (struct sound_data *sd, int index)
     p.suggestedLatency = di->defaultLowOutputLatency;
     p.hostApiSpecificStreamInfo = NULL; 
     for (;;) {
+       int err2;
        err = Pa_IsFormatSupported (NULL, &p, freq);
        if (err == paFormatIsSupported)
            break;
+       err2 = err;
+       errtxt = au (Pa_GetErrorText (err));
+       write_log (L"PASOUND: sound format not supported, ch=%d, rate=%d. %s\n", freq, ch, errtxt);
+       xfree (errtxt);
        if (freq < 48000) {
            freq = 48000;
            err = Pa_IsFormatSupported (NULL, &p, freq);
@@ -487,12 +493,18 @@ static int open_audio_pa (struct sound_data *sd, int index)
                break;
            }
        }
-       write_log (L"PASOUND: sound format not supported\n");
+       if (err2 != err) {
+           errtxt = au (Pa_GetErrorText (err));
+           write_log (L"PASOUND: sound format not supported, ch=%d, rate=%d. %s\n", freq, ch, errtxt);
+           xfree (errtxt);
+       }
        goto end;
     }
     err = Pa_OpenStream (&s->pastream, NULL, &p, freq, s->paframesperbuffer, paNoFlag, portAudioCallback, sd);
     if (err != paNoError) {
-       write_log (L"PASOUND: Pa_OpenStream() error %d (%s)\n", err, Pa_GetErrorText (err));
+       errtxt = au (Pa_GetErrorText (err));
+       write_log (L"PASOUND: Pa_OpenStream() error %d (%s)\n", err, errtxt);
+       xfree (errtxt);
        goto end;
     }
     s->paevent = CreateEvent (NULL, FALSE, FALSE, NULL);
@@ -1387,7 +1399,7 @@ void send_sound (struct sound_data *sd, uae_u16 *sndbuffer)
 
 void finish_sound_buffer (void)
 {
-    if (turbo_emulation)
+    if (currprefs.turbo_emulation)
        return;
     if (currprefs.sound_stereo_swap_paula) {
        if (get_audio_nativechannels () == 2 || get_audio_nativechannels () == 4)
index e685f40a525aa610e151a261c41ca82a2b12b52e..c9abb19c5d15048d05a7cb34313745f03cf047b9 100644 (file)
@@ -3426,7 +3426,9 @@ static int parseargs (const TCHAR *arg, const TCHAR *np, const TCHAR *np2)
        zfile_convertimage (np, np2);
        return -1;
     }
-
+    if (!_tcscmp (arg, L"-console")) {
+       return 1;
+    }
     if (!_tcscmp (arg, L"-log")) {
         console_logging = 1;
         return 1;
@@ -4428,6 +4430,7 @@ int PASCAL wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdL
        GetModuleHandle (L"user32.dll"), "SetProcessDPIAware");
     if (pSetProcessDPIAware)
        pSetProcessDPIAware ();
+    log_open (NULL, 0, 0);
 
     __try {
        WinMain2 (hInstance, hPrevInstance, lpCmdLine, nCmdShow);
index 41ceb121543e7ded309423b6a2b5195fb4fa9725..2f8b8650e180b3418dcda4ea6e88c3dbe9c5c1a2 100644 (file)
@@ -17,8 +17,8 @@
 
 #define WINUAEPUBLICBETA 1
 
-#define WINUAEBETA L"Beta 1"
-#define WINUAEDATE MAKEBD(2009, 5, 30)
+#define WINUAEBETA L"Beta 2"
+#define WINUAEDATE MAKEBD(2009, 6, 6)
 #define WINUAEEXTRA L""
 #define WINUAEREV L""
 
index 03ebaaf60bc25600881d96b1bf9689fdd0e28d26..3c24cdeb35d8096209e3f22d7373abdfa65d545b 100644 (file)
@@ -2213,13 +2213,13 @@ static int create_windows_2 (void)
            WS_EX_TOPMOST :
            WS_EX_ACCEPTFILES | exstyle | (currprefs.win32_alwaysontop ? WS_EX_TOPMOST : 0),
            L"AmigaPowah", L"WinUAE",
-           (dxfs || d3dfs ? WS_POPUP : (WS_CLIPCHILDREN | WS_CLIPSIBLINGS | (hMainWnd ? WS_VISIBLE | WS_CHILD : WS_VISIBLE | WS_POPUP | WS_SYSMENU | WS_MINIMIZEBOX))),
+           (dxfs || d3dfs || currprefs.headless ? WS_POPUP : (WS_CLIPCHILDREN | WS_CLIPSIBLINGS | (hMainWnd ? WS_VISIBLE | WS_CHILD : WS_VISIBLE | WS_POPUP | WS_SYSMENU | WS_MINIMIZEBOX))),
            x, y, w, h,
            borderless ? NULL : (hMainWnd ? hMainWnd : hhWnd), NULL, hInst, NULL);
     }
     if (!hAmigaWnd) {
        write_log (L"creation of amiga window failed\n");
-       close_hwnds();
+       close_hwnds ();
        return 0;
     }
     if (hMainWnd == NULL)
@@ -2229,10 +2229,12 @@ static int create_windows_2 (void)
        SetCursorPos (x + w / 2, y + h / 2);
     addnotifications (hAmigaWnd, FALSE);
     if (hMainWnd != hAmigaWnd) {
-       ShowWindow (hMainWnd, firstwindow ? SW_SHOWDEFAULT : SW_SHOWNORMAL);
+       if (!currprefs.headless)
+           ShowWindow (hMainWnd, firstwindow ? SW_SHOWDEFAULT : SW_SHOWNORMAL);
        UpdateWindow (hMainWnd);
     }
-    ShowWindow (hAmigaWnd, firstwindow ? SW_SHOWDEFAULT : SW_SHOWNORMAL);
+    if (!currprefs.headless)
+       ShowWindow (hAmigaWnd, firstwindow ? SW_SHOWDEFAULT : SW_SHOWNORMAL);
     UpdateWindow (hAmigaWnd);
     firstwindow = 0;
 
index 554a54a2e33e210ceb0e919cd813a1472e77886e..4f981f7fbdc853d273df93130c2fe48410abf73d 100644 (file)
@@ -1205,7 +1205,7 @@ int scan_roms (int show)
        keys = get_keyring ();
        fetch_path (L"KickstartPath", path, sizeof path / sizeof (TCHAR));
        cnt += scan_roms_3 (fkey, paths, path);
-       if (TRUE) {
+       if (1) {
            for(i = 0; i < MAX_ROM_PATHS; i++) {
                ret = get_rom_path (path, i);
                if (ret < 0)
@@ -2734,7 +2734,7 @@ static void set_lventry_input (HWND list, int index)
     int flags, i, sub;
     TCHAR name[256];
     TCHAR custom[MAX_DPATH];
-    TCHAR af[10];
+    TCHAR af[32], toggle[32];
 
     inputdevice_get_mapped_name (input_selected_device, index, &flags, name, custom, input_selected_sub_num);
     if (flags & IDEV_MAPPED_AUTOFIRE_SET)
@@ -2743,15 +2743,22 @@ static void set_lventry_input (HWND list, int index)
        WIN32GUI_LoadUIString (IDS_NO, af, sizeof (af) / sizeof (TCHAR));
     else
        _tcscpy (af, L"-");
-    ListView_SetItemText(list, index, 1, custom[0] ? custom : name);
-    ListView_SetItemText(list, index, 2, af);
+    if (flags & IDEV_MAPPED_TOGGLE)
+       WIN32GUI_LoadUIString (IDS_YES, toggle, sizeof (toggle) / sizeof (TCHAR));
+    else if (flags & IDEV_MAPPED_AUTOFIRE_POSSIBLE)
+       WIN32GUI_LoadUIString (IDS_NO, toggle, sizeof (toggle) / sizeof (TCHAR));
+    else
+       _tcscpy (toggle, L"-");
+    ListView_SetItemText (list, index, 1, custom[0] ? custom : name);
+    ListView_SetItemText (list, index, 2, af);
+    ListView_SetItemText (list, index, 3, toggle);
     sub = 0;
     for (i = 0; i < MAX_INPUT_SUB_EVENT; i++) {
        if (inputdevice_get_mapped_name (input_selected_device, index, &flags, name, custom, i) || custom[0])
            sub++;
     }
     _stprintf (name, L"%d", sub);
-    ListView_SetItemText(list, index, 3, name);
+    ListView_SetItemText (list, index, 4, name);
 }
 
 static void update_listview_input (HWND hDlg)
@@ -2774,7 +2781,7 @@ static int clicked_entry = -1;
 
 #define LV_LOADSAVE 1
 #define LV_HARDDISK 2
-#define LV_INPUT 3
+#define LV_INPUT 4
 #define LV_DISK 4
 #define LV_MISC2 5
 
@@ -2817,7 +2824,8 @@ void InitializeListView (HWND hDlg)
        WIN32GUI_LoadUIString(IDS_INPUTHOSTWIDGET, column_heading[0], MAX_COLUMN_HEADING_WIDTH);
        WIN32GUI_LoadUIString(IDS_INPUTAMIGAEVENT, column_heading[1], MAX_COLUMN_HEADING_WIDTH);
        WIN32GUI_LoadUIString(IDS_INPUTAUTOFIRE, column_heading[2], MAX_COLUMN_HEADING_WIDTH);
-       _tcscpy (column_heading[3], L"#");
+       WIN32GUI_LoadUIString(IDS_INPUTTOGGLE, column_heading[3], MAX_COLUMN_HEADING_WIDTH);
+       _tcscpy (column_heading[4], L"#");
        list = GetDlgItem(hDlg, IDC_INPUTLIST);
     } else if (hDlg == pages[MISC2_ID]) {
        listview_num_columns = MISC2_COLUMNS;
@@ -2881,7 +2889,8 @@ void InitializeListView (HWND hDlg)
        }
        listview_column_width [1] = 260;
        listview_column_width [2] = 65;
-       listview_column_width [3] = 30;
+       listview_column_width [3] = 65;
+       listview_column_width [4] = 30;
        update_listview_input (hDlg);
     } else if (lv_type == LV_DISK) {
        for (i = 0; i < MAX_SPARE_DRIVES; i++) {
@@ -9875,7 +9884,7 @@ static void doinputcustom (HWND hDlg, int newcustom)
     if (_tcslen (custom1) > 0 || newcustom) {
        if (askinputcustom (hDlg, custom1, sizeof custom1 / sizeof (TCHAR), IDS_SB_CUSTOMEVENT)) {
            inputdevice_set_mapping (input_selected_device, input_selected_widget,
-               0, custom1, (flags & IDEV_MAPPED_AUTOFIRE_SET) ? 1 : 0, input_selected_sub_num);
+               0, custom1, flags, input_selected_sub_num);
        }
     }
 }
@@ -9958,7 +9967,7 @@ static void values_from_inputdlg (HWND hDlg, int inputchange)
            custom[0] = 0;
        inputdevice_set_mapping (input_selected_device, input_selected_widget,
            eventnames[input_selected_event], _tcslen (custom) == 0 ? NULL : custom,
-           (flags & IDEV_MAPPED_AUTOFIRE_SET) ? 1 : 0, input_selected_sub_num);
+           flags, input_selected_sub_num);
        update_listview_input (hDlg);
        inputdevice_updateconfig (&workprefs);
     }
@@ -9998,7 +10007,21 @@ static void input_copy (HWND hDlg)
 
 static void input_toggleautofire (void)
 {
-    int af, flags, evt;
+    int flags, evt;
+    TCHAR name[256];
+    TCHAR custom[MAX_DPATH];
+    if (input_selected_device < 0 || input_selected_widget < 0)
+       return;
+    evt = inputdevice_get_mapped_name (input_selected_device, input_selected_widget,
+       &flags, name, custom, input_selected_sub_num);
+    if (evt <= 0)
+       return;
+    inputdevice_set_mapping (input_selected_device, input_selected_widget,
+       name, custom, flags ^ IDEV_MAPPED_AUTOFIRE_SET, input_selected_sub_num);
+}
+static void input_toggletoggle (void)
+{
+    int flags, evt;
     TCHAR name[256];
     TCHAR custom[MAX_DPATH];
     if (input_selected_device < 0 || input_selected_widget < 0)
@@ -10007,9 +10030,8 @@ static void input_toggleautofire (void)
        &flags, name, custom, input_selected_sub_num);
     if (evt <= 0)
        return;
-    af = (flags & IDEV_MAPPED_AUTOFIRE_SET) ? 0 : 1;
     inputdevice_set_mapping (input_selected_device, input_selected_widget,
-       name, custom, af, input_selected_sub_num);
+       name, custom, flags ^ IDEV_MAPPED_TOGGLE, input_selected_sub_num);
 }
 
 static INT_PTR CALLBACK InputDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -10051,7 +10073,7 @@ static INT_PTR CALLBACK InputDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
            input_swap (hDlg);
            break;
            case IDC_INPUTDEVICEDISABLE:
-           inputdevice_set_device_status (input_selected_device, IsDlgButtonCheckedhDlg, IDC_INPUTDEVICEDISABLE) ? 1 : 0);
+           inputdevice_set_device_status (input_selected_device, IsDlgButtonChecked (hDlg, IDC_INPUTDEVICEDISABLE) ? 1 : 0);
            break;
            default:
            switch (LOWORD (wParam))
@@ -10100,7 +10122,9 @@ static INT_PTR CALLBACK InputDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
                    input_selected_widget = entry;
                    if (row == 2 && entry == oldentry)
                        input_toggleautofire ();
-                   if (row == 3) {
+                   if (row == 3 && entry == oldentry)
+                       input_toggletoggle ();
+                   if (row == 4) {
                        input_selected_sub_num++;
                        if (input_selected_sub_num >= MAX_INPUT_SUB_EVENT)
                            input_selected_sub_num = 0;
@@ -10156,9 +10180,9 @@ static void enable_for_hw3ddlg (HWND hDlg)
     ew (hDlg, IDC_FILTERVZMULT, v && !as);
     ew (hDlg, IDC_FILTERHO, v && !as);
     ew (hDlg, IDC_FILTERVO, v && !as);
-    ew (hDlg, IDC_FILTERSLR, vv3 && !as);
-    ew (hDlg, IDC_FILTERXL, vv2 && !as);
-    ew (hDlg, IDC_FILTERXLV, vv2 && !as);
+    ew (hDlg, IDC_FILTERSLR, vv3);
+    ew (hDlg, IDC_FILTERXL, vv2);
+    ew (hDlg, IDC_FILTERXLV, vv2);
     ew (hDlg, IDC_FILTERXTRA, vv2);
     ew (hDlg, IDC_FILTERDEFAULT, v);
     ew (hDlg, IDC_FILTERFILTER, vv);
index 982d719f60e0682b6c83cf7caa17b6740b50dfd1..68e420b071d0e7a3c3a291e63ea763bf54bc3cca 100644 (file)
@@ -1,5 +1,28 @@
+Beta 2:
 
-Beta 1
+- fs "double vsync" mode (100Hz+) was still slow in warp mode
+  (note D3D mode will stay "slow" because afaik it is not possible
+  to switch D3D vsync on/off on the fly)
+- added warp mode to configuration file (warp=true/false, config file
+  read-only)
+- and another read-only configuration entry, "headless" that switches
+  invisible emulation mode (window gets hidden). future feature..
+- log window scrollback buffer increased to 900 lines
+- command prompt "console wrapper" support (run winuae in command
+  prompt: output goes to command prompt window, does not open separate
+  log window) More information later, not important just yet..
+- saving configuration after modifying input-panel autofire setting
+  caused modified input event to be saved incorrectly (old bug)
+- display scaling does not anymore change D3D filter scanline scaling
+- unicode conversion broke magic mouse
+- uaeunp file handling update broke some archive operations (b1)
+- loading config from command line with GUI enabled didn't override
+  quickstart (if enabled)
+- added "toggle" option to input panel. First button/key press =
+  emulated button is pressed and kept down. Second button/key press
+  = emulated button is released
+
+Beta 1:
 
 - development PC updated to Intel Core i7 based. (Asus P6T DeluxeV2,
   i7 920 2.66GHz CPU @ 3.7GHz, 3x2G 1866MHz RAM)
index 0c24b9ebe566fee4968f189ff2fba6e85666e474..a43bd305394260c369f475933fe56cb32199901e 100644 (file)
@@ -16,6 +16,7 @@
 #define SHOW_CONSOLE 0
 
 int consoleopen = 0;
+static int realconsole;
 static HANDLE stdinput,stdoutput;
 static int bootlogmode;
 static CRITICAL_SECTION cs;
@@ -36,20 +37,43 @@ static HWND myGetConsoleWindow (void)
     return GetConsoleWindow ();
 }
 
-static void open_console_window (void)
+static void getconsole (void)
 {
-    AllocConsole();
+    CONSOLE_SCREEN_BUFFER_INFO csbi;
+
     stdinput = GetStdHandle (STD_INPUT_HANDLE);
     stdoutput = GetStdHandle (STD_OUTPUT_HANDLE);
     SetConsoleMode (stdinput, ENABLE_PROCESSED_INPUT|ENABLE_LINE_INPUT|ENABLE_ECHO_INPUT|ENABLE_PROCESSED_OUTPUT);
     SetConsoleCP (65001);
     SetConsoleOutputCP (65001);
+    if (GetConsoleScreenBufferInfo (stdoutput, &csbi)) {
+       if (csbi.dwMaximumWindowSize.Y < 900) {
+           csbi.dwMaximumWindowSize.Y = 900;
+           SetConsoleScreenBufferSize (stdoutput, csbi.dwMaximumWindowSize);
+       }
+    }
+}
+
+static void open_console_window (void)
+{
+    AllocConsole ();
+    getconsole ();
     consoleopen = -1;
     reopen_console ();
 }
 
-static void openconsolevoid)
+static void openconsole (void)
 {
+    if (realconsole) {
+       if (debugger_type == 2) {
+           open_debug_window ();
+           consoleopen = 1;
+       } else {
+           close_debug_window ();
+           consoleopen = -1;
+       }
+       return;
+    }
     if (debugger_active && (debugger_type < 0 || debugger_type == 2)) {
        if (consoleopen > 0 || debuggerinitializing)
            return;
@@ -90,6 +114,8 @@ void reopen_console (void)
 {
     HWND hwnd;
 
+    if (realconsole)
+       return;
     if (consoleopen >= 0)
        return;
     hwnd = myGetConsoleWindow ();
@@ -121,6 +147,8 @@ void reopen_console (void)
 
 void close_console (void)
 {
+    if (realconsole)
+       return;
     if (consoleopen > 0) {
        close_debug_window ();
     } else if (consoleopen < 0) {
@@ -144,12 +172,18 @@ void close_console (void)
 static void writeconsole (const TCHAR *buffer)
 {
     DWORD temp;
+    
     if (!consoleopen)
-       openconsole();
-    if (consoleopen > 0)
+       openconsole ();
+
+    if (consoleopen > 0) {
        WriteOutput (buffer, _tcslen (buffer));
-    else if (consoleopen < 0)
-       WriteConsole (stdoutput, buffer, _tcslen (buffer), &temp,0);
+    } else if (realconsole) {
+       fputws (buffer, stdout);
+       fflush (stdout);
+    } else if (consoleopen < 0) {
+       WriteConsole (stdoutput, buffer, _tcslen (buffer), &temp, 0);
+    }
 }
 
 void console_out_f (const TCHAR *format,...)
@@ -172,8 +206,12 @@ void console_out (const TCHAR *txt)
 int console_get (TCHAR *out, int maxlen)
 {
     *out = 0;
+
     if (consoleopen > 0) {
        return console_get_gui (out, maxlen);
+    } else if (realconsole) {
+       _fgetts (out, maxlen, stdin);
+       return _tcslen (out);
     } else if (consoleopen < 0) {
        DWORD len, totallen;
 
@@ -351,13 +389,27 @@ TCHAR* buf_out (TCHAR *buffer, int *bufsize, const TCHAR *format, ...)
 
 void *log_open (const TCHAR *name, int append, int bootlog)
 {
-    FILE *f;
+    FILE *f = NULL;
 
-    f = _tfopen (name, append ? L"a, ccs=UTF-8" : L"wt, ccs=UTF-8");
-    bootlogmode = bootlog;
     if (!cs_init)
-       InitializeCriticalSection (&cs);
+        InitializeCriticalSection (&cs);
     cs_init = 1;
+
+    if (name != NULL) {
+       f = _tfopen (name, append ? L"a, ccs=UTF-8" : L"wt, ccs=UTF-8");
+       bootlogmode = bootlog;
+    } else if (1) {
+       TCHAR *c = GetCommandLine ();
+       if (_tcsstr (c, L" -console")) {
+           if (GetStdHandle (STD_INPUT_HANDLE) && GetStdHandle (STD_OUTPUT_HANDLE)) {
+               consoleopen = -1;
+               realconsole = 1;
+               getconsole ();
+               _setmode(_fileno (stdout), _O_U16TEXT);
+               _setmode(_fileno (stdin), _O_U16TEXT);
+           }
+       }
+    }
     return f;
 }
 
diff --git a/zfile.c b/zfile.c
index e23e5d7cff6a503c810ce0e7f5f4b0dcf073f83c..845faa66e562c0d6e5f4ea90f30e92f9b604875a 100644 (file)
--- a/zfile.c
+++ b/zfile.c
@@ -674,13 +674,15 @@ int iszip (struct zfile *z)
     return 0;
 }
 
-struct zfile *zuncompress (struct znode *parent, struct zfile *z, int dodefault, int mask)
+struct zfile *zuncompress (struct znode *parent, struct zfile *z, int dodefault, int mask, int *retcode)
 {
     TCHAR *name = z->name;
     TCHAR *ext = NULL;
     uae_u8 header[32];
     int i;
 
+    if (*retcode)
+       *retcode = 0;
     if (!mask)
        return NULL;
     if (name) {
@@ -692,15 +694,15 @@ struct zfile *zuncompress (struct znode *parent, struct zfile *z, int dodefault,
     if (ext != NULL) {
        if (mask & ZFD_ARCHIVE) {
            if (strcasecmp (ext, L"7z") == 0)
-                return archive_access_select (parent, z, ArchiveFormat7Zip, dodefault);
+                return archive_access_select (parent, z, ArchiveFormat7Zip, dodefault, retcode);
            if (strcasecmp (ext, L"zip") == 0)
-                return archive_access_select (parent, z, ArchiveFormatZIP, dodefault);
+                return archive_access_select (parent, z, ArchiveFormatZIP, dodefault, retcode);
            if (strcasecmp (ext, L"lha") == 0 || strcasecmp (ext, L"lzh") == 0)
-                return archive_access_select (parent, z, ArchiveFormatLHA, dodefault);
+                return archive_access_select (parent, z, ArchiveFormatLHA, dodefault, retcode);
            if (strcasecmp (ext, L"lzx") == 0)
-                return archive_access_select (parent, z, ArchiveFormatLZX, dodefault);
+                return archive_access_select (parent, z, ArchiveFormatLZX, dodefault, retcode);
            if (strcasecmp (ext, L"rar") == 0)
-                return archive_access_select (parent, z, ArchiveFormatRAR, dodefault);
+                return archive_access_select (parent, z, ArchiveFormatRAR, dodefault, retcode);
        }
        if (mask & ZFD_UNPACK) {
            if (strcasecmp (ext, L"gz") == 0)
@@ -741,7 +743,7 @@ struct zfile *zuncompress (struct znode *parent, struct zfile *z, int dodefault,
 #if defined(ARCHIVEACCESS)
        for (i = 0; plugins_7z_x[i]; i++) {
            if ((plugins_7z_t[i] & mask) && strcasecmp (ext, plugins_7z[i]) == 0)
-               return archive_access_arcacc_select (z, plugins_7z_t[i]);
+               return archive_access_arcacc_select (z, plugins_7z_t[i], retcode);
        }
 #endif
     }
@@ -787,21 +789,21 @@ struct zfile *zuncompress (struct znode *parent, struct zfile *z, int dodefault,
     }
     if (mask & ZFD_ARCHIVE) {
         if (header[0] == 'P' && header[1] == 'K')
-           return archive_access_select (parent, z, ArchiveFormatZIP, dodefault);
+           return archive_access_select (parent, z, ArchiveFormatZIP, dodefault, retcode);
         if (header[0] == 'R' && header[1] == 'a' && header[2] == 'r' && header[3] == '!')
-           return archive_access_select (parent, z, ArchiveFormatRAR, dodefault);
+           return archive_access_select (parent, z, ArchiveFormatRAR, dodefault, retcode);
        if (header[0] == 'L' && header[1] == 'Z' && header[2] == 'X')
-           return archive_access_select (parent, z, ArchiveFormatLZX, dodefault);
+           return archive_access_select (parent, z, ArchiveFormatLZX, dodefault, retcode);
        if (header[2] == '-' && header[3] == 'l' && header[4] == 'h' && header[6] == '-')
-           return archive_access_select (parent, z, ArchiveFormatLHA, dodefault);
+           return archive_access_select (parent, z, ArchiveFormatLHA, dodefault, retcode);
     }
     if (mask & ZFD_ADF) {
        if (header[0] == 'D' && header[1] == 'O' && header[2] == 'S' && (header[3] >= 0 && header[3] <= 7))
-           return archive_access_select (parent, z, ArchiveFormatADF, dodefault);
+           return archive_access_select (parent, z, ArchiveFormatADF, dodefault, retcode);
        if (header[0] == 'S' && header[1] == 'F' && header[2] == 'S')
-           return archive_access_select (parent, z, ArchiveFormatADF, dodefault);
+           return archive_access_select (parent, z, ArchiveFormatADF, dodefault, retcode);
        if (isfat (header))
-           return archive_access_select (parent, z, ArchiveFormatFAT, dodefault);
+           return archive_access_select (parent, z, ArchiveFormatFAT, dodefault, retcode);
     }
 
     if (ext) {
@@ -811,7 +813,7 @@ struct zfile *zuncompress (struct znode *parent, struct zfile *z, int dodefault,
        }
        if (mask & ZFD_ADF) {
            if (strcasecmp (ext, L"adf") == 0 && !memcmp (header, "DOS", 3))
-               return archive_access_select (parent, z, ArchiveFormatADF, dodefault);
+               return archive_access_select (parent, z, ArchiveFormatADF, dodefault, retcode);
        }
     }
     return NULL;
@@ -989,7 +991,7 @@ int zfile_zopen (const TCHAR *name, zfile_callback zc, void *user)
 /*
  * fopen() for a compressed file
  */
-struct zfile *zfile_fopen (const TCHAR *name, const TCHAR *mode, int mask)
+static struct zfile *zfile_fopen_x (const TCHAR *name, const TCHAR *mode, int mask)
 {
     int cnt = 10;
     struct zfile *l, *l2;
@@ -1003,15 +1005,30 @@ struct zfile *zfile_fopen (const TCHAR *name, const TCHAR *mode, int mask)
        return l;
     l2 = NULL;
     while (cnt-- > 0) {
+       int rc;
        zfile_fseek (l, 0, SEEK_SET);
-       l2 = zuncompress (NULL, l, 0, mask);
-       zfile_fseek (l, 0, SEEK_SET);
-       if (!l2)
+       l2 = zuncompress (NULL, l, 0, mask, &rc);
+       if (!l2) {
+           if (rc < 0) {
+               zfile_fclose (l);
+               return NULL;
+           }
+           zfile_fseek (l, 0, SEEK_SET);
            break;
+       }
        l = l2;
     }
     return l;
 }
+struct zfile *zfile_fopen (const TCHAR *name, const TCHAR *mode, int mask)
+{
+    struct zfile *f;
+    //write_log (L"zfile_fopen('%s','%s',%08x)\n", name, mode, mask);
+    f = zfile_fopen_x (name, mode, mask);
+    //write_log (L"=%p\n", f);
+    return f;
+}
+
 
 struct zfile *zfile_dup (struct zfile *zf)
 {
@@ -1778,7 +1795,7 @@ static struct zvolume *prepare_recursive_volume (struct zvolume *zv, const TCHAR
        goto end;
     zvnew = zfile_fopen_archive_ext (zv->parentz, zf);
     if (!zvnew) {
-       struct zfile *zf2 = zuncompress (&zv->root, zf, 0, ZFD_ALL);
+       struct zfile *zf2 = zuncompress (&zv->root, zf, 0, ZFD_ALL, NULL);
        if (zf2) {
            zf = zf2;
            zvnew = archive_directory_plain (zf);
index c441ac75f4131c9a6511fe7e6a8da03505d9db5a..4ca73f74b8b92999bfbd84f0ffbee76f6644a51b 100644 (file)
@@ -120,7 +120,7 @@ struct zfile *archive_getzfile (struct znode *zn, unsigned int id)
     return zf;
 }
 
-struct zfile *archive_access_select (struct znode *parent, struct zfile *zf, unsigned int id, int dodefault)
+struct zfile *archive_access_select (struct znode *parent, struct zfile *zf, unsigned int id, int dodefault, int *retcode)
 {
     struct zvolume *zv;
     struct znode *zn;
@@ -129,9 +129,11 @@ struct zfile *archive_access_select (struct znode *parent, struct zfile *zf, uns
     struct zfile *z = NULL;
     int we_have_file;
 
+    if (retcode)
+       *retcode = 0;
     zv = getzvolume (parent, zf, id);
     if (!zv)
-       return zf;
+       return NULL;
     we_have_file = 0;
     tmphist[0] = 0;
     zipcnt = 1;
@@ -193,13 +195,14 @@ struct zfile *archive_access_select (struct znode *parent, struct zfile *zf, uns
        zfile_fclose (zf);
        zf = z;
     } else if (!dodefault && zf->zipname && zf->zipname[0]) {
-       zfile_fclose (zf);
+       if (retcode)
+           *retcode = -1;
        zf = NULL;
     }
     return zf;
 }
 
-struct zfile *archive_access_arcacc_select (struct zfile *zf, unsigned int id)
+struct zfile *archive_access_arcacc_select (struct zfile *zf, unsigned int id, int *retcode)
 {
     return zf;
 }
@@ -874,6 +877,7 @@ struct zvolume *archive_directory_plain (struct zfile *z)
     struct znode *zn;
     struct zarchive_info zai;
     uae_u8 id[8];
+    int rc;
 
     memset (&zai, 0, sizeof zai);
     zv = zvolume_alloc (z, ArchiveFormatPLAIN, NULL, NULL);
@@ -893,7 +897,7 @@ struct zvolume *archive_directory_plain (struct zfile *z)
        xfree (data);
     }
     zf = zfile_dup (z);
-    zf2 = zuncompress (NULL, zf, 0, ZFD_ALL);
+    zf2 = zuncompress (NULL, zf, 0, ZFD_ALL, &rc);
     if (zf2) {
        zf = NULL;
        zai.name = zfile_getfilename (zf2);