Page MenuHomeWildfire Games

[POC] Checksumming to avoid OOS
Needs ReviewPublic

Authored by wraitii on Jan 21 2021, 11:50 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

Bit of a POC/WIP, maybe not a great idea.
This adds a way to checksum VFS files, which can be used to compare SVN revisions between players somewhat. It's obviously missing the source/ folder, which can be problematic.

Further no GUI support because I'd have to actually add this to the net code and it's not that trivial™.
Hashing works nice and fast though.

Kinda refs #161

Test Plan

TODO

Event Timeline

wraitii created this revision.Jan 21 2021, 11:50 AM
wraitii added inline comments.Jan 21 2021, 12:15 PM
source/lib/file/vfs/vfs_tree.cpp
263

I'm not entirely sure timestamps are platform-compatible

Build is green

builderr-debug-macos.txt
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libnetwork_dbg.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/liblobby_dbg.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libsimulation2_dbg.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libscriptinterface_dbg.a(precompiled.o) has no symbols
../../../source/network/scripting/JSInterface_Network.cpp:169:71: warning: unused parameter 'pCmptPrivate' [-Wunused-parameter]
void JSI_Network::StartNetworkJoinLobby(ScriptInterface::CmptPrivate* pCmptPrivate, const CStrW& playerName, const CStr& hostJID, const CStr& pas

See https://jenkins.wildfiregames.com/job/macos-differential/3003/display/redirect for more details.

Build is green

builderr-debug-gcc7.txt
../../../source/network/scripting/JSInterface_Network.cpp: In function 'void JSI_Network::StartNetworkJoinLobby(ScriptInterface::CmptPrivate*, const CStrW&, const CStr8&, const CStr8&)':
../../../source/network/scripting/JSInterface_Network.cpp:169:71: warning: unused parameter 'pCmptPrivate' [-Wunused-parameter]
 void JSI_Network::StartNetworkJoinLobby(ScriptInterface::CmptPrivate* pCmptPrivate, const CStrW& playerName, const CStr& hostJID, const CStr& password)
                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
../../../source/lib/res/h_mgr.cpp: In function 'void h_free_hd(HDATA*)':
../../../source/lib/res/h_mgr.cpp:560:27: warning: 'void* memset(void*, int, size_t)' clearing an object of type 'struct HDATA' with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess]
  memset(hd, 0, sizeof(*hd));
                           ^
../../../source/lib/res/h_mgr.cpp:132:8: note: 'struct HDATA' de

See https://jenkins.wildfiregames.com/job/docker-differential/4660/display/redirect for more details.

wraitii requested review of this revision.Jan 21 2021, 12:49 PM
Stan added a subscriber: Stan.Jan 21 2021, 12:59 PM

Just saw it was PoC for A2* after writing the comments.

source/lib/file/vfs/vfs.h
31–33
source/lib/file/vfs/vfs_tree.cpp
261–263
263

Add tests maybe? with a fixed timestamp, see if it works.

266

can we use the type here?

source/ps/scripting/JSInterface_VFS.h
21
wraitii added inline comments.Jan 21 2021, 1:11 PM
source/lib/file/vfs/vfs_tree.cpp
266

We could, but I don't think it really brings in much for a recursive function.