Skip to content

Commit

Permalink
Merge branch 'release1.05'
Browse files Browse the repository at this point in the history
  • Loading branch information
shiiion committed Nov 15, 2021
2 parents 600e1f6 + f8f2f87 commit c8e1771
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Source/Core/Core/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ void SConfig::SaveCoreSettings(IniFile& ini)
core->Set("PrimeRestoreScanDash", bPrimeRestoreDashing);
core->Set("PrimeFriendVouchers", bPrimeFriendVouchers);
core->Set("PrimeDisableHudMemo", bDisableHudMemoPopup);
core->Set("PrimeUnlockHypermode", bPrimeUnlockHypermode);
}

void SConfig::SaveMovieSettings(IniFile& ini)
Expand Down Expand Up @@ -513,6 +514,7 @@ void SConfig::LoadCoreSettings(IniFile& ini)
core->Get("PrimeRestoreScanDash", &bPrimeRestoreDashing, false);
core->Get("PrimeFriendVouchers", &bPrimeFriendVouchers, true);
core->Get("PrimeDisableHudMemo", &bDisableHudMemoPopup, false);
core->Get("PrimeUnlockHypermode", &bPrimeUnlockHypermode, true);
}

void SConfig::LoadMovieSettings(IniFile& ini)
Expand Down
1 change: 1 addition & 0 deletions Source/Core/Core/ConfigManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ struct SConfig
bool bPrimePortalSkip = false;
bool bPrimeFriendVouchers = true;
bool bDisableHudMemoPopup = false;
bool bPrimeUnlockHypermode = true;

// Interface settings
bool bConfirmStop = false;
Expand Down
8 changes: 5 additions & 3 deletions Source/Core/Core/PrimeHack/HackConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "Core/PrimeHack/Mods/PortalSkipMP2.h"
#include "Core/PrimeHack/Mods/DisableHudMemoPopup.h"
#include "Core/PrimeHack/Mods/ElfModLoader.h"
#include "Core/PrimeHack/Mods/UnlockHypermode.h"

#include "Core/HW/Wiimote.h"
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
Expand Down Expand Up @@ -79,6 +80,7 @@ void InitializeHack() {
hack_mgr.add_mod("friend_vouchers_cheat", std::make_unique<FriendVouchers>());
hack_mgr.add_mod("disable_hudmemo_popup", std::make_unique<DisableHudMemoPopup>());
hack_mgr.add_mod("elf_mod_loader", std::make_unique<ElfModLoader>());
hack_mgr.add_mod("unlock_hypermode", std::make_unique<UnlockHypermode>());

hack_mgr.enable_mod("skip_cutscene");
hack_mgr.enable_mod("fov_modifier");
Expand Down Expand Up @@ -119,7 +121,7 @@ bool CheckSpringBallCtl() {
bool ImprovedMotionControls() {
return Wiimote::CheckImprovedMotions();
}

bool CheckForward() {
if (hack_mgr.get_active_game() >= Game::PRIME_1_GCN) {
return Pad::CheckForward();
Expand Down Expand Up @@ -350,7 +352,7 @@ double GetHorizontalAxis() {
if (hack_mgr.get_active_game() >= Game::PRIME_1_GCN) {
if (Pad::PrimeUseController()) {
return std::get<0>(Pad::GetPrimeStickXY());
}
}
}
else if (Wiimote::PrimeUseController()) {
return std::get<0>(Wiimote::GetPrimeStickXY());
Expand All @@ -366,7 +368,7 @@ double GetVerticalAxis() {
if (hack_mgr.get_active_game() >= Game::PRIME_1_GCN) {
if (Pad::PrimeUseController()) {
return std::get<1>(Pad::GetPrimeStickXY());
}
}
}
else if (Wiimote::PrimeUseController()) {
return std::get<1>(Wiimote::GetPrimeStickXY());
Expand Down
2 changes: 2 additions & 0 deletions Source/Core/Core/PrimeHack/HackManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ void HackManager::update_mod_states() {
set_mod_enabled("friend_vouchers_cheat", settings.bPrimeFriendVouchers);
set_mod_enabled("portal_skip_mp2", settings.bPrimePortalSkip);
set_mod_enabled("disable_hudmemo_popup", settings.bDisableHudMemoPopup);
set_mod_enabled("unlock_hypermode", settings.bPrimeUnlockHypermode);
}
else {
disable_mod("noclip");
Expand All @@ -187,6 +188,7 @@ void HackManager::update_mod_states() {
disable_mod("restore_dashing");
disable_mod("friend_vouchers_cheat");
disable_mod("portal_skip_mp2");
disable_mod("unlock_hypermode");
}

// Disallow any PrimeHack control mods
Expand Down
35 changes: 35 additions & 0 deletions Source/Core/Core/PrimeHack/Mods/UnlockHypermode.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#pragma once

#include "Core/PrimeHack/PrimeMod.h"
#include "Core/PrimeHack/PrimeUtils.h"

namespace prime {
class UnlockHypermode : public PrimeMod {
public:
void run_mod(Game game, Region region) override {
if (game != Game::MENU) {
return;
}

u32 base = read32(GPR(13) - r13_offset);
write8(1, base + 0x68);
write8(1, base + 0xa0);
write8(1, base + 0xd8);
}

bool init_mod(Game game, Region region) override {
if (region == Region::NTSC_U) {
r13_offset = 0x2f94;
} else if (region == Region::PAL) {
r13_offset = 0x2f34;
}

return true;
}

void on_state_change(ModState old_state) override {}

private:
u32 r13_offset;
};
}
8 changes: 8 additions & 0 deletions Source/Core/DolphinQt/Config/PrimeCheatsWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ void PrimeCheatsWidget::CreateWidgets()
m_checkbox_skipportalmp2 = new QCheckBox(tr("Skip MP2 Portal Cutscene"));
m_checkbox_friendvouchers = new QCheckBox(tr("Remove Friend Vouchers Requirement (Trilogy Only)"));
m_checkbox_hudmemo = new QCheckBox(tr("Disable Hud Popup on Pickup Acquire"));
m_checkbox_hypermode = new QCheckBox(tr("Unlock Hypermode Difficulty"));

layout->addWidget(m_checkbox_noclip);
layout->addWidget(m_checkbox_invulnerability);
Expand All @@ -37,6 +38,7 @@ void PrimeCheatsWidget::CreateWidgets()
layout->addWidget(m_checkbox_skipportalmp2);
layout->addWidget(m_checkbox_friendvouchers);
layout->addWidget(m_checkbox_hudmemo);
layout->addWidget(m_checkbox_hypermode);

main_layout->addWidget(group_box);
main_layout->addStretch();
Expand All @@ -53,6 +55,7 @@ void PrimeCheatsWidget::ConnectWidgets()
connect(m_checkbox_skipportalmp2, &QCheckBox::toggled, this, &PrimeCheatsWidget::OnSaveConfig);
connect(m_checkbox_friendvouchers, &QCheckBox::toggled, this, &PrimeCheatsWidget::OnSaveConfig);
connect(m_checkbox_hudmemo, &QCheckBox::toggled, this, &PrimeCheatsWidget::OnSaveConfig);
connect(m_checkbox_hypermode, &QCheckBox::toggled, this, &PrimeCheatsWidget::OnSaveConfig);
}

void PrimeCheatsWidget::OnSaveConfig()
Expand All @@ -65,6 +68,7 @@ void PrimeCheatsWidget::OnSaveConfig()
settings.bPrimePortalSkip = m_checkbox_skipportalmp2->isChecked();
settings.bPrimeFriendVouchers = m_checkbox_friendvouchers->isChecked();
settings.bDisableHudMemoPopup = m_checkbox_hudmemo->isChecked();
settings.bPrimeUnlockHypermode = m_checkbox_hypermode->isChecked();

settings.SaveSettings();
}
Expand All @@ -79,6 +83,7 @@ void PrimeCheatsWidget::OnLoadConfig()
m_checkbox_skipportalmp2->setChecked(settings.bPrimePortalSkip);
m_checkbox_friendvouchers->setChecked(settings.bPrimeFriendVouchers);
m_checkbox_hudmemo->setChecked(settings.bDisableHudMemoPopup);
m_checkbox_hypermode->setChecked(settings.bPrimeUnlockHypermode);
}

void PrimeCheatsWidget::AddDescriptions()
Expand All @@ -97,6 +102,8 @@ void PrimeCheatsWidget::AddDescriptions()
QT_TR_NOOP("Removes the friend voucher cost from all purchasable extras. This is on by default as friend-vouchers are impossible to obtain.");
static const char TR_HUDMEMO[] =
QT_TR_NOOP("Removes the item pickup screen and explanation screen for powerups.");
static const char TR_HYPERMODE[] =
QT_TR_NOOP("Unlock Hypermode Difficulty.");

m_checkbox_noclip->setToolTip(tr(TR_NOCLIP));
m_checkbox_invulnerability->setToolTip(tr(TR_INVULNERABILITY));
Expand All @@ -105,6 +112,7 @@ void PrimeCheatsWidget::AddDescriptions()
m_checkbox_skipportalmp2->setToolTip(tr(TR_SKIPPORTAL));
m_checkbox_friendvouchers->setToolTip(tr(TR_FRIENDVOUCHERS));
m_checkbox_hudmemo->setToolTip(tr(TR_HUDMEMO));
m_checkbox_hypermode->setToolTip(tr(TR_HYPERMODE));
}

void PrimeCheatsWidget::showEvent(QShowEvent*)
Expand Down
1 change: 1 addition & 0 deletions Source/Core/DolphinQt/Config/PrimeCheatsWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ class PrimeCheatsWidget : public QWidget
QCheckBox* m_checkbox_skipportalmp2;
QCheckBox* m_checkbox_friendvouchers;
QCheckBox* m_checkbox_hudmemo;
QCheckBox* m_checkbox_hypermode;
};

0 comments on commit c8e1771

Please sign in to comment.