Author Topic: Raw hex questions for FF7 PSX  (Read 4519 times)

Jeet

  • Crazy poster
  • *
  • Posts: 155
  • Karma: 20
    • View Profile
Raw hex questions for FF7 PSX
« on: 2013-07-18 12:28:08 »
Hi,

I have many questions so i listed them,Im trying to modify my field models so and i  have a problems ( to begin with, i have no basics of hex editing i just started this recently, so i have some quesitons), in another topic LazyBastard talk about his CLOUD.BCX modification with a shinra soldier, when someone ask him how he did this , Lazybastard answer :

"I did all of this in raw hex, by first reverse-engineering the formats themselves (though the town and battle formats were already mostly mapped out)."

Then he shows 5 links saying anyone could do the same if they follow the instructions, so that what i found in one of the link:

"Using Akari's notes from Q-Gears, the source from Micky's BSX/BCX viewer, information from the wiki ,I've broken down MD1STIN.BSX (BSX file from the first field encountered in the game) as an example of BSX structure."

1/So my first questions are : What is a BSX/BCX viewer and what mean " i broken down the file" ( i need it seem to be basics questions but i need to understand to continue this)


Then he say this :

"'BSX Header Section' [at offset 0x00000000]:
Code: [Select]
30 07 01 00 9C F0 00 00

Breakdown:
30 07 01 00 - size of the (decompressed) file in bytes (little-endian, so 0x00010730; 67376 bytes)
9C F0 00 00 - offset to the 'Models Section' (little-endian, so 0x0000F09C) "

2/So my questions are : what mean  "header section"?  and what mean "offset to the model section?" (once again i suppose its beginners questions but if someone could explain me i ll appreciate)

Then i have a problems i compared the same file in my computer with his file, and the values are not the same, i have 30 07 01 00 like him but its not at offset 0x00000000 , it start at offset 0x00000005 and for the second code i dont have 9C F0 00 00, i have 9C F0 E8 F3 ( i wont list them all but all the others values he talk about are not the same).

3/ Why my values are not the same? he says " decompressed file" and i never decompressed any file so maybe its the problem? if im right, how can i uncompress a BSX file? if not i Wonder why my values are differents, i tryed with another ff7 version and its still different


Finally,Since i started this without having using an hexeditor before , i m not sure about what i must do to change a field model into another one, example : i changed cloud's field (BCX)model into vincent field model(BCX too), it worked, i didnt used hexediting i just swaped them with CDmage, but my really goal was to swap cloud's field model BCX with sephiroth's one, and sephiroth dont have a BCX, he is stored in a BSX, thats why i ask you all these questions i want to take the sephiroth data from the BSX of a nibheilheim area (NVDUN2.BSX) and write it into CLOUD.BCX.

4/My two last questions: What exactly i must take in sephiroth data for having a correct field model? the model data only? or i must remplace everything? animation , skeleton etc? i was thinking that if i remplace only the model i will have a sephiroth with cloud stance in town? (same way of walking, runing etc) or its not so simple? (even since sephiroth animation are cool, i dont really care about this ,if it can avoid me many hours on this, its the model texture that i want).

5/How can i  know where start the model of sephiroth in the BSX since  Lazybastard  BSX example dont have the same values as mine, i cant referr to his work to know what i must modify .


If someone have the patience to read all this and give me some answers, i  ll really appreciate,  im try Harding for nothing since many days , i need someone to explain me this, since LazyBastard was too lazy to explain how he realize such a nice mod for PSX (in fact he did it but a beginner cant understand everything)

Template

  • Freak
  • *
  • Posts: 861
  • Karma: 17
  • Life is a series of cats.
    • View Profile
Re: Raw hex questions for FF7 PSX
« Reply #1 on: 2013-07-18 12:44:50 »
I had patience to read what you wrote, makes perfect sense, I just can't offer much of any help,
the only reason I bother to reply, other than to offer some consolation for your frustrations, is about question #3 (and possibly totally wrong):

Perhaps this is what the converter that Akari was talking about is for. I looked for the Qgears svn but only for a minute and I was called away, now I have not the patience for that search. I would contact Akari about it directly via PM.

Jeet

  • Crazy poster
  • *
  • Posts: 155
  • Karma: 20
    • View Profile
Re: Raw hex questions for FF7 PSX
« Reply #2 on: 2013-07-18 13:05:08 »
I looked for this svn converter too, but never find,  i didnt think akari was still active since the topic im talking about is one year old, im sending a PM to him, thks.
« Last Edit: 2013-07-18 13:12:25 by Jeet »

xLostWingx

  • Freak
  • *
  • Posts: 800
  • Karma: 8
  • No Comment
    • View Profile
    • FFVII Lost Wing Mod/Hacks
Re: Raw hex questions for FF7 PSX
« Reply #3 on: 2013-07-18 21:56:17 »
...since LazyBastard was too lazy to explain how he realize such a nice mod for PSX (in fact he did it but a beginner cant understand everything)

Hey!  LB may be lazy, but he can...zzzZZZzzzZZZzzz... haha

The majority of forum members really don't work with PSX version too much.  There are a few that are really quite exceptional when it comes to working with the PSX version, but I haven't seen a lot of them around lately.  I'd send out a few PMs, and continue to search around the forums a bit more - though it looks like you've already done a good bit of research.  What you're attempting to do does not sound like it is very difficult - that is if you know the proper procedure.  I think that in the amount of time it will take for one of the PSX experts to find your post or your PM, you could just experiment with the things you do know and gain more experience with that Hex editor and likely figure out how to accomplish your goal, as well as learn a few cool tricks in the process.  Good Luck.

Tirlititi

  • Freak
  • *
  • Posts: 537
  • Karma: 68
    • View Profile
Re: Raw hex questions for FF7 PSX
« Reply #4 on: 2013-07-18 22:05:09 »
I can reply to the 2/ :

A file header is a part of the file (generally at its beginning, thus its name) that contains the "meta-datas" of the file, that is to say datas about how the content is encoded, in opposite to the "datas" which is the content itself. Inside, you can have the file size, the image's height/width if the file is an image, the music's length if the file is a music, etc...
More specifically, a section header, in your case, I think it is a header for several sub-files (grouped in a "section", in your case it must be that .BSX file) : the field's models may be in the same section as the field's images, for instance. So the header is here to say "what is stored where".

That brings to the models sections : models are stored somewhere in the .BSX file. Where they are stored is told by the "models section offset". "9C F0 00 00" means you have to jump 0xF09C bytes (=61596 bytes) and you fall on this "models section" that contains the models.
Once you're in this section, there is a high probability the first bytes are themselves the header of the models sections : they will tell how many models there is and the offsets to each single model.
I don't know how the offset must be interpreted in your case. That may be either :
- Go to the 0xF09C offset of the file (= absolute offset),
- Jump 0xF09C bytes from a certain position, most likely the position of the offset, TITS the position where there is "9C F0 00 00" or the position right after it (= relative offset).
Since the offset there seems to be really soon in your file (at the position 0x00000009 if I got it right), the position 0x0000F09C is near the models section anyway...

Hope it helped. I tried to be the most complete possible and understanding that is quiet a big step in the binary files comprehension.

Jeet

  • Crazy poster
  • *
  • Posts: 155
  • Karma: 20
    • View Profile
Re: Raw hex questions for FF7 PSX
« Reply #5 on: 2013-07-18 22:46:12 »
@Tirlititi:
Thks a lot you really helped me here, i didnt solved the problem yet but i really understand better what he meant, like you said, its write that the offset 0x0000F09C is the model section , and its start with the values of the number of models in the file ( in little endian) and there is  a "pointer to texture data"(i dont understand this) just before the individual model section (and thats what i was looking for).

I dont think i understood everything you said but that make more sence to me now when i look at the values, thx again, but there is still the big problem about my incorrect values ( and im pretty sure now its because i didnt uncompressed the BSX, i saw a message in a old post where someone said " you cant extract file directly from a BSX but you can  uncompressed and decompressed BSX file" so there is a reason to uncompress it and this is probably my solution, then he say he have a BSX model viewer and model extractor, i go see it but i see nothing, only codes, its q gear, i dont understand how this work , i dont even know if its a faq or a program, i download a " q gear " some times ago, once i installed it it launched ff7 game but without  battles or music, i dont know what does it mean.

Aniway thx again for the help.


@Lost Wings :
 yes i understand that most of players are using the pc version, it make sence, i even have the re release with the sephiroth patch working, but i never finished it, i really dont know how people can play ff7 on a pc, i dont like the graphics , the musics are bad quality, and i hate playing on a computer anyway i played this game on psx when i was kids and i feel the same pleasure when playing again on the same version.Like u said im waiting specially for Lazy Bastard he is the first person that i see moding the characters graphics on the psx and i really appreciate his work, until this i ll try to understand more about hex edit.





**EDIT**After hours of searching i finally find the lzs uncompressor/compressor, thx to the man with he poney avatar, so now, with tirliti advices and self deduct i have answer to all my questions and i understand how the data works, so no need to answer the 5 questions anymore , but i have one new question now:


I found sephiroth datas in the BSX ( the model number 5), to obtain sephiroth instead of clad texture i have to way: change everything, ( animation, skelet, parts and bones) or just change the texture, ( which one is the texture? bones or part?i dont think its skelet or animation) and i Wonder if i change only the texture the game wont crash? maybe i need the exact skelet and animation for the changes to work?

Another last question : lets say the sephiroth model will be bigger than cloud's, i couldnt remplace it  in that case, so here is a way to change this? for exemple allow cloud BCX size to be bigger? ( i know for the battle model i tryed to swap cloud's model with Hi-res cloud model but the file was twice bigger so they refused, if there is a way to have a hi res cloud inbattle or a hi res sephiroth it will be awsome but need to extand the size allowed in the FILE) If i use CDmage they say the files of hi res cloud is too big and they will truncated, and the game crash, if i use CDprog they dont even let me truncate it they refuse it ( im talking about battles model not field model for this)
« Last Edit: 2013-07-19 12:21:55 by Jeet »

Jeet

  • Crazy poster
  • *
  • Posts: 155
  • Karma: 20
    • View Profile
Re: Raw hex questions for FF7 PSX
« Reply #6 on: 2013-07-20 21:50:26 »
Finally !!!!!!! i sucess to have sephiroth model in field !! without bug, it wasnt so easy because all the model other than sephiroth worked when i modify them , but sephiroth never working i was wondering where i failed? but i didnt, in fact the SAMPLE BREAKDOWN of lazy bastard is missing one line :

---------------------------------
'Models Section', Header

01 FF 16 0F 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 58 00 38 02 64 2B 00 80 00 00 00 00

Breakdown:

01 FF - Unknown

16 - Number of bones

0F - Number of parts

03 - Number of animations

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 58 00 38 02 - Unknown   <<<<<<<<<<<<<<< this " unknow" 58 and 38 , i was wondering why barret and character with same bones and parts than cloud have this same number, and why vincent tifa and aerith ( with higher  bones and parts ) have higher number, ex: aerith have 60 and 60 , so i just set 60 60 to this, and sephiroth appear , ( since he have the same part and bones than aerith) i dont know the exact propotional values but at least i know their uses, if these two numbers dont correspond to the number of bones and parts, the game will crash, so i think finally its possible to play all character with many bones like rufus , diamond weapon (in there is a way to resize it )

---------------------


So finally after one week of full work i sucess my " Sephiroth patch " for psx !!

There is two  minor bugs , the first  is the animation in scene ( like clad climbing or moving is head or arm in dialogue) wont work well, but no crash, only the animation will be strange at this moment, but the normal animations, walk , stand and runing, work perfectly. To correct that i have to modify all BSX in the game so they fit with sephiroth but i wont do such a work.

Second bug is sephiroth have only one foot(i think its a low price compared to playing with him all the game on a psp instead of pc) , because  the model is too big i suppose, since when i put sephiroth on a high size model like tifa he have all his member and his scene animation work, so i ll find a way to make the "autorized size" of clad field model to be bigger.




« Last Edit: 2013-07-20 21:52:32 by Jeet »

myst6re

  • Freak
  • *
  • Posts: 515
  • Karma: 57
  • Light King of the Savegame - Field Master
    • View Profile
    • WikiSquare
Re: Raw hex questions for FF7 PSX
« Reply #7 on: 2013-07-21 12:12:18 »
Congratulations :)

Jeet

  • Crazy poster
  • *
  • Posts: 155
  • Karma: 20
    • View Profile
Re: Raw hex questions for FF7 PSX
« Reply #8 on: 2013-07-21 13:03:33 »
Ty and thanks for your advices too :)

vayneruel

  • Crazy poster
  • *
  • Posts: 139
  • Karma: 17
    • View Profile
Re: Raw hex questions for FF7 PSX
« Reply #9 on: 2013-07-21 16:47:45 »
Congratulations Jeet, you say have problems with the size of model, you talk about BCX file?

Jeet

  • Crazy poster
  • *
  • Posts: 155
  • Karma: 20
    • View Profile
Re: Raw hex questions for FF7 PSX
« Reply #10 on: 2013-07-21 22:14:49 »
Yes , sephiroth model is bigger than cloud's so there is two bugs because of this, first one is sephiroth will have one missing bone in the screen, second is his  dialog animations in BSX files will be buggy, to resolve this, i need to modify  maximum size value in every BSX files and set cloud's bone and parts in every DAT files, its a long work but really easy to do so finnally i ll do it  :) , to have a perfect game without bugs.

But im working on battles models before this and i have a question, its possible to add news bones for a characters? like take chaos wing's and put them on cloud at the same emplacement? I dont know if its possible since cloud is not supposed to have any bones in his back , if even if i can do it,i know the size model wont  be accepted since it will be bigger with news bones inserted, but there is an  easy way to avoid this, if i put a too high model on cloud's , i ll just put it in tifa or anyone who have a bigger size, then with a simple gamesave editor i swap cloud's and tifa's battle model , well, it will be really cool if we can add news bones (with their own animations) to a playable character
« Last Edit: 2013-07-21 22:17:00 by Jeet »

vayneruel

  • Crazy poster
  • *
  • Posts: 139
  • Karma: 17
    • View Profile
Re: Raw hex questions for FF7 PSX
« Reply #11 on: 2013-07-22 20:34:40 »
For write the new size of the BSX files you must update the FIELD.BIN,  contains size and LBA of .DAT,.MIM and .BSX files.
I think its possible add a new bone of battle model but its very hard, and the new problem is the bigger size of modified model than original, i dont know what file contains the LBA and size of character battle models, the enemy models LBA has in the BATTLE.X file.

Jeet

  • Crazy poster
  • *
  • Posts: 155
  • Karma: 20
    • View Profile
Re: Raw hex questions for FF7 PSX
« Reply #12 on: 2013-07-22 21:41:09 »
Well  finally i dont need to add new parts because the character i wanted ( diamond weapon) have the same part than cloud , so it fill well, but the problem is the size of the character is huge, i dont know how to make diamond weapon smaller like a normal character. I thinked about using mini on him, it work but i dont deal damage so it suck, im sure there is a way to reduce size since MINI do this ( i dont talk about the size file but about the tall  of the model in game).


Another things funny : in lazy bastard breakdown he  say you can swap every playable character with another, even vincent's limit like chaos, but its not working with enemy characters, finally i find the way to control any boss of the games ( not his model but the real enemy with his own bones and animations)  >>> iv tryed to put diamond weapon model data into cloud's, game crashed, so i knew the problem come from the model data, i put cloud"s model data into diamond weapon, game still crashed, then i put chaos model data on diamond weapon> its work  , he have his own fight animation and is fully controllable  , it  think its due to the fact that chaos  dont use the weapon of vincent in fight i dont think his damage are based on it and we dont even see the weapon once he transform so every monster could be controlled with this method.

There is still two problems,  i think know wich animations is supposed to do attack or magic , so when i do magic and attack it work but he have no animation so its suck,  there is probably a way to switch his animation so they fit to " attack" and " magic" .


Second problem> i supposed its because the diamond weapon is bigg so i can only fight alone, i cant have allies in the battle or game crash, but its not really a problem  i remember a gameshark code to fight alone always, and still have allies i n the party, so game wont crash when allies are supposed to talk in field, and wont crash in battle because they will not be here, actually the biggest problem is to know how to  put attack and magic animations into the diamond weapon 's moves, if there is a way to do this then everyone could play enemy characters with their own bones and animations



EDIT: i didnt finished to put the new offset for animation data thats  maybe the problem, i ll edit all of them and see if the result work .
« Last Edit: 2013-07-22 21:53:29 by Jeet »

Jeet

  • Crazy poster
  • *
  • Posts: 155
  • Karma: 20
    • View Profile
Re: Raw hex questions for FF7 PSX
« Reply #13 on: 2013-07-25 05:28:59 »
Ok so i sucess everything about controlling all bosses of the games, its not like the code for manip all enemy or a remodelling skin , its the real bosses, in the party, i found  the way to change bosses animations  avaiable in attack, magic, deadblow etc,so to summarize i can control ultima weapon will all his moves , bones and animation in battle ( some characters like the 4 weapons are too big sized to fit in a character model file, so i deleted their unused animation , it work, same way for hi-res cloud i deleted some of his weapon data and he can be used in PSX now, i didnt tryed safer sephiroth yet his file is really big but i think i can have him in the team if i delete some animations ( like his death animation and supernova casting animation)

I 'll post screen shot later when i'll finalize this, for now i have finished dayne, rufus, and reno ( once again its not a re skin like the shinra mod for pc ,its the real ones) , im actually on ultima weapon in the party , since he is the smaller of the 4 weapons he 'll fit well in the game.  Its on PSX/PSP btw.
« Last Edit: 2013-07-25 05:31:21 by Jeet »

xLostWingx

  • Freak
  • *
  • Posts: 800
  • Karma: 8
  • No Comment
    • View Profile
    • FFVII Lost Wing Mod/Hacks
Re: Raw hex questions for FF7 PSX
« Reply #14 on: 2013-07-25 22:44:20 »
This is super cool man.  Nice job sticking to it and producing results like that.  Also, if you are making these changes work on psp, you've managed to do something that, as far as i know, nobody else has managed to do before.

Cyberman

  • No life
  • *
  • Posts: 1575
  • Karma: 8
    • View Profile
Re: Raw hex questions for FF7 PSX
« Reply #15 on: 2013-07-25 23:45:44 »
Ok so i sucess everything about controlling all bosses of the games, its not like the code for manip all enemy or a remodelling skin , its the real bosses, in the party, i found  the way to change bosses animations  avaiable in attack, magic, deadblow etc,so to summarize i can control ultima weapon will all his moves , bones and animation in battle ( some characters like the 4 weapons are too big sized to fit in a character model file, so i deleted their unused animation , it work, same way for hi-res cloud i deleted some of his weapon data and he can be used in PSX now, i didnt tryed safer sephiroth yet his file is really big but i think i can have him in the team if i delete some animations ( like his death animation and supernova casting animation)

I 'll post screen shot later when i'll finalize this, for now i have finished dayne, rufus, and reno ( once again its not a re skin like the shinra mod for pc ,its the real ones) , im actually on ultima weapon in the party , since he is the smaller of the 4 weapons he 'll fit well in the game.  Its on PSX/PSP btw.
Let me know when you are having fun ...
LOL

Anyhow sounds like you have been busy.

Suggestions (thoughts) you should be able to shift reduce the vertices or you could just divide them.
That is the only thing you need to do is scale the list of points that the models are made of.
These are int16 values if I remember correctly. To scale these you will need to iterate through just these points and multiply by the scale factor.
AGAIN these are integers (not floating point) so if you know any C you would need to do this
Code: [Select]
//(example 1/10th scale)
float scale = 0.1;
for(index = 0; index < vertex_count; index++)
{
 // cast scaled vertex back to integer after converting it to a floating point and
 // multiplying it by 1/10th to scale it
 vertex_pool[index].x = (int)(scale * (float)vertex_pool[index].x);
 vertex_pool[index].y = (int)(scale * (float)vertex_pool[index].y);
 vertex_pool[index].z = (int)(scale * (float)vertex_pool[index].z);
}
This will reduce the scale (size) but not the actual amount of data it uses.
Animations are at fixed locations (from what I remember)
Obviously you can't increase or decrease clouds sector count sizes (for example) regarding the model. This would require messing with the field.bin table which conintains the absolute sector locations in it. (LBA)

As for scale pick what makes sense I can't remember the scale of the data in the models. I believe it's something like each count is a mm or something odd like that.

So 32767 would be 32.767m and -32768 would be -32.768m. That gives a maximum span of 65m cubed for all models (big enough I would say).
I don't remember a scale factor being applied to models either (wiki is your friend I guess).

Cyb

Jeet

  • Crazy poster
  • *
  • Posts: 155
  • Karma: 20
    • View Profile
Re: Raw hex questions for FF7 PSX
« Reply #16 on: 2013-07-26 15:54:41 »
Thx for the infos, i ' ll try this when i ll finish my models (take a lot of time.... ), if it works its great thats what i was looking for.