SOLVED: mapping the wiimote to the PS4 Share button

Wiimote tutorials, configurations and GPC scripts (FPS like in Nintendo Wii/WiiU).

Moderator: OFC-Giorgio

Re: mapping the wiimote to the PS4 Share button

Postby perfecthuntr » Sat May 30, 2015 6:16 pm

I've edited the code to make it space out a little better so it's easier to read. I've also modified my portion at the bottom. I made it so that PS4_SHARE will be pressed if WII_LEFT and either WII_A or PS4_SQUARE (what WII_A is remapped to) are pressed. If this doesn't work, then you need to start with my code and only my code and add in various portions of your code until you find the conflicting logic.

Code: Select all
//EDITED BY SHEP
//MACRO BY FRASIE WITH EDITS
/*
Changelog

20140917-1
• Removed crouch/prone macro (standard wii C button works fine).
• Use different sensitivity for ADS (aiming down the sights) and non ADS (hip fire) via ADS_SENSITIVITY and NON_ADS_SENSITIVITY parameters
• Led 3 indicates ADS.
• Led 4 indicates wiimote is out of reach of sensorbar and IRX & IRY are set to 0 to prevent spinning around.
• RUMBLE_ENABLED parameter to enable/disable vibrating
• Documented all wii keys (including non nunchuk) and keys for dummy mappings

Script to mimic CUSTOM settings wiimote+nunchuck of the wii(u)
cod games (ghosts, blackops 2, modern warfare 3, black ops, modern warfare reflex and world at war).

From the wiiu manual:
• Z Button – ADS
• C Button – Crouch/Prone
• Control Stick – Move
• Up on the +Control Pad – Jump
• Right on the +Control Pad – Switch Weapon
• Left on the +Control Pad – Inventory
• Down on the +Control Pad – Melee Attack
• A Button – Use/Sprint/Lock Camera
• + Button – Throw Tacticals
• - Button – Throw Lethals
• 1 Button – Objectives/Menu
• 2 Button – Scoreboard
• B Button (underneath controller) – Fire Weapon
• Shake Nunchuk – Reload

Hold Wii-Left and select with Nunchuck stick up, down, left or right (for next-killstreak, previous-killstreak,
use killstreak, switch to rifle grenadelauncher attachment respectively).

Custom settings:
• shake nunchuk / reload is disabled,
• shake wii mote is used for reload and
• - is still used to throw lethals but + while twisting the wiimote is used for throwing tacticals
*/


define ADS_SENSITIVITY     = 30; // a lower value than the standard 50 value means more sensitive
define NON_ADS_SENSITIVITY = 40; // a lower value than the standard 50 value means more sensitive

//define RUMBLE_ENABLED = TRUE; // vibratiing enabled
define RUMBLE_ENABLED = FALSE; // vibrating disabled

define MOVE_LEFT_RIGHT_3STATES         = TRUE;   // stick is only left/neutral/right (horizontal)
//define MOVE_LEFT_RIGHT_3STATES       = FALSE;  // stick is -100% - 100% (horizontal)
define MOVE_FORWARD_BACKWARD_3STATES   = TRUE;   // stick is only up/neutral/down (vertical)
//define MOVE_FORWARD_BACKWARD_3STATES = FALSE;  // stick is -100% - 100% (vertical)

unmap ALL_REMAPS;

remap WII_HOME     -> PS4_PS;       // home menu
remap WII_MINUS    -> PS4_R2;       // LETHAL
remap WII_PLUS     -> PS4_L2;       // NON-lethal grenade
remap WII_ONE      -> PS4_CROSS;    // jump/mantle
remap WII_TWO      -> PS4_CIRCLE;   // crouch/prone
remap WII_A        -> PS4_SQUARE;   // "use/RELOAD" action difference:
// in wii: A:use/sprint   -:reload
// in ps3: square=use/reload and L3=sprint
// for now: assign the wii A button to USE/RELOAD
remap WII_B        -> PS4_R1;       // fire
remap WII_UP       -> PS3_START;    // menu/map
remap WII_DOWN     -> PS4_R3;       // melee
remap WII_RIGHT    -> PS4_TRIANGLE; // switch weapon
remap WII_C        -> PS4_L3;       // SPRINT
remap WII_Z        -> PS4_L1;       // zoom/aiming down the sights (ADS)
remap WII_NX       -> PS4_LX;       // move
remap WII_NY       -> PS4_LY;       // move
remap WII_IRX      -> PS4_RX;       // look
remap WII_IRY      -> PS4_RY;       // look

unmap PS3_ACCX;
unmap PS3_ACCY;
unmap PS3_ACCZ;

// wiimote+nunchuk only buttons:
// WII_ONE/WII_TWO/WII_ACCX/WII_ACCY/WII_ACCZ/WII_ACCNX/WII_ACCNY/WII_ACCNZ/WII_IRX/WII_IRY


//MACRO BY FRASIE WITH EDITS
// (1)
//Macro by Wiimote Fuzzy. Hold Wii-Left and select with Nunchuck stick up, down, left or right.
//phantom buttons choosen by macro or shaking nunchuck
remap WII_X  -> PS3_LEFT// left
remap WII_RX -> PS3_RIGHT; // right
remap WII_Y  -> PS3_UP;    // up
remap WII_RY -> PS3_DOWN// down
//Macro by Wiimote Fuzzy. Hold Wii-Left and select with Nunchuck stick up, down, left or right.

// (2)
// dummy mapping for lethal grenades
//------remap  WII_RT -> PS3_L2;

//MACRO BY FRASIE
init {
    if(!RUMBLE_ENABLED) block_rumble();
}

main {
    // PS3 RXY = Wiimote IRXY by Wiimot3 (Wiimote Fuzzy: adjusted mid point & removed stickize)
    set_val(WII_IRX, inv(get_val(WII_IRX)));
    // PS3 RXY = Wiimote IRXY by Wiimot3 (Wiimote Fuzzy: adjusted mid point & removed stickize)

    // use different sensitivity for ADS (aiming down the sights) and non ADS
    if (get_val(WII_Z)) {
        set_led(LED_3, 1);
        sensitivity(WII_IRX , ADS_SENSITIVITY, 100);
        sensitivity(WII_IRY , ADS_SENSITIVITY, 100);
    }
    else {
        set_led(LED_3, 0);
        sensitivity(WII_IRX , NON_ADS_SENSITIVITY, 100);
        sensitivity(WII_IRY , NON_ADS_SENSITIVITY, 100);
    }

    deadzone(WII_IRX, WII_IRY, DZ_CIRCLE, 30);

    // PS3 LXY = Nunchuck NXY by Wiimot3
    sensitivity(WII_NX , NOT_USE, 150);
    sensitivity(WII_NY , NOT_USE, 150);
    deadzone(WII_NX, WII_NY, DZ_CIRCLE, 5);
    // PS3 LXY = Nunchuck NXY by Wiimot3

    //Macro by Wiimote Fuzzy. Hold Wii-Left and select with Nunchuck stick up, down, left or right.
    if(get_val(WII_LEFT) && get_val(WII_NX) < -90) set_val(WII_X100);  // left
    if(get_val(WII_LEFT) && get_val(WII_NX) >  90) set_val(WII_RX, 100);  // right
    if(get_val(WII_LEFT) && get_val(WII_NY) < -90) set_val(WII_Y100);  // up
    if(get_val(WII_LEFT) && get_val(WII_NY) >  90) set_val(WII_RY, 100);  // down
    //Macro by Wiimote Fuzzy. Hold Wii-Left and select with Nunchuck stick up, down, left or right.


    // make nunchuck stick 3 states only (per direction):
    // - stick is only left/neutral/right (horizontal)
    if (MOVE_LEFT_RIGHT_3STATES) {
        if (get_val(WII_NX) < -20) set_val(PS3_LX, -100); // left
        else if (get_val(WII_NX) > 20) set_val(PS3_LX, 100); // right
        else set_val(PS3_LX, 0);  // neutral
    }

    // - stick is only up/neutral/down (vertical)
    if (MOVE_FORWARD_BACKWARD_3STATES) {
        if (get_val(WII_NY) < -20) set_val(PS3_LY, -100); // up
        else if (get_val(WII_NY) > 20) set_val(PS3_LY, 100); // down
        else set_val(PS3_LY, 0);   // neutral
    }

    //Snap nunchuck up or down to Melee, or in vehicle/aircraft swaps camera view -
    if(get_val(WII_ACCZ) > 20) set_val(WII_DOWN, 100);
    if(get_val(WII_ACCNX) > 30) set_val(WII_A, 100);

    // Edited MACRO from OFC Giorgia
    // CUSTOM: B BUTTON + while twisting the wiimote is used for throwing LETHAL
    if(get_val(WII_B) && get_val(WII_ACCX) > 25) {
        set_val(WII_PLUS, 0); // stop/prevent throwing tacticals
        set_val(WII_B, 0); // not shoot
        set_val(WII_A, 0); //not use/reload
        set_val(WII_MINUS, 100); // throw lethal
    }
    //mapping wii_left and wii_A to the PS4 share button from perfecthuntr
    if (get_val(WII_LEFT) && (get_val(WII_A) || get_val(PS4_SQUARE))) set_val(PS4_SHARE, 100);
}
ConsoleTuner Support Team
User avatar
perfecthuntr
Major
Major
 
Posts: 897
Joined: Wed Jan 14, 2015 8:35 am
Location: Tennessee

Re: mapping the wiimote to the PS4 Share button

Postby ashep49017 » Mon Jun 01, 2015 6:38 am

The code worked when I only used the script you wrote. I didnt have anything else and I built and ran it ok. Its when I insert it into my own script that it doesnt work. Any help is much appreciated. I went over every line again and couldnt tell why it would work. I remember something about dummy buttons in earlier post last year. Does this matter in this case?
User avatar
ashep49017
Sergeant First Class
Sergeant First Class
 
Posts: 24
Joined: Wed Oct 15, 2014 7:54 am

Re: mapping the wiimote to the PS4 Share button

Postby ashep49017 » Mon Jun 01, 2015 6:40 am

sorry... I didnt see your latest response.
User avatar
ashep49017
Sergeant First Class
Sergeant First Class
 
Posts: 24
Joined: Wed Oct 15, 2014 7:54 am

Re: mapping the wiimote to the PS4 Share button

Postby ashep49017 » Mon Jun 01, 2015 7:04 am

OK. I used the script you sent me and it doesnt work. So the only time it has worked is when I only had both wii_left and wii_A as the only script and remapping the wii_left directly to the PS4_Share button. Of course, this causes a double action every time I use the wii_left for something else like calling in streaks. So my only idea left is there a way to remap the power button to another function on the wii mote? This is the only button not mapped to one directly on the PS4 controller. Just to make sure Im not making a mistake. I updated all firmware and gtuner software and mapped the wii_left directly to share just to check if it worked again.(yes it does) Any thoughts at this point?
User avatar
ashep49017
Sergeant First Class
Sergeant First Class
 
Posts: 24
Joined: Wed Oct 15, 2014 7:54 am

Re: mapping the wiimote to the PS4 Share button

Postby OFC-Giorgio » Mon Nov 09, 2015 12:28 pm

ashep49017 wrote:The script by itself works. when I place it into my script above it doesn't


I had the same with adding the nunchuc reload function (viewtopic.php?f=14&t=857&p=18460#p18460).

I think you need to add a dummy mapping (of a non used button)

For example:

Code: Select all

unmap ALL_REMAPS;

remap WII_ACCX -> PS4_SHARE;

main
{
   //mapping wii_left and wii_A to the PS4 share button from perfecthuntr
   set_val(WII_ACCX, 0);
//   set_val(PS4_SHARE, 0);
   if ((get_val(WII_LEFT)) && (get_val(WII_A)))
   {
     set_val(WII_LEFT,   0); 
     set_val(WII_A,      0); 
     set_val(WII_ACCX, 100);
   }
}



I will add this to my wiimote script.
User avatar
OFC-Giorgio
Lieutenant
Lieutenant
 
Posts: 344
Joined: Mon Sep 15, 2014 4:26 pm

Re: SOLVED: mapping the wiimote to the PS4 Share button

Postby OFC-Giorgio » Mon Nov 09, 2015 1:05 pm

I added it to the wiimote script:

Changelog:

20151109-2 Activate PS4 share button by holding Left on the +Control Pad and the A button

See gtuner library for the new version http://www.consoletuner.com/gpclib/?s=906
User avatar
OFC-Giorgio
Lieutenant
Lieutenant
 
Posts: 344
Joined: Mon Sep 15, 2014 4:26 pm

Previous

Return to Wiimote, Nunchuk and Sensorbar

Who is online

Users browsing this forum: No registered users and 88 guests