1 module m64p_frontend;
2 
3 import m64p_types;
4 
5 @nogc nothrow __gshared extern(C):
6 
7     /* pointer types to the callback functions in the front-end application */
8     alias DebugCallback = void function(void* Context, int level, const char*  message);
9     alias StateCallback = void function(void* Context, m64p_core_param param_type, int new_value);
10 
11     /* CoreStartup()
12     *
13     * This function initializes libmupen64plus for use by allocating memory,
14     * creating data structures, and loading the configuration file.
15     */
16     m64p_error function(int, const char*, const char*, void*, DebugCallback, void*, StateCallback) CoreStartup;
17 
18     /* CoreShutdown()
19     *
20     * This function saves the configuration file, then destroys data structures
21     * and releases memory allocated by the core library.
22     */
23     m64p_error function() CoreShutdown;
24 
25     /* CoreAttachPlugin()
26     *
27     * This function attaches the given plugin to the emulator core. There can only
28     * be one plugin of each type attached to the core at any given time. 
29     */
30     m64p_error function(m64p_plugin_type, m64p_dynlib_handle) CoreAttachPlugin;
31 
32     /* CoreDetachPlugin()
33     *
34     * This function detaches the given plugin from the emulator core, and re-attaches
35     * the 'dummy' plugin functions. 
36     */
37     m64p_error function(m64p_plugin_type) CoreDetachPlugin;
38 
39     /* CoreDoCommand()
40     *
41     * This function sends a command to the emulator core.
42     */
43     m64p_error function(m64p_command, int, void*) CoreDoCommand;
44 
45     /* CoreOverrideVidExt()
46     *
47     * This function overrides the core's internal SDL-based OpenGL functions. This
48     * override functionality allows a front-end to define its own video extension
49     * functions to be used instead of the SDL functions. If any of the function
50     * pointers in the structure are NULL, the override function will be disabled
51     * and the core's internal SDL functions will be used.
52     */
53     m64p_error function(m64p_video_extension_functions*) CoreOverrideVidExt;
54 
55     /* CoreAddCheat()
56     *
57     * This function will add a Cheat Function to a list of currently active cheats
58     * which are applied to the open ROM.
59     */
60     m64p_error function(const char*, m64p_cheat_code*, int) CoreAddCheat;
61 
62     /* CoreCheatEnabled()
63     *
64     * This function will enable or disable a Cheat Function which is in the list of
65     * currently active cheats.
66     */
67     m64p_error function(m64p_rom_settings*, int, int, int) CoreCheatEnabled;
68 
69     /* CoreGetRomSettings()
70     *
71     * This function will retrieve the ROM settings from the mupen64plus INI file for
72     * the ROM image corresponding to the given CRC values.
73     */
74     m64p_error function(m64p_rom_settings*, int, int, int) CoreGetRomSettings;
75 
76     /* CoreSaveOverride()
77     *
78     * This function will override where the eep save files are targetting.
79     */
80     m64p_error function(const char* path) CoreSaveOverride;
81 
82     /***********************\
83     |*  MODDING FUNCTIONS  *|
84     \***********************/
85 
86     /* GetHeader()
87     *
88     * This function will return a pointer to the ROM_HEADER.
89     */
90     void* function() GetHeader;
91 
92     /* GetRdRam()
93     *
94     * This function will return a pointer to the RDRAM.
95     */
96     void* function() GetRdRam;
97 
98     /* GetRom()
99     *
100     * This function will return a pointer to the ROM.
101     */
102     void* function() GetRom;
103 
104     /* GetRdRamSize()
105     *
106     * This function will return the real length of RDRAM memory.
107     */
108     const(size_t) function() GetRdRamSize;
109 
110     /* GetRomSize()
111     *
112     * This function will return the real length of ROM memory.
113     */
114     const(size_t) function() GetRomSize;
115 
116     /* RefreshDynarec()
117     *
118     * This function will refresh the dynamic recompiler needed for asm injections to work.
119     */
120     void function() RefreshDynarec;