Basic Questions and Answers Thread

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

  1. Devon

    Devon Down you're going... down you're going... Member

    Joined:
    Aug 26, 2013
    Messages:
    1,372
    Location:
    your mom
    It's a VRAM problem. You have to free some VRAM for the points art. Super Sonic is overlapping it.
     
  2. N30member

    N30member non-pro user btw Member

    Joined:
    Feb 15, 2014
    Messages:
    216
    Location:
    Kazakhstan
    How do you do this? I saved project, but levelsghz1.bin and ghzbg.bin is empty again.
     
  3. EasterBanana

    EasterBanana Newcomer Trialist

    Joined:
    Jul 22, 2014
    Messages:
    9
    Location:
    In the R of SSRG.
    I saw a lot of software to convert music in MID, XM, SMPS ... but I do not know which really helps to put a custom music in Sonic 1. Can you help me?
     
  4. ThomasThePencil

    ThomasThePencil resident psycho Member

    Joined:
    Jan 29, 2013
    Messages:
    910
    Location:
    the united states. where else?
    Well, the easiest one to get used to is my good friend xm3smps/oerg. It has many capabilities, including ASM-type output, previewing of conversions, voice selections and assignments, etc.

    Mid2smps can be used as well, but I can't really give directions on using it seeing as I'm still trying to learn the ropes with it myself. It's a lot more confusing, but I've observed that the output is much smoother, for lack of a better term.

    tl;dr MIDI can be either converted to XM, with the XM then being converted to a usable SMPS file, or simply a straight conversion from MIDI to SMPS.

    One tip, though: Do not EVER use the "Quick Convert" option with mid2smps. 9 times out of 10 the result will be nothing like how you want it to sound.

    Now then, if you'll excuse me, I need to work on figuring out how to use mid2smps...
     
  5. warr1or2

    warr1or2 I AM CLG Member

    Joined:
    Apr 7, 2008
    Messages:
    416
    Location:
    Town Creek, AL
    Custom SMPS question (mainly S3KtoS1 porting)

    Why is it when I change the speed of music in SOME & making custom music in xm3smps, everytime i set faster than 2.0 (say like 1.9, 1.5) and it plays nothing. Why is this?
     
  6. ThomasThePencil

    ThomasThePencil resident psycho Member

    Joined:
    Jan 29, 2013
    Messages:
    910
    Location:
    the united states. where else?
    Err...why are you using Sonic One Music Editor? You can just ASM the thing and mod it that way. Also waiting for the day when a program is released that makes the work of modding SMPS files 10x easier... =P
     
    Last edited by a moderator: Aug 17, 2014
  7. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    How would I get the Hidden points object to display its graphics before it's grabbed? I want it to appear right away, and then disappear when obtained. I'd figure it out on my own, but the code for it isn't very well labelled.
     
  8. Clownacy

    Clownacy Retired Staff lolololo Member

    Joined:
    Aug 15, 2014
    Messages:
    1,016
    That actually takes a fair bit of understanding of the object to achieve. Though, if you're familiar with the engine, it's pretty easy to catch on. I'm assuming you're using the Git disasm. (EDIT: He wasn't...)

    Git disassembly:

    Go to your Hidden Bonus object (HiddenBonus:) and note the basic structure: The first block of code after the routine loader is Bonus_Main, and it begins with a bunch of checks regarding when

    not to become visible (if Sonic isn't touching the object, if Sonic is touching the object but he's in debug mode, etc), then there's code for setting up the object's visuals and awarding the player with points. Under all that is another block of code, Bonus_Display. It runs the timer for how long the object should stay visible (before it's deleted) and it jumps to DisplaySprite. Bonus_Display is only processed once Sonic has touched the object.

    The main focus here is that jump to DisplaySprite, we need that jump to be processed before Sonic touches the object. Let's begin:

    Go to Bonus_Display and replace:


            jmp    DisplaySprite
    ...with an rts. This will stop the object from displaying after it's been touched.

    Now go to @chkdel, and replace the rts with...


            jmp    DisplaySprite
    ...the very jump that you deleted. But wait! If you build your ROM and go to the end of the level, the hidden points are still invisible, and if you touch them, they appear for a single frame and then vanish! What's the cause? Do you remember the structure of the first block of code, Bonus_Main? All of the checks for when not to display (or, in our case, when to display) come before the object's graphics are set up! So what we need to do is move the checks to after the graphics are set up.

    Go to Bonus_Main, and find all of this code:


           moveq    #$10,d2
           move.w    d2,d3
           add.w    d3,d3
           lea    (v_player).w,a1
           move.w    obX(a1),d0
           sub.w    obX(a0),d0
           add.w    d2,d0
           cmp.w    d3,d0
           bcc.s    @chkdel
           move.w    obY(a1),d1
           sub.w    obY(a0),d1
           add.w    d2,d1
           cmp.w    d3,d1
           bcc.s    @chkdel
           tst.w    (v_debuguse).w
           bne.s    @chkdel
           tst.b    (f_bigring).w
           bne.s    @chkdel
           addq.b    #2,obRoutine(a0)
    and move to after this line:


           move.b    obSubtype(a0),obFrame(a0)
    And that's it. Save and build and everything will now work.

    Except... what we did was a little hackish. Because of our changes, some of the object's code is redundant. We can go a bit further and optimise some of this code.

    Where to begin... The code that handles how long the object should wait before it's deleted after it's touched is redundant, so let's get rid of that:

    Go to Bonus_Main and remove this line:


            addq.b    #2,obRoutine(a0)
    and this line:


            move.w    #119,bonus_timelen(a0) ; set display time to 2 seconds
    These changes now make Bonus_Display unused. So go ahead and remove the entire thing, and then delete its entry in the index, which is this thing:


            dc.w Bonus_Display-Bonus_Index
    Now for the final adjustment: Making Bonus_Main delete the object directly instead of making Bonus_Display do it. After AddPoints is jumped to and processed, the code after it is read. This code displays the sprite and does some checking. This code is used by other things, but we don't need it to be used here. Move @delete and its jump to in between


            jsr    AddPoints
    and


        @chkdel:
            out_of_range.s    @delete
            jmp    DisplaySprite
    Now, instead of displaying itself (and then leaving itself occupying RAM), it deletes itself without displaying.

    One more thing... because of our adjustments, the code for setting up the object is processed every frame that the object isn't deleted. We can fix that too.

    After this:


            move.b    obSubtype(a0),obFrame(a0)
    ...add this:


            addq.b    #2,routine(a0)
            rts

    Bonus_Main2:
    And after:


    Bonus_Index:    dc.w Bonus_Main-Bonus_Index
    ...add this:


            dc.w Bonus_Main2-Bonus_Index
    We've separated Bonus_Main into two pieces, 'init' (_main) and 'main' (_main2). 'Init', the object setup, will only be processed once, and 'main', the checks, will be done on every frame.

    Hivebrain disassembly:

    Go to your Hidden Bonus object (Obj7D:) and note the basic structure: The first block of code after the routine loader is Obj7D_Main, and it begins with a bunch of checks regarding when

    not to become visible (if Sonic isn't touching the object, if Sonic is touching the object but he's in debug mode, etc), then there's code for setting up the object's visuals and awarding the player with points. Under all that is another block of code, Obj7D_DelayDel. It runs the timer for how long the object should stay visible (before it's deleted) and it jumps to DisplaySprite. Obj7D_DelayDel is only processed once Sonic has touched the object.

    The main focus here is that jump to DisplaySprite, we need that jump to be processed before Sonic touches the object. Let's begin:

    Go to Obj7D_DelayDel and replace:


            jmp    DisplaySprite
    ...with an rts. This will stop the object from displaying after it's been touched.

    Now go to Obj7D_ChkDel, and replace the rts with...


            jmp    DisplaySprite
    ...the very jump that you deleted. But wait! If you build your ROM and go to the end of the level, the hidden points are still invisible, and if you touch them, they appear for a single frame and then vanish! What's the cause? Do you remember the structure of the first block of code, Obj7D_Main? All of the checks for when not to display (or, in our case, when to display) come before the object's graphics are set up! So what we need to do is move the checks to after the graphics are set up.

    Go to Obj7D_Main, and find all of this code:


            moveq    #$10,d2
            move.w    d2,d3
            add.w    d3,d3
            lea    ($FFFFD000).w,a1
            move.w    8(a1),d0
            sub.w    8(a0),d0
            add.w    d2,d0
            cmp.w    d3,d0
            bcc.s    Obj7D_ChkDel
            move.w    $C(a1),d1
            sub.w    $C(a0),d1
            add.w    d2,d1
            cmp.w    d3,d1
            bcc.s    Obj7D_ChkDel
            tst.w    ($FFFFFE08).w
            bne.s    Obj7D_ChkDel
            tst.b    ($FFFFF7CD).w
            bne.s    Obj7D_ChkDel
            addq.b    #2,$24(a0)
    and move to after this line:


            move.b    $28(a0),$1A(a0)
    And that's it. Save and build and everything will now work.

    Except... what we did was a little hackish. Because of our changes, some of the object's code is redundant. We can go a bit further and optimise some of this code.

    Where to begin... The code that handles how long the object should wait before it's deleted after it's touched is redundant, so let's get rid of that:

    Go to Obj7D_Main and remove this line:


            addq.b    #2,$24(a0)
    and this line:


            move.w    #119,$30(a0)    ; set display time to 2    seconds
    These changes now make Obj7D_DelayDel unused. So go ahead and remove the entire thing, and then delete its entry in the index, which is this thing:


            dc.w Obj7D_Display-Obj7D_Index
    Now for the final adjustment: Making Obj7D_Main delete the object directly instead of making Obj7D_DelayDel do it. After AddPoints is jumped to and processed, the code after it is read. This code displays the sprite and does some checking. This code is used by other things, but we don't need it to be used here. Move Obj7D_Delete and its jump to in between


            jsr    AddPoints
    and


    Obj7D_ChkDel:
            move.w    8(a0),d0
    Now, instead of displaying itself (and then leaving itself occupying RAM), it deletes itself without displaying.

    One more thing... because of our adjustments, the code for setting up the object is processed every frame that the object isn't deleted. We can fix that too.

    After this:


            move.b    $28(a0),$1A(a0)
    ...add this:


            addq.b    #2,$24(a0)
            rts

    Obj7D_Main2:
    And after:


    Obj7D_Index:    dc.w Obj7D_Main-Obj7D_Index
    ...add this:


            dc.w Obj7D_Main2-Obj7D_Index
    We've separated Obj7D_Main into two pieces, 'init' (_main) and 'main' (_main2). 'Init', the object setup, will only be processed once, and 'main', the checks, will be done on every frame.

    That's all. The hidden points now display before being touched and vanish after, and we've even optimised the code a little! I've tried to explain everything so you can understand what the changes did. So excuse the enormous post.Though I should say that there's a minor side-effect: The actual graphics for the hidden points usually get loaded in to VRAM after the hidden points have already come on-screen, so for a few frames the hidden points will look horrible.
     
    Last edited by a moderator: Aug 18, 2014
  9. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    I was able to follow along, but I'm using the hivebrain dissasembly, so a good chunk of this guide didn't work at all. Also, another question: What is a good Sonic 2 dissassembly to use? I need something that works with sonlvl and can have Sonic Retro's tutorials easily applied to it.
     
  10. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    You should be able to follow most guides with either disassembly, although my Knuckles porting guide is only for the Git disassembly. SonLVL works with both disassemblies, but it can't edit start positions in the 2007 disassembly.
     
  11. Clownacy

    Clownacy Retired Staff lolololo Member

    Joined:
    Aug 15, 2014
    Messages:
    1,016
    ...

    Darn.

    *Goes to rewrite post

    Okay, how about now?
     
  12. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    So, I got a clean copy of the sonic 2 github disassembly , and immediately started following this tutorial. All i was able to do was cut and paste knuckles code into the dissasembly, where the guide said there would expectedly be errors. The issue is that I got way more errors than the guide said I should have, and although I fixed all the branches, I still got a bunch of errors I haven't seen before. The log file is attached below.

    Download
     
  13. Clownacy

    Clownacy Retired Staff lolololo Member

    Joined:
    Aug 15, 2014
    Messages:
    1,016
    The 68k has a quirk in that it can't read word or long-sized data on an odd address. This also extends to instructions. Try placing an 'even' before line 40473 of s2.asm.
     
  14. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    Thanks a lot :3

    P.S. I've noticed that I seem to dominate the Basic questions and answers thread. Is this a bad thing?
     
  15. redhotsonic

    redhotsonic Also known as RHS Member

    Joined:
    Aug 10, 2007
    Messages:
    2,969
    Location:
    England
    No, as long as you are genuinely trying to solve it yourself first before coming here.
     
  16. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    Ugh... I don't think this knuckles porting guide was built with the dissassembly I have in mind...

    After deciphering some other strange errors, I finished the section "get knuckles ingame" and tested it out, only to find that the game freezes whenever it tries to load a level as any character, not just knuckles. A copy of the ASM is here.

    Also, a copy of the knuckles asm.

    Edit: So I figured out what made the game freeze, and It loads fine now, but when I choose knuckles, I play as a really glitchy tails...
     
    Last edited by a moderator: Aug 18, 2014
  17. Sonic master

    Sonic master Well-Known Member Member

    Joined:
    Mar 27, 2010
    Messages:
    303
    I hope this does not appear to be back seat modding as this appears to be a question of opinion instead of site policy and I want to offer mine.

    What causes the need for so many questions and what do you try before hand? You at-least seem to be putting in an effort writing up the questions and at-least some effort in the topic you are asking about however I wonder how long you spend on the problem yourself. You notice that I do ask questions rarely and the reason for this is because I like to stay with the problem for a while and only when I am completely out of ideas do I ask a question. I find that even if I waste an hour on a problem it is still less time than waiting for someone to answer my question and the advantage of fixing the issue yourself especially more challenging issues is that it strengthens you, both with programming ability and in other areas of life. When I was newer at programming many years back I remember a few instances of me debugging my program for quite some time only to find that it was a silly error. I could have done it the lazy way and post a question on a relevant website. However I did not do that, instead I fixed the issue myself and what I found is that:

    1. The experience made me less likely to repeat the same mistake.

    2. After fixing the issue I felt a good sense of achievement.

    3. I understand why what I changed fix the problem. Understanding why is a far greater skill than just copying and pasting or simply memorizing something without knowing why.

    You do not get these things when asking a question and repeated reliance on others sets yourself up for failure. What happens when people stop answering your questions? By being become a better problem solver you eliminate the need to ask for help and become a better programmer as you can do the things yourself and you will also see improvements in your ability to focus on your project.

    What you should get out my post is NOT don't ask any questions ever but use questions wisely and when the need is great. There was a quote by Albert Einstein that said

    Also if you are thinking something to the effect of "but that's too much work!" or "did he say it will take longer?" ? Don't have those thoughts you will find that the more you improve yourself the easier and faster it gets and soon you will be pumping out code faster than you could write the question. I am a strong believer in the idea that people become great based on attitude and discipline meaning that one's ability is a choice and your ability is not set in stone. Overall I think following this philosophy will make you a better and faster programmer in the long run.

    Edit: Speaking of Einstein I would like to add

    I have already mentioned understanding but you see sometimes questions can help with understanding, but I think it is not the same to really do the research and learning yourself. The process and experience does matter.
     
    Last edited by a moderator: Aug 19, 2014
  18. N30member

    N30member non-pro user btw Member

    Joined:
    Feb 15, 2014
    Messages:
    216
    Location:
    Kazakhstan
    How to actually save your project in SonED2? Every time I save project and build ROM, assembler tells me that my files are empty.
     
  19. vladikcomper

    vladikcomper Well-Known Member Member

    Joined:
    Dec 2, 2009
    Messages:
    415
    Press F3 and wait until saving confirmation message appears. Saving a project may take several seconds.

    There's a bug in SonEd2 and I think this is exactly what you may be encountering. If you attempt to close editor's window *before* the confirmation message pop ups, the saving process will be interrupted and half of your files will remain empty or broken.
     
    Last edited by a moderator: Aug 19, 2014
  20. DumbLemon

    DumbLemon am back Member

    Joined:
    Aug 19, 2014
    Messages:
    115
    When i try to open a project in SonED2 (The ghz1.sep file in Sonic 1's Projects folder) it says that it can not open the tiles in the directory. I have tried placing the folder in different places and tried running it as administrator but nothing seems to be working. Help is appreciated.