add dsp and optional game page
[vg.git] / vg_msg.h
index a41b24c1e914712617c6d6042085b08c99795fdb..b5fb4a482bf991ef4624b65ab93b89be33da51a6 100644 (file)
--- a/vg_msg.h
+++ b/vg_msg.h
@@ -262,10 +262,15 @@ static u32 vg_msg_cmd_bytecount( u8 code ){
    return vg_msg_cmd_array_count( code ) * vg_msg_cmd_type_size( code );
 }
 
+static u8 vg_msg_count_bits( u32 count ){
+   assert( (count <= 16) && count );
+   return ((count-1)<<2);
+}
+
 /* write a sized type */
 static void vg_msg_wkvnum( vg_msg *msg, const char *key,
                            u8 type, u8 count, void *data ){
-   u8 code = type | ((count-1)<<2);
+   u8 code = type | vg_msg_count_bits(count);
 
    vg_msg_wbuf( msg, &code, 1 );
    vg_msg_wstr( msg, key );
@@ -530,7 +535,7 @@ static int vg_msg_getkvcmd( vg_msg *msg, const char *key, vg_msg_cmd *cmd ){
          }
       }
    }
-
+   msg->error = k_vg_msg_error_OK;
    msg->cur = orig;
    return 0;
 }
@@ -634,7 +639,7 @@ static void vg_msg_print( vg_msg *msg, u32 len ){
 
             printf( "'%s': ", cmd.key );
 
-            if( count > 1 ) printf( "'{' " );
+            if( count > 1 ) printf( "{ " );
 
             for( u32 i=0; i<count; i++ ){
                const void *p = cmd.value + size*i;
@@ -663,7 +668,7 @@ static void vg_msg_print( vg_msg *msg, u32 len ){
                if( i+1<count ) printf(", ");
             }
 
-            if( count > 1 ) printf( "'}'" );
+            if( count > 1 ) printf( " }" );
             printf( "\n" );
          }
       }