GiovanH / unofficial-homestuck-collection

An offline collection of Homestuck and its related works.
GNU General Public License v3.0
26 stars 3 forks source link

Handheld (Steam Deck) Mode #419

Open AmbrosiaEgg opened 2 years ago

AmbrosiaEgg commented 2 years ago

Is your feature request related to a problem? Please describe. Usage of the program on Steam Deck works if launched directly via Desktop Mode, but not when launched through the Steam Client in either Desktop or Gaming mode, also with no physical keyboard entering Fullscreen mode is impossible, and the window always defaults to a 16:9 aspect ratio.

Describe the solution you'd like The ability to launch via Steam and a toggle to automatically start at a custom resolution or in fullscreen when opening the app.

GiovanH commented 2 years ago

Some sort of setting to launch in full-screen mode makes sense, but I'm not sure what you mean by the first part. It doesn't open at all when opened as a shortcut in steam?

Bodertz commented 2 years ago

I don't know how familiar you are with the Steam Deck. There are two modes for the Steam deck, "Desktop Mode" and "Game Mode". Desktop Mode is just a normal Linux desktop, and the UHSC launches fine from Steam in that mode. It doesn't for AmbrosiaEgg apparently, but it does for me and at least one other person who posted a picture of it on /r/homestuck some time ago.

Game Mode is a console-like UI, and attempting to launch the UHSC there does not work. It may or may not be running in the background, but in any case it's not visible.

AmbrosiaEgg commented 2 years ago

I am able to launch the app directly, but not via Steam, in either Desktop or Gamemode, besides this it doesn't seem like it would be all too difficult to configure a button mapping to allow for the full experience to be had, my main concern is being able to open the app within the Steam Deck Game Mode, which prevents some hassle and would allow for custom input mapping to the app on a system level.

samirm commented 1 year ago

@AmbrosiaEgg did you install this as a flatpak? if not, how did you add it to the steam client?

any updates since then?

HuggieBo commented 1 year ago

I am also looking to run this.

I am confused though. There is an Appimage but I could not find a Flatpack version.

If we could get to run the Pogramm through Steam, then Steam input could work well with the Browser since it has Presets already for a Chromium Browser. So the only real hurdle rn is getting the program to launch via Steam or Gamemode.

When starting the Appimage or the Executeable(witch Both start in the Desktop mode without Steam) they seem to be in a loop. Since Steam says its Startung but nothing is happening. I will look online if there is maybe a common problem wit Electron or if I can find logfiles witch could point me to what is going wrong.

HuggieBo commented 1 year ago

Runnning the Executeable with output to a text gave this output.txt (edit: the sharp thing is unrelated since the prerelease also does not run)

Appimage does not give an output sadly but I wonder why it does not Spawn a window since it should not try to install a dependency. I hope this helps

A solution I tried was from this Thread but it sadly did not work. (--no-sandbox as startoption)

Bodertz commented 1 year ago

I've successfully gotten it to run in Game mode by doing the following:

TL;DR: Hardcode the path to sharp-linux-x64.node in sharp.js and launch with the --no-sandbox argument.

  module.exports = require(`../build/Release/sharp-${platformAndArch}.node`);

to

  module.exports = require(`../build/Release/sharp-linux-x64.node`);

That is, I replaced ${platformAndArch} with linux-x64. I do not know why ${platformAndArch} returns linuxnull-x64 (as can be seen in HuggieBo's output.txt file, and as I also saw on my Steam Deck), but it apparently does. Hardcoding the file path is a very simple workaround to the problem, though. Just check that the file actually exists. Starting from the directory where unofficial-homestuck-collection is, look for ./resources/app.asar.unpacked/node_modules/sharp/build/Release/sharp-linux-x64.node.

Does this work for you, HuggieBo? AmbrosiaEgg?

TheSmallBlue commented 1 year ago

Heya, I've been lurking around checking this issue and I just tested Bodertz's fix and I'm happy to say that it works perfectly! It's still a shame that it won't occupy the Deck's full screen, not even in fullscreen mode (F11)

Bodertz commented 1 year ago

If you go to the settings for the UHSC and check 'Use system window decorations', then F11 (which I bound to a back grip button) will make it full screen.

TheSmallBlue commented 1 year ago

Oh awesome! It works and looks excellent now, thank you so much!

Bodertz commented 1 year ago

This is off-topic for the issue, so I'm not going to be too detailed, but this is how you can get nice aliased fonts in the collection.

First, make sure you've installed the necessary fonts on your system. They are:

  1. Courier New Bold, which is used for main text of the comic, such as the Pesterlogs.
  2. Verdana, which is used for reader commands at the bottom of the panels.
  3. Comic Sans, which is used for SBaHJ sections.

Then, write a launcher script for the collection which does the following:

  1. Sets the environment variable XDG_HOME to some directory. I set this to Homestuck/Profiles/<SomeName> so that I can have multiple "profiles" that I can switch between using a tcl script.
  2. Launches the collection.

Point Steam to that launcher.

Finally, under Homestuck/Profiles/<SomeName>, create a fontconfig folder, and under that a file called fonts.conf with the following as its content:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
  <match target="font">
    <test name="family" qual="any">
      <string>Courier New</string>
    </test>
    <edit name="antialias" mode="assign">
      <bool>false</bool>
    </edit>
  </match>

  <match target="font">
    <test name="size" qual="any" compare="less">
      <double>13</double>
    </test>
    <edit name="antialias" mode="assign">
      <bool>true</bool>
    </edit>
  </match>

  <match target="font">
    <test name="size" qual="any" compare="more">
      <double>16</double>
    </test>
    <edit name="antialias" mode="assign">
      <bool>true</bool>
    </edit>
  </match>
</fontconfig>

This disables antialiasing for Courier New, but enables antialiasing if the text size (for any font) is less than 13 or greater than 16. I found that for text outside of that size range, the aliased font doesn't look so good. You may disagree.

This seems to work, but I don't understand fontconfig all that well, so it may cause issues I'm unaware of.

HuggieBo commented 1 year ago

Youre the absolute GOAT. Thank you so much also thanks for the help with the aliased fonts

Tested and it works. I want to write a script which Download the newest release and changes the bug and I would like to add functionality so that it automatically adds it to steam. I currently have just the download part but its still a nice time saver. https://github.com/HuggieBo/UHSC-Steam-Deck/tree/main

wispii commented 1 year ago
  module.exports = require(`../build/Release/sharp-linux-x64.node`);

This method also worked for me :D If it's okay, I would like to post this information to the homestuck subreddit to hopefully help more people get UHSC to work on their steam decks.