projects
/
vg.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d901e52
)
BAD one
author
hgn
<hgodden00@gmail.com>
Tue, 20 Jun 2023 23:24:18 +0000
(
00:24
+0100)
committer
hgn
<hgodden00@gmail.com>
Tue, 20 Jun 2023 23:24:18 +0000
(
00:24
+0100)
vg_loader.h
patch
|
blob
|
history
vg_msg.h
patch
|
blob
|
history
diff --git
a/vg_loader.h
b/vg_loader.h
index a776322b8b1ab18b60dcae8113cea53dc382a058..37b7b9ff4924f90b3c94f6f6620a039993e90fc2 100644
(file)
--- a/
vg_loader.h
+++ b/
vg_loader.h
@@
-10,7
+10,9
@@
#ifndef VG_LOADER_H
#define VG_LOADER_H
#ifndef VG_LOADER_H
#define VG_LOADER_H
-#include "common.h"
+#define VG_GAME
+#include "vg/vg.h"
+#include "vg/vg_shader.h"
VG_STATIC void vg_loader_start( void(*pfn)(void *data), void *data );
VG_STATIC void vg_loader_step( void( *fn_load )(void), void( *fn_free )(void) );
VG_STATIC void vg_loader_start( void(*pfn)(void *data), void *data );
VG_STATIC void vg_loader_step( void( *fn_load )(void), void( *fn_free )(void) );
@@
-204,6
+206,10
@@
VG_STATIC int _vg_loader_thread( void *pfn )
return 0;
}
return 0;
}
+static int vg_loader_availible(void){
+ return SDL_SemValue( vg.sem_loader );
+}
+
VG_STATIC void vg_loader_start( void(*pfn)(void *data), void *data )
{
SDL_SemWait( vg.sem_loader );
VG_STATIC void vg_loader_start( void(*pfn)(void *data), void *data )
{
SDL_SemWait( vg.sem_loader );
diff --git
a/vg_msg.h
b/vg_msg.h
index ae7cf8a185d605287280290554ebaeba613c8130..28ae5c8c52e0f6ad0233851017c6cd758eb21484 100644
(file)
--- a/
vg_msg.h
+++ b/
vg_msg.h
@@
-118,7
+118,7
@@
enum vg_msg_code{
k_vg_msg_8b = 0x00,
k_vg_msg_16b = 0x01,
k_vg_msg_32b = 0x02,
k_vg_msg_8b = 0x00,
k_vg_msg_16b = 0x01,
k_vg_msg_32b = 0x02,
- k_vg_msg_64b = 0x0
4
,
+ k_vg_msg_64b = 0x0
3
,
};
typedef struct vg_msg vg_msg;
};
typedef struct vg_msg vg_msg;
@@
-264,7
+264,7
@@
static void vg_msg_wkvbin( vg_msg *msg, const char *key, u8 *bin, u32 len ){
/* get the byte count of a sized code */
static u32 vg_msg_sized_bytecount( u8 code ){
u32 size = 0x1 << (code & k_vg_msg_size_bits),
/* get the byte count of a sized code */
static u32 vg_msg_sized_bytecount( u8 code ){
u32 size = 0x1 << (code & k_vg_msg_size_bits),
- count = (
code & k_vg_msg_array_count_bits
) + 1;
+ count = (
(code & k_vg_msg_array_count_bits)>>2
) + 1;
return size * count;
}
return size * count;
}
@@
-456,6
+456,18
@@
static u64 vg_msg_read_as_u64( vg_msg_cmd *cmd ){
return result;
}
return result;
}
+static void
+vg_msg_convert_num( vg_msg_cmd *cmd, u8 type, u32 count, void *result ){
+ u8 code = type | ((count-1)<<2);
+ if( code != cmd->code ) return;
+
+ const u8 *src = cmd->value;
+ u8 *dst = result;
+
+ u32 bytes = vg_msg_sized_bytecount( cmd->code );
+ for( u32 i=0; i<bytes; i ++ ) dst[i] = src[i];
+}
+
static u32 vg_msg_seekkvu32( vg_msg *msg, const char *key, enum vg_msg_dir dir )
{
vg_msg_cmd cmd = vg_msg_seekkv( msg, key, dir );
static u32 vg_msg_seekkvu32( vg_msg *msg, const char *key, enum vg_msg_dir dir )
{
vg_msg_cmd cmd = vg_msg_seekkv( msg, key, dir );