Skip to content

Commit

Permalink
22425: Implements VERIFY_ENTITY in trace files and fixes issue where …
Browse files Browse the repository at this point in the history
…it would respond incorrectly, MINOR (#328)
  • Loading branch information
howsohazard authored Dec 17, 2024
1 parent 6371d3f commit 645471b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
13 changes: 13 additions & 0 deletions src/Amalgam/AmalgamTrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,19 @@ int32_t RunAmalgamTrace(std::istream *in_stream, std::ostream *out_stream, std::
{
response = AMALGAM_VERSION_STRING;
}
else if(command == "VERIFY_ENTITY")
{
std::vector<std::string> command_tokens = StringManipulation::SplitArgString(input);
if(command_tokens.size() >= 1)
{
auto status = entint.VerifyEntity(command_tokens[0]);
response = status.loaded ? SUCCESS_RESPONSE : FAILURE_RESPONSE;
}
else
{
response = FAILURE_RESPONSE;
}
}
else if(command == "GET_MAX_NUM_THREADS")
{
#if defined(MULTITHREAD_SUPPORT)
Expand Down
8 changes: 4 additions & 4 deletions src/Amalgam/AssetManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ std::tuple<std::string, std::string, bool> AssetManager::GetFileStatus(std::stri

if(extension == FILE_EXTENSION_COMPRESSED_AMALGAM_CODE)
{
std::ifstream f(path, std::fstream::binary | std::fstream::in);
std::ifstream f(resource_path, std::fstream::binary | std::fstream::in);

if(!f.good())
return std::make_tuple("Cannot open file", "", false);
Expand All @@ -172,12 +172,12 @@ std::tuple<std::string, std::string, bool> AssetManager::GetFileStatus(std::stri
if(!success)
return std::make_tuple(error_message, version, false);

return std::make_tuple("", version, false);
return std::make_tuple("", version, true);
}
else if(extension == FILE_EXTENSION_AMALGAM)
{
//make sure path can be opened
std::ifstream file(path, std::fstream::binary | std::fstream::in);
std::ifstream file(resource_path, std::fstream::binary | std::fstream::in);
if(!file.good())
return std::make_tuple("Cannot open file", "", false);

Expand Down Expand Up @@ -209,7 +209,7 @@ std::tuple<std::string, std::string, bool> AssetManager::GetFileStatus(std::stri
}
else
{
std::ifstream f(path, std::fstream::binary | std::fstream::in);
std::ifstream f(resource_path, std::fstream::binary | std::fstream::in);
if(!f.good())
return std::make_tuple("Cannot open file", "", false);

Expand Down
2 changes: 1 addition & 1 deletion src/Amalgam/entity/EntityExternalInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ EntityExternalInterface::LoadEntityStatus EntityExternalInterface::VerifyEntity(
if(!success)
return EntityExternalInterface::LoadEntityStatus(false, error_string, version);

return EntityExternalInterface::LoadEntityStatus(false, "", version);
return EntityExternalInterface::LoadEntityStatus(true, "", version);
}

bool EntityExternalInterface::CloneEntity(std::string &handle, std::string &cloned_handle, std::string &path,
Expand Down

0 comments on commit 645471b

Please sign in to comment.