How can I change the window size of Cave Story+?
I know this post is three years old, but in case someone else ends up here who is looking for an answer, please see my post on the Steam forums.
https://steamcommunity.com/app/200900/discussions/0/1470841715955928554/
I took some time to copy/paste my original thread from the Steam forums and format it for stack exchange:
The default window size of Cave Story+ is way too big (in my opinion), and even though it can be manually resized by clicking and dragging, I'd rather not mess with that.
Disclaimer: I'm working with a monitor resolution of 2560x1440, so this may or may not work well for users on lower resolutions (e.g., 1920x1080). However, you can experiment with the x/y values of the window size, and also setting the game to "stretch" instead of "sharp" to see if that makes any difference.
To that end, I have been working on figuring out a way to have the window automatically resize to specified parameters. I believe that I have a couple decent solutions; you can choose between AutoHotkey and NirCmd methods (I prefer AutoHotkey because it seems to work better with process names when defining window sizes).
With AutoHotkey (easiest method)
-
Download my pre-compiled AutoHotkey executable
https://drive.google.com/open?id=0B7ntR7VRcUecMXhoQjlhM00yT1E
Place Cave Story+ (Window Mode).exe in steamapps\common\Cave Story+ directory
Skip to the bottom section, "To add as a Non-Steam game"
With AutoHotkey (manual method)
-
Download/install AutoHotkey
https://autohotkey.com/
Start Cave Story+ and access the game options menu
Change Screen Type to Window
Change Screen Scaling to Sharp
Close Cave Story+
Navigate to the Cave Story+ directory in steamapps\common
Right-click / New / AutoHotkey Script called "Cave Story+ (Window Mode)" (without quotes)
-
Open the script in notepad and paste the following:
#NoTrayIcon #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. ; #Warn ; Enable warnings to assist with detecting common errors. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. Run, steam://rungameid/200900 Sleep, 3000 WinMove, ahk_exe CaveStory+.exe, , 0, 0, 1296, 955 WinWait, ahk_exe CaveStory+.exe CenterWindow("ahk_exe CaveStory+.exe") CenterWindow(WinTitle) { WinGetPos,,, Width, Height, %WinTitle% WinMove, %WinTitle%,, (A_ScreenWidth/2)-(Width/2), (A_ScreenHeight/2)-(Height/2) } return
Save the script
Either run the script directly (or create a shortcut to it), or, you can add it as a Non-Steam game (see below)
WithNirCMD
Start Cave Story+ and access the game options menu
Change Screen Type to Window
Change Screen Scaling to Sharp
Close Cave Story+
Navigate to the Cave Story+ directory in steamapps\common
Right-click / New / Text Document called "Cave Story+ window mode" (without quotes)
-
Open the text file and paste the following:
nircmd win hide ititle cmd.exe start steam://rungameid/200900 nircmd wait 3000 nircmd win setsize process CaveStory+.exe 0 0 1296 955 nircmd win center ititle Cave Story+ exit
Save the document as a batch file (File / Save As then add .bat at the end of the file name; e.g.: Cave Story+ window mode.bat
-
Download NirCmd (scroll to the bottom of the page)
http://www.nirsoft.net/utils/nircmd.html
Unzip nircmd.exe into the Cave Story+ folder (you only need the one file, nircmd.exe)
To add as a Non-Steam game (launch from within Steam)
Open Steam, go to the Library
Click "+ ADD A GAME..." at the bottom-left of the screen
Choose "Add a Non-Steam Game..."
Click "Browse"
Navigate to the Cave Story+ folder and choose Cave Story+ (Window Mode).exe (if using my pre-compiled executable), or CaveStory+.exe if using AutoHotkey manual method or NirCmd method
Click "Add Selected Programs"
If you are using my pre-compiled executable, you are done at this point. You should be able to launch Cave Story+ (Window Mode) from your Steam library. If using one of the other two methods, continue on:
In the Library, right-click on the duplicate CaveStory+ entry (will have the space removed) and choose "Properties".
Change the name to something meaningful, like "Cave Story+ (Windowed)" or something similar
Click "Change"
Change File Type to "All Files (.)"
Choose "Cave Story+ window mode.ahk" if using AutoHotkey, or "Cave Story+ window mode.bat" if using NirCMD (note: you can also compile the AutoHotkey script you made so that you have .exe instead of .ahk, but this doesn't really matter)
Click "Open"
Click "Close"
Now you can launch Cave Story+ from your Steam library with a custom window size. To change the window size, edit the batch file you created and change the two numbers at the end of this line:
nircmd win setsize process CaveStory+.exe 0 0 **1296 955**
1296 represents x size whereas 955 represents y size. Cave Story+ runs at an odd aspect ratio of 1.296, so keep that in mind if you change the window size, as different aspect ratios will result in black bars on the image. Other window sizes of this aspect ratio include:
656 503 1296 955 1616 1184
Using these numbers will give you an image without black borders, but you can experiment with different resolutions if you want.
Also, if for some reason the game window is not resizing properly, try increasing the 3000 value (in either the AHK or NirCmd scripts) to 4000 or 5000:
Sleep, **3000**
nircmd wait **3000**
To automatically center windows using SDL environment variable
This is something you can do which will make the process of centering the window a little bit smoother. My scripts will automatically center the window, but adding this environment variable will ever-so-slightly speed up the process. It will affect all windows using SDL (not just Cave Story+) as it involves adding an environment variable. The easiest way to do this is as follows:
Create a new text document
-
Open it and paste the following:
REM Defines environment variable to center SDL windows if undefined if defined SDL_VIDEO_CENTERED ( exit ) else ( setx SDL_VIDEO_CENTERED 1 ) exit
Save this document as a .bat file (batch file)
Double-click the file and run it. It will automatically set the environment variable.
If you were using the AutoHotkey manual method, you can remove this portion from the script:
CenterWindow("ahk_exe CaveStory+.exe")
CenterWindow(WinTitle)
{
WinGetPos,,, Width, Height, %WinTitle%
WinMove, %WinTitle%,, (A_ScreenWidth/2)-(Width/2), (A_ScreenHeight/2)-(Height/2)
}
If using NirCmd, remove this line:
nircmd win center ititle Cave Story+
Well, there you have it. This method may work with other games, as well, but I've only tested with this one so far. Hope this helps someone.
You can't remove the borders when screen scaling is set to Sharp.
You need to set screen scaling to Stretch. Once it's been changed, you should be able to resize the window by dragging the corners.