diff --git a/config/SZBE69_B8/objects.json b/config/SZBE69_B8/objects.json index 2473534f4..2f0c0808a 100644 --- a/config/SZBE69_B8/objects.json +++ b/config/SZBE69_B8/objects.json @@ -277,7 +277,7 @@ "band3/meta_band/StandInProvider.cpp": "Matching", "band3/meta_band/StoreInfoPanel.cpp": "NonMatching", "band3/meta_band/StoreMainPanel.cpp": "NonMatching", - "band3/meta_band/StoreMenuPanel.cpp": "MISSING", + "band3/meta_band/StoreMenuPanel.cpp": "NonMatching", "band3/meta_band/StoreMenuProvider.cpp": "MISSING", "band3/meta_band/StoreOfferContentsProvider.cpp": "MISSING", "band3/meta_band/StoreOfferProvider.cpp": "MISSING", diff --git a/src/band3/meta_band/StoreMenuPanel.cpp b/src/band3/meta_band/StoreMenuPanel.cpp new file mode 100644 index 000000000..9108beb6d --- /dev/null +++ b/src/band3/meta_band/StoreMenuPanel.cpp @@ -0,0 +1,11 @@ +#include "meta_band/StoreMenuPanel.h" +#include "StoreMenuPanel.h" + +StoreMenuPanel* inst; + +StoreMenuPanel::StoreMenuPanel(): unk38(), unk40(0xffffffff), unk44(0xffffffff), unk48(0), unk4c(0) { + inst = this; +} +StoreMenuPanel::~StoreMenuPanel() { + inst = nullptr; +} \ No newline at end of file diff --git a/src/band3/meta_band/StoreMenuPanel.h b/src/band3/meta_band/StoreMenuPanel.h new file mode 100644 index 000000000..d5a9b44bd --- /dev/null +++ b/src/band3/meta_band/StoreMenuPanel.h @@ -0,0 +1,31 @@ +#pragma once +#include "meta_band/BandSongMetadata.h" +#include "stl/pointers/_vector.h" +#include "system/ui/UIPanel.h" + +class StoreMenuPanel : public UIPanel { +public: + StoreMenuPanel(); + OBJ_CLASSNAME(UIPanel); + OBJ_SET_TYPE(UIPanel); + virtual DataNode Handle(DataArray *, bool); + virtual ~StoreMenuPanel(); + virtual void FinishLoad(); + virtual void Unload(); + virtual void Enter(); + virtual void Exit(); + virtual void Poll(); + + void AddMenu(DataArray*, const char*); + void OnBack(const DataArray*); + void OnMsg(const MetadataLoadedMsg&); + void GetCrumbText(int) const; + void SetPendingMenuIx(int); + + std::vector unk38; // 0x38, 0x3c, 0x3e + int (unk40); // 0x40 + int (unk44); // 0x44 + int (unk48); // 0x48 + int (unk4c); // 0x4c +}; +extern StoreMenuPanel* inst; \ No newline at end of file diff --git a/src/system/char/CharClip.cpp b/src/system/char/CharClip.cpp index 215c64906..fb3ddfed6 100644 --- a/src/system/char/CharClip.cpp +++ b/src/system/char/CharClip.cpp @@ -645,8 +645,30 @@ void CharClip::MakeMRU() { } } -void CharClip::LockAndDelete(CharClip **, int remaining, int) { +void CharClip::LockAndDelete(CharClip** list, int count, int remaining) { MILO_ASSERT(remaining >= 0, 0x43A); + if (count < remaining) { + remaining = count; + } + CharClip** end = &list[count]; + int i = 0; + while (count > i) { + CharClip* clip = list[i]; + if (clip->mPlayFlags & 0x10000U) { + remaining--; + list[i] = list[--count]; + i--; + *--end = clip; + } + i++; + } + while (remaining > 0) { + list[--count]->mPlayFlags |= 0x10000; + remaining--; + } + while (count > 0) { + delete list[--count]; + } } void CharClip::PreSave(BinStream &) { MILO_WARN("You can only save a CharClip from PC"); }