-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a9e7c4d
Showing
10 changed files
with
234 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*.o | ||
|
||
vhf_installer_screen | ||
steamlink |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Source setenv.sh before running make | ||
|
||
CFLAGS := -I$(MARVELL_ROOTFS)/usr/include/SDL2 | ||
LDFLAGS := -lSDL2 -lSDL2_ttf | ||
|
||
vhf_installer_screen: vhf_installer_screen.o | ||
$(CC) -o $@ $< $(LDFLAGS) | ||
|
||
clean: | ||
$(RM) vhf_installer_screen.o | ||
|
||
distclean: clean | ||
$(RM) vhf_installer_screen | ||
$(RM) -r steamlink |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
# | ||
|
||
TOP=$(cd `dirname "${BASH_SOURCE[0]}"` && pwd) | ||
if [ "${MARVELL_SDK_PATH}" = "" ]; then | ||
MARVELL_SDK_PATH="$(cd "${TOP}/../.." && pwd)" | ||
fi | ||
if [ "${MARVELL_ROOTFS}" = "" ]; then | ||
source "${MARVELL_SDK_PATH}/setenv.sh" || exit 1 | ||
fi | ||
cd "${TOP}" | ||
|
||
make $MAKE_J || exit 2 | ||
|
||
export DESTDIR="${PWD}/steamlink/apps/VirtualHereFreeInstaller" | ||
|
||
# Copy the files to the app directory | ||
mkdir -p "${DESTDIR}" | ||
cp -v -r res/ "${DESTDIR}" | ||
cp -v install.sh "${DESTDIR}" | ||
cp -v vhf_installer_screen "${DESTDIR}" | ||
cp -v icon.png "${DESTDIR}" | ||
|
||
# Create the table of contents and icon | ||
cat >"${DESTDIR}/toc.txt" <<__EOF__ | ||
name=VirtualHereFree Installer | ||
icon=icon.png | ||
run=install.sh | ||
__EOF__ | ||
|
||
# Pack it up | ||
name=$(basename ${DESTDIR}) | ||
pushd "$(dirname ${DESTDIR})" | ||
tar zcvf $name.tgz $name || exit 3 | ||
rm -rf $name | ||
popd | ||
|
||
# All done! | ||
echo "Build complete!" | ||
echo | ||
echo "Put the steamlink folder onto a USB drive, insert it into your Steam Link, and cycle the power to install." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/sh | ||
|
||
bail () { | ||
pkill vhf_installer_screen | ||
exit 1 | ||
} | ||
|
||
./vhf_installer_screen & | ||
|
||
echo "Downloading free VirtualHere server binary..." | ||
mkdir -p /mnt/config/overlay/usr/local/bin/ | ||
wget https://virtualhere.com/sites/default/files/usbserver/vhusbdarm -O /mnt/config/overlay/usr/local/bin/vhusbdarm | ||
if [ $? -ne 0 ]; then | ||
echo "ERROR: Download failed." | ||
bail | ||
fi | ||
chmod 755 /mnt/config/overlay/usr/local/bin/vhusbdarm | ||
|
||
echo "Deploying VirtualHereFree server startup script..." | ||
mkdir -p /mnt/config/overlay/etc/init.d/startup/ | ||
cp res/S98virtualherefree /mnt/config/overlay/etc/init.d/startup/S98virtualherefree | ||
|
||
echo "Deploying VirtualHereFree server watchdog..." | ||
mkdir -p /mnt/config/overlay/usr/local/bin/ | ||
cp res/vhfwatchdog /mnt/config/overlay/usr/local/bin/vhfwatchdog | ||
|
||
if [ -f /mnt/config/system/virtualherefree_config.ini ]; then | ||
echo "VirtualHereFree server config already exists. Not overwriting." | ||
else | ||
echo "Deploying default VirtualHereFree server config..." | ||
cp res/virtualherefree_config.ini /mnt/config/system/virtualherefree_config.ini | ||
fi | ||
|
||
echo "Enabling VirtualHereFree server..." | ||
touch /mnt/config/system/virtualherefree_enabled.txt | ||
|
||
echo "Rebooting device..." | ||
/etc/init.d/reboot.sh & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
|
||
if [ -f /mnt/config/system/virtualherefree_enabled.txt ]; then | ||
/usr/local/bin/vhfwatchdog & | ||
fi |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/sh | ||
|
||
check_vh() { | ||
if [ $(pidof streaming_client | wc -l) -eq 0 ] && [ $(pidof vhusbdarm | wc -l) -gt 0 ]; then | ||
echo "Streaming connection ended, stopping VirtualHereFree server..." | ||
pkill vhusbdarm | ||
sleep 10 | ||
elif [ $(pidof streaming_client | wc -l) -gt 0 ] && [ $(pidof vhusbdarm | wc -l) -eq 0 ]; then | ||
echo "Streaming connection established, starting VirtualHereFree server..." | ||
/usr/local/bin/vhusbdarm -c /mnt/config/system/virtualherefree_config.ini -b | ||
sleep 2 | ||
fi | ||
} | ||
|
||
while true; do | ||
check_vh | ||
sleep 3 | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
;; https://virtualhere.com/configuration_faq | ||
|
||
ServerName=$HOSTNAME$ | ||
;UseAVAHI=0 | ||
;CompressionLimit=384 | ||
;IgnoredDevices= | ||
;IgnoredBuses= | ||
;AllowedDevice= | ||
;AutoAttachToKernel=1 | ||
;ClaimPorts=0 | ||
;PingInterval=4 | ||
;PingTimeout=9 | ||
;ControlTimeout=3 | ||
;UseAvahiServiceFile=0 | ||
;ReverseClients= | ||
;ReverseClientsRetryPeriod=15 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
#include <stdlib.h> | ||
#include <stdio.h> | ||
#include <time.h> | ||
|
||
#include "SDL.h" | ||
#include "SDL_ttf.h" | ||
|
||
#define TEXT_MARGIN 40 | ||
#define FONT "res/sans.ttf" | ||
#define FONTSIZE 24 | ||
|
||
void get_text(SDL_Renderer *renderer, int x, int y, char *text, TTF_Font *font, SDL_Color textColor, | ||
SDL_Texture **texture, SDL_Rect *rect) { | ||
int text_width; | ||
int text_height; | ||
SDL_Surface *surface; | ||
|
||
surface = TTF_RenderText_Solid(font, text, textColor); | ||
*texture = SDL_CreateTextureFromSurface(renderer, surface); | ||
text_width = surface->w; | ||
text_height = surface->h; | ||
SDL_FreeSurface(surface); | ||
rect->x = x; | ||
rect->y = y; | ||
rect->w = text_width; | ||
rect->h = text_height; | ||
} | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
SDL_DisplayMode displaymode; | ||
SDL_Renderer *renderer; | ||
SDL_Window *window; | ||
SDL_Surface *surface; | ||
SDL_Texture *texture1, *texture2; | ||
SDL_Rect textbox1, textbox2; | ||
SDL_Event event; | ||
|
||
if (SDL_Init(SDL_INIT_VIDEO) < 0) { | ||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s", SDL_GetError()); | ||
return EXIT_FAILURE; | ||
} | ||
|
||
if (SDL_GetCurrentDisplayMode(0, &displaymode) < 0) { | ||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't get displaymode: %s", SDL_GetError()); | ||
return EXIT_FAILURE; | ||
} | ||
|
||
if (SDL_CreateWindowAndRenderer(displaymode.w, displaymode.h, 0, &window, &renderer) < 0) { | ||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window and renderer: %s", SDL_GetError()); | ||
return EXIT_FAILURE; | ||
} | ||
SDL_ShowCursor(SDL_DISABLE); | ||
|
||
if (TTF_Init() < 0) { | ||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize TTF library: %s", SDL_GetError()); | ||
return EXIT_FAILURE; | ||
} | ||
|
||
TTF_Font* font = TTF_OpenFont(FONT, FONTSIZE); | ||
if (!font) { | ||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load font: %s", SDL_GetError()); | ||
return EXIT_FAILURE; | ||
} | ||
|
||
SDL_Color textColorHeader = {255, 0, 0, 0}; | ||
SDL_Color textColor = {255, 255, 255, 0}; | ||
|
||
get_text(renderer, TEXT_MARGIN, TEXT_MARGIN, "VirtualHereFree installer by milaq", font, textColorHeader, &texture1, &textbox1); | ||
get_text(renderer, TEXT_MARGIN, textbox1.y + 2 * textbox1.h, "Installing, please wait...", font, textColor, &texture2, &textbox2); | ||
|
||
SDL_FreeSurface(surface); | ||
|
||
while (1) { | ||
SDL_PollEvent(&event); | ||
if (event.type == SDL_QUIT) { | ||
break; | ||
} | ||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0); | ||
SDL_RenderClear(renderer); | ||
|
||
SDL_RenderCopy(renderer, texture1, NULL, &textbox1); | ||
SDL_RenderCopy(renderer, texture2, NULL, &textbox2); | ||
|
||
SDL_RenderPresent(renderer); | ||
} | ||
|
||
SDL_DestroyTexture(texture1); | ||
SDL_DestroyTexture(texture2); | ||
TTF_Quit(); | ||
|
||
SDL_DestroyRenderer(renderer); | ||
SDL_DestroyWindow(window); | ||
|
||
SDL_Quit(); | ||
|
||
return EXIT_SUCCESS; | ||
} |