summaryrefslogtreecommitdiff
path: root/Source/Kernel/Core
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-10-10 23:41:29 +0200
committerAlexis211 <alexis211@gmail.com>2009-10-10 23:41:29 +0200
commit378518140711bf19a80218711a018e8fd28d3ca7 (patch)
tree7f4ef7a866b35ce7d6db27ceae4b40f120693341 /Source/Kernel/Core
parent51971d317bfb962f986a7dea3505a3d89e577fe5 (diff)
downloadMelon-378518140711bf19a80218711a018e8fd28d3ca7.tar.gz
Melon-378518140711bf19a80218711a018e8fd28d3ca7.zip
Added a nice animation for the melon logo at boot
Diffstat (limited to 'Source/Kernel/Core')
-rw-r--r--Source/Kernel/Core/kmain.wtf.cpp51
1 files changed, 45 insertions, 6 deletions
diff --git a/Source/Kernel/Core/kmain.wtf.cpp b/Source/Kernel/Core/kmain.wtf.cpp
index 4df2ed5..66e6a8a 100644
--- a/Source/Kernel/Core/kmain.wtf.cpp
+++ b/Source/Kernel/Core/kmain.wtf.cpp
@@ -40,6 +40,49 @@ extern "C" void kmain(multiboot_info_t* mbd, u32int magic);
vt->setCursorCol(60); vt->setColor(KVT_LIGHTCOLOR); *vt << ": ";
#define OK(vt) vt->setColor(KVT_FGCOLOR); *vt << "[ "; vt->setColor(KVT_OKCOLOR); *vt << "OK"; vt->setColor(KVT_FGCOLOR); *vt << " ]\n";
+u32int logoAnimation(void* p) {
+ SimpleVT& vt = *((SimpleVT*)p);
+ vt.setColor(8);
+ u8int *wat = new u8int[melonLogoLines * melonLogoCols];
+ for (int x = 0; x < melonLogoCols; x++) {
+ for (int y = 0; y < melonLogoLines; y++) {
+ wat[x * melonLogoLines + y] = melonLogo[y][x];
+ vt.putChar(y, x, " ");
+ }
+ }
+ vt.setColor(TXTLOGO_FGCOLOR);
+ u32int s = 32;
+ for (int i = 0; i < 255; i++) {
+ for (int x = 0; x < (i < melonLogoCols ? i : melonLogoCols); x++) {
+ for (int y = 0; y < melonLogoLines; y++) {
+ if (wat[x * melonLogoLines + y] != melonLogo[y][x]) {
+ wat[x * melonLogoLines + y]++;
+ if (wat[x * melonLogoLines + y] > melonLogo[y][x] && (y + x) % 2 == 1)
+ wat[x * melonLogoLines + y] += 2;
+ if (wat[x * melonLogoLines + y] >= 127)
+ wat[x * melonLogoLines + y] = 32;
+ vt.setColor(7);
+ vt.putChar(y, x, wat[x * melonLogoLines + y]);
+ } else {
+ vt.setColor(TXTLOGO_FGCOLOR);
+ vt.putChar(y, x, wat[x * melonLogoLines + y]);
+ }
+ }
+ }
+ vt.setColor(8);
+ if (i < melonLogoCols) {
+ for (int y = 0; y < melonLogoLines; y++) {
+ s += 102;
+ while (s > 127) s -= (127 - 33);
+ wat[(i + (y%3)) * melonLogoLines + y] = s;
+ vt.putChar(y, (i + (y%3)), wat[(i + (y%3)) * melonLogoLines + y]);
+ }
+ }
+ Task::currentThread->sleep(20);
+ }
+ return 0;
+}
+
void kmain(multiboot_info_t* mbd, u32int magic) {
DEBUG("Entering kmain.");
@@ -67,11 +110,6 @@ void kmain(multiboot_info_t* mbd, u32int magic) {
//Create a VT for handling the Melon bootup logo
SimpleVT *melonLogoVT = new SimpleVT(melonLogoLines, melonLogoCols, TXTLOGO_FGCOLOR, TXTLOGO_BGCOLOR);
- for (int i = 0; i < melonLogoLines; i++) {
- for (int j = 0; j < melonLogoCols; j++) {
- melonLogoVT->putChar(i, j, melonLogo[i][j]);
- }
- }
melonLogoVT->map(1);
//Create a VT for logging what kernel does
@@ -101,7 +139,8 @@ void kmain(multiboot_info_t* mbd, u32int magic) {
Dev::registerDevice(new Timer()); OK(kvt);
PROCESSING(kvt, "Initializing multitasking...");
- Task::initialize(String((char*)mbd->cmdline), kvt); OK(kvt);
+ Task::initialize(String((char*)mbd->cmdline), kvt);
+ new Thread(logoAnimation, (void*)melonLogoVT, true); OK(kvt);
PROCESSING(kvt, "Mounting first module as ramfs on root directory...");
FileSystem* fs = RamFS::mount((u8int*)mods[0].mod_start, 1024 * 1024, NULL);