If the game can be run through Steam, the app is restarted through Steam directly. Make sure OnUserDestroy() gets called if the game is killed when OnUserCreate() returns false to free all resources. Release Build 8224.
This commit is contained in:
		
							parent
							
								
									8768b89f38
								
							
						
					
					
						commit
						6cd34639ef
					
				| @ -322,17 +322,19 @@ bool AiL::OnUserCreate(){ | ||||
| 	ValidateGameStatus(); //Checks to make sure everything has been initialized properly.
 | ||||
| 	#ifndef __EMSCRIPTEN__ | ||||
| 		SetupDiscord(); | ||||
| 		if(SteamAPI_RestartAppIfNecessary(2895980U))return false; //Immediately quit if steam is detected and can be started through it.
 | ||||
| 		if(SteamAPI_Init()){ | ||||
| 			std::cout<<"Steam API Initialized successfully!"<<std::endl; | ||||
| 		}else{ | ||||
| 			std::cout<<"Steam API failed to initialize!"<<std::endl; | ||||
| 		} | ||||
| 		if(SteamAPI_IsSteamRunning()){ | ||||
| 		if(SteamUtils()!=nullptr) | ||||
| 			SteamUtils()->SetWarningMessageHook([](int severity,const char*message){ | ||||
| 				std::cout<<std::format("STEAM[{}]: {}",severity,std::string(message))<<std::endl; | ||||
| 			}); | ||||
| 		if(SteamInput()!=nullptr) | ||||
| 			SteamInput()->Init(false); | ||||
| 		} | ||||
| 
 | ||||
| 	#endif | ||||
| 
 | ||||
| 	gameInitialized=true; | ||||
| @ -2783,6 +2785,7 @@ bool AiL::IsReflectiveTile(TilesheetData tileSheet,int tileID){ | ||||
| } | ||||
| 
 | ||||
| bool AiL::OnUserDestroy(){ | ||||
| 	SteamAPI_Shutdown(); | ||||
| 	GFX.Reset(); | ||||
| 	for(auto&[key,value]:MAP_DATA){ | ||||
| 		if(MAP_DATA[key].optimizedTile!=nullptr){ | ||||
|  | ||||
| @ -39,7 +39,7 @@ All rights reserved. | ||||
| #define VERSION_MAJOR 0 | ||||
| #define VERSION_MINOR 5 | ||||
| #define VERSION_PATCH 1 | ||||
| #define VERSION_BUILD 8221 | ||||
| #define VERSION_BUILD 8224 | ||||
| 
 | ||||
| #define stringify(a) stringify_(a) | ||||
| #define stringify_(a) #a | ||||
|  | ||||
| @ -4715,7 +4715,10 @@ namespace olc | ||||
| 
 | ||||
| 		// Create user resources as part of this thread
 | ||||
| 		for (auto& ext : vExtensions) ext->OnBeforeUserCreate(); | ||||
| 		if (!OnUserCreate()) bAtomActive = false; | ||||
| 		if (!OnUserCreate()){ | ||||
| 			bAtomActive = false; | ||||
| 			OnUserDestroy(); | ||||
| 		} | ||||
| 		for (auto& ext : vExtensions) ext->OnAfterUserCreate(); | ||||
| 
 | ||||
| 		while (bAtomActive) | ||||
|  | ||||
										
											Binary file not shown.
										
									
								
							
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user