Absolute mouse coordinates
Moderators: Mug UK, Zorro 2, spiny, Greenious, Sorgelig, Moderator Team
Re: Absolute mouse coordinates
Dolphinbar in mode 1 has mouse cursor freeze and short time upon press A/B. Probably for better mouse handling. So it's not good for lightgun emulation. Mode 2 has no such freezes but A/B buttons are swapped, so NES core need update to react on both mouse buttons as a trigger.
Re: Absolute mouse coordinates
Only for Windows!Locutus73 wrote:Mode 4 is intended for Dolphin emulator use, so we can find some code here https://github.com/dolphin-emu/dolphin
In Linux, mode 4 is not supported what i found so far.
Re: Absolute mouse coordinates
besides the IR pointer wiimote can be used as traditional gamepad. Together with nunchuck or classic controller it's pretty much normal gamepad. In Native mode you can use several wiimotes. Can it be use as 2 lightguns - it's up to the core.Locutus73 wrote:By the way, what would be the use of more than one wiimote? Two player lightgun games?
btw, there is 3rd party adapters for wiimote to connect Gamecube gamepad, and even there is adaptor for DB9! So it's a good opportunity to make a wireless retro joystick

Re: Absolute mouse coordinates
Yeah you’re right, I even defined gamepad maps for main MiSTer and NES both for cwiid and Dolphinbar... it’s just I’m used to think to the Wiimote basically as a lightgun and using other controllers otherwise. The Wiimote (with no accessories) can be also successfully used as a two button NES controller when held horizontally.Sorgelig wrote:besides the IR pointer wiimote can be used as traditional gamepad. Together with nunchuck or classic controller it's pretty much normal gamepad. In Native mode you can use several wiimotes. Can it be use as 2 lightguns - it's up to the core.
I suspect the Wiimote can be used for Nintendo Mini Classic Controllers too, so having good NES/SNES joypad replica with the added benefit of wireless and additional buttons (i.e. menu button) on the Wiimote.
Yup, I have a pair of them, bought back then along the Dolphinbar for using OG GameCube controllers with Dolphin Emulator... actually never used themSorgelig wrote:btw, there is 3rd party adapters for wiimote to connect Gamecube gamepad, and even there is adaptor for DB9! So it's a good opportunity to make a wireless retro joystick

Regards.
Locutus73
Re: Absolute mouse coordinates
This is correct, the NES and SNES Classic Controllers work perfectly with the Wiimote.Locutus73 wrote: I suspect the Wiimote can be used for Nintendo Mini Classic Controllers too, so having good NES/SNES joypad replica with the added benefit of wireless and additional buttons (i.e. menu button) on the Wiimote.
I am currently using both of these controllers with the MiSTer via a Raphnet USB adapter, but it would be cool to have the option to use them wirelessly through the Wiimote as well (and the extra buttons would definitely be nice for menu, etc.)
Re: Absolute mouse coordinates
After study the Dolphin emulator code, it definitely should work with mode 4 in Linux. But it's done through very awkward way. So Dolphis has the whole driver code which uses Wiimote in a low level mode using reports.
Since native support works fine now, i'm not interesting in adding low level dolphinbar code support myself. If some one is willing to do it, then i would be glad to integrate.
I think it's better to write a special app which will work similar to wminput as a user-space input driver. So this app will push the input events to uinput and then MiSTer will work with it as with traditional input device.
Since native support works fine now, i'm not interesting in adding low level dolphinbar code support myself. If some one is willing to do it, then i would be glad to integrate.
I think it's better to write a special app which will work similar to wminput as a user-space input driver. So this app will push the input events to uinput and then MiSTer will work with it as with traditional input device.
Re: Absolute mouse coordinates
@sorgelig
Just tested the new Wiimote implementation and it's sweet: the IR pointer is smooth (as with cwiid, much better than Dolphinbar) and the IR doesn't interfere with the joypad wizard anymore.
Just sweet.
I love the new joypad wizard layout too, much more understandable!
Thank you very much
Locutus73
Just tested the new Wiimote implementation and it's sweet: the IR pointer is smooth (as with cwiid, much better than Dolphinbar) and the IR doesn't interfere with the joypad wizard anymore.
Just sweet.
I love the new joypad wizard layout too, much more understandable!

Thank you very much
Locutus73
Re: Absolute mouse coordinates
The new integrated wiimote support is very good. Thank you for this.
Re: Absolute mouse coordinates
@sorgelig Nice job with SNES light gun. With your custom wiimote module, would it be hard to make a small calibration routine so it could be set up for true LoS targeting? Then it would be just like a real lightgun.
Re: Absolute mouse coordinates
I didn't find the info about calibrating the Wiimote. If you point me to such info, then i will tell you how hard it to implement. On the Wii i even can define the position of bar top/bottom. In Linux driver there is no such option.kitrinx wrote:@sorgelig Nice job with SNES light gun. With your custom wiimote module, would it be hard to make a small calibration routine so it could be set up for true LoS targeting? Then it would be just like a real lightgun.
P.S.: if you are talking about calibrating inside the SNES to match the wiimote cross with in-game target, then all games i've tried have calibration screen where you can do this. Some games have hidden calibration screen opened by specific button press. For example in "T2: Arcade game" you have to hold the cursor button and press the fire on the title screen.
My lightgun module gives only 1-2 pixel shifts horizontally between visible cross and real latched values. Thus from HW point of view wiimote is more precise than original Super Scope. It's just games have random calibrated point, so you need to use in-game calibration which is the part of standard usage scenario of SuperScope.
Re: Absolute mouse coordinates
I plan to add no-cursor mode. So in games providing the cursor you will be able to use without calibration.
Re: Absolute mouse coordinates
To the best of my knowledge, there's no internal method for doing this. The way the wii does it, and I assume most other things that use the wiimote, is they apply an offset to the input based on user feedback. For example:Sorgelig wrote: I didn't find the info about calibrating the Wiimote. If you point me to such info, then i will tell you how hard it to implement. On the Wii i even can define the position of bar top/bottom. In Linux driver there is no such option.
If you display a target on the screen, and tell the user to shoot that target (without providing crosshairs) then X/Y that is read when they pull the trigger can be associated with a real position on the screen. Doing this sequentially for 3 or 4 targets in the corners can let you easily calculate offsets to apply to raw input to make it line up with real positions on the screen. Since the TV doesn't really change the area that it draws in much, and we use scaled joystick input for the cores, you can make it very close to real LoS this way.
Re: Absolute mouse coordinates
This is just to match the physical position of wiimote in hand with screen coordinates. It won't help to match SNES game target with wiimote target (as different SNES games treat SS coordinates differently). So if you are just looking to natch red cross with in-game cross, then simply use in-game calibration - it will do the job.kitrinx wrote:To the best of my knowledge, there's no internal method for doing this. The way the wii does it, and I assume most other things that use the wiimote, is they apply an offset to the input based on user feedback. For example:
If you display a target on the screen, and tell the user to shoot that target (without providing crosshairs) then X/Y that is read when they pull the trigger can be associated with a real position on the screen. Doing this sequentially for 3 or 4 targets in the corners can let you easily calculate offsets to apply to raw input to make it line up with real positions on the screen. Since the TV doesn't really change the area that it draws in much, and we use scaled joystick input for the cores, you can make it very close to real LoS this way.
Actually for precise physical calibration it should be done on HPS side, where selected window will be cut from the whole range of wiimote coordinates leaving some outside gap for calibration, so core will get a clean calibrated coordinates. I think it must be done in either special calibration core, or in Menu core.
Still wiimote needs one important setting - bar top/bottom position, as even Wii requires this setting. It's something probably not implemented in current driver. Probably some code can be found in Dolphin emulator.
Re: Absolute mouse coordinates
Top/bottom or screen calibration, we are basically talking about the same thing. Just making so that where you point the wiimote lines up with what is on the screen. It is relevant for all lightgun cores. It is definitely an HPS side thing. I think for the most part it is just an offset. Since the coordinates are absolute, if the bar is on the top, you just add a constant number to lower it.if you know the right and left offsets, you can add constants there too to make the range line up with a 4:3 screen. You can find the offsets by making the user aim at what they feel is a corner, or the center. Lets say the upper left is coordinate 0,0. If you put a target there, and the user shoots, and the wiimote reads 0, 15, you know you need the offset of -15 to make it line up with the screen. You can also map out the range of what the user feels is the right and left sides of the screen and adjust the range to of the analog stick to match this too. See what I am suggesting?Sorgelig wrote: This is just to match the physical position of wiimote in hand with screen coordinates. It won't help to match SNES game target with wiimote target (as different SNES games treat SS coordinates differently). So if you are just looking to natch red cross with in-game cross, then simply use in-game calibration - it will do the job.
Actually for precise physical calibration it should be done on HPS side, where selected window will be cut from the whole range of wiimote coordinates leaving some outside gap for calibration, so core will get a clean calibrated coordinates. I think it must be done in either special calibration core, or in Menu core.
Still wiimote needs one important setting - bar top/bottom position, as even Wii requires this setting. It's something probably not implemented in current driver. Probably some code can be found in Dolphin emulator.
SNES calibration is a bit different and is timing related I think, since the original super scope was extremely timing sensitive.
Re: Absolute mouse coordinates
On Wii there are 2 independent settings: bar position and calibration.
So, it's not just offsets. Offset from up to down is pretty large so using just offset will make the range is too narrow and basically you cannot reach the other side of screen if bar position is wrong (unless your monitor is tiny).
So bar position option must be implemented in the driver anyway.
Sure i know how to calibrate. I have 30+ years of programming experience
May be some day i will add calibration. Currently i don't really care how i keep my wiimote - i just follow the cross mark
So, it's not just offsets. Offset from up to down is pretty large so using just offset will make the range is too narrow and basically you cannot reach the other side of screen if bar position is wrong (unless your monitor is tiny).
So bar position option must be implemented in the driver anyway.
Sure i know how to calibrate. I have 30+ years of programming experience

May be some day i will add calibration. Currently i don't really care how i keep my wiimote - i just follow the cross mark

Re: Absolute mouse coordinates
What are the recommended settings for the wiimote? I mapped it to Joy1 and set the NES core to use Joy1 for the zapper. The cursor moves but I don't seem to be able to use the trigger.
Do I need to map the trigger to a mouse button? Or is it independent from the gamepad settings? I feel like I'm almost there. And in general is "mouse" more accurate than using one of the Joy1/2 options?
Do I need to map the trigger to a mouse button? Or is it independent from the gamepad settings? I feel like I'm almost there. And in general is "mouse" more accurate than using one of the Joy1/2 options?
Re: Absolute mouse coordinates
For NES core there is a special mp for Trigger button. It's going after PowerPad 12 buttons. Pretty much hidden, but it's there 

Re: Absolute mouse coordinates
I just saw something interesting here https://github.com/MiSTer-devel/Main_Mi ... a3597f0439
Regards.
Locutus73

Regards.
Locutus73
Re: Absolute mouse coordinates
For Aimtrak gun users, I have good news. I tested out an Aimtrak today and it works nicely with MiSTer. Setting up the controller is a little hard, so I attached the controller setup. You can use it as a joystick, with the trigger as a mouse button. By default, if you hold the trigger for five seconds the gun will go into calibration mode, and it works well with MiSTer, at least while in the NES core. It moves the cursor around and you shoot at it. After this the gun will be line of sight. I had to turn the IR gain down using the configuration app in windows, but it seems to save the setting to the device, that reduced the jitter.
You do not have the required permissions to view the files attached to this post.
Re: Absolute mouse coordinates
@sorgeligkitrinx wrote:For Aimtrak gun users, I have good news. I tested out an Aimtrak today and it works nicely with MiSTer. Setting up the controller is a little hard, so I attached the controller setup.
Attaching some MiSTer event logs here would be it possible to automatically assign the Aimtrak IR to the analog stick mapping as you already do for the wiimote, making the configuration wizard a breeze (or not needed at all for basic usage)?
Regards.
Locutus73
Re: Absolute mouse coordinates
Is this what you need?Sorgelig wrote:yes, i can do it
Code: Select all
Input event: type=EV_ABS, Axis=0, Offset=3370, jnum=2, ID:d209:1601:04, abs_min = 0, abs_max = 4095
Combined mouse event: btn=0x18, dx=-36, dy=0, scroll=0
PS2 MOUSE: 18 252 0
Input event: type=EV_ABS, Axis=0, Offset=3238, jnum=2, ID:d209:1601:04, abs_min = 0, abs_max = 4095
Combined mouse event: btn=0x18, dx=-33, dy=0, scroll=0
Input event: type=EV_ABS, Axis=0, Offset=3105, jnum=2, ID:d209:1601:04, abs_min = 0, abs_max = 4095
Combined mouse event: btn=0x38, dx=-33, dy=-44, scroll=0
Input event: type=EV_ABS, Axis=1, Offset=235, jnum=2, ID:d209:1601:04, abs_min = 0, abs_max = 4095
PS2 MOUSE: 38 250 252
Input event: type=EV_ABS, Axis=0, Offset=2986, jnum=2, ID:d209:1601:04, abs_min = 0, abs_max = 4095
PS2 code(break)(ext) for core: 116(0x74)
Combined mouse event: btn=0x38, dx=-30, dy=-49, scroll=0
Input event: type=EV_ABS, Axis=1, Offset=499, jnum=2, ID:d209:1601:04, abs_min = 0, abs_max = 4095
Input event: type=EV_ABS, Axis=0, Offset=2866, jnum=2, ID:d209:1601:04, abs_min = 0, abs_max = 4095
Combined mouse event: btn=0x38, dx=-30, dy=-49, scroll=0
Input event: type=EV_ABS, Axis=1, Offset=762, jnum=2, ID:d209:1601:04, abs_min = 0, abs_max = 4095
PS2 MOUSE: 38 250 247
Re: Absolute mouse coordinates
yes.kitrinx wrote:Is this what you need?
Also log when input devices are opened, so i will see all devices of this gun.
Re: Absolute mouse coordinates
Sorgelig wrote:yes.kitrinx wrote:Is this what you need?
Also log when input devices are opened, so i will see all devices of this gun.
Code: Select all
Close all devices.
Open up to 20 input devices.
open(/dev/input/event2): 13
open(/dev/input/event1): 14
open(/dev/input/event0): 15
has LEDs.
open(/dev/input/event17): 16
open(/dev/input/event16): 17
open(/dev/input/event8): 18
open(/dev/input/event6): 19
opened 0( 0): /dev/input/event2 (d209:1601) 0 "9" "Ultimarc Ultimarc"
opened 1( 0): /dev/input/event1 (d209:1601) 0 "9" "Ultimarc Ultimarc"
opened 2( 0): /dev/input/event0 (d209:1601) 0 "9" "Ultimarc Ultimarc"
opened 3( 3): /dev/input/event17 (16d0:0d04) 0 "1000" "BLISS-BOX 4-PLAY PORT.1"
opened 4( 3): /dev/input/event16 (16d0:0d04) 0 "1000" "BLISS-BOX 4-PLAY/GP PO1"
opened 5( 5): /dev/input/event8 (054c:05c4) 4 "00:00:00:00:00:00" "Sony Computer Entertainment Wireless Controller"
opened 6( 5): /dev/input/event6 (054c:05c4) 5 "00:00:00:00:00:00" "Sony Computer Entertainment Wireless Controller Touchpad"
Re: Absolute mouse coordinates
how about the buttons? Do they come from the same eventX or different?
It's better to give me log where present:
1) opening the input devices
2) pointer move in both X and Y
3) press sequentially all available buttons.
This should be the single log so i can match the devices.
It's interesting what "9" in device name means. Is there any info why it present 3 input devices? Do you connect only single gun?
It's better to give me log where present:
1) opening the input devices
2) pointer move in both X and Y
3) press sequentially all available buttons.
This should be the single log so i can match the devices.
It's interesting what "9" in device name means. Is there any info why it present 3 input devices? Do you connect only single gun?