Subversion Repositories freemyipod

Rev

Rev 454 | Rev 529 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
454 theseven 1
#include "emcoreapp.h"
489 theseven 2
#include "libui.h"
99 theseven 3
 
4
 
5
void main();
454 theseven 6
EMCORE_APP_HEADER("Hello world", main, 127)
99 theseven 7
 
8
 
9
void main()
10
{
489 theseven 11
    struct emcorelib_header* libui = get_library(0x49554365, LIBUI_API_VERSION, LIBSOURCE_FILESYSTEM, "/ui.emcorelib");
12
    if (!libui) panicf(PANIC_KILLTHREAD, "Could not load UI library!");
13
    struct libui_api* ui = (struct libui_api*)libui->api;
14
    void* srcbuf = memalign(0x10, 92160);
15
    int fd = file_open("/test.lcd", O_RDONLY);
16
    read(fd, srcbuf, 92160);
17
    close(fd);
18
    displaylcd(194, 319, 0, 239, srcbuf, 0);
19
    fd = file_open("/test.raw", O_RDONLY);
20
    read(fd, srcbuf, 92160);
21
    close(fd);
22
    void* framebuf = malloc(61440);
23
    int count = 30720;
24
    char* in = (char*)srcbuf;
25
    short* out = (short*)framebuf;
26
    while (count--)
27
    {
28
        int b = *in++ >> 3;
29
        int g = *in++ >> 2;
30
        int r = *in++ >> 3;
31
        *out++ = (r << 11) | (g << 5) | b;
32
    }
33
    displaylcd(0, 127, 0, 239, framebuf, 0);
34
    ui->dither(128, 240, srcbuf, 0, 0, 128, framebuf, 0, 0, 128);
35
    free(srcbuf);
36
    displaylcd(128, 255, 0, 239, framebuf, 0);
37
    displaylcd_sync();
38
    free(framebuf);
39
    release_library(libui);
40
    library_unload(libui);
99 theseven 41
}