Created
October 11, 2016 01:31
-
-
Save toptensoftware/9d848b6ae3fb9757ddd01f6230c15792 to your computer and use it in GitHub Desktop.
Applying a chain of relocations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void ApplyRelocations(byte[] data, ushort offset, uint value, bool additive) | |
| { | |
| if (additive) | |
| { | |
| data.WriteDWord(offset, (uint)(data.ReadDWord(offset) + value)); | |
| } | |
| else | |
| { | |
| while (offset != 0xFFFF) | |
| { | |
| ushort nextOffset = data.ReadWord(offset); | |
| data.WriteDWord(offset, value); | |
| offset = nextOffset; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment