Wait i might this completely wrong. Can i just make a .elf which contain a simple "Hello World" written in C?
CODE#include
int main(void)
{
ÂÂÂÂprintf("hello, world\n");
ÂÂÂÂreturn 0;
}
maybe i need to have a special code or something to make it work on the twilight hack.
Uh, yeah, this isn't like programming for the PC. Check the /c/devkitPro/examples/wii/template (There's a makefile too, so you can compile it by navigating to that folder and typing "make"
Hello, World! for the Wiilooks like this:
CODE#include
#include
#include
#include
#include
#include
static void *xfb = NULL;
static GXRModeObj *rmode = NULL;
int main(int argc, char **argv) {
ÂÂÂÂVIDEO_Init();
ÂÂÂÂPAD_Init();
ÂÂÂÂ
ÂÂÂÂswitch(VIDEO_GetCurrentTvMode()) {
ÂÂÂÂÂÂÂÂcase VI_NTSC:
ÂÂÂÂÂÂÂÂÂÂÂÂrmode = &TVNtsc480IntDf;
ÂÂÂÂÂÂÂÂÂÂÂÂbreak;
ÂÂÂÂÂÂÂÂcase VI_PAL:
ÂÂÂÂÂÂÂÂÂÂÂÂrmode = &TVPal528IntDf;
ÂÂÂÂÂÂÂÂÂÂÂÂbreak;
ÂÂÂÂÂÂÂÂcase VI_MPAL:
ÂÂÂÂÂÂÂÂÂÂÂÂrmode = &TVMpal480IntDf;
ÂÂÂÂÂÂÂÂÂÂÂÂbreak;
ÂÂÂÂÂÂÂÂdefault:
ÂÂÂÂÂÂÂÂÂÂÂÂrmode = &TVNtsc480IntDf;
ÂÂÂÂÂÂÂÂÂÂÂÂbreak;
ÂÂÂÂ}
ÂÂÂÂxfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
ÂÂÂÂconsole_init(xfb,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
ÂÂÂÂ
ÂÂÂÂVIDEO_Configure(rmode);
ÂÂÂÂVIDEO_SetNextFramebuffer(xfb);
ÂÂÂÂVIDEO_SetBlack(FALSE);
ÂÂÂÂVIDEO_Flush();
ÂÂÂÂVIDEO_WaitVSync();
ÂÂÂÂif(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
ÂÂÂÂprintf("Hello World!\n");
ÂÂÂÂwhile(1) {
ÂÂÂÂÂÂÂÂVIDEO_WaitVSync();
ÂÂÂÂ}
ÂÂÂÂreturn 0;
}