bizswan: stuff
This commit is contained in:
parent
c306e61d5b
commit
ab93da6faf
|
@ -11,21 +11,78 @@ namespace BizHawk.Emulation.Cores.WonderSwan
|
||||||
const CallingConvention cc = CallingConvention.Cdecl;
|
const CallingConvention cc = CallingConvention.Cdecl;
|
||||||
const string dd = "bizswan.dll";
|
const string dd = "bizswan.dll";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// create new instance
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
[DllImport(dd, CallingConvention = cc)]
|
[DllImport(dd, CallingConvention = cc)]
|
||||||
public static extern IntPtr bizswan_new();
|
public static extern IntPtr bizswan_new();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// delete instance, freeing all associated memory
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="core"></param>
|
||||||
[DllImport(dd, CallingConvention = cc)]
|
[DllImport(dd, CallingConvention = cc)]
|
||||||
public static extern void bizswan_delete(IntPtr core);
|
public static extern void bizswan_delete(IntPtr core);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// hard reset
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="core"></param>
|
||||||
[DllImport(dd, CallingConvention = cc)]
|
[DllImport(dd, CallingConvention = cc)]
|
||||||
public static extern void bizswan_reset(IntPtr core);
|
public static extern void bizswan_reset(IntPtr core);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// frame advance
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="core"></param>
|
||||||
|
/// <param name="buttons">input to use on this frame</param>
|
||||||
|
/// <param name="novideo">true to skip all video rendering</param>
|
||||||
|
/// <param name="surface">uint32 video output buffer</param>
|
||||||
|
/// <param name="soundbuff">int16 sound output buffer</param>
|
||||||
|
/// <param name="soundbuffsize">[In] max hold size of soundbuff [Out] number of samples actually deposited</param>
|
||||||
[DllImport(dd, CallingConvention = cc)]
|
[DllImport(dd, CallingConvention = cc)]
|
||||||
public static extern void bizswan_advance(IntPtr core, Buttons buttons, bool novideo, int[] surface, short[] soundbuff, ref int soundbuffsize);
|
public static extern void bizswan_advance(IntPtr core, Buttons buttons, bool novideo, int[] surface, short[] soundbuff, ref int soundbuffsize);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// load rom
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="core"></param>
|
||||||
|
/// <param name="data"></param>
|
||||||
|
/// <param name="length"></param>
|
||||||
|
/// <param name="settings"></param>
|
||||||
|
/// <returns></returns>
|
||||||
[DllImport(dd, CallingConvention = cc)]
|
[DllImport(dd, CallingConvention = cc)]
|
||||||
public static extern bool bizswan_load(IntPtr core, byte[] data, int length, [In] ref Settings settings);
|
public static extern bool bizswan_load(IntPtr core, byte[] data, int length, [In] ref Settings settings);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// get size of saveram
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="core"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[DllImport(dd, CallingConvention = cc)]
|
||||||
|
public static extern int bizswan_saveramsize(IntPtr core);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// load saveram into core
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="core"></param>
|
||||||
|
/// <param name="data"></param>
|
||||||
|
/// <param name="size">should be same as bizswan_saveramsize()</param>
|
||||||
|
/// <returns>false if size mismatch</returns>
|
||||||
|
[DllImport(dd, CallingConvention = cc)]
|
||||||
|
public static extern bool bizswan_saveramload(IntPtr core, byte[] data, int size);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// save saveram from core
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="core"></param>
|
||||||
|
/// <param name="data"></param>
|
||||||
|
/// <param name="maxsize">should be same as bizswan_saveramsize()</param>
|
||||||
|
/// <returns>false if size mismatch</returns>
|
||||||
|
[DllImport(dd, CallingConvention = cc)]
|
||||||
|
public static extern bool bizswan_saveramsave(IntPtr core, byte[] data, int maxsize);
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum Buttons : ushort
|
public enum Buttons : ushort
|
||||||
{
|
{
|
||||||
|
|
|
@ -65,6 +65,8 @@ namespace BizHawk.Emulation.Cores.WonderSwan
|
||||||
|
|
||||||
CoreComm.VsyncNum = 3072000; // master CPU clock, also pixel clock
|
CoreComm.VsyncNum = 3072000; // master CPU clock, also pixel clock
|
||||||
CoreComm.VsyncDen = (144 + 15) * (224 + 32); // 144 vislines, 15 vblank lines; 224 vispixels, 32 hblank pixels
|
CoreComm.VsyncDen = (144 + 15) * (224 + 32); // 144 vislines, 15 vblank lines; 224 vispixels, 32 hblank pixels
|
||||||
|
|
||||||
|
saverambuff = new byte[BizSwan.bizswan_saveramsize(Core)];
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
@ -101,6 +103,15 @@ namespace BizHawk.Emulation.Cores.WonderSwan
|
||||||
LagCount++;
|
LagCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CoreComm CoreComm { get; private set; }
|
||||||
|
|
||||||
|
public void ResetCounters()
|
||||||
|
{
|
||||||
|
Frame = 0;
|
||||||
|
IsLagFrame = false;
|
||||||
|
LagCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
IntPtr Core;
|
IntPtr Core;
|
||||||
|
|
||||||
public int Frame { get; private set; }
|
public int Frame { get; private set; }
|
||||||
|
@ -114,40 +125,34 @@ namespace BizHawk.Emulation.Cores.WonderSwan
|
||||||
|
|
||||||
#region SaveRam
|
#region SaveRam
|
||||||
|
|
||||||
|
byte[] saverambuff;
|
||||||
|
|
||||||
public byte[] ReadSaveRam()
|
public byte[] ReadSaveRam()
|
||||||
{
|
{
|
||||||
return new byte[0];
|
if (!BizSwan.bizswan_saveramsave(Core, saverambuff, saverambuff.Length))
|
||||||
|
throw new InvalidOperationException("bizswan_saveramsave() returned false!");
|
||||||
|
return saverambuff;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StoreSaveRam(byte[] data)
|
public void StoreSaveRam(byte[] data)
|
||||||
{
|
{
|
||||||
|
if (!BizSwan.bizswan_saveramload(Core, data, data.Length))
|
||||||
|
throw new InvalidOperationException("bizswan_saveramload() returned false!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearSaveRam()
|
public void ClearSaveRam()
|
||||||
{
|
{
|
||||||
|
throw new InvalidOperationException("A new core starts with a clear saveram. Instantiate a new core if you want this.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SaveRamModified
|
public bool SaveRamModified
|
||||||
{
|
{
|
||||||
get
|
get { return BizSwan.bizswan_saveramsize(Core) > 0; }
|
||||||
{
|
set { throw new InvalidOperationException(); }
|
||||||
return false;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public void ResetCounters()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Savestates
|
#region Savestates
|
||||||
|
|
||||||
public void SaveStateText(TextWriter writer)
|
public void SaveStateText(TextWriter writer)
|
||||||
|
@ -178,8 +183,6 @@ namespace BizHawk.Emulation.Cores.WonderSwan
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public CoreComm CoreComm { get; private set; }
|
|
||||||
|
|
||||||
#region Debugging
|
#region Debugging
|
||||||
|
|
||||||
public MemoryDomainList MemoryDomains
|
public MemoryDomainList MemoryDomains
|
||||||
|
|
Binary file not shown.
|
@ -24,8 +24,6 @@
|
||||||
|
|
||||||
namespace MDFN_IEN_WSWAN
|
namespace MDFN_IEN_WSWAN
|
||||||
{
|
{
|
||||||
//uint8 wsEEPROM[2048];
|
|
||||||
//static uint8 iEEPROM[0x400];
|
|
||||||
static const uint8 iEEPROM_Init[0x400] =
|
static const uint8 iEEPROM_Init[0x400] =
|
||||||
{
|
{
|
||||||
255,255,255,255,255,255,192,255,0,0,0,0,
|
255,255,255,255,255,255,192,255,0,0,0,0,
|
||||||
|
|
|
@ -16,11 +16,14 @@ public:
|
||||||
void Init(const char *Name, const uint16 BYear, const uint8 BMonth, const uint8 BDay, const uint8 Sex, const uint8 Blood);
|
void Init(const char *Name, const uint16 BYear, const uint8 BMonth, const uint8 BDay, const uint8 Sex, const uint8 Blood);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8 wsEEPROM[2048];
|
|
||||||
uint8 iEEPROM[0x400];
|
|
||||||
uint8 iEEPROM_Command, EEPROM_Command;
|
uint8 iEEPROM_Command, EEPROM_Command;
|
||||||
uint16 iEEPROM_Address, EEPROM_Address;
|
uint16 iEEPROM_Address, EEPROM_Address;
|
||||||
|
public:
|
||||||
uint32 eeprom_size;
|
uint32 eeprom_size;
|
||||||
|
uint8 iEEPROM[0x400];
|
||||||
|
uint8 wsEEPROM[2048];
|
||||||
|
|
||||||
|
enum { ieeprom_size = 0x400 };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
System *sys;
|
System *sys;
|
||||||
|
|
|
@ -26,14 +26,11 @@
|
||||||
namespace MDFN_IEN_WSWAN
|
namespace MDFN_IEN_WSWAN
|
||||||
{
|
{
|
||||||
GFX::GFX()
|
GFX::GFX()
|
||||||
|
:LayerEnabled(7) // 1 = bg, 2 = fg, 4 = sprite
|
||||||
{
|
{
|
||||||
SetPixelFormat();
|
SetPixelFormat();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GFX::Init()
|
|
||||||
{
|
|
||||||
LayerEnabled = 7; // BG, FG, sprites
|
|
||||||
}
|
|
||||||
|
|
||||||
void GFX::PaletteRAMWrite(uint32 ws_offset, uint8 data)
|
void GFX::PaletteRAMWrite(uint32 ws_offset, uint8 data)
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,7 +20,6 @@ public:
|
||||||
void Scanline(uint32 *target);
|
void Scanline(uint32 *target);
|
||||||
void SetPixelFormat();
|
void SetPixelFormat();
|
||||||
|
|
||||||
void Init();
|
|
||||||
void Reset();
|
void Reset();
|
||||||
void Write(uint32 A, uint8 V);
|
void Write(uint32 A, uint8 V);
|
||||||
uint8 Read(uint32 A);
|
uint8 Read(uint32 A);
|
||||||
|
|
|
@ -289,42 +289,13 @@ namespace MDFN_IEN_WSWAN
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
void Memory::Init(const Settings &settings)
|
||||||
void Memory::Kill()
|
|
||||||
{
|
|
||||||
if((sram_size || eeprom_size) && !SkipSL)
|
|
||||||
{
|
|
||||||
|
|
||||||
std::vector<PtrLengthPair> EvilRams;
|
|
||||||
|
|
||||||
if(eeprom_size)
|
|
||||||
EvilRams.push_back(PtrLengthPair(wsEEPROM, eeprom_size));
|
|
||||||
|
|
||||||
if(sram_size)
|
|
||||||
EvilRams.push_back(PtrLengthPair(wsSRAM, sram_size));
|
|
||||||
|
|
||||||
MDFN_DumpToFile(MDFN_MakeFName(MDFNMKF_SAV, 0, "sav").c_str(), 6, EvilRams);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if(wsSRAM)
|
|
||||||
{
|
|
||||||
free(wsSRAM);
|
|
||||||
wsSRAM = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
void Memory::Init(bool SkipSaveLoad, const Settings &settings)
|
|
||||||
{
|
{
|
||||||
char tmpname[17];
|
char tmpname[17];
|
||||||
std::memcpy(tmpname, settings.name, 16);
|
std::memcpy(tmpname, settings.name, 16);
|
||||||
tmpname[16] = 0;
|
tmpname[16] = 0;
|
||||||
|
|
||||||
|
|
||||||
language = settings.language;
|
language = settings.language;
|
||||||
SkipSL = SkipSaveLoad;
|
|
||||||
|
|
||||||
|
|
||||||
// WSwan_EEPROMInit() will also clear wsEEPROM
|
// WSwan_EEPROMInit() will also clear wsEEPROM
|
||||||
sys->eeprom.Init(tmpname, settings.byear, settings.bmonth, settings.bday, settings.sex, settings.blood);
|
sys->eeprom.Init(tmpname, settings.byear, settings.bmonth, settings.bday, settings.sex, settings.blood);
|
||||||
|
@ -334,28 +305,6 @@ namespace MDFN_IEN_WSWAN
|
||||||
wsSRAM = (uint8*)malloc(sram_size);
|
wsSRAM = (uint8*)malloc(sram_size);
|
||||||
memset(wsSRAM, 0, sram_size);
|
memset(wsSRAM, 0, sram_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: SAVERAM
|
|
||||||
if((sram_size || eeprom_size) && !SkipSL)
|
|
||||||
{
|
|
||||||
gzFile savegame_fp;
|
|
||||||
|
|
||||||
savegame_fp = gzopen(MDFN_MakeFName(MDFNMKF_SAV, 0, "sav").c_str(), "rb");
|
|
||||||
if(savegame_fp)
|
|
||||||
{
|
|
||||||
if(eeprom_size)
|
|
||||||
gzread(savegame_fp, wsEEPROM, eeprom_size);
|
|
||||||
if(sram_size)
|
|
||||||
gzread(savegame_fp, wsSRAM, sram_size);
|
|
||||||
gzclose(savegame_fp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
//MDFNMP_AddRAM(wsRAMSize, 0x00000, wsRAM); // 65536
|
|
||||||
|
|
||||||
//if(sram_size)
|
|
||||||
// MDFNMP_AddRAM(sram_size, 0x10000, wsSRAM);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Memory::Reset()
|
void Memory::Reset()
|
||||||
|
|
|
@ -13,8 +13,7 @@ public:
|
||||||
uint8 Read20(uint32);
|
uint8 Read20(uint32);
|
||||||
void Write20(uint32 address,uint8 data);
|
void Write20(uint32 address,uint8 data);
|
||||||
|
|
||||||
void Init(bool SkipSaveLoad, const Settings &settings);
|
void Init(const Settings &settings);
|
||||||
//void Kill();
|
|
||||||
|
|
||||||
void CheckSoundDMA();
|
void CheckSoundDMA();
|
||||||
void Reset();
|
void Reset();
|
||||||
|
@ -22,21 +21,17 @@ public:
|
||||||
uint8 readport(uint32 number);
|
uint8 readport(uint32 number);
|
||||||
uint32 GetRegister(const unsigned int id, char *special, const uint32 special_len);
|
uint32 GetRegister(const unsigned int id, char *special, const uint32 special_len);
|
||||||
void SetRegister(const unsigned int id, uint32 value);
|
void SetRegister(const unsigned int id, uint32 value);
|
||||||
|
|
||||||
private:
|
|
||||||
bool SkipSL; // Skip save and load
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
uint8 wsRAM[65536];
|
uint8 wsRAM[65536];
|
||||||
uint8 *wsCartROM;
|
uint8 *wsCartROM;
|
||||||
uint32 rom_size;
|
uint32 rom_size;
|
||||||
uint32 sram_size;
|
uint32 sram_size;
|
||||||
uint32 eeprom_size;
|
uint8 *wsSRAM; // = NULL;
|
||||||
|
|
||||||
uint16 WSButtonStatus; // bitfield of buttons, indeed
|
uint16 WSButtonStatus; // bitfield of buttons, indeed
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8 *wsSRAM; // = NULL;
|
|
||||||
|
|
||||||
|
|
||||||
uint8 ButtonWhich, ButtonReadLatch;
|
uint8 ButtonWhich, ButtonReadLatch;
|
||||||
|
@ -63,13 +58,6 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//extern uint8 wsRAM[65536];
|
|
||||||
//extern uint8 *wsCartROM;
|
|
||||||
//extern uint32 eeprom_size;
|
|
||||||
//extern uint8 wsEEPROM[2048];
|
|
||||||
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
MEMORY_GSREG_ROMBBSLCT = 0,
|
MEMORY_GSREG_ROMBBSLCT = 0,
|
||||||
|
|
|
@ -23,14 +23,6 @@
|
||||||
|
|
||||||
namespace MDFN_IEN_WSWAN
|
namespace MDFN_IEN_WSWAN
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
|
||||||
static uint64 CurrentTime;
|
|
||||||
static uint32 ClockCycleCounter;
|
|
||||||
static uint8 wsCA15;
|
|
||||||
static uint8 Command, Data;
|
|
||||||
*/
|
|
||||||
|
|
||||||
void RTC::Write(uint32 A, uint8 V)
|
void RTC::Write(uint32 A, uint8 V)
|
||||||
{
|
{
|
||||||
switch(A)
|
switch(A)
|
||||||
|
|
|
@ -309,10 +309,6 @@ namespace MDFN_IEN_WSWAN
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sound::Init()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Sound::Sound()
|
Sound::Sound()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < 2; i++)
|
for(int i = 0; i < 2; i++)
|
||||||
|
|
|
@ -15,8 +15,6 @@ public:
|
||||||
|
|
||||||
int32 Flush(int16 *SoundBuf, const int32 MaxSoundFrames);
|
int32 Flush(int16 *SoundBuf, const int32 MaxSoundFrames);
|
||||||
|
|
||||||
void Init();
|
|
||||||
void Kill();
|
|
||||||
void SetMultiplier(double multiplier);
|
void SetMultiplier(double multiplier);
|
||||||
bool SetRate(uint32 rate);
|
bool SetRate(uint32 rate);
|
||||||
|
|
||||||
|
|
|
@ -267,3 +267,50 @@ const uint8 startio[256]={
|
||||||
0xd1,//fd
|
0xd1,//fd
|
||||||
0xd1,//fe
|
0xd1,//fe
|
||||||
0xd1};//ff
|
0xd1};//ff
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
const uint8 id;
|
||||||
|
const char *name;
|
||||||
|
} DLEntry;
|
||||||
|
|
||||||
|
static const DLEntry Developers[] =
|
||||||
|
{
|
||||||
|
{ 0x01, "Bandai" },
|
||||||
|
{ 0x02, "Taito" },
|
||||||
|
{ 0x03, "Tomy" },
|
||||||
|
{ 0x04, "Koei" },
|
||||||
|
{ 0x05, "Data East" },
|
||||||
|
{ 0x06, "Asmik" }, // Asmik Ace?
|
||||||
|
{ 0x07, "Media Entertainment" },
|
||||||
|
{ 0x08, "Nichibutsu" },
|
||||||
|
{ 0x0A, "Coconuts Japan" },
|
||||||
|
{ 0x0B, "Sammy" },
|
||||||
|
{ 0x0C, "Sunsoft" },
|
||||||
|
{ 0x0D, "Mebius" },
|
||||||
|
{ 0x0E, "Banpresto" },
|
||||||
|
{ 0x10, "Jaleco" },
|
||||||
|
{ 0x11, "Imagineer" },
|
||||||
|
{ 0x12, "Konami" },
|
||||||
|
{ 0x16, "Kobunsha" },
|
||||||
|
{ 0x17, "Bottom Up" },
|
||||||
|
{ 0x18, "Naxat" }, // Mechanic Arms? Media Entertainment? Argh!
|
||||||
|
{ 0x19, "Sunrise" },
|
||||||
|
{ 0x1A, "Cyberfront" },
|
||||||
|
{ 0x1B, "Megahouse" },
|
||||||
|
{ 0x1D, "Interbec" },
|
||||||
|
{ 0x1E, "NAC" },
|
||||||
|
{ 0x1F, "Emotion" }, // Bandai Visual??
|
||||||
|
{ 0x20, "Athena" },
|
||||||
|
{ 0x21, "KID" },
|
||||||
|
{ 0x24, "Omega Micott" },
|
||||||
|
{ 0x25, "Upstar" },
|
||||||
|
{ 0x26, "Kadokawa/Megas" },
|
||||||
|
{ 0x27, "Cocktail Soft" },
|
||||||
|
{ 0x28, "Squaresoft" },
|
||||||
|
{ 0x2B, "TomCreate" },
|
||||||
|
{ 0x2D, "Namco" },
|
||||||
|
{ 0x2F, "Gust" },
|
||||||
|
{ 0x36, "Capcom" },
|
||||||
|
};
|
||||||
|
|
|
@ -29,53 +29,21 @@
|
||||||
namespace MDFN_IEN_WSWAN
|
namespace MDFN_IEN_WSWAN
|
||||||
{
|
{
|
||||||
|
|
||||||
#include "start.inc"
|
// maybe change?
|
||||||
|
int Debug::puts ( const char * str )
|
||||||
|
{
|
||||||
|
return std::puts(str);
|
||||||
|
}
|
||||||
|
int Debug::printf ( const char * format, ... )
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
va_start(args, format);
|
||||||
|
int ret = vprintf(format, args);
|
||||||
|
va_end(args);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct
|
#include "start.inc"
|
||||||
{
|
|
||||||
const uint8 id;
|
|
||||||
const char *name;
|
|
||||||
} DLEntry;
|
|
||||||
|
|
||||||
static const DLEntry Developers[] =
|
|
||||||
{
|
|
||||||
{ 0x01, "Bandai" },
|
|
||||||
{ 0x02, "Taito" },
|
|
||||||
{ 0x03, "Tomy" },
|
|
||||||
{ 0x04, "Koei" },
|
|
||||||
{ 0x05, "Data East" },
|
|
||||||
{ 0x06, "Asmik" }, // Asmik Ace?
|
|
||||||
{ 0x07, "Media Entertainment" },
|
|
||||||
{ 0x08, "Nichibutsu" },
|
|
||||||
{ 0x0A, "Coconuts Japan" },
|
|
||||||
{ 0x0B, "Sammy" },
|
|
||||||
{ 0x0C, "Sunsoft" },
|
|
||||||
{ 0x0D, "Mebius" },
|
|
||||||
{ 0x0E, "Banpresto" },
|
|
||||||
{ 0x10, "Jaleco" },
|
|
||||||
{ 0x11, "Imagineer" },
|
|
||||||
{ 0x12, "Konami" },
|
|
||||||
{ 0x16, "Kobunsha" },
|
|
||||||
{ 0x17, "Bottom Up" },
|
|
||||||
{ 0x18, "Naxat" }, // Mechanic Arms? Media Entertainment? Argh!
|
|
||||||
{ 0x19, "Sunrise" },
|
|
||||||
{ 0x1A, "Cyberfront" },
|
|
||||||
{ 0x1B, "Megahouse" },
|
|
||||||
{ 0x1D, "Interbec" },
|
|
||||||
{ 0x1E, "NAC" },
|
|
||||||
{ 0x1F, "Emotion" }, // Bandai Visual??
|
|
||||||
{ 0x20, "Athena" },
|
|
||||||
{ 0x21, "KID" },
|
|
||||||
{ 0x24, "Omega Micott" },
|
|
||||||
{ 0x25, "Upstar" },
|
|
||||||
{ 0x26, "Kadokawa/Megas" },
|
|
||||||
{ 0x27, "Cocktail Soft" },
|
|
||||||
{ 0x28, "Squaresoft" },
|
|
||||||
{ 0x2B, "TomCreate" },
|
|
||||||
{ 0x2D, "Namco" },
|
|
||||||
{ 0x2F, "Gust" },
|
|
||||||
{ 0x36, "Capcom" },
|
|
||||||
};
|
|
||||||
|
|
||||||
void System::Reset()
|
void System::Reset()
|
||||||
{
|
{
|
||||||
|
@ -179,7 +147,7 @@ namespace MDFN_IEN_WSWAN
|
||||||
}
|
}
|
||||||
|
|
||||||
memory.sram_size = 0;
|
memory.sram_size = 0;
|
||||||
memory.eeprom_size = 0;
|
eeprom.eeprom_size = 0;
|
||||||
|
|
||||||
switch(header[5])
|
switch(header[5])
|
||||||
{
|
{
|
||||||
|
@ -188,15 +156,15 @@ namespace MDFN_IEN_WSWAN
|
||||||
case 0x03: memory.sram_size = 16 * 65536; break;
|
case 0x03: memory.sram_size = 16 * 65536; break;
|
||||||
case 0x04: memory.sram_size = 32 * 65536; break; // Dicing Knight!
|
case 0x04: memory.sram_size = 32 * 65536; break; // Dicing Knight!
|
||||||
|
|
||||||
case 0x10: memory.eeprom_size = 128; break;
|
case 0x10: eeprom.eeprom_size = 128; break;
|
||||||
case 0x20: memory.eeprom_size = 2*1024; break;
|
case 0x20: eeprom.eeprom_size = 2*1024; break;
|
||||||
case 0x50: memory.eeprom_size = 1024; break;
|
case 0x50: eeprom.eeprom_size = 1024; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//printf("%02x\n", header[5]);
|
//printf("%02x\n", header[5]);
|
||||||
|
|
||||||
if(memory.eeprom_size)
|
if(eeprom.eeprom_size)
|
||||||
Debug::printf("EEPROM: %d bytes\n", memory.eeprom_size);
|
Debug::printf("EEPROM: %d bytes\n", eeprom.eeprom_size);
|
||||||
|
|
||||||
if(memory.sram_size)
|
if(memory.sram_size)
|
||||||
Debug::printf("Battery-backed RAM: %d bytes\n", memory.sram_size);
|
Debug::printf("Battery-backed RAM: %d bytes\n", memory.sram_size);
|
||||||
|
@ -229,18 +197,13 @@ namespace MDFN_IEN_WSWAN
|
||||||
|
|
||||||
//MDFNMP_Init(16384, (1 << 20) / 1024);
|
//MDFNMP_Init(16384, (1 << 20) / 1024);
|
||||||
|
|
||||||
cpu.init();
|
|
||||||
|
|
||||||
// TODO: control WSC setting
|
// TODO: control WSC setting
|
||||||
// TODO: rip out skipsaveload code
|
|
||||||
|
|
||||||
memory.Init(false, settings);
|
memory.Init(settings);
|
||||||
|
|
||||||
gfx.Init();
|
|
||||||
//MDFNGameInfo->fps = (uint32)((uint64)3072000 * 65536 * 256 / (159*256));
|
//MDFNGameInfo->fps = (uint32)((uint64)3072000 * 65536 * 256 / (159*256));
|
||||||
|
|
||||||
sound.Init();
|
|
||||||
|
|
||||||
gfx.MakeTiles();
|
gfx.MakeTiles();
|
||||||
|
|
||||||
Reset();
|
Reset();
|
||||||
|
@ -271,20 +234,44 @@ namespace MDFN_IEN_WSWAN
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// maybe change?
|
int System::SaveRamSize()
|
||||||
int Debug::puts ( const char * str )
|
|
||||||
{
|
{
|
||||||
return std::puts(str);
|
return eeprom.ieeprom_size + eeprom.eeprom_size + memory.sram_size;
|
||||||
}
|
}
|
||||||
int Debug::printf ( const char * format, ... )
|
bool System::SaveRamLoad(const uint8 *data, int size)
|
||||||
{
|
{
|
||||||
va_list args;
|
if (size != SaveRamSize())
|
||||||
va_start(args, format);
|
return false;
|
||||||
int ret = vprintf(format, args);
|
|
||||||
va_end(args);
|
#define LOAD(sz,ptr) { if (sz) { std::memcpy((ptr), data, (sz)); data += (sz); } }
|
||||||
return ret;
|
|
||||||
|
LOAD(eeprom.ieeprom_size, eeprom.iEEPROM);
|
||||||
|
LOAD(eeprom.eeprom_size, eeprom.wsEEPROM);
|
||||||
|
LOAD(memory.sram_size, memory.wsSRAM);
|
||||||
|
|
||||||
|
#undef LOAD
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool System::SaveRamSave(uint8 *dest, int maxsize)
|
||||||
|
{
|
||||||
|
if (maxsize != SaveRamSize())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
#define SAVE(sz,ptr) { if (sz) { std::memcpy(dest, (ptr), (sz)); dest += (sz); } }
|
||||||
|
|
||||||
|
SAVE(eeprom.ieeprom_size, eeprom.iEEPROM);
|
||||||
|
SAVE(eeprom.eeprom_size, eeprom.wsEEPROM);
|
||||||
|
SAVE(memory.sram_size, memory.wsSRAM);
|
||||||
|
|
||||||
|
#undef SAVE
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EXPORT System *bizswan_new()
|
EXPORT System *bizswan_new()
|
||||||
|
@ -312,4 +299,19 @@ namespace MDFN_IEN_WSWAN
|
||||||
return s->Load(data, length, *settings);
|
return s->Load(data, length, *settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EXPORT int bizswan_saveramsize(System *s)
|
||||||
|
{
|
||||||
|
return s->SaveRamSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPORT int bizswan_saveramload(System *s, const uint8 *data, int size)
|
||||||
|
{
|
||||||
|
return s->SaveRamLoad(data, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPORT int bizswan_saveramsave(System *s, uint8 *dest, int maxsize)
|
||||||
|
{
|
||||||
|
return s->SaveRamSave(dest, maxsize);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,10 @@ public:
|
||||||
void Advance(uint16 buttons, bool novideo, uint32 *surface, int16 *soundbuff, int &soundbuffsize);
|
void Advance(uint16 buttons, bool novideo, uint32 *surface, int16 *soundbuff, int &soundbuffsize);
|
||||||
bool Load(const uint8 *data, int length, const Settings &s);
|
bool Load(const uint8 *data, int length, const Settings &s);
|
||||||
|
|
||||||
|
int SaveRamSize();
|
||||||
|
bool SaveRamLoad(const uint8 *data, int size);
|
||||||
|
bool SaveRamSave(uint8 *dest, int maxsize);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GFX gfx;
|
GFX gfx;
|
||||||
Memory memory;
|
Memory memory;
|
||||||
|
|
|
@ -126,11 +126,6 @@ namespace MDFN_IEN_WSWAN
|
||||||
SetupEA();
|
SetupEA();
|
||||||
}
|
}
|
||||||
|
|
||||||
void V30MZ::init()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void V30MZ::reset()
|
void V30MZ::reset()
|
||||||
{
|
{
|
||||||
const BREGS reg_name[8] = { AL, CL, DL, BL, AH, CH, DH, BH };
|
const BREGS reg_name[8] = { AL, CL, DL, BL, AH, CH, DH, BH };
|
||||||
|
|
|
@ -46,7 +46,6 @@ public:
|
||||||
void set_reg(int, unsigned);
|
void set_reg(int, unsigned);
|
||||||
unsigned get_reg(int regnum);
|
unsigned get_reg(int regnum);
|
||||||
void reset();
|
void reset();
|
||||||
void init();
|
|
||||||
|
|
||||||
void interrupt(uint32 vector, bool IgnoreIF = FALSE);
|
void interrupt(uint32 vector, bool IgnoreIF = FALSE);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue