Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/wonderswan/system.h
2 views
1
#ifndef SYSTEM_H
2
#define SYSTEM_H
3
4
namespace MDFN_IEN_WSWAN
5
{
6
class System;
7
struct SyncSettings;
8
struct Settings;
9
}
10
11
#include "wswan.h"
12
13
#include "newstate.h"
14
15
#include "gfx.h"
16
#include "memory.h"
17
#include "eeprom.h"
18
#include "rtc.h"
19
#include "sound.h"
20
#include "v30mz.h"
21
#include "interrupt.h"
22
23
#include <cstddef>
24
25
namespace MDFN_IEN_WSWAN
26
{
27
class System
28
{
29
public:
30
System();
31
~System();
32
33
static void* operator new(std::size_t size);
34
35
void Reset();
36
bool Advance(uint32 buttons, bool novideo, uint32 *surface, int16 *soundbuff, int &soundbuffsize);
37
bool Load(const uint8 *data, int length, const SyncSettings &s);
38
void PutSettings(const Settings &s);
39
40
int SaveRamSize() const;
41
bool SaveRamLoad(const uint8 *data, int size);
42
bool SaveRamSave(uint8 *dest, int maxsize) const;
43
44
uint32 GetNECReg(int which) const;
45
46
bool GetMemoryArea(int index, const char *&name, int &size, uint8 *&data);
47
48
public:
49
GFX gfx;
50
Memory memory;
51
EEPROM eeprom;
52
RTC rtc;
53
Sound sound;
54
V30MZ cpu;
55
Interrupt interrupt;
56
57
bool rotate; // rotate screen and controls left 90
58
uint32 oldbuttons;
59
60
template<bool isReader>void SyncState(NewState *ns);
61
};
62
63
struct SyncSettings
64
{
65
uint64 initialtime; // when userealtime is false, the initial time in unix format
66
uint32 byear; // birth year, 0000-9999
67
uint32 bmonth; // birth month, 1-12
68
uint32 bday; // birth day, 1-31
69
uint32 color; // true if wonderswan is in color mode
70
uint32 userealtime; // true to use the system's actual clock; false to use an emulation pegged clock
71
uint32 language; // 0 = J, 1 = E; only affects "Digimon Tamers - Battle Spirit"
72
uint32 sex; // sex, 1 = male, 2 = female
73
uint32 blood; // 1 = a, 2 = b, 3 = o, 4 = ab
74
char name[17]; // up to 16 chars long, most chars don't work (conversion from ascii is internal)
75
};
76
77
struct Settings
78
{
79
uint32 LayerMask; // 1 = enable bg, 2 = enable fg, 4 = enable sprites
80
uint32 BWPalette[16]; // map 16 b&w shades to output colors
81
uint32 ColorPalette[4096]; // map 4096 color shades to output colors
82
};
83
84
namespace Debug
85
{
86
int puts ( const char * str );
87
int printf ( const char * format, ... );
88
}
89
90
}
91
92
#endif
93
94