Release 0.9.1-3 with RetroBrowser, PPC audio, XP diagnostics and LP64 repair
This commit is contained in:
8
clients/retro-browser/common/test.c
Normal file
8
clients/retro-browser/common/test.c
Normal file
@@ -0,0 +1,8 @@
|
||||
#include "rbp.h"
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
struct mem{rb_u8 b[128];unsigned r,w;};
|
||||
static int wr(void*c,const void*p,unsigned n){struct mem*m=c;if(n>3)n=3;memcpy(m->b+m->w,p,n);m->w+=n;return n;}
|
||||
static int rd(void*c,void*p,unsigned n){struct mem*m=c;if(n>2)n=2;if(n>m->w-m->r)n=m->w-m->r;memcpy(p,m->b+m->r,n);m->r+=n;return n;}
|
||||
int main(void){struct mem m={{0},0,0};rb_io io;rb_header h;rb_u8 b[6];rb_u16 pixels[3];short audio[4];const rb_u8 rle[]={0,2,0xf8,0,0,1,7,0xe0};const rb_u8 pcm[]={0,0,0x56,0x22,1,1,0,2,0x80,0,0x7f,0xff};const rb_u8 adpcm[]={0,0,0x56,0x22,1,2,0,4,0,0,0,0,0,0}; io.ctx=&m;io.read=rd;io.write=wr;assert(!rb_hello(&io,320,240,6,1));assert(!rb_header_read(&io,&h));assert(h.type==RB_HELLO&&h.length==6);assert(!rb_read(&io,b,6));assert(rb_get16(b)==320&&rb_get16(b+2)==240&&b[4]==6);assert(!rb_rgb565(rle,sizeof rle,pixels,3,1));assert(pixels[0]==0xf800&&pixels[2]==0x07e0);assert(rb_rgb565(rle,sizeof rle,pixels,2,1)==-1);assert(rb_audio(pcm,sizeof pcm,audio,4)==2&&audio[0]==-32768&&audio[1]==32767);assert(rb_audio(adpcm,sizeof adpcm,audio,4)==4&&audio[3]==0);puts("PASS C89 wire fragmentation, endian, RLE bounds, PCM, IMA ADPCM");return 0;}
|
||||
Reference in New Issue
Block a user