all repos — mgba @ 9204c61ba20fa967e3dfcb46cf1e0351bb5237d5

mGBA Game Boy Advance Emulator

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_INT,
17	mCORE_MEMORY_SEARCH_STRING,
18	mCORE_MEMORY_SEARCH_GUESS,
19};
20
21enum mCoreMemorySearchOp {
22	mCORE_MEMORY_SEARCH_EQUAL,
23	mCORE_MEMORY_SEARCH_GREATER,
24	mCORE_MEMORY_SEARCH_LESS,
25	mCORE_MEMORY_SEARCH_DELTA,
26};
27
28struct mCoreMemorySearchParams {
29	int memoryFlags;
30	enum mCoreMemorySearchType type;
31	enum mCoreMemorySearchOp op;
32	int align;
33	int width;
34	union {
35		const char* valueStr;
36		int32_t valueInt;
37	};
38};
39
40struct mCoreMemorySearchResult {
41	uint32_t address;
42	int segment;
43	uint32_t guessDivisor;
44	uint32_t guessMultiplier;
45	enum mCoreMemorySearchType type;
46	int width;
47	int32_t oldValue;
48};
49
50DECLARE_VECTOR(mCoreMemorySearchResults, struct mCoreMemorySearchResult);
51
52struct mCore;
53void mCoreMemorySearch(struct mCore* core, const struct mCoreMemorySearchParams* params, struct mCoreMemorySearchResults* out, size_t limit);
54void mCoreMemorySearchRepeat(struct mCore* core, const struct mCoreMemorySearchParams* params, struct mCoreMemorySearchResults* inout);
55
56CXX_GUARD_END
57
58#endif