mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-12 11:10:39 +00:00
Add a hack so that when exit() is called on Android, we instead longjmp to main() and return from there.
git-svn-id: https://svn.eduke32.com/eduke32@5706 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
1fcf91d933
commit
93349bd8e0
2 changed files with 24 additions and 0 deletions
|
@ -1005,6 +1005,11 @@ FORCE_INLINE void *xaligned_malloc(const bsize_t alignment, const bsize_t size)
|
||||||
# define Bexit exit
|
# define Bexit exit
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __ANDROID__
|
||||||
|
void eduke32_exit_return(int) ATTRIBUTE((noreturn));
|
||||||
|
# define exit(x) eduke32_exit_return(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined _WIN32 && !defined NO_ALIGNED_MALLOC
|
#if defined _WIN32 && !defined NO_ALIGNED_MALLOC
|
||||||
# define Baligned_free _aligned_free
|
# define Baligned_free _aligned_free
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -378,12 +378,31 @@ int sdlayer_mobilefilter(void *userdata, SDL_Event *event)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __ANDROID__
|
||||||
|
# include <setjmp.h>
|
||||||
|
static jmp_buf eduke32_exit_jmp_buf;
|
||||||
|
static int eduke32_return_value;
|
||||||
|
|
||||||
|
void eduke32_exit_return(int retval)
|
||||||
|
{
|
||||||
|
eduke32_return_value = retval;
|
||||||
|
longjmp(eduke32_exit_jmp_buf, 1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
int32_t WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int32_t nCmdShow)
|
int32_t WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int32_t nCmdShow)
|
||||||
#else
|
#else
|
||||||
int32_t main(int32_t argc, char *argv[])
|
int32_t main(int32_t argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
#ifdef __ANDROID__
|
||||||
|
if (setjmp(eduke32_exit_jmp_buf))
|
||||||
|
{
|
||||||
|
return eduke32_return_value;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int32_t r;
|
int32_t r;
|
||||||
|
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
|
|
Loading…
Reference in a new issue