Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Retrostone N64
#1
Played Ocarina of Time up until the time I am asked to play the Ocarina.

The obvious problem is that there are not enough buttons on the retrostone to map the complete controller of the N64.
Now, is there a way to configure - let's say - Select + A as one of the buttons? So that on the rare ocasion I do need them I can access them via a two-button combo?
Reply
#2
(10-18-2018, 05:39 AM)secondd Wrote: Played Ocarina of Time up until the time I am asked to play the Ocarina.

The obvious problem is that there are not enough buttons on the retrostone to map the complete controller of the N64.
Now, is there a way to configure - let's say - Select + A as one of the buttons? So that on the rare ocasion I do need them I can access them via a two-button combo?

As per reply from Pierre, can you instruct how to install the button configuration so we can play Zelda 64 on retrostone please.

http://forum.8bcraft.com/viewtopic.php?f=19&t=1855

****
Pierre: "I think this is possible to add in the GPIO driver.

I just did so, I have not tried it but it should work.

When you press Select + A, Select + B, Select + X, Select + Y it should trigger 4 virtual buttons.

However it will also trigger the buttons themself... So I am not sure it's the best way to do it. Also I think if you selected "select" as the hotkey in emulation station, you'll probably have a double behaviour. Note you can change Select button with another in the script below. Maybe R + A, R + B, R + Y and R+ X would be better.

If you want to test it you'll need to update the GPIO driver with the following one. I am actually not sure where to change the driver as it is preinstalled in retrorangepi. Best is to ask them how to do it."
Code:
#!/usr/bin/env python


import evdev
import uinput
from time import sleep
from evdev import InputDevice, KeyEvent, UInput, AbsInfo, ecodes as e
from pyA20.gpio import gpio
from pyA20.gpio import port
from pyA20.gpio import connector

#sleep(10)

events = ([
        uinput.BTN_A,
        uinput.BTN_B,
        uinput.BTN_C,
        uinput.BTN_X,
        uinput.BTN_Y,
        uinput.BTN_Z,
        uinput.BTN_TL,
        uinput.BTN_TR,
        uinput.BTN_THUMBL,
        uinput.BTN_THUMBR,
        uinput.BTN_SELECT,
        uinput.BTN_START,
        uinput.BTN_TL2,
        uinput.BTN_TR2,
        uinput.ABS_X + (0,255,0,0),
        uinput.ABS_Y + (0,255,0,0),
        uinput.BTN_TRIGGER_HAPPY1 = (0x01, 0x2c0),
        uinput.BTN_TRIGGER_HAPPY2 = (0x01, 0x2c1),
        uinput.BTN_TRIGGER_HAPPY3 = (0x01, 0x2c2),
        uinput.BTN_TRIGGER_HAPPY4 = (0x01, 0x2c3),
    ])
#could use BTN_DPAD_UP BTN_DPAD_DOWN BTN_DPAD_LEFT BTN_DPAD_RIGHT but is it better?

gamepad = uinput.Device(events,"RetroStone Controle",0x00)

gamepad.emit(uinput.ABS_X, 128, syn=False)
gamepad.emit(uinput.ABS_Y, 128)

#--------------- define botoes -----------------
    # ---- PLAYER 1 ---------#
bt_up_p1 = port.PD12
bt_down_p1 = port.PD5
bt_left_p1 = port.PD0
bt_right_p1 = port.PD11

bt_l_p1 = port.PD6
bt_x_p1 = port.PD13
bt_y_p1 = port.PD9
bt_r_p1 = port.PD7
bt_b_p1 = port.PD15
bt_a_p1 = port.PD14

bt_select_p1 = port.PD4
bt_start_p1 = port.PD1

bt_left_trigger_p1 = port.PD8
bt_right_trigger_p1 = port.PD3

#optional buttons
bt_c_p1 = port.PC9
bt_z_p1 = port.PE3
bt_d_p1 = port.PA3
bt_e_p1 = port.PA15



#--------------------------------Initialize module. Always called first
gpio.init()

gpio.setcfg(bt_up_p1, gpio.INPUT)
gpio.pullup(bt_up_p1, gpio.PULLUP)

gpio.setcfg(bt_down_p1, gpio.INPUT)
gpio.pullup(bt_down_p1, gpio.PULLUP)

gpio.setcfg(bt_left_p1, gpio.INPUT)
gpio.pullup(bt_left_p1, gpio.PULLUP)

gpio.setcfg(bt_right_p1, gpio.INPUT)
gpio.pullup(bt_right_p1, gpio.PULLUP)


gpio.setcfg(bt_l_p1, gpio.INPUT)
gpio.pullup(bt_l_p1, gpio.PULLUP)

gpio.setcfg(bt_x_p1, gpio.INPUT)
gpio.pullup(bt_x_p1, gpio.PULLUP)

gpio.setcfg(bt_y_p1, gpio.INPUT)
gpio.pullup(bt_y_p1, gpio.PULLUP)

gpio.setcfg(bt_r_p1, gpio.INPUT)
gpio.pullup(bt_r_p1, gpio.PULLUP)

gpio.setcfg(bt_b_p1, gpio.INPUT)
gpio.pullup(bt_b_p1, gpio.PULLUP)

gpio.setcfg(bt_a_p1, gpio.INPUT)
gpio.pullup(bt_a_p1, gpio.PULLUP)

gpio.setcfg(bt_c_p1, gpio.INPUT)
gpio.pullup(bt_c_p1, gpio.PULLUP)

gpio.setcfg(bt_z_p1, gpio.INPUT)
gpio.pullup(bt_z_p1, gpio.PULLUP)

gpio.setcfg(bt_d_p1, gpio.INPUT)
gpio.pullup(bt_d_p1, gpio.PULLUP)

gpio.setcfg(bt_e_p1, gpio.INPUT)
gpio.pullup(bt_e_p1, gpio.PULLUP)

gpio.setcfg(bt_select_p1, gpio.INPUT)
gpio.pullup(bt_select_p1, gpio.PULLUP)

gpio.setcfg(bt_start_p1, gpio.INPUT)
gpio.pullup(bt_start_p1, gpio.PULLUP)

gpio.setcfg(bt_left_trigger_p1, gpio.INPUT)
gpio.pullup(bt_left_trigger_p1, gpio.PULLUP)

gpio.setcfg(bt_right_trigger_p1, gpio.INPUT)
gpio.pullup(bt_right_trigger_p1, gpio.PULLUP)

    
_bt_up_p1 = False
_bt_down_p1 = False
_bt_left_p1 = False
_bt_right_p1 = False
_bt_a_p1 = False
_bt_b_p1 = False
_bt_x_p1 = False
_bt_y_p1 = False
_bt_c_p1 = False
_bt_z_p1 = False
_bt_d_p1 = False
_bt_e_p1 = False
_bt_l_p1 = False
_bt_r_p1 = False
_bt_select_p1 = False
_bt_start_p1 = False
_bt_left_trigger_p1 = False
_bt_right_trigger_p1 = False
_bt_virtual_1 = False
_bt_virtual_2 = False
_bt_virtual_3 = False
_bt_virtual_4 = False

print gpio.input(bt_a_p1)

while True:
    #------ player 1 -----------#        
#bt a =====================
    if (not _bt_a_p1) and (gpio.input(bt_a_p1) == 0):
        _bt_a_p1 = True
        gamepad.emit(uinput.BTN_A, 1)    
    if (_bt_a_p1) and (gpio.input(bt_a_p1) == 1):
        _bt_a_p1 = False
        gamepad.emit(uinput.BTN_A, 0)    
#bt b =====================

    if (not _bt_b_p1) and (gpio.input(bt_b_p1) == 0):
        _bt_b_p1 = True
        gamepad.emit(uinput.BTN_B, 1)    
    if (_bt_b_p1) and (gpio.input(bt_b_p1) == 1):
        _bt_b_p1 = False
        gamepad.emit(uinput.BTN_B, 0)    

#bt X =====================

    if (not _bt_x_p1) and (gpio.input(bt_x_p1) == 0):
        _bt_x_p1 = True
        gamepad.emit(uinput.BTN_X, 1)    
    if (_bt_x_p1) and (gpio.input(bt_x_p1) == 1):
        _bt_x_p1 = False
        gamepad.emit(uinput.BTN_X, 0)    
#bt Y =====================

    if (not _bt_y_p1) and (gpio.input(bt_y_p1) == 0):
        _bt_y_p1 = True
        gamepad.emit(uinput.BTN_Y, 1)    
    if (_bt_y_p1) and (gpio.input(bt_y_p1) == 1):
        _bt_y_p1 = False
        gamepad.emit(uinput.BTN_Y, 0)    

#bt C =====================

    if (not _bt_c_p1) and (gpio.input(bt_c_p1) == 0):
        _bt_c_p1 = True
        gamepad.emit(uinput.BTN_C, 1)    
    if (_bt_c_p1) and (gpio.input(bt_c_p1) == 1):
        _bt_c_p1 = False
        gamepad.emit(uinput.BTN_C, 0)    
#bt Z =====================

    if (not _bt_z_p1) and (gpio.input(bt_z_p1) == 0):
        _bt_z_p1 = True
        gamepad.emit(uinput.BTN_Z, 1)    
    if (_bt_z_p1) and (gpio.input(bt_z_p1) == 1):
        _bt_z_p1 = False
        gamepad.emit(uinput.BTN_Z, 0)    

#bt D =====================

    if (not _bt_d_p1) and (gpio.input(bt_d_p1) == 0):
        _bt_d_p1 = True
        gamepad.emit(uinput.BTN_THUMBL, 1)    
    if (_bt_d_p1) and (gpio.input(bt_d_p1) == 1):
        _bt_d_p1 = False
        gamepad.emit(uinput.BTN_THUMBL, 0)    
#bt E =====================

    if (not _bt_e_p1) and (gpio.input(bt_e_p1) == 0):
        _bt_e_p1 = True
        gamepad.emit(uinput.BTN_THUMBR, 1)    
    if (_bt_e_p1) and (gpio.input(bt_e_p1) == 1):
        _bt_e_p1 = False
        gamepad.emit(uinput.BTN_THUMBR, 0)    
        
#bt L =====================
    if (not _bt_l_p1) and (gpio.input(bt_l_p1) == 0):
        _bt_l_p1 = True
        gamepad.emit(uinput.BTN_TL, 1)    
    if (_bt_l_p1) and (gpio.input(bt_l_p1) == 1):
        _bt_l_p1 = False
        gamepad.emit(uinput.BTN_TL, 0)    
#bt R =====================
    if (not _bt_r_p1) and (gpio.input(bt_r_p1) == 0):
        _bt_r_p1 = True
        gamepad.emit(uinput.BTN_TR, 1)    
    if (_bt_r_p1) and (gpio.input(bt_r_p1) == 1):
        _bt_r_p1 = False
        gamepad.emit(uinput.BTN_TR, 0)
#bt select =====================
    if (not _bt_select_p1) and (gpio.input(bt_select_p1) == 0):
        _bt_select_p1 = True
        gamepad.emit(uinput.BTN_SELECT, 1)    
    if (_bt_select_p1) and (gpio.input(bt_select_p1) == 1):
        _bt_select_p1 = False
        gamepad.emit(uinput.BTN_SELECT, 0)    
        _bt_virtual_1 = False
        gamepad.emit(uinput.BTN_TRIGGER_HAPPY1, 0)
        _bt_virtual_2 = False
        gamepad.emit(uinput.BTN_TRIGGER_HAPPY2, 0)
        _bt_virtual_3 = False
        gamepad.emit(uinput.BTN_TRIGGER_HAPPY3, 0)
        _bt_virtual_4 = False
        gamepad.emit(uinput.BTN_TRIGGER_HAPPY4, 0)

    #virtual button 1 on select        
    if (_bt_select_p1) and (not _bt_virtual_1) and (gpio.input(bt_a_p1) == 0):
        _bt_virtual_1 = True
        gamepad.emit(uinput.BTN_TRIGGER_HAPPY1, 1)
    if (_bt_select_p1) and (_bt_virtual_1) and (gpio.input(bt_a_p1) == 1):    
        _bt_virtual_1 = False
        gamepad.emit(uinput.BTN_TRIGGER_HAPPY1, 0)
    #virtual button 2 on select        
    if (_bt_select_p1) and (not _bt_virtual_2) and (gpio.input(bt_b_p1) == 0):
        _bt_virtual_2 = True
        gamepad.emit(uinput.BTN_TRIGGER_HAPPY2, 1)
    if (_bt_select_p1) and (_bt_virtual_2) and (gpio.input(bt_b_p1) == 1):    
        _bt_virtual_2 = False
        gamepad.emit(uinput.BTN_TRIGGER_HAPPY2, 0)
    #virtual button 3 on select        
    if (_bt_select_p1) and (not _bt_virtual_3) and (gpio.input(bt_x_p1) == 0):
        _bt_virtual_3 = True
        gamepad.emit(uinput.BTN_TRIGGER_HAPPY3, 1)
    if (_bt_select_p1) and (_bt_virtual_3) and (gpio.input(bt_x_p1) == 1):    
        _bt_virtual_3 = False
        gamepad.emit(uinput.BTN_TRIGGER_HAPPY3, 0)
    #virtual button 4 on select        
    if (_bt_select_p1) and (not _bt_virtual_4) and (gpio.input(bt_y_p1) == 0):
        _bt_virtual_4 = True
        gamepad.emit(uinput.BTN_TRIGGER_HAPPY4, 1)
    if (_bt_select_p1) and (_bt_virtual_4) and (gpio.input(bt_y_p1) == 1):    
        _bt_virtual_4 = False
        gamepad.emit(uinput.BTN_TRIGGER_HAPPY4, 0)        
        
        
#bt start =====================
    if (not _bt_start_p1) and (gpio.input(bt_start_p1) == 0):
        _bt_start_p1 = True
        gamepad.emit(uinput.BTN_START, 1)    
    if (_bt_start_p1) and (gpio.input(bt_start_p1) == 1):
        _bt_start_p1 = False
        gamepad.emit(uinput.BTN_START, 0)
#bt L2 =====================
    if (not _bt_left_trigger_p1) and (gpio.input(bt_left_trigger_p1) == 0):
        _bt_left_trigger_p1 = True
        gamepad.emit(uinput.BTN_TL2, 1)    
    if (_bt_left_trigger_p1) and (gpio.input(bt_left_trigger_p1) == 1):
        _bt_left_trigger_p1 = False
        gamepad.emit(uinput.BTN_TL2, 0)    
#bt R2 =====================
    if (not _bt_right_trigger_p1) and (gpio.input(bt_right_trigger_p1) == 0):
        _bt_right_trigger_p1 = True
        gamepad.emit(uinput.BTN_TR2, 1)    
    if (_bt_right_trigger_p1) and (gpio.input(bt_right_trigger_p1) == 1):
        _bt_right_trigger_p1 = False
        gamepad.emit(uinput.BTN_TR2, 0)    
####DIRECTIONS P1 ###########################

#bt up =====================
    if (not _bt_up_p1) and (gpio.input(bt_up_p1) == 0):
        _bt_up_p1 = True
        gamepad.emit(uinput.ABS_Y, 0)    
    if (_bt_up_p1) and (gpio.input(bt_up_p1) == 1):
        _bt_up_p1 = False
        gamepad.emit(uinput.ABS_Y, 128)
#bt down =====================
    if (not _bt_down_p1) and (gpio.input(bt_down_p1) == 0):
        _bt_down_p1 = True
        gamepad.emit(uinput.ABS_Y, 255)    
    if (_bt_down_p1) and (gpio.input(bt_down_p1) == 1):
        _bt_down_p1 = False
        gamepad.emit(uinput.ABS_Y, 128)
#bt left =====================
    if (not _bt_left_p1) and (gpio.input(bt_left_p1) == 0):
        _bt_left_p1 = True
        gamepad.emit(uinput.ABS_X, 0)    
    if (_bt_left_p1) and (gpio.input(bt_left_p1) == 1):
        _bt_left_p1 = False
        gamepad.emit(uinput.ABS_X, 128)
#bt right =====================
    if (not _bt_right_p1) and (gpio.input(bt_right_p1) == 0):
        _bt_right_p1 = True
        gamepad.emit(uinput.ABS_X, 255)    
    if (_bt_right_p1) and (gpio.input(bt_right_p1) == 1):
        _bt_right_p1 = False
        gamepad.emit(uinput.ABS_X, 128)
    
    sleep(.02)
Reply
#3
try editing /home/pi/RetrOrangePi/GPIO/drivers/gpio_retrostone.py , i think you can maybe replace the whole file
Reply
#4
Figured it out (I cannot post images here for whatever reason so I am leaving this link with the full answer on how to properly configure N64 on Retrostone) http://forum.8bcraft.com/viewtopic.php?f...3900#p3900
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  RCLONE on Retrostone? Dahak 5 506 06-10-2019, 08:09 PM
Last Post: qu1que
  Selling limited edition blue retrostone aj_efff 2 1,002 05-15-2019, 05:56 AM
Last Post: luckithroe
  TFT-CARBON theme for Emulation Station on the Retrostone qu1que 3 1,596 05-13-2019, 08:38 PM
Last Post: luckithroe
  RetroStone: Kodi Black Screen with Sound in Video luckithroe 5 858 04-09-2019, 12:09 AM
Last Post: alexkidd
Exclamation Retrostone supreme 1.3 no speaker sound GARRETTGRENIER 0 487 02-28-2019, 01:17 PM
Last Post: GARRETTGRENIER
  New **Update** Supreme Retrostone image v1.3 Régalad 55 25,157 02-17-2019, 05:10 AM
Last Post: lhymes
Question Retrostone and SteamLink Saidrog 0 551 02-11-2019, 11:43 PM
Last Post: Saidrog
  How to run Scummvm games on retrorangepi for retrostone??? ramonpks 12 3,480 10-24-2018, 12:48 PM
Last Post: ramonpks
  RetroStone controller takes a long time to be seen TROFF 3 1,281 10-18-2018, 02:39 AM
Last Post: alexkidd
  How hot is too hot for the RetroStone? TROFF 1 989 10-11-2018, 10:14 AM
Last Post: alexkidd

Forum Jump:


Users browsing this thread: 1 Guest(s)