PatchMapIt _add(const int eTag) { PatchMapIns insPatch = patch.insert(PatchMapVal(eTag, PatchDataListIt())); if(insPatch.second) { insPatch.first->second = patchData.insert(patchData.end(), PatchData(eTag)); } return insPatch.first; }
bool PatchCode(unsigned int address, void *data, int length) { if (PatchData(address, data, length) == false) { return false; } if (FlushInstructionCache(GetCurrentProcess(), (void *)address, length) == FALSE) { return false; } return true; }
/* void Print(int x,int y,char h,char v,char string[]); void ScreenAufbau(void); void DisplayPatch(void); void GetPatch(void); void Choose64(void); void PatchData(void); void PatchSuchen(); */ void Patches(void) { long L,l,n,ll; /* int i,k,pepe,k2,k3,Arg; */ int i,pepe,k2,k3; unsigned char Taste; Texes=1; Print(18,10,5,15," ����������������������������������������Ŀ "); Print(18,11,5,15," � Reading Texture Resources... � "); Print(18,12,5,15," ������������������������������������������ "); Print(27,22,0,15," "); for (i=0;i<PNames;i++) PName[i].UsedInTex=999; l=Entry->RStart; fseek(f,l,0); _read(fileno(f),&n,4); TEntries=(int)n; for (L=0;L<n;L++) { i=(int)L; _read(fileno(f),&ll,4); TEntry[i].TStart=ll+l; } for (i=0;i<TEntries;i++) { fseek(f,TEntry[i].TStart,0); _read(fileno(f),&TEntry[i].TName,8); TEntry[i].TName[8]=0; _read(fileno(f),Puffer,12); _read(fileno(f),&pepe,2); _read(fileno(f),Puffer,4); for (k2=0;k2<pepe;k2++) { _read(fileno(f),&k3,2); _read(fileno(f),Puffer,8); PName[k3].UsedInTex=i; } } ScreenAufbau(); DisplayPatch(); for(;;) { Taste=getch(); if (Taste==27) break; if (Taste==73) { TPos-=21; if (TPos<0) { TPos=0; TCPos=2; } DisplayPatch(); Taste=0; } if (Taste==81) { TPos+=21; if (TPos>n-22) { TPos=(int)n-22; TCPos=23; } DisplayPatch(); Taste=0; } if (Taste==72 && TCPos==2 && TPos>0) { TPos--; DisplayPatch(); Taste=0; } if (Taste==80 && TCPos==23) { TPos++; if (TPos>n-22) TPos=(int)n-22; DisplayPatch(); Taste=0; } if (Taste==72 && TCPos==2 && TPos==0) Taste=0; if (Taste==80) { TCPos++; DisplayPatch(); Taste=0; } if (Taste==72) { TCPos--; DisplayPatch(); Taste=0; } if (Taste==79) { TPos=(int)n-22; TCPos=23; DisplayPatch(); } if (Taste==71) { TPos=0; TCPos=2; DisplayPatch(); } if (Taste==13) GetPatch(); if (Taste==60) Choose64(); if (Taste==59) PatchData(); if ( ((Taste>94 && Taste<123) || (Taste>32 && Taste<58)) && SPos<8) { SuchStr[SPos]=Taste; SuchStr[SPos+1]=0; Print(27,22,0,15," "); Print(27,22,0,15,SuchStr); SPos++; if (SPos>0) PatchSuchen(); } if (Taste==8 && SPos>0) { SPos--; SuchStr[SPos]=0; Print(27,22,0,15," "); Print(27,22,0,15,SuchStr); if (SPos>0) PatchSuchen(); } } SuchStr[0]=0; SPos=0; Texes=0; ScreenAufbau(); Display(); }