Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- After looking over Pedra's mob struct information, etc I managed to find the one that controls platforms.
- Using this, it's possible to make your own "Active" or "Live" pvac that doesn't require .wz edits or a CRC bypass (by directly modifying the structure).
- The platform structure works as a linked list just like the mob structure, as follows:
- GMS 0.62:
- 0x978138[0x88] = firstplatform+0x10 (just like mob structure).
- Code:
- platformlist:
- 0 = seh or template address
- 4 = nextplatformlist (is a ptr)
- 8 = previousplatformlist (is a ptr)
- ...
- 10 = ep of the base ptr (if is first platform in list)
- 14 = platformdata
- 18 = sizeof(struct)
- platformdata:
- 0 = seh or template address
- ...
- c = left boundary of platform
- 10 = top boundary of platform
- 14 = right boundary of platform
- 18 = bottom boundary of platform
- ...
- 30 = an unknown "double byte value"
- 38 = an unknown "double byte value"
- 40 = an unknown "double byte value"
- 48 = the .wz platformID of the platform
- 4c = nextplatformdata (follows .wz defintions, is a ptr)
- 50 = previousplatformdata (follows .wz defintions, is a ptr)
- ...
- 80 = sizeof(struct)
- Code:
- struct platdata {
- unsigned template1;
- unsigned unknown2;
- unsigned unknown3;
- unsigned left;
- unsigned top;
- unsigned right;
- unsigned bottom;
- unsigned unknown8;
- unsigned unknown9;
- unsigned unknown10;
- unsigned unknown11;
- unsigned unknown12;
- double unknown13;
- double unknown14;
- double unknown15;
- unsigned platformid;
- platdata* next;
- platdata* previous;
- unsigned unknown19;
- unsigned unknown20;
- unsigned unknown21;
- unsigned unknown22;
- unsigned unknown23;
- unsigned unknown24;
- unsigned unknown25;
- unsigned unknown26;
- unsigned unknown27;
- unsigned unknown28;
- unsigned unknown29;
- unsigned size;
- };
- struct platlist {
- unsigned template1;
- platlist* next;
- platlist* previous;
- unsigned template2;
- unsigned unknown;
- platdata* data;
- unsigned size;
- };
- And functions for accessing/reading the structs:
- Code:
- unsigned platlistaddr = 0x978138;
- unsigned platlistoffset = 0x88;
- unsigned long readPointer( unsigned long addr, unsigned long offset)
- {
- if ( IsBadReadPtr( (void*) addr, 4 ) != 0 ) {
- return -1;
- }
- unsigned long *ptr = (unsigned long*) addr;
- unsigned long base = ptr[0];
- if ( IsBadReadPtr( (void*) (base+offset), 4 ) != 0 ) {
- return -1;
- }
- ptr = (unsigned long*) (base+offset);
- return ptr[0];
- }
- platlist* getPlatList() {
- unsigned platlistreal = readPointer(platlistaddr,platlistoffset);
- if(platlistreal==0)
- return NULL;
- platlistreal-=0x10;
- return (platlist*)platlistreal;
- }
- unsigned getPlatNumberFromPlatData(platdata* obj) {
- if(obj==NULL)
- return -1;
- return obj->platformid;
- }
- platdata* getPlatDataByPlatId(unsigned id) {
- platlist* thisplat = getPlatList();
- while(thisplat!=NULL) {
- if(getPlatNumberFromPlatData(thisplat->data) == id)
- return thisplat->data;
- thisplat = thisplat->next;
- }
- return NULL;
- }
- Code:
- platlist* addPlatform(platlist* original) {
- platlist* newplat = new platlist;
- memcpy(newplat,original,sizeof(platlist));
- platdata* newdata = new platdata;
- memcpy(newdata,original->data,sizeof(platdata));
- newplat->data = newdata;
- return newplat;
- }
- platlist* getFirstPlatform() {
- return getPlatList();
- }
- platlist* getLastPlatform() {
- platlist* thisplat = getPlatList();
- while(thisplat!=NULL) {
- if(thisplat->next==NULL)
- break;
- thisplat = thisplat->next;
- }
- return thisplat; //FIXED NAO
- }
- Code:
- platlist* getPlatListByPlatId(unsigned id) {
- platlist* thisplat = getPlatList();
- while(thisplat!=NULL) {
- if(thisplat->data->platformid == id)
- return thisplat;
- thisplat = thisplat->next;
- }
- return NULL;
- }
- void duplicatePlatforms() {
- platlist* lastplat = getLastPlatform();
- if(!lastplat)
- return;
- platlist* thisplat=getFirstPlatform();
- int totalplats = lastplat->data->platformid;
- int originaltotalplats = totalplats;
- platlist* firstdupedplatform = NULL;
- int curpos = 1;
- while(curpos <= originaltotalplats) {
- platlist* newplat = addPlatform(thisplat);
- if(!newplat)
- break;
- if(!firstdupedplatform)
- firstdupedplatform = newplat;
- totalplats++;
- newplat->data->platformid = totalplats;
- newplat->previous = lastplat;
- newplat->next = 0;
- lastplat->next = newplat;
- lastplat = newplat;
- thisplat = thisplat->next;
- curpos++;
- }
- //redirecting new platforms
- thisplat = firstdupedplatform;
- while(thisplat!=NULL) {
- int next = getPlatNumberFromPlatData(thisplat->data->next);
- int nextget = originaltotalplats+next;
- if(next!=-1)
- thisplat->data->next = getPlatDataByPlatId(nextget);
- int previous = getPlatNumberFromPlatData(thisplat->data->previous);
- int previousget = originaltotalplats+previous;
- if(previous!=-1)
- thisplat->data->previous = getPlatDataByPlatId(previousget);
- thisplat = thisplat->next;
- }
- //redirecting old platforms
- thisplat = getFirstPlatform();
- while(thisplat!=firstdupedplatform) {
- int next = getPlatNumberFromPlatData(thisplat->data->next);
- int nextget = originaltotalplats+next;
- if(next!=-1)
- thisplat->data->next = getPlatDataByPlatId(nextget);
- int previous = getPlatNumberFromPlatData(thisplat->data->previous);
- int previousget = originaltotalplats+previous;
- if(previous!=-1)
- thisplat->data->previous = getPlatDataByPlatId(previousget);
- thisplat = thisplat->next;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment