Skip to content

Commit

Permalink
add GetResourceIsCustom methods to resourcebridge.cpp (#174)
Browse files Browse the repository at this point in the history
Co-authored-by: briaguya <briaguya@alice>
  • Loading branch information
briaguya-ai and briaguya committed Apr 22, 2023
1 parent c81cd66 commit 159663c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/core/bridge/resourcebridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,20 @@ size_t GetResourceSizeByCrc(uint64_t crc, bool now) {
return GetResourceSizeByName(GetResourceNameByCrc(crc), now);
}

uint8_t GetResourceIsCustomByName(const char* name, bool now) {
auto resource = LoadResource(name, now);

if (resource == nullptr) {
return false;
}

return resource->InitData->IsCustom;
}

uint8_t GetResourceIsCustomByCrc(uint64_t crc, bool now) {
return GetResourceIsCustomByName(GetResourceNameByCrc(crc), now);
}

void* GetResourceDataByName(const char* name, bool now) {
auto resource = LoadResource(name, now);

Expand Down
2 changes: 2 additions & 0 deletions src/core/bridge/resourcebridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ uint64_t GetResourceCrcByName(const char* name);
const char* GetResourceNameByCrc(uint64_t crc);
size_t GetResourceSizeByName(const char* name, bool now);
size_t GetResourceSizeByCrc(uint64_t crc, bool now);
uint8_t GetResourceIsCustomByName(const char* name, bool now);
uint8_t GetResourceIsCustomByCrc(uint64_t crc, bool now);
void* GetResourceDataByName(const char* name, bool now);
void* GetResourceDataByCrc(uint64_t crc, bool now);
uint16_t GetResourceTexWidthByName(const char* name, bool now);
Expand Down

0 comments on commit 159663c

Please sign in to comment.