DLL Mod Loader + Extra music formats mod

Apr 10, 2017 at 10:21 PM
Senior Member
CSE Discord Admin
"Fly, Fly, Fly!"
Join Date: Jan 13, 2016
Location:
Posts: 132
Well, it's been a while. I figure I shouldn't keep things waiting, and just release what I've got so far. It doesn't matter how polished I make this if it never gets released anyway.

So, now, I've added a user-defined playlist system: no more sticking to the Wii/3D file naming schemes, or needing to select a different DLL for different features - you decide these for yourself!

Example playlist.txt based on Cave Story 3D's layout:
Code:
data/Ogg11/WANPAKU, loop, split
data/Ogg11/ANZEN, loop, split
data/Ogg11/GAMEOVER, split
data/Ogg11/GRAVITY, loop, split
data/Ogg11/WEED, loop, split
data/Ogg11/MDOWN2, loop, split
data/Ogg11/FIREEYE, loop, split
data/Ogg11/VIVI, loop, split
data/Ogg11/MURA, loop, split
data/Ogg11/FANFALE1, split
data/Ogg11/GINSUKE, loop, split
data/Ogg11/CEMETERY, loop, split
data/Ogg11/PLANT, loop, split
data/Ogg11/KODOU, loop, split
data/Ogg11/FANFALE3, split
data/Ogg11/FANFALE2, split
data/Ogg11/DR, loop, split
data/Ogg11/ESCAPE, loop, split
data/Ogg11/JENKA, loop, split
data/Ogg11/MAZE, loop, split
data/Ogg11/ACCESS, loop, split
data/Ogg11/IRONH, loop, split
data/Ogg11/GRAND, loop, split
data/Ogg11/Curly, loop, split
data/Ogg11/OSIDE, loop, split
data/Ogg11/REQUIEM, loop, split
data/Ogg11/WANPAK2, loop, split
data/Ogg11/QUIET, loop, split
data/Ogg11/LASTCAVE, loop, split
data/Ogg11/BALCONY, loop, split
data/Ogg11/LASTBTL, loop
data/Ogg11/LASTBT3, loop, split
data/Ogg11/ENDING, loop, split
data/Ogg11/ZONBIE, loop, split
data/Ogg11/BDOWN, loop, split
data/Ogg11/HELL, loop, split
data/Ogg11/JENKA2, loop, split
data/Ogg11/MARINE, loop, split
data/Ogg11/BALLOS, loop, split
data/Ogg11/TOROKO, split
data/Ogg11/WHITE, loop, split

You might be wondering where this file goes. Well, each mod in the mods folder now gets its own folder! Inside, it can store its DLL and a settings.txt file (in this case used to select the appropriate playlist file). In the future, this folder will be where you store your Ogg files, also, but that's currently not complete, hence the above filepaths being relative to the Doukutsu.exe as opposed to the mod's folder.

The mod loader itself also has preliminary support for file redirection. Right now, this only affects org files, but I hope to expand it to every other type of file in the game soon. Inside your mod's folder, create a 'data' folder, with an 'Org' folder inside it. In there, you can insert replacement Org files, and the game will play those instead of the ones embedded in the EXE (of course, this won't work if you're also using the Ogg music mod).

The mod loader's seen quite a bit of tweaking since the last release, so you'll have to follow the installation instructions again on a clean EXE. Notably, the mod_loader.dll has been moved to the mods folder.

In addition, there are a couple of new mods:
  1. Graphics enhancement pack - read about it here
  2. disable_image_protection - installing the mod loader no longer does this automatically, so a separate mod is needed
  3. 3ds_hud - I noticed the 3DS eShop port has a different HUD, one that tries to take up less of the screen, so this mod tries replicating it
Also, the SDL controller mod has been improved:
  1. The left analogue stick now controls the character
  2. The triggers now alternate weapons
  3. A system's been added to prevent inputs from cancelling each other out (such as the D-Pad and Analogue Stick)
 
Apr 30, 2017 at 7:14 PM
World's #1 Laharl Kinnie
"All your forum are belong to us!"
Join Date: Sep 22, 2012
Location: Hell
Posts: 611
Pronouns: She/It
I was a bit surprised I didn't notice this post earlier, though, I can't really figure out how to make this work.

I opened up Doukutsu.exe in HxD (Hex editor) and changed the values as specified, though, whenever I try to launch, it simply goes to the vanilla game instead of launching with the mods that I selected (60fps, disable image protection, graphics enhancement, and ogg music) and my mods.txt seems to have no errors in it:
Code:
60fps
disable_image_protection
graphics_enhancement
ogg_music
The folder structure is like this
p358391-0-5mvkw2r.png

Mods folder is in the same directory as executable, inside folder is mods.txt, dll, and mods. In the Data folder is the wiiware soundtrack.
The parts that were edited in the executable look like this
p358391-1-w8jcwjx.png




p358391-2-okt4zcu.png
I'd appreciate if somebody could tell me where I went wrong, as I know my mistake was in the EXE itself, I'm pretty illiterate when it comes to hex editing, and I haven't touched Cave Story in quite a while due to how busy I've been with my own projects. A pre-patched EXE would be nice, though, I could understand why one wouldn't be made in an attempt to detour people looking to do illegal things with the 2x graphics and commercial soundtracks. Though, people are out there that simply wanna use it for personal use.
 
Apr 30, 2017 at 8:03 PM
World's #1 Laharl Kinnie
"All your forum are belong to us!"
Join Date: Sep 22, 2012
Location: Hell
Posts: 611
Pronouns: She/It
Try applying it with BL, worked for me.
I tried with booster's lab
Code:
0x12429
E8 E2 E7 FF FF
and
Code:
0x10C10
55 8B EC 68 3B 0C 41 00 FF 15 AC C0 48 00 85 C0 74 12 68 4B 0C 41 00 50 FF 15 34 C1 48 00 85 C0 74 02 FF D0 A1 20 8B 49 00 5D C3 6D 6F 64 73 2F 6D 6F 64 5F 6C 6F 61 64 65 72 00 69 6E 69 74 00 CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC
with the patch tool.

Needless to say it still left me with vanilla, I don't know how to use the patch tool despite the guide it supplies me with :toroko2:
 
May 1, 2017 at 11:56 AM
Sincerity will always triumph over irony.
Modding Community Discord Admin
"What're YOU lookin' at?"
Join Date: Apr 23, 2013
Location: In a cave above the surface.
Posts: 1079
Age: 26
Pronouns: He/Him
I tried with booster's lab
Code:
0x12429
E8 E2 E7 FF FF
and
Code:
0x10C10
55 8B EC 68 3B 0C 41 00 FF 15 AC C0 48 00 85 C0 74 12 68 4B 0C 41 00 50 FF 15 34 C1 48 00 85 C0 74 02 FF D0 A1 20 8B 49 00 5D C3 6D 6F 64 73 2F 6D 6F 64 5F 6C 6F 61 64 65 72 00 69 6E 69 74 00 CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC
with the patch tool.

Needless to say it still left me with vanilla, I don't know how to use the patch tool despite the guide it supplies me with :toroko2:
Hey this probably doesn't apply but I had trouble getting the .dll to find files because the full filepath leading up to where I stored my cave story stuff had unusual characters like ' ; ' in it, so on the off-chance that this is the same deal, just double check that your filepath is letters and numbers.
 
May 1, 2017 at 2:17 PM
Senior Member
CSE Discord Admin
"Fly, Fly, Fly!"
Join Date: Jan 13, 2016
Location:
Posts: 132
The parts that were edited in the executable look like this
p358391-1-w8jcwjx.png




p358391-2-okt4zcu.png

Open Doukutsu.exe in a hex editor (and make sure the EXE is not marked as read-only), and navigate to address 0x12429. There, replace the first 5 bytes with this:
Code:
E8 E2 E7 FF FF
Next, go to 0x10C10, and replace the next 0x90 bytes with this:
Code:
55 8B EC 68 3B 0C 41 00 FF 15 AC C0 48 00 85 C0 74 12 68 4B 0C 41 00 50 FF 15 34 C1 48 00 85 C0 74 02 FF D0 A1 20 8B 49 00 5D C3 6D 6F 64 73 2F 6D 6F 64 5F 6C 6F 61 64 65 72 00 69 6E 69 74 00 CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC
And you're done! Be sure to configure your mods.txt!

The guide says '0x12429', but you overwrote the data at 0x308D because your hex editor thought the number was decimal.

A pre-patched EXE would be nice, though, I could understand why one wouldn't be made in an attempt to detour people looking to do illegal things with the 2x graphics and commercial soundtracks. Though, people are out there that simply wanna use it for personal use.

That's not my reason at all. I have no interest in preventing people from using this on the basis that they might abuse it. If I was that concerned, I would've just not released it in the first place.

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.

I've been thinking of making an automated patcher, that you just drag-and-drop the EXE on, but I'm busy with other things, right now.
 
May 6, 2017 at 2:48 PM
Senior Member
CSE Discord Admin
"Fly, Fly, Fly!"
Join Date: Jan 13, 2016
Location:
Posts: 132
So much for being busy. A few glaring bugs came to my attention, so I figured I had to get those out of the way.

So here's v1.2.1.1:
  • Improved debug/error logging for more detailed reports
  • Fixed mod loader DLL failing to load when file-path contains a semicolon (WTF Windows?)
  • Fixed Ogg mod causing a crash when <RMU is used to restore an Org song
  • Added automated EXE patcher, for easier installation
  • Disabled Org redirection for now, so the Ogg music in the NICE demo works
  • Fixed bug with settings parser that could cause crashes
The EXE patcher just requires you drag-and-drop an EXE onto it, and it'll spit out a patched file with the name 'Doukutsu_mod_loader.exe'. It performs some tests to check if the file is already patched, or if it's been modified in a way that may make it incompatible.
 
Last edited:
May 12, 2017 at 8:38 PM
Junior Member
"Wow! The more I drink of this magical beverage, the more games I can play! Wheee!"
Join Date: Apr 17, 2017
Location:
Posts: 28
Hi Clownacy,

After some experimentation with Booster's Lab and applying TSC+, I found that the .ogg mod does not function anymore once <CMU in the script elicits.
I figured that a possible workaround would be to make this .ogg mod use a custom TSC command, but I'm not quite sure how much work would be needed to put into that.

Any insight on that?

Thanks

Jables


EXAMPLE FILE

https://www.dropbox.com/s/bnjknx2ketr5h8s/CaveStory - Example.zip?dl=0
 
Last edited:
May 14, 2017 at 6:00 PM
Junior Member
CSE Discord Admin
"Fresh from the Bakery"
Join Date: Dec 6, 2015
Location: Behind You
Posts: 19
Age: 23
Pronouns: he/him
How
Hi Clownacy,

After some experimentation with Booster's Lab and applying TSC+, I found that the .ogg mod does not function anymore once <CMU in the script elicits.
I figured that a possible workaround would be to make this .ogg mod use a custom TSC command, but I'm not quite sure how much work would be needed to put into that.

Any insight on that?

Thanks

Jables


EXAMPLE FILE

https://www.dropbox.com/s/bnjknx2ketr5h8s/CaveStory - Example.zip?dl=0

How about a modified <CMU where if you put a 1 in front like how <GIT1002 shows an item but <GIT0002 shows a weapon, only the 1 denotes playing an ogg file.
 
May 14, 2017 at 7:33 PM
Senior Member
CSE Discord Admin
"Fly, Fly, Fly!"
Join Date: Jan 13, 2016
Location:
Posts: 132
Wait, why is this necessary, again? There's already a fallback that allows Org files to still be played: you just pad out the song's line in the playlist.txt with a path that doesn't actually point to anything. It's not ideal, and in hindsight I should have just included an 'ignore this and play the Org instead' flag, but it's there. Forcing everything into a custom TSC command would only serve to break drop-in compatibility with vanilla Cave Story.

Honestly, is it that surprising that two EXE hacks are conflicting with each other? If they both edit TSC code, then trying to tack on an entirely-new TSC command would only make it worse. Better to just find what part of the EXE they're both trying to edit, and get them to stop squabbling over it.
 
May 14, 2017 at 8:21 PM
Sincerity will always triumph over irony.
Modding Community Discord Admin
"What're YOU lookin' at?"
Join Date: Apr 23, 2013
Location: In a cave above the surface.
Posts: 1079
Age: 26
Pronouns: He/Him
No, we want a way to play Ogg files as sound effects and the likes. Right now <CMU can only play one file at a time.
But then you lose looping, RMU and FMU. Better to add functionality rather than to subtract.

Straight up this is likely never gonna work with TSC+ outside a rewrite of the system, and thats asking for a lot considering how much clunacy has already done to make all of this.

EDIT: also you can only play one sound effect at a time too unless you set the channels to be more differentiated, which is another thing all together.
 
Last edited:
May 15, 2017 at 12:07 AM
Junior Member
"Wow! The more I drink of this magical beverage, the more games I can play! Wheee!"
Join Date: Apr 17, 2017
Location:
Posts: 28
Wait, why is this necessary, again? There's already a fallback that allows Org files to still be played: you just pad out the song's line in the playlist.txt with a path that doesn't actually point to anything. It's not ideal, and in hindsight I should have just included an 'ignore this and play the Org instead' flag, but it's there. Forcing everything into a custom TSC command would only serve to break drop-in compatibility with vanilla Cave Story.

Honestly, is it that surprising that two EXE hacks are conflicting with each other? If they both edit TSC code, then trying to tack on an entirely-new TSC command would only make it worse. Better to just find what part of the EXE they're both trying to edit, and get them to stop squabbling over it.

If it is a major issue and too much of a hassle, I won't pry. I'm not extremely knowledgeable about the difficulty curves in making adjustments to compliment another .exe hack like TSC+, I just wanted to know if it was possible to allow them to work together hand in hand. More possibilities, better value.. so to speak. Thanks for the response.
 
May 21, 2017 at 3:31 AM
The TideWalker
Modding Community Discord Founder
"That dog!"
Join Date: Apr 5, 2013
Location: In my mind and of my body.
Posts: 1640
Age: 27
Pronouns: he/him
I can't seem to get this to run in ollydbg for the life of me...

Capture_zpsj06g5rar.png


This keeps happening and idk what to do about it. (and yes I do have ignore memory access violations in kernel32 enabled)
 
May 22, 2017 at 6:19 PM
Senior Member
CSE Discord Admin
"Fly, Fly, Fly!"
Join Date: Jan 13, 2016
Location:
Posts: 132
Which version are you using? The only versions I've looked at have the code at a different address.
 
Jun 27, 2017 at 12:31 PM
Junior Member
"Fresh from the Bakery"
Join Date: Dec 7, 2014
Location:
Posts: 10
Pronouns: he/him
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...
 
Last edited:
Back
Top