SonLVL

Discussion in 'Engineering & Reverse Engineering' started by MainMemory, Feb 7, 2011.

  1. Fred

    Fred

    Formerly known as 'Neo' Oldbie
    1,529
    60
    28
    Portugal
    Sonic 3 Unlocked
    I have a feature request!

    It would be super useful if in the advanced remap tools, any unassigned entries on the left could simply be copied sequentially to the first open spots on the right. Essentially, after copying the user-set remaps, go through both lists and copy from X to Y, skipping over any X or Y entries which were already set by the user. As an example, imagine I set up the following remaps:

    7 -> 1
    8 -> 2
    9 -> 3
    6 -> 6

    SonLVL would fill in the blanks as such:

    7 -> 1
    8 -> 2
    9 -> 3
    1 -> 4
    2 -> 5

    6 -> 6
    3 -> 7
    4 -> 8
    5 -> 9

    A -> A
    B -> B
    ...

    This would make it really easy to push a range to a desired location, while not messing with the overall order and still allowing to keep specific entries where they are by doing X -> X style mappings.
     
  2. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,422
    72
    28
    SonLVL
    New tool: Sprite Sheet Generator.

    Code (Text):
    1. Usage: spritesheetgen [options] input output
    2.  
    3. Input is an INI file containing art, mappings, palette, etc like SonLVL.
    4. Output is a PNG file.
    5.  
    6. Arguments:
    7.  
    8.     -h, --help              Shows this help screen.
    9.     -p, --padding=number    Pixels of padding between sprites. Default 2.
    10.     -c, --columns=number    Number of columns per row. Default 8.
    11.     -w, --width=number      Width of the image. As many sprites will be placed in each row as possible.
    12.     -g, --grid              Align all sprites in a grid.
    13.     -b, --background=color  Background color, as a name or #RRGGBB. Default Transparent.
    SpriteSheetGen.exe -c 16 -g -b Fuchsia example.ini SpriteSheetGen-example.png
    [​IMG]
     
  3. Fred

    Fred

    Formerly known as 'Neo' Oldbie
    1,529
    60
    28
    Portugal
    Sonic 3 Unlocked
    Could you add a feature to allow overloading the block list on SonLVL?

    I'm trying to import some Sonic CD stuff into S3K (don't ask) and whenever a block higher than $2FF is referenced, it throws an ArgumentOutOfRangeException even though the "SSTT YXII IIII IIII" chunk format should be able to address up $400 blocks. I know the collision array won't allow for more than $300 block definitions, but there's no reason it couldn't handle the full $400 during execution and then just truncate the output file.

    EDIT: Also I should point out that my previous feature request is void, I wrote a small C program that solved my problem for me.
     
  4. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,422
    72
    28
    SonLVL
    SonLVL has no problem referencing any number of blocks, it's the collision index list that it's failing to read. The way I see it, there are three options: 1. remove some unneeded blocks before converting/importing so you have $300 or less total 2. switch to Sonic 1 or Sonic 2 collision indexes 3. I could add a whole bunch of code to catch out-of-range collision indexes and return 0/disable the selectors. Truncating the output file would just open me up to a bunch of "why isn't my collision working" bug reports.
     
  5. Fred

    Fred

    Formerly known as 'Neo' Oldbie
    1,529
    60
    28
    Portugal
    Sonic 3 Unlocked
    This sounds like the best compromise. Greyed-out selectors should be a pretty good indicator of "why isn't my collision working".
     
  6. Techokami

    Techokami

    For use only on NTSC Genesis systems Researcher
    1,316
    3
    18
    HoleNet!
    Sonic Edge
    Trying to use the nifty new sprite sheet generator tool on the Sonic & Knuckles disassembly from GitHub is causing things to catch fire and burn :(
    Sonic doesn't seem to have a DLPC file? There's one for 2P mode sprites and one for the snowboarding animation, but none for the other sets.
     
  7. Clownacy

    Clownacy

    Tech Member
    802
    36
    28
    It's 'Sonic pattern load cues.asm'. 'DPLC' means 'Dynamic Pattern Load Cues', after all.
     
  8. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,422
    72
    28
    SonLVL
    Oh right, reminder: for S3K player objects, you need to specify dplcgame=S2, or it won't load properly. Also for Sonic, you may need to manually separate the normal and Super stuff.

    Also Neo, I uploaded the fix.
     
  9. Techokami

    Techokami

    For use only on NTSC Genesis systems Researcher
    1,316
    3
    18
    HoleNet!
    Sonic Edge
    welp, today I learned something. Let's give it another go, then!
    Still catching fire. For the record, here is the INI file:
    I had to look at the tool's source code to get the value for mapfmt and dlpcfmt, unless this info was provided elsewhere already and I didn't see it...
    EDIT: MainMemory sniped me with a post. I edited my INI file to include that, but it did not stop the crashings.
     
  10. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,422
    72
    28
    SonLVL
    Yes, lack of documentation is a problem that plagues all of my tools.

    I think the problem is because of the merged Sonic and Super Sonic mappings, it reads Super Sonic's mappings table as if it was part of normal Sonic's, which results in all kinds of screwy data being read. Like I said, you'll have to manually separate them.
     
  11. Fred

    Fred

    Formerly known as 'Neo' Oldbie
    1,529
    60
    28
    Portugal
    Sonic 3 Unlocked
    Many thanks, but the chunk editor still chokes up.

    Code (Text):
    1. System.ArgumentOutOfRangeException: Value of '769' is not valid for 'Value'. 'Value' should be between 'Minimum' and 'Maximum'.
    2. Parameter name: Value
    3.    at System.Windows.Forms.NumericUpDown.set_Value(Decimal value)
    4.    at SonicRetro.SonLVL.ChunkBlockEditor.blockList_SelectedIndexChanged(Object sender, EventArgs e) in c:\Users\Mike\Documents\GitHub\SonLVL\SonLVL\ChunkBlockEditor.cs:line 109
    5.    at System.EventHandler.Invoke(Object sender, EventArgs e)
    6.    at SonicRetro.SonLVL.API.TileList.set_SelectedIndex(Int32 value) in c:\Users\Mike\Documents\GitHub\SonLVL\SonLVLAPI\TileList.cs:line 24
    7.    at SonicRetro.SonLVL.API.TileList.TileList_MouseDown(Object sender, MouseEventArgs e) in c:\Users\Mike\Documents\GitHub\SonLVL\SonLVLAPI\TileList.cs:line 211
    8.    at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
    9.    at System.Windows.Forms.Control.WndProc(Message& m)
    10.    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
    11.    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    What's interesting is that block $300 (768) works fine, so it currently allows $301 blocks rather than $300 or $400.
     
  12. Techokami

    Techokami

    For use only on NTSC Genesis systems Researcher
    1,316
    3
    18
    HoleNet!
    Sonic Edge
    Ahaaa. Thought this would have been an ugly thing to do, but it turns out it was pretty simple. Thanks!
     
  13. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,422
    72
    28
    SonLVL
    SonLVL really shouldn't support anything the game itself doesn't support, but here you are making me do it anyway.
     
  14. Fred

    Fred

    Formerly known as 'Neo' Oldbie
    1,529
    60
    28
    Portugal
    Sonic 3 Unlocked
    Well, I'm sorry you feel that way, but wouldn't you rather have it support these esoteric cases for when they might be useful? I mean, it's not like overall functionality is hindered, but if you're that concerned about accuracy, you could just tuck it into a menu option.

    Anyway, many many thanks, and have a happy holiday!
     
  15. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,422
    72
    28
    SonLVL
    So, I've separated the Comper support into a separate download, because several people were reporting that they were either unable to download SonLVL, or had usage of it blocked by their antivirus software. It will remain separated until someone ports it to C#, where it should be just fine like all the other compression types.
     
  16. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,422
    72
    28
    SonLVL
    It's been a while since I've posted, so here are some recent updates, if you haven't been paying attention to GitHub or the updater:
    • The palette blending dialog now has checkboxes so you can selectively alter only specific palette lines, useful for things like MHZ and SOZ's alternate palettes, where you don't want to change the shared top lines.
    • Holding the Shift key will now reverse the operations of some of the chunk/block editor hotkeys (decrease instead of increase).
    • Fixed selection in FG/BG editors so that dragging the mouse left and up will expand the selection rectangle in those directions, instead of whatever it was doing before.
    • Fixed a bug where an object's sprite wouldn't update if you pressed F3 to find the next object before property changes had a chance to be applied.
    • Added multi-selection to chunk and block editors.
    [​IMG]
     
  17. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,422
    72
    28
    SonLVL
    More updates:
    • Added support for S2's 2P mode (interlaced mode) restrictions in the editor, activated by specifying 2pcompat=True in level entries in the INI. Enabling this forces the editor to treat tiles as 8x16 instead of 8x8.
    • Simplified and optimized the art importer code, it's significantly faster now (EHZ1 imports in about 30 seconds, with collision and priority), and gives a detailed report of the chunks, blocks, and tiles added, and time taken.
    • Added ability to search for objects by X and Y flip flags, and to not search by ID.
    • Added dialogs to mass-replace chunks within layouts, blocks within chunks, and tiles within blocks.
    • Added Usage Counts dialog.
    [​IMG] [​IMG]
     
  18. Caverns 4

    Caverns 4

    Member
    342
    0
    16
    Sanik Quest: Journey To The Right
    Heck yeah. This makes assigning collision to specific blocks SO much faster!
    Awesome job on all the updates though, this program keeps on getting better!
     
  19. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,422
    72
    28
    SonLVL
    I've added GetArt.NET to the updater, and fixed SpriteSheetGen's center-point calculation. I've also made a new tool: SpritePlotter.NET. Yes, once again taking one of MarkeyJester's tools and making my own version, with SonLVL's API and extra features (though the script support is missing from mine). SpritePlotter.NET has a few features over the original:
    • PNG/GIF/JPG support
    • support for indexed color images
    • outputting to binary or ASM with macros (not that anyone besides me uses the macros)
    • automatic art compression
    • multiple palette lines (though using multiple lines within a sprite is inadvisable, unless you know exactly where the tile divisions are going to be)
    • layering high and low priority sprites
    • specifying the center point of each sprite via an image like the one SpriteSheetGen creates
    Unlike the original, SpritePlotter.NET is a purely command-line tool, so you should definitely read the help (just run the program without arguments).

    Special thanks to MarkeyJester for (repeatedly) explaining to me how Sprite Plotter works.
     
  20. flamewing

    flamewing

    Emerald Hunter Tech Member
    1,138
    0
    16
    France
    Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
    I do (but not on every case).

    Anyways, nice work, will definitely check it out.