mirror of
https://github.com/cemu-project/cemu_graphic_packs.git
synced 2024-12-23 16:31:50 +01:00
[BotW] Fix centered HUD mode
Forgot how I made my original formula for the edge HUD, but now I finally understand MATH!
This commit is contained in:
parent
4cdffcaef2
commit
84fb724c9e
@ -607,7 +607,7 @@ b exitScale
|
||||
|
||||
const_SensorsOffset:
|
||||
.float 392.0
|
||||
scaleSensorMeterPanes:
|
||||
scaleSoundMeterPanes:
|
||||
addi r5, r31, 0x80
|
||||
lis r10, const_SensorsOffset@ha
|
||||
lfs f12, const_SensorsOffset@l(r10)
|
||||
@ -616,7 +616,7 @@ addi r10, r10, str_N_InOut_00@l
|
||||
bla _compareString
|
||||
beq scalePaneAndKeepCustomPosIf
|
||||
b exitScale
|
||||
scaleSoundMeterPanes:
|
||||
scaleSensorMeterPanes:
|
||||
addi r5, r31, 0x80
|
||||
lis r10, const_SensorsOffset@ha
|
||||
lfs f12, const_SensorsOffset@l(r10)
|
||||
@ -635,7 +635,7 @@ bla _compareString
|
||||
beq scalePaneAndKeepCustomPosIf
|
||||
b exitScale
|
||||
const_TimeOffset:
|
||||
.float 342*0.85
|
||||
.float (($ultrawideHUDMode == 1) * (342*0.85)) + (($ultrawideHUDMode == 2)*(342*(1/0.85)))
|
||||
scaleMainScreenTimePanes:
|
||||
addi r5, r31, 0x80
|
||||
lis r10, const_TimeOffset@ha
|
||||
@ -2436,6 +2436,12 @@ const_640:
|
||||
const_1:
|
||||
.float 1.0
|
||||
|
||||
scalePaneAndKeepPosIf:
|
||||
li r10, $ultrawideHUDMode
|
||||
cmpwi r10, 1
|
||||
beq scalePaneAndKeepPos
|
||||
bne scalePaneAndPos
|
||||
|
||||
scalePaneAndKeepPos:
|
||||
lis r10, const_AspectRatio@ha
|
||||
lfs f0, const_AspectRatio@l(r10)
|
||||
@ -2469,44 +2475,12 @@ fsubs f0, f11, f0
|
||||
stfs f0, 0x1C(r31)
|
||||
b exitScale
|
||||
|
||||
scalePaneAndKeepPosIf:
|
||||
li r10, $ultrawideHUDMode
|
||||
cmpwi r10, 1
|
||||
beq scalePaneAndKeepPos
|
||||
bne scalePaneAndPos
|
||||
|
||||
moveKeepPos:
|
||||
lis r10, const_0@ha
|
||||
lfs f11, const_0@l(r10)
|
||||
lfs f9, 0x1C(r31)
|
||||
fcmpu f9, f11
|
||||
lis r10, const_640@ha
|
||||
lfs f0, const_640@l(r10)
|
||||
lfs f9, 0x1C(r31)
|
||||
bge .+0x08
|
||||
fsubs f9, f11, f9
|
||||
fsubs f0, f0, f9
|
||||
lis r10, const_1@ha
|
||||
lfs f13, const_1@l(r10)
|
||||
lis r10, const_AspectRatio@ha
|
||||
lfs f9, const_AspectRatio@l(r10)
|
||||
fsubs f13, f13, f9
|
||||
fmuls f0, f0, f13
|
||||
lfs f9, 0x1C(r31)
|
||||
bge .+0x08
|
||||
fsubs f9, f11, f9
|
||||
fadds f0, f9, f0
|
||||
bge .+0x08
|
||||
fsubs f0, f11, f0
|
||||
stfs f0, 0x1C(r31)
|
||||
b exitScale
|
||||
|
||||
; Pass custom pos as f12
|
||||
scalePaneAndKeepCustomPosIf:
|
||||
li r10, $ultrawideHUDMode
|
||||
cmpwi r10, 1
|
||||
beq scalePaneAndKeepCustomPos
|
||||
bne scalePaneAndCenterCustomPos
|
||||
bne scalePaneAndCustomPos
|
||||
|
||||
scalePaneAndKeepCustomPos:
|
||||
lis r10, const_AspectRatio@ha
|
||||
@ -2515,6 +2489,7 @@ lfs f9, 0x34(r31)
|
||||
fmuls f0, f0, f9
|
||||
stfs f0, 0x34(r31)
|
||||
|
||||
; [XPositionOfPane] + ((1280/2 - [XPositionOfPane]) * (1-[AspectRatio])))
|
||||
lis r10, const_0@ha
|
||||
lfs f11, const_0@l(r10)
|
||||
lfs f9, 0x1C(r31)
|
||||
@ -2544,15 +2519,48 @@ fsubs f0, f0, f12
|
||||
stfs f0, 0x1C(r31)
|
||||
b exitScale
|
||||
|
||||
; todo: currently broken for left-sided elements
|
||||
scalePaneAndCenterCustomPos:
|
||||
# ; [XPositionOfPane] + ((1280/2 - [XPositionOfPane]) * (1-[AspectRatio])))
|
||||
# lis r10, const_640@ha
|
||||
# lfs f0, const_640@l(r10) ; (1280/2)
|
||||
# lfs f9, 0x1C(r31)
|
||||
# fadds f9, f9, f12 ; Create XPositionOfPane (add position of current pane + custom position of parent pane)
|
||||
# fsubs f0, f0, f9 ; (1280/2) - XPositionOfPane
|
||||
|
||||
# lis r10, const_1@ha
|
||||
# lfs f13, const_1@l(r10)
|
||||
# lis r10, const_AspectRatio@ha
|
||||
# lfs f9, const_AspectRatio@l(r10)
|
||||
# fsubs f13, f13, f9 ; (1-[AspectRatio])
|
||||
|
||||
# fmuls f0, f0, f13 ; ((1280/2) - XPositionOfPane) * (1-[AspectRatio])
|
||||
|
||||
# lfs f9, 0x1C(r31)
|
||||
# fadds f9, f9, f12 ; [XPositionOfPane]
|
||||
|
||||
# fadds f0, f9, f0 ; [XPositionOfPane] + ((1280/2 - [XPositionOfPane]) * (1-[AspectRatio])))
|
||||
# fsubs f0, f0, f12
|
||||
|
||||
; Explanation: The current position is 3x as big as it should be (let's take 3x at 48:9), so to correct that you scale it back by
|
||||
; XPositionOfPane*(1-AspectRatio)
|
||||
scalePaneAndCustomPos:
|
||||
lis r10, const_AspectRatio@ha
|
||||
lfs f0, const_AspectRatio@l(r10)
|
||||
lfs f9, 0x34(r31)
|
||||
fmuls f0, f0, f9
|
||||
stfs f0, 0x34(r31)
|
||||
|
||||
; [XPositionOfPane] + ((1280/2 - [XPositionOfPane]) * (1-[AspectRatio])))
|
||||
lis r10, const_1@ha
|
||||
lfs f9, const_1@l(r10)
|
||||
lis r10, const_AspectRatio@ha
|
||||
lfs f0, const_AspectRatio@l(r10)
|
||||
fsubs f0, f9, f0
|
||||
lfs f9, 0x1C(r31)
|
||||
fsubs f9, f9, f12
|
||||
fmuls f0, f9, f0
|
||||
stfs f0, 0x1C(r31)
|
||||
b exitScale
|
||||
|
||||
moveKeepPos:
|
||||
lis r10, const_0@ha
|
||||
lfs f11, const_0@l(r10)
|
||||
lfs f9, 0x1C(r31)
|
||||
@ -2576,20 +2584,22 @@ fadds f0, f9, f0
|
||||
bge .+0x08
|
||||
fsubs f0, f11, f0
|
||||
stfs f0, 0x1C(r31)
|
||||
|
||||
lis r10, const_640@ha
|
||||
lfs f11, const_640@l(r10)
|
||||
fsubs f0, f0, f11
|
||||
stfs f0, 0x1C(r31)
|
||||
b exitScale
|
||||
|
||||
movePaneToCustomSize:
|
||||
lis r10, const_AspectRatio@ha
|
||||
lfs f0, const_AspectRatio@l(r10)
|
||||
; Pass the scale in f0 and position in f12
|
||||
scalePaneWithCustomPosAndScale:
|
||||
lfs f9, 0x34(r31)
|
||||
fmuls f0, f0, f9
|
||||
stfs f0, 0x34(r31)
|
||||
|
||||
lfs f9, 0x1C(r31)
|
||||
fsubs f0, f9, f12
|
||||
stfs f12, 0x1C(r31)
|
||||
b exitScale
|
||||
|
||||
movePaneToCustomPos:
|
||||
lfs f9, 0x1C(r31)
|
||||
fsubs f0, f9, f12
|
||||
stfs f12, 0x1C(r31)
|
||||
b exitScale
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user