snes9xgx/source/ngc/aram.cpp
dborth 850b301978 [What Was New 003 - July 25, 2008]
- added: alphabetical file sorting
- added: background logo/backdrop + nicer menus
- added: scrolling in ROM selector
- fixed: switching between pal/ntsc ROMS doesn't mess up timings
- fixed: GC controller config works now
- fixed: freeze autoloading on ROM load
- fixed: zipped ROMS should now load in a reasonable time
- fixed: precompiled dols for autosaving to various locations (see readme)
- changed: GC default quickload slot (to sd) (thanks kerframil)
- changed: default load/save dirs are now "/snes9x/roms" and 
           "/snes9x/saves/"  (thanks kerframil)
- changed: Classic X and Y defaults aren't switched
- changed: if autosave is enabled, it doesn't ask to save SRAM 
           anymore. It is saved in the background.
- updated README
2008-10-16 01:50:21 +00:00

78 lines
1.4 KiB
C++

/****************************************************************************
* Snes9x 1.50
*
* Nintendo Gamecube Audio RAM
*
* softdev July 2006
****************************************************************************/
#include <gccore.h>
#include <string.h>
#include "aram.h"
#define ARAM_READ 1
#define ARAM_WRITE 0
#define TEMPSIZE 32768
static char tempbuffer[TEMPSIZE] ATTRIBUTE_ALIGN (32);
/**
* ARAMPut
*
* Move data from MAIN memory to ARAM
*/
void
ARAMPut (char *src, char *dst, int len)
{
DCFlushRange (src, len);
AR_StartDMA (ARAM_WRITE, (u32) src, (u32) dst, len);
while (AR_GetDMAStatus());
}
/**
* ARAMFetch
*
* This function will move data from ARAM to MAIN memory
*/
void
ARAMFetch (char *dst, char *src, int len)
{
DCInvalidateRange (dst, len);
AR_StartDMA (ARAM_READ, (u32) dst, (u32) src, len);
while (AR_GetDMAStatus ());
}
/**
* ARAMFetchSlow
*
* Required as SNES memory may NOT be 32-byte aligned
*/
void
ARAMFetchSlow (char *dst, char *src, int len)
{
int t;
if (len > TEMPSIZE)
{
t = 0;
while (t < len)
{
ARAMFetch (tempbuffer, src + t, TEMPSIZE);
if (t + TEMPSIZE > len)
{
memcpy (dst + t, tempbuffer, len - t);
}
else
memcpy (dst + t, tempbuffer, TEMPSIZE);
t += TEMPSIZE;
}
}
else
{
ARAMFetch (tempbuffer, src, len);
memcpy (dst, tempbuffer, len);
}
}