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 version(Modding)
77 {
78     /* CoreSaveOverride()
79     *
80     * This function will override where the eep save files are targetting.
81     */
82     m64p_error function(const char* path) CoreSaveOverride;
83 
84     /* GetHeader()
85     *
86     * This function will return a pointer to the ROM_HEADER.
87     */
88     void* function() GetHeader;
89 
90     /* GetRdRam()
91     *
92     * This function will return a pointer to the RDRAM.
93     */
94     void* function() GetRdRam;
95 
96     /* GetRom()
97     *
98     * This function will return a pointer to the ROM.
99     */
100     void* function() GetRom;
101 
102     /* GetRdRamSize()
103     *
104     * This function will return the real length of RDRAM memory.
105     */
106     const(size_t) function() GetRdRamSize;
107 
108     /* GetRomSize()
109     *
110     * This function will return the real length of ROM memory.
111     */
112     const(size_t) function() GetRomSize;
113 
114     /* RefreshDynarec()
115     *
116     * This function will refresh the dynamic recompiler needed for asm injections to work.
117     */
118     void function() RefreshDynarec;
119 }