tdauth / wowr

Warcraft III: Reforged funmap World of Warcraft Reforged.
https://wowreforged.org
8 stars 0 forks source link

Saving game with CreateRegion in globals in Calendary system crashes the game #3198

Closed tdauth closed 2 weeks ago

tdauth commented 1 month ago

Found it:

   private region rainyRegion = CreateRegion()

in calendar system.

CreateRegion in globals crashes the game on saving.

https://www.hiveworkshop.com/threads/list-of-warcraft-iii-crashes.194706/page-4#post-3637812

According to the user WchiWa it crashes since 3.23 and worked in 3.22. See all changes in 3.23: https://wowreforged.org/ChangeLog3.23.txt Calendar was not even there but LogUI and maybe FrameSaver stuff changed. Compare the map scripts war3map.j in git: https://github.com/tdauth/wowr/compare/3.22...3.23 34,009 wowr.w3x/war3map.j Copied! 20,244 additions, 13,765 deletions not shown because the diff is too large. Please use a local Git client to view these changes.

It is not the FrameSaver action of the Log system.

It could be the new action bar, paged buttons, maybe even the syncing main selected units which is updated all the time. Check the FrameSaver actions.

    call FrameSaverAddEx(function GetMainSelectedUnitForPlayer_PauseSyncTimer , function GetMainSelectedUnitForPlayer_ResumeSyncTimer)

function WoWReforgedRacesUI__BeforeSave takes nothing returns nothing
    call h__PauseTimer(WoWReforgedRacesUI__updateTimer)
endfunction

function WoWReforgedRacesUI__AfterSave takes nothing returns nothing
    call h__ResumeTimer(WoWReforgedRacesUI__updateTimer)
endfunction

function WoWReforgedRacesUI__Init takes nothing returns nothing
    call h__TimerStart(WoWReforgedRacesUI__updateTimer, 0.3, true, function WoWReforgedRacesUI__TimerFunctionUpdateIdleWorkerIcons)

    // make sure that the timer will be paused and not run before restoring frames of GetIdleWorkerOverlayParent after loading the game

    call FrameSaverAddEx(function WoWReforgedRacesUI__BeforeSave , function WoWReforgedRacesUI__AfterSave)

endfunction

just pauses the timers

    //call FrameSaverAdd(function HideLogUI)
    //call FrameSaverAddEx(function DisableLogUI, function EnableLogUI)

Disabled for now.

function WoWReforgedSkillUI__AboutToSave takes nothing returns nothing
    call DisableSkillUITriggers()
    call WoWReforgedSkillUI__HideSkillUI()
endfunction

function WoWReforgedSkillUI__AfterSaving takes nothing returns nothing
    call EnableSkillUITriggers()
    call UpdateSkillPointsUIForAllPlayers()
endfunction

function WoWReforgedSkillUI__Init takes nothing returns nothing
    call TriggerRegisterAnyUnitEventBJ(WoWReforgedSkillUI__selectionTrigger, EVENT_PLAYER_UNIT_SELECTED)
    call TriggerAddCondition(WoWReforgedSkillUI__selectionTrigger, Condition(function WoWReforgedSkillUI__TriggerConditionSelected))

    call TriggerRegisterAnyUnitEventBJ(WoWReforgedSkillUI__deselectionTrigger, EVENT_PLAYER_UNIT_DESELECTED)
    call TriggerAddCondition(WoWReforgedSkillUI__deselectionTrigger, Condition(function WoWReforgedSkillUI__TriggerConditionDeselected))

    call TriggerRegisterAnyUnitEventBJ(WoWReforgedSkillUI__loadTrigger, EVENT_PLAYER_UNIT_LOADED)
    call TriggerAddCondition(WoWReforgedSkillUI__loadTrigger, Condition(function WoWReforgedSkillUI__TriggerConditioLoaded))

    // leveling is done by UpdateSkillUIEvaluate

    call DisableSkillUITriggers()

    call TriggerAddAction(WoWReforgedSkillUI__tmpTrigger, function WoWReforgedSkillUI__TriggerActionUpdateSkillPointsUI)

    // Makes sure no events are triggered before the UI is restored after loading the game.
    call TriggerAddAction(FrameLoader___actionTrigger, (function CreateAndEnableSkillUI)) // INLINED!!
    call FrameSaverAddEx(function WoWReforgedSkillUI__AboutToSave , function WoWReforgedSkillUI__AfterSaving)

hides.

function s__MapChanger_triggerConditionSaveUser takes nothing returns boolean
        return IsInSinglePlayer()
    endfunction

    function s__MapChanger_triggerActionSaveUser takes nothing returns nothing
        local string levelName= null
        local string zoneSaveGame= null
        local string zoneTargetSaveGame= null
        local integer i= 0
        // Remove existing zones directory if a savegame already existed with the same name, otherwise old zone save games will remain.
        call RemoveSaveDirectory(s__MapChanger_saveGameFolder(GetSaveBasicFilename()))
        // Copy savegames for all zones into the new directory. Consider that every map needs ALL zones therefore. Disable unused zones in the map.
        loop
            exitwhen ( i == (WoWReforgedLevels___levelCounter) ) // INLINED!!
            set levelName=(WoWReforgedLevels___levelName[(i)]) // INLINED!!
            set zoneSaveGame=(s__MapChanger_saveGamePath("" , (levelName))) // INLINED!!
            if ( (s__MapChanger_getZoneNameIndex((levelName)) != - 1) and SaveGameExists(zoneSaveGame) ) then // INLINED!!
                set zoneTargetSaveGame=s__MapChanger_saveGamePath(GetSaveBasicFilename() , levelName)
                call CopySaveGame(zoneSaveGame, zoneTargetSaveGame)
            endif
            set i=i + 1
        endloop

        set s__MapChanger_m_currentSaveGame=GetSaveBasicFilename()
    endfunction

Map Change does all this shit when in single player.

tdauth commented 1 month ago

It is not //call FrameSaverAddEx(function AboutToSave, function AfterSaving) of SKillUI.

tdauth commented 1 month ago

It is not the MapChanger.

tdauth commented 1 month ago
 call TriggerAddAction(FrameSaver___saveTrigger, (function HideUrlUi)) // INLINED!!
   call TriggerAddAction(FrameSaver___saveTrigger, (function HideAiPlayersUi)) // INLINED!!
    call TriggerAddAction(FrameSaver___saveTrigger, (function HidePagedButtonsUI)) // INLINED!!
    call TriggerAddAction(FrameSaver___saveTrigger, (function UnitSoundSetsFakeBars___PauseAllFrameTimers)) // INLINED!!
    call TriggerAddAction(FrameSaver___saveTrigger, (function HideCinematicSceneFakeBars)) // INLINED!!
   call TriggerAddAction(FrameSaver___saveTrigger, (function HideBackpackUIForAllPlayers)) // INLINED!!
    call TriggerAddAction(FrameSaver___saveTrigger, (function HideSaveCodeUIAll)) // INLINED!!
tdauth commented 1 month ago

Not HideUrlUi

tdauth commented 1 month ago

Not HideAiPlayersUi

tdauth commented 1 month ago

Not HidePagedButtonsUI

tdauth commented 1 month ago

Not the custom sound sets:

    call TriggerAddAction(FrameSaver___saveTrigger, (function UnitSoundSetsFakeBars___PauseAllFrameTimers)) // INLINED!!
    call TriggerAddAction(FrameSaver___saveTrigger, (function HideCinematicSceneFakeBars)) // INLINED!!
tdauth commented 1 month ago

Not //call FrameSaverAdd(function HideBackpackUIForAllPlayers)

tdauth commented 1 month ago

Not //call FrameSaverAdd(function HideSaveCodeUIAll)

tdauth commented 1 month ago

Not //call FrameSaverAddEx(function BeforeSave, function AfterSave) for races UI

tdauth commented 1 month ago

Nothing with EVENT_GAME_SAVE.

tdauth commented 1 month ago

I suspect that same frame saver functionality is missing. Maybe something should be disabled, some timer updating UI which is called immediately after saving and accesses corrupted UI.

tdauth commented 1 month ago

Make sure that the trigger with the MAP_SAVE is really disabled.

tdauth commented 3 weeks ago

Actually, the line

call TriggerAddAction(FrameSaver___saveTrigger, (function HideCinematicSceneFakeBars)) // INLINED!!

was new in 3.23 where it crashed make sure it is not the cause.

Besides this is new:

framehandle PagedButtonsUI___PreviewSprite= null
effect PagedButtonsUI___PreviewEffect= null
call TriggerAddAction(FrameSaver___saveTrigger, (function PagedButtonsUI___ResetPreviewFrame)) // Destroying the frame will crash the game. // INLINED!!
tdauth commented 3 weeks ago

Also the buttons in the actions bar are new:

framehandle WoWReforgedActionsBarUI__LogButton
framehandle WoWReforgedActionsBarUI__LogFrame
framehandle WoWReforgedActionsBarUI__LogTooltip
trigger WoWReforgedActionsBarUI__LogTrigger

framehandle WoWReforgedActionsBarUI__MultiboardButton
framehandle WoWReforgedActionsBarUI__MultiboardFrame
framehandle WoWReforgedActionsBarUI__MultiboardTooltip
trigger WoWReforgedActionsBarUI__MultiboardTrigger

integer WoWReforgedActionsBarUI__currentMultiboard= 0
tdauth commented 2 weeks ago

Disabled all except paged buttons and it still crashes:

boolean array PagedButtonsUI___enabledForPlayer
boolean array PagedButtonsUI___UIVisible
unit array PagedButtonsUI___UIShop
integer array PagedButtonsUI___PagesIndex
framehandle PagedButtonsUI___BackgroundFrame
framehandle PagedButtonsUI___TitleFrame
framehandle array PagedButtonsUI___SlotFrame
framehandle array PagedButtonsUI___SlotBackdropFrame
framehandle array PagedButtonsUI___SlotChargesBackgroundFrame
framehandle array PagedButtonsUI___SlotChargesFrame
framehandle array PagedButtonsUI___SlotPageBackgroundFrame
framehandle array PagedButtonsUI___SlotPageFrame
trigger array PagedButtonsUI___SlotClickTrigger
trigger array PagedButtonsUI___SlotTooltipOnTrigger
trigger array PagedButtonsUI___SlotTooltipOffTrigger
framehandle PagedButtonsUI___TooltipFrame
framehandle PagedButtonsUI___PageNameText
framehandle PagedButtonsUI___TooltipIcon
framehandle PagedButtonsUI___SummonFrame
framehandle PagedButtonsUI___ItemGoldFrame
framehandle PagedButtonsUI___ItemGoldIconFrame
framehandle PagedButtonsUI___ItemLumberFrame
framehandle PagedButtonsUI___ItemLumberIconFrame
framehandle PagedButtonsUI___ItemFoodFrame
framehandle PagedButtonsUI___ItemFoodIconFrame
framehandle PagedButtonsUI___TooltipText
framehandle PagedButtonsUI___PreviewSprite= null
effect PagedButtonsUI___PreviewEffect= null
framehandle PagedButtonsUI___NextPagesButton
trigger PagedButtonsUI___NextPagesTrigger
framehandle PagedButtonsUI___PreviousPagesButton
trigger PagedButtonsUI___PreviousPagesTrigger
framehandle PagedButtonsUI___Checkbox
trigger PagedButtonsUI___CheckedTrigger
trigger PagedButtonsUI___UncheckedTrigger
framehandle PagedButtonsUI___CloseButton
trigger PagedButtonsUI___CloseTrigger
tdauth commented 2 weeks ago

It crashes even without any framehandle in the map script.

Only EVENT_GAME_SAVE left is the FrameSaver.

Maybe it is a completely different system.

tdauth commented 2 weeks ago

It is not FrameSaver.

tdauth commented 2 weeks ago

Textures/GenericGlow5.tif xŠn‘ö C ÀÃÃRV ÍoyúîžzøµRV   # Textures/Ghost2.dds # tØ|P܍³ÿ 3 Textures/GenericGlow5.tga hŒn‘ö C °ÄRV ‚C–úî·ÀzÀøµRV   ½ÁRV   C °íÃRV Ÿ· A$G¿à€øµRV   ¿ÁRV   C 0 ¶RV  gL$ŽÐò¶RV   ÁÁRV   # Textures/Ghost2.tif  C ÀíÂRV A`þó#Ô,W°ùµRV   ÅÁRV   # Textures/Ghost2.tga  C °ÕÂRV 6ÏÖó#ÁýVúµRV   ÉÁRV   # Textures/grad2b.dds  C ëÂRV SóveîpúµRV   ÌÁRV   # Textures/grad2b.blp  C ÝÂRV Í<öufþºÐúµRV   ÐÁRV   # Textures/grad2b.tif  C žÅ×bvèWz0ûµRV   ÔÁRV   # Textures/grad2b.tga  C 0ÄÂRV í°èbvlzûµRV   ØÁRV   # Textures/GreenGlow2.dds C “ƒ<ƒåo…ðûµRV   ÛÁRV   # Textures/GreenGlow2.blp C L:¸ƒôÞOPüµRV    # Textures/GreenGlow2.tif C  ŽÄRV E0 ì‚J6ù°üµRV   üµRV # Textures/GreenGlow2.tga C uµRV ꪏì‚"ùýµRV   .Õ p

tdauth commented 2 weeks ago

multiboard @ s Ò V
 €leaderboard @Ò V   €player

tdauth commented 2 weeks ago

Game data is unable to load and must be repaired. Please run the Blizzard app to repair the game. If the problem persists, try reinstalling the game.

tdauth commented 2 weeks ago

C:/Users/Tamino/Documents/Warcraft III/BattleNet/430860571/Campaigns/Classic/b.w3z

tdauth commented 2 weeks ago

Repairing the game did not help.

Further changes between 3.22 and 3.23:

constant integer ItemTypeUtils_SELL_UNIT= CUSTOMIZABLE_HERO_STRENGTH_MELEE // can buy equipment 'Hpal' constant integer PhoenixEgg_ABILITY_ID_2= 'A24J' constant boolean LIBRARY_WoWReforgedResurrectionStone=true trigger gg_trg_Taunts_Init= null trigger gg_trg_GoblinQuest_2_Init_Checkpoints= null trigger gg_trg_GoblinQuest_2a= null trigger gg_trg_GoblinQuest_2bb= null trigger gg_trg_GoblinQuest_2_Checkpoint_1= null trigger gg_trg_GoblinQuest_2_Checkpoint_2= null trigger gg_trg_GoblinQuest_2_Finish= null trigger gg_trg_GoblinQuest2c= null sZone_rects

We can try:

tdauth commented 2 weeks ago

Not resurrection stones.

tdauth commented 2 weeks ago

Goblin Race Checkpoint has no pathing map. Maybe buildings without any pathing map always cause a crash even on saving games?

tdauth commented 2 weeks ago

It is the zones or calendar system.

tdauth commented 2 weeks ago

It is the calendar/season system.

tdauth commented 2 weeks ago

It is WoWReforgedCalendar.

tdauth commented 2 weeks ago

Any of these globals:

    constant integer DAYS_PER_YEAR = 36
    constant integer DAYS_PER_MONTH = DAYS_PER_YEAR / 12
    constant integer WINTER_DAY = 0
    constant integer SPRING_DAY = 9
    constant integer SUMMER_DAY = 18
    constant integer FALL_DAY = 27

    constant real MIN_NO_WEATHER_DURATION = 60.0
    constant real MAX_NO_WEATHER_DURATION = 440.0
    constant real MIN_WEATHER_DURATION = 30.0
    constant real MAX_WEATHER_DURATION = 240.0
    constant real MIN_THUNDER_DURATION = 10.0
    constant real MAX_THUNDER_DURATION = 120.0

    constant integer SEASON_SUMMER = 0
    constant integer SEASON_SPRING = 1
    constant integer SEASON_FALL = 2
    constant integer SEASON_WINTER = 3

    constant integer JANUARY = 1
    constant integer FEBRUARY = 2
    constant integer MARCH = 3
    constant integer APRIL = 4
    constant integer MAY = 5
    constant integer JUNE = 6
    constant integer JULY = 7
    constant integer AUGUST = 8
    constant integer SEPTEMBER = 9
    constant integer OCTOBER = 10
    constant integer NOVEMBER = 11
    constant integer DECEMBER = 12

    private trigger changeDayTrigger = CreateTrigger()
    private timer changeSecondTimer = CreateTimer()
    private region rainyRegion = CreateRegion()
    private weathereffect array weather
    private integer array weatherEffectIds
    private integer days = SUMMER_DAY // we always start in summer
    private integer years = 24
    private integer season = SEASON_WINTER

    private boolean seasonsEnabled = true

    private boolean easterTrees = false
    private boolean christmasTrees = false
    private effect array newYearEffects

    private boolean weatherRunning = false
    private timer weatherTimer = CreateTimer()
    private timer thunderTimer = CreateTimer()

    private TileMapping array tileMappings
    private integer tileMappingsCounter = 0

    private CalendarEvent array calendarEvents
    private integer calendarEventsCounter = 0

    private hashtable h = InitHashtable()
tdauth commented 2 weeks ago

private region rainyRegion = CreateRegion()

CreateRegion in globals crashes the game on saving.

https://www.hiveworkshop.com/threads/list-of-warcraft-iii-crashes.194706/page-4#post-3637812

tdauth commented 2 weeks ago

Fixed.