Hacking postLoader v.1.0 bet

stfour

Well-Known Member
OP
Member
Joined
May 24, 2011
Messages
1,592
Trophies
0
XP
350
Country
Italy
UPDATED 17 June 2011 to V.1.0b4

Hi to all, I want to share this application I've developed initially for myself. But I'm quite happy of it, so I like to share to wii community it. I'm a old coder, but totally new to wii world. I'm affascinated by wii homebrew (and hacking) community.

postLoader is intended to be an extension to priiloader autoboot feature. It aims to replace Forwarders and HB Channel (maybe... one day).

Features:
----------------------------------------
* Autoboot your default application: If you don't press (A) in time to enter in interactive mode, postLoader will launch the predefined app (if enabled)
* HB Channel replacement: It can be used to browse homebrew application, with it own interface.
* Support interactive application sorting
* Full support for meta.xml arguments and all other tags.
* It support subfolders (see notes)
* Can browse SD and USB device (FAT32 on first/active partition)
* Support costom splash screen (only from SD device)
* Should be capable to enable ahbprot



Let me known what you think. Suggestions are welcome.

readmii.txt:
CODEpostLoader v1.0 b4 (updated 17 June 211)
========================================

postLoader is intended to be an extension to priiloader autoboot feature. It aims to replace Forwarders and HB Channel (maybe... one day).


Features:
----------------------------------------
* Autoboot your default application: If you don't press (A) in time to enter in interactive mode, postLoader will launch the predefined app (if enabled)
* HB Channel replacement: It can be used to browse homebrew application, with it own interface.
* Support interactive application sorting
* Full support for meta.xml arguments and all other tags.
* It support subfolders (see notes)
* Can browse SD and USB device (FAT32 on first/active partition)
* Support costom splash screen (only from SD device)
* Should be capable to enable ahbprot


Installation:
----------------------------------------
It shuold be installed as autorun file in priiloader and works as forwarder/hombrew launcher with it's own user interface. When started, postLoader search for it's configuration file starting from SD. If not found continue with an USB device. If no configuration file the user interface is shown to allow the selection of preferred homebrew.


Usage:
----------------------------------------

Keys (during initialization - time depends on the speed of usb init + 2 sec)

(A) Enter in interactive mode (show user interface)
(B) Skip USB initialization

Keys (interactive mode)

(A) Start selected homebrew
(B) Show selected application menu, also act as cancel on popup menu
() Change page
(Home) Show postLoader options menu


CUSTOM SPLASH SCREEN
----------------------------------------
Copy your png named "ploader.png" on the root of SD card. 640x480 is suggested.
Using a custom splash screen will slow a bit postLoader startup.


SUBFOLDER:
----------------------------------------
Since version 1.0b2, subfolders are supported. About any depth can be used, but keep in mind that actually postLoader support filenames long up to 255 chars.
To enable subfolder, only meta.xml MUST be present on parent folder. In meta.xml you can (should) edit tag to give a description to that folder. An icon.png can be present, otherwise a standard folder icon is shown.

example:

APPS
ÂÂ|
ÂÂ|-- HB1 (folder)
ÂÂ|ÂÂ |-- boot.dol
ÂÂ|ÂÂ |-- meta.xml
ÂÂ|ÂÂ |-- icon.xml
ÂÂ|
ÂÂ|---- HB2 (folder)
ÂÂ|ÂÂ |-- boot.dol
ÂÂ|ÂÂ |-- meta.xml
ÂÂ|ÂÂ |-- icon.xml
ÂÂ|
ÂÂ|---- FOLDERÂÂÂÂ
ÂÂÂÂÂÂÂÂ|
ÂÂÂÂÂÂÂÂ|-- meta.xml (MUST EXIST)
ÂÂÂÂÂÂÂÂ|-- icon.png (optional)
ÂÂÂÂÂÂÂÂ|
ÂÂÂÂÂÂÂÂ|-- HB3
ÂÂÂÂÂÂÂÂ|ÂÂ |-- boot.dol
ÂÂÂÂÂÂÂÂ|ÂÂ |-- meta.xml
ÂÂÂÂÂÂÂÂ|ÂÂ |-- icon.xml
ÂÂÂÂÂÂÂÂ|
ÂÂÂÂÂÂÂÂ|-- HB4
ÂÂÂÂÂÂÂÂÂÂÂÂ|-- boot.dol
ÂÂÂÂÂÂÂÂÂÂÂÂ|-- meta.xml
ÂÂÂÂÂÂÂÂÂÂÂÂ|-- icon.xml
ÂÂÂÂÂÂÂÂ

NOTES:
----------------------------------------

* If no application has been enabled for autorun, autorun for that device is disabled
* If you doesn't want to scan for USB, just select an autorun HB on the sd. Or create on SD root a file "/ploader.sd" (also empty).
* hb are sorted by name. Applications with highter priority are displayed first.
* postLoader creates a configuration file in the root of the device containing the path of the autorun application
* no elf support (I think it is not needed)
* Screenshots are from dolphin...


CREDITS:
----------------------------------------

* GRRLIB (I've removed ttf support to have much smaller application)
* USB Loader GX, I've used it's app_booter.dol... it seems to give the best compatibility
* Priiloader
* CFG Usb loader (for let me understand how priiload magic words should be used)


====================
HISTORY
====================

V.1.0 b4

* Limited the lines displayed for xml long description
* On popup menues, (B) act as cancel button
* Changed a lot of things in internal libraries
* Added option: "Disable autorun on current device"
* Added option "Enable/Disable boot time USB initialization" when the device is an SD.
* Add support for custom logo from (and only) SD.
* Added support for applications without icon.png or meta.xml (anyway the last will be created)
* During sorting you can mark the same application more than once. Corrected
* Disabled access to menu during sorting

V.1.0 b3

* MMM 13.4: Derived bootdol.dol from app_booter.dol (by dimok). Now It runs...
* Added on screen menu'. Press Home in interactive.
* Added application description.
* Pressing (B) on application, will open application menu, with full description (from xml)
* Changed a bit the interactive interface
* Faster interactive page change
* Updated readmii.txt

V.1.0 b2

* Corrected a memory's related bugs that can lead to code-dump if no icon is present for an HB Application
* Added support for subfolders
* Changed some displayed information in interactive mode
* Corrected a bug that cause failure on usb mount if configuration file is not present
* Corrected a bug that cause no directory listing if no sd card is inserted
* Corrected a bug on argv creating
* Added application path with sd/usb identifier to argv[0]
* Rewritten readmii.txt

V.1.0 b1

* Added arg parsing from meta.xml
* Now postLoader save its setting in meta.xml config
* Ad more checking on some buffers

V.1.0 beta - First public release

Screenshots:

00000001-0.png

(default splash screen)

00000001-1.png

(sample of custom splash from sd root file ploader.png)

00000001-2.png

(selecting an application)

00000001-3.png

(B on an application brings app menu)

00000001-4.png

(home will show postLoader menu)

00000001-5.png

(credits)

Download (no source):

>

>

Channel (by person66)

http://gbatemp.net/t296955-postloader-v-1-...t&p=3727640

Forwarder (by Albatroz)

http://gbatemp.net/t296955-postloader-v-1-...t&p=3722678

sources:

As I'm actually learning wii programming, source are continuously changing. With postLoader I'm developing a light user interface library (I called grlib, based on GRRLIB). So that I prefer to not release source until I am satisfied of them. Anyway feel free to request them via pm or mail. I only ask to not mod postLoader until beta phase is completed.
 

stfour

Well-Known Member
OP
Member
Joined
May 24, 2011
Messages
1,592
Trophies
0
XP
350
Country
Italy
Thank you. Try it and let me known what do you think.

I have reupped the application NOW as I found a little bug when passing args to autorun application.

Please download it again.
 

Taleweaver

Storywriter
Member
Joined
Dec 23, 2009
Messages
8,690
Trophies
2
Age
43
Location
Belgium
XP
8,095
Country
Belgium
A nice and ambitious project, man. I like how you just build what you want.
smile.gif



Unfortunately...I can't say things work out on my end as they should.
-if I try to run it with just the USB drive inserted, it looks for the SD card and then starts the normal system menu (same if I load it through wiixplorer, btw).
-if I try to run it on the SD card, it just code dumps.

As far as my tests go, I'd say the forwarder works fine, so it's something in the program. It may also be worth mentioning that uneek may interfere with the working of the program (not your fault: HBC and priiloader are also a bit flakey in that environment). But still...why it doesn't recognize my USB drive is beyond me.
unsure.gif
 

stfour

Well-Known Member
OP
Member
Joined
May 24, 2011
Messages
1,592
Trophies
0
XP
350
Country
Italy
Waver, thank you for your feedback.

Some questions:

1) Have you have postLoader under uneek ?
2) Have your hdd a primary FAT32 partition (I think yes as you using uneek)
3) How many hb you have ?
4) Have you IOS58 in you virtual nand ?

I will test under s/u-neek. But I've not developed postLoader for that scenario. Anyway I will try to see how works.

I use postLoader (on real nand, of course) to autorun CFG Usb loader, and have a fast and easy way to run mighty channels (mainly for VC) and wiimc. I use uneek+di just for wiiware, and I have a little HB app to boot to it.
 

Taleweaver

Storywriter
Member
Joined
Dec 23, 2009
Messages
8,690
Trophies
2
Age
43
Location
Belgium
XP
8,095
Country
Belgium
Before I answer...how do you install postloader, exactly? The way I did it was put the \apps\postLoader in both USB:\apps\postLoader and SD:\apps\postLoader, and the postloader.dol in the roots of SD and USB (probably overkill, but meh...). Is the \project map needed, or is that just the source code?

1. I tried both uneek+DI and the real nand.
2. yes (active & primary)
3. assuming you mean 'homebrew'...36 \apps subfolders on USB drive (including postloader), 28 on the SD drive. They don't all have meta.xml and boot.dol files in them...might that matter?
4. yes (also on real nand, btw)

(further specification on my wii config can be found in my avatar).


If you're just starting to get to know the wii, it may be better to just leave uneek features for what they are right now and focus on stability on the real nand. Most people will be using it that way (if they're willing to switch from the HBC, that is).
 

stfour

Well-Known Member
OP
Member
Joined
May 24, 2011
Messages
1,592
Trophies
0
XP
350
Country
Italy
Waver, postLoader should be installed in real nand in priiloader using it's load/install feature. Than you should configure priiloader to start installed app when boot.

This is how I use it and the way that make sense use it.

The apps/postloader I've added to distrubition is just to let you to test launching it from hbc. But really launching postloader from hbc make no sense.

wink.gif
 

oggzee

Well-Known Member
Member
Joined
Apr 11, 2009
Messages
2,333
Trophies
0
XP
188
Country
Slovenia
So this is like a HBC replacement?
Does this support meta.xml arguments tag?
If yes - cool, if not - it would be nice to add.
 

stfour

Well-Known Member
OP
Member
Joined
May 24, 2011
Messages
1,592
Trophies
0
XP
350
Country
Italy
Yes, it's support arguments but not from meta... as explained in readmii, arguments must be added in configuration file.

But reading args from meta can be easily implemented. I do not focus on it as I use args only for Mighty Channels
laugh.gif


If you think it is usefull, I will add complete parsing of meta (now just the name is readed). But first I need feedback about if it works for you.

I've tryed with SD only (1GB, 8GBHC) and with usb hdd (samsung G3 1.5TB)... and mixing them, of course. And also from dolphin with its sd emulation.
 

oggzee

Well-Known Member
Member
Joined
Apr 11, 2009
Messages
2,333
Trophies
0
XP
188
Country
Slovenia
I think it would be useful to use meta.xml arguments, so you have to set them only on one place.
The arguments come handy for the cfg loader to specify some options like ios, debug, intro,...
Adding that is of course trivial and to make if even easier you might just copy it from FIX94 forwarder:
CODE#define MAX_CMDLINE 4096
#define MAX_ARGVÂÂÂÂ1000
struct __argv args;
char cmdline[MAX_CMDLINE];
char *a_argv[MAX_ARGV];
char *meta_buf = NULL;

void arg_init()
{
ÂÂÂÂmemset(&args, 0, sizeof(args));
ÂÂÂÂmemset(cmdline, 0, sizeof(cmdline));
ÂÂÂÂmemset(a_argv, 0, sizeof(a_argv));
ÂÂÂÂargs.argvMagic = ARGV_MAGIC;
ÂÂÂÂargs.length = 1; // double
ÂÂÂÂargs.argc = 0;
ÂÂÂÂargs.commandLine = cmdline;
ÂÂÂÂargs.argv = a_argv;
ÂÂÂÂargs.endARGV = a_argv;
}

char* strcopy(char *dest, const char *src, int size)
{
ÂÂÂÂstrncpy(dest,src,size);
ÂÂÂÂdest[size-1] = 0;
ÂÂÂÂreturn dest;
}

int arg_addl(char *arg, int len)
{
ÂÂÂÂif (args.argc >= MAX_ARGV) return -1;
ÂÂÂÂif (args.length + len + 1 > MAX_CMDLINE) return -1;
ÂÂÂÂstrcopy(cmdline + args.length - 1, arg, len+1);
ÂÂÂÂargs.length += len + 1; // 0 term.
ÂÂÂÂcmdline[args.length - 1] = 0; // double
ÂÂÂÂargs.argc++;
ÂÂÂÂargs.endARGV = args.argv + args.argc;
ÂÂÂÂreturn 0;
}

int arg_add(char *arg)
{
ÂÂÂÂreturn arg_addl(arg, strlen(arg));
}

int load_file(char *name, void *buf, int size)
{
ÂÂÂÂint fd;
ÂÂÂÂint ret;
ÂÂÂÂfd = open(name, O_RDONLY);
ÂÂÂÂif (fd < 0) {
ÂÂÂÂÂÂÂÂreturn -1;
ÂÂÂÂ}
ÂÂÂÂret = read(fd, buf, size);
ÂÂÂÂclose(fd);
ÂÂÂÂif (ret != size) {
ÂÂÂÂÂÂÂÂreturn -2;
ÂÂÂÂ}
ÂÂÂÂreturn 0;
}

void load_meta( const char *exe_path)
{
ÂÂÂÂchar meta_path[200];
ÂÂÂÂconst char *p;
ÂÂÂÂstruct stat st;

ÂÂÂÂp = strrchr(exe_path, '/');
ÂÂÂÂsnprintf( meta_path, sizeof(meta_path), "%.*smeta.xml",
ÂÂÂÂÂÂÂÂp ? p-exe_path+1 : 0, exe_path );
ÂÂÂÂÂÂÂÂ
ÂÂÂÂif (stat(meta_path, &st) != 0) {
ÂÂÂÂÂÂÂÂreturn;
ÂÂÂÂ}
ÂÂÂÂif (st.st_size > 64*1024) {
ÂÂÂÂÂÂÂÂreturn;
ÂÂÂÂ}
ÂÂÂÂ// +1 so that the buf is 0 terminated
ÂÂÂÂmeta_buf = calloc(st.st_size + 1, 1);
ÂÂÂÂif (!meta_buf) {
ÂÂÂÂÂÂÂÂreturn;
ÂÂÂÂ}
ÂÂÂÂload_file(meta_path, meta_buf, st.st_size);
}

void parse_meta()
{
ÂÂÂÂchar *p;
ÂÂÂÂchar *e, *end;
ÂÂÂÂif (meta_buf == NULL) return;
ÂÂÂÂif (!strstr(meta_buf, "
 

Slimmmmmm

GBAtemp MoNkEeE
Member
Joined
Nov 1, 2007
Messages
1,770
Trophies
0
Location
the land of lol
XP
528
Country
This looks great
smile.gif


I think the BEST thing about it already is that people can offer suggestions and maybe they will be considered, I don't feel this is true for the HBC. Plus we get the sources
biggrin.gif


Not tried it yet, but bookmarked for sure. I'll be watching this closely.
 

Slimmmmmm

GBAtemp MoNkEeE
Member
Joined
Nov 1, 2007
Messages
1,770
Trophies
0
Location
the land of lol
XP
528
Country
Folder support would be good...hmm how to explain.

In my apps I have....

/apps/GAMECUBE SAVES/boot.dol (this boots my own dol that lets you select)
/apps/GAMECUBE SAVES/1/boot.dol some gc saves tool
/apps/GAMECUBE SAVES/2/boot.dol another GC saves tool
/apps/GAMECUBE SAVES/3/boot.dol yet another gc saves tool
/apps/GAMECUBE SAVES/4/boot.dol oh 1 more gc saves tool... (yes gc saves need 4 apps to get 100% working)

So in hbc 1,2,3,4 are hidden and selectable using the /apps/GAMECUBE SAVES/boot.dol

It's a stupid way of doing things but it hides most apps and provides a way of grouping. I like to have millions of apps, but like to not have them all on display at once.

I also do this with opera and have 1 entry in HBC, but can select 11 pages to start from by holding a button to load a diff arg.
 

stfour

Well-Known Member
OP
Member
Joined
May 24, 2011
Messages
1,592
Trophies
0
XP
350
Country
Italy
NutNut said:
I don't see differences between autobooting on HBC or autobooting on postloader ?
unsure.gif

Can you explain please !

It's simple, postLoader, if you don't press (A) in wiimote during initialization (no less 2 seconds) to enter in interactive mode, automatically boot your preferred homebrew application/loader.
 

stfour

Well-Known Member
OP
Member
Joined
May 24, 2011
Messages
1,592
Trophies
0
XP
350
Country
Italy
Slimmmmmm said:
Folder support would be good...hmm how to explain.

In my apps I have....

/apps/GAMECUBE SAVES/boot.dol (this boots my own dol that lets you select)
/apps/GAMECUBE SAVES/1/boot.dol some gc saves tool
/apps/GAMECUBE SAVES/2/boot.dol another GC saves tool
/apps/GAMECUBE SAVES/3/boot.dol yet another gc saves tool
/apps/GAMECUBE SAVES/4/boot.dol oh 1 more gc saves tool... (yes gc saves need 4 apps to get 100% working)

So in hbc 1,2,3,4 are hidden and selectable using the /apps/GAMECUBE SAVES/boot.dol

It's a stupid way of doing things but it hides most apps and provides a way of grouping. I like to have millions of apps, but like to not have them all on display at once.

I also do this with opera and have 1 entry in HBC, but can select 11 pages to start from by holding a button to load a diff arg.

Let me understand... you like to have in postLoader neasting folder support ?
 

SifJar

Not a pirate
Member
Joined
Apr 4, 2009
Messages
6,022
Trophies
0
Website
Visit site
XP
1,175
Country
I think he wants a system somewhat like that provided by "Categorii" - For example, there is an option displayed "GC Saves", and selecting this option will not actually load anything, but will change the displayed homebrew to the various GC saves homebrew.

EDIT: Example:

[youtube]fQk4m3uHYpI[/youtube]

This is Categorii. If it was natively supported by your app, it would obviously be much smoother.
 

Slimmmmmm

GBAtemp MoNkEeE
Member
Joined
Nov 1, 2007
Messages
1,770
Trophies
0
Location
the land of lol
XP
528
Country
No selecting gc saves does load a dol that if a button is held then it loads yet another dol, if you dont hold anything the default is loaded. So not like categorii afaik. Categorii hides some apps by renaming iirc. My hbc always looks the same. Nothing gets moved or hidden because then you need to unhide them again and imho that's a pita
tongue.gif


If I click on usb loader it loads a cetain loader, but holding b loads another, 1 another etc.

To add something like this idea to this app you would need to have a sort of drop down menu and it would list the apps you could load. So for example you put apps A,B and C in folderA. If you pick folderA it lets you select a,b, or c.

Or more simple it could switch and show you these apps (like categorii), but as i have it running nothing is ever hidden.

Being honest though, I am not familiar with categori so will have a look in the next day or two and then know if it's worth me switching to. I tried sometihng like that before but it hid certain apps to display some others, and loading it again it undid this.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    K3Nv2 @ K3Nv2: I really don't want to buy this fap tab...