SameBoy | Accurate GB/GBC emulator |
| download: https://git.y1.nz/archives/sameboy.tar.gz | |
| README | Files | Log | Refs | LICENSE |
Core/sgb.h
1 #pragma once
2
3 #include "defs.h"
4 #include <stdint.h>
5 #include <stdbool.h>
6
7 typedef struct GB_sgb_s GB_sgb_t;
8 typedef struct {
9 uint8_t tiles[0x100 * 8 * 4];
10 #ifdef GB_INTERNAL
11 union {
12 struct {
13 uint16_t map[32 * 32];
14 uint16_t palette[16 * 4];
15 };
16 uint16_t raw_data[0x440];
17 };
18 #else
19 uint16_t raw_data[0x440];
20 #endif
21 } GB_sgb_border_t;
22
23 #ifdef GB_INTERNAL
24 #define GB_SGB_INTRO_ANIMATION_LENGTH 200
25
26 struct GB_sgb_s {
27 uint8_t command[16 * 7];
28 uint16_t command_write_index;
29 bool ready_for_pulse;
30 bool ready_for_write;
31 bool ready_for_stop;
32 bool disable_commands;
33
34 /* Screen buffer */
35 uint8_t screen_buffer[160 * 144]; // Live image from the Game Boy
36 uint8_t effective_screen_buffer[160 * 144]; // Image actually rendered to the screen
37
38 /* Multiplayer Input */
39 uint8_t player_count, current_player;
40
41 /* Mask */
42 uint8_t mask_mode;
43
44 /* Data Transfer */
45 uint8_t vram_transfer_countdown, transfer_dest;
46
47 /* Border */
48 GB_sgb_border_t border, pending_border;
49 uint8_t border_animation;
50
51 /* Colorization */
52 uint16_t effective_palettes[4 * 4];
53 uint16_t ram_palettes[4 * 512];
54 uint8_t attribute_map[20 * 18];
55 uint8_t attribute_files[0xFD2];
56 uint8_t attribute_files_padding[0xFE0 - 0xFD2];
57
58 /* Intro */
59 int16_t intro_animation;
60
61 /* GB Header */
62 uint8_t received_header[0x54];
63 };
64
65 internal void GB_sgb_write(GB_gameboy_t *gb, uint8_t value);
66 internal void GB_sgb_render(GB_gameboy_t *gb, bool incomplete);
67 internal void GB_sgb_load_default_data(GB_gameboy_t *gb);
68
69 #endif
70 unsigned GB_get_player_count(GB_gameboy_t *gb);
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.