Skip to content

Releases: nmlgc/ssg

P0295

22 Oct 05:45
Compare
Choose a tag to compare

The graphics subsystem has been ported to SDL 2's cross-platform 2D rendering API! Now, the game runs fully hardware-accelerated on any GPU supporting at least Direct3D 9 or OpenGL 2.
SDL also facilitated the addition of new windowed and borderless fullscreen modes, providing all the scaling options you'd expect for retro pixel graphics on modern displays.
Screenshot of the new Graphic option menu in the Shuusou Gyoku P0295 build, showcasing the defaults after updating: Windowed mode, fullscreen as borderless, window as large as possible on current display, and framebuffer scaling.
The defaults after updating.

The SDL build now exclusively renders the game as it appeared in the original 16-bit mode, and currently does not offer the original 8-bit mode or an emulation of it. Therefore, this release also comes with a separate binary that retains the original Direct3D and DirectDraw renderers, built from the same current codebase. This binary still only supports the original game's 640×480 fullscreen mode.

The detailed changelog:

Graphics options

  • (SDL-exclusive) When updating to this build, the game starts up in windowed mode, scaled by the largest multiple of 0.25× possible on the primary display.

  • (SDL-exclusive) The Config → Graphic menu now hosts a variety of options to control rendering and scaling:

    • Display: Changes between windowed and fullscreen modes. When changing to fullscreen, the game will pick the display the window is on; if the window is placed between two displays, it will first be snapped to the closer one.

    • FullScr: Specifies the fullscreen mode to use:

      • [Exclusive]: The classic, display mode-changing type of fullscreen from the original version of the game. Uses the game's native 640×480 resolution and leaves the specific scaling behavior to your display.

      • [Borderless]: Displays the game in a borderless window stretched to the current desktop resolution.

    • ScaleFact: Allows the scaling factor in windowed mode to be adjusted at multiples of 0.25. Capped to the maximum possible resolution of the display the game window is currently placed on. Any explicit factor is preserved across restarts; [ Screen ] will always pick the largest possible size on the current monitor.

    • FullScrFit: Specifies scaling in borderless fullscreen mode:

      • [Integer]: Largest integer resolution possible on the current display. Can lead to windowboxing.

      • [ 4:3 ]: Largest resolution that maintains the game's 4:3 aspect ratio. Will pillarbox on wider screens, and letterbox on taller ones.

      • [Stretch]: Stretches the game to fill the display, disregarding its intended 4:3 aspect ratio.

    • ScaleMode: Selects between two scaling behaviors:

      • [FrameBuf]: Renders each frame to a 640×480 texture that is then scaled to the output size.
        Fully preserves the game's original pixel grid. When using any of the Direct3D rendering APIs, the rendered pixels perfectly match the 32-bit mode of pbg's original DirectDraw/Direct3D backend. Only line rendering slightly differs on other APIs; see the blog for details.

      • [Geometry]: Directly renders the game at its scaled resolution by scaling the vertices of each draw call. This has the following effects:

        1. All polygonal shapes (i.e., boxes, lasers, gradients, and the boss explosion rings) appear sharper due to being rasterized directly at the output resolution.
        2. However, sprites can suffer dramatically at non-integer resolutions, exhibiting weird color blending and texture coordinate glitches at their edges.
        3. Screenshots taken with the P key use the output resolution rather than 640×480. (In this mode, there is no 640×480 render output to be saved.)
    • API: Specifies which render driver SDL is using.
      This is only meant to provide alternatives in case of rendering or performance issues on certain GPUs. The game is not guaranteed to run flawlessly and at full speed with all of the drivers on every GPU. See #65 for a list of known bugs with specific GPU × API permutations.

  • (SDL-exclusive) Regardless of how the game is scaled, the SDL renderer always uses nearest-neighbor filtering if the output resolution is an integer multiple of 640×480, and bilinear filtering for every resolution in between.

  • The DrawMode option has been renamed to a less ambiguous and visually symmetric FrameRate.

  • The more layout-related MsgWindow option is now separated from the more technical graphics options with a horizontal line.

Input

  • (SDL-exclusive) The most important rendering options are also mapped to hotkeys:

    • Alt + ⏎ Return: Switches between windowed mode and the either borderless or exclusive fullscreen mode, as selected in the Graphic menu.
    • F11/F10: Cycles forward/backward through the window scale options. In windowed mode, this adds/subtracts 0.25× to the window's scaling factor; in borderless fullscreen mode, it cycles through the integer, 4:3, and stretch options.
    • F9: Switches between framebuffer and geometry scaling.
  • The F8 key now toggles the framerate limiter.

Graphics

  • All true-color shapes rendered in-game are now correctly clipped to the bottom-right edge of the playfield at (512, 480). The Direct3D backend used in the original game's 16-bit mode had an off-by-one error in its viewport calculation that caused these shapes to be clipped at (511, 479) instead.

    • (DirectDraw-exclusive) The palettized 8-bit renderer had similar off-by-one bugs in the clipping conditions of circle outlines and the filled circle parts of homing lasers, which are now fixed as well.
  • (DirectDraw-exclusive) The red boxes drawn when entering a new name into the High Score list are now equally wide in both 8-bit and 16-bit modes. An off-by-one error in the original game's 8-bit box drawing code added one more column of pixels to their right edge.

Sound and music

  • The MIDI options have been moved to a dedicated submenu within Sound / Music.

  • Invalid GS Reverb Macro SysEx messages are now clamped to the SC-88Pro's specified range of [0, 7] by default, matching the behavior of real hardware. This ensures that the majority of Shuusou Gyoku's soundtrack plays back with ZUN's intended panning delay reverb on non-SC-88Pro Roland synthesizers that don't clamp these messages, such as the SC-8850 and Sound Canvas VA.
    See the 2024-03-09 blog post for more info about the bugs in ZUN's MIDI files.
    Thanks to Romantique Tp for clarifying the behavior of real hardware.

    • This fix can be toggled with the SC88ProFXCompat option in the Config → Sound / Music → MIDI menu.

BGM modding

  • The previous empty files in the bgm/ directory that tried to explain the BGM pack folder structure with localized filenames have been replaced with a single, clearer image.

Menus

  • The title and options of the Joy Pad option menu are now consistently aligned to the same horizontal position.

Miscellaneous

  • Playing the Extra Stage or watching an Extra Stage replay no longer affects the configured difficulty setting. The original game had three bugs here:

    • When returning to the main menu from an Extra Stage replay, the configured difficulty would be overridden with either
      1. the difficulty selected before the last time the Extra Stage's Weapon Select screen was entered, or
      2. Easy, when watching the replay before having been to the Extra Stage's Weapon Select screen during one run of the program.
    1. Closing the game window during the Extra Stage (both self-played and replayed) would override the configured difficulty with Hard (the internal difficulty level of the Extra Stage).
  • During the game, the number of frames rendered in the previous second is now displayed in the top-left corner.

  • Scores above 2,147,483,647 points are now displayed correctly in-game instead of rendering as negative numbers.

Regressions

  • High score saving now works again. It was accidentally commented out in the P0256 and P0275 builds.

  • The P0251 build introduced a potential use-after-free bug when re-opening the in-game dialog / main menu help window, which has also been fixed.

Troubleshooting

As of the P0256 build, D3DWindower can no longer be used with the vintage DirectDraw/Direct3D binary, but DxWnd still works. Import this configuration via File → Import, then adjust the path to your GIAN07.exe.

If the vintage binary still runs slow on your system, or doesn't render anything at all:

  • Delete any reference to GIAN07.exe from the following registry keys:

    • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
    • HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
  • Make sure that the 32-bit mode is activated in the Config → Graphic menu.

Additional credits

  • Elfin: English→Japanese localizations

Summary blog post: https://rec98.nmlgc.net/blog/2024-10-22
Full changelog compared to the previous release: P0275...P0295
Previous release: https://github.com/nmlgc/ssg/releases/tag/P0275

P0275

09 Mar 15:38
Compare
Choose a tag to compare

BGM can now be modded via BGM packs in the bgm/ subdirectory! Each track is identified by its two-digit Music Room number, followed by the extension – for example, the MIDI version of the title screen theme would be 01.mid. This was mainly implemented for in-game support of SC-88Pro recordings on future operating systems without a native MIDI synth.
"Screenshot of the BGM pack selection menu introduced in the Shuusou Gyoku P0275 build, highlighting the <Download> option.

Due to new filesystem- and threading-related code, this release requires Windows Vista or later, and no longer comes with an i586 build. If you are interested in continued official support for earlier Windows versions, feel free to provide funding or code contributions for #43, #53, and/or #58.

The detailed changelog:

BGM packs

  • BGM packs introduce support for waveform BGM. The system is based on thcrap's BGM modding support, with the following key differences:

    • Only FLAC (.flac) and Ogg Vorbis (.ogg) codecs are supported, with .flac taking precedence over .ogg.

    • Stacking is not supported.

    • Each track can be provided in waveform and MIDI versions. If both are present, the MIDI version is silently processed in the Music Room to provide note and spectrum analyzer visualization. This assumes that both waveform and MIDI files are perfectly synchronized with each other.

    • Track titles for in-game and Music Room display are taken from the Vorbis comment TITLE tag of the intro file.

  • Waveform tracks can provide a gain factor to optionally remove any volume differences between individual tracks of a BGM pack. This factor is read as a floating-point value from the optional GAIN FACTOR tag of the intro file.

    • The configuration menu disables the BGMVolNormalize option if the currently playing track does not define a gain.
  • Waveform tracks can link themselves to a MIDI file from the original MUSIC.DAT soundtrack. This allows recordings of these MIDIs to retain the original Music Room visualizations without needing to bundle the original file in the BGM pack and thus infringing copyright. This is done by providing the full 32-byte BLAKE3 hash of a MIDI file in the optional SOURCE MIDI tag of the intro file.

  • If no BGM pack is present, the Sound / Config menu provides a download option for SC-88Pro recordings of the original soundtrack. Currently, this simply opens a web page in the system's default browser.

General sound- and music-related changes

  • BGM and sound effect volume can now be adjusted in-game, separately from each other. The controls in the Sound / Config menu are modeled after the MIDI standard, using a squared volume curve with a range between 0 and 127. Unlike in Windows Touhou, the BGM volume setting also applies to MIDI.

    Screenshot of the Sound / Music menu of the Shuusou Gyoku P0275 build, showing off the new volume control and BGM pack selection options.

  • The in-game music title animation is no longer shown if BGM is disabled.

  • In-game music titles are now consistently right-aligned.
    Leading whitespace in 4 of the original MIDI Sequence Names suggests that pbg might have intended these titles to be centered within the 216 maximum pixels that the original code designated for music titles, but none of those had the correct amount of spaces that would have been required for exact centering. The code did have a formula for right alignment though, so this fix maintains consistency with the whitespace-trimmed title tags in the BGM packs. For shorter titles, this slightly changes the look of the animation; this might be fixed with #55.

    Original game:

    2024-03-09-SH01-Ingame-music-title-original.webm

    P0275 build:
    2024-03-09-SH01-Ingame-music-title-P0275.webm

MIDI playback

  • The original MIDI soundtrack from MUSIC.DAT now seamlessly loops instead of restarting at the end of each MIDI file. The necessary loop points were algorithmically detected using mly and are hardcoded into the executable as a map that associates the BLAKE3 hash of each individual MIDI file with a loop region.

  • Re-enabling MIDI BGM in the Sound / Music menu will now immediately play the title screen theme again.

  • MIDI files now play at their exact notated tempo.
    Shuusou Gyoku's original MIDI parser had an arithmetic error that caused every tempo value to be parsed as roughly ≈0.8% / ≈1 BPM slower than notated. As a result of pbg's Program Support role during the development of TH06, this bug is also present in every Windows Touhou game that supports MIDI playback.

  • The MIDI Port configuration option now shows a simple grayed-out > if BGM is disabled. Previously it showed ^^^^^^^^^^, which lined up with the 使用しない string from the MIDI option above, but this no longer works with the new BGM-related options between the two.

  • When the game window regains focus after losing it, MIDI playback now resumes at the exact position it was paused, instead of rewinding to the beginning of the track.

  • The MIDI TIMER in the Music Room now shows the current MIDI pulse value.
    In the original game, it simply showed the PASSED TIME value formatted in milliseconds. While this revealed the 10ms update interval of the game's MIDI player, it didn't provide any further information that related to the actual MIDI file being played. In contrast, the MIDI pulse value will jump back when reaching the loop point while the PASSED TIME value continues to increase in that case.

Menus

  • If any of Shuusou Gyoku's 5 original game data files are missing, the game now shows a new screen at startup with the full absolute paths to the .DAT files and an option to recheck without restarting the game. This means that the game will now at least show something if it's started by itself from any directory – previously, it simply crashed on the first attempt to load anything from a nonexistent .DAT file.

    The new 'missing game data' screen shown at startup in the P0275 build of Shuusou Gyoku, listing any missing files at their absolute directories and offering the possibility to recheck their existence without quitting the game.

  • The main menu help text now appears centered rather than left-aligned next to a nonexistent face sprite.

Troubleshooting

As of the P0256 build, D3DWindower can no longer be used with the SDL2/non-i586 version, but DxWnd still works. Import this configuration via File → Import, then adjust the path to your GIAN07.exe.

If the game runs slow on your system, or doesn't render anything at all:

  • Delete any reference to GIAN07.exe from the following registry keys:

    • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
    • HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
  • Make sure that the 32-bit mode is activated in the Config → Graphic menu.

Additional credits

  • Elfin: English→Japanese localizations
  • Verinna: Spanish localization for BGM placement files

Summary blog post: https://rec98.nmlgc.net/blog/2024-03-09
Full changelog compared to the previous release: P0256...P0275
Previous release: https://github.com/nmlgc/ssg/releases/tag/P0256

P0256

30 Sep 21:26
Compare
Choose a tag to compare

This build starts the gradual migration to cross-platform low-level game libraries as part of the Linux port. SDL is now used for window creation, frame rate limiting, and input, while sound is handled through miniaudio.

Changes unique to the regular / cross-platform library build

  • The game now limits its frame rate by properly sleeping the process instead of the original's busy-waiting code that permanently used 100% of one CPU core to wait for the next frame. On modern systems, this should drop CPU usage into the 0%-2% range during regular gameplay.

  • Since the game no longer uses DirectInput 7, antivirus scanners shouldn't complain about the .EXE file anymore.

  • Thanks to SDL, the game should now support every possible controller, including more modern ones that maybe weren't supported by the original game.

  • The game now reads inputs from every connected controller, not just the one that is configured as the preferred device for older applications in the Control Panel.

    • All controllers can be freely hot-plugged and removed while the game is running, just like the single controller in the original game.
  • Sound effects are slightly crispier when upsampled to native sampling rates of ≥44100 Hz, due to miniaudio's differently implemented low-pass filter.

  • Direct3DWindower no longer works properly, but DxWnd does.

Changes present in both builds

  • When playing the game through external DirectDraw windowing tools, the game window can now be moved.

  • The original game's rapid-fire screenshot feature has been restored. The original game mapped this feature to the PrintScreen key, which invokes Windows' own focus-stealing screenshot UI in recent Windows versions. For this reason, it's remapped to the P key in this build, which is consistent with all Windows Touhou games since TH08.
    When holding the P key, the game will now save every rendered frame to a .BMP file.

  • The Joy Pad menu in the original game allowed joypad actions to be unmapped by pressing more than one button simultaneously. This was indicated with [Button 0], which might falsely suggest that the game starts numbering joypad buttons at 0, especially since the SpeedDown and ESC action start out in this unmapped state. This build replaces [Button 0] with a much clearer [--------] label.

    Joypad button unbinding in the P0256 build of Shuusou Gyoku, using a much clearer [--------] label

  • The game loop now keeps running at the end of the in-game Game Over animation, and doesn't freeze until pressing and releasing a key or joypad button anymore.

  • The game now immediately renders the High Score screen when entering it through the Score option in the main menu. The original game showed just a black screen until the ⏎ Return/Z key or corresponding joypad button was released.

  • When registering a new high score, any held ⏎ Return/Z or corresponding joypad inputs are now flushed before entering the High Score screen. This avoids an A being added to the name seemingly automatically when entering this screen by pressing one of those inputs after a Game Over.

  • Errors are now logged in UTF-8. To avoid mixed encodings in the originally Shift-JIS-encoded ErrLOG2.TXT file, new logs are written to ErrLOG_UTF8.TXT instead.

Troubleshooting

D3DWindower can no longer be used with the SDL2/non-i586 version, but DxWnd still works. Import this configuration via File → Import, then adjust the path to your GIAN07.exe.

If the game runs slow on your system, or doesn't render anything at all:

  • Delete any reference to GIAN07.exe from the following registry keys:

    • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
    • HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
  • Make sure that the 32-bit mode is activated in the Config → Graphic menu.


Summary blog post: https://rec98.nmlgc.net/blog/2023-09-30
Full changelog compared to the previous release: P0251...P0256
Previous release: https://github.com/nmlgc/ssg/releases/tag/P0251

P0251

01 Aug 23:57
Compare
Choose a tag to compare

Tons of internal changes in preparation for migrating the codebase to SDL and its renderer abstraction, together with a few minor bug fixes:

  • The P0226 build had a bug that allowed invalid stages to be selected for replay recording. If the ReplaySave option was [O F F], pressing the ⬅️ left arrow key on the StageSelect option would overflow its value to 255. The effects of this weren't all too serious: The game would simply stay on the Weapon Select screen for an invalid stage number, or launch into the Extra Stage if you scrolled all the way to 131. Still, it's fixed in this build.

    Screenshot of the negative overflow bug that the P0226 build of Shuusou Gyoku accidentally introduced into the replay stage selection
    Whoops! That one was fully my fault.

  • Alt-Tabbing out of the ending won't mess up graphics anymore.
    See #19 for details of this bug.

  • Text rendering has been optimized by caching each piece of text on a DirectDraw surface (equivalent to a texture in modern 3D APIs) instead of directly rasterizing it onto the DirectDraw framebuffer every frame. This was necessary for porting the game away from DirectDraw later, but it also happened to increase the game's potential frame rate by roughly 3.5× in the Music Room, and 1.9× during in-game dialog.

  • The gradient on the in-game music title now renders roughly twice as fast, cutting down the lag before its animation.

  • The configuration file now uses a forwards-compatible versioning scheme, and a matching SSG_V??.CFG file name format. These new files don't use a checksum anymore, which allows the configuration to be freely hex-edited. The game now validates each value individually, and resets it to its default on a validation failure.

    • For backward compatibility, a build will always write any changed settings to all previous configuration file versions, including the original 秋霜CFG.DAT.

    • A bit depth setting of 32-bit is now automatically turned into 16-bit when writing to the original 秋霜CFG.DAT. On the original 秋霜玉.exe, any value apart from 8-bit or 16-bit would cause the entire file to fail validation, resetting the entire configuration to its defaults and re-locking the Extra Stage. This fully restores the backward compatibility to the original release that the P0226 build broke.

  • 8-bit mode now requires no special tweaks in DxWnd to run without glitches.
    To display the in-game music title with correct colors, the original game required the DirectX(2) → Fix DC palette setting, which was only introduced in version 2.05.95, released in April 2023.

  • The archive now includes an i586 build that can potentially run on vintage Windows systems. See the Setup section inside the archive for more details.

The original screenshot feature is still missing, as it also wasn't part of pbg's released source code.

Troubleshooting

  • If the game runs slow on your system, or doesn't render anything at all:

    • Delete any reference to GIAN07.exe from the following registry keys:

      • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
      • HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
    • Make sure that the 32-bit mode is activated in the Config → Graphic menu.

  • If you're wondering why your antivirus is freaking out: I explained the reasons in #22, with some more background in #21.


Summary blog post: https://rec98.nmlgc.net/blog/2023-08-01
Full changelog compared to the previous release: P0226...P0251
Previous release: https://github.com/nmlgc/ssg/releases/tag/P0226

P0226

31 Dec 23:59
Compare
Choose a tag to compare

Now runs at full speed on modern Windows systems, by adding support for 32-bit rendering and defaulting to it if possible. If the game still runs slow on your system, or doesn't render anything at all:

  • Delete any reference to GIAN07.exe from the following registry keys:

    • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
    • HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
  • Make sure that this new mode is activated in the Config → Graphic menu:

    The new 32-bit rendering option in the Shuusou Gyoku P0226 build.

Due to this additional mode, the 秋霜CFG.DAT files created on this build are no longer compatible with official versions of Shuusou Gyoku. They will fail to load there, re-locking the Extra Stage in the process.

This build also features a basic level of locale independence:

  • The game now unconditionally reads from the original Japanese configuration (秋霜CFG.DAT), score (秋霜SC.DAT), and replay (秋霜りぷ*.DAT) filenames. If you previously played the game on a non-Japanese locale, make sure to rename your old files before starting this build the first time.

  • Ending text mojibake is fixed. Originally, the game didn't specify what font to show in the endings, which could result in a different appearance on certain systems. This build chooses the font that would appear on a clean Windows installation.

  • The game's window title now correctly shows up as 秋霜玉 as well.

The additional unique issues compared to the original binary still remain:

  • The original screenshot feature is still missing, as it also wasn't part of pbg's released source code.
  • If you're wondering why your antivirus is freaking out: I explained the reasons in this issue, with some more background here.

Summary blog post: https://rec98.nmlgc.net/blog/2022-12-31
Full changelog compared to the previous release: M0002...P0226
Previous release: https://github.com/nmlgc/ssg/releases/tag/M0002

M0002

01 Nov 21:11
Compare
Choose a tag to compare

A minor performance increase compared to the last build: The compressed data of the three main packfiles (ENEMY.DAT, GRAPH.DAT, and MUSIC.DAT) is now only loaded once into memory and then kept there for the runtime of the game process. Previously, the P0217 build fully loaded each corresponding packfile whenever the game requested any single of its contained files. I don't know how slow your system would have to be for that optimization to be noticeable, but it was something that stuck out about my original packfile implementation.
While this does prevent hot reloading for traditional packfile mods, I have other plans for a safer and more controlled modding system. Treating the original packfiles as immutable blobs removes the redundancy of keeping modified files in both uncompressed and compressed formats during mod development, and makes it easier to redistribute mods while complying with the copyright on the original packfiles.

No additional features or bug fixes otherwise, just some internal code cleanup and initial portability preparations, balancing out the overtime that went into P0217 in at least somewhat of a productive way.

Full changelog compared to the previous release: P0217...M0002

Previous release: https://github.com/nmlgc/ssg/releases/tag/P0217

P0217

04 Sep 15:38
Compare
Choose a tag to compare

First build that works as a drop-in replacement for the original 秋霜玉.exe, reading and writing the original data formats. Still a strict downgrade compared to the original binary, as it still has all of its problems:

  • Separate Japanese locale emulation is still needed to correctly refer to the original names of the configuration (秋霜CFG.DAT), score (秋霜SC.DAT), and replay (秋霜りぷ*.DAT) files. It's also required for the ending text to not render as mojibake.
  • Running the game at full speed and without graphical glitches on modern Windows still requires a separate DirectDraw patch such as DDrawCompat. To eliminate any remaining flickering, configure the game to use 16-bit graphics in the Config → Graphic menu.

As well as some of its own:

  • The original screenshot feature is still missing, as it also wasn't part of pbg's released source code.
  • If you're wondering why your antivirus is freaking out: I explained the reasons in this issue, with some more background here.

So it's more of a symbolic release, signifying that we can now start doing actual work on this game.

Summary blog post: https://rec98.nmlgc.net/blog/2022-09-04

Full changelog: pbg...P0217