Skip to content

Commit

Permalink
Wiiu Port
Browse files Browse the repository at this point in the history
FakeEmitter/FakeJit/VertexDecoderFake buildfix.

big-endian fixes.

add wiiu build files.

add wiiu build files.

initial wiiu port.

fix IR interpreter on big-endian machines.

fix VertexDecoder/SoftGpu on big-endian.

Revert "Goodbye PowerPC, you can always be resurrected when the time comes"

This reverts commit a54e0cf.

WiiU: improve exception handler.

PpcJit now works on WiiU, sort of ...

PpcJit: disable instructions not available on WiiU.

add GPU_GX2, doesn't work yet ...

WiiU: add a basic GX2 validation layer.

WiiU: some small improvements to GX2_GPU. still not functional.

WiiU: hardcode some shaders for now.

big endian fix in Loaders.cpp

WiiU: more improvements to GPU_GX2. cube.elf now renders correctly.

GPUCommon: fix freeze on big-endian.

Wii-U: start generating shaders dynamically.

Wii-U: add an ubershader. a lot of scenes render correctly now.

Wii-U: add support for Hardware T&L.

Wii-U: add missing compile flags. fixes savestates.

Wii-U: copy tiled surface data correctly. fixes screenshots.

Wii-U: use a push buffer for uniforms.

README: include temporary manual ffmpeg submodule updating (#1)

Manually update ffmpeg submodule for now, see (#11001 (comment))

more big-endian fixes.

Wii-U: misc.

Wii-U: add stencil upload shader.

Wii-U: add missing support for analog sticks input.

Wii-U: implement CopyFramebufferImage.

Wii-U: GX2: fix color attributes.

Swap.h: get rid of most overloads. they weren't necessary and were
having some really bad side-effects.(like preventing type promotions,
eg: result of `swapped<short> * int` was being clamped to short)

fix SceAtracIdInfo struct on big-endian.

simplify Swap.h

Wii-U: register axis input only on change.

keep decoded/mixed audio as little endian in PSP memory, to allow
emulated code to process it correctly.

more big-endian fixes.

Wii-U: update shaders.

another round of big-endian fixes.

Wii-U: misc.

libkirk: replace some magic offsets with struct member access. this will
also allow using the scalar_storage_order attribute to enforce endianess
(gcc only).

a bit more big-endian fun.

Wii-U: simulate a square range for analog input.

Wii-U: build fix.

more big-endian fixes.

Wii-U: fix webserver.

build fix for devkitPPC r38.

(WIIU)set toolchain file automatically. use std=c++17.

build fix after rebase.

debug build fix.

texture_atlas big endian fixes.

WiiU: GX2 fixes after rebase.

WiiU: exception handler tweaks.

nits.

big endian fixes.

derp.

WiiU: thin3d: use correct index type.

misc.

update the ffmpeg module

WiiU: fix flipped display

PrxDecrypter: big endian fixes.

change ext/wiiu into a submodule.

big endian ...

WiiU: GX2:
-add COLOR_2D_RB_SWIZZLE shader.
-use correct pitch and endianess with TextureDesc.initDataCallback;

Wiiu: GX2: use correct component swizzle.

WiiU: GX2: need to use the backbuffer ptr here.

WiiU: GX2: no need to endian swap here, fixes screenshots.

WiiU: refactor *ShaderGeneratorGX2.

WiiU: plug leak.

WiiU: rename shader_info.h
update wiiu submodule.

WiiU: add a basic shader disassembler.

WiiU: improve shader generators. use fallback ubershader for unsupported
shaderIDs.

Mpeg: avoid flagging the mpeg data as invalid when MpegDemux::demux is
called with a small read size.

WiiU: GX2 fix scissor (was being limited to display res instead of
current framebuffer res).

WiiU: refactors.

WiiU: GX2Framebuffer: fall back to MEM2 when running out of MEM1 memory.

WiiU: refactors.

WiiU: update *ShaderGenerator

big endian.

printf big endian fixes.

misc.

misc.

wiiu: update wiiu.cmake

Swap.h: add parameter pack templates to automatically cast swap_t<>
values to their basic types when passed as parameters to *_LOG calls.
plus some refactors.

use little endian types for keys in PrxDecrypter.cpp

WiiU: misc.

Revert "printf big endian fixes."

This reverts commit 2334beb.
  • Loading branch information
aliaspider committed Oct 3, 2020
1 parent 5c9b7bb commit 538983e
Show file tree
Hide file tree
Showing 204 changed files with 22,296 additions and 1,464 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@
[submodule "ext/miniupnp"]
path = ext/miniupnp
url = https://github.com/hrydgard/miniupnp.git
[submodule "ext/wiiu"]
path = ext/wiiu
url = https://github.com/aliaspider/wiiu.git
232 changes: 170 additions & 62 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# vim:noexpandtab:
cmake_minimum_required(VERSION 3.6)
if (WIIU)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/Toolchains/wiiu.cmake)
endif()

project(PPSSPP)

#This is supposed to work but doesn't!
Expand Down Expand Up @@ -52,6 +56,8 @@ if(CMAKE_SYSTEM_PROCESSOR)
set(X86_DEVICE ON)
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^mips")
set(MIPS_DEVICE ON)
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^ppc" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "^powerpc")
set(PPC_DEVICE ON)
else()
message("Unknown CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}")
endif()
Expand Down Expand Up @@ -102,6 +108,7 @@ option(ARM "Set to ON if targeting an ARM processor" ${ARM_DEVICE})
option(MIPS "Set to ON if targeting a MIPS processor" ${MIPS_DEVICE})
option(X86 "Set to ON if targeting an X86 processor" ${X86_DEVICE})
option(X86_64 "Set to ON if targeting an X86_64 processor" ${X86_64_DEVICE})
option(PPC "Set to ON if targeting a PPC processor" ${PPC_DEVICE})
# :: Environments
option(USING_EGL "Set to ON if target environment uses EGL" ${USING_EGL})
option(USING_FBDEV "Set to ON if target environment uses fbdev (eg. Pandora)" ${USING_FBDEV})
Expand Down Expand Up @@ -169,26 +176,27 @@ include_directories(ext/native)
# Work around for some misfeature of the current glslang build system
include_directories(ext/glslang)

if(NOT WIIU)
if(NOT OPENGL_LIBRARIES AND USING_GLES2)
set(OPENGL_LIBRARIES GLESv2 EGL)
endif()

if(NOT OPENGL_LIBRARIES AND USING_GLES2)
set(OPENGL_LIBRARIES GLESv2 EGL)
endif()

if(NOT OPENGL_LIBRARIES)
find_package(OpenGL REQUIRED)
endif()
if(NOT OPENGL_LIBRARIES)
find_package(OpenGL REQUIRED)
endif()

if(USING_EGL)
if(NOT EGL_LIBRARIES)
set(EGL_LIBRARIES EGL)
if(USING_EGL)
if(NOT EGL_LIBRARIES)
set(EGL_LIBRARIES EGL)
endif()
set(OPENGL_LIBRARIES ${OPENGL_LIBRARIES} ${EGL_LIBRARIES})
endif()
set(OPENGL_LIBRARIES ${OPENGL_LIBRARIES} ${EGL_LIBRARIES})
endif()

if(NOT LIBRETRO)
find_package(SDL2)
if(NOT LIBRETRO)
find_package(SDL2)
endif()
include(FindThreads)
endif()
include(FindThreads)

if(APPLE)
find_library(COCOA_LIBRARY Cocoa)
Expand Down Expand Up @@ -239,6 +247,9 @@ endif()
if(ARM64)
message("Generating for ARMv8, ${CMAKE_BUILD_TYPE}")
endif()
if(PPC)
message("Generating for PowerPC, ${CMAKE_BUILD_TYPE}")
endif()

# It looks like the flags for the selected build type are written to the cache after each run, which causes some of the operations
# below to keep expanding them with the same flags over and over on every run, leading to a rebuild of the majority of the files.
Expand Down Expand Up @@ -392,7 +403,13 @@ set(CommonMIPS
)
source_group(MIPS FILES ${CommonMIPS})

if(NOT (X86 OR ARM OR MIPS))
set(CommonPPC
Common/FakeCPUDetect.cpp
Common/ppcEmitter.cpp
Common/ppcEmitter.h)
source_group(PPC FILES ${CommonPPC})

if(NOT (X86 OR ARM OR MIPS OR PPC))
set(CommonFake
Common/FakeCPUDetect.cpp
Common/FakeEmitter.h
Expand All @@ -418,6 +435,7 @@ add_library(Common STATIC
${CommonARM}
${CommonARM64}
${CommonMIPS}
${CommonPPC}
${CommonFake}
${CommonVulkan}
Common/Serialize/Serializer.cpp
Expand Down Expand Up @@ -477,6 +495,7 @@ add_library(Common STATIC
Common/MemArenaDarwin.cpp
Common/MemArenaPosix.cpp
Common/MemArenaWin32.cpp
Common/MemArenaWiiU.cpp
Common/MemArena.h
Common/MemoryUtil.cpp
Common/MemoryUtil.h
Expand Down Expand Up @@ -545,6 +564,8 @@ if(USE_FFMPEG)
set(PLATFORM_ARCH "ios/universal")
elseif(MACOSX)
set(PLATFORM_ARCH "macosx/x86_64")
elseif(WIIU)
set(PLATFORM_ARCH "wiiu")
elseif(LINUX)
if(ARMV7)
set(PLATFORM_ARCH "linux/armv7")
Expand Down Expand Up @@ -817,6 +838,16 @@ elseif(IOS)
set_source_files_properties(ios/CameraHelper.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)
set_source_files_properties(ios/LocationHelper.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)

set(TargetBin PPSSPP)
elseif(WIIU)
add_definitions(-D_GNU_SOURCE)
set(nativeExtra ${nativeExtra}
WiiU/WiiUHost.h
WiiU/WiiUHost.cpp
WiiU/WiiUMain.cpp
WiiU/GX2GraphicsContext.h
WiiU/GX2GraphicsContext.cpp)
set(nativeExtraLibs ${nativeExtraLibs} wiiu fat iosuhax)
set(TargetBin PPSSPP)
elseif(USING_QT_UI)
set(CMAKE_AUTOMOC ON)
Expand Down Expand Up @@ -925,14 +956,20 @@ if(ANDROID)
endif()
endif()

set(THIN3D_PLATFORMS ext/native/thin3d/thin3d_gl.cpp
ext/native/thin3d/GLRenderManager.cpp
ext/native/thin3d/GLRenderManager.h
ext/native/thin3d/GLQueueRunner.cpp
ext/native/thin3d/GLQueueRunner.h
ext/native/thin3d/DataFormatGL.cpp
ext/native/thin3d/DataFormatGL.h
)
if(WIIU)
set(THIN3D_PLATFORMS ext/native/thin3d/thin3d_gx2.cpp
ext/native/thin3d/GX2Shaders.c
)
else()
set(THIN3D_PLATFORMS ext/native/thin3d/thin3d_gl.cpp
ext/native/thin3d/GLRenderManager.cpp
ext/native/thin3d/GLRenderManager.h
ext/native/thin3d/GLQueueRunner.cpp
ext/native/thin3d/GLQueueRunner.h
ext/native/thin3d/DataFormatGL.cpp
ext/native/thin3d/DataFormatGL.h
)
endif()

set(THIN3D_PLATFORMS ${THIN3D_PLATFORMS}
ext/native/thin3d/thin3d_vulkan.cpp
Expand All @@ -955,6 +992,35 @@ if(WIN32)
)
endif()

set(nativeExtra ${nativeExtra}
ext/native/gfx_es2/draw_buffer.cpp
ext/native/gfx_es2/draw_buffer.h
ext/native/gfx_es2/draw_text.cpp
ext/native/gfx_es2/draw_text.h
ext/native/gfx_es2/gpu_features.cpp
ext/native/gfx_es2/gpu_features.h)

if(NOT WIIU)
set(nativeExtra ${nativeExtra}
ext/native/gfx/gl_common.h
ext/native/gfx/gl_debug_log.cpp
ext/native/gfx/gl_debug_log.h
ext/native/gfx/d3d9_shader.cpp
ext/native/gfx/d3d9_shader.h
ext/native/gfx/d3d9_state.cpp
ext/native/gfx/d3d9_state.h
ext/native/gfx_es2/draw_text_win.cpp
ext/native/gfx_es2/draw_text_win.h
ext/native/gfx_es2/draw_text_qt.cpp
ext/native/gfx_es2/draw_text_qt.h
ext/native/gfx_es2/draw_text_android.cpp
ext/native/gfx_es2/draw_text_android.h
ext/native/gfx_es2/glsl_program.cpp
ext/native/gfx_es2/glsl_program.h
ext/native/gfx_es2/gl3stub.c
ext/native/gfx_es2/gl3stub.h)
endif()

add_library(native STATIC
${nativeExtra}
ext/native/base/colorutil.cpp
Expand All @@ -980,31 +1046,8 @@ add_library(native STATIC
ext/native/file/vfs.h
ext/native/file/zip_read.cpp
ext/native/file/zip_read.h
ext/native/gfx/gl_common.h
ext/native/gfx/gl_debug_log.cpp
ext/native/gfx/gl_debug_log.h
ext/native/gfx/texture_atlas.cpp
ext/native/gfx/texture_atlas.h
ext/native/gfx/d3d9_shader.cpp
ext/native/gfx/d3d9_shader.h
ext/native/gfx/d3d9_state.cpp
ext/native/gfx/d3d9_state.h
ext/native/gfx_es2/draw_buffer.cpp
ext/native/gfx_es2/draw_buffer.h
ext/native/gfx_es2/draw_text.cpp
ext/native/gfx_es2/draw_text.h
ext/native/gfx_es2/draw_text_win.cpp
ext/native/gfx_es2/draw_text_win.h
ext/native/gfx_es2/draw_text_qt.cpp
ext/native/gfx_es2/draw_text_qt.h
ext/native/gfx_es2/draw_text_android.cpp
ext/native/gfx_es2/draw_text_android.h
ext/native/gfx_es2/gpu_features.cpp
ext/native/gfx_es2/gpu_features.h
ext/native/gfx_es2/glsl_program.cpp
ext/native/gfx_es2/glsl_program.h
ext/native/gfx_es2/gl3stub.c
ext/native/gfx_es2/gl3stub.h
ext/native/i18n/i18n.cpp
ext/native/i18n/i18n.h
ext/native/image/png_load.cpp
Expand Down Expand Up @@ -1225,9 +1268,28 @@ list(APPEND CoreExtra
GPU/Software/SamplerX86.cpp
)

list(APPEND CoreExtra
Core/MIPS/PPC/PpcAsm.cpp
Core/MIPS/PPC/PpcCompAlu.cpp
Core/MIPS/PPC/PpcCompBranch.cpp
Core/MIPS/PPC/PpcCompFpu.cpp
Core/MIPS/PPC/PpcCompLoadStore.cpp
Core/MIPS/PPC/PpcCompReplace.cpp
Core/MIPS/PPC/PpcCompVFPU.cpp
Core/MIPS/PPC/PpcJit.cpp
Core/MIPS/PPC/PpcJit.h
Core/MIPS/PPC/PpcRegCache.cpp
Core/MIPS/PPC/PpcRegCache.h
Core/MIPS/PPC/PpcRegCacheFPU.cpp
Core/MIPS/PPC/PpcRegCacheFPU.h
Core/MIPS/PPC/PpcRegCacheVPU.cpp
Core/MIPS/PPC/PpcRegCacheVPU.h)

list(APPEND CoreExtra
Core/MIPS/MIPS/MipsJit.cpp
Core/MIPS/MIPS/MipsJit.h
Core/MIPS/fake/FakeJit.cpp
Core/MIPS/fake/FakeJit.h
GPU/Common/VertexDecoderFake.cpp
)

Expand Down Expand Up @@ -1347,8 +1409,43 @@ set(GPU_D3D11
GPU/D3D11/VertexShaderGeneratorD3D11.h
)

# We build Vulkan even on Apple to avoid annoying build differences.
set(GPU_IMPLS ${GPU_GLES} ${GPU_VULKAN})
set(GPU_GX2
GPU/GX2/DepalettizeShaderGX2.cpp
GPU/GX2/DepalettizeShaderGX2.h
GPU/GX2/DrawEngineGX2.cpp
GPU/GX2/DrawEngineGX2.h
GPU/GX2/FragmentShaderGeneratorGX2.cpp
GPU/GX2/FragmentShaderGeneratorGX2.h
GPU/GX2/FramebufferManagerGX2.cpp
GPU/GX2/FramebufferManagerGX2.h
GPU/GX2/GPU_GX2.cpp
GPU/GX2/GPU_GX2.h
GPU/GX2/GX2Shaders.c
GPU/GX2/GX2Shaders.h
GPU/GX2/GX2Util.cpp
GPU/GX2/GX2Util.h
GPU/GX2/ShaderManagerGX2.cpp
GPU/GX2/ShaderManagerGX2.h
GPU/GX2/StateMappingGX2.cpp
GPU/GX2/StateMappingGX2.h
GPU/GX2/StencilBufferGX2.cpp
GPU/GX2/TextureCacheGX2.cpp
GPU/GX2/TextureCacheGX2.h
GPU/GX2/TextureScalerGX2.cpp
GPU/GX2/TextureScalerGX2.h
GPU/GX2/VertexShaderGeneratorGX2.cpp
GPU/GX2/VertexShaderGeneratorGX2.h
)

# We build Vulkan even on Apple and WiiU to avoid annoying build differences.
set(GPU_IMPLS ${GPU_VULKAN})

if(WIIU)
list(APPEND GPU_IMPLS ${GPU_GX2})
else()
list(APPEND GPU_IMPLS ${GPU_GLES})
endif()

if(WIN32)
list(APPEND GPU_IMPLS ${GPU_D3D9} ${GPU_D3D11})
endif()
Expand All @@ -1359,8 +1456,6 @@ endif()
set(GPU_SOURCES
${GPU_IMPLS}
${GPU_NEON}
GPU/Common/DepalettizeShaderCommon.cpp
GPU/Common/DepalettizeShaderCommon.h
GPU/Common/FramebufferManagerCommon.cpp
GPU/Common/FramebufferManagerCommon.h
GPU/Common/GPUDebugInterface.cpp
Expand All @@ -1371,14 +1466,6 @@ set(GPU_SOURCES
GPU/Common/DrawEngineCommon.h
GPU/Common/PresentationCommon.cpp
GPU/Common/PresentationCommon.h
GPU/Common/ShaderId.cpp
GPU/Common/ShaderId.h
GPU/Common/ShaderUniforms.cpp
GPU/Common/ShaderUniforms.h
GPU/Common/ShaderCommon.cpp
GPU/Common/ShaderCommon.h
GPU/Common/ShaderTranslation.cpp
GPU/Common/ShaderTranslation.h
GPU/Common/SplineCommon.cpp
GPU/Common/SplineCommon.h
GPU/Common/StencilCommon.cpp
Expand All @@ -1387,6 +1474,16 @@ set(GPU_SOURCES
GPU/Common/SoftwareTransformCommon.h
GPU/Common/VertexDecoderCommon.cpp
GPU/Common/VertexDecoderCommon.h
GPU/Common/DepalettizeShaderCommon.cpp
GPU/Common/DepalettizeShaderCommon.h
GPU/Common/ShaderId.cpp
GPU/Common/ShaderId.h
GPU/Common/ShaderCommon.cpp
GPU/Common/ShaderCommon.h
GPU/Common/ShaderUniforms.cpp
GPU/Common/ShaderUniforms.h
GPU/Common/ShaderTranslation.cpp
GPU/Common/ShaderTranslation.h
GPU/Common/TransformCommon.cpp
GPU/Common/TransformCommon.h
GPU/Common/IndexGenerator.cpp
Expand Down Expand Up @@ -1813,7 +1910,11 @@ set(CoreExtraLibs ${CoreExtraLibs} armips)
#endif()


set(GlslangLibs glslang OGLCompiler OSDependent SPIRV SPVRemapper spirv-cross-glsl)
if(WIIU)
set(CMAKE_DL_LIBS "")
else()
set(GlslangLibs glslang OGLCompiler OSDependent SPIRV SPVRemapper spirv-cross-glsl)
endif()

if(WIN32)
set(GlslangLibs ${GlslangLibs} spirv-cross-hlsl)
Expand All @@ -1832,16 +1933,19 @@ if(FFmpeg_FOUND)
FFmpeg::swscale
${ZLIB_LIBRARY}
)
if(WIIU)
target_link_libraries(${CoreLibName} pthread)
endif()
endif()

# Discord integration
if(USE_DISCORD AND NOT IOS AND NOT LIBRETRO)
if(USE_DISCORD AND NOT IOS AND NOT WIIU AND NOT LIBRETRO)
add_definitions(-DUSE_DISCORD=1)
target_link_libraries(${CoreLibName} discord-rpc)
endif()

# miniUPnPc integration (MiniUPnPc supposed to works on any POSIX system, not sure if some of these are redundant/not needed tho)
if(USE_MINIUPNPC)
if(USE_MINIUPNPC AND NOT WIIU)
set (MINIUPNPC_VERSION 2.1) # used by miniupnpcstrings.h.cmake
set (MINIUPNPC_API_VERSION 17)
option(UPNPC_BUILD_STATIC "Build static library" TRUE)
Expand Down Expand Up @@ -2188,3 +2292,7 @@ if(IOS)
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "-"
)
endif()

if(WIIU)
add_rpx_target(${TargetBin})
endif()
Loading

0 comments on commit 538983e

Please sign in to comment.