mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2026-02-05 01:29:07 +00:00
feat(console): hardware detection et cetera
This commit is contained in:
parent
97bbe2ea66
commit
31f215ea14
118 changed files with 4059 additions and 1931 deletions
32
src/console/command/Commands.hpp
Normal file
32
src/console/command/Commands.hpp
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#ifndef CONSOLE_COMMAND_COMMANDS_HPP
|
||||
#define CONSOLE_COMMAND_COMMANDS_HPP
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "console/Types.hpp"
|
||||
|
||||
#define DECLARE_COMMAND(x) int32_t ConsoleCommand_##x(const char* command, const char* arguments)
|
||||
|
||||
int32_t CCGxRestart(const char* command, const char* argument);
|
||||
|
||||
DECLARE_COMMAND(Quit);
|
||||
DECLARE_COMMAND(Ver);
|
||||
DECLARE_COMMAND(SetMap);
|
||||
|
||||
DECLARE_COMMAND(Help);
|
||||
DECLARE_COMMAND(FontColor);
|
||||
DECLARE_COMMAND(BackGroundColor);
|
||||
DECLARE_COMMAND(HighLightColor);
|
||||
DECLARE_COMMAND(FontSize);
|
||||
DECLARE_COMMAND(Font);
|
||||
DECLARE_COMMAND(BufferSize);
|
||||
DECLARE_COMMAND(ClearConsole);
|
||||
DECLARE_COMMAND(Proportional);
|
||||
DECLARE_COMMAND(CharSpacing);
|
||||
DECLARE_COMMAND(CurrentSettings);
|
||||
DECLARE_COMMAND(DefaultSettings);
|
||||
DECLARE_COMMAND(CloseConsole);
|
||||
DECLARE_COMMAND(RepeatHandler);
|
||||
DECLARE_COMMAND(AppendLogToFile);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#include "console/Command.hpp"
|
||||
#include "console/command/Commands.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
|
||||
int32_t ConsoleCommand_AppendLogToFile(const char* command, const char* arguments) {
|
||||
// TODO
|
||||
return 1;
|
||||
DECLARE_COMMAND(AppendLogToFile) {
|
||||
WHOA_UNIMPLEMENTED(1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "console/Command.hpp"
|
||||
#include "console/command/Commands.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
|
||||
int32_t ConsoleCommand_BackGroundColor(const char* command, const char* arguments) {
|
||||
// TODO
|
||||
return 1;
|
||||
DECLARE_COMMAND(BackGroundColor) {
|
||||
WHOA_UNIMPLEMENTED(1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "console/Command.hpp"
|
||||
#include "console/command/Commands.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
|
||||
int32_t ConsoleCommand_BufferSize(const char* command, const char* arguments) {
|
||||
// TODO
|
||||
return 1;
|
||||
DECLARE_COMMAND(BufferSize) {
|
||||
WHOA_UNIMPLEMENTED(1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "console/Command.hpp"
|
||||
#include "console/command/Commands.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
|
||||
int32_t ConsoleCommand_CharSpacing(const char* command, const char* arguments) {
|
||||
// TODO
|
||||
return 1;
|
||||
DECLARE_COMMAND(CharSpacing) {
|
||||
WHOA_UNIMPLEMENTED(1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "console/Command.hpp"
|
||||
#include "console/Console.hpp"
|
||||
#include "console/command/Commands.hpp"
|
||||
|
||||
int32_t ConsoleCommand_ClearConsole(const char* command, const char* arguments) {
|
||||
DECLARE_COMMAND(ClearConsole) {
|
||||
ConsoleClear();
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "console/Command.hpp"
|
||||
#include "console/Console.hpp"
|
||||
#include "console/command/Commands.hpp"
|
||||
|
||||
int32_t ConsoleCommand_CloseConsole(const char* command, const char* arguments) {
|
||||
DECLARE_COMMAND(CloseConsole) {
|
||||
ConsoleSetActive(false);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "console/Command.hpp"
|
||||
#include "console/command/Commands.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
|
||||
int32_t ConsoleCommand_CurrentSettings(const char* command, const char* arguments) {
|
||||
// TODO
|
||||
return 1;
|
||||
DECLARE_COMMAND(CurrentSettings) {
|
||||
WHOA_UNIMPLEMENTED(1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "console/Command.hpp"
|
||||
#include "console/command/Commands.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
|
||||
int32_t ConsoleCommand_DefaultSettings(const char* command, const char* arguments) {
|
||||
// TODO
|
||||
return 1;
|
||||
DECLARE_COMMAND(DefaultSettings) {
|
||||
WHOA_UNIMPLEMENTED(1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "console/Command.hpp"
|
||||
#include "console/command/Commands.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
|
||||
int32_t ConsoleCommand_Font(const char* command, const char* arguments) {
|
||||
// TODO
|
||||
return 1;
|
||||
DECLARE_COMMAND(Font) {
|
||||
WHOA_UNIMPLEMENTED(1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "console/Command.hpp"
|
||||
#include "console/command/Commands.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
|
||||
int32_t ConsoleCommand_FontColor(const char* command, const char* arguments) {
|
||||
// TODO
|
||||
return 1;
|
||||
DECLARE_COMMAND(FontColor) {
|
||||
WHOA_UNIMPLEMENTED(1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "console/Command.hpp"
|
||||
#include "console/command/Commands.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
|
||||
int32_t ConsoleCommand_FontSize(const char* command, const char* arguments) {
|
||||
// TODO
|
||||
return 1;
|
||||
DECLARE_COMMAND(FontSize) {
|
||||
WHOA_UNIMPLEMENTED(1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include "console/Console.hpp"
|
||||
#include "console/Command.hpp"
|
||||
#include "console/Line.hpp"
|
||||
#include "console/command/Commands.hpp"
|
||||
|
||||
struct CategoryTranslation {
|
||||
CATEGORY categoryValue;
|
||||
|
|
@ -7,18 +8,18 @@ struct CategoryTranslation {
|
|||
};
|
||||
|
||||
CategoryTranslation s_translation[] = {
|
||||
{ DEBUG, "debug" },
|
||||
{ DEBUG, "debug" },
|
||||
{ GRAPHICS, "graphics" },
|
||||
{ CONSOLE, "console" },
|
||||
{ COMBAT, "combat" },
|
||||
{ GAME, "game" },
|
||||
{ DEFAULT, "default" },
|
||||
{ NET, "net" },
|
||||
{ SOUND, "sound" },
|
||||
{ GM, "gm" }
|
||||
{ CONSOLE, "console" },
|
||||
{ COMBAT, "combat" },
|
||||
{ GAME, "game" },
|
||||
{ DEFAULT, "default" },
|
||||
{ NET, "net" },
|
||||
{ SOUND, "sound" },
|
||||
{ GM, "gm" }
|
||||
};
|
||||
|
||||
int32_t ConsoleCommand_Help(const char* command, const char* arguments) {
|
||||
DECLARE_COMMAND(Help) {
|
||||
char buffer[128];
|
||||
bool showCategories = *arguments == '\0';
|
||||
|
||||
|
|
@ -42,70 +43,72 @@ int32_t ConsoleCommand_Help(const char* command, const char* arguments) {
|
|||
|
||||
ConsoleWrite(buffer, WARNING_COLOR);
|
||||
ConsoleWrite("For more information type 'help [command] or [category]'", WARNING_COLOR);
|
||||
} else {
|
||||
for (size_t i = 0; i < numTranslation; i++) {
|
||||
auto& translation = s_translation[i];
|
||||
|
||||
if (SStrCmpI(translation.categoryString, arguments, STORM_MAX_STR) == 0) {
|
||||
if (translation.categoryValue != NONE) {
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
SStrPrintf(buffer, sizeof(buffer), "Commands registered for the category %s:", arguments);
|
||||
return 1;
|
||||
}
|
||||
|
||||
ConsoleWrite(buffer, WARNING_COLOR);
|
||||
for (size_t i = 0; i < numTranslation; i++) {
|
||||
auto& translation = s_translation[i];
|
||||
|
||||
buffer[0] = '\0';
|
||||
if (SStrCmpI(translation.categoryString, arguments, STORM_MAX_STR) == 0) {
|
||||
if (translation.categoryValue != NONE) {
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
SStrPrintf(buffer, sizeof(buffer), "Commands registered for the category %s:", arguments);
|
||||
|
||||
uint32_t counter = 0;
|
||||
ConsoleWrite(buffer, WARNING_COLOR);
|
||||
|
||||
for (auto cmd = g_consoleCommandHash.Head(); cmd; cmd = g_consoleCommandHash.Next(cmd)) {
|
||||
if (cmd->m_category == translation.categoryValue) {
|
||||
SStrPack(buffer, cmd->m_key.m_str, sizeof(buffer));
|
||||
SStrPack(buffer, ", ", sizeof(buffer));
|
||||
buffer[0] = '\0';
|
||||
|
||||
if (++counter == 8) {
|
||||
ConsoleWrite(buffer, DEFAULT_COLOR);
|
||||
buffer[0] = '\0';
|
||||
counter = 0;
|
||||
}
|
||||
uint32_t counter = 0;
|
||||
|
||||
for (auto cmd = g_consoleCommandHash.Head(); cmd; cmd = g_consoleCommandHash.Next(cmd)) {
|
||||
if (cmd->m_category == translation.categoryValue) {
|
||||
SStrPack(buffer, cmd->m_key.m_str, sizeof(buffer));
|
||||
SStrPack(buffer, ", ", sizeof(buffer));
|
||||
|
||||
if (++counter == 8) {
|
||||
ConsoleWrite(buffer, DEFAULT_COLOR);
|
||||
buffer[0] = '\0';
|
||||
counter = 0;
|
||||
}
|
||||
}
|
||||
|
||||
const char* wr = nullptr;
|
||||
|
||||
if (buffer[0]) {
|
||||
auto comma = reinterpret_cast<char*>(SStrChrR(buffer, ','));
|
||||
if (comma) {
|
||||
*comma = 0x00;
|
||||
}
|
||||
|
||||
wr = buffer;
|
||||
} else {
|
||||
wr = "NONE";
|
||||
}
|
||||
|
||||
ConsoleWrite(wr, DEFAULT_COLOR);
|
||||
break;
|
||||
}
|
||||
|
||||
const char* wr = nullptr;
|
||||
|
||||
if (buffer[0]) {
|
||||
auto comma = reinterpret_cast<char*>(SStrChrR(buffer, ','));
|
||||
if (comma) {
|
||||
*comma = '\0';
|
||||
}
|
||||
|
||||
wr = buffer;
|
||||
} else {
|
||||
wr = "NONE";
|
||||
}
|
||||
|
||||
ConsoleWrite(wr, DEFAULT_COLOR);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
auto cmd = g_consoleCommandHash.Ptr(arguments);
|
||||
|
||||
if (cmd == nullptr) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
SStrPrintf(buffer, 0xa5, "Help for command %s:", arguments);
|
||||
ConsoleWrite(buffer, WARNING_COLOR);
|
||||
|
||||
auto help = cmd->m_helpText;
|
||||
if (help == nullptr) {
|
||||
help = "No help yet";
|
||||
}
|
||||
|
||||
SStrPrintf(buffer, 0xa5, " %s %s", arguments, help);
|
||||
ConsoleWrite(buffer, DEFAULT_COLOR);
|
||||
}
|
||||
|
||||
auto cmd = g_consoleCommandHash.Ptr(arguments);
|
||||
|
||||
if (cmd == nullptr) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
SStrPrintf(buffer, 0xA5, "Help for command %s:", arguments);
|
||||
ConsoleWrite(buffer, WARNING_COLOR);
|
||||
|
||||
auto help = cmd->m_helpText;
|
||||
if (help == nullptr) {
|
||||
help = "No help yet";
|
||||
}
|
||||
|
||||
SStrPrintf(buffer, 0xA5, " %s %s", arguments, help);
|
||||
ConsoleWrite(buffer, DEFAULT_COLOR);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "console/Command.hpp"
|
||||
#include "console/command/Commands.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
|
||||
int32_t ConsoleCommand_HighLightColor(const char* command, const char* arguments) {
|
||||
// TODO
|
||||
return 1;
|
||||
DECLARE_COMMAND(HighLightColor) {
|
||||
WHOA_UNIMPLEMENTED(1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "console/Command.hpp"
|
||||
#include "console/command/Commands.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
|
||||
int32_t ConsoleCommand_Proportional(const char* command, const char* arguments) {
|
||||
// TODO
|
||||
return 1;
|
||||
DECLARE_COMMAND(Proportional) {
|
||||
WHOA_UNIMPLEMENTED(1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
#include "console/Command.hpp"
|
||||
#include "console/Console.hpp"
|
||||
#include "console/command/Commands.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
|
||||
int32_t ConsoleCommand_RepeatHandler(const char* command, const char* arguments) {
|
||||
// TODO
|
||||
return 1;
|
||||
DECLARE_COMMAND(RepeatHandler) {
|
||||
WHOA_UNIMPLEMENTED(1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "console/Command.hpp"
|
||||
#include "console/Line.hpp"
|
||||
#include "console/Console.hpp"
|
||||
#include "console/command/Commands.hpp"
|
||||
|
||||
int32_t ConsoleCommand_Ver(const char* command, const char* arguments) {
|
||||
DECLARE_COMMAND(Ver) {
|
||||
ConsoleWrite("Whoa <https://github.com/whoahq/whoa>", DEFAULT_COLOR);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
16
src/console/command/default/GxRestart.cpp
Normal file
16
src/console/command/default/GxRestart.cpp
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#include "console/command/Commands.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
|
||||
int32_t CCGxRestart(const char* command, const char* argument) {
|
||||
// sub_512900();
|
||||
// ValidateFormatMonitor(s_requestedFormat);
|
||||
|
||||
// if (!GxDevSetFormat(s_requestedFormat)) {
|
||||
// ConsoleWrite("unable to set requested display mode", DEFAULT_COLOR);
|
||||
// memcpy(&s_requestedFormat, &s_lastGoodFormat, sizeof(CGxFormat));
|
||||
|
||||
// if (!GxDevSetFormat())
|
||||
// }
|
||||
|
||||
WHOA_UNIMPLEMENTED(1);
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#include "console/Command.hpp"
|
||||
#include "console/Console.hpp"
|
||||
#include "console/command/Commands.hpp"
|
||||
|
||||
int32_t ConsoleCommand_Quit(const char* command, const char* arguments) {
|
||||
DECLARE_COMMAND(Quit) {
|
||||
ConsolePostClose();
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#include "console/Command.hpp"
|
||||
#include "console/command/Commands.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
|
||||
int32_t ConsoleCommand_SetMap(const char* command, const char* arguments) {
|
||||
return 1;
|
||||
DECLARE_COMMAND(SetMap) {
|
||||
WHOA_UNIMPLEMENTED(1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue