"patcher/unpatcher" for one of my Oblivion cheats. I ran into what I
believe is a bug, but I could be wrong.
My code:
- Code: Select all
void On_HK_0(DWORD dw1, DWORD dw2)
{
extern BYTE values[5] = {"", 0x006519D9};
BYTE vals[5];
vals[0] = 1;
vals[1] = 2;
vals[2] = 3;
vals[3] = 4;
vals[4] = 5;
Clear();
int i = 0;
PrintF("Test1 at 0x006519D9 %02X%02X%02X%02X%02X.", values[0], values[1], values[2], values[3], values[4]);
PrintF("Test2 at 0x006519D9 %02X%02X%02X%02X%02X.", values[5-5], values[5-4], values[5-3], values[5-2], values[5-1]);
PrintF("Test3 at 0x006519D9 %02X%02X%02X%02X%02X.", values[i+5-5], values[i+5-4], values[i+5-3], values[i+5-2], values[i+5-1]);
PrintF("Test4 at 0x006519D9 %02X%02X%02X%02X%02X.", values[i], values[i+1], values[i+2], values[i+3], values[i+4]);
PrintF("Test5 at %02X%02X%02X%02X%02X.", vals[0], vals[1], vals[2], vals[3], vals[4]);
PrintF("Test6 at %02X%02X%02X%02X%02X.", vals[i], vals[i+1], vals[i+2], vals[i+3], vals[i+4]);
for(i=0;i<5;i++)
PrintF("values[%d] = %02X;", i, values[i]);
}
And my results:
- Code: Select all
Test1 at 0x006519D9 1010101010.
Test2 at 0x006519D9 1010101010.
Test3 at 0x006519D9 7A1084DB0F.
Test4 at 0x006519D9 7A1084DB0F.
Test5 at 0102030405.
Test6 at 0102030405.
values[0] = 7A;
values[1] = 10;
values[2] = 84;
values[3] = DB;
values[4] = 0F;
As you can see in Test1 and Test 2, the second byte of the array is
repeated no matter the index. This seems to only happen when the
array is indexed without a variable in the expression.
I did not know if this was a bug or intentional, but I figured I would
post my findings.
PS.
Awesome work L. Spiro