pizzaboxer / bloxstrap

An alternative bootstrapper for Roblox with a bunch of extra features.
MIT License
1.41k stars 224 forks source link

Feature Request - Shader Patching #399

Closed MaximumADHD closed 4 months ago

MaximumADHD commented 11 months ago

This is a theoretical idea that will depend on how flexible Roblox’s shader pack files are.

Since Roblox won’t provide us with discrete graphics options, it might be possible to hack in our own by patching the shader pack pointers to specific quality levels. More investigation will be needed, but I have a functional reader in my client tracker:

https://github.com/MaximumADHD/RCT-Source/blob/main/src/Shaders/ShaderPack.cs https://github.com/MaximumADHD/RCT-Source/blob/main/src/Shaders/ShaderFile.cs

pizzaboxer commented 11 months ago

Oh, that's a really interesting idea. I didn't even know that there was an attempt made to decipher and document the shader pack format. You mentioned patching the shader pack pointers to specific quality levels? Are you thinking more about decompiling shader packs, modifying them, and then rebuilding them?

MaximumADHD commented 11 months ago

I don’t think rebuilding is feasible unless the HLSL shaders are decompiled.

In the header for each shader there’s an Offset and Size into the *.pack file where the compiled shader is read.

The idea is that maybe it’s safe to point specific high quality shaders at their lower quality variants. It’ll require the hash checksums to be changed (including at the root level) but otherwise would allow discrete quality level modifications?

It’s evidently very complicated and will require more research and experimenting for me to even prove it’s viable. But I think it’d be really damn cool if it’s possible to accomplish.

pizzaboxer commented 11 months ago

but otherwise would allow discrete quality level modifications

Okay, now I see what you're trying to accomplish. I don't see why it wouldn't be possible, unless the hash checksums somehow manage to get in the way. I'll have take some time looking into the format to see how it all works comprehensively and stuff, especially seeing what areas are checksummed specifically.

I was originally thinking more about modifying the shader packs to allow for loading of custom shaders. Sure, HLSL-compiled shaders wouldn't be able to accomplish that, but OpenGL shaders could. Not for any practical reason because it's only OpenGL, just to see what's possible and what can be done.

pizzaboxer commented 11 months ago

Another thing I'm thinking about - do we have a way of hot reloading shaders, or are we just going to have to deal with restarting the game client every time?

MaximumADHD commented 11 months ago

Don’t think they can be hot reloaded as far as I’m aware.

bluepilledgreat commented 4 months ago

I can see this being used for malicious purposes.