Skip to content

Commit 0b1e386

Browse files
committed
DefaultManualTransmission: makes MT the default selection in C2C menus
1 parent a43403e commit 0b1e386

File tree

9 files changed

+54
-6
lines changed

9 files changed

+54
-6
lines changed

OutRun2006Tweaks.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ SteeringDeadZone = 0.2
3737
# IF YOU HAVE ISSUES WITH GAME DETECTING CONTROLLER: try disabling this!
3838
ControllerHotPlug = true
3939

40+
# Makes Manual Transmission the default selection in C2C menus
41+
# (the menu animation will briefly show as Automatic, but Manual will be selected - spamming through menus will select Manual by default)
42+
DefaultManualTransmission = false
43+
4044
# Allows assigning a keyboard key to toggle the game HUD
4145
# Depends on your keyboard layout which keys can be assigned here, some might work as-is (eg. P to bind it to P, or HOME to bind to Home)
4246
# Binding to a function key such as F10 should work fine on all keyboard layouts

external/ModUtils

Submodule ModUtils updated 1 file

src/dllmain.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,14 @@ namespace Settings
104104

105105
spdlog::info(" - SteeringDeadZone: {}", SteeringDeadZone);
106106
spdlog::info(" - ControllerHotPlug: {}", ControllerHotPlug);
107+
spdlog::info(" - DefaultManualTransmission: {}", DefaultManualTransmission);
107108
spdlog::info(" - VibrationMode: {}", VibrationMode);
108109
spdlog::info(" - VibrationStrength: {}", VibrationStrength);
109110
spdlog::info(" - VibrationControllerId: {}", VibrationControllerId);
110111
spdlog::info(" - ImpulseVibrationMode: {}", ImpulseVibrationMode);
111112
spdlog::info(" - ImpulseVibrationLeftMultiplier: {}", ImpulseVibrationLeftMultiplier);
112113
spdlog::info(" - ImpulseVibrationRightMultiplier: {}", ImpulseVibrationRightMultiplier);
113114

114-
115115
spdlog::info(" - EnableHollyCourse2: {}", EnableHollyCourse2);
116116
spdlog::info(" - SkipIntroLogos: {}", SkipIntroLogos);
117117
spdlog::info(" - DisableCountdownTimer: {}", DisableCountdownTimer);
@@ -216,6 +216,7 @@ namespace Settings
216216
SteeringDeadZone = ini.Get("Controls", "SteeringDeadZone", std::move(SteeringDeadZone));
217217
SteeringDeadZone = std::clamp(SteeringDeadZone, 0.f, 1.f);
218218
ControllerHotPlug = ini.Get("Controls", "ControllerHotPlug", std::move(ControllerHotPlug));
219+
DefaultManualTransmission = ini.Get("Controls", "DefaultManualTransmission", std::move(DefaultManualTransmission));
219220
HudToggleKey = ini.Get("Controls", "HudToggleKey", std::move(HudToggleKey));
220221
VibrationMode = ini.Get("Controls", "VibrationMode", std::move(VibrationMode));
221222
VibrationMode = std::clamp(VibrationMode, 0, 3);

src/hooks_flac.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <fstream>
77
#include <FLAC/stream_decoder.h>
88

9+
// CWaveFile class used in C2C, seems based on DirectX DXUTsound.cpp code
910
class CWaveFile
1011
{
1112
public:

src/hooks_misc.cpp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,47 @@
99
#include <upnpcommands.h>
1010
#include <WinSock2.h>
1111

12+
class DefaultManualTransmission : public Hook
13+
{
14+
inline static SafetyHookInline Sumo_TransmissionSelection_Init{};
15+
static char __fastcall destination2(uint8_t* thisptr)
16+
{
17+
char ret = Sumo_TransmissionSelection_Init.thiscall<char>(thisptr);
18+
19+
*(int*)(thisptr + 0xE4) = 0; // prev selection = auto
20+
*(int*)(thisptr + 0xE8) = 1; // current selection = manual
21+
22+
// This can force sprite to update to manual immediately, which should improve presentation
23+
// but this causes it to draw transmision menu while the animation for opening it plays out
24+
// (that anim also seems to show automatic selected despite this update, maybe the graphic for that animation has it selected...)
25+
//fn_0args_class sub_51BE30 = (fn_0args_class)0x51BE30;
26+
//sub_51BE30(thisptr + 0x34, 0);
27+
28+
return ret;
29+
}
30+
31+
public:
32+
std::string_view description() override
33+
{
34+
return "DefaultManualTransmission";
35+
}
36+
37+
bool validate() override
38+
{
39+
return Settings::DefaultManualTransmission;
40+
}
41+
42+
bool apply() override
43+
{
44+
Sumo_TransmissionSelection_Init = safetyhook::create_inline(Module::exe_ptr(0xDD250), destination2);
45+
46+
return !!Sumo_TransmissionSelection_Init;
47+
}
48+
49+
static DefaultManualTransmission instance;
50+
};
51+
DefaultManualTransmission DefaultManualTransmission::instance;
52+
1253
class EnableHollyCourse2 : public Hook
1354
{
1455
// TODO: Percentage might not be affected by the holly 2 missions atm, letting it go above 100% might be neat

src/plugin.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ namespace Settings
9595

9696
inline float SteeringDeadZone = 0.2f;
9797
inline bool ControllerHotPlug = true;
98+
inline bool DefaultManualTransmission = false;
9899
inline std::string HudToggleKey = "";
99100
inline int VibrationMode = 0;
100101
inline int VibrationStrength = 10;

src/resource.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
#endif
1515

1616
#define MODULE_VERSION_MAJOR 0
17-
#define MODULE_VERSION_MINOR 5
18-
#define MODULE_VERSION_BUILD 1
17+
#define MODULE_VERSION_MINOR 6
18+
#define MODULE_VERSION_BUILD 0
1919
#define MODULE_VERSION_REVISION 0
2020

2121
#define STR(value) #value

0 commit comments

Comments
 (0)