Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] File paths and cover images #1296

Closed
3 tasks done
zetsubou-io opened this issue May 21, 2023 · 12 comments
Closed
3 tasks done

[Windows] File paths and cover images #1296

zetsubou-io opened this issue May 21, 2023 · 12 comments
Labels
os:Windows OS is Windows stale

Comments

@zetsubou-io
Copy link

zetsubou-io commented May 21, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Is your issue described in the documentation?

  • I have read the documentation

Is your issue present in the nightly release?

  • This issue is present in the nightly release

Describe the Bug

Windows 10 Pro
Version 22H2
OS build 19045.2965

Sunshine Nightly Version 0.19.1.8da2caf764587b31902f058606334ac6e612b65f

  • Downloaded image covers don't load.
  • Inconsistent slashes in file paths?
  • FATAL error when saving app configs.

Steps:

  1. Adding an app in the GUI results in a change in the /config/apps.json file but also an error:

    [2023:05:21:13:09:27]:` Fatal: C:\Program Files\Sunshine\config/apps.json

    C:\Program Files\Sunshine\config\apps.json is still written to despite the error and inconsistent slashes.

    Selecting a cover image using the find image function also results in inconsistent slashes.

    C:\Program Files\Sunshine\config/covers/igdb_117271.png

  2. The new app appears in Moonlight clients but with no image cover. Correcting the slashes (all "\\" or "/") in config/apps.json does not help.

  3. Manually configuring the configs/apps.json file path in the GUI to "C:\Program Files\Sunshine\config\apps.json" does not help.

Expected Behavior

  • File paths written to config/apps.json without path issues or FATAL errors.
  • Image covers to load on Moonlight clients.

Additional Context

No response

Host Operating System

Windows

Operating System Version

10 Pro 22H2 Build 19045.2965

Architecture

64 bit

Sunshine commit or version

0.19.1.8da2caf764587b31902f058606334ac6e612b65f

Package

Windows - installer

GPU Type

Nvidia

GPU Model

GeForce RTX 3070

GPU Driver/Mesa Version

531.79

Capture Method (Linux Only)

No response

Config

virtual_sink = {0.0.0.00000000}.{922e05a3-5632-4d96-9455-e07dd749c2f9}

Apps

{
    "env": {
        "PATH": "$(PATH);$(ProgramFiles(x86))\\Steam"
    },
    "apps": [
        {
            "name": "Desktop",
            "image-path": "desktop.png"
        },
        {
            "name": "Steam Big Picture",
            "detached": [
                "steam steam:\/\/open\/bigpicture"
            ],
            "image-path": "steam.png"
        },
        {
            "name": "Chained Echoes",
            "output": "",
            "cmd": "D:\\Games\\Chained Echoes\\Chained Echoes.exe",
            "exclude-global-prep-cmd": "true",
            "elevated": "false",
            "image-path": "C:\\Program Files\\Sunshine\\config\/covers\/igdb_117271.png"
        }
    ]
}

Relevant log output

[2023:05:21:13:49:47]: Info: Sunshine version: 0.19.1.8da2caf764587b31902f058606334ac6e612b65f
[2023:05:21:13:49:47]: Info: Compiling shaders...
[2023:05:21:13:49:47]: Info: System tray created
[2023:05:21:13:49:47]: Info: Compiled shaders
[2023:05:21:13:49:47]: Info: // Testing for available encoders, this may generate errors. You can safely ignore those errors. //
[2023:05:21:13:49:47]: Info: Trying encoder [nvenc]
[2023:05:21:13:49:47]: Info: ddprobe.exe [1] [] returned: 0x00000000
[2023:05:21:13:49:47]: Info: Set GPU preference: 1
[2023:05:21:13:49:48]: Info: 
Device Description : NVIDIA GeForce RTX 3070
Device Vendor ID   : 0x000010DE
Device Device ID   : 0x00002484
Device Video Mem   : 8032 MiB
Device Sys Mem     : 0 MiB
Share Sys Mem      : 16345 MiB
Feature Level      : 0x0000B100
Capture size       : 2560x1440
Offset             : 3440x0
Virtual Desktop    : 6000x1440
[2023:05:21:13:49:48]: Info: Desktop resolution [2560x1440]
[2023:05:21:13:49:48]: Info: Desktop format [DXGI_FORMAT_B8G8R8A8_UNORM]
[2023:05:21:13:49:48]: Info: 
Colorspace         : DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
Bits Per Color     : 8
Red Primary        : [0.661133,0.332031]
Green Primary      : [0.301758,0.613281]
Blue Primary       : [0.149414,0.0595703]
White Point        : [0.313477,0.329102]
Min Luminance      : 0.5 nits
Max Luminance      : 270 nits
Max Full Luminance : 270 nits
[2023:05:21:13:49:48]: Info: SDR color coding [Rec. 601]
[2023:05:21:13:49:48]: Info: Color range: [JPEG]
[2023:05:21:13:49:49]: Info: 
Device Description : NVIDIA GeForce RTX 3070
Device Vendor ID   : 0x000010DE
Device Device ID   : 0x00002484
Device Video Mem   : 8032 MiB
Device Sys Mem     : 0 MiB
Share Sys Mem      : 16345 MiB
Feature Level      : 0x0000B100
Capture size       : 2560x1440
Offset             : 3440x0
Virtual Desktop    : 6000x1440
[2023:05:21:13:49:49]: Info: Desktop resolution [2560x1440]
[2023:05:21:13:49:49]: Info: Desktop format [DXGI_FORMAT_B8G8R8A8_UNORM]
[2023:05:21:13:49:49]: Info: 
Colorspace         : DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
Bits Per Color     : 8
Red Primary        : [0.661133,0.332031]
Green Primary      : [0.301758,0.613281]
Blue Primary       : [0.149414,0.0595703]
White Point        : [0.313477,0.329102]
Min Luminance      : 0.5 nits
Max Luminance      : 270 nits
Max Full Luminance : 270 nits
[2023:05:21:13:49:50]: Info: SDR color coding [Rec. 601]
[2023:05:21:13:49:50]: Info: Color range: [JPEG]
[2023:05:21:13:49:51]: Info: 
Device Description : NVIDIA GeForce RTX 3070
Device Vendor ID   : 0x000010DE
Device Device ID   : 0x00002484
Device Video Mem   : 8032 MiB
Device Sys Mem     : 0 MiB
Share Sys Mem      : 16345 MiB
Feature Level      : 0x0000B100
Capture size       : 2560x1440
Offset             : 3440x0
Virtual Desktop    : 6000x1440
[2023:05:21:13:49:51]: Info: Desktop resolution [2560x1440]
[2023:05:21:13:49:51]: Info: Desktop format [DXGI_FORMAT_B8G8R8A8_UNORM]
[2023:05:21:13:49:51]: Info: 
Colorspace         : DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
Bits Per Color     : 8
Red Primary        : [0.661133,0.332031]
Green Primary      : [0.301758,0.613281]
Blue Primary       : [0.149414,0.0595703]
White Point        : [0.313477,0.329102]
Min Luminance      : 0.5 nits
Max Luminance      : 270 nits
Max Full Luminance : 270 nits
[2023:05:21:13:49:51]: Info: SDR color coding [Rec. 709]
[2023:05:21:13:49:51]: Info: Color range: [JPEG]
[2023:05:21:13:49:51]: Info: 
[2023:05:21:13:49:51]: Info: // Ignore any errors mentioned above, they are not relevant. //
[2023:05:21:13:49:51]: Info: 
[2023:05:21:13:49:51]: Info: Found encoder nvenc: [h264_nvenc, hevc_nvenc]
[2023:05:21:13:49:51]: Info: Configuration UI available at [https://localhost:47990]
[2023:05:21:13:49:52]: Info: Registered Sunshine mDNS service
[2023:05:21:13:51:53]: Fatal: C:\Program Files\Sunshine\config/apps.json
@zetsubou-io zetsubou-io changed the title [Windows] Actual apps.json path. [Windows] File paths and cover images May 21, 2023
@ReenigneArcher
Copy link
Member

I would probably say this is a file permissions issue. I would try deleting this one /config/apps.json... do not delete the other one... and do not edit the file manually, only edit it through the web UI.

@kurac338
Copy link

For me images work only if placed in the same directory as apps.json.
In other words images need to be placed here: C:\Program Files\Sunshine\assets\.
And referenced in the web UI or .json without whitespaces like this: game-cover-image.png.

@ReenigneArcher
Copy link
Member

@kurac338 I would suggest to NOT put files there manually. Certainly not in assets as that directory will get deleted on updates.

Use the full path to the image.

@kurac338
Copy link

Initially when I first switched to Sunshine (v18.6), I had played around with the syntax of locations and path types (absolute, relative) for images, but only the method described in my previous comment worked as expected.

Since than, I've followed each release and the images were persisted in the assets directory. This is also true for the application list configuration JSON. ¯\_(ツ)_/¯

Although I haven't tried messing with the image configuration since than.
(If my memory servers, the images were not mentioned in the changelog neither?)

@Darkhost1999
Copy link

I'm glad I'm not the only one experiencing this.
I tried full URL path + the path on my PC, and neither worked.

@ReenigneArcher
Copy link
Member

I'm glad I'm not the only one experiencing this.
I tried full URL path + the path on my PC, and neither worked.

URLs don't work.

@Darkhost1999
Copy link

Darkhost1999 commented Jun 18, 2023

URLs don't work.

Thanks it wasn't clear.
This is the other path I tried "C:\Games\RPCS3\Icons\core-color-png.png". All I tried was copy and paste then read this issue and decided not to waste time on something reportedly not working

@LizardByte-bot
Copy link
Member

This issue is stale because it has been open for 90 days with no activity. Comment or remove the stale label, otherwise this will be closed in 10 days.

@kurac338
Copy link

No comments were added to this issue since our previous discussion, but the issue is still active on latest stable Sunhine v0.20.0.

Aside from our previous observations, I have also noticed that the web UI does not respect quotation marks for the image path input field. They are stripped/sanitized as soon as the app is saved/added.

IMO the issue is actually a mix of several bugs:

  • quotations not respected - meaning that any paths with whitespaces will not be resolvable
  • image file names must not contain whitespaces - directly related to the previous point
  • image lookup is relative to the Sunshine_install_dir/assets directory - meaning that absolute paths will not be resolved

@ReenigneArcher
Copy link
Member

quotations not respected - meaning that any paths with whitespaces will not be resolvable

We don't want the quotes, so we remove them. It's still a string though.

image lookup is relative to the Sunshine_install_dir/assets directory - meaning that absolute paths will not be resolved

Last time I checked absolute paths do work. Here's the function.

  std::string
  validate_app_image_path(std::string app_image_path) {
    if (app_image_path.empty()) {
      return DEFAULT_APP_IMAGE_PATH;
    }

    // get the image extension and convert it to lowercase
    auto image_extension = std::filesystem::path(app_image_path).extension().string();
    boost::to_lower(image_extension);

    // return the default box image if extension is not "png"
    if (image_extension != ".png") {
      return DEFAULT_APP_IMAGE_PATH;
    }

    // check if image is in assets directory
    auto full_image_path = std::filesystem::path(SUNSHINE_ASSETS_DIR) / app_image_path;
    if (std::filesystem::exists(full_image_path)) {
      return full_image_path.string();
    }
    else if (app_image_path == "./assets/steam.png") {
      // handle old default steam image definition
      return SUNSHINE_ASSETS_DIR "/steam.png";
    }

    // check if specified image exists
    std::error_code code;
    if (!std::filesystem::exists(app_image_path, code)) {
      // return default box image if image does not exist
      BOOST_LOG(warning) << "Couldn't find app image at path ["sv << app_image_path << ']';
      return DEFAULT_APP_IMAGE_PATH;
    }

    // image is a png, and not in assets directory
    // return only "content-type" http header compatible image type
    return app_image_path;
  }

In human terms.

  1. IF image is blank, use default image.
  2. Get the image extension and make it lowercase.
  3. Compare the lowercase extension to .png... IF it is NOT .png, use default image.
  4. Check if image is in assets directory, IF it is, use it
  5. Check if full image path does NOT exist, IF it does not, use default image
  6. IF none of the above conditions are true, use the image (i.e. this is when you specify the full path)

@LizardByte-bot
Copy link
Member

It seems this issue hasn't had any activity in the past 90 days. If it's still something you'd like addressed, please let us know by leaving a comment. Otherwise, to help keep our backlog tidy, we'll be closing this issue in 10 days. Thanks!

@LizardByte-bot
Copy link
Member

This issue was closed because it has been stalled for 10 days with no activity.

@LizardByte-bot LizardByte-bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 29, 2023
@ReenigneArcher ReenigneArcher added os:Windows OS is Windows and removed os:Windows:10 labels Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
os:Windows OS is Windows stale
Projects
None yet
Development

No branches or pull requests

5 participants