mirror of
https://github.com/libretro/beetle-lynx-libretro.git
synced 2024-11-26 18:01:38 +00:00
Cleanups
This commit is contained in:
parent
4f05f62622
commit
3d2fcc5a55
@ -196,17 +196,6 @@ LYNX_HEADER CCart::DecodeHeader(const uint8 *data)
|
||||
return(header);
|
||||
}
|
||||
|
||||
bool CCart::TestMagic(const uint8 *data, uint32 size)
|
||||
{
|
||||
if(size < HEADER_RAW_SIZE)
|
||||
return(false);
|
||||
|
||||
if(memcmp(data, "LYNX", 4) || data[8] != 0x01)
|
||||
return(false);
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
CCart::CCart(MDFNFILE *fp)
|
||||
{
|
||||
uint64 gamesize;
|
||||
@ -443,13 +432,8 @@ INLINE void CCart::Poke(uint32 addr, uint8 data)
|
||||
INLINE uint8 CCart::Peek(uint32 addr)
|
||||
{
|
||||
if(mBank==bank0)
|
||||
{
|
||||
return(mCartBank0[addr&mMaskBank0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
return(mCartBank1[addr&mMaskBank1]);
|
||||
}
|
||||
return(mCartBank1[addr&mMaskBank1]);
|
||||
}
|
||||
|
||||
|
||||
@ -459,11 +443,7 @@ void CCart::CartAddressStrobe(bool strobe)
|
||||
|
||||
if(mStrobe) mCounter=0;
|
||||
|
||||
//
|
||||
// Either of the two below seem to work OK.
|
||||
//
|
||||
// if(!strobe && last_strobe)
|
||||
//
|
||||
if(mStrobe && !last_strobe)
|
||||
{
|
||||
// Clock a bit into the shifter
|
||||
@ -557,9 +537,6 @@ int CCart::StateAction(StateMem *sm, int load, int data_only)
|
||||
SFARRAYN(mCartBank1, mCartRAM ? mMaskBank1 + 1 : 0, "mCartBank1"),
|
||||
SFEND
|
||||
};
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, CartRegs, "CART", false);
|
||||
|
||||
|
||||
return(ret);
|
||||
return MDFNSS_StateAction(sm, load, data_only, CartRegs, "CART", false);
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,6 @@ class CCart : public CLynxBase
|
||||
enum { HEADER_RAW_SIZE = 64 };
|
||||
|
||||
static LYNX_HEADER DecodeHeader(const uint8 *data);
|
||||
static bool TestMagic(const uint8 *data, uint32 size);
|
||||
|
||||
void Reset(void) MDFN_COLD;
|
||||
void Poke(uint32 addr,uint8 data);
|
||||
|
@ -53,17 +53,6 @@
|
||||
#include "../../scrc32.h"
|
||||
#include <algorithm>
|
||||
|
||||
bool CRam::TestMagic(const uint8* data, uint64 test_size)
|
||||
{
|
||||
if(test_size < 10)
|
||||
return false;
|
||||
|
||||
if(memcmp(&data[6], "BS93", 4))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
CRam::CRam(MDFNFILE *fp)
|
||||
:mRamXORData(NULL)
|
||||
{
|
||||
|
@ -59,7 +59,6 @@ class CRam : public CLynxBase
|
||||
|
||||
CRam(MDFNFILE *fp) MDFN_COLD;
|
||||
~CRam() MDFN_COLD;
|
||||
static bool TestMagic(const uint8* data, uint64 test_size) MDFN_COLD;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -70,8 +70,8 @@ CSystem::CSystem(MDFNFILE *fp, const char *bios_path)
|
||||
mFileType=HANDY_FILETYPE_ILLEGAL;
|
||||
|
||||
char clip[11];
|
||||
file_read(fp, clip, 11, 1);
|
||||
file_seek(fp, 0, SEEK_SET);
|
||||
file_read(fp, clip, 11, 1);
|
||||
file_seek(fp, 0, SEEK_SET);
|
||||
clip[4]=0;
|
||||
clip[10]=0;
|
||||
|
||||
@ -82,11 +82,6 @@ CSystem::CSystem(MDFNFILE *fp, const char *bios_path)
|
||||
else if(fp->size==128*1024 || fp->size==256*1024 || fp->size==512*1024)
|
||||
/* Invalid Cart (type). but 128/256/512k size -> set to RAW and try to load raw rom image */
|
||||
mFileType=HANDY_FILETYPE_RAW;
|
||||
else
|
||||
{
|
||||
/* File format is unknown to module. This will then
|
||||
* just load the core into an "Insert Game" screen */
|
||||
}
|
||||
|
||||
MDFNMP_Init(65536, 1);
|
||||
|
||||
@ -122,17 +117,14 @@ CSystem::CSystem(MDFNFILE *fp, const char *bios_path)
|
||||
mMikie = new CMikie(*this);
|
||||
mSusie = new CSusie(*this);
|
||||
|
||||
// Instantiate the memory map handler
|
||||
|
||||
// Instantiate the memory map handler
|
||||
mMemMap = new CMemMap(*this);
|
||||
|
||||
// Now the handlers are set we can instantiate the CPU as is will use handlers on reset
|
||||
|
||||
// Now the handlers are set we can instantiate the CPU as is will use handlers on reset
|
||||
mCpu = new C65C02(*this);
|
||||
|
||||
// Now init is complete do a reset, this will cause many things to be reset twice
|
||||
// but what the hell, who cares, I don't.....
|
||||
|
||||
// Now init is complete do a reset, this will cause many things to be reset twice
|
||||
// but what the hell, who cares, I don't.....
|
||||
Reset();
|
||||
}
|
||||
|
||||
@ -187,22 +179,6 @@ bool LynxLineDrawn[256];
|
||||
|
||||
CSystem *lynxie = NULL;
|
||||
|
||||
static bool TestMagic(const char *name, MDFNFILE *fp)
|
||||
{
|
||||
uint8 data[64];
|
||||
uint64 rc;
|
||||
|
||||
rc = fp->size;
|
||||
|
||||
if(rc >= CCart::HEADER_RAW_SIZE && CCart::TestMagic(data, sizeof(data)))
|
||||
return true;
|
||||
|
||||
if(rc >= CRam::HEADER_RAW_SIZE && CRam::TestMagic(data, sizeof(data)))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void Cleanup(void)
|
||||
{
|
||||
if(lynxie)
|
||||
@ -363,12 +339,6 @@ int StateAction(StateMem *sm, int load, int data_only)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void SetLayerEnableMask(uint64 mask)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
void DoSimpleCommand(int cmd)
|
||||
{
|
||||
switch(cmd)
|
||||
|
@ -61,9 +61,8 @@
|
||||
|
||||
#define HANDY_SCREEN_WIDTH 160
|
||||
#define HANDY_SCREEN_HEIGHT 102
|
||||
//
|
||||
|
||||
// Define the global variable list
|
||||
//
|
||||
|
||||
#ifdef SYSTEM_CPP
|
||||
uint32 gSuzieDoneTime = 0;
|
||||
@ -122,25 +121,16 @@ class CSystem : public CSystemBase
|
||||
|
||||
inline void Update(void)
|
||||
{
|
||||
//
|
||||
// Only update if there is a predicted timer event
|
||||
//
|
||||
if(gSystemCycleCount>=gNextTimerEvent)
|
||||
{
|
||||
mMikie->Update();
|
||||
}
|
||||
//
|
||||
|
||||
// Step the processor through 1 instruction
|
||||
//
|
||||
mCpu->Update();
|
||||
|
||||
//
|
||||
// If the CPU is asleep then skip to the next timer event
|
||||
//
|
||||
if(gSystemCPUSleep)
|
||||
{
|
||||
gSystemCycleCount=gNextTimerEvent;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user