You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
; Check if a cutscene is ongoing with a set FPS limit
31
+
_waitTillCutsceneLimit:
32
+
li r10,$cutsceneFPSLimit
33
+
cmpwi r10,1
34
+
bne _calculateFPS
35
+
lis r10, forceCutsceneLimit@ha
36
+
lwz r10, forceCutsceneLimit@l(r10)
37
+
cmpwi r10,1
38
+
bne _calculateFPS
39
+
40
+
; If a cutscene FPS limit is set, lower FPS
41
+
_lowerCutsceneFPS:
42
+
lis r10, const_30@ha
43
+
lfs f12, const_30@l(r10)
44
+
45
+
; Calculate how many ticks a frame has to take to render at the given FPS limit
46
+
lis r10, const_1@ha
47
+
lfs f7, const_1@l(r10)
48
+
fdivs f12, f7, f12
49
+
lis r10, timerTickSpeed@ha
50
+
lfs f7, timerTickSpeed@l(r10)
51
+
fmuls f12, f7, f12
52
+
53
+
; Subtract the time that it took for the actual frame to render and make sure that it's not negative (which means a frame already took longer to render then the FPS limit)
54
+
fsubs f12, f12, f10
55
+
lis r10, const_0.0@ha
56
+
lfs f7, const_0.0@l(r10)
57
+
fcmpu cr0, f7, f12
58
+
ble .+0x8
59
+
fmr f12, f7
60
+
61
+
; Convert the remaining ticks that should be spend idling to an integer (but it requires storing it in memory)
62
+
fctiwz f12, f12
63
+
lis r10, cutsceneFloatConvHa@ha
64
+
stfd f12, cutsceneFloatConvHa@l(r10)
65
+
66
+
# ; Load the converted integer ticks and sleep for the given amount of time
67
+
mr r10, r4
68
+
lis r9, cutsceneFloatConvL@ha
69
+
lwz r4, cutsceneFloatConvL@l(r9)
70
+
mr r11, r3
71
+
# li r3,0
72
+
lis r9, cutsceneFloatConvHa@ha
73
+
lwz r3, cutsceneFloatConvHa@l(r9)
74
+
mflr r9
75
+
bl import.coreinit.OSSleepTicks
76
+
mtlr r9
77
+
mr r3,r11
78
+
mr r4,r10
79
+
80
+
_reacquireTime:
81
+
mr r11, r3
82
+
mr r10, r4
83
+
mflr r9
84
+
bl import.coreinit.OSGetSystemTime
85
+
mtlr r9
86
+
87
+
lis r9, prevFrameTime_Up32Bit@ha
88
+
stw r3, prevFrameTime_Up32Bit@l(r9)
89
+
lis r9, prevFrameTime_Low32Bit@ha
90
+
stw r4, prevFrameTime_Low32Bit@l(r9)
91
+
mr r3,r11
92
+
mr r4,r10
93
+
94
+
; Directly set the game speed to 30FPS when cutscenes are active
0 commit comments