--- uae/src/inputdevice.c 2018/04/24 17:16:27 1.1.1.3 +++ uae/src/inputdevice.c 2018/04/24 17:21:46 1.1.1.5 @@ -21,10 +21,9 @@ #include "sysconfig.h" #include "sysdeps.h" +#include + #include "options.h" -#include "keyboard.h" -#include "inputdevice.h" -#include "keybuf.h" #include "custom.h" #include "xwin.h" #include "drawing.h" @@ -37,6 +36,11 @@ #include "gui.h" #include "disk.h" #include "audio.h" +#include "autoconf.h" +#include "traps.h" +#include "keyboard.h" +#include "inputdevice.h" +#include "keybuf.h" #include "savestate.h" #define DIR_LEFT 1 @@ -520,12 +524,44 @@ void read_inputdevice_config (struct uae static int ievent_alive = 0; static int lastmx, lastmy; +static void mousehack_setpos (int mousexpos, int mouseypos) +{ + uae_u8 *p; + if (!uae_boot_rom) + return; + p = rtarea + get_long (RTAREA_BASE + 40) + 12; + p[0] = mousexpos >> 8; + p[1] = mousexpos; + p[2] = mouseypos >> 8; + p[3] = mouseypos; + //write_log ("%dx%d\n", mousexpos, mouseypos); +} + +static void new_mousehack_helper (void) +{ + int mousexpos, mouseypos; + + if (!mousehack_allowed ()) + return; +#ifdef PICASSO96 + if (picasso_on) { + mousexpos = lastmx - picasso96_state.XOffset; + mouseypos = lastmy - picasso96_state.YOffset; + } else +#endif + { + mouseypos = coord_native_to_amiga_y (lastmy) << 1; + mousexpos = coord_native_to_amiga_x (lastmx); + } + mousehack_setpos (mousexpos, mouseypos); +} + int mousehack_alive (void) { return ievent_alive > 0; } -uae_u32 mousehack_helper (void) +uae_u32 mousehack_helper (TrapContext *dummy) { int mousexpos, mouseypos; @@ -544,7 +580,7 @@ uae_u32 mousehack_helper (void) switch (m68k_dreg (regs, 0)) { case 0: - return ievent_alive ? -1 : needmousehack (); + return ievent_alive ? -1 : (1 || !uae_boot_rom) && needmousehack (); case 1: ievent_alive = 10; if (!mousehack_allowed ()) @@ -689,7 +725,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]; -// write_log ("%d:%04.4X %p\n",vpos,v,m68k_getpc()); +// write_log ("%d:%04.4X %p\n",vpos,v,m68k_getpc ()); } static uae_u8 parconvert (uae_u8 v, int jd, int shift) @@ -820,7 +856,7 @@ static uae_u16 handle_joystick_potgor (u potgor &= ~p9dat; /* shift at zero == return zero */ if (cd32_shifter[i] >= 2 && (joybutton[i] & ((1 << JOYBUTTON_CD32_PLAY) << (cd32_shifter[i] - 2)))) potgor &= ~p9dat; - //write_log ("%d:%04.4X %08.8X\n", cd32_shifter[i], potgor, m68k_getpc()); + //write_log ("%d:%04.4X %08.8X\n", cd32_shifter[i], potgor, m68k_getpc ()); } else { if (getbuttonstate (i, JOYBUTTON_3)) potgor &= ~p5dat; @@ -901,7 +937,7 @@ void POTGO (uae_u16 v) { int i; - //write_log ("W:%d: %04.4X %p\n", vpos, v, m68k_getpc()); + //write_log ("W:%d: %04.4X %p\n", vpos, v, m68k_getpc ()); #ifdef DONGLE_DEBUG if (notinrom ()) write_log ("POTGO %04.4X %s\n", v, debuginfo(0)); @@ -933,7 +969,7 @@ void POTGO (uae_u16 v) uae_u16 POTGOR (void) { uae_u16 v = handle_joystick_potgor (potgo_value) & 0x5500; - //write_log("R:%d:%04.4X %d %p\n", vpos, v, cd32_shifter[1], m68k_getpc()); + //write_log ("R:%d:%04.4X %d %p\n", vpos, v, cd32_shifter[1], m68k_getpc ()); return v; } @@ -1012,7 +1048,7 @@ void inputdevice_do_keyboard (int code, uae_reset (r); } record_key ((uae_u8)((key << 1) | (key >> 7))); - //write_log("Amiga key %02.2X %d\n", key & 0x7f, key >> 7); + //write_log ("Amiga key %02.2X %d\n", key & 0x7f, key >> 7); return; } inputdevice_add_inputcode (code, state); @@ -1204,7 +1240,7 @@ void handle_input_event (int nr, int sta if (nr <= 0) return; ie = &events[nr]; - //write_log("'%s' %d %d\n", ie->name, state, max); + //write_log ("'%s' %d %d\n", ie->name, state, max); if (autofire) { if (state) queue_input_event (nr, state, max, currprefs.input_autofire_framecnt, 1); @@ -1428,7 +1464,7 @@ static int ismouse (int ei) extern int cd32_enabled; #endif -static void scanevents(struct uae_prefs *p) +static void scanevents (struct uae_prefs *p) { int i, j, k, ei; struct inputevent *e; @@ -2290,6 +2326,7 @@ void setmousestate (int mouse, int axis, } for (i = 0; i < MAX_INPUT_SUB_EVENT; i++) handle_input_event (id->eventid[ID_AXIS_OFFSET + axis][i], v, 0, 0); + new_mousehack_helper(); } #if 0