Skip to content

macOS: load lang/ + sound/aac/, dress up Set username dialog - #6

Merged
j92580498-max merged 1 commit into
mainfrom
devin/1778792481-macos-i18n-sound-username
May 14, 2026
Merged

macOS: load lang/ + sound/aac/, dress up Set username dialog#6
j92580498-max merged 1 commit into
mainfrom
devin/1778792481-macos-i18n-sound-username

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

Three macOS-only fixes for the bugs reported in the last test pass (broken Options text, silent game, near-invisible username dialog). All on top of 7f3f64f.

1. Options/Game settings text was rendering as raw keysAppPlatform_macOS::readAssetFile was modeled on the iOS port and stripped both the directory and the extension from the requested asset path. The iOS bundle is flat; ours mirrors the source data/ tree, so lang/en_US.lang was being looked up as en_US.lang only under Resources/images/ and the bundle root. The lookup failed → I18n::loadLanguage loaded zero strings → every I18n::get(id) fell back to return id + '<'; (literal < suffix), so the in-game Options screen showed labels like options.group.mojang< instead of Account. Hard-coded ASCII strings (Armor, Survival, Creative) kept working, which matches what the user saw on-device. Fix: keep the subdirectory in filename, only strip the extension — findBundleResource already searches the raw subdir (lang/, etc.) as a fallback.

2. The game was completely silentSoundEngine::_pp called [NSBundle pathForResource:fn ofType:@"m4a"] with no inDirectory:. Apple's pathForResource:ofType: only scans the top of Resources/ and *.lproj children. The Makefile copies handheld/data/sound/aac/<category>/<file>.m4a into the bundle, so every lookup returned nil and no clip ever loaded. Fix: try the four categories that actually exist on disk (damage, mob, random, step) plus sound/aac/ and sound/ as fallbacks, and only as a last ditch the flat bundle root that iOS uses.

3. The Set username dialog read as "there's no window at all"DIALOG_SET_USERNAME was using the generic accessory path with rows == 1, no label, no informative text, a "Name" placeholder and a thin 32-tall accessory frame. Visually it collapsed to a thin unlabelled strip under the Set username title. Fix: lay out rows as <label> | <control> (so even a one-row dialog has a clearly captioned field), give the username dialog its own Username: caption + Username placeholder + an informative-text sentence, and pre-fill the field from the saved mp_username so it's obvious the field is editable.

Review & Testing Checklist for Human

This is yellow risk — the changes are scoped to three small areas but I could not run a real macOS build on this box; CI is the first integration test. Please double-check:

  • Open the in-game Options screen on the built .app — the tab labels (Account, Game, Controls, Graphics) and per-row captions should now be real English text instead of options.group.mojang< style keys.
  • Sounds: place/break a block, take fall damage, hit a mob — confirm at least one clip plays. Console will print MyGetOpenALAudioData: errors if a lookup still fails.
  • On the Options screen, tap the username button — the Set username NSAlert should now show a labelled Username: field pre-filled with the current name, with an informative line under the title.
  • World creation / rename still work — the same dialog code path was touched. Each field should now show its own caption (Name:, Seed:, Game mode:).

Notes

I deliberately did not touch the player-preview rendering in ArmorScreen (reported as "the player is not shown"). The relevant code (ArmorScreen::renderPlayer, MobRenderer::render, PlayerRenderer) hasn't changed since the initial commit, and I couldn't reproduce or debug it without a Mac — I'd rather not start poking at GL state blindly. If after this PR the Options text + sound look right but the armor-preview player is still missing, I'll do a focused follow-up for that one specifically (likely a GL state issue around alpha test / texture binding when entering the inventory screen).

The <name> wow\ line in the screenshots is not a bug — the local player's default name is the literal string "name" (see Player.cpp), and <name> is the chat prefix wrapped around it.

Link to Devin session: https://app.devin.ai/sessions/5a7050a439284734a4b5702cd21fd2b7
Requested by: @j92580498-max

- readAssetFile: keep the subdirectory part of the requested path
  (only the extension is stripped) so I18n can load lang/en_US.lang
  from Contents/Resources/lang/. Previously the directory was thrown
  away and findBundleResource only looked under images/, so every
  translated string in the in-game Options screen fell back to the
  raw key + '<' suffix.

- SoundEngine::_pp: look inside Contents/Resources/sound/aac/{damage,
  mob,random,step}/ subdirectories. NSBundle's pathForResource:ofType:
  only scans the top of Resources/ and *.lproj children, so previously
  every clip lookup returned nil and the game was completely silent.

- DIALOG_SET_USERNAME: give the alert its own informative line, a
  dedicated 'Username:' caption, a Username placeholder, and pre-fill
  the field from the saved mp_username so it's obvious there's an
  editable text field there. The generic dialog accessory now lays
  out rows as <label> | <control> so single-row dialogs no longer
  render as a thin unlabelled strip.
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@j92580498-max
j92580498-max merged commit 579a5e3 into main May 14, 2026
2 checks passed
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