Author Topic: Yuffie Appearance + Bug  (Read 7346 times)

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Yuffie Appearance + Bug
« on: 2016-02-02 23:44:56 »
============
This bug can be worked around by using

Code: [Select]
Music volume transition (param1=1, param2=127, param3=0, param4=0, param5=0)
Play music #0

In the "init" script.

The PC port is at fault for the underlying issue.
============

spy_dragon recently made me aware of a bug with the music. If you encounter Yuffie (and win), the gil menu appears and then when that is closed, you are jumped to the Yougan2 map. The bug is that the music played will not be correct - it will always be the last field music you heard. This does not occur with the PSX game, and the field code is the same.  There is nothing wrong with the field code - so it has to be related to how this field loads in the PC game.  A possible porting error. 

Normally, a field is loaded either from another field (so a jump from the field code), or from the world map by entering villages.  But in this instance, the field map is jumped to after the battle menu is closed.  Even if we assume that some var is being set that causes the world map to load momentarily and then jump you to Yougan2 (I checked for such a var but couldn't replicate the action), this is still an onorthodox jump.  And something is going wrong in the process.

Spy_dragon fixes this by moving the "play music #0" field code elsewhere - outside of "main > init", which does work around this issue.  But that's a sloppy fix and is not fixing the underlining issue. 

Does anyone know what causes this?  Or what vars need to be set in memory to cause the jump to yougan2?  Or even what the mechanics are for how we end up at Yougan2?

« Last Edit: 2016-02-05 01:00:56 by DLPB »

sithlord48

  • *
  • Posts: 1641
  • Dark Lord of the Savegame
    • View Profile
    • Blackchocobo
Re: Yuffie Appearance + Bug
« Reply #1 on: 2016-02-03 13:13:53 »
had a user report an issue the post is here
http://forums.qhimm.com/index.php?topic=9625.msg231314#msg231314

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: Yuffie Appearance + Bug
« Reply #2 on: 2016-02-03 17:25:50 »
That issue was resolved in R04 and R03e. This is a totally different one. :)

Kaldarasha

  • *
  • Posts: 2449
  • Prince of Model Editing
    • View Profile
Re: Yuffie Appearance + Bug
« Reply #3 on: 2016-02-03 18:32:36 »
I also could make only a dirty trick to bring it to work. I guess if you add to main script the commands
Code: [Select]
3 Wait 1 frame
4 Play music #0
it should reload the right song. That's at last how I solved the problem with the non played songs with FF7 music back then.

I assume that after the battle the buffer of the last field isn't cleared or is not cleared fast enough. Maybe on PSX entering the WM does clear the memory of the last fields, but on PC they decided that this won't be needed because a PC has enough memory.  :|

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: Yuffie Appearance + Bug
« Reply #4 on: 2016-02-03 18:37:09 »
main script or "init" ?

What loads the field?  I assume it loads from world map- since the menu closes and then it transports.

Kaldarasha

  • *
  • Posts: 2449
  • Prince of Model Editing
    • View Profile
Re: Yuffie Appearance + Bug
« Reply #5 on: 2016-02-03 19:07:34 »
main script or "init" ?

What loads the field?  I assume it loads from world map- since the menu closes and then it transports.

Sorry I mean the init script.

I have the hunch that on psx all unneeded field data is cleared out of the memory. The battle system my not discriminate between field or WM and will load everything from the memory after the menu is closed. Adding a clear memory command (of course only for the sound) may also reset the music after a battle in field.

Does the wrong played music actually start from the beginning or somewhere else?

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: Yuffie Appearance + Bug
« Reply #6 on: 2016-02-03 19:13:35 »
Not sure...

Any case... why does "wait 1" fix things?  Because then a whole frame has been processed and the bug occurs in the immediate loading frame?

Sega Chief

  • *
  • Posts: 4116
  • These guys is sick
    • View Profile
Re: Yuffie Appearance + Bug
« Reply #7 on: 2016-02-03 19:16:08 »
I also could make only a dirty trick to bring it to work. I guess if you add to main script the commands
Code: [Select]
3 Wait 1 frame
4 Play music #0
it should reload the right song. That's at last how I solved the problem with the non played songs with FF7 music back then.

I assume that after the battle the buffer of the last field isn't cleared or is not cleared fast enough. Maybe on PSX entering the WM does clear the memory of the last fields, but on PC they decided that this won't be needed because a PC has enough memory.  :|

Kald's probably got the right of this. What I read was that the PS1 version overwrites it's RAM because it's got limited space, but the PC version has a lot more RAM or it works differently which means information isn't getting cleared out when you move between different kernels like the world map and field. To fix this, you might actually need to fix the underlying memory issue which would also fix wrong warping in general (maybe) but I imagine it'd be a major task. You should probably just go for Kald's solution; if the end result is the same either way on the user's end, then it's faster (and likely much safer considering what you might need to do to fix that memory thing) to just change the way music is handled on that Yougan field.

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: Yuffie Appearance + Bug
« Reply #8 on: 2016-02-03 19:26:27 »
Indeed.  It is a shame that such a bug exists though.  V annoying.  Still... does anyone know how the game decides that you jump to Yougan2?  Some vars have to be being set?

Kaldarasha

  • *
  • Posts: 2449
  • Prince of Model Editing
    • View Profile
Re: Yuffie Appearance + Bug
« Reply #9 on: 2016-02-03 19:39:55 »
Wait 1 frame gives the game the chance to update the sound buffer and then you can overwrite it with a new call of music #0. At last that's how I assume it works.

Quote
Not sure...

If I'm right it should start somewhere else if not I'm probably on the wrong track.

Now where I'm think about it this a jump from wm to field depending on the outcome of the battle. It should be reproducible from another scene where it jumps from the WM to a field. Maybe the Diamond Weapon scene.

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: Yuffie Appearance + Bug
« Reply #10 on: 2016-02-03 20:36:58 »
I think you both may be right.  But hell knows how I'd fix it.  So Wait 1 it is.  Tony may want to take note also, since his fix was a little more convoluted.

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: Yuffie Appearance + Bug
« Reply #11 on: 2016-02-03 22:10:46 »
Wait 1 frame didnt work with the Yuffie field.

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: Yuffie Appearance + Bug
« Reply #12 on: 2016-02-03 22:15:26 »
Regardless of what's there in "init" - the shinobi music does start - but is then superseded by the previously heard field music.  An unscheduled change occurs.

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: Yuffie Appearance + Bug
« Reply #13 on: 2016-02-03 22:44:41 »
Placing


Music volume transition (param1=1, param2=127, param3=0, param4=0, param5=0)
Play music #0

Does. 

No need for a wait.  Just needs a "akao" with arguments:

7: 193
8: 1
9: 127

I have no idea what that is.  I have a feeling that "127" is the volume.
« Last Edit: 2016-02-03 22:47:12 by DLPB »

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: Yuffie Appearance + Bug
« Reply #14 on: 2016-02-03 22:53:36 »
Seems that this is how it works

if 7 = 192, then set music volume to what 8 is.

if 7 = 193, then transition volume from 8 to 9.

So basically, the akao should only be 7 = 192, and 8 = 127.  Where 127 is maximum volume.  That will set the music volume to 127.  Myst6re has already realized this.

edit.

I think 193 is fade in.  And 194 is fade out.

So 192: set absolute.
193: fade in.
194: fade out.

I think.  Anyway... the bug can be worked around by using absolute to change to 127 volume.

http://wiki.qhimm.com/view/FF7/Field/Script/Opcodes/F2_AKAO

edit 2

It's there anyway.  Looks like 3 of them are noop in PC which may explain some of the music issues.
« Last Edit: 2016-02-04 01:43:34 by DLPB »

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: Yuffie Appearance + Bug
« Reply #15 on: 2016-02-04 01:55:44 »
FF7 PC also has a bug with akao (F2).  Certain things aren't working the same as PSX and, as Aali notes, 3 of the opcodes don't work at all.

This is why in Fship_25, during Cid's speech, the music stops then restarts.  It is supposed to stay silent.  This can be remedied by using a stop music, or by changing akao values. But whatever it was doing on PSX, it isn't doing in PC.

Fship_25 has an issue because akao argument 7 is set to 194. and it doesn't like the value set on argument 10. So clearly 194 for argument 7 in akao does not work correctly.  Setting it to 193 (transition) can fix the bug too, but I'm not sure what is really going on when I use transition as opposed to fade.  You can also just use 240 (F0) to stop music.  The question then is why are there two "stop musics"  One using akao, and one on its own.

I'm also not sure why there is an "akao2", especially since it seems to work the same as akao?
« Last Edit: 2016-02-04 02:05:14 by DLPB »