mirror of https://github.com/mgba-emu/mgba.git
3DS: Initialize ROM buffer and filesystem in lib
This commit is contained in:
parent
8fd14f40c0
commit
9c030fb553
|
@ -20,6 +20,12 @@
|
|||
*/
|
||||
|
||||
#include <3ds/types.h>
|
||||
#include <3ds/srv.h>
|
||||
#include <3ds/gfx.h>
|
||||
#include <3ds/sdmc.h>
|
||||
#include <3ds/services/apt.h>
|
||||
#include <3ds/services/fs.h>
|
||||
#include <3ds/services/hid.h>
|
||||
#include <3ds/svc.h>
|
||||
|
||||
#include "util/common.h"
|
||||
|
@ -33,10 +39,15 @@ extern u32 __ctru_linear_heap_size;
|
|||
static u32 __custom_heap_size = 0x02400000;
|
||||
static u32 __custom_linear_heap_size = 0x01400000;
|
||||
|
||||
uint32_t* romBuffer;
|
||||
uint32_t* romBuffer = NULL;
|
||||
size_t romBufferSize;
|
||||
|
||||
FS_Archive sdmcArchive;
|
||||
|
||||
bool allocateRomBuffer(void) {
|
||||
if (romBuffer) {
|
||||
return true;
|
||||
}
|
||||
romBuffer = malloc(0x02000000);
|
||||
if (romBuffer) {
|
||||
romBufferSize = 0x02000000;
|
||||
|
@ -66,3 +77,16 @@ void __system_allocateHeaps() {
|
|||
fake_heap_start = (char*)__ctru_heap;
|
||||
fake_heap_end = fake_heap_start + __ctru_heap_size;
|
||||
}
|
||||
|
||||
void __appInit(void) {
|
||||
// Initialize services
|
||||
srvInit();
|
||||
aptInit();
|
||||
hidInit();
|
||||
|
||||
fsInit();
|
||||
sdmcInit();
|
||||
|
||||
FSUSER_OpenArchive(&sdmcArchive, ARCHIVE_SDMC, fsMakePath(PATH_EMPTY, ""));
|
||||
allocateRomBuffer();
|
||||
}
|
||||
|
|
|
@ -56,8 +56,6 @@ static enum DarkenMode {
|
|||
#define AUDIO_SAMPLE_BUFFER (AUDIO_SAMPLES * 16)
|
||||
#define DSP_BUFFERS 4
|
||||
|
||||
FS_Archive sdmcArchive;
|
||||
|
||||
static struct GBA3DSRotationSource {
|
||||
struct mRotationSource d;
|
||||
accelVector accel;
|
||||
|
@ -725,8 +723,6 @@ int main() {
|
|||
NULL, 0, NULL, 0);
|
||||
gspWaitForPSC0();
|
||||
|
||||
FSUSER_OpenArchive(&sdmcArchive, ARCHIVE_SDMC, fsMakePath(PATH_EMPTY, ""));
|
||||
|
||||
struct GUIFont* font = GUIFontCreate();
|
||||
|
||||
if (!font) {
|
||||
|
|
|
@ -69,7 +69,6 @@ int main(int argc, char** argv) {
|
|||
if (!allocateRomBuffer()) {
|
||||
return 1;
|
||||
}
|
||||
FSUSER_OpenArchive(&sdmcArchive, ARCHIVE_SDMC, fsMakePath(PATH_EMPTY, ""));
|
||||
#else
|
||||
signal(SIGINT, _mPerfShutdown);
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue