obhq / obliteration

Experimental free and open-source PlayStation 4 kernel
https://obliteration.net
Apache License 2.0
623 stars 17 forks source link

Couldn't open systemfolder as a root directory. #746

Closed VocalFan closed 6 months ago

VocalFan commented 6 months ago

When trying to run a game, I immediately get this error:

++++++++++++++++++ I [00:00:00:00:001]:0x0000000000000c38: kernel\src/main.rs:125
Starting Obliteration Kernel.
System directory    : D:\obSTORAGE\dev_sys
Game directory      : D:\obSTORAGE\dev_hdd0\CUSA04518
Debug dump directory: C:\Users\ghost\AppData\Local\OBHQ\Obliteration\kernel
Application Title   : Hatsune Miku: Project DIVA X
Application ID      : CUSA04518
Application Category: gd
Application Version : 01.00
Operating System    : Windows 11 Pro 22631
CPU Information     : AMD Ryzen 9 5900X 12-Core Processor            
Memory Available    : 19945/32678 MB
Pro mode            : false
++++++++++++++++++ E [00:00:00:00:198]:0x0000000000000c38: kernel\src/main.rs:629
Error while running kernel: filesystem initialization failed -> cannot mount rootfs -> cannot mount the filesystem -> couldn't open D:\obSTORAGE\dev_sys as a root directory -> The specified path is invalid. (os error 161)

Which this folder does exist, and was filled with the FTP wizard from my PS4:

image

SuchAFuriousDeath commented 6 months ago

As I pointed out in DMs, this seems to be caused by an incorrect conversion from &Path into UNICODE_STRING. I could fix it but it's probably best that someone with Windows does it so they can verify that it actually works.

ultimaweapon commented 6 months ago

As I pointed out in DMs, this seems to be caused by an incorrect conversion from &Path into UNICODE_STRING. I could fix it but it's probably best that someone with Windows does it so they can verify that it actually works.

We have unit tests enabled in the CI. It was designed for this kind of case so you can test your code on other platforms.

SuchAFuriousDeath commented 6 months ago

I didn't think of that, thanks.

VocalFan commented 6 months ago

As I pointed out in DMs, this seems to be caused by an incorrect conversion from &Path into UNICODE_STRING. I could fix it but it's probably best that someone with Windows does it so they can verify that it actually works.

We have unit tests enabled in the CI. It was designed for this kind of case so you can test your code on other platforms.

To be fair, this been for like a month... Just only an actual concern for me since we're past this on Linux-

VocalFan commented 6 months ago

If anybody wishes to try to correct this, I'll test it.

VocalFan commented 6 months ago

@ultimaweapon Tried Process Monitor...

image It checks the game's param.sfo ^

image But never accesses the system folder.

I did check before and after the UNICODE conversion.

Before: D:\\obSTORAGE\\dev_sys After: D:\obSTORAGE\dev_sys

So it seems like it SHOULD try the path... But just errors?

VocalFan commented 6 months ago

Not a permission issue, just used fs::read_dir to read the folder in a fresh rust project.

VocalFan commented 6 months ago

@ultimaweapon I figured it out. You have to append \\??\\ to the start of the path. \\??\\D:\obSTORAGE\dev_sys

According to microsoft documentation: image

ultimaweapon commented 6 months ago

@ultimaweapon I figured it out. You have to append \\??\\ to the start of the path. \\??\\D:\obSTORAGE\dev_sys

According to microsoft documentation: image

Nice finding.

VocalFan commented 6 months ago

@ultimaweapon You can probably do a much less hacky implementation, if you do, I'll test and merge.

        let mut path_str = String::from("\\??\\");
        path_str.push_str(path.as_ref().to_str().unwrap());
        let path = std::path::Path::new(&path_str);

Literally what I did lol

VocalFan commented 6 months ago

@ultimaweapon Alright, this is... Half done. We still need raw_mkdir. Which I just... Kinda gave up on doing myself.

ultimaweapon commented 6 months ago

That one should be a separated issue.