nikez / gtav_audio_occlusion_documentation

MIT License
54 stars 15 forks source link

Occlusion Hash: *.ymt file doesn't load #2

Closed Markus1812 closed 3 years ago

Markus1812 commented 3 years ago

Hey, i am trying to implement the Audio Occlusion files for this interior: https://github.com/Evgenius33/Pillbox-Hospital-Interior

The dat151 and dat15 files are already working thanks to your documentation and Codewalker. I already tested them and I got reverb/echo in the hospital rooms.

My problem is, that the *.ymt file doesn't even get downloaded by fivem, because (my guess) I think the game doesn't request these files from streaming?

What I have done:

  1. Calculate the Occlusion Hash
    1. Get the coordinates and the Archetype from the .ymap
    2. Archetype: phxlsmc_interior_col (hash: 85189926)
    3. Coords: 327.6865, -580.5995, 60.59223
    4. I tried both calculations: (the second gives a different result, because I tried to just cut the decimal numbers. 85189926 ^ Math.floor((327.6865 * 100)) ^ Math.floor((-580.5995 * 100)) ^ Math.floor((60.59223 * 100)) & 0xffffffff = -85168199 85189926 ^ 32768 ^ -58059 ^ 6059 & 0xffffffff = -85168200
  2. Created the -85168199.ymt file. For now, just the connection between 0 (outside) and 1 (entrance). Full file attached as xml.
    <Item>
    <InteriorProxyHash value="-85168199" />
    <PortalIdx value="0" />
    <RoomIdx value="0" />
    <DestInteriorHash value="-85168199" />
    <DestRoomIdx value="1" />
    <PortalEntityList itemType="hash_F6624EF9" />
    </Item>
    <Item>
    <Key value="-575889495" />
    <PathNodeChildList itemType="hash_892CF74F">
    <Item>
    <PathNodeKey value="0" />
    <PortalInfoIdx value="0" />
    </Item>
    <Item>
    <PathNodeKey value="0" />
    <PortalInfoIdx value="1" />
    </Item>
    </PathNodeChildList>
    </Item>
  3. Tried the same files with -85168198, -85168199, -85168200 as Occlusion Hash (and InteriorProxyHash, DestIneriorHash)
  4. Loaded into Fivem, opened strlist and searched for these files. They never showed up and never got added to the cache index.

Maybe important info:

Files (these are xml files, but Github only allows them as .txt)

phxlsmc_interior_col_mix.dat15.rel.xml.txt phxlsmc_interior_col_game.dat151.rel.xml.txt -85168198.ymt.pso.xml.txt

I hope you have an idea, what I am doing wrong. When I figured everything out, I plan to extend this documentation with my findings and to upload the audio files to the hospital repository. Thanks.

Markus1812 commented 3 years ago

My first achievement is, that I got "the correct" filename. At least, FiveM is loading/streaming the file now.

First I used: {archetype} ^ {(int) (mlo.x * 100)} ^ {(int) (mlo.y * 100)} ^ {(int) (mlo.z * 100)} & 0xffffffff 85189926 ^ 32768 ^ -58059 ^ 6059 & 0xffffffff = -85168200

In Two's complement, -85168200 = 11111010111011000110111110111000

And when we take the binary number, and put it back to decimal (without Two's complement) 11111010111011000110111110111000 = 4209799096

And the file 4209799096.ymt actually gets requested/downloaded/loaded by GTA when getting near the hospital interior linked above. The interesting thing is, that 4209799096 is to big for a Two's complement Int32 number, but it seems as GTA expects filenames to be like this? The next problem is, that CodeWalker won't allow me to put that number in the .ymt, because its to big. But I'll try other methods again later today and will report, when I got further news.

MDitraX (and no, 4209799096.ymt is not a default GTA file)

nikez commented 3 years ago

Send me the ymap + ytyp and I can look at it