Basic Questions and Answers Thread

Discussion in 'Discussion & Q&A' started by Malevolence, Jul 7, 2009.

  1. Dj. Joker 27

    Dj. Joker 27 Known as "Mr. Joker 27" Member

    Joined:
    Aug 26, 2016
    Messages:
    37
    Alright nineko so, I will not be able to get those effects, also. There are a mappings and DAC list from S2 for Mid2smps?
    I use Sonic 2 Clone Driver in my hack and some instruments in the drums aren't presents, I only have got S1neko_DAC and S1Neko_map in my Data folder.
    Thanks in advice.
     
  2. Renegade

    Renegade RuthlessTheHooman Member

    Joined:
    Nov 20, 2016
    Messages:
    60
    Location:
    New York Desert
    Ugh, I really hate asking questions.

    I've tried putting Flamewing's S3K Driver in Sonic 2. Joenick has been helping me, but I think he's busy right now.
    Or who knows, I may have just being annoying him as I seem to do with people.

    Anyway, it seems I only have three errors left to fix. There are some undefined symbols.
    MusId__End, SndId__End and SndId__First.

    These seem to be the last errors there is. (I set them to random IDs once and it built, but the Rom didn't work.)

    Essentially, I need to know what to set them to. Thanks in advance.
     
  3. Iso Kilo

    Iso Kilo Creator of something Member

    Joined:
    Oct 9, 2017
    Messages:
    70
    Location:
    Small Town in BC, Canada
    There are probably 2 things you did wrong, but I'll write down the one I think is most likely first: Sonic 2 can't read the '_' symbol, and I'll give you a few solutions to that too: Replace the underscores with spaces. Remove the underscores outright, and if there are routines that are already called things like "MusIdEnd:" then just call these new ones "MusIdEnd2:". But I could be wrong, so here's my next idea.

    You renamed these routines and there are still instructions calling them. I recommend going back a few steps and seeing what you renamed them to. Then looking at the error in the assembler to find which lines were calling for those routines. Replace the routine name for the one you were initially branching to, and you should be good to go.

    It should be noted that this is just an educated guess. Without a screenshot of the assembler failing and where, I had to come up with multiple methods that could help. I also rarely work with Sonic 2, but I know that it's built off of Sonic 1, and the disassemblies share some resemblance. But backup your files first before following my directions in case I am wrong, I'm not really a Sonic 2 source, Sonic 1 is my primary game and is what I am most comfortable with. However, if my solutions did work, you are welcome.
    EDIT: I just realized you were probably talking about RAM addresses since you weren't sure what to set their ID's to, in which case, then yeah, remove the underscores.
     
    Last edited: Oct 31, 2018
  4. Nat The Porcupine

    Nat The Porcupine Newcomer Member

    Joined:
    Jun 23, 2017
    Messages:
    23
    Location:
    Harrisburg, Pennsylvania (USA)
    WTF? No no NO! That's not even remotely correct! Underscores are used in constant names and label names literally ALL the time in the Sonic 2 disassembly, or any other disassembly for that matter. Have you never even cracked open the Sonic 2 disassembly just out of sheer curiosity? If that's the case, then how exactly could you even hope to answer a question about something related to a code base you know next to nothing about? Just... WTF?

    Anyway Ruthless, obviously don't take Kilo's advice here because that'll unnecessarily overcomplicate things for you later. I have the day off today, so I'll try to either append and edit or write a new response with the real answer to your question sometime today.
     
    Ozaleto and Natsumi like this.
  5. Novedicus

    Novedicus Well-Known Member Member

    Joined:
    Aug 26, 2013
    Messages:
    857
    @RuthlessTheHooman This should be of help. I think it's worth mentioning to make sure you also reimplement the latest driver version and song pack.

    Also @Nat The Porcupine, dude, while I agree Kilo's answer wasn't really correct and that he should probably study the disassembly a bit more, couldn't there have been a better way to word your response?
     
    NeoFusionBox and MarkeyJester like this.
  6. Nat The Porcupine

    Nat The Porcupine Newcomer Member

    Joined:
    Jun 23, 2017
    Messages:
    23
    Location:
    Harrisburg, Pennsylvania (USA)
    Perhaps I did overreact a little. I just find it a tad frustrating when people make assumptions in order to answer a question related to a subject that they're inexperienced with; it's one of my pet peeves. Nevertheless, I will definitely try to be a little gentler with my word choice next time.
     
    NeoFusionBox, Ozaleto and Novedicus like this.
  7. Natsumi

    Natsumi Markey's Member

    Joined:
    Oct 7, 2011
    Messages:
    648
    Location:
    Otter's lap
    Well not really. Iso's been told many times its best not to try pretending to know about what they really don't, and inserting themselves into something like this. Not only that, but its blindingly obvious - to I hope everyone - that what they said is monumentally wrong. Even 5 minutes of testing would have shown they were wrong. This kind of stuff is the supreme laziness and idiocy people generally hate about newbies, and they tried to help someone else solve an issue they were having by using that. I think it was quite a measured response, given everyone flamed them on Discord about it already. I mean I guess, it didn't necessarily need to be re-iterated here again, but just leaving their answer up here without any comment would be a monumental fuckup.
     
    Dj. Joker 27 likes this.
  8. Iso Kilo

    Iso Kilo Creator of something Member

    Joined:
    Oct 9, 2017
    Messages:
    70
    Location:
    Small Town in BC, Canada
    Alright then, I understand that this is a place in which I can only ask questions, responding to questions obviously results in humiliation. We don't need a 37th bashing for something I tried solving while being tired to a degree in which I shouldn't have been trying to solve issues. I'm already in a shitty mood, and I'd rather this not ruin my day even further. Sorry for being wrong, it's something I do often. Can't help myself for trying.
     
  9. Renegade

    Renegade RuthlessTheHooman Member

    Joined:
    Nov 20, 2016
    Messages:
    60
    Location:
    New York Desert
    Thanks for the responses.
    Joenick gave me a guide on how to install it into the Hivebrain version, I knew there were some differences, but I should've elaborated a bit more.

    Also, don't beat yourself up Iso. Everyone makes mistakes. Look at my SonicRetro account.

    Edit: I've been waiting all day to get a chance to try this, but as is typical for me, it doesn't work. I don't know what to do.
    Edit 2: I'm starting this miserable little pallet hack over on a Git disam, if it doesn't work then I'm done with Sonic 2. I'm sick of wasting my time on this game.


    Final Edit: Yep, everything's failed again. This is the exact kind of thing that happens to be all the time. I don't know why I try. I'm done with Sonic 2. I absolutely CAN NOT do this even if my life depended on it. Thanks for your help everyone, but I despise trying to hack this game. I guess I'm only ever going to be able to hack Sonic 1. I can't add the Clone Driver, I can't add Flamewing's Driver, I can't add the S1 Driver. I can't do anything with this game.

    To ANYONE who's put a new Sound Driver of any kind in Sonic 2, I applaud you. I can be given simple instructions to copy and paste and STILL fail.

    And there goes a few weeks worth of effort.
     
    Last edited: Nov 1, 2018
  10. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    832
    You don't have to install a new sound driver, you know. It's entirely possible to add music to the stock one, you don't even have to compress them.
     
    Ozaleto, Clownacy and Natsumi like this.
  11. Renegade

    Renegade RuthlessTheHooman Member

    Joined:
    Nov 20, 2016
    Messages:
    60
    Location:
    New York Desert
    Yeah, vit I prefer to have a wider variety of Dac samples tp use.

    That's half the reason why I was looking intp the S3K driver, since it has numerous.

    Also, don't get me started on the stock snare sample.
     
  12. Pacca

    Pacca Level 1 inflatable otter thing Member

    Joined:
    Jul 5, 2014
    Messages:
    1,126
    Location:
    Twinleaf Town
    You act like it's impossible to add DAC samples to the original S2 sound driver. Now, I'm not exactly one to talk, I stick to the Clone Driver for the purpose of abusing higher quality PCM samples, but if your just using them as a background track for music, the quality offered by the Sonic 2 driver should be enough to suffice.

    I just cracked open a Vanilla S2 git disassembly to take a look, and it seems like samples are referenced in the driver by a list of macros like so:
    Code:
        ; DAC sample pointers and lengths
        ensure1byteoffset 1Ch
    
    ;zDACPtr_Index:
    ;zbyte_1233:
    zDACPtrTbl:
    zDACPtr_Sample1:    dw    zmake68kPtr(SndDAC_Sample1)
    ;zbyte_1235
    zDACLenTbl:
                dw    SndDAC_Sample1_End-SndDAC_Sample1
    
    zDACPtr_Sample2:    dw    zmake68kPtr(SndDAC_Sample2)
                dw    SndDAC_Sample2_End-SndDAC_Sample2
    
    zDACPtr_Sample3:    dw    zmake68kPtr(SndDAC_Sample3)
                dw    SndDAC_Sample3_End-SndDAC_Sample3
    
    zDACPtr_Sample4:    dw    zmake68kPtr(SndDAC_Sample4)
                dw    SndDAC_Sample4_End-SndDAC_Sample4
    
    zDACPtr_Sample5:    dw    zmake68kPtr(SndDAC_Sample5)
                dw    SndDAC_Sample5_End-SndDAC_Sample5
    
    zDACPtr_Sample6:    dw    zmake68kPtr(SndDAC_Sample6)
                dw    SndDAC_Sample6_End-SndDAC_Sample6
    
    zDACPtr_Sample7:    dw    zmake68kPtr(SndDAC_Sample7)
                dw    SndDAC_Sample7_End-SndDAC_Sample7
    
        ; something else for DAC sounds
        ; First byte selects one of the DAC samples.  The number that
        ; follows it is a wait time between each nibble written to the DAC
        ; (thus higher = slower)
        ensure1byteoffset 22h
    ; zbyte_124F:
    zDACMasterPlaylist:
    
    ; DAC samples IDs
    offset :=    zDACPtrTbl
    ptrsize :=    2+2
    idstart :=    81h
    
        db    id(zDACPtr_Sample1),17h        ; 81h
        db    id(zDACPtr_Sample2),1        ; 82h
        db    id(zDACPtr_Sample3),6        ; 83h
        db    id(zDACPtr_Sample4),8        ; 84h
        db    id(zDACPtr_Sample5),1Bh        ; 85h
        db    id(zDACPtr_Sample6),0Ah        ; 86h
        db    id(zDACPtr_Sample7),1Bh        ; 87h
        db    id(zDACPtr_Sample5),12h        ; 88h
        db    id(zDACPtr_Sample5),15h        ; 89h
        db    id(zDACPtr_Sample5),1Ch        ; 8Ah
        db    id(zDACPtr_Sample5),1Dh        ; 8Bh
        db    id(zDACPtr_Sample6),2        ; 8Ch
        db    id(zDACPtr_Sample6),5        ; 8Dh
        db    id(zDACPtr_Sample6),8        ; 8Eh
        db    id(zDACPtr_Sample7),8        ; 8Fh
        db    id(zDACPtr_Sample7),0Bh        ; 90h
        db    id(zDACPtr_Sample7),12h        ; 91h
    
    I have no idea what I'm doing in terms of sound drivers, and I dug this up in like 5 minutes without testing anything, so there's a good chance I might be wrong. But based on the other data structures I've seen, it looks like it could be extended quite easily just by copy pasting a previous set of lines, renaming them, and including another DAC file for them to reference. You might have to look up speed values for the files you want to add, and you would have to strip wav files yourself to add custom ones. However, if your just looking to use S3K/S3D/etc. samples or publicly available ones intended to be slapped on top of the S1 driver, I don't see any reason why they wouldn't work here.
     
    Renegade likes this.
  13. Renegade

    Renegade RuthlessTheHooman Member

    Joined:
    Nov 20, 2016
    Messages:
    60
    Location:
    New York Desert
    Weird, I thought there was something relating to the total size the Dac samples could add up to.

    Also, I felt reluctant to use the default S2 driver because when I've tried converting music to use in it, it's never worked, plus people seem to love to bash it.

    I may still try this, but no promises. I've already got a heap of things to work on.

    Edit: Also, I've just honestly been trying to get something to work. It's left me shall we say annoyed that no driver ever works. I can't even compare what I want to use.

    But, this is irrelevant. I think I'll declare this response chain as over.
     
    Last edited: Nov 1, 2018
  14. Trickle

    Trickle Newcomer Trialist

    Joined:
    Jan 18, 2018
    Messages:
    5
    So like most hacks, I enabled the S monitor to grant you 50 rings. For a little while, I had trouble making it play the ring sound, but I solved that issue by putting the Obj2E_RingSound line after ChkS. The issue I am running into now is that it won't grant you an extra life if you were to hit two consecutively. You only receive the extra life after collecting a ring. I tried adding the "check if you have 100 rings" and "check if you have 200 rings" lines, but it just gives me compiling errors.

    Code:
    Obj2E_ChkRings:
            cmpi.b    #6,d0        ; does monitor contain 10 rings?
            bne.s    Obj2E_ChkS ;
            addi.w    #$A,($FFFFFE20).w ; add    10 rings to the    number of rings    you have
            ori.b    #1,($FFFFFE1D).w ; update the ring counter
            cmpi.w    #100,($FFFFFE20).w ; check if you have 100 rings
            bcs.s    Obj2E_RingSound
            bset    #1,($FFFFFE1B).w
            beq.w    ExtraLife
            cmpi.w    #200,($FFFFFE20).w ; check if you have 200 rings
            bcs.s    Obj2E_RingSound
            bset    #2,($FFFFFE1B).w
            beq.w    ExtraLife
    ; ===========================================================================
    
    Obj2E_ChkS:
            cmpi.b    #7,d0              ; does monitor contain 'S'?
            bne.s    Obj2E_RingSound     ; if not, branch
            addi.w    #50,($FFFFFE20).w ; add    50 rings to the    number of rings    you have
            ori.b    #1,($FFFFFE1D).w  ; update the ring counter
    
    Obj2E_RingSound:
            move.w    #$B5,d0
            jmp    (PlaySound).l    ; play ring sound
    
    ; ===========================================================================
     
  15. Pacca

    Pacca Level 1 inflatable otter thing Member

    Joined:
    Jul 5, 2014
    Messages:
    1,126
    Location:
    Twinleaf Town
    What compiling errors do you get when adding those lines?
     
  16. Trickle

    Trickle Newcomer Trialist

    Joined:
    Jan 18, 2018
    Messages:
    5
    Error : Illegal value (-32802) bsr.w mvsoniconptfm. At first, I thought you just couldn't make certain objects have identical lines, but my Obj2E_ChkShoes looks similar to the invincibility one (It has it's own music play).
     
  17. LazloPsylus

    LazloPsylus A Certain Scientific Railgun The Railgun

    Joined:
    Nov 25, 2009
    Messages:
    Location:
    Academy City
    Check the line that the error indicates. Need to adjust the subroutine call, as the change has put the target out of reach of a branch (which is a relative signed integer value indicating distance from the branch to the target location). You'll need to adjust to a JSR so that the absolute address is used instead, which bypasses the size limit of a relative signed integer word, but is larger in size.
     
  18. Novedicus

    Novedicus Well-Known Member Member

    Joined:
    Aug 26, 2013
    Messages:
    857
    Change the bsr.w in that line to a jsr. Usually, those "illegal value" errors mean a branch may be too short, so you'll have to extend it.

    EDIT: Fuckin' Lazzie.
     
  19. LazloPsylus

    LazloPsylus A Certain Scientific Railgun The Railgun

    Joined:
    Nov 25, 2009
    Messages:
    Location:
    Academy City
    Surprise! A rare ninja moment!

    Seriously, though, this is a great point to emphasize the importance of learning the language you're working with. It's more than just learning that A does B. Learn why. Spend some time learning why, and an error like that makes plenty of sense. In this case, learning the difference between branches and jumps, and the issues and limitations with both. Code is fluid in design, so when things change, issues like that come up naturally.
     
    Natsumi likes this.
  20. ValleyBell

    ValleyBell Well-Known Member Member

    Joined:
    Dec 23, 2011
    Messages:
    143
    DAC and PSG lists for Sonic 2 should be included with mid2smps. (unless you got one of those "update" archives I posted on IRC)
    They are in the "ListFiles" folder.

    @RuthlessTheHooman: If you have so much trouble with porting sound drivers, you maybe should look for someone on IRC/Discord who is willing to check your steps.
     
    Dj. Joker 27 and Renegade like this.