~groovestomp/gsnes

gsnes/mapper.h -rw-r--r-- 2.1 KiB
9de07668 — GrooveStomp Foreground rendering works 1 year, 4 months ago
                                                                                
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
47
48
49
50
51
52
53
54
55
56
/******************************************************************************
  GrooveStomp's NES Emulator
  Copyright (c) 2019 Aaron Oman (GrooveStomp)

  File: mapper.h
  Created: 2019-11-04
  Updated: 2019-11-27
  Author: Aaron Oman
  Notice: GNU AGPLv3 License

  Based off of: One Lone Coder NES Emulator Copyright (C) 2019 Javidx9
  This program comes with ABSOLUTELY NO WARRANTY.
  This is free software, and you are welcome to redistribute it under certain
  conditions; See LICENSE for details.
 ******************************************************************************/
//! \file mapper.h
//! This file describes the `mapper` interface.
//! There are seven function pointers defined that must be provided by any
//! concrete implementation of this interface.
#include <stdint.h>

//! \brief Initialize the mapper
//! \return Pointer to mapper
typedef void *(*mapper_init_fn)(uint8_t prgBanks, uint8_t chrBanks);

//! \brief De-initialize the mapper
//! \param[in,out] interface the mapper
typedef void (*mapper_deinit_fn)(void *interface);

//! \brief Reset the mapper
//! \param[in,out] interface the mapper
typedef void (*mapper_reset_fn)(void *interface);

//! \brief CPU read intercept
//! \param[in,out] interface the mapper
//! \param[in] addr 16-bit address to read
//! \param[out] mappedAddr the translated address
typedef bool (*map_cpu_read_fn)(void *interface, uint16_t addr, uint32_t *mappedAddr);

//! \brief CPU write intercept
//! \param[in,out] interface the mapper
//! \param[in] addr 16-bit address to read
//! \param[out] mappedAddr the translated address
typedef bool (*map_cpu_write_fn)(void *interface, uint16_t addr, uint32_t *mappedAddr);

//! \brief PPU read intercept
//! \param[in,out] interface the mapper
//! \param[in] addr 16-bit address to read
//! \param[out] mappedAddr the translated address
typedef bool (*map_ppu_read_fn)(void *interface, uint16_t addr, uint32_t *mappedAddr);

//! \brief PPU write intercept
//! \param[in,out] interface the mapper
//! \param[in] addr 16-bit address to read
//! \param[out] mappedAddr the translated address
typedef bool (*map_ppu_write_fn)(void *interface, uint16_t addr, uint32_t *mappedAddr);