Welcome to the Shining Force Central Forums!
SFC Forums Index Shining Forums Shining Force II
Register for your free forum account now or Login to remove this advert.

Xenometal's SF2DISASM workshop

Newest work: Character Expansion

Discussion about this classic Genesis/Mega Drive game.

Xenometal's SF2DISASM workshop

Postby xenometal » Fri Mar 09 2018 6:15am

Originally titled [Patch] Mithril Shop

Image

Bowie: "I'll, uh, have a Gisarme, please."


Does exactly what is says on the tin.

More precisely, this implements a customized routine which let you access an exclusive shop and buy a single weapon in exchange for a piece of Mithril. Gotta pay the full price now, though!

The .ips patch below is Plug & Play and meant to be applied to a vanilla rom. It simply lets you buy the weapons that are normally available through the blacksmith.

But there's more!

For modders, I've added support for multiple kinds of materials that the blacksmith will accept, each granting access to its own shop. So, it's now fairly easy to have, say, Small Mithril to craft magic rings and/or Dark Block for cursed weapons as in SF3. Try it for yourself! Load the included save state (Kega Fusion) and see how the blacksmith reacts when you hand him a Wooden Panel or Cotton Balloon.

Modding instructions:
WARNING: SPOILER!


Code: blacksmithactions.asm

Patch: sf2-mithril-shop.ips

EDIT: Updated .ips patch download link.
Last edited by xenometal on Mon May 14 2018 6:56am, edited 4 times in total.
xenometal

User avatar
Shining Member
Shining Member
 
Posts: 431
Joined: Tue Mar 28 2006 3:05am
Location: Canada

Re: [Patch] Mithril Shop

Postby Wiz » Fri Mar 09 2018 10:29am

I was happy when I saw you fork SF2DISASM on GitHub, and now I'm even more happy to see you made several branches.

Go Xenometal go ! :)
Wiz

User avatar
Shining Member
Shining Member
 
Posts: 143
Joined: Sun Mar 18 2007 2:43pm
Location: Blois, France

Re: [Patch] Mithril Shop

Postby DiegoMM » Fri Mar 09 2018 11:39pm

Wow, its really great! so we dont need to reload save states anymore. This way makes more sense to me, I believe it should work like this in the original.
I learned english playing Shining Force 2!
I learned english playing Shining Force 2!
DiegoMM

User avatar
Shining Member
Shining Member
 
Posts: 395
Joined: Wed May 05 2010 2:48pm

Re: [Patch] Mithril Shop

Postby Nuburan » Sun Mar 11 2018 7:25pm

Thank you! I always dread that part of the game.
Nuburan

User avatar
Shining Member
Shining Member
 
Posts: 243
Joined: Thu Dec 22 2011 8:55pm

Item and Spell Expansion

Postby xenometal » Wed Apr 04 2018 7:36am

Hey, I hope you've been enjoying the Mithril Shop patch!

I figured I'd keep posts related to my SF2DISASM work in the same thread, so I'm renaming it "Xenometal's SF2DISASM workshop".

And with that done, I'm presenting you my newest work: the Item and Spell Expansion patch!

Image
"It's spelled, 'spell'."


Features:

  • Allows up to 255 items, and up to 63 spells (4 levels each)
  • Normally unused spell indexes won't crash the game anymore
  • Every spell can be assigned an element and effect subroutine
  • Enough room for icons; no more spells sharing an icon with the Jewels of Light and Evil
  • TODO: Rewrite the hardcoded weapon sprites to reference a table - done! :thumbsup:
  • TODO: Do something about Deals section data in RAM

Unlike the Mithril Shop, it doesn't really make sense to release this as a .ips patch since this is intended as a tool for modders working with SF2DISASM, but I'd be happy upload one along with a save state to quickly see the patch in action if there's a demand.

Quick start guide:
WARNING: SPOILER!


Now, I must admit that even though it seemingly works pretty well on the surface, this hasn't been thoroughly tested so bugs are to be expected. It goes without saying that any and all feedback will be appreciated. :)
Last edited by xenometal on Sat Apr 14 2018 4:55am, edited 1 time in total.
xenometal

User avatar
Shining Member
Shining Member
 
Posts: 431
Joined: Tue Mar 28 2006 3:05am
Location: Canada

Re: Xenometal's SF2DISASM workshop

Postby Wiz » Thu Apr 05 2018 8:14am

Just a quick note, as I rediscovered this recently : chest items may be limited to index 127, because higher indexes are used for gold amounts.
You'll find this in code\common\exploration\explorationfunctions_0.asm :
Code: Select all
loc_239C8:
      clr.w   d0
      move.w  d0,((TEXT_NAME_INDEX_1-$1000000)).w
      cmpi.w  #$80,d2
      blt.s   loc_239EE
      bsr.s   GetChestGoldAmount
Gold amounts don't need such a big range of indexes as it relies on a few registered amounts in a "Chest Gold Amounts" table, but you'll still have to sacrifice either those gold amounts or some item indexes which won't be available in chests.
Wiz

User avatar
Shining Member
Shining Member
 
Posts: 143
Joined: Sun Mar 18 2007 2:43pm
Location: Blois, France

Re: Xenometal's SF2DISASM workshop

Postby xenometal » Sat Apr 07 2018 6:00am

Thanks for bringing this up. As I'm mostly focusing on the menus, stats and battle engine I tend to forget about the exploration part of the game. :sweatdrop:

Now, wait a minute. I'm probably being silly so correct me if I'm wrong, but are there actually chests that contain gold in SF2? I just had a look through Moogie's guide to refresh my memory, and she doesn't mention any. Is that an unused functionality?
xenometal

User avatar
Shining Member
Shining Member
 
Posts: 431
Joined: Tue Mar 28 2006 3:05am
Location: Canada

Re: Xenometal's SF2DISASM workshop

Postby Wiz » Sat Apr 07 2018 1:15pm

Oh no that's not a silly observation at all, you must be right, I was also wondering if that was ever used in the game ... anyway, let's try it !
Ahah yeah !
It works very well with chests on map 19 (Granseal Castle), and I could change the gold amounts available to find the limit : you can fill chests with up to 32767 gold coins ($7FFF) ! :)
Wiz

User avatar
Shining Member
Shining Member
 
Posts: 143
Joined: Sun Mar 18 2007 2:43pm
Location: Blois, France

Re: Xenometal's SF2DISASM workshop

Postby DiegoMM » Sun Apr 08 2018 11:00pm

Its unused in the game
I learned english playing Shining Force 2!
I learned english playing Shining Force 2!
DiegoMM

User avatar
Shining Member
Shining Member
 
Posts: 395
Joined: Wed May 05 2010 2:48pm

Re: Xenometal's SF2DISASM workshop

Postby xenometal » Mon Apr 09 2018 7:48am

Of course they had to sign-extend the value gotten from the table so that it's possible to obtain a negative amount of gold. That makes sense! :lol:

Ah well, if it's unused then I don't necessarily have to support it, do I? I just made all items available from chests by default, and I'm leaving it to modders discretion whether they want to make use of that feature in their project (search for the "CHEST_GOLD_AMOUNTS_START:" label in sf2enums.asm).

I've also patched enemy equipment data according to the new format, so they have their weapons correctly equipped.
xenometal

User avatar
Shining Member
Shining Member
 
Posts: 431
Joined: Tue Mar 28 2006 3:05am
Location: Canada

Re: Xenometal's SF2DISASM workshop

Postby jordanelias » Mon Apr 09 2018 6:24pm

All hail.
jordanelias

Newbie
Newbie
 
Posts: 9
Joined: Mon Aug 14 2017 10:04pm

Re: Xenometal's SF2DISASM workshop

Postby xenometal » Sat Apr 14 2018 4:43am

Turns out there wasn't too much work involved in expanding the weapon sprites+palettes table after all! Thanks to Wiz's great write-up detailing the workings of this system, I figured I could just skip the hardcoded range and expand the table to the maximum number of entries. This way, we trade a bit of ROM space in order to afford the convenience of turning any item into a visible weapon.

However, another issue has presented itself; the Deals section. There's only enough room in RAM to keep track of item amounts (up to fifteen) for 128 item indexes under the current system, so expanded items cannot be added to deals at the moment. This will eventually need to be addressed somehow.

Ideally, I'll stumble upon a sizable chunk of unused RAM, otherwise some compromise will have to be made... :shifty:
xenometal

User avatar
Shining Member
Shining Member
 
Posts: 431
Joined: Tue Mar 28 2006 3:05am
Location: Canada

Re: Xenometal's SF2DISASM workshop

Postby Flygon » Mon Apr 16 2018 6:04am

How much SRAM are you able to address?

Theoretically, you'd probably be able to get away with addressing about as much as you want. Not that there's probably much need for addressing more than half a megabyte.

Do emulators choke up when addressing more than the standard amount? From a hardware perspective, it's fairly trivial.

Yes, using more SRAM is cheating, but I don't care, if NES games pulled that crap all the time, the Mega Drive should be allowed to too. :)
Flygon

User avatar
Powered by Jets
Shining Hero
 
Posts: 871
Joined: Sun Jan 18 2009 4:04am
Location: Victoria, Australia

Full Class Names

Postby xenometal » Sun Apr 22 2018 12:11am

Are you suggesting to use SRAM as if it was "working" RAM? The thought didn't occur to me at first, but now that you mention it, I recall that Final Conflict seemed to be doing just that from what I could tell.

Unfortunately, I don't think I can address any SRAM at all, since the 4MB expanded ROM is taking up all of the 0x000000-0x3FFFFF addressing space. BigNailCow apparently implemented an SRAM bankswitching routine to handle game saving/loading, but I don't know the details.

Wiz did mention that SRAM size could be doubled if needed, this could open interesting opportunities if we had an extra 16KB of RAM to work with.

As for whether that's cheating, well, why does it matter as long as the hardware is happy to play along with it? I say, let's just crank all of the knobs up to 11 and call it a day. :biggrin:

--

Here's a quick patch in the meantime that implements full class names.

Image Image
Image Image
Why Sheela? Because.


This includes a variant of BigNailCow's 3 digit stats hack, and as you can see, also preserves the ability to display the vanilla class name abbreviations where space is limited.

I'd like to know your opinion on the new window layout designs in terms of aesthetics, readability, etc.

Something to note is that I had to split the "class name + character name" header in the main status window into two lines due to some longer string combinations running outside the border (looking at you, "Pegasus Knight Chester"!) It does have the side effect of looking a bit jarring when the string is short enough that it could fit on one line, though. Hmmm...
Last edited by xenometal on Mon May 14 2018 6:36am, edited 1 time in total.
xenometal

User avatar
Shining Member
Shining Member
 
Posts: 431
Joined: Tue Mar 28 2006 3:05am
Location: Canada

Re: Xenometal's SF2DISASM workshop

Postby DiegoMM » Sun Apr 22 2018 6:47pm

Looks really good. Normally as second img shows the class names comes after the name, why it is first(mastermonk sheela) in the first image? something to do with space?

I think its great that in battle and small windows still has abreviation, its a good use of space and remais some classic flavor :P
I learned english playing Shining Force 2!
I learned english playing Shining Force 2!
DiegoMM

User avatar
Shining Member
Shining Member
 
Posts: 395
Joined: Wed May 05 2010 2:48pm

Re: Xenometal's SF2DISASM workshop

Postby Remuko » Sun Apr 22 2018 10:30pm

xenometal wrote:Are you suggesting to use SRAM as if it was "working" RAM? The thought didn't occur to me at first, but now that you mention it, I recall that Final Conflict seemed to be doing just that from what I could tell.

Unfortunately, I don't think I can address any SRAM at all, since the 4MB expanded ROM is taking up all of the 0x000000-0x3FFFFF addressing space. BigNailCow apparently implemented an SRAM bankswitching routine to handle game saving/loading, but I don't know the details.

Wiz did mention that SRAM size could be doubled if needed, this could open interesting opportunities if we had an extra 16KB of RAM to work with.

As for whether that's cheating, well, why does it matter as long as the hardware is happy to play along with it? I say, let's just crank all of the knobs up to 11 and call it a day. :biggrin:

--

Here's a quick patch in the meantime that implements full class names.

Image Image
Image Image
Why Sheela? Because.


This includes a variant of BigNailCow's 3 digit stats hack, and as you can see, also preserves the ability to display the vanilla class name abbreviations where space is limited.

I'd like to know your opinion on the new window layout designs in terms of aesthetics, readability, etc.

Something to note is that I had to split the "class name + character name" header in the main status window into two lines due to some longer string combinations running outside the border (looking at you, "Pegasus Knight Chester"!) It does have the side effect of looking a bit jarring when the string is short enough that it could fit on one line, though. Hmmm...



I'm curious in one of those Sheela pics from the menus, it has the bit on the side that shows the map sprite, but it has a number 19 above her sprite. What's that about?
Remuko

User avatar
Member
Member
 
Posts: 30
Joined: Thu Jul 02 2009 3:36am

Character Expansion

Postby xenometal » Mon May 14 2018 6:56am

DiegoMM wrote:Looks really good. Normally as second img shows the class names comes after the name, why it is first(mastermonk sheela) in the first image? something to do with space?

I think its great that in battle and small windows still has abreviation, its a good use of space and remais some classic flavor :P


That's how it is in the original game, e.g., "MMNK SHEELA". I aimed to stay as close as possible to the original layout, but it's not a problem to swap the two strings positions should that be preferable. As for what's preferable, well, that's subjective so I'm open to suggestions.

By the way, there's a visual oddity that I've purposefully omitted in the above pictures. :shifty: In the characters listing window, "Pegasus Knight" is running out of space, so the "t" is being overwritten by the level... That's servicable as-is, but hardly looks good! A solution could be to kill the EXP reading and shift LV all the way to the right I guess, but I'm really not sure how preferable that would be! In fact, "Pegasus Knight" is just being a pain in general. Damn you, "Pegasus Knight"!

Remuko wrote:I'm curious in one of those Sheela pics from the menus, it has the bit on the side that shows the map sprite, but it has a number 19 above her sprite. What's that about?


My bad. I took the picture while in debug mode (which is a feature of the original game, so unrelated to my work). Don't worry, it won't show up when playing normally.

--

So, I figure it's about time that I share my work on a much requested feature: Character Expansion

Image
You can finally play as your favorite character: Elis


Download link: Latest patched disassembly

Features:

  • Currently supports the two dummied out character slots, as I'm unsure whether we can easily repurpose superfluous enemy slots at this time.
  • Basic functionalities in and out of battles have been tested; it seems to work fine! :thumbsup:
  • Saving/Loading works (although I didn't have to do anything; the engine already supported it. ;) )
  • Reworking of the portrait assignment routine for force members.

When I say basic functionalities, I mean common actions that we typically perform when playing SF. Off the top of my head:

    Out of battle:

  • Stats generation (level-up to starting level at new game start)
  • Recruitment/Appointment to the active force
  • Transferring items
  • Equipping weapons
  • Resurrection

    In-battle:

  • Presence on the battlefield (normally, even if we manage to hack one of the dummied out characters into our active force, they couldn't participate in battle. In fact, they wouldn't seem to even exist at all!)
  • Getting a turn
  • Attacking an enemy
  • Being targeted by enemy attacks
  • Gaining EXP/Leveling up
  • Stats being reset after battle

On the other hand, I didn't get to test some edge cases/hardcoded effect routines such as, say, Aura 4 targeting the whole force or Prism Flowers death ray of doom moderate annoyance. Use at your own risk, and bug reports are welcomed!

As for "reworking of the portrait assignment routine for force members", we must know that the character index is normally used as the portrait index for force members. In vanilla SF2, we have the first 30 portraits which are reserved for our force immediately followed by Elis' and Astral's; this means that our new recruits are forced to use these two portraits by default. In addition, there are some further hardcoded shenanigans going on that override portrait index based on class (for those who get a new portrait upon promotion.) This poses a problem whenever we want to repurpose classes; all our ninja would belong to Slade!

In other words, the current system is hot garbage, so I wrote a routine that instead retrieves a portrait based on a character's map sprite, referencing a table that already exists (thanks to Earl for reminding me of it!)

Thankfully, Wiz has recently released a nice tool that allows us to easily modify this data, so it shouldn't be too much trouble to set up your new characters. Basically, once you've defined a base map sprite in "disasm\data\stats\allies\allyspriteids.bin" (here's another beautifully hardcoded system, by the way), then you simply make sure that a portrait is linked to it in "disasm\data\spritedialogdefs.bin" using Wiz's SF2DialogPropertiesManager tool.

Let me know how it goes!
xenometal

User avatar
Shining Member
Shining Member
 
Posts: 431
Joined: Tue Mar 28 2006 3:05am
Location: Canada

Re: Xenometal's SF2DISASM workshop

Postby DiegoMM » Mon May 14 2018 5:14pm

wonderful! cant wait to try.
How can we make then join the force?
I learned english playing Shining Force 2!
I learned english playing Shining Force 2!
DiegoMM

User avatar
Shining Member
Shining Member
 
Posts: 395
Joined: Wed May 05 2010 2:48pm

Re: Xenometal's SF2DISASM workshop

Postby xenometal » Tue May 15 2018 10:54am

That's... a good question! I've just been using the Debug/Battle Test mode to test things out for now. Here's a patch that'll let you access that feature along with the Special Configuration mode more easily. That'll make it so that at the Sega logo, you'll only need to press either Up and/or Down to activates these modes, respectively.

As for the Battle Test, first press Up to activate Debug mode (you'll hear the "cursed item" jingle), then press Up again and hold it until you see a textbox that says "Battle number?". Um, yeah, so it's not the most user-friendly thing ever but it's serviceable. :lol:

On the other hand, if you're asking how to add the characters into the game world and have them join "properly" after some dialogue and whatnot, well, that's a fairly complex question to answer! I don't even know all the details myself at this time, but the gist of it is that it involves "mapsetups" (ASM files located in "disasm\data\maps\entries\mapXX\mapsetups"), more specifically the "s2.asm" files that handle entity events such as NPC interaction. You'll also want to refer to Wiz's Cutscene Documentation.

If you're up to it, I suggest to give a look at the mapsetups for map08 (Ribble) for the event that lets you recruit May, as that's about the simplest example of a character join event, i.e., some NPC randomly wandering the map, you talk to them, they join.
xenometal

User avatar
Shining Member
Shining Member
 
Posts: 431
Joined: Tue Mar 28 2006 3:05am
Location: Canada


Return to Shining Force II

Who is online

Users viewing this topic: No registered users and 0 guests