Add ASCII View to Rosalina Process List (#1703)
This commit is contained in:
parent
b83a0abb9d
commit
e9b8b0daef
@ -50,6 +50,8 @@ typedef struct ProcessInfo
|
||||
static ProcessInfo infos[0x40] = {0}, infosPrev[0x40] = {0};
|
||||
extern GDBServer gdbServer;
|
||||
|
||||
bool ascii = false;
|
||||
|
||||
static inline int ProcessListMenu_FormatInfoLine(char *out, const ProcessInfo *info)
|
||||
{
|
||||
const char *checkbox;
|
||||
@ -382,6 +384,11 @@ static void ProcessListMenu_MemoryViewer(const ProcessInfo *info)
|
||||
menus[MENU_MODE_SEARCH].buf = searchPattern;
|
||||
menus[MENU_MODE_SEARCH].max = 1;
|
||||
// ------------------------------------------
|
||||
char u8ToChar(u8 val) {
|
||||
if(val < 32 || val > 126)
|
||||
return '-';
|
||||
return val;
|
||||
}
|
||||
|
||||
void drawMenu(void)
|
||||
{
|
||||
@ -412,16 +419,22 @@ static void ProcessListMenu_MemoryViewer(const ProcessInfo *info)
|
||||
// ------------------------------------------
|
||||
|
||||
// Location
|
||||
const u32 infoY = instructionsY + SPACING_Y;
|
||||
viewerY += SPACING_Y;
|
||||
if(codeAvailable && heapAvailable)
|
||||
{
|
||||
const u32 infoY = instructionsY + SPACING_Y;
|
||||
viewerY += SPACING_Y;
|
||||
{
|
||||
Draw_DrawString(10, infoY, COLOR_WHITE, "Press L or R to switch between heap and code.");
|
||||
if((u32)menus[MENU_MODE_NORMAL].buf == heapDestAddress)
|
||||
Draw_DrawString(10 + SPACING_X * 31, infoY, COLOR_GREEN, "heap");
|
||||
if((u32)menus[MENU_MODE_NORMAL].buf == codeDestAddress)
|
||||
Draw_DrawString(10 + SPACING_X * 40, infoY, COLOR_GREEN, "code");
|
||||
}
|
||||
else
|
||||
{
|
||||
Draw_DrawString(10, infoY, COLOR_WHITE, "SELECT to dump memory, START to toggle ASCII view.");
|
||||
if(ascii)
|
||||
Draw_DrawString(10 + SPACING_X * 39, infoY, COLOR_GREEN, "ASCII");
|
||||
}
|
||||
// ------------------------------------------
|
||||
|
||||
for(u32 row = menus[menuMode].starti; row < (menus[menuMode].starti + ROWS_PER_SCREEN); row++)
|
||||
@ -438,10 +451,23 @@ static void ProcessListMenu_MemoryViewer(const ProcessInfo *info)
|
||||
|
||||
if(address < menus[menuMode].max)
|
||||
{
|
||||
Draw_DrawFormattedString(x, y,
|
||||
address == menus[menuMode].selected ? (editing ? COLOR_RED : COLOR_GREEN) : COLOR_WHITE,
|
||||
"%.2x",
|
||||
menus[menuMode].buf[address]);
|
||||
u32 color;
|
||||
if(address == menus[menuMode].selected)
|
||||
{
|
||||
if(editing)
|
||||
color = COLOR_RED;
|
||||
else
|
||||
color = COLOR_GREEN;
|
||||
}
|
||||
else
|
||||
color = COLOR_WHITE;
|
||||
|
||||
u8 val = menus[menuMode].buf[address];
|
||||
|
||||
if(ascii)
|
||||
Draw_DrawFormattedString(x, y, color, "%c ", u8ToChar(val));
|
||||
else
|
||||
Draw_DrawFormattedString(x, y, color, "%.2x", val);
|
||||
}
|
||||
else
|
||||
Draw_DrawString(x, y, COLOR_WHITE, " ");
|
||||
@ -514,6 +540,8 @@ static void ProcessListMenu_MemoryViewer(const ProcessInfo *info)
|
||||
ProcessListMenu_DumpMemory(info->name, menus[MENU_MODE_NORMAL].buf, menus[MENU_MODE_NORMAL].max);
|
||||
clearMenu();
|
||||
}
|
||||
else if(pressed & KEY_START)
|
||||
ascii = !ascii;
|
||||
|
||||
if(editing)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user