]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
imported winuaesrc2000b20.zip
authorToni Wilen <twilen@winuae.net>
Sat, 7 Nov 2009 18:34:47 +0000 (20:34 +0200)
committerToni Wilen <twilen@winuae.net>
Mon, 22 Feb 2010 19:49:15 +0000 (21:49 +0200)
20 files changed:
blitter.c
custom.c
gencpu.c
inputdevice.c
od-win32/direct3d.c
od-win32/parser.c
od-win32/resources/expansion.ico [new file with mode: 0644]
od-win32/resources/icon3.ico [new file with mode: 0644]
od-win32/resources/resource
od-win32/resources/screen.ico
od-win32/resources/winuae.rc
od-win32/uaeunp/uaeunp.vcproj
od-win32/uaeunp/uaeunp.vcxproj
od-win32/win32.h
od-win32/win32gui.c
od-win32/winuae_msvc/winuae_msvc.vcproj
od-win32/winuaechangelog.txt
uaeunp.c
zfile.c
zfile_archive.c

index 08eaa1b1869ba85c522211f453509690b69e2095..21ed1c8227287989555f18318710dec635480515 100644 (file)
--- a/blitter.c
+++ b/blitter.c
@@ -59,7 +59,8 @@ static uae_u8 blit_filltable[256][4][2];
 uae_u32 blit_masktable[BLITTER_MAX_WORDS];
 enum blitter_states bltstate;
 
-static int blit_cyclecounter, blit_maxcyclecounter, blit_slowdown, blit_totalcyclecounter;
+static int blit_cyclecounter, blit_waitcyclecounter;
+static int blit_maxcyclecounter, blit_slowdown, blit_totalcyclecounter;
 static int blit_startcycles, blit_misscyclecounter;
 
 #ifdef CPUEMU_12
@@ -652,6 +653,11 @@ static void decide_blitter_line (int hsync, int hpos)
                for (;;) {
                        int v = canblit (last_blitter_hpos);
 
+                       if (blit_waitcyclecounter) {
+                               blit_waitcyclecounter = 0;
+                               break;
+                       }
+
                        if (!v) {
                                blit_misscyclecounter++;
                                blitter_nasty++;
@@ -682,6 +688,7 @@ static void decide_blitter_line (int hsync, int hpos)
                                        bltdpt = bltcpt;
                                        blit_final = 1;
                                        blit_cyclecounter = 0;
+                                       blit_waitcyclecounter = 0;
                                }
                                break;
                        }
@@ -711,6 +718,7 @@ static void decide_blitter_line (int hsync, int hpos)
                                        bltdpt = bltcpt;
                                        blit_final = 1;
                                        blit_cyclecounter = 0;
+                                       blit_waitcyclecounter = 0;
                                        break;
                                }
 
@@ -945,6 +953,7 @@ static void do_startcycles (int hpos)
                                do_blitter (vhpos, 0);
                                blit_startcycles = 0;
                                blit_cyclecounter = 0;
+                               blit_waitcyclecounter = 0;
                                if (blit_faulty)
                                        blit_faulty = 1;
                                return;
@@ -990,6 +999,11 @@ void decide_blitter (int hpos)
 
                        v = canblit (last_blitter_hpos);
 
+                       // copper bltsize write needs one cycle (any cycle) delay
+                       if (blit_waitcyclecounter) {
+                               blit_waitcyclecounter = 0;
+                               break;
+                       }
                        // idle cycles require free bus..
                        // (CPU can still use this cycle)
                        if (c == 0 && v == 0) {
@@ -1314,7 +1328,8 @@ static void do_blitter2 (int hpos, int copper)
                blitter_vcounter1 = blitter_vcounter2 = 0;
                if (blit_nod)
                        blitter_vcounter2 = vblitsize;
-               blit_cyclecounter = -(BLITTER_STARTUP_CYCLES + (copper ? 1 : 0));
+               blit_cyclecounter = -BLITTER_STARTUP_CYCLES;
+               blit_waitcyclecounter = copper;
                blit_startcycles = 0;
                blit_maxcyclecounter = hblitsize * vblitsize + 2;
                return;
@@ -1329,6 +1344,7 @@ static void do_blitter2 (int hpos, int copper)
        if (currprefs.immediate_blits)
                cycles = 1;
 
+       blit_waitcyclecounter = 0;
        blit_cyclecounter = cycles * (blit_dmacount2 + (blit_nod ? 0 : 1)); 
        event2_newevent (ev2_blitter, blit_cyclecounter);
 }
@@ -1341,7 +1357,8 @@ void do_blitter (int hpos, int copper)
        }
        // previous blit may have last write cycle left
        // and we must let it finish
-       blit_startcycles = BLITTER_STARTUP_CYCLES + (copper ? 1 : 0);
+       blit_startcycles = BLITTER_STARTUP_CYCLES;
+       blit_waitcyclecounter = copper;
 }
 
 void maybe_blit (int hpos, int hack)
index d85c5550aff7686d0b27866beedef4ba495a625a..4e3b8dcd0a06edcb05562cb5c479391b8b2aa85b 100644 (file)
--- a/custom.c
+++ b/custom.c
@@ -2910,11 +2910,19 @@ STATIC_INLINE int GETHPOS (void)
        return islightpentriggered () ? hpos_lpen : (issyncstopped () ? hpos_previous : current_hpos ());
 }
 
+#define HPOS_OFFSET 3
+
 STATIC_INLINE uae_u16 VPOSR (void)
 {
        unsigned int csbit = 0;
-       int vp = (GETVPOS () >> 8) & 7;
+       uae_u16 vp = (GETVPOS () >> 8) & 7;
+       uae_u16 hp = GETHPOS ();
 
+       if (hp + HPOS_OFFSET >= maxhpos) {
+               vp++;
+               if (vp >= maxvpos + lof)
+                       vp = 0;
+       }
        if (currprefs.cs_agnusrev >= 0) {
                csbit |= currprefs.cs_agnusrev  << 8;
        } else {
@@ -2985,11 +2993,11 @@ STATIC_INLINE uae_u16 VHPOSR (void)
        uae_u16 vp = GETVPOS ();
        uae_u16 hp = GETHPOS ();
 
-       hp += 3;
+       hp += HPOS_OFFSET;
        if (hp >= maxhpos) {
                hp -= maxhpos;
                vp++;
-               if (vp >= maxvpos)
+               if (vp >= maxvpos + lof)
                        vp = 0;
        }
        hp += 1;
@@ -3001,7 +3009,7 @@ STATIC_INLINE uae_u16 VHPOSR (void)
        if (currprefs.cpu_model >= 68020)
                hsyncdelay ();
 #if 0
-       if (M68K_GETPC < 0xf00000)
+       if (M68K_GETPC < 0xf00000 && (vpos >= maxhpos || vpos <= 1))
                write_log (L"VPOS %04x %04x at %08x\n", VPOSR (), vp, M68K_GETPC);
 #endif
        return vp;
index 240620e02f83c7d30ae5662b3727aac1d4987f24..5616d1f05ef5240cb0e9d969f1a18e3c7593fdf9 100644 (file)
--- a/gencpu.c
+++ b/gencpu.c
@@ -2362,7 +2362,7 @@ static void gen_opcode (unsigned long int opcode)
                fill_prefetch_next ();
                if (using_ce) {
                        start_brace ();
-                       printf ("\t\tint cycles = (getDivu68kCycles((uae_u32)dst, (uae_u16)src) - 4);\n");
+                       printf ("\t\tint cycles = (getDivu68kCycles((uae_u32)dst, (uae_u16)src));\n");
                        addcycles000_3 ("\t\t");
                } else if (using_ce020) {
                        addcycles_ce020 (36);
@@ -2410,7 +2410,7 @@ static void gen_opcode (unsigned long int opcode)
                fill_prefetch_next ();
                if (using_ce) {
                        start_brace ();
-                       printf ("\t\tint cycles = (getDivs68kCycles((uae_s32)dst, (uae_s16)src) - 4);\n");
+                       printf ("\t\tint cycles = (getDivs68kCycles((uae_s32)dst, (uae_s16)src));\n");
                        addcycles000_3 ("\t\t");
                } else if (using_ce020) {
                        addcycles_ce020 (46);
index 631e1b03a674f548b2ecf47730f8b63fe977c743..a372f606efa53baf589204051d266cc6bd93023e 100644 (file)
@@ -1524,6 +1524,8 @@ static int getvelocity (int num, int subnum, int pct)
        int val;
        int v;
 
+       if (pct > 1000)
+               pct = 1000;
        val = mouse_delta[num][subnum];
        v = val * pct / 1000;
        if (!v) {
@@ -1544,12 +1546,9 @@ static int getvelocity (int num, int subnum, int pct)
 static void mouseupdate (int pct, int vsync)
 {
        int v, i;
-       int max = 127;
+       int max = 120;
        static int mxd, myd;
 
-       if (pct > 1000)
-               pct = 1000;
-
        if (vsync) {
                if (mxd < 0) {
                        if (mouseedge_x > 0)
@@ -1631,9 +1630,17 @@ extern int vpos;
 static void readinput (void)
 {
        uae_u32 totalvpos;
+       int diff;
 
        totalvpos = input_frame * maxvpos + vpos;
-       mouseupdate ((totalvpos - input_vpos) * 1000 / maxvpos, 0);
+       diff = totalvpos - input_vpos;
+       if (diff > 0) {
+               if (diff < 10) {
+                       mouseupdate (0, 0);
+               } else {
+                       mouseupdate (diff * 1000 / maxvpos, 0);
+               }
+       }
        input_vpos = totalvpos;
 
 }
@@ -1641,7 +1648,7 @@ static void readinput (void)
 int getjoystate (int joy)
 {
        int left = 1, right = 1, top = 1, bot = 1;
-       uae_u16 v = 0;
+       uae_u16 v;
 
        if (inputdevice_logging & 2)
                write_log (L"JOY%dDAT %08x\n", joy, M68K_GETPC);
index 613468cc6739d0d75cff9ee2e38af27e6c5d2773..75841485796ff6161783d7674a1a796feb576d01 100644 (file)
@@ -1109,6 +1109,8 @@ const TCHAR *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth
        int adapter;
        DWORD flags;
        HINSTANCE d3dDLL, d3dx;
+       typedef HRESULT (WINAPI *LPDIRECT3DCREATE9EX)(UINT, IDirect3D9Ex**);
+       LPDIRECT3DCREATE9EX d3dexp = NULL;
 
        D3D_free ();
        D3D_canshaders ();
@@ -1132,15 +1134,14 @@ const TCHAR *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth
                _tcscpy (errmsg, L"Direct3D: DirectX 9 or newer required");
                return errmsg;
        } else {
-               typedef HRESULT (WINAPI *LPDIRECT3DCREATE9EX)(UINT, IDirect3D9Ex**);
-               LPDIRECT3DCREATE9EX d3dexp  = (LPDIRECT3DCREATE9EX)GetProcAddress (d3dDLL, "Direct3DCreate9Ex");
+               d3dexp  = (LPDIRECT3DCREATE9EX)GetProcAddress (d3dDLL, "Direct3DCreate9Ex");
                if (d3dexp)
                        d3d_ex = TRUE;
        }
        FreeLibrary (d3dDLL);
        hr = -1;
        if (d3d_ex && D3DEX) {
-               hr = Direct3DCreate9Ex (D3D_SDK_VERSION, &d3dex);
+               hr = d3dexp (D3D_SDK_VERSION, &d3dex);
                if (FAILED (hr))
                        write_log (L"Direct3D: failed to create D3DEx object: %s\n", D3D_ErrorString (hr));
                d3d = (IDirect3D9*)d3dex;
index ce41dacc407899f9075a83c01d6cb75650d138bc..8d69731975978e9b4f8aa8d524e9665b094cffba 100644 (file)
@@ -1190,7 +1190,7 @@ static int enumserialports_2 (int cnt)
        SP_DEVICE_INTERFACE_DETAIL_DATA *pDetData = NULL;
        BOOL bOk = TRUE;
        SP_DEVICE_INTERFACE_DATA ifcData;
-       DWORD dwDetDataSize = sizeof (SP_DEVICE_INTERFACE_DETAIL_DATA) + 256;
+       DWORD dwDetDataSize = sizeof (SP_DEVICE_INTERFACE_DETAIL_DATA) + 256 * sizeof (TCHAR);
        DWORD ii;
 
        hDevInfo = SetupDiGetClassDevs (&GUID_CLASS_COMPORT, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
@@ -1225,7 +1225,7 @@ static int enumserialports_2 (int cnt)
                                        comports[cnt].name = my_strdup (fname);
                                        p = _tcsstr (fname, L"(COM");
                                        if (p && (p[5] == ')' || p[6] == ')')) {
-                                               comports[cnt].cfgname = xmalloc (100);
+                                               comports[cnt].cfgname = xmalloc (100 * sizeof (TCHAR));
                                                if (isdigit(p[5]))
                                                        _stprintf (comports[cnt].cfgname, L"COM%c%c", p[4], p[5]);
                                                else
@@ -1241,7 +1241,7 @@ static int enumserialports_2 (int cnt)
                                goto end;
                        }
                } else {
-                       DWORD err = GetLastError();
+                       DWORD err = GetLastError ();
                        if (err != ERROR_NO_MORE_ITEMS) {
                                write_log (L"SetupDiEnumDeviceInterfaces failed, err=%d", err);
                                goto end;
@@ -1263,27 +1263,30 @@ int enumserialports (void)
        TCHAR devname[1000];
 
        write_log (L"Serial port enumeration..\n");
+       cnt = 0;
+
+#if 0
+       comports[cnt].dev = my_strdup (L"ENET:H");
+       comports[cnt].cfgname = my_strdup (comports[0].dev);
+       comports[cnt++].name = my_strdup (L"NET (host)");
+       comports[cnt].dev = my_strdup (L"ENET:L");
+       comports[cnt].cfgname = my_strdup (comports[1].dev);
+       comports[cnt++].name = my_strdup (L"NET (client)");
+#endif
 
-       comports[0].dev = my_strdup (L"ENET:H");
-       comports[0].cfgname = my_strdup (comports[0].dev);
-       comports[0].name = my_strdup (L"NET (host)");
-       comports[1].dev = my_strdup (L"ENET:L");
-       comports[1].cfgname = my_strdup (comports[1].dev);
-       comports[1].name = my_strdup (L"NET (client)");
-
-       cnt = enumserialports_2 (2);
+       cnt = enumserialports_2 (cnt);
        for (i = 0; i < 10; i++) {
-               _stprintf(name, L"COM%d", i);
-               if (!QueryDosDevice (name, devname, sizeof devname))
+               _stprintf (name, L"COM%d", i);
+               if (!QueryDosDevice (name, devname, sizeof devname / sizeof (TCHAR)))
                        continue;
                for(j = 0; j < cnt; j++) {
-                       if (!_tcscmp(comports[j].cfgname, name))
+                       if (!_tcscmp (comports[j].cfgname, name))
                                break;
                }
                if (j == cnt) {
                        if (cnt >= MAX_SERIAL_PORTS)
                                break;
-                       comports[j].dev = xmalloc (100);
+                       comports[j].dev = xmalloc (100 * sizeof (TCHAR));
                        _stprintf (comports[cnt].dev, L"\\.\\\\%s", name);
                        comports[j].cfgname = my_strdup (name);
                        comports[j].name = my_strdup (name);
diff --git a/od-win32/resources/expansion.ico b/od-win32/resources/expansion.ico
new file mode 100644 (file)
index 0000000..d34395f
Binary files /dev/null and b/od-win32/resources/expansion.ico differ
diff --git a/od-win32/resources/icon3.ico b/od-win32/resources/icon3.ico
new file mode 100644 (file)
index 0000000..f1282c6
Binary files /dev/null and b/od-win32/resources/icon3.ico differ
index 9ad628f7160a50435bf3a49b8755a28c5a91044b..21de335eec5c268ff7527f582e133958eff823c1 100644 (file)
 #define IDS_PRINTER_EPSON               352
 #define IDS_PRINTER_EPSON9              352
 #define IDS_PRINTER_POSTSCRIPT_DETECTION 353
+#define IDI_ICON4                       353
+#define IDI_EXPANSION                   353
 #define IDS_PRINTER_POSTSCRIPT_EMULATION 354
 #define IDS_PRINTER_PASSTHROUGH         355
 #define IDS_RES_LORES                   356
 #define IDS_RES_HIRES                   357
 #define IDS_RES_SUPERHIRES              358
-#define IDS_PRIRNTER_EPSON48            359
 #define IDS_PRINTER_EPSON48             359
 #define IDS_QS_MODELS                   1000
 #define IDS_QS_MODEL_A500               1001
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_NO_MFC                     1
 #define _APS_3D_CONTROLS                     1
-#define _APS_NEXT_RESOURCE_VALUE        352
+#define _APS_NEXT_RESOURCE_VALUE        354
 #define _APS_NEXT_COMMAND_VALUE         40045
 #define _APS_NEXT_CONTROL_VALUE         1793
 #define _APS_NEXT_SYMED_VALUE           101
index c165ac541539adf29a2ff55fa8e06acfb218af00..2547f026bf0b4f04416fb7c56e7d1e5fe5341fbf 100644 (file)
Binary files a/od-win32/resources/screen.ico and b/od-win32/resources/screen.ico differ
index 013e317c4e21c61ed5776eb79d0810598d39345f..98cc8aaeb829bab18dc1d5fa6ea5eb1bb43b144b 100644 (file)
 // English (Neutral) resources\r
 \r
 #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r
+#ifdef _WIN32\r
 LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL\r
 #pragma code_page(1252)\r
+#endif //_WIN32\r
 \r
 /////////////////////////////////////////////////////////////////////////////\r
 //\r
@@ -50,13 +52,14 @@ IDI_DISKIMAGE           ICON                    "diskimage.ico"
 IDI_PORTS               ICON                    "port.ico"\r
 IDI_CONFIGFILE          ICON                    "configfile.ico"\r
 IDI_FILE                ICON                    "file.ico"\r
+IDI_EXPANSION           ICON                    "expansion.ico"\r
 \r
 /////////////////////////////////////////////////////////////////////////////\r
 //\r
 // Accelerator\r
 //\r
 \r
-IDR_DBGACCEL ACCELERATORS\r
+IDR_DBGACCEL ACCELERATORS \r
 BEGIN\r
     VK_F1,          ID_DBG_PAGE1,           VIRTKEY, NOINVERT\r
     VK_F2,          ID_DBG_PAGE2,           VIRTKEY, NOINVERT\r
@@ -982,13 +985,17 @@ BEGIN
     RTEXT           "Aspect ratio:",IDC_STATIC,153,102,52,10,SS_CENTERIMAGE\r
     RTEXT           "Refresh rate:",IDC_STATIC,22,103,51,10,SS_CENTERIMAGE\r
     COMBOBOX        IDC_RTG_VBLANKRATE,77,101,68,150,CBS_DROPDOWN | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    CONTROL         "bsdsocket.library",IDC_SOCKETS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,142,148,120,10\r
-    CONTROL         "uaenet.device",IDC_SANA2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,142,160,77,10\r
-    CONTROL         "A2065 Z2",IDC_A2065,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,233,160,57,10\r
+    CONTROL         "bsdsocket.library [] bsdsocket network library emulation.",IDC_SOCKETS,\r
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,142,148,120,10\r
+    CONTROL         "uaenet.device [] Sana 2 compatible network device emulation. WinPcap required.",IDC_SANA2,\r
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,142,160,77,10\r
+    CONTROL         "A2065 Z2 [] A2065 Ethernet Zorro II card emulation. WinPcap required.",IDC_A2065,\r
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,233,160,57,10\r
     GROUPBOX        "Network",IDC_STATIC,126,130,169,66\r
     COMBOBOX        IDC_NETDEVICE,132,176,156,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
     CONTROL         "uaescsi.device",IDC_SCSIDEVICE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,160,102,10\r
-    CONTROL         "Catweasel Z2 emulation",IDC_CATWEASEL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,148,101,10\r
+    CONTROL         "Catweasel Z2 emulation [] Catweasel MK2 Zorro II card emulation. Physical Windows compatible Catweasel card and drivers required.",IDC_CATWEASEL,\r
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,148,101,10\r
     GROUPBOX        "Miscellaneous Expansions",IDC_STATIC,5,130,117,66\r
 END\r
 \r
@@ -1043,7 +1050,7 @@ IDC_MYHAND              CURSOR                  "H_arrow.cur"
 // Menu\r
 //\r
 \r
-IDM_SYSTRAY MENU\r
+IDM_SYSTRAY MENU \r
 BEGIN\r
     POPUP "Menu"\r
     BEGIN\r
@@ -1062,7 +1069,7 @@ BEGIN
     END\r
 END\r
 \r
-IDM_DBGCONTEXTMENU MENU\r
+IDM_DBGCONTEXTMENU MENU \r
 BEGIN\r
     POPUP "Inactive"\r
     BEGIN\r
@@ -1138,12 +1145,8 @@ IDB_LCD160X43           BITMAP                  "lcd.bmp"
 //\r
 \r
 #ifdef APSTUDIO_INVOKED\r
-GUIDELINES DESIGNINFO\r
+GUIDELINES DESIGNINFO \r
 BEGIN\r
-    IDD_CPU, DIALOG\r
-    BEGIN\r
-    END\r
-\r
     IDD_FILTER, DIALOG\r
     BEGIN\r
         BOTTOMMARGIN, 237\r
@@ -1157,7 +1160,7 @@ END
 // String Table\r
 //\r
 \r
-STRINGTABLE\r
+STRINGTABLE \r
 BEGIN\r
     IDS_KICKSTART           "ROM"\r
     IDS_DISK                "Disk swapper"\r
@@ -1176,7 +1179,7 @@ BEGIN
     IDS_FILTER              "Filter"\r
 END\r
 \r
-STRINGTABLE\r
+STRINGTABLE \r
 BEGIN\r
     IDS_MISC2               "Pri. & Extensions"\r
     IDS_PATHS               "Paths"\r
@@ -1187,7 +1190,7 @@ BEGIN
     IDS_EXPANSION           "Expansions"\r
 END\r
 \r
-STRINGTABLE\r
+STRINGTABLE \r
 BEGIN\r
     IDS_EXTTEXT             "Floppy disk image files"\r
     IDS_EXTACTUAL           "ADF"\r
@@ -1203,7 +1206,7 @@ BEGIN
     IDS_EIGHTH              "eighth "\r
 END\r
 \r
-STRINGTABLE\r
+STRINGTABLE \r
 BEGIN\r
     IDS_NINTH               "ninth "\r
     IDS_TENTH               "tenth "\r
@@ -1223,7 +1226,7 @@ BEGIN
     IDS_VOLUME              "Volume"\r
 END\r
 \r
-STRINGTABLE\r
+STRINGTABLE \r
 BEGIN\r
     IDS_SELECTFILESYSROOT   "Please select the root directory of the file system..."\r
     IDS_DEFAULTMIDIOUT      "Default MIDI-Out Device"\r
@@ -1242,7 +1245,7 @@ BEGIN
     IDS_MIDIOVERFLOW        "Sysexbuffer overflow. Should not happen. Please report this to\nberndroesch1@compuserve.de"\r
 END\r
 \r
-STRINGTABLE\r
+STRINGTABLE \r
 BEGIN\r
     IDS_PATH                "Path"\r
     IDS_RW                  "R/W"\r
@@ -1258,7 +1261,7 @@ BEGIN
     IDS_INVALIDCOMPORT      "The serial port you have in this configuration is not valid on this machine.\n"\r
 END\r
 \r
-STRINGTABLE\r
+STRINGTABLE \r
 BEGIN\r
     IDS_HFDSIZE             "Size"\r
     IDS_DEVICE              "Device"\r
@@ -1277,7 +1280,7 @@ BEGIN
     IDS_DEFAULT_WINUAE      "WinUAE default (old)"\r
 END\r
 \r
-STRINGTABLE\r
+STRINGTABLE \r
 BEGIN\r
     IDS_SOUND_STEREO2       "Cloned Stereo (4 Channels)"\r
     IDS_INPUT_CUSTOMEVENT   "<Custom event>"\r
@@ -1290,7 +1293,7 @@ BEGIN
     IDS_NETDISCONNECTED     "Cable disconnected"\r
 END\r
 \r
-STRINGTABLE\r
+STRINGTABLE \r
 BEGIN\r
     IDS_UNSUPPORTEDPIXELFORMAT \r
                             "Error: unsupported pixel format. Please use a different screen mode.\n"\r
@@ -1309,7 +1312,7 @@ BEGIN
     IDS_ERRORTITLE          "WinUAE message"\r
 END\r
 \r
-STRINGTABLE\r
+STRINGTABLE \r
 BEGIN\r
     IDS_INP                 "WinUAE Input Recording"\r
     IDS_RESTOREINP          "Playback a WinUAE input recording"\r
@@ -1327,7 +1330,7 @@ BEGIN
     IDS_SOUND_FILTER_EMULATED "Emulated (A500)"\r
 END\r
 \r
-STRINGTABLE\r
+STRINGTABLE \r
 BEGIN\r
     IDS_SOUND_FILTER_EMULATED_E "Emulated (A1200)"\r
     IDS_INPUT_COMPATIBILITY "Compatibility mode"\r
@@ -1349,7 +1352,7 @@ BEGIN
                             "the desktop is running in an unknown color mode."\r
 END\r
 \r
-STRINGTABLE\r
+STRINGTABLE \r
 BEGIN\r
     IDS_UNSUPPORTEDSCREENMODE_2 \r
                             "the desktop is running in 8-bit color depth, which WinUAE can't use in windowed mode."\r
@@ -1372,7 +1375,7 @@ BEGIN
     IDS_TREEVIEW_ABOUT      "About"\r
 END\r
 \r
-STRINGTABLE\r
+STRINGTABLE \r
 BEGIN\r
     IDS_NOHARDDRIVES        "No hard disks detected that were either empty or RDB-partitioned."\r
     IDS_DEFAULT_HOST        "Default Configuration"\r
@@ -1392,7 +1395,7 @@ BEGIN
     IDS_FLOPPYTYPE35DDESCOM "3.5"" ESCOM"\r
 END\r
 \r
-STRINGTABLE\r
+STRINGTABLE \r
 BEGIN\r
     IDS_NUMSG_NEEDEXT2      "The software uses a non-standard floppy disk format. You may need to use a custom floppy disk image file instead of a standard one. This message will not appear again."\r
     IDS_NUMSG_NOROMKEY      "Could not find system ROM key file."\r
@@ -1400,7 +1403,7 @@ BEGIN
     IDS_NUMSG_KSROMREADERROR "Error while reading system ROM."\r
 END\r
 \r
-STRINGTABLE\r
+STRINGTABLE \r
 BEGIN\r
     IDS_NUMSG_NOEXTROM      "No extended ROM found."\r
     IDS_NUMSG_MODRIP_NOTFOUND "No music modules or packed data found."\r
@@ -1420,7 +1423,7 @@ BEGIN
     IDS_ROMSCANEND          "Scan of ROMs finished"\r
 END\r
 \r
-STRINGTABLE\r
+STRINGTABLE \r
 BEGIN\r
     IDS_ROM_AVAILABLE       "available"\r
     IDS_ROM_UNAVAILABLE     "unavailable"\r
@@ -1437,7 +1440,7 @@ BEGIN
     IDS_SB_CUSTOMEVENT      "Enter custom event string.."\r
 END\r
 \r
-STRINGTABLE\r
+STRINGTABLE \r
 BEGIN\r
     IDS_QS_MODELS           "A500\nA500+\nA600\nA1000\nA1200\nA3000\nA4000\nCD32\nCDTV\nArcadia Multi Select system\nExpanded WinUAE example configuration"\r
     IDS_QS_MODEL_A500       "1.3 ROM, OCS, 512 KB Chip + 512 KB Slow RAM (most common)\nThis configuration is capable of running most games and demos produced for first-generation hardware. Only few exceptions need a different configuration (e.g. the oldest games tend to be incompatible with this configuration).\n1.3 ROM, ECS Agnus, 512 KB Chip RAM + 512 KB Slow RAM\nLater hardware revision of the A500. Nearly 100% compatible with the previous configuration.\n1.3 ROM, ECS Agnus, 1 MB Chip RAM\nFew newer games and demos require this configuration.\n1.3 ROM, OCS Agnus, 512 KB Chip RAM\nVery old (e.g. pre-1988) games and demos may require this configuration.\n1.2 ROM, OCS Agnus, 512 KB Chip RAM\nAs available for the A1000, and installed on the first A500 and A2000 series. Some very old programs only work correctly with this configuration. Note: This system ROM version can only boot from floppy disk (no hard disk boot support).\n1.2 ROM, OCS Agnus, 512 KB Chip RAM + 512 KB Slow RAM\nThis configuration adds expansion memory to the first A500 produced. Try this if your game does not work with newer configurations, but works with the previous one. It could add some features to the game, including faster loading times. Note: This system ROM version can only boot from floppy disk (no hard disk boot support)."\r
@@ -1449,7 +1452,7 @@ BEGIN
     IDS_QS_MODEL_CDTV       "CDTV\nThe CDTV was the first model with a built-in CD-ROM drive. Looking like a black CD player, it featured a configuration equivalent to that of an A500 with 1 MB RAM and an ECS chipset.\nFloppy drive and 64KB SRAM card expanded CDTV\n"\r
 END\r
 \r
-STRINGTABLE\r
+STRINGTABLE \r
 BEGIN\r
     IDS_QS_MODEL_UAE        "High-end expanded configuration"\r
     IDS_QS_MODEL_ARCADIA    "Arcadia\nArcadia Multi Select system is arcade platform developed by Arcadia and  Mastertronic. It is based on an A500 mainboard with ROM cage attached to expansion port. Arcadia ROM files go to ""Cartridge ROM File"" in ROM-panel."\r
@@ -1458,7 +1461,7 @@ BEGIN
     IDS_QS_MODEL_A4000T     "A4000T (test)\nA4000T"\r
 END\r
 \r
-STRINGTABLE\r
+STRINGTABLE \r
 BEGIN\r
     IDS_FLOPPYTYPE35DDPC    "3.5"" DD (PC)"\r
     IDS_FLOPPYTYPE35HDPC    "3.5"" HD (PC)"\r
@@ -1478,7 +1481,7 @@ BEGIN
     IDS_PRINTER_ASCII       "ASCII-Only"\r
 END\r
 \r
-STRINGTABLE\r
+STRINGTABLE \r
 BEGIN\r
     IDS_PRINTER_EPSON9      "Epson Matrix Printer Emulation, 9pin"\r
     IDS_PRINTER_POSTSCRIPT_DETECTION "PostScript (Passthrough)"\r
@@ -1499,8 +1502,10 @@ END
 // Finnish resources\r
 \r
 #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FIN)\r
+#ifdef _WIN32\r
 LANGUAGE LANG_FINNISH, SUBLANG_DEFAULT\r
 #pragma code_page(1252)\r
+#endif //_WIN32\r
 \r
 #ifdef APSTUDIO_INVOKED\r
 /////////////////////////////////////////////////////////////////////////////\r
index dc094be8449cb5364671ee493a07b2b8066c79c6..b60a1059b2566ebd2b50eda7cc19372f8db776d7 100644 (file)
@@ -61,7 +61,7 @@
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="zlibstat.lib"
+                               AdditionalDependencies="zlibstat.lib wininet.lib"
                                LinkIncremental="2"
                                GenerateDebugInformation="true"
                                SubSystem="1"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="zlibstat.lib"
+                               AdditionalDependencies="zlibstat.lib wininet.lib"
                                LinkIncremental="1"
+                               DelayLoadDLLs="wininet.dll"
                                GenerateDebugInformation="true"
                                SubSystem="1"
                                OptimizeReferences="2"
index ae274a131cbdf2b0ead988fa84ab8070574c52f2..160ba9c63e348ccda93766d55840d91ceef49e28 100644 (file)
       <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
     </ClCompile>
     <Link>
-      <AdditionalDependencies>zlibstat.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>zlibstat.lib;wininet.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <SubSystem>Console</SubSystem>
       <RandomizedBaseAddress>false</RandomizedBaseAddress>
       <TargetMachine>MachineX86</TargetMachine>
+      <DelayLoadDLLs>wininet.dll</DelayLoadDLLs>
     </Link>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
       <CompileAs>CompileAsC</CompileAs>
     </ClCompile>
     <Link>
-      <AdditionalDependencies>zlibstat.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>zlibstat.lib;wininet.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <SubSystem>Console</SubSystem>
       <OptimizeReferences>true</OptimizeReferences>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <TargetMachine>MachineX86</TargetMachine>
+      <DelayLoadDLLs>wininet.dll</DelayLoadDLLs>
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
index ca7d7aad2a7ec380ea6373b61b35016a319031db..52bbebd7ada754c3581decb31efb0c3b11b06ae2 100644 (file)
@@ -17,8 +17,8 @@
 
 #define WINUAEPUBLICBETA 1
 
-#define WINUAEBETA L"19"
-#define WINUAEDATE MAKEBD(2009, 10, 31)
+#define WINUAEBETA L"20"
+#define WINUAEDATE MAKEBD(2009, 11, 7)
 #define WINUAEEXTRA L""
 #define WINUAEREV L""
 
index f90023346b303f2153644f8555ee64de45cd849a..443395b4fd34c5b9d7274519c76ec2bd0de8658e 100644 (file)
@@ -12475,7 +12475,7 @@ static int GetSettings (int all_options, HWND hwnd)
                panelresource = getresource (IDD_PANEL);
                LOADSAVE_ID = init_page (IDD_LOADSAVE, IDI_FILE, IDS_LOADSAVE, LoadSaveDlgProc, NULL, L"gui/configurations.htm");
                MEMORY_ID = init_page (IDD_MEMORY, IDI_MEMORY, IDS_MEMORY, MemoryDlgProc, NULL, L"gui/ram.htm");
-               EXPANSION_ID = init_page (IDD_EXPANSION, IDI_DISPLAY, IDS_EXPANSION, ExpansionDlgProc, NULL, L"gui/expansion.htm");
+               EXPANSION_ID = init_page (IDD_EXPANSION, IDI_EXPANSION, IDS_EXPANSION, ExpansionDlgProc, NULL, L"gui/expansion.htm");
                KICKSTART_ID = init_page (IDD_KICKSTART, IDI_MEMORY, IDS_KICKSTART, KickstartDlgProc, NULL, L"gui/rom.htm");
                CPU_ID = init_page (IDD_CPU, IDI_CPU, IDS_CPU, CPUDlgProc, NULL, L"gui/cpu.htm");
                DISPLAY_ID = init_page (IDD_DISPLAY, IDI_DISPLAY, IDS_DISPLAY, DisplayDlgProc, NULL, L"gui/display.htm");
index f259a75558d6a01a97d0ecbc359e64aacdc40f81..258ed5c584eaa3925eef8558066fab0f5cced12b 100644 (file)
@@ -87,7 +87,7 @@
                        <Tool
                                Name="VCLinkerTool"
                                AdditionalOptions="/MACHINE:I386"
-                               AdditionalDependencies="ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib dxerr.lib shlwapi.lib zlibstat.lib libpng.lib lglcd.lib wpcap.lib packet.lib openal32.lib wintab32.lib portaudio_x86.lib freetype.lib vfw32.lib wtsapi32.lib avrt.lib"
+                               AdditionalDependencies="ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib dxerr.lib shlwapi.lib zlibstat.lib libpng.lib lglcd.lib wpcap.lib packet.lib openal32.lib wintab32.lib portaudio_x86.lib freetype.lib vfw32.lib wtsapi32.lib avrt.lib wininet.lib"
                                ShowProgress="0"
                                OutputFile="d:\amiga\winuae.exe"
                                LinkIncremental="2"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib dxerr.lib shlwapi.lib zlibstat.lib libpng.lib lglcd.lib wpcap.lib packet.lib openal32.lib wintab32.lib portaudio_x86.lib freetype.lib vfw32.lib wtsapi32.lib avrt.lib"
+                               AdditionalDependencies="ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib dxerr.lib shlwapi.lib zlibstat.lib libpng.lib lglcd.lib wpcap.lib packet.lib openal32.lib wintab32.lib portaudio_x86.lib freetype.lib vfw32.lib wtsapi32.lib avrt.lib wininet.lib"
                                OutputFile="d:\amiga\winuae.exe"
                                LinkIncremental="1"
                                SuppressStartupBanner="true"
                                AdditionalLibraryDirectories=""
                                GenerateManifest="true"
                                AdditionalManifestDependencies=""
-                               DelayLoadDLLs="wpcap.dll;packet.dll;d3dx9_42.dll;openal32.dll;wintab32.dll;portaudio_x86.dll;freetype6.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;avrt.dll"
+                               DelayLoadDLLs="wpcap.dll;packet.dll;d3dx9_42.dll;openal32.dll;wintab32.dll;portaudio_x86.dll;freetype6.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;avrt.dll;wininet.dll"
                                GenerateDebugInformation="true"
                                ProgramDatabaseFile=".\Release/winuae.pdb"
                                SubSystem="2"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib dxerr.lib shlwapi.lib zlibstat.lib libpng.lib lglcd.lib wpcap.lib packet.lib openal32.lib wintab32.lib portaudio_x86.lib freetype.lib vfw32.lib wtsapi32.lib avrt.lib"
+                               AdditionalDependencies="ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib dxerr.lib shlwapi.lib zlibstat.lib libpng.lib lglcd.lib wpcap.lib packet.lib openal32.lib wintab32.lib portaudio_x86.lib freetype.lib vfw32.lib wtsapi32.lib avrt.lib wininet.lib"
                                OutputFile="d:\amiga\winuae.exe"
                                LinkIncremental="1"
                                SuppressStartupBanner="true"
                                AdditionalLibraryDirectories=""
                                GenerateManifest="true"
                                AdditionalManifestDependencies=""
-                               DelayLoadDLLs="wpcap.dll;packet.dll;d3dx9_42.dll;openal32.dll;wintab32.dll;portaudio_x86.dll;freetype6.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;avrt.dll"
+                               DelayLoadDLLs="wpcap.dll;packet.dll;d3dx9_42.dll;openal32.dll;wintab32.dll;portaudio_x86.dll;freetype6.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;avrt.dll;wininet.dll"
                                GenerateDebugInformation="true"
                                ProgramDatabaseFile=".\FullRelease/winuae.pdb"
                                SubSystem="2"
                                        >
                                </File>
                                <File
-                                       RelativePath=".\configfile.ico"
+                                       RelativePath="..\resources\configfile.ico"
                                        >
                                </File>
                                <File
-                                       RelativePath="..\resources\configfile.ico"
+                                       RelativePath=".\configfile.ico"
                                        >
                                </File>
                                <File
                                        >
                                </File>
                                <File
-                                       RelativePath="..\resources\diskimage.ico"
+                                       RelativePath=".\diskimage.ico"
                                        >
                                </File>
                                <File
-                                       RelativePath=".\diskimage.ico"
+                                       RelativePath="..\resources\diskimage.ico"
                                        >
                                </File>
                                <File
                                        >
                                </File>
                                <File
-                                       RelativePath=".\file.ico"
+                                       RelativePath="..\resources\expansion.ico"
+                                       >
+                               </File>
+                               <File
+                                       RelativePath=".\expansion.ico"
                                        >
                                </File>
                                <File
                                        RelativePath="..\resources\file.ico"
                                        >
                                </File>
+                               <File
+                                       RelativePath=".\file.ico"
+                                       >
+                               </File>
                                <File
                                        RelativePath="..\resources\folder.ico"
                                        >
index bbccce010ca93f9c01ec626ab95f9276d8a5197f..fc63efa5a682d8c8b2739bcee2a031042238ceac 100644 (file)
@@ -1,4 +1,15 @@
 
+Beta 20:
+
+- 68000 CE timing updates
+- expansion panel GUI tree icon added
+- serial port detection didn't detect all ports (broke in 1.6.0)
+- http://, https:// and ftp:// file paths supported (pointless but it
+  was very easy to implement, do not ask for extra improvements)
+- dms, ipf and some other disk image types didn't unpack if inside
+  archive, truncate adf converted >80 cylinder images to 80 if all 81+
+  tracks are empty (uaeunp)
+
 Beta 19:
 
 - do not "fix" \\'s at start of path (b14)
index 0c3b69f11cbd7e55dfd31ae961e95d948985cb97..e5fea759bc4ba5eeebe44f86d1f0be729e9db911 100644 (file)
--- a/uaeunp.c
+++ b/uaeunp.c
@@ -21,15 +21,15 @@ static int amigatest;
 #define WRITE_LOG_BUF_SIZE 4096
 void write_log (const TCHAR *format, ...)
 {
-    int count;
-    TCHAR buffer[WRITE_LOG_BUF_SIZE];
-    va_list parms;
-    va_start (parms, format);
-    if (debug) {
-       count = _vsntprintf (buffer, WRITE_LOG_BUF_SIZE - 1, format, parms);
-       _tprintf (buffer);
-    }
-    va_end (parms);
+       int count;
+       TCHAR buffer[WRITE_LOG_BUF_SIZE];
+       va_list parms;
+       va_start (parms, format);
+       if (debug) {
+               count = _vsntprintf (buffer, WRITE_LOG_BUF_SIZE - 1, format, parms);
+               _tprintf (buffer);
+       }
+       va_end (parms);
 }
 
 void gui_message (const TCHAR *format, ...)
@@ -38,62 +38,62 @@ void gui_message (const TCHAR *format, ...)
 
 int uaerand (void)
 {
-    return rand ();
+       return rand ();
 }
 
 static int pattern_match (const TCHAR *str, const TCHAR *pattern)
 {
-    enum State {
-        Exact,        // exact match
-        Any,        // ?
-        AnyRepeat    // *
-    };
-
-    const TCHAR *s = str;
-    const TCHAR *p = pattern;
-    const TCHAR *q = 0;
-    int state = 0;
-
-    int match = TRUE;
-    while (match && *p) {
-        if (*p == '*') {
-            state = AnyRepeat;
-            q = p+1;
-        } else if (*p == '?') state = Any;
-        else state = Exact;
-
-        if (*s == 0) break;
-
-        switch (state) {
-            case Exact:
-                match = *s == *p;
-                s++;
-                p++;
-                break;
-
-            case Any:
-                match = TRUE;
-                s++;
-                p++;
-                break;
-
-            case AnyRepeat:
-                match = TRUE;
-                s++;
-
-               if (*s == *q){
-                   // make a recursive call so we don't match on just a single character
-                   if (pattern_match(s,q) == TRUE) {
+       enum State {
+               Exact,        // exact match
+               Any,        // ?
+               AnyRepeat    // *
+       };
+
+       const TCHAR *s = str;
+       const TCHAR *p = pattern;
+       const TCHAR *q = 0;
+       int state = 0;
+
+       int match = TRUE;
+       while (match && *p) {
+               if (*p == '*') {
+                       state = AnyRepeat;
+                       q = p+1;
+               } else if (*p == '?') state = Any;
+               else state = Exact;
+
+               if (*s == 0) break;
+
+               switch (state) {
+               case Exact:
+                       match = *s == *p;
+                       s++;
+                       p++;
+                       break;
+
+               case Any:
+                       match = TRUE;
+                       s++;
                        p++;
-                   }
+                       break;
+
+               case AnyRepeat:
+                       match = TRUE;
+                       s++;
+
+                       if (*s == *q){
+                               // make a recursive call so we don't match on just a single character
+                               if (pattern_match(s,q) == TRUE) {
+                                       p++;
+                               }
+                       }
+                       break;
                }
-                break;
-        }
-    }
+       }
 
-    if (state == AnyRepeat) return (*s == *q);
-    else if (state == Any) return (*s == *p);
-    else return match && (*s == *p);
+       if (state == AnyRepeat) return (*s == *q);
+       else if (state == Any) return (*s == *p);
+       else return match && (*s == *p);
 } 
 
 
@@ -101,90 +101,90 @@ static int pattern_match (const TCHAR *str, const TCHAR *pattern)
 
 static void geterror (void)
 {
-    TCHAR *err = zfile_geterror();
-    if (!err)
-       return;
-    _tprintf (L"%s\n", err);
+       TCHAR *err = zfile_geterror ();
+       if (!err)
+               return;
+       _tprintf (L"%s\n", err);
 }
 
 static const TCHAR *prots = L"HSPARWED";
 
 struct arcdir {
-    TCHAR *name;
-    int isdir;
-    uae_u32 flags;
-    uae_u64 size;
-    TCHAR *comment;
-    uae_u32 crc32;
-    int iscrc;
-    __time64_t dt;
-    int parent, nextlevel;
+       TCHAR *name;
+       int isdir;
+       uae_u32 flags;
+       uae_u64 size;
+       TCHAR *comment;
+       uae_u32 crc32;
+       int iscrc;
+       __time64_t dt;
+       int parent, nextlevel;
 };
 
 static struct arcdir **filelist;
 
 static void dolist (struct arcdir **filelist, struct arcdir *adp, int entries, int parent, int level)
 {
-    int ii, i;
-
-    for (ii = 0; ii < 2; ii++) {
-       for (i = 0; i < entries; i++) {
-           struct arcdir *ad = filelist[i];
-           int j;
-           TCHAR protflags[9];
-           TCHAR dates[32];
-           TCHAR crcs[16];
-           int flags;
-           struct tm *dt;
-
-           if (ad->parent != parent)
-               continue;
-
-           if ((ii == 0 && ad->isdir) || (ii == 1 && !ad->isdir)) {
-
-               flags = ad->flags;
-
-               if (flags >= 0) {
-                   for (j = 0; j < 8; j++) {
-                       protflags[j] = '-';
-                       if (flags & (1 << (7 - j)))
-                           protflags[j] = prots[j];
-                   }
-                   protflags[j] = 0;
-               } else {
-                   _tcscpy (protflags, L"--------");
-               }
-
-               if (ad->dt > 0) {
-                   dt = _gmtime64 (&ad->dt);
-                   _tcsftime (dates, sizeof (dates) / sizeof (TCHAR), L"%Y/%m/%d %H:%M:%S", dt);
-               } else {
-                   _tcscpy (dates, L"-------------------");
-               }
+       int ii, i;
+
+       for (ii = 0; ii < 2; ii++) {
+               for (i = 0; i < entries; i++) {
+                       struct arcdir *ad = filelist[i];
+                       int j;
+                       TCHAR protflags[9];
+                       TCHAR dates[32];
+                       TCHAR crcs[16];
+                       int flags;
+                       struct tm *dt;
+
+                       if (ad->parent != parent)
+                               continue;
+
+                       if ((ii == 0 && ad->isdir) || (ii == 1 && !ad->isdir)) {
+
+                               flags = ad->flags;
+
+                               if (flags >= 0) {
+                                       for (j = 0; j < 8; j++) {
+                                               protflags[j] = '-';
+                                               if (flags & (1 << (7 - j)))
+                                                       protflags[j] = prots[j];
+                                       }
+                                       protflags[j] = 0;
+                               } else {
+                                       _tcscpy (protflags, L"--------");
+                               }
+
+                               if (ad->dt > 0) {
+                                       dt = _gmtime64 (&ad->dt);
+                                       _tcsftime (dates, sizeof (dates) / sizeof (TCHAR), L"%Y/%m/%d %H:%M:%S", dt);
+                               } else {
+                                       _tcscpy (dates, L"-------------------");
+                               }
+
+                               for (j = 0; j < level; j++)
+                                       _tprintf (L" ");
+                               if (ad->iscrc)
+                                       _stprintf (crcs, L"%08X", ad->crc32);
+                               else
+                                       _tcscpy (crcs, L"--------");
+                               if (ad->isdir > 0)
+                                       _tprintf (L"     [DIR] %s %s          %s\n", protflags, dates, ad->name);
+                               else if (ad->isdir < 0)
+                                       _tprintf (L"    [VDIR] %s %s          %s\n", protflags, dates, ad->name);
+                               else
+                                       _tprintf (L"%10I64d %s %s %s %s\n", ad->size, protflags, dates, crcs, ad->name);
+                               if (ad->comment)
+                                       _tprintf (L" \"%s\"\n", ad->comment);
+                               if (ad->nextlevel >= 0) {
+                                       level++;
+                                       dolist (filelist, adp, entries, ad - adp, level);
+                                       level--;
+                               }
 
-               for (j = 0; j < level; j++)
-                   _tprintf (L" ");
-               if (ad->iscrc)
-                   _stprintf (crcs, L"%08X", ad->crc32);
-               else
-                   _tcscpy (crcs, L"--------");
-               if (ad->isdir > 0)
-                   _tprintf (L"     [DIR] %s %s          %s\n", protflags, dates, ad->name);
-               else if (ad->isdir < 0)
-                   _tprintf (L"    [VDIR] %s %s          %s\n", protflags, dates, ad->name);
-               else
-                   _tprintf (L"%10I64d %s %s %s %s\n", ad->size, protflags, dates, crcs, ad->name);
-               if (ad->comment)
-                   _tprintf (L" \"%s\"\n", ad->comment);
-               if (ad->nextlevel >= 0) {
-                   level++;
-                   dolist (filelist, adp, entries, ad - adp, level);
-                   level--;
+                       }
                }
-
-           }
        }
-    }
 }
 
 static int parentid = -1, subdirid;
@@ -192,554 +192,555 @@ static int maxentries = 10000, entries;
 
 static void resetlist (void)
 {
-    parentid = -1;
-    subdirid = 0;
-    maxentries = 10000;
-    entries = 0;
+       parentid = -1;
+       subdirid = 0;
+       maxentries = 10000;
+       entries = 0;
 }
 
 static int unlist2 (struct arcdir *adp, const TCHAR *src, int all)
 {
-    struct zvolume *zv;
-    void *h;
-    int i;
-    TCHAR p[MAX_DPATH];
-    TCHAR fn[MAX_DPATH];
-    struct arcdir *ad;
-   
-    zv = zfile_fopen_archive_root (src);
-    if (zv == NULL) {
-       geterror();
-       _tprintf (L"Couldn't open archive '%s'\n", src);
-       return 0;
-    }
-    h = zfile_opendir_archive (src);
-    if (!h) {
-       _tcscpy (p, src);
-       _tcscat (p, L".DIR");
+       struct zvolume *zv;
+       void *h;
+       int i;
+       TCHAR p[MAX_DPATH];
+       TCHAR fn[MAX_DPATH];
+       struct arcdir *ad;
+
+       zv = zfile_fopen_archive_root (src);
+       if (zv == NULL) {
+               geterror();
+               _tprintf (L"Couldn't open archive '%s'\n", src);
+               return 0;
+       }
        h = zfile_opendir_archive (src);
        if (!h) {
-           geterror();
-           _tprintf (L"Couldn't open directory '%s'\n", src);
-           return 0;
+               _tcscpy (p, src);
+               _tcscat (p, L".DIR");
+               h = zfile_opendir_archive (src);
+               if (!h) {
+                       geterror();
+                       _tprintf (L"Couldn't open directory '%s'\n", src);
+                       return 0;
+               }
        }
-    }
 
-    while (zfile_readdir_archive (h, fn)) {
-        struct _stat64 st; 
-        int isdir;
-       uae_u32 flags;
-        TCHAR *comment;
-       struct zfile *zf;
-       uae_u32 crc32 = 0;
-       int iscrc = 0;
-       int nextdir = -1;
-
-        _tcscpy (p, src);
-        _tcscat (p, sep);
-        _tcscat (p, fn);
-       if (!zfile_stat_archive (p, &st)) {
-           st.st_size = -1;
-           st.st_mtime = 0;
-       }
-       isdir = 0;
-       flags = 0;
-       comment = 0;
-       zfile_fill_file_attrs_archive (p, &isdir, &flags, &comment);
-       flags ^= 15;
-       if (!isdir && st.st_size < 1024 * 1024 * 2 && st.st_size > 0) {
-           zf = zfile_open_archive (p, 0);
-           if (zf) {
-               crc32 = zfile_crc32 (zf);
-               iscrc = 1;
-           }
-       }
+       while (zfile_readdir_archive (h, fn)) {
+               struct _stat64 st; 
+               int isdir;
+               uae_u32 flags;
+               TCHAR *comment;
+               struct zfile *zf;
+               uae_u32 crc32 = 0;
+               int iscrc = 0;
+               int nextdir = -1;
+
+               _tcscpy (p, src);
+               _tcscat (p, sep);
+               _tcscat (p, fn);
+               if (!zfile_stat_archive (p, &st)) {
+                       st.st_size = -1;
+                       st.st_mtime = 0;
+               }
+               isdir = 0;
+               flags = 0;
+               comment = 0;
+               zfile_fill_file_attrs_archive (p, &isdir, &flags, &comment);
+               flags ^= 15;
+               if (!isdir && st.st_size < 1024 * 1024 * 2 && st.st_size > 0) {
+                       zf = zfile_open_archive (p, 0);
+                       if (zf) {
+                               crc32 = zfile_crc32 (zf);
+                               iscrc = 1;
+                       }
+               }
 
-        ad = &adp[entries++];
-       ad->isdir = isdir;
-       ad->comment = comment;
-       ad->flags = flags;
-       ad->name = my_strdup (fn);
-       ad->size = st.st_size;
-       ad->dt = st.st_mtime;
-       ad->parent = parentid;
-       ad->crc32 = crc32;
-       ad->iscrc = iscrc;
-
-       if (isdir && all) {
-           int oldparent = parentid;
-           parentid = ad - adp;
-           nextdir = parentid + 1;
-           unlist2 (adp, p, all);
-           parentid = oldparent;
-       }
+               ad = &adp[entries++];
+               ad->isdir = isdir;
+               ad->comment = comment;
+               ad->flags = flags;
+               ad->name = my_strdup (fn);
+               ad->size = st.st_size;
+               ad->dt = st.st_mtime;
+               ad->parent = parentid;
+               ad->crc32 = crc32;
+               ad->iscrc = iscrc;
+
+               if (isdir && all) {
+                       int oldparent = parentid;
+                       parentid = ad - adp;
+                       nextdir = parentid + 1;
+                       unlist2 (adp, p, all);
+                       parentid = oldparent;
+               }
 
-       ad->nextlevel = nextdir;
+               ad->nextlevel = nextdir;
 
-       if (entries >= maxentries)
-           break;
-    }
-    if (parentid >= 0)
-       return 1;
+               if (entries >= maxentries)
+                       break;
+       }
+       if (parentid >= 0)
+               return 1;
+
+       filelist = xmalloc (entries * sizeof (struct arcdir*));
+       for (i = 0; i < entries; i++) {
+               filelist[i] = &adp[i];
+       }
 
-    filelist = xmalloc (entries * sizeof (struct arcdir*));
-    for (i = 0; i < entries; i++) {
-       filelist[i] = &adp[i];
-    }
-
-    // bubblesort is the winner!
-    for (i = 0; i < entries; i++) {
-       int j;
-       for (j = i + 1; j < entries; j++) {
-           int diff = _tcsicmp (filelist[i]->name, filelist[j]->name);
-           if (diff > 0) {
-               struct arcdir *tmp;
-               tmp = filelist[i];
-               filelist[i] = filelist[j];
-               filelist[j] = tmp;
-           }
+       // bubblesort is the winner!
+       for (i = 0; i < entries; i++) {
+               int j;
+               for (j = i + 1; j < entries; j++) {
+                       int diff = _tcsicmp (filelist[i]->name, filelist[j]->name);
+                       if (diff > 0) {
+                               struct arcdir *tmp;
+                               tmp = filelist[i];
+                               filelist[i] = filelist[j];
+                               filelist[j] = tmp;
+                       }
+               }
        }
-    }
 
-    dolist (filelist, adp, entries, -1, 0);
-    zfile_closedir_archive (h);
-    zfile_fclose_archive (zv);
-    return 1;
+       dolist (filelist, adp, entries, -1, 0);
+       zfile_closedir_archive (h);
+       zfile_fclose_archive (zv);
+       return 1;
 }
 
 static int unlist (const TCHAR *src, int all)
 {
-    struct arcdir *adp;
-    adp = xcalloc (sizeof (struct arcdir), maxentries);
-    unlist2 (adp, src, all);
-    return 1;
+       struct arcdir *adp;
+       adp = xcalloc (sizeof (struct arcdir), maxentries);
+       unlist2 (adp, src, all);
+       return 1;
 }
 
 static int docrclist (const TCHAR *src)
 {
-    WIN32_FIND_DATA ffd;
-    HANDLE h;
-    TCHAR path[MAX_DPATH];
-    
-    _tcscpy (path, src);
-    _tcscat (path, L"\\*.*");
-    h = FindFirstFile (path, &ffd);
-    while (h) {
-       if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
-           if (!_tcscmp (ffd.cFileName, L".") || !_tcscmp (ffd.cFileName, L".."))
-               goto next;
-           _tcscpy (path, src);
-           _tcscat (path, L"\\");
-           _tcscat (path, ffd.cFileName);
-           docrclist (path);
-       } else {
-           TCHAR path2[MAX_DPATH];
-           _tcscpy (path, src);
-           _tcscat (path, L"\\");
-           _tcscat (path, ffd.cFileName);
-           GetFullPathName (path, MAX_DPATH, path2, NULL);
-           resetlist ();
-           unlist (path2, 1);
-       }
+       WIN32_FIND_DATA ffd;
+       HANDLE h;
+       TCHAR path[MAX_DPATH];
+
+       _tcscpy (path, src);
+       _tcscat (path, L"\\*.*");
+       h = FindFirstFile (path, &ffd);
+       while (h) {
+               if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
+                       if (!_tcscmp (ffd.cFileName, L".") || !_tcscmp (ffd.cFileName, L".."))
+                               goto next;
+                       _tcscpy (path, src);
+                       _tcscat (path, L"\\");
+                       _tcscat (path, ffd.cFileName);
+                       docrclist (path);
+               } else {
+                       TCHAR path2[MAX_DPATH];
+                       _tcscpy (path, src);
+                       _tcscat (path, L"\\");
+                       _tcscat (path, ffd.cFileName);
+                       GetFullPathName (path, MAX_DPATH, path2, NULL);
+                       resetlist ();
+                       unlist (path2, 1);
+               }
 next:
-       if (!FindNextFile (h, &ffd)) {
-           FindClose (h);
-           break;
+               if (!FindNextFile (h, &ffd)) {
+                       FindClose (h);
+                       break;
+               }
        }
-    }
-    return 1;
+       return 1;
 }
 
 static void setdate (const TCHAR *src, __time64_t tm)
 {
-    struct utimbuf ut;
-    if (tm) {
-       ut.actime = ut.modtime = tm;
-       utime (src, &ut);
-    }
+       struct utimbuf ut;
+       if (tm) {
+               ut.actime = ut.modtime = tm;
+               utime (src, &ut);
+       }
 }
 
 static int found;
 
 static int unpack (const TCHAR *src, const TCHAR *filename, const TCHAR *dst, int out, int all, int level)
 {
-    void *h;
-    struct zvolume *zv;
-    int ret;
-    uae_u8 *b;
-    int size;
-    TCHAR fn[MAX_DPATH];
-
-    ret = 0;
-    zv = zfile_fopen_archive_root (src);
-    if (zv == NULL) {
-       geterror();
-       _tprintf (L"Couldn't open archive '%s'\n", src);
-       return 0;
-    }
-    h = zfile_opendir_archive (src);
-    if (!h) {
-       geterror();
-       _tprintf (L"Couldn't open directory '%s'\n", src);
-       return 0;
-    }
-    while (zfile_readdir_archive (h, fn)) {
-       if (all || !_tcsicmp (filename, fn)) {
-           TCHAR tmp[MAX_DPATH];
-           struct zfile *s, *d;
-           struct _stat64 st;
-
-           found = 1;
-           _tcscpy (tmp, src);
-           _tcscat (tmp, sep);
-           _tcscat (tmp, fn);
-           if (!zfile_stat_archive (tmp, &st)) {
-               _tprintf (L"Couldn't stat '%s'\n", tmp);
-               continue;
-           }
-           if (dst == NULL || all)
-               dst = fn;
-           if (st.st_mode) {
-               if (all > 0)
-                   continue;
-               if (all < 0) {
-                   TCHAR oldcur[MAX_DPATH];
-                   my_mkdir (fn);
-                   my_setcurrentdir (fn, oldcur);
-                   unpack (tmp, fn, dst, out, all, 1);
-                   my_setcurrentdir (oldcur, NULL);
-                   setdate (dst, st.st_mtime);
-                   continue;
-               }
-               _tprintf (L"Directory extraction not yet supported\n");
+       void *h;
+       struct zvolume *zv;
+       int ret;
+       uae_u8 *b;
+       int size;
+       TCHAR fn[MAX_DPATH];
+
+       ret = 0;
+       zv = zfile_fopen_archive_root (src);
+       if (zv == NULL) {
+               geterror();
+               _tprintf (L"Couldn't open archive '%s'\n", src);
                return 0;
-           }
-
-           s = zfile_open_archive (tmp, 0);
-           if (!s) {
+       }
+       h = zfile_opendir_archive (src);
+       if (!h) {
                geterror();
-               _tprintf (L"Couldn't open '%s' for reading\n", src);
-               continue;
-           }
-           zfile_fseek (s, 0, SEEK_END);
-           size = zfile_ftell (s);
-           zfile_fseek (s, 0, SEEK_SET);
-           b = xcalloc (size, 1);
-           if (b) {
-               if (zfile_fread (b, size, 1, s) == 1) {
-                   if (out) {
-                       _tprintf (L"\n");
-                       fwrite (b, size, 1, stdout);
-                   } else {
-                       d = zfile_fopen (dst, L"wb", 0);
-                       if (d) {
-                           if (zfile_fwrite (b, size, 1, d) == 1) {
-                               ret = 1;
-                               _tprintf (L"%s extracted, %d bytes\n", dst, size);
-                           }
-                           zfile_fclose (d);
-                           setdate (dst, st.st_mtime);
+               _tprintf (L"Couldn't open directory '%s'\n", src);
+               return 0;
+       }
+       while (zfile_readdir_archive (h, fn)) {
+               if (all || !_tcsicmp (filename, fn)) {
+                       TCHAR tmp[MAX_DPATH];
+                       struct zfile *s, *d;
+                       struct _stat64 st;
+
+                       found = 1;
+                       _tcscpy (tmp, src);
+                       _tcscat (tmp, sep);
+                       _tcscat (tmp, fn);
+                       if (!zfile_stat_archive (tmp, &st)) {
+                               _tprintf (L"Couldn't stat '%s'\n", tmp);
+                               continue;
+                       }
+                       if (dst == NULL || all)
+                               dst = fn;
+                       if (st.st_mode) {
+                               if (all > 0)
+                                       continue;
+                               if (all < 0) {
+                                       TCHAR oldcur[MAX_DPATH];
+                                       my_mkdir (fn);
+                                       my_setcurrentdir (fn, oldcur);
+                                       unpack (tmp, fn, dst, out, all, 1);
+                                       my_setcurrentdir (oldcur, NULL);
+                                       setdate (dst, st.st_mtime);
+                                       continue;
+                               }
+                               _tprintf (L"Directory extraction not yet supported\n");
+                               return 0;
+                       }
+
+                       s = zfile_open_archive (tmp, 0);
+                       if (!s) {
+                               geterror();
+                               _tprintf (L"Couldn't open '%s' for reading\n", src);
+                               continue;
+                       }
+                       zfile_fseek (s, 0, SEEK_END);
+                       size = zfile_ftell (s);
+                       zfile_fseek (s, 0, SEEK_SET);
+                       b = xcalloc (size, 1);
+                       if (b) {
+                               if (zfile_fread (b, size, 1, s) == 1) {
+                                       if (out) {
+                                               _tprintf (L"\n");
+                                               fwrite (b, size, 1, stdout);
+                                       } else {
+                                               d = zfile_fopen (dst, L"wb", 0);
+                                               if (d) {
+                                                       if (zfile_fwrite (b, size, 1, d) == 1) {
+                                                               ret = 1;
+                                                               _tprintf (L"%s extracted, %d bytes\n", dst, size);
+                                                       }
+                                                       zfile_fclose (d);
+                                                       setdate (dst, st.st_mtime);
+                                               }
+                                       }
+                               }
+                               xfree (b);
                        }
-                   }
+                       zfile_fclose (s);
+                       if (!all)
+                               break;
                }
-               xfree (b);
-           }
-           zfile_fclose (s);
-           if (!all)
-               break;
        }
-    }
-    geterror ();
-    if (!found && !level) {
-       _tprintf (L"'%s' not found\n", fn);
-    }
-    return ret;
+       geterror ();
+       if (!found && !level) {
+               _tprintf (L"'%s' not found\n", fn);
+       }
+       return ret;
 }
 
 static int unpack2 (const TCHAR *src, const TCHAR *match, int level)
 {
-    void *h;
-    struct zvolume *zv;
-    int ret;
-    uae_u8 *b;
-    int size;
-    TCHAR fn[MAX_DPATH];
-
-    ret = 0;
-    zv = zfile_fopen_archive_root (src);
-    if (zv == NULL) {
-       geterror();
-       _tprintf (L"Couldn't open archive '%s'\n", src);
-       return 0;
-    }
-    h = zfile_opendir_archive (src);
-    if (!h) {
-       geterror();
-       _tprintf (L"Couldn't open directory '%s'\n", src);
-       return 0;
-    }
-    while (zfile_readdir_archive (h, fn)) {
-        TCHAR tmp[MAX_DPATH];
-        TCHAR *dst;
-       struct zfile *s, *d;
-       int isdir, flags;
-
-       _tcscpy (tmp, src);
-       _tcscat (tmp, sep);
-       _tcscat (tmp, fn);
-       zfile_fill_file_attrs_archive (tmp, &isdir, &flags, NULL);
-       if (isdir) {
-           TCHAR *p = _tcsstr (fn, L".DIR");
-           if (isdir == ZNODE_VDIR && p && _tcslen (p) == 4) {
-               p[0] = 0;
-               if (pattern_match (fn, match))
-                   continue;
-               p[0] = '.';
-           }
-           unpack2 (tmp, match, 1);
-           continue;
+       void *h;
+       struct zvolume *zv;
+       int ret;
+       uae_u8 *b;
+       int size;
+       TCHAR fn[MAX_DPATH];
+
+       ret = 0;
+       zv = zfile_fopen_archive_root (src);
+       if (zv == NULL) {
+               geterror();
+               _tprintf (L"Couldn't open archive '%s'\n", src);
+               return 0;
        }
-       
-       if (pattern_match (fn, match)) {
-           struct _stat64 st;
-
-           if (!zfile_stat_archive (tmp, &st)) {
-               st.st_mtime = -1;
-           }
-           found = 1;
-           dst = fn;
-           s = zfile_open_archive (tmp, 0);
-           if (!s) {
+       h = zfile_opendir_archive (src);
+       if (!h) {
                geterror();
-               _tprintf (L"Couldn't open '%s' for reading\n", tmp);
-               continue;
-           }
-           zfile_fseek (s, 0, SEEK_END); 
-           size = zfile_ftell (s);
-           zfile_fseek (s, 0, SEEK_SET);
-           b = xcalloc (size, 1);
-           if (b) {
-               if (zfile_fread (b, size, 1, s) == 1) {
-                   d = zfile_fopen (dst, L"wb", 0);
-                   if (d) {
-                       if (zfile_fwrite (b, size, 1, d) == 1) {
-                           ret = 1;
-                           _tprintf (L"%s extracted, %d bytes\n", dst, size);
+               _tprintf (L"Couldn't open directory '%s'\n", src);
+               return 0;
+       }
+       while (zfile_readdir_archive (h, fn)) {
+               TCHAR tmp[MAX_DPATH];
+               TCHAR *dst;
+               struct zfile *s, *d;
+               int isdir, flags;
+
+               _tcscpy (tmp, src);
+               _tcscat (tmp, sep);
+               _tcscat (tmp, fn);
+               zfile_fill_file_attrs_archive (tmp, &isdir, &flags, NULL);
+               if (isdir) {
+                       TCHAR *p = _tcsstr (fn, L".DIR");
+                       if (isdir == ZNODE_VDIR && p && _tcslen (p) == 4) {
+                               p[0] = 0;
+                               if (pattern_match (fn, match))
+                                       continue;
+                               p[0] = '.';
+                       }
+                       unpack2 (tmp, match, 1);
+                       continue;
+               }
+
+               if (pattern_match (fn, match)) {
+                       struct _stat64 st;
+
+                       if (!zfile_stat_archive (tmp, &st)) {
+                               st.st_mtime = -1;
+                       }
+                       found = 1;
+                       dst = fn;
+                       s = zfile_open_archive (tmp, 0);
+                       if (!s) {
+                               geterror();
+                               _tprintf (L"Couldn't open '%s' for reading\n", tmp);
+                               continue;
+                       }
+                       zfile_fseek (s, 0, SEEK_END); 
+                       size = zfile_ftell (s);
+                       zfile_fseek (s, 0, SEEK_SET);
+                       b = xcalloc (size, 1);
+                       if (b) {
+                               if (zfile_fread (b, size, 1, s) == 1) {
+                                       d = zfile_fopen (dst, L"wb", 0);
+                                       if (d) {
+                                               if (zfile_fwrite (b, size, 1, d) == 1) {
+                                                       ret = 1;
+                                                       _tprintf (L"%s extracted, %d bytes\n", dst, size);
+                                               }
+                                               zfile_fclose (d);
+                                               setdate (dst, st.st_mtime);
+                                       }
+                               }
+                               xfree (b);
                        }
-                       zfile_fclose (d);
-                       setdate (dst, st.st_mtime);
-                   }
+                       zfile_fclose (s);
                }
-               xfree (b);
-           }
-           zfile_fclose (s);
        }
-    }
-    geterror ();
-    if (!found && !level) {
-       _tprintf (L"'%s' not matched\n", match);
-    }
-    return ret;
+       geterror ();
+       if (!found && !level) {
+               _tprintf (L"'%s' not matched\n", match);
+       }
+       return ret;
 }
 
 static int scanpath (TCHAR *src, TCHAR *outpath)
 {
-    struct zvolume *zv;
-    void *h;
-    TCHAR fn[MAX_DPATH];
-
-    zv = zfile_fopen_archive_root (src);
-    if (zv == NULL) {
-       geterror();
-       _tprintf (L"Couldn't open archive '%s'\n", src);
-       return 0;
-    }
-    h = zfile_opendir_archive (src);
-    if (!h) {
-       geterror();
-       _tprintf (L"Couldn't open directory '%s'\n", src);
-       return 0;
-    }
-    while (zfile_readdir_archive (h, fn)) {
-        TCHAR tmp[MAX_DPATH];
-       int isdir, flags;
-        _tcscpy (tmp, src);
-       _tcscat (tmp, sep);
-       _tcscat (tmp, fn);
-       zfile_fill_file_attrs_archive (tmp, &isdir, &flags, NULL);
-       if (isdir == ZNODE_VDIR) {
-           _tcscpy (outpath, tmp);
-           scanpath (tmp, outpath);
-           break;
+       struct zvolume *zv;
+       void *h;
+       TCHAR fn[MAX_DPATH];
+
+       zv = zfile_fopen_archive_root (src);
+       if (zv == NULL) {
+               geterror();
+               _tprintf (L"Couldn't open archive '%s'\n", src);
+               return 0;
        }
-    }
-    return 1;
+       h = zfile_opendir_archive (src);
+       if (!h) {
+               geterror();
+               _tprintf (L"Couldn't open directory '%s'\n", src);
+               return 0;
+       }
+       while (zfile_readdir_archive (h, fn)) {
+               TCHAR tmp[MAX_DPATH];
+               int isdir, flags;
+               _tcscpy (tmp, src);
+               _tcscat (tmp, sep);
+               _tcscat (tmp, fn);
+               zfile_fill_file_attrs_archive (tmp, &isdir, &flags, NULL);
+               if (isdir == ZNODE_VDIR) {
+                       _tcscpy (outpath, tmp);
+                       scanpath (tmp, outpath);
+                       break;
+               }
+       }
+       return 1;
 }
 
 int wmain (int argc, wchar_t *argv[], wchar_t *envp[])
 {
-    int ok = 0, i;
-    int list = 0, xtract = 0, extract = 0;
-    int out = 0, all = 0, crclist = 0;
-    TCHAR path[MAX_DPATH] = { 0 }, pathx[MAX_DPATH] = { 0 };
+       int ok = 0, i;
+       int list = 0, xtract = 0, extract = 0;
+       int out = 0, all = 0, crclist = 0;
+       TCHAR path[MAX_DPATH] = { 0 }, pathx[MAX_DPATH] = { 0 };
 #if 0
-    TCHAR tmppath[MAX_DPATH];
+       TCHAR tmppath[MAX_DPATH];
 #endif
-    int used[32] = { 0 };
-    TCHAR *parm2 = NULL;
-    TCHAR *parm3 = NULL;
-    TCHAR *match = NULL;
-    
-    resetlist ();
-
-    for (i = 0; i < argc && i < 32; i++) {
-       if (!_tcsicmp (argv[i], L"-crclist")) {
-           crclist = 1;
-           used[i] = 1;
-       }
-       if (!_tcsicmp (argv[i], L"o")) {
-           out = 1;
-           used[i] = 1;
-       }
-       if (!_tcsicmp (argv[i], L"-o")) {
-           out = 1;
-           used[i] = 1;
-       }
-       if (!_tcsicmp (argv[i], L"l")) {
-           list = 1;
-           used[i] = 1;
-       }
-       if (!_tcsicmp (argv[i], L"-l")) {
-           list = 1;
-           used[i] = 1;
-       }
-       if (!_tcsicmp (argv[i], L"x")) {
-           xtract = 1;
-           used[i] = 1;
-       }
-       if (!_tcsicmp (argv[i], L"-x")) {
-           xtract = 1;
-           used[i] = 1;
-       }
-       if (!_tcsicmp (argv[i], L"e")) {
-           extract = 1;
-           used[i] = 1;
-       }
-       if (!_tcsicmp (argv[i], L"-e")) {
-           extract = 1;
-           used[i] = 1;
-       }
-       if (!_tcsicmp (argv[i], L"*")) {
-           all = 1;
-           used[i] = 1;
+       int used[32] = { 0 };
+       TCHAR *parm2 = NULL;
+       TCHAR *parm3 = NULL;
+       TCHAR *match = NULL;
+
+       resetlist ();
+
+       for (i = 0; i < argc && i < 32; i++) {
+               if (!_tcsicmp (argv[i], L"-crclist")) {
+                       crclist = 1;
+                       used[i] = 1;
+               }
+               if (!_tcsicmp (argv[i], L"o")) {
+                       out = 1;
+                       used[i] = 1;
+               }
+               if (!_tcsicmp (argv[i], L"-o")) {
+                       out = 1;
+                       used[i] = 1;
+               }
+               if (!_tcsicmp (argv[i], L"l")) {
+                       list = 1;
+                       used[i] = 1;
+               }
+               if (!_tcsicmp (argv[i], L"-l")) {
+                       list = 1;
+                       used[i] = 1;
+               }
+               if (!_tcsicmp (argv[i], L"x")) {
+                       xtract = 1;
+                       used[i] = 1;
+               }
+               if (!_tcsicmp (argv[i], L"-x")) {
+                       xtract = 1;
+                       used[i] = 1;
+               }
+               if (!_tcsicmp (argv[i], L"e")) {
+                       extract = 1;
+                       used[i] = 1;
+               }
+               if (!_tcsicmp (argv[i], L"-e")) {
+                       extract = 1;
+                       used[i] = 1;
+               }
+               if (!_tcsicmp (argv[i], L"*")) {
+                       all = 1;
+                       used[i] = 1;
+               }
+               if (!_tcsicmp (argv[i], L"**")) {
+                       all = -1;
+                       used[i] = 1;
+               }
+               if (!used[i] && (_tcschr (argv[i], '*') || _tcschr (argv[i], '?'))) {
+                       extract = 1;
+                       match = argv[i];
+                       used[i] = 1;
+               }
        }
-       if (!_tcsicmp (argv[i], L"**")) {
-           all = -1;
-           used[i] = 1;
+       for (i = 1; i < argc && i < 32; i++) {
+               if (!used[i]) {
+                       _tcscpy (pathx, argv[i]);
+                       GetFullPathName (argv[i], MAX_DPATH, path, NULL);
+                       used[i] = 1;
+                       break;
+               }
        }
-       if (!used[i] && (_tcschr (argv[i], '*') || _tcschr (argv[i], '?'))) {
-           extract = 1;
-           match = argv[i];
-           used[i] = 1;
+       for (i = 1; i < argc && i < 32; i++) {
+               if (!used[i]) {
+                       parm2 = argv[i];
+                       used[i] = 1;
+                       break;
+               }
        }
-    }
-    for (i = 1; i < argc && i < 32; i++) {
-       if (!used[i]) {
-           _tcscpy (pathx, argv[i]);
-           GetFullPathName (argv[i], MAX_DPATH, path, NULL);
-           used[i] = 1;
-           break;
+       for (i = 1; i < argc && i < 32; i++) {
+               if (!used[i]) {
+                       parm3 = argv[i];
+                       used[i] = 1;
+                       break;
+               }
        }
-    }
-    for (i = 1; i < argc && i < 32; i++) {
-       if (!used[i]) {
-           parm2 = argv[i];
-           used[i] = 1;
-           break;
+
+       //    _tcscpy (tmppath, path);
+       //    scanpath (tmppath, path);
+
+       if (crclist) {
+               docrclist (L".");
+               ok = 1;
+       } else if (!list && match) {
+               unpack2 (path, match, 0);
+               ok = 1;
+       } else if (!list && !parm2 && all > 0) {
+               unpack2 (path, L"*", 0);
+               ok = 1;
+       } else if (!list && extract && parm2) {
+               unpack2 (path, parm2, 0);
+               ok = 1;
+       } else if (argc == 2 || (argc > 2 && list)) {
+               unlist (path, all);
+               ok = 1;
+       } else if (((xtract && parm2) || all || (argc >= 3 && parm2)) && !out) {
+               unpack (path, parm2, parm3, 0, all, 0);
+               ok = 1;
+       } else if (parm2 && (argc >= 4 && out)) {
+               unpack (path, parm2, parm3, 1, all, 0);
+               ok = 1;
        }
-    }
-    for (i = 1; i < argc && i < 32; i++) {
-       if (!used[i]) {
-           parm3 = argv[i];
-           used[i] = 1;
-           break;
+       if (!ok) {
+               _tprintf (L"UAE unpacker uaeunp 0.7 by Toni Wilen (c)2009\n");
+               _tprintf (L"\n");
+               _tprintf (L"List: \"uaeunp (-l) <path>\"\n");
+               _tprintf (L"List all recursively: \"uaeunp -l <path> **\"\n");
+               _tprintf (L"Extract to file: \"uaeunp (-x) <path> <filename> [<dst name>]\"\n");
+               _tprintf (L"Extract all (single directory): \"uaeunp (-x) <path> *\"\n");
+               _tprintf (L"Extract all (recursively): \"uaeunp (-x) <path> **\"\n");
+               _tprintf (L"Extract all (recursively, current dir): \"uaeunp -e <path> <match string>\"\n");
+               _tprintf (L"Output to console: \"uaeunp (-x) -o <path> <filename>\"\n");
+               _tprintf (L"\n");
+               _tprintf (L"Supported disk image formats:\n");
+               _tprintf (L" ADF, HDF (VHD), DMS, encrypted DMS, IPF, FDI, DSQ, WRP\n");
+               _tprintf (L"Supported filesystems:\n");
+               _tprintf (L" OFS, FFS, SFS, SFS2 and FAT12\n");
+               _tprintf (L"Supported archive formats:\n");
+               _tprintf (L" 7ZIP, LHA, LZX, RAR (unrar.dll), ZIP, ArchiveAccess.DLL\n");
+               _tprintf (L"Miscellaneous formats:\n");
+               _tprintf (L" RDB partition table, GZIP\n");
+
+
        }
-    }
-
-//    _tcscpy (tmppath, path);
-//    scanpath (tmppath, path);
-
-    if (crclist) {
-       docrclist (L".");
-       ok = 1;
-    } else if (!list && match) {
-       unpack2 (path, match, 0);
-       ok = 1;
-    } else if (!list && !parm2 && all > 0) {
-       unpack2 (path, L"*", 0);
-       ok = 1;
-    } else if (!list && extract && parm2) {
-       unpack2 (path, parm2, 0);
-       ok = 1;
-    } else if (argc == 2 || (argc > 2 && list)) {
-       unlist (path, all);
-       ok = 1;
-    } else if (((xtract && parm2) || all || (argc >= 3 && parm2)) && !out) {
-       unpack (path, parm2, parm3, 0, all, 0);
-       ok = 1;
-    } else if (parm2 && (argc >= 4 && out)) {
-       unpack (path, parm2, parm3, 1, all, 0);
-       ok = 1;
-    }
-    if (!ok) {
-       _tprintf (L"UAE unpacker uaeunp 0.7 by Toni Wilen (c)2009\n");
-       _tprintf (L"\n");
-       _tprintf (L"List: \"uaeunp (-l) <path>\"\n");
-       _tprintf (L"List all recursively: \"uaeunp -l <path> **\"\n");
-       _tprintf (L"Extract to file: \"uaeunp (-x) <path> <filename> [<dst name>]\"\n");
-       _tprintf (L"Extract all (single directory): \"uaeunp (-x) <path> *\"\n");
-       _tprintf (L"Extract all (recursively): \"uaeunp (-x) <path> **\"\n");
-       _tprintf (L"Extract all (recursively, current dir): \"uaeunp -e <path> <match string>\"\n");
-       _tprintf (L"Output to console: \"uaeunp (-x) -o <path> <filename>\"\n");
-       _tprintf (L"\n");
-       _tprintf (L"Supported disk image formats:\n");
-       _tprintf (L" ADF, HDF (VHD), DMS, encrypted DMS, IPF, FDI, DSQ, WRP\n");
-       _tprintf (L"Supported filesystems:\n");
-       _tprintf (L" OFS, FFS, SFS, SFS2 and FAT12\n");
-       _tprintf (L"Supported archive formats:\n");
-       _tprintf (L" 7ZIP, LHA, LZX, RAR (unrar.dll), ZIP, ArchiveAccess.DLL\n");
-       _tprintf (L"Miscellaneous formats:\n");
-       _tprintf (L" RDB partition table, GZIP\n");
-
-
-    }
-    return 0;
+       return 0;
 }
 
 /*
-    0.7:
+0.7:
 
-    - vhd read support
+- vhd read support
+- dms, ipf (and possible other) disk image formats didn't unpack inside archives
 
-    0.6:
+0.6:
 
-    - rdb handling optimization (no more huge memory usage)
-    - fat12 supported
+- rdb handling optimization (no more huge memory usage)
+- fat12 supported
 
-    0.5:
+0.5:
 
-    - adf protection flags fixed
-    - sfs support added
-    - >512 block sizes supported (rdb hardfiles only)
+- adf protection flags fixed
+- sfs support added
+- >512 block sizes supported (rdb hardfiles only)
 
-    0.5b:
+0.5b:
 
-    - SFS file extraction fixed
-    - SFS2 supported
-    - block size autodetection implemented (if non-rdb hardfile)
+- SFS file extraction fixed
+- SFS2 supported
+- block size autodetection implemented (if non-rdb hardfile)
 
-    0.5c:
+0.5c:
 
-    - rdb_dump.dat added to rdb hardfiles, can be used to dump/backup rdb blocks
+- rdb_dump.dat added to rdb hardfiles, can be used to dump/backup rdb blocks
 
 */
\ No newline at end of file
diff --git a/zfile.c b/zfile.c
index 5675014c42adbb57a2543474c28283a422eb0c9e..1e2f53438db6cd426487c4d4aab8988969a6bdc9 100644 (file)
--- a/zfile.c
+++ b/zfile.c
@@ -80,6 +80,7 @@ void zfile_fclose (struct zfile *f)
        struct zfile *l  = zlist;
        struct zfile *nxt;
 
+       //write_log (L"%p\n", f);
        if (!f)
                return;
        if (f->opencnt < 0) {
@@ -453,6 +454,27 @@ struct zfile *zfile_gunzip (struct zfile *z)
        return z2;
 }
 
+static void truncate880k (struct zfile *z)
+{
+       int i;
+       uae_u8 *b;
+
+       if (z == NULL || z->data == NULL)
+               return;
+       if (z->size < 880 * 512 * 2) {
+               int size = 880 * 512 * 2 - z->size;
+               b = xcalloc (size, 1);
+               zfile_fwrite (b, size, 1, z);
+               xfree (b);
+               return;
+       }
+       for (i = 880 * 512 * 2; i < z->size; i++) {
+               if (z->data[i])
+                       return;
+       }
+       z->size = 880 * 512 * 2;
+}
+
 static struct zfile *extadf (struct zfile *z, int pctype)
 {
        int i, r;
@@ -530,6 +552,7 @@ static struct zfile *extadf (struct zfile *z, int pctype)
        zfile_fclose (z);
        xfree (mfm);
        xfree (amigamfmbuffer);
+       truncate880k (zo);
        return zo;
 end:
        zfile_fclose (zo);
@@ -601,6 +624,7 @@ static struct zfile *fdi (struct zfile *z, int type)
        xfree (mfm);
        xfree (amigamfmbuffer);
        xfree (outbuf);
+       truncate880k (zo);
        return zo;
 end:
        if (zo)
@@ -666,6 +690,7 @@ static struct zfile *ipf (struct zfile *z, int type)
        xfree (mfm);
        xfree (amigamfmbuffer);
        xfree (outbuf);
+       truncate880k (zo);
        return zo;
 end:
        if (zo)
@@ -818,6 +843,12 @@ int zfile_is_diskimage (const TCHAR *name)
 }
 
 
+static const TCHAR *archive_extensions[] = {
+       L"7z", L"rar", L"zip", L"lha", L"lzh", L"lzx",
+       L"adf", L"adz", L"dsq", L"dms", L"ipf", L"fdi", L"wrp",
+       L"hdf",
+       NULL
+};
 static const TCHAR *plugins_7z[] = { L"7z", L"rar", L"zip", L"lha", L"lzh", L"lzx", L"adf", L"dsq", L"hdf", NULL };
 static const uae_char *plugins_7z_x[] = { "7z", "Rar!", "MK", NULL, NULL, NULL, NULL, NULL, NULL, NULL };
 static const int plugins_7z_t[] = {
@@ -1272,12 +1303,118 @@ static struct zfile *zfile_fopen_x (const TCHAR *name, const TCHAR *mode, int ma
        }
        return l;
 }
+
+#ifdef _WIN32
+static int isinternetfile (const TCHAR *name)
+{
+       if (!_tcsnicmp (name, L"http://", 7) || !_tcsnicmp (name, L"https://", 8))
+               return 1;
+       if (!_tcsnicmp (name, L"ftp://", 6))
+               return -1;
+       return 0;
+}
+#include <wininet.h>
+#define INETBUFFERLEN 1000000
+static struct zfile *zfile_fopen_internet (const TCHAR *name, const TCHAR *mode, int mask)
+{
+       static HINTERNET hi;
+       HINTERNET i = NULL;
+       TCHAR tmp[MAX_DPATH];
+       DWORD ierr = 0;
+       DWORD outbuf = sizeof tmp / sizeof (TCHAR);
+       uae_u8 *data = 0;
+       int bufferlen = INETBUFFERLEN;
+       int datalen;
+       DWORD didread;
+       struct zfile *zf = NULL;
+
+       if (_tcschr (mode, 'w') || _tcschr (mode, 'a'))
+               return NULL;
+       tmp[0] = 0;
+       if (!hi) {
+               hi = InternetOpen (WINUAEAPPNAME, INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY, NULL, NULL, 0);
+               if (hi == NULL) {
+                       write_log (L"InternetOpen() failed, %d\n", GetLastError ());
+                       return NULL;
+               }
+       }
+       i = InternetOpenUrl (hi, name, NULL, 0, INTERNET_FLAG_NO_COOKIES, 0);
+       if (i == NULL) {
+               DWORD err = GetLastError ();
+               if (err == ERROR_INTERNET_EXTENDED_ERROR)
+                       InternetGetLastResponseInfo (&ierr, tmp, &outbuf);
+               write_log (L"InternetOpenUrl(%s) failed %d (%d,%s)\n", name, err, ierr, tmp);
+               goto end;
+       }
+
+       if (isinternetfile (name) > 0) {
+               DWORD statuscode;
+               DWORD hindex = 0;
+               DWORD size = sizeof statuscode;
+               if (!HttpQueryInfo (i, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &statuscode, &size, &hindex)) {
+                       DWORD err = GetLastError ();
+                       write_log (L"HttpQueryInfo(%s) failed %d\n", name, err);
+                       goto end;
+               }
+               if (statuscode != 200) {
+                       write_log (L"HttpQueryInfo(%s)=%d\n", name, statuscode);
+                       goto end;
+               }
+       }
+
+       if (mask & ZFD_CHECKONLY) {
+               zf = zfile_create (NULL);
+               goto end;
+       }
+
+       datalen = 0;
+       data = malloc (bufferlen);
+       for (;;) {
+               if (!InternetReadFile (i, data + datalen, INETBUFFERLEN, &didread)) {
+                       DWORD err = GetLastError ();
+                       if (err == ERROR_INTERNET_EXTENDED_ERROR)
+                               InternetGetLastResponseInfo (&ierr, tmp, &outbuf);
+                       write_log (L"InternetReadFile(%s) failed %d (%d,%s)\n", name, err, ierr, tmp);
+                       break;
+               }
+               if (didread == 0)
+                       break;
+               datalen += didread;
+               if (datalen > bufferlen - INETBUFFERLEN) {
+                       bufferlen += INETBUFFERLEN;
+                       data = realloc (data, bufferlen);
+                       if (!data) {
+                               datalen = 0;
+                               break;
+                       }
+               }
+       }
+       if (datalen > 0) {
+               zf = zfile_create (NULL);
+               if (zf) {
+                       zf->size = datalen;
+                       zf->data = data;
+                       data = NULL;
+               }
+       }
+end:
+       if (i)
+               InternetCloseHandle (i);
+       free (data);
+       return zf;
+}
+#endif
+
 struct zfile *zfile_fopen (const TCHAR *name, const TCHAR *mode, int mask)
 {
        struct zfile *f;
        TCHAR tmp[MAX_DPATH];
        TCHAR dirsep[2] = { FSDB_DIR_SEPARATOR, '\0' };
 
+#ifdef _WIN32
+       if (isinternetfile (name))
+               return zfile_fopen_internet (name, mode, mask);
+#endif
        f = zfile_fopen_x (name, mode, mask);
        if (f)
                return f;
@@ -2056,18 +2193,22 @@ static int zfile_fopen_archive_recurse (struct zvolume *zv)
        added = 0;
        zn = zv->root.child;
        while (zn) {
+               int done = 0;
                struct zfile *z;
                TCHAR *ext = _tcsrchr (zn->name, '.');
                if (ext && !zn->vchild && zn->type == ZNODE_FILE) {
-                       for (i = 0; plugins_7z[i]; i++) {
-                               if (!strcasecmp (ext + 1, plugins_7z[i])) {
+                       for (i = 0; !done && archive_extensions[i]; i++) {
+                               if (!strcasecmp (ext + 1, archive_extensions[i])) {
                                        zfile_fopen_archive_recurse2 (zv, zn);
+                                       done = 1;
                                }
                        }
                }
-               z = archive_getzfile (zn, zv->method);
-               if (z && iszip (z))
-                       zfile_fopen_archive_recurse2 (zv, zn);
+               if (!done) {
+                       z = archive_getzfile (zn, zv->method);
+                       if (z && iszip (z))
+                               zfile_fopen_archive_recurse2 (zv, zn);
+               }
                zn = zn->next;
        }
        return 0;
@@ -2077,6 +2218,7 @@ static struct zvolume *prepare_recursive_volume (struct zvolume *zv, const TCHAR
 {
        struct zfile *zf = NULL;
        struct zvolume *zvnew = NULL;
+       int i;
 
 #ifdef ZFILE_DEBUG
        write_log (L"unpacking '%s'\n", path);
@@ -2086,10 +2228,27 @@ 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, NULL);
-               if (zf2) {
-                       zf = zf2;
-                       zvnew = archive_directory_plain (zf);
+               struct zfile *zf2, *zf3;
+               TCHAR oldname[MAX_DPATH];
+               _tcscpy (oldname, zf->name);
+               zf3 = zfile_dup (zf);
+               if (zf3) {
+                       zf2 = zuncompress (&zv->root, zf3, 0, ZFD_ALL, NULL);
+                       if (zf2) {
+                               TCHAR newname[MAX_DPATH];
+                               _tcscpy (newname, zf2->name);
+                               for (i = _tcslen (newname) - 1; i > 0; i--) {
+                                       if (newname[i] == '\\' || newname[i] == '/')
+                                               break;
+                               }
+                               //_tcscat (oldname, newname + i);
+                               //xfree (zf2->name);
+                               //zf2->name = my_strdup (oldname);
+                               zf = zf2;
+                               zvnew = archive_directory_plain (zf);
+                       } else {
+                               zfile_fclose (zf3);
+                       }
                }
        }
        if (!zvnew)
index bc1858095c0613be260e5b716912bc5055d0fe61..547faad32470d281ebe55bcebdba2f3bd4382b91 100644 (file)
@@ -908,7 +908,7 @@ struct zvolume *archive_directory_plain (struct zfile *z)
        }
        zf = zfile_dup (z);
        if (zf) {
-               zf2 = zuncompress (NULL, zf, 0, ZFD_ALL, &rc);
+               zf2 = zuncompress (NULL, zf, 0, ZFD_ALL & ~ZFD_ADF, &rc);
                if (zf2) {
                        zf = NULL;
                        zai.name = zfile_getfilename (zf2);