What a nightmare that was.

This commit is contained in:
Malkierian 2023-05-24 13:00:35 -07:00
commit 1fa99fd50a
152 changed files with 1064 additions and 650 deletions

View File

@ -5,12 +5,13 @@ set(CMAKE_CXX_STANDARD 20 CACHE STRING "The C++ standard to use")
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version")
project(Ship VERSION 7.0.1 LANGUAGES C CXX)
set(PROJECT_BUILD_NAME "Spock Bravo" CACHE STRING "")
project(Ship VERSION 7.0.2 LANGUAGES C CXX)
set(PROJECT_BUILD_NAME "Spock Charlie" CACHE STRING "")
set(PROJECT_TEAM "github.com/harbourmasters" CACHE STRING "")
set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT soh)
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/MP>)
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/utf-8>)
if (CMAKE_SYSTEM_NAME MATCHES "Windows|Linux")
if(NOT DEFINED BUILD_CROWD_CONTROL)

View File

@ -500,6 +500,7 @@ if(MSVC)
/INCREMENTAL:NO;
/FORCE:MULTIPLE
>
/MANIFEST:NO;
/DEBUG;
/SUBSYSTEM:WINDOWS
)
@ -514,6 +515,7 @@ if(MSVC)
/INCREMENTAL:NO;
/FORCE:MULTIPLE
>
/MANIFEST:NO;
/DEBUG;
/SUBSYSTEM:WINDOWS
)

View File

@ -91,6 +91,13 @@ END
// remains consistent on all systems.
IDI_ICON1 ICON "SHIPOFHARKINIAN.ico"
/////////////////////////////////////////////////////////////////////////////
//
// RT_MANIFEST
//
1 RT_MANIFEST "SHIPOFHARKINIAN.manifest"
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////

View File

@ -0,0 +1,31 @@
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
publicKeyToken="6595b64144ccf1df"
language="*"
processorArchitecture="*" />
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level='asInvoker' uiAccess='false' />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>
</assembly>

View File

@ -103,6 +103,7 @@ extern "C"
extern u32 gGsFlagsShifts[4];
extern void* gItemIcons[0x82];
extern u8 gItemAgeReqs[];
extern u8 gSlotAgeReqs[];
extern u8 gItemSlots[56];
extern void (*gSceneCmdHandlers[SCENE_CMD_ID_MAX])(PlayState*, SceneCmd*);
extern s16 gLinkObjectIds[2];

View File

@ -92,6 +92,8 @@ typedef struct {
/* */ u32 entrancesDiscovered[SAVEFILE_ENTRANCES_DISCOVERED_IDX_COUNT];
/* */ u32 scenesDiscovered[SAVEFILE_SCENES_DISCOVERED_IDX_COUNT];
/* */ u8 locationsSkipped[RC_MAX];
/* */ bool rtaTiming;
/* */ uint64_t fileCreatedAt;
} SohStats;
typedef struct {

View File

@ -267,10 +267,10 @@ namespace GameControlEditor {
UIWidgets::PaddedEnhancementCheckbox("Invert Camera Y Axis", "gInvertYAxis", true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true);
DrawHelpIcon("Inverts the Camera Y Axis in:\n-Free camera");
UIWidgets::Spacer(0);
+ UIWidgets::PaddedEnhancementSliderFloat("Third-Person Horizontal Sensitivity: %d %%", "##ThirdPersonSensitivity Horizontal",
+ "gThirdPersonCameraSensitivityX", 0.01f, 5.0f, "", 1.0f, true, true, false, true);
+ UIWidgets::PaddedEnhancementSliderFloat("Third-Person Vertical Sensitivity: %d %%", "##ThirdPersonSensitivity Vertical",
+ "gThirdPersonCameraSensitivityY", 0.01f, 5.0f, "", 1.0f, true, true, false, true);
UIWidgets::PaddedEnhancementSliderFloat("Third-Person Horizontal Sensitivity: %d %%", "##ThirdPersonSensitivity Horizontal",
"gThirdPersonCameraSensitivityX", 0.01f, 5.0f, "", 1.0f, true, true, false, true);
UIWidgets::PaddedEnhancementSliderFloat("Third-Person Vertical Sensitivity: %d %%", "##ThirdPersonSensitivity Vertical",
"gThirdPersonCameraSensitivityY", 0.01f, 5.0f, "", 1.0f, true, true, false, true);
UIWidgets::PaddedEnhancementSliderInt("Camera Distance: %d", "##CamDist",
"gFreeCameraDistMax", 100, 900, "", 185, true, false, true);
UIWidgets::PaddedEnhancementSliderInt("Camera Transition Speed: %d", "##CamTranSpeed",

View File

@ -1,40 +1,46 @@
#include "GameInteractor.h"
#ifdef __cplusplus
extern "C" {
#endif
// MARK: - Gameplay
extern "C" void GameInteractor_ExecuteOnLoadGame(int32_t fileNum);
extern "C" void GameInteractor_ExecuteOnExitGame(int32_t fileNum);
extern "C" void GameInteractor_ExecuteOnGameFrameUpdate();
extern "C" void GameInteractor_ExecuteOnItemReceiveHooks(GetItemEntry itemEntry);
extern "C" void GameInteractor_ExecuteOnSaleEndHooks(GetItemEntry itemEntry);
extern "C" void GameInteractor_ExecuteOnTransitionEndHooks(int16_t sceneNum);
extern "C" void GameInteractor_ExecuteOnSceneInit(int16_t sceneNum);
extern "C" void GameInteractor_ExecuteOnSceneSpawnActors();
extern "C" void GameInteractor_ExecuteOnPlayerUpdate();
extern "C" void GameInteractor_ExecuteOnOcarinaSongAction();
extern "C" void GameInteractor_ExecuteOnActorUpdate(void* actor);
extern "C" void GameInteractor_ExecuteOnPlayerBonk();
extern "C" void GameInteractor_ExecuteOnOcarinaSongAction();
void GameInteractor_ExecuteOnLoadGame(int32_t fileNum);
void GameInteractor_ExecuteOnExitGame(int32_t fileNum);
void GameInteractor_ExecuteOnGameFrameUpdate();
void GameInteractor_ExecuteOnItemReceiveHooks(GetItemEntry itemEntry);
void GameInteractor_ExecuteOnSaleEndHooks(GetItemEntry itemEntry);
void GameInteractor_ExecuteOnTransitionEndHooks(int16_t sceneNum);
void GameInteractor_ExecuteOnSceneInit(int16_t sceneNum);
void GameInteractor_ExecuteOnSceneSpawnActors();
void GameInteractor_ExecuteOnPlayerUpdate();
void GameInteractor_ExecuteOnOcarinaSongAction();
void GameInteractor_ExecuteOnActorUpdate(void* actor);
void GameInteractor_ExecuteOnPlayerBonk();
void GameInteractor_ExecuteOnOcarinaSongAction();
// MARK: - Save Files
extern "C" void GameInteractor_ExecuteOnSaveFile(int32_t fileNum);
extern "C" void GameInteractor_ExecuteOnLoadFile(int32_t fileNum);
extern "C" void GameInteractor_ExecuteOnDeleteFile(int32_t fileNum);
void GameInteractor_ExecuteOnSaveFile(int32_t fileNum);
void GameInteractor_ExecuteOnLoadFile(int32_t fileNum);
void GameInteractor_ExecuteOnDeleteFile(int32_t fileNum);
// MARK: - Dialog
extern "C" void GameInteractor_ExecuteOnDialogMessage();
extern "C" void GameInteractor_ExecuteOnPresentTitleCard();
extern "C" void GameInteractor_ExecuteOnInterfaceUpdate();
extern "C" void GameInteractor_ExecuteOnKaleidoscopeUpdate(int16_t inDungeonScene);
void GameInteractor_ExecuteOnDialogMessage();
void GameInteractor_ExecuteOnPresentTitleCard();
void GameInteractor_ExecuteOnInterfaceUpdate();
void GameInteractor_ExecuteOnKaleidoscopeUpdate(int16_t inDungeonScene);
// MARK: - Main Menu
extern "C" void GameInteractor_ExecuteOnPresentFileSelect();
extern "C" void GameInteractor_ExecuteOnUpdateFileSelectSelection(uint16_t optionIndex);
extern "C" void GameInteractor_ExecuteOnUpdateFileCopySelection(uint16_t optionIndex);
extern "C" void GameInteractor_ExecuteOnUpdateFileCopyConfirmationSelection(uint16_t optionIndex);
extern "C" void GameInteractor_ExecuteOnUpdateFileEraseSelection(uint16_t optionIndex);
extern "C" void GameInteractor_ExecuteOnUpdateFileEraseConfirmationSelection(uint16_t optionIndex);
extern "C" void GameInteractor_ExecuteOnUpdateFileAudioSelection(uint8_t optionIndex);
extern "C" void GameInteractor_ExecuteOnUpdateFileTargetSelection(uint8_t optionIndex);
void GameInteractor_ExecuteOnPresentFileSelect();
void GameInteractor_ExecuteOnUpdateFileSelectSelection(uint16_t optionIndex);
void GameInteractor_ExecuteOnUpdateFileCopySelection(uint16_t optionIndex);
void GameInteractor_ExecuteOnUpdateFileCopyConfirmationSelection(uint16_t optionIndex);
void GameInteractor_ExecuteOnUpdateFileEraseSelection(uint16_t optionIndex);
void GameInteractor_ExecuteOnUpdateFileEraseConfirmationSelection(uint16_t optionIndex);
void GameInteractor_ExecuteOnUpdateFileAudioSelection(uint8_t optionIndex);
void GameInteractor_ExecuteOnUpdateFileTargetSelection(uint8_t optionIndex);
// MARK: - Game
extern "C" void GameInteractor_ExecuteOnSetGameLanguage();
void GameInteractor_ExecuteOnSetGameLanguage();
#ifdef __cplusplus
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,18 @@
#pragma once
// Total gameplay time is tracked in tenths of seconds
// I.E. game time counts frames at 20fps/2, pause time counts frames at 30fps/3
// Frame counts in z_play.c and z_kaleido_scope_call.c
#define GAMEPLAYSTAT_TOTAL_TIME (gSaveContext.sohStats.playTimer / 2 + gSaveContext.sohStats.pauseTimer / 3)
#define CURRENT_MODE_TIMER (CVarGetInteger("gGameplayStatRoomBreakdown", 0) ?\
// When using RTA timing
// get the diff since the save was created,
// unless the game is complete in which we use the defeated ganon timestamp
// When not using RTA timing
// Total gameplay time is tracked in tenths of seconds
// I.E. game time counts frames at 20fps/2, pause time counts frames at 30fps/3
// Frame counts in z_play.c and z_kaleido_scope_call.c
#define GAMEPLAYSTAT_TOTAL_TIME (gSaveContext.sohStats.rtaTiming ?\
(!gSaveContext.sohStats.gameComplete ?\
(!gSaveContext.sohStats.fileCreatedAt ? 0 : ((GetUnixTimestamp() - gSaveContext.sohStats.fileCreatedAt) / 100)) :\
(gSaveContext.sohStats.itemTimestamp[TIMESTAMP_DEFEAT_GANON])) :\
(gSaveContext.sohStats.playTimer / 2 + gSaveContext.sohStats.pauseTimer / 3))
#define CURRENT_MODE_TIMER (CVarGetInteger("gGameplayStats.RoomBreakdown", 0) ?\
gSaveContext.sohStats.roomTimer :\
gSaveContext.sohStats.sceneTimer)

View File

@ -486,6 +486,24 @@ void RegisterBonkDamage() {
});
}
void UpdateDirtPathFixState(int32_t sceneNum) {
switch (sceneNum) {
case SCENE_SPOT00:
case SCENE_SPOT04:
case SCENE_SPOT15:
CVarSetInteger("gDirtPathFix", CVarGetInteger("gSceneSpecificDirtPathFix", 0));
return;
default:
CVarClear("gDirtPathFix");
}
}
void RegisterMenuPathFix() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnTransitionEnd>([](int32_t sceneNum) {
UpdateDirtPathFixState(sceneNum);
});
}
void InitMods() {
RegisterTTS();
RegisterInfiniteMoney();
@ -504,4 +522,5 @@ void InitMods() {
RegisterRupeeDash();
RegisterHyperBosses();
RegisterBonkDamage();
RegisterMenuPathFix();
}

View File

@ -1,3 +1,5 @@
#include <stdint.h>
#ifndef MODS_H
#define MODS_H
@ -5,6 +7,7 @@
extern "C" {
#endif
void UpdateDirtPathFixState(int32_t sceneNum);
void InitMods();
#ifdef __cplusplus

View File

@ -518,7 +518,7 @@ std::string GenerateRandomizer(std::unordered_map<RandomizerSettingKey, uint8_t>
srand(time(NULL));
// if a blank seed was entered, make a random one
if (seedString.empty()) {
Settings::seed = rand() & 0xFFFFFFFF;
seedString = std::to_string(rand() % 0xFFFFFFFF);
} else if (seedString.rfind("seed_testing_count", 0) == 0 && seedString.length() > 18) {
int count;
try {
@ -530,17 +530,12 @@ std::string GenerateRandomizer(std::unordered_map<RandomizerSettingKey, uint8_t>
}
Playthrough::Playthrough_Repeat(cvarSettings, excludedLocations, count);
return "";
} else {
try {
uint32_t seedHash = boost::hash_32<std::string>{}(seedString);
int seed = seedHash & 0xFFFFFFFF;
Settings::seed = seed;
Settings::seedString = seedString;
} catch (...) {
return "";
}
}
Settings::seedString = seedString;
uint32_t seedHash = boost::hash_32<std::string>{}(Settings::seedString);
Settings::seed = seedHash & 0xFFFFFFFF;
int ret = Playthrough::Playthrough_Init(Settings::seed, cvarSettings, excludedLocations);
if (ret < 0) {
if (ret == -1) { // Failed to generate after 5 tries

View File

@ -87,8 +87,9 @@ int Playthrough_Repeat(std::unordered_map<RandomizerSettingKey, uint8_t> cvarSet
printf("\x1b[0;0HGENERATING %d SEEDS", count);
uint32_t repeatedSeed = 0;
for (int i = 0; i < count; i++) {
repeatedSeed = rand() % 0xFFFFFFFF;
Settings::seed = repeatedSeed;
Settings::seedString = std::to_string(rand() % 0xFFFFFFFF);
repeatedSeed = boost::hash_32<std::string>{}(Settings::seedString);
Settings::seed = repeatedSeed % 0xFFFFFFFF;
CitraPrint("testing seed: " + std::to_string(Settings::seed));
ClearProgress();
Playthrough_Init(Settings::seed, cvarSettings, excludedLocations);

View File

@ -3149,8 +3149,8 @@ void DrawRandoEditor(bool& open) {
}
UIWidgets::Spacer(0);
if (ImGui::Button("Generate Randomizer")) {
GenerateRandomizer(CVarGetInteger("gRandoManualSeedEntry", 0) ? seedString : std::to_string(rand() & 0xFFFFFFFF).c_str());
if (ImGui::Button("Generate Randomizer")) {
GenerateRandomizer(CVarGetInteger("gRandoManualSeedEntry", 0) ? seedString : "");
}
UIWidgets::Spacer(0);

View File

@ -222,9 +222,9 @@ void Extractor::GetRoms(std::vector<std::string>& roms) {
if (S_ISREG(path.st_mode)) {
// Get the position of the extension character.
char* ext = strchr(dir->d_name, '.');
if (ext != NULL && (strcmp(ext, ".z64") == 0) && (strcmp(ext, ".n64") == 0) &&
(strcmp(ext, ".v64") == 0)) {
char* ext = strrchr(dir->d_name, '.');
if (ext != NULL && (strcmp(ext, ".z64") == 0 || strcmp(ext, ".n64") == 0 ||
strcmp(ext, ".v64") == 0)) {
roms.push_back(dir->d_name);
}
}

View File

@ -29,6 +29,7 @@
#include "soh/SaveManager.h"
#include "OTRGlobals.h"
#include "soh/Enhancements/presets.h"
#include "soh/Enhancements/mods.h"
#include "soh/resource/type/Skeleton.h"
#ifdef ENABLE_CROWD_CONTROL
@ -46,6 +47,8 @@ extern "C" {
void disableBetaQuest() { isBetaQuestEnabled = false; }
}
extern "C" PlayState* gPlayState;
enum SeqPlayers {
/* 0 */ SEQ_BGM_MAIN,
/* 1 */ SEQ_FANFARE,
@ -860,7 +863,9 @@ namespace GameMenuBar {
ImGui::EndMenu();
}
UIWidgets::PaddedText("Fix Vanishing Paths", true, false);
UIWidgets::EnhancementCombobox("gDirtPathFix", zFightingOptions, 0);
if (UIWidgets::EnhancementCombobox("gSceneSpecificDirtPathFix", zFightingOptions, 0) && gPlayState != NULL) {
UpdateDirtPathFixState(gPlayState->sceneNum);
}
UIWidgets::Tooltip("Disabled: Paths vanish more the higher the resolution (Z-fighting is based on resolution)\n"
"Consistent: Certain paths vanish the same way in all resolutions\n"
"No Vanish: Paths do not vanish, Link seems to sink in to some paths\n"
@ -1013,14 +1018,14 @@ namespace GameMenuBar {
LUS::RequestCvarSaveOnNextTick();
LUS::EnableWindow("Audio Editor", CVarGetInteger("gAudioEditor.WindowOpen", 0));
}
if (ImGui::Button(GetWindowButtonText("Gameplay Stats", CVarGetInteger("gGameplayStatsEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) {
if (CVarGetInteger("gGameplayStatsEnabled", 0)) {
CVarClear("gGameplayStatsEnabled");
if (ImGui::Button(GetWindowButtonText("Gameplay Stats", CVarGetInteger("gGameplayStats.Enabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) {
if (CVarGetInteger("gGameplayStats.Enabled", 0)) {
CVarClear("gGameplayStats.Enabled");
} else {
CVarSetInteger("gGameplayStatsEnabled", 1);
CVarSetInteger("gGameplayStats.Enabled", 1);
}
LUS::RequestCvarSaveOnNextTick();
LUS::EnableWindow("Gameplay Stats", CVarGetInteger("gGameplayStatsEnabled", 0));
LUS::EnableWindow("Gameplay Stats", CVarGetInteger("gGameplayStats.Enabled", 0));
}
ImGui::PopStyleVar(3);
ImGui::PopStyleColor(1);

View File

@ -4,6 +4,7 @@
#include <algorithm>
#include <filesystem>
#include <fstream>
#include <chrono>
#include <ResourceManager.h>
#include <File.h>
@ -688,9 +689,10 @@ std::unordered_map<uint32_t, uint32_t> ItemIDtoGetItemID{
{ ITEM_WEIRD_EGG, GI_WEIRD_EGG }
};
extern "C" uint32_t GetGIID(uint32_t itemID) {
if (ItemIDtoGetItemID.contains(itemID))
extern "C" int32_t GetGIID(uint32_t itemID) {
if (ItemIDtoGetItemID.contains(itemID)) {
return ItemIDtoGetItemID.at(itemID);
}
return -1;
}
@ -781,6 +783,8 @@ extern "C" void InitOTR() {
} else {
CVarClear("gLetItSnow");
}
srand(now);
#ifdef ENABLE_CROWD_CONTROL
CrowdControl::Instance = new CrowdControl();
CrowdControl::Instance->Init();
@ -831,6 +835,14 @@ extern "C" uint64_t GetPerfCounter() {
}
#endif
extern "C" uint64_t GetUnixTimestamp() {
auto time = std::chrono::system_clock::now();
auto since_epoch = time.time_since_epoch();
auto millis = std::chrono::duration_cast<std::chrono::milliseconds>(since_epoch);
long now = millis.count();
return now;
}
// C->C++ Bridge
extern "C" void Graph_ProcessFrame(void (*run_one_game_iter)(void)) {
OTRGlobals::Instance->context->GetWindow()->MainLoop(run_one_game_iter);

View File

@ -88,6 +88,7 @@ void Ctx_ReadSaveFile(uintptr_t addr, void* dramAddr, size_t size);
void Ctx_WriteSaveFile(uintptr_t addr, void* dramAddr, size_t size);
uint64_t GetPerfCounter();
uint64_t GetUnixTimestamp();
struct SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path, SkelAnime* skelAnime);
void ResourceMgr_UnregisterSkeleton(SkelAnime* skelAnime);
void ResourceMgr_ClearSkeletons();
@ -145,7 +146,7 @@ void EntranceTracker_SetLastEntranceOverride(s16 entranceIndex);
void Gfx_RegisterBlendedTexture(const char* name, u8* mask, u8* replacement);
void SaveManager_ThreadPoolWait();
uint32_t GetGIID(uint32_t itemID);
int32_t GetGIID(uint32_t itemID);
#endif
#endif

View File

@ -403,6 +403,7 @@ void SaveManager::Init() {
LoadFile(fileNum);
saveBlock = nlohmann::json::object();
}
}
}
@ -690,6 +691,8 @@ void SaveManager::InitFileDebug() {
gSaveContext.sceneFlags[5].swch = 0x40000000;
}
// Threaded SaveFile takes copy of gSaveContext for local unmodified storage
void SaveManager::SaveFileThreaded(int fileNum, SaveContext* saveContext, int sectionID) {
// Needed for first time save, hasn't changed in forever anyway
saveBlock["version"] = 1;
@ -744,7 +747,7 @@ void SaveManager::SaveFileThreaded(int fileNum, SaveContext* saveContext, int se
}
// SaveSection creates a copy of gSaveContext to prevent mid-save data modification, and passes its reference to SaveFileThreaded
void SaveManager::SaveSection(int fileNum, int sectionID) {
void SaveManager::SaveSection(int fileNum, int sectionID, bool threaded) {
if (fileNum == 0xFF) {
return;
}
@ -755,12 +758,15 @@ void SaveManager::SaveSection(int fileNum, int sectionID) {
}
auto saveContext = new SaveContext;
memcpy(saveContext, &gSaveContext, sizeof(gSaveContext));
// Can't think of any time the promise would be needed, so use push_task instead of submit
smThreadPool->push_task_back(&SaveManager::SaveFileThreaded, this, fileNum, saveContext, sectionID);
if (threaded) {
smThreadPool->push_task_back(&SaveManager::SaveFileThreaded, this, fileNum, saveContext, sectionID);
} else {
SaveFileThreaded(fileNum, saveContext, sectionID);
}
}
void SaveManager::SaveFile(int fileNum) {
SaveSection(fileNum, SECTION_ID_BASE);
SaveSection(fileNum, SECTION_ID_BASE, true);
}
void SaveManager::SaveGlobal() {
@ -783,6 +789,7 @@ void SaveManager::LoadFile(int fileNum) {
std::ifstream input(GetFileName(fileNum));
nlohmann::json saveBlock;
input >> saveBlock;
if (!saveBlock.contains("version")) {
SPDLOG_ERROR("Save at " + GetFileName(fileNum).string() + " contains no version");
@ -831,7 +838,7 @@ void SaveManager::ThreadPoolWait() {
bool SaveManager::SaveFile_Exist(int fileNum) {
try {
bool exists = std::filesystem::exists(GetFileName(fileNum));
SPDLOG_INFO("File[{}] - {}", fileNum, exists ? "exists" : "does not exist");
SPDLOG_INFO("File[{}] - {}", fileNum, exists ? "exists" : "does not exist" );
return exists;
}
catch(std::filesystem::filesystem_error const& ex) {
@ -864,6 +871,7 @@ void SaveManager::AddSaveFunction(const std::string& name, int version, SaveFunc
assert(false);
return;
}
int index = sectionIndex;
if (coreSectionIDsByName.contains(name)) {
index = coreSectionIDsByName.find(name)->second;
@ -1126,6 +1134,8 @@ void SaveManager::LoadBaseVersion2() {
SaveManager::Instance->LoadArray("dungeonKeys", ARRAY_COUNT(gSaveContext.sohStats.dungeonKeys), [](size_t i) {
SaveManager::Instance->LoadData("", gSaveContext.sohStats.dungeonKeys[i]);
});
SaveManager::Instance->LoadData("rtaTiming", gSaveContext.sohStats.rtaTiming);
SaveManager::Instance->LoadData("fileCreatedAt", gSaveContext.sohStats.fileCreatedAt);
SaveManager::Instance->LoadData("playTimer", gSaveContext.sohStats.playTimer);
SaveManager::Instance->LoadData("pauseTimer", gSaveContext.sohStats.pauseTimer);
SaveManager::Instance->LoadArray("timestamps", ARRAY_COUNT(gSaveContext.sohStats.itemTimestamp), [](size_t i) {
@ -1340,6 +1350,8 @@ void SaveManager::LoadBaseVersion3() {
SaveManager::Instance->LoadArray("dungeonKeys", ARRAY_COUNT(gSaveContext.sohStats.dungeonKeys), [](size_t i) {
SaveManager::Instance->LoadData("", gSaveContext.sohStats.dungeonKeys[i]);
});
SaveManager::Instance->LoadData("rtaTiming", gSaveContext.sohStats.rtaTiming);
SaveManager::Instance->LoadData("fileCreatedAt", gSaveContext.sohStats.fileCreatedAt);
SaveManager::Instance->LoadData("playTimer", gSaveContext.sohStats.playTimer);
SaveManager::Instance->LoadData("pauseTimer", gSaveContext.sohStats.pauseTimer);
SaveManager::Instance->LoadArray("itemTimestamps", ARRAY_COUNT(gSaveContext.sohStats.itemTimestamp), [](size_t i) {
@ -1352,6 +1364,7 @@ void SaveManager::LoadBaseVersion3() {
SaveManager::Instance->LoadData("sceneTime", gSaveContext.sohStats.sceneTimestamps[i].sceneTime);
SaveManager::Instance->LoadData("roomTime", gSaveContext.sohStats.sceneTimestamps[i].roomTime);
SaveManager::Instance->LoadData("isRoom", gSaveContext.sohStats.sceneTimestamps[i].isRoom);
});
});
SaveManager::Instance->LoadData("tsIdx", gSaveContext.sohStats.tsIdx);
@ -1853,6 +1866,7 @@ void SaveManager::LoadArray(const std::string& name, const size_t size, LoadArra
currentJsonContext = saveJsonContext;
}
void SaveManager::LoadStruct(const std::string& name, LoadStructFunc func) {
// Create an empty struct and set it as the current load context, then call the function that loads the struct.
// If it is an array entry, load it from the array instead.
@ -2280,7 +2294,7 @@ void SaveManager::ConvertFromUnversioned() {
static SaveContext saveContextSave = gSaveContext;
InitFile(false);
CopyV0Save(*file, gSaveContext);
SaveFile(fileNum);
SaveSection(fileNum, SECTION_ID_BASE, false);
InitMeta(fileNum);
gSaveContext = saveContextSave;
}
@ -2305,7 +2319,7 @@ extern "C" void Save_SaveFile(void) {
}
extern "C" void Save_SaveSection(int sectionID) {
SaveManager::Instance->SaveSection(gSaveContext.fileNum, sectionID);
SaveManager::Instance->SaveSection(gSaveContext.fileNum, sectionID, true);
}
extern "C" void Save_SaveGlobal(void) {
@ -2321,8 +2335,8 @@ extern "C" void Save_AddLoadFunction(char* name, int version, SaveManager::LoadF
SaveManager::Instance->AddLoadFunction(name, version, func);
}
extern "C" void Save_AddSaveFunction(char* name, int version, SaveManager::SaveFunc func, bool saveWithBase, int parentSection = SECTION_PARENT_NONE) {
SaveManager::Instance->AddSaveFunction(name, version, func, saveWithBase, parentSection);
extern "C" void Save_AddSaveFunction(char* name, int version, SaveManager::SaveFunc func, bool saveWithBase) {
SaveManager::Instance->AddSaveFunction(name, version, func, saveWithBase);
}
extern "C" SaveFileMetaInfo* Save_GetSaveMetaInfo(int fileNum) {

View File

@ -32,22 +32,21 @@ typedef struct {
#include "thread-pool/BS_thread_pool.hpp"
extern "C" {
#include "z64save.h"
#include "z64save.h"
}
#include <nlohmann/json.hpp>
class SaveManager {
public:
public:
static SaveManager* Instance;
static void WriteSaveFile(const std::filesystem::path& savePath, uintptr_t addr, void* dramAddr, size_t size);
static void ReadSaveFile(std::filesystem::path savePath, uintptr_t addr, void* dramAddr, size_t size);
using InitFunc = void(*)(bool isDebug);
using LoadFunc = void(*)();
using SaveFunc = void(*)(SaveContext* saveContext, int sectionID);
using InitFunc = void (*)(bool isDebug);
using LoadFunc = void (*)();
using SaveFunc = void (*)(SaveContext* saveContext, int sectionID);
using PostFunc = void (*)(int version);
typedef struct {
@ -63,7 +62,7 @@ public:
void Init();
void InitFile(bool isDebug);
void SaveFile(int fileNum);
void SaveSection(int fileNum, int sectionID);
void SaveSection(int fileNum, int sectionID, bool threaded);
int GetSaveSectionID(std::string& name);
void SaveGlobal();
void LoadFile(int fileNum);
@ -76,10 +75,12 @@ public:
// Adds a function to handling loading a section
void AddLoadFunction(const std::string& name, int version, LoadFunc func);
// Adds a function that is called when saving. This should only be called once for each function, the version is filled in automatically.
// Adds a function that is called when saving. This should only be called once for each function, the version is
// filled in automatically.
void AddSaveFunction(const std::string& name, int version, SaveFunc func, bool saveWithBase, int parentSection);
// Adds a function to be called after loading is complete. This is to handle any cleanup required from loading old versions.
// Adds a function to be called after loading is complete. This is to handle any cleanup required from loading old
// versions.
void AddPostFunction(const std::string& name, PostFunc func);
void CopyZeldaFile(int from, int to);
@ -87,8 +88,7 @@ public:
bool IsRandoFile();
// Use a name of "" to save to an array. You must be in a SaveArray callback.
template<typename T>
void SaveData(const std::string& name, const T& data) {
template <typename T> void SaveData(const std::string& name, const T& data) {
if (name == "") {
assert((*currentJsonContext).is_array());
(*currentJsonContext).push_back(data);
@ -96,16 +96,16 @@ public:
(*currentJsonContext)[name.c_str()] = data;
}
}
// In the SaveArrayFunc func, the name must be "" to save to the array.
using SaveArrayFunc = std::function<void(size_t)>;
void SaveArray(const std::string& name, const size_t size, SaveArrayFunc func);
using SaveStructFunc = std::function<void()>;
void SaveStruct(const std::string& name, SaveStructFunc func);
// Use a name of "" to load from an array. You must be in a LoadArray callback.
template<typename T> void LoadData(const std::string& name, T& data, const T& defaultValue = T{}) {
template <typename T> void LoadData(const std::string& name, T& data, const T& defaultValue = T{}) {
if (name == "") {
if (currentJsonArrayContext == currentJsonContext->end()) {
// This array member is past the data in the json file. Therefore, default construct it

View File

@ -15,6 +15,7 @@
#endif
#include "soh/Enhancements/game-interactor/GameInteractor.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#define DO_ACTION_TEX_WIDTH() 48
@ -1706,7 +1707,12 @@ u8 Return_Item_Entry(GetItemEntry itemEntry, ItemID returnItem ) {
// Processes Item_Give returns
u8 Return_Item(u8 itemID, ModIndex modId, ItemID returnItem) {
uint32_t get = GetGIID(itemID);
// ITEM_SOLD_OUT doesn't have an ItemTable entry, so pass custom entry instead
if (itemID == ITEM_SOLD_OUT) {
GetItemEntry gie = { ITEM_SOLD_OUT, 0, 0, 0, 0, 0, 0, 0, false, ITEM_FROM_NPC, ITEM_CATEGORY_LESSER, NULL };
return Return_Item_Entry(gie, returnItem);
}
int32_t get = GetGIID(itemID);
if (get == -1) {
modId = MOD_RANDOMIZER;
get = itemID;
@ -6158,8 +6164,13 @@ void Interface_Update(PlayState* play) {
u16 tempSaleMod = gSaveContext.pendingSaleMod;
gSaveContext.pendingSale = ITEM_NONE;
gSaveContext.pendingSaleMod = MOD_NONE;
if (tempSaleMod == 0) {
tempSaleItem = GetGIID(tempSaleItem);
if (tempSaleMod == MOD_NONE) {
s16 giid = GetGIID(tempSaleItem);
if (giid == -1) {
tempSaleMod = MOD_RANDOMIZER;
} else {
tempSaleItem = giid;
}
}
GameInteractor_ExecuteOnSaleEndHooks(ItemTable_RetrieveEntry(tempSaleMod, tempSaleItem));
}

View File

@ -604,6 +604,15 @@ void Play_Init(GameState* thisx) {
(s32)(zAllocAligned + zAllocSize) - (s32)(zAllocAligned - zAlloc));
Fault_AddClient(&D_801614B8, ZeldaArena_Display, NULL, NULL);
// In order to keep bunny hood equipped on first load, we need to pre-set the age reqs for the item and slot
if (CVarGetInteger("gMMBunnyHood", 0) || CVarGetInteger("gTimelessEquipment", 0)) {
gItemAgeReqs[ITEM_MASK_BUNNY] = 9;
if(INV_CONTENT(ITEM_TRADE_CHILD) == ITEM_MASK_BUNNY)
gSlotAgeReqs[SLOT_TRADE_CHILD] = 9;
}
else {
gItemAgeReqs[ITEM_MASK_BUNNY] = gSlotAgeReqs[SLOT_TRADE_CHILD] = 1;
}
func_800304DC(play, &play->actorCtx, play->linkActorEntry);
while (!func_800973FC(play, &play->roomCtx)) {
@ -751,6 +760,14 @@ void Play_Update(PlayState* play) {
if (CHECK_BTN_ALL(input[0].press.button, BTN_R)) {gSaveContext.sohStats.count[COUNT_BUTTON_PRESSES_R]++;}
if (CHECK_BTN_ALL(input[0].press.button, BTN_Z)) {gSaveContext.sohStats.count[COUNT_BUTTON_PRESSES_Z]++;}
if (CHECK_BTN_ALL(input[0].press.button, BTN_START)) {gSaveContext.sohStats.count[COUNT_BUTTON_PRESSES_START]++;}
// Start RTA timing on first non-c-up input after intro cutscene
if (
!gSaveContext.sohStats.fileCreatedAt && !Player_InCsMode(play) &&
((input[0].press.button && input[0].press.button != 0x8) || input[0].rel.stick_x != 0 || input[0].rel.stick_y != 0)
) {
gSaveContext.sohStats.fileCreatedAt = GetUnixTimestamp();
}
}
if (gTrnsnUnkState != 0) {

View File

@ -109,7 +109,9 @@ void BgDyYoseizo_Init(Actor* thisx, PlayState* play2) {
this->actionFunc = BgDyYoseizo_CheckMagicAcquired;
}
void BgDyYoseizo_Destroy(Actor* this, PlayState* play) {
void BgDyYoseizo_Destroy(Actor* thisx, PlayState* play) {
BgDyYoseizo* this = (BgDyYoseizo*)thisx;
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
static Color_RGB8 sParticlePrimColors[] = {

View File

@ -1680,8 +1680,8 @@ void func_8090120C(BossGanon2* this, PlayState* play) {
if ((ABS(temp_a0_2) < 0x2000) && (sqrtf(SQ(temp_f14) + SQ(temp_f12)) < 70.0f) &&
(player->swordState != 0) && (player->heldItemAction == PLAYER_IA_SWORD_MASTER)) {
func_80064520(play, &play->csCtx);
gSaveContext.sohStats.gameComplete = true;
gSaveContext.sohStats.itemTimestamp[TIMESTAMP_DEFEAT_GANON] = GAMEPLAYSTAT_TOTAL_TIME;
gSaveContext.sohStats.gameComplete = true;
this->unk_39E = Play_CreateSubCamera(play);
Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT);
Play_ChangeCameraStatus(play, this->unk_39E, CAM_STAT_ACTIVE);

View File

@ -346,6 +346,8 @@ void BossSst_Destroy(Actor* thisx, PlayState* play) {
Collider_DestroyJntSph(play, &this->colliderJntSph);
Collider_DestroyCylinder(play, &this->colliderCyl);
Audio_StopSfxByPos(&this->center);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void BossSst_HeadSetupLurk(BossSst* this) {

View File

@ -24,6 +24,9 @@ void DemoIk_Type1Draw(DemoIk* this, PlayState* play);
void DemoIk_Type2Draw(DemoIk* this, PlayState* play);
void DemoIk_Destroy(Actor* thisx, PlayState* play) {
DemoIk* this = (DemoIk*)thisx;
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void DemoIk_BgCheck(DemoIk* this, PlayState* play) {

View File

@ -1163,7 +1163,10 @@ void DemoIm_Init(Actor* thisx, PlayState* play) {
}
void DemoIm_Destroy(Actor* thisx, PlayState* play) {
DemoIm* this = (DemoIm*)thisx;
DemoIm_DestroyCollider(thisx, play);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
s32 DemoIm_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {

View File

@ -203,6 +203,8 @@ void DoorKiller_Destroy(Actor* thisx, PlayState* play) {
if ((thisx->params & 0xFF) == DOOR_KILLER_DOOR) {
Collider_DestroyCylinder(play, &this->colliderCylinder);
Collider_DestroyJntSph(play, &this->colliderJntSph);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
}

View File

@ -97,7 +97,16 @@ void DoorWarp1_Destroy(Actor* thisx, PlayState* play) {
play->envCtx.adjAmbientColor[i] = play->envCtx.adjFogColor[i] = play->envCtx.adjLight1Color[i] =
0;
}
//! @bug SkelAnime_Free is not called for crystal variants
switch (this->actor.params) {
case WARP_DUNGEON_ADULT:
case WARP_BLUE_CRYSTAL:
case WARP_PURPLE_CRYSTAL:
SkelAnime_Free(&this->skelAnime, play);
break;
default:
break;
}
}
void DoorWarp1_SetupWarp(DoorWarp1* this, PlayState* play) {

View File

@ -249,6 +249,8 @@ void EnAm_Destroy(Actor* thisx, PlayState* play) {
Collider_DestroyCylinder(play, &this->hurtCollider);
Collider_DestroyCylinder(play, &this->blockCollider);
//! @bug Quad collider is not destroyed (though destroy doesnt really do anything anyway)
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void EnAm_SpawnEffects(EnAm* this, PlayState* play) {

View File

@ -95,6 +95,8 @@ void EnAni_Destroy(Actor* thisx, PlayState* play) {
EnAni* this = (EnAni*)thisx;
Collider_DestroyCylinder(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
s32 EnAni_SetText(EnAni* this, PlayState* play, u16 textId) {

View File

@ -167,6 +167,8 @@ void EnAnubice_Destroy(Actor* thisx, PlayState* play) {
tag->anubis = NULL;
}
}
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void EnAnubice_FindFlameCircles(EnAnubice* this, PlayState* play) {

View File

@ -68,6 +68,8 @@ void EnAttackNiw_Destroy(Actor* thisx, PlayState* play) {
cucco->unk_296--;
}
}
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void func_809B5268(EnAttackNiw* this, PlayState* play, s16 arg2) {

View File

@ -403,6 +403,8 @@ void EnBb_Destroy(Actor* thisx, PlayState* play) {
EnBb* this = (EnBb*)thisx;
Collider_DestroyJntSph(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void EnBb_SetupFlameTrail(EnBb* this) {

View File

@ -196,6 +196,8 @@ void EnBigokuta_Destroy(Actor* thisx, PlayState* play) {
for (i = 0; i < ARRAY_COUNT(this->cylinder); i++) {
Collider_DestroyCylinder(play, &this->cylinder[i]);
}
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void func_809BCE3C(EnBigokuta* this) {

View File

@ -136,6 +136,8 @@ void EnBili_Destroy(Actor* thisx, PlayState* play) {
EnBili* this = (EnBili*)thisx;
Collider_DestroyCylinder(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
// Setup Action Functions

View File

@ -62,6 +62,9 @@ void EnBird_Init(Actor* thisx, PlayState* play) {
}
void EnBird_Destroy(Actor* thisx, PlayState* play) {
EnBird* this = (EnBird*)thisx;
SkelAnime_Free(&this->skelAnime, play);
}
void func_809C1CAC(EnBird* this, s16 params) {

View File

@ -89,6 +89,9 @@ void EnBomBowlMan_Init(Actor* thisx, PlayState* play2) {
}
void EnBomBowlMan_Destroy(Actor* thisx, PlayState* play) {
EnBomBowlMan* this = (EnBomBowlMan*)thisx;
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void EnBomBowMan_SetupWaitAsleep(EnBomBowlMan* this, PlayState* play) {

View File

@ -208,6 +208,8 @@ void EnBox_Destroy(Actor* thisx, PlayState* play) {
EnBox* this = (EnBox*)thisx;
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
ResourceMgr_UnregisterSkeleton(&this->skelanime);
}
void EnBox_RandomDustKinematic(EnBox* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel) {

View File

@ -102,6 +102,8 @@ void EnBrob_Destroy(Actor* thisx, PlayState* play) {
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
Collider_DestroyCylinder(play, &this->colliders[0]);
Collider_DestroyCylinder(play, &this->colliders[1]);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void func_809CADDC(EnBrob* this, PlayState* play) {

View File

@ -180,6 +180,8 @@ void EnButte_Destroy(Actor* thisx, PlayState* play2) {
EnButte* this = (EnButte*)thisx;
Collider_DestroyJntSph(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void func_809CD56C(EnButte* this) {

View File

@ -161,6 +161,8 @@ void EnBw_Destroy(Actor* thisx, PlayState* play) {
Collider_DestroyCylinder(play, &this->collider1);
Collider_DestroyCylinder(play, &this->collider2);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void func_809CE884(EnBw* this, PlayState* play) {

View File

@ -162,6 +162,8 @@ void EnCow_Destroy(Actor* thisx, PlayState* play) {
Collider_DestroyCylinder(play, &this->colliders[0]);
Collider_DestroyCylinder(play, &this->colliders[1]);
}
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void func_809DF494(EnCow* this, PlayState* play) {

View File

@ -124,6 +124,8 @@ void EnCrow_Destroy(Actor* thisx, PlayState* play) {
EnCrow* this = (EnCrow*)thisx;
Collider_DestroyJntSph(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
// Setup Action functions

View File

@ -161,6 +161,8 @@ void EnCs_Destroy(Actor* thisx, PlayState* play) {
EnCs* this = (EnCs*)thisx;
Collider_DestroyCylinder(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
s32 EnCs_GetTalkState(EnCs* this, PlayState* play) {

View File

@ -219,6 +219,8 @@ void EnDaiku_Destroy(Actor* thisx, PlayState* play) {
EnDaiku* this = (EnDaiku*)thisx;
Collider_DestroyCylinder(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
s32 EnDaiku_UpdateTalking(EnDaiku* this, PlayState* play) {

View File

@ -208,6 +208,8 @@ void EnDaikuKakariko_Destroy(Actor* thisx, PlayState* play) {
EnDaikuKakariko* this = (EnDaikuKakariko*)thisx;
Collider_DestroyCylinder(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
s32 EnDaikuKakariko_GetTalkState(EnDaikuKakariko* this, PlayState* play) {

View File

@ -278,6 +278,8 @@ void EnDekubaba_Destroy(Actor* thisx, PlayState* play) {
EnDekubaba* this = (EnDekubaba*)thisx;
Collider_DestroyJntSph(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void EnDekubaba_DisableHitboxes(EnDekubaba* this) {

View File

@ -136,6 +136,8 @@ void EnDekunuts_Destroy(Actor* thisx, PlayState* play) {
if (this->actor.params != DEKUNUTS_FLOWER) {
Collider_DestroyCylinder(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
}

View File

@ -164,6 +164,8 @@ void EnDh_Destroy(Actor* thisx, PlayState* play) {
func_800F5B58();
Collider_DestroyCylinder(play, &this->collider1);
Collider_DestroyJntSph(play, &this->collider2);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void EnDh_SpawnDebris(PlayState* play, EnDh* this, Vec3f* spawnPos, f32 spread, s32 arg4, f32 accelXZ,

View File

@ -177,6 +177,8 @@ void EnDha_Destroy(Actor* thisx, PlayState* play) {
EnDha* this = (EnDha*)thisx;
Collider_DestroyJntSph(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void EnDha_SetupWait(EnDha* this) {

View File

@ -108,6 +108,8 @@ void EnDivingGame_Destroy(Actor* thisx, PlayState* play) {
gSaveContext.timer1State = 0;
}
Collider_DestroyCylinder(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void EnDivingGame_SpawnRuppy(EnDivingGame* this, PlayState* play) {

View File

@ -200,6 +200,8 @@ void EnDns_Destroy(Actor* thisx, PlayState* play) {
EnDns* this = (EnDns*)thisx;
Collider_DestroyCylinder(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void EnDns_ChangeAnim(EnDns* this, u8 index) {

View File

@ -96,6 +96,8 @@ void EnDntJiji_Destroy(Actor* thisx, PlayState* play) {
EnDntJiji* this = (EnDntJiji*)thisx;
Collider_DestroyCylinder(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void EnDntJiji_SetFlower(EnDntJiji* this, PlayState* play) {

View File

@ -167,6 +167,8 @@ void EnDntNomal_Destroy(Actor* thisx, PlayState* play) {
} else {
Collider_DestroyCylinder(play, &this->bodyCyl);
}
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void EnDntNomal_WaitForObject(EnDntNomal* this, PlayState* play) {

View File

@ -88,6 +88,8 @@ void EnDodojr_Destroy(Actor* thisx, PlayState* play) {
EnDodojr* this = (EnDodojr*)thisx;
Collider_DestroyCylinder(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void func_809F64D0(EnDodojr* this) {

View File

@ -353,6 +353,8 @@ void EnDodongo_Destroy(Actor* thisx, PlayState* play) {
Collider_DestroyTris(play, &this->colliderHard);
Collider_DestroyJntSph(play, &this->colliderBody);
Collider_DestroyQuad(play, &this->colliderAT);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void EnDodongo_SetupIdle(EnDodongo* this) {

View File

@ -300,6 +300,8 @@ void EnDog_Init(Actor* thisx, PlayState* play) {
void EnDog_Destroy(Actor* thisx, PlayState* play) {
EnDog* this = (EnDog*)thisx;
Collider_DestroyCylinder(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void EnDog_FollowPath(EnDog* this, PlayState* play) {

View File

@ -143,6 +143,8 @@ void EnDoor_Destroy(Actor* thisx, PlayState* play) {
if (transitionEntry->id < 0) {
transitionEntry->id = -transitionEntry->id;
}
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void EnDoor_SetupType(EnDoor* this, PlayState* play) {

View File

@ -50,6 +50,9 @@ void EnDs_Init(Actor* thisx, PlayState* play) {
}
void EnDs_Destroy(Actor* thisx, PlayState* play) {
EnDs* this = (EnDs*)thisx;
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void EnDs_Talk(EnDs* this, PlayState* play) {

View File

@ -171,6 +171,8 @@ void EnEiyer_Init(Actor* thisx, PlayState* play) {
void EnEiyer_Destroy(Actor* thisx, PlayState* play) {
EnEiyer* this = (EnEiyer*)thisx;
Collider_DestroyCylinder(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelanime);
}
void EnEiyer_RotateAroundHome(EnEiyer* this) {

View File

@ -437,6 +437,8 @@ void EnElf_Destroy(Actor* thisx, PlayState* play) {
LightContext_RemoveLight(play, &play->lightCtx, this->lightNodeGlow);
LightContext_RemoveLight(play, &play->lightCtx, this->lightNodeNoGlow);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void func_80A02A20(EnElf* this, PlayState* play) {

View File

@ -472,6 +472,8 @@ void EnFd_Destroy(Actor* thisx, PlayState* play) {
EnFd* this = (EnFd*)thisx;
Collider_DestroyJntSph(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void EnFd_Reappear(EnFd* this, PlayState* play) {

View File

@ -198,6 +198,8 @@ void EnFirefly_Destroy(Actor* thisx, PlayState* play) {
EnFirefly* this = (EnFirefly*)thisx;
Collider_DestroyJntSph(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void EnFirefly_SetupFlyIdle(EnFirefly* this) {

View File

@ -157,6 +157,8 @@ void EnFish_Destroy(Actor* thisx, PlayState* play2) {
EnFish* this = (EnFish*)thisx;
Collider_DestroyJntSph(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void EnFish_SetYOffset(EnFish* this) {

View File

@ -179,6 +179,8 @@ void EnFloormas_Destroy(Actor* thisx, PlayState* play) {
EnFloormas* this = (EnFloormas*)thisx;
ColliderCylinder* col = &this->collider;
Collider_DestroyCylinder(play, col);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void EnFloormas_MakeInvulnerable(EnFloormas* this) {

View File

@ -309,6 +309,9 @@ void EnFr_Destroy(Actor* thisx, PlayState* play) {
EnFr* this = (EnFr*)thisx;
LightContext_RemoveLight(play, &play->lightCtx, this->lightNode);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
ResourceMgr_UnregisterSkeleton(&this->skelAnimeButterfly);
}
void EnFr_IsDivingIntoWater(EnFr* this, PlayState* play) {

View File

@ -99,6 +99,8 @@ void EnFu_Init(Actor* thisx, PlayState* play) {
void EnFu_Destroy(Actor* thisx, PlayState* play) {
EnFu* this = (EnFu*)thisx;
Collider_DestroyCylinder(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelanime);
}
s32 func_80A1D94C(EnFu* this, PlayState* play, u16 textID, EnFuActionFunc actionFunc) {

View File

@ -208,6 +208,8 @@ void EnFw_Init(Actor* thisx, PlayState* play) {
void EnFw_Destroy(Actor* thisx, PlayState* play) {
EnFw* this = (EnFw*)thisx;
Collider_DestroyJntSph(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void EnFw_Bounce(EnFw* this, PlayState* play) {

View File

@ -224,6 +224,8 @@ void EnGb_Destroy(Actor* thisx, PlayState* play) {
Collider_DestroyCylinder(play, &this->collider);
LightContext_RemoveLight(play, &play->lightCtx, this->light);
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void func_80A2F608(EnGb* this) {

View File

@ -203,6 +203,8 @@ void EnGe1_Destroy(Actor* thisx, PlayState* play) {
EnGe1* this = (EnGe1*)thisx;
Collider_DestroyCylinder(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
s32 EnGe1_SetTalkAction(EnGe1* this, PlayState* play, u16 textId, f32 arg3, EnGe1ActionFunc actionFunc) {

View File

@ -174,6 +174,8 @@ void EnGe2_Destroy(Actor* thisx, PlayState* play) {
EnGe2* this = (EnGe2*)thisx;
Collider_DestroyCylinder(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
// Detection/check functions

View File

@ -90,6 +90,8 @@ void EnGe3_Destroy(Actor* thisx, PlayState* play) {
EnGe3* this = (EnGe3*)thisx;
Collider_DestroyCylinder(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void EnGe3_TurnToFacePlayer(EnGe3* this, PlayState* play) {

View File

@ -269,6 +269,8 @@ void EnGeldB_Destroy(Actor* thisx, PlayState* play) {
Collider_DestroyTris(play, &this->blockCollider);
Collider_DestroyCylinder(play, &this->bodyCollider);
Collider_DestroyQuad(play, &this->swordCollider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
s32 EnGeldB_ReactToPlayer(PlayState* play, EnGeldB* this, s16 arg2) {

View File

@ -452,11 +452,6 @@ void EnGirlA_Init(Actor* thisx, PlayState* play) {
}
void EnGirlA_Destroy(Actor* thisx, PlayState* play) {
EnGirlA* this = (EnGirlA*)thisx;
if (this->isInitialized) {
SkelAnime_Free(&this->skelAnime, play);
}
}
s32 EnGirlA_CanBuy_Arrows(PlayState* play, EnGirlA* this) {

View File

@ -88,6 +88,8 @@ void EnGm_Destroy(Actor* thisx, PlayState* play) {
EnGm* this = (EnGm*)thisx;
Collider_DestroyCylinder(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
s32 func_80A3D7C8(void) {

View File

@ -1691,6 +1691,9 @@ void EnGo2_Init(Actor* thisx, PlayState* play) {
}
void EnGo2_Destroy(Actor* thisx, PlayState* play) {
EnGo2* this = (EnGo2*)thisx;
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void EnGo2_CurledUp(EnGo2* this, PlayState* play) {

View File

@ -177,6 +177,8 @@ void EnGoma_Destroy(Actor* thisx, PlayState* play) {
if (this->actor.params < 10) {
Collider_DestroyCylinder(play, &this->colCyl1);
Collider_DestroyCylinder(play, &this->colCyl2);
ResourceMgr_UnregisterSkeleton(&this->skelanime);
}
}

View File

@ -71,6 +71,8 @@ void EnGuest_Destroy(Actor* thisx, PlayState* play) {
EnGuest* this = (EnGuest*)thisx;
Collider_DestroyCylinder(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void EnGuest_Update(Actor* thisx, PlayState* play) {

View File

@ -142,6 +142,9 @@ void EnHeishi1_Init(Actor* thisx, PlayState* play) {
}
void EnHeishi1_Destroy(Actor* thisx, PlayState* play) {
EnHeishi1* this = (EnHeishi1*)thisx;
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void EnHeishi1_SetupWalk(EnHeishi1* this, PlayState* play) {

View File

@ -166,6 +166,8 @@ void EnHeishi2_Destroy(Actor* thisx, PlayState* play) {
if ((this->collider.dim.radius != 0) || (this->collider.dim.height != 0)) {
Collider_DestroyCylinder(play, &this->collider);
}
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void EnHeishi2_DoNothing1(EnHeishi2* this, PlayState* play) {

View File

@ -90,6 +90,8 @@ void EnHeishi3_Destroy(Actor* thisx, PlayState* play) {
EnHeishi3* this = (EnHeishi3*)thisx;
Collider_DestroyCylinder(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void EnHeishi3_SetupGuardType(EnHeishi3* this, PlayState* play) {

View File

@ -107,6 +107,8 @@ void EnHeishi4_Destroy(Actor* thisx, PlayState* play) {
EnHeishi4* this = (EnHeishi4*)thisx;
Collider_DestroyCylinder(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void func_80A56328(EnHeishi4* this, PlayState* play) {

View File

@ -105,6 +105,8 @@ void EnHintnuts_Destroy(Actor* thisx, PlayState* play) {
if (this->actor.params != 0xA) {
Collider_DestroyCylinder(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
}

View File

@ -116,6 +116,8 @@ void EnHs_Destroy(Actor* thisx, PlayState* play) {
EnHs* this = (EnHs*)thisx;
Collider_DestroyCylinder(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
s32 func_80A6E53C(EnHs* this, PlayState* play, u16 textId, EnHsActionFunc actionFunc) {

View File

@ -71,6 +71,8 @@ void EnHs2_Destroy(Actor* thisx, PlayState* play) {
EnHs2* this = (EnHs2*)thisx;
Collider_DestroyCylinder(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
s32 func_80A6F0B4(EnHs2* this, PlayState* play, u16 textId, EnHs2ActionFunc actionFunc) {

View File

@ -906,6 +906,8 @@ void EnHy_Destroy(Actor* thisx, PlayState* play) {
EnHy* this = (EnHy*)thisx;
Collider_DestroyCylinder(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void EnHy_InitImpl(EnHy* this, PlayState* play) {

View File

@ -175,6 +175,8 @@ void EnIk_Destroy(Actor* thisx, PlayState* play) {
Collider_DestroyTris(play, &this->shieldCollider);
Collider_DestroyCylinder(play, &this->bodyCollider);
Collider_DestroyQuad(play, &this->axeCollider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void EnIk_SetupAction(EnIk* this, EnIkActionFunc actionFunc) {

View File

@ -503,6 +503,8 @@ void EnIn_Destroy(Actor* thisx, PlayState* play) {
if (this->actionFunc != NULL && this->actionFunc != func_80A79FB0) {
Collider_DestroyCylinder(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
}

View File

@ -234,6 +234,8 @@ void EnInsect_Destroy(Actor* thisx, PlayState* play) {
if ((temp_v0 == 2 || temp_v0 == 3) && D_80A7DEB8 > 0) {
D_80A7DEB8--;
}
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void func_80A7C3A0(EnInsect* this) {

View File

@ -143,6 +143,8 @@ void EnJj_Destroy(Actor* thisx, PlayState* play) {
case JABUJABU_MAIN:
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
Collider_DestroyCylinder(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
break;
case JABUJABU_COLLISION:

View File

@ -76,6 +76,8 @@ void EnJs_Destroy(Actor* thisx, PlayState* play) {
EnJs* this = (EnJs*)thisx;
Collider_DestroyCylinder(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
u8 func_80A88F64(EnJs* this, PlayState* play, u16 textId) {

View File

@ -59,8 +59,7 @@ void EnKakasi_Destroy(Actor* thisx, PlayState* play) {
EnKakasi* this = (EnKakasi*)thisx;
Collider_DestroyCylinder(play, &this->collider);
SkelAnime_Free(&this->skelanime, play); // OTR - Fixed this memory leak
//! @bug SkelAnime_Free is not called
SkelAnime_Free(&this->skelanime, play);
}
void EnKakasi_Init(Actor* thisx, PlayState* play) {

View File

@ -109,8 +109,7 @@ void EnKakasi2_Destroy(Actor* thisx, PlayState* play) {
EnKakasi2* this = (EnKakasi2*)thisx;
Collider_DestroyCylinder(play, &this->collider);
SkelAnime_Free(&this->skelAnime, play); // OTR - Fixed this memory leak
//! @bug SkelAnime_Free is not called
SkelAnime_Free(&this->skelAnime, play);
}
void func_80A90264(EnKakasi2* this, PlayState* play) {

View File

@ -63,8 +63,7 @@ void EnKakasi3_Destroy(Actor* thisx, PlayState* play) {
EnKakasi3* this = (EnKakasi3*)thisx;
Collider_DestroyCylinder(play, &this->collider);
SkelAnime_Free(&this->skelAnime, play); //OTR - Fixed this memory leak
//! @bug SkelAnime_Free is not called
SkelAnime_Free(&this->skelAnime, play);
}
void EnKakasi3_Init(Actor* thisx, PlayState* play) {

View File

@ -119,6 +119,8 @@ void EnKarebaba_Destroy(Actor* thisx, PlayState* play) {
Collider_DestroyCylinder(play, &this->bodyCollider);
Collider_DestroyCylinder(play, &this->headCollider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void EnKarebaba_ResetCollider(EnKarebaba* this) {

View File

@ -1145,6 +1145,8 @@ void EnKo_Init(Actor* thisx, PlayState* play) {
void EnKo_Destroy(Actor* thisx, PlayState* play) {
EnKo* this = (EnKo*)thisx;
Collider_DestroyCylinder(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void func_80A99048(EnKo* this, PlayState* play) {

View File

@ -385,6 +385,8 @@ void EnKz_Destroy(Actor* thisx, PlayState* play) {
EnKz* this = (EnKz*)thisx;
Collider_DestroyCylinder(play, &this->collider);
ResourceMgr_UnregisterSkeleton(&this->skelanime);
}
void EnKz_PreMweepWait(EnKz* this, PlayState* play) {

View File

@ -336,6 +336,8 @@ void EnMb_Destroy(Actor* thisx, PlayState* play) {
Collider_DestroyTris(play, &this->frontShielding);
Collider_DestroyCylinder(play, &this->hitbox);
Collider_DestroyQuad(play, &this->attackCollider);
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
}
void EnMb_FaceWaypoint(EnMb* this, PlayState* play) {

Some files were not shown because too many files have changed in this diff Show More