devkitPro / 3ds-hbmenu

The 3DS Homebrew Menu (∩ ͡° ͜ʖ ͡°)⊃━☆゚
705 stars 73 forks source link

Netbooted 3dsx has different working directory from manually run 3dsx #97

Open HyperDir opened 2 months ago

HyperDir commented 2 months ago

Bug Report

What's the issue you encountered?

When netbooting a .3dsx file, the current working directory seems to be set to SD root, whereas when running the .3dsx file from the SD, the working directory seems to be set to sdmc:/3ds.

I have made no changes to the devkitPro tooling.

How can the issue be reproduced?

  1. Create a basic 3DS console program.
  2. std::cout << std::filesystem::current_path() << std::endl;
  3. Launch program via hbmenu netloader and view output.
  4. Launch program from SD card via hbmenu and view output.

When netbooted, this prints "/", whereas when loaded from the SD card, it prints "sdmc:/3ds"

Environment?

Using an official Homebrew Launcher build (Rosalina 2.4.3). Building test 3dsx on Windows 11.

Additional context?

User piepie62 on the Nintendo Homebrew Discord said that netbooting "gives you the argv[0] of 3dslink:/your_3dsx_name". They also mentioned that it was originally meant to allow accessing remote files, but that this was never implemented so it just defaults to the SD root. If this means that this is intended behaviour, then this bug report can be closed.

WinterMute commented 5 days ago

You can netboot the .3dsx and add -0 to place the cwd of that file anywhere. If you want sdmc:/3ds as your cwd then -0 sdmc:/3ds/ should work. The intended use was to allow the developer to upload data files anywhere on sd card then access them as if the .3dsx was launched from that path. I did intend at some point to extend 3dslink with a file server but never found the time/motivation for it. I can update 3dslink to use the default upload path as default argv.