fallout2-ce/src/win32.cc

77 lines
1.4 KiB
C++
Raw Normal View History

2022-05-19 01:51:26 -07:00
#include "win32.h"
2022-09-15 02:38:23 -07:00
#include <stdlib.h>
#include <SDL.h>
2022-12-08 08:38:55 -08:00
#ifndef _WIN32
#include <unistd.h>
#endif
2022-05-19 01:51:26 -07:00
#include "main.h"
2022-10-05 00:35:05 -07:00
#include "svga.h"
2022-05-19 01:51:26 -07:00
#include "window_manager.h"
2022-10-14 01:40:11 -07:00
#if __APPLE__ && TARGET_OS_IOS
#include "platform/ios/paths.h"
#endif
2022-09-23 05:43:44 -07:00
namespace fallout {
2022-05-29 12:08:13 -07:00
#ifdef _WIN32
2022-05-19 01:51:26 -07:00
// 0x51E444
bool gProgramIsActive = false;
// GNW95MUTEX
HANDLE _GNW95_mutex = NULL;
// 0x4DE700
int main(int argc, char* argv[])
2022-05-19 01:51:26 -07:00
{
_GNW95_mutex = CreateMutexA(0, TRUE, "GNW95MUTEX");
if (GetLastError() == ERROR_SUCCESS) {
SDL_ShowCursor(SDL_DISABLE);
2022-05-19 01:51:26 -07:00
2022-07-12 02:09:53 -07:00
gProgramIsActive = true;
falloutMain(argc, argv);
2022-05-19 01:51:26 -07:00
2022-07-12 02:09:53 -07:00
CloseHandle(_GNW95_mutex);
2022-05-19 01:51:26 -07:00
}
2022-07-12 02:09:53 -07:00
return 0;
2022-05-19 01:51:26 -07:00
}
2022-05-29 12:08:13 -07:00
#else
bool gProgramIsActive = false;
int main(int argc, char* argv[])
{
2022-10-14 01:40:11 -07:00
#if __APPLE__ && TARGET_OS_IOS
SDL_SetHint(SDL_HINT_MOUSE_TOUCH_EVENTS, "0");
SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");
chdir(iOSGetDocumentsPath());
#endif
#if __APPLE__ && TARGET_OS_OSX
2022-07-05 05:45:36 -07:00
char* basePath = SDL_GetBasePath();
chdir(basePath);
SDL_free(basePath);
#endif
2022-07-25 18:30:17 -07:00
#if __ANDROID__
2022-07-29 10:04:37 -07:00
SDL_SetHint(SDL_HINT_MOUSE_TOUCH_EVENTS, "0");
SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");
2022-07-25 18:30:17 -07:00
chdir(SDL_AndroidGetExternalStoragePath());
#endif
2022-05-29 12:08:13 -07:00
SDL_ShowCursor(SDL_DISABLE);
gProgramIsActive = true;
return falloutMain(argc, argv);
}
#endif
2022-09-23 05:43:44 -07:00
} // namespace fallout
int main(int argc, char* argv[])
{
return fallout::main(argc, argv);
}