Chef Shared Loader - Updates

PC Chef Shared Loader 1.5.4

Updates for Helldivers 2
This will likely be the last update. Arrowhead recently announced they'll be banning mods, and the post was vague enough that it may cover Lua scripts too.

Users
  • Chinese, Japanese and Korean text is now drawn bold. The game's only font with those characters draws them in thin strokes, lighter than its numbers and Latin letters. Every text with them, in the loader's menu and in every mod that draws text through the loader, now gets thicker strokes, with nothing to set. Text without them looks as before.
  • MDL3 can run under the loader through its boot stub. Mods made for MDL3 are left to it instead of being started twice, and F9 shows them as Run by MDL3 (or Left to MDL3, not running).
  • In the compact menu, a search too long for the header keeps its last letters in view, with "..." in front, so you can see what you just typed and what Backspace erases.
Modders
  • A chef.text call whose text (as translated) has CJK characters now draws it two more times, 1 px right and 1 px down, in the same layer, color and size. It still returns the same width, so chef.text_width, centering and row layouts don't move. Each extra draw uses its own text slot. A see-through text (alpha under 255) is drawn once.
  • '-- @loader mdl3' marks a mod for MDL3. When MDL3's boot stub (first line '-- MDL3 boot stub') is deployed under the loader and will run, the loader leaves the mod to it; with no stub, the stub held off by the crash guard, or a stub that fails to load, the mark is ignored and the loader starts the mod. 'HD2-Requires: chef-shared-loader' wins over the mark. A mod whose HD2-Requires names a mod left to MDL3 waits for the stub's init and starts once MDL3 has started it. The stub runs as a plain boot script (full access, under the watchdog and crash guard) and is named MDL3 in logs and CRASH RECOVERY. A game callback that a mod it starts sets the plain way ('function update(dt)') is put back after each of the stub's calls and run right after the stub's own, as with Rat's stub. See "MDL3's boot stub" in MODDING.md.
  • Once your mod has stopped, code of it that still runs (a function another mod holds) can't rename its entry (chef.title), open a log (chef.own_log), spawn a unit or an effect (chef.spawn, chef.particles) or save a table (chef.save_table): they give 'the mod is off', as chef.save already did. A paused mod's still work, and chef.call still works for its stop calls.
  • chef.save_table's reason for a failed save names the file only, not its folder (which has the Windows user name).
  • bit gives LuaJIT's answers for numbers of 2^51 and up too, so a hash written the LuaJIT way (h = bit.tobit(h * 16777619)) matches what it gave before 7.2.0, and huge numbers no longer raise an error.
  • A mod writing another mod's shared name (chef.share) is logged once per pair of mods and name, at most 64 lines a launch, instead of on every write.

Thanks to MCTimeRL for reporting the thin CJK text.
  • Like
Reactions: blapblap
Users
  • Holding an arrow key in the F9 menu now keeps it moving, as the controller's D-pad does: one step at once, then a steady run after a short wait. A held Right still opens a mod or a fold, presses a button or starts a key capture only once, and a held D-pad Right into an open fold no longer changes its first option.
  • A short press on the D-pad no longer jumps several steps in the F9 menu while another mod speeds up the game's clock (for example a mod that skips the drop's zoom), and the sped-up clock no longer shortens the 2-second touchpad / View hold that opens the menu.
  • In F9 > CRASH RECOVERY, RETRY on a running mod that couldn't be restarted now gives it its skipped calls back at once, instead of at the next launch. Each row now shows the mod's name with RETRY, and after the press what's happening: AFTER MENU CLOSES, RUNNING, WHEN SWITCHED ON or NEXT LAUNCH, or SHORTLY when it's pressed while a world is still loading (it's done once the world settles).
  • The hint words at the bottom of the F9 menu (MOVE, OPEN, CLOSE and the rest) are yellow now, to match the menu's headings. The keys and the controller's buttons next to them look as before. The note above the hints that warns of a key clash is orange now, not yellow. The search's typing hints no longer show Enter, which sends the text to the game's chat.
Modders
  • While a player holds an arrow key on your slider, choice or color row, its on_change can now fire about 10 times a second, as it already could with a held D-pad.
  • Another loader can now tell Chef Shared Loader that its player switched a mod off there: a modules entry of its CowboyBingusModLoader / HD2ModLoader, or a __boot_mod_loader.mods state, that starts with 'disabled' (MDL3 writes 'disabled by user'). Chef Shared Loader then leaves that mod to that loader instead of starting it, and F9 lists it as left to that loader, switched off there. See "For other loaders" in MODDING.md.
  • Three why texts in chef.mods(), the health file and mod_stopped changed: 'tried again when this menu closes' is now 'will run again after the menu closes', 'tried again from the options menu' is now 'retried from the options menu', and a requirement's 'which starts after this: tried again then' is now 'which starts after this: retried then'.
Users
  • The F9 menu's search moved from / to Enter. Press Enter (ENTER SEARCH) and the game's chat box opens: that's the search box now, and the list follows as you type. Backspace erases.
  • To finish, press Escape (ESC DONE) or click: the chat box closes without sending, the results stay, and the arrows take it from there. Enter with text in the box (ENTER SENDS) sends that text to the other players as a chat message, and the loader can't stop that. With nothing typed, Enter just closes the box. F9 does nothing until you finish typing, and / does nothing now.
  • On the keyboard, Right now does every row's job: it opens a mod, flips a toggle, starts a key capture and presses a button. Enter on a row starts a search instead. The controller and the mouse work as before.
  • The loader's unit scan (what Treasure Radar finds loot with) now switches off only after 4 launches in a row crash while it runs, not 2, so crashes from something else don't turn it off so easily. If 1.5.1 switched it off, this update turns it back on.
  • The hang watchdog no longer stops a healthy mod because the game stalled during its call (a slow engine call, the PC hitching): time with no Lua running is left out, within a limit, so a real endless loop is still stopped. The log now names the file and function a hung mod was running.
  • Two copies of a mod with the same name, one an addon and one boot-style, no longer both run: only the one deployed last does.
  • Options you change while chef_loader_settings.txt is read-only or locked are no longer lost at the next launch.
  • A mod you switch off in the menu still gets to save when the game closes.
  • With "Controller in this menu" set to Off, the menu shows the keyboard's hints and the mouse cursor right away.
  • When the menu can't find the mouse cursor, other mods can still hold the mouse.
  • Speed: a mod that refreshes its unit watch every frame no longer keeps the unit scan running back to back, a mod that reads a lot of game objects no longer writes a crash-trace line on every read, and a few smaller speed and memory fixes.
Modders
  • chef.button rows take Right, the controller's confirm or a click. The keyboard's Enter no longer presses one.
  • While the menu is open, in a search too, your mod's key and mouse reads and chef.typed() still answer nothing, so a search never fires your hotkey.
  • Another loader can now host the core in an environment of its own. The core runs its own init at its first update when nothing called it, never runs the host's callbacks twice, and if its start fails, the host's own callbacks keep running. Thanks to MCTimeRL for the report and the suggested fix (issue 16).
  • When the ship loads into the mission's world, mission_end now comes before the world event and carries the mission's world id, in a late start's replay too.
  • A paused mod (switched off, with no on_stop) still gets its shutdown as the game closes: the shutdown hook and event, a look-alike's on_shutdown and its guards' stop, so it can save.
  • A stopped copy's chef.save and chef.set answer nil, 'the mod is off', and its BingusRuntime guard and open_log are refused.
  • When an on_change callback sets its own row again, the callbacks after it hear only the new value. Each ModOptionsMenu on_change callback has its own crash key, so a crash skips only that one.
  • chef.spawn and chef.particles refuse a position that isn't finite numbers (nil, 'x, y, z: finite numbers').
  • chef.units_near with a negative radius finds nothing, chef.arc with no angle draws nothing, and chef.key_label hands back a name over 64 bytes as it is.
  • debug.traceback starts at your own code, and a nil passed to a bit function is a "bad argument" at your line.
  • HD2 Lua Runtime mods: a GUI made while the mod is paused stays hidden until it's back on, and handle.missing() also names the calls a need depends on.
  • A dev-mode reload with the menu open sends the new copy the menu event with true.
  • Hang watchdog: a gap of over 0.5 s between its checks (no Lua ran) comes off the clock of the call and its callers. The first gap comes off whole, then up to twice the call's limit in all (6 s, 20 s at launch), one budget shared by every call inside it. An HD2-Boot mod's or boot script's init and the after_startup callbacks at launch get the start's 10 s. A listener run inside a call that hung is no longer slowed into a hang of its own, and a mod looping on a hung boot script's callback is stopped now.
  • README and MODDING fixes: the log line for an addon stopped after 20 errors, what happens when a start hangs, and that material values aren't undone on stop.
  • Language files: the menu's hints use SENDS and DONE now, and no longer draw RESULTS or EXIT.
  • Like
Reactions: blapblap
Users
  • Fixed the hang watchdog switching off healthy mods for no reason, sometimes several in one session. A one-off game stall no longer counts against a mod either.
  • Menu opacity and Monitor opacity now fade only the background: text stays solid and readable at every setting.
Modders
  • chef.capture's one-a-second limit now counts real seconds, so a mod that freezes the game, like a photo mode, keeps getting pictures instead of one and then refusals.
  • Like
Reactions: blapblap
  • Switching a mod in F9 works in the same launch. A mod with no on_stop that you switch off is paused: what it changed or spawned stays, and switched back on, the same copy carries on when the menu closes. A mod with on_stop, or one that was off at launch, starts when the menu closes, when it can.
  • CRASH RECOVERY's Try again now restarts a mod in the same launch. A crash-guarded mod shows CRASH GUARD in the menu.
  • Works beside Rat's Shared Loader in either deploy order, and only the mods marked for it are left to it. They show a read-only row in F9, and mods from one patch file share a row.
  • With Rat's Shared Loader on top, a crash in a mod's start no longer gets this loader blocked by it.
  • Saved data survives more: unusual bytes in saved values and tables come back as they were, a table that saves always loads, a settings file that can't be read at launch isn't replaced, a switch-off survives a package gaining a mod or a crash in the mod's stop, and a log that can't open no longer moves a launch's files.
  • The crash guard learns from crashes in after_startup, event listeners, on_change, buttons, timers and spreads, each by where its code sits, and in the unit lookup, so a skip takes that place alone. A locked state or trace file no longer loses a crash or blames a working mod.
  • The hang watchdog catches loops it used to miss, such as a mod that keeps calling the loader's helpers or spends nearly all its time in a listener it fires, and an options file with an endless loop no longer freezes the launch.
  • A unit kept from an earlier world stays refused in every later world, even if nothing asked about it in between. (thanks sscoolqaz)
  • For mod authors: a chef helper handed a unit from a world that's gone now says so in the log, once per mod for each helper. chef.unit_alive stays quiet, so checking a unit first is still the clean way. (thanks sscoolqaz)
  • Fixes across the options menu, the performance monitor, language files, boot-style mods and the packing tools.
  • For mod authors: chef.watch hands back a small handle: items, generation, active (now documented), pause, resume, refresh and stop. w.a, w.next and w.kinds are gone from it; keep your own kinds table.
  • For mod authors: option specs are copied when you register a row, so editing a label or a list afterward doesn't change the row. A label or choice given as a function stays live.
  • Fixed: the HD2 Lua Runtime look-alike could end the game putting back a material a mod had replaced, using an id kept from earlier.
  • Like
Reactions: blapblap
  • A single launch that ends without a clean shutdown no longer blames a mod: closing the game from Task Manager looks just like a crash. A call is skipped, and counted against its mod, only when the next launch ends in it too.
  • Works beside a loader that bundles the HD2 Lua Runtime: when that loader hands off to this one, the mods that name the runtime as a requirement are left to it, which runs them on the real runtime; deployed above it, this loader runs them itself. The log and chef_loader_health.txt say which.
  • Run by another loader that handed off to it, the loader names that loader in the log and the health file, and the hang watchdog stays on: it takes the host's debug hook during the loader's own calls and gives it back after.
  • Older log sessions are kept: when chef_loader.log starts fresh, its launches move to chef_loader.old.log (the newest whole launches within 4 MB).
  • The log has a line when the mouse goes back to the game (once, however often a mod holds and lets go), and a mod can't take the mouse while the game closes.
  • Lower cost a frame: faster text, chef.call, camera, lines, sprite sheets and triangles, HD2 Lua Runtime unit reads, options menu and performance monitor. The game's settings file is read every 90 s, not 30.
  • Removed from the HD2 Lua Runtime look-alike: the live palette and cape calls, the inbox views, and the files and patches requests. Mods built on them run on their own runtime's loader.
  • For mod authors: put -- HD2-Requires: chef-shared-loader in every addon that uses chef, so another loader deployed above this one leaves it alone.
  • Fixed: a unit kept from an earlier world could pass as usable again two worlds later and end the game. It now stays refused as long as a mod keeps asking about it. (thanks sscoolqaz)
  • Fixed: colors with channels that weren't whole numbers could be drawn as another color, and one mod's bad color could slow every mod's bitmaps or turn every mod's triangles into rects for the session.
  • Like
Reactions: blapblap
  • A hang watchdog: a mod's call that runs on for more than 3 seconds (an endless loop; 10 seconds for its start) is stopped and the mod switched off for the session, so a stuck mod no longer freezes the game for good. Other mods' boot scripts are watched too while they load and run. It can't stop a stuck engine call.
  • CRASH RECOVERY (F9 > Chef Shared Loader) lists the mods the crash guard holds back, each with a "Try again next launch" button, so deleting chef_loader_state.txt by hand is no longer the only way.
  • Every mod has an on/off switch at the top of its options, mods without options included (they're listed now): off stops the mod at once and it stays off; on again, it starts again the next time you launch the game.
  • Each mod's title bar in the menu says how it's doing: running, off, kept off, stopped or not started (and why), its start's time and memory, and its last error. A screenshot of it makes a good bug report.
  • No loader mod can make the game write files, change or save its settings, open a browser or run console commands any more, and chef.call says why when it refuses one.
  • No loader mod can read other mods' saved data, the loader's own files or logs it didn't write, or load code under the loader's or another mod's name.
  • While the options menu is open, mods' hotkeys stay quiet, so typing a search never fires one.
  • Richer options for mods: buttons, colors (a palette with a swatch), headings, and a hint for the selected row. Key bindings take combos (Ctrl+Shift+F6) and controller buttons, and the menu captures both.
  • The options menu, reworked: the arrow keys do everything (no Enter, which also opened the game's chat), long mods' options fold under their headings, the compact menu moves out of the performance monitor's way and its hint line follows keys, mouse or controller, and the menu's colors now look as designed in game. Its cursor hides while you use a controller.
  • For mods: a shared mouse hold that always gives the camera back (when the last mod lets go, when a mod holding it stops, when the game closes), new menu, mod_stopped and players events, chef.ray_box, and chef.capture (a screenshot the loader saves itself, for trusted mods it's granted to).
  • For mod authors: type stubs for editor autocomplete (docs/types/chef.lua), a simulator that runs a mod without the game (tools/modsim/), and docs/TESTING.md on both.
  • Each mod's start is measured: its time and the Lua memory it added, in the log, chef_loader_health.txt (two new columns) and chef.mods().
  • The "Game patch files" switch is gone: a trusted mod that builds game patch files can't work without them, so they're now part of its permission. Every file it writes is still checked.
  • When a file-mod installer mod is still deployed while Medic File Mod Merger manages the game's settings files, the log and a notice say so.
  • For mods: chef.save refuses opt. keys (the options menu's own), and chef.own_log takes 8 names and 4 MB a launch at most.
  • Docs: how a mod gets on the trusted list (docs/MODDING.md), and a continuation clause in the LICENSE (what happens if the loader goes 3 months without a release).
  • Fixed: chef.players() counted a peer list keyed by peer id as 1 player; a chef.bitmap could flicker into a white square after another mod drew a lot; world lines (chef.line) stayed on screen after a mod stopped drawing them.
  • Fixed: a chef.notify with a bad color broke every notice for the session; a letter menu key closed the menu while you typed it in a search; sliders with a step of 1 or more showed rounded values; a saved choice a mod no longer has fell back to the first choice, not the default; chef.bind(nil) raised an error.
  • Fixed: chef.wheel, chef.cursor and chef.mouse_down stayed dead for the session when asked in the first frames; the crash guard could blame the wrong job after a long session; after an update, the loader kept reading the old version from its state file, so a crash on one kind of unit was never refused for every mod.
  • Like
Reactions: blapblap
  • Mods are no longer cut off when the game runs below your monitor's resolution in Borderless (Resolution 1920x1080 on a 1440p monitor, say): the loader compares the game's render size with the window's and draws in the UI world, as it already did for a Render Scale below native.
  • A mod updated after it crashed the game, but before the next launch, is no longer blamed for that crash: the crash counts against the file that was running, so the update is a change and its skipped calls are tried again.
  • chef_loader.log names the options menu's key at every start, with how to change it without the menu, and the status lines repeat it until the menu has opened once that launch. If F9 does nothing (a laptop's F keys, or an app with an F9 hotkey), try Fn+F9 or pick another key.
  • Like
Reactions: Rojomojo
  • A mod that crashes the game stays on: the call that crashed is skipped, and the mod is turned off only when it ends 3 launches in a row. An update of the mod tries its skipped calls again. A mod that crashes the game while it starts still isn't started again until it's updated.
  • A mod turned off after a crash comes back on when it's updated, and now the calls of its that crashed are tried again too.
  • A call on one kind of unit, made with only the unit, that ended the game for one mod is now refused for every mod. An update of the loader or of the game tries it again.
  • Trusted mods can build much bigger game patch files (up to 2,097,152 rows), and the log says why a patch file too big for mods isn't read.
  • Mods made for the HD2 Lua Runtime can list what they need and ask for access before they use it; what the loader lacks is named in the log, a notice and chef_loader_health.txt.
  • HD2 Lua Runtime mods get that runtime's live palette material calls: a mod can recolor its own copies, and the game's medium cape, during play.
  • Inboxes: a trusted mod can take plain data from any mod. Calls made before it's ready are held for it (16 per mod and call) and made once it is.
  • For language file makers: two new notices that start with a mod's name.
  • New option Monitor opacity (%): make the performance monitor see-through, down to 10.
  • Monitor on pause screen only is now Off, Missions or Always: Always keeps the monitor hidden on the ship too, until the pause screen is up.
  • New option Menu opacity % (Compact look): make the compact F9 panel see-through, down to 30.
  • The loader's own options are grouped under Menu (with Compact look and Controls) and Performance (with Monitor look).
  • The Game font option is gone: the game's font is always used once it's loaded, with the pixel font as the fallback.
  • Like
Reactions: Vhuz and blapblap