Homebrew What about using the DS as an android gamepad

Foxi4

Endless Trash
Global Moderator
Joined
Sep 13, 2009
Messages
28,548
Trophies
2
Location
Gaming Grotto
XP
26,077
Country
Poland
Android gamepads use Bluetooth which the DS is not equipped with. If there's a way to connect a gamepad via WiFi then perhaps it would be doable to code an app like that - I know there's one for PC.
 

cracker

Nyah!
Member
Joined
Aug 24, 2005
Messages
3,555
Trophies
0
XP
1,940
Country
United States
Though it is possible to do it would require a lot of work to program software on both the Android device and DS ends to connect. And then it would be only useful if there was AdHoc (direct connection without a router) mode for the wifi chip in the device. Which in turn on most devices you would lose your network connection since most wifi chips can only use one mode at once.

You're better off getting a PS3 controller and using that.
 

xXMortalKombatXx

Well-Known Member
OP
Newcomer
Joined
Apr 14, 2012
Messages
69
Trophies
0
XP
60
Country
Brazil
I didn't think about losing the internet access, but most people only use wi-fi for online gaming anyways (it would require a router). I was also thinking about making a simple ppjoy host only using the necessary stuff to get the DS keys working and on the DS side it would be done already, there's a homebrew application that sends ppjoy commands


Plus most gamepads such as the Wii remote can't connect anymore, as Google changed the BT stack in a way it doesn't connect to pairless devices, it's been like that since 4.2, and on latest android builds (4.4.2) it still wasn't fixed

*extra: I see no problem on the latency added by having a router in the middle?
 

Foxi4

Endless Trash
Global Moderator
Joined
Sep 13, 2009
Messages
28,548
Trophies
2
Location
Gaming Grotto
XP
26,077
Country
Poland
Honestly, the DS could do the complete barebones minimum of computing and the actuall button stroke interpreter could be on the Android side where there's more calculation power. All the DS has to do is read keystrokes, put them in a neat structure and send it through at regular intervals - I don't think that's beyond the scope of its capabilities. Actual gamepads are not powerhouses and work perfectly fine, the DS side of things wouldn't have to do a whole lot. Sounds like an interesting pet project, actually.
 

xXMortalKombatXx

Well-Known Member
OP
Newcomer
Joined
Apr 14, 2012
Messages
69
Trophies
0
XP
60
Country
Brazil
I think we can dedicate more of the ds's CPU to interpret the keys, it's battery would still last more than the phone's anyways, and every tweak for extra battery is always good on smartphones these days
 

Foxi4

Endless Trash
Global Moderator
Joined
Sep 13, 2009
Messages
28,548
Trophies
2
Location
Gaming Grotto
XP
26,077
Country
Poland
I think we can dedicate more of the ds's CPU to interpret the keys, it's battery would still last more than the phone's anyways, and every tweak for extra battery is always good on smartphones these days
This much is true, however the DS would have to connect with the phone in an AdHoc fashion - the latency introduced by the router could be pretty substantial in the long run, that's the issue more than anything.
 

Yepi69

Jill-sandwiched
Member
Joined
Nov 29, 2010
Messages
2,857
Trophies
0
Age
26
Location
Behind you
XP
1,700
Country
Portugal
You can if you have a PC nearby with internet connection, I actually used my DS to play Megaman X on my Android Tablet.

For the DS you need DS2KEY (Its homebrew, you need a flashcard to run it)
For the PC you need DS2KEY (you need an internet connection)
For your Android you need an app called Wi-Fi Keyboard

Here's how it is, DS2KEY sets up whatever button you wanna use, my configuration is:

DS2KEY:

Press A button = Computer receives the keyboard key A (using Wi-Fi keyboard) Android receives the keyboard key Z
Press B button = Computer receives the keyboard key (using Wi-Fi keyboard) Android receives the keyboard key X
Press the Start button = Computer receives the keyboard key Enter (using Wi-Fi keyboard) Android receives the keyboard key Enter
Press the Select button = Computer receives the keyboard key Backspace (using Wi-Fi keyboard) Android receives the keyboard key Backspace
Press the L button = Computer receives the keyboard key L (using Wi-Fi keyboard) Android receives the keyboard key L
Press the R button = Computer receives the keyboard key R (using Wi-Fi keyboard) Android receives the keyboard key R
Press the D-PAD UP = Computer receives the keyboard key UP Arrow (using Wi-Fi keyboard) Android receives the keyboard key W
Press the D-PAD DOWN = Computer receives the keyboard key DOWN Arrow (using Wi-Fi keyboard) Android receives the keyboard key S
Press the D-PAD LEFT = Computer receives the keyboard key LEFT Arrow (using Wi-Fi keyboard) Android receives the keyboard key A
Press the D-PAD RIGHT = Computer receives the keyboard key RIGHT Arrow (using Wi-Fi keyboard) Android receives the keyboard key D

So basically, DS2KEY transfers the input to PC and your PC transfers it to your android with the help of a Wifi keyboard app.
You can configure the key binds as you want, that was just my configuration.
 

Foxi4

Endless Trash
Global Moderator
Joined
Sep 13, 2009
Messages
28,548
Trophies
2
Location
Gaming Grotto
XP
26,077
Country
Poland
Hey I was bored, and I was short on money so I wanted to play retro games with a comfy D PAD and buttons :P
I know what you mean. I wanted to play PSP games on an HD TV once - connected to it by using RemoteJoy Lite on the PC and passing the signal through to the TV via HDMI. T'was a lot of cables... but it worked. :yaypsp:
 
  • Like
Reactions: Yepi69

YoshiInAVoid

Banned!
Banned
Joined
Jan 10, 2011
Messages
560
Trophies
0
Website
google.com
XP
453
Country
I actually wrote an application which does exactly this (for DS to PC) quite recently. Here's some parts part of my code:

Code:
unsigned int keys;
unsigned short delay = 1;
 
void sendKeys(unsigned int keys, char keyMapping) {
    outBuf[0] = keyMapping;
    memcpy(outBuf + 1, &keys, 4);
    sendBuf(5);
}
 
while(1) {
    for(i = 0; i < delay; i++) swiWaitForVBlank();
    keys = keysHeld();
    swiWaitForVBlank();
    scanKeys();
    sendKeys(keys, KEYS1);
}

I went with the option of sending the keys which are held down every other frame (~30 times a second). The delay is used to make sure that not too many packets are being sent (without any delay this happens about every 5 minutes, the keys will lag behind by 2 seconds or so for about 5 seconds)

Here's some parts of my server code:

Code:
#define newpress(key) ((currentKeys & key) && !(lastKeys & key))
#define release(key) (!(currentKeys & key) && (lastKeys & key))
 
#define handleKey(DSKey, PCKey) if(newpress(DSKey)) simulateKeyNewpress(PCKey);\
if(release(DSKey)) simulateKeyRelease(PCKey)
 
unsigned int lastKeys;
unsigned int currentKeys;
 
while(receiveBuffer(5) <= 0) {
    // Waiting
}
 
if(buffer[0] == KEYS1) {
    lastKeys = currentKeys;
    memcpy(&currentKeys, buffer + 1, 4);
 
    handleKey(KEY_A, 'A');
    handleKey(KEY_B, 'B');
    handleKey(KEY_SELECT, VK_BACK);
    handleKey(KEY_START, VK_RETURN);
    // ... cut out the rest
}
else {
    // Handle key mappings for player 2
}

It works reasonably well and you can even run two instances of the server at once on different ports and have 2 DSes connected at once, it'll work just as well. I've even had 7 connected at once and it still plays fine.

It really shouldn't be hard to port the server to Android, it just needs to receive a 5 byte buffer (first byte for the control mapping, other 4 are an integer which represent all keys on the DS) continuously and simulate key presses.

I hope this helps someone.
 

YoshiInAVoid

Banned!
Banned
Joined
Jan 10, 2011
Messages
560
Trophies
0
Website
google.com
XP
453
Country
Does this use an AdHoc connection like WifiMe?
The code I posted yesterday doesn't actually include any specific wireless code to send and receive buffers; it's just some snippets of code for someone to use as a template if they want to make their own DS controller client and server.

Since I don't have a PCI or PCMCIA wireless network card with the RT2500 or RT2560 chipset, I send data to my PC through my router first (using standard dswifi functions).
 
General chit-chat
Help Users
  • No one is chatting at the moment.
    KennieDaMeanie @ KennieDaMeanie: https://youtu.be/RZAKlo4VYHA psi you on airlines again