mirror of
https://github.com/rvtr/GodMode9i.git
synced 2025-11-02 00:11:07 -04:00
Read only for NAND/NitroFS/FAT IMG drives
This commit is contained in:
parent
8d607e70a2
commit
2d59362d9c
@ -8,11 +8,11 @@ endif
|
||||
|
||||
include $(DEVKITARM)/ds_rules
|
||||
|
||||
# If on a tagged commit, use the tag instead of the commit
|
||||
# If on a tagged commit, use just tag
|
||||
ifneq ($(shell echo $(shell git tag -l --points-at HEAD) | head -c 1),)
|
||||
GIT_VER := $(shell git tag -l --points-at HEAD)
|
||||
else
|
||||
GIT_VER := $(shell git describe --abbrev=0 --tags)-$(shell git rev-parse --short HEAD)
|
||||
GIT_VER := $(shell git describe --abbrev=0 --tags)-$(shell git rev-parse --short=7 HEAD)
|
||||
endif
|
||||
|
||||
# Ensure version.h exists
|
||||
|
||||
@ -379,7 +379,7 @@ FileOperation fileBrowse_A(DirEntry* entry, char path[PATH_MAX]) {
|
||||
}
|
||||
break;
|
||||
} case FileOperation::hexEdit: {
|
||||
hexEditor(entry->name.c_str());
|
||||
hexEditor(entry->name.c_str(), currentDrive);
|
||||
break;
|
||||
} case FileOperation::none: {
|
||||
break;
|
||||
|
||||
@ -50,17 +50,19 @@ u32 jumpToOffset(u32 offset) {
|
||||
}
|
||||
}
|
||||
|
||||
void hexEditor(const char *path) {
|
||||
void hexEditor(const char *path, int drive) {
|
||||
// Custom palettes
|
||||
BG_PALETTE_SUB[0x1F] = 0x9CF7;
|
||||
BG_PALETTE_SUB[0x2F] = 0xB710;
|
||||
BG_PALETTE_SUB[0x3F] = 0xAE8D;
|
||||
BG_PALETTE_SUB[0x7F] = 0xEA2D;
|
||||
|
||||
FILE *file = fopen(path, "rb+");
|
||||
FILE *file = fopen(path, drive < 4 ? "rb+" : "rb");
|
||||
|
||||
if(!file)
|
||||
if(!file) {
|
||||
nocashMessage("test");
|
||||
return;
|
||||
}
|
||||
|
||||
consoleClear();
|
||||
|
||||
@ -179,11 +181,13 @@ void hexEditor(const char *path) {
|
||||
if(cursorPosition < 8 * maxLines - 1)
|
||||
cursorPosition = std::min((u8)(cursorPosition + 1), (u8)(fileSize - offset - 1));
|
||||
} else if (pressed & KEY_A) {
|
||||
mode = 2;
|
||||
consoleSelect(&bottomConsoleBG);
|
||||
printf("\x1B[%d;%dH\x1B[%dm\2\2", 1 + cursorPosition / 8, 5 + (cursorPosition % 8 * 2) + (cursorPosition % 8 / 4), 31);
|
||||
printf("\x1B[%d;%dH\x1B[%dm\2", 1 + cursorPosition / 8, 23 + cursorPosition % 8, 31);
|
||||
consoleSelect(&bottomConsole);
|
||||
if(drive < 4) {
|
||||
mode = 2;
|
||||
consoleSelect(&bottomConsoleBG);
|
||||
printf("\x1B[%d;%dH\x1B[%dm\2\2", 1 + cursorPosition / 8, 5 + (cursorPosition % 8 * 2) + (cursorPosition % 8 / 4), 31);
|
||||
printf("\x1B[%d;%dH\x1B[%dm\2", 1 + cursorPosition / 8, 23 + cursorPosition % 8, 31);
|
||||
consoleSelect(&bottomConsole);
|
||||
}
|
||||
} else if (pressed & KEY_B) {
|
||||
mode = 0;
|
||||
} else if(pressed & KEY_Y) {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#ifndef HEX_EDITOR_H
|
||||
#define HEX_EDITOR_H
|
||||
|
||||
void hexEditor(const char *path);
|
||||
void hexEditor(const char *path, int drive);
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
Reference in New Issue
Block a user