X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=snapshot.cpp;fp=snapshot.cpp;h=d2ee654dfa4b6e05cb3a965a4587d21318874c0b;hb=6f057a6bc74f3f422ffc8f8439b1b205ebef66e5;hp=b968a097b914e9692f8febd26750ad42678b44e7;hpb=6e374f54d9572c47503466e9f0063571fd9a54fa;p=drnoksnes diff --git a/snapshot.cpp b/snapshot.cpp index b968a09..d2ee654 100644 --- a/snapshot.cpp +++ b/snapshot.cpp @@ -43,12 +43,6 @@ #include #include -#if defined(__unix) || defined(__linux) || defined(__sun) || defined(__DJGPP) -#include -#include -#include -#endif - #include "snapshot.h" #include "memmap.h" #include "snes9x.h" @@ -65,8 +59,6 @@ #define dprintf(...) /* disabled */ -extern uint8 *SRAM; - #ifdef ZSNES_FX START_EXTERN_C void S9xSuperFXPreSaveState (); @@ -398,6 +390,8 @@ static STREAM ss_st; static void Freeze (); static int Unfreeze (); + +static void FreezeSnapshot (const char *name); static void FreezeStruct (const char *name, void *base, FreezeData *fields, int num_fields); static void FreezeBlock (const char *name, uint8 *block, int size); @@ -678,7 +672,7 @@ static int Unfreeze() return (SUCCESS); } -int FreezeSize (int size, int type) +static int FreezeSize (int size, int type) { switch (type) { @@ -707,8 +701,7 @@ void FreezeStruct(const char *name, void *base, FreezeData *fields, fields [i].type); } -// uint8 *block = new uint8 [len]; - uint8 *block = (uint8*)malloc(len); + uint8 *block = new uint8[len]; uint8 *ptr = block; uint16 word; uint32 dword; @@ -777,7 +770,7 @@ void FreezeStruct(const char *name, void *base, FreezeData *fields, FreezeBlock (name, block, len); - free(block); + delete block; } void FreezeBlock (const char *name, uint8 *block, int size) @@ -804,7 +797,7 @@ int UnfreezeStruct (const char *name, void *base, FreezeData *fields, fields [i].type); } - uint8 *block = (uint8*)malloc(len); + uint8 *block = new uint8 [len]; uint8 *ptr = block; uint16 word; uint32 dword; @@ -878,8 +871,8 @@ int UnfreezeStruct (const char *name, void *base, FreezeData *fields, } } -// delete block; - free(block); + delete block; + return (result); }