diff --git a/OTRExporter/assets/helpers/cosmetics/gEndGrayscaleAndEndDlistDL b/OTRExporter/assets/helpers/cosmetics/gEndGrayscaleAndEndDlistDL new file mode 100644 index 000000000..d7f9ce45c --- /dev/null +++ b/OTRExporter/assets/helpers/cosmetics/gEndGrayscaleAndEndDlistDL @@ -0,0 +1,5 @@ + + + + + diff --git a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp index eb61dca57..dc5257428 100644 --- a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp +++ b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp @@ -47,10 +47,15 @@ extern PlayState* gPlayState; #include "objects/object_gjyo_objects/object_gjyo_objects.h" #include "textures/nintendo_rogo_static/nintendo_rogo_static.h" void ResourceMgr_PatchGfxByName(const char* path, const char* patchName, int index, Gfx instruction); +void ResourceMgr_PatchGfxCopyCommandByName(const char* path, const char* patchName, int destinationIndex, int sourceIndex); void ResourceMgr_UnpatchGfxByName(const char* path, const char* patchName); u8 Randomizer_GetSettingValue(RandomizerSettingKey randoSettingKey); } +// This is used for the greg bridge +#define dgEndGrayscaleAndEndDlistDL "__OTR__helpers/cosmetics/gEndGrayscaleAndEndDlistDL" +static const ALIGN_ASSET(2) char gEndGrayscaleAndEndDlistDL[] = dgEndGrayscaleAndEndDlistDL; + // Not to be confused with tabs, groups are 1:1 with the boxes shown in the UI, grouping them allows us to reset/randomize // every item in a group at once. If you are looking for tabs they are rendered manually in ImGui in `DrawCosmeticsEditor` typedef enum { @@ -915,11 +920,13 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { // Greg Bridge if (Randomizer_GetSettingValue(RSK_RAINBOW_BRIDGE) == RO_BRIDGE_GREG) { - ResourceMgr_PatchGfxByName(gRainbowBridgeDL, "RainbowBridge1", 2, gsSPGrayscale(true)); - ResourceMgr_PatchGfxByName(gRainbowBridgeDL, "RainbowBridge2", 10, gsDPSetGrayscaleColor(color.r, color.g, color.b, color.a)); + ResourceMgr_PatchGfxByName(gRainbowBridgeDL, "RainbowBridge_StartGrayscale", 2, gsSPGrayscale(true)); + ResourceMgr_PatchGfxByName(gRainbowBridgeDL, "RainbowBridge_MakeGreen", 10, gsDPSetGrayscaleColor(color.r, color.g, color.b, color.a)); + ResourceMgr_PatchGfxByName(gRainbowBridgeDL, "RainbowBridge_EndGrayscaleAndEndDlist", 79, gsSPBranchListOTRFilePath(gEndGrayscaleAndEndDlistDL)); } else { - ResourceMgr_UnpatchGfxByName(gRainbowBridgeDL, "RainbowBridge1"); - ResourceMgr_UnpatchGfxByName(gRainbowBridgeDL, "RainbowBridge2"); + ResourceMgr_UnpatchGfxByName(gRainbowBridgeDL, "RainbowBridge_StartGrayscale"); + ResourceMgr_UnpatchGfxByName(gRainbowBridgeDL, "RainbowBridge_MakeGreen"); + ResourceMgr_UnpatchGfxByName(gRainbowBridgeDL, "RainbowBridge_EndGrayscaleAndEndDlist"); } } static CosmeticOption& consumableBlueRupee = cosmeticOptions.at("Consumable_BlueRupee"); diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index 3a75545a5..a75416a71 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -1273,6 +1273,23 @@ extern "C" void ResourceMgr_PatchGfxByName(const char* path, const char* patchNa *gfx = instruction; } +extern "C" void ResourceMgr_PatchGfxCopyCommandByName(const char* path, const char* patchName, int destinationIndex, int sourceIndex) { + auto res = std::static_pointer_cast( + LUS::Context::GetInstance()->GetResourceManager()->LoadResource(path)); + + Gfx* destinationGfx = (Gfx*)&res->Instructions[destinationIndex]; + Gfx sourceGfx = res->Instructions[sourceIndex]; + + if (!originalGfx.contains(path) || !originalGfx[path].contains(patchName)) { + originalGfx[path][patchName] = { + destinationIndex, + *destinationGfx + }; + } + + *destinationGfx = sourceGfx; +} + extern "C" void ResourceMgr_UnpatchGfxByName(const char* path, const char* patchName) { if (originalGfx.contains(path) && originalGfx[path].contains(patchName)) { auto res = std::static_pointer_cast(