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

Added MicroSDeck #351

Merged
merged 3 commits into from
Oct 23, 2023
Merged

Added MicroSDeck #351

merged 3 commits into from
Oct 23, 2023

Conversation

CEbbinghaus
Copy link
Contributor

@CEbbinghaus CEbbinghaus commented May 6, 2023

MicroSDeck

MicroSDeck is a small plugin to manage games on MicroSD Cards which are not currently plugged in. It works by tracking all games it encounters on MicroSD Cards inserted and providing that data when a Game is viewed that is not currently installed.

Checklist:

  • Improve UI based on feedback (Library UI is especially bad RN)
  • Fix the problem with FS monitoring which causes bind events to never occur
  • Add functionality to remove/add games when installing (rather than just when the card is inserted)
  • General Polish and code cleanup / commenting
  • Update package versions and clean up metadata files

Developer Checklist

  • I am the original author or an authorized maintainer of this plugin.
  • I have abided by the licenses of the libraries I am utilizing, including attaching license notices where appropriate.

Plugin Checklist

  • I have verified that my plugin works properly on the Stable and Beta update channels of SteamOS.
  • I have verified my plugin is unique or alternatively provides more/alternative functionality to a similar plugin already on the store.

Plugin Backend Checklist

  • Yes: I am using a custom backend other than Python.
  • Yes: I am using a tool or software from a 3rd party FOSS project that does not have it's dependencies statically linked.
  • No: I am using a custom binary that has all of it's dependencies statically linked.

Testing

  • Tested on SteamOS Stable Update Channel.
  • Tested on SteamOS Beta Update Channel.

@CEbbinghaus
Copy link
Contributor Author

This is still fairly early although a lot of work has been done already. Keen to get some feedback before I tick the last items off the list.

@TrainDoctor TrainDoctor added plugin-addition on-hold This pull request must wait until it can be merged labels May 7, 2023
@CEbbinghaus CEbbinghaus marked this pull request as ready for review May 20, 2023 05:04
@CEbbinghaus CEbbinghaus requested a review from a team as a code owner May 20, 2023 05:04
@nabel0
Copy link

nabel0 commented May 27, 2023

Any progress on this? Would love to test this bit it's not in the testing store

@CEbbinghaus
Copy link
Contributor Author

Any progress on this? Would love to test this bit it's not in the testing store

Apologies, I only really get weekends to work on this and since I was busy all of last weekend I wasn't able to make any progress. I will try and get this building in the CI/CD today but I'm not sure how to get it into the testing store

@CEbbinghaus
Copy link
Contributor Author

I rebased onto current master. @TrainDoctor I appreciate you doing a merge but I will always rebase myself when I get to it. It seems that my backend directory is missing something I was previously not aware of nor existed in the template I used so let me fix that & get back. Will probably be tonight at the earliest 😢

@TrainDoctor
Copy link
Member

I rebased onto current master. @TrainDoctor I appreciate you doing a merge but I will always rebase myself when I get to it. It seems that my backend directory is missing something I was previously not aware of nor existed in the template I used so let me fix that & get back. Will probably be tonight at the earliest 😢

To be clear, I made no changes other than one required by git to properly put your submodule below a recently added plugin. And yes the backend directory is marked out in the docs. I can improve the docs to make it more clear how this folder works to your liking.

@CEbbinghaus
Copy link
Contributor Author

I added the required files but Haven't been able to get it all working to the level of getting to fixing potential missing dependencies for the build. Will try to resolve that soon

@CEbbinghaus CEbbinghaus temporarily deployed to testing_env June 6, 2023 15:23 — with GitHub Actions Inactive
@TrainDoctor TrainDoctor requested a review from a team June 7, 2023 19:06
@TrainDoctor TrainDoctor removed the on-hold This pull request must wait until it can be merged label Jun 7, 2023
@CEbbinghaus
Copy link
Contributor Author

CEbbinghaus commented Jun 8, 2023

Got it working (Was a problem with my local environment. Didn't even need to modify the dockerfile for it to work) so its ready to be run through CI & tests

Copy link

@nabel0 nabel0 left a comment

Choose a reason for hiding this comment

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

Any infos or guide how this will work?
I cant figure it out.
The "Open Settings Page" button only shows a "Pending..." dialogue.
Any i can't see any other infos about my games.

@CEbbinghaus
Copy link
Contributor Author

Any infos or guide how this will work? I cant figure it out. The "Open Settings Page" button only shows a "Pending..." dialogue. Any i can't see any other infos about my games.

Ah right. Yes, this one is a little tricky, I appreciate you being the guinea pig for this plugin though so Thank you so much.

Essentially the backend binds to udev to listen for device added notifications on the MMC category (you sticking in a MicroSD card). It then reads the content & determines if that MicroSD card contains a Steam library. After which it then parses the apps & loads all the data into an internal database. As such you might have to unplug & replug the MicroSD card for it to work.

But I have also had udev be a little more inconsistent than I would like and at times the bind wasn't fired even though the MicroSD card was inserted.

Additionally, it should do a full search of an existing card when the plugin loads but that clearly seems to have failed in one way or another.

@nabel0
Copy link

nabel0 commented Aug 8, 2023

Any news on this plugin? Or is it abandoned?

@CEbbinghaus
Copy link
Contributor Author

Not quite abandoned but also not solved. Right now There is a problem in that I cannot run a file system watcher on the SD Card that works seamlessly with swapping SD cards while also picking up FS changes within the SD Card. So while right now it will work perfectly for removing & inserting SD cards. It will not pick up if you installed a game on a SD card you have currently inserted. & subsequently it will not save that game when you remove the card (so it doesn't show up). This is currently the blocker that is stopping me from progressing much further since it feels incomplete & unpolished working only half the time.

If anyone has an idea on how to better capture which games are stored on which card please feel free to contribute. My current idea is to remove all smarts hooking into the device mount & instead just keep trying to search this directory on a timer (e.g 5s) which would add a bit extra processing (it no longer idly waits until you inserted a new card) but it should pick up on newly installed games without requiring a file system watcher.

@PartyWumpus
Copy link
Member

Just to clarify: the issue is newly installed games aren't recognized? If it is, you could probably set up something in the frontend that runs every time the steam client finishes downloading anything. Iirc bash shortcuts has something like that, so you could see how that does it.

@CEbbinghaus
Copy link
Contributor Author

Good point. Absolutely I could & it would fit well into my next step which is to replace some of the USDPL with gRPC. I will investigate that option. Thanks for the tip :3

@CEbbinghaus CEbbinghaus temporarily deployed to testing_env August 10, 2023 10:17 — with GitHub Actions Inactive
@nabel0
Copy link

nabel0 commented Aug 17, 2023

Any news?

@CEbbinghaus
Copy link
Contributor Author

CEbbinghaus commented Aug 18, 2023

The week has been busy. The weekend is hopefully going to give me some time to work on this. The current TODO list is:

  • Rewrite API to be HTTP/REST & get rid of frontend package. This is going to simplify getting data & allow other plugins to use the MicroSDeck backend for optional features (see TabMaster Discussion on discord)
  • Fix scanning for new games by either periodically searching through the directory or having the frontend send an event when a game is installed/removed.
  • Update the UI to be cleaner & investigate the possibility of moving the card view into the side bar
  • Fix the Library modal showing which card the current game is on. It is currently right above the play button but remains there even once hitting play. This will need to be moved or faded out when hitting play.
  • More testing. Ideally from more people & more feedback from you & others @nabel0.

@nabel0
Copy link

nabel0 commented Aug 28, 2023

The week has been busy. The weekend is hopefully going to give me some time to work on this. The current TODO list is:

  • Rewrite API to be HTTP/REST & get rid of frontend package. This is going to simplify getting data & allow other plugins to use the MicroSDeck backend for optional features (see TabMaster Discussion on discord)
  • Fix scanning for new games by either periodically searching through the directory or having the frontend send an event when a game is installed/removed.
  • Update the UI to be cleaner & investigate the possibility of moving the card view into the side bar
  • Fix the Library modal showing which card the current game is on. It is currently right above the play button but remains there even once hitting play. This will need to be moved or faded out when hitting play.
  • More testing. Ideally from more people & more feedback from you & others @nabel0.

Sounds nice. Just give me a ping if you need help in testing out stuff...

@CEbbinghaus
Copy link
Contributor Author

I finished the work of moving the whole system to a REST API. There were some problems because it caused the program to never be able to exit from SIGINT & would require going into htop & SIGTERM'ing it. But that seems to be fixed now & the API seems to work fine. There are a few small kinks I need to work out (id's have a newline at the end?) but overall the backend is a lot closer to being stable. It only requires some proper scanning & game deleting functionality and we can focus on the frontend. Pardon the delay it's been hectic over on this side.

Hoping to get to it this coming weekend though :3

# Conflicts:
#	.gitmodules

# Conflicts:
#	.gitmodules
@CEbbinghaus
Copy link
Contributor Author

So lots of updates since the last one. Took a while to get back into it but I finally fixed the github action so It doesn't require waiting for an approval before a new version can be tested. Additionally a lot of dependencies have been removed which simplify the architecture a lot and cut down on the performance overhead.

So surrealdb has been replaced with a bespoke "database" system that just serializes to a file. This removes some threads that would previously asynchronously process queries & do the lookup but since the throughput is expected to be extremely low this solution utilizing a Mutex is far superior.

Additionally libudev & listening to device updates has been removed. It had some strange edge cases where the MicroSD card would not be recognized, and I have to scan for installed games every 5 seconds anyways it just adds yet another thread that doesn't need to exist.

So I have now allocated 2 total threads (I Hope) one for the HTTP server used for communication with the frontend & one for checking the microsd card directory every 5 seconds.

With that the backend has been slimmed & streamlined a LOT and if it all works I would only want a tiny bit of UI cleanup before it gets merged. I am also very keen on getting this added even before I am 100% happy with the UI since it takes a bit of stress off lessening the load of things needed to be done at once.

@CEbbinghaus CEbbinghaus temporarily deployed to testing_env October 22, 2023 14:07 — with GitHub Actions Inactive
@CEbbinghaus
Copy link
Contributor Author

With that there have been some significant improvements on the backend. And while the frontend isn't quite perfect its perfectly usable. Barring any problems found, It would be nice to get this merged. That way I don't have the pressure of getting it all right the first time and can start iterating to improve bits.

@nabel0
Copy link

nabel0 commented Oct 22, 2023

Already tested this with a provided zip. Works really well. Very nice tool for users with multiple SD Cards like me (7 SD's). Would be nice to get an approval fast to go off into the store.

@CEbbinghaus
Copy link
Contributor Author

For anyone wanting to try it before it ends up in either the testing or full store. You can find the artifact here (just choose the latest successful one). Pasting that url into the plugin install should do it :p

Copy link

@nabel0 nabel0 left a comment

Choose a reason for hiding this comment

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

Tested on SteamOS STable, Beta and Preview Update Channel and works fine...
Ready for production

@TrainDoctor TrainDoctor merged commit 84f24d7 into SteamDeckHomebrew:main Oct 23, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants