mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-24 05:10:42 -04:00
PS4: Bring makefile up to date
This commit is contained in:
parent
53973d3505
commit
d826461573
@ -1,53 +1,76 @@
|
|||||||
# Package metadata.
|
ifeq ($(strip $(OO_PS4_TOOLCHAIN)),)
|
||||||
TITLE := OpenOrbis Hello World Sample
|
$(error "Please set OO_PS4_TOOLCHAIN in your environment. export OO_PS4_TOOLCHAIN=<path>")
|
||||||
|
endif
|
||||||
|
TOOLCHAIN := $(OO_PS4_TOOLCHAIN)
|
||||||
|
|
||||||
|
.SUFFIXES:
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# Configurable options
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
BUILD_DIR = build/ps4
|
||||||
|
SOURCE_DIRS = src src/ps4 third_party/bearssl
|
||||||
|
|
||||||
|
TARGET = ClassiCube-PS4
|
||||||
|
TITLE := ClassiCube
|
||||||
VERSION := 1.00
|
VERSION := 1.00
|
||||||
TITLE_ID := BREW00083
|
TITLE_ID := BREW00083
|
||||||
CONTENT_ID := IV0000-BREW00083_00-HELLOWORLD000000
|
CONTENT_ID := IV0000-BREW00083_00-HELLOWORLD000000
|
||||||
|
|
||||||
# Libraries linked into the ELF.
|
#---------------------------------------------------------------------------------
|
||||||
|
# Compilable files
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
CPP_FILES = $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.cpp))
|
||||||
|
C_FILES = $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c))
|
||||||
|
OBJS = $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o) $(CPP_FILES:%.cpp=%.o)))
|
||||||
|
|
||||||
|
# Dependency tracking
|
||||||
|
DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d
|
||||||
|
DEPFILES := $(OBJS:%.o=%.d)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# Code generation
|
||||||
|
#--------------------------------------------------------------------------------
|
||||||
LIBS := -lc -lkernel -lc++ -lSceVideoOut -lSceNet
|
LIBS := -lc -lkernel -lc++ -lSceVideoOut -lSceNet
|
||||||
|
|
||||||
# Additional compile flags.
|
|
||||||
#EXTRAFLAGS :=
|
|
||||||
|
|
||||||
# Asset and module directories.
|
|
||||||
LIBMODULES := $(wildcard sce_module/*)
|
|
||||||
|
|
||||||
# You likely won't need to touch anything below this point.
|
|
||||||
|
|
||||||
# Root vars
|
|
||||||
TOOLCHAIN := $(OO_PS4_TOOLCHAIN)
|
|
||||||
PROJDIR := src
|
|
||||||
INTDIR := build-ps4
|
|
||||||
|
|
||||||
# Define objects to build
|
|
||||||
CFILES := $(wildcard $(PROJDIR)/*.c)
|
|
||||||
CPPFILES := $(wildcard $(PROJDIR)/*.cpp)
|
|
||||||
OBJS := $(patsubst $(PROJDIR)/%.c, $(INTDIR)/%.o, $(CFILES)) $(patsubst $(PROJDIR)/%.cpp, $(INTDIR)/%.o, $(CPPFILES))
|
|
||||||
|
|
||||||
# Define final C/C++ flags
|
|
||||||
CFLAGS := --target=x86_64-pc-freebsd12-elf -fPIC -funwind-tables -c $(EXTRAFLAGS) -isysroot $(TOOLCHAIN) -isystem $(TOOLCHAIN)/include -isystem $(TOOLCHAIN)/include/orbis -DPLAT_PS4
|
CFLAGS := --target=x86_64-pc-freebsd12-elf -fPIC -funwind-tables -c $(EXTRAFLAGS) -isysroot $(TOOLCHAIN) -isystem $(TOOLCHAIN)/include -isystem $(TOOLCHAIN)/include/orbis -DPLAT_PS4
|
||||||
CXXFLAGS := $(CFLAGS) -isystem $(TOOLCHAIN)/include/c++/v1
|
CXXFLAGS := $(CFLAGS) -isystem $(TOOLCHAIN)/include/c++/v1
|
||||||
LDFLAGS := -m elf_x86_64 -pie --script $(TOOLCHAIN)/link.x --eh-frame-hdr -L$(TOOLCHAIN)/lib $(LIBS) $(TOOLCHAIN)/lib/crt1.o
|
LDFLAGS := -m elf_x86_64 -pie --script $(TOOLCHAIN)/link.x --eh-frame-hdr -L$(TOOLCHAIN)/lib $(LIBS) $(TOOLCHAIN)/lib/crt1.o
|
||||||
|
|
||||||
# Create the intermediate directory incase it doesn't already exist.
|
|
||||||
_unused := $(shell mkdir -p $(INTDIR))
|
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# Compiler tools
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
CC := clang
|
CC := clang
|
||||||
CCX := clang++
|
CCX := clang++
|
||||||
LD := ld.lld
|
LD := ld.lld
|
||||||
CDIR := linux
|
CDIR := linux
|
||||||
|
|
||||||
all: $(CONTENT_ID).pkg
|
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# Main targets
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
all: $(BUILD_DIR) $(CONTENT_ID).pkg
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(CONTENT_ID).pkg pkg.gp4 pkg/sce_sys/param.sfo eboot.bin \
|
||||||
|
$(BUILD_DIR)/$(PROJDIR).elf $(BUILD_DIR)/$(PROJDIR).oelf $(OBJS)
|
||||||
|
|
||||||
|
$(BUILD_DIR):
|
||||||
|
mkdir -p $(BUILD_DIR)
|
||||||
|
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# Executable generation
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
$(CONTENT_ID).pkg: pkg.gp4
|
$(CONTENT_ID).pkg: pkg.gp4
|
||||||
$(TOOLCHAIN)/bin/$(CDIR)/PkgTool.Core pkg_build $< .
|
$(TOOLCHAIN)/bin/$(CDIR)/PkgTool.Core pkg_build $< .
|
||||||
|
|
||||||
pkg.gp4: eboot.bin
|
pkg.gp4: eboot.bin $(BUILD_DIR)/sce_sys/param.sfo
|
||||||
cd misc/ps4
|
$(TOOLCHAIN)/bin/$(CDIR)/create-gp4 -out $@ --content-id=$(CONTENT_ID) --files "eboot.bin sce_sys/about/right.sprx sce_sys/param.sfo sce_sys/icon0.png"
|
||||||
$(TOOLCHAIN)/bin/$(CDIR)/create-gp4 -out $@ --content-id=$(CONTENT_ID) --files "sce_sys/about/right.sprx sce_sys/param.sfo sce_sys/icon0.png"
|
|
||||||
|
|
||||||
misc/ps4/sce_sys/param.sfo: Makefile
|
$(BUILD_DIR)/sce_sys/param.sfo:
|
||||||
|
mkdir -p $(BUILD_DIR)/sce_sys
|
||||||
$(TOOLCHAIN)/bin/$(CDIR)/PkgTool.Core sfo_new $@
|
$(TOOLCHAIN)/bin/$(CDIR)/PkgTool.Core sfo_new $@
|
||||||
$(TOOLCHAIN)/bin/$(CDIR)/PkgTool.Core sfo_setentry $@ APP_TYPE --type Integer --maxsize 4 --value 1
|
$(TOOLCHAIN)/bin/$(CDIR)/PkgTool.Core sfo_setentry $@ APP_TYPE --type Integer --maxsize 4 --value 1
|
||||||
$(TOOLCHAIN)/bin/$(CDIR)/PkgTool.Core sfo_setentry $@ APP_VER --type Utf8 --maxsize 8 --value '$(VERSION)'
|
$(TOOLCHAIN)/bin/$(CDIR)/PkgTool.Core sfo_setentry $@ APP_VER --type Utf8 --maxsize 8 --value '$(VERSION)'
|
||||||
@ -60,16 +83,32 @@ misc/ps4/sce_sys/param.sfo: Makefile
|
|||||||
$(TOOLCHAIN)/bin/$(CDIR)/PkgTool.Core sfo_setentry $@ TITLE_ID --type Utf8 --maxsize 12 --value '$(TITLE_ID)'
|
$(TOOLCHAIN)/bin/$(CDIR)/PkgTool.Core sfo_setentry $@ TITLE_ID --type Utf8 --maxsize 12 --value '$(TITLE_ID)'
|
||||||
$(TOOLCHAIN)/bin/$(CDIR)/PkgTool.Core sfo_setentry $@ VERSION --type Utf8 --maxsize 8 --value '$(VERSION)'
|
$(TOOLCHAIN)/bin/$(CDIR)/PkgTool.Core sfo_setentry $@ VERSION --type Utf8 --maxsize 8 --value '$(VERSION)'
|
||||||
|
|
||||||
eboot.bin: $(INTDIR) $(OBJS)
|
$(BUILD_DIR)/$(TARGET).elf: $(OBJS)
|
||||||
$(LD) $(INTDIR)/*.o -o $(INTDIR)/$(PROJDIR).elf $(LDFLAGS)
|
$(LD) $(OBJS) -o $(BUILD_DIR)/$(TARGET).elf $(LDFLAGS)
|
||||||
$(TOOLCHAIN)/bin/$(CDIR)/create-fself -in=$(INTDIR)/$(PROJDIR).elf -out=$(INTDIR)/$(PROJDIR).oelf --eboot "eboot.bin" --paid 0x3800000000000011
|
|
||||||
|
|
||||||
$(INTDIR)/%.o: $(PROJDIR)/%.c
|
eboot.bin: $(BUILD_DIR)/$(TARGET).elf
|
||||||
$(CC) $(CFLAGS) -o $@ $<
|
$(TOOLCHAIN)/bin/$(CDIR)/create-fself -in=$(BUILD_DIR)/$(TARGET).elf -out=$(BUILD_DIR)/$(TARGET).oelf --eboot "eboot.bin" --paid 0x3800000000000011
|
||||||
|
|
||||||
$(INTDIR)/%.o: $(PROJDIR)/%.cpp
|
|
||||||
$(CCX) $(CXXFLAGS) -o $@ $<
|
|
||||||
|
|
||||||
clean:
|
#---------------------------------------------------------------------------------
|
||||||
rm -f $(CONTENT_ID).pkg pkg.gp4 pkg/sce_sys/param.sfo eboot.bin \
|
# Object generation
|
||||||
$(INTDIR)/$(PROJDIR).elf $(INTDIR)/$(PROJDIR).oelf $(OBJS)
|
#---------------------------------------------------------------------------------
|
||||||
|
$(BUILD_DIR)/%.o: src/%.c
|
||||||
|
$(CC) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
$(BUILD_DIR)/%.o: src/%.cpp
|
||||||
|
$(CCX) $(CXXFLAGS) $(DEPFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
$(BUILD_DIR)/%.o: src/ps4/%.c
|
||||||
|
$(CC) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
$(BUILD_DIR)/%.o: third_party/bearssl/%.c
|
||||||
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# Dependency tracking
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
$(DEPFILES):
|
||||||
|
|
||||||
|
include $(wildcard $(DEPFILES))
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
#include "../../src/Core.h"
|
#include "../_PlatformBase.h"
|
||||||
#include "../../src/_PlatformBase.h"
|
#include "../Stream.h"
|
||||||
#include "../../src/Stream.h"
|
#include "../SystemFonts.h"
|
||||||
#include "../../src/SystemFonts.h"
|
#include "../Funcs.h"
|
||||||
#include "../../src/Funcs.h"
|
#include "../Utils.h"
|
||||||
#include "../../src/Utils.h"
|
#include "../Errors.h"
|
||||||
#include "../../src/Errors.h"
|
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#define NOSERVICE
|
#define NOSERVICE
|
||||||
@ -14,6 +13,7 @@
|
|||||||
#define UNICODE
|
#define UNICODE
|
||||||
#define _UNICODE
|
#define _UNICODE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
@ -557,43 +557,7 @@ static cc_result Process_RawGetExePath(cc_winstring* path, int* len) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cc_result Process_StartGame2(const cc_string* args, int numArgs) {
|
cc_result Process_StartGame2(const cc_string* args, int numArgs) {
|
||||||
union STARTUPINFO_union {
|
return SetGameArgs(args, numArgs);
|
||||||
STARTUPINFOW wide;
|
|
||||||
STARTUPINFOA ansi;
|
|
||||||
} si = { 0 }; // less compiler warnings this way
|
|
||||||
|
|
||||||
cc_winstring path;
|
|
||||||
cc_string argv; char argvBuffer[NATIVE_STR_LEN];
|
|
||||||
PROCESS_INFORMATION pi = { 0 };
|
|
||||||
cc_winstring raw;
|
|
||||||
cc_result res;
|
|
||||||
int len, i;
|
|
||||||
|
|
||||||
if (Platform_IsSingleProcess()) return SetGameArgs(args, numArgs);
|
|
||||||
|
|
||||||
if ((res = Process_RawGetExePath(&path, &len))) return res;
|
|
||||||
si.wide.cb = sizeof(STARTUPINFOW);
|
|
||||||
|
|
||||||
String_InitArray(argv, argvBuffer);
|
|
||||||
/* Game doesn't actually care about argv[0] */
|
|
||||||
String_AppendConst(&argv, "cc");
|
|
||||||
for (i = 0; i < numArgs; i++)
|
|
||||||
{
|
|
||||||
if (String_IndexOf(&args[i], ' ') >= 0) {
|
|
||||||
String_Format1(&argv, " \"%s\"", &args[i]);
|
|
||||||
} else {
|
|
||||||
String_Format1(&argv, " %s", &args[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Platform_EncodeString(&raw, &argv);
|
|
||||||
|
|
||||||
if (!CreateProcessW(UWP_STRING(&path), UWP_STRING(&raw), NULL, NULL,
|
|
||||||
false, 0, NULL, NULL, &si.wide, &pi)) return GetLastError();
|
|
||||||
|
|
||||||
/* Don't leak memory for process return code */
|
|
||||||
CloseHandle(pi.hProcess);
|
|
||||||
CloseHandle(pi.hThread);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Process_Exit(cc_result code) { ExitProcess(code); }
|
void Process_Exit(cc_result code) { ExitProcess(code); }
|
||||||
|
@ -1,4 +1,11 @@
|
|||||||
#include "../../src/Core.h"
|
#include "../_WindowBase.h"
|
||||||
|
#include "../String.h"
|
||||||
|
#include "../Funcs.h"
|
||||||
|
#include "../Bitmap.h"
|
||||||
|
#include "../Options.h"
|
||||||
|
#include "../Errors.h"
|
||||||
|
#include "../Graphics.h"
|
||||||
|
#include "../Game.h"
|
||||||
|
|
||||||
#include <winrt/Windows.ApplicationModel.DataTransfer.h>
|
#include <winrt/Windows.ApplicationModel.DataTransfer.h>
|
||||||
#include <winrt/Windows.ApplicationModel.h>
|
#include <winrt/Windows.ApplicationModel.h>
|
||||||
@ -23,14 +30,6 @@ using namespace Windows::System;
|
|||||||
using namespace Windows::UI::Core;
|
using namespace Windows::UI::Core;
|
||||||
using namespace Windows::UI::Input;
|
using namespace Windows::UI::Input;
|
||||||
|
|
||||||
#include "../../src/_WindowBase.h"
|
|
||||||
#include "../../src/String.h"
|
|
||||||
#include "../../src/Funcs.h"
|
|
||||||
#include "../../src/Bitmap.h"
|
|
||||||
#include "../../src/Options.h"
|
|
||||||
#include "../../src/Errors.h"
|
|
||||||
#include "../../src/Graphics.h"
|
|
||||||
#include "../../src/Game.h"
|
|
||||||
#define UWP_STRING(str) ((wchar_t*)(str)->uni)
|
#define UWP_STRING(str) ((wchar_t*)(str)->uni)
|
||||||
|
|
||||||
|
|
||||||
@ -326,4 +325,4 @@ int __stdcall wWinMain(void*, void*, wchar_t** argv, int argc)
|
|||||||
{
|
{
|
||||||
auto app = make<CCApp>();
|
auto app = make<CCApp>();
|
||||||
CoreApplication::Run(app);
|
CoreApplication::Run(app);
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,17 @@
|
|||||||
#include "Core.h"
|
|
||||||
#if defined CC_BUILD_PS4
|
|
||||||
|
|
||||||
#define CC_XTEA_ENCRYPTION
|
#define CC_XTEA_ENCRYPTION
|
||||||
#include "_PlatformBase.h"
|
#define CC_NO_UPDATER
|
||||||
#include "Stream.h"
|
#define CC_NO_DYNLIB
|
||||||
#include "ExtMath.h"
|
|
||||||
#include "SystemFonts.h"
|
#include "../_PlatformBase.h"
|
||||||
#include "Funcs.h"
|
#include "../Stream.h"
|
||||||
#include "Window.h"
|
#include "../ExtMath.h"
|
||||||
#include "Utils.h"
|
#include "../SystemFonts.h"
|
||||||
#include "Errors.h"
|
#include "../Funcs.h"
|
||||||
#include "PackedCol.h"
|
#include "../Window.h"
|
||||||
|
#include "../Utils.h"
|
||||||
|
#include "../Errors.h"
|
||||||
|
#include "../PackedCol.h"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -31,7 +32,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <libkernel.h>
|
#include <libkernel.h>
|
||||||
#include "_PlatformConsole.h"
|
#include "../_PlatformConsole.h"
|
||||||
|
|
||||||
const cc_result ReturnCode_FileShareViolation = 1000000000; /* TODO: not used apparently */
|
const cc_result ReturnCode_FileShareViolation = 1000000000; /* TODO: not used apparently */
|
||||||
const cc_result ReturnCode_FileNotFound = ENOENT;
|
const cc_result ReturnCode_FileNotFound = ENOENT;
|
||||||
@ -39,7 +40,6 @@ const cc_result ReturnCode_DirectoryExists = EEXIST;
|
|||||||
const cc_result ReturnCode_SocketInProgess = EINPROGRESS;
|
const cc_result ReturnCode_SocketInProgess = EINPROGRESS;
|
||||||
const cc_result ReturnCode_SocketWouldBlock = EWOULDBLOCK;
|
const cc_result ReturnCode_SocketWouldBlock = EWOULDBLOCK;
|
||||||
const cc_result ReturnCode_SocketDropped = EPIPE;
|
const cc_result ReturnCode_SocketDropped = EPIPE;
|
||||||
#define SUPPORTS_GETADDRINFO 1
|
|
||||||
|
|
||||||
const char* Platform_AppNameSuffix = " PS4";
|
const char* Platform_AppNameSuffix = " PS4";
|
||||||
cc_bool Platform_ReadonlyFilesystem;
|
cc_bool Platform_ReadonlyFilesystem;
|
||||||
@ -182,25 +182,15 @@ static cc_result File_Do(cc_file* file, const char* path, int mode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cc_result File_Open(cc_file* file, const cc_filepath* path) {
|
cc_result File_Open(cc_file* file, const cc_filepath* path) {
|
||||||
#if !defined CC_BUILD_OS2
|
|
||||||
return File_Do(file, path->buffer, O_RDONLY);
|
return File_Do(file, path->buffer, O_RDONLY);
|
||||||
#else
|
|
||||||
return File_Do(file, path->buffer, O_RDONLY | O_BINARY);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_result File_Create(cc_file* file, const cc_filepath* path) {
|
cc_result File_Create(cc_file* file, const cc_filepath* path) {
|
||||||
#if !defined CC_BUILD_OS2
|
|
||||||
return File_Do(file, path->buffer, O_RDWR | O_CREAT | O_TRUNC);
|
return File_Do(file, path->buffer, O_RDWR | O_CREAT | O_TRUNC);
|
||||||
#else
|
|
||||||
return File_Do(file, path->buffer, O_RDWR | O_CREAT | O_TRUNC | O_BINARY);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_result File_OpenOrCreate(cc_file* file, const cc_filepath* path) {
|
cc_result File_OpenOrCreate(cc_file* file, const cc_filepath* path) {
|
||||||
#if !defined CC_BUILD_OS2
|
|
||||||
return File_Do(file, path->buffer, O_RDWR | O_CREAT);
|
return File_Do(file, path->buffer, O_RDWR | O_CREAT);
|
||||||
#else
|
|
||||||
return File_Do(file, path->buffer, O_RDWR | O_CREAT | O_BINARY);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_result File_Read(cc_file file, void* data, cc_uint32 count, cc_uint32* bytesRead) {
|
cc_result File_Read(cc_file file, void* data, cc_uint32 count, cc_uint32* bytesRead) {
|
||||||
@ -377,12 +367,6 @@ void Waitable_WaitFor(void* handle, cc_uint32 milliseconds) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*########################################################################################################################*
|
|
||||||
*--------------------------------------------------------Font/Text--------------------------------------------------------*
|
|
||||||
*#########################################################################################################################*/
|
|
||||||
void Platform_LoadSysFonts(void) { }
|
|
||||||
|
|
||||||
|
|
||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*---------------------------------------------------------Socket----------------------------------------------------------*
|
*---------------------------------------------------------Socket----------------------------------------------------------*
|
||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
@ -492,27 +476,6 @@ void Socket_Close(cc_socket s) {
|
|||||||
close(s);
|
close(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined CC_BUILD_DARWIN || defined CC_BUILD_BEOS
|
|
||||||
/* poll is broken on old OSX apparently https://daniel.haxx.se/docs/poll-vs-select.html */
|
|
||||||
/* BeOS lacks support for poll */
|
|
||||||
static cc_result Socket_Poll(cc_socket s, int mode, cc_bool* success) {
|
|
||||||
fd_set set;
|
|
||||||
struct timeval time = { 0 };
|
|
||||||
int selectCount;
|
|
||||||
|
|
||||||
FD_ZERO(&set);
|
|
||||||
FD_SET(s, &set);
|
|
||||||
|
|
||||||
if (mode == SOCKET_POLL_READ) {
|
|
||||||
selectCount = select(s + 1, &set, NULL, NULL, &time);
|
|
||||||
} else {
|
|
||||||
selectCount = select(s + 1, NULL, &set, NULL, &time);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selectCount == -1) { *success = false; return errno; }
|
|
||||||
*success = FD_ISSET(s, &set) != 0; return 0;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
static cc_result Socket_Poll(cc_socket s, int mode, cc_bool* success) {
|
static cc_result Socket_Poll(cc_socket s, int mode, cc_bool* success) {
|
||||||
struct pollfd pfd;
|
struct pollfd pfd;
|
||||||
@ -527,7 +490,6 @@ static cc_result Socket_Poll(cc_socket s, int mode, cc_bool* success) {
|
|||||||
*success = (pfd.revents & flags) != 0;
|
*success = (pfd.revents & flags) != 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
cc_result Socket_CheckReadable(cc_socket s, cc_bool* readable) {
|
cc_result Socket_CheckReadable(cc_socket s, cc_bool* readable) {
|
||||||
return Socket_Poll(s, SOCKET_POLL_READ, readable);
|
return Socket_Poll(s, SOCKET_POLL_READ, readable);
|
||||||
@ -589,4 +551,3 @@ static cc_result GetMachineID(cc_uint32* key) {
|
|||||||
cc_result Platform_GetEntropy(void* data, int len) {
|
cc_result Platform_GetEntropy(void* data, int len) {
|
||||||
return ERR_NOT_SUPPORTED;
|
return ERR_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
#endif
|
|
@ -1,17 +1,15 @@
|
|||||||
#include "Core.h"
|
#include "../Window.h"
|
||||||
#if defined CC_BUILD_PS4
|
#include "../Platform.h"
|
||||||
#include "Window.h"
|
#include "../Input.h"
|
||||||
#include "Platform.h"
|
#include "../Event.h"
|
||||||
#include "Input.h"
|
#include "../Graphics.h"
|
||||||
#include "Event.h"
|
#include "../String.h"
|
||||||
#include "Graphics.h"
|
#include "../Funcs.h"
|
||||||
#include "String.h"
|
#include "../Bitmap.h"
|
||||||
#include "Funcs.h"
|
#include "../Errors.h"
|
||||||
#include "Bitmap.h"
|
#include "../ExtMath.h"
|
||||||
#include "Errors.h"
|
#include "../Logger.h"
|
||||||
#include "ExtMath.h"
|
#include "../VirtualKeyboard.h"
|
||||||
#include "Logger.h"
|
|
||||||
#include "VirtualKeyboard.h"
|
|
||||||
#include <VideoOut.h>
|
#include <VideoOut.h>
|
||||||
|
|
||||||
static cc_bool launcherMode;
|
static cc_bool launcherMode;
|
||||||
@ -152,4 +150,3 @@ cc_result Window_OpenFileDialog(const struct OpenFileDialogArgs* args) {
|
|||||||
cc_result Window_SaveFileDialog(const struct SaveFileDialogArgs* args) {
|
cc_result Window_SaveFileDialog(const struct SaveFileDialogArgs* args) {
|
||||||
return ERR_NOT_SUPPORTED;
|
return ERR_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
#endif
|
|
Loading…
x
Reference in New Issue
Block a user