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