]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
imported winuaesrc2000b17.zip
authorToni Wilen <twilen@winuae.net>
Wed, 7 Oct 2009 14:56:57 +0000 (17:56 +0300)
committerToni Wilen <twilen@winuae.net>
Mon, 22 Feb 2010 19:48:58 +0000 (21:48 +0200)
24 files changed:
audio.c
blitter.c
cfgfile.c
cia.c
custom.c
dongle.c [new file with mode: 0644]
enforcer.c
filesys.c
include/dongle.h [new file with mode: 0644]
include/execio.h
include/options.h
inputdevice.c
main.c
od-win32/blkdev_win32_aspi.c
od-win32/blkdev_win32_spti.c
od-win32/picasso96_win.c
od-win32/resources/resource
od-win32/resources/winuae.rc
od-win32/win32.h
od-win32/win32gfx.c
od-win32/win32gui.c
od-win32/winuae_msvc/winuae_msvc.vcproj
od-win32/winuaechangelog.txt
scsiemul.c

diff --git a/audio.c b/audio.c
index aef04935c02e874e8a3c44bb3fd868df7fb22f58..6e062ae013bd3ea07d96912561633b3f6bd3322b 100644 (file)
--- a/audio.c
+++ b/audio.c
@@ -1913,5 +1913,6 @@ void audio_vsync (void)
        extrasamples = 10;
     if (extrasamples < -10)
        extrasamples = -10;
+
 #endif
 }
index 9e9126493e576f2a874a7e2f623aac94cabb7f48..c0bbc93492b4dc4a773c36c307e6455467c4e56d 100644 (file)
--- a/blitter.c
+++ b/blitter.c
@@ -1333,8 +1333,8 @@ void do_blitter (int hpos, int copper)
        do_blitter2 (hpos, copper);
        return;
     }
-    // previous blit may be have last write cycle left
-    // we must let it finish
+    // previous blit may have last write cycle left
+    // and we must let it finish
     blit_startcycles = BLITTER_STARTUP_CYCLES + (copper ? 1 : 0);
 }
 
index 2967e6154315e436fd93ee8c3fbb5cb588e510d1..b6d5a854a877cc2ea8d96c2532dadfcac6abce63 100644 (file)
--- a/cfgfile.c
+++ b/cfgfile.c
@@ -168,6 +168,13 @@ static const TCHAR *joyportmodes[] = { NULL, L"mouse", L"djoy", L"ajoy", L"cdtvj
 static const TCHAR *epsonprinter[] = { L"none", L"ascii", L"epson_matrix", 0 };
 static const TCHAR *aspects[] = { L"none", L"vga", L"tv", 0 };
 static const TCHAR *vsyncmodes[] = { L"false", L"true", L"autoswitch", 0 };
+static const TCHAR *dongles[] =
+    {
+    L"none",
+    L"robocop 3", L"leaderboard", L"b.a.t. ii", L"italy'90 soccer", L"dames grand maitre",
+    L"rugby coach", L"cricket captain", L"leviathan",
+    NULL
+};
 
 static const TCHAR *obsolete[] = {
     L"accuracy", L"gfx_opengl", L"gfx_32bit_blits", L"32bit_blits",
@@ -595,6 +602,12 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
            }
        }
     }
+    if (p->dongle) {
+       if (p->dongle + 1 >= sizeof (dongles) / sizeof (TCHAR*))
+           cfgfile_write (f, L"dongle", L"%d", p->dongle);
+       else
+           cfgfile_write_str (f, L"dongle", dongles[p->dongle]);
+    }
 
     cfgfile_write_bool (f, L"bsdsocket_emu", p->socket_emu);
     if (p->a2065name[0])
@@ -702,7 +715,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
     cfgfile_write_bool (f, L"ntsc", p->ntscmode);
     cfgfile_write_bool (f, L"genlock", p->genlock);
     cfgfile_dwrite_bool (f, L"show_leds", p->leds_on_screen & STATUSLINE_CHIPSET);
-    //cfgfile_dwrite_bool (f, L"show_leds_rtg", p->leds_on_screen & STATUSLINE_RTG);
+    cfgfile_dwrite_bool (f, L"show_leds_rtg", p->leds_on_screen & STATUSLINE_RTG);
     cfgfile_dwrite (f, L"keyboard_leds", L"numlock:%s,capslock:%s,scrolllock:%s",
        kbleds[p->keyboard_leds[0]], kbleds[p->keyboard_leds[1]], kbleds[p->keyboard_leds[2]]);
     if (p->chipset_mask & CSMASK_AGA)
@@ -771,11 +784,13 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
     cfgfile_write_bool (f, L"cpu_24bit_addressing", p->address_space_24);
     /* do not reorder end */
 
-    if (p->cpu_frequency)
-       cfgfile_write (f, L"cpu_frequency", L"%d", p->cpu_frequency);
-    if (p->cpu_clock_multiplier) {
-       if (p->cpu_clock_multiplier >= 256)
-           cfgfile_write (f, L"cpu_multiplier", L"%d", p->cpu_clock_multiplier >> 8);
+    if (currprefs.cpu_cycle_exact) {
+       if (p->cpu_frequency)
+           cfgfile_write (f, L"cpu_frequency", L"%d", p->cpu_frequency);
+       if (p->cpu_clock_multiplier) {
+           if (p->cpu_clock_multiplier >= 256)
+               cfgfile_write (f, L"cpu_multiplier", L"%d", p->cpu_clock_multiplier >> 8);
+       }
     }
 
     cfgfile_write_bool (f, L"cpu_cycle_exact", p->cpu_cycle_exact);
@@ -1762,6 +1777,12 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, TCHAR *option, TCHAR *va
        return 1;
     }
 
+    if (cfgfile_intval (option, value, L"dongle", &p->dongle, 1)) {
+       if (p->dongle == 0)
+           cfgfile_strval (option, value, L"dongle", &p->dongle, dongles, 0);
+       return 1;
+    }
+
     for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
        TCHAR tmp[100];
        _stprintf (tmp, L"uaehf%d", i);
diff --git a/cia.c b/cia.c
index a95b7b136da00b7a32f327b9e8f76d269c54c42f..e8fa8b6f929b1b274674d6783d7587d28d63184c 100644 (file)
--- a/cia.c
+++ b/cia.c
@@ -36,6 +36,7 @@
 #include "uae.h"
 #include "amax.h"
 #include "ersatz.h"
+#include "dongle.h"
 
 //#define CIAA_DEBUG_R
 //#define CIAA_DEBUG_W
@@ -598,14 +599,15 @@ static void bfe001_change (void)
 static uae_u8 ReadCIAA (unsigned int addr)
 {
     unsigned int tmp;
+    int reg = addr & 15;
 
     compute_passed_time ();
 
 #ifdef CIAA_DEBUG_R
-    write_log (L"R_CIAA: bfe%x01 %08X\n", addr, M68K_GETPC);
+    write_log (L"R_CIAA: bfe%x01 %08X\n", reg, M68K_GETPC);
 #endif
 
-    switch (addr & 0xf) {
+    switch (reg) {
     case 0:
 #ifdef ACTION_REPLAY
        action_replay_ciaread ();
@@ -617,6 +619,7 @@ static uae_u8 ReadCIAA (unsigned int addr)
            tmp = (tmp & ~0x40) | (ciaapra & 0x40);
        if (ciaadra & 0x80)
            tmp = (tmp & ~0x80) | (ciaapra & 0x80);
+       tmp = dongle_cia_read (0, reg, tmp);
 #ifdef DONGLE_DEBUG
        if (notinrom())
            write_log (L"BFE001 R %02X %s\n", tmp, debuginfo(0));
@@ -638,6 +641,7 @@ static uae_u8 ReadCIAA (unsigned int addr)
 #endif
        {
            tmp = handle_parport_joystick (0, ciaaprb, ciaadrb);
+           tmp = dongle_cia_read (1, reg, tmp);
 #ifdef DONGLE_DEBUG
            if (notinrom())
                write_log (L"BFE101 R %02X %s\n", tmp, debuginfo(0));
@@ -715,15 +719,16 @@ static uae_u8 ReadCIAA (unsigned int addr)
 static uae_u8 ReadCIAB (unsigned int addr)
 {
     unsigned int tmp;
+    int reg = addr & 15;
 
 #ifdef CIAB_DEBUG_R
     if (addr >= 8 && addr <= 10)
-       write_log (L"R_CIAB: bfd%x00 %08X\n", addr, M68K_GETPC);
+       write_log (L"R_CIAB: bfd%x00 %08X\n", reg, M68K_GETPC);
 #endif
 
     compute_passed_time ();
 
-    switch (addr & 0xf) {
+    switch (reg) {
     case 0:
        tmp = 0;
 #ifdef SERIAL_PORT
@@ -741,6 +746,7 @@ static uae_u8 ReadCIAB (unsigned int addr)
            tmp |= handle_parport_joystick (1, ciabpra, ciabdra);
        }
 #endif
+       tmp = dongle_cia_read (1, reg, tmp);
 #ifdef DONGLE_DEBUG
        if (notinrom ())
            write_log (L"BFD000 R %02X %s\n", tmp, debuginfo(0));
@@ -752,6 +758,7 @@ static uae_u8 ReadCIAB (unsigned int addr)
            write_log (L"BFD100 R %02X %s\n", ciabprb, debuginfo(0));
 #endif
        tmp = ciabprb;
+       tmp = dongle_cia_read (1, reg, tmp);
        if (ciabcrb & 2) {
            int pb7 = 0;
            if (ciabcrb & 4)
@@ -811,19 +818,21 @@ static uae_u8 ReadCIAB (unsigned int addr)
     return 0;
 }
 
-static void WriteCIAA (uae_u16 addr,uae_u8 val)
+static void WriteCIAA (uae_u16 addr, uae_u8 val)
 {
+    int reg = addr & 15;
+
 #ifdef CIAA_DEBUG_W
-    write_log (L"W_CIAA: bfe%x01 %02X %08X\n", addr, val, M68K_GETPC);
+    write_log (L"W_CIAA: bfe%x01 %02X %08X\n", reg, val, M68K_GETPC);
 #endif
 #ifdef ACTION_REPLAY
-    ar_ciaa[addr & 0xf] = val;
+    ar_ciaa[reg] = val;
 #endif
     if (!currprefs.cs_ciaoverlay && oldovl) {
        map_overlay (1);
        oldovl = 0;
     }
-    switch (addr & 0xf) {
+    switch (reg) {
     case 0:
 #ifdef DONGLE_DEBUG
        if (notinrom ())
@@ -832,6 +841,7 @@ static void WriteCIAA (uae_u16 addr,uae_u8 val)
        ciaapra = (ciaapra & ~0xc3) | (val & 0xc3);
        bfe001_change ();
        handle_cd32_joystick_cia (ciaapra, ciaadra);
+       dongle_cia_write (0, reg, val);
 #ifdef AMAX
        if (currprefs.amaxromfile[0])
            amax_bfe001_write (val, ciaadra);
@@ -843,6 +853,7 @@ static void WriteCIAA (uae_u16 addr,uae_u8 val)
            write_log (L"BFE101 W %02X %s\n", val, debuginfo(0));
 #endif
        ciaaprb = val;
+       dongle_cia_write (0, reg, val);
 #ifdef PARALLEL_PORT
        if (isprinter() > 0) {
            doprinter (val);
@@ -862,9 +873,13 @@ static void WriteCIAA (uae_u16 addr,uae_u8 val)
        if (notinrom ())
            write_log (L"BFE201 W %02X %s\n", val, debuginfo(0));
 #endif
-       ciaadra = val; bfe001_change (); break;
+       ciaadra = val;
+       dongle_cia_write (0, reg, val);
+       bfe001_change ();
+       break;
     case 3:
        ciaadrb = val;
+       dongle_cia_write (0, reg, val);
 #ifdef DONGLE_DEBUG
        if (notinrom ())
            write_log (L"BFE301 W %02X %s\n", val, debuginfo(0));
@@ -969,21 +984,24 @@ static void WriteCIAA (uae_u16 addr,uae_u8 val)
     }
 }
 
-static void WriteCIAB (uae_u16 addr,uae_u8 val)
+static void WriteCIAB (uae_u16 addr, uae_u8 val)
 {
+    int reg = addr & 15;
+
 #ifdef CIAB_DEBUG_W
     if (addr >= 8 && addr <= 10)
-       write_log (L"W_CIAB: bfd%x00 %02X %08X\n", addr, val, M68K_GETPC);
+       write_log (L"W_CIAB: bfd%x00 %02X %08X\n", reg, val, M68K_GETPC);
 #endif
 #ifdef ACTION_REPLAY
-    ar_ciab[addr & 0xf] = val;
+    ar_ciab[reg] = val;
 #endif
-    switch (addr & 0xf) {
+    switch (reg) {
     case 0:
 #ifdef DONGLE_DEBUG
        if (notinrom ())
            write_log (L"BFD000 W %02X %s\n", val, debuginfo(0));
 #endif
+       dongle_cia_write (1, reg, val);
        ciabpra = val;
 #ifdef SERIAL_PORT
        if (currprefs.use_serial)
@@ -999,12 +1017,16 @@ static void WriteCIAB (uae_u16 addr,uae_u8 val)
        if (notinrom ())
            write_log (L"BFD100 W %02X %s\n", val, debuginfo(0));
 #endif
-       ciabprb = val; DISK_select (val); break;
+       dongle_cia_write (1, reg, val);
+       ciabprb = val;
+       DISK_select (val);
+       break;
     case 2:
 #ifdef DONGLE_DEBUG
        if (notinrom ())
            write_log (L"BFD200 W %02X %s\n", val, debuginfo(0));
 #endif
+       dongle_cia_write (1, reg, val);
        ciabdra = val;
 #ifdef SERIAL_PORT
        if (currprefs.use_serial)
@@ -1016,7 +1038,9 @@ static void WriteCIAB (uae_u16 addr,uae_u8 val)
        if (notinrom ())
            write_log (L"BFD300 W %02X %s\n", val, debuginfo(0));
 #endif
-       ciabdrb = val; break;
+       dongle_cia_write (1, reg, val);
+       ciabdrb = val;
+       break;
     case 4:
        CIA_update ();
        ciabla = (ciabla & 0xff00) | val;
index 859ef530ca4e432798782086451844305c0f6e6e..0149ac54e87587771b46062272129cd3f196d4b7 100644 (file)
--- a/custom.c
+++ b/custom.c
@@ -133,6 +133,7 @@ extern uae_u8* compiled_code;
 
 int vpos;
 int hack_vpos;
+static int hack_vpos2, hack_vpos2vpos;
 static int lof, lol;
 static int next_lineno, prev_lineno;
 static enum nln_how nextline_how;
@@ -827,8 +828,10 @@ STATIC_INLINE void compute_delay_offset (void)
 static void record_color_change2 (int hpos, int regno, unsigned long value)
 {
     curr_color_changes[next_color_change].linepos = hpos * 2;
-    // hpos >= 0xe0, add 2 lores pixels (PAL 0.5 extra cycle, should be in copper emul..)
-    curr_color_changes[next_color_change].linepos += (hpos >= maxhpos - 3) ? 2 : 0;
+#if 0
+    // hpos >= 0xe0, add 2 lores pixels (should be in copper emul..)
+    //curr_color_changes[next_color_change].linepos += (hpos >= maxhpos - 3) ? 2 : 0;
+#endif
     curr_color_changes[next_color_change].regno = regno;
     curr_color_changes[next_color_change++].value = value;
     curr_color_changes[next_color_change].regno = -1;
@@ -2927,6 +2930,7 @@ STATIC_INLINE uae_u16 VPOSR (void)
        hsyncdelay ();
     return vp;
 }
+
 static void VPOSW (uae_u16 v)
 {
 #if 0
@@ -2938,12 +2942,31 @@ static void VPOSW (uae_u16 v)
     lof = (v & 0x8000) ? 1 : 0;
     if (currprefs.chipset_mask & CSMASK_ECS_AGNUS)
        lol = (v & 0x0080) ? 1 : 0;
-    if ((v & 1) && vpos > 0) {
-       hack_vpos = vpos + 1;
-       if (hack_vpos > maxvpos)
-           hack_vpos = maxvpos;
-       hack_vpos &= ~1;
-    }
+    hack_vpos2 = (vpos & 0xff);
+    if (v & 1)
+       hack_vpos2 |= 0x100;
+    hack_vpos2vpos = vpos;
+    if (hack_vpos2 > maxvpos)
+       hack_vpos2 = maxvpos;
+    vpos = hack_vpos2;
+}
+
+static void VHPOSW (uae_u16 v)
+{
+#if 0
+    if (M68K_GETPC < 0xf00000)
+       write_log (L"VHPOSW %04X PC=%08x\n", v, M68K_GETPC);
+#endif
+    v >>= 8;
+    if (hack_vpos2 & 0x100)
+       v |= 0x100;
+    else if (vpos & 0x100)
+       v |= 0x100;
+    hack_vpos2 = v;
+    hack_vpos2vpos = vpos;
+    if (hack_vpos2 > maxvpos)
+       hack_vpos2 = maxvpos;
+    vpos = hack_vpos2;
 }
 
 STATIC_INLINE uae_u16 VHPOSR (void)
@@ -3945,10 +3968,15 @@ static void COLOR_WRITE (int hpos, uae_u16 v, int num)
 /* Determine which cycles are available for the copper in a display
  * with a agiven number of planes.  */
 
-STATIC_INLINE int copper_cant_read (int hpos)
+STATIC_INLINE int copper_cant_read (int hpos, int alloc)
 {
     if (hpos + 1 >= maxhpos) // first refresh slot
        return 1;
+    if ((hpos == maxhpos - 3) && (maxhpos & 1)) {
+       if (alloc)
+           alloc_cycle (hpos, CYCLE_COPPER);
+       return -1;
+    }
     return is_bitplane_dma_inline (hpos);
 }
 
@@ -4050,7 +4078,10 @@ static void update_copper (int until_hpos)
            }
        }
 #endif
-       c_hpos += 2;
+       if ((c_hpos == maxhpos - 3) && (maxhpos & 1))
+           c_hpos += 1;
+       else
+           c_hpos += 2;
 
        if (cop_state.strobe) {
            if (cop_state.strobe > 0)
@@ -4061,18 +4092,18 @@ static void update_copper (int until_hpos)
        switch (cop_state.state)
        {
        case COP_wait_in2:
-           if (copper_cant_read (old_hpos))
+           if (copper_cant_read (old_hpos, 0))
                continue;
            cop_state.state = COP_wait1;
            break;
        case COP_skip_in2:
-           if (copper_cant_read (old_hpos))
+           if (copper_cant_read (old_hpos, 0))
                continue;
            cop_state.state = COP_skip1;
            break;
        case COP_strobe_delay1:
            // first cycle after COPJMP is just like normal first read cycle
-           if (copper_cant_read (old_hpos))
+           if (copper_cant_read (old_hpos, 1))
                continue;
            cop_state.state = COP_strobe_delay2;
            alloc_cycle (old_hpos, CYCLE_COPPER);
@@ -4085,7 +4116,7 @@ static void update_copper (int until_hpos)
            // second cycle after COPJMP is like second read cycle except
            // there is 0x1FE as a target register
            // (following word is still read normally and tossed away)
-           if (copper_cant_read (old_hpos))
+           if (copper_cant_read (old_hpos, 1))
                continue;
            cop_state.state = COP_read1;
            alloc_cycle (old_hpos, CYCLE_COPPER);
@@ -4093,7 +4124,7 @@ static void update_copper (int until_hpos)
                record_dma (0x1fe, chipmem_agnus_wget (cop_state.ip + 2), cop_state.ip + 2, old_hpos, vpos);
            break;
        case COP_start_delay:
-           if (copper_cant_read (old_hpos))
+           if (copper_cant_read (old_hpos, 1))
                continue;
            cop_state.state = COP_read1;
            alloc_cycle (old_hpos, CYCLE_COPPER);
@@ -4102,7 +4133,7 @@ static void update_copper (int until_hpos)
            break;
 
        case COP_read1:
-           if (copper_cant_read (old_hpos))
+           if (copper_cant_read (old_hpos, 1))
                continue;
            cop_state.i1 = last_custom_value1 = chipmem_agnus_wget (cop_state.ip);
            alloc_cycle (old_hpos, CYCLE_COPPER);
@@ -4115,7 +4146,7 @@ static void update_copper (int until_hpos)
            break;
 
        case COP_read2:
-           if (copper_cant_read (old_hpos))
+           if (copper_cant_read (old_hpos, 1))
                continue;
            cop_state.i2 = last_custom_value1 = chipmem_agnus_wget (cop_state.ip);
            alloc_cycle (old_hpos, CYCLE_COPPER);
@@ -4219,7 +4250,7 @@ static void update_copper (int until_hpos)
 
            /* fall through */
        case COP_wait:
-           if (copper_cant_read (old_hpos))
+           if (copper_cant_read (old_hpos, 0))
                continue;
 
            hp = c_hpos & (cop_state.saved_i2 & 0xFE);
@@ -4256,7 +4287,7 @@ static void update_copper (int until_hpos)
 
            if (c_hpos >= (maxhpos & ~1))
                break;
-           if (copper_cant_read (old_hpos))
+           if (copper_cant_read (old_hpos, 0))
                continue;
 
            vcmp = (cop_state.saved_i1 & (cop_state.saved_i2 | 0x8000)) >> 8;
@@ -4870,6 +4901,16 @@ static void vsync_handler (void)
 
     /* For now, let's only allow this to change at vsync time.  It gets too
      * hairy otherwise.  */
+    if (hack_vpos2) {
+       hack_vpos = hack_vpos2vpos + 1;
+       if (hack_vpos2 < maxvpos)
+           hack_vpos += maxvpos - hack_vpos2;
+       if (hack_vpos > maxvpos)
+           hack_vpos = maxvpos;
+       if (hack_vpos < 10)
+           hack_vpos = 10;
+       hack_vpos2 = 0;
+    }
     if ((beamcon0 & (0x20|0x80)) != (new_beamcon0 & (0x20|0x80)) || hack_vpos)
        init_hz ();
 
@@ -5913,6 +5954,7 @@ static int REGPARAM2 custom_wput_1 (int hpos, uaecptr addr, uae_u32 value, int n
      case 0x026: DSKDAT (value); break;
 
      case 0x02A: VPOSW (value); break;
+     case 0x02C: VHPOSW (value); break;
      case 0x02E: COPCON (value); break;
      case 0x030: SERDAT (value); break;
      case 0x032: SERPER (value); break;
@@ -6735,16 +6777,11 @@ void wait_cpu_cycle_write (uaecptr addr, int mode, uae_u32 v)
 
 void do_cycles_ce (long cycles)
 {
-    int hpos;
-    int mask = CYCLE_UNIT - 1;
     static int extra;
 
-    extra += cycles & mask;
-    cycles &= ~mask;
-    cycles += extra & ~mask;
-    extra &= mask;
+    cycles += extra;
     while (cycles >= CYCLE_UNIT) {
-       hpos = current_hpos () + 1;
+       int hpos = current_hpos () + 1;
        sync_copper (hpos);
        decide_line (hpos);
        decide_fetch_ce (hpos);
@@ -6753,6 +6790,7 @@ void do_cycles_ce (long cycles)
        do_cycles (1 * CYCLE_UNIT);
        cycles -= CYCLE_UNIT;
     }
+    extra = cycles;
 }
 
 int is_cycle_ce (void)
diff --git a/dongle.c b/dongle.c
new file mode 100644 (file)
index 0000000..3ac79bf
--- /dev/null
+++ b/dongle.c
@@ -0,0 +1,231 @@
+
+ /*
+  * UAE - The Un*x Amiga Emulator
+  *
+  * Emulates simple protection dongles
+  *
+  * Copyright 2009 Toni Wilen
+  */
+
+
+#include "sysconfig.h"
+#include "sysdeps.h"
+
+#include "options.h"
+#include "events.h"
+#include "uae.h"
+
+#define ROBOCOP3 1
+#define LEADERBOARD 2
+#define BAT2 3
+#define ITALY90 4
+#define DAMESGRANDMAITRE 5
+#define RUGBYCOACH 6
+#define CRICKETCAPTAIN 7
+#define LEVIATHAN 8
+#define LOGISTIX 10
+
+static int type = 0;
+static int flag;
+static unsigned int cycles;
+
+/*
+    Robocop 3
+    - set firebutton as output
+    - read JOY1DAT
+    - pulse firebutton (high->low)
+    - read JOY1DAT
+    - JOY1DAT bit 8 must toggle
+    
+    Leaderboard
+    - JOY1DAT, both up and down active (0x0101)
+    
+    B.A.T. II
+    - set all serial pins as output except CTS
+    - game pulses DTR (high->low)
+    - CTS must be one
+    - delay
+    - CTS must be zero
+    
+    Italy'90 Soccer
+    - 220k resistor between pins 5 (+5v) and 7 (POTX)
+    - POT1DAT POTX must be between 0x32 and 0x60
+    
+    Dames Grand Maitre
+    - read POT1
+    - POT1X != POT1Y
+    - POT1Y * 256 / POT1X must be between 450 and 500
+    
+    Rugby Coach
+    - JOY1DAT, left, up and down active (0x0301)
+    
+    Cricket Captain
+    - JOY0DAT bits 0 and 1:
+      - 10 01 11 allowed
+      - must continuously change state
+    
+    Leviathan
+      - not implemented yet
+    
+    Logistix/SuperBase
+    - second button must be high
+    - POT1X = 150k
+    - POT1Y = 100k
+    - POT1X * 10 / POT1Y must be between 12 and 33
+
+
+*/
+
+static uae_u8 oldcia[2][16];
+
+void dongle_reset (void)
+{
+    type = currprefs.dongle;
+    flag = 0;
+    memset (oldcia, 0, sizeof oldcia);
+}
+
+uae_u8 dongle_cia_read (int cia, int reg, uae_u8 val)
+{
+    if (!type)
+       return val;
+    switch (type)
+    {
+       case BAT2:
+       if (cia == 1 && reg == 0) {
+           if (!flag || get_cycles () > cycles + CYCLE_UNIT * 200) {
+               val &= ~0x10;
+               flag = 0;
+           } else {
+               val |= 0x10;
+           }
+       }
+       break;
+    }
+    return val;
+}
+
+void dongle_cia_write (int cia, int reg, uae_u8 val)
+{
+    if (!type)
+       return;
+    switch (type)
+    {
+       case ROBOCOP3:
+       if (cia == 0 && reg == 0 && (val & 0x80))
+           flag ^= 1;
+       break;
+       case BAT2:
+       if (cia == 1 && reg == 0 && !(val & 0x80)) {
+           flag = 1;
+           cycles = get_cycles ();
+       }
+       break;
+    }
+    oldcia[cia][reg] = val;
+}
+
+void dongle_joytest (uae_u16 val)
+{
+}
+
+uae_u16 dongle_joydat (int port, uae_u16 val)
+{
+    if (!type)
+       return val;
+    switch (type)
+    {
+       case ROBOCOP3:
+       if (port == 1 && flag)
+           val += 0x100;
+       break;
+       case LEADERBOARD:
+       if (port == 1) {
+           val &= ~0x0303;
+           val |= 0x0101;
+       }
+       break;
+       case RUGBYCOACH:
+       if (port == 1) {
+           val &= ~0x0303;
+           val|= 0x0301;
+       }
+       break;
+       case CRICKETCAPTAIN:
+       if (port == 0) {
+           val &= ~0x0003;
+           if (flag == 0)
+               val |= 0x0001;
+           else
+               val |= 0x0002;
+       }
+       flag ^= 1;
+       break;
+    }
+    return val;
+}
+
+void dongle_potgo (uae_u16 val)
+{
+    if (!type)
+       return;
+    switch (type)
+    {
+       case ITALY90:
+       case LOGISTIX:
+       case DAMESGRANDMAITRE:
+        flag = (uaerand () & 7) - 3;
+       break;
+    }
+
+}
+
+uae_u16 dongle_potgor (uae_u16 val)
+{
+    if (!type)
+       return val;
+    switch (type)
+    {
+       case LOGISTIX:
+       val |= 1 << 14;
+       break;
+    }
+    return val;
+}
+
+int dongle_analogjoy (int joy, int axis)
+{
+    int v = -1;
+    if (!type)
+       return -1;
+    switch (type)
+    {
+       case ITALY90:
+       if (joy == 1 && axis == 0)
+           v = 73;
+       break;
+       case LOGISTIX:
+       if (joy == 1) {
+           if (axis == 0)
+               v = 21;
+           if (axis == 1)
+               v = 10;
+       }
+       break;
+       case DAMESGRANDMAITRE:
+       if (joy == 1) {
+           if (axis == 1)
+               v = 80;
+           if (axis == 0)
+               v = 43;
+       }
+       break;
+
+    }
+    if (v >= 0) {
+       v += flag;
+       if (v < 0)
+           v = 0;
+    }
+    return v;
+}
\ No newline at end of file
index d85c67875ae3894c66c47d09683d24ac31627b37..b836ff2a661b2b1be5252ab0e9282308b56d8787 100644 (file)
 #define BACKTRACELONGS 500
 #define INSTRUCTIONLINES 17
 
-#define ISILLEGAL_LONG(addr) (addr < 4 || (addr > 4 && addr < ENFORCESIZE))
-#define ISILLEGAL_WORD(addr) (addr < ENFORCESIZE)
-#define ISILLEGAL_BYTE(addr) (addr < ENFORCESIZE)
+#define ISEXEC(addr) ((addr) >= 4 && (addr) <= 7)
+#define ISILLEGAL_LONG(addr) ((addr) < 4 || ((addr) > 4 && (addr) < ENFORCESIZE))
+#define ISILLEGAL_WORD(addr) ((addr) < ENFORCESIZE)
+#define ISILLEGAL_BYTE(addr) ((addr) < ENFORCESIZE)
 
 extern uae_u8 *natmem_offset;
 
@@ -436,6 +437,8 @@ void REGPARAM2 chipmem_lput2 (uaecptr addr, uae_u32 l)
            if (addr != 0x100)
                set_special (SPCFLAG_TRAP);
     }
+    if (ISEXEC (addr) || ISEXEC (addr + 1) || ISEXEC (addr + 2) || ISEXEC (addr + 3))
+       return;
     do_put_mem_long (m, l);
 }
 
@@ -453,6 +456,8 @@ void REGPARAM2 chipmem_wput2 (uaecptr addr, uae_u32 w)
        if (enforcermode & 1)
            set_special (SPCFLAG_TRAP);
     }
+    if (ISEXEC (addr) || ISEXEC (addr + 1))
+       return;
     do_put_mem_word (m, w);
 }
 
@@ -467,6 +472,8 @@ void REGPARAM2 chipmem_bput2 (uaecptr addr, uae_u32 b)
        if (enforcermode & 1)
            set_special (SPCFLAG_TRAP);
     }
+    if (ISEXEC (addr))
+       return;
     chipmemory[addr] = b;
 }
 
index 9a6bf3d848bc69affc69cc791898b3af98780b05..ee88d1298a7b30133c9b04fbfcd5ebef5b6749b0 100644 (file)
--- a/filesys.c
+++ b/filesys.c
@@ -2248,7 +2248,7 @@ static Key *lookup_key (Unit *unit, uae_u32 uniq)
 
 static Key *new_key (Unit *unit)
 {
-    Key *k = xmalloc (sizeof (Key));
+    Key *k = xcalloc (sizeof (Key), 1);
     k->uniq = ++key_uniq;
     k->fd = NULL;
     k->file_pos = 0;
diff --git a/include/dongle.h b/include/dongle.h
new file mode 100644 (file)
index 0000000..d2f8e4f
--- /dev/null
@@ -0,0 +1,8 @@
+extern void dongle_reset (void);
+extern uae_u8 dongle_cia_read (int, int, uae_u8);
+extern void dongle_cia_write (int, int, uae_u8);
+extern void dongle_joytest (uae_u16);
+extern uae_u16 dongle_joydat (int, uae_u16);
+extern void dongle_potgo (uae_u16);
+extern uae_u16 dongle_potgor (uae_u16);
+extern int dongle_analogjoy (int, int);
\ No newline at end of file
index 6eda196185510ebaf1b099268675711ad592c542..fa7f77c3ffcd6f147b520d8decf4cba163eb0318 100644 (file)
@@ -7,6 +7,8 @@
 #define IOERR_UNITBUSY  -6
 #define IOERR_SELFTEST  -7
 
+#define TDERR_DiskChanged 29
+
 #define CMD_INVALID    0
 #define CMD_RESET      1
 #define CMD_READ       2
index b60588f500d4e29b13b47fe4af6c6c492d8da759..b787c5297c6049d0d649c216bae791b48671a874 100644 (file)
@@ -379,6 +379,7 @@ struct uae_prefs {
     struct uae_input_device joystick_settings[MAX_INPUT_SETTINGS + 1][MAX_INPUT_DEVICES];
     struct uae_input_device mouse_settings[MAX_INPUT_SETTINGS + 1][MAX_INPUT_DEVICES];
     struct uae_input_device keyboard_settings[MAX_INPUT_SETTINGS + 1][MAX_INPUT_DEVICES];
+    int dongle;
 };
 
 /* Contains the filename of .uaerc */
index 2ea6bf02d44b5a0711a73c8428d41ce6f71de3f3..d14bfc6467a82178605fe26513c89b9f2246f6bb 100644 (file)
@@ -46,6 +46,7 @@
 #include "cia.h"
 #include "autoconf.h"
 #include "rp.h"
+#include "dongle.h"
 
 extern int bootrom_header, bootrom_items;
 
@@ -393,8 +394,8 @@ static struct uae_input_device *mice;
 static struct uae_input_device *keyboards;
 static struct uae_input_device_kbr_default *keyboard_default;
 
-static double mouse_axis[MAX_INPUT_DEVICES][MAX_INPUT_DEVICE_EVENTS];
-static double oldm_axis[MAX_INPUT_DEVICES][MAX_INPUT_DEVICE_EVENTS];
+static int mouse_axis[MAX_INPUT_DEVICES][MAX_INPUT_DEVICE_EVENTS];
+static int oldm_axis[MAX_INPUT_DEVICES][MAX_INPUT_DEVICE_EVENTS];
 
 static int mouse_x[MAX_INPUT_DEVICES], mouse_y[MAX_INPUT_DEVICE_EVENTS];
 static int mouse_delta[MAX_INPUT_DEVICES][MAX_INPUT_DEVICE_EVENTS];
@@ -1639,30 +1640,31 @@ static void readinput (void)
 
 int getjoystate (int joy)
 {
-    int left = 0, right = 0, top = 0, bot = 0;
+    int left = 1, right = 1, top = 1, bot = 1;
     uae_u16 v = 0;
 
     if (inputdevice_logging & 2)
        write_log (L"JOY%dDAT %08x\n", joy, M68K_GETPC);
     readinput ();
     if (joydir[joy] & DIR_LEFT)
-       left = 1;
+       left = 0;
     if (joydir[joy] & DIR_RIGHT)
-       right = 1;
+       right = 0;
     if (joydir[joy] & DIR_UP)
-       top = 1;
+       top = 0;
     if (joydir[joy] & DIR_DOWN)
-       bot = 1;
+       bot = 0;
     v = (uae_u8)mouse_x[joy] | (mouse_y[joy] << 8);
-    if (left || right || top || bot || !mouse_port[joy]) {
+    if (!left || !right || !top || !bot || !mouse_port[joy]) {
+       int b9, b8, b1, b0;
        mouse_x[joy] &= ~3;
        mouse_y[joy] &= ~3;
-       if (left)
-           top = !top;
-       if (right)
-           bot = !bot;
+       b0 = bot ^ right;
+       b1 = right ^ 1;
+       b8 = top ^ left;
+       b9 = left ^ 1;
        v &= ~0x0303;
-       v |= bot | (right << 1) | (top << 8) | (left << 9);
+       v |= (b0 << 0) | (b1 << 1) | (b8 << 8) | (b9 << 9);
     }
 #ifdef DONGLE_DEBUG
     if (notinrom ())
@@ -1686,11 +1688,18 @@ int getjoystate (int joy)
 
 uae_u16 JOY0DAT (void)
 {
-    return getjoystate (0);
+    uae_u16 v;
+    v = getjoystate (0);
+    v = dongle_joydat (0, v);
+    return v;
 }
+
 uae_u16 JOY1DAT (void)
 {
-    return getjoystate (1);
+    uae_u16 v;
+    v = getjoystate (1);
+    v = dongle_joydat (1, v);
+    return v;
 }
 
 void JOYTEST (uae_u16 v)
@@ -1707,6 +1716,7 @@ void JOYTEST (uae_u16 v)
     mouse_frame_y[0] = mouse_y[0];
     mouse_frame_x[1] = mouse_x[1];
     mouse_frame_y[1] = mouse_y[1];
+    dongle_joytest (v);
     if (inputdevice_logging & 2)
        write_log (L"JOYTEST: %04X PC=%x\n", v , M68K_GETPC);
 }
@@ -1767,17 +1777,26 @@ static void cap_check (void)
 
     for (joy = 0; joy < 2; joy++) {
        for (i = 0; i < 2; i++) {
-           int charge = 0;
+           int charge = 0, dong, joypot;
            uae_u16 pdir = 0x0200 << (joy * 4 + i * 2); /* output enable */
            uae_u16 pdat = 0x0100 << (joy * 4 + i * 2); /* data */
            int isbutton = getbuttonstate (joy, i == 0 ? JOYBUTTON_3 : JOYBUTTON_2);
 
            if (cd32_pad_enabled[joy])
                continue;
-           if (analog_port[joy][i] && pot_cap[joy][i] < joydirpot[joy][i])
-               charge = 1; // slow charge via pot variable resistor
-           if ((digital_port[joy][i] || mouse_port[joy]))
-               charge = 1; // slow charge via pull-up resistor
+           dong = dongle_analogjoy (joy, i);
+           if (dong >= 0) {
+               isbutton = 0;
+               joypot = dong;
+               if (pot_cap[joy][i] < joypot)
+                   charge = 1; // slow charge via dongle resistor
+           } else {
+               joypot = joydirpot[joy][i];
+               if (analog_port[joy][i] && pot_cap[joy][i] < joypot)
+                   charge = 1; // slow charge via pot variable resistor
+               if ((digital_port[joy][i] || mouse_port[joy]))
+                   charge = 1; // slow charge via pull-up resistor
+           }
            if (!(potgo_value & pdir)) { // input?
                if (pot_dat_act[joy][i])
                    pot_dat[joy][i]++;
@@ -1790,11 +1809,16 @@ static void cap_check (void)
                        pot_dat[joy][i] = 0;
                    }
                }
-               if (analog_port[joy][i] && pot_dat_act[joy][i] == 2 && pot_cap[joy][i] >= joydirpot[joy][i])
-                   pot_dat_act[joy][i] = 0;
-               if ((digital_port[joy][i] || mouse_port[joy]) && pot_dat_act[joy][i] == 2) {
-                   if (pot_cap[joy][i] >= 10 && !isbutton)
+               if (dong >= 0) {
+                   if (pot_dat_act[joy][i] == 2 && pot_cap[joy][i] >= joypot)
+                       pot_dat_act[joy][i] = 0;
+               } else {
+                   if (analog_port[joy][i] && pot_dat_act[joy][i] == 2 && pot_cap[joy][i] >= joypot)
                        pot_dat_act[joy][i] = 0;
+                   if ((digital_port[joy][i] || mouse_port[joy]) && pot_dat_act[joy][i] == 2) {
+                       if (pot_cap[joy][i] >= 10 && !isbutton)
+                           pot_dat_act[joy][i] = 0;
+                   }
                }
            } else { // output?
                charge = (potgo_value & pdat) ? 2 : -2; /* fast (dis)charge if output */
@@ -1814,13 +1838,13 @@ static void cap_check (void)
            }
            /* official Commodore mouse has pull-up resistors in button lines
             * NOTE: 3rd party mice may not have pullups! */
-           if (mouse_port[joy] && charge == 0)
+           if (dong < 0 && mouse_port[joy] && charge == 0)
                charge = 2;
            /* emulate pullup resistor if button mapped because there too many broken
             * programs that read second button in input-mode (and most 2+ button pads have
             * pullups)
             */
-           if (digital_port[joy][i] && charge == 0)
+           if (dong < 0 && digital_port[joy][i] && charge == 0)
                charge = 2;
 
            charge_cap (joy, i, charge);
@@ -1979,6 +2003,7 @@ void POTGO (uae_u16 v)
     if (notinrom ())
        write_log (L"POTGO %04X %s\n", v, debuginfo(0));
 #endif
+    dongle_potgo (v);
     potgo_value = potgo_value & 0x5500; /* keep state of data bits */
     potgo_value |= v & 0xaa00; /* get new direction bits */
     for (i = 0; i < 8; i += 2) {
@@ -2009,7 +2034,10 @@ void POTGO (uae_u16 v)
 
 uae_u16 POTGOR (void)
 {
-    uae_u16 v = handle_joystick_potgor (potgo_value) & 0x5500;
+    uae_u16 v;
+    
+    v = handle_joystick_potgor (potgo_value) & 0x5500;
+    v = dongle_potgor (v);
 #ifdef DONGLE_DEBUG
     if (notinrom ())
        write_log (L"POTGOR %04X %s\n", v, debuginfo(0));
@@ -2491,10 +2519,14 @@ int handle_input_event (int nr, int state, int max, int autofire)
                int left = oleft[joy], right = oright[joy], top = otop[joy], bot = obot[joy];
                if (ie->type & 16) {
                    /* button to axis mapping */
-                   if (ie->data & DIR_LEFT) left = oleft[joy] = state ? 1 : 0;
-                   if (ie->data & DIR_RIGHT) right = oright[joy] = state ? 1 : 0;
-                   if (ie->data & DIR_UP) top = otop[joy] = state ? 1 : 0;
-                   if (ie->data & DIR_DOWN) bot = obot[joy] = state ? 1 : 0;
+                   if (ie->data & DIR_LEFT)
+                       left = oleft[joy] = state ? 1 : 0;
+                   if (ie->data & DIR_RIGHT)
+                       right = oright[joy] = state ? 1 : 0;
+                   if (ie->data & DIR_UP)
+                       top = otop[joy] = state ? 1 : 0;
+                   if (ie->data & DIR_DOWN)
+                       bot = obot[joy] = state ? 1 : 0;
                } else {
                    /* "normal" joystick axis */
                    int deadzone = currprefs.input_joystick_deadzone * max / 100;
@@ -2503,16 +2535,24 @@ int handle_input_event (int nr, int state, int max, int autofire)
                        state = 0;
                    neg = state < 0 ? 1 : 0;
                    pos = state > 0 ? 1 : 0;
-                   if (ie->data & DIR_LEFT) left = oleft[joy] = neg;
-                   if (ie->data & DIR_RIGHT) right = oright[joy] = pos;
-                   if (ie->data & DIR_UP) top = otop[joy] = neg;
-                   if (ie->data & DIR_DOWN) bot = obot[joy] = pos;
+                   if (ie->data & DIR_LEFT)
+                       left = oleft[joy] = neg;
+                   if (ie->data & DIR_RIGHT)
+                       right = oright[joy] = pos;
+                   if (ie->data & DIR_UP)
+                       top = otop[joy] = neg;
+                   if (ie->data & DIR_DOWN)
+                       bot = obot[joy] = pos;
                }
                joydir[joy] = 0;
-               if (left) joydir[joy] |= DIR_LEFT;
-               if (right) joydir[joy] |= DIR_RIGHT;
-               if (top) joydir[joy] |= DIR_UP;
-               if (bot) joydir[joy] |= DIR_DOWN;
+               if (left)
+                   joydir[joy] |= DIR_LEFT;
+               if (right)
+                   joydir[joy] |= DIR_RIGHT;
+               if (top)
+                   joydir[joy] |= DIR_UP;
+               if (bot)
+                   joydir[joy] |= DIR_DOWN;
 
            }
        break;
@@ -3243,11 +3283,13 @@ void inputdevice_updateconfig (struct uae_prefs *prefs)
     oldmx[0] = oldmx[1] = -1;
     oldmy[0] = oldmy[1] = -1;
     cd32_shifter[0] = cd32_shifter[1] = 8;
-    oleft[0] = oleft[1] = 0;
-    oright[0] = oright[1] = 0;
-    otop[0] = otop[1] = 0;
-    obot[0] = obot[1] = 0;
-    for (i = 0; i < 2; i++) {
+    for (i = 0; i < 4; i++) {
+       oleft[i] = 0;
+       oright[i] = 0;
+       otop[i] = 0;
+       obot[i] = 0;
+    }
+    for (i = 0; i < MAX_INPUT_DEVICES; i++) {
        mouse_deltanoreset[i][0] = 0;
        mouse_delta[i][0] = 0;
        mouse_deltanoreset[i][1] = 0;
@@ -4093,11 +4135,11 @@ int getjoystickstate(int joy)
 
 void setmousestate (int mouse, int axis, int data, int isabs)
 {
-    int i, v;
-    double *mouse_p, *oldm_p, d, diff;
+    int i, v, diff;
+    int *mouse_p, *oldm_p;
+    double d;
     struct uae_input_device *id = &mice[mouse];
-    static double fract1[MAX_INPUT_DEVICES][MAX_INPUT_DEVICE_EVENTS];
-    static double fract2[MAX_INPUT_DEVICES][MAX_INPUT_DEVICE_EVENTS];
+    static double fract[MAX_INPUT_DEVICES][MAX_INPUT_DEVICE_EVENTS];
 
     if (testmode) {
        testrecord (IDTYPE_MOUSE, mouse, IDEV_WIDGET_AXIS, axis, data);
@@ -4122,7 +4164,7 @@ void setmousestate (int mouse, int axis, int data, int isabs)
        *mouse_p += data;
        d = (*mouse_p - *oldm_p) * currprefs.input_mouse_speed / 100.0;
     } else {
-       d = data - (int)(*oldm_p);
+       d = data - *oldm_p;
        *oldm_p = data;
        *mouse_p += d;
        if (axis == 0)
@@ -4134,14 +4176,11 @@ void setmousestate (int mouse, int axis, int data, int isabs)
        if (currprefs.input_tablet == TABLET_MOUSEHACK && mousehack_alive ())
            return;
     }
-    v = (int)(d > 0 ? d + 0.5 : d - 0.5);
-    fract1[mouse][axis] += d;
-    fract2[mouse][axis] += v;
-    diff = fract2[mouse][axis] - fract1[mouse][axis];
-    if (diff > 1 || diff < -1) {
-       v -= (int)diff;
-       fract2[mouse][axis] -= diff;
-    }
+    v = (int)d;
+    fract[mouse][axis] += d - v;
+    diff = (int)fract[mouse][axis];
+    v += diff;
+    fract[mouse][axis] -= diff;
     for (i = 0; i < MAX_INPUT_SUB_EVENT; i++)
        handle_input_event (id->eventid[ID_AXIS_OFFSET + axis][i], v, 0, 0);
 }
diff --git a/main.c b/main.c
index aa9f0992b991ec522cca66a5097987f955a60a89..1dc4c69e05c6960e88478f48442469c8108f8a77 100644 (file)
--- a/main.c
+++ b/main.c
@@ -50,6 +50,7 @@
 #include "blkdev.h"
 #include "gfxfilter.h"
 #include "uaeresource.h"
+#include "dongle.h"
 
 #ifdef USE_SDL
 #include "SDL.h"
@@ -612,6 +613,7 @@ void reset_all_systems (void)
     initparallel ();
 #endif
     native2amiga_reset ();
+    dongle_reset ();
 }
 
 /* Okay, this stuff looks strange, but it is here to encourage people who
index aeeece0491e5c4f8272cc138ccd5f0f04139962c..7dfd4949b776636b7c307a405d6d387aa41a8214 100644 (file)
@@ -844,7 +844,7 @@ static int mediacheck_full (int unitnum, struct device_info *di)
     ok = execscsicmd_in(unitnum, cmd1, sizeof cmd1, &outlen) ? 1 : 0;
     if (ok) {
        di->bytespersector = (p[4] << 24) | (p[5] << 16) | (p[6] << 8) | p[7];
-       di->sectorspertrack = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
+       di->sectorspertrack = ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]) + 1;
         di->trackspercylinder = 1;
         di->cylinders = 1;
     }
index cc82994eb7c4c001cf72521e5f3131944e7958ea..28013fca3af00202c3212b85a52cc3f58969207f 100644 (file)
@@ -362,7 +362,7 @@ static int mediacheck_full (int unitnum, struct device_info *di)
     p = execscsicmd_in (unitnum, cmd1, sizeof cmd1, &outlen);
     if (p && outlen >= 8) {
        di->bytespersector = (p[4] << 24) | (p[5] << 16) | (p[6] << 8) | p[7];
-        di->sectorspertrack = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
+        di->sectorspertrack = ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]) + 1;
         di->trackspercylinder = 1;
         di->cylinders = 1;
     }
index c2895069a3d13669f11730279fa5ad01251c1b5d..3caafbcfac05ca86ca3a888c249ad124a5cd16a7 100644 (file)
@@ -3791,6 +3791,24 @@ static uae_u32 REGPARAM2 picasso_BlitPlanar2Direct (TrapContext *ctx)
     return result;
 }
 
+#include "statusline.h"
+static void statusline (uae_u8 *dst)
+{
+    int y, yy;
+    int dst_height, pitch;
+
+    dst_height = picasso96_state.Height;
+    if (dst_height > picasso_vidinfo.height)
+       dst_height = picasso_vidinfo.height;
+    pitch = picasso_vidinfo.rowbytes;
+    yy = 0;
+    for (y = dst_height - TD_TOTAL_HEIGHT; y < dst_height; y++) {
+       uae_u8 *buf = dst + y * pitch;
+       draw_status_line_single (buf, picasso_vidinfo.pixbytes, yy, picasso96_state.Width, p96rc, p96gc, p96bc, NULL);
+       yy++;
+    }
+}
+
 STATIC_INLINE void copyrow (uae_u8 *src, uae_u8 *dst, int x, int y, int width)
 {
     uae_u8 *src2 = src + y * picasso96_state.BytesPerRow;
@@ -3801,7 +3819,7 @@ STATIC_INLINE void copyrow (uae_u8 *src, uae_u8 *dst, int x, int y, int width)
 
     if (picasso96_state.RGBFormat == host_mode) {
         memcpy (dst2 + x * dstpix, src2 + x * srcpix, width * dstpix);
-        return;
+       return;
     }
 
     endx4 = endx & ~3;
@@ -4036,7 +4054,9 @@ static void copyallinvert (uae_u8 *src, uae_u8 *dst)
 static void copyall (uae_u8 *src, uae_u8 *dst)
 {
     int y;
+    uae_u8 *dstb;
 
+    dstb = dst;
     if (picasso96_state.RGBFormat == host_mode) {
        int w = picasso96_state.Width * picasso_vidinfo.pixbytes;
        for (y = 0; y < picasso96_state.Height; y++) {
@@ -4050,22 +4070,6 @@ static void copyall (uae_u8 *src, uae_u8 *dst)
     }
 }
 
-#include "statusline.h"
-static void statusline (uae_u8 *dst)
-{
-    int y, yy;
-    int dst_height, pitch;
-
-    dst_height = picasso96_state.Height;
-    pitch = picasso_vidinfo.rowbytes;
-    yy = 0;
-    for (y = dst_height - TD_TOTAL_HEIGHT; y < dst_height; y++) {
-        uae_u8 *buf = dst + y * pitch;
-       draw_status_line_single (buf, picasso_vidinfo.pixbytes, yy, picasso96_state.Width, p96rc, p96gc, p96bc, NULL);
-        yy++;
-    }
-}
-
 static void flushpixels (void)
 {
     int i;
@@ -4192,6 +4196,23 @@ static void flushpixels (void)
        break;
     }
 
+    if (currprefs.leds_on_screen & STATUSLINE_RTG) {
+       if (dst == NULL) {
+           if (DirectDraw_IsLocked () == FALSE) {
+               if (!lock)
+                   dst = gfx_lock_picasso ();
+               lock = 1;
+           } else {
+               dst = picasso96_state.HostAddress;
+           }
+       }
+       if (dst) {
+           statusline (dst);
+           maxy = picasso_vidinfo.height;
+           if (miny > picasso_vidinfo.height - TD_TOTAL_HEIGHT)
+               miny = picasso_vidinfo.height - TD_TOTAL_HEIGHT;
+       }
+    }
     if (maxy >= 0) {
        if (doskip () && p96skipmode == 4) {
            ;
@@ -4199,21 +4220,7 @@ static void flushpixels (void)
            DX_Invalidate (0, miny, picasso96_state.Width, maxy - miny);
        }
     }
-#if 0
-    if (currprefs.leds_on_screen & STATUSLINE_RTG) {
-       if (!dst && !lock) {
-           dst = gfx_lock_picasso ();
-           lock = 1;
-       }
-       if (dst) {
-           statusline (dst);
-           if (maxy < 0)
-               DX_Invalidate (0, picasso96_state.Height - TD_TOTAL_HEIGHT, picasso96_state.Width, TD_TOTAL_HEIGHT);
-           else
-               DX_Invalidate (0, miny, picasso96_state.Width, picasso96_state.Height - miny);
-       }
-    }
-#endif
+
     if (lock)
        gfx_unlock_picasso ();
     if (dst && gwwcnt) {
index 1bb5beb734f70d43b2407dacd063f99588e33168..e24258a3bb3860da7e243d0e3c0d45fae3fc03c1 100644 (file)
 #define IDD_GAMEPORTS                   263
 #define IDS_STRING22                    263
 #define IDS_INPUTTOGGLE                 263
-#define IDS_STRING23                    264
 #define IDS_NETDISCONNECTED             264
 #define IDS_NUMSG_NEEDEXT2              300
 #define IDS_NUMSG_NOROMKEY              301
 #define IDC_SCREENMODE_RTG              1027
 #define IDC_MBMEM1                      1028
 #define IDC_PORT_TABLET_CURSOR          1028
+#define IDC_SHOWLEDS2                   1028
+#define IDC_SHOWLEDSRTG                 1028
 #define IDC_PORT0_JOYSMODE              1029
 #define IDC_SLOWMEM                     1030
 #define IDC_PORT1_JOYSMODE              1030
 #define IDC_ASSOCIATE_OFF               1790
 #define IDC_PORT_TABLET_FULL            1790
 #define IDC_CPU_MULTIPLIER              1790
+#define IDC_CPU_FREQUENCY2              1790
 #define IDC_DD_SURFACETYPE              1791
 #define IDC_RTG_SCALE_ALLOW             1791
 #define IDC_CPU_FREQUENCY               1791
 #define _APS_3D_CONTROLS                     1
 #define _APS_NEXT_RESOURCE_VALUE        352
 #define _APS_NEXT_COMMAND_VALUE         40045
-#define _APS_NEXT_CONTROL_VALUE         1792
+#define _APS_NEXT_CONTROL_VALUE         1793
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif
index 775fe286d0ae6e3bb5baba3276b8a6a11cc237f2..267c34b84228fd76dbc399faaf3d6011ba181791 100644 (file)
@@ -92,10 +92,10 @@ EXSTYLE WS_EX_CONTEXTHELP
 FONT 8, "MS Sans Serif", 0, 0, 0x1\r
 BEGIN\r
     GROUPBOX        "System ROM Settings",-1,5,0,290,93\r
-    RTEXT           "Main ROM file:",IDC_ROMTEXT,10,13,75,10\r
+    LTEXT           "Main ROM file:",IDC_ROMTEXT,14,13,263,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
+    LTEXT           "Extended ROM file:",IDC_ROMFILE2TEXT,14,43,263,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
@@ -103,10 +103,10 @@ BEGIN
     CONTROL         "ShapeShifter support [] Patches the system ROM for ShapeShifter compatibility.",IDC_KICKSHIFTER,\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
+    LTEXT           "Cartridge ROM file:",IDC_FLASHTEXT2,12,110,265,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
+    LTEXT           "Flash RAM file:",IDC_FLASHTEXT,12,142,265,10\r
     EDITTEXT        IDC_FLASHFILE,12,155,262,13,ES_AUTOHSCROLL\r
     PUSHBUTTON      "...",IDC_FLASHCHOOSER,280,154,10,15\r
 END\r
@@ -219,8 +219,7 @@ BEGIN
     CONTROL         "68881",IDC_FPU1,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,14,175,63,10\r
     CONTROL         "68882",IDC_FPU2,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,14,188,63,10\r
     CONTROL         "CPU internal",IDC_FPU3,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,14,202,63,10\r
-    COMBOBOX        IDC_CPU_FREQUENCY,212,119,73,75,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP\r
-    RTEXT           "CPU Frequency",IDC_STATIC,105,119,87,10,SS_CENTERIMAGE\r
+    RTEXT           "CPU Frequency",IDC_STATIC,105,119,51,10,SS_CENTERIMAGE\r
     GROUPBOX        "Cycle-exact CPU Emulation Speed",IDC_STATIC,90,99,205,46\r
     RTEXT           "CPU",IDC_STATIC,96,77,17,10,SS_CENTERIMAGE\r
     RTEXT           "Chipset",IDC_STATIC,182,77,26,9,SS_CENTERIMAGE\r
@@ -228,6 +227,8 @@ BEGIN
     RTEXT           "Cache size:",IDC_STATIC,95,167,42,10,SS_CENTERIMAGE\r
     CONTROL         "68040 MMU [] 68040 MMU emulation. Not compatible with JIT.",IDC_MMUENABLE,\r
                     "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,132,73,10\r
+    COMBOBOX        IDC_CPU_FREQUENCY,165,118,46,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
+    EDITTEXT        IDC_CPU_FREQUENCY2,218,117,70,15\r
 END\r
 \r
 IDD_FLOPPY DIALOGEX 0, 0, 300, 240\r
@@ -458,9 +459,9 @@ BEGIN
     GROUPBOX        "Miscellaneous Options",IDC_STATIC,8,2,290,136\r
     CONTROL         "Untrap = middle button",IDC_JULIAN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,19,110,10\r
     CONTROL         "Show GUI on startup",IDC_SHOWGUI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,31,109,10\r
-    CONTROL         "On-screen LEDs",IDC_SHOWLEDS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,44,109,10\r
-    CONTROL         "Don't show taskbar button",IDC_NOTASKBARBUTTON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,70,109,10\r
-    CONTROL         "Use CTRL-F11 to quit",IDC_CTRLF11,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,57,110,10\r
+    CONTROL         "Native On-screen LEDs",IDC_SHOWLEDS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,141,80,109,10\r
+    CONTROL         "Don't show taskbar button",IDC_NOTASKBARBUTTON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,56,109,10\r
+    CONTROL         "Use CTRL-F11 to quit",IDC_CTRLF11,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,43,110,10\r
     GROUPBOX        "Keyboard LEDs",IDC_STATIC,7,140,85,94\r
     COMBOBOX        IDC_KBLED1,22,154,56,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
     COMBOBOX        IDC_KBLED2,22,173,56,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
@@ -476,18 +477,19 @@ BEGIN
     COMBOBOX        IDC_STATE_RATE,248,197,38,65,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP\r
     RTEXT           "Recording buffer (MB):",IDC_STATIC,160,219,83,10,SS_CENTERIMAGE | WS_TABSTOP\r
     COMBOBOX        IDC_STATE_BUFFERSIZE,248,217,38,65,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP\r
-    CONTROL         "Always on top",IDC_ALWAYSONTOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,83,110,10\r
+    CONTROL         "Always on top",IDC_ALWAYSONTOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,69,110,10\r
     CONTROL         "USB mode",IDC_KBLED_USB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,216,64,10\r
     COMBOBOX        IDC_SCSIMODE,213,30,80,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
     COMBOBOX        IDC_LANGUAGE,153,117,122,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
     GROUPBOX        "Language",IDC_STATIC,138,107,154,27\r
-    CONTROL         "Disable screensaver",IDC_POWERSAVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,96,109,10\r
+    CONTROL         "Disable screensaver",IDC_POWERSAVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,82,109,10\r
     COMBOBOX        IDC_DD_SURFACETYPE,213,63,79,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
     RTEXT           "DirectDraw display buffer:",IDC_STATIC,195,50,92,10,SS_CENTERIMAGE\r
     RTEXT           "SCSI and CD/DVD access method:",IDC_STATIC,151,12,126,10,SS_CENTERIMAGE\r
-    CONTROL         "Synchronize clock",IDC_CLOCKSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,109,111,10\r
+    CONTROL         "Synchronize clock",IDC_CLOCKSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,95,111,10\r
     CONTROL         "Faster RTG [] Enables less accurate custom chipset emulation mode when Picasso96 is enabled.",IDC_FASTERRTG,\r
-                    "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,19,122,100,10\r
+                    "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,19,108,100,10\r
+    CONTROL         "RTG On-screen LEDs",IDC_SHOWLEDSRTG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,141,93,109,10\r
 END\r
 \r
 IDD_HARDFILE DIALOGEX 0, 0, 299, 249\r
index f2cd03ce91dcffd7b513a7f56326cdc19fe0e82d..5cc68856e79e85e9b679c75cdbf1177f163be4f4 100644 (file)
@@ -17,8 +17,8 @@
 
 #define WINUAEPUBLICBETA 1
 
-#define WINUAEBETA L"16"
-#define WINUAEDATE MAKEBD(2009, 9, 27)
+#define WINUAEBETA L"17"
+#define WINUAEDATE MAKEBD(2009, 10, 7)
 #define WINUAEEXTRA L""
 #define WINUAEREV L""
 
index cc2757828a4137b547be69cb7d836c86b8d73ebd..a453eee70510633e0cf9581fb737266517e135f8 100644 (file)
@@ -937,48 +937,6 @@ static void DX_Blit96 (int x, int y, int w, int h)
     }
 }
 
-#include "statusline.h"
-extern uae_u32 p96rc[256], p96gc[256], p96bc[256];
-static void RTGleds (void)
-{
-    DDSURFACEDESC2 desc;
-    RECT sr, dr;
-    int dst_width = currentmode->native_width;
-    int dst_height = currentmode->native_height;
-    int width;
-
-    if (!(currprefs.leds_on_screen & STATUSLINE_RTG))
-       return;
-
-    width = dxdata.statuswidth;
-    if (dst_width < width)
-       width = dst_width;
-    SetRect (&sr, 0, 0, width, dxdata.statusheight);
-    SetRect (&dr, dst_width - width, dst_height - dxdata.statusheight, dst_width, dst_height);
-
-    picasso_putcursor (dr.left, dr.top,
-       dr.right - dr.left, dr.bottom - dr.top);
-    DX_Blit96 (dr.left, dr.top,
-       dr.right - dr.left, dr.bottom - dr.top);
-
-    DirectDraw_BlitRect (dxdata.statussurface, &sr, dxdata.secondary, &dr);
-    if (locksurface (dxdata.statussurface, &desc)) {
-        int sy, yy;
-        yy = 0;
-        for (sy = dst_height - dxdata.statusheight; sy < dst_height; sy++) {
-           uae_u8 *buf = (uae_u8*)desc.lpSurface + yy * desc.lPitch;
-           draw_status_line_single (buf, currentmode->current_depth / 8, yy, dst_width, p96rc, p96gc, p96bc, NULL);
-           yy++;
-       }
-       unlocksurface (dxdata.statussurface);
-    }
-    DirectDraw_BlitRect (dxdata.secondary, &dr, dxdata.statussurface, &sr);
-    
-    picasso_clearcursor ();
-    
-    DirectDraw_BlitToPrimary (&dr);
-}
-
 void gfx_unlock_picasso (void)
 {
     DirectDraw_SurfaceUnlock ();
@@ -997,8 +955,6 @@ void gfx_unlock_picasso (void)
        picasso_clearcursor ();
        p96_double_buffer_needs_flushing = 0;
     }
-    if (currprefs.leds_on_screen & STATUSLINE_RTG)
-       RTGleds ();
 }
 
 static void close_hwnds (void)
@@ -2053,9 +2009,11 @@ static int createnotification (HWND hwnd)
 
 static int getbestmode (int nextbest)
 {
-    int i, disp;
+    int i, startidx, disp;
     struct MultiDisplay *md = getdisplay (&currprefs);
+    int ratio;
 
+    ratio = currentmode->native_width > currentmode->native_height ? 1 : 0;
     disp = currprefs.gfx_display;
     for (i = 0; md->DisplayModes[i].depth >= 0; i++) {
         struct PicassoResolution *pr = &md->DisplayModes[i];
@@ -2070,8 +2028,26 @@ static int getbestmode (int nextbest)
     } else {
        i = 0;
     }
+    // first iterate only modes that have similar aspect ratio
+    startidx = i;
+    for (; md->DisplayModes[i].depth >= 0; i++) {
+       struct PicassoResolution *pr = &md->DisplayModes[i];
+       int r = pr->res.width > pr->res.height ? 1 : 0;
+       if (pr->res.width >= currentmode->native_width && pr->res.height >= currentmode->native_height && r == ratio) {
+           write_log (L"FS: %dx%d -> %dx%d (%d)\n", currentmode->native_width, currentmode->native_height,
+               pr->res.width, pr->res.height, ratio);
+           currentmode->native_width = pr->res.width;
+           currentmode->native_height = pr->res.height;
+           currentmode->current_width = currentmode->native_width;
+           currentmode->current_height = currentmode->native_height;
+           return 1;
+       }
+    }
+    // still not match? check all modes
+    i = startidx;
     for (; md->DisplayModes[i].depth >= 0; i++) {
        struct PicassoResolution *pr = &md->DisplayModes[i];
+       int r = pr->res.width > pr->res.height ? 1 : 0;
        if (pr->res.width >= currentmode->native_width && pr->res.height >= currentmode->native_height) {
            write_log (L"FS: %dx%d -> %dx%d\n", currentmode->native_width, currentmode->native_height,
                pr->res.width, pr->res.height);
index 71e98f4a03f6586af5de9a7c9dae7aaf04a44afb..d0f186a0476763a27764b883af6497364c78d35c 100644 (file)
@@ -5726,8 +5726,6 @@ static void values_to_memorydlg (HWND hDlg)
     CheckDlgButton (hDlg, IDC_RTG_SCALE_ALLOW, workprefs.win32_rtgallowscaling);
     CheckDlgButton (hDlg, IDC_RTG_MATCH_DEPTH, workprefs.win32_rtgmatchdepth);
 
-    //CheckDlgButton (hDlg, IDC_RTG_LEDS, (workprefs.leds_on_screen & STATUSLINE_RTG) ? 1 : 0);
-
     SendDlgItemMessage (hDlg, IDC_RTG_SCALE_ASPECTRATIO, CB_SETCURSEL,
        (workprefs.win32_rtgscaleaspectratio == 0) ? 0 :
        (workprefs.win32_rtgscaleaspectratio == 4 * 256 + 3) ? 2 :
@@ -5957,12 +5955,6 @@ static INT_PTR CALLBACK ExpansionDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LP
                case IDC_RTG_SCALE_ALLOW:
                workprefs.win32_rtgallowscaling = IsDlgButtonChecked (hDlg, IDC_RTG_SCALE_ALLOW);
                break;
-//             case IDC_RTG_LEDS:
-//             workprefs.leds_on_screen &= ~STATUSLINE_RTG;
-//             if (IsDlgButtonChecked (hDlg, IDC_RTG_LEDS))
-//                 workprefs.leds_on_screen |= STATUSLINE_RTG;
-//             break;
-
                case IDC_SOCKETS:
                workprefs.socket_emu = IsDlgButtonChecked (hDlg, IDC_SOCKETS);
                break;
@@ -6543,6 +6535,7 @@ static void values_to_miscdlg (HWND hDlg)
        CheckDlgButton (hDlg, IDC_CREATELOGFILE, workprefs.win32_logfile);
        CheckDlgButton (hDlg, IDC_CTRLF11, workprefs.win32_ctrl_F11_is_quit);
        CheckDlgButton (hDlg, IDC_SHOWLEDS, (workprefs.leds_on_screen & STATUSLINE_CHIPSET) ? 1 : 0);
+       CheckDlgButton (hDlg, IDC_SHOWLEDSRTG, (workprefs.leds_on_screen & STATUSLINE_RTG) ? 1 : 0);
        CheckDlgButton (hDlg, IDC_NOTASKBARBUTTON, workprefs.win32_notaskbarbutton);
        CheckDlgButton (hDlg, IDC_ALWAYSONTOP, workprefs.win32_alwaysontop);
        CheckDlgButton (hDlg, IDC_CLOCKSYNC, workprefs.tod_hack);
@@ -6733,6 +6726,11 @@ static INT_PTR MiscDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
            if (IsDlgButtonChecked(hDlg, IDC_SHOWLEDS))
                workprefs.leds_on_screen |= STATUSLINE_CHIPSET;
            break;
+       case IDC_SHOWLEDSRTG:
+           workprefs.leds_on_screen &= ~STATUSLINE_RTG;
+           if (IsDlgButtonChecked(hDlg, IDC_SHOWLEDSRTG))
+               workprefs.leds_on_screen |= STATUSLINE_RTG;
+           break;
        case IDC_SHOWGUI:
            workprefs.start_gui = IsDlgButtonChecked (hDlg, IDC_SHOWGUI);
            break;
@@ -6860,6 +6858,7 @@ static void enable_for_cpudlg (HWND hDlg)
     ew (hDlg, IDC_CPU_MULTIPLIER, workprefs.cpu_cycle_exact);
 #endif
     ew (hDlg, IDC_CPU_FREQUENCY, workprefs.cpu_cycle_exact);
+    ew (hDlg, IDC_CPU_FREQUENCY2, workprefs.cpu_cycle_exact && !workprefs.cpu_clock_multiplier);
 
     fpu = TRUE;
     if (workprefs.cpu_model > 68030 || workprefs.cpu_compatible || workprefs.cpu_cycle_exact)
@@ -6870,6 +6869,14 @@ static void enable_for_cpudlg (HWND hDlg)
     ew (hDlg, IDC_MMUENABLE, workprefs.cpu_model == 68040 && workprefs.cachesize == 0);
 }
 
+static int getcpufreq (int m)
+{
+    int f;
+    
+    f = workprefs.ntscmode ? 28636360.0 : 28375160.0;
+    return f * (m >> 8) / 8;
+}
+
 static void values_to_cpudlg (HWND hDlg)
 {
     TCHAR cache[8] = L"";
@@ -6907,6 +6914,12 @@ static void values_to_cpudlg (HWND hDlg)
     CheckDlgButton (hDlg, IDC_JITENABLE, workprefs.cachesize > 0);
     CheckDlgButton (hDlg, IDC_MMUENABLE, workprefs.cpu_model == 68040 && workprefs.cachesize == 0 && workprefs.mmu_model == 68040);
 
+    if (workprefs.cpu_clock_multiplier) {
+       TCHAR txt[20];
+       double f = getcpufreq (workprefs.cpu_clock_multiplier);
+       _stprintf (txt, L"%.6f", f / 1000000.0);
+       SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY2, WM_SETTEXT, 0, (LPARAM)txt);
+    }
 }
 
 static void values_from_cpudlg (HWND hDlg)
@@ -7010,9 +7023,9 @@ static void values_from_cpudlg (HWND hDlg)
     if (pages[MEMORY_ID])
        SendMessage (pages[MEMORY_ID], WM_USER, 0, 0);
 
-   
     idx = SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY, CB_GETCURSEL, 0, 0);
-    if (idx >= 0) {
+    if (idx != CB_ERR) {
+       int m = workprefs.cpu_clock_multiplier;
        workprefs.cpu_frequency = 0;
        workprefs.cpu_clock_multiplier = 0;
        if (idx == 0)
@@ -7021,18 +7034,17 @@ static void values_from_cpudlg (HWND hDlg)
            workprefs.cpu_clock_multiplier = 4 << 8;
        if (idx == 2)
            workprefs.cpu_clock_multiplier = 8 << 8;
-    } else {
-       TCHAR txt[20];
-       SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY, WM_GETTEXT, (WPARAM)sizeof (txt) / sizeof (TCHAR), (LPARAM)txt);
-       workprefs.cpu_clock_multiplier = 0;
-       workprefs.cpu_frequency = _tstof (txt) * 1000000.0;
-       if (workprefs.cpu_frequency < 1 * 1000000)
-           workprefs.cpu_frequency = 1 * 1000000;
-       if (workprefs.cpu_frequency >= 99 * 1000000)
-           workprefs.cpu_frequency = 99 * 1000000;
+       if (idx == 3) {
+           TCHAR txt[20];
+           SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY2, WM_GETTEXT, (WPARAM)sizeof (txt) / sizeof (TCHAR), (LPARAM)txt);
+           workprefs.cpu_clock_multiplier = 0;
+           workprefs.cpu_frequency = _tstof (txt) * 1000000.0;
+           if (workprefs.cpu_frequency < 1 * 1000000)
+               workprefs.cpu_frequency = 1 * 1000000;
+           if (workprefs.cpu_frequency >= 99 * 1000000)
+               workprefs.cpu_frequency = 99 * 1000000;
+       }
     }
-
-
 }
 
 static INT_PTR CALLBACK CPUDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -7042,6 +7054,7 @@ static INT_PTR CALLBACK CPUDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
 
     switch (msg) {
     case WM_INITDIALOG:
+       recursive++;
        pages[CPU_ID] = hDlg;
        currentpage = CPU_ID;
        SendDlgItemMessage (hDlg, IDC_SPEED, TBM_SETRANGE, TRUE, MAKELONG (MIN_M68K_PRIORITY, MAX_M68K_PRIORITY));
@@ -7059,26 +7072,25 @@ static INT_PTR CALLBACK CPUDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
        SendDlgItemMessage (hDlg, IDC_CPU_MULTIPLIER, CB_ADDSTRING, 0, (LPARAM)L"8 (28.4MHz)");
 #endif
        SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY, CB_RESETCONTENT, 0, 0);
-       SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY, CB_ADDSTRING, 0, (LPARAM)L"7MHz");
-       SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY, CB_ADDSTRING, 0, (LPARAM)L"14MHz");
-       SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY, CB_ADDSTRING, 0, (LPARAM)L"28MHz");
+       SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY, CB_ADDSTRING, 0, (LPARAM)L"A500");
+       SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY, CB_ADDSTRING, 0, (LPARAM)L"A1200");
+       SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY, CB_ADDSTRING, 0, (LPARAM)L"2x");
+       SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY, CB_ADDSTRING, 0, (LPARAM)L"Custom");
 
-       idx = -1;
-       if (workprefs.cpu_frequency) {
-           TCHAR txt[20];
-           _stprintf (txt, L"%.3f", workprefs.cpu_frequency / 1000000.0);
-           SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY, WM_SETTEXT, 0, (LPARAM)txt);
-       } else if (workprefs.cpu_clock_multiplier == 2 << 8) {
+       idx = 3;
+       if (workprefs.cpu_clock_multiplier == 2 << 8)
            idx = 0;
-       } else if (workprefs.cpu_clock_multiplier == 4 << 8) {
+       if (workprefs.cpu_clock_multiplier == 4 << 8)
            idx = 1;
-       } else if (workprefs.cpu_clock_multiplier == 8 << 8) {
+       if (workprefs.cpu_clock_multiplier == 8 << 8)
            idx = 2;
+       SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY, CB_SETCURSEL, idx, 0);
+       if (!workprefs.cpu_clock_multiplier) {
+           TCHAR txt[20];
+           _stprintf (txt, L"%.6f", workprefs.cpu_frequency / 1000000.0);
+           SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY2, WM_SETTEXT, 0, (LPARAM)txt);
        }
-       if (idx >= 0)
-           SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY, CB_SETCURSEL, idx, 0);
-       
-
+       recursive--;
 
     case WM_USER:
        recursive++;
@@ -7088,7 +7100,7 @@ static INT_PTR CALLBACK CPUDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
        return TRUE;
 
     case WM_COMMAND:
-       if (recursive > 0)
+        if (recursive > 0)
            break;
        recursive++;
        values_from_cpudlg (hDlg);
@@ -12380,6 +12392,23 @@ static void dialogmousemove (HWND hDlg)
     }
 }
 
+#if 0
+static void blah(void)
+{
+    char *str1 = "äöå\80õãñëÿüïñç";
+    TCHAR *str2 = L"äöå\80õãñëÿüïñç";
+    TCHAR *s1;
+    char *s2;
+    MessageBoxA(NULL, str1, "Test1 ANSI", MB_OK);
+    s1 = au (str1);
+    MessageBoxW(NULL, s1, L"Test1 UNICODE", MB_OK);
+
+    MessageBoxW(NULL, str2, L"Test2 UNICODE", MB_OK);
+    s2 = ua (str2);
+    MessageBoxA(NULL, s2, "Test2 ANSI", MB_OK);
+}
+#endif
+
 static int GetSettings (int all_options, HWND hwnd)
 {
     static int init_called = 0;
@@ -12447,6 +12476,7 @@ static int GetSettings (int all_options, HWND hwnd)
     DragAcceptFiles (hwnd, TRUE);
     if (first)
        write_log (L"Entering GUI idle loop\n");
+    //blah();
 
     scaleresource_setmaxsize (800, 600);
     tres = scaleresource (panelresource, hwnd);
index 7dcc2959fccc8a873ee9dc2c7ac8da87d271031f..f259a75558d6a01a97d0ecbc359e64aacdc40f81 100644 (file)
                                        >
                                </File>
                                <File
-                                       RelativePath="..\resources\configfile.ico"
+                                       RelativePath=".\configfile.ico"
                                        >
                                </File>
                                <File
-                                       RelativePath=".\configfile.ico"
+                                       RelativePath="..\resources\configfile.ico"
                                        >
                                </File>
                                <File
                                        >
                                </File>
                                <File
-                                       RelativePath="..\resources\file.ico"
+                                       RelativePath=".\file.ico"
                                        >
                                </File>
                                <File
-                                       RelativePath=".\file.ico"
+                                       RelativePath="..\resources\file.ico"
                                        >
                                </File>
                                <File
                                        >
                                </File>
                                <File
-                                       RelativePath=".\port.ico"
+                                       RelativePath="..\resources\port.ico"
                                        >
                                </File>
                                <File
-                                       RelativePath="..\resources\port.ico"
+                                       RelativePath=".\port.ico"
                                        >
                                </File>
                                <File
                                RelativePath="..\..\diskutil.c"
                                >
                        </File>
+                       <File
+                               RelativePath="..\..\dongle.c"
+                               >
+                       </File>
                        <File
                                RelativePath="..\..\drawing.c"
                                >
index 0d52eff849ae60739e4ebf5a0ab84cc005b9e02b..3a2f9385e1f925b6a712ff18d3d78fcb8218915d 100644 (file)
@@ -1,4 +1,23 @@
 
+Beta 17:
+
+- fixed uaescsi.device TD_GETGEOMETRY total number of blocks off by one
+  error, return TDERR_DiskChanged if no media inserted
+- ACTION_FH_FROM_LOCK didn't reset write notification flag, caused
+  ghost file notifications + parent directory date changes when file
+  was closed if same file/dir was ACTION_ADD_NOTIFY'd earlier
+- VHPOSW/VPOSW emulation rewritten (mainly used for "fake" 60Hz but
+  also can be used for other purposes)
+- less confusing GUI CPU frequency configuration
+- when selecting best fit fullscreen mode, ignore modes that have
+  completely wrong aspect ratio (for example rotated screen)
+- right border 2 lores pixel delay properly handled in copper emulation
+- RTG onscreen leds (no transparency, does not ignore scaling)
+- new pointless feature: following games' protection dongles emulated:
+  Leaderboard, Robocop 3, B.A.T. II, Italy'90 Soccer, Dames Grand Maitre,
+  Rugby Coach, Cricket Captain
+  No GUI support, add "dongle=x" where x is name of the game
+
 Beta 16:
 
 - Faster RTG moved to misc panel
@@ -9,6 +28,7 @@ Beta 16:
   100% why but I guess extra 0.5 cycle in PAL 227.5 color clock
   horizontal timing causes this) Fixes Leander "border", can fix other
   similar border problems. Previous fix in b15 was wrong.
+- disable new expansion checkboxes when emulation is running
 - CE linemode blitter non-nasty broke in b14
 
 Beta 15:
index a604954b91b512fb9da34d50369ad516474d3fab..8047c67a2a5e3c6e5c3f03a4eda221d24185d93b 100644 (file)
@@ -449,7 +449,6 @@ static int dev_do_io (struct devstruct *dev, uaecptr request)
     uae_u64 io_offset64;
     int async = 0;
     int bmask = dev->di.bytespersector - 1;
-    struct device_info di;
     struct priv_devstruct *pdev = getpdevstruct (request);
 
     if (!pdev)
@@ -460,6 +459,8 @@ static int dev_do_io (struct devstruct *dev, uaecptr request)
     {
        case CMD_READ:
        //write_log (L"CMD_READ %08x %d %d %08x\n", io_data, io_offset, io_length, bmask);
+       if (!dev->di.media_inserted)
+           goto no_media;
        if (dev->drivetype == INQ_ROMD) {
            io_error = command_cd_read (pdev->mode, dev, io_data, io_offset, io_length, &io_actual);
        } else {
@@ -472,6 +473,8 @@ static int dev_do_io (struct devstruct *dev, uaecptr request)
        break;
        case TD_READ64:
        case NSCMD_TD_READ64:
+       if (!dev->di.media_inserted)
+           goto no_media;
        io_offset64 = get_long (request + 44) | ((uae_u64)get_long (request + 32) << 32);
        if ((io_offset64 & bmask) || bmask == 0 || io_data == 0)
            goto bad_command;
@@ -484,6 +487,8 @@ static int dev_do_io (struct devstruct *dev, uaecptr request)
        break;
 
        case CMD_WRITE:
+       if (!dev->di.media_inserted)
+           goto no_media;
        if (dev->di.write_protected || dev->drivetype == INQ_ROMD) {
            io_error = 28; /* writeprotect */
        } else if ((io_offset & bmask) || bmask == 0 || io_data == 0) {
@@ -496,6 +501,8 @@ static int dev_do_io (struct devstruct *dev, uaecptr request)
        break;
        case TD_WRITE64:
        case NSCMD_TD_WRITE64:
+       if (!dev->di.media_inserted)
+           goto no_media;
        io_offset64 = get_long (request + 44) | ((uae_u64)get_long (request + 32) << 32);
        if (dev->di.write_protected || dev->drivetype == INQ_ROMD) {
            io_error = 28; /* writeprotect */
@@ -509,6 +516,8 @@ static int dev_do_io (struct devstruct *dev, uaecptr request)
        break;
 
        case CMD_FORMAT:
+       if (!dev->di.media_inserted)
+           goto no_media;
        if (dev->di.write_protected || dev->drivetype == INQ_ROMD) {
            io_error = 28; /* writeprotect */
        } else if ((io_offset & bmask) || bmask == 0 || io_data == 0) {
@@ -521,6 +530,8 @@ static int dev_do_io (struct devstruct *dev, uaecptr request)
        break;
        case TD_FORMAT64:
        case NSCMD_TD_FORMAT64:
+       if (!dev->di.media_inserted)
+           goto no_media;
        io_offset64 = get_long (request + 44) | ((uae_u64)get_long (request + 32) << 32);
        if (dev->di.write_protected || dev->drivetype == INQ_ROMD) {
            io_error = 28; /* writeprotect */
@@ -541,28 +552,32 @@ static int dev_do_io (struct devstruct *dev, uaecptr request)
        io_actual = 0;
        break;
        case CMD_REMOVE:
+       io_actual = dev->changeint;
        dev->changeint = io_data;
-       io_actual = 0;
        break;
        case CMD_CHANGENUM:
        io_actual = dev->changenum;
        break;
        case CMD_CHANGESTATE:
-       io_actual = devinfo(pdev->mode, dev->unitnum, &di)->media_inserted ? 0 : 1;
+       io_actual = devinfo (pdev->mode, dev->unitnum, &dev->di)->media_inserted ? 0 : 1;
        break;
        case CMD_PROTSTATUS:
-       io_actual = devinfo(pdev->mode, dev->unitnum, &di)->write_protected ? -1 : 0;
+       io_actual = devinfo (pdev->mode, dev->unitnum, &dev->di)->write_protected ? -1 : 0;
        break;
        case CMD_GETDRIVETYPE:
        io_actual = dev->drivetype;
        break;
        case CMD_GETNUMTRACKS:
+       if (!dev->di.media_inserted)
+           goto no_media;
        io_actual = dev->di.cylinders;
        break;
        case CMD_GETGEOMETRY:
        {
-           struct device_info di2, *di;
-           di = devinfo (pdev->mode, dev->unitnum, &di2);
+           struct device_info *di;
+           di = devinfo (pdev->mode, dev->unitnum, &dev->di);
+           if (!di->media_inserted)
+               goto no_media;
            put_long (io_data + 0, di->bytespersector);
            put_long (io_data + 4, di->sectorspertrack * di->trackspercylinder * di->cylinders);
            put_long (io_data + 8, di->cylinders);
@@ -572,6 +587,7 @@ static int dev_do_io (struct devstruct *dev, uaecptr request)
            put_long (io_data + 24, 0); /* bufmemtype */
            put_byte (io_data + 28, di->type);
            put_byte (io_data + 29, di->removable ? 1 : 0); /* flags */
+           io_actual = 30;
        }
        break;
        case CMD_ADDCHANGEINT:
@@ -609,6 +625,9 @@ static int dev_do_io (struct devstruct *dev, uaecptr request)
        bad_command:
        io_error = IOERR_BADADDRESS;
        break;
+       no_media:
+       io_error = TDERR_DiskChanged;
+       break;
     }
     put_long (request + 32, io_actual);
     put_byte (request + 31, io_error);