[3DS][Tutorial] GlovePie Script "Majoras Mask 3D" Full Wiimote Controls + IR TouchScreen Control + Stream to TV with [Kit-kat & Input Redirecton]


Demo Video: If you don't feel like reading my ramblings: 
Full Majora's Mask 3D GlovePie Script is at the Bottom of the Post!

 If you can Improve on the Script please do! I am a GlovePie NOOB!



With the recent release of the Flagship Switch Title "Zelda: Breath of the Wild" and me currently needing money to purchase the WiiU version + a Capture card to Record it - I decided to break into two of my favourite Zelda games;


TWILIGHT PRINCESS & MAJORA'S MASK 



After remembering you swing the Wiimote, in "Twilight Princess", (to make Link swing the Sword) I was hit with memories of watching someone on Youtube, use an N64 Emulator, to play "Ocarina of Time" with Wiimote Controls and a wireless Sensor bar on their PC

See that Video from 2007 here:



This lead me on a 5 day journey of trying to figure out how to;

-Use [GlovePie.exe] to Map the Wiimote + Nunchuk Buttons + Movements

-Use those Buttons + Movements to Match Keyboard to 3DS input for [InputRedirection.exe]

Then I would fully Wifi Control my 3DS (except for c-stick functionality) with the Wiimote.


Since "Ocarina of Time 3DS" doesn't currently have a Patch to allow InputRedirect to Function after it kicks off the Wifi on your 3DS -then I quickly settled on using "Majora's Mask 3D




My Project Goals

I wanted to maintain near-perfect Functionality/Play-ability of the game but also Implement these key points;

- Wirelessly Stream Video + Audio to TV = (PC + HDMIout + TV)

- Twilight Princess Wiimote Controlled "Sword Slash" + "Spin Charge"


- Skyward Sword Nunchuk "Roll"


- Wiimote gyroscopic motion "Aiming" (For Bow/Deku Bubbles/Zora Fins)


- Wiimote Emulating my Mouse + Left Click on my PC *only* when pointing at the screen So I can click the Touchscreen and without reaching to use the Real Touchscreen


That last one took along time to figure out but I was struck with the idea when I realized 
[InputRedirectionClient.exe] accepts Mouse Clicks as touchpad input.





Controlling the Touchscreen with PC Mouse Clicks

I noticed that by having [InputRedirectionClient.exe] open when streaming next to [NTRviewer.exe] on Bottom Screen Size [1], that they were identical sizes.

So I used a program called [PeekThrough.exe] to make [Kit-kat.exe] 90% Transparent.
I then hovered it on top of [NTRviewer.exe]





I clicked the Touchpad Area with my Mouse. I got a Response and a folder opened up on my 3DS

It turns out the size being similar wasn't a coincidence and the mouse inputs on [InputRedirection.exe] correspond perfectly with the Touchscreen on the 3DS.

 I now had my 3DS Streaming through Kit Kat to my TV ,
Audio coming out the TV Speakers & The Touchpad could now be flawlessly controlled by Mouse clicks.

Checkout how to setup [Kit-kat.exe] and [InputRedirection.exe] for;
- Wireless Video Streaming to PC
- Audio output to PC
- Controller/Keyboard Wifi Input to Control 3DS
Here:




Only issue now is;

- Getting the Wiimote to work with [GlovePie.exe] so it Emulates my Mouse on Screen VIA Infared Sensor of the Wiimote.

Which will allow me to Control the Touchscreen by "clicking" with my Wiimote
(which meant tons of Trial and Error)





Getting the Wiimote to be an "Infared Mouse"


There were a lot of [Glovepie] Scripts out there already for n64 games, but not as many as I thought there would be or even of the quality I thought they would be.

I did stumble upon a "Wiimote to Mouse Pointer" Script and studied it a bit. 

I Connected my Wiimote to my PC Bluetooth by pressing the Red Sync Button under the battery cover and clicking Pair with NO PASSCODE on my PC.








I Downloaded and Opened up [GlovePIE.exe], I entered the IR Mouse Pointer Script in and turned on my Wii so the Sensor Bar would have power under my TV.

I Clicked > Run and nothing happened

It turns out I have to Click [Run > Stop > Run] every time.

This all looked like Chinese to me at first!
I Pointed the Wiimote at my TV screen and....

-MY MOUSE WAS NOW MOVING ON THE SCREEN WITH INFRARED CONTROLS

I was now able to click the "Virtual Touchscreen" by pointing the Wiimote at [NTRViewer] on my TV Screen! 

I modified the script a bit and left out any unnecessary things;
Mouse Script

// = Not used/Notes.

// Led 1&4 should be on when everything is working
Wiimote.Led1 = true
Wiimote.Led4 = true

// Ignore cursor movement caused by clicking a button
var.ButtonFreezeTime = 250ms
var.PointerBump = KeepDown(Pressed(wiimote.A),var.ButtonFreezeTime) or KeepDown(Pressed(wiimote.B),var.ButtonFreezeTime)

// Mouse movement
if wiimote.PointerVisible but not var.PointerBump then
  mouse.x = wiimote.PointerX
  mouse.y = wiimote.PointerY
end if

// Mouse Buttons
mouse.LeftButton = Wiimote.A and KeepDown(Wiimote.PointerVisible,0.5s)


- essentially leaving me with an IR Wiimote Mouse Pointer that had (A) Button as Left Click (only when pointing onscreen)




Mapping the Wiimote Buttons to Keyboard

To make this universal to All InputRedirection Clients I left the Keyboard settings on Default.

I took a Screen shot of the Default Settings,
then decided how to map the Wiimote buttons, so Link does all In-game needed things.

(This doesn't include the gyroscopic Wiimote Motion control yet. It will eventually be Routed to the CPad, more on that soon)



Now I needed to make [GlovePIE] recognize these Wiimote Button presses as the equivalent Keyboard Strokes, essentially giving me access to all the 3DS controls over wifi with;
[Wiimote + GlovePie + InputRedirection]


Script For Wiimote+Nunchuk to Keyboard/3DS Button Mapping:
// = Not used/Notes.
//Erase to activate line.

// Nunchuk Controls - Link Walking
left = (-1.2 < wiimote.Nunchuk.JoyX < -0.5)
right = (0.5 < wiimote.Nunchuk.JoyX < 1.2)
up = (-1.2 < wiimote.Nunchuk.JoyY < -0.5)
down = (0.5 < wiimote.Nunchuk.JoyY < 1.2)

//Shield + L-Targeting
Q = wiimote.nunchuk.zbutton
W = wiimote.nunchuk.cbutton

//Wiimote Buttons
S = wiimote.B
A = Wiimote.A
M = wiimote.Plus
// = wiimote.two
// = Wiimote.one
// = wiimote.Home
Z = Wiimote.Up
X = Wiimote.Left
H = Wiimote.Right
G = Wiimote.Down

//Twilight Princess Sword Swing 
//Skyward Sword Nunchuk Roll
S = (wiimote.RawForceX >= 15)
A = (wiimote.nunchuk.RawForceX >= 15)

The Command Line RawForce is exactly that, raw force acceleration of the Wiimote/nunchuk.
We can register this to a button essentially giving us the Swinging Sword we wanted + Nunchuk Roll.

This line also gives us Sword Spin Charge Attack by Swinging & Holding the Wiimote back,

The number is the amount of Force Registered. I don't know the exact parameters of it but my guess is if rawforce equal to 15 is applied to the Wiimote, then the movement will register as the
(B) Button and Link will swing his sword.




Debugging the Wiimote Gyroscope AIMING CONTROLS w/ Minish Cap and VBA 

-Basically Trying to use the Wiimote like a Lightgun to Control Aiming by routing motion movements to the CPad.

After having tons of annoying problems with the motion controlling, not really clicking in my mind, I needed some sort of ability to change [GlovePie.exe] Settings on the fly and see how it effected the Controls.

Turned out to be a lot easier then I thought

I fired up Virtual Boy Advance and loaded up "Zelda Minish Cap"
I used Link's room at the beginning of the game to debug the Wiimote and successfully map the Accelerometer of the Wiimote to the Cpad by making Link do laps around his room.


But I had one new problem, I couldn't have the normal movement of the Wiimote in my hand, causing Link to run around -absent of any Control Stick input.

So since the movements are mapped to the CPad, which Aims & Walks, (depending what's on screen) 
-then I need a way to activate the Gyroscope by some sort of Button command.


I settled on using the Unassigned Wiimote.Minus Button


So when holding down the Wiimote.Minus button the Gyroscope Motion Aiming is Activated & the Infrared Mouse Controls are Disabled

//Disable Mouse by Holding Wiimote(-)
if wiimote.Plus then
  mouse.x = false
  mouse.y = false
  mouse.LeftButton = false
end if

//Wiimote Motion Aiming Controls - Hold Wiimote (-) Button To Active
//Change the Degree values to get more exact controls 
//Link looks Up Easily compared to Other movements, that's why its set at 30

left = Wiimote.smoothroll < -5 degrees and Wiimote.Minus
right = Wiimote.smoothroll > 5 degrees and Wiimote.Minus

up = Wiimote.smoothPitch > 30 degrees and Wiimote.Minus

down = Wiimote.smoothPitch < 5 degrees and Wiimote.Minus



This Essentially Finished our [GlovePie.exe] Script and I was left to Testing out the New Wiimote Skyward Sword + Twilight Princess Controls + New IR [NTRviewer.exe] Touchscreen.

Checkout the Demo video here:




"Majoras Mask 3D" Glove Pie Script


- Twilight Princess Sword Swing

- Skyward Sword Roll Controls

-Wiimote Aiming

-Working IR Sensor Touchscreen (when you pair NTRViewer+InputRedirect+PeekThrough)

+ Download Links to All the Programs you Need Below!

//Majora's Mask 3D Wiimote Controls (Twilight Princess Sword Swing + Skyward Sword Nunchuck Roll)

// Led 1&4 should be on when everything is working
Wiimote.Led1 = true
Wiimote.Led4 = true

// Ignore cursor movement caused by clicking a button
var.ButtonFreezeTime = 250ms
var.PointerBump = KeepDown(Pressed(wiimote.A),var.ButtonFreezeTime)
// Mouse movement
if wiimote.PointerVisible but not var.PointerBump then
mouse.x = wiimote.PointerX
mouse.y = wiimote.PointerY
end if

// Mouse Buttons
mouse.LeftButton = Wiimote.A and KeepDown(Wiimote.PointerVisible,0.5s)
// Nunchuk Controls - Link Walking
left = (-1.2 < wiimote.Nunchuk.JoyX < -0.5)
right = (0.5 < wiimote.Nunchuk.JoyX < 1.2)
up = (-1.2 < wiimote.Nunchuk.JoyY < -0.5)
down = (0.5 < wiimote.Nunchuk.JoyY < 1.2)

//Shield + L-Targeting
Q = wiimote.nunchuk.zbutton
W = wiimote.nunchuk.cbutton

//Wiimote Buttons
S = wiimote.B
A = Wiimote.A
M = wiimote.Plus
// = wiimote.two
// = Wiimote.one
// = wiimote.Home
Z = Wiimote.Up
X = Wiimote.Left
H = Wiimote.Right
G = Wiimote.Down

//Twilight Princess Sword Swing
//Skyward Sword Nunchuk Roll
S = (wiimote.RawForceX >= 15)
A = (wiimote.nunchuk.RawForceX >= 15)

//Disable Mouse by Holding Wiimote(-)
if wiimote.Plus then
mouse.x = false
mouse.y = false
mouse.LeftButton = false
end if
//Wiimote Motion Aiming Controls - Hold Wiimote (-) Button To Active
//Change the Degree values to get more exact controls
//Link looks Up Easier then other movements thats why its set at 30
left = Wiimote.smoothroll < -5 degrees and Wiimote.Minus
right = Wiimote.smoothroll > 5 degrees and Wiimote.Minus
up = Wiimote.smoothPitch > 30 degrees and Wiimote.Minus
down = Wiimote.smoothPitch < 5 degrees and Wiimote.Minus




 ⏬DOWNLOAD THE PC FILES HERE📁⏬


⬇ Direct Download ⬇ 


[NTR_3.4PREVIEW2_STARTER_KIT.zip] (https://github.com/44670/BootNTR/
⬇ Direct Download ⬇ 

[InputRedirectionClientNTR.exe] (https://github.com/Kazo/InputRedirect...)
⬇ Direct Download ⬇

[GlovePie.exe] By Carl Kenner
⬇ Download ⬇ 

[PeekThrough.exe]
⬇ Download ⬇ 




 ⏬DOWNLOAD THE 3DS FILES HERE📁⏬ 
  USE [FBI QR CODE INSTALLER]! 
▶NO REMOVING SD CARD!
▶NO FILE TRANSFERS!

Click [Remote Installer] on FBI
  1. - Go to [Scan Qr Code]
  2. - Scan 
  3. - Install
  4. - Complete


⬇ VIEW FBI QR Code ⬇

[BootNTR Selector.cia]
⬇VIEW FBI QR Code⬇


IF YOU FOUND THIS GUIDE USEFUL THINK ABOUT SUPPORTING THE CHANNEL BY SUBSCRIBING http://youtube.com/c/gameincanada
⏬IF YOU'RE FEELING CRAZY! DONATE TO HELP US GROW! ⏬


Big Thank You to
Carl Kenner for making GlovePIE
Kazo for making InputRedirection
InitPRAGMA for making Kit-Kat
Kunal for Teaching me GlovePIE by basing my Scripts from his!

Comments