mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-13 22:54:24 -04:00
fusee_cpp: implement exosphere load/configuration
This commit is contained in:
parent
1dd0297db3
commit
e0a41e9d33
8 changed files with 236 additions and 13 deletions
|
@ -49,7 +49,7 @@ namespace ams::nxboot {
|
|||
file_size = std::min(IniFileSizeMax, file_size);
|
||||
|
||||
/* Allocate memory for file. */
|
||||
char *buffer = static_cast<char *>(AllocateMemory(util::AlignUp(file_size + 1, 0x10)));
|
||||
char *buffer = static_cast<char *>(AllocateAligned(util::AlignUp(file_size + 1, 0x10), 0x10));
|
||||
buffer[file_size] = '\x00';
|
||||
|
||||
/* Read file. */
|
||||
|
@ -64,6 +64,7 @@ namespace ams::nxboot {
|
|||
SectionName,
|
||||
Key,
|
||||
KvSpace,
|
||||
KvSpace2,
|
||||
Value,
|
||||
TrailingSpace,
|
||||
};
|
||||
|
@ -120,20 +121,33 @@ namespace ams::nxboot {
|
|||
} else if (c == '=') {
|
||||
buffer[i] = '\x00';
|
||||
|
||||
val_start = buffer + i + 1;
|
||||
|
||||
state = State::Value;
|
||||
state = State::KvSpace2;
|
||||
}
|
||||
break;
|
||||
case State::KvSpace:
|
||||
if (c == '=') {
|
||||
val_start = buffer + i + 1;
|
||||
|
||||
state = State::Value;
|
||||
state = State::KvSpace2;
|
||||
} else if (!IsWhiteSpace(c)) {
|
||||
return ParseIniResult_InvalidFormat;
|
||||
}
|
||||
break;
|
||||
case State::KvSpace2:
|
||||
if (c == '\n') {
|
||||
buffer[i] = '\x00';
|
||||
|
||||
auto *entry = AllocateObject<IniKeyValueEntry>();
|
||||
entry->key = key_start;
|
||||
entry->value = buffer + i;
|
||||
|
||||
cur_sec->kv_list.push_back(*entry);
|
||||
|
||||
state = State::Newline;
|
||||
} else if (!IsWhiteSpace(c)) {
|
||||
val_start = buffer + i;
|
||||
|
||||
state = State::Value;
|
||||
}
|
||||
break;
|
||||
case State::Value:
|
||||
if (IsWhiteSpace(c) || c == '\n') {
|
||||
buffer[i] = '\x00';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue