Skip to content

Fix Android black screens from locale parsing and font substitution failures - #60

Open
SocialHummingbird wants to merge 2 commits into
Ekyso:mainfrom
SocialHummingbird:fix/android-black-screen-startup
Open

Fix Android black screens from locale parsing and font substitution failures#60
SocialHummingbird wants to merge 2 commits into
Ekyso:mainfrom
SocialHummingbird:fix/android-black-screen-startup

Conversation

@SocialHummingbird

@SocialHummingbird SocialHummingbird commented May 14, 2026

Copy link
Copy Markdown

Summary

  • Adapts the Android locale fix path from Fix black screen caused by Unicode locale extensions #38 so CultureInfo does not receive Unicode extension locale tails.
  • Sanitizes locale output at NullPlatformUtilStrategy.GetRawLanguage via postfix, preserving the game�s original GetThreeLetterLanguageCode logic for script/region-specific handling.
  • Handles both -u-... and -#u-... extension forms, with en-US fallback when the sanitized raw locale is empty or whitespace.
  • Adds a guarded font-substitution workaround from Fix post-update blackscreen: swallow font NRE, unbreak ModLoaderPatches #49 for post-update Android startup/UI black-screen failures.
  • Patches all ApplyLocaleFontSubstitution overloads to avoid AmbiguousMatchException if the game DLL exposes multiple matching methods.
  • Suppresses only NullReferenceException in ApplyLocaleFontSubstitution; non-NRE exceptions remain visible.
  • Scope intentionally limited to startup black-screen paths. No unrelated launcher, ModLoader, controller, or feature changes.

Links

Validation status

  • Local dotnet build src/STS2Mobile/STS2Mobile.csproj was attempted.
  • Build is blocked in this checkout because referenced assemblies are missing under upstream/godot-export/.godot/mono/publish/arm64/: 0Harmony, GodotSharp, and sts2.
  • Maintainer/device runtime validation is requested, especially on Samsung Fold and Android 16 locale-extension repro devices.

Test plan

  • Build src/STS2Mobile/STS2Mobile.csproj in a checkout with the required Godot/StS2 reference assemblies
  • Samsung Fold repro settings: verify Play no longer leaves persistent dev/command overlay or black screen
  • Samsung Android 16 / One UI non-US locale path
  • Pixel Android 16 locale extension path (-u-... / -#u-...)
  • Default English US locale/regional preferences regression check
  • Confirm no CultureNotFoundException at startup
  • Confirm no repeated ApplyLocaleFontSubstitution NRE spam

@SocialHummingbird

Copy link
Copy Markdown
Author

Update for 1a4b6208bb1c72aacaebc0baae5760c81692a67a:

  • Font substitution patch now enumerates and patches all ApplyLocaleFontSubstitution overloads, avoiding AmbiguousMatchException if the game DLL exposes more than one matching method.
  • Locale fix now sanitizes NullPlatformUtilStrategy.GetRawLanguage via postfix instead of replacing GetThreeLetterLanguageCode, so the game�s original script/region language-code handling still runs.
  • Locale sanitizer still handles both -u-... and -#u-...; empty/whitespace sanitized raw locales fall back to en-US before downstream parsing.

Build was attempted locally, but this checkout is missing the referenced 0Harmony, GodotSharp, and sts2 assemblies under upstream/godot-export/.godot/mono/publish/arm64/, so maintainer/device validation is still needed.

@SocialHummingbird
SocialHummingbird marked this pull request as ready for review May 14, 2026 20:01
@SocialHummingbird

Copy link
Copy Markdown
Author

Quick follow-up on #60: this combines the locale and font-substitution startup fixes discussed in #38/#49, with additional edge-case hardening.

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.

1 participant