Skip to content

Persist fullscreen setting and start windowed mode maximized#446

Merged
void2012 merged 1 commit intosmartcmd:mainfrom
MCbabel:fix/persist-fullscreen-setting
Mar 4, 2026
Merged

Persist fullscreen setting and start windowed mode maximized#446
void2012 merged 1 commit intosmartcmd:mainfrom
MCbabel:fix/persist-fullscreen-setting

Conversation

@MCbabel
Copy link
Contributor

@MCbabel MCbabel commented Mar 4, 2026

Description

Persist the fullscreen toggle state across game restarts and start the window maximized when in windowed mode.

Changes

Previous Behavior

  • Toggling fullscreen with F11 only lasted for the current session. On the next launch, the game always started in windowed mode regardless of the user's last fullscreen setting.
  • When starting in windowed mode, the window opened at a non-maximized size, requiring the user to manually maximize it.

Root Cause

g_isFullscreen was hardcoded to false on line 98 of Windows64_Minecraft.cpp and was never saved to disk. The ToggleFullscreen() function only modified the in-memory variable without any persistence. There was also no mechanism to read a saved fullscreen preference on startup.

New Behavior

  • The fullscreen state is saved to options.txt (next to the executable) whenever F11 is pressed. On the next launch, the saved state is read and applied after window creation.
  • When the game starts in windowed mode, the window is now shown maximized by default.

Fix Implementation

  • Added SaveFullscreenOption() and LoadFullscreenOption() helper functions that read/write a simple fullscreen=1 or fullscreen=0 key-value pair to options.txt (following the same pattern as the existing username.txt).
  • ToggleFullscreen() now calls SaveFullscreenOption() after toggling the state.
  • In _tWinMain(), after InitDevice() completes, LoadFullscreenOption() is called and ToggleFullscreen() is invoked if the saved state is fullscreen.
  • Changed ShowWindow() in InitInstance() to use SW_SHOWMAXIMIZED instead of the default nCmdShow for non-hidden windows.

Related Issues

@void2012
Copy link
Collaborator

void2012 commented Mar 4, 2026

Related to #320 ? Please coordinate with that PR author if so.

@MCbabel
Copy link
Contributor Author

MCbabel commented Mar 4, 2026

No, my pull request has nothing to do with #320

@void2012
Copy link
Collaborator

void2012 commented Mar 4, 2026

@fayaz12g

@fayaz12g
Copy link
Contributor

fayaz12g commented Mar 4, 2026

Nah this is an unrelated (and useful!) change. mine deals with the aspect ratio this one deals with persistent full screen state.

Also while I'm here wanted to ask why my PR was marked back to draft? I removed all the WIP parts so that the core logic (which has been thoroughly tested across platforms) could be implemented before I get the UI fixes in a good spot

@void2012
Copy link
Collaborator

void2012 commented Mar 4, 2026

So I should merge yours?

@MCbabel
Copy link
Contributor Author

MCbabel commented Mar 4, 2026

yes, please

@fayaz12g
Copy link
Contributor

fayaz12g commented Mar 4, 2026

So I should merge yours?

Yes

@fayaz12g
Copy link
Contributor

fayaz12g commented Mar 4, 2026

This change would actually be helpful to some of my stuff-- I can make it so that the UI is optimized to your display if you have the full screen parameter true to avoid the issues I've been facing with resizing.

Also using an options.txt makes sense in general. I think we should have some standardized config file that has a template as well, but that's for a separate pr

@void2012
Copy link
Collaborator

void2012 commented Mar 4, 2026

Record a gameplay footage, ask anyone else to test (especially with Wine), and I'm going to merge

@EnderActually
Copy link

I will test with wine and proton.

@fayaz12g
Copy link
Contributor

fayaz12g commented Mar 4, 2026

Tested on Windows 11, loaded the game in windowed mode, hit F11 to toggle full screen, closed the game, relaunched and it jumped right back into full screen, and observed the options.txt generated.

Video (too big to put straight to GitHub):
https://streamable.com/mtuiga

@EnderActually
Copy link

I can't currently compile right now, do you have a build?

@fayaz12g
Copy link
Contributor

fayaz12g commented Mar 4, 2026

I can't currently compile right now, do you have a build?

Sure: https://limewire.com/d/NM8ai#lDmA7RkWib

Save fullscreen toggle state to options.txt when F11 is pressed, and restore it on the next launch. When starting in windowed mode, the window now opens maximized instead of at a smaller default size.

Previously, g_isFullscreen was hardcoded to false and never persisted, so the game always started in windowed mode. The window also started at a non-maximized size requiring manual maximization.

Fixes smartcmd#391
@MCbabel MCbabel force-pushed the fix/persist-fullscreen-setting branch from f564631 to 718ee71 Compare March 4, 2026 19:46
Copy link

@EnderActually EnderActually left a comment

Choose a reason for hiding this comment

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

Works good on the Linux side!

@MCbabel
Copy link
Contributor Author

MCbabel commented Mar 4, 2026

I just tested it with GE-Proton, and it works exactly the same as it does under Windows

@void2012
Copy link
Collaborator

void2012 commented Mar 4, 2026

Merge?

@MCbabel
Copy link
Contributor Author

MCbabel commented Mar 4, 2026

Merge?

yeah please

@void2012 void2012 merged commit 3f1388e into smartcmd:main Mar 4, 2026
PortalG pushed a commit to PortalG/MinecraftConsoles that referenced this pull request Mar 5, 2026
…d#446)

Save fullscreen toggle state to options.txt when F11 is pressed, and restore it on the next launch. When starting in windowed mode, the window now opens maximized instead of at a smaller default size.

Previously, g_isFullscreen was hardcoded to false and never persisted, so the game always started in windowed mode. The window also started at a non-maximized size requiring manual maximization.

Fixes smartcmd#391
wolverton912 added a commit to wolverton912/MinecraftConsoles that referenced this pull request Mar 5, 2026
* Win64: show actual world names in save list, sort newest-first, preserve level name on load/resave

* Refactor README for consistent formatting

Updated formatting for clarity and consistency in the README.

* Prevent world input from affecting inventory (smartcmd#354)

* fix: properly offset the mouse position in containers (smartcmd#327)

* Fix overlapping debug menus and screens (smartcmd#294)

* Fix overlapping debug menus and screens

Also resolves a formatting issue with clang-format

* Update readme

* Update crafting controls description (smartcmd#359)

Clarified crafting controls in README.

* Disable flight state when riding entities (smartcmd#368)

* renderer: frustum test new chunks so newly generated chunks render to full view distance smartcmd#175 (smartcmd#344)

* Removed private information (smartcmd#333)

Maybe we should not have this out there to find so easily?

* Delete README.md

Unnecessary

* fix: fix inverted pitch in the second third person view

* fix: fix horse texture rendering

* feat: add support for username, IP, and port configuration via launch arguments

* feat: headless server

* docs: mark V-Sync note as WIP in README.md

* docs: fix table formatting in README.md

* Disable automatic Windows account username

This could reveal someone's private information on a livestream or video.
We need a long-term username implementation

* Restore username.txt loading without conflict

Still allows for -name launch argument, but restores old expected behavior

* Update README with info about username.txt

* Enable Stained Glass in Creative Menu

* Fix creative inventory crash with Art Tools debug option (smartcmd#399)

Fix vector out-of-bounds crash when scrolling the potions tab in the creative inventory with Art Tools debug enabled.

- Fix getPageCount() returning total rows instead of scrollable pages in Art Tools mode

- Fix off-by-one boundary check in populateMenu() for both static and debug group loops (< should be <=)

Fixes smartcmd#386

* Fix: Sorted the item list in the debug overlay (smartcmd#340)

* Fix: Sorted the item list in the debug overlay

* revert show all files to false

* Revert ShowAllFiles by removing it

* removed extra line

* Adressed PR review changes

* Replaced push_back with emplace_back

* Removed redundant emplace_back

* Fix Chunk destructor segfault using smart pointers smartcmd#112 (smartcmd#414)

* Fix duplicated stained glass when art tools enabled (smartcmd#426)

* Prevent door sounds from playing twice smartcmd#392 (smartcmd#425)

* Fix incorrect distance comparison return value (smartcmd#432)

* Fix:Prevent horse spawner crash (smartcmd#433)

* refactor: refactor KBM input code

* Fix mob nametag position to match correct height offset smartcmd#422 (smartcmd#440)

* fix: ignore dedicated server properties in normal world startup

* Fix controller paging regression in creative menu

Preserve smooth row-by-row scrolling for mouse wheel input, but restore
full-page movement for controller/menu scroll actions in the creative
inventory.

Commit 3093ca3 changed page indexing to support smooth scrolling, which
caused ACTION_MENU_OTHER_STICK_UP/DOWN to advance by one row instead of
one page. Track whether the scroll action originated from the mouse
wheel and only use single-row steps in that case.

Fixes smartcmd#253

* fix: restore KBM sprint on either Ctrl key

* fix: fix smartcmd#464

* Fix for any aspect ratio in 3D Environments (smartcmd#320)

* Add initial AnyAspectRatio support

* Remove some logic that didn't work

* Remove rogue back slash

* Remove more remnants

* Update UILayer.h

* Update some comments

* Remove WIP UI changes

* Fix diffs

* Remove UI resize call from `UpdateAspectRatio`

* handle merge conflict

* Update to C++ style static cast

* Fix syntax

* Revert "fix: fix smartcmd#464"

This reverts commit 5922824.

* Update ItemInHandRenderer.cpp (smartcmd#418)

* Persist fullscreen setting and start windowed mode maximized (smartcmd#446)

Save fullscreen toggle state to options.txt when F11 is pressed, and restore it on the next launch. When starting in windowed mode, the window now opens maximized instead of at a smaller default size.

Previously, g_isFullscreen was hardcoded to false and never persisted, so the game always started in windowed mode. The window also started at a non-maximized size requiring manual maximization.

Fixes smartcmd#391

* Ship updated, maybe temporary subtitle

People keep going "Oh no I don't like the red WINDOWS text, oh no! I hate it!
The red windows text is the devil, it will be my undoing! Please remove the red
windows text or I shall simply perish!" And for that? Well, I have removed it. Now
you can enjoy this logo made by @wiskerdmage in the style of the existing Edition
logos. (smartcmd#385 (comment))

* Ship revised logo from @wiskerdmage

This one looks a bit nicer so let's use this for now...

* Adjust entity tracking ticks for several types

This fixes the jittery problem.

* fix: Fixed crash when launching at 720p smartcmd#517

Modify `MediaWindows64.arc` to include `skinHud.swf`

---------

Co-authored-by: dtentiion <dtentiongit@gmail.com>
Co-authored-by: Alezito2008 <92759854+Alezito2008@users.noreply.github.com>
Co-authored-by: 4win <4winyt@gmail.com>
Co-authored-by: rtm516 <rtm516@users.noreply.github.com>
Co-authored-by: Mykey <mykey.discord@gmail.com>
Co-authored-by: ModMaker101 <119018978+ModMaker101@users.noreply.github.com>
Co-authored-by: Tygo de Vries <108730722+TygodeVries@users.noreply.github.com>
Co-authored-by: daoge_cmd <3523206925@qq.com>
Co-authored-by: Loki Rautio <lokirautio@gmail.com>
Co-authored-by: Marlian <84173858+MCbabel@users.noreply.github.com>
Co-authored-by: Davi Eler Magalhães <davi.eler.magalhaes@gmail.com>
Co-authored-by: Fayaz Shaikh <61674751+fayaz12g@users.noreply.github.com>
Co-authored-by: LetsGoAway <68365423+letsgoawaydev@users.noreply.github.com>
Co-authored-by: Siobhan 🏳️‍⚧️ <33694155+siobhan-saoirse@users.noreply.github.com>
Co-authored-by: kuwacom <kuwa.com3@gmail.com>
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.

Game should have run in fullscreen mode on next game launch while fullscreen is already toggled!

4 participants