Author Topic: GBA portraits - Hack Completed!!  (Read 6766 times)

magicpants29

  • FF5 Hacker
  • *
  • Posts: 47
    • View Profile
Re: GBA portraits
« Reply #15 on: September 08, 2011, 04:32:13 PM »
Corruption progress (in case someone reads this while I'm tinkering):
  • The portraits seem to be located before the portrait palettes. I corrupted everything between Lenna and Galuf's portrait palettes, and Galuf's whole dialogue box turned into a mess of random colored lines before the game forced itself to restart, while Lenna's was unchanged. This was in the [323200 to 323977] range.
  • Corrupted everything between [323200 to 32343D] and got similar results
  • Corrupted everything between [323200 to 323340] and got a brief flash and garbled Galuf sprite, but the game still runs! The portrait seems to be in this area, but needs to be narrowed down. I'll try changing the values to 00's instead of random stuff
  • Found Galuf's portrait! It was at [32325D]. I'm a bit confused though, since it appears just as it would in the memory viewer, yet I was never able to find Lenna's portrait by searching through the same means. I must have just made a mistake somewhere, I suppose. I'll need to go back and look at it after I mess around with Galuf's portrait. Kind of disappointing that I could've saved a lot of time if I just tried searching for someone else's portrait instead of just Lenna's haha...

The next question I have would be, how do I write out the colors I want for the palette? The drawings I've done so far are indexed with 16 colors (well, 15 plus transparency of course) and set so that the RGB values are multiples of 8 (cuz I know I only get 0-31). Is there a simple chart or conversion tool I can use to help implement my palettes?

 :edit:
I assume the way it works is that you essentially have 5 binary spots per color (Blue, then Green, then Red). The first digit will be a 0, then a number 0-31 in binary for Blue, then another number 0-31 for Green, and the same for Red, since you need at least 5 digits to write a number 0-31 in binary (see? I'm learning!). This 16 digit binary code is then segmented into 4, with the hex value of each one used, so it only takes up 4 spaces per color. Right?
« Last Edit: September 08, 2011, 05:30:17 PM by magicpants29 »

magicpants29

  • FF5 Hacker
  • *
  • Posts: 47
    • View Profile
Re: GBA portraits
« Reply #16 on: September 08, 2011, 08:31:07 PM »
Ok, seems to work so far... the only thing that sucks is trying to map out the picture in hex... anyone know a tool I can use to convert the pictures easily? I was gonna try using an ASCII converter but that isn't accurate enough.

magicpants29

  • FF5 Hacker
  • *
  • Posts: 47
    • View Profile
Re: GBA portraits
« Reply #17 on: September 08, 2011, 11:38:29 PM »
Upon testing a portrait, I noticed the code has random values (mostly 00's) crammed in with the portraits. I have to carefully examine the code for these I guess

samurai goroh

  • FF5 Hacker
  • *
  • Posts: 100
  • Gender: Male
    • View Profile
    • My page
Re: GBA portraits
« Reply #18 on: September 08, 2011, 11:58:31 PM »
If you haven't already, or for those who also want to know, here's the location of all the portraits palettes:

Code: [Select]
------------------------------------------------------------------------------------------------------------------------
Butz -        0032:2AB8  00 7C FF 7F BE 6F 5A 6B 5B 63 11 77 F9 56 F6 5E 8F 76 B7 4A 75 42 33 3E CF 31 6C 29 08 21 00 00
Leena -       0032:31E0  00 7C FF 7F BE 73 DD 67 5C 67 7D 4B 1A 5B 5B 66 D9 52 1D 33 AC 7E 75 46 12 3A AF 31 6C 29 08 21
Galuf -       0032:3978  00 7C FF 7F BF 6F 9B 73 5C 63 38 67 57 7E FA 56 D5 5A B8 4E 76 46 34 3E F2 35 8E 2D 4B 25 08 21
Faris -       0032:40D0  00 7C BE 77 BD 5F 5B 67 F8 5A 1D 33 B6 4E 4C 76 54 46 EB 6D 8B 65 F1 3D 39 1D AF 35 4B 29 08 21
Cara -        0032:481C  00 7C DF 77 DE 5F 7D 67 7D 53 1B 5B 1C 4B DA 4E DA 46 B9 42 76 42 BA 49 12 3A AF 31 6C 29 08 21
Boko -        0032:4FBC  00 7C FF 63 9D 57 5C 4B FE 4A FA 42 9C 3E 8C 7A B9 36 3A 36 57 2E CA 65 F5 25 90 21 4C 21 08 21
Cid -         0032:576C  00 7C FF 7F BF 6F 9B 73 5C 63 38 67 FA 56 D5 5A B8 4E 76 46 34 3E D1 35 39 1D 8E 2D 4B 25 08 21
Mid -         0032:5E94  00 7C DF 77 DE 5F 5D 67 7D 53 FF 56 76 7E FA 56 1C 4B DB 42 97 46 35 3A D1 2D 79 09 6D 25 0A 1D
Dorgann -     0032:6640  00 7C FF 7F BE 6F 5B 63 F9 56 8E 76 B7 4A 75 42 2C 6E CB 69 33 3E CF 31 6C 29 08 21 00 00 00 00
Kelger -      0032:6E50  00 7C FF 7F 9C 73 39 67 9F 3F D7 5A 1B 37 74 4E 97 32 11 42 14 2E CE 39 35 19 8C 2D 4A 25 08 21
Xezat -       0032:75E8  00 7C DE 7B 7D 67 9F 53 11 7F 1A 5B 3C 43 8E 76 B9 42 95 4A 2C 6E CB 69 6B 69 11 3E 8D 31 09 29
King Tycoon - 0032:7D80  00 7C DA 7F BF 6B 76 7F 3C 5B 13 7F B0 7E D9 4E 1D 33 4E 72 ED 69 54 42 AC 61 D0 39 6C 31 09 29
Gilgamesh -   0032:850C  00 7C FF 7F 9C 73 39 67 7E 37 D6 5A 9F 3E D9 3A 73 4E FD 31 10 42 7B 25 35 21 8C 31 10 1D 08 21
Exdeath -     0032:8C74  00 7C DB 7F 55 7B BF 3F 12 77 3C 37 CE 76 8A 76 B9 32 CC 75 56 2E 8B 59 F3 29 F9 10 4A 3D C7 30
------------------------------------------------------------------------------------------------------------------------
I'm the best in the universe! Just remember! [F-zero X]

magicpants29

  • FF5 Hacker
  • *
  • Posts: 47
    • View Profile
Re: GBA portraits
« Reply #19 on: September 09, 2011, 12:13:31 AM »
Ah good, I got about half of them and I thought I'd have to play through the game again to get the rest. Since I found his portrait first, I've been working on changing Galuf's portrait. The palette was easy enough to change and worked the way I want. The hard part is definitely working around the unusual way they're storing the portraits.

magicpants29

  • FF5 Hacker
  • *
  • Posts: 47
    • View Profile
Re: GBA portraits
« Reply #20 on: September 09, 2011, 02:14:01 PM »
The random crap between the portrait values seem to be some sort of reference thing... they seem to want to recall a previous 2 pixels from the portrait instead of just writing the values like normal. The result is, 2 pixels in Galuf's hair are reused in a few other spots (in the normal portrait, his ear and his left temple). Basically, I have to either find a way to get around that referential crap or adjust the sprite to look good despite it.


OLD PORTRAIT (top section of 8x32 pixels) - Red sections (which when documenting I'd start a new line to keep track) are not part of the portrait itself but rather random bits that are stuck in there. Blue sections repeat at a certain point; I wrote in green where they reappear in the portrait (and memory viewer), but they won't show in the hex editor. Changing the red values seems to screw with some stuff, but I think I have to screw with it if I don't want repeated pixels. Do problems like this occur in working with sprites?
-----------------------------------------------------------------
                        00 00
00 E0 3D 00 E0 DE 13 00 5E
00 35 11 00 1E 33 31 D0 13
00 53 31 1E 31 51 53 3E 31
00 85 75 8D 13 85 47 BC 58
00 13 31 35 11 11 53 13 33
00 13 11 31 35 31 55 51 15
00 85 33 73 15 38 11 44 34
00 77 39 44 47 47 57 C5 0D
00 00 E0 35 C1 ED 5E 11 31
00 55 53 33 11 11 55 13 31
10 53 33 53 35 11 11
00 30 81 13 31 55
00 71 87 58 55 00 C0 00 00
00 0E 5E 00 00 ED 85 00 00
00 13 C3 00 00 31 E8 00 00
04 53 0E 00 00 55
10 03 0E 00 00 55 D3 00
00 00

« Last Edit: September 09, 2011, 03:51:51 PM by magicpants29 »

magicpants29

  • FF5 Hacker
  • *
  • Posts: 47
    • View Profile
Re: GBA portraits
« Reply #21 on: September 10, 2011, 08:23:02 PM »
Alright, I "finished" Galuf's portrait, by which I mean I got all the stuff in that I could. As I mentioned before, certain parts of the portrait seem to be forced into other areas, and the few times I've tinkered with those spots, it just screws everything up completely. Also I realize I left a few spots unchanged from doing a few tests, which is why he randomly has orange streaks in his hair haha

Here is the portrait in game


Here is a close-up


And here is my portrait in Photoshop with the spots that get repeated, by color; Whatever I put in where the first two red pixels are gets repeated in every other spot there are two red pixels, etc. The pure blue area is automatically transparent.


There are two things I can do from here. For one, I could redraw/adjust the portrait to fit these spots. Or, I could try tampering with those screwy bits, which might be even more of a headache.
« Last Edit: September 10, 2011, 09:23:48 PM by magicpants29 »

magicpants29

  • FF5 Hacker
  • *
  • Posts: 47
    • View Profile
Re: GBA portraits
« Reply #22 on: September 16, 2011, 11:19:49 PM »
Alright, it took me a few days (mostly because I just didn't have much free time), but I figured it out. I can adjust where it is in the portrait the pixels are referenced, so long as it's before that spot and within 255 spaces. This probably doesn't mean anything to any of you, but it's basically the reason I'm being held up in this project. The most noticeable areas where the pixels need to be repeated are the far right and the bottom, which is why (if you notice those sort of things) you'll see a lot of repetition of pixels. There are sometimes I can get away with referencing a random section of code though, which is usually a bunch of FF's (I did this in Galuf's right shoulder).

Anyway I managed to work my Galuf portrait in, though it's not exactly as I originally drew it, but I'm happy with how it came out. I wanna know what you guys think though, so post your impressions of it. I can only change a handful of things in the picture easily, but fortunately the eyes and mouth are included in that, so if a lot of you think his expression is all wrong I can easily adjust it.

The final product:


In action:



Large resolution shot:


Gonna start the next character (probably Bartz cuz he should be easier based on how I drew him) tomorrow.
« Last Edit: September 16, 2011, 11:30:36 PM by magicpants29 »

samurai goroh

  • FF5 Hacker
  • *
  • Posts: 100
  • Gender: Male
    • View Profile
    • My page
Re: GBA portraits
« Reply #23 on: September 18, 2011, 09:36:46 PM »
Looking good, thumbs up :)

If you're good at programming you should give it a try to create a tool to edit the portraits for you, if you've already understood how the information is stored, that's it (or did you only got it with trial an error?).
I'm the best in the universe! Just remember! [F-zero X]

magicpants29

  • FF5 Hacker
  • *
  • Posts: 47
    • View Profile
Re: GBA portraits
« Reply #24 on: September 18, 2011, 11:34:45 PM »
I'm not a programmer, unfortunately, haha, I wish I was cuz I could be making my own games :P I do, however, have a great deal of experience with various art styles and animation so I can at least do all kinds of graphical work like this on my own.

Pretty much had to trial and error my way through those tricky sections. I understand, for the most part, the range of which I can adjust the pictures, and the next portraits (doing Lenna instead of Bartz cuz hers was next to Galuf's) probably won't be so difficult. I really just wish it was stored more simply, cuz then I probably could just learn enough programming skill to design a simple editor, though as it is it's far too disorderly for me to not manually go through it all.

magicpants29

  • FF5 Hacker
  • *
  • Posts: 47
    • View Profile
Re: GBA portraits
« Reply #25 on: October 15, 2011, 10:42:45 PM »
Been really busy this last month, but I've since managed to get Lenna to work. The problem here was that there were a lot of those tricky areas that are hard to work with. I ended up redrawing the portrait and essentially tracing over the original one, figuring I wouldn't be able to avoid those trouble spots. However, I've somewhat figured them out and I can completely remove them. The only concern I have is that I'm pretty sure I used more space than the original did. If this is a problem, I'll have to rework it a little, which is really just tedious rather than hard. If it isn't, then any portrait I draw (or anyone draws, for that matter) can be very easily put into the game, and it probably wouldn't be hard to make a portrait editor at that point (assuming there was a demand for such a program). I may at some point return to the Galuf portrait to do touch-ups when I know for certain what I can do.

Here's the new Lenna portrait. Let me know what you guys think, I can handle any criticism haha




Probably doing Faris next and then maybe some testing to see what kind of space I'm allowed to work with.
« Last Edit: October 15, 2011, 11:05:32 PM by magicpants29 »

Jorgur

  • Moderator
  • *
  • Posts: 186
  • Gender: Male
    • View Profile
Re: GBA portraits
« Reply #26 on: October 18, 2011, 05:55:45 AM »
I could probably whip up a portrait editor if you provide the technical info. I would also like to know how to remove the portraits, so I could insert that feature as well.

magicpants29

  • FF5 Hacker
  • *
  • Posts: 47
    • View Profile
Re: GBA portraits
« Reply #27 on: October 18, 2011, 09:23:47 AM »
Awesome, that sounds good, though I need to test some stuff first, or else an editor wouldn't be practical. If my plan works then I'll write out how the whole thing works, which is actually rather simple. As far as removing portraits goes, I only know how to replace it with transparency, which would just leave blank space where it used to be.

magicpants29

  • FF5 Hacker
  • *
  • Posts: 47
    • View Profile
Re: GBA portraits
« Reply #28 on: October 21, 2011, 09:40:34 PM »
Implemented Faris using my new technique, which was a LOT easier to do. The only question is whether or not it affects any other graphics in the game, which I would only be able to determine by a playthrough, unless someone else has a means of testing that sort of thing.





Now, as far as an editor would go, or anyone else attempting to adjust portraits, as far as implementation goes, this is the real road block. Upon finding the portrait, there will be breaks, usually in the form of 00, that seem to tell the portrait what to do in some spots. Note below, the red numbers are these breaks. You'll notice, however, sometimes they use other numbers. This indicates that it will be referencing a previous segment, in order to save code. The yellow numbers below are how the game picks which pixels that'll be repeated, the blue being which pixels are referenced, and the green is what it will look like in the game (or at least the memory viewer). To completely avoid this, you just have to change all the red values to 00, and make sure there is another 00 after every eighth hex segment thing.

-----------------------------------------------------------------
                        00 00
00 E0 3D 00 E0 DE 13 00 5E
00 35 11 00 1E 33 31 D0 13
00 53 31 1E 31 51 53 3E 31
00 85 75 8D 13 85 47 BC 58
00 13 31 35 11 11 53 13 33
00 13 11 31 35 31 55 51 15
00 85 33 73 15 38 11 44 34
00 77 39 44 47 47 57 C5 0D
00 00 E0 35 C1 ED 5E 11 31
00 55 53 33 11 11 55 13 31
10 53 33 53 35 11 11
00 30 81 13 31 55
00 71 87 58 55 00 C0 00 00
00 0E 5E 00 00 ED 85 00 00
00 13 C3 00 00 31 E8 00 00


To recap, the yellow values appear in the rom, while the green is what appears in it's place in the game. Basically, this sucks, and means you'd have to prepare your portrait to have certain pixel segments repeat throughout the whole thing. To completely avoid this, you just have to change all the red values to 00, and make sure there is another 00 after every eighth hex segment thing. You can do this all the way to the end of the portrait (or at least from my tests, this seems to be ok). By doing this, you can enter anything you want in the entire portrait.

Does this make sense? I can try to clarify if it doesn't.

For the record, this new system cut my time down from about 2 weeks a portrait (given my schedule) to about 2 hours, from initial drawing to final implementation.
« Last Edit: October 21, 2011, 09:58:43 PM by magicpants29 »

samurai goroh

  • FF5 Hacker
  • *
  • Posts: 100
  • Gender: Male
    • View Profile
    • My page
Re: GBA portraits
« Reply #29 on: November 04, 2011, 12:51:44 PM »
I was looking around romhacking forums & found this topic that might help a bit (seems that the user never came back, so I'm not sure if is possible to contact him or not)
http://www.romhacking.net/forum/index.php/topic,10364.0.html

BTW magicpants29, Faris looks great, loved it, though I can't say the same for Lenna. Her shoulder kind of bothers me, she's the only one that is turning her head around rather than looking to the distant, but I suppose that's the intention, right?

Edit: found another topic, with a little more information
http://shrineofseals.net/forum/printthread.php?tid=3801
« Last Edit: November 04, 2011, 10:30:16 PM by samurai goroh »
I'm the best in the universe! Just remember! [F-zero X]