451ab91e |
1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
2 | * Mupen64plus-core - m64p_frontend.h * |
3 | * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ * |
4 | * Copyright (C) 2009 Richard Goedeken * |
5 | * * |
6 | * This program is free software; you can redistribute it and/or modify * |
7 | * it under the terms of the GNU General Public License as published by * |
8 | * the Free Software Foundation; either version 2 of the License, or * |
9 | * (at your option) any later version. * |
10 | * * |
11 | * This program is distributed in the hope that it will be useful, * |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
14 | * GNU General Public License for more details. * |
15 | * * |
16 | * You should have received a copy of the GNU General Public License * |
17 | * along with this program; if not, write to the * |
18 | * Free Software Foundation, Inc., * |
19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * |
20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
21 | |
22 | /* This header file defines typedefs for function pointers to Core functions |
23 | * designed for use by the front-end user interface. |
24 | */ |
25 | |
26 | #if !defined(M64P_FRONTEND_H) |
27 | #define M64P_FRONTEND_H |
28 | |
29 | #include "m64p_types.h" |
30 | |
31 | #ifdef __cplusplus |
32 | extern "C" { |
33 | #endif |
34 | |
35 | |
36 | /* pointer types to the callback functions in the front-end application */ |
37 | typedef void (*ptr_DebugCallback)(void *Context, int level, const char *message); |
38 | typedef void (*ptr_StateCallback)(void *Context, m64p_core_param param_type, int new_value); |
39 | #if defined(M64P_CORE_PROTOTYPES) |
40 | EXPORT void CALL DebugCallback(void *Context, int level, const char *message); |
41 | EXPORT void CALL StateCallback(void *Context, m64p_core_param param_type, int new_value); |
42 | #endif |
43 | |
44 | /* CoreStartup() |
45 | * |
46 | * This function initializes libmupen64plus for use by allocating memory, |
47 | * creating data structures, and loading the configuration file. |
48 | */ |
49 | typedef m64p_error (*ptr_CoreStartup)(int, const char *, const char *, void *, ptr_DebugCallback, void *, ptr_StateCallback); |
50 | #if defined(M64P_CORE_PROTOTYPES) |
51 | EXPORT m64p_error CALL CoreStartup(int, const char *, const char *, void *, ptr_DebugCallback, void *, ptr_StateCallback); |
52 | #endif |
53 | |
54 | /* CoreShutdown() |
55 | * |
56 | * This function saves the configuration file, then destroys data structures |
57 | * and releases memory allocated by the core library. |
58 | */ |
59 | typedef m64p_error (*ptr_CoreShutdown)(void); |
60 | #if defined(M64P_CORE_PROTOTYPES) |
61 | EXPORT m64p_error CALL CoreShutdown(void); |
62 | #endif |
63 | |
64 | /* CoreAttachPlugin() |
65 | * |
66 | * This function attaches the given plugin to the emulator core. There can only |
67 | * be one plugin of each type attached to the core at any given time. |
68 | */ |
69 | typedef m64p_error (*ptr_CoreAttachPlugin)(m64p_plugin_type, m64p_dynlib_handle); |
70 | #if defined(M64P_CORE_PROTOTYPES) |
71 | EXPORT m64p_error CALL CoreAttachPlugin(m64p_plugin_type, m64p_dynlib_handle); |
72 | #endif |
73 | |
74 | /* CoreDetachPlugin() |
75 | * |
76 | * This function detaches the given plugin from the emulator core, and re-attaches |
77 | * the 'dummy' plugin functions. |
78 | */ |
79 | typedef m64p_error (*ptr_CoreDetachPlugin)(m64p_plugin_type); |
80 | #if defined(M64P_CORE_PROTOTYPES) |
81 | EXPORT m64p_error CALL CoreDetachPlugin(m64p_plugin_type); |
82 | #endif |
83 | |
84 | /* CoreDoCommand() |
85 | * |
86 | * This function sends a command to the emulator core. |
87 | */ |
88 | typedef m64p_error (*ptr_CoreDoCommand)(m64p_command, int, void *); |
89 | #if defined(M64P_CORE_PROTOTYPES) |
90 | EXPORT m64p_error CALL CoreDoCommand(m64p_command, int, void *); |
91 | #endif |
92 | |
93 | /* CoreOverrideVidExt() |
94 | * |
95 | * This function overrides the core's internal SDL-based OpenGL functions. This |
96 | * override functionality allows a front-end to define its own video extension |
97 | * functions to be used instead of the SDL functions. If any of the function |
98 | * pointers in the structure are NULL, the override function will be disabled |
99 | * and the core's internal SDL functions will be used. |
100 | */ |
101 | typedef m64p_error (*ptr_CoreOverrideVidExt)(m64p_video_extension_functions *); |
102 | #if defined(M64P_CORE_PROTOTYPES) |
103 | EXPORT m64p_error CALL CoreOverrideVidExt(m64p_video_extension_functions *); |
104 | #endif |
105 | |
106 | /* CoreAddCheat() |
107 | * |
108 | * This function will add a Cheat Function to a list of currently active cheats |
109 | * which are applied to the open ROM. |
110 | */ |
111 | typedef m64p_error (*ptr_CoreAddCheat)(const char *, m64p_cheat_code *, int); |
112 | #if defined(M64P_CORE_PROTOTYPES) |
113 | EXPORT m64p_error CALL CoreAddCheat(const char *, m64p_cheat_code *, int); |
114 | #endif |
115 | |
116 | /* CoreCheatEnabled() |
117 | * |
118 | * This function will enable or disable a Cheat Function which is in the list of |
119 | * currently active cheats. |
120 | */ |
121 | typedef m64p_error (*ptr_CoreCheatEnabled)(const char *, int); |
122 | #if defined(M64P_CORE_PROTOTYPES) |
123 | EXPORT m64p_error CALL CoreCheatEnabled(const char *, int); |
124 | #endif |
125 | |
126 | /* CoreGetRomSettings() |
127 | * |
128 | * This function will retrieve the ROM settings from the mupen64plus INI file for |
129 | * the ROM image corresponding to the given CRC values. |
130 | */ |
131 | typedef m64p_error (*ptr_CoreGetRomSettings)(m64p_rom_settings *, int, int, int); |
132 | #if defined(M64P_CORE_PROTOTYPES) |
133 | EXPORT m64p_error CALL CoreGetRomSettings(m64p_rom_settings *, int, int, int); |
134 | #endif |
135 | |
136 | #ifdef __cplusplus |
137 | } |
138 | #endif |
139 | |
140 | #endif /* #define M64P_FRONTEND_H */ |
141 | |