mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-22 23:06:18 +00:00
Reorganizing Mac and Linux blocks and commence on retina support
This commit is contained in:
parent
b3e3bdba30
commit
85da9ff7e8
8 changed files with 49 additions and 55 deletions
|
|
@ -20,5 +20,9 @@
|
||||||
<string>public.app-category.games</string>
|
<string>public.app-category.games</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
<string>10.7</string>
|
<string>10.7</string>
|
||||||
|
<key>NSPrincipalClass</key>
|
||||||
|
<string>NSApplication</string>
|
||||||
|
<key>NSHighResolutionCapable</key>
|
||||||
|
<string>True</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
|
||||||
BIN
OneShot.app/Contents/MacOS/oneshot
Executable file
BIN
OneShot.app/Contents/MacOS/oneshot
Executable file
Binary file not shown.
Binary file not shown.
|
|
@ -64,7 +64,7 @@ void Config::read(int argc, char *argv[])
|
||||||
PO_DESC(printFPS, bool, false) \
|
PO_DESC(printFPS, bool, false) \
|
||||||
PO_DESC(fullscreen, bool, false) \
|
PO_DESC(fullscreen, bool, false) \
|
||||||
PO_DESC(fixedAspectRatio, bool, true) \
|
PO_DESC(fixedAspectRatio, bool, true) \
|
||||||
PO_DESC(smoothScaling, bool, false) \
|
PO_DESC(smoothScaling, bool, true) \
|
||||||
PO_DESC(vsync, bool, true) \
|
PO_DESC(vsync, bool, true) \
|
||||||
PO_DESC(fixedFramerate, int, 0) \
|
PO_DESC(fixedFramerate, int, 0) \
|
||||||
PO_DESC(frameSkip, bool, true) \
|
PO_DESC(frameSkip, bool, true) \
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,8 @@
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
typedef void (ALC_APIENTRY *LPALCDEVICEPAUSESOFT) (ALCdevice *device);
|
typedef void (ALC_APIENTRY *LPALCDEVICEPAUSESOFT) (ALCdevice *device);
|
||||||
typedef void (ALC_APIENTRY *LPALCDEVICERESUMESOFT) (ALCdevice *device);
|
typedef void (ALC_APIENTRY *LPALCDEVICERESUMESOFT) (ALCdevice *device);
|
||||||
|
|
||||||
|
|
@ -173,7 +175,7 @@ void EventThread::process(RGSSThreadData &rtData)
|
||||||
std::map<int, SDL_Joystick*>::iterator jsit;
|
std::map<int, SDL_Joystick*>::iterator jsit;
|
||||||
std::map<int, SDL_GameController*>::iterator gcit;
|
std::map<int, SDL_GameController*>::iterator gcit;
|
||||||
|
|
||||||
SDL_GetWindowSize(win, &winW, &winH);
|
SDL_GetWindowSize(win, &winW, &winH); // SDL_GL_GetDrawableSize(win, &winW, &winH);
|
||||||
|
|
||||||
SettingsMenu *sMenu = 0;
|
SettingsMenu *sMenu = 0;
|
||||||
|
|
||||||
|
|
@ -226,6 +228,8 @@ void EventThread::process(RGSSThreadData &rtData)
|
||||||
winW = event.window.data1;
|
winW = event.window.data1;
|
||||||
winH = event.window.data2;
|
winH = event.window.data2;
|
||||||
|
|
||||||
|
//SDL_GL_GetDrawableSize(win, &winW, &winH);
|
||||||
|
|
||||||
windowSizeMsg.post(Vec2i(winW, winH));
|
windowSizeMsg.post(Vec2i(winW, winH));
|
||||||
resetInputStates();
|
resetInputStates();
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,10 @@
|
||||||
#include <stack>
|
#include <stack>
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
#define OS_OSX
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef OS_OSX
|
||||||
#include <iconv.h>
|
#include <iconv.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -354,7 +358,7 @@ struct CacheEnumData
|
||||||
FileSystemPrivate *p;
|
FileSystemPrivate *p;
|
||||||
std::stack<std::vector<std::string>*> fileLists;
|
std::stack<std::vector<std::string>*> fileLists;
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef OS_OSX
|
||||||
iconv_t nfd2nfc;
|
iconv_t nfd2nfc;
|
||||||
char buf[512];
|
char buf[512];
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -362,14 +366,14 @@ struct CacheEnumData
|
||||||
CacheEnumData(FileSystemPrivate *p)
|
CacheEnumData(FileSystemPrivate *p)
|
||||||
: p(p)
|
: p(p)
|
||||||
{
|
{
|
||||||
#ifdef __APPLE__
|
#ifdef OS_OSX
|
||||||
nfd2nfc = iconv_open("utf-8", "utf-8-mac");
|
nfd2nfc = iconv_open("utf-8", "utf-8-mac");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
~CacheEnumData()
|
~CacheEnumData()
|
||||||
{
|
{
|
||||||
#ifdef __APPLE__
|
#ifdef OS_OSX
|
||||||
iconv_close(nfd2nfc);
|
iconv_close(nfd2nfc);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
@ -377,7 +381,7 @@ struct CacheEnumData
|
||||||
/* Converts in-place */
|
/* Converts in-place */
|
||||||
void toNFC(char *inout)
|
void toNFC(char *inout)
|
||||||
{
|
{
|
||||||
#ifdef __APPLE__
|
#ifdef OS_OSX
|
||||||
size_t srcSize = strlen(inout);
|
size_t srcSize = strlen(inout);
|
||||||
size_t bufSize = sizeof(buf);
|
size_t bufSize = sizeof(buf);
|
||||||
char *bufPtr = buf;
|
char *bufPtr = buf;
|
||||||
|
|
|
||||||
|
|
@ -255,7 +255,7 @@ int main(int argc, char *argv[])
|
||||||
SDL_Surface *iconImg = IMG_Load_RW(iconSrc, SDL_TRUE);
|
SDL_Surface *iconImg = IMG_Load_RW(iconSrc, SDL_TRUE);
|
||||||
|
|
||||||
SDL_Window *win;
|
SDL_Window *win;
|
||||||
Uint32 winFlags = SDL_WINDOW_OPENGL | SDL_WINDOW_INPUT_FOCUS;
|
Uint32 winFlags = SDL_WINDOW_OPENGL | SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_RESIZABLE; //| SDL_WINDOW_ALLOW_HIGHDPI;
|
||||||
|
|
||||||
if (conf.fullscreen)
|
if (conf.fullscreen)
|
||||||
winFlags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
|
winFlags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
|
||||||
|
|
@ -308,7 +308,7 @@ int main(int argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int winW, winH;
|
int winW, winH;
|
||||||
SDL_GetWindowSize(win, &winW, &winH);
|
SDL_GetWindowSize(win, &winW, &winH); // SDL_GL_GetDrawableSize(win, &winW, &winH);
|
||||||
rtData.windowSizeMsg.post(Vec2i(winW, winH));
|
rtData.windowSizeMsg.post(Vec2i(winW, winH));
|
||||||
|
|
||||||
/* Load and post key bindings */
|
/* Load and post key bindings */
|
||||||
|
|
|
||||||
|
|
@ -19,18 +19,16 @@
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
#include <SDL2/SDL_syswm.h>
|
#include <SDL2/SDL_syswm.h>
|
||||||
#elif defined __APPLE__ || __linux__
|
#elif defined __APPLE__ || __linux__
|
||||||
#ifdef __APPLE__
|
|
||||||
#define OS_OSX
|
|
||||||
#else
|
|
||||||
#define OS_LINUX
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
|
||||||
#ifdef OS_LINUX
|
#ifdef __APPLE__
|
||||||
|
#define OS_OSX
|
||||||
|
#else
|
||||||
|
#define OS_LINUX
|
||||||
|
|
||||||
class GtkWidget;
|
class GtkWidget;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
|
@ -426,41 +424,24 @@ Oneshot::Oneshot(RGSSThreadData &threadData) :
|
||||||
else
|
else
|
||||||
p->lang = "en";
|
p->lang = "en";
|
||||||
|
|
||||||
|
//Get user's name
|
||||||
#ifdef OS_OSX
|
#ifdef OS_OSX
|
||||||
|
|
||||||
//Get user's name
|
|
||||||
struct passwd *pwd = getpwuid(geteuid());
|
struct passwd *pwd = getpwuid(geteuid());
|
||||||
if (pwd)
|
|
||||||
{
|
|
||||||
if (pwd->pw_gecos && pwd->pw_gecos[0] && pwd->pw_gecos[0] != ',')
|
|
||||||
{
|
|
||||||
//Get the user's full name
|
|
||||||
int comma = 0;
|
|
||||||
for (; pwd->pw_gecos[comma] && pwd->pw_gecos[comma] != ','; ++comma) {}
|
|
||||||
p->userName = std::string(pwd->pw_gecos, comma);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
p->userName = pwd->pw_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif defined OS_LINUX
|
#elif defined OS_LINUX
|
||||||
|
|
||||||
//Get user's name
|
|
||||||
struct passwd *pwd = getpwuid(getuid());
|
struct passwd *pwd = getpwuid(getuid());
|
||||||
if (pwd)
|
|
||||||
{
|
|
||||||
if (pwd->pw_gecos && pwd->pw_gecos[0] && pwd->pw_gecos[0] != ',')
|
|
||||||
{
|
|
||||||
//Get the user's full name
|
|
||||||
int comma = 0;
|
|
||||||
for (; pwd->pw_gecos[comma] && pwd->pw_gecos[comma] != ','; ++comma) {}
|
|
||||||
p->userName = std::string(pwd->pw_gecos, comma);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
p->userName = pwd->pw_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
if (pwd)
|
||||||
|
{
|
||||||
|
if (pwd->pw_gecos && pwd->pw_gecos[0] && pwd->pw_gecos[0] != ',')
|
||||||
|
{
|
||||||
|
//Get the user's full name
|
||||||
|
int comma = 0;
|
||||||
|
for (; pwd->pw_gecos[comma] && pwd->pw_gecos[comma] != ','; ++comma) {}
|
||||||
|
p->userName = std::string(pwd->pw_gecos, comma);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
p->userName = pwd->pw_name;
|
||||||
|
}
|
||||||
|
|
||||||
//Get documents path
|
//Get documents path
|
||||||
char *path = xdg_user_dir_lookup_with_fallback("DOCUMENTS", getenv("HOME"));
|
char *path = xdg_user_dir_lookup_with_fallback("DOCUMENTS", getenv("HOME"));
|
||||||
|
|
@ -696,15 +677,16 @@ bool Oneshot::msgbox(int type, const char *body, const char *title)
|
||||||
//Interpret result
|
//Interpret result
|
||||||
return (result == IDOK || result == IDYES);
|
return (result == IDOK || result == IDYES);
|
||||||
#else
|
#else
|
||||||
#if defined OS_LINUX
|
#if defined OS_LINUX
|
||||||
if (p->libgtk)
|
if (p->libgtk)
|
||||||
{
|
{
|
||||||
linux_DialogData data = {p, type, body, title, 0};
|
linux_DialogData data = {p, type, body, title, 0};
|
||||||
p->gdk_threads_add_idle(linux_dialog, &data);
|
p->gdk_threads_add_idle(linux_dialog, &data);
|
||||||
p->gtk_main();
|
p->gtk_main();
|
||||||
return data.result;
|
return data.result;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//SDL message box
|
//SDL message box
|
||||||
|
|
||||||
//Button data
|
//Button data
|
||||||
|
|
@ -716,7 +698,7 @@ bool Oneshot::msgbox(int type, const char *body, const char *title)
|
||||||
|
|
||||||
//Messagebox data
|
//Messagebox data
|
||||||
SDL_MessageBoxData data;
|
SDL_MessageBoxData data;
|
||||||
data.window = p->window;
|
data.window = NULL;//p->window;
|
||||||
data.colorScheme = 0;
|
data.colorScheme = 0;
|
||||||
data.title = title;
|
data.title = title;
|
||||||
data.message = body;
|
data.message = body;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue