OSCR
Open Source Cartridge Reader
Loading...
Searching...
No Matches
mapper.h
1/********************************************************************
2* Open Source Cartridge Reader *
3********************************************************************/
4#pragma once
5#ifndef CRDB_BASIC_MAPPER_H_
6# define CRDB_BASIC_MAPPER_H_
7
8#include "common/CRDB.h"
9
10namespace OSCR
11{
12 namespace Databases
13 {
14 namespace Basic
15 {
17 {
18 uint16_t id;
19 uint32_t sizeLow;
20 uint32_t sizeHigh;
21 uint32_t meta1;
22 uint32_t meta2;
23 char name[101];
24 };
25
26 class MapperRecord : public OSCR::CRDB::GenericRecord<crdbMapperRecord>
27 {
28 public:
29 char const * getName() const;
30 bool readName(char * buffer, size_t size) const;
31 void debug() const;
32 };
33
34 class CRMapperDatabase : public OSCR::CRDB::CRDB<MapperRecord, CRDB_RECORD_SIZE_BASIC_MAPPER, OSCR::CRDB::CRDBType::NamedByID>
35 {
36 using CRDB::CRDB;
37 public:
38 void nextRecord();
39
40 virtual ~CRMapperDatabase() = default;
41 };
42
43 extern crdbMapperRecord * mapperDetail;
44 extern MapperRecord * mapperRecord;
45 extern bool mapperReady;
46 extern bool fromCRDB;
47
48 extern void resetMapper();
49 extern void setupMapper(char const * databasePath);
50 extern void setupMapper(__FlashStringHelper const * databaseName);
51 extern CRMapperDatabase * getMapperCRDB();
52
53 extern bool matchMapper(uint16_t searchId, uint8_t offset = 0);
54
55 extern bool matchMapper(char const * databasePath, uint16_t searchId, uint8_t offset = 0);
56 extern bool matchMapper(__FlashStringHelper const * databaseName, uint16_t searchId, uint8_t offset = 0);
57
58 extern bool searchMapper(char const * databasePath, uint16_t searchId);
59 extern bool searchMapper(__FlashStringHelper const * databaseName, uint16_t searchId);
60
61 extern void browseMappers();
62 extern void browseMappers(char const * databasePath);
63 extern void browseMappers(__FlashStringHelper const * databaseName);
64
65 extern void printMapperNotFound(uint16_t mapperId);
66 }
67 }
68}
69
70#endif /* CRDB_BASIC_MAPPER_H_ */
Definition CRDB.h:313
Definition CRDB.h:81
Main program.
Definition Storage.h:13