From 17a510ddc0a12fbdad7098c0d9d91fd66098ead7 Mon Sep 17 00:00:00 2001 From: Zach Toogood Date: Wed, 1 May 2024 10:13:39 +0100 Subject: [PATCH 1/3] Embed version info into binary and print on startup --- CMakeLists.txt | 9 ++++++++- src/main.cpp | 6 +++--- src/xiloader.rc.in | 11 +++++++++++ 3 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 src/xiloader.rc.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 5fe38cd..8d2372b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,11 @@ include(cmake/detours.cmake) include(cmake/argparse.cmake) include(cmake/mbedtls.cmake) +configure_file( + src/xiloader.rc.in + src/xiloader.rc +) + # xiloader add_executable(xiloader src/console.cpp @@ -33,7 +38,9 @@ add_executable(xiloader src/main.cpp src/network.cpp src/network.h - src/polcore.h) + src/polcore.h + ${CMAKE_CURRENT_BINARY_DIR}/src/xiloader.rc +) set_target_properties(xiloader PROPERTIES LINK_FLAGS "/LARGEADDRESSAWARE") diff --git a/src/main.cpp b/src/main.cpp index 38582ca..a480172 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -46,7 +46,7 @@ namespace globals std::string g_Password = ""; // The password being logged in with. char g_SessionHash[16] = {}; // Session hash sent from auth std::string g_Email = ""; // Email, currently unused - std::string g_VersionNumber = "1.0.0"; // xiloader version number sent to auth server. Must be x.x.x with single characters for 'x' + std::string g_VersionNumber = "1.1.1"; // xiloader version number sent to auth server. Must be x.x.x with single characters for 'x'. Remember to also change in xiloader.rc.in char* g_CharacterList = NULL; // Pointer to the character list data being sent from the server. bool g_IsRunning = false; // Flag to determine if the network threads should hault. @@ -182,7 +182,7 @@ hostent* __stdcall Mine_gethostbyname(const char* name) } // This function's purpose is to identify a command byte and identify if it is meant for the lobby dataport or not. -// This way, we know we want to send +// This way, we know we want to send. bool isLobbyCommand(const char* buffer) { auto command = buffer[8]; @@ -431,7 +431,7 @@ int __cdecl main(int argc, char* argv[]) int currentYear = localtime(¤tTime)->tm_year + 1900; // Year is returned as the number of years since 1900. xiloader::console::output(xiloader::color::lightred, "=========================================================="); xiloader::console::output(xiloader::color::lightgreen, "DarkStar Boot Loader (c) 2015 DarkStar Team"); - xiloader::console::output(xiloader::color::lightgreen, "LandSandBoat Boot Loader (c) 2021-%d LandSandBoat Team", currentYear); + xiloader::console::output(xiloader::color::lightgreen, "LandSandBoat Boot Loader (c) 2021-%d LandSandBoat Team (v%s)", currentYear, globals::g_VersionNumber.c_str()); xiloader::console::output(xiloader::color::lightpurple, "Git Repo : https://github.com/LandSandBoat/xiloader"); xiloader::console::output(xiloader::color::lightpurple, "Bug Reports: https://github.com/LandSandBoat/xiloader/issues"); xiloader::console::output(xiloader::color::lightred, "=========================================================="); diff --git a/src/xiloader.rc.in b/src/xiloader.rc.in new file mode 100644 index 0000000..b2d0578 --- /dev/null +++ b/src/xiloader.rc.in @@ -0,0 +1,11 @@ +1 VERSIONINFO +FILEVERSION 1,1,1 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "081604b0" + BEGIN + VALUE "FileVersion", "1.1.1" + END + END +END From 9a68c42f4b35edbf93555defa527c19b45d99006 Mon Sep 17 00:00:00 2001 From: Zach Toogood Date: Wed, 1 May 2024 10:14:00 +0100 Subject: [PATCH 2/3] Allow duplicate arguments on startup --- src/main.cpp | 48 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index a480172..c5e55fe 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -359,28 +359,54 @@ int __cdecl main(int argc, char* argv[]) { argparse::ArgumentParser args("xiloader", "0.0"); - args.add_argument("--server").help("The server address to connect to."); - args.add_argument("--user", "--username").help("The username being logged in with."); - args.add_argument("--pass", "--password").help("The password being logged in with."); - args.add_argument("--email", "--email").help("The email being logged in with."); + // NOTE: .append() is used to allow multiple arguments to be passed to the same option. + // : Otherwise it will throw on repeated arguments (normally accidental). - args.add_argument("--serverport").help("(optional) The server's lobby port to connect to."); + args.add_argument("--server") + .help("The server address to connect to.") + .append(); - args.add_argument("--dataport").help("(optional) The login server data port to connect to."); + args.add_argument("--user", "--username") + .help("The username being logged in with.") + .append(); - args.add_argument("--viewport").help("(optional) The login view port to connect to."); + args.add_argument("--pass", "--password") + .help("The password being logged in with.") + .append(); - args.add_argument("--authport").help("(optional) The login auth port to connect to."); + args.add_argument("--email", "--email") + .help("The email being logged in with.") + .append(); - args.add_argument("--lang").help("(optional) The language of your FFXI install: JP/US/EU (0/1/2)."); + args.add_argument("--serverport") + .help("(optional) The server's lobby port to connect to.") + .append(); + + args.add_argument("--dataport") + .help("(optional) The login server data port to connect to.") + .append(); + + args.add_argument("--viewport") + .help("(optional) The login view port to connect to.") + .append(); + + args.add_argument("--authport") + .help("(optional) The login auth port to connect to.") + .append(); + + args.add_argument("--lang") + .help("(optional) The language of your FFXI install: JP/US/EU (0/1/2).") + .append(); args.add_argument("--hairpin") .implicit_value(true) - .help("(optional) Use this if connecting to a local server which you have exposed publicly. This should not have to be used if you are connecting to a remote server."); + .help("(optional) Use this if connecting to a local server which you have exposed publicly. This should not have to be used if you are connecting to a remote server.") + .append(); args.add_argument("--hide") .implicit_value(true) - .help("(optional) Determines whether or not to hide the console window after FFXI starts."); + .help("(optional) Determines whether or not to hide the console window after FFXI starts.") + .append(); try { From 00566d8c6504d8382428df7ae46c5d71e93cc34d Mon Sep 17 00:00:00 2001 From: Zach Toogood Date: Wed, 1 May 2024 10:15:21 +0100 Subject: [PATCH 3/3] Fix readme styling --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ef8ca9f..9bd3fab 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,10 @@ cmake --build build ## Release notes -# Windows +### Windows Requires VC2022 redist, included in https://aka.ms/vs/17/release/vc_redist.x86.exe -#Linux (through Wine) +### Linux (through Wine) Requires `winetricks vcrun2022`