Skip to content

Commit

Permalink
DefaultManualTransmission: makes MT the default selection in C2C menus
Browse files Browse the repository at this point in the history
  • Loading branch information
emoose committed Aug 30, 2024
1 parent a43403e commit 0b1e386
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 6 deletions.
4 changes: 4 additions & 0 deletions OutRun2006Tweaks.ini
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ SteeringDeadZone = 0.2
# IF YOU HAVE ISSUES WITH GAME DETECTING CONTROLLER: try disabling this!
ControllerHotPlug = true

# Makes Manual Transmission the default selection in C2C menus
# (the menu animation will briefly show as Automatic, but Manual will be selected - spamming through menus will select Manual by default)
DefaultManualTransmission = false

# Allows assigning a keyboard key to toggle the game HUD
# 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)
# Binding to a function key such as F10 should work fine on all keyboard layouts
Expand Down
2 changes: 1 addition & 1 deletion external/ModUtils
Submodule ModUtils updated 1 files
+1 −0 Patterns.h
2 changes: 1 addition & 1 deletion external/xxHash
3 changes: 2 additions & 1 deletion src/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ namespace Settings

spdlog::info(" - SteeringDeadZone: {}", SteeringDeadZone);
spdlog::info(" - ControllerHotPlug: {}", ControllerHotPlug);
spdlog::info(" - DefaultManualTransmission: {}", DefaultManualTransmission);
spdlog::info(" - VibrationMode: {}", VibrationMode);
spdlog::info(" - VibrationStrength: {}", VibrationStrength);
spdlog::info(" - VibrationControllerId: {}", VibrationControllerId);
spdlog::info(" - ImpulseVibrationMode: {}", ImpulseVibrationMode);
spdlog::info(" - ImpulseVibrationLeftMultiplier: {}", ImpulseVibrationLeftMultiplier);
spdlog::info(" - ImpulseVibrationRightMultiplier: {}", ImpulseVibrationRightMultiplier);


spdlog::info(" - EnableHollyCourse2: {}", EnableHollyCourse2);
spdlog::info(" - SkipIntroLogos: {}", SkipIntroLogos);
spdlog::info(" - DisableCountdownTimer: {}", DisableCountdownTimer);
Expand Down Expand Up @@ -216,6 +216,7 @@ namespace Settings
SteeringDeadZone = ini.Get("Controls", "SteeringDeadZone", std::move(SteeringDeadZone));
SteeringDeadZone = std::clamp(SteeringDeadZone, 0.f, 1.f);
ControllerHotPlug = ini.Get("Controls", "ControllerHotPlug", std::move(ControllerHotPlug));
DefaultManualTransmission = ini.Get("Controls", "DefaultManualTransmission", std::move(DefaultManualTransmission));
HudToggleKey = ini.Get("Controls", "HudToggleKey", std::move(HudToggleKey));
VibrationMode = ini.Get("Controls", "VibrationMode", std::move(VibrationMode));
VibrationMode = std::clamp(VibrationMode, 0, 3);
Expand Down
1 change: 1 addition & 0 deletions src/hooks_flac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <fstream>
#include <FLAC/stream_decoder.h>

// CWaveFile class used in C2C, seems based on DirectX DXUTsound.cpp code
class CWaveFile
{
public:
Expand Down
41 changes: 41 additions & 0 deletions src/hooks_misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,47 @@
#include <upnpcommands.h>
#include <WinSock2.h>

class DefaultManualTransmission : public Hook
{
inline static SafetyHookInline Sumo_TransmissionSelection_Init{};
static char __fastcall destination2(uint8_t* thisptr)
{
char ret = Sumo_TransmissionSelection_Init.thiscall<char>(thisptr);

*(int*)(thisptr + 0xE4) = 0; // prev selection = auto
*(int*)(thisptr + 0xE8) = 1; // current selection = manual

// This can force sprite to update to manual immediately, which should improve presentation
// but this causes it to draw transmision menu while the animation for opening it plays out
// (that anim also seems to show automatic selected despite this update, maybe the graphic for that animation has it selected...)
//fn_0args_class sub_51BE30 = (fn_0args_class)0x51BE30;
//sub_51BE30(thisptr + 0x34, 0);

return ret;
}

public:
std::string_view description() override
{
return "DefaultManualTransmission";
}

bool validate() override
{
return Settings::DefaultManualTransmission;
}

bool apply() override
{
Sumo_TransmissionSelection_Init = safetyhook::create_inline(Module::exe_ptr(0xDD250), destination2);

return !!Sumo_TransmissionSelection_Init;
}

static DefaultManualTransmission instance;
};
DefaultManualTransmission DefaultManualTransmission::instance;

class EnableHollyCourse2 : public Hook
{
// TODO: Percentage might not be affected by the holly 2 missions atm, letting it go above 100% might be neat
Expand Down
1 change: 1 addition & 0 deletions src/plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ namespace Settings

inline float SteeringDeadZone = 0.2f;
inline bool ControllerHotPlug = true;
inline bool DefaultManualTransmission = false;
inline std::string HudToggleKey = "";
inline int VibrationMode = 0;
inline int VibrationStrength = 10;
Expand Down
4 changes: 2 additions & 2 deletions src/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#endif

#define MODULE_VERSION_MAJOR 0
#define MODULE_VERSION_MINOR 5
#define MODULE_VERSION_BUILD 1
#define MODULE_VERSION_MINOR 6
#define MODULE_VERSION_BUILD 0
#define MODULE_VERSION_REVISION 0

#define STR(value) #value
Expand Down

0 comments on commit 0b1e386

Please sign in to comment.