ME3Tweaks / ME3TweaksModManager

Mod Manager for Mass Effect Original Trilogy and Mass Effect Legendary Edition
GNU General Public License v3.0
121 stars 34 forks source link

"Launcher: autoboot selected game" doesn't work due to inverted condition? #387

Closed VioletGiraffe closed 1 month ago

VioletGiraffe commented 8 months ago

Hi, new ME3TMM user here. I was curious why the "Start game button" doesn't work, so I built and debugged the app. I think the if condition that checks the "autoboot selected game" setting is inverted. At least as far as I understood it, the ticked checkmark means "launch the game directly without invoking the launcher", but the condition is the opposite (GameLauncher.cs:215):

 if (Settings.SkipLELauncher && target.Game.IsLEGame() && !MUtilities.IsGameRunning(MEGame.LELauncher))
 {
     var launcherPath = Path.Combine(target.TargetPath, @"..", @"Launcher");
     ...
}

If this is indeed the intended semantic, then the description of the option is unclear (at least to me).

So I can get past this by un-ticking the "Launcher: autoboot selected game" option. But there's one more hurdle just a few lines below:

 if (presuppliedArguments != null)
 {
     // We were passed in arguments to use
     if (target.Supported)
     {
         WriteLEAutobootValue(presuppliedArguments);
     }
     RunGame(target, exe, presuppliedArguments, null, environmentVars);
 }

presuppliedArguments is an empty string, not a null string. Both with the default launch config and with a custom one (with the empty "arguments" field). So I replaced it with if (!String.IsNullOrEmpty(presuppliedArguments)), and the launcher is finally working! Or I can use vanilla ME3TMM build and get around this by supplying the correct arguments manually, of course.

P. S. It looks like the build dependencies / build order in the solution is not quite right. I couldn't build by just pressing "Build solution" because some projects didn't find build artifacts from the other projects - because their build order was reversed. Just clicking each one project and building it individually in the right order worked.

Mgamerz commented 8 months ago

Autoboot runs the launcher, instructing it to immediately run the appropriate game and then immediately exit. There isn't a way to directly run a game as the DRM reboots to the launcher. A game that had its DRM decrypted can run the game (and since EA app will only run the launcher exe, we must go through that).

The start game button doesn't "seem" to work because the EA app is terrible at running games, it's one job. Null check is something I'll look into - launch config is somewhat new and I didn't check how it saved an empty parameter set.

VioletGiraffe commented 8 months ago

Now I understand, thank you!