Hi everyone ,
it's finally the release day!
this is my first homebrew so please be indulgent .
it's still need some minor adjustement but work complety fine .
i use a tricky way to generate a random number.(i will explain later).
i will give my code for the next update with lots of comment , that way beginner can easely understand it and i hope make there own to grow the community.
i post the 550 and 532 in the zip , but i don't have a 532 system to verify if this work.
Comments and Critics are welcome.
Ryuutseku85
it's finally the release day!
this is my first homebrew so please be indulgent .
it's still need some minor adjustement but work complety fine .
i use a tricky way to generate a random number.(i will explain later).
i will give my code for the next update with lots of comment , that way beginner can easely understand it and i hope make there own to grow the community.
i post the 550 and 532 in the zip , but i don't have a 532 system to verify if this work.
Comments and Critics are welcome.
Ryuutseku85
The game will be simple :
find the mysterious number , the wiiu will search for a mysterious number , it will ask you what is it , and it will answer , "more" , "less" or "congratulations !!! you win ".
all of you now this game , right ?
so lets begin ,
i have this code
loader.c
controller (for later with more choice)
and loader.h
the problem is that actually nothing work , i don't know how to wrote something on the screen , and do how to make the player answer . i find i will do an void exit for the end too .
thanks for your help.
find the mysterious number , the wiiu will search for a mysterious number , it will ask you what is it , and it will answer , "more" , "less" or "congratulations !!! you win ".
all of you now this game , right ?
so lets begin ,
i have this code
loader.c
Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "loader.h"
#include "control.h"
void START ()
{
asm(
"lis %r1, 0x1ab5 ;"
"ori %r1, %r1, 0xd138 ;"
);
uint32_t coreinit_handle;
OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle);
void(*OSScreenInit)();
unsigned int(*OSScreenGetBufferSizeEx)(unsigned int bufferNum);
unsigned int(*OSScreenSetBufferEx)(unsigned int bufferNum, void * addr);
void*(*memset)(void * dest, uint32_t value, uint32_t bytes);
void(*OSFreeToSystem)(void *ptr);
void* (*OSAllocFromSystem)(uint32_t size, int align);
OSDynLoad_FindExport(coreinit_handle, 0, "OSAllocFromSystem", &OSAllocFromSystem);
int(*IM_Open)();
int(*IM_Close)(int fd);
int(*IM_SetDeviceState)(int fd, void *mem, int state, int a, int b);
/****************************> Exports <****************************/
OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenInit", &OSScreenInit);
OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenGetBufferSizeEx", &OSScreenGetBufferSizeEx);
OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenSetBufferEx", &OSScreenSetBufferEx);
OSDynLoad_FindExport(coreinit_handle, 0, "memset", &memset);
OSDynLoad_FindExport(coreinit_handle, 0, "OSAllocFromSystem", &OSAllocFromSystem);
OSDynLoad_FindExport(coreinit_handle, 0, "OSFreeToSystem", &OSFreeToSystem);
OSDynLoad_FindExport(coreinit_handle, 0, "IM_Open", &IM_Open);
OSDynLoad_FindExport(coreinit_handle, 0, "IM_Close", &IM_Close);
OSDynLoad_FindExport(coreinit_handle, 0, "IM_SetDeviceState", &IM_SetDeviceState);
int fd = IM_Open();
void *mem = OSAllocFromSystem(0x100, 64);
memset(mem, 0, 0x100);
IM_SetDeviceState(fd, mem, 3, 0, 0);
IM_Close(fd);
OSFreeToSystem(mem);
unsigned int t1 = 0x1FFFFFFF;
while(t1--) ;
OSScreenInit();
int buf0_size = OSScreenGetBufferSizeEx(0);
int buf1_size = OSScreenGetBufferSizeEx(1);
OSScreenSetBufferEx(0, (void *)0xF4000000);
OSScreenSetBufferEx(1, (void *)0xF4000000 + buf0_size);
int ii = 0;
for (ii; ii < 2; ii++)
{
fillScreen(0,0,0,0);
flipBuffers();
}
_getIN();
}
void _getIN()
{
uint32_t coreinit_handle;
OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle);
unsigned int vpad_handle;
OSDynLoad_Acquire("vpad.rpl", &vpad_handle);
int(*VPADRead)(int controller, VPADData *buffer, unsigned int num, int *error);
void(*_Exit)();
OSDynLoad_FindExport(vpad_handle, 0, "VPADRead", &VPADRead);
OSDynLoad_FindExport(coreinit_handle, 0, "_Exit", &_Exit);
VPADData vpad_data;
int error;
VPADRead(0, &vpad_data, 1, &error);
printf(" MysteriU \n");
int compteur = 0;
int nombreentre = 0;
int nombremystere = 0;
const int min = 1 ;
const int max = 10;
srand(time(NULL));
nombremystere = (rand()% (max -min +1)+ min);
printf("what is the mysterious number\n\n");
compteur++ ;
scanf("%d" , &nombreentre);
if(nombreentre < nombremystere)
printf("it's more \n\n") ;
if(nombreentre > nombremystere)
printf("it's less \n\n") ;
if (nombreentre==nombremystere)
printf("congrats ! you win!!!\n\n", compteur);
printf("\n\n\n");
return 0;
}
Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "loader.h"
#include "control.h"
void START ()
{
asm(
"lis %r1, 0x1ab5 ;"
"ori %r1, %r1, 0xd138 ;"
);
uint32_t coreinit_handle;
OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle);
void(*OSScreenInit)();
unsigned int(*OSScreenGetBufferSizeEx)(unsigned int bufferNum);
unsigned int(*OSScreenSetBufferEx)(unsigned int bufferNum, void * addr);
void*(*memset)(void * dest, uint32_t value, uint32_t bytes);
void(*OSFreeToSystem)(void *ptr);
void* (*OSAllocFromSystem)(uint32_t size, int align);
OSDynLoad_FindExport(coreinit_handle, 0, "OSAllocFromSystem", &OSAllocFromSystem);
int(*IM_Open)();
int(*IM_Close)(int fd);
int(*IM_SetDeviceState)(int fd, void *mem, int state, int a, int b);
/****************************> Exports <****************************/
OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenInit", &OSScreenInit);
OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenGetBufferSizeEx", &OSScreenGetBufferSizeEx);
OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenSetBufferEx", &OSScreenSetBufferEx);
OSDynLoad_FindExport(coreinit_handle, 0, "memset", &memset);
OSDynLoad_FindExport(coreinit_handle, 0, "OSAllocFromSystem", &OSAllocFromSystem);
OSDynLoad_FindExport(coreinit_handle, 0, "OSFreeToSystem", &OSFreeToSystem);
OSDynLoad_FindExport(coreinit_handle, 0, "IM_Open", &IM_Open);
OSDynLoad_FindExport(coreinit_handle, 0, "IM_Close", &IM_Close);
OSDynLoad_FindExport(coreinit_handle, 0, "IM_SetDeviceState", &IM_SetDeviceState);
int fd = IM_Open();
void *mem = OSAllocFromSystem(0x100, 64);
memset(mem, 0, 0x100);
IM_SetDeviceState(fd, mem, 3, 0, 0);
IM_Close(fd);
OSFreeToSystem(mem);
unsigned int t1 = 0x1FFFFFFF;
while(t1--) ;
OSScreenInit();
int buf0_size = OSScreenGetBufferSizeEx(0);
int buf1_size = OSScreenGetBufferSizeEx(1);
OSScreenSetBufferEx(0, (void *)0xF4000000);
OSScreenSetBufferEx(1, (void *)0xF4000000 + buf0_size);
int ii = 0;
for (ii; ii < 2; ii++)
{
fillScreen(0,0,0,0);
flipBuffers();
}
_getIN();
}
void _getIN()
{
uint32_t coreinit_handle;
OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle);
unsigned int vpad_handle;
OSDynLoad_Acquire("vpad.rpl", &vpad_handle);
int(*VPADRead)(int controller, VPADData *buffer, unsigned int num, int *error);
void(*_Exit)();
OSDynLoad_FindExport(vpad_handle, 0, "VPADRead", &VPADRead);
OSDynLoad_FindExport(coreinit_handle, 0, "_Exit", &_Exit);
VPADData vpad_data;
int error;
VPADRead(0, &vpad_data, 1, &error);
printf(" MYSTERIU \n");
int compteur = 0;
int nombreentre = 0;
int nombremystere = 0;
const int min = 1 ;
const int max = 10;
srand(time(NULL));
nombremystere = (rand()% (max -min +1)+ min);
printf("quel est le nombre secret?\n\n");
compteur++ ;
scanf("%d" , &nombreentre);
if(nombreentre < nombremystere)
printf("c'est plus\n\n") ;
if(nombreentre > nombremystere)
printf("c'est moins\n\n") ;
if (nombreentre==nombremystere)
printf("bravo ! tu as trouve le nombre secret en %d fois\n\n", compteur);
printf("\n\n\n");
return 0;
}
controller (for later with more choice)
Code:
#define BUTTON_A 0x8000
#define BUTTON_B 0x4000
#define BUTTON_X 0x2000
#define BUTTON_Y 0x1000
#define BUTTON_LEFT 0x0800
#define BUTTON_RIGHT 0x0400
#define BUTTON_UP 0x0200
#define BUTTON_DOWN 0x0100
#define BUTTON_ZL 0x0080
#define BUTTON_ZR 0x0040
#define BUTTON_L 0x0020
#define BUTTON_R 0x0010
#define BUTTON_PLUS 0x0008
#define BUTTON_MINUS 0x0004
#define BUTTON_HOME 0x0002
#define BUTTON_SYNC 0x0001
#define BUTTON_STICK_R 0x00020000
#define BUTTON_STICK_L 0x00040000
#define BUTTON_TV 0x00010000
and loader.h
Code:
#include "../../../../../../../devkitPro/libwiiu/src/coreinit.h"
#include "../../../../../../../devkitPro/libwiiu/src/vpad.h"
#include "../../../../../../../devkitPro/libwiiu/src/draw.h"
#include "../../../../../../../devkitPro/libwiiu/src/string.h"
void _getIN();
the problem is that actually nothing work , i don't know how to wrote something on the screen , and do how to make the player answer . i find i will do an void exit for the end too .
thanks for your help.
Attachments
Last edited by ryuutseku85,