Skip to content

[BUG] Game 0.4.7f11: ProductPackagingContentPatches fails to apply (ProductIconManager.GenerateIcons was removed) #352

Closed

Description

@r-melvin

Summary

On game 0.4.7f11 the whole ProductPackagingContentPatches class fails to patch at start-up, because f11 removed ProductIconManager.GenerateIcons, which two of its five patches target. Harmony rejects the class as a unit, so the other three patches (MultiTypeVisualsSetter.ApplyVisuals, IconGenerator.GeneratePackagingIcon, ProductIconManager.GetIcon) are not applied either: custom product packaging contents and their icons fall back to the native visuals. The current beta source also no longer compiles against the f11 game assemblies (nameof(ProductIconManager.GenerateIcons)).

Game Version

0.4.7f11 (IL2CPP public beta and Mono alternate beta)

S1API Version

3.2.1-beta.8 (release ZIP) and beta at 24386da

MelonLoader Version

0.7.3 Open-Beta

Runtime Environment

Both

Steps to Reproduce

  1. Game 0.4.7f11, MelonLoader 0.7.3, S1API 3.2.1-beta.8 only.
  2. Launch the game to the main menu.
  3. Read the MelonLoader log.

Expected vs Actual Behavior

Expected: S1API's Harmony patches all apply.
Actual (IL2CPP):

[ERROR] [S1API_(Forked_by_Bars)] Failed to HarmonyInit PatchAll: S1API.Internal.Patches.ProductPackagingContentPatches
[ERROR] [S1API_(Forked_by_Bars)] HarmonyLib.HarmonyException: Patching exception in method null
 ---> System.ArgumentException: Undefined target method for patch method static void S1API.Internal.Patches.ProductPackagingContentPatches::GenerateIconsPrefix()

Actual (Mono, 0.4.7f11 Alternate):

[ERROR] [S1API_(Forked_by_Bars)] Failed to HarmonyInit PatchAll: S1API.Internal.Patches.ProductPackagingContentPatches
[ERROR] [S1API_(Forked_by_Bars)] HarmonyLib.HarmonyException: Patching exception in method null ---> System.ArgumentException: Undefined target method for patch method static void S1API.Internal.Patches.ProductPackagingContentPatches::GenerateIconsPrefix()

A local test mod that reads Harmony.GetPatchInfo at the menu confirms the knock-on effect on both runtimes: MultiTypeVisualsSetter.ApplyVisuals, ProductIconManager.GetIcon and IconGenerator.GeneratePackagingIcon have no S1API patch.

Building beta against the f11 assemblies (both runtimes): error CS0117: 'ProductIconManager' does not contain a definition for 'GenerateIcons'.

MelonLoader Log

See above.

What Have You Tried?

f11's ProductIconManager has GetIcon(string, string, bool), GenerateRuntimeIcons(string productID), GenerateRuntimeProductTexture(string, string), GenerateProductTexture(string, string) and DestroyRuntimeIcons(): icons are now generated on demand per product instead of in one batch at load. IconGenerator.GeneratePackagingIcon(string, string, int) and MultiTypeVisualsSetter.ApplyVisuals(ProductItemInstance) are unchanged.

A fix I've tested: move the two GenerateIcons hooks (they only defer custom icons during the old load-time batch) into their own patch class that applies only when GenerateIcons exists (Prepare/TargetMethod with AccessTools). On f11 the other three patches then apply, and the packaging-icon prefix generates custom icons directly, as it already does outside a batch. With it, the same check shows all three patched on both runtimes, with no error or warning at start-up. Builds on both runtimes; I'll link the PR here.

Additional Context

Found while testing on f11 for #351.

Activity

  1. added
    bugSomething isn't working
    HighAPI features not working, or minor gameplay hinderance
    on Oct 8, 2026
  2. ifBars commented on Oct 8, 2026

    @ifBars
    Owner

    Reproduced on both SteamCMD-updated 0.4.7f11 copies: alternate-beta Mono build 25770882 and beta IL2CPP build 25770926. Published S1API 3.2.1-beta.8 attempts to patch the removed ProductIconManager.GenerateIcons method; Harmony rejects that class and the ApplyVisuals, GeneratePackagingIcon, and GetIcon prefixes are absent.

    PR #353 fixes the registration failure on both runtimes. An asset-bearing custom-product probe exercised the three native methods and checked visible custom red content in the generated 512x512 baggie icon; screenshots are in the PR. Its exact head passes 775 Mono / 749 IL2CPP tests and both hosted workflows with refreshed f11 assembly references. No merge or release has been performed, so the issue stays open pending delivery.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    HighAPI features not working, or minor gameplay hinderancebugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions