X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=fce.c;h=8483a7b00249beba9620d178a3107a802602260b;hb=03c1614fc3c6db44cfd03f62eb415492192a37a7;hp=e83085eb56cc960e7334eef677940df9a3eda101;hpb=c8c88d89f9bb0df71360b3b68327300f686a1c20;p=fceu.git diff --git a/fce.c b/fce.c index e83085e..8483a7b 100644 --- a/fce.c +++ b/fce.c @@ -98,6 +98,7 @@ static uint8 deemp=0; static int deempcnt[8]; FCEUGI FCEUGameInfo; +FCEUGI *GameInfo = &FCEUGameInfo; void (*GameInterface)(int h, void *param); void FP_FASTAPASS(1) (*PPU_hook)(uint32 A); @@ -114,32 +115,6 @@ static int RWWrap=0; #ifdef ASM_6502 #ifdef DEBUG_ASM_6502 extern uint8 nes_internal_ram[0x800]; -#else -static void asmcpu_update(int32 cycles) -{ - // some code from x6502.c - fhcnt-=cycles; - if(fhcnt<=0) - { - FrameSoundUpdate(); - fhcnt+=fhinc; - } - - if(PCMIRQCount>0) - { - PCMIRQCount-=cycles; - if(PCMIRQCount<=0) - { - vdis=1; - if((PSG[0x10]&0x80) && !(PSG[0x10]&0x40)) - { - extern uint8 SIRQStat; - SIRQStat|=0x80; - X6502_IRQBegin(FCEU_IQDPCM); - } - } - } -} #endif void asmcpu_unpack(void) @@ -631,7 +606,14 @@ static void LineUpdate(uint8 *target) return; } - if(scanline < FSettings.FirstSLine || scanline > FSettings.LastSLine) + if(!ScreenON) + { + tem=Pal[0]|0x40; + tem|=tem << 8; + tem|=tem << 16; + FCEU_dwmemset(target,tem,256); + } + else if(scanline < FSettings.FirstSLine || scanline > FSettings.LastSLine) { if(PPU_hook) PRefreshLine(); @@ -640,17 +622,7 @@ static void LineUpdate(uint8 *target) } else { - if(ScreenON) - { - BGRender(target); - } - else - { - tem=Pal[0]|0x40; - tem|=tem << 8; - tem|=tem << 16; - FCEU_dwmemset(target,tem,256); - } + BGRender(target); } if(InputScanlineHook) @@ -1117,7 +1089,7 @@ void ResetGameLoaded(void) char lastLoadedGameName [2048]; int LoadGameLastError = 0; int UNIFLoad(const char *name, int fp); -int iNESLoad(const char *name, int fp); +int iNESLoad(const char *name, int fp, int OverwriteVidMode); int FDSLoad(const char *name, int fp); int NSFLoad(int fp); @@ -1178,7 +1150,7 @@ FCEUGI *FCEUI_LoadGame(char *name) } GetFileBase(name2); - if(iNESLoad(name2,fp)) + if(iNESLoad(name2,fp,1)) goto endlseq; if(NSFLoad(fp)) goto endlseq; @@ -1265,6 +1237,8 @@ int FCEUI_Initialize(void) FCEUI_Initialize098(); FCEUI_SetEmuMode(0); + X6502_Init(); + return 1; } @@ -1403,10 +1377,10 @@ static void EmLoop(void) { if(ScreenON || SpriteON) { - if(GameHBIRQHook) + if(GameHBIRQHook && (PPU[0]&0x38)!=0x18) GameHBIRQHook(); - if(PPU_hook) - for(x=0;x<42;x++) {PPU_hook(0x2000); PPU_hook(0);} // ugh + if(PPU_hook) + for(x=0;x<42;x++) {PPU_hook(0x2000); PPU_hook(0);} // ugh if(GameHBIRQHook2) GameHBIRQHook2(); } @@ -1516,14 +1490,14 @@ void ResetNES081(void) { if(!GameLoaded) return; GameInterface(GI_RESETM2, 0); - ResetSound(); + FCEUSND_Reset(); ResetPPU(); X6502_Reset(); } -#ifndef DEBUG_ASM_6502 -static void FCEU_MemoryRand(uint8 *ptr, uint32 size) +void FCEU_MemoryRand(uint8 *ptr, uint32 size) { +#ifndef DEBUG_ASM_6502 int x=0; while(size) { @@ -1532,8 +1506,8 @@ static void FCEU_MemoryRand(uint8 *ptr, uint32 size) size--; ptr++; } -} #endif +} void PowerNES(void) { @@ -1544,14 +1518,13 @@ void PowerNES(void) GeniePower(); -#ifndef DEBUG_ASM_6502 FCEU_MemoryRand(RAM,0x800); -#else +#ifdef DEBUG_ASM_6502 memset(RAM,0x00,0x800); memset(nes_internal_ram,0x00,0x800); #endif ResetMapping(); - PowerSound(); + FCEUSND_Power(); PowerPPU(); if (use098code)