mirror of
https://github.com/d0k3/GodMode9.git
synced 2025-06-26 13:42:47 +00:00
Show a warning when a file is currently locked (on A button)
This commit is contained in:
parent
648f314a0a
commit
67923556da
@ -38,7 +38,7 @@
|
||||
(((v) % (a)) ? ((v) + (a) - ((v) % (a))) : (v))
|
||||
|
||||
// GodMode9 version
|
||||
#define VERSION "0.8.3"
|
||||
#define VERSION "0.8.4"
|
||||
|
||||
// input / output paths
|
||||
#define INPUT_PATHS "0:", "0:/files9", "0:/Decrypt9"
|
||||
|
@ -402,6 +402,15 @@ u32 GetWritePermissions() {
|
||||
return write_permissions;
|
||||
}
|
||||
|
||||
bool FileCheck(const char* path) {
|
||||
FIL file;
|
||||
if (PathToNumFSA(path) < 0) return true;
|
||||
if (f_open(&file, path, FA_READ | FA_OPEN_EXISTING) == FR_OK) {
|
||||
f_close(&file);
|
||||
return true;
|
||||
} else return false;
|
||||
}
|
||||
|
||||
bool FileSetData(const char* path, const u8* data, size_t size, size_t foffset, bool create) {
|
||||
int drvtype = DriveType(path);
|
||||
if (!CheckWritePermissions(path)) return false;
|
||||
|
@ -64,6 +64,9 @@ bool SetWritePermissions(u32 perm, bool add_perm);
|
||||
/** Get write permissions */
|
||||
u32 GetWritePermissions();
|
||||
|
||||
/** True if file exists and is not locked, false otherwise **/
|
||||
bool FileCheck(const char* path);
|
||||
|
||||
/** Create / open file and write the provided data to it **/
|
||||
bool FileSetData(const char* path, const u8* data, size_t size, size_t foffset, bool create);
|
||||
|
||||
|
@ -700,7 +700,9 @@ u32 GodMode() {
|
||||
(filetype == GAME_NCCH) ? "Mount as NCCH image" : "???";
|
||||
if (searchdrv > 0) optionstr[searchdrv-1] = "Open containing folder";
|
||||
|
||||
int user_select = ShowSelectPrompt(n_opt, optionstr, pathstr);
|
||||
int user_select = 0;
|
||||
if (!FileCheck(curr_entry->path)) ShowPrompt(false, "%s\nFile is currently locked", pathstr);
|
||||
else user_select = ShowSelectPrompt(n_opt, optionstr, pathstr);
|
||||
if (user_select == hexviewer) { // -> show in hex viewer
|
||||
HexViewer(curr_entry->path);
|
||||
} else if (user_select == calcsha) { // -> calculate SHA-256
|
||||
|
Loading…
x
Reference in New Issue
Block a user