Refactored main.h

removed duplicate include in main.c
This commit is contained in:
Robin Jones 2017-10-11 16:35:30 +01:00
parent 1ee7e0f2e3
commit 0c34a482e9
4 changed files with 15 additions and 65 deletions

View File

@ -75,6 +75,7 @@ u8 evd_SPI(u8 dat);
void evd_mmcSetDmaSwap(u8 state);
u8 evd_mmcReadToCart(u32 cart_addr, u32 len);
void evd_ulockRegs(void);
void evd_lockRegs();
u16 evd_readReg(u8 reg);
void evd_writeReg(u8 reg, u16 val);

View File

@ -4,68 +4,21 @@
// See LICENSE file in the project root for full license information.
//
//protos maybe some aren't necessary any longer
void PI_DMAWait(void);
void evd_writeReg(u8 reg, u16 val);
//TODO: some of these should probably be includes not protos in main
void bootRom(display_context_t disp, int silent);
void loadrom(display_context_t disp, u8 *buff, int fast);
void loadgbrom(display_context_t disp, u8 *buff);
void view_mpk_file(display_context_t disp, char *mpk_filename);
char TranslateNotes( char *bNote, char *Text );
inline char CountBlocks( char *bMemPakBinary, char *aNoteSizes );
void view_mpk(display_context_t disp);
void evd_ulockRegs(void);
u8 fatReadCluster(void *dst);
u8 fatGetNextCluster(u32 *cluster);
u8 fatSkipCluster();
void memRomWrite32(u32 addr, u32 val);
u32 memRomRead32(u32 addr);
uint32_t translate_color(char *hexstring);
void evd_init(void);
void memSpiSetDma(u8 mode);
u16 evd_getFirmVersion(void);
u8 evd_isSDMode(void);
void dma_write_s(void * ram_address, unsigned long pi_address, unsigned long len);
void dma_read_s(void * ram_address, unsigned long pi_address, unsigned long len);
void readSDcard(display_context_t disp, char *directory);
int readConfigFile(void);
//void readCheatFile(display_context_t disp);
int readCheatFile(char *filename, u32 *cheat_lists[2]);
static int configHandler(void* user, const char* section, const char* name, const char* value);
int saveTypeToSd(display_context_t disp, char* save_filename ,int tpye);
int saveTypeFromSd(display_context_t disp, char* rom_name, int stype);
int backupSaveData(display_context_t disp);
void romInfoScreen(display_context_t disp, u8 *buff, int silent);
int saveTypeToSd(display_context_t disp, char* save_filename ,int type);
void checksum_sdram(void);
void drawShortInfoBox(display_context_t disp, char* text, u8 mode);
void drawToplistSelection(display_context_t disp,int l);
//boxes
void drawBox(short x, short y, short width, short height, display_context_t disp);
void drawBoxNumber(display_context_t disp, int box);
void printText(char *msg, int x, int y, display_context_t dcon);
void sleep(unsigned long int ms);
void clearScreen(display_context_t disp);
//mp3
void start_mp3(char *fname, long long *samples, int *rate, int *channels);
//character input functions
void drawTextInput(display_context_t disp,char *msg);
void drawInputAdd(display_context_t disp, char *msg);
void drawInputDel(display_context_t disp);
void readRomConfig(display_context_t disp, char* short_filename, char* full_filename);
void alterRomConfig(int type, int mode);
void drawConfigSelection(display_context_t disp,int l);
void drawRomConfigBox(display_context_t disp,int line);
#define MAX_LIST 20
#define REG_VER 11
#define ED_CFG_SDRAM_ON 0
#define ishexchar(c) (((c >= '0') && (c <= '9')) || ((c >= 'A') && (c <= 'F')) || ((c >= 'a') && (c <= 'f')))
//#define ishexchar(c) (((c >= '0') && (c <= '9')) || ((c >= 'A') && (c <= 'F')) || ((c >= 'a') && (c <= 'f')))
/**
* @brief Return the uncached memory address of a cached address
@ -75,7 +28,7 @@ void drawRomConfigBox(display_context_t disp,int line);
*uint32_t
* @return The uncached address
*/
#define UNCACHED_ADDR(x) ((void *)(((uint32_t)(x)) | 0xA0000000))
//#define UNCACHED_ADDR(x) ((void *)(((uint32_t)(x)) | 0xA0000000))
/**
* @brief Align a memory address to 16 byte offset
@ -85,4 +38,4 @@ void drawRomConfigBox(display_context_t disp,int line);
*
* @return An aligned address guaranteed to be >= the unaligned address
*/
#define ALIGN_16BYTE(x) ((void *)(((uint32_t)(x)+15) & 0xFFFFFFF0))
//#define ALIGN_16BYTE(x) ((void *)(((uint32_t)(x)+15) & 0xFFFFFFF0))

View File

@ -18,7 +18,6 @@
#include "types.h"
#include "sys.h"
#include "everdrive.h"
#include "everdrive.h"
//filesystem
#include "disk.h"
@ -44,6 +43,8 @@
// YAML parser
#include <yaml.h>
#include "mem.h"
#ifdef USE_TRUETYPE
#define STB_TRUETYPE_IMPLEMENTATION
#include "stb_truetype.h"
@ -853,9 +854,7 @@ void updateFirmware(char *filename)
//everdrive init functions
void configure()
{
u16 tv;
u16 msg = 0;
u16 sd_mode = 0;
u8 buff[16];
u16 firm;
@ -868,11 +867,6 @@ void configure()
firm = evd_readReg(REG_VER); //TODO: why not just use evd_getFirmVersion()
if (streql("ED64 SD boot", buff, 12) && firm >= 0x0116)
{
sd_mode = 1;
}
if (firm >= 0x0200)
{
sleep(1);
@ -906,7 +900,7 @@ void configure()
evd_setCfgBit(ED_CFG_SDRAM_ON, 1);
}
if (sd_mode) //TODO: can this be moved before the firmware is loaded?
if (streql("ED64 SD boot", buff, 12) && firm >= 0x0116) //TODO: can this be moved before the firmware is loaded?
{
diskSetInterface(DISK_IFACE_SD);
}
@ -1580,7 +1574,7 @@ char TranslateNotes(char *bNote, char *Text)
#pragma warning(disable : 4305 4309)
char cReturn = 0x00;
const char aSpecial[] = {0x21, 0x22, 0x23, 0x60, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x3A, 0x3D, 0x3F, 0x40, 0x74, 0xA9, 0xAE};
// { '!' , '\"', '#' , '`' , '*' , '+' , ',' , '-' , '.' , '/' , ':' , '=' , '?' , '>' , 'tm', '(r)','(c)' };
// { '!' , '\"', '#' , '`' , '*' , '+' , ',' , '-' , '.' , '/' , ':' , '=' , '?' , '>' , 'tm', '(r)','(c)' };
#pragma warning(default : 4305 4309)
int i = 16;
do

View File

@ -123,6 +123,8 @@ void dma_write_sram(void* src, u32 offset, u32 size) {
}
//TODO: look at https://github.com/mamedev/mame/blob/master/3rdparty/zlib/crc32.c
#define DO1(buf) crc = crc_table[((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8);
#define DO2(buf) DO1(buf); DO1(buf);
#define DO4(buf) DO2(buf); DO2(buf);