Merge branch 'HarbourMasters:develop' into sectional-saves

This commit is contained in:
Malkierian 2023-05-11 09:56:08 -07:00 committed by GitHub
commit 2a8810d6a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
335 changed files with 6293 additions and 8936 deletions

View file

@ -39,7 +39,7 @@
#define SYSTEM_HEAP_SIZE (1024 * 1024 * 4)
#ifdef __cplusplus
namespace Ship
namespace LUS
{
class Resource;
class Scene;

View file

@ -229,7 +229,7 @@ void AudioCollection::RemoveFromShufflePool(SequenceInfo* seqInfo) {
excludedSequences.insert(seqInfo);
includedSequences.erase(seqInfo);
CVarSetInteger(cvarKey.c_str(), 1);
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
void AudioCollection::AddToShufflePool(SequenceInfo* seqInfo) {
@ -237,7 +237,7 @@ void AudioCollection::AddToShufflePool(SequenceInfo* seqInfo) {
includedSequences.insert(seqInfo);
excludedSequences.erase(seqInfo);
CVarClear(cvarKey.c_str());
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
void AudioCollection::InitializeShufflePool() {

View file

@ -158,7 +158,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) {
const std::string randomizeAllButton = "Randomize All" + hiddenTabId;
if (ImGui::Button(resetAllButton.c_str())) {
ResetGroup(map, type);
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
if (type == SEQ_BGM_WORLD) {
ReplayCurrentBGM();
}
@ -166,7 +166,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) {
ImGui::SameLine();
if (ImGui::Button(randomizeAllButton.c_str())) {
RandomizeGroup(type);
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
if (type == SEQ_BGM_WORLD) {
ReplayCurrentBGM();
}
@ -205,7 +205,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) {
if (ImGui::Selectable(seqData.label.c_str())) {
CVarSetInteger(cvarKey.c_str(), value);
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
UpdateCurrentBGM(defaultValue, type);
}
}
@ -219,7 +219,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) {
ImGui::PushItemWidth(-FLT_MIN);
if (ImGui::Button(resetButton.c_str())) {
CVarSetInteger(cvarKey.c_str(), defaultValue);
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
UpdateCurrentBGM(defaultValue, seqData.category);
}
ImGui::SameLine();
@ -236,7 +236,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) {
auto it = validSequences.begin();
const auto& seqData = *std::next(it, rand() % validSequences.size());
CVarSetInteger(cvarKey.c_str(), seqData->sequenceId);
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
UpdateCurrentBGM(seqData->sequenceId, type);
}
}
@ -308,7 +308,10 @@ void DrawTypeChip(SeqType type) {
void DrawSfxEditor(bool& open) {
if (!open) {
CVarSetInteger("gAudioEditor.WindowOpen", 0);
if (CVarGetInteger("gAudioEditor.WindowOpen", 0)) {
CVarClear("gAudioEditor.WindowOpen");
LUS::RequestCvarSaveOnNextTick();
}
return;
}
@ -378,7 +381,7 @@ void DrawSfxEditor(bool& open) {
const std::string resetButton = "Reset##linkVoiceFreqMultiplier";
if (ImGui::Button(resetButton.c_str())) {
CVarSetFloat("gLinkVoiceFreqMultiplier", 1.0f);
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
ImGui::NewLine();
@ -552,7 +555,7 @@ void DrawSfxEditor(bool& open) {
void InitAudioEditor() {
//Draw the bar in the menu.
Ship::AddWindow("Enhancements", "Audio Editor", DrawSfxEditor);
LUS::AddWindow("Enhancements", "Audio Editor", DrawSfxEditor, CVarGetInteger("gAudioEditor.WindowOpen", 0));
}
std::vector<SeqType> allTypes = { SEQ_BGM_WORLD, SEQ_BGM_EVENT, SEQ_BGM_BATTLE, SEQ_OCARINA, SEQ_FANFARE, SEQ_INSTRUMENT, SEQ_SFX };
@ -562,7 +565,7 @@ void AudioEditor_RandomizeAll() {
RandomizeGroup(type);
}
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
ReplayCurrentBGM();
}
@ -571,6 +574,6 @@ void AudioEditor_ResetAll() {
ResetGroup(AudioCollection::Instance->GetAllSequences(), type);
}
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
ReplayCurrentBGM();
}

View file

@ -20,13 +20,10 @@ static BootCommand sCommands[] = { { "--skiplogo", BootCommands_Command_SkipLogo
void BootCommands_Init()
{
CVarRegisterInteger("gDebugEnabled", 0);
CVarRegisterInteger("gLanguages", LANGUAGE_ENG);
CVarRegisterInteger("gDebugWarpScreenTranslation", 1);
CVarRegisterInteger("gInvertYAxis", 1);
// Clears vars to prevent randomizer menu from being disabled
CVarSetInteger("gRandoGenerating", 0); // Clear when a crash happened during rando seed generation
CVarSetInteger("gOnFileSelectNameEntry", 0); // Clear when soh is killed on the file name entry page
CVarClear("gRandoGenerating"); // Clear when a crash happened during rando seed generation
CVarClear("gNewSeedGenerated");
CVarClear("gOnFileSelectNameEntry"); // Clear when soh is killed on the file name entry page
#if defined(__SWITCH__) || defined(__WIIU__)
CVarRegisterInteger("gControlNav", 1); // always enable controller nav on switch/wii u
#endif

View file

@ -88,7 +88,7 @@ namespace GameControlEditor {
void DrawUI(bool&);
void Init() {
Ship::AddWindow("Enhancements", "Game Control Editor", DrawUI);
LUS::AddWindow("Enhancements", "Game Control Editor", DrawUI, CVarGetInteger("gGameControlEditorEnabled", 0));
addButtonName(BTN_A, "A");
addButtonName(BTN_B, "B");
@ -136,7 +136,7 @@ namespace GameControlEditor {
}
if (ImGui::Selectable(i->second, i->first == currentButton)) {
CVarSetInteger(mapping.cVarName, i->first);
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
}
ImGui::EndCombo();
@ -172,7 +172,7 @@ namespace GameControlEditor {
ImGui::TableSetupColumn("Modifiers##CustomOcaranaModifiers", PANEL_TABLE_COLUMN_FLAGS);
TableHelper::InitHeader(false);
Ship::BeginGroupPanel("Notes", ImGui::GetContentRegionAvail());
LUS::BeginGroupPanel("Notes", ImGui::GetContentRegionAvail());
labelWidth = ImGui::CalcTextSize("D5").x + 10;
DrawMapping(ocarinaD5, labelWidth, disableMask);
DrawMapping(ocarinaB4, labelWidth, disableMask);
@ -181,16 +181,16 @@ namespace GameControlEditor {
DrawMapping(ocarinaD4, labelWidth, disableMask);
ImGui::Dummy(ImVec2(0, 5));
float cursorY = ImGui::GetCursorPosY();
Ship::EndGroupPanel();
LUS::EndGroupPanel();
TableHelper::NextCol();
Ship::BeginGroupPanel("Modifiers", ImGui::GetContentRegionAvail());
LUS::BeginGroupPanel("Modifiers", ImGui::GetContentRegionAvail());
labelWidth = ImGui::CalcTextSize(ocarinaSongDisable.label).x + 10;
DrawMapping(ocarinaSongDisable, labelWidth, disableMask);
DrawMapping(ocarinaSharp, labelWidth, disableMask);
DrawMapping(ocarinaFlat, labelWidth, disableMask);
Ship::EndGroupPanel(cursorY - ImGui::GetCursorPosY() + 2);
LUS::EndGroupPanel(cursorY - ImGui::GetCursorPosY() + 2);
ImGui::EndTable();
}
@ -201,7 +201,7 @@ namespace GameControlEditor {
UIWidgets::Spacer(0);
}
Ship::BeginGroupPanel("Alternate controls", ImGui::GetContentRegionAvail());
LUS::BeginGroupPanel("Alternate controls", ImGui::GetContentRegionAvail());
if (ImGui::BeginTable("tableOcarinaAlternateControls", 2, ImGuiTableFlags_SizingFixedSame)) {
ImGui::TableSetupColumn("D-pad", PANEL_TABLE_COLUMN_FLAGS);
ImGui::TableSetupColumn("Right stick", PANEL_TABLE_COLUMN_FLAGS);
@ -213,7 +213,7 @@ namespace GameControlEditor {
UIWidgets::Spacer(0);
ImGui::EndTable();
}
Ship::EndGroupPanel();
LUS::EndGroupPanel();
ImGui::EndTable();
}
@ -221,10 +221,10 @@ namespace GameControlEditor {
// CurrentPort is indexed started at 1 here due to the Generic tab, instead of 0 like in InputEditor
// Therefore CurrentPort - 1 must always be used inside this function instead of CurrentPort
void DrawCustomButtons() {
Ship::GetInputEditor()->DrawControllerSelect(CurrentPort - 1);
LUS::GetInputEditor()->DrawControllerSelect(CurrentPort - 1);
Ship::GetInputEditor()->DrawButton("Modifier 1", BTN_MODIFIER1, CurrentPort - 1, &BtnReading);
Ship::GetInputEditor()->DrawButton("Modifier 2", BTN_MODIFIER2, CurrentPort - 1, &BtnReading);
LUS::GetInputEditor()->DrawButton("Modifier 1", BTN_MODIFIER1, CurrentPort - 1, &BtnReading);
LUS::GetInputEditor()->DrawButton("Modifier 2", BTN_MODIFIER2, CurrentPort - 1, &BtnReading);
}
void DrawCameraControlPanel() {
@ -233,7 +233,7 @@ namespace GameControlEditor {
}
UIWidgets::Spacer(0);
Ship::BeginGroupPanel("Aiming/First-Person Camera", ImGui::GetContentRegionAvail());
LUS::BeginGroupPanel("Aiming/First-Person Camera", ImGui::GetContentRegionAvail());
UIWidgets::PaddedEnhancementCheckbox("Right Stick Aiming", "gRightStickAiming");
DrawHelpIcon("Allows for aiming with the right stick in:\n-First-Person/C-Up view\n-Weapon Aiming");
UIWidgets::PaddedEnhancementCheckbox("Invert Aiming X Axis", "gInvertAimingXAxis");
@ -242,27 +242,29 @@ namespace GameControlEditor {
DrawHelpIcon("Inverts the Camera Y Axis in:\n-First-Person/C-Up view\n-Weapon Aiming");
UIWidgets::PaddedEnhancementCheckbox("Disable Auto-Centering in First-Person View", "gDisableAutoCenterViewFirstPerson");
DrawHelpIcon("Prevents the C-Up view from auto-centering, allowing for Gyro Aiming");
UIWidgets::PaddedEnhancementCheckbox("Enable Custom Aiming/First-Person sensitivity", "gEnableFirstPersonSensitivity", true, false);
if (UIWidgets::PaddedEnhancementCheckbox("Enable Custom Aiming/First-Person sensitivity", "gEnableFirstPersonSensitivity", true, false)) {
if (!CVarGetInteger("gEnableFirstPersonSensitivity", 0)) {
CVarClear("gFirstPersonCameraSensitivity");
}
}
if (CVarGetInteger("gEnableFirstPersonSensitivity", 0)) {
UIWidgets::EnhancementSliderFloat("Aiming/First-Person Horizontal Sensitivity: %d %%", "##FirstPersonSensitivity Horizontal",
"gFirstPersonCameraSensitivityX", 0.01f, 5.0f, "", 1.0f, true);
UIWidgets::EnhancementSliderFloat("Aiming/First-Person Vertical Sensitivity: %d %%", "##FirstPersonSensitivity Vertical",
"gFirstPersonCameraSensitivityY", 0.01f, 5.0f, "", 1.0f, true);
} else {
CVarSetFloat("gFirstPersonCameraSensitivity", 1.0f);
}
UIWidgets::Spacer(0);
Ship::EndGroupPanel();
LUS::EndGroupPanel();
UIWidgets::Spacer(0);
Ship::BeginGroupPanel("Third-Person Camera", ImGui::GetContentRegionAvail());
LUS::BeginGroupPanel("Third-Person Camera", ImGui::GetContentRegionAvail());
UIWidgets::PaddedEnhancementCheckbox("Free Camera", "gFreeCamera");
DrawHelpIcon("Enables free camera control\nNote: You must remap C buttons off of the right stick in the "
"controller config menu, and map the camera stick to the right stick.");
UIWidgets::PaddedEnhancementCheckbox("Invert Camera X Axis", "gInvertXAxis");
DrawHelpIcon("Inverts the Camera X Axis in:\n-Free camera");
UIWidgets::PaddedEnhancementCheckbox("Invert Camera Y Axis", "gInvertYAxis");
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",
@ -273,7 +275,7 @@ namespace GameControlEditor {
"gFreeCameraDistMax", 100, 900, "", 185, true, false, true);
UIWidgets::PaddedEnhancementSliderInt("Camera Transition Speed: %d", "##CamTranSpeed",
"gFreeCameraTransitionSpeed", 0, 900, "", 25, true, false, true);
Ship::EndGroupPanel();
LUS::EndGroupPanel();
}
void DrawDpadControlPanel() {
@ -283,7 +285,7 @@ namespace GameControlEditor {
ImVec2 cursor = ImGui::GetCursorPos();
ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5));
Ship::BeginGroupPanel("D-Pad Options", ImGui::GetContentRegionAvail());
LUS::BeginGroupPanel("D-Pad Options", ImGui::GetContentRegionAvail());
UIWidgets::PaddedEnhancementCheckbox("D-pad Support on Pause Screen", "gDpadPause");
DrawHelpIcon("Navigate Pause with the D-pad\nIf used with D-pad as Equip Items, you must hold C-Up to equip instead of navigate\n"
"To make the cursor only move a single space no matter how long a direction is held, manually set gDpadHoldChange to 0");
@ -292,7 +294,7 @@ namespace GameControlEditor {
"To make the cursor only move a single space during name entry no matter how long a direction is held, manually set gDpadHoldChange to 0");
UIWidgets::PaddedEnhancementCheckbox("D-pad as Equip Items", "gDpadEquips");
DrawHelpIcon("Equip items and equipment on the D-pad\nIf used with D-pad on Pause Screen, you must hold C-Up to equip instead of navigate");
Ship::EndGroupPanel();
LUS::EndGroupPanel();
}
void DrawMiscControlPanel() {
@ -302,7 +304,7 @@ namespace GameControlEditor {
ImVec2 cursor = ImGui::GetCursorPos();
ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5));
Ship::BeginGroupPanel("Misc Controls", ImGui::GetContentRegionAvail());
LUS::BeginGroupPanel("Misc Controls", ImGui::GetContentRegionAvail());
UIWidgets::PaddedText("Allow the cursor to be on any slot");
static const char* cursorOnAnySlot[3] = { "Only in Rando", "Always", "Never" };
UIWidgets::EnhancementCombobox("gPauseAnyCursor", cursorOnAnySlot, PAUSE_ANY_CURSOR_RANDO_ONLY);
@ -313,22 +315,25 @@ namespace GameControlEditor {
DrawHelpIcon("Hold the assigned button to change the maximum walking speed\nTo change the assigned button, go into the Ports tabs above");
if (CVarGetInteger("gEnableWalkModify", 0)) {
UIWidgets::Spacer(5);
Ship::BeginGroupPanel("Walk Modifier", ImGui::GetContentRegionAvail());
LUS::BeginGroupPanel("Walk Modifier", ImGui::GetContentRegionAvail());
UIWidgets::PaddedEnhancementCheckbox("Toggle modifier instead of holding", "gWalkSpeedToggle", true, false);
UIWidgets::PaddedEnhancementSliderFloat("Modifier 1: %d %%", "##WalkMod1", "gWalkModifierOne", 0.0f, 5.0f, "", 1.0f, true, true, false, true);
UIWidgets::PaddedEnhancementSliderFloat("Modifier 2: %d %%", "##WalkMod2", "gWalkModifierTwo", 0.0f, 5.0f, "", 1.0f, true, true, false, true);
Ship::EndGroupPanel();
LUS::EndGroupPanel();
}
UIWidgets::Spacer(0);
UIWidgets::PaddedEnhancementCheckbox("Answer Navi Prompt with L Button", "gNaviOnL");
DrawHelpIcon("Speak to Navi with L but enter first-person camera with C-Up");
Ship::EndGroupPanel();
LUS::EndGroupPanel();
}
void DrawUI(bool& open) {
if (!open) {
CVarSetInteger("gGameControlEditorEnabled", false);
if (CVarGetInteger("gGameControlEditorEnabled", 0)) {
CVarClear("gGameControlEditorEnabled");
LUS::RequestCvarSaveOnNextTick();
}
return;
}

View file

@ -385,7 +385,7 @@ void ResetPositionAll() {
int hue = 0;
// Runs every frame to update rainbow hue, a potential future optimization is to only run this a once or twice a second and increase the speed of the rainbow hue rotation.
void CosmeticsUpdateTick(bool& open) {
void CosmeticsUpdateTick() {
int index = 0;
float rainbowSpeed = CVarGetFloat("gCosmetics.RainbowSpeed", 0.6f);
for (auto& [id, cosmeticOption] : cosmeticOptions) {
@ -1411,7 +1411,7 @@ void Draw_Placements(){
void DrawSillyTab() {
if (CVarGetInteger("gLetItSnow", 0)) {
if (UIWidgets::EnhancementCheckbox("Let It Snow", "gLetItSnow")) {
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
}
if (UIWidgets::EnhancementSliderFloat("Link Body Scale: %f", "##Link_BodyScale", "gCosmetics.Link_BodyScale.Value", 0.001f, 0.025f, "", 0.01f, false)) {
@ -1421,7 +1421,7 @@ void DrawSillyTab() {
if (ImGui::Button("Reset##Link_BodyScale")) {
CVarClear("gCosmetics.Link_BodyScale.Value");
CVarClear("gCosmetics.Link_BodyScale.Changed");
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
static Player* player = GET_PLAYER(gPlayState);
player->actor.scale.x = 0.01f;
player->actor.scale.y = 0.01f;
@ -1434,7 +1434,7 @@ void DrawSillyTab() {
if (ImGui::Button("Reset##Link_HeadScale")) {
CVarClear("gCosmetics.Link_HeadScale.Value");
CVarClear("gCosmetics.Link_HeadScale.Changed");
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
if (UIWidgets::EnhancementSliderFloat("Link Sword Scale: %f", "##Link_SwordScale", "gCosmetics.Link_SwordScale.Value", 1.0f, 2.5f, "", 1.0f, false)) {
CVarSetInteger("gCosmetics.Link_SwordScale.Changed", 1);
@ -1443,44 +1443,44 @@ void DrawSillyTab() {
if (ImGui::Button("Reset##Link_SwordScale")) {
CVarClear("gCosmetics.Link_SwordScale.Value");
CVarClear("gCosmetics.Link_SwordScale.Changed");
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
UIWidgets::EnhancementSliderFloat("Bunny Hood Length: %f", "##BunnyHood_EarLength", "gCosmetics.BunnyHood_EarLength", -300.0f, 1000.0f, "", 0.0f, false);
ImGui::SameLine();
if (ImGui::Button("Reset##BunnyHood_EarLength")) {
CVarClear("gCosmetics.BunnyHood_EarLength");
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
UIWidgets::EnhancementSliderFloat("Bunny Hood Spread: %f", "##BunnyHood_EarSpread", "gCosmetics.BunnyHood_EarSpread", -300.0f, 500.0f, "", 0.0f, false);
ImGui::SameLine();
if (ImGui::Button("Reset##BunnyHood_EarSpread")) {
CVarClear("gCosmetics.BunnyHood_EarSpread");
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
UIWidgets::EnhancementSliderFloat("Goron Neck Length: %f", "##Goron_NeckLength", "gCosmetics.Goron_NeckLength", 0.0f, 1000.0f, "", 0.0f, false);
ImGui::SameLine();
if (ImGui::Button("Reset##Goron_NeckLength")) {
CVarClear("gCosmetics.Goron_NeckLength");
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
UIWidgets::EnhancementCheckbox("Unfix Goron Spin", "gUnfixGoronSpin");
UIWidgets::EnhancementSliderFloat("Fairies Size: %f", "##Fairies_Size", "gCosmetics.Fairies_Size", 0.25f, 5.0f, "", 1.0f, false);
ImGui::SameLine();
if (ImGui::Button("Reset##Fairies_Size")) {
CVarClear("gCosmetics.Fairies_Size");
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
UIWidgets::EnhancementSliderFloat("N64 Logo Spin Speed: %f", "##N64Logo_SpinSpeed", "gCosmetics.N64Logo_SpinSpeed", 0.25f, 5.0f, "", 1.0f, false);
ImGui::SameLine();
if (ImGui::Button("Reset##N64Logo_SpinSpeed")) {
CVarClear("gCosmetics.N64Logo_SpinSpeed");
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
UIWidgets::EnhancementSliderFloat("Moon Size: %f", "##Moon_Size", "gCosmetics.Moon_Size", 0.5f, 2.0f, "", 1.0f, false);
ImGui::SameLine();
if (ImGui::Button("Reset##Moon_Size")) {
CVarClear("gCosmetics.Moon_Size");
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
if (UIWidgets::EnhancementSliderFloat("Kak Windmill Speed: %f", "##Kak_Windmill_Speed", "gCosmetics.Kak_Windmill_Speed.Value", 100.0f, 6000.0f, "", 100.0f, false)) {
CVarSetInteger("gCosmetics.Kak_Windmill_Speed.Changed", 1);
@ -1489,7 +1489,7 @@ void DrawSillyTab() {
if (ImGui::Button("Reset##Kak_Windmill_Speed")) {
CVarClear("gCosmetics.Kak_Windmill_Speed.Value");
CVarClear("gCosmetics.Kak_Windmill_Speed.Changed");
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
}
@ -1597,7 +1597,7 @@ void DrawCosmeticRow(CosmeticOption& cosmeticOption) {
CVarSetInteger((cosmeticOption.rainbowCvar), 0);
CVarSetInteger((cosmeticOption.changedCvar), 1);
ApplyOrResetCustomGfxPatches();
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
ImGui::SameLine();
ImGui::Text(cosmeticOption.label.c_str());
@ -1605,7 +1605,7 @@ void DrawCosmeticRow(CosmeticOption& cosmeticOption) {
if (ImGui::Button(("Random##" + cosmeticOption.label).c_str())) {
RandomizeColor(cosmeticOption);
ApplyOrResetCustomGfxPatches();
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
ImGui::SameLine();
bool isRainbow = (bool)CVarGetInteger((cosmeticOption.rainbowCvar), 0);
@ -1613,20 +1613,20 @@ void DrawCosmeticRow(CosmeticOption& cosmeticOption) {
CVarSetInteger((cosmeticOption.rainbowCvar), isRainbow);
CVarSetInteger((cosmeticOption.changedCvar), 1);
ApplyOrResetCustomGfxPatches();
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
ImGui::SameLine();
bool isLocked = (bool)CVarGetInteger((cosmeticOption.lockedCvar), 0);
if (ImGui::Checkbox(("Locked##" + cosmeticOption.label).c_str(), &isLocked)) {
CVarSetInteger((cosmeticOption.lockedCvar), isLocked);
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
if (CVarGetInteger((cosmeticOption.changedCvar), 0)) {
ImGui::SameLine();
if (ImGui::Button(("Reset##" + cosmeticOption.label).c_str())) {
ResetColor(cosmeticOption);
ApplyOrResetCustomGfxPatches();
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
}
}
@ -1642,7 +1642,7 @@ void DrawCosmeticGroup(CosmeticGroup cosmeticGroup) {
}
}
ApplyOrResetCustomGfxPatches();
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
ImGui::SameLine();
if (ImGui::Button(("Reset##" + label).c_str())) {
@ -1652,7 +1652,7 @@ void DrawCosmeticGroup(CosmeticGroup cosmeticGroup) {
}
}
ApplyOrResetCustomGfxPatches();
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
for (auto& [id, cosmeticOption] : cosmeticOptions) {
if (cosmeticOption.group == cosmeticGroup && (!cosmeticOption.advancedOption || CVarGetInteger("gCosmetics.AdvancedMode", 0))) {
@ -1668,7 +1668,10 @@ static const char* colorSchemes[2] = {
void DrawCosmeticsEditor(bool& open) {
if (!open) {
CVarSetInteger("gCosmeticsEditorEnabled", 0);
if (CVarGetInteger("gCosmeticsEditorEnabled", 0)) {
CVarClear("gCosmeticsEditorEnabled");
LUS::RequestCvarSaveOnNextTick();
}
return;
}
@ -1689,7 +1692,7 @@ void DrawCosmeticsEditor(bool& open) {
CVarSetInteger(cosmeticOption.lockedCvar, 1);
}
}
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
ImGui::SameLine();
if (ImGui::Button("Unlock All Advanced", ImVec2(ImGui::GetContentRegionAvail().x, 30.0f))) {
@ -1698,7 +1701,7 @@ void DrawCosmeticsEditor(bool& open) {
CVarSetInteger(cosmeticOption.lockedCvar, 0);
}
}
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
}
UIWidgets::EnhancementCheckbox("Sync Rainbow colors", "gCosmetics.RainbowSync");
@ -1710,7 +1713,7 @@ void DrawCosmeticsEditor(bool& open) {
}
}
ApplyOrResetCustomGfxPatches();
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
ImGui::SameLine();
if (ImGui::Button("Reset All", ImVec2(ImGui::GetContentRegionAvail().x, 30.0f))) {
@ -1720,7 +1723,7 @@ void DrawCosmeticsEditor(bool& open) {
}
}
ApplyOrResetCustomGfxPatches();
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
if (ImGui::Button("Lock All", ImVec2(ImGui::GetContentRegionAvail().x / 2, 30.0f))) {
@ -1729,7 +1732,7 @@ void DrawCosmeticsEditor(bool& open) {
CVarSetInteger(cosmeticOption.lockedCvar, 1);
}
}
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
ImGui::SameLine();
if (ImGui::Button("Unlock All", ImVec2(ImGui::GetContentRegionAvail().x, 30.0f))) {
@ -1738,7 +1741,7 @@ void DrawCosmeticsEditor(bool& open) {
CVarSetInteger(cosmeticOption.lockedCvar, 0);
}
}
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
if (ImGui::BeginTabBar("CosmeticsContextTabBar", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) {
@ -1763,7 +1766,7 @@ void DrawCosmeticsEditor(bool& open) {
if (ImGui::Button("Reset##Trails_Duration")) {
CVarClear("gCosmetics.Trails_Duration.Value");
CVarClear("gCosmetics.Trails_Duration.Changed");
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
ImGui::EndTabItem();
}
@ -1797,13 +1800,15 @@ void RegisterOnLoadGameHook() {
});
}
void InitCosmeticsEditor() {
// There's probably a better way to do this, but leaving as is for historical reasons. Even though there is no
// real window being rendered here, it calls this every frame allowing us to rotate through the rainbow hue for cosmetics
Ship::AddWindow("Enhancements", "Cosmetics Update Tick", CosmeticsUpdateTick, true, true);
void RegisterOnGameFrameUpdateHook() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([]() {
CosmeticsUpdateTick();
});
}
void InitCosmeticsEditor() {
// Draw the bar in the menu.
Ship::AddWindow("Enhancements", "Cosmetics Editor", DrawCosmeticsEditor);
LUS::AddWindow("Enhancements", "Cosmetics Editor", DrawCosmeticsEditor, CVarGetInteger("gCosmeticsEditorEnabled", 0));
// Convert the `current color` into the format that the ImGui color picker expects
for (auto& [id, cosmeticOption] : cosmeticOptions) {
Color_RGBA8 defaultColor = {cosmeticOption.defaultColor.x, cosmeticOption.defaultColor.y, cosmeticOption.defaultColor.z, cosmeticOption.defaultColor.w};
@ -1814,11 +1819,12 @@ void InitCosmeticsEditor() {
cosmeticOption.currentColor.z = cvarColor.b / 255.0;
cosmeticOption.currentColor.w = cvarColor.a / 255.0;
}
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
ApplyOrResetCustomGfxPatches();
ApplyAuthenticGfxPatches();
RegisterOnLoadGameHook();
RegisterOnGameFrameUpdateHook();
}
void CosmeticsEditor_RandomizeAll() {
@ -1829,7 +1835,7 @@ void CosmeticsEditor_RandomizeAll() {
}
}
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
ApplyOrResetCustomGfxPatches();
}
@ -1840,6 +1846,6 @@ void CosmeticsEditor_ResetAll() {
}
}
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
ApplyOrResetCustomGfxPatches();
}

View file

@ -417,6 +417,7 @@ CrowdControl::Effect* CrowdControl::ParseMessage(char payload[512]) {
break;
case kEffectFillHeart:
effect->giEffect = new GameInteractionEffect::ModifyHealth();
effect->giEffect->parameters[0] = receivedParameter;
break;
case kEffectKnockbackLinkWeak:
effect->giEffect = new GameInteractionEffect::KnockbackPlayer();
@ -454,6 +455,7 @@ CrowdControl::Effect* CrowdControl::ParseMessage(char payload[512]) {
break;
case kEffectAddRupees:
effect->giEffect = new GameInteractionEffect::ModifyRupees();
effect->giEffect->parameters[0] = receivedParameter;
break;
case kEffectGiveDekuShield:
effect->giEffect = new GameInteractionEffect::GiveOrTakeShield();
@ -465,26 +467,32 @@ CrowdControl::Effect* CrowdControl::ParseMessage(char payload[512]) {
break;
case kEffectRefillSticks:
effect->giEffect = new GameInteractionEffect::AddOrTakeAmmo();
effect->giEffect->parameters[0] = receivedParameter;
effect->giEffect->parameters[1] = ITEM_STICK;
break;
case kEffectRefillNuts:
effect->giEffect = new GameInteractionEffect::AddOrTakeAmmo();
effect->giEffect->parameters[0] = receivedParameter;
effect->giEffect->parameters[1] = ITEM_NUT;
break;
case kEffectRefillBombs:
effect->giEffect = new GameInteractionEffect::AddOrTakeAmmo();
effect->giEffect->parameters[0] = receivedParameter;
effect->giEffect->parameters[1] = ITEM_BOMB;
break;
case kEffectRefillSeeds:
effect->giEffect = new GameInteractionEffect::AddOrTakeAmmo();
effect->giEffect->parameters[0] = receivedParameter;
effect->giEffect->parameters[1] = ITEM_SLINGSHOT;
break;
case kEffectRefillArrows:
effect->giEffect = new GameInteractionEffect::AddOrTakeAmmo();
effect->giEffect->parameters[0] = receivedParameter;
effect->giEffect->parameters[1] = ITEM_BOW;
break;
case kEffectRefillBombchus:
effect->giEffect = new GameInteractionEffect::AddOrTakeAmmo();
effect->giEffect->parameters[0] = receivedParameter;
effect->giEffect->parameters[1] = ITEM_BOMBCHU;
break;
@ -811,16 +819,6 @@ CrowdControl::Effect* CrowdControl::ParseMessage(char payload[512]) {
break;
}
// If no value is specifically set, default to using whatever CC sends us.
// Values are used for various things depending on the effect, but they
// usually represent the "amount" of an effect. Amount of hearts healed,
// strength of knockback, etc.
if (effect->giEffect != NULL) {
if (!effect->giEffect->parameters[0]) {
effect->giEffect->parameters[0] = receivedParameter;
}
}
return effect;
}

View file

@ -113,7 +113,7 @@ public class ShipOfHarkinian : SimpleTCPPack
new("No UI", "no_ui") { Category = "Visual Effects", Duration = 60, Price = 20, Description = "No need to see ammo counts. The cinematic experience." },
new("Rainstorm", "rainstorm") { Category = "Visual Effects", Duration = 30, Price = 5, Description = "Summon a rainstorm for a sad moment." },
new("Debug Mode", "debug_mode") { Category = "Visual Effects", Duration = 30, Price = 20, Description = "if (debug_mode) { ShowCollision(); }" },
new("Randomize Cosmetics", "random_cosmetics") { Category = "Visual Effects", Duration = 30, Price = 30, Description = "Randomize most cosmetics options. Cosmetics changed by bidding wars are unaffected." },
new("Randomize Cosmetics", "random_cosmetics") { Category = "Visual Effects", Price = 30, Description = "Randomize most cosmetics options. Cosmetics changed by bidding wars are unaffected." },
// Controls

File diff suppressed because it is too large Load diff

View file

@ -531,7 +531,10 @@ void PopulateActorDropdown(int i, std::vector<Actor*>& data) {
void DrawActorViewer(bool& open) {
if (!open) {
CVarSetInteger("gActorViewerEnabled", 0);
if (CVarGetInteger("gActorViewerEnabled", 0)) {
CVarClear("gActorViewerEnabled");
LUS::RequestCvarSaveOnNextTick();
}
return;
}
@ -787,5 +790,5 @@ void DrawActorViewer(bool& open) {
}
void InitActorViewer() {
Ship::AddWindow("Developer Tools", "Actor Viewer", DrawActorViewer);
LUS::AddWindow("Developer Tools", "Actor Viewer", DrawActorViewer, CVarGetInteger("gActorViewerEnabled", 0));
}

View file

@ -53,7 +53,10 @@ static std::vector<Vtx> sphereVtx;
// Draws the ImGui window for the collision viewer
void DrawColViewerWindow(bool& open) {
if (!open) {
CVarSetInteger("gCollisionViewerEnabled", 0);
if (CVarGetInteger("gCollisionViewerEnabled", 0)) {
CVarClear("gCollisionViewerEnabled");
LUS::RequestCvarSaveOnNextTick();
}
return;
}
@ -288,7 +291,7 @@ void CreateSphereData() {
}
void InitColViewer() {
Ship::AddWindow("Developer Tools", "Collision Viewer", DrawColViewerWindow);
LUS::AddWindow("Developer Tools", "Collision Viewer", DrawColViewerWindow, CVarGetInteger("gCollisionViewerEnabled", 0));
CreateCylinderData();
CreateSphereData();

View file

@ -605,7 +605,7 @@ void DrawInfoTab() {
void DrawBGSItemFlag(uint8_t itemID) {
const ItemMapEntry& slotEntry = itemMapping[itemID];
ImGui::Image(Ship::GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1));
ImGui::Image(LUS::GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1));
ImGui::SameLine();
int tradeIndex = itemID - ITEM_POCKET_EGG;
bool hasItem = (gSaveContext.adultTradeItems & (1 << tradeIndex)) != 0;
@ -647,7 +647,7 @@ void DrawInventoryTab() {
uint8_t item = gSaveContext.inventory.items[index];
if (item != ITEM_NONE) {
const ItemMapEntry& slotEntry = itemMapping.find(item)->second;
if (ImGui::ImageButton(Ship::GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0),
if (ImGui::ImageButton(LUS::GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0),
ImVec2(1, 1), 0)) {
selectedIndex = index;
ImGui::OpenPopup(itemPopupPicker);
@ -695,7 +695,7 @@ void DrawInventoryTab() {
ImGui::SameLine();
}
const ItemMapEntry& slotEntry = possibleItems[pickerIndex];
if (ImGui::ImageButton(Ship::GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f),
if (ImGui::ImageButton(LUS::GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f),
ImVec2(0, 0), ImVec2(1, 1), 0)) {
gSaveContext.inventory.items[selectedIndex] = slotEntry.id;
// Set adult trade item flag if you're playing adult trade shuffle in rando
@ -733,7 +733,7 @@ void DrawInventoryTab() {
ImGui::PushItemWidth(32.0f);
ImGui::BeginGroup();
ImGui::Image(Ship::GetTextureByName(itemMapping[item].name), ImVec2(32.0f, 32.0f));
ImGui::Image(LUS::GetTextureByName(itemMapping[item].name), ImVec2(32.0f, 32.0f));
ImGui::InputScalar("##ammoInput", ImGuiDataType_S8, &AMMO(item));
ImGui::EndGroup();
@ -1148,7 +1148,7 @@ void DrawUpgradeIcon(const std::string& categoryName, int32_t categoryId, const
uint8_t item = items[CUR_UPG_VALUE(categoryId)];
if (item != ITEM_NONE) {
const ItemMapEntry& slotEntry = itemMapping[item];
if (ImGui::ImageButton(Ship::GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0),
if (ImGui::ImageButton(LUS::GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0),
ImVec2(1, 1), 0)) {
ImGui::OpenPopup(upgradePopupPicker);
}
@ -1176,7 +1176,7 @@ void DrawUpgradeIcon(const std::string& categoryName, int32_t categoryId, const
UIWidgets::SetLastItemHoverText("None");
} else {
const ItemMapEntry& slotEntry = itemMapping[items[pickerIndex]];
if (ImGui::ImageButton(Ship::GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0),
if (ImGui::ImageButton(LUS::GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0),
ImVec2(1, 1), 0)) {
Inventory_ChangeUpgrade(categoryId, pickerIndex);
ImGui::CloseCurrentPopup();
@ -1213,7 +1213,7 @@ void DrawEquipmentTab() {
bool hasEquip = (bitMask & gSaveContext.inventory.equipment) != 0;
const ItemMapEntry& entry = itemMapping[equipmentValues[i]];
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
if (ImGui::ImageButton(Ship::GetTextureByName(hasEquip ? entry.name : entry.nameFaded),
if (ImGui::ImageButton(LUS::GetTextureByName(hasEquip ? entry.name : entry.nameFaded),
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) {
if (hasEquip) {
gSaveContext.inventory.equipment &= ~bitMask;
@ -1312,7 +1312,7 @@ void DrawQuestItemButton(uint32_t item) {
uint32_t bitMask = 1 << entry.id;
bool hasQuestItem = (bitMask & gSaveContext.inventory.questItems) != 0;
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
if (ImGui::ImageButton(Ship::GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded),
if (ImGui::ImageButton(LUS::GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded),
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) {
if (hasQuestItem) {
gSaveContext.inventory.questItems &= ~bitMask;
@ -1330,7 +1330,7 @@ void DrawDungeonItemButton(uint32_t item, uint32_t scene) {
uint32_t bitMask = 1 << (entry.id - ITEM_KEY_BOSS); // Bitset starts at ITEM_KEY_BOSS == 0. the rest are sequential
bool hasItem = (bitMask & gSaveContext.inventory.dungeonItems[scene]) != 0;
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
if (ImGui::ImageButton(Ship::GetTextureByName(hasItem ? entry.name : entry.nameFaded),
if (ImGui::ImageButton(LUS::GetTextureByName(hasItem ? entry.name : entry.nameFaded),
ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) {
if (hasItem) {
gSaveContext.inventory.dungeonItems[scene] &= ~bitMask;
@ -1377,7 +1377,7 @@ void DrawQuestStatusTab() {
uint32_t bitMask = 1 << entry.id;
bool hasQuestItem = (bitMask & gSaveContext.inventory.questItems) != 0;
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
if (ImGui::ImageButton(Ship::GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded),
if (ImGui::ImageButton(LUS::GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded),
ImVec2(16.0f, 24.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) {
if (hasQuestItem) {
gSaveContext.inventory.questItems &= ~bitMask;
@ -1440,7 +1440,7 @@ void DrawQuestStatusTab() {
if (dungeonItemsScene != SCENE_BDAN_BOSS) {
float lineHeight = ImGui::GetTextLineHeightWithSpacing();
ImGui::Image(Ship::GetTextureByName(itemMapping[ITEM_KEY_SMALL].name), ImVec2(lineHeight, lineHeight));
ImGui::Image(LUS::GetTextureByName(itemMapping[ITEM_KEY_SMALL].name), ImVec2(lineHeight, lineHeight));
ImGui::SameLine();
if (ImGui::InputScalar("##Keys", ImGuiDataType_S8, gSaveContext.inventory.dungeonKeys + dungeonItemsScene)) {
gSaveContext.sohStats.dungeonKeys[dungeonItemsScene] = gSaveContext.inventory.dungeonKeys[dungeonItemsScene];
@ -1733,7 +1733,10 @@ void DrawPlayerTab() {
void DrawSaveEditor(bool& open) {
if (!open) {
CVarSetInteger("gSaveEditorEnabled", 0);
if (CVarGetInteger("gSaveEditorEnabled", 0)) {
CVarClear("gSaveEditorEnabled");
LUS::RequestCvarSaveOnNextTick();
}
return;
}
@ -1781,34 +1784,34 @@ void DrawSaveEditor(bool& open) {
}
void InitSaveEditor() {
Ship::AddWindow("Developer Tools", "Save Editor", DrawSaveEditor);
LUS::AddWindow("Developer Tools", "Save Editor", DrawSaveEditor, CVarGetInteger("gSaveEditorEnabled", 0));
// Load item icons into ImGui
for (const auto& entry : itemMapping) {
Ship::LoadResource(entry.second.name, entry.second.texturePath);
Ship::LoadResource(entry.second.nameFaded, entry.second.texturePath, ImVec4(1, 1, 1, 0.3f));
LUS::LoadResource(entry.second.name, entry.second.texturePath);
LUS::LoadResource(entry.second.nameFaded, entry.second.texturePath, ImVec4(1, 1, 1, 0.3f));
}
for (const auto& entry : gregMapping) {
ImVec4 gregGreen = ImVec4(42.0f / 255.0f, 169.0f / 255.0f, 40.0f / 255.0f, 1.0f);
ImVec4 gregFadedGreen = gregGreen;
gregFadedGreen.w = 0.3f;
Ship::LoadResource(entry.second.name, entry.second.texturePath, gregGreen);
Ship::LoadResource(entry.second.nameFaded, entry.second.texturePath, gregFadedGreen);
LUS::LoadResource(entry.second.name, entry.second.texturePath, gregGreen);
LUS::LoadResource(entry.second.nameFaded, entry.second.texturePath, gregFadedGreen);
}
for (const auto& entry : questMapping) {
Ship::LoadResource(entry.second.name, entry.second.texturePath);
Ship::LoadResource(entry.second.nameFaded, entry.second.texturePath, ImVec4(1, 1, 1, 0.3f));
LUS::LoadResource(entry.second.name, entry.second.texturePath);
LUS::LoadResource(entry.second.nameFaded, entry.second.texturePath, ImVec4(1, 1, 1, 0.3f));
}
for (const auto& entry : songMapping) {
Ship::LoadResource(entry.name, gSongNoteTex, entry.color);
LUS::LoadResource(entry.name, gSongNoteTex, entry.color);
ImVec4 fadedCol = entry.color;
fadedCol.w = 0.3f;
Ship::LoadResource(entry.nameFaded, gSongNoteTex, fadedCol);
LUS::LoadResource(entry.nameFaded, gSongNoteTex, fadedCol);
}
for (const auto& entry : vanillaSongMapping) {
Ship::LoadResource(entry.name, gSongNoteTex, entry.color);
LUS::LoadResource(entry.name, gSongNoteTex, entry.color);
ImVec4 fadedCol = entry.color;
fadedCol.w = 0.3f;
Ship::LoadResource(entry.nameFaded, gSongNoteTex, fadedCol);
LUS::LoadResource(entry.nameFaded, gSongNoteTex, fadedCol);
}
}

View file

@ -10,7 +10,7 @@
#include <bit>
#include <map>
#include <string>
#include <libultraship/bridge.h>
#include <libultraship/libultraship.h>
extern "C" {
#include <z64.h>
@ -40,7 +40,10 @@ std::map<int, std::string> cmdMap = {
void DrawDLViewer(bool& open) {
if (!open) {
CVarSetInteger("gDLViewerEnabled", 0);
if (CVarGetInteger("gDLViewerEnabled", 0)) {
CVarClear("gDLViewerEnabled");
LUS::RequestCvarSaveOnNextTick();
}
return;
}
@ -64,7 +67,7 @@ void DrawDLViewer(bool& open) {
ImGui::EndCombo();
}
if (activeDisplayList != nullptr) {
auto res = std::static_pointer_cast<Ship::DisplayList>(OTRGlobals::Instance->context->GetResourceManager()->LoadResource(activeDisplayList));
auto res = std::static_pointer_cast<LUS::DisplayList>(LUS::Context::GetInstance()->GetResourceManager()->LoadResource(activeDisplayList));
for (int i = 0; i < res->Instructions.size(); i++) {
std::string id = "##CMD" + std::to_string(i);
Gfx* gfx = (Gfx*)&res->Instructions[i];
@ -138,7 +141,7 @@ void DrawDLViewer(bool& open) {
}
void InitDLViewer() {
Ship::AddWindow("Developer Tools", "Display List Viewer", DrawDLViewer);
LUS::AddWindow("Developer Tools", "Display List Viewer", DrawDLViewer, CVarGetInteger("gDLViewerEnabled", 0));
displayListsSearchResults = ResourceMgr_ListFiles("*DL", &displayListsSearchResultsCount);
}

View file

@ -335,7 +335,7 @@ void GameInteractor::RawAction::SetCosmeticsColor(uint8_t cosmeticCategory, uint
break;
}
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
ApplyOrResetCustomGfxPatches();
}

View file

@ -263,7 +263,10 @@ std::string ResolveSceneID(int sceneID, int roomID){
void DrawStatsTracker(bool& open) {
if (!open) {
CVarSetInteger("gGameplayStatsEnabled", 0);
if (CVarGetInteger("gGameplayStatsEnabled", 0)) {
CVarClear("gGameplayStatsEnabled");
LUS::RequestCvarSaveOnNextTick();
}
return;
}
@ -667,8 +670,7 @@ void SetupDisplayColors() {
}
extern "C" void InitStatTracker() {
Ship::AddWindow("Enhancements", "Gameplay Stats", DrawStatsTracker,
CVarGetInteger("gGameplayStatsEnabled", 0) == 1);
LUS::AddWindow("Enhancements", "Gameplay Stats", DrawStatsTracker, CVarGetInteger("gGameplayStatsEnabled", 0));
SetupDisplayNames();
SetupDisplayColors();
}

View file

@ -152,7 +152,7 @@ void RegisterFreezeTime() {
int32_t prevTime = CVarGetInteger("gPrevTime", gSaveContext.dayTime);
gSaveContext.dayTime = prevTime;
} else {
CVarSetInteger("gPrevTime", -1);
CVarClear("gPrevTime");
}
});
}
@ -408,11 +408,13 @@ void RegisterHyperBosses() {
uint8_t isBossActor =
actor->id == ACTOR_BOSS_GOMA || // Gohma
actor->id == ACTOR_BOSS_DODONGO || // King Dodongo
actor->id == ACTOR_EN_BDFIRE || // King Dodongo Fire Breath
actor->id == ACTOR_BOSS_VA || // Barinade
actor->id == ACTOR_BOSS_GANONDROF || // Phantom Ganon
(actor->id == 0 && actor->category == ACTORCAT_BOSS) || // Phantom Ganon/Ganondorf Energy Ball/Thunder
actor->id == ACTOR_EN_FHG_FIRE || // Phantom Ganon/Ganondorf Energy Ball/Thunder
actor->id == ACTOR_EN_FHG || // Phantom Ganon's Horse
actor->id == ACTOR_BOSS_FD || actor->id == ACTOR_BOSS_FD2 || // Volvagia (grounded/flying)
actor->id == ACTOR_EN_VB_BALL || // Volvagia Rocks
actor->id == ACTOR_BOSS_MO || // Morpha
actor->id == ACTOR_BOSS_SST || // Bongo Bongo
actor->id == ACTOR_BOSS_TW || // Twinrova

View file

@ -59,7 +59,7 @@ void DrawPresetSelector(PresetType presetTypeId) {
if (selectedPresetId != 0) {
applyPreset(selectedPresetDef.entries);
}
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
ImGui::PopStyleVar(1);
}

View file

@ -333,7 +333,7 @@ static bool ValidateWorld(Entrance* entrancePlaced) {
// This means we need to hard check that none of the relevant entrances are ever reachable as that age
// This is mostly relevant when mixing entrance pools or shuffling special interiors (such as windmill or kak potion shop)
// Warp Songs and Overworld Spawns can also end up inside certain indoors so those need to be handled as well
std::array<std::string, 2> childForbidden = {"OGC Great Fairy Fountain -> Castle Grounds", "GV Carpenter Tent -> GV Fortress Side"};
std::array<std::string, 3> childForbidden = {"OGC Great Fairy Fountain -> Castle Grounds", "GV Carpenter Tent -> GV Fortress Side", "Ganon's Castle Entryway -> Castle Grounds From Ganon's Castle"};
std::array<std::string, 2> adultForbidden = {"HC Great Fairy Fountain -> Castle Grounds", "HC Storms Grotto -> Castle Grounds"};
auto allShuffleableEntrances = GetShuffleableEntrances(EntranceType::All, false);
@ -711,8 +711,8 @@ int ShuffleAllEntrances() {
{EntranceType::Dungeon, ICE_CAVERN_ENTRYWAY, ZORAS_FOUNTAIN, 0x03D4}},
{{EntranceType::Dungeon, GERUDO_FORTRESS, GERUDO_TRAINING_GROUNDS_ENTRYWAY, 0x0008},
{EntranceType::Dungeon, GERUDO_TRAINING_GROUNDS_ENTRYWAY, GERUDO_FORTRESS, 0x03A8}},
{{EntranceType::GanonDungeon, GANONS_CASTLE_GROUNDS, GANONS_CASTLE_ENTRYWAY, 0x0467},
{EntranceType::GanonDungeon, GANONS_CASTLE_ENTRYWAY, GANONS_CASTLE_GROUNDS, 0x023D}},
{{EntranceType::GanonDungeon, GANONS_CASTLE_LEDGE, GANONS_CASTLE_ENTRYWAY, 0x0467},
{EntranceType::GanonDungeon, GANONS_CASTLE_ENTRYWAY, CASTLE_GROUNDS_FROM_GANONS_CASTLE, 0x023D}},
{{EntranceType::Interior, KOKIRI_FOREST, KF_MIDOS_HOUSE, 0x0433},
{EntranceType::Interior, KF_MIDOS_HOUSE, KOKIRI_FOREST, 0x0443}},

View file

@ -1171,12 +1171,14 @@ typedef enum {
TEMPLE_OF_TIME,
TOT_BEYOND_DOOR_OF_TIME,
CASTLE_GROUNDS,
CASTLE_GROUNDS_FROM_GANONS_CASTLE,
HYRULE_CASTLE_GROUNDS,
HC_GARDEN,
HC_GREAT_FAIRY_FOUNTAIN,
HC_STORMS_GROTTO,
GANONS_CASTLE_GROUNDS,
OGC_GREAT_FAIRY_FOUNTAIN,
GANONS_CASTLE_LEDGE,
KAKARIKO_VILLAGE,
KAK_CARPENTER_BOSS_HOUSE,
KAK_HOUSE_OF_SKULLTULA,

View file

@ -135,14 +135,17 @@ void AreaTable_Init_CastleTown() {
Entrance(CASTLE_GROUNDS, {[]{return true;}}),
});
areaTable[GANONS_CASTLE_GROUNDS] = Area("Ganon's Castle Grounds", "Castle Grounds", OUTSIDE_GANONS_CASTLE, NO_DAY_NIGHT_CYCLE, {}, {
areaTable[GANONS_CASTLE_GROUNDS] = Area("Ganon's Castle Grounds", "Castle Grounds", OUTSIDE_GANONS_CASTLE, NO_DAY_NIGHT_CYCLE, {
EventAccess(&BuiltRainbowBridge, {[]{return CanBuildRainbowBridge;}}),
}, {
//Locations //the terrain was lowered such that you can't get this GS with a simple sword slash
LocationAccess(OGC_GS, {[]{return HasExplosives || (IsAdult && (LogicOutsideGanonsGS || Bow || HookshotOrBoomerang || CanUse(DINS_FIRE)));}}),
LocationAccess(OGC_GS, {[]{return CanJumpslash || CanUseProjectile
|| (CanShield && CanUse(MEGATON_HAMMER)) || CanUse(DINS_FIRE);}}),
}, {
//Exits
Entrance(CASTLE_GROUNDS, {[]{return AtNight;}}),
Entrance(OGC_GREAT_FAIRY_FOUNTAIN, {[]{return CanUse(GOLDEN_GAUNTLETS) && AtNight;}}),
Entrance(GANONS_CASTLE_ENTRYWAY, {[]{return CanBuildRainbowBridge;},
Entrance(GANONS_CASTLE_LEDGE, {[]{return BuiltRainbowBridge;},
/*Glitched*/[]{return (HasBombchus && CanDoGlitch(GlitchType::BombHover, GlitchDifficulty::NOVICE)) || CanDoGlitch(GlitchType::HoverBoost, GlitchDifficulty::ADVANCED) || (HoverBoots && CanShield && Bombs && CanDoGlitch(GlitchType::SuperSlide, GlitchDifficulty::EXPERT)) || (HoverBoots && CanDoGlitch(GlitchType::Megaflip, GlitchDifficulty::ADVANCED));}}),
});
@ -155,6 +158,20 @@ void AreaTable_Init_CastleTown() {
Entrance(CASTLE_GROUNDS, {[]{return true;}}),
});
areaTable[CASTLE_GROUNDS_FROM_GANONS_CASTLE] = Area("Castle Grounds From Ganon's Castle", "Castle Grounds From Ganon's Castle", NONE, NO_DAY_NIGHT_CYCLE, {}, {}, {
// Exits
Entrance(HYRULE_CASTLE_GROUNDS, { [] { return IsChild; }}),
Entrance(GANONS_CASTLE_LEDGE, { [] { return IsAdult; }}),
});
areaTable[GANONS_CASTLE_LEDGE] = Area("Ganon's Castle Ledge", "OGC Ganon's Castle Ledge", NONE, NO_DAY_NIGHT_CYCLE,
{}, {}, {
// Exits
Entrance(GANONS_CASTLE_GROUNDS, {[]{return BuiltRainbowBridge;},
/*Glitched*/[]{return (HasBombchus && CanDoGlitch(GlitchType::BombHover, GlitchDifficulty::NOVICE)) || CanDoGlitch(GlitchType::HoverBoost, GlitchDifficulty::ADVANCED) || (HoverBoots && CanShield && Bombs && CanDoGlitch(GlitchType::SuperSlide, GlitchDifficulty::EXPERT)) || (HoverBoots && CanDoGlitch(GlitchType::Megaflip, GlitchDifficulty::ADVANCED));}}),
Entrance(GANONS_CASTLE_ENTRYWAY, {[]{return IsAdult;}}),
});
areaTable[MARKET_GUARD_HOUSE] = Area("Market Guard House", "Market Guard House", NONE, NO_DAY_NIGHT_CYCLE, {}, {
//Locations
LocationAccess(MARKET_10_BIG_POES, {[]{return IsAdult && BigPoeKill;}}),

View file

@ -15,7 +15,7 @@ void AreaTable_Init_GanonsCastle() {
//Exits
Entrance(GANONS_CASTLE_LOBBY, {[]{return Dungeon::GanonsCastle.IsVanilla();}}),
Entrance(GANONS_CASTLE_MQ_LOBBY, {[]{return Dungeon::GanonsCastle.IsMQ();}}),
Entrance(GANONS_CASTLE_GROUNDS, {[]{return true;}}),
Entrance(CASTLE_GROUNDS_FROM_GANONS_CASTLE, {[]{return true;}}),
});
/*--------------------------

View file

@ -298,6 +298,7 @@ namespace Logic {
bool HasAllStones = false;
bool HasAllMedallions = false;
bool CanBuildRainbowBridge = false;
bool BuiltRainbowBridge = false;
bool CanTriggerLACS = false;
//Other
@ -1171,6 +1172,7 @@ namespace Logic {
HasAllStones = false;
HasAllMedallions = false;
CanBuildRainbowBridge = false;
BuiltRainbowBridge = false;
CanTriggerLACS = false;
//Other

View file

@ -286,6 +286,7 @@ extern bool CanUseMagicArrow;
extern bool HasAllStones;
extern bool HasAllMedallions;
extern bool CanBuildRainbowBridge;
extern bool BuiltRainbowBridge;
extern bool CanTriggerLACS;
// Other

View file

@ -6,7 +6,7 @@
#include "rando_main.hpp"
// #include <soh/Enhancements/randomizer.h>
#include <libultraship/bridge.h>
#include <Window.h>
#include <Context.h>
#include <libultraship/libultra/types.h>
#define TICKS_PER_SEC 268123480.0
@ -20,7 +20,7 @@ void RandoMain::GenerateRando(std::unordered_map<RandomizerSettingKey, u8> cvarS
// std::string settingsFileName = "./randomizer/latest_settings.json";
// CVarSetString("gLoadedPreset", settingsFileName.c_str());
std::string fileName = Ship::Window::GetPathRelativeToAppDirectory(GenerateRandomizer(cvarSettings, excludedLocations, seedString).c_str());
std::string fileName = LUS::Context::GetPathRelativeToAppDirectory(GenerateRandomizer(cvarSettings, excludedLocations, seedString).c_str());
CVarSetString("gSpoilerLog", fileName.c_str());
CVarSave();

View file

@ -27,7 +27,7 @@
#include <filesystem>
#include <variables.h>
#include <Window.h>
#include <libultraship/libultraship.h>
using json = nlohmann::json;
@ -807,8 +807,8 @@ const char* SpoilerLog_Write(int language) {
WriteShuffledEntrances();
WriteAllLocations(language);
if (!std::filesystem::exists(Ship::Window::GetPathRelativeToAppDirectory("Randomizer"))) {
std::filesystem::create_directory(Ship::Window::GetPathRelativeToAppDirectory("Randomizer"));
if (!std::filesystem::exists(LUS::Context::GetPathRelativeToAppDirectory("Randomizer"))) {
std::filesystem::create_directory(LUS::Context::GetPathRelativeToAppDirectory("Randomizer"));
}
std::string jsonString = jsonData.dump(4);
@ -823,7 +823,7 @@ const char* SpoilerLog_Write(int language) {
fileNameStream << std::to_string(Settings::hashIconIndexes[i]);
}
std::string fileName = fileNameStream.str();
std::ofstream jsonFile(Ship::Window::GetPathRelativeToAppDirectory(
std::ofstream jsonFile(LUS::Context::GetPathRelativeToAppDirectory(
(std::string("Randomizer/") + fileName + std::string(".json")).c_str()));
jsonFile << std::setw(4) << jsonString << std::endl;
jsonFile.close();

View file

@ -12,7 +12,7 @@
extern "C" void Randomizer_DrawSmallKey(PlayState* play, GetItemEntry* getItemEntry) {
s32 pad;
s8 isColoredKeysEnabled = CVarGetInteger("gRandoMatchKeyColors", 0);
s8 isColoredKeysEnabled = CVarGetInteger("gRandoMatchKeyColors", 1);
s16 color_slot = getItemEntry->getItemId - RG_FOREST_TEMPLE_SMALL_KEY;
s16 colors[9][3] = {
{ 4, 195, 46 }, // Forest Temple
@ -49,7 +49,7 @@ extern "C" void Randomizer_DrawSmallKey(PlayState* play, GetItemEntry* getItemEn
extern "C" void Randomizer_DrawBossKey(PlayState* play, GetItemEntry* getItemEntry) {
s32 pad;
s8 isColoredKeysEnabled = CVarGetInteger("gRandoMatchKeyColors", 0);
s8 isColoredKeysEnabled = CVarGetInteger("gRandoMatchKeyColors", 1);
s16 color_slot;
color_slot = getItemEntry->getItemId - RG_FOREST_TEMPLE_BOSS_KEY;
s16 colors[6][3] = {

View file

@ -2155,7 +2155,8 @@ GetItemID Randomizer::GetItemIdFromRandomizerGet(RandomizerGet randoGet, GetItem
case RG_ICE_CAVERN_MAP:
if (GetRandoSettingValue(RSK_STARTING_MAPS_COMPASSES) == RO_DUNGEON_ITEM_LOC_STARTWITH ||
GetRandoSettingValue(RSK_STARTING_MAPS_COMPASSES) == RO_DUNGEON_ITEM_LOC_VANILLA ||
GetRandoSettingValue(RSK_STARTING_MAPS_COMPASSES) == RO_DUNGEON_ITEM_LOC_OWN_DUNGEON) {
(GetRandoSettingValue(RSK_STARTING_MAPS_COMPASSES) == RO_DUNGEON_ITEM_LOC_OWN_DUNGEON &&
GetRandoSettingValue(RSK_SHUFFLE_BOSS_ENTRANCES) == RO_BOSS_ROOM_ENTRANCE_SHUFFLE_OFF)) {
return GI_MAP;
} else {
return (GetItemID)randoGet;
@ -2173,7 +2174,8 @@ GetItemID Randomizer::GetItemIdFromRandomizerGet(RandomizerGet randoGet, GetItem
case RG_ICE_CAVERN_COMPASS:
if (GetRandoSettingValue(RSK_STARTING_MAPS_COMPASSES) == RO_DUNGEON_ITEM_LOC_STARTWITH ||
GetRandoSettingValue(RSK_STARTING_MAPS_COMPASSES) == RO_DUNGEON_ITEM_LOC_VANILLA ||
GetRandoSettingValue(RSK_STARTING_MAPS_COMPASSES) == RO_DUNGEON_ITEM_LOC_OWN_DUNGEON) {
(GetRandoSettingValue(RSK_STARTING_MAPS_COMPASSES) == RO_DUNGEON_ITEM_LOC_OWN_DUNGEON &&
GetRandoSettingValue(RSK_SHUFFLE_BOSS_ENTRANCES) == RO_BOSS_ROOM_ENTRANCE_SHUFFLE_OFF)) {
return GI_COMPASS;
} else {
return (GetItemID)randoGet;
@ -2186,15 +2188,16 @@ GetItemID Randomizer::GetItemIdFromRandomizerGet(RandomizerGet randoGet, GetItem
case RG_SHADOW_TEMPLE_BOSS_KEY:
if (GetRandoSettingValue(RSK_BOSS_KEYSANITY) == RO_DUNGEON_ITEM_LOC_STARTWITH ||
GetRandoSettingValue(RSK_BOSS_KEYSANITY) == RO_DUNGEON_ITEM_LOC_VANILLA ||
GetRandoSettingValue(RSK_BOSS_KEYSANITY) == RO_DUNGEON_ITEM_LOC_OWN_DUNGEON) {
(GetRandoSettingValue(RSK_BOSS_KEYSANITY) == RO_DUNGEON_ITEM_LOC_OWN_DUNGEON &&
GetRandoSettingValue(RSK_SHUFFLE_BOSS_ENTRANCES) == RO_BOSS_ROOM_ENTRANCE_SHUFFLE_OFF)) {
return GI_KEY_BOSS;
} else {
return (GetItemID)randoGet;
}
case RG_GANONS_CASTLE_BOSS_KEY:
if (GetRandoSettingValue(RSK_GANONS_BOSS_KEY) == RO_GANON_BOSS_KEY_VANILLA ||
GetRandoSettingValue(RSK_GANONS_BOSS_KEY) == RO_GANON_BOSS_KEY_OWN_DUNGEON ||
GetRandoSettingValue(RSK_GANONS_BOSS_KEY) == RO_GANON_BOSS_KEY_STARTWITH) {
if (GetRandoSettingValue(RSK_GANONS_BOSS_KEY) == RO_GANON_BOSS_KEY_STARTWITH ||
GetRandoSettingValue(RSK_GANONS_BOSS_KEY) == RO_GANON_BOSS_KEY_VANILLA ||
GetRandoSettingValue(RSK_GANONS_BOSS_KEY) == RO_GANON_BOSS_KEY_OWN_DUNGEON) {
return GI_KEY_BOSS;
} else {
return (GetItemID)randoGet;
@ -2210,7 +2213,8 @@ GetItemID Randomizer::GetItemIdFromRandomizerGet(RandomizerGet randoGet, GetItem
case RG_GANONS_CASTLE_SMALL_KEY:
if (GetRandoSettingValue(RSK_KEYSANITY) == RO_DUNGEON_ITEM_LOC_STARTWITH ||
GetRandoSettingValue(RSK_KEYSANITY) == RO_DUNGEON_ITEM_LOC_VANILLA ||
GetRandoSettingValue(RSK_KEYSANITY) == RO_DUNGEON_ITEM_LOC_OWN_DUNGEON) {
(GetRandoSettingValue(RSK_KEYSANITY) == RO_DUNGEON_ITEM_LOC_OWN_DUNGEON &&
GetRandoSettingValue(RSK_SHUFFLE_BOSS_ENTRANCES) == RO_BOSS_ROOM_ENTRANCE_SHUFFLE_OFF)) {
return GI_KEY_SMALL;
} else {
return (GetItemID)randoGet;
@ -2387,10 +2391,13 @@ bool Randomizer::IsItemVanilla(RandomizerGet randoGet) {
case RG_BOTTOM_OF_THE_WELL_SMALL_KEY:
case RG_GERUDO_TRAINING_GROUNDS_SMALL_KEY:
case RG_GANONS_CASTLE_SMALL_KEY:
if (GetRandoSettingValue(RSK_KEYSANITY) > 2) {
return false;
if (GetRandoSettingValue(RSK_KEYSANITY) == RO_DUNGEON_ITEM_LOC_STARTWITH ||
GetRandoSettingValue(RSK_KEYSANITY) == RO_DUNGEON_ITEM_LOC_VANILLA ||
(GetRandoSettingValue(RSK_KEYSANITY) == RO_DUNGEON_ITEM_LOC_OWN_DUNGEON &&
GetRandoSettingValue(RSK_SHUFFLE_BOSS_ENTRANCES) == RO_BOSS_ROOM_ENTRANCE_SHUFFLE_OFF)) {
return true;
}
return true;
return false;
case RG_GERUDO_FORTRESS_SMALL_KEY:
if (GetRandoSettingValue(RSK_GERUDO_KEYS) != RO_GERUDO_KEYS_VANILLA) {
return false;
@ -2403,14 +2410,15 @@ bool Randomizer::IsItemVanilla(RandomizerGet randoGet) {
case RG_SHADOW_TEMPLE_BOSS_KEY:
if (GetRandoSettingValue(RSK_BOSS_KEYSANITY) == RO_DUNGEON_ITEM_LOC_STARTWITH ||
GetRandoSettingValue(RSK_BOSS_KEYSANITY) == RO_DUNGEON_ITEM_LOC_VANILLA ||
GetRandoSettingValue(RSK_BOSS_KEYSANITY) == RO_DUNGEON_ITEM_LOC_OWN_DUNGEON) {
(GetRandoSettingValue(RSK_BOSS_KEYSANITY) == RO_DUNGEON_ITEM_LOC_OWN_DUNGEON &&
GetRandoSettingValue(RSK_SHUFFLE_BOSS_ENTRANCES) == RO_BOSS_ROOM_ENTRANCE_SHUFFLE_OFF)) {
return true;
}
return false;
case RG_GANONS_CASTLE_BOSS_KEY:
if (GetRandoSettingValue(RSK_GANONS_BOSS_KEY) == RO_GANON_BOSS_KEY_VANILLA ||
GetRandoSettingValue(RSK_GANONS_BOSS_KEY) == RO_GANON_BOSS_KEY_OWN_DUNGEON ||
GetRandoSettingValue(RSK_GANONS_BOSS_KEY) == RO_GANON_BOSS_KEY_STARTWITH) {
if (GetRandoSettingValue(RSK_GANONS_BOSS_KEY) == RO_GANON_BOSS_KEY_STARTWITH ||
GetRandoSettingValue(RSK_GANONS_BOSS_KEY) == RO_GANON_BOSS_KEY_VANILLA ||
GetRandoSettingValue(RSK_GANONS_BOSS_KEY) == RO_GANON_BOSS_KEY_OWN_DUNGEON) {
return true;
}
return false;
@ -2436,7 +2444,8 @@ bool Randomizer::IsItemVanilla(RandomizerGet randoGet) {
case RG_ICE_CAVERN_MAP:
if (GetRandoSettingValue(RSK_STARTING_MAPS_COMPASSES) == RO_DUNGEON_ITEM_LOC_STARTWITH ||
GetRandoSettingValue(RSK_STARTING_MAPS_COMPASSES) == RO_DUNGEON_ITEM_LOC_VANILLA ||
GetRandoSettingValue(RSK_STARTING_MAPS_COMPASSES) == RO_DUNGEON_ITEM_LOC_OWN_DUNGEON) {
(GetRandoSettingValue(RSK_STARTING_MAPS_COMPASSES) == RO_DUNGEON_ITEM_LOC_OWN_DUNGEON &&
GetRandoSettingValue(RSK_SHUFFLE_BOSS_ENTRANCES) == RO_BOSS_ROOM_ENTRANCE_SHUFFLE_OFF)) {
return true;
}
return false;
@ -3081,7 +3090,10 @@ void DrawRandoEditor(bool& open) {
}
if (!open) {
CVarSetInteger("gRandomizerSettingsEnabled", 0);
if (CVarGetInteger("gRandomizerSettingsEnabled", 0)) {
CVarClear("gRandomizerSettingsEnabled");
LUS::RequestCvarSaveOnNextTick();
}
return;
}
@ -4361,7 +4373,7 @@ void DrawRandoEditor(bool& open) {
excludedLocationString += ",";
}
CVarSetString("gRandomizeExcludedLocations", excludedLocationString.c_str());
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
ImGui::SameLine();
ImGui::Text(rcObject->rcShortName.c_str());
@ -4402,7 +4414,7 @@ void DrawRandoEditor(bool& open) {
excludedLocationString += ",";
}
CVarSetString("gRandomizeExcludedLocations", excludedLocationString.c_str());
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
ImGui::SameLine();
ImGui::Text(rcObject->rcShortName.c_str());
@ -5443,7 +5455,7 @@ void InitRandoItemTable() {
void InitRando() {
Ship::AddWindow("Randomizer", "Randomizer Settings", DrawRandoEditor);
LUS::AddWindow("Randomizer", "Randomizer Settings", DrawRandoEditor, CVarGetInteger("gRandomizerSettingsEnabled", 0));
Randomizer::CreateCustomMessages();
seedString = (char*)calloc(MAX_SEED_STRING_SIZE, sizeof(char));
InitRandoItemTable();

View file

@ -110,7 +110,10 @@ std::vector<uint32_t> buttons = { BTN_A, BTN_B, BTN_CUP, BTN_CDOWN, BTN_CLEFT,
void DrawCheckTracker(bool& open) {
if (!open) {
CVarSetInteger("gCheckTrackerEnabled", 0);
if (CVarGetInteger("gCheckTrackerEnabled", 0)) {
CVarClear("gCheckTrackerEnabled");
LUS::RequestCvarSaveOnNextTick();
}
return;
}
@ -962,7 +965,10 @@ static const char* buttonStrings[] = { "A Button", "B Button", "C-Up", "C-Down"
"Z Button", "R Button", "Start", "D-Up", "D-Down", "D-Left", "D-Right" };
void DrawCheckTrackerOptions(bool& open) {
if (!open) {
CVarSetInteger("gCheckTrackerSettingsEnabled", 0);
if (CVarGetInteger("gCheckTrackerSettingsEnabled", 0)) {
CVarClear("gCheckTrackerSettingsEnabled");
LUS::RequestCvarSaveOnNextTick();
}
return;
}
@ -1023,8 +1029,8 @@ void DrawCheckTrackerOptions(bool& open) {
}
void InitCheckTracker() {
Ship::AddWindow("Randomizer", "Check Tracker", DrawCheckTracker, CVarGetInteger("gCheckTrackerEnabled", 0) == 1);
Ship::AddWindow("Randomizer", "Check Tracker Settings", DrawCheckTrackerOptions);
LUS::AddWindow("Randomizer", "Check Tracker", DrawCheckTracker, CVarGetInteger("gCheckTrackerEnabled", 0));
LUS::AddWindow("Randomizer", "Check Tracker Settings", DrawCheckTrackerOptions, CVarGetInteger("gCheckTrackerSettingsEnabled", 0));
Color_Background = CVarGetColor("gCheckTrackerBgColor", Color_Bg_Default);
Color_Area_Incomplete_Main = CVarGetColor("gCheckTrackerAreaMainIncompleteColor", Color_Main_Default);
Color_Area_Incomplete_Extra = CVarGetColor("gCheckTrackerAreaExtraIncompleteColor", Color_Area_Incomplete_Extra_Default);
@ -1045,13 +1051,13 @@ void InitCheckTracker() {
Color_Saved_Main = CVarGetColor("gCheckTrackerSavedMainColor", Color_Main_Default);
Color_Saved_Extra = CVarGetColor("gCheckTrackerSavedExtraColor", Color_Saved_Extra_Default);
Ship::RegisterHook<Ship::ControllerRead>([](OSContPad* cont_pad) {
LUS::RegisterHook<LUS::ControllerRead>([](OSContPad* cont_pad) {
trackerButtonsPressed = cont_pad;
});
Ship::RegisterHook<Ship::LoadFile>([](uint32_t fileNum) {
LUS::RegisterHook<LUS::LoadFile>([](uint32_t fileNum) {
doInitialize = true;
});
Ship::RegisterHook<Ship::DeleteFile>([](uint32_t fileNum) {
LUS::RegisterHook<LUS::DeleteFile>([](uint32_t fileNum) {
Teardown();
});
LocationTable_Init();

View file

@ -623,7 +623,10 @@ void InitEntranceTrackingData() {
void DrawEntranceTracker(bool& open) {
if (!open) {
CVarSetInteger("gEntranceTrackerEnabled", 0);
if (CVarGetInteger("gEntranceTrackerEnabled", 0)) {
CVarClear("gEntranceTrackerEnabled");
LUS::RequestCvarSaveOnNextTick();
}
return;
}
@ -919,8 +922,7 @@ void DrawEntranceTracker(bool& open) {
}
void InitEntranceTracker() {
Ship::AddWindow("Randomizer", "Entrance Tracker", DrawEntranceTracker,
CVarGetInteger("gEntranceTrackerEnabled", 0) == 1);
LUS::AddWindow("Randomizer", "Entrance Tracker", DrawEntranceTracker, CVarGetInteger("gEntranceTrackerEnabled", 0));
// Setup hooks for loading and clearing the entrance tracker data
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnLoadGame>([](int32_t fileNum) {

View file

@ -452,7 +452,7 @@ void DrawItemCount(ItemTrackerItem item) {
void DrawEquip(ItemTrackerItem item) {
bool hasEquip = (item.data & gSaveContext.inventory.equipment) != 0;
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36);
ImGui::Image(Ship::GetTextureByName(hasEquip && IsValidSaveFile() ? item.name : item.nameFaded),
ImGui::Image(LUS::GetTextureByName(hasEquip && IsValidSaveFile() ? item.name : item.nameFaded),
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
UIWidgets::SetLastItemHoverText(SohUtils::GetItemName(item.id));
@ -462,7 +462,7 @@ void DrawQuest(ItemTrackerItem item) {
bool hasQuestItem = (item.data & gSaveContext.inventory.questItems) != 0;
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36);
ImGui::BeginGroup();
ImGui::Image(Ship::GetTextureByName(hasQuestItem && IsValidSaveFile() ? item.name : item.nameFaded),
ImGui::Image(LUS::GetTextureByName(hasQuestItem && IsValidSaveFile() ? item.name : item.nameFaded),
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
if (item.id == QUEST_SKULL_TOKEN) {
@ -524,7 +524,7 @@ void DrawItem(ItemTrackerItem item) {
}
ImGui::BeginGroup();
ImGui::Image(Ship::GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded),
ImGui::Image(LUS::GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded),
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
DrawItemCount(item);
@ -542,7 +542,7 @@ void DrawBottle(ItemTrackerItem item) {
}
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36);
ImGui::Image(Ship::GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded),
ImGui::Image(LUS::GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded),
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
UIWidgets::SetLastItemHoverText(SohUtils::GetItemName(item.id));
@ -557,11 +557,11 @@ void DrawDungeonItem(ItemTrackerItem item) {
bool hasSmallKey = (gSaveContext.inventory.dungeonKeys[item.data]) >= 0;
ImGui::BeginGroup();
if (itemId == ITEM_KEY_SMALL) {
ImGui::Image(Ship::GetTextureByName(hasSmallKey && IsValidSaveFile() ? item.name : item.nameFaded),
ImGui::Image(LUS::GetTextureByName(hasSmallKey && IsValidSaveFile() ? item.name : item.nameFaded),
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
}
else {
ImGui::Image(Ship::GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded),
ImGui::Image(LUS::GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded),
ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1));
}
@ -601,7 +601,7 @@ void DrawSong(ItemTrackerItem item) {
bool hasSong = (bitMask & gSaveContext.inventory.questItems) != 0;
ImVec2 p = ImGui::GetCursorScreenPos();
ImGui::SetCursorScreenPos(ImVec2(p.x + 6, p.y));
ImGui::Image(Ship::GetTextureByName(hasSong && IsValidSaveFile() ? item.name : item.nameFaded),
ImGui::Image(LUS::GetTextureByName(hasSong && IsValidSaveFile() ? item.name : item.nameFaded),
ImVec2(iconSize / 1.5, iconSize), ImVec2(0, 0), ImVec2(1, 1));
UIWidgets::SetLastItemHoverText(SohUtils::GetQuestItemName(item.id));
}
@ -637,7 +637,7 @@ void DrawNotes(bool resizeable = false) {
ItemTrackerNotes::TrackerNotesInputTextMultiline("##ItemTrackerNotes", &itemTrackerNotes, size, ImGuiInputTextFlags_AllowTabInput);
if (ImGui::IsItemDeactivatedAfterEdit() && IsValidSaveFile()) {
CVarSetString(("gItemTrackerNotes" + std::to_string(gSaveContext.fileNum)).c_str(), std::string(std::begin(itemTrackerNotes), std::end(itemTrackerNotes)).c_str());
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
ImGui::EndGroup();
}
@ -851,7 +851,10 @@ void UpdateVectors() {
void DrawItemTracker(bool& open) {
UpdateVectors();
if (!open) {
CVarSetInteger("gItemTrackerEnabled", 0);
if (CVarGetInteger("gItemTrackerEnabled", 0)) {
CVarClear("gItemTrackerEnabled");
LUS::RequestCvarSaveOnNextTick();
}
return;
}
int iconSize = CVarGetInteger("gItemTrackerIconSize", 36);
@ -959,7 +962,10 @@ static const char* extendedDisplayTypes[4] = { "Hidden", "Main Window", "Misc Wi
void DrawItemTrackerOptions(bool& open) {
if (!open) {
CVarSetInteger("gItemTrackerSettingsEnabled", 0);
if (CVarGetInteger("gItemTrackerSettingsEnabled", 0)) {
CVarClear("gItemTrackerSettingsEnabled");
LUS::RequestCvarSaveOnNextTick();
}
return;
}
@ -985,7 +991,7 @@ void DrawItemTrackerOptions(bool& open) {
CVarSetFloat("gItemTrackerBgColorG", ChromaKeyBackground.y);
CVarSetFloat("gItemTrackerBgColorB", ChromaKeyBackground.z);
CVarSetFloat("gItemTrackerBgColorA", ChromaKeyBackground.w);
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
ImGui::PopItemWidth();
@ -1081,8 +1087,8 @@ void DrawItemTrackerOptions(bool& open) {
}
void InitItemTracker() {
Ship::AddWindow("Randomizer", "Item Tracker", DrawItemTracker, CVarGetInteger("gItemTrackerEnabled", 0) == 1);
Ship::AddWindow("Randomizer", "Item Tracker Settings", DrawItemTrackerOptions);
LUS::AddWindow("Randomizer", "Item Tracker", DrawItemTracker, CVarGetInteger("gItemTrackerEnabled", 0));
LUS::AddWindow("Randomizer", "Item Tracker Settings", DrawItemTrackerOptions, CVarGetInteger("gItemTrackerSettingsEnabled", 0));
float trackerBgR = CVarGetFloat("gItemTrackerBgColorR", 0);
float trackerBgG = CVarGetFloat("gItemTrackerBgColorG", 0);
float trackerBgB = CVarGetFloat("gItemTrackerBgColorB", 0);
@ -1097,16 +1103,16 @@ void InitItemTracker() {
if (itemTrackerNotes.empty()) {
itemTrackerNotes.push_back(0);
}
Ship::RegisterHook<Ship::ControllerRead>([](OSContPad* cont_pad) {
LUS::RegisterHook<LUS::ControllerRead>([](OSContPad* cont_pad) {
buttonsPressed = cont_pad;
});
Ship::RegisterHook<Ship::LoadFile>([](uint32_t fileNum) {
LUS::RegisterHook<LUS::LoadFile>([](uint32_t fileNum) {
const char* initialTrackerNotes = CVarGetString(("gItemTrackerNotes" + std::to_string(fileNum)).c_str(), "");
itemTrackerNotes.resize(strlen(initialTrackerNotes) + 1);
strcpy(itemTrackerNotes.Data, initialTrackerNotes);
});
Ship::RegisterHook<Ship::DeleteFile>([](uint32_t fileNum) {
LUS::RegisterHook<LUS::DeleteFile>([](uint32_t fileNum) {
CVarSetString(("gItemTrackerNotes" + std::to_string(fileNum)).c_str(), "");
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
});
}

View file

@ -837,7 +837,7 @@ extern "C" void ProcessSaveStateRequests(void) {
}
void SaveStateMgr::SetCurrentSlot(unsigned int slot) {
Ship::GetGameOverlay()->TextDrawNotification(1.0f, true, "slot %u set", slot);
LUS::GetGameOverlay()->TextDrawNotification(1.0f, true, "slot %u set", slot);
this->currentSlot = slot;
}
@ -855,12 +855,12 @@ void SaveStateMgr::ProcessSaveStateRequests(void) {
this->states[request.slot] = std::make_shared<SaveState>(OTRGlobals::Instance->gSaveStateMgr, request.slot);
}
this->states[request.slot]->Save();
Ship::GetGameOverlay()->TextDrawNotification(1.0f, true, "saved state %u", request.slot);
LUS::GetGameOverlay()->TextDrawNotification(1.0f, true, "saved state %u", request.slot);
break;
case RequestType::LOAD:
if (this->states.contains(request.slot)) {
this->states[request.slot]->Load();
Ship::GetGameOverlay()->TextDrawNotification(1.0f, true, "loaded state %u", request.slot);
LUS::GetGameOverlay()->TextDrawNotification(1.0f, true, "loaded state %u", request.slot);
} else {
SPDLOG_ERROR("Invalid SaveState slot: {}", request.type);
}
@ -876,7 +876,7 @@ void SaveStateMgr::ProcessSaveStateRequests(void) {
SaveStateReturn SaveStateMgr::AddRequest(const SaveStateRequest request) {
if (gPlayState == nullptr) {
SPDLOG_ERROR("[SOH] Can not save or load a state outside of \"GamePlay\"");
Ship::GetGameOverlay()->TextDrawNotification(1.0f, true, "states not available here", request.slot);
LUS::GetGameOverlay()->TextDrawNotification(1.0f, true, "states not available here", request.slot);
return SaveStateReturn::FAIL_WRONG_GAMESTATE;
}
@ -890,7 +890,7 @@ SaveStateReturn SaveStateMgr::AddRequest(const SaveStateRequest request) {
return SaveStateReturn::SUCCESS;
} else {
SPDLOG_ERROR("Invalid SaveState slot: {}", request.type);
Ship::GetGameOverlay()->TextDrawNotification(1.0f, true, "state slot %u empty", request.slot);
LUS::GetGameOverlay()->TextDrawNotification(1.0f, true, "state slot %u empty", request.slot);
return SaveStateReturn::FAIL_INVALID_SLOT;
}
[[unlikely]] default:

View file

@ -681,22 +681,22 @@ void InitTTSBank() {
break;
}
auto sceneFile = OTRGlobals::Instance->context->GetResourceManager()->LoadFile("accessibility/texts/scenes" + languageSuffix);
auto sceneFile = LUS::Context::GetInstance()->GetResourceManager()->LoadFile("accessibility/texts/scenes" + languageSuffix);
if (sceneFile != nullptr) {
sceneMap = nlohmann::json::parse(sceneFile->Buffer, nullptr, true, true);
}
auto miscFile = OTRGlobals::Instance->context->GetResourceManager()->LoadFile("accessibility/texts/misc" + languageSuffix);
auto miscFile = LUS::Context::GetInstance()->GetResourceManager()->LoadFile("accessibility/texts/misc" + languageSuffix);
if (miscFile != nullptr) {
miscMap = nlohmann::json::parse(miscFile->Buffer, nullptr, true, true);
}
auto kaleidoFile = OTRGlobals::Instance->context->GetResourceManager()->LoadFile("accessibility/texts/kaleidoscope" + languageSuffix);
auto kaleidoFile = LUS::Context::GetInstance()->GetResourceManager()->LoadFile("accessibility/texts/kaleidoscope" + languageSuffix);
if (kaleidoFile != nullptr) {
kaleidoMap = nlohmann::json::parse(kaleidoFile->Buffer, nullptr, true, true);
}
auto fileChooseFile = OTRGlobals::Instance->context->GetResourceManager()->LoadFile("accessibility/texts/filechoose" + languageSuffix);
auto fileChooseFile = LUS::Context::GetInstance()->GetResourceManager()->LoadFile("accessibility/texts/filechoose" + languageSuffix);
if (fileChooseFile != nullptr) {
fileChooseMap = nlohmann::json::parse(fileChooseFile->Buffer, nullptr, true, true);
}

View file

@ -54,10 +54,10 @@ static constexpr uint32_t OOT_PAL_GC_DBG2 = 0x87121EFE; // 03-13-2002 build
static constexpr uint32_t OOT_PAL_GC_MQ_DBG = 0x917D18F6;
static const std::unordered_map<uint32_t, const char*> verMap = {
{ OOT_PAL_GC, "Pal Gamecube" },
{ OOT_PAL_GC_DBG1, "PAL Debug 1" },
{ OOT_PAL_GC_DBG2, "PAL Debug 2" },
{ OOT_PAL_GC_MQ_DBG, "PAL MQ Debug" },
{ OOT_PAL_GC, "PAL GameCube" },
{ OOT_PAL_GC_DBG1, "PAL GameCube Debug 1" },
{ OOT_PAL_GC_DBG2, "PAL GameCube Debug 2" },
{ OOT_PAL_GC_MQ_DBG, "PAL GameCube MQ Debug" },
};
// TODO only check the first 54MB of the rom.
@ -156,6 +156,40 @@ void Extractor::SetRomInfo(const std::string& path) {
mCurRomSize = GetCurRomSize();
}
void Extractor::FilterRoms(std::vector<std::string>& roms, RomSearchMode searchMode) {
std::ifstream inFile;
std::vector<std::string>::iterator it = roms.begin();
while (it != roms.end()) {
std::string rom = *it;
SetRomInfo(rom);
// Skip. We will handle rom size errors later on after filtering
if (!ValidateRomSize()) {
it++;
continue;
}
inFile.open(rom, std::ios::in | std::ios::binary);
inFile.read((char*)mRomData.get(), mCurRomSize);
inFile.clear();
inFile.close();
RomToBigEndian(mRomData.get(), mCurRomSize);
// Rom doesn't claim to be valid
// Game type doesn't match search mode
if (!verMap.contains(GetRomVerCrc()) ||
(searchMode == RomSearchMode::Vanilla && IsMasterQuest()) ||
(searchMode == RomSearchMode::MQ && !IsMasterQuest())) {
it = roms.erase(it);
continue;
}
it++;
}
}
void Extractor::GetRoms(std::vector<std::string>& roms) {
#ifdef _WIN32
WIN32_FIND_DATAA ffd;
@ -258,6 +292,7 @@ bool Extractor::GetRomPathFromBox() {
mCurRomSize = GetCurRomSize();
return true;
}
uint32_t Extractor::GetRomVerCrc() const {
return BSWAP32(((uint32_t*)mRomData.get())[4]);
}
@ -303,28 +338,73 @@ bool Extractor::ValidateRom(bool skipCrcTextBox) {
return true;
}
bool Extractor::Run() {
bool Extractor::ManuallySearchForRom() {
std::ifstream inFile;
if (!GetRomPathFromBox()) {
ShowErrorBox("No rom selected", "No Rom selected. Exiting");
return false;
}
inFile.open(mCurrentRomPath, std::ios::in | std::ios::binary);
if (!inFile.is_open()) {
return false; // TODO Handle error
}
inFile.read((char*)mRomData.get(), mCurRomSize);
inFile.close();
RomToBigEndian(mRomData.get(), mCurRomSize);
if (!ValidateRom()) {
return false;
}
return true;
}
bool Extractor::ManuallySearchForRomMatchingType(RomSearchMode searchMode) {
if (!ManuallySearchForRom()) {
return false;
}
char msgBuf[150];
snprintf(msgBuf, 150, "The selected rom does not match the expected game type\nExpected type: %s.\n\nDo you want to search again?",
searchMode == RomSearchMode::MQ ? "Master Quest" : "Vanilla");
while ((searchMode == RomSearchMode::Vanilla && IsMasterQuest()) ||
(searchMode == RomSearchMode::MQ && !IsMasterQuest())) {
int ret = ShowYesNoBox("Wrong Game Type", msgBuf);
switch (ret) {
case IDYES:
if (!ManuallySearchForRom()) {
return false;
}
continue;
case IDNO:
return false;
default:
UNREACHABLE;
break;
}
}
return true;
}
bool Extractor::Run(RomSearchMode searchMode) {
std::vector<std::string> roms;
std::ifstream inFile;
uint32_t verCrc;
GetRoms(roms);
FilterRoms(roms, searchMode);
if (roms.empty()) {
int ret = ShowYesNoBox("No roms found", "No roms found. Look for one?");
switch (ret) {
case IDYES:
if (!GetRomPathFromBox()) {
ShowErrorBox("No rom selected", "No rom selected. Exiting");
return false;
}
inFile.open(mCurrentRomPath, std::ios::in | std::ios::binary);
if (!inFile.is_open()) {
return false; // TODO Handle error
}
inFile.read((char*)mRomData.get(), mCurRomSize);
if (!ValidateRom()) {
if (!ManuallySearchForRomMatchingType(searchMode)) {
return false;
}
break;
@ -338,27 +418,21 @@ bool Extractor::Run() {
}
for (const auto& rom : roms) {
int option;
SetRomInfo(rom);
if (inFile.is_open()) {
inFile.close();
}
inFile.open(rom, std::ios::in | std::ios::binary);
if (!ValidateRomSize()) {
ShowSizeErrorBox();
continue;
}
inFile.open(rom, std::ios::in | std::ios::binary);
inFile.read((char*)mRomData.get(), mCurRomSize);
inFile.clear();
inFile.close();
RomToBigEndian(mRomData.get(), mCurRomSize);
verCrc = GetRomVerCrc();
// Rom doesn't claim to be valid
if (!verMap.contains(verCrc)) {
continue;
}
int option = ShowRomPickBox(GetRomVerCrc());
option = ShowRomPickBox(verCrc);
if (option == (int)ButtonId::YES) {
if (!ValidateRom(true)) {
if (rom == roms.back()) {
@ -371,21 +445,11 @@ bool Extractor::Run() {
}
break;
} else if (option == (int)ButtonId::FIND) {
if (!GetRomPathFromBox()) {
ShowErrorBox("No rom selected", "No Rom selected. Exiting");
return false;
}
inFile.open(mCurrentRomPath, std::ios::in | std::ios::binary);
if (!inFile.is_open()) {
return false; // TODO Handle error
}
inFile.read((char*)mRomData.get(), mCurRomSize);
if (!ValidateRom()) {
if (!ManuallySearchForRomMatchingType(searchMode)) {
return false;
}
break;
} else if (option == (int)ButtonId::NO) {
inFile.close();
if (rom == roms.back()) {
ShowErrorBox("No rom provided", "No rom provided. Exiting");
return false;

View file

@ -19,6 +19,12 @@ static constexpr size_t MB32 = 32 * MB_BASE;
static constexpr size_t MB54 = 54 * MB_BASE;
static constexpr size_t MB64 = 64 * MB_BASE;
enum class RomSearchMode {
Both = 0,
Vanilla = 1,
MQ = 2,
};
class Extractor {
std::unique_ptr<unsigned char[]> mRomData = std::make_unique<unsigned char[]>(MB64);
std::string mCurrentRomPath;
@ -33,21 +39,24 @@ class Extractor {
bool ValidateRom(bool skipCrcBox = false);
const char* GetZapdVerStr() const;
bool IsMasterQuest() const;
void SetRomInfo(const std::string& path);
void FilterRoms(std::vector<std::string>& roms, RomSearchMode searchMode);
void GetRoms(std::vector<std::string>& roms);
void ShowSizeErrorBox() const;
void ShowCrcErrorBox() const;
int ShowRomPickBox(uint32_t verCrc) const;
bool ManuallySearchForRom();
bool ManuallySearchForRomMatchingType(RomSearchMode searchMode);
public:
//TODO create some kind of abstraction for message boxes.
static int ShowYesNoBox(const char* title, const char* text);
static void ShowErrorBox(const char* title, const char* text);
bool IsMasterQuest() const;
bool Run();
bool Run(RomSearchMode searchMode = RomSearchMode::Both);
bool CallZapd();
const char* GetZapdStr();
};

View file

@ -12,7 +12,7 @@
#define IMGUI_DEFINE_MATH_OPERATORS
#include <ImGui/imgui_internal.h>
#include <ImGuiImpl.h>
#include <libultraship/bridge.h>
#include <libultraship/libultraship.h>
#include <Hooks.h>
#include <libultraship/libultra/types.h>
#include <libultraship/libultra/pi.h>
@ -108,8 +108,8 @@ namespace GameMenuBar {
// MARK: - Delegates
void SetupHooks() {
Ship::RegisterHook<Ship::AudioInit>(UpdateAudio);
Ship::RegisterHook<Ship::GfxInit>(UpdateAudio);
LUS::RegisterHook<LUS::AudioInit>(UpdateAudio);
LUS::RegisterHook<LUS::GfxInit>(UpdateAudio);
}
void Draw() {
@ -131,8 +131,8 @@ namespace GameMenuBar {
}
ImGui::Text("Audio API (Needs reload)");
auto audioBackends = Ship::GetAvailableAudioBackends();
auto currentAudioBackend = Ship::GetCurrentAudioBackend();
auto audioBackends = LUS::GetAvailableAudioBackends();
auto currentAudioBackend = LUS::GetCurrentAudioBackend();
if (audioBackends.size() <= 1) {
UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f);
@ -140,7 +140,7 @@ namespace GameMenuBar {
if (ImGui::BeginCombo("##AApi", currentAudioBackend.second)) {
for (uint8_t i = 0; i < audioBackends.size(); i++) {
if (ImGui::Selectable(audioBackends[i].second, audioBackends[i] == currentAudioBackend)) {
Ship::SetCurrentAudioBackend(i, audioBackends[i]);
LUS::SetCurrentAudioBackend(i, audioBackends[i]);
}
}
@ -162,10 +162,13 @@ namespace GameMenuBar {
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.22f, 0.38f, 0.56f, 1.0f));
if (ImGui::Button(GetWindowButtonText("Controller Configuration", CVarGetInteger("gControllerConfigurationEnabled", 0)).c_str(), ImVec2 (-1.0f, 0.0f)))
{
bool currentValue = CVarGetInteger("gControllerConfigurationEnabled", 0);
CVarSetInteger("gControllerConfigurationEnabled", !currentValue);
Ship::RequestCvarSaveOnNextTick();
Ship::ToggleInputEditorWindow(CVarGetInteger("gControllerConfigurationEnabled", 0));
if (CVarGetInteger("gControllerConfigurationEnabled", 0)) {
CVarClear("gControllerConfigurationEnabled");
} else {
CVarSetInteger("gControllerConfigurationEnabled", 1);
}
LUS::RequestCvarSaveOnNextTick();
LUS::ToggleInputEditorWindow(CVarGetInteger("gControllerConfigurationEnabled", 0));
}
UIWidgets::PaddedSeparator();
ImGui::PopStyleColor(1);
@ -190,21 +193,21 @@ namespace GameMenuBar {
#ifndef __APPLE__
UIWidgets::EnhancementSliderFloat("Internal Resolution: %d %%", "##IMul", "gInternalResolution", 0.5f, 2.0f, "", 1.0f, true);
UIWidgets::Tooltip("Multiplies your output resolution by the value inputted, as a more intensive but effective form of anti-aliasing");
Ship::SetResolutionMultiplier(CVarGetFloat("gInternalResolution", 1));
LUS::SetResolutionMultiplier(CVarGetFloat("gInternalResolution", 1));
#endif
#ifndef __WIIU__
UIWidgets::PaddedEnhancementSliderInt("MSAA: %d", "##IMSAA", "gMSAAValue", 1, 8, "", 1, true, true, false);
UIWidgets::Tooltip("Activates multi-sample anti-aliasing when above 1x up to 8x for 8 samples for every pixel");
Ship::SetMSAALevel(CVarGetInteger("gMSAAValue", 1));
LUS::SetMSAALevel(CVarGetInteger("gMSAAValue", 1));
#endif
{ // FPS Slider
const int minFps = 20;
static int maxFps;
if (Ship::WindowBackend() == Ship::Backend::DX11) {
if (LUS::WindowBackend() == LUS::Backend::DX11) {
maxFps = 360;
} else {
maxFps = Ship::Window::GetInstance()->GetCurrentRefreshRate();
maxFps = LUS::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate();
}
int currentFps = fmax(fmin(OTRGlobals::Instance->GetInterpolationFPS(), maxFps), minFps);
#ifdef __WIIU__
@ -264,15 +267,15 @@ namespace GameMenuBar {
currentFps = 60;
}
CVarSetInteger("gInterpolationFPS", currentFps);
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
#else
bool matchingRefreshRate =
CVarGetInteger("gMatchRefreshRate", 0) && Ship::WindowBackend() != Ship::Backend::DX11;
CVarGetInteger("gMatchRefreshRate", 0) && LUS::WindowBackend() != LUS::Backend::DX11;
UIWidgets::PaddedEnhancementSliderInt(
(currentFps == 20) ? "FPS: Original (20)" : "FPS: %d",
"##FPSInterpolation", "gInterpolationFPS", minFps, maxFps, "", 20, true, true, false, matchingRefreshRate);
#endif
if (Ship::WindowBackend() == Ship::Backend::DX11) {
if (LUS::WindowBackend() == LUS::Backend::DX11) {
UIWidgets::Tooltip(
"Uses Matrix Interpolation to create extra frames, resulting in smoother graphics. This is purely "
"visual and does not impact game logic, execution of glitches etc.\n\n"
@ -286,13 +289,13 @@ namespace GameMenuBar {
}
} // END FPS Slider
if (Ship::WindowBackend() == Ship::Backend::DX11) {
if (LUS::WindowBackend() == LUS::Backend::DX11) {
UIWidgets::Spacer(0);
if (ImGui::Button("Match Refresh Rate")) {
int hz = Ship::Window::GetInstance()->GetCurrentRefreshRate();
int hz = LUS::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate();
if (hz >= 20 && hz <= 360) {
CVarSetInteger("gInterpolationFPS", hz);
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
}
} else {
@ -300,7 +303,7 @@ namespace GameMenuBar {
}
UIWidgets::Tooltip("Matches interpolation value to the current game's window refresh rate");
if (Ship::WindowBackend() == Ship::Backend::DX11) {
if (LUS::WindowBackend() == LUS::Backend::DX11) {
UIWidgets::PaddedEnhancementSliderInt(CVarGetInteger("gExtraLatencyThreshold", 80) == 0 ? "Jitter fix: Off" : "Jitter fix: >= %d FPS",
"##ExtraLatencyThreshold", "gExtraLatencyThreshold", 0, 360, "", 80, true, true, false);
UIWidgets::Tooltip("When Interpolation FPS setting is at least this threshold, add one frame of input lag (e.g. 16.6 ms for 60 FPS) in order to avoid jitter. This setting allows the CPU to work on one frame while GPU works on the previous frame.\nThis setting should be used when your computer is too slow to do CPU + GPU work in time.");
@ -309,8 +312,8 @@ namespace GameMenuBar {
UIWidgets::PaddedSeparator(true, true, 3.0f, 3.0f);
ImGui::Text("Renderer API (Needs reload)");
auto renderingBackends = Ship::GetAvailableRenderingBackends();
auto currentRenderingBackend = Ship::GetCurrentRenderingBackend();
auto renderingBackends = LUS::GetAvailableRenderingBackends();
auto currentRenderingBackend = LUS::GetCurrentRenderingBackend();
if (renderingBackends.size() <= 1) {
UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f);
@ -318,7 +321,7 @@ namespace GameMenuBar {
if (ImGui::BeginCombo("##RApi", currentRenderingBackend.second)) {
for (uint8_t i = 0; i < renderingBackends.size(); i++) {
if (ImGui::Selectable(renderingBackends[i].second, renderingBackends[i] == currentRenderingBackend)) {
Ship::SetCurrentRenderingBackend(i, renderingBackends[i]);
LUS::SetCurrentRenderingBackend(i, renderingBackends[i]);
}
}
@ -328,28 +331,28 @@ namespace GameMenuBar {
UIWidgets::ReEnableComponent("");
}
if (Ship::Window::GetInstance()->CanDisableVerticalSync()) {
if (LUS::Context::GetInstance()->GetWindow()->CanDisableVerticalSync()) {
UIWidgets::PaddedEnhancementCheckbox("Enable Vsync", "gVsyncEnabled", true, false);
}
if (Ship::SupportsWindowedFullscreen()) {
if (LUS::SupportsWindowedFullscreen()) {
UIWidgets::PaddedEnhancementCheckbox("Windowed fullscreen", "gSdlWindowedFullscreen", true, false);
}
if (Ship::SupportsViewports()) {
UIWidgets::PaddedEnhancementCheckbox("Allow multi-windows", "gEnableMultiViewports", true, false);
if (LUS::SupportsViewports()) {
UIWidgets::PaddedEnhancementCheckbox("Allow multi-windows", "gEnableMultiViewports", true, false, false, "", UIWidgets::CheckboxGraphics::Cross, true);
UIWidgets::Tooltip("Allows windows to be able to be dragged off of the main game window. Requires a reload to take effect.");
}
// If more filters are added to LUS, make sure to add them to the filters list here
ImGui::Text("Texture Filter (Needs reload)");
const char* filters[] = { Ship::GetSupportedTextureFilters()[0], Ship::GetSupportedTextureFilters()[1],
Ship::GetSupportedTextureFilters()[2] };
const char* filters[] = { LUS::GetSupportedTextureFilters()[0], LUS::GetSupportedTextureFilters()[1],
LUS::GetSupportedTextureFilters()[2] };
UIWidgets::EnhancementCombobox("gTextureFilter", filters, 0);
UIWidgets::Spacer(0);
Ship::DrawSettings();
LUS::DrawSettings();
ImGui::EndMenu();
}
@ -887,11 +890,13 @@ namespace GameMenuBar {
UIWidgets::Tooltip("Correctly centers the Navi text prompt on the HUD's C-Up button");
UIWidgets::PaddedEnhancementCheckbox("Fix Anubis fireballs", "gAnubisFix", true, false);
UIWidgets::Tooltip("Make Anubis fireballs do fire damage when reflected back at them with the Mirror Shield");
UIWidgets::PaddedEnhancementCheckbox("Fix Megaton Hammer crouch stab", "gCrouchStabHammerFix", true, false);
if (UIWidgets::PaddedEnhancementCheckbox("Fix Megaton Hammer crouch stab", "gCrouchStabHammerFix", true, false)) {
if (!CVarGetInteger("gCrouchStabHammerFix", 0)) {
CVarClear("gCrouchStabFix");
}
}
UIWidgets::Tooltip("Make the Megaton Hammer's crouch stab able to destroy rocks without first swinging it normally");
if (CVarGetInteger("gCrouchStabHammerFix", 0) == 0) {
CVarSetInteger("gCrouchStabFix", 0);
} else {
if (CVarGetInteger("gCrouchStabHammerFix", 0)) {
UIWidgets::PaddedEnhancementCheckbox("Remove power crouch stab", "gCrouchStabFix", true, false);
UIWidgets::Tooltip("Make crouch stabbing always do the same damage as a regular slash");
}
@ -980,30 +985,42 @@ namespace GameMenuBar {
if (ImGui::Button(GetWindowButtonText("Customize Game Controls", CVarGetInteger("gGameControlEditorEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f)))
{
bool currentValue = CVarGetInteger("gGameControlEditorEnabled", 0);
CVarSetInteger("gGameControlEditorEnabled", !currentValue);
Ship::RequestCvarSaveOnNextTick();
Ship::EnableWindow("Game Control Editor", CVarGetInteger("gGameControlEditorEnabled", 0));
if (CVarGetInteger("gGameControlEditorEnabled", 0)) {
CVarClear("gGameControlEditorEnabled");
} else {
CVarSetInteger("gGameControlEditorEnabled", 1);
}
LUS::RequestCvarSaveOnNextTick();
LUS::EnableWindow("Game Control Editor", CVarGetInteger("gGameControlEditorEnabled", 0));
}
if (ImGui::Button(GetWindowButtonText("Cosmetics Editor", CVarGetInteger("gCosmeticsEditorEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f)))
{
bool currentValue = CVarGetInteger("gCosmeticsEditorEnabled", 0);
CVarSetInteger("gCosmeticsEditorEnabled", !currentValue);
Ship::RequestCvarSaveOnNextTick();
Ship::EnableWindow("Cosmetics Editor", CVarGetInteger("gCosmeticsEditorEnabled", 0));
if (CVarGetInteger("gCosmeticsEditorEnabled", 0)) {
CVarClear("gCosmeticsEditorEnabled");
} else {
CVarSetInteger("gCosmeticsEditorEnabled", 1);
}
LUS::RequestCvarSaveOnNextTick();
LUS::EnableWindow("Cosmetics Editor", CVarGetInteger("gCosmeticsEditorEnabled", 0));
}
if (ImGui::Button(GetWindowButtonText("Audio Editor", CVarGetInteger("gAudioEditor.WindowOpen", 0)).c_str(), ImVec2(-1.0f, 0.0f)))
{
bool currentValue = CVarGetInteger("gAudioEditor.WindowOpen", 0);
CVarSetInteger("gAudioEditor.WindowOpen", !currentValue);
Ship::RequestCvarSaveOnNextTick();
Ship::EnableWindow("Audio Editor", CVarGetInteger("gAudioEditor.WindowOpen", 0));
if (CVarGetInteger("gAudioEditor.WindowOpen", 0)) {
CVarClear("gAudioEditor.WindowOpen");
} else {
CVarSetInteger("gAudioEditor.WindowOpen", 1);
}
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))) {
bool currentValue = CVarGetInteger("gGameplayStatsEnabled", 0);
CVarSetInteger("gGameplayStatsEnabled", !currentValue);
Ship::RequestCvarSaveOnNextTick();
Ship::EnableWindow("Gameplay Stats", CVarGetInteger("gGameplayStatsEnabled", 0));
if (CVarGetInteger("gGameplayStatsEnabled", 0)) {
CVarClear("gGameplayStatsEnabled");
} else {
CVarSetInteger("gGameplayStatsEnabled", 1);
}
LUS::RequestCvarSaveOnNextTick();
LUS::EnableWindow("Gameplay Stats", CVarGetInteger("gGameplayStatsEnabled", 0));
}
ImGui::PopStyleVar(3);
ImGui::PopStyleColor(1);
@ -1011,9 +1028,9 @@ namespace GameMenuBar {
#ifdef __SWITCH__
UIWidgets::Spacer(0);
ImGui::Text("Switch performance mode");
if (UIWidgets::EnhancementCombobox("gSwitchPerfMode", SWITCH_CPU_PROFILES, (int)Ship::SwitchProfiles::STOCK)) {
SPDLOG_INFO("Profile:: %s", SWITCH_CPU_PROFILES[CVarGetInteger("gSwitchPerfMode", (int)Ship::SwitchProfiles::STOCK)]);
Ship::Switch::ApplyOverclock();
if (UIWidgets::EnhancementCombobox("gSwitchPerfMode", SWITCH_CPU_PROFILES, (int)LUS::SwitchProfiles::STOCK)) {
SPDLOG_INFO("Profile:: %s", SWITCH_CPU_PROFILES[CVarGetInteger("gSwitchPerfMode", (int)LUS::SwitchProfiles::STOCK)]);
LUS::Switch::ApplyOverclock();
}
#endif
@ -1114,7 +1131,7 @@ namespace GameMenuBar {
}
else {
lastBetaQuestWorld = betaQuestWorld = 0xFFEF;
CVarSetInteger("gBetaQuestWorld", betaQuestWorld);
CVarClear("gBetaQuestWorld");
}
if (betaQuestEnabled != lastBetaQuestEnabled || betaQuestWorld != lastBetaQuestWorld)
{
@ -1124,9 +1141,9 @@ namespace GameMenuBar {
CVarSetInteger("gEnableBetaQuest", betaQuestEnabled);
CVarSetInteger("gBetaQuestWorld", betaQuestWorld);
Ship::DispatchConsoleCommand("reset");
LUS::DispatchConsoleCommand("reset");
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
if (!isBetaQuestEnabled) {
@ -1158,7 +1175,7 @@ namespace GameMenuBar {
};
UIWidgets::PaddedEnhancementCheckbox("Better Debug Warp Screen", "gBetterDebugWarpScreen", true, false);
UIWidgets::Tooltip("Optimized debug warp screen, with the added ability to chose entrances and time of day");
UIWidgets::PaddedEnhancementCheckbox("Debug Warp Screen Translation", "gDebugWarpScreenTranslation", true, false);
UIWidgets::PaddedEnhancementCheckbox("Debug Warp Screen Translation", "gDebugWarpScreenTranslation", true, false, false, "", UIWidgets::CheckboxGraphics::Cross, true);
UIWidgets::Tooltip("Translate the Debug Warp Screen based on the game language");
UIWidgets::PaddedSeparator();
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(12.0f, 6.0f));
@ -1167,52 +1184,70 @@ namespace GameMenuBar {
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.22f, 0.38f, 0.56f, 1.0f));
if (ImGui::Button(GetWindowButtonText("Stats", CVarGetInteger("gStatsEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f)))
{
bool currentValue = CVarGetInteger("gStatsEnabled", 0);
CVarSetInteger("gStatsEnabled", !currentValue);
Ship::ToggleStatisticsWindow(true);
Ship::RequestCvarSaveOnNextTick();
if (CVarGetInteger("gStatsEnabled", 0)) {
CVarClear("gStatsEnabled");
} else {
CVarSetInteger("gStatsEnabled", 1);
}
LUS::ToggleStatisticsWindow(CVarGetInteger("gStatsEnabled", 0));
LUS::RequestCvarSaveOnNextTick();
}
UIWidgets::Tooltip("Shows the stats window, with your FPS and frametimes, and the OS you're playing on");
UIWidgets::Spacer(0);
if (ImGui::Button(GetWindowButtonText("Console", CVarGetInteger("gConsoleEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f)))
{
bool currentValue = CVarGetInteger("gConsoleEnabled", 0);
CVarSetInteger("gConsoleEnabled", !currentValue);
Ship::RequestCvarSaveOnNextTick();
Ship::ToggleConsoleWindow(!currentValue);
if (CVarGetInteger("gConsoleEnabled", 0)) {
CVarClear("gConsoleEnabled");
} else {
CVarSetInteger("gConsoleEnabled", 1);
}
LUS::RequestCvarSaveOnNextTick();
LUS::ToggleConsoleWindow(CVarGetInteger("gConsoleEnabled", 0));
}
UIWidgets::Tooltip("Enables the console window, allowing you to input commands, type help for some examples");
UIWidgets::Spacer(0);
if (ImGui::Button(GetWindowButtonText("Save Editor", CVarGetInteger("gSaveEditorEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f)))
{
bool currentValue = CVarGetInteger("gSaveEditorEnabled", 0);
CVarSetInteger("gSaveEditorEnabled", !currentValue);
Ship::RequestCvarSaveOnNextTick();
Ship::EnableWindow("Save Editor", CVarGetInteger("gSaveEditorEnabled", 0));
if (CVarGetInteger("gSaveEditorEnabled", 0)) {
CVarClear("gSaveEditorEnabled");
} else {
CVarSetInteger("gSaveEditorEnabled", 1);
}
LUS::RequestCvarSaveOnNextTick();
LUS::EnableWindow("Save Editor", CVarGetInteger("gSaveEditorEnabled", 0));
}
UIWidgets::Spacer(0);
if (ImGui::Button(GetWindowButtonText("Collision Viewer", CVarGetInteger("gCollisionViewerEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f)))
{
bool currentValue = CVarGetInteger("gCollisionViewerEnabled", 0);
CVarSetInteger("gCollisionViewerEnabled", !currentValue);
Ship::RequestCvarSaveOnNextTick();
Ship::EnableWindow("Collision Viewer", CVarGetInteger("gCollisionViewerEnabled", 0));
if (CVarGetInteger("gCollisionViewerEnabled", 0)) {
CVarClear("gCollisionViewerEnabled");
} else {
CVarSetInteger("gCollisionViewerEnabled", 1);
}
LUS::RequestCvarSaveOnNextTick();
LUS::EnableWindow("Collision Viewer", CVarGetInteger("gCollisionViewerEnabled", 0));
}
UIWidgets::Spacer(0);
if (ImGui::Button(GetWindowButtonText("Actor Viewer", CVarGetInteger("gActorViewerEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f)))
{
bool currentValue = CVarGetInteger("gActorViewerEnabled", 0);
CVarSetInteger("gActorViewerEnabled", !currentValue);
Ship::RequestCvarSaveOnNextTick();
Ship::EnableWindow("Actor Viewer", CVarGetInteger("gActorViewerEnabled", 0));
if (CVarGetInteger("gActorViewerEnabled", 0)) {
CVarClear("gActorViewerEnabled");
} else {
CVarSetInteger("gActorViewerEnabled", 1);
}
LUS::RequestCvarSaveOnNextTick();
LUS::EnableWindow("Actor Viewer", CVarGetInteger("gActorViewerEnabled", 0));
}
UIWidgets::Spacer(0);
if (ImGui::Button(GetWindowButtonText("Display List Viewer", CVarGetInteger("gDLViewerEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f)))
{
bool currentValue = CVarGetInteger("gDLViewerEnabled", 0);
CVarSetInteger("gDLViewerEnabled", !currentValue);
Ship::RequestCvarSaveOnNextTick();
Ship::EnableWindow("Display List Viewer", CVarGetInteger("gDLViewerEnabled", 0));
if (CVarGetInteger("gDLViewerEnabled", 0)) {
CVarClear("gDLViewerEnabled");
} else {
CVarSetInteger("gDLViewerEnabled", 1);
}
LUS::RequestCvarSaveOnNextTick();
LUS::EnableWindow("Display List Viewer", CVarGetInteger("gDLViewerEnabled", 0));
}
ImGui::PopStyleVar(3);
ImGui::PopStyleColor(1);
@ -1235,50 +1270,68 @@ namespace GameMenuBar {
#endif
if (ImGui::Button(GetWindowButtonText("Randomizer Settings", CVarGetInteger("gRandomizerSettingsEnabled", 0)).c_str(), buttonSize))
{
bool currentValue = CVarGetInteger("gRandomizerSettingsEnabled", 0);
CVarSetInteger("gRandomizerSettingsEnabled", !currentValue);
Ship::RequestCvarSaveOnNextTick();
Ship::EnableWindow("Randomizer Settings", CVarGetInteger("gRandomizerSettingsEnabled", 0));
if (CVarGetInteger("gRandomizerSettingsEnabled", 0)) {
CVarClear("gRandomizerSettingsEnabled");
} else {
CVarSetInteger("gRandomizerSettingsEnabled", 1);
}
LUS::RequestCvarSaveOnNextTick();
LUS::EnableWindow("Randomizer Settings", CVarGetInteger("gRandomizerSettingsEnabled", 0));
}
UIWidgets::Spacer(0);
if (ImGui::Button(GetWindowButtonText("Item Tracker", CVarGetInteger("gItemTrackerEnabled", 0)).c_str(), buttonSize))
{
bool currentValue = CVarGetInteger("gItemTrackerEnabled", 0);
CVarSetInteger("gItemTrackerEnabled", !currentValue);
Ship::RequestCvarSaveOnNextTick();
Ship::EnableWindow("Item Tracker", CVarGetInteger("gItemTrackerEnabled", 0));
if (CVarGetInteger("gItemTrackerEnabled", 0)) {
CVarClear("gItemTrackerEnabled");
} else {
CVarSetInteger("gItemTrackerEnabled", 1);
}
LUS::RequestCvarSaveOnNextTick();
LUS::EnableWindow("Item Tracker", CVarGetInteger("gItemTrackerEnabled", 0));
}
UIWidgets::Spacer(0);
if (ImGui::Button(GetWindowButtonText("Item Tracker Settings", CVarGetInteger("gItemTrackerSettingsEnabled", 0)).c_str(), buttonSize))
{
bool currentValue = CVarGetInteger("gItemTrackerSettingsEnabled", 0);
CVarSetInteger("gItemTrackerSettingsEnabled", !currentValue);
Ship::RequestCvarSaveOnNextTick();
Ship::EnableWindow("Item Tracker Settings", CVarGetInteger("gItemTrackerSettingsEnabled", 0));
if (CVarGetInteger("gItemTrackerSettingsEnabled", 0)) {
CVarClear("gItemTrackerSettingsEnabled");
} else {
CVarSetInteger("gItemTrackerSettingsEnabled", 1);
}
LUS::RequestCvarSaveOnNextTick();
LUS::EnableWindow("Item Tracker Settings", CVarGetInteger("gItemTrackerSettingsEnabled", 0));
}
UIWidgets::Spacer(0);
if (ImGui::Button(GetWindowButtonText("Entrance Tracker", CVarGetInteger("gEntranceTrackerEnabled", 0)).c_str(), buttonSize))
{
bool currentValue = CVarGetInteger("gEntranceTrackerEnabled", 0);
CVarSetInteger("gEntranceTrackerEnabled", !currentValue);
Ship::RequestCvarSaveOnNextTick();
Ship::EnableWindow("Entrance Tracker", CVarGetInteger("gEntranceTrackerEnabled", 0));
if (CVarGetInteger("gEntranceTrackerEnabled", 0)) {
CVarClear("gEntranceTrackerEnabled");
} else {
CVarSetInteger("gEntranceTrackerEnabled", 1);
}
LUS::RequestCvarSaveOnNextTick();
LUS::EnableWindow("Entrance Tracker", CVarGetInteger("gEntranceTrackerEnabled", 0));
}
UIWidgets::Spacer(0);
if (ImGui::Button(GetWindowButtonText("Check Tracker", CVarGetInteger("gCheckTrackerEnabled", 0)).c_str(), buttonSize))
{
bool currentValue = CVarGetInteger("gCheckTrackerEnabled", 0);
CVarSetInteger("gCheckTrackerEnabled", !currentValue);
Ship::RequestCvarSaveOnNextTick();
Ship::EnableWindow("Check Tracker", CVarGetInteger("gCheckTrackerEnabled", 0));
if (CVarGetInteger("gCheckTrackerEnabled", 0)) {
CVarClear("gCheckTrackerEnabled");
} else {
CVarSetInteger("gCheckTrackerEnabled", 1);
}
LUS::RequestCvarSaveOnNextTick();
LUS::EnableWindow("Check Tracker", CVarGetInteger("gCheckTrackerEnabled", 0));
}
UIWidgets::Spacer(0);
if (ImGui::Button(GetWindowButtonText("Check Tracker Settings", CVarGetInteger("gCheckTrackerSettingsEnabled", 0)).c_str(), buttonSize))
{
bool currentValue = CVarGetInteger("gCheckTrackerSettingsEnabled", 0);
CVarSetInteger("gCheckTrackerSettingsEnabled", !currentValue);
Ship::RequestCvarSaveOnNextTick();
Ship::EnableWindow("Check Tracker Settings", CVarGetInteger("gCheckTrackerSettingsEnabled", 0));
if (CVarGetInteger("gCheckTrackerSettingsEnabled", 0)) {
CVarClear("gCheckTrackerSettingsEnabled");
} else {
CVarSetInteger("gCheckTrackerSettingsEnabled", 1);
}
LUS::RequestCvarSaveOnNextTick();
LUS::EnableWindow("Check Tracker Settings", CVarGetInteger("gCheckTrackerSettingsEnabled", 0));
}
ImGui::PopStyleVar(3);
ImGui::PopStyleColor(1);
@ -1287,11 +1340,11 @@ namespace GameMenuBar {
if (ImGui::BeginMenu("Rando Enhancements"))
{
UIWidgets::EnhancementCheckbox("Rando-Relevant Navi Hints", "gRandoRelevantNavi");
UIWidgets::EnhancementCheckbox("Rando-Relevant Navi Hints", "gRandoRelevantNavi", false, "", UIWidgets::CheckboxGraphics::Cross, true);
UIWidgets::Tooltip(
"Replace Navi's overworld quest hints with rando-related gameplay hints."
);
UIWidgets::PaddedEnhancementCheckbox("Random Rupee Names", "gRandomizeRupeeNames", true, false);
UIWidgets::PaddedEnhancementCheckbox("Random Rupee Names", "gRandomizeRupeeNames", true, false, false, "", UIWidgets::CheckboxGraphics::Cross, true);
UIWidgets::Tooltip(
"When obtaining rupees, randomize what the rupee is called in the textbox."
);
@ -1318,7 +1371,7 @@ namespace GameMenuBar {
"shuffle settings set to \"Any Dungeon\", \"Overworld\" or \"Anywhere\"";
UIWidgets::PaddedEnhancementCheckbox("Key Colors Match Dungeon", "gRandoMatchKeyColors", true, false,
disableKeyColors, disableKeyColorsText);
disableKeyColors, disableKeyColorsText, UIWidgets::CheckboxGraphics::Cross, true);
UIWidgets::Tooltip(
"Matches the color of small keys and boss keys to the dungeon they belong to. "
"This helps identify keys from afar and adds a little bit of flair.\n\nThis only "

View file

@ -201,19 +201,19 @@ const char* constCameraStrings[] = {
OTRGlobals::OTRGlobals() {
std::vector<std::string> OTRFiles;
std::string mqPath = Ship::Window::GetPathRelativeToAppDirectory("oot-mq.otr");
std::string mqPath = LUS::Context::GetPathRelativeToAppDirectory("oot-mq.otr");
if (std::filesystem::exists(mqPath)) {
OTRFiles.push_back(mqPath);
}
std::string ootPath = Ship::Window::GetPathRelativeToAppDirectory("oot.otr");
std::string ootPath = LUS::Context::GetPathRelativeToAppDirectory("oot.otr");
if (std::filesystem::exists(ootPath)) {
OTRFiles.push_back(ootPath);
}
std::string sohOtrPath = Ship::Window::GetPathRelativeToAppBundle("soh.otr");
std::string sohOtrPath = LUS::Context::GetPathRelativeToAppBundle("soh.otr");
if (std::filesystem::exists(sohOtrPath)) {
OTRFiles.push_back(sohOtrPath);
}
std::string patchesPath = Ship::Window::GetPathRelativeToAppDirectory("mods");
std::string patchesPath = LUS::Context::GetPathRelativeToAppDirectory("mods");
if (patchesPath.length() > 0 && std::filesystem::exists(patchesPath)) {
if (std::filesystem::is_directory(patchesPath)) {
for (const auto& p : std::filesystem::recursive_directory_iterator(patchesPath)) {
@ -240,21 +240,22 @@ OTRGlobals::OTRGlobals() {
OOT_PAL_GC_DBG1,
OOT_PAL_GC_DBG2
};
context = Ship::Window::CreateInstance("Ship of Harkinian", "soh", OTRFiles);
// tell LUS to reserve 3 SoH specific threads (Game, Audio, Save)
context = LUS::Context::CreateInstance("Ship of Harkinian", "soh", OTRFiles, {}, 3);
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(Ship::ResourceType::SOH_Animation, "Animation", std::make_shared<Ship::AnimationFactory>());
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(Ship::ResourceType::SOH_PlayerAnimation, "PlayerAnimation", std::make_shared<Ship::PlayerAnimationFactory>());
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(Ship::ResourceType::SOH_Room, "Room", std::make_shared<Ship::SceneFactory>()); // Is room scene? maybe?
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(Ship::ResourceType::SOH_CollisionHeader, "CollisionHeader", std::make_shared<Ship::CollisionHeaderFactory>());
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(Ship::ResourceType::SOH_Skeleton, "Skeleton", std::make_shared<Ship::SkeletonFactory>());
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(Ship::ResourceType::SOH_SkeletonLimb, "SkeletonLimb", std::make_shared<Ship::SkeletonLimbFactory>());
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(Ship::ResourceType::SOH_Path, "Path", std::make_shared<Ship::PathFactory>());
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(Ship::ResourceType::SOH_Cutscene, "Cutscene", std::make_shared<Ship::CutsceneFactory>());
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(Ship::ResourceType::SOH_Text, "Text", std::make_shared<Ship::TextFactory>());
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(Ship::ResourceType::SOH_AudioSample, "AudioSample", std::make_shared<Ship::AudioSampleFactory>());
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(Ship::ResourceType::SOH_AudioSoundFont, "AudioSoundFont", std::make_shared<Ship::AudioSoundFontFactory>());
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(Ship::ResourceType::SOH_AudioSequence, "AudioSequence", std::make_shared<Ship::AudioSequenceFactory>());
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(Ship::ResourceType::SOH_Background, "Background", std::make_shared<Ship::BackgroundFactory>());
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_Animation, "Animation", std::make_shared<LUS::AnimationFactory>());
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_PlayerAnimation, "PlayerAnimation", std::make_shared<LUS::PlayerAnimationFactory>());
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_Room, "Room", std::make_shared<LUS::SceneFactory>()); // Is room scene? maybe?
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_CollisionHeader, "CollisionHeader", std::make_shared<LUS::CollisionHeaderFactory>());
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_Skeleton, "Skeleton", std::make_shared<LUS::SkeletonFactory>());
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_SkeletonLimb, "SkeletonLimb", std::make_shared<LUS::SkeletonLimbFactory>());
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_Path, "Path", std::make_shared<LUS::PathFactory>());
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_Cutscene, "Cutscene", std::make_shared<LUS::CutsceneFactory>());
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_Text, "Text", std::make_shared<LUS::TextFactory>());
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_AudioSample, "AudioSample", std::make_shared<LUS::AudioSampleFactory>());
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_AudioSoundFont, "AudioSoundFont", std::make_shared<LUS::AudioSoundFontFactory>());
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_AudioSequence, "AudioSequence", std::make_shared<LUS::AudioSequenceFactory>());
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_Background, "Background", std::make_shared<LUS::BackgroundFactory>());
gSaveStateMgr = std::make_shared<SaveStateMgr>();
gRandomizer = std::make_shared<Randomizer>();
@ -278,7 +279,7 @@ OTRGlobals::OTRGlobals() {
#if defined(__SWITCH__)
SPDLOG_ERROR("Invalid OTR File!");
#elif defined(__WIIU__)
Ship::WiiU::ThrowInvalidOTR();
LUS::WiiU::ThrowInvalidOTR();
#else
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Invalid OTR File",
"Attempted to load an invalid OTR file. Try regenerating.", nullptr);
@ -324,15 +325,15 @@ bool OTRGlobals::HasOriginal() {
}
uint32_t OTRGlobals::GetInterpolationFPS() {
if (Ship::WindowBackend() == Ship::Backend::DX11) {
if (LUS::WindowBackend() == LUS::Backend::DX11) {
return CVarGetInteger("gInterpolationFPS", 20);
}
if (CVarGetInteger("gMatchRefreshRate", 0)) {
return Ship::Window::GetInstance()->GetCurrentRefreshRate();
return LUS::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate();
}
return std::min<uint32_t>(Ship::Window::GetInstance()->GetCurrentRefreshRate(), CVarGetInteger("gInterpolationFPS", 20));
return std::min<uint32_t>(LUS::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(), CVarGetInteger("gInterpolationFPS", 20));
}
struct ExtensionEntry {
@ -694,7 +695,7 @@ extern "C" uint32_t GetGIID(uint32_t itemID) {
}
extern "C" void OTRExtScanner() {
auto lst = *OTRGlobals::Instance->context->GetResourceManager()->GetArchive()->ListFiles("*").get();
auto lst = *LUS::Context::GetInstance()->GetResourceManager()->GetArchive()->ListFiles("*").get();
for (auto& rPath : lst) {
std::vector<std::string> raw = StringHelper::Split(rPath, ".");
@ -708,8 +709,9 @@ extern "C" void OTRExtScanner() {
extern "C" void InitOTR() {
#if not defined (__SWITCH__) && not defined(__WIIU__)
if (!std::filesystem::exists(Ship::Window::GetPathRelativeToAppDirectory("oot-mq.otr")) &&
!std::filesystem::exists(Ship::Window::GetPathRelativeToAppDirectory("oot.otr"))){
if (!std::filesystem::exists(LUS::Context::GetPathRelativeToAppDirectory("oot-mq.otr")) &&
!std::filesystem::exists(LUS::Context::GetPathRelativeToAppDirectory("oot.otr"))){
bool generatedOtrIsMQ = false;
if (Extractor::ShowYesNoBox("No OTR Files", "No OTR files found. Generate one now?") == IDYES) {
Extractor extract;
if (!extract.Run()) {
@ -717,12 +719,13 @@ extern "C" void InitOTR() {
exit(1);
}
extract.CallZapd();
generatedOtrIsMQ = extract.IsMasterQuest();
} else {
exit(1);
}
if (Extractor::ShowYesNoBox("Extraction Complete", "ROM Extracted. Extract another?") == IDYES) {
Extractor extract;
if (!extract.Run()) {
if (!extract.Run(generatedOtrIsMQ ? RomSearchMode::Vanilla : RomSearchMode::MQ)) {
Extractor::ShowErrorBox("Error", "An error occured, an OTR file may have been generated by a different step. Continuing...");
} else {
extract.CallZapd();
@ -732,12 +735,12 @@ extern "C" void InitOTR() {
#endif
#ifdef __SWITCH__
Ship::Switch::Init(Ship::PreInitPhase);
LUS::Switch::Init(LUS::PreInitPhase);
#elif defined(__WIIU__)
Ship::WiiU::Init();
LUS::WiiU::Init();
#endif
Ship::AddSetupHooksDelegate(GameMenuBar::SetupHooks);
Ship::RegisterMenuDrawMethod(GameMenuBar::Draw);
LUS::AddSetupHooksDelegate(GameMenuBar::SetupHooks);
LUS::RegisterMenuDrawMethod(GameMenuBar::Draw);
OTRGlobals::Instance = new OTRGlobals();
SaveManager::Instance = new SaveManager();
@ -791,9 +794,6 @@ extern "C" void InitOTR() {
extern "C" void DeinitOTR() {
OTRAudio_Exit();
#if defined(_WIN32) || defined(__APPLE__)
SpeechSynthesizerUninitialize();
#endif
#ifdef ENABLE_CROWD_CONTROL
CrowdControl::Instance->Disable();
CrowdControl::Instance->Shutdown();
@ -833,16 +833,16 @@ extern "C" uint64_t GetPerfCounter() {
// C->C++ Bridge
extern "C" void Graph_ProcessFrame(void (*run_one_game_iter)(void)) {
OTRGlobals::Instance->context->MainLoop(run_one_game_iter);
OTRGlobals::Instance->context->GetWindow()->MainLoop(run_one_game_iter);
}
extern bool ShouldClearTextureCacheAtEndOfFrame;
extern "C" void Graph_StartFrame() {
#ifndef __WIIU__
using Ship::KbScancode;
int32_t dwScancode = OTRGlobals::Instance->context->GetLastScancode();
OTRGlobals::Instance->context->SetLastScancode(-1);
using LUS::KbScancode;
int32_t dwScancode = OTRGlobals::Instance->context->GetWindow()->GetLastScancode();
OTRGlobals::Instance->context->GetWindow()->SetLastScancode(-1);
switch (dwScancode) {
case KbScancode::LUS_KB_F5: {
@ -911,7 +911,7 @@ extern "C" void Graph_StartFrame() {
}
}
#endif
OTRGlobals::Instance->context->StartFrame();
OTRGlobals::Instance->context->GetWindow()->StartFrame();
}
void RunCommands(Gfx* Commands, const std::vector<std::unordered_map<Mtx*, MtxF>>& mtx_replacements) {
@ -959,10 +959,10 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
time -= fps;
OTRGlobals::Instance->context->SetTargetFps(fps);
OTRGlobals::Instance->context->GetWindow()->SetTargetFps(fps);
int threshold = CVarGetInteger("gExtraLatencyThreshold", 80);
OTRGlobals::Instance->context->SetMaximumFrameLatency(threshold > 0 && target_fps >= threshold ? 2 : 1);
OTRGlobals::Instance->context->GetWindow()->SetMaximumFrameLatency(threshold > 0 && target_fps >= threshold ? 2 : 1);
RunCommands(commands, mtx_replacements);
@ -978,7 +978,7 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
if (ShouldClearTextureCacheAtEndOfFrame) {
gfx_texture_cache_clear();
Ship::SkeletonPatcher::UpdateSkeletons();
LUS::SkeletonPatcher::UpdateSkeletons();
ShouldClearTextureCacheAtEndOfFrame = false;
}
@ -991,19 +991,19 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
float divisor_num = 0.0f;
extern "C" void OTRGetPixelDepthPrepare(float x, float y) {
OTRGlobals::Instance->context->GetPixelDepthPrepare(x, y);
OTRGlobals::Instance->context->GetWindow()->GetPixelDepthPrepare(x, y);
}
extern "C" uint16_t OTRGetPixelDepth(float x, float y) {
return OTRGlobals::Instance->context->GetPixelDepth(x, y);
return OTRGlobals::Instance->context->GetWindow()->GetPixelDepth(x, y);
}
extern "C" uint32_t ResourceMgr_GetNumGameVersions() {
return OTRGlobals::Instance->context->GetResourceManager()->GetArchive()->GetGameVersions().size();
return LUS::Context::GetInstance()->GetResourceManager()->GetArchive()->GetGameVersions().size();
}
extern "C" uint32_t ResourceMgr_GetGameVersion(int index) {
return OTRGlobals::Instance->context->GetResourceManager()->GetArchive()->GetGameVersions()[index];
return LUS::Context::GetInstance()->GetResourceManager()->GetArchive()->GetGameVersions()[index];
}
uint32_t IsSceneMasterQuest(s16 sceneNum) {
@ -1048,16 +1048,16 @@ extern "C" uint32_t ResourceMgr_IsGameMasterQuest() {
}
extern "C" void ResourceMgr_LoadDirectory(const char* resName) {
OTRGlobals::Instance->context->GetResourceManager()->LoadDirectory(resName);
LUS::Context::GetInstance()->GetResourceManager()->LoadDirectory(resName);
}
extern "C" void ResourceMgr_DirtyDirectory(const char* resName) {
OTRGlobals::Instance->context->GetResourceManager()->DirtyDirectory(resName);
LUS::Context::GetInstance()->GetResourceManager()->DirtyDirectory(resName);
}
// 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 = OTRGlobals::Instance->context->GetResourceManager()->GetArchive()->ListFiles(searchMask);
auto lst = LUS::Context::GetInstance()->GetResourceManager()->GetArchive()->ListFiles(searchMask);
char** result = (char**)malloc(lst->size() * sizeof(char*));
for (size_t i = 0; i < lst->size(); i++) {
@ -1081,10 +1081,10 @@ extern "C" uint8_t ResourceMgr_FileExists(const char* filePath) {
}
extern "C" void ResourceMgr_LoadFile(const char* resName) {
OTRGlobals::Instance->context->GetResourceManager()->LoadResource(resName);
LUS::Context::GetInstance()->GetResourceManager()->LoadResource(resName);
}
std::shared_ptr<Ship::Resource> GetResourceByNameHandlingMQ(const char* path) {
std::shared_ptr<LUS::Resource> GetResourceByNameHandlingMQ(const char* path) {
std::string Path = path;
if (ResourceMgr_IsGameMasterQuest()) {
size_t pos = 0;
@ -1092,7 +1092,7 @@ std::shared_ptr<Ship::Resource> GetResourceByNameHandlingMQ(const char* path) {
Path.replace(pos, 7, "/mq/");
}
}
return OTRGlobals::Instance->context->GetResourceManager()->LoadResource(Path.c_str());
return LUS::Context::GetInstance()->GetResourceManager()->LoadResource(Path.c_str());
}
extern "C" char* GetResourceDataByNameHandlingMQ(const char* path) {
@ -1121,7 +1121,7 @@ extern "C" char* ResourceMgr_LoadFileFromDisk(const char* filePath) {
extern "C" uint8_t ResourceMgr_ResourceIsBackground(char* texPath) {
auto res = GetResourceByNameHandlingMQ(texPath);
return res->InitData->Type == Ship::ResourceType::SOH_Background;
return res->InitData->Type == LUS::ResourceType::SOH_Background;
}
extern "C" char* ResourceMgr_LoadJPEG(char* data, size_t dataSize)
@ -1169,10 +1169,10 @@ extern "C" uint16_t ResourceMgr_LoadTexHeightByName(char* texPath);
extern "C" char* ResourceMgr_LoadTexOrDListByName(const char* filePath) {
auto res = GetResourceByNameHandlingMQ(filePath);
if (res->InitData->Type == Ship::ResourceType::DisplayList)
return (char*)&((std::static_pointer_cast<Ship::DisplayList>(res))->Instructions[0]);
else if (res->InitData->Type == Ship::ResourceType::Array)
return (char*)(std::static_pointer_cast<Ship::Array>(res))->Vertices.data();
if (res->InitData->Type == LUS::ResourceType::DisplayList)
return (char*)&((std::static_pointer_cast<LUS::DisplayList>(res))->Instructions[0]);
else if (res->InitData->Type == LUS::ResourceType::Array)
return (char*)(std::static_pointer_cast<LUS::Array>(res))->Vertices.data();
else {
return (char*)GetResourceDataByNameHandlingMQ(filePath);
}
@ -1181,8 +1181,8 @@ extern "C" char* ResourceMgr_LoadTexOrDListByName(const char* filePath) {
extern "C" char* ResourceMgr_LoadIfDListByName(const char* filePath) {
auto res = GetResourceByNameHandlingMQ(filePath);
if (res->InitData->Type == Ship::ResourceType::DisplayList)
return (char*)&((std::static_pointer_cast<Ship::DisplayList>(res))->Instructions[0]);
if (res->InitData->Type == LUS::ResourceType::DisplayList)
return (char*)&((std::static_pointer_cast<LUS::DisplayList>(res))->Instructions[0]);
return nullptr;
}
@ -1192,7 +1192,7 @@ extern "C" Sprite* GetSeedTexture(uint8_t index) {
}
extern "C" char* ResourceMgr_LoadPlayerAnimByName(const char* animPath) {
auto anim = std::static_pointer_cast<Ship::PlayerAnimation>(GetResourceByNameHandlingMQ(animPath));
auto anim = std::static_pointer_cast<LUS::PlayerAnimation>(GetResourceByNameHandlingMQ(animPath));
return (char*)&anim->limbRotData[0];
}
@ -1204,7 +1204,7 @@ extern "C" void ResourceMgr_PushCurrentDirectory(char* path)
extern "C" Gfx* ResourceMgr_LoadGfxByName(const char* path)
{
auto res = std::static_pointer_cast<Ship::DisplayList>(GetResourceByNameHandlingMQ(path));
auto res = std::static_pointer_cast<LUS::DisplayList>(GetResourceByNameHandlingMQ(path));
return (Gfx*)&res->Instructions[0];
}
@ -1218,8 +1218,8 @@ std::unordered_map<std::string, std::unordered_map<std::string, GfxPatch>> origi
// 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<Ship::DisplayList>(
OTRGlobals::Instance->context->GetResourceManager()->LoadResource(path));
auto res = std::static_pointer_cast<LUS::DisplayList>(
LUS::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) {
@ -1253,8 +1253,8 @@ extern "C" void ResourceMgr_PatchGfxByName(const char* path, const char* patchNa
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<Ship::DisplayList>(
OTRGlobals::Instance->context->GetResourceManager()->LoadResource(path));
auto res = std::static_pointer_cast<LUS::DisplayList>(
LUS::Context::GetInstance()->GetResourceManager()->LoadResource(path));
Gfx* gfx = (Gfx*)&res->Instructions[originalGfx[path][patchName].index];
*gfx = originalGfx[path][patchName].instruction;
@ -1265,13 +1265,13 @@ extern "C" void ResourceMgr_UnpatchGfxByName(const char* path, const char* patch
extern "C" char* ResourceMgr_LoadArrayByName(const char* path)
{
auto res = std::static_pointer_cast<Ship::Array>(GetResourceByNameHandlingMQ(path));
auto res = std::static_pointer_cast<LUS::Array>(GetResourceByNameHandlingMQ(path));
return (char*)res->Scalars.data();
}
extern "C" char* ResourceMgr_LoadArrayByNameAsVec3s(const char* path) {
auto res = std::static_pointer_cast<Ship::Array>(GetResourceByNameHandlingMQ(path));
auto res = std::static_pointer_cast<LUS::Array>(GetResourceByNameHandlingMQ(path));
// if (res->CachedGameAsset != nullptr)
// return (char*)res->CachedGameAsset;
@ -1292,15 +1292,15 @@ extern "C" char* ResourceMgr_LoadArrayByNameAsVec3s(const char* path) {
}
extern "C" CollisionHeader* ResourceMgr_LoadColByName(const char* path) {
return (CollisionHeader*)GetResourceDataByName(path, false);
return (CollisionHeader*) GetResourceDataByName(path);
}
extern "C" Vtx* ResourceMgr_LoadVtxByName(char* path) {
return (Vtx*)GetResourceDataByName(path, false);
return (Vtx*) GetResourceDataByName(path);
}
extern "C" SequenceData ResourceMgr_LoadSeqByName(const char* path) {
SequenceData* sequence = (SequenceData*)GetResourceDataByName(path, false);
SequenceData* sequence = (SequenceData*) GetResourceDataByName(path);
return *sequence;
}
@ -1314,7 +1314,7 @@ extern "C" SoundFontSample* ReadCustomSample(const char* path) {
ExtensionEntry entry = ExtensionCache[path];
auto sampleRaw = OTRGlobals::Instance->context->GetResourceManager()->LoadFile(entry.path);
auto sampleRaw = LUS::Context::GetInstance()->GetResourceManager()->LoadFile(entry.path);
uint32_t* strem = (uint32_t*)sampleRaw->Buffer.get();
uint8_t* strem2 = (uint8_t*)strem;
@ -1365,11 +1365,11 @@ extern "C" SoundFontSample* ReadCustomSample(const char* path) {
}
extern "C" SoundFontSample* ResourceMgr_LoadAudioSample(const char* path) {
return (SoundFontSample*)GetResourceDataByName(path, false);
return (SoundFontSample*) GetResourceDataByName(path);
}
extern "C" SoundFont* ResourceMgr_LoadAudioSoundFont(const char* path) {
return (SoundFont*)GetResourceDataByName(path, false);
return (SoundFont*) GetResourceDataByName(path);
}
extern "C" int ResourceMgr_OTRSigCheck(char* imgData)
@ -1391,7 +1391,7 @@ extern "C" int ResourceMgr_OTRSigCheck(char* imgData)
}
extern "C" AnimationHeaderCommon* ResourceMgr_LoadAnimByName(const char* path) {
return (AnimationHeaderCommon*)GetResourceDataByName(path, false);
return (AnimationHeaderCommon*) GetResourceDataByName(path);
}
extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path, SkelAnime* skelAnime) {
@ -1405,21 +1405,21 @@ extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path, Skel
bool isAlt = CVarGetInteger("gAltAssets", 0);
if (isAlt) {
pathStr = Ship::Resource::gAltAssetPrefix + pathStr;
pathStr = LUS::Resource::gAltAssetPrefix + pathStr;
}
SkeletonHeader* skelHeader = (SkeletonHeader*)GetResourceDataByName(pathStr.c_str(), false);
SkeletonHeader* skelHeader = (SkeletonHeader*) GetResourceDataByName(pathStr.c_str());
// If there isn't an alternate model, load the regular one
if (isAlt && skelHeader == NULL) {
skelHeader = (SkeletonHeader*)GetResourceDataByName(path, false);
skelHeader = (SkeletonHeader*) GetResourceDataByName(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);
Ship::SkeletonPatcher::RegisterSkeleton(stringPath, skelAnime);
LUS::SkeletonPatcher::RegisterSkeleton(stringPath, skelAnime);
}
return skelHeader;
@ -1427,12 +1427,12 @@ extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path, Skel
extern "C" void ResourceMgr_UnregisterSkeleton(SkelAnime* skelAnime) {
if (skelAnime != nullptr)
Ship::SkeletonPatcher::UnregisterSkeleton(skelAnime);
LUS::SkeletonPatcher::UnregisterSkeleton(skelAnime);
}
extern "C" void ResourceMgr_ClearSkeletons(SkelAnime* skelAnime) {
if (skelAnime != nullptr)
Ship::SkeletonPatcher::ClearSkeletons();
LUS::SkeletonPatcher::ClearSkeletons();
}
extern "C" s32* ResourceMgr_LoadCSByName(const char* path) {
@ -1440,7 +1440,7 @@ extern "C" s32* ResourceMgr_LoadCSByName(const char* path) {
}
std::filesystem::path GetSaveFile(std::shared_ptr<Mercury> Conf) {
const std::string fileName = Conf->getString("Game.SaveName", Ship::Window::GetPathRelativeToAppDirectory("oot_save.sav"));
const std::string fileName = Conf->getString("Game.SaveName", LUS::Context::GetPathRelativeToAppDirectory("oot_save.sav"));
std::filesystem::path saveFile = std::filesystem::absolute(fileName);
if (!exists(saveFile.parent_path())) {
@ -1571,30 +1571,30 @@ extern "C" void OTRGfxPrint(const char* str, void* printer, void (*printImpl)(vo
}
extern "C" uint32_t OTRGetCurrentWidth() {
return OTRGlobals::Instance->context->GetCurrentWidth();
return OTRGlobals::Instance->context->GetWindow()->GetCurrentWidth();
}
extern "C" uint32_t OTRGetCurrentHeight() {
return OTRGlobals::Instance->context->GetCurrentHeight();
return OTRGlobals::Instance->context->GetWindow()->GetCurrentHeight();
}
extern "C" void OTRControllerCallback(uint8_t rumble, uint8_t ledColor) {
auto controlDeck = Ship::Window::GetInstance()->GetControlDeck();
auto controlDeck = LUS::Context::GetInstance()->GetControlDeck();
for (int i = 0; i < controlDeck->GetNumConnectedPorts(); ++i) {
auto physicalDevice = controlDeck->GetDeviceFromPortIndex(i);
switch (ledColor) {
case 0:
physicalDevice->SetLed(i, 255, 0, 0);
physicalDevice->SetLedColor(i, {255, 0, 0});
break;
case 1:
physicalDevice->SetLed(i, 0x1E, 0x69, 0x1B);
physicalDevice->SetLedColor(i, {0x1E, 0x69, 0x1B});
break;
case 2:
physicalDevice->SetLed(i, 0x64, 0x14, 0x00);
physicalDevice->SetLedColor(i, {0x64, 0x14, 0x00});
break;
case 3:
physicalDevice->SetLed(i, 0x00, 0x3C, 0x64);
physicalDevice->SetLedColor(i, {0x00, 0x3C, 0x64});
break;
}
@ -1642,7 +1642,7 @@ extern "C" void AudioPlayer_Play(const uint8_t* buf, uint32_t len) {
}
extern "C" int Controller_ShouldRumble(size_t slot) {
auto controlDeck = Ship::Window::GetInstance()->GetControlDeck();
auto controlDeck = LUS::Context::GetInstance()->GetControlDeck();
if (slot < controlDeck->GetNumConnectedPorts()) {
auto physicalDevice = controlDeck->GetDeviceFromPortIndex(slot);
@ -1656,19 +1656,19 @@ extern "C" int Controller_ShouldRumble(size_t slot) {
}
extern "C" void Controller_BlockGameInput() {
auto controlDeck = Ship::Window::GetInstance()->GetControlDeck();
auto controlDeck = LUS::Context::GetInstance()->GetControlDeck();
controlDeck->BlockGameInput();
}
extern "C" void Controller_UnblockGameInput() {
auto controlDeck = Ship::Window::GetInstance()->GetControlDeck();
auto controlDeck = LUS::Context::GetInstance()->GetControlDeck();
controlDeck->UnblockGameInput();
}
extern "C" void Hooks_ExecuteAudioInit() {
Ship::ExecuteHooks<Ship::AudioInit>();
LUS::ExecuteHooks<LUS::AudioInit>();
}
extern "C" void* getN64WeirdFrame(s32 i) {
@ -1884,7 +1884,7 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) {
RandomizerInf randoInf = (RandomizerInf)((textId - (TEXT_SHOP_ITEM_RANDOM + NUM_SHOP_ITEMS)) + RAND_INF_SHOP_ITEMS_KF_SHOP_ITEM_1);
messageEntry = OTRGlobals::Instance->gRandomizer->GetMerchantMessage(randoInf, TEXT_SHOP_ITEM_RANDOM_CONFIRM);
}
} else if (CVarGetInteger("gRandomizeRupeeNames", 0) &&
} else if (CVarGetInteger("gRandomizeRupeeNames", 1) &&
(textId == TEXT_BLUE_RUPEE || textId == TEXT_RED_RUPEE || textId == TEXT_PURPLE_RUPEE ||
textId == TEXT_HUGE_RUPEE)) {
messageEntry = Randomizer::GetRupeeMessage(textId);
@ -1988,12 +1988,12 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) {
}
extern "C" void Overlay_DisplayText(float duration, const char* text) {
Ship::GetGameOverlay()->TextDrawNotification(duration, true, text);
LUS::GetGameOverlay()->TextDrawNotification(duration, true, text);
}
extern "C" void Overlay_DisplayText_Seconds(int seconds, const char* text) {
float duration = seconds * OTRGlobals::Instance->GetInterpolationFPS() * 0.05;
Ship::GetGameOverlay()->TextDrawNotification(duration, true, text);
LUS::GetGameOverlay()->TextDrawNotification(duration, true, text);
}
extern "C" void Entrance_ClearEntranceTrackingData(void) {

View file

@ -19,7 +19,7 @@ class OTRGlobals
public:
static OTRGlobals* Instance;
std::shared_ptr<Ship::Window> context;
std::shared_ptr<LUS::Context> context;
std::shared_ptr<SaveStateMgr> gSaveStateMgr;
std::shared_ptr<Randomizer> gRandomizer;

View file

@ -7,7 +7,7 @@
#include "macros.h"
#include <variables.h>
#include <Hooks.h>
#include <libultraship/bridge.h>
#include <libultraship/libultraship.h>
#define NOGDI // avoid various windows defines that conflict with things in z64.h
#include <spdlog/spdlog.h>
@ -41,7 +41,7 @@ void SaveManager::ReadSaveFile(std::filesystem::path savePath, uintptr_t addr, v
}
std::filesystem::path SaveManager::GetFileName(int fileNum) {
const std::filesystem::path sSavePath(Ship::Window::GetPathRelativeToAppDirectory("Save"));
const std::filesystem::path sSavePath(LUS::Context::GetPathRelativeToAppDirectory("Save"));
return sSavePath / ("file" + std::to_string(fileNum + 1) + ".sav");
}
@ -356,11 +356,11 @@ void SaveManager::SaveRandomizer(SaveContext* saveContext) {
}
void SaveManager::Init() {
const std::filesystem::path sSavePath(Ship::Window::GetPathRelativeToAppDirectory("Save"));
const std::filesystem::path sSavePath(LUS::Context::GetPathRelativeToAppDirectory("Save"));
const std::filesystem::path sGlobalPath = sSavePath / std::string("global.sav");
auto sOldSavePath = Ship::Window::GetPathRelativeToAppDirectory("oot_save.sav");
auto sOldBackupSavePath = Ship::Window::GetPathRelativeToAppDirectory("oot_save.bak");
Ship::RegisterHook<Ship::ExitGame>([this]() { ThreadPoolWait(); });
auto sOldSavePath = LUS::Context::GetPathRelativeToAppDirectory("oot_save.sav");
auto sOldBackupSavePath = LUS::Context::GetPathRelativeToAppDirectory("oot_save.bak");
LUS::RegisterHook<LUS::ExitGame>([this]() { ThreadPoolWait(); });
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnExitGame>([this](uint32_t fileNum) { ThreadPoolWait(); });
// If the save directory does not exist, create it
@ -785,7 +785,7 @@ void SaveManager::SaveFile(int fileNum) {
// Can't think of any time the promise would be needed, so use push_task instead of submit
auto saveContext = new SaveContext;
memcpy(saveContext, &gSaveContext, sizeof(gSaveContext));
smThreadPool->push_task(&SaveManager::SaveFileThreaded, this, fileNum, saveContext);
smThreadPool->push_task_back(&SaveManager::SaveFileThreaded, this, fileNum, saveContext);
}
void SaveManager::SaveGlobal() {
@ -795,7 +795,7 @@ void SaveManager::SaveGlobal() {
globalBlock["zTargetSetting"] = gSaveContext.zTargetSetting;
globalBlock["language"] = gSaveContext.language;
const std::filesystem::path sSavePath(Ship::Window::GetPathRelativeToAppDirectory("Save"));
const std::filesystem::path sSavePath(LUS::Context::GetPathRelativeToAppDirectory("Save"));
const std::filesystem::path sGlobalPath = sSavePath / std::string("global.sav");
std::ofstream output(sGlobalPath);
@ -2189,7 +2189,7 @@ extern "C" void Save_SaveGlobal(void) {
extern "C" void Save_LoadFile(void) {
SaveManager::Instance->LoadFile(gSaveContext.fileNum);
Ship::ExecuteHooks<Ship::LoadFile>(gSaveContext.fileNum);
LUS::ExecuteHooks<LUS::LoadFile>(gSaveContext.fileNum);
}
extern "C" void Save_AddLoadFunction(char* name, int version, SaveManager::LoadFunc func) {
@ -2210,7 +2210,7 @@ extern "C" void Save_CopyFile(int from, int to) {
extern "C" void Save_DeleteFile(int fileNum) {
SaveManager::Instance->DeleteZeldaFile(fileNum);
Ship::ExecuteHooks<Ship::DeleteFile>(fileNum);
LUS::ExecuteHooks<LUS::DeleteFile>(fileNum);
}
extern "C" u32 Save_Exist(int fileNum) {

View file

@ -206,7 +206,7 @@ namespace UIWidgets {
bool val = (bool)CVarGetInteger(cvarName, defaultValue);
if (CustomCheckbox(text, &val, disabled, disabledGraphic)) {
CVarSetInteger(cvarName, val);
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
changed = true;
}
@ -246,7 +246,7 @@ namespace UIWidgets {
CVarSetInteger(cvarName, i);
selected = i;
changed = true;
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
}
}
@ -259,7 +259,7 @@ namespace UIWidgets {
if (disabledValue >= 0 && selected != disabledValue) {
CVarSetInteger(cvarName, disabledValue);
changed = true;
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
}
@ -348,7 +348,7 @@ namespace UIWidgets {
if (changed) {
CVarSetInteger(cvarName, val);
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
return changed;
@ -424,7 +424,7 @@ namespace UIWidgets {
if (changed) {
CVarSetFloat(cvarName, val);
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
}
return changed;
@ -471,7 +471,7 @@ namespace UIWidgets {
int val = CVarGetInteger(cvarName, 0);
if (ImGui::RadioButton(make_invisible.c_str(), id == val)) {
CVarSetInteger(cvarName, id);
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
ret = true;
}
ImGui::SameLine();
@ -498,7 +498,7 @@ namespace UIWidgets {
CVarSetColor(cvarName, colorsRGBA);
CVarSetInteger(Cvar_RBM.c_str(), 0); //On click disable rainbow mode.
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
changed = true;
}
Tooltip("Revert colors to the game's original colors (GameCube version)\nOverwrites previously chosen color");
@ -523,7 +523,7 @@ namespace UIWidgets {
NewColors.b = fmin(fmax(colors->z * 255, 0), 255);
CVarSetColor(cvarName, NewColors);
CVarSetInteger(Cvar_RBM.c_str(), 0); // On click disable rainbow mode.
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
changed = true;
}
Tooltip("Chooses a random color\nOverwrites previously chosen color");
@ -584,7 +584,7 @@ namespace UIWidgets {
colors.a = 255.0;
CVarSetColor(cvarName, colors);
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
changed = true;
}
}
@ -600,7 +600,7 @@ namespace UIWidgets {
colors.a = ColorRGBA.w * 255.0;
CVarSetColor(cvarName, colors);
Ship::RequestCvarSaveOnNextTick();
LUS::RequestCvarSaveOnNextTick();
changed = true;
}
}

195
soh/soh/mq_asset_hacks.h Normal file
View file

@ -0,0 +1,195 @@
#ifndef MQ_ASSET_HACKS_H
#define MQ_ASSET_HACKS_H
#include "align_asset_macro.h"
#define dgYdanTex_00BA18_MQ "__OTR__scenes/mq/ydan_scene/gYdanTex_00BA18"
static const ALIGN_ASSET(2) char gYdanTex_00BA18_MQ[] = dgYdanTex_00BA18_MQ;
#define dgYdanTex_00CA18_MQ "__OTR__scenes/mq/ydan_scene/gYdanTex_00CA18"
static const ALIGN_ASSET(2) char gYdanTex_00CA18_MQ[] = dgYdanTex_00CA18_MQ;
void* D_8012A2F8_MQ[] = {
gYdanTex_00BA18_MQ,
gYdanTex_00CA18_MQ,
};
#define dgGoronCityNightEntranceTex_MQ "__OTR__scenes/mq/spot18_scene/gGoronCityNightEntranceTex"
static const ALIGN_ASSET(2) char gGoronCityNightEntranceTex_MQ[] = dgGoronCityNightEntranceTex_MQ;
#define dgGoronCityDayEntranceTex_MQ "__OTR__scenes/mq/spot18_scene/gGoronCityDayEntranceTex"
static const ALIGN_ASSET(2) char gGoronCityDayEntranceTex_MQ[] = dgGoronCityDayEntranceTex_MQ;
void* sGoronCityEntranceTextures_MQ[] = {
gGoronCityDayEntranceTex_MQ,
gGoronCityNightEntranceTex_MQ,
};
#define dgLonLonRanchDayWindowTex_MQ "__OTR__scenes/mq/spot20_scene/gLonLonRanchDayWindowTex"
static const ALIGN_ASSET(2) char gLonLonRanchDayWindowTex_MQ[] = dgLonLonRanchDayWindowTex_MQ;
#define dgLonLonRangeNightWindowsTex_MQ "__OTR__scenes/mq/spot20_scene/gLonLonRangeNightWindowsTex"
static const ALIGN_ASSET(2) char gLonLonRangeNightWindowsTex_MQ[] = dgLonLonRangeNightWindowsTex_MQ;
void* sLonLonRanchWindowTextures_MQ[] = {
gLonLonRanchDayWindowTex_MQ,
gLonLonRangeNightWindowsTex_MQ,
};
// walls of GF room where they throw you when you get caught
#define dgSpot12_009678Tex_MQ "__OTR__scenes/mq/spot12_scene/gSpot12_009678Tex"
static const ALIGN_ASSET(2) char gSpot12_009678Tex_MQ[] = dgSpot12_009678Tex_MQ;
#define dgSpot12_00DE78Tex_MQ "__OTR__scenes/mq/spot12_scene/gSpot12_00DE78Tex"
static const ALIGN_ASSET(2) char gSpot12_00DE78Tex_MQ[] = dgSpot12_00DE78Tex_MQ;
void* D_8012A380_MQ[] = {
gSpot12_009678Tex_MQ,
gSpot12_00DE78Tex_MQ,
};
#define dgZorasDomainDayEntranceTex_MQ "__OTR__scenes/mq/spot07_scene/gZorasDomainDayEntranceTex"
static const ALIGN_ASSET(2) char gZorasDomainDayEntranceTex_MQ[] = dgZorasDomainDayEntranceTex_MQ;
#define dgZorasDomainNightEntranceTex_MQ "__OTR__scenes/mq/spot07_scene/gZorasDomainNightEntranceTex"
static const ALIGN_ASSET(2) char gZorasDomainNightEntranceTex_MQ[] = dgZorasDomainNightEntranceTex_MQ;
void* sZorasDomainEntranceTextures_MQ[] = {
gZorasDomainDayEntranceTex_MQ,
gZorasDomainNightEntranceTex_MQ,
};
#define dgKakarikoVillageDayWindowTex_MQ "__OTR__scenes/mq/spot01_scene/gKakarikoVillageDayWindowTex"
static const ALIGN_ASSET(2) char gKakarikoVillageDayWindowTex_MQ[] = dgKakarikoVillageDayWindowTex_MQ;
#define dgKakarikoVillageNightWindowTex_MQ "__OTR__scenes/mq/spot01_scene/gKakarikoVillageNightWindowTex"
static const ALIGN_ASSET(2) char gKakarikoVillageNightWindowTex_MQ[] = dgKakarikoVillageNightWindowTex_MQ;
void* sKakarikoWindowTextures_MQ[] = {
gKakarikoVillageDayWindowTex_MQ,
gKakarikoVillageNightWindowTex_MQ,
};
#define dgGuardHouseOutSideView2NightTex_MQ "__OTR__scenes/mq/miharigoya_scene/gGuardHouseOutSideView2NightTex"
static const ALIGN_ASSET(2) char gGuardHouseOutSideView2NightTex_MQ[] = dgGuardHouseOutSideView2NightTex_MQ;
#define dgGuardHouseOutSideView2DayTex_MQ "__OTR__scenes/mq/miharigoya_scene/gGuardHouseOutSideView2DayTex"
static const ALIGN_ASSET(2) char gGuardHouseOutSideView2DayTex_MQ[] = dgGuardHouseOutSideView2DayTex_MQ;
#define dgGuardHouseOutSideView1NightTex_MQ "__OTR__scenes/mq/miharigoya_scene/gGuardHouseOutSideView1NightTex"
static const ALIGN_ASSET(2) char gGuardHouseOutSideView1NightTex_MQ[] = dgGuardHouseOutSideView1NightTex_MQ;
#define dgGuardHouseOutSideView1DayTex_MQ "__OTR__scenes/mq/miharigoya_scene/gGuardHouseOutSideView1DayTex"
static const ALIGN_ASSET(2) char gGuardHouseOutSideView1DayTex_MQ[] = dgGuardHouseOutSideView1DayTex_MQ;
void* sGuardHouseView2Textures_MQ[] = {
gGuardHouseOutSideView1DayTex_MQ,
gGuardHouseOutSideView1NightTex_MQ,
};
void* sGuardHouseView1Textures_MQ[] = {
gGuardHouseOutSideView2DayTex_MQ,
gGuardHouseOutSideView2NightTex_MQ,
};
#define dgLonLonHouseDayEntranceTex_MQ "__OTR__scenes/mq/souko_scene/gLonLonHouseDayEntranceTex"
static const ALIGN_ASSET(2) char gLonLonHouseDayEntranceTex_MQ[] = dgLonLonHouseDayEntranceTex_MQ;
#define dgLonLonHouseNightEntranceTex_MQ "__OTR__scenes/mq/souko_scene/gLonLonHouseNightEntranceTex"
static const ALIGN_ASSET(2) char gLonLonHouseNightEntranceTex_MQ[] = dgLonLonHouseNightEntranceTex_MQ;
void* sLonLonHouseEntranceTextures_MQ[] = {
gLonLonHouseDayEntranceTex_MQ,
gLonLonHouseNightEntranceTex_MQ,
};
#define dgThievesHideoutNightEntranceTex_MQ "__OTR__scenes/mq/gerudoway_scene/gThievesHideoutNightEntranceTex"
static const ALIGN_ASSET(2) char gThievesHideoutNightEntranceTex_MQ[] = dgThievesHideoutNightEntranceTex_MQ;
#define dgThievesHideoutDayEntranceTex_MQ "__OTR__scenes/mq/gerudoway_scene/gThievesHideoutDayEntranceTex"
static const ALIGN_ASSET(2) char gThievesHideoutDayEntranceTex_MQ[] = dgThievesHideoutDayEntranceTex_MQ;
void* sThievesHideoutEntranceTextures_MQ[] = {
gThievesHideoutDayEntranceTex_MQ,
gThievesHideoutNightEntranceTex_MQ,
};
#define dgDCDayEntranceTex_MQ "__OTR__scenes/mq/ddan_scene/gDCDayEntranceTex"
static const ALIGN_ASSET(2) char gDCDayEntranceTex_MQ[] = dgDCDayEntranceTex_MQ;
#define dgDCNightEntranceTex_MQ "__OTR__scenes/mq/ddan_scene/gDCNightEntranceTex"
static const ALIGN_ASSET(2) char gDCNightEntranceTex_MQ[] = dgDCNightEntranceTex_MQ;
void* gDCEntranceTextures_MQ[] = {
gDCDayEntranceTex_MQ,
gDCNightEntranceTex_MQ,
};
#define dgDCLavaFloor1Tex_MQ "__OTR__scenes/mq/ddan_scene/gDCLavaFloor1Tex"
static const ALIGN_ASSET(2) char gDCLavaFloor1Tex_MQ[] = dgDCLavaFloor1Tex_MQ;
#define dgDCLavaFloor2Tex_MQ "__OTR__scenes/mq/ddan_scene/gDCLavaFloor2Tex"
static const ALIGN_ASSET(2) char gDCLavaFloor2Tex_MQ[] = dgDCLavaFloor2Tex_MQ;
#define dgDCLavaFloor3Tex_MQ "__OTR__scenes/mq/ddan_scene/gDCLavaFloor3Tex"
static const ALIGN_ASSET(2) char gDCLavaFloor3Tex_MQ[] = dgDCLavaFloor3Tex_MQ;
#define dgDCLavaFloor4Tex_MQ "__OTR__scenes/mq/ddan_scene/gDCLavaFloor4Tex"
static const ALIGN_ASSET(2) char gDCLavaFloor4Tex_MQ[] = dgDCLavaFloor4Tex_MQ;
#define dgDCLavaFloor5Tex_MQ "__OTR__scenes/mq/ddan_scene/gDCLavaFloor5Tex"
static const ALIGN_ASSET(2) char gDCLavaFloor5Tex_MQ[] = dgDCLavaFloor5Tex_MQ;
#define dgDCLavaFloor6Tex_MQ "__OTR__scenes/mq/ddan_scene/gDCLavaFloor6Tex"
static const ALIGN_ASSET(2) char gDCLavaFloor6Tex_MQ[] = dgDCLavaFloor6Tex_MQ;
#define dgDCLavaFloor7Tex_MQ "__OTR__scenes/mq/ddan_scene/gDCLavaFloor7Tex"
static const ALIGN_ASSET(2) char gDCLavaFloor7Tex_MQ[] = dgDCLavaFloor7Tex_MQ;
#define dgDCLavaFloor8Tex_MQ "__OTR__scenes/mq/ddan_scene/gDCLavaFloor8Tex"
static const ALIGN_ASSET(2) char gDCLavaFloor8Tex_MQ[] = dgDCLavaFloor8Tex_MQ;
void* sDCLavaFloorTextures_MQ[] = {
gDCLavaFloor1Tex_MQ, gDCLavaFloor2Tex_MQ, gDCLavaFloor3Tex_MQ, gDCLavaFloor4Tex_MQ,
gDCLavaFloor5Tex_MQ, gDCLavaFloor6Tex_MQ, gDCLavaFloor7Tex_MQ, gDCLavaFloor8Tex_MQ,
};
#define dgWaterTempleDayEntranceTex_MQ "__OTR__scenes/mq/MIZUsin_scene/gWaterTempleDayEntranceTex"
static const ALIGN_ASSET(2) char gWaterTempleDayEntranceTex_MQ[] = dgWaterTempleDayEntranceTex_MQ;
#define dgWaterTempleNightEntranceTex_MQ "__OTR__scenes/mq/MIZUsin_scene/gWaterTempleNightEntranceTex"
static const ALIGN_ASSET(2) char gWaterTempleNightEntranceTex_MQ[] = dgWaterTempleNightEntranceTex_MQ;
void* D_8012A330_MQ[] = {
gWaterTempleDayEntranceTex_MQ,
gWaterTempleNightEntranceTex_MQ,
};
#define dgIceCavernNightEntranceTex_MQ "__OTR__scenes/mq/ice_doukutu_scene/gIceCavernNightEntranceTex"
static const ALIGN_ASSET(2) char gIceCavernNightEntranceTex_MQ[] = dgIceCavernNightEntranceTex_MQ;
#define dgIceCavernDayEntranceTex_MQ "__OTR__scenes/mq/ice_doukutu_scene/gIceCavernDayEntranceTex"
static const ALIGN_ASSET(2) char gIceCavernDayEntranceTex_MQ[] = dgIceCavernDayEntranceTex_MQ;
void* sIceCavernEntranceTextures_MQ[] = {
gIceCavernDayEntranceTex_MQ,
gIceCavernNightEntranceTex_MQ,
};
#define dgGTGDayEntranceTex_MQ "__OTR__scenes/mq/men_scene/gGTGDayEntranceTex"
static const ALIGN_ASSET(2) char gGTGDayEntranceTex_MQ[] = dgGTGDayEntranceTex_MQ;
#define dgGTGNightEntranceTex_MQ "__OTR__scenes/mq/men_scene/gGTGNightEntranceTex"
static const ALIGN_ASSET(2) char gGTGNightEntranceTex_MQ[] = dgGTGNightEntranceTex_MQ;
void* sGTGEntranceTextures_MQ[] = {
gGTGDayEntranceTex_MQ,
gGTGNightEntranceTex_MQ,
};
#define dgForestTempleDayEntranceTex_MQ "__OTR__scenes/mq/Bmori1_scene/gForestTempleDayEntranceTex"
static const ALIGN_ASSET(2) char gForestTempleDayEntranceTex_MQ[] = dgForestTempleDayEntranceTex_MQ;
#define dgForestTempleNightEntranceTex_MQ "__OTR__scenes/mq/Bmori1_scene/gForestTempleNightEntranceTex"
static const ALIGN_ASSET(2) char gForestTempleNightEntranceTex_MQ[] = dgForestTempleNightEntranceTex_MQ;
void* sForestTempleEntranceTextures_MQ[] = {
gForestTempleDayEntranceTex_MQ,
gForestTempleNightEntranceTex_MQ,
};
#define dgSpiritTempleDayEntranceTex_MQ "__OTR__scenes/mq/jyasinzou_scene/gSpiritTempleDayEntranceTex"
static const ALIGN_ASSET(2) char gSpiritTempleDayEntranceTex_MQ[] = dgSpiritTempleDayEntranceTex_MQ;
#define dgSpiritTempleNightEntranceTex_MQ "__OTR__scenes/mq/jyasinzou_scene/gSpiritTempleNightEntranceTex"
static const ALIGN_ASSET(2) char gSpiritTempleNightEntranceTex_MQ[] = dgSpiritTempleNightEntranceTex_MQ;
void* sSpiritTempleEntranceTextures_MQ[] = {
gSpiritTempleDayEntranceTex_MQ,
gSpiritTempleNightEntranceTex_MQ,
};
#endif

View file

@ -2,7 +2,7 @@
#include "soh/resource/type/Animation.h"
#include "spdlog/spdlog.h"
namespace Ship {
namespace LUS {
std::shared_ptr<Resource> AnimationFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
@ -25,7 +25,7 @@ std::shared_ptr<Resource> AnimationFactory::ReadResource(std::shared_ptr<Resourc
return resource;
}
void Ship::AnimationFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) {
void LUS::AnimationFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) {
std::shared_ptr<Animation> animation = std::static_pointer_cast<Animation>(resource);
ResourceVersionFactory::ParseFileBinary(reader, animation);
@ -102,4 +102,4 @@ void Ship::AnimationFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> rea
SPDLOG_DEBUG("BEYTAH ANIMATION?!");
}
}
} // namespace Ship
} // namespace LUS

View file

@ -3,7 +3,7 @@
#include "Resource.h"
#include "ResourceFactory.h"
namespace Ship {
namespace LUS {
class AnimationFactory : public ResourceFactory {
public:
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
@ -15,4 +15,4 @@ class AnimationFactoryV0 : public ResourceVersionFactory {
public:
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
};
}; // namespace Ship
}; // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/type/AudioSample.h"
#include "spdlog/spdlog.h"
namespace Ship {
namespace LUS {
std::shared_ptr<Resource> AudioSampleFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
@ -25,7 +25,7 @@ std::shared_ptr<Resource> AudioSampleFactory::ReadResource(std::shared_ptr<Resou
return resource;
}
void Ship::AudioSampleFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
void LUS::AudioSampleFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<AudioSample> audioSample = std::static_pointer_cast<AudioSample>(resource);
@ -67,7 +67,7 @@ void Ship::AudioSampleFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> r
audioSample->book.book = audioSample->bookData.data();
audioSample->sample.book = &audioSample->book;
}
} // namespace Ship
} // namespace LUS
/*
@ -90,7 +90,7 @@ extern "C" SoundFontSample* ReadCustomSample(const char* path) {
ExtensionEntry entry = ExtensionCache[path];
auto sampleRaw = OTRGlobals::Instance->context->GetResourceManager()->LoadFile(entry.path);
auto sampleRaw = LUS::Context::GetInstance()->GetResourceManager()->LoadFile(entry.path);
uint32_t* strem = (uint32_t*)sampleRaw->Buffer.get();
uint8_t* strem2 = (uint8_t*)strem;

View file

@ -3,7 +3,7 @@
#include "Resource.h"
#include "ResourceFactory.h"
namespace Ship {
namespace LUS {
class AudioSampleFactory : public ResourceFactory
{
public:
@ -17,4 +17,4 @@ class AudioSampleFactoryV0 : public ResourceVersionFactory
public:
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
};
}; // namespace Ship
}; // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/type/AudioSequence.h"
#include "spdlog/spdlog.h"
namespace Ship {
namespace LUS {
std::shared_ptr<Resource> AudioSequenceFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
@ -18,7 +18,7 @@ std::shared_ptr<Resource> AudioSequenceFactory::ReadResource(std::shared_ptr<Res
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load AudioSequence with version {}", resource->InitData->ResourceVersion);
return nullptr;
return nullptr;
}
factory->ParseFileBinary(reader, resource);
@ -26,7 +26,7 @@ std::shared_ptr<Resource> AudioSequenceFactory::ReadResource(std::shared_ptr<Res
return resource;
}
void Ship::AudioSequenceFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
void LUS::AudioSequenceFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource) {
std::shared_ptr<AudioSequence> audioSequence = std::static_pointer_cast<AudioSequence>(resource);
ResourceVersionFactory::ParseFileBinary(reader, audioSequence);
@ -50,4 +50,4 @@ void Ship::AudioSequenceFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader>
audioSequence->sequence.fonts[i] = reader->ReadUByte();
}
}
} // namespace Ship
} // namespace LUS

View file

@ -3,7 +3,7 @@
#include "Resource.h"
#include "ResourceFactory.h"
namespace Ship {
namespace LUS {
class AudioSequenceFactory : public ResourceFactory
{
public:
@ -17,4 +17,4 @@ class AudioSequenceFactoryV0 : public ResourceVersionFactory
public:
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
};
}; // namespace Ship
}; // namespace LUS

View file

@ -1,9 +1,9 @@
#include "soh/resource/importer/AudioSoundFontFactory.h"
#include "soh/resource/type/AudioSoundFont.h"
#include "spdlog/spdlog.h"
#include "libultraship/bridge.h"
#include "libultraship/libultraship.h"
namespace Ship {
namespace LUS {
std::shared_ptr<Resource> AudioSoundFontFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
@ -19,7 +19,7 @@ std::shared_ptr<Resource> AudioSoundFontFactory::ReadResource(std::shared_ptr<Re
if (factory == nullptr)
{
SPDLOG_ERROR("Failed to load AudioSoundFont with version {}", resource->InitData->ResourceVersion);
return nullptr;
return nullptr;
}
factory->ParseFileBinary(reader, resource);
@ -27,7 +27,7 @@ std::shared_ptr<Resource> AudioSoundFontFactory::ReadResource(std::shared_ptr<Re
return resource;
}
void Ship::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
void LUS::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource) {
std::shared_ptr<AudioSoundFont> audioSoundFont = std::static_pointer_cast<AudioSoundFont>(resource);
ResourceVersionFactory::ParseFileBinary(reader, audioSoundFont);
@ -87,7 +87,8 @@ void Ship::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader
if (sampleFileName.empty()) {
drum.sound.sample = nullptr;
} else {
drum.sound.sample = static_cast<Sample*>(GetResourceDataByName(sampleFileName.c_str(), true));
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str());
drum.sound.sample = static_cast<Sample*>(res ? res->GetPointer() : nullptr);
}
audioSoundFont->drums.push_back(drum);
@ -130,7 +131,8 @@ void Ship::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader
bool hasSampleRef = reader->ReadInt8();
std::string sampleFileName = reader->ReadString();
instrument.lowNotesSound.tuning = reader->ReadFloat();
instrument.lowNotesSound.sample = static_cast<Sample*>(GetResourceDataByName(sampleFileName.c_str(), true));
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str());
instrument.lowNotesSound.sample = static_cast<Sample*>(res ? res->GetPointer() : nullptr);
} else {
instrument.lowNotesSound.sample = nullptr;
instrument.lowNotesSound.tuning = 0;
@ -141,7 +143,8 @@ void Ship::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader
bool hasSampleRef = reader->ReadInt8();
std::string sampleFileName = reader->ReadString();
instrument.normalNotesSound.tuning = reader->ReadFloat();
instrument.normalNotesSound.sample = static_cast<Sample*>(GetResourceDataByName(sampleFileName.c_str(), true));
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str());
instrument.normalNotesSound.sample = static_cast<Sample*>(res ? res->GetPointer() : nullptr);
} else {
instrument.normalNotesSound.sample = nullptr;
instrument.normalNotesSound.tuning = 0;
@ -152,7 +155,8 @@ void Ship::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader
bool hasSampleRef = reader->ReadInt8();
std::string sampleFileName = reader->ReadString();
instrument.highNotesSound.tuning = reader->ReadFloat();
instrument.highNotesSound.sample = static_cast<Sample*>(GetResourceDataByName(sampleFileName.c_str(), true));
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str());
instrument.highNotesSound.sample = static_cast<Sample*>(res ? res->GetPointer() : nullptr);
} else {
instrument.highNotesSound.sample = nullptr;
instrument.highNotesSound.tuning = 0;
@ -176,11 +180,12 @@ void Ship::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader
bool hasSampleRef = reader->ReadInt8();
std::string sampleFileName = reader->ReadString();
soundEffect.tuning = reader->ReadFloat();
soundEffect.sample = static_cast<Sample*>(GetResourceDataByName(sampleFileName.c_str(), true));
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str());
soundEffect.sample = static_cast<Sample*>(res ? res->GetPointer() : nullptr);
}
audioSoundFont->soundEffects.push_back(soundEffect);
}
audioSoundFont->soundFont.soundEffects = audioSoundFont->soundEffects.data();
}
} // namespace Ship
} // namespace LUS

View file

@ -3,7 +3,7 @@
#include "Resource.h"
#include "ResourceFactory.h"
namespace Ship {
namespace LUS {
class AudioSoundFontFactory : public ResourceFactory
{
public:
@ -17,4 +17,4 @@ class AudioSoundFontFactoryV0 : public ResourceVersionFactory
public:
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
};
}; // namespace Ship
}; // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/type/Background.h"
#include "spdlog/spdlog.h"
namespace Ship {
namespace LUS {
std::shared_ptr<Resource> BackgroundFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
@ -37,4 +37,4 @@ void BackgroundFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
background->Data.push_back(reader->ReadUByte());
}
}
} // namespace Ship
} // namespace LUS

View file

@ -3,7 +3,7 @@
#include "resource/Resource.h"
#include "resource/ResourceFactory.h"
namespace Ship {
namespace LUS {
class BackgroundFactory : public ResourceFactory {
public:
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
@ -15,4 +15,4 @@ class BackgroundFactoryV0 : public ResourceVersionFactory {
public:
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
};
}; // namespace Ship
}; // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/type/CollisionHeader.h"
#include "spdlog/spdlog.h"
namespace Ship {
namespace LUS {
std::shared_ptr<Resource> CollisionHeaderFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
@ -11,13 +11,13 @@ std::shared_ptr<Resource> CollisionHeaderFactory::ReadResource(std::shared_ptr<R
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<CollisionHeaderFactoryV0>();
break;
factory = std::make_shared<CollisionHeaderFactoryV0>();
break;
}
if (factory == nullptr) {
SPDLOG_ERROR("Failed to load Collision Header with version {}", resource->InitData->ResourceVersion);
return nullptr;
return nullptr;
}
factory->ParseFileBinary(reader, resource);
@ -25,7 +25,7 @@ std::shared_ptr<Resource> CollisionHeaderFactory::ReadResource(std::shared_ptr<R
return resource;
}
void Ship::CollisionHeaderFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
void LUS::CollisionHeaderFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<CollisionHeader> collisionHeader = std::static_pointer_cast<CollisionHeader>(resource);

View file

@ -3,7 +3,7 @@
#include "Resource.h"
#include "ResourceFactory.h"
namespace Ship {
namespace LUS {
class CollisionHeaderFactory : public ResourceFactory {
public:
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
@ -15,4 +15,4 @@ class CollisionHeaderFactoryV0 : public ResourceVersionFactory {
public:
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
};
}; // namespace Ship
}; // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/type/Cutscene.h"
#include "spdlog/spdlog.h"
namespace Ship {
namespace LUS {
std::shared_ptr<Resource> CutsceneFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
@ -37,7 +37,7 @@ static inline uint32_t read_CMD_BBH(std::shared_ptr<BinaryReader> reader) {
reader->Read((char*)&v, sizeof(uint32_t));
// swap the half word to match endianness
if (reader->GetEndianness() != Ship::Endianness::Native) {
if (reader->GetEndianness() != LUS::Endianness::Native) {
uint8_t* b = (uint8_t*)&v;
uint8_t tmp = b[2];
b[2] = b[3];
@ -52,7 +52,7 @@ static inline uint32_t read_CMD_HBB(std::shared_ptr<BinaryReader> reader) {
reader->Read((char*)&v, sizeof(uint32_t));
// swap the half word to match endianness
if (reader->GetEndianness() != Ship::Endianness::Native) {
if (reader->GetEndianness() != LUS::Endianness::Native) {
uint8_t* b = (uint8_t*)&v;
uint8_t tmp = b[0];
b[0] = b[1];
@ -67,7 +67,7 @@ static inline uint32_t read_CMD_HH(std::shared_ptr<BinaryReader> reader) {
reader->Read((char*)&v, sizeof(uint32_t));
// swap the half words to match endianness
if (reader->GetEndianness() != Ship::Endianness::Native) {
if (reader->GetEndianness() != LUS::Endianness::Native) {
uint8_t* b = (uint8_t*)&v;
uint8_t tmp = b[0];
b[0] = b[1];
@ -80,7 +80,7 @@ static inline uint32_t read_CMD_HH(std::shared_ptr<BinaryReader> reader) {
return v;
}
void Ship::CutsceneFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
void LUS::CutsceneFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<Cutscene> cutscene = std::static_pointer_cast<Cutscene>(resource);
@ -469,4 +469,4 @@ void Ship::CutsceneFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> read
}
}
}
} // namespace Ship
} // namespace LUS

View file

@ -3,7 +3,7 @@
#include "Resource.h"
#include "ResourceFactory.h"
namespace Ship {
namespace LUS {
class CutsceneFactory : public ResourceFactory
{
public:
@ -17,4 +17,4 @@ class CutsceneFactoryV0 : public ResourceVersionFactory
public:
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
};
}; // namespace Ship
}; // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/type/Path.h"
#include "spdlog/spdlog.h"
namespace Ship {
namespace LUS {
std::shared_ptr<Resource> PathFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
@ -25,7 +25,7 @@ std::shared_ptr<Resource> PathFactory::ReadResource(std::shared_ptr<ResourceMana
return resource;
}
void Ship::PathFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
void LUS::PathFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource) {
std::shared_ptr<Path> path = std::static_pointer_cast<Path>(resource);
ResourceVersionFactory::ParseFileBinary(reader, path);
@ -54,4 +54,4 @@ void Ship::PathFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
path->pathData.push_back(pathDataEntry);
}
}
} // namespace Ship
} // namespace LUS

View file

@ -3,7 +3,7 @@
#include "Resource.h"
#include "ResourceFactory.h"
namespace Ship {
namespace LUS {
class PathFactory : public ResourceFactory
{
public:
@ -17,4 +17,4 @@ class PathFactoryV0 : public ResourceVersionFactory
public:
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
};
}; // namespace Ship
}; // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/type/PlayerAnimation.h"
#include "spdlog/spdlog.h"
namespace Ship {
namespace LUS {
std::shared_ptr<Resource> PlayerAnimationFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
@ -26,7 +26,7 @@ std::shared_ptr<Resource> PlayerAnimationFactory::ReadResource(std::shared_ptr<R
return resource;
}
void Ship::PlayerAnimationFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
void LUS::PlayerAnimationFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<PlayerAnimation> playerAnimation = std::static_pointer_cast<PlayerAnimation>(resource);
@ -39,4 +39,4 @@ void Ship::PlayerAnimationFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReade
playerAnimation->limbRotData.push_back(reader->ReadInt16());
}
}
} // namespace Ship
} // namespace LUS

View file

@ -3,7 +3,7 @@
#include "Resource.h"
#include "ResourceFactory.h"
namespace Ship {
namespace LUS {
class PlayerAnimationFactory : public ResourceFactory {
public:
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
@ -15,4 +15,4 @@ class PlayerAnimationFactoryV0 : public ResourceVersionFactory {
public:
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
};
}; // namespace Ship
}; // namespace LUS

View file

@ -28,37 +28,37 @@
#include "soh/resource/importer/scenecommand/SetLightListFactory.h"
#include "soh/resource/importer/scenecommand/SetMeshFactory.h"
namespace Ship {
namespace LUS {
std::shared_ptr<Resource> SceneFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
if (SceneFactory::sceneCommandFactories.empty()) {
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetLightingSettings] = std::make_shared<SetLightingSettingsFactory>();
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetWind] = std::make_shared<SetWindSettingsFactory>();
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetExitList] = std::make_shared<SetExitListFactory>();
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetTimeSettings] = std::make_shared<SetTimeSettingsFactory>();
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetSkyboxModifier] = std::make_shared<SetSkyboxModifierFactory>();
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetEchoSettings] = std::make_shared<SetEchoSettingsFactory>();
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetSoundSettings] = std::make_shared<SetSoundSettingsFactory>();
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetSkyboxSettings] = std::make_shared<SetSkyboxSettingsFactory>();
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetRoomBehavior] = std::make_shared<SetRoomBehaviorFactory>();
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetCsCamera] = std::make_shared<SetCsCameraFactory>();
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetCameraSettings] = std::make_shared<SetCameraSettingsFactory>();
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetRoomList] = std::make_shared<SetRoomListFactory>();
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetCollisionHeader] = std::make_shared<SetCollisionHeaderFactory>();
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetEntranceList] = std::make_shared<SetEntranceListFactory>();
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetSpecialObjects] = std::make_shared<SetSpecialObjectsFactory>();
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetObjectList] = std::make_shared<SetObjectListFactory>();
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetStartPositionList] = std::make_shared<SetStartPositionListFactory>();
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetActorList] = std::make_shared<SetActorListFactory>();
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetTransitionActorList] = std::make_shared<SetTransitionActorListFactory>();
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::EndMarker] = std::make_shared<EndMarkerFactory>();
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetAlternateHeaders] = std::make_shared<SetAlternateHeadersFactory>();
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetPathways] = std::make_shared<SetPathwaysFactory>();
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetCutscenes] = std::make_shared<SetCutscenesFactory>();
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetLightList] = std::make_shared<SetLightListFactory>();
SceneFactory::sceneCommandFactories[Ship::SceneCommandID::SetMesh] = std::make_shared<SetMeshFactory>();
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetLightingSettings] = std::make_shared<SetLightingSettingsFactory>();
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetWind] = std::make_shared<SetWindSettingsFactory>();
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetExitList] = std::make_shared<SetExitListFactory>();
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetTimeSettings] = std::make_shared<SetTimeSettingsFactory>();
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetSkyboxModifier] = std::make_shared<SetSkyboxModifierFactory>();
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetEchoSettings] = std::make_shared<SetEchoSettingsFactory>();
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetSoundSettings] = std::make_shared<SetSoundSettingsFactory>();
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetSkyboxSettings] = std::make_shared<SetSkyboxSettingsFactory>();
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetRoomBehavior] = std::make_shared<SetRoomBehaviorFactory>();
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetCsCamera] = std::make_shared<SetCsCameraFactory>();
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetCameraSettings] = std::make_shared<SetCameraSettingsFactory>();
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetRoomList] = std::make_shared<SetRoomListFactory>();
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetCollisionHeader] = std::make_shared<SetCollisionHeaderFactory>();
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetEntranceList] = std::make_shared<SetEntranceListFactory>();
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetSpecialObjects] = std::make_shared<SetSpecialObjectsFactory>();
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetObjectList] = std::make_shared<SetObjectListFactory>();
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetStartPositionList] = std::make_shared<SetStartPositionListFactory>();
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetActorList] = std::make_shared<SetActorListFactory>();
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetTransitionActorList] = std::make_shared<SetTransitionActorListFactory>();
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::EndMarker] = std::make_shared<EndMarkerFactory>();
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetAlternateHeaders] = std::make_shared<SetAlternateHeadersFactory>();
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetPathways] = std::make_shared<SetPathwaysFactory>();
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetCutscenes] = std::make_shared<SetCutscenesFactory>();
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetLightList] = std::make_shared<SetLightListFactory>();
SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetMesh] = std::make_shared<SetMeshFactory>();
}
auto resource = std::make_shared<Scene>(resourceMgr, initData);
@ -124,4 +124,4 @@ std::shared_ptr<SceneCommand> SceneFactoryV0::ParseSceneCommand(std::shared_ptr<
return result;
}
} // namespace Ship
} // namespace LUS

View file

@ -6,7 +6,7 @@
#include "Resource.h"
#include "ResourceFactory.h"
namespace Ship {
namespace LUS {
class SceneFactory : public ResourceFactory {
public:
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
@ -27,4 +27,4 @@ class SceneFactoryV0 : public ResourceVersionFactory {
protected:
std::shared_ptr<SceneCommand> ParseSceneCommand(std::shared_ptr<Scene> scene, std::shared_ptr<BinaryReader> reader, uint32_t index);
};
}; // namespace Ship
}; // namespace LUS

View file

@ -1,9 +1,9 @@
#include "soh/resource/importer/SkeletonFactory.h"
#include "soh/resource/type/Skeleton.h"
#include <spdlog/spdlog.h>
#include <libultraship/bridge.h>
#include <libultraship/libultraship.h>
namespace Ship {
namespace LUS {
std::shared_ptr<Resource> SkeletonFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
@ -32,8 +32,8 @@ std::shared_ptr<Resource> SkeletonFactory::ReadResourceXML(std::shared_ptr<Resou
auto resource = std::make_shared<Skeleton>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch ((Version)resource->InitData->ResourceVersion) {
case Version::Deckard:
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<SkeletonFactoryV0>();
break;
}
@ -68,32 +68,32 @@ void SkeletonFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
skeleton->limbTable.push_back(limbPath);
}
if (skeleton->type == Ship::SkeletonType::Curve) {
if (skeleton->type == LUS::SkeletonType::Curve) {
skeleton->skeletonData.skelCurveLimbList.limbCount = skeleton->limbCount;
skeleton->curveLimbArray.reserve(skeleton->skeletonData.skelCurveLimbList.limbCount);
} else if (skeleton->type == Ship::SkeletonType::Flex) {
} else if (skeleton->type == LUS::SkeletonType::Flex) {
skeleton->skeletonData.flexSkeletonHeader.dListCount = skeleton->dListCount;
}
if (skeleton->type == Ship::SkeletonType::Normal) {
if (skeleton->type == LUS::SkeletonType::Normal) {
skeleton->skeletonData.skeletonHeader.limbCount = skeleton->limbCount;
skeleton->standardLimbArray.reserve(skeleton->skeletonData.skeletonHeader.limbCount);
} else if (skeleton->type == Ship::SkeletonType::Flex) {
} else if (skeleton->type == LUS::SkeletonType::Flex) {
skeleton->skeletonData.flexSkeletonHeader.sh.limbCount = skeleton->limbCount;
skeleton->standardLimbArray.reserve(skeleton->skeletonData.flexSkeletonHeader.sh.limbCount);
}
for (size_t i = 0; i < skeleton->limbTable.size(); i++) {
std::string limbStr = skeleton->limbTable[i];
auto limb = GetResourceDataByName(limbStr.c_str(), true);
skeleton->skeletonHeaderSegments.push_back(limb);
auto limb = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(limbStr.c_str());
skeleton->skeletonHeaderSegments.push_back(limb ? limb->GetPointer() : nullptr);
}
if (skeleton->type == Ship::SkeletonType::Normal) {
if (skeleton->type == LUS::SkeletonType::Normal) {
skeleton->skeletonData.skeletonHeader.segment = (void**)skeleton->skeletonHeaderSegments.data();
} else if (skeleton->type == Ship::SkeletonType::Flex) {
} else if (skeleton->type == LUS::SkeletonType::Flex) {
skeleton->skeletonData.flexSkeletonHeader.sh.segment = (void**)skeleton->skeletonHeaderSegments.data();
} else if (skeleton->type == Ship::SkeletonType::Curve) {
} else if (skeleton->type == LUS::SkeletonType::Curve) {
skeleton->skeletonData.skelCurveLimbList.limbs = (SkelCurveLimb**)skeleton->skeletonHeaderSegments.data();
} else {
SPDLOG_ERROR("unknown skeleton type {}", (uint32_t)skeleton->type);
@ -142,8 +142,8 @@ void SkeletonFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_p
std::string limbName = child->Attribute("Path");
skel->limbTable.push_back(limbName);
auto limb = GetResourceDataByName(limbName.c_str(), true);
skel->skeletonHeaderSegments.push_back(limb);
auto limb = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(limbName.c_str());
skel->skeletonHeaderSegments.push_back(limb ? limb->GetPointer() : nullptr);
}
child = child->NextSiblingElement();
@ -154,4 +154,4 @@ void SkeletonFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_p
skel->skeletonData.flexSkeletonHeader.dListCount = skel->dListCount;
}
} // namespace Ship
} // namespace LUS

View file

@ -3,7 +3,7 @@
#include "Resource.h"
#include "ResourceFactory.h"
namespace Ship {
namespace LUS {
class SkeletonFactory : public ResourceFactory
{
public:
@ -21,5 +21,5 @@ class SkeletonFactoryV0 : public ResourceVersionFactory
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
void ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr<Resource> resource) override;
};
}; // namespace Ship
}; // namespace LUS

View file

@ -1,9 +1,9 @@
#include "soh/resource/importer/SkeletonLimbFactory.h"
#include "soh/resource/type/SkeletonLimb.h"
#include "spdlog/spdlog.h"
#include "libultraship/bridge.h"
#include "libultraship/libultraship.h"
namespace Ship {
namespace LUS {
std::shared_ptr<Resource> SkeletonLimbFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
@ -32,8 +32,8 @@ std::shared_ptr<Resource> SkeletonLimbFactory::ReadResourceXML(std::shared_ptr<R
auto resource = std::make_shared<SkeletonLimb>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch ((Version)resource->InitData->ResourceVersion) {
case Version::Deckard:
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<SkeletonLimbFactoryV0>();
break;
}
@ -48,7 +48,7 @@ std::shared_ptr<Resource> SkeletonLimbFactory::ReadResourceXML(std::shared_ptr<R
return resource;
}
void Ship::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<SkeletonLimb> skeletonLimb = std::static_pointer_cast<SkeletonLimb>(resource);
@ -126,7 +126,7 @@ void Ship::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader>
skeletonLimb->childIndex = reader->ReadUByte();
skeletonLimb->siblingIndex = reader->ReadUByte();
if (skeletonLimb->limbType == Ship::LimbType::LOD) {
if (skeletonLimb->limbType == LUS::LimbType::LOD) {
skeletonLimb->limbData.lodLimb.jointPos.x = skeletonLimb->transX;
skeletonLimb->limbData.lodLimb.jointPos.y = skeletonLimb->transY;
skeletonLimb->limbData.lodLimb.jointPos.z = skeletonLimb->transZ;
@ -134,19 +134,19 @@ void Ship::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader>
skeletonLimb->limbData.lodLimb.sibling = skeletonLimb->siblingIndex;
if (skeletonLimb->dListPtr != "") {
auto dList = GetResourceDataByName(skeletonLimb->dListPtr.c_str(), true);
skeletonLimb->limbData.lodLimb.dLists[0] = (Gfx*)dList;
auto dList = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dListPtr.c_str());
skeletonLimb->limbData.lodLimb.dLists[0] = (Gfx*)(dList ? dList->GetPointer() : nullptr);
} else {
skeletonLimb->limbData.lodLimb.dLists[0] = nullptr;
}
if (skeletonLimb->dList2Ptr != "") {
auto dList = GetResourceDataByName(skeletonLimb->dList2Ptr.c_str(), true);
skeletonLimb->limbData.lodLimb.dLists[1] = (Gfx*)dList;
auto dList = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dList2Ptr.c_str());
skeletonLimb->limbData.lodLimb.dLists[1] = (Gfx*)(dList ? dList->GetPointer() : nullptr);
} else {
skeletonLimb->limbData.lodLimb.dLists[1] = nullptr;
}
} else if (skeletonLimb->limbType == Ship::LimbType::Standard) {
} else if (skeletonLimb->limbType == LUS::LimbType::Standard) {
skeletonLimb->limbData.standardLimb.jointPos.x = skeletonLimb->transX;
skeletonLimb->limbData.standardLimb.jointPos.y = skeletonLimb->transY;
skeletonLimb->limbData.standardLimb.jointPos.z = skeletonLimb->transZ;
@ -155,48 +155,50 @@ void Ship::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader>
skeletonLimb->limbData.standardLimb.dList = nullptr;
if (!skeletonLimb->dListPtr.empty()) {
const auto dList = GetResourceDataByName(skeletonLimb->dListPtr.c_str(), true);
skeletonLimb->limbData.standardLimb.dList = (Gfx*)dList;
const auto dList = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dListPtr.c_str());
skeletonLimb->limbData.standardLimb.dList = (Gfx*)(dList ? dList->GetPointer() : nullptr);
}
} else if (skeletonLimb->limbType == Ship::LimbType::Curve) {
} else if (skeletonLimb->limbType == LUS::LimbType::Curve) {
skeletonLimb->limbData.skelCurveLimb.firstChildIdx = skeletonLimb->childIndex;
skeletonLimb->limbData.skelCurveLimb.nextLimbIdx = skeletonLimb->siblingIndex;
skeletonLimb->limbData.skelCurveLimb.dList[0] = nullptr;
skeletonLimb->limbData.skelCurveLimb.dList[1] = nullptr;
if (!skeletonLimb->dListPtr.empty()) {
const auto dList = GetResourceDataByName(skeletonLimb->dListPtr.c_str(), true);
skeletonLimb->limbData.skelCurveLimb.dList[0] = (Gfx*)dList;
const auto dList = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dListPtr.c_str());
skeletonLimb->limbData.skelCurveLimb.dList[0] = (Gfx*)(dList ? dList->GetPointer() : nullptr);
}
if (!skeletonLimb->dList2Ptr.empty()) {
const auto dList = GetResourceDataByName(skeletonLimb->dList2Ptr.c_str(), true);
skeletonLimb->limbData.skelCurveLimb.dList[1] = (Gfx*)dList;
const auto dList = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dList2Ptr.c_str());
skeletonLimb->limbData.skelCurveLimb.dList[1] = (Gfx*)(dList ? dList->GetPointer() : nullptr);
}
} else if (skeletonLimb->limbType == Ship::LimbType::Skin) {
} else if (skeletonLimb->limbType == LUS::LimbType::Skin) {
skeletonLimb->limbData.skinLimb.jointPos.x = skeletonLimb->transX;
skeletonLimb->limbData.skinLimb.jointPos.y = skeletonLimb->transY;
skeletonLimb->limbData.skinLimb.jointPos.z = skeletonLimb->transZ;
skeletonLimb->limbData.skinLimb.child = skeletonLimb->childIndex;
skeletonLimb->limbData.skinLimb.sibling = skeletonLimb->siblingIndex;
if (skeletonLimb->skinSegmentType == Ship::ZLimbSkinType::SkinType_DList) {
if (skeletonLimb->skinSegmentType == LUS::ZLimbSkinType::SkinType_DList) {
skeletonLimb->limbData.skinLimb.segmentType = static_cast<int32_t>(skeletonLimb->skinSegmentType);
} else if (skeletonLimb->skinSegmentType == Ship::ZLimbSkinType::SkinType_4) {
} else if (skeletonLimb->skinSegmentType == LUS::ZLimbSkinType::SkinType_4) {
skeletonLimb->limbData.skinLimb.segmentType = 4;
} else if (skeletonLimb->skinSegmentType == Ship::ZLimbSkinType::SkinType_5) {
} else if (skeletonLimb->skinSegmentType == LUS::ZLimbSkinType::SkinType_5) {
skeletonLimb->limbData.skinLimb.segmentType = 5;
} else {
skeletonLimb->limbData.skinLimb.segmentType = 0;
}
if (skeletonLimb->skinSegmentType == Ship::ZLimbSkinType::SkinType_DList) {
skeletonLimb->limbData.skinLimb.segment = GetResourceDataByName(skeletonLimb->skinDList.c_str(), true);
} else if (skeletonLimb->skinSegmentType == Ship::ZLimbSkinType::SkinType_4) {
if (skeletonLimb->skinSegmentType == LUS::ZLimbSkinType::SkinType_DList) {
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->skinDList.c_str());
skeletonLimb->limbData.skinLimb.segment = res ? res->GetPointer() : nullptr;
} else if (skeletonLimb->skinSegmentType == LUS::ZLimbSkinType::SkinType_4) {
skeletonLimb->skinAnimLimbData.totalVtxCount = skeletonLimb->skinVtxCnt;
skeletonLimb->skinAnimLimbData.limbModifCount = skeletonLimb->skinLimbModifCount;
skeletonLimb->skinAnimLimbData.limbModifications = skeletonLimb->skinLimbModifArray.data();
skeletonLimb->skinAnimLimbData.dlist = (Gfx*)GetResourceDataByName(skeletonLimb->skinDList2.c_str(), true);
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->skinDList2.c_str());
skeletonLimb->skinAnimLimbData.dlist = (Gfx*)(res ? res->GetPointer() : nullptr);
for (size_t i = 0; i < skeletonLimb->skinLimbModifArray.size(); i++) {
skeletonLimb->skinAnimLimbData.limbModifications[i].vtxCount = skeletonLimb->skinLimbModifVertexArrays[i].size();
@ -254,7 +256,8 @@ void SkeletonLimbFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shar
limbData.lodLimb.jointPos.z = skelLimb->transZ;
if (skelLimb->dListPtr != "") {
limbData.lodLimb.dLists[0] = (Gfx*)GetResourceDataByName((const char*)skelLimb->dListPtr.c_str(), true);
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess((const char*)skelLimb->dListPtr.c_str());
limbData.lodLimb.dLists[0] = (Gfx*)(res ? res->GetPointer() : nullptr);
} else {
limbData.lodLimb.dLists[0] = nullptr;
}
@ -267,4 +270,4 @@ void SkeletonLimbFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shar
// skelLimb->dList2Ptr = reader->Attribute("DisplayList2");
}
} // namespace Ship
} // namespace LUS

View file

@ -3,7 +3,7 @@
#include "Resource.h"
#include "ResourceFactory.h"
namespace Ship {
namespace LUS {
class SkeletonLimbFactory : public ResourceFactory
{
public:
@ -21,5 +21,5 @@ class SkeletonLimbFactoryV0 : public ResourceVersionFactory
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
void ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr<Resource> resource) override;
};
}; // namespace Ship
}; // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/type/Text.h"
#include "spdlog/spdlog.h"
namespace Ship {
namespace LUS {
std::shared_ptr<Resource> TextFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
@ -34,8 +34,8 @@ std::shared_ptr<Resource> TextFactory::ReadResourceXML(std::shared_ptr<ResourceM
auto resource = std::make_shared<Text>(resourceMgr, initData);
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
switch ((Version)resource->InitData->ResourceVersion) {
case Version::Deckard:
switch (resource->InitData->ResourceVersion) {
case 0:
factory = std::make_shared<TextFactoryV0>();
break;
}
@ -50,7 +50,7 @@ std::shared_ptr<Resource> TextFactory::ReadResourceXML(std::shared_ptr<ResourceM
return resource;
}
void Ship::TextFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
void LUS::TextFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource) {
std::shared_ptr<Text> text = std::static_pointer_cast<Text>(resource);
ResourceVersionFactory::ParseFileBinary(reader, text);
@ -92,4 +92,4 @@ void TextFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr<R
}
}
} // namespace Ship
} // namespace LUS

View file

@ -3,7 +3,7 @@
#include "Resource.h"
#include "ResourceFactory.h"
namespace Ship {
namespace LUS {
class TextFactory : public ResourceFactory
{
public:
@ -21,5 +21,5 @@ class TextFactoryV0 : public ResourceVersionFactory
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
void ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr<Resource> resource) override;
};
}; // namespace Ship
}; // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/type/scenecommand/EndMarker.h"
#include "spdlog/spdlog.h"
namespace Ship {
namespace LUS {
std::shared_ptr<Resource> EndMarkerFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
@ -25,7 +25,7 @@ std::shared_ptr<Resource> EndMarkerFactory::ReadResource(std::shared_ptr<Resourc
return resource;
}
void Ship::EndMarkerFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
void LUS::EndMarkerFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<EndMarker> endMarker = std::static_pointer_cast<EndMarker>(resource);
@ -36,4 +36,4 @@ void Ship::EndMarkerFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> rea
// This has no data.
}
} // namespace Ship
} // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
namespace Ship {
namespace LUS {
class EndMarkerFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
@ -14,4 +14,4 @@ class EndMarkerFactoryV0 : public SceneCommandVersionFactory {
public:
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
};
}; // namespace Ship
}; // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/type/scenecommand/SceneCommand.h"
#include "spdlog/spdlog.h"
namespace Ship {
namespace LUS {
void SceneCommandVersionFactory::ReadCommandId(std::shared_ptr<SceneCommand> command, std::shared_ptr<BinaryReader> reader) {
command->cmdId = (SceneCommandID)reader->ReadInt32();
}

View file

@ -5,11 +5,11 @@
#include "ResourceFactory.h"
#include "soh/resource/type/scenecommand/SceneCommand.h"
namespace Ship {
namespace LUS {
class SceneCommandFactory : public ResourceFactory {};
class SceneCommandVersionFactory : public ResourceVersionFactory {
protected:
void ReadCommandId(std::shared_ptr<SceneCommand> command, std::shared_ptr<BinaryReader> reader);
};
}; // namespace Ship
}; // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/type/scenecommand/SetActorList.h"
#include "spdlog/spdlog.h"
namespace Ship {
namespace LUS {
std::shared_ptr<Resource> SetActorListFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
@ -26,7 +26,7 @@ std::shared_ptr<Resource> SetActorListFactory::ReadResource(std::shared_ptr<Reso
return resource;
}
void Ship::SetActorListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
void LUS::SetActorListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource) {
std::shared_ptr<SetActorList> setActorList = std::static_pointer_cast<SetActorList>(resource);
ResourceVersionFactory::ParseFileBinary(reader, setActorList);
@ -51,4 +51,4 @@ void Ship::SetActorListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader>
}
}
} // namespace Ship
} // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
namespace Ship {
namespace LUS {
class SetActorListFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
@ -14,4 +14,4 @@ class SetActorListFactoryV0 : public SceneCommandVersionFactory {
public:
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
};
}; // namespace Ship
}; // namespace LUS

View file

@ -1,9 +1,9 @@
#include "soh/resource/importer/scenecommand/SetAlternateHeadersFactory.h"
#include "soh/resource/type/scenecommand/SetAlternateHeaders.h"
#include "spdlog/spdlog.h"
#include "libultraship/bridge.h"
#include "libultraship/libultraship.h"
namespace Ship {
namespace LUS {
std::shared_ptr<Resource> SetAlternateHeadersFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
@ -27,7 +27,7 @@ std::shared_ptr<Resource> SetAlternateHeadersFactory::ReadResource(std::shared_p
return resource;
}
void Ship::SetAlternateHeadersFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
void LUS::SetAlternateHeadersFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<SetAlternateHeaders> setAlternateHeaders = std::static_pointer_cast<SetAlternateHeaders>(resource);
@ -40,11 +40,11 @@ void Ship::SetAlternateHeadersFactoryV0::ParseFileBinary(std::shared_ptr<BinaryR
for (uint32_t i = 0; i < setAlternateHeaders->numHeaders; i++) {
auto headerName = reader->ReadString();
if (!headerName.empty()) {
setAlternateHeaders->headers.push_back(std::static_pointer_cast<Ship::Scene>(LoadResource(headerName.c_str(), true)));
setAlternateHeaders->headers.push_back(std::static_pointer_cast<LUS::Scene>(LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(headerName.c_str())));
} else {
setAlternateHeaders->headers.push_back(nullptr);
}
}
}
} // namespace Ship
} // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
namespace Ship {
namespace LUS {
class SetAlternateHeadersFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
@ -14,4 +14,4 @@ class SetAlternateHeadersFactoryV0 : public SceneCommandVersionFactory {
public:
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
};
}; // namespace Ship
}; // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/type/scenecommand/SetCameraSettings.h"
#include "spdlog/spdlog.h"
namespace Ship {
namespace LUS {
std::shared_ptr<Resource> SetCameraSettingsFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
@ -25,7 +25,7 @@ std::shared_ptr<Resource> SetCameraSettingsFactory::ReadResource(std::shared_ptr
return resource;
}
void Ship::SetCameraSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
void LUS::SetCameraSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<SetCameraSettings> setCameraSettings = std::static_pointer_cast<SetCameraSettings>(resource);
@ -37,4 +37,4 @@ void Ship::SetCameraSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryRea
setCameraSettings->settings.worldMapArea = reader->ReadInt32();
}
} // namespace Ship
} // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
namespace Ship {
namespace LUS {
class SetCameraSettingsFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
@ -14,4 +14,4 @@ class SetCameraSettingsFactoryV0 : public SceneCommandVersionFactory {
public:
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
};
}; // namespace Ship
}; // namespace LUS

View file

@ -1,9 +1,9 @@
#include "soh/resource/importer/scenecommand/SetCollisionHeaderFactory.h"
#include "soh/resource/type/scenecommand/SetCollisionHeader.h"
#include "libultraship/bridge.h"
#include "libultraship/libultraship.h"
#include "spdlog/spdlog.h"
namespace Ship {
namespace LUS {
std::shared_ptr<Resource> SetCollisionHeaderFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
@ -26,7 +26,7 @@ std::shared_ptr<Resource> SetCollisionHeaderFactory::ReadResource(std::shared_pt
return resource;
}
void Ship::SetCollisionHeaderFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
void LUS::SetCollisionHeaderFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource) {
std::shared_ptr<SetCollisionHeader> setCollisionHeader = std::static_pointer_cast<SetCollisionHeader>(resource);
ResourceVersionFactory::ParseFileBinary(reader, setCollisionHeader);
@ -34,7 +34,7 @@ void Ship::SetCollisionHeaderFactoryV0::ParseFileBinary(std::shared_ptr<BinaryRe
ReadCommandId(setCollisionHeader, reader);
setCollisionHeader->fileName = reader->ReadString();
setCollisionHeader->collisionHeader = std::static_pointer_cast<CollisionHeader>(LoadResource(setCollisionHeader->fileName.c_str(), true));
setCollisionHeader->collisionHeader = std::static_pointer_cast<CollisionHeader>(LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(setCollisionHeader->fileName.c_str()));
}
} // namespace Ship
} // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
namespace Ship {
namespace LUS {
class SetCollisionHeaderFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
@ -14,4 +14,4 @@ class SetCollisionHeaderFactoryV0 : public SceneCommandVersionFactory {
public:
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
};
}; // namespace Ship
}; // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/type/scenecommand/SetCsCamera.h"
#include "spdlog/spdlog.h"
namespace Ship {
namespace LUS {
std::shared_ptr<Resource> SetCsCameraFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
@ -25,7 +25,7 @@ std::shared_ptr<Resource> SetCsCameraFactory::ReadResource(std::shared_ptr<Resou
return resource;
}
void Ship::SetCsCameraFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
void LUS::SetCsCameraFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource) {
std::shared_ptr<SetCsCamera> setCsCamera = std::static_pointer_cast<SetCsCamera>(resource);
ResourceVersionFactory::ParseFileBinary(reader, setCsCamera);
@ -38,4 +38,4 @@ void Ship::SetCsCameraFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> r
// OTRTODO: FINISH!
}
} // namespace Ship
} // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
namespace Ship {
namespace LUS {
class SetCsCameraFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
@ -14,4 +14,4 @@ class SetCsCameraFactoryV0 : public SceneCommandVersionFactory {
public:
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
};
}; // namespace Ship
}; // namespace LUS

View file

@ -1,9 +1,9 @@
#include "soh/resource/importer/scenecommand/SetCutscenesFactory.h"
#include "soh/resource/type/scenecommand/SetCutscenes.h"
#include <libultraship/bridge.h>
#include <libultraship/libultraship.h>
#include "spdlog/spdlog.h"
namespace Ship {
namespace LUS {
std::shared_ptr<Resource> SetCutscenesFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
@ -27,7 +27,7 @@ std::shared_ptr<Resource> SetCutscenesFactory::ReadResource(std::shared_ptr<Reso
return resource;
}
void Ship::SetCutscenesFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
void LUS::SetCutscenesFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource) {
std::shared_ptr<SetCutscenes> setCutscenes = std::static_pointer_cast<SetCutscenes>(resource);
ResourceVersionFactory::ParseFileBinary(reader, setCutscenes);
@ -35,7 +35,7 @@ void Ship::SetCutscenesFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader>
ReadCommandId(setCutscenes, reader);
setCutscenes->fileName = reader->ReadString();
setCutscenes->cutscene = std::static_pointer_cast<Cutscene>(LoadResource(setCutscenes->fileName.c_str(), true));
setCutscenes->cutscene = std::static_pointer_cast<Cutscene>(LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(setCutscenes->fileName.c_str()));
}
} // namespace Ship
} // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
namespace Ship {
namespace LUS {
class SetCutscenesFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
@ -14,4 +14,4 @@ class SetCutscenesFactoryV0 : public SceneCommandVersionFactory {
public:
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
};
}; // namespace Ship
}; // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/type/scenecommand/SetEchoSettings.h"
#include "spdlog/spdlog.h"
namespace Ship {
namespace LUS {
std::shared_ptr<Resource> SetEchoSettingsFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
@ -25,7 +25,7 @@ std::shared_ptr<Resource> SetEchoSettingsFactory::ReadResource(std::shared_ptr<R
return resource;
}
void Ship::SetEchoSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
void LUS::SetEchoSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<SetEchoSettings> setEchoSettings = std::static_pointer_cast<SetEchoSettings>(resource);
@ -36,4 +36,4 @@ void Ship::SetEchoSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReade
setEchoSettings->settings.echo = reader->ReadInt8();
}
} // namespace Ship
} // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
namespace Ship {
namespace LUS {
class SetEchoSettingsFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
@ -14,4 +14,4 @@ class SetEchoSettingsFactoryV0 : public SceneCommandVersionFactory {
public:
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
};
}; // namespace Ship
}; // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/type/scenecommand/SetEntranceList.h"
#include "spdlog/spdlog.h"
namespace Ship {
namespace LUS {
std::shared_ptr<Resource> SetEntranceListFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
@ -25,7 +25,7 @@ std::shared_ptr<Resource> SetEntranceListFactory::ReadResource(std::shared_ptr<R
return resource;
}
void Ship::SetEntranceListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
void LUS::SetEntranceListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource) {
std::shared_ptr<SetEntranceList> setEntranceList = std::static_pointer_cast<SetEntranceList>(resource);
ResourceVersionFactory::ParseFileBinary(reader, setEntranceList);
@ -44,4 +44,4 @@ void Ship::SetEntranceListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReade
}
}
} // namespace Ship
} // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
namespace Ship {
namespace LUS {
class SetEntranceListFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
@ -14,4 +14,4 @@ class SetEntranceListFactoryV0 : public SceneCommandVersionFactory {
public:
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
};
}; // namespace Ship
}; // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/type/scenecommand/SetExitList.h"
#include "spdlog/spdlog.h"
namespace Ship {
namespace LUS {
std::shared_ptr<Resource> SetExitListFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
@ -25,7 +25,7 @@ std::shared_ptr<Resource> SetExitListFactory::ReadResource(std::shared_ptr<Resou
return resource;
}
void Ship::SetExitListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
void LUS::SetExitListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource) {
std::shared_ptr<SetExitList> setExitList = std::static_pointer_cast<SetExitList>(resource);
ResourceVersionFactory::ParseFileBinary(reader, setExitList);
@ -39,4 +39,4 @@ void Ship::SetExitListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> r
}
}
} // namespace Ship
} // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
namespace Ship {
namespace LUS {
class SetExitListFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
@ -14,4 +14,4 @@ class SetExitListFactoryV0 : public SceneCommandVersionFactory {
public:
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
};
}; // namespace Ship
}; // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/type/scenecommand/SetLightList.h"
#include "spdlog/spdlog.h"
namespace Ship {
namespace LUS {
std::shared_ptr<Resource> SetLightListFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
@ -26,7 +26,7 @@ std::shared_ptr<Resource> SetLightListFactory::ReadResource(std::shared_ptr<Reso
return resource;
}
void Ship::SetLightListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
void LUS::SetLightListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<SetLightList> setLightList = std::static_pointer_cast<SetLightList>(resource);
@ -56,4 +56,4 @@ void Ship::SetLightListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader>
}
}
} // namespace Ship
} // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
namespace Ship {
namespace LUS {
class SetLightListFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
@ -14,4 +14,4 @@ class SetLightListFactoryV0 : public SceneCommandVersionFactory {
public:
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
};
}; // namespace Ship
}; // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/type/scenecommand/SetLightingSettings.h"
#include "spdlog/spdlog.h"
namespace Ship {
namespace LUS {
std::shared_ptr<Resource> SetLightingSettingsFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
@ -25,7 +25,7 @@ std::shared_ptr<Resource> SetLightingSettingsFactory::ReadResource(std::shared_p
return resource;
}
void Ship::SetLightingSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
void LUS::SetLightingSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<SetLightingSettings> setLightingSettings = std::static_pointer_cast<SetLightingSettings>(resource);
@ -68,4 +68,4 @@ void Ship::SetLightingSettingsFactoryV0::ParseFileBinary(std::shared_ptr<BinaryR
}
}
} // namespace Ship
} // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
namespace Ship {
namespace LUS {
class SetLightingSettingsFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
@ -14,4 +14,4 @@ class SetLightingSettingsFactoryV0 : public SceneCommandVersionFactory {
public:
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
};
}; // namespace Ship
}; // namespace LUS

View file

@ -1,9 +1,9 @@
#include "soh/resource/importer/scenecommand/SetMeshFactory.h"
#include "soh/resource/type/scenecommand/SetMesh.h"
#include "spdlog/spdlog.h"
#include "libultraship/bridge.h"
#include "libultraship/libultraship.h"
namespace Ship {
namespace LUS {
std::shared_ptr<Resource> SetMeshFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
@ -27,7 +27,7 @@ std::shared_ptr<Resource> SetMeshFactory::ReadResource(std::shared_ptr<ResourceM
return resource;
}
void Ship::SetMeshFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
void LUS::SetMeshFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<SetMesh> setMesh = std::static_pointer_cast<SetMesh>(resource);
@ -65,8 +65,10 @@ void Ship::SetMeshFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reade
std::string meshOpa = reader->ReadString();
std::string meshXlu = reader->ReadString();
dlist.opa = meshOpa != "" ? (Gfx*)GetResourceDataByName(meshOpa.c_str(), true) : 0;
dlist.xlu = meshXlu != "" ? (Gfx*)GetResourceDataByName(meshXlu.c_str(), true) : 0;
auto opaRes = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshOpa.c_str());
auto xluRes = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshXlu.c_str());
dlist.opa = meshOpa != "" ? (Gfx*)(opaRes ? opaRes->GetPointer() : nullptr) : 0;
dlist.xlu = meshXlu != "" ? (Gfx*)(xluRes ? xluRes->GetPointer() : nullptr) : 0;
setMesh->dlists.push_back(dlist);
} else if (setMesh->meshHeader.base.type == 1) {
@ -76,8 +78,10 @@ void Ship::SetMeshFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reade
std::string imgOpa = reader->ReadString();
std::string imgXlu = reader->ReadString();
pType.opa = imgOpa != "" ? (Gfx*)GetResourceDataByName(imgOpa.c_str(), true) : 0;
pType.xlu = imgXlu != "" ? (Gfx*)GetResourceDataByName(imgXlu.c_str(), true) : 0;
auto opaRes = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(imgOpa.c_str());
auto xluRes = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(imgXlu.c_str());
pType.opa = imgOpa != "" ? (Gfx*)(opaRes ? opaRes->GetPointer() : nullptr) : 0;
pType.xlu = imgXlu != "" ? (Gfx*)(xluRes ? xluRes->GetPointer() : nullptr) : 0;
int32_t bgImageCount = reader->ReadUInt32();
setMesh->images.reserve(bgImageCount);
@ -122,8 +126,10 @@ void Ship::SetMeshFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reade
std::string meshOpa = reader->ReadString();
std::string meshXlu = reader->ReadString();
pType.opa = meshOpa != "" ? (Gfx*)GetResourceDataByName(meshOpa.c_str(), true) : 0;
pType.xlu = meshXlu != "" ? (Gfx*)GetResourceDataByName(meshXlu.c_str(), true) : 0;
opaRes = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshOpa.c_str());
xluRes = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshXlu.c_str());
pType.opa = meshOpa != "" ? (Gfx*)(opaRes ? opaRes->GetPointer() : nullptr) : 0;
pType.xlu = meshXlu != "" ? (Gfx*)(xluRes ? xluRes->GetPointer() : nullptr) : 0;
setMesh->dlists.push_back(pType);
} else if (setMesh->meshHeader.base.type == 2) {
@ -138,8 +144,10 @@ void Ship::SetMeshFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reade
std::string meshOpa = reader->ReadString();
std::string meshXlu = reader->ReadString();
dlist.opa = meshOpa != "" ? (Gfx*)GetResourceDataByName(meshOpa.c_str(), true) : 0;
dlist.xlu = meshXlu != "" ? (Gfx*)GetResourceDataByName(meshXlu.c_str(), true) : 0;
auto opaRes = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshOpa.c_str());
auto xluRes = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshXlu.c_str());
dlist.opa = meshOpa != "" ? (Gfx*)(opaRes ? opaRes->GetPointer() : nullptr) : 0;
dlist.xlu = meshXlu != "" ? (Gfx*)(xluRes ? xluRes->GetPointer() : nullptr) : 0;
setMesh->dlists2.push_back(dlist);
} else {
@ -159,4 +167,4 @@ void Ship::SetMeshFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reade
}
}
} // namespace Ship
} // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
namespace Ship {
namespace LUS {
class SetMeshFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
@ -14,4 +14,4 @@ class SetMeshFactoryV0 : public SceneCommandVersionFactory {
public:
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
};
}; // namespace Ship
}; // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/type/scenecommand/SetObjectList.h"
#include "spdlog/spdlog.h"
namespace Ship {
namespace LUS {
std::shared_ptr<Resource> SetObjectListFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
@ -25,7 +25,7 @@ std::shared_ptr<Resource> SetObjectListFactory::ReadResource(std::shared_ptr<Res
return resource;
}
void Ship::SetObjectListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
void LUS::SetObjectListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource)
{
std::shared_ptr<SetObjectList> setObjectList = std::static_pointer_cast<SetObjectList>(resource);
@ -40,4 +40,4 @@ void Ship::SetObjectListFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader>
}
}
} // namespace Ship
} // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
namespace Ship {
namespace LUS {
class SetObjectListFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
@ -14,4 +14,4 @@ class SetObjectListFactoryV0 : public SceneCommandVersionFactory {
public:
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
};
}; // namespace Ship
}; // namespace LUS

View file

@ -1,9 +1,9 @@
#include "soh/resource/importer/scenecommand/SetPathwaysFactory.h"
#include "soh/resource/type/scenecommand/SetPathways.h"
#include "spdlog/spdlog.h"
#include <libultraship/bridge.h>
#include <libultraship/libultraship.h>
namespace Ship {
namespace LUS {
std::shared_ptr<Resource> SetPathwaysFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
@ -26,7 +26,7 @@ std::shared_ptr<Resource> SetPathwaysFactory::ReadResource(std::shared_ptr<Resou
return resource;
}
void Ship::SetPathwaysFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
void LUS::SetPathwaysFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource) {
std::shared_ptr<SetPathways> setPathways = std::static_pointer_cast<SetPathways>(resource);
ResourceVersionFactory::ParseFileBinary(reader, setPathways);
@ -37,8 +37,8 @@ void Ship::SetPathwaysFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> r
setPathways->paths.reserve(setPathways->numPaths);
for (uint32_t i = 0; i < setPathways->numPaths; i++) {
std::string pathFileName = reader->ReadString();
setPathways->paths.push_back(std::static_pointer_cast<Path>(LoadResource(pathFileName.c_str(), true)));
setPathways->paths.push_back(std::static_pointer_cast<Path>(LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(pathFileName.c_str())));
}
}
} // namespace Ship
} // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
namespace Ship {
namespace LUS {
class SetPathwaysFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
@ -14,4 +14,4 @@ class SetPathwaysFactoryV0 : public SceneCommandVersionFactory {
public:
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
};
}; // namespace Ship
}; // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/type/scenecommand/SetRoomBehavior.h"
#include "spdlog/spdlog.h"
namespace Ship {
namespace LUS {
std::shared_ptr<Resource> SetRoomBehaviorFactory::ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
std::shared_ptr<ResourceInitData> initData,
std::shared_ptr<BinaryReader> reader) {
@ -25,7 +25,7 @@ std::shared_ptr<Resource> SetRoomBehaviorFactory::ReadResource(std::shared_ptr<R
return resource;
}
void Ship::SetRoomBehaviorFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
void LUS::SetRoomBehaviorFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
std::shared_ptr<Resource> resource) {
std::shared_ptr<SetRoomBehavior> setRoomBehavior = std::static_pointer_cast<SetRoomBehavior>(resource);
ResourceVersionFactory::ParseFileBinary(reader, setRoomBehavior);
@ -36,4 +36,4 @@ void Ship::SetRoomBehaviorFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReade
setRoomBehavior->roomBehavior.gameplayFlags2 = reader->ReadInt32();
}
} // namespace Ship
} // namespace LUS

View file

@ -2,7 +2,7 @@
#include "soh/resource/importer/scenecommand/SceneCommandFactory.h"
namespace Ship {
namespace LUS {
class SetRoomBehaviorFactory : public SceneCommandFactory {
public:
std::shared_ptr<Resource> ReadResource(std::shared_ptr<ResourceManager> resourceMgr,
@ -14,4 +14,4 @@ class SetRoomBehaviorFactoryV0 : public SceneCommandVersionFactory {
public:
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<Resource> resource) override;
};
}; // namespace Ship
}; // namespace LUS

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