extrasamples = 10;
if (extrasamples < -10)
extrasamples = -10;
+
#endif
}
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);
}
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",
}
}
}
+ 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])
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)
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);
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);
#include "uae.h"
#include "amax.h"
#include "ersatz.h"
+#include "dongle.h"
//#define CIAA_DEBUG_R
//#define CIAA_DEBUG_W
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 ();
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));
#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));
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
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));
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)
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 ())
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);
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);
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));
}
}
-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)
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)
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;
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;
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;
hsyncdelay ();
return vp;
}
+
static void VPOSW (uae_u16 v)
{
#if 0
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)
/* 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);
}
}
}
#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)
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);
// 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);
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);
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);
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);
/* 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);
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;
/* 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 ();
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;
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);
do_cycles (1 * CYCLE_UNIT);
cycles -= CYCLE_UNIT;
}
+ extra = cycles;
}
int is_cycle_ce (void)
--- /dev/null
+
+ /*
+ * 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
#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;
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);
}
if (enforcermode & 1)
set_special (SPCFLAG_TRAP);
}
+ if (ISEXEC (addr) || ISEXEC (addr + 1))
+ return;
do_put_mem_word (m, w);
}
if (enforcermode & 1)
set_special (SPCFLAG_TRAP);
}
+ if (ISEXEC (addr))
+ return;
chipmemory[addr] = b;
}
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;
--- /dev/null
+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
#define IOERR_UNITBUSY -6
#define IOERR_SELFTEST -7
+#define TDERR_DiskChanged 29
+
#define CMD_INVALID 0
#define CMD_RESET 1
#define CMD_READ 2
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 */
#include "cia.h"
#include "autoconf.h"
#include "rp.h"
+#include "dongle.h"
extern int bootrom_header, bootrom_items;
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];
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 ())
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)
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);
}
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]++;
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 */
}
/* 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);
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) {
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));
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;
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;
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;
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);
*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)
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);
}
#include "blkdev.h"
#include "gfxfilter.h"
#include "uaeresource.h"
+#include "dongle.h"
#ifdef USE_SDL
#include "SDL.h"
initparallel ();
#endif
native2amiga_reset ();
+ dongle_reset ();
}
/* Okay, this stuff looks strange, but it is here to encourage people who
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;
}
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;
}
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;
if (picasso96_state.RGBFormat == host_mode) {
memcpy (dst2 + x * dstpix, src2 + x * srcpix, width * dstpix);
- return;
+ return;
}
endx4 = endx & ~3;
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++) {
}
}
-#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;
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) {
;
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) {
#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
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
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
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
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
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
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
#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""
}
}
-#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 ();
picasso_clearcursor ();
p96_double_buffer_needs_flushing = 0;
}
- if (currprefs.leds_on_screen & STATUSLINE_RTG)
- RTGleds ();
}
static void close_hwnds (void)
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];
} 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);
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 :
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;
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);
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;
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)
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"";
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)
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)
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)
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));
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++;
return TRUE;
case WM_COMMAND:
- if (recursive > 0)
+ if (recursive > 0)
break;
recursive++;
values_from_cpudlg (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;
DragAcceptFiles (hwnd, TRUE);
if (first)
write_log (L"Entering GUI idle loop\n");
+ //blah();
scaleresource_setmaxsize (800, 600);
tres = scaleresource (panelresource, hwnd);
>
</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"
>
+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
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:
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)
{
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 {
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;
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) {
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 */
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) {
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 */
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);
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:
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);