mirror of
https://github.com/cemu-project/cemu_graphic_packs.git
synced 2024-11-25 11:06:54 +01:00
[BotW] Fix fence methods
Accidentally budged up performance fence which would be active when it wasn't selected... Also added comments, so the code should be slightly easier to understand.
This commit is contained in:
parent
4aca768f40
commit
adb112620c
@ -2,84 +2,80 @@
|
||||
moduleMatches = 0x6267BFD0
|
||||
|
||||
# Code Cave
|
||||
#codeCaveSize = 0x50
|
||||
codeCaveSize = 0x50
|
||||
|
||||
# Fence Method Value
|
||||
#_fenceMethod = 0x0000000
|
||||
#0x0000000 = .int $fenceMethod
|
||||
_fenceMethod = 0x0000000
|
||||
0x0000000 = .int $fenceMethod
|
||||
|
||||
# Performance Fence method
|
||||
|
||||
#_conditionalPerformanceFence = 0x0000004
|
||||
#0x0000004 = lis r11, _fenceMethod@ha
|
||||
#0x0000008 = lwz r11, _fenceMethod@l(r11)
|
||||
#0x000000C = cmpwi r11, 1
|
||||
#0x0000010 = beq .+0x0C
|
||||
#0x0000014 = li r0, 1
|
||||
#0x0000018 = blr
|
||||
#0x000001C = lwz r0, 0x388(r31)
|
||||
#0x0000020 = blr
|
||||
_conditionalPerformanceFence = 0x0000004
|
||||
0x0000004 = lis r11, _fenceMethod@ha
|
||||
0x0000008 = lwz r11, _fenceMethod@l(r11) ; Load the fence method value
|
||||
0x000000C = cmpwi r11, 1 ; Compare the skip fence method with the fence method that's set, store comparison to the conditional register
|
||||
0x0000010 = bne .+0x0C ; If the conditional register isn't equel to the performance fence method, skip the next two instructions
|
||||
0x0000014 = li r0, 1 # Performance fence always set the fence skip value to 1
|
||||
0x0000018 = blr ; Return to the instruction that jumped to this part to the code cave
|
||||
0x000001C = lwz r0, 0x388(r31) ; Instruction that gets executed if performance fence isn't used, this is the original instruction.
|
||||
0x0000020 = blr ; Return to the instruction that jumped to this part to the code cave
|
||||
|
||||
# Accuracy and Skip Fence methods
|
||||
# Accurate and Skip Fence methods
|
||||
|
||||
#_conditionalAccuracyAndSkipFence = 0x0000024
|
||||
#0x0000024 = lis r5, _fenceMethod@ha
|
||||
#0x0000028 = lwz r11, _fenceMethod@l(r5)
|
||||
#0x000002C = cmpwi r11, 2
|
||||
#0x0000030 = li r5, 6
|
||||
#0x0000034 = add r6, r12, r0
|
||||
#0x0000038 = bne .+0x10
|
||||
#0x000003C = cmpwi r6, 500
|
||||
#0x0000040 = blt .+0x08
|
||||
#0x0000044 = subi r6, r6, 1
|
||||
#0x0000048 = cmpwi r11, 3
|
||||
#0x000004C = blr
|
||||
_conditionalAccurateAndSkipFence = 0x0000024
|
||||
0x0000024 = lis r5, _fenceMethod@ha
|
||||
0x0000028 = lwz r11, _fenceMethod@l(r5) ; Load the fence method value
|
||||
0x000002C = cmpwi r11, 2 ; Compare the accurate fence method with the fence method that's set, store comparison to the conditional register
|
||||
0x0000030 = li r5, 6 ; Original instruction that got replaced with the jump
|
||||
0x0000034 = add r6, r12, r0 ; Instruction that got replaced with the fence skip check
|
||||
0x0000038 = bne .+0x10 ; If the conditional register isn't equel to accurate fence, skip the next three instructions (the ones that are the accurate fence) to the next comparison instruction.
|
||||
0x000003C = cmpwi r6, 500 # Accurate fence basically checks if it's the first 500 frames of the game, in which case it does a full fence.
|
||||
0x0000040 = blt .+0x08
|
||||
0x0000044 = subi r6, r6, 1
|
||||
0x0000048 = cmpwi r11, 3 ; Compare the skip fence method with the fence method that's set, in preparation of the fence skip since it stores the result in the conditional register.
|
||||
0x000004C = blr ; Return to the instruction that jumped to this part to the code cave
|
||||
|
||||
#0x31FAAE8 = bla _conditionalPerformanceFence
|
||||
#0x31FAAF8 = bla _conditionalAccuracyAndSkipFence
|
||||
#0x31FAAFC = beq .+0x08
|
||||
|
||||
0x031FAAE8 = li r0, 1
|
||||
0x31FAAE8 = bla _conditionalPerformanceFence ; Jumps to the conditional performance part of the code cave that creates the performance fence skip if that preset has been chosen.
|
||||
0x31FAAF8 = bla _conditionalAccurateAndSkipFence ; Jumps to the conditional accurate part of the code cave that creates the accurate fence skip if that preset has been chosen.
|
||||
0x31FAAFC = beq .+0x08 ; This part is the crucial part of the fence skip method. It skips the GX2SetGPUFence call in which case there's no fence skip, if the conditional register that has previously been set by the accurate code cave was true.
|
||||
|
||||
[BotwFenceV176V192]
|
||||
moduleMatches = 0xFD091F9F, 0xD472D8A5
|
||||
|
||||
# Code Cave
|
||||
#codeCaveSize = 0x50
|
||||
codeCaveSize = 0x50
|
||||
|
||||
# Fence Method Value
|
||||
#_fenceMethod = 0x0000000
|
||||
#0x0000000 = .int $fenceMethod
|
||||
_fenceMethod = 0x0000000
|
||||
0x0000000 = .int $fenceMethod
|
||||
|
||||
# Performance Fence method
|
||||
|
||||
#_conditionalPerformanceFence = 0x0000004
|
||||
#0x0000004 = lis r11, _fenceMethod@ha
|
||||
#0x0000008 = lwz r11, _fenceMethod@l(r11)
|
||||
#0x000000C = cmpwi r11, 1
|
||||
#0x0000010 = beq .+0x0C
|
||||
#0x0000014 = li r0, 1
|
||||
#0x0000018 = blr
|
||||
#0x000001C = lwz r0, 0x388(r31)
|
||||
#0x0000020 = blr
|
||||
_conditionalPerformanceFence = 0x0000004
|
||||
0x0000004 = lis r11, _fenceMethod@ha
|
||||
0x0000008 = lwz r11, _fenceMethod@l(r11)
|
||||
0x000000C = cmpwi r11, 1
|
||||
0x0000010 = bne .+0x0C
|
||||
0x0000014 = li r0, 1
|
||||
0x0000018 = blr
|
||||
0x000001C = lwz r0, 0x388(r31)
|
||||
0x0000020 = blr
|
||||
|
||||
# Accuracy and Skip Fence methods
|
||||
# Accurate and Skip Fence methods
|
||||
|
||||
#_conditionalAccuracyAndSkipFence = 0x0000024
|
||||
#0x0000024 = lis r5, _fenceMethod@ha
|
||||
#0x0000028 = lwz r11, _fenceMethod@l(r5)
|
||||
#0x000002C = cmpwi r11, 2
|
||||
#0x0000030 = li r5, 6
|
||||
#0x0000034 = add r6, r12, r0
|
||||
#0x0000038 = bne .+0x10
|
||||
#0x000003C = cmpwi r6, 500
|
||||
#0x0000040 = blt .+0x08
|
||||
#0x0000044 = subi r6, r6, 1
|
||||
#0x0000048 = cmpwi r11, 3
|
||||
#0x000004C = blr
|
||||
_conditionalAccurateAndSkipFence = 0x0000024
|
||||
0x0000024 = lis r5, _fenceMethod@ha
|
||||
0x0000028 = lwz r11, _fenceMethod@l(r5)
|
||||
0x000002C = cmpwi r11, 2
|
||||
0x0000030 = li r5, 6
|
||||
0x0000034 = add r6, r12, r0
|
||||
0x0000038 = bne .+0x10
|
||||
0x000003C = cmpwi r6, 500
|
||||
0x0000040 = blt .+0x08
|
||||
0x0000044 = subi r6, r6, 1
|
||||
0x0000048 = cmpwi r11, 3
|
||||
0x000004C = blr
|
||||
|
||||
#0x31F9FEC = bla _conditionalPerformanceFence
|
||||
#0x31F9FFC = bla _conditionalAccuracyAndSkipFence
|
||||
#0x31FA000 = beq .+0x08
|
||||
|
||||
0x031F9FEC = li r0, 1
|
||||
0x31F9FEC = bla _conditionalPerformanceFence
|
||||
0x31F9FFC = bla _conditionalAccurateAndSkipFence
|
||||
0x31FA000 = beq .+0x08
|
Loading…
Reference in New Issue
Block a user