mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-01 00:15:14 +01:00
32 byte align some memory
This commit is contained in:
parent
b35f52367c
commit
99892a51f5
@ -65,7 +65,7 @@ devicecallback (void *arg)
|
||||
while (1)
|
||||
{
|
||||
#ifdef HW_RVL
|
||||
if(isMounted[METHOD_SD])
|
||||
/*if(isMounted[METHOD_SD])
|
||||
{
|
||||
if(!sd->isInserted()) // check if the device was removed
|
||||
{
|
||||
@ -82,11 +82,11 @@ devicecallback (void *arg)
|
||||
isMounted[METHOD_USB] = false;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
InitializeNetwork(SILENT);
|
||||
UpdateCheck();
|
||||
#else
|
||||
if(isMounted[METHOD_SD_SLOTA])
|
||||
/*if(isMounted[METHOD_SD_SLOTA])
|
||||
{
|
||||
if(!carda->isInserted()) // check if the device was removed
|
||||
{
|
||||
@ -101,7 +101,7 @@ devicecallback (void *arg)
|
||||
unmountRequired[METHOD_SD_SLOTB] = true;
|
||||
isMounted[METHOD_SD_SLOTB] = false;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
#endif
|
||||
usleep(500000); // suspend thread for 1/2 sec
|
||||
}
|
||||
@ -117,7 +117,7 @@ devicecallback (void *arg)
|
||||
void
|
||||
InitDeviceThread()
|
||||
{
|
||||
LWP_CreateThread (&devicethread, devicecallback, NULL, NULL, 0, 80);
|
||||
LWP_CreateThread (&devicethread, devicecallback, NULL, NULL, 0, 40);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -428,6 +428,9 @@ LoadFile (char * rbuffer, char *filepath, u32 length, int method, bool silent)
|
||||
|
||||
file = fopen (fullpath, "rb");
|
||||
|
||||
printf("loading %s", fullpath);
|
||||
sleep(2);
|
||||
|
||||
if (file > 0)
|
||||
{
|
||||
if(length > 0 && length <= 2048) // do a partial read (eg: to check file header)
|
||||
|
@ -14,6 +14,7 @@
|
||||
* Don't even think of opening two at the same time!
|
||||
***************************************************************************/
|
||||
|
||||
#include <malloc.h>
|
||||
#include <gccore.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -259,7 +260,7 @@ NGCUnfreezeGame (int method, bool silent)
|
||||
{
|
||||
if (offset)
|
||||
{
|
||||
char * zipbuffer = (char *)malloc(SAVEBUFFERSIZE);
|
||||
char * zipbuffer = (char *)memalign(32, SAVEBUFFERSIZE);
|
||||
memset (zipbuffer, 0, SAVEBUFFERSIZE);
|
||||
|
||||
// skip the saveicon and comment
|
||||
|
@ -9,6 +9,7 @@
|
||||
* This allows standard file calls to be replaced by memory based ones
|
||||
* With little modification required to the code
|
||||
***************************************************************************/
|
||||
#include <malloc.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@ -22,7 +23,7 @@
|
||||
***************************************************************************/
|
||||
MFILE * memfopen(char * buffer, int size)
|
||||
{
|
||||
MFILE *f = (MFILE *)malloc(sizeof(MFILE));
|
||||
MFILE *f = (MFILE *)memalign(32, sizeof(MFILE));
|
||||
|
||||
f->buffer = buffer;
|
||||
f->offset = 0;
|
||||
|
@ -11,6 +11,7 @@
|
||||
* Menu drawing routines
|
||||
***************************************************************************/
|
||||
|
||||
#include <malloc.h>
|
||||
#include <gccore.h>
|
||||
#include <ogcsys.h>
|
||||
#include <stdio.h>
|
||||
@ -314,7 +315,7 @@ unpackbackdrop ()
|
||||
int i;
|
||||
int bgSize = (screenheight * 640 * 2);
|
||||
|
||||
u32 * bgtemp = (u32 *) malloc (bgSize);
|
||||
u32 * bgtemp = (u32 *) memalign(32, bgSize);
|
||||
colour = getcolour (0x00, 0x00, 0x00);
|
||||
|
||||
/*** Fill with black for now ***/
|
||||
|
@ -289,7 +289,7 @@ InitVideoThread ()
|
||||
LWP_InitQueue (&videoblankqueue);
|
||||
|
||||
/*** Create the thread on this queue ***/
|
||||
LWP_CreateThread (&vbthread, vbgetback, NULL, vbstack, TSTACK, 150);
|
||||
LWP_CreateThread (&vbthread, vbgetback, NULL, vbstack, TSTACK, 80);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -432,7 +432,7 @@ UpdatePadsCB ()
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* MakeTexture
|
||||
* MakeTexture
|
||||
*
|
||||
* - modified for a buffer with an offset (border)
|
||||
****************************************************************************/
|
||||
@ -448,7 +448,7 @@ MakeTexture (const void *src, void *dst, s32 width, s32 height)
|
||||
" subi %4,%4,4\n"
|
||||
"2: mtctr %6\n"
|
||||
" mr %0,%5\n"
|
||||
//
|
||||
//
|
||||
"1: lwz %1,0(%5)\n" //1
|
||||
" stwu %1,8(%4)\n"
|
||||
" lwz %2,4(%5)\n" //1
|
||||
@ -583,6 +583,9 @@ InitGCVideo ()
|
||||
VIDEO_ClearFrameBuffer (vmode, xfb[1], COLOR_BLACK);
|
||||
VIDEO_SetNextFramebuffer (xfb[0]);
|
||||
|
||||
printf("\n\n\n\ttest A");
|
||||
sleep(5);
|
||||
|
||||
// video callbacks
|
||||
VIDEO_SetPostRetraceCallback ((VIRetraceCallback)UpdatePadsCB);
|
||||
VIDEO_SetPreRetraceCallback ((VIRetraceCallback)copy_to_xfb);
|
||||
@ -597,11 +600,17 @@ InitGCVideo ()
|
||||
StartGX ();
|
||||
|
||||
draw_init ();
|
||||
|
||||
|
||||
printf(" B");
|
||||
sleep(2);
|
||||
|
||||
InitLUTs(); // init LUTs for hq2x
|
||||
|
||||
InitVideoThread ();
|
||||
|
||||
printf(" C");
|
||||
sleep(2);
|
||||
|
||||
// Finally, the video is up and ready for use :)
|
||||
}
|
||||
|
||||
@ -617,7 +626,7 @@ ResetVideo_Emu ()
|
||||
Mtx44 p;
|
||||
|
||||
int i = -1;
|
||||
if (GCSettings.render == 0 || GCSettings.FilterMethod != FILTER_NONE) // original render mode or hq2x
|
||||
if (GCSettings.render == 0) // original render mode or hq2x
|
||||
{
|
||||
for (i=0; i<4; i++)
|
||||
{
|
||||
@ -625,13 +634,13 @@ ResetVideo_Emu ()
|
||||
break;
|
||||
}
|
||||
rmode = tvmodes[i];
|
||||
|
||||
|
||||
// hack to fix video output for hq2x
|
||||
if (GCSettings.FilterMethod != FILTER_NONE)
|
||||
{
|
||||
memcpy(&TV_Custom, tvmodes[i], sizeof(TV_Custom));
|
||||
rmode = &TV_Custom;
|
||||
|
||||
|
||||
rmode->fbWidth = 512;
|
||||
rmode->efbHeight *= 2;
|
||||
rmode->xfbHeight *= 2;
|
||||
@ -739,7 +748,7 @@ update_video (int width, int height)
|
||||
if ( CheckVideo && (IPPU.RenderedFramesCount != prevRenderedFrameCount) ) // if we get back from the menu, and have rendered at least 1 frame
|
||||
{
|
||||
int xscale, yscale;
|
||||
|
||||
|
||||
fscale = GetFilterScale((RenderFilter)GCSettings.FilterMethod);
|
||||
|
||||
ResetVideo_Emu (); // reset video to emulator rendering settings
|
||||
@ -795,7 +804,7 @@ update_video (int width, int height)
|
||||
}
|
||||
|
||||
// convert image to texture
|
||||
if (GCSettings.FilterMethod != FILTER_NONE)
|
||||
if (GCSettings.FilterMethod != FILTER_NONE)
|
||||
{
|
||||
FilterMethod ((uint8*) GFX.Screen, EXT_PITCH, (uint8*) filtermem, vwidth*fscale*2, vwidth, vheight);
|
||||
MakeTexture565((char *) filtermem, (char *) texturemem, vwidth*fscale, vheight*fscale);
|
||||
@ -879,6 +888,6 @@ setGFX ()
|
||||
{
|
||||
GFX.Pitch = EXT_PITCH;
|
||||
GFX.Screen = (uint16*)(snes9xgfx + EXT_OFFSET);
|
||||
|
||||
|
||||
memset (snes9xgfx, 0, sizeof(snes9xgfx));
|
||||
}
|
||||
|
@ -161,6 +161,7 @@
|
||||
|
||||
|
||||
|
||||
#include <malloc.h>
|
||||
#ifdef __DJGPP
|
||||
#include <allegro.h>
|
||||
#undef TRUE
|
||||
@ -191,7 +192,7 @@ void S9xTraceSoundDSP (const char *s, int i1 = 0, int i2 = 0, int i3 = 0,
|
||||
|
||||
bool8 S9xInitAPU ()
|
||||
{
|
||||
IAPU.RAM = (uint8 *) malloc (0x10000);
|
||||
IAPU.RAM = (uint8 *) memalign(32, 0x10000);
|
||||
|
||||
if (!IAPU.RAM)
|
||||
{
|
||||
|
@ -161,6 +161,7 @@
|
||||
|
||||
|
||||
|
||||
#include <malloc.h>
|
||||
#include "snes9x.h"
|
||||
#include "cpuexec.h"
|
||||
#include "gfx.h"
|
||||
@ -216,16 +217,16 @@ bool8 S9xGraphicsInit(){
|
||||
S9xFixColourBrightness();
|
||||
|
||||
GFX.X2=GFX.ZERO_OR_X2=GFX.ZERO=NULL;
|
||||
if(!(GFX.X2=(uint16*)malloc(sizeof(uint16)*0x10000))) goto FAIL;
|
||||
if(!(GFX.X2=(uint16*)memalign(32, sizeof(uint16)*0x10000))) goto FAIL;
|
||||
#if !defined(NEW_COLOUR_BLENDING)
|
||||
if(!(GFX.ZERO_OR_X2=(uint16*)malloc(sizeof(uint16)*0x10000))) goto FAIL;
|
||||
if(!(GFX.ZERO_OR_X2=(uint16*)memalign(32, sizeof(uint16)*0x10000))) goto FAIL;
|
||||
#endif
|
||||
if(!(GFX.ZERO=(uint16*)malloc(sizeof(uint16)*0x10000))) goto FAIL;
|
||||
if(!(GFX.ZERO=(uint16*)memalign(32, sizeof(uint16)*0x10000))) goto FAIL;
|
||||
|
||||
GFX.ScreenSize=GFX.Pitch/2*SNES_HEIGHT_EXTENDED*(Settings.SupportHiRes?2:1);
|
||||
if(!(GFX.SubScreen=(uint16*)malloc(GFX.ScreenSize*sizeof(uint16)))) goto FAIL;
|
||||
if(!(GFX.ZBuffer=(uint8*)malloc(GFX.ScreenSize))) goto FAIL;
|
||||
if(!(GFX.SubZBuffer=(uint8*)malloc(GFX.ScreenSize))) goto FAIL;
|
||||
if(!(GFX.SubScreen=(uint16*)memalign(32, GFX.ScreenSize*sizeof(uint16)))) goto FAIL;
|
||||
if(!(GFX.ZBuffer=(uint8*)memalign(32, GFX.ScreenSize))) goto FAIL;
|
||||
if(!(GFX.SubZBuffer=(uint8*)memalign(32, GFX.ScreenSize))) goto FAIL;
|
||||
|
||||
uint32 r, g, b;
|
||||
/* Lookup table for color addition */
|
||||
|
@ -160,6 +160,7 @@
|
||||
|
||||
|
||||
|
||||
#include <malloc.h>
|
||||
#include <numeric>
|
||||
|
||||
#include <string.h>
|
||||
@ -326,7 +327,7 @@ static void S9xDeinterleaveType1 (int size, uint8 *base)
|
||||
blocks[i * 2 + 1] = i;
|
||||
}
|
||||
|
||||
uint8 *tmp = (uint8 *) malloc(0x8000);
|
||||
uint8 *tmp = (uint8 *) memalign(32, 0x8000);
|
||||
if (tmp)
|
||||
{
|
||||
for (int i = 0; i < nblocks * 2; i++)
|
||||
@ -370,7 +371,7 @@ static void S9xDeinterleaveType2 (int size, uint8 *base)
|
||||
for (int i = 0; i < nblocks * 2; i++)
|
||||
blocks[i] = (i & ~0xf) | ((i & 3) << 2) | ((i & 12) >> 2);
|
||||
|
||||
uint8 *tmp = (uint8 *) malloc(0x10000);
|
||||
uint8 *tmp = (uint8 *) memalign(32, 0x10000);
|
||||
if (tmp)
|
||||
{
|
||||
for (int i = 0; i < nblocks * 2; i++)
|
||||
@ -406,7 +407,7 @@ static void S9xDeinterleaveGD24 (int size, uint8 *base)
|
||||
SET_UI_COLOR(0, 255, 255);
|
||||
}
|
||||
|
||||
uint8 *tmp = (uint8 *) malloc(0x80000);
|
||||
uint8 *tmp = (uint8 *) memalign(32, 0x80000);
|
||||
if (tmp)
|
||||
{
|
||||
memmove(tmp, &base[0x180000], 0x80000);
|
||||
@ -424,26 +425,26 @@ static void S9xDeinterleaveGD24 (int size, uint8 *base)
|
||||
|
||||
bool8 CMemory::Init (void)
|
||||
{
|
||||
RAM = (uint8 *) malloc(0x20000);
|
||||
SRAM = (uint8 *) malloc(0x20000);
|
||||
VRAM = (uint8 *) malloc(0x10000);
|
||||
ROM = (uint8 *) malloc(MAX_ROM_SIZE + 0x200 + 0x8000);
|
||||
RAM = (uint8 *) memalign(32, 0x20000);
|
||||
SRAM = (uint8 *) memalign(32, 0x20000);
|
||||
VRAM = (uint8 *) memalign(32, 0x10000);
|
||||
ROM = (uint8 *) memalign(32, MAX_ROM_SIZE + 0x200 + 0x8000);
|
||||
|
||||
IPPU.TileCache[TILE_2BIT] = (uint8 *) malloc(MAX_2BIT_TILES * 64);
|
||||
IPPU.TileCache[TILE_4BIT] = (uint8 *) malloc(MAX_4BIT_TILES * 64);
|
||||
IPPU.TileCache[TILE_8BIT] = (uint8 *) malloc(MAX_8BIT_TILES * 64);
|
||||
IPPU.TileCache[TILE_2BIT_EVEN] = (uint8 *) malloc(MAX_2BIT_TILES * 64);
|
||||
IPPU.TileCache[TILE_2BIT_ODD] = (uint8 *) malloc(MAX_2BIT_TILES * 64);
|
||||
IPPU.TileCache[TILE_4BIT_EVEN] = (uint8 *) malloc(MAX_4BIT_TILES * 64);
|
||||
IPPU.TileCache[TILE_4BIT_ODD] = (uint8 *) malloc(MAX_4BIT_TILES * 64);
|
||||
IPPU.TileCache[TILE_2BIT] = (uint8 *) memalign(32, MAX_2BIT_TILES * 64);
|
||||
IPPU.TileCache[TILE_4BIT] = (uint8 *) memalign(32, MAX_4BIT_TILES * 64);
|
||||
IPPU.TileCache[TILE_8BIT] = (uint8 *) memalign(32, MAX_8BIT_TILES * 64);
|
||||
IPPU.TileCache[TILE_2BIT_EVEN] = (uint8 *) memalign(32, MAX_2BIT_TILES * 64);
|
||||
IPPU.TileCache[TILE_2BIT_ODD] = (uint8 *) memalign(32, MAX_2BIT_TILES * 64);
|
||||
IPPU.TileCache[TILE_4BIT_EVEN] = (uint8 *) memalign(32, MAX_4BIT_TILES * 64);
|
||||
IPPU.TileCache[TILE_4BIT_ODD] = (uint8 *) memalign(32, MAX_4BIT_TILES * 64);
|
||||
|
||||
IPPU.TileCached[TILE_2BIT] = (uint8 *) malloc(MAX_2BIT_TILES);
|
||||
IPPU.TileCached[TILE_4BIT] = (uint8 *) malloc(MAX_4BIT_TILES);
|
||||
IPPU.TileCached[TILE_8BIT] = (uint8 *) malloc(MAX_8BIT_TILES);
|
||||
IPPU.TileCached[TILE_2BIT_EVEN] = (uint8 *) malloc(MAX_2BIT_TILES);
|
||||
IPPU.TileCached[TILE_2BIT_ODD] = (uint8 *) malloc(MAX_2BIT_TILES);
|
||||
IPPU.TileCached[TILE_4BIT_EVEN] = (uint8 *) malloc(MAX_4BIT_TILES);
|
||||
IPPU.TileCached[TILE_4BIT_ODD] = (uint8 *) malloc(MAX_4BIT_TILES);
|
||||
IPPU.TileCached[TILE_2BIT] = (uint8 *) memalign(32, MAX_2BIT_TILES);
|
||||
IPPU.TileCached[TILE_4BIT] = (uint8 *) memalign(32, MAX_4BIT_TILES);
|
||||
IPPU.TileCached[TILE_8BIT] = (uint8 *) memalign(32, MAX_8BIT_TILES);
|
||||
IPPU.TileCached[TILE_2BIT_EVEN] = (uint8 *) memalign(32, MAX_2BIT_TILES);
|
||||
IPPU.TileCached[TILE_2BIT_ODD] = (uint8 *) memalign(32, MAX_2BIT_TILES);
|
||||
IPPU.TileCached[TILE_4BIT_EVEN] = (uint8 *) memalign(32, MAX_4BIT_TILES);
|
||||
IPPU.TileCached[TILE_4BIT_ODD] = (uint8 *) memalign(32, MAX_4BIT_TILES);
|
||||
|
||||
if (!RAM || !SRAM || !VRAM || !ROM ||
|
||||
!IPPU.TileCache[TILE_2BIT] ||
|
||||
@ -975,7 +976,7 @@ again:
|
||||
|
||||
if (tales)
|
||||
{
|
||||
uint8 *tmp = (uint8 *) malloc(CalculatedSize - 0x400000);
|
||||
uint8 *tmp = (uint8 *) memalign(32, CalculatedSize - 0x400000);
|
||||
if (tmp)
|
||||
{
|
||||
S9xMessage(S9X_INFO, S9X_ROM_INTERLEAVED_INFO, "Fixing swapped ExHiROM...");
|
||||
@ -1587,7 +1588,7 @@ char * CMemory::Safe (const char *s)
|
||||
free(safe);
|
||||
|
||||
safe_len = len + 1;
|
||||
safe = (char *) malloc(safe_len);
|
||||
safe = (char *) memalign(32, safe_len);
|
||||
}
|
||||
|
||||
for (int i = 0; i < len; i++)
|
||||
@ -1626,7 +1627,7 @@ char * CMemory::SafeANK (const char *s)
|
||||
free(safe);
|
||||
|
||||
safe_len = len + 1;
|
||||
safe = (char *) malloc(safe_len);
|
||||
safe = (char *) memalign(32, safe_len);
|
||||
}
|
||||
|
||||
for (int i = 0; i < len; i++)
|
||||
|
Loading…
Reference in New Issue
Block a user