pcsx2
pcsx2 copied to clipboard
[Feature Request]: HostFS create folders
Description
HostFS when a path contains multiple folders like data/scene
cannot create folders and would look to the user to manually create the folder structure themselves.
Would be a nice convenience feature to have HostFS auto create the missing folder structure
Reason
- How will it make things easier for you?: Able to save files from HostFS on the fly without having to first manually check folder structure exists and create it if it does not.
- How does this feature help your enjoyment of the emulator?: Able to use game debug features easier
- What does it provide that isn't being provided currently? The ability to auto-make missing folders
Examples
Most programs like video games with a hard-coded path with an external data folder, IE. Skyrim,
Why would you not just mkdir()
on the PS2 side? Or does that not work?
Homebrew you probably could? Though I've no clue if it'd work or not. I have a debug copy of a game I've been slowly helping with reverse engineering on. It has the ability to save files in its debug menu scene viewer. Seems, it doesn't have a mkdir call or if it does it didn't make it through pcsx2 HostFS layer at least
I feel like a better solution would be to just log failed hostfs opens.
And that's a fair option as well. I guess the crux of this request is to have more inbuilt feedback from HostFS. Auto folder creation would be more convenient but even just more messaging feedback would be a benifit
I'm opposed to it because I feel like it's adding more complexity to something that should be a thin HLE wrapper. Currently, we don't know why the open fails, we just pass an error code back to the guest. So now you'd have to know why it failed, possibly iterate through the path and see if the directories exists and then if not, pass the path to create_directories(const std::filesystem::path&). Also, I don't believe the aforementioned function is currently implemented by whatever filesystem implementation we use now.
! I'm not opposed to more logging, if that wasn't clear.
I did write a recursive directory creator. But I still don't think it's appropriate here - there's potential for a misbehaving elf to accidentally create a ton of subdirectories, plus the aforementioned complexity issue.
Logging failed host file opens would be trivial and fine.