Skip to content

Replace CopyAssets.cmake with multithreaded Robocopy (and rsync) implementation.#410

Merged
void2012 merged 28 commits intosmartcmd:mainfrom
PortalG:robocopy-in-cmake
Mar 5, 2026
Merged

Replace CopyAssets.cmake with multithreaded Robocopy (and rsync) implementation.#410
void2012 merged 28 commits intosmartcmd:mainfrom
PortalG:robocopy-in-cmake

Conversation

@PortalG
Copy link
Contributor

@PortalG PortalG commented Mar 4, 2026

Description

CopyAssets.cmake has portability/reliability issues that stem from how CMake does file globbing. Rather than trying to find hacky solutions to fix a buggy feature, this PR is an attempt to introduce Robocopy as a reliable, flexible, and multithreaded alternative.

Changes

  1. Scrap CopyAssets.cmake completely. (or keep it as an option, your pick)
  2. Add two robocopy.exe calls in CMakeLists.txt: one to copy shared library redists, and one to copy only necessary assets in Minecraft.Client using file and folder exclusion patterns.

Previous Behavior

CMakeLists.txt executes CopyAssets.cmake, which relies on file globbing to try and find runtime required files to copy over. Not only is CMake's file globbing inefficient, but it is known to cause major portability issues. Depending on what version of CMake you are using or what directory the CMake project is in might affect how files are globbed, causing scenarios where CopyAssets.cmake will fail. Runtime is then never reached in a build that is supposed to be automated. When file globbing doesn't work, it often produces output that looks like this:

Screenshot 2026-03-03 163232

Not beneficial for an out-of-box experience.

Root Cause

This isn't a PR to go and hate on CMake. CMake is a great C/C++ build system compared to others. This is more to address a huge limitation when it comes to copying files the CMake way. Having inconsistent build results for something that is non-obvious and can't be figured out easily by a maintainer isn't great, and should be acknowledged.

New Behavior

Since the host machine is guaranteed to be building with Windows, Robocopy will always be available as it comes default with Windows systems. With native, multithreaded performance and the flexibility to modify behavior to high degrees, it allows for a more developer controlled experience at the cost of virtually nothing. As a result, the game runs without crash after compiled, with all assets properly copied:

Screenshot 2026-03-03 212029

Fix Implementation

The execute_process(...) function was used to start instances of robocopy.exe. As explained before, it uses two calls: one to copy redists and one to copy assets. By default, multithreading is enabled with the /MT tag. Other tags are used to ignore empty directories and files that can't be accessed. I tried to implement exclusions as close as the original CMake file, but if I made any mistakes or anything is missing, feel free to add.

@void2012
Copy link
Collaborator

void2012 commented Mar 4, 2026

Please refrain from using Win32-only utilities like that. Or at least hide within if(...) that checks that the current system is Windows.

@GuglioIsStupid
Copy link
Contributor

GuglioIsStupid commented Mar 4, 2026

Maybe rsync should be used, thats cross-platform and does what robocopy does

codeHusky and others added 26 commits March 4, 2026 20:51
This could reveal someone's private information on a livestream or video.
We need a long-term username implementation
Still allows for -name launch argument, but restores old expected behavior
Fix vector out-of-bounds crash when scrolling the potions tab in the creative inventory with Art Tools debug enabled.

- Fix getPageCount() returning total rows instead of scrollable pages in Art Tools mode

- Fix off-by-one boundary check in populateMenu() for both static and debug group loops (< should be <=)

Fixes smartcmd#386
* Fix: Sorted the item list in the debug overlay

* revert show all files to false

* Revert ShowAllFiles by removing it

* removed extra line

* Adressed PR review changes

* Replaced push_back with emplace_back

* Removed redundant emplace_back
Preserve smooth row-by-row scrolling for mouse wheel input, but restore
full-page movement for controller/menu scroll actions in the creative
inventory.

Commit 3093ca3 changed page indexing to support smooth scrolling, which
caused ACTION_MENU_OTHER_STICK_UP/DOWN to advance by one row instead of
one page. Track whether the scroll action originated from the mouse
wheel and only use single-row steps in that case.

Fixes smartcmd#253
* Add initial AnyAspectRatio support

* Remove some logic that didn't work

* Remove rogue back slash

* Remove more remnants

* Update UILayer.h

* Update some comments

* Remove WIP UI changes

* Fix diffs

* Remove UI resize call from `UpdateAspectRatio`

* handle merge conflict

* Update to C++ style static cast

* Fix syntax
…d#446)

Save fullscreen toggle state to options.txt when F11 is pressed, and restore it on the next launch. When starting in windowed mode, the window now opens maximized instead of at a smaller default size.

Previously, g_isFullscreen was hardcoded to false and never persisted, so the game always started in windowed mode. The window also started at a non-maximized size requiring manual maximization.

Fixes smartcmd#391
People keep going "Oh no I don't like the red WINDOWS text, oh no! I hate it!
The red windows text is the devil, it will be my undoing! Please remove the red
windows text or I shall simply perish!" And for that? Well, I have removed it. Now
you can enjoy this logo made by @wiskerdmage in the style of the existing Edition
logos. (smartcmd#385 (comment))
This one looks a bit nicer so let's use this for now...
This fixes the jittery problem.
@PortalG
Copy link
Contributor Author

PortalG commented Mar 5, 2026

Added Win32 checks, rsync implementation for Unix systems, and Windows64Media patching with Xbox One assets (DurangoMedia).

@PortalG PortalG changed the title Replace CopyAssets.cmake with multithreaded Robocopy implementation. Replace CopyAssets.cmake with multithreaded Robocopy (and rsync) implementation. Mar 5, 2026
@void2012
Copy link
Collaborator

void2012 commented Mar 5, 2026

@PortalG ready to merge?

@PortalG
Copy link
Contributor Author

PortalG commented Mar 5, 2026

yup

@void2012 void2012 merged commit fcc9970 into smartcmd:main Mar 5, 2026
@PortalG PortalG deleted the robocopy-in-cmake branch March 5, 2026 07:40
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.