Skip to content

Commit

Permalink
Release - 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ShizCalev committed Dec 6, 2023
1 parent 9272c02 commit 3b786cb
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 0 deletions.
Binary file added Source/ico.ico
Binary file not shown.
88 changes: 88 additions & 0 deletions Source/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#include <iostream>
#include <windows.h>
#include <cstdlib>
#include <shellapi.h>
#include <tlhelp32.h>

using namespace std;

LPCTSTR gEX;
LPCTSTR oID;
HANDLE GetHndl(LPCTSTR pName);
int Start(LPCTSTR pName, LPCTSTR pArgs);
bool IsRunning(LPCTSTR pName);
void Kill(LPCTSTR pName);

int main(int argc, char **argv)
{
FreeConsole();

//determine origin directory
LPCTSTR oDir;
if (argv[1]!=NULL){
oDir = argv[1];}
else oDir = "C:/PROGRA~2/Epic Games/Launcher/Portal/Binaries/Win32/EpicGamesLauncher.exe";
//check if Epic is running
if (IsRunning("EpicGamesLauncher.exe")){
Kill("EpicGamesLauncher.exe");}
//start Epic as child program
if (Start(oDir,"-StartClientMinimized") <= 32){
MessageBox(0, "Failed to launch Epic. \nIf it's not installed in the default location, put the full path to EpicGamesLauncher.exe in the launch parameters.", "Error", MB_OK);
return 1;}
while (!IsRunning("EpicGamesLauncher.exe")){
Sleep(1000);}
//wait for Epic to go idle
Sleep(8000);
//launch game
oID = "com.epicgames.launcher://apps/fn%3A4fe75bbc5a674f4f9b356b5c90567da5%3AFortnite?action=launch&silent=true";
Start(oID, NULL);
for (int i = 1; i<41; i++){
Sleep (1000);}
gEX = "FortniteClient-Win64-Shipping.exe";
//exit if game does not start after 40s
if (!IsRunning(gEX)){
MessageBox(0, "Game doesn't appear to be running. Closing launcher.", "Error", MB_OK);
Kill("EpicGamesLauncher.exe");
return 1;}
//wait for game to close
while (IsRunning(gEX)){
Sleep(1000);}
//give some time for cloud sync
Sleep(8000);
//Close Epic
Kill("EpicGamesLauncher.exe");
return 0;
}

//--------------- F U N C T I O N S ---------------//

HANDLE GetHndl(LPCTSTR pName){
PROCESSENTRY32 entry;
entry.dwSize = sizeof(PROCESSENTRY32);
HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
if (Process32First(snapshot, &entry) == TRUE){
while (Process32Next(snapshot, &entry) == TRUE){
if (_stricmp(entry.szExeFile, pName ) == 0){
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, entry.th32ProcessID);
CloseHandle(snapshot);
return hProcess;}}
}return 0;
}

int Start(LPCTSTR pName, LPCTSTR pArgs){
HINSTANCE h = ShellExecute(NULL,"open",pName,pArgs,NULL,SW_SHOW);
int r = (int) h;
return r;
}

bool IsRunning(LPCTSTR pName){
if (GetHndl(pName)==0)
return 0;
return 1;
}

void Kill(LPCTSTR pName){
HANDLE hProcess = GetHndl(pName);
TerminateProcess(hProcess, 0 );
}

Binary file added Source/resources.aps
Binary file not shown.
30 changes: 30 additions & 0 deletions Source/resources.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#define VOS_NT_WINDOWS32 0x00040004L
#define VFT_APP 0x00000001L

A ICON MOVEABLE PURE LOADONCALL DISCARDABLE "ico.ico"

1 VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0
FILETYPE VFT_APP
{
BLOCK "StringFileInfo"
{
BLOCK "040904E4"
{
VALUE "CompanyName", "Afevis / ShizCalev @ GitHub"
VALUE "FileVersion", "1.0.0.0"
VALUE "FileDescription", "Fortnite Steam Overlay Launcher"
VALUE "InternalName", "Fortnite-Launcher"
VALUE "LegalCopyright", "Afevis 2023"
VALUE "LegalTrademarks", "Afevis"
VALUE "OriginalFilename", "Fortnite-Launcher"
VALUE "ProductName", "Fortnite-Launcher"
VALUE "ProductVersion", "Initial"
}
}
BLOCK "VarFileInfo"
{
VALUE "Translation", 0x0409, 1252
}
}

0 comments on commit 3b786cb

Please sign in to comment.