CSE2 - The Cave Story decompilation project

Feb 16, 2019 at 5:29 PM
Senior Member
CSE Discord Admin
"Fly, Fly, Fly!"
Join Date: Jan 13, 2016
Location:
Posts: 132
Speaking of inaccuracy, I guess I should announce the enhanced branch of CSE2. Right now it contains:
  • PNG support
  • Alpha blending support
  • Booster's Lab support (stage.tbl)
  • 60FPS
  • Widescreen
  • Vastly-improved fullscreen
  • Automatic vsync (only enables on 60hz monitors)
  • All resource files moved to the data folder (doesn't include PXTs right now since they're C structs, not files)
Builds can be downloaded here, source can be found in the enhanced branch of mine and Cucky's repos.
 
Last edited:
Feb 17, 2019 at 1:28 AM
Indie game enthusiast
"What is a man!? A miserable pile of secrets! But enough talk, have at you!"
Join Date: Apr 18, 2006
Location: Forever wandering the tower...!
Posts: 1787
Oh my. PNG support :heart:
At this rate, I won't suffer a 3 GB folder for Cave Story anymore D: (That 4k BMP mod I am toying with.)
So, I'm still working towards a demo for that mod. Probably won't touch CSE2 enhanced code until that's demo ready, assuming CS2E be able to handle the 4k. Since the dll loader + N.I.C.E. ran smoothly at the original 4:3 ratio.

I'll just make a list here for what I'll need to look into for the meantime, in case you are curious:

-Accepting at least up to 4k graphics. Being able to scale down to your current resolution would be excellent... (4k, that would be 10x the original size I suppose?)
; This controls the size of the game window in windowed mode.
; At 4:3, 1 is 320x240, 2 is 640x480, 3 is 960x720, etc.
; This improves font smoothness in fullscreen, and enables higher resolution
; output when combined with remove_sprite_alignment and a high sprite_resolution
window_upscale = 10

; This controls the resolution of the game's sprites.
; 1 is normal, 2 doubles the resolution, 3 triples it, etc.
; For reference, normal Cave Story is 1, Cave Story+'s "New" graphics are 2.
sprite_resolution = 10
-A TSC command that displays an image that will stay until cleared or replaced. (Being able to specify the location would be a boon, probably per passing preset parameters or percentages perhaps?)
-ogg / flac music (flac would be nice to have again, but most probably aren't using 96khz for Cave Story; then again, the same could be said with how many are currently using 4k...)
-calling multiple ogg SFX through TSC (I'm currently using N.I.C.E. with its <VOC commands for SFX or voices)
Code:
tscTable["VOC"]=function (paramIterator)
    local subCommand = paramIterator()
    if subCommand=="file?" then
        local f = io.open(paramIterator(), "rb")
        if f == nil then
            return tonumber(paramIterator())
        end
        f:close()
        return
    end
    if subCommand=="load" then
        local name=paramIterator()
        vocBuffers[name]=dsound.loadSound(paramIterator())
        return
    end
    if subCommand=="play" then
        local buf=vocBuffers[paramIterator()]
        if buf~=nil then dsound.playSound(buf) end
        return
    end
    if subCommand=="playloop" then
        local buf=vocBuffers[paramIterator()]
        if buf~=nil then dsound.playSound(buf,true) end
        return
    end
    if subCommand=="stop" then
        local buf=vocBuffers[paramIterator()]
        if buf~=nil then dsound.stopSound(buf) end
        return
    end
    if subCommand=="free" then
        local nam=paramIterator()
        local buf=vocBuffers[nam]
        if buf~=nil then dsound.stopSound(buf) dsound.freeSound(buf) vocBuffers[nam]=nil end
        return
    end
    error("Unknown VOC sub-command: "..subCommand)
end

That's what I'll need to make the switch. I'll see if I can figure things out when the mod content is done, if it doesn't happen to show up in the meanwhile ;)
One problem at a time!

Oh and I'm dying to see if I can get a TSC smooth zoom working eventually. With higher res, it could be interesting in cutscenes or smaller areas...
Anyway, fantastic, fantastic, fantastic!
 
Mar 8, 2019 at 10:08 PM
Senior Member
CSE Discord Admin
"Fly, Fly, Fly!"
Join Date: Jan 13, 2016
Location:
Posts: 132
Here's v1.1 of the Enhanced branch.

Changes include improved font rendering and removal of the arbitrary sprite alignment.

The font improvement fixes the ugly outlines you'd see around text in the original game and the main version of CSE2:

Original:
p368707-0-unknown.png


Enhanced:
p368707-1-unknown.png
 
Mar 9, 2019 at 12:16 AM
War criminal
"Life begins and ends with Nu."
Join Date: Jun 27, 2013
Location: Phoenix
Posts: 2758
Age: 29
Damn, that's a hot improvement on the font! I'm very glad with that decision :D
 
Mar 9, 2019 at 6:53 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: 26
Ladies and Gentlemen, the future of modding is now at our front doorstep.
 
Last edited:
Mar 10, 2019 at 5:02 PM
beep boop
Bobomb says: "I need a hug!"
Join Date: Aug 16, 2014
Location: no
Posts: 845
Age: 22
I've been making a mod with this for a little while. I have to say, it's great to use. Porting my version of <BKG was a breeze, and making changes is pretty easy.
 
Apr 6, 2019 at 3:06 PM
Bonds that separate us
Forum Administrator
"Life begins and ends with Nu."
Join Date: Aug 20, 2006
Location:
Posts: 2846
Age: 33
Ahrumbl. There's something that's just occurred to me that would further unsettle matters, what with this being a github project. I've noticed that for a lot of other game decomp/recomps, modders will just start publicly copying the base repo to work on and soon there'll be endless clones of mostly the same tenuously-legal code lying around indefinitely. I am really, really not a fan of the general wastefulness of this sort of attitude and I'd very much prefer if we could preemptively try and focus on avoiding it. I'm sure we can find workarounds for any inconvenience it might cause users without any great difficulty.
 
Apr 6, 2019 at 10:32 PM
Junior Member
"Fresh from the Bakery"
Join Date: May 7, 2018
Location:
Posts: 17
Ahrumbl. There's something that's just occurred to me that would further unsettle matters, what with this being a github project. I've noticed that for a lot of other game decomp/recomps, modders will just start publicly copying the base repo to work on and soon there'll be endless clones of mostly the same tenuously-legal code lying around indefinitely. I am really, really not a fan of the general wastefulness of this sort of attitude and I'd very much prefer if we could preemptively try and focus on avoiding it. I'm sure we can find workarounds for any inconvenience it might cause users without any great difficulty.
what the hell does this mean
 
Apr 7, 2019 at 12:27 AM
Senior Member
"Fly, Fly, Fly!"
Join Date: Feb 4, 2015
Location: Nibel
Posts: 136
Age: 18
what the hell does this mean
it basically means a bunch of people can use the github source stuff and create a bunch of mods of it, which means there's a bunch of the same code lying around on github and it might cause people trying to find the original difficulty.
That's what I understood from the paragraph anyway.
 
Apr 7, 2019 at 1:00 AM
Bonds that separate us
Forum Administrator
"Life begins and ends with Nu."
Join Date: Aug 20, 2006
Location:
Posts: 2846
Age: 33
No, I'm saying I don't like the idea of people publicly copying/forking the code base every time they start a new mod using it
 
Apr 7, 2019 at 1:42 AM
Junior Member
CSE Discord Admin
"Fresh from the Bakery"
Join Date: Dec 6, 2015
Location: Behind You
Posts: 19
Age: 23
What's wrong with that? Though if you really dislike it someone could make a modding api or something so there's no need to mod the source or something.
 
Apr 7, 2019 at 5:09 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: 26
aka please use git clone, compile, and upload your mods the same way you always have at pixeltellsthetruth.solutions
 
Apr 7, 2019 at 1:01 PM
Senior Member
CSE Discord Admin
"Fly, Fly, Fly!"
Join Date: Jan 13, 2016
Location:
Posts: 132
I still don't see what the problem is. Even if there was an issue with having forks lying around, you don't have to fork the repo to use it.
 
May 10, 2019 at 3:01 PM
Senior Member
CSE Discord Admin
"Fly, Fly, Fly!"
Join Date: Jan 13, 2016
Location:
Posts: 132
Here's v1.1 of regular CSE2. The EXEs are 32-bit, and should be compatible with Windows XP.

The code's about as accurate as I can get it before restoring the original DirectSound/DirectDraw/WinAPI code. A lot of subtle behaviour inaccuracies have been weeded out along the way. CSE2 also now comes with its own DoConfig clone.

For developers, there's been a pretty big change since v1.0: the project now uses CMake, allowing it to be compiled by more than just GCC/MinGW. Notably, it can be built with MSVC, for you Visual Studio fans out there. In fact, I actually recommend using Visual Studio if you're a novice, since you avoid the learning curve of MSYS2's package manager.

...Yeah, if you're clued-in on this kind of stuff, CSE2 doesn't even need you to install packages for its dependencies anymore. Don't get me wrong, it's preferred, but it's not required. The repo comes with a copy of each dependency's source code, and if CMake detects that a dependency is not installed, it will just compile it into the executable itself.
 
Last edited:
May 10, 2019 at 6:18 PM
Stoned Member
"All your forum are belong to us!"
Join Date: Sep 22, 2012
Location: Hell
Posts: 557
1.1's lookin' rad.

The more accessible this becomes to everyone, the more likely it will be able to replace the base game as the version of choice in terms of what people want to modify.
Now the next step is making it easy to modify for people that just like looking in the code and changing numbers, that'd really mainly involve just labeling everything and commenting on exactly what it does. For all I know you guys have already done that, I haven't exactly checked the code myself recently.
 
May 11, 2019 at 4:12 AM
Senior Member
"Fly, Fly, Fly!"
Join Date: Nov 3, 2015
Location: Westminster, Colorado, U.S.A
Posts: 128
Here's v1.1 of regular CSE2. The EXEs are 32-bit, and should be compatible with Windows XP.

The code's about as accurate as I can get it before restoring the original DirectSound/DirectDraw/WinAPI code. A lot of subtle behaviour inaccuracies have been weeded out along the way. CSE2 also now comes with its own DoConfig clone.

For developers, there's been a pretty big change since v1.0: the project now uses CMake, allowing it to be compiled by more than just GCC/MinGW. Notably, it can be built with MSVC, for you Visual Studio fans out there. In fact, I actually recommend using Visual Studio if you're a novice, since you avoid the learning curve of MSYS2's package manager.

...Yeah, if you're clued-in on this kind of stuff, CSE2 doesn't even need you to install packages for its dependencies anymore. Don't get me wrong, it's preferred, but it's not required. The repo comes with a copy of each dependency's source code, and if CMake detects that a dependency is not installed, it will just compile it into the executable itself.

Oof. Seems like I was a little too late to avoid that nightmare...
 
May 13, 2019 at 11:00 PM
Neophyte Member
"Fresh from the Bakery"
Join Date: Jan 18, 2016
Location:
Posts: 4
This feels almost as big for the fangaming/modding scene as Geobox would have been if it had ever released. This is like when the Sonic 1 github decompile was started. This is huge.
 
May 16, 2019 at 6:24 AM
War criminal
"Life begins and ends with Nu."
Join Date: Jun 27, 2013
Location: Phoenix
Posts: 2758
Age: 29
I'm not supposed to have an opinion, but considering 90% of the community still only knows how to use TSC and the only way they'd ever touch ASM is through the Hackinator in Booster's Lab, let alone the amount of people who can code in C (which may be about the same as the amount of people who knows how to use ASM), I doubt there'd ever be a risk of modding the old fashioned way getting ruined. Will CSE2 ever become the preferred method? Maybe, but I doubt there will be a strict precaution against modding the original Cave Story files.

Hell, at the moment there are only like, two CSE2 mods that are barely in their beginning phases, so it's best to let time tell.
 
Top