-
-
Notifications
You must be signed in to change notification settings - Fork 694
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
941 changed files
with
14,262 additions
and
1,737 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"files": ["README.md"], | ||
"imageSize": 100, | ||
"contributorsPerLine": 7, | ||
"contributorsSortAlphabetically": false, | ||
"badgeTemplate": "[![All Contributors](https://img.shields.io/badge/all_contributors-<%= contributors.length %>-orange.svg?style=flat-square)](#contributors)", | ||
"contributorTemplate": "<a href=\"<%= contributor.profile %>\"><img src=\"<%= contributor.avatar_url %>\" width=\"<%= options.imageSize %>px;\" alt=\"\"/><br /><sub><b><%= contributor.name %></b></sub></a>", | ||
"types": { | ||
"custom": { | ||
"symbol": "🔭", | ||
"description": "A custom contribution type.", | ||
"link": "[<%= symbol %>](<%= url %> \"<%= description %>\")," | ||
} | ||
}, | ||
"skipCi": "true", | ||
"contributors": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// Cores.h | ||
// Cores | ||
// | ||
// Created by Joseph Mattiello on 3/12/22. | ||
// Copyright © 2022 Provenance Emu. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
//! Project version number for Cores. | ||
FOUNDATION_EXPORT double CoresVersionNumber; | ||
|
||
//! Project version string for Cores. | ||
FOUNDATION_EXPORT const unsigned char CoresVersionString[]; | ||
|
||
// In this header, you should import all the public headers of your framework using statements like #import <Cores/PublicHeader.h> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// BuildFlags.xcconfig | ||
// PVDosBox | ||
// | ||
// Created by Joseph Mattiello on 11/1/18. | ||
// | ||
// | ||
|
||
// All | ||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) | ||
OTHER_CFLAGS = $(inherited) | ||
|
||
// Device | ||
GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*] = $(inherited) TARGET_IPHONE=1 | ||
OTHER_CFLAGS[sdk=iphoneos*] = $(inherited) | ||
|
||
// Simulator | ||
GCC_PREPROCESSOR_DEFINITIONS[sdk=iphonesimulator*] = $(inherited) TARGET_IPHONE_SIMULATOR=1 | ||
|
||
// tvOS Device | ||
GCC_PREPROCESSOR_DEFINITIONS[sdk=appletvos*] = $(inherited) TARGET_IPHONE=1 | ||
OTHER_CFLAGS[sdk=appletvos*] = $(inherited) | ||
|
||
// tvOS Simulator | ||
GCC_PREPROCESSOR_DEFINITIONS[sdk=appletvsimulator*] = $(inherited) TARGET_IPHONE_SIMULATOR=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// PVDosBoxCore+Audio.h | ||
// PVDosBox | ||
// | ||
// Created by Joseph Mattiello on 11/1/18. | ||
// Copyright © 2021 Provenance. All rights reserved. | ||
// | ||
|
||
#import <PVDosBox/PVDosBox.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface PVDosBoxCore (Audio) | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// PVDosBoxCore+Audio.m | ||
// PVDosBox | ||
// | ||
// Created by Joseph Mattiello on 11/1/18. | ||
// Copyright © 2021 Provenance. All rights reserved. | ||
// | ||
|
||
#import "PVDosBoxCore+Audio.h" | ||
|
||
@implementation PVDosBoxCore (Audio) | ||
|
||
- (NSTimeInterval)frameInterval { | ||
return isNTSC ? 60 : 50; | ||
} | ||
|
||
- (NSUInteger)channelCount { | ||
return 2; | ||
} | ||
|
||
- (double)audioSampleRate { | ||
return sampleRate; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// | ||
// PVDosBoxCore+Controls.h | ||
// PVDosBox | ||
// | ||
// Created by Joseph Mattiello on 11/1/18. | ||
// Copyright © 2021 Provenance. All rights reserved. | ||
// | ||
|
||
#import <PVDosBox/PVDosBoxCore.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface PVDosBoxCore (Controls) <PVGameCubeSystemResponderClient> | ||
|
||
- (void)initControllBuffers; | ||
- (void)pollControllers; | ||
|
||
#pragma mark - Control | ||
|
||
- (void)didPushGameCubeButton:(enum PVGameCubeButton)button forPlayer:(NSInteger)player; | ||
- (void)didReleaseGameCubeButton:(enum PVGameCubeButton)button forPlayer:(NSInteger)player; | ||
- (void)didMoveGameCubeJoystickDirection:(enum PVGameCubeButton)button withValue:(CGFloat)value forPlayer:(NSInteger)player; | ||
- (void)didMoveJoystick:(NSInteger)button withValue:(CGFloat)value forPlayer:(NSInteger)player; | ||
|
||
- (void)didPush:(NSInteger)button forPlayer:(NSInteger)player; | ||
- (void)didRelease:(NSInteger)button forPlayer:(NSInteger)player; | ||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
202 changes: 202 additions & 0 deletions
202
Cores/DosBox/PBDosBoxCore/Core/PVDosBoxCore+Controls.mm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,202 @@ | ||
// | ||
// PVDosBoxCore+Controls.m | ||
// PVDosBox | ||
// | ||
// Created by Joseph Mattiello on 11/1/18. | ||
// Copyright © 2021 Provenance. All rights reserved. | ||
// | ||
|
||
#import <PVDosBox/PVDosBox.h> | ||
#import <Foundation/Foundation.h> | ||
#import <PVSupport/PVSupport.h> | ||
|
||
#define DC_BTN_C (1<<0) | ||
#define DC_BTN_B (1<<1) | ||
#define DC_BTN_A (1<<2) | ||
#define DC_BTN_START (1<<3) | ||
#define DC_DPAD_UP (1<<4) | ||
#define DC_DPAD_DOWN (1<<5) | ||
#define DC_DPAD_LEFT (1<<6) | ||
#define DC_DPAD_RIGHT (1<<7) | ||
#define DC_BTN_Z (1<<8) | ||
#define DC_BTN_Y (1<<9) | ||
#define DC_BTN_X (1<<10) | ||
#define DC_BTN_D (1<<11) | ||
#define DC_DPAD2_UP (1<<12) | ||
#define DC_DPAD2_DOWN (1<<13) | ||
#define DC_DPAD2_LEFT (1<<14) | ||
#define DC_DPAD2_RIGHT (1<<15) | ||
|
||
#define DC_AXIS_LT (0X10000) | ||
#define DC_AXIS_RT (0X10001) | ||
#define DC_AXIS_X (0X20000) | ||
#define DC_AXIS_Y (0X20001) | ||
|
||
static const int GameCubeMap[] = { | ||
DC_DPAD_UP, DC_DPAD_DOWN, DC_DPAD_LEFT, DC_DPAD_RIGHT, | ||
DC_BTN_A, DC_BTN_B, DC_BTN_X, DC_BTN_Y, | ||
DC_AXIS_LT, DC_AXIS_RT, | ||
DC_BTN_START | ||
}; | ||
|
||
typedef unsigned char u8; | ||
typedef signed char s8; | ||
typedef unsigned short u16; | ||
typedef unsigned int u32; | ||
|
||
// Reicast controller data | ||
u16 kcode[4]; | ||
u8 rt[4]; | ||
u8 lt[4]; | ||
u32 vks[4]; | ||
s8 joyx[4], joyy[4]; | ||
|
||
@implementation PVDosBoxCore (Controls) | ||
|
||
- (void)initControllBuffers { | ||
memset(&kcode, 0xFFFF, sizeof(kcode)); | ||
bzero(&rt, sizeof(rt)); | ||
bzero(<, sizeof(lt)); | ||
} | ||
|
||
#pragma mark - Control | ||
|
||
- (void)pollControllers { | ||
for (NSInteger playerIndex = 0; playerIndex < 4; playerIndex++) | ||
{ | ||
GCController *controller = nil; | ||
|
||
if (self.controller1 && playerIndex == 0) | ||
{ | ||
controller = self.controller1; | ||
} | ||
else if (self.controller2 && playerIndex == 1) | ||
{ | ||
controller = self.controller2; | ||
} | ||
else if (self.controller3 && playerIndex == 3) | ||
{ | ||
controller = self.controller3; | ||
} | ||
else if (self.controller4 && playerIndex == 4) | ||
{ | ||
controller = self.controller4; | ||
} | ||
|
||
if ([controller extendedGamepad]) | ||
{ | ||
GCExtendedGamepad *gamepad = [controller extendedGamepad]; | ||
GCControllerDirectionPad *dpad = [gamepad dpad]; | ||
|
||
dpad.up.isPressed ? kcode[playerIndex] &= ~(DC_DPAD_UP) : kcode[playerIndex] |= (DC_DPAD_UP); | ||
dpad.down.isPressed ? kcode[playerIndex] &= ~(DC_DPAD_DOWN) : kcode[playerIndex] |= (DC_DPAD_DOWN); | ||
dpad.left.isPressed ? kcode[playerIndex] &= ~(DC_DPAD_LEFT) : kcode[playerIndex] |= (DC_DPAD_LEFT); | ||
dpad.right.isPressed ? kcode[playerIndex] &= ~(DC_DPAD_RIGHT) : kcode[playerIndex] |= (DC_DPAD_RIGHT); | ||
|
||
gamepad.buttonA.isPressed ? kcode[playerIndex] &= ~(DC_BTN_A) : kcode[playerIndex] |= (DC_BTN_A); | ||
gamepad.buttonB.isPressed ? kcode[playerIndex] &= ~(DC_BTN_B) : kcode[playerIndex] |= (DC_BTN_B); | ||
gamepad.buttonX.isPressed ? kcode[playerIndex] &= ~(DC_BTN_X) : kcode[playerIndex] |= (DC_BTN_X); | ||
gamepad.buttonY.isPressed ? kcode[playerIndex] &= ~(DC_BTN_Y) : kcode[playerIndex] |= (DC_BTN_Y); | ||
|
||
gamepad.leftShoulder.isPressed ? kcode[playerIndex] &= ~(DC_AXIS_LT) : kcode[playerIndex] |= (DC_AXIS_LT); | ||
gamepad.rightShoulder.isPressed ? kcode[playerIndex] &= ~(DC_AXIS_RT) : kcode[playerIndex] |= (DC_AXIS_RT); | ||
|
||
gamepad.leftTrigger.isPressed ? kcode[playerIndex] &= ~(DC_BTN_Z) : kcode[playerIndex] |= (DC_BTN_Z); | ||
gamepad.rightTrigger.isPressed ? kcode[playerIndex] &= ~(DC_BTN_START) : kcode[playerIndex] |= (DC_BTN_START); | ||
|
||
|
||
float xvalue = gamepad.leftThumbstick.xAxis.value; | ||
s8 x=(s8)(xvalue*127); | ||
joyx[0] = x; | ||
|
||
float yvalue = gamepad.leftThumbstick.yAxis.value; | ||
s8 y=(s8)(yvalue*127 * - 1); //-127 ... + 127 range | ||
joyy[0] = y; | ||
|
||
} else if ([controller gamepad]) { | ||
GCGamepad *gamepad = [controller gamepad]; | ||
GCControllerDirectionPad *dpad = [gamepad dpad]; | ||
|
||
dpad.up.isPressed ? kcode[playerIndex] &= ~(DC_DPAD_UP) : kcode[playerIndex] |= (DC_DPAD_UP); | ||
dpad.down.isPressed ? kcode[playerIndex] &= ~(DC_DPAD_DOWN) : kcode[playerIndex] |= (DC_DPAD_DOWN); | ||
dpad.left.isPressed ? kcode[playerIndex] &= ~(DC_DPAD_LEFT) : kcode[playerIndex] |= (DC_DPAD_LEFT); | ||
dpad.right.isPressed ? kcode[playerIndex] &= ~(DC_DPAD_RIGHT) : kcode[playerIndex] |= (DC_DPAD_RIGHT); | ||
|
||
gamepad.buttonA.isPressed ? kcode[playerIndex] &= ~(DC_BTN_A) : kcode[playerIndex] |= (DC_BTN_A); | ||
gamepad.buttonB.isPressed ? kcode[playerIndex] &= ~(DC_BTN_B) : kcode[playerIndex] |= (DC_BTN_B); | ||
gamepad.buttonX.isPressed ? kcode[playerIndex] &= ~(DC_BTN_X) : kcode[playerIndex] |= (DC_BTN_X); | ||
gamepad.buttonY.isPressed ? kcode[playerIndex] &= ~(DC_BTN_Y) : kcode[playerIndex] |= (DC_BTN_Y); | ||
|
||
gamepad.leftShoulder.isPressed ? kcode[playerIndex] &= ~(DC_AXIS_LT) : kcode[playerIndex] |= (DC_AXIS_LT); | ||
gamepad.rightShoulder.isPressed ? kcode[playerIndex] &= ~(DC_AXIS_RT) : kcode[playerIndex] |= (DC_AXIS_RT); | ||
} | ||
#if TARGET_OS_TV | ||
else if ([controller microGamepad]) { | ||
GCMicroGamepad *gamepad = [controller microGamepad]; | ||
GCControllerDirectionPad *dpad = [gamepad dpad]; | ||
} | ||
#endif | ||
} | ||
} | ||
|
||
-(void)didPushGameCubeButton:(enum PVGameCubeButton)button forPlayer:(NSInteger)player { | ||
// if(_isInitialized) | ||
// { | ||
// } | ||
} | ||
|
||
-(void)didReleaseGameCubeButton:(enum PVGameCubeButton)button forPlayer:(NSInteger)player { | ||
// if(_isInitialized) | ||
// { | ||
// } | ||
} | ||
|
||
- (void)didMoveGameCubeJoystickDirection:(enum PVGameCubeButton)button withValue:(CGFloat)value forPlayer:(NSInteger)player { | ||
// if(_isInitialized) | ||
// { | ||
// } | ||
} | ||
|
||
-(void)didMoveJoystick:(NSInteger)button withValue:(CGFloat)value forPlayer:(NSInteger)player { | ||
[self didMoveGameCubeJoystickDirection:(enum PVGameCubeButton)button withValue:value forPlayer:player]; | ||
} | ||
|
||
- (void)didPush:(NSInteger)button forPlayer:(NSInteger)player { | ||
[self didPushGameCubeButton:(PVGameCubeButton)button forPlayer:player]; | ||
} | ||
|
||
- (void)didRelease:(NSInteger)button forPlayer:(NSInteger)player { | ||
[self didReleaseGameCubeButton:(PVGameCubeButton)button forPlayer:player]; | ||
} | ||
|
||
|
||
# pragma mark - Input Wii | ||
//- (oneway void)didMoveWiiJoystickDirection:(OEWiiButton)button withValue:(CGFloat)value forPlayer:(NSUInteger)player | ||
//{ | ||
// if(_isInitialized) | ||
// { | ||
// dol_host->SetAxis(button, value, (int)player); | ||
// } | ||
//} | ||
// | ||
//- (oneway void)didPushWiiButton:(OEWiiButton)button forPlayer:(NSUInteger)player | ||
//{ | ||
// if(_isInitialized) | ||
// { | ||
// if (button > OEWiiButtonCount) { | ||
// dol_host->processSpecialKeys(button , (int)player); | ||
// } else { | ||
// dol_host->setButtonState(button, 1, (int)player); | ||
// } | ||
// } | ||
//} | ||
// | ||
//- (oneway void)didReleaseWiiButton:(OEWiiButton)button forPlayer:(NSUInteger)player | ||
//{ | ||
// if(_isInitialized && button != OEWiimoteSideways && button != OEWiimoteUpright) | ||
// { | ||
// dol_host->setButtonState(button, 0, (int)player); | ||
// } | ||
//} | ||
|
||
@end |
Oops, something went wrong.