From f37f0175dac4d604e32ec102d8f505ba6576f296 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Mon, 5 Nov 2012 21:09:07 +0200 Subject: [PATCH] 2500b24 --- blitter.cpp | 2 + cpummu.cpp | 4 +- filesys.cpp | 25 ++++-- gencpu.cpp | 21 +++-- include/inputdevice.h | 4 +- inputdevice.cpp | 70 +++++++++++----- isofs.cpp | 2 +- memory.cpp | 2 +- od-win32/dinput.cpp | 81 +++++++++++-------- od-win32/picasso96_win.cpp | 10 ++- od-win32/picasso96_win.h | 3 +- od-win32/win32.cpp | 11 ++- od-win32/win32.h | 5 +- od-win32/win32gfx.cpp | 5 +- od-win32/win32gui.cpp | 149 +++++++++++++++++++++++++++-------- od-win32/winuaechangelog.txt | 11 +++ 16 files changed, 294 insertions(+), 111 deletions(-) diff --git a/blitter.cpp b/blitter.cpp index d153ed17..20c7dbfe 100644 --- a/blitter.cpp +++ b/blitter.cpp @@ -1459,6 +1459,8 @@ void do_blitter (int hpos, int copper) do_blitter2 (hpos, copper); return; } + if (!dmaen (DMA_BLITTER) || !blt_info.got_cycle) + return; // previous blit may have last write cycle left // and we must let it finish blit_startcycles = BLITTER_STARTUP_CYCLES; diff --git a/cpummu.cpp b/cpummu.cpp index e7d9d924..c5db0606 100644 --- a/cpummu.cpp +++ b/cpummu.cpp @@ -1018,8 +1018,8 @@ void REGPARAM2 mmu_reset(void) mmu_flush_atc_all(true); #if 0 regs.urp = regs.srp = 0; - regs.itt0 = regs.itt0 = 0; - regs.dtt0 = regs.dtt0 = 0; + regs.itt0 = regs.itt1 = 0; + regs.dtt0 = regs.dtt1 = 0; regs.mmusr = 0; #endif } diff --git a/filesys.cpp b/filesys.cpp index a56bce7e..84823895 100644 --- a/filesys.cpp +++ b/filesys.cpp @@ -2657,7 +2657,7 @@ static void int ret, err = ERROR_NO_FREE_STORE; int blocksize, nr; uae_u32 dostype; - bool fs = false; + bool fs = false, media = false; blocksize = 512; /* not FFS because it is not understood by WB1.x C:Info */ @@ -2666,17 +2666,17 @@ static void if (unit->volflags & MYVOLUMEINFO_ARCHIVE) { ret = zfile_fs_usage_archive (unit->ui.rootdir, 0, &fsu); fs = true; + media = filesys_isvolume (unit); } else if (unit->volflags & MYVOLUMEINFO_CDFS) { struct isofs_info ii; ret = isofs_mediainfo (unit->ui.cdfs_superblock, &ii) ? 0 : 1; if (!ret) { + media = ii.media; + nr = unit->unit - cd_unit_offset; + blocksize = ii.blocksize; if (ii.media) { fsu.fsu_blocks = ii.blocks; fsu.fsu_bavail = 0; - blocksize = ii.blocksize; - nr = unit->unit - cd_unit_offset; - } else { - ret = ERROR_NO_DISK; } } } else { @@ -2684,6 +2684,7 @@ static void if (ret) err = dos_errno (); fs = true; + media = filesys_isvolume (unit); } if (ret != 0) { PUT_PCK_RES1 (packet, DOS_FALSE); @@ -2695,12 +2696,22 @@ static void put_long (info + 8, unit->ui.readonly || unit->ui.locked ? 80 : 82); /* state */ put_long (info + 20, blocksize); /* bytesperblock */ put_long (info + 32, 0); /* inuse */ - if (disk_info && unit->ui.unknown_media) { + if (unit->ui.unknown_media) { + if (!disk_info) { + PUT_PCK_RES1 (packet, DOS_FALSE); + PUT_PCK_RES2 (packet, ERROR_NOT_A_DOS_DISK); + return; + } put_long (info + 12, 0); put_long (info + 16, 0); put_long (info + 24, ('B' << 24) | ('A' << 16) | ('D' << 8) | (0 << 0)); /* ID_UNREADABLE_DISK */ put_long (info + 28, 0); - } else if (disk_info && !filesys_isvolume (unit)) { + } else if (!media) { + if (!disk_info) { + PUT_PCK_RES1 (packet, DOS_FALSE); + PUT_PCK_RES2 (packet, ERROR_NO_DISK); + return; + } put_long (info + 12, 0); put_long (info + 16, 0); put_long (info + 24, -1); /* ID_NO_DISK_PRESENT */ diff --git a/gencpu.cpp b/gencpu.cpp index 31fc9373..0e0af874 100644 --- a/gencpu.cpp +++ b/gencpu.cpp @@ -3161,6 +3161,7 @@ static void gen_opcode (unsigned long int opcode) printf ("\tint ru = (src >> 6) & 7;\n"); printf ("\tint rc = src & 7;\n"); genflags (flag_cmp, curi->size, "newv", "m68k_dreg (regs, rc)", "dst"); + sync_m68k_pc (); printf ("\tif (GET_ZFLG ())"); old_brace_level = n_braces; start_brace (); @@ -3168,7 +3169,17 @@ static void gen_opcode (unsigned long int opcode) pop_braces (old_brace_level); printf ("else"); start_brace (); - printf ("m68k_dreg (regs, rc) = dst;\n"); + switch (curi->size) { + case sz_byte: + printf ("\tm68k_dreg(regs, rc) = (m68k_dreg(regs, rc) & ~0xff) | (dst & 0xff);\n"); + break; + case sz_word: + printf ("\tm68k_dreg(regs, rc) = (m68k_dreg(regs, rc) & ~0xffff) | (dst & 0xffff);\n"); + break; + default: + printf ("\tm68k_dreg(regs, rc) = dst;\n"); + break; + } pop_braces (old_brace_level); } break; @@ -3184,12 +3195,12 @@ static void gen_opcode (unsigned long int opcode) genflags (flag_cmp, curi->size, "newv", "m68k_dreg (regs, extra & 7)", "dst2"); printf ("\tif (GET_ZFLG ()) {\n"); printf ("\t%s (rn1, m68k_dreg (regs, (extra >> 22) & 7));\n", dstw); - printf ("\t%s (rn1, m68k_dreg (regs, (extra >> 6) & 7));\n", dstw); + printf ("\t%s (rn2, m68k_dreg (regs, (extra >> 6) & 7));\n", dstw); printf ("\t}}\n"); pop_braces (old_brace_level); printf ("\tif (! GET_ZFLG ()) {\n"); - printf ("\tm68k_dreg (regs, (extra >> 22) & 7) = (m68k_dreg (regs, (extra >> 22) & 7) & ~0xffff) | (dst1 & 0xffff);\n"); printf ("\tm68k_dreg (regs, (extra >> 6) & 7) = (m68k_dreg (regs, (extra >> 6) & 7) & ~0xffff) | (dst2 & 0xffff);\n"); + printf ("\tm68k_dreg (regs, (extra >> 22) & 7) = (m68k_dreg (regs, (extra >> 22) & 7) & ~0xffff) | (dst1 & 0xffff);\n"); printf ("\t}\n"); } else { int old_brace_level = n_braces; @@ -3199,12 +3210,12 @@ static void gen_opcode (unsigned long int opcode) genflags (flag_cmp, curi->size, "newv", "m68k_dreg (regs, extra & 7)", "dst2"); printf ("\tif (GET_ZFLG ()) {\n"); printf ("\t%s (rn1, m68k_dreg (regs, (extra >> 22) & 7));\n", dstl); - printf ("\t%s (rn1, m68k_dreg (regs, (extra >> 6) & 7));\n", dstl); + printf ("\t%s (rn2, m68k_dreg (regs, (extra >> 6) & 7));\n", dstl); printf ("\t}}\n"); pop_braces (old_brace_level); printf ("\tif (! GET_ZFLG ()) {\n"); - printf ("\tm68k_dreg (regs, (extra >> 22) & 7) = dst1;\n"); printf ("\tm68k_dreg (regs, (extra >> 6) & 7) = dst2;\n"); + printf ("\tm68k_dreg (regs, (extra >> 22) & 7) = dst1;\n"); printf ("\t}\n"); } break; diff --git a/include/inputdevice.h b/include/inputdevice.h index 69182972..e561e77b 100644 --- a/include/inputdevice.h +++ b/include/inputdevice.h @@ -207,7 +207,7 @@ extern void inputdevice_setkeytranslation (struct uae_input_device_kbr_default * extern void inputdevice_do_keyboard (int code, int state); extern int inputdevice_iskeymapped (int keyboard, int scancode); extern int inputdevice_synccapslock (int, int*); -extern void inputdevice_testrecord (int type, int num, int wtype, int wnum, int state); +extern void inputdevice_testrecord (int type, int num, int wtype, int wnum, int state, int max); extern int inputdevice_get_compatibility_input (struct uae_prefs*, int, int*, int**, int**); extern struct inputevent *inputdevice_get_eventinfo (int evt); extern bool inputdevice_get_eventname (const struct inputevent *ie, TCHAR *out); @@ -292,7 +292,7 @@ extern int jsem_iskbdjoy (int port, const struct uae_prefs *p); extern int inputdevice_uaelib (const TCHAR *, const TCHAR *); -extern int inputdevice_testread (int*, int*, int*); +extern int inputdevice_testread (int*, int*, int*, bool); extern int inputdevice_istest (void); extern void inputdevice_settest (int); extern int inputdevice_testread_count (void); diff --git a/inputdevice.cpp b/inputdevice.cpp index 0f488117..e46f6672 100644 --- a/inputdevice.cpp +++ b/inputdevice.cpp @@ -134,6 +134,7 @@ struct teststore int testmode_wtype; int testmode_wnum; int testmode_state; + int testmode_max; }; #define TESTMODE_MAX 2 static int testmode_count; @@ -4927,7 +4928,21 @@ bool inputdevice_set_gameports_mapping (struct uae_prefs *prefs, int devnum, int { TCHAR name[256]; struct inputevent *ie; + int sub; + if (evtnum < 0) { + joysticks = prefs->joystick_settings[GAMEPORT_INPUT_SETTINGS]; + mice = prefs->mouse_settings[GAMEPORT_INPUT_SETTINGS]; + keyboards = prefs->keyboard_settings[GAMEPORT_INPUT_SETTINGS]; + for (sub = 0; sub < MAX_INPUT_SUB_EVENT; sub++) { + int port2 = 0; + inputdevice_get_mapping (devnum, num, NULL, &port2, NULL, NULL, sub); + if (port2 == port + 1) { + inputdevice_set_mapping (devnum, num, NULL, NULL, 0, 0, sub); + } + } + return true; + } ie = inputdevice_get_eventinfo (evtnum); if (!inputdevice_get_eventname (ie, name)) return false; @@ -4935,9 +4950,13 @@ bool inputdevice_set_gameports_mapping (struct uae_prefs *prefs, int devnum, int mice = prefs->mouse_settings[GAMEPORT_INPUT_SETTINGS]; keyboards = prefs->keyboard_settings[GAMEPORT_INPUT_SETTINGS]; - int sub = 0; + sub = 0; if (inputdevice_get_widget_type (devnum, num, NULL) != IDEV_WIDGET_KEY) { for (sub = 0; sub < MAX_INPUT_SUB_EVENT; sub++) { + int port2 = 0; + int evt = inputdevice_get_mapping (devnum, num, NULL, &port2, NULL, NULL, sub); + if (port2 == port + 1 && evt == evtnum) + break; if (!inputdevice_get_mapping (devnum, num, NULL, NULL, NULL, NULL, sub)) break; } @@ -6138,8 +6157,10 @@ void inputdevice_unacquire (void) idev[IDTYPE_KEYBOARD].unacquire (-1); } -void inputdevice_testrecord (int type, int num, int wtype, int wnum, int state) +void inputdevice_testrecord (int type, int num, int wtype, int wnum, int state, int max) { + //write_log (_T("%d %d %d %d %d/%d\n"), type, num, wtype, wnum, state, max); + if (wnum < 0) { testmode = -1; return; @@ -6170,20 +6191,31 @@ void inputdevice_testrecord (int type, int num, int wtype, int wnum, int state) continue; if (ts2->testmode_num != num || ts2->testmode_type != type || ts2->testmode_wtype != wtype || ts2->testmode_wnum != wnum) continue; - if (state) - continue; + if (max <= 0) { + if (state) + continue; + } else { + if (state < -(max / 2) || state > (max / 2)) + continue; + } ts2->testmode_num = -1; } - if (!state) - return; + if (max <= 0) { + if (!state) + return; + } else { + if (state >= -(max / 2) && state <= (max / 2)) + return; + } - //write_log (_T("%d %d %d %d %d\n"), type, num, wtype, wnum, state); + //write_log (_T("%d %d %d %d %d/%d\n"), type, num, wtype, wnum, state, max); struct teststore *ts = &testmode_data[testmode_count]; ts->testmode_type = type; ts->testmode_num = num; ts->testmode_wtype = wtype; ts->testmode_wnum = wnum; ts->testmode_state = state; + ts->testmode_max = max; testmode_count++; } @@ -6209,12 +6241,14 @@ int inputdevice_testread_count (void) return testmode_count; } -int inputdevice_testread (int *devnum, int *wtype, int *state) +int inputdevice_testread (int *devnum, int *wtype, int *state, bool doread) { - inputdevice_read (); - if (testmode != 1) { - testmode = 0; - return -1; + if (doread) { + inputdevice_read (); + if (testmode != 1) { + testmode = 0; + return -1; + } } if (testmode_count > 0) { testmode_count--; @@ -6242,9 +6276,9 @@ int inputdevice_testread (int *devnum, int *wtype, int *state) void setjoybuttonstate (int joy, int button, int state) { if (testmode) { - inputdevice_testrecord (IDTYPE_JOYSTICK, joy, IDEV_WIDGET_BUTTON, button, state); + inputdevice_testrecord (IDTYPE_JOYSTICK, joy, IDEV_WIDGET_BUTTON, button, state, -1); if (state < 0) - inputdevice_testrecord (IDTYPE_JOYSTICK, joy, IDEV_WIDGET_BUTTON, button, 0); + inputdevice_testrecord (IDTYPE_JOYSTICK, joy, IDEV_WIDGET_BUTTON, button, 0, -1); return; } #if 0 @@ -6295,7 +6329,7 @@ void setmousebuttonstate (int mouse, int button, int state) { uae_u32 obuttonmask = mice2[mouse].buttonmask; if (testmode) { - inputdevice_testrecord (IDTYPE_MOUSE, mouse, IDEV_WIDGET_BUTTON, button, state); + inputdevice_testrecord (IDTYPE_MOUSE, mouse, IDEV_WIDGET_BUTTON, button, state, -1); return; } setbuttonstateall (&mice[mouse], &mice2[mouse], button, state); @@ -6314,7 +6348,7 @@ void setjoystickstate (int joy, int axis, int state, int max) int i, v1, v2; if (testmode) { - inputdevice_testrecord (IDTYPE_JOYSTICK, joy, IDEV_WIDGET_AXIS, axis, state); + inputdevice_testrecord (IDTYPE_JOYSTICK, joy, IDEV_WIDGET_AXIS, axis, state, max); return; } v1 = state; @@ -6354,9 +6388,9 @@ void setmousestate (int mouse, int axis, int data, int isabs) static double fract[MAX_INPUT_DEVICES][MAX_INPUT_DEVICE_EVENTS]; if (testmode) { - inputdevice_testrecord (IDTYPE_MOUSE, mouse, IDEV_WIDGET_AXIS, axis, data); + inputdevice_testrecord (IDTYPE_MOUSE, mouse, IDEV_WIDGET_AXIS, axis, data, -1); // fake "release" event - inputdevice_testrecord (IDTYPE_MOUSE, mouse, IDEV_WIDGET_AXIS, axis, 0); + inputdevice_testrecord (IDTYPE_MOUSE, mouse, IDEV_WIDGET_AXIS, axis, 0, -1); return; } if (input_play) diff --git a/isofs.cpp b/isofs.cpp index 66fe7e60..7ce9beb5 100644 --- a/isofs.cpp +++ b/isofs.cpp @@ -2421,6 +2421,7 @@ bool isofs_mediainfo(void *sbp, struct isofs_info *ii) if (!sb) return true; struct isofs_sb_info *sbi = ISOFS_SB(sb); + ii->blocksize = 2048; if (sys_command_ismedia (sb->unitnum, true)) { struct device_info di; uae_u32 totalblocks = 0; @@ -2432,7 +2433,6 @@ bool isofs_mediainfo(void *sbp, struct isofs_info *ii) _tcscpy (ii->devname, di.label); } ii->unknown_media = sb->unknown_media; - ii->blocksize = 2048; if (sb->root) { _tcscpy (ii->volumename, sb->root->name); ii->blocks = sbi->s_max_size; diff --git a/memory.cpp b/memory.cpp index bb15f54c..e893d288 100644 --- a/memory.cpp +++ b/memory.cpp @@ -6,7 +6,7 @@ * (c) 1995 Bernd Schmidt */ -#define DEBUG_STUPID 1 +#define DEBUG_STUPID 0 #include "sysconfig.h" #include "sysdeps.h" diff --git a/od-win32/dinput.cpp b/od-win32/dinput.cpp index 6747f71b..c061df95 100644 --- a/od-win32/dinput.cpp +++ b/od-win32/dinput.cpp @@ -119,6 +119,7 @@ struct didata { uae_s16 buttonsort[MAX_MAPPINGS]; uae_s16 buttonaxisparent[MAX_MAPPINGS]; uae_s16 buttonaxisparentdir[MAX_MAPPINGS]; + uae_s16 buttonaxistype[MAX_MAPPINGS]; }; @@ -346,6 +347,7 @@ static void addplusminus (struct didata *did, int i) did->buttonsort[did->buttons] = 1000 + (did->axismappings[i] + did->axistype[i]) * 2 + j; did->buttonaxisparent[did->buttons] = i; did->buttonaxisparentdir[did->buttons] = j; + did->buttonaxistype[did->buttons] = did->axistype[i]; did->buttons++; } } @@ -951,6 +953,7 @@ static void sortobjects (struct didata *did) tmpc = did->buttonname[i]; did->buttonname[i] = did->buttonname[j]; did->buttonname[j] = tmpc; tmpi = did->buttonaxisparent[i]; did->buttonaxisparent[i] = did->buttonaxisparent[j]; did->buttonaxisparent[j] = tmpi; tmpi = did->buttonaxisparentdir[i]; did->buttonaxisparentdir[i] = did->buttonaxisparentdir[j]; did->buttonaxisparentdir[j] = tmpi; + tmpi = did->buttonaxistype[i]; did->buttonaxistype[i] = did->buttonaxistype[j]; did->buttonaxistype[j] = tmpi; } } } @@ -1700,30 +1703,37 @@ static bool initialize_rawinput (void) int ht; for (ht = 0; hidtable[ht].name; ht++) { if (hidtable[ht].usage == acnt && hidtable[ht].page == vcaps[i].UsagePage) { - if (hidtable[ht].page == 0x01 && acnt == 0x39) { // POV - if (axiscnt + 1 < MAX_MAPPINGS) { - for (int l = 0; l < 2; l++) { - TCHAR tmp[256]; - _stprintf (tmp, _T("%s (%c)"), hidtable[ht].name, l == 0 ? 'X' : 'Y'); - did->axisname[axiscnt] = my_strdup (tmp); - did->axissort[axiscnt] = hidtable[ht].priority * 2 + l; - did->axismappings[axiscnt] = acnt; - memcpy (&did->hidvcaps[axiscnt], &vcaps[i], sizeof HIDP_VALUE_CAPS); - did->axistype[axiscnt] = l + 1; - axiscnt++; + int k; + for (k = 0; k < axiscnt; k++) { + if (did->axismappings[k] == acnt) + break; + } + if (k == axiscnt) { + if (hidtable[ht].page == 0x01 && acnt == 0x39) { // POV + if (axiscnt + 1 < MAX_MAPPINGS) { + for (int l = 0; l < 2; l++) { + TCHAR tmp[256]; + _stprintf (tmp, _T("%s (%c)"), hidtable[ht].name, l == 0 ? 'X' : 'Y'); + did->axisname[axiscnt] = my_strdup (tmp); + did->axissort[axiscnt] = hidtable[ht].priority * 2 + l; + did->axismappings[axiscnt] = acnt; + memcpy (&did->hidvcaps[axiscnt], &vcaps[i], sizeof HIDP_VALUE_CAPS); + did->axistype[axiscnt] = l + 1; + axiscnt++; + } } + } else { + did->axissort[axiscnt] = hidtable[ht].priority * 2; + did->axisname[axiscnt] = my_strdup (hidtable[ht].name); + did->axismappings[axiscnt] = acnt; + memcpy (&did->hidvcaps[axiscnt], &vcaps[i], sizeof HIDP_VALUE_CAPS); + fixhidvcaps (&rdi->hid, &did->hidvcaps[axiscnt]); + did->axistype[axiscnt] = hidtable[ht].type; + axiscnt++; + did->analogstick = true; } - } else { - did->axissort[axiscnt] = hidtable[ht].priority * 2; - did->axisname[axiscnt] = my_strdup (hidtable[ht].name); - did->axismappings[axiscnt] = acnt; - memcpy (&did->hidvcaps[axiscnt], &vcaps[i], sizeof HIDP_VALUE_CAPS); - fixhidvcaps (&rdi->hid, &did->hidvcaps[axiscnt]); - did->axistype[axiscnt] = hidtable[ht].type; - axiscnt++; - did->analogstick = true; + break; } - break; } } if (hidtable[ht].name == NULL) @@ -2009,6 +2019,7 @@ static void handle_rawinput_2 (RAWINPUT *raw) int type = did->axistype[axisnum]; int logicalrange = (vcaps->LogicalMax - vcaps->LogicalMin) / 2; uae_u32 mask = hidmask (vcaps->BitSize); + int buttonaxistype; if (type == AXISTYPE_POV_X || type == AXISTYPE_POV_Y) { @@ -2032,6 +2043,9 @@ static void handle_rawinput_2 (RAWINPUT *raw) if (val == min + 3 && type == AXISTYPE_POV_X) data = -127; } + logicalrange = 127; + digitalrange = logicalrange / 2; + buttonaxistype = type == AXISTYPE_POV_X ? 1 : 2; } else { @@ -2060,27 +2074,30 @@ static void handle_rawinput_2 (RAWINPUT *raw) data = 0; //write_log (_T("%d %d: (%d-%d) %d\n"), num, axisnum, did->axismin[axisnum], did->axismax[axisnum], data); } + buttonaxistype = -1; } if (data != axisold[num][axisnum] && logicalrange) { - //write_log (_T("%d %d: %d->%d\n"), num, axisnum, axisold[num][axisnum], data); + //write_log (_T("%d %d: %d->%d %d\n"), num, axisnum, axisold[num][axisnum], data, logicalrange); axisold[num][axisnum] = data; int bstate = -1; int bstate2 = 0; for (j = 0; j < did->buttons; j++) { - if (did->buttonaxisparent[j] >= 0 && did->buttonmappings[j] == usage) { + if (did->buttonaxisparent[j] >= 0 && did->buttonmappings[j] == usage && (did->buttonaxistype[j] == buttonaxistype || buttonaxistype < 0)) { + int axistype = did->axistype[j]; if (did->buttonaxisparentdir[j] == 0 && data < -digitalrange) { bstate = j; bstate2 = 1; - } else if (did->buttonaxisparentdir[j] && data > digitalrange) { + } else if (did->buttonaxisparentdir[j] != 0 && data > digitalrange) { bstate = j; bstate2 = 1; - } else if (data > - digitalrange && data < digitalrange) { + } else if (data >= -digitalrange && data <= digitalrange) { bstate = j; bstate2 = 0; } - //write_log (_T("%d %d %d\n"), num, bstate, bstate2); + if (bstate >= 0 && buttonold[num][bstate] != bstate2) { + //write_log (_T("%d %d %d (%s)\n"), num, bstate, bstate2, did->buttonname[bstate]); buttonold[num][bstate] = bstate2; setjoybuttonstate (num, bstate, bstate2); } @@ -2194,10 +2211,10 @@ static void handle_rawinput_2 (RAWINPUT *raw) if (scancode == DIK_F12) scancode = -1; if (scancode == DIK_F11) { - inputdevice_testrecord (IDTYPE_KEYBOARD, num, IDEV_WIDGET_BUTTON, 0x100, 1); - inputdevice_testrecord (IDTYPE_KEYBOARD, num, IDEV_WIDGET_BUTTON, 0x100, 0); + inputdevice_testrecord (IDTYPE_KEYBOARD, num, IDEV_WIDGET_BUTTON, 0x100, 1, -1); + inputdevice_testrecord (IDTYPE_KEYBOARD, num, IDEV_WIDGET_BUTTON, 0x100, 0, -1); } else { - inputdevice_testrecord (IDTYPE_KEYBOARD, num, IDEV_WIDGET_BUTTON, scancode, pressed); + inputdevice_testrecord (IDTYPE_KEYBOARD, num, IDEV_WIDGET_BUTTON, scancode, pressed, -1); } } else { scancode = keyhack (scancode, pressed, num); @@ -3219,10 +3236,10 @@ static void read_kb (void) if (scancode == DIK_F12) scancode = -1; if (scancode == DIK_F11) { - inputdevice_testrecord (IDTYPE_KEYBOARD, i, IDEV_WIDGET_BUTTON, 0x100, 1); - inputdevice_testrecord (IDTYPE_KEYBOARD, i, IDEV_WIDGET_BUTTON, 0x100, 0); + inputdevice_testrecord (IDTYPE_KEYBOARD, i, IDEV_WIDGET_BUTTON, 0x100, 1, -1); + inputdevice_testrecord (IDTYPE_KEYBOARD, i, IDEV_WIDGET_BUTTON, 0x100, 0, -1); } else { - inputdevice_testrecord (IDTYPE_KEYBOARD, i, IDEV_WIDGET_BUTTON, scancode, pressed); + inputdevice_testrecord (IDTYPE_KEYBOARD, i, IDEV_WIDGET_BUTTON, scancode, pressed, -1); } } else { if (stopoutput == 0) diff --git a/od-win32/picasso96_win.cpp b/od-win32/picasso96_win.cpp index e1c35053..010f3338 100644 --- a/od-win32/picasso96_win.cpp +++ b/od-win32/picasso96_win.cpp @@ -4259,11 +4259,11 @@ static void initvblankirq (TrapContext *ctx, uaecptr base) put_long (p2 + 14, base + CARD_IRQFLAG); put_long (p2 + 18, c); - put_word (c, 0x4a11); c += 2; // tst.b (a1) + put_word (c, 0x4a11); c += 2; // tst.b (a1) CARD_IRQFLAG put_word (c, 0x670e); c += 2; // beq.s label put_word (c, 0x4211); c += 2; // clr.b (a1) - put_long (c, 0x22690004); c += 4; // move.l 4(a1),a1 - put_long (c, 0x2c780004); c += 4; // move.l 4.w,a6 + put_long (c, 0x2c690008); c += 4; // move.l 8(a1),a6 CARD_IRQEXECBASE + put_long (c, 0x22690004); c += 4; // move.l 4(a1),a1 CARD_IRQPTR put_long (c, 0x4eaeff4c); c += 4; // jsr Cause(a6) put_word (c, 0x7000); c += 2; // label: moveq #0,d0 put_word (c, RTS); // rts @@ -4474,7 +4474,8 @@ static void inituaegfxfuncs (uaecptr start, uaecptr ABI) RTGCALLDEFAULT(PSSO_BoardInfo_UpdatePlanar, PSSO_BoardInfo_UpdatePlanarDefault); RTGCALLDEFAULT(PSSO_BoardInfo_DrawLine, PSSO_BoardInfo_DrawLineDefault); - RTGCALL2(PSSO_BoardInfo_SetInterrupt, picasso_SetInterrupt); + if (currprefs.rtg_hardwareinterrupt) + RTGCALL2(PSSO_BoardInfo_SetInterrupt, picasso_SetInterrupt); write_log (_T("uaegfx.card magic code: %08X-%08X ABI=%08X\n"), start, here (), ABI); @@ -4581,6 +4582,7 @@ static uaecptr uaegfx_card_install (TrapContext *ctx, uae_u32 extrasize) m68k_dreg (regs, 0) = 0; put_long (uaegfx_base + CARD_EXPANSIONBASE, CallLib (ctx, exec, -0x228)); /* OpenLibrary */ put_long (uaegfx_base + CARD_EXECBASE, exec); + put_long (uaegfx_base + CARD_IRQEXECBASE, exec); put_long (uaegfx_base + CARD_NAME, uaegfx_resname); put_long (uaegfx_base + CARD_RESLIST, uaegfx_base + CARD_SIZEOF); put_long (uaegfx_base + CARD_RESLISTSIZE, extrasize); diff --git a/od-win32/picasso96_win.h b/od-win32/picasso96_win.h index 52641677..4659b334 100644 --- a/od-win32/picasso96_win.h +++ b/od-win32/picasso96_win.h @@ -597,7 +597,8 @@ extern int p96hsync_counter; #define CARD_PORTSIRQ (CARD_VBLANKIRQ + 22) #define CARD_IRQFLAG (CARD_PORTSIRQ + 22) #define CARD_IRQPTR (CARD_IRQFLAG + 4) -#define CARD_IRQCODE (CARD_IRQPTR + 4) +#define CARD_IRQEXECBASE (CARD_IRQPTR + 4) +#define CARD_IRQCODE (CARD_IRQEXECBASE + 4) #define CARD_END (CARD_IRQCODE + 11 * 2) #define CARD_SIZEOF CARD_END diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index 1f051009..61c2df5c 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -588,6 +588,14 @@ static void releasecapture (void) showcursor = 0; } +void updatemouseclip (void) +{ + if (showcursor) { + ClipCursor (&amigawin_rect); + //write_log (_T("CLIP %dx%d %dx%d\n"), amigawin_rect.left, amigawin_rect.top, amigawin_rect.right, amigawin_rect.bottom); + } +} + static void setmouseactive2 (int active, bool allowpause) { //write_log (_T("setmouseactive %d->%d\n"), mouseactive, active); @@ -658,7 +666,7 @@ static void setmouseactive2 (int active, bool allowpause) if (!showcursor) { ShowCursor (FALSE); SetCapture (hAmigaWnd); - ClipCursor (&amigawin_rect); + updatemouseclip (); } showcursor = 1; setcursor (-30000, -30000); @@ -1176,6 +1184,7 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, changed_prefs.gfx_size_win.y = amigawin_rect.top; config_changed = 1; } + updatemouseclip (); } notice_screen_contents_lost (); } diff --git a/od-win32/win32.h b/od-win32/win32.h index 5d15fed6..af1a44bf 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -19,8 +19,8 @@ #define LANG_DLL 1 //#define WINUAEBETA _T("") -#define WINUAEBETA _T("23") -#define WINUAEDATE MAKEBD(2012, 10, 31) +#define WINUAEBETA _T("24") +#define WINUAEDATE MAKEBD(2012, 11, 5) #define WINUAEEXTRA _T("") //#define WINUAEEXTRA _T("AmiKit Preview") #define WINUAEREV _T("") @@ -63,6 +63,7 @@ extern void gui_restart (void); extern void setmouseactive (int active); extern void minimizewindow (void); extern uae_u32 OSDEP_minimize_uae (void); +extern void updatemouseclip (void); extern void resumepaused (int priority); extern void setpaused (int priority); diff --git a/od-win32/win32gfx.cpp b/od-win32/win32gfx.cpp index f0183e40..cfb0e828 100644 --- a/od-win32/win32gfx.cpp +++ b/od-win32/win32gfx.cpp @@ -1548,6 +1548,7 @@ static int open_windows (int full) setpriority (&priorities[currprefs.win32_active_capture_priority]); for (i = 0; i < NUM_LEDS; i++) gui_led (i, -1); + gui_led (LED_POWER, gui_data.powerled); gui_fps (0, 0, 0); inputdevice_acquire (TRUE); } else if (startminimized) { @@ -3522,7 +3523,9 @@ static int create_windows_2 (void) GetWindowRect (hMainWnd, &mainwin_rect); if (d3dfs || dxfs) SetCursorPos (x + w / 2, y + h / 2); - write_log (_T("window already open\n")); + write_log (_T("window already open (%dx%d %dx%d)\n"), + amigawin_rect.left, amigawin_rect.top, amigawin_rect.right - amigawin_rect.left, amigawin_rect.bottom - amigawin_rect.top); + updatemouseclip (); #ifdef RETROPLATFORM rp_set_hwnd (hAmigaWnd); #endif diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index f528867d..f19c7a7e 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -3439,7 +3439,8 @@ static void update_listview_input (HWND hDlg) } static int inputmap_port = -1, inputmap_port_remap = -1; -static int inputmap_handle (HWND list, int currentdevnum, int currentwidgetnum, int *inputmap_portp, int *inputmap_indexp, int state) +static int inputmap_groupindex[32]; +static int inputmap_handle (HWND list, int currentdevnum, int currentwidgetnum, int *inputmap_portp, int *inputmap_indexp, int state, int *inputmap_itemindexp) { int cntitem, cntgroup, portnum; int mode, *events, *axistable; @@ -3476,6 +3477,8 @@ static int inputmap_handle (HWND list, int currentdevnum, int currentwidgetnum, lvstruct.lParam = 0; lvstruct.iSubItem = 0; lvstruct.iGroupId = cntgroup; + if (inputmap_itemindexp) + inputmap_itemindexp[cntgroup] = -1; } atpidx = 0; @@ -3510,6 +3513,8 @@ static int inputmap_handle (HWND list, int currentdevnum, int currentwidgetnum, lvstruct.pszText = target; lvstruct.iItem = cntgroup * 256 + cntitem; item = ListView_InsertItem (list, &lvstruct); + if (inputmap_itemindexp && inputmap_itemindexp[cntgroup - 1] < 0) + inputmap_itemindexp[cntgroup - 1] = item; } else if (currentdevnum == devnum) { if (currentwidgetnum == j) { *inputmap_portp = portnum; @@ -3536,6 +3541,8 @@ static int inputmap_handle (HWND list, int currentdevnum, int currentwidgetnum, lvstruct.pszText = _T(""); lvstruct.iItem = cntgroup * 256 + cntitem; item = ListView_InsertItem (list, &lvstruct); + if (inputmap_itemindexp && inputmap_itemindexp[cntgroup - 1] < 0) + inputmap_itemindexp[cntgroup - 1] = item; } cntitem++; } @@ -3555,7 +3562,7 @@ static void update_listview_inputmap (HWND hDlg) ListView_EnableGroupView (list, TRUE); - inputmap_handle (list, -1, -1, NULL, NULL, 0); + inputmap_handle (list, -1, -1, NULL, NULL, 0, inputmap_groupindex); } static int clicked_entry = -1; @@ -12301,7 +12308,7 @@ static void CALLBACK timerfunc (HWND hDlg, UINT uMsg, UINT_PTR idEvent, DWORD dw } if (!cnt) return; - int ret = inputdevice_testread (&devnum, &wtype, &state); + int ret = inputdevice_testread (&devnum, &wtype, &state, true); if (ret > 0) { if (wtype < 0) { if (!state) @@ -12310,13 +12317,14 @@ static void CALLBACK timerfunc (HWND hDlg, UINT uMsg, UINT_PTR idEvent, DWORD dw // F11 if (inputmap == 1) { int mode, *events, *axistable; - inputmap_remap_counter++; - ListView_EnsureVisible (h, inputmap_remap_counter, FALSE); - ListView_SetItemState (h, -1, 0, LVIS_SELECTED | LVIS_FOCUSED); - ListView_SetItemState (h, inputmap_remap_counter, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); int max = inputdevice_get_compatibility_input (&workprefs, inputmap_port, &mode, &events, &axistable); + inputmap_remap_counter++; if (inputmap_remap_counter >= max) - inputmap_remap_counter = -1; + inputmap_remap_counter = 0; + inputmap_index = inputmap_groupindex[inputmap_remap_counter]; + ListView_EnsureVisible (h, inputmap_index, FALSE); + ListView_SetItemState (h, -1, 0, LVIS_SELECTED | LVIS_FOCUSED); + ListView_SetItemState (h, inputmap_index, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); } else if (inputmap == 2) { int itemcnt = ListView_GetItemCount (h); if (inputmap_view_offset >= itemcnt - 1 || inputmap_view_offset < 0) { @@ -12338,51 +12346,124 @@ static void CALLBACK timerfunc (HWND hDlg, UINT uMsg, UINT_PTR idEvent, DWORD dw if (inputmap == 1) { // ports panel / remap static int skipbuttonaxis; + static int prevtype2, prevtype, prevwidget, prevevtnum, prevaxisevent, prevaxisstate; + int widgets[10], widgetstate[10]; + int wcnt, found, axisevent, axisstate; HWND h = GetDlgItem (hDlg, IDC_INPUTMAPLIST); int mode, *events, *axistable, *axistable2; - int cntadd = 1; int max = inputdevice_get_compatibility_input (&workprefs, inputmap_port, &mode, &events, &axistable); int evtnum = events[inputmap_remap_counter]; int type2 = intputdevice_compa_get_eventtype (evtnum, &axistable2); - if (type == IDEV_WIDGET_BUTTONAXIS) { - if (skipbuttonaxis) { - skipbuttonaxis = false; - return; + if (inputmap_remap_counter == 0) { + prevtype = prevtype2 = prevwidget = prevevtnum = prevaxisevent = -1; + } + + axisevent = -1; + axisstate = 0; + wcnt = 0; + widgets[wcnt] = input_selected_widget; + widgetstate[wcnt] = state; + wcnt++; + for (;;) { + ret = inputdevice_testread (&devnum, &wtype, &state, false); + if (ret <= 0) + break; + if (devnum != input_selected_device) + continue; + if (wcnt < 10) { + widgets[wcnt] = wtype; + widgetstate[wcnt] = state; + wcnt++; } - if (type2 != IDEV_WIDGET_BUTTON && type2 != IDEV_WIDGET_KEY) - return; - } else if (type == IDEV_WIDGET_AXIS) { - skipbuttonaxis = false; - if (type2 == IDEV_WIDGET_BUTTON || type2 == IDEV_WIDGET_KEY) - return; - if (type2 == IDEV_WIDGET_BUTTONAXIS) { - if (inputmap_remap_counter & 1) - return; - // use VERT or HORIZ events, not UP/DOWN/LEFT/RIGHT - evtnum = axistable2[0]; - cntadd = 2; - skipbuttonaxis = true; + } + + found = 0; + for (int i = 0; i < wcnt; i++) { + input_selected_widget = widgets[i]; + type = inputdevice_get_widget_type (input_selected_device, input_selected_widget, NULL); + if (type == IDEV_WIDGET_BUTTONAXIS) { + found = 1; + break; + } + } + for (int i = 0; i < wcnt; i++) { + int typex = inputdevice_get_widget_type (input_selected_device, widgets[i], NULL); + if (typex == IDEV_WIDGET_AXIS) { + if (!found) { + found = 1; + input_selected_widget = widgets[i]; + } else if (found && type == IDEV_WIDGET_BUTTONAXIS) { + axisevent = widgets[i]; + axisstate = widgetstate[i]; + } + break; + } + } + if (!found) { + for (int i = 0; i < wcnt; i++) { + input_selected_widget = widgets[i]; + type = inputdevice_get_widget_type (input_selected_device, input_selected_widget, NULL); + if (type == IDEV_WIDGET_BUTTON || type == IDEV_WIDGET_KEY) { + found = 1; + break; + } + } + } + if (!found) + return; + + // if (inputmap_remap_counter > 4) + // write_log (_T("*")); + + //write_log (_T("%d %d %d %d %d\n"), input_selected_device, input_selected_widget, type, evtnum, type2); + + // if this and previous are same axis and they match (up/down or left/right) + if ((inputmap_remap_counter & 1) == 1) { + if (type2 == IDEV_WIDGET_BUTTONAXIS && prevtype2 == IDEV_WIDGET_BUTTONAXIS) { + if (type == IDEV_WIDGET_BUTTONAXIS && prevtype == IDEV_WIDGET_BUTTONAXIS) { + if (axisevent == prevaxisevent && (axisstate > 0 && prevaxisstate < 0)) { + for (int i = 0; i < wcnt; i++) { + wtype = widgets[i]; + if (inputdevice_get_widget_type (input_selected_device, wtype, NULL) == IDEV_WIDGET_AXIS) { + inputdevice_set_gameports_mapping (&workprefs, input_selected_device, prevwidget, -1, 0, inputmap_port); + inputdevice_set_gameports_mapping (&workprefs, input_selected_device, wtype, axistable2[0], 0, inputmap_port); + evtnum = -1; + break; + } + } + } + } } } - //write_log (_T("%d %d %d %s\n"), input_selected_device, input_selected_widget, evtnum, name); - inputdevice_set_gameports_mapping (&workprefs, input_selected_device, input_selected_widget, evtnum, 0, inputmap_port); +// write_log (_T("%d %d %d\n"), input_selected_device, input_selected_widget, evtnum); + if (evtnum >= 0) + inputdevice_set_gameports_mapping (&workprefs, input_selected_device, input_selected_widget, evtnum, 0, inputmap_port); InitializeListView (hDlg); - inputmap_remap_counter += cntadd; - ListView_EnsureVisible (h, inputmap_remap_counter, FALSE); - ListView_SetItemState (h, -1, 0, LVIS_SELECTED | LVIS_FOCUSED); - ListView_SetItemState (h, inputmap_remap_counter, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); + inputmap_remap_counter++; if (inputmap_remap_counter >= max) - inputmap_remap_counter = -1; + inputmap_remap_counter = 0; + + inputmap_index = inputmap_groupindex[inputmap_remap_counter]; + ListView_EnsureVisible (h, inputmap_index, FALSE); + ListView_SetItemState (h, -1, 0, LVIS_SELECTED | LVIS_FOCUSED); + ListView_SetItemState (h, inputmap_index, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); TCHAR tmp[256]; tmp[0] = 0; inputdevice_get_widget_type (input_selected_device, input_selected_widget, tmp); _tcscat (tmp, _T(", ")); _tcscat (tmp, inputdevice_get_device_name2 (input_selected_device)); SetWindowText (GetDlgItem (hDlg, IDC_INPUTMAPOUT), tmp); + + prevtype = type; + prevtype2 = type2; + prevwidget = input_selected_widget; + prevevtnum = evtnum; + prevaxisevent = axisevent; + prevaxisstate = axisstate; } else if (inputmap == 2) { // ports panel / test @@ -12402,7 +12483,7 @@ static void CALLBACK timerfunc (HWND hDlg, UINT uMsg, UINT_PTR idEvent, DWORD dw bool found = false; HWND h = GetDlgItem (hDlg, IDC_INPUTMAPLIST); int op = inputmap_port; - if (inputmap_handle (NULL, input_selected_device, input_selected_widget, &op, &inputmap_index, state)) { + if (inputmap_handle (NULL, input_selected_device, input_selected_widget, &op, &inputmap_index, state, NULL)) { if (op == inputmap_port) { ListView_EnsureVisible (h, 1, FALSE); ListView_EnsureVisible (h, inputmap_index, FALSE); diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index b184e34c..2d565259 100644 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,6 +1,17 @@ - restore only single input target to default. +Beta 24: + +- CDFS: ACTION_DISK_INFO no disk status really works now. +- Fixed "Windows mouse" sometimes hitting invisible barriers in windowed mode if window size changed and mouse was captured. (Quite old bug) +- blitter_cycle_exact=true and cpu_cycle_exact=false confused blitter emulation if BLTSIZE was written twice while DMA was disabled. +- CAS and CAS2 instruction fixes from Aranym (I guess these are practically never used on Amiga..) +- Ignore duplicate USB HID axis IDs. (I was lazy and only added duplicate button check previously..) +- USB HID D-Pad/POV axis may have caused ghost events. +- GamePorts panel Remap separated axis configuration support (for example up can be mapped to button and down can be normal down axis), + and multiple input sources can be mapped to single input target. Selection cursor now wraps around to allow multiconfiguration. + Beta 23: - CDFS: Joliet CDs didn't work and caused crashes. Directory listing worked but it was only possible to open non-existing files :) -- 2.47.3