Filestreams for Hombrew Development

Discussion in 'Wii - Emulation and Homebrew' started by diego_pmc, Sep 22, 2009.

Sep 22, 2009
  1. diego_pmc
    OP

    Newcomer diego_pmc Advanced Member

    Joined:
    Sep 8, 2009
    Messages:
    52
    Country:
    United States
    I'm trying to port a small game I made some months ago over to Wii Homebrew (I am using devkitPro). I wanted to know what ways of reading simple text files are available for the Wii. I already know of this method, but I'd like to know if there are others as well.
     
  2. giantpune

    Member giantpune GBAtemp Addict

    Joined:
    Apr 10, 2009
    Messages:
    2,860
    Country:
    United States
    it really depends on what treads you already have running in your app. if you are using libwiigui, you can probably steal the txt reader from wiixplorer. aside from that, you will need to have some thread or function to pass the txt to and have that display it on the screen.
     
  3. diego_pmc
    OP

    Newcomer diego_pmc Advanced Member

    Joined:
    Sep 8, 2009
    Messages:
    52
    Country:
    United States
    I'm trying to port it over from Windows to Wii Hombrew — I've only just started last night and I'm currently trying to figure out how to make the core stuff work on Wii. This is basically what I have in Windows:
    CODE#include
    //...
    std::ifstream file ("filename.txt");
    std::string line;
    getline (file, line); // get a line from 'file' and assign it to 'line'
    std::cout
     
  4. giantpune

    Member giantpune GBAtemp Addict

    Joined:
    Apr 10, 2009
    Messages:
    2,860
    Country:
    United States
    it isn't really that easy. there is a system set up in homebrew known as the console. you have to initiate it and a couple other things, but then you can just use printf("blablablablabla"); it isn't pretty, but it works great. just look at any of waninkoko's source code for usage. if you want to get fancy with it, you need to use a few functions to load a font and draw stuff on the screen. in which case i would point you to libwiigui or grrlib.

    but as far as a function like

    printf(put_line_on_screen(get_line_from_file));

    there isn't one. you would need to code it to suit your needs.



    in libwiigui you would just need to parse the file into lines and assign each line to a char[200] or something and then use

    GuiText textName(line_of_file, 18, (GXColor) {255,255,255,255});
    some_other_object.Append(textName);
     

Share This Page