[V1.0] Png2Dmp, by Crazycolorz5

This kind of grew out of Portrait Formatter. It’s a more portable app that just formats a png into the graphics form that the GBA uses.

It’s basically capable of inserting anything GBAGE can/does. It’s even a bit more explicit about when it’s compressing.

After conversion, insert with Event Assembler. Or even better, put it in the tools folder and use #incext.

Usage:
./Png2Dmp <filename.png> [--lz77] [-po <paletteout.dmp>] [-o <outputfile.dmp>] [--palette-only] [--to-stdout] [--help]
Converts a png to GBA format. Use the --lz77 option to compress the output. Use the --palette-only option to only output the palette of the image. Otherwise, -po can be used to specify an output file for the palette.

Source available on request.

Download:
Png2Dmp V1.0

5 Likes

So I tried this to see if I could just drop FE4 portraits into the game (ignore the fact that they’d look awful, it’s for science) but… well, yeah. First I tried to assemble a file with just the usage instructions filled in. However, it said it couldn’t find the file. [spoiler=error] Finished.
1 errors encountered:
File: do you work.txt, Line: 1: File C:\Users\Owner\Documents\Emu_stuff\GB(A)\FE7\Tools\Event_Assembler_V10.0\Tools\Png2Dmp_V0.1.exe not found.

No data written to output.

[/spoiler]

Then I decided to drag the picture over on top of the program and a dmp file was generated. I tried inserting that, but I just caused some exception. [spoiler=error the second]Finished.
1 errors encountered:
Exception: System.ArgumentException: parameter(5R)
at Nintenlord.Utility.StringExtensions.GetValue(String parameter)
at Nintenlord.Event_Assembler.Core.Code.Language.Parser.MathParser1.Parse1(IScanner1 scanner, Match1& match) at Nintenlord.Event_Assembler.Core.Code.Language.Parser.MathParser1.Parse3(IScanner1 scanner, Match1& match)
at Nintenlord.Event_Assembler.Core.Code.Language.Parser.MathParser1.Parse4(IScanner1 scanner, Match1& match) at Nintenlord.Event_Assembler.Core.Code.Language.Parser.MathParser1.Parse5(IScanner1 scanner, Match1& match)
at Nintenlord.Event_Assembler.Core.Code.Language.Parser.MathParser1.Parse8(IScanner1 scanner, Match1& match) at Nintenlord.Event_Assembler.Core.Code.Language.Parser.MathParser1.Parse9(IScanner1 scanner, Match1& match)
at Nintenlord.Event_Assembler.Core.Code.Language.Parser.MathParser1.Parse10(IScanner1 scanner, Match1& match) at Nintenlord.Parser.Parser2.Parse(IScanner1 scanner, Match1& match)
at Nintenlord.Parser.ParserCombinators.UnaryParsers.NameParser2.ParseMain(IScanner1 scanner, Match1& match) at Nintenlord.Parser.Parser2.Parse(IScanner1 scanner, Match1& match)
at Nintenlord.Parser.ParserCombinators.BinaryParsers.OrParser2.ParseMain(IScanner1 scanner, Match1& match) at Nintenlord.Parser.Parser2.Parse(IScanner1 scanner, Match1& match)
at Nintenlord.Parser.ParserCombinators.UnaryParsers.NameParser2.ParseMain(IScanner1 scanner, Match1& match) at Nintenlord.Parser.Parser2.Parse(IScanner1 scanner, Match1& match)
at Nintenlord.Event_Assembler.Core.Code.Language.Parser.StatementParser1.Statement(IScanner1 scanner, Symbol1 name, Match1& match)
at Nintenlord.Event_Assembler.Core.Code.Language.Parser.StatementParser1.ParseMain(IScanner1 scanner, Match1& match) at Nintenlord.Parser.Parser2.Parse(IScanner1 scanner, Match1& match)
at Nintenlord.Parser.ParserCombinators.UnaryParsers.NameParser2.ParseMain(IScanner1 scanner, Match1& match) at Nintenlord.Parser.Parser2.Parse(IScanner1 scanner, Match1& match)
at Nintenlord.Parser.ParserCombinators.ManyParser2.<Enumerate>d__0.MoveNext() at System.Collections.Generic.List1…ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)
at Nintenlord.Parser.ParserCombinators.RepeatingParser2.ParseMain(IScanner1 scanner, Match1& match) at Nintenlord.Parser.Parser2.Parse(IScanner1 scanner, Match1& match)
at Nintenlord.Event_Assembler.Core.Code.Language.Parser.ScopeParser1.ParseMain(IScanner1 scanner, Match1& match) at Nintenlord.Parser.Parser2.Parse(IScanner1 scanner, Match1& match)
at Nintenlord.Parser.ParserCombinators.TransformParser3.ParseMain(IScanner1 scanner, Match1& match) at Nintenlord.Parser.Parser2.Parse(IScanner1 scanner, Match1& match)
at Nintenlord.Parser.Parser2.Parse(IScanner1 scanner, Match`1& match)
at Nintenlord.Event_Assembler.Core.Code.Language.EAExpressionAssembler.Assemble(IPositionableInputStream input, BinaryWriter output, ILog log)
at Nintenlord.Event_Assembler.Core.Program.Assemble(EACodeLanguage language, TextReader input, BinaryWriter output, ILog log)
at Nintenlord.Event_Assembler.Core.Program.Assemble(String inputFile, String outputFile, String languageName, ILog messageLog)
at Nintenlord.Event_Assembler.UserInterface.MainForm.<.ctor>b__1(Object sender, DoWorkEventArgs args)

No data written to output.

[/spoiler]
Am I just putting the files in the wrong order? My assembly file looked like this:
#incext ./Png2Dmp sigurd.png --lz77 -po palette.dmp --help I also just tried inserting the dmp straight up. In some attempts the ./Png2Dmp had the filepath before it. I want Feditor obsoleted like everyone else here, but you don’t want the noobs like me fall back on it in the name of user-friendliness, right? Because as buggy as Feditor is, it is easy to use. So what am I doing wrong? Is it something as stupid as me putting some terms backwards or what?

Rename the file after you download it to just Png2Dmp.exe; take off the version number.

As for the EA error; I’m not sure, but we’ve been bugfixing incext; the currently released version doesn’t work yet (as of 10.0)

Edit: Also, don’t pass in the --help option if you want it to actually insert. Also, -po is optional if you need the palette for some reason.

Edit2:

In effect, the EA directive should look something like this:
#incext Png2Dmp sigurd.png
or if you need it compressed
#incext Png2Dmp sigurd.png --lz77

Don’t worry; there’ll be more on this in the inserting everything through EA tutorial in time.

Updated to 1.0 with the following features:

  • Specify an output file name with -o <filename>. This will even output to the file is --to-stdout is passed.
  • Huge performance increases on lz77 compression. Performs about 40x faster than it used to.

I’m running the following two files through Png2Dmp. The difference between the two is that one is 4bpp and the other is 8bpp. The 8bpp image also uses colour 16 at the start.
PrepPrompts
PrepPrompts2

Both produce the same .dmp though. It seems the 8bpp image is stored in 4bpp format in the .dmp (maybe the top nybble is ignored?)