Skip to content

Commit

Permalink
Controls changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Parik27 committed Jul 26, 2022
1 parent 1258842 commit 7bcf20b
Showing 1 changed file with 57 additions and 47 deletions.
104 changes: 57 additions & 47 deletions src/misc/controls.cc
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ class ControlsRandomizer
SWAP_NONE,
SWAP_HORIZONTAL,
SWAP_ALL
} sm_InputSwapPreset = SWAP_HORIZONTAL;
} sm_InputSwapPreset = SWAP_NONE;

static void
AdjustControls (ControlSettings *settings)
Expand All @@ -442,26 +442,26 @@ class ControlsRandomizer
if (sm_InputSwapPreset == SWAP_HORIZONTAL)
{
InputsToSwap = {
// {"INPUT_MOVE_LEFT_ONLY"_joaat,
// "INPUT_MOVE_RIGHT_ONLY"_joaat},
// {"INPUT_SCALED_LOOK_LEFT_ONLY"_joaat,
// "INPUT_SCALED_LOOK_RIGHT_ONLY"_joaat},
// {"INPUT_LOOK_LEFT_ONLY"_joaat,
// "INPUT_LOOK_RIGHT_ONLY"_joaat},
// {"INPUT_VEH_MOVE_LEFT_ONLY"_joaat,
// "INPUT_VEH_MOVE_RIGHT_ONLY"_joaat},
{"INPUT_MOVE_LEFT_ONLY"_joaat,
"INPUT_MOVE_RIGHT_ONLY"_joaat},
{"INPUT_SCALED_LOOK_LEFT_ONLY"_joaat,
"INPUT_SCALED_LOOK_RIGHT_ONLY"_joaat},
{"INPUT_LOOK_LEFT_ONLY"_joaat,
"INPUT_LOOK_RIGHT_ONLY"_joaat},
{"INPUT_VEH_MOVE_LEFT_ONLY"_joaat,
"INPUT_VEH_MOVE_RIGHT_ONLY"_joaat},
{"INPUT_VEH_FLY_YAW_LEFT"_joaat,
"INPUT_VEH_FLY_YAW_RIGHT"_joaat},

// {"INPUT_VEH_FLY_ROLL_LEFT_ONLY"_joaat,
// "INPUT_VEH_FLY_ROLL_RIGHT_ONLY"_joaat},
// {"INPUT_VEH_SUB_TURN_LEFT_ONLY"_joaat,
// "INPUT_VEH_SUB_TURN_RIGHT_ONLY"_joaat},
{"INPUT_VEH_FLY_ROLL_LEFT_ONLY"_joaat,
"INPUT_VEH_FLY_ROLL_RIGHT_ONLY"_joaat},
{"INPUT_VEH_SUB_TURN_LEFT_ONLY"_joaat,
"INPUT_VEH_SUB_TURN_RIGHT_ONLY"_joaat},
{"INPUT_VEH_SUB_TURN_HARD_LEFT"_joaat,
"INPUT_VEH_SUB_TURN_HARD_RIGHT"_joaat},

// {"INPUT_PARACHUTE_TURN_LEFT_ONLY"_joaat,
// "INPUT_PARACHUTE_TURN_RIGHT_ONLY"_joaat
{"INPUT_PARACHUTE_TURN_LEFT_ONLY"_joaat,
"INPUT_PARACHUTE_TURN_RIGHT_ONLY"_joaat}
};
}
else if (sm_InputSwapPreset == SWAP_ALL)
Expand Down Expand Up @@ -539,13 +539,13 @@ class ControlsRandomizer
AdjustControls4 (CControls *p1)
{
O (p1);
p1->GetIoValue (INPUT_LOOK_LR)->fMultiplier = -1;
p1->GetIoValue (INPUT_MOVE_LR)->fMultiplier = -1;
p1->GetIoValue (INPUT_SCALED_LOOK_LR)->fMultiplier = -1;
p1->GetIoValue (INPUT_VEH_MOVE_LR)->fMultiplier = -1;
p1->GetIoValue (INPUT_VEH_FLY_ROLL_LR)->fMultiplier = -1;
p1->GetIoValue (INPUT_VEH_SUB_TURN_LR)->fMultiplier = -1;
p1->GetIoValue (INPUT_PARACHUTE_TURN_LR)->fMultiplier = -1;
//p1->GetIoValue (INPUT_LOOK_LR)->fMultiplier = -1;
//p1->GetIoValue (INPUT_MOVE_LR)->fMultiplier = -1;
//p1->GetIoValue (INPUT_SCALED_LOOK_LR)->fMultiplier = -1;
//p1->GetIoValue (INPUT_VEH_MOVE_LR)->fMultiplier = -1;
//p1->GetIoValue (INPUT_VEH_FLY_ROLL_LR)->fMultiplier = -1;
//p1->GetIoValue (INPUT_VEH_SUB_TURN_LR)->fMultiplier = -1;
//p1->GetIoValue (INPUT_PARACHUTE_TURN_LR)->fMultiplier = -1;
}

static void
Expand All @@ -557,6 +557,14 @@ class ControlsRandomizer
sm_InputSwapPreset = SWAP_NONE;
}

template <auto& O>
static void
DelayControls ()
{
Sleep (1000);
O ();
}

public:
ControlsRandomizer ()
{
Expand All @@ -565,34 +573,37 @@ class ControlsRandomizer
"39 05 ? ? ? ? 74 ? 89 05 ? ? ? ? e8 ? ? ? ?", 14),
ReloadControls);

// REGISTER_HOOK ("e8 ? ? ? ? ? 8d ? ? ? ? ? ? 8b c7 ? 8b ce e8 ? ? ? ? ? "
// "8d ? ? ? ? ? ? 8b ce e8 ? ? ? ?",
// 0, AdjustControls2, void, CControls *, ControlSettings *,
// int);
REGISTER_HOOK ("e8 ? ? ? ? ? 8d ? ? ? ? ? ? 8b c7 ? 8b ce e8 ? ? ? ? ? "
"8d ? ? ? ? ? ? 8b ce e8 ? ? ? ?",
0, AdjustControls2, void, CControls *, ControlSettings
*, int);

REGISTER_HOOK ("e8 ? ? ? ? ? 8d ? ? ? ? ? ? 8b c7 ? 8b ce e8 ? ? ? ? ? "
"8d ? ? ? ? ? ? 8b ce e8 ? ? ? ?",
18, AdjustControls2, void, CControls *,
ControlSettings *, int);

// REGISTER_HOOK ("e8 ? ? ? ? ? 8d ? ? ? ? ? ? 8b c7 ? 8b ce e8 ? ? ? ? ? "
// "8d ? ? ? ? ? ? 8b ce e8 ? ? ? ?",
// 18, AdjustControls2, void, CControls *,
// ControlSettings *, int);
REGISTER_HOOK ("e8 ? ? ? ? ? 8d ? ? ? ? ? ? 8b c7 ? 8b ce e8 ? ? ? ? ? "
"8d ? ? ? ? ? ? 8b ce e8 ? ? ? ?",
33, AdjustControls, void, CControls *,
ControlSettings *);

// REGISTER_HOOK ("e8 ? ? ? ? ? 8d ? ? ? ? ? ? 8b c7 ? 8b ce e8 ? ? ? ? ? "
// "8d ? ? ? ? ? ? 8b ce e8 ? ? ? ?",
// 33, AdjustControls, void, CControls *,
// ControlSettings *);
REGISTER_HOOK ("e8 ? ? ? ? ? 8d ? ? ? ? ? ? 8b c7 ? 8b ce e8 ? ? ? ? ? "
"8d ? ? ? ? ? ? 8b ce e8 ? ? ? ?",
48, AdjustControls, void, CControls *,
ControlSettings*);

// REGISTER_HOOK ("e8 ? ? ? ? ? 8d ? ? ? ? ? ? 8b c7 ? 8b ce e8 ? ? ? ? ? "
// "8d ? ? ? ? ? ? 8b ce e8 ? ? ? ?",
// 48, AdjustControls, void, CControls *,
// ControlSettings*);
// REGISTER_HOOK ("eb ? ? 8b 0d ? ? ? ? ba 01 00 00 00 e8 ? ? ? ? e8 ? ? ? ?",
// 19, DelayControls, void);

REGISTER_HOOK (
"72 ? ? 8b ce e8 ? ? ? ? ? 8d ? ? ? ? ? ? 8d ? ? ? ? ? ?", 5,
AdjustControls4, void, CControls *);
// REGISTER_HOOK (
// "72 ? ? 8b ce e8 ? ? ? ? ? 8d ? ? ? ? ? ? 8d ? ? ? ? ? ?", 5,
// AdjustControls4, void, CControls *);

REGISTER_MH_HOOK_BRANCH (
"e8 ? ? ? ? bf fc ff ff ff ? 8d ? ? ? ? ? ? 8b ce ", 0,
AdjustControls3, void, CControls *, const char *, bool,
ControlSettings *);
// REGISTER_MH_HOOK_BRANCH (
// "e8 ? ? ? ? bf fc ff ff ff ? 8d ? ? ? ? ? ? 8b ce ", 0,
// AdjustControls3, void, CControls *, const char *, bool,
// ControlSettings *);

// REGISTER_MH_HOOK_BRANCH (
// "e8 ? ? ? ? ? 8d ? ? ? ? ? ? 8b c7 ? 8b ce e8 ? ? ? ? ? "
Expand All @@ -601,5 +612,4 @@ class ControlsRandomizer

NativeManager::AddNative (0xC00510201122022, SetControlSwapState);
}
};
//controls;
} controls;

0 comments on commit 7bcf20b

Please sign in to comment.