Tuesday, March 16, 2021

Oops! I did it again!

Novembre 2020. J'ai voulu pouvoir ouvrir n'importe quel .spr dans mon Sprite Editor et j'ai rajouté un discret petit "dir" qui ouvre OtherFileWindow. Oui, parce que jusque là, c'était toujours A pour spriteA.spr, B pour spriteB.spr et ainsi de suite jusqu'Y. 

Sauf que quand j'ai voulu essayer de re-sauver ça n'avait pas marché. Pas de quoi fouetter un chat, mais j'ai moins ri quand je me suis rendu compte l'éditeur de niveau ne marchait plus. J'ai tenté un patch, j'ai voulu l'uploader dans runMe, mais runMe ne savait plus rien uploader non plus...

For over 15 years (!), Sprite Editor for DS has been satisfying to use with only 4 files directly accessible. It no longer is, with Furries experiments, demo projects and dreamland target that will use 4 different environment plus bilou.spr.

Hopefully, back in November, I added a new window in SEDS that let you pick a .spr when tapping the (poorly named) "dir." button.

There's unfortunately an unforeseen interference between SpriteSet::SaveBack() and OtherFileWindow::event(). One expects that the string you passed to SpriteSet::Load() megacycles ago is constant and hasn't changed. The other needs to drop the 'file' part of the path so that you can pick another file later on and not end up with fat:/moving/bilou.spr/desert.spr/green.spr ...

The unfortunate consequence of all this comes as SaveBack tries to make a .bakup of your .spriteset ... the name is now just the directory's name and thus the directory is renamed. None of my tools are ready to face that. Do you think future self-as-a-user will take notice of past-self-as-coder warnings written in the comments part of commit logs ?

Heureusement, je n'avais pas bousillé toute ma carte mémoire, mais par contre, au moment de faire la sauvegarde, mon "fat:/moving/oldies.spr" était redevenu "fat:/moving/", prêt à traiter un nouveau fichier et en faire un chemin d'accès. Et le code qui crée le fichier .bak à partir du .spr est ... disons ... vieux et innocent. Il à renommé fat:/moving/ en fat:/movibak qu'aucun de mes outils ne reconnait.

Et bien sûr, ça m'est re-arrivé hier en voulant changer quelque-chose dans mon bilouchk.spr ... Donc cette fois j'ai sorti mon callepin et le code-sur-boox

  • [done] fix SpriteSet so that it uses a std::string rather than const char* to remember the filename to save
  • [done] make sure SpriteSet::SaveBack() checks there is a .spr at the end of the file name
  • [done] add a check window in runMe that triggers when there is no /moving/ folder and offers to create one or to restore /movibak as /moving (if exists)
  • [done] also browse for files in AnimEDS

No comments: