41e7f62dcd511bc0c7c98cf863060f7f6a3bede2
[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         /** Speedhacks file to use */
22         char * hacksFile;
23         /** Enable touchscreen controls */
24         bool touchscreenInput;
25         /** Display touchscreen controls grid */
26         bool touchscreenShow;
27         /** If true, next time the main loop is entered application will close */
28         bool quitting;
29         /** Current scancode->joypad mapping */
30         unsigned short joypad1Mapping[256];
31         unsigned short joypad2Mapping[256];
32         unsigned char action[256];
33 } Config;
34
35 // Video
36 extern struct gui {
37         /** Size of the GUI Window */
38         unsigned short Width, Height;
39         /** Size of the (scaled) rendering area, relative to window. */
40         unsigned short RenderX, RenderY, RenderW, RenderH;
41         /** Scaling ratio */
42         float ScaleX, ScaleY;
43 } GUI;
44
45 void S9xInitDisplay(int argc, char **argv);
46 void S9xDeinitDisplay();
47 void S9xVideoToggleFullscreen();
48 void S9xSetTitle (const char *title);
49
50 // Audio output
51 void S9xInitAudioOutput();
52 void S9xDeinitAudioOutput();
53 void S9xAudioOutputEnable(bool enable);
54
55 // Input devices
56 void S9xInitInputDevices();
57 void S9xDeinitInputDevices();
58 void S9xInputScreenChanged();
59 void S9xInputScreenDraw(int pixelSize, void * buffer, int pitch);
60 void S9xProcessEvents(bool block);
61
62 // Input actions
63 #define kActionNone                                             0
64 #define kActionQuit                                     (1U << 0)
65 #define kActionToggleFullscreen         (1U << 1)
66 #define kActionQuickLoad1                       (1U << 2)
67 #define kActionQuickSave1                       (1U << 3)
68 #define kActionQuickLoad2                       (1U << 4)
69 #define kActionQuickSave2                       (1U << 5)
70
71 void S9xDoAction(unsigned char action);
72
73 #endif