Advertisement
djvj

Untitled

Feb 8th, 2015
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 66.94 KB | None | 0 0
  1. MCRC=F3154B6F
  2. MVersion=1.1.1
  3.  
  4. ; Default transition animation used for Fade_In
  5. DefaultAnimateFadeIn(direction,time){
  6. Global Fade_hwnd1,Fade_hdc1,fadeLyr1CanvasX,fadeLyr1CanvasY,fadeLyr1CanvasW,fadeLyr1CanvasH
  7. Global Fade_hwnd2,Fade_hdc2,fadeLyr2CanvasX,fadeLyr2CanvasY,fadeLyr2CanvasW,fadeLyr2CanvasH
  8. Global Fade_hwnd3Static,Fade_hdc3Static,fadeLyr3StaticCanvasX,fadeLyr3StaticCanvasY,fadeLyr3StaticCanvasW,fadeLyr3StaticCanvasH
  9. Global Fade_hwnd3,Fade_hdc3,fadeLyr3CanvasX,fadeLyr3CanvasY,fadeLyr3CanvasW,fadeLyr3CanvasH
  10. Global Fade_hwnd4,Fade_hdc4,fadeLyr4CanvasX,fadeLyr4CanvasY,fadeLyr4CanvasW,fadeLyr4CanvasH,FadeLayer4AnimFilesAr
  11. Global Fade_hwnd5,Fade_hdc5,fadeLyr5CanvasX,fadeLyr5CanvasY,fadeLyr5CanvasW,fadeLyr5CanvasH
  12. Global Fade_hwnd6,Fade_hdc6,fadeLyr6CanvasX,fadeLyr6CanvasY,fadeLyr6CanvasW,fadeLyr6CanvasH
  13. Global Fade_hwnd7,Fade_hdc7,fadeLyr7CanvasX,fadeLyr7CanvasY,fadeLyr7CanvasW,fadeLyr7CanvasH
  14. Log("DefaultAnimateFadeIn - Started, direction is: " . direction)
  15. startTime := A_TickCount
  16. If direction = in
  17. Log("DefaultAnimateFadeIn - Drawing First FadeIn Image.", 1)
  18. Loop{
  19. t := ((TimeElapsed := A_TickCount-startTime) < time) ? (If direction="in" ? 255*(timeElapsed/time) : 255*(1-(timeElapsed/time))) : (If direction="in" ? 255 : 0)
  20. if fadeLyr1CanvasW
  21. Alt_UpdateLayeredWindow(Fade_hwnd1, Fade_hdc1, fadeLyr1CanvasX, fadeLyr1CanvasY, fadeLyr1CanvasW, fadeLyr1CanvasH, t) ; to fade in, set transparency to 0 at first
  22. if fadeLyr2CanvasW
  23. Alt_UpdateLayeredWindow(Fade_hwnd2,Fade_hdc2,fadeLyr2CanvasX,fadeLyr2CanvasY,fadeLyr2CanvasW,fadeLyr2CanvasH, t)
  24. If direction = out
  25. {
  26. if fadeLyr3StaticCanvasW
  27. Alt_UpdateLayeredWindow(Fade_hwnd3Static, Fade_hdc3Static,fadeLyr3StaticCanvasX,fadeLyr3StaticCanvasY, fadeLyr3StaticCanvasW, fadeLyr3StaticCanvasH, t)
  28. if fadeLyr3CanvasW
  29. Alt_UpdateLayeredWindow(Fade_hwnd3, Fade_hdc3,fadeLyr3CanvasX,fadeLyr3CanvasY, fadeLyr3CanvasW, fadeLyr3CanvasH, t)
  30. if fadeLyr5CanvasW
  31. Alt_UpdateLayeredWindow(Fade_hwnd5, Fade_hdc5,fadeLyr5CanvasX,fadeLyr5CanvasY, fadeLyr5CanvasW, fadeLyr5CanvasH, t)
  32. if fadeLyr6CanvasW
  33. Alt_UpdateLayeredWindow(Fade_hwnd6, Fade_hdc6,fadeLyr6CanvasX,fadeLyr6CanvasY, fadeLyr6CanvasW, fadeLyr6CanvasH, t)
  34. if fadeLyr7CanvasW
  35. Alt_UpdateLayeredWindow(Fade_hwnd7, Fade_hdc7,fadeLyr7CanvasX,fadeLyr7CanvasY, fadeLyr7CanvasW, fadeLyr7CanvasH, t)
  36. If FadeLayer4AnimFilesAr.MaxIndex() > 0 {
  37. SetTimer, FadeLayer4Anim, Off
  38. Alt_UpdateLayeredWindow(Fade_hwnd4, Fade_hdc4,fadeLyr4CanvasX,fadeLyr4CanvasY, fadeLyr4CanvasW, fadeLyr4CanvasH, t)
  39. }
  40. }
  41. If (direction = "in" && t >= 255) or (direction = "out" && t <= 0)
  42. Break
  43. }
  44. Log("DefaultAnimateFadeIn - Ended")
  45. }
  46.  
  47. ; Default transition animation used for Fade_Out
  48. DefaultAnimateFadeOut(direction,time){
  49. Global FadeOut_hwnd1, FadeOut_hdc1, fadeOutLyr1CanvasX,fadeOutLyr1CanvasY,fadeOutLyr1CanvasW,fadeOutLyr1CanvasH
  50. Global fadeOutExtraScreen,FadeOutExtraScreen_ID
  51. Log("DefaultAnimateFadeOut - Started, direction is: " . direction)
  52. If fadeOutExtraScreen = true
  53. { Log("DefaultAnimateFadeOut - Destroying FadeOutBlackScreen",4)
  54. AnimateWindow(FadeOutExtraScreen_ID, "out", "fade", 100) ; animate FadeOutBlackScreen out quickly
  55. Gui, FadeOutExtraScreen:Destroy ; destroy the temporary FadeOutBlackScreen
  56. }
  57. startTime := A_TickCount
  58. Loop{
  59. t := ((TimeElapsed := A_TickCount-startTime) < time) ? (If direction="in" ? 255*(timeElapsed/time) : 255*(1-(timeElapsed/time))) : (If direction="in" ? 255 : 0)
  60. Alt_UpdateLayeredWindow(FadeOut_hwnd1, FadeOut_hdc1, fadeOutLyr1CanvasX,fadeOutLyr1CanvasY,fadeOutLyr1CanvasW,fadeOutLyr1CanvasH, t) ; to fade in, set transparency to 0 at first
  61. If (direction = "in" && t >= 255) or (direction = "out" && t <= 0)
  62. Break
  63. }
  64. Log("DefaultAnimateFadeOut - Ended")
  65. }
  66.  
  67. ; Legacy fadein animation for use when gdi does not work with an emulator. Jpgs are not supported and will not show on this legacy gui
  68. LegacyFadeInTransition(direction,time){
  69. Global Fade_hwnd1,Fade_hdc1,Fade_G1,fadeLyr1CanvasX,fadeLyr1CanvasY,fadeLyr1CanvasW,fadeLyr1CanvasH
  70. Global Fade_hwnd2,Fade_hdc2,fadeLyr2CanvasX,fadeLyr2CanvasY,fadeLyr2CanvasW,fadeLyr2CanvasH
  71. Global Fade_hwnd3Static,Fade_hdc3Static,fadeLyr3StaticCanvasX,fadeLyr3StaticCanvasY,fadeLyr3StaticCanvasW,fadeLyr3StaticCanvasH
  72. Global Fade_hwnd3,Fade_hdc3,fadeLyr3CanvasX,fadeLyr3CanvasY,fadeLyr3CanvasW,fadeLyr3CanvasH
  73. Global Fade_hwnd4,Fade_hdc4,fadeLyr4CanvasX,fadeLyr4CanvasY,fadeLyr4CanvasW,fadeLyr4CanvasH
  74. Global Fade_hwnd5,Fade_hdc5,fadeLyr5CanvasX,fadeLyr5CanvasY,fadeLyr5CanvasW,fadeLyr5CanvasH
  75. Global Fade_hwnd6,Fade_hdc6,fadeLyr6CanvasX,fadeLyr6CanvasY,fadeLyr6CanvasW,fadeLyr6CanvasH
  76. Global Fade_hwnd7,Fade_hdc7,fadeLyr7CanvasX,fadeLyr7CanvasY,fadeLyr7CanvasW,fadeLyr7CanvasH
  77. Global fadeLyr1PicW,fadeLyr1PicH,fadeInLyr1File,fadeLyr1Color,fadeLyr1AlignImage
  78. Log("LegacyFadeInTransition - Started, direction is: " . direction)
  79. StringTrimLeft,fadeLyr1ColorNoAlpha,fadeLyr1Color,2 ; for legacy gui, we need to trim the alpha from the color as it's not supported
  80.  
  81. If direction = in
  82. { Log("LegacyFadeInTransition - Drawing First FadeIn Image.", 1)
  83. Gui, Fade_GUI1:Color, %fadeLyr1ColorNoAlpha%
  84. GetBGPicPosition(fadeLyr1PicXNew,fadeLyr1PicYNew,fadeLyr1PicWNew,fadeLyr1PicHNew,fadeLyr1PicW,fadeLyr1PicH,fadeLyr1AlignImage) ; get the background pic's new position and size
  85. If (fadeLyr1AlignImage = "Stretch and Lose Aspect")
  86. Gui, Fade_GUI1:Add, Picture,w%baseScreenWidth% h%baseScreenHeight% x0 y0, %fadeInLyr1File%
  87. Else If (fadeLyr1AlignImage = "Stretch and Keep Aspect" Or fadeLyr1AlignImage = "Center Width" Or fadeLyr1AlignImage = "Center Height" Or fadeLyr1AlignImage = "Align to Bottom Left" Or fadeLyr1AlignImage = "Align to Bottom Right")
  88. Gui, Fade_GUI1:Add, Picture,w%fadeLyr1PicWNew% h%fadeLyr1PicHNew% x%fadeLyr1PicXNew% y%fadeLyr1PicYNew%, %fadeInLyr1File%
  89. Else If (fadeLyr1AlignImage = "Center") ; original image size and aspect
  90. Gui, Fade_GUI1:Add, Picture,w%fadeLyr1PicW% h%fadeLyr1PicH% x%fadeLyr1PicXNew% y%fadeLyr1PicYNew%, %fadeInLyr1File%
  91. Else If (fadeLyr1AlignImage = "Align to Top Right") ; place the pic so the top right corner matches the screen's top right corner
  92. Gui, Fade_GUI1:Add, Picture,w%fadeLyr1PicWNew% h%fadeLyr1PicHNew% x%fadeLyr1PicXNew% y0, %fadeInLyr1File%
  93. Else ; place the pic so the top left corner matches the screen's top left corner, also the default
  94. Gui, Fade_GUI1:Add, Picture,w%fadeLyr1PicWNew% h%fadeLyr1PicHNew% x0 y0, %fadeInLyr1File%
  95. Gui, Fade_GUI1:Show, x0 y0 h%baseScreenHeight% w%baseScreenWidth% Hide
  96. }
  97. If direction = out
  98. { SetTimer, FadeLayer4Anim, Off
  99. Gdip_GraphicsClear(Fade_G2)
  100. Gdip_GraphicsClear(Fade_G3Static)
  101. Gdip_GraphicsClear(Fade_G3)
  102. Gdip_GraphicsClear(Fade_G4)
  103. Gdip_GraphicsClear(Fade_G5)
  104. Gdip_GraphicsClear(Fade_G6)
  105. Gdip_GraphicsClear(Fade_G7)
  106. Alt_UpdateLayeredWindow(Fade_hwnd2, Fade_hdc2, fadeLyr2CanvasX, fadeLyr2CanvasY, fadeLyr2CanvasW, fadeLyr2CanvasH)
  107. Alt_UpdateLayeredWindow(Fade_hwnd3Static, Fade_hdc3Static,fadeLyr3StaticCanvasX,fadeLyr3StaticCanvasY, fadeLyr3StaticCanvasW, fadeLyr3StaticCanvasH)
  108. Alt_UpdateLayeredWindow(Fade_hwnd3, Fade_hdc3, fadeLyr3CanvasX, fadeLyr3CanvasY, fadeLyr3CanvasW, fadeLyr3CanvasH)
  109. Alt_UpdateLayeredWindow(Fade_hwnd4, Fade_hdc4, fadeLyr4CanvasX, fadeLyr4CanvasY, fadeLyr4CanvasW, fadeLyr4CanvasH)
  110. Alt_UpdateLayeredWindow(Fade_hwnd5, Fade_hdc5, fadeLyr5CanvasX, fadeLyr5CanvasY, fadeLyr5CanvasW, fadeLyr5CanvasH)
  111. Alt_UpdateLayeredWindow(Fade_hwnd6, Fade_hdc6, fadeLyr6CanvasX, fadeLyr6CanvasY, fadeLyr6CanvasW, fadeLyr6CanvasH)
  112. Alt_UpdateLayeredWindow(Fade_hwnd7, Fade_hdc7, fadeLyr7CanvasX, fadeLyr7CanvasY, fadeLyr7CanvasW, fadeLyr7CanvasH)
  113. }
  114. AnimateWindow(Fade_hwnd1, direction, "fade", time) ; animate in fadeLayer1
  115. If direction = in
  116. Alt_UpdateLayeredWindow(Fade_hwnd2, Fade_hdc2, fadeLyr2CanvasX, fadeLyr2CanvasY, fadeLyr2CanvasW, fadeLyr2CanvasH)
  117. ; AnimateWindow(1_ID, direction, "slide bt", time) ; slide
  118. Log("LegacyFadeInTransition - Ended")
  119. }
  120.  
  121. ; Legacy fadeout animation for use when gdi does not work with an emulator. Jpgs are not supported and will not show on this legacy gui
  122. LegacyFadeOutTransition(direction,time){
  123. Global FadeOut_hwnd1, FadeOut_hdc1, fadeOutLyr1CanvasX,fadeOutLyr1CanvasY,fadeOutLyr1CanvasW,fadeOutLyr1CanvasH
  124. Global fadeOutExtraScreen,FadeOutExtraScreen_ID
  125. Global lyr1OutPicW,lyr1OutPicH,lyr1OutFile,fadeLyr1Color,fadeLyr1AlignImage
  126. ;,fadeOutBlackScreenEnabled,FadeOutBlackScreen_ID
  127. Log("LegacyFadeOutTransition - Started, direction is: " . direction)
  128. StringTrimLeft,fadeLyr1ColorNoAlpha,fadeLyr1Color,2 ; for legacy gui, we need to trim the alpha from the color as it's not supported
  129. If direction = in
  130. {
  131. Gui, FadeOut_GUI1:Color, %fadeLyr1ColorNoAlpha%
  132. GetBGPicPosition(fadeLyr1OutPicXNew,fadeLyr1OutPicYNew,fadeLyr1OutPicWNew,fadeLyr1OutPicHNew,lyr1OutPicW,lyr1OutPicH,fadeLyr1AlignImage) ; get the background pic's new position and size
  133. If (fadeLyr1AlignImage = "Stretch and Lose Aspect")
  134. Gui, FadeOut_GUI1:Add, Picture,w%baseScreenWidth% h%baseScreenHeight% x0 y0, %lyr1OutFile%
  135. Else If (fadeLyr1AlignImage = "Stretch and Keep Aspect" Or fadeLyr1AlignImage = "Center Width" Or fadeLyr1AlignImage = "Center Height" Or fadeLyr1AlignImage = "Align to Bottom Left" Or fadeLyr1AlignImage = "Align to Bottom Right")
  136. Gui, FadeOut_GUI1:Add, Picture,w%fadeLyr1OutPicWNew% h%fadeLyr1OutPicHNew% x%fadeLyr1OutPicXNew% y%fadeLyr1OutPicYNew%, %lyr1OutFile%
  137. Else If (fadeLyr1AlignImage = "Center") ; original image size and aspect
  138. Gui, FadeOut_GUI1:Add, Picture,w%lyr1OutPicW% h%lyr1OutPicH% x%fadeLyr1OutPicXNew% y%fadeLyr1OutPicYNew%, %lyr1OutFile%
  139. Else If (fadeLyr1AlignImage = "Align to Top Right") ; place the pic so the top right corner matches the screen's top right corner
  140. Gui, FadeOut_GUI1:Add, Picture,w%fadeLyr1OutPicWNew% h%fadeLyr1OutPicHNew% x%fadeLyr1OutPicXNew% y0, %lyr1OutFile%
  141. Else ; place the pic so the top left corner matches the screen's top left corner, also the default
  142. Gui, FadeOut_GUI1:Add, Picture,w%fadeLyr1OutPicWNew% h%fadeLyr1OutPicHNew% x0 y0, %lyr1OutFile%
  143. Gui, FadeOut_GUI1:Show, x0 y0 h%baseScreenHeight% w%baseScreenWidth% Hide
  144. }
  145. If fadeOutExtraScreen = true
  146. { Log("LegacyFadeOutTransition - Destroying FadeOutBlackScreen",4)
  147. AnimateWindow(FadeOutExtraScreen_ID, "out", "fade", 100) ; animate FadeOutBlackScreen out quickly
  148. Gui, FadeOutExtraScreen:Destroy ; destroy the temporary FadeOutBlackScreen
  149. }
  150. AnimateWindow(FadeOut_hwnd1, direction, "fade", time) ; animate in fadeLayer1
  151. ; AnimateWindow(out1_ID, direction, "slide bt", time) ; slide
  152. Log("LegacyFadeOutTransition - Ended")
  153. }
  154.  
  155. ; Bleasby's DefaultFadeAnimation included in HL - you can use it on both layer 3 animation and layer 3 7z animation
  156. DefaultFadeAnimation:
  157. ;SetTimer, DetectFadeError, Off
  158. Log("DefaultFadeAnimation - Started")
  159. ;====== Begin of menu code
  160. fadeInActive=1 ; As long as user did not press a key to exit fade, this var will be filled and fade will do its full animation
  161. ;====== Loading info about layer 3 image
  162. if fadeLyr3StaticPrefix
  163. fadeInLyr3StaticFile := GetFadePicFile(fadeLyr3StaticPrefix)
  164. If FileExist(fadeInLyr3StaticFile) ; If a layer 3 static image exists, let's get its dimensions
  165. { fadeLyr3StaticPic := Gdip_CreateBitmapFromFile(fadeInLyr3StaticFile)
  166. Gdip_GetImageDimensions(fadeLyr3StaticPic, fadeLyr3StaticPicW, fadeLyr3StaticPicH)
  167. ; find Width and Height
  168. If (fadeLyr3StaticPos = "Stretch and Lose Aspect"){
  169. fadeLyr3StaticPicW := baseScreenWidth
  170. fadeLyr3StaticPicH := baseScreenHeight
  171. fadeLyr3StaticPicPadX := 0 , fadeLyr3StaticPicPadY := 0
  172. } else if (fadeLyr3StaticPos = "Stretch and Keep Aspect"){
  173. widthMaxPercent := ( baseScreenWidth / fadeLyr3StaticPicW ) ; get the percentage needed to maximumise the image so it reaches the screen's width
  174. heightMaxPercent := ( baseScreenHeight / fadeLyr3StaticPicH )
  175. percentToEnlarge := If (widthMaxPercent < heightMaxPercent) ? widthMaxPercent : heightMaxPercent ; this basicallys says if the width's max reaches the screen's width first, use the width's percentage instead of the height's
  176. fadeLyr3StaticPicW := Round(fadeLyr3StaticPicW * percentToEnlarge)
  177. fadeLyr3StaticPicH := Round(fadeLyr3StaticPicH * percentToEnlarge)
  178. fadeLyr3StaticPicPadX := 0 , fadeLyr3StaticPicPadY := 0
  179. } else {
  180. if (!(fadeLyr3StaticW)) and (!(fadeLyr3StaticH)){
  181. fadeLyr3StaticPicW := Round(fadeLyr3StaticPicW * fadeXScale * fadeLyr3StaticAdjust)
  182. fadeLyr3StaticPicH := Round(fadeLyr3StaticPicH * fadeYScale * fadeLyr3StaticAdjust)
  183. } else if (fadeLyr3StaticW) and (!(fadeLyr3StaticH)){
  184. fadeLyr3StaticPicH := Round( fadeLyr3StaticPicH * (fadeLyr3StaticPicW / Round(fadeLyr3StaticPicW * fadeLyr3StaticAdjust)) )
  185. fadeLyr3StaticPicW := Round(fadeLyr3StaticW * fadeLyr3StaticAdjust)
  186. } else if (!(fadeLyr3StaticW)) and (fadeLyr3StaticH){
  187. fadeLyr3StaticPicW := Round( fadeLyr3StaticPicW * (fadeLyr3StaticPicH / Round(fadeLyr3StaticH * fadeLyr3StaticAdjust)) )
  188. fadeLyr3StaticPicH := Round(fadeLyr3StaticH * fadeLyr3StaticAdjust)
  189. } else {
  190. fadeLyr3StaticPicW := Round(fadeLyr3StaticW * fadeLyr3StaticAdjust)
  191. fadeLyr3StaticPicH := Round(fadeLyr3StaticH * fadeLyr3StaticAdjust)
  192. }
  193. }
  194. GetFadePicPosition(fadeLyr3StaticPicX,fadeLyr3StaticPicY,fadeLyr3StaticX,fadeLyr3StaticY,fadeLyr3StaticPicW,fadeLyr3StaticPicH,fadeLyr3StaticPos)
  195. ; figure out what quadrant the layer 3 Static image is in, so we know to apply a + or - pad value so the user does not have to
  196. If fadeLyr3StaticPos in No Alignment,Center,Top Left Corner
  197. fadeLyr3StaticPicPadX:=fadeLyr3StaticPicPad, fadeLyr3StaticPicPadY:=fadeLyr3StaticPicPad
  198. Else If fadeLyr3StaticPos = Top Center
  199. fadeLyr3StaticPicPadX:=0, fadeLyr3StaticPicPadY:=fadeLyr3StaticPicPad
  200. Else If fadeLyr3StaticPos = Left Center
  201. fadeLyr3StaticPicPadX:=fadeLyr3StaticPicPad, fadeLyr3StaticPicPadY:=0
  202. Else If fadeLyr3StaticPos = Top Right Corner
  203. fadeLyr3StaticPicPadX:=fadeLyr3StaticPicPad*-1, fadeLyr3StaticPicPadY:=fadeLyr3StaticPicPad
  204. Else If fadeLyr3StaticPos = Right Center
  205. fadeLyr3StaticPicPadX:=fadeLyr3StaticPicPad*-1, fadeLyr3StaticPicPadY:=0
  206. Else If fadeLyr3StaticPos = Bottom Left Corner
  207. fadeLyr3StaticPicPadX:=fadeLyr3StaticPicPad, fadeLyr3StaticPicPadY:=fadeLyr3StaticPicPad*-1
  208. Else If fadeLyr3StaticPos = Bottom Center
  209. fadeLyr3StaticPicPadX:=0, fadeLyr3StaticPicPadY:=fadeLyr3StaticPicPad*-1
  210. Else If fadeLyr3StaticPos = Bottom Right Corner
  211. fadeLyr3StaticPicPadX:=fadeLyr3StaticPicPad*-1, fadeLyr3StaticPicPadY:=fadeLyr3StaticPicPad*-1
  212. fadeLyr3StaticCanvasX := fadeLyr3StaticPicX + fadeLyr3StaticPicPadX , fadeLyr3StaticCanvasY := fadeLyr3StaticPicY + fadeLyr3StaticPicPadY
  213. fadeLyr3StaticCanvasW := fadeLyr3StaticPicW, fadeLyr3StaticCanvasH := fadeLyr3StaticPicH
  214. pGraphUpd(Fade_G3Static,fadeLyr3StaticCanvasW,fadeLyr3StaticCanvasH)
  215. Gdip_Alt_DrawImage(Fade_G3Static, fadeLyr3StaticPic, 0, 0, fadeLyr3StaticPicW, fadeLyr3StaticPicH)
  216. }
  217. ;====== Loading info about layer 3 image
  218. fadeInLyr3File := GetFadePicFile("Layer 3")
  219. If FileExist(fadeInLyr3File)
  220. { fadeLyr3Pic := Gdip_CreateBitmapFromFile(fadeInLyr3File)
  221. Gdip_GetImageDimensions(fadeLyr3Pic, fadeLyr3PicOrigW, fadeLyr3PicOrigH)
  222. if (!(fadeLyr3W)) and (!(fadeLyr3H)){
  223. fadeLyr3PicW := Round(fadeLyr3PicOrigW * fadeXScale * fadeLyr3Adjust)
  224. fadeLyr3PicH := Round(fadeLyr3PicOrigH * fadeYScale * fadeLyr3Adjust)
  225. } else if (fadeLyr3W) and (!(fadeLyr3H)){
  226. fadeLyr3PicH := Round( fadeLyr3PicH * (fadeLyr3PicW / Round(fadeLyr3PicW * fadeLyr3Adjust)) )
  227. fadeLyr3PicW := Round(fadeLyr3W * fadeLyr3Adjust)
  228. } else if (!(fadeLyr3W)) and (fadeLyr3H){
  229. fadeLyr3PicW := Round( fadeLyr3PicW * (fadeLyr3PicH / Round(fadeLyr3H * fadeLyr3Adjust)) )
  230. fadeLyr3PicH := Round(fadeLyr3H * fadeLyr3Adjust)
  231. } else {
  232. fadeLyr3PicW := Round(fadeLyr3W * fadeLyr3Adjust)
  233. fadeLyr3PicH := Round(fadeLyr3H * fadeLyr3Adjust)
  234. }
  235. GetFadePicPosition(fadeLyr3PicX,fadeLyr3PicY,fadeLyr3X,fadeLyr3Y,fadeLyr3PicW,fadeLyr3PicH,fadeLyr3Pos)
  236. If fadeLyr3Pos in No Alignment,Center,Top Left Corner
  237. fadeLyr3PicPadX:=fadeLyr3PicPad, fadeLyr3PicPadY:=fadeLyr3PicPad
  238. Else If fadeLyr3Pos = Top Center
  239. fadeLyr3PicPadX:=0, fadeLyr3PicPadY:=fadeLyr3PicPad
  240. Else If fadeLyr3Pos = Left Center
  241. fadeLyr3PicPadX:=fadeLyr3PicPad, fadeLyr3PicPadY:=0
  242. Else If fadeLyr3Pos = Top Right Corner
  243. fadeLyr3PicPadX:=fadeLyr3PicPad*-1, fadeLyr3PicPadY:=fadeLyr3PicPad
  244. Else If fadeLyr3Pos = Right Center
  245. fadeLyr3PicPadX:=fadeLyr3PicPad*-1, fadeLyr3PicPadY:=0
  246. Else If fadeLyr3Pos = Bottom Left Corner
  247. fadeLyr3PicPadX:=fadeLyr3PicPad, fadeLyr3PicPadY:=fadeLyr3PicPad*-1
  248. Else If fadeLyr3Pos = Bottom Center
  249. fadeLyr3PicPadX:=0, fadeLyr3PicPadY:=fadeLyr3PicPad*-1
  250. Else If fadeLyr3Pos = Bottom Right Corner
  251. fadeLyr3PicPadX:=fadeLyr3PicPad*-1, fadeLyr3PicPadY:=fadeLyr3PicPad*-1
  252. fadeLyr3PicX := fadeLyr3PicX+fadeLyr3PicPadX
  253. fadeLyr3PicY := fadeLyr3PicY+fadeLyr3PicPadY
  254. }
  255. ;====== Loading Gif Files
  256. GifAnimation := GetFadeGifFile("Anim")
  257. If GifAnimation
  258. {
  259. AnimatedGifControl_GetImageDimensions(GifAnimation, GifWidth, GifHeight)
  260. if (!(fadeLyr4W)) and (!(fadeLyr4H)){
  261. fadeLyr4PicW := Round(GifWidth * fadeXScale * fadeLyr4Adjust)
  262. fadeLyr4PicH := Round(GifHeight * fadeYScale * fadeLyr4Adjust)
  263. } else if (fadeLyr4W) and (!(fadeLyr4H)){
  264. fadeLyr4PicH := Round( GifHeight * (GifWidth / Round(GifWidth * fadeLyr4Adjust)) )
  265. fadeLyr4PicW := Round(fadeLyr4W * fadeLyr4Adjust)
  266. } else if (!(fadeLyr4W)) and (fadeLyr4H){
  267. fadeLyr4PicW := Round( GifWidth * (GifHeight / Round(fadeLyr4H * fadeLyr4Adjust)) )
  268. fadeLyr4PicH := Round(fadeLyr4H * fadeLyr4Adjust)
  269. } else {
  270. fadeLyr4PicW := Round(fadeLyr4W * fadeLyr4Adjust)
  271. fadeLyr4PicH := Round(fadeLyr4H * fadeLyr4Adjust)
  272. }
  273. If (fadeLyr4Pos = "Above Layer 3 - Left") {
  274. fadeLyr4PicX := fadeLyr3PicX
  275. fadeLyr4PicY := fadeLyr3PicY-fadeLyr4PicH
  276. } Else If (fadeLyr4Pos = "Above Layer 3 - Center") {
  277. fadeLyr4PicX := fadeLyr3PicX+fadeLyr3PicW/2
  278. fadeLyr4PicY := fadeLyr3PicY-fadeLyr4PicH
  279. } Else If (fadeLyr4Pos = "Above Layer 3 - Right") {
  280. fadeLyr4PicX := fadeLyr3PicX+fadeLyr3PicW-fadeLyr4PicX
  281. fadeLyr4PicY := fadeLyr3PicY-fadeLyr4PicH
  282. } Else {
  283. GetFadePicPosition(fadeLyr4PicX,fadeLyr4PicY,fadeLyr4X,fadeLyr4Y,fadeLyr4PicW,fadeLyr4PicH,fadeLyr4Pos)
  284. }
  285. fadeTranspGifColor := % "0x" . fadeTranspGifColor
  286. Gui, Fade_GifAnim_GUI: +OwnerFade_GUI3 -Caption +LastFound +ToolWindow +AlwaysOnTop
  287. GifAnim_GUI_ID := WinExist()
  288. Gui, Fade_GifAnim_GUI: Color, %fadeTranspGifColor%
  289. WinSet, TransColor, %fadeTranspGifColor% , ahk_id %GifAnim_GUI_ID%
  290. hAniGif1 := AniGif_CreateControl(GifAnim_GUI_ID, 0, 0, fadeLyr4PicW,fadeLyr4PicH, "center")
  291. }
  292. ;====== Loading Layer 4 Animation Files
  293. If !GifAnimation
  294. {
  295. FadeLayer4AnimFilesAr := GetFadeAnimFiles("Layer",4)
  296. If FadeLayer4AnimFilesAr.MaxIndex() > 0
  297. {
  298. For index, value in FadeLayer4AnimFilesAr
  299. {
  300. FadeLayer4Anim%a_index%Pic := Gdip_CreateBitmapFromFile(value)
  301. FadeLayer4AnimTotal := a_index
  302. }
  303. Gdip_GetImageDimensions(FadeLayer4Anim1Pic, fadeLyr4PicW, fadeLyr4PicH)
  304. if (!(fadeLyr4W)) and (!(fadeLyr4H)){
  305. fadeLyr4PicW := Round(fadeLyr4PicW * fadeLyr4Adjust)
  306. fadeLyr4PicH := Round(fadeLyr4PicH * fadeLyr4Adjust)
  307. } else if (fadeLyr4W) and (!(fadeLyr4H)){
  308. fadeLyr4PicH := Round( fadeLyr4PicH * (fadeLyr4PicW / Round(fadeLyr4PicW * fadeLyr4Adjust)) )
  309. fadeLyr4PicW := Round(fadeLyr4W * fadeLyr4Adjust)
  310. } else if (!(fadeLyr4W)) and (fadeLyr4H){
  311. fadeLyr4PicW := Round( fadeLyr4PicW * (fadeLyr4PicH / Round(fadeLyr4H * fadeLyr4Adjust)) )
  312. fadeLyr4PicH := Round(fadeLyr4H * fadeLyr4Adjust)
  313. } else {
  314. fadeLyr4PicW := Round(fadeLyr4W * fadeLyr4Adjust)
  315. fadeLyr4PicH := Round(fadeLyr4H * fadeLyr4Adjust)
  316. }
  317. If (fadeLyr4Pos = "Above Layer 3 - Left") {
  318. fadeLyr4PicX := fadeLyr3PicX
  319. fadeLyr4PicY := fadeLyr3PicY-fadeLyr4PicH
  320. } Else If (fadeLyr4Pos = "Above Layer 3 - Center") {
  321. fadeLyr4PicX := fadeLyr3PicX+fadeLyr3PicW/2
  322. fadeLyr4PicY := fadeLyr3PicY-fadeLyr4PicH
  323. } Else If (fadeLyr4Pos = "Above Layer 3 - Right") {
  324. fadeLyr4PicX := fadeLyr3PicX+fadeLyr3PicW-fadeLyr4PicX
  325. fadeLyr4PicY := fadeLyr3PicY-fadeLyr4PicH
  326. } Else {
  327. GetFadePicPosition(fadeLyr4PicX,fadeLyr4PicY,fadeLyr4X,fadeLyr4Y,fadeLyr4PicW,fadeLyr4PicH,fadeLyr4Pos)
  328. }
  329. }
  330. }
  331. ;Layer 4 padding
  332. If fadeLyr4PicX < baseScreenWidth//2
  333. fadeLyr4PicX := fadeLyr4PicX+fadeLyr4PicPad
  334. Else
  335. fadeLyr4PicX := fadeLyr4PicX-fadeLyr4PicPad
  336. If fadeLyr4PicY < baseScreenHeight//2
  337. fadeLyr4PicX := fadeLyr4PicX+fadeLyr4PicPad
  338. Else
  339. fadeLyr4PicX := fadeLyr4PicX-fadeLyr4PicPad
  340. ;====== Loading Bar options
  341. If ((fadeLyr3Type = "bar") or (fadeLyr3Type = "ImageAndBar")) and ((fadeBar="true") or ( (fadeBar="7zOnly") and ((found7z="true") and (7zEnabled = "true") and !7zTempRomExists and use7zAnimation)) )
  342. {
  343. ;Creating Progress Bar Brushes
  344. fadeBrushWindow1 := Gdip_CreateLineBrushFromRect(0, 0, fadeBarWindowW, fadeBarWindowH, 0xff555555, 0xff050505)
  345. fadeBrushWindow2 := Gdip_BrushCreateHatch(0xff000000, 0x00000000, fadeBarWindowHatchStyle)
  346. fadeBrushBarBack := Gdip_BrushCreateSolid("0x" . fadeBarBackColor)
  347. fadeBrushBar := Gdip_BrushCreateHatch(0x00000000, "0x" . fadeBarColor, fadeBarHatchStyle)
  348. if (fadeBarWindow="Image") {
  349. fadeLyr3ProgressBarFile := GetFadePicFile("Progress Bar")
  350. fadeLyr3ProgressBar := Gdip_CreateBitmapFromFile(fadeLyr3ProgressBarFile)
  351. Gdip_GetImageDimensions(fadeLyr3ProgressBar, fadeBarImageW, fadeBarImageH)
  352. if (!(fadeBarWindowW)) and (!(fadeBarWindowH)){
  353. fadeBarWindowW := fadeBarImageW
  354. fadeBarWindowH := fadeBarImageH
  355. } else if (fadeBarWindowW) and (!(fadeBarWindowH)){
  356. fadeBarWindowW := Round(fadeBarImageW*fadeXScale)
  357. fadeBarWindowH := Round(fadeBarImageH*fadeXScale)
  358. } else if (!(fadeBarWindowW)) and (fadeBarWindowH){
  359. fadeBarWindowW := Round(fadeBarImageW*fadeYScale)
  360. fadeBarWindowH := Round(fadeBarImageH*fadeYScale)
  361. } else {
  362. fadeBarWindowW := Round(fadeBarImageW*fadeXScale)
  363. fadeBarWindowH := Round(fadeBarImageH*fadeYScale)
  364. }
  365. }
  366. fadeBarW := fadeBarWindowW-2*fadeBarWindowM ; controls the bar's width, calculated from the bar window width and margin
  367. ;Progress Bar
  368. fadeBarX := fadeBarWindowM ; Relative to window update area
  369. yBar := (fadeBarWindowH-fadeBarH)//2 ; Relative to window update area
  370. ; Percentage Text
  371. Gdip_FontFamilyCreate(fadeFont) ; Creating font family
  372. ;Acquiring text font size
  373. Loop, parse, fadeText1Options, %A_Space%
  374. {
  375. If (InStr(A_LoopField, "s")=1)
  376. stringtrimleft, fadeText1Height, A_LoopField, 1
  377. }
  378. Loop, parse, fadeText2Options, %A_Space%
  379. {
  380. If (InStr(A_LoopField, "s")=1)
  381. stringtrimleft, fadeText2Height, A_LoopField, 1
  382. }
  383. If !fadeText1X
  384. fadeText1X := fadeBarX ; text1 X is set in relation to the bar X If not set by the user
  385. If !fadeText1Y
  386. fadeText1Y := round((fadeBarWindowH-fadeBarH)//2-1.5*fadeText1Height) ; text1 Y calculation If not set by the user
  387. If !fadeText2X
  388. fadeText2X := fadeBarWindowW-fadeBarWindowM ; text2 X calculation If not set by the user
  389. If !fadeText2Y
  390. fadeText2Y := round((fadeBarWindowH+fadeBarH)//2+0.5*fadeText2Height) ; text2 Y calculation If not set by the user
  391. ; Window Update Area
  392. If (fadeLyr3Type = "bar") {
  393. xTopLeft := If fadeBarWindowX ? fadeBarWindowX : (baseScreenWidth-fadeBarWindowW)//2 ; calculates where the X of the topleft corner of the bar window needs to be
  394. yTopLeft := If fadeBarWindowY ? fadeBarWindowY : (baseScreenHeight-fadeBarWindowH)//2 ; calculates where the Y of the topleft corner of the bar window needs to be
  395. } Else {
  396. xTopLeft := If fadeBarWindowX ? fadeBarWindowX : (baseScreenWidth-fadeBarWindowW)//2+fadeBarXOffset ; calculates where the X of the topleft corner of the bar window needs to be
  397. yTopLeft := If fadeBarWindowY ? fadeBarWindowY : (baseScreenHeight-fadeBarWindowH)//2+fadeBarYOffset ; calculates where the Y of the topleft corner of the bar window needs to be
  398. }
  399. } Else {
  400. xTopLeft := fadeLyr3PicX
  401. yTopLeft := fadeLyr3PicY
  402. }
  403. ;====== Loading extraction time text info
  404. If !fadeExtractionTimeTextX
  405. fadeExtractionTimeTextX := fadeBarWindowM ; text X calculation If not set by the user
  406. If !fadeExtractionTimeTextY
  407. fadeExtractionTimeTextY := round((fadeBarWindowH+fadeBarH)//2+0.5*fadeText2Height) ; text Y calculation If not set by the user
  408. ;====== Redefining Layer 3 to cover image plus bar size
  409. ; Defining Layer 3 update area
  410. If ((fadeLyr3Type = "bar") and ((fadeBar="true") or ( (fadeBar="7zOnly") and ((found7z="true") and (7zEnabled = "true") and !7zTempRomExists and use7zAnimation)) )){
  411. fadeLyr3CanvasX := xTopLeft
  412. fadeLyr3CanvasY := yTopLeft
  413. fadeLyr3CanvasW := fadeBarWindowW
  414. fadeLyr3CanvasH := fadeBarWindowH
  415. } Else If ((fadeLyr3Type = "ImageAndBar") and ((fadeBar="true") or ( (fadeBar="7zOnly") and ((found7z="true") and (7zEnabled = "true") and !7zTempRomExists and use7zAnimation)) )){
  416. fadeLyr3CanvasX := fadeLyr3PicX < xTopLeft ? fadeLyr3PicX : xTopLeft
  417. fadeLyr3CanvasY := fadeLyr3PicY < yTopLeft ? fadeLyr3PicY : yTopLeft
  418. fadeLyr3CanvasW := fadeLyr3PicX+fadeLyr3PicW-fadeLyr3CanvasX > xTopLeft+fadeBarWindowW-fadeLyr3CanvasX ? fadeLyr3PicX+fadeLyr3PicW-fadeLyr3CanvasX : xTopLeft+fadeBarWindowW-fadeLyr3CanvasX
  419. fadeLyr3CanvasH := fadeLyr3PicY+fadeLyr3PicH-fadeLyr3CanvasY > yTopLeft+fadeBarWindowH-fadeLyr3CanvasY ? fadeLyr3PicY+fadeLyr3PicH-fadeLyr3CanvasY : yTopLeft+fadeBarWindowH-fadeLyr3CanvasY
  420. } Else { ;(fadeLyr3Type = "image")
  421. fadeLyr3CanvasX := fadeLyr3PicX
  422. fadeLyr3CanvasY := fadeLyr3PicY
  423. fadeLyr3CanvasW := fadeLyr3PicW
  424. fadeLyr3CanvasH := fadeLyr3PicH
  425. }
  426. ;====== Rom Info Text
  427. romInfoText := [] ; 1,1 - romInfoText ; 1,2 romInfoTextContent ; 1,3 - romInfoTextFormatedContent ; 1,4 - romInfoTextOptions ; 1,5 - romInfoBitmap ; 1,6 - romInfoBitmapX ; 1,7 - romInfoBitmapY ; 1,8 - romInfoBitmapW ; 1,9 - romInfoBitmapH
  428. clearGameName := gameInfo["Name"].Value
  429. stringSplit, clearGameName, clearGameName, (
  430. clearGameName := clearGameName1
  431. Displacement := 0
  432. Loop, parse, fadeRomInfoOrder,|,
  433. {
  434. romInfoText[A_Index,1] := A_LoopField
  435. If (romInfoText[A_Index,1] = "Description") {
  436. descriptionTextIndex := A_Index
  437. romInfoText[A_Index,2] := gameInfo["Name"].Value
  438. If (fadeRomInfoDescription="filtered text") {
  439. romInfoText[A_Index,3] := clearGameName
  440. } else if (fadeRomInfoDescription="text") {
  441. romInfoText[A_Index,3] := romInfoText[A_Index,2]
  442. } else if (fadeRomInfoDescription="filtered text with label") {
  443. romInfoText[A_Index,3] := "Game: " . clearGameName
  444. } else if (fadeRomInfoDescription="text with label") {
  445. romInfoText[A_Index,3] := "Game: " . romInfoText[A_Index,2]
  446. }
  447. } Else If (romInfoText[A_Index,1] = "SystemName") {
  448. romInfoText[A_Index,2] := systemName
  449. If (fadeRomInfoSystemName="text with label") {
  450. romInfoText[A_Index,3] := "System: " . romInfoText[A_Index,2]
  451. } Else
  452. romInfoText[A_Index,3] := romInfoText[A_Index,2]
  453. } Else If (romInfoText[A_Index,1] = "Year") {
  454. yearTextIndex := A_Index
  455. romInfoText[A_Index,2] := gameInfo["Year"].Value
  456. If (fadeRomInfoYear="text with label") {
  457. romInfoText[A_Index,3] := "Year: " . romInfoText[A_Index,2]
  458. } Else
  459. romInfoText[A_Index,3] := romInfoText[A_Index,2]
  460. } Else If (romInfoText[A_Index,1] = "Manufacturer") {
  461. manufacturerTextIndex := A_Index
  462. romInfoText[A_Index,2] := gameInfo["Manufacturer"].Value
  463. If (fadeRomInfoManufacturer="text with label") {
  464. romInfoText[A_Index,3] := "Manufacturer: " . romInfoText[A_Index,2]
  465. } Else
  466. romInfoText[A_Index,3] := romInfoText[A_Index,2]
  467. } Else If (romInfoText[A_Index,1] = "Genre") {
  468. romInfoText[A_Index,2] := gameInfo["Genre"].Value
  469. If (fadeRomInfoGenre="text with label") {
  470. romInfoText[A_Index,3] := "Genre: " . romInfoText[A_Index,2]
  471. } Else
  472. romInfoText[A_Index,3] := romInfoText[A_Index,2]
  473. } Else If (romInfoText[A_Index,1] = "Rating") {
  474. romInfoText[A_Index,2] := gameInfo["Rating"].Value
  475. If (fadeRomInfoRating="text with label") {
  476. romInfoText[A_Index,3] := "Rating: " . romInfoText[A_Index,2]
  477. } Else
  478. romInfoText[A_Index,3] := romInfoText[A_Index,2]
  479. }
  480. }
  481. ; Resizing text if does not fit the defined width
  482. Loop, 6
  483. {
  484. currentRomInfoTextIndex := A_Index
  485. currentRomInfoTextType := "fadeRomInfo" . romInfoText[currentRomInfoTextIndex,1]
  486. if !((%currentRomInfoTextType%="Image")or(%currentRomInfoTextType%="Disabled")){
  487. RegExMatch(fadeRomInfoText%currentRomInfoTextIndex%Options, "i)W([\-\d\.]+)(p*)", Width)
  488. if Width
  489. {
  490. RegExMatch(fadeRomInfoText%currentRomInfoTextIndex%Options, "i)S([\-\d\.]+)(p*)", Size)
  491. StringReplace, textOptions, fadeRomInfoText%currentRomInfoTextIndex%Options, %Width%,
  492. Width := SubStr(Width, 2), FontSize := SubStr(Size, 2)
  493. textLength := MeasureText(romInfoText[currentRomInfoTextIndex,3],textOptions,fadeFont)
  494. if (textLength>Width) {
  495. loop,
  496. {
  497. StringReplace, textOptions, textOptions, % "S" . FontSize, % "S" . FontSize-5
  498. FontSize := FontSize - 5
  499. textLength := MeasureText(romInfoText[currentRomInfoTextIndex,3],textOptions,fadeFont)
  500. if (textLength<Width){
  501. fadeRomInfoText%currentRomInfoTextIndex%Options := RegExReplace(fadeRomInfoText%currentRomInfoTextIndex%Options, "i)S(\d+)(p*)", "s" . FontSize )
  502. RegExMatch(fadeRomInfoText%currentRomInfoTextIndex%Options, "i)Y([\-\d\.]+)(p*)", YPos)
  503. fadeRomInfoText%currentRomInfoTextIndex%Options := RegExReplace(fadeRomInfoText%currentRomInfoTextIndex%Options, "i)Y([\-\d\.]+)(p*)", "y" . Round(SubStr(YPos,2)+(5*A_Index)/2) )
  504. break
  505. }
  506. }
  507. }
  508. }
  509. }
  510. }
  511. ; Handling Rom Info images
  512. Loop, 6
  513. {
  514. currentRomInfoTextType := "fadeRomInfo" . romInfoText[A_Index,1]
  515. If (%currentRomInfoTextType%="Image") {
  516. If (romInfoText[A_Index,1] = "Description") {
  517. If romInfoText[A_Index,2]
  518. {
  519. If FileExist(HLMediaPath . "\Wheels\" . systemname . "\" . dbname . "\*.png") {
  520. fadeRomWheelImageList := []
  521. Loop, %HLMediaPath%\Wheels\%systemname%\%dbname%\*.png
  522. fadeRomWheelImageList.Insert(A_LoopFileFullPath)
  523. Random, RndmFadeRomWheelImage, 1, % fadeRomWheelImageList.MaxIndex()
  524. fadeRomWheelImage := FadeRomWheelImageList[RndmFadeRomWheelImage]
  525. imagePointer := Gdip_CreateBitmapFromFile(fadeRomWheelImage)
  526. } Else If FileExist( frontendPath . "\Media\" . systemName . "\Images\Wheel\" . dbname . ".png") {
  527. imagePointer := Gdip_CreateBitmapFromFile( frontendPath . "\Media\" . systemName . "\Images\Wheel\" . dbname . ".png" )
  528. }
  529. }
  530. } Else If (romInfoText[A_Index,1] = "SystemName") {
  531. If romInfoText[A_Index,2]
  532. {
  533. If FileExist(HLMediaPath . "\Wheels\" . systemname . "\_Default\*.png") {
  534. fadeSystemWheelImageList := []
  535. Loop, %HLMediaPath%\Wheels\%systemname%\_Default\*.png
  536. fadeSystemWheelImageList.Insert(A_LoopFileFullPath)
  537. Random, RndmFadeSystemWheelImage, 1, % fadeSystemWheelImageList.MaxIndex()
  538. fadeSystemWheelImage := fadeSystemWheelImageList[RndmFadeSystemWheelImage]
  539. imagePointer := Gdip_CreateBitmapFromFile(fadeSystemWheelImage)
  540. } Else If FileExist( frontendPath . "\Media\Main Menu\Images\Wheel\" . systemname . ".png") {
  541. imagePointer := Gdip_CreateBitmapFromFile( frontendPath . "\Media\Main Menu\Images\Wheel\" . systemname . ".png" )
  542. }
  543. }
  544. } Else {
  545. If romInfoText[A_Index,2]
  546. If FileExist( fadeImgPath . "\_Default\" . romInfoText[A_Index,1] . "\" . romInfoText[A_Index,2] . ".png" )
  547. imagePointer := Gdip_CreateBitmapFromFile( fadeImgPath . "\_Default\" . romInfoText[A_Index,1] . "\" . romInfoText[A_Index,2] . ".png" )
  548. }
  549. If imagePointer
  550. romInfoText[A_Index,5] := imagePointer
  551. }
  552. imagePointer :=
  553. }
  554. ;Defining Image W and H of images
  555. Loop, 6
  556. {
  557. currentRomInfoTextType := "fadeRomInfo" . romInfoText[A_Index,1]
  558. If (%currentRomInfoTextType%="Image") {
  559. RegExMatch(fadeRomInfoText%A_Index%Options, "i)W([\-\d\.]+)(p*)", UserDefinedW) ; getting w coordinates
  560. RegExMatch(fadeRomInfoText%A_Index%Options, "i)H([\-\d\.]+)(p*)", UserDefinedH) ; getting h coordinates
  561. stringtrimLeft, UserDefinedW, UserDefinedW, 1
  562. stringtrimLeft, UserDefinedH, UserDefinedH, 1
  563. Gdip_GetImageDimensions(romInfoText[A_Index,5], W, H)
  564. If ((UserDefinedW) and (UserDefinedH)){
  565. romInfoText[A_Index,8] := UserDefinedW
  566. romInfoText[A_Index,9] := UserDefinedH
  567. } Else If (UserDefinedW) {
  568. romInfoText[A_Index,8] := UserDefinedW
  569. romInfoText[A_Index,9] := round(H*UserDefinedW/W)
  570. } Else If (UserDefinedH) {
  571. romInfoText[A_Index,9] := UserDefinedH
  572. romInfoText[A_Index,8] := round(W*UserDefinedH/H)
  573. } Else {
  574. romInfoText[A_Index,8] := W
  575. romInfoText[A_Index,9] := H
  576. }
  577. }
  578. }
  579. If (fadeRomInfoTextPlacement="User Defined"){
  580. Loop, 6
  581. {
  582. currentRomInfoTextType := "fadeRomInfo" . romInfoText[A_Index,1]
  583. If ((%currentRomInfoTextType%="Text") or (%currentRomInfoTextType%="filtered text") or (%currentRomInfoTextType%="filtered text with label") or (%currentRomInfoTextType%="text with label"))
  584.  
  585. romInfoText[A_Index,4] := fadeRomInfoText%A_Index%Options
  586. Else If (%currentRomInfoTextType%="Image") {
  587. RegExMatch(fadeRomInfoText%A_Index%Options, "i)X([\-\d\.]+)(p*)", UserDefinedX) ; getting x coordinates
  588. RegExMatch(fadeRomInfoText%A_Index%Options, "i)Y([\-\d\.]+)(p*)", UserDefinedY) ; getting y coordinates
  589. stringtrimLeft, UserDefinedX, UserDefinedX, 1
  590. stringtrimLeft, UserDefinedY, UserDefinedY, 1
  591. romInfoText[A_Index,6] := UserDefinedX
  592. romInfoText[A_Index,7] := UserDefinedY
  593. If !UserDefinedX
  594. romInfoText[A_Index,6] := (baseScreenWidth-romInfoText[A_Index,8])//2
  595. If !UserDefinedY
  596. romInfoText[A_Index,7] := (baseScreenHeight-romInfoText[A_Index,9])//2
  597. }
  598. }
  599. } Else {
  600. Loop, 6
  601. {
  602. currentRomInfoTextType := "fadeRomInfo" . romInfoText[A_Index,1]
  603. If ((%currentRomInfoTextType%="Text") or (%currentRomInfoTextType%="filtered text") or (%currentRomInfoTextType%="filtered text with label") or (%currentRomInfoTextType%="text with label")) { ;parsing text options to remove x, y, W, H
  604.  
  605. romInfoText[A_Index,4] := RegExReplace(fadeRomInfoText%A_Index%Options, "i)X([\-\d\.]+)(p*)", " ") ; Removing x
  606. romInfoText[A_Index,4] := RegExReplace(romInfoText[A_Index,4], "i)Y([\-\d\.]+)(p*)", " ") ; Removing y
  607. romInfoText[A_Index,4] := RegExReplace(romInfoText[A_Index,4], "i)W([\-\d\.]+)(p*)", " ") ; Removing w
  608. romInfoText[A_Index,4] := RegExReplace(romInfoText[A_Index,4], "i)H([\-\d\.]+)(p*)", " ") ; Removing h
  609. romInfoText[A_Index,4] := RegExReplace(romInfoText[A_Index,4], "i)Top|Up|Bottom|Down|vCentre|vCenter", " ") ; Removing Align
  610. FoundPos := RegExMatch(romInfoText[A_Index,4], "i)S(\d+)(p*)", Size) ; Acquiring rom info font size
  611. StringTrimLeft, Size , Size,1
  612. maxromInfoTextSize := maxromInfoTextSize > Size ? maxromInfoTextSize : Size
  613. }
  614. }
  615. If (fadeRomInfoTextPlacement="corners"){
  616. romInfoText[1,4] := "x" . fadeRomInfoTextMargin . " y" . fadeRomInfoTextMargin . " Left " . romInfoText[1,4]
  617. romInfoText[1,6] := fadeRomInfoTextMargin
  618. romInfoText[1,7] := fadeRomInfoTextMargin
  619. romInfoText[2,4] := "x" . baseScreenWidth-fadeRomInfoTextMargin . " y" . fadeRomInfoTextMargin . " Right " . romInfoText[2,4]
  620. romInfoText[2,6] := baseScreenWidth-fadeRomInfoTextMargin-romInfoText[2,8]
  621. romInfoText[2,7] := fadeRomInfoTextMargin
  622. romInfoText[3,4] := "x" . fadeRomInfoTextMargin . " y" . baseScreenHeight-maxromInfoTextSize-fadeRomInfoTextMargin . " Left " . romInfoText[3,4]
  623. romInfoText[3,6] := fadeRomInfoTextMargin
  624. romInfoText[3,7] := baseScreenHeight-fadeRomInfoTextMargin-romInfoText[3,9]
  625. romInfoText[4,4] := "x" . baseScreenWidth-fadeRomInfoTextMargin . " y" . baseScreenHeight-maxromInfoTextSize-fadeRomInfoTextMargin . " Right " . romInfoText[4,4]
  626. romInfoText[4,6] := baseScreenWidth-fadeRomInfoTextMargin-romInfoText[4,8]
  627. romInfoText[4,7] := baseScreenHeight-fadeRomInfoTextMargin-romInfoText[4,9]
  628. romInfoText[5,4] := "x" . baseScreenWidth//2 . " y" . fadeRomInfoTextMargin . " Center " . romInfoText[5,4]
  629. romInfoText[5,6] := (baseScreenWidth-romInfoText[5,8])//2
  630. romInfoText[5,7] := fadeRomInfoTextMargin
  631. romInfoText[6,4] := "x" . baseScreenWidth//2 . " y" . baseScreenHeight-maxromInfoTextSize-fadeRomInfoTextMargin . " Center " . romInfoText[6,4]
  632. romInfoText[6,6] := (baseScreenWidth-romInfoText[6,8])//2
  633. romInfoText[6,7] := baseScreenHeight-fadeRomInfoTextMargin-romInfoText[6,9]
  634. } Else {
  635. Loop, 6
  636. {
  637. currentRomInfoTextType := "fadeRomInfo" . romInfoText[A_Index,1]
  638. If ((fadeRomInfoTextPlacement="bottomRight") or (fadeRomInfoTextPlacement="bottomLeft")) {
  639. If ((%currentRomInfoTextType%="Text") or (%currentRomInfoTextType%="filtered text") or (%currentRomInfoTextType%="filtered text with label") or (%currentRomInfoTextType%="text with label"))
  640.  
  641. Displacement := Displacement + (maxromInfoTextSize+10)
  642. Else If (%currentRomInfoTextType%="Image")
  643. Displacement := Displacement + ( romInfoText[A_Index,9] +10)
  644. }
  645. If (fadeRomInfoTextPlacement="topRight") {
  646. romInfoText[A_Index,4] := "x" . baseScreenWidth-fadeRomInfoTextMargin . " y" . Displacement+fadeRomInfoTextMargin . " Right " . romInfoText[A_Index,4]
  647. romInfoText[A_Index,6] := baseScreenWidth-fadeRomInfoTextMargin-romInfoText[A_Index,8]
  648. romInfoText[A_Index,7] := Displacement+fadeRomInfoTextMargin
  649. } Else If (fadeRomInfoTextPlacement="topLeft") {
  650. romInfoText[A_Index,4] := "x" . fadeRomInfoTextMargin . " y" . Displacement+fadeRomInfoTextMargin . " Left " . romInfoText[A_Index,4]
  651. romInfoText[A_Index,6] := fadeRomInfoTextMargin
  652. romInfoText[A_Index,7] := Displacement+fadeRomInfoTextMargin
  653. } Else If (fadeRomInfoTextPlacement="bottomRight") {
  654. romInfoText[A_Index,4] := "x" . baseScreenWidth-fadeRomInfoTextMargin . " y" . baseScreenHeight-Displacement-fadeRomInfoTextMargin . " Right " . romInfoText[A_Index,4]
  655. romInfoText[A_Index,6] := baseScreenWidth-fadeRomInfoTextMargin-romInfoText[A_Index,8]
  656. romInfoText[A_Index,7] := baseScreenHeight-fadeRomInfoTextMargin-Displacement
  657. } Else If (fadeRomInfoTextPlacement="bottomLeft") {
  658. romInfoText[A_Index,4] := "x" . fadeRomInfoTextMargin . " y" . baseScreenHeight-Displacement-fadeRomInfoTextMargin . " Left " . romInfoText[A_Index,4]
  659. romInfoText[A_Index,6] := fadeRomInfoTextMargin
  660. romInfoText[A_Index,7] := baseScreenHeight-fadeRomInfoTextMargin-Displacement
  661. }
  662. If ((fadeRomInfoTextPlacement="topRight") or (fadeRomInfoTextPlacement="topLeft")) {
  663. If ((%currentRomInfoTextType%="Text") or (%currentRomInfoTextType%="filtered text") or (%currentRomInfoTextType%="filtered text with label") or (%currentRomInfoTextType%="text with label"))
  664.  
  665. Displacement := Displacement + (maxromInfoTextSize+10)
  666. Else If (%currentRomInfoTextType%="Image")
  667. Displacement := Displacement + ( romInfoText[A_Index,9] +10)
  668. }
  669. }
  670. }
  671. }
  672. ;====== Statistics Info Text
  673. If !( (fadeRomInfoTextPlacement=fadestatsInfoTextPlacement) and ((fadeRomInfoTextPlacement="topRight") or (fadeRomInfoTextPlacement="topLeft") or (fadeRomInfoTextPlacement="bottomRight") or (fadeRomInfoTextPlacement="bottomLeft")) )
  674. Displacement := 0
  675. If (statisticsEnabled = "true"){
  676. If ((fadeStats_Number_of_Times_Played<>disabled) or (fadeStats_Last_Time_Played<>disabled) or (fadeStats_Average_Time_Played<>disabled) or (fadeStats_Total_Time_Played<>disabled) or (fadeStats_System_Total_Played_Time<>disabled) or (fadeStats_Total_Global_Played_Time<>disabled) ){
  677. ;Load statistics
  678. If (!romTable && mgCandidate)
  679. romTable := CreateRomTable(dbName)
  680. Totaldiscsofcurrentgame:=romTable.MaxIndex()
  681. If (Totaldiscsofcurrentgame>1)
  682. DescriptionNameWithoutDisc := romTable[1,4]
  683. Else
  684. DescriptionNameWithoutDisc := gameInfo["Name"].Value
  685. stringsplit, DescriptionNameSplit, DescriptionNameWithoutDisc, "(", ;Only game description name
  686. ClearDescriptionName := RegexReplace( DescriptionNameSplit1, "^\s+|\s+$" ) ; Statistics cleared game name
  687. IniRead, Number_of_Times_Played, % HLDataPath . "\Statistics\" . systemName . ".ini", % dbName, Number_of_Times_Played, 0
  688. IniRead, Last_Time_Played, % HLDataPath . "\Statistics\" . systemName . ".ini", % dbName, Last_Time_Played, 0
  689. IniRead, Average_Time_Played, % HLDataPath . "\Statistics\" . systemName . ".ini", % dbName, Average_Time_Played, 0
  690. IniRead, Total_Time_Played, % HLDataPath . "\Statistics\" . systemName . ".ini", % dbName, Total_Time_Played, 0
  691. IniRead, System_Total_Played_Time, % HLDataPath . "\Statistics\" . systemName . ".ini", General, System_Total_Played_Time, 0
  692. IniRead, Total_Global_Played_Time, % HLDataPath . "\Statistics\Global Statistics.ini", General, Total_Global_Played_Time, 0
  693. ;Formating stats
  694. If(Number_of_Times_Played=0)
  695. Number_of_Times_Played := "Never"
  696. Else If (Number_of_Times_Played=1)
  697. Number_of_Times_Played := Number_of_Times_Played . " time"
  698. Else
  699. Number_of_Times_Played := Number_of_Times_Played . " times"
  700. If(Last_Time_Played=0)
  701. Last_Time_Played := "Never"
  702. If (Average_Time_Played>0)
  703. Average_Time_Played := GetTimeString(Average_Time_Played) . " per session"
  704. Total_Time_Played := GetTimeString(Total_Time_Played)
  705. System_Total_Played_Time := GetTimeString(System_Total_Played_Time)
  706. Total_Global_Played_Time := GetTimeString(Total_Global_Played_Time)
  707. statsInfoText := []
  708. Loop, parse, fadeStatsInfoOrder,|,
  709. {
  710. statsInfoText[A_Index,1] := A_LoopField
  711. If (statsInfoText[A_Index,1] = "Number_of_Times_Played") {
  712. statsInfoText[A_Index,2] := Number_of_Times_Played
  713. If (fadeStats_Number_of_Times_Played="text with label") {
  714. statsInfoText[A_Index,3] := "Times Played: " . statsInfoText[A_Index,2]
  715. } Else
  716. statsInfoText[A_Index,3] := statsInfoText[A_Index,2]
  717. } Else If (statsInfoText[A_Index,1] = "Last_Time_Played") {
  718. statsInfoText[A_Index,2] := Last_Time_Played
  719. If (fadeStats_Last_Time_Played="text with label") {
  720. statsInfoText[A_Index,3] := "Last Time Played: " . statsInfoText[A_Index,2]
  721. } Else
  722. statsInfoText[A_Index,3] := statsInfoText[A_Index,2]
  723. } Else If (statsInfoText[A_Index,1] = "Average_Time_Played") {
  724. statsInfoText[A_Index,2] := Average_Time_Played
  725. If (fadeStats_Average_Time_Played="text with label") {
  726. statsInfoText[A_Index,3] := "Average Time Played: " . statsInfoText[A_Index,2]
  727. } Else
  728. statsInfoText[A_Index,3] := statsInfoText[A_Index,2]
  729. } Else If (statsInfoText[A_Index,1] = "Total_Time_Played") {
  730. statsInfoText[A_Index,2] := Total_Time_Played
  731. If (fadeStats_Total_Time_Played="text with label") {
  732. statsInfoText[A_Index,3] := "Total Time Played: " . statsInfoText[A_Index,2]
  733. } Else
  734. statsInfoText[A_Index,3] := statsInfoText[A_Index,2]
  735. } Else If (statsInfoText[A_Index,1] = "System_Total_Played_Time") {
  736. statsInfoText[A_Index,2] := System_Total_Played_Time
  737. If (fadeStats_System_Total_Played_Time="text with label") {
  738. statsInfoText[A_Index,3] := "System Total Played Time: " . statsInfoText[A_Index,2]
  739. } Else
  740. statsInfoText[A_Index,3] := statsInfoText[A_Index,2]
  741. } Else If (statsInfoText[A_Index,1] = "Total_Global_Played_Time") {
  742. statsInfoText[A_Index,2] := Total_Global_Played_Time
  743. If (fadeStats_Total_Global_Played_Time="text with label") {
  744. statsInfoText[A_Index,3] := "Total Global Played Time: " . statsInfoText[A_Index,2]
  745. } Else
  746. statsInfoText[A_Index,3] := statsInfoText[A_Index,2]
  747. }
  748. }
  749. If (fadeStatsInfoTextPlacement="User Defined"){
  750. Loop, 6
  751. {
  752. currentStatsInfoTextType := "fadeStats_" . statsInfoText[A_Index,1]
  753. If ((%currentStatsInfoTextType%="Text") or (%currentStatsInfoTextType%="text with label"))
  754. statsInfoText[A_Index,4] := fadeStatsInfoText%A_Index%Options
  755. }
  756. } Else {
  757. Loop, 6
  758. {
  759. currentStatsInfoTextType := "fadeStats_" . statsInfoText[A_Index,1]
  760. If ((%currentStatsInfoTextType%="Text") or (%currentStatsInfoTextType%="text with label")) { ;parsing text options to remove x, y, W, H
  761. statsInfoText[A_Index,4] := RegExReplace(fadeStatsInfoText%A_Index%Options, "i)X([\-\d\.]+)(p*)", " ") ; Removing x
  762. statsInfoText[A_Index,4] := RegExReplace(statsInfoText[A_Index,4], "i)Y([\-\d\.]+)(p*)", " ") ; Removing y
  763. statsInfoText[A_Index,4] := RegExReplace(statsInfoText[A_Index,4], "i)W([\-\d\.]+)(p*)", " ") ; Removing w
  764. statsInfoText[A_Index,4] := RegExReplace(statsInfoText[A_Index,4], "i)H([\-\d\.]+)(p*)", " ") ; Removing h
  765. statsInfoText[A_Index,4] := RegExReplace(statsInfoText[A_Index,4], "i)Top|Up|Bottom|Down|vCentre|vCenter", " ") ; Removing Align
  766. FoundPos := RegExMatch(statsInfoText[A_Index,4], "i)S(\d+)(p*)", Size) ; Acquiring stats info font size
  767. StringTrimLeft, Size , Size,1
  768. maxStatsInfoTextSize := maxStatsInfoTextSize > Size ? maxStatsInfoTextSize : Size
  769. }
  770. }
  771. If (fadestatsInfoTextPlacement="corners"){
  772. statsInfoText[1,4] := "x" . fadeStatsInfoTextMargin . " y" . fadeStatsInfoTextMargin . " Left " . statsInfoText[1,4]
  773. statsInfoText[2,4] := "x" . baseScreenWidth-fadeStatsInfoTextMargin . " y" . fadeStatsInfoTextMargin . " Right " . statsInfoText[2,4]
  774. statsInfoText[3,4] := "x" . fadeStatsInfoTextMargin . " y" . baseScreenHeight-maxstatsInfoTextSize-fadeStatsInfoTextMargin . " Left " . statsInfoText[3,4]
  775. statsInfoText[4,4] := "x" . baseScreenWidth-fadeStatsInfoTextMargin . " y" . baseScreenHeight-maxstatsInfoTextSize-fadeStatsInfoTextMargin . " Right " . statsInfoText[4,4]
  776. statsInfoText[5,4] := "x" . baseScreenWidth//2 . " y" . fadeStatsInfoTextMargin . " Center " . statsInfoText[5,4]
  777. statsInfoText[6,4] := "x" . baseScreenWidth//2 . " y" . baseScreenHeight-maxstatsInfoTextSize-fadeStatsInfoTextMargin . " Center " . statsInfoText[6,4]
  778. } Else {
  779. Loop, 6
  780. {
  781. If ((fadestatsInfoTextPlacement="bottomRight") or (fadestatsInfoTextPlacement="bottomLeft")) {
  782. if statsInfoText[A_Index,2]
  783. Displacement := Displacement + (maxstatsInfoTextSize+10)
  784. else if (A_Index=1)
  785. Displacement := (maxstatsInfoTextSize+10)
  786. }
  787. If (fadestatsInfoTextPlacement="topRight")
  788. statsInfoText[A_Index,4] := "x" . baseScreenWidth-fadeStatsInfoTextMargin . " y" . Displacement+fadeStatsInfoTextMargin . " Right " . statsInfoText[A_Index,4]
  789. Else If (fadestatsInfoTextPlacement="topLeft")
  790. statsInfoText[A_Index,4] := "x" . fadeStatsInfoTextMargin . " y" . Displacement+fadeStatsInfoTextMargin . " Left " . statsInfoText[A_Index,4]
  791. Else If (fadestatsInfoTextPlacement="bottomRight")
  792. statsInfoText[A_Index,4] := "x" . baseScreenWidth-fadeStatsInfoTextMargin . " y" . baseScreenHeight-Displacement-fadeStatsInfoTextMargin . " Right " . statsInfoText[A_Index,4]
  793. Else If (fadestatsInfoTextPlacement="bottomLeft")
  794. statsInfoText[A_Index,4] := "x" . fadeStatsInfoTextMargin . " y" . baseScreenHeight-Displacement-fadeStatsInfoTextMargin . " Left " . statsInfoText[A_Index,4]
  795. If ((fadestatsInfoTextPlacement="topRight") or (fadestatsInfoTextPlacement="topLeft")) {
  796. if statsInfoText[A_Index,2]
  797. Displacement := Displacement + (maxstatsInfoTextSize+10)
  798. }
  799. }
  800. }
  801. }
  802. }
  803. }
  804. ;====== Defining Drawing areas
  805. pGraphUpd(Fade_G3,fadeLyr3CanvasW,fadeLyr3CanvasH)
  806. fadeLyr4CanvasX := round(fadeLyr4PicX) , fadeLyr4CanvasY := round(fadeLyr4PicY)
  807. fadeLyr4CanvasW := round(fadeLyr4PicW), fadeLyr4CanvasH := round(fadeLyr4PicH)
  808. pGraphUpd(Fade_G4,fadeLyr4CanvasW,fadeLyr4CanvasH)
  809. fadeLyr5CanvasX := 0 , fadeLyr5CanvasY := 0
  810. fadeLyr5CanvasW := baseScreenWidth, fadeLyr5CanvasH := baseScreenHeight
  811. pGraphUpd(Fade_G5,fadeLyr5CanvasW,fadeLyr5CanvasH)
  812. ;====== Drawing Layer 3 Static
  813. Alt_UpdateLayeredWindow(Fade_hwnd3Static, Fade_hdc3Static,fadeLyr3StaticCanvasX,fadeLyr3StaticCanvasY, fadeLyr3StaticCanvasW, fadeLyr3StaticCanvasH)
  814. ;====== Drawing text info
  815. Loop, 6
  816. {
  817. currentRomInfoTextType := "fadeRomInfo" . romInfoText[A_Index,1]
  818. If ((%currentRomInfoTextType%="Text") or (%currentRomInfoTextType%="filtered text") or (%currentRomInfoTextType%="filtered text with label") or (%currentRomInfoTextType%="text with label")) {
  819. If romInfoText[A_Index,2]
  820. Gdip_Alt_TextToGraphics(Fade_G5, romInfoText[A_Index,3], romInfoText[A_Index,4], fadeFont, 0, 0)
  821. } Else If (%currentRomInfoTextType%="Image") {
  822. If romInfoText[A_Index,2]
  823. Gdip_Alt_DrawImage(Fade_G5, romInfoText[A_Index,5], romInfoText[A_Index,6], romInfoText[A_Index,7], romInfoText[A_Index,8], romInfoText[A_Index,9])
  824. }
  825. }
  826. ; Drawing Statistics text info
  827. If (statisticsEnabled = "true"){
  828. Loop, 6
  829. {
  830. currentStatsInfoTextType := "fadeStats_" . statsInfoText[A_Index,1]
  831. If ((%currentStatsInfoTextType%="Text") or (%currentStatsInfoTextType%="text with label"))
  832. If statsInfoText[A_Index,2]
  833. Gdip_Alt_TextToGraphics(Fade_G5, statsInfoText[A_Index,3], statsInfoText[A_Index,4], fadeFont, 0, 0)
  834. }
  835. }
  836. Alt_UpdateLayeredWindow(Fade_hwnd5, Fade_hdc5,fadeLyr5CanvasX,fadeLyr5CanvasY, fadeLyr5CanvasW, fadeLyr5CanvasH)
  837. ;====== drawing animated gif
  838. If GifAnimation
  839. SetTimer, FadeLayer4Anim, -1
  840. Else If (FadeLayer4AnimFilesAr.MaxIndex() > 0)
  841. SetTimer, FadeLayer4Anim, %fadeLyr4FPS%
  842. ;====== Defining Progress Bar Update for non 7z
  843. timeToMax := fadeLyr3Speed / fadeLyr3Repeat ; calculate how long layer 3 needs to take to show 100% of the image
  844. ; update fadeInExitDelay value to assure that the fadeLyr3 animation finishes before exiting fade
  845. If (((fadeLyr3Type = "Image") or (fadeLyr3Type = "ImageAndBar")) and (fadeInLyr3File) and (fadeLyr3Repeat))
  846. if (fadeLyr3Speed>fadeInDelay+fadeInExitDelay)
  847. fadeInExitDelay := fadeInExitDelay + fadeLyr3Speed-(fadeInDelay+fadeInExitDelay)
  848. ;Defining Progress Bar Update Time
  849. If ((fadeLyr3Type = "bar") or (fadeLyr3Type = "ImageAndBar")) and (fadeBar="true")
  850. progressBarTimeToMax := if (fadeBarNon7zProgressTime) ? fadeBarNon7zProgressTime : (fadeInDelay+fadeInExitDelay)
  851. ;======checking for extraction and loading sound
  852. If ((found7z="true" and 7zEnabled = "true" and !7zTempRomExists and use7zAnimation) or (hlmode="fade7z")) and (7zSounds = "true") {
  853. If not (fadeLyr3Type = image and fadeLyr3ImgFollow7zProgress = false) {
  854. If FileExist( HLMediaPath . "\Fade\" . SystemName . "\" . dbName . "\7z extracting.mp3")
  855. extractionSound := HLMediaPath . "\Fade\" . SystemName . "\" . dbName . "\7z extracting.mp3"
  856. Else If FileExist( HLMediaPath . "\Fade\" . SystemName . "\_Default\7z extracting.mp3")
  857. extractionSound := HLMediaPath . "\Fade\" . SystemName . "\_Default\7z extracting.mp3"
  858. Else If FileExist( HLMediaPath . "\Fade\_Default\7z extracting.mp3")
  859. extractionSound := HLMediaPath . "\Fade\_Default\7z extracting.mp3"
  860. If extractionSound {
  861. Log("DefaultFadeAnimation - Playing " . extractionSound)
  862. SoundPlay, %extractionSound%
  863. }
  864. }
  865. } else {
  866. If FileExist( HLMediaPath . "\Fade\" . SystemName . "\" . dbName . "\loading.mp3")
  867. loadingSound := HLMediaPath . "\Fade\" . SystemName . "\" . dbName . "\loading.mp3"
  868. Else If FileExist( HLMediaPath . "\Fade\" . SystemName . "\_Default\loading.mp3")
  869. loadingSound := HLMediaPath . "\Fade\" . SystemName . "\_Default\loading.mp3"
  870. Else If FileExist( HLMediaPath . "\Fade\_Default\loading.mp3")
  871. loadingSound := HLMediaPath . "\Fade\_Default\loading.mp3"
  872. If loadingSound {
  873. Log("DefaultFadeAnimation - Playing " . loadingSound)
  874. SoundPlay, %loadingSound%
  875. }
  876. }
  877. ;==== Create timer to update layer 3
  878. SetTimer, _DefaultFadeAnimationLoop, 50
  879. startTime := A_TickCount
  880. layer3startTime := A_TickCount
  881. If fadeInActive
  882. GoSub, FadeInDelay ; This must always be at the end of all animation functions. It's a simple timer that will force the GUI to stay up the defined amount of delay If the animation was shorter then said delay.
  883. Log("DefaultFadeAnimation - Ended")
  884. Return
  885.  
  886. _DefaultFadeAnimationLoop:
  887. if (!fadeInActive or fadeInExitComplete) {
  888. Log("DefaultFadeAnimationLoop - " . (If fadeInExitComplete ? "FadeInExit completed" : "FadeIn is no longer active") . ", stopping DefaultFadeAnimationLoop",4)
  889. SetTimer, _DefaultFadeAnimationLoop, Off
  890. }
  891. if AnimationLoopFinished {
  892. Log("DefaultFadeAnimationLoop - AnimationLoop has finished",4)
  893. SetTimer, _DefaultFadeAnimationLoop, Off
  894. Alt_UpdateLayeredWindow(Fade_hwnd3, Fade_hdc3,fadeLyr3CanvasX,fadeLyr3CanvasY, fadeLyr3CanvasW, fadeLyr3CanvasH)
  895. ; stopping extraction sound and checking for complete sound
  896. If ((found7z="true" and 7zEnabled = "true" and !7zTempRomExists and use7zAnimation) or (hlmode="fade7z")) and (7zSounds = "true") {
  897. If extractionSound
  898. SoundPlay, blank.mp3 ; playing non existent file to stop extraction sound.
  899. If FileExist( HLMediaPath . "\Fade\" . SystemName . "\" . dbName . "\7z complete.mp3")
  900. completeSound := HLMediaPath . "\Fade\" . SystemName . "\" . dbName . "\7z complete.mp3"
  901. Else If FileExist( HLMediaPath . "\Fade\" . SystemName . "\_Default\7z complete.mp3")
  902. completeSound := HLMediaPath . "\Fade\" . SystemName . "\_Default\7z complete.mp3"
  903. Else If FileExist( HLMediaPath . "\Fade\_Default\7z complete.mp3")
  904. completeSound := HLMediaPath . "\Fade\_Default\7z complete.mp3"
  905. If completeSound {
  906. Log("DefaultFadeAnimationLoop - Playing " . completeSound)
  907. SoundPlay, %completeSound%
  908. }
  909. } else {
  910. If loadingSound
  911. SoundPlay, blank.mp3 ; playing non existent file to stop extraction sound.
  912. If FileExist( HLMediaPath . "\Fade\" . SystemName . "\" . dbName . "\loading complete.mp3")
  913. loadingSound := HLMediaPath . "\Fade\" . SystemName . "\" . dbName . "\loading complete.mp3"
  914. Else If FileExist( HLMediaPath . "\Fade\" . SystemName . "\_Default\loading complete.mp3")
  915. loadingSound := HLMediaPath . "\Fade\" . SystemName . "\_Default\loading complete.mp3"
  916. Else If FileExist( HLMediaPath . "\Fade\_Default\loading complete.mp3")
  917. loadingSound := HLMediaPath . "\Fade\_Default\loading complete.mp3"
  918. If loadingSound {
  919. Log("DefaultFadeAnimationLoop - Playing " . loadingSound)
  920. SoundPlay, %loadingSound%
  921. }
  922. }
  923. Log("DefaultFadeAnimationLoop - Ended",4)
  924. }
  925. ;====== Begin of animation Loop
  926. Gdip_GraphicsClear(Fade_G3)
  927. ;====== Updating 7z extraction info
  928. If (((found7z="true") and (7zEnabled = "true") and !(7zTempRomExists) and (use7zAnimation)) and !(hlmode="fade7z")) {
  929. If not (fadeLyr3Type = image and fadeLyr3ImgFollow7zProgress = false) {
  930. romExPercentageAndFile := COM_Invoke(HLObject, "getExtractionSize", 7zRomPath, 0) ; Get the current file being extracted and size of the 7z Extract Path - (Extraction Size\Progress (0=Accurate Method, 1=Fast Detection Method))
  931. Loop, Parse, romExPercentageAndFile, | ; StringSplit oddly doesn't work for some unknown reason, must resort to a parsing Loop instead
  932. {
  933. If A_Index = 1
  934. {
  935. romExCurSize := A_LoopField ; Store bytes extracted
  936. romExPercentage := (A_LoopField / romExSize) * 100 ; Calculate percentage extracted
  937. } Else If A_Index = 2
  938. romExFile := A_LoopField
  939. }
  940. layer3Percentage := romExPercentage
  941. }
  942. } else { ; to be used for drawing the progress bar on non 7z fade or in hlmode "fade"
  943. timeElapsed := A_TickCount - startTime
  944. layer3TimeElapsed := A_TickCount - layer3startTime
  945. romExPercentage := (timeElapsed < progressBarTimeToMax) ? Round((timeElapsed / progressBarTimeToMax)*100) : 100
  946. if !fadeLyr3Drawn
  947. layer3Percentage := (layer3TimeElapsed < timeToMax) ? Round((layer3TimeElapsed / timeToMax)*100) : 100
  948. }
  949. ;====== Drawing layer 3 image
  950. If (fadeLyr3Type = "Image") or (fadeLyr3Type = "ImageAndBar")
  951. {
  952. IfExist, % fadeInLyr3File
  953. {
  954. If fadeLyr3Repeat != 0 ; Only Loop animation If user does not want a static image
  955. {
  956. if fadeLyr3BackImageTransparency
  957. Gdip_Alt_DrawImage(Fade_G3, fadeLyr3Pic, fadeLyr3PicX-fadeLyr3CanvasX, fadeLyr3PicY-fadeLyr3CanvasY, fadeLyr3PicW, fadeLyr3PicH, , , , , fadeLyr3BackImageTransparency/100) ; draw layer 3 image with transparency
  958. If (found7z="true") and (7zEnabled = "true") and (fadeLyr3ImgFollow7zProgress="true") and !7zTempRomExists and use7zAnimation {
  959. Gdip_Alt_DrawImage(Fade_G3, fadeLyr3Pic, fadeLyr3PicX-fadeLyr3CanvasX, fadeLyr3PicY-fadeLyr3CanvasY, round(fadeLyr3PicW*layer3Percentage/100), fadeLyr3PicH, 0, 0, Round(fadeLyr3PicOrigW*layer3Percentage/100), fadeLyr3PicOrigH) ; draw layer 3 image onto screen on layer 3 and adjust the size If set
  960. If (layer3Percentage >= 100){
  961. If 7zEnded
  962. fadeLyr3Drawn := true
  963. 7zEnded=1 ; Often on small archives, 7z.exe ends so fast, it doesn't give us the chance to show 100% completion. By looping a 2nd time after 7z.exe is closed, the 2nd Loop after 7zEnded, sets the percentage to 100%.
  964. }
  965. } Else {
  966. If (t1 < 100 and fadeLyr3DrawnTimes<fadeLyr3Repeat) {
  967. t1 := ((timeElapsed := A_TickCount - layer3startTime) < timeToMax) ? timeElapsed / timeToMax : 100
  968. Gdip_Alt_DrawImage(Fade_G3, fadeLyr3Pic, fadeLyr3PicX-fadeLyr3CanvasX, fadeLyr3PicY-fadeLyr3CanvasY, fadeLyr3PicW*t1, fadeLyr3PicH, 0, 0, fadeLyr3PicOrigW*t1, fadeLyr3PicOrigH) ; draw layer 3 image onto screen on layer 3 and adjust the size If set
  969. } Else {
  970. layer3startTime := A_TickCount ; reset on each Loop
  971. fadeLyr3DrawnTimes++
  972. t1 := 0
  973. If (fadeLyr3DrawnTimes>=fadeLyr3Repeat) {
  974. fadeLyr3Drawn := true
  975. Gdip_Alt_DrawImage(Fade_G3, fadeLyr3Pic, fadeLyr3PicX-fadeLyr3CanvasX, fadeLyr3PicY-fadeLyr3CanvasY, fadeLyr3PicW, fadeLyr3PicH) ; draw layer 3 image onto screen on layer 3 and adjust the size If set
  976. }
  977. }
  978. }
  979. } Else If !fadeLyr3Drawn { ; If fadeLyr3Repeat is set to 0 (a static image), just show it, rather then animate
  980. Gdip_Alt_DrawImage(Fade_G3, fadeLyr3Pic, fadeLyr3PicX-fadeLyr3CanvasX, fadeLyr3PicY-fadeLyr3CanvasY, fadeLyr3PicW, fadeLyr3PicH) ; draw layer 3 image onto screen on layer 3 and adjust the size If set
  981. fadeLyr3Drawn := true
  982. }
  983. } Else {
  984. fadeLyr3Drawn := true
  985. }
  986. } Else {
  987. fadeLyr3Drawn := true
  988. }
  989. ;====== Drawing Bar
  990. If ((fadeLyr3Type = "bar") or (fadeLyr3Type = "ImageAndBar")) and ((fadeBar="true") or ( (fadeBar="7zOnly") and ((found7z="true") and (7zEnabled = "true") and !7zTempRomExists and use7zAnimation)) )
  991. {
  992. ; Bar Window
  993. if (fadeBarWindow="Image") {
  994. Gdip_Alt_DrawImage(Fade_G3, fadeLyr3ProgressBar, xTopLeft-fadeLyr3CanvasX, yTopLeft-fadeLyr3CanvasY, fadeBarWindowW, fadeBarWindowH)
  995. } else if (fadeBarWindow="GDI") {
  996. Gdip_Alt_FillRoundedRectangle(Fade_G3, fadeBrushWindow1, xTopLeft-fadeLyr3CanvasX, yTopLeft-fadeLyr3CanvasY, fadeBarWindowW, fadeBarWindowH, fadeBarWindowR)
  997. Gdip_Alt_FillRoundedRectangle(Fade_G3, fadeBrushWindow2, xTopLeft-fadeLyr3CanvasX, yTopLeft-fadeLyr3CanvasY, fadeBarWindowW, fadeBarWindowH, fadeBarWindowR)
  998. }
  999. ; Bar Background
  1000. If (fadeBarBack = "true")
  1001. Gdip_Alt_FillRoundedRectangle(Fade_G3, fadeBrushBarBack, xTopLeft+fadeBarX-fadeLyr3CanvasX, yTopLeft+yBar-fadeLyr3CanvasY, fadeBarW, fadeBarH, fadeBarR)
  1002. ; Progress Bar
  1003. percentage := romExPercentage
  1004. If percentage > 100
  1005. percentage := 100
  1006. If(fadeBarW*percentage/100<3*fadeBarR) ; avoiding glitch in rounded rectangle drawing when they are too small
  1007. currentRBar := fadeBarR * ((fadeBarW*percentage/100)/(3*fadeBarR))
  1008. Else
  1009. currentRBar := fadeBarR
  1010. If (fadeBarPercentageText = "true")
  1011. Gdip_Alt_TextToGraphics(Fade_G3, round(percentage) . "%", "x" round(xTopLeft+fadeText1X+fadeBarW*percentage/100)-fadeLyr3CanvasX " y" yTopLeft+fadeText1Y-fadeLyr3CanvasY . " " . fadeText1Options, fadeFont, 0, 0)
  1012. If percentage < 100
  1013. {
  1014. If (fadeBarInfoText = "true")
  1015. {
  1016. if (found7z="true") and (7zEnabled = "true") and !7zTempRomExists and use7zAnimation
  1017. Gdip_Alt_TextToGraphics(Fade_G3, fadeText1, "x" xTopLeft+fadeText2X-fadeLyr3CanvasX " y" yTopLeft+fadeText2Y-fadeLyr3CanvasY . " " . fadeText1Options, fadeFont, 0, 0)
  1018. else
  1019. Gdip_Alt_TextToGraphics(Fade_G3, fadeText3, "x" xTopLeft+fadeText2X-fadeLyr3CanvasX " y" yTopLeft+fadeText2Y-fadeLyr3CanvasY . " " . fadeText1Options, fadeFont, 0, 0)
  1020. }
  1021. If !(fadeExtractionTime="Disabled") {
  1022. extractionElapsedTime := (A_TickCount - startTime)//1000
  1023. if ((fadeExtractionTime="Remaining Time") or (fadeExtractionTime="Labeled Remaining Time")){
  1024. if (timerUpdate + 250 < A_TickCount) {
  1025. timerUpdate := A_TickCount
  1026. tempExtractionRemainingTime := extractionElapsedTime *(100 / percentage - 1)
  1027. extractionRemainingTime := ((tempExtractionRemainingTime - extractionRemainingTime) > 0 and (tempExtractionRemainingTime - extractionRemainingTime) < 6) ? extractionRemainingTime : tempExtractionRemainingTime
  1028. extractionTimeText := (fadeExtractionTime="Labeled Remaining Time") ? "Remaining Time: " . GetTimeString(round(extractionRemainingTime)) : GetTimeString(round(extractionRemainingTime))
  1029. if (stabilityThreshold<4)
  1030. {
  1031. diff := (prevExtractionRemainingTime - extractionRemainingTime)
  1032. if (diff > 0)
  1033. stabilityThreshold++
  1034. else if (diff < 0)
  1035. stabilityThreshold:=0
  1036. extractionTimeText := "Calculating..."
  1037. }
  1038. prevExtractionRemainingTime := extractionRemainingTime
  1039. }
  1040. } else
  1041. extractionTimeText := (fadeExtractionTime="Labeled Elapsed Time") ? "Elapsed Time: " . GetTimeString(extractionElapsedTime) : GetTimeString(extractionElapsedTime)
  1042. Gdip_Alt_TextToGraphics(Fade_G3, extractionTimeText, "x" xTopLeft+fadeExtractionTimeTextX-fadeLyr3CanvasX " y" yTopLeft+fadeExtractionTimeTextY-fadeLyr3CanvasY . " " . fadeExtractionTimeTextOptions, fadeFont, 0, 0)
  1043. }
  1044. } Else { ; bar is at 100%
  1045. finishedBar:= 1
  1046. Log("DefaultFadeAnimationLoop - Progress bar reached 100%",4)
  1047. If (fadeBarInfoText = "true")
  1048. {
  1049. if (found7z="true") and (7zEnabled = "true") and !7zTempRomExists and use7zAnimation
  1050. Gdip_Alt_TextToGraphics(Fade_G3, fadeText2, "x" xTopLeft+fadeText2X-fadeLyr3CanvasX " y" yTopLeft+fadeText2Y-fadeLyr3CanvasY . " " . fadeText2Options, fadeFont, 0, 0)
  1051. else
  1052. Gdip_Alt_TextToGraphics(Fade_G3, fadeText4, "x" xTopLeft+fadeText2X-fadeLyr3CanvasX " y" yTopLeft+fadeText2Y-fadeLyr3CanvasY . " " . fadeText2Options, fadeFont, 0, 0)
  1053. }
  1054. }
  1055. Gdip_Alt_FillRoundedRectangle(Fade_G3, fadeBrushBar, xTopLeft+fadeBarX-fadeLyr3CanvasX, yTopLeft+yBar-fadeLyr3CanvasY, fadeBarW*percentage/100, fadeBarH,currentRBar)
  1056. Process, Exist, 7z.exe ; This breaks out of 7z.exe If it's no longer running. Sometimes an extraction was very quick or there was an error and we don't want to be stuck in an infinite Loop
  1057. If (!ErrorLevel and fadeLyr3Drawn) ; bar is at 100% or 7z is already closed or user interrupted fade, so break out
  1058. If (((found7z="true") and (7zEnabled = "true") and !(7zTempRomExists) and (use7zAnimation)) and !(hlmode="fade7z")) {
  1059. Log("DefaultFadeAnimationLoop - 7z already finished or user interrupted fade, so animation loop is finished.",4)
  1060. AnimationLoopFinished := true
  1061. }
  1062. If (fadeLyr3Drawn and (finishedBar or !fadeInActive)) {
  1063. Log("DefaultFadeAnimationLoop - Fade Layer 3 is drawn and " . (If finishedBar ? "Extraction bar is at 100%" : "FadeIn is not active") . " so animation loop is finished.",4)
  1064. AnimationLoopFinished := true
  1065. }
  1066. } Else {
  1067. If fadeLyr3Drawn {
  1068. Log("DefaultFadeAnimationLoop - Fade Layer 3 is drawn so animation loop is finished.",4)
  1069. AnimationLoopFinished := true
  1070. }
  1071. }
  1072. Alt_UpdateLayeredWindow(Fade_hwnd3, Fade_hdc3,fadeLyr3CanvasX,fadeLyr3CanvasY, fadeLyr3CanvasW, fadeLyr3CanvasH)
  1073. Return
  1074.  
  1075. ; Simple Hello World Fade Code Tutorial
  1076. HelloWorldCustomFadeAnimation:
  1077. ;====== Initializing Fade Code
  1078. fadeInActive=1
  1079. ;====== Start Loop to draw Hello World text and update 7z extraction percentage If necessary
  1080. Loop {
  1081. Gdip_GraphicsClear(Fade_G3)
  1082. ; Updating 7z extraction info
  1083. If (found7z="true") and (7zEnabled = "true") and !7zTempRomExists {
  1084. SetFormat, Float, 3 ; don't want to show decimal places in the percentage
  1085. romExPercentageAndFile := COM_Invoke(HLObject, "getExtractionSize", 7zRomPath, 0) ; Get the current file being extracted and size of the 7z Extract Path - (Extraction Size\Progress (0=Accurate Method, 1=Fast Detection Method))
  1086. Loop, Parse, romExPercentageAndFile, | ; StringSplit oddly doesn't work for some unknown reason, must resort to a parsing Loop instead
  1087. {
  1088. If A_Index = 1
  1089. {
  1090. romExCurSize := A_LoopField ; Store bytes extracted
  1091. romExPercentage := (A_LoopField / romExSize) * 100 ; Calculate percentage extracted
  1092. } Else If A_Index = 2
  1093. romExFile := A_LoopField
  1094. }
  1095. }
  1096. ; Defining text to be shown
  1097. FadeOutputText = Hello World
  1098. If (found7z="true") and (7zEnabled = "true") and !7zTempRomExists
  1099. FadeOutputText := % "Hello World`n Extracting file: " . romExFile . "`nPercentage Extracted: " . romExPercentage . "%"
  1100. ; Calculating the text position centered at the screen
  1101. fadeLyr3CanvasW := MeasureText(FadeOutputText, "s40 Bold","Arial")+20 ; Length of the text
  1102. fadeLyr3CanvasH := 40 ; Font Size
  1103. If (found7z="true") and (7zEnabled = "true") and !7zTempRomExists
  1104. fadeLyr3CanvasH := 140
  1105. fadeLyr3CanvasX := (baseScreenWidth-fadeLyr3CanvasW)//2
  1106. fadeLyr3CanvasY := (baseScreenHeight-fadeLyr3CanvasH)//2
  1107. ; Creating the GDI+ text element
  1108. Gdip_Alt_TextToGraphics(Fade_G3, FadeOutputText, "x" fadeLyr3CanvasW//2 " y0 Bold Center cFFffffff r4 s40", "Arial", 0, 0)
  1109. ; Showing the Hello World text
  1110. Alt_UpdateLayeredWindow(Fade_hwnd3, Fade_hdc3,fadeLyr3CanvasX,fadeLyr3CanvasY, fadeLyr3CanvasW, fadeLyr3CanvasH)
  1111. ; Breaking animation Loop
  1112. Process, Exist, 7z.exe ; This breaks out of 7z.exe If it's no longer running. Sometimes an extraction was very quick or there was an error and we don't want to be stuck in an infinite Loop
  1113. If (!ErrorLevel or (romExPercentage >= 100) or !fadeInActive) ; bar is at 100% or 7z is already closed or user interrupted fade, so break out
  1114. Break
  1115. }
  1116. ; Assuring that fade remains active for the amount of time defined at the fade delay variable
  1117. If fadeInActive
  1118. GoSub, FadeInDelay
  1119. Return
  1120.  
  1121. ; Blank animation which can be used with legacy transition
  1122. NoAnimation:
  1123. Log("NoAnimation - No Animation selected for Fade")
  1124. GoSub, FadeInDelay ; This must always be at the end of all animation functions. It's a simple timer that will force the GUI to stay up the defined amount of delay If the animation was shorter then said delay.
  1125. Return
  1126.  
  1127. ;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  1128. ;------------------------------------------------------------ USER CUSTOM ANIMATIONS AND TRANSITIONS BELOW THIS LINE ------------------------------------------------------------
  1129. ;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  1130.  
  1131. MyFirstAnimation:
  1132. Log("MyFirstAnimation - Started")
  1133. Log("MyFirstAnimation - Ended")
  1134. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement