skelatool64: fix "pessimizing-move" warnings + clean build with main Makefile. Fix typo.

This commit is contained in:
hackgrid 2023-12-11 19:19:50 +01:00
parent f0146f2041
commit d51b800588
10 changed files with 40 additions and 27 deletions

View File

@ -359,6 +359,7 @@ build/src/scene/security_camera.o: build/src/audio/clips.h build/assets/models/p
build/src/scene/signage.o: $(MODEL_HEADERS)
build/src/scene/switch.o: build/assets/models/props/switch001.h build/assets/materials/static.h build/assets/models/dynamic_animated_model_list.h
build/src/util/dynamic_asset_data.o: build/assets/models/dynamic_model_list_data.h
build/src/util/dynamic_animated_asset_data.o: build/assets/models/dynamic_animated_model_list_data.h
build/src/util/dynamic_asset_loader.o: build/assets/models/dynamic_model_list.h build/assets/models/dynamic_animated_model_list.h
build/src/menu/audio_options.o: build/src/audio/subtitles.h
build/src/menu/video_options.o: build/src/audio/subtitles.h
@ -569,10 +570,11 @@ $(BASE_TARGET_NAME)_debug.z64: $(CODESEGMENT)_debug.o $(OBJECTS) $(DATA_OBJECTS)
makemask $(BASE_TARGET_NAME)_debug.z64
clean:
rm -rf skelatool64/build
rm -rf build
rm -rf portal_pak_dir
rm -rf portal_pak_modified
rm -rf assets/locales/
rm -rf assets/locales
clean-src:
rm -rf build/src

View File

@ -28,7 +28,7 @@ Bone* Bone::GetParent() {
return mParent;
}
std::unique_ptr<DataChunk> Bone::GenerateRestPosiitonData() {
std::unique_ptr<DataChunk> Bone::GenerateRestPositionData() {
std::unique_ptr<StructureDataChunk> result(new StructureDataChunk());
result->Add(std::unique_ptr<DataChunk>(new StructureDataChunk(mRestPosition)));
@ -190,13 +190,14 @@ Bone* BoneHierarchy::BoneForName(std::string name) {
}
}
void BoneHierarchy::GenerateRestPosiitonData(CFileDefinition& fileDef, const std::string& variableName) {
void BoneHierarchy::GenerateRestPositionData(CFileDefinition& fileDef, const std::string& variableName) {
if (mBones.size() == 0) return;
std::unique_ptr<StructureDataChunk> transformData(new StructureDataChunk());
for (unsigned int boneIndex = 0; boneIndex < mBones.size(); ++boneIndex) {
transformData->Add(std::move(mBones[boneIndex]->GenerateRestPosiitonData()));
auto restPositionData = mBones[boneIndex]->GenerateRestPositionData();
transformData->Add(std::move(restPositionData));
std::string boneName = fileDef.GetUniqueName(mBones[boneIndex]->GetName() + "_BONE");
std::transform(boneName.begin(), boneName.end(), boneName.begin(), ::toupper);
@ -215,4 +216,4 @@ bool BoneHierarchy::HasData() const {
unsigned int BoneHierarchy::GetBoneCount() const {
return mBones.size();
}
}

View File

@ -36,7 +36,7 @@ public:
const std::string& GetName();
Bone* GetParent();
std::unique_ptr<DataChunk> GenerateRestPosiitonData();
std::unique_ptr<DataChunk> GenerateRestPositionData();
static Bone* FindCommonAncestor(Bone* a, Bone* b);
/**
@ -72,7 +72,7 @@ public:
bool HasData() const;
unsigned int GetBoneCount() const;
void GenerateRestPosiitonData(CFileDefinition& fileDef, const std::string& variableName);
void GenerateRestPositionData(CFileDefinition& fileDef, const std::string& variableName);
private:
std::vector<std::unique_ptr<Bone>> mBones;
std::map<std::string, Bone*> mBoneByName;

View File

@ -212,7 +212,8 @@ DisplayList::DisplayList(std::string name):
}
void DisplayList::AddCommand(std::unique_ptr<DisplayListCommand> command) {
mDataChunk->Add(std::move(command->GenerateCommand()));
auto generatedCommand = command->GenerateCommand();
mDataChunk->Add(std::move(generatedCommand));
}
StructureDataChunk& DisplayList::GetDataChunk() {
@ -237,4 +238,4 @@ std::unique_ptr<FileDefinition> DisplayList::Generate(const std::string& fileSuf
result->AddTypeHeader("<ultra64.h>");
return result;
}
}

View File

@ -15,8 +15,8 @@ void useTexture(std::set<std::shared_ptr<TextureDefinition>>& usedTextures, std:
}
usedTextures.insert(texture);
fileDefinition.AddDefinition(std::move(texture->GenerateDefinition(fileDefinition.GetUniqueName(texture->Name()), fileSuffix)));
auto textureDefinition = texture->GenerateDefinition(fileDefinition.GetUniqueName(texture->Name()), fileSuffix);
fileDefinition.AddDefinition(std::move(textureDefinition));
std::shared_ptr<PalleteDefinition> pallete = texture->GetPallete();
if (!pallete || usedPalletes.find(pallete) != usedPalletes.end()) {
@ -24,7 +24,8 @@ void useTexture(std::set<std::shared_ptr<TextureDefinition>>& usedTextures, std:
}
usedPalletes.insert(pallete);
fileDefinition.AddDefinition(std::move(pallete->GenerateDefinition(fileDefinition.GetUniqueName(pallete->Name()), fileSuffix)));
auto palleteDefinition = pallete->GenerateDefinition(fileDefinition.GetUniqueName(pallete->Name()), fileSuffix);
fileDefinition.AddDefinition(std::move(palleteDefinition));
}
void MaterialCollector::UseMaterial(const std::string& material, DisplayListSettings& settings) {
@ -150,4 +151,4 @@ std::string generateMesh(const aiScene* scene, CFileDefinition& fileDefinition,
fileDefinition.AddDefinition(std::move(dlResult));
return displayList.GetName();
}
}

View File

@ -266,7 +266,7 @@ AnimationResults generateAnimationForScene(const aiScene* scene, CFileDefinition
std::string bonesName = fileDefinition.GetUniqueName("default_bones");
std::string boneParentName = fileDefinition.GetUniqueName("bone_parent");
bones.GenerateRestPosiitonData(fileDefinition, bonesName);
bones.GenerateRestPositionData(fileDefinition, bonesName);
std::string boneCountName = bonesName + "_COUNT";
std::transform(boneCountName.begin(), boneCountName.end(), boneCountName.begin(), ::toupper);
fileDefinition.AddMacro(boneCountName, std::to_string(bones.GetBoneCount()));

View File

@ -83,8 +83,9 @@ std::shared_ptr<CollisionGeneratorOutput> generateCollision(const aiScene* scene
if (namedEntry != "") {
fileDefinition.AddMacro(fileDefinition.GetMacroName(namedEntry + "_COLLISION_INDEX"), std::to_string(output->quads.size()));
}
collidersChunk->Add(std::move(collider.Generate()));
auto generatedCollider = collider.Generate();
collidersChunk->Add(std::move(generatedCollider));
std::unique_ptr<StructureDataChunk> colliderType(new StructureDataChunk());
colliderType->AddPrimitive<const char*>("CollisionShapeTypeQuad");
@ -174,4 +175,4 @@ void generateMeshCollider(CFileDefinition& fileDefinition, CollisionGeneratorOut
std::unique_ptr<FileDefinition> definition(new DataFileDefinition("struct MeshCollider", colliderName, false, "_geo", std::move(meshColliderChunk)));
definition->AddTypeHeader("\"physics/mesh_collider.h\"");
fileDefinition.AddDefinition(std::move(definition));
}
}

View File

@ -54,11 +54,13 @@ void MaterialGenerator::GenerateDefinitions(const aiScene* scene, CFileDefinitio
}
for (auto& texture : textures) {
fileDefinition.AddDefinition(std::move(texture->GenerateDefinition(fileDefinition.GetUniqueName(texture->Name()), "_mat")));
auto textureDefinition = texture->GenerateDefinition(fileDefinition.GetUniqueName(texture->Name()), "_mat");
fileDefinition.AddDefinition(std::move(textureDefinition));
}
for (auto& pallete : palletes) {
fileDefinition.AddDefinition(std::move(pallete->GenerateDefinition(fileDefinition.GetUniqueName(pallete->Name()), "_mat")));
auto palleteDefinition = pallete->GenerateDefinition(fileDefinition.GetUniqueName(pallete->Name()), "_mat");
fileDefinition.AddDefinition(std::move(palleteDefinition));
}
int index = 0;
@ -130,4 +132,4 @@ std::string MaterialGenerator::MaterialIndexMacroName(const std::string& materia
std::transform(materialName.begin(), materialName.end(), result.begin(), ::toupper);
makeCCompatible(result);
return result + "_INDEX";
}
}

View File

@ -20,7 +20,8 @@ std::unique_ptr<DataChunk> buildMacroChunk(lua_State* L) {
lua_pushnil(L); /* first key */
while (lua_next(L, args) != 0) {
result->Add(std::move(buildDataChunk(L)));
auto dataChunk = buildDataChunk(L);
result->Add(std::move(dataChunk));
lua_pop(L, 1);
}
lua_pop(L, 1);
@ -39,7 +40,8 @@ std::unique_ptr<DataChunk> buildStructureChunk(lua_State* L) {
while (lua_next(L, topStart) != 0) {
int keyType = lua_type(L, -2);
if (keyType == LUA_TNUMBER) {
result->Add(std::move(buildDataChunk(L)));
auto dataChunk = buildDataChunk(L);
result->Add(std::move(dataChunk));
} else if (keyType == LUA_TSTRING) {
namedEntries.push_back(std::pair<std::string, std::unique_ptr<DataChunk>>(
lua_tostring(L, -2),
@ -308,4 +310,4 @@ int luaDefinitonWriterAppend(lua_State* L) {
void populateLuaDefinitionWrite(lua_State* L, CFileDefinition& fileDef) {
lua_pushlightuserdata(L, &fileDef);
luaChainModuleLoader(L, "sk_definition_writer", luaDefinitonWriterAppend, 1);
}
}

View File

@ -601,17 +601,20 @@ void generateMaterial(CFileDefinition& fileDef, const MaterialState& from, const
generateEnumMacro((int)from.alphaCompare, (int)to.alphaCompare, "gsDPSetAlphaCompare", gAlphaCompareNames, output);
generateEnumMacro((int)from.depthSource, (int)to.depthSource, "gsDPSetDepthSource", gDepthSourceNames, output);
std::unique_ptr<DataChunk> geometryModes = std::move(generateGeometryModes(from, to));
auto generatedGeometryModes = generateGeometryModes(from, to);
std::unique_ptr<DataChunk> geometryModes = std::move(generatedGeometryModes);
if (geometryModes) {
output.Add(std::move(geometryModes));
}
std::unique_ptr<DataChunk> combineMode = std::move(generateCombineMode(from, to));
auto generatedCombineMode = generateCombineMode(from, to);
std::unique_ptr<DataChunk> combineMode = std::move(generatedCombineMode);
if (combineMode) {
output.Add(std::move(combineMode));
}
std::unique_ptr<DataChunk> renderMode = std::move(generateRenderMode(from, to));
auto generatedRenderMode = generateRenderMode(from, to);
std::unique_ptr<DataChunk> renderMode = std::move(generatedRenderMode);
if (renderMode) {
output.Add(std::move(renderMode));
}
@ -869,4 +872,4 @@ double materialTransitionTime(const MaterialState& from, const MaterialState& to
}
return result;
}
}