Skip to content
This repository was archived by the owner on Jan 10, 2026. It is now read-only.

added support for non steam game with cover art support#23

Merged
oo8dev merged 5 commits intooo8dev:masterfrom
RocketKevQt:master
Jun 1, 2025
Merged

added support for non steam game with cover art support#23
oo8dev merged 5 commits intooo8dev:masterfrom
RocketKevQt:master

Conversation

@RocketKevQt
Copy link

This is my first time writing rust and typescript so feel free to ask for modifications if needed, I added support for non steam games inside the game folder so there is a centralized way to run any kind of games

@RocketKevQt
Copy link
Author

RocketKevQt commented May 29, 2025

Decided to use base64 instead of copying the files. I needed to update security policy to allow image load from base64 but it's working as it should in vr and out of vr

@RocketKevQt
Copy link
Author

RocketKevQt commented May 29, 2025

As explained, I realised steamgriddb do not give only png but also other kinds of images, so added support of them in the conversion to base 64

@oo8dev
Copy link
Owner

oo8dev commented May 30, 2025

Hello and thanks for the contribution. Make sure that this code will be compatible in non-development scenarios (package managers, Envision plugin) - as a single executable. Could you explain how does this custom cover arts downloader work? Is "grid" directory being created by Steam or it's comething custom?

Copy link
Owner

@oo8dev oo8dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed some things.

struct Shortcut {
name: String,
exe: String,
run_game_id: u64,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to run cargo fmt across this whole project or setup your IDE to auto-format the code after saving it. This project uses tabs as indentation instead of spaces, you can install "Editorconfig" and "rust-analyzer" extensions in case of VSCode

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's now correctly formatted

};

let Ok(pid) = pid.parse::<i32>() else {
let Ok(pid) = pid.parse::<u64>() else {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pid is explicitly being used to determine a process ID. In case if you want to add some metadata to this number, you can try using Enum instead if it's something else than a process ID

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i should have reverted the changes

}

pub type AppID = u64;
pub type AppID = String;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's a good idea to separate Steam's AppID and custom ones using an Enum

Copy link
Author

@RocketKevQt RocketKevQt May 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm not sure, cause I had to convert it to String because typescript convert u64 to the "number" type which round up the least significant bits. It's not a problem usually with "normal" AppID cause they're shorter but converting it to string fixes the rounding. Switching to bigint every where in typescript did not fix the issue because it's occuring in the ipc.game_list();

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, if that's the case - sure.

@RocketKevQt
Copy link
Author

RocketKevQt commented May 30, 2025

Hello and thanks for the contribution. Make sure that this code will be compatible in non-development scenarios (package managers, Envision plugin) - as a single executable. Could you explain how does this custom cover arts downloader work? Is "grid" directory being created by Steam or it's comething custom?

I used in my headset and to me it's working. The code works by checking the "~/.steam/steam/userdata/{userid}/config/shortcut.vdf file. here it tells that there is non steam games that have been added. While parsing, the library automatically generates a i32 that correspond to the game id when it's runned, however to run it steam needs a u64 that is corresponding to the app_id at the most significant bits and 0x02000000 at the least.

the cover art downloader convert the cover art to base64 and give it directly to the metadata. so in the<> <img className={scss.game_cover_image} src="data:{base_64_data};base64,{mime_type}"/> </>;;
The grid folder is automatically generated by steam if it's added through steam itself or when using external tools like bottles, heroic games launcher or steamgriddb

@RocketKevQt
Copy link
Author

I should have fixed all of the issues, i reviewed them one by one and use Option for the cover_b64

@oo8dev
Copy link
Owner

oo8dev commented Jun 1, 2025

I think this PR is good to go, only one request: could you do a check in get_app_details_json() in utils.ts to prevent requesting Steam API for system-installed shortcuts? They will be not valid anyways. Thanks!

@RocketKevQt
Copy link
Author

RocketKevQt commented Jun 1, 2025

I added a check in the GameCover({ manifest, big, on_click }) function instead. I check for the length of the run_game_id, (32 bits integer for steam games (so maximum 10 char) ) if it's longer than 10 chars, it means it's a non steam game and I bypass the call. (indead of throwing an error in the get_app_details_json() to handle it

@oo8dev
Copy link
Owner

oo8dev commented Jun 1, 2025

Thank you for your contribution! Merging

@oo8dev oo8dev merged commit 37d57b4 into oo8dev:master Jun 1, 2025
1 check passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants