Skip to content

Commit

Permalink
Rework scripts to just be additional args.
Browse files Browse the repository at this point in the history
(cherry picked from commit 7451907)
  • Loading branch information
Chris Frantz committed Apr 5, 2020
1 parent 0c3a3fe commit 95e8b73
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ bazel-*
tools/mxe
gtm/*
lemmy/*
init.z2edit
9 changes: 3 additions & 6 deletions main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
#include <gflags/gflags.h>
#include <SDL2/SDL.h>

#include "absl/strings/str_split.h"
#include "app.h"
#include "util/config.h"
#include "zelda2_config.h"

DEFINE_string(config, "", "ROM info config file");
DEFINE_string(source, "", "List of scripts to run upon startup.");
DEFINE_string(keybinds, "", "Alternate keybinds for the editor");
DEFINE_bool(dump_config, false, "Dump config to stdout and exit");
DEFINE_bool(move_from_keepout, true, "Move maps out of known keepout areas");
Expand Down Expand Up @@ -119,14 +117,13 @@ void PostProcess(z2util::RomInfo* config) {
}

const char kUsage[] =
R"ZZZ(<optional flags> [user-supplied-zelda2.nes]
R"ZZZ(<optional flags> [user-supplied-zelda2.nes] [script ...]
Description:
A ROM file edtior for Zelda II The Adventure of Link.
Flags:
--config <filename> Use an alternate config file.
--source [script[,script]] Scripts to run on startup.
--hidpi <n> Set the scaling factor on hidpi displays (try 2.0)
--emulator <prog> Emulator to run for File | Emulate.
--romtmp <filename> Temporary filename for File | Emulate.
Expand Down Expand Up @@ -158,8 +155,8 @@ int main(int argc, char *argv[]) {

if (argc > 1) {
app.Load(argv[1]);
for(const auto& s : absl::StrSplit(FLAGS_source, ',')) {
app.Source(std::string(s));
for(int i=2; i<argc; ++i) {
app.Source(argv[i]);
}
}
app.Run();
Expand Down

0 comments on commit 95e8b73

Please sign in to comment.