Bananattack / brewtool

A collection of primitive editor/converter tools for making assets used with homebrew ROM development, written in JavaScript
Other
29 stars 2 forks source link

Cannot save any produced files. #1

Open rukai opened 8 years ago

rukai commented 8 years ago

I have tried the chr tool and the map tool, I can choose a local png file fine, however clicking on the download buttons for the produced files has no effect. e.g. save raw gb tileset, save tileset The local file is definitely valid, I even tried with the example file on your blog.

Bananattack commented 8 years ago

Sorry! It looks like there are problems currently with running these scripts in Firefox. These tools work fine in Google Chrome for the time being. I'm not sure when I'll have time to fix this properly!

Around the top of maptool.js (and some of the other files): There's some polyfill code for saveAs. In the fallback case, does a final effort to manually trigger downloading a data link via a script-generated mouse event. The problem is, when it calls initMouseEvent, it references a variable named event, that isn't defined (maptool.js, line 11). Some browsers have window.event which will be read anyways due to JS scoping rules, but pretty sure I wanted to use 'click' rather than 'event' here (a variable set on the previous line). Alternatively, I could just fake out all of that data with undefined / null / false / 0 as appropriate, since I think the only relevant thing being initialized in the initMouseEvent line is just to indicate the mouse event is a 'click' event.

A possible fix may also be to add window.saveAs to the list of functions to check when doing the polyfill, since it's possible Firefox dropped the "moz" prefix from mozSaveAs, or never had one.

So to reiterate, not sure when I can properly fix this, but in the meantime, using Chrome works for now. I haven't had much time to support my homebrew tools and tutorials in a while, which is why I haven't done significant updates for them in a long time. Sorry! I hope I can find time again soon though, and good luck with your homebrew endeavours!