mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-25 23:10:32 +00:00
Compare commits
4 commits
f82f906012
...
ea25e58f1c
Author | SHA1 | Date | |
---|---|---|---|
|
ea25e58f1c | ||
|
a95d5559de | ||
|
5bd76304ec | ||
|
e24f121ad6 |
6 changed files with 1308 additions and 30 deletions
64
src/Demo/Graphics/WallPaperImage.ZC
Normal file
64
src/Demo/Graphics/WallPaperImage.ZC
Normal file
|
@ -0,0 +1,64 @@
|
|||
#include "::/Home/Wallpapers/Images/Lib/uPNG";
|
||||
|
||||
U0 (*old_wall_paper)(CTask *task);
|
||||
RegDefault("Wallpapers/Images/Current", "1;\n");
|
||||
RegExe("Wallpapers/Images/Current");
|
||||
|
||||
CDC *image;
|
||||
|
||||
U0 WallPaperSet(I8 direction) {
|
||||
CDirEntry *tmpde1;
|
||||
// read the current wallpaper index from the registry
|
||||
I64 current = RegExe("Wallpapers/Images/Current");
|
||||
I64 max = 0;
|
||||
|
||||
// SysLog("Reading current wallpaper index from registry: %d\n", current);
|
||||
|
||||
// search the wallpapers directory for .DD files
|
||||
tmpde1 = FilesFind("::/Home/Wallpapers/Images/1024/*.png", 1);
|
||||
if (tmpde1) {
|
||||
do {
|
||||
max++;
|
||||
tmpde1 = tmpde1->next;
|
||||
} while (tmpde1);
|
||||
}
|
||||
|
||||
// move to the next/previous wallpaper
|
||||
current += direction;
|
||||
if (current < 1)
|
||||
current = max; // wrap around to the end
|
||||
if (current > max)
|
||||
current = 1; // wrap around to the start
|
||||
|
||||
// write the new current index back to the registry
|
||||
RegWrite("Wallpapers/Images/Current", "%d;\n", current);
|
||||
|
||||
// SysLog("Current: %d\n", current);
|
||||
// Change the wallpaper
|
||||
Sys("WallPaperImageInit(\"::/Home/Wallpapers/Images/1024/%d.png\");\n", current);
|
||||
}
|
||||
|
||||
U0 WallPaperImage(CTask *task) {
|
||||
CDC *dc = DCAlias(gr.dc2, task);
|
||||
// TODO: dont call PNGRead everyframe, should only be called once;
|
||||
GrBlot(dc, 0, 0, image);
|
||||
DCDel(dc);
|
||||
}
|
||||
|
||||
U0 WallPaperImageInit(I64 filepath="::/Home/Wallpapers/Images/1024/1.png")
|
||||
{
|
||||
if (Fs != sys_task)
|
||||
{
|
||||
"\nMust be System Included. (SHIFT-F5 / RightClick->System Include) \n";
|
||||
return;
|
||||
}
|
||||
old_wall_paper = gr.fp_wall_paper;
|
||||
|
||||
image = PNGRead(filepath);
|
||||
|
||||
// wallpaper_doc->win_task = sys_winmgr_task;
|
||||
|
||||
gr.fp_wall_paper = &WallPaperImage;
|
||||
}
|
||||
|
||||
WallPaperSet(1);
|
BIN
src/Home/Wallpapers/Images/1024/1.png
Normal file
BIN
src/Home/Wallpapers/Images/1024/1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 MiB |
BIN
src/Home/Wallpapers/Images/1024/2.png
Normal file
BIN
src/Home/Wallpapers/Images/1024/2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 MiB |
1212
src/Home/Wallpapers/Images/Lib/uPNG.ZC
Normal file
1212
src/Home/Wallpapers/Images/Lib/uPNG.ZC
Normal file
File diff suppressed because it is too large
Load diff
|
@ -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