From 899c733ec140153f6d005d9997b81ef8109b29e4 Mon Sep 17 00:00:00 2001 From: Sharoy Veduchi <61427449+doodayev@users.noreply.github.com> Date: Mon, 29 May 2023 03:01:03 -0700 Subject: [PATCH 01/18] New version of PaletteGodGenerate (#106) This version makes seeding with GodPick optional and even if you want to seed it will only require one press of "Ok". The rest is taken care of by RandI32. --- src/Home/PaletteEditor/PaletteGod.ZC | 31 +++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/Home/PaletteEditor/PaletteGod.ZC b/src/Home/PaletteEditor/PaletteGod.ZC index 1de348d1..02fe7a8e 100755 --- a/src/Home/PaletteEditor/PaletteGod.ZC +++ b/src/Home/PaletteEditor/PaletteGod.ZC @@ -12,4 +12,33 @@ public U0 PaletteGodGenerate() } } -PaletteGodGenerate; \ No newline at end of file +public U0 PaletteGodGenerate2(Bool NeedForSneed=0) +{ + //This one will involve a lot less tapping + //and be a lot more random + + I64 i; + CBGR24 palette; + I64 SNEED; + I32 FEED; + + if(!NeedForSneed) //By default if no args are passed, it assumes the user + { //doesn't want or care for a seed. + goto Generate; + } + else //If a 1 is passed of course, we seed the RNG + { + + SNEED = GodPick; + Seed(SNEED); + } +Generate: + + for (i=0; i < 16; i++) + { + FEED = RandI32; + palette = FEED & 0xFFFFFF; + gr_palette[i] = palette; + LFBFlush; + } +} From 7da26fdde99d42cf132832b1468b133c06564c4c Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Tue, 30 May 2023 01:10:27 +0900 Subject: [PATCH 02/18] palette generation cleanup --- src/Home/PaletteEditor/PaletteGod.ZC | 47 ++++++++-------------------- 1 file changed, 13 insertions(+), 34 deletions(-) diff --git a/src/Home/PaletteEditor/PaletteGod.ZC b/src/Home/PaletteEditor/PaletteGod.ZC index 02fe7a8e..928846f8 100755 --- a/src/Home/PaletteEditor/PaletteGod.ZC +++ b/src/Home/PaletteEditor/PaletteGod.ZC @@ -1,43 +1,22 @@ - -public U0 PaletteGodGenerate() +public U0 PaletteGod(Bool seedUse=TRUE, Bool instant=TRUE) { + // Instantly generate a random palette, seed-based or not I64 i; CBGR24 palette; + I32 color; - for (i = 0; i < 16; i++) - { - palette = GodPick & 0xFFFFFF; - gr_palette[i] = palette; - LFBFlush; - } -} - -public U0 PaletteGodGenerate2(Bool NeedForSneed=0) -{ - //This one will involve a lot less tapping - //and be a lot more random - - I64 i; - CBGR24 palette; - I64 SNEED; - I32 FEED; - - if(!NeedForSneed) //By default if no args are passed, it assumes the user - { //doesn't want or care for a seed. - goto Generate; - } - else //If a 1 is passed of course, we seed the RNG - { - - SNEED = GodPick; - Seed(SNEED); - } -Generate: - + if (seedUse) + Seed(GodPick); for (i=0; i < 16; i++) { - FEED = RandI32; - palette = FEED & 0xFFFFFF; + if (instant || seedUse) + { + color = RandI32; + palette = color & 0xFFFFFF; + } + else { + palette = GodPick & 0xFFFFFF; + } gr_palette[i] = palette; LFBFlush; } From 17578a1f78053e3eb581491eeacd4274eeda9eab Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Tue, 30 May 2023 01:11:28 +0900 Subject: [PATCH 03/18] Run PaletteGod on include --- src/Home/PaletteEditor/PaletteGod.ZC | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Home/PaletteEditor/PaletteGod.ZC b/src/Home/PaletteEditor/PaletteGod.ZC index 928846f8..be6c49c7 100755 --- a/src/Home/PaletteEditor/PaletteGod.ZC +++ b/src/Home/PaletteEditor/PaletteGod.ZC @@ -21,3 +21,5 @@ public U0 PaletteGod(Bool seedUse=TRUE, Bool instant=TRUE) LFBFlush; } } + +PaletteGod; \ No newline at end of file From 782bba268c23accc4e3245488c7c16378ea20a85 Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Tue, 30 May 2023 01:30:41 +0900 Subject: [PATCH 04/18] 16colors PaletteEdit --- src/Home/PaletteEditor/PaletteEdit.ZC | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Home/PaletteEditor/PaletteEdit.ZC b/src/Home/PaletteEditor/PaletteEdit.ZC index 30e2e785..48e084e0 100755 --- a/src/Home/PaletteEditor/PaletteEdit.ZC +++ b/src/Home/PaletteEditor/PaletteEdit.ZC @@ -61,9 +61,12 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) tempColor = gr_palette[selected_color]; if (i < border || i > 12 - border || j < border || j > 12 - border) tempColor = 0x000000; - DrawPixel(c->win_task->pix_left + 78 + i, t + 7 + j, tempColor); + // draw color preview + dc->color = tempColor; + GrPlot(dc, c->win_task->pix_left + 78 + i, t + 7 + j); + // DrawPixel(c->win_task->pix_left + 78 + i, t + 7 + j, tempColor); } - GrPrint(dc, 10, 26, "Current Color: #%d", selected_color + 1); + GrPrint(dc, 10, 26, "Current Color: #%d", selected_color); if (selected_color == 15) dc->color = LTGRAY; else if (gr_palette[selected_color] > 0xCCCCCC) @@ -165,8 +168,10 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) else tempColor = 0x000000; } - // color preview - DrawPixel(c->win_task->pix_left + j + (size * i), c->win_task->pix_bottom - size * 1.5 + k, tempColor); + // draw color preview + dc->color = tempColor; + GrPlot(dc, c->win_task->pix_left + j + (size * i), c->win_task->pix_bottom - size * 1.5 + k); + // DrawPixel(c->win_task->pix_left + j + (size * i), c->win_task->pix_bottom - size * 1.5 + k, tempColor); } } // color label and text preview @@ -198,8 +203,8 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) bias = (size / 2) - 4; if (i >= 9) bias = (size / 2) - 8; - GrPrint(dc, bias + (i * size), c->win_task->pix_height - (size * .6) + (size / 4), "%d", i + 1); - GrPrint(dc, 10, (size2 * 2) + 70 + 16 * i, "#%d: Test", i + 1); + GrPrint(dc, bias + (i * size), c->win_task->pix_height - (size * .6) + (size / 4), "%d", i); + GrPrint(dc, 10, (size2 * 2) + 70 + 16 * i, "#%d: Test", i); } From 9cf9e07805ef92cccaf150056aa9d9a9760e5e81 Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Wed, 31 May 2023 01:14:03 +0900 Subject: [PATCH 05/18] 16colors --- src/Home/PaletteEditor/PaletteEdit.ZC | 47 ++++++++------------------- 1 file changed, 14 insertions(+), 33 deletions(-) diff --git a/src/Home/PaletteEditor/PaletteEdit.ZC b/src/Home/PaletteEditor/PaletteEdit.ZC index 48e084e0..84713f59 100755 --- a/src/Home/PaletteEditor/PaletteEdit.ZC +++ b/src/Home/PaletteEditor/PaletteEdit.ZC @@ -44,6 +44,7 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) i, k, j,// l, pos, col, bias; + I64 rectSize = size / 16; // Size of each color rectangle CBGR24 tempColor; /////////////////////// @@ -53,20 +54,8 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) // current color box preview dc->color = BLACK; GrPrint(dc, 10, 10, "Preview:"); + GrPrint(dc, 10, 26, "Current Color: #%d", selected_color); - // pixel loop for current color preview - for (i = 0; i <= 12; i++) - for (j = 0; j <= 12; j++) - { - tempColor = gr_palette[selected_color]; - if (i < border || i > 12 - border || j < border || j > 12 - border) - tempColor = 0x000000; - // draw color preview - dc->color = tempColor; - GrPlot(dc, c->win_task->pix_left + 78 + i, t + 7 + j); - // DrawPixel(c->win_task->pix_left + 78 + i, t + 7 + j, tempColor); - } - GrPrint(dc, 10, 26, "Current Color: #%d", selected_color); if (selected_color == 15) dc->color = LTGRAY; else if (gr_palette[selected_color] > 0xCCCCCC) @@ -76,6 +65,9 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) GrRect(dc, 94, 8, 58, 12); dc->color = selected_color; + // Color preview next to #hex + GrRect(dc, 78, 8, 12, 12); + // #Hex value GrPrint(dc, 95, 10, "#%x%x%x", gr_palette[selected_color].r, gr_palette[selected_color].g, gr_palette[selected_color].b); @@ -155,25 +147,6 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) for (i = 0; i < COLORS_NUM; i++) { - for (j = 0; j <= size; j++) - { - for (k = 0; k <= size; k++) - { - tempColor = gr_palette[i]; - // black borders - if (k < border || k > size - border || j < border || j > size - border - 1) - { - if (selected_color == i) - tempColor = 0xFFFFFF; - else - tempColor = 0x000000; - } - // draw color preview - dc->color = tempColor; - GrPlot(dc, c->win_task->pix_left + j + (size * i), c->win_task->pix_bottom - size * 1.5 + k); - // DrawPixel(c->win_task->pix_left + j + (size * i), c->win_task->pix_bottom - size * 1.5 + k, tempColor); - } - } // color label and text preview // TODO: THIS LOGIC DOESNT WORK ON LIGHT THEMES // if color too light or too dark add bg @@ -188,6 +161,11 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) dc->color = LTRED;*/ else dc->color = 15; + + // Border for preview box + GrRect(dc, (size * i)-1, c->win_task->pix_height - (size*1.5)-1, size+2, size+2); + + if (i == selected_color) dc->color = 0; GrRect(dc, 6, (size2 * 2) + 65 + 16 * i, 80, 18); @@ -195,7 +173,7 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) GrRect(dc, 6, (size2 * 2) + 65 + 16 * i, 80, 18); - + if (i == selected_color) dc->color = 15; else @@ -205,6 +183,9 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) bias = (size / 2) - 8; GrPrint(dc, bias + (i * size), c->win_task->pix_height - (size * .6) + (size / 4), "%d", i); GrPrint(dc, 10, (size2 * 2) + 70 + 16 * i, "#%d: Test", i); + + // preview box + GrRect(dc, (size * i), c->win_task->pix_height - (size*1.5), size, size); } From 5700e961c8f6261235b4a608b2c86e06f5623f99 Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Wed, 31 May 2023 01:40:05 +0900 Subject: [PATCH 06/18] Random Colors hotkey in palette editor --- src/Home/PaletteEditor/Load.ZC | 1 + src/Home/PaletteEditor/PaletteEdit.ZC | 16 +++++--- src/Home/PaletteEditor/PaletteGod.ZC | 53 +++++++++++++++++---------- 3 files changed, 46 insertions(+), 24 deletions(-) diff --git a/src/Home/PaletteEditor/Load.ZC b/src/Home/PaletteEditor/Load.ZC index 812b6cab..7678cba0 100755 --- a/src/Home/PaletteEditor/Load.ZC +++ b/src/Home/PaletteEditor/Load.ZC @@ -1,4 +1,5 @@ Cd(__DIR__);; #define PALETTES_PATH "~/PaletteEditor/Palettes/" #include "PaletteSelect" +#include "PaletteGod" #include "PaletteEdit" \ No newline at end of file diff --git a/src/Home/PaletteEditor/PaletteEdit.ZC b/src/Home/PaletteEditor/PaletteEdit.ZC index 84713f59..5fda5cc7 100755 --- a/src/Home/PaletteEditor/PaletteEdit.ZC +++ b/src/Home/PaletteEditor/PaletteEdit.ZC @@ -38,14 +38,12 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) CSliderState *s = c->state; I64 size = (c->win_task->pix_width / 16), - border = size / 16, +// border = size / 16, size2 = (c->win_task->pix_height / 32), // slider_amount = 3, - i, k, j,// l, + i, pos, col, bias; - I64 rectSize = size / 16; // Size of each color rectangle - CBGR24 tempColor; /////////////////////// // CURRENT SELECTION // @@ -54,7 +52,7 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) // current color box preview dc->color = BLACK; GrPrint(dc, 10, 10, "Preview:"); - GrPrint(dc, 10, 26, "Current Color: #%d", selected_color); + GrPrint(dc, 10, 26, "Current Color: #%d", selected_color); if (selected_color == 15) dc->color = LTGRAY; @@ -428,6 +426,14 @@ public U0 PaletteEditor() current_palette = ""; current_palette = PaletteSelect; break; + case 'r': + gr_palette[selected_color] = ColorGod(FALSE, TRUE); + LFBFlush; + break; + case 'R': + gr_palette[selected_color] = PaletteGod(FALSE, TRUE); + LFBFlush; + break; case CH_CTRLI: PopUpOk("\n\n Use the arrows to select color\n\n # to manually input hex value","\n\n\n\t\tMade by y4my4m\n\n"); break; diff --git a/src/Home/PaletteEditor/PaletteGod.ZC b/src/Home/PaletteEditor/PaletteGod.ZC index be6c49c7..35cb3091 100755 --- a/src/Home/PaletteEditor/PaletteGod.ZC +++ b/src/Home/PaletteEditor/PaletteGod.ZC @@ -1,25 +1,40 @@ public U0 PaletteGod(Bool seedUse=TRUE, Bool instant=TRUE) { - // Instantly generate a random palette, seed-based or not + // Instantly generate a random palette, seed-based or not I64 i; - CBGR24 palette; - I32 color; + CBGR24 color; - if (seedUse) - Seed(GodPick); - for (i=0; i < 16; i++) - { - if (instant || seedUse) - { - color = RandI32; - palette = color & 0xFFFFFF; - } - else { - palette = GodPick & 0xFFFFFF; - } - gr_palette[i] = palette; - LFBFlush; - } + if (seedUse) + Seed(GodPick); + for (i=0; i < 16; i++) + { + if (instant || seedUse) + { + color = RandI32 & 0xFFFFFF; + } + else { + color = GodPick & 0xFFFFFF; + } + gr_palette[i] = color; + LFBFlush; + } } -PaletteGod; \ No newline at end of file +CBGR24 ColorGod(Bool seedUse=TRUE, Bool instant=TRUE) +{ + // Instantly generate a random color, seed-based or not + + if (seedUse) + Seed(GodPick); + if (instant || seedUse) + { + return RandI32 & 0xFFFFFF; + } + else { + return GodPick & 0xFFFFFF; + } + +} + + +// PaletteGod; From b8fb29fa2d2857c8eb6c98af35a4abf0704fdbcb Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Wed, 31 May 2023 01:52:47 +0900 Subject: [PATCH 07/18] Fix --- src/Home/PaletteEditor/Load.ZC | 2 +- src/Home/PaletteEditor/PaletteEdit.ZC | 4 +++- src/Home/PaletteEditor/Palettes/Tradition.ZC | 10 ++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100755 src/Home/PaletteEditor/Palettes/Tradition.ZC diff --git a/src/Home/PaletteEditor/Load.ZC b/src/Home/PaletteEditor/Load.ZC index 7678cba0..ebe27070 100755 --- a/src/Home/PaletteEditor/Load.ZC +++ b/src/Home/PaletteEditor/Load.ZC @@ -1,5 +1,5 @@ Cd(__DIR__);; #define PALETTES_PATH "~/PaletteEditor/Palettes/" #include "PaletteSelect" -#include "PaletteGod" +#include "PaletteGod" #include "PaletteEdit" \ No newline at end of file diff --git a/src/Home/PaletteEditor/PaletteEdit.ZC b/src/Home/PaletteEditor/PaletteEdit.ZC index 5fda5cc7..b6b5c21c 100755 --- a/src/Home/PaletteEditor/PaletteEdit.ZC +++ b/src/Home/PaletteEditor/PaletteEdit.ZC @@ -357,6 +357,8 @@ public U0 PaletteEditor() " PreviousColor(,,SC_CURSOR_UP);" " NextColor(,,SC_CURSOR_RIGHT);" " NextColor(,,SC_CURSOR_DOWN);" + " RandomColor(,,'r');" + " RandomPalette(,,'R');" "}" "About {" " Info(,CH_CTRLI);" @@ -431,7 +433,7 @@ public U0 PaletteEditor() LFBFlush; break; case 'R': - gr_palette[selected_color] = PaletteGod(FALSE, TRUE); + gr_palette[selected_color] = PaletteGod(FALSE, TRUE); LFBFlush; break; case CH_CTRLI: diff --git a/src/Home/PaletteEditor/Palettes/Tradition.ZC b/src/Home/PaletteEditor/Palettes/Tradition.ZC new file mode 100755 index 00000000..e0ef467b --- /dev/null +++ b/src/Home/PaletteEditor/Palettes/Tradition.ZC @@ -0,0 +1,10 @@ +public CBGR24 gr_palette_tradition[COLORS_NUM] = { +0xE8E8E9, 0x374B88, 0x4FBC2C, 0x29CACE, 0xDD0000, 0x8C33FF, 0x875721, 0x7F7A7C, 0x15171C, 0x2EA1FF, 0x4FFF00, 0xFFBB, 0x690000, 0x6E3FFC, 0xFFCC00, 0xC0F14 +}; +public U0 PaletteSetTradition(Bool persistent=TRUE) +{ + GrPaletteSet(gr_palette_tradition); + LFBFlush; + if (persistent) + fp_set_std_palette = &PaletteSetTradition; +} \ No newline at end of file From 3f64a301e7e7eadffb6122c6252866b70d05446d Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Wed, 31 May 2023 02:02:00 +0900 Subject: [PATCH 08/18] Cleaner --- src/Home/PaletteEditor/PaletteGod.ZC | 35 ++++++++++------------------ 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/src/Home/PaletteEditor/PaletteGod.ZC b/src/Home/PaletteEditor/PaletteGod.ZC index 35cb3091..fea5f2ec 100755 --- a/src/Home/PaletteEditor/PaletteGod.ZC +++ b/src/Home/PaletteEditor/PaletteGod.ZC @@ -1,28 +1,6 @@ -public U0 PaletteGod(Bool seedUse=TRUE, Bool instant=TRUE) -{ - // Instantly generate a random palette, seed-based or not - I64 i; - CBGR24 color; - - if (seedUse) - Seed(GodPick); - for (i=0; i < 16; i++) - { - if (instant || seedUse) - { - color = RandI32 & 0xFFFFFF; - } - else { - color = GodPick & 0xFFFFFF; - } - gr_palette[i] = color; - LFBFlush; - } -} - CBGR24 ColorGod(Bool seedUse=TRUE, Bool instant=TRUE) { - // Instantly generate a random color, seed-based or not + // Generate a random color, seed-based or not if (seedUse) Seed(GodPick); @@ -36,5 +14,16 @@ CBGR24 ColorGod(Bool seedUse=TRUE, Bool instant=TRUE) } +public U0 PaletteGod(Bool seedUse=TRUE, Bool instant=TRUE) +{ + // Generate a random palette, seed-based or not + I64 i; + + for (i=0; i < 16; i++) + { + gr_palette[i] = ColorGod(seedUse, instant); + LFBFlush; + } +} // PaletteGod; From 18e545dfe88e9639b107e016df706de4eb22e933 Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Wed, 31 May 2023 02:05:08 +0900 Subject: [PATCH 09/18] Cleanerer --- src/Home/PaletteEditor/PaletteEdit.ZC | 3 +-- src/Home/PaletteEditor/PaletteGod.ZC | 12 ++---------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/Home/PaletteEditor/PaletteEdit.ZC b/src/Home/PaletteEditor/PaletteEdit.ZC index b6b5c21c..f9045e9c 100755 --- a/src/Home/PaletteEditor/PaletteEdit.ZC +++ b/src/Home/PaletteEditor/PaletteEdit.ZC @@ -433,8 +433,7 @@ public U0 PaletteEditor() LFBFlush; break; case 'R': - gr_palette[selected_color] = PaletteGod(FALSE, TRUE); - LFBFlush; + PaletteGod(FALSE, TRUE); break; case CH_CTRLI: PopUpOk("\n\n Use the arrows to select color\n\n # to manually input hex value","\n\n\n\t\tMade by y4my4m\n\n"); diff --git a/src/Home/PaletteEditor/PaletteGod.ZC b/src/Home/PaletteEditor/PaletteGod.ZC index fea5f2ec..329250f4 100755 --- a/src/Home/PaletteEditor/PaletteGod.ZC +++ b/src/Home/PaletteEditor/PaletteGod.ZC @@ -1,29 +1,21 @@ CBGR24 ColorGod(Bool seedUse=TRUE, Bool instant=TRUE) { // Generate a random color, seed-based or not - if (seedUse) Seed(GodPick); if (instant || seedUse) - { return RandI32 & 0xFFFFFF; - } - else { + else return GodPick & 0xFFFFFF; - } - } public U0 PaletteGod(Bool seedUse=TRUE, Bool instant=TRUE) { // Generate a random palette, seed-based or not I64 i; - for (i=0; i < 16; i++) - { gr_palette[i] = ColorGod(seedUse, instant); - LFBFlush; - } + LFBFlush; } // PaletteGod; From 2f7381847a7f956552a42d0b319ff714b98ed269 Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Wed, 31 May 2023 02:21:09 +0900 Subject: [PATCH 10/18] Fix --- src/Home/PaletteEditor/PaletteEdit.ZC | 5 ++--- src/Home/PaletteEditor/PaletteGod.ZC | 10 +++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Home/PaletteEditor/PaletteEdit.ZC b/src/Home/PaletteEditor/PaletteEdit.ZC index f9045e9c..2772e7b2 100755 --- a/src/Home/PaletteEditor/PaletteEdit.ZC +++ b/src/Home/PaletteEditor/PaletteEdit.ZC @@ -171,7 +171,6 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) GrRect(dc, 6, (size2 * 2) + 65 + 16 * i, 80, 18); - if (i == selected_color) dc->color = 15; else @@ -421,7 +420,7 @@ public U0 PaletteEditor() if (selected_color == 15) selected_color = -1; SelectColor(selected_color + 1, c); - break; + break; } break; case CH_CTRLO: @@ -429,7 +428,7 @@ public U0 PaletteEditor() current_palette = PaletteSelect; break; case 'r': - gr_palette[selected_color] = ColorGod(FALSE, TRUE); + gr_palette[selected_color] = ColorGod(TRUE); LFBFlush; break; case 'R': diff --git a/src/Home/PaletteEditor/PaletteGod.ZC b/src/Home/PaletteEditor/PaletteGod.ZC index 329250f4..d8ad16d9 100755 --- a/src/Home/PaletteEditor/PaletteGod.ZC +++ b/src/Home/PaletteEditor/PaletteGod.ZC @@ -1,9 +1,7 @@ -CBGR24 ColorGod(Bool seedUse=TRUE, Bool instant=TRUE) +CBGR24 ColorGod(Bool instant=TRUE) { // Generate a random color, seed-based or not - if (seedUse) - Seed(GodPick); - if (instant || seedUse) + if (instant) return RandI32 & 0xFFFFFF; else return GodPick & 0xFFFFFF; @@ -13,8 +11,10 @@ public U0 PaletteGod(Bool seedUse=TRUE, Bool instant=TRUE) { // Generate a random palette, seed-based or not I64 i; + if (seedUse) + Seed(GodPick); for (i=0; i < 16; i++) - gr_palette[i] = ColorGod(seedUse, instant); + gr_palette[i] = ColorGod(instant); LFBFlush; } From 3c2ab12e309bc39dc596fb861cd6bcfd44bd99b4 Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Wed, 31 May 2023 02:23:31 +0900 Subject: [PATCH 11/18] Removed cursor --- src/Home/PaletteEditor/PaletteGod.ZC | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Home/PaletteEditor/PaletteGod.ZC b/src/Home/PaletteEditor/PaletteGod.ZC index d8ad16d9..4a2fd688 100755 --- a/src/Home/PaletteEditor/PaletteGod.ZC +++ b/src/Home/PaletteEditor/PaletteGod.ZC @@ -14,7 +14,7 @@ public U0 PaletteGod(Bool seedUse=TRUE, Bool instant=TRUE) if (seedUse) Seed(GodPick); for (i=0; i < 16; i++) - gr_palette[i] = ColorGod(instant); + gr_palette[i] = ColorGod(instant); LFBFlush; } From 9b75e8dd0f33da6b3969d65912392e7327876106 Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Wed, 31 May 2023 02:24:43 +0900 Subject: [PATCH 12/18] Hide doc cursor --- src/Home/PaletteEditor/PaletteEdit.ZC | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Home/PaletteEditor/PaletteEdit.ZC b/src/Home/PaletteEditor/PaletteEdit.ZC index 2772e7b2..61462e9a 100755 --- a/src/Home/PaletteEditor/PaletteEdit.ZC +++ b/src/Home/PaletteEditor/PaletteEdit.ZC @@ -364,6 +364,7 @@ public U0 PaletteEditor() "}" ); DocClear; + DocCursor(OFF); WinBorder(ON); CCtrl *c = SliderNew; From c947d9d451fce0e4c374f0e7a892ceb59b2c385c Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Wed, 31 May 2023 02:26:02 +0900 Subject: [PATCH 13/18] Menu fix --- src/Home/PaletteEditor/PaletteEdit.ZC | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Home/PaletteEditor/PaletteEdit.ZC b/src/Home/PaletteEditor/PaletteEdit.ZC index 61462e9a..11877874 100755 --- a/src/Home/PaletteEditor/PaletteEdit.ZC +++ b/src/Home/PaletteEditor/PaletteEdit.ZC @@ -356,8 +356,8 @@ public U0 PaletteEditor() " PreviousColor(,,SC_CURSOR_UP);" " NextColor(,,SC_CURSOR_RIGHT);" " NextColor(,,SC_CURSOR_DOWN);" - " RandomColor(,,'r');" - " RandomPalette(,,'R');" + " RandomColor(,'r');" + " RandomPalette(,'R');" "}" "About {" " Info(,CH_CTRLI);" From 2b9a3b0bbb54d87b37ba86eed63129952eac16cc Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Wed, 31 May 2023 02:51:04 +0900 Subject: [PATCH 14/18] Fix --- src/Home/PaletteEditor/PaletteEdit.ZC | 20 ++++++++++++-------- src/Home/PaletteEditor/PaletteGod.ZC | 6 ++++-- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/Home/PaletteEditor/PaletteEdit.ZC b/src/Home/PaletteEditor/PaletteEdit.ZC index 11877874..6465e7c6 100755 --- a/src/Home/PaletteEditor/PaletteEdit.ZC +++ b/src/Home/PaletteEditor/PaletteEdit.ZC @@ -148,7 +148,7 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) // color label and text preview // TODO: THIS LOGIC DOESNT WORK ON LIGHT THEMES // if color too light or too dark add bg - + if (i == 15) dc->color = LTGRAY; else if (gr_palette[i] < gr_palette[15]) @@ -159,10 +159,6 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) dc->color = LTRED;*/ else dc->color = 15; - - // Border for preview box - GrRect(dc, (size * i)-1, c->win_task->pix_height - (size*1.5)-1, size+2, size+2); - if (i == selected_color) dc->color = 0; @@ -170,19 +166,27 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) GrRect(dc, (size * i), c->win_task->pix_height - (size - size / 2), size, size * 1.5); GrRect(dc, 6, (size2 * 2) + 65 + 16 * i, 80, 18); + if (i == selected_color) dc->color = 15; else dc->color = i; + bias = (size / 2) - 4; if (i >= 9) bias = (size / 2) - 8; + GrPrint(dc, bias + (i * size), c->win_task->pix_height - (size * .6) + (size / 4), "%d", i); GrPrint(dc, 10, (size2 * 2) + 70 + 16 * i, "#%d: Test", i); - + // Border for preview box + GrRect(dc, (size * i)-2, c->win_task->pix_height - (size*1.5)-1, size+2, size+1); // preview box + dc->color = i; GrRect(dc, (size * i), c->win_task->pix_height - (size*1.5), size, size); + + + } @@ -429,11 +433,11 @@ public U0 PaletteEditor() current_palette = PaletteSelect; break; case 'r': - gr_palette[selected_color] = ColorGod(TRUE); + gr_palette[selected_color] = ColorGod; LFBFlush; break; case 'R': - PaletteGod(FALSE, TRUE); + PaletteGod; break; case CH_CTRLI: PopUpOk("\n\n Use the arrows to select color\n\n # to manually input hex value","\n\n\n\t\tMade by y4my4m\n\n"); diff --git a/src/Home/PaletteEditor/PaletteGod.ZC b/src/Home/PaletteEditor/PaletteGod.ZC index 4a2fd688..99e92031 100755 --- a/src/Home/PaletteEditor/PaletteGod.ZC +++ b/src/Home/PaletteEditor/PaletteGod.ZC @@ -7,12 +7,14 @@ CBGR24 ColorGod(Bool instant=TRUE) return GodPick & 0xFFFFFF; } -public U0 PaletteGod(Bool seedUse=TRUE, Bool instant=TRUE) +public U0 PaletteGod(Bool seedUse=FALSE, Bool instant=TRUE) { // Generate a random palette, seed-based or not I64 i; - if (seedUse) + + if (seedUse) { Seed(GodPick); + } for (i=0; i < 16; i++) gr_palette[i] = ColorGod(instant); LFBFlush; From 0afbbd6ce236e7fb4c230a2f7a138b6f7076e791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=81=E3=83=A3=E3=83=BC=E3=83=AB=E3=82=BA?= <8145020+y4my4my4m@users.noreply.github.com> Date: Wed, 31 May 2023 02:59:33 +0900 Subject: [PATCH 15/18] Update PaletteGod.ZC --- src/Home/PaletteEditor/PaletteGod.ZC | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Home/PaletteEditor/PaletteGod.ZC b/src/Home/PaletteEditor/PaletteGod.ZC index 99e92031..c2e02d2c 100755 --- a/src/Home/PaletteEditor/PaletteGod.ZC +++ b/src/Home/PaletteEditor/PaletteGod.ZC @@ -1,6 +1,6 @@ CBGR24 ColorGod(Bool instant=TRUE) { - // Generate a random color, seed-based or not + // Generate a random color if (instant) return RandI32 & 0xFFFFFF; else From 8a60eb60a390e6b6bb31fe7b8e7d8403fced8e38 Mon Sep 17 00:00:00 2001 From: y4my4my4m <8145020+y4my4my4m@users.noreply.github.com> Date: Wed, 7 Jun 2023 14:14:52 +0900 Subject: [PATCH 16/18] update --- src/Home/PaletteEditor/PaletteEdit.ZC | 10 ++-------- src/Home/PaletteEditor/PaletteGod.ZC | 13 ++++--------- src/Home/PaletteEditor/Palettes/Tradition.ZC | 2 +- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/Home/PaletteEditor/PaletteEdit.ZC b/src/Home/PaletteEditor/PaletteEdit.ZC index 6465e7c6..bf0029d5 100755 --- a/src/Home/PaletteEditor/PaletteEdit.ZC +++ b/src/Home/PaletteEditor/PaletteEdit.ZC @@ -38,9 +38,7 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) CSliderState *s = c->state; I64 size = (c->win_task->pix_width / 16), -// border = size / 16, size2 = (c->win_task->pix_height / 32), -// slider_amount = 3, i, pos, col, bias; @@ -62,10 +60,9 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) dc->color = 15; GrRect(dc, 94, 8, 58, 12); - dc->color = selected_color; - // Color preview next to #hex - GrRect(dc, 78, 8, 12, 12); // #Hex value + dc->color = selected_color; + GrRect(dc, 78, 8, 12, 12); GrPrint(dc, 95, 10, "#%x%x%x", gr_palette[selected_color].r, gr_palette[selected_color].g, gr_palette[selected_color].b); @@ -184,9 +181,6 @@ U0 DrawCtrlSlider(CDC *dc, CCtrl *c) // preview box dc->color = i; GrRect(dc, (size * i), c->win_task->pix_height - (size*1.5), size, size); - - - } diff --git a/src/Home/PaletteEditor/PaletteGod.ZC b/src/Home/PaletteEditor/PaletteGod.ZC index c2e02d2c..79eb8745 100755 --- a/src/Home/PaletteEditor/PaletteGod.ZC +++ b/src/Home/PaletteEditor/PaletteGod.ZC @@ -1,6 +1,5 @@ CBGR24 ColorGod(Bool instant=TRUE) -{ - // Generate a random color +{ // Generate a random color, seed-based or not if (instant) return RandI32 & 0xFFFFFF; else @@ -8,16 +7,12 @@ CBGR24 ColorGod(Bool instant=TRUE) } public U0 PaletteGod(Bool seedUse=FALSE, Bool instant=TRUE) -{ - // Generate a random palette, seed-based or not +{ // Generate a random palette, seed-based or not I64 i; - if (seedUse) { - Seed(GodPick); - } + if (seedUse) Seed(GodPick); + for (i=0; i < 16; i++) gr_palette[i] = ColorGod(instant); LFBFlush; } - -// PaletteGod; diff --git a/src/Home/PaletteEditor/Palettes/Tradition.ZC b/src/Home/PaletteEditor/Palettes/Tradition.ZC index e0ef467b..2aa2f68d 100755 --- a/src/Home/PaletteEditor/Palettes/Tradition.ZC +++ b/src/Home/PaletteEditor/Palettes/Tradition.ZC @@ -7,4 +7,4 @@ public U0 PaletteSetTradition(Bool persistent=TRUE) LFBFlush; if (persistent) fp_set_std_palette = &PaletteSetTradition; -} \ No newline at end of file +} \ No newline at end of file From 7a6dda2a1c2ad34835ae1134fb7e962dee7200eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=81=E3=83=A3=E3=83=BC=E3=83=AB=E3=82=BA?= <8145020+y4my4my4m@users.noreply.github.com> Date: Tue, 13 Jun 2023 11:58:38 +0900 Subject: [PATCH 17/18] Update PaletteGod.ZC --- src/Home/PaletteEditor/PaletteGod.ZC | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Home/PaletteEditor/PaletteGod.ZC b/src/Home/PaletteEditor/PaletteGod.ZC index 79eb8745..383ea315 100755 --- a/src/Home/PaletteEditor/PaletteGod.ZC +++ b/src/Home/PaletteEditor/PaletteGod.ZC @@ -1,5 +1,5 @@ CBGR24 ColorGod(Bool instant=TRUE) -{ // Generate a random color, seed-based or not +{// Generate a random color, seed-based or not if (instant) return RandI32 & 0xFFFFFF; else @@ -7,7 +7,7 @@ CBGR24 ColorGod(Bool instant=TRUE) } public U0 PaletteGod(Bool seedUse=FALSE, Bool instant=TRUE) -{ // Generate a random palette, seed-based or not +{// Generate a random palette, seed-based or not I64 i; if (seedUse) Seed(GodPick); From 3f61ca6932b164817a0ab616e6a5db6112a81dab Mon Sep 17 00:00:00 2001 From: mintsuki Date: Sat, 15 Jul 2023 08:12:16 +0200 Subject: [PATCH 18/18] Misc updates for Limine 5.x and Zealbooter --- build/build-iso.sh | 33 ++++++++++++++++----------------- src/Misc/OSInstall.ZC | 10 +++++----- src/System/Boot/LimineMHDIns.ZC | 2 +- zealbooter/GNUmakefile | 30 ++++++++++++++++++------------ zealbooter/lib/print.c | 14 +++++++------- zealbooter/linker.ld | 2 +- zealbooter/zealbooter.c | 2 +- 7 files changed, 49 insertions(+), 44 deletions(-) diff --git a/build/build-iso.sh b/build/build-iso.sh index e97d8874..2c62dc60 100755 --- a/build/build-iso.sh +++ b/build/build-iso.sh @@ -64,7 +64,7 @@ umount_tempdisk echo "Rebuilding kernel headers, kernel, OS, and building Distro ISO ..." $QEMU_BIN_PATH/qemu-system-x86_64 -machine q35,accel=kvm -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -smp 4 -device isa-debug-exit -LIMINE_BINARY_BRANCH="v4.x-branch-binary" +LIMINE_BINARY_BRANCH="v5.x-branch-binary" if [ -d "limine" ] then @@ -74,8 +74,7 @@ then git remote set-head origin $LIMINE_BINARY_BRANCH git switch $LIMINE_BINARY_BRANCH git pull - rm limine-deploy - rm limine-version + rm limine cd .. fi @@ -84,13 +83,13 @@ if [ ! -d "limine" ]; then fi make -C limine -touch limine/Limine-HDD.HH -echo "/*\$WW,1\$" > limine/Limine-HDD.HH -cat limine/LICENSE.md >> limine/Limine-HDD.HH -echo "*/\$WW,0\$" >> limine/Limine-HDD.HH -cat limine/limine-hdd.h >> limine/Limine-HDD.HH -sed -i 's/const uint8_t/U8/g' limine/Limine-HDD.HH -sed -i "s/\[\]/\[$(grep -o "0x" ./limine/limine-hdd.h | wc -l)\]/g" limine/Limine-HDD.HH +touch limine/Limine-BIOS-HDD.HH +echo "/*\$WW,1\$" > limine/Limine-BIOS-HDD.HH +cat limine/LICENSE >> limine/Limine-BIOS-HDD.HH +echo "*/\$WW,0\$" >> limine/Limine-BIOS-HDD.HH +cat limine/limine-bios-hdd.h >> limine/Limine-BIOS-HDD.HH +sed -i 's/const uint8_t/U8/g' limine/Limine-BIOS-HDD.HH +sed -i "s/\[\]/\[$(grep -o "0x" ./limine/limine-bios-hdd.h | wc -l)\]/g" limine/Limine-BIOS-HDD.HH mount_tempdisk echo "Extracting MyDistro ISO from vdisk ..." @@ -101,11 +100,11 @@ sudo cp -rf $TMPMOUNT/* $TMPISODIR sudo rm $TMPISODIR/Boot/OldMBR.BIN 2> /dev/null sudo rm $TMPISODIR/Boot/BootMHD2.BIN 2> /dev/null sudo mkdir -p $TMPISODIR/EFI/BOOT -sudo cp limine/Limine-HDD.HH $TMPISODIR/Boot/Limine-HDD.HH +sudo cp limine/Limine-BIOS-HDD.HH $TMPISODIR/Boot/Limine-BIOS-HDD.HH sudo cp limine/BOOTX64.EFI $TMPISODIR/EFI/BOOT/BOOTX64.EFI -sudo cp limine/limine-cd-efi.bin $TMPISODIR/Boot/Limine-CD-EFI.BIN -sudo cp limine/limine-cd.bin $TMPISODIR/Boot/Limine-CD.BIN -sudo cp limine/limine.sys $TMPISODIR/Boot/Limine.SYS +sudo cp limine/limine-uefi-cd.bin $TMPISODIR/Boot/Limine-UEFI-CD.BIN +sudo cp limine/limine-bios-cd.bin $TMPISODIR/Boot/Limine-BIOS-CD.BIN +sudo cp limine/limine-bios.sys $TMPISODIR/Boot/Limine-BIOS.SYS sudo cp ../zealbooter/zealbooter.elf $TMPISODIR/Boot/ZealBooter.ELF sudo cp ../zealbooter/Limine.CFG $TMPISODIR/Boot/Limine.CFG echo "Copying DVDKernel.ZXE over ISO Boot/Kernel.ZXE ..." @@ -113,13 +112,13 @@ sudo mv $TMPMOUNT/Tmp/DVDKernel.ZXE $TMPISODIR/Boot/Kernel.ZXE sudo rm $TMPISODIR/Tmp/DVDKernel.ZXE 2> /dev/null umount_tempdisk -xorriso -joliet "on" -rockridge "on" -as mkisofs -b Boot/Limine-CD.BIN \ +xorriso -joliet "on" -rockridge "on" -as mkisofs -b Boot/Limine-BIOS-CD.BIN \ -no-emul-boot -boot-load-size 4 -boot-info-table \ - --efi-boot Boot/Limine-CD-EFI.BIN \ + --efi-boot Boot/Limine-UEFI-CD.BIN \ -efi-boot-part --efi-boot-image --protective-msdos-label \ $TMPISODIR -o ZealOS-limine.iso -./limine/limine-deploy ZealOS-limine.iso +./limine/limine bios-install ZealOS-limine.iso if [ "$TESTING" = true ]; then if [ ! -d "ovmf" ]; then diff --git a/src/Misc/OSInstall.ZC b/src/Misc/OSInstall.ZC index ad876287..a51671c4 100755 --- a/src/Misc/OSInstall.ZC +++ b/src/Misc/OSInstall.ZC @@ -1,5 +1,5 @@ -#define LIMINE_HDD_FILE "/Boot/Limine-HDD.HH" +#define LIMINE_HDD_FILE "/Boot/Limine-BIOS-HDD.HH" #define LIMINE_HDD_INSTALLER "/System/Boot/LimineMHDIns.ZC" #include LIMINE_HDD_FILE #include LIMINE_HDD_INSTALLER @@ -127,8 +127,8 @@ U0 OSMerge(U8 dst_drv, U8 src_drv=':') CopyTree("B:/", dst); - ExePrint("Del(\"%C:/Boot/Limine-CD.BIN\");", dst_drv); - ExePrint("Del(\"%C:/Boot/Limine-CD-EFI.BIN\");", dst_drv); + ExePrint("Del(\"%C:/Boot/Limine-BIOS-CD.BIN\");", dst_drv); + ExePrint("Del(\"%C:/Boot/Limine-UEFI-CD.BIN\");", dst_drv); ExePrint("Del(\"%C:/Boot/Limine.CFG\");", dst_drv); ExePrint("Del(\"%C:/boot.catalog\");", dst_drv); @@ -245,8 +245,8 @@ U0 InstallDrive(U8 drv_let) ExePrint("CopyTree(\"::/\",\"%C:/\");", drv_let); - ExePrint("Del(\"%C:/Boot/Limine-CD.BIN\");", drv_let); - ExePrint("Del(\"%C:/Boot/Limine-CD-EFI.BIN\");", drv_let); + ExePrint("Del(\"%C:/Boot/Limine-BIOS-CD.BIN\");", drv_let); + ExePrint("Del(\"%C:/Boot/Limine-UEFI-CD.BIN\");", drv_let); ExePrint("Del(\"%C:/Boot/Limine.CFG\");", drv_let); ExePrint("Del(\"%C:/boot.catalog\");", drv_let); diff --git a/src/System/Boot/LimineMHDIns.ZC b/src/System/Boot/LimineMHDIns.ZC index 714cafe4..c87fbd7e 100755 --- a/src/System/Boot/LimineMHDIns.ZC +++ b/src/System/Boot/LimineMHDIns.ZC @@ -34,7 +34,7 @@ Bool LimineCFGMake(U8 drv_let) bd = drive->bd; drv_let = Drive2Letter(drive); - filename_sys = MStrPrint("%C:/Boot/Limine.SYS", drv_let); + filename_sys = MStrPrint("%C:/Boot/Limine-BIOS.SYS", drv_let); filename_elf = MStrPrint("%C:/Boot/ZealBooter.ELF", drv_let); filename_zxe = MStrPrint("%C:/Boot/Kernel.ZXE", drv_let); if (FileFind(filename_sys) && FileFind(filename_elf) && FileFind(filename_zxe)) diff --git a/zealbooter/GNUmakefile b/zealbooter/GNUmakefile index a0d9a1fd..54eca6ed 100644 --- a/zealbooter/GNUmakefile +++ b/zealbooter/GNUmakefile @@ -18,22 +18,28 @@ endef # It is highly recommended to use a custom built cross toolchain to build a kernel. # We are only using "cc" as a placeholder here. It may work by using # the host system's toolchain, but this is not guaranteed. -$(eval $(call DEFAULT_VAR,CC,cc)) +override DEFAULT_CC := cc +$(eval $(call DEFAULT_VAR,CC,$(DEFAULT_CC))) # Same thing for "ld" (the linker). -$(eval $(call DEFAULT_VAR,LD,ld)) +override DEFAULT_LD := ld +$(eval $(call DEFAULT_VAR,LD,$(DEFAULT_LD))) # User controllable C flags. -$(eval $(call DEFAULT_VAR,CFLAGS,-g -O2 -pipe)) +override DEFAULT_CFLAGS := -g -O2 -pipe +$(eval $(call DEFAULT_VAR,CFLAGS,$(DEFAULT_CFLAGS))) # User controllable C preprocessor flags. We set none by default. -$(eval $(call DEFAULT_VAR,CPPFLAGS,)) +override DEFAULT_CPPFLAGS := +$(eval $(call DEFAULT_VAR,CPPFLAGS,$(DEFAULT_CPPFLAGS))) # User controllable nasm flags. -$(eval $(call DEFAULT_VAR,NASMFLAGS,-F dwarf -g)) +override DEFAULT_NASMFLAGS := -F dwarf -g +$(eval $(call DEFAULT_VAR,NASMFLAGS,$(DEFAULT_NASMFLAGS))) # User controllable linker flags. We set none by default. -$(eval $(call DEFAULT_VAR,LDFLAGS,)) +override DEFAULT_LDFLAGS := +$(eval $(call DEFAULT_VAR,LDFLAGS,$(DEFAULT_LDFLAGS))) # Internal C flags that should not be changed by the user. override CFLAGS += \ @@ -66,9 +72,9 @@ override CPPFLAGS := \ # Internal linker flags that should not be changed by the user. override LDFLAGS += \ + -m elf_x86_64 \ -nostdlib \ -static \ - -m elf_x86_64 \ -z max-page-size=0x1000 \ -T linker.ld @@ -87,8 +93,8 @@ override NASMFLAGS += \ override CFILES := $(shell find -L . -type f -name '*.c') override ASFILES := $(shell find -L . -type f -name '*.S') override NASMFILES := $(shell find -L . -type f -name '*.asm') -override OBJ := $(CFILES:.c=.o) $(ASFILES:.S=.o) $(NASMFILES:.asm=.o) -override HEADER_DEPS := $(CFILES:.c=.d) $(ASFILES:.S=.d) +override OBJ := $(CFILES:.c=.c.o) $(ASFILES:.S=.S.o) $(NASMFILES:.asm=.asm.o) +override HEADER_DEPS := $(CFILES:.c=.c.d) $(ASFILES:.S=.S.d) # Default target. .PHONY: all @@ -105,15 +111,15 @@ $(KERNEL): $(OBJ) -include $(HEADER_DEPS) # Compilation rules for *.c files. -%.o: %.c limine.h +%.c.o: %.c limine.h $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ # Compilation rules for *.S files. -%.o: %.S limine.h +%.S.o: %.S limine.h $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ # Compilation rules for *.asm (nasm) files. -%.o: %.asm +%.asm.o: %.asm nasm $(NASMFLAGS) $< -o $@ # Remove object files and the final executable. diff --git a/zealbooter/lib/print.c b/zealbooter/lib/print.c index 2fbc98d6..d419836f 100644 --- a/zealbooter/lib/print.c +++ b/zealbooter/lib/print.c @@ -4,10 +4,10 @@ #include #include -static volatile struct limine_terminal_request terminal_request = { - .id = LIMINE_TERMINAL_REQUEST, - .revision = 0 -}; +//static volatile struct limine_terminal_request terminal_request = { +// .id = LIMINE_TERMINAL_REQUEST, +// .revision = 0 +//}; #define PRINT_BUFFER_SIZE 8192 @@ -15,14 +15,14 @@ int printf(const char *format, ...) { va_list args; char buffer[PRINT_BUFFER_SIZE]; - struct limine_terminal *terminal; + //struct limine_terminal *terminal; size_t length; va_start(args, format); length = vsnprintf(buffer, PRINT_BUFFER_SIZE, format, args); - terminal = terminal_request.response->terminals[0]; - terminal_request.response->write(terminal, buffer, length); + //terminal = terminal_request.response->terminals[0]; + //terminal_request.response->write(terminal, buffer, length); va_end(args); diff --git a/zealbooter/linker.ld b/zealbooter/linker.ld index 529a4dd1..52f96f0d 100644 --- a/zealbooter/linker.ld +++ b/zealbooter/linker.ld @@ -45,8 +45,8 @@ SECTIONS /* If you need, for example, .init_array and .fini_array, those should be placed */ /* above this. */ .bss : { - *(COMMON) *(.bss .bss.*) + *(COMMON) } :data /* Discard .note.* and .eh_frame since they may cause issues on some hosts. */ diff --git a/zealbooter/zealbooter.c b/zealbooter/zealbooter.c index 195ec3fc..a8a081da 100644 --- a/zealbooter/zealbooter.c +++ b/zealbooter/zealbooter.c @@ -21,7 +21,7 @@ static volatile struct limine_memmap_request memmap_request = { static volatile struct limine_framebuffer_request framebuffer_request = { .id = LIMINE_FRAMEBUFFER_REQUEST, - .revision = 1 + .revision = 0 }; static volatile struct limine_smbios_request smbios_request = {