include/mgba/core/library.h (view raw)
1/* Copyright (c) 2013-2016 Jeffrey Pfau
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6#ifndef M_LIBRARY_H
7#define M_LIBRARY_H
8
9#include <mgba-util/common.h>
10
11CXX_GUARD_START
12
13#include <mgba/core/core.h>
14#include <mgba-util/vector.h>
15
16struct mLibraryEntry {
17 const char* base;
18 const char* filename;
19 const char* title;
20 char internalTitle[17];
21 char internalCode[9];
22 enum mPlatform platform;
23 size_t filesize;
24 uint32_t crc32;
25};
26
27#ifdef USE_SQLITE3
28
29DECLARE_VECTOR(mLibraryListing, struct mLibraryEntry);
30
31struct mLibrary;
32struct mLibrary* mLibraryCreateEmpty(void);
33struct mLibrary* mLibraryLoad(const char* filename);
34void mLibraryDestroy(struct mLibrary*);
35
36struct VDir;
37struct VFile;
38void mLibraryLoadDirectory(struct mLibrary* library, const char* base);
39
40size_t mLibraryCount(struct mLibrary* library, const struct mLibraryEntry* constraints);
41size_t mLibraryGetEntries(struct mLibrary* library, struct mLibraryListing* out, size_t numEntries, size_t offset, const struct mLibraryEntry* constraints);
42struct VFile* mLibraryOpenVFile(struct mLibrary* library, const struct mLibraryEntry* entry);
43
44#endif
45
46CXX_GUARD_END
47
48#endif