What's the easiest way to check if a title is installed?

Discussion in 'Wii - Emulation and Homebrew' started by JoostinOnline, Nov 13, 2011.

  1. JoostinOnline
    OP

    JoostinOnline Certified Crash Test Dummy

    Member
    10,919
    3,689
    Apr 2, 2011
    United States
    The Twilight Zone
    The next version of Settings Editor GUI prompts you how you want to exit when in an emu nand (using exit(0) doesn't work). Currently all the options (various channels and shutdown/reset) are displayed, but, if the channel isn't installed, it gives a message and asks again. That works okay, but I want to limit the list of channels depending on what you have installed. Here is my code:
    Code:
    void EmuExitPrompt(void) {
    int item;
    char menu[1024];
    do
    {
    *menu = '\0';
    grlib_menuAddItem (menu, 1, "Load Homebrew Channel");
    grlib_menuAddItem (menu, 2, "Load Homebrew Filter");
    grlib_menuAddItem (menu, 3, "Load PostLoader Channel");
    grlib_menuAddSeparetor (menu);
    grlib_menuAddItem (menu, 4, "Restart Wii");
    grlib_menuAddItem (menu, 5, "Shutdown Wii");
    
    item = grlib_menu ("------ Select an exit type ------", menu);
    if (item == 1) {
    WII_LaunchTitle(TITLE_ID(0x00010001,0xAF1BF516)); // HBC v1.0.7+
    WII_LaunchTitle(TITLE_ID(0x00010001,0x4a4f4449)); // HBC JODI
    WII_LaunchTitle(TITLE_ID(0x00010001,0x48415858)); // HBC HAXX
    Message ("Homebrew Channel not installed");
    sleep (1);
    }
    if (item == 2) {
    WII_LaunchTitle(TITLE_ID(0x00010001,0x54484246)); // Homebrew Filter THBF
    Message ("Homebrew Filter not installed");
    sleep (1);
    }
    if (item == 3) {
    WII_LaunchTitle(TITLE_ID(0x00010001,0x504f5354)); // postLoader2 Channel POST
    Message ("PostLoader Channel not installed");
    sleep (1);
    }
    if (item == 4) {
    SYS_ResetSystem(SYS_RESTART,0,0); // Restart Wii
    }
    if (item == 5) {
    SYS_ResetSystem(SYS_SHUTDOWN,0,0); // Shutdown Wii
    }
    }
    while (true);
    
    } // EmuExitPromt
    
     
  2. JoostinOnline
    OP

    JoostinOnline Certified Crash Test Dummy

    Member
    10,919
    3,689
    Apr 2, 2011
    United States
    The Twilight Zone
    Anybody have a response to this?
     
  3. obcd

    obcd GBAtemp Advanced Maniac

    Member
    1,594
    278
    Apr 5, 2011
    Belgium
    Either you can scan the title/00010001 folder or you can search for entries in the uid.sys file.

    You can find usfull code snippets in channel loader programs like Mighty Channels, Postloader, Triiforce.
     
    1 person likes this.
  4. JoostinOnline
    OP

    JoostinOnline Certified Crash Test Dummy

    Member
    10,919
    3,689
    Apr 2, 2011
    United States
    The Twilight Zone
    Thanks. Wouldn't uid.sys contain entries for deleted channels?
     
  5. obcd

    obcd GBAtemp Advanced Maniac

    Member
    1,594
    278
    Apr 5, 2011
    Belgium
    Don't know. Logically, they should be removed from that file if the channel is properly deinstalled. Scanning the folder is a better solution.
     
  6. SifJar

    SifJar Not a pirate

    Member
    6,022
    891
    Apr 4, 2009
    uid.sys will include deleted channels, it's not a log of what is installed, it's a log of what has been run (and the uids associated with them). Scanning the folder is the best way to do I think.
     
  7. JoostinOnline
    OP

    JoostinOnline Certified Crash Test Dummy

    Member
    10,919
    3,689
    Apr 2, 2011
    United States
    The Twilight Zone
    Thanks guys. I'm about to release a new version already (just waiting for one more report), but I'll probably add this in the one after.
     
  8. giantpune

    giantpune GBAtemp Addict

    Member
    2,860
    122
    Apr 10, 2009
    United States
    ES_GetNumContents or whatever its called
    or ISFS_ReadDir( "/title/00010001/blablabla/content", ... )
     
    1 person likes this.