22 #ifndef __OSYS_N64_H__ 23 #define __OSYS_N64_H__ 25 #include "common/rect.h" 26 #include "common/config-manager.h" 28 #include "backends/base-backend.h" 30 #include "base/main.h" 32 #include "graphics/surface.h" 33 #include "graphics/paletteman.h" 34 #include "graphics/pixelformat.h" 36 #include "audio/mixer_intern.h" 41 #define DEFAULT_SOUND_SAMPLE_RATE 8000 // 8 kHz 44 #define N64_PAL_FPS 25 45 #define N64_NTSC_FPS 30 47 typedef int (*TimerProc)(
int interval);
50 void vblCallback(
void);
51 void sndCallback(
void);
52 void refillAudioBuffers(
void);
55 void enableAudioPlayback(
void);
56 void disableAudioPlayback(
void);
57 void checkTimers(
void);
58 int timer_handler(
int t);
60 static volatile bool _audioEnabled =
false;
76 struct display_context * _dc;
80 uint16 *_offscreen_hic;
81 uint8 *_offscreen_pal;
82 uint16 *_overlayBuffer;
84 uint16 *_screenPalette;
86 #ifndef N64_EXTREME_MEMORY_SAVING 87 uint8 *_screenExactPalette;
89 uint16 _cursorPalette[256];
92 uint16 _screenWidth, _screenHeight;
93 uint16 _gameWidth, _gameHeight;
94 uint16 _frameBufferWidth;
103 bool _cursorPaletteDisabled;
106 uint _cursorWidth, _cursorHeight;
110 uint16 _overlayHeight, _overlayWidth;
111 bool _overlayVisible;
114 bool _disableFpsLimit;
117 volatile int _mouseX, _mouseY;
118 volatile float _tempMouseX, _tempMouseY;
119 volatile int _mouseMaxX, _mouseMaxY;
120 int _mouseHotspotX, _mouseHotspotY;
122 int8 _controllerPort;
124 bool _controllerHasRumble;
126 bool _dirtyOffscreen;
131 uint16 _audioBufferSize;
134 uint32 _timerCallbackNext;
135 uint32 _timerCallbackTimer;
136 TimerProc _timerCallback;
158 virtual void setPalette(
const byte *colors, uint start, uint num);
159 virtual void grabPalette(byte *colors, uint start, uint num)
const;
162 virtual void copyRectToScreen(
const void *buf,
int pitch,
int x,
int y,
int w,
int h);
166 virtual void setShakePos(
int shakeXOffset,
int shakeYOffset);
173 virtual void copyRectToOverlay(
const void *buf,
int pitch,
int x,
int y,
int w,
int h);
183 virtual void setMouseCursor(
const void *buf, uint w, uint h,
int hotspotX,
int hotspotY, uint32 keycolor,
bool dontScale,
const Graphics::PixelFormat *format,
const byte *mask);
187 virtual uint32
getMillis(
bool skipRecord =
false);
196 virtual void setTimerCallback(TimerProc callback,
int interval);
199 void rebuildOffscreenGameBuffer(
void);
200 void rebuildOffscreenMouseBuffer(
void);
201 void switchGraphicModeId(
int mode);
203 void setupMixer(
void);
205 void detectControllers(
void);
206 void readControllerAnalogInput(
void);
virtual int16 getOverlayWidth()
virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format)
virtual Graphics::PixelFormat getOverlayFormat() const
Definition: osys_n64.h:176
virtual int16 getHeight()
virtual void grabOverlay(Graphics::Surface &surface)
virtual void getTimeAndDate(TimeDate &t, bool skipRecord=false) const
Feature
Definition: system.h:403
virtual void setPalette(const byte *colors, uint start, uint num)
virtual int16 getOverlayHeight()
virtual void hideOverlay()
virtual bool hasFeature(Feature f)
virtual void warpMouse(int x, int y)
virtual void unlockScreen()
virtual bool setGraphicsMode(int mode, uint flags=OSystem::kGfxModeNoFlags)
virtual Common::MutexInternal * createMutex(void)
virtual void setShakePos(int shakeXOffset, int shakeYOffset)
virtual int getDefaultGraphicsMode() const
Definition: mixer_intern.h:58
virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h)
virtual void updateScreen()
virtual const GraphicsMode * getSupportedGraphicsModes() const
virtual bool isOverlayVisible() const
Definition: osys_n64.h:170
virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format, const byte *mask)
virtual void showOverlay(bool inGUI)
virtual void clearOverlay()
virtual Audio::Mixer * getMixer()
virtual void initBackend()
virtual bool pollEvent(Common::Event &event)
virtual int getGraphicsMode() const
virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h)
virtual void setCursorPalette(const byte *colors, uint start, uint num)
virtual PaletteManager * getPaletteManager()
Definition: osys_n64.h:155
Definition: base-backend.h:44
virtual uint32 getMillis(bool skipRecord=false)
virtual void logMessage(LogMessageType::Type type, const char *message)
virtual void delayMillis(uint msecs)
Definition: osys_n64.h:72
virtual Graphics::Surface * lockScreen()
Definition: paletteman.h:47
virtual void grabPalette(byte *colors, uint start, uint num) const
virtual bool getFeatureState(Feature f)
virtual void setFeatureState(Feature f, bool enable)
virtual bool showMouse(bool visible)