iw4x / iw4x-client

GNU General Public License v3.0
123 stars 42 forks source link

Rewrite menu code to track memory usage, prevent crashes and fix leaks #137

Closed Rackover closed 1 month ago

Rackover commented 1 month ago

The biggest paradigm change is that menus are now overriden from raw when the filesystem is reloaded during a UI_Init or CGameStart. They are no longer loaded on demand, they are always loaded when present.

Normally we should use menu lists (like code.txt ) for this, it would be the correct approach. However this would instantly break decades of mods and servers, so right now I can't consider it. There's a little trick instead to make sure we only load stray menus when in game, and not in the main menu (where most would fail anyway), so mods that modify the main menu will have to have a menulist TXT somewhere to say what should be loaded and what shouldn't.

diamante0018 commented 1 month ago

btw this is how guy debugs SL and Memtree now: https://gist.github.com/ineedbots/ccd66cf076e67b6033bea8fb8d965bc8

Rackover commented 1 month ago

I've tested it, so I'm merging and releasing it right now because this addresses a very frequent crash. I will open another pr for next changes if needs be