RGTMax Posted November 1, 2015 Posted November 1, 2015 Hello guys! It might be a stupid question, but I have a hard time configuring my wiimotes as lightguns in MAME through Glovepie.I have several scripts, which work great outside of hyperspin. The mouse cursor moves smoothly and everything looks fine. However, when I enter Hyperspin, the cursor starts to move as if it was on a grid. It looks like the wiimotes are emulating the keyboard and it makes the whole thing unplayable. Do you have any idea on what my problem could be? Thank everyone! PS: This is the "best" Glovepie script I've found so far:------------------------------------------------------------------------- 'MAME Wiimote Lightgun Script 'NOTE: PPJOY MUST be installed for this to work! 'NOTE2: The guns will show up as joysticks in mame, NOT mice! 'NOTE3: Set the deadzone in your mame.ini to 0 and the Saturation to 1 'for best results 'Mappings: 'Power Button = Turn off Wiimote 'NOTE: Do NOT hit the power button if you wiimote isn't connected to your 'computer, it will turn on your Wii! '1+2 = Connect Wiimote (Only works when script first starts... can take 'multiple trys) 'Pointer Position = Joystick X and Y Axis 'B Trigger = Joy Button 1 'A Button or Shake Wiimote = Joy Button 2 (You can smack the butt of the handle on the gun to reload or press A) '1 Button = Joy Button 3 '2 Button = Joy Button 4 '-Button = Joy Button 5 '+Button = Joy Button 6 'Home Button = Joy Button 7 'D-pad UP = Enter Calibration Mode 'D-pad DOWN = Reset Calibration Values to the Default 'For Player 1 ONLY! '------------------- 'D-pad Left=Toggle Offscreen Reload (On for lightgun, off for joystick gun) '------------------- 'if Nunchuck Mode is plugged in: (in addition to wiimote mappings) 'Z Button or Shake Nunchuck = Joy Button 2 'C Button = Joy Button 1 if var.init=0 then 'USER Editable Settings Section '------------------------------ 'exit script when made exits var.exit=1 'unpair wiimotes on exit.... set to 0 if you want to leave them connected. var.unpair=1 'Aspect Mode Correction: 0=None, 1=Playing a 4:3 game on a 16:9 monitor '2=Playing a 4:3 game on a 16:10 monitor 'wtp=AspectMode var.AspectMode=0 'enables pressing button 2 via shaking the wiimote var.shake=1 'enables pressing button2 via shaking the nunchuck var.nshake=1 'NOTE: The shake to reload options don't work unless offscreen reload is enabled 'Note: WTP comments are for my experimental write to pie app... it'll let 'you save your calibration settings! So don't remove or move them! 'Starting Calibartion Values... Will be saved as you adjust! '---------------------------------------------------------- 'wtp=offscreenreload var.offscreenreload=0 'wtp=xmin var.xmin=0.08 'wtp=ymin var.ymin=0.07 'wtp=xmax var.xmax=0.96 'wtp=ymax var.ymax=0.95 'wtp=xmin2 var.xmin2=0.14 'wtp=ymin2 var.ymin2=0.28 'wtp=xmax2 var.xmax2=0.73 'wtp=ymax2 var.ymax2=1.03 'wtp=xmin3 var.xmin3=0 'wtp=ymin3 var.ymin3=0 'wtp=xmax3 var.xmax3=1 'wtp=ymax3 var.ymax3=1 'wtp=xmin4 var.xmin4=0 'wtp=ymin4 var.ymin4=0 'wtp=xmax4 var.xmax4=1 'wtp=ymax4 var.ymax4=1 '----------------------------------------------------------- 'constant section '--------------- var.init=1 pie.FrameRate = 100 hz '--------------- var.exists=wiimote1.Exists var.exists2=wiimote2.exists end if if var.MAME=0 then if window.class="MAME" then var.MAME=1 end if if var.MAME=1 then if window.class <> "MAME" then if var.unpair=1 then execute("btpair.exe"," -u") exitpie end if end if 'Gun Control Section if var.calibrate=0 then fakecursor5.visible=0 'Player 1 if var.calibrate=0 and wiimote1.exists =true then var.pointerx=wiimote1.pointerx var.pointery=wiimote1.pointery if var.MAME=0 then if fakecursor1.visible=0 then fakecursor1.visible=1 fakecursor1.x = maprange(var.pointerx,var.xmin,var.xmax,0,1) fakecursor1.y =maprange(var.pointery,var.ymin,var.ymax,0,1) else if fakecursor1.visible=1 then fakecursor1.visible=0 if var.offscreenreload=1 then if var.reload=0 then ppjoy1.Analog0 = maprange(var.pointerx,var.xmin,var.xmax,-1,1) ppjoy1.analog1 =maprange(var.pointery,var.ymin,var.ymax,-1,1) end if else ppjoy1.Analog0 = maprange(var.pointerx,var.xmin,var.xmax,-1,1) ppjoy1.analog1 =maprange(var.pointery,var.ymin,var.ymax,-1,1) end if if nunchuck1.Exists=0 then ppjoy1.Digital0=wiimote1.b if var.shake=1 and var.offscreenreload=1 then var.reload=wiimote1.a or wiimote1.shake else var.reload=wiimote1.a end if else ppjoy1.digital0=wiimote1.b or nunchuck1.C if var.nshake=1 then if var.shake=1 then var.reload=wiimote1.a or wiimote1.shake or nunchuck1.Z or wiimote1.Nunchuk.Shake else var.reload=wiimote1.a or nunchuck1.Z or wiimote1.Nunchuk.Shake end if else if var.shake=1 and var.offscreenload=1 then var.reload=wiimote1.a or wiimote1.shake or nunchuck1.Z else var.reload=wiimote1.a or nunchuck1.Z end if end if end if if var.offscreenreload=1 then if var.reload=1 then ppjoy1.Analog0=-1 ppjoy1.Analog1=-1 ppjoy1.Digital0=1 wait 10ms ppjoy1.digital0=0 end if else ppjoy1.digital1=var.reload end if ppjoy1.digital2 = wiimote1.one ppjoy1.digital3 = wiimote1.two ppjoy1.digital4=wiimote1.minus ppjoy1.digital5=wiimote1.plus ppjoy1.digital6=wiimote1.home end if else if var.calibrate=0 then fakecursor1.visible=0 end if '---------------------------------------------------------------------------- 'Player 2 if var.calibrate=0 and wiimote2.exists = true then var.pointerx2=wiimote2.pointerx var.pointery2=wiimote2.pointery if var.MAME=0 then if fakecursor2.visible=0 then fakecursor2.visible=1 fakecursor2.x = maprange(var.pointerx2,var.xmin2,var.xmax2,0,1) fakecursor2.y =maprange(var.pointery2,var.ymin2,var.ymax2,0,1) else if fakecursor2.visible=1 then fakecursor2.visible=0 if var.offscreenreload=1 then if var.reload2=0 then ppjoy2.Analog0 = maprange(var.pointerx2,var.xmin2,var.xmax2,-1,1) ppjoy2.analog1 =maprange(var.pointery2,var.ymin2,var.ymax2,-1,1) end if else ppjoy2.Analog0 = maprange(var.pointerx2,var.xmin2,var.xmax2,-1,1) ppjoy2.analog1 =maprange(var.pointery2,var.ymin2,var.ymax2,-1,1) end if if nunchuck2.Exists=0 then ppjoy2.Digital0=wiimote2.b if var.shake=1 and var.offscreenreload=1 then var.reload2=wiimote2.a or wiimote2.shake else var.reload2=wiimote2.a end if else ppjoy2.digital0=wiimote2.b or nunchuck2.C if var.nshake=1 then if var.shake=1 then var.reload=wiimote2.a or wiimote2.shake or nunchuck2.Z or wiimote2.Nunchuk.Shake else var.reload=wiimote2.a or nunchuck2.Z or wiimote2.Nunchuk.Shake end if else if var.shake=1 and var.offscreenload=1 then var.reload=wiimote2.a or wiimote2.shake or nunchuck2.Z else var.reload=wiimote2.a or nunchuck2.Z end if end if end if if var.offscreenreload=1 then if var.reload2=1 then ppjoy2.Analog0=-1 ppjoy2.Analog1=-1 ppjoy2.Digital0=1 wait 10ms ppjoy2.digital0=0 end if else ppjoy2.digital2=var.reload2 end if ppjoy2.digital2 = wiimote2.one ppjoy2.digital3 = wiimote2.two ppjoy2.digital4=wiimote2.minus ppjoy2.digital5=wiimote2.plus ppjoy2.digital6=wiimote2.home end if else if var.calibrate=0 then fakecursor2.visible=0 end if '--------------------------------------------------------------------------- 'Player 3 if var.calibrate=0 and wiimote3.exists = true then var.pointerx3=wiimote3.pointerx var.pointery3=wiimote3.pointery if var.MAME=0 then if fakecursor3.visible=0 then fakecursor3.visible=1 fakecursor3.x = maprange(var.pointerx3,var.xmin3,var.xmax3,0,1) fakecursor3.y =maprange(var.pointery3,var.ymin3,var.ymax3,0,1) else if fakecursor3.visible=1 then fakecursor3.visible=0 if var.offscreenreload=1 then if var.reload3=0 then ppjoy3.Analog0 = maprange(var.pointerx3,var.xmin3,var.xmax3,-1,1) ppjoy3.analog1 =maprange(var.pointery3,var.ymin3,var.ymax3,-1,1) end if else ppjoy3.Analog0 = maprange(var.pointerx3,var.xmin3,var.xmax3,-1,1) ppjoy3.analog1 =maprange(var.pointery3,var.ymin3,var.ymax3,-1,1) end if if nunchuck3.Exists=0 then ppjoy3.Digital0=wiimote3.b if var.shake=1 and var.offscreenreload=1 then var.reload3=wiimote3.a or wiimote3.shake else var.reload=wiimote3.a end if else ppjoy3.digital0=wiimote3.b or nunchuck3.C if var.nshake=1 then if var.shake=1 then var.reload3=wiimote3.a or wiimote3.shake or nunchuck3.Z or wiimote3.Nunchuk.Shake else var.reload3=wiimote3.a or nunchuck3.Z or wiimote3.Nunchuk.Shake end if else if var.shake=1 and var.offscreenload=1 then var.reload3=wiimote3.a or wiimote3.shake or nunchuck3.Z else var.reload3=wiimote3.a or nunchuck3.Z end if end if end if if var.offscreenreload=1 then if var.reload3=1 then ppjoy3.Analog0=-1 ppjoy3.Analog1=-1 ppjoy3.Digital0=1 wait 10ms ppjoy3.digital0=0 end if else ppjoy3.digital1=var.reload3 end if ppjoy3.digital2 = wiimote3.one ppjoy3.digital3 = wiimote3.two ppjoy3.digital4=wiimote3.minus ppjoy3.digital5=wiimote3.plus ppjoy3.digital6=wiimote3.home end if else if var.calibrate=0 then fakecursor3.visible=0 end if '-------------------------------------------------------------------------- 'Player 4 if var.calibrate=0 and wiimote4.exists = true then var.pointerx4=wiimote4.pointerx var.pointery4=wiimote4.pointery if var.MAME=0 then if fakecursor4.visible=0 then fakecursor4.visible=1 fakecursor4.x = maprange(var.pointerx4,var.xmin4,var.xmax4,0,1) fakecursor4.y =maprange(var.pointery4,var.ymin4,var.ymax4,0,1) else if fakecursor4.visible=1 then fakecursor4.visible=0 if var.offscreenreload=1 then if var.reload4=0 then ppjoy4.Analog0 = maprange(var.pointerx4,var.xmin4,var.xmax4,-1,1) ppjoy4.analog1 =maprange(var.pointery4,var.ymin4,var.ymax4,-1,1) end if else ppjoy4.Analog0 = maprange(var.pointerx4,var.xmin4,var.xmax4,-1,1) ppjoy4.analog1 =maprange(var.pointery4,var.ymin4,var.ymax4,-1,1) end if if nunchuck4.Exists=0 then ppjoy4.Digital0=wiimote4.b if var.shake=1 and var.offscreenreload=1 then var.reload4=wiimote4.a or wiimote4.shake else var.reload=wiimote4.a end if else ppjoy4.digital0=wiimote4.b or nunchuck4.C if var.nshake=1 then if var.shake=1 then var.reload4=wiimote4.a or wiimote4.shake or nunchuck4.Z or wiimote4.Nunchuk.Shake else var.reload4=wiimote4.a or nunchuck4.Z or wiimote4.Nunchuk.Shake end if else if var.shake=1 and var.offscreenload=1 then var.reload4=wiimote4.a or wiimote4.shake or nunchuck4.Z else var.reload4=wiimote4.a or nunchuck4.Z end if end if end if if var.offscreenreload=1 then if var.reload4=1 then ppjoy4.Analog0=-1 ppjoy4.Analog1=-1 ppjoy4.Digital0=1 wait 10ms ppjoy4.digital0=0 end if else ppjoy4.digital1=var.reload4 end if ppjoy4.digital2 = wiimote4.one ppjoy4.digital3 = wiimote4.two ppjoy4.digital4=wiimote4.minus ppjoy4.digital5=wiimote4.plus ppjoy4.digital6=wiimote4.home end if else if var.calibrate=0 then fakecursor4.visible=0 end if '-------------------------------------------------------------------------- 'Click Functions, For changing modes 'Player 1 '-------------------------------------------------- if SingleClicked(wiimote1.up) then if var.calibrate =0 or var.calibrate =1 then if var.calibrate=1 then var.calibrate=0 else var.calibrate=1 var.cmode=1 fakecursor5.visible=1 say "Shoot the Upper Left Corner" end if end if end if if SingleClicked(wiimote1.down) then var.xmin=0 var.ymin=0 var.xmax=1 var.ymax=1 var.xmid=.5 var.ymid=.5 say "Player One Calibration Reset" execute("wtp.exe"," -script=MAMEWiiGun.pie -xmin="+var.xmin+" -ymin="+var.ymin+" -xmax="+var.xmax+" -ymax="+var.ymax) end if 'NOTE: Changing reload modes is exclusive to P1, all guns follow suit. if SingleClicked(wiimote1.left) then if var.offscreenreload=0 then var.offscreenreload=1 say "Off Screen Reload Enabled" else var.offscreenreload=0 say "Off Screen Reload Disabled" end if execute("wtp.exe"," -script=MAMEWiiGun.pie -offscreenreload="+var.offscreenreload) end if '------------------------------------------------- 'Player 2 '------------------------------------------------- if SingleClicked(wiimote2.up) then if var.calibrate =0 or var.calibrate=2 then if var.calibrate=2 then var.calibrate=0 else var.calibrate=2 var.cmode=1 fakecursor5.visible=1 say "Shoot the Upper Left Corner" end if end if end if if SingleClicked(wiimote2.down) then var.xmin2=0 var.ymin2=0 var.xmax2=1 var.ymax2=1 var.xmid2=.5 var.ymid2=.5 say "Player Two Calibration Reset" execute("wtp.exe"," -script=MAMEWiiGun.pie -xmin2="+var.xmin2+" -ymin2="+var.ymin2+" -xmax2="+var.xmax2+" -ymax2="+var.ymax2) end if '------------------------------------------------------ 'Player 3 '------------------------------------------------- if SingleClicked(wiimote3.up) then if var.calibrate =0 or var.calibrate=3 then if var.calibrate=3 then var.calibrate=0 else var.calibrate=3 var.cmode=1 fakecursor5.visible=1 say "Shoot the Upper Left Corner" end if end if end if if SingleClicked(wiimote3.down) then var.xmin3=0 var.ymin3=0 var.xmax3=1 var.ymax3=1 var.xmid3=.5 var.ymid3=.5 say "Player Three Calibration Reset" execute("wtp.exe"," -script=MAMEWiiGun.pie -xmin3="+var.xmin3+" -ymin3="+var.ymin3+" -xmax3="+var.xmax3+" -ymax3="+var.ymax3) end if '------------------------------------------------------ 'Player 4 '------------------------------------------------- if SingleClicked(wiimote4.up) then if var.calibrate =0 or var.calibrate=4 then if var.calibrate=4 then var.calibrate=0 else var.calibrate=4 var.cmode=1 fakecursor5.visible=1 say "Shoot the Upper Left Corner" end if end if end if if SingleClicked(wiimote4.down) then var.xmin4=0 var.ymin4=0 var.xmax4=1 var.ymax4=1 var.xmid4=.5 var.ymid4=.5 say "Player Four Calibration Reset" execute("wtp.exe"," -script=MAMEWiiGun.pie -xmin4="+var.xmin4+" -ymin4="+var.ymin4+" -xmax4="+var.xmax4+" -ymax4="+var.ymax4) end if '------------------------------------------------------ 'Calibration Funtion 'It is annoyingly complex. :-( if var.calibrate>0 then if var.blink=1 then wait 100ms var.blink=0 var.wobble=1 var.wobblec=0 else wait 100ms var.blink=1 var.wobble=.987 var.wobblec=-.023 end if if var.cmode=1 then if var.calibrate=1 then ppjoy1.analog0 =-1 *var.wobble ppjoy1.analog1=-1*var.wobble var.xmin=wiimote1.pointerx var.ymin=wiimote1.pointery end if if var.calibrate=2 then ppjoy2.analog0 =-1 *var.wobble ppjoy2.analog1=-1*var.wobble var.xmin2=wiimote2.pointerx var.ymin2=wiimote2.pointery end if if var.calibrate=3 then ppjoy3.analog0 =-1 *var.wobble ppjoy3.analog1=-1*var.wobble var.xmin3=wiimote3.pointerx var.ymin3=wiimote3.pointery end if if var.calibrate=4 then ppjoy4.analog0 =-1 *var.wobble ppjoy4.analog1=-1*var.wobble var.xmin4=wiimote4.pointerx var.ymin4=wiimote4.pointery end if fakecursor5.x =0.005 fakecursor5.y=0.02 fakecursor5.image="UL.ico" fakecursor5.caption ="Shoot The Corner!" end if if var.cmode=2 then if var.calibrate=1 then ppjoy1.Analog0=1*var.wobble ppjoy1.analog1=1 *var.wobble var.xmax=wiimote1.pointerx var.ymax=wiimote1.pointery end if if var.calibrate=2 then ppjoy2.Analog0=1*var.wobble ppjoy2.analog1=1 *var.wobble var.xmax2=wiimote2.pointerx var.ymax2=wiimote2.pointery end if if var.calibrate=3 then ppjoy3.Analog0=1*var.wobble ppjoy3.analog1=1 *var.wobble var.xmax3=wiimote3.pointerx var.ymax3=wiimote3.pointery end if if var.calibrate=4 then ppjoy4.Analog0=1*var.wobble ppjoy4.analog1=1 *var.wobble var.xmax4=wiimote4.pointerx var.ymax4=wiimote4.pointery end if fakecursor5.x =.98 fakecursor5.y=.98 fakecursor5.image="LR.ico" fakecursor5.caption ="Shoot The Corner!" end if if var.blink=1 then if var.calibrate=1 then fakecursor5.colour=[0,0,1] else fakecursor5.colour=[1,0,0] end if else if var.calibrate=1 then fakecursor5.colour=[0,1,1] else fakecursor5.colour=[1,1,0] end if end if if (SingleClicked(wiimote1.b)and var.calibrate=1) or (singleclicked(wiimote2. and var.calibrate=2) or (singleclicked(wiimote3. and var.calibrate=3) or (singleclicked(wiimote4. and var.calibrate=4) then var.sf=var.sf*2 var.cmode=var.cmode+1 if var.cmode>2 then var.cmode=0 say "Calibration Complete!" fakecursor5.visible=0 if var.calibrate=1 then execute("wtp.exe"," -script=MAMEWiiGun.pie -xmin="+var.xmin+" -ymin="+var.ymin+" -xmax="+var.xmax+" -ymax="+var.ymax) end if if var.calibrate=2 then execute("wtp.exe"," -script=MAMEWiiGun.pie -xmin2="+var.xmin2+" -ymin2="+var.ymin2+" -xmax2="+var.xmax2+" -ymax2="+var.ymax2) end if if var.calibrate=3 then execute("wtp.exe"," -script=MAMEWiiGun.pie -xmin3="+var.xmin3+" -ymin3="+var.ymin3+" -xmax3="+var.xmax3+" -ymax3="+var.ymax3) end if if var.calibrate=4 then execute("wtp.exe"," -script=MAMEWiiGun.pie -xmin4="+var.xmin4+" -ymin4="+var.ymin4+" -xmax4="+var.xmax4+" -ymax4="+var.ymax4) end if var.calibrate=0 end if if var.cmode=2 then say "Shoot the Lower Right Corner" end if end if end if
Recommended Posts
Archived
This topic is now archived and is closed to further replies.