MxPresenter::ParseExtra (#123)

* MxPresenter::ParseExtra and surrounding functions

* Named extra data is MxDSAction, added Parsed flag to enum
This commit is contained in:
MS
2023-09-13 03:44:03 -04:00
committed by GitHub
parent 3e7cb6a7a8
commit 89f66e4e0e
8 changed files with 184 additions and 33 deletions

View File

@@ -43,6 +43,42 @@ void MakeSourceName(char *, const char *)
// TODO
}
// OFFSET: LEGO1 0x100b7050
MxBool KeyValueStringParse(char *p_outputValue, char *p_key, char *p_source)
{
MxBool didMatch = FALSE;
MxS16 len = strlen(p_source);
char *temp = new char[len + 1];
strcpy(temp, p_source);
char *token = strtok(temp, ", \t\r\n:");
while (token) {
len -= (strlen(token) + 1);
if (strcmpi(token, p_key) == 0) {
if (p_outputValue && len > 0) {
char *cur = &token[strlen(p_key)];
cur++;
while (*cur != ',') {
if (*cur == ' ' || *cur == '\0' || *cur == '\t' || *cur == '\n' || *cur == '\r')
break;
*p_outputValue++ = *cur++;
}
*p_outputValue = '\0';
}
didMatch = TRUE;
break;
}
token = strtok(NULL, ", \t\r\n:");
}
delete[] temp;
return didMatch;
}
// OFFSET: LEGO1 0x100b7210
void SetOmniUserMessage(void (*p_userMsg)(const char *,int))
{