Giter Site home page Giter Site logo

launcher's Introduction

GameShell launcher

This is the launcher for GameShell based on 320x240 resolution and D-Pad layout. Screenshot

Create the necessary user and group

  • User name: cpi
  • Password: cpi
  • Group ID: 31415 with group name: cpifav
sudo adduser cpi  
sudo groupadd cpifav -g 31415  
sudo adduser cpi cpifav  

Directory structure

/home/cpi/
├── apps
│   ├── emulators
│   └── launcher <-Here we are
│       ├── Menu
│       ├── sys.py
│       └── truetype
├── games
│   ├── FreeDM
│   ├── MAME
│   └── nxengine
└── music

Create the necessary directories

mkdir -p /home/cpi/apps/emulators  
mkdir -p /home/cpi/games  
mkdir -p /home/cpi/music  

Dependent packages

  • validators, numpy, requests, python-mpd2, beeprint, python-pycurl, python-alsaaudio, python-pygame, python-gobject, python-xlib, python-wicd
  • wicd (For Wi-Fi)
  • mpd (For music player)

Install dependent packages

sudo apt-get -y install mpd ncmpcpp git libuser
sudo apt-get -y install python-wicd  wicd wicd-curses python-pycurl python-alsaaudio python-pygame python-gobject python-xlib   

sudo apt-get -y install python-pip   
sudo pip install validators numpy requests python-mpd2 beeprint

With pip install and virtualenv

mkvirtualenv launcher
pip install -r requirements.txt

Create “.mpd_cpi.conf” config

vim ~/.mpd_cpi.conf

music_directory    "/home/cpi/music"
playlist_directory    "/home/cpi/music/playlists"
db_file    "/home/cpi/music/tag_cache"
log_file    "/tmp/mpd.log"
pid_file    "/tmp/mpd.pid"
state_file    "/home/cpi/music/mpd_state"
sticker_file    "/home/cpi/music/sticker.sql"
user    "cpi"
bind_to_address    "/tmp/mpd.socket"
auto_update    "yes"
auto_update_depth    "3" 
input {
    plugin "curl"
}

audio_output {
    type    "alsa"
    name    "My ALSA Device"
}

audio_output {
    type    "fifo"
    name    "my_fifo"
    path    "/tmp/mpd.fifo"
    format    "44100:16:2"
}

filesystem_charset    "UTF-8"

launcher's People

Contributors

4k1 avatar aifreedom avatar arthurlutz avatar bear454 avatar cecilectomy avatar cuu avatar disruptityourself avatar dphys avatar follower46 avatar infernalmaster avatar kortanz avatar krushinru avatar losernator avatar mfpierre avatar mguilherme avatar neolao avatar o4k avatar prashantkamdar avatar quantumkraken avatar stephensaw avatar taffer avatar tanrax avatar undancer avatar zital avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

launcher's Issues

Merging of the official branch and cuu branch

Hi,

Could you use "rebase" instead of merging between the cuu branch and the main branch? It make the repository history really clunky and hard to follow.
It is too late for the existing history, but could you please use the rebase strategy for future pull requests?

Thanks

(that makes merging on my branch unnecessarily complicated)

Display help to get to Favorites (left button)

When browsing the list of ROMs, there is no indication that Favorite list is to the right of the Roms list. Maybe add an indication at the bottom of the screen (even tough there is little room).

Wireless doesn't work reliably

Setting up a wireless network with multiple networks around is a pain in the a$$.

Usually the first network you pick is wrong after entering your password, then after scanning it pops up the password and connects to the correct network.

If it doesn't connect and says "connecting", pressing B will cause Launcher to crash and stay on the loading screen indefinitely (needs a reset).

This seems to happen in both Launcher and LauncherGo especially after switching launchers.

Custom Emulator - Wrong Permissions

If you add a custom emulator, like SNES for instance, and define a custom action.config file, pointing to a valid core, and core URL. The Launcher will download and extract the core, but not set the permissions correctly. This results in the Launcher not being able to properly run the core, or the game, and causes a loop (where the screen returns to the menu).

By default the core permissions are set to 0644, they need to be set to 0775.

Once permissions are manually fixed, the launcher is able to launch the core, and the game.

See details here: https://forum.clockworkpi.com/t/how-to-add-icons-on-the-homescreen-that-link-to-emulators/580/29

Launcher freezes on bad wifi

Hi, I have no issue connecting to my wifi. The only issue I have is that the launcher freezes/locks up in the cases where the wifi connectivity is bad.

I understand, that with the onboard ceramic antenna, the connectivity won't be excellent, and that throughput will be slow.

What puzzles me ist that this affects the launcher to the point where it freezes for a few seconds (or longer) until the signal is good again.

Launcher Version: stable 1.25 OS 0.5

Is this a known issue, or what info can I provide to resolve this :).

Add a reboot option on the launcher

Hello, only power off option is available from the launcher, can you add a reboot option in the poweroff script ?

 def KeyDown(self,event):
    
    if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:
        
        self.ReturnToUpLevelPage()
        self._Screen.Draw()
        self._Screen.SwapAndShow()

    if event.key == CurKeys["B"]:
        if self.CheckBattery() < 20:
            cmdpath = "feh --bg-center gameshell/wallpaper/gameover.png;"
        else:
            cmdpath = "feh --bg-center gameshell/wallpaper/seeyou.png;"
        
        cmdpath += "sleep 3;"
        
        #cmdpath += "echo 'halt -p' > /tmp/halt_cmd"
        
        cmdpath += "sudo halt -p"
        pygame.event.post( pygame.event.Event(RUNSYS, message=cmdpath))
        
    if event.key == CurKeys["X"]:

        cmdpath = "sudo reboot"
        pygame.event.post( pygame.event.Event(RUNSYS, message=cmdpath))

MPD playlist titles are sometimes a list

This was a pain to figure out, but MPD playlistinfo titles are sometimes a list instead of a string.
This will cause the entire UI to lock up and not resolve until the offending track has been removed from the playlist (which is impossible since the playlist will be reloaded even after a reboot).

We can either handle this by scrubbing the playlist list in the libs/MPD/poller playlist method and make sure it only returns a single string (by joining the title list elements together with commas) or handle the playlist title sometimes being a list in the Menus/GameShell/Music Player/play_list_page.py.

If you want to try reproducing you can use the same public domain song I was testing with:
https://ia800307.us.archive.org/34/items/MusopenCollectionAsFlac/Bach_GoldbergVariations/JohannSebastianBach-01-GoldbergVariationsBwv.988-Aria.flac

Set timezone in the settings

It would be nice to have the option to set the system timezone in the settings menu.
I copied the /usr/share/zoneinfo/America/Chicago file to /etc/localtime on my GS and it updated accordingly.

We could have a vertical list of string options by listing the options in zoneinfo and drilling down to the timezone of each location.

I'd like to work on this one 😄

Allow manual SSID entry

I was talking to a user on the forum and it was requested that they have the option to enter in the SSID of their hidden network.

After looking through the wifi_list.py code, this will be a bit of work, but I think it should be possible without changing too much.

I think we can re-use the same keyboard/text-area components already used in the wifi pages.

Add higan and visualboyadvance?

Part of it is just me being bad at figuring out how to use it, but RetroArch is a giant pain and only sometimes work. Could we add shortcuts to Higan and VisualBoyAdvance to the "Retro games" menu, or are there problems with those particular emulators? I've only tried to get them to work a little bit and it does not seem straightforward, but shouldn't be that hard, hopefully. Would you accept a PR that does this?

File descriptor leak

Every time you "reload" the launcher GUI (running and then exiting an application), it uses up more file descriptors (fd's). Once it uses up 1000+ fd's, the launcher can no longer open any new files and crashes when it tries to load a font from file (it loads all fonts every reload). It creates a LOT of fonts and is loading the file for the font for every size it needs (about 72 fonts/sizes, from sys.py/UI/fonts.py), but it never frees their fd's.

Instead the font files should be loaded into python once and reused for creating the fonts/sizes. Use the second constructor with object instead of filename: https://www.pygame.org/docs/ref/font.html#pygame.font.Font

Additionally, why are the fonts being recreated on reload at all anyways? At the very least, if the fonts need to be refreshed, the above should be used and combined with closing the files to free the descriptors, then reloaded, again only once, before re-creating the fonts/sizes.

You can use the following command to count the fd's being used by the launcher GUI at any given moment:
ps aux | grep [r]un.py | awk '{system("ls /proc/"$2"/fd")}' | wc -l

Run the above command, then on the GameShell reload the launcher, then run the command after the launcher fully reloads. It will have an additional 72 fd's being used. Repeat and watch the fd count climb until it crashes when it reaches over 1000. It takes only 13 launcher reloads to crash (starts with 82 fd's, adding 72 each reload (72 + 13 = 936 + 82 = 1018).

Support for an easier dev environment

With #297 #296 #298 in general the setup of a dev environment is not easy with launcher. To get new contributors it would be nice to have this become a bit easier.

One of the things is to remove the dependency to /home/cpi and have a "relative paths" mode or a configurable though $HOME/.config/clockworkpi config.

Feature request: automatically disable auto-shutdown when charging

Since Launcher obviously is aware of when the battery is charging or not, it seems like it would be pretty simple to set it up so that auto-shutdown is disabled during charging. This would be convenient for when someone is doing configuration/server work on the GameShell, instead of having to manually change the power config to "Server" or "Performance" first, and then remember to change it back afterward.

Background image is "Loading"

The GameShell background image is the "Loading" image (On HDMI it is actually a full size background image of an exploded gameshell). If and When the UI crashes due to various bugs and issues, it makes the unit look like it is stuck loading something when in actuality nothing is happening, you are just seeing the background image.

The background should be something unique, and the loading image should be shown in times of actual loading, and an error image should be shown for crashes, etc.

CW中文支持问题

系统:cwOS v0.4
使用Cocos Creator开发的游戏,在GameShell中通过NW.js运行时,中文显示为方块

TIM截图20191118173643

后来通过 sudo apt-get install fonts-wqy-zenhei 安装字体解决,希望后续cw的版本能默认安装一些中文字体,:)

Allow launcher external application with volume controls

This can be closed out if you like, it's just a suggestion.

I discovered while using PICO-8 that the game has no build in volume controls. It expects the host system to have either hardware volume controls or system controls.

Because of this it's not possible to adjust the volume in-game without some script to manage the gameshell keybindings.

I wrote a script to do this here: https://gist.github.com/follower46/69cdc41d9dc09cf9fe97b48ec4036158
We could add the option in the launcher so if an application needed it, bindings could be given to manage the volume.

This could be extended in the future to also map menu to terminate the process.

pygame font extract from relative path

python sys.py/run.py 
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
../skin/default/truetype/VarelaRound-Regular.ttf
Traceback (most recent call last):
  File "sys.py/run.py", line 39, in <module>
    from UI.page         import PageStack,PageSelector,Page
  File "/home/arthur/local/clockworkpi/launcher/sys.py/UI/page.py", line 22, in <module>
    from icon_pool import MyIconPool
  File "/home/arthur/local/clockworkpi/launcher/sys.py/UI/icon_pool.py", line 9, in <module>
    from skin_manager import MySkinManager
  File "/home/arthur/local/clockworkpi/launcher/sys.py/UI/skin_manager.py", line 163, in <module>
    InitMySkinManager()
  File "/home/arthur/local/clockworkpi/launcher/sys.py/UI/skin_manager.py", line 160, in InitMySkinManager
    MySkinManager = SkinManager()
  File "/home/arthur/local/clockworkpi/launcher/sys.py/UI/skin_manager.py", line 30, in __init__
    self.Init()
  File "/home/arthur/local/clockworkpi/launcher/sys.py/UI/skin_manager.py", line 41, in Init
    self.SetFonts()
  File "/home/arthur/local/clockworkpi/launcher/sys.py/UI/skin_manager.py", line 56, in SetFonts
    self._Fonts["varela%d"%i] = pygame.font.Font(fonts_path["varela"],i)
IOError: [Errno 2] No such file or directory: '../skin/default/truetype/VarelaRound-Regular.ttf'

[tinycloud] Consider "accessible" when USB-ethernet is connected

When using the clockworkpi "offline" without a wifi connection, I think tinycloud could (should?) display instructions when the clockworkpi has been connected using USB ethernet.

Existing :

  • Keep clockworkpi not connected to wifi (airplaine mode or just don't configure wifi)
  • Open tinycloud
  • "Please connect to a wifi network" is displayed
  • USB-ethernet information is displayed with IP address
  • Connect it with usb cable
  • From computer tinycloud functionnality is usable (scp, ssh, smb, etc.)

Wished :

  • Keep clockworkpi not connected to wifi (airplaine mode or just don't configure wifi)
  • Open tinycloud
  • "Please connect to wifi or USB" is displayed (the IP for USB-ethernet is set but not useful so far, don't display it)
  • Connect USB cable
  • DHCP lease is detected on USB-ethernet
  • Display full information (except wifi address)

Keep entry in list when adding it to the Favorites

When adding a ROM to Favorites using select, it disappears from the list. I would expect the title to stay in the general list. I can understand other people like this behaviour, if that is the case, could this be made to be an option ?

Audible or Visual warning if batttery is about to give out.

Hey guys,

Having great fun playing with the gameshell however just got a little miffed when I just completed a boss fight and was about to save when the battery gave out. Arrrg

So is there a chance that there can be some sort of audible warning or a quick flash on screen when the battery is say 10% or 5% and needs charging sooner not later?

Would certainly cut down on frustration , trust me. :)

Thanks for such a compelling product.

UI skin preparation

It would be nice if all of the UI pygame.Color parameters came from the skin_manager
I'd like to work on switching it over.

This change should have zero change to the visuals of the system (I'm not going to add any skins)

This will change these types of calls:
pygame.Color(R,G,B)
component.Init("title",font,(R,G,B))
pygame.draw.shape(self._CanvasHWND,(R,G,B),param,0)
component.fill( (R,G,B))

This change won't handle fonts or any other skin elements.
This is just the first step on getting all the UI's unified color-wise

Run Launcher on a (desktop) dev machine?

I know this is not an issue, but as close to the devs as I can get ;)

Is there a way to run the launcher on a desktop/emulator/vm to make development faster?

I was thinking about playing with the code, but sending the files via my (rather slow) wifi, and relaunching it on the cpi is a bit tedious.

Is there a better way to develop stuff for the launcher?

Thanks in advance,
Paul

Add option to have wifi not connect automatically

I love that gameshell can connect to wifi to setup retroarch cores, and some games that get assets from the internet.

But I would really like having the option of not automatically connecting to wifi (power saving, privacy, only on a need-to-use basis). I would argue this could a be default, but I can understand that it isn't, so it would be nice to be able to configure that as an option for the gameshell, or even just by wifi setting (for example, auto connect at home, but manual connect at work).

Wrong IP for usb0

So I had to change the usb ip in order to have an internet connection with a Mac, everything is working just fine after changing /etc/network/interfaces to:

iface usb0 inet static
    address 192.168.2.2
    netmask 255.255.255.0
    gateway 192.168.2.1
    dns-nameservers 192.168.2.1

However the Tyny Cloud is showing the wrong ip for the USB-Ethernet because the ip is hardcoded in ~/launcher/Menu/GameShell/98_TinyCloud/__init__.py.
I wrote a small function to retrieve the IP from USB0, therefor we could replace the hardcoded ip with the result of this function, if no one changes the ip, fine :) If we need to change the TynyCloud will be always updated.

The function:

import socket
import fcntl
import struct

def GetIpAddress(ifname):
  s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

  try:
    ip = socket.inet_ntoa(fcntl.ioctl(
       s.fileno(),
       0x8915,  # SIOCGIFADDR
       struct.pack('256s', ifname[:15])
    )[20:24])
  except:
    ip = 'x.x.x.x'

  return ip


print(GetIpAddress('usb0'))

Do you want me to create a PR or do you have anything to add / change?

Problem upgrading from 1.20

Hello guys,

I recently upgraded the launcher from 1.20 to the 1.23 and every time I try to upgrade to 1.24 is shows an error.

Any way to bypass/fix the problem?

Regards.

Enable Bluetooth Pairing

Now that we have the bluetooth driver, it would be nice to be able to pair bluetooth devices from the launcher.

Remember previous selected menu

It would be nice if when restarting the launcher remembered where the user was previously in the menu and restored that setting.

For example when testing a few ROMs in the "MGBA" menu of "Retro Games", when I quit a game, I have to go through "A > Right > Right > Right > A" to go back to where I was.

Feature request or maybe bug: have volume buttons always modify global volume

This is somewhat related to #84, but is a bit more in-depth.

Here's the thing: right now, the volume buttons modify the overall system volume when in Launcher, but when in a RetroArch-powered emulator, they modify the volume inside RetroArch. The problem is that these two different volume options "stack" -- the volume inside RetroArch is dependent on the system volume.

This behavior can be demonstrated by turning the volume down very low in Launcher, then launching a RetroArch emulator, and then trying to change the volume inside the emulator. The maximum volume inside the emulator is entirely dependent on the system volume.

IMO, ideally the volume buttons would always do the same thing -- e.g. controlling the volume via @follower46's script when not in Launcher. This would provide the added benefit of being able to control the volume regardless of what happens to be running. One con of this is that you'd have no way to provide graphical feedback when pressing volume buttons outside of Launcher. A future GameShell HW revision incorporating some GPIO-controllable LEDs might alleviate this problem.

python3 support

When trying to run launcher with python3 I get :

python run.py 
Traceback (most recent call last):
  File "run.py", line 6, in <module>
    import commands
ModuleNotFoundError: No module named 'commands'

2to3 says :

-import commands
+import subprocess

Button layout

The button layout selected used to reflect the setting under settings, but doesn't do do anymore.

I use the SNES layout, but the UI still shows B as enter while A needs to be pressed.

Pico-8 won't install if not in compkginfo.json

Currently pico-8 will not be installable via the pico-8*raspi.zip files if the desired version does not have an entry in compkginfo.json.

example: currently trying to install pico-8_0.1.12c_raspi.zip does not work as it has no entry in compkginfo.json.

I propose that the install process installs ANY version of pico-8 using a pattern match for something like "pico-8*raspi.zip" and if there is not corresponding entry in compkginfo.json with an md5 checksum, it displays the validation warning and lets the user install anyways.

This would make installation of pico-8 easier for the end user without confusion as to why it wont install or work as well as remove the need for always having the latest launcher or modifying launcher files.

Launcher breaking bug (TypeError, main_screen.py)

from /tmp/x.log:

Traceback (most recent call last):
  File "run.py", line 672, in <module>
    big_loop(config.GlobalCanvas)
  File "run.py", line 603, in big_loop
    main_screen.ReadTheDirIntoPages("/home/cpi/apps/Menu",1,main_screen._Pages[ len(main_screen._Pages) -1])
  File "/home/cpi/launcher/sys.py/UI/main_screen.py", line 571, in ReadTheDirIntoPages
    self.ReadTheDirIntoPages(_dir+"/"+i,pglevel+1,iconitem._LinkPage)
  File "/home/cpi/launcher/sys.py/UI/main_screen.py", line 571, in ReadTheDirIntoPages
    self.ReadTheDirIntoPages(_dir+"/"+i,pglevel+1,iconitem._LinkPage)
  File "/home/cpi/launcher/sys.py/UI/main_screen.py", line 583, in ReadTheDirIntoPages
    if FileExists( MySkinManager.GiveIcon( _dir+"/"+ReplaceSuffix(i2,"png"))):
TypeError: cannot concatenate 'str' and 'NoneType' objects

Please advise on a solution, after the first Loading and a few seconds in black screen, the launcher won't boot up and it gets stuck on Loading endlessly. After some configuration I've been frustratingly met with this error the past 2 days and trying to figure out why.

No recent updates?

I haven't updated in about a month or so. There seems to be a lot of activity in this repo, but when I select "Update" in the GameShell UI it says that there are no updates. Is there anything I need to do? Can I update manually some other way?

Foot Bar Button Layout Actions Swapped

It seems that the footbar when using SNES layout shows the XBOX actions and when using XBOX layout show the SNES actions.

I have created a pull request to fix this, #246.

Allow Wifi passwords that are longer than the input field

Hi,

I'm on a Wifi with a very long password (yes, I know). I can not enter the whole password, so of course I can not join the Wifi ☹️. On all other devices I used before (from smartphone, over streaming stick, to computers), normally the input field simply scrolls while you add more chars.

Of course I know, that you textarea thing is a little more complicated

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.