]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
stuff
authorToni Wilen <twilen@winuae.net>
Wed, 4 Aug 2010 11:05:42 +0000 (14:05 +0300)
committerToni Wilen <twilen@winuae.net>
Wed, 4 Aug 2010 11:05:42 +0000 (14:05 +0300)
include/zfile.h
inputdevice.cpp
od-win32/direct3d.cpp
od-win32/win32.h
od-win32/win32gui.cpp
zfile.cpp

index e7ae0b60fe80d7a2414ce4850e73f1ac5c890247..08602c8e525f981c82eba47c60951ebd904377c1 100644 (file)
@@ -79,6 +79,7 @@ extern TCHAR *zfile_geterror (void);
 #define ZFD_DISKHISTORY 0x100 //allow diskhistory (if disk image)
 #define ZFD_CHECKONLY 0x200 //file exists checkc
 #define ZFD_DELAYEDOPEN 0x400 //do not unpack, just get metadata
+#define ZFD_NORECURSE 0x10000 // do not recurse archives
 #define ZFD_NORMAL (ZFD_ARCHIVE|ZFD_UNPACK)
 #define ZFD_ALL 0x0000ffff
 
@@ -101,12 +102,13 @@ extern const TCHAR *uae_ignoreextensions[];
 extern const TCHAR *uae_diskimageextensions[];
 
 extern struct zvolume *zfile_fopen_archive (const TCHAR *filename);
-extern struct zvolume *zfile_fopen_archive (const TCHAR *filename, bool norecurse);
+extern struct zvolume *zfile_fopen_archive (const TCHAR *filename, int flags);
 extern struct zvolume *zfile_fopen_archive_root (const TCHAR *filename);
 extern void zfile_fclose_archive (struct zvolume *zv);
 extern int zfile_fs_usage_archive (const TCHAR *path, const TCHAR *disk, struct fs_usage *fsp);
 extern int zfile_stat_archive (const TCHAR *path, struct _stat64 *statbuf);
 extern struct zdirectory *zfile_opendir_archive (const TCHAR *path);
+extern struct zdirectory *zfile_opendir_archive (const TCHAR *path, int flags);
 extern void zfile_closedir_archive (struct zdirectory *);
 extern int zfile_readdir_archive (struct zdirectory *, TCHAR*);
 extern int zfile_readdir_archive (struct zdirectory *, TCHAR*, bool fullpath);
index 15074d00bbed1c26dcf3b82fd54524805251cd8b..f091ef7ee7549a4ce899dfe0574a099340c379aa 100644 (file)
@@ -5613,6 +5613,18 @@ int jsem_iskbdjoy (int port, const struct uae_prefs *p)
        return v;
 }
 
+// reject same joystick in parallel ports if it is already in normal ports, AF2008 workaround
+static bool checkjpc (struct uae_prefs *p, int portnum, int idnum)
+{
+       if (portnum < 2 || idnum < 0)
+               return true;
+       for (int i = 0; i < MAX_JPORTS; i++) {
+               if (p->jports[i].id == idnum && portnum != i)
+                       return false;
+       }
+       return true;
+}
+
 int inputdevice_joyport_config (struct uae_prefs *p, TCHAR *value, int portnum, int mode, int type)
 {
        switch (type)
@@ -5634,6 +5646,8 @@ int inputdevice_joyport_config (struct uae_prefs *p, TCHAR *value, int portnum,
                                        TCHAR *name1 = idf->get_friendlyname (i);
                                        TCHAR *name2 = idf->get_uniquename (i);
                                        if ((name1 && !_tcscmp (name1, value)) || (name2 && !_tcscmp (name2, value))) {
+                                               if (!checkjpc (p, portnum, idnum + 1))
+                                                       return 0;
                                                p->jports[portnum].id = idnum + i;
                                                if (mode >= 0)
                                                        p->jports[portnum].mode = mode;
index f17f7556a77da736745a818a615a87156a527a93..8cf1c25755a8f9423e8bd64f8143bf7bdcb14186 100644 (file)
@@ -1003,12 +1003,10 @@ static LPDIRECT3DTEXTURE9 createtext (int w, int h, D3DFORMAT format)
        D3DLOCKED_RECT locked;
        HRESULT hr;
 
-       hr = d3ddev->CreateTexture (w, h, 1, D3DUSAGE_DYNAMIC, format,
-               D3DPOOL_DEFAULT, &t, NULL);
+       hr = d3ddev->CreateTexture (w, h, 1, D3DUSAGE_DYNAMIC, format, D3DPOOL_DEFAULT, &t, NULL);
        if (FAILED (hr))
                write_log (L"%s: CreateTexture() D3DUSAGE_DYNAMIC failed: %s (%d*%d %08x)\n",
-               D3DHEAD,
-               D3D_ErrorString (hr), w, h, format);
+                       D3DHEAD, D3D_ErrorString (hr), w, h, format);
        if (FAILED (hr)) {
                hr = d3ddev->CreateTexture (w, h, 1, 0, format, D3DPOOL_DEFAULT, &t, NULL);
        }
@@ -1049,28 +1047,24 @@ static int createtexture (int iw, int ih, int ow, int oh, int win_w, int win_h)
                w = win_w * multx;
                h = win_h * multx;
        }
-       if (FAILED (hr = d3ddev->CreateTexture (w, h, 1,
-                       D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpTempTexture, NULL))) {
-                               write_log (L"%s: Failed to create working texture1: %s\n", D3DHEAD, D3D_ErrorString (hr));
-                               return 0;
+       if (FAILED (hr = d3ddev->CreateTexture (w, h, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpTempTexture, NULL))) {
+               write_log (L"%s: Failed to create working texture1: %s\n", D3DHEAD, D3D_ErrorString (hr));
+               return 0;
        }
        write_log (L"%s: %d*%d working texture allocated, bits per pixel %d\n", D3DHEAD, w, h, t_depth);
        if (psActive) {
                D3DLOCKED_BOX lockedBox;
-               if (FAILED (hr = d3ddev->CreateTexture (iw, ih, 1,
-                       D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpWorkTexture1, NULL))) {
-                               write_log (L"%s: Failed to create temp texture: %s\n", D3DHEAD, D3D_ErrorString (hr));
-                               return 0;
+               if (FAILED (hr = d3ddev->CreateTexture (iw, ih, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpWorkTexture1, NULL))) {
+                       write_log (L"%s: Failed to create temp texture: %s\n", D3DHEAD, D3D_ErrorString (hr));
+                       return 0;
                }
-               if (FAILED (hr = d3ddev->CreateTexture (iw, ih, 1,
-                       D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpWorkTexture2, NULL))) {
-                               write_log (L"%s: Failed to create working texture2: %s\n", D3DHEAD, D3D_ErrorString (hr));
-                               return 0;
+               if (FAILED (hr = d3ddev->CreateTexture (iw, ih, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpWorkTexture2, NULL))) {
+                       write_log (L"%s: Failed to create working texture2: %s\n", D3DHEAD, D3D_ErrorString (hr));
+                       return 0;
                }
-               if (FAILED (hr = d3ddev->CreateVolumeTexture (256, 16, 256, 1,
-                       D3DUSAGE_DYNAMIC, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpHq2xLookupTexture, NULL))) {
-                               write_log (L"%s: Failed to create volume texture: %s\n", D3DHEAD, D3D_ErrorString (hr));
-                               return 0;
+               if (FAILED (hr = d3ddev->CreateVolumeTexture (256, 16, 256, 1, D3DUSAGE_DYNAMIC, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpHq2xLookupTexture, NULL))) {
+                       write_log (L"%s: Failed to create volume texture: %s\n", D3DHEAD, D3D_ErrorString (hr));
+                       return 0;
                }
                if (FAILED (hr = lpHq2xLookupTexture->LockBox (0, &lockedBox, NULL, 0))) {
                        write_log (L"%s: Failed to lock box of volume texture: %s\n", D3DHEAD, D3D_ErrorString (hr));
index 0563258abc97291a0478b5ec3462d704b6720b57..12c96856b66d4227db377a501ce9445ab7fe9dfb 100644 (file)
@@ -19,7 +19,7 @@
 #define LANG_DLL 1
 
 #define WINUAEBETA L"9"
-#define WINUAEDATE MAKEBD(2010, 8, 3)
+#define WINUAEDATE MAKEBD(2010, 8, 4)
 #define WINUAEEXTRA L""
 #define WINUAEREV L""
 
index 57c321b568e6427d0a8cc58b3a07767e92a3ed40..8bb31f0640b9546bf1c3daf168b6777c36fc9d21 100644 (file)
@@ -10053,8 +10053,8 @@ static void diskswapper_addfile2 (struct uae_prefs *prefs, const TCHAR *file)
 
 static void diskswapper_addfile (struct uae_prefs *prefs, const TCHAR *file)
 {
-       struct zdirectory *zd = zfile_opendir_archive (file);
-       if (zd) {
+       struct zdirectory *zd = zfile_opendir_archive (file, ZFD_ARCHIVE | ZFD_NORECURSE);
+       if (zd && zfile_readdir_archive (zd, NULL, true) > 1) {
                TCHAR out[MAX_DPATH];
                while (zfile_readdir_archive (zd, out, true)) {
                        struct zfile *zf = zfile_fopen (out, L"rb", ZFD_NORMAL);
@@ -13495,8 +13495,8 @@ static int floppyslot_addfile2 (struct uae_prefs *prefs, const TCHAR *file, int
 }
 static int floppyslot_addfile (struct uae_prefs *prefs, const TCHAR *file, int drv, int firstdrv, int maxdrv)
 {
-       struct zdirectory *zd = zfile_opendir_archive (file);
-       if (zd) {
+       struct zdirectory *zd = zfile_opendir_archive (file, ZFD_ARCHIVE | ZFD_NORECURSE);
+       if (zd && zfile_readdir_archive (zd, NULL, true) > 1) {
                TCHAR out[MAX_DPATH];
                while (zfile_readdir_archive (zd, out, true)) {
                        struct zfile *zf = zfile_fopen (out, L"rb", ZFD_NORMAL);
index c19e16cfaea1a1d49fac71186b546983ba9d679f..59939f2e0e54029d951d26f0aa6a1b8fd1c61379 100644 (file)
--- a/zfile.cpp
+++ b/zfile.cpp
@@ -2475,7 +2475,7 @@ static struct zvolume *get_zvolume (const TCHAR *path)
        return NULL;
 }
 
-static struct zvolume *zfile_fopen_archive_ext (struct znode *parent, struct zfile *zf)
+static struct zvolume *zfile_fopen_archive_ext (struct znode *parent, struct zfile *zf, int flags)
 {
        struct zvolume *zv = NULL;
        TCHAR *name = zfile_getname (zf);
@@ -2493,32 +2493,38 @@ static struct zvolume *zfile_fopen_archive_ext (struct znode *parent, struct zfi
        ext = _tcsrchr (name, '.');
        if (ext != NULL) {
                ext++;
-               if (strcasecmp (ext, L"lha") == 0 || strcasecmp (ext, L"lzh") == 0)
-                       zv = archive_directory_lha (zf);
-               if (strcasecmp (ext, L"zip") == 0)
-                       zv = archive_directory_zip (zf);
-               if (strcasecmp (ext, L"7z") == 0)
-                       zv = archive_directory_7z (zf);
-               if (strcasecmp (ext, L"lzx") == 0)
-                       zv = archive_directory_lzx (zf);
-               if (strcasecmp (ext, L"rar") == 0)
-                       zv = archive_directory_rar (zf);
-               if (strcasecmp (ext, L"tar") == 0)
-                       zv = archive_directory_tar (zf);
-               if (strcasecmp (ext, L"adf") == 0 && !memcmp (header, "DOS", 3))
-                       zv = archive_directory_adf (parent, zf);
-               if (strcasecmp (ext, L"hdf") == 0)  {
-                       if (!memcmp (header, "RDSK", 4))
-                               zv = archive_directory_rdb (zf);
-                       else
+               if (flags & ZFD_ARCHIVE) {
+                       if (strcasecmp (ext, L"lha") == 0 || strcasecmp (ext, L"lzh") == 0)
+                               zv = archive_directory_lha (zf);
+                       if (strcasecmp (ext, L"zip") == 0)
+                               zv = archive_directory_zip (zf);
+                       if (strcasecmp (ext, L"7z") == 0)
+                               zv = archive_directory_7z (zf);
+                       if (strcasecmp (ext, L"lzx") == 0)
+                               zv = archive_directory_lzx (zf);
+                       if (strcasecmp (ext, L"rar") == 0)
+                               zv = archive_directory_rar (zf);
+                       if (strcasecmp (ext, L"tar") == 0)
+                               zv = archive_directory_tar (zf);
+               }
+               if (flags & ZFD_ADF) {
+                       if (strcasecmp (ext, L"adf") == 0 && !memcmp (header, "DOS", 3))
                                zv = archive_directory_adf (parent, zf);
                }
+               if (flags & ZFD_HD) {
+                       if (strcasecmp (ext, L"hdf") == 0)  {
+                               if (!memcmp (header, "RDSK", 4))
+                                       zv = archive_directory_rdb (zf);
+                               else
+                                       zv = archive_directory_adf (parent, zf);
+                       }
+               }
        }
        return zv;
 }
 
 
-static struct zvolume *zfile_fopen_archive_data (struct znode *parent, struct zfile *zf)
+static struct zvolume *zfile_fopen_archive_data (struct znode *parent, struct zfile *zf, int flags)
 {
        struct zvolume *zv = NULL;
        uae_u8 header[32];
@@ -2526,20 +2532,26 @@ static struct zvolume *zfile_fopen_archive_data (struct znode *parent, struct zf
        memset (header, 0, sizeof (header));
        zfile_fread (header, sizeof (header), 1, zf);
        zfile_fseek (zf, 0, SEEK_SET);
-       if (header[0] == 'P' && header[1] == 'K')
-               zv = archive_directory_zip (zf);
-       if (header[0] == 'R' && header[1] == 'a' && header[2] == 'r' && header[3] == '!')
-               zv = archive_directory_rar (zf);
-       if (header[0] == 'L' && header[1] == 'Z' && header[2] == 'X')
-               zv = archive_directory_lzx (zf);
-       if (header[2] == '-' && header[3] == 'l' && header[4] == 'h' && header[6] == '-')
-               zv = archive_directory_lha (zf);
-       if (header[0] == 'D' && header[1] == 'O' && header[2] == 'S' && (header[3] >= 0 && header[3] <= 7))
-               zv = archive_directory_adf (parent, zf);
-       if (header[0] == 'R' && header[1] == 'D' && header[2] == 'S' && header[3] == 'K')
-               zv = archive_directory_rdb (zf);
-       if (isfat (header))
-               zv = archive_directory_fat (zf);
+       if (flags & ZFD_ARCHIVE) {
+               if (header[0] == 'P' && header[1] == 'K')
+                       zv = archive_directory_zip (zf);
+               if (header[0] == 'R' && header[1] == 'a' && header[2] == 'r' && header[3] == '!')
+                       zv = archive_directory_rar (zf);
+               if (header[0] == 'L' && header[1] == 'Z' && header[2] == 'X')
+                       zv = archive_directory_lzx (zf);
+               if (header[2] == '-' && header[3] == 'l' && header[4] == 'h' && header[6] == '-')
+                       zv = archive_directory_lha (zf);
+       }
+       if (flags & ZFD_ADF) {
+               if (header[0] == 'D' && header[1] == 'O' && header[2] == 'S' && (header[3] >= 0 && header[3] <= 7))
+                       zv = archive_directory_adf (parent, zf);
+       }
+       if (flags & ZFD_HD) {
+               if (header[0] == 'R' && header[1] == 'D' && header[2] == 'S' && header[3] == 'K')
+                       zv = archive_directory_rdb (zf);
+               if (isfat (header))
+                       zv = archive_directory_fat (zf);
+       }
        return zv;
 }
 
@@ -2601,7 +2613,7 @@ static int zfile_fopen_archive_recurse (struct zvolume *zv)
        return 0;
 }
 
-static struct zvolume *prepare_recursive_volume (struct zvolume *zv, const TCHAR *path)
+static struct zvolume *prepare_recursive_volume (struct zvolume *zv, const TCHAR *path, int flags)
 {
        struct zfile *zf = NULL;
        struct zvolume *zvnew = NULL;
@@ -2613,8 +2625,8 @@ static struct zvolume *prepare_recursive_volume (struct zvolume *zv, const TCHAR
        zf = zfile_open_archive (path, 0);
        if (!zf)
                goto end;
-       zvnew = zfile_fopen_archive_ext (zv->parentz, zf);
-       if (!zvnew) {
+       zvnew = zfile_fopen_archive_ext (zv->parentz, zf, flags);
+       if (!zvnew && !(flags & ZFD_NORECURSE)) {
 #if 1
                zvnew = archive_directory_plain (zf);
                zfile_fopen_archive_recurse (zvnew);
@@ -2693,7 +2705,7 @@ static struct znode *get_znode (struct zvolume *zv, const TCHAR *ppath, int recu
 #ifdef ZFILE_DEBUG
                                                write_log (L"'%s'\n", newpath);
 #endif
-                                               zvdeep = prepare_recursive_volume (zvdeep, newpath);
+                                               zvdeep = prepare_recursive_volume (zvdeep, newpath, ZFD_ALL);
                                                if (!zvdeep) {
                                                        write_log (L"failed to unpack '%s'\n", newpath);
                                                        return NULL;
@@ -2848,34 +2860,34 @@ struct zvolume *zfile_fopen_directory (const TCHAR *dirname)
        return zv;
 }
 
-struct zvolume *zfile_fopen_archive (const TCHAR *filename, bool norecurse)
+struct zvolume *zfile_fopen_archive (const TCHAR *filename, int flags)
 {
        struct zvolume *zv = NULL;
        struct zfile *zf = zfile_fopen_nozip (filename, L"rb");
 
        if (!zf)
                return NULL;
-       zf->zfdmask = ZFD_ALL;
-       zv = zfile_fopen_archive_ext (NULL, zf);
+       zf->zfdmask = flags;
+       zv = zfile_fopen_archive_ext (NULL, zf, flags);
        if (!zv)
-               zv = zfile_fopen_archive_data (NULL, zf);
+               zv = zfile_fopen_archive_data (NULL, zf, flags);
 #if 0
        if (!zv) {
                struct zfile *zf2 = zuncompress (zf, 0, 0);
                if (zf2 != zf) {
                        zf = zf2;
-                       zv = zfile_fopen_archive_ext (zf);
+                       zv = zfile_fopen_archive_ext (zf, flags);
                        if (!zv)
-                               zv = zfile_fopen_archive_data (zf);
+                               zv = zfile_fopen_archive_data (zf, flags);
                }
        }
 #endif
        /* pointless but who cares? */
-       if (!zv && !norecurse)
+       if (!zv && !(flags & ZFD_NORECURSE))
                zv = archive_directory_plain (zf);
 
 #if RECURSIVE_ARCHIVES
-       if (zv && !norecurse)
+       if (zv && !(flags & ZFD_NORECURSE))
                zfile_fopen_archive_recurse (zv);
 #endif
 
@@ -2888,7 +2900,7 @@ struct zvolume *zfile_fopen_archive (const TCHAR *filename, bool norecurse)
 }
 struct zvolume *zfile_fopen_archive (const TCHAR *filename)
 {
-       return zfile_fopen_archive (filename, false);
+       return zfile_fopen_archive (filename, ZFD_ALL);
 }
 
 struct zvolume *zfile_fopen_archive_root (const TCHAR *filename)
@@ -2991,12 +3003,12 @@ struct zdirectory {
        TCHAR **filenames;
 };
 
-struct zdirectory *zfile_opendir_archive (const TCHAR *path)
+struct zdirectory *zfile_opendir_archive (const TCHAR *path, int flags)
 {
        struct zvolume *zv = get_zvolume (path);
        bool created = false;
        if (zv == NULL) {
-               zv = zfile_fopen_archive (path, true);
+               zv = zfile_fopen_archive (path, flags);
                created = true;
        }
        struct znode *zn = get_znode (zv, path, TRUE);
@@ -3013,7 +3025,7 @@ struct zdirectory *zfile_opendir_archive (const TCHAR *path)
                zd->n = zn->child;
        } else {
                if (zn->vchild->archive == NULL) {
-                       struct zvolume *zvnew = prepare_recursive_volume (zn->vchild, path);
+                       struct zvolume *zvnew = prepare_recursive_volume (zn->vchild, path, flags);
                        if (zvnew) {
                                zn->vchild = zvnew;
                                zvnew->parentz = zn;
@@ -3025,6 +3037,10 @@ struct zdirectory *zfile_opendir_archive (const TCHAR *path)
        zd->first = zd->n;
        return zd;
 }
+struct zdirectory *zfile_opendir_archive (const TCHAR *path)
+{
+       return zfile_opendir_archive (path, ZFD_ALL);
+}
 void zfile_closedir_archive (struct zdirectory *zd)
 {
        if (!zd)
@@ -3036,7 +3052,8 @@ void zfile_closedir_archive (struct zdirectory *zd)
 }
 int zfile_readdir_archive (struct zdirectory *zd, TCHAR *out, bool fullpath)
 {
-       out[0] = 0;
+       if (out)
+               out[0] = 0;
        if (!zd->n || (zd->filenames != NULL && zd->offset >= zd->cnt))
                return 0;
        if (zd->filenames == NULL) {
@@ -3044,17 +3061,14 @@ int zfile_readdir_archive (struct zdirectory *zd, TCHAR *out, bool fullpath)
                int cnt = 0, len = 0;
                while (n) {
                        cnt++;
-                       len += _tcslen (n->name) + 1;
                        n = n->sibling;
                }
                n = zd->first;
-               uae_u8 *buf = xmalloc (uae_u8, cnt * sizeof (TCHAR*) + len * sizeof (TCHAR) * cnt);
+               uae_u8 *buf = xmalloc (uae_u8, cnt * sizeof (TCHAR*));
                zd->filenames = (TCHAR**)buf;
                buf += cnt * sizeof (TCHAR*);
                for (int i = 0; i < cnt; i++) {
-                       zd->filenames[i] = (TCHAR*)buf;
-                       _tcscpy ((TCHAR*)buf, n->name);
-                       buf += (_tcslen (n->name) + 1) * sizeof (TCHAR);
+                       zd->filenames[i] = n->name;
                        n = n->sibling;
                }
                for (int i = 0; i < cnt; i++) {
@@ -3068,6 +3082,8 @@ int zfile_readdir_archive (struct zdirectory *zd, TCHAR *out, bool fullpath)
                }
                zd->cnt = cnt;
        }
+       if (out == NULL)
+               return zd->cnt;
        if (fullpath) {
                _tcscpy (out, zd->parentpath);
                _tcscat (out, L"\\");