A fork of CSE2 providing support and optimization for running on a Sun Ultra 1.
Find a file
Gabriel Ravier d6ec92cba5 Attempt 2 at making warnings work
Signed-off-by: Gabriel Ravier <gabravier@gmail.com>
2019-10-27 21:02:59 +01:00
assets Add a FOSS Japanese font 2019-09-27 11:18:26 +00:00
bin2h Attempt 2 at making warnings work 2019-10-27 21:02:59 +01:00
DoConfig Merge pull request #53 from GabrielRavier/betterCMakeMessages 2019-09-11 18:03:37 +01:00
external Revert "Remove the 'external' folder" 2019-09-05 12:50:21 +00:00
src Handle Backend_Init failing 2019-10-27 01:57:09 +00:00
.gitattributes Added .gitattributes for normalisation and normalized a few sources files to LF (from CRLF) 2019-05-03 12:27:11 +02:00
.gitignore Merge branch 'accurate' into portable 2019-09-10 12:35:31 +00:00
CMakeLists.txt Attempt 2 at making warnings work 2019-10-27 21:02:59 +01:00
Makefile First attempt at making warnings work 2019-10-27 20:42:19 +01:00
README.md First attempt at making warnings work 2019-10-27 20:42:19 +01:00
screenshot.png New screenshot 2019-09-05 20:57:48 +00:00

Table of Contents

This repo has multiple branches:

Branch Description
accurate The main decompilation branch. The code intended to be as close to the original as possible, down to all the bugs and platform-dependencies.
portable This branch ports the engine to SDL2, and addresses numerous portability issues, allowing it to run on other platforms.
enhanced Based on the portable branch, this adds several enhancements to the engine, and makes it more accessible to modders.
emscripten Modifies the engine to build with Emscripten, allowing it to run in web browsers.
wii Ports the engine to the Nintendo Wii.

Cave Story Engine 2 (Portable)

Cave Story Engine 2 is a decompilation of Cave Story.

This branch migrates the engine from WinAPI to SDL2, and addresses numerous portability issues, allowing it to run on other platforms.

Screenshot

Background

In 2007, a Linux port of Cave Story was made by Peter Mackay and Simon Parzer. Details about it can be found in Peter's old blog. This port received an update in 2011, including two shiny new executables. What Peter and Simon didn't realise was that they left huge amounts of debugging information in these executables, including the names of every C++ source file, and the variables and functions they contained.

This was a goldmine of information about not just the game's inner-workings, but its source code. This alone made a decompilation viable, but it wasn't the only help we'd get...

When Pixel made Cave Story, he compiled the original Windows EXE with no optimisations. This left the generated assembly code extremely verbose and easy to read. It also made the code very decompiler-friendly, since the assembly could be mapped directly back to the original C(++) code.

A combination of easy-to-decompile code and a near-complete symbol list made much of the decompilation process a copy/paste job, but not all of the game would need decompiling, as some of Cave Story's source code would actually see the light of day...

In early 2018, the Organya music engine was released on GitHub by an old friend of Pixel's. On top of providing an insight into Pixel's coding style, this helped with figuring out one of the most complex parts of Cave Story's codebase.

It's because of these findings that a decompilation is possible: the Mario 64 decompilation project had a game that was built with no optimisations, the Devilution project was lucky enough to find a symbol list, so it's a miracle that we have both!

Many months of copypasting and tinkering later, here is the result.

Dependencies

Note: with CMake, if these are not found, they will be built locally

  • SDL2
  • Freetype
  • FLTK
  • GLEW (if the OpenGL rendering backend is selected)

Building

CMake

This project primarily uses CMake, allowing it to be built with a range of compilers.

In this folder, create another folder called 'build', then switch to the command-line (Visual Studio users should open the Developer Command Prompt) and cd into it. After that, generate the files for your build system with:

cmake .. -DCMAKE_BUILD_TYPE=Release

You can also add the following flags:

Name Function
-DJAPANESE=ON Enable the Japanese-language build (instead of the unofficial Aeon Genesis English translation)
-DFIX_BUGS=ON Fix various bugs in the game
-DDEBUG_SAVE=ON Re-enable the ability to drag-and-drop save files onto the window
-DFORCE_LOCAL_LIBS=ON Compile the built-in versions of SDL2, FreeType, and FLTK instead of using the system-provided ones
-DWARNINGS=ON Enable common warnings
-DALL_WARNINGS=ON Enable ALL warnings (clang/MSVC-only)
-DFATAL_WARNINGS=ON Make all warnings errors
-DRENDERER=OpenGL3 Use the hardware-accelerated OpenGL 3.2 renderer
-DRENDERER=SDLTexture Use the hardware-accelerated SDL2 Texture API renderer (default)
-DRENDERER=SDLSurface Use the software-rendered SDL2 Surface API renderer
-DRENDERER=Software Use the handwritten software renderer

Then compile CSE2 with this command:

cmake --build . --config Release

If you're a Visual Studio user, you can open the generated CSE2.sln file instead.

Once built, the executables and assets can be found in the newly-generated game folder.

Makefile

Note: this requires pkg-config

Run 'make' in this folder, preferably with some of the following settings:

Name Function
RELEASE=1 Compile a release build (optimised, stripped, etc.)
STATIC=1 Produce a statically-linked executable (good for Windows builds, so you don't need to bundle DLL files)
JAPANESE=1 Enable the Japanese-language build (instead of the unofficial Aeon Genesis English translation)
FIX_BUGS=1 Fix various bugs in the game
WINDOWS=1 Build for Windows
DEBUG_SAVE=1 Re-enable the ability to drag-and-drop save files onto the window
WARNINGS=1 Enable common warnings
ALL_WARNINGS=1 Enable ALL warnings (clang/MSVC only)
FATAL_WARNINGS=1 Make all warnings errors
RENDERER=OpenGL3 Use the hardware-accelerated OpenGL 3.2 renderer
RENDERER=SDLTexture Use the hardware-accelerated SDL2 Texture API renderer (default)
RENDERER=SDLSurface Use the software-rendered SDL2 Surface API renderer
RENDERER=Software Use the hand-written software renderer

Once built, the executables and assets can be found in the newly-generated game folder.

Licensing

Being a decompilation, the majority of the code in this project belongs to Daisuke "Pixel" Amaya - not us. We've yet to agree on a license for our own code.