jam1garner/cargo-skyline

Implementation ideas for ``cargo skyline emu``

Opened this issue · 0 comments

As discussed in DMs, here's a draft of what would be needed and broad ideas for how process should unfold:

  • Locating Ryujinx
    Considering Ryujinx can only be downloaded as an archive on the official website (afaik), there isn't much choice but to ask the user for the location of the software on their system. However, we could try calling the process by expecting it to be in the PATH environment variable, and then ask if it isn't.
  • Locating the game
    Similarly, we can't assume the path for the NSP or even the filename, so we can only ask the user for the full path.
    One thing that could be interesting is having a env variable pointing to the location of the user's NSPs and look for the a nsp with the titleid from cargo.toml in the filename and assume it is the correct one.
    Considering the NSP to boot will be different for each game you're trying to mod, a way to configure this on a plugin basis would be optimal (cargo.toml metadata?).
  • Installing Skyline and the plugin
    Copying the files must be done in the sdcard and mods directories and can be located in different places depending on Ryujinx's boot mode:
    • Normal: the path is always %appdata%\Ryujinx\
    • Portable: the sdcard and mods directories are located in the same place as the executable (needs verification)

Storing the paths could be done the same way the IP is stored for cargo install.

As for the cargo skyline emu flow, probably something such as:

  1. Check if the Ryujinx path is configured.
    • ⭕ Proceed.
    • ❌ Either prompt the user for it (abort if they don't provide the expected path) or just abort with a help message on how to configure it.
  2. Check if the game's NSP can be found.
  • First, check if the path for the NSP is configured (project-specific configuration/cargo.toml metadata).
    • ⭕ Does the file actually exist (the user could've moved or renamed it?)
      • ⭕ Proceed
      • ❌ Abort with help message/Ask for the NSP's path and configure on the spot.
    • ❌ Check for the environment variable for the NSP directory. Does it exists?
      • ⭕ Read every entry in the directory, check if a filename had a nsp extension and the file stem container the titleid. If not, abort with help message.
      • ❌ Abort with help message/Ask for the NSP's path and configure on the spot.
  1. Reproduce the cargo run process but with cargo install dropping the files in the correct place instead of FTPing them. The IP should be set to 0.0.0.0 for the logger.
  2. Run the Ryujinx executable and pass the NSP's path as the first argument to immediately boot into it.

I'm obviously missing a few edge cases here, so feel free to suggest changes.