Skip to content

Commit

Permalink
dosbox.conf option to control BIOS logo
Browse files Browse the repository at this point in the history
  • Loading branch information
joncampbell123 committed Dec 9, 2024
1 parent 415ba70 commit a3189ad
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion src/dosbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
16 changes: 12 additions & 4 deletions src/ints/bios.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Section_prop *>(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)
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit a3189ad

Please sign in to comment.