make it even saferer

This commit is contained in:
StapleButter 2018-12-16 00:39:14 +01:00
parent 502d8c3fa0
commit 4a47bd6d53
1 changed files with 11 additions and 3 deletions

View File

@ -1575,6 +1575,8 @@ int main(int argc, char** argv)
if (argv[0][len] == '\\') break;
len--;
}
if (len > 0)
{
EmuDirectory = new char[len];
strncpy(EmuDirectory, argv[0], len);
EmuDirectory[len] = '\0';
@ -1584,6 +1586,12 @@ int main(int argc, char** argv)
EmuDirectory = new char[2];
strcpy(EmuDirectory, ".");
}
}
else
{
EmuDirectory = new char[2];
strcpy(EmuDirectory, ".");
}
// http://stackoverflow.com/questions/14543333/joystick-wont-work-using-sdl
SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1");