Detect type of BIOS
This commit is contained in:
@@ -48,16 +48,16 @@ namespace BIOSInfo {
|
||||
};
|
||||
|
||||
static struct {
|
||||
using BIOSStringOffset = const char*const (SysCall::BIOSVersion::*);
|
||||
using BIOSStringOffset = const char*const (BIOS::Version::*);
|
||||
|
||||
const BIOSStringOffset bios_str_offset;
|
||||
const char*const display_str;
|
||||
FontSlider font_slider;
|
||||
} BIOSStringInfo[] = {
|
||||
{.bios_str_offset = &SysCall::BIOSVersion::kernel_maker, .display_str = "Kernel-Maker"},
|
||||
{.bios_str_offset = &SysCall::BIOSVersion::version_str, .display_str = "Version"},
|
||||
{.bios_str_offset = &SysCall::BIOSVersion::gui_version, .display_str = "GUI-Version"},
|
||||
{.bios_str_offset = &SysCall::BIOSVersion::copyright, .display_str = "Copyright"},
|
||||
{.bios_str_offset = &BIOS::Version::kernel_maker, .display_str = "Kernel-Maker"},
|
||||
{.bios_str_offset = &BIOS::Version::version_str, .display_str = "Version"},
|
||||
{.bios_str_offset = &BIOS::Version::gui_version, .display_str = "GUI-Version"},
|
||||
{.bios_str_offset = &BIOS::Version::copyright, .display_str = "Copyright"},
|
||||
};
|
||||
|
||||
static GPU::TILE::Linked border_tiles[2] = {
|
||||
@@ -65,18 +65,47 @@ namespace BIOSInfo {
|
||||
Make::TILE(Make::AreaI16(GPU::Display::Width - TextOffset.x, 0, TextOffset.x, GPU::Display::Height - 32), GPU::Color24::Black()).linked()
|
||||
};
|
||||
|
||||
static SysCall::BIOSVersion setup() {
|
||||
const auto result = SysCall::get_bios_version();
|
||||
static const char* bios_name = nullptr;
|
||||
static FontSlider bios_name_slider;
|
||||
|
||||
static const char* get_bios_name() {
|
||||
switch(BIOS::type) {
|
||||
case BIOS::Type::Devboard:
|
||||
return "DevBoard";
|
||||
case BIOS::Type::PS1:
|
||||
return "PS1";
|
||||
case BIOS::Type::PS2:
|
||||
return "PS2";
|
||||
case BIOS::Type::PS3:
|
||||
return "PS3";
|
||||
case BIOS::Type::PSCompatible:
|
||||
return "Unkown PS compatible BIOS";
|
||||
case BIOS::Type::No$psx:
|
||||
return "NO$PSX";
|
||||
case BIOS::Type::XEBRA:
|
||||
return "XEBRA";
|
||||
default:
|
||||
return "Unkown";
|
||||
}
|
||||
}
|
||||
|
||||
static BIOS::Version setup() {
|
||||
const auto result = BIOS::get_bios_version();
|
||||
|
||||
if(!bios_name) {
|
||||
bios_name = get_bios_name();
|
||||
}
|
||||
|
||||
Shared::back_menu.reset();
|
||||
for(auto& bios_str_info : BIOSStringInfo) {
|
||||
bios_str_info.font_slider = FontSlider::create_for(FontWriter::BIOSFont::Info, result.*(bios_str_info.bios_str_offset));
|
||||
}
|
||||
bios_name_slider = FontSlider::create_for(FontWriter::BIOSFont::Info, bios_name);
|
||||
border_tiles[0].concat(border_tiles[1]);
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool update_or_exit(const SysCall::BIOSVersion& bios_version) {
|
||||
static bool update_or_exit(const BIOS::Version& bios_version) {
|
||||
static const auto move_cursor = [](JabyEngine::Cursor& cursor, int16_t dx, int16_t old_x) -> JabyEngine::Cursor& {
|
||||
cursor.pos.x = (old_x - dx);
|
||||
return cursor;
|
||||
@@ -97,6 +126,8 @@ namespace BIOSInfo {
|
||||
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), "BIOS Type:\n");
|
||||
FontWriter::bios_font_writer.write(move_cursor(cursor, bios_name_slider.count, old_pos_x), "%s\n", bios_name);
|
||||
FontWriter::bios_font_writer.write(move_cursor(cursor, 0, old_pos_x), "----------------\n");
|
||||
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user