don't click here

Demo of entirely C-based SMPS Playback Engine NOW WITH SOURCE

Discussion in 'Engineering & Reverse Engineering' started by Rob Jinnai, Nov 6, 2008.

Thread Status:
Not open for further replies.
  1. muteKi

    muteKi

    Fuck it Member
    7,850
    131
    43
    You could ask AamirM about his core; it's actually pretty accurate right now, overall more so than Gens'.
     
  2. Rob Jinnai

    Rob Jinnai

    Not really master of theory debunking anymore Tech Member
    215
    0
    0
    Custom Game Engine Prototypes
    Heh, I don't even check 98 anymore... or a machine to check it with for that matter... might be an Allegro / DirectX issue though. (I didn't write the digital driver part, obviously.)


    Can you point me in some direction towards this AamirM? Is that a board member or what?
     
  3. nineko

    nineko

    I am the Holy Cat Tech Member
    6,298
    475
    63
    italy
    Also this.
     
  4. muteKi

    muteKi

    Fuck it Member
    7,850
    131
    43
    Actually, yes. He developed the core for the emulator Regen ( http://aamirm.hacking-cult.org/ ). There's also a winamp plugin using it.


    I know he at least plans at some point to release it, though I mean you'd have to ask him yourself about using it right now, since he's still retooling it.
     
  5. Rob Jinnai

    Rob Jinnai

    Not really master of theory debunking anymore Tech Member
    215
    0
    0
    Custom Game Engine Prototypes
    I think I fixed my last "disappearing track" problem... apparently I was missing the very last byte in my Saxman decompression routine for Sonic 2. The last byte typically sets a TL level, and it would pretty much be up to random memory whether or not it would be a value good enough to supply a volume. It was quite often ending up being a silencing or very quiet value. Also the Sonic 1 FM6 thing is fixed. I was enabling the DAC incorrectly when not in use and thus silencing FM6, which is pretty much what I expected.

    I haven't got too far into using other cores yet... I briefly looked at Gens' and it seemed like it might also be fairly easy to implement, though it looks like its update routines are slightly different which may pose a problem of some minor alterations to the update loop. I haven't decided yet if I'm going to just release the source and leave this up to another or what yet. After all, having spent two weeks on a solo mission to get it this far, it would be nice to have a little help. :eng101:
     
  6. Puto

    Puto

    Shin'ichi Kudō, detective. Tech Member
    2,013
    0
    16
    Portugal, Oeiras
    Part of Team Megamix, but haven't done any actual work in ages.
    Right, so I've been doing some thinking, and I believe I understand how Sonic 1 tempo works. Note that I did this without actually looking at SMPS's code, and is merely a theory based on my experience working with SMPS. Testing that I did with nineko seems to confirm it, though.

    Tempo, as you know, has two bytes, I.e. "0x0y". Every x frames, it calls a certain routine. That routine then checks a certain variable, let's call it z, which is initialized at y. If z is 1, then it is reset to y and it doesn't do anything else this frame. Otherwise, it is decremented and the engine continues processing the song (I.e. check if the current note finished playing, etc.). Testing done with nineko seems to support this theory; and it explains everything: Tempo 0x01 is always stopped because, since variable 'z' is always 1, the song never plays. Tempo 0100 is the fastest because it only stops every 256th frame. 0200 and 0102 have nearly identical timing because they both process the song every other frame (well, technically 0200 processes it every other frame except one out of 256, but that's such a minor difference that the human ear doesn't detect it).

    Actually, I might as well mention that there is one thing slightly inaccurate with this picture: It isn't "every x frames, it calls a certain routine"; instead it does it every frame, and x is multiplied to the duration of every note by the engine (this is also why, when using an extremely slow multiplier, notes with large durations come out broken; the duration of a note is stored on a byte, and 3*7F > FF).

    Well, that's it. Hopefully this will help. Also, for those whose brain didn't flip on yet, I remind you that a frame is 1/60 seconds on NTSC, and 1/50 seconds on PAL.
     
  7. Rob Jinnai

    Rob Jinnai

    Not really master of theory debunking anymore Tech Member
    215
    0
    0
    Custom Game Engine Prototypes
  8. Hitaxas

    Hitaxas

    Retro 80's themed Twitch streamer ( on hiatus) Member
    I fucking love this, seems to work perfectly for me, I even got it to play my imported songs. This is one hell of a wonderful program. :(
     
  9. Uh, sorry if I sound rude, but that's nothing special. Imported songs are standard SMPS files.

    (Except if you failed at importing them, leading to broken files, of course.)
     
  10. Hitaxas

    Hitaxas

    Retro 80's themed Twitch streamer ( on hiatus) Member
    I didn't say it was, I just stated the fact that I could.
     
  11. Armada

    Armada

    Sometimes I do things Member
    338
    0
    0
    Wow, open source too! When I get some free time after I finish my homebrew project, I want to try my hand at porting this to the DS. Thanks for this!
     
  12. Eduardo Knuckles

    Eduardo Knuckles

    Not a loved one, but the most hated person. Banned
    414
    10
    18
    Someplace somewhere
    Project S.A.M.G.
    I agree. Wonderful tool!
     
  13. Puto

    Puto

    Shin'ichi Kudō, detective. Tech Member
    2,013
    0
    16
    Portugal, Oeiras
    Part of Team Megamix, but haven't done any actual work in ages.
    This code is definitely going into xm4smps for a preview feature =P
     
  14. nineko

    nineko

    I am the Holy Cat Tech Member
    6,298
    475
    63
    italy
    Thanks God, hopefully now I won't be reading my name in this thread anymore.
     
  15. Hitaxas

    Hitaxas

    Retro 80's themed Twitch streamer ( on hiatus) Member
    But you know we love you, Nineko.
     
  16. Rob Jinnai

    Rob Jinnai

    Not really master of theory debunking anymore Tech Member
    215
    0
    0
    Custom Game Engine Prototypes
    Yeah, I definitely wanna see how that might turn out..
     
  17. Puto

    Puto

    Shin'ichi Kudō, detective. Tech Member
    2,013
    0
    16
    Portugal, Oeiras
    Part of Team Megamix, but haven't done any actual work in ages.
    Oh, it's already in and working =P. I just want to try and get Sonic 1 tempo fixed before I release it, and with university exams on top of me, I really don't have a lot of free time...
     
  18. Hitaxas

    Hitaxas

    Retro 80's themed Twitch streamer ( on hiatus) Member
    That is awesome news. This will help so much. :psyduck:

    I can't count how many times I've fucked up a song, only to find out once I put it in-game. :colbert:
     
Thread Status:
Not open for further replies.