Added AmigaOS4 port

This commit is contained in:
Andrea Palmatè 2022-02-20 20:16:14 +01:00
parent 7d060ba4f1
commit 6a9600f5cb
14 changed files with 2220 additions and 4 deletions

22
.vscode/c_cpp_properties.json vendored Normal file
View File

@ -0,0 +1,22 @@
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"\\\\wsl.localhost\\Ubuntu\\usr\\ppc-amigaos\\SDK"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.19041.0",
"compilerPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30133\\bin\\Hostx64\\x64\\cl.exe",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "windows-msvc-x64"
}
],
"version": 4
}

8
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,8 @@
{
"files.associations": {
"internal.h": "c",
"platform.h": "c",
"xutility": "c",
"gl.h": "c"
}
}

View File

@ -37,9 +37,10 @@ endif()
cmake_dependent_option(GLFW_BUILD_WIN32 "Build support for Win32" ON "WIN32" OFF) cmake_dependent_option(GLFW_BUILD_WIN32 "Build support for Win32" ON "WIN32" OFF)
cmake_dependent_option(GLFW_BUILD_COCOA "Build support for Cocoa" ON "APPLE" OFF) cmake_dependent_option(GLFW_BUILD_COCOA "Build support for Cocoa" ON "APPLE" OFF)
cmake_dependent_option(GLFW_BUILD_X11 "Build support for X11" ON "UNIX;NOT APPLE" OFF) cmake_dependent_option(GLFW_BUILD_X11 "Build support for X11" ON "UNIX;NOT APPLE;NOT AMIGAOS4" OFF)
cmake_dependent_option(GLFW_BUILD_WAYLAND "Build support for Wayland" cmake_dependent_option(GLFW_BUILD_WAYLAND "Build support for Wayland"
"${GLFW_USE_WAYLAND}" "UNIX;NOT APPLE" OFF) "${GLFW_USE_WAYLAND}" "UNIX;NOT APPLE" OFF)
cmake_dependent_option(GLFW_BUILD_OS4 "Build support for AmigaOS4" ON "AMIGAOS4" OFF)
cmake_dependent_option(GLFW_USE_HYBRID_HPG "Force use of high-performance GPU on hybrid systems" OFF cmake_dependent_option(GLFW_USE_HYBRID_HPG "Force use of high-performance GPU on hybrid systems" OFF
"WIN32" OFF) "WIN32" OFF)
@ -83,6 +84,9 @@ endif()
if (GLFW_BUILD_X11) if (GLFW_BUILD_X11)
message(STATUS "Including X11 support") message(STATUS "Including X11 support")
endif() endif()
if (GLFW_BUILD_OS4)
message(STATUS "Including AmigaOS4 support")
endif()
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Apply Microsoft C runtime library option # Apply Microsoft C runtime library option

View File

@ -1301,6 +1301,7 @@ extern "C" {
#define GLFW_PLATFORM_WAYLAND 0x00060003 #define GLFW_PLATFORM_WAYLAND 0x00060003
#define GLFW_PLATFORM_X11 0x00060004 #define GLFW_PLATFORM_X11 0x00060004
#define GLFW_PLATFORM_NULL 0x00060005 #define GLFW_PLATFORM_NULL 0x00060005
#define GLFW_PLATFORM_OS4 0x00060006
/*! @} */ /*! @} */
#define GLFW_DONT_CARE -1 #define GLFW_DONT_CARE -1

View File

@ -62,6 +62,11 @@ if (GLFW_BUILD_X11 OR GLFW_BUILD_WAYLAND)
endif() endif()
endif() endif()
if (GLFW_BUILD_OS4)
target_compile_definitions(glfw PRIVATE _GLFW_OS4)
target_sources(glfw PRIVATE os4_init.c os4_window.c os4_monitor.c os4_context.c os4_joystick.c)
endif()
if (GLFW_BUILD_WAYLAND) if (GLFW_BUILD_WAYLAND)
include(CheckIncludeFiles) include(CheckIncludeFiles)
include(CheckFunctionExists) include(CheckFunctionExists)
@ -159,6 +164,11 @@ if (GLFW_BUILD_WIN32)
list(APPEND glfw_PKG_LIBS "-lgdi32") list(APPEND glfw_PKG_LIBS "-lgdi32")
endif() endif()
if (GLFW_BUILD_OS4)
target_compile_options(glfw PRIVATE "-DGL4ES" "-gstabs")
target_link_libraries(glfw PRIVATE "-lGL4ES")
endif()
if (GLFW_BUILD_COCOA) if (GLFW_BUILD_COCOA)
target_link_libraries(glfw PRIVATE "-framework Cocoa" target_link_libraries(glfw PRIVATE "-framework Cocoa"
"-framework IOKit" "-framework IOKit"

158
src/os4_context.c Normal file
View File

@ -0,0 +1,158 @@
//========================================================================
// GLFW 3.4 WGL - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.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.
//
//========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include "internal.h"
#include <stdlib.h>
#ifndef GL4ES
#include <proto/ogles2.h>
#include <GLES2/gl2.h>
#define GETPROCADDRESS getProcAddressGL
#else
enum CreateContextTags {
OGLES2_CCT_MIN=(1UL<<31),
OGLES2_CCT_WINDOW,
OGLES2_CCT_MODEID,
OGLES2_CCT_DEPTH,
OGLES2_CCT_STENCIL,
OGLES2_CCT_VSYNC,
OGLES2_CCT_SINGLE_GET_ERROR_MODE,
OGLES2_CCT_GET_WIDTH,
OGLES2_CCT_GET_HEIGHT,
OGLES2_CCT_BITMAP,
OGLES2_CCT_SHADER_COMPAT_PATCH,
OGLES2_CCT_CONTEXT_FOR_MODEID,
OGLES2_CCT_RESIZE_VIEWPORT,
OGLES2_CCT_DEBUG_SHADER_LOG,
};
typedef int GLint;
typedef int GLsizei;
extern void aglMakeCurrent(void* context);
extern void aglSetParams2(struct TagItem * tags);
extern void aglDestroyContext(void* context);
extern void aglMakeCurrent(void* context);
extern void aglSwapBuffers();
extern void glFinish();
extern void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
extern void *aglCreateContext2(ULONG * errcode, struct TagItem * tags);
extern void *gl4es_aglGetProcAddress(const char *name);
extern void gl4es_glXSwapInterval(int interval);
#define GETPROCADDRESS gl4es_aglGetProcAddress
extern struct OGLES2IFace *IOGLES2;
#endif
static void makeContextCurrentGL(_GLFWwindow* window)
{
if (window)
{
aglMakeCurrent(window->context.gl.glContext);
_glfwPlatformSetTls(&_glfw.contextSlot, window);
}
}
static void destroyContextGL(_GLFWwindow* window) {
if (window->context.gl.glContext) {
printf("Destroying context %p for window handle %p\n", window->context.gl.glContext, window->os4.handle);
aglDestroyContext(window->context.gl.glContext);
}
window->context.gl.glContext = NULL;
}
static void swapBuffersGL(_GLFWwindow* window)
{
// First flush the render pipeline, so that everything gets drawn
glFinish();
// Swap the buffers (if any)
aglSwapBuffers();
}
static GLFWglproc getProcAddressGL(const char* procname)
{
const GLFWglproc proc = (GLFWglproc) aglGetProcAddress(procname);
return proc;
}
static int extensionSupportedGL(const char* extension)
{
// TODO - Implement this
return GLFW_FALSE;
}
static void swapIntervalGL(int interval)
{
// TODO - Should we implement this?
}
// Create the OpenGL or OpenGL ES context
//
GLFWbool _glfwCreateContextGL(_GLFWwindow* window,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig)
{
ULONG errCode;
struct TagItem contextparams[] =
{
{OGLES2_CCT_WINDOW,(ULONG)window->os4.handle},
/*
{OGLES2_CCT_DEPTH,_this->gl_config.depth_size},
{OGLES2_CCT_STENCIL,_this->gl_config.stencil_size},
*/
{OGLES2_CCT_VSYNC,0},
{TAG_DONE,0}
};
window->context.gl.glContext = (void *)aglCreateContext2(&errCode, contextparams);
/* Set the context as current */
if (window->context.gl.glContext) {
aglMakeCurrent(window->context.gl.glContext);
}
else {
IIntuition->CloseWindow(window->os4.handle);
window->os4.handle = NULL;
return GLFW_FALSE;
}
printf("Creating context %p for window handle %p\n", window->context.gl.glContext, window->os4.handle);
window->context.makeCurrent = makeContextCurrentGL;
window->context.swapBuffers = swapBuffersGL;
window->context.swapInterval = swapIntervalGL;
window->context.extensionSupported = extensionSupportedGL;
window->context.getProcAddress = GETPROCADDRESS;
window->context.destroy = destroyContextGL;
return GLFW_TRUE;
}

505
src/os4_init.c Normal file
View File

@ -0,0 +1,505 @@
//========================================================================
// GLFW 3.4 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2016 Google Inc.
// Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.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.
//
//========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
extern struct Library *DOSBase;
extern struct DOSIFace *IDOS;
struct GraphicsIFace *IGraphics = NULL;
struct Library *GfxBase = NULL;
struct IntuitionIFace *IIntuition = NULL;
struct Library *IntuitionBase = NULL;
struct KeymapIFace *IKeymap = NULL;
struct Library *KeymapBase = NULL;
struct UtilityIFace *IUtility = NULL;
struct Library *UtilityBase = NULL;
struct Library *AIN_Base = NULL;
struct AIN_IFace *IAIN = NULL;
struct Device *TimerBase = NULL;
struct TimerIFace *ITimer = NULL;
#ifndef GL4ES
struct Library *OGLES2Base = NULL;
struct OGLES2IFace *IOGLES2 = NULL;
#else
extern struct OGLES2IFace *IOGLES2;
#endif
//************************************************************************
//**** OS4 internal functions ****
//************************************************************************
BOOL VARARGS68K showErrorRequester(const char *errMsgRaw, ...)
{
va_list ap;
va_startlinear(ap, errMsgRaw);
ULONG *errMsgArgs = va_getlinearva(ap, ULONG *);
Object *object = NULL;
if (IIntuition)
{
object = IIntuition->NewObject(
NULL, "requester.class",
REQ_Type, REQTYPE_INFO,
REQ_TitleText, "GLFW: FATAL ERROR",
REQ_BodyText, errMsgRaw,
REQ_VarArgs, errMsgArgs,
REQ_Image, REQIMAGE_ERROR,
REQ_GadgetText, "_Ok",
TAG_DONE);
}
if (object)
{
IIntuition->IDoMethod(object, RM_OPENREQ, NULL, NULL, NULL, TAG_DONE);
IIntuition->DisposeObject(object);
return TRUE;
}
else
{
return FALSE;
}
}
static struct Library *openLib(const char *libName, unsigned int minVers, struct Interface **iFacePtr)
{
struct Library *libBase = IExec->OpenLibrary(libName, minVers);
if (libBase)
{
struct Interface *iFace = IExec->GetInterface(libBase, "main", 1, NULL);
if (!iFace)
{
// Failed
//CloseLibrary(libBase);
libBase = NULL; // Lets the code below know we've failed
}
if (iFacePtr)
{
// Write the interface pointer
*iFacePtr = iFace;
}
}
else
{
// Opening the library failed. Show the error requester
const char errMsgRaw[] = "Couldn't open %s version %u+.\n";
if (!showErrorRequester(errMsgRaw, libName, minVers))
{
// Use printf() as a backup
printf(errMsgRaw, libName, minVers);
}
}
return libBase;
}
static int loadLibraries(void)
{
// graphics.library
DOSBase = openLib("dos.library", 52, (struct Interface **)&IDOS);
if (!DOSBase)
{
return 0;
}
// graphics.library
GfxBase = openLib("graphics.library", 52, (struct Interface **)&IGraphics);
if (!GfxBase)
{
return 0;
}
// intuition.library
IntuitionBase = openLib("intuition.library", 52, (struct Interface **)&IIntuition);
if (!IntuitionBase)
{
return 0;
}
// keymap.library
KeymapBase = openLib("keymap.library", 52, (struct Interface **)&IKeymap);
if (!KeymapBase)
{
return 0;
}
// Utility.library
UtilityBase = openLib("utility.library", 52, (struct Interface **)&IUtility);
if (!UtilityBase)
{
return 0;
}
#ifndef GL4ES
OGLES2Base = openLib("ogles2.library", MIN_OGLES2_VERSION, (struct Interface **)&IOGLES2);
if (!OGLES2Base)
{
return 0;
}
#endif
AIN_Base = openLib("AmigaInput.library", 51, (struct Interface **)&IAIN);
if (!AIN_Base)
{
return 0;
}
return 1;
}
static void closeLibraries(void)
{
printf("close libraries\n");
if (IAIN)
{
IExec->DropInterface((struct Interface *)IAIN);
}
if (AIN_Base)
{
IExec->CloseLibrary(AIN_Base);
}
#ifndef GL4ES
if (IOGLES2)
{
IExec->DropInterface((struct Interface *)IOGLES2);
}
if (OGLES2Base)
{
IExec->CloseLibrary(OGLES2Base);
}
#endif
// Close graphics.library
if (IGraphics)
{
IExec->DropInterface((struct Interface *)IGraphics);
IGraphics = NULL;
}
if (GfxBase)
{
IExec->CloseLibrary((struct Library *)GfxBase);
GfxBase = NULL;
}
// Close intuition.library
if (IIntuition)
{
IExec->DropInterface((struct Interface *)IIntuition);
IIntuition = NULL;
}
if (IntuitionBase)
{
IExec->CloseLibrary((struct Library *)IntuitionBase);
IntuitionBase = NULL;
}
// Close keymap.library
if (IKeymap)
{
IExec->DropInterface((struct Interface *)IKeymap);
IKeymap = NULL;
}
if (KeymapBase)
{
IExec->CloseLibrary(KeymapBase);
KeymapBase = NULL;
}
// Close utility.library
if (IUtility)
{
IExec->DropInterface((struct Interface *)IUtility);
IUtility = NULL;
}
if (UtilityBase)
{
IExec->CloseLibrary((struct Library *)UtilityBase);
UtilityBase = NULL;
}
}
static void createKeyTables(void)
{
memset(_glfw.os4.keycodes, -1, sizeof(_glfw.os4.keycodes));
memset(_glfw.os4.scancodes, -1, sizeof(_glfw.os4.scancodes));
_glfw.os4.keycodes[0xb] = GLFW_KEY_GRAVE_ACCENT;
_glfw.os4.keycodes[0x1] = GLFW_KEY_1;
_glfw.os4.keycodes[0x2] = GLFW_KEY_2;
_glfw.os4.keycodes[0x3] = GLFW_KEY_3;
_glfw.os4.keycodes[0x4] = GLFW_KEY_4;
_glfw.os4.keycodes[0x5] = GLFW_KEY_5;
_glfw.os4.keycodes[0x6] = GLFW_KEY_6;
_glfw.os4.keycodes[0x7] = GLFW_KEY_7;
_glfw.os4.keycodes[0x8] = GLFW_KEY_8;
_glfw.os4.keycodes[0x9] = GLFW_KEY_9;
_glfw.os4.keycodes[0xa] = GLFW_KEY_0;
_glfw.os4.keycodes[0x40] = GLFW_KEY_SPACE; //
_glfw.os4.keycodes[0x3a] = GLFW_KEY_MINUS;
_glfw.os4.keycodes[0xc] = GLFW_KEY_EQUAL;
_glfw.os4.keycodes[0x10] = GLFW_KEY_Q;
_glfw.os4.keycodes[0x11] = GLFW_KEY_W;
_glfw.os4.keycodes[0x12] = GLFW_KEY_E;
_glfw.os4.keycodes[0x13] = GLFW_KEY_R;
_glfw.os4.keycodes[0x14] = GLFW_KEY_T;
_glfw.os4.keycodes[0x15] = GLFW_KEY_Y;
_glfw.os4.keycodes[0x16] = GLFW_KEY_U;
_glfw.os4.keycodes[0x17] = GLFW_KEY_I;
_glfw.os4.keycodes[0x18] = GLFW_KEY_O;
_glfw.os4.keycodes[0x19] = GLFW_KEY_P;
_glfw.os4.keycodes[0x1a] = GLFW_KEY_LEFT_BRACKET;
_glfw.os4.keycodes[0x1b] = GLFW_KEY_RIGHT_BRACKET;
_glfw.os4.keycodes[0x20] = GLFW_KEY_A;
_glfw.os4.keycodes[0x21] = GLFW_KEY_S;
_glfw.os4.keycodes[0x22] = GLFW_KEY_D;
_glfw.os4.keycodes[0x23] = GLFW_KEY_F;
_glfw.os4.keycodes[0x24] = GLFW_KEY_G;
_glfw.os4.keycodes[0x25] = GLFW_KEY_H;
_glfw.os4.keycodes[0x26] = GLFW_KEY_J;
_glfw.os4.keycodes[0x27] = GLFW_KEY_K;
_glfw.os4.keycodes[0x28] = GLFW_KEY_L;
//_glfw.os4.keycodes[KEY_SEMICOLON] = GLFW_KEY_SEMICOLON;
//_glfw.os4.keycodes[KEY_APOSTROPHE] = GLFW_KEY_APOSTROPHE;
_glfw.os4.keycodes[0x31] = GLFW_KEY_Z;
_glfw.os4.keycodes[0x32] = GLFW_KEY_X;
_glfw.os4.keycodes[0x33] = GLFW_KEY_C;
_glfw.os4.keycodes[0x34] = GLFW_KEY_V;
_glfw.os4.keycodes[0x35] = GLFW_KEY_B;
_glfw.os4.keycodes[0x36] = GLFW_KEY_N;
_glfw.os4.keycodes[0x37] = GLFW_KEY_M;
_glfw.os4.keycodes[0x38] = GLFW_KEY_COMMA;
_glfw.os4.keycodes[0x39] = GLFW_KEY_PERIOD;
_glfw.os4.keycodes[0x3a] = GLFW_KEY_SLASH;
_glfw.os4.keycodes[0x0] = GLFW_KEY_BACKSLASH;
_glfw.os4.keycodes[RAWKEY_ESC] = GLFW_KEY_ESCAPE; //
_glfw.os4.keycodes[RAWKEY_TAB] = GLFW_KEY_TAB; //
_glfw.os4.keycodes[RAWKEY_LSHIFT] = GLFW_KEY_LEFT_SHIFT; //
_glfw.os4.keycodes[RAWKEY_RSHIFT] = GLFW_KEY_RIGHT_SHIFT; //
_glfw.os4.keycodes[RAWKEY_LCTRL] = GLFW_KEY_LEFT_CONTROL; //
_glfw.os4.keycodes[RAWKEY_LCTRL] = GLFW_KEY_RIGHT_CONTROL;
_glfw.os4.keycodes[RAWKEY_LALT] = GLFW_KEY_LEFT_ALT; //
_glfw.os4.keycodes[RAWKEY_RALT] = GLFW_KEY_RIGHT_ALT; //
_glfw.os4.keycodes[RAWKEY_LCOMMAND] = GLFW_KEY_LEFT_SUPER; //
_glfw.os4.keycodes[RAWKEY_RCOMMAND] = GLFW_KEY_RIGHT_SUPER;
_glfw.os4.keycodes[RAWKEY_MENU] = GLFW_KEY_MENU; //
//_glfw.os4.keycodes[KEY_NUMLOCK] = GLFW_KEY_NUM_LOCK;
_glfw.os4.keycodes[RAWKEY_CAPSLOCK] = GLFW_KEY_CAPS_LOCK; //
_glfw.os4.keycodes[RAWKEY_BREAK] = GLFW_KEY_PRINT_SCREEN;
_glfw.os4.keycodes[0x5f] = GLFW_KEY_SCROLL_LOCK;
_glfw.os4.keycodes[RAWKEY_BREAK] = GLFW_KEY_PAUSE;
_glfw.os4.keycodes[RAWKEY_DEL] = GLFW_KEY_DELETE; //
_glfw.os4.keycodes[RAWKEY_BACKSPACE] = GLFW_KEY_BACKSPACE; //
_glfw.os4.keycodes[RAWKEY_RETURN] = GLFW_KEY_ENTER; //
_glfw.os4.keycodes[RAWKEY_HOME] = GLFW_KEY_HOME; //
_glfw.os4.keycodes[RAWKEY_END] = GLFW_KEY_END; //
_glfw.os4.keycodes[RAWKEY_PAGEUP] = GLFW_KEY_PAGE_UP; //
_glfw.os4.keycodes[RAWKEY_PAGEDOWN] = GLFW_KEY_PAGE_DOWN; //
_glfw.os4.keycodes[RAWKEY_INSERT] = GLFW_KEY_INSERT; //
_glfw.os4.keycodes[RAWKEY_CRSRLEFT] = GLFW_KEY_LEFT;
_glfw.os4.keycodes[RAWKEY_CRSRRIGHT] = GLFW_KEY_RIGHT; //
_glfw.os4.keycodes[RAWKEY_CRSRDOWN] = GLFW_KEY_DOWN; //
_glfw.os4.keycodes[RAWKEY_CRSRUP] = GLFW_KEY_UP; //
_glfw.os4.keycodes[RAWKEY_F1] = GLFW_KEY_F1; //
_glfw.os4.keycodes[RAWKEY_F2] = GLFW_KEY_F2; //
_glfw.os4.keycodes[RAWKEY_F3] = GLFW_KEY_F3; //
_glfw.os4.keycodes[RAWKEY_F4] = GLFW_KEY_F4; //
_glfw.os4.keycodes[RAWKEY_F5] = GLFW_KEY_F5; //
_glfw.os4.keycodes[RAWKEY_F6] = GLFW_KEY_F6; //
_glfw.os4.keycodes[RAWKEY_F7] = GLFW_KEY_F7; //
_glfw.os4.keycodes[RAWKEY_F8] = GLFW_KEY_F8; //
_glfw.os4.keycodes[RAWKEY_F9] = GLFW_KEY_F9; //
_glfw.os4.keycodes[RAWKEY_F10] = GLFW_KEY_F10; //
_glfw.os4.keycodes[RAWKEY_F11] = GLFW_KEY_F11; //
_glfw.os4.keycodes[RAWKEY_F12] = GLFW_KEY_F12; //
_glfw.os4.keycodes[RAWKEY_F13] = GLFW_KEY_F13; //
_glfw.os4.keycodes[RAWKEY_F14] = GLFW_KEY_F14; //
_glfw.os4.keycodes[RAWKEY_F15] = GLFW_KEY_F15; //
_glfw.os4.keycodes[RAWKEY_HELP] = GLFW_KEY_F16; // Mapped amiga HELP key with F16
_glfw.os4.keycodes[0x5c] = GLFW_KEY_KP_DIVIDE;
_glfw.os4.keycodes[0x5d] = GLFW_KEY_KP_MULTIPLY;
_glfw.os4.keycodes[0x4a] = GLFW_KEY_KP_SUBTRACT;
_glfw.os4.keycodes[0x5e] = GLFW_KEY_KP_ADD;
_glfw.os4.keycodes[0xf] = GLFW_KEY_KP_0;
_glfw.os4.keycodes[0x1d] = GLFW_KEY_KP_1;
_glfw.os4.keycodes[0x1e] = GLFW_KEY_KP_2;
_glfw.os4.keycodes[0x1f] = GLFW_KEY_KP_3;
_glfw.os4.keycodes[0x2d] = GLFW_KEY_KP_4;
_glfw.os4.keycodes[0x2e] = GLFW_KEY_KP_5;
_glfw.os4.keycodes[0x2f] = GLFW_KEY_KP_6;
_glfw.os4.keycodes[0x3d] = GLFW_KEY_KP_7;
_glfw.os4.keycodes[0x3e] = GLFW_KEY_KP_8;
_glfw.os4.keycodes[0x3f] = GLFW_KEY_KP_9;
_glfw.os4.keycodes[0x3c] = GLFW_KEY_KP_DECIMAL;
/*
_glfw.os4.keycodes[KEY_KPEQUAL] = GLFW_KEY_KP_EQUAL;
*/
_glfw.os4.keycodes[RAWKEY_ENTER] = GLFW_KEY_KP_ENTER; //
for (int scancode = 0; scancode < 256; scancode++)
{
if (_glfw.os4.keycodes[scancode] > 0)
_glfw.os4.scancodes[_glfw.os4.keycodes[scancode]] = scancode;
}
}
//////////////////////////////////////////////////////////////////////////
////// GLFW platform API //////
//////////////////////////////////////////////////////////////////////////
GLFWbool _glfwConnectOS4(int platformID, _GLFWplatform *platform)
{
const _GLFWplatform os4 =
{
GLFW_PLATFORM_OS4,
_glfwInitOS4,
_glfwTerminateOS4,
_glfwGetCursorPosOS4,
_glfwSetCursorPosOS4,
_glfwSetCursorModeOS4,
_glfwSetRawMouseMotionOS4,
_glfwRawMouseMotionSupportedOS4,
_glfwCreateCursorOS4,
_glfwCreateStandardCursorOS4,
_glfwDestroyCursorOS4,
_glfwSetCursorOS4,
_glfwGetScancodeNameOS4,
_glfwGetKeyScancodeOS4,
_glfwSetClipboardStringOS4,
_glfwGetClipboardStringOS4,
_glfwInitJoysticksOS4,
_glfwTerminateJoysticksOS4,
_glfwPollJoystickOS4,
_glfwGetMappingNameOS4,
_glfwUpdateGamepadGUIDOS4,
_glfwFreeMonitorOS4,
_glfwGetMonitorPosOS4,
_glfwGetMonitorContentScaleOS4,
_glfwGetMonitorWorkareaOS4,
_glfwGetVideoModesOS4,
_glfwGetVideoModeOS4,
_glfwGetGammaRampOS4,
_glfwSetGammaRampOS4,
_glfwCreateWindowOS4,
_glfwDestroyWindowOS4,
_glfwSetWindowTitleOS4,
_glfwSetWindowIconOS4,
_glfwGetWindowPosOS4,
_glfwSetWindowPosOS4,
_glfwGetWindowSizeOS4,
_glfwSetWindowSizeOS4,
_glfwSetWindowSizeLimitsOS4,
_glfwSetWindowAspectRatioOS4,
_glfwGetFramebufferSizeOS4,
_glfwGetWindowFrameSizeOS4,
_glfwGetWindowContentScaleOS4,
_glfwIconifyWindowOS4,
_glfwRestoreWindowOS4,
_glfwMaximizeWindowOS4,
_glfwShowWindowOS4,
_glfwHideWindowOS4,
_glfwRequestWindowAttentionOS4,
_glfwFocusWindowOS4,
_glfwSetWindowMonitorOS4,
_glfwWindowFocusedOS4,
_glfwWindowIconifiedOS4,
_glfwWindowVisibleOS4,
_glfwWindowMaximizedOS4,
_glfwWindowHoveredOS4,
_glfwFramebufferTransparentOS4,
_glfwGetWindowOpacityOS4,
_glfwSetWindowResizableOS4,
_glfwSetWindowDecoratedOS4,
_glfwSetWindowFloatingOS4,
_glfwSetWindowOpacityOS4,
_glfwSetWindowMousePassthroughOS4,
_glfwPollEventsOS4,
_glfwWaitEventsOS4,
_glfwWaitEventsTimeoutOS4,
_glfwPostEmptyEventOS4,
_glfwGetRequiredInstanceExtensionsOS4,
_glfwGetPhysicalDevicePresentationSupportOS4,
_glfwCreateWindowSurfaceOS4,
};
*platform = os4;
return GLFW_TRUE;
}
int _glfwInitOS4(void)
{
loadLibraries();
createKeyTables();
_glfwPollMonitorsOS4();
if (!(_glfw.os4.userPort = IExec->AllocSysObjectTags(ASOT_PORT, TAG_DONE))) {
return GLFW_FALSE;
}
if (!(_glfw.os4.appMsgPort = IExec->AllocSysObjectTags(ASOT_PORT, TAG_DONE))) {
return GLFW_FALSE;
}
return GLFW_TRUE;
}
void _glfwTerminateOS4(void)
{
if (_glfw.os4.appMsgPort) {
struct Message *msg;
while ((msg = IExec->GetMsg(_glfw.os4.appMsgPort))) {
IExec->ReplyMsg((struct Message *) msg);
}
IExec->FreeSysObject(ASOT_PORT, _glfw.os4.appMsgPort);
}
if (_glfw.os4.userPort) {
struct Message *msg;
while ((msg = IExec->GetMsg(_glfw.os4.userPort))) {
IExec->ReplyMsg((struct Message *) msg);
}
IExec->FreeSysObject(ASOT_PORT, _glfw.os4.userPort);
}
free(_glfw.os4.clipboardString);
//_glfwTerminateOSMesa();
closeLibraries();
}

58
src/os4_joystick.c Normal file
View File

@ -0,0 +1,58 @@
//========================================================================
// GLFW 3.4 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.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.
//
//========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h"
//////////////////////////////////////////////////////////////////////////
////// GLFW platform API //////
//////////////////////////////////////////////////////////////////////////
GLFWbool _glfwInitJoysticksOS4(void)
{
return GLFW_TRUE;
}
void _glfwTerminateJoysticksOS4(void)
{
}
int _glfwPollJoystickOS4(_GLFWjoystick* js, int mode)
{
return GLFW_FALSE;
}
const char* _glfwGetMappingNameOS4(void)
{
return "";
}
void _glfwUpdateGamepadGUIDOS4(char* guid)
{
}

166
src/os4_monitor.c Normal file
View File

@ -0,0 +1,166 @@
//========================================================================
// GLFW 3.4 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2016 Google Inc.
// Copyright (c) 2016-2019 Camilla Löwy <elmindreda@glfw.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.
//
//========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
#include "internal.h"
#include <stdlib.h>
#include <string.h>
#include <math.h>
// The the sole (fake) video mode of our (sole) fake monitor
//
static GLFWvidmode getVideoMode(void)
{
struct Screen* currentScreen = IIntuition->LockPubScreen(NULL);
GLFWvidmode mode;
mode.width = currentScreen->Width;
mode.height = currentScreen->Height;
// TODO - Change this
mode.redBits = 8;
mode.greenBits = 8;
mode.blueBits = 8;
mode.refreshRate = 60;
IIntuition->UnlockPubScreen(NULL, currentScreen);
return mode;
}
//////////////////////////////////////////////////////////////////////////
////// GLFW internal API //////
//////////////////////////////////////////////////////////////////////////
void _glfwPollMonitorsOS4(void)
{
const float dpi = 141.f;
const GLFWvidmode mode = getVideoMode();
_GLFWmonitor* monitor = _glfwAllocMonitor("OS4 Monitor 0",
(int) (mode.width * 25.4f / dpi),
(int) (mode.height * 25.4f / dpi));
_glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_FIRST);
}
//////////////////////////////////////////////////////////////////////////
////// GLFW platform API //////
//////////////////////////////////////////////////////////////////////////
void _glfwFreeMonitorOS4(_GLFWmonitor* monitor)
{
_glfwFreeGammaArrays(&monitor->os4.ramp);
}
void _glfwGetMonitorPosOS4(_GLFWmonitor* monitor, int* xpos, int* ypos)
{
if (xpos)
*xpos = 0;
if (ypos)
*ypos = 0;
}
void _glfwGetMonitorContentScaleOS4(_GLFWmonitor* monitor,
float* xscale, float* yscale)
{
if (xscale)
*xscale = 1.f;
if (yscale)
*yscale = 1.f;
}
void _glfwGetMonitorWorkareaOS4(_GLFWmonitor* monitor,
int* xpos, int* ypos,
int* width, int* height)
{
const GLFWvidmode mode = getVideoMode();
if (xpos)
*xpos = 0;
if (ypos)
*ypos = 10;
if (width)
*width = mode.width;
if (height)
*height = mode.height - 10;
}
GLFWvidmode* _glfwGetVideoModesOS4(_GLFWmonitor* monitor, int* found)
{
GLFWvidmode* mode = _glfw_calloc(1, sizeof(GLFWvidmode));
*mode = getVideoMode();
*found = 1;
return mode;
}
void _glfwGetVideoModeOS4(_GLFWmonitor* monitor, GLFWvidmode* mode)
{
*mode = getVideoMode();
}
GLFWbool _glfwGetGammaRampOS4(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
{
if (!monitor->os4.ramp.size)
{
unsigned int i;
_glfwAllocGammaArrays(&monitor->os4.ramp, 256);
for (i = 0; i < monitor->os4.ramp.size; i++)
{
const float gamma = 2.2f;
float value;
value = i / (float) (monitor->os4.ramp.size - 1);
value = powf(value, 1.f / gamma) * 65535.f + 0.5f;
value = _glfw_fminf(value, 65535.f);
monitor->os4.ramp.red[i] = (unsigned short) value;
monitor->os4.ramp.green[i] = (unsigned short) value;
monitor->os4.ramp.blue[i] = (unsigned short) value;
}
}
_glfwAllocGammaArrays(ramp, monitor->os4.ramp.size);
memcpy(ramp->red, monitor->os4.ramp.red, sizeof(short) * ramp->size);
memcpy(ramp->green, monitor->os4.ramp.green, sizeof(short) * ramp->size);
memcpy(ramp->blue, monitor->os4.ramp.blue, sizeof(short) * ramp->size);
return GLFW_TRUE;
}
void _glfwSetGammaRampOS4(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
{
if (monitor->os4.ramp.size != ramp->size)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"OS4: Gamma ramp size must match current ramp size");
return;
}
memcpy(monitor->os4.ramp.red, ramp->red, sizeof(short) * ramp->size);
memcpy(monitor->os4.ramp.green, ramp->green, sizeof(short) * ramp->size);
memcpy(monitor->os4.ramp.blue, ramp->blue, sizeof(short) * ramp->size);
}

236
src/os4_platform.h Normal file
View File

@ -0,0 +1,236 @@
//========================================================================
// GLFW 3.4 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2016 Google Inc.
// Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.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.
//
//========================================================================
#pragma once
// Include files
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/intuition.h>
#include <proto/graphics.h>
#include <proto/timer.h>
#include <proto/keymap.h>
#include <proto/utility.h>
#include <proto/requester.h>
#include <exec/exec.h>
#include <dos/dos.h>
#include <dos/dostags.h>
#include <dos/dosextens.h>
#include <intuition/intuition.h>
#include <graphics/displayinfo.h>
#include <graphics/rastport.h>
#include <devices/timer.h>
#include <devices/keymap.h>
#include <devices/input.h>
#include <devices/inputevent.h>
#include <devices/gameport.h>
#include <classes/requester.h>
#include <amigainput/amigainput.h>
#include <proto/amigainput.h>
/* GL Stuff */
#ifndef GL4ES
#include <proto/ogles2.h>
#include <proto/minigl.h>
#endif
#define MIN_MINIGLVERSION 2
#define MIN_OGLES2_VERSION 0
#define GLFW_OS4_WINDOW_STATE _GLFWwindowOS4 os4;
#define GLFW_OS4_LIBRARY_WINDOW_STATE _GLFWlibraryOS4 os4;
#define GLFW_OS4_MONITOR_STATE _GLFWmonitorOS4 os4;
#define GLFW_OS4_CONTEXT_STATE _GLFWcontextGL gl;
#define GLFW_OS4_CURSOR_STATE _GLFWcursorOS4 os4;
#define GLFW_OS4_LIBRARY_CONTEXT_STATE
struct MyIntuiMessage
{
uint32 Class;
uint16 Code;
uint16 Qualifier;
struct Gadget *Gadget;
struct Window *IDCMPWindow;
int16 RelativeMouseX;
int16 RelativeMouseY;
int16 WindowMouseX; // Absolute pointer position, relative to
int16 WindowMouseY; // top-left corner of inner window
int16 ScreenMouseX;
int16 ScreenMouseY;
int16 Width; // Inner window dimensions
int16 Height;
};
// OS4-specific per-window data
//
typedef struct _GLFWwindowOS4
{
struct Window *handle;
int xpos;
int ypos;
int lastCursorPosX;
int lastCursorPosY;
int width;
int height;
char *title;
GLFWbool visible;
GLFWbool iconified;
GLFWbool maximized;
GLFWbool resizable;
GLFWbool decorated;
GLFWbool floating;
GLFWbool transparent;
float opacity;
int windowType; // NORMAL - GL - GLES
} _GLFWwindowOS4;
typedef struct _GLFWcontextGL {
struct BitMap *bm;
void* glContext;
} _GLFWcontextGL;
// OS4-specific per-monitor data
//
typedef struct _GLFWmonitorOS4
{
GLFWgammaramp ramp;
} _GLFWmonitorOS4;
// X11-specific per-cursor data
//
typedef struct _GLFWcursorX11
{
Object *handle;
uint32_t *imageData;
} _GLFWcursorOS4;
// OS4-specific global data
//
typedef struct _GLFWlibraryOS4
{
int xcursor;
int ycursor;
char keynames[GLFW_KEY_LAST + 1][17];
short int keycodes[256];
short int scancodes[GLFW_KEY_LAST + 1];
char *clipboardString;
struct MsgPort *appMsgPort;
struct MsgPort *userPort;
_GLFWwindow *focusedWindow;
} _GLFWlibraryOS4;
void _glfwPollMonitorsOS4(void);
GLFWbool _glfwConnectOS4(int platformID, _GLFWplatform* platform);
int _glfwInitOS4(void);
void _glfwTerminateOS4(void);
void _glfwFreeMonitorOS4(_GLFWmonitor* monitor);
void _glfwGetMonitorPosOS4(_GLFWmonitor* monitor, int* xpos, int* ypos);
void _glfwGetMonitorContentScaleOS4(_GLFWmonitor* monitor, float* xscale, float* yscale);
void _glfwGetMonitorWorkareaOS4(_GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
GLFWvidmode* _glfwGetVideoModesOS4(_GLFWmonitor* monitor, int* found);
void _glfwGetVideoModeOS4(_GLFWmonitor* monitor, GLFWvidmode* mode);
GLFWbool _glfwGetGammaRampOS4(_GLFWmonitor* monitor, GLFWgammaramp* ramp);
void _glfwSetGammaRampOS4(_GLFWmonitor* monitor, const GLFWgammaramp* ramp);
int _glfwCreateWindowOS4(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig);
void _glfwDestroyWindowOS4(_GLFWwindow* window);
void _glfwSetWindowTitleOS4(_GLFWwindow* window, const char* title);
void _glfwSetWindowIconOS4(_GLFWwindow* window, int count, const GLFWimage* images);
void _glfwSetWindowMonitorOS4(_GLFWwindow* window, _GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
void _glfwGetWindowPosOS4(_GLFWwindow* window, int* xpos, int* ypos);
void _glfwSetWindowPosOS4(_GLFWwindow* window, int xpos, int ypos);
void _glfwGetWindowSizeOS4(_GLFWwindow* window, int* width, int* height);
void _glfwSetWindowSizeOS4(_GLFWwindow* window, int width, int height);
void _glfwSetWindowSizeLimitsOS4(_GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
void _glfwSetWindowAspectRatioOS4(_GLFWwindow* window, int n, int d);
void _glfwGetFramebufferSizeOS4(_GLFWwindow* window, int* width, int* height);
void _glfwGetWindowFrameSizeOS4(_GLFWwindow* window, int* left, int* top, int* right, int* bottom);
void _glfwGetWindowContentScaleOS4(_GLFWwindow* window, float* xscale, float* yscale);
void _glfwIconifyWindowOS4(_GLFWwindow* window);
void _glfwRestoreWindowOS4(_GLFWwindow* window);
void _glfwMaximizeWindowOS4(_GLFWwindow* window);
int _glfwWindowMaximizedOS4(_GLFWwindow* window);
int _glfwWindowHoveredOS4(_GLFWwindow* window);
int _glfwFramebufferTransparentOS4(_GLFWwindow* window);
void _glfwSetWindowResizableOS4(_GLFWwindow* window, GLFWbool enabled);
void _glfwSetWindowDecoratedOS4(_GLFWwindow* window, GLFWbool enabled);
void _glfwSetWindowFloatingOS4(_GLFWwindow* window, GLFWbool enabled);
void _glfwSetWindowMousePassthroughOS4(_GLFWwindow* window, GLFWbool enabled);
float _glfwGetWindowOpacityOS4(_GLFWwindow* window);
void _glfwSetWindowOpacityOS4(_GLFWwindow* window, float opacity);
void _glfwSetRawMouseMotionOS4(_GLFWwindow *window, GLFWbool enabled);
GLFWbool _glfwRawMouseMotionSupportedOS4(void);
void _glfwShowWindowOS4(_GLFWwindow* window);
void _glfwRequestWindowAttentionOS4(_GLFWwindow* window);
void _glfwRequestWindowAttentionOS4(_GLFWwindow* window);
void _glfwHideWindowOS4(_GLFWwindow* window);
void _glfwFocusWindowOS4(_GLFWwindow* window);
int _glfwWindowFocusedOS4(_GLFWwindow* window);
int _glfwWindowIconifiedOS4(_GLFWwindow* window);
int _glfwWindowVisibleOS4(_GLFWwindow* window);
void _glfwPollEventsOS4(void);
void _glfwWaitEventsOS4(void);
void _glfwWaitEventsTimeoutOS4(double timeout);
void _glfwPostEmptyEventOS4(void);
void _glfwGetCursorPosOS4(_GLFWwindow* window, double* xpos, double* ypos);
void _glfwSetCursorPosOS4(_GLFWwindow* window, double x, double y);
void _glfwSetCursorModeOS4(_GLFWwindow* window, int mode);
int _glfwCreateCursorOS4(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot);
int _glfwCreateStandardCursorOS4(_GLFWcursor* cursor, int shape);
void _glfwDestroyCursorOS4(_GLFWcursor* cursor);
void _glfwSetCursorOS4(_GLFWwindow* window, _GLFWcursor* cursor);
void _glfwSetClipboardStringOS4(const char* string);
const char* _glfwGetClipboardStringOS4(void);
const char* _glfwGetScancodeNameOS4(int scancode);
int _glfwGetKeyScancodeOS4(int key);
GLFWbool _glfwInitJoysticksOS4(void);
void _glfwTerminateJoysticksOS4(void);
int _glfwPollJoystickOS4(_GLFWjoystick* js, int mode);
const char* _glfwGetMappingNameOS4(void);
void _glfwUpdateGamepadGUIDOS4(char* guid);
void _glfwGetRequiredInstanceExtensionsOS4(char** extensions);
int _glfwGetPhysicalDevicePresentationSupportOS4(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
VkResult _glfwCreateWindowSurfaceOS4(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
void _glfwPollMonitorsOS4(void);

1026
src/os4_window.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -51,6 +51,9 @@ static const struct
#if defined(_GLFW_WAYLAND) #if defined(_GLFW_WAYLAND)
{ GLFW_PLATFORM_WAYLAND, _glfwConnectWayland }, { GLFW_PLATFORM_WAYLAND, _glfwConnectWayland },
#endif #endif
#if defined(_GLFW_OS4)
{ GLFW_PLATFORM_OS4, _glfwConnectOS4 },
#endif
}; };
GLFWbool _glfwSelectPlatform(int desiredID, _GLFWplatform* platform) GLFWbool _glfwSelectPlatform(int desiredID, _GLFWplatform* platform)
@ -63,7 +66,8 @@ GLFWbool _glfwSelectPlatform(int desiredID, _GLFWplatform* platform)
desiredID != GLFW_PLATFORM_COCOA && desiredID != GLFW_PLATFORM_COCOA &&
desiredID != GLFW_PLATFORM_WAYLAND && desiredID != GLFW_PLATFORM_WAYLAND &&
desiredID != GLFW_PLATFORM_X11 && desiredID != GLFW_PLATFORM_X11 &&
desiredID != GLFW_PLATFORM_NULL) desiredID != GLFW_PLATFORM_NULL &&
desiredID != GLFW_PLATFORM_OS4)
{ {
_glfwInputError(GLFW_INVALID_ENUM, "Invalid platform ID 0x%08X", desiredID); _glfwInputError(GLFW_INVALID_ENUM, "Invalid platform ID 0x%08X", desiredID);
return GLFW_FALSE; return GLFW_FALSE;

View File

@ -69,6 +69,17 @@
#define GLFW_GLX_LIBRARY_CONTEXT_STATE #define GLFW_GLX_LIBRARY_CONTEXT_STATE
#endif #endif
#if defined(_GLFW_OS4)
#include "os4_platform.h"
#else
#define GLFW_OS4_WINDOW_STATE
#define GLFW_OS4_MONITOR_STATE
#define GLFW_OS4_CURSOR_STATE
#define GLFW_OS4_LIBRARY_WINDOW_STATE
#define GLFW_GLX_CONTEXT_STATE
#define GLFW_GLX_LIBRARY_CONTEXT_STATE
#endif
#include "null_joystick.h" #include "null_joystick.h"
#if defined(_GLFW_WIN32) #if defined(_GLFW_WIN32)
@ -122,6 +133,7 @@
GLFW_WAYLAND_WINDOW_STATE \ GLFW_WAYLAND_WINDOW_STATE \
GLFW_X11_WINDOW_STATE \ GLFW_X11_WINDOW_STATE \
GLFW_NULL_WINDOW_STATE \ GLFW_NULL_WINDOW_STATE \
GLFW_OS4_WINDOW_STATE \
#define GLFW_PLATFORM_MONITOR_STATE \ #define GLFW_PLATFORM_MONITOR_STATE \
GLFW_WIN32_MONITOR_STATE \ GLFW_WIN32_MONITOR_STATE \
@ -129,6 +141,7 @@
GLFW_WAYLAND_MONITOR_STATE \ GLFW_WAYLAND_MONITOR_STATE \
GLFW_X11_MONITOR_STATE \ GLFW_X11_MONITOR_STATE \
GLFW_NULL_MONITOR_STATE \ GLFW_NULL_MONITOR_STATE \
GLFW_OS4_MONITOR_STATE \
#define GLFW_PLATFORM_CURSOR_STATE \ #define GLFW_PLATFORM_CURSOR_STATE \
GLFW_WIN32_CURSOR_STATE \ GLFW_WIN32_CURSOR_STATE \
@ -136,6 +149,7 @@
GLFW_WAYLAND_CURSOR_STATE \ GLFW_WAYLAND_CURSOR_STATE \
GLFW_X11_CURSOR_STATE \ GLFW_X11_CURSOR_STATE \
GLFW_NULL_CURSOR_STATE \ GLFW_NULL_CURSOR_STATE \
GLFW_OS4_CURSOR_STATE \
#define GLFW_PLATFORM_JOYSTICK_STATE \ #define GLFW_PLATFORM_JOYSTICK_STATE \
GLFW_WIN32_JOYSTICK_STATE \ GLFW_WIN32_JOYSTICK_STATE \
@ -156,6 +170,7 @@
GLFW_WAYLAND_LIBRARY_WINDOW_STATE \ GLFW_WAYLAND_LIBRARY_WINDOW_STATE \
GLFW_X11_LIBRARY_WINDOW_STATE \ GLFW_X11_LIBRARY_WINDOW_STATE \
GLFW_NULL_LIBRARY_WINDOW_STATE \ GLFW_NULL_LIBRARY_WINDOW_STATE \
GLFW_OS4_LIBRARY_WINDOW_STATE \
#define GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE \ #define GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE \
GLFW_WIN32_LIBRARY_JOYSTICK_STATE \ GLFW_WIN32_LIBRARY_JOYSTICK_STATE \
@ -170,10 +185,12 @@
#define GLFW_PLATFORM_CONTEXT_STATE \ #define GLFW_PLATFORM_CONTEXT_STATE \
GLFW_WGL_CONTEXT_STATE \ GLFW_WGL_CONTEXT_STATE \
GLFW_NSGL_CONTEXT_STATE \ GLFW_NSGL_CONTEXT_STATE \
GLFW_GLX_CONTEXT_STATE GLFW_GLX_CONTEXT_STATE \
GLFW_OS4_CONTEXT_STATE
#define GLFW_PLATFORM_LIBRARY_CONTEXT_STATE \ #define GLFW_PLATFORM_LIBRARY_CONTEXT_STATE \
GLFW_WGL_LIBRARY_CONTEXT_STATE \ GLFW_WGL_LIBRARY_CONTEXT_STATE \
GLFW_NSGL_LIBRARY_CONTEXT_STATE \ GLFW_NSGL_LIBRARY_CONTEXT_STATE \
GLFW_GLX_LIBRARY_CONTEXT_STATE GLFW_GLX_LIBRARY_CONTEXT_STATE \
GLFW_OS4_LIBRARY_CONTEXT_STATE \

View File

@ -148,6 +148,7 @@ int main(void)
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
thrd_join(threads[i].id, &result); thrd_join(threads[i].id, &result);
glfwTerminate();
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }