GreemDev / Ryujinx

Experimental Switch emulator written in C#
MIT License
5.35k stars 431 forks source link

[Feature Request] Implementation of custom textures #78

Open OutrageousCyberpunk opened 1 month ago

OutrageousCyberpunk commented 1 month ago

Overview

Some custom versions of Ryujinx had the option to exchange the game's textures for modified textures. It would be nice to have this function enabled in an updated version of Ryujinx.

Smaller details

.

Nature of request

Allow modified versions of the games.

Why would this feature be useful?

There is a community very dedicated to modifying and improving games visually, for example the Skyward Sword HD game has a completely retextured version, but it cannot be run on updated versions of Ryujinx.

extherian commented 1 month ago

I compiled the Ryujinx-NX branch with the texture replacement code, but it doesn't seem to have anything I can click on in the GUI to add them. Could you explain how this is supposed to work? Or is there some other branch out there with appropriate UI changes?

OutrageousCyberpunk commented 1 month ago

I compiled the Ryujinx-NX branch with the texture replacement code, but it doesn't seem to have anything I can click on in the GUI to add them. Could you explain how this is supposed to work? Or is there some other branch out there with appropriate UI changes?I

There is a guide showing how it should work. But I believe that the branches are no longer available, although some changes were previously made for this purpose.

Anyway, the first image of the guide shows where the commands should be in the interface.

extherian commented 1 month ago

Please note that since these are all Google Drive links, you will need to be signed into your Google Account to view them.

The option to load the texture pack is here in the Ryujinx interface:

Screenshot 2024-10-28 105414

Click here for a windows version of the texture replacement build.

Click here for a linux version of the texture replacement build.

Unfortunately I deleted the Linux VM that I was using to put AppImages together by mistake so for now there is no AppImage version, sorry Steam Deck users.

@GreemDev as with the Sparse JIT build, this will have to be manually merged upstream, since it's based on an old GTK build of Ryujinx.

cheezwiz789 commented 1 month ago

I tested this build with Henriko Magnifico's Skyward Sword HD pack. It seems to load the replacement textures fine. Some screenshots with the replacement textures loaded: image image image

Here are similar shots in the same locations that obviously do not load the texture replacements on the released 1.2.59: image image image

I haven't played long... but the first few minutes of the game seem to be running fine. Smooth at 60fps. I'll play some more and report back if I have any issues.

For reference: OS: Windows 11 CPU: AMD 7940HS GPU: NVIDIA 4080 RTX (driver 565.90)

One other item of note: The mod manager doesn't see the texture pack mod. That might need some fixing.

k-carbonatedtea commented 1 month ago

YUZU BOTW HD textures c3124ceb222d37e31e71ab6afc928227 Ryujinx no HD textures 8e9168e4d7ab6668ebc0b53373af7a7e Ryujinx HD textures It cannot run

MOD:https://gamebanana.com/mods/478224

OS: Windows 11 24h2 CPU: Inter 14700KF RAM: 48G GPU1: NVIDIA 2080Ti GPU2:AMD 6800XT

OutrageousCyberpunk commented 1 month ago

Skyward Sword HD

Without custom textures: ss2x

Henriko Magnifico's Skyward Sword HD: ss2

It's working fine here. Thank you guys.

OutrageousCyberpunk commented 1 month ago

YUZU BOTW HD textures ! Ryujinx HD textures It cannot run

MOD:https://gamebanana.com/mods/478224

OS: Windows 11 24h2 CPU: Inter 14700KF RAM: 48G GPU1: NVIDIA 2080Ti GPU2:AMD 6800XT

I tested this Breath of the Wild mod, but it is not in the format stipulated by the guide for it to work on Ryujinx. The modder will have to make the adjustments, saving all textures in PNG.

cheezwiz789 commented 1 month ago

The png files could be extracted from the BOTW HD pack to png… with the likes of switch toolbox but the names will not be correct for this replacer function to know when to grab what file…

So yeah, the botw hd pack will not work in its current state.

Pmason1999 commented 4 weeks ago

Concept Plan for Implementation:

  1. Intercepting rendering pipelines
  2. Create a unique identifier for each texture like a hash
  3. Dump textures in .png format to the Textures/Dump/ directory in the root folder of Ryujinx.
  4. Replace in-game textures with either .png or .dds files from Textures/Replace/, prioritizing .dds files.
  5. Game-Specific Toggle for Texture Replacement: Enable/disable texture replacement via a game-specific checkbox in the Ryujinx UI when right-clicking a game.
Pmason1999 commented 4 weeks ago

[Bug] Unreesponsive 381837203-8d860e9d-2a26-4f19-afc9-f73523260f17

Ryujinx becomes unable to respond or crashes upon launching of any title with the config shown in the Log File both GraphicsBackends Unresponsive.

Log file 00:00:00.079 |I| Configuration LogValueChange: ResScale set to: 3 00:00:00.080 |I| Configuration LogValueChange: ResScaleCustom set to: 1 00:00:00.080 |I| Configuration LogValueChange: MaxAnisotropy set to: -1 00:00:00.081 |I| Configuration LogValueChange: AspectRatio set to: Fixed16x9 00:00:00.081 |I| Configuration LogValueChange: TexturesDumpFileFormat set to: Png 00:00:00.081 |I| Configuration LogValueChange: EnableTextureDump set to: True 00:00:00.081 |I| Configuration LogValueChange: EnableTextureRealTimeEdit set to: False 00:00:00.082 |I| Configuration LogValueChange: BackendThreading set to: Auto 00:00:00.082 |I| Configuration LogValueChange: GraphicsBackend set to: Vulkan 00:00:00.082 |I| Configuration LogValueChange: PreferredGpu set to: 0x10DE_0x2208 00:00:00.083 |I| Configuration LogValueChange: AntiAliasing set to: None 00:00:00.083 |I| Configuration LogValueChange: ScalingFilter set to: Bilinear 00:00:00.083 |I| Configuration LogValueChange: ScalingFilterLevel set to: 80 00:00:00.084 |I| Configuration LogValueChange: EnableDockedMode set to: True 00:00:00.088 |I| Configuration LogValueChange: EnableVsync set to: True 00:00:00.088 |I| Configuration LogValueChange: EnableShaderCache set to: True 00:00:00.088 |I| Configuration LogValueChange: EnableTextureRecompression set to: True 00:00:00.088 |I| Configuration LogValueChange: EnableMacroHLE set to: True 00:00:00.088 |I| Configuration LogValueChange: EnableColorSpacePassthrough set to: False 00:00:00.088 |I| Configuration LogValueChange: EnablePtc set to: True 00:00:00.088 |I| Configuration LogValueChange: EnableInternetAccess set to: False 00:00:00.088 |I| Configuration LogValueChange: EnableFsIntegrityChecks set to: True 00:00:00.088 |I| Configuration LogValueChange: FsGlobalAccessLogMode set to: 0 00:00:00.088 |I| Configuration LogValueChange: AudioBackend set to: SDL2 00:00:00.088 |I| Configuration LogValueChange: AudioVolume set to: 1 00:00:00.089 |I| Configuration LogValueChange: MemoryManagerMode set to: HostMappedUnsafe 00:00:00.089 |I| Configuration LogValueChange: ExpandRam set to: False 00:00:00.089 |I| Configuration LogValueChange: IgnoreMissingServices set to: False 00:00:00.089 |I| Configuration LogValueChange: UseHypervisor set to: True 00:00:00.091 |I| Configuration LogValueChange: MultiplayerMode set to: LdnMitm 00:00:00.097 |N| Application PrintSystemInfo: Ryujinx Version: 1.0.0-dirty+8a92df8611adf42778e403456c3edacd161ad889 00:00:00.098 |N| Application Print: Operating System: Microsoft Windows 10.0.22631 (X64) 00:00:00.098 |N| Application Print: CPU: AMD Ryzen 9 7900X 12-Core Processor ; 24 logical 00:00:00.099 |N| Application Print: RAM: Total 31.2 GiB ; Available 10.5 GiB 00:00:00.100 |N| Application PrintSystemInfo: Logs Enabled: Info, Warning, Error, Guest, Stub 00:00:00.100 |N| Application PrintSystemInfo: Launch Mode: UserProfile 00:00:20.325 |I| Configuration LogValueChange: GraphicsBackend set to: OpenGl OS

Windows 11 Pro Ryujinx version

Ryujinx 1.0.0-dirty+8a92df8611adf42778e403456c3edacd161ad889 Game version

1.0.0 CPU

AMD Ryzen 9 7900X 12-Core Processor GPU

NVIDIA GeForce RTX 3080 Ti RAM

32GB

cheezwiz789 commented 4 weeks ago

Concept Plan for Implementation:

1. Intercepting rendering pipelines

2. Create a unique identifier for each texture like a hash

3. Dump textures in .png format to the Textures/Dump/ directory in the root folder of Ryujinx.

4. Replace in-game textures with either .png or .dds files from Textures/Replace/, prioritizing .dds files.

5. Game-Specific Toggle for Texture Replacement: Enable/disable texture replacement via a game-specific checkbox in the Ryujinx UI when right-clicking a game.

It pretty much works like this already... except for the game specific config, because there isn't game specific config other than the mod manager yet. It would be nice to be able to turn the mod on and off like a regular mod though. No texture replacement happens if no suitable textures are in the "textures" mod as described in the guide linked above.

extherian commented 4 weeks ago

Here is a build of GreemDev's fork with texture replacement added for Windows, made by cheezwiz789.

Here is a build of GreemDev's fork with texture replacement added for Linux, made by cheezwiz789.

Note that texture replacement is unlikely to be merged in its current form, these are provided for user convenience and testing only.

Pmason1999 commented 4 weeks ago

Luigi’s Mansion 2 HD_2024-10-31_03-56-22 Luigi’s Mansion 2 HD_2024-10-31_03-55-56 Luigi’s Mansion 2 HD_2024-10-31_03-56-02 I love it so far after figuring out how it works. However, the replacement texture location could be improved, as it’s a bit wonky. When converting PNGs to DDS with the DXT5 Alpha option using the DDS Converter 1.4 tool, the textures sometimes become distorted and show artifacts. I’ve used this tool for PS2 texture replacement before without issues, but that was with PCSX2. The same issue also occurs if textures are stored within sub-folders—this isn’t necessarily a problem if you don’t plan on organizing—but it also happens if all necessary associated mipmaps aren’t edited to the correct scale. Luigi’s Mansion 2 HD_2024-10-31_04-14-57 Luigi’s Mansion 2 HD_2024-10-31_04-14-50

cheezwiz789 commented 3 weeks ago

A couple more hours in on using my build to play Henriko’s SSHD pack… no problems so far.

Pmason1999 commented 3 weeks ago

Can you please make a appimage I would like to try getting this working on batocera

extherian commented 3 weeks ago

Here is a build of GreemDev's fork with texture replacement added in AppImage format, made by cheezwiz789.

Pmason1999 commented 3 weeks ago

Here is a build of GreemDev's fork with texture replacement added in AppImage format, made by cheezwiz789.

Is this appimage the most recent build of this fork? It looks like it is missing somethings.

GabCoolDude commented 3 weeks ago

Is this appimage the most recent build of this fork? It looks like it is missing somethings.

That build doesn't get updated automatically, so it's possible it may have things missing.

cheezwiz789 commented 3 weeks ago

Here are updated builds of both the replacement version and the dumping only version. These are based on the latest Greem fork version.

Per Greem, the replacement version is not likely to get merged any time soon. It is included, because it is basically the same as what gdkchan implemented, but with adjustments to adapt to the latest changes in the Greem fork. (gui/config changes/class consolidation)

The dumping only version is the same, except the real-time texture replacement function is removed, the loading of files in to memory as the game is running is removed, and the modloader no longer looks for the "textures" folder in the mod folder during the loading sequence.

This should be plenty good for testing... so don't expect updates to these any time soon.

https://www.mediafire.com/file/v5wxbg5htz56f70/texture_replacement_testing_11-3-24.zip/file

cheezwiz789 commented 3 weeks ago

Also, just a reminder, no support will be offered by the ryujinx folks on custom builds. This is for testing... not mainstream use if you happen upon this and don't know what you're doing.

cheezwiz789 commented 3 weeks ago

I am aware that the dumping only build indiscriminately dumps all textures and overwrites the ones previously placed in the folder.

I’ll fix that, so that it won’t re-dump the ones that are already dumped… more like the replacement build works.

maybe tomorrow. 😐

Bentheminernz commented 3 weeks ago

Please note that since these are all Google Drive links, you will need to be signed into your Google Account to view them.

The option to load the texture pack is here in the Ryujinx interface:

Screenshot 2024-10-28 105414

Click here for a windows version of the texture replacement build.

Click here for a linux version of the texture replacement build.

Unfortunately I deleted the Linux VM that I was using to put AppImages together by mistake so for now there is no AppImage version, sorry Steam Deck users.

@GreemDev as with the Sparse JIT build, this will have to be manually merged upstream, since it's based on an old GTK build of Ryujinx.

Is a macOS build for this possible?

extherian commented 3 weeks ago

I don't have a mac, unfortunately, and there's no way to compile software for mac on windows. If you want to try compiling it yourself for your own use, please visit the discord and ask for help on how to do so.

cheezwiz789 commented 3 weeks ago

New test builds: https://www.mediafire.com/folder/dgm1gci671kqu/texture+replacement+testing+11-4-24 This time, not all in one zip file... so you can pick and choose which one you want to download.

I have no way to test that macOS build... so... good luck with that.

Both branches: rebased on Greem's latest fork as of now

Texture replacement branch: If you have a "textures" folder in the mod location (or in a folder in the mod location), as described in the guide, the per-game mod manager will recognize it, list it with the mods, and let you enable and disable it as you would a regular mod.

Dumping only branch: Now doesn't just overwrite every single file for every single texture it encounters for every single run of the game. If there's an existing file, the console with print an ioerror, and move on. So, if you were not happy about getting your files overwritten in the dump folder, you can be happy again.

OutrageousCyberpunk commented 3 weeks ago

I played Skyward Sword until the end, and everything worked correctly.

Pmason1999 commented 3 weeks ago

Luigi’s Mansion 2 HD_2024-11-05_06-38-04 Luigi’s Mansion 2 HD_2024-11-04_05-34-12 Finished my first texture mod nothing weird to report yet.

Pmason1999 commented 3 weeks ago

a good tool for DDS https://developer.nvidia.com/texture-tools-exporter

Tagger102 commented 2 weeks ago

Works great using Skyward Sword textures. Can't wait for this to be merged to the main builds!

GreemDev commented 2 weeks ago

Works great using Skyward Sword textures. Can't wait for this to be merged to the main builds!

Spoiler: It won't be