Skip to content

fix: name the packaging-icon patch signature so it binds beside added overloads - #336

Merged
ifBars merged 2 commits into
ifBars:betafrom
r-melvin:fix/packaging-icon-patch-signature
Oct 2, 2026
Merged

ifBars merged 2 commits into
ifBars:betafrom
r-melvin:fix/packaging-icon-patch-signature

Conversation

@r-melvin

@r-melvin r-melvin commented Oct 1, 2026 •

Copy link
Copy Markdown

Summary

ProductPackagingContentPatches names IconGenerator.GeneratePackagingIcon without its argument types. The game has one method of that name, (string, string, int iconSize = 512). Polyfill, which rewrites the IL2CPP interop assembly, adds a (string, string) overload beside it. With Polyfill installed, Harmony can't choose between the two:

[Polyfill.Boot] [harmony] S1API.Internal.Patches.ProductPackagingContentPatches did not bind and was skipped: Ambiguous match found.

MelonLoader then skips the whole class, which is all six of its patches (custom product/package visuals and icons).

The change. Both patches name the game's signature, (string, string, int).

A new test, HarmonyPatchTargetTests, resolves every attribute-declared patch target in S1API against the referenced game assembly. It fails when a name matches no method or more than one. These two were the only failures. It skips TargetMethod(s) classes and non-method targets. It catches this case only when built against an interop assembly with the extra overload, as a Polyfill-rewritten one has.

Polyfill also fixes its side: DooDesch-Mods/ScheduleOne-Polyfill#109.

Compatibility

  • Public/protected API: none changed.
  • Existing defaults and behavior: none; the same method is patched. The test project now references 0Harmony.
  • Stable IDs, saves, and network payloads: none touched.

Validation

Mono

dotnet build S1API.sln -c MonoMelon --no-restore -p:AutomateLocalDeployment=false: 0 errors, 0 warnings. dotnet test ... -c MonoMelon: 741 passed (740 on beta plus 1 new).

IL2CPP

dotnet build S1API.sln -c Il2CppMelon --no-restore -p:AutomateLocalDeployment=false: 0 errors, 0 warnings. dotnet test ... -c Il2CppMelon: 721 passed (720 plus 1 new; it fails without the fix when built against a Polyfill-rewritten interop).

Runtime evidence

How it was tested. Automated runs on 0.4.7f7 load a save, teleport to each custom NPC, record whether its model is shown and its network state, return to the menu and load again. They used a combined build of #332 to #339.

  • Same mods on both runtimes: IL2CPP and Mono "Alternate", with BigWillyMod, The Big Pimpin, Drug Expansion, S1MAPI and SteamNetworkLib. IL2CPP ran without Polyfill, on the game's own interop assembly.
  • IL2CPP with about 60 mods: including Polyfill, Siesta and S1UMF.
  • Saves: an early save and a late one where The Big Pimpin's intro is played through.

I also played the IL2CPP case by hand.

  • IL2CPP with Polyfill, beta as it is: Harmony's patch info shows nothing attached to IconGenerator.GeneratePackagingIcon or MultiTypeVisualsSetter.ApplyVisuals. ProductIconManager.GetIcon returns no icon for Drug Expansion's MDMA in a baggie, jar or brick.
  • Same setup with this change: both methods are patched by S1API, and all three icons render (512×512): the jar shows MDMA's pink heart pills, Drug Expansion's custom packaging content. This held on both loads of a session.
  • Without Polyfill: the class binds, on both runtimes, with or without this change.

Documentation

None needed.

🤖 Generated with Claude Code

… overloads

ProductPackagingContentPatches named IconGenerator.GeneratePackagingIcon by name only. The game has one
method of that name, (string, string, int), but Polyfill rewrites the IL2CPP interop assembly and adds a
(string, string) compatibility overload. With Polyfill installed Harmony cannot choose ("Ambiguous match
found") and MelonLoader skips the whole patch class, so custom product/package visuals and icons are
unpatched. Without Polyfill, and on Mono, it bound as before.

Both patches now name the game's signature. A new test resolves every attribute-declared patch target in
S1API against the referenced game assembly and fails when a name matches no method or more than one. It
catches this only when the referenced interop assembly has the extra overload (as a Polyfill-rewritten one
does); against a stock assembly these two patches already resolved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: cfcb90ba-91c1-4fb4-a1a6-2cd8847ea4a3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@r-melvin
r-melvin marked this pull request as ready for review October 1, 2026 23:34
@ifBars ifBars added beta A game update on the beta & alternate-beta steam branches bug Something isn't working products Native game product system labels Oct 2, 2026
@ifBars

ifBars commented Oct 2, 2026

Copy link
Copy Markdown
Owner

I pushed 6f9b7cb to remove the redundant introduction in the patch-target test. Kept the explanation of Harmony's argument matching and the XML docs. No runtime changes in this follow-up. Full builds and suites pass: 741 Mono, 721 IL2CPP.

@ifBars

ifBars commented Oct 2, 2026 •

Copy link
Copy Markdown
Owner

Tested on 0.4.7f7 Mono and IL2CPP. The Harmony prefix and finalizer both bound to GeneratePackagingIcon(string, string, int). The method produced a 128x128 baggie/ogkush icon on the first load and after reloading.

CI passed. The combined build of #332, #333, #334, #336 and #337 also passed all 770 Mono and 744 IL2CPP tests. Merged into beta.

@ifBars
ifBars merged commit d72d893 into ifBars:beta Oct 2, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beta A game update on the beta & alternate-beta steam branches bug Something isn't working products Native game product system

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants