Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: SamsungDForum/moonlight-chrome
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: samsung_wasm
Choose a base ref
...
head repository: KyroFrCode/moonlight-chrome-tizen
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: samsung_wasm
Choose a head ref
Able to merge. These branches can be automatically merged.

Commits on Mar 15, 2023

  1. Add files via upload

    KyroFrCode authored Mar 15, 2023
    Copy the full SHA
    b7b04c2 View commit details
  2. Delete .gitmodules

    KyroFrCode authored Mar 15, 2023
    Copy the full SHA
    86e7fe5 View commit details

Commits on Mar 16, 2023

  1. Update

    KyroFrCode committed Mar 16, 2023
    Copy the full SHA
    c5f7cd9 View commit details
  2. Add files via upload

    KyroFrCode authored Mar 16, 2023
    Copy the full SHA
    bd367fe View commit details
  3. Add files via upload

    KyroFrCode authored Mar 16, 2023
    Copy the full SHA
    fddd65b View commit details
  4. Update

    KyroFrCode committed Mar 16, 2023
    Copy the full SHA
    bb57daa View commit details
  5. No commit message

    KyroFrCode committed Mar 16, 2023
    Copy the full SHA
    5e3f7fb View commit details

Commits on Apr 7, 2023

  1. modifié : res/config.xml

    	modifié :         wasm/main.cpp
    	modifié :         wasm/wasmplayer.cpp
    
    Update
    KyroFrCode committed Apr 7, 2023
    Copy the full SHA
    6df9dd7 View commit details
  2. Copy the full SHA
    72cfa43 View commit details

Commits on Jun 1, 2023

  1. Update main.cpp

    reactivate hdr (in the event of an error, such as a black screen, deactivate by quoting line 206)
    KyroFrCode authored Jun 1, 2023
    Copy the full SHA
    3b13004 View commit details

Commits on Jun 29, 2023

  1. Add files via upload

    KyroFrCode authored Jun 29, 2023
    Copy the full SHA
    db51bc3 View commit details
  2. Add files via upload

    KyroFrCode authored Jun 29, 2023
    Copy the full SHA
    27fb9ee View commit details

Commits on Aug 11, 2023

  1. Copy the full SHA
    83f1276 View commit details
  2. Copy the full SHA
    5ba02f8 View commit details
  3. Copy the full SHA
    90ea911 View commit details

Commits on Aug 12, 2023

  1. Copy the full SHA
    c16aca5 View commit details
  2. Copy the full SHA
    9a66a71 View commit details

Commits on Aug 17, 2023

  1. Copy the full SHA
    1522776 View commit details

Commits on Oct 9, 2023

  1. Copy the full SHA
    a75a30e View commit details
  2. Copy the full SHA
    a4fbf56 View commit details
  3. Copy the full SHA
    f60348b View commit details

Commits on Nov 8, 2023

  1. Merge pull request moonlight-stream#10 from pkmnnerd/samsung_wasm

    Build docker image and publish to GitHub Container Registry
    KyroFrCode authored Nov 8, 2023
    Copy the full SHA
    df48bfa View commit details

Commits on Feb 16, 2024

  1. Update README.md

    KyroFrCode authored Feb 16, 2024
    Copy the full SHA
    fd8c516 View commit details
Showing 502 changed files with 125,881 additions and 149 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Dockerfile
49 changes: 49 additions & 0 deletions .github/workflows/docker-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#
name: Create and publish a Docker image

# Configures this workflow to run every time a change is pushed to the branch called `release`.
on:
push:
branches: ['samsung_wasm']

# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
jobs:
build-and-push-image:
runs-on: ubuntu-latest
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: write
#
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

6 changes: 0 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +0,0 @@
[submodule "moonlight-common-c"]
path = moonlight-common-c
url = ../moonlight-common-c
[submodule "opus"]
path = opus
url = https://github.com/xiph/opus.git
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -297,3 +297,4 @@ install(DIRECTORY wasm/platform DESTINATION widget)
install(FILES wasm/index.html DESTINATION widget)
install(FILES res/config.xml DESTINATION widget)
install(FILES res/platform.js DESTINATION widget)

109 changes: 109 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
FROM ubuntu:22.04 as base

ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Etc/UTC
RUN apt-get update && apt-get install -y \
cmake \
expect \
git \
ninja-build \
python2 \
unzip \
wget \
&& rm -rf /var/lib/apt/lists/*

# Some of Samsung scripts make reference to python,
# but Ubuntu only provides /usr/bin/python2.
RUN ln -sf /usr/bin/python2 /usr/bin/python

# Use a non-root user from here on
RUN useradd -m -s /bin/bash moonlight
USER moonlight
WORKDIR /home/moonlight

# Install Tizen Studio
# get file: web-cli_Tizen_Studio_5.0_ubuntu-64.bin
RUN wget -nv -O web-cli_Tizen_Studio_5.0_ubuntu-64.bin 'https://download.tizen.org/sdk/Installer/tizen-studio_5.0/web-cli_Tizen_Studio_5.0_ubuntu-64.bin'
RUN chmod a+x web-cli_Tizen_Studio_5.0_ubuntu-64.bin
RUN ./web-cli_Tizen_Studio_5.0_ubuntu-64.bin --accept-license /home/moonlight/tizen-studio
ENV PATH=/home/moonlight/tizen-studio/tools/ide/bin:/home/moonlight/tizen-studio/tools:${PATH}

# Prepare Tizen signing cerficates
RUN tizen certificate \
-a Moonlight \
-f Moonlight \
-p 1234
RUN tizen security-profiles add \
-n Moonlight \
-a /home/moonlight/tizen-studio-data/keystore/author/Moonlight.p12 \
-p 1234

# Workaround to package applications without gnome-keyring
# These steps must be repeated each time prior to packaging an application.
# See <https://developer.tizen.org/forums/sdk-ide/pwd-fle-format-profile.xml-certificates>
RUN sed -i 's|/home/moonlight/tizen-studio-data/keystore/author/Moonlight.pwd||' /home/moonlight/tizen-studio-data/profile/profiles.xml
RUN sed -i 's|/home/moonlight/tizen-studio-data/tools/certificate-generator/certificates/distributor/tizen-distributor-signer.pwd|tizenpkcs12passfordsigner|' /home/moonlight/tizen-studio-data/profile/profiles.xml

# Install Samsung Emscripten SDK
# get file: emscripten-1.39.4.7-linux64.zip
RUN wget -nv -O emscripten-1.39.4.7-linux64.zip 'https://developer.samsung.com/smarttv/file/a5013a65-af11-4b59-844f-2d34f14d19a9'
RUN unzip emscripten-1.39.4.7-linux64.zip
WORKDIR emscripten-release-bundle/emsdk
RUN ./emsdk activate latest-fastcomp
WORKDIR ../..

# Build moonlight
COPY --chown=moonlight . ./moonlight-chrome-tizen

RUN cmake \
-DCMAKE_TOOLCHAIN_FILE=/home/moonlight/emscripten-release-bundle/emsdk/fastcomp/emscripten/cmake/Modules/Platform/Emscripten.cmake \
-G Ninja \
-S moonlight-chrome-tizen \
-B build
RUN cmake --build build
RUN cmake --install build --prefix build

RUN cp moonlight-chrome-tizen/icons/icon.png build/widget/

# Package and sign application
# Effectively runs `tizen package -t wgt -- build/widget`,
# but uses an expect cmdfile to automate the password prompt.
RUN echo \
'set timeout -1\n' \
'spawn tizen package -t wgt -- build/widget\n' \
'expect "Author password:"\n' \
'send -- "1234\\r"\n' \
'expect "Yes: (Y), No: (N) ?"\n' \
'send -- "N\\r"\n' \
'expect eof\n' \
| expect

RUN mv build/widget/MoonlightWasm.wgt .

# remove unneed files
RUN rm -rf \
build \
emscripten-1.39.4.7-linux64.zip \
emscripten-release-bundle \
moonlight-chrome-tizen \
tizen-package-expect.sh \
web-cli_Tizen_Studio_5.0_ubuntu-64.bin \
.emscripten \
.emscripten_cache \
.emscripten_cache.lock \
.emscripten_ports \
.emscripten_sanity \
.package-manager \
.wget-hsts

# Use a multistage build to reclaim space from deleted files
FROM ubuntu:22.04
COPY --from=base / /
USER moonlight
WORKDIR /home/moonlight

# Add Tizen Studio to path
ENV PATH=/home/moonlight/tizen-studio/tools/ide/bin:/home/moonlight/tizen-studio/tools:${PATH}

# RUN sdb connect 192.168.0.228
# RUN tizen install -n MoonlightWasm.wgt -t QN55Q65BAGC
100 changes: 77 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,82 @@
# Moonlight for ChromeOS
# Moonlight for Tizen
An easy method for building Moonlight for Samsung TV
#### OneLiberty repo with many fixes that I haven't fixed in this repo yet go check out: https://github.com/OneLiberty/moonlight-chrome-tizen

[Moonlight for ChromeOS](https://moonlight-stream.org) is an open source implementation of NVIDIA's GameStream, as used by the NVIDIA Shield, but built to run on ChromeOS.
## Credits
- Moonlight developers: https://moonlight-stream.org
- Samsung developers: https://github.com/SamsungDForum/moonlight-chrome
- This Dockerfile and support files have been adapted from [jellyfin-docker-tizen](https://github.com/babagreensheep/jellyfin-tizen-docker)
- Dockerfile readapted for my repository tizen from [pablojrl123](https://github.com/pablojrl123/moonlight-tizen-docker)

Moonlight for ChromeOS allows you to stream your full collection of games from your powerful desktop to another PC or laptop running ChromeOS.
## Using the prebuilt Docker image
1. Enable developer mode on the TV (more information on [official Samsung guide](https://developer.samsung.com/smarttv/develop/getting-started/using-sdk/tv-device.html)):
- Go to Apps.
- Press `12345` on the remote; a dialog should pop up.
- Set `Developer mode` to `On`; fill in the IP of the Docker host.
- Power off and power on the TV as instructed; go once again to Apps.
- Depending on your model, a "DEVELOP MODE" or similar message might appear.

2. Deploy the application to the TV:
- Run and enter a container; the container will be removed automatically on exit:
```
docker run -it --rm ghcr.io/kyrofrcode/moonlight-chrome-tizen:samsung_wasm
```
- Connect to your TV over Smart Development Bridge:
```sh
sdb connect YOUR_TV_IP
```
- Confirm that you are connected, take note of the device ID:
```
sdb devices
```
The device ID will be the last column, something like `UE65NU7400`.
- Install the package:
```sh
tizen install -n MoonlightWasm.wgt -t DEVICE_ID
```
Moonlight should now appear in your Recent Apps - or similar page - on your TV.
- Exit the container:
```sh
exit
```
- (Optional) Remove the Docker image:
```sh
docker image rm ghcr.io/kyrofrcode/moonlight-chrome-tizen:samsung_wasm
```

For Windows, Mac, and Linux, we recommend running the [new PC port](https://github.com/moonlight-stream/moonlight-qt) for maximum performance.
## Building the Docker image from source
1. Enable developer mode on the TV using the steps from the previous section

Moonlight also has mobile versions for [Android](https://github.com/moonlight-stream/moonlight-android) and [iOS/tvOS](https://github.com/moonlight-stream/moonlight-ios).
2. Build the application within a Docker image:
```
docker build -t moonlight-tizen .
```
This will take a while.

Check out [the Moonlight wiki](https://github.com/moonlight-stream/moonlight-docs/wiki) for more detailed project information, setup guide, or troubleshooting steps.

[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/w716mt9ulyww68c5/branch/master?svg=true)](https://ci.appveyor.com/project/cgutman/moonlight-chrome/branch/master)

[![Moonlight for ChromeOS](https://moonlight-stream.org/images/chrome_webstore.png)](https://chrome.google.com/webstore/detail/moonlight-game-streaming/gemamigbbenahjlfnmlfdjhdnkpbkfjj)

## Building
1. Install the Chrome Native Client SDK and download the current Pepper SDK
2. Set the `NACL_SDK_ROOT` environment variable to your Pepper SDK folder. If you need more detailed instructions, see [here](https://github.com/google/pepper.js/wiki/Getting-Started)
3. Run `git submodule update --init --recursive` from within `moonlight-chrome/`
4. Run `make` from within the `moonlight-chrome/` repo

## Testing
1. Open the Extensions page in Chrome
2. Check the 'Developer mode' option
3. Click 'Load unpacked extension' and point it at your built moonlight-chrome repo
4. Run Moonlight from the extensions page
5. If making changes, make sure to click the Reload button on the Extensions page
3. Deploy the application to the TV:
- Run and enter a container; the container will be removed automatically on exit:
```
docker run -it --rm moonlight-tizen
```
- Connect to your TV over Smart Development Bridge:
```sh
sdb connect YOUR_TV_IP
```
- Confirm that you are connected, take note of the device ID:
```
sdb devices
```
The device ID will be the last column, something like `UE65NU7400`.
- Install the package:
```sh
tizen install -n MoonlightWasm.wgt -t DEVICE_ID
```
Moonlight should now appear in your Recent Apps - or similar page - on your TV.
- Exit the container:
```sh
exit
```
- (Optional) Remove the Docker image:
```sh
docker image rm moonlight-tizen
```
7 changes: 5 additions & 2 deletions auddec.cpp
Original file line number Diff line number Diff line change
@@ -11,8 +11,8 @@
// at a time.

static short s_CircularBuffer[CIRCULAR_BUFFER_SIZE][FRAME_SIZE * MAX_CHANNEL_COUNT];
static int s_ReadIndex = 0;
static int s_WriteIndex = 0;
static int s_ReadIndex;
static int s_WriteIndex;

static void AudioPlayerSampleCallback(void* samples, uint32_t buffer_size, void* data) {
// It should only ask us for complete buffers
@@ -36,6 +36,9 @@ static void AudioPlayerSampleCallback(void* samples, uint32_t buffer_size, void*

int MoonlightInstance::AudDecInit(int audioConfiguration, POPUS_MULTISTREAM_CONFIGURATION opusConfig, void* context, int flags) {
int rc;

// Reset the ring buffer to empty
s_ReadIndex = s_WriteIndex = 0;

g_Instance->m_OpusDecoder = opus_multistream_decoder_create(opusConfig->sampleRate,
opusConfig->channelCount,
8 changes: 7 additions & 1 deletion connectionlistener.cpp
Original file line number Diff line number Diff line change
@@ -45,9 +45,14 @@ void MoonlightInstance::ClDisplayTransientMessage(const char* message) {

void MoonlightInstance::ClLogMessage(const char* format, ...) {
va_list va;
char message[1024];

va_start(va, format);
vfprintf(stderr, format, va);
vsnprintf(message, sizeof(message), format, va);
va_end(va);

pp::Var response(std::string("LogMsg: ") + std::string(message));
g_Instance->PostMessage(response);
}

CONNECTION_LISTENER_CALLBACKS MoonlightInstance::s_ClCallbacks = {
@@ -56,4 +61,5 @@ CONNECTION_LISTENER_CALLBACKS MoonlightInstance::s_ClCallbacks = {
.connectionStarted = MoonlightInstance::ClConnectionStarted,
.connectionTerminated = MoonlightInstance::ClConnectionTerminated,
.logMessage = MoonlightInstance::ClLogMessage,
.rumble = MoonlightInstance::ClControllerRumble,
};
16 changes: 16 additions & 0 deletions do-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
fail()
{
echo "$1" 1>&2
exit 1
}

git diff-index --quiet HEAD -- || fail "Release builds must not have unstaged changes!"

rm moonlight-chrome.zip
make clean || fail "Clean failed"
make -j$(nproc) || fail "Build failed"


zip moonlight-chrome.zip -r . -i pnacl/Release/moonlight-chrome.* -i manifest.json -i index.html -i LICENSE || fail "Zip failed"
zip moonlight-chrome.zip -r icons || fail "Zip failed"
zip moonlight-chrome.zip -r static || fail "Zip failed"
13 changes: 13 additions & 0 deletions gamepad.cpp
Original file line number Diff line number Diff line change
@@ -4,6 +4,8 @@

#include <Limelight.h>

#include <sstream>

static const unsigned short k_StandardGamepadButtonMapping[] = {
A_FLAG, B_FLAG, X_FLAG, Y_FLAG,
LB_FLAG, RB_FLAG,
@@ -127,3 +129,14 @@ void MoonlightInstance::PollGamepads() {
controllerIndex++;
}
}

void MoonlightInstance::ClControllerRumble(unsigned short controllerNumber, unsigned short lowFreqMotor, unsigned short highFreqMotor)
{
const float weakMagnitude = static_cast<float>(highFreqMotor) / static_cast<float>(UINT16_MAX);
const float strongMagnitude = static_cast<float>(lowFreqMotor) / static_cast<float>(UINT16_MAX);

std::ostringstream ss;
ss << controllerNumber << "," << weakMagnitude << "," << strongMagnitude;
pp::Var response(std::string("controllerRumble: ") + ss.str());
g_Instance->PostMessage(response);
}
Binary file added icons/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -79,6 +79,16 @@
</div>
</div>

<div class="nav-menu-parent">
<label id="mouseLockBtn" class="mdl-icon-toggle mdl-js-icon-toggle mdl-js-ripple-effect" for="mouseLockEnabledSwitch">
<input type="checkbox" id="mouseLockEnabledSwitch" class="mdl-icon-toggle__input">
<i class="mdl-icon-toggle__label material-icons">mouse</i>
</label>
<div id="mouseLockTooltip" class="mdl-tooltip" for="mouseLockBtn">
Enable mouse locking (must disable to use tap-to-click on touchpads)
</div>
</div>

<div class="nav-menu-parent">
<label id="optimizeGamesBtn" class="mdl-icon-toggle mdl-js-icon-toggle mdl-js-ripple-effect" for="optimizeGamesSwitch">
<input type="checkbox" id="optimizeGamesSwitch" class="mdl-icon-toggle__input">
Loading