mirror of
				https://github.com/hedge-dev/UnleashedRecomp.git
				synced 2025-10-30 07:11:05 +00:00 
			
		
		
		
	Hide console on Release configuration. (#244)
This commit is contained in:
		
							parent
							
								
									c78c2010a3
								
							
						
					
					
						commit
						9fea5f9e4c
					
				
					 7 changed files with 31 additions and 1 deletions
				
			
		|  | @ -293,7 +293,12 @@ if (WIN32) | |||
|     set(WIN32_ICON_PATH "${PROJECT_SOURCE_DIR}/../UnleashedRecompResources/images/game_icon.ico") | ||||
| 
 | ||||
|     configure_file("res/win32/res.rc.template" "${CMAKE_BINARY_DIR}/res.rc" @ONLY) | ||||
|     add_executable(UnleashedRecomp ${UNLEASHED_RECOMP_CXX_SOURCES} "${CMAKE_BINARY_DIR}/res.rc") | ||||
|     add_executable(UnleashedRecomp ${UNLEASHED_RECOMP_CXX_SOURCES} "${CMAKE_BINARY_DIR}/res.rc") | ||||
| 
 | ||||
|     # Hide console for release configurations. | ||||
|     if (${CMAKE_BUILD_TYPE} MATCHES "Release") | ||||
|         target_link_options(UnleashedRecomp PRIVATE "/SUBSYSTEM:WINDOWS" "/ENTRY:mainCRTStartup") | ||||
|     endif() | ||||
| else() | ||||
|     add_executable(UnleashedRecomp ${UNLEASHED_RECOMP_CXX_SOURCES}) | ||||
| endif() | ||||
|  |  | |||
|  | @ -172,6 +172,9 @@ int main(int argc, char *argv[]) | |||
| 
 | ||||
|     Config::Load(); | ||||
| 
 | ||||
|     if (Config::ShowConsole) | ||||
|         os::process::ShowConsole(); | ||||
| 
 | ||||
|     HostStartup(); | ||||
| 
 | ||||
|     std::filesystem::path modulePath; | ||||
|  |  | |||
|  | @ -6,6 +6,7 @@ | |||
| #include <kernel/function.h> | ||||
| #include <kernel/heap.h> | ||||
| #include <user/paths.h> | ||||
| #include <os/process.h> | ||||
| #include <xxHashMap.h> | ||||
| 
 | ||||
| enum class ModType | ||||
|  | @ -115,6 +116,9 @@ void ModLoader::Init() | |||
|         ModLoader::s_saveFilePath /= "SYS-DATA"; | ||||
|     } | ||||
| 
 | ||||
|     if (configIni.getString("CPKREDIR", "LogType", std::string()) == "console") | ||||
|         os::process::ShowConsole(); | ||||
| 
 | ||||
|     std::string modsDbIniFilePathU8 = configIni.getString("CPKREDIR", "ModsDbIni", ""); | ||||
|     if (modsDbIniFilePathU8.empty()) | ||||
|         return; | ||||
|  |  | |||
|  | @ -60,3 +60,8 @@ bool os::process::StartProcess(const std::filesystem::path& path, const std::vec | |||
| 
 | ||||
|     return true; | ||||
| } | ||||
| 
 | ||||
| void os::process::ShowConsole() | ||||
| { | ||||
|     // Unnecessary on Linux.
 | ||||
| } | ||||
|  |  | |||
|  | @ -6,4 +6,5 @@ namespace os::process | |||
|     std::filesystem::path GetWorkingDirectory(); | ||||
|     bool SetWorkingDirectory(const std::filesystem::path& path); | ||||
|     bool StartProcess(const std::filesystem::path& path, const std::vector<std::string>& args, std::filesystem::path work = {}); | ||||
|     void ShowConsole(); | ||||
| } | ||||
|  |  | |||
|  | @ -51,3 +51,14 @@ bool os::process::StartProcess(const std::filesystem::path& path, const std::vec | |||
| 
 | ||||
|     return true; | ||||
| } | ||||
| 
 | ||||
| void os::process::ShowConsole() | ||||
| { | ||||
|     if (GetConsoleWindow() == nullptr) | ||||
|     { | ||||
|         AllocConsole(); | ||||
|         freopen("CONIN$", "r", stdin); | ||||
|         freopen("CONOUT$", "w", stderr); | ||||
|         freopen("CONOUT$", "w", stdout); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -8,6 +8,7 @@ CONFIG_DEFINE_LOCALISED("System", bool, Hints, true); | |||
| CONFIG_DEFINE_LOCALISED("System", bool, ControlTutorial, true); | ||||
| CONFIG_DEFINE_LOCALISED("System", bool, AchievementNotifications, true); | ||||
| CONFIG_DEFINE_ENUM_LOCALISED("System", ETimeOfDayTransition, TimeOfDayTransition, ETimeOfDayTransition::Xbox); | ||||
| CONFIG_DEFINE("System", bool, ShowConsole, false); | ||||
| 
 | ||||
| CONFIG_DEFINE_LOCALISED("Input", bool, InvertCameraX, false); | ||||
| CONFIG_DEFINE_LOCALISED("Input", bool, InvertCameraY, false); | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Skyth (Asilkan)
						Skyth (Asilkan)