Fix crash when toggling dynos packs

This commit is contained in:
MysterD 2022-04-23 02:22:12 -07:00
parent 22f39d3933
commit a8fbf26338
4 changed files with 20 additions and 1 deletions

View File

@ -757,6 +757,7 @@ void DynOS_Anim_Swap(void *aPtr);
void DynOS_Tex_Valid(GfxData* aGfxData);
void DynOS_Tex_Invalid(GfxData* aGfxData);
void DynOS_Tex_Update();
u8 *DynOS_Tex_ConvertToRGBA32(const u8 *aData, u64 aLength, s32 aFormat, s32 aSize, const u8 *aPalette);
bool DynOS_Tex_Import(void **aOutput, void *aPtr, s32 aTile, void *aGfxRApi, void **aHashMap, void *aPool, u32 *aPoolPos, u32 aPoolSize);

View File

@ -3,4 +3,5 @@ extern "C" {
}
void DynOS_Gfx_Update() {
DynOS_Tex_Update();
}

View File

@ -10,6 +10,13 @@ static std::set<DataNode<TexData> *>& DynosValidTextures() {
return sDynosValidTextures;
}
static Array<DataNode<TexData> *>& DynosScheduledInvalidTextures() {
static Array<DataNode<TexData> *> sDynosScheduledInvalidTextures;
return sDynosScheduledInvalidTextures;
}
static bool sDynosDumpTextureCache = false;
//
// Conversion
//
@ -260,9 +267,19 @@ void DynOS_Tex_Valid(GfxData* aGfxData) {
}
void DynOS_Tex_Invalid(GfxData* aGfxData) {
auto& schedule = DynosScheduledInvalidTextures();
for (auto &_Texture : aGfxData->mTextures) {
schedule.Add(_Texture);
}
}
void DynOS_Tex_Update() {
auto& schedule = DynosScheduledInvalidTextures();
if (schedule.Count() == 0) { return; }
for (auto &_Texture : schedule) {
DynosValidTextures().erase(_Texture);
}
schedule.Clear();
}
//

View File

@ -35,7 +35,7 @@ function bhv_item_box_loop(obj)
if obj.oItemBoxTouched == 1 then
if obj.oTimer >= itemBoxTimeout then
obj.oItemBoxTouched = 0
if get_network_player_smallest_global() == gNetworkPlayers[0] then
if network_is_server() then
network_send_object(obj, true)
end
elseif obj.oTimer < 5 then