mirror of
https://git.planet-casio.com/Lephenixnoir/gint.git
synced 2024-12-29 13:03:36 +01:00
Added gint_set_quit_handler()
This commit is contained in:
parent
6426406043
commit
984f162cb2
2 changed files with 36 additions and 0 deletions
|
@ -109,6 +109,16 @@ static GINLINE void *gint_inthandler(int code, void const *h, size_t size) {
|
|||
Returns the return value of the callback. */
|
||||
extern int (*gint_inth_callback)(gint_call_t const *call);
|
||||
|
||||
/* gint_set_quit_handler(): Call a GINT_CALL when the user open another add-in
|
||||
|
||||
This function use the SetQuitHandler syscall to call a function when the
|
||||
user open another add-in.
|
||||
|
||||
@call A GINT_CALL
|
||||
@do_world_switch 1 to execute @call in a world_switch. */
|
||||
|
||||
void gint_set_quit_handler(gint_call_t gcall, bool do_world_switch);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -13,6 +13,7 @@ int __GetKeyWait(int *col,int *row,int type,int time,int menu,uint16_t *key);
|
|||
void __ClearKeyBuffer(void); /* ? */
|
||||
void *__GetVRAMAddress(void);
|
||||
void __ConfigureStatusArea(int mode);
|
||||
void __SetQuitHandler(void (*callback)(void));
|
||||
|
||||
static int __osmenu_id;
|
||||
|
||||
|
@ -76,3 +77,28 @@ void gint_osmenu(void)
|
|||
{
|
||||
gint_world_switch(GINT_CALL(gint_osmenu_native));
|
||||
}
|
||||
|
||||
static gint_call_t __gcall;
|
||||
static bool __do_world_switch;
|
||||
|
||||
static void __handler()
|
||||
{
|
||||
if(__do_world_switch){
|
||||
gint_call(__gcall);
|
||||
}else{
|
||||
/* TODO: quit the world switch */
|
||||
gint_call(__gcall);
|
||||
}
|
||||
}
|
||||
|
||||
static void __sethandler()
|
||||
{
|
||||
__SetQuitHandler((void *)__handler);
|
||||
}
|
||||
|
||||
void gint_set_quit_handler(gint_call_t gcall, bool do_world_switch)
|
||||
{
|
||||
__gcall = gcall;
|
||||
__do_world_switch = do_world_switch;
|
||||
gint_world_switch(GINT_CALL(__sethandler));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue