GBA: Add API for getting Configuration structs for overrides and input

This commit is contained in:
Jeffrey Pfau 2015-01-29 23:16:25 -08:00
parent 370bbd83ba
commit 0de46a7867
6 changed files with 17 additions and 4 deletions

View File

@ -45,6 +45,7 @@ Misc:
- Debugger: Merge Thumb BL instructions when disassembling - Debugger: Merge Thumb BL instructions when disassembling
- Debugger: Clean up debugger interface, removing obsolete state (fixes #67) - Debugger: Clean up debugger interface, removing obsolete state (fixes #67)
- Debugger: Watchpoints now report address watched (fixes #68) - Debugger: Watchpoints now report address watched (fixes #68)
- GBA: Add API for getting Configuration structs for overrides and input
0.1.1: (2015-01-24) 0.1.1: (2015-01-24)
Bugfixes: Bugfixes:

View File

@ -257,6 +257,15 @@ void GBAConfigLoadDefaults(struct GBAConfig* config, const struct GBAOptions* op
} }
} }
// These two are basically placeholders in case the internal layout changes, e.g. for loading separate files
struct Configuration* GBAConfigGetInput(struct GBAConfig* config) {
return &config->configTable;
}
struct Configuration* GBAConfigGetOverrides(struct GBAConfig* config) {
return &config->configTable;
}
void GBAConfigFreeOpts(struct GBAOptions* opts) { void GBAConfigFreeOpts(struct GBAOptions* opts) {
free(opts->bios); free(opts->bios);
opts->bios = 0; opts->bios = 0;

View File

@ -64,6 +64,9 @@ void GBAConfigSetDefaultFloatValue(struct GBAConfig*, const char* key, float val
void GBAConfigMap(const struct GBAConfig* config, struct GBAOptions* opts); void GBAConfigMap(const struct GBAConfig* config, struct GBAOptions* opts);
void GBAConfigLoadDefaults(struct GBAConfig* config, const struct GBAOptions* opts); void GBAConfigLoadDefaults(struct GBAConfig* config, const struct GBAOptions* opts);
struct Configuration* GBAConfigGetInput(struct GBAConfig*);
struct Configuration* GBAConfigGetOverrides(struct GBAConfig*);
void GBAConfigFreeOpts(struct GBAOptions* opts); void GBAConfigFreeOpts(struct GBAOptions* opts);
#endif #endif

View File

@ -81,7 +81,7 @@ int main(int argc, char** argv) {
} }
context.debugger = createDebugger(&args, &context); context.debugger = createDebugger(&args, &context);
context.overrides = &config.configTable; context.overrides = GBAConfigGetOverrides(&config);
char gameCode[5] = { 0 }; char gameCode[5] = { 0 };
GBAConfigMap(&config, &opts); GBAConfigMap(&config, &opts);

View File

@ -76,7 +76,7 @@ public:
QList<QString> getMRU() const; QList<QString> getMRU() const;
void setMRU(const QList<QString>& mru); void setMRU(const QList<QString>& mru);
Configuration* overrides() { return &m_config.configTable; } // TODO: Make this not return the whole table Configuration* overrides() { return GBAConfigGetOverrides(&m_config); }
void saveOverride(const GBACartridgeOverride&); void saveOverride(const GBACartridgeOverride&);
public slots: public slots:

View File

@ -102,8 +102,8 @@ int main(int argc, char** argv) {
renderer.events.bindings = &inputMap; renderer.events.bindings = &inputMap;
GBASDLInitBindings(&inputMap); GBASDLInitBindings(&inputMap);
GBASDLInitEvents(&renderer.events); GBASDLInitEvents(&renderer.events);
GBASDLEventsLoadConfig(&renderer.events, &config.configTable); // TODO: Don't use this directly GBASDLEventsLoadConfig(&renderer.events, GBAConfigGetInput(&config));
context.overrides = &config.configTable; context.overrides = GBAConfigGetOverrides(&config);
int didFail = 0; int didFail = 0;
if (GBAThreadStart(&context)) { if (GBAThreadStart(&context)) {