-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathPatchManager.cpp
30 lines (29 loc) · 1.2 KB
/
PatchManager.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "basetypes.h"
#include "PatchManager.h"
void PatchManager::ApplyPatches()
{
for(uint32 i = 0; i < numPatches; i++)
{
switch(patchData[i].patchType)
{
case PatchType::PatchType_Rel8:
*((uint8 *)(patchData[i].patchPtr)) = (uint8)(labelPointers[patchData[i].destLabel] - patchData[i].basePtr);
break;
case PatchType::PatchType_Rel16:
*((uint16 *)(patchData[i].patchPtr)) = (uint16)(labelPointers[patchData[i].destLabel] - patchData[i].basePtr);
break;
case PatchType::PatchType_Rel32:
*((uint32 *)(patchData[i].patchPtr)) = (uint32)(labelPointers[patchData[i].destLabel] - patchData[i].basePtr);
break;
case PatchType::PatchType_Rel64:
//*((uint64 *)(patchData[i].patchPtr)) = (uint64)(labelPointers[patchData[i].destLabel] - patchData[i].basePtr);
break;
case PatchType::PatchType_Abs32:
*((uint32 *)(patchData[i].patchPtr)) = (uint32)(labelPointers[patchData[i].destLabel]); //!! 64bit prob?
break;
case PatchType::PatchType_Abs64:
//*((uint64 *)(patchData[i].patchPtr)) = (uint32)(labelPointers[patchData[i].destLabel]);
break;
}
}
}