Skip to content

Commit

Permalink
Enhanced querying text from DB
Browse files Browse the repository at this point in the history
  • Loading branch information
Kimjio committed Dec 26, 2022
1 parent 924cc89 commit 20ce0a4
Showing 1 changed file with 44 additions and 2 deletions.
46 changes: 44 additions & 2 deletions src/hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,27 @@ namespace
auto stmt = text_queries.at(pStmt);
if (stmt)
{
stmt->executeStep();
if (stmt->getQuery().find("`race_jikkyo_message`;") != string::npos)
{
if (replacement_queries_can_next.find(pStmt) == replacement_queries_can_next.end())
{
replacement_queries_can_next.emplace(pStmt, true);
}
if (replacement_queries_can_next.at(pStmt))
{
try
{
stmt->executeStep();
}
catch (exception& e)
{
}
}
}
else
{
stmt->executeStep();
}
}
}
catch (exception& e)
Expand Down Expand Up @@ -611,7 +631,24 @@ namespace
text = stmt->getColumn(idx).getString();
if (!text.empty())
{
if (stmt->getQuery().find("character_system_text") != string::npos)
if (stmt->getQuery().find("`race_jikkyo_message`;") != string::npos)
{
int id = query_getint(_this, 0);
int id1 = stmt->getColumn(0).getInt();
if (stmt->hasRow())
{
if (id == id1)
{
replacement_queries_can_next.insert_or_assign(stmtPtr, true);
return il2cpp_string_new(text.data());
}
else
{
replacement_queries_can_next.insert_or_assign(stmtPtr, false);
}
}
}
else if (stmt->getQuery().find("character_system_text") != string::npos)
{
int cueId, cueId1;
if (stmt->getQuery().find("`voice_id`=?") != string::npos)
Expand Down Expand Up @@ -1366,6 +1403,11 @@ namespace
}

}
if (uobject_get_name(_this)->start_char == L"Message"s)
{
text_set_horizontalOverflow(_this, 1);
text_set_verticalOverflow(_this, 1);
}
return reinterpret_cast<decltype(on_populate_hook)*>(on_populate_orig)(_this, toFill);
}

Expand Down

0 comments on commit 20ce0a4

Please sign in to comment.