annotate src/common/System.h @ 252:2b6bd03feb4f

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