include/mgba/core/mem-search.h (view raw)
1/* Copyright (c) 2013-2017 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 CORE_MEM_SEARCH_H
7#define CORE_MEM_SEARCH_H
8
9#include <mgba-util/common.h>
10
11CXX_GUARD_START
12
13#include <mgba-util/vector.h>
14
15enum mCoreMemorySearchType {
16 mCORE_MEMORY_SEARCH_32,
17 mCORE_MEMORY_SEARCH_16,
18 mCORE_MEMORY_SEARCH_8,
19 mCORE_MEMORY_SEARCH_STRING,
20 mCORE_MEMORY_SEARCH_GUESS,
21};
22
23struct mCoreMemorySearchParams {
24 int memoryFlags;
25 enum mCoreMemorySearchType type;
26 union {
27 const char* valueStr;
28 uint32_t value32;
29 uint32_t value16;
30 uint32_t value8;
31 };
32};
33
34struct mCoreMemorySearchResult {
35 uint32_t address;
36 int segment;
37 enum mCoreMemorySearchType type;
38};
39
40DECLARE_VECTOR(mCoreMemorySearchResults, struct mCoreMemorySearchResult);
41
42struct mCore;
43void mCoreMemorySearch(struct mCore* core, const struct mCoreMemorySearchParams* params, struct mCoreMemorySearchResults* out, size_t limit);
44void mCoreMemorySearchRepeat(struct mCore* core, const struct mCoreMemorySearchParams* params, struct mCoreMemorySearchResults* inout);
45
46CXX_GUARD_END
47
48#endif