Merge branch 'develop' into runtime_errors

This commit is contained in:
INeedBots 2020-12-10 03:32:23 -06:00
commit 442980c056
32 changed files with 525 additions and 685 deletions

View File

@ -1,413 +1,448 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog v0.3.0](http://keepachangelog.com/en/0.3.0/) and this project adheres to [Semantic Versioning](http://semver.org/).
## [unreleased] - xxxx-xx-xx
### Added
- Add host information to /info endpoint (request)
### Changed
- Stats are now separate for each mod (#6). Player stats are copied to `fs_game` folder if no stats exist for this mod yet. Keep in mind this also means that level, XP and classes will not be synchronized with the main stats file after this point.
## [0.6.0] - 2018-12-30
### Added
- Implement unbanclient command.
- Implement /serverlist api endpoint on dedicated servers
- Add dvar to control the server query rate (net_serverQueryLimit & net_serverFrames)
### Changed
- Update dependencies
### Fixed
- Fix mods not working in private matches.
- Fix multiple game structures (map tools)
- Fix multiple vulnerability's
- Fix lag spikes on lower end PCs
- Fix invalid name check
- Fix openLink command crash issue
- Fix lobby server map downloading
- Fix steam integration
### Known issues
- HTTPS is not supported for fast downloads at the moment.
## [0.5.4] - 2017-07-09
### Added
- Integrate IW4MVM by luckyy.
### Changed
- Displayed stats for Dragunov have been changed, has no effect on actual game play.
### Fixed
- Fix fast download failing when the target host is missing a trailing slash.
- Fix servers not being listed in the server browser.
- Fix some FPS drop issues caused by compression code.
### Known issues
- HTTPS is not supported for fast downloads at the moment.
## [0.5.3] - 2017-07-02
### Added
- Increase webserver security.
### Fixed
- Reduce lags introduced by nodes.
- Fix modlist download.
## [0.5.2] - 2017-07-02
### Fixed
- Fix dedicated server crash.
## [0.5.1] - 2017-07-02
### Added
- Add fast download option for custom mods/maps based on Call of Duty 4.
- Display a toast when an update is available.
- Use the hourglass cursor while loading assets (with the native cursor feature).
- Show bots in parenthesis after the number of players in the serverlist (request).
- Add GSC event `level waittill("say", string, player);` (request).
- Restrict unauthorized mod download for password protected servers.
- Add OMA support for 15 classes.
### Changed
- Show friend avatars when they play IW4x (request).
- Rewrite and optimize the entire node system.
- Remove syncnode command for node system.
- Remove steam start.
### Fixed
- Fix lags and frame drops caused by server sorting.
- Fix demos on custom maps.
- Can no longer join a lobby or server with an incorrect password.
- Fix crashes caused by a bug in file/data compression.
- Improve overall stability.
## [0.5.0] - 2017-06-04
### Added
- Add GSC functionality to download files via HTTP(S) (request).
- Implement preliminary custom map support.
### Changed
- Add new nicknames for bots.
- Bumped Fastfile version. If you built fastfiles with the zone builder (e.g. mod.ff) you have to rebuild them!
- Default `sv_network_fps` to `1000` on dedicated game servers.
- Increase maximum FOV to 120.
### Fixed
- Fix `iw4x_onelog` dvar.
- Fix server list only showing local servers by default instead of Internet servers.
- Fix some deadlock situations on game shutdown.
## [0.4.2] - 2017-03-16
### Changed
- Disable unnecessary dvar update in server browser.
- Update bot names.
### Fixed
- Fix process permissions.
- Fix classic AK-47 color bleedthrough.
- Re-aligned the MG4's Raffica iron sights.
## [0.4.1] - 2017-03-10
### Fixed
- Fix command line argument parsing.
## [0.4.0] - 2017-03-10
### Added
- Set played with status.
- Add support for 15 classes.
- Add `iw4x_onelog` dvar.
- Add show server/playercount in server browser.
### Changed
- Do not show friend status notifications with stream friendly UI.
- Reduce loaded modules for dedis.
- Use joystick emblem for friend status.
- Disable XP bar when max level.
- Change fs_game display postition.
- Replace Painkiller with Juiced from IW5.
### Fixed
- Fix AK weaponfiles.
- Fix brightness slider.
- Fix text length for column mod in server browser.
- Changed the L86 LSW to use the correct HUD icon.
- Re-aligned the M93 Raffica's iron sights.
- Re-aligned the Desert Eagle's iron sights.
## [0.3.3] - 2017-02-14
### Added
- Add mapname to friend status (request).
- Add option to toggle notify friend state.
- Add support for mod.ff.
### Changed
- Disabled big minidump message box.
- Limit dedicated servers to 15 instances per IP.
- Move build number location.
- Remove news ticker and friends button from theater.
### Fixed
- Fix audio bug in options menu.
- Fix crash caused by faulty file download requests to game hosts.
- Fix friend sorting.
- Fix game not starting issue under certain circumstances.
- Fix menu crash.
- Fix typo in security increase popmenu.
- Fix vid_restart crash with connect protocol.
- Fix weapon crash issue.
- Potentially fix no-ammo bug.
## [0.3.2] - 2017-02-12
This is the third public Beta version.
### Added
- Add working friend system.
- Add colored pings in the server list.
- Add credits.
- Add first launch menu.
- Add AK-47 (Classic) attachments.
- Add HUD icon for night vision goggles.
### Changed
- Join when pressing enter in server list (request).
- Redesign and refactor all fullscreen menus.
- Increase weapon and configstring limit.
- Allow creating full crash dumps if wanted.
- Set default name from steam.
### Fixed
- Fix missing models on village.
- Fix custom server motd (request).
- Fix various memory leaks.
- Fix mouse pitch (request).
- Fix compatibility with B3 (request).
- Fix RCon bug (request).
- Fix dedicated server crash on linux.
- Fix crash in mod download.
- Fix peacekeeper reload sound.
- Fix cl_maxpackets 125 in settings (request).
- Fix deserteaglegold_mp icon.
### Known issues
- IW4x on Linux currently requires gnutls to be installed to access the Tor service via HTTPS.
## [0.3.1] - 2017-01-21
This is the second public Beta version.
### Added
- Add classic AK-47 to CAC.
- Add servers to favorites when ingame.
- Add delete favorites button in the serverlist.
### Changed
- Change maplist to a dynamic list.
### Fixed
- Fix list focus.
- Fix mod restart loop.
- Fix mod download status.
- Fix modelsurf crash.
- Fix floating AK-74u.
### Known issues
- IW4x on Linux currently requires gnutls to be installed to access the Tor service via HTTPS.
## [0.3.0] - 2017-01-14
This is the first public Beta version.
### Added
- Add com_logFilter dvar.
- Add peacekeeper.
- Add support for maps from DLC 8 (Recycled Pack)
- Chemical Plant (mp_storm_spring)
- Crash: Tropical (mp_crash_tropical)
- Estate: Tropical (mp_estate_tropical)
- Favela: Tropical (mp_fav_tropical)
- Forgotten City (mp_bloc_sh)
### Changed
- Improve node synchronization handling.
- Improve security by modifying GUIDs to allow 64-bit certificate fingerprints.
- Optimize fastfiles, they are now a lot smaller.
- Replace intro.
### Fixed
- Fix concurrent image loading bug.
- Fix issues when spawning more than one bot.
- Fix no ammo bug.
- Fix server crash on startup.
- Fix splash screen hang.
### Known issues
- IW4x on Linux currently requires gnutls to be installed to access the Tor service via HTTPS.
## [0.2.1] - 2016-12-14
This is the second public Alpha version.
### Added
- Add support for CoD:Online maps.
- Firing Range (mp_firingrange)
- Rust (mp_rust_long)
- Shipment (mp_shipment/mp_shipment_long)
- Add `sv_motd` Dvar for server owners to set custom motd (will be visible in the loadscreen).
- Add Zonebuilder support for sounds and fx.
- Add command setviewpos.
- Add high-definition loadscreens.
### Changed
- Rename Arctic Wet Work map to it's official name (Freighter).
- Complete redesign of the main menus.
- Allow `cl_maxpackets` to be set up to 125.
### Fixed
- Fix crash when using the Harrier killstreak.
- Disable code that downloads news/changelog when in zonebuilder mode.
- Fix freeze on game shutdown.
- Disable unlockstats while ingame to prevent a crash.
### Known issues
- IW4x on Linux currently requires gnutls to be installed to access the Tor service via HTTPS.
## [0.2.0] - 2016-10-09
This is the first public Alpha version.
### Added
- Support for CoD:Online maps.
- Arctic Wet Work (mp_cargoship_sh)
- Bloc (mp_bloc)
- Bog (mp_bog_sh)
- Crossfire (mp_cross_fire)
- Killhouse (mp_killhouse)
- Nuketown (mp_nuked)
- Wet Work (mp_cargoship)
### Fixed
- Fix techniques in Zonebuilder.
- Fix possible memory leak.
- Fix timeout bug when connecting to server via iw4x link.
- Partially fix deadlock in decentralized networking code.
### Known issues
- Running IW4x on Linux currently requires gnutls to be installed additional to Wine as it needs to access the Tor service via HTTPS.
## [0.1.1] - 2016-09-19
This version is an internal Pre-Alpha version.
### Added
- Add IW5 material embedding system.
### Changed
- Enhance mod download with detailed progress display.
### Fixed
- Fix and optimize network logging commands.
- Fix console not displaying command inputs properly.
- Fix crash when running multiple instances of the IW4x client from the same directory.
- Fix crash when the `securityLevel` command is used on a game server.
- Fix possible data corruption in code for decentralized networking.
- Fix possible deadlock during client shutdown.
## [0.1.0] - 2016-09-03
This version is an internal Pre-Alpha version.
### Added
- Add `banclient` command which will permanently ban a client from a server. The ban will persist across restarts.
- Add capabilities to save played games and replay them ("Theater").
- Add code for generating and sending minidumps for debugging purposes. This feature is meant to be used only during the Open Beta and will be removed once the code goes to stable release.
- Add commands that allow forwarding console and games log via UDP to other computers ("network logging").
- Add D3D9Ex.
- Add filters for server list.
- Add handling for `iw4x://` URLs ("connect protocol"). For example, if IW4x is properly registered in Windows as URL handler for `iw4x://` URLs you can type `iw4x://ip:port`. If possible, this will connect to the server in an already running IW4x client.
- Add lean support through new key bindings.
- Add native cursor as replacement for the sometimes laggy in-game cursor. This change can be reverted in the settings menu.
- Add news ticker.
- Add remote console ("RCon").
- Add support for BigBrotherBot.
- Add support for hosting game mods in order to allow players to just join modded servers out of the box ("mod download").
- Add Warfare2 text coloring.
- Add zone builder. For more information see the respective documentation.
- Implement a completely decentralized peering network.
- Implement playlists which can be used for flexible map and gametype rotation.
- Introduce security levels. This ensures that you need to "pay" with CPU power to verify your identity once before being able to join a server which reduces the interval at which people who get banned can circumvent server bans through using new identities. The default security level is 23.
- Move IW4x resource files into their own folder to prevent clogging up the main game directories.
- Reintroduce parties, now also available for dedicated servers ("lobby servers").
### Changed
- Move logs to `userraw` folder.
- Replace main menu background music.
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog v0.3.0](http://keepachangelog.com/en/0.3.0/) and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.6.1 Community] - 2020-12-05
### Added
- Add host information to /info endpoint (request)
- Add fileWrite GSC Function (#36)
- Add fileRead GSC Function (#36)
- Add fileExists GSC Function (#36)
- Add fileRemove GSC Function (#36)
- Add botMovement GSC Function (#46)
- Add botAction GSC Function (#46)
- Add botWeapon GSC Function (#46)
- Add botStop GSC Function (#46)
- Add isBot GSC Function (#46)
- Add setPing GSC Function (#46)
- Add GetSystemTime and GetSystemTimeMilliseconds GSC Functions (#46)
- Add PrintConsole GSC Function (#46)
- Add Exec GSC Function (#46)
- Add getIP GSC Method (#36)
- Add getPing GSC Method (#36)
- Add scr_intermissionTime GSC Function (#25)
- Add g_playerCollision Dvar (#36)
- Add g_playerEjection Dvar (#36)
- Add r_specularCustomMaps Dvar (#36)
- Unlock safeArea_horizontal and safeArea_vertical Dvars (#42)
- Unlock cg_fovscale Dvar (#47)
### Changed
- Stats are now separate for each mod (#6). Player stats are copied to `fs_game` folder if no stats exist for this mod yet. Keep in mind this also means that level, XP and classes will not be synchronized with the main stats file after this point.
- Reduced duration of toasts (#48)
- Removed old updater functionality
- Use old bot names if bots.txt is not found (#46)
- Removed Steam integration because Steam updates kept breaking it (#51)
### Fixed
- Fixed a node system related crash (#45)
- Fixed an issue that made dedicated servers crash when info was requested during map rotation (#43)
- Fixed an issue where the game was trying to decrypt gsc files which caused it to crash when loading mods (#35)
#######################End of official IW4x Development - Project goes Open Source#######################
## [0.6.0] - 2018-12-30
### Added
- Implement unbanclient command.
- Implement /serverlist api endpoint on dedicated servers
- Add dvar to control the server query rate (net_serverQueryLimit & net_serverFrames)
### Changed
- Update dependencies
### Fixed
- Fix mods not working in private matches.
- Fix multiple game structures (map tools)
- Fix multiple vulnerability's
- Fix lag spikes on lower end PCs
- Fix invalid name check
- Fix openLink command crash issue
- Fix lobby server map downloading
- Fix steam integration
### Known issues
- HTTPS is not supported for fast downloads at the moment.
## [0.5.4] - 2017-07-09
### Added
- Integrate IW4MVM by luckyy.
### Changed
- Displayed stats for Dragunov have been changed, has no effect on actual game play.
### Fixed
- Fix fast download failing when the target host is missing a trailing slash.
- Fix servers not being listed in the server browser.
- Fix some FPS drop issues caused by compression code.
### Known issues
- HTTPS is not supported for fast downloads at the moment.
## [0.5.3] - 2017-07-02
### Added
- Increase webserver security.
### Fixed
- Reduce lags introduced by nodes.
- Fix modlist download.
## [0.5.2] - 2017-07-02
### Fixed
- Fix dedicated server crash.
## [0.5.1] - 2017-07-02
### Added
- Add fast download option for custom mods/maps based on Call of Duty 4.
- Display a toast when an update is available.
- Use the hourglass cursor while loading assets (with the native cursor feature).
- Show bots in parenthesis after the number of players in the serverlist (request).
- Add GSC event `level waittill("say", string, player);` (request).
- Restrict unauthorized mod download for password protected servers.
- Add OMA support for 15 classes.
### Changed
- Show friend avatars when they play IW4x (request).
- Rewrite and optimize the entire node system.
- Remove syncnode command for node system.
- Remove steam start.
### Fixed
- Fix lags and frame drops caused by server sorting.
- Fix demos on custom maps.
- Can no longer join a lobby or server with an incorrect password.
- Fix crashes caused by a bug in file/data compression.
- Improve overall stability.
## [0.5.0] - 2017-06-04
### Added
- Add GSC functionality to download files via HTTP(S) (request).
- Implement preliminary custom map support.
### Changed
- Add new nicknames for bots.
- Bumped Fastfile version. If you built fastfiles with the zone builder (e.g. mod.ff) you have to rebuild them!
- Default `sv_network_fps` to `1000` on dedicated game servers.
- Increase maximum FOV to 120.
### Fixed
- Fix `iw4x_onelog` dvar.
- Fix server list only showing local servers by default instead of Internet servers.
- Fix some deadlock situations on game shutdown.
## [0.4.2] - 2017-03-16
### Changed
- Disable unnecessary dvar update in server browser.
- Update bot names.
### Fixed
- Fix process permissions.
- Fix classic AK-47 color bleedthrough.
- Re-aligned the MG4's Raffica iron sights.
## [0.4.1] - 2017-03-10
### Fixed
- Fix command line argument parsing.
## [0.4.0] - 2017-03-10
### Added
- Set played with status.
- Add support for 15 classes.
- Add `iw4x_onelog` dvar.
- Add show server/playercount in server browser.
### Changed
- Do not show friend status notifications with stream friendly UI.
- Reduce loaded modules for dedis.
- Use joystick emblem for friend status.
- Disable XP bar when max level.
- Change fs_game display postition.
- Replace Painkiller with Juiced from IW5.
### Fixed
- Fix AK weaponfiles.
- Fix brightness slider.
- Fix text length for column mod in server browser.
- Changed the L86 LSW to use the correct HUD icon.
- Re-aligned the M93 Raffica's iron sights.
- Re-aligned the Desert Eagle's iron sights.
## [0.3.3] - 2017-02-14
### Added
- Add mapname to friend status (request).
- Add option to toggle notify friend state.
- Add support for mod.ff.
### Changed
- Disabled big minidump message box.
- Limit dedicated servers to 15 instances per IP.
- Move build number location.
- Remove news ticker and friends button from theater.
### Fixed
- Fix audio bug in options menu.
- Fix crash caused by faulty file download requests to game hosts.
- Fix friend sorting.
- Fix game not starting issue under certain circumstances.
- Fix menu crash.
- Fix typo in security increase popmenu.
- Fix vid_restart crash with connect protocol.
- Fix weapon crash issue.
- Potentially fix no-ammo bug.
## [0.3.2] - 2017-02-12
This is the third public Beta version.
### Added
- Add working friend system.
- Add colored pings in the server list.
- Add credits.
- Add first launch menu.
- Add AK-47 (Classic) attachments.
- Add HUD icon for night vision goggles.
### Changed
- Join when pressing enter in server list (request).
- Redesign and refactor all fullscreen menus.
- Increase weapon and configstring limit.
- Allow creating full crash dumps if wanted.
- Set default name from steam.
### Fixed
- Fix missing models on village.
- Fix custom server motd (request).
- Fix various memory leaks.
- Fix mouse pitch (request).
- Fix compatibility with B3 (request).
- Fix RCon bug (request).
- Fix dedicated server crash on linux.
- Fix crash in mod download.
- Fix peacekeeper reload sound.
- Fix cl_maxpackets 125 in settings (request).
- Fix deserteaglegold_mp icon.
### Known issues
- IW4x on Linux currently requires gnutls to be installed to access the Tor service via HTTPS.
## [0.3.1] - 2017-01-21
This is the second public Beta version.
### Added
- Add classic AK-47 to CAC.
- Add servers to favorites when ingame.
- Add delete favorites button in the serverlist.
### Changed
- Change maplist to a dynamic list.
### Fixed
- Fix list focus.
- Fix mod restart loop.
- Fix mod download status.
- Fix modelsurf crash.
- Fix floating AK-74u.
### Known issues
- IW4x on Linux currently requires gnutls to be installed to access the Tor service via HTTPS.
## [0.3.0] - 2017-01-14
This is the first public Beta version.
### Added
- Add com_logFilter dvar.
- Add peacekeeper.
- Add support for maps from DLC 8 (Recycled Pack)
- Chemical Plant (mp_storm_spring)
- Crash: Tropical (mp_crash_tropical)
- Estate: Tropical (mp_estate_tropical)
- Favela: Tropical (mp_fav_tropical)
- Forgotten City (mp_bloc_sh)
### Changed
- Improve node synchronization handling.
- Improve security by modifying GUIDs to allow 64-bit certificate fingerprints.
- Optimize fastfiles, they are now a lot smaller.
- Replace intro.
### Fixed
- Fix concurrent image loading bug.
- Fix issues when spawning more than one bot.
- Fix no ammo bug.
- Fix server crash on startup.
- Fix splash screen hang.
### Known issues
- IW4x on Linux currently requires gnutls to be installed to access the Tor service via HTTPS.
## [0.2.1] - 2016-12-14
This is the second public Alpha version.
### Added
- Add support for CoD:Online maps.
- Firing Range (mp_firingrange)
- Rust (mp_rust_long)
- Shipment (mp_shipment/mp_shipment_long)
- Add `sv_motd` Dvar for server owners to set custom motd (will be visible in the loadscreen).
- Add Zonebuilder support for sounds and fx.
- Add command setviewpos.
- Add high-definition loadscreens.
### Changed
- Rename Arctic Wet Work map to it's official name (Freighter).
- Complete redesign of the main menus.
- Allow `cl_maxpackets` to be set up to 125.
### Fixed
- Fix crash when using the Harrier killstreak.
- Disable code that downloads news/changelog when in zonebuilder mode.
- Fix freeze on game shutdown.
- Disable unlockstats while ingame to prevent a crash.
### Known issues
- IW4x on Linux currently requires gnutls to be installed to access the Tor service via HTTPS.
## [0.2.0] - 2016-10-09
This is the first public Alpha version.
### Added
- Support for CoD:Online maps.
- Arctic Wet Work (mp_cargoship_sh)
- Bloc (mp_bloc)
- Bog (mp_bog_sh)
- Crossfire (mp_cross_fire)
- Killhouse (mp_killhouse)
- Nuketown (mp_nuked)
- Wet Work (mp_cargoship)
### Fixed
- Fix techniques in Zonebuilder.
- Fix possible memory leak.
- Fix timeout bug when connecting to server via iw4x link.
- Partially fix deadlock in decentralized networking code.
### Known issues
- Running IW4x on Linux currently requires gnutls to be installed additional to Wine as it needs to access the Tor service via HTTPS.
## [0.1.1] - 2016-09-19
This version is an internal Pre-Alpha version.
### Added
- Add IW5 material embedding system.
### Changed
- Enhance mod download with detailed progress display.
### Fixed
- Fix and optimize network logging commands.
- Fix console not displaying command inputs properly.
- Fix crash when running multiple instances of the IW4x client from the same directory.
- Fix crash when the `securityLevel` command is used on a game server.
- Fix possible data corruption in code for decentralized networking.
- Fix possible deadlock during client shutdown.
## [0.1.0] - 2016-09-03
This version is an internal Pre-Alpha version.
### Added
- Add `banclient` command which will permanently ban a client from a server. The ban will persist across restarts.
- Add capabilities to save played games and replay them ("Theater").
- Add code for generating and sending minidumps for debugging purposes. This feature is meant to be used only during the Open Beta and will be removed once the code goes to stable release.
- Add commands that allow forwarding console and games log via UDP to other computers ("network logging").
- Add D3D9Ex.
- Add filters for server list.
- Add handling for `iw4x://` URLs ("connect protocol"). For example, if IW4x is properly registered in Windows as URL handler for `iw4x://` URLs you can type `iw4x://ip:port`. If possible, this will connect to the server in an already running IW4x client.
- Add lean support through new key bindings.
- Add native cursor as replacement for the sometimes laggy in-game cursor. This change can be reverted in the settings menu.
- Add news ticker.
- Add remote console ("RCon").
- Add support for BigBrotherBot.
- Add support for hosting game mods in order to allow players to just join modded servers out of the box ("mod download").
- Add Warfare2 text coloring.
- Add zone builder. For more information see the respective documentation.
- Implement a completely decentralized peering network.
- Implement playlists which can be used for flexible map and gametype rotation.
- Introduce security levels. This ensures that you need to "pay" with CPU power to verify your identity once before being able to join a server which reduces the interval at which people who get banned can circumvent server bans through using new identities. The default security level is 23.
- Move IW4x resource files into their own folder to prevent clogging up the main game directories.
- Reintroduce parties, now also available for dedicated servers ("lobby servers").
### Changed
- Move logs to `userraw` folder.
- Replace main menu background music.

View File

@ -12,7 +12,7 @@ namespace Components
std::lock_guard<std::mutex> _(Changelog::Mutex);
Changelog::Lines.clear();
std::string data = Utils::Cache::GetFile("/iw4/changelog.txt");
std::string data = Utils::Cache::GetFile("/develop/CHANGELOG.md");
if (data.empty())
{

View File

@ -13,7 +13,7 @@ namespace Components
~ClanTags();
private:
static std::string ClanTags::Tags[18];
static std::string Tags[18];
static void DrawPlayerNameOnScoreboard();

View File

@ -31,7 +31,7 @@ namespace Components
if (mode != "append"s && mode != "write"s)
{
Game::Com_Printf(0, "^3fileWrite: mode not defined or was wrong, defaulting to 'write'\n");
mode = "write";
mode = const_cast<char*>("write");
}
if (mode == "write"s)

View File

@ -25,7 +25,7 @@ namespace Components
char* Command::ClientParams::get(size_t index)
{
if (index >= this->length()) return "";
if (index >= this->length()) return const_cast<char*>("");
return Game::cmd_argv[this->commandId][index];
}
@ -36,7 +36,7 @@ namespace Components
char* Command::ServerParams::get(size_t index)
{
if (index >= this->length()) return "";
if (index >= this->length()) return const_cast<char*>("");
return Game::cmd_argv_sv[this->commandId][index];
}

View File

@ -537,7 +537,7 @@ namespace Components
Console::Console()
{
// Console '%s: %s> ' string
Utils::Hook::Set<char*>(0x5A44B4, "IW4x: " VERSION "> ");
Utils::Hook::Set<const char*>(0x5A44B4, "IW4x: " VERSION "> ");
// Patch console color
static float consoleColor[] = { 0.70f, 1.00f, 0.00f, 1.00f };

View File

@ -27,7 +27,7 @@ namespace Components
return const_cast<char*>(this->dvar->current.string);
}
return "";
return const_cast<char*>("");
}
template <> const char* Dvar::Var::get()
{

View File

@ -186,7 +186,7 @@ namespace Components
{
std::lock_guard<std::recursive_mutex> _(Friends::Mutex);
const unsigned int modId = *reinterpret_cast<unsigned int*>("IW4x") | 0x80000000;
const unsigned int modId = *reinterpret_cast<unsigned int*>(const_cast<char*>("IW4x")) | 0x80000000;
// Split up the list
for (auto entry : Friends::FriendsList)

View File

@ -766,8 +766,7 @@ namespace Components
{
if (pack.index == dlc)
{
News::LaunchUpdater(Utils::String::VA("-dlc %i -c", pack.index));
//ShellExecuteA(nullptr, "open", pack.url.data(), nullptr, nullptr, SW_SHOWNORMAL);
ShellExecute(0, 0, L"https://xlabs.dev/support_iw4x_client.html", 0, 0, SW_SHOW);
return;
}
}

View File

@ -907,6 +907,7 @@ namespace Components
Menus::Add("ui_mp/pc_store.menu");
Menus::Add("ui_mp/iw4x_credits.menu");
Menus::Add("ui_mp/resetclass.menu");
Menus::Add("ui_mp/popup_customtitle.menu");
}
Menus::~Menus()

View File

@ -15,7 +15,7 @@ namespace Components
static void Add(const std::string& menu);
static Game::MenuList* Menus::LoadCustomMenuList(const std::string& menu, Utils::Memory::Allocator* allocator);
static Game::MenuList* LoadCustomMenuList(const std::string& menu, Utils::Memory::Allocator* allocator);
static std::vector<std::pair<bool, Game::menuDef_t*>> LoadMenu(Game::menuDef_t* menudef);
static std::vector<std::pair<bool, Game::menuDef_t*>> LoadMenu(const std::string& file);

View File

@ -364,7 +364,7 @@ namespace Components
Utils::Hook::Set<BYTE>(0x4050A5, 125);
// Parse port as short in Net_AddrToString
Utils::Hook::Set<char*>(0x4698E3, "%u.%u.%u.%u:%hu");
Utils::Hook::Set<const char*>(0x4698E3, "%u.%u.%u.%u:%hu");
// Install startup handler
Utils::Hook(0x4FD4D4, Network::NetworkStartStub, HOOK_JUMP).install()->quick();

View File

@ -6,9 +6,6 @@ namespace Components
{
bool News::Terminate;
std::thread News::Thread;
std::string News::UpdaterArgs;
std::string News::UpdaterHash;
std::mutex News::UpdaterMutex;
bool News::unitTest()
{
@ -33,165 +30,18 @@ namespace Components
return result;
}
void News::ExitProcessStub(unsigned int exitCode)
{
std::this_thread::sleep_for(10ms);
STARTUPINFOA sInfo;
PROCESS_INFORMATION pInfo;
ZeroMemory(&sInfo, sizeof(sInfo));
ZeroMemory(&pInfo, sizeof(pInfo));
sInfo.cb = sizeof(sInfo);
CreateProcessA("updater.exe", const_cast<char*>(Utils::String::VA("updater.exe %s", News::UpdaterArgs.data())), nullptr, nullptr, false, NULL, nullptr, nullptr, &sInfo, &pInfo);
if (pInfo.hThread && pInfo.hThread != INVALID_HANDLE_VALUE) CloseHandle(pInfo.hThread);
if (pInfo.hProcess && pInfo.hProcess != INVALID_HANDLE_VALUE) CloseHandle(pInfo.hProcess);
TerminateProcess(GetCurrentProcess(), exitCode);
}
bool News::GetLatestUpdater()
{
std::lock_guard<std::mutex> _(News::UpdaterMutex);
if (Utils::IO::FileExists("updater.exe"))
{
// Generate hash of local updater.exe
std::string localUpdater = Utils::IO::ReadFile("updater.exe");
localUpdater = Utils::Cryptography::SHA1::Compute(localUpdater, true);
static Utils::Time::Interval updateInterval;
if (News::UpdaterHash.empty() || updateInterval.elapsed(15min)) // Check for updater Update every 15 mins max
{
updateInterval.update();
std::string data = Utils::Cache::GetFile("/json/updater"); // {"updater.exe":{"SHA1":"*HASH*"}}
std::string error;
json11::Json listData = json11::Json::parse(data, error);
if (error.empty() || listData.is_object())
{
News::UpdaterHash = listData["updater.exe"]["SHA1"].string_value();
}
}
if (!News::UpdaterHash.empty() && localUpdater != News::UpdaterHash)
{
remove("updater.exe");
}
}
if (!Utils::IO::FileExists("updater.exe"))
{
return News::DownloadUpdater();
}
return true;
}
bool News::DownloadUpdater()
{
std::string data = Utils::Cache::GetFile("/iw4/updater.exe");
if (!data.empty())
{
Utils::IO::WriteFile("updater.exe", data);
return true;
}
return false;
}
const char* News::GetNewsText()
{
return Localization::Get("MPUI_MOTD_TEXT");
}
void News::CheckForUpdate()
{
std::string _client = Utils::Cache::GetFile("/json/client");
if (!_client.empty())
{
std::string error;
json11::Json client = json11::Json::parse(_client.data(), error);
int revisionNumber;
if (client["revision"].is_number())
{
revisionNumber = client["revision"].int_value();
}
else if (client["revision"].is_string())
{
revisionNumber = atoi(client["revision"].string_value().data());
}
else return;
Dvar::Var("cl_updateversion").get<Game::dvar_t*>()->current.integer = revisionNumber;
Dvar::Var("cl_updateavailable").get<Game::dvar_t*>()->current.enabled = (revisionNumber > REVISION);
// if there is an update then show the toast, but only once
static bool showToast = true;
if (revisionNumber > REVISION && showToast)
{
showToast = false;
Scheduler::OnReady([]()
{
Toast::Show("cardicon_gears", "^4Update Available", "There is an update available for your client!", 5000);
});
}
}
}
void News::LaunchUpdater(const std::string& params)
{
if (News::Updating()) return;
News::UpdaterArgs = params;
Localization::SetTemp("MENU_RECONNECTING_TO_PARTY", "Downloading updater");
Command::Execute("openmenu popup_reconnectingtoparty", true);
// Run the updater on shutdown
Utils::Hook::Set(0x6D72A0, News::ExitProcessStub);
std::thread([]()
{
if (News::GetLatestUpdater())
{
Console::SetSkipShutdown();
Command::Execute("wait 300; quit;", false);
}
else
{
Localization::ClearTemp();
News::UpdaterArgs.clear();
Command::Execute("closemenu popup_reconnectingtoparty", false);
Game::ShowMessageBox("Failed to download the updater!", "Error");
}
}).detach();
}
bool News::Updating()
{
return !News::UpdaterArgs.empty();
}
News::News()
{
News::UpdaterArgs.clear();
News::UpdaterHash.clear();
if (ZoneBuilder::IsEnabled() || Dedicated::IsEnabled()) return; // Maybe also dedi?
Dvar::Register<bool>("g_firstLaunch", true, Game::DVAR_FLAG_SAVED, "");
Dvar::Register<int>("cl_updateoldversion", REVISION, REVISION, REVISION, Game::DVAR_FLAG_WRITEPROTECTED, "Current version number.");
Dvar::Register<int>("cl_updateversion", 0, 0, -1, Game::DVAR_FLAG_WRITEPROTECTED, "New version number.");
Dvar::Register<bool>("cl_updateavailable", false, Game::DVAR_FLAG_WRITEPROTECTED, "New update is available.");
UIScript::Add("checkFirstLaunch", [](UIScript::Token)
{
@ -221,8 +71,6 @@ namespace Components
Localization::Set("MPUI_CHANGELOG_TEXT", "Loading...");
Localization::Set("MPUI_MOTD_TEXT", NEWS_MOTD_DEFAULT);
//News::GetLatestUpdater();
// make newsfeed (ticker) menu items not cut off based on safe area
Utils::Hook::Nop(0x63892D, 5);
@ -230,17 +78,6 @@ namespace Components
Utils::Hook::Nop(0x6388BB, 2); // skip the "if (item->text[0] == '@')" localize check
Utils::Hook(0x6388C1, News::GetNewsText, HOOK_CALL).install()->quick();
Command::Add("checkforupdate", [](Command::Params*)
{
News::CheckForUpdate();
});
Command::Add("getautoupdate", [](Command::Params*)
{
if (!Dvar::Var("cl_updateavailable").get<Game::dvar_t*>()->current.enabled) return;
News::LaunchUpdater("-update -c");
});
if (!Utils::IsWineEnvironment() && !Loader::IsPerformingUnitTests())
{
News::Terminate = false;
@ -257,12 +94,8 @@ namespace Components
if (!Loader::IsPerformingUnitTests() && !News::Terminate)
{
News::GetLatestUpdater();
while (!News::Terminate)
{
News::CheckForUpdate();
// Sleep for 3 minutes
for (int i = 0; i < 180 && !News::Terminate; ++i)
{
@ -274,12 +107,6 @@ namespace Components
}
}
News::~News()
{
News::UpdaterArgs.clear();
News::UpdaterHash.clear();
}
void News::preDestroy()
{
News::Terminate = true;

View File

@ -6,27 +6,16 @@ namespace Components
{
public:
News();
~News();
void preDestroy() override;
bool unitTest() override;
static void LaunchUpdater(const std::string& params);
static bool Updating();
private:
static std::string UpdaterArgs;
static std::string UpdaterHash;
static std::thread Thread;
static std::mutex UpdaterMutex;
static bool Terminate;
static bool GetLatestUpdater();
static bool DownloadUpdater();
static void CheckForUpdate();
static void ExitProcessStub(unsigned int exitCode);
static const char* GetNewsText();
};
}

View File

@ -210,7 +210,7 @@ namespace Components
// Force xblive_privatematch 0 and rename it
//Utils::Hook::Set<BYTE>(0x420A6A, 4);
Utils::Hook::Set<BYTE>(0x420A6C, 0);
Utils::Hook::Set<char*>(0x420A6E, "xblive_privateserver");
Utils::Hook::Set<const char*>(0x420A6E, "xblive_privateserver");
// Remove migration shutdown, it causes crashes and will be destroyed when erroring anyways
Utils::Hook::Nop(0x5A8E1C, 12);
@ -244,9 +244,9 @@ namespace Components
//Utils::Hook(0x4D5D51, Party::RegisterMinPlayers, HOOK_CALL).install()->quick();
// Set ui_maxclients to sv_maxclients
Utils::Hook::Set<char*>(0x42618F, "sv_maxclients");
Utils::Hook::Set<char*>(0x4D3756, "sv_maxclients");
Utils::Hook::Set<char*>(0x5E3772, "sv_maxclients");
Utils::Hook::Set<const char*>(0x42618F, "sv_maxclients");
Utils::Hook::Set<const char*>(0x4D3756, "sv_maxclients");
Utils::Hook::Set<const char*>(0x5E3772, "sv_maxclients");
// Unlatch maxclient dvars
Utils::Hook::Xor<BYTE>(0x426187, Game::dvar_flag::DVAR_FLAG_LATCHED);

View File

@ -150,7 +150,7 @@ namespace Components
Playlist::Playlist()
{
// Default playlists
Utils::Hook::Set<char*>(0x60B06E, "playlists_default.info");
Utils::Hook::Set<const char*>(0x60B06E, "playlists_default.info");
// disable playlist download function
Utils::Hook::Set<BYTE>(0x4D4790, 0xC3);

View File

@ -159,7 +159,7 @@ namespace Components
__declspec(naked) void QuickPatch::InvalidNameStub()
{
static char* kick_reason = "Invalid name detected.";
static const char* kick_reason = "Invalid name detected.";
__asm
{
@ -216,11 +216,11 @@ namespace Components
{
static std::vector < char * > values =
{
"auto",
"standard",
"wide 16:10",
"wide 16:9",
"custom",
const_cast<char*>("auto"),
const_cast<char*>("standard"),
const_cast<char*>("wide 16:10"),
const_cast<char*>("wide 16:9"),
const_cast<char*>("custom"),
nullptr,
};
@ -443,16 +443,16 @@ namespace Components
Utils::Hook::Set<DWORD>(0x45ACE0, 0xC301B0);
// fs_basegame
Utils::Hook::Set<char*>(0x6431D1, BASEGAME);
Utils::Hook::Set<const char*>(0x6431D1, BASEGAME);
// UI version string
Utils::Hook::Set<char*>(0x43F73B, "IW4x: " VERSION);
Utils::Hook::Set<const char*>(0x43F73B, "IW4x: " VERSION);
// console version string
Utils::Hook::Set<char*>(0x4B12BB, "IW4x " VERSION " (built " __DATE__ " " __TIME__ ")");
Utils::Hook::Set<const char*>(0x4B12BB, "IW4x " VERSION " (built " __DATE__ " " __TIME__ ")");
// version string
Utils::Hook::Set<char*>(0x60BD56, "IW4x (" VERSION ")");
Utils::Hook::Set<const char*>(0x60BD56, "IW4x (" VERSION ")");
// version string color
static float buildLocColor[] = { 1.0f, 1.0f, 1.0f, 0.8f };
@ -469,33 +469,33 @@ namespace Components
// console title
if (ZoneBuilder::IsEnabled())
{
Utils::Hook::Set<char*>(0x4289E8, "IW4x (" VERSION "): ZoneBuilder");
Utils::Hook::Set<const char*>(0x4289E8, "IW4x (" VERSION "): ZoneBuilder");
}
else if (Dedicated::IsEnabled())
{
Utils::Hook::Set<char*>(0x4289E8, "IW4x (" VERSION "): Dedicated");
Utils::Hook::Set<const char*>(0x4289E8, "IW4x (" VERSION "): Dedicated");
}
else
{
Utils::Hook::Set<char*>(0x4289E8, "IW4x (" VERSION "): Console");
Utils::Hook::Set<const char*>(0x4289E8, "IW4x (" VERSION "): Console");
}
// window title
Utils::Hook::Set<char*>(0x5076A0, "IW4x: Multiplayer");
Utils::Hook::Set<const char*>(0x5076A0, "IW4x: Multiplayer");
// sv_hostname
Utils::Hook::Set<char*>(0x4D378B, "IW4Host");
Utils::Hook::Set<const char*>(0x4D378B, "IW4Host");
// shortversion
Utils::Hook::Set<char*>(0x60BD91, SHORTVERSION);
Utils::Hook::Set<const char*>(0x60BD91, SHORTVERSION);
// console logo
Utils::Hook::Set<char*>(0x428A66, BASEGAME "/images/logo.bmp");
Utils::Hook::Set<const char*>(0x428A66, BASEGAME "/images/logo.bmp");
// splash logo
Utils::Hook::Set<char*>(0x475F9E, BASEGAME "/images/splash.bmp");
Utils::Hook::Set<const char*>(0x475F9E, BASEGAME "/images/splash.bmp");
Utils::Hook::Set<char*>(0x4876C6, "Successfully read stats data\n");
Utils::Hook::Set<const char*>(0x4876C6, "Successfully read stats data\n");
// Numerical ping (cg_scoreboardPingText 1)
Utils::Hook::Set<BYTE>(0x45888E, 1);
@ -596,21 +596,21 @@ namespace Components
// intro stuff
Utils::Hook::Nop(0x60BEE9, 5); // Don't show legals
Utils::Hook::Nop(0x60BEF6, 5); // Don't reset the intro dvar
Utils::Hook::Set<char*>(0x60BED2, "unskippablecinematic IW_logo\n");
Utils::Hook::Set<char*>(0x51C2A4, "%s\\" BASEGAME "\\video\\%s.bik");
Utils::Hook::Set<const char*>(0x60BED2, "unskippablecinematic IW_logo\n");
Utils::Hook::Set<const char*>(0x51C2A4, "%s\\" BASEGAME "\\video\\%s.bik");
Utils::Hook::Set<DWORD>(0x51C2C2, 0x78A0AC);
// Redirect logs
Utils::Hook::Set<char*>(0x5E44D8, "logs/games_mp.log");
Utils::Hook::Set<char*>(0x60A90C, "logs/console_mp.log");
Utils::Hook::Set<char*>(0x60A918, "logs/console_mp.log");
Utils::Hook::Set<const char*>(0x5E44D8, "logs/games_mp.log");
Utils::Hook::Set<const char*>(0x60A90C, "logs/console_mp.log");
Utils::Hook::Set<const char*>(0x60A918, "logs/console_mp.log");
// Rename config
Utils::Hook::Set<char*>(0x461B4B, CLIENT_CONFIG);
Utils::Hook::Set<char*>(0x47DCBB, CLIENT_CONFIG);
Utils::Hook::Set<char*>(0x6098F8, CLIENT_CONFIG);
Utils::Hook::Set<char*>(0x60B279, CLIENT_CONFIG);
Utils::Hook::Set<char*>(0x60BBD4, CLIENT_CONFIG);
Utils::Hook::Set<const char*>(0x461B4B, CLIENT_CONFIG);
Utils::Hook::Set<const char*>(0x47DCBB, CLIENT_CONFIG);
Utils::Hook::Set<const char*>(0x6098F8, CLIENT_CONFIG);
Utils::Hook::Set<const char*>(0x60B279, CLIENT_CONFIG);
Utils::Hook::Set<const char*>(0x60BBD4, CLIENT_CONFIG);
// Disable profile system
// Utils::Hook::Nop(0x60BEB1, 5); // GamerProfile_InitAllProfiles - Causes an error, when calling a harrier killstreak.

View File

@ -7,6 +7,6 @@ namespace Components
public:
RawFiles();
static void* RawFiles::LoadModdableRawfileFunc(const char* filename);
static void* LoadModdableRawfileFunc(const char* filename);
};
}

View File

@ -371,7 +371,7 @@ namespace Components
UIFeeder::Add(10.0f, Theatre::GetDemoCount, Theatre::GetDemoText, Theatre::SelectDemo);
// set the configstrings stuff to load the default (empty) string table; this should allow demo recording on all gametypes/maps
if (!Dedicated::IsEnabled()) Utils::Hook::Set<char*>(0x47440B, "mp/defaultStringTable.csv");
if (!Dedicated::IsEnabled()) Utils::Hook::Set<const char*>(0x47440B, "mp/defaultStringTable.csv");
// Change font size
Utils::Hook::Set<BYTE>(0x5AC854, 2);

View File

@ -22,7 +22,7 @@ namespace Components
return this->token;
}
return "";
return const_cast<char*>("");
}
template<> const char* UIScript::Token::get()

View File

@ -510,7 +510,7 @@ namespace Components
// Add branding asset
void ZoneBuilder::Zone::addBranding()
{
char* data = "FastFile built using the IW4x ZoneBuilder!";
const char* data = "FastFile built using the IW4x ZoneBuilder!";
this->branding = { this->zoneName.data(), static_cast<int>(strlen(data)), 0, data };
if (this->findAsset(Game::XAssetType::ASSET_TYPE_RAWFILE, this->branding.name) != -1)
@ -1306,7 +1306,7 @@ namespace Components
// HACK: set language to 'techsets' to load from that dir
char* language = Utils::Hook::Get<char*>(0x649E740);
Utils::Hook::Set<char*>(0x649E740, "techsets");
Utils::Hook::Set<const char*>(0x649E740, "techsets");
// load generated techset fastfiles
auto list = Utils::IO::ListFiles("zone/techsets");
@ -1366,7 +1366,7 @@ namespace Components
info.freeFlags = Game::DB_ZONE_MOD;
Game::DB_LoadXAssets(&info, 1, true);
Utils::Hook::Set<char*>(0x649E740, "techsets");
Utils::Hook::Set<const char*>(0x649E740, "techsets");
i = 0;
subCount++;

View File

@ -693,7 +693,7 @@ namespace Game
void Vec3Normalize(vec3_t& vec)
{
const auto length = std::sqrt(std::pow(vec[0], 2) + std::pow(vec[1], 2) + std::pow(vec[2], 2));
const float length = static_cast<float>(std::sqrt(std::pow(vec[0], 2) + std::pow(vec[1], 2) + std::pow(vec[2], 2)));
vec[0] /= length;
vec[1] /= length;
vec[2] /= length;

View File

@ -24,7 +24,7 @@ namespace Steam
{
if (Components::Dedicated::IsEnabled() || Components::ZoneBuilder::IsEnabled()) // Dedi guid
{
idBits = *reinterpret_cast<unsigned __int64*>(static_cast<char*>("DEDICATE"));
idBits = *reinterpret_cast<unsigned __int64*>(const_cast<char*>("DEDICATE"));
}
else if (Components::Singleton::IsFirstInstance()) // ECDSA guid
{

View File

@ -154,7 +154,7 @@ namespace Steam
gameID.type = 1; // k_EGameIDTypeGameMod
gameID.appID = Proxy::AppId & 0xFFFFFF;
char* modId = "IW4x";
char* modId = const_cast<char*>("IW4x");
gameID.modID = *reinterpret_cast<unsigned int*>(modId) | 0x80000000;
Interface clientUtils(Proxy::ClientEngine->GetIClientUtils(Proxy::SteamPipe));
@ -194,7 +194,7 @@ namespace Steam
void Proxy::RunMod()
{
char* command = "-proc ";
const char* command = "-proc ";
char* parentProc = strstr(GetCommandLineA(), command);
if (parentProc)

View File

@ -111,7 +111,8 @@ namespace Steam
{
bool SteamAPI_Init()
{
Proxy::SetGame(10190);
//The latest steam update has broke IW4x's steam integration. As of now the best way of dealing with this is to just disable it. This has been commented out so that if fixed, this may be easily enabled once again.
/*Proxy::SetGame(10190);
if (!Proxy::Inititalize())
{
@ -122,7 +123,7 @@ namespace Steam
{
Proxy::SetMod("IW4x: Modern Warfare 2");
Proxy::RunGame();
}
}*/
return true;
}

View File

@ -4,27 +4,15 @@ namespace Utils
{
const char* Cache::Urls[] =
{
"https://iw4x.org",
"https://xlabs.dev",
"https://raw.githubusercontent.com/XLabsProject/iw4x-client"
"https://iw4xcachep26muba.onion.to",
"https://iw4xcachep26muba.tor2web.xyz",
"https://iw4xcachep26muba.onion.ws",
"https://iw4xcachep26muba.onion.sh",
"https://iw4xcachep26muba.onion.pet",
//Links to old onion site - deprecated
//"https://iw4xcachep26muba.tor2web.xyz",
//"https://iw4xcachep26muba.onion.ws",
//"https://iw4xcachep26muba.onion.sh",
//"https://iw4xcachep26muba.onion.pet",
// Links below are dead
// Still, let's keep them in case they come back
"https://iw4xcachep26muba.onion.rip",
"https://iw4xcachep26muba.onion.nu",
"https://iw4xcachep26muba.onion.guide",
"https://iw4xcachep26muba.onion.casa",
"https://iw4xcachep26muba.hiddenservice.net",
"https://iw4xcachep26muba.onion.cab",
"https://iw4xcachep26muba.onion.link",
// Not registered yet
//"https://iw4xcachejnetuln.onion.to",
//"https://iw4xcachedjodc4y.onion.to",
};
std::string Cache::ValidUrl;
std::mutex Cache::CacheMutex;

View File

@ -18,7 +18,7 @@ namespace Utils
{
if (this->tokenString.empty())
{
this->tokenString.append(reinterpret_cast<uint8_t*>("\0"), 1);
this->tokenString.append(reinterpret_cast<uint8_t*>(const_cast<char *>("\0")), 1);
}
else
{
@ -31,7 +31,7 @@ namespace Utils
if (!i)
{
// Prepend here, as /dev/urandom says so ;) https://github.com/IW4x/iw4x-client-node/wikis/technical-information#incrementing-the-token
this->tokenString = std::basic_string<uint8_t>(reinterpret_cast<uint8_t*>("\0"), 1) + this->tokenString;
this->tokenString = std::basic_string<uint8_t>(reinterpret_cast<uint8_t*>(const_cast<char*>("\0")), 1) + this->tokenString;
break;
}
}

View File

@ -2,9 +2,9 @@
namespace Utils
{
Library::Library(const std::string& buffer, bool _freeOnDestroy) : module(nullptr), freeOnDestroy(_freeOnDestroy)
Library::Library(const std::string& buffer, bool _freeOnDestroy) : _module(nullptr), freeOnDestroy(_freeOnDestroy)
{
this->module = LoadLibraryExA(buffer.data(), nullptr, 0);
this->_module = LoadLibraryExA(buffer.data(), nullptr, 0);
}
Library::~Library()
@ -22,7 +22,7 @@ namespace Utils
HMODULE Library::getModule()
{
return this->module;
return this->_module;
}
void Library::free()
@ -32,6 +32,6 @@ namespace Utils
FreeLibrary(this->getModule());
}
this->module = nullptr;
this->_module = nullptr;
}
}

View File

@ -5,7 +5,7 @@ namespace Utils
class Library
{
public:
Library() : module(nullptr), freeOnDestroy(false) {};
Library() : _module(nullptr), freeOnDestroy(false) {};
Library(const std::string& buffer, bool freeOnDestroy = true);
~Library();
@ -26,7 +26,7 @@ namespace Utils
void free();
private:
HMODULE module;
HMODULE _module;
bool freeOnDestroy;
};
}

View File

@ -149,7 +149,7 @@ namespace Utils
std::string FormatBandwidth(size_t bytes, int milliseconds)
{
static char* sizes[] =
static const char* sizes[] =
{
"B",
"KB",

View File

@ -13,7 +13,7 @@ namespace Utils
VAProvider() : currentBuffer(0) {}
~VAProvider() {}
char* get(const char* format, va_list ap)
const char* get(const char* format, va_list ap)
{
++this->currentBuffer %= ARRAYSIZE(this->stringPool);
auto entry = &this->stringPool[this->currentBuffer];

View File

@ -15,7 +15,7 @@ namespace Utils
bool IsWineEnvironment();
unsigned long GetParentProcessId();
size_t GetModuleSize(HMODULE module);
size_t GetModuleSize(HMODULE);
void* GetThreadStartAddress(HANDLE hThread);
HMODULE GetNTDLL();