Skip to content

Commit

Permalink
Merge pull request #10 from portasynthinca3/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
portasynthinca3 authored Mar 8, 2020
2 parents f5e1021 + 1853d6e commit 6673bb5
Show file tree
Hide file tree
Showing 20 changed files with 7,693 additions and 3,678 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This project is **not** intended to do some crazy stuff like replacing the giant
In theory, it should work on any modern system. Here they are:
* CPU: x86-64 architecture
* System: UEFI class 2 or 3
* RAM: 64 MB
* RAM: 256 MB (this is temporary for version 5.0.1, will be reduced back to 64MB in a next release)
## Screenshots
They are in the `screens` directory
## Building
Expand Down
2 changes: 1 addition & 1 deletion builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def execute(cmd):
path_obj = 'build/' + os.path.basename(path) + '.o'
c_obj.append(path_obj)
print(' Compiling: ' + path)
execute('x86_64-w64-mingw32-gcc -ffreestanding -mcmodel=large -mno-red-zone -m64 -mno-sse -Os -fstack-protector -Ignu-efi/inc -Ignu-efi/lib -Ignu-efi/inc/x86_64 -Ignu-efi/inc/protocol -nostdlib -c -o ' + path_obj + ' ' + path)
execute('x86_64-w64-mingw32-gcc -ffreestanding -mcmodel=large -mno-red-zone -m64 -msse2 -mstackrealign -Os -fstack-protector -Ignu-efi/inc -Ignu-efi/lib -Ignu-efi/inc/x86_64 -Ignu-efi/inc/protocol -nostdlib -c -o ' + path_obj + ' ' + path)

print_status('Linking')
execute('x86_64-w64-mingw32-gcc -mcmodel=large -mno-red-zone -m64 -nostdlib -Wl,-dll -shared -Wl,--subsystem,10 -e efi_main -o build/BOOTX64.EFI ' + ' '.join(c_obj))
Expand Down
Binary file modified gfx/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screens/boot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screens/desktop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/gui/gui.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void gui_init(void){
color_scheme.win_bg = COLOR32(240, 10, 10, 10);
color_scheme.win_title = COLOR32(255, 255, 255, 255);
color_scheme.win_title_inactive = COLOR32(255, 255, 255, 255);
color_scheme.win_border = COLOR32(240, 236, 78, 32);
color_scheme.win_border = COLOR32(240, 255, 82, 107);
color_scheme.win_border_inactive = COLOR32(140, 15, 15, 15);
color_scheme.win_exit_btn = COLOR32(255, 255, 0, 0);
color_scheme.win_state_btn = COLOR32(255, 255, 255, 255);
Expand Down
78 changes: 77 additions & 1 deletion src/gui/stdgui.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "./stdgui.h"
#include "../stdlib.h"
#include "../cpuid.h"
#include "../drivers/gfx.h"
#include "./gui.h"
#include "./windows.h"
Expand All @@ -11,6 +12,7 @@

#include "../images/neutron_logo.h"
#include "../images/task_mgr.h"
#include "../images/cpu_logos.h"

//These are defined in the Kernel
void krnl_shutdown(void);
Expand Down Expand Up @@ -93,6 +95,10 @@ void _stdgui_task_mgr_btn_click(ui_event_args_t* args){
}
}

void _stdgui_cpuid_btn_click(ui_event_args_t* args){
stdgui_create_cpuid();
}

/*
* Creates a system control window
*/
Expand Down Expand Up @@ -132,9 +138,12 @@ void stdgui_create_system_win(void){
//Add the system color change button to it
gui_create_button(window, (p2d_t){.x = 2, .y = 13 + neutron_logo_height + 45}, (p2d_t){.x = system_win_size.x - 2 - 4, .y = 15}, "Change system color",
COLOR32(255, 255, 255, 255), COLOR32(0, 0, 0, 0), COLOR32(0, 0, 0, 0), COLOR32(0, 0, 0, 0), krnl_open_sys_color_picker);
//Add the system task manager button to it
//Add the task manager button to it
gui_create_button(window, (p2d_t){.x = 2, .y = 13 + neutron_logo_height + 62}, (p2d_t){.x = system_win_size.x - 2 - 4, .y = 15}, "Task manager",
COLOR32(255, 255, 255, 255), COLOR32(0, 0, 0, 0), COLOR32(0, 0, 0, 0), COLOR32(0, 0, 0, 0), _stdgui_task_mgr_btn_click);
//Add the task CPUID button to it
gui_create_button(window, (p2d_t){.x = 2, .y = 13 + neutron_logo_height + 79}, (p2d_t){.x = system_win_size.x - 2 - 4, .y = 15}, "CPUID",
COLOR32(255, 255, 255, 255), COLOR32(0, 0, 0, 0), COLOR32(0, 0, 0, 0), COLOR32(0, 0, 0, 0), _stdgui_cpuid_btn_click);
}

/*
Expand Down Expand Up @@ -230,6 +239,73 @@ void stdgui_create_color_picker(void (*callback)(ui_event_args_t*), color32_t st
COLOR32(255, 255, 255, 255), COLOR32(0, 0, 0, 0), COLOR32(0, 0, 0, 0), COLOR32(0, 0, 0, 0), callback)->extended;
}

/*
* Creates a window with information about the CPU
*/
void stdgui_create_cpuid(void){
p2d_t win_size = (p2d_t){.x = 400, 250};
//Create the window
window_t* window = gui_create_window("CPUID", cpuid_icon, GUI_WIN_FLAGS_STANDARD,
(p2d_t){.x = (gfx_res_x() - win_size.x) / 2,
.y = (gfx_res_y() - win_size.y) / 2}, win_size, NULL);
//Read CPU info
char vendor[16];
char brand[80];
cpuid_get_vendor(vendor, NULL);
cpuid_get_brand(brand);
//Determine the vendor logo
void* logo = NULL;
if(strcmp(vendor, CPUID_VENDOR_INTEL) == 0)
logo = intel_logo;
if(strcmp(vendor, CPUID_VENDOR_AMD) == 0)
logo = amd_logo;
if(strcmp(vendor, CPUID_VENDOR_VMWARE) == 0)
logo = vmware_logo;
//Create the logo image
gui_create_image(window, (p2d_t){.x = win_size.x - 80, .y = 1}, (p2d_t){.x = 64, .y = 64}, GUI_IMAGE_FORMAT_RAW, logo,
COLOR32(0, 0, 0, 0), COLOR32(0, 0, 0, 0), NULL);
//Create the vendor and brand strings
p2d_t vendor_sz = gfx_text_bounds(vendor);
gui_create_label(window, (p2d_t){1, 1}, vendor_sz, vendor, COLOR32(255, 255, 255, 255), COLOR32(0, 0, 0, 0), NULL);
p2d_t brand_sz = gfx_text_bounds(brand);
gui_create_label(window, (p2d_t){1, 10}, brand_sz, brand, COLOR32(255, 255, 255, 255), COLOR32(0, 0, 0, 0), NULL);

//Create feature string
char cpu_feat[1024] = "CPU instructions: ";
uint32_t feat_edx, feat_ecx;
cpuid_get_feat(&feat_edx, &feat_ecx);
if(feat_edx & CPUID_FEAT_EDX_MMX)
strcat(cpu_feat, "MMX ");
if(feat_edx & CPUID_FEAT_EDX_SSE)
strcat(cpu_feat, "SSE ");
if(feat_edx & CPUID_FEAT_EDX_SSE2)
strcat(cpu_feat, "SSE2 ");
if(feat_ecx & CPUID_FEAT_ECX_SSE3)
strcat(cpu_feat, "SSE3 ");
if(feat_ecx & CPUID_FEAT_ECX_SSSE3)
strcat(cpu_feat, "SSSE3 ");
if(feat_ecx & CPUID_FEAT_ECX_SSE4_1)
strcat(cpu_feat, "SSE4.1 ");
if(feat_ecx & CPUID_FEAT_ECX_SSE4_2)
strcat(cpu_feat, "SSE4.2 ");
if(feat_ecx & CPUID_FEAT_ECX_AVX)
strcat(cpu_feat, "AVX ");
strcat(cpu_feat, "\nCPU features: ");
if(feat_edx & CPUID_FEAT_EDX_FPU)
strcat(cpu_feat, "FPU ");
if(feat_edx & CPUID_FEAT_EDX_SYSCALL)
strcat(cpu_feat, "SYSCALL ");
if(feat_edx & CPUID_FEAT_EDX_MTRR)
strcat(cpu_feat, "MTRR ");
if(feat_edx & CPUID_FEAT_EDX_PAT)
strcat(cpu_feat, "PAT ");
if(feat_ecx & CPUID_FEAT_ECX_XSAVE)
strcat(cpu_feat, "XSAVE ");

p2d_t feat_sz = gfx_text_bounds(cpu_feat);
gui_create_label(window, (p2d_t){1, 19}, feat_sz, cpu_feat, COLOR32(255, 255, 255, 255), COLOR32(0, 0, 0, 0), NULL);
}

/*
* Returns the color that was selected by a color picker
*/
Expand Down
1 change: 1 addition & 0 deletions src/gui/stdgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ void stdgui_create_shutdown_prompt(void);
void stdgui_create_system_win(void);
void stdgui_create_task_manager(void);
void stdgui_create_color_picker(void (*callback)(ui_event_args_t*), color32_t start);
void stdgui_create_cpuid(void);
color32_t stdgui_cpick_get_color(void);

#endif
Loading

0 comments on commit 6673bb5

Please sign in to comment.