moved some util files to utils directory
This commit is contained in:
parent
ddc242cac3
commit
cd427263da
|
@ -2,19 +2,14 @@ file_list = Split("""
|
||||||
asm.cpp
|
asm.cpp
|
||||||
cart.cpp
|
cart.cpp
|
||||||
cheat.cpp
|
cheat.cpp
|
||||||
crc32.cpp
|
|
||||||
config.cpp
|
config.cpp
|
||||||
debug.cpp
|
debug.cpp
|
||||||
endian.cpp
|
|
||||||
fceu.cpp
|
fceu.cpp
|
||||||
fds.cpp
|
fds.cpp
|
||||||
file.cpp
|
file.cpp
|
||||||
filter.cpp
|
filter.cpp
|
||||||
general.cpp
|
|
||||||
ines.cpp
|
ines.cpp
|
||||||
input.cpp
|
input.cpp
|
||||||
md5.cpp
|
|
||||||
memory.cpp
|
|
||||||
netplay.cpp
|
netplay.cpp
|
||||||
nsf.cpp
|
nsf.cpp
|
||||||
palette.cpp
|
palette.cpp
|
||||||
|
@ -26,9 +21,8 @@ video.cpp
|
||||||
vsuni.cpp
|
vsuni.cpp
|
||||||
wave.cpp
|
wave.cpp
|
||||||
x6502.cpp
|
x6502.cpp
|
||||||
xstring.cpp
|
|
||||||
movie.cpp
|
movie.cpp
|
||||||
unzip.c""")
|
""")
|
||||||
|
|
||||||
subdirs = Split("""
|
subdirs = Split("""
|
||||||
boards
|
boards
|
||||||
|
@ -36,6 +30,7 @@ drivers/common
|
||||||
drivers/sdl
|
drivers/sdl
|
||||||
fir
|
fir
|
||||||
input
|
input
|
||||||
|
utils
|
||||||
mappers""")
|
mappers""")
|
||||||
#palettes
|
#palettes
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "xstring.h"
|
#include "utils/xstring.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "asm.h"
|
#include "asm.h"
|
||||||
#include "x6502.h"
|
#include "x6502.h"
|
||||||
|
@ -519,4 +519,4 @@ char *Disassemble(int addr, uint8 *opcode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
int Assemble(unsigned char *output, int addr, char *str);
|
int Assemble(unsigned char *output, int addr, char *str);
|
||||||
char *Disassemble(int addr, uint8 *opcode);
|
char *Disassemble(int addr, uint8 *opcode);
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#include "../types.h"
|
#include "../types.h"
|
||||||
|
#include "../utils/memory.h"
|
||||||
#include "../x6502.h"
|
#include "../x6502.h"
|
||||||
#include "../fceu.h"
|
#include "../fceu.h"
|
||||||
#include "../ppu.h"
|
#include "../ppu.h"
|
||||||
#include "../memory.h"
|
|
||||||
#include "../sound.h"
|
#include "../sound.h"
|
||||||
#include "../state.h"
|
#include "../state.h"
|
||||||
#include "../cart.h"
|
#include "../cart.h"
|
||||||
|
|
|
@ -30,10 +30,11 @@
|
||||||
#include "ppu.h"
|
#include "ppu.h"
|
||||||
|
|
||||||
#include "cart.h"
|
#include "cart.h"
|
||||||
#include "memory.h"
|
|
||||||
#include "x6502.h"
|
#include "x6502.h"
|
||||||
|
|
||||||
#include "general.h"
|
#include "file.h"
|
||||||
|
#include "utils/memory.h"
|
||||||
|
|
||||||
|
|
||||||
uint8 *Page[32],*VPage[8];
|
uint8 *Page[32],*VPage[8];
|
||||||
uint8 **VPageR=VPage;
|
uint8 **VPageR=VPage;
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include "x6502.h"
|
#include "x6502.h"
|
||||||
#include "cheat.h"
|
#include "cheat.h"
|
||||||
#include "fceu.h"
|
#include "fceu.h"
|
||||||
#include "general.h"
|
#include "file.h"
|
||||||
#include "cart.h"
|
#include "cart.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
|
||||||
|
|
15
src/driver.h
15
src/driver.h
|
@ -315,18 +315,21 @@ void FCEUD_CmdOpen(void);
|
||||||
|
|
||||||
//new merge-era driver routines here:
|
//new merge-era driver routines here:
|
||||||
|
|
||||||
//signals that the cpu core hit a breakpoint
|
///signals that the cpu core hit a breakpoint. this function should not return until the core is ready for the next cycle
|
||||||
//this function should not return until the core is ready for the next cycle
|
|
||||||
void FCEUD_DebugBreakpoint();
|
void FCEUD_DebugBreakpoint();
|
||||||
|
|
||||||
//the driver should log the current instruction, if it wants
|
///the driver should log the current instruction, if it wants (we should move the code in the win driver that does this to the shared area)
|
||||||
//(we should move the code in the win driver that does this to the shared area)
|
|
||||||
void FCEUD_TraceInstruction();
|
void FCEUD_TraceInstruction();
|
||||||
|
|
||||||
//the driver might should update its NTView (only used if debugging support is compiled in)
|
///the driver might should update its NTView (only used if debugging support is compiled in)
|
||||||
void FCEUD_UpdateNTView(int scanline, int drawall);
|
void FCEUD_UpdateNTView(int scanline, int drawall);
|
||||||
|
|
||||||
//the driver might should update its PPUView (only used if debugging support is compiled in)
|
///the driver might should update its PPUView (only used if debugging support is compiled in)
|
||||||
void FCEUD_UpdatePPUView(int scanline, int drawall);
|
void FCEUD_UpdatePPUView(int scanline, int drawall);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
#endif
|
||||||
|
FILE *FCEUI_UTF8fopen_C(const char *n, const char *m);
|
||||||
|
|
||||||
#endif /* __DRIVER_H_ */
|
#endif /* __DRIVER_H_ */
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../../md5.h"
|
#include "../../utils/md5.h"
|
||||||
|
|
||||||
#ifndef socklen_t
|
#ifndef socklen_t
|
||||||
#define socklen_t int
|
#define socklen_t int
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#define DIRECTINPUT_VERSION 0x700
|
#define DIRECTINPUT_VERSION 0x700
|
||||||
//#define FCEUDEF_DEBUGGER //mbg merge 7/17/06 removing conditional compiles
|
//#define FCEUDEF_DEBUGGER //mbg merge 7/17/06 removing conditional compiles
|
||||||
#include "../../types.h"
|
#include "../../types.h"
|
||||||
#include "../../general.h"
|
#include "../../file.h"
|
||||||
#include "../../driver.h"
|
#include "../../driver.h"
|
||||||
#include "../common/vidblit.h" //mbg merge 7/17/06 added
|
#include "../common/vidblit.h" //mbg merge 7/17/06 added
|
||||||
#include "../common/config.h"
|
#include "../common/config.h"
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "..\..\xstring.h"
|
#include "..\..\utils/xstring.h"
|
||||||
#include "debugger.h"
|
#include "debugger.h"
|
||||||
#include "..\..\x6502.h"
|
#include "..\..\x6502.h"
|
||||||
#include "..\..\fceu.h"
|
#include "..\..\fceu.h"
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "../../md5.h"
|
#include "../../utils/md5.h"
|
||||||
|
|
||||||
static int recv_tcpwrap(uint8 *buf, int len);
|
static int recv_tcpwrap(uint8 *buf, int len);
|
||||||
static void NetStatAdd(char *text);
|
static void NetStatAdd(char *text);
|
||||||
|
|
12
src/fceu.cpp
12
src/fceu.cpp
|
@ -28,9 +28,10 @@
|
||||||
#include "ppu.h"
|
#include "ppu.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "netplay.h"
|
#include "netplay.h"
|
||||||
#include "general.h"
|
#include "file.h"
|
||||||
#include "endian.h"
|
#include "utils/endian.h"
|
||||||
#include "memory.h"
|
#include "utils/memory.h"
|
||||||
|
#include "utils/crc32.h"
|
||||||
|
|
||||||
#include "cart.h"
|
#include "cart.h"
|
||||||
#include "nsf.h"
|
#include "nsf.h"
|
||||||
|
@ -41,10 +42,9 @@
|
||||||
#include "palette.h"
|
#include "palette.h"
|
||||||
#include "state.h"
|
#include "state.h"
|
||||||
#include "movie.h"
|
#include "movie.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "crc32.h"
|
|
||||||
#include "vsuni.h"
|
#include "vsuni.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ static int RewindStatus[4] = {0, 0, 0, 0}; //is it safe to load rewind state
|
||||||
static int RewindIndex = 0; //which rewind state we're on
|
static int RewindIndex = 0; //which rewind state we're on
|
||||||
int EnableRewind = 0; //is rewind enabled
|
int EnableRewind = 0; //is rewind enabled
|
||||||
|
|
||||||
//a wrapper for unzip.c
|
///a wrapper for unzip.c
|
||||||
extern "C" FILE *FCEUI_UTF8fopen_C(const char *n, const char *m) { return ::FCEUD_UTF8fopen(n,m); }
|
extern "C" FILE *FCEUI_UTF8fopen_C(const char *n, const char *m) { return ::FCEUD_UTF8fopen(n,m); }
|
||||||
|
|
||||||
static DECLFW(BNull)
|
static DECLFW(BNull)
|
||||||
|
|
|
@ -27,12 +27,12 @@
|
||||||
#include "fceu.h"
|
#include "fceu.h"
|
||||||
#include "fds.h"
|
#include "fds.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "general.h"
|
#include "file.h"
|
||||||
|
#include "utils/md5.h"
|
||||||
|
#include "utils/memory.h"
|
||||||
#include "state.h"
|
#include "state.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "memory.h"
|
|
||||||
#include "cart.h"
|
#include "cart.h"
|
||||||
#include "md5.h"
|
|
||||||
#include "netplay.h"
|
#include "netplay.h"
|
||||||
|
|
||||||
/* TODO: Add code to put a delay in between the time a disk is inserted
|
/* TODO: Add code to put a delay in between the time a disk is inserted
|
||||||
|
|
279
src/file.cpp
279
src/file.cpp
|
@ -21,17 +21,24 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
//#include <unistd.h> //mbg merge 7/17/06 - removed
|
#include <stdarg.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
#include "unzip.h"
|
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "endian.h"
|
#include "utils/endian.h"
|
||||||
#include "memory.h"
|
#include "utils/memory.h"
|
||||||
|
#include "utils/md5.h"
|
||||||
|
#include "utils/unzip.h"
|
||||||
|
#include "driver.h"
|
||||||
|
#include "types.h"
|
||||||
|
#include "fceu.h"
|
||||||
|
#include "state.h"
|
||||||
|
#include "movie.h"
|
||||||
#include "driver.h"
|
#include "driver.h"
|
||||||
#include "general.h"
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8 *data;
|
uint8 *data;
|
||||||
|
@ -572,3 +579,265 @@ int FCEU_fisarchive(FCEUFILE *fp)
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static char BaseDirectory[2048];
|
||||||
|
char FileBase[2048];
|
||||||
|
static char FileExt[2048]; /* Includes the . character, as in ".nes" */
|
||||||
|
|
||||||
|
static char FileBaseDirectory[2048];
|
||||||
|
|
||||||
|
void FCEUI_SetBaseDirectory(char *dir)
|
||||||
|
{
|
||||||
|
strncpy(BaseDirectory,dir,2047);
|
||||||
|
BaseDirectory[2047]=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *odirs[FCEUIOD__COUNT]={0,0,0,0,0}; // odirs, odors. ^_^
|
||||||
|
|
||||||
|
void FCEUI_SetDirOverride(int which, char *n)
|
||||||
|
{
|
||||||
|
// FCEU_PrintError("odirs[%d]=%s->%s", which, odirs[which], n);
|
||||||
|
if(which < FCEUIOD__COUNT)
|
||||||
|
odirs[which]=n;
|
||||||
|
|
||||||
|
if(FCEUGameInfo) /* Rebuild cache of present states/movies. */
|
||||||
|
{
|
||||||
|
if(which==FCEUIOD_STATE)
|
||||||
|
FCEUSS_CheckStates();
|
||||||
|
else if(which == FCEUIOD_MISC)
|
||||||
|
FCEUMOV_CheckMovies();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef HAVE_ASPRINTF
|
||||||
|
static int asprintf(char **strp, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
va_start(ap,fmt);
|
||||||
|
if(!(*strp=(char*)malloc(2048))) //mbg merge 7/17/06 cast to char*
|
||||||
|
return(0);
|
||||||
|
ret=vsnprintf(*strp,2048,fmt,ap);
|
||||||
|
va_end(ap);
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
char* FCEU_GetPath(int type)
|
||||||
|
{
|
||||||
|
char *ret=0;
|
||||||
|
switch(type)
|
||||||
|
{
|
||||||
|
case FCEUMKF_STATE:if(odirs[FCEUIOD_STATE])
|
||||||
|
ret=strdup(odirs[FCEUIOD_STATE]);
|
||||||
|
else
|
||||||
|
asprintf(&ret,"%s"PSS"movie",BaseDirectory);
|
||||||
|
break;
|
||||||
|
case FCEUMKF_MOVIE:if(odirs[FCEUIOD_MISC])
|
||||||
|
ret=strdup(odirs[FCEUIOD_MISC]);
|
||||||
|
else
|
||||||
|
asprintf(&ret,"%s"PSS"movie",BaseDirectory);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *FCEU_MakePath(int type, const char* filebase)
|
||||||
|
{
|
||||||
|
char *ret=0;
|
||||||
|
|
||||||
|
switch(type)
|
||||||
|
{
|
||||||
|
case FCEUMKF_MOVIE:if(odirs[FCEUIOD_MISC])
|
||||||
|
asprintf(&ret,"%s"PSS"%s",odirs[FCEUIOD_MISC],filebase);
|
||||||
|
else
|
||||||
|
asprintf(&ret,"%s"PSS"movie"PSS"%s",BaseDirectory,filebase);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *FCEU_MakeFName(int type, int id1, char *cd1)
|
||||||
|
{
|
||||||
|
char *ret=0;
|
||||||
|
struct stat tmpstat;
|
||||||
|
|
||||||
|
switch(type)
|
||||||
|
{
|
||||||
|
case FCEUMKF_NPTEMP: asprintf(&ret,"%s"PSS"m590plqd94fo.tmp",BaseDirectory);break;
|
||||||
|
case FCEUMKF_MOVIE:if(id1>=0)
|
||||||
|
{
|
||||||
|
if(odirs[FCEUIOD_MISC])
|
||||||
|
asprintf(&ret,"%s"PSS"%s.%d.fcm",odirs[FCEUIOD_MISC],FileBase,id1);
|
||||||
|
else
|
||||||
|
asprintf(&ret,"%s"PSS"movie"PSS"%s.%d.fcm",BaseDirectory,FileBase,id1);
|
||||||
|
if(stat(ret,&tmpstat)==-1)
|
||||||
|
{
|
||||||
|
if(odirs[FCEUIOD_MISC])
|
||||||
|
asprintf(&ret,"%s"PSS"%s.%d.fcm",odirs[FCEUIOD_MISC],FileBase,id1);
|
||||||
|
else
|
||||||
|
asprintf(&ret,"%s"PSS"movie"PSS"%s.%d.fcm",BaseDirectory,FileBase,id1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(odirs[FCEUIOD_MISC])
|
||||||
|
asprintf(&ret,"%s"PSS"%s.fcm",odirs[FCEUIOD_MISC],FileBase);
|
||||||
|
else
|
||||||
|
asprintf(&ret,"%s"PSS"movie"PSS"%s.fcm",BaseDirectory,FileBase);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case FCEUMKF_STATE:
|
||||||
|
if(odirs[FCEUIOD_STATE])
|
||||||
|
{
|
||||||
|
asprintf(&ret,"%s"PSS"%s.fc%d",odirs[FCEUIOD_STATE],FileBase,id1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
asprintf(&ret,"%s"PSS"fcs"PSS"%s.fc%d",BaseDirectory,FileBase,id1);
|
||||||
|
}
|
||||||
|
if(stat(ret,&tmpstat)==-1)
|
||||||
|
{
|
||||||
|
if(odirs[FCEUIOD_STATE])
|
||||||
|
{
|
||||||
|
asprintf(&ret,"%s"PSS"%s.fc%d",odirs[FCEUIOD_STATE],FileBase,id1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
asprintf(&ret,"%s"PSS"fcs"PSS"%s.fc%d",BaseDirectory,FileBase,id1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case FCEUMKF_SNAP:
|
||||||
|
if(FSettings.SnapName)
|
||||||
|
{
|
||||||
|
if(odirs[FCEUIOD_SNAPS])
|
||||||
|
asprintf(&ret,"%s"PSS"%s-%d.%s",odirs[FCEUIOD_SNAPS],FileBase,id1,cd1);
|
||||||
|
else
|
||||||
|
asprintf(&ret,"%s"PSS"snaps"PSS"%s-%d.%s",BaseDirectory,FileBase,id1,cd1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(odirs[FCEUIOD_SNAPS])
|
||||||
|
asprintf(&ret,"%s"PSS"%d.%s",odirs[FCEUIOD_SNAPS],id1,cd1);
|
||||||
|
else
|
||||||
|
asprintf(&ret,"%s"PSS"snaps"PSS"%d.%s",BaseDirectory,id1,cd1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case FCEUMKF_FDS:if(odirs[FCEUIOD_NV])
|
||||||
|
asprintf(&ret,"%s"PSS"%s.fds",odirs[FCEUIOD_NV],FileBase);
|
||||||
|
else
|
||||||
|
asprintf(&ret,"%s"PSS"sav"PSS"%s.fds",BaseDirectory,FileBase);
|
||||||
|
break;
|
||||||
|
case FCEUMKF_SAV:if(odirs[FCEUIOD_NV])
|
||||||
|
asprintf(&ret,"%s"PSS"%s.%s",odirs[FCEUIOD_NV],FileBase,cd1);
|
||||||
|
else
|
||||||
|
asprintf(&ret,"%s"PSS"sav"PSS"%s.%s",BaseDirectory,FileBase,cd1);
|
||||||
|
if(stat(ret,&tmpstat)==-1)
|
||||||
|
{
|
||||||
|
if(odirs[FCEUIOD_NV])
|
||||||
|
asprintf(&ret,"%s"PSS"%s.%s",odirs[FCEUIOD_NV],FileBase,cd1);
|
||||||
|
else
|
||||||
|
asprintf(&ret,"%s"PSS"sav"PSS"%s.%s",BaseDirectory,FileBase,cd1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case FCEUMKF_REWINDSTATE:
|
||||||
|
if(odirs[FCEUIOD_STATE])
|
||||||
|
{
|
||||||
|
asprintf(&ret,"%s"PSS"rewind%d.fcs",odirs[FCEUIOD_STATE],id1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
asprintf(&ret,"%s"PSS"fcs"PSS"rewind%d.fcs",BaseDirectory,id1);
|
||||||
|
}
|
||||||
|
if(stat(ret,&tmpstat)==-1)
|
||||||
|
{
|
||||||
|
if(odirs[FCEUIOD_STATE])
|
||||||
|
{
|
||||||
|
asprintf(&ret,"%s"PSS"rewind%d.fcs",odirs[FCEUIOD_STATE],id1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
asprintf(&ret,"%s"PSS"fcs"PSS"rewind%d.fcs",BaseDirectory,id1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case FCEUMKF_CHEAT:
|
||||||
|
if(odirs[FCEUIOD_CHEATS])
|
||||||
|
asprintf(&ret,"%s"PSS"%s.cht",odirs[FCEUIOD_CHEATS],FileBase);
|
||||||
|
else
|
||||||
|
asprintf(&ret,"%s"PSS"cheats"PSS"%s.cht",BaseDirectory,FileBase);
|
||||||
|
break;
|
||||||
|
case FCEUMKF_IPS: asprintf(&ret,"%s"PSS"%s%s.ips",FileBaseDirectory,FileBase,FileExt);
|
||||||
|
break;
|
||||||
|
case FCEUMKF_GGROM:asprintf(&ret,"%s"PSS"gg.rom",BaseDirectory);break;
|
||||||
|
case FCEUMKF_FDSROM:asprintf(&ret,"%s"PSS"disksys.rom",BaseDirectory);break;
|
||||||
|
case FCEUMKF_PALETTE:
|
||||||
|
if(odirs[FCEUIOD_MISC])
|
||||||
|
asprintf(&ret,"%s"PSS"%s.pal",odirs[FCEUIOD_MISC],FileBase);
|
||||||
|
else
|
||||||
|
asprintf(&ret,"%s"PSS"%s.pal",BaseDirectory,FileBase);
|
||||||
|
break;
|
||||||
|
case FCEUMKF_MOVIEGLOB:
|
||||||
|
if(odirs[FCEUIOD_MISC])
|
||||||
|
// asprintf(&ret,"%s"PSS"%s*.fcm",odirs[FCEUIOD_MISC],FileBase);
|
||||||
|
asprintf(&ret,"%s"PSS"*.???",odirs[FCEUIOD_MISC]);
|
||||||
|
else
|
||||||
|
// asprintf(&ret,"%s"PSS"fcs"PSS"%s*.fcm",BaseDirectory,FileBase);
|
||||||
|
asprintf(&ret,"%s"PSS"movie"PSS"*.???",BaseDirectory);
|
||||||
|
break;
|
||||||
|
case FCEUMKF_MOVIEGLOB2:
|
||||||
|
asprintf(&ret,"%s"PSS"*.???",BaseDirectory);
|
||||||
|
break;
|
||||||
|
case FCEUMKF_STATEGLOB:
|
||||||
|
if(odirs[FCEUIOD_STATE])
|
||||||
|
asprintf(&ret,"%s"PSS"%s*.fc?",odirs[FCEUIOD_STATE],FileBase);
|
||||||
|
else
|
||||||
|
asprintf(&ret,"%s"PSS"fcs"PSS"%s*.fc?",BaseDirectory,FileBase);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GetFileBase(const char *f)
|
||||||
|
{
|
||||||
|
const char *tp1,*tp3;
|
||||||
|
|
||||||
|
#if PSS_STYLE==4
|
||||||
|
tp1=((char *)strrchr(f,':'));
|
||||||
|
#elif PSS_STYLE==1
|
||||||
|
tp1=((char *)strrchr(f,'/'));
|
||||||
|
#else
|
||||||
|
tp1=((char *)strrchr(f,'\\'));
|
||||||
|
#if PSS_STYLE!=3
|
||||||
|
tp3=((char *)strrchr(f,'/'));
|
||||||
|
if(tp1<tp3) tp1=tp3;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
if(!tp1)
|
||||||
|
{
|
||||||
|
tp1=f;
|
||||||
|
strcpy(FileBaseDirectory,".");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
memcpy(FileBaseDirectory,f,tp1-f);
|
||||||
|
FileBaseDirectory[tp1-f]=0;
|
||||||
|
tp1++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(((tp3=strrchr(f,'.'))!=NULL) && (tp3>tp1))
|
||||||
|
{
|
||||||
|
memcpy(FileBase,tp1,tp3-tp1);
|
||||||
|
FileBase[tp3-tp1]=0;
|
||||||
|
strcpy(FileExt,tp3);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strcpy(FileBase,tp1);
|
||||||
|
FileExt[0]=0;
|
||||||
|
}
|
||||||
|
}
|
27
src/file.h
27
src/file.h
|
@ -1,3 +1,6 @@
|
||||||
|
#ifndef _FCEU_FILE_H_
|
||||||
|
#define _FCEU_FILE_H_
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
void *fp; // FILE* or ptr to ZIPWRAP
|
void *fp; // FILE* or ptr to ZIPWRAP
|
||||||
uint32 type; // 0=normal file, 1=gzip, 2=zip
|
uint32 type; // 0=normal file, 1=gzip, 2=zip
|
||||||
|
@ -16,3 +19,27 @@ int FCEU_fgetc(FCEUFILE*);
|
||||||
uint64 FCEU_fgetsize(FCEUFILE*);
|
uint64 FCEU_fgetsize(FCEUFILE*);
|
||||||
int FCEU_fisarchive(FCEUFILE*);
|
int FCEU_fisarchive(FCEUFILE*);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void GetFileBase(const char *f);
|
||||||
|
char* FCEU_GetPath(int type);
|
||||||
|
char *FCEU_MakePath(int type, const char* filebase);
|
||||||
|
char *FCEU_MakeFName(int type, int id1, char *cd1);
|
||||||
|
|
||||||
|
#define FCEUMKF_STATE 1
|
||||||
|
#define FCEUMKF_SNAP 2
|
||||||
|
#define FCEUMKF_SAV 3
|
||||||
|
#define FCEUMKF_CHEAT 4
|
||||||
|
#define FCEUMKF_FDSROM 5
|
||||||
|
#define FCEUMKF_PALETTE 6
|
||||||
|
#define FCEUMKF_GGROM 7
|
||||||
|
#define FCEUMKF_IPS 8
|
||||||
|
#define FCEUMKF_FDS 9
|
||||||
|
#define FCEUMKF_MOVIE 10
|
||||||
|
#define FCEUMKF_NPTEMP 11
|
||||||
|
#define FCEUMKF_MOVIEGLOB 12
|
||||||
|
#define FCEUMKF_STATEGLOB 13
|
||||||
|
#define FCEUMKF_MOVIEGLOB2 14
|
||||||
|
#define FCEUMKF_REWINDSTATE 15
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
314
src/general.cpp
314
src/general.cpp
|
@ -1,314 +0,0 @@
|
||||||
/* FCE Ultra - NES/Famicom Emulator
|
|
||||||
*
|
|
||||||
* Copyright notice for this file:
|
|
||||||
* Copyright (C) 2002 Xodnizel
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* 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 this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
//#include <unistd.h> //mbg merge 7/17/06 - removed
|
|
||||||
|
|
||||||
#include "types.h"
|
|
||||||
#include "fceu.h"
|
|
||||||
|
|
||||||
#include "general.h"
|
|
||||||
#include "state.h"
|
|
||||||
#include "movie.h"
|
|
||||||
|
|
||||||
#include "driver.h"
|
|
||||||
|
|
||||||
#include "md5.h"
|
|
||||||
|
|
||||||
static char BaseDirectory[2048];
|
|
||||||
char FileBase[2048];
|
|
||||||
static char FileExt[2048]; /* Includes the . character, as in ".nes" */
|
|
||||||
|
|
||||||
static char FileBaseDirectory[2048];
|
|
||||||
|
|
||||||
void FCEUI_SetBaseDirectory(char *dir)
|
|
||||||
{
|
|
||||||
strncpy(BaseDirectory,dir,2047);
|
|
||||||
BaseDirectory[2047]=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *odirs[FCEUIOD__COUNT]={0,0,0,0,0}; // odirs, odors. ^_^
|
|
||||||
|
|
||||||
void FCEUI_SetDirOverride(int which, char *n)
|
|
||||||
{
|
|
||||||
// FCEU_PrintError("odirs[%d]=%s->%s", which, odirs[which], n);
|
|
||||||
if(which < FCEUIOD__COUNT)
|
|
||||||
odirs[which]=n;
|
|
||||||
|
|
||||||
if(FCEUGameInfo) /* Rebuild cache of present states/movies. */
|
|
||||||
{
|
|
||||||
if(which==FCEUIOD_STATE)
|
|
||||||
FCEUSS_CheckStates();
|
|
||||||
else if(which == FCEUIOD_MISC)
|
|
||||||
FCEUMOV_CheckMovies();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef HAVE_ASPRINTF
|
|
||||||
static int asprintf(char **strp, const char *fmt, ...)
|
|
||||||
{
|
|
||||||
va_list ap;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
va_start(ap,fmt);
|
|
||||||
if(!(*strp=(char*)malloc(2048))) //mbg merge 7/17/06 cast to char*
|
|
||||||
return(0);
|
|
||||||
ret=vsnprintf(*strp,2048,fmt,ap);
|
|
||||||
va_end(ap);
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
char* FCEU_GetPath(int type)
|
|
||||||
{
|
|
||||||
char *ret=0;
|
|
||||||
switch(type)
|
|
||||||
{
|
|
||||||
case FCEUMKF_STATE:if(odirs[FCEUIOD_STATE])
|
|
||||||
ret=strdup(odirs[FCEUIOD_STATE]);
|
|
||||||
else
|
|
||||||
asprintf(&ret,"%s"PSS"movie",BaseDirectory);
|
|
||||||
break;
|
|
||||||
case FCEUMKF_MOVIE:if(odirs[FCEUIOD_MISC])
|
|
||||||
ret=strdup(odirs[FCEUIOD_MISC]);
|
|
||||||
else
|
|
||||||
asprintf(&ret,"%s"PSS"movie",BaseDirectory);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
char *FCEU_MakePath(int type, const char* filebase)
|
|
||||||
{
|
|
||||||
char *ret=0;
|
|
||||||
|
|
||||||
switch(type)
|
|
||||||
{
|
|
||||||
case FCEUMKF_MOVIE:if(odirs[FCEUIOD_MISC])
|
|
||||||
asprintf(&ret,"%s"PSS"%s",odirs[FCEUIOD_MISC],filebase);
|
|
||||||
else
|
|
||||||
asprintf(&ret,"%s"PSS"movie"PSS"%s",BaseDirectory,filebase);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
char *FCEU_MakeFName(int type, int id1, char *cd1)
|
|
||||||
{
|
|
||||||
char *ret=0;
|
|
||||||
struct stat tmpstat;
|
|
||||||
|
|
||||||
switch(type)
|
|
||||||
{
|
|
||||||
case FCEUMKF_NPTEMP: asprintf(&ret,"%s"PSS"m590plqd94fo.tmp",BaseDirectory);break;
|
|
||||||
case FCEUMKF_MOVIE:if(id1>=0)
|
|
||||||
{
|
|
||||||
if(odirs[FCEUIOD_MISC])
|
|
||||||
asprintf(&ret,"%s"PSS"%s.%d.fcm",odirs[FCEUIOD_MISC],FileBase,id1);
|
|
||||||
else
|
|
||||||
asprintf(&ret,"%s"PSS"movie"PSS"%s.%d.fcm",BaseDirectory,FileBase,id1);
|
|
||||||
if(stat(ret,&tmpstat)==-1)
|
|
||||||
{
|
|
||||||
if(odirs[FCEUIOD_MISC])
|
|
||||||
asprintf(&ret,"%s"PSS"%s.%d.fcm",odirs[FCEUIOD_MISC],FileBase,id1);
|
|
||||||
else
|
|
||||||
asprintf(&ret,"%s"PSS"movie"PSS"%s.%d.fcm",BaseDirectory,FileBase,id1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(odirs[FCEUIOD_MISC])
|
|
||||||
asprintf(&ret,"%s"PSS"%s.fcm",odirs[FCEUIOD_MISC],FileBase);
|
|
||||||
else
|
|
||||||
asprintf(&ret,"%s"PSS"movie"PSS"%s.fcm",BaseDirectory,FileBase);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case FCEUMKF_STATE:
|
|
||||||
if(odirs[FCEUIOD_STATE])
|
|
||||||
{
|
|
||||||
asprintf(&ret,"%s"PSS"%s.fc%d",odirs[FCEUIOD_STATE],FileBase,id1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
asprintf(&ret,"%s"PSS"fcs"PSS"%s.fc%d",BaseDirectory,FileBase,id1);
|
|
||||||
}
|
|
||||||
if(stat(ret,&tmpstat)==-1)
|
|
||||||
{
|
|
||||||
if(odirs[FCEUIOD_STATE])
|
|
||||||
{
|
|
||||||
asprintf(&ret,"%s"PSS"%s.fc%d",odirs[FCEUIOD_STATE],FileBase,id1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
asprintf(&ret,"%s"PSS"fcs"PSS"%s.fc%d",BaseDirectory,FileBase,id1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case FCEUMKF_SNAP:
|
|
||||||
if(FSettings.SnapName)
|
|
||||||
{
|
|
||||||
if(odirs[FCEUIOD_SNAPS])
|
|
||||||
asprintf(&ret,"%s"PSS"%s-%d.%s",odirs[FCEUIOD_SNAPS],FileBase,id1,cd1);
|
|
||||||
else
|
|
||||||
asprintf(&ret,"%s"PSS"snaps"PSS"%s-%d.%s",BaseDirectory,FileBase,id1,cd1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(odirs[FCEUIOD_SNAPS])
|
|
||||||
asprintf(&ret,"%s"PSS"%d.%s",odirs[FCEUIOD_SNAPS],id1,cd1);
|
|
||||||
else
|
|
||||||
asprintf(&ret,"%s"PSS"snaps"PSS"%d.%s",BaseDirectory,id1,cd1);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case FCEUMKF_FDS:if(odirs[FCEUIOD_NV])
|
|
||||||
asprintf(&ret,"%s"PSS"%s.fds",odirs[FCEUIOD_NV],FileBase);
|
|
||||||
else
|
|
||||||
asprintf(&ret,"%s"PSS"sav"PSS"%s.fds",BaseDirectory,FileBase);
|
|
||||||
break;
|
|
||||||
case FCEUMKF_SAV:if(odirs[FCEUIOD_NV])
|
|
||||||
asprintf(&ret,"%s"PSS"%s.%s",odirs[FCEUIOD_NV],FileBase,cd1);
|
|
||||||
else
|
|
||||||
asprintf(&ret,"%s"PSS"sav"PSS"%s.%s",BaseDirectory,FileBase,cd1);
|
|
||||||
if(stat(ret,&tmpstat)==-1)
|
|
||||||
{
|
|
||||||
if(odirs[FCEUIOD_NV])
|
|
||||||
asprintf(&ret,"%s"PSS"%s.%s",odirs[FCEUIOD_NV],FileBase,cd1);
|
|
||||||
else
|
|
||||||
asprintf(&ret,"%s"PSS"sav"PSS"%s.%s",BaseDirectory,FileBase,cd1);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case FCEUMKF_REWINDSTATE:
|
|
||||||
if(odirs[FCEUIOD_STATE])
|
|
||||||
{
|
|
||||||
asprintf(&ret,"%s"PSS"rewind%d.fcs",odirs[FCEUIOD_STATE],id1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
asprintf(&ret,"%s"PSS"fcs"PSS"rewind%d.fcs",BaseDirectory,id1);
|
|
||||||
}
|
|
||||||
if(stat(ret,&tmpstat)==-1)
|
|
||||||
{
|
|
||||||
if(odirs[FCEUIOD_STATE])
|
|
||||||
{
|
|
||||||
asprintf(&ret,"%s"PSS"rewind%d.fcs",odirs[FCEUIOD_STATE],id1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
asprintf(&ret,"%s"PSS"fcs"PSS"rewind%d.fcs",BaseDirectory,id1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case FCEUMKF_CHEAT:
|
|
||||||
if(odirs[FCEUIOD_CHEATS])
|
|
||||||
asprintf(&ret,"%s"PSS"%s.cht",odirs[FCEUIOD_CHEATS],FileBase);
|
|
||||||
else
|
|
||||||
asprintf(&ret,"%s"PSS"cheats"PSS"%s.cht",BaseDirectory,FileBase);
|
|
||||||
break;
|
|
||||||
case FCEUMKF_IPS: asprintf(&ret,"%s"PSS"%s%s.ips",FileBaseDirectory,FileBase,FileExt);
|
|
||||||
break;
|
|
||||||
case FCEUMKF_GGROM:asprintf(&ret,"%s"PSS"gg.rom",BaseDirectory);break;
|
|
||||||
case FCEUMKF_FDSROM:asprintf(&ret,"%s"PSS"disksys.rom",BaseDirectory);break;
|
|
||||||
case FCEUMKF_PALETTE:
|
|
||||||
if(odirs[FCEUIOD_MISC])
|
|
||||||
asprintf(&ret,"%s"PSS"%s.pal",odirs[FCEUIOD_MISC],FileBase);
|
|
||||||
else
|
|
||||||
asprintf(&ret,"%s"PSS"%s.pal",BaseDirectory,FileBase);
|
|
||||||
break;
|
|
||||||
case FCEUMKF_MOVIEGLOB:
|
|
||||||
if(odirs[FCEUIOD_MISC])
|
|
||||||
// asprintf(&ret,"%s"PSS"%s*.fcm",odirs[FCEUIOD_MISC],FileBase);
|
|
||||||
asprintf(&ret,"%s"PSS"*.???",odirs[FCEUIOD_MISC]);
|
|
||||||
else
|
|
||||||
// asprintf(&ret,"%s"PSS"fcs"PSS"%s*.fcm",BaseDirectory,FileBase);
|
|
||||||
asprintf(&ret,"%s"PSS"movie"PSS"*.???",BaseDirectory);
|
|
||||||
break;
|
|
||||||
case FCEUMKF_MOVIEGLOB2:
|
|
||||||
asprintf(&ret,"%s"PSS"*.???",BaseDirectory);
|
|
||||||
break;
|
|
||||||
case FCEUMKF_STATEGLOB:
|
|
||||||
if(odirs[FCEUIOD_STATE])
|
|
||||||
asprintf(&ret,"%s"PSS"%s*.fc?",odirs[FCEUIOD_STATE],FileBase);
|
|
||||||
else
|
|
||||||
asprintf(&ret,"%s"PSS"fcs"PSS"%s*.fc?",BaseDirectory,FileBase);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GetFileBase(const char *f)
|
|
||||||
{
|
|
||||||
const char *tp1,*tp3;
|
|
||||||
|
|
||||||
#if PSS_STYLE==4
|
|
||||||
tp1=((char *)strrchr(f,':'));
|
|
||||||
#elif PSS_STYLE==1
|
|
||||||
tp1=((char *)strrchr(f,'/'));
|
|
||||||
#else
|
|
||||||
tp1=((char *)strrchr(f,'\\'));
|
|
||||||
#if PSS_STYLE!=3
|
|
||||||
tp3=((char *)strrchr(f,'/'));
|
|
||||||
if(tp1<tp3) tp1=tp3;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
if(!tp1)
|
|
||||||
{
|
|
||||||
tp1=f;
|
|
||||||
strcpy(FileBaseDirectory,".");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
memcpy(FileBaseDirectory,f,tp1-f);
|
|
||||||
FileBaseDirectory[tp1-f]=0;
|
|
||||||
tp1++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(((tp3=strrchr(f,'.'))!=NULL) && (tp3>tp1))
|
|
||||||
{
|
|
||||||
memcpy(FileBase,tp1,tp3-tp1);
|
|
||||||
FileBase[tp3-tp1]=0;
|
|
||||||
strcpy(FileExt,tp3);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
strcpy(FileBase,tp1);
|
|
||||||
FileExt[0]=0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 uppow2(uint32 n)
|
|
||||||
{
|
|
||||||
int x;
|
|
||||||
|
|
||||||
for(x=31;x>=0;x--)
|
|
||||||
if(n&(1<<x))
|
|
||||||
{
|
|
||||||
if((1<<x)!=n)
|
|
||||||
return(1<<(x+1));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
void GetFileBase(const char *f);
|
|
||||||
extern uint32 uppow2(uint32 n);
|
|
||||||
|
|
||||||
char* FCEU_GetPath(int type);
|
|
||||||
char *FCEU_MakePath(int type, const char* filebase);
|
|
||||||
char *FCEU_MakeFName(int type, int id1, char *cd1);
|
|
||||||
|
|
||||||
#define FCEUMKF_STATE 1
|
|
||||||
#define FCEUMKF_SNAP 2
|
|
||||||
#define FCEUMKF_SAV 3
|
|
||||||
#define FCEUMKF_CHEAT 4
|
|
||||||
#define FCEUMKF_FDSROM 5
|
|
||||||
#define FCEUMKF_PALETTE 6
|
|
||||||
#define FCEUMKF_GGROM 7
|
|
||||||
#define FCEUMKF_IPS 8
|
|
||||||
#define FCEUMKF_FDS 9
|
|
||||||
#define FCEUMKF_MOVIE 10
|
|
||||||
#define FCEUMKF_NPTEMP 11
|
|
||||||
#define FCEUMKF_MOVIEGLOB 12
|
|
||||||
#define FCEUMKF_STATEGLOB 13
|
|
||||||
#define FCEUMKF_MOVIEGLOB2 14
|
|
||||||
#define FCEUMKF_REWINDSTATE 15
|
|
|
@ -36,12 +36,12 @@
|
||||||
#define INESPRIV
|
#define INESPRIV
|
||||||
#include "ines.h"
|
#include "ines.h"
|
||||||
#include "unif.h"
|
#include "unif.h"
|
||||||
#include "general.h"
|
|
||||||
#include "state.h"
|
#include "state.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "memory.h"
|
#include "utils/general.h"
|
||||||
#include "crc32.h"
|
#include "utils/memory.h"
|
||||||
#include "md5.h"
|
#include "utils/crc32.h"
|
||||||
|
#include "utils/md5.h"
|
||||||
#include "cheat.h"
|
#include "cheat.h"
|
||||||
#include "vsuni.h"
|
#include "vsuni.h"
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#define INESPRIV
|
#define INESPRIV
|
||||||
#include "../cart.h"
|
#include "../cart.h"
|
||||||
#include "../ines.h"
|
#include "../ines.h"
|
||||||
#include "../memory.h"
|
#include "../utils/memory.h"
|
||||||
#include "../sound.h"
|
#include "../sound.h"
|
||||||
#include "../state.h"
|
#include "../state.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
|
@ -7,16 +7,16 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "endian.h"
|
#include "utils/endian.h"
|
||||||
#include "palette.h"
|
#include "palette.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "fceu.h"
|
#include "fceu.h"
|
||||||
#include "driver.h"
|
#include "driver.h"
|
||||||
#include "state.h"
|
#include "state.h"
|
||||||
#include "general.h"
|
#include "file.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "movie.h"
|
#include "movie.h"
|
||||||
#include "memory.h" //mbg merge 7/17/06 added
|
#include "utils/memory.h" //mbg merge 7/17/06 added
|
||||||
|
|
||||||
#define MOVIE_MAGIC 0x1a4d4346 // FCM\x1a
|
#define MOVIE_MAGIC 0x1a4d4346 // FCM\x1a
|
||||||
#define MOVIE_VERSION 2 // still at 2 since the format itself is still compatible - to detect which version the movie was made with, check the fceu version stored in the movie header (e.g against FCEU_VERSION_NUMERIC)
|
#define MOVIE_VERSION 2 // still at 2 since the format itself is still compatible - to detect which version the movie was made with, check the fceu version stored in the movie header (e.g against FCEU_VERSION_NUMERIC)
|
||||||
|
|
|
@ -28,13 +28,13 @@
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
#include "file.h"
|
||||||
|
#include "utils/endian.h"
|
||||||
#include "netplay.h"
|
#include "netplay.h"
|
||||||
#include "fceu.h"
|
#include "fceu.h"
|
||||||
#include "general.h"
|
|
||||||
#include "state.h"
|
#include "state.h"
|
||||||
#include "cheat.h"
|
#include "cheat.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "endian.h"
|
|
||||||
|
|
||||||
int FCEUnetplay=0;
|
int FCEUnetplay=0;
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,8 @@
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "nsf.h"
|
#include "nsf.h"
|
||||||
#include "general.h"
|
#include "utils/general.h"
|
||||||
#include "memory.h"
|
#include "utils/memory.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "fds.h"
|
#include "fds.h"
|
||||||
#include "cart.h"
|
#include "cart.h"
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
#include "file.h"
|
||||||
#include "fceu.h"
|
#include "fceu.h"
|
||||||
#include "general.h"
|
|
||||||
#include "driver.h"
|
#include "driver.h"
|
||||||
|
|
||||||
#include "palette.h"
|
#include "palette.h"
|
||||||
|
|
|
@ -29,9 +29,9 @@
|
||||||
#include "ppu.h"
|
#include "ppu.h"
|
||||||
#include "nsf.h"
|
#include "nsf.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "general.h"
|
#include "file.h"
|
||||||
#include "endian.h"
|
#include "utils/endian.h"
|
||||||
#include "memory.h"
|
#include "utils/memory.h"
|
||||||
|
|
||||||
#include "cart.h"
|
#include "cart.h"
|
||||||
#include "palette.h"
|
#include "palette.h"
|
||||||
|
|
|
@ -30,12 +30,12 @@
|
||||||
#include "x6502.h"
|
#include "x6502.h"
|
||||||
#include "fceu.h"
|
#include "fceu.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "endian.h"
|
#include "utils/endian.h"
|
||||||
|
#include "utils/memory.h"
|
||||||
|
#include "file.h"
|
||||||
#include "fds.h"
|
#include "fds.h"
|
||||||
#include "general.h"
|
|
||||||
#include "state.h"
|
#include "state.h"
|
||||||
#include "movie.h"
|
#include "movie.h"
|
||||||
#include "memory.h"
|
|
||||||
#include "ppu.h"
|
#include "ppu.h"
|
||||||
#include "netplay.h"
|
#include "netplay.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
|
|
71
src/unif.cpp
71
src/unif.cpp
|
@ -32,13 +32,12 @@
|
||||||
#include "cart.h"
|
#include "cart.h"
|
||||||
#include "unif.h"
|
#include "unif.h"
|
||||||
#include "ines.h"
|
#include "ines.h"
|
||||||
#include "general.h"
|
#include "utils/endian.h"
|
||||||
|
#include "utils/memory.h"
|
||||||
|
#include "utils/md5.h"
|
||||||
#include "state.h"
|
#include "state.h"
|
||||||
#include "endian.h"
|
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "memory.h"
|
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "md5.h"
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char ID[4];
|
char ID[4];
|
||||||
|
@ -385,38 +384,38 @@ static BMAPPING bmap[] = {
|
||||||
|
|
||||||
{ "CC-21", UNLCC21_Init,0},
|
{ "CC-21", UNLCC21_Init,0},
|
||||||
|
|
||||||
{ "H2288", UNLH2288_Init,0},
|
{ "H2288", UNLH2288_Init,0},
|
||||||
{ "KOF97", UNLKOF97_Init,0},
|
{ "KOF97", UNLKOF97_Init,0},
|
||||||
{ "SL1632", UNLSL1632_Init,0},
|
{ "SL1632", UNLSL1632_Init,0},
|
||||||
{ "SHERO", UNLSHeroes_Init,0},
|
{ "SHERO", UNLSHeroes_Init,0},
|
||||||
{ "8237", UNL8237_Init,0},
|
{ "8237", UNL8237_Init,0},
|
||||||
{ "8157", UNL8157_Init,0},
|
{ "8157", UNL8157_Init,0},
|
||||||
{ "T-262", BMCT262_Init,0},
|
{ "T-262", BMCT262_Init,0},
|
||||||
{ "FK23C", BMCFK23C_Init,0},
|
{ "FK23C", BMCFK23C_Init,0},
|
||||||
{ "A65AS", BMCA65AS_Init,0},
|
{ "A65AS", BMCA65AS_Init,0},
|
||||||
{ "C-N22M", UNLCN22M_Init,0},
|
{ "C-N22M", UNLCN22M_Init,0},
|
||||||
{ "EDU2000", UNLEDU2000_Init,0},
|
{ "EDU2000", UNLEDU2000_Init,0},
|
||||||
{ "603-5052", UNL6035052_Init,0},
|
{ "603-5052", UNL6035052_Init,0},
|
||||||
{ "Supervision16in1", Supervision16_Init,0},
|
{ "Supervision16in1", Supervision16_Init,0},
|
||||||
{ "NovelDiamond9999999in1", Novel_Init,0},
|
{ "NovelDiamond9999999in1", Novel_Init,0},
|
||||||
{ "Super24in1SC03", Super24_Init,0},
|
{ "Super24in1SC03", Super24_Init,0},
|
||||||
{ "42in1ResetSwitch", BMC42in1r_Init, 0},
|
{ "42in1ResetSwitch", BMC42in1r_Init, 0},
|
||||||
{ "64in1NoRepeat", BMC64in1nr_Init, 0},
|
{ "64in1NoRepeat", BMC64in1nr_Init, 0},
|
||||||
{ "13in1JY110", BMC13in1JY110_Init, 0},
|
{ "13in1JY110", BMC13in1JY110_Init, 0},
|
||||||
{ "70in1", BMC70in1_Init, 0},
|
{ "70in1", BMC70in1_Init, 0},
|
||||||
{ "70in1B", BMC70in1B_Init, 0},
|
{ "70in1B", BMC70in1B_Init, 0},
|
||||||
{ "D1038", BMCD1038_Init, 0},
|
{ "D1038", BMCD1038_Init, 0},
|
||||||
{ "GK-192", BMCGK192_Init, 0},
|
{ "GK-192", BMCGK192_Init, 0},
|
||||||
{ "SuperHIK8in1", Mapper45_Init,0},
|
{ "SuperHIK8in1", Mapper45_Init,0},
|
||||||
{ "22211", UNL22211_Init,0},
|
{ "22211", UNL22211_Init,0},
|
||||||
|
|
||||||
{ "DREAMTECH01", DreamTech01_Init,0},
|
{ "DREAMTECH01", DreamTech01_Init,0},
|
||||||
{ "KONAMI-QTAI", Mapper190_Init,0},
|
{ "KONAMI-QTAI", Mapper190_Init,0},
|
||||||
|
|
||||||
{ "TEK90", Mapper90_Init,0},
|
{ "TEK90", Mapper90_Init,0},
|
||||||
|
|
||||||
{0,0,0}
|
{0,0,0}
|
||||||
};
|
};
|
||||||
static BFMAPPING bfunc[] = {
|
static BFMAPPING bfunc[] = {
|
||||||
{ "CTRL", CTRL },
|
{ "CTRL", CTRL },
|
||||||
{ "TVCI", TVCI },
|
{ "TVCI", TVCI },
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "types.h"
|
#include "../types.h"
|
||||||
#include "crc32.h"
|
#include "crc32.h"
|
||||||
|
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
|
@ -22,7 +22,7 @@
|
||||||
/// \brief contains file I/O functions that write/read data LSB first.
|
/// \brief contains file I/O functions that write/read data LSB first.
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "types.h"
|
#include "../types.h"
|
||||||
#include "endian.h"
|
#include "endian.h"
|
||||||
|
|
||||||
///endian-flips count bytes. count should be even and nonzero.
|
///endian-flips count bytes. count should be even and nonzero.
|
|
@ -0,0 +1,39 @@
|
||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2002 Xodnizel
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* 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 this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "../types.h"
|
||||||
|
|
||||||
|
uint32 uppow2(uint32 n)
|
||||||
|
{
|
||||||
|
int x;
|
||||||
|
|
||||||
|
for(x=31;x>=0;x--)
|
||||||
|
if(n&(1<<x))
|
||||||
|
{
|
||||||
|
if((1<<x)!=n)
|
||||||
|
return(1<<(x+1));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
extern uint32 uppow2(uint32 n);
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// -Xodnizel
|
// -Xodnizel
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "types.h"
|
#include "../types.h"
|
||||||
#include "md5.h"
|
#include "md5.h"
|
||||||
|
|
||||||
#define GET_UINT32(n,b,i) \
|
#define GET_UINT32(n,b,i) \
|
|
@ -22,10 +22,9 @@
|
||||||
/// \brief memory management services provided by FCEU core
|
/// \brief memory management services provided by FCEU core
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "types.h"
|
#include "../types.h"
|
||||||
#include "fceu.h"
|
#include "../fceu.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "general.h"
|
|
||||||
|
|
||||||
///allocates the specified number of bytes. exits process if this fails
|
///allocates the specified number of bytes. exits process if this fails
|
||||||
void *FCEU_gmalloc(uint32 size)
|
void *FCEU_gmalloc(uint32 size)
|
||||||
|
@ -63,4 +62,4 @@ void FCEU_gfree(void *ptr)
|
||||||
void FCEU_free(void *ptr) // Might do something with this and FCEU_malloc later...
|
void FCEU_free(void *ptr) // Might do something with this and FCEU_malloc later...
|
||||||
{
|
{
|
||||||
free(ptr);
|
free(ptr);
|
||||||
}
|
}
|
|
@ -22,7 +22,7 @@
|
||||||
# include <errno.h>
|
# include <errno.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "driver.h"
|
#include "../driver.h"
|
||||||
|
|
||||||
#ifndef local
|
#ifndef local
|
||||||
# define local static
|
# define local static
|
|
@ -31,9 +31,9 @@
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "fceu.h"
|
#include "fceu.h"
|
||||||
#include "general.h"
|
#include "file.h"
|
||||||
#include "memory.h"
|
#include "utils/memory.h"
|
||||||
#include "crc32.h"
|
#include "utils/crc32.h"
|
||||||
#include "state.h"
|
#include "state.h"
|
||||||
#include "movie.h"
|
#include "movie.h"
|
||||||
#include "palette.h"
|
#include "palette.h"
|
||||||
|
|
Loading…
Reference in New Issue