Subversion Repositories freemyipod

Rev

Rev 489 | Rev 534 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 489 Rev 529
Line 1... Line 1...
1
#include "emcoreapp.h"
1
#include "emcoreapp.h"
2
#include "libui.h"
-
 
3
 
2
 
4
 
3
 
5
void main();
-
 
6
EMCORE_APP_HEADER("Hello world", main, 127)
-
 
7
 
-
 
8
 
-
 
9
void main()
4
static void main()
10
{
5
{
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);
6
    cputc(3, "Hello, world!\n");
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);
-
 
41
}
7
}
-
 
8
 
-
 
9
 
-
 
10
EMCORE_APP_HEADER("Hello world", main, 127)