Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dadigang
Ventoy
Commits
96fdd594
Commit
96fdd594
authored
Feb 15, 2022
by
longpanda
Browse files
Support to F2 browse Ventoy partition self.
parent
62dc0033
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
3 deletions
+55
-3
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_browser.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_browser.c
+47
-1
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c
+5
-2
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
+3
-0
No files found.
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_browser.c
View file @
96fdd594
...
...
@@ -149,7 +149,7 @@ static int ventoy_browser_iterate_partition(struct grub_disk *disk, const grub_p
(
void
)
data
;
if
(
partition
->
number
<
2
&&
g_vtoy_dev
&&
grub_strcmp
(
disk
->
name
,
g_vtoy_dev
)
==
0
)
if
(
partition
->
number
==
1
&&
g_vtoy_dev
&&
grub_strcmp
(
disk
->
name
,
g_vtoy_dev
)
==
0
)
{
return
0
;
}
...
...
@@ -423,6 +423,43 @@ static int ventoy_browser_iterate_dir(const char *filename, const struct grub_di
return
0
;
}
static
grub_err_t
ventoy_browser_iso_part
(
void
)
{
char
cfgfile
[
64
];
char
*
buffer
=
NULL
;
int
pos
=
0
;
int
buflen
=
0
;
int
cfglen
=
0
;
cfglen
=
g_tree_script_pos
-
g_tree_script_pre
;
buflen
=
cfglen
+
512
;
buffer
=
grub_malloc
(
buflen
);
if
(
!
buffer
)
{
return
1
;
}
if
(
g_tree_view_menu_style
==
0
)
{
pos
=
grub_snprintf
(
buffer
,
buflen
,
"menuentry
\"
%-10s [../]
\"
--class=
\"
vtoyret
\"
VTOY_RET {
\n
"
" echo 'return ...'
\n
}
\n
"
,
"<--"
);
}
else
{
pos
=
grub_snprintf
(
buffer
,
buflen
,
"menuentry
\"
[../]
\"
--class=
\"
vtoyret
\"
VTOY_RET {
\n
"
" echo 'return ...'
\n
}
\n
"
);
}
grub_memcpy
(
buffer
+
pos
,
g_tree_script_buf
+
g_tree_script_pre
,
cfglen
);
pos
+=
cfglen
;
grub_snprintf
(
cfgfile
,
sizeof
(
cfgfile
),
"configfile mem:0x%lx:size:%d"
,
(
ulong
)
buffer
,
pos
);
grub_script_execute_sourcecode
(
cfgfile
);
grub_free
(
buffer
);
VENTOY_CMD_RETURN
(
GRUB_ERR_NONE
);
}
grub_err_t
ventoy_cmd_browser_dir
(
grub_extcmd_context_t
ctxt
,
int
argc
,
char
**
args
)
{
int
i
;
...
...
@@ -435,6 +472,15 @@ grub_err_t ventoy_cmd_browser_dir(grub_extcmd_context_t ctxt, int argc, char **a
(
void
)
ctxt
;
(
void
)
argc
;
if
(
args
[
2
][
0
]
==
'/'
&&
args
[
2
][
1
]
==
0
)
{
grub_snprintf
(
cfgfile
,
sizeof
(
cfgfile
),
"(%s)"
,
args
[
0
]);
if
(
grub_strcmp
(
cfgfile
,
g_iso_path
)
==
0
)
{
return
ventoy_browser_iso_part
();
}
}
if
(
!
ventoy_browser_mbuf_alloc
(
&
mbuf
))
{
return
1
;
...
...
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c
View file @
96fdd594
...
...
@@ -117,8 +117,9 @@ ventoy_gpt_info *g_ventoy_part_info = NULL;
grub_uint64_t
g_ventoy_disk_size
=
0
;
grub_uint64_t
g_ventoy_disk_part_size
[
2
];
static
char
*
g_tree_script_buf
=
NULL
;
static
int
g_tree_script_pos
=
0
;
char
*
g_tree_script_buf
=
NULL
;
int
g_tree_script_pos
=
0
;
int
g_tree_script_pre
=
0
;
static
char
*
g_list_script_buf
=
NULL
;
static
int
g_list_script_pos
=
0
;
...
...
@@ -2294,6 +2295,8 @@ static int ventoy_dynamic_tree_menu(img_iterator_node *node)
"}
\n
"
,
"return"
);
}
}
g_tree_script_pre
=
g_tree_script_pos
;
}
else
{
...
...
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
View file @
96fdd594
...
...
@@ -1187,6 +1187,9 @@ typedef struct browser_node
struct
browser_node
*
next
;
}
browser_node
;
extern
char
*
g_tree_script_buf
;
extern
int
g_tree_script_pos
;
extern
int
g_tree_script_pre
;
extern
int
g_tree_view_menu_style
;
extern
int
g_sort_case_sensitive
;
extern
int
g_wimboot_enable
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment