don't click here

Tales: Tails Adventures Level Editor Suite

Discussion in 'Engineering & Reverse Engineering' started by SupperTails66, Jan 16, 2016.

  1. SupperTails66

    SupperTails66

    Tech Member
    1,109
    7
    18
    Well, that's quite a problem. The program seems to be dying without running any code (that I control) at all, so without some kind of error or way to reproduce the behavior, there's only so much I can do about it. I'll look into compiling for Windows with Qt 4, but I don't know if that'll help.

    Also, I fixed the bug that was sometimes causing exported ROMs to crash/reset while trying to load the intro. Will put up a new build later.
     
  2. GerbilSoft

    GerbilSoft

    RickRotate'd. Administrator
    2,971
    76
    28
    USA
    rom-properties
    I took a quick look at Tales and found some possible issues that could be causing problems. I'm currently doing a quick cleanup of compile warnings and cppcheck warnings/errors, and will submit a pull request once I'm done.

    I also rewrote the GNU Makefile to use proper dependencies, which should make it less painful to rebuild the library.
     
  3. SupperTails66

    SupperTails66

    Tech Member
    1,109
    7
    18
    Release 4: http://www.mediafire.com/download/jmqknxp2mhfjiwl/libtales-bin-r4-win32.zip

    This is the first release to actually include new features instead of just bugfixes: you can now add metatile structure definitions to a metatile set and change the existing ones instead of being stuck with what the game gives you. I also fixed the crash in exported ROMs that I mentioned. Let me know about any problems that crop up.

    Whoa, great. Thanks for the help. I haven't done much cleanup w/r/t warnings, so there's definitely a lot of cruft to sort through there. And yeah, the makefile is pretty pitiful, I'd never actually done a project big enough to warrant a proper one before this.
     
  4. GerbilSoft

    GerbilSoft

    RickRotate'd. Administrator
    2,971
    76
    28
    USA
    rom-properties
    Here's a few things I committed to my branch:
    • Use -std=gnu++11 instead of -std=c++11 to enable gcc-specific extensions.
    • Added all generated files (on Linux at least) to .gitignore, so they don't get commited to the repository by accident..
    • Reordered constructor variable initialization to match the order of the variables as declared in the class declaration.
    • Don't use const when returning non-pointer types. The const doesn't do anything, and it causes MSVC to emit a different mangled symbol name, which can cause ABI problems later on.
    • For non-primitive types, such as iterators, prefer prefix increment (++iter) instead of postfix increment (iter++). The postfix version makes a copy of its previous value and returns it, which isn't needed most of the time.
    • Don't specify the existing exception when re-throwing it; that is, just use "throw;" instead of "throw e;". Specifying the exception again causes the compiler to make another copy.
    The most notable fix:
    • Fixed mismatched new[]/delete. When deleting memory allocated using an array new[], you have to delete it using array delete[], e.g. "delete[] outputBuffer". This might not necessarily cause immediate problems with primitive types, but it *will* cause problems if you do a mismatched delete with an array of objects.
    Some stuff you should look into doing:
    • Add const to accessor functions. There's *lots* of classes in this project, so doing it all at once is probably too much effort. You should probably mark member functions as const whenever you see a function that simply returns a value, e.g. nativeWidth() or nativeHeight().
    EDIT: I recommend checking out cppcheck. It helps to find the most common errors that can affect runtime performance and stability, including mismatched new[]/delete.
     
  5. SupperTails66

    SupperTails66

    Tech Member
    1,109
    7
    18
    Merged your branch. Thanks for all the help and advice. I'm obviously not a coding whiz, so I really appreciate it.
     
  6. Shoemanbundy

    Shoemanbundy

    Researcher
    1,094
    30
    28
    Chicago, Illinois
    selling shoes
    Figured out my issue. It's Windows 7 being a dick, basically. Some bug where programs don't open and stay stuck as a process in Task Manager only taking up like 100kb of ram. Fixed it by doing a clean boot. Happened with SonLVL and Game Maker which made it obvious to me it was not only the Tales editor.
     
  7. Techokami

    Techokami

    For use only on NTSC Genesis systems Researcher
    1,373
    81
    28
    HoleNet!
    Sonic Worlds Next
    I would love to see the ability to export metatiles and maps as PNG images, in addition to exporting tiles as uncompressed 4bpp graphics and importing them too.
     
  8. SupperTails66

    SupperTails66

    Tech Member
    1,109
    7
    18
    Glad to hear you got that sorted, since I was pretty much out of things I could do to try to fix it.

    Exporting stuff is simple enough, I'll see about throwing that in somewhere for the next release. Importing is obviously trickier, but I'll probably start working on it after I finish the static tilemap editor I'm working on now.
     
  9. Techokami

    Techokami

    For use only on NTSC Genesis systems Researcher
    1,373
    81
    28
    HoleNet!
    Sonic Worlds Next
    That's why I suggested using native 4bpp formats for importing instead of just PNGs. That should, in theory, simplify things, since all you'd need to do is load it as uncompressed data over the desired graphical slot.

    (Also can you please add exporting animations as PNGs too? Also, a counter stating how many objects are used would be helpful for keeping the 1645 limit in mind!)
     
  10. Shoemanbundy

    Shoemanbundy

    Researcher
    1,094
    30
    28
    Chicago, Illinois
    selling shoes
    So not all blank tiles can be drawn into? Was trying to replace Tails' sprite and his standing sprite for example has a blank square at the top left. Will we be only limited to tiles with graphics already in them?
     
  11. SupperTails66

    SupperTails66

    Tech Member
    1,109
    7
    18
    Exporting the data and palettes as-is is an option, but editing a raw data format is pretty unintuitive if you're not technically inclined. Ideally, the program will be able to export palettized PNGs that can be edited in a normal image editor, then import them back. I'll have to do some testing to see whether that's workable or not.

    As for not listing the object total, well, I got a bit lazy. I'll work that into the next release. The math comes out to something like an average of 40 objects per level, so you shouldn't hit the cap anytime soon, and if you do the program will yell at you when you try to export.

    Yeah, that's how the sprite mappings work -- only the parts that are needed are defined, and the program can't edit the actual mappings because they're a bit of a structural headache. I'll see about making the non-editable areas transparent in the next version so that's more clear.
     
  12. InvisibleUp

    InvisibleUp

    friendly internet ghost Member
    139
    13
    18
    I'd imagine it'd be easier at first to create a paletted BMP (assuming using a PNG library isn't working out). Those are basically raw data dumps of the image/palette with a header.

    That being said I'm liking this. I've always wanted a good Tails Adventure hack, and this is not a bad program to make one with. Also, if you could put the level mapping/etc. on the SCHG that would be awesome. That way anyone hoping to hack other bits of the game (that Seafox level table, for instance) would know where to look.
     
  13. SupperTails66

    SupperTails66

    Tech Member
    1,109
    7
    18
    It's less about the format than making sure external editors don't try to optimize away colors or the like. I'm hoping most programs have an option for it, but I've never actually had to do something like that before.

    And thanks for the kind words. My notes on the game are a bit of a trainwreck (a 51.9 KB text file plus a ream of unsorted notebook paper plus random disassembly comments), but I will try to get them sorted and uploaded at some point.

    Incidentally, it's not even a table; the game just does hardcoded "is this area 6? is this area 7?" checks every time it needs to know if you're on a Sea Fox level, so it's kind of a pain to try to change it.
     
  14. SupperTails66

    SupperTails66

    Tech Member
    1,109
    7
    18
    Release 5 out: http://www.mediafire.com/download/fa1bsdh6f2i0a8l/libtales-bin-r5-win32.zip

    This adds quite a few new features and improvements, including most of the stuff people have requested so far:

    * Added tilemap editor for modifying fixed tilemaps.
    * Added resource export dialog for exporting maps, metatiles, tilemaps, and
    graphics to PNGs.
    * Added no game over hack.
    * Fixed conversion of Game Gear colors (previously, brighter colors appeared too
    dark).
    * Changed display of mappings in the graphics editor so that non-mapped
    (non-editable) areas appear transparent.
    * Added to level editor a count of total objects in all levels and the maximum
    total allowed.
    * Many internal improvements made to the code courtesy of GerbilSoft.
     
  15. Shoemanbundy

    Shoemanbundy

    Researcher
    1,094
    30
    28
    Chicago, Illinois
    selling shoes
    Program is crashing suddenly, possibly due to me having the magnification up so high?

    Anyway, I've been messing around and this thing can do so much. Just want to say thank you again. People can make whole new games with this. I just look forward to the import feature since I've spent hours drawing my art into the editor. Easy to get burned out. Too impatient to wait, though!
     
  16. SupperTails66

    SupperTails66

    Tech Member
    1,109
    7
    18
    Any particular situation (e.g. editing tool) where the program seems to crash? I hate to keep blaming Qt for everything, but it tends to mysteriously fail under seemingly arbitrary circumstances, like clicking an image embedded in a widget or changing between specific maps when the window size is too small. Trying to hunt down a specific issue can be tough going.

    And don't hurt yourself trying to use my crappy homebrew graphics tools! Since there's more demand for it than I'd thought, I've bumped graphics to the top of the priorities list. No promises on when it'll be ready, but hopefully it shouldn't be too long.
     
  17. Shoemanbundy

    Shoemanbundy

    Researcher
    1,094
    30
    28
    Chicago, Illinois
    selling shoes
    It only started crashing when I realized I should have the graphics editor expanded more than 800%. Switched it to the highest possible and continued my routine of clicking in and out if it to reference my image in GIMP that I'm trying to draw into the program. Sometimes when I switch back into Tales it will then just crash when I click to draw a pixel. That's about as specific as I can get.

    Ain't gonna stop me from still painting pixels, but cool news about graphics getting a higher priority now!

    BTW, what's the likelihood the editor could ever allow people to add in additional titlesets and levels?
     
  18. SupperTails66

    SupperTails66

    Tech Member
    1,109
    7
    18
    Release 6: http://www.mediafire.com/download/yzlvz054a3984wh/libtales-bin-r6-win32.zip

    Here's the graphics importer, in what is probably a personal record for turnaround time on a significant new feature. If I'd known it would be this simple, I'd have done it ages ago.

    Important note: If you use GIMP to edit the graphics, make sure there are no transparent pixels when you export the edited file back to a PNG or GIMP will wreck the palette structure. Sorry, but it's GIMP's issue, not mine. The only real workaround would be to allow exporting to a format GIMP handles less stupidly, but I'm not quite up for it right now. Until/unless that happens, make sure transparency is disabled when exporting from Tales.

    Hmm, I'll look into your problem. Sounds like another obscure Qt issue, so I don't know how much I'll turn up.

    Extra tilesets are doable (I think, I'd have to check my notes), but more levels are pretty much out of the question. You'd have to regenerate virtually every address lookup table in the ROM and probably update a bunch of hardcoded stuff, and my dedication has its limits. Glad to hear you're enjoying things though -- let me know if you think anything else could use improving.
     
  19. Shoemanbundy

    Shoemanbundy

    Researcher
    1,094
    30
    28
    Chicago, Illinois
    selling shoes
    Amazing! Quicker than I expected. Will try it out and post results.

    Extra tilesets would be neat. Just to be clear, extra levels aren't possible, but would extra maps for individual levels be doable? For the project I am sorta attempting (either just to see how it looks or to be a full-on project, I still haven't decided), it would work since then just warping to different maps would be fine. Extra palettes, too, btw? I almost feel like I ask too much but this is pretty fun.

    On that note, anyone else already working on a project? Completely revamp the graphics and you've got yourself a neat adventure engine for the Game Gear. Nice change from just editing a Sonic engine all the time.
     
  20. SupperTails66

    SupperTails66

    Tech Member
    1,109
    7
    18
    It's the same thing, basically. Whenever the game needs to get some data associated with a level, it usually does a two-table lookup: first it uses the area number to get a base address into a second table, then it uses the map number to index into that address. Expanding either of the tables means rewriting both of them. Plus I wrote the program assuming the area-map values were constant, so I'd have to rework the code to deal with that, and probably a host of other issues I haven't thought of.

    I'm working on my own little hack, though it'll probably a while before it's ready. Looking forward to seeing what you come up with!