Basic Questions & Answers thread

Discussion in 'Engineering & Reverse Engineering' started by Tweaker, May 29, 2008.

  1. MarkeyJester

    MarkeyJester

    Vague Memories Resident Jester
    2,052
    130
    43
    Japan
    Code (Text):
    1. SegaPCM:    incbin  sound\segapcm.bin
    2.         even
    Replace it with the following:

    Code (Text):
    1. SegaPCM:    incbin  sound\segapcm.wav,$3A
    2. SegaPCM_End even
    Then replace "segapcm.bin" with this .wav file, this should make it easier for you to edit. The $3A represents the starting offset from inside the .wav "RIFF" file where the actual PCM data starts.

    The PCM sample itself is 8-bit mono PCM. I will say though, you have to be careful with which programs you use to edit the .wav file. Some programs like to insert "xtra" data on the end of the sample, some write the header of the "RIFF" data larger/smaller than expected. But the standard expected should be $3A with no "xtra" tag. You should be fine.
     
  2. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,509
    129
    43
    SonLVL
    You can also use a program such as Audacity to export a raw PCM file, and not worry about extra data in the file. Also, the sample rate of the audio must be 16000Hz, although you can get higher or lower sample rates by altering the timing of the playback loop.
     
  3. lordxernom

    lordxernom

    Hail Darkness Member
    54
    0
    6
    Kielce
    Tails Adventure LX, Tails Adventure X-L, Sonic Limbo
    I've tried to find "SegaPCM:" in sonic.asm file, but I can't found it. How it works in Retro Github disassembly case?
     
  4. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,509
    129
    43
    SonLVL
    You'll find it in s1.sounddriver.asm.
     
  5. lordxernom

    lordxernom

    Hail Darkness Member
    54
    0
    6
    Kielce
    Tails Adventure LX, Tails Adventure X-L, Sonic Limbo
    Ok, I found and replace code and segapcm.bin file with segapcm.wav file and I got error like this: "C:\USERS\MACIEK\DESKTOP\MACIEK KUKLA\SONIC HACKING AND FAN GAMING\HACKS\SONIC 1\SONIC LIMBO - COPY\S1.SOUNDDRIVER.ASM(2618) : Error : Could not open file 'sound\segapcm.wav'
    segapcm: incbin sound\segapcm.wav,$3a"
     
  6. Knucklez

    Knucklez

    PC Engine Enthusiast Member
    663
    5
    18
    Thanks a lot. I'll work on getting the audio sample I need and put it together as best as I can. This one's just for fun.

    But I actually have plans to do what you guys would consider a "small-scale" hack of KiS2 as my first and most extensive work from my part. As much as I don't like S2, the rev with Knuckles is simpler, less buggy and I prefer Knuckles anyway. There's a short list of things I want to change and fix for consistency that I'd be proud of. So I'll try getting around to learning that disasm and modifying it with luck :specialed:
     
  7. CHRdutch

    CHRdutch

    h Member
    82
    16
    8
    Earth, I think.
    Sonic the Hackable (A.K.A. "A generic Sonic 1 ROMhack")
    You're using the GitHub version, right? Try changing

    SegaPCM: incbin sound\segapcm.wav,$3A

    to this:

    SegaPCM: incbin sound\dac\segapcm.wav,$3A
     
  8. lordxernom

    lordxernom

    Hail Darkness Member
    54
    0
    6
    Kielce
    Tails Adventure LX, Tails Adventure X-L, Sonic Limbo
    Now I have this error:
    "C:\USERS\MACIEK\DESKTOP\MACIEK KUKLA\SONIC HACKING AND FAN GAMING\HACKS\SONIC 1\SONIC LIMBO - COPY\S1.SOUNDDRIVER.ASM(2618) : Error : more than one label specified
    segapcm: segapcm: incbin sound\dac\segapcm.wav,$3a
    C:\USERS\MACIEK\DESKTOP\MACIEK KUKLA\SONIC HACKING AND FAN GAMING\HACKS\SONIC 1\SONIC LIMBO - COPY\S1.SOUNDDRIVER.ASM(2621) : Error : Expression must evaluate
    if segapcm_end-segapcm>$8000
    C:\USERS\MACIEK\DESKTOP\MACIEK KUKLA\SONIC HACKING AND FAN GAMING\HACKS\SONIC 1\SONIC LIMBO - COPY\S1.SOUNDDRIVER.ASM(2622) : Fatal error : Sega sound must fit within $8000 bytes, but you have a $
    C:\USERS\MACIEK\DESKTOP\MACIEK KUKLA\SONIC HACKING AND FAN GAMING\HACKS\SONIC 1\SONIC LIMBO - COPY\S1.SOUNDDRIVER.ASM(2622) : Error : Expression must evaluate
    inform 3,'Sega sound must fit within $8000 bytes, but you have a $%h byte Sega sound.',segapcm_end-segapcm
    C:\USERS\MACIEK\DESKTOP\MACIEK KUKLA\SONIC HACKING AND FAN GAMING\HACKS\SONIC 1\SONIC LIMBO - COPY\S1.SOUNDDRIVER.ASM(2624) : Error : Expression must evaluate
    if segapcm_end-segapcm>size_of_segapcm
    C:\USERS\MACIEK\DESKTOP\MACIEK KUKLA\SONIC HACKING AND FAN GAMING\HACKS\SONIC 1\SONIC LIMBO - COPY\S1.SOUNDDRIVER.ASM(2625) : Fatal error : Size_of_SegaPCM = $6978, but you have a $
    C:\USERS\MACIEK\DESKTOP\MACIEK KUKLA\SONIC HACKING AND FAN GAMING\HACKS\SONIC 1\SONIC LIMBO - COPY\S1.SOUNDDRIVER.ASM(2625) : Error : Expression must evaluate
    inform 3,'Size_of_SegaPCM = $%h, but you have a $%h byte Sega sound.',size_of_segapcm,segapcm_end-segapcm
    Errors during pass 1 - pass 2 aborted
    Assembly completed.
    5 error(s) from 53237 lines in 0.24 seconds"
     
  9. MarkeyJester

    MarkeyJester

    Vague Memories Resident Jester
    2,052
    130
    43
    Japan
    The first line clearly says "Error : more than one label specified", and it even showed you the line:

    "segapcm: segapcm: incbin sound\dac\segapcm.wav,$3a"

    You have two "segapcm:" labels there, you only need one label.

    Those other errors occur because they reference "segapcm:" label, but since the assembler couldn't deal with the label (because you have two), it cannot use the label for those other things. Fixing this one label problem will fix the other problems automatically =3
     
  10. lordxernom

    lordxernom

    Hail Darkness Member
    54
    0
    6
    Kielce
    Tails Adventure LX, Tails Adventure X-L, Sonic Limbo
    Still got this: C:\USERS\MACIEK\DESKTOP\MACIEK KUKLA\SONIC HACKING AND FAN GAMING\HACKS\SONIC 1\SONIC LIMBO - COPY\S1.SOUNDDRIVER.ASM(2621) : Error : Expression must evaluate
    if segapcm_end-segapcm>$8000
    C:\USERS\MACIEK\DESKTOP\MACIEK KUKLA\SONIC HACKING AND FAN GAMING\HACKS\SONIC 1\SONIC LIMBO - COPY\S1.SOUNDDRIVER.ASM(2622) : Fatal error : Sega sound must fit within $8000 bytes, but you have a $
    C:\USERS\MACIEK\DESKTOP\MACIEK KUKLA\SONIC HACKING AND FAN GAMING\HACKS\SONIC 1\SONIC LIMBO - COPY\S1.SOUNDDRIVER.ASM(2622) : Error : Expression must evaluate
    inform 3,'Sega sound must fit within $8000 bytes, but you have a $%h byte Sega sound.',segapcm_end-segapcm
    C:\USERS\MACIEK\DESKTOP\MACIEK KUKLA\SONIC HACKING AND FAN GAMING\HACKS\SONIC 1\SONIC LIMBO - COPY\S1.SOUNDDRIVER.ASM(2624) : Error : Expression must evaluate
    if segapcm_end-segapcm>size_of_segapcm
    C:\USERS\MACIEK\DESKTOP\MACIEK KUKLA\SONIC HACKING AND FAN GAMING\HACKS\SONIC 1\SONIC LIMBO - COPY\S1.SOUNDDRIVER.ASM(2625) : Fatal error : Size_of_SegaPCM = $6978, but you have a $
    C:\USERS\MACIEK\DESKTOP\MACIEK KUKLA\SONIC HACKING AND FAN GAMING\HACKS\SONIC 1\SONIC LIMBO - COPY\S1.SOUNDDRIVER.ASM(2625) : Error : Expression must evaluate
    inform 3,'Size_of_SegaPCM = $%h, but you have a $%h byte Sega sound.',size_of_segapcm,segapcm_end-segapcm
    Errors during pass 1 - pass 2 aborted
    Assembly completed.
    4 error(s) from 53237 lines in 0.26 seconds
     
  11. MarkeyJester

    MarkeyJester

    Vague Memories Resident Jester
    2,052
    130
    43
    Japan
    It seems the disassembly you are using has put in extra measures to ensure the ROM assembles correctly, and in the process has made it more difficult to edit.

    The original Sonic the hedgehog title expects the SEGA sample to be at a specific location. What's worse, is the Z80 code for playing back the sample does not change the window address while playing, so if the sample crosses over a $8000 68k memory boundary, the Z80 will wrap its address back to 0000, and start reading the Z80 RAM data as PCM data. The messages you are getting are measures to help ensure that none of the conditions I've just mentioned are breached.

    I would probably throw this at you: http://info.sonicretro.org/SCHG_How-to:Fix_the_SEGA_Sound Since this will ensure the 68k writes the data instead of the Z80, but the disassembly you are using is structured differently, and you'll have to rip out all of those "helpful measures" that the disassembly creators have so kindly provided you =|
     
  12. Chainspike

    Chainspike

    Stealing rings since 1994 Member
    163
    58
    28
    Death Egg Zone
    S3C Delta
    I was trying to get the Sonic 2 clone driver to work in my hack following this guide. It was not hard to follow until it said that the driver only works with the AS Macro Assembler. I have been trying for hours to get the disassembly to assemble using it and I have no idea how do it. Help is very much appreciated.
     
  13. Clownacy

    Clownacy

    Tech Member
    807
    39
    28
    You can't just copy/paste a new assembler into an existing disassembly and expect it to work. Converting is a pretty insane task, when you get down to it. You'd be better off rebasing your hack on a different disassembly, that's already been ported to AS.
     
  14. Chainspike

    Chainspike

    Stealing rings since 1994 Member
    163
    58
    28
    Death Egg Zone
    S3C Delta
    Okay then, do I have to use the Sonic 2 Xenowhirl disassembly or is there another good disassembly that uses AS?
     
  15. Clownacy

    Clownacy

    Tech Member
    807
    39
    28
    There's a list of supported disassemblies here. The only common non-AS disassembly I know of is Sonic 1 Hivebrain/Git.
     
  16. Chainspike

    Chainspike

    Stealing rings since 1994 Member
    163
    58
    28
    Death Egg Zone
    S3C Delta
    I tried using the sound driver with the Sonic 2 Github disassembly and I got this: '"win32/asw"' is not recognized as an internal or external command, operable program or batch file."
     
  17. So, I followed this guide as a basis to begin adding a new playable character for Sonic 3 and Knuckles. Problem is, while I've done everything the tutorial told me to do and it works, there's one part it mentions I haven't understood:

    It doesn't go into any greater detail. I have an extra sprite added into the mappings and art tiles, but if I put the new sprite in after Knuckles and before the "Del" it shifts every sprite afterwards to the next space. I have the new sprite at the end of the mappings, but no clue how to get it to appear.

    Also, how should I go about getting other things to work such as the life icon, character sprites, continue icon, etc.? And disable the gliding and breakable rocks for the character like Sonic too, if possible.
     
  18. lordxernom

    lordxernom

    Hail Darkness Member
    54
    0
    6
    Kielce
    Tails Adventure LX, Tails Adventure X-L, Sonic Limbo
    I started experimenting with S1 Dual PCM sound driver and I have one issue - I replaced S1 Kick sample with Postal 1 OST Outskirts sample, but in ROM it plays S1 Kick instead of that sample. I used ConvPCM.exe - doesn't work. Somebody knows how to fix it? Here's a video how my issue looks:

    http://www.youtube.com/watch?v=uuF8UnuPhY8&feature=youtu.be
     
  19. MarkeyJester

    MarkeyJester

    Vague Memories Resident Jester
    2,052
    130
    43
    Japan
    You'll need to elaborate. When you said "I used ConvPCM.exe", how did you use it? What did you do exactly? You did not use it in that video from what I could see.

    I can help you, but I need more information.
     
  20. lordxernom

    lordxernom

    Hail Darkness Member
    54
    0
    6
    Kielce
    Tails Adventure LX, Tails Adventure X-L, Sonic Limbo
    Well, I drag/drop S1 Kick.wav after I replaced original S1 Kick.wav and renamed with my sample and no changes. Before that my sample was 8-bit 16000hz Mono.