Mod SDK: Gamemode Service, Change Speedrun mode to a gamemode, Allow prelaunch to be restarted

This commit is contained in:
jdflyer
2026-07-19 00:50:49 -07:00
parent 1bae8a5e6a
commit 61a4ab3117
38 changed files with 974 additions and 250 deletions
+6 -3
View File
@@ -23,9 +23,12 @@
#include "d/actor/d_a_npc_tkc.h"
#include <cstring>
#ifdef TARGET_PC
#include "dusk/imgui/ImGuiConsole.hpp"
#include "dusk/settings.h"
#include "dusk/speedrun.h"
#include "dusk/gamemode.hpp"
#endif
BOOL daAlink_c::checkEventRun() const {
return dComIfGp_event_runCheck() || checkPlayerDemoMode();
@@ -4009,9 +4012,9 @@ int daAlink_c::procGanonFinishInit() {
onEndResetFlg1(ERFLG1_SHIELD_BACKBONE);
#if TARGET_PC
if (dusk::getSettings().game.speedrunMode) {
if (dusk::m_speedrunInfo.m_isRunStarted) {
dusk::m_speedrunInfo.stopRun();
if (dusk::speedrun::isActive()) {
if (dusk::speedrun::g_speedrunInfo.m_isRunStarted) {
dusk::speedrun::g_speedrunInfo.stopRun();
}
}
#endif
+10 -8
View File
@@ -9,11 +9,15 @@
#include "JSystem/J2DGraph/J2DScreen.h"
#include "JSystem/J2DGraph/J2DTextBox.h"
#include "d/d_msg_string.h"
#include "m_Do/m_Do_controller_pad.h"
#ifdef TARGET_PC
#include <dusk/autosave.h>
#include "dusk/livesplit.h"
#include "dusk/imgui/ImGuiConsole.hpp"
#include "dusk/speedrun.h"
#include "m_Do/m_Do_controller_pad.h"
#include <dusk/autosave.h>
#include "dusk/gamemode.hpp"
#endif
dBrightCheck_c::dBrightCheck_c(JKRArchive* i_archive) {
mArchive = i_archive;
@@ -143,12 +147,10 @@ void dBrightCheck_c::modeMove() {
if (mDoCPd_c::getTrigA(PAD_1) || mDoCPd_c::getTrigStart(PAD_1)) {
mDoAud_seStart(Z2SE_ENTER_GAME, NULL, 0, 0);
#ifdef TARGET_PC
if (dusk::getSettings().game.speedrunMode && !dusk::getSettings().game.hideTvSettingsScreen) {
// start a new run if a run isn't already in progress
if (!dusk::m_speedrunInfo.m_isRunStarted) {
dusk::resetForSpeedrunMode();
dusk::m_speedrunInfo.startRun();
dusk::speedrun::start();
if (!dusk::getSettings().game.hideTvSettingsScreen) {
const dusk::gamemode::Gamemode* gamemode = dusk::gamemode::getGamemodeManager().getCurrentGamemode();
if (gamemode) {
gamemode->mOnSaveLoadedFunction();
}
}
+14 -12
View File
@@ -9,11 +9,6 @@
#include "d/d_com_inf_game.h"
#include "d/d_meter2_info.h"
#include "d/d_s_name.h"
#include "dusk/imgui/ImGuiConsole.hpp"
#include "dusk/livesplit.h"
#include "dusk/memory.h"
#include "dusk/speedrun.h"
#include "dusk/settings.h"
#include "f_op/f_op_overlap_mng.h"
#include "f_op/f_op_scene_mng.h"
#include "m_Do/m_Do_Reset.h"
@@ -21,7 +16,16 @@
#include "m_Do/m_Do_machine.h"
#include "m_Do/m_Do_main.h"
#include "m_Do/m_Do_mtx.h"
#include <dusk/autosave.h>
#ifdef TARGET_PC
#include "dusk/imgui/ImGuiConsole.hpp"
#include "dusk/livesplit.h"
#include "dusk/memory.h"
#include "dusk/speedrun.h"
#include "dusk/settings.h"
#include "dusk/autosave.h"
#include "dusk/gamemode.hpp"
#endif
#if TARGET_PC
#define SHOW_TV_SETTINGS_SCREEN (this->mShowTvSettingsScreen)
@@ -418,12 +422,10 @@ void dScnName_c::changeGameScene() {
dComIfGs_setRestartRoomParam(0);
#if TARGET_PC
if (dusk::getSettings().game.speedrunMode && dusk::getSettings().game.hideTvSettingsScreen) {
// start a new run on file load if a run isn't already in progress
if (!dusk::m_speedrunInfo.m_isRunStarted) {
dusk::resetForSpeedrunMode();
dusk::m_speedrunInfo.startRun();
dusk::speedrun::start();
if (dusk::getSettings().game.hideTvSettingsScreen) {
const dusk::gamemode::Gamemode* gamemode = dusk::gamemode::getGamemodeManager().getCurrentGamemode();
if (gamemode) {
gamemode->mOnSaveLoadedFunction();
}
}
+8
View File
@@ -29,6 +29,7 @@
#if TARGET_PC
#include "dusk/settings.h"
#include "dusk/gamemode.hpp"
#include <f_ap/f_ap_game.h>
#include "helpers/string.hpp"
@@ -1531,6 +1532,13 @@ void dSv_save_c::init() {
mEvent.init();
mMiniGame.init();
#ifdef TARGET_PC
const dusk::gamemode::Gamemode* gamemode = dusk::gamemode::getGamemodeManager().getCurrentGamemode();
if (gamemode) {
gamemode->mOnNewSaveFunction();
}
#endif
}
dSv_memory2_c* dSv_save_c::getSave2(int i_stage2No) {