don't click here

Sonic R Hacking

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

  1. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,734
    330
    63
    SonLVL
    I fixed the crashing error by changing the code.

    The fact that it doesn't respond to input unless it's running with IDA seems to be entirely separate.
     
  2. Aquaslash

    Aquaslash

    <The Has-been Legend> Moderator
    On a slightly off topic note. If anyone manages to get an exporter working for the character models, do post them please, regardless of the low poly count.
     
  3. Lostgame

    Lostgame

    producer/turnablist. homebrew dev. cosplayer. Oldbie
    4,134
    58
    28
    Toronto, ON
    The O.I.C.
    This. This, this this this. PLEASE. I've been trying for *years*.
     
  4. Azookara

    Azookara

    yup Member
    Thirded (sp?). I've always wanted the Sonic R/S3DSaturnSS/Jam/protoSA1 models sooooo bad, because there the only models I've ever seen in all of history that captured the charm of classic Sonic 100% no matter how blocky they look. Give the models and I'll love you forever plzkthx~ <3
     
  5. Skyler

    Skyler

    Neonネオン Cowgirlカウガール Site Staff
    3,287
    32
    28
    Hellafornia
    The next audtion
    MainMemory, you never cease to amaze me. :thumbsup:
     
  6. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,734
    330
    63
    SonLVL
    Thanks?

    All I really did with this game is some redundant research, posted something from a YouTube video, and wrote two little programs.
     
  7. It WOULD be pretty cool if this Sonic R hacking could actually enable some sort of adventure game, not racing. That'd probably be really difficult, though. :P
     
  8. Hmm, this looks interesting. I've seen SMK being hacked, but this seems cooler as it is in 3D. Can't wait to see more hacking pictures!
     
  9. Skeledroid

    Skeledroid

    Member
    227
    0
    0
    I've always wanted to see the Sonic R engine used for an actual Sonic game. Maybe one of these adventurous hackers could use the newly released Sonic Xtreme textures and stuff... ;)
     
  10. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,734
    330
    63
    SonLVL
    Hey saxman, if you read this, could you explain the .ter files a bit more? The info you gave me isn't very understandable.
     
  11. TapamN

    TapamN

    Member
    101
    2
    18
    Heh. I actually made a floor editor like that about three or four years ago, written in VB6. It even read in the graphics the same way. The biggest difference was that you had a palette of tiles on the right rather than using a spinbox, and a menu bar for selecting the MAP/PLY files and saving.
     
  12. Any more improvements on the Map Editor?
     
  13. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,734
    330
    63
    SonLVL
  14. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,734
    330
    63
    SonLVL
    Well, now it seems like Sonic R doesn't want to respond to inputs even when I run it from IDA. And I still can't get it to run in a window.
    It looks like I won't be doing much with this unless someone can figure out how to fix the control problem.

    EDIT: okay, looks like IDA 5.5 is not working. It still works with 5.1.

    Anyway, in case I haven't already said these, the RAM addresses I have found so far are:
    Code (Text):
    1. 008FB8EC&nbsp;&nbsp;&nbsp;&nbsp;4 Bytes&nbsp;&nbsp;&nbsp;&nbsp;Course
    2. 008FD50C&nbsp;&nbsp;&nbsp;&nbsp;4 Bytes&nbsp;&nbsp;&nbsp;&nbsp;Rings P1
    3. 008FD538&nbsp;&nbsp;&nbsp;&nbsp;4 Bytes&nbsp;&nbsp;&nbsp;&nbsp;Speed P1
    4. 008FD588&nbsp;&nbsp;&nbsp;&nbsp;4 Bytes&nbsp;&nbsp;&nbsp;&nbsp;Distance from ground P1
    5. 008FD5E6&nbsp;&nbsp;&nbsp;&nbsp;4 Bytes&nbsp;&nbsp;&nbsp;&nbsp;Character P1
    6. 008FD6D4&nbsp;&nbsp;&nbsp;&nbsp;4 Bytes&nbsp;&nbsp;&nbsp;&nbsp;Character model P1
     
  15. Polygon Jim

    Polygon Jim

    Eternal Tech Member
    0
    3
    0
    across town from Hinchy
    All the bitches.
    Here's the ones I found.


    Code (Text):
    1. 8FD5E6 - Player 1 character
    2. 8FD6D4 - Player 1 model
    3. 8FD50C - Player 1 rings
    4.  
    5. 8FDD02 - Player 2 character
    6. 8FDDF0 - Player 2 model
    7. 8FDC28 - Player 2 rings
    8.  
    9. 8FE41E - Player 3 character
    10. 8FE50C - Player 3 model
    11. 8FE344 - Player 3 rings
    12.  
    13. 8FEB3A - Player 4 character
    14. 8FEC28 - Player 4 model
    15. 8FEA60 - Player 4 rings
    16.  
    17. 8FF256 - Player 5 character
    18. 8FF344 - Player 5 model
    19. 8FF17C - Player 5 rings
     
  16. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,734
    330
    63
    SonLVL
    It looks like DXWnd wasn't working because I had Windows 95 compatibility mode set for Sonic R. And, Sonic R responds to input if I'm using DXWnd, even without IDA.

    They left a lot of debug strings in this game, which is quite helpful for figuring out what the game is doing. Here, have some functions:
    <div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>CreateTPageBuffer 00422FB4
    D3D_HackTPageBrightness 00424C74
    LoadTerrain 0042A3F8
    LoadAI 0042A44C
    S3D_LoadTextureIntoTPageRAW 0042A5EC
    D3D_LoadTPageRGB 0042AD10
    LoadTextureRAW 0042AD74
    InitFlagBitmap 0042AF20
    LoadBlueScaleFlag 0042AF98
    LoadTPageRAW 0042B044
    D3D_LoadAndScaleParallax 0042BA9C
    S3D_LoadWallpaper 0042BDD0
    D3D_LoadWallpaper 0042C3EC
    S3D_LoadAndScaleParallax8 0042CB34
    S3D_LoadAndScaleParallax 0042CD14
    D3D_LoadPlayfieldTilesRGB 0042D418
    LoadPlayfieldTilesRGB 0042D5E4
    nullsub_9 0042D8C0
    LoadTrackBin 0042F118
    SaveTrackBin 0042F530
    TintTrackGourauds 00430A0C
    TintCharacterGouraudTables 00430BDC
    Callback 004316D0
    CreateD3DApp 00432908
    RestartD3D 00432BC8
    D3DAppCreateFromHWND 00434CB0
    D3DAppWindowProc 00435344
    D3DAppSetRenderState 00435628
    D3DAppDestroy 00435C14
    JHOverrideDisplayMode 00438C48
    D3DGenerateMaterials 00438D10
    InitSoftwareRenderer 00439024
    AppAccel 00439220
    DialogFunc 00439970
    WindowProcSOFT 004399B0
    WindowProcD3D 00439AA8
    CloseTrackHoles 0046F8BC
    CloseTrackObjectHoles 0046FA34
    InitTitleStuff 00470654
    InitOptionStuff 0047096C
    UpdateObjectVertices 0047256C
    InitIsland 004732BC
    InitCity 00473954
    InitRuin 0047405C
    InitFactory 00474744
    InitEmerald 00474CE8
    LoadCharacterGouraudTables 00476750
    nullsub_1 00478288
    nullsub_2 00479700
    nullsub_6 0048088A
    DestroyThread 00486928
    Connect 00486B58
    CreateSession 00486D78
    EnumeratePlayers 0048739C
    SendMessageDirect 004875F8
    CreateThread_1 00487674
    ModeSelectScreen 004885BC
    MultiPlayerScreen 0048905C
    NetworkScreen 0048A8AC
    TimeAttackModeSelectScreen 0048BA80
    MultiPlayerModeSelectScreen 0048C270
    CharacterSelectScreen 0048C968
    CourseSelectScreen 0048DE34
    LoadSaveScreen 0048F984
    TimeRankingScreen 00490D24
    FindResMatch 00492234
    AdjustResolution 004922AC
    AdjustColourDepth 004923B4
    OptionsScreen 00493BDC
    nullsub_3 00496A44
    InitPaletteStuff 004B88D0
    ClosePaletteStuff 004B8924
    Allocate8BitTextureArea 004CA08C
    S3D_Textures8to16 004CA11C
    S3D_Textures16to8 004CA180
    ShutDown 004CA2FC
    QuitSonicR 004CA4C0
    SetScreenDimensions 004CBEFC
    ResetPolygonFunctionPointers 004CC81C
    InitPolygonPointers 004CD86C
    InitSonicR_A 004CD8B8
    InitSonicR_B 004CD904
    _WinMain 004CDFC4
    OpenCDDevice 004D0134
    CloseCDDevice 004D0180
    PlayCD 004D01AC
    FindSonicRCD 004D0F4C
    SwitchDriverScreen 004D4D94
    StartAddress 004D8D10
    SegaLogoScreen 004DC1E0
    TravellersTalesLogoScreen 004DC440
    TitleScreen 004DCFCC
    InitWeather 004E0448
    SetParallaxLightSource 004E0758 </div>

    Also, looking at InitIsland etc., it would seem that 94BCF4 is the current weather setting, as it loads the snow data if this is equal to 2.
    The code that skips the Network menu when moving right on the main menu is at 488938 in RAM, and the code that adds to your ring count when you collect a ring is at 49676E in RAM.
     
  17. So apparently Super Mario 64 level editing has just become a lot easier. Some guy released a program that can port levels into Super Mario 64 in .obj format, and it does it pretty well too, apparently:

    Spiral Mountain in Super Mario 64
    Rusty Bucket Bay in Super Mario 64
    Level made with Google sketch-up in Super Mario 64
    Some stage from Aidyn Chronicles in Super Mario 64

    There's a lot more all over Youtube, too. But what I'm wondering is if the Sonic R tracks models could possibly be ported over to this .obj format and then ported into Super Mario 64? (If the models have been ported yet, I don't know if they have, but I'm assuming so)

    The Level Importer can be found here.
     
  18. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,734
    330
    63
    SonLVL
    Over half of that post has little to do with Sonic R...

    Anyway, sure they could! If we knew the format. Which we don't.
     
  19. Raz

    Raz

    Member
    38
    0
    0
    USA
    Hey there, I joined this forum because of this thread. :)

    I think I read through everything so far, but let me get a few quick questions out since I haven't had any sleep yet and I have class soon. Please forgive me if I ask any ignorant questions (and kindly point me to a doc/link)

    When I go to look for the UV's or 3D vertices for the models, what byte sizes should I expect for the verts and the UV's? I quickly read the SA model format to get an idea of what to expect in general, it shows 2 shorts for each U and V, and a Float[3] for each vertex, but since Saturn's an older machine I'm assuming much more frugal setups, or perhaps strange byte orientation? (I recall one machine even reads its disc backwards?)

    Also, which .bin file would be the smallest and probably best to try and analyze? And do you think this engine even uses weights? It looks like it may be just static meshes attached to a skeleton, as I can see mesh clipping when I play the game, so currently I'm guessing that all those tiny .bin files in the character directories are probably just body parts.

    I'm an artist but I wanted to cut my teeth on some binary stuff, so I'm just starting my learning path on packed data. Please bear with me ^^; Any advice or pointers would be greatly appreciated.
     
  20. Polygon Jim

    Polygon Jim

    Eternal Tech Member
    0
    3
    0
    across town from Hinchy
    All the bitches.


    I can say the games models should not be using weights at all, it is using a hierarchy system like SA1 for animations. For the verts it's been a long time since I was messing with them, and I can't seem to find any notes I wrote down so I don't know how the verts were set up. I think they were just 3 floats X/Y/Z.



    If you want to try with Sonic's model it would be BIN\OBJECTS\SONIC\SONIC_H.BIN. The other .bin files in the directory are animation files. The .grd files from what I remember is lighting data for the characters, but I might be wrong on that part, it's been a long time since I messed with the game.