Skip to content

Commit

Permalink
Allow skipping legal screen while still showing intros
Browse files Browse the repository at this point in the history
  • Loading branch information
TheIndra55 committed Apr 28, 2024
1 parent 02d22c4 commit 1d542b3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/modules/Patches.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Patches::Patches()
s_menu = Hook::GetInstance().GetModule<MainMenu>().get();

#ifndef TR8
if (m_disableIntro.GetValue())
if (m_disableIntro.GetValue() > Disabled)
{
RemoveIntro();
}
Expand Down Expand Up @@ -122,12 +122,16 @@ void Patches::RemoveIntro() const noexcept
auto match = hook::pattern("8D 0C 8D 03 00 00 00 89 0D").count(1);
auto mainState = *match.get_first<int>(9);

// Set new state to either main menu or intros
auto newState = m_disableIntro.GetValue() == SkipIntros ? 6 : 3;

// Nop out the code setting the main state to intros
Hooking::Nop(match.get_first(), 13);

// mov [mainState], 6
Hooking::Patch(match.get_first(), { 0xC7, 0x05, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00 });
// mov [mainState], newState
Hooking::Patch(match.get_first(), { 0xC7, 0x05, 0x00, 0x00, 0x00, 0x00 });
Hooking::Patch(match.get_first(2), mainState);
Hooking::Patch(match.get_first(6), newState);
}

void Patches::PatchHeapSize() const noexcept
Expand Down
9 changes: 8 additions & 1 deletion src/modules/Patches.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,17 @@ class Patch
}
};

enum IntroSkip
{
Disabled,
SkipLegal,
SkipIntros
};

class Patches : public Module
{
private:
Option<bool> m_disableIntro{ "DisableIntro", true };
Option<IntroSkip> m_disableIntro{ "IntroSkip", SkipLegal };
Option<bool> m_noCinematicBars{ "NoCinematicBars", true };
Option<bool> m_noMotionBlur{ "NoMotionBlur", false };

Expand Down

0 comments on commit 1d542b3

Please sign in to comment.