Skip to content

Commit

Permalink
Add versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
Kian738 committed Oct 30, 2023
1 parent c745456 commit 9969490
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
14 changes: 14 additions & 0 deletions Source/Boot/EFI/Libs.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,20 @@ void InitializeLibs(EFI_HANDLE imageHandle, EFI_SYSTEM_TABLE *systemTable)
LocateProtocol(&SimpleFileSystemProtocolGuid, (void **)&FileSystem);
}

CHAR16 *GetVersionString()
{
CHAR16 *version = 0;
ALLOC((void **)&version, (18 + 1) * sizeof(CHAR16));

StrCat(version, IntToString(VERSION_MAJOR));
StrCat(version, L".");
StrCat(version, IntToString(VERSION_MINOR));
StrCat(version, L".");
StrCat(version, IntToString(VERSION_PATCH));

return version;
}

void Print(CHAR16 *string)
{
ConOut->OutputString(ConOut, string);
Expand Down
8 changes: 6 additions & 2 deletions Source/Boot/Globals.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#pragma once

#define VERSION_MAJOR (__DATE__[7] - '0') * 1000 + (__DATE__[8] - '0') * 100 + (__DATE__[9] - '0')
#define VERSION_MINOR (__DATE__[0] - 'A' + 1) * 100 + (__DATE__[1] - 'A' + 1)
#define VERSION_PATCH (__DATE__[4] - '0') * 1000 + (__TIME__[0] - '0') * 100 + (__TIME__[1] - '0')

BOOLEAN IsInShell = FALSE;

EFI_HANDLE ImageHandle;
EFI_SYSTEM_TABLE *SystemTable;

Expand All @@ -17,5 +23,3 @@ EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *FileSystem;

EFI_GUID FileInfoId = EFI_FILE_INFO_ID;
EFI_GUID FileSystemInfoId = EFI_FILE_SYSTEM_INFO_ID;

BOOLEAN IsInShell = FALSE;
5 changes: 4 additions & 1 deletion Source/Boot/Shell.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,12 @@ CHAR16 *ReadInput()
void OpenShell()
{
Print(L"Welcome to ");
SetColor(EFI_WHITE);
SetColor(EFI_LIGHTCYAN);
Print(L"Kittnus Shell");
ResetColor();
Print(L" (");
Print(GetVersionString());
Print(L")");
PrintLn(L"!");

PrintLn(L"Type \"Help\" to see available commands");
Expand Down

0 comments on commit 9969490

Please sign in to comment.