Skip to content

Commit

Permalink
Fix for loading atlas attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
JCash committed Jan 11, 2024
1 parent 98788c0 commit 24e56ba
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion defold-spine/commonsrc/spine_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,12 @@ namespace dmSpine
static bool loadSequence(dmHashTable64<uint32_t>* name_to_index, spAtlasRegion* atlasRegions, const char *basePath, spSequence *sequence, spAtlasRegion* default_region) {
bool is_atlas_available = name_to_index != 0;

// The C runtime seems a bit broken,
// and doesn't account for number of digits required regions->size
// So, instead, we simply add some extra room for X digits
uint32_t region_digits = 8;
spTextureRegionArray *regions = sequence->regions;
char *path = (char*)MALLOC(char, strlen(basePath) + sequence->digits + 1);
char *path = (char*)MALLOC(char, strlen(basePath) + sequence->digits + region_digits + 1);
path[0] = 0;
int i;
for (i = 0; i < regions->size; i++) {
Expand Down

0 comments on commit 24e56ba

Please sign in to comment.