| 22 | namespace dmGameObject |
| 23 | { |
| 24 | void PatchBytes(uint8_t* bytes, uint32_t bytes_size, const uint8_t* delta, uint32_t delta_size) |
| 25 | { |
| 26 | uint32_t i = 0; |
| 27 | while (i < delta_size) { |
| 28 | // get the index |
| 29 | uint32_t index = delta[i++]; |
| 30 | if (bytes_size >= (1 << 24)) |
| 31 | { |
| 32 | index += ((delta[i++]) << 8); |
| 33 | index += ((delta[i++]) << 16); |
| 34 | index += ((delta[i++]) << 24); |
| 35 | } |
| 36 | else if (bytes_size >= (1 << 16)) |
| 37 | { |
| 38 | index += ((delta[i++]) << 8); |
| 39 | index += ((delta[i++]) << 16); |
| 40 | } |
| 41 | else if (bytes_size >= (1 << 8)) |
| 42 | { |
| 43 | index += ((delta[i++]) << 8); |
| 44 | } |
| 45 | |
| 46 | // get the number of consecutive bytes of changes |
| 47 | uint32_t count = delta[i++]; |
| 48 | while (count-- > 0) |
| 49 | { |
| 50 | // apply the delta to the bytes |
| 51 | bytes[index++] = delta[i++]; |
| 52 | } |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | void PatchLuaBytecode(dmLuaDDF::LuaSource *source) |
| 57 | { |
no outgoing calls