| 1 | |
| 2 | /** |
| 3 | * |
| 4 | * @file platform_interface.cpp |
| 5 | * |
| 6 | * Part of the OpenJazz project |
| 7 | * |
| 8 | * @par Licence: |
| 9 | * Copyright (c) 2015-2026 Carsten Teibes |
| 10 | * |
| 11 | * OpenJazz is distributed under the terms of |
| 12 | * the GNU General Public License, version 2.0 |
| 13 | * |
| 14 | */ |
| 15 | |
| 16 | #include "platform_interface.h" |
| 17 | #include "platforms.h" |
| 18 | |
| 19 | #ifdef OJ_SDL3 |
| 20 | #include <SDL3/SDL.h> |
| 21 | #else |
| 22 | #include <SDL.h> |
| 23 | #endif |
| 24 | |
| 25 | IPlatform::~IPlatform() {} |
| 26 | |
| 27 | IPlatform* IPlatform::make() { |
| 28 | #if defined(__HAIKU__) |
| 29 | return new HaikuPlatform(); |
| 30 | #elif defined(PSP) |
| 31 | return new PspPlatform(); |
| 32 | #elif defined(__3DS__) |
| 33 | return new N3dsPlatform(); |
| 34 | #elif defined(__wii__) |
| 35 | return new WiiPlatform(); |
| 36 | #elif defined(__SWITCH__) |
| 37 | return new SwitchPlatform(); |
| 38 | #elif defined(__vita__) |
| 39 | return new VitaPlatform(); |
| 40 | #elif defined(__riscos__) |
| 41 | return new RiscosPlatform(); |
| 42 | #elif defined(__SYMBIAN32__) |
| 43 | return new SymbianPlatform(); |
| 44 | #elif defined(__APPLE__) |
| 45 | return new ApplePlatform(); |
| 46 | #elif defined(__ANDROID__) |
| 47 | return new AndroidPlatform(); |
| 48 | #else |
| 49 | // using the stuff below |
| 50 | return new DefaultPlatform(); |
| 51 | #endif |
| 52 | } |
| 53 | |
| 54 | void IPlatform::AddGamePaths() { |
| 55 | // using __unix__ might add too much |
| 56 | #if (__linux__ && !__ANDROID__) || __FreeBSD__ || __OpenBSD__ |
| 57 | #ifndef PORTABLE |
| 58 | // Only use XDG dirs for installed package |
| 59 | XDGPlatform::AddGamePaths(); |
| 60 | #endif |
| 61 | #endif |
| 62 | } |
| 63 | void IPlatform::ErrorNoDatafiles() { |
| 64 | #if OJ_SDL3 || OJ_SDL2 |
| 65 | SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, |
| 66 | "OpenJazz", |
| 67 | "Unable to find game data files. When launching OpenJazz, \n" |
| 68 | "pass the location of the original game data, eg:\n" |
| 69 | " OpenJazz ~/jazz1", nullptr); |
| 70 | #endif |
| 71 | } |