Fix redistribution scripts and Linux scripts. Linux scripts now detect if Steam is installed and if the game properly initializes with steam. If it does not, it will restart itself to run in nosteam mode. Added the ability to read command line arguments into the game. Release Build 9441.
This commit is contained in:
parent
44c0a8b1c0
commit
110857949d
@ -156,7 +156,6 @@ float AiL::SIZE_CHANGE_SPEED=1;
|
||||
|
||||
AiL::AiL()
|
||||
{
|
||||
debugLogger.open("debug.log");
|
||||
utils::datafile::Read(DATA,"assets/config/configuration.txt");
|
||||
std::filesystem::create_directories("save_file_path"_S);
|
||||
|
||||
@ -2901,8 +2900,20 @@ bool Steam_Init(){
|
||||
return false;
|
||||
}
|
||||
|
||||
int main()
|
||||
int main(char**args,const int argn)
|
||||
{
|
||||
debugLogger.open("debug.log");
|
||||
LOG(std::format("Found {} args",argn));
|
||||
bool usingSteam=true;
|
||||
|
||||
for(int i=0;i<argn;i++){
|
||||
if(std::string(args[i])=="nosteam"){
|
||||
LOG("nosteam flag detected. Disabling steam API...");
|
||||
usingSteam=false;
|
||||
}
|
||||
LOG(std::format("{}: {}",i,args[i]));
|
||||
}
|
||||
|
||||
if(!std::filesystem::exists("assets/config/configuration.txt")){
|
||||
ERR("WARNING! Could not find initial config file! Aborting.");
|
||||
return false;
|
||||
@ -2910,7 +2921,8 @@ int main()
|
||||
{
|
||||
utils::datafile configFile;
|
||||
utils::datafile::Read(configFile,"assets/config/configuration.txt");
|
||||
if(configFile["steam_api"].GetBool()){
|
||||
usingSteam&=configFile["steam_api"].GetBool();
|
||||
if(usingSteam){
|
||||
#ifndef __EMSCRIPTEN__
|
||||
if(SteamAPI_RestartAppIfNecessary(2895980U))return false; //Immediately quit if steam is detected and can be started through it.
|
||||
if(Steam_Init()){
|
||||
@ -2924,6 +2936,8 @@ int main()
|
||||
{
|
||||
AiL demo;
|
||||
|
||||
demo.UsingSteamAPI(usingSteam);
|
||||
|
||||
#pragma region Load Window Settings
|
||||
utils::datafile loadSystemFile;
|
||||
|
||||
@ -2997,10 +3011,42 @@ int main()
|
||||
return 0;
|
||||
}
|
||||
|
||||
void get_command_line_args( int * argc, char *** argv )
|
||||
{
|
||||
// Get the command line arguments as wchar_t strings
|
||||
wchar_t ** wargv = CommandLineToArgvW( GetCommandLineW(), argc );
|
||||
if (!wargv) { *argc = 0; *argv = NULL; return; }
|
||||
|
||||
// Count the number of bytes necessary to store the UTF-8 versions of those strings
|
||||
int n = 0;
|
||||
for (int i = 0; i < *argc; i++)
|
||||
n += WideCharToMultiByte( CP_UTF8, 0, wargv[i], -1, NULL, 0, NULL, NULL ) + 1;
|
||||
|
||||
// Allocate the argv[] array + all the UTF-8 strings
|
||||
*argv = (char**)(malloc( (*argc + 1) * sizeof(char *) + n ));
|
||||
if (!*argv) { *argc = 0; return; }
|
||||
|
||||
// Convert all wargv[] --> argv[]
|
||||
char * arg = (char *)&((*argv)[*argc + 1]);
|
||||
for (int i = 0; i < *argc; i++)
|
||||
{
|
||||
(*argv)[i] = arg;
|
||||
arg += WideCharToMultiByte( CP_UTF8, 0, wargv[i], -1, arg, n, NULL, NULL ) + 1;
|
||||
}
|
||||
(*argv)[*argc] = NULL;
|
||||
}
|
||||
|
||||
#ifndef _DEBUG
|
||||
#ifdef _WIN32
|
||||
int CALLBACK WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow){
|
||||
main();
|
||||
int argc;
|
||||
char ** argv;
|
||||
get_command_line_args( &argc, &argv );
|
||||
|
||||
for(int n = 0;n < argc;n++)
|
||||
printf( " %d : %s\n", n, argv[n] );
|
||||
main(argv,argc);
|
||||
free( argv );
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@ -3888,7 +3934,7 @@ void AiL::UpdateDiscordStatus(std::string levelName,std::string className){
|
||||
}
|
||||
SteamFriends()->SetRichPresence("steam_display","#Status");
|
||||
}else{
|
||||
if("steam_api"_B&&Steam_Init()){
|
||||
if(steamAPIEnabled&&Steam_Init()){
|
||||
retry=true;
|
||||
LOG("Steam API Initialized successfully!");
|
||||
}
|
||||
@ -4213,3 +4259,7 @@ void AiL::ComputeModeColors(TilesetData&tileset){
|
||||
void AiL::SetBossIndicatorPos(const vf2d pos){
|
||||
bossIndicatorPos=pos;
|
||||
}
|
||||
|
||||
void AiL::UsingSteamAPI(const bool usingSteam){
|
||||
steamAPIEnabled=usingSteam;
|
||||
}
|
@ -201,6 +201,8 @@ private:
|
||||
SteamKeyboardCallbackHandler*steamKeyboardCallbackListener=nullptr;
|
||||
SteamStatsReceivedHandler*steamStatsReceivedHandlerListener=nullptr;
|
||||
std::optional<vf2d>bossIndicatorPos{};
|
||||
bool steamAPIEnabled{true};
|
||||
|
||||
public:
|
||||
AiL();
|
||||
bool OnUserCreate() override;
|
||||
@ -211,6 +213,7 @@ public:
|
||||
void GetAnyMousePress(int32_t mouseButton)override final;
|
||||
void GetAnyMouseHeld(int32_t mouseButton)override final;
|
||||
void GetAnyMouseRelease(int32_t mouseButton)override final;
|
||||
void UsingSteamAPI(const bool usingSteam);
|
||||
public:
|
||||
geom2d::rect<float>NO_COLLISION={{0.f,0.f,},{0.f,0.f}};
|
||||
TileTransformedView view;
|
||||
|
@ -39,7 +39,7 @@ All rights reserved.
|
||||
#define VERSION_MAJOR 1
|
||||
#define VERSION_MINOR 2
|
||||
#define VERSION_PATCH 3
|
||||
#define VERSION_BUILD 9430
|
||||
#define VERSION_BUILD 9441
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
@ -23,4 +23,10 @@ cp -R bin release
|
||||
rm release/*.pdb
|
||||
|
||||
touch release/runGame.sh
|
||||
echo "bin/AdventuresInLestoria" > release/runGame.sh
|
||||
echo "#!/bin/bash
|
||||
if [ `bin/AdventuresInLestoria | wc -l` == 0 ]; then
|
||||
echo \"Failed to Load through Steam Restarting without Steam API!\"
|
||||
bin/AdventuresInLestoria nosteam
|
||||
else
|
||||
echo \"Success!\"
|
||||
fi" > release/runGame.sh
|
3
runGame - NO STEAM.bat
Normal file
3
runGame - NO STEAM.bat
Normal file
@ -0,0 +1,3 @@
|
||||
cd "Adventures in Lestoria"
|
||||
"..\x64\Release\Adventures in Lestoria.exe" nosteam
|
||||
set /p DUMMY=Hit ENTER to exit...
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user