Skip to content

Commit

Permalink
added cheat, fix linux, fix mangler
Browse files Browse the repository at this point in the history
  • Loading branch information
shiiion committed Nov 15, 2021
1 parent feeee35 commit f8f2f87
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 6 deletions.
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
4 changes: 2 additions & 2 deletions Source/Core/Core/PrimeHack/HackManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +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({NAME}, settings.bPrimeUnlockHypermode);
set_mod_enabled("unlock_hypermode", settings.bPrimeUnlockHypermode);
}
else {
disable_mod("noclip");
Expand All @@ -188,7 +188,7 @@ void HackManager::update_mod_states() {
disable_mod("restore_dashing");
disable_mod("friend_vouchers_cheat");
disable_mod("portal_skip_mp2");
//disable_mod({NAME});
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;
};
}
2 changes: 1 addition & 1 deletion Source/Core/DolphinQt/Config/GamecubeControllersWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@

#include "DolphinQt/Config/Mapping/GCPadWiiUConfigDialog.h"
#include "DolphinQt/Config/Mapping/MappingWindow.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/Settings.h"

#include "InputCommon/GCAdapter.h"
#include <ModalMessageBox.h>

static const std::vector<std::pair<SerialInterface::SIDevices, const char*>> s_gc_types = {
{SerialInterface::SIDEVICE_NONE, _trans("None")},
Expand Down
1 change: 1 addition & 0 deletions Source/Core/DolphinQt/Config/PrimeCheatsWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,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 Down

0 comments on commit f8f2f87

Please sign in to comment.