]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
imported winuaesrc1500b8.zip
authorToni Wilen <twilen@winuae.net>
Fri, 14 Mar 2008 16:56:42 +0000 (18:56 +0200)
committerToni Wilen <twilen@winuae.net>
Mon, 22 Feb 2010 19:39:17 +0000 (21:39 +0200)
26 files changed:
custom.c
expansion.c
gayle.c
include/autoconf.h
include/memory.h
include/options.h
jit/compemu_raw_x86.c
memory.c
od-win32/direct3d.c
od-win32/dxwrap.c
od-win32/dxwrap.h
od-win32/mman.c
od-win32/picasso96_win.c
od-win32/resources/winuae.rc
od-win32/sounddep/sound.c
od-win32/sys/mman.h
od-win32/win32.c
od-win32/win32.h
od-win32/win32_scale2x.c
od-win32/win32gfx.c
od-win32/win32gfx.h
od-win32/win32gui.c
od-win32/winuae_msvc/winuae_msvc.vcproj
od-win32/winuaechangelog.txt
od-win32/writelog.c
uaelib.c

index c616777815e74384f5ae96d972b49e030c6c64f9..40c160839238da3bf37d25a751421e99a0f719e7 100755 (executable)
--- a/custom.c
+++ b/custom.c
@@ -1919,19 +1919,21 @@ static void record_sprite (int line, int num, int sprxp, uae_u16 *data, uae_u16
     uae_u32 collision_mask;
     int width, dbl, half;
     unsigned int mask = 0;
+    int attachment;
 
     half = 0;
     dbl = sprite_buffer_res - sprres;
     if (dbl < 0) {
         half = -dbl;
         dbl = 0;
-       if (ecsshres())
+       if (ecsshres ())
            mask = 1;
     }
     width = (sprite_width << sprite_buffer_res) >> sprres;
+    attachment =  (spr[num & ~1].armed && ((sprctl[num | 1] & 0x80) || (!(currprefs.chipset_mask & CSMASK_AGA) && (sprctl[num & ~1] & 0x80))));
 
-    /* Try to coalesce entries if they aren't too far apart, except AGA due to AGA sprite color selection.  */
-    if (! next_sprite_forced && e[-1].max + 16 >= sprxp && !(currprefs.chipset_mask & CSMASK_AGA)) {
+    /* Try to coalesce entries if they aren't too far apart  */
+    if (! next_sprite_forced && e[-1].max + sprite_width >= sprxp && (attachment || ((bplcon4 >> 4) & 15) == ((bplcon4 >> 0) & 15))) {
        e--;
     } else {
        next_sprite_entry++;
@@ -1966,7 +1968,7 @@ static void record_sprite (int line, int num, int sprxp, uae_u16 *data, uae_u16
 
     /* We have 8 bits per pixel in spixstate, two for every sprite pair.  The
        low order bit records whether the attach bit was set for this pair.  */
-    if (spr[num & ~1].armed && ((sprctl[num | 1] & 0x80) || (!(currprefs.chipset_mask & CSMASK_AGA) && (sprctl[num & ~1] & 0x80)))) {
+    if (attachment) {
        uae_u32 state = 0x01010101 << (num & ~1);
        uae_u32 *stbuf = spixstate.words + (word_offs >> 2);
        uae_u8 *stb1 = spixstate.bytes + word_offs;
@@ -4160,7 +4162,7 @@ static void framewait (void)
        double v = rpt_vsync () / (syncbase / 1000.0);
        if (v >= -4)
            break;
-       sleep_millis_busy (2);
+       sleep_millis (2);
     }
     curr_time = start = read_processor_time();
     if (!isvsync()) {
index 8dde2d68b0401ef6a2c9f452cf09eb1ea861a61f..395df6d5c119d17734beef9699972eeafe51779c 100755 (executable)
@@ -27,9 +27,6 @@
 #include "ncr_scsi.h"
 #include "debug.h"
 
-#define RTAREA_DEFAULT 0xf00000
-#define RTAREA_BACKUP  0xef0000
-
 #define MAX_EXPANSION_BOARDS 8
 
 /* ********************************************************** */
diff --git a/gayle.c b/gayle.c
index fed34d0c0b505c91ad8dd13ace922bb71826c7e4..928130e098122ee53be619d40b2236813a8693f2 100755 (executable)
--- a/gayle.c
+++ b/gayle.c
@@ -1403,8 +1403,11 @@ static int initpcmcia (const char *path, int readonly, int reset)
     if (currprefs.cs_pcmcia == 0)
        return 0;
     freepcmcia (reset);
-    if (reset) {
+    if (!pcmcia_sram)
        pcmcia_sram = xcalloc (sizeof (struct hd_hardfiledata), 1);
+    if (!pcmcia_sram->hfd.handle_valid)
+       reset = 1;
+    if (reset) {
        if (path)
            hdf_hd_open (pcmcia_sram, path, 512, readonly, NULL, 0, 0, 0, 0, NULL);
     } else {
@@ -1418,7 +1421,6 @@ static int initpcmcia (const char *path, int readonly, int reset)
     pcmcia_attrs = xcalloc (pcmcia_attrs_size, 1);
     if (!pcmcia_sram->hfd.drive_empty) {
        pcmcia_common_size = pcmcia_sram->hfd.size;
-       pcmcia_common_size = 16384;
        if (pcmcia_sram->hfd.size > 4 * 1024 * 1024) {
            write_log ("PCMCIA SRAM: too large device, %d bytes\n", pcmcia_sram->hfd.size);
            pcmcia_common_size = 4 * 1024 * 1024;
@@ -1672,9 +1674,9 @@ int gayle_add_pcmcia_sram_unit (const char *path, int readonly)
 int gayle_modify_pcmcia_sram_unit (const char *path, int readonly, int insert)
 {
     if (insert)
-       return initpcmcia (path, readonly, 0);
+       return initpcmcia (path, readonly, 1);
     else
-       return freepcmcia (0);
+       return freepcmcia (1);
 }
 
 static void initide (void)
index 1c1214e9d3af87d66f720390586b44335f3f96db..9009bf3d22fe5f35a876a9735fa0b7f97dea942e 100755 (executable)
@@ -6,6 +6,9 @@
   * (c) 1996 Ed Hanway
   */
 
+#define RTAREA_DEFAULT 0xf00000
+#define RTAREA_BACKUP  0xef0000
+
 extern uae_u32 addr (int);
 extern void db (uae_u8);
 extern void dw (uae_u16);
index 9e9846f156a5fdd9e9fd043b123ad914369929ac..a8755ad22107ce1e3505200dece3c0a0c9014aaa 100755 (executable)
@@ -328,27 +328,28 @@ extern void mapkick (void);
 extern int decode_cloanto_rom_do (uae_u8 *mem, int size, int real_size);
 extern void a3000_fakekick(int);
 
-#define ROMTYPE_KICK 1
-#define ROMTYPE_KICKCD32 2
-#define ROMTYPE_EXTCD32 4
-#define ROMTYPE_EXTCDTV 8
-#define ROMTYPE_A2091BOOT 16
-#define ROMTYPE_A4091BOOT 32
-#define ROMTYPE_AR 64
-#define ROMTYPE_SUPERIV 128
-#define ROMTYPE_KEY 256
-#define ROMTYPE_ARCADIABIOS 512
-#define ROMTYPE_ARCADIAGAME 1024
-#define ROMTYPE_HRTMON 2048
-#define ROMTYPE_NORDIC 4096
-#define ROMTYPE_XPOWER 8192
-#define ROMTYPE_CD32CART 16384
-#define ROMTYPE_MASK 131071
-#define ROMTYPE_EVEN 131072
-#define ROMTYPE_ODD 262144
-#define ROMTYPE_8BIT 524288
-#define ROMTYPE_BYTESWAP 1048576
-#define ROMTYPE_SCRAMBLED 2097152
+#define ROMTYPE_KICK       0x000001
+#define ROMTYPE_KICKCD32    0x000002
+#define ROMTYPE_EXTCD32            0x000004
+#define ROMTYPE_EXTCDTV            0x000008
+#define ROMTYPE_A2091BOOT   0x000010
+#define ROMTYPE_A4091BOOT   0x000020
+#define ROMTYPE_AR         0x000040
+#define ROMTYPE_SUPERIV            0x000080
+#define ROMTYPE_KEY        0x000100
+#define ROMTYPE_ARCADIABIOS 0x000200
+#define ROMTYPE_ARCADIAGAME 0x000400
+#define ROMTYPE_HRTMON     0x000800
+#define ROMTYPE_NORDIC     0x001000
+#define ROMTYPE_XPOWER     0x002000
+#define ROMTYPE_CD32CART    0x004000
+#define ROMTYPE_MASK       0x01ffff
+#define ROMTYPE_EVEN       0x020000
+#define ROMTYPE_ODD        0x040000
+#define ROMTYPE_8BIT       0x080000
+#define ROMTYPE_BYTESWAP    0x100000
+#define ROMTYPE_CD32       0x200000
+#define ROMTYPE_SCRAMBLED   0x400000
 
 struct romheader {
     char *name;
@@ -367,6 +368,7 @@ struct romdata {
     int type;
     int group;
     int title;
+    char *partnumber;
     uae_u32 crc32;
     uae_u32 sha1[5];
     char *configname;
index 25ea47d6eaaa9abc4895469967910f5d4a0b17eb..bd303c8db4e97aed7cfaead5cb2f69e2eccf4474 100755 (executable)
@@ -309,6 +309,7 @@ struct uae_prefs {
     int win32_iconified_nosound;
 
     int win32_rtgmatchdepth;
+    int win32_rtgscaleifsmall;
     int win32_borderless;
     int win32_ctrl_F11_is_quit;
     int win32_automount_removable;
index b091bcd312c0adb28239090f1a546ac4ce4b7d0a..5639b7e5eb75ed3e706297e95705362c55b34d7f 100755 (executable)
@@ -1718,24 +1718,15 @@ int EvalException (LPEXCEPTION_POINTERS blah, int n_except)
     pExceptRecord = blah->ExceptionRecord;
     pContext = blah->ContextRecord;
 
-    if( pContext )
-    {
+    if (pContext)
        i = (uae_u8 *)ctxPC;
-    }
-    if( pExceptRecord )
-    {
+    if (pExceptRecord)
        addr = (uae_u32)(pExceptRecord->ExceptionInformation[1]);
-    }
 #ifdef JIT_DEBUG
     write_log ("JIT: fault address is 0x%x at 0x%x\n",addr,i);
 #endif
     if (!canbang || !currprefs.cachesize)
-    {
-#ifdef JIT_DEBUG
-       write_log ("JIT: Not happy! Canbang or cachesize is 0 in SIGSEGV handler!\n");
-#endif
        return EXCEPTION_CONTINUE_SEARCH;
-    }
 
     if (in_handler)
        write_log ("JIT: Argh --- Am already in a handler. Shouldn't happen!\n");
index 42b3a55c1d0bf4f7b61c809eaad446159c371586..e602be4da08101ad3430c2c14783934059b83959 100755 (executable)
--- a/memory.c
+++ b/memory.c
@@ -145,173 +145,180 @@ static struct romheader romheaders[] = {
 };
 
 #define ALTROM(id,grp,num,size,flags,crc32,a,b,c,d,e) \
-    { "X", 0, 0, 0, 0, 0, size, id, 0, 0, flags, (grp << 16) | num, 0, crc32, a, b, c, d, e },
+    { "X", 0, 0, 0, 0, 0, size, id, 0, 0, flags, (grp << 16) | num, 0, NULL, crc32, a, b, c, d, e },
+#define ALTROMPN(id,grp,num,size,flags,pn,crc32,a,b,c,d,e) \
+    { "X", 0, 0, 0, 0, 0, size, id, 0, 0, flags, (grp << 16) | num, 0, pn, crc32, a, b, c, d, e },
 
 static struct romdata roms[] = {
-    { "Cloanto Amiga Forever ROM key", 0, 0, 0, 0, 0, 2069, 0, 0, 1, ROMTYPE_KEY, 0, 0,
+    { "Cloanto Amiga Forever ROM key", 0, 0, 0, 0, 0, 2069, 0, 0, 1, ROMTYPE_KEY, 0, 0, NULL,
        0x869ae1b1, 0x801bbab3,0x2e3d3738,0x6dd1636d,0x4f1d6fa7,0xe21d5874 },
-    { "Cloanto Amiga Forever 2006 ROM key", 0, 0, 0, 0, 0, 750, 48, 0, 1, ROMTYPE_KEY, 0, 0,
+    { "Cloanto Amiga Forever 2006 ROM key", 0, 0, 0, 0, 0, 750, 48, 0, 1, ROMTYPE_KEY, 0, 0, NULL,
        0xb01c4b56, 0xbba8e5cd,0x118b8d92,0xafed5693,0x5eeb9770,0x2a662d8f },
 
-    { "KS ROM v1.0 (A1000)(NTSC)", 1, 0, 1, 0, "A1000\0", 262144, 1, 0, 0, ROMTYPE_KICK, 0, 0,
+    { "KS ROM v1.0 (A1000)(NTSC)", 1, 0, 1, 0, "A1000\0", 262144, 1, 0, 0, ROMTYPE_KICK, 0, 0, NULL,
        0x299790ff, 0x00C15406,0xBEB4B8AB,0x1A16AA66,0xC05860E1,0xA7C1AD79 },
-    { "KS ROM v1.1 (A1000)(NTSC)", 1, 1, 31, 34, "A1000\0", 262144, 2, 0, 0, ROMTYPE_KICK, 0, 0,
+    { "KS ROM v1.1 (A1000)(NTSC)", 1, 1, 31, 34, "A1000\0", 262144, 2, 0, 0, ROMTYPE_KICK, 0, 0, NULL,
        0xd060572a, 0x4192C505,0xD130F446,0xB2ADA6BD,0xC91DAE73,0x0ACAFB4C},
-    { "KS ROM v1.1 (A1000)(PAL)", 1, 1, 31, 34, "A1000\0", 262144, 3, 0, 0, ROMTYPE_KICK, 0, 0,
+    { "KS ROM v1.1 (A1000)(PAL)", 1, 1, 31, 34, "A1000\0", 262144, 3, 0, 0, ROMTYPE_KICK, 0, 0, NULL,
        0xec86dae2, 0x16DF8B5F,0xD524C5A1,0xC7584B24,0x57AC15AF,0xF9E3AD6D },
-    { "KS ROM v1.2 (A1000)", 1, 2, 33, 166, "A1000\0", 262144, 4, 0, 0, ROMTYPE_KICK, 0, 0,
+    { "KS ROM v1.2 (A1000)", 1, 2, 33, 166, "A1000\0", 262144, 4, 0, 0, ROMTYPE_KICK, 0, 0, NULL,
        0x9ed783d0, 0x6A7BFB5D,0xBD6B8F17,0x9F03DA84,0xD8D95282,0x67B6273B },
-    { "KS ROM v1.2 (A500,A1000,A2000)", 1, 2, 33, 180, "A500\0A1000\0A2000\0", 262144, 5, 0, 0, ROMTYPE_KICK, 0, 0,
+    { "KS ROM v1.2 (A500,A1000,A2000)", 1, 2, 33, 180, "A500\0A1000\0A2000\0", 262144, 5, 0, 0, ROMTYPE_KICK, 0, 0, "315093-01",
        0xa6ce1636, 0x11F9E62C,0xF299F721,0x84835B7B,0x2A70A163,0x33FC0D88 },
-    { "KS ROM v1.3 (A500,A1000,A2000)", 1, 3, 34, 5, "A500\0A1000\0A2000\0", 262144, 6, 0, 0, ROMTYPE_KICK, 0, 0,
+    { "KS ROM v1.3 (A500,A1000,A2000)", 1, 3, 34, 5, "A500\0A1000\0A2000\0", 262144, 6, 0, 0, ROMTYPE_KICK, 0, 0, "315093-02",
        0xc4f0f55f, 0x891E9A54,0x7772FE0C,0x6C19B610,0xBAF8BC4E,0xA7FCB785 },
-    { "KS ROM v1.3 (A3000)(SK)", 1, 3, 34, 5, "A3000\0", 262144, 32, 0, 0, ROMTYPE_KICK, 0, 0,
+    { "KS ROM v1.3 (A3000)(SK)", 1, 3, 34, 5, "A3000\0", 262144, 32, 0, 0, ROMTYPE_KICK, 0, 0, NULL,
        0xe0f37258, 0xC39BD909,0x4D4E5F4E,0x28C1411F,0x30869504,0x06062E87 },
-    { "KS ROM v1.4 (A3000)", 1, 4, 36, 16, "A3000\0", 524288, 59, 3, 0, ROMTYPE_KICK, 0, 0,
+    { "KS ROM v1.4 (A3000)", 1, 4, 36, 16, "A3000\0", 524288, 59, 3, 0, ROMTYPE_KICK, 0, 0, NULL,
        0xbc0ec13f, 0xF76316BF,0x36DFF14B,0x20FA349E,0xD02E4B11,0xDD932B07 },
-    ALTROM(59, 1, 1, 262144, ROMTYPE_EVEN, 0x58327536,0xd1713d7f,0x31474a59,0x48e6d488,0xe3368606,0x1cf3d1e2)
-    ALTROM(59, 1, 2, 262144, ROMTYPE_ODD , 0xfe2f7fb9,0xc05c9c52,0xd014c66f,0x9019152b,0x3f2a2adc,0x2c678794)
-    { "KS ROM v2.04 (A500+)", 2, 4, 37, 175, "A500+\0", 524288, 7, 0, 0, ROMTYPE_KICK, 0, 0,
+    ALTROMPN(59, 1, 1, 262144, ROMTYPE_EVEN, "390629-02", 0x58327536,0xd1713d7f,0x31474a59,0x48e6d488,0xe3368606,0x1cf3d1e2)
+    ALTROMPN(59, 1, 2, 262144, ROMTYPE_ODD , "390630-02", 0xfe2f7fb9,0xc05c9c52,0xd014c66f,0x9019152b,0x3f2a2adc,0x2c678794)
+    { "KS ROM v2.04 (A500+)", 2, 4, 37, 175, "A500+\0", 524288, 7, 0, 0, ROMTYPE_KICK, 0, 0, "390979-01",
        0xc3bdb240, 0xC5839F5C,0xB98A7A89,0x47065C3E,0xD2F14F5F,0x42E334A1 },
-    { "KS ROM v2.05 (A600)", 2, 5, 37, 299, "A600\0", 524288, 8, 0, 0, ROMTYPE_KICK, 0, 0,
+    { "KS ROM v2.05 (A600)", 2, 5, 37, 299, "A600\0", 524288, 8, 0, 0, ROMTYPE_KICK, 0, 0, "391388-01",
        0x83028fb5, 0x87508DE8,0x34DC7EB4,0x7359CEDE,0x72D2E3C8,0xA2E5D8DB },
-    { "KS ROM v2.05 (A600HD)", 2, 5, 37, 300, "A600HD\0A600\0", 524288, 9, 0, 0, ROMTYPE_KICK, 0, 0,
+    { "KS ROM v2.05 (A600HD)", 2, 5, 37, 300, "A600HD\0A600\0", 524288, 9, 0, 0, ROMTYPE_KICK, 0, 0, "391304-01",
        0x64466c2a, 0xF72D8914,0x8DAC39C6,0x96E30B10,0x859EBC85,0x9226637B },
-    { "KS ROM v2.05 (A600HD)", 2, 5, 37, 350, "A600HD\0A600\0", 524288, 10, 0, 0, ROMTYPE_KICK, 0, 0,
+    { "KS ROM v2.05 (A600HD)", 2, 5, 37, 350, "A600HD\0A600\0", 524288, 10, 0, 0, ROMTYPE_KICK, 0, 0, "391304-02",
        0x43b0df7b, 0x02843C42,0x53BBD29A,0xBA535B0A,0xA3BD9A85,0x034ECDE4 },
-    { "KS ROM v2.04 (A3000)", 2, 4, 37, 175, "A3000\0", 524288, 71, 3, 0, ROMTYPE_KICK, 0, 0,
+    { "KS ROM v2.04 (A3000)", 2, 4, 37, 175, "A3000\0", 524288, 71, 3, 0, ROMTYPE_KICK, 0, 0, NULL,
        0x234a7233, 0xd82ebb59,0xafc53540,0xddf2d718,0x7ecf239b,0x7ea91590 },
-    ALTROM(71, 1, 1, 262144, ROMTYPE_EVEN, 0x7db1332b,0x48f14b31,0x279da675,0x7848df6f,0xeb531881,0x8f8f576c)
-    ALTROM(71, 1, 2, 262144, ROMTYPE_ODD , 0xa245dbdf,0x83bab8e9,0x5d378b55,0xb0c6ae65,0x61385a96,0xf638598f)
+    ALTROMPN(71, 1, 1, 262144, ROMTYPE_EVEN, "390629-03", 0x7db1332b,0x48f14b31,0x279da675,0x7848df6f,0xeb531881,0x8f8f576c)
+    ALTROMPN(71, 1, 2, 262144, ROMTYPE_ODD , "390630-03", 0xa245dbdf,0x83bab8e9,0x5d378b55,0xb0c6ae65,0x61385a96,0xf638598f)
 
-    { "KS ROM v3.0 (A1200)", 3, 0, 39, 106, "A1200\0", 524288, 11, 0, 0, ROMTYPE_KICK, 0, 0,
+    { "KS ROM v3.0 (A1200)", 3, 0, 39, 106, "A1200\0", 524288, 11, 0, 0, ROMTYPE_KICK, 0, 0, NULL,
        0x6c9b07d2, 0x70033828,0x182FFFC7,0xED106E53,0x73A8B89D,0xDA76FAA5 },
-    ALTROM(11, 1, 1, 262144, ROMTYPE_EVEN, 0xc742a412,0x999eb81c,0x65dfd07a,0x71ee1931,0x5d99c7eb,0x858ab186)
-    ALTROM(11, 1, 2, 262144, ROMTYPE_ODD , 0xd55c6ec6,0x3341108d,0x3a402882,0xb5ef9d3b,0x242cbf3c,0x8ab1a3e9)
-    { "KS ROM v3.0 (A4000)", 3, 0, 39, 106, "A4000\0", 524288, 12, 2 | 4, 0, ROMTYPE_KICK, 0, 0,
+    ALTROMPN(11, 1, 1, 262144, ROMTYPE_EVEN, "391523-01", 0xc742a412,0x999eb81c,0x65dfd07a,0x71ee1931,0x5d99c7eb,0x858ab186)
+    ALTROMPN(11, 1, 2, 262144, ROMTYPE_ODD , "391524-01", 0xd55c6ec6,0x3341108d,0x3a402882,0xb5ef9d3b,0x242cbf3c,0x8ab1a3e9)
+    { "KS ROM v3.0 (A4000)", 3, 0, 39, 106, "A4000\0", 524288, 12, 2 | 4, 0, ROMTYPE_KICK, 0, 0, NULL,
        0x9e6ac152, 0xF0B4E9E2,0x9E12218C,0x2D5BD702,0x0E4E7852,0x97D91FD7 },
-    ALTROM(12, 1, 1, 262144, ROMTYPE_EVEN, 0x36f64dd0,0x196e9f3f,0x9cad934e,0x181c07da,0x33083b1f,0x0a3c702f)
-    ALTROM(12, 1, 2, 262144, ROMTYPE_ODD , 0x17266a55,0x42fbed34,0x53d1f11c,0xcbde89a9,0x826f2d11,0x75cca5cc)
-    { "KS ROM v3.1 (A4000)", 3, 1, 40, 70, "A4000\0", 524288, 13, 2 | 4, 0, ROMTYPE_KICK, 0, 0,
+    ALTROMPN(12, 1, 1, 262144, ROMTYPE_EVEN, "319513-02", 0x36f64dd0,0x196e9f3f,0x9cad934e,0x181c07da,0x33083b1f,0x0a3c702f)
+    ALTROMPN(12, 1, 2, 262144, ROMTYPE_ODD , "319514-02", 0x17266a55,0x42fbed34,0x53d1f11c,0xcbde89a9,0x826f2d11,0x75cca5cc)
+    { "KS ROM v3.1 (A4000)", 3, 1, 40, 70, "A4000\0", 524288, 13, 2 | 4, 0, ROMTYPE_KICK, 0, 0, NULL,
        0x2b4566f1, 0x81c631dd,0x096bbb31,0xd2af9029,0x9c76b774,0xdb74076c },
     ALTROM(13, 1, 1, 262144, ROMTYPE_EVEN, 0xf9cbecc9,0x138d8cb4,0x3b8312fe,0x16d69070,0xde607469,0xb3d4078e)
     ALTROM(13, 1, 2, 262144, ROMTYPE_ODD , 0xf8248355,0xc2379547,0x9fae3910,0xc185512c,0xa268b82f,0x1ae4fe05)
-    { "KS ROM v3.1 (A500,A600,A2000)", 3, 1, 40, 63, "A500\0A600\0A2000\0", 524288, 14, 0, 0, ROMTYPE_KICK, 0, 0,
+    { "KS ROM v3.1 (A500,A600,A2000)", 3, 1, 40, 63, "A500\0A600\0A2000\0", 524288, 14, 0, 0, ROMTYPE_KICK, 0, 0, NULL,
        0xfc24ae0d, 0x3B7F1493,0xB27E2128,0x30F989F2,0x6CA76C02,0x049F09CA },
-    { "KS ROM v3.1 (A1200)", 3, 1, 40, 68, "A1200\0", 524288, 15, 1, 0, ROMTYPE_KICK, 0, 0,
+    { "KS ROM v3.1 (A1200)", 3, 1, 40, 68, "A1200\0", 524288, 15, 1, 0, ROMTYPE_KICK, 0, 0, NULL,
        0x1483a091, 0xE2154572,0x3FE8374E,0x91342617,0x604F1B3D,0x703094F1 },
-    ALTROM(15, 1, 1, 262144, ROMTYPE_EVEN, 0x08dbf275,0xb8800f5f,0x90929810,0x9ea69690,0xb1b8523f,0xa22ddb37)
-    ALTROM(15, 1, 2, 262144, ROMTYPE_ODD , 0x16c07bf8,0x90e331be,0x1970b0e5,0x3f53a9b0,0x390b51b5,0x9b3869c2)
-    { "KS ROM v3.1 (A3000)", 3, 1, 40, 68, "A3000\0", 524288, 61, 2, 0, ROMTYPE_KICK, 0, 0,
+    ALTROMPN(15, 1, 1, 262144, ROMTYPE_EVEN, "391773-01", 0x08dbf275,0xb8800f5f,0x90929810,0x9ea69690,0xb1b8523f,0xa22ddb37)
+    ALTROMPN(15, 1, 2, 262144, ROMTYPE_ODD , "391774-01", 0x16c07bf8,0x90e331be,0x1970b0e5,0x3f53a9b0,0x390b51b5,0x9b3869c2)
+    { "KS ROM v3.1 (A3000)", 3, 1, 40, 68, "A3000\0", 524288, 61, 2, 0, ROMTYPE_KICK, 0, 0, NULL,
        0xefb239cc, 0xF8E210D7,0x2B4C4853,0xE0C9B85D,0x223BA20E,0x3D1B36EE },
     ALTROM(61, 1, 1, 262144, ROMTYPE_EVEN, 0x286b9a0d,0x6763a225,0x8ec493f7,0x408cf663,0x110dae9a,0x17803ad1)
     ALTROM(61, 1, 2, 262144, ROMTYPE_ODD , 0x0b8cde6a,0x5f02e97b,0x48ebbba8,0x7d516a56,0xb0400c6f,0xc3434d8d)
-    { "KS ROM v3.1 (A4000)(Cloanto)", 3, 1, 40, 68, "A4000\0", 524288, 31, 2 | 4, 1, ROMTYPE_KICK, 0, 0,
+    { "KS ROM v3.1 (A4000)(Cloanto)", 3, 1, 40, 68, "A4000\0", 524288, 31, 2 | 4, 1, ROMTYPE_KICK, 0, 0, NULL,
        0x43b6dd22, 0xC3C48116,0x0866E60D,0x085E436A,0x24DB3617,0xFF60B5F9 },
-    { "KS ROM v3.1 (A4000)", 3, 1, 40, 68, "A4000\0", 524288, 16, 2 | 4, 0, ROMTYPE_KICK, 0, 0,
+    { "KS ROM v3.1 (A4000)", 3, 1, 40, 68, "A4000\0", 524288, 16, 2 | 4, 0, ROMTYPE_KICK, 0, 0, NULL,
        0xd6bae334, 0x5FE04842,0xD04A4897,0x20F0F4BB,0x0E469481,0x99406F49 },
     ALTROM(16, 1, 1, 262144, ROMTYPE_EVEN, 0xb2af34f8,0x24e52b5e,0xfc020495,0x17387ab7,0xb1a1475f,0xc540350e)
     ALTROM(16, 1, 2, 262144, ROMTYPE_ODD , 0xe65636a3,0x313c7cbd,0xa5779e56,0xf19a41d3,0x4e760f51,0x7626d882)
-    { "KS ROM v3.1 (A4000T)", 3, 1, 40, 70, "A4000T\0", 524288, 17, 2 | 4, 0, ROMTYPE_KICK, 0, 0,
+    { "KS ROM v3.1 (A4000T)", 3, 1, 40, 70, "A4000T\0", 524288, 17, 2 | 4, 0, ROMTYPE_KICK, 0, 0, NULL,
        0x75932c3a, 0xB0EC8B84,0xD6768321,0xE01209F1,0x1E6248F2,0xF5281A21 },
-    ALTROM(17, 1, 1, 262144, ROMTYPE_EVEN, 0x0ca94f70,0xb3806eda,0xcb3362fc,0x16a154ce,0x1eeec5bf,0x5bc24789)
-    ALTROM(17, 1, 2, 262144, ROMTYPE_ODD , 0xdfe03120,0xcd7a706c,0x431b04d8,0x7814d3a2,0xd8b39710,0x0cf44c0c)
-    { "KS ROM v3.X (A4000)(Cloanto)", 3, 10, 45, 57, "A4000\0", 524288, 46, 2 | 4, 0, ROMTYPE_KICK, 0, 0,
+    ALTROMPN(17, 1, 1, 262144, ROMTYPE_EVEN, "391657-01", 0x0ca94f70,0xb3806eda,0xcb3362fc,0x16a154ce,0x1eeec5bf,0x5bc24789)
+    ALTROMPN(17, 1, 2, 262144, ROMTYPE_ODD , "391658-01", 0xdfe03120,0xcd7a706c,0x431b04d8,0x7814d3a2,0xd8b39710,0x0cf44c0c)
+    { "KS ROM v3.X (A4000)(Cloanto)", 3, 10, 45, 57, "A4000\0", 524288, 46, 2 | 4, 0, ROMTYPE_KICK, 0, 0, NULL,
        0x08b69382, 0x81D3AEA3,0x0DB7FBBB,0x4AFEE41C,0x21C5ED66,0x2B70CA53 },
 
-    { "CD32 KS ROM v3.1", 3, 1, 40, 60, "CD32\0", 524288, 18, 1, 0, ROMTYPE_KICKCD32, 0, 0,
+    { "CD32 KS ROM v3.1", 3, 1, 40, 60, "CD32\0", 524288, 18, 1, 0, ROMTYPE_KICKCD32, 0, 0, NULL,
        0x1e62d4a5, 0x3525BE88,0x87F79B59,0x29E017B4,0x2380A79E,0xDFEE542D },
-    { "CD32 extended ROM", 3, 1, 40, 60, "CD32\0", 524288, 19, 1, 0, ROMTYPE_EXTCD32, 0, 0,
+    { "CD32 extended ROM", 3, 1, 40, 60, "CD32\0", 524288, 19, 1, 0, ROMTYPE_EXTCD32, 0, 0, NULL,
        0x87746be2, 0x5BEF3D62,0x8CE59CC0,0x2A66E6E4,0xAE0DA48F,0x60E78F7F },
-    { "CD32 ROM (KS + extended)", 3, 1, 40, 60, "CD32\0", 2 * 524288, 64, 1, 0, ROMTYPE_KICKCD32 | ROMTYPE_EXTCD32, 0, 0,
-       0xd3837ae4, 0x06807db3,0x18163745,0x5f4d4658,0x2d9972af,0xec8956d9 },
-    { "CD32 MPEG Cartridge ROM", 3, 1, 40, 30, "CD32\0", 262144, 23, 1, 0, ROMTYPE_CD32CART, 0, 0,
+
+    /* plain CD32 rom */
+    { "CD32 ROM (KS + extended)", 3, 1, 40, 60, "CD32\0", 2 * 524288, 64, 1, 0, ROMTYPE_KICKCD32 | ROMTYPE_EXTCD32 | ROMTYPE_CD32, 0, 0, NULL,
+       0xf5d4f3c8, 0x9fa14825,0xc40a2475,0xa2eba5cf,0x325bd483,0xc447e7c1 },
+    /* real CD32 rom dump 391640-03 */
+    ALTROMPN(64, 1, 1, 2 * 524288, ROMTYPE_CD32, "391640-03", 0xa4fbc94a, 0x816ce6c5,0x07787585,0x0c7d4345,0x2230a9ba,0x3a2902db )
+   
+    { "CD32 MPEG Cartridge ROM", 3, 1, 40, 30, "CD32\0", 262144, 23, 1, 0, ROMTYPE_CD32CART, 0, 0, NULL,
        0xc35c37bf, 0x03ca81c7,0xa7b259cf,0x64bc9582,0x863eca0f,0x6529f435 },
 
-    { "CDTV extended ROM v1.00", 1, 0, 1, 0, "CDTV\0", 262144, 20, 0, 0, ROMTYPE_EXTCDTV, 0, 0,
+    { "CDTV extended ROM v1.00", 1, 0, 1, 0, "CDTV\0", 262144, 20, 0, 0, ROMTYPE_EXTCDTV, 0, 0, NULL,
        0x42baa124, 0x7BA40FFA,0x17E500ED,0x9FED041F,0x3424BD81,0xD9C907BE },
     ALTROM(20, 1, 1, 131072, ROMTYPE_EVEN | ROMTYPE_8BIT, 0x791cb14b,0x277a1778,0x92449635,0x3ffe56be,0x68063d2a,0x334360e4)
     ALTROM(20, 1, 2, 131072, ROMTYPE_ODD  | ROMTYPE_8BIT, 0xaccbbc2e,0x41b06d16,0x79c6e693,0x3c3378b7,0x626025f7,0x641ebc5c)
-    { "CDTV extended ROM v2.07", 2, 7, 2, 7, "CDTV\0", 262144, 22, 0, 0, ROMTYPE_EXTCDTV, 0, 0,
+    { "CDTV extended ROM v2.07", 2, 7, 2, 7, "CDTV\0", 262144, 22, 0, 0, ROMTYPE_EXTCDTV, 0, 0, NULL,
        0xceae68d2, 0x5BC114BB,0xA29F60A6,0x14A31174,0x5B3E2464,0xBFA06846 },
     ALTROM(22, 1, 1, 131072, ROMTYPE_EVEN | ROMTYPE_8BIT, 0x36d73cb8,0x9574e546,0x4b390697,0xf28f9a43,0x4e604e5e,0xf5e5490a)
     ALTROM(22, 1, 2, 131072, ROMTYPE_ODD  | ROMTYPE_8BIT, 0x6e84dce7,0x01a0679e,0x895a1a0f,0x559c7253,0xf539606b,0xd447b54f)
-    { "CDTV extended ROM v2.30", 2, 30, 2, 30, "CDTV\0", 262144, 21, 0, 0, ROMTYPE_EXTCDTV, 0, 0,
+    { "CDTV/A570 extended ROM v2.30", 2, 30, 2, 30, "CDTV\0", 262144, 21, 0, 0, ROMTYPE_EXTCDTV, 0, 0, "391298-01",
        0x30b54232, 0xED7E461D,0x1FFF3CDA,0x321631AE,0x42B80E3C,0xD4FA5EBB },
     ALTROM(21, 1, 1, 131072, ROMTYPE_EVEN | ROMTYPE_8BIT, 0x48e4d74f,0x54946054,0x2269e410,0x36018402,0xe1f6b855,0xfd89092b)
     ALTROM(21, 1, 2, 131072, ROMTYPE_ODD  | ROMTYPE_8BIT, 0x8a54f362,0x03df800f,0x032046fd,0x892f6e7e,0xec08b76d,0x33981e8c)
 
-    { "A1000 bootstrap ROM", 0, 0, 0, 0, "A1000\0", 65536, 24, 0, 0, ROMTYPE_KICK, 0, 0,
+    { "A1000 bootstrap ROM", 0, 0, 0, 0, "A1000\0", 65536, 24, 0, 0, ROMTYPE_KICK, 0, 0, NULL,
        0x0b1ad2d0, 0xBA93B8B8,0x5CA0D83A,0x68225CC3,0x3B95050D,0x72D2FDD7 },
     ALTROM(24, 1, 1, 8192,           0, 0x62f11c04, 0xC87F9FAD,0xA4EE4E69,0xF3CCA0C3,0x6193BE82,0x2B9F5FE6)
-    ALTROM(24, 2, 1, 4096, ROMTYPE_EVEN | ROMTYPE_8BIT, 0x42553bc4,0x8855a97f,0x7a44e3f6,0x2d1c88d9,0x38fee1f4,0xc606af5b)
-    ALTROM(24, 2, 2, 4096, ROMTYPE_ODD  | ROMTYPE_8BIT, 0x8e5b9a37,0xd10f1564,0xb99f5ffe,0x108fa042,0x362e877f,0x569de2c3)
+    ALTROMPN(24, 2, 1, 4096, ROMTYPE_EVEN | ROMTYPE_8BIT, "252179-01", 0x42553bc4,0x8855a97f,0x7a44e3f6,0x2d1c88d9,0x38fee1f4,0xc606af5b)
+    ALTROMPN(24, 2, 2, 4096, ROMTYPE_ODD  | ROMTYPE_8BIT, "252180-01", 0x8e5b9a37,0xd10f1564,0xb99f5ffe,0x108fa042,0x362e877f,0x569de2c3)
 
-    { "Freezer: Action Replay Mk I v1.00", 1, 0, 1, 0, "AR\0", 65536, 52, 0, 0, ROMTYPE_AR, 0, 1,
+    { "Freezer: Action Replay Mk I v1.00", 1, 0, 1, 0, "AR\0", 65536, 52, 0, 0, ROMTYPE_AR, 0, 1, NULL,
        0x2d921771, 0x1EAD9DDA,0x2DAD2914,0x6441F5EF,0x72183750,0x22E01248 },
     ALTROM(52, 1, 1, 32768, ROMTYPE_EVEN | ROMTYPE_8BIT, 0x82d6eb87, 0x7c9bac11,0x28666017,0xeee6f019,0x63fb3890,0x7fbea355)
     ALTROM(52, 1, 2, 32768, ROMTYPE_ODD  | ROMTYPE_8BIT, 0x40ae490c, 0x81d8e432,0x01b73fd9,0x2e204ebd,0x68af8602,0xb62ce397)
-    { "Freezer: Action Replay Mk I v1.50", 1, 50, 1, 50, "AR\0", 65536, 25, 0, 0, ROMTYPE_AR, 0, 1,
+    { "Freezer: Action Replay Mk I v1.50", 1, 50, 1, 50, "AR\0", 65536, 25, 0, 0, ROMTYPE_AR, 0, 1, NULL,
        0xd4ce0675, 0x843B433B,0x2C56640E,0x045D5FDC,0x854DC6B1,0xA4964E7C },
     ALTROM(25, 1, 1, 32768, ROMTYPE_EVEN | ROMTYPE_8BIT, 0x7fbd6de2, 0xb5f71a5c,0x09d65ecc,0xa8a3bc93,0x93558461,0xca190228)
     ALTROM(25, 1, 2, 32768, ROMTYPE_ODD  | ROMTYPE_8BIT, 0x43018069, 0xad8ff242,0xb2cbf125,0x1fc53a73,0x581cf57a,0xb69cee00)
-    { "Freezer: Action Replay Mk II v2.05", 2, 5, 2, 5, "AR\0", 131072, 26, 0, 0, ROMTYPE_AR, 0, 1,
+    { "Freezer: Action Replay Mk II v2.05", 2, 5, 2, 5, "AR\0", 131072, 26, 0, 0, ROMTYPE_AR, 0, 1, NULL,
        0x1287301f, 0xF6601DE8,0x888F0050,0x72BF562B,0x9F533BBC,0xAF1B0074 },
-    { "Freezer: Action Replay Mk II v2.12", 2, 12, 2, 12, "AR\0", 131072, 27, 0, 0, ROMTYPE_AR, 0, 1,
+    { "Freezer: Action Replay Mk II v2.12", 2, 12, 2, 12, "AR\0", 131072, 27, 0, 0, ROMTYPE_AR, 0, 1, NULL,
        0x804d0361, 0x3194A07A,0x0A82D8B5,0xF2B6AEFA,0x3CA581D6,0x8BA8762B },
-    { "Freezer: Action Replay Mk II v2.14", 2, 14, 2, 14, "AR\0", 131072, 28, 0, 0, ROMTYPE_AR, 0, 1,
+    { "Freezer: Action Replay Mk II v2.14", 2, 14, 2, 14, "AR\0", 131072, 28, 0, 0, ROMTYPE_AR, 0, 1, NULL,
        0x49650e4f, 0x255D6DF6,0x3A4EAB0A,0x838EB1A1,0x6A267B09,0x59DFF634 },
-    { "Freezer: Action Replay Mk III v3.09", 3, 9, 3, 9, "AR\0", 262144, 29, 0, 0, ROMTYPE_AR, 0, 1,
+    { "Freezer: Action Replay Mk III v3.09", 3, 9, 3, 9, "AR\0", 262144, 29, 0, 0, ROMTYPE_AR, 0, 1, NULL,
        0x0ed9b5aa, 0x0FF3170A,0xBBF0CA64,0xC9DD93D6,0xEC0C7A01,0xB5436824 },
-    { "Freezer: Action Replay Mk III v3.17", 3, 17, 3, 17, "AR\0", 262144, 30, 0, 0, ROMTYPE_AR, 0, 1,
+    { "Freezer: Action Replay Mk III v3.17", 3, 17, 3, 17, "AR\0", 262144, 30, 0, 0, ROMTYPE_AR, 0, 1, NULL,
        0xc8a16406, 0x5D4987C2,0xE3FFEA8B,0x1B02E314,0x30EF190F,0x2DB76542 },
-    { "Freezer: Action Replay 1200", 0, 0, 0, 0, "AR\0", 262144, 47, 0, 0, ROMTYPE_AR, 0, 1,
+    { "Freezer: Action Replay 1200", 0, 0, 0, 0, "AR\0", 262144, 47, 0, 0, ROMTYPE_AR, 0, 1, NULL,
        0x8d760101, 0x0F6AB834,0x2810094A,0xC0642F62,0xBA42F78B,0xC0B07E6A },
 
-    { "Freezer: Action Cartridge Super IV Professional", 0, 0, 0, 0, "SUPERIV\0", 0, 62, 0, 0, ROMTYPE_SUPERIV, 0, 1,
+    { "Freezer: Action Cartridge Super IV Professional", 0, 0, 0, 0, "SUPERIV\0", 0, 62, 0, 0, ROMTYPE_SUPERIV, 0, 1, NULL,
        0xffffffff, 0, 0, 0, 0, 0, "SuperIV" },
-    { "Freezer: Action Cart. Super IV Pro (+ROM v4.3)", 4, 3, 4, 3, "SUPERIV\0", 170368, 60, 0, 0, ROMTYPE_SUPERIV, 0, 1,
+    { "Freezer: Action Cart. Super IV Pro (+ROM v4.3)", 4, 3, 4, 3, "SUPERIV\0", 170368, 60, 0, 0, ROMTYPE_SUPERIV, 0, 1, NULL,
        0xe668a0be, 0x633A6E65,0xA93580B8,0xDDB0BE9C,0x9A64D4A1,0x7D4B4801 },
-    { "Freezer: X-Power Professional 500 v1.2", 1, 2, 1, 2, "XPOWER\0", 131072, 65, 0, 0, ROMTYPE_XPOWER, 0, 1,
+    { "Freezer: X-Power Professional 500 v1.2", 1, 2, 1, 2, "XPOWER\0", 131072, 65, 0, 0, ROMTYPE_XPOWER, 0, 1, NULL,
        0x9e70c231, 0xa2977a1c,0x41a8ca7d,0x4af4a168,0x726da542,0x179d5963 },
     ALTROM(65, 1, 1, 65536, ROMTYPE_EVEN|ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0xf98742e4,0xe8e683ba,0xd8b38d1f,0x79f3ad83,0xa9e67c6f,0xa91dc96c)
     ALTROM(65, 1, 2, 65536, ROMTYPE_ODD |ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0xdfb9984b,0x8d6bdd49,0x469ec8e2,0x0143fbb3,0x72e92500,0x99f07910)
-    { "Freezer: X-Power Professional 500 v1.3", 1, 2, 1, 2, "XPOWER\0", 131072, 68, 0, 0, ROMTYPE_XPOWER, 0, 1,
+    { "Freezer: X-Power Professional 500 v1.3", 1, 2, 1, 2, "XPOWER\0", 131072, 68, 0, 0, ROMTYPE_XPOWER, 0, 1, NULL,
        0x31e057f0, 0x84650266,0x465d1859,0x7fd71dee,0x00775930,0xb7e450ee },
     ALTROM(68, 1, 1, 65536, ROMTYPE_EVEN|ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0x0b2ce0c7,0x45ad5456,0x89192404,0x956f47ce,0xf66a5274,0x57ace33b)
     ALTROM(68, 1, 2, 65536, ROMTYPE_ODD |ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0x34580c35,0x8ad42566,0x7364f238,0x978f4381,0x08f8d5ec,0x470e72ea)
-    { "Freezer: Nordic Power v1.5", 1, 5, 1, 5, "NPOWER\0", 65536, 69, 0, 0, ROMTYPE_NORDIC, 0, 1,
+    { "Freezer: Nordic Power v1.5", 1, 5, 1, 5, "NPOWER\0", 65536, 69, 0, 0, ROMTYPE_NORDIC, 0, 1, NULL,
        0x83b4b21c, 0xc56ced25,0x506a5aab,0x3fa13813,0x4fc9e5ae,0x0f9d3709 },
     ALTROM(69, 1, 1, 32768, ROMTYPE_EVEN|ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0xdd207174,0xae67652d,0x64f5db20,0x0f4b2110,0xee59567f,0xfbd90a1b)
     ALTROM(69, 1, 2, 32768, ROMTYPE_ODD |ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0x8f93d85d,0x73c62d21,0x40c0c092,0x6315b702,0xdd5d0f05,0x3dad7fab)
-    { "Freezer: Nordic Power v2.0", 2, 0, 2, 0, "NPOWER\0", 65536, 67, 0, 0, ROMTYPE_NORDIC, 0, 1,
+    { "Freezer: Nordic Power v2.0", 2, 0, 2, 0, "NPOWER\0", 65536, 67, 0, 0, ROMTYPE_NORDIC, 0, 1, NULL,
        0xa4db2906, 0x0aec68f7,0x25470c89,0x6b699ff4,0x6623dec5,0xc777466e },
     ALTROM(67, 1, 1, 32768, ROMTYPE_EVEN|ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0xb21be46c,0x50dc607c,0xce976bbd,0x3841eaf0,0x591ddc7e,0xa1939ad2)
     ALTROM(67, 1, 2, 32768, ROMTYPE_ODD |ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0x96057aed,0xdd9209e2,0x1d5edfc1,0xcdb52abe,0x93de0f35,0xc43da696)
-    { "Freezer: Nordic Power v3.0", 3, 0, 3, 0, "NPOWER\0", 65536, 70, 0, 0, ROMTYPE_NORDIC, 0, 1,
+    { "Freezer: Nordic Power v3.0", 3, 0, 3, 0, "NPOWER\0", 65536, 70, 0, 0, ROMTYPE_NORDIC, 0, 1, NULL,
        0x72850aef, 0x59c91d1f,0xa8f118f9,0x0bdba05a,0x9ae788d7,0x7a6cc7c9 },
     ALTROM(70, 1, 1, 32768, ROMTYPE_EVEN|ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0xf3330e1f,0x3a597db2,0xb7d11b6c,0xb8e13496,0xc215f223,0x88c4ca3c)
     ALTROM(70, 1, 2, 32768, ROMTYPE_EVEN|ROMTYPE_SCRAMBLED|ROMTYPE_8BIT, 0xee58e0f9,0x4148f4cb,0xb42cec33,0x8ca144de,0xd4f54118,0xe0f185dd)
-    { "Freezer: HRTMon v2.30 (built-in)", 0, 0, 0, 0, "HRTMON\0", 0, 63, 0, 0, ROMTYPE_HRTMON, 0, 1,
+    { "Freezer: HRTMon v2.30 (built-in)", 0, 0, 0, 0, "HRTMON\0", 0, 63, 0, 0, ROMTYPE_HRTMON, 0, 1, NULL,
        0xffffffff, 0, 0, 0, 0, 0, "HRTMon" },
 
-    { "A590/A2091 SCSI boot ROM", 0, 0, 6, 0, "A590\0A2091\0", 16384, 53, 0, 0, ROMTYPE_A2091BOOT, 0, 0,
+    { "A590/A2091 SCSI boot ROM", 0, 0, 6, 0, "A590\0A2091\0", 16384, 53, 0, 0, ROMTYPE_A2091BOOT, 0, 0, NULL,
        0x8396cf4e, 0x5E03BC61,0x8C862ABE,0x7BF79723,0xB4EEF4D2,0x1859A0F2 },
     ALTROM(53, 1, 1, 8192, ROMTYPE_ODD  | ROMTYPE_8BIT, 0xb0b8cf24,0xfcf40175,0x05f4d441,0x814b45d5,0x59c19eab,0x43816b30)
     ALTROM(53, 1, 2, 8192, ROMTYPE_EVEN | ROMTYPE_8BIT, 0x2e77bbff,0x8a098845,0x068f32cf,0xa4d34a27,0x8cd290f6,0x1d35a52c)
-    { "A590/A2091 SCSI boot ROM", 0, 0, 6, 6, "A590\0A2091\0", 16384, 54, 0, 0, ROMTYPE_A2091BOOT, 0, 0,
+    { "A590/A2091 SCSI boot ROM", 0, 0, 6, 6, "A590\0A2091\0", 16384, 54, 0, 0, ROMTYPE_A2091BOOT, 0, 0, NULL,
        0x33e00a7a, 0x739BB828,0xE874F064,0x9360F59D,0x26B5ED3F,0xBC99BB66 },
     ALTROM(54, 1, 1, 8192, ROMTYPE_ODD  | ROMTYPE_8BIT, 0xe536bbb2,0xfd7f8a6d,0xa18c1b02,0xd07eb990,0xc2467a24,0x183ede12)
     ALTROM(54, 1, 2, 8192, ROMTYPE_EVEN | ROMTYPE_8BIT, 0xc0871d25,0xe155f18a,0xbb90cf82,0x0589c15e,0x70559d3b,0x6b391af8)
-    { "A590/A2091 SCSI boot ROM", 0, 0, 7, 0, "A590\0A2091\0", 16384, 55, 0, 0, ROMTYPE_A2091BOOT, 0, 0,
+    { "A590/A2091 SCSI boot ROM", 0, 0, 7, 0, "A590\0A2091\0", 16384, 55, 0, 0, ROMTYPE_A2091BOOT, 0, 0, NULL,
        0x714a97a2, 0xE50F01BA,0xF2899892,0x85547863,0x72A82C33,0x3C91276E },
     ALTROM(55, 1, 1, 8192, ROMTYPE_ODD  | ROMTYPE_8BIT, 0xa9ccffed,0x149f5bd5,0x2e2d2990,0x4e3de483,0xb9ad7724,0x48e9278e)
     ALTROM(55, 1, 2, 8192, ROMTYPE_EVEN | ROMTYPE_8BIT, 0x2942747a,0xdbd7648e,0x79c75333,0x7ff3e4f4,0x91de224b,0xf05e6bb6)
-    { "A590/A2091 SCSI Guru boot ROM", 0, 0, 6, 14, "A590\0A2091\0", 32768, 56, 0, 0, ROMTYPE_A2091BOOT, 0, 0,
+    { "A590/A2091 SCSI Guru boot ROM", 0, 0, 6, 14, "A590\0A2091\0", 32768, 56, 0, 0, ROMTYPE_A2091BOOT, 0, 0, NULL,
        0x04e52f93, 0x6DA21B6F,0x5E8F8837,0xD64507CD,0x8A4D5CDC,0xAC4F426B },
-    { "A4091 SCSI boot ROM", 0, 0, 40, 9, "A4091\0", 32768, 57, 0, 0, ROMTYPE_A4091BOOT, 0, 0,
+    { "A4091 SCSI boot ROM", 0, 0, 40, 9, "A4091\0", 32768, 57, 0, 0, ROMTYPE_A4091BOOT, 0, 0, NULL,
        0x00000000, 0, 0, 0, 0, 0 },
-    { "A4091 SCSI boot ROM", 0, 0, 40, 13, "A4091\0", 32768, 58, 0, 0, ROMTYPE_A4091BOOT, 0, 0,
+    { "A4091 SCSI boot ROM", 0, 0, 40, 13, "A4091\0", 32768, 58, 0, 0, ROMTYPE_A4091BOOT, 0, 0, NULL,
        0x54cb9e85, 0x3CE66919,0xF6FD6797,0x4923A12D,0x91B730F1,0xFFB4A7BA },
 
     { "Arcadia OnePlay 2.11", 0, 0, 0, 0, "ARCADIA\0", 0, 49, 0, 0, ROMTYPE_ARCADIABIOS, 0, 0 },
@@ -340,16 +347,36 @@ void romlist_clear (void)
 {
     int i;
     int mask = 0;
+    struct romdata *parent;
+    char *pn;
+
     xfree (rl);
     rl = 0;
     romlist_cnt = 0;
+    parent = 0;
+    pn = NULL;
     for (i = 0; roms[i].name; i++) {
        struct romdata *rd = &roms[i];
        if (rd->group == 0) {
+           parent = rd;
            mask = rd->type;
+           pn = parent->partnumber;
        } else {
            rd->type &= ~ROMTYPE_MASK;
            rd->type |= mask & ROMTYPE_MASK;
+           if (rd->partnumber && !pn) {
+               char *newpn;
+               if (parent->partnumber == NULL)
+                   parent->partnumber = my_strdup ("");
+               newpn = xcalloc (strlen (parent->partnumber) + 1 + strlen (rd->partnumber) + 1, 1);
+               if (strlen (parent->partnumber) > 0) {
+                   strcpy (newpn, parent->partnumber);
+                   strcat (newpn, "/");
+               }
+               strcat (newpn, rd->partnumber);
+               xfree (parent->partnumber);
+               parent->partnumber = newpn;
+           }
        }
     }
 }
@@ -907,6 +934,8 @@ void getromname     (struct romdata *rd, char *name)
        sprintf (name + strlen (name), " rev %d.%d", rd->subver, rd->subrev);
     if (rd->size > 0)
        sprintf (name + strlen (name), " (%dk)", (rd->size + 1023) / 1024);
+    if (rd->partnumber && strlen (rd->partnumber) > 0)
+       sprintf (name + strlen (name), " [%s]", rd->partnumber);
 }
 
 struct romlist *getromlistbyromdata(struct romdata *rd)
@@ -2292,6 +2321,27 @@ static void byteswap (uae_u8 *buf, int size)
        buf[i + 1] = t;
     }
 }
+static void mergecd32 (uae_u8 *dst, uae_u8 *src, int size)
+{
+    int i, k;
+    k = 0;
+    for (i = 0; i < size / 2; i += 2) {
+       int j = i + size / 2;
+       dst[k + 1] = src[i + 0];
+       dst[k + 0] = src[i + 1];
+       dst[k + 3] = src[j + 0];
+       dst[k + 2] = src[j + 1];
+       k += 4;
+    }
+#if 0
+    {
+       struct zfile *f;
+       f = zfile_fopen ("c:\\d\\1.rom","wb");
+       zfile_fwrite (dst, 1, size, f);
+       zfile_fclose(f);
+    }
+#endif
+}
 
 static void descramble (struct romdata *rd, uae_u8 *data, int size, int odd)
 {
@@ -2337,8 +2387,10 @@ struct zfile *read_rom (struct romdata **prd)
            memset (buf, 0, size);
            if (!(flags & (ROMTYPE_EVEN | ROMTYPE_ODD))) {
                read_rom_file (buf, rd);
-               if (flags & ROMTYPE_BYTESWAP)
-                   byteswap (buf, size);
+               if (flags & ROMTYPE_CD32) {
+                   memcpy (buf2, buf, size);
+                   mergecd32 (buf, buf2, size);
+               }
                rd++;
                i++;
            } else {
@@ -2498,14 +2550,10 @@ static int load_extendedkickstart (void)
     off = 0;
     if (currprefs.cs_cd32cd) {
        extendedkickmem_type = EXTENDED_ROM_CD32;
-       if (size >= 524288 * 2)
-           off = 524288;
     } else if (currprefs.cs_cdtvcd || currprefs.cs_cdtvram) {
        extendedkickmem_type = EXTENDED_ROM_CDTV;
     } else if (size > 300000) {
        extendedkickmem_type = EXTENDED_ROM_CD32;
-       if (size >= 524288 * 2)
-           off = 524288;
     } else {
        extendedkickmem_type = EXTENDED_ROM_CDTV;
     }
@@ -2686,10 +2734,6 @@ static int load_kickstart (void)
        }
        if (filesize >= 524288 * 2) {
            struct romdata *rd = getromdatabyzfile(f);
-           if (rd && rd->id == 64) {
-               kspos = 0;
-               extpos = 524288;
-           }
            zfile_fseek (f, kspos, SEEK_SET);
        }
        if (filesize >= 524288 * 4) {
index eab8492acc18d45287042bfc5da4addeab685713..9754a09688738d6b6a4d7253b704c838746840aa 100755 (executable)
@@ -271,7 +271,6 @@ const char *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth)
 {
     HRESULT ret;
     static char errmsg[100] = { 0 };
-    LPDIRECT3D9 (WINAPI *D3DCreate)(UINT);
     D3DDISPLAYMODE mode;
     D3DCAPS9 d3dCaps;
     int adapter;
@@ -292,14 +291,7 @@ const char *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth)
        return errmsg;
     }
 
-    D3DCreate = (LPDIRECT3D9 (WINAPI *)(UINT))
-       GetProcAddress(d3dDLL, "Direct3DCreate9");
-    if(D3DCreate == NULL) {
-       D3D_free ();
-       strcpy (errmsg, "Direct3D: DirectX 9 or newer required");
-       return errmsg;
-    }
-    d3d = D3DCreate(D3D9b_SDK_VERSION);
+    d3d = Direct3DCreate9 (D3D9b_SDK_VERSION);
     if (d3d == NULL) {
        D3D_free ();
        strcpy (errmsg, "Direct3D: failed to create D3D object");
@@ -332,7 +324,7 @@ const char *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth)
        }
     }
 
-    ret = IDirect3D9_CreateDevice(d3d, adapter, D3DDEVTYPE_HAL, ahwnd,
+    ret = IDirect3D9_CreateDevice (d3d, adapter, D3DDEVTYPE_HAL, ahwnd,
        USAGE, &dpp, &d3ddev);
     if(FAILED(ret)) {
        sprintf (errmsg, "CreateDevice failed, %s\n", D3D_ErrorString (ret));
index a15e88e06491a99b50dff1260812566a5615e0c3..ffb60757c0c4f84d3bd1440c7faad941bad389fe 100755 (executable)
@@ -6,6 +6,7 @@
 #include "dxwrap.h"
 #include "win32gfx.h"
 
+#include <d3d9.h>
 #include <dxerr9.h>
 
 
@@ -26,6 +27,13 @@ HRESULT DirectDraw_GetDisplayMode (void)
 
 #define releaser(x, y) if (x) { y (x); x = NULL; }
 
+static LPDIRECTDRAWSURFACE7 getlocksurface (void)
+{
+    if (dxdata.backbuffers > 0 && currprefs.gfx_afullscreen > 0 && !WIN32GFX_IsPicassoScreen ())
+       return dxdata.flipping[0];
+    return dxdata.secondary;
+}
+
 static void freemainsurface (void)
 {
     if (dxdata.dclip) {
@@ -58,6 +66,8 @@ void DirectDraw_Release (void)
 int DirectDraw_Start (GUID *guid)
 {
     HRESULT ddrval;
+    LPDIRECT3D9 d3d;
+    D3DCAPS9 d3dCaps;
 
     if (dxdata.ddinit) {
        if (guid == NULL && dxdata.ddzeroguid)
@@ -67,19 +77,28 @@ int DirectDraw_Start (GUID *guid)
        DirectDraw_Release ();
     }
 
-    ddrval = DirectDrawCreate(guid, &dxdata.olddd, NULL);
+    ddrval = DirectDrawCreate (guid, &dxdata.olddd, NULL);
     if (FAILED(ddrval)) {
        if (guid != NULL)
            return 0;
        goto oops;
     }
-    ddrval = IDirectDraw_QueryInterface(dxdata.olddd, &IID_IDirectDraw7, (LPVOID*)&dxdata.maindd);
+    ddrval = IDirectDraw_QueryInterface (dxdata.olddd, &IID_IDirectDraw7, (LPVOID*)&dxdata.maindd);
     if(FAILED(ddrval)) {
        gui_message("start_ddraw(): DirectX 7 or newer required");
        DirectDraw_Release();
        return 0;
     }
 
+    dxdata.maxwidth = 16384;
+    dxdata.maxheight = 16384;
+    d3d = Direct3DCreate9 (D3D9b_SDK_VERSION);
+    if (d3d) {
+       IDirect3D9_GetDeviceCaps (d3d, 0, D3DDEVTYPE_HAL, &d3dCaps);
+       dxdata.maxwidth = d3dCaps.MaxTextureWidth;
+       dxdata.maxheight = d3dCaps.MaxTextureHeight;
+    }
+
     if (SUCCEEDED(DirectDraw_GetDisplayMode ())) {
        dxdata.ddinit = 1;
        dxdata.ddzeroguid = 1;
@@ -109,7 +128,7 @@ HRESULT restoresurface (LPDIRECTDRAWSURFACE7 surf)
     return ddrval;
 }
 
-void clearsurface (LPDIRECTDRAWSURFACE7 surf)
+static void clearsurf (LPDIRECTDRAWSURFACE7 surf)
 {
     HRESULT ddrval;
     DDBLTFX ddbltfx;
@@ -128,9 +147,16 @@ void clearsurface (LPDIRECTDRAWSURFACE7 surf)
            break;
        }
     }
+}
 
+void clearsurface (LPDIRECTDRAWSURFACE7 surf)
+{
+    if (surf == NULL)
+       surf = getlocksurface ();
+    clearsurf (surf);
 }
 
+
 int locksurface (LPDIRECTDRAWSURFACE7 surf, LPDDSURFACEDESC2 desc)
 {
     HRESULT ddrval;
@@ -165,6 +191,8 @@ LPDIRECTDRAWSURFACE7 allocsurface (int width, int height)
     desc.dwSize = sizeof (desc);
     desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
     desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
+    if (width > dxdata.maxwidth || height > dxdata.maxheight)
+       desc.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
     desc.dwWidth = width;
     desc.dwHeight = height;
     memcpy (&desc.ddpfPixelFormat, &dxdata.native.ddpfPixelFormat, sizeof (DDPIXELFORMAT));
@@ -172,7 +200,7 @@ LPDIRECTDRAWSURFACE7 allocsurface (int width, int height)
     if (FAILED (ddrval)) {
        write_log ("IDirectDraw7_CreateSurface: %s\n", DXError (ddrval));
     } else {
-       clearsurface (surf);
+       clearsurf (surf);
     }
     return surf;
 }
@@ -201,18 +229,14 @@ HRESULT DirectDraw_CreateMainSurface (int width, int height)
        DWORD oldflags = desc.dwFlags;
        desc.dwFlags |= DDSD_BACKBUFFERCOUNT;
        desc.ddsCaps.dwCaps |= DDSCAPS_COMPLEX | DDSCAPS_FLIP;
-       desc.dwBackBufferCount = 1;
+       desc.dwBackBufferCount = 2;
        ddrval = IDirectDraw7_CreateSurface (dxdata.maindd, &desc, &dxdata.primary, NULL);
-       if (FAILED (ddrval)) {
-           desc.dwBackBufferCount = 1;
-           ddrval = IDirectDraw7_CreateSurface (dxdata.maindd, &desc, &dxdata.primary, NULL);
-       }
        if (SUCCEEDED (ddrval)) {
            DDSCAPS2 ddscaps;
            memset (&ddscaps, 0, sizeof (ddscaps));
            ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
            ddrval = IDirectDrawSurface7_GetAttachedSurface (dxdata.primary, &ddscaps, &dxdata.flipping[0]);
-           if(SUCCEEDED (ddrval) && desc.dwBackBufferCount > 1) {
+           if(SUCCEEDED (ddrval)) {
                memset (&ddscaps, 0, sizeof (ddscaps));
                ddscaps.dwCaps = DDSCAPS_FLIP;
                ddrval = IDirectDrawSurface7_GetAttachedSurface (dxdata.flipping[0], &ddscaps, &dxdata.flipping[1]);
@@ -236,10 +260,10 @@ HRESULT DirectDraw_CreateMainSurface (int width, int height)
     if (FAILED (ddrval))
        write_log ("IDirectDrawSurface7_GetSurfaceDesc: %s\n", DXError (ddrval));
     if (dxdata.fsmodeset)
-        clearsurface (dxdata.primary);
+        clearsurf (dxdata.primary);
     dxdata.backbuffers = desc.dwBackBufferCount;
-    clearsurface (dxdata.flipping[0]);
-    clearsurface (dxdata.flipping[1]);
+    clearsurf (dxdata.flipping[0]);
+    clearsurf (dxdata.flipping[1]);
     surf = allocsurface (width, height);
     if (surf) {
        dxdata.secondary = surf;
@@ -280,7 +304,7 @@ HRESULT DirectDraw_SetCooperativeLevel (HWND window, int fullscreen)
     HRESULT ddrval;
     
     dxdata.hwnd = window;
-    ddrval = IDirectDraw7_SetCooperativeLevel(dxdata.maindd, window, fullscreen ?
+    ddrval = IDirectDraw7_SetCooperativeLevel (dxdata.maindd, window, fullscreen ?
        DDSCL_ALLOWREBOOT | DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN : DDSCL_NORMAL);
     if (FAILED (ddrval))
        write_log ("IDirectDraw7_SetCooperativeLevel: %s\n", DXError (ddrval));
@@ -425,13 +449,6 @@ DWORD DirectDraw_GetCurrentDepth (void)
     return dxdata.native.ddpfPixelFormat.dwRGBBitCount;
 }
 
-static LPDIRECTDRAWSURFACE7 getlocksurface (void)
-{
-    if (dxdata.backbuffers > 0 && currprefs.gfx_afullscreen > 0 && !WIN32GFX_IsPicassoScreen ())
-       return dxdata.flipping[0];
-    return dxdata.secondary;
-}
-
 int DirectDraw_SurfaceLock (void)
 {
     int ok;
@@ -524,13 +541,41 @@ HRESULT DirectDraw_FlipToGDISurface (void)
     return IDirectDraw7_FlipToGDISurface (dxdata.maindd);
 }
 
+int DirectDraw_BlitToPrimaryScale (RECT *rect)
+{
+    LPDIRECTDRAWSURFACE7 dst;
+    int result = 0;
+    HRESULT ddrval;
+    RECT dstrect;
+    int x = 0, y = 0, w = dxdata.swidth, h = dxdata.sheight;
+
+    dst = dxdata.primary;
+    SetRect (&dstrect, x, y, x + w, y + h);
+    centerdstrect (&dstrect);
+    while (FAILED(ddrval = IDirectDrawSurface7_Blt (dst, &dstrect, dxdata.secondary, rect, DDBLT_WAIT, NULL))) {
+       if (ddrval == DDERR_SURFACELOST) {
+           ddrval = restoresurface (dst);
+           if (FAILED (ddrval))
+               return 0;
+       } else if (ddrval != DDERR_SURFACEBUSY) {
+           write_log ("DirectDraw_BlitToPrimary: %s\n", DXError (ddrval));
+           break;
+       }
+    }
+    if (SUCCEEDED(ddrval))
+       result = 1;
+    return result;
+}
+
 int DirectDraw_BlitToPrimary (RECT *rect)
 {
+    LPDIRECTDRAWSURFACE7 dst;
     int result = 0;
     HRESULT ddrval;
     RECT srcrect, dstrect;
     int x = 0, y = 0, w = dxdata.swidth, h = dxdata.sheight;
 
+    dst = dxdata.primary;
     if (rect) {
        x = rect->left;
        y = rect->top;
@@ -543,10 +588,10 @@ int DirectDraw_BlitToPrimary (RECT *rect)
        h = dxdata.sheight - y;
     SetRect (&srcrect, x, y, x + w, y + h);
     SetRect (&dstrect, x, y, x + w, y + h);
-    centerdstrect (&dstrect, &srcrect);
-    while (FAILED(ddrval = IDirectDrawSurface7_Blt (dxdata.primary, &dstrect, dxdata.secondary, &srcrect, DDBLT_WAIT, NULL))) {
+    centerdstrect (&dstrect);
+    while (FAILED(ddrval = IDirectDrawSurface7_Blt (dst, &dstrect, dxdata.secondary, &srcrect, DDBLT_WAIT, NULL))) {
        if (ddrval == DDERR_SURFACELOST) {
-           ddrval = restoresurface (dxdata.primary);
+           ddrval = restoresurface (dst);
            if (FAILED (ddrval))
                return 0;
        } else if (ddrval != DDERR_SURFACEBUSY) {
@@ -562,11 +607,18 @@ int DirectDraw_BlitToPrimary (RECT *rect)
 static void DirectDraw_Blt (LPDIRECTDRAWSURFACE7 dst, RECT *dstrect, LPDIRECTDRAWSURFACE7 src, RECT *srcrect)
 {
     HRESULT ddrval;
+    DDBLTFX fx = { 0 };
+
+    fx.dwSize = sizeof (fx);
+    fx.dwROP = SRCCOPY;
+
     if (dst == NULL)
        dst = getlocksurface ();
     if (src == NULL)
        src = getlocksurface ();
-    while (FAILED(ddrval = IDirectDrawSurface7_Blt (dst, dstrect, src, srcrect, DDBLT_WAIT, NULL))) {
+    if (dst == src)
+       return;
+    while (FAILED(ddrval = IDirectDrawSurface7_Blt (dst, dstrect, src, srcrect, DDBLT_ROP | DDBLT_WAIT, &fx))) {
        if (ddrval == DDERR_SURFACELOST) {
            ddrval = restoresurface (dst);
            if (FAILED (ddrval))
@@ -620,6 +672,7 @@ static void flip (void)
     static int skip;
 
     if (dxdata.backbuffers == 2) {
+        DirectDraw_Blit (dxdata.flipping[1], dxdata.flipping[0]);
        if (currprefs.gfx_avsync) {
            if (vblank_skip >= 0) {
                skip++;
@@ -641,9 +694,12 @@ static void flip (void)
        } else {
            ddrval = IDirectDrawSurface7_Flip (dxdata.primary, NULL, flags);
        }
-        DirectDraw_Blit (dxdata.flipping[1], dxdata.primary);
     } else if(dxdata.backbuffers == 1) {
-        ddrval = IDirectDrawSurface7_Flip(dxdata.primary, NULL, flags);
+       if (currprefs.gfx_avsync) { 
+           ddrval = IDirectDrawSurface7_Flip (dxdata.primary, NULL, flags);
+       } else {
+           ddrval = IDirectDrawSurface7_Flip (dxdata.primary, NULL, flags | DDFLIP_NOVSYNC);
+       }
         DirectDraw_Blit (dxdata.flipping[0], dxdata.primary);
     }
     if (ddrval == DDERR_SURFACELOST) {
@@ -659,10 +715,15 @@ static void flip (void)
     }
 }
 
-int DirectDraw_Flip (int wait)
+int DirectDraw_Flip (int doflip)
 {
     if (getlocksurface () != dxdata.secondary) {
-       flip ();
+       if (doflip) {
+           flip ();
+           return 1;
+       } else {
+           DirectDraw_Blit (dxdata.primary, getlocksurface ());
+       }
     } else {
        DirectDraw_BlitToPrimary (NULL);
     }
index 8cd74cd624e2c94b8402b245c9e6b344fac89336..e60bbae5f7c0fbd93b69ed9143fd7ad9ee36fa6b 100755 (executable)
@@ -21,6 +21,7 @@ struct ddstuff
     int lockcnt;
     DWORD pitch;
     HWND hwnd;
+    int maxwidth, maxheight;
 };
 extern struct ddstuff dxdata;
 
@@ -165,8 +166,9 @@ int DirectDraw_GetVerticalBlankStatus (void);
 DWORD DirectDraw_CurrentRefreshRate (void);
 void DirectDraw_GetPrimaryPixelFormat (DDSURFACEDESC2 *desc);
 HRESULT DirectDraw_FlipToGDISurface (void);
-int DirectDraw_Flip (int wait);
+int DirectDraw_Flip (int doflip);
 int DirectDraw_BlitToPrimary (RECT *rect);
+int DirectDraw_BlitToPrimaryScale (RECT *rect);
 void DirectDraw_Blit (LPDIRECTDRAWSURFACE7 dst, LPDIRECTDRAWSURFACE7 src);
 void DirectDraw_BlitRect (LPDIRECTDRAWSURFACE7 dst, RECT *dstrect, LPDIRECTDRAWSURFACE7 src, RECT *scrrect);
 void DirectDraw_Fill (RECT *rect, uae_u32 color);
index 5dab8ef624409dc379307eecc46ce46ac91733d6..574b9eef9c8627bfd81d04981f906d8b6276335c 100755 (executable)
@@ -18,7 +18,7 @@
 
 static struct shmid_ds shmids[MAX_SHMID];
 static int memwatchok = 0;
-uae_u8 *natmem_offset = NULL;
+uae_u8 *natmem_offset, *natmem_offset_end;
 static uae_u8 *p96mem_offset;
 static int p96mem_size;
 static SYSTEM_INFO si;
@@ -135,7 +135,7 @@ int mman_GetWriteWatch (PVOID lpBaseAddress, SIZE_T dwRegionSize, PVOID *lpAddre
     int i, j;
 
     if (memwatchok)
-       return GetWriteWatch (WRITE_WATCH_FLAG_RESET, lpBaseAddress, dwRegionSize, lpAddresses, lpdwCount, lpdwGranularity);
+       return GetWriteWatch (0, lpBaseAddress, dwRegionSize, lpAddresses, lpdwCount, lpdwGranularity);
     j = 0;
     for (i = 0; i < p96mem_size / si.dwPageSize; i++) {
        if (j >= *lpdwCount)
@@ -149,7 +149,10 @@ int mman_GetWriteWatch (PVOID lpBaseAddress, SIZE_T dwRegionSize, PVOID *lpAddre
 }
 void mman_ResetWatch (PVOID lpBaseAddress, SIZE_T dwRegionSize)
 {
-    if (!memwatchok) {
+    if (memwatchok) {
+       if (ResetWriteWatch (lpBaseAddress, dwRegionSize))
+           write_log ("ResetWriteWatch() failed, %d\n", GetLastError ());
+    } else {
        DWORD op;
        memset (memwatchtable, 0, p96mem_size / si.dwPageSize);
        if (!VirtualProtect (lpBaseAddress, dwRegionSize, PAGE_READWRITE | PAGE_GUARD, &op))
@@ -234,6 +237,7 @@ int init_shm (void)
     if (natmem_offset)
        VirtualFree(natmem_offset, 0, MEM_RELEASE);
     natmem_offset = NULL;
+    natmem_offset_end = NULL;
     canbang = 0;
 
     z3size = 0;
@@ -325,6 +329,7 @@ restart:
                p96mem_offset, (uae_u8*)p96mem_offset + currprefs.gfxmem_size,
                currprefs.gfxmem_size, currprefs.gfxmem_size >> 20);
        canbang = 1;
+       natmem_offset_end = p96mem_offset + currprefs.gfxmem_size;
     }
 
     return canbang;
index 7b3399f0493ae4ba51c9d1b190d5762a8f181031..539e5229f7e900b19c2bd940afc6bff6e762e85f 100755 (executable)
@@ -46,8 +46,6 @@
 
 #if defined(PICASSO96)
 
-#define USEDX 1
-
 static int hwsprite;
 
 #include "registry.h"
@@ -282,9 +280,8 @@ static void DumpTemplate (struct Template *tmp, unsigned long w, unsigned long h
        write_log ("\n");
     }
 }
-#endif
 
-static void DumpLine( struct Line *line )
+static void DumpLine(struct Line *line)
 {
     if (line) {
        write_log ("Line->X = %d\n", line->X);
@@ -308,7 +305,6 @@ static void DumpLine( struct Line *line )
 
 static void ShowSupportedResolutions (void)
 {
-#if 0
     int i = 0;
 
     write_log ("-----------------\n");
@@ -317,9 +313,14 @@ static void ShowSupportedResolutions (void)
        i++;
     }
     write_log ("-----------------\n");
-#endif
 }
 
+#endif
+
+static void **gwwbuf;
+static int gwwbufsize, gwwpagesize, gwwpagemask;
+extern uae_u8 *natmem_offset;
+
 static uae_u8 GetBytesPerPixel (uae_u32 RGBfmt)
 {
     switch (RGBfmt)
@@ -546,29 +547,32 @@ static void disablemouse (void)
     cursordeactivate = 0;
 }
 
-static int remcursor_x, remcursor_y, newcursor_x, newcursor_y;
+static int remcursor_x, remcursor_y, remcursor_w, remcursor_h;
+static int newcursor_x, newcursor_y;
+static int oldcursor_x, oldcursor_y;
 static void mouseupdate (void)
 {
-    static int ox, oy;
     int fx1, fy1, fx2, fy2;
     int x = newcursor_x;
     int y = newcursor_y;
+    int forced = 0;
 
     if (cursordeactivate > 0) {
        cursordeactivate--;
        if (cursordeactivate == 0) {
            disablemouse ();
            cursorvisible = 0;
+           oldcursor_x = -10000;
        }
+       x = oldcursor_x;
+       y = oldcursor_y;
+       forced = 1;
     }
-    if (!hwsprite)
+    if (oldcursor_x == x && oldcursor_y == y && !forced)
        return;
-    if (!cursorsurface || !cursorvisible)
-       return;
-    if (ox == x && oy == y)
-       return;
-    ox = x;
-    oy = y;
+    oldcursor_x = x;
+    oldcursor_y = y;
+
     if (x <= -cursorwidth)
        x = -cursorwidth;
     if (y <= -cursorheight)
@@ -577,12 +581,20 @@ static void mouseupdate (void)
        x = picasso96_state.Width;
     if (y >= picasso96_state.Height)
        y = picasso96_state.Height;
+
     fx1 = remcursor_x;
     fy1 = remcursor_y;
-    fx2 = fx1 + cursorwidth;
-    fy2 = fy1 + cursorheight;
+    fx2 = fx1 + remcursor_h;
+    fy2 = fy1 + remcursor_w;
+
     remcursor_x = x;
     remcursor_y = y;
+    remcursor_w = cursorwidth;
+    remcursor_h = cursorheight;
+
+    if (fx2 == fx1 || fy1 == fy2)
+       return;
+
     if (x < fx1)
        fx1 = x;
     if (y < fy1)
@@ -861,7 +873,6 @@ STATIC_INLINE void do_blitrect_frame_buffer (struct RenderInfo *ri, struct
     unsigned long dstx, unsigned long dsty, unsigned long width, unsigned
     long height, uae_u8 mask, BLIT_OPCODE opcode)
 {
-
     uae_u8 *src, *dst, *tmp, *tmp2, *tmp3;
     uae_u8 Bpp = GetBytesPerPixel (ri->RGBFormat);
     unsigned long total_width = width * Bpp;
@@ -1006,7 +1017,7 @@ uae_u32 REGPARAM2 picasso_SetSprite (struct regstruct *regs)
        picasso_SetSpriteImage (regs);
        cursorvisible = 1;
     } else {
-       cursordeactivate = 10;
+       cursordeactivate = 2;
     }
     result = 1;
     P96TRACE_SPR (("SetSprite: %d\n", activate));
@@ -1106,19 +1117,21 @@ void picasso_putcursor (int sx, int sy, int sw, int sh)
     if (cursorsurface == NULL || !cursorvisible || !hwsprite)
        return;
 
-    if (remcursor_x + cursorwidth < sx)
+    if (remcursor_x + remcursor_w < sx)
        return;
-    if (remcursor_y + cursorheight < sy)
+    if (remcursor_y + remcursor_h < sy)
        return;
     if (remcursor_x > sx + sw)
        return;
     if (remcursor_y > sy + sh)
        return;
+    if (remcursor_w == 0 || remcursor_h == 0)
+       return;
 
     cursor_r1.left = remcursor_x;
     cursor_r1.top = remcursor_y;
-    cursor_r1.right = cursor_r1.left + cursorwidth;
-    cursor_r1.bottom = cursor_r1.top + cursorheight;
+    cursor_r1.right = cursor_r1.left + remcursor_w;
+    cursor_r1.bottom = cursor_r1.top + remcursor_h;
 
     xdiff = ydiff = 0;
     xdiff2 = ydiff2 = 0;
@@ -1145,8 +1158,8 @@ void picasso_putcursor (int sx, int sy, int sw, int sh)
 
     cursor_r2.left = 0;
     cursor_r2.top = cursorheight;
-    cursor_r2.right = cursorwidth + xdiff2 + xdiff;
-    cursor_r2.bottom = cursorheight + cursorheight + ydiff2 + ydiff;
+    cursor_r2.right = cursorwidth + xdiff + xdiff2;
+    cursor_r2.bottom = cursorheight + cursorheight + ydiff + ydiff2;
 
     ddrval = IDirectDrawSurface7_Blt (cursorsurface, &cursor_r2, dstsurf, &cursor_r1, DDBLT_WAIT, NULL);
     if (FAILED(ddrval)) {
@@ -1157,8 +1170,8 @@ void picasso_putcursor (int sx, int sy, int sw, int sh)
 
     cursor_r2.left = -xdiff2;
     cursor_r2.top = -ydiff2;
-    cursor_r2.right = cursorwidth + xdiff + xdiff2;
-    cursor_r2.bottom = cursorheight + ydiff + ydiff2;
+    cursor_r2.right = cursor_r2.left + cursorwidth + xdiff + xdiff2;
+    cursor_r2.bottom = cursor_r2.top + cursorheight + ydiff + ydiff2;
 
     ddrval = IDirectDrawSurface7_Blt (dstsurf, &cursor_r1, cursorsurface, &cursor_r2, DDBLT_WAIT | DDBLT_KEYSRC, NULL);
     if (FAILED(ddrval)) {
@@ -1169,8 +1182,8 @@ void picasso_putcursor (int sx, int sy, int sw, int sh)
 
     cursor_r2.left = 0;
     cursor_r2.top = cursorheight;
-    cursor_r2.right = cursorwidth + xdiff2 + xdiff;
-    cursor_r2.bottom = cursorheight + cursorheight + ydiff2 + ydiff;
+    cursor_r2.right = cursorwidth + xdiff + xdiff2;
+    cursor_r2.bottom = cursorheight + cursorheight + ydiff + ydiff2;
 
     mouseput = 1;
 }
@@ -1249,6 +1262,7 @@ static uae_u32 setspriteimage (uaecptr bi)
     cursordeactivate = 0;
     if (!hwsprite)
        return 0;
+    oldcursor_x = -10000;
     w = (uae_u32)get_byte (bi + PSSO_BoardInfo_MouseWidth);
     h = (uae_u32)get_byte (bi + PSSO_BoardInfo_MouseHeight);
     tmpbuf = NULL;
@@ -1261,13 +1275,13 @@ static uae_u32 setspriteimage (uaecptr bi)
        doubledsprite = 1;
     updatesprcolors ();
 
-    P96TRACE_SPR (("SetSpriteImage(%08x,%08x,w=%d,h=%d,hires=%d,double=%d,%08x)\n",
+    P96TRACE_SPR (("SetSpriteImage(%08x,%08x,w=%d,h=%d,%d/%d,%08x)\n",
        bi, get_long (bi + PSSO_BoardInfo_MouseImage), w, h,
        hiressprite - 1, doubledsprite, bi + PSSO_BoardInfo_MouseImage));
 
     bpp = picasso_vidinfo.pixbytes;
     if (!w || !h || get_long (bi + PSSO_BoardInfo_MouseImage) == 0) {
-       disablemouse ();
+       cursordeactivate = 1;
        ret = 1;
        goto end;
     }
@@ -1409,9 +1423,7 @@ uae_u32 REGPARAM2 picasso_SetSpriteImage (struct regstruct *regs)
 uae_u32 REGPARAM2 picasso_FindCard (struct regstruct *regs)
 {
     uaecptr AmigaBoardInfo = m68k_areg (regs, 0);
-
     /* NOTES: See BoardInfo struct definition in Picasso96 dev info */
-
     if (allocated_gfxmem && !picasso96_state.CardFound) {
        /* Fill in MemoryBase, MemorySize */
        put_long (AmigaBoardInfo + PSSO_BoardInfo_MemoryBase, gfxmem_start);
@@ -1571,10 +1583,6 @@ static void CopyLibResolutionStructureU2A (struct LibResolution *libres, uaecptr
 
 static int missmodes[] = { 320, 200, 320, 240, 640, 400, 640, 480, -1 };
 
-static void **gwwbuf;
-static int gwwbufsize, gwwpagesize, gwwpagemask;
-extern uae_u8 *natmem_offset;
-
 void picasso96_alloc (TrapContext *ctx)
 {
     int i, j, size, cnt;
@@ -1670,8 +1678,9 @@ void picasso96_alloc (TrapContext *ctx)
            break;
        }
     }
+#if 0
     ShowSupportedResolutions ();
-
+#endif
     m68k_dreg (&ctx->regs, 0) = size;
     m68k_dreg (&ctx->regs, 1) = 65536 + 1;
     picasso96_amem = CallLib (ctx, get_long (4), -0xC6); /* AllocMem */
@@ -1694,6 +1703,45 @@ void picasso96_alloc (TrapContext *ctx)
     put_long (p96ram_start + allocated_gfxmem - 4, '_UAE');
 }
 
+static void uaegfxversion (uaecptr bi)
+{
+    uaecptr addr = get_long (bi + 16); /* gbi_BoardName */
+    int max = 1000;
+    int ok = 0;
+
+    addr &= ~1;
+    for (;;) {
+       if (!valid_address (addr, 24) || bi == 0) {
+           max = 0;
+           break;
+       }
+       addr -= 2;
+       if (get_word (addr) == 0x4afc)
+           break;
+       max--;
+       if (max < 0)
+           break;
+    }
+    if (max > 0) {
+       uaecptr romtagp;
+       romtagp = get_long (addr + 2);
+       if (romtagp == addr) {
+           uaecptr ver = get_long (addr + 18);
+           if (valid_address (ver, 8)) {
+               char *vers = my_strdup (get_real_address (ver));
+               while (strlen (vers) > 0 && (vers[strlen (vers) - 1] == 10 || vers[strlen (vers) - 1] == 13))
+                   vers[strlen (vers) - 1] = 0;
+               write_log ("P96: %s\n", vers);
+               xfree (vers);
+               ok = 1;
+           }
+       }
+    }
+    if (!ok)
+       write_log ("P96: uaegfx.card not detected!?\n");
+}
+
+
 /****************************************
 * InitCard()
 *
@@ -1709,6 +1757,7 @@ uae_u32 REGPARAM2 picasso_InitCard (struct regstruct *regs)
     uaecptr AmigaBoardInfo = m68k_areg (regs, 2);
     uae_u32 flags;
 
+    uaegfxversion (AmigaBoardInfo);
     if (!picasso96_amem) {
        write_log ("P96: InitCard() but no resolution memory!\n");
        return 0;
@@ -2085,7 +2134,7 @@ uae_u32 REGPARAM2 picasso_InvertRect (struct regstruct *regs)
 
        xorval = 0x01010101 * (mask & 0xFF);
        width_in_bytes = Bpp * Width;
-       rectstart = uae_mem = ri.Memory + Y*ri.BytesPerRow + X*Bpp;
+       rectstart = uae_mem = ri.Memory + Y * ri.BytesPerRow + X * Bpp;
 
        for (lines = 0; lines < Height; lines++, uae_mem += ri.BytesPerRow) {
            do_xor8 (uae_mem, width_in_bytes, xorval);
@@ -2226,7 +2275,7 @@ STATIC_INLINE int BlitRectHelper (void)
     unsigned long total_width = width * Bpp;
     unsigned long linewidth = (total_width + 15) & ~15;
 
-    if(opcode == BLIT_DST) {
+    if (opcode == BLIT_DST) {
        write_log ( "WARNING: BlitRect() being called with opcode of BLIT_DST\n" );
        return 1;
     }
@@ -2337,6 +2386,17 @@ uae_u32 REGPARAM2 picasso_BlitRectNoMaskComplete (struct regstruct *regs)
     uae_u32 RGBFmt = m68k_dreg (regs, 7);
     uae_u32 result = 0;
 
+    {
+       uaecptr a5 = m68k_areg (regs, 5) & ~0xffff;
+       if (a5 != RTAREA_DEFAULT && a5 != RTAREA_BACKUP) {
+           static int notified;
+           if (!notified)
+               gui_message ("Picasso96 function call with invalid parameters!\n"
+                   "Most likely reason: unsupported version of p96_uae_tweak");
+           notified = 1;
+       }
+    }
+
     P96TRACE(("BlitRectNoMaskComplete() op 0x%02x, %08x:(%4d,%4d) --> %08x:(%4d,%4d), wh(%4d,%4d)\n",
        OpCode, get_long (srcri + PSSO_RenderInfo_Memory), srcx, srcy, get_long (dstri + PSSO_RenderInfo_Memory), dstx, dsty, width, height));
     result = BlitRect (srcri, dstri, srcx, srcy, dstx, dsty, width, height, 0xFF, OpCode);
@@ -2420,11 +2480,7 @@ uae_u32 REGPARAM2 picasso_BlitPattern (struct regstruct *regs)
        if (Mask != 0xFF) {
            if(Bpp > 1)
                Mask = 0xFF;
-           if(pattern.DrawMode == COMP) {
-               write_log ("WARNING - BlitPattern() has unhandled mask 0x%x with COMP DrawMode. Using fall-back routine.\n", Mask);
-           } else {
-               result = 1;
-           }
+           result = 1;
        } else {
            result = 1;
        }
@@ -2497,7 +2553,7 @@ uae_u32 REGPARAM2 picasso_BlitPattern (struct regstruct *regs)
                                    {
                                        case 1:
                                        {
-                                           uae_mem2[bits] ^= 0xff;
+                                           uae_mem2[bits] ^= 0xff & Mask;
                                        }
                                        break;
                                        case 2:
@@ -2715,7 +2771,7 @@ uae_u32 REGPARAM2 picasso_CalculateBytesPerRow (struct regstruct *regs)
 {
     uae_u16 width = m68k_dreg (regs, 0);
     uae_u32 type = m68k_dreg (regs, 7);
-    width = GetBytesPerPixel(type) * width;
+    width = GetBytesPerPixel (type) * width;
     return width;
 }
 
@@ -3046,7 +3102,7 @@ static void flushpixels (void)
     uae_u8 *dst = NULL;
     ULONG_PTR gwwcnt;
 
-    if (!picasso_vidinfo.extra_mem || !gwwbuf)
+    if (!picasso_vidinfo.extra_mem || !gwwbuf || src_start >= src_end)
        return;
 
     if (palette_changed)
@@ -3210,7 +3266,7 @@ static void flushpixels (void)
     if(lock)
        gfx_unlock_picasso ();
     if (dst && gwwcnt) {
-       mman_ResetWatch (src, allocated_gfxmem);
+       mman_ResetWatch (src_start, src_end - src_start);
         palette_changed = 0;
     }
     if (maxy >= 0)
index 327f9d8c7032808aace8b17cc8219b0b4420626c..d28b89481e5239ee60b2388b66cbacd957838e2e 100755 (executable)
@@ -1,6 +1,6 @@
 // Microsoft Visual C++ generated resource script.\r
 //\r
-#include "resource.h"\r
+#include "resource."\r
 \r
 #define APSTUDIO_READONLY_SYMBOLS\r
 /////////////////////////////////////////////////////////////////////////////\r
@@ -58,24 +58,24 @@ STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
 EXSTYLE WS_EX_CONTEXTHELP\r
 FONT 8, "MS Sans Serif", 0, 0, 0x1\r
 BEGIN\r
-    GROUPBOX        "System ROM Settings",-1,5,0,290,74\r
-    RTEXT           "Main ROM file:",IDC_ROMTEXT,10,15,75,10\r
-    COMBOBOX        IDC_ROMFILE,89,12,186,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP\r
-    PUSHBUTTON      "...",IDC_KICKCHOOSER,280,11,10,15\r
-    RTEXT           "Extended ROM file:",IDC_ROMFILE2TEXT,10,35,75,10\r
-    COMBOBOX        IDC_ROMFILE2,89,32,186,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP\r
-    PUSHBUTTON      "...",IDC_ROMCHOOSER2,280,31,10,15\r
+    GROUPBOX        "System ROM Settings",-1,5,0,290,93\r
+    RTEXT           "Main ROM file:",IDC_ROMTEXT,10,13,75,10\r
+    COMBOBOX        IDC_ROMFILE,12,26,263,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP\r
+    PUSHBUTTON      "...",IDC_KICKCHOOSER,280,25,10,15\r
+    RTEXT           "Extended ROM file:",IDC_ROMFILE2TEXT,10,43,75,10\r
+    COMBOBOX        IDC_ROMFILE2,12,56,263,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP\r
+    PUSHBUTTON      "...",IDC_ROMCHOOSER2,280,55,10,15\r
     CONTROL         "MapROM emulation [] Creates a BlizKick-compatible memory area.",IDC_MAPROM,\r
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,95,54,87,10\r
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,95,77,87,10\r
     CONTROL         "ShapeShifter support [] Patches the system ROM for ShapeShifter compatibility.",IDC_KICKSHIFTER,\r
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,54,87,10\r
-    GROUPBOX        "Miscellaneous",-1,5,76,290,57\r
-    RTEXT           "Cartridge ROM file:",IDC_FLASHTEXT2,8,93,75,10\r
-    COMBOBOX        IDC_CARTFILE,89,90,186,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP\r
-    PUSHBUTTON      "...",IDC_CARTCHOOSER,280,89,10,15\r
-    RTEXT           "Flash RAM file:",IDC_FLASHTEXT,8,112,75,10\r
-    EDITTEXT        IDC_FLASHFILE,89,110,185,13,ES_AUTOHSCROLL\r
-    PUSHBUTTON      "...",IDC_FLASHCHOOSER,280,109,10,15\r
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,77,87,10\r
+    GROUPBOX        "Miscellaneous",-1,5,99,290,75\r
+    RTEXT           "Cartridge ROM file:",IDC_FLASHTEXT2,8,110,75,10\r
+    COMBOBOX        IDC_CARTFILE,12,123,263,75,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP\r
+    PUSHBUTTON      "...",IDC_CARTCHOOSER,280,122,10,15\r
+    RTEXT           "Flash RAM file:",IDC_FLASHTEXT,8,142,75,10\r
+    EDITTEXT        IDC_FLASHFILE,12,155,262,13,ES_AUTOHSCROLL\r
+    PUSHBUTTON      "...",IDC_FLASHCHOOSER,280,154,10,15\r
 END\r
 \r
 IDD_DISPLAY DIALOGEX 0, 0, 300, 235\r
@@ -688,7 +688,7 @@ BEGIN
     COMBOBOX        IDC_FILTERVZMULT,67,63,27,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
     CONTROL         "Autoscale",IDC_FILTERAUTORES,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,9,168,63,10\r
     COMBOBOX        IDC_FILTERXTRA,105,130,138,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
-    CONTROL         "Full screen filter",IDC_FILTERUPSCALE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP | NOT WS_VISIBLE,9,153,87,10\r
+    CONTROL         "Full screen filter",IDC_FILTERUPSCALE,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,9,153,87,10\r
 END\r
 \r
 IDD_HARDDRIVE DIALOGEX 0, 0, 380, 76\r
index b43511bf2621d966ad8b793dbf022197ff5b9889..44d06ba10b2b7f94ce810872f9ff7182eba84bf9 100755 (executable)
@@ -163,12 +163,12 @@ static int restore (DWORD hr)
 static LARGE_INTEGER qpfc, qpf;
 static void storeqpf (void)
 {
-    QueryPerformanceCounter(&qpfc);
+    QueryPerformanceCounter (&qpfc);
 }
 static double getqpf (void)
 {
     LARGE_INTEGER qpfc2;
-    QueryPerformanceCounter(&qpfc2);
+    QueryPerformanceCounter (&qpfc2);
     return (qpfc2.QuadPart - qpfc.QuadPart) / (qpf.QuadPart / 1000.0);
 }
 
@@ -205,7 +205,7 @@ void set_volume (int volume, int mute)
     setvolume_ahi (vol);
 }
 
-static void recalc_offsets(void)
+static void recalc_offsets (void)
 {
     snd_writeoffset = max_sndbufsize * 5 / 8;
     snd_maxoffset = max_sndbufsize;
@@ -224,7 +224,7 @@ struct dsaudiomodes {
 };
 static struct dsaudiomodes supportedmodes[16];
 
-static void fillsupportedmodes(int freq)
+static void fillsupportedmodes (int freq)
 {
     DWORD speakerconfig;
     DSBUFFERDESC sound_buffer;
@@ -563,7 +563,7 @@ static int safedist;
 
 #define cf(x) if ((x) >= dsoundbuf) (x) -= dsoundbuf;
 
-void restart_sound_buffer(void)
+void restart_sound_buffer (void)
 {
     DWORD playpos, safed;
     HRESULT hr;
@@ -783,7 +783,7 @@ static void finish_sound_buffer_ds (void)
     cf(writepos);
 }
 
-static void channelswap(uae_s16 *sndbuffer, int len)
+static void channelswap (uae_s16 *sndbuffer, int len)
 {
     int i;
     for (i = 0; i < len; i += 2) {
@@ -792,7 +792,7 @@ static void channelswap(uae_s16 *sndbuffer, int len)
        sndbuffer[i + 1] = t;
     }
 }
-static void channelswap6(uae_s16 *sndbuffer, int len)
+static void channelswap6 (uae_s16 *sndbuffer, int len)
 {
     int i;
     for (i = 0; i < len; i += 6) {
index ad879249cc1c45c80d93a9359a2e12c3ed0cb3da..2dfabc7fe2df152838bb230d95ce58f77a6b6aa1 100755 (executable)
@@ -12,7 +12,7 @@
 
 #define MAX_SHMID 256
 
-extern uae_u8 *natmem_offset;
+extern uae_u8 *natmem_offset, *natmem_offset_end;
 
 typedef int key_t;
 typedef USHORT ushort;
index 85677310c3fb6ebff451dc84308a8fd92d6843e7..550cfeb8d3109ddb0183378a6a0042390873f8d1 100755 (executable)
 #endif
 
 extern int harddrive_dangerous, do_rdbdump, aspi_allow_all, no_rawinput;
-int log_scsi, log_net = 0;
+int log_scsi, log_net, uaelib_debug;
 
 extern FILE *debugfile;
 extern int console_logging;
 static OSVERSIONINFO osVersion;
 static SYSTEM_INFO SystemInfo;
 
-int useqpc = 0; /* Set to TRUE to use the QueryPerformanceCounter() function instead of rdtsc() */
 int qpcdivisor = 0;
-int cpu_mmx = 0;
-static int no_rdtsc;
+int cpu_mmx = 1;
 
 HINSTANCE hInst = NULL;
 HMODULE hUIDLL = NULL;
@@ -125,6 +123,7 @@ int mouseactive, focus;
 static int mm_timerres;
 static int timermode, timeon;
 static HANDLE timehandle;
+int sleep_resolution;
 
 char start_path_data[MAX_DPATH];
 char start_path_exe[MAX_DPATH];
@@ -161,53 +160,32 @@ static int timebegin (void)
     return 0;
 }
 
-static void init_mmtimer (void)
+static int init_mmtimer (void)
 {
     TIMECAPS tc;
     mm_timerres = 0;
     if (timeGetDevCaps(&tc, sizeof(TIMECAPS)) != TIMERR_NOERROR)
-       return;
+       return 0;
     mm_timerres = min(max(tc.wPeriodMin, 1), tc.wPeriodMax);
+    sleep_resolution = 1000 / mm_timerres;
     timehandle = CreateEvent (NULL, TRUE, FALSE, NULL);
+    return 1;
 }
 
-int sleep_resolution;
 void sleep_millis (int ms)
 {
     UINT TimerEvent;
-    int start = read_processor_time();
-    if (mm_timerres <= 0 || timermode) {
-       Sleep (ms);
-    } else {
-       TimerEvent = timeSetEvent (ms, 0, timehandle, 0, TIME_ONESHOT | TIME_CALLBACK_EVENT_SET);
-       if (!TimerEvent) {
-           Sleep (ms);
-       } else {
-           WaitForSingleObject (timehandle, ms);
-           ResetEvent (timehandle);
-           timeKillEvent (TimerEvent);
-       }
-    }
+    int start;
+    
+    start = read_processor_time();
+    TimerEvent = timeSetEvent (ms, 0, timehandle, 0, TIME_ONESHOT | TIME_CALLBACK_EVENT_SET);
+    WaitForSingleObject (timehandle, ms);
+    ResetEvent (timehandle);
+    timeKillEvent (TimerEvent);
     idletime += read_processor_time() - start;
 }
 
-void sleep_millis_busy (int ms)
-{
-    if (timermode < 0)
-       return;
-    sleep_millis (ms);
-}
-
-#include <process.h>
-static volatile int dummythread_die;
-static void dummythread (void *dummy)
-{
-    SetThreadPriority (GetCurrentThread(), THREAD_PRIORITY_LOWEST);
-    while (!dummythread_die);
-}
-
-
-STATIC_INLINE frame_time_t read_processor_time_qpc (void)
+frame_time_t read_processor_time (void)
 {
     LARGE_INTEGER counter;
     QueryPerformanceCounter(&counter);
@@ -216,227 +194,27 @@ STATIC_INLINE frame_time_t read_processor_time_qpc (void)
     return (frame_time_t)(counter.QuadPart >> qpcdivisor);
 }
 
-frame_time_t read_processor_time (void)
+static void figure_processor_speed (void)
 {
-    frame_time_t foo;
-
-    if (useqpc) /* No RDTSC or RDTSC is not stable */
-       return read_processor_time_qpc();
-
-#if defined(X86_MSVC_ASSEMBLY)
-    {
-       frame_time_t bar;
-       __asm
-       {
-           rdtsc
-           mov foo, eax
-           mov bar, edx
-       }
-       /* very high speed CPU's RDTSC might overflow without this.. */
-       foo >>= 6;
-       foo |= bar << 26;
-    }
-#else
-    foo = 0;
-#endif
-#ifdef HIBERNATE_TEST
-    if (rpt_skip_trigger) {
-       foo += rpt_skip_trigger;
-       rpt_skip_trigger = 0;
-    }
-#endif
-    return foo;
-}
-
-
-static uae_u64 win32_read_processor_time (void)
-{
-#if defined(X86_MSVC_ASSEMBLY)
-    uae_u32 foo, bar;
-    __asm
-    {
-       rdtsc
-       mov foo, eax
-       mov bar, edx
-    }
-    return ((uae_u64)bar << 32) | foo;
-#else
-    return 0;
-#endif
-}
-
-static int figure_processor_speed (void)
-{
-    extern volatile frame_time_t vsynctime;
-    extern unsigned long syncbase;
-    uae_u64 clockrate, clockrateidle, qpfrate, ratea1, ratea2;
-    uae_u32 rate1, rate2;
-    double limit, clkdiv = 1, clockrate1000 = 0;
-    int i, ratecnt = 5;
     LARGE_INTEGER freq;
-    int qpc_avail = 0;
-    int mmx = 0;
-
-    rpt_available = no_rdtsc > 0 ? 0 : 1;
-#ifdef X86_MSVC_ASSEMBLY
-    __try
-    {
-       __asm
-       {
-           rdtsc
-       }
-    } __except(GetExceptionCode() == EXCEPTION_ILLEGAL_INSTRUCTION) {
-       rpt_available = 0;
-       write_log ("CLOCKFREQ: RDTSC not supported\n");
-    }
-    __try
-    {
-       __asm
-       {
-           mov eax,1
-           cpuid
-           and edx,0x800000
-           mov mmx,edx
-       }
-       if (mmx)
-           cpu_mmx = 1;
-    } __except(GetExceptionCode() == EXCEPTION_ILLEGAL_INSTRUCTION) {
-    }
-#endif
-#ifdef WIN64
-    cpu_mmx = 1;
-    rpt_available = 0;
-#endif
-
-    if (QueryPerformanceFrequency(&freq)) {
-       qpc_avail = 1;
-       qpfrate = freq.QuadPart;
-        /* limit to 10MHz */
-       qpcdivisor = 0;
-       while (qpfrate > 10000000) {
-           qpfrate >>= 1;
-           qpcdivisor++;
-           qpc_avail = -1;
-       }
-       write_log ("CLOCKFREQ: QPF %.2fMHz (%.2fMHz, DIV=%d)\n", freq.QuadPart / 1000000.0,
-           qpfrate / 1000000.0, 1 << qpcdivisor);
-       if (SystemInfo.dwNumberOfProcessors > 1 && no_rdtsc >= 0)
-           rpt_available = 0; /* RDTSC can be weird in SMP-systems */
-    } else {
-       write_log ("CLOCKREQ: QPF not supported\n");
-    }
-
-    if (!rpt_available && !qpc_avail) {
-       pre_gui_message ("No timing reference found\n(no RDTSC or QPF support detected)\nWinUAE will exit\n");
-       return 0;
-    }
+    static LARGE_INTEGER freq2;
+    uae_u64 qpfrate;
 
-    init_mmtimer();
-    SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
-    sleep_millis (50);
-    dummythread_die = -1;
-
-    if (qpc_avail || rpt_available)  {
-       int qpfinit = 0;
-
-       if (rpt_available) {
-           clockrateidle = win32_read_processor_time();
-           sleep_millis (500);
-           clockrateidle = (win32_read_processor_time() - clockrateidle) * 2;
-           dummythread_die = 0;
-           _beginthread(&dummythread, 0, 0);
-           sleep_millis (50);
-           clockrate = win32_read_processor_time();
-           sleep_millis (500);
-           clockrate = (win32_read_processor_time() - clockrate) * 2;
-           write_log ("CLOCKFREQ: RDTSC %.2fMHz (busy) / %.2fMHz (idle)\n",
-               clockrate / 1000000.0, clockrateidle / 1000000.0);
-           clkdiv = (double)clockrate / (double)clockrateidle;
-           clockrate >>= 6;
-           clockrate1000 = clockrate / 1000.0;
-       }
-       if (rpt_available && qpc_avail && qpfrate / 950.0 >= clockrate1000) {
-           write_log ("CLOCKFREQ: Using QPF (QPF ~>= RDTSC)\n");
-           qpfinit = 1;
-       } else  if (((clkdiv <= 0.95 || clkdiv >= 1.05) && no_rdtsc == 0) || !rpt_available) {
-           if (rpt_available)
-               write_log ("CLOCKFREQ: CPU throttling detected, using QPF instead of RDTSC\n");
-           qpfinit = 1;
-       } else if (qpc_avail && freq.QuadPart >= 999000000) {
-           write_log ("CLOCKFREQ: Using QPF (QPF >= 1GHz)\n");
-           qpfinit = 1;
-       }
-       if (qpfinit) {
-           useqpc = qpc_avail;
-           rpt_available = 1;
-           clkdiv = 1.0;
-           clockrate = qpfrate;
-           clockrate1000 = clockrate / 1000.0;
-           if (dummythread_die < 0) {
-               dummythread_die = 0;
-               _beginthread(&dummythread, 0, 0);
-           }
-           if (!qpc_avail)
-               write_log ("No working timing reference detected\n");
-       }
-       timermode = 0;
-       if (mm_timerres) {
-           sleep_millis (50);
-           timebegin ();
-           sleep_millis (50);
-           ratea1 = 0;
-           write_log ("Testing MM-timer resolution:\n");
-           for (i = 0; i < ratecnt; i++) {
-               rate1 = read_processor_time();
-               sleep_millis (1);
-               rate1 = read_processor_time() - rate1;
-               write_log ("%1.2fms ", rate1 / clockrate1000);
-               ratea1 += rate1;
-           }
-           write_log ("\n");
-           timeend ();
-           sleep_millis (50);
-       }
-       timermode = 1;
-       ratea2 = 0;
-       write_log ("Testing Sleep() resolution:\n");
-       for (i = 0; i < ratecnt; i++) {
-           rate2 = read_processor_time();
-           sleep_millis (1);
-           rate2 = read_processor_time() - rate2;
-           write_log ("%1.2fms ", rate2 / clockrate1000);
-           ratea2 += rate2;
-       }
-       write_log ("\n");
-    }
-
-    SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL);
-    dummythread_die = 1;
-
-    sleep_resolution = 1;
-    if ((clkdiv >= 0.90 && clkdiv <= 1.10 && rpt_available) && no_rdtsc < 2) {
-       limit = 2.5;
-       if (mm_timerres && (ratea1 / ratecnt) < limit * clockrate1000) { /* MM-timer is ok */
-           timermode = 0;
-           sleep_resolution = (int)((1000 * ratea1) / (clockrate1000 * ratecnt));
-           timebegin ();
-           write_log ("Using MultiMedia timers (resolution < %.1fms) SR=%d\n", limit, sleep_resolution);
-       } else if ((ratea2 / ratecnt) < limit * clockrate1000) { /* regular Sleep() is ok */
-           timermode = 1;
-           sleep_resolution = (int)((1000 * ratea2) / (clockrate1000 * ratecnt));
-           write_log ("Using Sleep() (resolution < %.1fms) SR=%d\n", limit, sleep_resolution);
-       } else {
-           timermode = -1; /* both timers are bad, fall back to busy-wait */
-           write_log ("falling back to busy-loop waiting (timer resolution > %.1fms)\n", limit);
-       }
-    } else {
-       timermode = -1;
-       write_log ("forcing busy-loop wait mode\n");
+    if (!QueryPerformanceFrequency(&freq))
+       return;
+    if (freq.QuadPart == freq2.QuadPart)
+       return;
+    freq2.QuadPart = freq.QuadPart;
+    qpfrate = freq.QuadPart;
+     /* limit to 10MHz */
+    qpcdivisor = 0;
+    while (qpfrate > 10000000) {
+        qpfrate >>= 1;
+        qpcdivisor++;
     }
-    if (sleep_resolution < 1000)
-       sleep_resolution = 1000;
-    syncbase = (unsigned long)clockrate;
-    return 1;
+    write_log ("CLOCKFREQ: QPF %.2fMHz (%.2fMHz, DIV=%d)\n", freq.QuadPart / 1000000.0,
+        qpfrate / 1000000.0, 1 << qpcdivisor);
+    syncbase = (unsigned long)qpfrate;
 }
 
 static void setcursor(int oldx, int oldy)
@@ -615,21 +393,14 @@ void setmouseactive (int active)
 
 static void winuae_active (HWND hWnd, int minimized)
 {
-    int ot;
     struct threadpriorities *pri;
 
     write_log ("winuae_active(%d)\n", minimized);
     /* without this returning from hibernate-mode causes wrong timing
      */
-    if (!os_vista) {
-       ot = timermode;
-       timermode = 0;
-       timebegin();
-       sleep_millis (2);
-       timermode = ot;
-       if (timermode != 0)
-           timeend();
-    }
+    timeend ();
+    sleep_millis (2);
+    timebegin ();
 
     focus = 1;
     pri = &priorities[currprefs.win32_inactive_priority];
@@ -756,7 +527,6 @@ static void handleXbutton (WPARAM wParam, int updown)
 
 static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
-    PAINTSTRUCT ps;
     HDC hDC;
     int mx, my;
     static int mm, minimized, recursive, ignoremousemove;
@@ -880,6 +650,7 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
     {
        static int recursive = 0;
        if (recursive == 0) {
+           PAINTSTRUCT ps;
            recursive++;
            notice_screen_contents_lost ();
            hDC = BeginPaint (hWnd, &ps);
@@ -1358,6 +1129,7 @@ void handle_events (void)
 {
     MSG msg;
     int was_paused = 0;
+    static int cnt;
 
     while (emulation_paused > 0 || pause_emulation) {
        if ((emulation_paused > 0 || pause_emulation) && was_paused == 0) {
@@ -1371,12 +1143,12 @@ void handle_events (void)
            DispatchMessage (&msg);
        }
        sleep_millis (50);
-       inputdevicefunc_keyboard.read();
-       inputdevicefunc_mouse.read();
-       inputdevicefunc_joystick.read();
+       inputdevicefunc_keyboard.read ();
+       inputdevicefunc_mouse.read ();
+       inputdevicefunc_joystick.read ();
        inputdevice_handle_inputcode ();
        check_prefs_changed_gfx ();
-       while (checkIPC(&currprefs));
+       while (checkIPC (&currprefs));
        if (quit_program)
            break;
     }
@@ -1384,13 +1156,18 @@ void handle_events (void)
        TranslateMessage (&msg);
        DispatchMessage (&msg);
     }
-    while (checkIPC(&currprefs));
+    while (checkIPC (&currprefs));
     if (was_paused) {
-       resumepaused();
+       resumepaused ();
        emulation_paused = 0;
        sound_closed = 0;
        manual_painting_needed--;
     }
+    cnt--;
+    if (cnt <= 0) {
+       figure_processor_speed ();
+       cnt = 100;
+    }
 }
 
 /* We're not a console-app anymore! */
@@ -1691,17 +1468,30 @@ static void WIN32_InitLang(void)
  /* try to load COMDLG32 and DDRAW, initialize csDraw */
 static int WIN32_InitLibraries( void )
 {
-    int result = 1;
+    LARGE_INTEGER freq;
+
     /* Determine our processor speed and capabilities */
-    if (!figure_processor_speed())
+    if (!init_mmtimer()) {
+       pre_gui_message ("MMTimer initialization failed, exiting..");
+       return 0;
+    }
+    if (!QueryPerformanceCounter (&freq)) {
+       pre_gui_message ("No QueryPerformanceFrequency() supported, exiting..\n");
+       return 0;
+    }
+    rpt_available = 1;
+    figure_processor_speed ();
+    if (!timebegin ()) {
+       pre_gui_message ("MMTimer second initialization failed, exiting..");
        return 0;
+    }
 
     /* Make sure we do an InitCommonControls() to get some advanced controls */
     InitCommonControls();
 
     hRichEdit = LoadLibrary ("RICHED32.DLL");
 
-    return result;
+    return 1;
 }
 
 int debuggable (void)
@@ -1904,6 +1694,7 @@ void target_default_options (struct uae_prefs *p, int type)
        p->win32_outsidemouse = 0;
        p->sana2 = 0;
        p->win32_rtgmatchdepth = 1;
+       p->win32_rtgscaleifsmall = 1;
     }
     if (type == 1 || type == 0) {
        p->win32_uaescsimode = get_aspi(p->win32_uaescsimode);
@@ -1944,6 +1735,7 @@ void target_save_options (struct zfile *f, struct uae_prefs *p)
     cfgfile_target_dwrite (f, "midiout_device=%d\n", p->win32_midioutdev );
     cfgfile_target_dwrite (f, "midiin_device=%d\n", p->win32_midiindev );
     cfgfile_target_dwrite (f, "rtg_match_depth=%s\n", p->win32_rtgmatchdepth ? "true" : "false" );
+    cfgfile_target_dwrite (f, "rtg_scale_small=%s\n", p->win32_rtgscaleifsmall ? "true" : "false" );
     cfgfile_target_dwrite (f, "borderless=%s\n", p->win32_borderless ? "true" : "false" );
     cfgfile_target_dwrite (f, "uaescsimode=%s\n", scsimode[p->win32_uaescsimode]);
     cfgfile_target_dwrite (f, "soundcard=%d\n", p->win32_soundcard );
@@ -2006,6 +1798,8 @@ int target_parse_option (struct uae_prefs *p, char *option, char *value)
 
     if (cfgfile_yesno (option, value, "rtg_match_depth", &p->win32_rtgmatchdepth))
        return 1;
+    if (cfgfile_yesno (option, value, "rtg_scale_small", &p->win32_rtgscaleifsmall))
+       return 1;
 
     if (cfgfile_yesno (option, value, "aspi", &v)) {
        p->win32_uaescsimode = 0;
@@ -2952,18 +2746,6 @@ static int process_arg(char **xargv)
            continue;
        }
 #endif
-       if (!strcmp (arg, "-nordtsc")) {
-           no_rdtsc = 1;
-           continue;
-       }
-       if (!strcmp (arg, "-forcerdtsc")) {
-           no_rdtsc = -1;
-           continue;
-       }
-       if (!strcmp (arg, "-busywait")) {
-           no_rdtsc = 2;
-           continue;
-       }
        if (!strcmp (arg, "-norawinput")) {
            no_rawinput = 1;
            continue;
@@ -3166,8 +2948,7 @@ static int PASCAL WinMain2 (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
 #endif
     closeIPC();
     write_disk_history ();
-    if (mm_timerres && timermode == 0)
-       timeend ();
+    timeend ();
 #ifdef AVIOUTPUT
     AVIOutput_Release ();
 #endif
index 560e5e471f78baaa3197118208777cfc509bc485..c14cffac867d931209ca31d782745c27f6ad6c45 100755 (executable)
@@ -15,9 +15,9 @@
 #define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100)
 #define GETBDD(x) ((x) % 100)
 
-#define WINUAEBETA 7
+#define WINUAEBETA 8
 #define WINUAEPUBLICBETA 1
-#define WINUAEDATE MAKEBD(2008, 3, 9)
+#define WINUAEDATE MAKEBD(2008, 3, 14)
 #define WINUAEEXTRA ""
 #define WINUAEREV ""
 
index 780decf4712d4bb4d62cbba3f15292e83613cfea..9cbc5c316134858e52a9992fb059fac5835b0b02 100755 (executable)
@@ -123,7 +123,11 @@ void S2X_init (int dw, int dh, int aw, int ah, int mult, int ad, int dd)
     scale = mult;
 
     temp_width = dst_width * 3;
+    if (temp_width > dxdata.maxwidth)
+       temp_width = dxdata.maxwidth;
     temp_height = dst_height * 3;
+    if (temp_height > dxdata.maxheight)
+       temp_height = dxdata.maxheight;
     tempsurf = allocsurface (temp_width, temp_height);
     if (!tempsurf)
        write_log ("DDRAW: failed to create temp surface\n");
@@ -325,16 +329,7 @@ end:
 
 void S2X_refresh (void)
 {
-    int y, pitch;
-    uae_u8 *dptr;
-
-    if (!DirectDraw_SurfaceLock ())
-       return;
-    dptr = DirectDraw_GetSurfacePointer ();
-    pitch = DirectDraw_GetSurfacePitch ();
-    for (y = 0; y < dst_height; y++)
-       memset (dptr + y * pitch, 0, dst_width * dst_depth / 8);
-    DirectDraw_SurfaceUnlock ();
+    clearsurface (NULL);
     S2X_render ();
 }
 
index 69a7098a26ab5fb062b7cfffcdcbdbb4c00998b6..58e7839a222ed5fafee158bfe22994743b304994 100755 (executable)
@@ -77,6 +77,7 @@
 #define SM_NONE 11
 
 struct uae_filter *usedfilter;
+static int scalepicasso;
 
 struct winuae_currentmode {
     unsigned int flags;
@@ -169,26 +170,15 @@ uae_u16 picasso96_pixel_format = RGBFF_CHUNKY;
 static char scrlinebuf[4096 * 4]; /* this is too large, but let's rather play on the safe side here */
 
 
-void centerdstrect (RECT *dr, RECT *sr)
+void centerdstrect (RECT *dr)
 {
     if(!(currentmode->flags & (DM_DX_FULLSCREEN | DM_W_FULLSCREEN)))
        OffsetRect(dr, amigawin_rect.left, amigawin_rect.top);
     if (currentmode->flags & DM_W_FULLSCREEN) {
-       int dx, dy;
        if (currentmode->fullfill)
            return;
        OffsetRect (dr, (currentmode->native_width - currentmode->current_width) / 2,
            (currentmode->native_height - currentmode->current_height) / 2);
-       dx = (dr->right - dr->left) - currentmode->current_width;
-       if (dx > 0) {
-           dr->right -= dx;
-           sr->right -= dx;
-       }
-       dy = (dr->bottom - dr->top) - currentmode->current_height;
-       if (dy > 0) {
-           dr->bottom -= dy;
-           sr->bottom -= dy;
-       }
     }
 }
 
@@ -205,18 +195,10 @@ void DX_Fill (int dstx, int dsty, int width, int height, uae_u32 color)
 
     /* Set up our destination rectangle, and adjust for blit to windowed display (if necessary ) */
     SetRect (&dstrect, dstx, dsty, dstx + width, dsty + height);
-    centerdstrect (&dstrect, &srcrect);
+    centerdstrect (&dstrect);
     DirectDraw_Fill (&dstrect, color);
 }
 
-void DX_Blit (int x, int y, int w, int h)
-{
-    RECT r;
-
-    SetRect (&r, x, y, x + w, y + h);
-    DirectDraw_BlitToPrimary (&r);
-}
-
 static int rgbformat_bits (RGBFTYPE t)
 {
     unsigned long f = 1 << t;
@@ -270,11 +252,11 @@ static int set_ddraw (void)
        ddrval = DirectDraw_SetClipper (hAmigaWnd);
        if (FAILED(ddrval))
            goto oops;
-       if (DirectDraw_SurfaceLock()) {
+       if (DirectDraw_SurfaceLock ()) {
            currentmode->pitch = DirectDraw_GetSurfacePitch ();
            DirectDraw_SurfaceUnlock ();
        }
-       if (bits == 8)
+       if (bits <= 8)
            DirectDraw_CreatePalette (currentmode->pal);
     }
 
@@ -682,13 +664,32 @@ static int p96_double_buffer_firstx, p96_double_buffer_lastx;
 static int p96_double_buffer_first, p96_double_buffer_last;
 static int p96_double_buffer_needs_flushing = 0;
 
+static void DX_Blit96 (int x, int y, int w, int h)
+{
+    RECT r;
+
+    if (scalepicasso) {
+       SetRect (&r, 0, 0, picasso96_state.Width, picasso96_state.Height);
+       DirectDraw_BlitToPrimaryScale (&r);
+    } else {
+        SetRect (&r, x, y, x + w, y + h);
+       DirectDraw_BlitToPrimary (&r);
+    }
+}
+
 void gfx_unlock_picasso (void)
 {
     DirectDraw_SurfaceUnlock();
     if (p96_double_buffer_needs_flushing) {
+       if (scalepicasso) {
+          p96_double_buffer_firstx = 0;
+          p96_double_buffer_lastx = picasso_vidinfo.width;
+          p96_double_buffer_first = 0;
+          p96_double_buffer_last = picasso_vidinfo.height;
+       }
        picasso_putcursor (p96_double_buffer_firstx, p96_double_buffer_first,
            p96_double_buffer_lastx - p96_double_buffer_firstx + 1, p96_double_buffer_last - p96_double_buffer_first + 1);
-       DX_Blit (p96_double_buffer_firstx, p96_double_buffer_first,
+       DX_Blit96 (p96_double_buffer_firstx, p96_double_buffer_first,
             p96_double_buffer_lastx - p96_double_buffer_firstx + 1,
             p96_double_buffer_last - p96_double_buffer_first + 1);
        picasso_clearcursor ();
@@ -735,7 +736,7 @@ static void update_gfxparams (void)
 {
     updatewinfsmode (&currprefs);
 #ifdef PICASSO96
-    if (screen_is_picasso) {
+    if (screen_is_picasso && !scalepicasso) {
        currentmode->current_width = picasso96_state.Width;
        currentmode->current_height = picasso96_state.Height;
        currentmode->frequency = abs (currprefs.gfx_refreshrate > default_freq ? currprefs.gfx_refreshrate : default_freq);
@@ -1219,11 +1220,19 @@ static int reopen (int full)
 
 static int modeswitchneeded (struct winuae_currentmode *wc)
 {
+    scalepicasso = 0;
     if (isfullscreen () > 0) {
        if (screen_is_picasso) {
+           if (picasso96_state.BytesPerPixel * 8 != wc->current_depth && currprefs.win32_rtgmatchdepth)
+               return -1;
+           if (picasso96_state.Width < wc->current_width && picasso96_state.Height < wc->current_height) {
+               if (currprefs.win32_rtgscaleifsmall) {
+                   scalepicasso = 1;
+                   return 0;
+               }
+           }
            if (picasso96_state.Width != wc->current_width ||
-               picasso96_state.Height != wc->current_height ||
-               (picasso96_state.BytesPerPixel * 8 != wc->current_depth && currprefs.win32_rtgmatchdepth))
+               picasso96_state.Height != wc->current_height)
                return -1;
        } else {
            if (currentmode->current_width != wc->current_width ||
@@ -1233,6 +1242,12 @@ static int modeswitchneeded (struct winuae_currentmode *wc)
        }
     } else if (isfullscreen () == 0) {
        if (screen_is_picasso) {
+           if (picasso96_state.Width < wc->current_width && picasso96_state.Height < wc->current_height) {
+               if (currprefs.win32_rtgscaleifsmall) {
+                   scalepicasso = 1;
+                   return 0;
+               }
+           }
            if (picasso96_state.Width != wc->current_width ||
                picasso96_state.Height != wc->current_height)
                return 1;
@@ -1242,6 +1257,10 @@ static int modeswitchneeded (struct winuae_currentmode *wc)
                return 1;
        }
     } else {
+       if (currprefs.win32_rtgscaleifsmall) {
+           scalepicasso = 1;
+           return 0;
+       }
        if (picasso96_state.Width > wc->native_width ||
            picasso96_state.Height > wc->native_height)
            return -1;
@@ -1253,10 +1272,13 @@ void gfx_set_picasso_state (int on)
 {
     struct winuae_currentmode wc;
     int mode;
+
     if (screen_is_picasso == on)
        return;
     screen_is_picasso = on;
     memcpy (&wc, currentmode, sizeof (wc));
+
+    scalepicasso = 0;
     update_gfxparams ();
     if (currprefs.gfx_afullscreen != currprefs.gfx_pfullscreen) {
        mode = 1;
index 04e04173de7e4fa8891df3b9b2664ebb9438db77..c759a10ced88a40cc804099a84b70436d31d7648 100755 (executable)
@@ -36,7 +36,7 @@ extern int is3dmode (void);
 
 void DX_Fill (int dstx, int dsty, int width, int height, uae_u32 color);
 void DX_Blit (int x, int y, int w, int h);
-void centerdstrect (RECT *, RECT *);
+void centerdstrect (RECT *);
 
 
 #endif
index b60280dff8f60bf420809f80bbd965fe417d65ee..c640ce6fd1323a38378be21c8398eeb34656649e 100755 (executable)
@@ -1115,7 +1115,7 @@ static void m(void)
 }
 
 /* if drive is -1, show the full GUI, otherwise file-requester for DF[drive] */
-void gui_display(int shortcut)
+void gui_display (int shortcut)
 {
     static int here;
     HRESULT hr;
index 72494257189c9e6c5aca5699a9be594f5460b735..9ce5434ffddb73f28275993a79dc5eb2d56ac9f5 100755 (executable)
                                RelativePath="..\hardfile_win32.c"
                                >
                        </File>
-                       <File
-                               RelativePath="..\hq3x16.obj"
-                               >
-                       </File>
-                       <File
-                               RelativePath="..\hq3x32.obj"
-                               >
-                       </File>
-                       <File
-                               RelativePath="..\hq4x16.obj"
-                               >
-                       </File>
-                       <File
-                               RelativePath="..\hq4x32.obj"
-                               >
-                       </File>
                        <File
                                RelativePath="..\ioport.c"
                                >
                        RelativePath="..\hq2x32.obj"
                        >
                </File>
+               <File
+                       RelativePath="..\hq3x16.obj"
+                       >
+               </File>
+               <File
+                       RelativePath="..\hq3x32.obj"
+                       >
+               </File>
+               <File
+                       RelativePath="..\hq4x16.obj"
+                       >
+               </File>
+               <File
+                       RelativePath="..\hq4x32.obj"
+                       >
+               </File>
                <File
                        RelativePath="..\resources\resource.h"
                        >
index 6e6893822b99fd7627c088a8ee937235e671e74e..9cc8216be812a28f9aeb7315029c0a89537ec21d 100755 (executable)
@@ -1,4 +1,44 @@
 
+Beta 8:
+
+NOTE: OGL/D3D filters still using old scaling
+
+- uaegfx.card fallback graphics routines fixed (rarely used drawing
+  modes that native C-code "blitter" does not support)
+- print uaegfx.card version to log file
+- simple RTG scaling support, do not change resolution but scale to
+  fullscreen if display size configured in display panel is larger than
+  requested Picasso96 resolution. Quality is not good, real filter
+  support later. Perhaps.. Mainly useful with games/demos that use
+  very low resolutions. (configuration enable option not yet added)
+- "super skid marks fix" updated, previous "fix" broke all attached
+  AGA-mode sprites
+- GUI does not get overdrawn in fullscreen when adjusting filters
+- timer calibration removed, uses now performance counters only, also
+  checks periodically if counter frequency changes and adjusts to new
+  rate automatically (possible fix for random power saving slowdown
+  problems)
+- fullscreen non-filter mode graphics problems fixed
+- vsync is working but it isn't 100% smooth yet (at least on my PC)
+- real CD32 rom (391640-03) checksums added to rom scanner
+- fixed left and top border RTG hardware cursor graphics problems
+- added warning if p96_uae_tweak is detected, it is incompatible with
+  new uaegfx.card (update will be released later)
+- filter temporary directdraw surface size restricted to max hardware
+  supported 3D texture size (at least some cards apparently switch
+  to very slow software blitter if size is bigger than max texture
+  size) note that this can restrict scaling range, image simply
+  disappears if scaling multiplier is out of supported range
+- "watch" only visible RTG display RAM, should improve performance if
+  program uses multiple temporary offscreen bitmaps
+- RTG hardware cursor didn't always get erased properly when cursor
+  shape was changed
+- ROM chip part numbers added to rom scanner data, also added to GUI
+  because not all ROMs have confirmed part number yet. "Non-ROMs" not
+  included, like separate CD32 ROMs (real CD32 has single 1M ROM)
+- PCMCIA SRAM on the fly insert/removal fix
+
+
 Beta 7:
 
 NOTE: _DO_ use filters (except OGL/D3D). Vsync still broken.
index df1e04ee2c03f95a16b29767e1444cacf0538058..4272bd1042118ff936f5f261421296477b9cd7d8 100755 (executable)
@@ -144,7 +144,7 @@ void close_console(void)
     consoleopen = 0;
 }
 
-static void writeconsole(const char *buffer)
+static void writeconsole (const char *buffer)
 {
     DWORD temp;
     if (!consoleopen)
@@ -203,7 +203,7 @@ void console_flush (void)
 
 static int lfdetected = 1;
 
-static char *writets(void)
+static char *writets (void)
 {
     struct tm *t;
     struct _timeb tb;
@@ -258,7 +258,7 @@ void write_dlog (const char *format, ...)
        if (lfdetected && ts)
            fprintf(debugfile, ts);
        fprintf(debugfile, buffer);
-       fflush(debugfile);
+       //fflush(debugfile);
     }
     lfdetected = 0;
     if (strlen(buffer) > 0 && buffer[strlen(buffer) - 1] == '\n')
@@ -303,7 +303,8 @@ void write_log (const char *format, ...)
        if (lfdetected && ts)
            fprintf(debugfile, ts);
        fprintf(debugfile, bufp);
-       fflush(debugfile);
+       if (!bootlogmode)
+           fflush(debugfile);
     }
     lfdetected = 0;
     if (strlen(bufp) > 0 && bufp[strlen(bufp) - 1] == '\n')
@@ -342,7 +343,7 @@ char* buf_out (char *buffer, int *bufsize, const char *format, ...)
     return buffer + strlen(buffer);
 }
 
-void *log_open(const char *name, int append, int bootlog)
+void *log_open (const char *name, int append, int bootlog)
 {
     FILE *f;
 
index fd21b6c429d4bf3a584746c4f2c9c76926b9224b..ee1f1e41b4bfacd05675fed84db152acd746840b 100755 (executable)
--- a/uaelib.c
+++ b/uaelib.c
@@ -377,7 +377,7 @@ static int native_dos_op (uae_u32 mode, uae_u32 p1, uae_u32 p2, uae_u32 p3)
     return 0;
 }
 
-static uae_u32 REGPARAM2 uaelib_demux (TrapContext *context)
+static uae_u32 REGPARAM2 uaelib_demux2 (TrapContext *context)
 {
 #define ARG0 (get_long (m68k_areg (&context->regs, 7) + 4))
 #define ARG1 (get_long (m68k_areg (&context->regs, 7) + 8))
@@ -386,7 +386,8 @@ static uae_u32 REGPARAM2 uaelib_demux (TrapContext *context)
 #define ARG4 (get_long (m68k_areg (&context->regs, 7) + 20))
 #define ARG5 (get_long (m68k_areg (&context->regs, 7) + 24))
 
-    switch (ARG0) {
+    switch (ARG0)
+    {
      case 0: return emulib_GetVersion ();
      case 1: return emulib_GetUaeConfig (ARG1);
      case 2: return emulib_SetUaeConfig (ARG1);
@@ -451,6 +452,22 @@ static uae_u32 REGPARAM2 uaelib_demux (TrapContext *context)
     return 0;
 }
 
+extern int uaelib_debug;
+static uae_u32 REGPARAM2 uaelib_demux (TrapContext *context)
+{
+    uae_u32 v;
+    struct regstruct *r = &context->regs;
+    if (uaelib_debug)
+       write_log ("%d: %08x %08x %08x %08x %08x %08x %08x %08x, %08x %08x %08x %08x %08x %08x %08x %08x\n",
+           ARG0,
+           r->regs[0],r->regs[1],r->regs[2],r->regs[3],r->regs[4],r->regs[5],r->regs[6],r->regs[7],
+           r->regs[8],r->regs[9],r->regs[10],r->regs[11],r->regs[12],r->regs[13],r->regs[14],r->regs[15]);
+    v = uaelib_demux2 (context);
+    if (uaelib_debug)
+       write_log ("=%08x\n", v);
+    return v;
+}
+
 /*
  * Installs the UAE LIBRARY
  */