Homebrew Convert Python to C?

victormr21

Well-Known Member
OP
Member
Joined
Dec 29, 2015
Messages
565
Trophies
0
XP
498
Country
Hi!
I made a very simple homebrew, its a rock, paper, scissors version but its write in Python, and I think I saw that for make Wii U Homebrew the program needs to be in C
So its there a way to convert from Python to C or something similar?
Bye!
 

victormr21

Well-Known Member
OP
Member
Joined
Dec 29, 2015
Messages
565
Trophies
0
XP
498
Country
Honestly it'd be easier to write such a small program in C(++) directly.
Python's cool, but I think studying C or C++, even just a bit is a must.
There are some tools but I don't think this is the proper way to go.
i started with Python because its easier at my opinión that others languages, ex. in Python you put:
Code:
print ("Hello World")
and its done but in C its like (i think, im not very sure, its an example from the page you said above)
Code:
#include <iostream.h>

int main() {
   std::cout << "Hello World!\n";
   return 0;
}
A lot of lines for something that can be in one/two lines
Ill try to write it in C/C++, thanks for reply
Bye!
 
D

Deleted User

Guest
Code:
#include <iostream.h>

int main() {
   std::cout << "Hello World!\n";
   return 0;
}
This is C code for a PC. The Wii U is a bit different to this, unfortunately.

I have a basic demo on my GitHub page that shows rendering text to the screen, if it helps at all.

The way I would go with this is learn a little bit of C first (here's a good tutorial - I'd say the first two sections (Introduction and Basic C features, and Pointers, Arrays and Strings) are a must, the other two don't matter as much as they don't apply to the Wii U as much as they do on PC. This tutorial teaches you PC development)

After that, @QuarkTheAwesome has a WIP tutorial that guides existing C programmers to the Wii U. Not much there right now, but by the time you get back from C you should be able to learn something.

For anyone else out there who is interested in pogramming for the Wii U, like @victormr21 said, I;d learn something simpler like Lua or Python first, and then move on to the C tutorial mentioned above. Then follow @QuarkTheAwesome's guide and look at existing homebrew code to get a feel for how the Wii U works.

This is, of course, how I learned programming. If you feel gutsy, you can jump straight into the Wii U if you want, I won't stop you.
 

Logan Pockrus

Knawledge is key.
Member
Joined
Jan 1, 2016
Messages
1,338
Trophies
0
XP
1,062
Country
United States
i started with Python because its easier at my opinión that others languages, ex. in Python you put:
Code:
print ("Hello World")
and its done but in C its like (i think, im not very sure, its an example from the page you said above)
Code:
#include <iostream.h>

int main() {
   std::cout << "Hello World!\n";
   return 0;
}
A lot of lines for something that can be in one/two lines
Ill try to write it in C/C++, thanks for reply
Bye!
The only line that prints anything is "std::cout<< "Hello World!\n". Here are what the other lines are for:

"#include <iostream>" includes a library required to use "std::cout".

"return 0" returns from the main function with a normal exit code.

"int main()" marks the declaration of the main function.

The braces simply represent the scope of the main function (basically, it starts at the first, and ends at the second).

Oh, and if you pick up C++, please don't use "#include <iostream.h>"; use "#include <iostream>" (the use of "iostream.h" as opposed to "iostream" is deprecated).
 
D

Deleted User

Guest
Here is an Hello Wotld for Wii U made with easy_lib , if this can help you :

#include "lib_easy.h"
int Menu_Main(void) {
uprintf("Hello World!");
while(1) {
updatePressedButtons(); //Update buttons state
if(isPressed(VPAD_BUTTON_HOME)) break; //Check if home is pressed
}
uprintf("Exiting...");
return 0;
}
 

shinyquagsire23

SALT/Sm4sh Leak Guy
Member
Joined
Nov 18, 2012
Messages
1,977
Trophies
2
Age
26
Location
Las Vegas
XP
3,765
Country
United States
i started with Python because its easier at my opinión that others languages, ex. in Python you put:
Code:
print ("Hello World")
and its done but in C its like (i think, im not very sure, its an example from the page you said above)
Code:
#include <iostream.h>

int main() {
   std::cout << "Hello World!\n";
   return 0;
}
A lot of lines for something that can be in one/two lines
Ill try to write it in C/C++, thanks for reply
Bye!
It may be better to actually try writing homebrew for 3DS, if you have a 3DS. 3DS has better established examples than Wii U at the moment, and more standardization (Wii U has .elf which has a set of de-facto libraries which differ from WUT, which is used for RPX native applications which can load from loadiine, not as popular yet).

On 3DS you can do something like
Code:
printf("Hello World!");
and ctrulib will actually print to a console on the 3DS. printf also works in C++, some people prefer it to cout because it can do formatting somewhat nicer. https://github.com/devkitPro/3ds-examples/tree/master/graphics/printing/hello-world is a good 3DS sample if you go that direction.

Wii U doesn't have a standard console as far as I know, however you can do things like OSScreenPutFontEx to print to the screen, or OSReport to print to syslog (which cannot be viewed without either hacking coreinit to redirect output somewhere, or with IOSU). OSReport is handy if you're developing against something like Decaf-Emu because you can just print like
Code:
OSReport("Hello, world!");
and it'll show up in the console there. You can only develop with decaf-emu if you target WUT instead of the usual homebrew .elfs, unfortunately. WUT has a basic example at https://github.com/decaf-emu/wut/tree/master/samples/helloworld, doesn't do any GUI stuff though, just does some prints, runs code on each core and exits.

You'd probably be better off, assuming you don't have a 3DS and really want to do Wii U homebrew, just sticking with the existing examples used for .elf homebrew run through Homebrew Loader. https://github.com/rw-r-r-0644/WiiU-HelloWorld-Easy looks like a nice place to start for basic printing stuff, because they have a printf wrapper called uprintf which gives you a console to work with.

TLDR; Maybe look at 3DS stuff because it's a bit nicer, https://github.com/rw-r-r-0644/WiiU-HelloWorld-Easy is good too though.
 

victormr21

Well-Known Member
OP
Member
Joined
Dec 29, 2015
Messages
565
Trophies
0
XP
498
Country
Hi!
First of all thanks for the replies to try to help me
@Logan Pockrus for explain me whats the meanning of function in C/C++
@Coc4tm for sharing with me a easier example
And @shinyquagsire23 for the recomendations and also share more examples
Unfortunally I havent got a 3DS, So if I continue learning programing its in the Wii U
Or for Wii, I have instales HBC, some IOS, some programs and I think that in the DevKitPro folders to compile Loadiine there are Wii tools
The Guy that have IOSU Userland/Kernel Exploit quoted my post!!!!!
Bye!
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    K3Nv2 @ K3Nv2: Well start walking towards them +1