-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show real scriptfile name in asset view
- Loading branch information
Showing
3 changed files
with
70 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#include <std_include.hpp> | ||
#include "loader/component_loader.hpp" | ||
|
||
#include "game/game.hpp" | ||
#include "game/dvars.hpp" | ||
|
||
#include "component/scheduler.hpp" | ||
#include "component/command.hpp" | ||
#include "component/fastfiles.hpp" | ||
#include "component/gsc/script_loading.hpp" | ||
#include "../gui.hpp" | ||
#include "../asset_list.hpp" | ||
|
||
#include "utils/mapents.hpp" | ||
|
||
#include <utils/string.hpp> | ||
#include <utils/hook.hpp> | ||
#include <utils/concurrency.hpp> | ||
#include <utils/io.hpp> | ||
|
||
namespace gui::asset_list::scriptfile | ||
{ | ||
namespace | ||
{ | ||
std::string get_asset_display_name(const std::string& name) | ||
{ | ||
const auto id = static_cast<std::uint32_t>(std::atoi(name.data())); | ||
|
||
if (id == 0) | ||
{ | ||
return name; | ||
} | ||
|
||
return gsc::gsc_ctx->token_name(id); | ||
} | ||
} | ||
|
||
class component final : public component_interface | ||
{ | ||
public: | ||
void post_unpack() override | ||
{ | ||
gui::asset_list::add_asset_name_override_callback(game::ASSET_TYPE_SCRIPTFILE, get_asset_display_name); | ||
} | ||
}; | ||
} | ||
|
||
REGISTER_COMPONENT(gui::asset_list::scriptfile::component) |