switch from C to C++, fix a few small bugs

This commit is contained in:
dborth 2009-01-25 06:53:21 +00:00
parent d4d6789a08
commit 7a84a2492e
20 changed files with 60 additions and 42 deletions

View File

@ -17,7 +17,9 @@
#include <malloc.h>
#ifdef HW_RVL
extern "C" {
#include <di/di.h>
}
#endif
#include "menudraw.h"

View File

@ -18,8 +18,6 @@
#include <fat.h>
#include <wiiuse/wpad.h>
#include "types.h"
#include "fceugx.h"
#include "fceuconfig.h"
#include "fceuload.h"
@ -35,10 +33,21 @@
#include "gcvideo.h"
#include "pad.h"
#ifdef WII_DVD
#ifdef HW_RVL
extern "C" {
#include <di/di.h>
}
#endif
extern "C" {
#include "types.h"
extern int cleanSFMDATA();
extern void PowerNES(void);
extern uint8 FDSBIOS[8192];
void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count);
}
unsigned char * nesrom = NULL;
int ConfigRequested = 0;
int ShutdownRequested = 0;
@ -49,12 +58,6 @@ int frameskip = 0;
extern bool romLoaded;
extern int cleanSFMDATA();
extern void PowerNES(void);
extern uint8 FDSBIOS[8192];
void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count);
/****************************************************************************
* Shutdown / Reboot / Exit
***************************************************************************/

View File

@ -75,5 +75,6 @@ extern int ConfigRequested;
extern int ShutdownRequested;
extern char appPath[];
extern int frameskip;
extern unsigned char * nesrom;
#endif

View File

@ -16,6 +16,7 @@
#include <stdlib.h>
#include <string.h>
extern "C" {
#include "types.h"
#include "git.h"
#include "driver.h"
@ -24,6 +25,13 @@
#include "sound.h"
#include "file.h"
extern int FDSLoad(const char *name, FCEUFILE *fp);
extern int iNESLoad(const char *name, FCEUFILE *fp);
extern int UNIFLoad(const char *name, FCEUFILE *fp);
extern int NSFLoad(FCEUFILE *fp);
extern uint8 FDSBIOS[8192];
}
#include "fceugx.h"
#include "gcaudio.h"
#include "common.h"
@ -32,7 +40,6 @@
#include "fileop.h"
#include "filesel.h"
unsigned char *nesrom;
bool romLoaded = false;
extern FCEUGI *FCEUGameInfo;
@ -66,19 +73,13 @@ static void MakeFCEUFile(char * membuffer, int length)
fceufp->fp = fceumem;
}
extern int FDSLoad(const char *name, FCEUFILE *fp);
extern int iNESLoad(const char *name, FCEUFILE *fp);
extern int UNIFLoad(const char *name, FCEUFILE *fp);
extern int NSFLoad(FCEUFILE *fp);
extern uint8 FDSBIOS[8192];
int GCMemROM(int method, int size)
{
ResetGameLoaded();
/*** Allocate and clear GameInfo ***/
FCEUGameInfo = malloc(sizeof(FCEUGI));
FCEUGameInfo = (FCEUGI *)malloc(sizeof(FCEUGI));
memset(FCEUGameInfo, 0, sizeof(FCEUGI));
/*** Set some default values ***/

View File

@ -20,17 +20,7 @@
#include <fat.h>
#include <string.h>
#include "types.h"
#include "fceu.h"
#include "ppu.h"
#include "cart.h"
#include "memory.h"
#include "x6502.h"
#include "general.h"
#include "images/saveicon.h"
#include "fceugx.h"
#include "intl.h"
#include "menudraw.h"
@ -38,10 +28,18 @@
#include "memcardop.h"
#include "fileop.h"
extern const unsigned short saveicon[1024];
extern "C" {
#include "types.h"
#include "fceu.h"
#include "ppu.h"
#include "cart.h"
#include "memory.h"
#include "x6502.h"
#include "general.h"
extern u32 iNESGameCRC32;
extern CartInfo iNESCart;
extern CartInfo UNIFCart;
}
static u32 NGCFCEU_GameSave(CartInfo *LocalHWInfo, int operation, int method)
{

View File

@ -29,6 +29,7 @@
#include "memcardop.h"
#include "fileop.h"
extern "C" {
/*** External functions ***/
extern void FCEUPPU_SaveState(void);
extern void FCEUSND_SaveState(void);
@ -45,6 +46,7 @@ extern SFORMAT FCEUCTRL_STATEINFO[];
extern SFORMAT FCEUSND_STATEINFO[];
extern SFORMAT SFMDATA[64];
extern u32 iNESGameCRC32;
}
#define RLSB 0x80000000
@ -92,7 +94,7 @@ static void memfread(void *buffer, int len)
****************************************************************************/
static int GCReadChunk(int chunkid, SFORMAT *sf)
{
int csize;
uint32 csize;
static char chunk[6];
int chunklength;
int thischunk;
@ -268,7 +270,7 @@ static int GCFCEUSS_Save(int method)
if(method == METHOD_MC_SLOTA || method == METHOD_MC_SLOTB)
{
// Copy in save icon
memfwrite(&saveicon, sizeof(saveicon));
memfwrite((void *)&saveicon, sizeof(saveicon));
totalsize += sizeof(saveicon);
// And the comments

View File

@ -15,9 +15,11 @@
#include <string.h>
#include <zlib.h>
extern "C" {
#include "../sz/7zCrc.h"
#include "../sz/7zIn.h"
#include "../sz/7zExtract.h"
}
#include "fceugx.h"
#include "dvd.h"

View File

@ -23,7 +23,9 @@
#include "menudraw.h"
#include "images/nesback.h"
extern "C" {
extern void FCEU_ResetPalette(void);
}
int FDSTimer = 0;
u32 FrameTimer = 0;
@ -68,8 +70,11 @@ static unsigned short rgb565[256]; // Texture map palette
static long long prev;
static long long now;
extern "C"
{
long long gettime();
u32 diff_usec(long long start,long long end);
}
/* New texture based scaler */
typedef struct tagcamera
@ -190,7 +195,7 @@ static GXRModeObj *tvmodes[2] = {
* change frame timings depending on whether ROM is NTSC or PAL
***************************************************************************/
static int normaldiff;
static long long normaldiff;
void setFrameTimer()
{
@ -205,7 +210,8 @@ void setFrameTimer()
static void SyncSpeed()
{
now = gettime();
while (diff_usec(prev, now) < normaldiff) now = gettime();
while (diff_usec(prev, now) < normaldiff)
now = gettime();
prev = now;
}
@ -999,7 +1005,7 @@ struct st_palettes palettes[] = {
0xe0e01e, 0xd8f878, 0xc0e890, 0x95f7c8,
0x98e0e8, 0xf8d8f8, 0x000000, 0x000000 }
},
{ "mess", "palette from the MESS NES driver",
{ "mess", "palette from MESS NES driver",
{ 0x747474, 0x24188c, 0x0000a8, 0x44009c,
0x8c0074, 0xa80010, 0xa40000, 0x7c0800,
0x402c00, 0x004400, 0x005000, 0x003c14,

View File

@ -34,6 +34,6 @@ struct st_palettes {
extern struct st_palettes palettes[];
extern int FDSSwitchRequested;
extern bool progressive;
u32 FrameTimer;
extern u32 FrameTimer;
#endif

View File

@ -38,8 +38,10 @@
#include "fceuram.h"
#include "fceuload.h"
extern "C" {
extern void ResetNES(void);
extern void PowerNES(void);
}
extern int menu;
extern bool romLoaded;

View File

@ -12,9 +12,6 @@
#include <gccore.h>
#include <wiiuse/wpad.h>
#include <math.h>
#include "driver.h"
#include "fceu.h"
#include "input.h"
#include "fceugx.h"
#include "pad.h"
@ -23,6 +20,13 @@
#include "gcvideo.h"
#include "filesel.h"
extern "C" {
#include "driver.h"
#include "fceu.h"
#include "input.h"
extern INPUTC *FCEU_InitZapper(int w);
}
extern bool romLoaded;
static uint32 JSReturn = 0;
@ -31,8 +35,6 @@ void *InputDPR;
static INPUTC *zapperdata[2];
static unsigned int myzappers[2][3];
extern INPUTC *FCEU_InitZapper(int w);
unsigned int nespadmap[11]; // Original NES controller buttons
unsigned int gcpadmap[11]; // Gamecube controller Padmap
unsigned int wmpadmap[11]; // Wiimote Padmap

View File

@ -15,14 +15,13 @@
#include <ogcsys.h>
#include <mxml.h>
#include "images/saveicon.h"
#include "menudraw.h"
#include "memcardop.h"
#include "fileop.h"
#include "fceugx.h"
#include "pad.h"
extern const unsigned short saveicon[1024];
/****************************************************************************
* Prepare Preferences Data
*