//Save existing heap to binary buffer void EmuHeap::save(Buffer &b) { unsigned int num_heaps = 0; EmuHeap *h; //count the number of heaps for (h = this; h; h = h->nextHeap) num_heaps++; b.write((char*)&num_heaps, sizeof(num_heaps)); //write all of the heaps for (h = this; h; h = h->nextHeap) { h->writeHeap(b); } }
//Save existing heap to binary buffer void EmuHeap::save(Buffer &b) { unsigned int num_heaps = 0; unsigned int magic = HEAP_MAGIC; EmuHeap *h; //count the number of heaps for (h = this; h; h = h->nextHeap) num_heaps++; //if more than one heap, then use multi-heap format if (num_heaps > 1) { b.write((char*)&magic, sizeof(magic)); b.write((char*)&num_heaps, sizeof(num_heaps)); } //write all of the heaps for (h = this; h; h = h->nextHeap) { h->writeHeap(b); } }