mmozeiko / pkgi

pkg download & installation directly on Vita
The Unlicense
247 stars 162 forks source link

(Request) Check for pkgi in ur0 #32

Closed protectivedad closed 6 years ago

protectivedad commented 6 years ago

I'm trying to detach as much as possible from the ux0. It would be great if in pkgi_get_pkgi_folder you can add the logic to check for ur0:pkgi and return that if it exists. I don't have a Vita compile env setup or I'd provide the code.

I have to say great code. It shows how well it was written that a feature can be added with only a few lines of extra code.

Of course you use that for temp storage also. Didn't think of that till later.

mmozeiko commented 6 years ago

pkgi uses ux0:pkgi folder to store downloaded files before installation. Are you sure you want this to be on ur0? Afaik ur0 is very small partition and you won't be able to download larger games.

protectivedad commented 6 years ago

No, it was only later that I realized the same function was used for both temp and config files. The only way it would work would be to split the temp files function from the config files function and use the ur0 for the config files only. Create a pkgi_get_temp_folder function using only ux0 and make the pkgi_get_pkgi_folder function use ur0 if it exists and fall back to ux0 if it doesn't.

MarioMasta64 commented 6 years ago

1.5gb and only on slim :( i mostly only put vitashell and important programs there.

protectivedad commented 6 years ago

On which ur0 or ux0? My rational for it is that pkgi is a program for installing packages on cards and I am duplicating the config file across my VIta card and multiple SD cards (one for each of my kids). When something so essential should IMHO have only one config file, but if the ur0 pkgi config file doesn't exist, it uses a card specific one.

Or maybe it would be better the other way around. Search for a card specific pkgi config file if it exists use it and fall back to a system one if not. That would give the most flexibility, and splitting the temp functionality from the config would make implementing it fairly easy.

MarioMasta64 commented 6 years ago

afaik if pkgi is on ur0 it seems to look for its stuff in ur0:pkgi/

protectivedad commented 6 years ago

I don't think so, I'm considering the config file(s) include the pkgi.txt (db file) and config.txt file. From the code (pkgi_get_pkgi_folder) is only used in a few places (config, db, and resume). The first two are small files which tell the program what to do. The resume (or temp) is something that is generated by the program and is (or can be) rather large.

I don't have a slim model, but on the fat one I have the ur0 has enough space to hold a config and db files with no issues (2.55 GB total and only 27.75 MB is currently used). Though I wouldn't want the temp files going there.

fennectech commented 6 years ago

We could easily put he config files and pkgi.txt on ur0. We could also install the application to ur0. That is if they haven’t hardcoded the file names in this app. Resumes and such should be done on ux0 as your not going to need them on ur0 at all. Resumes dont need to survive a card swap because installs cant be started on one card and completed on another. Volital files belong on ux0 but not having to manage multiple config.txts i could see a case for this. So multiple pkgi folders would make sense. One on ux0 for resumes and temp downloads. And one on ur0 for pkgi.txt and config.txt. These files are never going to grow past a few megabytes so space doesn’t mater (even oled vitas have about 2.5 gb free space on ur0. Plus putting temp files on ur0 adds extra writes. That are not needed. A file is written to a card a total of twice. Once to the temp file. And then twice for decapsulating it. The files are written to ux0/pkgi and then relocated logically without having to actually re write the file to flash. The file system is updated only which reduces wear on these cards. (Flash is a finite resource so you need to minimize writes where possible. ). (By that i mean it can only be written a certain number of times before its used up. So each extra write is in a sense using up life of the flash. Especially for the Devices internal flash which cannot be replaced. Once that is worn out. You replace your vita. ).

mmozeiko commented 6 years ago

Ok, I implemented check for ur0:pkgi folder on startup. If this folder exists, then it will be used for config.txt and pkgi.txt. All other files for download/resuming will be still downloaded in ux0:pkgi.

If ur0:pkgi folder does not exist, then pkgi will use ux0:pkgi same as before.