Skip to content

Commit

Permalink
Instantaneous Weapon Switching & Native player rotator Saints Row (#49)
Browse files Browse the repository at this point in the history
* insta switch test

* A fix for empty slots, Hack/Workaround for selectable weapons function.

* Extra tweaks / cheaks

* extra map open flag for taxis, and remove old comments

* swap_wheel for weapon wheel again, simplify calling function

* Native mouse input for rotating player in Customization menus

* Rotation for vehicles in rim jobs and zoom support.

* Move Rotating Player addresses to the map, IsPlayerStatus1 function in the backburner if accurate weapon scrolling to SR2's PC port is desired

* bool-ify RotatePlayerinCustomization, added paused world flag so rotation doesn't break

* MP checks, and clamp Y axis

* Dynamic clamping for Saints Row 2

* More accurate fine aim flag

* Remove Havok frametime fix for Saints Row 1
xenia-canary/game-patches#355

* Disable RS emulation when in spin contexts

* Remove havok_fix_frametime entirely.
xenia-canary/game-patches@b4bf741

* New bindings for 1-9 binds

* Correct taxi flag

---------

Co-authored-by: Clippy95 <[email protected]>
  • Loading branch information
2 people authored and marinesciencedude committed Jan 3, 2025
1 parent cab497d commit 62912b0
Show file tree
Hide file tree
Showing 6 changed files with 349 additions and 133 deletions.
61 changes: 40 additions & 21 deletions bindings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -92,23 +92,34 @@ F = Y
R = A
Space = X
V = LB
1 = Up
2 = Down
3 = Left
4 = Right
X = Up
Z = Down
Left = Left
Right = Right
T = Left
Y = Right
LShift = RB
;Tidle on US keyboard "`"
' = Start
Enter = Start
;Back is unused but for any mods that utilize it.
P = Back
Up = RS-Up
Down = RS-Down
Left = RS-Left
Right = RS-Right
O = RS-Up
L = RS-Down
k = RS-Left
; = RS-Right
B = RS
H = RS
1 = weapon1
2 = weapon2
3 = weapon3
4 = weapon4
5 = weapon5
6 = weapon6
7 = weapon7
8 = weapon8
9 = weapon9
0 = weapon10
[545107D1 Vehicle - Saints Row 1]
W = A
Expand All @@ -119,34 +130,42 @@ Q = LB
E = RB
CapsLock = RS
Ctrl = LS
C = LS
B = RS
H = RS
H = LS
LClick = RT
RClick = LT
Mouse5 = B
Tab = B
F = Y
R = A
Space = LT
V = LB
1 = Up
2 = Down
3 = Left
4 = Right
X = Up
Z = Down
MWheelDown = Left
MWheelUp = Right
Left = Left
Right = Right
C = Left
V = Right
T = Left
Y = Right
LShift = RB
;Tidle on US keyboard "`"
' = Start
Enter = Start
;Back is unused but for any mods that utilize it.
P = Back
Up = RS-Up
Down = RS-Down
Left = RS-Left
Right = RS-Right
O = RS-Up
L = RS-Down
k = RS-Left
; = RS-Right
1 = weapon1
2 = weapon2
3 = weapon3
4 = weapon4
5 = weapon5
6 = weapon6
7 = weapon7
8 = weapon8
9 = weapon9

[555307DC Default - Far Cry Instincts Predator]
CapsLock = Modifier
Expand Down
33 changes: 3 additions & 30 deletions src/xenia/emulator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,6 @@ DEFINE_bool(
"(Saints Row 2) Switches fineaim (ADS) from a toggle to hold press.",
"MouseHook");

DEFINE_bool(sr_havok_fix_frametime, false,
"(Saints Row 1&2) Fixes cutscene object synchronization and doors "
"teleporting on high fps, as seen in Juiced Patch. (Causes "
"Performance loss at a higher FPSes.) ",
"MouseHook");

DEFINE_bool(sr1_increase_vehicle_rotation_limit, true,
"(Saints Row 1) Patch vehicle vertical rotation limit to be mostly "
"the same "
Expand Down Expand Up @@ -1692,8 +1686,6 @@ X_STATUS Emulator::CompleteLaunch(const std::filesystem::path& path,
uint32_t mousefix_addr2;
uint32_t mousefix_addr3;
uint32_t aim_assist_xbtl; // File declares aim_assist values.
uint32_t havok_write_frametime_address1;
uint32_t havok_write_frametime_address2;
uint32_t vehicle_rotationXWrite_addr_start; // lfs f0, (flt_827F9B04 -
// 0x827F99A0)(r31) -- no
// idea how I figured this,
Expand All @@ -1706,15 +1698,12 @@ X_STATUS Emulator::CompleteLaunch(const std::filesystem::path& path,
uint32_t min_float_addr_lis1;
uint32_t write_max_value1; // making it same as on-foot causes the camera
// to clip.
uint32_t havok_value_address;
uint32_t fps_1over60_value;
};
std::vector<SR1PatchOffsets> supported_builds = {
// TU1 Release build
{0x82050304, 0x7361696E, 0x60000000, 0x8249db00, 0x8249dd28, 0x8249dd50,
0x82079cbc, 0x82195324, 0x8225BD8C, 0x8211D604, 0x82772D90, 0x8211FC8C,
0x82772DB0, 0xC108C88C, 0xC00BC88C, 0xC0C8B850, 0x8208C88C, 0x835F2684,
0x3c888889},
0x82079cbc, 0x8211D604, 0x82772D90, 0x8211FC8C, 0x82772DB0, 0xC108C88C,
0xC00BC88C, 0xC0C8B850, 0x8208C88C},
};
for (auto& build : supported_builds) {
auto* test_addr = (xe::be<uint32_t>*)module->memory()->TranslateVirtual(
Expand All @@ -1729,14 +1718,6 @@ X_STATUS Emulator::CompleteLaunch(const std::filesystem::path& path,
if (cvars::disable_autoaim && build.aim_assist_xbtl) {
patch_addr(build.aim_assist_xbtl, build.beNOP);
}
if (cvars::sr_havok_fix_frametime &&
build.havok_write_frametime_address1 &&
build.havok_write_frametime_address2) {
patch_addr(build.havok_write_frametime_address1, build.beNOP);
patch_addr(build.havok_write_frametime_address2, build.beNOP);
// in case user boots game with inputs other than winkey.
patch_addr(build.havok_value_address, build.fps_1over60_value);
}
if (cvars::sr_better_drive_cam &&
build.vehicle_rotationXWrite_addr_start) {
uint32_t addr = build.vehicle_rotationXWrite_addr_start;
Expand Down Expand Up @@ -1804,9 +1785,6 @@ X_STATUS Emulator::CompleteLaunch(const std::filesystem::path& path,
uint32_t Vehicle_RotationXWrite_addr1;
uint32_t Vehicle_RotationXWrite_addr2; // Handbrake.
uint32_t aim_assist_xbtl; // File declares aim_assist values.
uint32_t havok_write_frametime_address1;
uint32_t havok_value_address;
uint32_t fps_1over60_value;
};

std::vector<SR2PatchOffsets> supported_builds = {
Expand All @@ -1816,8 +1794,7 @@ X_STATUS Emulator::CompleteLaunch(const std::filesystem::path& path,
0x8247832c, 0x821a4b84, 0x824e6a68, 0x824e7f50, 0x824e6b8c, 0x82478934,
0x824e6b2c, 0x82478330, 0x82478094, 0x821a4b88, 0x82B7A5AC, 0x82B7A5A8,
0x82B77C04, 0x82B77C08, 0x82B77C0C, 0x82B77C08, 0x82B77C10, 0x821A4D20,
0x821A4D18, 0x821a1f74, 0x821A2A2C, 0x820A61C0, 0x8221CEAC, 0x837DB620,
0x3c888889},
0x821A4D18, 0x821a1f74, 0x821A2A2C, 0x820A61C0},
};

for (auto& build : supported_builds) {
Expand Down Expand Up @@ -1868,10 +1845,6 @@ X_STATUS Emulator::CompleteLaunch(const std::filesystem::path& path,
if (cvars::disable_autoaim && build.aim_assist_xbtl) {
patch_addr(build.aim_assist_xbtl, build.beNOP);
}
if (cvars::sr_havok_fix_frametime && build.havok_write_frametime_address1)
patch_addr(build.havok_write_frametime_address1, build.beNOP);
// in case user boots game with inputs other than winkey.
patch_addr(build.havok_value_address, build.fps_1over60_value);
break;
}
}
Expand Down
Loading

0 comments on commit 62912b0

Please sign in to comment.