1
0
Fork 0
mirror of https://github.com/DarkMatterCore/nxdumptool.git synced 2024-11-22 10:16:39 +00:00

OptionsTab: add reset settings option.

Other changes include:

* gamecard: set GameCardStatus_Processing as the current gamecard status before calling gamecardLoadInfo().

* workflow: try to fix the missing commit tag issue.
This commit is contained in:
Pablo Curiel 2024-05-01 12:50:36 +02:00
parent 50deeeb41b
commit 1ff3df4eca
4 changed files with 42 additions and 15 deletions

View file

@ -35,7 +35,7 @@ jobs:
- name: Set environment variables - name: Set environment variables
run: | run: |
echo "nxdt_commit=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV echo "NXDT_COMMIT=${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: Set workspace permissions - name: Set workspace permissions
run: chmod 777 -R "$GITHUB_WORKSPACE" run: chmod 777 -R "$GITHUB_WORKSPACE"
@ -66,27 +66,27 @@ jobs:
# run: | # run: |
# make -j8 PREFIX="ccache aarch64-none-elf-" # make -j8 PREFIX="ccache aarch64-none-elf-"
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v4
with: with:
name: nxdt_rw_poc-${{ env.nxdt_commit }}.nro name: nxdt_rw_poc-${{ env.NXDT_COMMIT }}.nro
path: code_templates/tmp/nxdt_rw_poc.nro path: code_templates/tmp/nxdt_rw_poc.nro
if-no-files-found: error if-no-files-found: error
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v4
with: with:
name: nxdt_rw_poc-${{ env.nxdt_commit }}.elf name: nxdt_rw_poc-${{ env.NXDT_COMMIT }}.elf
path: code_templates/tmp/nxdt_rw_poc.elf path: code_templates/tmp/nxdt_rw_poc.elf
if-no-files-found: error if-no-files-found: error
#- uses: actions/upload-artifact@v3 #- uses: actions/upload-artifact@v4
# with: # with:
# name: nxdumptool-rewrite-${{ env.nxdt_commit }}-WIP_UI.nro # name: nxdumptool-rewrite-${{ env.NXDT_COMMIT }}-WIP_UI.nro
# path: nxdumptool.nro # path: nxdumptool.nro
# if-no-files-found: error # if-no-files-found: error
#- uses: actions/upload-artifact@v3 #- uses: actions/upload-artifact@v4
# with: # with:
# name: nxdumptool-rewrite-${{ env.nxdt_commit }}-WIP_UI.elf # name: nxdumptool-rewrite-${{ env.NXDT_COMMIT }}-WIP_UI.elf
# path: nxdumptool.elf # path: nxdumptool.elf
# if-no-files-found: error # if-no-files-found: error

View file

@ -34,6 +34,11 @@
} }
}, },
"reset_settings": {
"label": "Reset settings",
"description": "Resets all settings to their default values, including the ones not reflected in this menu (e.g. dump options, etc.)."
},
"notifications": { "notifications": {
"no_ums_devices": "No USB Mass Storage devices available.", "no_ums_devices": "No USB Mass Storage devices available.",
"ums_device_unmount_success": "USB Mass Storage device successfully unmounted!", "ums_device_unmount_success": "USB Mass Storage device successfully unmounted!",
@ -45,6 +50,7 @@
"already_updated": "The application has already been updated. Please reload.", "already_updated": "The application has already been updated. Please reload.",
"github_json_failed": "Failed to download or parse GitHub release JSON!", "github_json_failed": "Failed to download or parse GitHub release JSON!",
"up_to_date": "The application is up to date!", "up_to_date": "The application is up to date!",
"app_updated": "Application successfully updated! Please reload for the changes to take effect." "app_updated": "Application successfully updated! Please reload for the changes to take effect.",
"settings_reset": "User settings have been reset."
} }
} }

View file

@ -670,7 +670,12 @@ static void gamecardDetectionThreadFunc(void *arg)
/* Load gamecard info right away if a gamecard is inserted, then signal the user mode gamecard status change event. */ /* Load gamecard info right away if a gamecard is inserted, then signal the user mode gamecard status change event. */
SCOPED_LOCK(&g_gameCardMutex) SCOPED_LOCK(&g_gameCardMutex)
{ {
if (gamecardIsInserted()) gamecardLoadInfo(); if (gamecardIsInserted())
{
atomic_store(&g_gameCardStatus, GameCardStatus_Processing);
gamecardLoadInfo();
}
ueventSignal(&g_gameCardStatusChangeEvent); ueventSignal(&g_gameCardStatusChangeEvent);
} }
@ -688,13 +693,17 @@ static void gamecardDetectionThreadFunc(void *arg)
/* Free gamecard info before proceeding. */ /* Free gamecard info before proceeding. */
gamecardFreeInfo(true); gamecardFreeInfo(true);
/* Set initial gamecard status. */
bool gc_inserted = gamecardIsInserted();
atomic_store(&g_gameCardStatus, gc_inserted ? GameCardStatus_Processing : GameCardStatus_NotInserted);
/* Delay gamecard access by GAMECARD_ACCESS_DELAY full seconds. This is done to to avoid conflicts with HOS / sysmodules. */ /* Delay gamecard access by GAMECARD_ACCESS_DELAY full seconds. This is done to to avoid conflicts with HOS / sysmodules. */
/* We will periodically check if the gamecard is still inserted during this period. */ /* We will periodically check if the gamecard is still inserted during this period. */
/* If the gamecard is taken out before reaching the length of the delay, we won't try to access it. */ /* If the gamecard is taken out before reaching the length of the delay, we won't try to access it. */
time_t start = time(NULL); time_t start = time(NULL);
bool gc_delay_passed = false; bool gc_delay_passed = false;
while(gamecardIsInserted()) while(gc_inserted)
{ {
time_t now = time(NULL); time_t now = time(NULL);
time_t diff = (now - start); time_t diff = (now - start);
@ -706,6 +715,8 @@ static void gamecardDetectionThreadFunc(void *arg)
} }
utilsAppletLoopDelay(); utilsAppletLoopDelay();
gc_inserted = gamecardIsInserted();
} }
/* Load gamecard info (if applicable). */ /* Load gamecard info (if applicable). */
@ -738,9 +749,6 @@ static void gamecardLoadInfo(void)
u32 root_hfs_entry_count = 0, root_hfs_name_table_size = 0; u32 root_hfs_entry_count = 0, root_hfs_name_table_size = 0;
char *root_hfs_name_table = NULL; char *root_hfs_name_table = NULL;
/* Set initial gamecard status. */
atomic_store(&g_gameCardStatus, GameCardStatus_Processing);
/* Read gamecard header. */ /* Read gamecard header. */
/* This step *will* fail if the running CFW enabled the "nogc" patch. */ /* This step *will* fail if the running CFW enabled the "nogc" patch. */
/* gamecardGetHandleAndStorage() takes care of updating the gamecard status accordingly if this happens. */ /* gamecardGetHandleAndStorage() takes care of updating the gamecard status accordingly if this happens. */

View file

@ -428,6 +428,19 @@ namespace nxdt::views
}); });
this->addView(update_app); this->addView(update_app);
/* Reset settings. */
brls::ListItem *reset_settings = new brls::ListItem("options_tab/reset_settings/label"_i18n, "options_tab/reset_settings/description"_i18n);
reset_settings->getClickEvent()->subscribe([this](brls::View* view) {
if (!this->display_notification) return;
configResetSettings();
this->DisplayNotification("options_tab/notifications/settings_reset"_i18n);
});
this->addView(reset_settings);
} }
OptionsTab::~OptionsTab() OptionsTab::~OptionsTab()