diff --git a/CMakeLists.txt b/CMakeLists.txt index af1f68026..b182e0fec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -305,6 +305,7 @@ if(DEFINED SWITCH) endif() if(DEFINED PS3) + add_definitions(-DPS3) set(BUILD_GLES2 OFF CACHE BOOL "Build with OpenGL|ES 2" FORCE) set(BUILD_GLES3 OFF CACHE BOOL "Build with OpenGL|ES 3" FORCE) set(USE_ELF OFF) diff --git a/include/mgba-util/common.h b/include/mgba-util/common.h index 3163b5857..ec0cf6ef3 100644 --- a/include/mgba-util/common.h +++ b/include/mgba-util/common.h @@ -78,7 +78,7 @@ typedef intptr_t ssize_t; typedef intptr_t ssize_t; #endif -#if defined(PSP2) || defined(__lv2ppu__) +#if defined(PSP2) || defined(PS3) // For PATH_MAX on modern toolchains #include #endif diff --git a/include/mgba-util/threading.h b/include/mgba-util/threading.h index 1890c5886..58f8969f3 100644 --- a/include/mgba-util/threading.h +++ b/include/mgba-util/threading.h @@ -21,7 +21,7 @@ CXX_GUARD_START #include #elif defined(__SWITCH__) #include -#elif defined(__lv2ppu__) +#elif defined(PS3) #include #else #define DISABLE_THREADING diff --git a/include/mgba-util/vfs.h b/include/mgba-util/vfs.h index e6e16a512..bb231124a 100644 --- a/include/mgba-util/vfs.h +++ b/include/mgba-util/vfs.h @@ -99,7 +99,7 @@ struct VDir* VDirOpenZip(const char* path, int flags); struct VDir* VDirOpen7z(const char* path, int flags); #endif -#if defined(__wii__) || defined(__3DS__) || defined(PSP2) || defined(__lv2ppu__) +#if defined(__wii__) || defined(__3DS__) || defined(PSP2) || defined(PS3) struct VDir* VDeviceList(void); #endif diff --git a/src/core/config.c b/src/core/config.c index 4d6e6b0a7..77c1d8f0b 100644 --- a/src/core/config.c +++ b/src/core/config.c @@ -258,6 +258,9 @@ void mCoreConfigDirectory(char* out, size_t outLength) { #elif defined(PSP2) snprintf(out, outLength, "ux0:data/%s", projectName); sceIoMkdir(out, 0777); +#elif defined(PS3) + snprintf(out, outLength, "/dev_hdd0/%s", projectName); + mkdir(out, 0777); #elif defined(GEKKO) || defined(__SWITCH__) snprintf(out, outLength, "/%s", projectName); mkdir(out, 0777); @@ -297,7 +300,7 @@ void mCoreConfigPortableIniPath(char* out, size_t outLength) { } WideCharToMultiByte(CP_UTF8, 0, wpath, -1, out, outLength, 0, 0); StringCchCatA(out, outLength, PATH_SEP "portable.ini"); -#elif defined(PSP2) || defined(GEKKO) || defined(__SWITCH__) || defined(__3DS__) || defined(__lv2ppu__) +#elif defined(PSP2) || defined(GEKKO) || defined(__SWITCH__) || defined(__3DS__) || defined(PS3) UNUSED(outLength); out[0] = '\0'; #else diff --git a/src/feature/commandline.c b/src/feature/commandline.c index 1a8ed582d..f7bf26d71 100644 --- a/src/feature/commandline.c +++ b/src/feature/commandline.c @@ -205,7 +205,7 @@ bool mArgumentsParse(struct mArguments* args, int argc, char* const* argv, struc } else if (argc == 1) { args->fname = strdup(argv[0]); } else { -#ifdef __lv2ppu__ +#ifdef PS3 args->fname = "/dev_hdd0/mGBA/rom.gba"; #else args->fname = NULL; diff --git a/src/gba/sio/dolphin.c b/src/gba/sio/dolphin.c index 255c5a13f..0bb783e76 100644 --- a/src/gba/sio/dolphin.c +++ b/src/gba/sio/dolphin.c @@ -3,7 +3,6 @@ * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef __lv2ppu__ // threads cause issues on PS3, do not include this file #include #include @@ -216,4 +215,3 @@ int32_t _processCommand(struct GBASIODolphin* dol, uint32_t cyclesLate) { bool GBASIODolphinIsConnected(struct GBASIODolphin* dol) { return dol->data != INVALID_SOCKET; } -#endif \ No newline at end of file diff --git a/src/platform/posix/memory.c b/src/platform/posix/memory.c index c0cf08999..5c265eec7 100644 --- a/src/platform/posix/memory.c +++ b/src/platform/posix/memory.c @@ -12,7 +12,7 @@ #if __has_feature(address_sanitizer) #define DISABLE_ANON_MMAP #endif -#ifdef __lv2ppu__ +#ifdef PS3 #define DISABLE_ANON_MMAP #endif #endif diff --git a/src/platform/ps3/CMakeToolchain.txt b/src/platform/ps3/CMakeToolchain.txt index bb6d76f09..c3d5296d8 100644 --- a/src/platform/ps3/CMakeToolchain.txt +++ b/src/platform/ps3/CMakeToolchain.txt @@ -29,11 +29,11 @@ set(CMAKE_SYSTEM_PROCESSOR powerpc) set(CMAKE_C_COMPILER ppu-gcc) set(CMAKE_CXX_COMPILER ppu-g++) -set(MACHDEP "-mhard-float -fmodulo-sched -ffunction-sections -fdata-sections") +set(MACHDEP "-mcpu=cell -mno-fp-in-toc -mno-sum-in-toc -mregnames -mhard-float -fmodulo-sched -ffunction-sections -fdata-sections") set(INCLUDES "-I${PS3DEV}/ppu/include -I${PS3DEV}/portlibs/ppu/include") -set(PPU_CFLAGS "-mcpu=cell -mregnames -Wall ${MACHDEP} ${INCLUDES} -Wa,-mcell") -set(PPU_LDFLAGS "-mcpu=cell -mregnames -Wall ${MACHDEP} -Wl,--gc-sections -L${PS3DEV}/ppu/lib -L${PS3DEV}/portlibs/ppu/lib") +set(PPU_CFLAGS "-Wall ${MACHDEP} ${INCLUDES} -Wa,-mcell") +set(PPU_LDFLAGS "-Wall ${MACHDEP} -Wl,--gc-sections -L${PS3DEV}/ppu/lib -L${PS3DEV}/portlibs/ppu/lib") set(PPU_CXXFLAGS "-D_GLIBCXX11_USE_C99_STDIO ${PPU_CFLAGS}") set(CMAKE_FIND_ROOT_PATH ${PS3DEV} ${PS3DEV}/ppu ${PS3DEV}/portlibs/ppu) @@ -44,7 +44,7 @@ set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) set(CMAKE_C_FLAGS ${PPU_CFLAGS}) -set(ASFLAGS "${MACHDEP} -mcpu=cell -mregnames -D__ASSEMBLY__ -Wa,-mcell ${INCLUDES}") +set(ASFLAGS "${MACHDEP} -D__ASSEMBLY__ -Wa,-mcell ${INCLUDES}") set(CMAKE_CXX_FLAGS ${PPU_CXXFLAGS}) set(CMAKE_EXE_LINKER_FLAGS ${PPU_LDFLAGS}) diff --git a/src/platform/sdl/main.c b/src/platform/sdl/main.c index 4debea3ee..3f0901cc1 100644 --- a/src/platform/sdl/main.c +++ b/src/platform/sdl/main.c @@ -30,6 +30,12 @@ #include #include +#if defined(PS3) +#include + +SYS_PROCESS_PARAM(1001, 0x200000) +#endif + #define PORT "sdl" static void mSDLDeinit(struct mSDLRenderer* renderer);