Author Topic: [FF7] Preliminary fix for ff7music delay problems [FF7 lessdebug]  (Read 10932 times)

Aali

  • No life
  • *
  • Posts: 1197
  • Karma: 115
    • View Profile
I'm pretty sure this has bothered many (if not all) ff7music users, sometimes you get a rather long and annoying delay before the music actually kicks in.

This is because FF7 floods ff7music with useless debug info (ff7music intercepts this and uses it to determine what to play) instead of sending the 'important' stuff.

Originally, I was just going to release a patch that would nuke 2 of the things i saw clogging up ff7music on my system, but i realized that this could be handled in a much neater way. So here it is, ff7_lessdebug, a utility for disabling some of FF7's debug messages. For the "regular" user, i have included a config file that will stop the two most common ff7music hogs, but the possibilites are endless; this could also be used to get only the 'relevant' info to show in APP.LOG.

The actual program consists of two files, the patcher and the config file. When the patcher is run, it will read the config file and try to match every line with one or more debug messages. It doesnt have to be an exact match, for example "MIDI" will match any and all messages starting with "MIDI". Note that the config file should contain the messages you DON'T want to get. Also note that you can NOT patch the same file twice, you have to revert to the backup (saved as ff7.backup before patching) or another "clean" exe before you can patch again.

This patch *should* be compatible with pretty much anything you can throw at it, i know for sure it works with high-res + minigame fps patches.

That said, I can not in any way gaurantee you a safe ride, and i will not take any responsibility for anything that might happen to you, your neighbour, your neighbours dog or anything else.

(If this does not fix your ff7music problems out of the box, play the game up until the point where you get a delay, kill it with ALT-F4 and check the ff7music window, you should see a large number of the same (or similar) messages, copy&paste the lowest common denominator on a new line in lessdebug_cfg.txt, restore the backup and repatch)

Oh, and one more thing, lessdebug_cfg.txt MAY need an extra empty line after the last message, this is a yet-to-be-confirmed bug.

Download Here
« Last Edit: 2014-07-17 18:32:41 by Covarr »

Bane King

  • Fast newbie
  • *
  • Posts: 17
  • Karma: 0
    • View Profile
    • Sammie Jo Bray 1986-2006 -- You will be Missed
Sweet Thanks!
I only had the lag problem when I used the FF10 music files.

I have the +9999 and Hi-Quality Cloud so I'll try it out and edit with results :)

LAST EDIT:

(x)  This program failed to start because the application configuration was incorrect.
« Last Edit: 2006-07-23 20:50:37 by Bane King »

zero88

  • Insane poster
  • *
  • Posts: 259
  • Karma: 0
    • View Profile
Huh...

I try to play with the Direct Sound plugin and it doesn't work. It seems to play, no delays, except for only a few seconds. After a small amount of time, FF7Music returns this error that says "Could not set cooperative level".

So I try the Wave output plugin. It does not fix the delay, almost seems like it makes it worse.

Any other solutions (or plugins to try)?

dziugo

  • No life
  • *
  • Posts: 1474
  • Karma: 3
    • View Profile
    • A new copy of FF7 thanks to Salk. Pack (zip/rar/etc) your saved game before sending it to me.
It does not fix the delay, almost seems like it makes it worse.
I don't see a reason why it would increase the delay. Also, make sure the plugin you're trying to use, is actually working (use unmodded ff7.exe, so you're sure it's not because of this fix).

@Aali:
After looking at your code - pair every "malloc" with "free" and calculate the length of the strings before that big search&destroy loop. And let me confirm the "bug" you mentioned.

dziugo

Aali

  • No life
  • *
  • Posts: 1197
  • Karma: 115
    • View Profile
dziugo, i dont think free is really neccesary in this case
there's nothing in there of substantial length that doesn't need the memory, freeing it before the program terminates is just a waste of cpu

except for the config buffer, possibly, but thats not even close to 1kb (unless you are insane) and wont make any difference anyways

i'm not sure what you mean by the "calculate the length of the strings..." though
if you mean the actual ff7.exe strings, i dont see why thats really neccesary   :|
i dont have the code in front of me right now, i'm on my laptop which may be the reason why i'm not following you there

dziugo

  • No life
  • *
  • Posts: 1474
  • Karma: 3
    • View Profile
    • A new copy of FF7 thanks to Salk. Pack (zip/rar/etc) your saved game before sending it to me.
(...)freeing it before the program terminates is just a waste of cpu
True. It's also a good habit.

i'm not sure what you mean by the "calculate the length of the strings..." though
Hmm... Can't post your code obviously, but you're using something like:
Code: [Select]
strncmp(searching_for, another_possible_string_from_ff7, strlen(searching_for));or
Code: [Select]
i=-1;
while(searching_for[++i]);
strncmp(searching_for, another_possible_string_from_ff7, i);
The length of the searching_for string (the one from the config file), doesn't change. You don't have to calculate it... 1980928(?) times :P

dziugo

Aali

  • No life
  • *
  • Posts: 1197
  • Karma: 115
    • View Profile
yeah, its a good habit, but since this app will be running in a known environment, who cares? not me, quite obviously  :-P

about the strlen calls, thats very true
i didn't want to do that originally, it just happened to be the easiest way (code-wise)

either way, its a one-time thing, its not like you need to patch your ff7.exe's in realtime  :-P

good point though, i might just update it once i get back on my main pc

dziugo

  • No life
  • *
  • Posts: 1474
  • Karma: 3
    • View Profile
    • A new copy of FF7 thanks to Salk. Pack (zip/rar/etc) your saved game before sending it to me.
either way, its a one-time thing, its not like you need to patch your ff7.exe's in realtime  :-P
True :P

Anyway, I tried it... Run FF7, and there were no delays. I reverted to unpatched ff7.exe, and... Still no delays. Any specific point at which the delay is noticable? I tried field -> battle, worldmap -> battle and field -> worldmap, "no luck".

I can also wrap up a YAMP patch if you still don't want to make (heh, you've just made) another patching environment (although I still don't have any idea how this could be coded nicely).

dziugo

Aali

  • No life
  • *
  • Posts: 1197
  • Karma: 115
    • View Profile
the two locations i used to test it was a save in wall market, dressed up as a girl, where i would get enough of the "video memory" messages to induce a 2-3 second delay
the other is the boss after the highway chase where i got loads of "set volume" for 10-15 seconds

i'm sure there are a lot of other places like that though, thats just the two i knew i could reproduce easily

if you can (and want to) make a YAMP patch out of it, that would be nice
there's definatly way too many patching environments out there, i had a hard time to come up with a (semi-)unique name for the backup file  :-P

zero88

  • Insane poster
  • *
  • Posts: 259
  • Karma: 0
    • View Profile
I don't see a reason why it would increase the delay. Also, make sure the plugin you're trying to use, is actually working (use unmodded ff7.exe, so you're sure it's not because of this fix).

Well, I don't know why it would, either. But it still runs delayed and choppy. I started over with a brand-new ff7.exe and it's still the same. The fix, I guess, doesn't do anything.

But that was just for wave output. Direct sound output still won't work, and maybe that's because of FF7Music...? I could try direct sound output without this fix and see what happens...

EDIT: ARGH. FF7Music, flat out, refuses to work with me on my computer with direct sound output. It gives me an error, stating that it "Could not set cooperative level". What does that mean?

I've tried nearly every other output plugin and they don't seem to cooperate well with FF7Music. It could be that I am using miniPSFs, though, and the output plugins may not support those very much.
« Last Edit: 2006-07-24 02:47:52 by zero88 »

Aali

  • No life
  • *
  • Posts: 1197
  • Karma: 115
    • View Profile
Re: FF7 lessdebug - preliminary fix for ff7music delay problems
« Reply #10 on: 2006-07-24 11:25:13 »
dont expect out_ds to work at all
and there's really no reason not to use out_wave

also, you said you experience choppiness? that indicates a more serious (hardware?) problem, this patch will only fix delays before the music kicks in, it will not help the overall performance of ff7music

i use mp3's and minipsf's with the out_wave plugin, haven't had any issues except for these delays

zero88

  • Insane poster
  • *
  • Posts: 259
  • Karma: 0
    • View Profile
Re: FF7 lessdebug - preliminary fix for ff7music delay problems
« Reply #11 on: 2006-07-24 14:41:35 »
Oh well. I might be able to try and figure something else out.

Moonfall

  • Guest
Re: FF7 lessdebug - preliminary fix for ff7music delay problems
« Reply #12 on: 2006-07-29 18:25:57 »
LAST EDIT:

(x)  This program failed to start because the application configuration was incorrect.

I am suffering from the same error message at the moment. I installed FF7 at my friend a few days ago and noticed music delays almost everytime when entering the world map. I found this topic, downloaded the file, installed it, and all was well again. Now I'm trying to do the same thing back at home. Same version of Windows, same FF7, same patches/mods placed on it (FF7Music & High Res patch), but here the file won't work. It gives me the error message quoted above.

Does anyone have an idea how to make it work? :?

Aali

  • No life
  • *
  • Posts: 1197
  • Karma: 115
    • View Profile
Re: FF7 lessdebug - preliminary fix for ff7music delay problems
« Reply #13 on: 2006-07-29 19:25:17 »
sounds like you need msvcr80.dll and/or the .manifest file for it
let me just add those to the .zip file and reupload.. (this issue seems to be quite common with VC++ apps)

dziugo

  • No life
  • *
  • Posts: 1474
  • Karma: 3
    • View Profile
    • A new copy of FF7 thanks to Salk. Pack (zip/rar/etc) your saved game before sending it to me.
Re: FF7 lessdebug - preliminary fix for ff7music delay problems
« Reply #14 on: 2006-07-29 19:36:18 »
Or just install them.

dziugo

Aali

  • No life
  • *
  • Posts: 1197
  • Karma: 115
    • View Profile
Re: FF7 lessdebug - preliminary fix for ff7music delay problems
« Reply #15 on: 2006-07-29 19:40:38 »
oh, wow, i would never have expected microsoft to be sane like that
too bad you dont get any pointers to that if you dont have it installed

Moonfall

  • Guest
Re: FF7 lessdebug - preliminary fix for ff7music delay problems
« Reply #16 on: 2006-07-30 11:01:14 »
It worked wonders, thanks a lot! :-)