Skip to content

Feature/protobuf savedata#370

Open
PuppetMasterHex wants to merge 6 commits intoMSRevive:devfrom
PuppetMasterHex:feature/protobuf-savedata
Open

Feature/protobuf savedata#370
PuppetMasterHex wants to merge 6 commits intoMSRevive:devfrom
PuppetMasterHex:feature/protobuf-savedata

Conversation

@PuppetMasterHex
Copy link
Copy Markdown

  • Added protobuf save feature and made it the new default
    • Saving -> ProtoSave::SaveCharProtobuf
    • Loading -> ProtoSave::LoadCharProtobuf
  • Protobuf can export to JSON -> ProtoSave::SaveCharJSON
  • Compatible with old save files
    • First protobuf tries to parse the data
    • If it fails there is a fallback to the old save loader
  • Added dockerfile for easy compiling and testing
    • Can volume mount hlds in the container and run the server there
    • docker/run_server.sh copies the ms.so and config files before starting hlds for faster testing
  • Minor improvements
    • Compile multithreaded with -j8 on linux
    • Made msstring::c_str() const

@SaintWish
Copy link
Copy Markdown
Member

Sorry for the delay I'll get to looking at this soon, been busy these last few days.

Copy link
Copy Markdown
Member

@SaintWish SaintWish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems windows fails to compile because of the find_package for protobuf (https://github.com/MSRevive/MasterSwordRebirth/actions/runs/23979449975/job/70516350440?pr=370)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why the compiler and compile flags are set here when they were already set here https://github.com/MSRevive/MasterSwordRebirth/blob/dev/CMakeLists.txt

Copy link
Copy Markdown
Author

@PuppetMasterHex PuppetMasterHex Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why the flags in the CMakeLists.txt are ignored, the block is executed I tested that.
When the entry in the LinuxToolchain.cmake is removed, there are linker errors because cmake doesn't link the 32bit libprotobuf:
protosave.cpp:(.text+0x2d2b): undefined reference to `google::protobuf::RepeatedPtrFieldstd::string::Add()'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try moving find_package(Protobuf REQUIRED) to the server and client CMakeLists, that might fix that?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested some combinations and -D_GLIBCXX_USE_CXX11_ABI=0 causes the linking of libprotobuf to fail.
@tschumann you've added this in commit 8e05d36, do you remember where this was needed back then?
Building and running in the container works fine without that flag.

@tschumann
Copy link
Copy Markdown
Contributor

tschumann commented Apr 9, 2026 via email

@SaintWish
Copy link
Copy Markdown
Member

Still a few todo debugs as well.

Also, what are the URLs in the .cfg files?

On Thu, 9 Apr 2026 at 13:23, Saint Wish @.***> wrote:

@.**** requested changes on this pull request.

Seems windows fails to compile because of the find_package for protobuf (
https://github.com/MSRevive/MasterSwordRebirth/actions/
runs/23979449975/job/70516350440?pr=370)

On src/game/server/save/protosave.h
#370 (comment)
:

That license at the top would restrict anyone but you from ever modifying
this code, and is incompatible with the HL SDK and GPL3.0 license.

On src/game/server/save/protosave.cpp
#370 (comment)
:

That license at the top would restrict anyone but you from ever modifying
this code, and is incompatible with the HL SDK and GPL3.0 license.

Instead of using the C++ std filesystem please use the engine's filesystem
https://github.com/MSRevive/MasterSwordRebirth/blob/dev/
src/game/shared/filesystem_shared.h

On cmake/LinuxToolchain.cmake
#370 (comment)
:

I'm not sure why the compiler and compile flags are set here when they
were already set here https://github.com/MSRevive/
MasterSwordRebirth/blob/dev/CMakeLists.txt


Reply to this email directly, view it on GitHub
#370 (review),
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AA34IYSAF2FTUJEB5HU3GTT4U4JU5AVCNFSM6AAAAACXMUMW2KVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHM2DANZZGQ3TCNZTHA
.
You are receiving this because you are subscribed to this thread.Message
ID: @.***>

Good catch!

@PuppetMasterHex PuppetMasterHex force-pushed the feature/protobuf-savedata branch from 1dfa5b8 to df8479f Compare April 9, 2026 18:16
@PuppetMasterHex
Copy link
Copy Markdown
Author

PuppetMasterHex commented Apr 9, 2026

Still a few todo debugs as well. Also, what are the URLs in the .cfg files?

I have removed the debug comments, only kept the /// @todo replace with range based for of mslist for loops, since I think that list implementation should support range based for loops :)

The .cfg files (and these URLs) come from the default .cfgs shipped with MSR, I have replaced the URLs with example.org

@PuppetMasterHex
Copy link
Copy Markdown
Author

Seems windows fails to compile because of the find_package for protobuf (https://github.com/MSRevive/MasterSwordRebirth/actions/runs/23979449975/job/70516350440?pr=370)

The WindowsToolchain.cmake includes vcpkg but I cannot find the file included there.
Most package managers support protobuf

I think cpm would also work.
What is the preferred way to add dependencies for the windows build?

@PuppetMasterHex PuppetMasterHex force-pushed the feature/protobuf-savedata branch from df8479f to d7540df Compare April 9, 2026 19:41
@SaintWish
Copy link
Copy Markdown
Member

SaintWish commented Apr 9, 2026

The preferred way for now is to just add them manually to thirdpart either just the code or if it needs to be compiled then the compiled form, like for example the libcurl. I tried using vcpkg once but had nothing but problems with it and git dependencies.

I never tried CPM though it might worth using it it works better than VCPKG
After looking at CPM, it might be worth using that since all it requires is CMake.

@SaintWish
Copy link
Copy Markdown
Member

Still a few todo debugs as well. Also, what are the URLs in the .cfg files?

I have removed the debug comments, only kept the /// @todo replace with range based for of mslist for loops, since I think that list implementation should support range based for loops :)

The .cfg files (and these URLs) come from the default .cfgs shipped with MSR, I have replaced the URLs with example.org

At some point we want to get rid of mslist and just use the appropriate standard lib option same for msstring.

Signed-off-by: Genesis <10389486+PuppetMasterHex@users.noreply.github.com>
Signed-off-by: Genesis <10389486+PuppetMasterHex@users.noreply.github.com>
With the dockerfile it is not necessary anymore

Signed-off-by: Genesis <10389486+PuppetMasterHex@users.noreply.github.com>
…onfigs

Signed-off-by: Genesis <10389486+PuppetMasterHex@users.noreply.github.com>
The data is not modified in the function so it should be const

Signed-off-by: Genesis <10389486+PuppetMasterHex@users.noreply.github.com>
@PuppetMasterHex PuppetMasterHex force-pushed the feature/protobuf-savedata branch from d7540df to adb4bff Compare April 11, 2026 13:06
@PuppetMasterHex
Copy link
Copy Markdown
Author

I never tried CPM though it might worth using it it works better than VCPKG After looking at CPM, it might be worth using that since all it requires is CMake.

I have added cmake/protobuf.cmake that uses CPM to fetch and build protobuf for windows, but I cannot test if the target_link_libaries works for $<$<PLATFORM_ID:Windows>:libprotobuf>

Also committed the protoc generated files since BPM doesnt support a two stage build to build protoc before running 'cmake -B'

Signed-off-by: Genesis <10389486+PuppetMasterHex@users.noreply.github.com>
@PuppetMasterHex PuppetMasterHex force-pushed the feature/protobuf-savedata branch from adb4bff to 85db73d Compare April 11, 2026 13:12
@SaintWish
Copy link
Copy Markdown
Member

If it fails to build again on windows I can just merge it and work on it when I have time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants