Qhimm.com Forums
		Miscellaneous Forums => Scripting and Reverse Engineering => Topic started by: Kudistos Megistos on 2008-10-31 16:49:43
		
			
			- 
				I was wondering how to change the music played in the field and battle scenes using meteor, and came across this (http://wiki.qhimm.com/FF7/Field/Script/Opcodes/F0_MUSIC) and this (http://wiki.qhimm.com/FF7/Field/Script/Opcodes/F6_BMUSC) after searching for information this and about the music opcodes.
They say that music is "defined" or "set" for a field file: I'd like to know how to set extra tracks for field files to change the music played in battle; for example, how to set the normal boss music for the fight with the Turks in the Winding Tunnel without changing the music in other battles (which would happen if one changed it with ff7music). Meteor doesn't seem to have an option for this; either that, or I am missing something that is right in front of my face.
EDIT: I think I've found where this data is stored. Now, if I can just figure out how to repack flevel.lgp I'll be able to do some tests.
EDIT2: Managed to change the music in the Wall Market to "Cosmo Canyon" without anything crashing...
			 
			
			- 
				This topic grabbed my attention immediately!
So is it possible to change the Turk battle music based on this info? (There are other things I would change, just using your example for now.)
Sorry.  I know I'm something of a n00b.  I've no hex-editing experience, but I've still got a hex-editor.  Experimenting with it based on information I vaguely understand could be fun :P
			 
			
			- 
				I'm sure it is, but I can't do it. As I've said, I've found (with the help of the wiki) where in the field file the bytes that call the music are1 and which bytes call which songs2. But I'm not sure about adding new songs to files and am having problems with scripting different battle music into that scene with meteor (no doubt because I am n00bishly sticking opcodes in like a drunk playing "Pin the Tail on the Donkey" and hoping they work).
But if you want to have a go, please do! And if you have any success, please share! That also goes for any pros out there who are reading this with horror and disgust ;-)
1 Do a text-string search for AKAO. I've found that the bytes after the last AKAO are the ones for music, but don't take this as read; I've only looked at a few files.
2 They are based on the order of the songs in ff7.exe starting from 0x567054 in my patched .exe file.
			 
			
			- 
				All lo and behold my n00biness!!
Which bytes call which songs?  My natural assumption is that they are in an alphabetical order somewhat like this:
Hurry = aseri = 00
Hurry Faster = aseri2 = 01
Lurking in the Darkness = ayasi = 02
etc.  By any fortunate twist of fate, would I happen to be right about this?
I haven't managed to do anything successfully yet.  Also, about "AKAO"... are you saying that the bytes that call the songs are immediately after the "O" of the very last "AKAO" in the file?  What exactly did you do to change Wall Market's music to "Cosmo Canyon"?
Any news on changing battle music?
I don't want to ask to be spoon-fed, but I'm having some trouble grasping the concept (first time playing around with a hex editor).
			 
			
			- 
				They are in this order in ff7.exe:
NONE
OA
OB
DUN2
GUITAR2
FANFARE
MAKORO
BAT
FIDDLE
KURAI
CHU
KETC
EARIS
TA
TB
SATO
PARADE
COMICAL
YUME
MATI
SIDO
SIERA
WALZ
CORNEO
HORROR
CANYON
RED
SETO
AYASI
SINRA
SINRASLO
DOKUBO
BOKUJO
TM
TIFA
COSTA
ROCKET
EARISLO
CHASE
RUKEI
CEPHIROS
BARRET
COREL
BOO
ELEC
RHYTHM
FAN2
HIKU
CANNON
DATE
CINTRO
CINCO
CHU2
YUFI
ASERI
GOLD1
MURA1
YADO
OVER2
CRWIN
CRLOST
ODDS
GEKI
JUNON
TENDER
WIND
VINCENT
BEE
JUKAI
SADBAR
ASERI2
KITA
SID2
SADSID
ISEKI
HEN
UTAI
SNOW
YUFI2
MEKYU
CONDOR
LB2
GUN
WEAPON
PJ
SEA
LD
LB1
SENSUI
RO
JYRO
NOINTRO
RIKU
SI
MOGU
PRE
FIN
HEART
ROLL
(a few of those might be wrong)
I changed the music in the part of Wall Market where the save point is by changing the "25" at 0xEBE (right after the O) to "1a" in the flevel.lgp file "mrkt2" with a hex editor. 25 is the 37th song on that list, "rocket" (AKA "Oppressed People), and 1a is the 26th, "canyon". If you convert the values of the bytes after AKAO to decimal and look them up on that list, you should be able to see whether they are the music files. Some of them seem to be one or two places off, however (maybe I'm doing something wrong).
Unfortunately, Real Life (i.e. university work) has prevented me from doing much real modding recently, so I don't have any news on changing battle music. I think that the basic principle should be fairly similar. Unless I'm given a lot of reading to do over the holidays I should be able to get a lot more modding work done next month.
			 
			
			- 
				I have to confess that I haven't looked into this very much since my last post, but I'm looking at the flevel.lgp file "nmkin_1" right now with Meteor.  This is the file with the background for an area of Reactor 1 in Midgar near the beginning of the game.  Barret first joins the party here.
Well, I've found a few interesting things with this file.  The background music should be MAKORO and the battle music should be BAT.  In hex, that's 06 and 07 respectively (right?).  Meteor seems to think differently, though.
I've investigated the "Entities & Script" section of this file quite carefully.  Under "dir", I've found the following:
BMUSC   (00)
I've also found this several lines later:
MUSIC   (01)
BMUSC   (02)
Now, I'm under the assumption that MUSIC = the music that is played in the area while BMUSC = the music played during a battle (if I'm wrong about this, I'll be surprised!).
Based on the information I have and what I understand, the only thing that adds up correctly here is the second BMUSC, since the battle music for when you're trying to escape from the reactor is indeed "OB", which should be 02.  Apart from that, it seems to make little sense.
So far, I can only assume that either I've missed something here or Meteor isn't very reliable for music and that I'll have to go back to blind hex-editing.
EDIT: I've looked at the file with a hex-editor and there is a 08 after the final AKAO (there are three of them).  Since 08 is FIDDLE, I don't think this has to do with the background music.  I have found a 07 after the second AKAO, but that's BAT, the battle music, not the field music.
I haven't done any testing yet, but so far, not much makes sense.  I'm sure you can edit the music with Meteor somehow, but I don't know how.  There has got to be a hex-editing omniscient out there who has the answers...
I'm not in a huge hurry to do any music editing for now, though.  I have a lot of other stuff on my mind at the moment.  I will probably be preoccupied with other things until February :(
			 
			
			- 
				I'm going to check this in a few days, but as far as I know, the bytes after MUSIC and BMUSIC point to the bytes after AKAO, so whatever music is played, the byte after MUSIC will nearly always be a low number. 00 After MUSIC or BMUSIC calls the first byte specified after AKAO, 01 the second byte and so on.
As for why *those* bytes are after AKAO, the ony explanation I can give at the moment is that the music starts with 01 rather than 00, so the 03 at 0x1fac would be the music "OB", the 07 at 0x3394 would be "MAKORO" and the 08 at 0x3eb0 would be "BAT".
			 
			
			- 
				
00 After MUSIC or BMUSIC calls the first byte specified after AKAO, 01 the second byte and so on... the music starts with 01 rather than 00, so the 03 at 0x1fac would be the music "OB", the 07 at 0x3394 would be "MAKORO" and the 08 at 0x3eb0 would be "BAT".
Oh. :|  Well, that makes sense.  So if 00 is the code for the music, that means that it will just use the music playing from the last field while if 01 is the code for the music, it will be silent?  That's my inference.  And if I'm wrong about this as well, then dang.  What's wrong with me? (lol!)
Thank you for all your help!  When I get enough freetime, I'm gonna make a lot of use of this!  I think that if one played around with the scripts displayed in Meteor, one might be able to include a second battle music used for boss battles, no?  It would also involve hex-editing... I understand where that gets tricky.
			 
			
			- 
				I'm not sure whether you mean an 00 after "MUSIC" or 00 after "AKAO". If you mean 00 after "AKAO", then you might be right, but that's just a hunch (I didn't think of that myself, but your inference makes sense). If you mean 00 after "MUSIC" then the music specified by the first byte after AKAO should be played. Again, I can't say this for certain, since I am just a beginner with this kind of thing myself.
			
 
			
			- 
				Sorry, I meant after AKAO.  What does "AKAO" mean, I was wondering?
By the way, looking at the list of the order of music files (can't stop wondering why the programmers put them in THAT order; it appears to be so random), I've noticed four music files I've never heard or seen before, specifically SATO, WIND, SENSUI, and HEART.  I first thought that SATO was a typo and was supposed to say SETO, but that's also there.  Are these unused files like COMICAL?
How did you know the music files were in that order?
			 
			
			- 
				
What does "AKAO" mean, I was wondering?
http://en.wikipedia.org/wiki/Minoru_Akao
			 
			
			- 
				
By the way, looking at the list of the order of music files (can't stop wondering why the programmers put them in THAT order; it appears to be so random), I've noticed four music files I've never heard or seen before, specifically SATO, WIND, SENSUI, and HEART.  I first thought that SATO was a typo and was supposed to say SETO, but that's also there.  Are these unused files like COMICAL?
I've just listened to these and the only way I can describe them is "strange sound effects that I don't recognise from the game". They are in xg.lgp and ygm.lgp (in the "midi" folder) but not in awe.lgp and midi.lgp. You can hear them if you use lgp tools.
How did you know the music files were in that order?
There is a post somewhere on these boards that has all of the files in order, and they are in this order in ff7.exe.
			 
			
			- 
				Thx for teaching me!
As soon as my academic life becomes less fierce and demanding, I'll make it my goal to figure out a solution to making additional musics in the field file.  Maybe I'm over confident, but it shouldn't be too difficult.  I need some time to experiment.
			 
			
			- 
				Necromancy!
Since no one took the next step and mapped each of the values mentioned by Kudistos Megistos to decimal and hexadecimal equivalents, I've done so:
[code]
NONE		1                   01
OA		2                   02
OB		3                   03
DUN2		4                   04
GUITAR2		5                   05
FANFARE		6                   06
MAKORO		7                   07
BAT		8                   08
FIDDLE		9                   09
KURAI		10                  0A
CHU		11                  0B
KETC		12                  0C
EARIS		13                  0D
TA		14                  0E
TB		15                  0F
SATO		16                  10
PARADE		17                  11
COMICAL		18                  12
YUME		19                  13
MATI		20                  14
SIDO		21                  15
SIERA		22                  16
WALZ		23                  17
CORNEO		24                  18
HORROR		25                  19
CANYON		26                  1A
RED		27                  1B
SETO		28                  1C
AYASI		29                  1D
SINRA		30                  1E
SINRASLO   	31                  1F
DOKUBO		32                  20
BOKUJO		33                  21
TM		34                  22
TIFA		35                  23
COSTA		36                  24
ROCKET		37                  25
EARISLO		38                  26
CHASE		39                  27
RUKEI		40                  28
CEPHIROS	41                  29
BARRET		42                  2A
COREL		43                  2B
BOO		44                  2C
ELEC		45                  2D
RHYTHM		46                  2E
FAN2		47                  2F
HIKU		48                  30
CANNON		49                  31
DATE		50                  32
CINTRO		51                  33
CINCO		52                  34
CHU2		53                  35
YUFI		54                  36
ASERI		55                  37
GOLD1		56                  38
MURA1		57                  39
YADO		58                  40
OVER2		59                  41
CRWIN		60                  42
CRLOST		61                  43
ODDS		62                  44
GEKI		63                  45
JUNON		64                  46
TENDER		65                  47
WIND		66                  48
VINCENT		67                  49
BEE		68                  4A
JUKAI		69                  4B
SADBAR		70                  4C
ASERI2		71                  4D
KITA		72                  4E
SID2		73                  4F
SADSID		74                  50
ISEKI		75                  51
HEN		76                  52
UTAI		77                  53
SNOW		78                  54
YUFI2		79                  55
MEKYU		80                  56
CONDOR		81                  57
LB2		82                  58
GUN		83                  59
WEAPON		84                  5A
PJ		85                  5B
SEA		86                  5C
LD		87                  5D
LB1		88                  5E
SENSUI		89                  5F
RO		90                  60
JYRO		91                  61
NOINTRO		92                  62
RIKU		93                  63
SI		94                  64
MOGU		95                  65
PRE		96                  66
FIN		97                  67
HEART		98                  68
ROLL		99                  69