support for new SEQ format and idle animations

This commit is contained in:
Ondřej Novák 2025-07-10 15:07:54 +02:00
parent 3463d8e720
commit 2ce5f77825
9 changed files with 284 additions and 93 deletions

View file

@ -9,6 +9,7 @@
#include "swaper.c"
#include <fcntl.h>
#include <string.h>
#include <assert.h>
#include <sys/stat.h>
@ -65,24 +66,26 @@ void (*swap_error)()=standard_swap_error;
void *getmem(int32_t size)
{
void *p,*res;
void *p;
if (!size) return NULL;
do
{
res=malloc(NON_GETMEM_RESERVED);
if (res!=NULL)
{
p=(void *)malloc(size);
free(res);
}
else p=NULL;
if (p==NULL) mem_error(size);
}
while (p==NULL);
// SEND_LOG("(ALLOC) **** Alloc: %p size %d",p,*((int32_t *)p-1));
#ifndef NDEBUG
p = malloc(size+4);
memset(p, 0xCD, size);
memset((char *)p+size,0xEE,4);
return p;
}
#else
return malloc(size);
#endif
}
#ifndef NDEBUG
void CHECK_MEMORY(const void *ptr, size_t sz) {
uint8_t *p = (uint8_t *)ptr + sz;
for (int i = 0; i < 4; i++) {
assert(p[i] == 0xEE);
}
}
#endif
void *load_file(const char *filename, size_t *sz)

View file

@ -53,6 +53,7 @@ typedef struct thandle_data
unsigned short lockcount;
uint32_t counter;
uint32_t size;
void *context;
}THANDLE_DATA;
#define BK_MAJOR_HANDLES 256 // maximalni pocet skupin rukojeti
@ -105,6 +106,13 @@ int32_t get_handle_size(int handle);
//void get_mem_info(MEMORYSTATUS *mem);
void ablock_free(const void *ptr);
#ifdef NDEBUG
inline void CHECK_MEMORY(const void *x,size_t sz) {}
#else
void CHECK_MEMORY(const void *ptr, size_t sz);
#endif
//access file using memory mapping feature
const void *afile_mapped(const char *filename,int group,int32_t *blocksize);
//free file memory opened by afile_mapped