#ifndef SYSTEM_H
#define SYSTEM_H
namespace MDFN_IEN_WSWAN
{
class System;
struct SyncSettings;
struct Settings;
}
#include "wswan.h"
#include "newstate.h"
#include "gfx.h"
#include "memory.h"
#include "eeprom.h"
#include "rtc.h"
#include "sound.h"
#include "v30mz.h"
#include "interrupt.h"
#include <cstddef>
namespace MDFN_IEN_WSWAN
{
class System
{
public:
System();
~System();
static void* operator new(std::size_t size);
void Reset();
bool Advance(uint32 buttons, bool novideo, uint32 *surface, int16 *soundbuff, int &soundbuffsize);
bool Load(const uint8 *data, int length, const SyncSettings &s);
void PutSettings(const Settings &s);
int SaveRamSize() const;
bool SaveRamLoad(const uint8 *data, int size);
bool SaveRamSave(uint8 *dest, int maxsize) const;
uint32 GetNECReg(int which) const;
bool GetMemoryArea(int index, const char *&name, int &size, uint8 *&data);
public:
GFX gfx;
Memory memory;
EEPROM eeprom;
RTC rtc;
Sound sound;
V30MZ cpu;
Interrupt interrupt;
bool rotate;
uint32 oldbuttons;
template<bool isReader>void SyncState(NewState *ns);
};
struct SyncSettings
{
uint64 initialtime;
uint32 byear;
uint32 bmonth;
uint32 bday;
uint32 color;
uint32 userealtime;
uint32 language;
uint32 sex;
uint32 blood;
char name[17];
};
struct Settings
{
uint32 LayerMask;
uint32 BWPalette[16];
uint32 ColorPalette[4096];
};
namespace Debug
{
int puts ( const char * str );
int printf ( const char * format, ... );
}
}
#endif