Titan Two+BlueTooth module wiimote script: Call of Duty BO4
Moderator: OFC-Giorgio
13 posts
• Page 2 of 2 • 1, 2
Re: Titan Two+BlueTooth module wiimote script: Call of Duty
Error fixed:
- Code: Select all
#pragma METAINFO("T2 wiimote bravo PS4 call of duty black ops 4", 1, 1, "ofc-giorgio")
/*** Online Resource Info
<shortdesc>
Please report bugs/problems via consoletuners forum - click the DOC link to get to this scripts topic.<br>
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSNcr8BUXOPllhY_V104RkalacMCfRnoSeC_nioFpv5odtLA7ju">
Use wiimote in bravo settings PS4 (adjust key mapping in script for other platforms) for:
<b>Call of Duty Black Ops 4</b>
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!
</shortdesc>
<keywords>wiimote, wii remote, bravo, PS4, call of duty, black ops 4, bo4</keywords>
<docurl>https://www.consoletuner.com/forum/viewtopic.php?f=23&t=10376</docurl>
***/
#include <remapper.gph>
#include <wii.gph>
#include <ps4.gph>
/*
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 90o counter clock wise 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:
uint8 ADS_MIDPOINT = 25;
uint8 ADS_SENSITIVITY = 100;
// while NOT aiming down the sight:
uint8 NON_ADS_MIDPOINT = 25; // a lower value than the standard 50 value means more sensitive
uint8 NON_ADS_SENSITIVITY = 100;
// Input wiimote controller stick and buttons
//#define INPUT_WII_NC_STICK_LEFT_RIGHT WII_LX + 1 // WII_NX + 1 renamed in T2.h wth
//#define INPUT_WII_NC_STICK_UP_DOWN WII_LY + 1 // WII_NY + 1 renamed in T2.h wth
#define INPUT_WII_DPAD_LEFT WII_LEFT + 1
#define INPUT_WII_DPAD_RIGHT WII_RIGHT + 1
#define INPUT_WII_DPAD_UP WII_UP + 1
#define INPUT_WII_DPAD_DOWN WII_DOWN + 1
//#define INPUT_WII_GYRO_X WII_ACCX + 1
#define INPUT_WII_BUTTON_PLUS WII_PLUS + 1
#define INPUT_WII_BUTTON_MINUS WII_MINUS + 1
#define INPUT_WII_BUTTON_HOME WII_HOME + 1
#define INPUT_WII_BUTTON_ONE WII_ONE + 1
#define INPUT_WII_BUTTON_TWO WII_TWO + 1
#define INPUT_WII_BUTTON_A WII_A + 1
#define INPUT_WII_BUTTON_B WII_B + 1
#define INPUT_WII_BUTTON_C WII_C + 1
#define INPUT_WII_BUTTON_Z WII_Z + 1
// Output controller stick and buttons
#define OUTPUT_CONSOLE_LEFT_STICK_LEFT_RIGHT PS4_LX // walk
#define OUTPUT_CONSOLE_LEFT_STICK_UP_DOWN PS4_LY // walk
#define OUTPUT_CONSOLE_RIGHT_STICK_LEFT_RIGHT PS4_RX // look
#define OUTPUT_CONSOLE_RIGHT_STICK_UP_DOWN PS4_RY // look
#define OUTPUT_CONSOLE_DPAD_LEFT PS4_LEFT // killstreak use `
#define OUTPUT_CONSOLE_DPAD_RIGHT PS4_RIGHT //
#define OUTPUT_CONSOLE_DPAD_UP PS4_UP // killstreak next
#define OUTPUT_CONSOLE_DPAD_DOWN PS4_DOWN // killstreak prev
#define OUTPUT_CONSOLE_BUTTON_L1LB PS4_L1 // tactical grenade
#define OUTPUT_CONSOLE_BUTTON_R1RB PS4_R1 // lethal grenade
#define OUTPUT_CONSOLE_BUTTON_L2LT PS4_L2 // zoom/ads
#define OUTPUT_CONSOLE_BUTTON_R2RT PS4_R2 // fire
#define OUTPUT_CONSOLE_BUTTON_L3LS PS4_L3 // sprint
#define OUTPUT_CONSOLE_BUTTON_R3RS PS4_R3 // melee
#define OUTPUT_CONSOLE_BUTTON_PSXBOX PS4_PS // home
#define OUTPUT_CONSOLE_BUTTON_OPTIONSSTARTMENUSTART PS4_OPTIONS // menu/map
#define OUTPUT_CONSOLE_BUTTON_TOUCHSELECTVIEWBACK PS4_TOUCH // score
#define OUTPUT_CONSOLE_BUTTON_SQUAREX PS4_SQUARE // reload
#define OUTPUT_CONSOLE_BUTTON_CIRCLEB PS4_CIRCLE // crouch
#define OUTPUT_CONSOLE_BUTTON_TRIANGLEY PS4_TRIANGLE // switch weapon
#define OUTPUT_CONSOLE_BUTTON_CROSSA PS4_CROSS // jump
//#define OUTPUT_CONSOLE_LEFT_STICK_LEFT_RIGHT STICK_2_X // walk
//#define OUTPUT_CONSOLE_LEFT_STICK_UP_DOWN STICK_2_Y // walk
//#define OUTPUT_CONSOLE_RIGHT_STICK_LEFT_RIGHT STICK_1_X // walk
//#define OUTPUT_CONSOLE_RIGHT_STICK_UP_DOWN STICK_1_Y // walk
#define OUTPUT_CONSOLE_ACCEL_1_X ACCEL_1_X // 90o twisted wiimote
#define OUTPUT_CONSOLE_POINT_1_X POINT_1_X
#define OUTPUT_CONSOLE_POINT_1_Y POINT_1_Y
#define OUTPUT_CONSOLE_POINT_2_X POINT_2_X
#define OUTPUT_CONSOLE_POINT_2_Y POINT_2_Y
const // init with no mapping = default gpc
uint8 wiimote2PS4[43] = {
RMP_BT_A ||
RMP_BT_B,
0, 1, 2, 3, 4, 5, 6,
7, 8, 9, 10, 11, 12, 13,
14, 15 , 16, 17, 18, 19, 20,
STICK_1_X, STICK_1_Y, STICK_2_X, STICK_2_Y,
POINT_1_X, POINT_1_Y, POINT_2_X, POINT_2_Y,
ACCEL_1_X, ACCEL_1_Y, ACCEL_1_Z, ACCEL_2_X, ACCEL_2_Y, ACCEL_2_Z,
GYRO_1_X, GYRO_1_Y, GYRO_1_Z,
PADDLE_1, PADDLE_2, PADDLE_3, PADDLE_4
};
init {
// wii B comes in as 16, to be mapped to PS4_R2 = BUTTON_5
// wiimote2PS4[ "position in array of button 16" ] = BUTTON_5;
// wiimote2PS4[ 16 ] = BUTTON_5; // 0 is controller mask
// printf shows: WII_B = 15 PS4_R2 = 4 BUTTON_5 = 4
// wiimote2PS4[ 16 ] = 4; // 0 is controller mask
// wiimote2PS4[ WII_B + 1 ] = BUTTON_5;
// #define INPUT_WII_BUTTON_B WII_B + 1;
// wiimote2PS4[ INPUT_WII_BUTTON_B ] = BUTTON_5;
// wiimote2PS4[ INPUT_WII_BUTTON_B ] = PS4_R2;
// #define OUTPUT_CONSOLE_BUTTON_R2RT PS4_R2
// remap rule:
// wiimote2PS4[ INPUT_WII_BUTTON_B ] = CONSOLE_BUTTON_R2RT;
wiimote2PS4[ INPUT_WII_BUTTON_HOME ] = OUTPUT_CONSOLE_BUTTON_PSXBOX; // home
wiimote2PS4[ INPUT_WII_BUTTON_MINUS ] = OUTPUT_CONSOLE_BUTTON_SQUAREX; // reload hold: use/interact
wiimote2PS4[ INPUT_WII_BUTTON_PLUS ] = OUTPUT_CONSOLE_BUTTON_R1RB; // lethal grenade
wiimote2PS4[ INPUT_WII_BUTTON_ONE ] = OUTPUT_CONSOLE_BUTTON_OPTIONSSTARTMENUSTART; // menu/map
wiimote2PS4[ INPUT_WII_BUTTON_TWO ] = OUTPUT_CONSOLE_BUTTON_TOUCHSELECTVIEWBACK; // scoreboard
wiimote2PS4[ INPUT_WII_BUTTON_A ] = OUTPUT_CONSOLE_BUTTON_L3LS; // sprint
wiimote2PS4[ INPUT_WII_BUTTON_B ] = OUTPUT_CONSOLE_BUTTON_R2RT; // fire
wiimote2PS4[ INPUT_WII_BUTTON_C ] = OUTPUT_CONSOLE_BUTTON_CIRCLEB; // crouch/prone
wiimote2PS4[ INPUT_WII_BUTTON_Z ] = OUTPUT_CONSOLE_BUTTON_L2LT; // zoom/aiming down the sights (ADS)
wiimote2PS4[ INPUT_WII_DPAD_LEFT ] = OUTPUT_CONSOLE_DPAD_LEFT; // shift nc -> dpad
wiimote2PS4[ INPUT_WII_DPAD_RIGHT ] = OUTPUT_CONSOLE_BUTTON_TRIANGLEY; // switch weapon hold: pickup
wiimote2PS4[ INPUT_WII_DPAD_UP ] = OUTPUT_CONSOLE_BUTTON_CROSSA; // jump/mantle
wiimote2PS4[ INPUT_WII_DPAD_DOWN ] = OUTPUT_CONSOLE_BUTTON_R3RS; // melee
//is default:
//wiimote2PS4[ INPUT_WII_NC_STICK_LEFT_RIGHT ] = OUTPUT_CONSOLE_LEFT_STICK_LEFT_RIGHT; //walk
//wiimote2PS4[ INPUT_WII_NC_STICK_UP_DOWN ] = OUTPUT_CONSOLE_LEFT_STICK_UP_DOWN; //walk
remapper(wiimote2PS4);
}
/* alternative way of mapping the wii buttons to PS4 controller
const
uint8 wiimote2PS4_correct_lean_and_mean[39] = {
RMP_BT_A,
BUTTON_1, BUTTON_17, BUTTON_4, BUTTON_21, BUTTON_21, BUTTON_2, BUTTON_15,
BUTTON_8, BUTTON_3, BUTTON_16, BUTTON_9, BUTTON_21, BUTTON_14, BUTTON_21,
BUTTON_6, BUTTON_5, BUTTON_21, BUTTON_21, BUTTON_21, BUTTON_21, BUTTON_21,
STICK_1_X, STICK_1_Y, STICK_2_X, STICK_2_Y,
POINT_1_X, POINT_1_Y, POINT_2_X, POINT_2_Y,
ACCEL_1_X, ACCEL_1_Y, ACCEL_1_Z, ACCEL_2_X, ACCEL_2_Y, ACCEL_2_Z,
GYRO_1_X, GYRO_1_Y, GYRO_1_Z
};
*/
int isDPADding = 0;
int doubletap_stage_SpecialistWeapon = 0;
int doubletap_timing_SpecialistWeapon;
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;
fix32 VALUE_WII_SENSOR_IRX_1 = 0.0;
fix32 VALUE_WII_SENSOR_IRY_1 = 0.0;
fix32 VALUE_WII_SENSOR_IRX_2 = 0.0;
fix32 VALUE_WII_SENSOR_IRY_2 = 0.0;
main
{
VALUE_WII_BUTTON_Z = (int) get_val(OUTPUT_CONSOLE_BUTTON_L2LT); // t2 very reversed weird vs t1
VALUE_WII_DPAD_LEFT = (int) get_val(OUTPUT_CONSOLE_DPAD_LEFT); // t2 weird vs t1
VALUE_WII_NC_STICK_LEFT_RIGHT = (int) get_val(OUTPUT_CONSOLE_LEFT_STICK_LEFT_RIGHT);
VALUE_WII_NC_STICK_UP_DOWN = (int) get_val(OUTPUT_CONSOLE_LEFT_STICK_UP_DOWN);
VALUE_WII_BUTTON_PLUS = (int) get_val(OUTPUT_CONSOLE_BUTTON_R1RB);
VALUE_WII_GYRO_X = 0 - (int) get_val(OUTPUT_CONSOLE_ACCEL_1_X); // T2 flip sign
if(VALUE_WII_BUTTON_Z == 100)
{
sensitivity(OUTPUT_CONSOLE_POINT_1_X, ADS_MIDPOINT, ADS_SENSITIVITY);
sensitivity(OUTPUT_CONSOLE_POINT_1_Y, ADS_MIDPOINT, ADS_SENSITIVITY);
}
else
{
sensitivity(OUTPUT_CONSOLE_POINT_1_Y, NON_ADS_MIDPOINT, NON_ADS_SENSITIVITY);
sensitivity(OUTPUT_CONSOLE_POINT_1_Y, NON_ADS_MIDPOINT, NON_ADS_SENSITIVITY);
}
// get values after sensitivity calls
VALUE_WII_SENSOR_IRX_1 = (fix32) get_val(OUTPUT_CONSOLE_POINT_1_X);
VALUE_WII_SENSOR_IRY_1 = (fix32) get_val(OUTPUT_CONSOLE_POINT_1_Y);
set_val(OUTPUT_CONSOLE_RIGHT_STICK_LEFT_RIGHT, VALUE_WII_SENSOR_IRX_1);
set_val(OUTPUT_CONSOLE_RIGHT_STICK_UP_DOWN, VALUE_WII_SENSOR_IRY_1);
// 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;
set_val(OUTPUT_CONSOLE_DPAD_LEFT, 0);
set_val(OUTPUT_CONSOLE_LEFT_STICK_LEFT_RIGHT, 0);
set_val(OUTPUT_CONSOLE_LEFT_STICK_UP_DOWN, 0);
// 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 left is not to use kilstreak
//set_val(OUTPUT_CONSOLE_DPAD_LEFT, 100); // left
// In BO4 press and hold triangle for a bit to use kilstreak
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
}
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)
// in bo4: heal
if((VALUE_WII_BUTTON_PLUS > 0) && (VALUE_WII_GYRO_X > 20))
{
set_val(OUTPUT_CONSOLE_BUTTON_R1RB, 0); // stop/prevent throwing lethal
set_val(OUTPUT_CONSOLE_BUTTON_L1LB, 100); // throw tactical grenade
}
else
{
set_val(OUTPUT_CONSOLE_BUTTON_L1LB, 0);
}
// doubletap wii plus button to activate specialist weapon
if(doubletap_stage_SpecialistWeapon == 0)
{
if(VALUE_WII_BUTTON_PLUS)
{
doubletap_stage_SpecialistWeapon = 1;
}
}
else if(doubletap_stage_SpecialistWeapon == 1)
{
if(!VALUE_WII_BUTTON_PLUS)
{
doubletap_timing_SpecialistWeapon = 0;
doubletap_stage_SpecialistWeapon = 2;
}
}
else if(doubletap_stage_SpecialistWeapon == 2)
{
if(VALUE_WII_BUTTON_PLUS)
{
doubletap_stage_SpecialistWeapon = 1;
combo_run(ComboSpecialistWeapon);
}
doubletap_timing_SpecialistWeapon = doubletap_timing_SpecialistWeapon + elapsed_time();
if(doubletap_timing_SpecialistWeapon > 300)
{
doubletap_stage_SpecialistWeapon = 0;
}
}
// not in use: surpress
set_val(ACCEL_1_X, 0);
set_val(ACCEL_1_Y, 0);
set_val(ACCEL_1_Z, 0);
set_val(GYRO_1_Y, 0);
set_val(GYRO_1_Z, 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
combo ComboSpecialistWeapon
{
set_val(OUTPUT_CONSOLE_BUTTON_R1RB, 100);
set_val(OUTPUT_CONSOLE_BUTTON_L1LB, 100);
wait(500);
set_val(INPUT_WII_BUTTON_PLUS, 0);
set_val(OUTPUT_CONSOLE_BUTTON_L1LB, 0);
}
combo ComboUseKillStreak
{
set_val(OUTPUT_CONSOLE_BUTTON_TRIANGLEY, 100);
wait(2000);
set_val(OUTPUT_CONSOLE_BUTTON_TRIANGLEY, 0);
}
#define NOT_USE 0
void sensitivity(int id, int mid, int sen) {
int val = (int) get_val(id);
if(mid != NOT_USE) {
int val_s = (val >= 0) ? 1 : -1;
val *= val_s;
if(val <= mid) val = (val * 50) / mid;
else val = ((50 * (val - mid)) / (100 - mid)) + 50;
val *= val_s;
}
if(sen != NOT_USE) {
val = (val * sen) / 100;
}
set_val(id, clamp(val, -100, 100));
return;
}
ConsoleTuner Support Team
-
J2Kbr - General of the Army
- Posts: 20323
- Joined: Tue Mar 18, 2014 1:39 pm
Re: Titan Two+BlueTooth module wiimote script: Call of Duty
Thanks J2Kbr
I will try to publish it as version 1.2 (2023)
P.S. Done. Published version 1.02
I will try to publish it as version 1.2 (2023)
P.S. Done. Published version 1.02
-
OFC-Giorgio - Lieutenant
- Posts: 344
- Joined: Mon Sep 15, 2014 4:26 pm
Re: Titan Two+BlueTooth module wiimote script: Call of Duty
See:
T2 wiimote bravo PS4 call of duty black ops 4 v 1.02 - Aug 30, 2023
url https://www.consoletuner.com/greslib/?w2999
T2 wiimote bravo PS4 call of duty black ops 4 v 1.02 - Aug 30, 2023
url https://www.consoletuner.com/greslib/?w2999
-
OFC-Giorgio - Lieutenant
- Posts: 344
- Joined: Mon Sep 15, 2014 4:26 pm
13 posts
• Page 2 of 2 • 1, 2
Return to Wiimote, Nunchuk and Sensorbar
Who is online
Users browsing this forum: No registered users and 2 guests