Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
owomomo committed Jun 10, 2019
1 parent 959c94f commit d87970f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,9 @@ FCEUFILE * FCEU_fopen(const char *path, const char *ipsfn, char *mode, char *ext
FILE *ipsfile=0;
FCEUFILE *fceufp=0;

bool read = (std::string)mode == "rb";
bool write = (std::string)mode == "wb";
if((read&&write) || (!read&&!write))
bool read = !strcmp(mode, "rb");
bool write = !strcmp(mode, "wb");
if(read && write || !read && !write)
{
FCEU_PrintError("invalid file open mode specified (only wb and rb are supported)");
return 0;
Expand Down
16 changes: 4 additions & 12 deletions src/ines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static int iNES_Init(int num);

static int MapperNo = 0;

static int iNES2 = 0;
int iNES2 = 0;

static DECLFR(TrainerRead) {
return(trainerpoo[A & 0x1FF]);
Expand Down Expand Up @@ -443,13 +443,8 @@ static int not_power2[] =
{
53, 198, 228
};
typedef struct {
char *name;
int32 number;
void (*init)(CartInfo *);
} BMAPPINGLocal;

static BMAPPINGLocal bmap[] = {
BMAPPINGLocal bmap[] = {
{"NROM", 0, NROM_Init},
{"MMC1", 1, Mapper1_Init},
{"UNROM", 2, UNROM_Init},
Expand Down Expand Up @@ -729,12 +724,9 @@ static BMAPPINGLocal bmap[] = {
int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode) {
struct md5_context md5;

if (FCEU_fread(&head, 1, 16, fp) != 16)
if (FCEU_fread(&head, 1, 16, fp) != 16 || memcmp(&head, "NES\x1A", 4))
return 0;

if (memcmp(&head, "NES\x1a", 4))
return 0;


head.cleanup();

memset(&iNESCart, 0, sizeof(iNESCart));
Expand Down

0 comments on commit d87970f

Please sign in to comment.