rando logo tex replacement

This commit is contained in:
TakaRikka
2026-08-20 01:22:49 -07:00
parent c86d6918d6
commit dc716329d8
3 changed files with 18 additions and 6 deletions
+2
View File
@@ -19,6 +19,7 @@ IMPORT_SERVICE(ItemService, svc_item);
IMPORT_SERVICE(FlowService, svc_flow);
IMPORT_SERVICE(MessageService, svc_message);
IMPORT_SERVICE(GameModeService, svc_game_mode);
IMPORT_SERVICE(TextureService, svc_texture);
extern "C" {
@@ -37,6 +38,7 @@ MOD_EXPORT ModResult mod_initialize(ModError* error) {
svc_flow,
svc_message,
svc_game_mode,
svc_texture,
});
if (result != MOD_OK) {
return mods::set_error(error, result, "failed to initialize session");
+14 -6
View File
@@ -339,12 +339,6 @@ void registerStartingLocation() {
dComIfGp_setNextStage("F_SP103", 1, 1, -1);
}
void shutdown() {
deactivateSeed();
hooks::uninstall();
svc_mng.save->unobserve_saves(mod_ctx, s_save_observer);
}
ModResult onNewSave(void*, ModError*) {
const std::string hash = g_pending_seed_hash;
if (hash.empty())
@@ -387,6 +381,8 @@ void onSaveWritten(ModContext*, uint32_t, void*) {
svc_mng.save->set_blob(svc_mng.mod_ctx, kSeedHashBlobName, hash.data(), hash.size());
}
TextureReplacementHandle logoTexHandle{};
ModResult onGameModeActivated(void*, ModError* error) {
ModResult result = hooks::initialize();
if (result != MOD_OK) {
@@ -404,10 +400,22 @@ ModResult onGameModeActivated(void*, ModError* error) {
return mods::set_error(error, result, "failed to initialize save observation");
}
result = svc_mng.texture->register_file(mod_ctx, "res/tex1_608x100_0c1c70378fb8cb46_6.png", &logoTexHandle);
if (result != MOD_OK) {
return mods::set_error(error, result, "failed to register texture replacement");
}
mods::log::info("randomizer game mode activated");
return MOD_OK;
}
void shutdown() {
deactivateSeed();
hooks::uninstall();
svc_mng.save->unobserve_saves(mod_ctx, s_save_observer);
svc_mng.texture->unregister(mod_ctx, logoTexHandle);
}
ModResult onGameModeDeactivated(void*, ModError* error) {
shutdown();
+2
View File
@@ -12,6 +12,7 @@
#include "mods/svc/flow.h"
#include "mods/svc/message.h"
#include "mods/svc/game_mode.h"
#include "mods/svc/texture.h"
#include <string>
@@ -30,6 +31,7 @@ struct ServiceManager {
const FlowService* flow;
const MessageService* message;
const GameModeService* game_mode;
const TextureService* texture;
};
extern ServiceManager svc_mng;