Conversation
dlls/util.cpp
Outdated
| LittleShortSW( data[i] ); | ||
| } | ||
|
|
||
| BufferField( pname, sizeof(short) * count, (const char *)data ); |
There was a problem hiding this comment.
Maybe add some sort of argument to BufferField that will tell the data type, and only swap it when it's written to save file?
So that we don't modify original buffer
cl_dll/StudioModelRenderer.cpp
Outdated
| { | ||
| if ( pseqdesc2[i].seqgroup == pseqdesc->seqgroup ) | ||
| { | ||
| panim = (mstudioanim_t *)( (byte *)paSequences[pseqdesc->seqgroup].data + pseqdesc2[i].animindex ); |
There was a problem hiding this comment.
Let's reduce panim scope to this block.
| uint32_t li = Swap32( bi ); | ||
| return UintAsFloat( li ); | ||
| } | ||
|
|
There was a problem hiding this comment.
As HLSDK written in C++, maybe we could have something like a template function that will automatically apply appropriate swap based on data type size.
It's completely fine without it too, it's just a minor nitpick.
dlls/nodes.cpp
Outdated
| LittleLongSW( m_cLinks ); | ||
| LittleLongSW( m_nRouteInfo ); | ||
|
|
||
| for ( int i = 0; i < 3; i++ ) |
There was a problem hiding this comment.
It would be nice to avoid magic numbers.
There is a helper macro ARRAYSIZE to get the size of arrays.
There was a problem hiding this comment.
(that applies to the whole PR, as it's not the only place, there is similar issue in studio model renderer)
Instead of 3 it could be ARRAYSIZE( m_RegionMin ) for example and instead of NUM_RANGES it could be `ARRAYSIZE( m_RangeStart[i] ).
095888b to
b3bf0c0
Compare
Figured I'd start with something relatively small. This should be everything that needs to be byteswapped in hlsdk.
I've also added definitions for the s390x architecture which is the only big endian architecture that has official support from debian and some other big distros, which might be useful for CI.