Fix up handling of positional options in cvar handling.

- Fix up handling of positional options in cvar handling so that executables
  other than app can handle them properly.
- Fix command-line arguments for xenia-vfs-dump.
This commit is contained in:
gibbed
2019-08-24 06:23:25 -05:00
committed by Rick Gibbed
parent 16bbfdbb3c
commit 3e6c2bb47c
14 changed files with 81 additions and 39 deletions

View File

@@ -2,7 +2,7 @@
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2014 Ben Vanik. All rights reserved. *
* Copyright 2019 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
@@ -13,6 +13,7 @@
#include <string>
#include <vector>
#include "xenia/base/cvar.h"
#include "xenia/base/platform.h"
namespace xe {
@@ -24,14 +25,19 @@ bool has_console_attached();
// launch.
struct EntryInfo {
std::wstring name;
std::wstring usage;
std::string positional_usage;
std::vector<std::string> positional_options;
int (*entry_point)(const std::vector<std::wstring>& args);
};
EntryInfo GetEntryInfo();
#define DEFINE_ENTRY_POINT(name, usage, entry_point) \
xe::EntryInfo xe::GetEntryInfo() { \
return xe::EntryInfo({name, usage, entry_point}); \
#define DEFINE_ENTRY_POINT(name, entry_point, positional_usage, ...) \
xe::EntryInfo xe::GetEntryInfo() { \
std::initializer_list<std::string> positional_options = {__VA_ARGS__}; \
return xe::EntryInfo( \
{name, positional_usage, \
std::vector<std::string>(std::move(positional_options)), \
entry_point}); \
}
} // namespace xe