fix typos in addons and make functions is static (thanks xrmx)

This commit is contained in:
mtabachenko 2009-01-23 10:09:09 +00:00
parent f9d81fcd0d
commit dd167055b2
6 changed files with 118 additions and 100 deletions

View File

@ -2,6 +2,7 @@
yopyop156@ifrance.com yopyop156@ifrance.com
yopyop156.ifrance.com yopyop156.ifrance.com
Copyright (C) 2009 CrazyMax
Copyright (C) 2009 DeSmuME team Copyright (C) 2009 DeSmuME team
This file is part of DeSmuME This file is part of DeSmuME
@ -18,7 +19,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "addons.h" #include "addons.h"

View File

@ -1,24 +1,25 @@
/* Copyright (C) 2006 yopyop /* Copyright (C) 2006 yopyop
yopyop156@ifrance.com yopyop156@ifrance.com
yopyop156.ifrance.com yopyop156.ifrance.com
Copyright (C) 2009 DeSmuME team Copyright (C) 2009 CrazyMax
Copyright (C) 2009 DeSmuME team
This file is part of DeSmuME
This file is part of DeSmuME
DeSmuME is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by DeSmuME is free software; you can redistribute it and/or modify
the Free Software Foundation; either version 2 of the License, or it under the terms of the GNU General Public License as published by
(at your option) any later version. the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of DeSmuME is distributed in the hope that it will be useful,
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software You should have received a copy of the GNU General Public License
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef __ADDONS_H__ #ifndef __ADDONS_H__

View File

@ -2,6 +2,8 @@
yopyop156@ifrance.com yopyop156@ifrance.com
yopyop156.ifrance.com yopyop156.ifrance.com
Copyright (C) 2006 Mic
Copyright (C) 2009 CrazyMax
Copyright (C) 2009 DeSmuME team Copyright (C) 2009 DeSmuME team
This file is part of DeSmuME This file is part of DeSmuME
@ -18,16 +20,13 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "../addons.h" #include "../addons.h"
#include <string.h> #include <string.h>
#ifdef EXPERIMENTAL_GBASLOT #ifdef EXPERIMENTAL_GBASLOT
#define DEBUG
#define CFLASHDEBUG
#include "debug.h" #include "debug.h"
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
@ -508,7 +507,7 @@ static BOOL cflash_build_fat( void)
return TRUE; return TRUE;
} }
BOOL cflash_init() static BOOL cflash_init()
{ {
if (inited) return FALSE; if (inited) return FALSE;
BOOL init_good = FALSE; BOOL init_good = FALSE;
@ -666,7 +665,7 @@ static u16 fread_buffered(int dirent,u32 cluster,u32 offset)
return freadBuffer[(offset-bufferStart)>>1]; return freadBuffer[(offset-bufferStart)>>1];
} }
unsigned int cflash_read(unsigned int address) static unsigned int cflash_read(unsigned int address)
{ {
unsigned int ret_value = 0; unsigned int ret_value = 0;
size_t elems_read = 0; size_t elems_read = 0;
@ -817,7 +816,7 @@ unsigned int cflash_read(unsigned int address)
return ret_value; return ret_value;
} }
void cflash_write(unsigned int address,unsigned int data) static void cflash_write(unsigned int address,unsigned int data)
{ {
static u8 sector_data[512]; static u8 sector_data[512];
static u32 sector_write_index = 0; static u32 sector_write_index = 0;
@ -904,7 +903,7 @@ void cflash_write(unsigned int address,unsigned int data)
} }
} }
void cflash_close( void) static void cflash_close( void)
{ {
if (!inited) return; if (!inited) return;
if (!CFlashUsePath) if (!CFlashUsePath)
@ -944,73 +943,75 @@ void cflash_close( void)
inited = FALSE; inited = FALSE;
} }
BOOL CFlash_init(void) static BOOL CFlash_init(void)
{ {
CFlashUseRomPath = TRUE; CFlashUseRomPath = TRUE;
CFlashUsePath = TRUE; CFlashUsePath = TRUE;
return TRUE; return TRUE;
} }
void CFlash_reset(void) static void CFlash_reset(void)
{ {
cflash_close(); cflash_close();
cflash_init(); cflash_init();
} }
void CFlash_close(void)
static void CFlash_close(void)
{ {
cflash_close(); cflash_close();
} }
void CFlash_config(void)
static void CFlash_config(void)
{ {
} }
void CFlash_write08(u32 adr, u8 val) static void CFlash_write08(u32 adr, u8 val)
{ {
cflash_write(adr, val); cflash_write(adr, val);
} }
void CFlash_write16(u32 adr, u16 val) static void CFlash_write16(u32 adr, u16 val)
{ {
cflash_write(adr, val); cflash_write(adr, val);
} }
void CFlash_write32(u32 adr, u32 val) static void CFlash_write32(u32 adr, u32 val)
{ {
cflash_write(adr, val); cflash_write(adr, val);
} }
u8 CFlash_read08(u32 adr) static u8 CFlash_read08(u32 adr)
{ {
return (cflash_read(adr)); return (cflash_read(adr));
} }
u16 CFlash_read16(u32 adr) static u16 CFlash_read16(u32 adr)
{ {
return (cflash_read(adr)); return (cflash_read(adr));
} }
u32 CFlash_read32(u32 adr) static u32 CFlash_read32(u32 adr)
{ {
return (cflash_read(adr)); return (cflash_read(adr));
} }
void CFlash_info(char *info) static void CFlash_info(char *info)
{ {
strcpy(info, "Compact Flash memory in slot"); strcpy(info, "Compact Flash memory in slot");
} }
#else #else
BOOL CFlash_init(void) { return TRUE; } static BOOL CFlash_init(void) { return TRUE; }
void CFlash_reset(void) {} static void CFlash_reset(void) {}
void CFlash_close(void) {} static void CFlash_close(void) {}
void CFlash_config(void){} static void CFlash_config(void){}
void CFlash_write08(u32 adr, u8 val){} static void CFlash_write08(u32 adr, u8 val){}
void CFlash_write16(u32 adr, u16 val){} static void CFlash_write16(u32 adr, u16 val){}
void CFlash_write32(u32 adr, u32 val){} static void CFlash_write32(u32 adr, u32 val){}
u8 CFlash_read08(u32 adr){return (0);} static u8 CFlash_read08(u32 adr){return (0);}
u16 CFlash_read16(u32 adr){return (0);} static u16 CFlash_read16(u32 adr){return (0);}
u32 CFlash_read32(u32 adr){return (0);} static u32 CFlash_read32(u32 adr){return (0);}
void CFlash_info(char *info) static void CFlash_info(char *info)
{ {
strcpy(info, "Compact Flash memory in slot"); strcpy(info, "Compact Flash memory in slot");
} }
@ -1030,5 +1031,4 @@ ADDONINTERFACE addonCFlash = {
CFlash_read32, CFlash_read32,
CFlash_info}; CFlash_info};
#undef DEBUG
#undef CFLASHDEBUG #undef CFLASHDEBUG

View File

@ -2,6 +2,7 @@
yopyop156@ifrance.com yopyop156@ifrance.com
yopyop156.ifrance.com yopyop156.ifrance.com
Copyright (C) 2009 CrazyMax
Copyright (C) 2009 DeSmuME team Copyright (C) 2009 DeSmuME team
This file is part of DeSmuME This file is part of DeSmuME
@ -18,7 +19,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "../addons.h" #include "../addons.h"
@ -26,14 +27,15 @@
#include <string.h> #include <string.h>
#include "../MMU.h" #include "../MMU.h"
u8 *GBArom = NULL; static u8 *GBArom = NULL;
BOOL GBAgame_init(void) static BOOL GBAgame_init(void)
{ {
GBArom = new u8 [32 * 1024 * 1024]; GBArom = new u8 [32 * 1024 * 1024];
return (TRUE); return (TRUE);
}; }
void GBAgame_reset(void)
static void GBAgame_reset(void)
{ {
memset(GBArom, 0, 32 * 1024 * 1024); memset(GBArom, 0, 32 * 1024 * 1024);
@ -54,41 +56,50 @@ void GBAgame_reset(void)
} }
fclose(fgame); fclose(fgame);
}; }
void GBAgame_close(void)
static void GBAgame_close(void)
{ {
if (GBArom) if (GBArom)
{ {
delete [] GBArom; delete [] GBArom;
GBArom = NULL; GBArom = NULL;
} }
}; }
void GBAgame_config(void) {}
void GBAgame_write08(u32 adr, u8 val){} static void GBAgame_config(void) {}
void GBAgame_write16(u32 adr, u16 val) {} static void GBAgame_write08(u32 adr, u8 val){}
void GBAgame_write32(u32 adr, u32 val) {} static void GBAgame_write16(u32 adr, u16 val) {}
u8 GBAgame_read08(u32 adr) static void GBAgame_write32(u32 adr, u32 val) {}
static u8 GBAgame_read08(u32 adr)
{ {
//INFO("Read08 at 0x%08X value 0x%02X\n", adr, (u8)T1ReadByte(GBArom, (adr - 0x08000000))); //INFO("Read08 at 0x%08X value 0x%02X\n", adr, (u8)T1ReadByte(GBArom, (adr - 0x08000000)));
if ( (adr >= 0x08000004) && (adr < 0x080000A0) ) if ( (adr >= 0x08000004) && (adr < 0x080000A0) )
return MMU.MMU_MEM[0][0xFF][(adr +0x1C) & MMU.MMU_MASK[0][0xFF]]; return MMU.MMU_MEM[0][0xFF][(adr +0x1C) & MMU.MMU_MASK[0][0xFF]];
return (u8)T1ReadByte(GBArom, (adr - 0x08000000)); return (u8)T1ReadByte(GBArom, (adr - 0x08000000));
} }
u16 GBAgame_read16(u32 adr)
static u16 GBAgame_read16(u32 adr)
{ {
//INFO("Read16 at 0x%08X value 0x%04X\n", adr, (u16)T1ReadWord(GBArom, (adr - 0x08000000))); //INFO("Read16 at 0x%08X value 0x%04X\n", adr, (u16)T1ReadWord(GBArom, (adr - 0x08000000)));
if ( (adr >= 0x08000004) && (adr < 0x080000A0) ) if ( (adr >= 0x08000004) && (adr < 0x080000A0) )
return T1ReadWord(MMU.MMU_MEM[0][0xFF], (adr +0x1C) & MMU.MMU_MASK[0][0xFF]); return T1ReadWord(MMU.MMU_MEM[0][0xFF], (adr +0x1C) & MMU.MMU_MASK[0][0xFF]);
return (u16)T1ReadWord(GBArom, (adr - 0x08000000)); return (u16)T1ReadWord(GBArom, (adr - 0x08000000));
} }
u32 GBAgame_read32(u32 adr)
static u32 GBAgame_read32(u32 adr)
{ {
//INFO("Read32 at 0x%08X value 0x%08X\n", adr, (u32)T1ReadLong(GBArom, (adr - 0x08000000))); //INFO("Read32 at 0x%08X value 0x%08X\n", adr, (u32)T1ReadLong(GBArom, (adr - 0x08000000)));
if ( (adr >= 0x08000004) && (adr < 0x080000A0) ) if ( (adr >= 0x08000004) && (adr < 0x080000A0) )
return T1ReadLong(MMU.MMU_MEM[0][0xFF], (adr +0x1C) & MMU.MMU_MASK[0][0xFF]); return T1ReadLong(MMU.MMU_MEM[0][0xFF], (adr +0x1C) & MMU.MMU_MASK[0][0xFF]);
return (u32)T1ReadLong(GBArom, (adr - 0x08000000)); return (u32)T1ReadLong(GBArom, (adr - 0x08000000));
} }
void GBAgame_info(char *info) { strcpy(info, "GBA game in slot"); };
static void GBAgame_info(char *info)
{
strcpy(info, "GBA game in slot");
}
ADDONINTERFACE addonGBAgame = { ADDONINTERFACE addonGBAgame = {
"GBA game", "GBA game",

View File

@ -2,6 +2,7 @@
yopyop156@ifrance.com yopyop156@ifrance.com
yopyop156.ifrance.com yopyop156.ifrance.com
Copyright (C) 2009 CrazyMax
Copyright (C) 2009 DeSmuME team Copyright (C) 2009 DeSmuME team
This file is part of DeSmuME This file is part of DeSmuME
@ -18,23 +19,23 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "../addons.h" #include "../addons.h"
#include <string.h> #include <string.h>
BOOL None_init(void) { return (TRUE); }; static BOOL None_init(void) { return (TRUE); }
void None_reset(void) {}; static void None_reset(void) {}
void None_close(void) {}; static void None_close(void) {}
void None_config(void) {}; static void None_config(void) {}
void None_write08(u32 adr, u8 val) {}; static void None_write08(u32 adr, u8 val) {}
void None_write16(u32 adr, u16 val) {}; static void None_write16(u32 adr, u16 val) {}
void None_write32(u32 adr, u32 val) {}; static void None_write32(u32 adr, u32 val) {}
u8 None_read08(u32 adr){ return (0); }; static u8 None_read08(u32 adr){ return (0); }
u16 None_read16(u32 adr){ return (0); }; static u16 None_read16(u32 adr){ return (0); }
u32 None_read32(u32 adr){ return (0); }; static u32 None_read32(u32 adr){ return (0); }
void None_info(char *info) { strcpy(info, "Nothing in GBA slot"); }; static void None_info(char *info) { strcpy(info, "Nothing in GBA slot"); }
ADDONINTERFACE addonNone = { ADDONINTERFACE addonNone = {
"NONE", "NONE",

View File

@ -2,6 +2,7 @@
yopyop156@ifrance.com yopyop156@ifrance.com
yopyop156.ifrance.com yopyop156.ifrance.com
Copyright (C) 2009 CrazyMax
Copyright (C) 2009 DeSmuME team Copyright (C) 2009 DeSmuME team
This file is part of DeSmuME This file is part of DeSmuME
@ -18,7 +19,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "../addons.h" #include "../addons.h"
@ -28,21 +29,21 @@
void (*FeedbackON)(BOOL enable) = NULL; void (*FeedbackON)(BOOL enable) = NULL;
BOOL RumblePak_init(void) { return (TRUE); }; static BOOL RumblePak_init(void) { return (TRUE); }
void RumblePak_reset(void) static void RumblePak_reset(void)
{ {
}; }
void RumblePak_close(void) {}; static void RumblePak_close(void) {}
void RumblePak_config(void) {}; static void RumblePak_config(void) {}
void RumblePak_write08(u32 adr, u8 val) static void RumblePak_write08(u32 adr, u8 val)
{ {
}; }
void RumblePak_write16(u32 adr, u16 val) static void RumblePak_write16(u32 adr, u16 val)
{ {
if (!FeedbackON) return; if (!FeedbackON) return;
@ -52,31 +53,34 @@ void RumblePak_write16(u32 adr, u16 val)
FeedbackON(val); FeedbackON(val);
if (adr == 0x08001000) if (adr == 0x08001000)
FeedbackON(val); FeedbackON(val);
}; }
void RumblePak_write32(u32 adr, u32 val) static void RumblePak_write32(u32 adr, u32 val)
{ {
}; }
u8 RumblePak_read08(u32 adr) static u8 RumblePak_read08(u32 adr)
{ {
return (0); return (0);
}; }
u16 RumblePak_read16(u32 adr) static u16 RumblePak_read16(u32 adr)
{ {
u16 val = ( (adr & 0x1FFFF) >> 1 ) & 0xFFFD; u16 val = ( (adr & 0x1FFFF) >> 1 ) & 0xFFFD;
if (adr == 0x0801FFFE) val = 0x005D; // hack!!! anybody have docs for RumblePak? if (adr == 0x0801FFFE) val = 0x005D; // hack!!! anybody have docs for RumblePak?
return ((u16)val); return ((u16)val);
}; }
u32 RumblePak_read32(u32 adr) static u32 RumblePak_read32(u32 adr)
{ {
return (0); return (0);
}; }
void RumblePak_info(char *info) { strcpy(info, "NDS Rumble Pak (need joystick)"); }; static void RumblePak_info(char *info)
{
strcpy(info, "NDS Rumble Pak (need joystick with Feedback)");
}
ADDONINTERFACE addonRumblePak = { ADDONINTERFACE addonRumblePak = {
"Rumble Pak", "Rumble Pak",