Changes in description.

* Added icon to launcher.exe
* Launcher.exe gets remnamed to Run R5 Reloaded.exe in launcher release compilation configuration.
* Extended argument buffer for starting the game in launcher.exe.
* Added exception printing if in the custom ConVars an invalid value gets passed.
This commit is contained in:
IcePixelx 2021-08-19 14:32:52 +02:00
parent 70b4c02a9a
commit 0e171fca6a
9 changed files with 166 additions and 22 deletions

View File

@ -151,7 +151,7 @@
<AdditionalDependencies>Minhook.x64.lib;r5net.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>del $(SolutionDir)bin\$(Configuration)\r5dev.dll
<Command>del "$(SolutionDir)bin\$(Configuration)\r5dev.dll"
rename "$(TargetPath)" "r5dev.dll"</Command>
</PostBuildEvent>
<PreBuildEvent>

View File

@ -26,7 +26,7 @@ namespace GameGlobals
}
catch (std::exception& e)
{
std::cout << " [+CGameConsole+] Please don't input a character that isn't a number into cgameconsole :(.\n";
std::cout << " [+CGameConsole+] Please don't input a character that isn't a number into cgameconsole :(." << e.what() << std::endl;
}
}
@ -50,7 +50,7 @@ namespace GameGlobals
}
catch (std::exception& e)
{
std::cout << " [+CCompanion+] Please don't input a character that isn't a number into ccompanion :(.\n";
std::cout << " [+CCompanion+] Please don't input a character that isn't a number into ccompanion :(." << e.what() << std::endl;
};
}
}

BIN
r5launcher/R5 Reloaded.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -1,6 +1,6 @@
#include <string>
#include <stdio.h>
#include <iostream>
#include <Windows.h>
#include <detours.h>
@ -40,7 +40,7 @@ bool LaunchR5Apex(LAUNCHMODE lMode, LAUNCHSTATE lState)
BOOL result;
FILE* sLaunchParams;
CHAR sArgumentBuffer[1024] = { 0 };
CHAR sArgumentBuffer[2048] = { 0 };
CHAR sCommandDirectory[MAX_PATH];
LPSTR sCommandLine = sCommandDirectory;
@ -173,23 +173,59 @@ bool LaunchR5Apex(LAUNCHMODE lMode, LAUNCHSTATE lState)
///////////////////////////////////////////////////////////////////////////////
int main(int argc, char* argv[], char* envp[])
{
for (int i = 1; i < argc; ++i)
std::cout << "If you choose Dev as start parameter do not host servers into the Server Browser\n\n"
<< "Every command will be and people can execute any script on your server.\n\n"
<< "Use release for normal playing.\n\n"
<< "Dev should only be used for testing purposes.\n\n";
std::cout << "Enter 1 for Dev Build. Enter 2 for Release Build:\n";
std::string input = std::string();
if (std::cin >> input)
{
std::string arg = argv[i];
if ((arg == "-dedicated") || (arg == "-dedi"))
try
{
LaunchR5Apex(LAUNCHMODE::LM_DEDI, LAUNCHSTATE::LS_CHEATS);
Sleep(2000);
return EXIT_SUCCESS;
LAUNCHMODE iinput = (LAUNCHMODE)std::stoi(input);
switch (iinput)
{
case LAUNCHMODE::LM_DEBUG:
{
LaunchR5Apex(LAUNCHMODE::LM_DEBUG, LAUNCHSTATE::LS_CHEATS);
Sleep(2000);
return EXIT_SUCCESS;
}
case LAUNCHMODE::LM_GAME:
{
LaunchR5Apex(LAUNCHMODE::LM_GAME, LAUNCHSTATE::LS_CHEATS);
Sleep(2000);
return EXIT_SUCCESS;
}
case LAUNCHMODE::LM_DEDI:
{
LaunchR5Apex(LAUNCHMODE::LM_DEDI, LAUNCHSTATE::LS_CHEATS);
Sleep(2000);
return EXIT_SUCCESS;
}
default:
{
std::cout << "R5 Reloaded asked for a number between 1 and 2 :(.\n";
Sleep(2000);
return EXIT_FAILURE;
}
}
}
if ((arg == "-debug") || (arg == "-dbg"))
catch (std::exception& e)
{
LaunchR5Apex(LAUNCHMODE::LM_DEBUG, LAUNCHSTATE::LS_CHEATS);
Sleep(2000);
return EXIT_SUCCESS;
std::cout << "R5 Reloaded asked for a number and not a letter or anything of that sort :(." << e.what() << std::endl;
Sleep(5000);
return EXIT_FAILURE;
}
}
LaunchR5Apex(LAUNCHMODE::LM_GAME, LAUNCHSTATE::LS_CHEATS);
Sleep(2000);
std::cout << "R5 Reloaded needs an input to launch :(.\n";
Sleep(5000);
return EXIT_SUCCESS;
}

View File

@ -5,9 +5,10 @@
//-----------------------------------------------------------------------------
enum class LAUNCHMODE : int
{
LM_GAME, // Dev DLL
LM_DEDI, // Dedi DLL
LM_DEBUG // Debug DLL
LM_NULL,
LM_DEBUG, // Debug DLL
LM_GAME, // Release DLL
LM_DEDI // Dedi DLL
};
//-----------------------------------------------------------------------------

71
r5launcher/r5launcher.rc Normal file
View File

@ -0,0 +1,71 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// German (Germany) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
#pragma code_page(1252)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON1 ICON "R5 Reloaded.ico"
#endif // German (Germany) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -165,8 +165,8 @@
<AdditionalDependencies>detours.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>
</Command>
<Command>del "$(SolutionDir)bin\$(Configuration)\Run R5 Reloaded.exe"
rename "$(TargetPath)" "Run R5 Reloaded.exe"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
@ -174,6 +174,13 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="main.h" />
<ClInclude Include="resource.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="r5launcher.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="R5 Reloaded.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View File

@ -23,5 +23,18 @@
<ClInclude Include="main.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="r5launcher.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Image Include="R5 Reloaded.ico">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>
</Project>

16
r5launcher/resource.h Normal file
View File

@ -0,0 +1,16 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by r5launcher.rc
//
#define IDI_ICON1 101
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif