-
Notifications
You must be signed in to change notification settings - Fork 0
/
s9x.h
46 lines (37 loc) · 1.44 KB
/
s9x.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#pragma once
#include "drawlist_fwd.hpp"
#include "drawlist.hpp"
#include "drawlist_render.hpp"
extern std::shared_ptr<DrawList::SpaceContainer> spaceContainer;
extern std::shared_ptr<DrawList::FontContainer> fontContainer;
struct leu16 {
uint8_t b[2];
alwaysinline uint16_t u16() const { return (uint16_t)b[0] | ((uint16_t)b[1])<<8; }
};
const int drawlistCount = 1024;
struct drawlist_jump_table {
// 0000 index signifies end of jump table; values in range [1..drawlistCount]
leu16 index;
uint8_t target_layer;
uint8_t target_priority;
leu16 x_offset;
leu16 y_offset;
DrawList::draw_layer layer() const { return static_cast<DrawList::draw_layer>(target_layer & 0x3F); }
uint8_t priority() const { return target_priority & 3; }
bool main_enable() const { return target_layer & 0x80; }
bool sub_enable() const { return target_layer & 0x40; }
};
extern drawlist_jump_table drawlistJump[drawlistCount];
struct drawlist_data {
leu16 size;
uint8_t data[2048 - 2];
};
extern drawlist_data drawlists[drawlistCount];
struct font_data {
uint8_t do_load;
// fonts begin with 3 byte little endian size followed by data, repeating size+data until size==0
uint8_t data[0xDDE000 - 1];
};
extern font_data fonts;
extern uint16_t spaceVRAM[0x8000 * DrawList::SpaceContainer::MaxCount-1];
extern uint16_t spaceCGRAM[0x100 * DrawList::SpaceContainer::MaxCount-1];