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
+29 -2
View File
@@ -3,10 +3,37 @@
#include "dusk/config.hpp"
#include "m_Do/m_Do_main.h"
#include <aurora/aurora.h>
#include "dusk/gamemode.hpp"
#include "dusk/livesplit.h"
namespace dusk {
namespace dusk::speedrun {
SpeedrunInfo m_speedrunInfo;
SpeedrunInfo g_speedrunInfo;
static void onSpeedrunModeActive() {
resetForSpeedrunMode();
}
static void onSpeedrunModeDeactive() {
restoreFromSpeedrunMode();
if (getSettings().game.liveSplitEnabled) {
speedrun::disconnectLiveSplit();
}
}
void registerSpeedrunGamemode() {
dusk::gamemode::Gamemode speedrunGamemode(DUSK_SPEEDRUN_GAMEMODE_ID,"Speedrun","gczelda2-speedrun");
speedrunGamemode.mOnSaveLoadedFunction = dusk::speedrun::start;
speedrunGamemode.mOnActivatedFunction = onSpeedrunModeActive;
speedrunGamemode.mOnDeactivatedFunction = onSpeedrunModeDeactive;
speedrunGamemode.mOnTickFunction = dusk::speedrun::onGameFrame;
dusk::gamemode::getGamemodeManager().registerGamemode(speedrunGamemode);
}
void unregisterSpeedrunGamemode() {
dusk::gamemode::getGamemodeManager().unregisterGamemode(DUSK_SPEEDRUN_GAMEMODE_ID);
}
void resetForSpeedrunMode() {
mDoMain::developmentMode = -1;