forked from rosebudai/OpenRCT2-Web
Merge pull request #25941 from mixiate/improve-sprite-build-performance
Improve command line sprite build performance
This commit is contained in:
4 files changed
+7
-8
No files matched your search
+1
-1
@@ -406,7 +406,7 @@ if (NOT CMAKE_CROSSCOMPILING)
|
||||
file(GLOB_RECURSE dependent_files CONFIGURE_DEPENDS "${ROOT_DIR}/resources/${graphics_file}/*")
|
||||
add_custom_command(
|
||||
OUTPUT ${output_file}
|
||||
COMMAND ./openrct2-cli sprite build "${CMAKE_BINARY_DIR}/${output_file}" "${json_file}"
|
||||
COMMAND ./openrct2-cli sprite build "${CMAKE_BINARY_DIR}/${output_file}" "${json_file}" silent
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
|
||||
DEPENDS ${dependent_files}
|
||||
)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
0.4.32 (in development)
|
||||
------------------------------------------------------------------------
|
||||
- Improved: [#25941] The command line sprite build command is now faster.
|
||||
|
||||
0.4.31 (2026-02-01)
|
||||
------------------------------------------------------------------------
|
||||
|
||||
+4
-4
@@ -113,7 +113,7 @@
|
||||
|
||||
<MakeDir Directories="$(DataOutputPath)" />
|
||||
|
||||
<Exec Command=""$(GraphicsCLIPath)" sprite build "$(DataOutputPath)g2.dat" "%(G2Input.FullPath)""
|
||||
<Exec Command=""$(GraphicsCLIPath)" sprite build "$(DataOutputPath)g2.dat" "%(G2Input.FullPath)" silent"
|
||||
ConsoleToMSBuild="true"
|
||||
IgnoreExitCode="false">
|
||||
<Output TaskParameter="ConsoleOutput" PropertyName="G2BuildOutput" />
|
||||
@@ -133,7 +133,7 @@
|
||||
|
||||
<MakeDir Directories="$(DataOutputPath)" />
|
||||
|
||||
<Exec Command=""$(GraphicsCLIPath)" sprite build "$(DataOutputPath)fonts.dat" "%(FontsInput.FullPath)""
|
||||
<Exec Command=""$(GraphicsCLIPath)" sprite build "$(DataOutputPath)fonts.dat" "%(FontsInput.FullPath)" silent"
|
||||
ConsoleToMSBuild="true"
|
||||
IgnoreExitCode="false">
|
||||
<Output TaskParameter="ConsoleOutput" PropertyName="FontsBuildOutput" />
|
||||
@@ -153,7 +153,7 @@
|
||||
|
||||
<MakeDir Directories="$(DataOutputPath)" />
|
||||
|
||||
<Exec Command=""$(GraphicsCLIPath)" sprite build "$(DataOutputPath)tracks.dat" "%(TracksInput.FullPath)""
|
||||
<Exec Command=""$(GraphicsCLIPath)" sprite build "$(DataOutputPath)tracks.dat" "%(TracksInput.FullPath)" silent"
|
||||
ConsoleToMSBuild="true"
|
||||
IgnoreExitCode="false">
|
||||
<Output TaskParameter="ConsoleOutput" PropertyName="TracksBuildOutput" />
|
||||
@@ -173,7 +173,7 @@
|
||||
|
||||
<MakeDir Directories="$(DataOutputPath)" />
|
||||
|
||||
<Exec Command=""$(GraphicsCLIPath)" sprite build "$(DataOutputPath)palettes.dat" "%(PalettesInput.FullPath)""
|
||||
<Exec Command=""$(GraphicsCLIPath)" sprite build "$(DataOutputPath)palettes.dat" "%(PalettesInput.FullPath)" silent"
|
||||
ConsoleToMSBuild="true"
|
||||
IgnoreExitCode="false">
|
||||
<Output TaskParameter="ConsoleOutput" PropertyName="PalettesBuildOutput" />
|
||||
|
||||
@@ -80,15 +80,13 @@ namespace OpenRCT2::CommandLine::Sprite
|
||||
// New image will have its data inserted after previous image
|
||||
uint8_t* newElementOffset = reinterpret_cast<uint8_t*>(static_cast<uintptr_t>(Header.totalSize));
|
||||
Header.totalSize += static_cast<uint32_t>(image.Buffer.size());
|
||||
Entries.reserve(Header.numEntries);
|
||||
|
||||
{
|
||||
ScopedRelativeSpriteFile scopedRelative(*this);
|
||||
Data.reserve(Header.totalSize);
|
||||
Entries.push_back(image.Element);
|
||||
Entries.back().offset = newElementOffset;
|
||||
const auto& buffer = image.Buffer;
|
||||
std::copy(buffer.begin(), buffer.end(), std::back_inserter(Data));
|
||||
Data.insert(Data.end(), buffer.begin(), buffer.end());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user