From 045c5177249210ef0b5ba04afb1f79a7ebc50f05 Mon Sep 17 00:00:00 2001 From: Nour-Elhamshary Date: Thu, 19 Sep 2024 09:48:49 +0300 Subject: [PATCH 1/6] Modified Doxyfile to be more platform-agnostic in input and output directories --- winter/doc/Doxyfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/winter/doc/Doxyfile b/winter/doc/Doxyfile index b9ddfc4..dafa658 100644 --- a/winter/doc/Doxyfile +++ b/winter/doc/Doxyfile @@ -74,7 +74,7 @@ PROJECT_ICON = # entered, it will be relative to the location where Doxygen was started. If # left blank the current directory will be used. -OUTPUT_DIRECTORY = /home/rr/adastral/osprey/winter/doc +OUTPUT_DIRECTORY = # If the CREATE_SUBDIRS tag is set to YES then Doxygen will create up to 4096 # sub-directories (in 2 levels) under the output directory of each output format @@ -965,7 +965,7 @@ WARN_LOGFILE = # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = /home/rr/adastral/osprey/winter/Code +INPUT = ../Code # This tag can be used to specify the character encoding of the source files # that Doxygen parses. Internally Doxygen uses the UTF-8 encoding. Doxygen uses @@ -1087,7 +1087,7 @@ EXCLUDE_SYMLINKS = NO # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories for example use the pattern */test/* -EXCLUDE_PATTERNS = +EXCLUDE_PATTERNS = ../Code/shared/sha256* ../Code/sys/zip* # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the From 413ed16ca113071bb80124f8974bf5133f90ea6d Mon Sep 17 00:00:00 2001 From: Nour-Elhamshary Date: Thu, 19 Sep 2024 11:23:24 +0300 Subject: [PATCH 2/6] Added documentation on public classes and methods of Kachemak --- winter/Code/emley/kachemak/kachemak.hpp | 81 +++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/winter/Code/emley/kachemak/kachemak.hpp b/winter/Code/emley/kachemak/kachemak.hpp index f487ebd..12ae2a3 100644 --- a/winter/Code/emley/kachemak/kachemak.hpp +++ b/winter/Code/emley/kachemak/kachemak.hpp @@ -9,6 +9,7 @@ #include #include +//! Structure for data files that deals with Kachemak. struct KachemakVersion { std::string file_name; @@ -26,28 +27,108 @@ struct KachemakPatch std::size_t temp_required; }; +//! Enum class that specifies the category of the directory to check if it has free space. enum class FreeSpaceCheckCategory { Temporary, Permanent }; +//! The Kachemak class. class Kachemak : public Version { public: + //! Constructor of the class. + /*! + \param sourcemod_path The path of the sourcemod directory, found within Steam directory. + \param folder_name The name of the folder for the game. + \param source_url The link to the game's downloadable path online. + \param butler_path The path of butler. + */ Kachemak(const std::filesystem::path& sourcemod_path, const std::filesystem::path& folder_name, const std::string& source_url, const std::filesystem::path& butler_path); + + //! Function to install sourcemod games. + /*! + \return Status code for the installation. + */ virtual int install(); + //! Function to install sourcemod games through a specific path. + /*! + * \param custom_path Path where the game would be installed. + \return Status code post-installation. + */ virtual int install_path(std::filesystem::path custom_path); + + //! Function to check on free spaces at specific directories, depending on its category. + /*! + \param size Specified Size to check on. + \param category The category of the directory. + */ int free_space_check(const uintmax_t size, const FreeSpaceCheckCategory& category); + //! Function to check on free spaces at specific directories, depending on its path. + /*! + * \param size Specified Size to check on. + * \param category The path of the directory. + * + * Status code post-checking are as such: + * 0: success + * 1: not enough temp storage + * 2: not enough permanent storage + * \return Status code post-checking. + */ int free_space_check_path(const uintmax_t size, const std::filesystem::path custom_path); + //! Function to update games installed by Adastral + /*! + * Status code post-update are as such: + * 0: success + * 1: symlink fail + * 2: space check fail + * 3: already on latest / verification needed first + * + * \return Status code post-update. + */ int update(); + + //! Function to verify games installed by Adastral + /*! + * Status code post-verification are as such: + * 0: success + * 4: not installed + * \return Status code post-verification. + */ int verify(); + //! Function to extract games stored as .zip files. + /*! + * \param input_file Name of the input file. + * \param output_directory Name of the output directory. + * \param size Size of the file. + * Status code post-extract are as such: + * -1: failure + * 0: success + * 1: not enough free space + * \return Status code post-extract. + */ int extract(const std::string& input_file, const std::string& output_directory, const size_t& size); + //! Function to extract games stored as .zip files to a custom path. + /*! + * \param input_file Name of the input file. + * \param output_directory Path of the output directory. + * \param size Size of the file. + * Status code post-extract are as such: + * -1: failure + * 0: success + * 1: not enough free space + * \return Status code post-extract. + */ int extract_path(const std::string& input_file, const std::string& output_directory, const size_t& size); + //! Function to get the tag of an installed game. std::string get_installed_version_tag(); + //! Function to get the latest version code of an installed game. std::string get_latest_version_code(); + //! Function to get the latest version tag of an installed game. std::string get_latest_version_tag(); + //! Boolean that checks whether verification is forced or not. bool force_verify = false; private: From 0930ad2f7dfeee46a6062b96958423d32ddd22b7 Mon Sep 17 00:00:00 2001 From: Nour-Elhamshary Date: Sun, 29 Sep 2024 10:25:11 +0300 Subject: [PATCH 3/6] Palace documentation added. --- winter/Code/palace/palace.hpp | 58 +++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/winter/Code/palace/palace.hpp b/winter/Code/palace/palace.hpp index 6909c05..d586d86 100644 --- a/winter/Code/palace/palace.hpp +++ b/winter/Code/palace/palace.hpp @@ -7,6 +7,7 @@ #include #include +//! Structure dealing with metadata of the game. struct GameMetadata { std::string name; @@ -16,21 +17,78 @@ struct GameMetadata class palace { public: + /*! + Constructor of the class. + \param path Steam path. + */ palace(std::string path = ""); + //! Deconstructor of the class. ~palace(); + + //! Function to fetch server data. void fetch_server_data(); + + //! Function to download assets from server to internal Adastral folder. void download_assets(); + + //! Function to initialize games for Adastral to detect. int init_games(); + + /*! + Function to update a specific game. + \param game_name Name of Adastral-supported game. + */ int update_game(const std::string &game_name); + + /*! + Function to update a specific game in a custom path. + \param game_name Name of Adastral-supported game. + \param custom_path Custom path of the Adastral-supported game. + */ int update_game_with_path(const std::string &game_name, std::string custom_path); + /*! + Function to verify game's integrity. + \param game_name Name of Adastral-supported game. + */ int verify_game(const std::string &game_name); + /*! + Function to launch the game itself. + \param game_name Name of Adastral-supported game. + \param arguments Launch arguments of the game. + */ int launch_game(const std::string &game_name, const std::string &arguments); + /*! + Function to check if the app is installed + \param app_id Steam app id. + \return If the app is installed or not. + */ bool is_app_installed(const std::string &app_id); + + /*! + Function to get the application path. + \param app_id Steam app id. + \return The path of the application. + */ std::filesystem::path get_app_path(const std::string &app_id); + /*! + Function to get the sourcemod folder path from Steam folder. + \return Path of the sourcemod folder.*/ std::filesystem::path find_sourcemod_path(); + /* + */ std::filesystem::path get_asset(std::string hash); + /*! + Function to get the list of Adastral-supported games. + \return vector variable containing the list. + */ std::vector get_games(); + /*! + Function to get the list of Adastral-supported games that are installed. + \return vector variable containing the installed games list. + */ std::vector get_installed_games(); + + std::filesystem::path sourcemods_path; std::filesystem::path steam_path; std::unordered_map server_games; From c3b109fb39a78d27ff92759d71b40c5fe006ab4c Mon Sep 17 00:00:00 2001 From: Nour-Elhamshary Date: Thu, 17 Oct 2024 16:02:24 +0300 Subject: [PATCH 4/6] Added documentation for net --- winter/Code/net/net.hpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/winter/Code/net/net.hpp b/winter/Code/net/net.hpp index 197493f..3d0d220 100644 --- a/winter/Code/net/net.hpp +++ b/winter/Code/net/net.hpp @@ -14,9 +14,26 @@ class net { public: + /*! + Function to download items to a temporary folder. + \param url URL link to download from. + \param name Name of the temp folder. + \param progress State of the progress + \param event Kind of event enabled for downloading, defaults to nullptr. + \param path Path of the temporary folder, defaults to nullptr. + */ static std::string download_to_temp(std::string url, std::string name, bool progress = false, EventSystem* event = nullptr, std::filesystem::path* path = nullptr); + + /*! + Function to get string data from server. + \param url URL link to download from. + */ std::string get_string_data_from_server(const std::string& url); + /*! + Function to get string data from server. + \param url URL link to download from. +*/ std::vector get_bin_data_from_server(const std::string& url); // Get path object for the systems sourcemods folder (win/linux) private: From e9928703fcf06637903916afee7faea0e5aba571 Mon Sep 17 00:00:00 2001 From: Nour-Elhamshary Date: Sat, 9 Nov 2024 14:48:23 +0200 Subject: [PATCH 5/6] Added documentation for sys. --- winter/Code/sys/sys.hpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/winter/Code/sys/sys.hpp b/winter/Code/sys/sys.hpp index 2513908..1a8d153 100644 --- a/winter/Code/sys/sys.hpp +++ b/winter/Code/sys/sys.hpp @@ -14,9 +14,34 @@ class sys { public: + /*! + Function to execute a system function through a parameter. + \param params Set of parameters. + */ static int exec_with_param(const std::vector& params); + /*! + Function to recursively delete contents of directory. + \param dir path of the directory + \return 0 if success, 1 if input path doesn't exist, 2 if input path isn't a directory. + */ static int delete_directory_content(const std::filesystem::path& dir); + /*! + Function to extract zip files. + \param input_file Input of the zip archive file. + \param output_file Direction of the output zip archive file. + */ static int extract_zip(const std::string& input_file, const std::string& output_file); + + /*! + Function to get path of Steam. + \return Steam path. + */ static std::filesystem::path get_steam_path(); + + /*! + Function to parse vdf files. + \param file_path File path of the vdf file. + \return Result of parsed VDF file. + */ static tyti::vdf::object parse_vdf_file(std::filesystem::path file_path); }; From 28ffae249a419ef223fa235bbb9a44584182552c Mon Sep 17 00:00:00 2001 From: Nour-Elhamshary Date: Sat, 9 Nov 2024 15:30:09 +0200 Subject: [PATCH 6/6] Added documentation for torrent. --- winter/Code/torrent/torrent.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/winter/Code/torrent/torrent.hpp b/winter/Code/torrent/torrent.hpp index 89fe9cd..392a3f8 100644 --- a/winter/Code/torrent/torrent.hpp +++ b/winter/Code/torrent/torrent.hpp @@ -18,5 +18,11 @@ class torrent { public: + /*! + Function to download from a turrent file using libtorrent. + \param torrent_url URL of the torrent. + \param path Path to save the contents to. + \param event Events from the EventSystem. + */ static int libtorrent_download(const std::string &torrent_url, const std::string &path, EventSystem *event = nullptr); };