DLL Mod Loader + Extra music formats mod

Jun 27, 2017 at 5:09 PM
Senior Member
CSE Discord Admin
"Fly, Fly, Fly!"
Join Date: Jan 13, 2016
Location:
Posts: 132
Why wouldn't you provide a pre-patched launcher for the game?
I tried editing with a random Hex editor I found, but it won't let me paste code unless I buy it...

EDIT. I extracted the zip in the wrong way and didn't see the patcher...

Looks like I forgot to update the installation instructions to mention the patcher. It's fixed now.

Anyway, I've given my reason for not providing a patched EXE before in this thread:
Having installation instructions means the mod loader can be applied to mods, and not just vanilla Cave Story. Not to mention, different versions of vanilla Cave Story have different EXEs (compare the Japanese version to the Aeon Genesis one), so a pre-patched EXE could do more harm than good.
 
Last edited:
Jul 27, 2017 at 12:45 AM
Senior Member
CSE Discord Admin
"Fly, Fly, Fly!"
Join Date: Jan 13, 2016
Location:
Posts: 132
New update (v1.3)

Ogg mod:
  • Fixed TSC+ compatibility (as described in this post)
  • Fixed RMU music resuming
  • Music now goes in the 'ogg_music' folder, instead of the 'data' folder
Mod loader:
  • Killed-off the '_deps' folder. DLLs that a mod depends on now go in that particular mod's folder
  • Added a basic version print to the debug log
  • Added a print-to-console option for the debug log
3DS HUD:
  • Fixed double 290 timers appearing during the post-Hell falling island scene
SDL2 controller input:
  • Added DInput support (hopefully)
This is a big update for the Ogg mod in particular, which basically had to be rewritten: previously, the mod relied on SDL2_mixer for Ogg playback, but that doesn't give you any feasible way of resuming an interrupted song. Instead, I had to switch to using libvorbis (which SDL2_mixer used under-the-hood) manually, and playing the decoded audio using the Cubeb library. Overall, this new system gave me much more low-level control over the audio, making resuming trivial to add.

In addition, music now goes in the ogg_music folder, with the DLL itself. This makes it easier to have multiple soundtracks, custom or otherwise. You can have a single copy of the ogg mod with multiple soundtracks, or you can have multiple copies of the ogg mod, each with their own soundtrack.

The mod loader itself has a new feature: its own 'settings.txt'. Right now, it only has one 'true'/'false' option: 'debug_console'. This makes it open up a console window, along with the main Cave Story window, so you can view the debug log without constantly opening/refreshing the debug.txt file.

The controller mod now loads bindings for a wide assortment of controllers, which should make it compatible with more than just XInput devices. I was unfortunately unable to test it properly, since my PS3 controller would refuse to connect in DInput mode, but adding this feature just required inserting a function call, so it should work.
 
Last edited:
Aug 14, 2017 at 2:08 PM
Senior Member
CSE Discord Admin
"Fly, Fly, Fly!"
Join Date: Jan 13, 2016
Location:
Posts: 132
This isn't a big update. In fact, none of the mods have changed at all. What is different, however, is the installation process:

Initially, you had to hex-edit the EXE manually, then later there was the patcher program that's been the norm for a while, and now, you don't have to touch the EXE at all: just drag a special 'dsound.dll' file into your Cave Story folder, and there you go!

Link here.
 
Last edited:
Aug 22, 2017 at 12:35 PM
ZYZZ Spur is the best gun because its super cool
"All your forum are belong to us!"
Join Date: Jan 15, 2017
Location: Northern Hemisphere
Posts: 564
Age: 16
This is cool
although this doesn't seem to be 100% full screen as the smaller areas still look a little odd, it's a lot better for me
I deleted all the mods except the 3d one (not even sure what that does), the 60 fps (this works AMAZING, game is so smooth and fast) and the widescreen is still MUCH better than the tiny window or all gray
I put this into the mod I was making, is that ok if I give you credit?
I'm not even sure if I'm going to share it so...
 
Aug 22, 2017 at 7:03 PM
Senior Member
CSE Discord Admin
"Fly, Fly, Fly!"
Join Date: Jan 13, 2016
Location:
Posts: 132
Eh, he's got a point. There was no license agreement in the GitHub repo, which means it falls back on All Rights Reserved.

I put this into the mod I was making, is that ok if I give you credit?
I'm not even sure if I'm going to share it so...
A lot of folks here seem to have already taken the liberty of distributing my hacks in their mods anyway, so you might as well join in. I'm honestly not too fussed about credits. If someone wants to see if my stuff's in someone's hack, all they have to do is look for a mods folder.

This is cool
although this doesn't seem to be 100% full screen as the smaller areas still look a little odd, it's a lot better for me
My fullscreen/widescreen currently only affects the game's engine, not levels. The thing you're seeing is that the rooms are physically too small, and the camera shows out-of-bound areas, which can look really strange. To make this look more presentable, there's a 'black_bars' flag in the Graphics Enhancement Pack's settings.txt file, that makes the game draw black bars over the out-of-bound areas. It can be disabled by setting it to false, but some rooms and cutscenes look downright silly (such as a certain ending).

If a mod were built around this hack, it would be '100% full screen'. Heck, someone clever with a level editor could make vanilla Cave Story just that too (well, except Ironhead, anyway). As far as editing the engine goes, however, I've done just about all I can to make small rooms look good.
 
Last edited:
Aug 23, 2017 at 1:25 PM
Senior Member
"Huzzah!"
Join Date: Jul 12, 2017
Location: <3
Posts: 204
Age: 20
Found a bug in ogg music: (requires multi save hack)
If you have a custom title screen ogg, clicking new or load WILL load oggs perfectly, but if you hit ESC during the new file or load file select, it will go back to the new and load screen, but playing the org AND ogg at the same time.
But it's not that big a deal.
 
Aug 23, 2017 at 3:44 PM
Senior Member
CSE Discord Admin
"Fly, Fly, Fly!"
Join Date: Jan 13, 2016
Location:
Posts: 132
Strange, that doesn't happen when I do it. Also, what Org? You say the title screen and save menu both use Oggs, so what Org plays? Anyway, just to double-check, make sure you're using the newest version. According to the code, it already tries to stop any currently-playing Org/Ogg before playing a new one, so the issue really shouldn't be happening.
 
Aug 23, 2017 at 7:25 PM
Senior Member
"Huzzah!"
Join Date: Jul 12, 2017
Location: <3
Posts: 204
Age: 20
I might of meant the update before this one, so I'll check the new version soon.
 
Oct 6, 2017 at 7:25 AM
Senior Member
"Fly, Fly, Fly!"
Join Date: Nov 3, 2015
Location: Westminster, Colorado, U.S.A
Posts: 128
I don't know if it's the mod loader or the mods themselves, but when I try to patch these to my mod I'm working on it does nothing whatsoever. The 'mods' folder is in the same folder as 'data' and the game executable itself, and as far as I know, I didn't do anything wrong. Inside the 'mods' folder I have all of my mods (3ds_hud, 60fps, graphics_enhancement, ikachan_cursor, and wasd_input), and in mods.txt I have 3ds_hud, graphics_enhancement, ikachan_cursor, 60fps and wasd_input activated. There is a file in my mods folder called debug.txt, and I think that might be interfering with the mods. I ripped these from open_cs (sorry) and that may be the problem. Sorry if I sound like an idiot, thanks for your help!
 
Oct 6, 2017 at 4:05 PM
Senior Member
CSE Discord Admin
"Fly, Fly, Fly!"
Join Date: Jan 13, 2016
Location:
Posts: 132
The only thing I can think of is that the files from OpenCS are old, and you followed the most recent installation instructions. They're incompatible. Why are you using the files from a mod anyway?
 
Last edited:
Oct 6, 2017 at 10:55 PM
Senior Member
"Fly, Fly, Fly!"
Join Date: Nov 3, 2015
Location: Westminster, Colorado, U.S.A
Posts: 128
I honestly don't know. I didn't want to go fishing for mods, so I decided to use what I have
 
Mar 7, 2018 at 2:05 AM
Senior Member
CSE Discord Admin
"Fly, Fly, Fly!"
Join Date: Jan 13, 2016
Location:
Posts: 132
Well then. It's been a while.

This update adds a couple of notable features, along with your usual bugfixes:

First up is the addition of Famitracks playlist data to the Ogg mod. If you get your hands on the Switch version's files, you can drop them into the mod and they'll work right away.

Next up is that there's a new setting for the mod loader to create what I call a 'pollution map'. It's really basic, but I'm not sure how else to implement it. What it does is make the game log all the addresses it writes to to a 'pollution.txt' in the mods folder. This is for hack developers, to help them figure out where the mod loader is editing the EXE.

For the audiophiles out there, I've also switched the Ogg mod's fade to work logarithmically, instead of linearly. This should produce smoother fading.

A fairly big change is that I've switched the settings files from my custom txt format to the INI configuration format. The mod loader uses the inih library for this, so it should be pretty stable, unlike my old txt parser. What does this mean for end-users? Well, along with being a standard, well-understood format, it also means I can insert comments into the settings themselves, so it's clear what each one does.

The 60FPS mod has been merged with the Graphics Enhancement Pack. See its thread for more details.

The bootstrapper (dsound.dll) has been vastly improved. Along with just being generally faster, and not invoking undefined behaviour, it no longer causes orgview to crash.

The Graphics Enhancement Pack also got a couple of new features. Again, see its thread for more.

I suppose now's also a good time to introduce 'nightly' builds. Basically, now I upload premade DLLs to GitHub with each commit I make, so you can get the latest versions without waiting for me to test and release them. You can get the latest files here. The DLLs will be in the 'bin' folder.

Link to latest version here.
 
Last edited:
Apr 11, 2018 at 2:28 PM
Junior Member
"It's dangerous to go alone!"
Join Date: Sep 4, 2014
Location: South Korea
Posts: 44
I applied the mode loader to the mode I made, and this happens
full


full


full

start game and crash.....
 
Apr 11, 2018 at 3:42 PM
War criminal
"Life begins and ends with Nu."
Join Date: Jun 27, 2013
Location: Phoenix
Posts: 2763
Age: 29
Yeah, you'll need to reposition the Studio Pixel logo a few tiles to the right in the background file to make it look more center.

As for the crash, I can really think of the <IMG hack being the reason for it, if it's in your mod, of course.
 
Apr 11, 2018 at 4:44 PM
Senior Member
CSE Discord Admin
"Fly, Fly, Fly!"
Join Date: Jan 13, 2016
Location:
Posts: 132
The <IMG thing has been known for almost a year.

Anyway my "mode" loader has plenty of settings. You can disable each part of the graphics_enhancement mod to see which one's conflicting with your other EXE edits.
 
Last edited:
Jul 20, 2018 at 12:58 AM
Senior Member
CSE Discord Admin
"Fly, Fly, Fly!"
Join Date: Jan 13, 2016
Location:
Posts: 132
Alrighty, update time.

1.5
For the Ogg music mod, we have...

  • Restored Windows XP compatibility
  • Added support for FLAC
  • Added support for XM, IT, MOD, and more (most of what OpenMPT supports)
  • Added predecode setting (decode entire file in memory) to reduce stutter
  • Reduced stutter when new song plays by recycling compatible playback streams
  • Overhauled fading to be smoother
  • Playlist files now specify file extension
  • Added setting to disable the music pausing when the window loses focus
Since it supports more than just Ogg now, the mod's been renamed 'alternate_music'. Getting XP (presumably) working again was done by ditching Cubeb, and using mini_al instead.

By adding libopenmpt, the DLL should now support almost everything listed here, with the exception of any formats that use MP3-encoded samples. Honestly, I find this a little overkill. I only really wanted to support the more major formats like XM and IT, but until I can be sure certain compatibility requirements are met, I'm sticking with something I know will work for now.

Anyway, the new 'predecode' setting is for anyone that's really bothered by any stuttering this mod may introduce when loading a song. In this case, the game will decode every Ogg/FLAC file to raw PCM in memory right when the game starts (causing a pretty massive startup delay, mind you), reducing song playing to nothing more than a few switched pointers, and some memcpys. Likewise, 'stream recycling' reduces overhead further by not destroying and creating the output stream whenever a song starts, so long as the new song has the same channel count, sample rate, and sample format as the previous song.

Besides all this Ogg music stuff, I've added a new mod for giving the title screen a background:

p357265-1-unknown.png


Very original, I know. I mainly just did it to see how hard it would be, and was surprised to see it only took a few lines of code. The mod's settings file can be used to control the choice of bitmap, and background type:
Code:
; This is the filename of the bitmap to use. Typical options are
; bkBlue, bkFog, bkGard, bkGray, bkGreen, bkMaze, bkMoon, bkRed
filename = bkMoon

; This defines what type of background this is.
; 0 - Tiled, static
; 1 - Tiled, moving
; 2 - Scrolling clouds - bkMoon-style
; 3 - Scrolling clouds - bkFog-style
type = 2

The difference between type 2 & 3 only matters with my widescreen mod, since I have to account for the location of the sun/moon.

Graphics Enhancement Pack update info here.

Download link here.
 
Last edited:
Jul 20, 2018 at 1:45 AM
ZYZZ Spur is the best gun because its super cool
"All your forum are belong to us!"
Join Date: Jan 15, 2017
Location: Northern Hemisphere
Posts: 564
Age: 16
Alrighty, update time.

1.5
For the Ogg music mod, we have...

  • Restored Windows XP compatibility
  • Added support for FLAC
  • Added support for XM, IT, MOD, and more (most of what OpenMPT supports)
  • Added predecode setting (decode entire file in memory) to reduce stutter
  • Reduced stutter when new song plays by recycling compatible playback streams
  • Overhauled fading to be smoother
  • Playlist files now specify file extension
  • Added setting to disable the music pausing when the window loses focus
Since it supports more than just Ogg now, the mod's been renamed 'alternate_music'. Getting XP (presumably) working again was done by ditching Cubeb, and using mini_al instead.

By adding libopenmpt, the DLL should now support almost everything listed here, with the exception of any formats that use MP3-encoded samples. Honestly, I find this a little overkill. I only really wanted to support the more major formats like XM and IT, but until I can be sure certain compatibility requirements are met, I'm sticking with something I _know_ will work for now.

Anyway, the new 'predecode' setting is for anyone that's really bothered by any stuttering this mod may introduce when loading a song. In this case, the game will decode every Ogg/FLAC file to raw PCM in memory right when the game starts (causing a pretty massive startup delay, mind you), reducing song playing to nothing more than a few switched pointers, and some memcpys. Likewise, 'stream recycling' reduces overhead further by not destroying and creating the output stream whenever a song starts, so long as the new song has the same channel count, sample rate, and sample format as the previous song.

Besides all this Ogg music stuff, I've added a new mod for giving the title screen a background:
p357265-1-unknown.png


Very original, I know. I mainly just did it to see how hard it would be, and was surprised to see it only took a few lines of code. The mod's settings file can be used to control the choice of bitmap, and background type:
Code:
; This is the filename of the bitmap to use. Typical options are
; bkBlue, bkFog, bkGard, bkGray, bkGreen, bkMaze, bkMoon, bkRed
filename = bkMoon

; This defines what type of background this is.
; 0 - Tiled, static
; 1 - Tiled, moving
; 2 - Scrolling clouds - bkMoon-style
; 3 - Scrolling clouds - bkFog-style
type = 2

The difference between type 2 & 3 only matters with my widescreen mod, since I have to account for the locations of the sun and moon in each one.

Graphics DLL update info here

Download link here
woah that backgruond thing is actually really cool
do the clouds actually scroll or are they stationary?
 
Jul 20, 2018 at 2:00 AM
Senior Member
CSE Discord Admin
"Fly, Fly, Fly!"
Join Date: Jan 13, 2016
Location:
Posts: 132
They scroll.
 
Jul 20, 2018 at 2:23 AM
Senior Member
"Fly, Fly, Fly!"
Join Date: Nov 3, 2015
Location: Westminster, Colorado, U.S.A
Posts: 128
Yeah that's what this is for
; This defines what type of background this is. ; 0 - Tiled, static ; 1 - Tiled, moving ; 2 - Scrolling clouds - bkMoon-style ; 3 - Scrolling clouds - bkFog-style type = 2
 
Top