Skip to content
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

Paginate the CONFIG command's output #3758

Merged
merged 13 commits into from
Jun 15, 2024
5 changes: 2 additions & 3 deletions contrib/resources/translations/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,9 @@ to learn more about it, here are a few links:

For example `CONFIG_FULLSCREEN`.

Do not exceed 79 characters on a line, or commands such as `config -h fullscreen`
Do not exceed 80 characters on a line, or commands such as `config -h fullscreen`
won't be able to display the help properly, and might wrap the text or display blank
lines. The limit might be increased to 80 characters in the future, but
the implementation is not there yet.
lines.

### Command or program help

Expand Down
1 change: 1 addition & 0 deletions include/programs.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <memory>
#include <optional>
#include <string>
#include <vector>

#include "dos_inc.h"
#include "help_util.h"
Expand Down
47 changes: 25 additions & 22 deletions src/dos/program_mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,70 +100,71 @@ static void set_8x8_font()
CALLBACK_RunRealInt(0x10);
}

void MODE::HandleSetDisplayMode(const std::string& _mode)
void MODE::HandleSetDisplayMode(const std::string& _mode_str)
{
auto mode = _mode;
auto mode_str = _mode_str;

// These formats are all valid:
// 80X25
// 80x25
// 80,25
lowcase(mode);
mode = replace(mode, ',', 'x');
lowcase(mode_str);
mode_str = replace(mode_str, ',', 'x');

if (!is_valid_video_mode(mode)) {
WriteOut(MSG_Get("PROGRAM_MODE_INVALID_DISPLAY_MODE"), mode.c_str());
if (!is_valid_video_mode(mode_str)) {
WriteOut(MSG_Get("PROGRAM_MODE_INVALID_DISPLAY_MODE"),
mode_str.c_str());
return;
}

switch (machine) {
case MCH_HERC:
if (mode == "80x25") {
if (mode_str == "80x25") {
INT10_SetVideoMode(0x07);
} else {
WriteOut(MSG_Get("PROGRAM_MODE_UNSUPPORTED_DISPLAY_MODE"),
mode.c_str());
mode_str.c_str());
}
break;

case MCH_CGA:
case MCH_TANDY:
case MCH_PCJR:
if (mode == "40x25") {
if (mode_str == "40x25") {
INT10_SetVideoMode(0x01);

} else if (mode == "80x25") {
} else if (mode_str == "80x25") {
INT10_SetVideoMode(0x03);

} else {
WriteOut(MSG_Get("PROGRAM_MODE_UNSUPPORTED_DISPLAY_MODE"),
mode.c_str());
mode_str.c_str());
}
break;

case MCH_EGA:
if (mode == "40x25") {
if (mode_str == "40x25") {
INT10_SetVideoMode(0x01);

} else if (mode == "80x25") {
} else if (mode_str == "80x25") {
INT10_SetVideoMode(0x03);

} else if (mode == "80x43") {
} else if (mode_str == "80x43") {
INT10_SetVideoMode(0x03);
set_8x8_font();

} else {
WriteOut(MSG_Get("PROGRAM_MODE_UNSUPPORTED_DISPLAY_MODE"),
mode.c_str());
mode_str.c_str());
}
break;

case MCH_VGA:
if (svgaCard == SVGA_S3Trio) {
if (const auto it = video_mode_map_svga_s3.find(mode);
if (const auto it = video_mode_map_svga_s3.find(mode_str);
it != video_mode_map_svga_s3.end()) {

const auto mode = it->second;
const auto& mode = it->second;

if (mode < MinVesaBiosModeNumber) {
INT10_SetVideoMode(mode);
Expand All @@ -172,17 +173,19 @@ void MODE::HandleSetDisplayMode(const std::string& _mode)
}
} else {
WriteOut(MSG_Get("PROGRAM_MODE_UNSUPPORTED_DISPLAY_MODE"),
mode.c_str());
mode_str.c_str());
}

} else {
// SVGA non-S3
if (const auto it = video_mode_map_svga_other.find(mode);
if (const auto it = video_mode_map_svga_other.find(mode_str);
it != video_mode_map_svga_other.end()) {
INT10_SetVideoMode(it->second);

const auto& mode = it->second;
INT10_SetVideoMode(mode);
} else {
WriteOut(MSG_Get("PROGRAM_MODE_UNSUPPORTED_DISPLAY_MODE"),
mode.c_str());
mode_str.c_str());
}
}
break;
Expand Down Expand Up @@ -244,7 +247,7 @@ void MODE::Run()
const auto command = args[0];

if (is_set_display_mode_command(command)) {
const auto mode = command;
const auto& mode = command;
HandleSetDisplayMode(mode);
} else {
WriteOut(MSG_Get("PROGRAM_MODE_INVALID_COMMAND"));
Expand Down
Loading
Loading