Skip to content

Commit

Permalink
new
Browse files Browse the repository at this point in the history
  • Loading branch information
oneui committed Dec 31, 2024
1 parent c81f518 commit d71cbc5
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 34 deletions.
2 changes: 1 addition & 1 deletion resources/module_codes/cn/make_super.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function create_super_img {
fi

# 定义额外的空间大小
local extra_space=$((100 * 1024 * 1024 * 1024 / 100))
local extra_space=$((2 * 1024 * 1024 * 1024 / 10))

# 根据分区类型调整 total_size 的值
case "$partition_type" in
Expand Down
2 changes: 1 addition & 1 deletion resources/module_codes/en/make_super.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function create_super_img {
total_size=$((total_size + 4096 - remainder))
fi
# Define the size of the extra space
local extra_space=$((100 * 1024 * 1024 * 1024 / 100))
local extra_space=$((2 * 1024 * 1024 * 1024 / 10))
# Adjust the total_size based on the partition type
case "$partition_type" in
"VAB")
Expand Down
65 changes: 33 additions & 32 deletions resources/my_tools/flash_tool/FlashROM.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
setlocal enabledelayedexpansion
:HOME

REM 设置机型
REM 设置机型
set "right_device=Model_code"

set "PATH=%PATH%;%cd%\bin\windows"
Expand All @@ -13,28 +13,28 @@ for /f "tokens=2 delims=:" %%a in ('chcp') do set "locale=%%a"
cls

if "!locale!"==" 936" (
set "confirm_switch={08}{\n}你确定要执行这个操作吗?{\n}{\n}如果确定,请输入 'sure',否则,输入任意以退出:{\n}{\n}"
set "device_mismatch_msg=此 ROM 仅适配 !right_device! ,但你的设备是 !DeviceCode!"
set "disabled_avb_verification=已禁用 Avb2.0 校验"
set "exit_program={04}{\n}[4] {01}退出程序{#}{#}{\n}"
set "execution_completed=执行完成,等待自动重启"
set "failure_status=因为某些原因,未能刷入"
set "fastboot_mode={06}当前所处状态:Fastboot 模式{\n}"
set "fastbootd_mode={06}当前所处状态:Fastbootd 模式{\n}"
set "format_data_flash={04}{\n}[2] {01}格式化用户数据并刷入{#}{#}{\n}"
set "formatting_data=正在格式化 DATA"
set "keep_data_flash={04}{\n}[1] {01}保留全部数据并刷入{#}{#}{\n}"
set "kept_data_reboot=已保留全部数据,准备重启!"
set "confirm_switch={08}{\n}你确定要执行这个操作吗?{\n}{\n}如果确定,请输入 'sure',否则,输入任意以退出:{\n}{\n}"
set "device_mismatch_msg=此 ROM 仅适配 !right_device! ,但你的设备是 !DeviceCode!"
set "disabled_avb_verification=已禁用 Avb2.0 校验"
set "exit_program={04}{\n}[4] {01}退出程序{#}{#}{\n}"
set "execution_completed=执行完成,等待自动重启"
set "failure_status=因为某些原因,未能刷入"
set "fastboot_mode={06}当前所处状态:Fastboot 模式{\n}"
set "fastbootd_mode={06}当前所处状态:Fastbootd 模式{\n}"
set "format_data_flash={04}{\n}[2] {01}格式化用户数据并刷入{#}{#}{\n}"
set "formatting_data=正在格式化 DATA"
set "keep_data_flash={04}{\n}[1] {01}保留全部数据并刷入{#}{#}{\n}"
set "kept_data_reboot=已保留全部数据,准备重启!"
set "one_title={F9} Powered By {F0}Garden Of Joy {#}{#}{\n}"
set "retry_message=重试..."
set "select_project={02}请选择你要操作的项目:{\n}{\n}"
set "success_status=刷入成功"
set "switch_to_fastboot={04}{\n}[3] {01}切换到 Fastboot 模式{#}{#}{\n}"
set "switch_to_fastbootd={04}{\n}[3] {01}切换到 Fastbootd 模式{#}{#}{\n}"
set "title=盾牌座 UY 线刷工具"
set "waiting_device={0D}———— 正在等待设备 ————{#}{\n}{\n}"
set "retry_message=重试..."
set "select_project={02}请选择你要操作的项目:{\n}{\n}"
set "success_status=刷入成功"
set "switch_to_fastboot={04}{\n}[3] {01}切换到 Fastboot 模式{#}{#}{\n}"
set "switch_to_fastbootd={04}{\n}[3] {01}切换到 Fastbootd 模式{#}{#}{\n}"
set "title=盾牌座 UY 线刷工具"
set "waiting_device={0D}———— 正在等待设备 ————{#}{\n}{\n}"
) else (
set "confirm_switch={08}{\n}Are you sure you want to perform this operation?{\n}{\n}If sure, please enter 'sure', otherwise, enter anything to exit:{\n}{\n}"
set "confirm_switch={08}{\n}Are you sure you want to perform this operation?{\n}{\n}If sure, please enter 'sure', otherwise, enter anything to exit:{\n}{\n}"
set "device_mismatch_msg=This ROM is only compatible with !right_device! , but your device is !DeviceCode!"
set "disabled_avb_verification=Avb2.0 verification has been disabled"
set "exit_program={04}{\n}[4] {01}Exit program{#}{#}{\n}"
Expand All @@ -48,39 +48,39 @@ if "!locale!"==" 936" (
set "kept_data_reboot=All data has been kept, ready to reboot!"
set "one_title={F9} Powered By {F0}Garden Of Joy {#}{#}{\n}"
set "retry_message=Retry..."
set "select_project={02}Please select the project you want to operate:{\n}{\n}"
set "select_project={02}Please select the project you want to operate:{\n}{\n}"
set "success_status=Flash successful"
set "switch_to_fastboot={04}{\n}[3] {01}Switch to Fastboot mode{#}{#}{\n}"
set "switch_to_fastbootd={04}{\n}[3] {01}Switch to Fastbootd mode{#}{#}{\n}"
set "title=UY Scuti Flash Tool"
set "waiting_device={0D}———— Waiting for device ————{#}{\n}{\n}"
set "waiting_device={0D}———— Waiting for device ————{#}{\n}{\n}"
)

title !title!

REM 显示等待设备的消息
REM 显示等待设备的消息
echo.
cho !waiting_device!

REM 获取设备型号
REM 获取设备型号
for /f "tokens=2" %%a in ('fastboot getvar product 2^>^&1^|find "product"') do (
set DeviceCode=%%a
)
REM 获取设备的分区类型
REM 获取设备的分区类型
for /f "tokens=2" %%a in ('fastboot getvar slot-count 2^>^&1^|find "slot-count" ') do (
set DynamicPartitionType=%%a
)
REM 根据设备的分区类型设置变量 DynamicPartitionType 的值
REM 根据设备的分区类型设置变量 DynamicPartitionType 的值
if "!DynamicPartitionType!" == "2" (
set DynamicPartitionType=NonOnlyA
) else (
set DynamicPartitionType=OnlyA
)
REM 获取设备的 Fastboot 状态
REM 获取设备的 Fastboot 状态
for /f "tokens=2" %%a in ('fastboot getvar is-userspace 2^>^&1^|find "is-userspace"') do (
set FastbootState=%%a
)
REM 根据设备的 Fastboot 状态设置变量 FastbootState 的值
REM 根据设备的 Fastboot 状态设置变量 FastbootState 的值
if "!FastbootState!" == "yes" (
set FastbootState=!fastbootd_mode!
) else (
Expand Down Expand Up @@ -144,7 +144,7 @@ goto HOME&pause
cls
echo.

REM 对 vbmeta 分区文件专门刷入
REM 对 vbmeta 分区文件专门刷入
set "count=0"
for /R "images\" %%i in (*.img) do (
echo %%~ni | findstr /B "vbmeta" >nul && (
Expand All @@ -162,7 +162,7 @@ if !count! gtr 0 (
echo.
)

REM 遍历分区文件并刷入
REM 遍历分区文件并刷入
for /f "delims=" %%b in ('dir /b images\*.img ^| findstr /v /i "super.img" ^| findstr /v /i "preloader_raw.img" ^| findstr /v /i "cust.img" ^| findstr /v /i "recovery.img" ^| findstr /v /i /b "vbmeta"') do (
set "filename=%%~nb"
if "!DynamicPartitionType!"=="OnlyA" (
Expand Down Expand Up @@ -192,7 +192,7 @@ for /f "delims=" %%b in ('dir /b images\*.img ^| findstr /v /i "super.img" ^| fi
)
)

REM MTK 机型专属
REM MTK 机型专属
if exist "images\preloader_raw.img" (
fastboot flash preloader_a "images\preloader_raw.img"
fastboot flash preloader_b "images\preloader_raw.img"
Expand All @@ -207,6 +207,7 @@ if exist images\cust.img (
)

if exist images\super.img (
fastboot erase super
fastboot flash super "images\super.img"
echo.
)
Expand Down

0 comments on commit d71cbc5

Please sign in to comment.