Revert #327, at least for now

This commit is contained in:
jeblanchard 2008-05-29 03:04:44 +00:00
parent f4ab095a5e
commit 6755343a52
6 changed files with 2 additions and 82 deletions

View File

@ -12,7 +12,6 @@ file.cpp
filter.cpp
ines.cpp
input.cpp
mem-cb.cpp
netplay.cpp
nsf.cpp
palette.cpp

View File

@ -533,3 +533,5 @@ int FCEUD_ShowStatusIcon(void) {return 0;}
int FCEUI_AviIsRecording(void) {return 0;}
void FCEUI_UseInputPreset(int preset) { }
bool FCEUD_PauseAfterPlayback() { return false; }
bool moviePleaseLogSavestates = false;

View File

@ -1,29 +0,0 @@
#include "types.h"
#include "mem-cb.h"
using namespace std;
struct MEMCALLBACKS memCallbacks;
MEMCALLBACKS::~MEMCALLBACKS()
{
delete read_cb;
delete write_cb;
}
void FCEU_AddressReadCallback(uint32 A, readfunc cb)
{
if (!memCallbacks. read_cb) memCallbacks. read_cb = new map<uint32, readfunc>;
(*memCallbacks. read_cb)[FCEU_AddressCanonicalize(A)] = cb;
}
void FCEU_AddressWriteCallback(uint32 A, writefunc cb)
{
if (!memCallbacks.write_cb) memCallbacks.write_cb = new map<uint32, writefunc>;
(*memCallbacks.write_cb)[FCEU_AddressCanonicalize(A)] = cb;
}
uint32 FCEU_AddressCanonicalize(uint32 A)
{
if (A >= 0x0800 && A < 0x2000) return (A & 0x07FF);
return A;
}

View File

@ -1,17 +0,0 @@
#ifndef MEM_CB_H
#define MEM_CB_H
#include <map>
void FCEU_AddressReadCallback(uint32 A, readfunc cb);
void FCEU_AddressWriteCallback(uint32 A, writefunc cb);
uint32 FCEU_AddressCanonicalize(uint32 A);
extern struct MEMCALLBACKS
{
std::map<uint32, readfunc> * read_cb;
std::map<uint32, writefunc> *write_cb;
~MEMCALLBACKS();
} memCallbacks;
#endif

View File

@ -24,7 +24,6 @@
#include "fceu.h"
#include "debug.h"
#include "sound.h"
#include "mem-cb.h"
X6502 X;
uint32 timestamp;
@ -38,65 +37,39 @@ void FP_FASTAPASS(1) (*MapIRQHook)(int a);
timestamp+=__x; \
}
static INLINE void RdRunCB(unsigned int A)
{
if (memCallbacks.read_cb)
{
std::map<uint32, readfunc>::const_iterator i =
memCallbacks.read_cb->find(FCEU_AddressCanonicalize(A));
if (i != memCallbacks.read_cb->end()) (i->second)(A);
}
}
static INLINE void WrRunCB(unsigned int A, uint8 V)
{
if (memCallbacks.write_cb)
{
std::map<uint32, writefunc>::const_iterator i =
memCallbacks.write_cb->find(FCEU_AddressCanonicalize(A));
if (i != memCallbacks.write_cb->end()) (i->second)(A, V);
}
}
//normal memory read
static INLINE uint8 RdMem(unsigned int A)
{
RdRunCB(A);
return(_DB=ARead[A](A));
}
//normal memory write
static INLINE void WrMem(unsigned int A, uint8 V)
{
WrRunCB(A, V);
BWrite[A](A,V);
}
static INLINE uint8 RdRAM(unsigned int A)
{
//bbit edited: this was changed so cheat substituion would work
RdRunCB(A);
return(_DB=ARead[A](A));
// return(_DB=RAM[A]);
}
static INLINE void WrRAM(unsigned int A, uint8 V)
{
WrRunCB(A, V);
RAM[A]=V;
}
uint8 FASTAPASS(1) X6502_DMR(uint32 A)
{
ADDCYC(1);
RdRunCB(A);
return(X.DB=ARead[A](A));
}
void FASTAPASS(2) X6502_DMW(uint32 A, uint8 V)
{
ADDCYC(1);
WrRunCB(A, V);
BWrite[A](A,V);
}

View File

@ -1526,10 +1526,6 @@
RelativePath="..\src\input.h"
>
</File>
<File
RelativePath="..\src\mem-cb.h"
>
</File>
<File
RelativePath="..\src\memory.h"
>
@ -2260,10 +2256,6 @@
RelativePath="..\src\input.cpp"
>
</File>
<File
RelativePath="..\src\mem-cb.cpp"
>
</File>
<File
RelativePath="..\src\movie.cpp"
>