From 41059552b306a371a6c79d50c51ff559045d174d Mon Sep 17 00:00:00 2001 From: dborth Date: Wed, 1 Oct 2008 21:00:12 +0000 Subject: [PATCH] FDS works now, option to disable zapper crosshair --- source/fceultra/fds.c | 30 ++++++++++++------------ source/fceultra/input/cursor.c | 43 +++++++++++++++++----------------- source/fceultra/unif.c | 2 +- source/ngc/fceuconfig.c | 1 + source/ngc/fceuconfig.h | 1 + source/ngc/fceugc.c | 3 ++- source/ngc/fceuload.c | 9 +++---- source/ngc/menu.c | 24 ++++++++++++------- source/ngc/pad.c | 18 +++++++++++--- 9 files changed, 75 insertions(+), 56 deletions(-) diff --git a/source/fceultra/fds.c b/source/fceultra/fds.c index d1023c1..66c5e8a 100644 --- a/source/fceultra/fds.c +++ b/source/fceultra/fds.c @@ -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;xtype=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); } diff --git a/source/fceultra/input/cursor.c b/source/fceultra/input/cursor.c index f7a5b87..47db6d8 100644 --- a/source/fceultra/input/cursor.c +++ b/source/fceultra/input/cursor.c @@ -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; + } + } + } + } } diff --git a/source/fceultra/unif.c b/source/fceultra/unif.c index 49d9c66..888693a 100644 --- a/source/fceultra/unif.c +++ b/source/fceultra/unif.c @@ -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(); diff --git a/source/ngc/fceuconfig.c b/source/ngc/fceuconfig.c index b64973f..c0fba05 100644 --- a/source/ngc/fceuconfig.c +++ b/source/ngc/fceuconfig.c @@ -26,6 +26,7 @@ DefaultSettings () GCSettings.timing = 0; GCSettings.FSDisable = 1; GCSettings.zapper = 0; + GCSettings.crosshair = 1; GCSettings.slimit = 1; GCSettings.screenscaler = 2; diff --git a/source/ngc/fceuconfig.h b/source/ngc/fceuconfig.h index f6b031d..af5526a 100644 --- a/source/ngc/fceuconfig.h +++ b/source/ngc/fceuconfig.h @@ -53,6 +53,7 @@ struct SGCSettings{ int timing; int FSDisable; int zapper; + int crosshair; int slimit; int screenscaler; }; diff --git a/source/ngc/fceugc.c b/source/ngc/fceugc.c index 0796e3a..61d0254 100644 --- a/source/ngc/fceugc.c +++ b/source/ngc/fceugc.c @@ -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 diff --git a/source/ngc/fceuload.c b/source/ngc/fceuload.c index f6df801..71eb209 100644 --- a/source/ngc/fceuload.c +++ b/source/ngc/fceuload.c @@ -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) diff --git a/source/ngc/menu.c b/source/ngc/menu.c index 8c154de..69a0fe1 100644 --- a/source/ngc/menu.c +++ b/source/ngc/menu.c @@ -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; diff --git a/source/ngc/pad.c b/source/ngc/pad.c index 8187256..462718e 100644 --- a/source/ngc/pad.c +++ b/source/ngc/pad.c @@ -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);