Changes

Jump to navigation Jump to search
942 bytes removed ,  11:07, 19 April 2008
no edit summary
I am currently coding ( attempting ;-) ) a package of seemingly random bits of code that may server a purpose, may not but, it is just to learn C and have some fun with my wii.
 
If someone can improve it put any improvements in the Updates section at the bottom ;-)
===Code dump : ===
#include "stm.c"
#include "es.h"
#include "es.c"
#include "ipc.h"
#include "gu.c"
 
#include "GRRLIB.h"
#include "../gfx/music.h"
typedef void (*Loader_Entry)(void);
static u32 *xjbxbb;
Loader_Entry loader = (Loader_Entry)0x80001800;
extern u16 *GRRLIB_buffer; void helloclearscreen(void)
{
printf int y; for("Hello world!\n"y=0;y<34;y++); printf("v 0.3 \n");
}
printf("Menu\n");
printf("----\n");
printf("Start + Z = Return to loader\n");
printf("A !! = Elf Loader\n");
printf("B !! = System Utils\n");
printf("Y ! = Fun\n");
printf("X !! = Reboot Shutdown Wii\n");
return;
}
 
void clearscreen(void)
{
int y;
for(y=0;y<34;y++)
printf(" \n");
}
loader();
}
}
 
void console(void) {
xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
xjb = 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();
}
}
return;
}
 
void hello(void)
{
printf("Hello world!\n");
printf("v 0.15");
}
void shutdown(void) {
__STM_Initstatic u8 stm_inbuf[0x20] ATTRIBUTE_ALIGN(32); static u8 stm_iobuf[0x20] ATTRIBUTE_ALIGN(32); int fd; fd=0; fd=IOS_Open("/dev/stm/immediate", 2); STM_RebootSystemIOS_Ioctl(fd, 0x2004, stm_inbuf, 0x20, stm_iobuf, 0x20); __STM_CloseIOS_Close(fd);
}
void fun(void) {
 
clearscreen();
__STM_Init();
printf("FUN\n");
printf("---\n\n");
int ver;
int revma;
int revmi;
int di_fd;
int es_fd;
int vec;
u32 wiiid;
static u8 stm_inbuf[0x20] ATTRIBUTE_ALIGN(32);
static u8 stm_iobuf[0x20] ATTRIBUTE_ALIGN(32);
ver=IOS_GetVersion();
revmi=IOS_GetRevisionMinor();
printf("IOS Version : %d Revision : %d.%d \n\n", ver, revma, revmi);
di_fd=IOS_Open("/dev/di",1);
((u32*)stm_inbuf)[0x00] = 0x70000000;
IOS_Ioctl( di_fd, stm_inbuf[0x00], stm_inbuf, 0x20, stm_iobuf, 0x20);
printf("DVD ID : %s \n\n",stm_iobuf);
IOS_Close(di_fd);
vec=0;
es_fd=IOS_Open("/dev/es",1);
vec = ES_GetDeviceID(&wiiid);
// printf("Console ID : %08x \n\n", wiiid);
IOS_Close(es_fd);
GRRLIB_DrawImg(10,50, music_width, music_high, music_img);
GRRLIB_Render();
printf("Press A to continue\n");
int buttonsDown = PAD_ButtonsHeld(0);
if (buttonsDown & PAD_BUTTON_A){
console();
clearscreen();
menutext();
__STM_Close();
return;
}
}
if (buttonsDown & PAD_BUTTON_X){
//shutdown();
}
if (buttonsDown & PAD_BUTTON_B){
****************************************************************************/
GRRLIB_buffer=(u16 *)malloc(640*240*2);
VIDEO_Init();
PAD_Init();
GRRLIB_InitVideo();
GRRLIB_Start();
GRRLIB_FillScreen(0x0000);
GRRLIB_Render();
switch(VIDEO_GetCurrentTvMode()) {
xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
xjb xbb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
console_init(xfb,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
hello();
printf("\n");
printf("My first native wii homebrew\n\n"); printf("Press Start :-)\n\n");
while(1) {
return 0;
}
</source>
 
== Updates ==
 
These may be updates/fixes for the code above
 
<source lang="c">
</source>
569

edits

Navigation menu