Display Copyright

This commit is contained in:
Jaby 2024-03-30 13:09:30 -05:00 committed by Jaby
parent 723875a79c
commit 33096378b4
3 changed files with 27 additions and 11 deletions

View File

@ -46,7 +46,18 @@ namespace BIOSInfo {
} }
}; };
static FontSlider font_sliders[2]; static struct {
using BIOSStringOffset = const char*const (SysCall::BIOSVersion::*);
const BIOSStringOffset bios_str_offset;
const char*const display_str;
FontSlider font_slider;
} BIOSStringInfo[3] = {
{.bios_str_offset = &SysCall::BIOSVersion::kernel_maker, .display_str = "Kernel-Maker"},
{.bios_str_offset = &SysCall::BIOSVersion::gui_version, .display_str = "GUI-Version"},
{.bios_str_offset = &SysCall::BIOSVersion::copyright, .display_str = "Copyright"}
};
static GPU::TILE::Linked border_tiles[2] = { static GPU::TILE::Linked border_tiles[2] = {
Make::TILE(Make::AreaI16(0, 0, TextOffset.x, GPU::Display::Height), GPU::Color24::Black()).linked(), Make::TILE(Make::AreaI16(0, 0, TextOffset.x, GPU::Display::Height), GPU::Color24::Black()).linked(),
Make::TILE(Make::AreaI16(GPU::Display::Width - TextOffset.x, 0, TextOffset.x, GPU::Display::Height), GPU::Color24::Black()).linked() Make::TILE(Make::AreaI16(GPU::Display::Width - TextOffset.x, 0, TextOffset.x, GPU::Display::Height), GPU::Color24::Black()).linked()
@ -56,8 +67,9 @@ namespace BIOSInfo {
const auto result = SysCall::get_bios_version(); const auto result = SysCall::get_bios_version();
Shared::back_menu.reset(); Shared::back_menu.reset();
font_sliders[0] = FontSlider::create_for(FontWriter::BIOSFont::Info, result.kernel_maker); for(auto& bios_str_info : BIOSStringInfo) {
font_sliders[1] = FontSlider::create_for(FontWriter::BIOSFont::Info, result.gui_version); bios_str_info.font_slider = FontSlider::create_for(FontWriter::BIOSFont::Info, result.*(bios_str_info.bios_str_offset));
}
border_tiles[0].concat(border_tiles[1]); border_tiles[0].concat(border_tiles[1]);
return result; return result;
} }
@ -73,17 +85,16 @@ namespace BIOSInfo {
return true; return true;
} }
for(auto& font_slider : font_sliders) {
font_slider.advance();
}
auto cursor = FontWriter::update(TextOffset); auto cursor = FontWriter::update(TextOffset);
FontWriter::bios_font_writer.write(cursor, "BIOS INFORMATION\n----------------\nDate (day/month/year):\n%i/%i/%i\nKernel-Maker:\n", bios_version.date.day, bios_version.date.month, bios_version.date.year); FontWriter::bios_font_writer.write(cursor, "BIOS INFORMATION\n----------------\nDate (day/month/year):\n%i/%i/%i\n", bios_version.date.day, bios_version.date.month, bios_version.date.year);
const auto old_pos_x = cursor.pos.x; const auto old_pos_x = cursor.pos.x;
FontWriter::bios_font_writer.write(move_cursor(cursor, font_sliders[0].count, old_pos_x), "%s\n", bios_version.kernel_maker); for(auto& bios_str_info : BIOSStringInfo) {
FontWriter::bios_font_writer.write(move_cursor(cursor, 0, old_pos_x), "GUI-Version:\n"); bios_str_info.font_slider.advance();
FontWriter::bios_font_writer.write(move_cursor(cursor, font_sliders[1].count, old_pos_x), "%s\n", bios_version.gui_version);
FontWriter::bios_font_writer.write(move_cursor(cursor, 0, old_pos_x), "%s:\n", bios_str_info.display_str);
FontWriter::bios_font_writer.write(move_cursor(cursor, bios_str_info.font_slider.count, old_pos_x), "%s\n", bios_version.*(bios_str_info.bios_str_offset));
}
FontWriter::bios_font_writer.write(move_cursor(cursor, 0, old_pos_x), "----------------\n"); FontWriter::bios_font_writer.write(move_cursor(cursor, 0, old_pos_x), "----------------\n");
return false; return false;

View File

@ -63,6 +63,7 @@ namespace JabyEngine {
} date; } date;
const char* kernel_maker; const char* kernel_maker;
const char* gui_version; const char* gui_version;
const char* copyright;
}; };
BIOSVersion get_bios_version(); BIOSVersion get_bios_version();

View File

@ -1,5 +1,6 @@
#include <PSX/Auxiliary/math_helper.hpp> #include <PSX/Auxiliary/math_helper.hpp>
#include <PSX/System/syscalls.hpp> #include <PSX/System/syscalls.hpp>
#include <string.h>
namespace JabyEngine { namespace JabyEngine {
namespace SysCall { namespace SysCall {
@ -13,6 +14,9 @@ namespace JabyEngine {
version.date.year = from_bcd(static_cast<uint16_t>(date_bcd >> 16)); version.date.year = from_bcd(static_cast<uint16_t>(date_bcd >> 16));
version.kernel_maker = reinterpret_cast<const char*>(0xBFC00108); version.kernel_maker = reinterpret_cast<const char*>(0xBFC00108);
version.gui_version = reinterpret_cast<const char*>(0xBFC7FF32); version.gui_version = reinterpret_cast<const char*>(0xBFC7FF32);
version.copyright = version.gui_version + (strlen(version.gui_version) + 1);
printf(">>> \"%s\"\n", version.copyright);
return version; return version;
} }
} }