Mercurial > pub > dyncall > dyncall
comparison test/common/platformInit.c @ 0:3e629dc19168
initial from svn dyncall-1745
author | Daniel Adler |
---|---|
date | Thu, 19 Mar 2015 22:24:28 +0100 |
parents | |
children | f5577f6bf97a |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:3e629dc19168 |
---|---|
1 /* | |
2 | |
3 Package: dyncall | |
4 Library: test | |
5 File: test/common/platformInit.c | |
6 Description: | |
7 License: | |
8 | |
9 Copyright (c) 2015 Daniel Adler <dadler@uni-goettingen.de>, | |
10 Tassilo Philipp <tphilipp@potion-studios.com> | |
11 | |
12 Permission to use, copy, modify, and distribute this software for any | |
13 purpose with or without fee is hereby granted, provided that the above | |
14 copyright notice and this permission notice appear in all copies. | |
15 | |
16 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
17 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
18 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
19 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
20 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
21 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
22 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
23 | |
24 */ | |
25 | |
26 | |
27 #include "platformInit.h" | |
28 | |
29 | |
30 #if defined(DC__OS_NDS) | |
31 | |
32 void dcTest_initPlatform() | |
33 { | |
34 powerOn(POWER_ALL); | |
35 | |
36 /* Interrupt handlers. */ | |
37 /*irqInit();*/ | |
38 /*irqSet(IRQ_VBLANK, OnIrq);*/ | |
39 | |
40 /* Use the touch screen for output. */ | |
41 videoSetMode(MODE_FB0); | |
42 vramSetBankA(VRAM_A_LCD); | |
43 videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE); | |
44 vramSetBankC(VRAM_C_SUB_BG); | |
45 REG_BG0CNT_SUB = BG_MAP_BASE(31); | |
46 | |
47 /* Set the colour of the font. */ | |
48 /* BG_PALETTE_SUB[255] = RGB15(25, 11, 9); */ | |
49 | |
50 /* consoleInitDefault((u16*)SCREEN_BASE_BLOCK_SUB(31), (u16*)CHAR_BASE_BLOCK_SUB(0), 16); */ | |
51 consoleDemoInit(); | |
52 } | |
53 | |
54 | |
55 void dcTest_deInitPlatform() | |
56 { | |
57 /* Main loop - console style. */ | |
58 while(1) { | |
59 swiWaitForVBlank(); | |
60 } | |
61 } | |
62 | |
63 | |
64 #elif defined(DC__OS_PSP) | |
65 | |
66 PSP_MODULE_INFO("dyncall_test",0,1,1); | |
67 | |
68 int exit_callback(int arg1, int arg2, void *common) | |
69 { | |
70 sceKernelExitGame(); | |
71 return 0; | |
72 } | |
73 | |
74 int CallbackThread(SceSize args, void *argp) | |
75 { | |
76 int cbid; | |
77 cbid = sceKernelCreateCallback("Exit Callback", &exit_callback, NULL); | |
78 sceKernelRegisterExitCallback(cbid); | |
79 sceKernelSleepThreadCB(); | |
80 return 0; | |
81 } | |
82 | |
83 void dcTest_initPlatform() | |
84 { | |
85 pspDebugScreenInit(); | |
86 pspDebugScreenClear(); | |
87 | |
88 int thid = 0; | |
89 thid = sceKernelCreateThread("update_thread", &CallbackThread, 0x11, 0xFA0, THREAD_ATTR_USER, 0); | |
90 if (thid >= 0) | |
91 sceKernelStartThread(thid, 0, 0); | |
92 | |
93 sceDisplayWaitVblankStart(); | |
94 pspDebugScreenSetXY(0, 0); | |
95 } | |
96 | |
97 void dcTest_deInitPlatform() | |
98 { | |
99 sceKernelSleepThread(); | |
100 sceKernelExitGame(); | |
101 } | |
102 | |
103 | |
104 #else /* All other platforms, usually just pulling in standard headers and empty init function. */ | |
105 | |
106 void dcTest_initPlatform() | |
107 { | |
108 } | |
109 | |
110 void dcTest_deInitPlatform() | |
111 { | |
112 } | |
113 | |
114 #endif | |
115 |