32 byte align some memory

This commit is contained in:
dborth 2009-02-07 00:57:39 +00:00
parent 399b36963d
commit 0b7703a85f
3 changed files with 10 additions and 7 deletions

View File

@ -17,6 +17,7 @@
#include <ogc/system.h> #include <ogc/system.h>
#include <fat.h> #include <fat.h>
#include <wiiuse/wpad.h> #include <wiiuse/wpad.h>
#include <malloc.h>
#include "fceugx.h" #include "fceugx.h"
#include "fceuconfig.h" #include "fceuconfig.h"
@ -224,7 +225,7 @@ int main(int argc, char *argv[])
#endif #endif
// allocate memory to store rom // 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 ***/ /*** Minimal Emulation Loop ***/
if ( !FCEUI_Initialize() ) if ( !FCEUI_Initialize() )

View File

@ -15,6 +15,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <malloc.h>
extern "C" { extern "C" {
#include "types.h" #include "types.h"
@ -62,12 +63,12 @@ static void MakeFCEUFile(char * membuffer, int length)
fceufp = NULL; fceufp = NULL;
} }
fceufp =(FCEUFILE *)malloc(sizeof(FCEUFILE)); fceufp =(FCEUFILE *)memalign(32,sizeof(FCEUFILE));
fceufp->type=3; fceufp->type=3;
fceumem = (MEMWRAP *)malloc(sizeof(MEMWRAP)); fceumem = (MEMWRAP *)memalign(32,sizeof(MEMWRAP));
fceumem->location=0; fceumem->location=0;
fceumem->size=length; fceumem->size=length;
fceuFileData = (unsigned char *)malloc(length); fceuFileData = (unsigned char *)memalign(32,length);
memcpy(fceuFileData, membuffer, length); memcpy(fceuFileData, membuffer, length);
fceumem->data=fceuFileData; fceumem->data=fceuFileData;
fceufp->fp = fceumem; fceufp->fp = fceumem;
@ -79,7 +80,7 @@ int GCMemROM(int method, int size)
/*** Allocate and clear GameInfo ***/ /*** Allocate and clear GameInfo ***/
FCEUGameInfo = (FCEUGI *)malloc(sizeof(FCEUGI)); FCEUGameInfo = (FCEUGI *)memalign(32,sizeof(FCEUGI));
memset(FCEUGameInfo, 0, sizeof(FCEUGI)); memset(FCEUGameInfo, 0, sizeof(FCEUGI));
/*** Set some default values ***/ /*** Set some default values ***/
@ -115,7 +116,7 @@ int GCMemROM(int method, int size)
if(FDSBIOS[1] == 0) if(FDSBIOS[1] == 0)
{ {
int biosSize = 0; int biosSize = 0;
char * tmpbuffer = (char *)malloc(64 * 1024); char * tmpbuffer = (char *)memalign(32,64 * 1024);
char filepath[1024]; char filepath[1024];

View File

@ -12,6 +12,7 @@
#include <network.h> #include <network.h>
#include <smb.h> #include <smb.h>
#include <mxml.h> #include <mxml.h>
#include <malloc.h>
#include "unzip.h" #include "unzip.h"
#include "miniunz.h" #include "miniunz.h"
@ -45,7 +46,7 @@ void UpdateCheck()
snprintf(url, 128, "http://fceugc.googlecode.com/svn/trunk/update.xml"); 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); memset(tmpbuffer, 0, 32768);
retval = http_request(url, NULL, tmpbuffer, 32768); retval = http_request(url, NULL, tmpbuffer, 32768);
memset(url, 0, 128); memset(url, 0, 128);