4

I'd like to play Cave Story in a small-ish window taking up about 1/4-1/2 of my screen. In the options I set it to window, and the screen scaling to "sharp" which appears to give me the approximate play size I want. Only one problem: the window is still taking up the whole screen, just now it's blank borders. I'd like to remove these border areas.

How can I change the window size of Cave Story+?

  • Did you remember to turn off full-screen mode? – jw013 May 19 '14 at 22:03
  • @jw013 Haha yes, I did – John the Green May 20 '14 at 14:51
  • Ok. I have Cave Story+ too (Steam Windows version) and it played in a small window fine, no unnecessary borders. I'll have to check my settings later when I get back on my Steam PC. – jw013 May 20 '14 at 15:17
  • Window / Sharp runs in a window with no black borders for me. Did you resize the window yourself? It looks like Cave Story+ only runs at a few fixed resolutions so if your window size doesn't exactly match one of those resolutions black bars will be used to pad out the extra space. Normally when I change any of the graphics settings the window size changes automatically. – jw013 May 21 '14 at 3:12
  • ..Oddly enough, it seems to have magically resized itself after a few uses >.> Thanks for the effort, @jw013! – John the Green May 21 '14 at 14:53
2

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)

  1. Download my pre-compiled AutoHotkey executable

    https://drive.google.com/open?id=0B7ntR7VRcUecMXhoQjlhM00yT1E
    
  2. Place Cave Story+ (Window Mode).exe in steamapps\common\Cave Story+ directory

  3. Skip to the bottom section, "To add as a Non-Steam game"

With AutoHotkey (manual method)

  1. Download/install AutoHotkey

    https://autohotkey.com/
    
  2. Start Cave Story+ and access the game options menu

  3. Change Screen Type to Window

  4. Change Screen Scaling to Sharp

  5. Close Cave Story+

  6. Navigate to the Cave Story+ directory in steamapps\common

  7. Right-click / New / AutoHotkey Script called "Cave Story+ (Window Mode)" (without quotes)

  8. 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
    
  9. Save the script

  10. Either run the script directly (or create a shortcut to it), or, you can add it as a Non-Steam game (see below)

WithNirCMD

  1. Start Cave Story+ and access the game options menu

  2. Change Screen Type to Window

  3. Change Screen Scaling to Sharp

  4. Close Cave Story+

  5. Navigate to the Cave Story+ directory in steamapps\common

  6. Right-click / New / Text Document called "Cave Story+ window mode" (without quotes)

  7. 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
    
  8. 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

  9. Download NirCmd (scroll to the bottom of the page)

    http://www.nirsoft.net/utils/nircmd.html
    
  10. 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)

  1. Open Steam, go to the Library

  2. Click "+ ADD A GAME..." at the bottom-left of the screen

  3. Choose "Add a Non-Steam Game..."

  4. Click "Browse"

  5. 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

  6. 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:

  1. In the Library, right-click on the duplicate CaveStory+ entry (will have the space removed) and choose "Properties".

  2. Change the name to something meaningful, like "Cave Story+ (Windowed)" or something similar

  3. Click "Change"

  4. Change File Type to "All Files (.)"

  5. 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)

  6. Click "Open"

  7. 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:

  1. Create a new text document

  2. 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
    
  3. Save this document as a .bat file (batch file)

  4. 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.

| improve this answer | |
  • 1
    Could you summarize the contents of the link? – Jutschge Aug 9 '17 at 9:45
  • Ok, but I didn't originally have time to copy/paste and reformat the entire thing to be compatible with SE's formatting rules after originally writing it up for the Steam forums. I made some time to do that tonight. As such, I would certainly appreciate upvotes so that I can actually post hyperlinks in the future, which will be helpful to those reading my answers. – Lucas Aug 11 '17 at 1:34
  • Welcome to Arqade! I hope you enjoy it here. Have my vote for a great answer. 👍 – Stevoisiak Aug 11 '17 at 13:22
1

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.

'sharp' scaling

'stretch' scaling

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.