diff --git a/source/ngc/fceugx.cpp b/source/ngc/fceugx.cpp index 81ba11c..a3fb6a7 100644 --- a/source/ngc/fceugx.cpp +++ b/source/ngc/fceugx.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include "fceugx.h" #include "fceuconfig.h" @@ -224,7 +225,7 @@ int main(int argc, char *argv[]) #endif // allocate memory to store rom - nesrom = (unsigned char *)malloc(1024*1024*3); // 3 MB should be plenty + nesrom = (unsigned char *)memalign(32,1024*1024*3); // 3 MB should be plenty /*** Minimal Emulation Loop ***/ if ( !FCEUI_Initialize() ) diff --git a/source/ngc/fceuload.cpp b/source/ngc/fceuload.cpp index 547f154..a408c4e 100644 --- a/source/ngc/fceuload.cpp +++ b/source/ngc/fceuload.cpp @@ -15,6 +15,7 @@ #include #include #include +#include extern "C" { #include "types.h" @@ -62,12 +63,12 @@ static void MakeFCEUFile(char * membuffer, int length) fceufp = NULL; } - fceufp =(FCEUFILE *)malloc(sizeof(FCEUFILE)); + fceufp =(FCEUFILE *)memalign(32,sizeof(FCEUFILE)); fceufp->type=3; - fceumem = (MEMWRAP *)malloc(sizeof(MEMWRAP)); + fceumem = (MEMWRAP *)memalign(32,sizeof(MEMWRAP)); fceumem->location=0; fceumem->size=length; - fceuFileData = (unsigned char *)malloc(length); + fceuFileData = (unsigned char *)memalign(32,length); memcpy(fceuFileData, membuffer, length); fceumem->data=fceuFileData; fceufp->fp = fceumem; @@ -79,7 +80,7 @@ int GCMemROM(int method, int size) /*** Allocate and clear GameInfo ***/ - FCEUGameInfo = (FCEUGI *)malloc(sizeof(FCEUGI)); + FCEUGameInfo = (FCEUGI *)memalign(32,sizeof(FCEUGI)); memset(FCEUGameInfo, 0, sizeof(FCEUGI)); /*** Set some default values ***/ @@ -115,7 +116,7 @@ int GCMemROM(int method, int size) if(FDSBIOS[1] == 0) { int biosSize = 0; - char * tmpbuffer = (char *)malloc(64 * 1024); + char * tmpbuffer = (char *)memalign(32,64 * 1024); char filepath[1024]; diff --git a/source/ngc/networkop.cpp b/source/ngc/networkop.cpp index 1a5121a..9a7c71b 100644 --- a/source/ngc/networkop.cpp +++ b/source/ngc/networkop.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include "unzip.h" #include "miniunz.h" @@ -45,7 +46,7 @@ void UpdateCheck() snprintf(url, 128, "http://fceugc.googlecode.com/svn/trunk/update.xml"); - u8 * tmpbuffer = (u8 *)malloc(32768); + u8 * tmpbuffer = (u8 *)memalign(32,32768); memset(tmpbuffer, 0, 32768); retval = http_request(url, NULL, tmpbuffer, 32768); memset(url, 0, 128);