aboutsummaryrefslogtreecommitdiff
path: root/SrcShared/Patches/EmPatchIf.h
blob: e6e1d4136b24562a03259885e4aae233f3ed0f57 (plain)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/* -*- mode: C++; tab-width: 4 -*- */
/* ===================================================================== *\
	Copyright (c) 2001 PocketPyro, Inc.
	All rights reserved.

	This file is part of the Palm OS Emulator.

	This program is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.
\* ===================================================================== */


#ifndef EmPatchIf_h
#define EmPatchIf_h

#include "EcmIf.h"


enum
{
	kPatchErrNone,
	kPatchErrNotImplemented,
	kPatchErrInvalidIndex
};


enum CallROMType
{
	kExecuteROM,
	kSkipROM
};


// Function types for head- and Tailpatch functions.

typedef	CallROMType	(*HeadpatchProc)(void);
typedef	void		(*TailpatchProc)(void);


// ==============================================================================
// *  BEGIN IEmPatchLoader
// ==============================================================================

const EcmIfName kEmPatchLoaderIfn = "loader.patchmodule.i.ecm";

ecm_interface IEmPatchLoader : ecm_extends IEcmComponent
{
	virtual Err InitializePL	(void) = 0;
	virtual Err ResetPL			(void) = 0;
	virtual Err DisposePL		(void) = 0;
	
	virtual Err ClearPL			(void) = 0;
	virtual Err LoadPL			(void) = 0;

	virtual Err LoadAllModules	(void) = 0;
	virtual Err LoadModule		(const string& url) = 0;
};

// ==============================================================================
// *  END IEmPatchLoader
// ==============================================================================
	


// ==============================================================================
// *  BEGIN IEmPatchContainer
// ==============================================================================

const EcmIfName kEmPatchContainerIfn = "container.patchmodule.i.ecm";

ecm_interface IEmPatchContainer : ecm_extends IEcmContainer
{
};


// ==============================================================================
// *  END IEmPatchContainer
// ==============================================================================



// ==============================================================================
// *  BEGIN IEmPatchDllTempHacks
// ==============================================================================

const EcmIfName kEmPatchDllTempHacksIfn = "hacks.dll.patchmodule.i.ecm";

ecm_interface IEmPatchDllTempHacks : ecm_extends IEcmComponent
{
	virtual Err GetGlobalMemBanks(void** membanksPP)=0;
	virtual Err GetGlobalRegs(void** regsPP)=0;
};

// ==============================================================================
// *  END IEmPatchDllTempHacks
// ==============================================================================




// ===========================================================================
//		IEmPatchModule interface exposed by all patch modules.
//			this is how all patch modules appear to the patching sub-system
// ===========================================================================

const EcmIfName kEmPatchModuleIfn = "patchmodule.i.ecm";

ecm_interface IEmPatchModule : ecm_extends IEcmComponent
{
	virtual Err Initialize(IEmPatchContainer &containerIP) = 0;
	virtual Err Reset() = 0;
	virtual Err Dispose() = 0;
	
	virtual Err Clear () = 0;
	virtual Err Load () = 0;

	virtual const string &GetName() = 0;

	virtual Err GetHeadpatch (uint16 index, HeadpatchProc &procP) = 0;
	virtual Err GetTailpatch (uint16 index, TailpatchProc &procP) = 0;
};




// ===========================================================================
//		IEmPatchModuleMap interface supporting a collection of PatchModules
//			Basically there is one component which maintains the list of all 
//			installed patch modules, and it is accessed using IEmPatchModuleMap
// ===========================================================================

const EcmIfName kEmPatchModuleMapIfn = "map.patchmodule.i.ecm";

ecm_interface IEmPatchModuleMap : ecm_extends IEcmComponent
{
	virtual Err InitializeAll(IEmPatchContainer &containerI) = 0;
	virtual Err ResetAll() = 0;
	virtual Err DisposeAll() = 0;
	
	virtual Err ClearAll () = 0;
	virtual Err LoadAll () = 0;

	virtual Err AddModule (IEmPatchModule *moduleIP) = 0;
	
	virtual Err GetModuleByName (const string &nameStr, IEmPatchModule *& moduleIP) = 0;
};

#endif // EmPatchIf_h