First Commit
This commit is contained in:
7
externals/sdl2/SDL/src/main/android/SDL_android_main.c
vendored
Normal file
7
externals/sdl2/SDL/src/main/android/SDL_android_main.c
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/*
|
||||
SDL_android_main.c, placed in the public domain by Sam Lantinga 3/13/14
|
||||
|
||||
As of SDL 2.0.6 this file is no longer necessary.
|
||||
*/
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
25
externals/sdl2/SDL/src/main/dummy/SDL_dummy_main.c
vendored
Normal file
25
externals/sdl2/SDL/src/main/dummy/SDL_dummy_main.c
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
SDL_dummy_main.c, placed in the public domain by Sam Lantinga 3/13/14
|
||||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
/* Include the SDL main definition header */
|
||||
#include "SDL_main.h"
|
||||
|
||||
#ifdef main
|
||||
#undef main
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
return (SDL_main(argc, argv));
|
||||
}
|
||||
#else
|
||||
/* Nothing to do on this platform */
|
||||
int
|
||||
SDL_main_stub_symbol(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
41
externals/sdl2/SDL/src/main/gdk/SDL_gdk_main.c
vendored
Normal file
41
externals/sdl2/SDL/src/main/gdk/SDL_gdk_main.c
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "SDL_config.h"
|
||||
|
||||
/* Include this so we define UNICODE properly */
|
||||
#include "../../core/windows/SDL_windows.h"
|
||||
|
||||
/* Include the SDL main definition header */
|
||||
#include "SDL.h"
|
||||
#include "SDL_main.h"
|
||||
|
||||
#ifdef main
|
||||
# undef main
|
||||
#endif /* main */
|
||||
|
||||
/* This is where execution begins */
|
||||
int WINAPI
|
||||
WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
|
||||
{
|
||||
return SDL_GDKRunApp(SDL_main, NULL);
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
431
externals/sdl2/SDL/src/main/haiku/SDL_BApp.h
vendored
Normal file
431
externals/sdl2/SDL/src/main/haiku/SDL_BApp.h
vendored
Normal file
@@ -0,0 +1,431 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#ifndef SDL_BAPP_H
|
||||
#define SDL_BAPP_H
|
||||
|
||||
#include <Path.h>
|
||||
#include <InterfaceKit.h>
|
||||
#include <LocaleRoster.h>
|
||||
#if SDL_VIDEO_OPENGL
|
||||
#include <OpenGLKit.h>
|
||||
#endif
|
||||
|
||||
#include "../../video/haiku/SDL_bkeyboard.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#include "SDL_video.h"
|
||||
|
||||
/* Local includes */
|
||||
#include "../../events/SDL_events_c.h"
|
||||
#include "../../video/haiku/SDL_bframebuffer.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
||||
|
||||
|
||||
/* Forward declarations */
|
||||
class SDL_BWin;
|
||||
|
||||
/* Message constants */
|
||||
enum ToSDL {
|
||||
/* Intercepted by BWindow on its way to BView */
|
||||
BAPP_MOUSE_MOVED,
|
||||
BAPP_MOUSE_BUTTON,
|
||||
BAPP_MOUSE_WHEEL,
|
||||
BAPP_KEY,
|
||||
BAPP_REPAINT, /* from _UPDATE_ */
|
||||
/* From BWindow */
|
||||
BAPP_MAXIMIZE, /* from B_ZOOM */
|
||||
BAPP_MINIMIZE,
|
||||
BAPP_RESTORE, /* TODO: IMPLEMENT! */
|
||||
BAPP_SHOW,
|
||||
BAPP_HIDE,
|
||||
BAPP_MOUSE_FOCUS, /* caused by MOUSE_MOVE */
|
||||
BAPP_KEYBOARD_FOCUS, /* from WINDOW_ACTIVATED */
|
||||
BAPP_WINDOW_CLOSE_REQUESTED,
|
||||
BAPP_WINDOW_MOVED,
|
||||
BAPP_WINDOW_RESIZED,
|
||||
BAPP_SCREEN_CHANGED
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* Create a descendant of BApplication */
|
||||
class SDL_BApp : public BApplication {
|
||||
public:
|
||||
SDL_BApp(const char* signature) :
|
||||
BApplication(signature) {
|
||||
#if SDL_VIDEO_OPENGL
|
||||
_current_context = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
virtual ~SDL_BApp() {
|
||||
}
|
||||
|
||||
|
||||
virtual void RefsReceived(BMessage* message) {
|
||||
char filePath[512];
|
||||
entry_ref entryRef;
|
||||
for (int32 i = 0; message->FindRef("refs", i, &entryRef) == B_OK; i++) {
|
||||
BPath referencePath = BPath(&entryRef);
|
||||
SDL_SendDropFile(NULL, referencePath.Path());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* Event-handling functions */
|
||||
virtual void MessageReceived(BMessage* message) {
|
||||
/* Sort out SDL-related messages */
|
||||
switch ( message->what ) {
|
||||
case BAPP_MOUSE_MOVED:
|
||||
_HandleMouseMove(message);
|
||||
break;
|
||||
|
||||
case BAPP_MOUSE_BUTTON:
|
||||
_HandleMouseButton(message);
|
||||
break;
|
||||
|
||||
case BAPP_MOUSE_WHEEL:
|
||||
_HandleMouseWheel(message);
|
||||
break;
|
||||
|
||||
case BAPP_KEY:
|
||||
_HandleKey(message);
|
||||
break;
|
||||
|
||||
case BAPP_REPAINT:
|
||||
_HandleBasicWindowEvent(message, SDL_WINDOWEVENT_EXPOSED);
|
||||
break;
|
||||
|
||||
case BAPP_MAXIMIZE:
|
||||
_HandleBasicWindowEvent(message, SDL_WINDOWEVENT_MAXIMIZED);
|
||||
break;
|
||||
|
||||
case BAPP_MINIMIZE:
|
||||
_HandleBasicWindowEvent(message, SDL_WINDOWEVENT_MINIMIZED);
|
||||
break;
|
||||
|
||||
case BAPP_SHOW:
|
||||
_HandleBasicWindowEvent(message, SDL_WINDOWEVENT_SHOWN);
|
||||
break;
|
||||
|
||||
case BAPP_HIDE:
|
||||
_HandleBasicWindowEvent(message, SDL_WINDOWEVENT_HIDDEN);
|
||||
break;
|
||||
|
||||
case BAPP_MOUSE_FOCUS:
|
||||
_HandleMouseFocus(message);
|
||||
break;
|
||||
|
||||
case BAPP_KEYBOARD_FOCUS:
|
||||
_HandleKeyboardFocus(message);
|
||||
break;
|
||||
|
||||
case BAPP_WINDOW_CLOSE_REQUESTED:
|
||||
_HandleBasicWindowEvent(message, SDL_WINDOWEVENT_CLOSE);
|
||||
break;
|
||||
|
||||
case BAPP_WINDOW_MOVED:
|
||||
_HandleWindowMoved(message);
|
||||
break;
|
||||
|
||||
case BAPP_WINDOW_RESIZED:
|
||||
_HandleWindowResized(message);
|
||||
break;
|
||||
|
||||
case B_LOCALE_CHANGED:
|
||||
SDL_SendLocaleChangedEvent();
|
||||
break;
|
||||
|
||||
case BAPP_SCREEN_CHANGED:
|
||||
/* TODO: Handle screen resize or workspace change */
|
||||
break;
|
||||
|
||||
default:
|
||||
BApplication::MessageReceived(message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Window creation/destruction methods */
|
||||
int32 GetID(SDL_Window *win) {
|
||||
int32 i;
|
||||
for(i = 0; i < _GetNumWindowSlots(); ++i) {
|
||||
if( GetSDLWindow(i) == NULL ) {
|
||||
_SetSDLWindow(win, i);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
/* Expand the vector if all slots are full */
|
||||
if( i == _GetNumWindowSlots() ) {
|
||||
_PushBackWindow(win);
|
||||
return i;
|
||||
}
|
||||
|
||||
/* TODO: error handling */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* FIXME: Bad coding practice, but I can't include SDL_BWin.h here. Is
|
||||
there another way to do this? */
|
||||
void ClearID(SDL_BWin *bwin); /* Defined in SDL_BeApp.cc */
|
||||
|
||||
|
||||
SDL_Window *GetSDLWindow(int32 winID) {
|
||||
return _window_map[winID];
|
||||
}
|
||||
|
||||
#if SDL_VIDEO_OPENGL
|
||||
BGLView *GetCurrentContext() {
|
||||
return _current_context;
|
||||
}
|
||||
|
||||
void SetCurrentContext(BGLView *newContext) {
|
||||
if(_current_context)
|
||||
_current_context->UnlockGL();
|
||||
_current_context = newContext;
|
||||
if (_current_context)
|
||||
_current_context->LockGL();
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
/* Event management */
|
||||
void _HandleBasicWindowEvent(BMessage *msg, int32 sdlEventType) {
|
||||
SDL_Window *win;
|
||||
int32 winID;
|
||||
if(
|
||||
!_GetWinID(msg, &winID)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
win = GetSDLWindow(winID);
|
||||
SDL_SendWindowEvent(win, sdlEventType, 0, 0);
|
||||
}
|
||||
|
||||
void _HandleMouseMove(BMessage *msg) {
|
||||
SDL_Window *win;
|
||||
int32 winID;
|
||||
int32 x = 0, y = 0;
|
||||
if(
|
||||
!_GetWinID(msg, &winID) ||
|
||||
msg->FindInt32("x", &x) != B_OK || /* x movement */
|
||||
msg->FindInt32("y", &y) != B_OK /* y movement */
|
||||
) {
|
||||
return;
|
||||
}
|
||||
win = GetSDLWindow(winID);
|
||||
|
||||
// Simple relative mode support for mouse.
|
||||
if (SDL_GetMouse()->relative_mode) {
|
||||
int winWidth, winHeight, winPosX, winPosY;
|
||||
SDL_GetWindowSize(win, &winWidth, &winHeight);
|
||||
SDL_GetWindowPosition(win, &winPosX, &winPosY);
|
||||
int dx = x - (winWidth / 2);
|
||||
int dy = y - (winHeight / 2);
|
||||
SDL_SendMouseMotion(win, 0, SDL_GetMouse()->relative_mode, dx, dy);
|
||||
set_mouse_position((winPosX + winWidth / 2), (winPosY + winHeight / 2));
|
||||
if (!be_app->IsCursorHidden())
|
||||
be_app->HideCursor();
|
||||
} else {
|
||||
SDL_SendMouseMotion(win, 0, 0, x, y);
|
||||
if (SDL_ShowCursor(-1) && be_app->IsCursorHidden())
|
||||
be_app->ShowCursor();
|
||||
}
|
||||
}
|
||||
|
||||
void _HandleMouseButton(BMessage *msg) {
|
||||
SDL_Window *win;
|
||||
int32 winID;
|
||||
int32 button, state; /* left/middle/right, pressed/released */
|
||||
if(
|
||||
!_GetWinID(msg, &winID) ||
|
||||
msg->FindInt32("button-id", &button) != B_OK ||
|
||||
msg->FindInt32("button-state", &state) != B_OK
|
||||
) {
|
||||
return;
|
||||
}
|
||||
win = GetSDLWindow(winID);
|
||||
SDL_SendMouseButton(win, 0, state, button);
|
||||
}
|
||||
|
||||
void _HandleMouseWheel(BMessage *msg) {
|
||||
SDL_Window *win;
|
||||
int32 winID;
|
||||
int32 xTicks, yTicks;
|
||||
if(
|
||||
!_GetWinID(msg, &winID) ||
|
||||
msg->FindInt32("xticks", &xTicks) != B_OK ||
|
||||
msg->FindInt32("yticks", &yTicks) != B_OK
|
||||
) {
|
||||
return;
|
||||
}
|
||||
win = GetSDLWindow(winID);
|
||||
SDL_SendMouseWheel(win, 0, xTicks, -yTicks, SDL_MOUSEWHEEL_NORMAL);
|
||||
}
|
||||
|
||||
void _HandleKey(BMessage *msg) {
|
||||
int32 scancode, state; /* scancode, pressed/released */
|
||||
if(
|
||||
msg->FindInt32("key-state", &state) != B_OK ||
|
||||
msg->FindInt32("key-scancode", &scancode) != B_OK
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Make sure this isn't a repeated event (key pressed and held) */
|
||||
if(state == SDL_PRESSED && HAIKU_GetKeyState(scancode) == SDL_PRESSED) {
|
||||
return;
|
||||
}
|
||||
HAIKU_SetKeyState(scancode, state);
|
||||
SDL_SendKeyboardKey(state, HAIKU_GetScancodeFromBeKey(scancode));
|
||||
|
||||
if (state == SDL_PRESSED && SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
|
||||
const int8 *keyUtf8;
|
||||
ssize_t count;
|
||||
if (msg->FindData("key-utf8", B_INT8_TYPE, (const void**)&keyUtf8, &count) == B_OK) {
|
||||
char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];
|
||||
SDL_zeroa(text);
|
||||
SDL_memcpy(text, keyUtf8, count);
|
||||
SDL_SendKeyboardText(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _HandleMouseFocus(BMessage *msg) {
|
||||
SDL_Window *win;
|
||||
int32 winID;
|
||||
bool bSetFocus; /* If false, lose focus */
|
||||
if(
|
||||
!_GetWinID(msg, &winID) ||
|
||||
msg->FindBool("focusGained", &bSetFocus) != B_OK
|
||||
) {
|
||||
return;
|
||||
}
|
||||
win = GetSDLWindow(winID);
|
||||
if(bSetFocus) {
|
||||
SDL_SetMouseFocus(win);
|
||||
} else if(SDL_GetMouseFocus() == win) {
|
||||
/* Only lose all focus if this window was the current focus */
|
||||
SDL_SetMouseFocus(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void _HandleKeyboardFocus(BMessage *msg) {
|
||||
SDL_Window *win;
|
||||
int32 winID;
|
||||
bool bSetFocus; /* If false, lose focus */
|
||||
if(
|
||||
!_GetWinID(msg, &winID) ||
|
||||
msg->FindBool("focusGained", &bSetFocus) != B_OK
|
||||
) {
|
||||
return;
|
||||
}
|
||||
win = GetSDLWindow(winID);
|
||||
if(bSetFocus) {
|
||||
SDL_SetKeyboardFocus(win);
|
||||
} else if(SDL_GetKeyboardFocus() == win) {
|
||||
/* Only lose all focus if this window was the current focus */
|
||||
SDL_SetKeyboardFocus(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void _HandleWindowMoved(BMessage *msg) {
|
||||
SDL_Window *win;
|
||||
int32 winID;
|
||||
int32 xPos, yPos;
|
||||
/* Get the window id and new x/y position of the window */
|
||||
if(
|
||||
!_GetWinID(msg, &winID) ||
|
||||
msg->FindInt32("window-x", &xPos) != B_OK ||
|
||||
msg->FindInt32("window-y", &yPos) != B_OK
|
||||
) {
|
||||
return;
|
||||
}
|
||||
win = GetSDLWindow(winID);
|
||||
SDL_SendWindowEvent(win, SDL_WINDOWEVENT_MOVED, xPos, yPos);
|
||||
}
|
||||
|
||||
void _HandleWindowResized(BMessage *msg) {
|
||||
SDL_Window *win;
|
||||
int32 winID;
|
||||
int32 w, h;
|
||||
/* Get the window id ]and new x/y position of the window */
|
||||
if(
|
||||
!_GetWinID(msg, &winID) ||
|
||||
msg->FindInt32("window-w", &w) != B_OK ||
|
||||
msg->FindInt32("window-h", &h) != B_OK
|
||||
) {
|
||||
return;
|
||||
}
|
||||
win = GetSDLWindow(winID);
|
||||
SDL_SendWindowEvent(win, SDL_WINDOWEVENT_RESIZED, w, h);
|
||||
}
|
||||
|
||||
bool _GetWinID(BMessage *msg, int32 *winID) {
|
||||
return msg->FindInt32("window-id", winID) == B_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Vector functions: Wraps vector stuff in case we need to change
|
||||
implementation */
|
||||
void _SetSDLWindow(SDL_Window *win, int32 winID) {
|
||||
_window_map[winID] = win;
|
||||
}
|
||||
|
||||
int32 _GetNumWindowSlots() {
|
||||
return _window_map.size();
|
||||
}
|
||||
|
||||
|
||||
void _PopBackWindow() {
|
||||
_window_map.pop_back();
|
||||
}
|
||||
|
||||
void _PushBackWindow(SDL_Window *win) {
|
||||
_window_map.push_back(win);
|
||||
}
|
||||
|
||||
|
||||
/* Members */
|
||||
std::vector<SDL_Window*> _window_map; /* Keeps track of SDL_Windows by index-id */
|
||||
|
||||
#if SDL_VIDEO_OPENGL
|
||||
BGLView *_current_context;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
158
externals/sdl2/SDL/src/main/haiku/SDL_BeApp.cc
vendored
Normal file
158
externals/sdl2/SDL/src/main/haiku/SDL_BeApp.cc
vendored
Normal file
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if defined(__HAIKU__)
|
||||
|
||||
/* Handle the BeApp specific portions of the application */
|
||||
|
||||
#include <AppKit.h>
|
||||
#include <storage/AppFileInfo.h>
|
||||
#include <storage/Path.h>
|
||||
#include <storage/Entry.h>
|
||||
#include <storage/File.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "SDL_BApp.h" /* SDL_BApp class definition */
|
||||
#include "SDL_BeApp.h"
|
||||
#include "SDL_timer.h"
|
||||
#include "SDL_error.h"
|
||||
|
||||
#include "../../video/haiku/SDL_BWin.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "../../thread/SDL_systhread.h"
|
||||
|
||||
/* Flag to tell whether or not the Be application is active or not */
|
||||
static int SDL_BeAppActive = 0;
|
||||
static SDL_Thread *SDL_AppThread = NULL;
|
||||
|
||||
/* Default application signature */
|
||||
const char *signature = "application/x-SDL-executable";
|
||||
|
||||
static int
|
||||
StartBeApp(void *unused)
|
||||
{
|
||||
BApplication *App;
|
||||
|
||||
// dig resources for correct signature
|
||||
image_info info;
|
||||
int32 cookie = 0;
|
||||
if (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) {
|
||||
BFile f(info.name, O_RDONLY);
|
||||
if (f.InitCheck() == B_OK) {
|
||||
BAppFileInfo app_info(&f);
|
||||
if (app_info.InitCheck() == B_OK) {
|
||||
char sig[B_MIME_TYPE_LENGTH];
|
||||
if (app_info.GetSignature(sig) == B_OK)
|
||||
signature = strndup(sig, B_MIME_TYPE_LENGTH);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
App = new SDL_BApp(signature);
|
||||
|
||||
App->Run();
|
||||
delete App;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Initialize the Be Application, if it's not already started */
|
||||
int
|
||||
SDL_InitBeApp(void)
|
||||
{
|
||||
/* Create the BApplication that handles appserver interaction */
|
||||
if (SDL_BeAppActive <= 0) {
|
||||
SDL_AppThread = SDL_CreateThreadInternal(StartBeApp, "SDLApplication", 0, NULL);
|
||||
if (SDL_AppThread == NULL) {
|
||||
return SDL_SetError("Couldn't create BApplication thread");
|
||||
}
|
||||
|
||||
/* Change working directory to that of executable */
|
||||
app_info info;
|
||||
if (B_OK == be_app->GetAppInfo(&info)) {
|
||||
entry_ref ref = info.ref;
|
||||
BEntry entry;
|
||||
if (B_OK == entry.SetTo(&ref)) {
|
||||
BPath path;
|
||||
if (B_OK == path.SetTo(&entry)) {
|
||||
if (B_OK == path.GetParent(&path)) {
|
||||
chdir(path.Path());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
SDL_Delay(10);
|
||||
} while ((be_app == NULL) || be_app->IsLaunching());
|
||||
|
||||
/* Mark the application active */
|
||||
SDL_BeAppActive = 0;
|
||||
}
|
||||
|
||||
/* Increment the application reference count */
|
||||
++SDL_BeAppActive;
|
||||
|
||||
/* The app is running, and we're ready to go */
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Quit the Be Application, if there's nothing left to do */
|
||||
void
|
||||
SDL_QuitBeApp(void)
|
||||
{
|
||||
/* Decrement the application reference count */
|
||||
--SDL_BeAppActive;
|
||||
|
||||
/* If the reference count reached zero, clean up the app */
|
||||
if (SDL_BeAppActive == 0) {
|
||||
if (SDL_AppThread != NULL) {
|
||||
if (be_app != NULL) { /* Not tested */
|
||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
||||
}
|
||||
SDL_WaitThread(SDL_AppThread, NULL);
|
||||
SDL_AppThread = NULL;
|
||||
}
|
||||
/* be_app should now be NULL since be_app has quit */
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* SDL_BApp functions */
|
||||
void SDL_BApp::ClearID(SDL_BWin *bwin) {
|
||||
_SetSDLWindow(NULL, bwin->GetID());
|
||||
int32 i = _GetNumWindowSlots() - 1;
|
||||
while(i >= 0 && GetSDLWindow(i) == NULL) {
|
||||
_PopBackWindow();
|
||||
--i;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* __HAIKU__ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
41
externals/sdl2/SDL/src/main/haiku/SDL_BeApp.h
vendored
Normal file
41
externals/sdl2/SDL/src/main/haiku/SDL_BeApp.h
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/* Handle the BeApp specific portions of the application */
|
||||
|
||||
/* Initialize the Be Application, if it's not already started */
|
||||
extern int SDL_InitBeApp(void);
|
||||
|
||||
/* Quit the Be Application, if there's nothing left to do */
|
||||
extern void SDL_QuitBeApp(void);
|
||||
|
||||
/* Be Application Signature*/
|
||||
extern const char *signature;
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
62
externals/sdl2/SDL/src/main/n3ds/SDL_n3ds_main.c
vendored
Normal file
62
externals/sdl2/SDL/src/main/n3ds/SDL_n3ds_main.c
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#ifdef __3DS__
|
||||
|
||||
#include "SDL_main.h"
|
||||
#include <3ds.h>
|
||||
|
||||
#ifdef main
|
||||
#undef main
|
||||
#endif
|
||||
|
||||
SDL_FORCE_INLINE void N3DS_Init(void);
|
||||
SDL_FORCE_INLINE void N3DS_Quit(void);
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int result;
|
||||
N3DS_Init();
|
||||
SDL_SetMainReady();
|
||||
result = SDL_main(argc, argv);
|
||||
N3DS_Quit();
|
||||
return result;
|
||||
}
|
||||
|
||||
SDL_FORCE_INLINE void
|
||||
N3DS_Init(void)
|
||||
{
|
||||
osSetSpeedupEnable(true);
|
||||
romfsInit();
|
||||
}
|
||||
|
||||
SDL_FORCE_INLINE void
|
||||
N3DS_Quit(void)
|
||||
{
|
||||
romfsExit();
|
||||
}
|
||||
|
||||
#endif /* __3DS__ */
|
||||
|
||||
/* vi: set sts=4 ts=4 sw=4 expandtab: */
|
||||
93
externals/sdl2/SDL/src/main/nacl/SDL_nacl_main.c
vendored
Normal file
93
externals/sdl2/SDL/src/main/nacl/SDL_nacl_main.c
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_VIDEO_DRIVER_NACL
|
||||
|
||||
/* Include the SDL main definition header */
|
||||
#include "SDL_main.h"
|
||||
|
||||
#include "ppapi_simple/ps_main.h"
|
||||
#include "ppapi_simple/ps_event.h"
|
||||
#include "ppapi_simple/ps_interface.h"
|
||||
#include "nacl_io/nacl_io.h"
|
||||
#include "sys/mount.h"
|
||||
|
||||
extern void NACL_SetScreenResolution(int width, int height, Uint32 format);
|
||||
|
||||
int
|
||||
nacl_main(int argc, char *argv[])
|
||||
{
|
||||
int status;
|
||||
PSEvent* ps_event;
|
||||
PP_Resource event;
|
||||
struct PP_Rect rect;
|
||||
int ready = 0;
|
||||
const PPB_View *ppb_view = PSInterfaceView();
|
||||
|
||||
/* This is started in a worker thread by ppapi_simple! */
|
||||
|
||||
/* Wait for the first PSE_INSTANCE_DIDCHANGEVIEW event before starting the app */
|
||||
|
||||
PSEventSetFilter(PSE_INSTANCE_DIDCHANGEVIEW);
|
||||
while (!ready) {
|
||||
/* Process all waiting events without blocking */
|
||||
while (!ready && (ps_event = PSEventWaitAcquire()) != NULL) {
|
||||
event = ps_event->as_resource;
|
||||
switch(ps_event->type) {
|
||||
/* From DidChangeView, contains a view resource */
|
||||
case PSE_INSTANCE_DIDCHANGEVIEW:
|
||||
ppb_view->GetRect(event, &rect);
|
||||
NACL_SetScreenResolution(rect.size.width, rect.size.height, 0);
|
||||
ready = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
PSEventRelease(ps_event);
|
||||
}
|
||||
}
|
||||
|
||||
/* Do a default httpfs mount on /,
|
||||
* apps can override this by unmounting /
|
||||
* and remounting with the desired configuration
|
||||
*/
|
||||
nacl_io_init_ppapi(PSGetInstanceId(), PSGetInterface);
|
||||
|
||||
umount("/");
|
||||
mount(
|
||||
"", /* source */
|
||||
"/", /* target */
|
||||
"httpfs", /* filesystemtype */
|
||||
0, /* mountflags */
|
||||
""); /* data specific to the html5fs type */
|
||||
|
||||
/* Everything is ready, start the user main function */
|
||||
SDL_SetMainReady();
|
||||
status = SDL_main(argc, argv);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ppapi_simple will start nacl_main in a worker thread */
|
||||
PPAPI_SIMPLE_REGISTER_MAIN(nacl_main);
|
||||
|
||||
#endif /* SDL_VIDEO_DRIVER_NACL */
|
||||
82
externals/sdl2/SDL/src/main/ngage/SDL_ngage_main.cpp
vendored
Normal file
82
externals/sdl2/SDL/src/main/ngage/SDL_ngage_main.cpp
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
SDL_ngage_main.c, originally for SDL 1.2 by Hannu Viitala
|
||||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
/* Include the SDL main definition header */
|
||||
#include "SDL_main.h"
|
||||
|
||||
#include <e32std.h>
|
||||
#include <e32def.h>
|
||||
#include <e32svr.h>
|
||||
#include <e32base.h>
|
||||
#include <estlib.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <w32std.h>
|
||||
#include <apgtask.h>
|
||||
|
||||
#include "SDL_error.h"
|
||||
|
||||
extern "C" int main(int argc, char *argv[]);
|
||||
|
||||
TInt E32Main()
|
||||
{
|
||||
/* Get the clean-up stack */
|
||||
CTrapCleanup* cleanup = CTrapCleanup::New();
|
||||
|
||||
/* Arrange for multi-threaded operation */
|
||||
SpawnPosixServerThread();
|
||||
|
||||
/* Get args and environment */
|
||||
int argc = 0;
|
||||
char** argv = 0;
|
||||
char** envp = 0;
|
||||
|
||||
__crt0(argc,argv,envp);
|
||||
|
||||
/* Start the application! */
|
||||
|
||||
/* Create stdlib */
|
||||
_REENT;
|
||||
|
||||
/* Set process and thread priority and name */
|
||||
|
||||
RThread currentThread;
|
||||
RProcess thisProcess;
|
||||
TParse exeName;
|
||||
exeName.Set(thisProcess.FileName(), NULL, NULL);
|
||||
currentThread.Rename(exeName.Name());
|
||||
currentThread.SetProcessPriority(EPriorityLow);
|
||||
currentThread.SetPriority(EPriorityMuchLess);
|
||||
|
||||
/* Increase heap size */
|
||||
RHeap* newHeap = NULL;
|
||||
RHeap* oldHeap = NULL;
|
||||
TInt heapSize = 7500000;
|
||||
int ret;
|
||||
|
||||
newHeap = User::ChunkHeap(NULL, heapSize, heapSize, KMinHeapGrowBy);
|
||||
|
||||
if (NULL == newHeap)
|
||||
{
|
||||
ret = 3;
|
||||
goto cleanup;
|
||||
}
|
||||
else
|
||||
{
|
||||
oldHeap = User::SwitchHeap(newHeap);
|
||||
/* Call stdlib main */
|
||||
SDL_SetMainReady();
|
||||
ret = SDL_main(argc, argv);
|
||||
}
|
||||
|
||||
cleanup:
|
||||
_cleanup();
|
||||
|
||||
CloseSTDLIB();
|
||||
delete cleanup;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
91
externals/sdl2/SDL/src/main/ps2/SDL_ps2_main.c
vendored
Normal file
91
externals/sdl2/SDL/src/main/ps2/SDL_ps2_main.c
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
SDL_ps2_main.c, fjtrujy@gmail.com
|
||||
*/
|
||||
|
||||
#include "SDL_config.h"
|
||||
|
||||
#ifdef __PS2__
|
||||
|
||||
#include "SDL_main.h"
|
||||
#include "SDL_error.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <kernel.h>
|
||||
#include <sifrpc.h>
|
||||
#include <iopcontrol.h>
|
||||
#include <sbv_patches.h>
|
||||
#include <ps2_fileXio_driver.h>
|
||||
#include <ps2_memcard_driver.h>
|
||||
#include <ps2_usb_driver.h>
|
||||
|
||||
#ifdef main
|
||||
#undef main
|
||||
#endif
|
||||
|
||||
__attribute__((weak))
|
||||
void reset_IOP() {
|
||||
SifInitRpc(0);
|
||||
while(!SifIopReset(NULL, 0)) {
|
||||
}
|
||||
while(!SifIopSync()){
|
||||
}
|
||||
}
|
||||
|
||||
static void prepare_IOP()
|
||||
{
|
||||
reset_IOP();
|
||||
SifInitRpc(0);
|
||||
sbv_patch_enable_lmb();
|
||||
sbv_patch_disable_prefix_check();
|
||||
sbv_patch_fileio();
|
||||
}
|
||||
|
||||
static void init_drivers() {
|
||||
init_memcard_driver(true);
|
||||
init_usb_driver(true);
|
||||
}
|
||||
|
||||
static void deinit_drivers() {
|
||||
deinit_usb_driver(true);
|
||||
deinit_memcard_driver(true);
|
||||
}
|
||||
|
||||
static void waitUntilDeviceIsReady(char *path)
|
||||
{
|
||||
struct stat buffer;
|
||||
int ret = -1;
|
||||
int retries = 50;
|
||||
|
||||
while(ret != 0 && retries > 0) {
|
||||
ret = stat(path, &buffer);
|
||||
/* Wait until the device is ready */
|
||||
nopdelay();
|
||||
|
||||
retries--;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int res;
|
||||
char cwd[FILENAME_MAX];
|
||||
|
||||
prepare_IOP();
|
||||
init_drivers();
|
||||
|
||||
getcwd(cwd, sizeof(cwd));
|
||||
waitUntilDeviceIsReady(cwd);
|
||||
|
||||
res = SDL_main(argc, argv);
|
||||
|
||||
deinit_drivers();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
#endif /* _PS2 */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
67
externals/sdl2/SDL/src/main/psp/SDL_psp_main.c
vendored
Normal file
67
externals/sdl2/SDL/src/main/psp/SDL_psp_main.c
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
SDL_psp_main.c, placed in the public domain by Sam Lantinga 3/13/14
|
||||
*/
|
||||
#include "SDL_config.h"
|
||||
|
||||
#ifdef __PSP__
|
||||
|
||||
#include "SDL_main.h"
|
||||
#include <pspkernel.h>
|
||||
#include <pspthreadman.h>
|
||||
|
||||
#ifdef main
|
||||
#undef main
|
||||
#endif
|
||||
|
||||
/* If application's main() is redefined as SDL_main, and libSDLmain is
|
||||
linked, then this file will create the standard exit callback,
|
||||
define the PSP_MODULE_INFO macro, and exit back to the browser when
|
||||
the program is finished.
|
||||
|
||||
You can still override other parameters in your own code if you
|
||||
desire, such as PSP_HEAP_SIZE_KB, PSP_MAIN_THREAD_ATTR,
|
||||
PSP_MAIN_THREAD_STACK_SIZE, etc.
|
||||
*/
|
||||
|
||||
PSP_MODULE_INFO("SDL App", 0, 1, 0);
|
||||
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_VFPU | THREAD_ATTR_USER);
|
||||
|
||||
int sdl_psp_exit_callback(int arg1, int arg2, void *common)
|
||||
{
|
||||
sceKernelExitGame();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sdl_psp_callback_thread(SceSize args, void *argp)
|
||||
{
|
||||
int cbid;
|
||||
cbid = sceKernelCreateCallback("Exit Callback",
|
||||
sdl_psp_exit_callback, NULL);
|
||||
sceKernelRegisterExitCallback(cbid);
|
||||
sceKernelSleepThreadCB();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sdl_psp_setup_callbacks(void)
|
||||
{
|
||||
int thid;
|
||||
thid = sceKernelCreateThread("update_thread",
|
||||
sdl_psp_callback_thread, 0x11, 0xFA0, 0, 0);
|
||||
if(thid >= 0)
|
||||
sceKernelStartThread(thid, 0, 0);
|
||||
return thid;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
sdl_psp_setup_callbacks();
|
||||
|
||||
SDL_SetMainReady();
|
||||
|
||||
(void)SDL_main(argc, argv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* __PSP__ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
24
externals/sdl2/SDL/src/main/uikit/SDL_uikit_main.c
vendored
Normal file
24
externals/sdl2/SDL/src/main/uikit/SDL_uikit_main.c
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
SDL_uikit_main.c, placed in the public domain by Sam Lantinga 3/18/2019
|
||||
*/
|
||||
|
||||
/* Include the SDL main definition header */
|
||||
#include "SDL_main.h"
|
||||
|
||||
#if defined(__IPHONEOS__) || defined(__TVOS__)
|
||||
|
||||
#ifndef SDL_MAIN_HANDLED
|
||||
#ifdef main
|
||||
#undef main
|
||||
#endif
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
return SDL_UIKitRunApp(argc, argv, SDL_main);
|
||||
}
|
||||
#endif /* !SDL_MAIN_HANDLED */
|
||||
|
||||
#endif /* __IPHONEOS__ || __TVOS__ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
119
externals/sdl2/SDL/src/main/windows/SDL_windows_main.c
vendored
Normal file
119
externals/sdl2/SDL/src/main/windows/SDL_windows_main.c
vendored
Normal file
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
SDL_windows_main.c, placed in the public domain by Sam Lantinga 4/13/98
|
||||
|
||||
The WinMain function -- calls your program's main() function
|
||||
*/
|
||||
#include "SDL_config.h"
|
||||
|
||||
#ifdef __WIN32__
|
||||
|
||||
/* Include this so we define UNICODE properly */
|
||||
#include "../../core/windows/SDL_windows.h"
|
||||
#include <shellapi.h> /* CommandLineToArgvW() */
|
||||
|
||||
/* Include the SDL main definition header */
|
||||
#include "SDL.h"
|
||||
#include "SDL_main.h"
|
||||
|
||||
#ifdef main
|
||||
# undef main
|
||||
#endif /* main */
|
||||
|
||||
/* Pop up an out of memory message, returns to Windows */
|
||||
static BOOL
|
||||
OutOfMemory(void)
|
||||
{
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal Error", "Out of memory - aborting", NULL);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
/* The VC++ compiler needs main/wmain defined */
|
||||
# define console_ansi_main main
|
||||
# if UNICODE
|
||||
# define console_wmain wmain
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Gets the arguments with GetCommandLine, converts them to argc and argv
|
||||
and calls SDL_main */
|
||||
static int
|
||||
main_getcmdline(void)
|
||||
{
|
||||
LPWSTR *argvw;
|
||||
char **argv;
|
||||
int i, argc, result;
|
||||
|
||||
argvw = CommandLineToArgvW(GetCommandLineW(), &argc);
|
||||
if (argvw == NULL) {
|
||||
return OutOfMemory();
|
||||
}
|
||||
|
||||
/* Note that we need to be careful about how we allocate/free memory here.
|
||||
* If the application calls SDL_SetMemoryFunctions(), we can't rely on
|
||||
* SDL_free() to use the same allocator after SDL_main() returns.
|
||||
*/
|
||||
|
||||
/* Parse it into argv and argc */
|
||||
argv = (char **)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (argc + 1) * sizeof(*argv));
|
||||
if (!argv) {
|
||||
return OutOfMemory();
|
||||
}
|
||||
for (i = 0; i < argc; ++i) {
|
||||
DWORD len;
|
||||
char *arg = WIN_StringToUTF8W(argvw[i]);
|
||||
if (!arg) {
|
||||
return OutOfMemory();
|
||||
}
|
||||
len = (DWORD)SDL_strlen(arg);
|
||||
argv[i] = (char *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len + 1);
|
||||
if (!argv[i]) {
|
||||
return OutOfMemory();
|
||||
}
|
||||
SDL_memcpy(argv[i], arg, len);
|
||||
SDL_free(arg);
|
||||
}
|
||||
argv[i] = NULL;
|
||||
LocalFree(argvw);
|
||||
|
||||
SDL_SetMainReady();
|
||||
|
||||
/* Run the application main() code */
|
||||
result = SDL_main(argc, argv);
|
||||
|
||||
/* Free argv, to avoid memory leak */
|
||||
for (i = 0; i < argc; ++i) {
|
||||
HeapFree(GetProcessHeap(), 0, argv[i]);
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, argv);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* This is where execution begins [console apps, ansi] */
|
||||
int
|
||||
console_ansi_main(int argc, char *argv[])
|
||||
{
|
||||
return main_getcmdline();
|
||||
}
|
||||
|
||||
|
||||
#if UNICODE
|
||||
/* This is where execution begins [console apps, unicode] */
|
||||
int
|
||||
console_wmain(int argc, wchar_t *wargv[], wchar_t *wenvp)
|
||||
{
|
||||
return main_getcmdline();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This is where execution begins [windowed apps] */
|
||||
int WINAPI
|
||||
WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
|
||||
{
|
||||
return main_getcmdline();
|
||||
}
|
||||
|
||||
#endif /* __WIN32__ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
38
externals/sdl2/SDL/src/main/windows/version.rc
vendored
Normal file
38
externals/sdl2/SDL/src/main/windows/version.rc
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
#include "winresrc.h"
|
||||
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 2,26,5,0
|
||||
PRODUCTVERSION 2,26,5,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
FILEFLAGS 0x0L
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "\0"
|
||||
VALUE "FileDescription", "SDL\0"
|
||||
VALUE "FileVersion", "2, 26, 5, 0\0"
|
||||
VALUE "InternalName", "SDL\0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2023 Sam Lantinga\0"
|
||||
VALUE "OriginalFilename", "SDL2.dll\0"
|
||||
VALUE "ProductName", "Simple DirectMedia Layer\0"
|
||||
VALUE "ProductVersion", "2, 26, 5, 0\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
BIN
externals/sdl2/SDL/src/main/winrt/SDL2-WinRTResource_BlankCursor.cur
vendored
Normal file
BIN
externals/sdl2/SDL/src/main/winrt/SDL2-WinRTResource_BlankCursor.cur
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 326 B |
3
externals/sdl2/SDL/src/main/winrt/SDL2-WinRTResources.rc
vendored
Normal file
3
externals/sdl2/SDL/src/main/winrt/SDL2-WinRTResources.rc
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "winres.h"
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
5000 CURSOR "SDL2-WinRTResource_BlankCursor.cur"
|
||||
54
externals/sdl2/SDL/src/main/winrt/SDL_winrt_main_NonXAML.cpp
vendored
Normal file
54
externals/sdl2/SDL/src/main/winrt/SDL_winrt_main_NonXAML.cpp
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
SDL_winrt_main_NonXAML.cpp, placed in the public domain by David Ludwig 3/13/14
|
||||
*/
|
||||
|
||||
#include "SDL_main.h"
|
||||
#include <wrl.h>
|
||||
|
||||
/* At least one file in any SDL/WinRT app appears to require compilation
|
||||
with C++/CX, otherwise a Windows Metadata file won't get created, and
|
||||
an APPX0702 build error can appear shortly after linking.
|
||||
|
||||
The following set of preprocessor code forces this file to be compiled
|
||||
as C++/CX, which appears to cause Visual C++ 2012's build tools to
|
||||
create this .winmd file, and will help allow builds of SDL/WinRT apps
|
||||
to proceed without error.
|
||||
|
||||
If other files in an app's project enable C++/CX compilation, then it might
|
||||
be possible for SDL_winrt_main_NonXAML.cpp to be compiled without /ZW,
|
||||
for Visual C++'s build tools to create a winmd file, and for the app to
|
||||
build without APPX0702 errors. In this case, if
|
||||
SDL_WINRT_METADATA_FILE_AVAILABLE is defined as a C/C++ macro, then
|
||||
the #error (to force C++/CX compilation) will be disabled.
|
||||
|
||||
Please note that /ZW can be specified on a file-by-file basis. To do this,
|
||||
right click on the file in Visual C++, click Properties, then change the
|
||||
setting through the dialog that comes up.
|
||||
*/
|
||||
#ifndef SDL_WINRT_METADATA_FILE_AVAILABLE
|
||||
#ifndef __cplusplus_winrt
|
||||
#error SDL_winrt_main_NonXAML.cpp must be compiled with /ZW, otherwise build errors due to missing .winmd files can occur.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Prevent MSVC++ from warning about threading models when defining our
|
||||
custom WinMain. The threading model will instead be set via a direct
|
||||
call to Windows::Foundation::Initialize (rather than via an attributed
|
||||
function).
|
||||
|
||||
To note, this warning (C4447) does not seem to come up unless this file
|
||||
is compiled with C++/CX enabled (via the /ZW compiler flag).
|
||||
*/
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:4447)
|
||||
#endif
|
||||
|
||||
/* Make sure the function to initialize the Windows Runtime gets linked in. */
|
||||
#ifdef _MSC_VER
|
||||
#pragma comment(lib, "runtimeobject.lib")
|
||||
#endif
|
||||
|
||||
int CALLBACK WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
|
||||
{
|
||||
return SDL_WinRTRunApp(SDL_main, NULL);
|
||||
}
|
||||
Reference in New Issue
Block a user