Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions source/vlikestuntcam.ixx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
module;

#include <common.hxx>

export module vlikestuntcam;

import common;
import natives;

injector::hook_back<const wchar_t* (__fastcall*)(void*, void*, const char*)> hbgetUSJ_FRST;
void __fastcall getUSJ_FRST(void* _this, void* edx, const char* key)
{
if (!Natives::IsUsingController())
key = "USJ_FRST_KMB";
hbgetUSJ_FRST.fun(_this, edx, key);
}

class VLikeStuntCam
{
public:
VLikeStuntCam()
{
FusionFix::onInitEvent() += []()
{
//128 = min speed, -128 = maxSpeed
static float camSpeed = 128.0f;
static bool canSwitchRadio = true;

auto pattern = find_pattern("8D 8F D8 29 00 00 E8");
static auto sub_E8CB90_1 = safetyhook::create_mid(pattern.get_first(6), [](SafetyHookContext& regs)
{
if (!canSwitchRadio)
*(int8_t*)(regs.ecx + 6) = 0;
});

pattern = find_pattern("8D 8F E8 29 00 00 E8");
static auto sub_E8CB90_2 = safetyhook::create_mid(pattern.get_first(6), [](SafetyHookContext& regs)
{
if (!canSwitchRadio)
*(int8_t*)(regs.ecx + 6) = 0;
});


//reset back to defaults
pattern = find_pattern("E8 ? ? ? ? C7 05 ? ? ? ? CD CC 4C 3E C3", "E8 ? ? ? ? F3 0F 10 05 ? ? ? ? F3 0F 11 05 ? ? ? ? C3");
static auto CIntermezzoEventStuntJump__virtual0x8Hook = safetyhook::create_mid(pattern.get_first(), [](SafetyHookContext& regs)
{
camSpeed = 128.0f;
canSwitchRadio = true;
});

pattern = find_pattern("F3 0F 5C 05 ? ? ? ? 0F 2F C2 76 16 F3 0F 59 05", "F3 0F 5C 05 ? ? ? ? 0F 57 D2 0F 2F C2");
static auto CIntermezzoEventStuntJump__virtual0x4Hook = safetyhook::create_mid(pattern.get_first(), [](SafetyHookContext& regs)
{
int32_t wheel;
Natives::GetMouseWheel(&wheel);

camSpeed = std::clamp(camSpeed + float(wheel / 4), -128.0f, 128.0f);
canSwitchRadio = false;

regs.xmm0.f32[0] = camSpeed;
});

pattern = find_pattern("E8 ? ? ? ? 50 B9 ? ? ? ? E8 ? ? ? ? 6A 00 6A 00 6A 01", "E8 ? ? ? ? 50 B9 ? ? ? ? E8 ? ? ? ? 6A 00 6A 00 6A 01");
hbgetUSJ_FRST.fun = injector::MakeCALL(pattern.get_first(0), getUSJ_FRST, true).get();

pattern = find_pattern("E8 ? ? ? ? 50 E8 ? ? ? ? 83 C4 40", "E8 ? ? ? ? 50 E8 ? ? ? ? 83 C4 40");
hbgetUSJ_FRST.fun = injector::MakeCALL(pattern.get_first(0), getUSJ_FRST, true).get();
};
}
} VLikeStuntCam;
3 changes: 3 additions & 0 deletions text/americanFF.txt
Original file line number Diff line number Diff line change
Expand Up @@ -202,5 +202,8 @@ Police Buffalo
[FF_WARN7]
~r~WARNING: Set Cutscene Audio Sync ON if you have audio desynchronization, OFF for animation smoothness. It can be toggled in a cutscene via ~PAD_UP~

[USJ_FRST_KMB]
During the stunt camera mode use ~INPUT_MOUSE_WHEEL_UP~ and ~INPUT_MOUSE_WHEEL_DOWN~ to control the slow motion speed.

[DUMMY_l11]
Dummy label.
3 changes: 3 additions & 0 deletions text/frenchFF.txt
Original file line number Diff line number Diff line change
Expand Up @@ -199,5 +199,8 @@ Police Buffalo
[FF_WARN7]
~r~AVERTISSEMENT : Utilisez la synchronisation audio des cinématiques sur ON en cas de désynchronisation audio, sur OFF pour la fluidité de l'animation. Peut être changer en cinématique via ~PAD_UP~.

[USJ_FRST_KMB]
Lorsque la caméra passe en mode saut unique, utilise ~INPUT_MOUSE_WHEEL_UP~ et ~INPUT_MOUSE_WHEEL_DOWN~ pour modifier la vitesse du ralenti.

[DUMMY_l11]
Option fictive.
3 changes: 3 additions & 0 deletions text/germanFF.txt
Original file line number Diff line number Diff line change
Expand Up @@ -202,5 +202,8 @@ Polizei-Buffalo
[FF_WARN7]
~r~ACHTUNG: "Synchronen Ton in Zwischensequenzen erzwingen" nur bei auffallend asynchronem Ton aktivieren, für flüssige Animationen deaktiviert lassen. Kann während Zwischensequenzen mit ~PAD_UP~ ein- und ausgeschaltet werden.

[USJ_FRST_KMB]
Verwende während der Stuntkamera ~INPUT_MOUSE_WHEEL_UP~ und ~INPUT_MOUSE_WHEEL_DOWN~, um das Zeitlupentempo zu regulieren.

[DUMMY_l11]
Dummy label.
3 changes: 3 additions & 0 deletions text/italianFF.txt
Original file line number Diff line number Diff line change
Expand Up @@ -202,5 +202,8 @@ Buffalo polizia
[FF_WARN7]
~r~ATTENZIONE: Attiva la sincronizzazione audio cinematiche se riscontri desincronizzazione audio, disattivala per la fluidità delle animazioni. Può essere attivata/disattivata in una cinematica tramite ~PAD_UP~.

[USJ_FRST_KMB]
Durante la visualizzazione delle acrobazie usa ~INPUT_MOUSE_WHEEL_UP~ e ~INPUT_MOUSE_WHEEL_DOWN~ per controllare lo slow motion.

[DUMMY_l11]
Dummy label.
3 changes: 3 additions & 0 deletions text/japaneseFF.txt
Original file line number Diff line number Diff line change
Expand Up @@ -199,5 +199,8 @@ FPSリミッター
[FF_WARN7]
~r~警告: 音ズレが発生する場合はカットシーンの音声同期をONに、アニメーションを滑らかにするにはOFFにしてください。カットシーン中に~PAD_UP~で切り替えられます。

[USJ_FRST_KMB]
スタントカメラモード中は~INPUT_MOUSE_WHEEL_UP~と~INPUT_MOUSE_WHEEL_DOWN~で スローモーションの速度を調節できる

[DUMMY_l11]
Dummy label.
3 changes: 3 additions & 0 deletions text/russianFF.txt
Original file line number Diff line number Diff line change
Expand Up @@ -202,5 +202,8 @@ GTA IV необходимо перезапустить для применени
[FF_WARN7]
~r~ПРЕДУПРЕЖДЕНИЕ: Включите синхронизацию аудио в катсценах, если у вас возникает рассинхронизация звука, выключите для плавности анимации. Режим можно переключить во время катсцены с помощью ~PAD_UP~.

[USJ_FRST_KMB]
При выполнении трюков используйте ~INPUT_MOUSE_WHEEL_UP~ и ~INPUT_MOUSE_WHEEL_DOWN~ для управления скоростью замедленного движения.

[DUMMY_l11]
Dummy label.
3 changes: 3 additions & 0 deletions text/spanishFF.txt
Original file line number Diff line number Diff line change
Expand Up @@ -202,5 +202,8 @@ Buffalo policía
[FF_WARN7]
~r~NOTA: Activa la sincronización de audio de las escenas cinemáticas si tienes desincronización de audio, y desactívala para que la animación sea más fluida. Se puede activar o desactivar en una escena cinemática con ~PAD_UP~.

[USJ_FRST_KMB]
Durante el modo cámara acrobática, usa ~INPUT_MOUSE_WHEEL_UP~ y ~INPUT_MOUSE_WHEEL_DOWN~ para controlar la velocidad de la cámara lenta.

[DUMMY_l11]
Dummy label.