Commit 9c9af5e6 authored by jdgleaver's avatar jdgleaver
Browse files

- Remove usage of memory_malloc_secure()/memory_free()

- Don't compile/link unnecessary source files
parent 2f235a30
......@@ -29,7 +29,7 @@
#include "../platform/rs97/shared.h"
#endif
static uint16 *supervision_palette;
static uint16 supervision_palette[4];
uint8 gpu_regs[4];
#ifdef NDS
#define RGB555(R,G,B) ((((int)(B))<<10)|(((int)(G))<<5)|(((int)(R)))|BIT(15))
......@@ -156,7 +156,6 @@ void gpu_init(void)
printf("Gpu Init\n");
#endif
//fprintf(log_get(), "gpu: init\n");
memory_malloc_secure((void**)&supervision_palette, 4*sizeof(int16), "Palette");
}
////////////////////////////////////////////////////////////////////////////////
//
......@@ -170,7 +169,6 @@ void gpu_init(void)
void gpu_done(void)
{
//fprintf(log_get(), "gpu: done\n");
memory_free(supervision_palette);
}
////////////////////////////////////////////////////////////////////////////////
//
......
......@@ -8,7 +8,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include "io.h"
#include "log.h"
/*#include "log.h"*/
#include <stdlib.h>
#include <stdio.h>
......
......@@ -13,12 +13,12 @@
#include <stdio.h>
#include <string.h>
uint8 *memorymap_programRom;
uint8 *memorymap_lowerRam;
uint8 *memorymap_upperRam;
uint8 *memorymap_lowerRomBank;
uint8 *memorymap_upperRomBank;
uint8 *memorymap_regs;
uint8 *memorymap_programRom = NULL;
uint8 *memorymap_lowerRam = NULL;
uint8 *memorymap_upperRam = NULL;
uint8 *memorymap_lowerRomBank = NULL;
uint8 *memorymap_upperRomBank = NULL;
uint8 *memorymap_regs = NULL;
static uint32 memorymap_programRomSize;
......@@ -48,10 +48,14 @@ uint8 *memorymap_getRomPointer(void)
void memorymap_init()
{
//fprintf(log_get(), "memorymap: init\n");
memory_malloc_secure((void**)&memorymap_lowerRam, 0x2000, "Lower ram");
/*memory_malloc_secure((void**)&memorymap_lowerRam, 0x2000, "Lower ram");
memory_malloc_secure((void**)&memorymap_upperRam, 0x2000, "Upper ram");
memory_malloc_secure((void**)&memorymap_regs, 0x2000, "Internal registers");
memory_malloc_secure((void**)&memorymap_regs, 0x2000, "Internal registers");*/
memorymap_lowerRam = (uint8*)malloc(0x2000);
memorymap_upperRam = (uint8*)malloc(0x2000);
memorymap_regs = (uint8*)malloc(0x2000);
}
////////////////////////////////////////////////////////////////////////////////
//
......@@ -65,14 +69,26 @@ void memorymap_init()
void memorymap_done()
{
//fprintf(log_get(), "memorymap: done\n");
memory_free(memorymap_lowerRam);
/*memory_free(memorymap_lowerRam);
memory_free(memorymap_upperRam);
memory_free(memorymap_regs);
memory_free(memorymap_regs);*/
if (memorymap_lowerRam)
free(memorymap_lowerRam);
if (memorymap_upperRam)
free(memorymap_upperRam);
if (memorymap_regs)
free(memorymap_regs);
if (memorymap_programRom)
{
free(memorymap_programRom);
memorymap_programRom = NULL;
}
memorymap_lowerRam = NULL;
memorymap_upperRam = NULL;
memorymap_regs = NULL;
memorymap_programRom = NULL;
}
////////////////////////////////////////////////////////////////////////////////
//
......@@ -254,7 +270,8 @@ void memorymap_load(uint8 *rom, uint32 size)
uint8 *tmp = (uint8*)malloc(0x10000);
memcpy(tmp+0x0000, memorymap_programRom, 0x8000);
memcpy(tmp+0x8000, memorymap_programRom, 0x8000);
free(memorymap_programRom);
if (memorymap_programRom)
free(memorymap_programRom);
memorymap_programRom = tmp;
memorymap_programRomSize = 0x10000;
}
......
......@@ -13,9 +13,9 @@
#ifndef __SUPERVISION_H__
#define __SUPERVISION_H__
#include "log.h"
/*#include "log.h"*/
#include "types.h"
#include "memory.h"
/*#include "memory.h"*/
#include "version.h"
#include "io.h"
#include "gpu.h"
......
......@@ -13,8 +13,6 @@ SOURCES_C := \
$(CORE_SRC_DIR)/gpu.c \
$(CORE_SRC_DIR)/interrupts.c \
$(CORE_SRC_DIR)/io.c \
$(CORE_SRC_DIR)/log.c \
$(CORE_SRC_DIR)/memory.c \
$(CORE_SRC_DIR)/memorymap.c \
$(CORE_SRC_DIR)/sound.c \
$(CORE_SRC_DIR)/timer.c \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment