10 for (
const auto [key, char_value] : CharEncoder) {
11 if (value == char_value) {
19 if (value <
DICTOFF || value == 0xFF) {
27 for (
const auto& text_element : TextCommands) {
28 if (text_element.ID == b) {
36 auto it = std::find_if(SpecialChars.begin(), SpecialChars.end(),
38 return text_element.ID == value;
40 if (it != SpecialChars.end()) {
49 for (
auto& textElement : TextCommands) {
50 match = textElement.MatchMe(str);
51 if (match.size() > 0) {
52 if (textElement.HasArgument) {
54 std::stoi(match[1].str(),
nullptr, 16));
61 const auto dictionary_element =
64 match = dictionary_element.MatchMe(str);
65 if (match.size() > 0) {
67 DICTOFF + std::stoi(match[1].str(),
nullptr, 16));
73 if (CharEncoder.contains(value)) {
74 char c = CharEncoder.at(value);
82 if (!textElement.
Empty()) {
88 if (!textElement.
Empty()) {
94 if (dictionary >= 0) {
102 std::vector<uint8_t> bytes;
103 std::string temp_string = str;
106 while (pos < temp_string.size()) {
108 if (temp_string[pos] ==
'[') {
109 int next = temp_string.find(
']', pos);
117 const auto dictionary_element =
120 if (!parsedElement.
Active) {
121 core::logf(
"Error parsing message: %s", temp_string);
123 }
else if (parsedElement.
Parent == dictionary_element) {
124 bytes.push_back(parsedElement.
Value);
126 bytes.push_back(parsedElement.
Parent.
ID);
129 bytes.push_back(parsedElement.
Value);
139 core::logf(
"Error parsing message: %s", temp_string);
149 std::vector<DictionaryEntry> AllDictionaries;
151 std::vector<uint8_t> bytes;
152 std::stringstream stringBuilder;
163 while (address < temppush_backress) {
164 uint8_t uint8_tDictionary = rom->
data()[address++];
165 bytes.push_back(uint8_tDictionary);
169 AllDictionaries.push_back(
DictionaryEntry{(uint8_t)i, stringBuilder.str()});
172 std::sort(AllDictionaries.begin(), AllDictionaries.end(),
174 return a.Contents.size() > b.Contents.size();
177 return AllDictionaries;
The Rom class is used to load, save, and modify Rom data.
uint32_t SnesToPc(uint32_t addr) noexcept
const std::string DICTIONARYTOKEN
uint8_t FindDictionaryEntry(uint8_t value)
ParsedElement FindMatchingElement(const std::string &str)
constexpr uint8_t DICTOFF
constexpr int kPointersDictionaries
std::vector< DictionaryEntry > BuildDictionaryEntries(app::Rom *rom)
uint8_t FindMatchingCharacter(char value)
TextElement FindMatchingSpecial(uint8_t value)
TextElement FindMatchingCommand(uint8_t b)
std::vector< uint8_t > ParseMessageToData(std::string str)
constexpr int kNumDictionaryEntries
std::string ParseTextDataByte(uint8_t value)