Advertising (This ad goes away for registered users. You can Login or Register)

Black Friday Sale: Playstation Plus 1 Year subscription is $39.99 (33% off) on Amazon and other retailers, while supplies last.

Menu API and cascading menus

This is the development forum of the half-byte loader project. For general Half Byte Loader questions, visit the Half Byte Loader forum.
Forum rules
This forum is for HBL Development discussions ONLY. For User support or HBL general discussions, go to viewforum.php?f=3 . Messages that are not development related will be deleted.
JJS
Big Beholder
Posts: 1416
Joined: Mon Sep 27, 2010 2:18 pm
Contact:

Re: Menu API and cascading menus

Post by JJS » Fri Dec 17, 2010 2:18 pm

While I was writing a sample menu for the new API I was using the sceUtilityGetSystemParam*() functions and thought that doing it like that would be a better idea. So instead of having a dedicated set/get function for every variable, there is now only one set/get for each data type. This simplyfies the extension of the API and the hooking code quite a bit.

So a new header would look like this:

Code: Select all

#ifndef HBL_API
#define HBL_API

// All functions return 0 on success and a value < 0 on error
#define HBL_ERROR_OK 0
#define HBL_ERROR_GENERIC 0x80000001
#define HBL_ERROR_BUFFER_TOO_SMALL 0x80000002
#define HBL_ERROR_INVALID_PARAMETER_ID 0x80000003
#define HBL_ERROR_PARAMETER_IS_READONLY 0x80000004


// String parameter IDs (R = readable, W = writable)
typedef enum
{
	HBL_PARAM_HOMEBREW_PATH = 0,     // R+W - starting folder for the menu
	HBL_PARAM_NEXT_EXEC = 1,         // R+W - path of the EBOOT that is run next
	HBL_PARAM_CREDITS_STRING = 2,    // R - HBL credits string
	HBL_PARAM_VERSION_STRING = 3     // R - HBL version string
}
HblStringParameter;


// Integer parameter IDs (R = readable, W = writable)
typedef enum
{
	HBL_PARAM_NEXT_EXEC_IS_MENU = 0, // R+W - treat the next EBOOT as an old style menu (API in argv[1])
	HBL_PARAM_VERSION = 1,           // R - HBL revision
	HBL_PARAM_EXIT_TO_XMB = 2        // R+W - quit to the XMB after the current homebrew exits
}
HblIntParameter;



// Set the string parameter indicated by the ID
int hblSetParamString(HblStringParameter id, char* buffer);

// Get the string parameter indicated by the ID, bufferSize includes the trailing 0
int hblGetParamString(HblStringParameter id, char* buffer, unsigned int bufferSize);

// Get the size of a buffer (including the trailing 0) to hold the indicated parameter
int hblGetParamStringSize(HblStringParameter id);


// Set the int parameter indicated by the ID
int hblSetParamInt(HblIntParameter id, int value);

// Get the int parameter indicated by the ID
int hblGetParamInt(HblIntParameter id, int value);



#endif
What do you guys think?
Advertising

User avatar
FrEdDy
HBL Collaborator
Posts: 243
Joined: Mon Sep 27, 2010 7:08 pm
Contact:

Re: Menu API and cascading menus

Post by FrEdDy » Fri Dec 17, 2010 4:01 pm

JJS wrote:While I was writing a sample menu for the new API I was using the sceUtilityGetSystemParam*() functions and thought that doing it like that would be a better idea. So instead of having a dedicated set/get function for every variable, there is now only one set/get for each data type. This simplyfies the extension of the API and the hooking code quite a bit.

So a new header would look like this:

Code: Select all

#ifndef HBL_API
#define HBL_API

// All functions return 0 on success and a value < 0 on error
#define HBL_ERROR_OK 0
#define HBL_ERROR_GENERIC 0x80000001
#define HBL_ERROR_BUFFER_TOO_SMALL 0x80000002
#define HBL_ERROR_INVALID_PARAMETER_ID 0x80000003
#define HBL_ERROR_PARAMETER_IS_READONLY 0x80000004


// String parameter IDs (R = readable, W = writable)
typedef enum
{
	HBL_PARAM_HOMEBREW_PATH = 0,     // R+W - starting folder for the menu
	HBL_PARAM_NEXT_EXEC = 1,         // R+W - path of the EBOOT that is run next
	HBL_PARAM_CREDITS_STRING = 2,    // R - HBL credits string
	HBL_PARAM_VERSION_STRING = 3     // R - HBL version string
}
HblStringParameter;


// Integer parameter IDs (R = readable, W = writable)
typedef enum
{
	HBL_PARAM_NEXT_EXEC_IS_MENU = 0, // R+W - treat the next EBOOT as an old style menu (API in argv[1])
	HBL_PARAM_VERSION = 1,           // R - HBL revision
	HBL_PARAM_EXIT_TO_XMB = 2        // R+W - quit to the XMB after the current homebrew exits
}
HblIntParameter;



// Set the string parameter indicated by the ID
int hblSetParamString(HblStringParameter id, char* buffer);

// Get the string parameter indicated by the ID, bufferSize includes the trailing 0
int hblGetParamString(HblStringParameter id, char* buffer, unsigned int bufferSize);

// Get the size of a buffer (including the trailing 0) to hold the indicated parameter
int hblGetParamStringSize(HblStringParameter id);


// Set the int parameter indicated by the ID
int hblSetParamInt(HblIntParameter id, int value);

// Get the int parameter indicated by the ID
int hblGetParamInt(HblIntParameter id, int value);



#endif
What do you guys think?
Nice idea
Advertising
https://github.com/freddy-156
<@n00b81> FREDDY CUTTIES

User avatar
m0skit0
Guru
Posts: 3817
Joined: Mon Sep 27, 2010 6:01 pm

Re: Menu API and cascading menus

Post by m0skit0 » Fri Dec 17, 2010 5:43 pm

Nice one.
I wanna lots of mov al,0xb
Image
"just not into this RA stuffz"

JJS
Big Beholder
Posts: 1416
Joined: Mon Sep 27, 2010 2:18 pm
Contact:

Re: Menu API and cascading menus

Post by JJS » Mon Mar 19, 2012 7:52 am

I was looking through old threads and this caught my attention. Sorry that I didn't finish the API implementation, guys. This whole thing got steamrolled with me helping on the sukkiri exploit and the TN HEN release I guess.

Anyway, I decided to pull a diff from the files I had on my harddrive. The problem I ran into was that I couldn't implement the API in a way that would not break backward compatibility with the old menu code. So here is a diff with HBL R112 :shock:
Attachments
hblapi_r112.zip
(9.46 KiB) Downloaded 70 times

Post Reply

Return to “Half Byte Loader Development”