Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - dangarfield

Pages: [1] 2
1
All done, all changes sync'd:
eg: https://ff7-mods.github.io/ff7-flat-wiki/FF7/WorldMap_Module/Script/Opcodes/348.html

There are some changes made directly to this 'flat wiki' (as I called it) that will be not be sync (eg, HobbitDur's FF8 changes) - In time we'll add these in properly

Thanks,
Dan

2
Hi, I created the mirror just in case anything went crazy and we lost the wiki.ffrtt.ru, which would've been a catastrophe!

There are two tools:
- https://github.com/ff7-mods/ff7-flat-wiki-migration-tool - A tool that reads the main wiki.ffrtt.ru site and converts it into a markdown format
- https://github.com/ff7-mods/ff7-flat-wiki - A publicly hosted version of the above converted wiki in said Markdown format

In order to update, simply install the migration tool, run it locally (which scrapes the content from the main site and converts it into the markdown format, and create a merge request for the ff7-flat-wiki site.

I haven't pulled it for a long while because I was pretty much the only contributor, but I'll have a look ago and pull it over the next few weeks.

I 'had' accepted a few changes directly into the flat-wiki, I'll have to have a look at a merging mechanism to deal with these (but it was ff8 content anyway at this point.

Hopefully that makes sense and thanks for contributing!

3
Hi, yes, it's possible, but I haven't coded it to do so. There are subtle differences between the battle.lgp and char.lgp contents and I don't know how the chocobo.lgp looks.
What specifically are you looking for, the chocobo minigame?

I haven't looked at this at all yet, but I do think someone made a post here recently. It'll be possible if the format is the same, but not with the existing cli

4
I'm just looking at the hit effects / attack textures, eg: https://github.com/Akari1982/q-gears_reverse/blob/master/ffvii/documents/battle/attack_textures/tex%3D00.gif



(Not the damage numbers, but the hit effect underneath)

I'm looking to build them from the offsets & timings as stored in the exe, eg combine them myself. Getting each of the 'components' from the seffect*.tex files is easy, cutting and animating is fine, but I've just noticed that there are 70+ combinations and many interesting rotations, combinations, timings and movement of these components into the larger effects.

Any ideas where abouts in the exe I can look to find this data?

5
Scripting and Reverse Engineering / Re: [FF7] camdat files
« on: 2024-10-04 09:22:19 »
I'm not really sorry! It's a shame that I'm 15 years late to the party I guess.

I've generally figured it out. It's quite interesting, simple and convoluted at the same time.

It's an Archimedean spiral where:

Code: [Select]
F8          - Op code
DE FF       - zoom - not quite fully worked this out yet but it essentially relates to how 'zoomed in' but also how many frames to step through as well as direction (+-)
FC 03       - initial radius - Distance to first 'turn'
00 0A       - rotation - where 4096 is a full rotation
F1 FF       - spiral growth rate (+-) - Where positive: spiral contracts, negative: spiral expands
00 00       - y adjust (+-) - linearly adjust y per frame
2D 00       - frames

This is then added on to the focus position so that it also moves as the focus point moves also.

I can imagine the creators adding a spiral on, resizing, rotating it etc. It's interesting as it can account for a whole plethora of curves. Simple, yet convoluted.

I'm sure there is probably no one else in the world who would ever care, but that's it from me.

6
Scripting and Reverse Engineering / Re: [FF7] camdat files
« on: 2024-10-02 19:25:11 »
Sorry for absolutely bringing this post back, but I had a question for nfitc1 regarding battle cameras:

Context: I'm building a from scratch game engine (kind of like q-gears). https://github.com/dangarfield/ff7-fenrir/ Fields are generally working, now I'm working on battles. Things are going well, but I can't figure out the F8 op position code.
 
Example (from camdat0.bin - victory cam[2]):
`F8 DE FF FC 03 00 0A F1 FF 00 00 2D 00`

The visual effect is that of an spiral.
In game, this goes from:
`START  arg3: -5881  y: 606 z:  2931`
`FINAL  arg3:  2879  y: 606 z: -1973`

I initially thought that it started from the previous operation eg, F9 (sets XYZ) in this case, but playing with camdat0.bin in game, shows me that it's not at all. The starting positions are 'calculated' from the operation arguments (eg, changing the arguments changes the starting position). I feel as though there each step creates a vector and applies it to the next position and so on, but I can't seem to work out what the first 4 parameters actually refer to and how they are used in the position update loop.

eg  `cameraSpiral({arg1: -34, arg2: 1020, arg3: 2560, arg4: -15, arg5: 0, arg6: 45, })`

Your notes above seem to say: `Store These values in six words starting at 0xBFCE0C (not in order)` (I believe you documented this as F7, but actually I think the doc mixed up F7 <-> F8)

Would it be possible to help identify the source function that performs these stepping updates?

My current process is amending the camdat0.bin file with specific F8 arguments, watching the memory for battle camera position changes when the script is triggered, analysing the result and coding a matching algorithm to emulate it, this has been fine for the vast majority of battle camera op codes so far, but this one is eluding me!


I'm confident that:
ARG 5 - Each step increment Y (eg, always linear) - doesn't affect x or z
ARG 6 - Duration in frames

It's also worth noting, that the initial camera and victory camera movements use the frame duration set in the op codes, but for the main scripts, this duration is actually halved, very strange.

7
Hi,

Just doing some things now and I was told that Proud Clod had (at least placeholder) player positions. I don't think these are in the lgps, just wanted to confirm if you've found them. There are lots of different configuration for each battle type.

Example of my findings and values: https://github.com/dangarfield/ff7-fenrir/blob/master/app/battle/battle-formation.js

Thanks,
Dan

8
FF7 Tools / Re: FFVII Field Models + Animations
« on: 2023-12-08 08:58:32 »
Hi, process:

- Generate glTF files: install kujata, configure the directories and run the methods to generate the gltf files (field and/or battle)
- Output contains *.gltf, *.a.gltf (animations), *.bin (data), /textures/*.png (texture files)
- Or just download these from (format of files names from here https://github.com/dangarfield/kujata-data/tree/master/data/field/char.lgp but with the domain: https://dangarfield.github.io/kujata-data/)
- Import .gltf into blender (which automatically imports the .bin and textures.
- If you want animations, you should combine them before you import - eg https://github.com/dangarfield/kujata-webapp/blob/master/angular/src/app/field-model-details/field-model-details.component.ts#L152. I'm sure there are tools to do it for you, but it's probably more technical that you're looking for. But it is what it is

9
FF7 Tools / Re: FFVII Field Models + Animations
« on: 2023-12-01 19:26:58 »
I built upon kujata:
https://github.com/dangarfield/kujata

It exports ff7 to common web based formats (such as gltf, which you can open in blender). Have a look.

Example usage:
https://dangarfield.github.io/kujata-webapp/battle-models

You can see the requests and all files that are hosted.

10
Team Avalanche / Re: Project Edge (Jusete's field scenes)
« on: 2023-03-04 19:17:55 »
Hi Jusete, just a quick validation.

When you're modelling and ultimately rendering, do you solely use an orthographic camera?

Yes, I understand the field camera positions, walkmesh and other entities are overlaid with a perspective camera (which I know and have implemented in https://github.com/dangarfield/ff7-fenrir), but I'm mainly interested in whether ALL of the fields are orthographically rendered or whether there are any that seem to have a distinct level of perspective to them.

Thanks

11
FF7 Tools / Re: [PC] Mark.dat Online Editor
« on: 2023-01-27 16:57:29 »
Yep, have a play with the online editor. Just set the Y values to any positive number (eg 100) and the triangle will be underneath (y is inverted). Or use 'top height' and 'bottom height' to do it quickly.

I'm sure there will be a simpler hext way to hide them, but this will work.

12
FF7 Tools / [PC] Mark.dat Online Editor
« on: 2023-01-16 12:11:35 »
Mark.dat Online Editor

For those who want to edit the selection triangle in game:
- Go to https://dangarfield.github.io/ff7-mark-dat-editor/
- Edit in the editor, download your new mark.dat
- Replace file in `data/battle` directory (don't forget to backup)
- Run game
- No installation required

Code: https://github.com/dangarfield/ff7-mark-dat-editor

Default editor view:


After editing:


In game view:

13
re: Not much you can do with it.

You can change the colour in game. I'm sure you can change the size too.

From the real FF7 - One blue corner:

14
No, that's perfect, just the answer I was after. I was looking for the vertex colours and positions (no textures). Thanks very much.

I used the data to make this in https://github.com/dangarfield/ff7-fenrir:


15
Hi, I'm trying to find the active selection triangle model (inverted tetrahedron) and potential animation data.

Eg: the yellow icon that sits above cloud here:


I've been through all 5k files in magic.lgp with no luck, I'm pretty sure it's not in the battle.lgp already.

Any ideas?

16
Thanks my friend. There are 11 enemies that use them, but that's all fine. What I have seems to work pretty well so far.

Much appreciated.

I'm sure I'll be back, specifically with some questions about the animation / effects texture mechanics and lookups, but I saw that Akari had some nice stuff worked out already - https://github.com/Akari1982/q-gears_reverse/blob/master/ffvii/documents/battle/models/data/dump_cloud.lua - But I'm nowhere near there yet.

Thanks again!

17
Thanks for this.

1. Thanks, yep, I've got all that. I'm happy.
2. Yep, agree with the notation, that's my bad, but I think you get the point with the logical ordering of args. I've also noticed since writing this that the op code actually comes last, so yes, it.

Regarding not seeing 02 data type on the stack, I 'think' I can read this from the scripts, eg, an 0x81 (RWRD - Random) pushes an 02 type onto the stack. I think I can read a lot in the Terry Ferguson docs about 02s being added, but I might just be misunderstanding, https://forums.qhimm.com/index.php?topic=3290

Either way, I think what I mean by this is that I'm not sure what to push onto my 'stack reconstructed' if I get a '00 41 60', but I'll go with the a stack value of a 10-digit binary saved as a word. We'll see, but this is really for me. I've tested a number of AI scripts so far and it seems to give me the results I'm looking for.

3. I think this is the same as above, but it's throwing me off because it's a 22 (eg, x=2 -> 2 byte return type), but if I understand what you're saying, it should always be (in the instance of 2xxx commands) a single 2byte array returned, even though the x=2 'implies' a 2byte per record. I'll have to find an example specifically look into it.

4. Will do, much appreciated.

I do, however, have another small question:

5. How does the preScriptSetup execution affect the stack?

Eg, is an actor's stack a singleton or is it a new instance between different invocations of different script types.

During the execution of a stack, there is a 0x92 command with an argument less than 0x20 that results in the triggering of all active actors' preActionSetup scripts. Is it fair to say the following:

A)
- After the enemy turnTimer indicates that a enemy has a turn, the enemy 'turn' is added to a prioritised turn queue
- When it is the enemy turn get priority it:
- Executes the 'main' script, which may or may not result in a 0x92 command (with < 0x20 arg), if it does
- All actors sequentially run their preActionSetup scripts, in their own 'new stack instance', most importantly, the current actor has two stacks in this point, or at least, there is an index maintained that allows it continue after the preActionSetup script(s) have finished
- The execution and animation of the enemy 0x92 happens
- The script picks up from where it was until it reach an 0x73 end code

OR B)
- After the enemy turnTimer indicates that a enemy has a turn, the enemy 'turn' is added to a prioritised turn queue
- When it is the enemy turn get priority it:
- Executes the 'main' script, which may or may not result in a 0x92 command (with < 0x20 arg), if it does, effectively this is the end of the enemy stack turn because:
- All actors sequentially run their preActionSetup scripts, thus destroying the one stack
- The execution and animation of the enemy 0x92 happens
 (eg, the 0x92 is effectively equal to the 0x73 end code, and nothing can happen in the stack after) - I really don't think this is the case, Diamond Weapon queues commands after the 0x92

OR C)
- After the enemy turnTimer indicates that a enemy has a turn, the enemy 'turn' is added to a prioritised turn queue
- When it is the enemy turn get priority it:
- All actors sequentially run their preActionSetup scripts
- Executes the the 'main' script, which may or may not result in a 0x92 command (with < 0x20 arg), if it does:
- The execution and animation of the enemy 0x92 happens
- The script picks up from where it was until it reach an 0x73 end code

OR Something else. I'm really looking for a logical view here.

Much appreciated!

Update: I'm pretty sure that it's the first as I get very similar results to what I see in game here.

18
I have a few questions about battle operations that would be great to get clarity with on:

Note: DWORD = 4 bytes. But I'm just using 1BYTE, 2BYTE, 3BYTE, 4BYTE notation because it's clearer for the non-windows programmer in me.

1. Does a stack only exist for each single 'turn' of an actor?
    Eg, is it correct to say:
    - A stack only exists for an actor's turn and is only processing that actor's commands
    - Before an actor's turn, the stack is cleared
    - Multiple 'attacks' etc, can be chained, the actor's turn only ends when it hits the END op code (0x73). The last position of the last action is lost, eg always go from 0x0000 of main script etc for each main turn
    - All local variables (0x0000 - 0x03FF) (and global variables) are persisted between each actor's turns. Local variables are set to 0 at beginning of battle only

2. Types and what is pushed on stack from address. 2x mainly
Is it correct to say the following when invoking some commands:

LOAD ADDRESS: 1x commands
    The following commands are effectively all the same:
Code: [Select]
    - 10 03 83
    - 11 03 83
    - 12 03 83
    - 13 03 83
  ->   push address '0x0383' to the stack ALWAYS as a 2BYTE even though the type '10' -> 1bit as 1BYTE, '11' -> 1BYTE, '12' -> 2BYTE, '13' -> 4BYTE.
  ->   stack:    12 03 83
    eg, is the x in `1x` always a 2 in what is added to the stack? is does the x remain as the same in the op code, but the engine just knows that it will always be a 2BYTE value regardless of what the 1x's x value is?

LOAD VALUES: 0x commands

    If arg is 0x0000-0x3FFF, the values are fetched and pushed as 0x variable, eg: (assume arg 0x0123 has value of 0x2345)
Code: [Select]
        Command -> 00 01 23 -> get bit value of 0x2345 store as 00 (bit) -> stack: 00 01 (0x2345 first bit = 1)
        Command -> 01 01 23 -> get byte value of 0x2345 store as 01 (byte) -> stack: 01 45 (0x2345 first byte 0x45)
        Command -> 02 01 23 -> get 2byte value of 0x2345 store as 02 (2byte) -> stack: 02 23 45
        Command -> 03 01 23 -> get 4byte value of 0x2345 store as 03 (4byte) -> stack: 03 00 00 23 45

    If arg is 0x4000-0xFFFF, the values are for ALL objects in battle eg: (assume only player 3 & enemy 1, with current HP of 0x567 and 0x789 respectively)
Code: [Select]
        Command -> 00 41 60 -> get bit value for each actor store as 20 (bit) -> stack: 20 00 00 01 00 01 00 00 00 00 00
              or is this a simple bit mask in a 2BYTE, eg 0xb0000010100 -> 0x0014 (eg, 20 00 14, up to a potential max of 20 03 FF)
        Command -> 01 41 60 -> get byte value for each actor store as 21 (byte) -> stack: 21 00 00 67 00 89 00 00 00 00 00
        Command -> 02 41 60 -> get 2byte value for each actor store as 22 (2byte) -> stack: 22 0000 0000 0567 0000 0789 0000 0000 0000 0000 0000
        Command -> 03 41 60 -> get 4byte value for each actor store as 24 (4byte) -> stack: 23 00000000 00000000 00000567 00000000 00000789 00000000 00000000 00000000 00000000 00000000

3. Global values bit masks

Take 0x20A0 - Bit mask of actors indicating actors the current actor considers as enemies
Assumed command - 02 20 A0 -> Push value to stack of 0x20A0, store value as a 2Byte value
Assumed enemies - All 3 players only
Is the result value added to stack 0b0000000111 (eg 0x0007) -> 20 00 07
 or because it's a x=2 command, each actor has a 2 byte value, eg:
 -> 22 0001 0001 0001 0000 0000 0000 0000 0000 0000 0000



4. Example reversing walkthrough

I'm sure that I will have a myriad more questions, but I would love to able to fish for myself. Would anyone be able to make a brief video / tutorial to show how I can step through this in debugger? I'm also willing to document and video the process for others once I know.

I can code and have decomposed most field and scene assets, but have very little experience with windows based reverse engineering (of running applications), but I think that a smaller tutorial would benefit a lot of people.
A good example would be: Stepping through the Grand Horn's AI in game, op by op, showing the ops and the resultant stack values (Grand Horn appears to be the simplest / shortest AI).

Thanks as always.

Note: I'm actually writing the whole of FF7 in a web based engine. All fields and menu engines are working. I've extracted and created models for all battle models etc, pretty much extracted in a readable way most field assets, now, I'm interested in making the battle engine. All is promising and it will work, just need some pointers in the battle stack.

Additonal links that I've found useful for future reference:
https://pastebin.com/raw/mjfRFNsZ
https://forums.qhimm.com/index.php?topic=3290.msg45951#msg45951
https://forums.qhimm.com/index.php?topic=18668.75
https://wiki.ffrtt.ru/index.php/FF7/Battle/Battle_Scenes/Battle_AI_Addresses
https://wiki.ffrtt.ru/index.php/FF7/Battle/Battle_Mechanics
https://wiki.ffrtt.ru/index.php/FF7/Battle/Battle_Scenes#AI_Data
https://wiki.ffrtt.ru/index.php/FF7/Battle/Battle_Scenes/Battle_Script
https://faqs.neoseeker.com/Games/PS4/final_fantasy_vii_dynamixdj.txt

19
General Discussion / Re: State of current wiki
« on: 2022-06-30 21:18:09 »
I'm a little late, but the link is not quite right:
https://wiki.ffrtt.ru/index.php/FF7/DamageFormula

Also, I've made a git friendly backup should anything go wrong with the wiki:
https://ff7-mods.github.io/ff7-flat-wiki/
https://github.com/ff7-mods/ff7-flat-wiki

20
Thanks @sithlord48, this is useful, but I'm wondering how these IDs were derived.

I can make the assumption that the enemy model hrcs are sequentially based aa,ab,ac, 1,2,3 etc, and I've found the exe offset for the playable characters (FROG -> CHAOS, ff7_en.exe, 0x004FE310), but I would be interested in if anyone could explain HOW or where they found the data linking the scene.bin enemy IDs to the battle models in battle.lgp.

I'd prefer not to hardcode it in what I'm doing but generate the information from the sources.

@halkun Any Ideas?

21
Hi,

I'm just adding battle models (battle.lgp) and scene.bin exporting to kujata (see https://dangarfield.github.io/kujata-webapp/battle-models for previews) and fenrir and I'm unsure about how to correlate the battle models to the enemy IDs.
I assume there is a table in the exe / some data file but I haven't found it yet in the battle directory.

Eg:
Elfadunk - Scene.bin ID: 76 (0x4C) - battle.lgp model: cyaa
Mandragora - Scene.bin ID: 79 (0x4F) - battle.lgp model: dbaa
Levrikon - Scene.bin ID: 80 (0x50) - battle.lgp model: dcaa

I can approximate this roughly (aa = 0, ab = 1, ac = 2... cy = 25 + 25 + 24 + 3 = 76, but I just wanted to check that there isn't a better way of looking this up.
Also the same for the playable character files. Any locations in exe memory or data files I should be looking?

22
FF7 Tools / Re: [PC] Text editor - touphScript (v1.4.0)
« on: 2021-01-15 13:27:15 »
I've documented usb's notes, created a brief readme on 1.4 usage and configuration and added to a github fork. Just waiting for the owner to merge the pull request.

Hopefully this should help a little. My fork: (until it is merged) https://github.com/dangarfield/touphscript#toughscript

23
After investigation, I've updated the points above and will update the wiki too: http://wiki.ffrtt.ru/index.php?title=FF7/Field/Script/Opcodes/D3_SLINE

If you have any further insights, please reply or update the wiki.

Thanks

24
Hi,

I'm just playing around LINE field op code (0xD0) and have a few questions about the game behaviour.
I'll update this after:
http://wiki.ffrtt.ru/index.php?title=FF7/Field/Script/Opcodes/D0_LINE

There are generally 6 scripts (other than the init and main) if the entity is a LINE (taken from Makou Reactor):

  script index 2 -> S1 - [OK]
  script index 3 -> S2 - Move
  script index 4 -> S3 - Move
  script index 5 -> S4 - Go
  script index 6 -> S5 - Go 1x
  script index 7 -> S6 - Go away

[OK]
Occurrences - This is often present, but mostly contains a single RET op code.
Behaviour - I'm sure this is triggered when the player is close to the line and presses the [OK] button, eg blin59

Move
 - Occurrences
The script index 2 Move is often present, but again mostly contains a single RET op code.
The script index 3 Move is not often present but when it is, the script index 2 typically isn't, again, always ends with a RET.
There are 11 occurrences when both index 2 & 3 Move are present and both have more than one single RET op code.
10 of these contain exactly the same ops in both (fields - hyou4, hyou5_4)  - A REQEW and a RET with exactly the same params. Every one of these leads to a MAPJUMP.
1 of these (field - del12) contains 2 ops in the index 2 Move script (UC,MENU, and no RET). The index 3 Move script contains 11 ops including a final RET op

As a result of the above, I believe that it is relatively safe to assume the following logic:

 - Behaviour
This is triggered every time the player is close to the line.
If the index 2 Move is present, it executes until it receives a RET or finishes all of the ops, then
If the index 3 Move is present, it executes until it receives a RET or finishes all of the ops.

Go
Occurrences - This is often present, and always contains a final RET op code.
Behaviour - I'm sure this is triggered every time the player leaves the line

Go 1x
Occurrences - This is occasioanlly present, and always contains a final RET op code.
Behaviour - I'm sure this is triggered when the player leaves the line, but only once for the duration of the time in the field. Come examples are doors remaining open after they are programmatically triggered. bugin2.

Go away
Occurrences - Can be present alongside Go and Go 1x. Always contains a final RET op code.
Behaviour - Very similar to Go, but the distance that the player has to be away from the point is large (maybe 4x). Examples are the jumps on las0_6

It's worth noting that any combination of Go, Go 1x and Go away can be present an executable on any script.

Here is a JSON file containing a little more details on the occurrences, frequencies and combinations of the LINE op code usage: https://github.com/dangarfield/ff7-fenrir/blob/master/workings-out/output/line-occurences.json


Updates:
- Updated Move occurrences and behaviour- Should be final
- Updated Go, Go 1x & Go Move - Should be final

No further updates required.

Thanks,
Dan Garfield

25
Team Avalanche / Re: Project Edge (Jusete's field scenes)
« on: 2020-09-08 12:02:39 »
Great job! How are you dealing with slicing the 'semi transparent layers, e.g. Where the game uses additive or subtractive blending? Are these included in the sliced output also or it is just ignored? Same with param and state layers? Are they included too? I may have something that may be able to help identify and seperate later if you're interested

Pages: [1] 2