Permalink
Browse files

Merge pull request #7 from LunaMoo/cheats

Fix 0x6 code types
  • Loading branch information...
unknownbrackets committed Nov 9, 2017
2 parents bf4f5a1 + 34b1cb7 commit 0ed62cfe3059edc97d14f5005bfe0df7a032e096
Showing with 3 additions and 3 deletions.
  1. +3 −3 Core/CwCheat.cpp
View
@@ -495,18 +495,18 @@ CheatOperation CWCheatEngine::InterpretNextCwCheat(const CheatCode &cheat, size_
addr = GetAddress(line1.part1 & 0x0FFFFFFF);
if (i < cheat.lines.size()) {
const CheatLine &line2 = cheat.lines[i++];
const int count = line1.part1 & 0xFFFF;
const int count = line2.part1 & 0xFFFF;
// Doesn't have enough lines to process.
if (i + count > cheat.lines.size())
if (i - 1 + count > cheat.lines.size())
return { CheatOp::Invalid };
CheatOperation op = { CheatOp::CwCheatPointerCommands, addr, 0, arg };
op.pointerCommands.offset = (int)line2.part2;
// TODO: Verify sign handling. Is this really supposed to sign extend?
op.pointerCommands.baseOffset = ((int)line2.part1 >> 20) * 4;
op.pointerCommands.count = count;
op.pointerCommands.type = (line1.part1 >> 16) & 0xF;
op.pointerCommands.type = (line2.part1 >> 16) & 0xF;
return op;
}
return { CheatOp::Invalid };

0 comments on commit 0ed62cf

Please sign in to comment.