@@ -31,8 +31,9 @@ void BattleFixes::OnSetSongtimer(SafetyHookContext& regs) {
3131
3232void BattleFixes::OnCheckMeasurelineAppear (SafetyHookContext& regs) {
3333 BattleFixes& battleFixes = *(BattleFixes*)(LR2HackBox::Get ().mBattleFixes .get ());
34+ LR2::game& game = *LR2HackBox::Get ().GetGame ();
35+ if (!battleFixes.mIsEnabled || game.config .play .battle != 1 ) return ;
3436 battleFixes.lastLineBmstime = *(double *)regs.ecx ;
35- if (!battleFixes.mIsEnabled ) return ;
3637 double highestTimer = std::max (battleFixes.songtimerP1 , battleFixes.songtimerP2 );
3738 __asm {
3839 FFREEP ST (0 )
@@ -42,7 +43,8 @@ void BattleFixes::OnCheckMeasurelineAppear(SafetyHookContext& regs) {
4243
4344void BattleFixes::OnSetBattleP2Y (SafetyHookContext& regs) {
4445 BattleFixes& battleFixes = *(BattleFixes*)(LR2HackBox::Get ().mBattleFixes .get ());
45- if (!battleFixes.mIsEnabled ) return ;
46+ LR2::game& game = *LR2HackBox::Get ().GetGame ();
47+ if (!battleFixes.mIsEnabled || game.config .play .battle != 1 ) return ;
4648 double p2timer = battleFixes.songtimerP2 ;
4749 __asm {
4850 FFREEP ST (0 )
@@ -52,7 +54,8 @@ void BattleFixes::OnSetBattleP2Y(SafetyHookContext& regs) {
5254
5355void BattleFixes::OnCheckMeasurelineDisappear (SafetyHookContext& regs) {
5456 BattleFixes& battleFixes = *(BattleFixes*)(LR2HackBox::Get ().mBattleFixes .get ());
55- if (!battleFixes.mIsEnabled ) return ;
57+ LR2::game& game = *LR2HackBox::Get ().GetGame ();
58+ if (!battleFixes.mIsEnabled || game.config .play .battle != 1 ) return ;
5659 constexpr unsigned short CMP_FALSE = 30759 ;
5760 constexpr unsigned short CMP_TRUE = 14375 ;
5861 double lowestTimer = std::min (battleFixes.songtimerP1 , battleFixes.songtimerP2 );
@@ -83,7 +86,8 @@ void BattleFixes::OnSetBpmChangedBmstime(SafetyHookContext& regs) {
8386
8487int BattleFixes::OnAddDrawingBuffer_PlayArea (LR2::DrawingBuf* drb, LR2::SRCstruct* src, LR2::DSTstruct* dst, LR2::Timer* T, float shiftX, float shiftY, int alpha, float sizeX, float sizeY, char flag) {
8588 BattleFixes& battleFixes = *(BattleFixes*)(LR2HackBox::Get ().mBattleFixes .get ());
86- if (!battleFixes.mIsEnabled || battleFixes.lastLineBmstime < 0 .) return battleFixes.oAddDrawingBuffer_PlayArea .ccall <int >(drb, src, dst, T, shiftX, shiftY, alpha, sizeX, sizeY, flag);
89+ LR2::game& game = *LR2HackBox::Get ().GetGame ();
90+ if (!battleFixes.mIsEnabled || game.config .play .battle != 1 || battleFixes.lastLineBmstime < 0 .) return battleFixes.oAddDrawingBuffer_PlayArea .ccall <int >(drb, src, dst, T, shiftX, shiftY, alpha, sizeX, sizeY, flag);
8791 uintptr_t returnAddress = (uintptr_t )_ReturnAddress ();
8892 switch (returnAddress) {
8993 case 0x406FF6 :
@@ -124,7 +128,7 @@ void BattleFixes::OnCheckAutoadjustCondition(SafetyHookContext& regs) {
124128 BattleFixes& battleFixes = *(BattleFixes*)(LR2HackBox::Get ().mBattleFixes .get ());
125129 LR2::game& game = *LR2HackBox::Get ().GetGame ();
126130 GameOptions& options = *(GameOptions*)(LR2HackBox::Get ().mGameOptions .get ());
127- if (!battleFixes.mIsEnabled && game.config .play .battle != 1 ) return ;
131+ if (!battleFixes.mIsEnabled || game.config .play .battle != 1 ) return ;
128132 if (game.config .play .autojudge && game.gameplay .autojudge_midcount > 9 ) {
129133 if (game.gameplay .autojudge_midsum > 0 ) game.config .play .judgetiming ++;
130134 else if (game.gameplay .autojudge_midsum < 0 ) game.config .play .judgetiming --;
@@ -144,7 +148,7 @@ void BattleFixes::OnCheckAutoadjustCondition(SafetyHookContext& regs) {
144148void BattleFixes::OnCheckMousewheelLanecover (SafetyHookContext& regs) {
145149 BattleFixes& battleFixes = *(BattleFixes*)(LR2HackBox::Get ().mBattleFixes .get ());
146150 LR2::game& game = *LR2HackBox::Get ().GetGame ();
147- if (!battleFixes.mIsEnabled ) return ;
151+ if (!battleFixes.mIsEnabled || game. config . play . battle != 1 ) return ;
148152 int & mouseWheel = game.KeyInput .mousewheel ;
149153 if (game.config .play .p1_lanecover == 1 ) {
150154 if (game.KeyInput .p2_buttonInput [12 ] || game.KeyInput .p2_buttonInput [13 ]) {
0 commit comments