2014-05-30 05:09:54 +00:00
|
|
|
#ifndef SYSTEM_H
|
|
|
|
#define SYSTEM_H
|
|
|
|
|
|
|
|
namespace MDFN_IEN_WSWAN
|
|
|
|
{
|
|
|
|
class System;
|
2014-05-30 18:10:39 +00:00
|
|
|
struct SyncSettings;
|
2014-05-30 05:09:54 +00:00
|
|
|
struct Settings;
|
|
|
|
}
|
2014-05-31 05:57:18 +00:00
|
|
|
|
2014-05-30 05:09:54 +00:00
|
|
|
#include "wswan.h"
|
2014-05-31 05:57:18 +00:00
|
|
|
|
|
|
|
#include "newstate.h"
|
|
|
|
|
2014-05-30 05:09:54 +00:00
|
|
|
#include "gfx.h"
|
|
|
|
#include "memory.h"
|
|
|
|
#include "eeprom.h"
|
|
|
|
#include "rtc.h"
|
|
|
|
#include "sound.h"
|
|
|
|
#include "v30mz.h"
|
|
|
|
#include "interrupt.h"
|
|
|
|
|
|
|
|
#include <cstddef>
|
2014-05-31 05:57:18 +00:00
|
|
|
|
2014-05-30 05:09:54 +00:00
|
|
|
namespace MDFN_IEN_WSWAN
|
|
|
|
{
|
|
|
|
class System
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
System();
|
|
|
|
~System();
|
|
|
|
|
|
|
|
static void* operator new(std::size_t size);
|
|
|
|
|
|
|
|
void Reset();
|
2014-06-04 23:26:57 +00:00
|
|
|
bool Advance(uint32 buttons, bool novideo, uint32 *surface, int16 *soundbuff, int &soundbuffsize);
|
2014-05-30 18:10:39 +00:00
|
|
|
bool Load(const uint8 *data, int length, const SyncSettings &s);
|
2014-05-30 22:31:16 +00:00
|
|
|
void PutSettings(const Settings &s);
|
2014-05-30 05:09:54 +00:00
|
|
|
|
2014-05-30 20:53:52 +00:00
|
|
|
int SaveRamSize() const;
|
2014-05-30 16:50:58 +00:00
|
|
|
bool SaveRamLoad(const uint8 *data, int size);
|
2014-05-30 20:53:52 +00:00
|
|
|
bool SaveRamSave(uint8 *dest, int maxsize) const;
|
2014-05-30 16:50:58 +00:00
|
|
|
|
2014-05-30 22:59:13 +00:00
|
|
|
uint32 GetNECReg(int which) const;
|
|
|
|
|
|
|
|
bool GetMemoryArea(int index, const char *&name, int &size, uint8 *&data);
|
|
|
|
|
2014-05-30 05:09:54 +00:00
|
|
|
public:
|
|
|
|
GFX gfx;
|
|
|
|
Memory memory;
|
|
|
|
EEPROM eeprom;
|
|
|
|
RTC rtc;
|
|
|
|
Sound sound;
|
|
|
|
V30MZ cpu;
|
|
|
|
Interrupt interrupt;
|
2014-05-30 20:53:52 +00:00
|
|
|
|
|
|
|
bool rotate; // rotate screen and controls left 90
|
2014-06-04 23:26:57 +00:00
|
|
|
uint32 oldbuttons;
|
2014-05-31 05:57:18 +00:00
|
|
|
|
|
|
|
template<bool isReader>void SyncState(NewState *ns);
|
2014-05-30 05:09:54 +00:00
|
|
|
};
|
|
|
|
|
2014-05-30 18:10:39 +00:00
|
|
|
struct SyncSettings
|
2014-05-30 05:09:54 +00:00
|
|
|
{
|
2014-05-30 18:10:39 +00:00
|
|
|
uint64 initialtime; // when userealtime is false, the initial time in unix format
|
2014-05-30 22:31:16 +00:00
|
|
|
uint32 byear; // birth year, 0000-9999
|
|
|
|
uint32 bmonth; // birth month, 1-12
|
|
|
|
uint32 bday; // birth day, 1-31
|
|
|
|
uint32 color; // true if wonderswan is in color mode
|
|
|
|
uint32 userealtime; // true to use the system's actual clock; false to use an emulation pegged clock
|
|
|
|
uint32 language; // 0 = J, 1 = E; only affects "Digimon Tamers - Battle Spirit"
|
|
|
|
uint32 sex; // sex, 1 = male, 2 = female
|
|
|
|
uint32 blood; // 1 = a, 2 = b, 3 = o, 4 = ab
|
|
|
|
char name[17]; // up to 16 chars long, most chars don't work (conversion from ascii is internal)
|
2014-05-30 18:10:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Settings
|
|
|
|
{
|
|
|
|
uint32 LayerMask; // 1 = enable bg, 2 = enable fg, 4 = enable sprites
|
2016-03-26 17:35:57 +00:00
|
|
|
uint32 BWPalette[16]; // map 16 b&w shades to output colors
|
|
|
|
uint32 ColorPalette[4096]; // map 4096 color shades to output colors
|
2014-05-30 05:09:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
namespace Debug
|
|
|
|
{
|
|
|
|
int puts ( const char * str );
|
|
|
|
int printf ( const char * format, ... );
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|