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

View File

@ -1,4 +1,5 @@
#include "share.h" #include "share.h"
#include "fceuconfig.h"
static uint8 GunSight[]={ static uint8 GunSight[]={
0,0,0,0,0,0,1,0,0,0,0,0,0, 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, 0,0,0,0,0,0,0,1,1,0,0,
}; };
void FCEU_DrawGunSight(uint8 *buf, int xc, int yc) void FCEU_DrawGunSight(uint8 *buf, int xc, int yc) {
{ if (GCSettings.crosshair) {
int x,y; int x, y;
int c,d; int c, d;
for(y=0;y<13;y++) for (y = 0; y < 13; y++)
for(x=0;x<13;x++) for (x = 0; x < 13; x++) {
{ uint8 a;
uint8 a; a = GunSight[y * 13 + x];
a=GunSight[y*13+x]; if (a) {
if(a) c = (yc + y - 7);
{ d = (xc + x - 7);
c=(yc+y-7); if (c >= 0 && d >= 0 && d < 256 && c < 240) {
d=(xc+x-7); if (a == 3)
if(c>=0 && d>=0 && d<256 && c<240) buf[c * 256 + d] = 0xBF - (buf[c * 256 + d] & 0x3F);
{ else
if(a==3) buf[c * 256 + d] = a - 1;
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); if(UNIFchrrama) memset(UNIFchrrama,0,8192);
break; break;
case GI_CLOSE: case GI_CLOSE:
FCEU_SaveGameSave(&UNIFCart); //FCEU_SaveGameSave(&UNIFCart);
if(UNIFCart.Close) if(UNIFCart.Close)
UNIFCart.Close(); UNIFCart.Close();
FreeUNIF(); FreeUNIF();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -33,7 +33,7 @@ unsigned int nespadmap[] = {
JOY_SELECT, JOY_START, JOY_SELECT, JOY_START,
JOY_UP, JOY_DOWN, JOY_UP, JOY_DOWN,
JOY_LEFT, JOY_RIGHT, 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 ***/ /*** Gamecube controller Padmap ***/
@ -383,7 +383,18 @@ unsigned char DecodeJoy( unsigned short pad )
if(nespadmap[i] > 0) if(nespadmap[i] > 0)
J |= nespadmap[i]; J |= nespadmap[i];
else 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() void GetJoy()
{ {
unsigned char pad[4]; JSReturn = 0; // reset buttons pressed
unsigned char pad[4];
short i; short i;
s8 gc_px = PAD_SubStickX (0); s8 gc_px = PAD_SubStickX (0);