NorthstarLauncher
NorthstarLauncher copied to clipboard
Feature: start Origin/EA minimized and add an option to close the console
Alt-tabbing and sharing screens on Discord can be a pain with the console window open, and not many people are going to use it anyways, so a command-line argument that can be placed into origin's launch args or into the Northstar arguments text file would be really nice to have. Also, when starting Northstar without Origin or EA Desktop open, when it opens the app it should be minimised or hiding in the system tray.
I'm not totally sure if there are any specific window tags/hints/etc that Discord uses to figure out whether something can be streamed, so I wasn't able to figure out that sort of thing, but this diff is something that'll hide the console.
I'm not sure if this is the sort of thing people would want integrated into the launcher or not. If the console is hidden it currently makes it impossible (as I've tested) to stream the app on Discord.
I also added CREATE_NO_WINDOW for launching Origin, but that doesn't seem to make it start minimized. I don't personally know much about programming on windows specific API's so someone else might need to look into it.
diff --git a/LauncherInjector/main.cpp b/LauncherInjector/main.cpp
index 7697e80..7ff89b1 100644
--- a/LauncherInjector/main.cpp
+++ b/LauncherInjector/main.cpp
@@ -106,7 +106,7 @@ void EnsureOriginStarted()
memset(&pi, 0, sizeof(pi));
STARTUPINFO si;
memset(&si, 0, sizeof(si));
- CreateProcessA(originPath, (char*)"", NULL, NULL, false, CREATE_DEFAULT_ERROR_MODE | CREATE_NEW_PROCESS_GROUP, NULL, NULL, (LPSTARTUPINFOA)&si, &pi);
+ CreateProcessA(originPath, (char*)"", NULL, NULL, false, CREATE_DEFAULT_ERROR_MODE | CREATE_NEW_PROCESS_GROUP | CREATE_NO_WINDOW, NULL, NULL, (LPSTARTUPINFOA)&si, &pi);
printf("[*] Waiting for Origin...\n");
@@ -139,6 +139,18 @@ void PrependPath()
}
}
+bool ShouldHideConsole()
+{
+ return strstr(GetCommandLineA(), "-hideConsole") != NULL;
+}
+
+bool HideConsole()
+{
+ // Could also use ShowWindow(GetConsoleWindow(), SW_HIDE);
+ // Not clear what the main difference is between these things.
+ return FreeConsole();
+}
+
bool ShouldLoadNorthstar(int argc, char* argv[])
{
bool loadNorthstar = true;
@@ -230,6 +242,12 @@ int main(int argc, char* argv[]) {
}
}
+ if (ShouldHideConsole())
+ {
+ printf("[*] Goodbye console...");
+ HideConsole();
+ }
+
printf("[*] Launching the game...\n");
auto LauncherMain = GetLauncherMain();
if (!LauncherMain)
Will look into this issue for next release
#107 allows you to hide the console so that's a start
#108 makes origin start in the background
also it seems like the problem with discord not identifying the titanfall window is fixed and may have been for a while; i get the thing in the bottom left prompting me to screen share titanfall 2 when i have northstar open