CronusMax/Titane One wiimote bravo call of duty black ops 4

Use wiimote in bravo settings PS4 (adjust key mapping in script for other platforms) for: Call of Duty Black Ops 4 wii + button: throw lethal grenade wii + button while twisting the wiimote 90o counter clock wise: throw tactical double click wii + button: use specialist weapon wii dpad left and nunchuk left: use killstreak (like in previous call of duty games; in BO4: holding reload button for 2 seconds) wii dpad left and nunchuk right is disabled to prevent accidental use of: gestures/spraying decals keywords: wiimote, wii remote, bravo, PS4, call of duty, black ops 4, bo4 Happy wiimoting!
Versionv1.2
AuthorOFC-Giorgio
Publish DateWed, 17 Oct 2018 - 07:13
Last UpdateWed, 17 Oct 2018 - 07:16
Downloads75
ForumAnnouncement Topic
RATE


0

0

Release Notes: Version for CronusMax and Titan One
Code: Select all
//#pragma METAINFO("CM device and Titan One wiimote bravo PS4 call of duty black ops 4", 1, 2, "ofc-giorgio")
 
/***
 
Use wiimote in bravo settings PS4 (adjust key mapping in script for other platforms) for:
 
Call of Duty Black Ops 4
 
wii + button: throw lethal grenade
 
wii + button while twisting the wiimote 90o counter clock wise: throw tactical
 
double click wii + button: use specialist weapon
 
wii dpad left and nunchuk left: use killstreak (like in previous call of duty games; in BO4: holding reload button for 2 seconds)       
 
wii dpad left and nunchuk right is disabled to prevent accidental use of: gestures/spraying decals
 
Happy wiimoting!
 
 
keywords: wiimote, wii remote, bravo, PS4, call of duty, black ops 4, bo4
 
url: https://www.consoletuner.com/forum/viewtopic.php?f=14&t=10377
***/

 
/*
   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 Nunchuk stick up, down, left or right (for
   next-killstreak, previous-killstreak, use killstreak, switch to rifle
   grenadelauncher attachment respectively).
 
   Bravo settings:
   * shake nunchuk / reload is disabled,
   * - is used for reload and
   * + is still used to throw lethals but + while twisting the wiimote is used
     for throwing tacticals
*/

 
// Sensitivity while aiming - Default: 100 - Range [0 ~ 327]
// set a number below 100 for less sens - above 100 for more sens
 
// MIDPOINT - Default: 50 - Range [0 ~ 100]
//    If you set a number below 50 you are defining a zone of high sensitivity range when close to rest position
//    (fast movements) and a low sensitivity range when far from rest position (better accuracy).
//    if you set a number above 50 you are defining a zone of low sensitivity when close to the rest position
//    (better accuracy), and a zone of high sensitivity when far from rest position (fast movements).**/
 
// while aiming down the sight:
define ADS_MIDPOINT        =  20;
define ADS_SENSITIVITY     = 100;
 
// while NOT aiming down the sight:
define NON_ADS_MIDPOINT    =  20;
define NON_ADS_SENSITIVITY = 100;
 
// Output controller stick and buttons (for indirect programaticaly computed setting via dummy mapping)
define CONSOLE_LEFT_STICK_LEFT_RIGHT        = PS4_LX;       // cod walk
define CONSOLE_LEFT_STICK_UP_DOWN           = PS4_LY;       // cod walk
define CONSOLE_RIGHT_STICK_LEFT_RIGHT       = PS4_RX;       // cod look
define CONSOLE_RIGHT_STICK_UP_DOWN          = PS4_RY;       // cod look
define CONSOLE_DPAD_LEFT                    = PS4_LEFT;     // cod killstreak etc
define CONSOLE_DPAD_RIGHT                   = PS4_RIGHT;    // cod killstreak etc
define CONSOLE_DPAD_UP                      = PS4_UP;       // cod killstreak etc
define CONSOLE_DPAD_DOWN                    = PS4_DOWN;     // cod killstreak etc
define CONSOLE_BUTTON_L1LB                  = PS4_L1;       // tactical grenade
define CONSOLE_BUTTON_R1RB                  = PS4_R1;       // lethal grenade
define CONSOLE_BUTTON_L2LT                  = PS4_L2;       // zoom ads
define CONSOLE_BUTTON_R2RT                  = PS4_R2;       // fire
define CONSOLE_BUTTON_L3LS                  = PS4_L3;       // sprint
define CONSOLE_BUTTON_R3RS                  = PS4_R3;       // melee
define CONSOLE_BUTTON_PSXBOX                = PS4_PS;       // home
define CONSOLE_BUTTON_OPTIONSSTARTMENUSTART = PS4_OPTIONS// menu
define CONSOLE_BUTTON_TOUCHSELECTVIEWBACK   = PS4_TOUCH;    // menu
define CONSOLE_BUTTON_SQUAREX               = PS4_SQUARE;   // reload
define CONSOLE_BUTTON_CIRCLEB               = PS4_CIRCLE;   // crouch
define CONSOLE_BUTTON_TRIANGLEY             = PS4_TRIANGLE; // switch weapon
define CONSOLE_BUTTON_CROSSA                = PS4_CROSS;    // jump
 
define CONSOLE_BUTTON_TOUCHX   = PS4_TOUCHX;    // menu
define CONSOLE_BUTTON_TOUCHY   = PS4_TOUCHY;    // menu
 
define INPUT_WII_NC_STICK_LEFT_RIGHT    = WII_NX;
define INPUT_WII_NC_STICK_UP_DOWN       = WII_NY;
define INPUT_WII_DPAD_LEFT              = WII_LEFT;
define INPUT_WII_DPAD_RIGHT             = WII_RIGHT;
define INPUT_WII_DPAD_UP                = WII_UP;
define INPUT_WII_DPAD_DOWN              = WII_DOWN;
define INPUT_WII_NC_GYRO_X              = WII_ACCNX;
define INPUT_WII_GYRO_X                 = WII_ACCX;
define INPUT_WII_BUTTON_PLUS            = WII_PLUS;
define INPUT_WII_BUTTON_MINUS           = WII_MINUS;
define INPUT_WII_BUTTON_HOME            = WII_HOME;
define INPUT_WII_BUTTON_ONE             = WII_ONE;
define INPUT_WII_BUTTON_TWO             = WII_TWO;
define INPUT_WII_BUTTON_A               = WII_A;
define INPUT_WII_BUTTON_B               = WII_B;
define INPUT_WII_BUTTON_C               = WII_C;
define INPUT_WII_BUTTON_Z               = WII_Z;
define INPUT_WII_SENSOR_IRX             = WII_IRX;
define INPUT_WII_SENSOR_IRY             = WII_IRY;
 
 
int    VALUE_WII_NC_STICK_LEFT_RIGHT    = 0;
int    VALUE_WII_NC_STICK_UP_DOWN       = 0;
int    VALUE_WII_DPAD_LEFT              = 0;
int    VALUE_WII_GYRO_X                 = 0;
int    VALUE_WII_BUTTON_PLUS            = 0;
int    VALUE_WII_BUTTON_Z               = 0;
int    VALUE_WII_SENSOR_IRX             = 0;
 
 
// standard mappings
unmap ALL_REMAPS;
 
remap  INPUT_WII_BUTTON_HOME     -> CONSOLE_BUTTON_PSXBOX;                // home
remap  INPUT_WII_BUTTON_MINUS    -> CONSOLE_BUTTON_SQUAREX;               // reload hold: use/interact
remap  INPUT_WII_BUTTON_PLUS     -> CONSOLE_BUTTON_R1RB;                  // lethal grenade
remap  INPUT_WII_BUTTON_ONE      -> CONSOLE_BUTTON_OPTIONSSTARTMENUSTART; // menu/map
remap  INPUT_WII_BUTTON_TWO      -> CONSOLE_BUTTON_TOUCHSELECTVIEWBACK;   // scoreboard
remap  INPUT_WII_BUTTON_A        -> CONSOLE_BUTTON_L3LS;                  // sprint
remap  INPUT_WII_BUTTON_B        -> CONSOLE_BUTTON_R2RT;                  // fire
remap  INPUT_WII_DPAD_UP         -> CONSOLE_BUTTON_CROSSA;                // jump/mantle
remap  INPUT_WII_BUTTON_C        -> CONSOLE_BUTTON_CIRCLEB;               // crouch/prone
remap  INPUT_WII_BUTTON_Z        -> CONSOLE_BUTTON_L2LT;                  // zoom/aiming down the sights (ADS)
remap  INPUT_WII_DPAD_RIGHT      -> CONSOLE_BUTTON_TRIANGLEY;             // switch weapon
remap  INPUT_WII_DPAD_DOWN       -> CONSOLE_BUTTON_R3RS;                  // melee
remap  INPUT_WII_SENSOR_IRX      -> CONSOLE_RIGHT_STICK_LEFT_RIGHT;       // look
remap  INPUT_WII_SENSOR_IRY      -> CONSOLE_RIGHT_STICK_UP_DOWN;          // look
 
 
// Dummy mapping  3 4 9 10 17 20 24 not used in api
 
define OUTPUT_CONSOLE_LEFT_STICK_LEFT_RIGHT =  3
remap  OUTPUT_CONSOLE_LEFT_STICK_LEFT_RIGHT -> CONSOLE_LEFT_STICK_LEFT_RIGHT;
define OUTPUT_CONSOLE_LEFT_STICK_UP_DOWN    =  4;
remap  OUTPUT_CONSOLE_LEFT_STICK_UP_DOWN    -> CONSOLE_LEFT_STICK_UP_DOWN;
define OUTPUT_CONSOLE_DPAD_LEFT             =  9;
remap  OUTPUT_CONSOLE_DPAD_LEFT             -> CONSOLE_DPAD_LEFT;
define OUTPUT_CONSOLE_DPAD_RIGHT            =  10;
remap  OUTPUT_CONSOLE_DPAD_RIGHT            -> CONSOLE_DPAD_RIGHT;
define OUTPUT_CONSOLE_DPAD_UP               =  17;
remap  OUTPUT_CONSOLE_DPAD_UP               -> CONSOLE_DPAD_UP;
define OUTPUT_CONSOLE_DPAD_DOWN             =  20;
remap  OUTPUT_CONSOLE_DPAD_DOWN             -> CONSOLE_DPAD_DOWN;
define OUTPUT_CONSOLE_BUTTON_R1RB           =  24;
remap  OUTPUT_CONSOLE_BUTTON_R1RB           -> CONSOLE_BUTTON_L1LB;
 
//int ps4auth;
int isDPADding = 0;
int TimerSpecialistWeapon;
int ps4auth;
 
init
{
  //ps4auth = ps4_authtimeout();
  my_init();
}
 
main
{
  if(ps4_authtimeout() > ps4auth)
  {
    my_init();
  }
  ps4auth = ps4_authtimeout();
 
  // Retrieve values from input controller (wiimote + nc)
  VALUE_WII_DPAD_LEFT           = get_val(INPUT_WII_DPAD_LEFT);
  VALUE_WII_NC_STICK_LEFT_RIGHT = get_val(INPUT_WII_NC_STICK_LEFT_RIGHT);
  VALUE_WII_NC_STICK_UP_DOWN    = get_val(INPUT_WII_NC_STICK_UP_DOWN);
  VALUE_WII_GYRO_X              = get_val(INPUT_WII_GYRO_X);
  VALUE_WII_BUTTON_PLUS         = get_val(INPUT_WII_BUTTON_PLUS);
  VALUE_WII_BUTTON_Z            = get_val(INPUT_WII_BUTTON_Z);
  VALUE_WII_SENSOR_IRX          = get_val(INPUT_WII_SENSOR_IRX);
 
  set_val(INPUT_WII_SENSOR_IRX, inv(VALUE_WII_SENSOR_IRX));
 
  // use different sensitivity for ADS (aiming down the sights) and non ADS
  if (VALUE_WII_BUTTON_Z == 100)
  {
    sensitivity(INPUT_WII_SENSOR_IRX, ADS_MIDPOINT, ADS_SENSITIVITY);
    sensitivity(INPUT_WII_SENSOR_IRY, ADS_MIDPOINT, ADS_SENSITIVITY);
  }
  else
  {
    sensitivity(INPUT_WII_SENSOR_IRX, NON_ADS_MIDPOINT, NON_ADS_SENSITIVITY);
    sensitivity(INPUT_WII_SENSOR_IRY, NON_ADS_MIDPOINT, NON_ADS_SENSITIVITY);
  }
 
  // test for wiimote out of reach of sensorbar
  if(wiir_offscreen())
  {
    set_val(INPUT_WII_SENSOR_IRX, 0); // prevent camera from spinning
    set_val(INPUT_WII_SENSOR_IRY, 0); // prevent camera from spinning   
    set_led(LED_4, 1);   // light led 4 to indicate sensorbar is out of sight
  }
  else
  {
    set_led(LED_4, 0);
  }
 
  // Moving with right stick or dpad buttons
  // WII_LIFT acts like a SHIFT key, when pressed the Nunchuck stick is not used for moving but for
  // selecting dpad up, down, left or right.
  isDPADding = 0;
  if(VALUE_WII_DPAD_LEFT == 100)
  {
    isDPADding = 1;
    // selecting dpad left, right, up, down.
    // threshold is higher (vs 30) in order to have only one dpad button selected at a time
    if(VALUE_WII_NC_STICK_LEFT_RIGHT < -30)
    {
      // In BO4 press and hold triangle for a bit to use kilstreak
      //set_val(OUTPUT_CONSOLE_DPAD_LEFT,  100);  // left
      combo_run(ComboUseKillStreak);       
    }
    else
    if(VALUE_WII_NC_STICK_LEFT_RIGHT >  30)
    {       
      // bo4: surpress gestures/spraying decals
      //set_val(OUTPUT_CONSOLE_DPAD_RIGHT, 100); // right
      isDPADding=isDPADding; // NOP
    }
    else
    if(VALUE_WII_NC_STICK_UP_DOWN    >  30) //&&
    { set_val(OUTPUT_CONSOLE_DPAD_DOWN,  100); } // down (sign is flipped compared to math class)
    else
    if(VALUE_WII_NC_STICK_UP_DOWN    < -30) //&&
    {
    set_val(OUTPUT_CONSOLE_DPAD_UP,    100);
    } // up (sign is flipped compared to math class)
  }
 
  if(isDPADding == 0)
  {
    // moving left/right
    if (VALUE_WII_NC_STICK_LEFT_RIGHT < -30) { set_val(OUTPUT_CONSOLE_LEFT_STICK_LEFT_RIGHT, -100); } // left
    else
    if (VALUE_WII_NC_STICK_LEFT_RIGHT > 30)  { set_val(OUTPUT_CONSOLE_LEFT_STICK_LEFT_RIGHT,  100); } // right
    else
    { set_val(OUTPUT_CONSOLE_LEFT_STICK_LEFT_RIGHT, VALUE_WII_NC_STICK_LEFT_RIGHT); }
 
    // moving up/down
    if (VALUE_WII_NC_STICK_UP_DOWN    < -30) { set_val(OUTPUT_CONSOLE_LEFT_STICK_UP_DOWN,    -100); } // up (sign is flipped compared to math class)
    else
    if (VALUE_WII_NC_STICK_UP_DOWN    > 30)  { set_val(OUTPUT_CONSOLE_LEFT_STICK_UP_DOWN,     100); } // down (sign is flipped compared to math class)
    else
    { set_val(OUTPUT_CONSOLE_LEFT_STICK_UP_DOWN, VALUE_WII_NC_STICK_UP_DOWN); }
  }
 
  // Bravo settings  twisting the wiimote 90o, hold it and press the + button
  // is used for throwing tacticals (instead of lethal grenade)
  if((VALUE_WII_BUTTON_PLUS > 0) && (VALUE_WII_GYRO_X > 20))
  {
    set_val(INPUT_WII_BUTTON_PLUS,      0);   // stop/prevent throwing lethal
    set_val(OUTPUT_CONSOLE_BUTTON_R1RB, 100); // throw tactical grenade
  }   
  else
  {
    set_val(OUTPUT_CONSOLE_BUTTON_R1RB, 0);
  }
 
  // Bravo settings (COD Black Ops 3 + 4: throwing both lethal and tactical to activate Specialist weapon or skill) 
  // this can not be done in bravo settings so to in bravo settings
  // activate Specialist weapon or skill by double tapping the lethal grenade button
  // TimerSpecialistWeapon - Countdown function
  if (TimerSpecialistWeapon > 0) { TimerSpecialistWeapon = TimerSpecialistWeapon - get_rtime(); }    // Reduce the timer value by the elapsed run time
  // Timer - Detection of the release
  if (event_release(INPUT_WII_BUTTON_PLUS)) { TimerSpecialistWeapon = 300; }   // 300 ms timer (starting the timer)
  // Timer - Detection of the press
  if (event_press(INPUT_WII_BUTTON_PLUS) && TimerSpecialistWeapon > 0)
  {
     TimerSpecialistWeapon = 0;
     combo_run(ComboSpecialistWeapon);
  } 
 
 // Empty battery indicator (led 3 on if battery level less or equal 20%)
 if(get_battery() <= 2)
 {
   set_led(LED_1, 1);
   set_led(LED_2, 1);
   set_led(LED_3, 1);
   set_led(LED_4, 1);
 }
 
} // end of main() function
 
combo ComboSpecialistWeapon
{
   set_val(INPUT_WII_BUTTON_PLUS, 100);
   set_val(OUTPUT_CONSOLE_BUTTON_R1RB,        100);
   wait(500);
   set_val(INPUT_WII_BUTTON_PLUS, 0);
   set_val(OUTPUT_CONSOLE_BUTTON_R1RB,        0);   
}
 
combo ComboUseKillStreak
{
   set_val(INPUT_WII_DPAD_RIGHT, 100);
   wait(2000);
   set_val(INPUT_WII_DPAD_RIGHT, 0);   
}
 
function my_init()
{
  block_rumble();
}