diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index ce98e87d..bbc463b1 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -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 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!"); } @@ -4212,4 +4258,8 @@ void AiL::ComputeModeColors(TilesetData&tileset){ void AiL::SetBossIndicatorPos(const vf2d pos){ bossIndicatorPos=pos; +} + +void AiL::UsingSteamAPI(const bool usingSteam){ + steamAPIEnabled=usingSteam; } \ No newline at end of file diff --git a/Adventures in Lestoria/AdventuresInLestoria.h b/Adventures in Lestoria/AdventuresInLestoria.h index cf30506e..60976fcf 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.h +++ b/Adventures in Lestoria/AdventuresInLestoria.h @@ -201,6 +201,8 @@ private: SteamKeyboardCallbackHandler*steamKeyboardCallbackListener=nullptr; SteamStatsReceivedHandler*steamStatsReceivedHandlerListener=nullptr; std::optionalbossIndicatorPos{}; + 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::rectNO_COLLISION={{0.f,0.f,},{0.f,0.f}}; TileTransformedView view; diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index a7d23e31..2e266f7e 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -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 diff --git a/distribute.sh b/distribute.sh index cc23bafd..155454f4 100755 --- a/distribute.sh +++ b/distribute.sh @@ -23,4 +23,10 @@ cp -R bin release rm release/*.pdb touch release/runGame.sh -echo "bin/AdventuresInLestoria" > release/runGame.sh \ No newline at end of file +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 \ No newline at end of file diff --git a/runGame - NO STEAM.bat b/runGame - NO STEAM.bat new file mode 100644 index 00000000..49853c8a --- /dev/null +++ b/runGame - NO STEAM.bat @@ -0,0 +1,3 @@ +cd "Adventures in Lestoria" +"..\x64\Release\Adventures in Lestoria.exe" nosteam +set /p DUMMY=Hit ENTER to exit... \ No newline at end of file diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index c34f5c76..c8f04a24 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ