Basic Questions and Answers Thread

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

  1. redhotsonic

    redhotsonic Also known as RHS Member

    Joined:
    Aug 10, 2007
    Messages:
    2,969
    Location:
    England
    Personally, I'd stick with what you got. The HG version at Retro is the most up to date version, but I do not get on with it. What I'd do is download it anyway, and have a good look at it, and see which one you'd prefer.
     
  2. MrSpade

    MrSpade It's meant to be Mr_Spad3 but y'know... Member

    Joined:
    Dec 5, 2009
    Messages:
    172
    Location:
    The UK
    Kay. Well I've stuck with the '07 disassem and effectively restarted my project (The old one had some nasty conflicts in the vram which I couldn't be bothered to root out and fix).

    Question now: How would I disable the 2P VS mode option on the title screen and make the options selector replace it? (So, only two selectable choices are available on the title screen)

    EDIT: Yay... More embarrassing questions:

    Whilst trying to apply a new font to the 1Player/2PlayerVS text on the title screen, sonMapEd decided to recompress the art file 9 bytes larger than before (Even though I haven't added anything more to the file apart from replacing the letters with the new font). Due to this art file being a tad larger in size, it's throwing what I would guess to be close to about 1000 'Address not aligned' warnings each build.

    The culprit: (Old font and new font respectively)

    [​IMG] [​IMG]
     
    Last edited by a moderator: Dec 18, 2012
  3. vladikcomper

    vladikcomper Well-Known Member Member

    Joined:
    Dec 2, 2009
    Messages:
    415
    It turns out that by increasing data size by the odd number of bytes you misaligned all the instructions after it. The Motorola 68000 processor needs all the instructions (opcodes) to be aligned on even addresses, like $00000, $00002 etc. If the assembler finds the instruction to be on the odd address, like $00003, $00005 etc, it will generate an 'Address not aligned' error for you (it applies to AS assembler used in S2 2007's disassembly, not ASM68K one used in Sonic 1 disasm for example).

    To fix this, add even directive after you included the data. I assume you was working with this art:



    ; ---------------------------------------------------------------------------------
    ; Nemesis compressed art


    ; 10 blocks


    ; Player 1 2 VS Text


    ; ---------------------------------------------------------------------------------


    ; ArtNem_3DF4:


    ArtNem_Player1VS2:    BINCLUDE    "art/nemesis/1Player2VS.bin"



    Then change it to this:



    ; ---------------------------------------------------------------------------------
    ; Nemesis compressed art


    ; 10 blocks


    ; Player 1 2 VS Text


    ; ---------------------------------------------------------------------------------


    ; ArtNem_3DF4:


    ArtNem_Player1VS2:    BINCLUDE    "art/nemesis/1Player2VS.bin"


                even
     
    Last edited by a moderator: Dec 18, 2012
  4. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    Step 01 - Changing the number of selections within the menu.

    Find the lable "Obj0F_Main:", you will have the following code inside:

    btst #0,d0
    beq.s +
    subq.b #1,d2
    bcc.s +
    move.b #2,d2
    +
    btst #1,d0
    beq.s +
    addq.b #1,d2
    cmpi.b #3,d2
    bcs.s +
    moveq #0,d2
    +This code checks the buttons being pressed, specifically for up and down, and here is what each instruction does:

    btst #0,d0 ; has the up button been pressed?
    beq.s + ; if not, branch to the + sign
    subq.b #1,d2 ; decrease selection by 1
    bcc.s + ; if it is still 0 or above, branch to the + sign
    move.b #2,d2 ; if it has gone below 0, change the selection back to 2
    +
    btst #1,d0 ; has the down button been pressed?
    beq.s + ; if not, branch to the next + sign
    addq.b #1,d2 ; increase selection by 1
    cmpi.b #3,d2 ; has the selection reached 3 or above?
    bcs.s + ; if not, then branch to the next + sign
    moveq #0,d2 ; if it has gone above 2, change the selection back round to 0 again
    +Here, the selection is held inside the d2 register, 0 is "1 PLAYER", 1 is "2 PLAYER VS" and 2 is "OPTIONS", these are your three selections (0, 1 and 2), but you only want 2 selections, so, we need to knock out 2 leaving only 0 and 1, to do so, change the following:

    btst #0,d0
    beq.s +
    subq.b #1,d2
    bcc.s +
    move.b #1,d2 ; <- change to 1 (if the selection has gone below 0, it will now change to 1 instead of 2)
    +
    btst #1,d0
    beq.s +
    addq.b #1,d2
    cmpi.b #2,d2 ; <- change to 2 (if it has reached 2 or above instead of 3 or above, it will now change to 0)
    bcs.s +
    moveq #0,d2
    +The next thing to do is to change selection 1 to go to the options menu instead of the player 2 menu, to do so, find "TitleScreen_Loop:", you'll have the following code inside:

    moveq #0,d0
    move.b (Title_screen_option).w,d0
    bne.s TitleScreen_CheckIfChose2P ; branch if not a 1-player gameThis will load the selection number that I explained just a while ago (0, 1 or 2), this will check if the selection is 0 or not, if it is not 0, then it will branch to "TitleScreen_CheckIfChose2P" where it will check if the selection is 1 or 2, and then branch to the correct menu, simply change the word "TitleScreen_CheckIfChose2P" to "TitleScreen_ChoseOptions" like so:

    moveq #0,d0
    move.b (Title_screen_option).w,d0
    bne.s TitleScreen_ChoseOptions ; branch if not a 1-player gameThat way, it'll go directly to the options menu if the selection is not 0.

    The final thing to do is changing the sprite mappings, running the game you will see that it still shows the second menu selection as "2 PLAYER VS" which is not what you want, this is the sprite mapping file you will want to edit:

    "mappingsspriteobj0F.bin"​
    Open it with a hexadecimal editor, you will see the following values:

    00 06 00 48 00 8A 00 08 F4 00 64 02 62 01 FF D4

    F4 0C 64 03 62 01 FF E4 F4 04 64 07 62 03 00 04

    04 00 04 09 02 04 FF D4 04 0C 04 03 02 01 FF E4

    04 04 04 07 02 03 00 04 04 04 04 0A 02 05 00 1C

    F4 04 63 FA 61 FD FF BC 00 08 F4 00 04 02 02 01

    FF D4 F4 0C 04 03 02 01 FF E4 F4 04 04 07 02 03

    00 04 04 00 64 09 62 04 FF D4 04 0C 64 03 62 01

    FF E4 04 04 64 07 62 03 00 04 04 04 64 0A 62 05

    00 1C 04 04 63 FA 61 FD FF BC 00 08 F8 00 66 9C

    63 4E FF DC F8 00 66 9D 63 4E FF E4 F8 00 66 A1

    63 50 FF EC F8 00 66 96 63 4B FF F4 F8 00 66 9C

    63 4E FF FC F8 00 66 9B 63 4D 00 04 F8 00 66 A0

    63 50 00 0C F8 04 63 FA 61 FD FF BC

    These values are responsible for displaying the words of the title screen menu correctly, now, you'll see that I've highlighted one of them blue, I thought I'd give you a little insight, that blue text there, is the letter "P" of the options:

    F8 = Y position (vertical)

    00 = Shape (1 tile)

    66A1 = VRAM address (pattern index referrence)

    6350 = VRAM address (pattern index referrence) for two player mode

    FFDC = X position (horizontal)

    So, if you wanted to move it up by 4 pixels for example, you would subtract 4 from F8, which is F4, if you wanted to move it right by 9 pixels, you add 9 to FFDC, which is FFE5. If you'd like to experiment, then I strongly advise it, I have however, provided you with what you want to make "Options" display with "1 Player", simply change all the values to this below:

    00 04 00 56 00 0A F4 00 64 02 62 01 FF D4 F4 0C

    64 03 62 01 FF E4 F4 04 63 FA 61 FD FF BC F4 04

    64 07 62 03 00 04 04 04 06 9C 03 4E FF D4 04 00

    06 A1 03 50 FF E4 04 00 06 96 03 4B FF EC 04 00

    06 9C 03 4E FF F4 04 00 06 9B 03 4D FF FC 04 00

    06 A0 03 50 00 04 00 0A F4 00 04 02 02 01 FF D4

    F4 0C 04 03 02 01 FF E4 F4 04 04 07 02 03 00 04

    04 04 63 FA 61 FD FF BC 04 04 66 9C 63 4E FF D4

    04 00 66 A1 63 50 FF E4 04 00 66 96 63 4B FF EC

    04 00 66 9C 63 4E FF F4 04 00 66 9B 63 4D FF FC

    04 00 66 A0 63 50 00 04
     
    Last edited by a moderator: Dec 18, 2012
  5. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    How you can edit mappings in hex like that I have no idea.
     
  6. MrSpade

    MrSpade It's meant to be Mr_Spad3 but y'know... Member

    Joined:
    Dec 5, 2009
    Messages:
    172
    Location:
    The UK
    Well everything apart from the Hex was easy enough to understand. Currently trying to center the options text so it matches with the 1 Player option. (I only need to move it to the right 8 or so pixels, but it's proving difficult since Hex Workshop doesn't let you undo past a save point, so I can trial-and-error it.)

    Oh, and SonMapEd doesn't want to play ball either. So much fun when you're trying to re-learn this stuff. ._.
     
  7. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    Right then...

    00 04 00 56 00 0A F4 00 64 02 62 01 FF D4 F4 0C

    64 03 62 01 FF E4 F4 04 63 FA 61 FD FF BC F4 04

    64 07 62 03 00 04 04 04 06 9C 03 4E FF D4 04 00

    06 A1 03 50 FF E4 04 00 06 96 03 4B FF EC 04 00

    06 9C 03 4E FF F4 04 00 06 9B 03 4D FF FC 04 00

    06 A0 03 50 00 04 00 0A F4 00 04 02 02 01 FF D4

    F4 0C 04 03 02 01 FF E4 F4 04 04 07 02 03 00 04

    04 04 63 FA 61 FD FF BC 04 04 66 9C 63 4E FF D4

    04 00 66 A1 63 50 FF E4 04 00 66 96 63 4B FF EC

    04 00 66 9C 63 4E FF F4 04 00 66 9B 63 4D FF FC

    04 00 66 A0 63 50 00 04

    OPTIONS

    Add 8 (in hex) to each of those highlighted to move them right by 8 pixels:

    00 04 00 56 00 0A F4 00 64 02 62 01 FF D4 F4 0C

    64 03 62 01 FF E4 F4 04 63 FA 61 FD FF BC F4 04

    64 07 62 03 00 04 04 04 06 9C 03 4E FF DC 04 00

    06 A1 03 50 FF EC 04 00 06 96 03 4B FF F4 04 00

    06 9C 03 4E FF FC 04 00 06 9B 03 4D 00 04 04 00

    06 A0 03 50 00 0C 00 0A F4 00 04 02 02 01 FF D4

    F4 0C 04 03 02 01 FF E4 F4 04 04 07 02 03 00 04

    04 04 63 FA 61 FD FF BC 04 04 66 9C 63 4E FF DC

    04 00 66 A1 63 50 FF EC 04 00 66 96 63 4B FF F4

    04 00 66 9C 63 4E FF FC 04 00 66 9B 63 4D 00 04

    04 00 66 A0 63 50 00 0C

    It might not be easy to grasp, but it is logically simple...
     
    Last edited by a moderator: Dec 19, 2012
  8. MrSpade

    MrSpade It's meant to be Mr_Spad3 but y'know... Member

    Joined:
    Dec 5, 2009
    Messages:
    172
    Location:
    The UK
    I understand hex pretty well, it's just finding out what bits did what in the mapping :p

    Aaaand more questions to the mix: Where are the highlighted text mappings located? Cause with your help I've only managed to move over the deselected options text.

    Apologies if I'm asking far too many questions. :S
     
    Last edited by a moderator: Dec 19, 2012
  9. SpirituInsanum

    SpirituInsanum Well-Known Member Member

    Joined:
    Feb 11, 2010
    Messages:
    642
    Does anyone have a good method for finding unused art tiles in a level art file? At this point every tile is precious.
     
  10. redhotsonic

    redhotsonic Also known as RHS Member

    Joined:
    Aug 10, 2007
    Messages:
    2,969
    Location:
    England
    No, I don't, but if you ever find out, let me know instantly.
     
  11. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    I recommend writing an algorithm that will function during the level to collect the necessary information on used/unused tiles, by reading the plane mapping and sprite pattern index values (voiding the plane, palette, flip, mirror values), you can write up a list in a rewritable memory space (such as 68k RAM), either; read from VRAM to collect the values, or alter the routines responsible for writing the values to VRAM and getting it to store them while it's writing them, the latter would probably allow for quicker processing power, though the former would mean less chance of fucking up the current routines.

    You will need to move around the level once done though, to ensure that all used tiles display (including sprites), and being careful of special events such as boss fights and end of level art, additionally you'll want to pay attention to seperate acts using tiles exclusively.

    For storage, it will require 1000 bytes of memory (800 words for the 800 possible tile IDs), I recommend setting all of the values from 0000 to 07FF, and clearing them in RAM when used, this will leave the unused values which you will be able to see, if you do not have 1000 bytes to spare, then perhaps a "simple" compression method of sorts, like "from - to", by that I mean for example:

    00FF0000: 00 20 00 28 00 5F 01 14 04 F2 04 F3 05 00 05 FF

    00FF0010: 07 6F 07 FF 00 00 00 00 00 00 00 00 00 00 00 00

    00FF0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

    In this case, tiles 0020 to 0028 are unused 005F to 0114 are also used, and so forth.

    There might be several other ways of collecting the information desired, but I find the one above will give you it with the most accuracy.

    If you are referring to just the level art itself, then perhaps you should write a tool to read from the layouts/chunks/blocks to read which tiles, blocks and chunks are unused and erase them whilst shifting the data up, and I say layout"s" due to different acts having the ability to use exclusive chunks, blocks and tiles.
     
    Last edited by a moderator: Dec 21, 2012
  12. OrdosAlpha

    OrdosAlpha RIGHT! Naebody move! Root Admin

    Joined:
    Aug 5, 2007
    Messages:
    1,793
    Location:
    Glasgow, Scotland
    Stealth's E02 engine has a Level Ripper that will import tiles while ignoring duplicates. If I'm right, then you should be able to use SonED2 to export and import art to and from the E02 engine.
     
  13. SpirituInsanum

    SpirituInsanum Well-Known Member Member

    Joined:
    Feb 11, 2010
    Messages:
    642
    Importing the art would cause several issues (especially destroying the tile order where it's necessary) which is especially unfortunate since it would remove duplicates I create myself without knowing.

    So it seems the easier would be to create a list of tiles, read which ones are used from the block file and remove them from the list. :/

    (Then export the list, figure I messed up and the number are wrong, try again... xD )

    Well, I'll try that, thanks for your answers.
     
    Last edited by a moderator: Dec 22, 2012
  14. vladikcomper

    vladikcomper Well-Known Member Member

    Joined:
    Dec 2, 2009
    Messages:
    415
    SpirituInsanum, I had some free time this evening and a strong urge to program something, so here you go:

    https://dl.dropbox.com/u/44757401/LevTileFinder.7z

    This is a small tool to find unused tile in 16x16 block mappings. Just unpack the archive somewhere, take a file you need from map16 folder of your disassembly and drag&drop it on the LevTileFinder.exe. The program will display range of tiles that the mappings use and list all the unused tile IDs in hex. Note that it checks all the 16x16 blocks, so it relies that you use them all in the level layout.

    EDIT: By djohe's request, I've just made Sonic 2 version of it. Everything is the same, except for mappings being decompressed from Kosinski format, which used in Sonic 2 instead of Sonic 1's Engima.

    https://dl.dropbox.com/u/44757401/LevTileFinder_S2.7z.
     
    Last edited by a moderator: Dec 24, 2012
  15. Dark Lips

    Dark Lips Well-Known Member Member

    Joined:
    Nov 14, 2008
    Messages:
    293
    Location:
    Wolverhampton UK
    Hi guys, I am having trouble getting the spindash dust object to load in the sonic 2 beta, I have copied the spindash code from the final, and have checked that the dust object is being loaded with sonic but it still dosnt show - any ideas?
     
  16. vladikcomper

    vladikcomper Well-Known Member Member

    Joined:
    Dec 2, 2009
    Messages:
    415
    There can be a number of reason for this:

    • The Spin Dust tiles are not being loaded proprely (DPLC issue), so sprites display empty tiles
    • The Spin Dust object is broken
    • The Spin Dust object is loaded, but not being set correctly to display animation when it's needed.
    • Combination of the above
    ... and plenty of unobvious issues.

    Please give us more info about what you did, more details on the changed/added code etc.
     
  17. Dark Lips

    Dark Lips Well-Known Member Member

    Joined:
    Nov 14, 2008
    Messages:
    293
    Location:
    Wolverhampton UK
    basicaly I have tried to add the dust as if it was a a sonic 1 rom as per the guide on retro - something I have done many times in sonic 1 but with the sonic 2 beta it would seem I am missing something.
     
  18. SuperEgg

    SuperEgg I'm a guy that knows that you know that I know Member

    Joined:
    Oct 17, 2009
    Messages:
    Location:
    THE BEST GOD DAMN STATE OF TEXAS
    Nah vlad, I know the issue. Sonic 2 Beta doesn't have enough free VRAM because of the horribly done 2 player mode. Instead of having all that free space to place in art, you're kinda limited. That's the reason why the splash art doesn't load properly, because instead of the splash, it loads the air bubble art instead. I'm currently trying to fix this issue as we speak, and the next release of the S2B disasm will have this problem properly addressed.
     
  19. Suler

    Suler Experimentator Member

    Joined:
    Jul 15, 2012
    Messages:
    31
    I was started to learn "How to convert music", my teacher - Suler_Maxwell=).

    Is there ways to have more than 9 (5 voices and 4 for drums)?

    Is asm changes a way? Is hex-music-hacking a way?
     
  20. vladikcomper

    vladikcomper Well-Known Member Member

    Joined:
    Dec 2, 2009
    Messages:
    415
    I assume by 'voices' in the question you were referring to actual sound channels used in songs. In this case the answer is no.

    Sega Genesis has two sound chips: YM 2612 and PSG, which gives you 10 sound channels in total: 6 FM and 4 PSG channels.The FM 6 channel can be used to output digital sound, and PSG 4 is a noise generator. This is all the hardware that provides you, you physically can't have more.

    Apparently, SMPS allows you to use only 3 PSG channels at once, as far as I know (which is 9 channels in total), because PSG noise generator somehow depends on PSG 3's frequency or something (I don't remember exactly), using all four PSGs would be quite problematic.
     
    Last edited by a moderator: Jan 30, 2013