Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,768,001 Members 39,906 Now Online
XDA Developers Android and Mobile Development Forum

Using hardware keys in games

Tip us?
 
worldextermination
Old
#1  
worldextermination's Avatar
Member - OP
Thanks Meter 25
Posts: 42
Join Date: Jan 2013
Location: Philadelphia, PA
Default Using hardware keys in games

I recently started playing Critical Strike Portable on my LG OG Pro, and I noticed it's hard to aim and shoot at the same time. My fix for this is to assign the button above the volume buttons (default is camera on PAC-ROM) as the fire key. Question is, how do I do this? I assume I'd have to unpack the APK and edit the configuration file to accept the key as fire. But I'm sure I'd have to throw some device specific mumbo jumbo in there to get it to work properly. Can anyone help me out or point me in the right direction? Thank you!

Sent from my LG-E980 using xda app-developers app
 
ramdante
Old
#2  
Member
Thanks Meter 4
Posts: 58
Join Date: Nov 2011
Quote:
Originally Posted by worldextermination View Post
I recently started playing Critical Strike Portable on my LG OG Pro, and I noticed it's hard to aim and shoot at the same time. My fix for this is to assign the button above the volume buttons (default is camera on PAC-ROM) as the fire key. Question is, how do I do this? I assume I'd have to unpack the APK and edit the configuration file to accept the key as fire. But I'm sure I'd have to throw some device specific mumbo jumbo in there to get it to work properly. Can anyone help me out or point me in the right direction? Thank you!

Sent from my LG-E980 using xda app-developers app
Use a ps3 controller over bluetooth instead, if you have that.
 
worldextermination
Old
#3  
worldextermination's Avatar
Member - OP
Thanks Meter 25
Posts: 42
Join Date: Jan 2013
Location: Philadelphia, PA
I don't have one, although I do have an Xbox 360, which I believe is bluetooth as well, but that kind of defeats the purpose.
 
Neroga
Old
#4  
Neroga's Avatar
Senior Member
Thanks Meter 521
Posts: 1,257
Join Date: Feb 2012
Location: Saint Cloud, Florida
I'm not exactly sure what to change it to but editing the hardware buttons is quite simple. Go to /system/usr/keylayout/gk-keypad-8064.kl and change key 250 to something else. I would assume that changing it to 1 would make it type the number 1 so you might be able to assign fire to that hardware button if the app allows it.

Sent from my Optimus G Pro using XDA Premium 4 mobile app
 
worldextermination
Old
#5  
worldextermination's Avatar
Member - OP
Thanks Meter 25
Posts: 42
Join Date: Jan 2013
Location: Philadelphia, PA
Sweet! I'll try it as soon as I get home! Though I'm not sure what I would assign it to, since the game uses touch commands. Is there any way I can edit the game's APK to assign the key to fire only while the game is open?

Sent from my LG-E980 using xda app-developers app
 
Neroga
Old
#6  
Neroga's Avatar
Senior Member
Thanks Meter 521
Posts: 1,257
Join Date: Feb 2012
Location: Saint Cloud, Florida
Quote:
Originally Posted by worldextermination View Post
Sweet! I'll try it as soon as I get home! Though I'm not sure what I would assign it to, since the game uses touch commands. Is there any way I can edit the game's APK to assign the key to fire only while the game is open?

Sent from my LG-E980 using xda app-developers app
I'm no sure. Never got into modifying APKs. There IS an app called Game Keyboard (paid) that allows you to assign hardware keys to touch inputs. It's well worth the few bucks. I use it for just about every game / emulator I have as you can make your own custom layouts.

Sent from my Optimus G Pro using XDA Premium 4 mobile app
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


[OTA Captured] Android 4.4.3 Lands on European HTC One M7

The secound release of the Android L Developer Previewmay be the new hotness for … more

Take a Perfectly Stable Shot with Open Camera

The camera app on our Android smartphones and tablets isn’t something we focus on all … more

Motorola Droid X Receives Almost Fully Functional KitKat Port

While we are all wondering when Google will decide to officially release … more

XDA Xposed Tuesday: Kids Mode for Your Phone – XDA Developer TV

The greatest thing about technology is its ability to teach and promote … more