Permalink
Please sign in to comment.
Browse files
Moving everything to Trunk in prep for Branch "helper app" Open Emu p…
…roject. git-svn-id: https://openemu.svn.sourceforge.net/svnroot/openemu/Trunk@669 a16923d9-94c8-4a39-ae78-11df2d60a2ba
- Loading branch information...
Binary file not shown.
| @@ -0,0 +1,27 @@ | ||
| +/* | ||
| + * BSNESInterface.h | ||
| + * BSNES | ||
| + * | ||
| + * Created by Joshua Weinberg on 7/20/09. | ||
| + * Copyright 2009 __MyCompanyName__. All rights reserved. | ||
| + * | ||
| + */ | ||
| +#pragma once | ||
| + | ||
| +//#include <base.hpp> | ||
| +#include "system/interface/interface.hpp" | ||
| +#import "OERingBuffer.h" | ||
| + | ||
| +class BSNESInterface : public SNES::Interface { | ||
| +public: | ||
| + void video_refresh(uint16_t *data, unsigned pitch, unsigned *line, unsigned width, unsigned height); | ||
| + void audio_sample(uint16_t left, uint16_t right); | ||
| + void input_poll(); | ||
| + int16_t input_poll(unsigned deviceid, unsigned id); | ||
| + OERingBuffer *ringBuffer; | ||
| + int width; | ||
| + int height; | ||
| + int pitch; | ||
| + int16_t pad[2][12]; | ||
| + uint16_t *video; | ||
| +}; |
| @@ -0,0 +1,62 @@ | ||
| +#include <base.hpp> | ||
| +#include "BSNESInterface.h" | ||
| + | ||
| +void BSNESInterface::video_refresh(uint16_t *input, unsigned apitch, unsigned *line, unsigned awidth, unsigned aheight) { | ||
| + | ||
| + width = awidth; | ||
| + height = aheight; | ||
| + pitch = apitch; | ||
| + | ||
| + | ||
| + pitch >>= 1; | ||
| + | ||
| + uint16_t *output = video; | ||
| + for(unsigned y = 0; y < height; y++) | ||
| + { | ||
| + if(width == 512 && line[y] == 256) | ||
| + { | ||
| + for(unsigned x = 0; x < 256; x++) | ||
| + { | ||
| + uint16_t p = *input++; | ||
| + *output++ = p; | ||
| + *output++ = p; | ||
| + } | ||
| + input += 256; | ||
| + } | ||
| + else | ||
| + { | ||
| + for(unsigned x = 0; x < width; x++) | ||
| + { | ||
| + uint16_t p = *input++; | ||
| + *output++ = p; | ||
| + } | ||
| + } | ||
| + input += pitch - width; | ||
| + output += pitch - width; | ||
| + } | ||
| +} | ||
| + | ||
| +void BSNESInterface::audio_sample(uint16_t left, uint16_t right) { | ||
| + // if(config.audio.mute) left = right = 0; | ||
| + // audio.sample(left, right); | ||
| + //printf("sampled"); | ||
| + | ||
| + [ringBuffer write:&left maxLength:2]; | ||
| + [ringBuffer write:&right maxLength:2]; | ||
| +} | ||
| + | ||
| +void BSNESInterface::input_poll() { | ||
| + // inputManager.poll(); | ||
| +} | ||
| + | ||
| +int16_t BSNESInterface::input_poll(unsigned deviceid, unsigned a) { | ||
| + //NSLog(@"polled input: device: %d id: %d", deviceid, id); | ||
| + if (deviceid == SNES::Input::DeviceIDJoypad1) { | ||
| + return pad[0][a]; | ||
| + } | ||
| + else if(deviceid == SNES::Input::DeviceIDJoypad2) { | ||
| + return pad[1][a]; | ||
| + } | ||
| + | ||
| + return 0;//inputManager.getStatus(deviceid, id); | ||
| +} |
| @@ -0,0 +1,7 @@ | ||
| +// | ||
| +// Prefix header for all source files of the 'BSNES' target in the 'BSNES' project. | ||
| +// | ||
| + | ||
| +#ifdef __OBJC__ | ||
| + #import <Cocoa/Cocoa.h> | ||
| +#endif |
Oops, something went wrong.
0 comments on commit
c143e77