Fix kernel keyboard listener being derpy with the letter z

This commit is contained in:
Curle 2021-06-16 22:57:33 +01:00
parent da81dfc597
commit 2b90ae603b
Signed by: TheCurle
GPG Key ID: 5942F13718443F79

View File

@ -42,8 +42,6 @@ int Main(void) {
SerialPrintf("[ boot] The bootloader has put the paging tables at 0x%p.\r\n", ReadControlRegister(3)); SerialPrintf("[ boot] The bootloader has put the paging tables at 0x%p.\r\n", ReadControlRegister(3));
//TraversePageTables();
ListMemoryMap(); ListMemoryMap();
InitPrint(); InitPrint();
@ -59,9 +57,10 @@ int Main(void) {
Printf("Paging complete. System initialized.\n\r"); Printf("Paging complete. System initialized.\n\r");
KernelLoaded = true; KernelLoaded = true;
InternalBuffer = (char*) kmalloc(4098); InternalBuffer = (char*) kmalloc(4096);
SerialPrintf("[ Mem] Allocated a text buffer at 0x%p\r\n", (size_t) InternalBuffer); SerialPrintf("[ Mem] Allocated a text buffer at 0x%p\r\n", (size_t) InternalBuffer);
// TODO: WriteString should accept escape color codes!
SetForegroundColor(0x00FF0000); SetForegroundColor(0x00FF0000);
WriteChar('C'); WriteChar('C');
SetForegroundColor(0x0000FF00); SetForegroundColor(0x0000FF00);
@ -122,10 +121,12 @@ void TrackInternalBuffer(KeyboardData data) {
if(data.Scancode == 0x1C) { if(data.Scancode == 0x1C) {
InternalBuffer[BufferLength] = '\0'; // Null-terminate to make checking easier InternalBuffer[BufferLength] = '\0'; // Null-terminate to make checking easier
SerialPrintf("[ Kbd] Enter pressed.\r\n");
if(strcmp(InternalBuffer, "editor")) { if(strcmp(InternalBuffer, "editor")) {
UninstallKBCallback(InternalBufferID); UninstallKBCallback(InternalBufferID);
StartEditor(CharPrinterCallbackID); StartEditor(CharPrinterCallbackID);
} else if(strcmp(InternalBuffer, "zero")) {
/*entry entryPoint = (entry) ((size_t) _binary_zerosharp_obj_start + 0x20);
entryPoint();*/ // TODO: Zerosharp integration, maybe?
} else { } else {
SerialPrintf("[ Kbd] No match for %s\r\n", InternalBuffer); SerialPrintf("[ Kbd] No match for %s\r\n", InternalBuffer);
memset(InternalBuffer, 0, 4098); memset(InternalBuffer, 0, 4098);
@ -133,7 +134,7 @@ void TrackInternalBuffer(KeyboardData data) {
} }
} }
if(!tentative && data.Scancode < 0x27 && data.Scancode != 0x1C) { if(!tentative && data.Scancode <= 0x2c && data.Scancode != 0x1C) {
SerialPrintf("[ Kbd] Adding %c to the buffer.\r\n", data.Char); SerialPrintf("[ Kbd] Adding %c to the buffer.\r\n", data.Char);
InternalBuffer[BufferLength] = data.Char; InternalBuffer[BufferLength] = data.Char;
BufferLength++; BufferLength++;