mirror of
https://github.com/dborth/fceugx.git
synced 2025-01-05 21:38:17 +01:00
sync with official
This commit is contained in:
parent
56088e6e60
commit
3b5b05ddfe
@ -18,14 +18,17 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//ccording to nestopia, BTL_SMB2_C, otherwise known as UNL-SMB2J
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg;
|
||||
static uint8 IRQCount, IRQa;
|
||||
static uint8 IRQa;
|
||||
static uint32 IRQCount;
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{&IRQCount, 1, "IRQC"},
|
||||
{&IRQCount, 4, "IRQC"},
|
||||
{&IRQa, 1, "IRQA"},
|
||||
{®, 1, "REG"},
|
||||
{0}
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "types.h"
|
||||
#include "version.h"
|
||||
#include "fceu.h"
|
||||
#include "driver.h"
|
||||
|
||||
|
@ -404,7 +404,7 @@ void DrawTextTransWH(uint8 *dest, uint32 width, uint8 *textmsg, uint8 fgcolor, i
|
||||
char target[64][256] = {{0}};
|
||||
|
||||
assert(width==256);
|
||||
if (max_w > 256) max_w = 256;
|
||||
if (max_w > 256) max_w = 256;
|
||||
if (max_h > 64) max_h = 64;
|
||||
|
||||
for(; *textmsg; ++textmsg)
|
||||
|
@ -5,4 +5,4 @@ void DrawMessage(bool beforeMovie);
|
||||
void FCEU_DrawRecordingStatus(uint8* XBuf);
|
||||
void FCEU_DrawNumberRow(uint8 *XBuf, int *nstatus, int cur);
|
||||
void DrawTextTrans(uint8 *dest, uint32 width, uint8 *textmsg, uint8 fgcolor);
|
||||
void DrawTextTransWH(uint8 *dest, uint32 width, uint8 *textmsg, uint8 fgcolor, int max_w, int max_h, int border);
|
||||
void DrawTextTransWH(uint8 *dest, uint32 width, uint8 *textmsg, uint8 fgcolor, int max_w, int max_h, int border);
|
||||
|
@ -6,14 +6,29 @@
|
||||
static uint8 reg[9], VRAM_switch;
|
||||
static int32 irq_enable, irq_counter, irq_latch, irq_clock;
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{ reg, sizeof(reg), "MAPPER_REGS" },
|
||||
{ &VRAM_switch, sizeof(VRAM_switch), "MAPPER_VRAMSWITCH" },
|
||||
{ &irq_enable, sizeof(irq_enable), "MAPPER_IRQ_ENABLE" },
|
||||
{ &irq_counter, sizeof(irq_counter), "MAPPER_IRQ_COUNTER" },
|
||||
{ &irq_latch, sizeof(irq_latch), "MAPPER_IRQ_LATCH" },
|
||||
{ &irq_clock, sizeof(irq_clock), "MAPPER_IRQ_CLOCK" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void Mapper253_IRQHook(int cycles)
|
||||
{
|
||||
//basically, this happens at every frame
|
||||
//0x72 is 114 cycles, so like one scanline
|
||||
//happens for 0xff scanlines so 256 scanlines (frame)
|
||||
if( irq_enable & 0x02 )
|
||||
{
|
||||
if( (irq_clock+=cycles) >= 0x72 )
|
||||
{
|
||||
irq_clock -= 0x72;
|
||||
if( irq_counter == 0xFF )
|
||||
|
||||
if( irq_counter == 0xFF)
|
||||
{
|
||||
irq_counter = irq_latch;
|
||||
irq_enable = (irq_enable & 0x01) * 3;
|
||||
@ -40,22 +55,20 @@ static void SetBank_PPUSUB(int bank, int page)
|
||||
}
|
||||
if ((page == 4) || (page == 5))
|
||||
{
|
||||
printf("Page in 4 5: %d\n", page);
|
||||
if(VRAM_switch == 0)
|
||||
setchr1( bank << 10, page ); //CHR-ROM
|
||||
else
|
||||
setchr1( bank << 10, page ); //CHR-RAM
|
||||
// [ES-1064] Qi Long Zhu (C).NES game uses CHR-RAM for these pages
|
||||
//and doesn't seem to set VRAM switch so use
|
||||
//CHR-RAM as default for now
|
||||
/*if (VRAM_switch == 0)
|
||||
setchr1(bank << 10, page); //CHR-ROM
|
||||
else*/
|
||||
setvramb1(&CHRRAM[page << 10], page << 10, 0); //CHR-RAM
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Page: %d\n", page);
|
||||
setchr1(bank << 10, page);
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(Mapper253_Write)
|
||||
{
|
||||
printf("Address: 0x%X V: 0x%X\n", A, V);
|
||||
if (A == 0x8010) //8kb select at 0x8000
|
||||
{
|
||||
setprg8(0x8000, V);
|
||||
@ -86,6 +99,7 @@ static DECLFW(Mapper253_Write)
|
||||
setmirror(MI_1);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
switch (A & 0xF00C)
|
||||
@ -169,9 +183,6 @@ static DECLFW(Mapper253_Write)
|
||||
}
|
||||
X6502_IRQEnd(FCEU_IQEXT);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
//printf("Not handled 0x%X 0x%X", A, V);
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,5 +218,6 @@ void Mapper253_Init(CartInfo *info)
|
||||
info->Close = Mapper253_Close;
|
||||
SetWriteHandler(0x8000, 0xFFFF, Mapper253_Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
AddExState(StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
|
||||
#include "version.h"
|
||||
#include "types.h"
|
||||
#include "utils/endian.h"
|
||||
#include "palette.h"
|
||||
|
@ -208,6 +208,7 @@ struct PPUREGS {
|
||||
void increment_vs() {
|
||||
fv++;
|
||||
vt += (fv>>3);
|
||||
vt &= 31; //fixed tecmo super bowl
|
||||
v += (vt==30)?1:0;
|
||||
fv &= 7;
|
||||
if(vt==30) vt=0;
|
||||
@ -2136,7 +2137,6 @@ struct BGData {
|
||||
|
||||
int framectr=0;
|
||||
int FCEUX_PPU_Loop(int skip) {
|
||||
|
||||
//262 scanlines
|
||||
if (ppudead)
|
||||
{
|
||||
@ -2285,8 +2285,9 @@ int FCEUX_PPU_Loop(int skip) {
|
||||
//2. is the bg pixel nonzero?
|
||||
//then, it is spritehit.
|
||||
if(oam[6] == 0 && pixel != 0)
|
||||
{
|
||||
PPU_status |= 0x40;
|
||||
|
||||
}
|
||||
havepixel = true;
|
||||
|
||||
//priority handling
|
||||
@ -2408,14 +2409,18 @@ int FCEUX_PPU_Loop(int skip) {
|
||||
else
|
||||
runppu(kFetchTime);
|
||||
}
|
||||
|
||||
if(((PPU[0]&0x38)!=0x18) && s == 2 && SpriteON ) {
|
||||
//Dragon's Lair (Europe version mapper 4)
|
||||
//does not set SpriteON in the beginning but it does
|
||||
//set the bg on so if using the conditional SpriteON the MMC3 counter
|
||||
//the counter will never count and no IRQs will be fired so use PPUON
|
||||
if(((PPU[0]&0x38)!=0x18) && s == 2 && PPUON) { //SpriteON ) {
|
||||
//(The MMC3 scanline counter is based entirely on PPU A12, triggered on rising edges (after the line remains low for a sufficiently long period of time))
|
||||
//http://nesdevwiki.org/wiki/index.php/Nintendo_MMC3
|
||||
//test cases for timing: SMB3, Crystalis
|
||||
//crystalis requires deferring this til somewhere in sprite [1,3]
|
||||
//kirby requires deferring this til somewhere in sprite [2,5..
|
||||
if(PPUON && GameHBIRQHook) {
|
||||
//if (PPUON && GameHBIRQHook) {
|
||||
if(GameHBIRQHook) {
|
||||
GameHBIRQHook();
|
||||
}
|
||||
}
|
||||
|
@ -37,4 +37,4 @@ enum PPUPHASE {
|
||||
PPUPHASE_VBL, PPUPHASE_BG, PPUPHASE_OBJ
|
||||
};
|
||||
|
||||
extern PPUPHASE ppuphase;
|
||||
extern PPUPHASE ppuphase;
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <vector>
|
||||
#include <fstream>
|
||||
|
||||
#include "version.h"
|
||||
#include "types.h"
|
||||
#include "x6502.h"
|
||||
#include "fceu.h"
|
||||
@ -1022,4 +1023,4 @@ void RedoLoadState()
|
||||
}
|
||||
redoLS = false; //Flag that RedoLoadState can not be run again
|
||||
undoLS = true; //Flag that LoadBackup can be run again
|
||||
}
|
||||
}
|
||||
|
@ -73,4 +73,4 @@ extern bool redoSS; //redo savestate flag
|
||||
extern char lastLoadstateMade[2048]; //Filename of last state loaded
|
||||
extern bool undoLS; //undo loadstate flag
|
||||
extern bool redoLS; //redo savestate flag
|
||||
bool CheckBackupSaveStateExist(); //Checks if backupsavestate exists
|
||||
bool CheckBackupSaveStateExist(); //Checks if backupsavestate exists
|
||||
|
@ -22,11 +22,6 @@
|
||||
#ifndef __FCEU_TYPES
|
||||
#define __FCEU_TYPES
|
||||
|
||||
#define FCEU_NAME "FCEUX"
|
||||
#define FCEU_VERSION_STRING "2.1.2-interim"
|
||||
#define FCEU_VERSION_NUMERIC 21020
|
||||
#define FCEU_NAME_AND_VERSION FCEU_NAME " " FCEU_VERSION_STRING
|
||||
|
||||
///causes the code fragment argument to be compiled in if the build includes debugging
|
||||
#ifdef FCEUDEF_DEBUGGER
|
||||
#define DEBUG(X) X;
|
||||
@ -130,4 +125,8 @@ typedef uint8 (*readfunc)(uint32 A);
|
||||
|
||||
#include "utils/endian.h"
|
||||
|
||||
#ifndef CTASSERT
|
||||
#define CTASSERT(x) typedef char __assert ## y[(x) ? 1 : -1];
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
65
source/fceultra/version.h
Normal file
65
source/fceultra/version.h
Normal file
@ -0,0 +1,65 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2001 Aaron Oneal
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __FCEU_VERSION
|
||||
#define __FCEU_VERSION
|
||||
|
||||
//todo - everyone will want to support this eventually, i suppose
|
||||
#ifdef _MSC_VER
|
||||
#include "svnrev.h"
|
||||
#else
|
||||
#ifdef SVN_REV
|
||||
#define SVN_REV_STR SVN_REV
|
||||
#else
|
||||
#define SVN_REV_STR ""
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define FCEU_NAME "FCEUX"
|
||||
|
||||
#define FCEU_FEATURE_STRING ""
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define FCEU_SUBVERSION_STRING " debug"
|
||||
#elif defined(PUBLIC_RELEASE)
|
||||
#define FCEU_SUBVERSION_STRING ""
|
||||
#else
|
||||
#define FCEU_SUBVERSION_STRING "-interim svn" SVN_REV_STR
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define FCEU_COMPILER ""
|
||||
#define FCEU_COMPILER_DETAIL " msvc " _Py_STRINGIZE(_MSC_VER)
|
||||
#define _Py_STRINGIZE(X) _Py_STRINGIZE1((X))
|
||||
#define _Py_STRINGIZE1(X) _Py_STRINGIZE2 ## X
|
||||
#define _Py_STRINGIZE2(X) #X
|
||||
//re: http://72.14.203.104/search?q=cache:HG-okth5NGkJ:mail.python.org/pipermail/python-checkins/2002-November/030704.html+_msc_ver+compiler+version+string&hl=en&gl=us&ct=clnk&cd=5
|
||||
#else
|
||||
// TODO: make for others compilers
|
||||
#define FCEU_COMPILER ""
|
||||
#define FCEU_COMPILER_DETAIL ""
|
||||
#endif
|
||||
|
||||
#define FCEU_VERSION_NUMERIC 21020
|
||||
#define FCEU_VERSION_STRING "2.1.2" FCEU_SUBVERSION_STRING FCEU_FEATURE_STRING FCEU_COMPILER
|
||||
#define FCEU_NAME_AND_VERSION FCEU_NAME " " FCEU_VERSION_STRING
|
||||
|
||||
#endif
|
@ -51,8 +51,8 @@ static INLINE uint8 RdMem(unsigned int A)
|
||||
static INLINE void WrMem(unsigned int A, uint8 V)
|
||||
{
|
||||
BWrite[A](A,V);
|
||||
#ifdef _S9XLUA_H
|
||||
FCEU_LuaWriteInform();
|
||||
#ifdef _S9XLUA_H
|
||||
CallRegisteredLuaMemHook(A, 1, V, LUAMEMHOOK_WRITE);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ static INLINE void WrRAM(unsigned int A, uint8 V)
|
||||
{
|
||||
RAM[A]=V;
|
||||
#ifdef _S9XLUA_H
|
||||
FCEU_LuaWriteInform();
|
||||
CallRegisteredLuaMemHook(A, 1, V, LUAMEMHOOK_WRITE);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ void X6502_DMW(uint32 A, uint8 V)
|
||||
ADDCYC(1);
|
||||
BWrite[A](A,V);
|
||||
#ifdef _S9XLUA_H
|
||||
FCEU_LuaWriteInform();
|
||||
CallRegisteredLuaMemHook(A, 1, V, LUAMEMHOOK_WRITE);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -490,6 +490,9 @@ extern int test; test++;
|
||||
_tcount=0;
|
||||
if(MapIRQHook) MapIRQHook(temp);
|
||||
FCEU_SoundCPUHook(temp);
|
||||
#ifdef _S9XLUA_H
|
||||
CallRegisteredLuaMemHook(_PC, 1, 0, LUAMEMHOOK_EXEC);
|
||||
#endif
|
||||
_PC++;
|
||||
switch(b1)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user