Skip to content

Commit

Permalink
Review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kalaposfos13 committed Jan 18, 2025
1 parent adaeb7c commit 0063fcb
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/core/linker.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class Linker {
void Relocate(Module* module);
bool Resolve(const std::string& name, Loader::SymbolType type, Module* module,
Loader::SymbolRecord* return_info);
void Execute(const std::vector<std::string> args = std::vector<std::string>());
void Execute(const std::vector<std::string> args = {});
void DebugDump();

private:
Expand Down
2 changes: 1 addition & 1 deletion src/emulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ void Emulator::Run(const std::filesystem::path& file, const std::vector<std::str
psf_attributes.raw = *raw_attributes;
}
if (!args.empty()) {
int argc = args.size() > 32 ? 32 : args.size();
int argc = std::min<int>(args.size(), 32);
for (int i = 0; i < argc; i++) {
LOG_INFO(Loader, "Game argument {}: {}", i, args[i]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/emulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Emulator {
~Emulator();

void Run(const std::filesystem::path& file,
const std::vector<std::string> args = std::vector<std::string>());
const std::vector<std::string> args = {});
void UpdatePlayTime(const std::string& serial);

private:
Expand Down
9 changes: 1 addition & 8 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,18 +139,11 @@ int main(int argc, char* argv[]) {
game_args.push_back(argv[j]);
}
break;
} else if (std::string(argv[i + 1]) == "--") {
} else if (i + 1 < argc && std::string(argv[i + 1]) == "--") {
if (!has_game_argument) {
game_path = argv[i];
has_game_argument = true;
}
if (i + 2 == argc) {
std::cerr << "Warning: -- is set, but no game arguments are added!\n";
break;
}
for (int j = i + 2; j < argc; j++) {
game_args.push_back(argv[j]);
}
break;
} else {
std::cerr << "Unknown argument: " << cur_arg << ", see --help for info.\n";
Expand Down
10 changes: 1 addition & 9 deletions src/qt_gui/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,19 +144,11 @@ int main(int argc, char* argv[]) {
game_args.push_back(argv[j]);
}
break;
} else if (std::string(argv[i + 1]) == "--") {
} else if (i + 1 < argc && std::string(argv[i + 1]) == "--") {
if (!has_game_argument) {
game_path = argv[i];
has_game_argument = true;
}
if (i + 2 == argc) {
std::cerr << "Warning: -- is set, but no game arguments are added!\n";
break;
}
for (int j = i + 2; j < argc; j++) {
game_args.push_back(argv[j]);
}
break;
} else {
std::cerr << "Unknown argument: " << cur_arg << ", see --help for info.\n";
return 1;
Expand Down

0 comments on commit 0063fcb

Please sign in to comment.