# rules.txt contains information about the graphic pack, the games it is applied to and one or multiple rules that can modify texture properties.
# Everything after a '#' character is considered a comment.
# Note: While not necessary, knowledge about engines, rendering concepts, graphic effects etc. is helpful when trying to create your own graphic packs.


[Definition]
titleIds = 0005000011111111,0005000022222222 # List of one or multiple titleIds (unique game indentifier) which are used to determine for which games this pack is active
name = "Example pack name" # Name which appears in Cemu's "Graphic packs" window. We recommend a "gamename - effect" style naming scheme. E.g. "Mario Kart 8 - 1080p resolution"
version = 2 # Version 2 is used since Cemu 1.8.0 and must always be set

[Control]
vsyncFrequency = 60 # Set the vsync frequency to any arbitrary value (default is 60)
# The [Control] section is optional and can be skipped

# After the [Definition] or [Control] section multiple texture rules can follow. Currently there is only one type of rule supported, called 'TextureRedefine'. Below is a description of what it does and how it works.

# TextureRedefine:
# This rule type can be used to overwrite certain texture properties, like the resolution or format.
# There are two parts to each 'TextureRedefine' rule:
# The filter settings: The rule will only apply to textures when the original texture properties match the values given by the filter settings.
# The overwrite settings: If a texture matches the filter, these properties are applied.
# The idea is that via these rules you can tell Cemu which textures to modify and how to modify them.
# Note that texture rules are applied upon creation of the texture. Multiple rules can apply to the same textures as long as they don't interfere with each other (e.g. it's ok to have one rule to set the width/height and another rule to set the format)

[TextureRedefine] # <-- Rule type
# filter:
width = 1280
height = 720
formats = 0x20,0x1A # Texture format must match any of these ('0x' prefix denotes hexadecimal format, can contain multiple formats separated by comma)
#formatsExcluded = 0x31,0x32,0x33,0x34,0x35 #  
tilemodes = 4 # Allowed tilemodes. Similar to format parameter, can contain multiple entries.
# tilemodesExcluded = 1 # Allows all but these tilemodes.

# If any of the filter settings above are omitted they are not evaluated. This allows you to write a rule that, for example, only filters for the width of a texture but not the height.

# overwrite with:
overwriteWidth = 1920
overwriteHeight = 1080
overwriteFormat = 0x1A # new texture format
# Like filter settings you can omit individual overwrite settings. This allows to selectively overwrite the width but not the height etc.


# Common use case example:
# Many games run in 1280x720 resolution and we would like to use a textureRule to upscale those games to 1920x1080
# Here is how it would look:
[TextureRedefine]
width = 1280
height = 720
overwriteWidth = 1920
overwriteHeight = 1080
tilemodesExclude = 1
# This rule applies to all textures that have a resolution of 1280x720 and overwrites their resolution to be 1920x1080.
# The tileModes exclude filter furthermore makes sure that we skip CPU-generated textures like video frames (tileMode 1 is a strong indicator for direct CPU access to a texture)
# Depending on the game, this might suffice for simple upscaling. However, since the filter settings in this example are very loose (only width and height is checked) the rule might catch unwanted textures. Some games use background or splash screen textures that have the same resolution as the intended screen resolution. Since Cemu resets the contents of a texture if any rule is applied, you would end up with a black background. A workaround for this is to use the texture dump feature of Cemu and figure out more exact filters.


List of all texture formats:
R8_UNORM              0x00000001
R8_UINT               0x00000101
R8_SNORM              0x00000201
R8_SINT               0x00000301
R4_G4_UNORM           0x00000002
R16_UNORM             0x00000005
R16_UINT              0x00000105
R16_SNORM             0x00000205
R16_SINT              0x00000305
R16_FLOAT             0x00000806
R8_G8_UNORM           0x00000007
R8_G8_UINT            0x00000107
R8_G8_SNORM           0x00000207
R8_G8_SINT            0x00000307
R5_G6_B5_UNORM        0x00000008
R5_G5_B5_A1_UNORM     0x0000000a
R4_G4_B4_A4_UNORM     0x0000000b
A1_B5_G5_R5_UNORM     0x0000000c
R32_UINT              0x0000010d
R32_SINT              0x0000030d
R32_FLOAT             0x0000080e
R16_G16_UNORM         0x0000000f
R16_G16_UINT          0x0000010f
R16_G16_SNORM         0x0000020f
R16_G16_SINT          0x0000030f
R16_G16_FLOAT         0x00000810
D24_S8_UNORM          0x00000011
X24_G8_UINT           0x00000111
D24_S8_FLOAT          0x00000811
R11_G11_B10_FLOAT     0x00000816
R10_G10_B10_A2_UNORM  0x00000019
R10_G10_B10_A2_UINT   0x00000119
R10_G10_B10_A2_SNORM  0x00000219
R10_G10_B10_A2_SINT   0x00000319
R10_G10_B10_A2_SRGB   0x00000419
R8_G8_B8_A8_UNORM     0x0000001a
R8_G8_B8_A8_UINT      0x0000011a
R8_G8_B8_A8_SNORM     0x0000021a
R8_G8_B8_A8_SINT      0x0000031a
R8_G8_B8_A8_SRGB      0x0000041a
A2_B10_G10_R10_UNORM  0x0000001b
A2_B10_G10_R10_UINT   0x0000011b
D32_FLOAT_S8_UINT_X24 0x0000081c
X32_G8_UINT_X24       0x0000011c
R32_G32_UINT          0x0000011d
R32_G32_SINT          0x0000031d
R32_G32_FLOAT         0x0000081e
R16_G16_B16_A16_UNORM 0x0000001f
R16_G16_B16_A16_UINT  0x0000011f
R16_G16_B16_A16_SNORM 0x0000021f
R16_G16_B16_A16_SINT  0x0000031f
R16_G16_B16_A16_FLOAT 0x00000820
R32_G32_B32_A32_UINT  0x00000122
R32_G32_B32_A32_SINT  0x00000322
R32_G32_B32_A32_FLOAT 0x00000823
BC1_UNORM             0x00000031
BC1_SRGB              0x00000431
BC2_UNORM             0x00000032
BC2_SRGB              0x00000432
BC3_UNORM             0x00000033
BC3_SRGB              0x00000433
BC4_UNORM             0x00000034
BC4_SNORM             0x00000234
BC5_UNORM             0x00000035
BC5_SNORM             0x00000235