Updated game structs, variable symbols and references. #11
| @@ -4,6 +4,7 @@ | ||||
| #include "loader/component_loader.hpp" | ||||
| #include "game/game.hpp" | ||||
|  | ||||
| #include "utils/command_line.hpp" | ||||
| #include <utils/flags.hpp> | ||||
| #include <utils/io.hpp> | ||||
| #include <utils/string.hpp> | ||||
| @@ -165,11 +166,26 @@ FARPROC load_binary(const launcher::mode mode) | ||||
| 	} | ||||
|  | ||||
| 	std::string data; | ||||
| 	if (!utils::io::read_file(binary, &data)) | ||||
| 	{ | ||||
| 		// Check the first argument to see if the current directory needs to changed | ||||
| 		// Required when the game is used to open a file (like a demo file) | ||||
| 		const auto& args = utils::command_line::get_args(); | ||||
| 		if (!args.empty()) | ||||
| 		{ | ||||
| 			const auto& binary_dir = args.front(); | ||||
| 			if (binary_dir.filename().string().ends_with("iw6-mod.exe")) | ||||
| 			{ | ||||
| 				std::filesystem::current_path(binary_dir.parent_path()); | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		if (!utils::io::read_file(binary, &data)) | ||||
| 		{ | ||||
| 			throw std::runtime_error( | ||||
| 				"Failed to read game binary! Please select the correct path in the launcher settings."); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| #ifdef INJECT_HOST_AS_LIB | ||||
| 	return loader.load_library(binary); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user