Adds beta quest Gameshark cheat. (#975)

* Adds beta quest Gameshark cheat.

* Fixes issue where lus was including a function from soh.

* Limits beta quest to 0-8
This commit is contained in:
Kenix3 2022-07-31 21:52:10 -04:00 committed by GitHub
parent d648c7275c
commit 4f29833476
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 95 additions and 2 deletions

View File

@ -68,6 +68,13 @@ OSContPad* pads;
std::map<std::string, GameAsset*> DefaultAssets;
std::vector<std::string> emptyArgs;
bool isBetaQuestEnabled = false;
extern "C" {
void enableBetaQuest() { isBetaQuestEnabled = true; }
void disableBetaQuest() { isBetaQuestEnabled = false; }
}
namespace SohImGui {
WindowImpl impl;
@ -1404,6 +1411,78 @@ namespace SohImGui {
EnhancementCheckbox("Shield with Two-Handed Weapons", "gShieldTwoHanded");
Tooltip("This allows you to put up your shield with any two-handed weapon in hand except for Deku Sticks");
{
static int32_t betaQuestEnabled = CVar_GetS32("gEnableBetaQuest", 0);
static int32_t lastBetaQuestEnabled = betaQuestEnabled;
static int32_t betaQuestWorld = CVar_GetS32("gBetaQuestWorld", 0xFFEF);
static int32_t lastBetaQuestWorld = betaQuestWorld;
if (!isBetaQuestEnabled) {
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
}
EnhancementCheckbox("Enable Beta Quest", "gEnableBetaQuest");
Tooltip("Turns on OoT Beta Quest. *WARNING* This will reset your game.");
betaQuestEnabled = CVar_GetS32("gEnableBetaQuest", 0);
if (betaQuestEnabled) {
if (betaQuestEnabled != lastBetaQuestEnabled) {
betaQuestWorld = 0;
}
ImGui::Text("Beta Quest World: %d", betaQuestWorld);
if (ImGui::Button(" - ##BetaQuest")) {
betaQuestWorld--;
}
ImGui::SameLine();
ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f);
ImGui::SliderInt("##BetaQuest", &betaQuestWorld, 0, 8, "", ImGuiSliderFlags_AlwaysClamp);
Tooltip("Set the Beta Quest world to explore. *WARNING* Changing this will reset your game.\nCtrl+Click to type in a value.");
ImGui::Text("After Slider Beta Quest World: %d", betaQuestWorld);
ImGui::SameLine();
ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f);
if (ImGui::Button(" + ##BetaQuest")) {
betaQuestWorld++;
}
if (betaQuestWorld > 8) {
betaQuestWorld = 8;
}
else if (betaQuestWorld < 0) {
betaQuestWorld = 0;
}
ImGui::Text("After Clamp Beta Quest World: %d", betaQuestWorld);
}
else {
lastBetaQuestWorld = betaQuestWorld = 0xFFEF;
CVar_SetS32("gBetaQuestWorld", betaQuestWorld);
needs_save = true;
}
if (betaQuestEnabled != lastBetaQuestEnabled || betaQuestWorld != lastBetaQuestWorld)
{
// Reset the game if the beta quest state or world changed because beta quest happens on redirecting the title screen cutscene.
lastBetaQuestEnabled = betaQuestEnabled;
lastBetaQuestWorld = betaQuestWorld;
CVar_SetS32("gEnableBetaQuest", betaQuestEnabled);
CVar_SetS32("gBetaQuestWorld", betaQuestWorld);
console->Commands["reset"].handler(emptyArgs);
needs_save = true;
}
if (!isBetaQuestEnabled) {
ImGui::PopItemFlag();
ImGui::PopStyleVar();
}
}
ImGui::EndMenu();
}

View File

@ -1,5 +1,15 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
void enableBetaQuest();
void disableBetaQuest();
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
#include "GameOverlay.h"
#include "Lib/ImGui/imgui.h"
#include "Console.h"
@ -97,3 +107,5 @@ namespace SohImGui {
std::string BreakTooltip(const char* text, int lineLength = 60);
std::string BreakTooltip(const std::string& text, int lineLength = 60);
}
#endif

View File

@ -8,7 +8,7 @@ void SaveContext_Init(void) {
gSaveContext.seqId = (u8)NA_BGM_DISABLED;
gSaveContext.natureAmbienceId = NATURE_ID_DISABLED;
gSaveContext.forcedSeqId = NA_BGM_GENERAL_SFX;
gSaveContext.nextCutsceneIndex = 0xFFEF;
gSaveContext.nextCutsceneIndex = CVar_GetS32("gBetaQuestWorld", 0xFFEF);
gSaveContext.cutsceneTrigger = 0;
gSaveContext.chamberCutsceneNum = 0;
gSaveContext.nextDayTime = 0xFFFF;

View File

@ -4,7 +4,7 @@
#include <string.h>
#include "soh/Enhancements/gameconsole.h"
#include "../libultraship/ImGuiImpl.h"
#include "soh/frame_interpolation.h"
void* D_8012D1F0 = NULL;
@ -190,6 +190,7 @@ void Gameplay_Destroy(GameState* thisx) {
KaleidoManager_Destroy();
ZeldaArena_Cleanup();
Fault_RemoveClient(&D_801614B8);
disableBetaQuest();
gGlobalCtx = NULL;
}
@ -260,6 +261,7 @@ void GivePlayerRandoRewardSariaGift(GlobalContext* globalCtx, RandomizerCheck ch
void Gameplay_Init(GameState* thisx) {
GlobalContext* globalCtx = (GlobalContext*)thisx;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
enableBetaQuest();
gGlobalCtx = globalCtx;
//globalCtx->state.gfxCtx = NULL;
uintptr_t zAlloc;