mirror of
https://git.planet-casio.com/Lephenixnoir/gint.git
synced 2025-01-01 06:23:35 +01:00
Merge pull request 'Added SetQuitHandler syscall into gint' (#21) from mibi88/gint:dev into dev
Reviewed-on: https://gitea.planet-casio.com/Lephenixnoir/gint/pulls/21
This commit is contained in:
commit
a5fb6d3401
4 changed files with 42 additions and 1 deletions
|
@ -32,7 +32,7 @@ The library also offers powerful higher-level features:
|
||||||
|
|
||||||
* An enhanced version of the system's GetKey() and GetKeyWait()
|
* An enhanced version of the system's GetKey() and GetKeyWait()
|
||||||
* A gray engine that works by rapidly swapping monochrome images on fx-9860G II
|
* A gray engine that works by rapidly swapping monochrome images on fx-9860G II
|
||||||
* Blazingly fast rendering functions (image rendering is 10 times faster tha
|
* Blazingly fast rendering functions (image rendering is 10 times faster than
|
||||||
MonochromeLib)
|
MonochromeLib)
|
||||||
* Integrated font management
|
* Integrated font management
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,16 @@ static GINLINE void *gint_inthandler(int code, void const *h, size_t size) {
|
||||||
Returns the return value of the callback. */
|
Returns the return value of the callback. */
|
||||||
extern int (*gint_inth_callback)(gint_call_t const *call);
|
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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -13,6 +13,7 @@ int __GetKeyWait(int *col,int *row,int type,int time,int menu,uint16_t *key);
|
||||||
void __ClearKeyBuffer(void); /* ? */
|
void __ClearKeyBuffer(void); /* ? */
|
||||||
void *__GetVRAMAddress(void);
|
void *__GetVRAMAddress(void);
|
||||||
void __ConfigureStatusArea(int mode);
|
void __ConfigureStatusArea(int mode);
|
||||||
|
void __SetQuitHandler(void (*callback)(void));
|
||||||
|
|
||||||
static int __osmenu_id;
|
static int __osmenu_id;
|
||||||
|
|
||||||
|
@ -76,3 +77,28 @@ void gint_osmenu(void)
|
||||||
{
|
{
|
||||||
gint_world_switch(GINT_CALL(gint_osmenu_native));
|
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));
|
||||||
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
.global ___ClearKeyBuffer
|
.global ___ClearKeyBuffer
|
||||||
.global ___GetVRAMAddress
|
.global ___GetVRAMAddress
|
||||||
.global ___ConfigureStatusArea
|
.global ___ConfigureStatusArea
|
||||||
|
.global ___SetQuitHandler
|
||||||
|
|
||||||
#define syscall_(id, syscall_table) \
|
#define syscall_(id, syscall_table) \
|
||||||
mov.l syscall_table, r2 ;\
|
mov.l syscall_table, r2 ;\
|
||||||
|
@ -111,6 +112,8 @@ ___ClearKeyBuffer:
|
||||||
syscall(0x241)
|
syscall(0x241)
|
||||||
___GetVRAMAddress:
|
___GetVRAMAddress:
|
||||||
syscall(0x135)
|
syscall(0x135)
|
||||||
|
___SetQuitHandler:
|
||||||
|
syscall(0x494)
|
||||||
|
|
||||||
syscall_table:
|
syscall_table:
|
||||||
.long 0x80010070
|
.long 0x80010070
|
||||||
|
@ -178,6 +181,8 @@ ___GetVRAMAddress:
|
||||||
syscall(0x1e6)
|
syscall(0x1e6)
|
||||||
___ConfigureStatusArea:
|
___ConfigureStatusArea:
|
||||||
syscall(0x2b7)
|
syscall(0x2b7)
|
||||||
|
___SetQuitHandler:
|
||||||
|
syscall(0x1e6e)
|
||||||
|
|
||||||
.global ___SpecialMatrixCodeProcessing
|
.global ___SpecialMatrixCodeProcessing
|
||||||
___SpecialMatrixCodeProcessing:
|
___SpecialMatrixCodeProcessing:
|
||||||
|
|
Loading…
Reference in a new issue