-
Notifications
You must be signed in to change notification settings - Fork 1
/
module.h
33 lines (24 loc) · 854 Bytes
/
module.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
#pragma once
#include "900L1.h"
// Struct for external memory modules
struct EX_MEMORY {
/// Userdata for storing additional data
void* userdata;
/// Called to access the extended memory
void(*access)(DWORD address, BYTE* mem, bool read, void* userdata);
/// Called when another memory module is inserted,
/// May be left NULL
void(*destroy)(struct EX_MEMORY* self);
};
struct MEM_USERDATA {
DWORD offset;
BYTE* memory;
};
/// Creates a RAM type module
struct EX_MEMORY* mod_ram(DWORD size, DWORD offset);
/// Creates a ROM type module
/// Behaves exactly like a RAM type module but is read only
struct EX_MEMORY* mod_rom(DWORD size, DWORD offset);
/// Copies the specified bytes from the source buffer to the destination
/// This works with both RAM and ROM type modules
void mod_copy_mem(struct EX_MEMORY* dst, BYTE* src, DWORD num);