Level 99 Recruitment Bug - Practical Use?

If you are stuck in the Dunan Unification Wars; or wish for more details on the gameplay systems, this is the place.
Post Reply
Omnigamer
Posts: 324
Joined: Wed Feb 13, 2013 11:48 am

Level 99 Recruitment Bug - Practical Use?

Post by Omnigamer »

Many of us are familiar with the Level 99 character bug, but for the most part it only seems to come up due to poor emulator construction.

The fact that it is most commonly seen in emulators though does not mean the bug is impossible or nonexistent on official ports. The underlying code still makes it possible to get an arbitrary-level character on recruitment if the circumstances line up for it.

My question then: is there a reasonable way to force this to happen? Since it is based on poor initialization of stack values, shouldn't there be some approximate means of making values go to the stack just prior to the recruitment action, resulting in a malformed argument to the function?

There are a lot of minor details related to this, but with enough knowledge on other trigger-able functions and processes, I'm wondering if there's an easily repeatable means to trigger this bug as needed. If there is, then it could be incredibly useful for various things. If there are too many competing processes that leave the stack in an unpredictable state, then at least approximating the probability of it occurring would be helpful.
User avatar
Pyriel
Webmaster
Posts: 1227
Joined: Wed Aug 18, 2004 1:20 pm

Re: Level 99 Recruitment Bug - Practical Use?

Post by Pyriel »

I don't know about, "easy". I've been wondering for a long time now if it happens more on emulators because some emulators don't exactly replicate initialization tasks that are part of certain syscalls on real hardware. I don't know why they wouldn't, apart from just not being bothered because it shouldn't be that important, but it's the only simple explanation that springs to mind.

Your biggest sticking point is probably going to be that any junk value large enough to be interpreted as negative will definitely break the exploit. If a level less than the character's current level is passed, nothing is done. So any pointer stored on the stack, including return addresses, will stymie your attempts. So you need to find a function that litters the stack with word values greater than 0xFF and less than about 0x7FFFFFCD.

How valuable would exploiting it really be? The function in question only comes into play for 7 characters who aren't exactly cream-of-the-crop. I can see how getting Anita and Hoi early, and at level 99 might have some advantages, but I don't think they'd be that massive. Although having level 99 Georg, Pesmerga, and Mazus might be valuable late in the game, during a speedrun.
Omnigamer
Posts: 324
Joined: Wed Feb 13, 2013 11:48 am

Re: Level 99 Recruitment Bug - Practical Use?

Post by Omnigamer »

Anita in Muse would potentially be the biggest thing to consider for typical speedruns. It changes a fair bit from the perspective of having another mage early on with sufficient level 4 spell MP. If there were some way of forcing deaths on her as well, then she could also be a great candidate for using the Kindness rune as well, with high TECH and SPD. That said, it's not clear from the bug notes whether she's susceptible in Muse; I imagine the same check for Valeria's level occurs, but since she hasn't been recruited, it's all 0s and nothing happens under typical circumstances.

As for the other characters, those would only be beneficial for a True Ending run, but they would still be helpful. Most specifically a very slightly faster Mazus would allow for some newer strategies against Beast Rune and Seed & Culgan.

"Easy" is relative, of course, but even just a proof of concept that it can happen on realistic hardware/emulators is enough. I might try to force a scenario for this in BizHawk by poking values into memory ahead of time just to see if I can even get it to trigger then. If it works, then I can try to dig in further and see if there's any way to pre-load that part of the stack with anything at all, let alone a good positive number. Should be interesting to observe, one way or another.
Post Reply