FWGS / xash3d-fwgs

Xash3D FWGS engine
1.58k stars 240 forks source link

Vita - Errors when loading into map #1876

Closed romruru closed 1 week ago

romruru commented 2 weeks ago

Followed the instructions as provided in psvita.md and downloaded the latest release. I'm able to load into the game but it is missing parts of the map and immediately crashes. On the Hazard Course I'm spawned at the bottom of the elevator shaft and on c0a0 the tram doesn't load and results in a crash.

Attached is the engine.log of the error. engine.log

a1batross commented 1 week ago
[2024:11:09|23:34:13] Chapter title: T0A0TITLEÿßÿ©
[2024:11:09|23:34:13] Error: No spawn function for "func_trainÿß1º"
[2024:11:09|23:34:13] Error: No spawn function for "path_track.ßi¹"
[2024:11:09|23:34:13] Error: No spawn function for "path_track»ß    ¹"
[2024:11:09|23:34:13] Error: No spawn function for "info_player_startÿßÿÿÿÿÿ@"
[2024:11:09|23:34:13] Error: No spawn function for "func_doorsߥ³"
[2024:11:09|23:34:13] Error: No spawn function for "light!߄!ÿ„!ñ±"
[2024:11:09|23:34:13] Error: No spawn function for "monster_generic)ß!9)®"
[2024:11:09|23:34:13] Error: No spawn function for "trigger_onces߄k{{9B)­"

This doesn't seem right.

Did you get game files from Steam version of the game?

romruru commented 1 week ago

Yes, I got the files from Steam version. I checked that they do work with an older version of fwgs from March here https://github.com/FWGS/xash3d-fwgs/releases/tag/continuous-tw_port

fgsfdsfgs commented 1 week ago

That just looks like every string is missing a null terminator. Don't know what would cause that. Can you try loading into a multiplayer map?

a1batross commented 1 week ago

Chapter title (which is worldspawn's netname) and classnames go through entity kvd parser and then through pfnAllocString.

As this bug seemingly affect only entity's strings variables, that might be caused by pfnAllocString, rather than widely used COM_ParseFile or Q_strncpy. There is a function called SV_ProcessString which replaces escaped symbols on the fly, and I think that might cause the issue on PSVita.

Some strings have ß after where they supposed to have NUL character, which corresponds to 0xDF, which is a special byte used to detect out of bounds writes in Mem_Free.

romruru commented 1 week ago

That just looks like every string is missing a null terminator. Don't know what would cause that. Can you try loading into a multiplayer map?

I tried loading into boot_camp and it immediately crashed.

engine.log

a1batross commented 1 week ago

I don't know what happens with SV_ProcessString here.

GCC removes the null termination during DSE optimization, as it was moved into the loop. This isn't a problem on any other platform, but for some reason might cause this issue on PSVita. I don't know which compiler version used for PSVita here so I can't verify the resulted assembly.

I replaced Mem_Malloc by Mem_Calloc, so string always comes zero initialized.

@romruru can you try latest build, when it finishes building?

romruru commented 1 week ago

That fixed it, thank you.