Emulator.h (2284B)
1/* 2 * Gearboy - Nintendo Game Boy Emulator 3 * Copyright (C) 2012 Ignacio Sanchez 4 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * any later version. 9 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see http://www.gnu.org/licenses/ 17 * 18 */ 19 20#import <Foundation/Foundation.h> 21#import <GLKit/GLKit.h> 22 23#ifdef __APPLE__ 24#if TARGET_IPHONE_SIMULATOR == 1 || TARGET_OS_IPHONE == 1 25#define SDL_MAIN_HANDLED 26#endif 27#endif 28 29#import "../../../src/gearboy.h" 30#import "../../../platforms/audio-shared/Sound_Queue.h" 31#import "EmulatorInput.h" 32#include "texturemanager.h" 33 34@interface Emulator : NSObject 35{ 36 GearboyCore* theGearboyCore; 37 Sound_Queue* theSoundQueue; 38 s16 theSampleBufffer[AUDIO_BUFFER_SIZE]; 39 u16* theFrameBuffer; 40 u16* theTexture; 41 EmulatorInput* theInput; 42 GLuint accumulationFramebuffer; 43 GLuint accumulationTexture; 44 GLuint GBTexture; 45 Texture* dotMatrixDMGTexture; 46 Texture* dotMatrixCGBTexture; 47 BOOL firstFrame; 48 BOOL saveStatePending; 49 BOOL loadStatePending; 50} 51 52@property (nonatomic) BOOL audioEnabled; 53@property (nonatomic) float multiplier; 54@property (nonatomic) BOOL retina; 55@property (nonatomic) BOOL iPad; 56@property (nonatomic) GLKView* glview; 57 58 59- (void)update; 60- (void)draw; 61- (void)loadRomWithPath: (NSString *)filePath; 62- (void)keyPressed: (Gameboy_Keys)key; 63- (void)keyReleased: (Gameboy_Keys)key; 64- (void)pause; 65- (void)resume; 66- (BOOL)paused; 67- (void)reset; 68- (void)save; 69- (void)initGL; 70- (void)shutdownGL; 71- (void)renderFrame; 72- (void)renderMixFrames; 73- (void)renderDotMatrix; 74- (void)setupTextureWithData: (GLvoid*) data; 75- (void)renderQuadWithViewportWidth: (float)viewportWidth andHeight: (float)viewportHeight andMirrorY: (BOOL)mirrorY; 76- (void)setAudioEnabled: (BOOL)enabled; 77- (void)resetAudio; 78- (void)saveState; 79- (void)loadState; 80 81@end