mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-24 18:32:19 -05:00
OTRGlobals cleanup (#4251)
* Remove unused headers * Move all "ResourceMgr_" functions to a new file * Don't transitively include SaveManager * Move cvar prefixes to a new header * Add missing includes * Update OTRGlobals.cpp * Fix build * Address review * Fix some of the errors * Update gameplaystats.h * Update z_en_in.c * Hopefully fix the linux issues * Fix Linux issues for real this time, I checked * Update ResourceManagerHelpers.cpp * Update z_obj_mure2.c * Post-merge fixes * Fix build (hopefully) * Post-merge fixes * Update z_file_nameset_PAL.c * cleanup some unnecessary headers (#7) --------- Co-authored-by: Archez <Archez@users.noreply.github.com>
This commit is contained in:
parent
70f3dfa8c5
commit
9bed5af33b
@ -8,7 +8,7 @@
|
||||
#include "functions.h"
|
||||
#include "variables.h"
|
||||
#include "macros.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
#include "soh/Enhancements/gameconsole.h"
|
||||
#include "soh/Enhancements/gameplaystats.h"
|
||||
#include <libultraship/bridge.h>
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "AudioCollection.h"
|
||||
#include "sequence.h"
|
||||
#include "sfx.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
#include <vector>
|
||||
#include <utils/StringHelper.h>
|
||||
#include <libultraship/bridge.h>
|
||||
|
@ -8,9 +8,10 @@
|
||||
#include <libultraship/libultraship.h>
|
||||
#include <functions.h>
|
||||
#include "../randomizer/3drando/random.hpp"
|
||||
#include "../../OTRGlobals.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
#include <utils/StringHelper.h>
|
||||
#include "../../UIWidgets.hpp"
|
||||
#include "soh/UIWidgets.hpp"
|
||||
#include "AudioCollection.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <stdarg.h>
|
||||
#include <z64.h>
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
|
||||
uint8_t gLoadFileSelect = 0, gSkipLogoTest = 0;
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "libultraship/libultra/controller.h"
|
||||
#include "Context.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
#ifndef IMGUI_DEFINE_MATH_OPERATORS
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
#endif
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "../../UIWidgets.hpp"
|
||||
#include "z64.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
#ifndef __WIIU__
|
||||
#include "controller/controldevice/controller/mapping/sdl/SDLAxisDirectionToButtonMapping.h"
|
||||
#endif
|
||||
|
@ -14,10 +14,12 @@
|
||||
|
||||
#include "soh/UIWidgets.hpp"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
|
||||
extern "C" {
|
||||
#include <z64.h>
|
||||
#include "macros.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
extern PlayState* gPlayState;
|
||||
#include "objects/object_link_boy/object_link_boy.h"
|
||||
#include "objects/object_link_child/object_link_child.h"
|
||||
@ -48,9 +50,6 @@ extern PlayState* gPlayState;
|
||||
#include "objects/object_gjyo_objects/object_gjyo_objects.h"
|
||||
#include "textures/nintendo_rogo_static/nintendo_rogo_static.h"
|
||||
#include "objects/object_gi_rabit_mask/object_gi_rabit_mask.h"
|
||||
void ResourceMgr_PatchGfxByName(const char* path, const char* patchName, int index, Gfx instruction);
|
||||
void ResourceMgr_PatchGfxCopyCommandByName(const char* path, const char* patchName, int destinationIndex, int sourceIndex);
|
||||
void ResourceMgr_UnpatchGfxByName(const char* path, const char* patchName);
|
||||
u8 Randomizer_GetSettingValue(RandomizerSettingKey randoSettingKey);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include <libultraship/bridge.h>
|
||||
#include <string>
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
|
||||
extern "C" {
|
||||
#include <libultraship/libultra.h>
|
||||
@ -9,11 +11,6 @@ extern "C" {
|
||||
#include "objects/object_gi_soldout/object_gi_soldout.h"
|
||||
#include "objects/object_ik/object_ik.h"
|
||||
#include "objects/object_link_child/object_link_child.h"
|
||||
|
||||
uint32_t ResourceMgr_GameHasMasterQuest();
|
||||
uint32_t ResourceMgr_GameHasOriginal();
|
||||
void ResourceMgr_PatchGfxByName(const char* path, const char* patchName, int index, Gfx instruction);
|
||||
void ResourceMgr_UnpatchGfxByName(const char* path, const char* patchName);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
#include <soh/Enhancements/item-tables/ItemTableManager.h>
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||
#include "soh/Enhancements/cosmetics/CosmeticsEditor.h"
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "../custom-message/CustomMessageManager.h"
|
||||
#include "functions.h"
|
||||
#include "macros.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
#include "message_data_static.h"
|
||||
#include "variables.h"
|
||||
#include "soh/util.h"
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <libultraship/bridge.h>
|
||||
#include <libultraship/libultraship.h>
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
|
||||
extern "C" {
|
||||
#include <z64.h>
|
||||
|
@ -15,6 +15,7 @@ extern "C" {
|
||||
#include "variables.h"
|
||||
#include "functions.h"
|
||||
#include "macros.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
extern PlayState* gPlayState;
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ extern "C" {
|
||||
#include "variables.h"
|
||||
#include "functions.h"
|
||||
#include "macros.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
#include "soh/Enhancements/randomizer/adult_trade_shuffle.h"
|
||||
extern PlayState* gPlayState;
|
||||
|
||||
|
@ -7,6 +7,7 @@ extern "C" {
|
||||
#include "variables.h"
|
||||
#include "functions.h"
|
||||
#include "macros.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
extern PlayState* gPlayState;
|
||||
void GfxPrint_SetColor(GfxPrint* printer, u32 r, u32 g, u32 b, u32 a);
|
||||
void GfxPrint_SetPos(GfxPrint* printer, s32 x, s32 y);
|
||||
|
@ -6,13 +6,13 @@
|
||||
#include "soh/Enhancements/enhancementTypes.h"
|
||||
#include "variables.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
|
||||
extern "C" {
|
||||
#include <z64.h>
|
||||
}
|
||||
|
||||
extern "C" uint32_t ResourceMgr_IsSceneMasterQuest(s16 sceneNum);
|
||||
|
||||
const char* enemyCVarList[] = {
|
||||
CVAR_ENHANCEMENT("RandomizedEnemyList.Armos"), CVAR_ENHANCEMENT("RandomizedEnemyList.Arwing"),
|
||||
CVAR_ENHANCEMENT("RandomizedEnemyList.BabyDodongo"), CVAR_ENHANCEMENT("RandomizedEnemyList.Bari"),
|
||||
|
@ -8,6 +8,7 @@
|
||||
extern "C" {
|
||||
#include "variables.h"
|
||||
#include "macros.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
#include "functions.h"
|
||||
extern PlayState* gPlayState;
|
||||
}
|
||||
|
@ -1,11 +1,10 @@
|
||||
extern "C" {
|
||||
#include "gameplaystats.h"
|
||||
}
|
||||
#include "gameplaystatswindow.h"
|
||||
|
||||
#include "soh/SaveManager.h"
|
||||
#include "functions.h"
|
||||
#include "macros.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
#include "../UIWidgets.hpp"
|
||||
#include "soh/util.h"
|
||||
|
||||
|
@ -1,5 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include "soh/cvar_prefixes.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
uint64_t GetUnixTimestamp(void);
|
||||
char* GameplayStats_GetCurrentTime();
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
// 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
|
||||
@ -17,7 +29,6 @@
|
||||
gSaveContext.sohStats.sceneTimer)
|
||||
|
||||
void InitStatTracker();
|
||||
char* GameplayStats_GetCurrentTime();
|
||||
|
||||
typedef enum {
|
||||
// 0x00 to 0x9B (0 to 155) used for getting items,
|
||||
|
@ -3,6 +3,9 @@
|
||||
#include "game-interactor/GameInteractor.h"
|
||||
#include "tts/tts.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/SaveManager.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
#include "soh/Enhancements/boss-rush/BossRushTypes.h"
|
||||
#include "soh/Enhancements/boss-rush/BossRush.h"
|
||||
#include "soh/Enhancements/enhancementTypes.h"
|
||||
#include "soh/Enhancements/randomizer/3drando/random.hpp"
|
||||
@ -41,17 +44,15 @@ extern "C" {
|
||||
#include <z64.h>
|
||||
#include "align_asset_macro.h"
|
||||
#include "macros.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
#include "functions.h"
|
||||
#include "variables.h"
|
||||
#include "functions.h"
|
||||
#include "src/overlays/actors/ovl_En_Door/z_en_door.h"
|
||||
void ResourceMgr_PatchGfxByName(const char* path, const char* patchName, int index, Gfx instruction);
|
||||
void ResourceMgr_UnpatchGfxByName(const char* path, const char* patchName);
|
||||
|
||||
extern SaveContext gSaveContext;
|
||||
extern PlayState* gPlayState;
|
||||
extern void Overlay_DisplayText(float duration, const char* text);
|
||||
uint32_t ResourceMgr_IsSceneMasterQuest(s16 sceneNum);
|
||||
}
|
||||
|
||||
// GreyScaleEndDlist
|
||||
|
@ -10,6 +10,7 @@
|
||||
extern "C" {
|
||||
#include "z64.h"
|
||||
#include "macros.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
#include "functions.h"
|
||||
#include "variables.h"
|
||||
#include "textures/message_static/message_static.h"
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "soh/Enhancements/randomizer/randomizerTypes.h"
|
||||
#include "soh/Enhancements/enhancementTypes.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
|
||||
enum PresetEntryType {
|
||||
PRESET_ENTRY_TYPE_S32,
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "soh/Enhancements/randomizer/randomizerTypes.h"
|
||||
#include "variables.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
#include "../option.h"
|
||||
#include "soh/Enhancements/debugger/performanceTimer.h"
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <Context.h>
|
||||
#include <libultraship/libultra/types.h>
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
|
||||
void RandoMain::GenerateRando(std::set<RandomizerCheck> excludedLocations, std::set<RandomizerTrick> enabledTricks,
|
||||
std::string seedString) {
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "functions.h"
|
||||
#include "variables.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
#include "randomizerTypes.h"
|
||||
#include <array>
|
||||
#include "objects/object_gi_key/object_gi_key.h"
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <libultraship/bridge.h>
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
#include "soh/Enhancements/enhancementTypes.h"
|
||||
#include "soh/Enhancements/custom-message/CustomMessageTypes.h"
|
||||
#include "soh/Enhancements/item-tables/ItemTableManager.h"
|
||||
@ -10,6 +11,7 @@
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
#include "soh/ImGuiUtils.h"
|
||||
#include "soh/Notification/Notification.h"
|
||||
#include "soh/SaveManager.h"
|
||||
|
||||
extern "C" {
|
||||
#include "macros.h"
|
||||
@ -1834,7 +1836,7 @@ void RandomizerOnActorInitHandler(void* actorRef) {
|
||||
if (
|
||||
actor->id == ACTOR_OBJ_OSHIHIKI &&
|
||||
LINK_IS_CHILD &&
|
||||
IsGameMasterQuest() &&
|
||||
ResourceMgr_IsGameMasterQuest() &&
|
||||
gPlayState->sceneNum == SCENE_SPIRIT_TEMPLE && actor->room == 6 && // Spirit Temple silver block hallway
|
||||
actor->params == 0x9C7 // Silver block that is marked as in the hole
|
||||
) {
|
||||
|
@ -10,7 +10,9 @@
|
||||
#include <textures/icon_item_24_static/icon_item_24_static.h>
|
||||
#include "3drando/rando_main.hpp"
|
||||
#include "3drando/random.hpp"
|
||||
#include "3drando/custom_messages.hpp"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
#include "soh/UIWidgets.hpp"
|
||||
#include "3drando/custom_messages.hpp"
|
||||
#include "../../UIWidgets.hpp"
|
||||
#ifndef IMGUI_DEFINE_MATH_OPERATORS
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
@ -41,9 +43,6 @@
|
||||
#include "fishsanity.h"
|
||||
#include "randomizerTypes.h"
|
||||
|
||||
extern "C" uint32_t ResourceMgr_IsGameMasterQuest();
|
||||
extern "C" uint32_t ResourceMgr_IsSceneMasterQuest(s16 sceneNum);
|
||||
|
||||
extern std::map<RandomizerCheckArea, std::string> rcAreaNames;
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <libultraship/bridge.h>
|
||||
#include "z64.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
#include "fishsanity.h"
|
||||
|
||||
std::map<RandomizerCheckArea, std::string> rcAreaNames = {
|
||||
|
@ -2,9 +2,12 @@
|
||||
#include "randomizer_entrance_tracker.h"
|
||||
#include "randomizer_item_tracker.h"
|
||||
#include "randomizerTypes.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
#include "soh/SaveManager.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
#include "soh/UIWidgets.hpp"
|
||||
#include "dungeon.h"
|
||||
#include "../../OTRGlobals.h"
|
||||
#include "../../UIWidgets.hpp"
|
||||
#include "3drando/location_access.hpp"
|
||||
|
||||
#include <string>
|
||||
@ -24,7 +27,6 @@ extern "C" {
|
||||
#include "macros.h"
|
||||
extern PlayState* gPlayState;
|
||||
}
|
||||
extern "C" uint32_t ResourceMgr_IsSceneMasterQuest(s16 sceneNum);
|
||||
extern "C" GetItemEntry ItemTable_RetrieveEntry(s16 modIndex, s16 getItemID);
|
||||
|
||||
extern std::vector<ItemTrackerItem> dungeonRewardStones;
|
||||
|
@ -9,6 +9,8 @@
|
||||
|
||||
#include "randomizer_entrance.h"
|
||||
#include "randomizer_grotto.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/SaveManager.h"
|
||||
#include <string.h>
|
||||
|
||||
#include "global.h"
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "randomizer_entrance_tracker.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
#include "soh/UIWidgets.hpp"
|
||||
|
||||
#include <map>
|
||||
|
@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
#include "randomizer_grotto.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
|
||||
#include "global.h"
|
||||
|
||||
|
@ -1,7 +1,10 @@
|
||||
#include "randomizer_item_tracker.h"
|
||||
#include "../../util.h"
|
||||
#include "../../OTRGlobals.h"
|
||||
#include "../../UIWidgets.hpp"
|
||||
#include "soh/util.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
#include "soh/SaveManager.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
#include "soh/UIWidgets.hpp"
|
||||
#include "randomizerTypes.h"
|
||||
|
||||
#include <map>
|
||||
@ -22,7 +25,6 @@ extern PlayState* gPlayState;
|
||||
#include "textures/icon_item_static/icon_item_static.h"
|
||||
#include "textures/icon_item_24_static/icon_item_24_static.h"
|
||||
}
|
||||
extern "C" uint32_t ResourceMgr_IsSceneMasterQuest(s16 sceneNum);
|
||||
|
||||
void DrawEquip(ItemTrackerItem item);
|
||||
void DrawItem(ItemTrackerItem item);
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "savefile.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||
|
||||
extern "C" {
|
||||
@ -8,7 +9,6 @@ extern "C" {
|
||||
#include "functions.h"
|
||||
#include "macros.h"
|
||||
|
||||
uint32_t ResourceMgr_IsSceneMasterQuest(s16 sceneNum);
|
||||
uint8_t Randomizer_GetSettingValue(RandomizerSettingKey randoSettingKey);
|
||||
GetItemEntry Randomizer_GetItemFromKnownCheck(RandomizerCheck randomizerCheck, GetItemID ogId);
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <soh/UIWidgets.hpp>
|
||||
#include <graphic/Fast3D/gfx_pc.h>
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
|
||||
/* Console Variables are grouped under gAdvancedResolution. (e.g. CVAR_PREFIX_ADVANCED_RESOLUTION ".Enabled")
|
||||
|
||||
|
@ -6,17 +6,14 @@
|
||||
#include <fstream>
|
||||
#include <chrono>
|
||||
|
||||
#include <ResourceManager.h>
|
||||
#include "ResourceManagerHelpers.h"
|
||||
#include "graphic/Fast3D/Fast3dWindow.h"
|
||||
#include <File.h>
|
||||
#include <DisplayList.h>
|
||||
#include <Window.h>
|
||||
#include <GameVersions.h>
|
||||
|
||||
#include "z64animation.h"
|
||||
#include "z64bgcheck.h"
|
||||
#include "Enhancements/gameconsole.h"
|
||||
#include <libultraship/libultra/gbi.h>
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#else
|
||||
@ -27,7 +24,6 @@
|
||||
#include "Enhancements/controls/SohInputEditorWindow.h"
|
||||
#include "Enhancements/cosmetics/CosmeticsEditor.h"
|
||||
#include "Enhancements/audio/AudioCollection.h"
|
||||
#include "Enhancements/audio/AudioEditor.h"
|
||||
#include "Enhancements/enhancementTypes.h"
|
||||
#include "Enhancements/debugconsole.h"
|
||||
#include "Enhancements/randomizer/randomizer.h"
|
||||
@ -56,7 +52,6 @@
|
||||
#endif
|
||||
|
||||
#include <Fast3D/gfx_pc.h>
|
||||
#include <Fast3D/gfx_rendering_api.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <SDL_scancode.h>
|
||||
@ -77,6 +72,7 @@
|
||||
#include "Enhancements/item-tables/ItemTableManager.h"
|
||||
#include "SohGui.hpp"
|
||||
#include "ActorDB.h"
|
||||
#include "SaveManager.h"
|
||||
|
||||
#ifdef ENABLE_REMOTE_CONTROL
|
||||
#include "soh/Network/CrowdControl/CrowdControl.h"
|
||||
@ -506,18 +502,11 @@ uint32_t OTRGlobals::GetInterpolationFPS() {
|
||||
return std::min<uint32_t>(Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(), CVarGetInteger(CVAR_SETTING("InterpolationFPS"), 20));
|
||||
}
|
||||
|
||||
struct ExtensionEntry {
|
||||
std::string path;
|
||||
std::string ext;
|
||||
};
|
||||
|
||||
extern "C" void OTRMessage_Init();
|
||||
extern "C" void AudioMgr_CreateNextAudioBuffer(s16* samples, u32 num_samples);
|
||||
extern "C" void AudioPlayer_Play(const uint8_t* buf, uint32_t len);
|
||||
extern "C" int AudioPlayer_Buffered(void);
|
||||
extern "C" int AudioPlayer_GetDesiredBuffered(void);
|
||||
extern "C" void ResourceMgr_LoadDirectory(const char* resName);
|
||||
extern "C" SequenceData ResourceMgr_LoadSeqByName(const char* path);
|
||||
std::unordered_map<std::string, ExtensionEntry> ExtensionCache;
|
||||
|
||||
void OTRAudio_Thread() {
|
||||
@ -1478,269 +1467,7 @@ extern "C" uint16_t OTRGetPixelDepth(float x, float y) {
|
||||
return wnd->GetPixelDepth(x, y);
|
||||
}
|
||||
|
||||
extern "C" uint32_t ResourceMgr_GetNumGameVersions() {
|
||||
return Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions().size();
|
||||
}
|
||||
|
||||
extern "C" uint32_t ResourceMgr_GetGameVersion(int index) {
|
||||
return Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions()[index];
|
||||
}
|
||||
|
||||
extern "C" uint32_t ResourceMgr_GetGamePlatform(int index) {
|
||||
uint32_t version = Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions()[index];
|
||||
|
||||
switch (version) {
|
||||
case OOT_NTSC_US_10:
|
||||
case OOT_NTSC_US_11:
|
||||
case OOT_NTSC_US_12:
|
||||
case OOT_PAL_10:
|
||||
case OOT_PAL_11:
|
||||
return GAME_PLATFORM_N64;
|
||||
case OOT_NTSC_JP_GC:
|
||||
case OOT_NTSC_US_GC:
|
||||
case OOT_PAL_GC:
|
||||
case OOT_NTSC_JP_MQ:
|
||||
case OOT_NTSC_US_MQ:
|
||||
case OOT_PAL_MQ:
|
||||
case OOT_PAL_GC_DBG1:
|
||||
case OOT_PAL_GC_DBG2:
|
||||
case OOT_PAL_GC_MQ_DBG:
|
||||
return GAME_PLATFORM_GC;
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" uint32_t ResourceMgr_GetGameRegion(int index) {
|
||||
uint32_t version = Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions()[index];
|
||||
|
||||
switch (version) {
|
||||
case OOT_NTSC_US_10:
|
||||
case OOT_NTSC_US_11:
|
||||
case OOT_NTSC_US_12:
|
||||
case OOT_NTSC_JP_GC:
|
||||
case OOT_NTSC_US_GC:
|
||||
case OOT_NTSC_JP_MQ:
|
||||
case OOT_NTSC_US_MQ:
|
||||
return GAME_REGION_NTSC;
|
||||
case OOT_PAL_10:
|
||||
case OOT_PAL_11:
|
||||
case OOT_PAL_GC:
|
||||
case OOT_PAL_MQ:
|
||||
case OOT_PAL_GC_DBG1:
|
||||
case OOT_PAL_GC_DBG2:
|
||||
case OOT_PAL_GC_MQ_DBG:
|
||||
return GAME_REGION_PAL;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t IsSceneMasterQuest(s16 sceneNum) {
|
||||
uint32_t value = 0;
|
||||
uint8_t mqMode = CVarGetInteger(CVAR_GENERAL("BetterDebugWarpScreenMQMode"), WARP_MODE_OVERRIDE_OFF);
|
||||
if (mqMode == WARP_MODE_OVERRIDE_MQ_AS_VANILLA) {
|
||||
return 1;
|
||||
} else if (mqMode == WARP_MODE_OVERRIDE_VANILLA_AS_MQ) {
|
||||
return 0;
|
||||
} else {
|
||||
if (OTRGlobals::Instance->HasMasterQuest()) {
|
||||
if (!OTRGlobals::Instance->HasOriginal()) {
|
||||
value = 1;
|
||||
} else if (IS_MASTER_QUEST) {
|
||||
value = 1;
|
||||
} else {
|
||||
value = 0;
|
||||
if (IS_RANDO) {
|
||||
auto dungeon = OTRGlobals::Instance->gRandoContext->GetDungeons()->GetDungeonFromScene(sceneNum);
|
||||
if (dungeon != nullptr && dungeon->IsMQ()) {
|
||||
value = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
uint32_t IsGameMasterQuest() {
|
||||
return gPlayState != NULL ? IsSceneMasterQuest(gPlayState->sceneNum) : 0;
|
||||
}
|
||||
|
||||
extern "C" uint32_t ResourceMgr_GameHasMasterQuest() {
|
||||
return OTRGlobals::Instance->HasMasterQuest();
|
||||
}
|
||||
|
||||
extern "C" uint32_t ResourceMgr_GameHasOriginal() {
|
||||
return OTRGlobals::Instance->HasOriginal();
|
||||
}
|
||||
|
||||
extern "C" uint32_t ResourceMgr_IsSceneMasterQuest(s16 sceneNum) {
|
||||
return IsSceneMasterQuest(sceneNum);
|
||||
}
|
||||
|
||||
extern "C" uint32_t ResourceMgr_IsGameMasterQuest() {
|
||||
return IsGameMasterQuest();
|
||||
}
|
||||
|
||||
extern "C" void ResourceMgr_LoadDirectory(const char* resName) {
|
||||
Ship::Context::GetInstance()->GetResourceManager()->LoadDirectory(resName);
|
||||
}
|
||||
extern "C" void ResourceMgr_DirtyDirectory(const char* resName) {
|
||||
Ship::Context::GetInstance()->GetResourceManager()->DirtyDirectory(resName);
|
||||
}
|
||||
|
||||
extern "C" void ResourceMgr_UnloadResource(const char* resName) {
|
||||
std::string path = resName;
|
||||
if (path.substr(0, 7) == "__OTR__") {
|
||||
path = path.substr(7);
|
||||
}
|
||||
auto res = Ship::Context::GetInstance()->GetResourceManager()->UnloadResource(path);
|
||||
}
|
||||
|
||||
// OTRTODO: There is probably a more elegant way to go about this...
|
||||
// Kenix: This is definitely leaking memory when it's called.
|
||||
extern "C" char** ResourceMgr_ListFiles(const char* searchMask, int* resultSize) {
|
||||
auto lst = Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles(searchMask);
|
||||
char** result = (char**)malloc(lst->size() * sizeof(char*));
|
||||
|
||||
for (size_t i = 0; i < lst->size(); i++) {
|
||||
char* str = (char*)malloc(lst.get()[0][i].size() + 1);
|
||||
memcpy(str, lst.get()[0][i].data(), lst.get()[0][i].size());
|
||||
str[lst.get()[0][i].size()] = '\0';
|
||||
result[i] = str;
|
||||
}
|
||||
*resultSize = lst->size();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
extern "C" uint8_t ResourceMgr_FileExists(const char* filePath) {
|
||||
std::string path = filePath;
|
||||
if(path.substr(0, 7) == "__OTR__"){
|
||||
path = path.substr(7);
|
||||
}
|
||||
|
||||
return ExtensionCache.contains(path);
|
||||
}
|
||||
|
||||
extern "C" uint8_t ResourceMgr_FileAltExists(const char* filePath) {
|
||||
std::string path = filePath;
|
||||
if (path.substr(0, 7) == "__OTR__") {
|
||||
path = path.substr(7);
|
||||
}
|
||||
|
||||
if (path.substr(0, 4) != "alt/") {
|
||||
path = "alt/" + path;
|
||||
}
|
||||
|
||||
return ExtensionCache.contains(path);
|
||||
}
|
||||
|
||||
extern "C" bool ResourceMgr_IsAltAssetsEnabled() {
|
||||
return Ship::Context::GetInstance()->GetResourceManager()->IsAltAssetsEnabled();
|
||||
}
|
||||
|
||||
// Unloads a resource if an alternate version exists when alt assets are enabled
|
||||
// The resource is only removed from the internal cache to prevent it from used in the next resource lookup
|
||||
extern "C" void ResourceMgr_UnloadOriginalWhenAltExists(const char* resName) {
|
||||
if (ResourceMgr_IsAltAssetsEnabled() && ResourceMgr_FileAltExists((char*)resName)) {
|
||||
ResourceMgr_UnloadResource((char*) resName);
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<Ship::IResource> GetResourceByNameHandlingMQ(const char* path) {
|
||||
std::string Path = path;
|
||||
if (ResourceMgr_IsGameMasterQuest()) {
|
||||
size_t pos = 0;
|
||||
if ((pos = Path.find("/nonmq/", 0)) != std::string::npos) {
|
||||
Path.replace(pos, 7, "/mq/");
|
||||
}
|
||||
}
|
||||
return Ship::Context::GetInstance()->GetResourceManager()->LoadResource(Path.c_str());
|
||||
}
|
||||
|
||||
extern "C" char* GetResourceDataByNameHandlingMQ(const char* path) {
|
||||
auto res = GetResourceByNameHandlingMQ(path);
|
||||
|
||||
if (res == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return (char*)res->GetRawPointer();
|
||||
}
|
||||
|
||||
extern "C" uint8_t ResourceMgr_TexIsRaw(const char* texPath) {
|
||||
auto res = std::static_pointer_cast<LUS::Texture>(GetResourceByNameHandlingMQ(texPath));
|
||||
return res->Flags & TEX_FLAG_LOAD_AS_RAW;
|
||||
}
|
||||
|
||||
extern "C" uint8_t ResourceMgr_ResourceIsBackground(char* texPath) {
|
||||
auto res = GetResourceByNameHandlingMQ(texPath);
|
||||
return res->GetInitData()->Type == static_cast<uint32_t>(SOH::ResourceType::SOH_Background);
|
||||
}
|
||||
|
||||
extern "C" char* ResourceMgr_LoadJPEG(char* data, size_t dataSize)
|
||||
{
|
||||
static char* finalBuffer = 0;
|
||||
|
||||
if (finalBuffer == 0)
|
||||
finalBuffer = (char*)malloc(dataSize);
|
||||
|
||||
int w;
|
||||
int h;
|
||||
int comp;
|
||||
|
||||
unsigned char* pixels = stbi_load_from_memory((const unsigned char*)data, 320 * 240 * 2, &w, &h, &comp, STBI_rgb_alpha);
|
||||
//unsigned char* pixels = stbi_load_from_memory((const unsigned char*)data, 480 * 240 * 2, &w, &h, &comp, STBI_rgb_alpha);
|
||||
int idx = 0;
|
||||
|
||||
for (int y = 0; y < h; y++)
|
||||
{
|
||||
for (int x = 0; x < w; x++)
|
||||
{
|
||||
uint16_t* bufferTest = (uint16_t*)finalBuffer;
|
||||
int pixelIdx = ((y * w) + x) * 4;
|
||||
|
||||
uint8_t r = pixels[pixelIdx + 0] / 8;
|
||||
uint8_t g = pixels[pixelIdx + 1] / 8;
|
||||
uint8_t b = pixels[pixelIdx + 2] / 8;
|
||||
|
||||
uint8_t alphaBit = pixels[pixelIdx + 3] != 0;
|
||||
|
||||
uint16_t data = (r << 11) + (g << 6) + (b << 1) + alphaBit;
|
||||
|
||||
finalBuffer[idx++] = (data & 0xFF00) >> 8;
|
||||
finalBuffer[idx++] = (data & 0x00FF);
|
||||
}
|
||||
}
|
||||
|
||||
return (char*)finalBuffer;
|
||||
}
|
||||
|
||||
extern "C" uint16_t ResourceMgr_LoadTexWidthByName(char* texPath);
|
||||
|
||||
extern "C" uint16_t ResourceMgr_LoadTexHeightByName(char* texPath);
|
||||
|
||||
extern "C" char* ResourceMgr_LoadTexOrDListByName(const char* filePath) {
|
||||
auto res = GetResourceByNameHandlingMQ(filePath);
|
||||
|
||||
if (res->GetInitData()->Type == static_cast<uint32_t>(LUS::ResourceType::DisplayList))
|
||||
return (char*)&((std::static_pointer_cast<LUS::DisplayList>(res))->Instructions[0]);
|
||||
else if (res->GetInitData()->Type == static_cast<uint32_t>(SOH::ResourceType::SOH_Array))
|
||||
return (char*)(std::static_pointer_cast<SOH::Array>(res))->Vertices.data();
|
||||
else {
|
||||
return (char*)GetResourceDataByNameHandlingMQ(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" char* ResourceMgr_LoadIfDListByName(const char* filePath) {
|
||||
auto res = GetResourceByNameHandlingMQ(filePath);
|
||||
|
||||
if (res->GetInitData()->Type == static_cast<uint32_t>(LUS::ResourceType::DisplayList))
|
||||
return (char*)&((std::static_pointer_cast<LUS::DisplayList>(res))->Instructions[0]);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
extern "C" Sprite* GetSeedTexture(uint8_t index) {
|
||||
|
||||
return OTRGlobals::Instance->gRandoContext->GetSeedTexture(index);
|
||||
}
|
||||
|
||||
@ -1748,157 +1475,6 @@ extern "C" uint8_t GetSeedIconIndex(uint8_t index) {
|
||||
return OTRGlobals::Instance->gRandoContext->hashIconIndexes[index];
|
||||
}
|
||||
|
||||
extern "C" char* ResourceMgr_LoadPlayerAnimByName(const char* animPath) {
|
||||
auto anim = std::static_pointer_cast<SOH::PlayerAnimation>(GetResourceByNameHandlingMQ(animPath));
|
||||
|
||||
return (char*)&anim->limbRotData[0];
|
||||
}
|
||||
|
||||
extern "C" void ResourceMgr_PushCurrentDirectory(char* path)
|
||||
{
|
||||
gfx_push_current_dir(path);
|
||||
}
|
||||
|
||||
extern "C" Gfx* ResourceMgr_LoadGfxByName(const char* path)
|
||||
{
|
||||
// When an alt resource exists for the DL, we need to unload the original asset
|
||||
// to clear the cache so the alt asset will be loaded instead
|
||||
// OTRTODO: If Alt loading over original cache is fixed, this line can most likely be removed
|
||||
ResourceMgr_UnloadOriginalWhenAltExists(path);
|
||||
|
||||
auto res = std::static_pointer_cast<LUS::DisplayList>(GetResourceByNameHandlingMQ(path));
|
||||
return (Gfx*)&res->Instructions[0];
|
||||
}
|
||||
|
||||
extern "C" uint8_t ResourceMgr_FileIsCustomByName(const char* path) {
|
||||
auto res = std::static_pointer_cast<LUS::DisplayList>(GetResourceByNameHandlingMQ(path));
|
||||
return res->GetInitData()->IsCustom;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
int index;
|
||||
Gfx instruction;
|
||||
} GfxPatch;
|
||||
|
||||
std::unordered_map<std::string, std::unordered_map<std::string, GfxPatch>> originalGfx;
|
||||
|
||||
// Attention! This is primarily for cosmetics & bug fixes. For things like mods and model replacement you should be using OTRs
|
||||
// instead (When that is available). Index can be found using the commented out section below.
|
||||
extern "C" void ResourceMgr_PatchGfxByName(const char* path, const char* patchName, int index, Gfx instruction) {
|
||||
auto res = std::static_pointer_cast<LUS::DisplayList>(
|
||||
Ship::Context::GetInstance()->GetResourceManager()->LoadResource(path));
|
||||
|
||||
// Leaving this here for people attempting to find the correct Dlist index to patch
|
||||
/*if (strcmp("__OTR__objects/object_gi_longsword/gGiBiggoronSwordDL", path) == 0) {
|
||||
for (int i = 0; i < res->instructions.size(); i++) {
|
||||
Gfx* gfx = (Gfx*)&res->instructions[i];
|
||||
// Log all commands
|
||||
// SPDLOG_INFO("index:{} command:{}", i, gfx->words.w0 >> 24);
|
||||
// Log only SetPrimColors
|
||||
if (gfx->words.w0 >> 24 == 250) {
|
||||
SPDLOG_INFO("index:{} r:{} g:{} b:{} a:{}", i, _SHIFTR(gfx->words.w1, 24, 8), _SHIFTR(gfx->words.w1, 16, 8), _SHIFTR(gfx->words.w1, 8, 8), _SHIFTR(gfx->words.w1, 0, 8));
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// Index refers to individual gfx words, which are half the size on 32-bit
|
||||
// if (sizeof(uintptr_t) < 8) {
|
||||
// index /= 2;
|
||||
// }
|
||||
|
||||
// Do not patch custom assets as they most likely do not have the same instructions as authentic assets
|
||||
if (res->GetInitData()->IsCustom) {
|
||||
return;
|
||||
}
|
||||
|
||||
Gfx* gfx = (Gfx*)&res->Instructions[index];
|
||||
|
||||
if (!originalGfx.contains(path) || !originalGfx[path].contains(patchName)) {
|
||||
originalGfx[path][patchName] = {
|
||||
index,
|
||||
*gfx
|
||||
};
|
||||
}
|
||||
|
||||
*gfx = instruction;
|
||||
}
|
||||
|
||||
extern "C" void ResourceMgr_PatchGfxCopyCommandByName(const char* path, const char* patchName, int destinationIndex, int sourceIndex) {
|
||||
auto res = std::static_pointer_cast<LUS::DisplayList>(
|
||||
Ship::Context::GetInstance()->GetResourceManager()->LoadResource(path));
|
||||
|
||||
// Do not patch custom assets as they most likely do not have the same instructions as authentic assets
|
||||
if (res->GetInitData()->IsCustom) {
|
||||
return;
|
||||
}
|
||||
|
||||
Gfx* destinationGfx = (Gfx*)&res->Instructions[destinationIndex];
|
||||
Gfx sourceGfx = *(Gfx*)&res->Instructions[sourceIndex];
|
||||
|
||||
if (!originalGfx.contains(path) || !originalGfx[path].contains(patchName)) {
|
||||
originalGfx[path][patchName] = {
|
||||
destinationIndex,
|
||||
*destinationGfx
|
||||
};
|
||||
}
|
||||
|
||||
*destinationGfx = sourceGfx;
|
||||
}
|
||||
|
||||
extern "C" void ResourceMgr_UnpatchGfxByName(const char* path, const char* patchName) {
|
||||
if (originalGfx.contains(path) && originalGfx[path].contains(patchName)) {
|
||||
auto res = std::static_pointer_cast<LUS::DisplayList>(
|
||||
Ship::Context::GetInstance()->GetResourceManager()->LoadResource(path));
|
||||
|
||||
Gfx* gfx = (Gfx*)&res->Instructions[originalGfx[path][patchName].index];
|
||||
*gfx = originalGfx[path][patchName].instruction;
|
||||
|
||||
originalGfx[path].erase(patchName);
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" char* ResourceMgr_LoadArrayByName(const char* path)
|
||||
{
|
||||
auto res = std::static_pointer_cast<SOH::Array>(GetResourceByNameHandlingMQ(path));
|
||||
|
||||
return (char*)res->Scalars.data();
|
||||
}
|
||||
|
||||
// Return of LoadArrayByNameAsVec3s must be freed by the caller
|
||||
extern "C" char* ResourceMgr_LoadArrayByNameAsVec3s(const char* path) {
|
||||
auto res = std::static_pointer_cast<SOH::Array>(GetResourceByNameHandlingMQ(path));
|
||||
|
||||
// if (res->CachedGameAsset != nullptr)
|
||||
// return (char*)res->CachedGameAsset;
|
||||
// else
|
||||
// {
|
||||
Vec3s* data = (Vec3s*)malloc(sizeof(Vec3s) * res->Scalars.size());
|
||||
|
||||
for (size_t i = 0; i < res->Scalars.size(); i += 3) {
|
||||
data[(i / 3)].x = res->Scalars[i + 0].s16;
|
||||
data[(i / 3)].y = res->Scalars[i + 1].s16;
|
||||
data[(i / 3)].z = res->Scalars[i + 2].s16;
|
||||
}
|
||||
|
||||
// res->CachedGameAsset = data;
|
||||
|
||||
return (char*)data;
|
||||
// }
|
||||
}
|
||||
|
||||
extern "C" CollisionHeader* ResourceMgr_LoadColByName(const char* path) {
|
||||
return (CollisionHeader*) ResourceGetDataByName(path);
|
||||
}
|
||||
|
||||
extern "C" Vtx* ResourceMgr_LoadVtxByName(char* path) {
|
||||
return (Vtx*) ResourceGetDataByName(path);
|
||||
}
|
||||
|
||||
extern "C" SequenceData ResourceMgr_LoadSeqByName(const char* path) {
|
||||
SequenceData* sequence = (SequenceData*) ResourceGetDataByName(path);
|
||||
return *sequence;
|
||||
}
|
||||
|
||||
std::map<std::string, SoundFontSample*> cachedCustomSFs;
|
||||
|
||||
extern "C" SoundFontSample* ReadCustomSample(const char* path) {
|
||||
@ -1959,81 +1535,6 @@ extern "C" SoundFontSample* ReadCustomSample(const char* path) {
|
||||
*/
|
||||
}
|
||||
|
||||
extern "C" SoundFontSample* ResourceMgr_LoadAudioSample(const char* path) {
|
||||
return (SoundFontSample*) ResourceGetDataByName(path);
|
||||
}
|
||||
|
||||
extern "C" SoundFont* ResourceMgr_LoadAudioSoundFont(const char* path) {
|
||||
return (SoundFont*) ResourceGetDataByName(path);
|
||||
}
|
||||
|
||||
extern "C" int ResourceMgr_OTRSigCheck(char* imgData)
|
||||
{
|
||||
uintptr_t i = (uintptr_t)(imgData);
|
||||
|
||||
// if (i == 0xD9000000 || i == 0xE7000000 || (i & 1) == 1)
|
||||
if ((i & 1) == 1)
|
||||
return 0;
|
||||
|
||||
// if ((i & 0xFF000000) != 0xAB000000 && (i & 0xFF000000) != 0xCD000000 && i != 0) {
|
||||
if (i != 0) {
|
||||
if (imgData[0] == '_' && imgData[1] == '_' && imgData[2] == 'O' && imgData[3] == 'T' && imgData[4] == 'R' &&
|
||||
imgData[5] == '_' && imgData[6] == '_')
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" AnimationHeaderCommon* ResourceMgr_LoadAnimByName(const char* path) {
|
||||
return (AnimationHeaderCommon*) ResourceGetDataByName(path);
|
||||
}
|
||||
|
||||
extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path, SkelAnime* skelAnime) {
|
||||
std::string pathStr = std::string(path);
|
||||
static const std::string sOtr = "__OTR__";
|
||||
|
||||
if (pathStr.starts_with(sOtr)) {
|
||||
pathStr = pathStr.substr(sOtr.length());
|
||||
}
|
||||
|
||||
bool isAlt = ResourceMgr_IsAltAssetsEnabled();
|
||||
|
||||
if (isAlt) {
|
||||
pathStr = Ship::IResource::gAltAssetPrefix + pathStr;
|
||||
}
|
||||
|
||||
SkeletonHeader* skelHeader = (SkeletonHeader*) ResourceGetDataByName(pathStr.c_str());
|
||||
|
||||
// If there isn't an alternate model, load the regular one
|
||||
if (isAlt && skelHeader == NULL) {
|
||||
skelHeader = (SkeletonHeader*) ResourceGetDataByName(path);
|
||||
}
|
||||
|
||||
// This function is only called when a skeleton is initialized.
|
||||
// Therefore we can take this oppurtunity to take note of the Skeleton that is created...
|
||||
if (skelAnime != nullptr) {
|
||||
auto stringPath = std::string(path);
|
||||
SOH::SkeletonPatcher::RegisterSkeleton(stringPath, skelAnime);
|
||||
}
|
||||
|
||||
return skelHeader;
|
||||
}
|
||||
|
||||
extern "C" void ResourceMgr_UnregisterSkeleton(SkelAnime* skelAnime) {
|
||||
if (skelAnime != nullptr)
|
||||
SOH::SkeletonPatcher::UnregisterSkeleton(skelAnime);
|
||||
}
|
||||
|
||||
extern "C" void ResourceMgr_ClearSkeletons(SkelAnime* skelAnime) {
|
||||
if (skelAnime != nullptr)
|
||||
SOH::SkeletonPatcher::ClearSkeletons();
|
||||
}
|
||||
|
||||
extern "C" s32* ResourceMgr_LoadCSByName(const char* path) {
|
||||
return (s32*)GetResourceDataByNameHandlingMQ(path);
|
||||
}
|
||||
|
||||
std::filesystem::path GetSaveFile(std::shared_ptr<Ship::Config> Conf) {
|
||||
const std::string fileName = Conf->GetString("Game.SaveName", Ship::Context::GetPathRelativeToAppDirectory("oot_save.sav"));
|
||||
std::filesystem::path saveFile = std::filesystem::absolute(fileName);
|
||||
@ -2884,7 +2385,7 @@ extern "C" void Gfx_TextureCacheDelete(const uint8_t* texAddr) {
|
||||
}
|
||||
|
||||
if (ResourceMgr_OTRSigCheck(imgName)) {
|
||||
texAddr = (const uint8_t*)GetResourceDataByNameHandlingMQ(imgName);
|
||||
texAddr = (const uint8_t*)ResourceMgr_GetResourceDataByNameHandlingMQ(imgName);
|
||||
}
|
||||
|
||||
gfx_texture_cache_delete(texAddr);
|
||||
|
@ -3,15 +3,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "SaveManager.h"
|
||||
#include <soh/Enhancements/item-tables/ItemTableTypes.h>
|
||||
|
||||
#define GAME_REGION_NTSC 0
|
||||
#define GAME_REGION_PAL 1
|
||||
|
||||
#define GAME_PLATFORM_N64 0
|
||||
#define GAME_PLATFORM_GC 1
|
||||
|
||||
#define BTN_CUSTOM_MODIFIER1 0x0040
|
||||
#define BTN_CUSTOM_MODIFIER2 0x0080
|
||||
|
||||
@ -29,6 +20,14 @@
|
||||
#include "Enhancements/savestates.h"
|
||||
#include "Enhancements/randomizer/randomizer.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
struct ExtensionEntry {
|
||||
std::string path;
|
||||
std::string ext;
|
||||
};
|
||||
|
||||
extern std::unordered_map<std::string, ExtensionEntry> ExtensionCache;
|
||||
#include "Enhancements/randomizer/context.h"
|
||||
|
||||
const std::string customMessageTableID = "BaseGameOverrides";
|
||||
@ -42,60 +41,39 @@ const uint32_t defaultImGuiScale = 1;
|
||||
|
||||
const float imguiScaleOptionToValue[4] = { 0.75f, 1.0f, 1.5f, 2.0f };
|
||||
|
||||
class OTRGlobals
|
||||
{
|
||||
public:
|
||||
static OTRGlobals* Instance;
|
||||
class OTRGlobals {
|
||||
public:
|
||||
static OTRGlobals* Instance;
|
||||
|
||||
std::shared_ptr<Ship::Context> context;
|
||||
std::shared_ptr<SaveStateMgr> gSaveStateMgr;
|
||||
std::shared_ptr<Randomizer> gRandomizer;
|
||||
std::shared_ptr<Rando::Context> gRandoContext;
|
||||
|
||||
ImFont* defaultFontSmaller;
|
||||
ImFont* defaultFontLarger;
|
||||
ImFont* defaultFontLargest;
|
||||
ImFont* defaultFontSmaller;
|
||||
ImFont* defaultFontLarger;
|
||||
ImFont* defaultFontLargest;
|
||||
|
||||
OTRGlobals();
|
||||
~OTRGlobals();
|
||||
|
||||
void ScaleImGui();
|
||||
OTRGlobals();
|
||||
~OTRGlobals();
|
||||
|
||||
bool HasMasterQuest();
|
||||
bool HasOriginal();
|
||||
uint32_t GetInterpolationFPS();
|
||||
std::shared_ptr<std::vector<std::string>> ListFiles(std::string path);
|
||||
void ScaleImGui();
|
||||
|
||||
private:
|
||||
void CheckSaveFile(size_t sramSize) const;
|
||||
bool hasMasterQuest;
|
||||
bool hasOriginal;
|
||||
ImFont* CreateDefaultFontWithSize(float size);
|
||||
bool HasMasterQuest();
|
||||
bool HasOriginal();
|
||||
uint32_t GetInterpolationFPS();
|
||||
std::shared_ptr<std::vector<std::string>> ListFiles(std::string path);
|
||||
|
||||
private:
|
||||
void CheckSaveFile(size_t sramSize) const;
|
||||
bool hasMasterQuest;
|
||||
bool hasOriginal;
|
||||
ImFont* CreateDefaultFontWithSize(float size);
|
||||
};
|
||||
|
||||
uint32_t IsGameMasterQuest();
|
||||
#endif
|
||||
|
||||
#define CVAR_RANDOMIZER_ENHANCEMENT(var) CVAR_PREFIX_RANDOMIZER_ENHANCEMENT "." var
|
||||
#define CVAR_RANDOMIZER_SETTING(var) CVAR_PREFIX_RANDOMIZER_SETTING "." var
|
||||
#define CVAR_COSMETIC(var) CVAR_PREFIX_COSMETIC "." var
|
||||
#define CVAR_AUDIO(var) CVAR_PREFIX_AUDIO "." var
|
||||
#define CVAR_CHEAT(var) CVAR_PREFIX_CHEAT "." var
|
||||
#define CVAR_ENHANCEMENT(var) CVAR_PREFIX_ENHANCEMENT "." var
|
||||
#define CVAR_SETTING(var) CVAR_PREFIX_SETTING "." var
|
||||
#define CVAR_WINDOW(var) CVAR_PREFIX_WINDOW "." var
|
||||
#define CVAR_TRACKER(var) CVAR_PREFIX_TRACKER "." var
|
||||
#define CVAR_TRACKER_ITEM(var) CVAR_TRACKER(".ItemTracker." var)
|
||||
#define CVAR_TRACKER_CHECK(var) CVAR_TRACKER(".CheckTracker." var)
|
||||
#define CVAR_TRACKER_ENTRANCE(var) CVAR_TRACKER(".EntranceTracker." var)
|
||||
#define CVAR_DEVELOPER_TOOLS(var) CVAR_PREFIX_DEVELOPER_TOOLS "." var
|
||||
#define CVAR_GENERAL(var) CVAR_PREFIX_GENERAL "." var
|
||||
#define CVAR_REMOTE(var) CVAR_PREFIX_REMOTE "." var
|
||||
#define CVAR_REMOTE_CROWD_CONTROL(var) CVAR_REMOTE(".CrowdControl." var)
|
||||
#define CVAR_REMOTE_SAIL(var) CVAR_REMOTE(".Sail." var)
|
||||
|
||||
#ifndef __cplusplus
|
||||
void InitOTR(void);
|
||||
void InitOTR(void);
|
||||
void DeinitOTR(void);
|
||||
void VanillaItemTable_Init();
|
||||
void OTRAudio_Init();
|
||||
@ -109,53 +87,12 @@ void OTRGfxPrint(const char* str, void* printer, void (*printImpl)(void*, char))
|
||||
void OTRGetPixelDepthPrepare(float x, float y);
|
||||
uint16_t OTRGetPixelDepth(float x, float y);
|
||||
int32_t OTRGetLastScancode();
|
||||
uint32_t ResourceMgr_IsGameMasterQuest();
|
||||
uint32_t ResourceMgr_IsSceneMasterQuest(s16 sceneNum);
|
||||
uint32_t ResourceMgr_GameHasMasterQuest();
|
||||
uint32_t ResourceMgr_GameHasOriginal();
|
||||
uint32_t ResourceMgr_GetNumGameVersions();
|
||||
uint32_t ResourceMgr_GetGameVersion(int index);
|
||||
uint32_t ResourceMgr_GetGamePlatform(int index);
|
||||
uint32_t ResourceMgr_GetGameRegion(int index);
|
||||
void ResourceMgr_LoadDirectory(const char* resName);
|
||||
void ResourceMgr_UnloadResource(const char* resName);
|
||||
char** ResourceMgr_ListFiles(const char* searchMask, int* resultSize);
|
||||
uint8_t ResourceMgr_FileExists(const char* resName);
|
||||
uint8_t ResourceMgr_FileAltExists(const char* resName);
|
||||
void ResourceMgr_UnloadOriginalWhenAltExists(const char* resName);
|
||||
char* GetResourceDataByNameHandlingMQ(const char* path);
|
||||
uint8_t ResourceMgr_TexIsRaw(const char* texPath);
|
||||
uint8_t ResourceMgr_ResourceIsBackground(char* texPath);
|
||||
char* ResourceMgr_LoadJPEG(char* data, size_t dataSize);
|
||||
uint16_t ResourceMgr_LoadTexWidthByName(char* texPath);
|
||||
uint16_t ResourceMgr_LoadTexHeightByName(char* texPath);
|
||||
char* ResourceMgr_LoadTexOrDListByName(const char* filePath);
|
||||
char* ResourceMgr_LoadPlayerAnimByName(const char* animPath);
|
||||
AnimationHeaderCommon* ResourceMgr_LoadAnimByName(const char* path);
|
||||
char* ResourceMgr_GetNameByCRC(uint64_t crc, char* alloc);
|
||||
Gfx* ResourceMgr_LoadGfxByCRC(uint64_t crc);
|
||||
Gfx* ResourceMgr_LoadGfxByName(const char* path);
|
||||
uint8_t ResourceMgr_FileIsCustomByName(const char* path);
|
||||
void ResourceMgr_PatchGfxByName(const char* path, const char* patchName, int index, Gfx instruction);
|
||||
void ResourceMgr_UnpatchGfxByName(const char* path, const char* patchName);
|
||||
char* ResourceMgr_LoadArrayByNameAsVec3s(const char* path);
|
||||
Vtx* ResourceMgr_LoadVtxByCRC(uint64_t crc);
|
||||
|
||||
Vtx* ResourceMgr_LoadVtxByName(char* path);
|
||||
SoundFont* ResourceMgr_LoadAudioSoundFont(const char* path);
|
||||
SequenceData ResourceMgr_LoadSeqByName(const char* path);
|
||||
SoundFontSample* ResourceMgr_LoadAudioSample(const char* path);
|
||||
CollisionHeader* ResourceMgr_LoadColByName(const char* path);
|
||||
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();
|
||||
bool ResourceMgr_IsAltAssetsEnabled();
|
||||
struct SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path, SkelAnime* skelAnime);
|
||||
void ResourceMgr_UnregisterSkeleton(SkelAnime* skelAnime);
|
||||
void ResourceMgr_ClearSkeletons();
|
||||
s32* ResourceMgr_LoadCSByName(const char* path);
|
||||
int ResourceMgr_OTRSigCheck(char* imgData);
|
||||
uint64_t osGetTime(void);
|
||||
uint32_t osGetCount(void);
|
||||
uint32_t OTRGetCurrentWidth(void);
|
||||
|
505
soh/soh/ResourceManagerHelpers.cpp
Normal file
505
soh/soh/ResourceManagerHelpers.cpp
Normal file
@ -0,0 +1,505 @@
|
||||
#include "ResourceManagerHelpers.h"
|
||||
#include "OTRGlobals.h"
|
||||
#include "variables.h"
|
||||
#include "z64.h"
|
||||
#include "cvar_prefixes.h"
|
||||
#include "Enhancements/enhancementTypes.h"
|
||||
#include "Enhancements/randomizer/dungeon.h"
|
||||
#include <libultraship/libultraship.h>
|
||||
#include <GameVersions.h>
|
||||
#include "resource/type/SohResourceType.h"
|
||||
#include "resource/type/Array.h"
|
||||
#include "resource/type/Skeleton.h"
|
||||
#include "resource/type/PlayerAnimation.h"
|
||||
#include <Fast3D/gfx_pc.h>
|
||||
#include <DisplayList.h>
|
||||
|
||||
extern "C" PlayState* gPlayState;
|
||||
|
||||
extern "C" uint32_t ResourceMgr_GetNumGameVersions() {
|
||||
return Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions().size();
|
||||
}
|
||||
|
||||
extern "C" uint32_t ResourceMgr_GetGameVersion(int index) {
|
||||
return Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions()[index];
|
||||
}
|
||||
|
||||
extern "C" uint32_t ResourceMgr_GetGamePlatform(int index) {
|
||||
uint32_t version = Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions()[index];
|
||||
|
||||
switch (version) {
|
||||
case OOT_NTSC_US_10:
|
||||
case OOT_NTSC_US_11:
|
||||
case OOT_NTSC_US_12:
|
||||
case OOT_PAL_10:
|
||||
case OOT_PAL_11:
|
||||
return GAME_PLATFORM_N64;
|
||||
case OOT_NTSC_JP_GC:
|
||||
case OOT_NTSC_US_GC:
|
||||
case OOT_PAL_GC:
|
||||
case OOT_NTSC_JP_MQ:
|
||||
case OOT_NTSC_US_MQ:
|
||||
case OOT_PAL_MQ:
|
||||
case OOT_PAL_GC_DBG1:
|
||||
case OOT_PAL_GC_DBG2:
|
||||
case OOT_PAL_GC_MQ_DBG:
|
||||
return GAME_PLATFORM_GC;
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" uint32_t ResourceMgr_GetGameRegion(int index) {
|
||||
uint32_t version = Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions()[index];
|
||||
|
||||
switch (version) {
|
||||
case OOT_NTSC_US_10:
|
||||
case OOT_NTSC_US_11:
|
||||
case OOT_NTSC_US_12:
|
||||
case OOT_NTSC_JP_GC:
|
||||
case OOT_NTSC_US_GC:
|
||||
case OOT_NTSC_JP_MQ:
|
||||
case OOT_NTSC_US_MQ:
|
||||
return GAME_REGION_NTSC;
|
||||
case OOT_PAL_10:
|
||||
case OOT_PAL_11:
|
||||
case OOT_PAL_GC:
|
||||
case OOT_PAL_MQ:
|
||||
case OOT_PAL_GC_DBG1:
|
||||
case OOT_PAL_GC_DBG2:
|
||||
case OOT_PAL_GC_MQ_DBG:
|
||||
return GAME_REGION_PAL;
|
||||
}
|
||||
}
|
||||
|
||||
u32 IsSceneMasterQuest(s16 sceneNum) {
|
||||
u8 mqMode = CVarGetInteger(CVAR_GENERAL("BetterDebugWarpScreenMQMode"), WARP_MODE_OVERRIDE_OFF);
|
||||
if (mqMode == WARP_MODE_OVERRIDE_MQ_AS_VANILLA) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mqMode == WARP_MODE_OVERRIDE_VANILLA_AS_MQ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (OTRGlobals::Instance->HasMasterQuest()) {
|
||||
if (!OTRGlobals::Instance->HasOriginal()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (IS_MASTER_QUEST) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (IS_RANDO) {
|
||||
auto dungeon = OTRGlobals::Instance->gRandoContext->GetDungeons()->GetDungeonFromScene(sceneNum);
|
||||
if (dungeon != nullptr && dungeon->IsMQ()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
extern "C" uint32_t ResourceMgr_GameHasMasterQuest() {
|
||||
return OTRGlobals::Instance->HasMasterQuest();
|
||||
}
|
||||
|
||||
extern "C" uint32_t ResourceMgr_GameHasOriginal() {
|
||||
return OTRGlobals::Instance->HasOriginal();
|
||||
}
|
||||
|
||||
extern "C" uint32_t ResourceMgr_IsSceneMasterQuest(s16 sceneNum) {
|
||||
return IsSceneMasterQuest(sceneNum);
|
||||
}
|
||||
|
||||
extern "C" uint32_t ResourceMgr_IsGameMasterQuest() {
|
||||
return gPlayState != NULL ? IsSceneMasterQuest(gPlayState->sceneNum) : 0;
|
||||
}
|
||||
|
||||
extern "C" void ResourceMgr_LoadDirectory(const char* resName) {
|
||||
Ship::Context::GetInstance()->GetResourceManager()->LoadDirectory(resName);
|
||||
}
|
||||
|
||||
extern "C" void ResourceMgr_DirtyDirectory(const char* resName) {
|
||||
Ship::Context::GetInstance()->GetResourceManager()->DirtyDirectory(resName);
|
||||
}
|
||||
|
||||
extern "C" void ResourceMgr_UnloadResource(const char* resName) {
|
||||
std::string path = resName;
|
||||
if (path.substr(0, 7) == "__OTR__") {
|
||||
path = path.substr(7);
|
||||
}
|
||||
auto res = Ship::Context::GetInstance()->GetResourceManager()->UnloadResource(path);
|
||||
}
|
||||
|
||||
// OTRTODO: There is probably a more elegant way to go about this...
|
||||
// Kenix: This is definitely leaking memory when it's called.
|
||||
extern "C" char** ResourceMgr_ListFiles(const char* searchMask, int* resultSize) {
|
||||
auto lst = Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles(searchMask);
|
||||
char** result = (char**)malloc(lst->size() * sizeof(char*));
|
||||
|
||||
for (size_t i = 0; i < lst->size(); i++) {
|
||||
char* str = (char*)malloc(lst.get()[0][i].size() + 1);
|
||||
memcpy(str, lst.get()[0][i].data(), lst.get()[0][i].size());
|
||||
str[lst.get()[0][i].size()] = '\0';
|
||||
result[i] = str;
|
||||
}
|
||||
*resultSize = lst->size();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
extern "C" uint8_t ResourceMgr_FileExists(const char* filePath) {
|
||||
std::string path = filePath;
|
||||
if(path.substr(0, 7) == "__OTR__"){
|
||||
path = path.substr(7);
|
||||
}
|
||||
|
||||
return ExtensionCache.contains(path);
|
||||
}
|
||||
|
||||
extern "C" uint8_t ResourceMgr_FileAltExists(const char* filePath) {
|
||||
std::string path = filePath;
|
||||
if (path.substr(0, 7) == "__OTR__") {
|
||||
path = path.substr(7);
|
||||
}
|
||||
|
||||
if (path.substr(0, 4) != "alt/") {
|
||||
path = "alt/" + path;
|
||||
}
|
||||
|
||||
return ExtensionCache.contains(path);
|
||||
}
|
||||
|
||||
extern "C" bool ResourceMgr_IsAltAssetsEnabled() {
|
||||
return Ship::Context::GetInstance()->GetResourceManager()->IsAltAssetsEnabled();
|
||||
}
|
||||
|
||||
// Unloads a resource if an alternate version exists when alt assets are enabled
|
||||
// The resource is only removed from the internal cache to prevent it from used in the next resource lookup
|
||||
extern "C" void ResourceMgr_UnloadOriginalWhenAltExists(const char* resName) {
|
||||
if (ResourceMgr_IsAltAssetsEnabled() && ResourceMgr_FileAltExists((char*)resName)) {
|
||||
ResourceMgr_UnloadResource((char*) resName);
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<Ship::IResource> ResourceMgr_GetResourceByNameHandlingMQ(const char* path) {
|
||||
std::string Path = path;
|
||||
if (ResourceMgr_IsGameMasterQuest()) {
|
||||
size_t pos = 0;
|
||||
if ((pos = Path.find("/nonmq/", 0)) != std::string::npos) {
|
||||
Path.replace(pos, 7, "/mq/");
|
||||
}
|
||||
}
|
||||
return Ship::Context::GetInstance()->GetResourceManager()->LoadResource(Path.c_str());
|
||||
}
|
||||
|
||||
extern "C" char* ResourceMgr_GetResourceDataByNameHandlingMQ(const char* path) {
|
||||
auto res = ResourceMgr_GetResourceByNameHandlingMQ(path);
|
||||
|
||||
if (res == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return (char*)res->GetRawPointer();
|
||||
}
|
||||
|
||||
extern "C" uint8_t ResourceMgr_TexIsRaw(const char* texPath) {
|
||||
auto res = std::static_pointer_cast<LUS::Texture>(ResourceMgr_GetResourceByNameHandlingMQ(texPath));
|
||||
return res->Flags & TEX_FLAG_LOAD_AS_RAW;
|
||||
}
|
||||
|
||||
extern "C" uint8_t ResourceMgr_ResourceIsBackground(char* texPath) {
|
||||
auto res = ResourceMgr_GetResourceByNameHandlingMQ(texPath);
|
||||
return res->GetInitData()->Type == static_cast<uint32_t>(SOH::ResourceType::SOH_Background);
|
||||
}
|
||||
|
||||
extern "C" char* ResourceMgr_LoadJPEG(char* data, size_t dataSize) {
|
||||
static char* finalBuffer = 0;
|
||||
|
||||
if (finalBuffer == 0) {
|
||||
finalBuffer = (char*)malloc(dataSize);
|
||||
}
|
||||
|
||||
int w;
|
||||
int h;
|
||||
int comp;
|
||||
|
||||
unsigned char* pixels = stbi_load_from_memory((const unsigned char*)data, 320 * 240 * 2, &w, &h, &comp, STBI_rgb_alpha);
|
||||
//unsigned char* pixels = stbi_load_from_memory((const unsigned char*)data, 480 * 240 * 2, &w, &h, &comp, STBI_rgb_alpha);
|
||||
int idx = 0;
|
||||
|
||||
for (int y = 0; y < h; y++) {
|
||||
for (int x = 0; x < w; x++) {
|
||||
uint16_t* bufferTest = (uint16_t*)finalBuffer;
|
||||
int pixelIdx = ((y * w) + x) * 4;
|
||||
|
||||
uint8_t r = pixels[pixelIdx + 0] / 8;
|
||||
uint8_t g = pixels[pixelIdx + 1] / 8;
|
||||
uint8_t b = pixels[pixelIdx + 2] / 8;
|
||||
|
||||
uint8_t alphaBit = pixels[pixelIdx + 3] != 0;
|
||||
|
||||
uint16_t data = (r << 11) + (g << 6) + (b << 1) + alphaBit;
|
||||
|
||||
finalBuffer[idx++] = (data & 0xFF00) >> 8;
|
||||
finalBuffer[idx++] = (data & 0x00FF);
|
||||
}
|
||||
}
|
||||
|
||||
return (char*)finalBuffer;
|
||||
}
|
||||
|
||||
extern "C" char* ResourceMgr_LoadTexOrDListByName(const char* filePath) {
|
||||
auto res = ResourceMgr_GetResourceByNameHandlingMQ(filePath);
|
||||
|
||||
if (res->GetInitData()->Type == static_cast<uint32_t>(LUS::ResourceType::DisplayList)) {
|
||||
return (char*)&((std::static_pointer_cast<LUS::DisplayList>(res))->Instructions[0]);
|
||||
}
|
||||
|
||||
if (res->GetInitData()->Type == static_cast<uint32_t>(SOH::ResourceType::SOH_Array)) {
|
||||
return (char*)(std::static_pointer_cast<SOH::Array>(res))->Vertices.data();
|
||||
}
|
||||
|
||||
return (char*)ResourceMgr_GetResourceDataByNameHandlingMQ(filePath);
|
||||
}
|
||||
|
||||
extern "C" char* ResourceMgr_LoadIfDListByName(const char* filePath) {
|
||||
auto res = ResourceMgr_GetResourceByNameHandlingMQ(filePath);
|
||||
|
||||
if (res->GetInitData()->Type == static_cast<uint32_t>(LUS::ResourceType::DisplayList)) {
|
||||
return (char*)&((std::static_pointer_cast<LUS::DisplayList>(res))->Instructions[0]);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
extern "C" char* ResourceMgr_LoadPlayerAnimByName(const char* animPath) {
|
||||
auto anim = std::static_pointer_cast<SOH::PlayerAnimation>(ResourceMgr_GetResourceByNameHandlingMQ(animPath));
|
||||
|
||||
return (char*)&anim->limbRotData[0];
|
||||
}
|
||||
|
||||
extern "C" void ResourceMgr_PushCurrentDirectory(char* path) {
|
||||
gfx_push_current_dir(path);
|
||||
}
|
||||
|
||||
extern "C" Gfx* ResourceMgr_LoadGfxByName(const char* path) {
|
||||
// When an alt resource exists for the DL, we need to unload the original asset
|
||||
// to clear the cache so the alt asset will be loaded instead
|
||||
// OTRTODO: If Alt loading over original cache is fixed, this line can most likely be removed
|
||||
ResourceMgr_UnloadOriginalWhenAltExists(path);
|
||||
|
||||
auto res = std::static_pointer_cast<LUS::DisplayList>(ResourceMgr_GetResourceByNameHandlingMQ(path));
|
||||
return (Gfx*)&res->Instructions[0];
|
||||
}
|
||||
|
||||
extern "C" uint8_t ResourceMgr_FileIsCustomByName(const char* path) {
|
||||
auto res = std::static_pointer_cast<LUS::DisplayList>(ResourceMgr_GetResourceByNameHandlingMQ(path));
|
||||
return res->GetInitData()->IsCustom;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
int index;
|
||||
Gfx instruction;
|
||||
} GfxPatch;
|
||||
|
||||
std::unordered_map<std::string, std::unordered_map<std::string, GfxPatch>> originalGfx;
|
||||
|
||||
// Attention! This is primarily for cosmetics & bug fixes. For things like mods and model replacement you should be using OTRs
|
||||
// instead (When that is available). Index can be found using the commented out section below.
|
||||
extern "C" void ResourceMgr_PatchGfxByName(const char* path, const char* patchName, int index, Gfx instruction) {
|
||||
auto res = std::static_pointer_cast<LUS::DisplayList>(
|
||||
Ship::Context::GetInstance()->GetResourceManager()->LoadResource(path));
|
||||
|
||||
// Leaving this here for people attempting to find the correct Dlist index to patch
|
||||
/*if (strcmp("__OTR__objects/object_gi_longsword/gGiBiggoronSwordDL", path) == 0) {
|
||||
for (int i = 0; i < res->instructions.size(); i++) {
|
||||
Gfx* gfx = (Gfx*)&res->instructions[i];
|
||||
// Log all commands
|
||||
// SPDLOG_INFO("index:{} command:{}", i, gfx->words.w0 >> 24);
|
||||
// Log only SetPrimColors
|
||||
if (gfx->words.w0 >> 24 == 250) {
|
||||
SPDLOG_INFO("index:{} r:{} g:{} b:{} a:{}", i, _SHIFTR(gfx->words.w1, 24, 8), _SHIFTR(gfx->words.w1, 16, 8), _SHIFTR(gfx->words.w1, 8, 8), _SHIFTR(gfx->words.w1, 0, 8));
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// Index refers to individual gfx words, which are half the size on 32-bit
|
||||
// if (sizeof(uintptr_t) < 8) {
|
||||
// index /= 2;
|
||||
// }
|
||||
|
||||
// Do not patch custom assets as they most likely do not have the same instructions as authentic assets
|
||||
if (res->GetInitData()->IsCustom) {
|
||||
return;
|
||||
}
|
||||
|
||||
Gfx* gfx = (Gfx*)&res->Instructions[index];
|
||||
|
||||
if (!originalGfx.contains(path) || !originalGfx[path].contains(patchName)) {
|
||||
originalGfx[path][patchName] = {
|
||||
index,
|
||||
*gfx
|
||||
};
|
||||
}
|
||||
|
||||
*gfx = instruction;
|
||||
}
|
||||
|
||||
extern "C" void ResourceMgr_PatchGfxCopyCommandByName(const char* path, const char* patchName, int destinationIndex, int sourceIndex) {
|
||||
auto res = std::static_pointer_cast<LUS::DisplayList>(
|
||||
Ship::Context::GetInstance()->GetResourceManager()->LoadResource(path));
|
||||
|
||||
// Do not patch custom assets as they most likely do not have the same instructions as authentic assets
|
||||
if (res->GetInitData()->IsCustom) {
|
||||
return;
|
||||
}
|
||||
|
||||
Gfx* destinationGfx = (Gfx*)&res->Instructions[destinationIndex];
|
||||
Gfx sourceGfx = *(Gfx*)&res->Instructions[sourceIndex];
|
||||
|
||||
if (!originalGfx.contains(path) || !originalGfx[path].contains(patchName)) {
|
||||
originalGfx[path][patchName] = {
|
||||
destinationIndex,
|
||||
*destinationGfx
|
||||
};
|
||||
}
|
||||
|
||||
*destinationGfx = sourceGfx;
|
||||
}
|
||||
|
||||
extern "C" void ResourceMgr_UnpatchGfxByName(const char* path, const char* patchName) {
|
||||
if (originalGfx.contains(path) && originalGfx[path].contains(patchName)) {
|
||||
auto res = std::static_pointer_cast<LUS::DisplayList>(
|
||||
Ship::Context::GetInstance()->GetResourceManager()->LoadResource(path));
|
||||
|
||||
Gfx* gfx = (Gfx*)&res->Instructions[originalGfx[path][patchName].index];
|
||||
*gfx = originalGfx[path][patchName].instruction;
|
||||
|
||||
originalGfx[path].erase(patchName);
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" char* ResourceMgr_LoadArrayByName(const char* path) {
|
||||
auto res = std::static_pointer_cast<SOH::Array>(ResourceMgr_GetResourceByNameHandlingMQ(path));
|
||||
|
||||
return (char*)res->Scalars.data();
|
||||
}
|
||||
|
||||
// Return of LoadArrayByNameAsVec3s must be freed by the caller
|
||||
extern "C" char* ResourceMgr_LoadArrayByNameAsVec3s(const char* path) {
|
||||
auto res = std::static_pointer_cast<SOH::Array>(ResourceMgr_GetResourceByNameHandlingMQ(path));
|
||||
|
||||
// if (res->CachedGameAsset != nullptr)
|
||||
// return (char*)res->CachedGameAsset;
|
||||
// else
|
||||
// {
|
||||
Vec3s* data = (Vec3s*)malloc(sizeof(Vec3s) * res->Scalars.size());
|
||||
|
||||
for (size_t i = 0; i < res->Scalars.size(); i += 3) {
|
||||
data[(i / 3)].x = res->Scalars[i + 0].s16;
|
||||
data[(i / 3)].y = res->Scalars[i + 1].s16;
|
||||
data[(i / 3)].z = res->Scalars[i + 2].s16;
|
||||
}
|
||||
|
||||
// res->CachedGameAsset = data;
|
||||
|
||||
return (char*)data;
|
||||
// }
|
||||
}
|
||||
|
||||
extern "C" CollisionHeader* ResourceMgr_LoadColByName(const char* path) {
|
||||
return (CollisionHeader*) ResourceGetDataByName(path);
|
||||
}
|
||||
|
||||
extern "C" Vtx* ResourceMgr_LoadVtxByName(char* path) {
|
||||
return (Vtx*) ResourceGetDataByName(path);
|
||||
}
|
||||
|
||||
extern "C" SequenceData ResourceMgr_LoadSeqByName(const char* path) {
|
||||
SequenceData* sequence = (SequenceData*) ResourceGetDataByName(path);
|
||||
return *sequence;
|
||||
}
|
||||
|
||||
extern "C" SoundFontSample* ResourceMgr_LoadAudioSample(const char* path) {
|
||||
return (SoundFontSample*) ResourceGetDataByName(path);
|
||||
}
|
||||
|
||||
extern "C" SoundFont* ResourceMgr_LoadAudioSoundFont(const char* path) {
|
||||
return (SoundFont*) ResourceGetDataByName(path);
|
||||
}
|
||||
|
||||
extern "C" int ResourceMgr_OTRSigCheck(char* imgData) {
|
||||
uintptr_t i = (uintptr_t)(imgData);
|
||||
|
||||
// if (i == 0xD9000000 || i == 0xE7000000 || (i & 1) == 1)
|
||||
if ((i & 1) == 1)
|
||||
return 0;
|
||||
|
||||
// if ((i & 0xFF000000) != 0xAB000000 && (i & 0xFF000000) != 0xCD000000 && i != 0) {
|
||||
if (i != 0) {
|
||||
if (
|
||||
imgData[0] == '_' &&
|
||||
imgData[1] == '_' &&
|
||||
imgData[2] == 'O' &&
|
||||
imgData[3] == 'T' &&
|
||||
imgData[4] == 'R' &&
|
||||
imgData[5] == '_' &&
|
||||
imgData[6] == '_'
|
||||
) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" AnimationHeaderCommon* ResourceMgr_LoadAnimByName(const char* path) {
|
||||
return (AnimationHeaderCommon*) ResourceGetDataByName(path);
|
||||
}
|
||||
|
||||
extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path, SkelAnime* skelAnime) {
|
||||
std::string pathStr = std::string(path);
|
||||
static const std::string sOtr = "__OTR__";
|
||||
|
||||
if (pathStr.starts_with(sOtr)) {
|
||||
pathStr = pathStr.substr(sOtr.length());
|
||||
}
|
||||
|
||||
bool isAlt = ResourceMgr_IsAltAssetsEnabled();
|
||||
|
||||
if (isAlt) {
|
||||
pathStr = Ship::IResource::gAltAssetPrefix + pathStr;
|
||||
}
|
||||
|
||||
SkeletonHeader* skelHeader = (SkeletonHeader*) ResourceGetDataByName(pathStr.c_str());
|
||||
|
||||
// If there isn't an alternate model, load the regular one
|
||||
if (isAlt && skelHeader == NULL) {
|
||||
skelHeader = (SkeletonHeader*) ResourceGetDataByName(path);
|
||||
}
|
||||
|
||||
// This function is only called when a skeleton is initialized.
|
||||
// Therefore we can take this oppurtunity to take note of the Skeleton that is created...
|
||||
if (skelAnime != nullptr) {
|
||||
auto stringPath = std::string(path);
|
||||
SOH::SkeletonPatcher::RegisterSkeleton(stringPath, skelAnime);
|
||||
}
|
||||
|
||||
return skelHeader;
|
||||
}
|
||||
|
||||
extern "C" void ResourceMgr_UnregisterSkeleton(SkelAnime* skelAnime) {
|
||||
if (skelAnime != nullptr) {
|
||||
SOH::SkeletonPatcher::UnregisterSkeleton(skelAnime);
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void ResourceMgr_ClearSkeletons() {
|
||||
SOH::SkeletonPatcher::ClearSkeletons();
|
||||
}
|
||||
|
||||
extern "C" s32* ResourceMgr_LoadCSByName(const char* path) {
|
||||
return (s32*)ResourceMgr_GetResourceDataByNameHandlingMQ(path);
|
||||
}
|
66
soh/soh/ResourceManagerHelpers.h
Normal file
66
soh/soh/ResourceManagerHelpers.h
Normal file
@ -0,0 +1,66 @@
|
||||
#pragma once
|
||||
|
||||
#include "libultraship/libultra/types.h"
|
||||
|
||||
#define GAME_REGION_NTSC 0
|
||||
#define GAME_REGION_PAL 1
|
||||
|
||||
#define GAME_PLATFORM_N64 0
|
||||
#define GAME_PLATFORM_GC 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <memory>
|
||||
#include <Resource.h>
|
||||
|
||||
std::shared_ptr<Ship::IResource> ResourceMgr_GetResourceByNameHandlingMQ(const char* path);
|
||||
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
#include "z64animation.h"
|
||||
#include "z64audio.h"
|
||||
#include "z64bgcheck.h"
|
||||
uint32_t ResourceMgr_IsGameMasterQuest();
|
||||
uint32_t ResourceMgr_IsSceneMasterQuest(s16 sceneNum);
|
||||
uint32_t ResourceMgr_GameHasMasterQuest();
|
||||
uint32_t ResourceMgr_GameHasOriginal();
|
||||
uint32_t ResourceMgr_GetNumGameVersions();
|
||||
uint32_t ResourceMgr_GetGameVersion(int index);
|
||||
uint32_t ResourceMgr_GetGamePlatform(int index);
|
||||
uint32_t ResourceMgr_GetGameRegion(int index);
|
||||
void ResourceMgr_LoadDirectory(const char* resName);
|
||||
void ResourceMgr_UnloadResource(const char* resName);
|
||||
char** ResourceMgr_ListFiles(const char* searchMask, int* resultSize);
|
||||
uint8_t ResourceMgr_FileExists(const char* resName);
|
||||
uint8_t ResourceMgr_FileAltExists(const char* resName);
|
||||
void ResourceMgr_UnloadOriginalWhenAltExists(const char* resName);
|
||||
uint8_t ResourceMgr_TexIsRaw(const char* texPath);
|
||||
uint8_t ResourceMgr_ResourceIsBackground(char* texPath);
|
||||
char* ResourceMgr_LoadJPEG(char* data, size_t dataSize);
|
||||
uint16_t ResourceMgr_LoadTexWidthByName(char* texPath);
|
||||
uint16_t ResourceMgr_LoadTexHeightByName(char* texPath);
|
||||
char* ResourceMgr_LoadTexOrDListByName(const char* filePath);
|
||||
char* ResourceMgr_LoadPlayerAnimByName(const char* animPath);
|
||||
AnimationHeaderCommon* ResourceMgr_LoadAnimByName(const char* path);
|
||||
char* ResourceMgr_GetNameByCRC(uint64_t crc, char* alloc);
|
||||
Gfx* ResourceMgr_LoadGfxByCRC(uint64_t crc);
|
||||
Gfx* ResourceMgr_LoadGfxByName(const char* path);
|
||||
uint8_t ResourceMgr_FileIsCustomByName(const char* path);
|
||||
void ResourceMgr_PatchGfxByName(const char* path, const char* patchName, int index, Gfx instruction);
|
||||
void ResourceMgr_UnpatchGfxByName(const char* path, const char* patchName);
|
||||
char* ResourceMgr_LoadArrayByNameAsVec3s(const char* path);
|
||||
Vtx* ResourceMgr_LoadVtxByCRC(uint64_t crc);
|
||||
Vtx* ResourceMgr_LoadVtxByName(char* path);
|
||||
SoundFont* ResourceMgr_LoadAudioSoundFont(const char* path);
|
||||
SequenceData ResourceMgr_LoadSeqByName(const char* path);
|
||||
SoundFontSample* ResourceMgr_LoadAudioSample(const char* path);
|
||||
CollisionHeader* ResourceMgr_LoadColByName(const char* path);
|
||||
bool ResourceMgr_IsAltAssetsEnabled();
|
||||
SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path, SkelAnime* skelAnime);
|
||||
void ResourceMgr_UnregisterSkeleton(SkelAnime* skelAnime);
|
||||
void ResourceMgr_ClearSkeletons();
|
||||
s32* ResourceMgr_LoadCSByName(const char* path);
|
||||
int ResourceMgr_OTRSigCheck(char* imgData);
|
||||
char* ResourceMgr_GetResourceDataByNameHandlingMQ(const char* path);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
@ -10,6 +10,7 @@
|
||||
#include "Enhancements/randomizer/item.h"
|
||||
|
||||
#include "z64.h"
|
||||
#include "cvar_prefixes.h"
|
||||
#include "functions.h"
|
||||
#include "macros.h"
|
||||
#include <variables.h>
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <libultraship/libultra/gbi.h>
|
||||
#include "z64save.h"
|
||||
|
||||
#define SECTION_PARENT_NONE -1
|
||||
typedef struct {
|
||||
@ -45,8 +46,6 @@ typedef struct {
|
||||
#define BS_THREAD_POOL_ENABLE_PAUSE
|
||||
#include <BS_thread_pool.hpp>
|
||||
|
||||
#include "z64save.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
class SaveManager {
|
||||
|
@ -10,7 +10,9 @@
|
||||
#include "include/z64audio.h"
|
||||
#include "graphic/Fast3D/gfx_rendering_api.h"
|
||||
#include "OTRGlobals.h"
|
||||
#include "SaveManager.h"
|
||||
#include "z64.h"
|
||||
#include "cvar_prefixes.h"
|
||||
#include "macros.h"
|
||||
#include "Enhancements/game-interactor/GameInteractor.h"
|
||||
#include "soh/Enhancements/presets.h"
|
||||
|
17
soh/soh/cvar_prefixes.h
Normal file
17
soh/soh/cvar_prefixes.h
Normal file
@ -0,0 +1,17 @@
|
||||
#define CVAR_RANDOMIZER_ENHANCEMENT(var) CVAR_PREFIX_RANDOMIZER_ENHANCEMENT "." var
|
||||
#define CVAR_RANDOMIZER_SETTING(var) CVAR_PREFIX_RANDOMIZER_SETTING "." var
|
||||
#define CVAR_COSMETIC(var) CVAR_PREFIX_COSMETIC "." var
|
||||
#define CVAR_AUDIO(var) CVAR_PREFIX_AUDIO "." var
|
||||
#define CVAR_CHEAT(var) CVAR_PREFIX_CHEAT "." var
|
||||
#define CVAR_ENHANCEMENT(var) CVAR_PREFIX_ENHANCEMENT "." var
|
||||
#define CVAR_SETTING(var) CVAR_PREFIX_SETTING "." var
|
||||
#define CVAR_WINDOW(var) CVAR_PREFIX_WINDOW "." var
|
||||
#define CVAR_TRACKER(var) CVAR_PREFIX_TRACKER "." var
|
||||
#define CVAR_TRACKER_ITEM(var) CVAR_TRACKER(".ItemTracker." var)
|
||||
#define CVAR_TRACKER_CHECK(var) CVAR_TRACKER(".CheckTracker." var)
|
||||
#define CVAR_TRACKER_ENTRANCE(var) CVAR_TRACKER(".EntranceTracker." var)
|
||||
#define CVAR_DEVELOPER_TOOLS(var) CVAR_PREFIX_DEVELOPER_TOOLS "." var
|
||||
#define CVAR_GENERAL(var) CVAR_PREFIX_GENERAL "." var
|
||||
#define CVAR_REMOTE(var) CVAR_PREFIX_REMOTE "." var
|
||||
#define CVAR_REMOTE_CROWD_CONTROL(var) CVAR_REMOTE(".CrowdControl." var)
|
||||
#define CVAR_REMOTE_SAIL(var) CVAR_REMOTE(".Sail." var)
|
@ -1,5 +1,6 @@
|
||||
#include "Resource.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
|
||||
namespace SOH {
|
||||
void LogPathAsXML(std::shared_ptr<Ship::IResource> resource);
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "Resource.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
|
||||
namespace SOH {
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "OTRGlobals.h"
|
||||
#include "ResourceManagerHelpers.h"
|
||||
#include <libultraship/libultraship.h>
|
||||
#include "soh/resource/type/Scene.h"
|
||||
#include <utils/StringHelper.h>
|
||||
@ -35,7 +36,7 @@ extern "C" void OTRPlay_SpawnScene(PlayState* play, s32 sceneId, s32 spawn) {
|
||||
|
||||
std::string sceneVersion = "shared";
|
||||
if (inNonSharedScene) {
|
||||
sceneVersion = IsGameMasterQuest() ? "mq" : "nonmq";
|
||||
sceneVersion = ResourceMgr_IsGameMasterQuest() ? "mq" : "nonmq";
|
||||
}
|
||||
std::string scenePath = StringHelper::Sprintf("scenes/%s/%s/%s", sceneVersion.c_str(), scene->sceneFile.fileName, scene->sceneFile.fileName);
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "OTRGlobals.h"
|
||||
#include "ResourceManagerHelpers.h"
|
||||
#include <libultraship/libultraship.h>
|
||||
#include "soh/resource/type/Scene.h"
|
||||
#include <utils/StringHelper.h>
|
||||
@ -39,9 +40,6 @@ extern "C" s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId);
|
||||
extern "C" RomFile sNaviMsgFiles[];
|
||||
s32 OTRScene_ExecuteCommands(PlayState* play, SOH::Scene* scene);
|
||||
|
||||
// Forward Declaration of function declared in OTRGlobals.cpp
|
||||
std::shared_ptr<Ship::IResource> GetResourceByNameHandlingMQ(const char* path);
|
||||
|
||||
bool Scene_CommandSpawnList(PlayState* play, SOH::ISceneCommand* cmd) {
|
||||
// SOH::SetStartPositionList* cmdStartPos = std::static_pointer_cast<SOH::SetStartPositionList>(cmd);
|
||||
SOH::SetStartPositionList* cmdStartPos = (SOH::SetStartPositionList*)cmd;
|
||||
@ -512,7 +510,7 @@ extern "C" s32 OTRfunc_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomN
|
||||
//&roomCtx->loadQueue, NULL, __FILE__, __LINE__);
|
||||
|
||||
auto roomData =
|
||||
std::static_pointer_cast<SOH::Scene>(GetResourceByNameHandlingMQ(play->roomList[roomNum].fileName));
|
||||
std::static_pointer_cast<SOH::Scene>(ResourceMgr_GetResourceByNameHandlingMQ(play->roomList[roomNum].fileName));
|
||||
roomCtx->status = 1;
|
||||
roomCtx->roomToLoad = roomData.get();
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/Enhancements/audio/AudioCollection.h"
|
||||
#include "soh/Enhancements/audio/AudioEditor.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
|
||||
#define MK_ASYNC_MSG(retData, tableType, id, status) (((retData) << 24) | ((tableType) << 16) | ((id) << 8) | (status))
|
||||
#define ASYNC_TBLTYPE(v) ((u8)(v >> 16))
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
#include <libultraship/bridge.h>
|
||||
|
||||
extern bool gUseLegacySD;
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "soh/Enhancements/audio/AudioEditor.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
|
||||
extern char** sequenceMap;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <libultraship/libultra.h>
|
||||
#include "global.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/Enhancements/audio/AudioEditor.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "libultraship/bridge.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
|
||||
SpeedMeter D_801664D0;
|
||||
VisCvg sVisCvg;
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "global.h"
|
||||
#include "align_asset_macro.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
|
||||
u16 sGfxPrintFontTLUT[64] = {
|
||||
0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000,
|
||||
|
@ -3,6 +3,8 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
|
||||
s32 D_8012D280 = 1;
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "soh/Enhancements/nametag.h"
|
||||
|
||||
#include "soh/ActorDB.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -1,7 +1,8 @@
|
||||
#include "global.h"
|
||||
#include "vt.h"
|
||||
|
||||
#include <soh/OTRGlobals.h>
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
#include <assert.h>
|
||||
|
||||
#define SS_NULL 0xFFFF
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
|
||||
void Gfx_DrawDListOpa(PlayState* play, Gfx* dlist) {
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
@ -32,6 +32,8 @@
|
||||
#include "scenes/misc/hakaana_ouke/hakaana_ouke_scene.h"
|
||||
|
||||
#include "soh/Enhancements/randomizer/randomizer_entrance.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
|
||||
u16 D_8011E1C0 = 0;
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "global.h"
|
||||
#include "z64elf_message.h"
|
||||
#include <assert.h>
|
||||
#include "soh/OTRGlobals.h"
|
||||
|
||||
ElfMessage sChildSariaMsgs[] = {
|
||||
ELF_MSG_STRENGTH_UPG(SKIP, 3, false, 0),
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.h"
|
||||
#include "textures/icon_item_static/icon_item_static.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
|
||||
#define FLAGS 0
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "global.h"
|
||||
#include <string.h>
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
|
||||
// unused
|
||||
Gfx sCircleNullDList[] = {
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "global.h"
|
||||
#include <assert.h>
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
|
||||
void SkelCurve_Clear(SkelAnimeCurve* skelCurve) {
|
||||
skelCurve->limbCount = 0;
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
|
||||
void GameOver_Init(PlayState* play) {
|
||||
play->gameOverCtx.state = GAMEOVER_INACTIVE;
|
||||
|
@ -4,6 +4,8 @@
|
||||
#include "objects/gameplay_keep/gameplay_keep.h"
|
||||
#include "objects/gameplay_field_keep/gameplay_field_keep.h"
|
||||
#include "soh/frame_interpolation.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ LENS_FLARE_CIRCLE0,
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "global.h"
|
||||
#include "textures/parameter_static/parameter_static.h"
|
||||
#include "soh/frame_interpolation.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
|
||||
s16 Top_LM_Margin = 0;
|
||||
s16 Left_LM_Margin = 0;
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "objects/gameplay_keep/gameplay_keep.h"
|
||||
|
||||
#include "soh/frame_interpolation.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
|
||||
#define LIGHTS_BUFFER_SIZE 32
|
||||
//#define LIGHTS_BUFFER_SIZE 1024 // Kill me
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "textures/map_i_static/map_i_static.h"
|
||||
#include "textures/map_grand_static/map_grand_static.h"
|
||||
#include <assert.h>
|
||||
#include "soh/OTRGlobals.h"
|
||||
|
||||
MapData* gMapData;
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "global.h"
|
||||
#include "vt.h"
|
||||
#include "textures/parameter_static/parameter_static.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ void* texture;
|
||||
|
@ -21,6 +21,9 @@
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
#include "soh/Enhancements/randomizer/randomizer_grotto.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
#include "soh/Enhancements/gameplaystats.h"
|
||||
|
||||
#define DO_ACTION_TEX_WIDTH() 48
|
||||
#define DO_ACTION_TEX_HEIGHT() 16
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include <overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h>
|
||||
#include "soh/Enhancements/enhancementTypes.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/SaveManager.h"
|
||||
#include "soh/framebuffer_effects.h"
|
||||
|
||||
#include <libultraship/libultraship.h>
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||
#include "soh/Enhancements/randomizer/draw.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "global.h"
|
||||
#include <assert.h>
|
||||
#include "soh/OTRGlobals.h"
|
||||
|
||||
Gfx sSetupDL[SETUPDL_MAX][6] = {
|
||||
{
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include "public/bridge/gfxbridge.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
|
||||
void func_80095AB4(PlayState* play, Room* room, u32 flags);
|
||||
void func_80095D04(PlayState* play, Room* room, u32 flags);
|
||||
|
@ -25,6 +25,8 @@
|
||||
|
||||
#include "soh/mq_asset_hacks.h"
|
||||
#include "soh/Enhancements/randomizer/adult_trade_shuffle.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
|
||||
// Entrance Table definition
|
||||
#define DEFINE_ENTRANCE(_0, sceneId, spawn, continueBgm, displayTitleCard, endTransType, startTransType) \
|
||||
|
@ -3,6 +3,8 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
|
||||
#define ANIM_INTERP 1
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "global.h"
|
||||
#include "overlays/actors/ovl_En_fHG/z_en_fhg.h"
|
||||
#include <assert.h>
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
|
||||
/**
|
||||
* Initialises the Vtx buffers used for limb at index `limbIndex`
|
||||
|
@ -5,6 +5,8 @@
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
#include "soh/Enhancements/randomizer/savefile.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/SaveManager.h"
|
||||
|
||||
#define NUM_DUNGEONS 8
|
||||
#define NUM_COWS 10
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <libultraship/libultra.h>
|
||||
#include "global.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "scenes/dungeons/ddan/ddan_scene.h"
|
||||
#include "objects/object_bwall/object_bwall.h"
|
||||
#include "objects/object_kingdodongo/object_kingdodongo.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include "scenes/indoors/yousei_izumi_yoko/yousei_izumi_yoko_scene.h"
|
||||
#include "scenes/indoors/daiyousei_izumi/daiyousei_izumi_scene.h"
|
||||
#include "soh/frame_interpolation.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_UPDATE_WHILE_CULLED | ACTOR_FLAG_DRAW_WHILE_CULLED | ACTOR_FLAG_NO_FREEZE_OCARINA)
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "z_bg_gate_shutter.h"
|
||||
#include "objects/object_spot01_matoyab/object_spot01_matoyab.h"
|
||||
#include "vt.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
|
||||
#define FLAGS 0
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "z_bg_gjyo_bridge.h"
|
||||
#include "objects/object_gjyo_objects/object_gjyo_objects.h"
|
||||
#include "scenes/dungeons/ganon_tou/ganon_tou_scene.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
|
||||
#define FLAGS 0
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "z_bg_ice_shelter.h"
|
||||
#include "objects/object_ice_objects/object_ice_objects.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
|
||||
#define FLAGS 0
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "z_bg_jya_lift.h"
|
||||
#include "objects/object_jya_obj/object_jya_obj.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
|
||||
#define FLAGS ACTOR_FLAG_UPDATE_WHILE_CULLED
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "z_bg_spot01_idosoko.h"
|
||||
#include "objects/object_spot01_matoya/object_spot01_matoya.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
|
||||
#define FLAGS ACTOR_FLAG_UPDATE_WHILE_CULLED
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "z_bg_spot03_taki.h"
|
||||
#include "objects/object_spot03_object/object_spot03_object.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_UPDATE_WHILE_CULLED | ACTOR_FLAG_DRAW_WHILE_CULLED)
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "z_bg_spot12_saku.h"
|
||||
#include "objects/object_spot12_obj/object_spot12_obj.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
|
||||
#define FLAGS 0
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "z_bg_sst_floor.h"
|
||||
#include "objects/object_sst/object_sst.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_UPDATE_WHILE_CULLED | ACTOR_FLAG_DRAW_WHILE_CULLED)
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "z_bg_toki_swd.h"
|
||||
#include "objects/object_toki_objects/object_toki_objects.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
|
||||
#define FLAGS ACTOR_FLAG_UPDATE_WHILE_CULLED
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "z_bg_treemouth.h"
|
||||
#include "objects/object_spot04_objects/object_spot04_objects.h"
|
||||
#include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_UPDATE_WHILE_CULLED | ACTOR_FLAG_DRAW_WHILE_CULLED)
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "z_bg_ydan_sp.h"
|
||||
#include "objects/object_ydan_objects/object_ydan_objects.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
|
||||
#define FLAGS 0
|
||||
|
||||
|
@ -5,6 +5,8 @@
|
||||
#include "scenes/dungeons/ddan_boss/ddan_boss_room_1.h"
|
||||
#include "soh/frame_interpolation.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
|
||||
#include <stdlib.h> // malloc
|
||||
#include <string.h> // memcpy
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "assets/scenes/dungeons/ganon_boss/ganon_boss_scene.h"
|
||||
|
||||
#include "soh/frame_interpolation.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
|
||||
#include <string.h>
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include "objects/object_ganon_anime3/object_ganon_anime3.h"
|
||||
#include "objects/object_geff/object_geff.h"
|
||||
#include "soh/frame_interpolation.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
|
||||
#include <string.h>
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h"
|
||||
#include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h"
|
||||
#include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_WHILE_CULLED | ACTOR_FLAG_DRAW_WHILE_CULLED)
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "overlays/actors/ovl_En_Goma/z_en_goma.h"
|
||||
#include "overlays/actors/ovl_Door_Shutter/z_door_shutter.h"
|
||||
#include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.h"
|
||||
#include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h"
|
||||
#include "soh/frame_interpolation.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "objects/gameplay_keep/gameplay_keep.h"
|
||||
#include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h"
|
||||
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/frame_interpolation.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "overlays/actors/ovl_Eff_Dust/z_eff_dust.h"
|
||||
#include "soh/frame_interpolation.h"
|
||||
#include <assert.h>
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
|
||||
#define FLAGS ACTOR_FLAG_UPDATE_WHILE_CULLED
|
||||
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include "objects/object_efc_tw/object_efc_tw.h"
|
||||
#include "objects/object_gi_jewel/object_gi_jewel.h"
|
||||
#include <assert.h>
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_UPDATE_WHILE_CULLED | ACTOR_FLAG_DRAW_WHILE_CULLED)
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "z_demo_ik.h"
|
||||
#include "vt.h"
|
||||
#include "objects/object_ik/object_ik.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
|
||||
#define FLAGS ACTOR_FLAG_UPDATE_WHILE_CULLED
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user