Skip to content

Commit 3bad565

Browse files
committed
Work on Consoles (Added Console::summary())
1 parent 9e6d5b2 commit 3bad565

File tree

6 files changed

+53
-5
lines changed

6 files changed

+53
-5
lines changed

Core/FileSystems/FileSystem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ FileSystem::numUnallocated() const noexcept
479479
std::vector<u32>
480480
FileSystem::serializeBitmap() const
481481
{
482-
require_formatted();
482+
if (!isFormatted()) return {};
483483

484484
auto longwords = ((numBlocks() - 2) + 31) / 32;
485485
std::vector<u32> result;

Core/Misc/RetroShell/CommanderConsole.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,25 @@ CommanderConsole::welcome()
3232
Console::welcome();
3333
}
3434

35+
void
36+
CommanderConsole::summary()
37+
{
38+
std::stringstream ss;
39+
40+
ss << "Model Chip Slow Fast Agnus Denise ROM" << std::endl;
41+
ss << std::setw(8) << std::left << BankMapEnum::key(BankMap(amiga.get(Opt::MEM_BANKMAP)));
42+
ss << std::setw(8) << std::left << (std::to_string(amiga.get(Opt::MEM_CHIP_RAM)) + " MB");
43+
ss << std::setw(8) << std::left << (std::to_string(amiga.get(Opt::MEM_SLOW_RAM)) + " MB");
44+
ss << std::setw(8) << std::left << (std::to_string(amiga.get(Opt::MEM_FAST_RAM)) + " MB");
45+
ss << std::setw(8) << std::left << (agnus.isECS() ? "ECS" : "OCS");
46+
ss << std::setw(8) << std::left << (denise.isECS() ? "ECS" : "OCS");
47+
ss << mem.getRomTraits().title << std::endl;
48+
49+
*this << vspace{1};
50+
*this << ss;
51+
*this << vspace{1};
52+
}
53+
3554
void
3655
CommanderConsole::printHelp(isize tab)
3756
{

Core/Misc/RetroShell/Console.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,9 @@ class Console : public SubComponent {
215215
// Prints the welcome message
216216
virtual void welcome() = 0;
217217

218+
// Prints the status summary
219+
virtual void summary() = 0;
220+
218221
// Prints the help line
219222
virtual void printHelp(isize tab = 0);
220223

@@ -364,6 +367,7 @@ class CommanderConsole final : public Console
364367
void _pause() override;
365368
string getPrompt() override;
366369
void welcome() override;
370+
void summary() override;
367371
void printHelp(isize tab = 0) override;
368372
void pressReturn(bool shift) override;
369373
};
@@ -380,6 +384,7 @@ class DebuggerConsole final : public Console
380384
void _pause() override;
381385
string getPrompt() override;
382386
void welcome() override;
387+
void summary() override;
383388
void printHelp(isize tab = 0) override;
384389
void pressReturn(bool shift) override;
385390
};
@@ -398,14 +403,12 @@ class NavigatorConsole final : public Console
398403
void _pause() override;
399404
string getPrompt() override;
400405
void welcome() override;
406+
void summary() override;
401407
void printHelp(isize tab = 0) override;
402408
void pressReturn(bool shift) override;
403409
void autoComplete(Tokens &argv) override;
404410
void help(std::ostream &os, const string &argv, isize tabs) override;
405411
string autoCompleteFilename(const string &input) const;
406-
// std::vector<string> autoCompleteFilename(const string &input) const;
407-
// std::vector<string> autoCompleteFilename(const string &path, const string &input) const;
408-
// std::vector<string> autoCompleteFilename(const FSBlock *root, const string &input) const;
409412

410413
//
411414
// Parsing input
@@ -427,7 +430,6 @@ class NavigatorConsole final : public Console
427430
FSBlock &matchPath(const Arguments &argv, const string &token, Tokens &notFound);
428431
FSBlock &matchPath(const Arguments &argv, const string &token, Tokens &notFound, FSBlock &fallback);
429432
FSBlock &matchPath(const string &path, Tokens &notFound);
430-
431433
};
432434

433435
}

Core/Misc/RetroShell/DebuggerConsole.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@ DebuggerConsole::welcome()
4343
Console::welcome();
4444
}
4545

46+
void
47+
DebuggerConsole::summary()
48+
{
49+
std::stringstream ss;
50+
51+
amiga.dump(Category::Current, ss);
52+
53+
*this << vspace{1};
54+
*this << ss;
55+
*this << vspace{1};
56+
}
57+
4658
void
4759
DebuggerConsole::printHelp(isize tab)
4860
{

Core/Misc/RetroShell/NavigatorConsole.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,18 @@ NavigatorConsole::welcome()
4949
Console::welcome();
5050
}
5151

52+
void
53+
NavigatorConsole::summary()
54+
{
55+
std::stringstream ss;
56+
57+
fs.dump(Category::Info, ss);
58+
59+
*this << vspace{1};
60+
*this << ss;
61+
*this << vspace{1};
62+
}
63+
5264
void
5365
NavigatorConsole::printHelp(isize tab)
5466
{

Core/Misc/RetroShell/RetroShell.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ RetroShell::enterConsole(isize nr)
7070
// Print the welcome message if entered the first time
7171
if (current->isEmpty()) { current->exec("welcome"); *this << current->getPrompt(); }
7272

73+
// Print the summary message
74+
current->summary();
75+
7376
// Update prompt
7477
*this << '\r' << current->getPrompt();
7578

0 commit comments

Comments
 (0)