Basic Questions and Answers Thread

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

  1. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France
    Damn. I can't realize that I've been missing this and confusing myself. I have to admit I feel stupid, haha! Thank you so much for the explanation!
     
  2. DeltaWooloo

    DeltaWooloo The noob next door Member

    Joined:
    Aug 7, 2019
    Messages:
    373
    Screenshot_20200206-205108.jpg
    Do I need to explain this in detail? Any object will make Sonic balance besides tilesets. How can I fix it?
     
  3. Inferno

    Inferno Rom Hacker Member

    Joined:
    Oct 27, 2015
    Messages:
    132
    Location:
    Sky Base Zone, South Island
    So, do you mean that he'll balance no matter what while on the object, or he'll balance where he shouldn't, but he isn't always balancing? It'd be helpful if you mentioned anything you did with the code to potentially cause this issue. If you have any ideas, please bring the potential causes up.

    If I'm answering too late and you already figured it out, sorry.
     
  4. DeltaWooloo

    DeltaWooloo The noob next door Member

    Joined:
    Aug 7, 2019
    Messages:
    373
    So on any object, he'll go into his balancing animation. He can still duck. Unfortunately, I don't have my laptop on me to show the code, but I will in a couple of hours time.
     
  5. DeltaWooloo

    DeltaWooloo The noob next door Member

    Joined:
    Aug 7, 2019
    Messages:
    373
    Here is the code Screenshot 2020-02-07 at 19.16.23.png Screenshot 2020-02-07 at 19.16.45.png
    Hope it goes well!
     
  6. DeltaWooloo

    DeltaWooloo The noob next door Member

    Joined:
    Aug 7, 2019
    Messages:
    373
    So while someone is trying to sort out my issue up above, I have another question.

    I have used the Chaotix to SMPS app to add KC songs to Sonic 1. They've worked, but there is one issue...

    NO DAC!

    What is the best solution to fix it via hex or anything?
     
  7. Devon

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

    Joined:
    Aug 26, 2013
    Messages:
    1,372
    Location:
    your mom
    The 32X has an extra sound chip that plays back stereo PWM samples. IIRC, Chaotix uses a PWM driver that processes 4 mono (I think) PWM samples and plays them through that sound chip. I am pretty certain that Chaotix uses PWM for drums, hence why you are not getting any DAC playback in your conversions. You can probably get the samples converted properly to be played back via DAC, though.
     
    MarkeyJester likes this.
  8. DeltaWooloo

    DeltaWooloo The noob next door Member

    Joined:
    Aug 7, 2019
    Messages:
    373
    I already know about the PWM, I only want to know the best way to allow DAC to be in the music. What is the best solution for DAC to work with the music?
     
  9. AsuharaMoon

    AsuharaMoon kakyoin did you lay this egg Member

    Joined:
    Aug 15, 2013
    Messages:
    67
    Even so, that app made by Markey is awfully outdated (2011), and doesn't garantize all the conversions to be nearly decent. Maybe SMPSConv could get some better results if you know how Z80's offsets works, as well dealing with the FM and PWM channels.
     
    MarkeyJester likes this.
  10. DeltaWooloo

    DeltaWooloo The noob next door Member

    Joined:
    Aug 7, 2019
    Messages:
    373
    I do know how Z80 works and how SMPSConv works. The only downside is the way I have to convert the tracks. Since they are all in .KC format in the SMPS Research Pack, SMPSConv doesn't fully support these tracks. Did you try to use the converter yourself and made Chaotix .bins yourself?
     
    Last edited: Feb 9, 2020
  11. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    As Ralakimus pointed out, the 32X has two PWM channels, one for left speaker and one for right speaker. The audio is passed vis software (similar to DAC), so software mixing is viable. Knuckles Chaotix uses software mixing to mix four mono samples (as Ralakimus also pointed out) to both the left and right speaker, but it'll also control the volume via software through both in order to control panning.

    Also as AshuraMoon pointed out; In 2010 (not 2011 d=) I wrote the tool to rip out and convert the tracks so they would be compatible with Sonic 1's SMPS driver. But only the FM and PSG portions of the music tracks would be converted, the DAC pointer will point to an F2 stop flag, thus ensuring that FM6 runs. The idea was for you to handle the DAC later yourself, by sacrificing the channels which you thought would have the less impact on the song as a whole, even if by means of ripping unnoticeable segments from two channels in different spots, and fusing the two channels together in the respective spots. Had I have simply muted FM6 and attempted drums, many songs would not have sounded as vibrant than if you were to do it manually with love, care, and attention.

    All DAC pointers (at offset 6) will point to offset 3F, there is an F2 there to stop it. You can repoint this to the end of the SMPS data if you wish, and start adding in your own tracker notes for DAC, but it will have to be done with a hex editor, and with attention to detail. For example, in "Chaotic_World.bin" you would change the pointer to point to 5D8 which is at the end of the file, you would then insert your notes. For example, you could add "81 10 82 F6 FF FB" to the end, and it'll play note/samples 81 and 82 in a loop with 10 ticks apart, this example should get you started. Do read up on ValleyBell's work though, he has brought into the scene newer and more powerful tools which may assist you better, and it's worth digging.

    Remember though, Ralakimus and AshuraMoon are only trying to help you out, your post is coming off as a little aggressive, you might want to back peddle just a little bit, we understand it's frustrating but you don't want to turn away the only people who are offering any help at all, for the next time you ask a question, you might be greeted with silence.
     
  12. DeltaWooloo

    DeltaWooloo The noob next door Member

    Joined:
    Aug 7, 2019
    Messages:
    373
    I do apologize for the inconvenience for my aggressiveness. I just wanted the things I want but it felt stressful. Thanks for the help and I'll see if it works! :D

    My only concern is how can I convert it via SMPSConv since it doesn't support it and I find it difficult to locate the Z80 Pointers for each piece of music. The only was to convert pieces on SMPSConv are:
    Sonic 1
    Sonic 2
    Sonic 3K
    .trs
    .tra
    .ors
    .rst

    But no Chaotix music. I gave it a go but the results was loud beeps and unmapped DAC and not the music.
     
  13. AURORA☆FIELDS

    AURORA☆FIELDS so uh yes Exiled

    Joined:
    Oct 7, 2011
    Messages:
    759
    What I did for my Door Into Summer conversion to AMPS was to convert the binary file into SMPS2ASM with my own SMPS2ASM (I believe the script exists in MDMusicPlayer still), and then just merged FM6 with another FM channel, and the 4 PWM channels into one. This means the conversion is not perfect, there are missing notes and missing DAC, and this certainly wasn't all that eady to do. My recommendation is not to attempt porting Chaotix songs unless you are comfortable with SMPS2ASM already, because its not easy afterall
     
  14. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    If the particular song you want exists in Sonic Crackers, it would be a lot easier to use those versions.
     
  15. DeltaWooloo

    DeltaWooloo The noob next door Member

    Joined:
    Aug 7, 2019
    Messages:
    373
    I do want these versions, but I prefer really well know musics such as "Door into Summer" and "Surging Power"
     
  16. penPhobic

    penPhobic Everything's all topsy-turvy now. Member

    Joined:
    Dec 11, 2016
    Messages:
    67
    Location:
    Basement
    One more question to ask. I'm curious why does object or enemy disappear and then you go backwards and said object or enemy is back. Spring Yard Zone comes to mind. Is that due to limited spaces or is just a bug?
     
  17. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    In the object layout, certain objects have a flag known as "remember sprite", when the object is loaded (when its in range of the screen's object load range) this causes the object to store a remember state RAM address and set that RAM address's MSB (Most Significant Bit). If the screen should cause the object to go out of the load range, the object will clear the MSB of the remember state RAM address, and then delete itself.

    If you destroy an enemy for example, the object will become deleted. Because it's deleted, it won't be processing, thus, it won't check if it's gone out of the screen/object load range, and therefore, it will not clear that MSB of the remember state RAM. So, that MSB bit will always be set. If you go off screen and come back on, the object load engine won't load that object if the MSB of the remember byte is set. So it counts as being remembered as being destroyed.

    The only way of causing an object to reload even if it was destroyed, is if:

    1. The object layout does not have the "remember sprite" flag set. The object won't be given a remember RAM space, therefore it will always load.
    2. The object isn't programmed correctly, that is to say it does not handle the remember RAM space correctly when being destroyed (this should be impossible if the object is set as a touch response which represents an enemy, but the opposite problem can occur if you do not clear the MSB (which can be done via jumping to "MarkObjGone" or whatever it might be called on GIT)).
    3. Too many objects loaded at once. The object load subroutine has a bug where the remember RAM space comes out of sync, but ONLY if there are too many objects. If the dynamic RAM list is full, the subroutine can incorrectly handle the loading of objects, but it seems to be only in one direction (I forget which, but I made a fix for it on Retro's wiki, don't ask me to hunt it down for you, because I'm certain your problem is reason 1.)
    4. See 1. again.
     
  18. TheInvisibleSun

    TheInvisibleSun Visible Member

    Joined:
    Jul 2, 2013
    Messages:
    424
    Location:
    Western New York, USA
    I'll add that SonLVL conveniently has a toggle for scenario #1, so that's an easy way to check that possibility (especially if you haven't modified the objects' code). Scenario #3 might explain an issue I had with this a long time ago however, where certain destroyed enemies seemed to reload at random, even though the flag was set properly.
     
    ProjectFM and penPhobic like this.
  19. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    Assuming you have object definitions set up properly for the objects in question, SonLVL should automatically set the remember state flag when placing objects.
     
    AURORA☆FIELDS likes this.
  20. DeltaWooloo

    DeltaWooloo The noob next door Member

    Joined:
    Aug 7, 2019
    Messages:
    373
    I want Sonic to do his end pose animation since I ported his sprites from S3K. His animation for the end pose is 23. I kept trying to mess around with "GotThroughAct:" and "Sonic_ResetOnFloor" but I have the same results, messed up animations or other issues. How can I do it?