Skip to content

Commit

Permalink
Merge commit 'refs/pull/35/head' of https://github.com/shiiion/dolphin
Browse files Browse the repository at this point in the history
  • Loading branch information
SirMangler committed Dec 25, 2020
2 parents 24b8a5f + 478dc67 commit 49ca7b9
Show file tree
Hide file tree
Showing 12 changed files with 170 additions and 5 deletions.
1 change: 1 addition & 0 deletions Source/Core/Core/ConfigManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ struct SConfig
bool bPrimeNoclip = false;
bool bPrimeInvulnerability = false;
bool bPrimeSkipCutscene = false;
bool bPrimeRestoreDashing = false;

// Interface settings
bool bConfirmStop = false;
Expand Down
1 change: 1 addition & 0 deletions Source/Core/Core/Core.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,7 @@
<ClInclude Include="PrimeHack\Mods\ContextSensitiveControls.h" />
<ClInclude Include="PrimeHack\Mods\Invulnerability.h" />
<ClInclude Include="PrimeHack\Mods\Noclip.h" />
<ClInclude Include="PrimeHack\Mods\RestoreDashing.h" />
<ClInclude Include="PrimeHack\Mods\SkipCutscene.h" />
<ClInclude Include="PrimeHack\Mods\SpringballButton.h" />
<ClInclude Include="PrimeHack\Mods\ViewModifier.h" />
Expand Down
3 changes: 3 additions & 0 deletions Source/Core/Core/Core.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -1837,6 +1837,9 @@
<ClInclude Include="PrimeHack\HackManager.h">
<Filter>PrimeHack</Filter>
</ClInclude>
<ClInclude Include="PrimeHack\Mods\RestoreDashing.h">
<Filter>PrimeHack\Mods</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Text Include="CMakeLists.txt" />
Expand Down
5 changes: 3 additions & 2 deletions Source/Core/Core/HotkeyManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "InputCommon/GCPadStatus.h"

// clang-format off
constexpr std::array<const char*, 143> s_hotkey_labels{{
constexpr std::array<const char*, 144> s_hotkey_labels{{
_trans("Open"),
_trans("Change Disc"),
_trans("Eject Disc"),
Expand Down Expand Up @@ -196,6 +196,7 @@ constexpr std::array<const char*, 143> s_hotkey_labels{{
_trans("Toggle Noclip"),
_trans("Toggle Invulnerability"),
_trans("Toggle Skippable Cutscenes"),
_trans("Toggle Dashing Restoration"),
_trans("Toggle Lock Camera In Motion Puzzles")
}};
// clang-format on
Expand Down Expand Up @@ -354,7 +355,7 @@ constexpr std::array<HotkeyGroupInfo, NUM_HOTKEY_GROUPS> s_groups_info = {
{_trans("Select State"), HK_SELECT_STATE_SLOT_1, HK_SELECT_STATE_SLOT_10},
{_trans("Load Last State"), HK_LOAD_LAST_STATE_1, HK_LOAD_LAST_STATE_10},
{_trans("Other State Hotkeys"), HK_SAVE_FIRST_STATE, HK_LOAD_STATE_FILE},
{_trans("PrimeHack Cheats"), HK_NOCLIP_TOGGLE, HK_SKIP_CUTSCENE},
{_trans("PrimeHack Cheats"), HK_NOCLIP_TOGGLE, HK_RESTORE_DASHING},
{_trans("PrimeHack Graphics"), HK_MOTION_LOCK, HK_MOTION_LOCK}}};

HotkeyManager::HotkeyManager()
Expand Down
1 change: 1 addition & 0 deletions Source/Core/Core/HotkeyManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ enum Hotkey
HK_NOCLIP_TOGGLE,
HK_INVULNERABILITY_TOGGLE,
HK_SKIP_CUTSCENE,
HK_RESTORE_DASHING,
HK_MOTION_LOCK,

NUM_HOTKEYS,
Expand Down
6 changes: 6 additions & 0 deletions Source/Core/Core/PrimeHack/HackConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "Core/PrimeHack/Mods/CutBeamFxMP1.h"
#include "Core/PrimeHack/Mods/DisableBloom.h"
#include "Core/PrimeHack/Mods/FpsControls.h"
#include "Core/PrimeHack/Mods/RestoreDashing.h"
#include "Core/PrimeHack/Mods/Invulnerability.h"
#include "Core/PrimeHack/Mods/Noclip.h"
#include "Core/PrimeHack/Mods/SkipCutscene.h"
Expand Down Expand Up @@ -51,6 +52,7 @@ void InitializeHack() {
hack_mgr.add_mod("invulnerability", std::make_unique<Invulnerability>());
hack_mgr.add_mod("noclip", std::make_unique<Noclip>());
hack_mgr.add_mod("skip_cutscene", std::make_unique<SkipCutscene>());
hack_mgr.add_mod("restore_dashing", std::make_unique<RestoreDashing>());
hack_mgr.add_mod("springball_button", std::make_unique<SpringballButton>());
hack_mgr.add_mod("fov_modifier", std::make_unique<ViewModifier>());
hack_mgr.add_mod("context_sensitive_controls", std::make_unique<ContextSensitiveControls>());
Expand Down Expand Up @@ -137,6 +139,10 @@ bool GetSkipCutscene() {
return SConfig::GetInstance().bPrimeSkipCutscene;
}

bool GetRestoreDashing() {
return SConfig::GetInstance().bPrimeRestoreDashing;
}

bool GetEFBTexture() {
return Config::Get(Config::GFX_HACK_SKIP_EFB_COPY_TO_RAM);
}
Expand Down
1 change: 1 addition & 0 deletions Source/Core/Core/PrimeHack/HackConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ bool GetBloom();
bool GetNoclip();
bool GetInvulnerability();
bool GetSkipCutscene();
bool GetRestoreDashing();

bool GetEnableSecondaryGunFX();

Expand Down
1 change: 1 addition & 0 deletions Source/Core/Core/PrimeHack/HackManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ void HackManager::update_mod_states()
set_mod_enabled("noclip", GetNoclip());
set_mod_enabled("invulnerability", GetInvulnerability());
set_mod_enabled("skip_cutscene", GetSkipCutscene());
set_mod_enabled("restore_dashing", GetRestoreDashing());

// Disallow any PrimeHack control mods
if (!SConfig::GetInstance().bEnablePrimeHack) {
Expand Down
137 changes: 137 additions & 0 deletions Source/Core/Core/PrimeHack/Mods/RestoreDashing.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
#pragma once

#include "Core/PrimeHack/PrimeMod.h"
#include <VideoCommon/OnScreenDisplay.h>

namespace prime {
class RestoreDashing : public PrimeMod {
public:
void run_mod(Game game, Region region) override {}
void init_mod(Game game, Region region) override {
// d0210014 d0010010 4b -> pattern to search for CPlayer::FinishSidewaysDash() for Prime 2 GC
// d0210024 d0010020 4b -> pattern to search for CPlayer::FinishSidewaysDash() for Prime 2 and 3 Wii

u8 version = PowerPC::HostRead_U8(0x80000007);

switch (game) {
case Game::PRIME_1:
if (region == Region::NTSC_U) {
// remove scan visor check
code_changes.emplace_back(0x80193334, 0x48000018);
// restore dashing speed
code_changes.emplace_back(0x80194b60, 0x4800001c);
// stop dash when done dashing
code_changes.emplace_back(0x80192cc0, 0x801f037c); // CPlayer + 0x37c
}
else if (region == Region::PAL) {
// remove scan visor check
code_changes.emplace_back(0x801935cc, 0x48000018);
// restore dashing speed
code_changes.emplace_back(0x80194df8, 0x4800001c);
// stop dash when done dashing
code_changes.emplace_back(0x80192f58, 0x801f037c); // CPlayer + 0x37c
}
else { // region == Region::NTSC-J
// remove scan visor check
code_changes.emplace_back(0x80193eb4, 0x48000018);
// restore dashing speed
code_changes.emplace_back(0x801956e0, 0x4800001c);
// stop dash when done dashing
code_changes.emplace_back(0x80193840, 0x801f037c); // CPlayer + 0x37c
}
break;
case Game::PRIME_1_GCN:
if (region == Region::NTSC_U) {
if (version == 2) {
// remove scan visor check
code_changes.emplace_back(0x802888d0, 0x48000018);
}
}
else if (region == Region::NTSC_J) {
// remove scan visor check
code_changes.emplace_back(0x802770e4, 0x48000018);
}
else if (region == Region::PAL) {
// remove scan visor check
code_changes.emplace_back(0x80275328, 0x48000018);
}
break;
case Game::PRIME_2:
if (region == Region::NTSC_U) {
// don't slow down when finishing the dash
code_changes.emplace_back(0x8015d690, 0x60000000);
// stop dash when done dashing
code_changes.emplace_back(0x8015cd1c, 0x881e0574); // CPlayer + 0x574 as u8
}
else if (region == Region::NTSC_J) {
// don't slow down when finishing the dash
code_changes.emplace_back(0x8015cc58, 0x60000000);
// stop dash when done dashing
code_changes.emplace_back(0x8015c2e4, 0x881e0574); // CPlayer + 0x574 as u8
}
else if (region == Region::PAL) {
// don't slow down when finishing the dash
code_changes.emplace_back(0x8015ee08, 0x60000000);
// stop dash when done dashing
code_changes.emplace_back(0x8015e494, 0x881e0574); // CPlayer + 0x574 as u8
}
break;
case Game::PRIME_2_GCN:
if (region == Region::NTSC_U) {
// don't slow down when finishing the dash
code_changes.emplace_back(0x8018961c, 0x60000000);
// stop dash when done dashing
code_changes.emplace_back(0x80189d6c, 0x881e0588); // CPlayer + 0x588 as u8
}
else if (region == Region::NTSC_J) {
// don't slow down when finishing the dash
code_changes.emplace_back(0x8018b130, 0x60000000);
// stop dash when done dashing
code_changes.emplace_back(0x8018b884, 0x881e0588); // CPlayer + 0x588 as u8
}
else if (region == Region::PAL) {
// don't slow down when finishing the dash
code_changes.emplace_back(0x80189914, 0x60000000);
// stop dash when done dashing
code_changes.emplace_back(0x8018a068, 0x881e0588); // CPlayer + 0x588 as u8
}
break;
case Game::PRIME_3:
if (region == Region::NTSC_U) {
// don't slow down when finishing the dash
code_changes.emplace_back(0x80174c60, 0x60000000);
// stop dash when done dashing
code_changes.emplace_back(0x8017432c, 0x881e06cc); // CPlayer + 0x6cc as u8
}
else if (region == Region::PAL) {
// don't slow down when finishing the dash
code_changes.emplace_back(0x801745ac, 0x60000000);
// stop dash when done dashing
code_changes.emplace_back(0x80173c78, 0x881e06cc); // CPlayer + 0x6cc as u8
}
break;
case Game::PRIME_3_STANDALONE:
if (region == Region::NTSC_U) {
// don't slow down when finishing the dash
code_changes.emplace_back(0x80178d90, 0x60000000);
// stop dash when done dashing
code_changes.emplace_back(0x8017845c, 0x881e06cc); // CPlayer + 0x6cc as u8
}
else if (region == Region::NTSC_J) {
// don't slow down when finishing the dash
code_changes.emplace_back(0x8017aa90, 0x60000000);
// stop dash when done dashing
code_changes.emplace_back(0x8017a15c, 0x881e06cc); // CPlayer + 0x6cc as u8
}
else if (region == Region::PAL) {
// don't slow down when finishing the dash
code_changes.emplace_back(0x80179884, 0x60000000);
// stop dash when done dashing
code_changes.emplace_back(0x80178F50, 0x881e06cc); // CPlayer + 0x6cc as u8
}
break;
}
initialized = true;
}
};
}
8 changes: 6 additions & 2 deletions Source/Core/Core/PrimeHack/PrimeUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ std::array<std::array<CodeChange, static_cast<int>(Game::MAX_VAL) + 1>,
static u32 noclip_msg_time;
static u32 invulnerability_msg_time;
static u32 cutscene_msg_time;
static u32 restore_dashing_msg_time;

u8 read8(u32 addr) {
return PowerPC::HostRead_U8(addr);
Expand Down Expand Up @@ -247,9 +248,9 @@ std::string GetDevInfo()
}

// Common::Timer::GetTimeMs()
std::tuple<u32, u32, u32> GetCheatsTime()
std::tuple<u32, u32, u32, u32> GetCheatsTime()
{
return std::make_tuple(noclip_msg_time, invulnerability_msg_time, cutscene_msg_time);
return std::make_tuple(noclip_msg_time, invulnerability_msg_time, cutscene_msg_time, restore_dashing_msg_time);
}

void AddCheatsTime(int index, u32 time)
Expand All @@ -264,6 +265,9 @@ void AddCheatsTime(int index, u32 time)
break;
case 2:
cutscene_msg_time = Common::Timer::GetTimeMs() + 3000;
break;
case 3:
restore_dashing_msg_time = Common::Timer::GetTimeMs() + 3000;
}
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/PrimeHack/PrimeUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void set_cursor_pos(float x, float y);

void DevInfo(const char* name, const char* format, ...);
void DevInfoMatrix(const char* name, const Transform& t);
std::tuple<u32, u32, u32> GetCheatsTime();
std::tuple<u32, u32, u32, u32> GetCheatsTime();
void AddCheatsTime(int index, u32 time);

std::string GetDevInfo();
Expand Down
9 changes: 9 additions & 0 deletions Source/Core/DolphinQt/HotkeyScheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,8 +613,17 @@ void HotkeyScheduler::Run()

OSD::AddMessage(StringFromFormat("Skippable Cutscenes: %s", new_value ? "Enabled" : "Disabled"));
}

if (IsHotkey(HK_RESTORE_DASHING))
{
const bool new_value = !SConfig::GetInstance().bPrimeRestoreDashing;
SConfig::GetInstance().bPrimeRestoreDashing = new_value;

OSD::AddMessage(StringFromFormat("Restore Dashing: %s", new_value ? "Enabled" : "Disabled"));
}
}
else {
SConfig::GetInstance().bPrimeRestoreDashing = false;
SConfig::GetInstance().bPrimeSkipCutscene = false;
SConfig::GetInstance().bPrimeInvulnerability = false;
SConfig::GetInstance().bPrimeNoclip = false;
Expand Down

0 comments on commit 49ca7b9

Please # to comment.