-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCREATE_BOOT_LOGO.cmd
161 lines (161 loc) · 6.51 KB
/
CREATE_BOOT_LOGO.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
@echo off
Author Deepak (@HumanBoy23)
echo.&echo.
SET tool_version="Splash Maker (Redmi Note 6 Pro) v2 04-08-2022"
TITLE Splash Maker (Redmi Note 6 Pro)
:main
:: Boot Logo (splash) size/resolution
SET logo_resolution="1080*2160"
::
:: Device screen size/resoultion
SET device_resolution="1080*2280"
::
:: Setting and creation of folders
::
:: User will add his desired image(s) files inside pics folder
IF NOT EXIST "pics" MKDIR pics
::
:: Script will store some temporary files in temp folder
IF NOT EXIST "temp" MKDIR temp
::
:: Output location of custom boot logo
IF NOT EXIST "splash_new" MKDIR splash_new
:: Header for empty file at start of splash.img
IF NOT EXIST bin\header.img fsutil file createnew bin\header.img 16384
:: Small.img - Will be appended after dd removes curse given by ffmpeg to bmp files
IF NOT EXIST bin\small.img fsutil file createnew bin\small.img 259
:: Required softwares - dd for windows and ffmpeg for windows
IF NOT EXIST bin\dd.exe (goto missing_warning)
IF NOT EXIST bin\ffmpeg.exe (goto missing_warning)
cls
echo.&echo.
echo Splash Maker for Redmi Note 6 Pro (Tulip) & echo. Device Resoultion: %device_resolution% Boot Logo Resolution: %logo_resolution% & echo.
echo Press Enter to generate splash
pause >nul
cls
:: Verifying files
::
:: boot file set as empty
SET boot="not_found"
:: will change boot variable to boot.png if found
IF EXIST pics\boot.png SET boot="boot.png"
:: if boot.png is not found it will check for boot.jpg
IF %boot%=="not_found" (goto check_bootis_jpg)
:: after failure to find boot.png, script checks for boot.jpg
:check_bootis_jpg
IF EXIST pics\boot.jpg SET boot="boot.jpg"
:: if both boot.png and boot.jpg are not found script will throw an exception
IF %boot%=="not_found" (goto boot_not_found)
::
:: default value of fastboot file
SET fastboot="not_found"
:: will change fastboot variable to fastboot.png if found
IF EXIST pics\fastboot.png SET fastboot="fastboot.png"
:: if fastboot.png is not found it will check for fastboot.jpg
IF %fastboot%=="not_found" (goto check_fastbootis_jpg)
:: after failure to find fastboot.png, script checks for fastboot.jpg
:check_fastbootis_jpg
IF EXIST pics\fastboot.jpg SET fastboot="fastboot.jpg"
:: if both fastboot.png and fastboot.jpg are not found script will throw an exception
IF %fastboot%=="not_found" (goto fastboot_not_found)
:: Default value of destroyed variable
SET destroyed="not_found"
:: will change destroyed variable to destroyed.png if found
IF EXIST pics\destroyed.png SET destroyed="destroyed.png"
:: if destroyed.png is not found it will check for destroyed.jpg
IF %destroyed%=="not_found" (goto check_destroyedis_jpg)
:: after failure to find destroyed.png, script checks for destroyed.jpg
:check_destroyedis_jpg
IF EXIST pics\destroyed.jpg SET destroyed="destroyed.jpg"
:: if both destroyed.png and destroyed.jpg are not found script will throw an exception
IF %destroyed%=="not_found" (goto destroyed_not_found)
::
:: Converting files to RGB 24 bit windows bitmap (*.BMP) image format using ffmpeg open source imaging (it can do more than just images) library
::
:: Converting boot image too bmp
echo. & echo. Converting user provided files: &echo.
echo Converting %boot%
bin\ffmpeg.exe -hide_banner -loglevel panic -i pics/%boot% -pix_fmt rgb24 -s %logo_resolution% -y temp/boot_cursed.bmp
:: Removing curse given by ffmpeg at end of file
timeout 2 /nobreak >nul
bin\dd.exe if=temp/boot_cursed.bmp count=6998197 bs=1 of=temp/boot.bmp
timeout 1 /nobreak >nul
:: Replace removed curse empty area with god's healing power and regrow removed part
copy /b temp\boot.bmp+bin\small.img temp\boot_healed.bmp
timeout 2 /nobreak >nul
cls
:: Making a copy of boot.bmp and renamed to unlocked.bmp
echo Making a copy of boot.bmp for unlocked (unlocked.bmp)
copy temp\boot_healed.bmp temp\unlocked.bmp
timeout 1 /nobreak >nul
del temp\boot.bmp >nul
timeout 2 /nobreak >nul
:: Deleting cursed file
del temp\boot_cursed.bmp
timeout 2 /nobreak >nul
cls
:: Converting fastboot image to bmp
echo Converting %fastboot%
bin\ffmpeg.exe -hide_banner -loglevel panic -i pics/%fastboot% -pix_fmt rgb24 -s %logo_resolution% -y temp/fastboot_cursed.bmp
:: Removing curse given by ffmpeg at end of file
timeout 2 /nobreak >nul
bin\dd.exe if=temp/fastboot_cursed.bmp count=6998197 bs=1 of=temp/fastboot.bmp
timeout 1 /nobreak >nul
:: Replace removed area with god's healing power and regrow removed part
copy /b temp\fastboot.bmp+bin\small.img temp\fastboot_healed.bmp
timeout 1 /nobreak >nul
del temp\fastboot.bmp
:: Deleting cursed file
del temp\fastboot_cursed.bmp
timeout 2 /nobreak >nul
cls
:: Converting destroyed
echo Converting %destroyed%
bin\ffmpeg.exe -hide_banner -loglevel panic -i pics/%destroyed% -pix_fmt rgb24 -s %logo_resolution% -y temp/destroyed_cursed.bmp
timeout 2 /nobreak >nul
:: Removing curse given by ffmpeg at end of file
bin\dd.exe if=temp/destroyed_cursed.bmp count=6998197 bs=1 of=temp/destroyed.bmp
timeout 1 /nobreak >nul
:: Replace removed curse empty area with god's healing power and regrow removed part
copy /b temp\destroyed.bmp+bin\small.img temp\destroyed_healed.bmp
timeout 1 /nobreak >nul
del temp\destroyed.bmp
timeout 2 /nobreak >nul
:: Deleting cursed file
del temp\destroyed_cursed.bmp
timeout 2 /nobreak >nul
cls
::
::Generates Splash after all files are converted
::
echo.&echo Finished with conversion. Now merging and creating Boot Logo
timeout 4 /nobreak >nul
copy /b bin\header.img+temp\boot_healed.bmp+temp\fastboot_healed.bmp+temp\unlocked.bmp+temp\destroyed_healed.bmp splash_new\splash_new.img
:: Delete temporary files
IF EXIST temp DEL /Q temp
::
cls
echo.&echo.
echo Successfully created Boot Logo! (check splash_new folder)
echo.
echo %tool_version% &echo.
echo Credits
echo ---------------------------------
echo - -
echo # @HumanBoy23 #
echo - -
echo ---------------------------------
echo.&echo Run Flash_Logo.cmd to flash your custom Boot Logo &echo.
echo Press any key to Exit..
pause >nul &exit
:missing_warning
cls
echo.&echo.
echo FATAL_ERROR!! Required files to make splash are/is missing. Please redownload and/or extract the tool again
echo.&echo.&pause&exit
:boot_not_found
echo. & echo File for boot not found read instructions &pause&exit
:fastboot_not_found
echo. & echo File for fastboot not found read instructions &pause&exit
:destroyed_not_found
echo. & echo File for destroyed not found read instructions &pause&exit