Fix LaunchAndFocus and ship AppLauncher keys in the default retrobat.ini - #50
Open
goldorakiller wants to merge 2 commits into
Open
Conversation
Follow-up to review feedback on RetroBat-Official#48. - The black splash was only closed inside the success branch (esHandle != IntPtr.Zero && !isExternalLauncher). When the main window handle was never obtained - exclusive fullscreen, or EmulationStation exiting early - it stayed on screen for the whole wait. It is now closed unconditionally right after the (bounded) wait loop, with a finally block as a safety net if an exception is thrown earlier. CloseBlackSplash is idempotent, so the extra call is harmless. - The method returned true even when an exception was caught, so callers could not distinguish a successful launch from a failed one. The success return is now at the end of the try block and the catch returns false. The XML doc was updated to match the new contract.
The AppLauncher option was documented but never appeared in a freshly generated retrobat.ini: it was written as "AppLauncher=" with an empty value, and IniFile.ToString() skips entries whose value is empty, so the line was dropped as soon as the file was saved. Users had to add the key by hand to discover the feature. - The default ini now ships AppLauncher="" and AppLauncher2="" as real keys. The value "" is not an empty string, so the lines survive every rewrite, and an empty value still means "disabled" as documented. - The supported number of entries is now a single constant (MaxAppLaunchers) shared with the ini comment, instead of a magic 20 duplicated in both places. - An entry with no path is skipped silently, since that is the state every default install ships with; an entry whose path is set but does not exist is still logged as a warning. Reading the configuration never writes to retrobat.ini: entries are read with GetValue, so absent keys stay absent. As a result, a key manually emptied down to "AppLauncher=" is still dropped on the next save, which is the pre-existing IniFile behaviour and leaves the feature disabled.
goldorakiller
force-pushed
the
fix/launch-and-focus-splash-and-return
branch
from
August 26, 2026 19:19
e950912 to
36bba0c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR groups two related follow-ups on the launcher. It started as the
LaunchAndFocusfix alone and now also carries theAppLauncherini fix.1. LaunchAndFocus (review feedback from @Tartifless)
The black splash could stay on screen indefinitely.
SplashVideo.CloseBlackSplash()was only called on the success path (esHandle != IntPtr.Zero && !isExternalLauncher). When the window handle was never obtained — exclusive fullscreen, or EmulationStation exiting early — it was never closed there. It is now closed unconditionally right after the wait loop, which is bounded bymaxWaitMsand therefore always reached, with afinallyas a safety net in case an exception is thrown earlier.Missing
return falsein thecatch.return truesat after thetry/catch, so a failure to start EmulationStation was logged and then reported as a success.return truemoved to the end of thetry,return falseadded to thecatch, and the XML doc updated to match the new contract.2. AppLauncher missing from a generated retrobat.ini
The option was documented but never showed up in a freshly generated
retrobat.ini. It was written asAppLauncher=with an empty value, andIniFile.ToString()skips entries whose value is empty, so the line was dropped as soon as the file was saved. Users had to add the key by hand to discover the feature.AppLauncher=""andAppLauncher2=""as real keys.""is not an empty string, so the lines survive every rewrite, and an empty value still means "disabled" as documented.MaxAppLaunchers) shared with the ini comment, instead of a magic20duplicated in both places.Reading the configuration never writes to
retrobat.ini: entries are read withGetValue, so absent keys stay absent. A key manually emptied down toAppLauncher=is therefore still dropped on the next save, which is pre-existingIniFilebehaviour and simply leaves the feature disabled.Generated
[RetroBat]sectionTesting
Release build passes with no warnings. The ini behaviour was checked with a standalone harness driving
IniFile+RetroBatConfigLoaderover three scenarios: fresh generation, a full rewrite triggered by a missing key, and a real path set by the user. TheAppLauncherlines and their values survive in all three, and loading the configuration leaves the file untouched.Follow-up to review feedback on #48.The black splash was only closed inside the success branch (esHandle != IntPtr.Zero && !isExternalLauncher). When the main window handle was never obtained - exclusive fullscreen, or EmulationStation exiting early - it stayed on screen for the whole wait. It is now closed unconditionally right after the (bounded) wait loop, with a finally block as a safety net if an exception is thrown earlier. CloseBlackSplash is idempotent, so the extra call is harmless.
The method returned true even when an exception was caught, so callers could not distinguish a successful launch from a failed one. The success return is now at the end of the try block and the catch returns false. The XML doc was updated to match the new contract.