Skip to content

Logging & config description improvements #2668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/dos/cdrom_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ CDROM_Interface_Image::CDROM_Interface_Image(uint8_t sub_unit)
player.channel->Enable(false); // only enabled during playback periods
}
#ifdef DEBUG
LOG_MSG("CDROM: Initialized the CDAUDIO audio channel");
LOG_MSG("CDROM: Initialised the CDAUDIO audio channel");
#endif
}
refCount++;
Expand Down
8 changes: 4 additions & 4 deletions src/gui/sdl_mapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ class CStickBindGroup : public CBindGroup {
if (button_wrap > MAXBUTTON)
button_wrap = MAXBUTTON;

LOG_MSG("MAPPER: Initialized %s with %d axes, %d buttons, and %d hat(s)",
LOG_MSG("MAPPER: Initialised %s with %d axes, %d buttons, and %d hat(s)",
SDL_JoystickNameForIndex(stick), axes, buttons, hats);
}

Expand Down Expand Up @@ -2396,7 +2396,7 @@ static void CreateStringBind(char * line) {
goto foundevent;
}
}
LOG_WARNING("MAPPER: Can't find key binding for %s event", eventname);
LOG_WARNING("MAPPER: Can't find key binding for '%s' event", eventname);
return ;
foundevent:
CBind * bind = nullptr;
Expand Down Expand Up @@ -2667,7 +2667,7 @@ static bool load_binds_from_file(const std::string_view mapperfile_path,
for (auto &line : lines)
CreateStringBind(line.data());

LOG_MSG("MAPPER: Loaded %d key bindings from %s",
LOG_MSG("MAPPER: Loaded %d key bindings from '%s'",
static_cast<int>(lines.size()),
mapper_path.string().c_str());

Expand Down Expand Up @@ -2831,7 +2831,7 @@ static void QueryJoysticks()
assert(num_joysticks >= 0);
mapper.sticks.num = static_cast<unsigned int>(num_joysticks);
if (num_joysticks == 0) {
LOG_MSG("MAPPER: no joysticks found");
LOG_MSG("MAPPER: No joysticks found");
return;
}

Expand Down
24 changes: 13 additions & 11 deletions src/gui/sdlmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3289,8 +3289,6 @@ static void setup_window_sizes_from_conf(const char *windowresolution_val,
// Can the window be resized?
sdl.desktop.want_resizable_window = detect_resizable_window();

const auto desktop = get_desktop_resolution();

// The refined scaling mode tell the refiner how it should adjust
// the coarse-resolution.
SCALING_MODE refined_scaling_mode = scaling_mode;
Expand All @@ -3306,9 +3304,11 @@ static void setup_window_sizes_from_conf(const char *windowresolution_val,

sdl.use_exact_window_resolution = pref.find('x') != std::string::npos;
if (sdl.use_exact_window_resolution) {
coarse_size = parse_window_resolution_from_conf(pref);
coarse_size = parse_window_resolution_from_conf(pref);
refined_scaling_mode = drop_nearest();
} else {
const auto desktop = get_desktop_resolution();

coarse_size = window_bounds_from_label(pref, desktop);
if (pref == "desktop") {
refined_scaling_mode = drop_nearest();
Expand All @@ -3330,15 +3330,17 @@ static void setup_window_sizes_from_conf(const char *windowresolution_val,

auto describe_scaling_mode = [scaling_mode]() -> const char * {
switch (scaling_mode) {
case SCALING_MODE::NONE: return "Bilinear";
case SCALING_MODE::NEAREST: return "Nearest-neighbour";
case SCALING_MODE::NONE: return "bilinear";
case SCALING_MODE::NEAREST: return "nearest-neighbour";
}
return "Unknown mode!";
};

// Let the user know the resulting window properties
LOG_MSG("DISPLAY: Initialized %dx%d window-mode using %s scaling on %dp display-%d",
refined_size.x, refined_size.y, describe_scaling_mode(), desktop.h,
LOG_MSG("DISPLAY: Initialised %dx%d windowed mode using %s scaling on display-%d",
refined_size.x,
refined_size.y,
describe_scaling_mode(),
sdl.display_number);
}

Expand Down Expand Up @@ -4788,7 +4790,7 @@ int sdl_main(int argc, char *argv[])
LOG_MSG("%s version %s", CANONICAL_PROJECT_NAME, DOSBOX_GetDetailedVersion());
LOG_MSG("---");

LOG_MSG("LOG: Loguru version %d.%d.%d initialized", LOGURU_VERSION_MAJOR,
LOG_MSG("LOG: Loguru version %d.%d.%d initialised", LOGURU_VERSION_MAJOR,
LOGURU_VERSION_MINOR, LOGURU_VERSION_PATCH);

int rcode = 0; // assume good until proven otherwise
Expand All @@ -4805,7 +4807,7 @@ int sdl_main(int argc, char *argv[])
}
}

OverrideWMClass(); // Before SDL2 video subsystem is initialized
OverrideWMClass(); // Before SDL2 video subsystem is initialised

CROSS_DetermineConfigPaths();

Expand Down Expand Up @@ -4881,10 +4883,10 @@ int sdl_main(int argc, char *argv[])
LOG_WARNING("Failed to init CD-ROM support");

sdl.initialized = true;
// Once initialized, ensure we clean up SDL for all exit conditions
// Once initialised, ensure we clean up SDL for all exit conditions
atexit(QuitSDL);

LOG_MSG("SDL: version %d.%d.%d initialized (%s video and %s audio)",
LOG_MSG("SDL: version %d.%d.%d initialised (%s video and %s audio)",
SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL,
SDL_GetCurrentVideoDriver(), SDL_GetCurrentAudioDriver());

Expand Down
2 changes: 1 addition & 1 deletion src/hardware/covox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void Covox::BindToPort(const io_port_t lpt_port)
const auto read_status = std::bind(&Covox::ReadStatus, this, _1, _2);
const auto write_control = std::bind(&Covox::WriteControl, this, _1, _2, _3);
BindHandlers(lpt_port, write_data, read_status, write_control);
LOG_MSG("LPT_DAC: Initialized Covox Speech Thing on LPT port %03xh", lpt_port);
LOG_MSG("LPT_DAC: Initialised Covox Speech Thing on LPT port %03xh", lpt_port);
}

void Covox::ConfigureFilters(const FilterState state)
Expand Down
2 changes: 1 addition & 1 deletion src/hardware/disney.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void Disney::BindToPort(const io_port_t lpt_port)
const auto read_status = std::bind(&Disney::ReadStatus, this, _1, _2);
const auto write_control = std::bind(&Disney::WriteControl, this, _1, _2, _3);
BindHandlers(lpt_port, write_data, read_status, write_control);
LOG_MSG("LPT_DAC: Initialized Disney Sound Source on LPT port %03xh", lpt_port);
LOG_MSG("LPT_DAC: Initialised Disney Sound Source on LPT port %03xh", lpt_port);
}

void Disney::ConfigureFilters(const FilterState state)
Expand Down
4 changes: 2 additions & 2 deletions src/hardware/dma.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static void perform_dma_io(const DMA_DIRECTION direction, const PhysPt spage,
// The data pointer will be incremented per transfer
auto data_pt = reinterpret_cast<uint8_t*>(data_start);

// Convert from DMA 'words' to actual bytes, no greater than 64 KiB
// Convert from DMA 'words' to actual bytes, no greater than 64 KB
auto remaining_bytes = check_cast<uint16_t>(num_words << is_dma16);
do {
// Find the right EMS page that contains the current address
Expand Down Expand Up @@ -586,7 +586,7 @@ DmaController::DmaController(const uint8_t controller_index)
io_read_handlers[0x11].Install(0x8f, DMA_Read_Port, io_width_t::byte, 1);
}

LOG_MSG("DMA: Initialized %s controller",
LOG_MSG("DMA: Initialised %s controller",
(index == 0 ? "primary" : "secondary"));
}

Expand Down
19 changes: 15 additions & 4 deletions src/hardware/gus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const auto ultrasnd_env_name = "ULTRASND";
const auto ultradir_env_name = "ULTRADIR";

// Buffer and memory constants
constexpr uint32_t RAM_SIZE = 1024 * 1024; // 1 MiB
constexpr uint32_t RAM_SIZE = 1024 * 1024; // 1 MB

// DMA transfer size and rate constants
constexpr uint32_t BYTES_PER_DMA_XFER = 8 * 1024; // 8 KB per transfer
Expand Down Expand Up @@ -941,9 +941,15 @@ void Gus::SetupEnvironment(uint16_t port, const char* ultradir_env_val)
// ULTRASND variable
char ultrasnd_env_val[] = "HHH,D,D,II,II";
safe_sprintf(ultrasnd_env_val, "%x,%u,%u,%u,%u", port, dma1, dma2, irq1, irq2);
LOG_MSG("GUS: Setting '%s' environment variable to '%s'",
ultrasnd_env_name,
ultrasnd_env_val);
AUTOEXEC_SetVariable(ultrasnd_env_name, ultrasnd_env_val);

// ULTRADIR variable
LOG_MSG("GUS: Setting '%s' environment variable to '%s'",
ultradir_env_name,
ultradir_env_val);
AUTOEXEC_SetVariable(ultradir_env_name, ultradir_env_val);
}

Expand Down Expand Up @@ -1634,7 +1640,12 @@ void init_gus_dosbox_settings(Section_prop &secprop)

auto *bool_prop = secprop.Add_bool("gus", when_idle, false);
assert(bool_prop);
bool_prop->Set_help("Enable Gravis UltraSound emulation (disabled by default).");
bool_prop->Set_help(
"Enable Gravis UltraSound emulation (disabled by default).\n"
"The default settings of base address 240, IRQ 5, and DMA 3 have been chosen\n"
"so the GUS can coexist with a Sound Blaster card. This works fine for the\n"
"majority of programs, but some games and demos expect the GUS factory\n"
"defaults of base address 220, IRQ 11, DMA 1.");

auto *hex_prop = secprop.Add_hex("gusbase", when_idle, 0x240);
assert(hex_prop);
Expand All @@ -1660,8 +1671,8 @@ void init_gus_dosbox_settings(Section_prop &secprop)
assert(str_prop);
str_prop->Set_help(
"Path to UltraSound directory ('C:\\ULTRASND' by default).\n"
"In this directory there should be a MIDI directory that contains the patch\n"
"files for GUS playback. Patch sets used with Timidity should work fine.");
"In this directory there should be a 'MIDI' directory that contains the patch\n"
"files for GUS playback.");

str_prop = secprop.Add_string("gus_filter", when_idle, "off");
assert(str_prop);
Expand Down
2 changes: 1 addition & 1 deletion src/hardware/mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2685,7 +2685,7 @@ void MIXER_Init(Section *sec)
mixer.tick_add = calc_tickadd(mixer.sample_rate);
set_mixer_state(MixerState::On);

LOG_MSG("MIXER: Negotiated %u-channel %u-Hz audio in %u-frame blocks",
LOG_MSG("MIXER: Negotiated %u-channel %u Hz audio in %u-frame blocks",
obtained.channels,
mixer.sample_rate.load(),
mixer.blocksize);
Expand Down
2 changes: 1 addition & 1 deletion src/hardware/mpu401.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ class MPU401 final : public Module_base {
MPU401_Reset();
}

LOG_MSG("MPU-401: Running in %s-mode on ports %xh and %xh",
LOG_MSG("MPU-401: Running in %s mode on ports %xh and %xh",
mpu.is_intelligent ? "intelligent" : "UART",
port_0x330,
port_0x331);
Expand Down
2 changes: 1 addition & 1 deletion src/hardware/ne2000.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1479,7 +1479,7 @@ class NE2K final : public Module_base {
base=0x300;
}

LOG_MSG("NE2000: Base=0x%x irq=%u", base, irq);
LOG_MSG("NE2000: Initialised on port %xh and IRQ %u", base, irq);

// mac address
const char* macstring=section->Get_string("macaddr");
Expand Down
2 changes: 1 addition & 1 deletion src/hardware/pcspeaker_discrete.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ PcSpeakerDiscrete::PcSpeakerDiscrete()

channel->SetPeakAmplitude(static_cast<uint32_t>(amp_positive));

LOG_MSG("%s: Initialized %s model", device_name, model_name);
LOG_MSG("%s: Initialised %s model", device_name, model_name);
}

PcSpeakerDiscrete::~PcSpeakerDiscrete()
Expand Down
2 changes: 1 addition & 1 deletion src/hardware/pcspeaker_impulse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ PcSpeakerImpulse::PcSpeakerImpulse()
ChannelFeature::Synthesizer});
assert(channel);

LOG_MSG("%s: Initialized %s model", device_name, model_name);
LOG_MSG("%s: Initialised %s model", device_name, model_name);

channel->SetPeakAmplitude(static_cast<uint32_t>(positive_amplitude));
}
Expand Down
2 changes: 1 addition & 1 deletion src/hardware/ps1audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ void PS1AUDIO_Init(Section *section)
ps1_synth = std::make_unique<Ps1Synth>(
prop->Get_string("ps1audio_filter"));

LOG_MSG("PS1: Initialized IBM PS/1 Audio card");
LOG_MSG("PS1: Initialised IBM PS/1 Audio card");

constexpr auto changeable_at_runtime = true;
section->AddDestroyFunction(&PS1AUDIO_ShutDown, changeable_at_runtime);
Expand Down
4 changes: 2 additions & 2 deletions src/hardware/reelmagic/driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1448,9 +1448,9 @@ void ReelMagic_Init(Section* sec)
const bool driver_initialized = _installedInterruptNumber != 0;

if (card_initialized && driver_initialized)
LOG_MSG("REELMAGIC: Initialized ReelMagic MPEG playback card and driver");
LOG_MSG("REELMAGIC: Initialised ReelMagic MPEG playback card and driver");
else if (card_initialized)
LOG_MSG("REELMAGIC: Initialized ReelMagic MPEG playback card");
LOG_MSG("REELMAGIC: Initialised ReelMagic MPEG playback card");
else {
// Should be impossible to initialize the driver without the card
assert(driver_initialized == false);
Expand Down
2 changes: 1 addition & 1 deletion src/hardware/sblaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2145,7 +2145,7 @@ class SBLASTER final {
}

// Update AUTOEXEC.BAT line
LOG_MSG("%s: %s=%s", CardType(), blaster_env_name, blaster_env_val);
LOG_MSG("%s: Setting '%s' environment variable to '%s'", CardType(), blaster_env_name, blaster_env_val);
AUTOEXEC_SetVariable(blaster_env_name, blaster_env_val);
}

Expand Down
4 changes: 2 additions & 2 deletions src/hardware/serialport/misc_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class enet_manager_t {
ENET_VERSION_MAJOR, ENET_VERSION_MINOR, ENET_VERSION_PATCH);
is_initialized = enet_initialize() == 0;
if (is_initialized)
LOG_INFO("ENET: Initialized successfully");
LOG_INFO("ENET: Initialised successfully");
else
LOG_WARNING("ENET: failed to initialize ENet\n");
}
Expand Down Expand Up @@ -503,7 +503,7 @@ class sdl_net_manager_t {

is_initialized = SDLNet_Init() != -1;
if (is_initialized)
LOG_INFO("SDLNET: Initialized SDL network subsystem");
LOG_INFO("SDLNET: Initialised SDL network subsystem");
else
LOG_WARNING("SDLNET: failed to initialize SDL network subsystem: %s\n",
SDLNet_GetError());
Expand Down
2 changes: 1 addition & 1 deletion src/hardware/ston1_dac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void StereoOn1::BindToPort(const io_port_t lpt_port)
const auto read_status = std::bind(&StereoOn1::ReadStatus, this, _1, _2);
const auto write_control = std::bind(&StereoOn1::WriteControl, this, _1, _2, _3);
BindHandlers(lpt_port, write_data, read_status, write_control);
LOG_MSG("LPT_DAC: Initialized Stereo-On-1 DAC on LPT port %03xh", lpt_port);
LOG_MSG("LPT_DAC: Initialised Stereo-On-1 DAC on LPT port %03xh", lpt_port);
}

void StereoOn1::ConfigureFilters(const FilterState state)
Expand Down
2 changes: 1 addition & 1 deletion src/hardware/tandy_sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ TandyPSG::TandyPSG(const ConfigProfile config_profile, const bool is_dac_enabled
base_device->device_start();
device->convert_samplerate(render_rate_hz);

LOG_MSG("TANDY: Initialized audio card with a TI %s PSG %s",
LOG_MSG("TANDY: Initialised audio card with a TI %s PSG %s",
base_device->shortName,
is_dac_enabled ? "and 8-bit DAC" : "but without DAC");
}
Expand Down
4 changes: 2 additions & 2 deletions src/hardware/vga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ void VGA_LogInitialization(const char *adapter_name,
const size_t num_modes)
{
const auto mem_in_kib = vga.vmemsize / 1024;
LOG_INFO("VIDEO: Initialized %s with %d-%s of %s supporting %d modes",
LOG_INFO("VIDEO: Initialised %s with %d %s of %s supporting %d modes",
adapter_name, mem_in_kib < 1024 ? mem_in_kib : mem_in_kib / 1024,
mem_in_kib < 1024 ? "KiB" : "MiB", ram_type,
mem_in_kib < 1024 ? "KB" : "MB", ram_type,
check_cast<int16_t>(num_modes));
}

Expand Down
2 changes: 1 addition & 1 deletion src/midi/midi_mt32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ bool MidiHandler_mt32::Open([[maybe_unused]] const char *conf)
mt32_service->getROMInfo(&rom_info);

assert(loaded_model_and_dir.has_value());
LOG_MSG("MT32: Initialized %s from %s",
LOG_MSG("MT32: Initialised %s from %s",
rom_info.control_rom_description,
loaded_model_and_dir->second.string().c_str());

Expand Down
2 changes: 1 addition & 1 deletion src/misc/setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,7 @@ bool Config::ParseConfigFile(const std::string& type,
// So internal changes don't use the path information
current_config_dir.clear();

LOG_INFO("CONFIG: Loaded '%s' config file '%s'",
LOG_INFO("CONFIG: Loaded %s config file '%s'",
type.c_str(),
config_file_name.c_str());

Expand Down
2 changes: 1 addition & 1 deletion src/misc/support.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ static int64_t stdio_size_with_divisor(FILE* f, const int divisor)
return -1;
}

// File size in KiB, returns -1 on error
// File size in KB, returns -1 on error
// The file position will be restored
int64_t stdio_size_kb(FILE* f)
{
Expand Down
4 changes: 2 additions & 2 deletions src/shell/shell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ void DOS_Shell::ParseLine(char *line)
if (out_file.length() && pipe_file.length())
WriteOut(MSG_Get("SHELL_CMD_DUPLICATE_REDIRECTION"),
out_file.c_str());
LOG_MSG("SHELL: Redirect output to %s",
LOG_MSG("SHELL: Redirecting output to %s",
pipe_file.length() ? pipe_tempfile : out_file.c_str());
close_stdout(normalstdout);
open_console_device(!normalstdin && !in_file.length());
Expand Down Expand Up @@ -559,7 +559,7 @@ std::tuple<std::string, std::string, std::string> parse_drive_conf(
// If we couldn't parse it, return the defaults
auto conf = specify_drive_config();
assert(conf);
if (!conf->ParseConfigFile("drive", conf_path.string()))
if (!conf->ParseConfigFile("auto-mounted drive", conf_path.string()))
return {drive_letter, default_args, default_path};

const auto settings = static_cast<Section_prop *>(conf->GetSection("drive"));
Expand Down