diff 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 1ff2c546f5ad
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/common/System.h	Sat Mar 03 10:31:27 2012 -0600
     1.3 @@ -0,0 +1,137 @@
     1.4 +#ifndef VBA_SYSTEM_H
     1.5 +#define VBA_SYSTEM_H
     1.6 +
     1.7 +#if _MSC_VER > 1000
     1.8 +#pragma once
     1.9 +#endif // _MSC_VER > 1000
    1.10 +
    1.11 +#include "zlib.h"
    1.12 +#include "../Port.h"
    1.13 +
    1.14 +// c++ lacks a way to implement Smart Referrences or Delphi-Style Properties
    1.15 +// in order to maintain consistency, value-copied things should not be modified too often
    1.16 +struct EmulatedSystem
    1.17 +{
    1.18 +	// main emulation function
    1.19 +	void (*emuMain)(int);
    1.20 +	// reset emulator
    1.21 +	void (*emuReset)(bool);
    1.22 +	// clean up memory
    1.23 +	void (*emuCleanUp)();
    1.24 +	// load battery file
    1.25 +	bool (*emuReadBattery)(const char *);
    1.26 +	// write battery file
    1.27 +	bool (*emuWriteBattery)(const char *);
    1.28 +	// load battery file from stream
    1.29 +	bool (*emuReadBatteryFromStream)(gzFile);
    1.30 +	// write battery file to stream
    1.31 +	bool (*emuWriteBatteryToStream)(gzFile);
    1.32 +	// load state
    1.33 +	bool (*emuReadState)(const char *);
    1.34 +	// save state
    1.35 +	bool (*emuWriteState)(const char *);
    1.36 +	// load state from stream
    1.37 +	bool (*emuReadStateFromStream)(gzFile);
    1.38 +	// save state to stream
    1.39 +	bool (*emuWriteStateToStream)(gzFile);
    1.40 +	// load memory state (rewind)
    1.41 +	bool (*emuReadMemState)(char *, int);
    1.42 +	// write memory state (rewind)
    1.43 +	bool (*emuWriteMemState)(char *, int);
    1.44 +	// write PNG file
    1.45 +	bool (*emuWritePNG)(const char *);
    1.46 +	// write BMP file
    1.47 +	bool (*emuWriteBMP)(const char *);
    1.48 +	// emulator update CPSR (ARM only)
    1.49 +	void (*emuUpdateCPSR)();
    1.50 +	// emulator has debugger
    1.51 +	bool emuHasDebugger;
    1.52 +	// clock ticks to emulate
    1.53 +	int emuCount;
    1.54 +};
    1.55 +
    1.56 +// why not convert the value type only when doing I/O?
    1.57 +struct EmulatedSystemCounters
    1.58 +{
    1.59 +	int32 frameCount;
    1.60 +	int32 lagCount;
    1.61 +	int32 extraCount;
    1.62 +	bool8 lagged;
    1.63 +	bool8 laggedLast;
    1.64 +};
    1.65 +
    1.66 +extern struct EmulatedSystem theEmulator;
    1.67 +extern struct EmulatedSystemCounters systemCounters;
    1.68 +
    1.69 +extern void log(const char *, ...);
    1.70 +
    1.71 +extern void systemGbPrint(u8 *, int, int, int, int);
    1.72 +extern int  systemScreenCapture(int);
    1.73 +extern void systemRefreshScreen();
    1.74 +extern void systemRenderFrame();
    1.75 +extern void systemRedrawScreen();
    1.76 +extern void systemUpdateListeners();
    1.77 +// updates the joystick data
    1.78 +extern void systemSetSensorX(int32);
    1.79 +extern void systemSetSensorY(int32);
    1.80 +extern void systemResetSensor();
    1.81 +extern int32 systemGetSensorX();
    1.82 +extern int32 systemGetSensorY();
    1.83 +extern void systemUpdateMotionSensor(int);
    1.84 +extern int  systemGetDefaultJoypad();
    1.85 +extern void systemSetDefaultJoypad(int);
    1.86 +extern bool systemReadJoypads();
    1.87 +// return information about the given joystick, -1 for default joystick... the bool is for if motion sensor should be handled
    1.88 +// too
    1.89 +extern u32  systemGetOriginalJoypad(int, bool);
    1.90 +extern u32  systemGetJoypad(int, bool);
    1.91 +extern void systemSetJoypad(int, u32);
    1.92 +extern void systemClearJoypads();
    1.93 +extern void systemMessage(int, const char *, ...);
    1.94 +extern void systemScreenMessage(const char *msg, int slot = 0, int duration = 3000, const char *colorList = NULL);
    1.95 +extern bool systemSoundInit();
    1.96 +extern void systemSoundShutdown();
    1.97 +extern void systemSoundPause();
    1.98 +extern void systemSoundResume();
    1.99 +extern bool systemSoundIsPaused();
   1.100 +extern void systemSoundReset();
   1.101 +extern void systemSoundWriteToBuffer();
   1.102 +extern void systemSoundClearBuffer();
   1.103 +extern bool systemSoundCanChangeQuality();
   1.104 +extern bool systemSoundSetQuality(int quality);
   1.105 +extern u32  systemGetClock();
   1.106 +extern void systemSetTitle(const char *);
   1.107 +extern void systemShowSpeed(int);
   1.108 +extern void systemIncreaseThrottle();
   1.109 +extern void systemDecreaseThrottle();
   1.110 +extern void systemSetThrottle(int);
   1.111 +extern int  systemGetThrottle();
   1.112 +extern void systemFrame();
   1.113 +extern int  systemFramesToSkip();
   1.114 +extern bool systemIsEmulating();
   1.115 +extern void systemGbBorderOn();
   1.116 +extern bool systemIsRunningGBA();
   1.117 +extern bool systemIsSpedUp();
   1.118 +extern bool systemIsPaused();
   1.119 +extern void systemSetPause(bool pause);
   1.120 +extern bool systemPauseOnFrame();
   1.121 +
   1.122 +extern int	systemCartridgeType;
   1.123 +extern int  systemSpeed;
   1.124 +extern bool systemSoundOn;
   1.125 +extern u16  systemColorMap16[0x10000];
   1.126 +extern u32  systemColorMap32[0x10000];
   1.127 +extern u16  systemGbPalette[24];
   1.128 +extern int  systemRedShift;
   1.129 +extern int  systemGreenShift;
   1.130 +extern int  systemBlueShift;
   1.131 +extern int  systemColorDepth;
   1.132 +extern int  systemDebug;
   1.133 +extern int  systemVerbose;
   1.134 +extern int  systemFrameSkip;
   1.135 +extern int  systemSaveUpdateCounter;
   1.136 +
   1.137 +#define SYSTEM_SAVE_UPDATED 30
   1.138 +#define SYSTEM_SAVE_NOT_UPDATED 0
   1.139 +
   1.140 +#endif // VBA_SYSTEM_H