hrydgard / ppsspp

A PSP emulator for Android, Windows, Mac and Linux, written in C++. Want to contribute? Join us on Discord at https://discord.gg/5NJB6dD or just send pull requests / issues. For discussion use the forums at forums.ppsspp.org.
https://www.ppsspp.org
Other
11.02k stars 2.15k forks source link

Texture Replacement - Usability Improvements for End Users #17149

Open superostrich opened 1 year ago

superostrich commented 1 year ago

What should happen

Recently PPSSPP began copying texture pack zip files to each game's texture folder, rather than extracting.

This makes things more difficult for end users who wish to customize or replace individual textures in said packs. It would be useful for end-users to be able to install their own textures without editing the .zip file.

One way would be to look for textures in the same paths defined in textures.ini, but outside the zip, and load those.

Example;

textures.ini (in the zip) contains;

0000000042af8dc290a08a75 = aircraft/plane1.ktx2

and textures.zip contains;

\aircraft\plane1.ktx2

and the game's textures folder contains;

\aircraft\plane1.png

PPSSPP would replace 0000000042af8dc290a08a75 with ppsspp\memstick\PSP\TEXTURES\ULUS10000\aircraft\plane1.png since it would prioritize files outside the zip (where the name and patch match a file in textures.ini).

This example allows for PNG files outside the textures.zip to be read. since it's unlikely the end user will be using .ktx2 or .dds

In this way, the end user could make modifications to their textures, with the added benefit that their customization would survive updates by texture pack authors.

Who would this benefit

This would primarily benefit end-users who install textures packs, and wish to customize them.

Platform (if relevant)

None

Games this would be useful in

Ace Combat, Ridge Racer, or any game where users may wish to customize a vehicle livery.

Other emulators or software with a similar feature

No response

Checklist

hrydgard commented 1 year ago

While yes, we did add zipped texture pack support, which performs a bit better on mobile and installs faster - we didn't remove support for unzipped texture packs! All you need to do is to unzip the zipped texture pack, and then edit it as normal.

I guess it could also be nice to override individual textures, but you can still do that by manually unzipping the pack first, so... worth the complexity? not sure...

superostrich commented 1 year ago

In my case, the texture packs I've published are semi modular, so in lieu of a baked-in solution, I'd be directing them to skip the zip-install and manually extract. Writing those instructions would be easy for windows users, however Android does not have a consistent method of dealing with archives, and poor filesystem management in general.

Perhaps pack authors could specify whether the .zip file should be copied or extracted in textures.ini?

extract = 0 ----> zip file is copied to textures folder extract = 1 ----> zip file is extracted to textures folder

Alternatively, maybe PPSSPP could just read any additional .ini file in each game's texture folder? That way a user, or texture pack add-on creator, could create a user.ini file that would allow replacement of additional textures, or override conflicting textures from textures.zip?

unknownbrackets commented 1 year ago

The problem is, checking if files exist or opening them is ridiculously, it's-a-joke slow on Android now. So checking for all the files individually, especially if most of them usually won't be there, will be a huge drain on performance - making textures load A LOT slower and increasing "pop-in". That's specially why zip packs are even used now - so that it only needs to open the single zip file once.

So for any of your users, if you're telling them to combine packs already, you really want to tell them to re-zip it if they're on Android. How bad the performance hit is depends on device and Android version, but it'll always help a lot.

If anything, when an extracted texture pack on Android is detected, it'd probably be ideal to show a message saying, "Inefficient horribly slow texture pack detected. Google has changed Android for security reasons to intentionally make accessing individual files extremely slow. Zip inefficient texture pack so HD textures show without significant pop-in delay? [Yes/No]"

-[Unknown]

superostrich commented 1 year ago

Right, that makes sense, I didn't realize Android filesystem access incurred such a large performance penalty. I agree, the published pack should stay zipped then.

From my experience, the most popular user-customized textures are player-character textures, which tend to be large 'hero' textures loaded at start of stage, not something that would cause pop-in stutter. Another common example are button prompts (XBox or PlayStation) which wouldn't be subject to pop-in stutter either.

Perhaps PPSSPP could load additional .zip files from the textures directory, each containing their own .ini file? (eg. user.zip, containing user.ini + texture files)

-and/or-

PPSSPP could read additional .ini files from the textures folder (eg. user.ini & texture files)

In either scenario if a hash conflict exists between textures.ini and user.ini; the files defined in user.ini would be loaded.

From a texture-pack publisher's POV this would preserve the user's files between pack updates, which is a desirable side effect.

superostrich commented 1 year ago

Thinking about this & testing; currently if there is a hash conflict in textures.ini (same hash points to two or more different textures), the one farther down the text file wins the conflict.

Maybe PPSSPP can be made to load multiple .zip files? Zip install would need retain the original filename when copying it to the game's TEXTURES folder (rather than rename to textures.zip) This would make it very easy for the end user to install & manage modular packs.

If we could load multiple zips, in alphabetical order, with last-loaded winning any conflicts, the user could simply name the files in their preferred loading order.

Example;

0-hd-texture-pack.zip 1-custom-effects.zip 2-xbox-buttons.zip 9-user.zip

In this scenario the 0-hd-texture-pack.zip could have a number of textures overridden by the packs that are loaded subsequently, with 9-user.zip being the last loaded, and therefore winning any conflicts.