mirror of
https://github.com/ApacheThunder/GBA-Exploader.git
synced 2025-06-18 19:45:39 -04:00

* Can now use gbaframes specific to a gba rom being loaded to ram/flash. Have a bmp file with filename matching the game rom being flashed in GBA_SIGN path. If it finds a matching BMP it will use that before falling back to the default gbaframe.bmp paths. * nds-bootstrap now used for booting retail NDS roms from file browser. Note that currently GBA-Exploader does not create new save files so only games with existing save files (currently hardcoded to GBA_SAV path like with GBA games) can be booted with this.
81 lines
1.1 KiB
C
81 lines
1.1 KiB
C
/*
|
|
include licence stuff?
|
|
|
|
see dynamicArray for licence...
|
|
*/
|
|
|
|
|
|
#include <nds/arm9/dynamicArray.h>
|
|
|
|
|
|
void* DynamicArrayInit(DynamicArray* v, unsigned int initialSize)
|
|
{
|
|
if(v == NULL)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
v->cur_size = initialSize;
|
|
v->data = (void**)malloc(sizeof(void*) * initialSize);
|
|
|
|
return v->data;
|
|
}
|
|
|
|
|
|
|
|
void DynamicArrayDelete(DynamicArray* v)
|
|
{
|
|
if(v == NULL)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if(v->data != NULL)
|
|
{
|
|
free(v->data);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void* DynamicArrayGet(DynamicArray* v, unsigned int index)
|
|
{
|
|
if(v == NULL)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
if(index >= v->cur_size)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
return v->data[index];
|
|
}
|
|
|
|
|
|
|
|
bool DynamicArraySet(DynamicArray *v, unsigned int index, void* item)
|
|
{
|
|
if(v == NULL)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
if(index >= v->cur_size)
|
|
{
|
|
//resize the array, making sure it is bigger than index.
|
|
unsigned int newSize = (v->cur_size * 2 > index ? v->cur_size * 2: index + 1);
|
|
|
|
void** temp = (void**)realloc(v->data, sizeof(void*) * newSize);
|
|
|
|
if(temp == NULL) return false;
|
|
v->data = temp;
|
|
memset(v->data + v->cur_size, 0, sizeof(void*) * (newSize - v->cur_size));
|
|
v->cur_size = newSize;
|
|
}
|
|
|
|
v->data[index] = item;
|
|
return true;
|
|
}
|