mirror of https://github.com/mgba-emu/mgba.git
Test: Actually add CInema core config loading
This commit is contained in:
parent
e1bd52a3d0
commit
469f2d9940
|
@ -303,7 +303,36 @@ bool CInemaConfigGetUInt(struct Table* configTree, const char* testName, const c
|
||||||
|
|
||||||
void CInemaConfigLoad(struct Table* configTree, const char* testName, struct mCore* core) {
|
void CInemaConfigLoad(struct Table* configTree, const char* testName, struct mCore* core) {
|
||||||
_loadConfigTree(configTree, testName);
|
_loadConfigTree(configTree, testName);
|
||||||
// TODO: Write
|
|
||||||
|
char testKey[MAX_TEST] = {0};
|
||||||
|
char* keyEnd = testKey;
|
||||||
|
const char* pos;
|
||||||
|
while (true) {
|
||||||
|
pos = strchr(testName, '.');
|
||||||
|
size_t maxlen = sizeof(testKey) - (keyEnd - testKey) - 1;
|
||||||
|
size_t len;
|
||||||
|
if (pos) {
|
||||||
|
len = pos - testName;
|
||||||
|
} else {
|
||||||
|
len = strlen(testName);
|
||||||
|
}
|
||||||
|
if (len > maxlen) {
|
||||||
|
len = maxlen;
|
||||||
|
}
|
||||||
|
strncpy(keyEnd, testName, len);
|
||||||
|
keyEnd += len;
|
||||||
|
|
||||||
|
struct mCoreConfig* config = HashTableLookup(configTree, testKey);
|
||||||
|
if (config) {
|
||||||
|
core->loadConfig(core, config);
|
||||||
|
}
|
||||||
|
if (!pos) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
testName = pos + 1;
|
||||||
|
keyEnd[0] = '.';
|
||||||
|
++keyEnd;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CInemaTestInit(struct CInemaTest* test, const char* directory, const char* filename) {
|
bool CInemaTestInit(struct CInemaTest* test, const char* directory, const char* filename) {
|
||||||
|
|
Loading…
Reference in New Issue