Flex 2

Discussion in 'Engineering & Reverse Engineering' started by snkenjoi, Nov 19, 2017.

  1. snkenjoi


    Tech Member
    Flex 2 is a multi-purpose art and mapping editor for the Sega Megadrive.

    Key improvements in V2;

    • desktop version
    • project files
    • sexy flexible UI layout
    • custom mapping formats
    • undo / redo
    • ability to draw directly on sprites
    • multiple heuristics for spritesheet importing
    • full access to dplc/mapping data

    Various other additions have been made - a usage guide can be found in the documentation.

    source code / report issues

    The first version will likely have a flurry of various bugs or other issues. Bear with me and I'll try and keep on top of them.
  2. snkenjoi


    Tech Member
    Fixed a bug that causes imported spritesheets to be a pixel too short and wide.
    Fixed a bug where spritesheets without a surrounding empty border import as a single sprite.
    Removed google analytics

    Latest release is now 0.0.6
  3. snkenjoi


    Tech Member
    This project has been dormant for a little while but I intend to resume working on it.

    I've done two quality of life releases recently, here are the changelogs;

    • Tabs can be maximized
    • Sprite swapping keyboard shortcuts added - ctrl+] & ctrl+[
    • Sort imported spritesheet into rows properly
    • Compression now based on flamewing's mdcomp
    • Uses WASM and is much faster
    • Added ArtC42, LZKN1, Rocket and RLE compression formats
    • Autodismiss new mapping screen
    • Better error reporting & enabled devtools (F12)
    • Updated many dependencies, added performance improvements and other small tweaks

    • Changed default palette from Sonic 2 to the SCH unified palette
    • Fixed a bug that allows deleting mappings in drawing mode
    • Fixed a bug where up/down scrolls when there are active mappings
    • Fixed Kosinski-M compression
    • Added KosinskiPlus compression
    • Rebuilt colour picker
    • More dependency upgrades

    One often requested feature is support for other mapping formats. I'm currently working on making them a lot more dynamic so adding support for your custom formats will be a lot easier.
  4. Rudie Radio Waves

    Rudie Radio Waves

    happy! :D Member
    Many a game.
    I apologize for the bump, but I have a question about this program (keep in mind I'm a total newbie):

    It seems that, whenever I overwrite one of Sonic's sprites through Flex 2, his DPLCs and map disappear from the .asm files. Is there a reason why?
  5. snkenjoi


    Tech Member
    Hey, I've just seen this post - you'd likely get faster responses opening an issue on the project's github page. It's also easier to track and resolve issues there than in this forum format.

    It's quite hard to discern exactly what the problem is. What were the exact steps you took? When you save does it just empty the file?
  6. Rufus_Iskv


    hey, I have a question. Most of the sprites seem to be "bundled up" in these rectangles, is there a way to do that for a mapping made from scratch?

    (sorry if the question is inappropriate for this thread, this is my first time on a forum website)
  7. Rudie Radio Waves

    Rudie Radio Waves

    happy! :D Member
    Many a game.
    Okay, it's been a while but I recreated the exact same steps I took last time:

    - Unzipped a clear S3K disassembly from the Retro GitHub
    - Built it to check for errors, rom built correctly
    - Opened Flex2 & created new project into root disassembly folder
    - Created new object
    - Added Sonic art (Sonic.bin)
    - Added Sonic mappings (Map - Sonic.asm)
    - Added DLPCs (Sonic pattern load cues.asm)
    - Added palettes (SonicAndTails.bin)
    - Clicked "Load Data"
    - Import custom sprite over Sonic's standing frame (0x56)
    - Clicked save data

    These are the errors that pooped out of the buildS3Complete.bat file.

    Code (Text):
    1. > > >sonic3k.asm(23254): error: symbol undefined
    2. > > > Map_SuperSonic
    3. > > >           move.l  #Map_SuperSonic,mappings(a0)
    4. > > >sonic3k.asm(24982): error: symbol undefined
    5. > > > PLC_SuperSonic
    6. > > >           lea     (PLC_SuperSonic).l,a2
    7. > > >sonic3k.asm(24982): error: addressing mode not allowed here
    8. > > >           lea     (PLC_SuperSonic).l,a2
    9. > > >sonic3k.asm(34738): error: symbol undefined
    10. > > > Map_SuperSonic
    11. > > >           move.l  #Map_SuperSonic,mappings(a0)    ; If not, you must be Hyper Sonic, load Super/Hyper Sonic mappings
    12. > > >sonic3k.asm(40309): error: symbol undefined
    13. > > > Map_SuperSonic
    14. > > >           move.l  #Map_SuperSonic,(Player_1+mappings).w
    15. > > >sonic3k.asm(101973): error: symbol undefined
    16. > > > Map_SuperSonic
    17. > > >           move.l  #Map_SuperSonic,$C(a0)
    18. > > >sonic3k.asm(127317): error: symbol undefined
    19. > > > Map_SuperSonic
    20. > > >           move.l  #Map_SuperSonic,(Player_1+mappings).w
    21. > > >sonic3k.asm(136934): error: symbol undefined
    22. > > > Map_SuperSonic
    23. > > >           move.l  #Map_SuperSonic,mappings(a0)
    24. > > >sonic3k.asm(174493): error: symbol undefined
    25. > > > Map_SuperSonic
    26. > > >           move.l  #Map_SuperSonic,(Player_1+mappings).w
    27. > > >sonic3k.asm(182698): error: symbol undefined
    28. > > > Map_SuperSonic
    29. > > >           move.l  #Map_SuperSonic,(Player_1+mappings).w
    I also checked the current Map - Sonic.asm and a copy I made before editing the disassembly with Flex2, and the version modified by Flex2 seems to be completely different. I've uploaded the files, if you need to check them.

    Also, would you like me to move the discussion to GitHub after this post?

    Attached Files:

  8. Inferno


    Sonic 1 Definitive
    Ok, I can see what the issue is here: It isn't an issue with Flex2, it's an issue with the disasm itself: it stores the Super Sonic mappings and DPLCs in the same file as the regular mappings and DPLCs respectively but under different labels (this is because the Super Sonic mappings and DPLCs reference the regular mappings and DPLCs). Flex2 isn't able to tell that it needs to keep the two different labels.

    How to fix the issue? Seperate the Super Sonic mappings and DPLCs into their own seperate files.
  9. Fred


    Taking a break Oldbie
    Sonic 3 Unlocked
    This isn't a problem with the disassembly, the disassembly is accurate to the original ROM. The problem is that every tool, including Flex, assumes a single offset table per mappings file. Which is fine 99% of the time, but since Super Sonic reuses a lot of Sonic's sprites, his offset table is interleaved between Sonic's offset table and the actual mapping definitions. There are other mapping files which do the same thing; springs come to mind.

    You can definitely work around it, but I'd personally rather see Flex handle this corner case properly rather than tell people to "fix" their disassemblies that aren't broken.
  10. snkenjoi


    Tech Member


    Code (Text):
    1. - New engine
    2.     - Real custom mappings & DPLCs
    3.     - Support for custom art formats (including compression)
    4.     - Support for custom palette formats
    5.     - Sonic 2 Special Stage added [#21](/../../issues/21)
    6.     - Sonic 3&K Sonic/Supersonic partial support
    7. - New ASM parser/writer
    8.     - Wider compatibility
    9.     - Ability to provide a custom parser
    10. - Added File tab
    11.     - Create new files
    12.     - Save/Load individual assets
    13.     - Art offset [#15](/../../issues/15)
    14.     - Blank entries in palette line
    15.     - Various UX improvements for file input
    16. - Rebuilt Project tab
    17.     - Tree structure for projects
    18.     - Reuse file menu
    19. - Mapping tab updates
    20.     - New mapping autodismiss is configurable
    21.     - Added 'close' to new mapping / raw editor
    22. - Sprites tab now autozooms depending on sprite size
    23. - Fixed a keycombination event bug [#29](/../../issues/29)
    24. - Fixed corrupted art when importing transparent PNGs [#22](/../../issues/22)
    25. - Performance improvements to remove lag
    26. - Created project files for s1disasm, s2disasm

    This release contains a breaking change: Project files from previous versions will work, but game format will have to be reselected as it cannot be migrated.

    It's much more complicated to make tools handle this is a generic way rather than get people to just modify their disassemblies a little, and I would much rather put the time into improving the mapping manipulation functionality.

    That said, this is kind of supported now!

    More to come here, but this is a good point to make a release at.
  11. snkenjoi


    Tech Member