[Glitch] Characters joining at lvl 99

If you are stuck in the Dunan Unification Wars; or wish for more details on the gameplay systems, this is the place.
Post Reply
User avatar
Hirathien
Posts: 697
Joined: Mon Dec 07, 2009 8:26 pm

Re: [Glitch] Characters joining at lvl 99

Post by Hirathien »

When i added Pesmerga by cheat, into the game when i was at Viktor's fort, he was level 50.
Shinyo
Posts: 34
Joined: Mon Aug 23, 2010 2:23 am

Re: [Glitch] Characters joining at lvl 99

Post by Shinyo »

I like tiki's idea, but if they join at level 1 like Crispy said, it won't work. Instead you would have to recruit them after every event (or after several decisions that you made), which means you would need a wallhack or a hack/cheat to teleport to all places or enter places that cannot be entered yet. (Is that even possible? :D)

But the problem is, that they won't join unless a certain event took place for Hoi (killed Luca) and Georg (killed Neclord) or your castle is level 4 for Pesmerga and Yuber, so I guess the only possibility would be Long Chan Chan in Crom (I heard Anita in Muse can join at level 99, too, so that's even better.).
And if you miss Anita in Muse you will have to go to Banner Village to recruit her.
Check out my blog for random fun stuff and reviews!
KFCrispy
Global Admin
Posts: 6176
Joined: Wed Jun 30, 2004 3:29 pm

Re: [Glitch] Characters joining at lvl 99

Post by KFCrispy »

Hirathien wrote:When i added Pesmerga by cheat, into the game when i was at Viktor's fort, he was level 50.
that could be Pesmerga's default level if you didn't load Suikoden I data. but we can certainly try things out.
User avatar
Pyriel
Webmaster
Posts: 1229
Joined: Wed Aug 18, 2004 1:20 pm

Re: [Glitch] Characters joining at lvl 99

Post by Pyriel »

For the hell of it, I've decided to see if I can pin down the cause of this particular glitch. If anyone has game saves with the glitch active, and the ability to copy them to the PC and e-mail them to me, it might be helpful. Just PM me if you think you can help. Preferably, the saves would be made shortly before you recruited someone that joined at 99, so all that has to happen is the party journeys to meet and recruit the character.

I've already identified the code responsible for building the characters up to whatever level on joining. I've had Yoshino join at level 99 and level 1 in a couple of attempts. The weird thing about this is that this function calls the function that increases stats (current level, STR, MAG) at level-up, which in turn calls a function that can call this batch level-add function. It's bizarrely circuitous. While it's not recursion in the usual sense, it does give me concern that the problem might be related to stack corruption, since the level-increase functions make use of the stack for retaining relevant data across calls. (This is not unusual on the PSX/PS2, but it's not terribly common in simple routines, since 4-6 registers are set aside for the purpose of passing arguments, depending on the compiler in use. In a typical, simple function, the stack is primarily used to preserve save registers and return addresses.) However, from the sound of this thread, the problem remains after saving and restarting the game. If it is stack corruption, the result of it somehow winds up in the saved data. Even if the cause is never fully understood, it may be possible to trigger or remove the results at will.

If anyone is interested in playing around with join levels:

Recruited Characters Join at Level ??
800726CC 00??
800726CE 3412
User avatar
Celes
Global Admin
Posts: 1422
Joined: Sun Nov 12, 2006 6:25 pm

Re: [Glitch] Characters joining at lvl 99

Post by Celes »

Characters "level-up" during the recruitement, being stored all as lv 1 (or even lv 0, don't remember) on a clear save file. So even a character who joins at fixed lv (let's say always lv 30) will start with different stats each try.

Did you take a look at the initial levels "in-game" this way, Pyriel? Never managed to do so.
User avatar
Pyriel
Webmaster
Posts: 1229
Joined: Wed Aug 18, 2004 1:20 pm

Re: [Glitch] Characters joining at lvl 99

Post by Pyriel »

You could certainly do that. I've gone through 4 or 5 recruitment events with the characters all coming at level one using the code I posted. I never really said anything about stats, but that's sort of the point. No matter what level the character is scripted for they gain those levels, more or less one at a time, via the functions I described. These guys join at hero+5, or whatever, so some script (probably in their area file) makes the determination of what level they should join at, and erroneously arrives at 99. I haven't yet found one of the scripts just hunting through code files, though. I think I know where one of them is, but it may require more than one overlay file. I really don't know.

Edit: Do the saves on the site have the level 99 glitch active? I downloaded #19 and played up through recruiting Pesmerga. He joined at level 99 despite the hero being level 51, so I assume it was either active, or I somehow triggered it.
User avatar
Pyriel
Webmaster
Posts: 1229
Joined: Wed Aug 18, 2004 1:20 pm

Re: [Glitch] Characters joining at lvl 99

Post by Pyriel »

Ha ha. It's almost exactly the first option that came to my mind when I was trying to think what could cause this. It's funny because I had given that option a low probability, thinking that nobody could actually do something like that and have it get through all rounds of QA. Here's the bug:

Code: Select all


#This is part of a multi-purpose routine that can add levels, retrieve character data regarding levels, etc.
#When the first argument passed (register $a0) is zero, it retrieves a character's level. In this case, it's the hero's.
RAM:80073FB8 lbu $v0, 0x86E($v0) <- Load the base level for the script
RAM:80073FBC nop
RAM:80073FC0 sb $v0, 0($s5) <- Store the level. Register $s5 is set from the fourth argument to the function ($a3). The address is part of the stack for the calling routine in this case.
That's all fine and good, load a byte value, store a byte value. This next section was probably written by a different programmer, and the two must not have talked much.

Code: Select all


#This is the code for actually setting the character's level when they join up.
RAM:800A233C addiu $a3, $sp, 0x28+var_18 <- Set the value where the base will be stored. Stack + 0x10 here.
...
RAM:800A236C jal sub_80073E24 <- Call the multi-purpose function above.
...
RAM:800A237C lw $v0, 0x28+var_18($sp) <- Get the base level value, stored by the multi-purpose function.
The dopey recruit script retrieves a value stored as a byte, as though it was a word (4 bytes). Since it's pulling off the stack, and the space contains whatever was left there by the last thing that used it, there's a fair chance that the value retrieved will have something more to it than the byte value that was stored. In the test I just ran, the multi-purpose function stored 0x33 (level 51), which was expected. When the recruit script retrieved it, along with the next 3 bytes, the value it got was 0x00008A33. It then added 5 to it, and passed that to the multi-purpose function along with an argument telling it to set Pesmerga to that level. Some of the other functions involved will check to make sure that the value is less than 100, so the result is a level 99 Pesmerga instead of 35,384, which is the level it tried to set, or 56, which is the level it should have set.

The actual trigger for the bug could be literally anything. It's all down to what functions have operated within that particular memory space, and what they left there. Consistency is just down to the vagaries of the system. It's not unusual for the same machine to allocate stack frames or heap space in exactly the same way every time a particular program runs in a certain state. You would literally have to trace every access to memory used by the stack, and then look at all the writes to see what left the data there to be picked up erroneously. However, the actual bug is that the recruitment routines are not written correctly. Simply loading a byte instead of a word or even ANDing the value with 0x7F/0xFF would prevent this.

Bottom line: While the bug may be consistent on your system during a play-through, I don't think there's any reliable way for a player to deliberately trigger it. You might raise your chances by traveling as widely as possible and playing about in the menus as much as you can, but I can't swear that a particular sequence of events will or won't cause the bug to occur.

Fix Recruit at 99 Bug
D00A236C CF89
800A237E 83A2
D00A236C CF89
800A238A 83A2

This modifies the recruitment procedure to treat the level value it gets back as a byte/char rather than a word/int. I think it'll work for every recruit, but it may miss some things. If there are characters that use other scripts and differently located procedures, they may still be subject to the bug. You can do this a bit more "scorched earth" by modifying the routine that actually stores the byte value, but I've seen it called where they handed it half-word alignment, so you can't simply change it to store a word, and there's no guarantee that a routine somewhere won't be using every byte of stack space it allocated to hold values.

Edit: Oh yeah, thanks to KoRnholio for the saves. I only had to play about 15 minutes to get through two events, recruit 5 people, and then Mazus and Pesmerga became available.
highwind44029
Posts: 1490
Joined: Wed Sep 29, 2004 4:40 am

Re: [Glitch] Characters joining at lvl 99

Post by highwind44029 »

Hmm... so it's consistent in a single playthrough? I didn't even know Hoi could be glitched at Level 99, and he did in my game. Same with LC Chan, so now I have two. Should I expect Mazus, Georg, and Pes to join at max level too?
User avatar
Pyriel
Webmaster
Posts: 1229
Joined: Wed Aug 18, 2004 1:20 pm

Re: [Glitch] Characters joining at lvl 99

Post by Pyriel »

Well, it wasn't my intent to imply that, but I can see how it might be interpreted that way. I'm basing the assumption that it appears consistent on people's anecdotes, and the fact that I was able to get two characters to join at 99. It is just an appearance, though. The bug can occur at any time; it's just an accident waiting to happen. However, it is in no way persisted in the save data, and may or may not crop up during a given play session. The fact that it tends to occur four times if it occurs once is down to a combination of luck, to identical or nearly identical behavior by your system when setting things up during different sessions, and possibly to consistent behavior on your part.

Knowing what the bug is, I'm actually surprised that it doesn't happen much more frequently. Since your system and your play style seem predisposed to triggering the bug, I'd say the chances are fair that Mazus and Pesmerga will suffer from it as well, but it's not guaranteed. For example, I triggered the bug while playing, and Pesmerga and Mazus joined at level 99. I was using Save #19 from the site, and L.C. Chan had previously been recruited at, I think, level 37 or less (I know he was in the 30s). I didn't check Hoi.
User avatar
Celes
Global Admin
Posts: 1422
Joined: Sun Nov 12, 2006 6:25 pm

Re: [Glitch] Characters joining at lvl 99

Post by Celes »

I assume the whole thing only goes for characters whos initial lv is based on Riou's current level, correct?
User avatar
Pyriel
Webmaster
Posts: 1229
Joined: Wed Aug 18, 2004 1:20 pm

Re: [Glitch] Characters joining at lvl 99

Post by Pyriel »

I can't definitively answer that question. I believe that's the case.
LetsRock

Re: [Glitch] Characters joining at lvl 99

Post by LetsRock »

I never heard of this glitch and Hoi recently joined for me at Level 99

So is there a solution? (Not a gameshark code)

For example: Should i reenter the town or recruit first other characters or do something else before going to Hoi? I tried some of them but he still joins at Level 99. I defeated the Bone Dragon right now and saved in my castle. Should i continue with my story?

Thanks for the help
User avatar
Pyriel
Webmaster
Posts: 1229
Joined: Wed Aug 18, 2004 1:20 pm

Re: [Glitch] Characters joining at lvl 99

Post by Pyriel »

I wouldn't worry about it. It's not a game-breaking bug, after all.

Like I said, there's no telling what will trigger the glitch, so there's also no one thing anybody can tell you to avoid.
LetsRock

Re: [Glitch] Characters joining at lvl 99

Post by LetsRock »

EDIT
Last edited by LetsRock on Wed Jul 13, 2011 1:36 am, edited 1 time in total.
LetsRock

Re: [Glitch] Characters joining at lvl 99

Post by LetsRock »

I finally found a way.

I was using epsxe 1.7 and no matter what i was doing they all (tried with hoi, chan and georg) joined at Level 99. So i used another emulator (pSX 1.13) and they didnt joned at level 99. After that i saved and was using epsxe 1.7 again and everything was fine (no level 99 anymore). My Heros level was 51 and Hoi joined at Level 41 and Chan at 38.

I hope this helps

PS: The tool i was using was called Memory Card Rex for changing the file extension of the memory card (epsxe 1.7 memory cards have mcr and pSX 1.13 have bin format)

Sorry for double post
Post Reply