øAslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1945.msg21021e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/indexc33d.htmlslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1945.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/indexc33d.html.zx~g^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈ ,/2OKtext/htmlISO-8859-1gzip0|Ö2ÿÿÿÿÿÿÿÿTue, 10 Mar 2020 04:11:00 GMT0ó°° ®0®P®€§²ð®}g^ÿÿÿÿÿÿÿÿà02 4bpp Graphics Backport

Author Topic: 4bpp Graphics Backport  (Read 9126 times)

Gedankenschild

  • Vargas
  • *
  • Posts: 101
  • Gender: Male
    • View Profile
4bpp Graphics Backport
« on: July 26, 2014, 08:46:52 PM »
Hi everyone!

I thought I'd share what I've been up to recently. After looking through Gemini's very helpful posts from years ago (Thanks!) about inserting 16-color portraits into the menu screen, I became curious. I decided to take a look at ASM and tried to at least understand what exactly his code was doing. After a couple of weeks of studying the guides and experimenting with debuggers I finally hit the jackpot and got my very first ASM hack to work: inserting the 4bpp Wonderswan enemies into the expanded SNES ROM and actually making it work! (YAY!)

It's obviously not finished yet and quite a few things need to be done. The code that loads the enemy graphics is also used to load the background tiles and menu elements like the pointer and damage numbers. Which is a very welcome side effect as far as I'm concerned... 30 color battle backgrounds, anyone? :happy: Also, other palettes like spell flashing and enemy death need to be changed as well. The more complex bosses cannot simply be copied over either, because of the more sophisticated way the game loads their tiles. But that's not much of problem - a tiny bit of simplification won't hurt that much, I think. Oh, and summons display as garbage, so they use unique tile loading code. Same is true for Toad/Piggy/Tiny status effects.

I rewrote the enemy palette/size/graphics pointer index documented by JCE3000GT (Thanks to you as well!) and I can say that code-wise everything seems to be working very well. Even the Four Elements battle (which had me worried) causes no problems thanks to the unsophisticated way the game manages the palettes, hehe... (Remember how Kainazzo turns yellow before transforming into Valvalis - totally unnecessary, but very fortunate for this project!)

I just pasted part of the battle background tiles back over the originals in 4bpp mode to make at least the field background look right in these screens. (That, of course, throws off the index and screws all the other bgs.)

Regards!



(Edit: Replaced screenshot, original didn't survive the forum update)
« Last Edit: December 21, 2014, 02:37:39 AM by Gedankenschild »
You've got to be kidding me with that Dynasty Warriors registration question??!!
I barely know such a series exists...

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: 4bpp Graphics Backport
« Reply #1 on: July 26, 2014, 09:41:03 PM »
Oh man! That is so cool! Does that mean we can look forward to new portraits (and not those awful ones from FFIV:A) in a bit of time as well? Those monsters look quite glorious on the SNES, I must say!

Pinkpuff

  • Flan Princess
  • *
  • Posts: 924
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: 4bpp Graphics Backport
« Reply #2 on: July 27, 2014, 05:07:56 AM »
That looks totally awesome! Great work!

Say, I could actually use your help if you're interested, since you seem to know a thing or two about how to read graphics. I've been trying to get FF4kster to read the map tiles directly from the rom (currently it's just using pre-packaged image files instead). The 3bpp ones I was able to get no trouble, but for some reason the 4bpp ones (ship/airship) are causing me some issues. I posted my code over on this thread. I read various documents over on RHDN and did my best to implement what I understood to be the correct process but it doesn't seem to be producing the correct results.
Let's dance!

Gedankenschild

  • Vargas
  • *
  • Posts: 101
  • Gender: Male
    • View Profile
Re: 4bpp Graphics Backport
« Reply #3 on: July 27, 2014, 10:45:53 AM »
Oh man! That is so cool! Does that mean we can look forward to new portraits (and not those awful ones from FFIV:A) in a bit of time as well? Those monsters look quite glorious on the SNES, I must say!

I'm very much intended to port back whatever I can manage, so yes, that includes the portraits! That makes this a LONG term project, though... One of the main reasons I didn't really do anything about those menu portraits yet, is that I don't know what I should use! We had that discussion in that other thread, I was never that crazy about the GBA ones, but when I compared them to the new ones from the mobile port (that no one can get their hands on) I couldn't take them anymore at all.  :sad:

When the monsters are done I want to try my hand on improving the battle backgrounds, I did some research on them and finally figured out how and where the tile layout and pallet association are stored in the ROM. (Is that something you would be interested in, Pinkpuff?)

Updating the enemies is of course not a simple copy and paste job, the remake (Wonderswan version, but since GBA is based on that I think it's true for both) is actually very wasteful with its ROM space. The palette swap enemies aren't actual palette swaps anymore - they all have their own tile sets! And their colors are arranged differently so that the palettes need to be rearranged by hand in order the work with a single tileset!

That looks totally awesome! Great work!

Say, I could actually use your help if you're interested, since you seem to know a thing or two about how to read graphics. I've been trying to get FF4kster to read the map tiles directly from the rom (currently it's just using pre-packaged image files instead). The 3bpp ones I was able to get no trouble, but for some reason the 4bpp ones (ship/airship) are causing me some issues. I posted my code over on this thread. I read various documents over on RHDN and did my best to implement what I understood to be the correct process but it doesn't seem to be producing the correct results.

Thanks for the kind words! I'd really like to help but I'm afraid I'm not much of a programmer... I can give you the code I changed if that helps. The screenshot I posted in the thread you linked to was obtained by simply opening the ROM in TileLayerPro in SNES 4bpp mode and going to the right address. It doesn't seem to me like the game has any particular, non-standard way of storing those graphics...  :hmm:
I did fool around with location graphics a bit by pasting the DMA routine of the airship over other location's routines, only to test whether the game could run 16-color graphics in towns and dungeons (yes it can).
You've got to be kidding me with that Dynasty Warriors registration question??!!
I barely know such a series exists...

Pinkpuff

  • Flan Princess
  • *
  • Posts: 924
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: 4bpp Graphics Backport
« Reply #4 on: July 27, 2014, 06:54:17 PM »
Wow, I totally overlooked the fact that you had already posted there; my bad!

I'm convinced that there's something wrong with my 4bpp reading routine, I just have no idea what it could be, since, as far as I can tell, it's following the algorithm exactly... the only other possibility I can think of is that it's not starting in the right place, but I'm certain it is... could it be that the algorithm I've been looking off of is incorrect? Anyway that's a discussion for another thread.

Thanks anyway though! ^_^
Let's dance!

JCE3000GT

  • Master of FF4
  • *
  • Posts: 1,429
  • Gender: Male
  • Vladof
    • View Profile
    • BlitzKrieg Innovations
Re: 4bpp Graphics Backport
« Reply #5 on: July 27, 2014, 11:09:27 PM »
Wow this is very nice work I'm very impressed.  I always knew the SNES version of Final Fantasy IV/IIus could be graphically improved.  Do you think the map and overworld tiles could be done/enhanced too at some point?

One last question, how much room does the increased graphics take up?

Gedankenschild

  • Vargas
  • *
  • Posts: 101
  • Gender: Male
    • View Profile
Re: 4bpp Graphics Backport
« Reply #6 on: July 28, 2014, 09:44:03 AM »
Wow this is very nice work I'm very impressed.  I always knew the SNES version of Final Fantasy IV/IIus could be graphically improved.  Do you think the map and overworld tiles could be done/enhanced too at some point?

One last question, how much room does the increased graphics take up?
I did look at the map a little bit. As far as I remember, the updated version uses one palette more than the SNES version. And quite a few more tiles. I do believe that the SNES version loads all map palettes (overworld/underworld/moon) in each of those locations. A certain degree of rewriting things would be required to get it close and of course it would be more static... But even without that, a bit of touching up is not just possible but necessary!
The really interesting thing here is that I'm confident the new overworld (and NPC) sprites should work. The game does indeed reserve 16 colors per sprite palette and then just leaves the last 8 colors empty - so the space is there!

The new graphics + palettes take up 6 banks. I expanded the ROM to 4MB - the same size as the WSC ROM. I guess it could have been squeezed together more tightly, but after seeing some of the WSC tilesets I realized, that ROM space would never become a problem... And I would have had to think harder when redoing the monster index!  :happy:

Just for entertainment purposes take a look at the Evil Wall Tileset (the WSC/GBA one, not mine!) below. Why move it, if you can just paint it anew?  :cycle:

« Last Edit: December 21, 2014, 02:52:06 AM by Gedankenschild »
You've got to be kidding me with that Dynasty Warriors registration question??!!
I barely know such a series exists...

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: 4bpp Graphics Backport
« Reply #7 on: July 28, 2014, 11:13:24 AM »
This boggles my mind... in what universe was it easier for Square Enix to cut and paste the same image six or seven times slightly moving it instead of y,know... Moving the Sprite to the Right as custom battle code says!

Gedankenschild

  • Vargas
  • *
  • Posts: 101
  • Gender: Male
    • View Profile
Re: 4bpp Graphics Backport
« Reply #8 on: September 03, 2014, 06:11:43 PM »
Maybe it's time to post an update...

I was able to fix both battle backgrounds and the cursor and stuff by copying them to the expanded area in 4bpp and rewiring everything. I also finally got summoning to work by locating and rewriting the offset table that is only used when monsters are summoned (as opposed to fought in battle). Redoing the summon loading routine (to load 4bpp tiles) also switched weapon and slash sprites into 4bpp mode, breaking those... And for some reason floating enemy shadows are now also off! Oh well, I will look into that soon, but for now I wanna look at chillyfeez' special sizes data and fix some of the bosses and summons.

Regards!



(Edit: Replaced screenshot, original didn't survive the forum update)
« Last Edit: December 21, 2014, 02:57:49 AM by Gedankenschild »
You've got to be kidding me with that Dynasty Warriors registration question??!!
I barely know such a series exists...

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: 4bpp Graphics Backport
« Reply #9 on: September 04, 2014, 09:42:20 PM »
That looks smooth! Looking forward to hearing some more progress on this front!

Gedankenschild

  • Vargas
  • *
  • Posts: 101
  • Gender: Male
    • View Profile
Re: 4bpp Graphics Backport
« Reply #10 on: October 02, 2014, 07:09:18 PM »
I grew a little bored of enemy stuff and decided to try upgrading the backgrounds a bit, porting over a custom version of the WSC beach background (the water is from the actual WSC background, the sand is from the scene when Cecil is washed ashore near Mysidia). It replaces the field background for now, since that is the only one that can be rewritten top to bottom freely... for now!



A question: Has anyone documented the weapon/spell/enemy flashing palettes? What I mean is, which is which and what starts when and where. I need to do some work on the enemy flashing palettes since they are not prepared for 16 colors. I thought I'd ask before I start researching them more deeply - don't want to do it unnecessarily!  :wink:
You've got to be kidding me with that Dynasty Warriors registration question??!!
I barely know such a series exists...

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: 4bpp Graphics Backport
« Reply #11 on: October 04, 2014, 09:54:41 AM »
Hmm, as I recall there is a sort of "fast and loose" order to the entire thing. Magic Palettes and Weapon Palettes anyhow both use the same bytes. I know that Chillyfeez would have a better idea on this regard because he had a lot of experimentation in getting palettes to look right for Summons when he wanted to make them into battle enemies.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: 4bpp Graphics Backport
« Reply #12 on: October 11, 2014, 01:45:52 PM »
Hey all, sorry, I went on a caribbean cruise on 10/4 and just got back to the US.

Anyway, I never got to the point of finding the flashing palettes, but I did find and document the subroutine within the summon animation routine that makes the summoned monster flash, so it shouldn't be hard to find from there. I won't be back home for another couple of days. Let me know if you still want me to research the flash palette and I will when I'm home.

Gedankenschild

  • Vargas
  • *
  • Posts: 101
  • Gender: Male
    • View Profile
Re: 4bpp Graphics Backport
« Reply #13 on: October 12, 2014, 05:54:09 AM »
Sounds nice, hope you had a good time!

I did a little bit of documenting myself concerning those palettes:

Code: [Select]
074B00 Petrification 1
074B10 Petrification 2
074B20 Menu Stuff
074B30 Size/Toad/Piggy/Egg/Floating Enemy Shadow
074B40 ???? (Gray)
074B50 Purple (Enemy Death)
074B60 Holy Spell Palette
074B70
074B80 White-Blue Spell Palette
074B90 Yellow-Orange-Purple Spell Palette
074BA0 White-Yellow Spell Palette
074BB0 White-Green Spell Palette
074BC0 Yellow-Red Spell Palette
074BD0 Fatal Spell Palette
074BE0 Yellow-Red-Purple Spell Palette
074BF0 Grey Spell Palette
074C00 Brown Spell Palette
074C10
074C20
074C30
074C40 Purple (Heal) Spell Palette
074C50 Life Spell Palette
074C60 Yellow-Brown (Heal) Spell Palette
074C70
======
074C80 Flame Whip Palette
074C90 Murasame Palette
074CA0 Crystal Sword Palette
074CB0 Mage Masher Palette
074CC0 Life Staff Palette
074CD0 CatClaw Palette
074CE0 Dwarf Axe Palette
074CF0 Stardust Rod Palette
074D00 Excalibur Palette
074D10 Some Hammer/Axe Palette
074D20 Gungnir Spear Palette
074D30 Some Axe/Spear Palette
074D40 Masamune Palette
074D50 Bare Fist Palette
======
074D60 "Exit" spell cast in battle (Background)
074D70 "Exit" spell cast in battle (Enemies)
======
074D80 Red Rotating Palette
074D90 Turquoise Rotating Palette
074DA0 Green Rotating Palette
074DB0 White-Yellow Rotating Palette
074DC0 White-Blue Rotating Palette (+ White Spear)
074DD0 Gray Rotating Palette

The palettes themselves are not THAT important. Weapons look pretty much the same in all versions. The slash animations and some spells are slightly touched up and that is something I'd like to address in the future.

The enemy flashing routine is definitely something I'd like to fix. The ninth color isn't moving at all and the rest doesn't look completely right either. I just now realized that there has to be a working 16-color rotation routine already - the one that's used for the party members! That one should be fit to replace the enemy one.



If you have any info on that I would absolutely appreciate that!  :happy:
You've got to be kidding me with that Dynasty Warriors registration question??!!
I barely know such a series exists...

LightPhoenix

  • FF5 Hacker
  • *
  • Posts: 130
    • View Profile
Re: 4bpp Graphics Backport
« Reply #14 on: October 12, 2014, 03:45:38 PM »
Not familiar with FF4, but is it possible the palette color at that position is being overwritten in the code?