@@ -13,12 +13,12 @@ HandleType_t g_MemoryPatchType = 0;
1313void ByteVectorRead (ByteVector &vec, uint8_t * mem, size_t count) {
1414 vec.clear ();
1515 for (size_t i = 0 ; i < count; i++) {
16- vec.append (mem[i]);
16+ vec.push_back (mem[i]);
1717 }
1818}
1919
2020void ByteVectorWrite (ByteVector &vec, uint8_t * mem) {
21- for (size_t i = 0 ; i < vec.length (); i++) {
21+ for (size_t i = 0 ; i < vec.size (); i++) {
2222 mem[i] = vec[i];
2323 }
2424}
@@ -27,38 +27,38 @@ class MemoryPatch {
2727public:
2828 MemoryPatch (uintptr_t pAddress, const MemPatchGameConfig::MemoryPatchInfo& info) {
2929 for (auto bit : info.vecPatch ) {
30- this ->vecPatch .append (bit);
30+ this ->vecPatch .push_back (bit);
3131 }
3232 for (auto bit : info.vecVerify ) {
33- this ->vecVerify .append (bit);
33+ this ->vecVerify .push_back (bit);
3434 }
3535 for (auto bit : info.vecPreserve ) {
36- this ->vecPreserve .append (bit);
36+ this ->vecPreserve .push_back (bit);
3737 }
3838
3939 // ignore offset if address is bad
4040 this ->pAddress = pAddress ? pAddress + (info.offset ) : 0 ;
4141 }
4242
4343 bool Enable () {
44- if (vecRestore.length () > 0 ) {
44+ if (vecRestore.size () > 0 ) {
4545 // already patched, disregard
4646 return false ;
4747 }
4848
4949 if (!this ->Verify ()) {
5050 return false ;
5151 }
52- ByteVectorRead (vecRestore, (uint8_t *) pAddress, vecPatch.length ());
52+ ByteVectorRead (vecRestore, (uint8_t *) pAddress, vecPatch.size ());
5353
54- SourceHook::SetMemAccess ((void *) this ->pAddress , vecPatch.length () * sizeof (uint8_t ),
54+ SourceHook::SetMemAccess ((void *) this ->pAddress , vecPatch.size () * sizeof (uint8_t ),
5555 SH_MEM_READ | SH_MEM_WRITE | SH_MEM_EXEC);
5656 ByteVectorWrite (vecPatch, (uint8_t *) pAddress);
5757
5858 //
59- for (size_t i = 0 ; i < vecPatch.length (); i++) {
59+ for (size_t i = 0 ; i < vecPatch.size (); i++) {
6060 uint8_t preserveBits = 0 ;
61- if (i < vecPreserve.length ()) {
61+ if (i < vecPreserve.size ()) {
6262 preserveBits = vecPreserve[i];
6363 }
6464 *((uint8_t *) pAddress + i) = (vecPatch[i] & ~preserveBits) | (vecRestore[i] & preserveBits);
@@ -68,7 +68,7 @@ class MemoryPatch {
6868 }
6969
7070 void Disable () {
71- if (vecRestore.length () == 0 ) {
71+ if (vecRestore.size () == 0 ) {
7272 // no memory to restore, fug
7373 return ;
7474 }
@@ -82,7 +82,7 @@ class MemoryPatch {
8282 }
8383
8484 auto addr = (uint8_t *) pAddress;
85- for (size_t i = 0 ; i < this ->vecVerify .length (); i++) {
85+ for (size_t i = 0 ; i < this ->vecVerify .size (); i++) {
8686 if (vecVerify[i] != ' *' && vecVerify[i] != addr[i]) {
8787 return false ;
8888 }
@@ -129,8 +129,8 @@ cell_t sm_MemoryPatchLoadFromConfig(IPluginContext *pContext, const cell_t *para
129129 }
130130
131131 void * addr;
132- if (!pConfig->GetMemSig (info.signature .chars (), &addr)) {
133- return pContext->ThrowNativeError (" Failed to locate signature for '%s' (mempatch '%s')" , info.signature .chars (), name);
132+ if (!pConfig->GetMemSig (info.signature .c_str (), &addr)) {
133+ return pContext->ThrowNativeError (" Failed to locate signature for '%s' (mempatch '%s')" , info.signature .c_str (), name);
134134 }
135135
136136 MemoryPatch *pMemoryPatch = new MemoryPatch ((uintptr_t ) addr, info);
0 commit comments