Mercurial > vba-linux
comparison src/common/System.h @ 1:f9f4f1b99eed
importing src directory
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 03 Mar 2012 10:31:27 -0600 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:8ced16adf2e1 | 1:f9f4f1b99eed |
---|---|
1 #ifndef VBA_SYSTEM_H | |
2 #define VBA_SYSTEM_H | |
3 | |
4 #if _MSC_VER > 1000 | |
5 #pragma once | |
6 #endif // _MSC_VER > 1000 | |
7 | |
8 #include "zlib.h" | |
9 #include "../Port.h" | |
10 | |
11 // c++ lacks a way to implement Smart Referrences or Delphi-Style Properties | |
12 // in order to maintain consistency, value-copied things should not be modified too often | |
13 struct EmulatedSystem | |
14 { | |
15 // main emulation function | |
16 void (*emuMain)(int); | |
17 // reset emulator | |
18 void (*emuReset)(bool); | |
19 // clean up memory | |
20 void (*emuCleanUp)(); | |
21 // load battery file | |
22 bool (*emuReadBattery)(const char *); | |
23 // write battery file | |
24 bool (*emuWriteBattery)(const char *); | |
25 // load battery file from stream | |
26 bool (*emuReadBatteryFromStream)(gzFile); | |
27 // write battery file to stream | |
28 bool (*emuWriteBatteryToStream)(gzFile); | |
29 // load state | |
30 bool (*emuReadState)(const char *); | |
31 // save state | |
32 bool (*emuWriteState)(const char *); | |
33 // load state from stream | |
34 bool (*emuReadStateFromStream)(gzFile); | |
35 // save state to stream | |
36 bool (*emuWriteStateToStream)(gzFile); | |
37 // load memory state (rewind) | |
38 bool (*emuReadMemState)(char *, int); | |
39 // write memory state (rewind) | |
40 bool (*emuWriteMemState)(char *, int); | |
41 // write PNG file | |
42 bool (*emuWritePNG)(const char *); | |
43 // write BMP file | |
44 bool (*emuWriteBMP)(const char *); | |
45 // emulator update CPSR (ARM only) | |
46 void (*emuUpdateCPSR)(); | |
47 // emulator has debugger | |
48 bool emuHasDebugger; | |
49 // clock ticks to emulate | |
50 int emuCount; | |
51 }; | |
52 | |
53 // why not convert the value type only when doing I/O? | |
54 struct EmulatedSystemCounters | |
55 { | |
56 int32 frameCount; | |
57 int32 lagCount; | |
58 int32 extraCount; | |
59 bool8 lagged; | |
60 bool8 laggedLast; | |
61 }; | |
62 | |
63 extern struct EmulatedSystem theEmulator; | |
64 extern struct EmulatedSystemCounters systemCounters; | |
65 | |
66 extern void log(const char *, ...); | |
67 | |
68 extern void systemGbPrint(u8 *, int, int, int, int); | |
69 extern int systemScreenCapture(int); | |
70 extern void systemRefreshScreen(); | |
71 extern void systemRenderFrame(); | |
72 extern void systemRedrawScreen(); | |
73 extern void systemUpdateListeners(); | |
74 // updates the joystick data | |
75 extern void systemSetSensorX(int32); | |
76 extern void systemSetSensorY(int32); | |
77 extern void systemResetSensor(); | |
78 extern int32 systemGetSensorX(); | |
79 extern int32 systemGetSensorY(); | |
80 extern void systemUpdateMotionSensor(int); | |
81 extern int systemGetDefaultJoypad(); | |
82 extern void systemSetDefaultJoypad(int); | |
83 extern bool systemReadJoypads(); | |
84 // return information about the given joystick, -1 for default joystick... the bool is for if motion sensor should be handled | |
85 // too | |
86 extern u32 systemGetOriginalJoypad(int, bool); | |
87 extern u32 systemGetJoypad(int, bool); | |
88 extern void systemSetJoypad(int, u32); | |
89 extern void systemClearJoypads(); | |
90 extern void systemMessage(int, const char *, ...); | |
91 extern void systemScreenMessage(const char *msg, int slot = 0, int duration = 3000, const char *colorList = NULL); | |
92 extern bool systemSoundInit(); | |
93 extern void systemSoundShutdown(); | |
94 extern void systemSoundPause(); | |
95 extern void systemSoundResume(); | |
96 extern bool systemSoundIsPaused(); | |
97 extern void systemSoundReset(); | |
98 extern void systemSoundWriteToBuffer(); | |
99 extern void systemSoundClearBuffer(); | |
100 extern bool systemSoundCanChangeQuality(); | |
101 extern bool systemSoundSetQuality(int quality); | |
102 extern u32 systemGetClock(); | |
103 extern void systemSetTitle(const char *); | |
104 extern void systemShowSpeed(int); | |
105 extern void systemIncreaseThrottle(); | |
106 extern void systemDecreaseThrottle(); | |
107 extern void systemSetThrottle(int); | |
108 extern int systemGetThrottle(); | |
109 extern void systemFrame(); | |
110 extern int systemFramesToSkip(); | |
111 extern bool systemIsEmulating(); | |
112 extern void systemGbBorderOn(); | |
113 extern bool systemIsRunningGBA(); | |
114 extern bool systemIsSpedUp(); | |
115 extern bool systemIsPaused(); | |
116 extern void systemSetPause(bool pause); | |
117 extern bool systemPauseOnFrame(); | |
118 | |
119 extern int systemCartridgeType; | |
120 extern int systemSpeed; | |
121 extern bool systemSoundOn; | |
122 extern u16 systemColorMap16[0x10000]; | |
123 extern u32 systemColorMap32[0x10000]; | |
124 extern u16 systemGbPalette[24]; | |
125 extern int systemRedShift; | |
126 extern int systemGreenShift; | |
127 extern int systemBlueShift; | |
128 extern int systemColorDepth; | |
129 extern int systemDebug; | |
130 extern int systemVerbose; | |
131 extern int systemFrameSkip; | |
132 extern int systemSaveUpdateCounter; | |
133 | |
134 #define SYSTEM_SAVE_UPDATED 30 | |
135 #define SYSTEM_SAVE_NOT_UPDATED 0 | |
136 | |
137 #endif // VBA_SYSTEM_H |