mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 19:45:20 +00:00
rsx: Fix rare crash in vertex program decompiler
- This whole decompiler mess needs a rewrite
This commit is contained in:
parent
cfc124fabf
commit
01fe39fbb9
1 changed files with 6 additions and 5 deletions
|
@ -362,14 +362,13 @@ std::string VertexProgramDecompiler::NotZeroPositive(const std::string& code)
|
|||
std::string VertexProgramDecompiler::BuildCode()
|
||||
{
|
||||
std::string main_body;
|
||||
for (uint i = 0, lvl = 1; i < m_instr_count; i++)
|
||||
for (int i = 0, lvl = 1; i < static_cast<int>(m_instr_count); i++)
|
||||
{
|
||||
lvl -= m_instructions[i].close_scopes;
|
||||
if (lvl < 1) lvl = 1;
|
||||
lvl = std::max<int>(lvl - m_instructions[i].close_scopes, 0);
|
||||
|
||||
for (int j = 0; j < m_instructions[i].put_close_scopes; ++j)
|
||||
{
|
||||
--lvl;
|
||||
if (lvl < 1) lvl = 1;
|
||||
if (lvl > 1) --lvl;
|
||||
main_body.append(lvl, '\t') += "}\n";
|
||||
}
|
||||
|
||||
|
@ -380,6 +379,8 @@ std::string VertexProgramDecompiler::BuildCode()
|
|||
lvl++;
|
||||
}
|
||||
|
||||
ensure(lvl >= 0); // Underflow of indent level will cause crashes!!
|
||||
|
||||
for (const auto& instruction_body : m_instructions[i].body)
|
||||
{
|
||||
main_body.append(lvl, '\t') += instruction_body + "\n";
|
||||
|
|
Loading…
Add table
Reference in a new issue