Skip to content

Commit

Permalink
Rewrote CmdArgs
Browse files Browse the repository at this point in the history
- Renamed it to CommandLine
- Now parsing happens in the ctor where it should; command line arguments are not subject to change throughout a program's run
  • Loading branch information
visuve committed Jan 1, 2024
1 parent bcef98e commit 335009b
Show file tree
Hide file tree
Showing 33 changed files with 349 additions and 339 deletions.
4 changes: 2 additions & 2 deletions CrysisR/CrysisR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

template<typename T>
void Cheat(const CmdArgs& args, std::string_view key, const Process& process, size_t offset)
void Cheat(const CommandLine& args, std::string_view key, const Process& process, size_t offset)
{
T wanted = args.Value<T>(key);

Expand All @@ -28,7 +28,7 @@ int IWillNotUseHackLibForEvil(const std::vector<std::string>& givenArguments)
{
int exitCode = 0;

const CmdArgs args(givenArguments,
const CommandLine args(givenArguments,
{
{ "i_unlimitedammo", typeid(int32_t), "Unlimited ammo" },
{ "g_suitRecoilEnergyCost", typeid(float), "Recoil energy cost" },
Expand Down
2 changes: 1 addition & 1 deletion Doom2016/Doom2016.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ int IWillNotUseHackLibForEvil(const std::vector<std::string>& givenArguments)
{
int exitCode = 0;

const CmdArgs args(givenArguments,
const CommandLine args(givenArguments,
{
{ "infammo", typeid(std::nullopt), "Infinite ammo" },
{ "instantcool", typeid(std::nullopt), "Instant weapon cooldown" },
Expand Down
2 changes: 1 addition & 1 deletion Doom3BFG/Doom3BFG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

int IWillNotUseHackLibForEvil(const std::vector<std::string>& givenArguments)
{
const CmdArgs args(givenArguments,
const CommandLine args(givenArguments,
{
{ "infammo", typeid(std::nullopt), "Ammunition is never reduced" },
{ "inflamp", typeid(std::nullopt), "Lamp battery is never reduced" },
Expand Down
2 changes: 1 addition & 1 deletion Doom3ROE/Doom3ROE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

int IWillNotUseHackLibForEvil(const std::vector<std::string>& givenArguments)
{
const CmdArgs args(givenArguments,
const CommandLine args(givenArguments,
{
{ "infammo", typeid(std::nullopt), "Ammunition is never reduced" },
{ "infarmor", typeid(std::nullopt), "Infinite armor" }
Expand Down
2 changes: 1 addition & 1 deletion DoomEternal/DoomEternal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ int IWillNotUseHackLibForEvil(const std::vector<std::string>& givenArguments)
{
int exitCode = 0;

const CmdArgs args(givenArguments,
const CommandLine args(givenArguments,
{
{ "infammo", typeid(std::nullopt), "Infinite ammo" },
{ "freeupgrades", typeid(std::nullopt), "Free weapon & gear upgrades. Note: do not use before third level (Cultist Base)..." },
Expand Down
4 changes: 2 additions & 2 deletions EntryPoint/Main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "CmdArgs.hpp"
#include "CommandLine.hpp"
#include "System.hpp"
#include "Logger.hpp"
#include "Win32Event.hpp"
Expand Down Expand Up @@ -63,7 +63,7 @@ int main(int argc, char** argv)
exitCode = IWillNotUseHackLibForEvil({ argv, argv + argc });
System::BeepDown();
}
catch (const CmdArgs::Exception& e)
catch (const CommandLine::Exception& e)
{
LogError << e.what() << "\n";
std::cerr << e.Usage();
Expand Down
2 changes: 1 addition & 1 deletion FalloutNV/FalloutNV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

int IWillNotUseHackLibForEvil(const std::vector<std::string>& givenArguments)
{
const CmdArgs args(givenArguments,
const CommandLine args(givenArguments,
{
{ "infammo", typeid(std::nullopt), "Ammunition is never reduced (NOTE: might be flaky)" },
{ "nowear", typeid(std::nullopt), "Weapon condition is never reduced" }
Expand Down
2 changes: 1 addition & 1 deletion HOMM3/HOMM3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ std::ostream& operator << (std::ostream& os, const Resources& r)

int IWillNotUseHackLibForEvil(const std::vector<std::string>& givenArguments)
{
const CmdArgs args(givenArguments,
const CommandLine args(givenArguments,
{
{ "addresources", typeid(std::nullopt), "Adds 48879 to each resource" },
});
Expand Down
218 changes: 0 additions & 218 deletions HackLib/CmdArgs.cpp

This file was deleted.

57 changes: 0 additions & 57 deletions HackLib/CmdArgs.hpp

This file was deleted.

Loading

0 comments on commit 335009b

Please sign in to comment.