e3fe8319bbcde7fbd67c1c3db38fc8a5a917ab3b
[drnoksnes] / platform / platform.h
1 #ifndef _PLATFORM_H_
2 #define _PLATFORM_H_
3
4 #include "port.h"
5
6 // Configuration and command line parsing
7 void S9xLoadConfig(int argc, char ** argv);
8 void S9xUnloadConfig();
9 void S9xSetRomFile(const char * file);
10 extern struct config {
11         /** Unfreeze from .frz.gz snapshot on start */
12         bool snapshotLoad;
13         /** Freeze to .frz.gz on exit */
14         bool snapshotSave;
15         /** Create fullscreen surface */
16         bool fullscreen;
17         /** Name of the scaler to use or NULL for default */
18         char * scaler;
19         /** Audio output enabled */
20         bool enableAudio;
21         /** Quit when the emulator window is deactivated */
22         bool saver;
23         /** Speedhacks file to use */
24         char * hacksFile;
25         /** Enable player 1 joypad */
26         bool joypad1Enabled;
27         /** Enable player 2 joypad */
28         bool joypad2Enabled;
29         /** Enable touchscreen controls (0 = no, 1 = for player 1, 2 = for player 2) */
30         char touchscreenInput;
31         /** Display touchscreen controls grid */
32         bool touchscreenShow;
33         /** If true, next time the main loop is entered application will close */
34         bool quitting;
35         /** Current scancode->joypad mapping */
36         unsigned short joypad1Mapping[256];
37         unsigned short joypad2Mapping[256];
38         unsigned char action[256];
39 } Config;
40
41 // Video
42 extern struct gui {
43         /** Size of the GUI Window */
44         unsigned short Width, Height;
45         /** Size of the (scaled) rendering area, relative to window. */
46         unsigned short RenderX, RenderY, RenderW, RenderH;
47         /** Scaling ratio */
48         float ScaleX, ScaleY;
49 } GUI;
50
51 void S9xInitDisplay(int argc, char **argv);
52 void S9xDeinitDisplay();
53 void S9xVideoToggleFullscreen();
54 void S9xSetTitle (const char *title);
55
56 // Audio output
57 void S9xInitAudioOutput();
58 void S9xDeinitAudioOutput();
59 void S9xAudioOutputEnable(bool enable);
60
61 // Input devices
62 void S9xInitInputDevices();
63 void S9xDeinitInputDevices();
64 void S9xInputScreenChanged();
65 void S9xInputScreenDraw(void * buffer, int pitch);
66 void S9xProcessEvents(bool block);
67
68 // Input actions
69 #define kActionNone                                             0
70 #define kActionQuit                                     (1U << 0)
71 #define kActionToggleFullscreen         (1U << 1)
72 #define kActionQuickLoad1                       (1U << 2)
73 #define kActionQuickSave1                       (1U << 3)
74 #define kActionQuickLoad2                       (1U << 4)
75 #define kActionQuickSave2                       (1U << 5)
76
77 void S9xDoAction(unsigned char action);
78
79 #endif