Files
FEX-Emu--FEX/Source/Common/ArgumentLoader.cpp
T
Ryan Houdek f161e3bfb0 Massive amount of IWYU cleanup
This isn't quite a 100% clean sweep of IWYU.
There are some false positives where clang fails.
Additionally there are still a few missed in the frontend side of things
that I didn't get to
2021-08-28 00:32:15 -07:00

85 lines
2.2 KiB
C++

#include "Common/ArgumentLoader.h"
#include "OptionParser.h"
#include "git_version.h"
#include <stdint.h>
namespace FEX::Handler {
std::string CoreHandler(std::string &Value) {
if (Value == "irint")
return "0";
else if (Value == "irjit")
return "1";
#ifdef _M_X86_64
else if (Value == "host")
return "2";
#endif
return "1";
}
std::string SMCCheckHandler(std::string &Value) {
if (Value == "none")
return "0";
else if (Value == "mman")
return "1";
else if (Value == "full")
return "2";
return "0";
}
}
namespace FEX::ArgLoader {
std::vector<std::string> RemainingArgs;
std::vector<std::string> ProgramArguments;
static std::string Version = "FEX-Emu (" GIT_DESCRIBE_STRING ") ";
void FEX::ArgLoader::ArgLoader::Load() {
optparse::OptionParser Parser{};
Parser.version(Version);
optparse::OptionGroup CPUGroup(Parser, "CPU Core options");
optparse::OptionGroup EmulationGroup(Parser, "Emulation options");
optparse::OptionGroup DebugGroup(Parser, "Debug options");
optparse::OptionGroup HacksGroup(Parser, "Hacks options");
optparse::OptionGroup MiscGroup(Parser, "Miscellaneous options");
optparse::OptionGroup LoggingGroup(Parser, "Logging options");
#define BEFORE_PARSE
#include <FEXCore/Config/ConfigOptions.inl>
Parser.add_option_group(CPUGroup);
Parser.add_option_group(EmulationGroup);
Parser.add_option_group(DebugGroup);
Parser.add_option_group(HacksGroup);
Parser.add_option_group(MiscGroup);
Parser.add_option_group(LoggingGroup);
optparse::Values Options = Parser.parse_args(argc, argv);
using int32 = int32_t;
using uint32 = uint32_t;
#define AFTER_PARSE
#include <FEXCore/Config/ConfigOptions.inl>
RemainingArgs = Parser.args();
ProgramArguments = Parser.parsed_args();
}
void LoadWithoutArguments(int _argc, char **_argv) {
// Skip argument 0, which will be the interpreter
for (int i = 1; i < _argc; ++i) {
RemainingArgs.emplace_back(_argv[i]);
}
// Put the interpreter in ProgramArguments
ProgramArguments.emplace_back(_argv[0]);
}
std::vector<std::string> Get() {
return RemainingArgs;
}
std::vector<std::string> GetParsedArgs() {
return ProgramArguments;
}
}