1
0
Fork 0
forked from len0rd/rockbox

Submit initial patch from FS#12176. Adds support for several new game music formats (AY, GBS, HES, KSS, SGC, VGM and VGZ) and replaces the current NSF and NSFE with a new implementation based on a port of the Game Music Emu library 'GME'. This first submit does not cover the full functionality provided by the author's original patch: Coleco-SGV is not supported, some GME-specific m3u-support has been removed and IRAM is not used yet. Further changes are very likely to follow this submit. Thanks to Mauricio Garrido.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30264 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Andree Buschmann 2011-08-07 20:01:04 +00:00
parent 93c6f1329a
commit acb0917556
149 changed files with 33133 additions and 4431 deletions

View file

@ -0,0 +1,86 @@
/*
Based on the wiki viewer mallocer
Copyright (C) 2005 Dave Chapman
@ Modified to decompress memory buffer by gama
*/
#include "mallocer.h"
#include "codeclib.h"
unsigned char* mallocbuffer[MEMPOOL_MAX];
long memory_ptr[MEMPOOL_MAX];
size_t buffersize[MEMPOOL_MAX];
int wpw_init_mempool(unsigned char mempool)
{
memory_ptr[mempool] = 0;
mallocbuffer[mempool] = (unsigned char *)ci->codec_get_buffer(&buffersize[mempool]);
// memset(mallocbuf[mempool], 0, bufsize[mempool]);
return 0;
}
int wpw_init_mempool_pdm(unsigned char mempool,
unsigned char* mem,long memsize)
{
memory_ptr[mempool] = 0;
mallocbuffer[mempool] = mem;
buffersize[mempool]=memsize;
return 0;
}
void wpw_reset_mempool(unsigned char mempool)
{
memory_ptr[mempool]=0;
}
void wpw_destroy_mempool(unsigned char mempool)
{
memory_ptr[mempool] = 0;
mallocbuffer[mempool] =0;
buffersize[mempool]=0;
}
long wpw_available(unsigned char mempool)
{
return buffersize[mempool]-memory_ptr[mempool];
}
void* wpw_malloc(unsigned char mempool,size_t size)
{
void* x;
if (memory_ptr[mempool] + size > buffersize[mempool] )
return NULL;
x=&mallocbuffer[mempool][memory_ptr[mempool]];
memory_ptr[mempool]+=(size+3)&~3; /* Keep memory 32-bit aligned */
return(x);
}
void* wpw_calloc(unsigned char mempool,size_t nmemb, size_t size)
{
void* x;
x = wpw_malloc(mempool,nmemb*size);
if (x == NULL)
return NULL;
memset(x,0,nmemb*size);
return(x);
}
void wpw_free(unsigned char mempool,void* ptr)
{
(void)ptr;
(void)mempool;
}
void* wpw_realloc(unsigned char mempool,void* ptr, size_t size)
{
void* x;
(void)ptr;
x = wpw_malloc(mempool,size);
return(x);
}