#include "fcram.h"
void *fcram_temp = (void *)0x23000000;
+
+void *fcram_static_mem = (void*)FCRAM_STATIC_ALLOC_LOC;
+void *static_allocate(size_t bytes) {
+ size_t aligned_bytes = bytes + (4 - (bytes % 4)); // Align to integer size (for ARM processor)
+ void *ret = fcram_static_mem;
+ fcram_static_mem += aligned_bytes;
+ return ret;
+}
// It provides an easy overview of all that is used.
#include <stdint.h>
+#include <stddef.h>
#include "../std/unused.h"
// Path that the menu for chains will be at
#define FCRAM_CHAIN_LOC (FCRAM_FONT_LOC + FCRAM_SPACING)
+// Location to perform static allocations at.
+#define FCRAM_STATIC_ALLOC_LOC (0x25000000)
+
+// Allocate static memory.
+void *static_allocate(size_t bytes);
+
#endif
if (PDN_MPCORE_CFG == 7)
is_n3ds = 1; // Enable n3ds specific options.
+ std_init();
+
int c = fmount();
screen_init();
clear_bg();
static unsigned int top_cursor_x = 0, top_cursor_y = 0;
static unsigned int bottom_cursor_x = 0, bottom_cursor_y = 0;
+#define LOG_BUFFER_SIZE 4096
+
static size_t log_size = 0;
-static char log_buffer[4096]; // Log buffer.
+static char* log_buffer; // Log buffer.
unsigned int font_w = 8;
unsigned int font_h = 8;
static unsigned int text_bottom_width = 20;
static unsigned int text_bottom_height = 10;
-uint8_t top_bg[TOP_SIZE];
-uint8_t bottom_bg[BOTTOM_SIZE];
+uint8_t *top_bg;
+uint8_t *bottom_bg;
+
+void std_init() {
+ top_bg = static_allocate(TOP_SIZE);
+ bottom_bg = static_allocate(BOTTOM_SIZE);
+ log_buffer = static_allocate(LOG_BUFFER_SIZE);
+}
static uint32_t colors[16] = {
0x000000, // Black
if(!config.options[OPTION_SAVE_LOGS])
return;
- if (force == 0 && log_size < sizeof(log_buffer)-1)
+ if (force == 0 && log_size < LOG_BUFFER_SIZE-1)
return;
if (log_size == 0)
void rect(void* channel, int x, int y, int x2, int y2, uint8_t color);
void fill_line(void* channel, int y, uint8_t color);
+void std_init();
+
void clear_bg();
void load_bg_top(char* fname_top);
void load_bg_bottom(char* fname_bottom);
static FATFS fs;
-static FILE files[MAX_FILES_OPEN];
+FILE files[MAX_FILES_OPEN];
// This function is based on PathDeleteWorker from GodMode9.
// It was easier to just import it.