Rinnegatamante / lpp-vita

Lua Player Plus for PSVITA. Documentation on: http://rinnegatamante.github.io/lpp-vita/
GNU General Public License v3.0
179 stars 27 forks source link

[Feature Request] SceIoStat functions #47

Open bb010g opened 4 years ago

bb010g commented 4 years ago

Functions that deal with file status (declared in VitaSDK's File Status Library, <psp2/io/stat.h>) are not exposed by LPP, specifically the functions dealing with SceIoStat: sceIoGetstat(), sceIoGetstatByFd(), sceIoChstat(), and sceIoChstatByFd(). (The ByFd variants would likely fold into LPP's handle interface, provided from functions like System.getFile).)

These functions are useful for implementing file managers at least.

Rinnegatamante commented 4 years ago

What fields in particular would you need from SceIoStat?

bb010g commented 4 years ago

Ideally? All of them. st_mtime, st_ctime, & st_atime are standard file system fields, st_size is being returned anyways from this call and useful, st_mode allows for making files visible to safe homebrew via the others octet (VitaShell removed that patch's functionality and doesn't let you change file permissions), and by now st_attr is probably worth carrying through too unless it's a huge footgun to modify? st_private looks reasonable to leave out, but I also don't know what it's used for ("Device-specific data.").

There's no way to get to these currently without either writing C or figuring out LuaJIT's FFI library, which makes me uncomfortable due to https://github.com/hyln9/vita-libdl/issues/1 being an open issue relating to void *symbol_lookup(char *module, char *symbol). (By the way, tossed lpp-vita's eboot_unsafe.bin.elf into Ghidra and am chasing down where https://pastebin.com/V615iLtj was coming from; see that issue.)

Rinnegatamante commented 4 years ago

is there an usage of sceIoChstat and/or doc about it? The only snippets i found about it are to fill an error on id.dat so that it gets regenerated.

bb010g commented 4 years ago

There's one linked in the VitaShell commit? As for documentation, VitaSDK's Doxygen seems to cover it pretty alright; Unix's chmod(2) is also pretty similar. https://manpage.me/index.cgi?q=chmod&sektion=2&manpath=OpenBSD+6.2

Rinnegatamante commented 3 years ago

Partially solved with https://github.com/Rinnegatamante/lpp-vita/commit/2fafdc870b3c689668d2401b0aae29d1ef16c55c