Skip to content

Conversation

@jb55
Copy link
Contributor

@jb55 jb55 commented Jul 12, 2025

These are a few minimal commits to stop the application from outright crashing when creating custom items.

The main reason this is needed is there are a few places in the codebase that map item ids to icons, slots, and item actions. Since these are fixed sized tables, custom ids fall outside the range of these tables and then it crashes. These are non-behavior-modifying changes to these lookups so that custom ids work.

The plan is to a have a dynamic hook-based approach for creating new items on the fly without touching the upstream code too much.

Unfortunately still builds on:

since I need that to compile

jb55 added 4 commits July 7, 2025 12:08
On some distros format-security is turned on to detect possible issues
with non-string literals as format strings

Let's explicitly turn it on and fix the ImgUi text formatting to avoid
compile issues on those platforms

Signed-off-by: William Casarin <[email protected]>
This is a safe wrapper around the icon table so that
we don't immediately crash when we try to use an
id that isn't expected

Signed-off-by: William Casarin <[email protected]>
When creating custom items, let's not immediately crash if
trying to lookup an unknown item action for a new id

Signed-off-by: William Casarin <[email protected]>
When creating custom items, have a fallback slot for custom item ids
that don't have an entry in the itemId -> slot mapping table

Signed-off-by: William Casarin <[email protected]>
@serprex serprex requested a review from aMannus January 10, 2026 21:27
@serprex
Copy link
Contributor

serprex commented Jan 10, 2026

@aMannus is this related to Roc's Feather? does #6035 affect this PR in any way?

@aMannus
Copy link
Contributor

aMannus commented Jan 10, 2026

I've handled everything that was required for Roc's. This would protect against crashes but properly implemented items shouldn't hit any of these failsafes to begin with. It's also directly replacing source code which I'm not super jazzed about.

I would like to know what the actual purpose of this is. I understand that the plan is to ultimately have other systems to introduce custom items, but the payoff here feels questionable to me.

@serprex
Copy link
Contributor

serprex commented Jan 11, 2026

@jb55 could you split out -Wformat-security portion to separate PR? I think rest of this we'll pass on

@jb55 jb55 closed this Jan 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants