FDS works now, option to disable zapper crosshair

This commit is contained in:
dborth 2008-10-01 21:00:12 +00:00
parent 4ff5b30628
commit 41059552b3
9 changed files with 75 additions and 56 deletions

View File

@ -747,14 +747,14 @@ static void PostSave(void)
int FDSLoad(const char *name, FCEUFILE *fp)
{
//FILE *zp;
int x;
// char *fn;
//FILE *zp;
int x;
// char *fn;
FCEU_fseek(fp,0,SEEK_SET);
FCEU_fseek(fp,0,SEEK_SET);
if(!SubLoad(fp))
return(0);
if(!SubLoad(fp))
return(0);
/*
fn = FCEU_MakeFName(FCEUMKF_FDSROM,0,0);
@ -778,10 +778,10 @@ int FDSLoad(const char *name, FCEUFILE *fp)
}
fclose(zp);
*/
{
FCEUFILE *tp;
char *fn=FCEU_MakeFName(FCEUMKF_FDS,0,0);
//FCEUFILE *tp;
//char *fn=FCEU_MakeFName(FCEUMKF_FDS,0,0);
int x;
for(x=0;x<TotalSides;x++)
@ -789,7 +789,7 @@ int FDSLoad(const char *name, FCEUFILE *fp)
diskdatao[x]=(uint8 *)FCEU_malloc(65500);
memcpy(diskdatao[x],diskdata[x],65500);
}
if((tp=FCEU_fopen(fn,0,"rb",0)))
/* if((tp=FCEU_fopen(fn,0,"rb",0)))
{
FreeFDSMemory();
if(!SubLoad(tp))
@ -801,8 +801,8 @@ int FDSLoad(const char *name, FCEUFILE *fp)
FCEU_fclose(tp);
DiskWritten=1; // For save state handling.
}
free(fn);
}*/
free(fn);*/
}
FCEUGameInfo->type=GIT_FDS;
GameInterface=FDSGI;
@ -845,7 +845,7 @@ int FDSLoad(const char *name, FCEUFILE *fp)
void FDSClose(void)
{
FILE *fp;
/*FILE *fp;
int x;
char *fn=FCEU_MakeFName(FCEUMKF_FDS,0,0);
@ -866,7 +866,7 @@ void FDSClose(void)
fclose(fp);
return;
}
}
}*/
FreeFDSMemory();
fclose(fp);
//fclose(fp);
}

View File

@ -1,4 +1,5 @@
#include "share.h"
#include "fceuconfig.h"
static uint8 GunSight[]={
0,0,0,0,0,0,1,0,0,0,0,0,0,
@ -38,29 +39,27 @@ static uint8 FCEUcursor[11*19]=
0,0,0,0,0,0,0,1,1,0,0,
};
void FCEU_DrawGunSight(uint8 *buf, int xc, int yc)
{
int x,y;
int c,d;
void FCEU_DrawGunSight(uint8 *buf, int xc, int yc) {
if (GCSettings.crosshair) {
int x, y;
int c, d;
for(y=0;y<13;y++)
for(x=0;x<13;x++)
{
uint8 a;
a=GunSight[y*13+x];
if(a)
{
c=(yc+y-7);
d=(xc+x-7);
if(c>=0 && d>=0 && d<256 && c<240)
{
if(a==3)
buf[c*256+d]=0xBF-(buf[c*256+d]&0x3F);
else
buf[c*256+d]=a-1;
}
}
}
for (y = 0; y < 13; y++)
for (x = 0; x < 13; x++) {
uint8 a;
a = GunSight[y * 13 + x];
if (a) {
c = (yc + y - 7);
d = (xc + x - 7);
if (c >= 0 && d >= 0 && d < 256 && c < 240) {
if (a == 3)
buf[c * 256 + d] = 0xBF - (buf[c * 256 + d] & 0x3F);
else
buf[c * 256 + d] = a - 1;
}
}
}
}
}

View File

@ -484,7 +484,7 @@ static void UNIFGI(int h)
if(UNIFchrrama) memset(UNIFchrrama,0,8192);
break;
case GI_CLOSE:
FCEU_SaveGameSave(&UNIFCart);
//FCEU_SaveGameSave(&UNIFCart);
if(UNIFCart.Close)
UNIFCart.Close();
FreeUNIF();

View File

@ -26,6 +26,7 @@ DefaultSettings ()
GCSettings.timing = 0;
GCSettings.FSDisable = 1;
GCSettings.zapper = 0;
GCSettings.crosshair = 1;
GCSettings.slimit = 1;
GCSettings.screenscaler = 2;

View File

@ -53,6 +53,7 @@ struct SGCSettings{
int timing;
int FSDisable;
int zapper;
int crosshair;
int slimit;
int screenscaler;
};

View File

@ -126,7 +126,8 @@ int main(int argc, char *argv[])
// File Control
FILE *FCEUD_UTF8fopen(const char *n, const char *m)
{
return(fopen(n,m));
return NULL;
//return(fopen(n,m));
}
// General Logging

View File

@ -142,12 +142,9 @@ int GCMemROM(method)
}
free(tmpbuffer);
}
else
{
// load game
if(FDSLoad(NULL,fceufp))
nesGameType = 4;
}
// load game
if(FDSLoad(NULL,fceufp))
nesGameType = 4;
}
if (nesGameType > 0)

View File

@ -533,7 +533,7 @@ char cfg_btns_menu[][50] = {
"DOWN - ",
"LEFT - ",
"RIGHT - ",
"INSERT COIN - ",
"SPECIAL - ",
"Return to previous"
};
@ -634,10 +634,11 @@ ConfigureButtons (u16 ctrlr_type)
menu = oldmenu;
} // end configurebuttons()
int ctlrmenucount = 8;
int ctlrmenucount = 9;
char ctlrmenu[][50] = {
"Four Score",
"Zapper",
"Zapper Crosshair",
"Nunchuk",
"Classic Controller",
"Wiimote",
@ -670,6 +671,9 @@ ConfigureControllers ()
else if (GCSettings.zapper == 1) sprintf (ctlrmenu[1],"Zapper - Port 1");
else if (GCSettings.zapper == 2) sprintf (ctlrmenu[1],"Zapper - Port 2");
sprintf (ctlrmenu[2], "Zapper Crosshair - %s",
GCSettings.crosshair == true ? " ON" : "OFF");
/*** Controller Config Menu ***/
ret = RunMenu (ctlrmenu, ctlrmenucount, (char*)"Configure Controllers", 20, -1);
@ -687,33 +691,37 @@ ConfigureControllers ()
ToggleZapper(GCSettings.zapper);
break;
case 2:
case 2: // zapper crosshair
GCSettings.crosshair ^= 1;
break;
case 3:
/*** Configure Nunchuk ***/
ConfigureButtons (CTRLR_NUNCHUK);
break;
case 3:
case 4:
/*** Configure Classic ***/
ConfigureButtons (CTRLR_CLASSIC);
break;
case 4:
case 5:
/*** Configure Wiimote ***/
ConfigureButtons (CTRLR_WIIMOTE);
break;
case 5:
case 6:
/*** Configure GC Pad ***/
ConfigureButtons (CTRLR_GCPAD);
break;
case 6:
case 7:
/*** Save Preferences Now ***/
SavePrefs(GCSettings.SaveMethod, NOTSILENT);
break;
case -1: /*** Button B ***/
case 7:
case 8:
/*** Return ***/
quit = 1;
break;

View File

@ -33,7 +33,7 @@ unsigned int nespadmap[] = {
JOY_SELECT, JOY_START,
JOY_UP, JOY_DOWN,
JOY_LEFT, JOY_RIGHT,
0 // insert coin for VS games
0 // insert coin for VS games, insert/eject/select disk for FDS
};
/*** Gamecube controller Padmap ***/
@ -383,7 +383,18 @@ unsigned char DecodeJoy( unsigned short pad )
if(nespadmap[i] > 0)
J |= nespadmap[i];
else
FCEU_DoSimpleCommand(0x07); // insert coin for VS Games
{
if(nesGameType == 4) // FDS
{
/* these commands shouldn't be issued in parallel but this
* allows us to only map one button for both!
* the gamer must just have to press the button twice */
FCEUI_FDSInsert(0); // eject / insert disk
FCEUI_FDSSelect(); // select other side
}
else
FCEU_DoSimpleCommand(0x07); // insert coin for VS Games
}
}
}
@ -421,7 +432,8 @@ unsigned char DecodeJoy( unsigned short pad )
void GetJoy()
{
unsigned char pad[4];
JSReturn = 0; // reset buttons pressed
unsigned char pad[4];
short i;
s8 gc_px = PAD_SubStickX (0);