Skip to content

Commit

Permalink
AppleTV remote - basic working version
Browse files Browse the repository at this point in the history
  • Loading branch information
kevsmithpublic committed Nov 8, 2015
1 parent fd18b40 commit d25c47d
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 22 deletions.
31 changes: 15 additions & 16 deletions Classes/LesObjCInterface.m
Expand Up @@ -113,10 +113,10 @@ +(void)handleMFIController

if (usingTVRemote) {

if (gameController.microGamepad.buttonX.isPressed && gameController.microGamepad.buttonA.isPressed && selectPressed<30)
if (gameController.microGamepad.buttonX.isPressed && gameController.microGamepad.buttonA.isPressed && selectPressed<20)
{
selectPressed++;
if (selectPressed<10){
if (selectPressed<5){
printf("Select");
gp2x_pad_status |= GP2X_SELECT;
btnStates[BTN_SELECT] = BUTTON_PRESS;
Expand All @@ -127,27 +127,25 @@ +(void)handleMFIController
btnStates[BTN_START] = BUTTON_PRESS;
return;
}

return;
}


if (gameController.microGamepad.buttonA.isPressed) {
printf("A");
gp2x_pad_status |= GP2X_B;
btnStates[BTN_B] = BUTTON_PRESS;
return;
printf("X");
gp2x_pad_status |= GP2X_X;
btnStates[BTN_X] = BUTTON_PRESS;
}

if (gameController.microGamepad.buttonX.isPressed) {
printf("X-B");
gp2x_pad_status |= GP2X_A;
btnStates[BTN_A] = BUTTON_PRESS;
return;
printf("B");
gp2x_pad_status |= GP2X_B;
btnStates[BTN_B] = BUTTON_PRESS;
}

const float sensitivity=.5;
const float sensitivity=.1;

/*
if (gameController.microGamepad.dpad.left.value>=sensitivity &&
gameController.microGamepad.dpad.up.value>=sensitivity) {
printf("Up/Left %f",gameController.microGamepad.dpad.left.value);
Expand Down Expand Up @@ -177,27 +175,28 @@ +(void)handleMFIController
gp2x_pad_status |= GP2X_UP;
return;
}
*/

if (gameController.microGamepad.dpad.left.value>=sensitivity) {
printf("Left %f",gameController.microGamepad.dpad.left.value);
gp2x_pad_status |= GP2X_LEFT;
return;
//return;
}
//
if (gameController.microGamepad.dpad.right.value>=sensitivity) {
printf("Right %f",gameController.microGamepad.dpad.right.value);
gp2x_pad_status |= GP2X_RIGHT;
return;
//return;
}
if (gameController.microGamepad.dpad.up.value>=sensitivity) {
printf("Up");
gp2x_pad_status |= GP2X_UP;
return;
//return;
}
if (gameController.microGamepad.dpad.down.value>=sensitivity) {
printf("Down");
gp2x_pad_status |= GP2X_DOWN;
return;
//return;
}

return;
Expand Down
14 changes: 14 additions & 0 deletions README.md
Expand Up @@ -18,6 +18,20 @@ To get this to work you need

- Drag the rom zip file into the resource folder in the xcode project so they are copied to the device (Should appear as files in Build Phases/ Copy Bundle resources)

Apple TV - Brief guide to using to play game (Tested with 1942,Donkey Kong, Raiden)

- Turn the controller on it's side (It will work both directions but I found this easier)
- Select rom using up down on dpad
- Press play to select
- Swipe left/right for OK message
- Hold play and press dpad for credit
- Hold play and press dpad for start
- Play game :-)


The code needs some work but you can play basic games


Areas that need work

- Sound - fix arm64 assembler which has been commented out
Expand Down
24 changes: 24 additions & 0 deletions iMAME4tvOS.xcodeproj/project.pbxproj
Expand Up @@ -42,6 +42,12 @@
0AACBCBA1BB8D98B007C0EBF /* icon-72.png in Resources */ = {isa = PBXBuildFile; fileRef = 8E13888E13F5933C005CF68A /* icon-72.png */; };
0AACBCBB1BB8D98B007C0EBF /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 8E13888F13F5933C005CF68A /* icon.png */; };
0AACBCBC1BB8D98B007C0EBF /* icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 8E13889013F5933C005CF68A /* icon@2x.png */; };
0ACF75471BEEC7AE0037BA71 /* 1942.zip in Resources */ = {isa = PBXBuildFile; fileRef = 0ACF75411BEEC7AE0037BA71 /* 1942.zip */; };
0ACF75481BEEC7AE0037BA71 /* dkong.zip in Resources */ = {isa = PBXBuildFile; fileRef = 0ACF75421BEEC7AE0037BA71 /* dkong.zip */; };
0ACF75491BEEC7AE0037BA71 /* galaga.zip in Resources */ = {isa = PBXBuildFile; fileRef = 0ACF75431BEEC7AE0037BA71 /* galaga.zip */; };
0ACF754A1BEEC7AE0037BA71 /* pacman.zip in Resources */ = {isa = PBXBuildFile; fileRef = 0ACF75441BEEC7AE0037BA71 /* pacman.zip */; };
0ACF754B1BEEC7AE0037BA71 /* raiden.zip in Resources */ = {isa = PBXBuildFile; fileRef = 0ACF75451BEEC7AE0037BA71 /* raiden.zip */; };
0ACF754C1BEEC7AE0037BA71 /* timeplt.zip in Resources */ = {isa = PBXBuildFile; fileRef = 0ACF75461BEEC7AE0037BA71 /* timeplt.zip */; };
0AF567211BB75B7F002FA553 /* artwork.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 638F63FC12CCFDE500DF79C0 /* artwork.cpp */; };
0AF567221BB75B7F002FA553 /* audit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 638F63FE12CCFDE500DF79C0 /* audit.cpp */; };
0AF567231BB75B7F002FA553 /* cheat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 638F640012CCFDE500DF79C0 /* cheat.cpp */; };
Expand Down Expand Up @@ -632,6 +638,12 @@
0AACBC9C1BB8D14B007C0EBF /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.0.sdk/System/Library/Frameworks/GameController.framework; sourceTree = DEVELOPER_DIR; };
0AACBC9E1BB8D164007C0EBF /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.0.sdk/System/Library/Frameworks/AudioToolbox.framework; sourceTree = DEVELOPER_DIR; };
0AACBCA01BB8D171007C0EBF /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
0ACF75411BEEC7AE0037BA71 /* 1942.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; name = 1942.zip; path = res/roms/1942.zip; sourceTree = "<group>"; };
0ACF75421BEEC7AE0037BA71 /* dkong.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; name = dkong.zip; path = res/roms/dkong.zip; sourceTree = "<group>"; };
0ACF75431BEEC7AE0037BA71 /* galaga.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; name = galaga.zip; path = res/roms/galaga.zip; sourceTree = "<group>"; };
0ACF75441BEEC7AE0037BA71 /* pacman.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; name = pacman.zip; path = res/roms/pacman.zip; sourceTree = "<group>"; };
0ACF75451BEEC7AE0037BA71 /* raiden.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; name = raiden.zip; path = res/roms/raiden.zip; sourceTree = "<group>"; };
0ACF75461BEEC7AE0037BA71 /* timeplt.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; name = timeplt.zip; path = res/roms/timeplt.zip; sourceTree = "<group>"; };
0AF569651BB75D7D002FA553 /* tvOSBootstrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tvOSBootstrapper.h; sourceTree = "<group>"; };
0AF569661BB75D7D002FA553 /* tvOSBootstrapper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = tvOSBootstrapper.m; sourceTree = "<group>"; };
1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -1590,6 +1602,12 @@
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
0ACF75411BEEC7AE0037BA71 /* 1942.zip */,
0ACF75421BEEC7AE0037BA71 /* dkong.zip */,
0ACF75431BEEC7AE0037BA71 /* galaga.zip */,
0ACF75441BEEC7AE0037BA71 /* pacman.zip */,
0ACF75451BEEC7AE0037BA71 /* raiden.zip */,
0ACF75461BEEC7AE0037BA71 /* timeplt.zip */,
0A7343ED1BED8A8800814197 /* dkong.zip */,
0A7343EE1BED8A8800814197 /* galaga.zip */,
215F66A6184BC4240053E5A0 /* cheat.dat */,
Expand Down Expand Up @@ -2859,8 +2877,11 @@
0AACBCA51BB8D98B007C0EBF /* gamelist.txt in Resources */,
0AACBCA61BB8D98B007C0EBF /* hiscore.dat in Resources */,
0AACBCA71BB8D98B007C0EBF /* nvram in Resources */,
0ACF754A1BEEC7AE0037BA71 /* pacman.zip in Resources */,
0ACF75491BEEC7AE0037BA71 /* galaga.zip in Resources */,
0AACBCA81BB8D98B007C0EBF /* skins in Resources */,
0A7343F01BED8A8800814197 /* galaga.zip in Resources */,
0ACF754B1BEEC7AE0037BA71 /* raiden.zip in Resources */,
0AACBCA91BB8D98B007C0EBF /* artwork in Resources */,
0AACBCAA1BB8D98B007C0EBF /* samples in Resources */,
0AACBCAB1BB8D98B007C0EBF /* SKIN_2 in Resources */,
Expand All @@ -2875,9 +2896,12 @@
0AACBCB41BB8D98B007C0EBF /* crt-1.png in Resources */,
0AACBCB51BB8D98B007C0EBF /* crt-2.png in Resources */,
0AACBCB61BB8D98B007C0EBF /* Default-Landscape.png in Resources */,
0ACF75481BEEC7AE0037BA71 /* dkong.zip in Resources */,
0ACF754C1BEEC7AE0037BA71 /* timeplt.zip in Resources */,
0AACBCB71BB8D98B007C0EBF /* Default-Portrait.png in Resources */,
0AACBCB81BB8D98B007C0EBF /* Default.png in Resources */,
0AACBCB91BB8D98B007C0EBF /* Default@2x.png in Resources */,
0ACF75471BEEC7AE0037BA71 /* 1942.zip in Resources */,
0AACBCBA1BB8D98B007C0EBF /* icon-72.png in Resources */,
0AACBCBB1BB8D98B007C0EBF /* icon.png in Resources */,
0AACBCBC1BB8D98B007C0EBF /* icon@2x.png in Resources */,
Expand Down
Binary file not shown.
Expand Up @@ -90,11 +90,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Classes/LesObjCInterface.m"
timestampString = "468556656.74625"
timestampString = "468633881.453444"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "297"
endingLineNumber = "297"
startingLineNumber = "296"
endingLineNumber = "296"
landmarkName = "+handleMFIController"
landmarkType = "5">
</BreakpointContent>
Expand Down Expand Up @@ -266,11 +266,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Classes/LesObjCInterface.m"
timestampString = "468556656.74625"
timestampString = "468633252.768257"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "142"
endingLineNumber = "142"
startingLineNumber = "140"
endingLineNumber = "140"
landmarkName = "+handleMFIController"
landmarkType = "5">
</BreakpointContent>
Expand Down
Binary file added res/roms/1942.zip
Binary file not shown.
Binary file added res/roms/dkong.zip
Binary file not shown.
Binary file added res/roms/galaga.zip
Binary file not shown.
Binary file added res/roms/pacman.zip
Binary file not shown.
Binary file added res/roms/raiden.zip
Binary file not shown.
Binary file added res/roms/timeplt.zip
Binary file not shown.

0 comments on commit d25c47d

Please sign in to comment.