From a3189adedf3a013245811b1d9106968e7d9954f3 Mon Sep 17 00:00:00 2001 From: Jonathan Campbell Date: Mon, 9 Dec 2024 03:33:44 -0800 Subject: [PATCH] dosbox.conf option to control BIOS logo --- CHANGELOG | 1 + src/dosbox.cpp | 8 +++++++- src/ints/bios.cpp | 16 ++++++++++++---- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 4de5c11c14..5fcf715e6e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -47,6 +47,7 @@ Next files in the same directory as your dosbox.conf or current working directory. Have fun. Note that this addition requires that you compile DOSBox-X with libpng enabled. (joncampbell123). + - Added dosbox.conf option to specify BIOS logo file. (joncampbell123). 2024.12.04 - Arrange memory device allocation so that it is possible to allocate diff --git a/src/dosbox.cpp b/src/dosbox.cpp index f9d6dfd70e..5b73840ee2 100644 --- a/src/dosbox.cpp +++ b/src/dosbox.cpp @@ -1560,10 +1560,16 @@ void DOSBOX_SetupConfigSections(void) { "You can set code page either in the language file or with \"country\" setting in [config] section."); Pstring->SetBasic(true); - Pstring = secprop->Add_path("title",Property::Changeable::Always,""); + Pstring = secprop->Add_string("title",Property::Changeable::Always,""); Pstring->Set_help("Additional text to place in the title bar of the window."); Pstring->SetBasic(true); + Pstring = secprop->Add_string("logo",Property::Changeable::Always,""); + Pstring->Set_help("Location of PNG images to use in place of the DOSBox-X logo at startup.\n" + "This is the path of the base file name. For example logo=subdir\\sets\\007\\logo\n" + "with machine=vgaonly will use subdir\\sets\\007\\logo224x224.png as the logo."); + Pstring->SetBasic(true); + Pbool = secprop->Add_bool("fastbioslogo",Property::Changeable::OnlyAtStart,false); Pbool->Set_help("If set, DOSBox-X will skip the BIOS screen by activating fast BIOS logo mode (without 1-second pause)."); Pbool->SetBasic(true); diff --git a/src/ints/bios.cpp b/src/ints/bios.cpp index 5d0b0c5816..0efb551182 100644 --- a/src/ints/bios.cpp +++ b/src/ints/bios.cpp @@ -10604,6 +10604,7 @@ class BIOS:public Module_base{ CALLBACK_HandlerObject cb_bios_startup_screen; static Bitu cb_bios_startup_screen__func(void) { const Section_prop* section = static_cast(control->GetSection("dosbox")); + const char *logo = section->Get_string("logo"); bool fastbioslogo=section->Get_bool("fastbioslogo")||control->opt_fastbioslogo||control->opt_fastlaunch; if (fastbioslogo && machine != MCH_PC98) { #if defined(USE_TTF) @@ -10713,53 +10714,60 @@ class BIOS:public Module_base{ int png_bit_depth = 0,png_color_type = 0,png_interlace = 0,png_filter = 0,png_compression = 0; png_color *palette = NULL; int palette_count = 0; + std::string user_filename; const char *filename = NULL; const unsigned char *inpng = NULL; size_t inpng_size = 0; FILE *png_fp = NULL; /* If the user wants a custom logo, just put it in the same directory as the .conf file and have at it. - * Requirements: The PNG Must be 1/2/4/8bpp with a color palette, not grayscale, not truecolor, and + * Requirements: The PNG must be 1/2/4/8bpp with a color palette, not grayscale, not truecolor, and * no alpha channel data at all. No interlacing. Must be 224x224 or smaller, and should fit the size * indicated in the filename. There are multiple versions, one for each vertical resolution of common * CGA/EGA/VGA/etc. modes: 480-line, 400-line, 350-line, and 200-line. All images other than the 480-line * one have a non-square pixel aspect ratio. Please take that into consideration. */ - /* TODO: The user should also be able to point at the PNG files using either/both the local dosbox.conf - * or global dosbox.conf! */ if (IS_VGA_ARCH) { + if (logo) user_filename = std::string(logo) + "224x224.png"; filename = "dosbox224x224.png"; inpng_size = dosbox224x224_png_len; inpng = dosbox224x224_png; } else if (IS_PC98_ARCH) { + if (logo) user_filename = std::string(logo) + "224x186.png"; filename = "dosbox224x186.png"; inpng_size = dosbox224x186_png_len; inpng = dosbox224x186_png; } else if (IS_EGA_ARCH) { if (ega200) { + if (logo) user_filename = std::string(logo) + "224x93.png"; filename = "dosbox224x93.png"; inpng_size = dosbox224x93_png_len; inpng = dosbox224x93_png; } else { + if (logo) user_filename = std::string(logo) + "224x163.png"; filename = "dosbox224x163.png"; inpng_size = dosbox224x163_png_len; inpng = dosbox224x163_png; } } else if (machine == MCH_HERC || machine == MCH_MDA) { + if (logo) user_filename = std::string(logo) + "224x163.png"; filename = "dosbox224x163.png"; inpng_size = dosbox224x163_png_len; inpng = dosbox224x163_png; } else { + if (logo) user_filename = std::string(logo) + "224x93.png"; filename = "dosbox224x93.png"; inpng_size = dosbox224x93_png_len; inpng = dosbox224x93_png; } - if (filename != NULL) + if (png_fp == NULL && !user_filename.empty()) + png_fp = fopen(user_filename.c_str(),"rb"); + if (png_fp == NULL && filename != NULL) png_fp = fopen(filename,"rb"); if (png_fp || inpng) {