don't click here

Sonic 1, 2, and CD Remake Decompilation

Discussion in 'Engineering & Reverse Engineering' started by jubbalub, Jan 18, 2021.

  1. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,626
    206
    43
    SonLVL
    Setting up palette-based graphics and per-pixel scrolling is more complicated with today's graphics cards. Sonic CD ran into the former issue in ports, twice even! The Gems version has clear water and the mobile version uses an overlay instead of changing the palette.
     
  2. Blue Spikeball

    Blue Spikeball

    Member
    1,680
    548
    93
    I've always wondered why Gems didn't just use a transparent mesh as an overlay for the water in Sonic CD. It wouldn't have looked identical to the Sega CD version, but it would have looked closer (and much better) than colorless water.
     
  3. Clownacy

    Clownacy

    Tech Member
    915
    224
    43
    I've released v0.6 of my Sonic Mania Wii U port. As well as fixing the Time Attack/Replay menus and hopefully fixing the game's rampant random crashing issue, this version utilises a new homebrew format (.wuhb) which allows it to be ran directly from the Wii U Menu instead of the Homebrew Launcher. Being ran from the Wii U Menu allows the home button to function properly in-game, opening the home menu instead of just exiting the game without warning. Note that '.wuhb' files require the brand new Aroma homebrew environment.
     
  4. Clownacy

    Clownacy

    Tech Member
    915
    224
    43
    I've updated my Sonic Mania Wii U port: now it should run mostly at full speed.

    Where did this speed boost come from? Two things:

    This port leverages the SDL2 library, and one of its responsibilities is displaying the game's framebuffer on the screen. The framebuffer is in the RGB565 format, but SDL2 didn't support displaying RGB565 on the Wii U, so it was converting it to a different format instead. It did this every frame, using up a lot of the CPU. However, the Wii U actually does support RGB565, so I extended SDL2 to make use of it, and now the conversion is skipped.

    The second improvement has to do with V-sync: whenever SDL2 updates the display, it waits for the start of a new frame. However, if the game had lagged so much that a new frame had already begun, it would wait for the next frame instead. It would basically cause the game to run at 30FPS instead of 60FPS, even if it was only lagging a little. Now, it uses adaptive V-sync, which means that it doesn't bother waiting if it's already missed the start of the frame. This way, if the game is only slightly lagging, then it will run at, say, 55FPS instead of 30FPS.
     
  5. Clownacy

    Clownacy

    Tech Member
    915
    224
    43
    Last edited: Sep 26, 2022 at 10:09 PM