Add resolution adjustment, framerate limit, etc

- isle-config has been reworked to be a smaller, more organised window
- resolution adjustment has now been added to isle-config, so that the resolution on windowed game start can be set
- max framerate setting added to isle-config
- higher-quality options disabled in isle-config if computer has too little RAM (unlikely)
This commit is contained in:
VoxelTek 2025-07-15 10:53:16 +10:00
parent 19edb0340e
commit e65bd269d4
7 changed files with 919 additions and 626 deletions

View File

@ -80,7 +80,44 @@ CMainDialog::CMainDialog(QWidget* pParent) : QDialog(pParent)
connect(m_ui->maxActorsSlider, &QSlider::valueChanged, this, &CMainDialog::MaxActorsChanged); connect(m_ui->maxActorsSlider, &QSlider::valueChanged, this, &CMainDialog::MaxActorsChanged);
connect(m_ui->maxActorsSlider, &QSlider::sliderMoved, this, &CMainDialog::MaxActorsChanged); connect(m_ui->maxActorsSlider, &QSlider::sliderMoved, this, &CMainDialog::MaxActorsChanged);
connect(m_ui->aspectRatioComboBox, &QComboBox::currentIndexChanged, this, &CMainDialog::AspectRatioChanged);
connect(m_ui->xResSpinBox, &QSpinBox::valueChanged, this, &CMainDialog::XResChanged);
connect(m_ui->yResSpinBox, &QSpinBox::valueChanged, this, &CMainDialog::YResChanged);
connect(m_ui->framerateSpinBox, &QSpinBox::valueChanged, this, &CMainDialog::FramerateChanged);
layout()->setSizeConstraint(QLayout::SetFixedSize); layout()->setSizeConstraint(QLayout::SetFixedSize);
if (currentConfigApp->m_ram_quality_limit != 0) {
m_modified = true;
const QString ramError = QString("Insufficient RAM!");
m_ui->sound3DCheckBox->setChecked(false);
m_ui->sound3DCheckBox->setEnabled(false);
m_ui->sound3DCheckBox->setToolTip(ramError);
m_ui->modelQualityHighRadioButton->setEnabled(false);
m_ui->modelQualityHighRadioButton->setToolTip(ramError);
m_ui->modelQualityLowRadioButton->setEnabled(true);
if (currentConfigApp->m_ram_quality_limit == 2) {
m_ui->modelQualityLowRadioButton->setChecked(true);
m_ui->modelQualityMediumRadioButton->setEnabled(false);
m_ui->modelQualityMediumRadioButton->setToolTip(ramError);
m_ui->maxLoDSlider->setMaximum(30);
m_ui->maxActorsSlider->setMaximum(15);
}
else {
m_ui->modelQualityMediumRadioButton->setChecked(true);
m_ui->modelQualityMediumRadioButton->setEnabled(true);
m_ui->maxLoDSlider->setMaximum(40);
m_ui->maxActorsSlider->setMaximum(30);
}
}
else {
m_ui->sound3DCheckBox->setEnabled(true);
m_ui->modelQualityLowRadioButton->setEnabled(true);
m_ui->modelQualityMediumRadioButton->setEnabled(true);
m_ui->modelQualityHighRadioButton->setEnabled(true);
m_ui->maxLoDSlider->setMaximum(50);
m_ui->maxActorsSlider->setMaximum(40);
}
} }
CMainDialog::~CMainDialog() CMainDialog::~CMainDialog()
@ -125,6 +162,7 @@ bool CMainDialog::OnInitDialog()
m_ui->LoDNum->setNum((int) currentConfigApp->m_max_lod * 10); m_ui->LoDNum->setNum((int) currentConfigApp->m_max_lod * 10);
m_ui->maxActorsSlider->setValue(currentConfigApp->m_max_actors); m_ui->maxActorsSlider->setValue(currentConfigApp->m_max_actors);
m_ui->maxActorsNum->setNum(currentConfigApp->m_max_actors); m_ui->maxActorsNum->setNum(currentConfigApp->m_max_actors);
UpdateInterface(); UpdateInterface();
return true; return true;
} }
@ -231,6 +269,11 @@ void CMainDialog::UpdateInterface()
m_ui->texturePath->setEnabled(currentConfigApp->m_texture_load); m_ui->texturePath->setEnabled(currentConfigApp->m_texture_load);
m_ui->texturePathOpen->setEnabled(currentConfigApp->m_texture_load); m_ui->texturePathOpen->setEnabled(currentConfigApp->m_texture_load);
m_ui->aspectRatioComboBox->setCurrentIndex(currentConfigApp->m_aspect_ratio);
m_ui->xResSpinBox->setValue(currentConfigApp->m_x_res);
m_ui->yResSpinBox->setValue(currentConfigApp->m_y_res);
m_ui->framerateSpinBox->setValue(static_cast<int>(std::round(1000.0f / currentConfigApp->m_frame_delta)));
} }
// FUNCTION: CONFIG 0x004045e0 // FUNCTION: CONFIG 0x004045e0
@ -444,3 +487,54 @@ void CMainDialog::TexturePathEdited()
} }
UpdateInterface(); UpdateInterface();
} }
void CMainDialog::AspectRatioChanged(int index) {
currentConfigApp->m_aspect_ratio = index;
EnsureAspectRatio();
m_modified = true;
UpdateInterface();
}
void CMainDialog::XResChanged(int i) {
currentConfigApp->m_x_res = i;
m_modified = true;
UpdateInterface();
}
void CMainDialog::YResChanged(int i) {
currentConfigApp->m_y_res = i;
EnsureAspectRatio();
m_modified = true;
UpdateInterface();
}
void CMainDialog::EnsureAspectRatio() {
if (currentConfigApp->m_aspect_ratio != 3) {
m_ui->xResSpinBox->setReadOnly(true);
switch (currentConfigApp->m_aspect_ratio) {
case 0: {
float standardAspect = 4.0f / 3.0f;
currentConfigApp->m_x_res = static_cast<int>(std::round((currentConfigApp->m_y_res) * standardAspect));
break;
}
case 1: {
float wideAspect = 16.0f / 9.0f;
currentConfigApp->m_x_res = static_cast<int>(std::round((currentConfigApp->m_y_res) * wideAspect));
break;
}
case 2: {
currentConfigApp->m_x_res = currentConfigApp->m_y_res;
break;
}
}
}
else {
m_ui->xResSpinBox->setReadOnly(false);
}
}
void CMainDialog::FramerateChanged(int i) {
currentConfigApp->m_frame_delta = (1000.0f / static_cast<float>(i));
m_modified = true;
UpdateInterface();
}

View File

@ -57,6 +57,11 @@ private slots:
void MaxActorsChanged(int value); void MaxActorsChanged(int value);
void SelectTexturePathDialog(); void SelectTexturePathDialog();
void TexturePathEdited(); void TexturePathEdited();
void XResChanged(int i);
void YResChanged(int i);
void AspectRatioChanged(int index);
void EnsureAspectRatio();
void FramerateChanged(int i);
}; };
// SYNTHETIC: CONFIG 0x00403de0 // SYNTHETIC: CONFIG 0x00403de0

View File

@ -67,6 +67,10 @@ bool CConfigApp::InitInstance()
return FALSE; return FALSE;
} }
SDL_DestroyWindow(window); SDL_DestroyWindow(window);
m_aspect_ratio = 0;
m_x_res = 640;
m_y_res = 480;
m_frame_delta = 10.0f;
m_driver = NULL; m_driver = NULL;
m_device = NULL; m_device = NULL;
m_full_screen = TRUE; m_full_screen = TRUE;
@ -84,6 +88,7 @@ bool CConfigApp::InitInstance()
m_texture_path = "/textures/"; m_texture_path = "/textures/";
int totalRamMiB = SDL_GetSystemRAM(); int totalRamMiB = SDL_GetSystemRAM();
if (totalRamMiB < 12) { if (totalRamMiB < 12) {
m_ram_quality_limit = 2;
m_3d_sound = FALSE; m_3d_sound = FALSE;
m_model_quality = 0; m_model_quality = 0;
m_texture_quality = 1; m_texture_quality = 1;
@ -91,6 +96,7 @@ bool CConfigApp::InitInstance()
m_max_actors = 5; m_max_actors = 5;
} }
else if (totalRamMiB < 20) { else if (totalRamMiB < 20) {
m_ram_quality_limit = 1;
m_3d_sound = FALSE; m_3d_sound = FALSE;
m_model_quality = 1; m_model_quality = 1;
m_texture_quality = 1; m_texture_quality = 1;
@ -98,6 +104,7 @@ bool CConfigApp::InitInstance()
m_max_actors = 10; m_max_actors = 10;
} }
else { else {
m_ram_quality_limit = 0;
m_model_quality = 2; m_model_quality = 2;
m_3d_sound = TRUE; m_3d_sound = TRUE;
m_texture_quality = 1; m_texture_quality = 1;
@ -174,6 +181,10 @@ bool CConfigApp::ReadRegisterSettings()
m_max_actors = iniparser_getint(dict, "isle:Max Allowed Extras", m_max_actors); m_max_actors = iniparser_getint(dict, "isle:Max Allowed Extras", m_max_actors);
m_texture_load = iniparser_getboolean(dict, "extensions:texture loader", m_texture_load); m_texture_load = iniparser_getboolean(dict, "extensions:texture loader", m_texture_load);
m_texture_path = iniparser_getstring(dict, "texture loader:texture path", m_texture_path.c_str()); m_texture_path = iniparser_getstring(dict, "texture loader:texture path", m_texture_path.c_str());
m_aspect_ratio = iniparser_getint(dict, "isle:Aspect Ratio", m_aspect_ratio);
m_x_res = iniparser_getint(dict, "isle:Horizontal Resolution", m_x_res);
m_y_res = iniparser_getint(dict, "isle:Vertical Resolution", m_y_res);
m_frame_delta = iniparser_getdouble(dict, "isle:Frame Delta", m_frame_delta);
iniparser_freedict(dict); iniparser_freedict(dict);
return true; return true;
} }
@ -350,6 +361,11 @@ void CConfigApp::WriteRegisterSettings() const
iniparser_set(dict, "isle:Max LOD", std::to_string(m_max_lod).c_str()); iniparser_set(dict, "isle:Max LOD", std::to_string(m_max_lod).c_str());
SetIniInt(dict, "isle:Max Allowed Extras", m_max_actors); SetIniInt(dict, "isle:Max Allowed Extras", m_max_actors);
SetIniInt(dict, "isle:Aspect Ratio", m_aspect_ratio);
SetIniInt(dict, "isle:Horizontal Resolution", m_x_res);
SetIniInt(dict, "isle:Vertical Resolution", m_y_res);
iniparser_set(dict, "isle:Frame Delta", std::to_string(m_frame_delta).c_str());
#undef SetIniBool #undef SetIniBool
#undef SetIniInt #undef SetIniInt

View File

@ -59,6 +59,10 @@ class CConfigApp {
// DECLARE_MESSAGE_MAP() // DECLARE_MESSAGE_MAP()
public: public:
int m_aspect_ratio;
int m_x_res;
int m_y_res;
float m_frame_delta;
LegoDeviceEnumerate* m_device_enumerator; LegoDeviceEnumerate* m_device_enumerator;
MxDriver* m_driver; MxDriver* m_driver;
Direct3DDeviceInfo* m_device; Direct3DDeviceInfo* m_device;
@ -85,6 +89,7 @@ class CConfigApp {
float m_max_lod; float m_max_lod;
int m_max_actors; int m_max_actors;
int m_touch_scheme; int m_touch_scheme;
int m_ram_quality_limit;
}; };
extern CConfigApp g_theApp; extern CConfigApp g_theApp;

File diff suppressed because it is too large Load Diff

View File

@ -124,6 +124,8 @@ extern const char* g_files[46];
// FUNCTION: ISLE 0x401000 // FUNCTION: ISLE 0x401000
IsleApp::IsleApp() IsleApp::IsleApp()
{ {
m_xRes = 640;
m_yRes = 480;
m_hdPath = NULL; m_hdPath = NULL;
m_cdPath = NULL; m_cdPath = NULL;
m_deviceId = NULL; m_deviceId = NULL;
@ -153,7 +155,7 @@ IsleApp::IsleApp()
m_videoParam = MxVideoParam(r, NULL, 1, flags); m_videoParam = MxVideoParam(r, NULL, 1, flags);
} }
#else #else
m_videoParam = MxVideoParam(MxRect32(0, 0, 639, 479), NULL, 1, MxVideoParamFlags()); m_videoParam = MxVideoParam(MxRect32(0, 0, (m_xRes - 1), (m_yRes - 1)), NULL, 1, MxVideoParamFlags());
#endif #endif
m_videoParam.Flags().Set16Bit(MxDirectDraw::GetPrimaryBitDepth() == 16); m_videoParam.Flags().Set16Bit(MxDirectDraw::GetPrimaryBitDepth() == 16);
@ -1013,6 +1015,9 @@ bool IsleApp::LoadConfig()
iniparser_set(dict, "isle:Transition Type", SDL_itoa(m_transitionType, buf, 10)); iniparser_set(dict, "isle:Transition Type", SDL_itoa(m_transitionType, buf, 10));
iniparser_set(dict, "isle:Touch Scheme", SDL_itoa(m_touchScheme, buf, 10)); iniparser_set(dict, "isle:Touch Scheme", SDL_itoa(m_touchScheme, buf, 10));
iniparser_set(dict, "isle:Haptic", m_haptic ? "true" : "false"); iniparser_set(dict, "isle:Haptic", m_haptic ? "true" : "false");
iniparser_set(dict, "isle:Horizontal Resolution", SDL_itoa(m_xRes, buf, 10));
iniparser_set(dict, "isle:Vertical Resolution", SDL_itoa(m_yRes, buf, 10));
iniparser_set(dict, "isle:Frame Delta", SDL_itoa(m_frameDelta, buf, 10));
#ifdef EXTENSIONS #ifdef EXTENSIONS
iniparser_set(dict, "extensions", NULL); iniparser_set(dict, "extensions", NULL);
@ -1085,6 +1090,11 @@ bool IsleApp::LoadConfig()
(MxTransitionManager::TransitionType) iniparser_getint(dict, "isle:Transition Type", m_transitionType); (MxTransitionManager::TransitionType) iniparser_getint(dict, "isle:Transition Type", m_transitionType);
m_touchScheme = (LegoInputManager::TouchScheme) iniparser_getint(dict, "isle:Touch Scheme", m_touchScheme); m_touchScheme = (LegoInputManager::TouchScheme) iniparser_getint(dict, "isle:Touch Scheme", m_touchScheme);
m_haptic = iniparser_getboolean(dict, "isle:Haptic", m_haptic); m_haptic = iniparser_getboolean(dict, "isle:Haptic", m_haptic);
m_xRes = iniparser_getint(dict, "isle:Horizontal Resolution", m_xRes);
m_yRes = iniparser_getint(dict, "isle:Vertical Resolution", m_yRes);
m_videoParam.GetRect() = MxRect32(0, 0, (m_xRes - 1), (m_yRes - 1));
m_frameDelta = static_cast<int>(std::round(iniparser_getdouble(dict, "isle:Frame Delta", m_frameDelta)));
const char* deviceId = iniparser_getstring(dict, "isle:3D Device ID", NULL); const char* deviceId = iniparser_getstring(dict, "isle:3D Device ID", NULL);
if (deviceId != NULL) { if (deviceId != NULL) {

View File

@ -108,6 +108,8 @@ class IsleApp {
MxTransitionManager::TransitionType m_transitionType; MxTransitionManager::TransitionType m_transitionType;
LegoInputManager::TouchScheme m_touchScheme; LegoInputManager::TouchScheme m_touchScheme;
MxBool m_haptic; MxBool m_haptic;
int m_xRes;
int m_yRes;
}; };
extern IsleApp* g_isle; extern IsleApp* g_isle;