Sonic R Hacking

Discussion in 'Engineering & Reverse Engineering' started by MainMemory, Dec 1, 2009.

  1. Dark Sonic

    Dark Sonic

    I'll find the old avatar eventually Member
    12,522
    158
    43
    Working on my art!
    So this is probably a real stupid question, but where are the models located exactly?

    Also does anyone know what the name of the font is that's used throughout the menus?
     
  2. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,396
    64
    28
    SonLVL
    Character models are located in "bin\objects", stage models are located in the stage's bin file.
     
  3. It's probably Futura, but they faked the smallcaps instead of using the right version.
     
  4. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,396
    64
    28
    SonLVL
  5. CheatFreak

    CheatFreak

    Everything or Nothing. Member
    58
    2
    6
    Michigan
    BetterSADX Patch
    Along with the work I did on the cheatcodes for MainMemory's Mod Manager,
    I've also updated RemoveStrays and added it to the mods page on my website here.


    [​IMG]
    Changes:
    • Fixed more save menu elements
    • Fixed tons of options menu elements
    • Fixed results screen elements
    • Tried to fix the rotating trophy icon a bit better
    • Fixed the colon bleeding into the number 9 text again.
    • Fixed all the main menu, course, and game selection texts.
    • Tested in many resolutions to ensure that almost all resolutions are considerably better than the last release.
     
  6. InvisibleUp

    InvisibleUp

    friendly internet ghost Member
    134
    10
    18
    [​IMG]

    Took me a while to get situated with how the mod loader worked, but I've made a widescreen hack for the '04 version of Sonic R. It's actually better than the one in Sonic Redux (my contest hack), because the 2004 version has a variable for the screen X scale. This means I can actually make widescreen work when the screen is split horizontally.

    But anyways, download link (with source for Visual Studio 2017) is at https://mega.nz/#!MC...uq2ImvUvW9eK950

    EDIT: Updated DL link, fixed phrasing

    EDIT2: Also uploaded to GameBanana (https://gamebanana.com/guis/33496) because I saw that MainMemory started a Sonic R section.
     
  7. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,396
    64
    28
    SonLVL
    That looks promising, although it seems from your screenshot that certain graphical elements are not properly adjusted. I'd like to see this polished and implemented directly into the mod loader, if that's alright with you.
    [hr]
    In other news, I did a music mod. It replaces all the music with SADX music. You can get it on GameBanana.
     
  8. InvisibleUp

    InvisibleUp

    friendly internet ghost Member
    134
    10
    18
    Alright, wasn't sure if you wanted it in the mod loader or not.

    It's only really broken in 3P/4P mode, because it does some funky stuff with the aspect ratio variable I'm using. I think I know how to fix it, though.

    EDIT: That was a lot easier than I thought it would be. New link: https://mega.nz/#!QX5zSJDb!7Ouz-X2qJpTdwMGsP-wrnTaQVzADjlzmEo_qiI2mpiQ
    I simply changed it so that instead of halving the X stretch variable if it was in 3/4P mode, it halved it if the original value was already halved. Works perfectly now. I might work on adding this to the mod loader itself tomorrow.
     
  9. CheatFreak

    CheatFreak

    Everything or Nothing. Member
    58
    2
    6
    Michigan
    BetterSADX Patch
    I think he's also referring to the UI elements in general being positioned in the center of the screen. Ideally these elements would be moved to the edges of the screen properly instead.

    Also, the change to these appropriate things should scale with the actual resolution, allowing the game to properly render at any aspect ratio ideally, but that's also a bit of work probably.

    Regardless, what impressive work! I can tick this off my Sonic R Wishlist.
     
  10. CheatFreak

    CheatFreak

    Everything or Nothing. Member
    58
    2
    6
    Michigan
    BetterSADX Patch
    This post has been changed significantly since it was originally posted so uh. Redownload junk if you saw it before I changed it.
    Yesterday morning I posted a mod called "ADX Looped Music" which I released not knowing there was an issue with one of the included tracks. In addition I found out from MainMemory on IRC that the Saturn version of Sonic R has longer Instrumental Tracks. I also came to the decision that for a proper ADX Music mod, I shouldn't be editing in my own loops, so I've created 2 mods now instead.

    So first we have the ADX Music mod.
    This contains unedited ADX format encodes of the Sonic R music tracks, which takes advantage of MainMemory's implementation of bass_vgmstream in the Sonic R Mod Loader.
    The main purpose of this is to replace the space inefficient (albeit lossless) *.SON files of the standard 2004 Sonic R port, and simultaneously take advantage of the capability for looping that the ADX format provides.

    Download ADX Music

    In addition, I'm releasing an optional mod that includes edited loops of the main 7 vocal track themes that I made yesterday. They were done by cleanly overlaying the portion of music at the end of the song where it fades out with the first few seconds of music from the start of the song, removing any silence that would ordinarily be there when the music would loop, and setting an appropriate loop point in the song.

    Download ADX Music - Overlapping Fades.

    I'll also post links to these on my website but uh. Not until I feel like updating my site, so it could be a day or two.
     
  11. CheatFreak

    CheatFreak

    Everything or Nothing. Member
    58
    2
    6
    Michigan
    BetterSADX Patch
    So I was saying I was working on a patch for Sonic R 1998 to make it into the 2004 port, and I did it.
    Enjoy that for anyone interested in dabbling in Sonic R mods, this might be of use.

    http://forums.sonicretro.org/index.php?showtopic=37536
     
  12. Strife

    Strife

    Member
    1,928
    23
    18
    United States
    Freedom Planet 2
    I'm wondering if there are a few things in the PC version of the game that can be modded, mostly having to do with restoring elements and settings from the Sega Saturn version.

    - Adjusting the camera's height and angle to roughly the same place that it was on the Saturn.
    Comparison:
    [​IMG]
    Messing around in Cheat Engine I was able to find a 4-byte value at 32D918 that adjusts the zoom level (and setting it to a negative value even acts as a look-behind camera), but no luck finding anything related to the actual position.

    - Fixing/toning down the pitch modulation on Amy's car since it's way off in the PC version. Modifying the sound file's pitch is only a half solution in this regard.

    - Swapping the darker backgrounds of the PC version's menu with the Saturn's brighter ones, or at least altering the palette that the PC's background uses on each screen to approximate it.
     
  13. muteKi

    muteKi

    Fuck it Member
    7,575
    2
    18
    Truly lovely! Now if only there were a known way to get the lighting to resemble the software-rendered mode
     
  14. InvisibleUp

    InvisibleUp

    friendly internet ghost Member
    134
    10
    18
    Finally. Multiplayer was being a bit of a pain.

    [​IMG]

    I've created a pull request for the mod loader, so hopefully that'll be integrated soon.
     
  15. CheatFreak

    CheatFreak

    Everything or Nothing. Member
    58
    2
    6
    Michigan
    BetterSADX Patch
    Neat, feedback time.

    You may need to have a look at how you position the elements on the right side, tried running in an ultrawide resolution, and it works fine for the most part save for the map and timers on the right.

    [​IMG]

    EDIT: Actually it doesn't seem to be working for me in 720p 16:9 either, so something must be up there, I guess.

    Additionally, the "Ready, Set, Go!" elements are still off center in multiplayer mode, even in a really low widescreen resolution where your code works. :V

    [​IMG]

    This is just another passing observation but I think however you calculate a few things must be very slightly off, I wouldn't know how exactly, but- running this code on the game in a 4:3 resolution causes some distinct mispositioning.
    [​IMG]

    Regular Sonic R in 4:3 doesn't show the edges of the background, and everything is squished very slightly to the left.

    Ideally, if your code is running while the game is in 4:3, it should be indistinguishable from when running without your code at all.
    If you do that, even things like the pause menu will be properly positioned in widescreen, I'd imagine, though it definitely helps to check anyway.

    The goal for implementation is for this to always work similar to SADX Mod Loader, this way your widescreen code can always run and everything will just fall into place automatically, that way you don't even need to have a toggle in the GUI for it- it'll just always run because there won't be a reason to have it not run.

    Again, sorry if it seems like I'm nitpicking but I figure this feedback would maybe help this implementation get even better. :P
     
  16. InvisibleUp

    InvisibleUp

    friendly internet ghost Member
    134
    10
    18
    Fixed it all. It turns out the big issue was that I had the wrong value the aspect ratio variable. Really, it's just supposed to be the window height. ...multiplied by 15/16. That fixes all the centering. The 2P not working was due to a comparison error and the right side elements being off was a side effect of me overcompensating for the incorrect aspect ratio.

    The only thing that I know is broken is that the 2P HUD elements don't appear when the aspect ratio is less than 4:3. That has to do with the comparison to determine which side of the screen I'm supposed to render to, and I'm not super sure how to fix that. But I'd imagine if you're playing with an aspect ratio less than 4:3 you'd be playing it with vertical split anyways, so I'm not too concerned.

    ---

    To avoid a double post, here's my quick and dirty plan moving forwards. I want to port Redux (well, Redux's character loader specifically) over to the mod loader, but with a little more polish. (And new models, I guess, because my custom models seemed to be the most criticized part about that hack.) Here's how I want to go about doing that.

    - Create a character exporter for Blender that includes shading and animations. (The OBJ exporter I used didn't, and that's probably the biggest reason the models looked so bad, beyond my lack of 3D modeling skill.)
    - Rewrite all the menus in Sonic R to be handled by a function that loads the menu data from a JSON file (or something like that) and that can be extended by other mods. (Hear me out...)
    - Create a "fastlaunch" console command for Sonic R that I can feed menu options (as defined in those JSON files) and make the game instantly start up in a race or whatever.
    - Make a new screen in the game that ONLY displays a character model, and add it to the menu. (This should be really simple, as it's just one function call to display the model.)
    - Actually port the character loader itself (including changing the fixed-size array to a malloc'd one and a standardized character directory format, as was done in Redux)
    - Put a button in the Blender addon that exports the model and launches it in the game's model viewer OR in a Time Trial race for instant feedback.
    - Let the game load sound effects, textures, animation timing data, custom code, icons, attributes, etc. from the directory and remove anything hardcoded to a specific character (probably the hardest part)
    - Do whatever needs to be done to let game handle an arbitrary number of characters
    - Repeat for courses

    I know I'm shooting super duper high here with my ambitions, but I feel the payoff would be worth it.
    First off, I want to be able to distribute a character (or a course) as a mod and have it just get nicely slotted into the character select menu and work out of the box, without having to deal with replacing existing characters or anything like that.
    Secondly, I want a sort of IDE-like thing where I can just press a button and instantly test out my character or course in game, without having to copy files and slog through menus.
    Thirdly, having custom menus would be super useful if I wanted to add new Time Attack/Grand Prix/Multiplayer modes, the networking mode, or custom debugging screens.

    If anyone's got a less insane solution, don't hesitate to speak up.
    Also, for my way far off end game I want to ditch the idea of racing entirely and just make a traditional Sonic game in the Sonic R engine, with badniks and bosses and checkpoints and stuff. It would take an absolutely stupid amount of effort, but it would be fun to try.
     
  17. Strife

    Strife

    Member
    1,928
    23
    18
    United States
    Freedom Planet 2
    That sounds like a really cool and ambitious way to open up modding potential. I've always wondered what this game would be like with just a few more courses and features.

    Would it be possible to add vehicle sounds to characters besides Amy? Imagine recreating Mario Kart or Sonic Drift through modding.
     
  18. McAleeCh

    McAleeCh

    Oldbie
    995
    22
    18
    This is amazing. My computer's out of commission at the moment and my disc drives packed up long ago, but as soon as I'm back in the game with a functioning PC and a drive that can read the disc I'm busting out my old '98 release of Sonic R (and grabbing the patch to turn it into the '04 version so that it's compatible) and checking some of this out. Proper widescreen Sonic R looks great - hoping modding for this will take off and we'll eventually see new characters/courses too! = D

    Out of interest - from skimming the topic I'm sure we're not at this point yet, but in future, would it theoretically be possible to add new characters/courses in addition to those that are already there? Would be awesome to retain the base Sonic R characters/features but be able to add more user-developed characters/courses on top to expand it into a much fuller game. = )
     
  19. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,396
    64
    28
    SonLVL
    I always say, anything is possible, if you're willing to put in enough effort.

    As for InvisibleUp's suggestions, I generally tend to just use a structure filled with function pointers sent as a parameter on the mod's Init function whenever I want mods to be able to modify lists cooperatively, but I'm willing to try something different.
     
  20. CheatFreak

    CheatFreak

    Everything or Nothing. Member
    58
    2
    6
    Michigan
    BetterSADX Patch
    For those that may be interested, I've also made a cheat engine cheat table for Sonic R 2004, feel free to use it as the basis for your own stuff if you want.
    Download

    The codes included in Sonic R Mod Loader were found with Cheat Engine of course, so almost everything in that table is in here somehow, but as raw addresses and values with descriptions.