Merge branch 'dev' of gitea.planet-casio.com:Lephenixnoir/gint into dev
This commit is contained in:
commit
f51752eef3
1
TODO
1
TODO
|
@ -17,6 +17,7 @@ Extensions on existing code:
|
|||
* core: run destructors when a task-switch results in leaving the app
|
||||
* fs: support read-only files backed with GetBlockAddress() on fx-CG
|
||||
* kernel: SH4- or G-III-specific linker scripts?
|
||||
* render: Properly document bopti fx. Also make it faster maybe?
|
||||
|
||||
Future directions:
|
||||
* Audio playback using TSWilliamson's libsnd method
|
||||
|
|
|
@ -83,10 +83,29 @@ typedef struct
|
|||
uint height :12;
|
||||
|
||||
/* Raw layer data */
|
||||
uint8_t data[];
|
||||
uint8_t *data;
|
||||
|
||||
} GPACKED(4) bopti_image_t;
|
||||
|
||||
/* Image formats ("profiles") */
|
||||
enum {
|
||||
/* MONO: black/white, 1 layer (bw) */
|
||||
IMAGE_MONO = 0,
|
||||
/* MONO_ALPHA: black/white/transparent, 2 layers (alpha+bw) */
|
||||
IMAGE_MONO_ALPHA = 1,
|
||||
/* GRAY: black/dark/light/white, 2 layers (light+dark) */
|
||||
IMAGE_GRAY = 2,
|
||||
/* GRAY_ALPHA: black/dark/light/white/transparent, 3 layres
|
||||
(alpha+light+dark) */
|
||||
IMAGE_GRAY_ALPHA = 3,
|
||||
};
|
||||
|
||||
/* Number of layers in the image. */
|
||||
GINLINE static int image_layer_count(int profile)
|
||||
{
|
||||
return profile + (profile <= 1);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -108,6 +108,11 @@ void kmalloc_init_arena(kmalloc_arena_t *a, bool enable_statistics);
|
|||
success, false if the maximum number of arenas has been reached. */
|
||||
bool kmalloc_add_arena(kmalloc_arena_t *arena);
|
||||
|
||||
/* kmalloc_remove_arena(): Remove an arena from the heap source
|
||||
Removes an arena from the heap source. The arena should certainly be empty,
|
||||
although this function will not check that. */
|
||||
void kmalloc_remove_arena(kmalloc_arena_t *arena);
|
||||
|
||||
//---
|
||||
// Internal functions
|
||||
//---
|
||||
|
|
|
@ -93,6 +93,8 @@ void *fugue_dir_explore(char const *path)
|
|||
struct BFile_FileInfo info;
|
||||
char *wildcard=NULL;
|
||||
uint16_t *fc_path=NULL, *search=NULL;
|
||||
/* We allocate by batches of 8 */
|
||||
int sd=-1, rc, allocated=0;
|
||||
|
||||
dir_t *dp = malloc(sizeof *dp);
|
||||
if(!dp) goto alloc_failure;
|
||||
|
@ -100,8 +102,6 @@ void *fugue_dir_explore(char const *path)
|
|||
dp->count = 0;
|
||||
dp->entries = NULL;
|
||||
dp->pos = 0;
|
||||
/* We allocate by batches of 8 */
|
||||
int sd=-1, rc, allocated=0;
|
||||
|
||||
fc_path = malloc(512 * sizeof *fc_path);
|
||||
if(!fc_path) goto alloc_failure;
|
||||
|
@ -118,7 +118,7 @@ void *fugue_dir_explore(char const *path)
|
|||
if(rc < 0) {
|
||||
if(rc != BFile_EntryNotFound)
|
||||
errno = bfile_error_to_errno(rc);
|
||||
goto end;
|
||||
goto error;
|
||||
}
|
||||
|
||||
do {
|
||||
|
@ -148,7 +148,9 @@ void *fugue_dir_explore(char const *path)
|
|||
|
||||
alloc_failure:
|
||||
errno = ENOMEM;
|
||||
error:
|
||||
fugue_dir_close(dp);
|
||||
dp = NULL;
|
||||
end:
|
||||
free(wildcard);
|
||||
free(search);
|
||||
|
|
|
@ -63,6 +63,10 @@ int fugue_open(char const *path, int flags, GUNUSED mode_t mode)
|
|||
/* If the entry is a directory, open it as such */
|
||||
if(type == BFile_Type_Directory) {
|
||||
void *dp = fugue_dir_explore(path);
|
||||
if(!dp) {
|
||||
rc = -1;
|
||||
goto end;
|
||||
}
|
||||
fs_descriptor_t data = {
|
||||
.type = &fugue_dir_descriptor_type,
|
||||
.data = dp,
|
||||
|
|
|
@ -43,17 +43,17 @@
|
|||
link, then one block_t pointer to the next link with LSB=1
|
||||
* For a larger block, the footer has a 4-byte block size, then a pointer to
|
||||
the previous link, and a pointer to the next link with LSB=0. */
|
||||
typedef struct {
|
||||
uint :5;
|
||||
typedef volatile struct {
|
||||
uint32_t :5;
|
||||
/* Marks the last block of the sequence */
|
||||
uint last: 1;
|
||||
uint32_t last: 1;
|
||||
/* Whether the block is used; in general this can be kept implicit, but
|
||||
it has to be specified for the last block */
|
||||
uint used: 1;
|
||||
uint32_t used: 1;
|
||||
/* Boundary tag, vital to implement way #2 to merge adjacent blocks */
|
||||
uint previous_used: 1;
|
||||
uint32_t previous_used: 1;
|
||||
/* Block size in bytes. */
|
||||
uint size: 24;
|
||||
uint32_t size: 24;
|
||||
} block_t;
|
||||
|
||||
typedef kmalloc_gint_stats_t stats_t;
|
||||
|
@ -435,7 +435,10 @@ void kmalloc_init_arena(kmalloc_arena_t *a, bool enable_statistics)
|
|||
index->stats = (void *)a->start + sizeof(index_t);
|
||||
entry_block = (void *)index->stats + sizeof(stats_t);
|
||||
|
||||
memset(index->stats, 0, sizeof(stats_t));
|
||||
/* Manual 4-byte memset to allow PRAM0 arena */
|
||||
for(uint i = 0; i < sizeof(stats_t) / 4; i++)
|
||||
((uint32_t *)index->stats)[i] = 0;
|
||||
_Static_assert((sizeof(stats_t) & 3) == 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -184,3 +184,12 @@ bool kmalloc_add_arena(kmalloc_arena_t *arena)
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void kmalloc_remove_arena(kmalloc_arena_t *arena)
|
||||
{
|
||||
for(int i = 0; i < KMALLOC_ARENA_MAX; i++)
|
||||
{
|
||||
if(arenas[i] == arena)
|
||||
arenas[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -164,8 +164,7 @@ void bopti_render(bopti_image_t const *img, struct rbox *rbox, uint32_t *v1,
|
|||
masks(rbox->visual_x, rbox->visual_x + rbox->width - 1, vm);
|
||||
|
||||
/* Number of layers per profile */
|
||||
static const int layer_count[] = { 1, 2, 2, 3 };
|
||||
int layers = layer_count[img->profile];
|
||||
int layers = image_layer_count(img->profile);
|
||||
|
||||
/* For each pair of consecutive VRAM elements involved, create a mask
|
||||
from the intersection of the standard vram mask with the shift-mask
|
||||
|
@ -222,7 +221,7 @@ void bopti_render_scsp(bopti_image_t const *img, struct rbox *rbox,
|
|||
(0xffffffff << (32 - rbox->width)) >> (rbox->visual_x & 31);
|
||||
|
||||
/* Number of layers */
|
||||
int layers = img->profile - (img->profile >> 1) + 1;
|
||||
int layers = image_layer_count(img->profile);
|
||||
|
||||
/* Number of longwords to skip between rows of [img] */
|
||||
int img_stride = ((img->width + 31) >> 5) * layers;
|
||||
|
|
Loading…
Reference in New Issue