diff --git a/source/fceultra/fds.cpp b/source/fceultra/fds.cpp index 6b931ad..b40f2e5 100644 --- a/source/fceultra/fds.cpp +++ b/source/fceultra/fds.cpp @@ -779,7 +779,7 @@ int FDSLoad(const char *name, FCEUFILE *fp) #ifndef GEKKO FCEU_fseek(fp,0,SEEK_SET); #endif - if(!SubLoad(fp)) + if(!SubLoad(fp)) return(0); #ifndef GEKKO @@ -787,7 +787,7 @@ int FDSLoad(const char *name, FCEUFILE *fp) if(!(zp=FCEUD_UTF8fopen(fn,"rb"))) { - FCEU_PrintError("FDS BIOS ROM image missing!"); + FCEU_PrintError("FDS BIOS ROM image missing: %s", FCEU_MakeFName(FCEUMKF_FDSROM,0,0).c_str()); FreeFDSMemory(); free(fn); return 0; @@ -834,6 +834,10 @@ if (!disableBatteryLoading) #endif } +#ifndef GEKKO + extern char LoadedRomFName[2048]; + strcpy(LoadedRomFName,name); //For the debugger list +#endif GameInfo->type=GIT_FDS; GameInterface=FDSGI; diff --git a/source/fceultra/ppu.cpp b/source/fceultra/ppu.cpp index 960f13c..dcd1506 100644 --- a/source/fceultra/ppu.cpp +++ b/source/fceultra/ppu.cpp @@ -266,6 +266,7 @@ struct PPUREGS { } } ppur; + static void makeppulut(void) { int x; @@ -471,6 +472,22 @@ void (*FFCEUX_PPUWrite)(uint32 A, uint8 V) = 0; //whether to use the new ppu (new PPU doesn't handle MMC5 extra nametables at all int newppu = 0; + +void ppu_getScroll(int &xpos, int &ypos) +{ + if(newppu) + { + ypos = ppur._vt*8 + ppur._fv + ppur._v*256; + xpos = ppur._ht*8 + ppur.fh + ppur._h*256; + } + else + { + xpos = ((RefreshAddr & 0x400) >> 2) | ((RefreshAddr & 0x1F) << 3) | XOffset; + + ypos = ((RefreshAddr & 0x3E0) >> 2) | ((RefreshAddr & 0x7000) >> 12); + if(RefreshAddr & 0x800) ypos += 240; + } +} //--------------- static DECLFR(A2002) @@ -1074,7 +1091,8 @@ static void CheckSpriteHit(int p) for(x=sphitx;x<(sphitx+8) && x>(x-sphitx))) && !(Plinef[x]&64)) + + if((sphitdata&(0x80>>(x-sphitx))) && !(Plinef[x]&64) && x < 255) { PPU_status|=0x40; //printf("Ha: %d, %d, Hita: %d, %d, %d, %d, %d\n",p,p&~7,scanline,GETLASTPIXEL-16,&Plinef[x],Pline,Pline-Plinef); @@ -2284,9 +2302,10 @@ int FCEUX_PPU_Loop(int skip) { //1. is it sprite#0? //2. is the bg pixel nonzero? //then, it is spritehit. - if(oam[6] == 0 && pixel != 0) + if(oam[6] == 0 && (pixel & 3) != 0 && + rasterpos < 255) { - PPU_status |= 0x40; + PPU_status |= 0x40; } havepixel = true; diff --git a/source/fceultra/ppu.h b/source/fceultra/ppu.h index d2f519c..0e15114 100644 --- a/source/fceultra/ppu.h +++ b/source/fceultra/ppu.h @@ -17,6 +17,8 @@ extern uint8 PPUCHRRAM; void FCEUPPU_SaveState(void); void FCEUPPU_LoadState(int version); uint8* FCEUPPU_GetCHR(uint32 vadr, uint32 refreshaddr); +void ppu_getScroll(int &xpos, int &ypos); + #ifdef _MSC_VER #define FASTCALL __fastcall