Skip to content

Persist screen resolution - #44

Merged
Flamefire merged 7 commits into
Return-To-The-Roots:masterfrom
morganchristiansson:save-screen-resolution
Jun 23, 2026
Merged

Persist screen resolution#44
Flamefire merged 7 commits into
Return-To-The-Roots:masterfrom
morganchristiansson:save-screen-resolution

Conversation

@morganchristiansson

Copy link
Copy Markdown
Contributor
$ cat ~/.s25rttr/s25edit.ini 
[editor]
width=800
height=600
fullscreen=0

Also increase resolution list height and add 4K UHD.
image
Fixes #20

Comment thread CGame.cpp Outdated
libsiedler2::Archiv settings;
if(libsiedler2::Load(settingsPath, settings) != 0)
return;
const auto* ini = static_cast<const libsiedler2::ArchivItem_Ini*>(settings.find("editor"));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't it be a dynamic_cast here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Thank you for your review!

Comment thread CGame.cpp Outdated
libsiedler2::Archiv settings;
settings.alloc(1);
settings.set(0, std::make_unique<libsiedler2::ArchivItem_Ini>("editor"));
auto* ini = static_cast<libsiedler2::ArchivItem_Ini*>(settings.find("editor"));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually not required here as you just put that one in. So this cannot fail. It could use a dynamic cast with a reference to make that clear(er), but not so important

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment thread CGame.cpp Outdated
morganchristiansson and others added 2 commits June 23, 2026 14:53
Co-authored-by: Alexander Grund <Flamefire@users.noreply.github.com>
Comment thread CGame.cpp Outdated
return;
GameResolution.x = ini->getValue("width", static_cast<int>(GameResolution.x));
GameResolution.y = ini->getValue("height", static_cast<int>(GameResolution.y));
fullscreen = ini->getValue("fullscreen", static_cast<int>(fullscreen)) != 0;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fullscreen = ini->getValue("fullscreen", static_cast<int>(fullscreen)) != 0;
fullscreen = ini->getValue("fullscreen", fullscreen);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@Flamefire
Flamefire merged commit 9800519 into Return-To-The-Roots:master Jun 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Save resolution

3 participants