mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-25 23:10:32 +00:00
Compare commits
5 commits
6b94d38f71
...
9548b1fd85
Author | SHA1 | Date | |
---|---|---|---|
|
9548b1fd85 | ||
|
a95d5559de | ||
|
5bd76304ec | ||
|
9b82ba8278 | ||
|
48ea59e96f |
4 changed files with 107 additions and 30 deletions
BIN
src/Home/FontBook/CurrentFont.TXT
Executable file
BIN
src/Home/FontBook/CurrentFont.TXT
Executable file
Binary file not shown.
75
src/Home/FontBook/FontCycle.ZC
Executable file
75
src/Home/FontBook/FontCycle.ZC
Executable file
|
@ -0,0 +1,75 @@
|
|||
U0 FontCycle(I8 direction)
|
||||
{
|
||||
CDirEntry *tmpde1, *previous = NULL, *selected = NULL;
|
||||
U8 selected_font;
|
||||
|
||||
I64 current_font = FileRead("~/FontBook/CurrentFont.TXT");
|
||||
if (!current_font)
|
||||
{
|
||||
FileWrite("~/FontBook/CurrentFont.TXT", "Zeal", 4);
|
||||
}
|
||||
|
||||
//I64 current_font = "Zeal";
|
||||
//"$$LTBLUE$$current_font:\t%s$$FG$$\n", current_font;
|
||||
|
||||
if (direction == 0)
|
||||
{
|
||||
selected_font = current_font;
|
||||
goto load_current;
|
||||
}
|
||||
|
||||
tmpde1 = FilesFind("~/FontBook/Fonts/*.BIN", 1);
|
||||
if (!tmpde1) return;
|
||||
|
||||
do {
|
||||
FileExtRemove(tmpde1->name);
|
||||
//"found:\t\t\t%s\n", tmpde1->name;
|
||||
// Check if this is the current font
|
||||
if (StrCompare(current_font, tmpde1->name) == 0) {
|
||||
if (direction == 1) {
|
||||
if (tmpde1->next) {
|
||||
selected = tmpde1->next;
|
||||
} else {
|
||||
selected = FilesFind("~/FontBook/Fonts/*.BIN", 1); // Start from the first font if at the end
|
||||
}
|
||||
} else {
|
||||
if (previous) {
|
||||
selected = previous;
|
||||
} else {
|
||||
// Find the last font for the case where direction is -1 and we're at the start
|
||||
CDirEntry *temp = tmpde1;
|
||||
while (temp->next) {
|
||||
temp = temp->next;
|
||||
}
|
||||
selected = temp;
|
||||
}
|
||||
}
|
||||
break; // Exit loop once the current font is found.
|
||||
}
|
||||
|
||||
previous = tmpde1;
|
||||
tmpde1 = tmpde1->next;
|
||||
} while (tmpde1);
|
||||
|
||||
if (selected) {
|
||||
FileExtRemove(selected->name);
|
||||
|
||||
selected_font = selected->name;
|
||||
"\n$$YELLOW$$selected:\t\t%s$$FG$$\n", selected_font;
|
||||
FileWrite("~/FontBook/CurrentFont.TXT", selected_font, StrLen(selected_font)+1);
|
||||
|
||||
load_current:
|
||||
U8 selected_path[0];
|
||||
StrPrint(selected_path, "~/FontBook/Fonts/%s.BIN", selected_font);
|
||||
//"%s\n", selected_path;
|
||||
|
||||
U64 *new_font = FileRead(selected_path);
|
||||
if (new_font) {
|
||||
|
||||
text.font = new_font;
|
||||
Free(new_font);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//FontCycle(1);
|
|
@ -1,43 +1,40 @@
|
|||
# Nuke built-in rules and variables.
|
||||
override MAKEFLAGS += -rR
|
||||
MAKEFLAGS += -rR
|
||||
.SUFFIXES:
|
||||
|
||||
# This is the name that our final executable will have.
|
||||
# Change as needed.
|
||||
override OUTPUT := kernel
|
||||
|
||||
# Convenience macro to reliably declare user overridable variables.
|
||||
define DEFAULT_VAR =
|
||||
ifeq ($(origin $1),default)
|
||||
override $(1) := $(2)
|
||||
endif
|
||||
ifeq ($(origin $1),undefined)
|
||||
override $(1) := $(2)
|
||||
endif
|
||||
endef
|
||||
override USER_VARIABLE = $(if $(filter $(origin $(1)),default undefined),$(eval override $(1) := $(2)))
|
||||
|
||||
# User controllable C compiler command.
|
||||
override DEFAULT_KCC := cc
|
||||
$(eval $(call DEFAULT_VAR,KCC,$(DEFAULT_KCC)))
|
||||
$(call USER_VARIABLE,KCC,cc)
|
||||
|
||||
# User controllable linker command.
|
||||
override DEFAULT_KLD := ld
|
||||
$(eval $(call DEFAULT_VAR,KLD,$(DEFAULT_KLD)))
|
||||
$(call USER_VARIABLE,KLD,ld)
|
||||
|
||||
# User controllable C flags.
|
||||
override DEFAULT_KCFLAGS := -g -O2 -pipe
|
||||
$(eval $(call DEFAULT_VAR,KCFLAGS,$(DEFAULT_KCFLAGS)))
|
||||
$(call USER_VARIABLE,KCFLAGS,-g -O2 -pipe)
|
||||
|
||||
# User controllable C preprocessor flags. We set none by default.
|
||||
override DEFAULT_KCPPFLAGS :=
|
||||
$(eval $(call DEFAULT_VAR,KCPPFLAGS,$(DEFAULT_KCPPFLAGS)))
|
||||
$(call USER_VARIABLE,KCPPFLAGS,)
|
||||
|
||||
# User controllable nasm flags.
|
||||
override DEFAULT_KNASMFLAGS := -F dwarf -g
|
||||
$(eval $(call DEFAULT_VAR,KNASMFLAGS,$(DEFAULT_KNASMFLAGS)))
|
||||
$(call USER_VARIABLE,KNASMFLAGS,-F dwarf -g)
|
||||
|
||||
# User controllable linker flags. We set none by default.
|
||||
override DEFAULT_KLDFLAGS :=
|
||||
$(eval $(call DEFAULT_VAR,KLDFLAGS,$(DEFAULT_KLDFLAGS)))
|
||||
$(call USER_VARIABLE,KLDFLAGS,)
|
||||
|
||||
# Check if KCC is Clang.
|
||||
override KCC_IS_CLANG := $(shell ! $(KCC) --version 2>/dev/null | grep 'clang' >/dev/null 2>&1; echo $$?)
|
||||
|
||||
# If the C compiler is Clang, set the target as needed.
|
||||
ifeq ($(KCC_IS_CLANG),1)
|
||||
override KCC += \
|
||||
-target x86_64-unknown-none
|
||||
endif
|
||||
|
||||
# Internal C flags that should not be changed by the user.
|
||||
override KCFLAGS += \
|
||||
|
|
|
@ -9,6 +9,7 @@ ENTRY(kmain)
|
|||
/* process. */
|
||||
PHDRS
|
||||
{
|
||||
requests PT_LOAD;
|
||||
text PT_LOAD;
|
||||
rodata PT_LOAD;
|
||||
data PT_LOAD;
|
||||
|
@ -22,6 +23,16 @@ SECTIONS
|
|||
/* that is the beginning of the region. */
|
||||
. = 0xffffffff80000000;
|
||||
|
||||
/* Define a section to contain the Limine requests and assign it to its own PHDR */
|
||||
.requests : {
|
||||
KEEP(*(.requests_start_marker))
|
||||
KEEP(*(.requests))
|
||||
KEEP(*(.requests_end_marker))
|
||||
} :requests
|
||||
|
||||
/* Move to the next memory page for .text */
|
||||
. = ALIGN(CONSTANT(MAXPAGESIZE));
|
||||
|
||||
.text : {
|
||||
*(.text .text.*)
|
||||
} :text
|
||||
|
@ -38,12 +49,6 @@ SECTIONS
|
|||
|
||||
.data : {
|
||||
*(.data .data.*)
|
||||
|
||||
/* Place the sections that contain the Limine requests as part of the .data */
|
||||
/* output section. */
|
||||
KEEP(*(.requests_start_marker))
|
||||
KEEP(*(.requests))
|
||||
KEEP(*(.requests_end_marker))
|
||||
} :data
|
||||
|
||||
/* NOTE: .bss needs to be the last thing mapped to :data, otherwise lots of */
|
||||
|
|
Loading…
Reference in a new issue