Hello alekmaul!
This is the remainder of the code snippet I got from the SDK, this is not all that interesting, but here it is for completeness's sake:
Code:
extern int MP4_fd;
extern int MP4_buf;
u32 get_buf_from_bufnum(int num)
{
ÂÂÂÂreturn (pmain_buf->buf_st_list[num].offset + MP4_buf);
}
int check_video_up_buf(void)
{
ÂÂÂÂint i = 0;
ÂÂÂÂif (pmain_buf->buf_st_list[buf_video_up_0].isused != 0) i += 1;
ÂÂÂÂif (pmain_buf->buf_st_list[buf_video_up_1].isused != 0) i += 1;
ÂÂÂÂreturn i;
}
int get_video_up_buf(void)
{
ÂÂÂÂint ret = -1;
ÂÂÂÂif (pmain_buf->buf_st_list[buf_video_up_0].isused == 0)
ÂÂÂÂ{
ÂÂÂÂÂÂÂÂret= buf_video_up_0;
ÂÂÂÂ}
ÂÂÂÂif (pmain_buf->buf_st_list[buf_video_up_1].isused == 0)
ÂÂÂÂ{
ÂÂÂÂÂÂÂÂret= buf_video_up_1;
ÂÂÂÂ}
ÂÂÂÂreturn ret;
}
int check_video_down_buf(void)
{
ÂÂÂÂint i= 0;
ÂÂÂÂif (pmain_buf->buf_st_list[buf_video_down_0].isused != 0) i += 1;
ÂÂÂÂif (pmain_buf->buf_st_list[buf_video_down_1].isused != 0) i += 1;
ÂÂÂÂreturn i;
}
int get_video_down_buf(void)
{
ÂÂÂÂif (pmain_buf->buf_st_list[buf_video_down_0].isused == 0)
ÂÂÂÂ{
ÂÂÂÂÂÂÂÂreturn buf_video_down_0;
ÂÂÂÂ}
ÂÂÂÂif (pmain_buf->buf_st_list[buf_video_down_1].isused == 0)
ÂÂÂÂ{
ÂÂÂÂÂÂÂÂreturn buf_video_down_1;
ÂÂÂÂ}
ÂÂÂÂreturn -1;
}
As for the GCC options, here's what I use for DS2x86:
CODECFLAGS := -mips32 -O3 -mno-abicalls -fno-pic -fno-builtin \
ÂÂÂÂÂÂ -fno-exceptions -ffunction-sections -mlong-calls\
ÂÂÂÂÂÂ -fomit-frame-pointer -msoft-float -G 4
.c.o:
ÂÂÂÂ$(CC) $(CFLAGS) $(INC) -MD -o $@ -c $<
ÂÂÂÂ@cp $*.d $*.P; \
ÂÂÂÂsed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
ÂÂÂÂÂÂÂÂÂÂ-e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $*.P; \
ÂÂÂÂrm -f $*.d
.cpp.o:
ÂÂÂÂ$(CC) $(CFLAGS) $(INC) -MD -fno-rtti -o $@ -c $<
ÂÂÂÂ@cp $*.d $*.P; \
ÂÂÂÂsed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
ÂÂÂÂÂÂÂÂÂÂ-e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $*.P; \
ÂÂÂÂrm -f $*.d
I don't have any object-oriented features in my cpp modules (as in no classes), I use them just for some of the nice cpp features like being able to declare variables on the fly. I mostly code in ASM, so the C and cpp modules are there just as an interface to the SDK.
I can post my whole Makefile if you think it will be useful, though I have to admit I am no Makefile guru, so much of the stuff in my Makefile I have only a vague idea of what it does.
Pate