From c112de8d2301eefee7e816b80b8d431b24ac440e Mon Sep 17 00:00:00 2001 From: Nick Chan Date: Sun, 5 Feb 2023 03:00:29 +0800 Subject: [PATCH] fix flower chain --- src/tui_main.c | 2 +- src/tui_screen_main.c | 2 +- src/tui_screen_options.c | 33 +++++++++++++++++++++------------ 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/tui_main.c b/src/tui_main.c index f2de6a1..865c68a 100644 --- a/src/tui_main.c +++ b/src/tui_main.c @@ -40,7 +40,7 @@ int init_window() { newtInit(); newtCls(); - newtDrawRootText(0, 0, "Package Configuration"); + newtDrawRootText(0, 0, "palera1n version 2.0.0"); newtPushHelpLine(NULL); return 0; } diff --git a/src/tui_screen_main.c b/src/tui_screen_main.c index ff5b44e..e28ca0e 100644 --- a/src/tui_screen_main.c +++ b/src/tui_screen_main.c @@ -15,7 +15,7 @@ tui_screen_t tui_screen_main() { int ret = MAIN_SCREEN; bool can_start = false; - newtCenteredWindow(WIDTH, HEIGHT, "palera1n version 2.0.0"); + newtCenteredWindow(WIDTH, HEIGHT, NULL); newtComponent optionsButton = newtCompactButton(46, 17, "Options"); newtComponent startButton = newtCompactButton(57, 17, "Start"); newtComponent exitButton = newtCompactButton(66, 17, "Exit"); diff --git a/src/tui_screen_options.c b/src/tui_screen_options.c index a3ad1b0..82111db 100644 --- a/src/tui_screen_options.c +++ b/src/tui_screen_options.c @@ -20,29 +20,31 @@ void bitfield_check_cb(newtComponent box, void* data) { } else assert(0); } + tui_screen_t tui_screen_options() { tui_bit_info_t verbose_info = { &kpf_flags, checkrain_option_verbose_boot }; tui_bit_info_t rootful_info = { &palerain_flags, palerain_option_rootful }; tui_bit_info_t setup_rootful_info = { &palerain_flags, palerain_option_setup_rootful }; tui_bit_info_t force_revert_info = { &checkrain_flags, checkrain_option_force_revert }; tui_bit_info_t safemode_info = { &checkrain_flags, checkrain_option_safemode }; - const char* bootargs_entered = NULL; + static checkrain_option_t flower_flags = 0, flower_option_flower_chain = (1 << 0); + tui_bit_info_t flower_chain_info = { &flower_flags, flower_option_flower_chain }; + + const char* bootargs_entered = NULL; int ret = MAIN_SCREEN; - newtCenteredWindow(WIDTH, HEIGHT, "palera1n version 2.0.0"); + newtCenteredWindow(WIDTH, HEIGHT, NULL); newtComponent backButton = newtCompactButton(66, 17, "Back"); - newtComponent verboseBootBox = newtCheckbox(1, 1, "Verbose boot", CHECKBOX_STATE(kpf_flags, checkrain_option_verbose_boot), NULL, NULL); - newtComponent rootfulBox = newtCheckbox(1, 2, "Rootful", CHECKBOX_STATE(palerain_flags, palerain_option_rootful), NULL, NULL); - newtComponent rootfulSetupBox = newtCheckbox(1, 3, "Setup fakefs", CHECKBOX_STATE(palerain_flags, palerain_option_setup_rootful), NULL, NULL); - newtComponent forceRevertBox = newtCheckbox(1, 4, "Restore system", CHECKBOX_STATE(checkrain_flags, checkrain_option_force_revert), NULL, NULL); - newtComponent safeModeBox = newtCheckbox(1, 5, "Safe mode", CHECKBOX_STATE(checkrain_flags, checkrain_option_safemode), NULL, NULL); + newtComponent optionsNotice = newtTextbox(1, 1, WIDTH - 2, 3, NEWT_FLAG_WRAP); + newtTextboxSetText(optionsNotice, "You may set the following options. If you don't know what they meant you'll probably have no reason to set them."); - newtComponent bootCmdlineLabel = newtLabel(1, 6, "Kernel command line:"); - newtComponent bootCmdlineEntry = newtEntry(1, 7, NULL, WIDTH - 2, &bootargs_entered, NEWT_ENTRY_SCROLL); - - newtComponent flowerChainBox /* dark blockchain */ = newtCheckbox(1, 8, "Flower chain", ' ', NULL, NULL); + newtComponent verboseBootBox = newtCheckbox(1, 4, "Verbose boot", CHECKBOX_STATE(kpf_flags, checkrain_option_verbose_boot), NULL, NULL); + newtComponent rootfulBox = newtCheckbox(1, 5, "Rootful", CHECKBOX_STATE(palerain_flags, palerain_option_rootful), NULL, NULL); + newtComponent rootfulSetupBox = newtCheckbox(1, 6, "Setup fakefs", CHECKBOX_STATE(palerain_flags, palerain_option_setup_rootful), NULL, NULL); + newtComponent forceRevertBox = newtCheckbox(1, 7, "Restore system", CHECKBOX_STATE(checkrain_flags, checkrain_option_force_revert), NULL, NULL); + newtComponent safeModeBox = newtCheckbox(1, 8, "Safe mode", CHECKBOX_STATE(checkrain_flags, checkrain_option_safemode), NULL, NULL); newtComponentAddCallback(verboseBootBox, bitfield_check_cb, &verbose_info); newtComponentAddCallback(rootfulBox, bitfield_check_cb, &rootful_info); @@ -50,10 +52,17 @@ tui_screen_t tui_screen_options() { newtComponentAddCallback(forceRevertBox, bitfield_check_cb, &force_revert_info); newtComponentAddCallback(safeModeBox, bitfield_check_cb, &safemode_info); + newtComponent bootCmdlineLabel = newtLabel(1, 9, "Kernel command line:"); + newtComponent bootCmdlineEntry = newtEntry(1, 10, NULL, WIDTH - 2, &bootargs_entered, NEWT_ENTRY_SCROLL); + + newtComponent flowerChainBox = newtCheckbox(1, 11, "Flower chain", CHECKBOX_STATE(flower_flags, flower_option_flower_chain), NULL, NULL); + newtComponentAddCallback(flowerChainBox, bitfield_check_cb, &flower_chain_info); + + newtComponent form = newtForm(NULL, NULL, 0); newtFormAddComponents(form, backButton, verboseBootBox, rootfulBox, rootfulSetupBox, forceRevertBox, safeModeBox, bootCmdlineLabel, - bootCmdlineEntry, flowerChainBox, NULL); + bootCmdlineEntry, flowerChainBox, optionsNotice, NULL); newtRunForm(form); newtRefresh(); snprintf(xargs_cmd, 0x270, "xargs %s", bootargs_entered);