mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-09 03:29:43 -10:00
Compare commits
14
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
28c7ae5007 | ||
|
|
0a613c04a6 | ||
|
|
f12092a09f | ||
|
|
21aa1cdbe6 | ||
|
|
5e18a5513c | ||
|
|
1188650a3f | ||
|
|
f64a01c5d4 | ||
|
|
42e803435f | ||
|
|
5e1486d92a | ||
|
|
f03a0cedca | ||
|
|
75a134a578 | ||
|
|
a9b9435e0b | ||
|
|
b674457671 | ||
|
|
7752c73abc |
No files matched your search
@@ -1,20 +0,0 @@
|
||||
# EditorConfig: http://EditorConfig.org
|
||||
|
||||
# Top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Unix-style newlines with a newline ending every file
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
charset = utf-8
|
||||
|
||||
# 3 space indentation
|
||||
[*.{c,h,js,css,html}]
|
||||
indent_style = space
|
||||
indent_size = 3
|
||||
|
||||
# Tab indentation
|
||||
[Makefile*]
|
||||
indent_style = tab
|
||||
File renamed without changes.
@@ -1,12 +0,0 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [libretro]
|
||||
patreon: libretro
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with a single custom sponsorship URL
|
||||
@@ -1,35 +0,0 @@
|
||||
# First and foremost consider this:
|
||||
- Only RetroArch bugs should be filed here. Not core bugs or game bugs
|
||||
- This is not a forum or a help section, this is strictly developer oriented
|
||||
|
||||
## Description
|
||||
|
||||
[Description of the bug]
|
||||
|
||||
### Expected behavior
|
||||
|
||||
[What you expected to happen]
|
||||
|
||||
### Actual behavior
|
||||
|
||||
[What is actually happening]
|
||||
|
||||
### Steps to reproduce the bug
|
||||
|
||||
1. [First step]
|
||||
2. [Second step]
|
||||
3. [and so on...]
|
||||
|
||||
### Bisect Results
|
||||
|
||||
[Try to bisect and tell us when this started happening]
|
||||
|
||||
### Version/Commit
|
||||
You can find this information under Information/System Information
|
||||
|
||||
- RetroArch: [version/commit]
|
||||
|
||||
### Environment information
|
||||
|
||||
- OS: [The operating system you're running]
|
||||
- Compiler: [In case you are running local builds]
|
||||
@@ -1,21 +0,0 @@
|
||||
## Guidelines
|
||||
|
||||
1. Rebase before opening a pull request
|
||||
2. If you are sending several unrelated fixes or features, use a branch and a separate pull request for each
|
||||
3. If possible try squashing everything in a single commit. This is particularly beneficial in the case of feature merges since it allows easy bisecting when a problem arises
|
||||
|
||||
## Description
|
||||
|
||||
[Description of the pull request, detail any issues you are fixing or any features you are implementing]
|
||||
|
||||
## Related Issues
|
||||
|
||||
[Any issues this pull request may be addressing]
|
||||
|
||||
## Related Pull Requests
|
||||
|
||||
[Any other PRs from related repositories that might be needed for this pull request to work]
|
||||
|
||||
## Reviewers
|
||||
|
||||
[If possible @mention all the people that should review your pull request]
|
||||
+3
-103
@@ -7,19 +7,10 @@
|
||||
*.elf
|
||||
*.dol
|
||||
*.map
|
||||
*.swp
|
||||
.tmp
|
||||
.tmp.c
|
||||
.tmp.cxx
|
||||
.moc.h
|
||||
.moc.cpp
|
||||
config.log
|
||||
/.project
|
||||
/.externalToolBuilders/
|
||||
/retroarch
|
||||
/retroarch.cfg
|
||||
/retroarch.exe
|
||||
/retroarch_debug.exe
|
||||
/config.h
|
||||
/config.mk
|
||||
/tools/retroarch-joyconfig
|
||||
@@ -55,6 +46,7 @@ DerivedData
|
||||
apple/tmp
|
||||
apple/*.mobileprovision
|
||||
apple/RetroArch_iOS.xcodeproj/project.xcworkspace/*
|
||||
menu/driverspzarch.c
|
||||
/Cg/
|
||||
/GL/
|
||||
/SDL/
|
||||
@@ -62,52 +54,17 @@ apple/RetroArch_iOS.xcodeproj/project.xcworkspace/*
|
||||
/freetype2/
|
||||
/ft2build.h
|
||||
/iconv.h
|
||||
/libxml2/
|
||||
/phoenix/
|
||||
/python/
|
||||
/rsound.h
|
||||
.pc
|
||||
/media/shaders_glsl/
|
||||
/obj-w32/
|
||||
.cproject
|
||||
.settings
|
||||
libretro-super
|
||||
run.sh
|
||||
convert_rumble.awk
|
||||
*~
|
||||
assets
|
||||
info
|
||||
content_image_history.lpl
|
||||
saves
|
||||
screenshots
|
||||
|
||||
|
||||
# Wii U
|
||||
*.depend
|
||||
*.rpx
|
||||
*.last
|
||||
wiiu/wut/elf2rpl/elf2rpl
|
||||
/pkg/wiiu/retroarch
|
||||
/pkg/wiiu/wiiu
|
||||
/pkg/wiiu/rpx
|
||||
/wiiu-devel.properties
|
||||
|
||||
# 3ds
|
||||
/.lst
|
||||
*.3dsx
|
||||
*.cia
|
||||
*.3ds
|
||||
*.bnr
|
||||
*.smdh
|
||||
/retroarch_3ds.core
|
||||
/retroarch_3ds.icn
|
||||
/retroarch_3ds_salamander.icn
|
||||
|
||||
# Ctags
|
||||
/tags
|
||||
|
||||
# CLion
|
||||
/cmake-build-debug/
|
||||
|
||||
# Android
|
||||
/pkg/android/phoenix/obj/
|
||||
/pkg/android/phoenix/assets/
|
||||
@@ -115,10 +72,6 @@ wiiu/wut/elf2rpl/elf2rpl
|
||||
/pkg/android/phoenix/bin/
|
||||
/pkg/android/phoenix/gen/
|
||||
/pkg/android/phoenix/local.properties
|
||||
/pkg/android/phoenix/gradle.properties
|
||||
/pkg/android/phoenix/.gradle
|
||||
/pkg/android/phoenix/.externalNativeBuild
|
||||
/pkg/android/phoenix/build
|
||||
|
||||
# Cloned by libretro-fetch.sh
|
||||
/media/assets/
|
||||
@@ -128,60 +81,7 @@ wiiu/wut/elf2rpl/elf2rpl
|
||||
/media/libretrodb/
|
||||
|
||||
pkg/apple/iOS/build/
|
||||
pkg/apple/build/
|
||||
ui/drivers/qt/moc_*
|
||||
ui/drivers/moc_*
|
||||
pkg/apple/iOS/modules/
|
||||
|
||||
obj-unix/
|
||||
.vagrant/
|
||||
|
||||
/pkg/msvc/Release Cg/*.exe
|
||||
/pkg/msvc/Release Cg/*.iobj
|
||||
/pkg/msvc/Release Cg/*.ipdb
|
||||
/pkg/msvc/Release Cg/*.pdb
|
||||
/pkg/msvc/Release Cg/*.lpl
|
||||
/pkg/msvc/Release Cg/*.cfg
|
||||
/pkg/msvc/*.db
|
||||
/pkg/msvc/.vs
|
||||
/pkg/msvc/*/.vs
|
||||
/pkg/msvc/msvc-2010/Release Cg/RetroArc.27FF7CE1.tlog/*.tlog
|
||||
/pkg/msvc/msvc-2010/Release Cg/RetroArc.27FF7CE1.tlog/*.lastbuildstate
|
||||
/pkg/msvc/msvc-2010/Release Cg/*.log
|
||||
/pkg/msvc/msvc-2010/Release Cg/*.obj
|
||||
/pkg/msvc/msvc-2010/Release Cg/*.res
|
||||
/pkg/msvc/msvc-2010/Release Cg/*.pdb
|
||||
retroarch.cfg
|
||||
Makefile.local
|
||||
|
||||
# Emscripten artifacts
|
||||
|
||||
retroarch.js
|
||||
retroarch.js.mem
|
||||
*.bc
|
||||
*.wasm
|
||||
|
||||
# only ignore .js files in the repo root
|
||||
/*.js
|
||||
|
||||
# Switch
|
||||
*.d
|
||||
exefs/*
|
||||
retroarch_switch.pfs0
|
||||
retroarch_switch.lst
|
||||
retroarch_switch.nacp
|
||||
retroarch_switch.nro
|
||||
retroarch_switch.nso
|
||||
|
||||
# PS2
|
||||
ps2/irx/*.c
|
||||
ps2/libcdvd/lib/
|
||||
|
||||
# Wayland
|
||||
gfx/common/wayland/idle-inhibit-unstable-v1.c
|
||||
gfx/common/wayland/idle-inhibit-unstable-v1.h
|
||||
gfx/common/wayland/xdg-shell-unstable-v6.c
|
||||
gfx/common/wayland/xdg-shell-unstable-v6.h
|
||||
gfx/common/wayland/xdg-decoration-unstable-v1.h
|
||||
gfx/common/wayland/xdg-decoration-unstable-v1.c
|
||||
gfx/common/wayland/xdg-shell.c
|
||||
gfx/common/wayland/xdg-shell.h
|
||||
@@ -1,8 +0,0 @@
|
||||
before_script:
|
||||
- apt-get update -qq && apt-get install -y -qq git build-essential
|
||||
- apt-get update -qq && apt-get build-dep -y retroarch
|
||||
|
||||
build:
|
||||
script:
|
||||
- ./configure
|
||||
- make -j2
|
||||
@@ -0,0 +1,3 @@
|
||||
[submodule "deps/glslang/glslang"]
|
||||
path = deps/glslang/glslang
|
||||
url = git://github.com/KhronosGroup/glslang.git
|
||||
@@ -5,23 +5,7 @@
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||
<triggers>clean,full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||
<triggers>full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
-196
@@ -1,196 +0,0 @@
|
||||
# This setting is to prevent travis to launch duplicate builds on PRs
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- /^v.*$/
|
||||
|
||||
# Use 'generic' to be able to override CC/CXX for clang
|
||||
language: generic
|
||||
|
||||
# Use a release with a longer normal LTS
|
||||
dist: xenial
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- compiler: mingw-x86
|
||||
addons: true
|
||||
env: CROSS_COMPILE=i686-w64-mingw32- CFLAGS="-D_WIN32_WINNT=0x0501"
|
||||
- compiler: mingw-x86
|
||||
addons: true
|
||||
env: C89_BUILD=1 CROSS_COMPILE=i686-w64-mingw32- CFLAGS="-D_WIN32_WINNT=0x0501"
|
||||
- compiler: mingw-x86
|
||||
addons: true
|
||||
env: CXX_BUILD=1 CROSS_COMPILE=i686-w64-mingw32- CFLAGS="-D_WIN32_WINNT=0x0501"
|
||||
- compiler: mingw-x64
|
||||
addons: true
|
||||
env: CROSS_COMPILE=x86_64-w64-mingw32- CFLAGS="-D_WIN32_WINNT=0x0501"
|
||||
- compiler: mingw-x64
|
||||
addons: true
|
||||
env: C89_BUILD=1 CROSS_COMPILE=x86_64-w64-mingw32- CFLAGS="-D_WIN32_WINNT=0x0501"
|
||||
- compiler: mingw-x64
|
||||
addons: true
|
||||
env: CXX_BUILD=1 CROSS_COMPILE=x86_64-w64-mingw32- CFLAGS="-D_WIN32_WINNT=0x0501"
|
||||
- compiler: gcc
|
||||
env: CC=gcc-8 CXX=g++-8
|
||||
- compiler: gcc
|
||||
env: CC="gcc-8 --sysroot=/" CXX="g++-8 --sysroot=/"
|
||||
- compiler: gcc
|
||||
env: C89_BUILD=1 CC=gcc-8 CXX=g++-8
|
||||
- compiler: gcc
|
||||
env: CXX_BUILD=1 CC=gcc-8 CXX=g++-8
|
||||
- compiler: gcc
|
||||
env: DISABLE_MENU=1 CC=gcc-8 CXX=g++-8
|
||||
- compiler: gcc
|
||||
env: DISABLE_OVERLAY=1 CC=gcc-8 CXX=g++-8
|
||||
- compiler: gcc
|
||||
env: DISABLE_CDROM=1 CC=gcc-8 CXX=g++-8
|
||||
- compiler: gcc
|
||||
env: DISABLE_VIDEO_LAYOUT=1 CC=gcc-8 CXX=g++-8
|
||||
- compiler: gcc
|
||||
env: DISABLE_AUDIOMIXER=1 CC=gcc-8 CXX=g++-8
|
||||
- compiler: gcc
|
||||
env: ENABLE_GLES=1 CC=gcc-8 CXX=g++-8
|
||||
- compiler: gcc
|
||||
env: ENABLE_GLES=1 ENABLE_GLES3=1 CC=gcc-8 CXX=g++-8
|
||||
- compiler: clang
|
||||
env: CC=clang-6.0 CXX=clang++-6.0
|
||||
- compiler: clang
|
||||
env: C89_BUILD=1 CC=clang-6.0 CXX=clang++-6.0
|
||||
- compiler: clang
|
||||
env: CXX_BUILD=1 CC=clang-6.0 CXX=clang++-6.0
|
||||
- os: osx
|
||||
env: CC=clang CXX=clang++
|
||||
- name: OSX OpenGL Make
|
||||
os: osx
|
||||
osx_image: xcode11.2
|
||||
script:
|
||||
- ./configure --enable-opengl --disable-metal
|
||||
- make
|
||||
- os: osx
|
||||
osx_image: xcode8
|
||||
script:
|
||||
- xcodebuild -target RetroArch -configuration Release -project pkg/apple/RetroArch.xcodeproj
|
||||
- os: osx
|
||||
osx_image: xcode11.2
|
||||
script:
|
||||
- brew update-reset
|
||||
- brew install --force-bottle qt5
|
||||
- security create-keychain -p travis build.keychain
|
||||
- security default-keychain -s build.keychain
|
||||
- security unlock-keychain -p travis build.keychain
|
||||
- echo $OSX_CERT | base64 --decode > dev.p12
|
||||
- security import dev.p12 -k build.keychain -P $OSX_CERT_PASS -T /usr/bin/codesign
|
||||
- rm dev.p12
|
||||
- security set-key-partition-list -S "apple-tool:,apple:,codesign:" -s -k travis build.keychain
|
||||
- xcodebuild -target RetroArchQt -configuration Release -project pkg/apple/RetroArch_Metal.xcodeproj
|
||||
deploy:
|
||||
skip_cleanup: true
|
||||
provider: script
|
||||
script: bash travis_metal_deploy.sh
|
||||
on:
|
||||
branch: master
|
||||
- language: android
|
||||
# Android builds are only supported on Trusty
|
||||
dist: trusty
|
||||
android:
|
||||
components:
|
||||
- tools
|
||||
- build-tools-28.0.3
|
||||
- android-28
|
||||
install:
|
||||
- echo y | sdkmanager "ndk-bundle"
|
||||
before_script:
|
||||
- export ANDROID_NDK_HOME=$ANDROID_HOME/ndk-bundle
|
||||
script:
|
||||
- cd pkg/android/phoenix
|
||||
- ./gradlew assembleNormalRelease
|
||||
|
||||
jobs:
|
||||
allow_failure:
|
||||
- os: osx
|
||||
|
||||
before_install:
|
||||
- |
|
||||
if [[ "$CC" =~ ^gcc-8.* ]]; then
|
||||
# Install a more recent gcc than the default
|
||||
sudo apt-get install -y g++-8
|
||||
elif [ "$CC" = clang-6.0 ]; then
|
||||
# Install a more recent clang than the default
|
||||
sudo apt-get install -y clang-6.0
|
||||
elif [ "$CROSS_COMPILE" = i686-w64-mingw32- ]; then
|
||||
sudo update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix
|
||||
elif [ "$CROSS_COMPILE" = x86_64-w64-mingw32- ]; then
|
||||
sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
|
||||
fi
|
||||
|
||||
before_script:
|
||||
- |
|
||||
if [ -n "$CROSS_COMPILE" ]; then
|
||||
ARGS="$ARGS --disable-d3d8 --disable-d3d9 --disable-d3d10 --disable-d3d11 --disable-d3d12"
|
||||
fi
|
||||
- |
|
||||
if [ -n "$DISABLE_MENU" ]; then
|
||||
ARGS="$ARGS --disable-menu"
|
||||
fi
|
||||
- |
|
||||
if [ -n "$DISABLE_OVERLAY" ]; then
|
||||
ARGS="$ARGS --disable-overlay"
|
||||
fi
|
||||
- |
|
||||
if [ -n "$DISABLE_CDROM" ]; then
|
||||
ARGS="$ARGS --disable-cdrom"
|
||||
fi
|
||||
- |
|
||||
if [ -n "$DISABLE_VIDEO_LAYOUT" ]; then
|
||||
ARGS="$ARGS --disable-video_layout"
|
||||
fi
|
||||
- |
|
||||
if [ -n "$DISABLE_AUDIOMIXER" ]; then
|
||||
ARGS="$ARGS --disable-audiomixer"
|
||||
fi
|
||||
- |
|
||||
if [ -n "$ENABLE_GLES" ]; then
|
||||
ARGS="$ARGS --enable-opengles"
|
||||
fi
|
||||
- |
|
||||
if [ -n "$ENABLE_GLES3" ]; then
|
||||
ARGS="$ARGS --enable-opengles3"
|
||||
fi
|
||||
- echo "Configure arguments = $ARGS"
|
||||
|
||||
script:
|
||||
- ./configure $ARGS
|
||||
- |
|
||||
if [ -n "$C89_BUILD" ]; then
|
||||
make C89_BUILD=1
|
||||
elif [ -n "$CXX_BUILD" ]; then
|
||||
make CXX_BUILD=1
|
||||
else
|
||||
make
|
||||
fi
|
||||
|
||||
env:
|
||||
global:
|
||||
- ARGS=""
|
||||
- MAKEFLAGS="-j2"
|
||||
- secure: "qc91ReC3OlzSh2gFaSH6TYzC2qIQvgA2AZff6J13eaH8xijAhuMzttZ0rMQJ0DWCIhPeUb0kIzVyaGoe4MwPALzpw1C1AznIWiZJ53HN+hWCOcS/af7YVPk6HPySnwqrS+Wv3AIIvIKFV2mxv21F/JbT/N+pArlRrp904Xj+KPo="
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libsdl2-dev
|
||||
- libusb-1.0-0-dev
|
||||
- qtbase5-dev
|
||||
- qtdeclarative5-dev
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-xenial
|
||||
coverity_scan:
|
||||
project:
|
||||
name: "RetroArch"
|
||||
description: "RetroArch is the official reference frontend for the libretro API."
|
||||
notification_email: [email protected]
|
||||
build_command_prepend: "./configure; make clean"
|
||||
build_command: "make"
|
||||
branch_pattern: coverity_scan
|
||||
notifications:
|
||||
email: true
|
||||
Vendored
-155
@@ -1,155 +0,0 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Mac",
|
||||
"includePath": [
|
||||
"/usr/include",
|
||||
"/usr/local/include",
|
||||
"${workspaceRoot}",
|
||||
"${workspaceRoot}/libretro-common/include"
|
||||
],
|
||||
"defines": [],
|
||||
"intelliSenseMode": "clang-x64",
|
||||
"browse": {
|
||||
"path": [
|
||||
"/usr/include",
|
||||
"/usr/local/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
},
|
||||
"macFrameworkPath": [
|
||||
"/System/Library/Frameworks",
|
||||
"/Library/Frameworks"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Linux",
|
||||
"includePath": [
|
||||
"/usr/include",
|
||||
"/usr/local/include",
|
||||
"${workspaceRoot}",
|
||||
"${workspaceFolder}/libretro-common/include",
|
||||
"${workspaceRoot}/libretro-common/include"
|
||||
],
|
||||
"defines": [],
|
||||
"intelliSenseMode": "clang-x64",
|
||||
"browse": {
|
||||
"path": [
|
||||
"/usr/include",
|
||||
"/usr/local/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Win32",
|
||||
"includePath": [
|
||||
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/um",
|
||||
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/ucrt",
|
||||
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/shared",
|
||||
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/winrt",
|
||||
"${workspaceRoot}",
|
||||
"${workspaceFolder}/libretro-common/include"
|
||||
],
|
||||
"defines": [
|
||||
"_DEBUG",
|
||||
"UNICODE"
|
||||
],
|
||||
"intelliSenseMode": "msvc-x64",
|
||||
"browse": {
|
||||
"path": [
|
||||
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/um",
|
||||
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/ucrt",
|
||||
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/shared",
|
||||
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/winrt",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
},
|
||||
"cStandard": "c11",
|
||||
"cppStandard": "c++17"
|
||||
},
|
||||
{
|
||||
"name": "msys2-mingw32",
|
||||
"includePath": [
|
||||
"C:/msys64/mingw32/include",
|
||||
"C:/msys64/mingw32/i686-w64-mingw32/include",
|
||||
"${workspaceRoot}/libretro-common/include",
|
||||
"${workspaceRoot}/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"defines": [
|
||||
"_DEBUG",
|
||||
"UNICODE"
|
||||
],
|
||||
"intelliSenseMode": "msvc-x64",
|
||||
"browse": {
|
||||
"path": [
|
||||
"C:/msys64/mingw32/include",
|
||||
"C:/msys64/mingw32/i686-w64-mingw32/include",
|
||||
"${workspaceRoot}/libretro-common/include",
|
||||
"${workspaceRoot}/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "msys2-mingw64",
|
||||
"includePath": [
|
||||
"C:/msys64/mingw64/include",
|
||||
"C:/msys64/mingw64/x86_64-w64-mingw32/include",
|
||||
"${workspaceRoot}/libretro-common/include",
|
||||
"${workspaceRoot}/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"defines": [
|
||||
"_DEBUG",
|
||||
"UNICODE"
|
||||
],
|
||||
"intelliSenseMode": "msvc-x64",
|
||||
"browse": {
|
||||
"path": [
|
||||
"C:/msys64/mingw64/include",
|
||||
"C:/msys64/mingw64/x86_64-w64-mingw32/include",
|
||||
"${workspaceRoot}/libretro-common/include",
|
||||
"${workspaceRoot}/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Switch",
|
||||
"includePath": [
|
||||
"/opt/devkitpro/devkitA64/aarch64-none-elf/include",
|
||||
"/opt/devkitpro/devkitA64/lib/gcc/aarch64-none-elf/8.3.0/include",
|
||||
"/opt/devkitpro/libnx/include",
|
||||
"/opt/devkitpro/portlibs/switch/include",
|
||||
"/opt/devkitpro/portlibs/switch/include/freetype2",
|
||||
"${workspaceFolder}/**"
|
||||
],
|
||||
"defines": [
|
||||
"_DEBUG",
|
||||
"UNICODE",
|
||||
"_UNICODE",
|
||||
"__aarch64__",
|
||||
"__SWITCH__",
|
||||
"HAVE_LIBNX"
|
||||
],
|
||||
"windowsSdkVersion": "10.0.17763.0",
|
||||
"compilerPath": "/opt/devkitpro/devkitA64/bin/aarch64-none-elf-gcc",
|
||||
"cStandard": "c11",
|
||||
"cppStandard": "c++11",
|
||||
"intelliSenseMode": "gcc-x64"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
||||
Vendored
-70
@@ -1,70 +0,0 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "(gdb) Launch",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/retroarch.exe",
|
||||
"args": ["-v"],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": true,
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerPath": "c:\\msys64\\mingw64\\bin\\gdb.exe",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "(gdb) Attach",
|
||||
"type": "cppdbg",
|
||||
"request": "attach",
|
||||
"program": "${workspaceFolder}/retroarch.exe",
|
||||
"processId": "${command:pickProcess}",
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerPath": "c:\\msys64\\mingw64\\bin\\gdb.exe",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "PSP-GDB Debugger",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/retroarchpsp.elf",
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"setupCommands": [
|
||||
{
|
||||
"text": "symbol-file ${workspaceFolder}/retroarchpsp.elf",
|
||||
"description": "read symbols for elf file",
|
||||
"ignoreFailures": true
|
||||
},
|
||||
{
|
||||
"description": "Enable all-exceptions",
|
||||
"text": "-exec \"catch throw\"",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
],
|
||||
"showDisplayString": true,
|
||||
"targetArchitecture": "mips",
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerPath": "/usr/local/pspdev/bin/psp-gdb",
|
||||
"miDebuggerServerAddress": "127.0.0.1:10001",
|
||||
}
|
||||
]
|
||||
}
|
||||
Vendored
-72
@@ -1,72 +0,0 @@
|
||||
{
|
||||
"terminal.integrated.shell.windows": "C:\\msys64\\usr\\bin\\bash.exe",
|
||||
"terminal.integrated.env.windows": {
|
||||
"PATH": "/mingw64/lib/ccache/bin:/mingw64/lib/ccache/bin:/mingw64/lib/ccache/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:$PATH",
|
||||
"MSYSTEM": "MINGW64",
|
||||
},
|
||||
"terminal.integrated.cursorBlinking": true,
|
||||
|
||||
"editor.tabSize": 3,
|
||||
"editor.detectIndentation": false,
|
||||
"editor.renderWhitespace": "all",
|
||||
"editor.insertSpaces": true,
|
||||
"files.associations": {
|
||||
"frontend_driver.h": "c",
|
||||
"*.in": "c",
|
||||
"*.rh": "c",
|
||||
"array": "c",
|
||||
"file_stream.h": "c",
|
||||
"driver.h": "c",
|
||||
"iosfwd": "c",
|
||||
"xlocbuf": "c",
|
||||
"xmemory0": "c",
|
||||
"ios": "c",
|
||||
"list": "c",
|
||||
"input_driver.h": "c",
|
||||
"menu_driver.h": "c",
|
||||
"file_path.h": "c",
|
||||
"unordered_map": "c",
|
||||
"unordered_set": "c",
|
||||
"sstream": "cpp",
|
||||
"hash_map": "c",
|
||||
"hash_set": "c",
|
||||
"initializer_list": "c",
|
||||
"string_view": "c",
|
||||
"utility": "c",
|
||||
"menu_input.h": "c",
|
||||
"tasks_internal.h": "c",
|
||||
"ozone.h": "c",
|
||||
"ozone_theme.h": "c",
|
||||
"ozone_texture.h": "c",
|
||||
"string_list.h": "c",
|
||||
"core_info.h": "c",
|
||||
"thread": "c",
|
||||
"xlocale": "c",
|
||||
"gfx_widgets.h": "c",
|
||||
"message_queue.h": "c",
|
||||
"task_queue.h": "c",
|
||||
"fifo_queue.h": "c",
|
||||
"file_list.h": "c",
|
||||
"strl.h": "c",
|
||||
"configuration.h": "c",
|
||||
"ozone_display.h": "c",
|
||||
"verbosity.h": "c",
|
||||
"retroarch.h": "c",
|
||||
"gfx_animation.h": "c",
|
||||
"netplay.h": "c",
|
||||
"scaler.h": "c",
|
||||
"deque": "c",
|
||||
"vector": "c",
|
||||
"xhash": "c",
|
||||
"xiosbase": "c",
|
||||
"xstring": "c",
|
||||
"xtree": "c",
|
||||
"xutility": "c",
|
||||
"menu_input_dialog.h": "c",
|
||||
"menu_filebrowser.h": "c",
|
||||
"ozone_sidebar.h": "c",
|
||||
"menu_thumbnail_path.h": "c",
|
||||
"badges.h": "c"
|
||||
},
|
||||
"C_Cpp.dimInactiveRegions": false,
|
||||
}
|
||||
Vendored
-128
@@ -1,128 +0,0 @@
|
||||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "linux clean build",
|
||||
"type": "shell",
|
||||
"group": "build",
|
||||
"command": "make clean && ./configure && make -j12"
|
||||
},
|
||||
{
|
||||
"label": "linux clean",
|
||||
"type": "shell",
|
||||
"group": "build",
|
||||
"command": "make clean"
|
||||
},
|
||||
{
|
||||
"label": "linux build with debug symbols",
|
||||
"type": "shell",
|
||||
"group": "build",
|
||||
"command": "DEBUG=1 make -j12"
|
||||
},
|
||||
{
|
||||
"label": "linux build",
|
||||
"type": "shell",
|
||||
"group": "build",
|
||||
"command": "make -j12"
|
||||
},
|
||||
{
|
||||
"label": "linux build and run",
|
||||
"type": "shell",
|
||||
"group": "build",
|
||||
"command": "make -j12 && ./retroarch -v"
|
||||
},
|
||||
{
|
||||
"label": "linux build and run with debug symbols",
|
||||
"type": "shell",
|
||||
"group": "build",
|
||||
"command": "DEBUG=1 make -j12 && ./retroarch -v"
|
||||
},
|
||||
{
|
||||
"label": "msys2-mingw64 build",
|
||||
"type": "shell",
|
||||
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
|
||||
"command": "./configure; make -j2",
|
||||
"options": {
|
||||
"shell": {
|
||||
"executable": "C:\\msys64\\usr\\bin\\bash.exe",
|
||||
"args": [
|
||||
"-c"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "msys2-mingw64 build with debug symbols",
|
||||
"type": "shell",
|
||||
|
||||
"group": "build",
|
||||
|
||||
"command": "./configure; DEBUG=1 make -j2",
|
||||
"options": {
|
||||
"shell": {
|
||||
"executable": "C:\\msys64\\usr\\bin\\bash.exe",
|
||||
"args": [
|
||||
"-c"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "msys2-mingw64 rebuild",
|
||||
"type": "shell",
|
||||
|
||||
"group": "build",
|
||||
|
||||
"command": "make -j2",
|
||||
"options": {
|
||||
"shell": {
|
||||
"executable": "C:\\msys64\\usr\\bin\\bash.exe",
|
||||
"args": [
|
||||
"-c"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "msys2-mingw64 clean",
|
||||
"type": "shell",
|
||||
|
||||
"group": "build",
|
||||
|
||||
"command": "make clean",
|
||||
"options": {
|
||||
"shell": {
|
||||
"executable": "C:\\msys64\\usr\\bin\\bash.exe",
|
||||
"args": [
|
||||
"-c"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "msys2-mingw64 run",
|
||||
"type": "shell",
|
||||
|
||||
"group": {
|
||||
"kind": "test",
|
||||
"isDefault": true },
|
||||
|
||||
"command": "./retroarch -v",
|
||||
"options": {
|
||||
"shell": {
|
||||
"executable": "C:\\msys64\\usr\\bin\\bash.exe",
|
||||
"args": [
|
||||
"-c"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
diff --git a/gfx/drivers_context/wgl_ctx.c b/gfx/drivers_context/wgl_ctx.c
|
||||
index b90a8e40c3..e57c4df194 100644
|
||||
--- a/gfx/drivers_context/wgl_ctx.c
|
||||
+++ b/gfx/drivers_context/wgl_ctx.c
|
||||
@@ -78,6 +78,47 @@
|
||||
#ifndef WGL_CONTEXT_DEBUG_BIT_ARB
|
||||
#define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001
|
||||
#endif
|
||||
+
|
||||
+#ifndef WGL_ACCELERATION_ARB
|
||||
+#define WGL_ACCELERATION_ARB 0x2003
|
||||
+#endif
|
||||
+
|
||||
+#ifndef WGL_FULL_ACCELERATION_ARB
|
||||
+#define WGL_FULL_ACCELERATION_ARB 0x2027
|
||||
+#endif
|
||||
+
|
||||
+#ifndef WGL_DRAW_TO_WINDOW_ARB
|
||||
+#define WGL_DRAW_TO_WINDOW_ARB 0x2001
|
||||
+#endif
|
||||
+
|
||||
+#ifndef WGL_DOUBLE_BUFFER_ARB
|
||||
+#define WGL_DOUBLE_BUFFER_ARB 0x2011
|
||||
+#endif
|
||||
+
|
||||
+#ifndef WGL_RED_BITS_ARB
|
||||
+#define WGL_RED_BITS_ARB 0x2015
|
||||
+#endif
|
||||
+
|
||||
+#ifndef WGL_GREEN_BITS_ARB
|
||||
+#define WGL_GREEN_BITS_ARB 0x2017
|
||||
+#endif
|
||||
+
|
||||
+#ifndef WGL_BLUE_BITS_ARB
|
||||
+#define WGL_BLUE_BITS_ARB 0x2019
|
||||
+#endif
|
||||
+
|
||||
+#ifndef WGL_ALPHA_BITS_ARB
|
||||
+#define WGL_ALPHA_BITS_ARB 0x201B
|
||||
+#endif
|
||||
+
|
||||
+#ifndef WGL_PIXEL_TYPE_ARB
|
||||
+#define WGL_PIXEL_TYPE_ARB 0x2013
|
||||
+#endif
|
||||
+
|
||||
+#ifndef WGL_TYPE_RGBA_ARB
|
||||
+#define WGL_TYPE_RGBA_ARB 0x202B
|
||||
+#endif
|
||||
+
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_OPENGL)
|
||||
@@ -313,6 +354,43 @@ static void create_gl_context(HWND hwnd, bool *quit)
|
||||
RARCH_LOG("[WGL]: Adaptive VSync supported.\n");
|
||||
wgl_adaptive_vsync = true;
|
||||
}
|
||||
+ if (wgl_has_extension("WGL_ARB_pixel_format", extensions))
|
||||
+ {
|
||||
+ BOOL (WINAPI * wglChoosePixelFormatARB)
|
||||
+ (HDC hdc,
|
||||
+ const int *piAttribIList,
|
||||
+ const FLOAT *pfAttribFList,
|
||||
+ UINT nMaxFormats,
|
||||
+ int *piFormats,
|
||||
+ UINT *nNumFormats);
|
||||
+ UINT nMatchingFormats;
|
||||
+ int index = 0;
|
||||
+ int attribsDesired[] = {
|
||||
+ WGL_DRAW_TO_WINDOW_ARB, 1,
|
||||
+ WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB,
|
||||
+ WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB,
|
||||
+ WGL_RED_BITS_ARB, 10,
|
||||
+ WGL_GREEN_BITS_ARB, 10,
|
||||
+ WGL_BLUE_BITS_ARB, 10,
|
||||
+ WGL_ALPHA_BITS_ARB, 2,
|
||||
+ WGL_DOUBLE_BUFFER_ARB, 1,
|
||||
+ 0,0
|
||||
+ };
|
||||
+ wglChoosePixelFormatARB = (BOOL (WINAPI *) (HDC, const int *,
|
||||
+ const FLOAT*, UINT, int*, UINT*))
|
||||
+ gfx_ctx_wgl_get_proc_address("wglChoosePixelFormatARB");
|
||||
+
|
||||
+ RARCH_LOG("[WGL]: ARB pixel format supported.\n");
|
||||
+
|
||||
+ if (wglChoosePixelFormatARB(win32_hdc, attribsDesired,
|
||||
+ NULL, 1, &index, &nMatchingFormats))
|
||||
+ {
|
||||
+ if (nMatchingFormats == 0)
|
||||
+ {
|
||||
+ RARCH_WARN("No 10bpc WGL_ARB_pixel_formats found!\n");
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,321 +0,0 @@
|
||||
static const char *retroarch_contributors_list = R"(
|
||||
RetroArch and the libretro team would like to
|
||||
acknowledge the following contributors:
|
||||
|
||||
1ch (L0sted)
|
||||
Aaahh Ahh (Aaahh)
|
||||
Aaron Oneal (aarononeal)
|
||||
Adam Londero (alondero)
|
||||
Adam Mechtley (amechtley)
|
||||
AdrianoML
|
||||
ajefr
|
||||
Alberto Simon (asimonf)
|
||||
Alcaro
|
||||
Aleksey Samoilov (Sunderland93)
|
||||
Alessandro Mangone (Vektor) (zevektor)
|
||||
Alex Eckhart (alex34567)
|
||||
Alex Folland (AlexFolland)
|
||||
Alexander Spady (alkaseltzerspadt)
|
||||
Alexandre Garcia (Alexandre-Garcia)
|
||||
Alfredo Monclus (alfrix)
|
||||
aliaspider
|
||||
alphanu1
|
||||
altiereslima
|
||||
Alwin Garside (Yogarine)
|
||||
Amiga1200Gamer (amigagamer)
|
||||
Andre Leiradella (leiradel)
|
||||
Andrés (fr500)
|
||||
Anthony J. Bentley (bentley)
|
||||
Antonio Jose Ramos Marquez (psxdev)
|
||||
AridRayne
|
||||
ArnaudFaucher
|
||||
Arto Vainiolehto (arakerlu)
|
||||
Ash (QuarkTheAwesome)
|
||||
Ashura (CoalaJoe)
|
||||
Autechre64
|
||||
Avton1
|
||||
ayssia
|
||||
barbudreadmon
|
||||
bearoso
|
||||
benutzer193
|
||||
blackgur
|
||||
Boris Timofeev (btimofeev)
|
||||
bparker06
|
||||
Brandon Johnson (Denu8thell)
|
||||
Brian Koropoff (bkoropoff)
|
||||
Brian S. Stephan (bsstephan)
|
||||
Brunnis
|
||||
bubuleur
|
||||
Casey Borders (CaseyB)
|
||||
ceb33
|
||||
celerizer
|
||||
Chris Merrett (chrisfu)
|
||||
Christian Murphy (grimpunch)
|
||||
chu (9chu)
|
||||
CidVonHighwind
|
||||
clienthax
|
||||
cold-brewed
|
||||
CompCom
|
||||
Conn O'Griofa (psyke83)
|
||||
CozmoP
|
||||
cpsw
|
||||
Cray Elliott (MP2E)
|
||||
Cristian Sandu (crazyquark)
|
||||
ctult
|
||||
cucholix
|
||||
cudencuden
|
||||
cxd4
|
||||
dalter
|
||||
Dan Weiss (Dwedit)
|
||||
danieljg
|
||||
Daniil Zhilin (LaserMoai)
|
||||
dankcushions
|
||||
Dave (freakdave)
|
||||
Dave Leaver (danzel)
|
||||
David Demelier (markand)
|
||||
David Erickson (daviderickson)
|
||||
David Shah (daveshah1)
|
||||
David Walters (hiddenasbestos)
|
||||
DEX357
|
||||
diablodiab
|
||||
dibas
|
||||
Diego A. (SuperrSonic)
|
||||
Diego Viola (diegoviola)
|
||||
Diogo Barros (BlueKore)
|
||||
DogParty
|
||||
dor3k
|
||||
driver1998
|
||||
Dudu Akiva (duduke)
|
||||
duganchen
|
||||
dukemiller
|
||||
duskgao
|
||||
ekipan
|
||||
Emmanuel Martin (daliaetnano)
|
||||
endrift
|
||||
erbridge
|
||||
esoptron
|
||||
Ethan Lee (flibitijibibo)
|
||||
Exvat
|
||||
Ezio-PS
|
||||
Fabio (Oibaf66)
|
||||
Fabio Ritrovato (Sephiroth87)
|
||||
Fayne Aldan (FayneAldan)
|
||||
FIX94
|
||||
Flame Sage (chris062689)
|
||||
flyinghead
|
||||
Francisco Javier Trujillo Mata (fjtrujy)
|
||||
Francisco José García García (frangarcj)
|
||||
Gabriel (Ghabry)
|
||||
GameDragon2k
|
||||
Garrett Brown (garbear)
|
||||
gblues
|
||||
Geoffrey Plitt (GeoffreyPlitt)
|
||||
Glenn Hevey (hevey)
|
||||
Googer
|
||||
gouchi
|
||||
grant2258
|
||||
Gregor Richards (GregorR)
|
||||
Gui Andrade (archshift)
|
||||
Gustavo Maciel Dias Vieira (gmdvieira)
|
||||
gvbr
|
||||
H. İbrahim Güngör (igungor)
|
||||
hadess
|
||||
Hans-Kristian Arntzen (Themaister)
|
||||
Henri Gomez (hgomez)
|
||||
Henri Gomez (hgomez-sonarsource)
|
||||
Higor Eurípedes (heuripedes)
|
||||
Hisman Yosika (dnjstlr555)
|
||||
hizzlekizzle
|
||||
Hugo B. (hug0b)
|
||||
Hugo Hromic (hhromic)
|
||||
hunterk
|
||||
hyarsan
|
||||
Hyllian
|
||||
i30817
|
||||
iAmGhost
|
||||
Jack (jakcron)
|
||||
Jacob (cubtekki)
|
||||
James Le Cuirot (chewi)
|
||||
James Sexton (Bezier89)
|
||||
Jamiras
|
||||
Jan Holthuis (Holzhaus)
|
||||
Jay McCarthy (jeapostrophe)
|
||||
jdgleaver
|
||||
Jean-André Santoni (kivutar)
|
||||
Jean-Paul Mari (djipi)
|
||||
Jean-Sébastien Guay (Skylark13)
|
||||
Jesse Bryan (winneon)
|
||||
Joel (joel16)
|
||||
Joerg Sonnenberger (jsonn)
|
||||
Johannes Schickel (lordhoto)
|
||||
John Regan (jprjr)
|
||||
Jon Maddox (maddox)
|
||||
Jonathan Relf (jonathanrelf)
|
||||
Joohan Lee (losernator)
|
||||
Jools Wills (joolswills)
|
||||
Jose Lage Miguez (Joselagem)
|
||||
Joseph Carter (iKarith)
|
||||
Joseph Conan Montgomery (Grotke)
|
||||
Josh Palmer (ShiftyAxel)
|
||||
JuanVCS
|
||||
Justin Jacobs (dorkster)
|
||||
Justin Weiss (justinweiss)
|
||||
Ken Rossato (rossato)
|
||||
krzys_h (krzys-h)
|
||||
kurumushi
|
||||
kwyxz
|
||||
l3iggs
|
||||
lambolighting
|
||||
lasers
|
||||
Lawrence Kesteloot (lkesteloot)
|
||||
lifajucejo
|
||||
liffy (lifning)
|
||||
Lionel Flandrin (simias)
|
||||
littleguy77
|
||||
Logan (loganmc10)
|
||||
lordashram
|
||||
Lothar Serra Mari (lotharsm)
|
||||
Lubosz Sarnecki (lubosz)
|
||||
lucianposton
|
||||
lxerandrew
|
||||
m4xw
|
||||
Mahyar Koshkouei (deltabeard)
|
||||
Manuel Alfayate Corchete (vanfanel)
|
||||
Marcelo Munhoz Pélos (mpelos)
|
||||
markwkidd
|
||||
Maschell
|
||||
Mat M. (lioncash)
|
||||
Mats A. (Datamats)
|
||||
Matt Sephton (gingerbeardman)
|
||||
Matthew Wang (asakous)
|
||||
Max K. (langerhans)
|
||||
Maxime Gauduin (alucryd)
|
||||
mcrisostomo
|
||||
meancoot
|
||||
meepingsnesroms
|
||||
meleu
|
||||
Michael K. (kuxii2016)
|
||||
Michael Lelli (ToadKing)
|
||||
Michał Durak (micechal)
|
||||
mickski56
|
||||
Mico Chopitea (micochops)
|
||||
miguelpinheiro
|
||||
Mike Swanson (chungy)
|
||||
miqlas (extrowerk)
|
||||
misson20000
|
||||
Monroe88
|
||||
mprobinson
|
||||
MrHuu
|
||||
MrJs (mrjschulte)
|
||||
muzuiget
|
||||
mwtremblay
|
||||
myfreeweb
|
||||
Nathan S. (natinusala)
|
||||
NathanStrong-Tripwire
|
||||
nattycleopatra
|
||||
nayslayer
|
||||
netux79
|
||||
nfnty
|
||||
nia (ensra)
|
||||
Nicolas Adenis-Lamarre (nadenislamarre)
|
||||
Nicolas Guillaumin (nguillaumin)
|
||||
Nicolas Lopez Fernandez (pyroesp)
|
||||
Nikita Vakhrushev (SwooodGa)
|
||||
Nikola Kocić (nikola-kocic)
|
||||
Niouby
|
||||
nosh01
|
||||
not6 (r-type)
|
||||
notaz
|
||||
nstCactus
|
||||
nurupo
|
||||
Oggom
|
||||
Oleg Shevchenko (olsh)
|
||||
opendata26
|
||||
orbea
|
||||
OV2
|
||||
pamapa
|
||||
Paolo Bonzini (bonzini)
|
||||
Paul McCarty (notabeatle)
|
||||
Pedro Ribeiro (pedrib)
|
||||
pinumbernumber
|
||||
pponso1
|
||||
Ramiro Morales (ramiro)
|
||||
Raphaël Zumer (rzumer)
|
||||
retro-wertz
|
||||
retrotails
|
||||
reztek
|
||||
Richard Howell (rmaz)
|
||||
rlnilsen
|
||||
Rob Loach (RobLoach)
|
||||
Romain Gay (vikbez)
|
||||
Romain Graillot (notnotme)
|
||||
Romain TISSERAND (rtissera)
|
||||
Roman Kalashnikov (lunixoid)
|
||||
Royerson
|
||||
rrooij
|
||||
rsn8887
|
||||
Ryunam
|
||||
rz5
|
||||
Saggi Mizrahi (ficoos)
|
||||
SAKUJ0
|
||||
Sam Pagenkopf (44100hertz)
|
||||
Sam Stenvall (Jalle19)
|
||||
Samuel P. (p-sam)
|
||||
Scheiker
|
||||
Sebastien Ronsse (sronsse)
|
||||
Sergi Granell (xerpi)
|
||||
Sergio Padrino (sergiou87)
|
||||
sergio-br2 (sergiobenrocha2)
|
||||
Seth Kingsley (sethk)
|
||||
Shane Mouton (ismouton)
|
||||
Shizeeg Unadequatov (shizeeg)
|
||||
slotek
|
||||
sparklewind
|
||||
spec-chum
|
||||
Stefan (gizmo98)
|
||||
stefan-gr
|
||||
stellarporter
|
||||
Steven M. Vascellaro (stevoisiak)
|
||||
Stuart Carnie (stuartcarnie)
|
||||
Sunguk Lee (d3m3vilurr)
|
||||
Supernature2k
|
||||
Sven (RetroSven)
|
||||
Swingflip
|
||||
Swizzy
|
||||
Sylvain Colinet (Skarsnik)
|
||||
Tatsuya79
|
||||
Terry Lewis (terry-au)
|
||||
thedax
|
||||
theheroGAC
|
||||
TheMrIron2
|
||||
TheOfficialFloW
|
||||
thiolliere
|
||||
Thomas Lorblanchès (Zlika)
|
||||
Tobias Jakobi (tobiasjakobi)
|
||||
Tomáš Kelemen (ToKe79)
|
||||
Torsten Paul (t-paul)
|
||||
TotalCaesar659
|
||||
TroggleMonkey
|
||||
Twinaphex
|
||||
URBANsUNITED
|
||||
vgmoose
|
||||
Vicky C Lau (vickychenglau)
|
||||
Vladimir Panteleev (CyberShadow)
|
||||
Vladimir Serbinenko (phcoder)
|
||||
Víctor "IlDucci" (IlDucci)
|
||||
waitingmoon
|
||||
Wang Vincent (susemm)
|
||||
webgeek1234
|
||||
Weedy Weed Smoker (WeedyWeedSmoker)
|
||||
WerWolv
|
||||
Wiimpathy
|
||||
Wiktor Strzębała (wiktorek140)
|
||||
xhp-creations
|
||||
yesfish (huwpascoe)
|
||||
Yongwoon Cho (ssangkong)
|
||||
yoshisuga
|
||||
zeromus
|
||||
zlice
|
||||
Zoran Vuckovic (casdevel)
|
||||
Ömercan Kömür (fpscan)
|
||||
)";
|
||||
-1253
File diff suppressed because it is too large.
Load diff
+58
-58
@@ -1,58 +1,58 @@
|
||||
# Contributing to RetroArch
|
||||
|
||||
If you are a developer and want to contribute to the development of RetroArch, please read this.
|
||||
If you have found a bug and want to submit a minor patch or a bug report, please read this as well.
|
||||
|
||||
# Submitting a bug report
|
||||
When submitting a bug report, make sure that the bug is local to RetroArch.
|
||||
A bug in a libretro core or something deemed to be external is likely to be closed very fast.
|
||||
If you still suspect a bug in RetroArch, make sure to test with several cores to make sure.
|
||||
|
||||
If you have troubles building RetroArch on Linux/BSD/OSX, make sure to paste shell output of ./configure,
|
||||
as well as config.log and shell output of make. If building on Windows, just paste shell output of make.
|
||||
|
||||
If the issue occurs during runtime, make sure to paste RetroArch's verbose log.
|
||||
If using Phoenix frontend, you can find log in (File -> Show Log) after running.
|
||||
In console, make sure to run with verbose (-v) flag.
|
||||
|
||||
# Pull Requests
|
||||
Outside contributions are generally only accepted in the form of a pull request. The process is very simple.
|
||||
Fork RetroArch, make your changes, and issue a pull request on GitHub. This can all be done within the browser.
|
||||
The changes are reviewed, and might be merged in. If the pull request isn't acceptable at the time,
|
||||
note that it's possible to continue pushing up commits to your branch.
|
||||
|
||||
If you want to develop a larger feature,
|
||||
we'd like to discuss this first (ideally on IRC) so that you don't risk developing something
|
||||
that won't be merged. A pull request with a proof-of-concept is fine, but please indicate so.
|
||||
|
||||
## libretro API
|
||||
If you wish to add functionality to libretro's API, it can take some time to merge in, because changes
|
||||
to libretro API will affect other projects as well, and we highly value API/ABI stability.
|
||||
Features will only be added when deemed *necessary* for a concrete libretro core to function properly.
|
||||
Features will not be added on basis of hypothetical libretro implementations.
|
||||
|
||||
# Coding style
|
||||
Having a consistent code style throughout the code base is highly valued.
|
||||
Please look through the code to get a feel for the coding style.
|
||||
A pull request may be asked to fix the coding style before submission.
|
||||
In other cases, a pull request may be followed up with a "style nit commit".
|
||||
|
||||
## Non-obvious things:
|
||||
- Code should be both C89 and ISO C++ compatible. This dual requirement is for XBox360 and MSVC in general. Think of it as a C++ compatible subset of C99.
|
||||
- Warnings are not allowed (-Wall). Make sure your code is warning-free. Note that warning sensitivity differs a bit across compiler versions.
|
||||
- Using deprecated APIs is discouraged.
|
||||
|
||||
# Copyright Headers and AUTHORS
|
||||
If you have contributed to a part of a source file (a chunk of code that's written by you),
|
||||
you should add yourself to the copyright header in that file.
|
||||
If you have contributed significantly
|
||||
(a feature, a contribution you can "name", e.g. "Added audio driver foo"), you should add yourself to AUTHORS file.
|
||||
We'd like your full name and email, and which features you have been part of.
|
||||
|
||||
# IRC
|
||||
Active development happens on IRC. (#retroarch @ irc.freenode.org)
|
||||
We value discussing things in "real-time".
|
||||
|
||||
# Commit Access
|
||||
Contributors who show a track record of making good pull requests over time will eventually get commit access to the repo.
|
||||
This typically happens when the "overhead" of looking through pull requests over time becomes a burden.
|
||||
# Contributing to RetroArch
|
||||
|
||||
If you are a developer and want to contribute to the development of RetroArch, please read this.
|
||||
If you have found a bug and want to submit a minor patch or a bug report, please read this as well.
|
||||
|
||||
# Submitting a bug report
|
||||
When submitting a bug report, make sure that the bug is local to RetroArch.
|
||||
A bug in a libretro core or something deemed to be external is likely to be closed very fast.
|
||||
If you still suspect a bug in RetroArch, make sure to test with several cores to make sure.
|
||||
|
||||
If you have troubles building RetroArch on Linux/BSD/OSX, make sure to paste shell output of ./configure,
|
||||
as well as config.log and shell output of make. If building on Windows, just paste shell output of make.
|
||||
|
||||
If the issue occurs during runtime, make sure to paste RetroArch's verbose log.
|
||||
If using Phoenix frontend, you can find log in (File -> Show Log) after running.
|
||||
In console, make sure to run with verbose (-v) flag.
|
||||
|
||||
# Pull Requests
|
||||
Outside contributions are generally only accepted in the form of a pull request. The process is very simple.
|
||||
Fork RetroArch, make your changes, and issue a pull request on GitHub. This can all be done within the browser.
|
||||
The changes are reviewed, and might be merged in. If the pull request isn't acceptable at the time,
|
||||
note that it's possible to continue pushing up commits to your branch.
|
||||
|
||||
If you want to develop a larger feature,
|
||||
we'd like to discuss this first (ideally on IRC) so that you don't risk developing something
|
||||
that won't be merged. A pull request with a proof-of-concept is fine, but please indicate so.
|
||||
|
||||
## libretro API
|
||||
If you wish to add functionality to libretro's API, it can take some time to merge in, because changes
|
||||
to libretro API will affect other projects as well, and we highly value API/ABI stability.
|
||||
Features will only be added when deemed *necessary* for a concrete libretro core to function properly.
|
||||
Features will not be added on basis of hypothetical libretro implementations.
|
||||
|
||||
# Coding style
|
||||
Having a consistent code style throughout the code base is highly valued.
|
||||
Please look through the code to get a feel for the coding style.
|
||||
A pull request may be asked to fix the coding style before submission.
|
||||
In other cases, a pull request may be followed up with a "style nit commit".
|
||||
|
||||
## Non-obvious things:
|
||||
- Code should be both ISO C99 and ISO C++ compatible. This dual requirement is for XBox360 and MSVC in general. Think of it as a C++ compatible subset of C99.
|
||||
- Warnings are not allowed (-Wall). Make sure your code is warning-free. Note that warning sensitivity differs a bit across compiler versions.
|
||||
- Using deprecated APIs is discouraged.
|
||||
|
||||
# Copyright Headers and AUTHORS
|
||||
If you have contributed to a part of a source file (a chunk of code that's written by you),
|
||||
you should add yourself to the copyright header in that file.
|
||||
If you have contributed significantly
|
||||
(a feature, a contribution you can "name", e.g. "Added audio driver foo"), you should add yourself to AUTHORS file.
|
||||
We'd like your full name and email, and which features you have been part of.
|
||||
|
||||
# IRC
|
||||
Active development happens on IRC. (#retroarch @ irc.freenode.org)
|
||||
We value discussing things in "real-time".
|
||||
|
||||
# Commit Access
|
||||
Contributors who show a track record of making good pull requests over time will eventually get commit access to the repo.
|
||||
This typically happens when the "overhead" of looking through pull requests over time becomes a burden.
|
||||
@@ -1,6 +1,4 @@
|
||||
HAVE_FILE_LOGGER=1
|
||||
NEED_CXX_LINKER?=0
|
||||
NEED_GOLD_LINKER?=0
|
||||
MISSING_DECLS =0
|
||||
|
||||
ifneq ($(C90_BUILD),)
|
||||
@@ -9,80 +7,33 @@ endif
|
||||
|
||||
include config.mk
|
||||
|
||||
# Put your favorite compile flags in this file, if you want different defaults than upstream.
|
||||
# Do not attempt to create that file upstream.
|
||||
# (It'd be better to put this comment in that file, but .gitignore doesn't work on files that exist in the repo.)
|
||||
-include Makefile.local
|
||||
|
||||
ifeq ($(HAVE_ANGLE), 1)
|
||||
TARGET = retroarch_angle
|
||||
else
|
||||
TARGET = retroarch
|
||||
|
||||
OBJDIR := obj-unix
|
||||
|
||||
ifeq ($(GLOBAL_CONFIG_DIR),)
|
||||
GLOBAL_CONFIG_DIR = /etc
|
||||
endif
|
||||
|
||||
OBJ :=
|
||||
OBJ :=
|
||||
LIBS :=
|
||||
DEF_FLAGS :=
|
||||
ASFLAGS :=
|
||||
DEFINES := -DHAVE_CONFIG_H -DRARCH_INTERNAL -D_FILE_OFFSET_BITS=64
|
||||
DEFINES := -DHAVE_CONFIG_H -DRARCH_INTERNAL -DHAVE_OVERLAY
|
||||
DEFINES += -DGLOBAL_CONFIG_DIR='"$(GLOBAL_CONFIG_DIR)"'
|
||||
|
||||
OBJDIR_BASE := obj-unix
|
||||
|
||||
ifeq ($(NEED_GOLD_LINKER), 1)
|
||||
LDFLAGS += -fuse-ld=gold
|
||||
endif
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
OBJDIR := $(OBJDIR_BASE)/debug
|
||||
CFLAGS ?= -O0 -g
|
||||
CXXFLAGS ?= -O0 -g
|
||||
DEFINES += -DDEBUG -D_DEBUG
|
||||
else
|
||||
OBJDIR := $(OBJDIR_BASE)/release
|
||||
CFLAGS ?= -O3
|
||||
CXXFLAGS ?= -O3
|
||||
DEF_FLAGS += -ffast-math
|
||||
endif
|
||||
|
||||
DEF_FLAGS += -Wall
|
||||
|
||||
ifneq ($(findstring BSD,$(OS)),)
|
||||
DEF_FLAGS += -DBSD
|
||||
LDFLAGS += -L/usr/local/lib
|
||||
UDEV_CFLAGS += -I/usr/local/include/libepoll-shim
|
||||
UDEV_LIBS += -lepoll-shim
|
||||
endif
|
||||
|
||||
ifneq ($(findstring DOS,$(OS)),)
|
||||
DEF_FLAGS += -march=i386
|
||||
LDFLAGS += -lemu
|
||||
endif
|
||||
|
||||
ifneq ($(findstring FPGA,$(OS)),)
|
||||
DEFINES += -DHAVE_FPGA
|
||||
endif
|
||||
|
||||
ifneq ($(findstring Win32,$(OS)),)
|
||||
LDFLAGS += -static-libgcc -lwinmm
|
||||
LDFLAGS += -static-libgcc
|
||||
endif
|
||||
|
||||
include Makefile.common
|
||||
|
||||
ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang"),1)
|
||||
DEF_FLAGS += -Wno-invalid-source-encoding -Wno-incompatible-ms-struct
|
||||
endif
|
||||
|
||||
ifeq ($(shell $(CC) -v 2>&1 | grep -c "tcc"),1)
|
||||
MD = -MD
|
||||
else
|
||||
MD = -MMD
|
||||
DEFINES += -Wno-invalid-source-encoding
|
||||
endif
|
||||
|
||||
HEADERS = $(wildcard */*/*.h) $(wildcard */*.h) $(wildcard *.h)
|
||||
|
||||
ifeq ($(MISSING_DECLS), 1)
|
||||
DEF_FLAGS += -Werror=missing-declarations
|
||||
DEFINES += -Werror=missing-declarations
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_DYLIB), 1)
|
||||
@@ -99,58 +50,60 @@ ifneq ($(V),1)
|
||||
Q := @
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_DRMINGW), 1)
|
||||
DEF_FLAGS += -DHAVE_DRMINGW
|
||||
LDFLAGS += $(DRMINGW_LIBS)
|
||||
endif
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
OPTIMIZE_FLAG = -O0 -g
|
||||
else
|
||||
OPTIMIZE_FLAG = -O3 -ffast-math
|
||||
ifneq ($(findstring Win32,$(OS)),)
|
||||
LDFLAGS += -mwindows
|
||||
endif
|
||||
|
||||
ifneq ($(CXX_BUILD), 1)
|
||||
ifneq ($(C89_BUILD),)
|
||||
CFLAGS += -std=c89 -ansi -pedantic -Werror=pedantic -Wno-long-long
|
||||
else ifeq ($(HAVE_C99), 1)
|
||||
CFLAGS += $(C99_CFLAGS)
|
||||
endif
|
||||
|
||||
CFLAGS += -D_GNU_SOURCE
|
||||
endif
|
||||
|
||||
DEF_FLAGS += $(INCLUDE_DIRS) -I. -Ideps -Ideps/stb
|
||||
CFLAGS += -Wall $(OPTIMIZE_FLAG) $(INCLUDE_DIRS) $(DEBUG_FLAG) -I.
|
||||
|
||||
CFLAGS += $(DEF_FLAGS)
|
||||
CXXFLAGS += $(DEF_FLAGS) -D__STDC_CONSTANT_MACROS
|
||||
APPEND_CFLAGS := $(CFLAGS)
|
||||
CXXFLAGS += $(APPEND_CFLAGS) -std=c++11 -D__STDC_CONSTANT_MACROS
|
||||
OBJCFLAGS := $(CFLAGS) -D__STDC_CONSTANT_MACROS
|
||||
|
||||
ifeq ($(HAVE_CXX), 1)
|
||||
ifeq ($(CXX_BUILD), 1)
|
||||
LINK = $(CXX)
|
||||
CFLAGS := $(CXXFLAGS) -xc++
|
||||
CFLAGS += -DCXX_BUILD
|
||||
CXXFLAGS += -DCXX_BUILD
|
||||
else ifeq ($(NEED_CXX_LINKER),1)
|
||||
LINK = $(CXX)
|
||||
else
|
||||
LINK = $(CC)
|
||||
endif
|
||||
ifeq ($(CXX_BUILD), 1)
|
||||
LINK = $(CXX)
|
||||
CFLAGS := $(CXXFLAGS) -xc++
|
||||
else
|
||||
LINK = $(CC)
|
||||
ifeq ($(findstring Win32,$(OS)),)
|
||||
LINK = $(CC)
|
||||
else
|
||||
# directx-related code is c++
|
||||
LINK = $(CXX)
|
||||
endif
|
||||
|
||||
ifneq ($(GNU90_BUILD), 1)
|
||||
ifneq ($(findstring icc,$(CC)),)
|
||||
CFLAGS += -std=c99 -D_GNU_SOURCE
|
||||
else
|
||||
CFLAGS += -std=gnu99 -D_GNU_SOURCE
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(C89_BUILD),)
|
||||
CFLAGS += -std=c89 -ansi -pedantic -Werror=pedantic -Wno-long-long
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(NOUNUSED), yes)
|
||||
CFLAGS += -Wno-unused-result
|
||||
CXXFLAGS += -Wno-unused-result
|
||||
endif
|
||||
ifeq ($(NOUNUSED_VARIABLE), yes)
|
||||
CFLAGS += -Wno-unused-variable
|
||||
CXXFLAGS += -Wno-unused-variable
|
||||
endif
|
||||
|
||||
RARCH_OBJ := $(addprefix $(OBJDIR)/,$(OBJ))
|
||||
|
||||
ifneq ($(X86),)
|
||||
CFLAGS += -m32
|
||||
CXXFLAGS += -m32
|
||||
LDFLAGS += -m32
|
||||
endif
|
||||
|
||||
ifneq ($(SANITIZER),)
|
||||
CFLAGS := -fsanitize=$(SANITIZER) $(CFLAGS)
|
||||
CXXFLAGS := -fsanitize=$(SANITIZER) $(CXXFLAGS)
|
||||
LDFLAGS := -fsanitize=$(SANITIZER) $(LDFLAGS)
|
||||
CFLAGS := -fsanitize=$(SANITIZER) $(CFLAGS)
|
||||
CXXFLAGS := -fsanitize=$(SANITIZER) $(CXXFLAGS)
|
||||
LDFLAGS := -fsanitize=$(SANITIZER) $(LDLAGS)
|
||||
endif
|
||||
|
||||
ifneq ($(findstring $(GPERFTOOLS),profiler),)
|
||||
@@ -160,55 +113,26 @@ ifneq ($(findstring $(GPERFTOOLS),tcmalloc),)
|
||||
LIBS += -ltcmalloc
|
||||
endif
|
||||
|
||||
# Qt MOC generation, required for QObject-derived classes
|
||||
ifneq ($(MOC_HEADERS),)
|
||||
# prefix moc_ to base filename of paths and change extension from h to cpp, so a/b/foo.h becomes a/b/moc_foo.cpp
|
||||
MOC_SRC := $(join $(addsuffix moc_,$(addprefix $(OBJDIR)/,$(dir $(MOC_HEADERS)))), $(notdir $(MOC_HEADERS:.h=.cpp)))
|
||||
MOC_OBJ := $(patsubst %.cpp,%.o,$(MOC_SRC))
|
||||
RARCH_OBJ += $(MOC_OBJ)
|
||||
endif
|
||||
|
||||
all: $(TARGET) config.mk
|
||||
|
||||
$(MOC_SRC):
|
||||
@$(if $(Q), $(shell echo echo MOC $<),)
|
||||
$(eval MOC_TMP := $(patsubst %.h,%_moc.cpp,$@))
|
||||
$(Q)QT_SELECT=$(QT_VERSION) $(MOC) -o $(MOC_TMP) $<
|
||||
|
||||
$(foreach x,$(join $(addsuffix :,$(MOC_SRC)),$(MOC_HEADERS)),$(eval $x))
|
||||
|
||||
$(MOC_OBJ):
|
||||
@$(if $(Q), $(shell echo echo CXX $<),)
|
||||
$(Q)$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(DEFINES) -MMD -c -o $@ $<
|
||||
|
||||
$(foreach x,$(join $(addsuffix :,$(MOC_OBJ)),$(MOC_SRC)),$(eval $x))
|
||||
|
||||
ifeq ($(MAKECMDGOALS),clean)
|
||||
config.mk:
|
||||
else
|
||||
-include $(RARCH_OBJ:.o=.d)
|
||||
ifeq ($(HAVE_CONFIG_MK),)
|
||||
config.mk: configure qb/*
|
||||
@echo "config.mk is outdated or non-existing. Run ./configure again."
|
||||
@exit 1
|
||||
endif
|
||||
endif
|
||||
|
||||
SYMBOL_MAP := -Wl,-Map=output.map
|
||||
|
||||
$(TARGET): $(RARCH_OBJ)
|
||||
retroarch: $(RARCH_OBJ)
|
||||
@$(if $(Q), $(shell echo echo LD $@),)
|
||||
$(Q)$(LINK) -o $@ $(RARCH_OBJ) $(LIBS) $(LDFLAGS) $(LIBRARY_DIRS)
|
||||
|
||||
$(OBJDIR)/%.o: %.c config.h config.mk
|
||||
@mkdir -p $(dir $@)
|
||||
@$(if $(Q), $(shell echo echo CC $<),)
|
||||
$(Q)$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) $(MD) -c -o $@ $<
|
||||
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -c -o $@ $<
|
||||
|
||||
$(OBJDIR)/%.o: %.cpp config.h config.mk
|
||||
@mkdir -p $(dir $@)
|
||||
@$(if $(Q), $(shell echo echo CXX $<),)
|
||||
$(Q)$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(DEFINES) -MMD -c -o $@ $<
|
||||
$(Q)$(CXX) $(CXXFLAGS) $(DEFINES) -MMD -c -o $@ $<
|
||||
|
||||
$(OBJDIR)/%.o: %.m
|
||||
@mkdir -p $(dir $@)
|
||||
@@ -234,63 +158,31 @@ $(OBJDIR)/%.o: %.rc $(HEADERS)
|
||||
|
||||
install: $(TARGET)
|
||||
rm -f $(OBJDIR)/git_version.o
|
||||
mkdir -p $(DESTDIR)$(BIN_DIR) 2>/dev/null || /bin/true
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/bin 2>/dev/null || /bin/true
|
||||
mkdir -p $(DESTDIR)$(GLOBAL_CONFIG_DIR) 2>/dev/null || /bin/true
|
||||
mkdir -p $(DESTDIR)$(DATA_DIR)/applications 2>/dev/null || /bin/true
|
||||
mkdir -p $(DESTDIR)$(DOC_DIR) 2>/dev/null || /bin/true
|
||||
mkdir -p $(DESTDIR)$(MAN_DIR)/man6 2>/dev/null || /bin/true
|
||||
mkdir -p $(DESTDIR)$(DATA_DIR)/pixmaps 2>/dev/null || /bin/true
|
||||
cp $(TARGET) $(DESTDIR)$(BIN_DIR)
|
||||
cp tools/cg2glsl.py $(DESTDIR)$(BIN_DIR)/retroarch-cg2glsl
|
||||
cp retroarch.cfg $(DESTDIR)$(GLOBAL_CONFIG_DIR)
|
||||
cp retroarch.desktop $(DESTDIR)$(DATA_DIR)/applications
|
||||
cp docs/retroarch.6 $(DESTDIR)$(MAN_DIR)/man6
|
||||
cp docs/retroarch-cg2glsl.6 $(DESTDIR)$(MAN_DIR)/man6
|
||||
cp media/retroarch.svg $(DESTDIR)$(DATA_DIR)/pixmaps
|
||||
cp COPYING $(DESTDIR)$(DOC_DIR)
|
||||
cp README.md $(DESTDIR)$(DOC_DIR)
|
||||
chmod 755 $(DESTDIR)$(BIN_DIR)/$(TARGET)
|
||||
chmod 755 $(DESTDIR)$(BIN_DIR)/retroarch-cg2glsl
|
||||
chmod 644 $(DESTDIR)$(GLOBAL_CONFIG_DIR)/retroarch.cfg
|
||||
chmod 644 $(DESTDIR)$(DATA_DIR)/applications/retroarch.desktop
|
||||
chmod 644 $(DESTDIR)$(MAN_DIR)/man6/retroarch.6
|
||||
chmod 644 $(DESTDIR)$(MAN_DIR)/man6/retroarch-cg2glsl.6
|
||||
chmod 644 $(DESTDIR)$(DATA_DIR)/pixmaps/retroarch.svg
|
||||
@if test -d media/assets && test $(HAVE_ASSETS); then \
|
||||
echo "Installing media assets..."; \
|
||||
mkdir -p $(DESTDIR)$(ASSETS_DIR)/assets; \
|
||||
if test $(HAVE_MATERIALUI) = 1; then \
|
||||
cp -r media/assets/glui/ $(DESTDIR)$(ASSETS_DIR)/assets; \
|
||||
fi; \
|
||||
if test $(HAVE_XMB) = 1; then \
|
||||
cp -r media/assets/xmb/ $(DESTDIR)$(ASSETS_DIR)/assets; \
|
||||
fi; \
|
||||
if test $(HAVE_OZONE) = 1; then \
|
||||
cp -r media/assets/ozone/ $(DESTDIR)$(ASSETS_DIR)/assets; \
|
||||
fi; \
|
||||
cp media/assets/COPYING $(DESTDIR)$(DOC_DIR)/COPYING.assets; \
|
||||
echo "Asset copying done."; \
|
||||
fi
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/share/applications 2>/dev/null || /bin/true
|
||||
mkdir -p $(DESTDIR)$(MAN_DIR) 2>/dev/null || /bin/true
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/share/pixmaps 2>/dev/null || /bin/true
|
||||
install -m755 $(TARGET) $(DESTDIR)$(PREFIX)/bin
|
||||
install -m755 tools/cg2glsl.py $(DESTDIR)$(PREFIX)/bin/retroarch-cg2glsl
|
||||
install -m644 retroarch.cfg $(DESTDIR)$(GLOBAL_CONFIG_DIR)/retroarch.cfg
|
||||
install -m644 retroarch.desktop $(DESTDIR)$(PREFIX)/share/applications
|
||||
install -m644 docs/retroarch.1 $(DESTDIR)$(MAN_DIR)
|
||||
install -m644 docs/retroarch-cg2glsl.1 $(DESTDIR)$(MAN_DIR)
|
||||
install -m644 media/retroarch.svg $(DESTDIR)$(PREFIX)/share/pixmaps
|
||||
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)$(BIN_DIR)/$(TARGET)
|
||||
rm -f $(DESTDIR)$(BIN_DIR)/retroarch-cg2glsl
|
||||
rm -f $(DESTDIR)$(PREFIX)/bin/retroarch
|
||||
rm -f $(DESTDIR)$(PREFIX)/bin/retroarch-cg2glsl
|
||||
rm -f $(DESTDIR)$(GLOBAL_CONFIG_DIR)/retroarch.cfg
|
||||
rm -f $(DESTDIR)$(DATA_DIR)/applications/retroarch.desktop
|
||||
rm -f $(DESTDIR)$(DATA_DIR)/pixmaps/retroarch.svg
|
||||
rm -f $(DESTDIR)$(DOC_DIR)/COPYING
|
||||
rm -f $(DESTDIR)$(DOC_DIR)/COPYING.assets
|
||||
rm -f $(DESTDIR)$(DOC_DIR)/README.md
|
||||
rm -f $(DESTDIR)$(MAN_DIR)/man6/retroarch.6
|
||||
rm -f $(DESTDIR)$(MAN_DIR)/man6/retroarch-cg2glsl.6
|
||||
rm -rf $(DESTDIR)$(ASSETS_DIR)
|
||||
rm -f $(DESTDIR)$(PREFIX)/share/applications/retroarch.desktop
|
||||
rm -f $(DESTDIR)$(MAN_DIR)/retroarch.1
|
||||
rm -f $(DESTDIR)$(MAN_DIR)/retroarch-cg2glsl.1
|
||||
rm -f $(DESTDIR)$(PREFIX)/share/pixmaps/retroarch.svg
|
||||
|
||||
clean:
|
||||
rm -rf $(OBJDIR_BASE)
|
||||
rm -rf $(OBJDIR)
|
||||
rm -f $(TARGET)
|
||||
rm -f *.d
|
||||
|
||||
.PHONY: all install uninstall clean
|
||||
|
||||
print-%:
|
||||
@echo '$*=$($*)'
|
||||
@@ -1,24 +0,0 @@
|
||||
include Makefile.common
|
||||
|
||||
# Qt MOC generation, required for QObject-derived classes
|
||||
ifneq ($(MOC_HEADERS),)
|
||||
# prefix moc_ to base filename of paths and change extension from h to cpp, so a/b/foo.h becomes a/b/moc_foo.cpp
|
||||
MOC_SRC := $(join $(addsuffix moc_,$(dir $(MOC_HEADERS))), $(notdir $(MOC_HEADERS:.h=.cpp)))
|
||||
endif
|
||||
|
||||
MOC ?= $(error missing moc path)
|
||||
|
||||
.PHONY: generate
|
||||
|
||||
$(MOC_SRC):
|
||||
@$(if $(Q), $(shell echo echo MOC $<),)
|
||||
$(eval MOC_TMP := $(patsubst %.h,%_moc.cpp,$@))
|
||||
$(MOC) -o $(MOC_TMP) $<
|
||||
|
||||
$(foreach x,$(join $(addsuffix :,$(MOC_SRC)),$(MOC_HEADERS)),$(eval $x))
|
||||
|
||||
generate: $(MOC_SRC)
|
||||
@echo $(MOC_SRC)
|
||||
|
||||
print-%:
|
||||
@echo '$*=$($*)'
|
||||
@@ -1,49 +0,0 @@
|
||||
# This build was put together and is maintained by ModMyClassic.com for Libretro.
|
||||
# The purpose is to give Libretro a proper "official" build platform for classic consoles.
|
||||
# If you need any help in building for the classics or have any questions then please visit
|
||||
# https://modmyclassic.com and we will help in any way possible!
|
||||
|
||||
# Building Prerequisites ##############
|
||||
# arm-linux-gnueabihf-strip
|
||||
|
||||
include version.all
|
||||
|
||||
# General Shared Variables ############
|
||||
TARGET := retroarch
|
||||
|
||||
# Libretro Defines ####################
|
||||
#HAVE_CLASSIC = Classic Hook, disable some features
|
||||
#HAVE_C_A7A7 = Classic Armv7 Cortex A7 optimisation override
|
||||
#HAVE_SEGAM = Sega Mini Hook, change default configurations etc (TODO)
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
retroarch:
|
||||
#Build the RetroArch Binary for cross platform classics (ARMv7 Cortex A7)
|
||||
patchelf --version #Check if you have patchelf installed... (sudo apt-get install patchelf)
|
||||
CFLAGS="-marm -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard" ./configure --host=arm-linux-gnueabihf --disable-wayland --disable-x11 --disable-opengl --disable-opengl1 --disable-opengl_core --enable-mali_fbdev --disable-freetype --enable-opengles --enable-udev --enable-alsa --enable-neon --enable-floathard --disable-discord
|
||||
make HAVE_CLASSIC=1 HAVE_C_A7A7=1 HAVE_SEGAM=1 -j #Cook it
|
||||
arm-linux-gnueabihf-strip -v retroarch
|
||||
@echo "*********************************************************************"
|
||||
@echo "*** SEGA Mega Drive Mini RetroArch binary built successfully! ***"
|
||||
@echo "*********************************************************************"
|
||||
clean:
|
||||
rm -rf obj-unix
|
||||
rm -f *.d
|
||||
rm -f *.o
|
||||
rm -f audio/*.o
|
||||
rm -f conf/*.o
|
||||
rm -f gfx/*.o
|
||||
rm -f gfx/drivers_font/*.o
|
||||
rm -f gfx/drivers_font_renderer/*.o
|
||||
rm -f gfx/drivers_context/*.o
|
||||
rm -f gfx/py_state/*.o
|
||||
rm -f compat/*.o
|
||||
rm -f record/*.o
|
||||
rm -f input/*.o
|
||||
rm -f tools/*.o
|
||||
rm -f $(BINDIR)/retroarch
|
||||
rm -f $(BINDIR)/retroarch-joyconfig
|
||||
rm -f $(PNDDIR)/readme.html
|
||||
rm -f retroarch
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
# This build was put together and is maintained by ModMyClassic.com for Libretro.
|
||||
# The purpose is to give Libretro a proper "official" build platform for classic consoles.
|
||||
# If you need any help in building for the classics or have any questions then please visit
|
||||
# https://modmyclassic.com and we will help in any way possible!
|
||||
|
||||
# INFO: THIS BUILD TARGET ALSO COVERS THE NESC!!!
|
||||
|
||||
# Building Prerequisites ##############
|
||||
# arm-linux-gnueabihf-strip
|
||||
# patchelf
|
||||
|
||||
include version.all
|
||||
|
||||
# General Shared Variables ############
|
||||
TARGET := retroarch
|
||||
|
||||
# Libretro Defines ####################
|
||||
#HAVE_CLASSIC = Classic Hook, disable some features
|
||||
#HAVE_C_A7A7 = Classic Armv7 Cortex A7 optimisation override
|
||||
#HAVE_HAKCHI = Hakchi Hook, change default configurations etc (TODO)
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
retroarch:
|
||||
#Build the RetroArch Binary for cross platform classics (ARMv7 Cortex A7)
|
||||
patchelf --version #Check if you have patchelf installed... (sudo apt-get install patchelf)
|
||||
CFLAGS="-marm -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard" ./configure --host=arm-linux-gnueabihf --disable-wayland --disable-x11 --disable-opengl --disable-opengl1 --disable-opengl_core --enable-mali_fbdev --disable-freetype --enable-opengles --enable-udev --enable-alsa --enable-neon --enable-floathard --disable-discord
|
||||
make HAVE_CLASSIC=1 HAVE_C_A7A7=1 HAVE_HAKCHI=1 -j #Cook it
|
||||
arm-linux-gnueabihf-strip -v retroarch
|
||||
patchelf --replace-needed libSDL2-2.0.so.0 libSDL2.so retroarch #libSDL2-2.0.so.0 sym link doesn't exist on native build. Just patch the binary...
|
||||
@echo "*********************************************************************"
|
||||
@echo "*** NES/SNES Classic RetroArch binary built successfully! ***"
|
||||
@echo "*********************************************************************"
|
||||
clean:
|
||||
rm -rf obj-unix
|
||||
rm -f *.d
|
||||
rm -f *.o
|
||||
rm -f audio/*.o
|
||||
rm -f conf/*.o
|
||||
rm -f gfx/*.o
|
||||
rm -f gfx/drivers_font/*.o
|
||||
rm -f gfx/drivers_font_renderer/*.o
|
||||
rm -f gfx/drivers_context/*.o
|
||||
rm -f gfx/py_state/*.o
|
||||
rm -f compat/*.o
|
||||
rm -f record/*.o
|
||||
rm -f input/*.o
|
||||
rm -f tools/*.o
|
||||
rm -f $(BINDIR)/retroarch
|
||||
rm -f $(BINDIR)/retroarch-joyconfig
|
||||
rm -f $(PNDDIR)/readme.html
|
||||
rm -f retroarch
|
||||
|
||||
+507
-1618
File diff suppressed because it is too large.
Load diff
+253
-122
@@ -5,96 +5,240 @@ DEBUG = 0
|
||||
GRIFFIN_BUILD = 1
|
||||
WHOLE_ARCHIVE_LINK = 0
|
||||
BUILD_3DSX = 1
|
||||
BUILD_3DS = 0
|
||||
BUILD_3DS = 1
|
||||
BUILD_CIA = 1
|
||||
LIBCTRU_NO_DEPRECATION = 1
|
||||
|
||||
APP_TITLE = RetroArch 3DS
|
||||
APP_DESCRIPTION = RetroArch 3DS
|
||||
APP_TITLE = Retroarch 3DS
|
||||
APP_DESCRIPTION = Retroarch 3DS
|
||||
APP_AUTHOR = Team Libretro
|
||||
APP_PRODUCT_CODE = RETROARCH-3DS
|
||||
APP_UNIQUE_ID = 0xBAC00
|
||||
APP_ICON = pkg/ctr/assets/default.png
|
||||
APP_BANNER = pkg/ctr/assets/libretro_banner.png
|
||||
APP_AUDIO = pkg/ctr/assets/silent.wav
|
||||
APP_RSF = pkg/ctr/tools/template.rsf
|
||||
APP_ICON = ctr/assets/default.png
|
||||
APP_BANNER = ctr/assets/libretro_banner.png
|
||||
APP_AUDIO = ctr/assets/silent.wav
|
||||
APP_RSF = ctr/tools/template.rsf
|
||||
APP_SYSTEM_MODE = 64MB
|
||||
APP_SYSTEM_MODE_EXT = 124MB
|
||||
APP_BIG_TEXT_SECTION = 0
|
||||
APP_USE_SVCHAX = 0
|
||||
|
||||
include pkg/ctr/Makefile.cores
|
||||
include ctr/Makefile.cores
|
||||
|
||||
OBJ :=
|
||||
OBJ += gfx/drivers/ctr_shaders/ctr_sprite.o
|
||||
OBJ += ctr/ctr_system.o
|
||||
OBJ += ctr/ctr_memory.o
|
||||
OBJ += ctr/ctr_linear.o
|
||||
OBJ += ctr/gpu_old.o
|
||||
OBJ += ctr/exec-3dsx/exec_cia.o \
|
||||
ctr/exec-3dsx/exec_3dsx.o \
|
||||
ctr/exec-3dsx/mini-hb-menu/launch.o \
|
||||
ctr/exec-3dsx/mini-hb-menu/loaders/rosalina.o \
|
||||
ctr/exec-3dsx/mini-hb-menu/loaders/hax2.o \
|
||||
ctr/exec-3dsx/mini-hb-menu/loaders/ninjhax1.o
|
||||
OBJS :=
|
||||
OBJS += gfx/drivers/ctr_sprite.o
|
||||
OBJS += ctr/ctr_system.o
|
||||
OBJS += ctr/ctr_memory.o
|
||||
OBJS += ctr/ctr_linear.o
|
||||
OBJS += ctr/ctr_svchax.o
|
||||
|
||||
ifeq ($(APP_BIG_TEXT_SECTION), 1)
|
||||
APP_USE_SVCHAX = 1
|
||||
LDFLAGS += -Wl,--defsym,__ctr_patch_services=__service_ptr
|
||||
endif
|
||||
|
||||
ifeq ($(APP_USE_SVCHAX), 1)
|
||||
OBJ += ctr/ctr_svchax.o
|
||||
endif
|
||||
|
||||
DEFINES :=
|
||||
ifeq ($(GRIFFIN_BUILD), 1)
|
||||
OBJ += griffin/griffin.o
|
||||
DEFINES += -DHAVE_GRIFFIN=1 -DHAVE_MENU -DHAVE_CONFIGFILE -DHAVE_RGUI -DHAVE_XMB -DHAVE_MATERIALUI -DHAVE_LIBRETRODB -DHAVE_CC_RESAMPLER
|
||||
DEFINES += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA
|
||||
#DEFINES += -DHAVE_NETWORKING -DHAVE_CHEEVOS -DRC_DISABLE_LUA -DHAVE_SOCKET_LEGACY -DHAVE_THREADS
|
||||
#-DHAVE_SSL -DHAVE_BUILTINMBEDTLS -DMBEDTLS_SSL_DEBUG_ALL
|
||||
#ssl is currently incompatible with griffin due to use of the "static" flag on repeating functions that will conflict when included in one file
|
||||
OBJS += griffin/griffin.o
|
||||
else
|
||||
HAVE_CC_RESAMPLER = 1
|
||||
HAVE_MENU_COMMON = 1
|
||||
HAVE_RTGA = 1
|
||||
HAVE_RPNG = 1
|
||||
HAVE_RJPEG = 1
|
||||
HAVE_RBMP = 1
|
||||
HAVE_MENU = 1
|
||||
HAVE_RGUI = 1
|
||||
HAVE_ZLIB = 1
|
||||
HAVE_7ZIP = 1
|
||||
HAVE_BUILTINZLIB = 1
|
||||
HAVE_LIBRETRODB = 1
|
||||
HAVE_MATERIALUI = 1
|
||||
HAVE_XMB = 1
|
||||
HAVE_STATIC_VIDEO_FILTERS = 1
|
||||
HAVE_STATIC_AUDIO_FILTERS = 1
|
||||
#HAVE_NETWORKING = 1
|
||||
#HAVE_CHEEVOS = 1
|
||||
#HAVE_SOCKET_LEGACY = 1
|
||||
#HAVE_THREADS = 1
|
||||
#HAVE_SSL = 1
|
||||
#HAVE_BUILTINMBEDTLS = 1
|
||||
|
||||
include Makefile.common
|
||||
CFLAGS += $(DEF_FLAGS)
|
||||
BLACKLIST :=
|
||||
BLACKLIST += input/input_overlay.o
|
||||
BLACKLIST += tasks/task_overlay.o
|
||||
OBJ := $(filter-out $(BLACKLIST),$(OBJ))
|
||||
OBJS += libretro-common/file/file_extract.o
|
||||
OBJS += verbosity.o
|
||||
OBJS += performance.o
|
||||
OBJS += libretro-common/compat/compat_getopt.o
|
||||
OBJS += libretro-common/compat/compat_strcasestr.o
|
||||
OBJS += libretro-common/compat/compat_strl.o
|
||||
OBJS += libretro-common/compat/compat_fnmatch.o
|
||||
OBJS += libretro-common/memmap/memalign.o
|
||||
OBJS += libretro-common/file/config_file.o
|
||||
OBJS += libretro-common/file/config_file_userdata.o
|
||||
OBJS += core_options.o
|
||||
OBJS += cheats.o
|
||||
OBJS += libretro-common/hash/rhash.o
|
||||
OBJS += gfx/video_context_driver.o
|
||||
OBJS += gfx/drivers_context/gfx_null_ctx.o
|
||||
OBJS += gfx/image/image.o
|
||||
OBJS += libretro-common/formats/tga/rtga.o
|
||||
OBJS += libretro-common/formats/png/rpng.o
|
||||
OBJS += libretro-common/formats/png/rpng_encode.o
|
||||
OBJS += libretro-common/formats/bmp/rbmp_encode.o
|
||||
OBJS += libretro-common/gfx/math/matrix_4x4.o
|
||||
OBJS += libretro-common/gfx/math/matrix_3x3.o
|
||||
OBJS += gfx/drivers/ctr_gfx.o
|
||||
OBJS += gfx/drivers/nullgfx.o
|
||||
OBJS += gfx/font_driver.o
|
||||
OBJS += gfx/drivers_font_renderer/bitmapfont.o
|
||||
OBJS += input/input_autodetect.o
|
||||
OBJS += input/input_joypad_driver.o
|
||||
OBJS += input/input_hid_driver.o
|
||||
OBJS += input/input_config.o
|
||||
OBJS += input/input_keymaps.o
|
||||
OBJS += input/input_remapping.o
|
||||
OBJS += input/input_keyboard.o
|
||||
OBJS += input/drivers/ctr_input.o
|
||||
OBJS += input/drivers_joypad/ctr_joypad.o
|
||||
OBJS += input/autoconf/builtin_ctr.o
|
||||
OBJS += input/drivers/nullinput.o
|
||||
OBJS += input/drivers_joypad/null_joypad.o
|
||||
OBJS += input/drivers_joypad/hid_joypad.o
|
||||
OBJS += input/drivers_hid/null_hid.o
|
||||
OBJS += gfx/video_state_tracker.o
|
||||
OBJS += libretro-common/queues/fifo_buffer.o
|
||||
OBJS += audio/audio_resampler_driver.o
|
||||
OBJS += audio/drivers_resampler/sinc.o
|
||||
OBJS += audio/drivers_resampler/nearest.o
|
||||
OBJS += audio/drivers_resampler/cc_resampler.o
|
||||
OBJS += camera/drivers/nullcamera.o
|
||||
OBJS += location/drivers/nulllocation.o
|
||||
OBJS += audio/drivers/ctr_csnd_audio.o
|
||||
OBJS += audio/drivers/ctr_dsp_audio.o
|
||||
OBJS += audio/drivers/nullaudio.o
|
||||
OBJS += gfx/video_driver.o
|
||||
OBJS += gfx/video_common.o
|
||||
OBJS += input/input_driver.o
|
||||
OBJS += audio/audio_driver.o
|
||||
OBJS += camera/camera_driver.o
|
||||
OBJS += location/location_driver.o
|
||||
OBJS += driver.o
|
||||
OBJS += libretro-common/gfx/scaler/scaler_filter.o
|
||||
OBJS += libretro-common/gfx/scaler/pixconv.o
|
||||
OBJS += libretro-common/gfx/scaler/scaler.o
|
||||
OBJS += libretro-common/gfx/scaler/scaler_int.o
|
||||
OBJS += gfx/video_filters/2xsai.o
|
||||
OBJS += gfx/video_filters/super2xsai.o
|
||||
OBJS += gfx/video_filters/supereagle.o
|
||||
OBJS += gfx/video_filters/2xbr.o
|
||||
OBJS += gfx/video_filters/darken.o
|
||||
OBJS += gfx/video_filters/epx.o
|
||||
OBJS += gfx/video_filters/scale2x.o
|
||||
OBJS += gfx/video_filters/blargg_ntsc_snes.o
|
||||
OBJS += gfx/video_filters/lq2x.o
|
||||
OBJS += gfx/video_filters/phosphor2x.o
|
||||
OBJS += audio/audio_filters/echo.o
|
||||
OBJS += audio/audio_filters/eq.o
|
||||
OBJS += audio/audio_filters/chorus.o
|
||||
OBJS += audio/audio_filters/iir.o
|
||||
OBJS += audio/audio_filters/panning.o
|
||||
OBJS += audio/audio_filters/phaser.o
|
||||
OBJS += audio/audio_filters/reverb.o
|
||||
OBJS += audio/audio_filters/wahwah.o
|
||||
OBJS += libretro-common/dynamic/dylib.o
|
||||
OBJS += dynamic.o
|
||||
OBJS += gfx/video_filter.o
|
||||
OBJS += audio/audio_dsp_filter.o
|
||||
OBJS += cores/dynamic_dummy.o
|
||||
OBJS += content.o
|
||||
OBJS += libretro-common/file/file_path.o
|
||||
OBJS += file_path_special.o
|
||||
OBJS += libretro-common/file/dir_list.o
|
||||
OBJS += libretro-common/file/retro_dirent.o
|
||||
OBJS += libretro-common/file/retro_file.o
|
||||
OBJS += libretro-common/file/retro_stat.o
|
||||
OBJS += dir_list_special.o
|
||||
OBJS += string_list_special.o
|
||||
OBJS += libretro-common/string/string_list.o
|
||||
OBJS += libretro-common/string/stdstring.o
|
||||
OBJS += file_ops.o
|
||||
OBJS += libretro-common/file/nbio/nbio_stdio.o
|
||||
OBJS += libretro-common/file/file_list.o
|
||||
OBJS += libretro-common/queues/message_queue.o
|
||||
OBJS += patch.o
|
||||
OBJS += configuration.o
|
||||
OBJS += rewind.o
|
||||
OBJS += frontend/frontend_driver.o
|
||||
OBJS += frontend/drivers/platform_ctr.o
|
||||
OBJS += frontend/drivers/platform_null.o
|
||||
OBJS += core_info.o
|
||||
OBJS += ui/ui_companion_driver.o
|
||||
OBJS += ui/drivers/ui_null.o
|
||||
OBJS += frontend/frontend.o
|
||||
OBJS += libretro_version_1.o
|
||||
OBJS += retroarch.o
|
||||
OBJS += runloop.o
|
||||
OBJS += tasks/tasks.o
|
||||
OBJS += msg_hash.o
|
||||
OBJS += intl/msg_hash_de.o
|
||||
OBJS += intl/msg_hash_es.o
|
||||
OBJS += intl/msg_hash_eo.o
|
||||
OBJS += intl/msg_hash_fr.o
|
||||
OBJS += intl/msg_hash_it.o
|
||||
OBJS += intl/msg_hash_nl.o
|
||||
OBJS += intl/msg_hash_pt.o
|
||||
OBJS += intl/msg_hash_pl.o
|
||||
OBJS += intl/msg_hash_us.o
|
||||
OBJS += movie.o
|
||||
OBJS += record/record_driver.o
|
||||
OBJS += record/drivers/record_null.o
|
||||
OBJS += tasks/task_decompress.o
|
||||
OBJS += tasks/task_file_transfer.o
|
||||
OBJS += screenshot.o
|
||||
OBJS += playlist.o
|
||||
OBJS += menu/menu_driver.o
|
||||
OBJS += menu/menu_hash.o
|
||||
OBJS += menu/menu_input.o
|
||||
OBJS += menu/menu_entry.o
|
||||
OBJS += menu/menu_entries.o
|
||||
OBJS += menu/menu_setting.o
|
||||
OBJS += menu/menu_cbs.o
|
||||
OBJS += menu/cbs/menu_cbs_ok.o
|
||||
OBJS += menu/cbs/menu_cbs_cancel.o
|
||||
OBJS += menu/cbs/menu_cbs_select.o
|
||||
OBJS += menu/cbs/menu_cbs_start.o
|
||||
OBJS += menu/cbs/menu_cbs_info.o
|
||||
OBJS += menu/cbs/menu_cbs_refresh.o
|
||||
OBJS += menu/cbs/menu_cbs_left.o
|
||||
OBJS += menu/cbs/menu_cbs_right.o
|
||||
OBJS += menu/cbs/menu_cbs_title.o
|
||||
OBJS += menu/cbs/menu_cbs_deferred_push.o
|
||||
OBJS += menu/cbs/menu_cbs_scan.o
|
||||
OBJS += menu/cbs/menu_cbs_get_value.o
|
||||
OBJS += menu/cbs/menu_cbs_up.o
|
||||
OBJS += menu/cbs/menu_cbs_down.o
|
||||
OBJS += menu/cbs/menu_cbs_contentlist_switch.o
|
||||
OBJS += menu/menu_shader.o
|
||||
OBJS += menu/menu_navigation.o
|
||||
OBJS += menu/menu_display.o
|
||||
OBJS += menu/menu_displaylist.o
|
||||
OBJS += menu/menu_animation.o
|
||||
OBJS += menu/intl/menu_hash_de.o
|
||||
OBJS += menu/intl/menu_hash_es.o
|
||||
OBJS += menu/intl/menu_hash_eo.o
|
||||
OBJS += menu/intl/menu_hash_fr.o
|
||||
OBJS += menu/intl/menu_hash_it.o
|
||||
OBJS += menu/intl/menu_hash_nl.o
|
||||
OBJS += menu/intl/menu_hash_pl.o
|
||||
OBJS += menu/intl/menu_hash_pt.o
|
||||
OBJS += menu/intl/menu_hash_us.o
|
||||
OBJS += menu/drivers/null.o
|
||||
OBJS += menu/drivers/menu_generic.o
|
||||
OBJS += menu/drivers_display/menu_display_null.o
|
||||
OBJS += menu/drivers/rgui.o
|
||||
OBJS += command_event.o
|
||||
OBJS += deps/zlib/adler32.o
|
||||
OBJS += deps/zlib/compress.o
|
||||
OBJS += deps/zlib/crc32.o
|
||||
OBJS += deps/zlib/deflate.o
|
||||
OBJS += deps/zlib/gzclose.o
|
||||
OBJS += deps/zlib/gzlib.o
|
||||
OBJS += deps/zlib/gzread.o
|
||||
OBJS += deps/zlib/gzwrite.o
|
||||
OBJS += deps/zlib/inffast.o
|
||||
OBJS += deps/zlib/inflate.o
|
||||
OBJS += deps/zlib/inftrees.o
|
||||
OBJS += deps/zlib/trees.o
|
||||
OBJS += deps/zlib/uncompr.o
|
||||
OBJS += deps/zlib/zutil.o
|
||||
OBJS += deps/zlib/ioapi.o
|
||||
OBJS += deps/zlib/unzip.o
|
||||
OBJS += audio/audio_utils.o
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(DEVKITPRO)),)
|
||||
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitpro")
|
||||
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(CTRULIB)),)
|
||||
CTRULIB = $(DEVKITPRO)/libctru
|
||||
$(error "Please set CTRULIB in your environment. export CTRULIB=<path to>ctrulib")
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(AEMSTRO)),)
|
||||
$(error "Please set AEMSTRO in your environment. export AEMSTRO=<path to>aemstro")
|
||||
endif
|
||||
|
||||
|
||||
APP_TITLE := $(shell echo "$(APP_TITLE)" | cut -c1-128)
|
||||
APP_DESCRIPTION := $(shell echo "$(APP_DESCRIPTION)" | cut -c1-256)
|
||||
APP_AUTHOR := $(shell echo "$(APP_AUTHOR)" | cut -c1-128)
|
||||
@@ -106,6 +250,7 @@ MAKEROM_ARGS_COMMON = -rsf $(APP_RSF) -exefslogo -elf $(TARGET).elf -icon $(TARG
|
||||
INCDIRS := -I$(CTRULIB)/include
|
||||
LIBDIRS := -L. -L$(CTRULIB)/lib
|
||||
|
||||
|
||||
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -marm -mfpu=vfp -mtp=soft
|
||||
|
||||
CFLAGS += -mword-relocations \
|
||||
@@ -131,41 +276,33 @@ ifeq ($(WHOLE_ARCHIVE_LINK), 1)
|
||||
WHOLE_END := -Wl,--no-whole-archive
|
||||
endif
|
||||
|
||||
CFLAGS += -I. \
|
||||
-Ideps \
|
||||
-Ideps/7zip \
|
||||
-Ideps/stb \
|
||||
-Ilibretro-common/include \
|
||||
-Ilibretro-common/include/compat/zlib
|
||||
CFLAGS += -I. -Ideps/zlib -Ideps/7zip -Ilibretro-common/include
|
||||
|
||||
CFLAGS += -DRARCH_INTERNAL -DRARCH_CONSOLE
|
||||
CFLAGS += -DHAVE_FILTERS_BUILTIN $(DEFINES)
|
||||
CFLAGS += -DRARCH_INTERNAL -DRARCH_CONSOLE -DSINC_LOWEST_QUALITY
|
||||
CFLAGS += -DHAVE_GRIFFIN=1 -DHAVE_FILTERS_BUILTIN -DHAVE_MENU -DHAVE_RGUI
|
||||
CFLAGS += -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -DHAVE_BUILTIN_AUTOCONFIG
|
||||
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
|
||||
|
||||
ASFLAGS := -g $(ARCH) -O3
|
||||
LDFLAGS += -specs=ctr/3dsx_custom.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
LDFLAGS = -specs=ctr/3dsx_custom.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
CFLAGS += -std=gnu99 -ffast-math
|
||||
|
||||
LIBS := $(WHOLE_START) -lretro_ctr $(WHOLE_END) -lm
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
LIBS += -lctrud
|
||||
else
|
||||
LIBS += -lctru
|
||||
endif
|
||||
LIBS := $(WHOLE_START) -lretro_ctr $(WHOLE_END) -lctru -lm
|
||||
|
||||
|
||||
ifeq ($(BUILD_3DSX), 1)
|
||||
TARGET_3DSX := $(TARGET).3dsx $(TARGET).smdh
|
||||
TARGET_3DSX := $(TARGET).3dsx $(TARGET).smdh
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_3DS), 1)
|
||||
TARGET_3DS := $(TARGET).3ds
|
||||
TARGET_3DS := $(TARGET).3ds
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_CIA), 1)
|
||||
TARGET_CIA := $(TARGET).cia
|
||||
TARGET_CIA := $(TARGET).cia
|
||||
endif
|
||||
|
||||
.PHONY: $(BUILD) clean all
|
||||
@@ -174,7 +311,12 @@ all: $(TARGET)
|
||||
|
||||
$(TARGET): $(TARGET_3DSX) $(TARGET_3DS) $(TARGET_CIA)
|
||||
$(TARGET).3dsx: $(TARGET).elf
|
||||
$(TARGET).elf: $(OBJ) libretro_ctr.a
|
||||
$(TARGET).elf: $(OBJS) libretro_ctr.a
|
||||
|
||||
ctr_sprite_shader_shbin.h: gfx/drivers/ctr_sprite.o
|
||||
gfx/drivers/ctr_gfx.c: ctr_sprite_shader_shbin.h
|
||||
griffin/griffin.o: gfx/drivers/ctr_gfx.c
|
||||
|
||||
|
||||
PREFIX := $(DEVKITARM)/bin/arm-none-eabi-
|
||||
|
||||
@@ -187,39 +329,25 @@ STRIP := $(PREFIX)strip
|
||||
NM := $(PREFIX)nm
|
||||
LD := $(CXX)
|
||||
|
||||
ifeq ($(strip $(CTRBANNERTOOL)),)
|
||||
ifneq ($(findstring Linux,$(shell uname)),)
|
||||
BANNERTOOL = pkg/ctr/tools/bannertool-linux
|
||||
else ifneq ($(findstring Darwin,$(shell uname)),)
|
||||
BANNERTOOL = pkg/ctr/tools/bannertool-mac
|
||||
else
|
||||
BANNERTOOL = pkg/ctr/tools/bannertool.exe
|
||||
endif
|
||||
ifneq ($(findstring Linux,$(shell uname -a)),)
|
||||
MAKEROM = ctr/tools/makerom-linux
|
||||
BANNERTOOL = ctr/tools/bannertool-linux
|
||||
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
||||
MAKEROM = ctr/tools/makerom-mac
|
||||
BANNERTOOL = ctr/tools/bannertool-mac
|
||||
else
|
||||
BANNERTOOL = $(CTRBANNERTOOL)
|
||||
MAKEROM = ctr/tools/makerom.exe
|
||||
BANNERTOOL = ctr/tools/bannertool.exe
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(CTRMAKEROM)),)
|
||||
ifneq ($(findstring Linux,$(shell uname)),)
|
||||
MAKEROM = pkg/ctr/tools/makerom-linux
|
||||
else ifneq ($(findstring Darwin,$(shell uname)),)
|
||||
MAKEROM = pkg/ctr/tools/makerom-mac
|
||||
else
|
||||
MAKEROM = pkg/ctr/tools/makerom.exe
|
||||
endif
|
||||
else
|
||||
MAKEROM = $(CTRMAKEROM)
|
||||
endif
|
||||
%.o: %.shader
|
||||
python $(AEMSTRO)/aemstro_as.py $< $(notdir $<).shbin
|
||||
$(DEVKITARM)/bin/bin2s $(notdir $<).shbin | $(PREFIX)as -o $@
|
||||
echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(notdir $<).shbin | tr . _)`.h
|
||||
echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(notdir $<).shbin | tr . _)`.h
|
||||
echo "extern const u32" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(notdir $<).shbin | tr . _)`.h
|
||||
rm $(notdir $<).shbin
|
||||
|
||||
%.o: %.vsh %.gsh
|
||||
$(DEVKITARM)/bin/picasso $^ -o $*.shbin
|
||||
$(DEVKITARM)/bin/bin2s $*.shbin | $(PREFIX)as -o $@
|
||||
rm $*.shbin
|
||||
|
||||
%.o: %.vsh
|
||||
$(DEVKITARM)/bin/picasso $^ -o $*.shbin
|
||||
$(DEVKITARM)/bin/bin2s $*.shbin | $(PREFIX)as -o $@
|
||||
rm $*.shbin
|
||||
|
||||
%.o: %.cpp
|
||||
$(CXX) -c -o $@ $< $(CXXFLAGS) $(INCDIRS)
|
||||
@@ -239,18 +367,18 @@ endif
|
||||
%.vsh:
|
||||
|
||||
$(TARGET).smdh: $(APP_ICON)
|
||||
$(DEVKITARM)/bin/smdhtool --create "$(APP_TITLE)" "$(APP_DESCRIPTION)" "$(APP_AUTHOR)" $(APP_ICON) $@
|
||||
smdhtool --create "$(APP_TITLE)" "$(APP_DESCRIPTION)" "$(APP_AUTHOR)" $(APP_ICON) $@
|
||||
|
||||
$(TARGET).3dsx: $(TARGET).elf
|
||||
ifeq ($(APP_BIG_TEXT_SECTION), 1)
|
||||
cp pkg/ctr/big_text_section.xml $(TARGET).xml
|
||||
cp ctr/big_text_section.xml $(TARGET).xml
|
||||
else
|
||||
rm -f $(TARGET).xml
|
||||
endif
|
||||
$(DEVKITARM)/bin/3dsxtool $< $@ $(_3DSXFLAGS)
|
||||
-3dsxtool $< $@ $(_3DSXFLAGS)
|
||||
|
||||
$(TARGET).elf: ctr/3dsx_custom_crt0.o
|
||||
$(LD) $(LDFLAGS) $(OBJ) $(LIBDIRS) $(LIBS) -o $@
|
||||
$(LD) $(LDFLAGS) $(OBJS) $(LIBDIRS) $(LIBS) -o $@
|
||||
$(NM) -CSn $@ > $(notdir $*.lst)
|
||||
|
||||
$(TARGET).bnr: $(APP_BANNER) $(APP_AUDIO)
|
||||
@@ -265,8 +393,9 @@ $(TARGET).3ds: $(TARGET).elf $(TARGET).bnr $(TARGET).icn $(APP_RSF)
|
||||
$(TARGET).cia: $(TARGET).elf $(TARGET).bnr $(TARGET).icn $(APP_RSF)
|
||||
$(MAKEROM) -f cia -o $@ $(MAKEROM_ARGS_COMMON) -DAPP_ENCRYPTED=false
|
||||
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ)
|
||||
rm -f $(OBJS)
|
||||
rm -f $(TARGET).3dsx
|
||||
rm -f $(TARGET).elf
|
||||
rm -f $(TARGET).3ds
|
||||
@@ -274,7 +403,9 @@ clean:
|
||||
rm -f $(TARGET).smdh
|
||||
rm -f $(TARGET).bnr
|
||||
rm -f $(TARGET).icn
|
||||
rm -f *_shader_shbin.h
|
||||
rm -f ctr/ctr_config_*.o
|
||||
rm -f ctr/3dsx_custom_crt0.o
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
@@ -1,221 +0,0 @@
|
||||
TARGET := retroarch_3ds_salamander
|
||||
LIBRETRO =
|
||||
|
||||
DEBUG = 0
|
||||
BUILD_3DSX = 1
|
||||
BUILD_3DS = 0
|
||||
BUILD_CIA = 1
|
||||
|
||||
APP_TITLE = RetroArch 3DS
|
||||
APP_DESCRIPTION = RetroArch 3DS
|
||||
APP_AUTHOR = Team Libretro
|
||||
APP_PRODUCT_CODE = RETROARCH-3DS
|
||||
APP_UNIQUE_ID = 0xBAC00
|
||||
APP_ICON = pkg/ctr/assets/default.png
|
||||
APP_BANNER = pkg/ctr/assets/libretro_banner.png
|
||||
APP_AUDIO = pkg/ctr/assets/silent.wav
|
||||
APP_RSF = pkg/ctr/tools/template.rsf
|
||||
APP_SYSTEM_MODE = 64MB
|
||||
APP_SYSTEM_MODE_EXT = 124MB
|
||||
|
||||
OBJ := ctr/ctr_system.o \
|
||||
ctr/ctr_memory.o \
|
||||
ctr/ctr_linear.o \
|
||||
frontend/frontend_salamander.o \
|
||||
frontend/frontend_driver.o \
|
||||
frontend/drivers/platform_ctr.o \
|
||||
libretro-common/encodings/encoding_utf.o \
|
||||
libretro-common/compat/compat_strcasestr.o \
|
||||
libretro-common/compat/fopen_utf8.o \
|
||||
libretro-common/file/file_path.o \
|
||||
libretro-common/file/file_path_io.o \
|
||||
libretro-common/string/stdstring.o \
|
||||
libretro-common/lists/string_list.o \
|
||||
libretro-common/lists/dir_list.o \
|
||||
libretro-common/file/retro_dirent.o \
|
||||
libretro-common/compat/compat_strl.o \
|
||||
libretro-common/file/config_file.o \
|
||||
libretro-common/streams/file_stream.o \
|
||||
libretro-common/vfs/vfs_implementation.o \
|
||||
libretro-common/hash/rhash.o \
|
||||
file_path_str.o \
|
||||
verbosity.o
|
||||
|
||||
OBJ += ctr/exec-3dsx/exec_cia.o \
|
||||
ctr/exec-3dsx/exec_3dsx.o \
|
||||
ctr/exec-3dsx/mini-hb-menu/launch.o \
|
||||
ctr/exec-3dsx/mini-hb-menu/loaders/rosalina.o \
|
||||
ctr/exec-3dsx/mini-hb-menu/loaders/hax2.o \
|
||||
ctr/exec-3dsx/mini-hb-menu/loaders/ninjhax1.o
|
||||
|
||||
ifeq ($(strip $(DEVKITPRO)),)
|
||||
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitpro")
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(CTRULIB)),)
|
||||
CTRULIB = $(DEVKITPRO)/libctru
|
||||
endif
|
||||
|
||||
APP_TITLE := $(shell echo "$(APP_TITLE)" | cut -c1-128)
|
||||
APP_DESCRIPTION := $(shell echo "$(APP_DESCRIPTION)" | cut -c1-256)
|
||||
APP_AUTHOR := $(shell echo "$(APP_AUTHOR)" | cut -c1-128)
|
||||
APP_PRODUCT_CODE := $(shell echo $(APP_PRODUCT_CODE) | cut -c1-16)
|
||||
APP_UNIQUE_ID := $(shell echo $(APP_UNIQUE_ID) | cut -c1-7)
|
||||
|
||||
MAKEROM_ARGS_COMMON = -rsf $(APP_RSF) -exefslogo -elf $(TARGET).elf -icon $(TARGET).icn -banner $(TARGET).bnr -DAPP_TITLE="$(APP_TITLE)" -DAPP_PRODUCT_CODE="$(APP_PRODUCT_CODE)" -DAPP_UNIQUE_ID=$(APP_UNIQUE_ID) -DAPP_SYSTEM_MODE=$(APP_SYSTEM_MODE) -DAPP_SYSTEM_MODE_EXT=$(APP_SYSTEM_MODE_EXT)
|
||||
|
||||
INCDIRS := -I$(CTRULIB)/include
|
||||
LIBDIRS := -L. -L$(CTRULIB)/lib
|
||||
|
||||
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -marm -mfpu=vfp -mtp=soft
|
||||
|
||||
CFLAGS += -mword-relocations \
|
||||
-fomit-frame-pointer -ffast-math \
|
||||
-Werror=implicit-function-declaration \
|
||||
$(ARCH)
|
||||
|
||||
#CFLAGS += -Wall
|
||||
CFLAGS += -DARM11 -D_3DS
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -O0 -g
|
||||
else
|
||||
CFLAGS += -O3
|
||||
endif
|
||||
|
||||
CFLAGS += -I. -Ideps/7zip -Ideps/stb -Ilibretro-common/include -Ilibretro-common/include/compat/zlib
|
||||
|
||||
#CFLAGS += -DRARCH_INTERNAL
|
||||
CFLAGS += -DRARCH_CONSOLE -DIS_SALAMANDER
|
||||
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
|
||||
|
||||
ASFLAGS := -g $(ARCH) -O3
|
||||
LDFLAGS += -specs=ctr/3dsx_custom.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
CFLAGS += -std=gnu99 -ffast-math
|
||||
|
||||
LIBS := -lctru -lm
|
||||
|
||||
ifeq ($(BUILD_3DSX), 1)
|
||||
TARGET_3DSX := $(TARGET).3dsx $(TARGET).smdh
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_3DS), 1)
|
||||
TARGET_3DS := $(TARGET).3ds
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_CIA), 1)
|
||||
TARGET_CIA := $(TARGET).cia
|
||||
endif
|
||||
|
||||
.PHONY: $(BUILD) clean all
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(TARGET_3DSX) $(TARGET_3DS) $(TARGET_CIA)
|
||||
$(TARGET).3dsx: $(TARGET).elf
|
||||
$(TARGET).elf: $(OBJ)
|
||||
|
||||
PREFIX := $(DEVKITARM)/bin/arm-none-eabi-
|
||||
|
||||
CC := $(PREFIX)gcc
|
||||
CXX := $(PREFIX)g++
|
||||
AS := $(PREFIX)as
|
||||
AR := $(PREFIX)ar
|
||||
OBJCOPY := $(PREFIX)objcopy
|
||||
STRIP := $(PREFIX)strip
|
||||
NM := $(PREFIX)nm
|
||||
LD := $(CXX)
|
||||
|
||||
ifeq ($(strip $(CTRBANNERTOOL)),)
|
||||
ifneq ($(findstring Linux,$(shell uname)),)
|
||||
BANNERTOOL = pkg/ctr/tools/bannertool-linux
|
||||
else ifneq ($(findstring Darwin,$(shell uname)),)
|
||||
BANNERTOOL = pkg/ctr/tools/bannertool-mac
|
||||
else
|
||||
BANNERTOOL = pkg/ctr/tools/bannertool.exe
|
||||
endif
|
||||
else
|
||||
BANNERTOOL = $(CTRBANNERTOOL)
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(CTRMAKEROM)),)
|
||||
ifneq ($(findstring Linux,$(shell uname)),)
|
||||
MAKEROM = pkg/ctr/tools/makerom-linux
|
||||
else ifneq ($(findstring Darwin,$(shell uname)),)
|
||||
MAKEROM = pkg/ctr/tools/makerom-mac
|
||||
else
|
||||
MAKEROM = pkg/ctr/tools/makerom.exe
|
||||
endif
|
||||
else
|
||||
MAKEROM = $(CTRMAKEROM)
|
||||
endif
|
||||
|
||||
%.o: %.vsh %.gsh
|
||||
$(DEVKITARM)/bin/picasso $^ -o $*.shbin
|
||||
$(DEVKITARM)/bin/bin2s $*.shbin | $(PREFIX)as -o $@
|
||||
rm $*.shbin
|
||||
|
||||
%.o: %.vsh
|
||||
$(DEVKITARM)/bin/picasso $^ -o $*.shbin
|
||||
$(DEVKITARM)/bin/bin2s $*.shbin | $(PREFIX)as -o $@
|
||||
rm $*.shbin
|
||||
|
||||
%.o: %.cpp
|
||||
$(CXX) -c -o $@ $< $(CXXFLAGS) $(INCDIRS)
|
||||
|
||||
%.o: %.c
|
||||
$(CC) -c -o $@ $< $(CFLAGS) $(INCDIRS)
|
||||
|
||||
%.o: %.s
|
||||
$(CC) -c -o $@ $< $(ASFLAGS)
|
||||
|
||||
%.o: %.S
|
||||
$(CC) -c -o $@ $< $(ASFLAGS)
|
||||
|
||||
%.a:
|
||||
$(AR) -rc $@ $^
|
||||
|
||||
%.vsh:
|
||||
|
||||
$(TARGET).smdh: $(APP_ICON)
|
||||
$(DEVKITARM)/bin/smdhtool --create "$(APP_TITLE)" "$(APP_DESCRIPTION)" "$(APP_AUTHOR)" $(APP_ICON) $@
|
||||
|
||||
$(TARGET).3dsx: $(TARGET).elf
|
||||
ifeq ($(APP_BIG_TEXT_SECTION), 1)
|
||||
cp pkg/ctr/big_text_section.xml $(TARGET).xml
|
||||
else
|
||||
rm -f $(TARGET).xml
|
||||
endif
|
||||
$(DEVKITARM)/bin/3dsxtool $< $@ $(_3DSXFLAGS)
|
||||
|
||||
$(TARGET).elf: ctr/3dsx_custom_crt0.o
|
||||
$(LD) $(LDFLAGS) $(OBJ) $(LIBDIRS) $(LIBS) -o $@
|
||||
$(NM) -CSn $@ > $(notdir $*.lst)
|
||||
|
||||
$(TARGET).bnr: $(APP_BANNER) $(APP_AUDIO)
|
||||
$(BANNERTOOL) makebanner -i "$(APP_BANNER)" -a "$(APP_AUDIO)" -o $@
|
||||
|
||||
$(TARGET).icn: $(APP_ICON)
|
||||
$(BANNERTOOL) makesmdh -s "$(APP_TITLE)" -l "$(APP_TITLE)" -p "$(APP_AUTHOR)" -i $(APP_ICON) -o $@
|
||||
|
||||
$(TARGET).3ds: $(TARGET).elf $(TARGET).bnr $(TARGET).icn $(APP_RSF)
|
||||
$(MAKEROM) -f cci -o $@ $(MAKEROM_ARGS_COMMON) -DAPP_ENCRYPTED=true
|
||||
|
||||
$(TARGET).cia: $(TARGET).elf $(TARGET).bnr $(TARGET).icn $(APP_RSF)
|
||||
$(MAKEROM) -f cia -o $@ $(MAKEROM_ARGS_COMMON) -DAPP_ENCRYPTED=false
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ)
|
||||
rm -f $(TARGET).3dsx
|
||||
rm -f $(TARGET).elf
|
||||
rm -f $(TARGET).3ds
|
||||
rm -f $(TARGET).cia
|
||||
rm -f $(TARGET).smdh
|
||||
rm -f $(TARGET).bnr
|
||||
rm -f $(TARGET).icn
|
||||
rm -f ctr/ctr_config_*.o
|
||||
rm -f ctr/3dsx_custom_crt0.o
|
||||
|
||||
.PHONY: clean
|
||||
-189
@@ -1,189 +0,0 @@
|
||||
CC = /opt/gcw0-toolchain/usr/bin/mipsel-gcw0-linux-uclibc-gcc
|
||||
CXX = /opt/gcw0-toolchain/usr/bin/mipsel-gcw0-linux-uclibc-g++
|
||||
PACKAGE_NAME = retroarch
|
||||
|
||||
DEBUG ?= 0
|
||||
|
||||
HAVE_7ZIP = 1
|
||||
HAVE_AL = 1
|
||||
# this freezes when switching back from menu
|
||||
HAVE_ALSA = 0
|
||||
HAVE_BUILTINMBEDTLS = 1
|
||||
HAVE_BUILTINZLIB = 1
|
||||
HAVE_C99 = 1
|
||||
HAVE_CC = 1
|
||||
HAVE_CC_RESAMPLER = 1
|
||||
HAVE_CHD = 1
|
||||
HAVE_CHEEVOS = 1
|
||||
HAVE_COMMAND = 1
|
||||
HAVE_CXX = 1
|
||||
HAVE_DR_MP3 = 1
|
||||
HAVE_DYNAMIC = 1
|
||||
HAVE_EGL = 1
|
||||
HAVE_FREETYPE = 1
|
||||
HAVE_GDI = 1
|
||||
HAVE_GETADDRINFO = 1
|
||||
HAVE_GETOPT_LONG = 1
|
||||
HAVE_GLSL = 1
|
||||
HAVE_HID = 1
|
||||
HAVE_IBXM = 1
|
||||
HAVE_IMAGEVIEWER = 1
|
||||
HAVE_LANGEXTRA = 1
|
||||
HAVE_LIBRETRODB = 1
|
||||
HAVE_MENU = 1
|
||||
HAVE_MENU_COMMON = 1
|
||||
HAVE_GFX_WIDGETS = 1
|
||||
HAVE_MMAP = 1
|
||||
HAVE_NETWORKING = 1
|
||||
HAVE_OPENDINGUX_FBDEV = 1
|
||||
HAVE_OPENGL = 1
|
||||
HAVE_OPENGL1 = 0
|
||||
HAVE_OPENGLES = 1
|
||||
HAVE_OPENGLES3 = 0
|
||||
HAVE_OPENGL_CORE = 0
|
||||
HAVE_OPENSSL = 1
|
||||
HAVE_OVERLAY = 1
|
||||
HAVE_RBMP = 1
|
||||
HAVE_RJPEG = 1
|
||||
HAVE_RPILED = 1
|
||||
HAVE_RPNG = 1
|
||||
HAVE_RUNAHEAD = 1
|
||||
HAVE_SDL_DINGUX = 1
|
||||
HAVE_SHADERPIPELINE = 1
|
||||
HAVE_STB_FONT = 1
|
||||
HAVE_STB_IMAGE = 1
|
||||
HAVE_STB_VORBIS = 1
|
||||
HAVE_STDIN_CMD = 1
|
||||
HAVE_STRCASESTR = 1
|
||||
HAVE_THREADS = 1
|
||||
HAVE_TRANSLATE = 1
|
||||
HAVE_UDEV = 1
|
||||
HAVE_VIDEO_LAYOUT = 1
|
||||
HAVE_XMB = 1
|
||||
HAVE_ZLIB = 1
|
||||
HAVE_CONFIGFILE = 1
|
||||
|
||||
OS = Linux
|
||||
TARGET = retroarch
|
||||
OPK_NAME = retroarch.opk
|
||||
|
||||
OBJ :=
|
||||
LINK := $(CXX)
|
||||
DEF_FLAGS := -march=mips32 -mtune=mips32r2 -mhard-float -ffast-math -fomit-frame-pointer -fdata-sections
|
||||
DEF_FLAGS += -I. -Ideps -Ideps/stb -DDINGUX=1 -MMD
|
||||
DEF_FLAGS += -Wall -Wno-unused-variable
|
||||
DEF_FLAGS += -std=gnu99 -D_GNU_SOURCE
|
||||
LIBS := -ldl -lz -lrt -lcrypto -lssl -ludev -pthread
|
||||
CFLAGS :=
|
||||
CXXFLAGS := -fno-exceptions -fno-rtti -std=c++11 -D__STDC_CONSTANT_MACROS
|
||||
ASFLAGS :=
|
||||
LDFLAGS := -flto
|
||||
INCLUDE_DIRS = -I/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/include
|
||||
LIBRARY_DIRS = -L/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/lib
|
||||
DEFINES := -DRARCH_INTERNAL -D_FILE_OFFSET_BITS=64 -UHAVE_STATIC_DUMMY
|
||||
DEFINES += -DHAVE_C99=1 -DHAVE_CXX=1 -DHAVE_OPENDINGUX_FBDEV=1
|
||||
DEFINES += -DHAVE_GETOPT_LONG=1 -DHAVE_STRCASESTR=1 -DHAVE_DYNAMIC=1
|
||||
DEFINES += -DHAVE_AL=1
|
||||
DEFINES += -DHAVE_ONLINE_UPDATER=1
|
||||
DEFINES += -DHAVE_UPDATE_ASSETS=1
|
||||
DEFINES += -DHAVE_UDEV=1
|
||||
|
||||
SDL_DINGUX_CFLAGS := $(shell /opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/bin/sdl-config --cflags)
|
||||
SDL_DINGUX_LIBS := $(shell /opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/bin/sdl-config --libs)
|
||||
FREETYPE_CFLAGS := $(shell /opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/bin/freetype-config --cflags)
|
||||
FREETYPE_LIBS := $(shell /opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/bin/freetype-config --libs)
|
||||
AL_LIBS := -lopenal
|
||||
OPENGLES_CFLAGS := -DMESA_EGL_NO_X11_HEADERS
|
||||
OPENGLES_LIBS := -lGLESv2 -lEGL
|
||||
MMAP_LIBS = -lc
|
||||
|
||||
OBJDIR_BASE := obj-unix
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
OBJDIR := $(OBJDIR_BASE)/debug
|
||||
DEF_FLAGS += -O0 -g -DDEBUG -D_DEBUG
|
||||
else
|
||||
OBJDIR := $(OBJDIR_BASE)/release
|
||||
DEF_FLAGS += -O2 -DNDEBUG
|
||||
endif
|
||||
|
||||
include Makefile.common
|
||||
|
||||
DEF_FLAGS += $(INCLUDE_DIRS)
|
||||
CFLAGS += $(DEF_FLAGS)
|
||||
CXXFLAGS += $(DEF_FLAGS)
|
||||
|
||||
HEADERS = $(wildcard */*/*.h) $(wildcard */*.h) $(wildcard *.h)
|
||||
|
||||
Q := @
|
||||
|
||||
RARCH_OBJ := $(addprefix $(OBJDIR)/,$(OBJ))
|
||||
|
||||
define DESKTOP_ENTRY
|
||||
[Desktop Entry]
|
||||
Name=retroarch
|
||||
Comment=Retroarch
|
||||
Exec=retroarch
|
||||
Terminal=false
|
||||
Type=Application
|
||||
StartupNotify=true
|
||||
Icon=retroarch
|
||||
Categories=emulators;
|
||||
X-OD-NeedsDownscaling=true
|
||||
endef
|
||||
export DESKTOP_ENTRY
|
||||
|
||||
all: $(TARGET) opk
|
||||
|
||||
-include $(RARCH_OBJ:.o=.d)
|
||||
|
||||
SYMBOL_MAP := -Wl,-Map=output.map
|
||||
|
||||
$(TARGET): $(RARCH_OBJ)
|
||||
@$(if $(Q), $(shell echo echo LD $@),)
|
||||
$(LINK) -o $@ $(RARCH_OBJ) $(LIBS) $(LDFLAGS) $(LIBRARY_DIRS)
|
||||
|
||||
$(OBJDIR)/%.o: %.c
|
||||
@mkdir -p $(dir $@)
|
||||
@$(if $(Q), $(shell echo echo CC $<),)
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c -o $@ $<
|
||||
|
||||
$(OBJDIR)/%.o: %.cpp
|
||||
@mkdir -p $(dir $@)
|
||||
@$(if $(Q), $(shell echo echo CXX $<),)
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(DEFINES) -MMD -c -o $@ $<
|
||||
|
||||
$(OBJDIR)/%.o: %.m
|
||||
@mkdir -p $(dir $@)
|
||||
@$(if $(Q), $(shell echo echo OBJC $<),)
|
||||
$(CXX) $(OBJCFLAGS) $(DEFINES) -MMD -c -o $@ $<
|
||||
|
||||
.FORCE:
|
||||
|
||||
$(OBJDIR)/git_version.o: git_version.c .FORCE
|
||||
@mkdir -p $(dir $@)
|
||||
@$(if $(Q), $(shell echo echo CC $<),)
|
||||
$(CC) $(CFLAGS) $(DEFINES) -MMD -c -o $@ $<
|
||||
|
||||
$(OBJDIR)/%.o: %.S $(HEADERS)
|
||||
@mkdir -p $(dir $@)
|
||||
@$(if $(Q), $(shell echo echo AS $<),)
|
||||
$(CC) $(CFLAGS) $(ASFLAGS) $(DEFINES) -c -o $@ $<
|
||||
|
||||
clean:
|
||||
rm -rf $(OBJDIR_BASE)
|
||||
rm -f $(TARGET)
|
||||
rm -f *.d
|
||||
rm -rf $(OPK_NAME)
|
||||
|
||||
opk: $(TARGET)
|
||||
echo "$$DESKTOP_ENTRY" > default.gcw0.desktop
|
||||
rm -f $(OPK_NAME)
|
||||
cp media/ico_src/icon32.png retroarch.png
|
||||
mksquashfs retroarch default.gcw0.desktop retroarch.png $(OPK_NAME) -all-root -no-xattrs -noappend -no-exports
|
||||
rm -f default.gcw0.desktop retroarch.png
|
||||
|
||||
.PHONY: all clean opk
|
||||
|
||||
print-%:
|
||||
@echo '$*=$($*)'
|
||||
+73
-62
@@ -1,66 +1,58 @@
|
||||
TARGET := retroarch.js
|
||||
TARGET = retroarch.js
|
||||
|
||||
EOPT = USE_ZLIB=1 # Emscripten specific options
|
||||
EOPTS = $(addprefix -s $(EMPTY), $(EOPT)) # Add '-s ' to each option
|
||||
|
||||
PTHREAD = 0
|
||||
OS = Emscripten
|
||||
OBJ :=
|
||||
DEFINES := -DRARCH_INTERNAL -DHAVE_MAIN -s USE_PTHREADS=$(PTHREAD)
|
||||
DEFINES += -DHAVE_FILTERS_BUILTIN
|
||||
DEFINES := -DRARCH_INTERNAL -DHAVE_OVERLAY -DHAVE_MAIN
|
||||
DEFINES += -DHAVE_OPENGL -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DHAVE_EGL -DHAVE_OVERLAY -DHAVE_GLSL -DHAVE_FILTERS_BUILTIN
|
||||
|
||||
HAVE_OVERLAY = 1
|
||||
HAVE_GLSL = 1
|
||||
HAVE_AUDIOMIXER = 1
|
||||
HAVE_VIDEO_LAYOUT = 0
|
||||
HAVE_CC_RESAMPLER = 1
|
||||
HAVE_EGL = 1
|
||||
HAVE_OPENGLES = 1
|
||||
HAVE_RJPEG = 0
|
||||
HAVE_RPNG = 1
|
||||
HAVE_OPENGL = 1
|
||||
HAVE_GLES = 1
|
||||
HAVE_EMSCRIPTEN = 1
|
||||
HAVE_MENU = 1
|
||||
HAVE_GFX_WIDGETS = 1
|
||||
HAVE_RGUI = 1
|
||||
HAVE_SDL = 0
|
||||
HAVE_SDL2 = 0
|
||||
HAVE_ZLIB = 1
|
||||
HAVE_SHADERPIPELINE = 1
|
||||
HAVE_STATIC_VIDEO_FILTERS = 1
|
||||
HAVE_STATIC_AUDIO_FILTERS = 1
|
||||
HAVE_STB_FONT = 1
|
||||
HAVE_CONFIGFILE = 1
|
||||
HAVE_FBO = 1
|
||||
WANT_ZLIB = 1
|
||||
MEMORY = 268435456
|
||||
LTO = 0
|
||||
# XXX: setting this to 1/2 currently crashes Firefox nightly
|
||||
PRECISE_F32 = 2
|
||||
|
||||
MEMORY = 134217728
|
||||
ifneq ($(NATIVE_ZLIB),)
|
||||
WANT_ZLIB = 0
|
||||
endif
|
||||
|
||||
PRECISE_F32 = 1
|
||||
|
||||
OBJDIR := obj-emscripten
|
||||
|
||||
#if you compile with SDL2 flag add this Emscripten flag "-s USE_SDL=2" to LDFLAGS:
|
||||
|
||||
LIBS := -s USE_ZLIB=1
|
||||
LDFLAGS := -L. --no-heap-copy -s $(LIBS) -s TOTAL_MEMORY=$(MEMORY) -s NO_EXIT_RUNTIME=0 -s FULL_ES2=1 -s "EXTRA_EXPORTED_RUNTIME_METHODS=['callMain']" \
|
||||
-s ALLOW_MEMORY_GROWTH=1 -s EXPORTED_FUNCTIONS="['_main', '_malloc', '_cmd_savefiles', '_cmd_save_state', '_cmd_load_state', '_cmd_take_screenshot']" \
|
||||
LIBS :=
|
||||
LDFLAGS := -L. --no-heap-copy -s USE_ZLIB=1 -s TOTAL_MEMORY=$(MEMORY) -s OUTLINING_LIMIT=50000 \
|
||||
-s EXPORTED_FUNCTIONS="['_main', '_malloc', '_cmd_savefiles', '_cmd_save_state', '_cmd_load_state', '_cmd_take_screenshot']" \
|
||||
--js-library emscripten/library_rwebaudio.js \
|
||||
--js-library emscripten/library_rwebcam.js \
|
||||
--js-library emscripten/library_errno_codes.js
|
||||
ifneq ($(PTHREAD), 0)
|
||||
LDFLAGS += -s USE_PTHREADS=$(PTHREAD) -s PTHREAD_POOL_SIZE=2
|
||||
endif
|
||||
|
||||
ifeq ($(ASYNC), 1)
|
||||
LDFLAGS += -s ASYNCIFY=$(ASYNC)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_SDL2), 1)
|
||||
LIBS += -s USE_SDL=2
|
||||
DEFINES += -DHAVE_SDL2
|
||||
endif
|
||||
--js-library emscripten/library_rwebinput.js \
|
||||
--js-library emscripten/library_rwebcam.js
|
||||
|
||||
include Makefile.common
|
||||
|
||||
CFLAGS += $(DEF_FLAGS) -Ideps -Ideps/stb
|
||||
OBJ += gfx/video_filters/2xsai.o
|
||||
OBJ += gfx/video_filters/super2xsai.o
|
||||
OBJ += gfx/video_filters/supereagle.o
|
||||
OBJ += gfx/video_filters/2xbr.o
|
||||
OBJ += gfx/video_filters/darken.o
|
||||
OBJ += gfx/video_filters/epx.o
|
||||
OBJ += gfx/video_filters/scale2x.o
|
||||
OBJ += gfx/video_filters/blargg_ntsc_snes.o
|
||||
OBJ += gfx/video_filters/lq2x.o
|
||||
OBJ += gfx/video_filters/phosphor2x.o
|
||||
|
||||
OBJ += audio/audio_filters/echo.o
|
||||
OBJ += audio/audio_filters/eq.o
|
||||
OBJ += audio/audio_filters/chorus.o
|
||||
OBJ += audio/audio_filters/iir.o
|
||||
OBJ += audio/audio_filters/panning.o
|
||||
OBJ += audio/audio_filters/phaser.o
|
||||
OBJ += audio/audio_filters/reverb.o
|
||||
OBJ += audio/audio_filters/wahwah.o
|
||||
|
||||
CFLAGS += -Ideps/zlib/
|
||||
libretro = libretro_emscripten.bc
|
||||
|
||||
ifneq ($(V), 1)
|
||||
@@ -71,38 +63,57 @@ ifeq ($(DEBUG), 1)
|
||||
LDFLAGS += -O0 -g
|
||||
CFLAGS += -O0 -g
|
||||
else
|
||||
LDFLAGS += -O3 -s WASM=1
|
||||
LDFLAGS += -O2
|
||||
# WARNING: some optimizations can break some cores (ex: LTO breaks tyrquake)
|
||||
LDFLAGS += -s PRECISE_F32=$(PRECISE_F32)
|
||||
ifeq ($(LTO), 1)
|
||||
LDFLAGS += --llvm-lto 3
|
||||
endif
|
||||
CFLAGS += -O3
|
||||
CFLAGS += -O2
|
||||
endif
|
||||
|
||||
CFLAGS += -Wall -I. -Ilibretro-common/include -std=gnu99 $(LIBS) \
|
||||
CFLAGS += -DWANT_RPNG -Wall -Wno-unused-result -Wno-unused-variable -I. -Ilibretro-common/include -std=gnu99 -s USE_ZLIB=1 \
|
||||
-s EXPORTED_FUNCTIONS="['_main', '_malloc', '_cmd_savefiles', '_cmd_save_state', '_cmd_take_screenshot']"
|
||||
|
||||
RARCH_OBJ := $(addprefix $(OBJDIR)/,$(OBJ))
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(RARCH_OBJ) $(libretro)
|
||||
$(TARGET): $(OBJ)
|
||||
@$(if $(Q), $(shell echo echo LD $@),)
|
||||
$(Q)$(LD) -o $@ $(RARCH_OBJ) $(libretro) $(LIBS) $(LDFLAGS)
|
||||
$(Q)$(LD) -o $@ $(OBJ) $(libretro) $(LIBS) $(LDFLAGS)
|
||||
|
||||
$(OBJDIR)/%.o: %.c
|
||||
@mkdir -p $(dir $@)
|
||||
%.o: %.c
|
||||
@$(if $(Q), $(shell echo echo CC $<),)
|
||||
$(Q)$(CC) $(CFLAGS) $(DEFINES) $(EOPTS) -c -o $@ $<
|
||||
$(Q)$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
|
||||
|
||||
$(OBJDIR)/%.o: %.cpp
|
||||
@mkdir -p $(dir $@)
|
||||
%.o: %.cpp
|
||||
@$(if $(Q), $(shell echo echo CXX $<),)
|
||||
$(Q)$(CXX) $(CXXFLAGS) $(DEFINES) $(EOPTS) -c -o $@ $<
|
||||
$(Q)$(CXX) $(CXXFLAGS) $(DEFINES) -c -o $@ $<
|
||||
|
||||
clean:
|
||||
rm -rf $(OBJDIR)
|
||||
rm -f *.o
|
||||
rm -f deps/zlib/*.o
|
||||
rm -f frontend/*.o
|
||||
rm -f menu/*.o
|
||||
rm -f menu/disp/*.o
|
||||
rm -f audio/*.o
|
||||
rm -f compat/*.o
|
||||
rm -f compat/rxml/*.o
|
||||
rm -f conf/*.o
|
||||
rm -f gfx/scaler/*.o
|
||||
rm -f gfx/*.o
|
||||
rm -f gfx/d3d/*.o
|
||||
rm -f gfx/drivers_context/*.o
|
||||
rm -f gfx/math/*.o
|
||||
rm -f gfx/drivers_font/*.o
|
||||
rm -f gfx/drivers_font_renderer/*.o
|
||||
rm -f gfx/py_state/*.o
|
||||
rm -f gfx/rpng/*.o
|
||||
rm -f gfx/glsym/*.o
|
||||
rm -f record/*.o
|
||||
rm -f input/*.o
|
||||
rm -f tools/*.o
|
||||
rm -f libretro-common/*/*.o
|
||||
rm -f $(TARGET)
|
||||
rm -f *.d
|
||||
|
||||
.PHONY: all clean
|
||||
+223
-1002
File diff suppressed because it is too large.
Load diff
-262
@@ -1,262 +0,0 @@
|
||||
include version.all
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
ifeq ($(strip $(DEVKITPRO)),)
|
||||
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/devkitpro")
|
||||
endif
|
||||
|
||||
TOPDIR ?= $(CURDIR)
|
||||
include $(DEVKITPRO)/libnx/switch_rules
|
||||
|
||||
TARGET := retroarch_switch
|
||||
|
||||
DEBUG ?= 0
|
||||
WHOLE_ARCHIVE_LINK = 0
|
||||
GRIFFIN_BUILD = 0
|
||||
|
||||
OBJ :=
|
||||
|
||||
DEFINES := -D__SWITCH__=1 -U__linux__ -U__linux -DGLM_FORCE_PURE=1 -DRARCH_CONSOLE -DRARCH_INTERNAL -DGLOBAL_CONFIG_DIR='"/switch"' -DHAVE_STB_VORBIS
|
||||
|
||||
HAVE_DR_MP3 = 1
|
||||
HAVE_TRANSLATE = 1
|
||||
HAVE_AUDIOMIXER = 1
|
||||
HAVE_CC_RESAMPLER = 1
|
||||
HAVE_MENU_COMMON = 1
|
||||
HAVE_RTGA = 1
|
||||
HAVE_RPNG = 1
|
||||
HAVE_RJPEG = 1
|
||||
HAVE_RBMP = 1
|
||||
HAVE_ZLIB = 1
|
||||
HAVE_BUILTINZLIB = 1
|
||||
HAVE_LIBRETRODB = 1
|
||||
HAVE_STATIC_VIDEO_FILTERS = 1
|
||||
HAVE_STATIC_AUDIO_FILTERS = 1
|
||||
HAVE_MENU = 1
|
||||
HAVE_CONFIGFILE = 1
|
||||
HAVE_RUNAHEAD = 1
|
||||
HAVE_NETWORKING = 1
|
||||
HAVE_NETPLAYDISCOVERY = 1
|
||||
HAVE_STB_FONT = 1
|
||||
HAVE_CHEEVOS = 1
|
||||
HAVE_CHD = 0 # disabled due to static libretro-common and libchdr conflicts between different cores
|
||||
HAVE_STB_VORBIS = 1
|
||||
|
||||
# RetroArch libnx useful flags
|
||||
HAVE_THREADS = 1
|
||||
HAVE_PTHREADS = 1
|
||||
HAVE_FREETYPE = 0
|
||||
HAVE_SWITCH = 1
|
||||
HAVE_LIBNX = 1
|
||||
HAVE_OPENGL = 1
|
||||
HAVE_LANGEXTRA = 1
|
||||
HAVE_GFX_WIDGETS = 1
|
||||
|
||||
ifeq ($(HAVE_OPENGL), 1)
|
||||
HAVE_EGL = 1
|
||||
HAVE_SHADERPIPELINE = 1
|
||||
HAVE_RGUI = 1
|
||||
HAVE_MATERIALUI = 1
|
||||
HAVE_XMB = 1
|
||||
HAVE_OZONE = 1
|
||||
HAVE_OVERLAY = 1
|
||||
HAVE_VIDEO_LAYOUT = 1
|
||||
HAVE_GLSL = 1
|
||||
else
|
||||
HAVE_RGUI = 1
|
||||
HAVE_MATERIALUI = 0
|
||||
HAVE_XMB = 0
|
||||
HAVE_OZONE = 0
|
||||
HAVE_STRIPES = 0
|
||||
endif
|
||||
|
||||
include Makefile.common
|
||||
BLACKLIST :=
|
||||
|
||||
OBJ := $(filter-out $(BLACKLIST),$(OBJ))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# DATA is a list of directories containing data files
|
||||
# INCLUDES is a list of directories containing header files
|
||||
# EXEFS_SRC is the optional input directory containing data copied into exefs, if anything this normally should only contain "main.npdm".
|
||||
# ROMFS is the directory containing data to be added to RomFS, relative to the Makefile (Optional)
|
||||
#
|
||||
# NO_ICON: if set to anything, do not use icon.
|
||||
# NO_NACP: if set to anything, no .nacp file is generated.
|
||||
# APP_TITLE is the name of the app stored in the .nacp file (Optional)
|
||||
# APP_AUTHOR is the author of the app stored in the .nacp file (Optional)
|
||||
# APP_VERSION is the version of the app stored in the .nacp file (Optional)
|
||||
# APP_TITLEID is the titleID of the app stored in the .nacp file (Optional)
|
||||
# ICON is the filename of the icon (.jpg), relative to the project folder.
|
||||
# If not set, it attempts to use one of the following (in this order):
|
||||
# - <Project name>.jpg
|
||||
# - icon.jpg
|
||||
# - <libnx folder>/default_icon.jpg
|
||||
#---------------------------------------------------------------------------------
|
||||
BUILD := build
|
||||
SOURCES := $(CURDIR)/source
|
||||
DATA := data
|
||||
INCLUDES := include
|
||||
EXEFS_SRC := exefs_src
|
||||
#ROMFS := switch/romfs
|
||||
|
||||
APP_TITLE := RetroArch
|
||||
APP_VERSION := $(RARCH_VERSION)
|
||||
APP_AUTHOR := libretro Team
|
||||
APP_ICON := pkg/libnx/retroarch.jpg
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE -mcpu=cortex-a57+crc+fp+simd
|
||||
|
||||
CFLAGS := -g -Wall -O3 -ffast-math -ffunction-sections \
|
||||
$(ARCH) $(DEFINES) $(INCLUDE_DIRS) -I$(LIBNX)/include -I$(PORTLIBS)/include/ -include $(LIBNX)/include/switch.h #$(shell $(PORTLIBS)/bin/freetype-config --cflags)
|
||||
|
||||
CFLAGS += $(INCLUDE) -DSWITCH=1 -DHAVE_LIBNX=1 -DNXLINK=1 -DHAVE_SHADERPIPELINE -DHAVE_ONLINE_UPDATER -DHAVE_UPDATE_ASSETS -DHAVE_UPDATE_CORES -DHAVE_STB_FONT #-DHAVE_FREETYPE
|
||||
|
||||
ifeq ($(strip $(HAVE_STATIC_DUMMY)),1)
|
||||
CFLAGS += -DHAVE_STATIC_DUMMY=1
|
||||
endif
|
||||
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
|
||||
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs $(ARCH) -Wl,--allow-multiple-definition -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
# add things from Makefile.common
|
||||
CFLAGS += $(DEF_FLAGS)
|
||||
|
||||
LIBS := -lswresample -lavformat -lavcodec -lavutil -lswscale -lstdc++ -lbz2 -lpng -lz -lnx -lvpx -lopus -llzma -lm
|
||||
|
||||
ifeq ($(HAVE_OPENGL), 1)
|
||||
LIBS := -lEGL -lglapi -ldrm_nouveau $(LIBS)
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(PORTLIBS) $(LIBNX)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OUTPUT := $(TARGET)
|
||||
export TOPDIR := $(CURDIR)
|
||||
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||
|
||||
export DEPSDIR := $(CURDIR)/
|
||||
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CC)
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CXX)
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OFILES := $(OBJ)
|
||||
|
||||
ifeq ($(strip $(HAVE_STATIC_DUMMY)),)
|
||||
OFILES += libretro_libnx.a
|
||||
endif
|
||||
|
||||
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
export BUILD_EXEFS_SRC := $(TOPDIR)/$(EXEFS_SRC)
|
||||
|
||||
ifeq ($(strip $(ICON)),)
|
||||
icons := $(wildcard *.jpg)
|
||||
ifneq (,$(findstring $(TARGET).jpg,$(icons)))
|
||||
export APP_ICON := $(TOPDIR)/$(TARGET).jpg
|
||||
else
|
||||
ifneq (,$(findstring icon.jpg,$(icons)))
|
||||
export APP_ICON := $(TOPDIR)/icon.jpg
|
||||
endif
|
||||
endif
|
||||
else
|
||||
export APP_ICON := $(TOPDIR)/$(ICON)
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(NO_ICON)),)
|
||||
export NROFLAGS += --icon=$(APP_ICON)
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(NO_NACP)),)
|
||||
export NROFLAGS += --nacp=$(CURDIR)/$(TARGET).nacp
|
||||
endif
|
||||
|
||||
ifneq ($(APP_TITLEID),)
|
||||
export NACPFLAGS += --titleid=$(APP_TITLEID)
|
||||
endif
|
||||
|
||||
ifneq ($(ROMFS),)
|
||||
export NROFLAGS += --romfsdir=$(CURDIR)/$(ROMFS)
|
||||
endif
|
||||
|
||||
DEPENDS_TMP := $(OFILES:.o=.d)
|
||||
DEPENDS := $(filter-out libretro_libnx.a,$(DEPENDS_TMP))
|
||||
|
||||
.PHONY: clean all
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
all : $(OUTPUT).pfs0 $(OUTPUT).nro
|
||||
|
||||
$(OUTPUT).pfs0 : $(OUTPUT).nso
|
||||
|
||||
$(OUTPUT).nso : $(OUTPUT).elf
|
||||
|
||||
ifeq ($(strip $(NO_NACP)),)
|
||||
$(OUTPUT).nro : $(OUTPUT).elf $(OUTPUT).nacp
|
||||
else
|
||||
$(OUTPUT).nro : $(OUTPUT).elf
|
||||
endif
|
||||
|
||||
$(OUTPUT).elf : $(OBJ)
|
||||
|
||||
clean:
|
||||
rm -f $(DEPENDS) $(OBJ) $(OUTPUT).pfs0 $(OUTPUT).nro $(OUTPUT).elf
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# you need a rule like this for each extension you use as binary data
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bin.o %_bin.h : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
-354
@@ -1,354 +0,0 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
ifeq ($(strip $(DEVKITPRO)),)
|
||||
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro")
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
|
||||
endif
|
||||
|
||||
export PATH := $(DEVKITPPC)/bin:$(PATH)
|
||||
|
||||
ifeq ($(PLATFORM),)
|
||||
PLATFORM=wii
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# change shell on Snow Leopard
|
||||
#---------------------------------------------------------------------------------
|
||||
UNAME_S := $(shell uname -s)
|
||||
UNAME_R := $(shell uname -r)
|
||||
|
||||
ifneq (,$(findstring Darwin,$(UNAME_S)))
|
||||
ifneq (,$(findstring 10.8.0,$(UNAME_R)))
|
||||
export SHELL=/bin/bash
|
||||
endif
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# path to tools
|
||||
#---------------------------------------------------------------------------------
|
||||
export PORTLIBS := $(DEVKITPRO)/portlibs/ppc
|
||||
export PATH := $(DEVKITPPC)/bin:$(PORTLIBS)/bin:$(PATH)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# the prefix on the compiler executables
|
||||
#---------------------------------------------------------------------------------
|
||||
PREFIX := powerpc-eabi-
|
||||
|
||||
export AS := $(PREFIX)as
|
||||
export CC := $(PREFIX)gcc
|
||||
export CXX := $(PREFIX)g++
|
||||
export AR := $(PREFIX)ar
|
||||
export OBJCOPY := $(PREFIX)objcopy
|
||||
|
||||
ISVC=$(or $(VCBUILDHELPER_COMMAND),$(MSBUILDEXTENSIONSPATH32),$(MSBUILDEXTENSIONSPATH))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.a:
|
||||
#---------------------------------------------------------------------------------
|
||||
@rm -f $@
|
||||
$(AR) -rc $@ $^
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o: %.cpp
|
||||
$(CXX) $(CXXFLAGS) -c $< -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o: %.m
|
||||
$(CC) $(OBJCFLAGS) -c $< -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o: %.s
|
||||
$(CC) -x assembler-with-cpp $(ASFLAGS) -c $< -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o: %.S
|
||||
$(CC) -x assembler-with-cpp $(ASFLAGS) -c $< -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# canned command sequence for binary data
|
||||
#---------------------------------------------------------------------------------
|
||||
define bin2o
|
||||
bin2s -a 32 $< | $(AS) -o $(@)
|
||||
echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(<F) | tr . _)`.h
|
||||
echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(<F) | tr . _)`.h
|
||||
echo "extern const u32" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(<F) | tr . _)`.h
|
||||
endef
|
||||
|
||||
BUILD := build
|
||||
|
||||
BUILD_LITE = 1
|
||||
CURDIR = .
|
||||
|
||||
export BASEDIR := $(CURDIR)
|
||||
export DEPSDIR := $(BASEDIR)/wii/libogc/deps
|
||||
export LWIPDIR := $(BASEDIR)/wii/libogc/lwip
|
||||
export OGCDIR := $(BASEDIR)/wii/libogc/libogc
|
||||
export DBDIR := $(BASEDIR)/wii/libogc/libdb
|
||||
export BTEDIR := $(BASEDIR)/wii/libogc/lwbt
|
||||
export WIIUSEDIR := $(BASEDIR)/wii/libogc/wiiuse
|
||||
export LIBWIIKEYB := $(BASEDIR)/wii/libogc/libwiikeyboard
|
||||
export STUBSDIR := $(BASEDIR)/wii/libogc/lockstubs
|
||||
export LIBS := $(BASEDIR)/wii/libogc/libs
|
||||
|
||||
export INCDIR := $(BASEDIR)/wii/libogc/include
|
||||
|
||||
export LIBDIR := $(LIBS)/$(PLATFORM)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
BBALIB := $(LIBDIR)/libbba
|
||||
OGCLIB := $(LIBDIR)/libogc
|
||||
DBLIB := $(LIBDIR)/libdb
|
||||
BTELIB := $(LIBDIR)/libbte
|
||||
WIIUSELIB := $(LIBDIR)/libwiiuse
|
||||
WIIKEYBLIB := $(LIBDIR)/libwiikeyboard
|
||||
STUBSLIB := $(LIBDIR)/libgclibstubs
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
DEFAULTINCDIR := $(BASEDIR)/wii/libogc/include
|
||||
DEFINCS := -I$(DEFAULTINCDIR)
|
||||
INCLUDES := $(DEFINCS) \
|
||||
-I$(BASEDIR)/wii/libogc \
|
||||
-I$(DEFAULTINCDIR)/netif \
|
||||
-I$(DEFAULTINCDIR)/ipv4 \
|
||||
-I$(DEFAULTINCDIR)/sdcard \
|
||||
-I$(DEFAULTINCDIR)/ogc \
|
||||
-I$(DEFAULTINCDIR)/ogc/machine \
|
||||
-I$(DEFAULTINCDIR)/bte \
|
||||
-I$(DEFAULTINCDIR)/sdcard \
|
||||
-I$(DEFAULTINCDIR)/wiikeyboard \
|
||||
-I$(DEFAULTINCDIR)/wiiuse \
|
||||
-I$(DEFAULTINCDIR)/di
|
||||
|
||||
MACHDEP := -DBIGENDIAN -DGEKKO -mcpu=750 -meabi -msdata=eabi -mhard-float -ffunction-sections -fdata-sections
|
||||
|
||||
ifeq ($(PLATFORM),wii)
|
||||
MACHDEP += -DHW_RVL
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),cube)
|
||||
MACHDEP += -DHW_DOL
|
||||
endif
|
||||
|
||||
CFLAGS := -DLIBOGC_INTERNAL -DNDEBUG -O2 -fno-strict-aliasing -mregnames -Wall $(MACHDEP) $(INCLUDES)
|
||||
ASFLAGS := $(MACHDEP) -mregnames -D_LANGUAGE_ASSEMBLY $(INCLUDES)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
VPATH := $(LWIPDIR) \
|
||||
$(LWIPDIR)/arch/gc \
|
||||
$(LWIPDIR)/arch/gc/netif \
|
||||
$(LWIPDIR)/core \
|
||||
$(LWIPDIR)/core/ipv4 \
|
||||
$(LWIPDIR)/netif \
|
||||
$(OGCDIR) \
|
||||
$(DBDIR) \
|
||||
$(DBDIR)/uIP \
|
||||
$(BTEDIR) \
|
||||
$(WIIUSEDIR) \
|
||||
$(SDCARDDIR) \
|
||||
$(LIBWIIKEYB) \
|
||||
$(STUBSDIR)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
SOURCES_LWIP := $(LWIPDIR)/network.c \
|
||||
$(LWIPDIR)/netio.c \
|
||||
$(LWIPDIR)/arch/gc/netif/gcif.c \
|
||||
$(LWIPDIR)/core/inet.c \
|
||||
$(LWIPDIR)/core/mem.c \
|
||||
$(LWIPDIR)/core/dhcp.c \
|
||||
$(LWIPDIR)/core/raw.c \
|
||||
$(LWIPDIR)/core/memp.c \
|
||||
$(LWIPDIR)/core/netif.c \
|
||||
$(LWIPDIR)/core/pbuf.c \
|
||||
$(LWIPDIR)/core/stats.c \
|
||||
$(LWIPDIR)/core/sys.c \
|
||||
$(LWIPDIR)/core/tcp.c \
|
||||
$(LWIPDIR)/core/tcp_in.c \
|
||||
$(LWIPDIR)/core/tcp_out.c \
|
||||
$(LWIPDIR)/core/udp.c \
|
||||
$(LWIPDIR)/core/ipv4/icmp.c \
|
||||
$(LWIPDIR)/core/ipv4/ip.c \
|
||||
$(LWIPDIR)/core/ipv4/ip_frag.c \
|
||||
$(LWIPDIR)/core/ipv4/ip_addr.c \
|
||||
$(LWIPDIR)/netif/etharp.c \
|
||||
$(LWIPDIR)/netif/loopif.c
|
||||
|
||||
LWIPOBJ := $(SOURCES_LWIP:.c=.o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
SOURCES_OGC := \
|
||||
$(OGCDIR)/console.c \
|
||||
$(OGCDIR)/lwp_priority.c \
|
||||
$(OGCDIR)/lwp_queue.c \
|
||||
$(OGCDIR)/lwp_threadq.c \
|
||||
$(OGCDIR)/lwp_threads.c \
|
||||
$(OGCDIR)/lwp_sema.c \
|
||||
$(OGCDIR)/lwp_messages.c \
|
||||
$(OGCDIR)/lwp.c \
|
||||
$(OGCDIR)/lwp_stack.c \
|
||||
$(OGCDIR)/lwp_mutex.c \
|
||||
$(OGCDIR)/lwp_watchdog.c \
|
||||
$(OGCDIR)/lwp_wkspace.c \
|
||||
$(OGCDIR)/lwp_objmgr.c \
|
||||
$(OGCDIR)/lwp_heap.c \
|
||||
$(OGCDIR)/sys_state.c \
|
||||
$(OGCDIR)/exception.c \
|
||||
$(OGCDIR)/irq.c \
|
||||
$(OGCDIR)/semaphore.c \
|
||||
$(OGCDIR)/video.c \
|
||||
$(OGCDIR)/pad.c \
|
||||
$(OGCDIR)/exi.c \
|
||||
$(OGCDIR)/mutex.c \
|
||||
$(OGCDIR)/arqueue.c \
|
||||
$(OGCDIR)/arqmgr.c \
|
||||
$(OGCDIR)/system.c \
|
||||
$(OGCDIR)/cond.c \
|
||||
$(OGCDIR)/gx.c \
|
||||
$(OGCDIR)/gu.c \
|
||||
$(OGCDIR)/audio.c \
|
||||
$(OGCDIR)/cache.c \
|
||||
$(OGCDIR)/decrementer.c \
|
||||
$(OGCDIR)/message.c \
|
||||
$(OGCDIR)/card.c \
|
||||
$(OGCDIR)/aram.c \
|
||||
$(OGCDIR)/depackrnc1.c \
|
||||
$(OGCDIR)/dsp.c \
|
||||
$(OGCDIR)/si.c \
|
||||
$(OGCDIR)/tpl.c \
|
||||
$(OGCDIR)/ipc.c \
|
||||
$(OGCDIR)/console_font_8x16.c \
|
||||
$(OGCDIR)/timesupp.c \
|
||||
$(OGCDIR)/lock_supp.c \
|
||||
$(OGCDIR)/newlibc.c \
|
||||
$(OGCDIR)/usbgecko.c \
|
||||
$(OGCDIR)/usbmouse.c \
|
||||
$(OGCDIR)/sbrk.c \
|
||||
$(OGCDIR)/malloc_lock.c \
|
||||
$(OGCDIR)/kprintf.c \
|
||||
$(OGCDIR)/stm.c \
|
||||
$(OGCDIR)/ios.c \
|
||||
$(OGCDIR)/es.c \
|
||||
$(OGCDIR)/isfs.c \
|
||||
$(OGCDIR)/usb.c \
|
||||
$(OGCDIR)/network_common.c \
|
||||
$(OGCDIR)/sdgecko_io.c \
|
||||
$(OGCDIR)/sdgecko_buf.c \
|
||||
$(OGCDIR)/gcsd.c \
|
||||
$(OGCDIR)/argv.c \
|
||||
$(OGCDIR)/network_wii.c \
|
||||
$(OGCDIR)/wiisd.c \
|
||||
$(OGCDIR)/conf.c \
|
||||
$(OGCDIR)/usbstorage.c \
|
||||
$(OGCDIR)/texconv.c \
|
||||
$(OGCDIR)/wiilaunch.c
|
||||
|
||||
SOURCES_OGC_ASM := $(OGCDIR)/cache_asm.S \
|
||||
$(OGCDIR)/decrementer_handler.S \
|
||||
$(OGCDIR)/depackrnc.S \
|
||||
$(OGCDIR)/exception_handler.S \
|
||||
$(OGCDIR)/gu_psasm.S \
|
||||
$(OGCDIR)/irq_handler.S \
|
||||
$(OGCDIR)/lwp_handler.S \
|
||||
$(OGCDIR)/ogc_crt0.S \
|
||||
$(OGCDIR)/system_asm.S \
|
||||
$(OGCDIR)/video_asm.S
|
||||
|
||||
ifneq ($(BUILD_LITE), 1)
|
||||
SOURCES_OGC += $(OGCDIR)/dvd.c
|
||||
endif
|
||||
|
||||
OGCOBJ := $(SOURCES_OGC:.c=.o) $(SOURCES_OGC_ASM:.S=.o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
SOURCES_DB := \
|
||||
$(DBDIR)/uIP/uip_ip.c \
|
||||
$(DBDIR)/uIP/uip_tcp.c \
|
||||
$(DBDIR)/uIP/uip_pbuf.c \
|
||||
$(DBDIR)/uIP/uip_netif.c \
|
||||
$(DBDIR)/uIP/uip_arp.c \
|
||||
$(DBDIR)/uIP/uip_arch.c \
|
||||
$(DBDIR)/uIP/uip_icmp.c \
|
||||
$(DBDIR)/uIP/memb.c \
|
||||
$(DBDIR)/uIP/memr.c \
|
||||
$(DBDIR)/uIP/bba.c \
|
||||
$(DBDIR)/tcpip.c \
|
||||
$(DBDIR)/debug.c \
|
||||
$(DBDIR)/debug_handler.c \
|
||||
$(DBDIR)/debug_supp.c \
|
||||
$(DBDIR)/geckousb.c
|
||||
|
||||
DBOBJ := $(SOURCES_DB:.c=.o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
SOURCES_BTE := \
|
||||
$(BTEDIR)/bte.c \
|
||||
$(BTEDIR)/hci.c \
|
||||
$(BTEDIR)/l2cap.c \
|
||||
$(BTEDIR)/btmemb.c \
|
||||
$(BTEDIR)/btmemr.c \
|
||||
$(BTEDIR)/btpbuf.c \
|
||||
$(BTEDIR)/physbusif.c
|
||||
|
||||
BTEOBJ := $(SOURCES_BTE:.c=.o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
SOURCES_WIIUSE := \
|
||||
$(WIIUSEDIR)/classic.c \
|
||||
$(WIIUSEDIR)/dynamics.c \
|
||||
$(WIIUSEDIR)/events.c \
|
||||
$(WIIUSEDIR)/io.c \
|
||||
$(WIIUSEDIR)/io_wii.c \
|
||||
$(WIIUSEDIR)/ir.c \
|
||||
$(WIIUSEDIR)/nunchuk.c \
|
||||
$(WIIUSEDIR)/wiiuse.c \
|
||||
$(WIIUSEDIR)/speaker.c \
|
||||
$(WIIUSEDIR)/wpad.c \
|
||||
$(WIIUSEDIR)/motion_plus.c
|
||||
|
||||
WIIUSEOBJ := $(SOURCES_WIIUSE:.c=.o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
SOURCES_WIIKEYB = $(LIBWIIKEYB)/usbkeyboard.c \
|
||||
$(LIBWIIKEYB)/keyboard.c \
|
||||
$(LIBWIIKEYB)/ukbdmap.c \
|
||||
$(LIBWIIKEYB)/wskbdutil.c
|
||||
|
||||
WIIKEYBLIBOBJ := $(SOURCES_WIIKEYB:.c=.o)
|
||||
|
||||
LIBRARIES := $(OGCLIB).a $(DBLIB).a
|
||||
|
||||
ifeq ($(PLATFORM),cube)
|
||||
LIBRARIES += $(BBALIB).a
|
||||
endif
|
||||
ifeq ($(PLATFORM),wii)
|
||||
LIBRARIES += $(BTELIB).a $(WIIUSELIB).a $(WIIKEYBLIB).a
|
||||
endif
|
||||
|
||||
all: $(LIBRARIES)
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BBALIB).a: $(LWIPOBJ)
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OGCLIB).a: $(OGCOBJ)
|
||||
#---------------------------------------------------------------------------------
|
||||
$(DBLIB).a: $(DBOBJ)
|
||||
#---------------------------------------------------------------------------------
|
||||
$(WIIKEYBLIB).a: $(WIIKEYBLIBOBJ)
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BTELIB).a: $(BTEOBJ)
|
||||
#---------------------------------------------------------------------------------
|
||||
$(WIIUSELIB).a: $(WIIUSEOBJ)
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
#---------------------------------------------------------------------------------
|
||||
rm -fr $(LWIPOBJ) $(OGCOBJ) $(DBOBJ) $(BTEOBJ) $(WIIUSEOBJ) $(WIIKEYBLIBOBJ)
|
||||
rm -f *.map
|
||||
-282
@@ -1,282 +0,0 @@
|
||||
TARGET := retroarch.exe
|
||||
DEBUG = 0
|
||||
GRIFFIN_BUILD = 0
|
||||
OS = Win32
|
||||
ARCH = amd64
|
||||
#TARGET_ARCH = x86
|
||||
BUILD_DIR = objs/msvc
|
||||
CXX_BUILD = 0
|
||||
|
||||
WindowsSdkDir = C:\Program Files (x86)\Windows Kits\10\$(NOTHING)
|
||||
WindowsSDKVersion := 10.0.14393.0\$(NOTHING)
|
||||
VCINSTALLDIR := C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\$(NOTHING)
|
||||
|
||||
HAVE_AUDIOMIXER := 1
|
||||
HAVE_D3DX := 1
|
||||
HAVE_D3D8 := 0
|
||||
HAVE_D3D9 := 1
|
||||
HAVE_D3D10 := 1
|
||||
HAVE_D3D11 := 1
|
||||
HAVE_D3D12 := 1
|
||||
HAVE_CG := 1
|
||||
HAVE_OPENGL := 1
|
||||
HAVE_OPENGL1 := 1
|
||||
HAVE_GFX_WIDGETS := 1
|
||||
HAVE_VULKAN := 1
|
||||
HAVE_XAUDIO := 1
|
||||
HAVE_XINPUT := 1
|
||||
HAVE_WASAPI := 0
|
||||
HAVE_THREAD_STORAGE := 1
|
||||
HAVE_WINMM := 1
|
||||
|
||||
HAVE_RPNG := 1
|
||||
HAVE_ZLIB := 1
|
||||
HAVE_CONFIGFILE := 1
|
||||
HAVE_MENU := 1
|
||||
HAVE_RGUI := 1
|
||||
HAVE_XMB := 1
|
||||
HAVE_MATERIALUI := 1
|
||||
HAVE_STB_FONT := 1
|
||||
HAVE_THREADS := 1
|
||||
HAVE_LIBRETRODB := 1
|
||||
HAVE_COMMAND := 1
|
||||
HAVE_STDIN_CMD := 1
|
||||
HAVE_CMD := 1
|
||||
HAVE_DYLIB := 1
|
||||
HAVE_DYNAMIC := 1
|
||||
HAVE_DINPUT := 1
|
||||
HAVE_MENU_COMMON := 1
|
||||
HAVE_BUILTINZLIB := 1
|
||||
|
||||
HAVE_RJPEG := 1
|
||||
HAVE_RBMP := 1
|
||||
HAVE_RTGA := 1
|
||||
HAVE_7ZIP := 1
|
||||
HAVE_NETWORKING := 1
|
||||
HAVE_NETWORK_CMD := 1
|
||||
HAVE_OVERLAY := 1
|
||||
HAVE_VIDEO_LAYOUT := 0
|
||||
HAVE_LANGEXTRA := 1
|
||||
HAVE_CHEEVOS := 1
|
||||
HAVE_SHADERPIPELINE := 1
|
||||
HAVE_IMAGEVIEWER := 1
|
||||
|
||||
ifeq ($(HAVE_D3D8), 1)
|
||||
D3D8_LIBS := -ld3d8
|
||||
ifeq ($(HAVE_D3DX), 1)
|
||||
D3DX8_LIBS := -ld3dx8
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_D3D9), 1)
|
||||
D3D9_LIBS := -ld3d9
|
||||
ifeq ($(HAVE_D3DX), 1)
|
||||
D3DX9_LIBS := -ld3dx9
|
||||
endif
|
||||
endif
|
||||
|
||||
include Makefile.common
|
||||
INCLUDE_DIRS := $(patsubst -isystem%,-I%,$(INCLUDE_DIRS))
|
||||
CFLAGS := $(filter-out -Wno-unknown-pragmas,$(DEF_FLAGS))
|
||||
CXXFLAGS := $(filter-out -fpermissive -Wno-switch -Wno-sign-compare -fno-strict-aliasing -Wno-maybe-uninitialized -Wno-reorder -Wno-parentheses,$(CXXFLAGS))
|
||||
LIBS := $(filter-out -lstdc++,$(LIBS))
|
||||
|
||||
ifeq ($(ARCH),x64)
|
||||
ARCH := amd64
|
||||
endif
|
||||
|
||||
ARCH2 := $(ARCH)
|
||||
ifeq ($(ARCH),amd64)
|
||||
ARCH2 := x64
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_ARCH),)
|
||||
TARGET_ARCH = $(ARCH)
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_ARCH),x64)
|
||||
TARGET_ARCH = amd64
|
||||
endif
|
||||
|
||||
TARGET_ARCH2 = $(TARGET_ARCH)
|
||||
ifeq ($(TARGET_ARCH2),amd64)
|
||||
TARGET_ARCH2 = x64
|
||||
endif
|
||||
|
||||
CROSS = $(ARCH)
|
||||
ifeq ($(ARCH),x86)
|
||||
CROSS =
|
||||
endif
|
||||
|
||||
INCLUDE := $(VCINSTALLDIR)include;$(VCINSTALLDIR)atlmfc\include;$(WindowsSdkDir)include\$(WindowsSDKVersion)ucrt;$(WindowsSdkDir)include\$(WindowsSDKVersion)shared;$(WindowsSdkDir)include\$(WindowsSDKVersion)um;
|
||||
LIB := $(VCINSTALLDIR)LIB\$(CROSS);$(VCINSTALLDIR)atlmfc\lib\$(CROSS);$(WindowsSdkDir)lib\$(WindowsSDKVersion)ucrt\$(TARGET_ARCH2);$(WindowsSdkDir)lib\$(WindowsSDKVersion)um\$(TARGET_ARCH2);C:\Program Files (x86)\NVIDIA Corporation\Cg\lib.$(TARGET_ARCH2);C:\Program Files (x86)\Microsoft DirectX SDK (February 2010)\Lib\$(TARGET_ARCH2);
|
||||
LIBPATH := $(VCINSTALLDIR)LIB\$(CROSS);$(VCINSTALLDIR)atlmfc\lib\$(CROSS);
|
||||
|
||||
PATH := $(shell IFS=$$'\n'; cygpath "$(VCINSTALLDIR)bin\\$(CROSS)"):$(shell IFS=$$'\n'; cygpath "$(WindowsSdkDir)\bin\\$(ARCH2)"):$(PATH)
|
||||
|
||||
export INCLUDE := $(INCLUDE)
|
||||
export LIB := $(LIB)
|
||||
export LIBPATH := $(LIBPATH)
|
||||
export PATH := $(PATH)
|
||||
|
||||
#$(info WindowsSdkDir : $(WindowsSdkDir))
|
||||
#$(info WindowsSDKVersion : $(WindowsSDKVersion))
|
||||
#$(info VCINSTALLDIR : $(VCINSTALLDIR))
|
||||
#$(info INCLUDE : $(INCLUDE))
|
||||
#$(info LIB : $(LIB))
|
||||
#$(info LIBPATH : $(LIBPATH))
|
||||
#$(info PATH : $(PATH))
|
||||
#$(error end)
|
||||
|
||||
DEFINES += -D__SSE__ -D__SSE2__
|
||||
ifeq ($(TARGET_ARCH2),x64)
|
||||
DEFINES += -D__x86_64__
|
||||
else
|
||||
#DEFINES += -D__i686__
|
||||
endif
|
||||
|
||||
FLAGS += -nologo -MP
|
||||
FLAGS += -Gm- -Zc:inline -fp:precise -Zc:forScope -GR- -Gd -Oi -volatile:iso
|
||||
#FLAGS += -Zc:wchar_t -Zp16 -Z7
|
||||
FLAGS += -utf-8
|
||||
#FLAGS += -source-charset:utf-8
|
||||
|
||||
CXXFLAGS += $(CFLAGS) -TP -EHsc
|
||||
ifeq ($(CXX_BUILD),1)
|
||||
CFLAGS := $(CXXFLAGS)
|
||||
DEFINES += -DCXX_BUILD
|
||||
else
|
||||
CFLAGS += -TC
|
||||
endif
|
||||
|
||||
WARNINGS += -WX -W3
|
||||
WARNINGS += -wd4101 -wd4996 -wd4244 -wd4267 -wd4090 -wd4305 -wd4146 -wd4334 -wd4018 -wd4800 -wd4838
|
||||
|
||||
CC = cl.exe
|
||||
CXX = cl.exe
|
||||
LD = link.exe
|
||||
RC = rc.exe
|
||||
|
||||
LIBS += shell32.lib user32.lib gdi32.lib comdlg32.lib winmm.lib ole32.lib
|
||||
LDFLAGS += -nologo -wx -nxcompat -machine:$(TARGET_ARCH2)
|
||||
|
||||
ifeq ($(DEBUG),1)
|
||||
FLAGS += -GS -Gy -Od -RTC1 -D_SECURE_SCL=1 -Zi
|
||||
FLAGS += -MDd
|
||||
LDFLAGS += -DEBUG
|
||||
DEFINES += -DDEBUG -D_DEBUG
|
||||
else
|
||||
FLAGS += -GS- -Gy- -O2 -Ob2 -GF -GT -Oy -Ot -D_SECURE_SCL=0
|
||||
FLAGS += -MD
|
||||
endif
|
||||
|
||||
ifeq ($(DEBUG),1)
|
||||
BUILD_DIR := $(BUILD_DIR)-debug
|
||||
endif
|
||||
|
||||
ifeq ($(GRIFFIN_BUILD),1)
|
||||
BUILD_DIR := $(BUILD_DIR)-griffin
|
||||
endif
|
||||
|
||||
BUILD_DIR := $(BUILD_DIR)-$(TARGET_ARCH2)
|
||||
|
||||
ifneq ($(V), 1)
|
||||
Q := @
|
||||
endif
|
||||
|
||||
ifeq ($(GRIFFIN_BUILD), 1)
|
||||
OBJ := griffin/griffin.o griffin/griffin_cpp.o
|
||||
DEFINES += -DHAVE_GRIFFIN -DUSE_MATH_DEFINES
|
||||
else
|
||||
BLACKLIST :=
|
||||
OBJ := $(filter-out $(BLACKLIST),$(OBJ))
|
||||
endif
|
||||
|
||||
DEFINES += -DRARCH_INTERNAL -DHAVE_DYNAMIC -DJSON_STATIC
|
||||
INCLUDE_DIRS += -I. -Igfx/include
|
||||
|
||||
#OBJ := version_git.o
|
||||
|
||||
OBJ := $(patsubst %rarch.o,%rarch.res,$(OBJ))
|
||||
OBJ := $(addprefix $(BUILD_DIR)/,$(OBJ))
|
||||
OBJ := $(OBJ:.o=.obj)
|
||||
|
||||
LDFLAGS += -WX -SUBSYSTEM:WINDOWS -ENTRY:mainCRTStartup
|
||||
|
||||
DEFINES := $(patsubst -f%,,$(DEFINES))
|
||||
LDFLAGS := $(patsubst -l%,%.lib,$(LDFLAGS))
|
||||
LIBS := $(filter-out -lm,$(LIBS))
|
||||
LIBS := $(patsubst -l%,%.lib,$(LIBS))
|
||||
|
||||
#$(info INCLUDE_DIRS : $(INCLUDE_DIRS))
|
||||
#$(info DEFINES : $(DEFINES))
|
||||
#$(info CFLAGS : $(CFLAGS))
|
||||
#$(info CXXFLAGS : $(CXXFLAGS))
|
||||
#$(info LDFLAGS : $(LDFLAGS))
|
||||
#$(info LIBS : $(LIBS))
|
||||
#$(info OBJ : $(OBJ))
|
||||
#$(info target : $(TARGET))
|
||||
#$(info flags : $(FLAGS))
|
||||
#$(info INCLUDE : $(INCLUDE))
|
||||
#$(info LIB : $(LIB))
|
||||
#$(info LIBPATH : $(LIBPATH))
|
||||
#$(error end)
|
||||
|
||||
$(info os : $(OS))
|
||||
$(info host : $(ARCH))
|
||||
$(info target : $(TARGET_ARCH))
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
%: $(BUILD_DIR)/%
|
||||
cp $< $@
|
||||
|
||||
ifeq ($(DEBUG),1)
|
||||
%.exe: $(BUILD_DIR)/%.exe
|
||||
cp $< $@
|
||||
cp $(BUILD_DIR)/$*.pdb $*.pbd
|
||||
endif
|
||||
|
||||
SHELL:=$(SHELL) -o pipefail
|
||||
|
||||
DEPFLAGS = -showIncludes | tee $(BUILD_DIR)/$*.dtemp | sed /'Note: including file:'/d
|
||||
MAKEDEPS = echo $@: $< \\ > $(BUILD_DIR)/$*.depend && \
|
||||
grep 'Note: including file:' $(BUILD_DIR)/$*.dtemp \
|
||||
| sed '/$(subst \,\\,$(WindowsSdkDir))/Id; /$(subst \,\\,$(VCINSTALLDIR))/Id; s/Note: including file:[ ]*//g; s/\\/\//g; s/ /\\ /g; s/.*/ & \\/g' \
|
||||
>> $(BUILD_DIR)/$*.depend && \
|
||||
rm -f $(BUILD_DIR)/$*.dtemp
|
||||
|
||||
#DEPFLAGS :=
|
||||
#MAKEDEPS :=
|
||||
|
||||
$(BUILD_DIR)/%.obj: %.cpp
|
||||
@mkdir -p $(dir $@)
|
||||
$(Q)$(CXX) -c -Fo:$@ $< $(FLAGS) $(CXXFLAGS) $(DEFINES) $(INCLUDE_DIRS) $(WARNINGS) $(DEPFLAGS)
|
||||
@$(MAKEDEPS)
|
||||
|
||||
$(BUILD_DIR)/%.obj: %.c
|
||||
@mkdir -p $(dir $@)
|
||||
$(Q)$(CC) -c -Fo:$@ $< $(FLAGS) $(CFLAGS) $(DEFINES) $(INCLUDE_DIRS) $(WARNINGS) $(DEPFLAGS)
|
||||
@$(MAKEDEPS)
|
||||
|
||||
$(BUILD_DIR)/%.res: %.rc
|
||||
@mkdir -p $(dir $@)
|
||||
$(Q)$(RC) $<
|
||||
$(Q)mv $*.res $@
|
||||
|
||||
$(BUILD_DIR)/$(TARGET): $(OBJ) .$(TARGET).last
|
||||
@touch .$(TARGET).last
|
||||
$(Q)$(LD) $(OBJ) $(LDFLAGS) $(LIBS) -out:$(BUILD_DIR)/$(TARGET)
|
||||
|
||||
%.h %.hpp %.depend %.last: ;
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ) $(TARGET)
|
||||
rm -f $(BUILD_DIR)/$(TARGET)
|
||||
rm -f .$(TARGET).last
|
||||
rm -f $(OBJ:.obj=.depend)
|
||||
|
||||
.PHONY: clean all
|
||||
.PRECIOUS: %.depend %.last
|
||||
|
||||
-include $(patsubst %.obj,%.depend,$(filter %.obj,$(OBJ)))
|
||||
@@ -1,4 +1,4 @@
|
||||
include version.all
|
||||
RARCH_VERSION = "0.9.9.3"
|
||||
|
||||
DEBUG = 0
|
||||
|
||||
@@ -10,12 +10,12 @@ TARGET := retroarch-pandora
|
||||
LDDIRS = -L. -L$(PNDSDK)/usr/lib
|
||||
INCDIRS = -I. -I$(PNDSDK)/usr/include
|
||||
|
||||
OBJ = griffin/griffin.o audio/resamplers/sinc_resampler_neon.o libretro-common/conversion/s16_to_float_neon.o libretro-common/conversion/float_to_s16_neon.o
|
||||
OBJ = griffin/griffin.o audio/resamplers/sinc_resampler_neon.o audio/audio_utils_neon.o
|
||||
LDFLAGS = -L$(PNDSDK)/usr/lib -Wl,-rpath,$(PNDSDK)/usr/lib
|
||||
|
||||
LIBS = -lGLESv2 -lEGL -ldl -lm -lpthread -lrt -lasound
|
||||
DEFINES = -std=gnu99 -DHAVE_THREADS -DHAVE_GETOPT_LONG=1 -DHAVE_GRIFFIN -DRARCH_INTERNAL
|
||||
DEFINES += -DHAVE_CONFIGFILE -D__ARM_ARCH_6__ -DHAVE_OPENGL -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DHAVE_GLSL -DHAVE_DYNAMIC -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_OVERLAY -DHAVE_VIDEO_LAYOUT -DHAVE_ALSA -DHAVE_ZLIB -D__linux__
|
||||
DEFINES += -D__ARM_ARCH_6__ -DSINC_LOWER_QUALITY -DHAVE_OPENGL -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DHAVE_GLSL -DHAVE_DYNAMIC -DWANT_RPNG -DWANT_ZLIB -DHAVE_OVERLAY -DHAVE_ALSA -DHAVE_ZLIB -D__linux__
|
||||
DEFINES += $(INCDIRS)
|
||||
DEFINES += -D__OPENPANDORA__ -DPANDORA
|
||||
DEFINES += -marm -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize
|
||||
|
||||
-165
@@ -1,165 +0,0 @@
|
||||
TARGET := retroarch_orbis
|
||||
DEBUG ?= 0
|
||||
GRIFFIN_BUILD = 0
|
||||
WHOLE_ARCHIVE_LINK = 0
|
||||
|
||||
PS4_TITLE_ID := RETROARCH
|
||||
PS4_TITLE_NAME := RetroArch
|
||||
|
||||
PC_DEVELOPMENT_IP_ADDRESS =
|
||||
PC_DEVELOPMENT_UDP_PORT =
|
||||
|
||||
OBJ :=
|
||||
|
||||
DEFINES :=
|
||||
|
||||
ifeq ($(GRIFFIN_BUILD), 1)
|
||||
OBJ += griffin/griffin.o
|
||||
DEFINES += -DHAVE_GRIFFIN=1
|
||||
DEFINES += -DHAVE_MENU -DHAVE_LIBRETRODB -DHAVE_CONFIGFILE
|
||||
DEFINES += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DHAVE_CC_RESAMPLER
|
||||
ifeq ($(DEBUG), 1)
|
||||
DEFINES += -DHAVE_NETLOGGER
|
||||
endif
|
||||
else
|
||||
|
||||
HAVE_FILTERS_BUILTIN := 1
|
||||
HAVE_LANGEXTRA := 0
|
||||
HAVE_RPNG := 1
|
||||
HAVE_RJPEG := 1
|
||||
HAVE_RBMP := 1
|
||||
HAVE_RTGA := 1
|
||||
HAVE_ZLIB := 1
|
||||
HAVE_OVERLAY := 1
|
||||
HAVE_VIDEO_LAYOUT := 0
|
||||
HAVE_7ZIP := 1
|
||||
HAVE_EGL := 1
|
||||
HAVE_GFX_WIDGETS := 1
|
||||
HAVE_GLSL := 1
|
||||
HAVE_OPENGLES := 1
|
||||
HAVE_NETWORKING := 0
|
||||
HAVE_SOCKET_LEGACY := 0
|
||||
HAVE_MENU := 1
|
||||
HAVE_MENU_COMMON := 1
|
||||
HAVE_CONFIGFILE := 1
|
||||
HAVE_RGUI := 0
|
||||
HAVE_MATERIALUI := 0
|
||||
HAVE_XMB := 1
|
||||
HAVE_THREADS := 1
|
||||
HAVE_LIBRETRODB := 1
|
||||
HAVE_CC_RESAMPLER := 1
|
||||
HAVE_CHEEVOS := 1
|
||||
RARCH_CONSOLE := 1
|
||||
HAVE_STATIC_VIDEO_FILTERS = 1
|
||||
HAVE_STATIC_AUDIO_FILTERS = 1
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
HAVE_NETLOGGER = 1
|
||||
endif
|
||||
|
||||
include Makefile.common
|
||||
CFLAGS += $(DEF_FLAGS)
|
||||
BLACKLIST :=
|
||||
OBJ := $(filter-out $(BLACKLIST),$(OBJ))
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(PS4SDK)),)
|
||||
$(error "Please set PS4SDK in your environment. export PS4SDK=<path to>ps4sdk")
|
||||
endif
|
||||
|
||||
export PATH := $(PATH):$(PS4SDK)/bin
|
||||
|
||||
PREFIX :=
|
||||
|
||||
CC := $(PREFIX)clang
|
||||
CXX := $(PREFIX)clang
|
||||
AS := $(PREFIX)clang
|
||||
AR := $(PREFIX)ar
|
||||
OBJCOPY := $(PREFIX)objcopy
|
||||
STRIP := $(PREFIX)strip
|
||||
NM := $(PREFIX)nm
|
||||
LD := $(CXX)
|
||||
|
||||
INCDIRS := -I. -Ideps/7zip -Ilibretro-common/include -Ideps/stb -Ilibretro-common/include/compat/zlib
|
||||
LIBDIRS := -L.
|
||||
|
||||
ARCHFLAGS := -m64 -DORBIS
|
||||
CFLAGS += $(ARCHFLAGS) -std=c11 -mcmodel=large -ffreestanding -nostdlib -nostdinc -fno-builtin -fno-stack-protector
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -O2 -g
|
||||
else
|
||||
CFLAGS += -O3
|
||||
endif
|
||||
|
||||
ASFLAGS := $(ARCHFLAGS) -I$(PS4SDK)/include -target x86_64-scei-ps4-elf -fPIE
|
||||
LDFLAGS := -O3 -Wall -m64 -nostartfiles -nostdlib -L$(PS4SDK)/lib -pie
|
||||
ARFLAGS := rcs
|
||||
|
||||
CRTFILE ?= $(PS4SDK)/crt0.s
|
||||
|
||||
CFLAGS += -Wall -pedantic -Wno-zero-length-array -Wno-format-pedantic
|
||||
CFLAGS += -D__PS4__ -I$(PS4SDK)/include -I $(PS4SDK)/include/sce
|
||||
CFLAGS += -target x86_64-scei-ps4-elf -fPIE
|
||||
CFLAGS += -DRARCH_INTERNAL -DRARCH_CONSOLE
|
||||
CFLAGS += -DHAVE_FILTERS_BUILTIN $(DEFINES)
|
||||
|
||||
ifneq ($(PC_DEVELOPMENT_IP_ADDRESS),)
|
||||
CFLAGS += -DPC_DEVELOPMENT_IP_ADDRESS='"$(PC_DEVELOPMENT_IP_ADDRESS)"'
|
||||
endif
|
||||
|
||||
ifneq ($(PC_DEVELOPMENT_UDP_PORT),)
|
||||
CFLAGS += -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
|
||||
endif
|
||||
|
||||
ifeq ($(WHOLE_ARCHIVE_LINK), 1)
|
||||
WHOLE_START := -Wl,--whole-archive
|
||||
WHOLE_END := -Wl,--no-whole-archive
|
||||
endif
|
||||
CXXFLAGS := $(CFLAGS)
|
||||
|
||||
PS4_LIBS := -lps4link -ldebugnet -lorbisFile -lelfloader -lorbisKeyboard -lorbis2d -lpng -lz -lorbisGl -lorbisPad -lorbisAudio -lmod -lorbisFileBrowser -lorbisXbmFont -lSceNet_stub -lScePigletv2VSH_stub -lSceSystemService_stub -lSceUserService_stub -lScePad_stub -lSceAudioOut_stub -lSceIme_stub -lSceSysmodule_stub \
|
||||
-lPs4_extension_kernel_call_standard -lPs4_extension_kernel_execute_dynlib_prepare_dlclose -lPs4_common_kernel -lPs4_common_user -lPs4_common_generic -lPs4LibCInternalAdaptive_stub -lPs4LibKernelAdaptive_stub -lSceLibcInternal_stub -lkernel_stub -lps4Kernel_stub -lPs4_base_stub_resolve_minimal -lPs4_base_kernel_dlsym_standard -lPs4_base_kernel_seek_elf_address_standard -lPs4_base_assembler_register_parameter_standard -lPs4_base_assembler_system_call_standard
|
||||
|
||||
LIBS := $(WHOLE_START) -lretro_orbis $(WHOLE_END) $(PS4_LIBS)
|
||||
|
||||
TARGETS := $(TARGET).elf
|
||||
|
||||
DEPFLAGS = -MT $@ -MMD -MP -MF $*.Tdepend
|
||||
POSTCOMPILE = mv -f $*.Tdepend $*.depend
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
%.o: %.cpp
|
||||
%.o: %.cpp %.depend
|
||||
$(CXX) -c -o $@ $< $(CXXFLAGS) $(INCDIRS) $(DEPFLAGS)
|
||||
$(POSTCOMPILE)
|
||||
|
||||
%.o: %.c
|
||||
%.o: %.c %.depend
|
||||
$(CC) -c -o $@ $< $(CFLAGS) $(INCDIRS) $(DEPFLAGS)
|
||||
$(POSTCOMPILE)
|
||||
|
||||
%.o: %.S
|
||||
%.o: %.S %.depend
|
||||
$(CC) -c -o $@ $< $(ASFLAGS) $(INCDIRS) $(DEPFLAGS)
|
||||
$(POSTCOMPILE)
|
||||
|
||||
%.o: %.s
|
||||
%.o: %.s %.depend
|
||||
$(CC) -c -o $@ $< $(ASFLAGS) $(INCDIRS) $(DEPFLAGS)
|
||||
$(POSTCOMPILE)
|
||||
|
||||
%.depend: ;
|
||||
|
||||
$(TARGET).elf: $(OBJ) libretro_orbis.a
|
||||
$(LD) $(CRTFILE) $(OBJ) $(LDFLAGS) $(LIBDIRS) $(LIBS) -o $@
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ) $(TARGET).elf
|
||||
rm -f $(OBJ:.o=.depend)
|
||||
|
||||
.PHONY: clean all
|
||||
.PRECIOUS: %.depend
|
||||
|
||||
-include $(OBJ:.o=.depend)
|
||||
+2
-1
@@ -36,7 +36,7 @@ retroarch.pnd: install
|
||||
pnd_make -c -p retroarch.pnd -d $(PNDDIR)/ -x $(PNDDIR)/PXML.xml -i $(PNDDIR)/icon.png
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
rm -f *.o
|
||||
rm -f audio/*.o
|
||||
rm -f conf/*.o
|
||||
rm -f gfx/*.o
|
||||
@@ -52,3 +52,4 @@ clean:
|
||||
rm -f $(BINDIR)/retroarch-joyconfig
|
||||
rm -f $(PNDDIR)/readme.html
|
||||
rm -f retroarch
|
||||
|
||||
-123
@@ -1,123 +0,0 @@
|
||||
BUILD_FOR_PCSX2 = 0
|
||||
DEBUG = 0
|
||||
HAVE_KERNEL_PRX = 0
|
||||
HAVE_LOGGER = 0
|
||||
HAVE_FILE_LOGGER = 0
|
||||
HAVE_THREADS = 0
|
||||
BIG_STACK = 0
|
||||
MUTE_WARNINGS = 1
|
||||
PS2_IP = 192.168.1.150
|
||||
|
||||
TARGET = retroarchps2.elf
|
||||
TARGET_RELEASE = retroarchps2-release.elf
|
||||
|
||||
# Lib CDVD
|
||||
CDVD_DIR = ps2/libcdvd
|
||||
|
||||
# Compile the IRXs first
|
||||
IRX_DIR = ps2/irx
|
||||
IRX_FILES = $(wildcard ps2/irx/*.c)
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
OPTIMIZE_LV := -O0 -g
|
||||
RARCH_DEFINES += -DDEBUG
|
||||
else
|
||||
OPTIMIZE_LV := -O2
|
||||
LDFLAGS := -s
|
||||
endif
|
||||
|
||||
ifeq ($(MUTE_WARNINGS), 1)
|
||||
DISABLE_WARNINGS := -Wno-sign-compare -Wno-unused -Wno-parentheses
|
||||
endif
|
||||
|
||||
INCDIR = -I$(PS2DEV)/gsKit/include -I$(PS2SDK)/ports/include -I$(CDVD_DIR)/ee
|
||||
INCDIR += -Ips2 -Ips2/include -Ilibretro-common/include -Ideps -Ideps/stb -Ideps/7zip
|
||||
INCDIR += -Ideps/pthreads -Ideps/pthreads/platform/ps2 -Ideps/pthreads/platform/helper
|
||||
GPVAL = -G0
|
||||
CFLAGS = $(OPTIMIZE_LV) $(DISABLE_WARNINGS) -ffast-math -fsingle-precision-constant
|
||||
ASFLAGS = $(CFLAGS)
|
||||
|
||||
RARCH_DEFINES += -DPS2 -DUSE_IOP_CTYPE_MACRO -D_MIPS_ARCH_R5900 -DHAVE_ZLIB -DHAVE_NO_BUILTINZLIB -DHAVE_RPNG -DHAVE_RJPEG
|
||||
RARCH_DEFINES += -DHAVE_GRIFFIN=1 -DRARCH_INTERNAL -DRARCH_CONSOLE -DHAVE_MENU -DHAVE_CONFIGFILE -DHAVE_RGUI -DHAVE_FILTERS_BUILTIN -DHAVE_7ZIP -DHAVE_CC_RESAMPLER
|
||||
|
||||
LIBDIR =
|
||||
LDFLAGS += -L$(PS2SDK)/ports/lib -L$(PS2DEV)/gsKit/lib -L$(PS2SDK)/ee/lib -L$(CDVD_DIR)/lib -L.
|
||||
LIBS += -lretro_ps2 -lgskit -ldmakit -lgskit_toolkit -laudsrv -lmf -lpadx -lmtap -lmc -lhdd -lsdl -lfileXio -lz
|
||||
LIBS += -lcdvdfs -lpatches -lpoweroff
|
||||
|
||||
ifeq ($(BUILD_FOR_PCSX2), 1)
|
||||
RARCH_DEFINES += -DBUILD_FOR_PCSX2
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_THREADS), 1)
|
||||
RARCH_DEFINES += -DHAVE_THREADS
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_FILE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_FILE_LOGGER
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_KERNEL_PRX), 1)
|
||||
CFLAGS += -DHAVE_KERNEL_PRX
|
||||
endif
|
||||
|
||||
ifeq ($(BIG_STACK), 1)
|
||||
CFLAGS += -DBIG_STACK
|
||||
endif
|
||||
|
||||
CFLAGS += $(RARCH_DEFINES)
|
||||
|
||||
# All the IRX objects
|
||||
EE_OBJS += $(IRX_DIR)/freemtap_irx.o $(IRX_DIR)/freepad_irx.o $(IRX_DIR)/freesio2_irx.o $(IRX_DIR)/iomanX_irx.o
|
||||
EE_OBJS += $(IRX_DIR)/fileXio_irx.o $(IRX_DIR)/mcman_irx.o $(IRX_DIR)/mcserv_irx.o $(IRX_DIR)/usbd_irx.o
|
||||
EE_OBJS += $(IRX_DIR)/usbhdfsd_irx.o $(IRX_DIR)/freesd_irx.o $(IRX_DIR)/audsrv_irx.o $(IRX_DIR)/poweroff_irx.o
|
||||
EE_OBJS += $(IRX_DIR)/cdvd_irx.o
|
||||
|
||||
# Missing objecst on the PS2SDK
|
||||
EE_OBJS += ps2/compat_files/compat_ctype.o ps2/compat_files/time.o ps2/compat_files/ps2_devices.o
|
||||
EE_OBJS += ps2/compat_files/fileXio_cdvd.o ps2/compat_files/ps2_descriptor.o
|
||||
|
||||
#EE_OBJS = griffin/griffin.o bootstrap/ps2/kernel_functions.o
|
||||
EE_OBJS += griffin/griffin.o
|
||||
|
||||
EE_CFLAGS = $(CFLAGS)
|
||||
EE_CXXFLAGS = $(CFLAGS)
|
||||
EE_LDFLAGS = $(LDFLAGS)
|
||||
EE_LIBS = $(LIBS)
|
||||
EE_ASFLAGS = $(ASFLAGS)
|
||||
EE_INCS = $(INCDIR)
|
||||
EE_BIN = $(TARGET)
|
||||
EE_GPVAL = $(GPVAL)
|
||||
|
||||
|
||||
all: irxdir $(EE_BIN)
|
||||
|
||||
irxdir:
|
||||
$(MAKE) -C $(IRX_DIR)
|
||||
|
||||
clean:
|
||||
rm -f $(EE_BIN) $(EE_OBJS)
|
||||
$(MAKE) -C $(IRX_DIR) clean
|
||||
|
||||
prepare:
|
||||
ps2client -h $(PS2_IP) reset
|
||||
ps2client -h $(PS2_IP) netdump
|
||||
|
||||
run:
|
||||
ps2client -h $(PS2_IP) execee host:$(EE_BIN)
|
||||
|
||||
debug: clean prepare all run
|
||||
|
||||
package:
|
||||
ps2-packer $(EE_BIN) $(TARGET_RELEASE)
|
||||
|
||||
release: clean all package
|
||||
|
||||
#Include preferences
|
||||
include $(PS2SDK)/samples/Makefile.pref
|
||||
include $(PS2SDK)/samples/Makefile.eeglobal
|
||||
|
||||
#Linking with C++
|
||||
$(EE_BIN): $(EE_OBJS) $(PS2SDK)/ee/startup/crt0.o
|
||||
$(EE_CXX) $(EE_NO_CRT) -T$(PS2SDK)/ee/startup/linkfile $(EE_CXXFLAGS) \
|
||||
-o $(EE_BIN) $(PS2SDK)/ee/startup/crt0.o $(CRTI_OBJ) $(CRTBEGIN_OBJ) $(EE_OBJS) $(CRTEND_OBJ) $(CRTN_OBJ) $(EE_LDFLAGS) $(EE_LIBS)
|
||||
+21
-34
@@ -1,10 +1,10 @@
|
||||
include version.all
|
||||
RARCH_VERSION = "0.9.9.3"
|
||||
|
||||
#which compiler to build with - GCC or SNC
|
||||
#set to GCC for debug builds for use with debugger
|
||||
CELL_BUILD_TOOLS = SNC
|
||||
CELL_GPU_TYPE = RSX
|
||||
CELL_PSGL_VERSION = opt
|
||||
CELL_PSGL_VERSION = ultra-opt
|
||||
|
||||
ASSETS_DIR := media/assets
|
||||
|
||||
@@ -15,6 +15,7 @@ DEBUG = 0
|
||||
HAVE_GCMGL = 0
|
||||
HAVE_LOGGER = 0
|
||||
HAVE_FREETYPE = 0
|
||||
HAVE_RLAUNCH = 0
|
||||
WHOLE_ARCHIVE_LINK = 0
|
||||
|
||||
CONTENT_ID_FULL = UP0001-SSNE10000_00-0000000000000001
|
||||
@@ -33,13 +34,7 @@ EBOOT_PATH = pkg/ps3/USRDIR/EBOOT.BIN
|
||||
CORE_PATH = pkg/ps3/USRDIR/cores/CORE.SELF
|
||||
|
||||
LDDIRS = -L. -L$(CELL_SDK)/target/ppu/lib/PSGL/RSX/ultra-opt
|
||||
INCDIRS = -I. \
|
||||
-Idefines \
|
||||
-Ideps \
|
||||
-Ideps/stb \
|
||||
-Ideps/rcheevos/include \
|
||||
-Ilibretro-common/include \
|
||||
-Ilibretro-common/include/compat/zlib
|
||||
INCDIRS = -I. -Idefines -Ideps/zlib -Ilibretro-common/include
|
||||
|
||||
# system platform
|
||||
system_platform = unix
|
||||
@@ -69,21 +64,11 @@ endif
|
||||
|
||||
PPU_SRCS = griffin/griffin.c
|
||||
|
||||
DEFINES += -DHAVE_VIDEO_LAYOUT
|
||||
DEFINES += -DHAVE_MENU -DHAVE_CONFIGFILE -DHAVE_GFX_WIDGETS -DHAVE_RGUI -DHAVE_XMB -DHAVE_OZONE -DHAVE_LIBRETRODB -DHAVE_MATERIALUI -DHAVE_SHADERPIPELINE -DRARCH_INTERNAL -DMSB_FIRST -DHAVE_OVERLAY -DHAVE_CC_RESAMPLER -DHAVE_STB_VORBIS -DHAVE_STB_FONT -DHAVE_RUNAHEAD -DHAVE_DR_MP3 -DHAVE_DR_FLAC
|
||||
DEFINES += -DHAVE_ONLINE_UPDATER -DHAVE_UPDATE_ASSETS -DHAVE_UPDATE_CORES
|
||||
|
||||
ifeq ($(DEX_BUILD), 1)
|
||||
DEFINES += -DDEX_BUILD
|
||||
ifeq ($(HAVE_RLAUNCH), 1)
|
||||
DEFINES += -DHAVE_RLAUNCH
|
||||
endif
|
||||
|
||||
ifeq ($(CEX_BUILD), 1)
|
||||
DEFINES += -DCEX_BUILD
|
||||
endif
|
||||
|
||||
ifeq ($(ODE_BUILD), 1)
|
||||
DEFINES += -DODE_BUILD
|
||||
endif
|
||||
DEFINES += -DHAVE_MENU -DHAVE_RGUI -DRARCH_INTERNAL -DMSB_FIRST -DHAVE_OVERLAY
|
||||
|
||||
ifeq ($(HAVE_GCMGL), 1)
|
||||
DEFINES += -DHAVE_GCMGL
|
||||
@@ -95,13 +80,17 @@ endif
|
||||
ifeq ($(HAVE_FREETYPE), 1)
|
||||
DEFINES += -DHAVE_FREETYPE
|
||||
FONT_LIBS := -lfontFT_stub -lfreetype_stub
|
||||
else
|
||||
#DEFINES += -DHAVE_LIBDBGFONT
|
||||
#FONT_LIBS := -ldbgfont
|
||||
endif
|
||||
|
||||
ifeq ($(CELL_BUILD_TOOLS), SNC)
|
||||
PPU_CXXLD = $(CELL_SDK)/host-win32/sn/bin/ps3ppuld.exe
|
||||
PPU_CXX = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
|
||||
PPU_CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
|
||||
else ifneq ($(system_platform), win)
|
||||
else
|
||||
ifneq($(system_platform), win)
|
||||
PPU_CXX = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-g++.exe
|
||||
PPU_CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
|
||||
PPU_CXXLD = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ld.exe
|
||||
@@ -117,14 +106,12 @@ PPU_LDLIBS = $(FONT_LIBS) $(GL_LIBS) $(WHOLE_START) -lretro_ps3 $(WHOLE_END) -l
|
||||
|
||||
PPU_RANLIB = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ranlib.exe
|
||||
|
||||
DEFINES += -DHAVE_THREADS -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_HEADSET -DHAVE_LANGEXTRA -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_RSOUND -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DHAVE_7Z -D__CELLOS_LV2__ -DHAVE_NETWORKING=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_MOUSE -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -DHAVE_FILTERS_BUILTIN -DHAVE_CHEEVOS -DRC_DISABLE_LUA
|
||||
|
||||
#DEFINES += -DHAVE_IMAGEVIEWER
|
||||
DEFINES += -DHAVE_THREADS -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_FBO -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_RSOUND -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_7Z -DWANT_ZLIB -DSINC_LOWER_QUALITY -D__CELLOS_LV2__ -DHAVE_NETPLAY=1 -DHAVE_NETWORKING=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_MOUSE -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -DHAVE_FILTERS_BUILTIN -DHAVE_BUILTIN_AUTOCONFIG
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
PPU_OPTIMIZE_LV := -O0 -g
|
||||
else
|
||||
PPU_OPTIMIZE_LV := -O2 -g
|
||||
PPU_OPTIMIZE_LV := -O3 -g
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_LOGGER), 1)
|
||||
@@ -164,7 +151,7 @@ create-core:
|
||||
|
||||
create-npdrm-salamander:
|
||||
$(MAKE_FSELF_NPDRM) $(SALAMANDER_TARGET) $(EBOOT_PATH)
|
||||
|
||||
|
||||
create-salamander:
|
||||
$(MAKE_SELF) $(SALAMANDER_TARGET) $(EBOOT_PATH) $(CONTENT_ID_FULL)
|
||||
|
||||
@@ -179,20 +166,20 @@ pkg: $(PPU_TARGET) create-shaders copy-media-files create-npdrm-salamander crea
|
||||
$(MAKE_PACKAGE_NPDRM) pkg/ps3/package.conf pkg/ps3
|
||||
|
||||
pkg-signed: $(PPU_TARGET) create-shaders copy-media-files create-salamander create-core
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
|
||||
pkg-signed-standalone: $(PPU_TARGET) create-shaders copy-media-files create-core
|
||||
$(MAKE_SELF) $(PPU_TARGET) $(EBOOT_PATH) $(CONTENT_ID)
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
|
||||
pkg-signed-cfw: $(PPU_TARGET) create-shaders copy-media-files create-salamander create-core
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
|
||||
|
||||
pkg-signed-cfw-standalone: $(PPU_TARGET) create-shaders copy-media-files create-core
|
||||
$(MAKE_SELF) $(PPU_TARGET) $(EBOOT_PATH) $(CONTENT_ID)
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
|
||||
|
||||
clean-selfs:
|
||||
ifeq ($(EBOOT_EXISTS),1)
|
||||
|
||||
+21
-25
@@ -1,8 +1,8 @@
|
||||
include version.all
|
||||
RARCH_VERSION = "0.9.9.3"
|
||||
|
||||
#which compiler to build with - GCC or SNC
|
||||
#set to GCC for debug builds for use with debugger
|
||||
CELL_BUILD_TOOLS = GCC
|
||||
CELL_BUILD_TOOLS = SNC
|
||||
CELL_GPU_TYPE = RSX
|
||||
CELL_PSGL_VERSION = ultra-opt
|
||||
|
||||
@@ -13,6 +13,7 @@ DEBUG = 0
|
||||
HAVE_GCMGL = 1
|
||||
HAVE_LOGGER = 0
|
||||
HAVE_FREETYPE = 0
|
||||
HAVE_RLAUNCH = 0
|
||||
WHOLE_ARCHIVE_LINK = 0
|
||||
|
||||
CONTENT_ID_FULL = UP0001-SSNE10000_00-0000000000000001
|
||||
@@ -31,7 +32,7 @@ EBOOT_PATH = pkg/ps3/USRDIR/EBOOT.BIN
|
||||
CORE_PATH = pkg/ps3/USRDIR/cores/CORE.SELF
|
||||
|
||||
LDDIRS = -L. -L$(CELL_SDK)/target/ppu/lib/PSGL/RSX/ultra-opt
|
||||
INCDIRS = -I. -Idefines -Ideps -Ideps/stb
|
||||
INCDIRS = -I. -Idefines
|
||||
|
||||
# system platform
|
||||
system_platform = unix
|
||||
@@ -61,20 +62,12 @@ endif
|
||||
|
||||
PPU_SRCS = griffin/griffin.c
|
||||
|
||||
ifeq ($(HAVE_RLAUNCH), 1)
|
||||
DEFINES += -DHAVE_RLAUNCH
|
||||
endif
|
||||
|
||||
DEFINES += -DHAVE_RGUI -DHAVE_MATERIALUI -DHAVE_XMB -DHAVE_MENU -DRARCH_INTERNAL
|
||||
|
||||
ifeq ($(DEX_BUILD), 1)
|
||||
DEFINES += -DDEX_BUILD
|
||||
endif
|
||||
|
||||
ifeq ($(CEX_BUILD), 1)
|
||||
DEFINES += -DCEX_BUILD
|
||||
endif
|
||||
|
||||
ifeq ($(ODE_BUILD), 1)
|
||||
DEFINES += -DODE_BUILD
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_GCMGL), 1)
|
||||
DEFINES += -DHAVE_GCMGL
|
||||
GL_LIBS := -L. -lrgl_ps3
|
||||
@@ -85,13 +78,17 @@ endif
|
||||
ifeq ($(HAVE_FREETYPE), 1)
|
||||
DEFINES += -DHAVE_FREETYPE
|
||||
FONT_LIBS := -lfontFT_stub -lfreetype_stub
|
||||
else
|
||||
DEFINES += -DHAVE_LIBDBGFONT
|
||||
FONT_LIBS := -ldbgfont
|
||||
endif
|
||||
|
||||
ifeq ($(CELL_BUILD_TOOLS), SNC)
|
||||
PPU_CXXLD = $(CELL_SDK)/host-win32/sn/bin/ps3ppuld.exe
|
||||
PPU_CXX = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
|
||||
PPU_CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
|
||||
else ifneq($(system_platform), win)
|
||||
else
|
||||
ifneq($(system_platform), win)
|
||||
PPU_CXX = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-g++.exe
|
||||
PPU_CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
|
||||
PPU_CXXLD = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ld.exe
|
||||
@@ -107,8 +104,7 @@ PPU_LDLIBS = $(FONT_LIBS) $(GL_LIBS) $(WHOLE_START) -lretro_ps3 $(WHOLE_END) -l
|
||||
|
||||
PPU_RANLIB = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ranlib.exe
|
||||
|
||||
#DEFINES += -DHAVE_VIDEO_LAYOUT
|
||||
DEFINES += -DHAVE_THREADS -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_RSOUND -DHAVE_ZLIB -DHAVE_RPNG -D__CELLOS_LV2__ -DHAVE_NETWORKING=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_MOUSE -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=0 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -DHAVE_STB_VORBIS
|
||||
DEFINES += -DHAVE_THREADS -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_FBO -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_RSOUND -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -DSINC_LOWER_QUALITY -D__CELLOS_LV2__ -DHAVE_NETPLAY=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_MOUSE -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=0 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
PPU_OPTIMIZE_LV := -O0 -g
|
||||
@@ -153,7 +149,7 @@ create-core:
|
||||
|
||||
create-npdrm-salamander:
|
||||
$(MAKE_FSELF_NPDRM) $(SALAMANDER_TARGET) $(EBOOT_PATH)
|
||||
|
||||
|
||||
create-salamander:
|
||||
$(MAKE_SELF) $(SALAMANDER_TARGET) $(EBOOT_PATH) $(CONTENT_ID_FULL)
|
||||
|
||||
@@ -168,20 +164,20 @@ pkg: $(PPU_TARGET) create-shaders copy-media-files create-npdrm-salamander crea
|
||||
$(MAKE_PACKAGE_NPDRM) pkg/ps3/package.conf pkg/ps3
|
||||
|
||||
pkg-signed: $(PPU_TARGET) create-shaders copy-media-files create-salamander create-core
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
|
||||
pkg-signed-standalone: $(PPU_TARGET) create-shaders copy-media-files create-core
|
||||
$(MAKE_SELF) $(PPU_TARGET) $(EBOOT_PATH) $(CONTENT_ID)
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
|
||||
pkg-signed-cfw: $(PPU_TARGET) create-shaders copy-media-files create-salamander create-core
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
|
||||
|
||||
pkg-signed-cfw-standalone: $(PPU_TARGET) create-shaders copy-media-files create-core
|
||||
$(MAKE_SELF) $(PPU_TARGET) $(EBOOT_PATH) $(CONTENT_ID)
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
|
||||
|
||||
clean-selfs:
|
||||
ifeq ($(EBOOT_EXISTS),1)
|
||||
|
||||
+64
-91
@@ -1,91 +1,64 @@
|
||||
CELL_BUILD_TOOLS = GCC
|
||||
CELL_SDK ?= /usr/local/cell
|
||||
HAVE_LOGGER = 0
|
||||
CELL_MK_DIR ?= $(CELL_SDK)/samples/mk
|
||||
|
||||
include $(CELL_MK_DIR)/sdk.makedef.mk
|
||||
|
||||
# system platform
|
||||
system_platform = unix
|
||||
ifeq ($(shell uname -a),)
|
||||
EXE_EXT = .exe
|
||||
system_platform = win
|
||||
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
||||
system_platform = osx
|
||||
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
||||
system_platform = win
|
||||
endif
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
PPU_OPTIMIZE_LV := -O0 -g
|
||||
else
|
||||
PPU_OPTIMIZE_LV := -O2 -DNDEBUG
|
||||
endif
|
||||
|
||||
STRIP = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-strip.exe
|
||||
|
||||
INCFLAGS = -I. -Idefines -Ilibretro-common/include -Ilibretro-common/include/compat/zlib
|
||||
DEFINES = -D__CELLOS_LV2__ -DIS_SALAMANDER -DRARCH_CONSOLE -DHAVE_SYSUTILS -DHAVE_SYSMODULES -DHAVE_RARCH_EXEC
|
||||
|
||||
ifeq ($(DEX_BUILD), 1)
|
||||
DEFINES += -DDEX_BUILD
|
||||
endif
|
||||
|
||||
ifeq ($(CEX_BUILD), 1)
|
||||
DEFINES += -DCEX_BUILD
|
||||
endif
|
||||
|
||||
ifeq ($(ODE_BUILD), 1)
|
||||
DEFINES += -DODE_BUILD
|
||||
endif
|
||||
|
||||
PPU_CFLAGS := $(PPU_OPTIMIZE_LV) $(INCFLAGS) $(DEFINES)
|
||||
PPU_CXXFLAGS := $(PPU_OPTIMIZE_LV) $(INCFLAGS) $(DEFINES)
|
||||
|
||||
PPU_SRCS = frontend/frontend_salamander.c \
|
||||
frontend/frontend_driver.c \
|
||||
frontend/drivers/platform_ps3.c \
|
||||
libretro-common/file/file_path.c \
|
||||
libretro-common/file/file_path_io.c \
|
||||
libretro-common/lists/dir_list.c \
|
||||
libretro-common/lists/string_list.c \
|
||||
libretro-common/file/retro_dirent.c \
|
||||
libretro-common/hash/rhash.c \
|
||||
libretro-common/string/stdstring.c \
|
||||
libretro-common/encodings/encoding_utf.c \
|
||||
libretro-common/compat/compat_strl.c \
|
||||
libretro-common/compat/compat_strcasestr.c \
|
||||
libretro-common/compat/fopen_utf8.c \
|
||||
libretro-common/streams/file_stream.c \
|
||||
libretro-common/vfs/vfs_implementation.c \
|
||||
libretro-common/file/config_file.c \
|
||||
file_path_str.c \
|
||||
verbosity.c
|
||||
|
||||
ifeq ($(HAVE_LOGGER), 1)
|
||||
PPU_CFLAGS += -DHAVE_LOGGER
|
||||
PPU_SRCS += network/net_logger.c \
|
||||
libretro-common/net/net_compat.c \
|
||||
libretro-common/net/net_socket.c
|
||||
endif
|
||||
|
||||
PPU_TARGET = retroarch-salamander_ps3.elf
|
||||
|
||||
ifeq ($(CELL_BUILD_TOOLS),SNC)
|
||||
PPU_CFLAGS += -Xbranchless=1 -Xfastmath=1 -Xassumecorrectsign=1 -Xassumecorrectalignment=1 -Xunroll=1 -Xautovecreg=1
|
||||
PPU_CXXFLAGS += -Xbranchless=1 -Xfastmath=1 -Xassumecorrectsign=1 -Xassumecorrectalignment=1 -Xunroll=1 -Xautovecreg=1
|
||||
PPU_CXXLD = $(CELL_SDK)/host-win32/sn/bin/ps3ppuld.exe
|
||||
PPU_CLD = $(CELL_SDK)/host-win32/sn/bin/ps3ppuld.exe
|
||||
PPU_CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
|
||||
else
|
||||
PPU_CFLAGS += -std=gnu99
|
||||
PPU_CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
|
||||
PPU_CLD = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ld.exe
|
||||
PPU_CXXLD = $(CELL_SDK)/host-win32/sn/bin/ps3ppuld.exe
|
||||
endif
|
||||
|
||||
PPU_LDLIBS += -lm -lnet_stub -lnetctl_stub -lio_stub -lsysmodule_stub -lsysutil_stub -lsysutil_game_stub -lfs_stub -lsysutil_np_stub
|
||||
|
||||
MAKE_FSELF = $(CELL_SDK)/host-win32/bin/make_fself.exe
|
||||
|
||||
include $(CELL_MK_DIR)/sdk.target.mk
|
||||
CELL_BUILD_TOOLS = SNC
|
||||
CELL_SDK ?= /usr/local/cell
|
||||
HAVE_LOGGER = 0
|
||||
CELL_MK_DIR ?= $(CELL_SDK)/samples/mk
|
||||
|
||||
include $(CELL_MK_DIR)/sdk.makedef.mk
|
||||
|
||||
# system platform
|
||||
system_platform = unix
|
||||
ifeq ($(shell uname -a),)
|
||||
EXE_EXT = .exe
|
||||
system_platform = win
|
||||
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
||||
system_platform = osx
|
||||
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
||||
system_platform = win
|
||||
endif
|
||||
|
||||
STRIP = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-strip.exe
|
||||
|
||||
PPU_CFLAGS += -I. -Ilibretro-common/include -Ideps/zlib -D__CELLOS_LV2__ -DIS_SALAMANDER -DRARCH_CONSOLE -DHAVE_SYSUTILS -DHAVE_SYSMODULES -DHAVE_RARCH_EXEC
|
||||
PPU_SRCS = frontend/frontend_salamander.c \
|
||||
frontend/frontend_driver.c \
|
||||
frontend/drivers/platform_ps3.c \
|
||||
frontend/drivers/platform_null.c \
|
||||
libretro-common/file/file_path.c \
|
||||
libretro-common/file/dir_list.c \
|
||||
libretro-common/file/retro_dirent.c \
|
||||
libretro-common/file/retro_stat.c \
|
||||
libretro-common/hash/rhash.c \
|
||||
libretro-common/string/stdstring.c \
|
||||
libretro-common/string/string_list.c \
|
||||
libretro-common/compat/compat_strl.c \
|
||||
libretro-common/file/retro_file.c \
|
||||
libretro-common/file/config_file.c \
|
||||
verbosity.c
|
||||
|
||||
ifeq ($(HAVE_LOGGER), 1)
|
||||
PPU_CFLAGS += -DHAVE_LOGGER
|
||||
PPU_SRCS += netlogger.c
|
||||
endif
|
||||
|
||||
PPU_TARGET = retroarch-salamander_ps3.elf
|
||||
|
||||
ifeq ($(CELL_BUILD_TOOLS),SNC)
|
||||
PPU_CFLAGS += -Xbranchless=1 -Xfastmath=1 -Xassumecorrectsign=1 -Xassumecorrectalignment=1 -Xunroll=1 -Xautovecreg=1
|
||||
PPU_CXXFLAGS += -Xbranchless=1 -Xfastmath=1 -Xassumecorrectsign=1 -Xassumecorrectalignment=1 -Xunroll=1 -Xautovecreg=1
|
||||
PPU_CXXLD = $(CELL_SDK)/host-win32/sn/bin/ps3ppuld.exe
|
||||
PPU_CLD = $(CELL_SDK)/host-win32/sn/bin/ps3ppuld.exe
|
||||
PPU_CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
|
||||
else
|
||||
PPU_CFLAGS += -std=gnu99
|
||||
PPU_CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
|
||||
PPU_CLD = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ld.exe
|
||||
PPU_CXXLD = $(CELL_SDK)/host-win32/sn/bin/ps3ppuld.exe
|
||||
endif
|
||||
|
||||
PPU_LDLIBS += -lm -lnet_stub -lnetctl_stub -lio_stub -lsysmodule_stub -lsysutil_stub -lsysutil_game_stub -lfs_stub -lsysutil_np_stub
|
||||
|
||||
PPU_OPTIMIZE_LV := -O2
|
||||
|
||||
MAKE_FSELF = $(CELL_SDK)/host-win32/bin/make_fself.exe
|
||||
|
||||
include $(CELL_MK_DIR)/sdk.target.mk
|
||||
+70
-35
@@ -1,39 +1,29 @@
|
||||
#-------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#-------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#-------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(PSL1GHT)),)
|
||||
$(error "Please set PSL1GHT in your environment. export PSL1GHT=<path>")
|
||||
endif
|
||||
|
||||
include $(PSL1GHT)/ppu_rules
|
||||
|
||||
include version.all
|
||||
RARCH_VERSION = "0.9.9.3"
|
||||
|
||||
DEBUG = 0
|
||||
HAVE_LOGGER = 0
|
||||
HAVE_FILE_LOGGER = 1
|
||||
HAVE_FILE_LOGGER = 0
|
||||
|
||||
PC_DEVELOPMENT_IP_ADDRESS = "192.168.1.7"
|
||||
PC_DEVELOPMENT_UDP_PORT = 3490
|
||||
|
||||
CONTENTID = UP0001-SSNE10001_00-0000000000000001
|
||||
APPID = SSNE10001
|
||||
TITLE = Retroarch PSL1GHT
|
||||
PACKAGE_BASENAME := retroarch_psl1ght
|
||||
CC = $(PS3DEV)/ppu/bin/ppu-gcc
|
||||
CXX = $(PS3DEV)/ppu/bin/ppu-g++
|
||||
LD = $(PS3DEV)/ppu/bin/ppu-ld
|
||||
|
||||
CONTENT_ID_FULL = UP0001-SSNE10000_00-0000000000000001
|
||||
|
||||
ELF_TARGET := retroarch_psl1ght.elf
|
||||
SELF_TARGET := $(ELF_TARGET:.elf=.self)
|
||||
CORE_PATH = pkg/psl1ght/pkg/USRDIR/cores/CORE.SELF
|
||||
EBOOT_PATH = pkg/ps3/USRDIR/EBOOT.BIN
|
||||
CORE_PATH = pkg/ps3/USRDIR/cores/CORE.SELF
|
||||
|
||||
INCLUDE += -I. -Ips3/gcmgl/include/export -Ips3/include -Ideps -Ideps/stb -Ilibretro-common/include/compat/zlib -Ilibretro-common/include $(LIBPSL1GHT_INC) -Iinclude
|
||||
LIBDIRS += -L.
|
||||
INCLUDE := -I. -I$(PS3DEV)/ppu/include -Ideps/zlib -Ips3/gcmgl/include/export -Ips3/include
|
||||
LIBDIRS := -L$(PS3DEV)/ppu/lib -L$(PS3DEV)/portlibs/ppu/lib -L.
|
||||
|
||||
MACHDEP := -D__CELLOS_LV2__ -D__PSL1GHT__ -mcpu=cell
|
||||
MACHDEP := -D__CELLOS_LV2__ -D__PSL1GHT__
|
||||
CFLAGS += -Wall $(MACHDEP) $(INCLUDE)
|
||||
LDFLAGS := $(MACHDEP)
|
||||
LIBS := -lretro_psl1ght -laudio -lrsx -lgcm_sys -lnet -lio -lsysutil -lsysmodule -lm -ljpgdec -lpngdec -llv2 -lnet -lnetctl
|
||||
LIBS := -lrgl_ps3 -lretro_psl1ght -laudio -lrsx -lgcm_sys -lnet -lio -lsysutil -lsysmodule -lm -ljpgdec -lpngdec -llv2 -lnet -lnetctl
|
||||
|
||||
# system platform
|
||||
system_platform = unix
|
||||
@@ -48,50 +38,95 @@ endif
|
||||
|
||||
PKG_SCRIPT = tools/ps3/ps3py/pkg.py
|
||||
ifeq ($(shell uname), Linux)
|
||||
PKG_FINALIZE = package_finalize
|
||||
MAKE_SELF_WC = make_self_wc
|
||||
MAKE_SELF = make_self_npdrm
|
||||
PYTHON2 = python2
|
||||
GIT = git
|
||||
else
|
||||
PKG_FINALIZE = package_finalize.exe
|
||||
MAKE_SELF_WC = make_self_wc.exe
|
||||
MAKE_SELF = make_self_npdrm.exe
|
||||
PYTHON2 = python2.exe
|
||||
GIT = git.exe
|
||||
endif
|
||||
# system platform
|
||||
system_platform = unix
|
||||
ifeq ($(shell uname -a),)
|
||||
EXE_EXT = .exe
|
||||
system_platform = win
|
||||
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
||||
system_platform = osx
|
||||
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
||||
system_platform = win
|
||||
endif
|
||||
|
||||
PKG_SCRIPT = tools/ps3/ps3py/pkg.py
|
||||
ifeq ($(shell uname), Linux)
|
||||
PKG_FINALIZE = package_finalize
|
||||
MAKE_SELF_WC = make_self_wc
|
||||
MAKE_SELF = make_self_npdrm
|
||||
PYTHON2 = python2
|
||||
GIT = git
|
||||
else
|
||||
PKG_FINALIZE = package_finalize.exe
|
||||
MAKE_SELF_WC = make_self_wc.exe
|
||||
MAKE_SELF = make_self_npdrm.exe
|
||||
PYTHON2 = python2.exe
|
||||
GIT = git.exe
|
||||
endif
|
||||
|
||||
MAKE_FSELF_NPDRM = $(CELL_SDK)/host-win32/bin/make_fself_npdrm.exe
|
||||
MAKE_PACKAGE_NPDRM = $(CELL_SDK)/host-win32/bin/make_package_npdrm.exe
|
||||
|
||||
OBJ = griffin/griffin.o
|
||||
|
||||
ifeq ($(HAVE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_LOGGER
|
||||
CFLAGS += -Ilogger/netlogger
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_FILE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_FILE_LOGGER
|
||||
endif
|
||||
|
||||
SHARED_FLAGS :=
|
||||
|
||||
SHARED_FLAGS += -DHAVE_VIDEO_LAYOUT
|
||||
SHARED_FLAGS += -DHAVE_MENU -DHAVE_CONFIGFILE -DRARCH_CONSOLE -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_GCMGL -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_MOUSE -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_GRIFFIN=1 -DHAVE_NETWORKING=1 -DHAVE_SOCKET_LEGACY=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -Wno-char-subscripts -DHAVE_CC_RESAMPLER -DRARCH_INTERNAL -DHAVE_MULTIMAN -DHAVE_RGUI
|
||||
SHARED_FLAGS := -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_GCMGL -DHAVE_FBO -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_MOUSE -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -DHAVE_GRIFFIN=1 -DHAVE_NETPLAY=1 -DHAVE_SOCKET_LEGACY=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -Wno-char-subscripts
|
||||
CFLAGS += -std=gnu99 $(SHARED_FLAGS)
|
||||
CXXFLAGS += $(SHARED_FLAGS)
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -O0 -g
|
||||
else
|
||||
CFLAGS += -O3 -g
|
||||
CFLAGS += -O3 -g
|
||||
CXXFLAGS += -03 -g
|
||||
endif
|
||||
|
||||
all: $(SELF_TARGET)
|
||||
all: $(ELF_TARGET)
|
||||
|
||||
$(ELF_TARGET): $(OBJ)
|
||||
$(CXX) -o $@ $(LDFLAGS) $(LIBDIRS) $(OBJ) $(LIBS)
|
||||
|
||||
create-core: $(SELF_TARGET)
|
||||
cp $(SELF_TARGET) $(CORE_PATH)
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
pkg: create-core
|
||||
$(PKG) --contentid $(CONTENTID) pkg/psl1ght/pkg/ $(PACKAGE_BASENAME).pkg
|
||||
# cp $(PACKAGE_BASENAME).pkg $(PACKAGE_BASENAME).gnpdrm.pkg
|
||||
# $(PACKAGE_FINALIZE) $(PACKAGE_BASENAME).gnpdrm.pkg
|
||||
%.o: %.cpp
|
||||
$(CXX) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
create-npdrm-core:
|
||||
$(MAKE_FSELF_NPDRM) $(ELF_TARGET) $(CORE_PATH)
|
||||
|
||||
create-core:
|
||||
$(MAKE_SELF_WC) $(ELF_TARGET) $(CORE_PATH)
|
||||
|
||||
pkg: $(ELF_TARGET) create-npdrm-core
|
||||
$(MAKE_PACKAGE_NPDRM) pkg/ps3/package.conf ps3/pkg
|
||||
|
||||
pkg-signed: $(ELF_TARGET) create-core
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
|
||||
clean:
|
||||
rm -f $(ELF_TARGET)
|
||||
rm -f $(OBJ)
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
#-------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#-------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#-------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(PSL1GHT)),)
|
||||
$(error "Please set PSL1GHT in your environment. export PSL1GHT=<path>")
|
||||
endif
|
||||
|
||||
include $(PSL1GHT)/ppu_rules
|
||||
|
||||
include version.all
|
||||
|
||||
DEBUG = 0
|
||||
HAVE_LOGGER = 0
|
||||
HAVE_FILE_LOGGER = 1
|
||||
|
||||
PC_DEVELOPMENT_IP_ADDRESS = "192.168.1.7"
|
||||
PC_DEVELOPMENT_UDP_PORT = 3490
|
||||
|
||||
CONTENTID = UP0001-SSNE10001_00-0000000000000001
|
||||
APPID = SSNE10001
|
||||
TITLE = Retroarch PSL1GHT
|
||||
PACKAGE_BASENAME := retroarch_psl1ght
|
||||
|
||||
ELF_TARGET := retroarch_psl1ght_salamander.elf
|
||||
ELF_TARGET_NONSTRIPPED := retroarch_psl1ght_salamander_nonstripped.elf
|
||||
EBOOT_PATH = pkg/psl1ght/pkg/USRDIR/EBOOT.BIN
|
||||
|
||||
INCLUDE += -I. -Ips3/gcmgl/include/export -Ips3/include -Ideps -Ideps/stb -Ilibretro-common/include/compat/zlib -Ilibretro-common/include $(LIBPSL1GHT_INC) -Iinclude
|
||||
LIBDIRS += -L.
|
||||
|
||||
MACHDEP := -D__CELLOS_LV2__ -D__PSL1GHT__ -mcpu=cell -mhard-float -fmodulo-sched -ffunction-sections -fdata-sections
|
||||
CFLAGS += -Wall $(MACHDEP) $(INCLUDE)
|
||||
LDFLAGS := $(MACHDEP)
|
||||
LIBS := -lgcm_sys -lrsx -lsysutil -lio -lnet -lsysmodule -lrt -llv2 -lm
|
||||
|
||||
# system platform
|
||||
system_platform = unix
|
||||
ifeq ($(shell uname -a),)
|
||||
EXE_EXT = .exe
|
||||
system_platform = win
|
||||
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
||||
system_platform = osx
|
||||
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
||||
system_platform = win
|
||||
endif
|
||||
|
||||
PKG_SCRIPT = tools/ps3/ps3py/pkg.py
|
||||
ifeq ($(shell uname), Linux)
|
||||
GIT = git
|
||||
else
|
||||
GIT = git.exe
|
||||
endif
|
||||
|
||||
OBJ = frontend/frontend_salamander.o \
|
||||
frontend/frontend_driver.o \
|
||||
frontend/drivers/platform_ps3.o \
|
||||
libretro-common/file/file_path.o \
|
||||
libretro-common/file/file_path_io.o \
|
||||
libretro-common/lists/dir_list.o \
|
||||
libretro-common/lists/string_list.o \
|
||||
libretro-common/file/retro_dirent.o \
|
||||
libretro-common/hash/rhash.o \
|
||||
libretro-common/string/stdstring.o \
|
||||
libretro-common/encodings/encoding_utf.o \
|
||||
libretro-common/compat/compat_strl.o \
|
||||
libretro-common/compat/compat_strcasestr.o \
|
||||
libretro-common/compat/fopen_utf8.o \
|
||||
libretro-common/streams/file_stream.o \
|
||||
libretro-common/vfs/vfs_implementation.o \
|
||||
libretro-common/file/config_file.o \
|
||||
file_path_str.o \
|
||||
verbosity.o
|
||||
|
||||
ifeq ($(HAVE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_LOGGER
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_FILE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_FILE_LOGGER
|
||||
endif
|
||||
|
||||
SHARED_FLAGS :=
|
||||
|
||||
SHARED_FLAGS += -DHAVE_VIDEO_LAYOUT
|
||||
SHARED_FLAGS += -DHAVE_MENU -DHAVE_CONFIGFILE -DRARCH_CONSOLE -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_GCMGL -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_MOUSE -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_GRIFFIN=1 -DHAVE_NETWORKING=1 -DHAVE_SOCKET_LEGACY=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -Wno-char-subscripts -DHAVE_CC_RESAMPLER -DHAVE_MULTIMAN -DHAVE_RGUI -DIS_SALAMANDER
|
||||
CFLAGS += -std=gnu99 $(SHARED_FLAGS)
|
||||
CXXFLAGS += $(SHARED_FLAGS)
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -O0 -g
|
||||
else
|
||||
CFLAGS += -O3 -g
|
||||
CXXFLAGS += -03 -g
|
||||
endif
|
||||
|
||||
all: create-salamander
|
||||
|
||||
$(ELF_TARGET_NONSTRIPPED): $(OBJ)
|
||||
$(CXX) -o $@ $(LDFLAGS) $(LIBDIRS) $(OBJ) $(LIBS)
|
||||
|
||||
$(ELF_TARGET): $(ELF_TARGET_NONSTRIPPED)
|
||||
$(STRIP) $< -o $@
|
||||
$(SPRX) $@
|
||||
|
||||
create-salamander: $(ELF_TARGET)
|
||||
$(SELF_NPDRM) $(ELF_TARGET) $(EBOOT_PATH) $(CONTENTID)
|
||||
|
||||
pkg: create-salamander
|
||||
$(PKG) --contentid $(CONTENTID) pkg/psl1ght/pkg/ $(PACKAGE_BASENAME).pkg
|
||||
# cp $(PACKAGE_BASENAME).pkg $(PACKAGE_BASENAME).gnpdrm.pkg
|
||||
# $(PACKAGE_FINALIZE) $(PACKAGE_BASENAME).gnpdrm.pkg
|
||||
|
||||
clean:
|
||||
rm -f $(ELF_TARGET)
|
||||
rm -f $(OBJ)
|
||||
|
||||
.PHONY: clean
|
||||
+7
-23
@@ -1,10 +1,8 @@
|
||||
BUILD_PRX = 0
|
||||
PSP_LARGE_MEMORY = 1
|
||||
BUILD_PRX = 1
|
||||
DEBUG = 0
|
||||
HAVE_KERNEL_PRX = 1
|
||||
HAVE_LOGGER = 0
|
||||
HAVE_FILE_LOGGER = 0
|
||||
HAVE_THREADS = 1
|
||||
HAVE_THREADS = 0
|
||||
BIG_STACK = 0
|
||||
WHOLE_ARCHIVE_LINK = 0
|
||||
|
||||
@@ -13,7 +11,7 @@ TARGET = retroarchpsp
|
||||
ifeq ($(DEBUG), 1)
|
||||
OPTIMIZE_LV := -O0 -g
|
||||
else
|
||||
OPTIMIZE_LV := -O3
|
||||
OPTIMIZE_LV := -O3 -g
|
||||
endif
|
||||
|
||||
ifeq ($(WHOLE_ARCHIVE_LINK), 1)
|
||||
@@ -21,11 +19,11 @@ ifeq ($(WHOLE_ARCHIVE_LINK), 1)
|
||||
WHOLE_END := -Wl,--no-whole-archive
|
||||
endif
|
||||
|
||||
INCDIR = deps deps/stb deps/7zip deps/pthreads deps/pthreads/platform/psp deps/pthreads/platform/helper libretro-common/include libretro-common/include/compat/zlib
|
||||
CFLAGS = $(OPTIMIZE_LV) -G0 -std=gnu99 -ffast-math -fsingle-precision-constant
|
||||
INCDIR = deps/zlib deps/7zip libretro-common/include
|
||||
CFLAGS = $(OPTIMIZE_LV) -G0 -std=gnu99 -ffast-math
|
||||
ASFLAGS = $(CFLAGS)
|
||||
|
||||
RARCH_DEFINES = -DPSP -D_MIPS_ARCH_ALLEGREX -DHAVE_LANGEXTRA -DHAVE_ZLIB -DHAVE_AUDIOMIXER -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_GRIFFIN=1 -DRARCH_INTERNAL -DRARCH_CONSOLE -DHAVE_MENU -DHAVE_CONFIGFILE -DHAVE_RGUI -DHAVE_FILTERS_BUILTIN -DHAVE_7ZIP -DHAVE_CC_RESAMPLER
|
||||
RARCH_DEFINES = -DPSP -D_MIPS_ARCH_ALLEGREX -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -DHAVE_GRIFFIN=1 -DRARCH_INTERNAL -DRARCH_CONSOLE -DHAVE_MENU -DHAVE_RGUI -DWANT_RPNG -DSINC_LOWEST_QUALITY -DHAVE_BUILTIN_AUTOCONFIG -DHAVE_FILTERS_BUILTIN -DHAVE_7ZIP
|
||||
|
||||
LIBDIR =
|
||||
LDFLAGS =
|
||||
@@ -49,6 +47,7 @@ endif
|
||||
|
||||
CFLAGS += $(RARCH_DEFINES)
|
||||
|
||||
|
||||
EXTRA_TARGETS = EBOOT.PBP
|
||||
PSP_EBOOT_TITLE = RetroArch PSP1
|
||||
|
||||
@@ -58,18 +57,3 @@ OBJS = $(PSP_OBJECTS)
|
||||
|
||||
PSPSDK=$(shell psp-config --pspsdk-path)
|
||||
include $(PSPSDK)/lib/build.mak
|
||||
|
||||
pspsh-debug:
|
||||
pspsh -e reset
|
||||
read -p "Start debugger in VSCode and press any key to continue... \n" -n1 -s
|
||||
pspsh -e debug ./retroarchpsp.prx
|
||||
pspsh
|
||||
|
||||
pspsh-run:
|
||||
pspsh -e reset
|
||||
pspsh -e ./retroarchpsp.prx
|
||||
pspsh
|
||||
|
||||
debug: clean all pspsh-debug
|
||||
|
||||
run: clean all pspsh-run
|
||||
@@ -1,5 +1,4 @@
|
||||
BUILD_PRX = 0
|
||||
PSP_LARGE_MEMORY = 1
|
||||
BUILD_PRX = 1
|
||||
HAVE_FILE_LOGGER = 0
|
||||
DEBUG = 0
|
||||
|
||||
@@ -8,7 +7,7 @@ TARGET = retroarchpsp_salamander
|
||||
ifeq ($(DEBUG), 1)
|
||||
OPTIMIZE_LV := -O0 -g
|
||||
else
|
||||
OPTIMIZE_LV := -O2
|
||||
OPTIMIZE_LV := -O2 -g
|
||||
endif
|
||||
|
||||
INCDIR = $(PSPPATH)/include libretro-common/include
|
||||
@@ -35,23 +34,19 @@ PSP_EBOOT_PIC1 = pkg/psp1/PIC1.PNG
|
||||
OBJS = frontend/frontend_salamander.o \
|
||||
frontend/frontend_driver.o \
|
||||
frontend/drivers/platform_psp.o \
|
||||
frontend/drivers/platform_null.o \
|
||||
libretro-common/file/file_path.o \
|
||||
libretro-common/file/file_path_io.o \
|
||||
libretro-common/string/stdstring.o \
|
||||
libretro-common/lists/string_list.o \
|
||||
libretro-common/lists/dir_list.o \
|
||||
libretro-common/string/string_list.o \
|
||||
libretro-common/file/dir_list.o \
|
||||
libretro-common/file/retro_dirent.o \
|
||||
libretro-common/encodings/encoding_utf.o \
|
||||
libretro-common/compat/fopen_utf8.o \
|
||||
libretro-common/compat/compat_strl.o \
|
||||
libretro-common/compat/compat_strcasestr.o \
|
||||
libretro-common/file/config_file.o \
|
||||
libretro-common/streams/file_stream.o \
|
||||
libretro-common/vfs/vfs_implementation.o \
|
||||
libretro-common/file/retro_file.o \
|
||||
libretro-common/file/retro_stat.o \
|
||||
libretro-common/hash/rhash.o \
|
||||
file_path_str.o \
|
||||
verbosity.o \
|
||||
bootstrap/psp1/kernel_functions.o
|
||||
bootstrap/psp1/kernel_functions.o
|
||||
|
||||
PSPSDK=$(shell psp-config --pspsdk-path)
|
||||
include $(PSPSDK)/lib/build.mak
|
||||
@@ -1,73 +0,0 @@
|
||||
TARGET := retroarch_switch
|
||||
|
||||
DEBUG ?= 0
|
||||
GRIFFIN_BUILD = 0
|
||||
WHOLE_ARCHIVE_LINK = 0
|
||||
|
||||
OBJ :=
|
||||
|
||||
DEFINES := -DSWITCH=1 -U__linux__ -U__linux -DRARCH_INTERNAL -DHAVE_DYNAMIC
|
||||
|
||||
ifeq ($(GRIFFIN_BUILD), 1)
|
||||
OBJ += griffin/griffin.o
|
||||
DEFINES += -DHAVE_GRIFFIN=1 -DHAVE_NEON -DHAVE_MATERIALUI -DHAVE_LIBRETRODB -DHAVE_CC_RESAMPLER
|
||||
DEFINES += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA
|
||||
DEFINES += -DHAVE_RUNAHEAD -DHAVE_DYNAMIC
|
||||
DEFINES += -DHAVE_CONFIGFILE
|
||||
else
|
||||
HAVE_AUDIOMIXER = 1
|
||||
HAVE_CC_RESAMPLER = 1
|
||||
HAVE_MENU_COMMON = 1
|
||||
HAVE_RTGA = 1
|
||||
HAVE_RPNG = 1
|
||||
HAVE_RJPEG = 1
|
||||
HAVE_RBMP = 1
|
||||
HAVE_RGUI = 1
|
||||
HAVE_ZLIB = 1
|
||||
HAVE_BUILTINZLIB = 1
|
||||
HAVE_LIBRETRODB = 1
|
||||
HAVE_MATERIALUI = 0 # enable later?
|
||||
HAVE_XMB = 0
|
||||
HAVE_STATIC_VIDEO_FILTERS = 1
|
||||
HAVE_STATIC_AUDIO_FILTERS = 1
|
||||
HAVE_MENU = 1
|
||||
HAVE_CONFIGFILE = 1
|
||||
HAVE_RUNAHEAD = 1
|
||||
HAVE_DYNAMIC = 1
|
||||
|
||||
include Makefile.common
|
||||
CFLAGS += $(DEF_FLAGS)
|
||||
BLACKLIST :=
|
||||
BLACKLIST += input/input_overlay.o
|
||||
BLACKLIST += tasks/task_overlay.o
|
||||
OBJ := $(filter-out $(BLACKLIST),$(OBJ))
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(LIBTRANSISTOR_HOME)),)
|
||||
$(error "Please set LIBTRANSISTOR_HOME in your environment. export LIBTRANSISTOR_HOME=<path/to/libtransistor/dist/>")
|
||||
endif
|
||||
|
||||
include $(LIBTRANSISTOR_HOME)/libtransistor.mk
|
||||
|
||||
INCDIRS := -I. -Ideps -Ilibretro-common/include -Ilibretro-common/include/compat/zlib -Ideps/stb -I$(LIBTRANSISTOR_HOME)/build/sdl2_install/include/SDL2/
|
||||
LIBDIRS := -L.
|
||||
|
||||
TARGETS := $(TARGET).nro
|
||||
|
||||
CFLAGS += $(INCDIRS) $(DEFINES) -Wno-unused-command-line-argument -Werror-implicit-function-declaration
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
$(TARGET).nro.so: $(OBJ) libretro_switch.a fs.squashfs.o $(LIBTRANSISTOR_NRO_LIB) $(LIBTRANSISTOR_COMMON_LIBS)
|
||||
$(LD) $(LD_FLAGS) --allow-multiple-definition -o $@ $(OBJ) libretro_switch.a fs.squashfs.o $(LIBTRANSISTOR_NRO_LDFLAGS) -lm
|
||||
|
||||
%.squashfs.o: %.squashfs
|
||||
$(LD) -s -r -b binary -m aarch64elf -T $(LIBTRANSISTOR_HOME)/fs.T -o $@ $<
|
||||
|
||||
fs.squashfs: fs/*
|
||||
mksquashfs $^ $@ -comp lz4 -nopad -noappend
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ) $(TARGET).nro.so $(TARGET).nro
|
||||
|
||||
.PHONY: clean all
|
||||
-187
@@ -1,187 +0,0 @@
|
||||
TARGET := retroarch_vita
|
||||
DEBUG ?= 0
|
||||
GRIFFIN_BUILD = 0
|
||||
WHOLE_ARCHIVE_LINK = 0
|
||||
|
||||
VITA_TITLE_ID := RETROARCH
|
||||
VITA_TITLE_NAME := RetroArch
|
||||
|
||||
PC_DEVELOPMENT_IP_ADDRESS =
|
||||
PC_DEVELOPMENT_UDP_PORT =
|
||||
|
||||
OBJ :=
|
||||
|
||||
DEFINES := -DHAVE_ONLINE_UPDATER -DHAVE_UPDATE_ASSETS
|
||||
INCDIRS :=
|
||||
|
||||
ifeq ($(GRIFFIN_BUILD), 1)
|
||||
OBJ += griffin/griffin.o
|
||||
DEFINES += -DHAVE_GRIFFIN=1
|
||||
DEFINES += -DHAVE_NEON -DHAVE_MENU -DHAVE_CONFIGFILE -DHAVE_XMB -DHAVE_MATERIALUI -DHAVE_LIBRETRODB DEFINES -DHAVE_KEYMAPPER
|
||||
DEFINES += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DHAVE_CC_RESAMPLER
|
||||
ifeq ($(DEBUG), 1)
|
||||
DEFINES += -DHAVE_NETLOGGER
|
||||
endif
|
||||
INCDIRS += -I. -Ideps/7zip -Ilibretro-common/include -Ilibretro-common/include/compat/zlib -Ideps/stb
|
||||
else
|
||||
|
||||
HAVE_UPDATE_ASSETS := 1
|
||||
HAVE_ONLINE_UPDATER := 1
|
||||
HAVE_NEON := 1
|
||||
HAVE_MATH_NEON := 1
|
||||
HAVE_FILTERS_BUILTIN := 1
|
||||
HAVE_LANGEXTRA := 1
|
||||
HAVE_RPNG := 1
|
||||
HAVE_RJPEG := 1
|
||||
HAVE_RBMP := 1
|
||||
HAVE_RTGA := 1
|
||||
HAVE_ZLIB := 1
|
||||
HAVE_7ZIP := 1
|
||||
HAVE_VITA2D := 1
|
||||
HAVE_VITAGL := 1
|
||||
HAVE_NETWORKING := 1
|
||||
HAVE_SOCKET_LEGACY := 1
|
||||
HAVE_MENU := 1
|
||||
HAVE_MENU_COMMON := 1
|
||||
HAVE_GFX_WIDGETS := 1
|
||||
HAVE_CONFIGFILE := 1
|
||||
HAVE_OVERLAY := 1
|
||||
HAVE_VIDEO_LAYOUT := 0
|
||||
HAVE_MATERIALUI := 1
|
||||
HAVE_XMB := 1
|
||||
HAVE_RGUI := 1
|
||||
HAVE_STB_FONT := 1
|
||||
HAVE_THREADS := 1
|
||||
HAVE_LIBRETRODB := 1
|
||||
HAVE_CC_RESAMPLER := 1
|
||||
HAVE_CHEEVOS := 1
|
||||
HAVE_RUNAHEAD := 1
|
||||
RARCH_CONSOLE := 1
|
||||
HAVE_STATIC_VIDEO_FILTERS = 1
|
||||
HAVE_STATIC_AUDIO_FILTERS = 1
|
||||
HAVE_AUDIOMIXER := 1
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
HAVE_NETLOGGER = 1
|
||||
endif
|
||||
|
||||
include Makefile.common
|
||||
CFLAGS += $(DEF_FLAGS)
|
||||
BLACKLIST :=
|
||||
OBJ := $(filter-out $(BLACKLIST),$(OBJ))
|
||||
INCDIRS += $(INCLUDE_DIRS)
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(VITASDK)),)
|
||||
$(error "Please set VITASDK in your environment. export VITASDK=<path to>vitasdk")
|
||||
endif
|
||||
|
||||
export PATH := $(PATH):$(VITASDK)/bin
|
||||
|
||||
PREFIX := arm-vita-eabi-
|
||||
|
||||
CC := $(PREFIX)gcc
|
||||
CXX := $(PREFIX)g++
|
||||
AS := $(PREFIX)as
|
||||
AR := $(PREFIX)ar
|
||||
OBJCOPY := $(PREFIX)objcopy
|
||||
STRIP := $(PREFIX)strip
|
||||
NM := $(PREFIX)nm
|
||||
LD := $(CXX)
|
||||
|
||||
LIBDIRS := -L.
|
||||
|
||||
ARCHFLAGS := -march=armv7-a -mfpu=neon -mfloat-abi=hard -DVITA
|
||||
CFLAGS += $(ARCHFLAGS) -mword-relocations -fno-optimize-sibling-calls -O2
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -g
|
||||
endif
|
||||
|
||||
ASFLAGS := $(CFLAGS)
|
||||
LDFLAGS := -Wl,-q
|
||||
|
||||
CFLAGS += -Wall -ffast-math -g
|
||||
CFLAGS += -DRARCH_INTERNAL -DRARCH_CONSOLE
|
||||
CFLAGS += -DHAVE_FILTERS_BUILTIN $(DEFINES)
|
||||
|
||||
ifneq ($(PC_DEVELOPMENT_IP_ADDRESS),)
|
||||
CFLAGS += -DPC_DEVELOPMENT_IP_ADDRESS='"$(PC_DEVELOPMENT_IP_ADDRESS)"'
|
||||
endif
|
||||
|
||||
ifneq ($(PC_DEVELOPMENT_UDP_PORT),)
|
||||
CFLAGS += -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
|
||||
endif
|
||||
|
||||
ifeq ($(WHOLE_ARCHIVE_LINK), 1)
|
||||
WHOLE_START := -Wl,--whole-archive
|
||||
WHOLE_END := -Wl,--no-whole-archive
|
||||
endif
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||
|
||||
VITA_LIBS := -lSceDisplay_stub -lSceGxm_stub -lSceNet_stub -lSceNetCtl_stub -lSceAppUtil_stub \
|
||||
-lSceSysmodule_stub -lSceCtrl_stub -lSceHid_stub -lSceTouch_stub -lSceAudio_stub \
|
||||
-lScePower_stub -lSceRtc_stub -lSceCommonDialog_stub -lScePgf_stub -lSceMotion_stub \
|
||||
-lSceFiber_stub -lSceMotion_stub -lSceAppMgr_stub -lpthread -lpng -lz
|
||||
|
||||
LIBS := $(WHOLE_START) -lretro_vita $(WHOLE_END) $(VITA_LIBS) -lm -lc
|
||||
|
||||
TARGETS := $(TARGET).vpk
|
||||
|
||||
DEPFLAGS = -MT $@ -MMD -MP -MF $*.Tdepend
|
||||
POSTCOMPILE = mv -f $*.Tdepend $*.depend
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
%.o: %.cpp
|
||||
%.o: %.cpp %.depend
|
||||
$(CXX) -c -o $@ $< $(CXXFLAGS) $(INCDIRS) $(DEPFLAGS)
|
||||
$(POSTCOMPILE)
|
||||
|
||||
%.o: %.c
|
||||
%.o: %.c %.depend
|
||||
$(CC) -c -o $@ $< $(CFLAGS) $(INCDIRS) $(DEPFLAGS)
|
||||
$(POSTCOMPILE)
|
||||
|
||||
%.o: %.S
|
||||
%.o: %.S %.depend
|
||||
$(CC) -c -o $@ $< $(ASFLAGS) $(INCDIRS) $(DEPFLAGS)
|
||||
$(POSTCOMPILE)
|
||||
|
||||
%.o: %.s
|
||||
%.o: %.s %.depend
|
||||
$(CC) -c -o $@ $< $(ASFLAGS) $(INCDIRS) $(DEPFLAGS)
|
||||
$(POSTCOMPILE)
|
||||
|
||||
%.depend: ;
|
||||
|
||||
$(TARGET).elf: $(OBJ) libretro_vita.a
|
||||
$(LD) $(OBJ) $(LDFLAGS) $(LIBDIRS) $(LIBS) -o $@
|
||||
|
||||
%.velf: %.elf
|
||||
cp $< $<.unstripped.elf
|
||||
$(PREFIX)strip -g $<
|
||||
vita-elf-create $< $@
|
||||
|
||||
%.self: %.velf
|
||||
vita-make-fself -c -s $< $@
|
||||
|
||||
%.vpk: %.self
|
||||
vita-mksfoex -s TITLE_ID=$(VITA_TITLE_ID) "$(VITA_TITLE_NAME)" -d ATTRIBUTE2=12 param.sfo
|
||||
vita-pack-vpk -s param.sfo -b $< $@
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ) $(TARGET).elf $(TARGET).elf.unstripped.elf $(TARGET).velf $(TARGET).self param.sfo $(TARGET).vpk
|
||||
rm -f $(OBJ:.o=.depend)
|
||||
|
||||
# Useful for developers
|
||||
vpksend: $(TARGET).vpk
|
||||
curl -T $< ftp://$(PSVITAIP):1337/ux0:/
|
||||
|
||||
send: $(TARGET).self
|
||||
curl -T $< ftp://$(PSVITAIP):1337/ux0:/app/$(VITA_TITLE_ID)/eboot.bin
|
||||
|
||||
.PHONY: clean all send vpksend
|
||||
.PRECIOUS: %.depend
|
||||
|
||||
-include $(OBJ:.o=.depend)
|
||||
@@ -1,85 +0,0 @@
|
||||
HAVE_FILE_LOGGER = 0
|
||||
DEBUG = 0
|
||||
|
||||
TARGET = retroarchvita_salamander
|
||||
TITLE_ID = RETROVITA
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
OPTIMIZE_LV := -O0 -g
|
||||
else
|
||||
OPTIMIZE_LV := -O2
|
||||
endif
|
||||
|
||||
PREFIX = arm-vita-eabi
|
||||
CC = $(PREFIX)-gcc
|
||||
|
||||
INCDIR = libretro-common/include
|
||||
CFLAGS = -Wl,-q $(OPTIMIZE_LV) -I$(INCDIR) -std=gnu99 -mfloat-abi=hard -ffast-math -fsingle-precision-constant -mword-relocations
|
||||
ASFLAGS = $(CFLAGS)
|
||||
|
||||
RARCH_DEFINES = -DVITA -DIS_SALAMANDER -DRARCH_CONSOLE
|
||||
|
||||
LIBDIR =
|
||||
LDFLAGS =
|
||||
LIBS = -lSceDisplay_stub -lSceGxm_stub -lSceNet_stub -lSceNetCtl_stub -lSceAppUtil_stub\
|
||||
-lSceSysmodule_stub -lSceCtrl_stub -lSceHid_stub -lSceAudio_stub -lSceFiber_stub\
|
||||
-lScePower_stub -lSceRtc_stub -lSceCommonDialog_stub -lScePgf_stub -lSceMotion_stub \
|
||||
-lSceMotion_stub -lSceAppMgr_stub -lfreetype -lpng -lm -lc
|
||||
|
||||
ifeq ($(HAVE_FILE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_FILE_LOGGER
|
||||
endif
|
||||
|
||||
CFLAGS += $(RARCH_DEFINES)
|
||||
|
||||
OBJS = frontend/frontend_salamander.o \
|
||||
frontend/frontend_driver.o \
|
||||
frontend/drivers/platform_psp.o \
|
||||
libretro-common/file/file_path.o \
|
||||
libretro-common/file/file_path_io.o \
|
||||
libretro-common/string/stdstring.o \
|
||||
libretro-common/lists/string_list.o \
|
||||
libretro-common/lists/dir_list.o \
|
||||
libretro-common/file/retro_dirent.o \
|
||||
libretro-common/encodings/encoding_utf.o \
|
||||
libretro-common/compat/compat_strl.o \
|
||||
libretro-common/compat/compat_strcasestr.o \
|
||||
libretro-common/compat/fopen_utf8.o \
|
||||
libretro-common/file/config_file.o \
|
||||
libretro-common/streams/file_stream.o \
|
||||
libretro-common/vfs/vfs_implementation.o \
|
||||
libretro-common/hash/rhash.o \
|
||||
file_path_str.o \
|
||||
verbosity.o
|
||||
|
||||
all: $(TARGET).vpk
|
||||
|
||||
%.vpk: eboot.bin
|
||||
vita-mksfoex -s TITLE_ID=$(TITLE_ID) "$(TARGET)" -d ATTRIBUTE2=12 param.sfo
|
||||
vita-pack-vpk -s param.sfo -b eboot.bin $@
|
||||
|
||||
eboot.bin: $(TARGET).velf
|
||||
vita-make-fself $< $@
|
||||
|
||||
%.velf: %.elf
|
||||
vita-elf-create $< $@
|
||||
|
||||
$(TARGET).elf: $(OBJS)
|
||||
$(CC) $(CFLAGS) $^ $(LIBS) -o $@
|
||||
|
||||
%.o: %.png
|
||||
$(PREFIX)-ld -r -b binary -o $@ $^
|
||||
|
||||
clean:
|
||||
@rm -rf $(TARGET).vpk $(TARGET).velf $(TARGET).elf $(OBJS) \
|
||||
eboot.bin param.sfo
|
||||
|
||||
vpksend: $(TARGET).vpk
|
||||
curl -T $(TARGET).vpk ftp://$(PSVITAIP):1337/ux0:/
|
||||
@echo "Sent."
|
||||
|
||||
PSVITAIP = 192.168.1.15
|
||||
|
||||
send: eboot.bin
|
||||
curl -T eboot.bin ftp://$(PSVITAIP):1337/ux0:/app/$(TITLE_ID)/
|
||||
@echo "Sent."
|
||||
+8
-40
@@ -6,7 +6,6 @@
|
||||
DEBUG = 0
|
||||
HAVE_LOGGER = 0
|
||||
HAVE_FILE_LOGGER = 0
|
||||
EXTERNAL_LIBOGC = 0
|
||||
|
||||
# system platform
|
||||
system_platform = unix
|
||||
@@ -30,24 +29,13 @@ ELF2DOL = $(DEVKITPPC)/bin/elf2dol$(EXE_EXT)
|
||||
DOL_TARGET := retroarch-salamander_wii.dol
|
||||
ELF_TARGET := retroarch-salamander_wii.elf
|
||||
|
||||
INCLUDE := -I. -Ilibretro-common/include -Ilibretro-common/include/compat/zlib
|
||||
ifeq ($(EXTERNAL_LIBOGC), 1)
|
||||
INCLUDE += -I$(DEVKITPRO)/libogc/include
|
||||
INCLUDE := -I. -I$(DEVKITPRO)/libogc/include -Ilibretro-common/include -Ideps/zlib
|
||||
LIBDIRS := -L$(DEVKITPRO)/libogc/lib/wii -L.
|
||||
else
|
||||
INCLUDE += -Iwii/libogc/include
|
||||
LIBDIRS := -Lwii/libogc/libs/wii -L.
|
||||
endif
|
||||
|
||||
MACHDEP := -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float
|
||||
CFLAGS += -Wall -std=gnu99 $(MACHDEP) $(INCLUDE)
|
||||
LDFLAGS := $(MACHDEP) -Wl,-Map,$(notdir $(ELF_TARGET)).map
|
||||
|
||||
ifeq ($(EXTERNAL_LIBOGC), 1)
|
||||
LIBS := -lfat
|
||||
endif
|
||||
|
||||
LIBS += -lwiiuse -logc -lbte
|
||||
LIBS := -lfat -lwiiuse -logc -lbte
|
||||
|
||||
APP_BOOTER_DIR = wii/app_booter
|
||||
|
||||
@@ -55,44 +43,24 @@ OBJ = frontend/frontend_salamander.o \
|
||||
frontend/frontend_driver.o \
|
||||
frontend/drivers/platform_gx.o \
|
||||
frontend/drivers/platform_wii.o \
|
||||
frontend/drivers/platform_null.o \
|
||||
libretro-common/file/file_path.o \
|
||||
libretro-common/file/file_path_io.o \
|
||||
libretro-common/hash/rhash.o \
|
||||
libretro-common/string/stdstring.o \
|
||||
libretro-common/lists/string_list.o \
|
||||
libretro-common/lists/dir_list.o \
|
||||
libretro-common/streams/file_stream.o \
|
||||
libretro-common/vfs/vfs_implementation.o \
|
||||
libretro-common/string/string_list.o \
|
||||
libretro-common/file/dir_list.o \
|
||||
libretro-common/file/retro_file.o \
|
||||
libretro-common/file/retro_dirent.o \
|
||||
libretro-common/encodings/encoding_utf.o \
|
||||
libretro-common/file/retro_stat.o \
|
||||
libretro-common/compat/compat_strl.o \
|
||||
libretro-common/compat/compat_strcasestr.o \
|
||||
libretro-common/compat/fopen_utf8.o \
|
||||
libretro-common/file/config_file.o \
|
||||
file_path_str.o \
|
||||
verbosity.o \
|
||||
$(APP_BOOTER_DIR)/app_booter.binobj
|
||||
|
||||
ifeq ($(EXTERNAL_LIBOGC), 1)
|
||||
else
|
||||
OBJ += wii/libogc/libfat/cache.o \
|
||||
wii/libogc/libfat/directory.o \
|
||||
wii/libogc/libfat/disc.o \
|
||||
wii/libogc/libfat/fatdir.o \
|
||||
wii/libogc/libfat/fatfile.o \
|
||||
wii/libogc/libfat/file_allocation_table.o \
|
||||
wii/libogc/libfat/filetime.o \
|
||||
wii/libogc/libfat/libfat.o \
|
||||
wii/libogc/libfat/lock.o \
|
||||
wii/libogc/libfat/partition.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_LOGGER
|
||||
CFLAGS += -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
|
||||
OBJ += network/net_logger.o \
|
||||
libretro-common/net/net_compat.o \
|
||||
libretro-common/net/net_socket.o
|
||||
OBJ += logger/netlogger.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_FILE_LOGGER), 1)
|
||||
|
||||
-334
@@ -1,334 +0,0 @@
|
||||
TARGET := retroarch_wiiu
|
||||
|
||||
BUILD_HBL_ELF = 1
|
||||
BUILD_RPX = 1
|
||||
DEBUG = 0
|
||||
GRIFFIN_BUILD = 0
|
||||
SALAMANDER_BUILD = 0
|
||||
WHOLE_ARCHIVE_LINK = 0
|
||||
WIIU_HID = 1
|
||||
HAVE_RUNAHEAD = 1
|
||||
WIIU_LOG_RPX = 0
|
||||
BUILD_DIR = objs/wiiu
|
||||
PC_DEVELOPMENT_TCP_PORT ?=
|
||||
|
||||
ifeq ($(SALAMANDER_BUILD),1)
|
||||
BUILD_DIR := $(BUILD_DIR)-salamander
|
||||
TARGET := $(TARGET)_salamander
|
||||
else ifeq ($(GRIFFIN_BUILD),1)
|
||||
BUILD_DIR := $(BUILD_DIR)-griffin
|
||||
endif
|
||||
|
||||
ifeq ($(DEBUG),1)
|
||||
BUILD_DIR := $(BUILD_DIR)-debug
|
||||
endif
|
||||
|
||||
ifneq ($(V), 1)
|
||||
Q := @
|
||||
endif
|
||||
|
||||
DEFINES :=
|
||||
OBJ :=
|
||||
INCDIRS :=
|
||||
|
||||
#-----------------------------
|
||||
# Features and object files
|
||||
|
||||
OBJ += wiiu/main.o
|
||||
OBJ += wiiu/system/memory.o
|
||||
OBJ += wiiu/system/atomic.o
|
||||
OBJ += wiiu/system/exception_handler.o
|
||||
OBJ += wiiu/system/missing_libc_functions.o
|
||||
OBJ += wiiu/fs/sd_fat_devoptab.o
|
||||
OBJ += wiiu/fs/fs_utils.o
|
||||
OBJ += wiiu/hbl.o
|
||||
|
||||
RPX_OBJ = $(BUILD_DIR)/wiiu/system/stubs_rpl.o
|
||||
HBL_ELF_OBJ = $(BUILD_DIR)/wiiu/system/dynamic.o \
|
||||
$(BUILD_DIR)/wiiu/system/stubs_elf.o
|
||||
|
||||
ifeq ($(SALAMANDER_BUILD),1)
|
||||
DEFINES += -DRARCH_CONSOLE -DIS_SALAMANDER
|
||||
|
||||
OBJ += frontend/frontend_salamander.o
|
||||
OBJ += frontend/frontend_driver.o
|
||||
OBJ += frontend/drivers/platform_wiiu.o
|
||||
OBJ += libretro-common/encodings/encoding_utf.o
|
||||
OBJ += libretro-common/compat/compat_strcasestr.o
|
||||
OBJ += libretro-common/compat/fopen_utf8.o
|
||||
OBJ += libretro-common/file/file_path.o
|
||||
OBJ += libretro-common/file/file_path_io.o
|
||||
OBJ += libretro-common/string/stdstring.o
|
||||
OBJ += libretro-common/lists/string_list.o
|
||||
OBJ += libretro-common/lists/dir_list.o
|
||||
OBJ += libretro-common/file/retro_dirent.o
|
||||
OBJ += libretro-common/compat/compat_strl.o
|
||||
OBJ += libretro-common/file/config_file.o
|
||||
OBJ += libretro-common/streams/file_stream.o
|
||||
OBJ += libretro-common/vfs/vfs_implementation.o
|
||||
OBJ += libretro-common/hash/rhash.o
|
||||
OBJ += file_path_str.o
|
||||
OBJ += verbosity.o
|
||||
|
||||
# $(SALAMANDER_BUILD),0
|
||||
else
|
||||
DEFINES += -DRARCH_INTERNAL
|
||||
DEFINES += -DHAVE_KEYMAPPER
|
||||
DEFINES += -DHAVE_ONLINE_UPDATER
|
||||
DEFINES += -DHAVE_UPDATE_ASSETS
|
||||
DEFINES += -DHAVE_UPDATE_CORES
|
||||
DEFINES += -DHAVE_FILTERS_BUILTIN
|
||||
DEFINES += -DHAVE_SLANG
|
||||
DEFINES += -DHAVE_SHADERPIPELINE
|
||||
|
||||
ifeq ($(HAVE_RUNAHEAD),1)
|
||||
DEFINES += -DHAVE_RUNAHEAD
|
||||
endif
|
||||
|
||||
OBJ += wiiu/shader_utils.o
|
||||
OBJ += gfx/drivers/gx2_shaders/tex.o
|
||||
OBJ += gfx/drivers/gx2_shaders/sprite.o
|
||||
OBJ += gfx/drivers/gx2_shaders/frame.o
|
||||
OBJ += gfx/drivers/gx2_shaders/ribbon.o
|
||||
OBJ += gfx/drivers/gx2_shaders/ribbon_simple.o
|
||||
OBJ += gfx/drivers/gx2_shaders/bokeh.o
|
||||
OBJ += gfx/drivers/gx2_shaders/snow.o
|
||||
OBJ += gfx/drivers/gx2_shaders/snow_simple.o
|
||||
OBJ += gfx/drivers/gx2_shaders/snowflake.o
|
||||
|
||||
ifeq ($(GRIFFIN_BUILD), 1)
|
||||
OBJ += griffin/griffin.o
|
||||
|
||||
INCDIRS += -Ilibretro-common/include/compat/zlib
|
||||
# for stb, libfat, iosuhax
|
||||
INCDIRS += -Ideps -Ideps/libfat/include -Ideps/libiosuhax
|
||||
# pad_functions uses wiiu/input.h
|
||||
INCDIRS += -Iinput/include
|
||||
INCDIRS += -Ideps/SPIRV-Cross
|
||||
|
||||
DEFINES += -DHAVE_AUDIOMIXER
|
||||
DEFINES += -DHAVE_GRIFFIN=1 -DHAVE_MENU -DHAVE_CONFIGFILE -DHAVE_RGUI -DHAVE_LIBRETRODB
|
||||
DEFINES += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DHAVE_CC_RESAMPLER
|
||||
DEFINES += -DHAVE_SPIRV_CROSS -DHAVE_SLANG
|
||||
DEFINES += -DHAVE_STB_FONT -DHAVE_STB_VORBIS -DHAVE_LANGEXTRA -DHAVE_LIBRETRODB -DHAVE_NETWORKING -DHAVE_NETPLAYDISCOVERY
|
||||
#DEFINES += -DWANT_IFADDRS
|
||||
#DEFINES += -DHAVE_FREETYPE
|
||||
DEFINES += -DHAVE_XMB -DHAVE_MATERIALUI
|
||||
DEFINES += -DHAVE_HID
|
||||
DEFINES += -DWANT_LIBFAT -DHAVE_LIBFAT -DWANT_IOSUHAX -DHAVE_IOSUHAX
|
||||
DEFINES += -DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS
|
||||
|
||||
# $(GRIFFIN_BUILD),0
|
||||
else
|
||||
HAVE_AUDIOMIXER = 1
|
||||
HAVE_MENU_COMMON = 1
|
||||
HAVE_RTGA = 1
|
||||
HAVE_RPNG = 1
|
||||
HAVE_RJPEG = 1
|
||||
HAVE_RBMP = 1
|
||||
HAVE_CONFIGFILE = 1
|
||||
HAVE_MENU = 1
|
||||
HAVE_RGUI = 1
|
||||
HAVE_7ZIP = 1
|
||||
HAVE_ZLIB = 1
|
||||
HAVE_BUILTINZLIB = 0
|
||||
HAVE_LIBRETRODB = 1
|
||||
HAVE_MATERIALUI = 1
|
||||
HAVE_XMB = 1
|
||||
HAVE_STB_FONT = 1
|
||||
#HAVE_FREETYPE = 1
|
||||
HAVE_LANGEXTRA = 1
|
||||
HAVE_LIBRETRODB = 1
|
||||
HAVE_NETWORKING = 1
|
||||
HAVE_NETPLAYDISCOVERY = 1
|
||||
HAVE_CHEEVOS = 1
|
||||
#WANT_IFADDRS = 1
|
||||
HAVE_OVERLAY = 1
|
||||
HAVE_SPIRV_CROSS = 1
|
||||
HAVE_SLANG = 1
|
||||
HAVE_VIDEO_LAYOUT = 0
|
||||
HAVE_STATIC_VIDEO_FILTERS = 1
|
||||
HAVE_STATIC_AUDIO_FILTERS = 1
|
||||
WANT_LIBFAT = 1
|
||||
WANT_IOSUHAX = 1
|
||||
|
||||
include Makefile.common
|
||||
DEFINES += $(DEF_FLAGS)
|
||||
INCDIRS += $(INCLUDE_DIRS)
|
||||
endif
|
||||
endif
|
||||
|
||||
OBJ := $(addprefix $(BUILD_DIR)/,$(OBJ))
|
||||
|
||||
#-----------------------------
|
||||
# Compile flags
|
||||
|
||||
DEFINES += -DWIIU -DMSB_FIRST -D__WUT__ -DHW_WUP -D__wiiu__
|
||||
DEFINES += -DHAVE_MAIN
|
||||
DEFINES += -DRARCH_CONSOLE
|
||||
|
||||
ifeq ($(WIIU_LOG_RPX),1)
|
||||
DEFINES += -DWIIU_LOG_RPX
|
||||
endif
|
||||
|
||||
ifneq ($(PC_DEVELOPMENT_TCP_PORT),)
|
||||
DEFINES += -DPC_DEVELOPMENT_TCP_PORT=$(PC_DEVELOPMENT_TCP_PORT)
|
||||
endif
|
||||
|
||||
INCDIRS += -I.
|
||||
INCDIRS += -Ilibretro-common/include
|
||||
INCDIRS += -Iwiiu
|
||||
INCDIRS += -Iwiiu/include
|
||||
|
||||
CFLAGS := -mcpu=750 -meabi -mhard-float
|
||||
CFLAGS += -ffast-math -Werror=implicit-function-declaration
|
||||
CFLAGS += -ffunction-sections -fdata-sections
|
||||
#CFLAGS += -fomit-frame-pointer -mword-relocations
|
||||
#CFLAGS += -Wall
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -O0 -g
|
||||
else
|
||||
CFLAGS += -O3
|
||||
endif
|
||||
|
||||
ASFLAGS := $(CFLAGS) -mregnames
|
||||
|
||||
#-----------------------------
|
||||
# Linking/library flags
|
||||
|
||||
LIBDIRS := -L.
|
||||
LDFLAGS := $(CFLAGS)
|
||||
|
||||
ifeq ($(WHOLE_ARCHIVE_LINK), 1)
|
||||
WHOLE_START := -Wl,--whole-archive
|
||||
WHOLE_END := -Wl,--no-whole-archive
|
||||
endif
|
||||
|
||||
LIBS := $(WHOLE_START) -lretro_wiiu $(WHOLE_END) -lm
|
||||
|
||||
# Use portlibs zlib if deps/ isn't being used
|
||||
ifeq ($(HAVE_ZLIB),1)
|
||||
ifeq ($(HAVE_BUILTINZLIB),0)
|
||||
INCDIRS += -I$(DEVKITPRO)/portlibs/ppc/include
|
||||
LIBDIRS += -L$(DEVKITPRO)/portlibs/ppc/lib
|
||||
# Bonus: libpng for cores that need it
|
||||
LIBS += -lpng -lz
|
||||
endif
|
||||
endif
|
||||
|
||||
LDFLAGS += -Wl,--gc-sections
|
||||
|
||||
RPX_LDFLAGS := -pie -fPIE
|
||||
RPX_LDFLAGS += -z common-page-size=64 -z max-page-size=64
|
||||
RPX_LDFLAGS += -T wiiu/link_rpl.ld
|
||||
RPX_LDFLAGS += -nostartfiles
|
||||
|
||||
HBL_ELF_LDFLAGS := -T wiiu/link_elf.ld
|
||||
|
||||
#-----------------------------
|
||||
# Compiler setup
|
||||
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
|
||||
endif
|
||||
ifeq ($(strip $(DEVKITPRO)),)
|
||||
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPRO")
|
||||
endif
|
||||
|
||||
export PATH := $(PATH):$(DEVKITPPC)/bin
|
||||
|
||||
PREFIX := powerpc-eabi-
|
||||
|
||||
CC := $(PREFIX)gcc
|
||||
CXX := $(PREFIX)g++
|
||||
AS := $(PREFIX)as
|
||||
AR := $(PREFIX)ar
|
||||
OBJCOPY := $(PREFIX)objcopy
|
||||
STRIP := $(PREFIX)strip
|
||||
NM := $(PREFIX)nm
|
||||
LD := $(CXX)
|
||||
|
||||
ELF2RPL := wiiu/wut/elf2rpl/elf2rpl
|
||||
|
||||
ifneq ($(findstring Linux,$(shell uname -a)),)
|
||||
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
||||
else
|
||||
ELF2RPL := $(ELF2RPL).exe
|
||||
endif
|
||||
|
||||
#-----------------------------
|
||||
# Targets and build rules
|
||||
|
||||
TARGETS :=
|
||||
ifeq ($(BUILD_RPX), 1)
|
||||
TARGETS += $(TARGET).rpx
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_HBL_ELF), 1)
|
||||
TARGETS += $(TARGET).elf
|
||||
endif
|
||||
|
||||
DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.depend
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
%: $(BUILD_DIR)/%
|
||||
cp $< $@
|
||||
|
||||
$(BUILD_DIR)/%.o: %.cpp %.depend
|
||||
@$(if $(Q), echo CXX $<,)
|
||||
@mkdir -p $(dir $@)
|
||||
$(Q)$(CXX) -c -o $@ $< $(CXXFLAGS) $(DEFINES) $(INCDIRS) $(DEPFLAGS)
|
||||
|
||||
$(BUILD_DIR)/%.o: %.c %.depend
|
||||
@$(if $(Q), echo CC $<,)
|
||||
@mkdir -p $(dir $@)
|
||||
$(Q)$(CC) -c -o $@ $< $(CFLAGS) $(DEFINES) $(INCDIRS) $(DEPFLAGS)
|
||||
|
||||
$(BUILD_DIR)/%.o: %.S %.depend
|
||||
@$(if $(Q), echo AS $<,)
|
||||
@mkdir -p $(dir $@)
|
||||
$(Q)$(CC) -c -o $@ $< $(ASFLAGS) $(DEFINES) $(INCDIRS) $(DEPFLAGS)
|
||||
|
||||
$(BUILD_DIR)/%.o: %.s %.depend
|
||||
@$(if $(Q), echo AS $<,)
|
||||
@mkdir -p $(dir $@)
|
||||
$(Q)$(CC) -c -o $@ $< $(ASFLAGS) $(INCDIRS) $(DEPFLAGS)
|
||||
%.a:
|
||||
@$(if $(Q), echo AR $<,)
|
||||
@mkdir -p $(dir $@)
|
||||
$(Q)$(AR) -rc $@ $^
|
||||
|
||||
%.depend: ;
|
||||
%.last: ;
|
||||
|
||||
$(ELF2RPL):
|
||||
@$(if $(Q), echo MAKE $@,)
|
||||
$(Q)$(MAKE) -C wiiu/wut/elf2rpl/
|
||||
|
||||
$(BUILD_DIR)/$(TARGET).elf: $(OBJ) $(HBL_ELF_OBJ) libretro_wiiu.a wiiu/link_elf.ld .$(TARGET).elf.last
|
||||
@$(if $(Q), echo LD $@,)
|
||||
@touch .$(TARGET).elf.last
|
||||
$(Q)$(LD) $(OBJ) $(HBL_ELF_OBJ) $(LDFLAGS) $(HBL_ELF_LDFLAGS) $(LIBDIRS) $(LIBS) -o $@
|
||||
|
||||
$(BUILD_DIR)/$(TARGET).rpx.elf: $(OBJ) $(RPX_OBJ) libretro_wiiu.a wiiu/link_elf.ld
|
||||
@$(if $(Q), echo LD $@,)
|
||||
$(Q)$(LD) $(OBJ) $(RPX_OBJ) $(LDFLAGS) $(RPX_LDFLAGS) $(LIBDIRS) $(LIBS) -o $@
|
||||
|
||||
$(BUILD_DIR)/$(TARGET).rpx: $(BUILD_DIR)/$(TARGET).rpx.elf $(ELF2RPL) .$(TARGET).rpx.last
|
||||
@$(if $(Q), echo ELF2RPL $@,)
|
||||
@touch .$(TARGET).rpx.last
|
||||
$(Q)-$(ELF2RPL) $< $@
|
||||
|
||||
clean:
|
||||
@$(if $(Q), echo $@,)
|
||||
$(Q)rm -f $(OBJ) $(RPX_OBJ) $(HBL_ELF_OBJ) $(TARGET).elf $(TARGET).rpx.elf $(TARGET).rpx
|
||||
$(Q)rm -f $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).rpx.elf $(BUILD_DIR)/$(TARGET).rpx
|
||||
$(Q)rm -f .$(TARGET).elf.last .$(TARGET).rpx.elf.last .$(TARGET).rpx.last
|
||||
$(Q)rm -f $(OBJ:.o=.depend) $(RPX_OBJ:.o=.depend) $(HBL_ELF_OBJ:.o=.depend)
|
||||
|
||||
.PHONY: clean all
|
||||
.PRECIOUS: %.depend %.last
|
||||
|
||||
-include $(OBJ:.o=.depend) $(RPX_OBJ:.o=.depend) $(HBL_ELF_OBJ:.o=.depend)
|
||||
+16
-26
@@ -1,28 +1,25 @@
|
||||
TARGET = retroarch.exe
|
||||
|
||||
HAVE_AUDIOMIXER = 1
|
||||
HAVE_DINPUT = 1
|
||||
HAVE_XAUDIO = 1
|
||||
HAVE_DSOUND = 1
|
||||
HAVE_WASAPI = 1
|
||||
HAVE_OPENGL = 1
|
||||
HAVE_FBO = 1
|
||||
HAVE_DYLIB = 1
|
||||
HAVE_D3D9 = 1
|
||||
HAVE_NETPLAY = 1
|
||||
HAVE_NETWORKING = 1
|
||||
HAVE_NETPLAYDISCOVERY = 1
|
||||
HAVE_STDIN_CMD = 1
|
||||
HAVE_COMMAND = 1
|
||||
HAVE_THREADS = 1
|
||||
HAVE_MENU = 1
|
||||
HAVE_CONFIGFILE = 1
|
||||
HAVE_RGUI = 1
|
||||
HAVE_MATERIALUI = 1
|
||||
HAVE_7ZIP = 1
|
||||
HAVE_ZLIB_DEFLATE = 1
|
||||
HAVE_PYTHON = 0
|
||||
DYNAMIC = 1
|
||||
|
||||
HAVE_XINPUT = 1
|
||||
HAVE_WINMM = 1
|
||||
|
||||
HAVE_SDL := 0
|
||||
HAVE_SDL2 := 0
|
||||
@@ -34,8 +31,9 @@ HAVE_FREETYPE := 1
|
||||
HAVE_FFMPEG := 0
|
||||
|
||||
HAVE_CG := 1
|
||||
HAVE_LIBXML2 := 0
|
||||
HAVE_ZLIB := 1
|
||||
HAVE_CC_RESAMPLER := 1
|
||||
WANT_ZLIB := 1
|
||||
|
||||
ifeq ($(HAVE_CG), 1)
|
||||
CG_LIBS := -lcg -lcgGL
|
||||
@@ -46,6 +44,11 @@ FREETYPE_CFLAGS := -DHAVE_FREETYPE -Ifreetype2
|
||||
FREETYPE_LIBS := -lfreetype
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_LIBXML2), 1)
|
||||
LIBXML2_CFLAGS := -Ilibxml2 -DHAVE_LIBXML2 -DHAVE_GLSL
|
||||
LIBXML2_LIBS := -lxml2 -liconv
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_SDL), 1)
|
||||
SDL_LIBS := -lSDL
|
||||
SDL_CFLAGS := -ISDL -DHAVE_SDL
|
||||
@@ -57,20 +60,6 @@ SDL2_LIBS := -lSDL2
|
||||
SDL2_CFLAGS := -ISDL2 -DHAVE_SDL2
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_D3D8), 1)
|
||||
D3D8_LIBS := -ld3d8
|
||||
ifeq ($(HAVE_D3DX), 1)
|
||||
D3DX8_LIBS := -ld3dx8
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_D3D9), 1)
|
||||
D3D9_LIBS := -ld3d9
|
||||
ifeq ($(HAVE_D3DX), 1)
|
||||
D3DX9_LIBS := -ld3dx9
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_RSOUND), 1)
|
||||
RSOUND_CFLAGS := -DHAVE_RSOUND
|
||||
RSOUND_LIBS := -lrsound
|
||||
@@ -95,9 +84,7 @@ OBJDIR := obj-w32
|
||||
OS := Win32
|
||||
OBJ :=
|
||||
LIBS := -lm
|
||||
DEFINES :=
|
||||
DEFINES += -I. -Ilibretro-common/include -Ilibretro-common/include/compat/zlib -DRARCH_INTERNAL -DHAVE_OVERLAY
|
||||
#DEFINES += -DHAVE_VIDEO_LAYOUT
|
||||
DEFINES := -I. -Ilibretro-common/include -DRARCH_INTERNAL -DHAVE_OVERLAY
|
||||
LDFLAGS := -L. -static-libgcc
|
||||
|
||||
include Makefile.common
|
||||
@@ -114,6 +101,7 @@ else
|
||||
WINDRES = windres
|
||||
endif
|
||||
|
||||
|
||||
libretro ?= -lretro
|
||||
|
||||
ifeq ($(DYNAMIC), 1)
|
||||
@@ -132,10 +120,11 @@ ifeq ($(DEBUG), 1)
|
||||
else
|
||||
CFLAGS += -O3 -ffast-math
|
||||
CXXFLAGS += -O3 -ffast-math
|
||||
LDCXXFLAGS += -s
|
||||
endif
|
||||
|
||||
CFLAGS += $(DEF_FLAGS) -Wall -Wno-unused-result -Wno-unused-variable -I. -Ideps
|
||||
CXXFLAGS += -Wall -Wno-unused-result -Wno-unused-variable -I. -Ideps -std=c++98 -D__STDC_CONSTANT_MACROS
|
||||
CFLAGS += -Wall -Wno-unused-result -Wno-unused-variable -I.
|
||||
CXXFLAGS += -Wall -Wno-unused-result -Wno-unused-variable -I. -std=c++98 -D__STDC_CONSTANT_MACROS
|
||||
ifeq ($(CXX_BUILD), 1)
|
||||
CFLAGS += -std=c++98 -xc++ -D__STDC_CONSTANT_MACROS
|
||||
else
|
||||
@@ -183,3 +172,4 @@ clean:
|
||||
rm -f *.d
|
||||
|
||||
.PHONY: all install uninstall clean
|
||||
|
||||
+10
-10
@@ -1,7 +1,7 @@
|
||||
USAGE NOTES
|
||||
===========
|
||||
|
||||
This driver is meant for devices with Allwinner SoCs with Mali400 3D block and a
|
||||
This driver is meant for devices with Allwinner SoCs with Mali400 3D block and a
|
||||
good fbdev implementation. It is derived from the old Android GLES driver.
|
||||
|
||||
It was meant to be used on Cubieboard/Cubieboard2/Cubietruck, but it should not
|
||||
@@ -18,8 +18,8 @@ So we will use
|
||||
First we will clone and build the kernel:
|
||||
git clone https://github.com/mireq/linux-sunxi.git -b sunxi-3.4 --depth 1
|
||||
|
||||
Now we edit drivers/video/sunxi/disp/dev_fb.c, and uncomment the line 1074:
|
||||
// Fb_wait_for_vsync(info);
|
||||
Now we edit drivers/video/sunxi/disp/dev_fb.c, and uncoment the line 1074:
|
||||
// Fb_wait_for_vsync(info);
|
||||
|
||||
It is assumed you have a cross-compiler installed, so we configure and build the kernel and modules:
|
||||
|
||||
@@ -50,7 +50,7 @@ Now we need the headers. We can get them from here:
|
||||
|
||||
http://malideveloper.arm.com/develop-for-mali/sdks/opengl-es-sdk-for-linux/#opengl-es-sdk-for-linux-download
|
||||
|
||||
Download whatever version you want. We just get the headers from here, not machine-dependant compiled code.
|
||||
Download whatever version you want. We just get the headers from here, not machine-dependant compiled code.
|
||||
|
||||
Extract the files and copy the directories inside inc to /usr/include .
|
||||
|
||||
@@ -60,27 +60,27 @@ In the end you should have this on your system:
|
||||
|
||||
/usr/include/EGL/
|
||||
eglext.h
|
||||
egl.h
|
||||
eglplatform.h
|
||||
egl.h
|
||||
eglplatform.h
|
||||
fbdev_window.h
|
||||
/usr/include/GLES/
|
||||
glext.h
|
||||
gl.h
|
||||
gl.h
|
||||
glplatform.h
|
||||
/usr/include/GLES2
|
||||
gl2ext.h
|
||||
gl2.h
|
||||
gl2.h
|
||||
gl2platform.h
|
||||
/usr/include/GLES3
|
||||
gl3ext.h
|
||||
gl3.h
|
||||
gl3.h
|
||||
gl3platform.h
|
||||
|
||||
To enable mali_fbdev you must configure RetroArch with --enable-gles and --enable-mali_fbdev.
|
||||
|
||||
This is an example of what you would use on a CubieBoard2 for a lightweight RetroArch:
|
||||
|
||||
./configure --enable-gles --enable-mali_fbdev --disable-x11 --disable-sdl2 --enable-floathard --disable-ffmpeg --disable-netplay --enable-udev --disable-sdl --disable-pulse --disable-oss --disable-freetype --disable-7zip
|
||||
./configure --enable-gles --enable-mali_fbdev --disable-x11 --disable-sdl2 --enable-floathard --disable-ffmpeg --disable-netplay --enable-udev --disable-sdl --disable-pulse --disable-oss --disable-freetype --disable-7zip --disable-libxml2
|
||||
|
||||
NOTE: A TTY hack is used to auto-clean the console on exit, and the fbdev ioctls are used to retrieve
|
||||
current video mode. Both things work good, but they are not exactly ideal solutions.
|
||||
|
||||
@@ -1,91 +1,61 @@
|
||||
[](https://travis-ci.org/libretro/RetroArch)
|
||||
[](https://scan.coverity.com/projects/retroarch)
|
||||
|
||||
# RetroArch
|
||||
|
||||
RetroArch is the reference frontend for the libretro API.
|
||||
Popular examples of implementations for this API includes video game system emulators and game engines as well as
|
||||
Popular examples of implementations for this API includes videogame system emulators and game engines, but also
|
||||
more generalized 3D programs.
|
||||
These programs are instantiated as dynamic libraries. We refer to these as "libretro cores".
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
## libretro
|
||||
|
||||
[libretro](https://www.libretro.com) is an API that exposes generic audio/video/input callbacks.
|
||||
[libretro](http://libretro.com) is an API that exposes generic audio/video/input callbacks.
|
||||
A frontend for libretro (such as RetroArch) handles video output, audio output, input and application lifecycle.
|
||||
A libretro core written in portable C or C++ can run seamlessly on many platforms with very little to no porting effort.
|
||||
A libretro core written in portable C or C++ can run seamlessly on many platforms with very little/no porting effort.
|
||||
|
||||
While RetroArch is the reference frontend for libretro, several other projects have used the libretro
|
||||
interface to include support for emulators and/or game engines. libretro is completely open and free for anyone to use.
|
||||
|
||||
[libretro API header](https://github.com/libretro/RetroArch/blob/master/libretro-common/include/libretro.h)
|
||||
[libretro API header](https://github.com/libretro/RetroArch/blob/master/libretro.h)
|
||||
|
||||
## Binaries
|
||||
|
||||
Latest binaries are currently hosted on the [buildbot](http://buildbot.libretro.com/).
|
||||
Latest Windows binaries are currently hosted on the buildbot -(http://buildbot.libretro.com/).
|
||||
|
||||
## Support
|
||||
|
||||
To reach developers, either make an issue here on GitHub, make a thread on the [forum](https://www.libretro.com/forums/), chat on [discord](https://discord.gg/C4amCeV), or visit our IRC channel: #retroarch @ irc.freenode.org. You could create a post in [Reddit](https://www.reddit.com/r/RetroArch/) with *Technical Support* flair.
|
||||
To reach developers, either make an issue here on Github, make a thread on the [forum](http://www.libretro.com/forums/),
|
||||
or visit our IRC channel: #retroarch @ irc.freenode.org.
|
||||
|
||||
## Documentation
|
||||
|
||||
See our [Documentation Center](https://docs.libretro.com/). On Unix, man-pages are provided.
|
||||
More developer-centric stuff is found [here](https://docs.libretro.com/development/libretro-overview/).
|
||||
See our [wiki](https://github.com/libretro/RetroArch/wiki). On Unix, man-pages are provided.
|
||||
More developer-centric stuff is found [here](https://github.com/libretro/libretro.github.com/wiki/Documentation-devs).
|
||||
|
||||
## Related projects
|
||||
|
||||
- Cg/HLSL shaders: [common-shaders](https://github.com/libretro/common-shaders)
|
||||
- slang shaders: [slang-shaders](https://github.com/libretro/slang-shaders)
|
||||
- GLSL shaders: [glsl-shaders](https://github.com/libretro/glsl-shaders)
|
||||
- Helper scripts to build libretro implementations: [libretro-super](https://github.com/libretro/libretro-super)
|
||||
- GitHub mirrors of projects, useful for generating diff files: [libretro-mirrors](https://github.com/libretro-mirrors/)
|
||||
|
||||
## Philosophy
|
||||
|
||||
RetroArch attempts to be small and lean
|
||||
RetroArch attempts to be small and lean,
|
||||
while still having all the useful core features expected from an emulator.
|
||||
It is designed to be very portable and features a gamepad-centric and touchscreen UI.
|
||||
It is designed to be very portable and features a gamepad-centric UI.
|
||||
It also has a full-featured command-line interface.
|
||||
|
||||
In some areas, RetroArch goes beyond and emphasizes on not-so-common technical features such as multi-pass shader support,
|
||||
real-time rewind (Braid-style), video recording (using FFmpeg), run-ahead input latency removal, etc.
|
||||
real-time rewind (Braid-style), video recording (using FFmpeg), etc.
|
||||
|
||||
RetroArch also emphasizes being easy to integrate into various launcher frontends.
|
||||
RetroArch also emphasizes on being easy to integrate into various launcher frontends.
|
||||
|
||||
## Platforms
|
||||
|
||||
RetroArch has been ported to the following platforms:
|
||||
RetroArch has been ported to the following platforms outside PC:
|
||||
|
||||
- DOS
|
||||
- Windows
|
||||
- Linux
|
||||
- Emscripten (WebAssembly and JavaScript)
|
||||
- FreeBSD
|
||||
- NetBSD
|
||||
- OpenBSD
|
||||
- Haiku
|
||||
- Solaris
|
||||
- macOS (PPC, x86-32 and x86-64)
|
||||
- PlayStation 2
|
||||
- PlayStation 3
|
||||
- PlayStation Portable
|
||||
- PlayStation Vita
|
||||
- Original Microsoft Xbox
|
||||
- Microsoft Xbox 360 (Libxenon/XeXDK)
|
||||
- Nintendo GameCube
|
||||
- Nintendo Wii
|
||||
- Nintendo Wii U
|
||||
- Nintendo 3DS/2DS
|
||||
- Nintendo Switch
|
||||
- Nintendo NES/SNES Classic Edition
|
||||
- PlayStation3
|
||||
- Xbox 360 (Libxenon/XeXDK)
|
||||
- Xbox 1
|
||||
- Wii, Gamecube (Libogc)
|
||||
- Nintendo 3DS
|
||||
- Raspberry Pi
|
||||
- Android
|
||||
- iOS
|
||||
@@ -108,6 +78,7 @@ OSX port of RetroArch requires latest versions of XCode to build.
|
||||
RetroArch can utilize these libraries if enabled:
|
||||
|
||||
- nvidia-cg-toolkit
|
||||
- libxml2 (GLSL XML shaders)
|
||||
- libfreetype2 (TTF font rendering on screen)
|
||||
|
||||
RetroArch needs at least one of these audio driver libraries:
|
||||
@@ -124,7 +95,7 @@ RetroArch needs at least one of these audio driver libraries:
|
||||
- DirectSound (Win32, Xbox 1)
|
||||
- CoreAudio (OSX, iOS)
|
||||
|
||||
To run properly, RetroArch requires a libretro implementation present; however, as it's typically loaded
|
||||
To run properly, RetroArch requires a libretro implementation present, however, as it's typically loaded
|
||||
dynamically, it's not required at build time.
|
||||
|
||||
## Dependencies (Console ports, mobile)
|
||||
@@ -134,148 +105,102 @@ anything other than what the respective SDKs provide.
|
||||
|
||||
## Configuring
|
||||
|
||||
The default configuration is defined in `config.def.h`.
|
||||
The default configuration is defined in config.def.h.
|
||||
It is not recommended to change this unless you know what you're doing.
|
||||
These can later be tweaked by using a config file.
|
||||
A sample configuration file is installed to `/etc/retroarch.cfg`. This is the system-wide config file.
|
||||
A sample configuration file is installed to /etc/retroarch.cfg. This is the system-wide config file.
|
||||
|
||||
RetroArch will on startup create a config file in `$XDG\_CONFIG\_HOME/retroarch/retroarch.cfg` if it does not exist.
|
||||
RetroArch will on startup create a config file in $XDG\_CONFIG\_HOME/retroarch/retroarch.cfg if doesn't exist.
|
||||
Users only need to configure a certain option if the desired value deviates from the value defined in config.def.h.
|
||||
|
||||
To configure joypads, use the built-in menu or the `retroarch-joyconfig` command-line tool.
|
||||
To configure joypads, use the built-in menu or the <tt>retroarch-joyconfig</tt> command-line tool.
|
||||
|
||||
## Compiling and installing
|
||||
<b>Linux</b><br/>
|
||||
- Prerequisites:
|
||||
```bash
|
||||
sudo apt-get install -y make git-core curl g++ pkg-config libglu1-mesa-dev freeglut3-dev mesa-common-dev libsdl1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev
|
||||
```
|
||||
- Compiling:
|
||||
```bash
|
||||
./configure
|
||||
make
|
||||
```
|
||||
|
||||
Instructions for compiling and installing RetroArch can be found in the [Libretro/RetroArch Documentation Center](https://docs.libretro.com/).
|
||||
<b>Mac</b><br/>
|
||||
- Prerequisites: [XCode](https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CB4QFjAA&url=https%3A%2F%2Fitunes.apple.com%2Fus%2Fapp%2Fxcode%2Fid497799835%3Fmt%3D12&ei=ZmfeVNPtIILVoASBnoCYBw&usg=AFQjCNGrxKmVtXUdvUU3MhqZhP4MHT6Gtg&sig2=RIXKsWQ79YTQBt_lK5fdKA&bvm=bv.85970519,d.cGU), [Cg](https://developer.nvidia.com/cg-toolkit-download).
|
||||
- You can open the project (**pkg/apple/RetroArch.xcodeproj**) in the Xcode IDE and build (**⌘-B**) and run (**⌘-R**) it there. Or you can use the command line...
|
||||
- Debug:
|
||||
```bash
|
||||
# Build
|
||||
xcodebuild -target RetroArch -configuration Debug -project pkg/apple/RetroArch.xcodeproj
|
||||
# Run
|
||||
open ./pkg/apple/build/Debug/RetroArch.app/
|
||||
```
|
||||
- Release:
|
||||
```bash
|
||||
# Build
|
||||
xcodebuild -target RetroArch -configuration Release -project pkg/apple/RetroArch.xcodeproj
|
||||
# Run
|
||||
open ./pkg/apple/build/Release/RetroArch.app/
|
||||
```
|
||||
|
||||
## CRT 15Khz Resolution Switching
|
||||
<b>PC</b><br/>
|
||||
Instructions for compiling on PC can be found in the [wiki](https://github.com/Themaister/RetroArch/wiki).
|
||||
|
||||
CRT SwitchRes will turn on, on the fly. However, you will need to restart RetroArch to disable it. With CRT SwitchRes enable RetroArch will start in 2560 x 480 @ 60.
|
||||
<b>PlayStation3</b><br/>
|
||||
|
||||
If you are running Windows, before enabling the CRT SwitchRes options please make sure you have installed CRTEmudriver and installed some modelines. The minimum modelines for all games to switch correctly are:
|
||||
RetroArch PS3 needs to be compiled in the following order:
|
||||
|
||||
- 2560 x 192 @ 60.000000
|
||||
- 2560 x 200 @ 60.000000
|
||||
- 2560 x 240 @ 60.000000
|
||||
- 2560 x 224 @ 60.000000
|
||||
- 2560 x 237 @ 60.000000
|
||||
- 2560 x 256 @ 50.000000
|
||||
- 2560 x 254 @ 55.000000
|
||||
- 2560 x 448 @ 60.000000
|
||||
- 2560 x 480 @ 60.000000
|
||||
1) Compile RetroArch Salamander
|
||||
|
||||
Install these modelines replacing 2560 with your desired super resolution. The above resolutions are NTSC only so if you would be playing any PAL content please add PAL modelines:
|
||||
<tt>make -f Makefile.ps3.salamander</tt>
|
||||
|
||||
- 2560 x 192 @ 50.000000
|
||||
- 2560 x 200 @ 50.000000
|
||||
- 2560 x 240 @ 50.000000
|
||||
- 2560 x 224 @ 50.000000
|
||||
- 2560 x 288 @ 50.000000
|
||||
- 2560 x 237 @ 50.000000
|
||||
- 2560 x 254 @ 55.000000
|
||||
- 2560 x 448 @ 50.000000
|
||||
- 2560 x 480 @ 50.000000
|
||||
2) Finally, compile RetroArch packed together with the GUI:
|
||||
|
||||
Some games will require higher PAL resolutions which should also be installed:
|
||||
<tt>make -f Makefile.ps3</tt>
|
||||
|
||||
- 2560 x 512 @ 50.000000
|
||||
- 2560 x 576 @ 50.000000
|
||||
<b>PlayStation3 - Creating a PKG installable file</b><br />
|
||||
|
||||
Ideally install all these modelines and everything will work great.
|
||||
You can add `pkg` as a parameter in order to make a PKG file - for example:
|
||||
|
||||
## Super Resolutions
|
||||
<tt>make -f Makefile.ps3 pkg</tt>
|
||||
|
||||
The default super resolution is 2560. It is displayed just under the CRT switch option, which can be found in video settings. This can be changed within the retroarch.cfg. The only compatible resolutions are 1920, 2560 and 3840. Any other resolutions will be ignored and native switching will be activated.
|
||||
This creates an NPDRM package. This can be installed on debug PS3s.
|
||||
|
||||
## Native Resolutions
|
||||
To make a non-NPDRM package that can be installed on a jailbroken/CFW PS3 (such as PSGroove or PS3 CFWs and other 3.55 CFW derivatives), do:
|
||||
|
||||
If native resolutions are activated you will need a whole new set of modelines:
|
||||
<tt>make -f Makefile.ps3 pkg-signed</tt>
|
||||
|
||||
- 256 x 240 @ 50.006977 SNESpal
|
||||
- 256 x 448 @ 50.006977 SNESpal
|
||||
- 512 x 224 @ 50.006977 SNESpal
|
||||
- 512 x 240 @ 50.006977 SNESpal
|
||||
- 512 x 448 @ 50.006977 SNESpal
|
||||
- 256 x 240 @ 60.098812 SNESntsc
|
||||
- 256 x 448 @ 60.098812 SNESntsc
|
||||
- 512 x 240 @ 60.098812 SNESntsc
|
||||
- 512 x 224 @ 60.098812 SNESntsc
|
||||
- 512 x 448 @ 60.098812 SNESntsc
|
||||
- 256 x 192 @ 59.922745 MDntsc
|
||||
- 256 x 224 @ 59.922745 MDntsc
|
||||
- 320 x 224 @ 59.922745 MDntsc
|
||||
- 320 x 240 @ 59.922745 MDntsc
|
||||
- 320 x 448 @ 59.922745 MDntsc
|
||||
- 320 x 480 @ 59.922745 MDntsc
|
||||
- 256 x 192 @ 49.701458 MDpal
|
||||
- 256 x 224 @ 49.701458 MDpal
|
||||
- 320 x 224 @ 49.701458 MDpal
|
||||
- 320 x 240 @ 49.701458 MDpal
|
||||
- 320 x 288 @ 49.701458 MDpal
|
||||
- 320 x 448 @ 49.701458 MDpal
|
||||
- 320 x 480 @ 49.701458 MDpal
|
||||
- 320 x 576 @ 49.701458 MDpal
|
||||
- 256 x 288 @ 49.701458 MSYSpal
|
||||
- 256 x 240 @ 60.098812 NESntsc
|
||||
- 256 x 240 @ 50.006977 NESpal
|
||||
If you're using Kmeaw 3.55 firmware, the package needs to be signed:
|
||||
|
||||
- 640 x 237 @ 60.130001 N64ntsc
|
||||
- 640 x 240 @ 60.130001 N64ntsc
|
||||
- 640 x 480 @ 60.130001 N64ntsc
|
||||
- 640 x 288 @ 50.000000 N64pal
|
||||
- 640 x 480 @ 50.000000 N64pal
|
||||
- 640 x 576 @ 50.000000 N64pal
|
||||
<tt>make -f Makefile.ps3 pkg-signed-cfw</tt>
|
||||
|
||||
- 256 x 252 @ 49.759998 PSXpal
|
||||
- 320 x 252 @ 49.759998 PSXpal
|
||||
- 384 x 252 @ 49.759998 PSXpal
|
||||
- 640 x 252 @ 49.759998 PSXpal
|
||||
- 640 x 540 @ 49.759998 PSXpal
|
||||
NOTE: A pre-existing libretro library needs to be present in the root directory in order to link RetroArch PS3. This file needs to be called <em><b>`libretro_ps3.a`</b></em>.
|
||||
|
||||
- 384 x 240 @ 59.941002 PSXntsc
|
||||
- 256 x 480 @ 59.941002 PSXntsc
|
||||
<b> Xbox 360 (XeXDK)</b><br />
|
||||
|
||||
- 352 x 240 @ 59.820000 Saturn/SGFX_NTSCp
|
||||
- 704 x 240 @ 59.820000 SaturnNTSCp
|
||||
- 352 x 480 @ 59.820000 SaturnNTSCi
|
||||
- 704 x 480 @ 59.820000 SaturnNTSCi
|
||||
- 352 x 288 @ 49.701458 SaturnPALp
|
||||
- 704 x 288 @ 49.701458 SaturnPALp
|
||||
- 352 x 576 @ 49.701458 SaturnPALi
|
||||
- 704 x 576 @ 49.701458 SaturnPALi
|
||||
You will need Microsoft Visual Studio 2010 installed (or higher) in order to compile RetroArch 360.
|
||||
|
||||
- 240 x 160 @ 59.730000 GBA
|
||||
- 320 x 200 @ 60.000000 Doom
|
||||
The solution file can be found at the following location:
|
||||
|
||||
// Arcade
|
||||
<tt>pkg/msvc-360/RetroArch-360.sln</tt>
|
||||
|
||||
- 400 x 254 @ 54.706841 MK
|
||||
- 384 x 224 @ 59.637405 CPS1
|
||||
NOTE: A pre-existing libretro library needs to be present in the `pkg/msvc-360/RetroArch-360/Release` directory in order to link RetroArch 360. This file needs to be
|
||||
called <em><b>`libretro_xdk360.lib`</b></em>.
|
||||
|
||||
These modelines are more accurate giving exact hz. However, some games may have unwanted results. This is due to mid-scanline resolution changes on the original hardware. For the best results super resolutions are the way to go.
|
||||
<b> Xbox 360 (Libxenon)</b><br />
|
||||
|
||||
## CRT resolution switching & MAME
|
||||
You will need to have the libxenon libraries and a working Devkit Xenon toolchain installed in order to compile RetroArch 360 Libxenon.
|
||||
|
||||
Some arcade resolutions can be very different from consumer CRTs. There is resolution detection to ensure MAME games will be displayed in the closest available resolution but drawn at their native resolution within this resolution. Meaning that the MAME game will look just like the original hardware.
|
||||
<tt>make -f Makefile.xenon</tt>
|
||||
|
||||
MAME ROMs that run in a vertical aspect like DoDonPachi need to be rotated within MAME before resolution switching and aspect correction will work. Do this before enabling CRT SwitchRes so that RetroArch will run in your desktop resolution. Once you have rotated any games that may need it turn CRT SwitchRes on.
|
||||
NOTE: A pre-existing libretro library needs to be present in the root directory in order to link RetroArch 360 Libxenon. This file needs to be called <em><b>`libretro_xenon360.a`</b></em>.
|
||||
|
||||
## Socials
|
||||
<b> Wii</b><br >
|
||||
|
||||
The links below belong to our official channels. Links other than this may have been created by fans, independent members or followers. We seriously recommend using our original resources.
|
||||
You will need to have the libogc libraries and a working Devkit PPC toolchain installed in order to compile RetroArch Wii.
|
||||
|
||||
- [Website](https://www.retroarch.com/)
|
||||
- [Blog](https://libretro.com/)
|
||||
- [Facebook](https://www.facebook.com/libretro)
|
||||
- [Twitter](https://twitter.com/libretro)
|
||||
- [Reddit](https://www.reddit.com/r/RetroArch/)
|
||||
- [YouTube](https://www.youtube.com/Libretro)
|
||||
- [Google Post](https://posts.google.com/share/55Nhs2jG)
|
||||
- [Steam](https://store.steampowered.com/app/1118310/RetroArch/)
|
||||
- [YouTube Topic](https://www.youtube.com/channel/UC5q007PYyQPgin0HHbzF0zQ)
|
||||
- [Patreon](https://www.patreon.com/libretro)
|
||||
- [BOUNTYSOURCE](https://www.bountysource.com/teams/libretro/issues)
|
||||
- [Discord](https://discord.gg/27Xxm2h)
|
||||
- [Teespring](https://teespring.com/stores/retroarch)
|
||||
- [Documentation](https://docs.libretro.com/)
|
||||
- [Forum](https://forums.libretro.com/)
|
||||
<tt>make -f Makefile.griffin platform=wii</tt>
|
||||
|
||||
NOTE: A pre-existing libretro library needs to be present in the root directory in order to link RetroArch Wii. This file needs to be called <em><b>`libretro_wii.a`</b></em>.
|
||||
@@ -1,42 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __RETROARCH_ACCESSIBILITY_H
|
||||
#define __RETROARCH_ACCESSIBILITY_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <boolean.h>
|
||||
#include <retro_inline.h>
|
||||
#include <retro_common_api.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
bool is_accessibility_enabled(void);
|
||||
|
||||
bool accessibility_speak_priority(const char* speak_text, int priority);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
@@ -1,88 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __AUDIO_DEFINES__H
|
||||
#define __AUDIO_DEFINES__H
|
||||
|
||||
#include <retro_common_api.h>
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
#define AUDIO_CHUNK_SIZE_BLOCKING 512
|
||||
|
||||
/* So we don't get complete line-noise when fast-forwarding audio. */
|
||||
#define AUDIO_CHUNK_SIZE_NONBLOCKING 2048
|
||||
|
||||
#define AUDIO_MAX_RATIO 16
|
||||
|
||||
#define AUDIO_MIXER_MAX_STREAMS 16
|
||||
|
||||
#define AUDIO_MIXER_MAX_SYSTEM_STREAMS (AUDIO_MIXER_MAX_STREAMS + 4)
|
||||
|
||||
/* do not define more than (MAX_SYSTEM_STREAMS - MAX_STREAMS) */
|
||||
enum audio_mixer_system_slot
|
||||
{
|
||||
AUDIO_MIXER_SYSTEM_SLOT_OK = AUDIO_MIXER_MAX_STREAMS,
|
||||
AUDIO_MIXER_SYSTEM_SLOT_CANCEL,
|
||||
AUDIO_MIXER_SYSTEM_SLOT_NOTICE,
|
||||
AUDIO_MIXER_SYSTEM_SLOT_BGM
|
||||
};
|
||||
|
||||
enum audio_action
|
||||
{
|
||||
AUDIO_ACTION_NONE = 0,
|
||||
AUDIO_ACTION_RATE_CONTROL_DELTA,
|
||||
AUDIO_ACTION_MIXER_MUTE_ENABLE,
|
||||
AUDIO_ACTION_MUTE_ENABLE,
|
||||
AUDIO_ACTION_VOLUME_GAIN,
|
||||
AUDIO_ACTION_MIXER_VOLUME_GAIN,
|
||||
AUDIO_ACTION_MIXER
|
||||
};
|
||||
|
||||
enum audio_mixer_slot_selection_type
|
||||
{
|
||||
AUDIO_MIXER_SLOT_SELECTION_AUTOMATIC = 0,
|
||||
AUDIO_MIXER_SLOT_SELECTION_MANUAL
|
||||
};
|
||||
|
||||
enum audio_mixer_stream_type
|
||||
{
|
||||
AUDIO_STREAM_TYPE_NONE = 0,
|
||||
AUDIO_STREAM_TYPE_USER,
|
||||
AUDIO_STREAM_TYPE_SYSTEM
|
||||
};
|
||||
|
||||
enum audio_mixer_state
|
||||
{
|
||||
AUDIO_STREAM_STATE_NONE = 0,
|
||||
AUDIO_STREAM_STATE_STOPPED,
|
||||
AUDIO_STREAM_STATE_PLAYING,
|
||||
AUDIO_STREAM_STATE_PLAYING_LOOPED,
|
||||
AUDIO_STREAM_STATE_PLAYING_SEQUENTIAL
|
||||
};
|
||||
|
||||
typedef struct audio_statistics
|
||||
{
|
||||
float average_buffer_saturation;
|
||||
float std_deviation_percentage;
|
||||
float close_to_underrun;
|
||||
float close_to_blocking;
|
||||
unsigned samples;
|
||||
} audio_statistics_t;
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,942 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <retro_assert.h>
|
||||
|
||||
#include "audio_driver.h"
|
||||
#include "audio_resampler_driver.h"
|
||||
#include "../record/record_driver.h"
|
||||
#include "audio_utils.h"
|
||||
#include "audio_thread_wrapper.h"
|
||||
|
||||
#include "../command_event.h"
|
||||
#include "../configuration.h"
|
||||
#include "../general.h"
|
||||
#include "../performance.h"
|
||||
#include "../verbosity.h"
|
||||
#include "../string_list_special.h"
|
||||
|
||||
#ifdef HAVE_NETPLAY
|
||||
#include "../netplay/netplay.h"
|
||||
#endif
|
||||
|
||||
#ifndef AUDIO_BUFFER_FREE_SAMPLES_COUNT
|
||||
#define AUDIO_BUFFER_FREE_SAMPLES_COUNT (8 * 1024)
|
||||
#endif
|
||||
|
||||
typedef struct audio_driver_input_data
|
||||
{
|
||||
float *data;
|
||||
|
||||
size_t data_ptr;
|
||||
struct
|
||||
{
|
||||
size_t size;
|
||||
size_t nonblock_size;
|
||||
size_t block_size;
|
||||
} chunk;
|
||||
|
||||
|
||||
struct
|
||||
{
|
||||
float input;
|
||||
bool control;
|
||||
struct
|
||||
{
|
||||
double original;
|
||||
double current;
|
||||
} source_ratio;
|
||||
} audio_rate;
|
||||
|
||||
bool use_float;
|
||||
|
||||
struct
|
||||
{
|
||||
int16_t *buf;
|
||||
size_t ptr;
|
||||
size_t size;
|
||||
} rewind;
|
||||
|
||||
rarch_dsp_filter_t *dsp;
|
||||
|
||||
size_t driver_buffer_size;
|
||||
|
||||
float volume_gain;
|
||||
|
||||
struct
|
||||
{
|
||||
float *buf;
|
||||
int16_t *conv_buf;
|
||||
} output_samples;
|
||||
|
||||
struct
|
||||
{
|
||||
unsigned buf[AUDIO_BUFFER_FREE_SAMPLES_COUNT];
|
||||
uint64_t count;
|
||||
} free_samples;
|
||||
} audio_driver_input_data_t;
|
||||
|
||||
static const audio_driver_t *audio_drivers[] = {
|
||||
#ifdef HAVE_ALSA
|
||||
&audio_alsa,
|
||||
#ifndef __QNX__
|
||||
&audio_alsathread,
|
||||
#endif
|
||||
#endif
|
||||
#if defined(HAVE_OSS) || defined(HAVE_OSS_BSD)
|
||||
&audio_oss,
|
||||
#endif
|
||||
#ifdef HAVE_RSOUND
|
||||
&audio_rsound,
|
||||
#endif
|
||||
#ifdef HAVE_COREAUDIO
|
||||
&audio_coreaudio,
|
||||
#endif
|
||||
#ifdef HAVE_AL
|
||||
&audio_openal,
|
||||
#endif
|
||||
#ifdef HAVE_SL
|
||||
&audio_opensl,
|
||||
#endif
|
||||
#ifdef HAVE_ROAR
|
||||
&audio_roar,
|
||||
#endif
|
||||
#ifdef HAVE_JACK
|
||||
&audio_jack,
|
||||
#endif
|
||||
#if defined(HAVE_SDL) || defined(HAVE_SDL2)
|
||||
&audio_sdl,
|
||||
#endif
|
||||
#ifdef HAVE_XAUDIO
|
||||
&audio_xa,
|
||||
#endif
|
||||
#ifdef HAVE_DSOUND
|
||||
&audio_dsound,
|
||||
#endif
|
||||
#ifdef HAVE_PULSE
|
||||
&audio_pulse,
|
||||
#endif
|
||||
#ifdef __CELLOS_LV2__
|
||||
&audio_ps3,
|
||||
#endif
|
||||
#ifdef XENON
|
||||
&audio_xenon360,
|
||||
#endif
|
||||
#ifdef GEKKO
|
||||
&audio_gx,
|
||||
#endif
|
||||
#ifdef EMSCRIPTEN
|
||||
&audio_rwebaudio,
|
||||
#endif
|
||||
#if defined(PSP) || defined(VITA)
|
||||
&audio_psp,
|
||||
#endif
|
||||
#ifdef _3DS
|
||||
&audio_ctr_csnd,
|
||||
&audio_ctr_dsp,
|
||||
#endif
|
||||
&audio_null,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static audio_driver_input_data_t audio_driver_data;
|
||||
static const audio_driver_t *current_audio = NULL;
|
||||
static void *audio_driver_context_audio_data = NULL;
|
||||
|
||||
/**
|
||||
* compute_audio_buffer_statistics:
|
||||
*
|
||||
* Computes audio buffer statistics.
|
||||
*
|
||||
**/
|
||||
static void compute_audio_buffer_statistics(void)
|
||||
{
|
||||
unsigned i, low_water_size, high_water_size, avg, stddev;
|
||||
float avg_filled, deviation;
|
||||
uint64_t accum = 0;
|
||||
uint64_t accum_var = 0;
|
||||
unsigned low_water_count = 0;
|
||||
unsigned high_water_count = 0;
|
||||
unsigned samples = MIN(
|
||||
audio_driver_data.free_samples.count,
|
||||
AUDIO_BUFFER_FREE_SAMPLES_COUNT);
|
||||
|
||||
if (samples < 3)
|
||||
return;
|
||||
|
||||
for (i = 1; i < samples; i++)
|
||||
accum += audio_driver_data.free_samples.buf[i];
|
||||
|
||||
avg = accum / (samples - 1);
|
||||
|
||||
for (i = 1; i < samples; i++)
|
||||
{
|
||||
int diff = avg - audio_driver_data.free_samples.buf[i];
|
||||
accum_var += diff * diff;
|
||||
}
|
||||
|
||||
stddev = (unsigned)sqrt((double)accum_var / (samples - 2));
|
||||
avg_filled = 1.0f - (float)avg / audio_driver_data.driver_buffer_size;
|
||||
deviation = (float)stddev / audio_driver_data.driver_buffer_size;
|
||||
|
||||
low_water_size = audio_driver_data.driver_buffer_size * 3 / 4;
|
||||
high_water_size = audio_driver_data.driver_buffer_size / 4;
|
||||
|
||||
for (i = 1; i < samples; i++)
|
||||
{
|
||||
if (audio_driver_data.free_samples.buf[i] >= low_water_size)
|
||||
low_water_count++;
|
||||
else if (audio_driver_data.free_samples.buf[i] <= high_water_size)
|
||||
high_water_count++;
|
||||
}
|
||||
|
||||
RARCH_LOG("Average audio buffer saturation: %.2f %%, standard deviation (percentage points): %.2f %%.\n",
|
||||
avg_filled * 100.0, deviation * 100.0);
|
||||
RARCH_LOG("Amount of time spent close to underrun: %.2f %%. Close to blocking: %.2f %%.\n",
|
||||
(100.0 * low_water_count) / (samples - 1),
|
||||
(100.0 * high_water_count) / (samples - 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* audio_driver_find_handle:
|
||||
* @idx : index of driver to get handle to.
|
||||
*
|
||||
* Returns: handle to audio driver at index. Can be NULL
|
||||
* if nothing found.
|
||||
**/
|
||||
const void *audio_driver_find_handle(int idx)
|
||||
{
|
||||
const void *drv = audio_drivers[idx];
|
||||
if (!drv)
|
||||
return NULL;
|
||||
return drv;
|
||||
}
|
||||
|
||||
/**
|
||||
* audio_driver_find_ident:
|
||||
* @idx : index of driver to get handle to.
|
||||
*
|
||||
* Returns: Human-readable identifier of audio driver at index. Can be NULL
|
||||
* if nothing found.
|
||||
**/
|
||||
const char *audio_driver_find_ident(int idx)
|
||||
{
|
||||
const audio_driver_t *drv = audio_drivers[idx];
|
||||
if (!drv)
|
||||
return NULL;
|
||||
return drv->ident;
|
||||
}
|
||||
|
||||
/**
|
||||
* config_get_audio_driver_options:
|
||||
*
|
||||
* Get an enumerated list of all audio driver names, separated by '|'.
|
||||
*
|
||||
* Returns: string listing of all audio driver names, separated by '|'.
|
||||
**/
|
||||
const char *config_get_audio_driver_options(void)
|
||||
{
|
||||
return char_list_new_special(STRING_LIST_AUDIO_DRIVERS, NULL);
|
||||
}
|
||||
|
||||
|
||||
static bool uninit_audio(void)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (current_audio && current_audio->free)
|
||||
{
|
||||
if (audio_driver_context_audio_data)
|
||||
current_audio->free(audio_driver_context_audio_data);
|
||||
audio_driver_context_audio_data = NULL;
|
||||
}
|
||||
|
||||
if (audio_driver_data.output_samples.conv_buf)
|
||||
free(audio_driver_data.output_samples.conv_buf);
|
||||
audio_driver_data.output_samples.conv_buf = NULL;
|
||||
audio_driver_data.data_ptr = 0;
|
||||
|
||||
if (audio_driver_data.rewind.buf)
|
||||
free(audio_driver_data.rewind.buf);
|
||||
audio_driver_data.rewind.buf = NULL;
|
||||
audio_driver_data.rewind.size = 0;
|
||||
|
||||
if (!settings->audio.enable)
|
||||
{
|
||||
audio_driver_ctl(RARCH_AUDIO_CTL_UNSET_ACTIVE, NULL);
|
||||
return false;
|
||||
}
|
||||
|
||||
audio_driver_ctl(RARCH_AUDIO_CTL_RESAMPLER_DEINIT, NULL);
|
||||
|
||||
if (audio_driver_data.data)
|
||||
free(audio_driver_data.data);
|
||||
audio_driver_data.data = NULL;
|
||||
|
||||
if (audio_driver_data.output_samples.buf)
|
||||
free(audio_driver_data.output_samples.buf);
|
||||
audio_driver_data.output_samples.buf = NULL;
|
||||
|
||||
event_cmd_ctl(EVENT_CMD_DSP_FILTER_DEINIT, NULL);
|
||||
|
||||
compute_audio_buffer_statistics();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool init_audio(bool audio_cb_inited)
|
||||
{
|
||||
size_t outsamples_max, max_bufsamples = AUDIO_CHUNK_SIZE_NONBLOCKING * 2;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
audio_convert_init_simd();
|
||||
|
||||
/* Accomodate rewind since at some point we might have two full buffers. */
|
||||
outsamples_max = max_bufsamples * AUDIO_MAX_RATIO *
|
||||
settings->slowmotion_ratio;
|
||||
|
||||
/* Used for recording even if audio isn't enabled. */
|
||||
retro_assert(audio_driver_data.output_samples.conv_buf =
|
||||
(int16_t*)malloc(outsamples_max * sizeof(int16_t)));
|
||||
|
||||
if (!audio_driver_data.output_samples.conv_buf)
|
||||
goto error;
|
||||
|
||||
audio_driver_data.chunk.block_size = AUDIO_CHUNK_SIZE_BLOCKING;
|
||||
audio_driver_data.chunk.nonblock_size = AUDIO_CHUNK_SIZE_NONBLOCKING;
|
||||
audio_driver_data.chunk.size = audio_driver_data.chunk.block_size;
|
||||
|
||||
/* Needs to be able to hold full content of a full max_bufsamples
|
||||
* in addition to its own. */
|
||||
retro_assert(audio_driver_data.rewind.buf = (int16_t*)
|
||||
malloc(max_bufsamples * sizeof(int16_t)));
|
||||
|
||||
if (!audio_driver_data.rewind.buf)
|
||||
goto error;
|
||||
|
||||
audio_driver_data.rewind.size = max_bufsamples;
|
||||
|
||||
if (!settings->audio.enable)
|
||||
{
|
||||
audio_driver_ctl(RARCH_AUDIO_CTL_UNSET_ACTIVE, NULL);
|
||||
return false;
|
||||
}
|
||||
|
||||
audio_driver_ctl(RARCH_AUDIO_CTL_FIND_DRIVER, NULL);
|
||||
#ifdef HAVE_THREADS
|
||||
if (audio_cb_inited)
|
||||
{
|
||||
RARCH_LOG("Starting threaded audio driver ...\n");
|
||||
if (!rarch_threaded_audio_init(
|
||||
¤t_audio,
|
||||
&audio_driver_context_audio_data,
|
||||
*settings->audio.device ? settings->audio.device : NULL,
|
||||
settings->audio.out_rate, settings->audio.latency,
|
||||
current_audio))
|
||||
{
|
||||
RARCH_ERR("Cannot open threaded audio driver ... Exiting ...\n");
|
||||
retro_fail(1, "init_audio()");
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
audio_driver_context_audio_data =
|
||||
current_audio->init(*settings->audio.device ?
|
||||
settings->audio.device : NULL,
|
||||
settings->audio.out_rate, settings->audio.latency);
|
||||
}
|
||||
|
||||
if (!audio_driver_context_audio_data)
|
||||
{
|
||||
RARCH_ERR("Failed to initialize audio driver. Will continue without audio.\n");
|
||||
audio_driver_ctl(RARCH_AUDIO_CTL_UNSET_ACTIVE, NULL);
|
||||
}
|
||||
|
||||
audio_driver_data.use_float = false;
|
||||
if ( audio_driver_ctl(RARCH_AUDIO_CTL_IS_ACTIVE, NULL)
|
||||
&& current_audio->use_float(audio_driver_context_audio_data))
|
||||
audio_driver_data.use_float = true;
|
||||
|
||||
if (!settings->audio.sync && audio_driver_ctl(RARCH_AUDIO_CTL_IS_ACTIVE, NULL))
|
||||
{
|
||||
event_cmd_ctl(EVENT_CMD_AUDIO_SET_NONBLOCKING_STATE, NULL);
|
||||
audio_driver_data.chunk.size = audio_driver_data.chunk.nonblock_size;
|
||||
}
|
||||
|
||||
if (audio_driver_data.audio_rate.input <= 0.0f)
|
||||
{
|
||||
/* Should never happen. */
|
||||
RARCH_WARN("Input rate is invalid (%.3f Hz). Using output rate (%u Hz).\n",
|
||||
audio_driver_data.audio_rate.input, settings->audio.out_rate);
|
||||
audio_driver_data.audio_rate.input = settings->audio.out_rate;
|
||||
}
|
||||
|
||||
audio_driver_data.audio_rate.source_ratio.original =
|
||||
audio_driver_data.audio_rate.source_ratio.current =
|
||||
(double)settings->audio.out_rate / audio_driver_data.audio_rate.input;
|
||||
|
||||
if (!audio_driver_ctl(RARCH_AUDIO_CTL_RESAMPLER_INIT, NULL))
|
||||
{
|
||||
RARCH_ERR("Failed to initialize resampler \"%s\".\n",
|
||||
settings->audio.resampler);
|
||||
audio_driver_ctl(RARCH_AUDIO_CTL_UNSET_ACTIVE, NULL);
|
||||
}
|
||||
|
||||
retro_assert(audio_driver_data.data = (float*)
|
||||
malloc(max_bufsamples * sizeof(float)));
|
||||
|
||||
if (!audio_driver_data.data)
|
||||
goto error;
|
||||
|
||||
audio_driver_data.data_ptr = 0;
|
||||
|
||||
retro_assert(settings->audio.out_rate <
|
||||
audio_driver_data.audio_rate.input * AUDIO_MAX_RATIO);
|
||||
retro_assert(audio_driver_data.output_samples.buf = (float*)
|
||||
malloc(outsamples_max * sizeof(float)));
|
||||
|
||||
if (!audio_driver_data.output_samples.buf)
|
||||
goto error;
|
||||
|
||||
audio_driver_data.audio_rate.control = false;
|
||||
if (
|
||||
!audio_cb_inited
|
||||
&& audio_driver_ctl(RARCH_AUDIO_CTL_IS_ACTIVE, NULL)
|
||||
&& settings->audio.rate_control
|
||||
)
|
||||
{
|
||||
/* Audio rate control requires write_avail
|
||||
* and buffer_size to be implemented. */
|
||||
if (current_audio->buffer_size)
|
||||
{
|
||||
audio_driver_data.driver_buffer_size =
|
||||
current_audio->buffer_size(audio_driver_context_audio_data);
|
||||
audio_driver_data.audio_rate.control = true;
|
||||
}
|
||||
else
|
||||
RARCH_WARN("Audio rate control was desired, but driver does not support needed features.\n");
|
||||
}
|
||||
|
||||
event_cmd_ctl(EVENT_CMD_DSP_FILTER_INIT, NULL);
|
||||
|
||||
audio_driver_data.free_samples.count = 0;
|
||||
|
||||
/* Threaded driver is initially stopped. */
|
||||
if (
|
||||
audio_driver_ctl(RARCH_AUDIO_CTL_IS_ACTIVE, NULL)
|
||||
&& !settings->audio.mute_enable
|
||||
&& audio_cb_inited
|
||||
)
|
||||
audio_driver_ctl(RARCH_AUDIO_CTL_START, NULL);
|
||||
|
||||
return true;
|
||||
|
||||
error:
|
||||
return audio_driver_ctl(RARCH_AUDIO_CTL_DEINIT, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* audio_driver_readjust_input_rate:
|
||||
*
|
||||
* Readjust the audio input rate.
|
||||
*/
|
||||
static void audio_driver_readjust_input_rate(void)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned write_idx = audio_driver_data.free_samples.count++ &
|
||||
(AUDIO_BUFFER_FREE_SAMPLES_COUNT - 1);
|
||||
int half_size = audio_driver_data.driver_buffer_size / 2;
|
||||
int avail =
|
||||
current_audio->write_avail(audio_driver_context_audio_data);
|
||||
int delta_mid = avail - half_size;
|
||||
double direction = (double)delta_mid / half_size;
|
||||
double adjust = 1.0 + settings->audio.rate_control_delta * direction;
|
||||
|
||||
#if 0
|
||||
RARCH_LOG_OUTPUT("Audio buffer is %u%% full\n",
|
||||
(unsigned)(100 - (avail * 100) / audio_driver_data.driver_buffer_size));
|
||||
#endif
|
||||
|
||||
audio_driver_data.free_samples.buf[write_idx] = avail;
|
||||
audio_driver_data.audio_rate.source_ratio.current =
|
||||
audio_driver_data.audio_rate.source_ratio.original * adjust;
|
||||
|
||||
#if 0
|
||||
RARCH_LOG_OUTPUT("New rate: %lf, Orig rate: %lf\n",
|
||||
audio_driver_data.audio_rate.source_ratio.current,
|
||||
audio_driver_data.audio_rate.source_ratio.original);
|
||||
#endif
|
||||
}
|
||||
|
||||
void audio_driver_set_nonblocking_state(bool enable)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
if (
|
||||
audio_driver_ctl(RARCH_AUDIO_CTL_IS_ACTIVE, NULL)
|
||||
&& audio_driver_context_audio_data
|
||||
)
|
||||
current_audio->set_nonblock_state(audio_driver_context_audio_data,
|
||||
settings->audio.sync ? enable : true);
|
||||
|
||||
audio_driver_data.chunk.size = enable ?
|
||||
audio_driver_data.chunk.nonblock_size :
|
||||
audio_driver_data.chunk.block_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* audio_driver_flush:
|
||||
* @data : pointer to audio buffer.
|
||||
* @right : amount of samples to write.
|
||||
*
|
||||
* Writes audio samples to audio driver. Will first
|
||||
* perform DSP processing (if enabled) and resampling.
|
||||
*
|
||||
* Returns: true (1) if audio samples were written to the audio
|
||||
* driver, false (0) in case of an error.
|
||||
**/
|
||||
static bool audio_driver_flush(const int16_t *data, size_t samples)
|
||||
{
|
||||
static struct retro_perf_counter audio_convert_s16 = {0};
|
||||
static struct retro_perf_counter audio_convert_float = {0};
|
||||
static struct retro_perf_counter audio_dsp = {0};
|
||||
struct resampler_data src_data = {0};
|
||||
struct rarch_dsp_data dsp_data = {0};
|
||||
const void *output_data = NULL;
|
||||
unsigned output_frames = 0;
|
||||
size_t output_size = sizeof(float);
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
recording_push_audio(data, samples);
|
||||
|
||||
if (runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL) || settings->audio.mute_enable)
|
||||
return true;
|
||||
if (!audio_driver_ctl(RARCH_AUDIO_CTL_IS_ACTIVE, NULL))
|
||||
return false;
|
||||
if (!audio_driver_data.data)
|
||||
return false;
|
||||
|
||||
rarch_perf_init(&audio_convert_s16, "audio_convert_s16");
|
||||
retro_perf_start(&audio_convert_s16);
|
||||
audio_convert_s16_to_float(audio_driver_data.data, data, samples,
|
||||
audio_driver_data.volume_gain);
|
||||
retro_perf_stop(&audio_convert_s16);
|
||||
|
||||
src_data.data_in = audio_driver_data.data;
|
||||
src_data.input_frames = samples >> 1;
|
||||
|
||||
dsp_data.input = audio_driver_data.data;
|
||||
dsp_data.input_frames = samples >> 1;
|
||||
|
||||
if (audio_driver_data.dsp)
|
||||
{
|
||||
rarch_perf_init(&audio_dsp, "audio_dsp");
|
||||
retro_perf_start(&audio_dsp);
|
||||
rarch_dsp_filter_process(audio_driver_data.dsp, &dsp_data);
|
||||
retro_perf_stop(&audio_dsp);
|
||||
|
||||
if (dsp_data.output)
|
||||
{
|
||||
src_data.data_in = dsp_data.output;
|
||||
src_data.input_frames = dsp_data.output_frames;
|
||||
}
|
||||
}
|
||||
|
||||
src_data.data_out = audio_driver_data.output_samples.buf;
|
||||
|
||||
if (audio_driver_data.audio_rate.control)
|
||||
audio_driver_readjust_input_rate();
|
||||
|
||||
src_data.ratio = audio_driver_data.audio_rate.source_ratio.current;
|
||||
|
||||
if (runloop_ctl(RUNLOOP_CTL_IS_SLOWMOTION, NULL))
|
||||
src_data.ratio *= settings->slowmotion_ratio;
|
||||
|
||||
audio_driver_ctl(RARCH_AUDIO_CTL_RESAMPLER_PROCESS, &src_data);
|
||||
|
||||
output_data = audio_driver_data.output_samples.buf;
|
||||
output_frames = src_data.output_frames;
|
||||
|
||||
if (!audio_driver_data.use_float)
|
||||
{
|
||||
rarch_perf_init(&audio_convert_float, "audio_convert_float");
|
||||
retro_perf_start(&audio_convert_float);
|
||||
audio_convert_float_to_s16(audio_driver_data.output_samples.conv_buf,
|
||||
(const float*)output_data, output_frames * 2);
|
||||
retro_perf_stop(&audio_convert_float);
|
||||
|
||||
output_data = audio_driver_data.output_samples.conv_buf;
|
||||
output_size = sizeof(int16_t);
|
||||
}
|
||||
|
||||
if (current_audio->write(audio_driver_context_audio_data,
|
||||
output_data, output_frames * output_size * 2) < 0)
|
||||
{
|
||||
audio_driver_ctl(RARCH_AUDIO_CTL_UNSET_ACTIVE, NULL);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* audio_driver_sample:
|
||||
* @left : value of the left audio channel.
|
||||
* @right : value of the right audio channel.
|
||||
*
|
||||
* Audio sample render callback function.
|
||||
**/
|
||||
void audio_driver_sample(int16_t left, int16_t right)
|
||||
{
|
||||
audio_driver_data.output_samples.conv_buf[audio_driver_data.data_ptr++] = left;
|
||||
audio_driver_data.output_samples.conv_buf[audio_driver_data.data_ptr++] = right;
|
||||
|
||||
if (audio_driver_data.data_ptr < audio_driver_data.chunk.size)
|
||||
return;
|
||||
|
||||
audio_driver_flush(audio_driver_data.output_samples.conv_buf,
|
||||
audio_driver_data.data_ptr);
|
||||
|
||||
audio_driver_data.data_ptr = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* audio_driver_sample_batch:
|
||||
* @data : pointer to audio buffer.
|
||||
* @frames : amount of audio frames to push.
|
||||
*
|
||||
* Batched audio sample render callback function.
|
||||
*
|
||||
* Returns: amount of frames sampled. Will be equal to @frames
|
||||
* unless @frames exceeds (AUDIO_CHUNK_SIZE_NONBLOCKING / 2).
|
||||
**/
|
||||
size_t audio_driver_sample_batch(const int16_t *data, size_t frames)
|
||||
{
|
||||
if (frames > (AUDIO_CHUNK_SIZE_NONBLOCKING >> 1))
|
||||
frames = AUDIO_CHUNK_SIZE_NONBLOCKING >> 1;
|
||||
|
||||
audio_driver_flush(data, frames << 1);
|
||||
|
||||
return frames;
|
||||
}
|
||||
|
||||
/**
|
||||
* audio_driver_sample_rewind:
|
||||
* @left : value of the left audio channel.
|
||||
* @right : value of the right audio channel.
|
||||
*
|
||||
* Audio sample render callback function (rewind version).
|
||||
* This callback function will be used instead of
|
||||
* audio_driver_sample when rewinding is activated.
|
||||
**/
|
||||
void audio_driver_sample_rewind(int16_t left, int16_t right)
|
||||
{
|
||||
audio_driver_data.rewind.buf[--audio_driver_data.rewind.ptr] = right;
|
||||
audio_driver_data.rewind.buf[--audio_driver_data.rewind.ptr] = left;
|
||||
}
|
||||
|
||||
/**
|
||||
* audio_driver_sample_batch_rewind:
|
||||
* @data : pointer to audio buffer.
|
||||
* @frames : amount of audio frames to push.
|
||||
*
|
||||
* Batched audio sample render callback function (rewind version).
|
||||
*
|
||||
* This callback function will be used instead of
|
||||
* audio_driver_sample_batch when rewinding is activated.
|
||||
*
|
||||
* Returns: amount of frames sampled. Will be equal to @frames
|
||||
* unless @frames exceeds (AUDIO_CHUNK_SIZE_NONBLOCKING / 2).
|
||||
**/
|
||||
size_t audio_driver_sample_batch_rewind(const int16_t *data, size_t frames)
|
||||
{
|
||||
size_t i;
|
||||
size_t samples = frames << 1;
|
||||
|
||||
for (i = 0; i < samples; i++)
|
||||
audio_driver_data.rewind.buf[--audio_driver_data.rewind.ptr] = data[i];
|
||||
|
||||
return frames;
|
||||
}
|
||||
|
||||
void audio_driver_set_volume_gain(float gain)
|
||||
{
|
||||
audio_driver_data.volume_gain = gain;
|
||||
}
|
||||
|
||||
void audio_driver_dsp_filter_free(void)
|
||||
{
|
||||
if (audio_driver_data.dsp)
|
||||
rarch_dsp_filter_free(audio_driver_data.dsp);
|
||||
audio_driver_data.dsp = NULL;
|
||||
}
|
||||
|
||||
void audio_driver_dsp_filter_init(const char *device)
|
||||
{
|
||||
audio_driver_data.dsp = rarch_dsp_filter_new(
|
||||
device, audio_driver_data.audio_rate.input);
|
||||
|
||||
if (!audio_driver_data.dsp)
|
||||
RARCH_ERR("[DSP]: Failed to initialize DSP filter \"%s\".\n", device);
|
||||
}
|
||||
|
||||
void audio_driver_set_buffer_size(size_t bufsize)
|
||||
{
|
||||
audio_driver_data.driver_buffer_size = bufsize;
|
||||
}
|
||||
|
||||
|
||||
static void audio_monitor_adjust_system_rates(void)
|
||||
{
|
||||
float timing_skew;
|
||||
settings_t *settings = config_get_ptr();
|
||||
const struct retro_system_timing *info = NULL;
|
||||
struct retro_system_av_info *av_info = video_viewport_get_system_av_info();
|
||||
|
||||
if (av_info)
|
||||
info = (const struct retro_system_timing*)&av_info->timing;
|
||||
|
||||
if (!info || info->sample_rate <= 0.0)
|
||||
return;
|
||||
|
||||
timing_skew = fabs(1.0f - info->fps / settings->video.refresh_rate);
|
||||
audio_driver_data.audio_rate.input = info->sample_rate;
|
||||
|
||||
if (timing_skew <= settings->audio.max_timing_skew)
|
||||
audio_driver_data.audio_rate.input *= (settings->video.refresh_rate / info->fps);
|
||||
|
||||
RARCH_LOG("Set audio input rate to: %.2f Hz.\n",
|
||||
audio_driver_data.audio_rate.input);
|
||||
}
|
||||
|
||||
static void audio_driver_setup_rewind(void)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
/* Push audio ready to be played. */
|
||||
audio_driver_data.rewind.ptr = audio_driver_data.rewind.size;
|
||||
|
||||
for (i = 0; i < audio_driver_data.data_ptr; i += 2)
|
||||
{
|
||||
audio_driver_data.rewind.buf[--audio_driver_data.rewind.ptr] =
|
||||
audio_driver_data.output_samples.conv_buf[i + 1];
|
||||
|
||||
audio_driver_data.rewind.buf[--audio_driver_data.rewind.ptr] =
|
||||
audio_driver_data.output_samples.conv_buf[i + 0];
|
||||
}
|
||||
|
||||
audio_driver_data.data_ptr = 0;
|
||||
}
|
||||
|
||||
static bool find_audio_driver(void)
|
||||
{
|
||||
int i;
|
||||
driver_ctx_info_t drv;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
drv.label = "audio_driver";
|
||||
drv.s = settings->audio.driver;
|
||||
|
||||
driver_ctl(RARCH_DRIVER_CTL_FIND_INDEX, &drv);
|
||||
|
||||
i = drv.len;
|
||||
|
||||
if (i >= 0)
|
||||
current_audio = (const audio_driver_t*)audio_driver_find_handle(i);
|
||||
else
|
||||
{
|
||||
unsigned d;
|
||||
RARCH_ERR("Couldn't find any audio driver named \"%s\"\n",
|
||||
settings->audio.driver);
|
||||
RARCH_LOG_OUTPUT("Available audio drivers are:\n");
|
||||
for (d = 0; audio_driver_find_handle(d); d++)
|
||||
RARCH_LOG_OUTPUT("\t%s\n", audio_driver_find_ident(d));
|
||||
RARCH_WARN("Going to default to first audio driver...\n");
|
||||
|
||||
current_audio = (const audio_driver_t*)audio_driver_find_handle(0);
|
||||
|
||||
if (!current_audio)
|
||||
retro_fail(1, "find_audio_driver()");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool audio_driver_ctl(enum rarch_audio_ctl_state state, void *data)
|
||||
{
|
||||
static struct retro_audio_callback audio_callback;
|
||||
static struct retro_perf_counter resampler_proc = {0};
|
||||
static const rarch_resampler_t *audio_driver_resampler = NULL;
|
||||
static void *audio_driver_resampler_data = NULL;
|
||||
static bool audio_driver_active = false;
|
||||
static bool audio_driver_data_own = false;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case RARCH_AUDIO_CTL_RESAMPLER_DEINIT:
|
||||
rarch_resampler_freep(&audio_driver_resampler,
|
||||
&audio_driver_resampler_data);
|
||||
break;
|
||||
case RARCH_AUDIO_CTL_RESAMPLER_INIT:
|
||||
return rarch_resampler_realloc(
|
||||
&audio_driver_resampler_data,
|
||||
&audio_driver_resampler,
|
||||
settings->audio.resampler,
|
||||
audio_driver_data.audio_rate.source_ratio.original);
|
||||
case RARCH_AUDIO_CTL_RESAMPLER_PROCESS:
|
||||
rarch_perf_init(&resampler_proc, "resampler_proc");
|
||||
retro_perf_start(&resampler_proc);
|
||||
rarch_resampler_process(audio_driver_resampler,
|
||||
audio_driver_resampler_data,
|
||||
(struct resampler_data*)data);
|
||||
retro_perf_stop(&resampler_proc);
|
||||
break;
|
||||
case RARCH_AUDIO_CTL_INIT:
|
||||
return init_audio(audio_callback.callback != NULL);
|
||||
case RARCH_AUDIO_CTL_DESTROY:
|
||||
audio_driver_active = false;
|
||||
audio_driver_data_own = false;
|
||||
current_audio = NULL;
|
||||
break;
|
||||
case RARCH_AUDIO_CTL_DESTROY_DATA:
|
||||
audio_driver_context_audio_data = NULL;
|
||||
break;
|
||||
case RARCH_AUDIO_CTL_DEINIT:
|
||||
if (!uninit_audio())
|
||||
return false;
|
||||
break;
|
||||
case RARCH_AUDIO_CTL_SETUP_REWIND:
|
||||
audio_driver_setup_rewind();
|
||||
break;
|
||||
case RARCH_AUDIO_CTL_SET_CALLBACK_ENABLE:
|
||||
if (!audio_driver_ctl(RARCH_AUDIO_CTL_HAS_CALLBACK, NULL))
|
||||
return false;
|
||||
if (audio_callback.set_state)
|
||||
audio_callback.set_state(true);
|
||||
break;
|
||||
case RARCH_AUDIO_CTL_SET_CALLBACK_DISABLE:
|
||||
if (!audio_driver_ctl(RARCH_AUDIO_CTL_HAS_CALLBACK, NULL))
|
||||
return false;
|
||||
|
||||
if (audio_callback.set_state)
|
||||
audio_callback.set_state(false);
|
||||
break;
|
||||
case RARCH_AUDIO_CTL_HAS_CALLBACK:
|
||||
return audio_callback.callback;
|
||||
case RARCH_AUDIO_CTL_CALLBACK:
|
||||
if (!audio_driver_ctl(RARCH_AUDIO_CTL_HAS_CALLBACK, NULL))
|
||||
return false;
|
||||
|
||||
if (audio_callback.callback)
|
||||
audio_callback.callback();
|
||||
break;
|
||||
case RARCH_AUDIO_CTL_UNSET_CALLBACK:
|
||||
audio_callback.callback = NULL;
|
||||
audio_callback.set_state = NULL;
|
||||
break;
|
||||
case RARCH_AUDIO_CTL_SET_CALLBACK:
|
||||
{
|
||||
const struct retro_audio_callback *cb =
|
||||
(const struct retro_audio_callback*)data;
|
||||
|
||||
if (recording_driver_get_data_ptr()) /* A/V sync is a must. */
|
||||
return false;
|
||||
|
||||
#ifdef HAVE_NETPLAY
|
||||
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL))
|
||||
return false;
|
||||
#endif
|
||||
if (cb)
|
||||
audio_callback = *cb;
|
||||
}
|
||||
break;
|
||||
case RARCH_AUDIO_CTL_MONITOR_ADJUST_SYSTEM_RATES:
|
||||
audio_monitor_adjust_system_rates();
|
||||
break;
|
||||
case RARCH_AUDIO_CTL_MONITOR_SET_REFRESH_RATE:
|
||||
{
|
||||
double new_src_ratio = (double)settings->audio.out_rate /
|
||||
audio_driver_data.audio_rate.input;
|
||||
|
||||
audio_driver_data.audio_rate.source_ratio.original = new_src_ratio;
|
||||
audio_driver_data.audio_rate.source_ratio.current = new_src_ratio;
|
||||
}
|
||||
break;
|
||||
case RARCH_AUDIO_CTL_MUTE_TOGGLE:
|
||||
if (!audio_driver_context_audio_data)
|
||||
return false;
|
||||
if (!audio_driver_ctl(RARCH_AUDIO_CTL_IS_ACTIVE, NULL))
|
||||
return false;
|
||||
|
||||
settings->audio.mute_enable = !settings->audio.mute_enable;
|
||||
|
||||
if (settings->audio.mute_enable)
|
||||
event_cmd_ctl(EVENT_CMD_AUDIO_STOP, NULL);
|
||||
else if (!event_cmd_ctl(EVENT_CMD_AUDIO_START, NULL))
|
||||
{
|
||||
audio_driver_ctl(RARCH_AUDIO_CTL_UNSET_ACTIVE, NULL);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case RARCH_AUDIO_CTL_ALIVE:
|
||||
if (!current_audio || !current_audio->alive
|
||||
|| !audio_driver_context_audio_data)
|
||||
return false;
|
||||
return current_audio->alive(audio_driver_context_audio_data);
|
||||
case RARCH_AUDIO_CTL_START:
|
||||
if (!current_audio || !current_audio->start
|
||||
|| !audio_driver_context_audio_data)
|
||||
return false;
|
||||
return current_audio->start(audio_driver_context_audio_data);
|
||||
case RARCH_AUDIO_CTL_STOP:
|
||||
if (!current_audio || !current_audio->stop
|
||||
|| !audio_driver_context_audio_data)
|
||||
return false;
|
||||
return current_audio->stop(audio_driver_context_audio_data);
|
||||
case RARCH_AUDIO_CTL_FIND_DRIVER:
|
||||
return find_audio_driver();
|
||||
case RARCH_AUDIO_CTL_SET_OWN_DRIVER:
|
||||
audio_driver_data_own = true;
|
||||
break;
|
||||
case RARCH_AUDIO_CTL_UNSET_OWN_DRIVER:
|
||||
audio_driver_data_own = false;
|
||||
break;
|
||||
case RARCH_AUDIO_CTL_OWNS_DRIVER:
|
||||
return audio_driver_data_own;
|
||||
case RARCH_AUDIO_CTL_SET_ACTIVE:
|
||||
audio_driver_active = true;
|
||||
break;
|
||||
case RARCH_AUDIO_CTL_UNSET_ACTIVE:
|
||||
audio_driver_active = false;
|
||||
break;
|
||||
case RARCH_AUDIO_CTL_IS_ACTIVE:
|
||||
return audio_driver_active;
|
||||
case RARCH_AUDIO_CTL_FRAME_IS_REVERSE:
|
||||
/* We just rewound. Flush rewind audio buffer. */
|
||||
audio_driver_flush(
|
||||
audio_driver_data.rewind.buf + audio_driver_data.rewind.ptr,
|
||||
audio_driver_data.rewind.size - audio_driver_data.rewind.ptr);
|
||||
break;
|
||||
case RARCH_AUDIO_CTL_NONE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __AUDIO_DRIVER__H
|
||||
#define __AUDIO_DRIVER__H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
#include <boolean.h>
|
||||
#include "audio_dsp_filter.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum rarch_audio_ctl_state
|
||||
{
|
||||
RARCH_AUDIO_CTL_NONE = 0,
|
||||
RARCH_AUDIO_CTL_INIT,
|
||||
RARCH_AUDIO_CTL_DEINIT,
|
||||
RARCH_AUDIO_CTL_DESTROY,
|
||||
RARCH_AUDIO_CTL_DESTROY_DATA,
|
||||
RARCH_AUDIO_CTL_START,
|
||||
RARCH_AUDIO_CTL_STOP,
|
||||
RARCH_AUDIO_CTL_FIND_DRIVER,
|
||||
RARCH_AUDIO_CTL_SETUP_REWIND,
|
||||
/* Sets audio monitor refresh rate to new value. */
|
||||
RARCH_AUDIO_CTL_MONITOR_SET_REFRESH_RATE,
|
||||
RARCH_AUDIO_CTL_MONITOR_ADJUST_SYSTEM_RATES,
|
||||
RARCH_AUDIO_CTL_MUTE_TOGGLE,
|
||||
RARCH_AUDIO_CTL_SET_CALLBACK_ENABLE,
|
||||
RARCH_AUDIO_CTL_SET_CALLBACK_DISABLE,
|
||||
RARCH_AUDIO_CTL_SET_CALLBACK,
|
||||
RARCH_AUDIO_CTL_UNSET_CALLBACK,
|
||||
RARCH_AUDIO_CTL_CALLBACK,
|
||||
RARCH_AUDIO_CTL_HAS_CALLBACK,
|
||||
RARCH_AUDIO_CTL_ALIVE,
|
||||
RARCH_AUDIO_CTL_FRAME_IS_REVERSE,
|
||||
RARCH_AUDIO_CTL_SET_OWN_DRIVER,
|
||||
RARCH_AUDIO_CTL_UNSET_OWN_DRIVER,
|
||||
RARCH_AUDIO_CTL_OWNS_DRIVER,
|
||||
RARCH_AUDIO_CTL_SET_ACTIVE,
|
||||
RARCH_AUDIO_CTL_UNSET_ACTIVE,
|
||||
RARCH_AUDIO_CTL_IS_ACTIVE,
|
||||
RARCH_AUDIO_CTL_RESAMPLER_DEINIT,
|
||||
RARCH_AUDIO_CTL_RESAMPLER_INIT,
|
||||
RARCH_AUDIO_CTL_RESAMPLER_PROCESS
|
||||
};
|
||||
|
||||
typedef struct audio_driver
|
||||
{
|
||||
/* Creates and initializes handle to audio driver.
|
||||
*
|
||||
* Returns: audio driver handle on success, otherwise NULL.
|
||||
**/
|
||||
void *(*init)(const char *device, unsigned rate, unsigned latency);
|
||||
|
||||
/*
|
||||
* @data : Pointer to audio data handle.
|
||||
* @buf : Audio buffer data.
|
||||
* @size : Size of audio buffer.
|
||||
*
|
||||
* Write samples to audio driver.
|
||||
**/
|
||||
ssize_t (*write)(void *data, const void *buf, size_t size);
|
||||
|
||||
/* Stops driver. */
|
||||
bool (*stop)(void *data);
|
||||
|
||||
/* Starts driver. */
|
||||
bool (*start)(void *data);
|
||||
|
||||
/* Is the audio driver currently running? */
|
||||
bool (*alive)(void *data);
|
||||
|
||||
/* Should we care about blocking in audio thread? Fast forwarding. */
|
||||
void (*set_nonblock_state)(void *data, bool toggle);
|
||||
|
||||
/* Frees driver data. */
|
||||
void (*free)(void *data);
|
||||
|
||||
/* Defines if driver will take standard floating point samples,
|
||||
* or int16_t samples. */
|
||||
bool (*use_float)(void *data);
|
||||
|
||||
/* Human-readable identifier. */
|
||||
const char *ident;
|
||||
|
||||
/* Optional. */
|
||||
size_t (*write_avail)(void *data);
|
||||
|
||||
size_t (*buffer_size)(void *data);
|
||||
} audio_driver_t;
|
||||
|
||||
|
||||
bool audio_driver_ctl(enum rarch_audio_ctl_state state, void *data);
|
||||
|
||||
/**
|
||||
* audio_driver_find_handle:
|
||||
* @index : index of driver to get handle to.
|
||||
*
|
||||
* Returns: handle to audio driver at index. Can be NULL
|
||||
* if nothing found.
|
||||
**/
|
||||
const void *audio_driver_find_handle(int index);
|
||||
|
||||
/**
|
||||
* audio_driver_find_ident:
|
||||
* @index : index of driver to get handle to.
|
||||
*
|
||||
* Returns: Human-readable identifier of audio driver at index. Can be NULL
|
||||
* if nothing found.
|
||||
**/
|
||||
const char *audio_driver_find_ident(int index);
|
||||
|
||||
void audio_driver_set_nonblocking_state(bool enable);
|
||||
|
||||
/**
|
||||
* config_get_audio_driver_options:
|
||||
*
|
||||
* Get an enumerated list of all audio driver names, separated by '|'.
|
||||
*
|
||||
* Returns: string listing of all audio driver names, separated by '|'.
|
||||
**/
|
||||
const char* config_get_audio_driver_options(void);
|
||||
|
||||
void audio_driver_sample(int16_t left, int16_t right);
|
||||
|
||||
size_t audio_driver_sample_batch(const int16_t *data, size_t frames);
|
||||
|
||||
void audio_driver_sample_rewind(int16_t left, int16_t right);
|
||||
|
||||
size_t audio_driver_sample_batch_rewind(const int16_t *data, size_t frames);
|
||||
|
||||
void audio_driver_set_volume_gain(float gain);
|
||||
|
||||
void audio_driver_dsp_filter_free(void);
|
||||
|
||||
void audio_driver_dsp_filter_init(const char *device);
|
||||
|
||||
void audio_driver_set_buffer_size(size_t bufsize);
|
||||
|
||||
extern audio_driver_t audio_rsound;
|
||||
extern audio_driver_t audio_oss;
|
||||
extern audio_driver_t audio_alsa;
|
||||
extern audio_driver_t audio_alsathread;
|
||||
extern audio_driver_t audio_roar;
|
||||
extern audio_driver_t audio_openal;
|
||||
extern audio_driver_t audio_opensl;
|
||||
extern audio_driver_t audio_jack;
|
||||
extern audio_driver_t audio_sdl;
|
||||
extern audio_driver_t audio_xa;
|
||||
extern audio_driver_t audio_pulse;
|
||||
extern audio_driver_t audio_dsound;
|
||||
extern audio_driver_t audio_coreaudio;
|
||||
extern audio_driver_t audio_xenon360;
|
||||
extern audio_driver_t audio_ps3;
|
||||
extern audio_driver_t audio_gx;
|
||||
extern audio_driver_t audio_psp;
|
||||
extern audio_driver_t audio_ctr_csnd;
|
||||
extern audio_driver_t audio_ctr_dsp;
|
||||
extern audio_driver_t audio_rwebaudio;
|
||||
extern audio_driver_t audio_null;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,323 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#include <compat/posix_string.h>
|
||||
#include <dynamic/dylib.h>
|
||||
|
||||
#include <file/file_path.h>
|
||||
#include <file/config_file_userdata.h>
|
||||
#include <file/dir_list.h>
|
||||
|
||||
#include "audio_dsp_filter.h"
|
||||
#include "audio_filters/dspfilter.h"
|
||||
|
||||
#include "../frontend/frontend_driver.h"
|
||||
#include "../performance.h"
|
||||
#include "../dynamic.h"
|
||||
|
||||
struct rarch_dsp_plug
|
||||
{
|
||||
#ifdef HAVE_DYLIB
|
||||
dylib_t lib;
|
||||
#endif
|
||||
const struct dspfilter_implementation *impl;
|
||||
};
|
||||
|
||||
struct rarch_dsp_instance
|
||||
{
|
||||
const struct dspfilter_implementation *impl;
|
||||
void *impl_data;
|
||||
};
|
||||
|
||||
struct rarch_dsp_filter
|
||||
{
|
||||
config_file_t *conf;
|
||||
|
||||
struct rarch_dsp_plug *plugs;
|
||||
unsigned num_plugs;
|
||||
|
||||
struct rarch_dsp_instance *instances;
|
||||
unsigned num_instances;
|
||||
};
|
||||
|
||||
static const struct dspfilter_implementation *find_implementation(
|
||||
rarch_dsp_filter_t *dsp, const char *ident)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < dsp->num_plugs; i++)
|
||||
{
|
||||
if (!strcmp(dsp->plugs[i].impl->short_ident, ident))
|
||||
return dsp->plugs[i].impl;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const struct dspfilter_config dspfilter_config = {
|
||||
config_userdata_get_float,
|
||||
config_userdata_get_int,
|
||||
config_userdata_get_float_array,
|
||||
config_userdata_get_int_array,
|
||||
config_userdata_get_string,
|
||||
config_userdata_free,
|
||||
};
|
||||
|
||||
static bool create_filter_graph(rarch_dsp_filter_t *dsp, float sample_rate)
|
||||
{
|
||||
unsigned i, filters = 0;
|
||||
|
||||
if (!config_get_uint(dsp->conf, "filters", &filters))
|
||||
return false;
|
||||
|
||||
dsp->instances = (struct rarch_dsp_instance*)
|
||||
calloc(filters, sizeof(*dsp->instances));
|
||||
if (!dsp->instances)
|
||||
return false;
|
||||
|
||||
dsp->num_instances = filters;
|
||||
|
||||
for (i = 0; i < filters; i++)
|
||||
{
|
||||
struct config_file_userdata userdata;
|
||||
struct dspfilter_info info;
|
||||
char key[64] = {0};
|
||||
char name[64] = {0};
|
||||
|
||||
info.input_rate = sample_rate;
|
||||
|
||||
snprintf(key, sizeof(key), "filter%u", i);
|
||||
|
||||
if (!config_get_array(dsp->conf, key, name, sizeof(name)))
|
||||
return false;
|
||||
|
||||
dsp->instances[i].impl = find_implementation(dsp, name);
|
||||
if (!dsp->instances[i].impl)
|
||||
return false;
|
||||
|
||||
userdata.conf = dsp->conf;
|
||||
/* Index-specific configs take priority over ident-specific. */
|
||||
userdata.prefix[0] = key;
|
||||
userdata.prefix[1] = dsp->instances[i].impl->short_ident;
|
||||
|
||||
dsp->instances[i].impl_data = dsp->instances[i].impl->init(&info, &dspfilter_config, &userdata);
|
||||
if (!dsp->instances[i].impl_data)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined(HAVE_FILTERS_BUILTIN)
|
||||
extern const struct dspfilter_implementation *panning_dspfilter_get_implementation(dspfilter_simd_mask_t mask);
|
||||
extern const struct dspfilter_implementation *iir_dspfilter_get_implementation(dspfilter_simd_mask_t mask);
|
||||
extern const struct dspfilter_implementation *echo_dspfilter_get_implementation(dspfilter_simd_mask_t mask);
|
||||
extern const struct dspfilter_implementation *phaser_dspfilter_get_implementation(dspfilter_simd_mask_t mask);
|
||||
extern const struct dspfilter_implementation *wahwah_dspfilter_get_implementation(dspfilter_simd_mask_t mask);
|
||||
extern const struct dspfilter_implementation *eq_dspfilter_get_implementation(dspfilter_simd_mask_t mask);
|
||||
extern const struct dspfilter_implementation *chorus_dspfilter_get_implementation(dspfilter_simd_mask_t mask);
|
||||
|
||||
static const dspfilter_get_implementation_t dsp_plugs_builtin[] = {
|
||||
panning_dspfilter_get_implementation,
|
||||
iir_dspfilter_get_implementation,
|
||||
echo_dspfilter_get_implementation,
|
||||
phaser_dspfilter_get_implementation,
|
||||
wahwah_dspfilter_get_implementation,
|
||||
eq_dspfilter_get_implementation,
|
||||
chorus_dspfilter_get_implementation,
|
||||
};
|
||||
|
||||
static bool append_plugs(rarch_dsp_filter_t *dsp, struct string_list *list)
|
||||
{
|
||||
unsigned i;
|
||||
dspfilter_simd_mask_t mask = retro_get_cpu_features();
|
||||
|
||||
(void)list;
|
||||
|
||||
dsp->plugs = (struct rarch_dsp_plug*)
|
||||
calloc(ARRAY_SIZE(dsp_plugs_builtin), sizeof(*dsp->plugs));
|
||||
if (!dsp->plugs)
|
||||
return false;
|
||||
|
||||
dsp->num_plugs = ARRAY_SIZE(dsp_plugs_builtin);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(dsp_plugs_builtin); i++)
|
||||
{
|
||||
dsp->plugs[i].impl = dsp_plugs_builtin[i](mask);
|
||||
if (!dsp->plugs[i].impl)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#elif defined(HAVE_DYLIB)
|
||||
static bool append_plugs(rarch_dsp_filter_t *dsp, struct string_list *list)
|
||||
{
|
||||
unsigned i;
|
||||
dspfilter_simd_mask_t mask = retro_get_cpu_features();
|
||||
|
||||
for (i = 0; i < list->size; i++)
|
||||
{
|
||||
const struct dspfilter_implementation *impl = NULL;
|
||||
struct rarch_dsp_plug *new_plugs = NULL;
|
||||
dylib_t lib = dylib_load(list->elems[i].data);
|
||||
dspfilter_get_implementation_t cb;
|
||||
|
||||
if (!lib)
|
||||
continue;
|
||||
|
||||
cb = (dspfilter_get_implementation_t)dylib_proc(lib, "dspfilter_get_implementation");
|
||||
if (!cb)
|
||||
{
|
||||
dylib_close(lib);
|
||||
continue;
|
||||
}
|
||||
|
||||
impl = cb(mask);
|
||||
if (!impl)
|
||||
{
|
||||
dylib_close(lib);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (impl->api_version != DSPFILTER_API_VERSION)
|
||||
{
|
||||
dylib_close(lib);
|
||||
continue;
|
||||
}
|
||||
|
||||
new_plugs = (struct rarch_dsp_plug*)
|
||||
realloc(dsp->plugs, sizeof(*dsp->plugs) * (dsp->num_plugs + 1));
|
||||
if (!new_plugs)
|
||||
{
|
||||
dylib_close(lib);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Found plug. */
|
||||
|
||||
dsp->plugs = new_plugs;
|
||||
dsp->plugs[dsp->num_plugs].lib = lib;
|
||||
dsp->plugs[dsp->num_plugs].impl = impl;
|
||||
dsp->num_plugs++;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
rarch_dsp_filter_t *rarch_dsp_filter_new(
|
||||
const char *filter_config, float sample_rate)
|
||||
{
|
||||
#if !defined(HAVE_FILTERS_BUILTIN) && defined(HAVE_DYLIB)
|
||||
char basedir[PATH_MAX_LENGTH];
|
||||
char ext_name[PATH_MAX_LENGTH];
|
||||
#endif
|
||||
struct string_list *plugs = NULL;
|
||||
rarch_dsp_filter_t *dsp = NULL;
|
||||
|
||||
dsp = (rarch_dsp_filter_t*)calloc(1, sizeof(*dsp));
|
||||
if (!dsp)
|
||||
return NULL;
|
||||
|
||||
dsp->conf = config_file_new(filter_config);
|
||||
if (!dsp->conf) /* Did not find config. */
|
||||
goto error;
|
||||
|
||||
#if !defined(HAVE_FILTERS_BUILTIN) && defined(HAVE_DYLIB)
|
||||
fill_pathname_basedir(basedir, filter_config, sizeof(basedir));
|
||||
|
||||
if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
|
||||
goto error;
|
||||
|
||||
plugs = dir_list_new(basedir, ext_name, false, false);
|
||||
if (!plugs)
|
||||
goto error;
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_DYLIB) || defined(HAVE_FILTERS_BUILTIN)
|
||||
if (!append_plugs(dsp, plugs))
|
||||
goto error;
|
||||
#endif
|
||||
|
||||
if (plugs)
|
||||
string_list_free(plugs);
|
||||
plugs = NULL;
|
||||
|
||||
if (!create_filter_graph(dsp, sample_rate))
|
||||
goto error;
|
||||
|
||||
return dsp;
|
||||
|
||||
error:
|
||||
if (plugs)
|
||||
string_list_free(plugs);
|
||||
rarch_dsp_filter_free(dsp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void rarch_dsp_filter_free(rarch_dsp_filter_t *dsp)
|
||||
{
|
||||
unsigned i;
|
||||
if (!dsp)
|
||||
return;
|
||||
|
||||
for (i = 0; i < dsp->num_instances; i++)
|
||||
{
|
||||
if (dsp->instances[i].impl_data && dsp->instances[i].impl)
|
||||
dsp->instances[i].impl->free(dsp->instances[i].impl_data);
|
||||
}
|
||||
free(dsp->instances);
|
||||
|
||||
#ifdef HAVE_DYLIB
|
||||
for (i = 0; i < dsp->num_plugs; i++)
|
||||
{
|
||||
if (dsp->plugs[i].lib)
|
||||
dylib_close(dsp->plugs[i].lib);
|
||||
}
|
||||
free(dsp->plugs);
|
||||
#endif
|
||||
|
||||
if (dsp->conf)
|
||||
config_file_free(dsp->conf);
|
||||
|
||||
free(dsp);
|
||||
}
|
||||
|
||||
void rarch_dsp_filter_process(rarch_dsp_filter_t *dsp,
|
||||
struct rarch_dsp_data *data)
|
||||
{
|
||||
unsigned i;
|
||||
struct dspfilter_output output = {0};
|
||||
struct dspfilter_input input = {0};
|
||||
|
||||
output.samples = data->input;
|
||||
output.frames = data->input_frames;
|
||||
|
||||
for (i = 0; i < dsp->num_instances; i++)
|
||||
{
|
||||
input.samples = output.samples;
|
||||
input.frames = output.frames;
|
||||
dsp->instances[i].impl->process(
|
||||
dsp->instances[i].impl_data, &output, &input);
|
||||
}
|
||||
|
||||
data->output = output.samples;
|
||||
data->output_frames = output.frames;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __AUDIO_DSP_FILTER_H__
|
||||
#define __AUDIO_DSP_FILTER_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct rarch_dsp_filter rarch_dsp_filter_t;
|
||||
|
||||
rarch_dsp_filter_t *rarch_dsp_filter_new(const char *filter_config,
|
||||
float sample_rate);
|
||||
|
||||
void rarch_dsp_filter_free(rarch_dsp_filter_t *dsp);
|
||||
|
||||
struct rarch_dsp_data
|
||||
{
|
||||
float *input;
|
||||
unsigned input_frames;
|
||||
|
||||
/* Set by rarch_dsp_filter_process(). */
|
||||
float *output;
|
||||
unsigned output_frames;
|
||||
};
|
||||
|
||||
void rarch_dsp_filter_process(rarch_dsp_filter_t *dsp,
|
||||
struct rarch_dsp_data *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,3 +9,4 @@ iir_frequency = 200.0
|
||||
# Avoids clipping.
|
||||
panning_left_mix = "0.3 0.0"
|
||||
panning_right_mix = "0.0 0.3"
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1
@@ -4,3 +4,4 @@ filter0 = iir
|
||||
iir_gain = -12.0
|
||||
iir_type = HSH
|
||||
iir_frequency = 8000.0
|
||||
|
||||
@@ -20,3 +20,4 @@ filter0 = iir
|
||||
# LSH: Low-shelf
|
||||
# HSH: High-shelf
|
||||
# RIAA_CD: CD de-emphasis
|
||||
|
||||
File renamed without changes.
@@ -0,0 +1,91 @@
|
||||
compiler := gcc
|
||||
extra_flags :=
|
||||
use_neon := 0
|
||||
build = release
|
||||
DYLIB := so
|
||||
|
||||
ifeq ($(platform),)
|
||||
platform = unix
|
||||
ifeq ($(shell uname -a),)
|
||||
platform = win
|
||||
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
||||
platform = win
|
||||
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
||||
platform = osx
|
||||
arch = intel
|
||||
ifeq ($(shell uname -p),powerpc)
|
||||
arch = ppc
|
||||
endif
|
||||
else ifneq ($(findstring win,$(shell uname -a)),)
|
||||
platform = win
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(platform),gcc)
|
||||
extra_rules_gcc := $(shell $(compiler) -dumpmachine)
|
||||
endif
|
||||
|
||||
ifneq (,$(findstring armv7,$(extra_rules_gcc)))
|
||||
extra_flags += -mcpu=cortex-a9 -mtune=cortex-a9 -mfpu=neon
|
||||
use_neon := 1
|
||||
endif
|
||||
|
||||
ifneq (,$(findstring hardfloat,$(extra_rules_gcc)))
|
||||
extra_flags += -mfloat-abi=hard
|
||||
endif
|
||||
|
||||
ifeq (release,$(build))
|
||||
extra_flags += -O2
|
||||
endif
|
||||
|
||||
ifeq (debug,$(build))
|
||||
extra_flags += -O0 -g
|
||||
endif
|
||||
|
||||
ldflags := $(LDFLAGS) -shared -lm -Wl,--version-script=link.T
|
||||
|
||||
ifeq ($(platform), unix)
|
||||
DYLIB = so
|
||||
else ifeq ($(platform), osx)
|
||||
compiler := $(CC)
|
||||
DYLIB = dylib
|
||||
ldflags := -dynamiclib
|
||||
else
|
||||
extra_flags += -static-libgcc -static-libstdc++
|
||||
DYLIB = dll
|
||||
endif
|
||||
|
||||
CC := $(compiler) -Wall
|
||||
CXX := $(subst CC,++,$(compiler)) -std=gnu++0x -Wall
|
||||
flags := $(CFLAGS) -fPIC $(extra_flags) -I../../libretro-common/include
|
||||
asflags := $(ASFLAGS) -fPIC $(extra_flags)
|
||||
objects :=
|
||||
|
||||
ifeq (1,$(use_neon))
|
||||
ASMFLAGS := -INEON/asm
|
||||
asflags += -mfpu=neon
|
||||
endif
|
||||
|
||||
plugs := $(wildcard *.c)
|
||||
objects := $(plugs:.c=.o)
|
||||
targets := $(objects:.o=.$(DYLIB))
|
||||
|
||||
all: build;
|
||||
|
||||
%.o: %.S
|
||||
$(CC) -c -o $@ $(asflags) $(ASMFLAGS) $<
|
||||
|
||||
%.o: %.c
|
||||
$(CC) -c -o $@ $(flags) $<
|
||||
|
||||
%.$(DYLIB): %.o
|
||||
$(CC) -o $@ $(ldflags) $(flags) $^
|
||||
|
||||
build: $(targets)
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
rm -f *.$(DYLIB)
|
||||
|
||||
strip:
|
||||
strip -s *.$(DYLIB)
|
||||
@@ -20,3 +20,4 @@ panning_right_mix = "0.0 1.0"
|
||||
# Mono on one speaker:
|
||||
# panning_left_mix = "0.5 0.5"
|
||||
# panning_right_mix = "0.0 0.0"
|
||||
|
||||
@@ -8,3 +8,4 @@ filter0 = phaser
|
||||
# phaser_depth = 0.4
|
||||
# phaser_dry_wet = 0.5
|
||||
# phaser_stages = 2
|
||||
|
||||
@@ -7,3 +7,4 @@ filter0 = reverb
|
||||
# reverb_damping = 0.8
|
||||
# reverb_roomwidth = 0.56
|
||||
# reverb_roomsize = 0.56
|
||||
|
||||
@@ -7,3 +7,4 @@ filter0 = wahwah
|
||||
# wahwah_freq_offset = 0.3
|
||||
# wahwah_depth = 0.7
|
||||
# wahwah_resonance = 2.5
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "dspfilter.h"
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#define CHORUS_MAX_DELAY 4096
|
||||
#define CHORUS_DELAY_MASK (CHORUS_MAX_DELAY - 1)
|
||||
|
||||
struct chorus_data
|
||||
{
|
||||
float old[2][CHORUS_MAX_DELAY];
|
||||
unsigned old_ptr;
|
||||
|
||||
float delay;
|
||||
float depth;
|
||||
float input_rate;
|
||||
float mix_dry;
|
||||
float mix_wet;
|
||||
unsigned lfo_ptr;
|
||||
unsigned lfo_period;
|
||||
};
|
||||
|
||||
static void chorus_free(void *data)
|
||||
{
|
||||
free(data);
|
||||
}
|
||||
|
||||
static void chorus_process(void *data, struct dspfilter_output *output,
|
||||
const struct dspfilter_input *input)
|
||||
{
|
||||
unsigned i;
|
||||
struct chorus_data *ch = (struct chorus_data*)data;
|
||||
|
||||
output->samples = input->samples;
|
||||
output->frames = input->frames;
|
||||
float *out = output->samples;
|
||||
|
||||
for (i = 0; i < input->frames; i++, out += 2)
|
||||
{
|
||||
unsigned delay_int;
|
||||
float delay_frac, l_a, l_b, r_a, r_b;
|
||||
float chorus_l, chorus_r;
|
||||
float in[2] = { out[0], out[1] };
|
||||
float delay = ch->delay + ch->depth * sin((2.0 * M_PI * ch->lfo_ptr++) / ch->lfo_period);
|
||||
|
||||
delay *= ch->input_rate;
|
||||
if (ch->lfo_ptr >= ch->lfo_period)
|
||||
ch->lfo_ptr = 0;
|
||||
|
||||
delay_int = (unsigned)delay;
|
||||
if (delay_int >= CHORUS_MAX_DELAY - 1)
|
||||
delay_int = CHORUS_MAX_DELAY - 2;
|
||||
delay_frac = delay - delay_int;
|
||||
|
||||
ch->old[0][ch->old_ptr] = in[0];
|
||||
ch->old[1][ch->old_ptr] = in[1];
|
||||
|
||||
l_a = ch->old[0][(ch->old_ptr - delay_int - 0) & CHORUS_DELAY_MASK];
|
||||
l_b = ch->old[0][(ch->old_ptr - delay_int - 1) & CHORUS_DELAY_MASK];
|
||||
r_a = ch->old[1][(ch->old_ptr - delay_int - 0) & CHORUS_DELAY_MASK];
|
||||
r_b = ch->old[1][(ch->old_ptr - delay_int - 1) & CHORUS_DELAY_MASK];
|
||||
|
||||
/* Lerp introduces aliasing of the chorus component, but doing full polyphase here is probably overkill. */
|
||||
chorus_l = l_a * (1.0f - delay_frac) + l_b * delay_frac;
|
||||
chorus_r = r_a * (1.0f - delay_frac) + r_b * delay_frac;
|
||||
|
||||
out[0] = ch->mix_dry * in[0] + ch->mix_wet * chorus_l;
|
||||
out[1] = ch->mix_dry * in[1] + ch->mix_wet * chorus_r;
|
||||
|
||||
ch->old_ptr = (ch->old_ptr + 1) & CHORUS_DELAY_MASK;
|
||||
}
|
||||
}
|
||||
|
||||
static void *chorus_init(const struct dspfilter_info *info,
|
||||
const struct dspfilter_config *config, void *userdata)
|
||||
{
|
||||
float delay, depth, lfo_freq, drywet;
|
||||
struct chorus_data *ch = (struct chorus_data*)calloc(1, sizeof(*ch));
|
||||
if (!ch)
|
||||
return NULL;
|
||||
|
||||
config->get_float(userdata, "delay_ms", &delay, 25.0f);
|
||||
config->get_float(userdata, "depth_ms", &depth, 1.0f);
|
||||
config->get_float(userdata, "lfo_freq", &lfo_freq, 0.5f);
|
||||
config->get_float(userdata, "drywet", &drywet, 0.8f);
|
||||
|
||||
delay /= 1000.0f;
|
||||
depth /= 1000.0f;
|
||||
|
||||
if (depth > delay)
|
||||
depth = delay;
|
||||
|
||||
if (drywet < 0.0f)
|
||||
drywet = 0.0f;
|
||||
else if (drywet > 1.0f)
|
||||
drywet = 1.0f;
|
||||
|
||||
ch->mix_dry = 1.0f - 0.5f * drywet;
|
||||
ch->mix_wet = 0.5f * drywet;
|
||||
|
||||
ch->delay = delay;
|
||||
ch->depth = depth;
|
||||
ch->lfo_period = (1.0f / lfo_freq) * info->input_rate;
|
||||
ch->input_rate = info->input_rate;
|
||||
if (!ch->lfo_period)
|
||||
ch->lfo_period = 1;
|
||||
return ch;
|
||||
}
|
||||
|
||||
static const struct dspfilter_implementation chorus_plug = {
|
||||
chorus_init,
|
||||
chorus_process,
|
||||
chorus_free,
|
||||
|
||||
DSPFILTER_API_VERSION,
|
||||
"Chorus",
|
||||
"chorus",
|
||||
};
|
||||
|
||||
#ifdef HAVE_FILTERS_BUILTIN
|
||||
#define dspfilter_get_implementation chorus_dspfilter_get_implementation
|
||||
#endif
|
||||
|
||||
const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_simd_mask_t mask)
|
||||
{
|
||||
(void)mask;
|
||||
return &chorus_plug;
|
||||
}
|
||||
|
||||
#undef dspfilter_get_implementation
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2015 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DSPFILTER_API_H__
|
||||
#define DSPFILTER_API_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define DSPFILTER_SIMD_SSE (1 << 0)
|
||||
#define DSPFILTER_SIMD_SSE2 (1 << 1)
|
||||
#define DSPFILTER_SIMD_VMX (1 << 2)
|
||||
#define DSPFILTER_SIMD_VMX128 (1 << 3)
|
||||
#define DSPFILTER_SIMD_AVX (1 << 4)
|
||||
#define DSPFILTER_SIMD_NEON (1 << 5)
|
||||
#define DSPFILTER_SIMD_SSE3 (1 << 6)
|
||||
#define DSPFILTER_SIMD_SSSE3 (1 << 7)
|
||||
#define DSPFILTER_SIMD_MMX (1 << 8)
|
||||
#define DSPFILTER_SIMD_MMXEXT (1 << 9)
|
||||
#define DSPFILTER_SIMD_SSE4 (1 << 10)
|
||||
#define DSPFILTER_SIMD_SSE42 (1 << 11)
|
||||
#define DSPFILTER_SIMD_AVX2 (1 << 12)
|
||||
#define DSPFILTER_SIMD_VFPU (1 << 13)
|
||||
#define DSPFILTER_SIMD_PS (1 << 14)
|
||||
|
||||
/* A bit-mask of all supported SIMD instruction sets.
|
||||
* Allows an implementation to pick different
|
||||
* dspfilter_implementation structs.
|
||||
*/
|
||||
typedef unsigned dspfilter_simd_mask_t;
|
||||
|
||||
/* Dynamic library endpoint. */
|
||||
typedef const struct dspfilter_implementation *(
|
||||
*dspfilter_get_implementation_t)(dspfilter_simd_mask_t mask);
|
||||
|
||||
/* The same SIMD mask argument is forwarded to create() callback
|
||||
* as well to avoid having to keep lots of state around. */
|
||||
const struct dspfilter_implementation *dspfilter_get_implementation(
|
||||
dspfilter_simd_mask_t mask);
|
||||
|
||||
#define DSPFILTER_API_VERSION 1
|
||||
|
||||
struct dspfilter_info
|
||||
{
|
||||
/* Input sample rate that the DSP plugin receives. */
|
||||
float input_rate;
|
||||
};
|
||||
|
||||
struct dspfilter_output
|
||||
{
|
||||
/* The DSP plugin has to provide the buffering for the
|
||||
* output samples or reuse the input buffer directly.
|
||||
*
|
||||
* The samples are laid out in interleaving order: LRLRLRLR
|
||||
* The range of the samples are [-1.0, 1.0].
|
||||
*
|
||||
* It is not necessary to manually clip values. */
|
||||
float *samples;
|
||||
|
||||
/* Frames which the DSP plugin outputted for the current process.
|
||||
*
|
||||
* One frame is here defined as a combined sample of
|
||||
* left and right channels.
|
||||
*
|
||||
* (I.e. 44.1kHz, 16bit stereo will have
|
||||
* 88.2k samples/sec and 44.1k frames/sec.)
|
||||
*/
|
||||
unsigned frames;
|
||||
};
|
||||
|
||||
struct dspfilter_input
|
||||
{
|
||||
/* Input data for the DSP. The samples are interleaved in order: LRLRLRLR
|
||||
*
|
||||
* It is valid for a DSP plug to use this buffer for output as long as
|
||||
* the output size is less or equal to the input.
|
||||
*
|
||||
* This is useful for filters which can output one sample for each
|
||||
* input sample and do not need to maintain its own buffers.
|
||||
*
|
||||
* Block based filters must provide their own buffering scheme.
|
||||
*
|
||||
* The input size is not bound, but it can be safely assumed that it
|
||||
* will not exceed ~100ms worth of audio at a time. */
|
||||
float *samples;
|
||||
|
||||
/* Number of frames for input data.
|
||||
* One frame is here defined as a combined sample of
|
||||
* left and right channels.
|
||||
*
|
||||
* (I.e. 44.1kHz, 16bit stereo will have
|
||||
* 88.2k samples/sec and 44.1k frames/sec.)
|
||||
*/
|
||||
unsigned frames;
|
||||
};
|
||||
|
||||
/* Returns true if config key was found. Otherwise,
|
||||
* returns false, and sets value to default value.
|
||||
*/
|
||||
typedef int (*dspfilter_config_get_float_t)(void *userdata,
|
||||
const char *key, float *value, float default_value);
|
||||
|
||||
typedef int (*dspfilter_config_get_int_t)(void *userdata,
|
||||
const char *key, int *value, int default_value);
|
||||
|
||||
/* Allocates an array with values. free() with dspfilter_config_free_t. */
|
||||
typedef int (*dspfilter_config_get_float_array_t)(void *userdata,
|
||||
const char *key, float **values, unsigned *out_num_values,
|
||||
const float *default_values, unsigned num_default_values);
|
||||
|
||||
typedef int (*dspfilter_config_get_int_array_t)(void *userdata,
|
||||
const char *key, int **values, unsigned *out_num_values,
|
||||
const int *default_values, unsigned num_default_values);
|
||||
|
||||
typedef int (*dspfilter_config_get_string_t)(void *userdata,
|
||||
const char *key, char **output, const char *default_output);
|
||||
|
||||
/* Calls free() in host runtime. Sometimes needed on Windows.
|
||||
* free() on NULL is fine. */
|
||||
typedef void (*dspfilter_config_free_t)(void *ptr);
|
||||
|
||||
struct dspfilter_config
|
||||
{
|
||||
dspfilter_config_get_float_t get_float;
|
||||
dspfilter_config_get_int_t get_int;
|
||||
|
||||
dspfilter_config_get_float_array_t get_float_array;
|
||||
dspfilter_config_get_int_array_t get_int_array;
|
||||
|
||||
dspfilter_config_get_string_t get_string;
|
||||
/* Avoid problems where DSP plug and host are
|
||||
* linked against different C runtimes. */
|
||||
dspfilter_config_free_t free;
|
||||
};
|
||||
|
||||
/* Creates a handle of the plugin. Returns NULL if failed. */
|
||||
typedef void *(*dspfilter_init_t)(const struct dspfilter_info *info,
|
||||
const struct dspfilter_config *config, void *userdata);
|
||||
|
||||
/* Frees the handle. */
|
||||
typedef void (*dspfilter_free_t)(void *data);
|
||||
|
||||
/* Processes input data.
|
||||
* The plugin is allowed to return variable sizes for output data. */
|
||||
typedef void (*dspfilter_process_t)(void *data,
|
||||
struct dspfilter_output *output, const struct dspfilter_input *input);
|
||||
|
||||
struct dspfilter_implementation
|
||||
{
|
||||
dspfilter_init_t init;
|
||||
dspfilter_process_t process;
|
||||
dspfilter_free_t free;
|
||||
|
||||
/* Must be DSPFILTER_API_VERSION */
|
||||
unsigned api_version;
|
||||
|
||||
/* Human readable identifier of implementation. */
|
||||
const char *ident;
|
||||
|
||||
/* Computer-friendly short version of ident.
|
||||
* Lower case, no spaces and special characters, etc. */
|
||||
const char *short_ident;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,165 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#include "dspfilter.h"
|
||||
|
||||
struct echo_channel
|
||||
{
|
||||
float *buffer;
|
||||
unsigned ptr;
|
||||
unsigned frames;
|
||||
float feedback;
|
||||
};
|
||||
|
||||
struct echo_data
|
||||
{
|
||||
struct echo_channel *channels;
|
||||
unsigned num_channels;
|
||||
float amp;
|
||||
};
|
||||
|
||||
static void echo_free(void *data)
|
||||
{
|
||||
unsigned i;
|
||||
struct echo_data *echo = (struct echo_data*)data;
|
||||
|
||||
for (i = 0; i < echo->num_channels; i++)
|
||||
free(echo->channels[i].buffer);
|
||||
free(echo->channels);
|
||||
free(echo);
|
||||
}
|
||||
|
||||
static void echo_process(void *data, struct dspfilter_output *output,
|
||||
const struct dspfilter_input *input)
|
||||
{
|
||||
unsigned i, c;
|
||||
struct echo_data *echo = (struct echo_data*)data;
|
||||
|
||||
output->samples = input->samples;
|
||||
output->frames = input->frames;
|
||||
|
||||
float *out = output->samples;
|
||||
|
||||
for (i = 0; i < input->frames; i++, out += 2)
|
||||
{
|
||||
float left, right;
|
||||
float echo_left = 0.0f;
|
||||
float echo_right = 0.0f;
|
||||
|
||||
for (c = 0; c < echo->num_channels; c++)
|
||||
{
|
||||
echo_left += echo->channels[c].buffer[(echo->channels[c].ptr << 1) + 0];
|
||||
echo_right += echo->channels[c].buffer[(echo->channels[c].ptr << 1) + 1];
|
||||
}
|
||||
|
||||
echo_left *= echo->amp;
|
||||
echo_right *= echo->amp;
|
||||
|
||||
left = out[0] + echo_left;
|
||||
right = out[1] + echo_right;
|
||||
|
||||
for (c = 0; c < echo->num_channels; c++)
|
||||
{
|
||||
float feedback_left = out[0] + echo->channels[c].feedback * echo_left;
|
||||
float feedback_right = out[1] + echo->channels[c].feedback * echo_right;
|
||||
|
||||
echo->channels[c].buffer[(echo->channels[c].ptr << 1) + 0] = feedback_left;
|
||||
echo->channels[c].buffer[(echo->channels[c].ptr << 1) + 1] = feedback_right;
|
||||
|
||||
echo->channels[c].ptr = (echo->channels[c].ptr + 1) % echo->channels[c].frames;
|
||||
}
|
||||
|
||||
out[0] = left;
|
||||
out[1] = right;
|
||||
}
|
||||
}
|
||||
|
||||
static void *echo_init(const struct dspfilter_info *info,
|
||||
const struct dspfilter_config *config, void *userdata)
|
||||
{
|
||||
unsigned i, channels;
|
||||
float *delay = NULL, *feedback = NULL;
|
||||
unsigned num_delay = 0, num_feedback = 0;
|
||||
|
||||
static const float default_delay[] = { 200.0f };
|
||||
static const float default_feedback[] = { 0.5f };
|
||||
struct echo_data *echo = (struct echo_data*)calloc(1, sizeof(*echo));
|
||||
if (!echo)
|
||||
return NULL;
|
||||
|
||||
config->get_float_array(userdata, "delay", &delay, &num_delay, default_delay, 1);
|
||||
config->get_float_array(userdata, "feedback", &feedback, &num_feedback, default_feedback, 1);
|
||||
config->get_float(userdata, "amp", &echo->amp, 0.2f);
|
||||
|
||||
channels = num_feedback = num_delay = MIN(num_delay, num_feedback);
|
||||
|
||||
echo->channels = (struct echo_channel*)calloc(channels, sizeof(*echo->channels));
|
||||
if (!echo->channels)
|
||||
goto error;
|
||||
|
||||
echo->num_channels = channels;
|
||||
|
||||
for (i = 0; i < channels; i++)
|
||||
{
|
||||
unsigned frames = (unsigned)(delay[i] * info->input_rate / 1000.0f + 0.5f);
|
||||
if (!frames)
|
||||
goto error;
|
||||
|
||||
echo->channels[i].buffer = (float*)calloc(frames, 2 * sizeof(float));
|
||||
if (!echo->channels[i].buffer)
|
||||
goto error;
|
||||
|
||||
echo->channels[i].frames = frames;
|
||||
echo->channels[i].feedback = feedback[i];
|
||||
}
|
||||
|
||||
config->free(delay);
|
||||
config->free(feedback);
|
||||
return echo;
|
||||
|
||||
error:
|
||||
config->free(delay);
|
||||
config->free(feedback);
|
||||
echo_free(echo);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static const struct dspfilter_implementation echo_plug = {
|
||||
echo_init,
|
||||
echo_process,
|
||||
echo_free,
|
||||
|
||||
DSPFILTER_API_VERSION,
|
||||
"Multi-Echo",
|
||||
"echo",
|
||||
};
|
||||
|
||||
#ifdef HAVE_FILTERS_BUILTIN
|
||||
#define dspfilter_get_implementation echo_dspfilter_get_implementation
|
||||
#endif
|
||||
|
||||
const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_simd_mask_t mask)
|
||||
{
|
||||
(void)mask;
|
||||
return &echo_plug;
|
||||
}
|
||||
|
||||
#undef dspfilter_get_implementation
|
||||
|
||||
@@ -1,25 +1,17 @@
|
||||
/* Copyright (C) 2010-2020 The RetroArch team
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (eq.c).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Permission is hereby granted, free of charge,
|
||||
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -27,7 +19,8 @@
|
||||
#include <retro_inline.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <filters.h>
|
||||
#include <libretro_dspfilter.h>
|
||||
|
||||
#include "dspfilter.h"
|
||||
|
||||
#include "fft/fft.c"
|
||||
|
||||
@@ -149,8 +142,7 @@ static void generate_response(fft_complex_t *response,
|
||||
gains++;
|
||||
}
|
||||
|
||||
/* Create a response by linear interpolation between
|
||||
* known frequency sample points. */
|
||||
// Create a response by linear interpolation between known frequency sample points.
|
||||
for (i = 0; i <= samples; i++)
|
||||
{
|
||||
float gain;
|
||||
@@ -212,11 +204,9 @@ static void create_filter(struct eq_data *eq, unsigned size_log2,
|
||||
/* Get equivalent time-domain filter. */
|
||||
fft_process_inverse(fft, time_filter, eq->filter, 1);
|
||||
|
||||
/* ifftshift() to create the correct linear phase filter.
|
||||
* The filter response was designed with zero phase, which
|
||||
* won't work unless we compensate
|
||||
* for the repeating property of the FFT here
|
||||
* by flipping left and right blocks. */
|
||||
// ifftshift() to create the correct linear phase filter.
|
||||
// The filter response was designed with zero phase, which won't work unless we compensate
|
||||
// for the repeating property of the FFT here by flipping left and right blocks.
|
||||
for (i = 0; i < half_block_size; i++)
|
||||
{
|
||||
float tmp = time_filter[i + half_block_size];
|
||||
@@ -271,6 +261,7 @@ static void *eq_init(const struct dspfilter_info *info,
|
||||
if (!eq)
|
||||
return NULL;
|
||||
|
||||
|
||||
config->get_float(userdata, "window_beta", &beta, 4.0f);
|
||||
|
||||
config->get_int(userdata, "block_size_log2", &size_log2, 8);
|
||||
@@ -348,3 +339,4 @@ const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_si
|
||||
}
|
||||
|
||||
#undef dspfilter_get_implementation
|
||||
|
||||
@@ -0,0 +1,194 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "fft.h"
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
struct fft
|
||||
{
|
||||
fft_complex_t *interleave_buffer;
|
||||
fft_complex_t *phase_lut;
|
||||
unsigned *bitinverse_buffer;
|
||||
unsigned size;
|
||||
};
|
||||
|
||||
static unsigned bitswap(unsigned x, unsigned size_log2)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned ret = 0;
|
||||
for (i = 0; i < size_log2; i++)
|
||||
ret |= ((x >> i) & 1) << (size_log2 - i - 1);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void build_bitinverse(unsigned *bitinverse, unsigned size_log2)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned size = 1 << size_log2;
|
||||
for (i = 0; i < size; i++)
|
||||
bitinverse[i] = bitswap(i, size_log2);
|
||||
}
|
||||
|
||||
static fft_complex_t exp_imag(double phase)
|
||||
{
|
||||
fft_complex_t out = { cos(phase), sin(phase) };
|
||||
return out;
|
||||
}
|
||||
|
||||
static void build_phase_lut(fft_complex_t *out, int size)
|
||||
{
|
||||
int i;
|
||||
out += size;
|
||||
for (i = -size; i <= size; i++)
|
||||
out[i] = exp_imag((M_PI * i) / size);
|
||||
}
|
||||
|
||||
static void interleave_complex(const unsigned *bitinverse,
|
||||
fft_complex_t *out, const fft_complex_t *in,
|
||||
unsigned samples, unsigned step)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < samples; i++, in += step)
|
||||
out[bitinverse[i]] = *in;
|
||||
}
|
||||
|
||||
static void interleave_float(const unsigned *bitinverse,
|
||||
fft_complex_t *out, const float *in,
|
||||
unsigned samples, unsigned step)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < samples; i++, in += step)
|
||||
{
|
||||
unsigned inv_i = bitinverse[i];
|
||||
out[inv_i].real = *in;
|
||||
out[inv_i].imag = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
static void resolve_float(float *out, const fft_complex_t *in, unsigned samples,
|
||||
float gain, unsigned step)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < samples; i++, in++, out += step)
|
||||
*out = gain * in->real;
|
||||
}
|
||||
|
||||
fft_t *fft_new(unsigned block_size_log2)
|
||||
{
|
||||
fft_t *fft = (fft_t*)calloc(1, sizeof(*fft));
|
||||
if (!fft)
|
||||
return NULL;
|
||||
|
||||
unsigned size = 1 << block_size_log2;
|
||||
|
||||
fft->interleave_buffer = (fft_complex_t*)calloc(size, sizeof(*fft->interleave_buffer));
|
||||
fft->bitinverse_buffer = (unsigned*)calloc(size, sizeof(*fft->bitinverse_buffer));
|
||||
fft->phase_lut = (fft_complex_t*)calloc(2 * size + 1, sizeof(*fft->phase_lut));
|
||||
|
||||
if (!fft->interleave_buffer || !fft->bitinverse_buffer || !fft->phase_lut)
|
||||
goto error;
|
||||
|
||||
fft->size = size;
|
||||
|
||||
build_bitinverse(fft->bitinverse_buffer, block_size_log2);
|
||||
build_phase_lut(fft->phase_lut, size);
|
||||
return fft;
|
||||
|
||||
error:
|
||||
fft_free(fft);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void fft_free(fft_t *fft)
|
||||
{
|
||||
if (!fft)
|
||||
return;
|
||||
|
||||
free(fft->interleave_buffer);
|
||||
free(fft->bitinverse_buffer);
|
||||
free(fft->phase_lut);
|
||||
free(fft);
|
||||
}
|
||||
|
||||
static void butterfly(fft_complex_t *a, fft_complex_t *b, fft_complex_t mod)
|
||||
{
|
||||
mod = fft_complex_mul(mod, *b);
|
||||
*b = fft_complex_sub(*a, mod);
|
||||
*a = fft_complex_add(*a, mod);
|
||||
}
|
||||
|
||||
static void butterflies(fft_complex_t *butterfly_buf,
|
||||
const fft_complex_t *phase_lut,
|
||||
int phase_dir, unsigned step_size, unsigned samples)
|
||||
{
|
||||
unsigned i, j;
|
||||
for (i = 0; i < samples; i += step_size << 1)
|
||||
{
|
||||
int phase_step = (int)samples * phase_dir / (int)step_size;
|
||||
for (j = i; j < i + step_size; j++)
|
||||
butterfly(&butterfly_buf[j], &butterfly_buf[j + step_size], phase_lut[phase_step * (int)(j - i)]);
|
||||
}
|
||||
}
|
||||
|
||||
void fft_process_forward_complex(fft_t *fft,
|
||||
fft_complex_t *out, const fft_complex_t *in, unsigned step)
|
||||
{
|
||||
unsigned step_size;
|
||||
unsigned samples = fft->size;
|
||||
interleave_complex(fft->bitinverse_buffer, out, in, samples, step);
|
||||
|
||||
for (step_size = 1; step_size < samples; step_size <<= 1)
|
||||
{
|
||||
butterflies(out,
|
||||
fft->phase_lut + samples,
|
||||
-1, step_size, samples);
|
||||
}
|
||||
}
|
||||
|
||||
void fft_process_forward(fft_t *fft,
|
||||
fft_complex_t *out, const float *in, unsigned step)
|
||||
{
|
||||
unsigned step_size;
|
||||
unsigned samples = fft->size;
|
||||
interleave_float(fft->bitinverse_buffer, out, in, samples, step);
|
||||
|
||||
for (step_size = 1; step_size < fft->size; step_size <<= 1)
|
||||
{
|
||||
butterflies(out,
|
||||
fft->phase_lut + samples,
|
||||
-1, step_size, samples);
|
||||
}
|
||||
}
|
||||
|
||||
void fft_process_inverse(fft_t *fft,
|
||||
float *out, const fft_complex_t *in, unsigned step)
|
||||
{
|
||||
unsigned step_size;
|
||||
unsigned samples = fft->size;
|
||||
interleave_complex(fft->bitinverse_buffer, fft->interleave_buffer, in, samples, 1);
|
||||
|
||||
for (step_size = 1; step_size < samples; step_size <<= 1)
|
||||
{
|
||||
butterflies(fft->interleave_buffer,
|
||||
fft->phase_lut + samples,
|
||||
1, step_size, samples);
|
||||
}
|
||||
|
||||
resolve_float(out, fft->interleave_buffer, samples, 1.0f / samples, step);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef RARCH_FFT_H__
|
||||
#define RARCH_FFT_H__
|
||||
|
||||
#include <retro_inline.h>
|
||||
|
||||
typedef struct fft fft_t;
|
||||
|
||||
// C99 <complex.h> would be nice.
|
||||
typedef struct
|
||||
{
|
||||
float real;
|
||||
float imag;
|
||||
} fft_complex_t;
|
||||
|
||||
static INLINE fft_complex_t fft_complex_mul(fft_complex_t a,
|
||||
fft_complex_t b)
|
||||
{
|
||||
fft_complex_t out = {
|
||||
a.real * b.real - a.imag * b.imag,
|
||||
a.imag * b.real + a.real * b.imag,
|
||||
};
|
||||
|
||||
return out;
|
||||
|
||||
}
|
||||
|
||||
static INLINE fft_complex_t fft_complex_add(fft_complex_t a,
|
||||
fft_complex_t b)
|
||||
{
|
||||
fft_complex_t out = {
|
||||
a.real + b.real,
|
||||
a.imag + b.imag,
|
||||
};
|
||||
|
||||
return out;
|
||||
|
||||
}
|
||||
|
||||
static INLINE fft_complex_t fft_complex_sub(fft_complex_t a,
|
||||
fft_complex_t b)
|
||||
{
|
||||
fft_complex_t out = {
|
||||
a.real - b.real,
|
||||
a.imag - b.imag,
|
||||
};
|
||||
|
||||
return out;
|
||||
|
||||
}
|
||||
|
||||
static INLINE fft_complex_t fft_complex_conj(fft_complex_t a)
|
||||
{
|
||||
fft_complex_t out = {
|
||||
a.real, -a.imag,
|
||||
};
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
fft_t *fft_new(unsigned block_size_log2);
|
||||
|
||||
void fft_free(fft_t *fft);
|
||||
|
||||
void fft_process_forward_complex(fft_t *fft,
|
||||
fft_complex_t *out, const fft_complex_t *in, unsigned step);
|
||||
|
||||
void fft_process_forward(fft_t *fft,
|
||||
fft_complex_t *out, const float *in, unsigned step);
|
||||
|
||||
void fft_process_inverse(fft_t *fft,
|
||||
float *out, const fft_complex_t *in, unsigned step);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,32 +1,25 @@
|
||||
/* Copyright (C) 2010-2020 The RetroArch team
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2014 - Brad Miller
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (iir.c).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Permission is hereby granted, free of charge,
|
||||
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "dspfilter.h"
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <libretro_dspfilter.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#define sqr(a) ((a) * (a))
|
||||
|
||||
@@ -67,29 +60,34 @@ static void iir_free(void *data)
|
||||
static void iir_process(void *data, struct dspfilter_output *output,
|
||||
const struct dspfilter_input *input)
|
||||
{
|
||||
float b0, b1, b2, a0, a1, a2;
|
||||
float xn1_l, xn2_l, yn1_l, yn2_l;
|
||||
float xn1_r, xn2_r, yn1_r, yn2_r;
|
||||
unsigned i;
|
||||
float *out;
|
||||
struct iir_data *iir = (struct iir_data*)data;
|
||||
float *out = output->samples;
|
||||
|
||||
float b0 = iir->b0;
|
||||
float b1 = iir->b1;
|
||||
float b2 = iir->b2;
|
||||
float a0 = iir->a0;
|
||||
float a1 = iir->a1;
|
||||
float a2 = iir->a2;
|
||||
output->samples = input->samples;
|
||||
output->frames = input->frames;
|
||||
|
||||
float xn1_l = iir->l.xn1;
|
||||
float xn2_l = iir->l.xn2;
|
||||
float yn1_l = iir->l.yn1;
|
||||
float yn2_l = iir->l.yn2;
|
||||
out = output->samples;
|
||||
|
||||
float xn1_r = iir->r.xn1;
|
||||
float xn2_r = iir->r.xn2;
|
||||
float yn1_r = iir->r.yn1;
|
||||
float yn2_r = iir->r.yn2;
|
||||
b0 = iir->b0;
|
||||
b1 = iir->b1;
|
||||
b2 = iir->b2;
|
||||
a0 = iir->a0;
|
||||
a1 = iir->a1;
|
||||
a2 = iir->a2;
|
||||
|
||||
output->samples = input->samples;
|
||||
output->frames = input->frames;
|
||||
xn1_l = iir->l.xn1;
|
||||
xn2_l = iir->l.xn2;
|
||||
yn1_l = iir->l.yn1;
|
||||
yn2_l = iir->l.yn2;
|
||||
|
||||
xn1_r = iir->r.xn1;
|
||||
xn2_r = iir->r.xn2;
|
||||
yn1_r = iir->r.yn1;
|
||||
yn2_r = iir->r.yn2;
|
||||
|
||||
for (i = 0; i < input->frames; i++, out += 2)
|
||||
{
|
||||
@@ -99,18 +97,18 @@ static void iir_process(void *data, struct dspfilter_output *output,
|
||||
float l = (b0 * in_l + b1 * xn1_l + b2 * xn2_l - a1 * yn1_l - a2 * yn2_l) / a0;
|
||||
float r = (b0 * in_r + b1 * xn1_r + b2 * xn2_r - a1 * yn1_r - a2 * yn2_r) / a0;
|
||||
|
||||
xn2_l = xn1_l;
|
||||
xn1_l = in_l;
|
||||
yn2_l = yn1_l;
|
||||
yn1_l = l;
|
||||
xn2_l = xn1_l;
|
||||
xn1_l = in_l;
|
||||
yn2_l = yn1_l;
|
||||
yn1_l = l;
|
||||
|
||||
xn2_r = xn1_r;
|
||||
xn1_r = in_r;
|
||||
yn2_r = yn1_r;
|
||||
yn1_r = r;
|
||||
xn2_r = xn1_r;
|
||||
xn1_r = in_r;
|
||||
yn2_r = yn1_r;
|
||||
yn1_r = r;
|
||||
|
||||
out[0] = l;
|
||||
out[1] = r;
|
||||
out[0] = l;
|
||||
out[1] = r;
|
||||
}
|
||||
|
||||
iir->l.xn1 = xn1_l;
|
||||
@@ -124,7 +122,7 @@ static void iir_process(void *data, struct dspfilter_output *output,
|
||||
iir->r.yn2 = yn2_r;
|
||||
}
|
||||
|
||||
#define CHECK(x) if (string_is_equal(str, #x)) return x
|
||||
#define CHECK(x) if (!strcmp(str, #x)) return x
|
||||
static enum IIRFilter str_to_type(const char *str)
|
||||
{
|
||||
CHECK(LPF);
|
||||
@@ -139,8 +137,7 @@ static enum IIRFilter str_to_type(const char *str)
|
||||
CHECK(LSH);
|
||||
CHECK(HSH);
|
||||
CHECK(RIAA_CD);
|
||||
|
||||
return LPF; /* Fallback. */
|
||||
return LPF; // Fallback.
|
||||
}
|
||||
|
||||
static void make_poly_from_roots(
|
||||
@@ -212,7 +209,7 @@ static void iir_filter_init(struct iir_data *iir,
|
||||
a1 = -2.0 * cs;
|
||||
a2 = 1.0 - a1pha;
|
||||
break;
|
||||
case NOTCH:
|
||||
case NOTCH:
|
||||
b0 = 1.0;
|
||||
b1 = -2.0 * cs;
|
||||
b2 = 1.0;
|
||||
@@ -253,7 +250,7 @@ static void iir_filter_init(struct iir_data *iir,
|
||||
make_poly_from_roots(zeros, 2, b);
|
||||
make_poly_from_roots(poles, 2, a);
|
||||
}
|
||||
|
||||
|
||||
b0 = b[0];
|
||||
b1 = b[1];
|
||||
b2 = b[2];
|
||||
@@ -261,6 +258,7 @@ static void iir_filter_init(struct iir_data *iir,
|
||||
a1 = a[1];
|
||||
a2 = a[2];
|
||||
|
||||
|
||||
/* Normalise to 0dB at 1kHz (Thanks to Glenn Davis) */
|
||||
y = 2.0 * M_PI * 1000.0 / sample_rate;
|
||||
b_re = b0 + b1 * cos(-y) + b2 * cos(-2.0 * y);
|
||||
@@ -271,15 +269,15 @@ static void iir_filter_init(struct iir_data *iir,
|
||||
b0 *= g; b1 *= g; b2 *= g;
|
||||
break;
|
||||
}
|
||||
case PEQ:
|
||||
case PEQ:
|
||||
b0 = 1.0 + a1pha * A;
|
||||
b1 = -2.0 * cs;
|
||||
b2 = 1.0 - a1pha * A;
|
||||
a0 = 1.0 + a1pha / A;
|
||||
a1 = -2.0 * cs;
|
||||
a2 = 1.0 - a1pha / A;
|
||||
break;
|
||||
case BBOOST:
|
||||
break;
|
||||
case BBOOST:
|
||||
beta = sqrt((A * A + 1) / 1.0 - (pow((A - 1), 2)));
|
||||
b0 = A * ((A + 1) - (A - 1) * cs + beta * sn);
|
||||
b1 = 2 * A * ((A - 1) - (A + 1) * cs);
|
||||
@@ -328,9 +326,9 @@ static void *iir_init(const struct dspfilter_info *info,
|
||||
const struct dspfilter_config *config, void *userdata)
|
||||
{
|
||||
float freq, qual, gain;
|
||||
enum IIRFilter filter = LPF;
|
||||
char *type = NULL;
|
||||
struct iir_data *iir = (struct iir_data*)calloc(1, sizeof(*iir));
|
||||
enum IIRFilter filter;
|
||||
char *type = NULL;
|
||||
struct iir_data *iir = (struct iir_data*)calloc(1, sizeof(*iir));
|
||||
if (!iir)
|
||||
return NULL;
|
||||
|
||||
@@ -368,3 +366,4 @@ const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_si
|
||||
}
|
||||
|
||||
#undef dspfilter_get_implementation
|
||||
|
||||
File renamed without changes.
@@ -0,0 +1,96 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "dspfilter.h"
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
struct panning_data
|
||||
{
|
||||
float left[2];
|
||||
float right[2];
|
||||
};
|
||||
|
||||
static void panning_free(void *data)
|
||||
{
|
||||
free(data);
|
||||
}
|
||||
|
||||
static void panning_process(void *data, struct dspfilter_output *output,
|
||||
const struct dspfilter_input *input)
|
||||
{
|
||||
unsigned i;
|
||||
float *out;
|
||||
struct panning_data *pan = (struct panning_data*)data;
|
||||
|
||||
output->samples = input->samples;
|
||||
output->frames = input->frames;
|
||||
out = output->samples;
|
||||
|
||||
for (i = 0; i < input->frames; i++, out += 2)
|
||||
{
|
||||
float left = out[0];
|
||||
float right = out[1];
|
||||
out[0] = left * pan->left[0] + right * pan->left[1];
|
||||
out[1] = left * pan->right[0] + right * pan->right[1];
|
||||
}
|
||||
}
|
||||
|
||||
static void *panning_init(const struct dspfilter_info *info,
|
||||
const struct dspfilter_config *config, void *userdata)
|
||||
{
|
||||
static const float default_left[] = { 1.0f, 0.0f };
|
||||
static const float default_right[] = { 0.0f, 1.0f };
|
||||
float *left = NULL, *right = NULL;
|
||||
unsigned num_left = 0, num_right = 0;
|
||||
struct panning_data *pan = (struct panning_data*)calloc(1, sizeof(*pan));
|
||||
if (!pan)
|
||||
return NULL;
|
||||
|
||||
config->get_float_array(userdata, "left_mix", &left, &num_left, default_left, 2);
|
||||
config->get_float_array(userdata, "right_mix", &right, &num_right, default_right, 2);
|
||||
|
||||
memcpy(pan->left, (num_left == 2) ? left : default_left, sizeof(pan->left));
|
||||
memcpy(pan->right, (num_right == 2) ? right : default_right, sizeof(pan->right));
|
||||
|
||||
config->free(left);
|
||||
config->free(right);
|
||||
|
||||
return pan;
|
||||
}
|
||||
|
||||
static const struct dspfilter_implementation panning = {
|
||||
panning_init,
|
||||
panning_process,
|
||||
panning_free,
|
||||
|
||||
DSPFILTER_API_VERSION,
|
||||
"Panning",
|
||||
"panning",
|
||||
};
|
||||
|
||||
#ifdef HAVE_FILTERS_BUILTIN
|
||||
#define dspfilter_get_implementation panning_dspfilter_get_implementation
|
||||
#endif
|
||||
|
||||
const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_simd_mask_t mask)
|
||||
{
|
||||
(void)mask;
|
||||
return &panning;
|
||||
}
|
||||
|
||||
#undef dspfilter_get_implementation
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2014 - Brad Miller
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "dspfilter.h"
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#define phaserlfoshape 4.0
|
||||
#define phaserlfoskipsamples 20
|
||||
|
||||
struct phaser_data
|
||||
{
|
||||
float freq;
|
||||
float startphase;
|
||||
float fb;
|
||||
float depth;
|
||||
float drywet;
|
||||
float old[2][24];
|
||||
float gain;
|
||||
float fbout[2];
|
||||
float lfoskip;
|
||||
float phase;
|
||||
|
||||
int stages;
|
||||
unsigned long skipcount;
|
||||
};
|
||||
|
||||
static void phaser_free(void *data)
|
||||
{
|
||||
free(data);
|
||||
}
|
||||
|
||||
static void phaser_process(void *data, struct dspfilter_output *output,
|
||||
const struct dspfilter_input *input)
|
||||
{
|
||||
unsigned i, c;
|
||||
int s;
|
||||
float m[2], tmp[2], *out;
|
||||
struct phaser_data *ph = (struct phaser_data*)data;
|
||||
|
||||
output->samples = input->samples;
|
||||
output->frames = input->frames;
|
||||
out = output->samples;
|
||||
|
||||
for (i = 0; i < input->frames; i++, out += 2)
|
||||
{
|
||||
float in[2] = { out[0], out[1] };
|
||||
|
||||
for (c = 0; c < 2; c++)
|
||||
m[c] = in[c] + ph->fbout[c] * ph->fb * 0.01f;
|
||||
|
||||
if ((ph->skipcount++ % phaserlfoskipsamples) == 0)
|
||||
{
|
||||
ph->gain = 0.5 * (1.0 + cos(ph->skipcount * ph->lfoskip + ph->phase));
|
||||
ph->gain = (exp(ph->gain * phaserlfoshape) - 1.0) / (exp(phaserlfoshape) - 1);
|
||||
ph->gain = 1.0 - ph->gain * ph->depth;
|
||||
}
|
||||
|
||||
for (s = 0; s < ph->stages; s++)
|
||||
{
|
||||
for (c = 0; c < 2; c++)
|
||||
{
|
||||
tmp[c] = ph->old[c][s];
|
||||
ph->old[c][s] = ph->gain * tmp[c] + m[c];
|
||||
m[c] = tmp[c] - ph->gain * ph->old[c][s];
|
||||
}
|
||||
}
|
||||
|
||||
for (c = 0; c < 2; c++)
|
||||
{
|
||||
ph->fbout[c] = m[c];
|
||||
out[c] = m[c] * ph->drywet + in[c] * (1.0f - ph->drywet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void *phaser_init(const struct dspfilter_info *info,
|
||||
const struct dspfilter_config *config, void *userdata)
|
||||
{
|
||||
float lfo_freq, lfo_start_phase;
|
||||
struct phaser_data *ph = (struct phaser_data*)calloc(1, sizeof(*ph));
|
||||
if (!ph)
|
||||
return NULL;
|
||||
|
||||
config->get_float(userdata, "lfo_freq", &lfo_freq, 0.4f);
|
||||
config->get_float(userdata, "lfo_start_phase", &lfo_start_phase, 0.0f);
|
||||
config->get_float(userdata, "feedback", &ph->fb, 0.0f);
|
||||
config->get_float(userdata, "depth", &ph->depth, 0.4f);
|
||||
config->get_float(userdata, "dry_wet", &ph->drywet, 0.5f);
|
||||
config->get_int(userdata, "stages", &ph->stages, 2);
|
||||
|
||||
if (ph->stages < 1)
|
||||
ph->stages = 1;
|
||||
else if (ph->stages > 24)
|
||||
ph->stages = 24;
|
||||
|
||||
ph->lfoskip = lfo_freq * 2.0 * M_PI / info->input_rate;
|
||||
ph->phase = lfo_start_phase * M_PI / 180.0;
|
||||
|
||||
return ph;
|
||||
}
|
||||
|
||||
static const struct dspfilter_implementation phaser_plug = {
|
||||
phaser_init,
|
||||
phaser_process,
|
||||
phaser_free,
|
||||
|
||||
DSPFILTER_API_VERSION,
|
||||
"Phaser",
|
||||
"phaser",
|
||||
};
|
||||
|
||||
#ifdef HAVE_FILTERS_BUILTIN
|
||||
#define dspfilter_get_implementation phaser_dspfilter_get_implementation
|
||||
#endif
|
||||
|
||||
const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_simd_mask_t mask)
|
||||
{
|
||||
(void)mask;
|
||||
return &phaser_plug;
|
||||
}
|
||||
|
||||
#undef dspfilter_get_implementation
|
||||
|
||||
@@ -0,0 +1,319 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2014 - Brad Miller
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "dspfilter.h"
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <retro_inline.h>
|
||||
|
||||
struct comb
|
||||
{
|
||||
float *buffer;
|
||||
unsigned bufsize;
|
||||
unsigned bufidx;
|
||||
|
||||
float feedback;
|
||||
float filterstore;
|
||||
float damp1, damp2;
|
||||
};
|
||||
|
||||
struct allpass
|
||||
{
|
||||
float *buffer;
|
||||
float feedback;
|
||||
unsigned bufsize;
|
||||
unsigned bufidx;
|
||||
};
|
||||
|
||||
static INLINE float comb_process(struct comb *c, float input)
|
||||
{
|
||||
float output = c->buffer[c->bufidx];
|
||||
c->filterstore = (output * c->damp2) + (c->filterstore * c->damp1);
|
||||
|
||||
c->buffer[c->bufidx] = input + (c->filterstore * c->feedback);
|
||||
|
||||
c->bufidx++;
|
||||
if (c->bufidx >= c->bufsize)
|
||||
c->bufidx = 0;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
static INLINE float allpass_process(struct allpass *a, float input)
|
||||
{
|
||||
float bufout = a->buffer[a->bufidx];
|
||||
float output = -input + bufout;
|
||||
a->buffer[a->bufidx] = input + bufout * a->feedback;
|
||||
|
||||
a->bufidx++;
|
||||
if (a->bufidx >= a->bufsize)
|
||||
a->bufidx = 0;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
#define numcombs 8
|
||||
#define numallpasses 4
|
||||
static const float muted = 0;
|
||||
static const float fixedgain = 0.015f;
|
||||
static const float scalewet = 3;
|
||||
static const float scaledry = 2;
|
||||
static const float scaledamp = 0.4f;
|
||||
static const float scaleroom = 0.28f;
|
||||
static const float offsetroom = 0.7f;
|
||||
static const float initialroom = 0.5f;
|
||||
static const float initialdamp = 0.5f;
|
||||
static const float initialwet = 1.0f / 3.0f;
|
||||
static const float initialdry = 0;
|
||||
static const float initialwidth = 1;
|
||||
static const float initialmode = 0;
|
||||
static const float freezemode = 0.5f;
|
||||
|
||||
#define combtuningL1 1116
|
||||
#define combtuningL2 1188
|
||||
#define combtuningL3 1277
|
||||
#define combtuningL4 1356
|
||||
#define combtuningL5 1422
|
||||
#define combtuningL6 1491
|
||||
#define combtuningL7 1557
|
||||
#define combtuningL8 1617
|
||||
#define allpasstuningL1 556
|
||||
#define allpasstuningL2 441
|
||||
#define allpasstuningL3 341
|
||||
#define allpasstuningL4 225
|
||||
|
||||
struct revmodel
|
||||
{
|
||||
struct comb combL[numcombs];
|
||||
struct allpass allpassL[numallpasses];
|
||||
|
||||
float bufcombL1[combtuningL1];
|
||||
float bufcombL2[combtuningL2];
|
||||
float bufcombL3[combtuningL3];
|
||||
float bufcombL4[combtuningL4];
|
||||
float bufcombL5[combtuningL5];
|
||||
float bufcombL6[combtuningL6];
|
||||
float bufcombL7[combtuningL7];
|
||||
float bufcombL8[combtuningL8];
|
||||
|
||||
float bufallpassL1[allpasstuningL1];
|
||||
float bufallpassL2[allpasstuningL2];
|
||||
float bufallpassL3[allpasstuningL3];
|
||||
float bufallpassL4[allpasstuningL4];
|
||||
|
||||
float gain;
|
||||
float roomsize, roomsize1;
|
||||
float damp, damp1;
|
||||
float wet, wet1, wet2;
|
||||
float dry;
|
||||
float width;
|
||||
float mode;
|
||||
};
|
||||
|
||||
static float revmodel_process(struct revmodel *rev, float in)
|
||||
{
|
||||
int i;
|
||||
float mono_out = 0.0f;
|
||||
float mono_in = in;
|
||||
float input = mono_in * rev->gain;
|
||||
for (i = 0; i < numcombs; i++)
|
||||
mono_out += comb_process(&rev->combL[i], input);
|
||||
|
||||
for (i = 0; i < numallpasses; i++)
|
||||
mono_out = allpass_process(&rev->allpassL[i], mono_out);
|
||||
|
||||
return mono_in * rev->dry + mono_out * rev->wet1;
|
||||
}
|
||||
|
||||
static void revmodel_update(struct revmodel *rev)
|
||||
{
|
||||
int i;
|
||||
rev->wet1 = rev->wet * (rev->width / 2.0f + 0.5f);
|
||||
|
||||
if (rev->mode >= freezemode)
|
||||
{
|
||||
rev->roomsize1 = 1.0f;
|
||||
rev->damp1 = 0.0f;
|
||||
rev->gain = muted;
|
||||
}
|
||||
else
|
||||
{
|
||||
rev->roomsize1 = rev->roomsize;
|
||||
rev->damp1 = rev->damp;
|
||||
rev->gain = fixedgain;
|
||||
}
|
||||
|
||||
for (i = 0; i < numcombs; i++)
|
||||
{
|
||||
rev->combL[i].feedback = rev->roomsize1;
|
||||
rev->combL[i].damp1 = rev->damp1;
|
||||
rev->combL[i].damp2 = 1.0f - rev->damp1;
|
||||
}
|
||||
}
|
||||
|
||||
static void revmodel_setroomsize(struct revmodel *rev, float value)
|
||||
{
|
||||
rev->roomsize = value * scaleroom + offsetroom;
|
||||
revmodel_update(rev);
|
||||
}
|
||||
|
||||
static void revmodel_setdamp(struct revmodel *rev, float value)
|
||||
{
|
||||
rev->damp = value * scaledamp;
|
||||
revmodel_update(rev);
|
||||
}
|
||||
|
||||
static void revmodel_setwet(struct revmodel *rev, float value)
|
||||
{
|
||||
rev->wet = value * scalewet;
|
||||
revmodel_update(rev);
|
||||
}
|
||||
|
||||
static void revmodel_setdry(struct revmodel *rev, float value)
|
||||
{
|
||||
rev->dry = value * scaledry;
|
||||
revmodel_update(rev);
|
||||
}
|
||||
|
||||
static void revmodel_setwidth(struct revmodel *rev, float value)
|
||||
{
|
||||
rev->width = value;
|
||||
revmodel_update(rev);
|
||||
}
|
||||
|
||||
static void revmodel_setmode(struct revmodel *rev, float value)
|
||||
{
|
||||
rev->mode = value;
|
||||
revmodel_update(rev);
|
||||
}
|
||||
|
||||
static void revmodel_init(struct revmodel *rev)
|
||||
{
|
||||
rev->combL[0].buffer = rev->bufcombL1; rev->combL[0].bufsize = combtuningL1;
|
||||
rev->combL[1].buffer = rev->bufcombL2; rev->combL[1].bufsize = combtuningL2;
|
||||
rev->combL[2].buffer = rev->bufcombL3; rev->combL[2].bufsize = combtuningL3;
|
||||
rev->combL[3].buffer = rev->bufcombL4; rev->combL[3].bufsize = combtuningL4;
|
||||
rev->combL[4].buffer = rev->bufcombL5; rev->combL[4].bufsize = combtuningL5;
|
||||
rev->combL[5].buffer = rev->bufcombL6; rev->combL[5].bufsize = combtuningL6;
|
||||
rev->combL[6].buffer = rev->bufcombL7; rev->combL[6].bufsize = combtuningL7;
|
||||
rev->combL[7].buffer = rev->bufcombL8; rev->combL[7].bufsize = combtuningL8;
|
||||
|
||||
rev->allpassL[0].buffer = rev->bufallpassL1; rev->allpassL[0].bufsize = allpasstuningL1;
|
||||
rev->allpassL[1].buffer = rev->bufallpassL2; rev->allpassL[1].bufsize = allpasstuningL2;
|
||||
rev->allpassL[2].buffer = rev->bufallpassL3; rev->allpassL[2].bufsize = allpasstuningL3;
|
||||
rev->allpassL[3].buffer = rev->bufallpassL4; rev->allpassL[3].bufsize = allpasstuningL4;
|
||||
|
||||
rev->allpassL[0].feedback = 0.5f;
|
||||
rev->allpassL[1].feedback = 0.5f;
|
||||
rev->allpassL[2].feedback = 0.5f;
|
||||
rev->allpassL[3].feedback = 0.5f;
|
||||
|
||||
revmodel_setwet(rev, initialwet);
|
||||
revmodel_setroomsize(rev, initialroom);
|
||||
revmodel_setdry(rev, initialdry);
|
||||
revmodel_setdamp(rev, initialdamp);
|
||||
revmodel_setwidth(rev, initialwidth);
|
||||
revmodel_setmode(rev, initialmode);
|
||||
}
|
||||
|
||||
struct reverb_data
|
||||
{
|
||||
struct revmodel left, right;
|
||||
};
|
||||
|
||||
static void reverb_free(void *data)
|
||||
{
|
||||
free(data);
|
||||
}
|
||||
|
||||
static void reverb_process(void *data, struct dspfilter_output *output,
|
||||
const struct dspfilter_input *input)
|
||||
{
|
||||
unsigned i;
|
||||
float *out;
|
||||
struct reverb_data *rev = (struct reverb_data*)data;
|
||||
|
||||
output->samples = input->samples;
|
||||
output->frames = input->frames;
|
||||
out = output->samples;
|
||||
|
||||
for (i = 0; i < input->frames; i++, out += 2)
|
||||
{
|
||||
float in[2] = { out[0], out[1] };
|
||||
|
||||
out[0] = revmodel_process(&rev->left, in[0]);
|
||||
out[1] = revmodel_process(&rev->right, in[1]);
|
||||
}
|
||||
}
|
||||
|
||||
static void *reverb_init(const struct dspfilter_info *info,
|
||||
const struct dspfilter_config *config, void *userdata)
|
||||
{
|
||||
float drytime, wettime, damping, roomwidth, roomsize;
|
||||
struct reverb_data *rev = (struct reverb_data*)
|
||||
calloc(1, sizeof(*rev));
|
||||
if (!rev)
|
||||
return NULL;
|
||||
|
||||
config->get_float(userdata, "drytime", &drytime, 0.43f);
|
||||
config->get_float(userdata, "wettime", &wettime, 0.4f);
|
||||
config->get_float(userdata, "damping", &damping, 0.8f);
|
||||
config->get_float(userdata, "roomwidth", &roomwidth, 0.56f);
|
||||
config->get_float(userdata, "roomsize", &roomsize, 0.56f);
|
||||
|
||||
revmodel_init(&rev->left);
|
||||
revmodel_init(&rev->right);
|
||||
|
||||
revmodel_setdamp(&rev->left, damping);
|
||||
revmodel_setdry(&rev->left, drytime);
|
||||
revmodel_setwet(&rev->left, wettime);
|
||||
revmodel_setwidth(&rev->left, roomwidth);
|
||||
revmodel_setroomsize(&rev->left, roomsize);
|
||||
|
||||
revmodel_setdamp(&rev->right, damping);
|
||||
revmodel_setdry(&rev->right, drytime);
|
||||
revmodel_setwet(&rev->right, wettime);
|
||||
revmodel_setwidth(&rev->right, roomwidth);
|
||||
revmodel_setroomsize(&rev->right, roomsize);
|
||||
|
||||
return rev;
|
||||
}
|
||||
|
||||
static const struct dspfilter_implementation reverb_plug = {
|
||||
reverb_init,
|
||||
reverb_process,
|
||||
reverb_free,
|
||||
|
||||
DSPFILTER_API_VERSION,
|
||||
"Reverb",
|
||||
"reverb",
|
||||
};
|
||||
|
||||
#ifdef HAVE_FILTERS_BUILTIN
|
||||
#define dspfilter_get_implementation reverb_dspfilter_get_implementation
|
||||
#endif
|
||||
|
||||
const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_simd_mask_t mask)
|
||||
{
|
||||
(void)mask;
|
||||
return &reverb_plug;
|
||||
}
|
||||
|
||||
#undef dspfilter_get_implementation
|
||||
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2014 - Brad Miller
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "dspfilter.h"
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#define WAHWAH_LFO_SKIP_SAMPLES 30
|
||||
|
||||
struct wahwah_data
|
||||
{
|
||||
float phase;
|
||||
float lfoskip;
|
||||
float b0, b1, b2, a0, a1, a2;
|
||||
float freq, startphase;
|
||||
float depth, freqofs, res;
|
||||
unsigned long skipcount;
|
||||
|
||||
struct
|
||||
{
|
||||
float xn1, xn2, yn1, yn2;
|
||||
} l, r;
|
||||
};
|
||||
|
||||
static void wahwah_free(void *data)
|
||||
{
|
||||
if (data)
|
||||
free(data);
|
||||
}
|
||||
|
||||
static void wahwah_process(void *data, struct dspfilter_output *output,
|
||||
const struct dspfilter_input *input)
|
||||
{
|
||||
unsigned i;
|
||||
float *out;
|
||||
struct wahwah_data *wah = (struct wahwah_data*)data;
|
||||
|
||||
output->samples = input->samples;
|
||||
output->frames = input->frames;
|
||||
out = output->samples;
|
||||
|
||||
for (i = 0; i < input->frames; i++, out += 2)
|
||||
{
|
||||
float out_l, out_r;
|
||||
float in[2] = { out[0], out[1] };
|
||||
|
||||
if ((wah->skipcount++ % WAHWAH_LFO_SKIP_SAMPLES) == 0)
|
||||
{
|
||||
float omega, sn, cs, alpha;
|
||||
float frequency = (1.0 + cos(wah->skipcount * wah->lfoskip + wah->phase)) / 2.0;
|
||||
|
||||
frequency = frequency * wah->depth * (1.0 - wah->freqofs) + wah->freqofs;
|
||||
frequency = exp((frequency - 1.0) * 6.0);
|
||||
|
||||
omega = M_PI * frequency;
|
||||
sn = sin(omega);
|
||||
cs = cos(omega);
|
||||
alpha = sn / (2.0 * wah->res);
|
||||
|
||||
wah->b0 = (1.0 - cs) / 2.0;
|
||||
wah->b1 = 1.0 - cs;
|
||||
wah->b2 = (1.0 - cs) / 2.0;
|
||||
wah->a0 = 1.0 + alpha;
|
||||
wah->a1 = -2.0 * cs;
|
||||
wah->a2 = 1.0 - alpha;
|
||||
}
|
||||
|
||||
out_l = (wah->b0 * in[0] + wah->b1 * wah->l.xn1 + wah->b2 * wah->l.xn2 - wah->a1 * wah->l.yn1 - wah->a2 * wah->l.yn2) / wah->a0;
|
||||
out_r = (wah->b0 * in[1] + wah->b1 * wah->r.xn1 + wah->b2 * wah->r.xn2 - wah->a1 * wah->r.yn1 - wah->a2 * wah->r.yn2) / wah->a0;
|
||||
|
||||
wah->l.xn2 = wah->l.xn1;
|
||||
wah->l.xn1 = in[0];
|
||||
wah->l.yn2 = wah->l.yn1;
|
||||
wah->l.yn1 = out_l;
|
||||
|
||||
wah->r.xn2 = wah->r.xn1;
|
||||
wah->r.xn1 = in[1];
|
||||
wah->r.yn2 = wah->r.yn1;
|
||||
wah->r.yn1 = out_r;
|
||||
|
||||
out[0] = out_l;
|
||||
out[1] = out_r;
|
||||
}
|
||||
}
|
||||
|
||||
static void *wahwah_init(const struct dspfilter_info *info,
|
||||
const struct dspfilter_config *config, void *userdata)
|
||||
{
|
||||
struct wahwah_data *wah = (struct wahwah_data*)calloc(1, sizeof(*wah));
|
||||
if (!wah)
|
||||
return NULL;
|
||||
|
||||
config->get_float(userdata, "lfo_freq", &wah->freq, 1.5f);
|
||||
config->get_float(userdata, "lfo_start_phase", &wah->startphase, 0.0f);
|
||||
config->get_float(userdata, "freq_offset", &wah->freqofs, 0.3f);
|
||||
config->get_float(userdata, "depth", &wah->depth, 0.7f);
|
||||
config->get_float(userdata, "resonance", &wah->res, 2.5f);
|
||||
|
||||
wah->lfoskip = wah->freq * 2.0 * M_PI / info->input_rate;
|
||||
wah->phase = wah->startphase * M_PI / 180.0;
|
||||
|
||||
return wah;
|
||||
}
|
||||
|
||||
static const struct dspfilter_implementation wahwah_plug = {
|
||||
wahwah_init,
|
||||
wahwah_process,
|
||||
wahwah_free,
|
||||
|
||||
DSPFILTER_API_VERSION,
|
||||
"Wah-Wah",
|
||||
"wahwah",
|
||||
};
|
||||
|
||||
#ifdef HAVE_FILTERS_BUILTIN
|
||||
#define dspfilter_get_implementation wahwah_dspfilter_get_implementation
|
||||
#endif
|
||||
|
||||
const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_simd_mask_t mask)
|
||||
{
|
||||
(void)mask;
|
||||
return &wahwah_plug;
|
||||
}
|
||||
|
||||
#undef dspfilter_get_implementation
|
||||
|
||||
@@ -0,0 +1,204 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <file/config_file_userdata.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "audio_resampler_driver.h"
|
||||
#ifdef RARCH_INTERNAL
|
||||
#include "../performance.h"
|
||||
#endif
|
||||
#ifndef DONT_HAVE_STRING_LIST
|
||||
#include "../string_list_special.h"
|
||||
#endif
|
||||
|
||||
static const rarch_resampler_t *resampler_drivers[] = {
|
||||
&sinc_resampler,
|
||||
&CC_resampler,
|
||||
&nearest_resampler,
|
||||
&null_resampler,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static const struct resampler_config resampler_config = {
|
||||
config_userdata_get_float,
|
||||
config_userdata_get_int,
|
||||
config_userdata_get_float_array,
|
||||
config_userdata_get_int_array,
|
||||
config_userdata_get_string,
|
||||
config_userdata_free,
|
||||
};
|
||||
|
||||
/**
|
||||
* find_resampler_driver_index:
|
||||
* @ident : Identifier of resampler driver to find.
|
||||
*
|
||||
* Finds resampler driver index by @ident name.
|
||||
*
|
||||
* Returns: resampler driver index if resampler driver was found, otherwise
|
||||
* -1.
|
||||
**/
|
||||
static int find_resampler_driver_index(const char *ident)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; resampler_drivers[i]; i++)
|
||||
if (string_is_equal_noncase(ident, resampler_drivers[i]->ident))
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* audio_resampler_driver_find_handle:
|
||||
* @idx : index of driver to get handle to.
|
||||
*
|
||||
* Returns: handle to audio resampler driver at index. Can be NULL
|
||||
* if nothing found.
|
||||
**/
|
||||
const void *audio_resampler_driver_find_handle(int idx)
|
||||
{
|
||||
const void *drv = resampler_drivers[idx];
|
||||
if (!drv)
|
||||
return NULL;
|
||||
return drv;
|
||||
}
|
||||
|
||||
/**
|
||||
* audio_resampler_driver_find_ident:
|
||||
* @idx : index of driver to get handle to.
|
||||
*
|
||||
* Returns: Human-readable identifier of audio resampler driver at index.
|
||||
* Can be NULL if nothing found.
|
||||
**/
|
||||
const char *audio_resampler_driver_find_ident(int idx)
|
||||
{
|
||||
const rarch_resampler_t *drv = resampler_drivers[idx];
|
||||
if (!drv)
|
||||
return NULL;
|
||||
return drv->ident;
|
||||
}
|
||||
|
||||
#ifndef DONT_HAVE_STRING_LIST
|
||||
/**
|
||||
* config_get_audio_resampler_driver_options:
|
||||
*
|
||||
* Get an enumerated list of all resampler driver names, separated by '|'.
|
||||
*
|
||||
* Returns: string listing of all resampler driver names, separated by '|'.
|
||||
**/
|
||||
const char* config_get_audio_resampler_driver_options(void)
|
||||
{
|
||||
return char_list_new_special(STRING_LIST_AUDIO_RESAMPLER_DRIVERS, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* find_resampler_driver:
|
||||
* @ident : Identifier of resampler driver to find.
|
||||
*
|
||||
* Finds resampler by @ident name.
|
||||
*
|
||||
* Returns: resampler driver if resampler driver was found, otherwise
|
||||
* NULL.
|
||||
**/
|
||||
static const rarch_resampler_t *find_resampler_driver(const char *ident)
|
||||
{
|
||||
int i = find_resampler_driver_index(ident);
|
||||
|
||||
if (i >= 0)
|
||||
return resampler_drivers[i];
|
||||
|
||||
return resampler_drivers[0];
|
||||
}
|
||||
|
||||
#ifndef RARCH_INTERNAL
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
retro_get_cpu_features_t perf_get_cpu_features_cb;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
static resampler_simd_mask_t resampler_get_cpu_features(void)
|
||||
{
|
||||
#ifdef RARCH_INTERNAL
|
||||
return retro_get_cpu_features();
|
||||
#else
|
||||
return perf_get_cpu_features_cb();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* resampler_append_plugs:
|
||||
* @re : Resampler handle
|
||||
* @backend : Resampler backend that is about to be set.
|
||||
* @bw_ratio : Bandwidth ratio.
|
||||
*
|
||||
* Initializes resampler driver based on queried CPU features.
|
||||
*
|
||||
* Returns: true (1) if successfully initialized, otherwise false (0).
|
||||
**/
|
||||
static bool resampler_append_plugs(void **re,
|
||||
const rarch_resampler_t **backend,
|
||||
double bw_ratio)
|
||||
{
|
||||
resampler_simd_mask_t mask = resampler_get_cpu_features();
|
||||
|
||||
*re = (*backend)->init(&resampler_config, bw_ratio, mask);
|
||||
|
||||
if (!*re)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* rarch_resampler_realloc:
|
||||
* @re : Resampler handle
|
||||
* @backend : Resampler backend that is about to be set.
|
||||
* @ident : Identifier name for resampler we want.
|
||||
* @bw_ratio : Bandwidth ratio.
|
||||
*
|
||||
* Reallocates resampler. Will free previous handle before
|
||||
* allocating a new one. If ident is NULL, first resampler will be used.
|
||||
*
|
||||
* Returns: true (1) if successful, otherwise false (0).
|
||||
**/
|
||||
bool rarch_resampler_realloc(void **re, const rarch_resampler_t **backend,
|
||||
const char *ident, double bw_ratio)
|
||||
{
|
||||
if (*re && *backend)
|
||||
(*backend)->free(*re);
|
||||
|
||||
*re = NULL;
|
||||
*backend = find_resampler_driver(ident);
|
||||
|
||||
if (!resampler_append_plugs(re, backend, bw_ratio))
|
||||
goto error;
|
||||
|
||||
return true;
|
||||
|
||||
error:
|
||||
if (!*re)
|
||||
*backend = NULL;
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,213 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __AUDIO_RESAMPLER_DRIVER_H
|
||||
#define __AUDIO_RESAMPLER_DRIVER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <math.h>
|
||||
#include <boolean.h>
|
||||
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#define RESAMPLER_SIMD_SSE (1 << 0)
|
||||
#define RESAMPLER_SIMD_SSE2 (1 << 1)
|
||||
#define RESAMPLER_SIMD_VMX (1 << 2)
|
||||
#define RESAMPLER_SIMD_VMX128 (1 << 3)
|
||||
#define RESAMPLER_SIMD_AVX (1 << 4)
|
||||
#define RESAMPLER_SIMD_NEON (1 << 5)
|
||||
#define RESAMPLER_SIMD_SSE3 (1 << 6)
|
||||
#define RESAMPLER_SIMD_SSSE3 (1 << 7)
|
||||
#define RESAMPLER_SIMD_MMX (1 << 8)
|
||||
#define RESAMPLER_SIMD_MMXEXT (1 << 9)
|
||||
#define RESAMPLER_SIMD_SSE4 (1 << 10)
|
||||
#define RESAMPLER_SIMD_SSE42 (1 << 11)
|
||||
#define RESAMPLER_SIMD_AVX2 (1 << 12)
|
||||
#define RESAMPLER_SIMD_VFPU (1 << 13)
|
||||
#define RESAMPLER_SIMD_PS (1 << 14)
|
||||
|
||||
/* A bit-mask of all supported SIMD instruction sets.
|
||||
* Allows an implementation to pick different
|
||||
* resampler_implementation structs.
|
||||
*/
|
||||
typedef unsigned resampler_simd_mask_t;
|
||||
|
||||
#define RESAMPLER_API_VERSION 1
|
||||
|
||||
struct resampler_data
|
||||
{
|
||||
const float *data_in;
|
||||
float *data_out;
|
||||
|
||||
size_t input_frames;
|
||||
size_t output_frames;
|
||||
|
||||
double ratio;
|
||||
};
|
||||
|
||||
/* Returns true if config key was found. Otherwise,
|
||||
* returns false, and sets value to default value.
|
||||
*/
|
||||
typedef int (*resampler_config_get_float_t)(void *userdata,
|
||||
const char *key, float *value, float default_value);
|
||||
|
||||
typedef int (*resampler_config_get_int_t)(void *userdata,
|
||||
const char *key, int *value, int default_value);
|
||||
|
||||
/* Allocates an array with values. free() with resampler_config_free_t. */
|
||||
typedef int (*resampler_config_get_float_array_t)(void *userdata,
|
||||
const char *key, float **values, unsigned *out_num_values,
|
||||
const float *default_values, unsigned num_default_values);
|
||||
|
||||
typedef int (*resampler_config_get_int_array_t)(void *userdata,
|
||||
const char *key, int **values, unsigned *out_num_values,
|
||||
const int *default_values, unsigned num_default_values);
|
||||
|
||||
typedef int (*resampler_config_get_string_t)(void *userdata,
|
||||
const char *key, char **output, const char *default_output);
|
||||
|
||||
/* Calls free() in host runtime. Sometimes needed on Windows.
|
||||
* free() on NULL is fine. */
|
||||
typedef void (*resampler_config_free_t)(void *ptr);
|
||||
|
||||
struct resampler_config
|
||||
{
|
||||
resampler_config_get_float_t get_float;
|
||||
resampler_config_get_int_t get_int;
|
||||
|
||||
resampler_config_get_float_array_t get_float_array;
|
||||
resampler_config_get_int_array_t get_int_array;
|
||||
|
||||
resampler_config_get_string_t get_string;
|
||||
/* Avoid problems where resampler plug and host are
|
||||
* linked against different C runtimes. */
|
||||
resampler_config_free_t free;
|
||||
};
|
||||
|
||||
/* Bandwidth factor. Will be < 1.0 for downsampling, > 1.0 for upsampling.
|
||||
* Corresponds to expected resampling ratio. */
|
||||
typedef void *(*resampler_init_t)(const struct resampler_config *config,
|
||||
double bandwidth_mod, resampler_simd_mask_t mask);
|
||||
|
||||
/* Frees the handle. */
|
||||
typedef void (*resampler_free_t)(void *data);
|
||||
|
||||
/* Processes input data. */
|
||||
typedef void (*resampler_process_t)(void *_data, struct resampler_data *data);
|
||||
|
||||
typedef struct rarch_resampler
|
||||
{
|
||||
resampler_init_t init;
|
||||
resampler_process_t process;
|
||||
resampler_free_t free;
|
||||
|
||||
/* Must be RESAMPLER_API_VERSION */
|
||||
unsigned api_version;
|
||||
|
||||
/* Human readable identifier of implementation. */
|
||||
const char *ident;
|
||||
|
||||
/* Computer-friendly short version of ident.
|
||||
* Lower case, no spaces and special characters, etc. */
|
||||
const char *short_ident;
|
||||
} rarch_resampler_t;
|
||||
|
||||
typedef struct audio_frame_float
|
||||
{
|
||||
float l;
|
||||
float r;
|
||||
} audio_frame_float_t;
|
||||
|
||||
extern rarch_resampler_t sinc_resampler;
|
||||
extern rarch_resampler_t CC_resampler;
|
||||
extern rarch_resampler_t nearest_resampler;
|
||||
extern rarch_resampler_t null_resampler;
|
||||
|
||||
#ifndef DONT_HAVE_STRING_LIST
|
||||
/**
|
||||
* config_get_audio_resampler_driver_options:
|
||||
*
|
||||
* Get an enumerated list of all resampler driver names, separated by '|'.
|
||||
*
|
||||
* Returns: string listing of all resampler driver names, separated by '|'.
|
||||
**/
|
||||
const char* config_get_audio_resampler_driver_options(void);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* audio_resampler_driver_find_handle:
|
||||
* @index : index of driver to get handle to.
|
||||
*
|
||||
* Returns: handle to audio resampler driver at index. Can be NULL
|
||||
* if nothing found.
|
||||
**/
|
||||
const void *audio_resampler_driver_find_handle(int index);
|
||||
|
||||
/**
|
||||
* audio_resampler_driver_find_ident:
|
||||
* @index : index of driver to get handle to.
|
||||
*
|
||||
* Returns: Human-readable identifier of audio resampler driver at index.
|
||||
* Can be NULL if nothing found.
|
||||
**/
|
||||
const char *audio_resampler_driver_find_ident(int index);
|
||||
|
||||
/**
|
||||
* rarch_resampler_realloc:
|
||||
* @re : Resampler handle
|
||||
* @backend : Resampler backend that is about to be set.
|
||||
* @ident : Identifier name for resampler we want.
|
||||
* @bw_ratio : Bandwidth ratio.
|
||||
*
|
||||
* Reallocates resampler. Will free previous handle before
|
||||
* allocating a new one. If ident is NULL, first resampler will be used.
|
||||
*
|
||||
* Returns: true (1) if successful, otherwise false (0).
|
||||
**/
|
||||
bool rarch_resampler_realloc(void **re, const rarch_resampler_t **backend,
|
||||
const char *ident, double bw_ratio);
|
||||
|
||||
/* Convenience macros.
|
||||
* freep makes sure to set handles to NULL to avoid double-free
|
||||
* in rarch_resampler_realloc. */
|
||||
#define rarch_resampler_freep(backend, handle) do { \
|
||||
if (*(backend) && *(handle)) \
|
||||
(*backend)->free(*handle); \
|
||||
*backend = NULL; \
|
||||
*handle = NULL; \
|
||||
} while(0)
|
||||
|
||||
#define rarch_resampler_process(backend, handle, data) do { \
|
||||
(backend)->process(handle, data); \
|
||||
} while(0)
|
||||
|
||||
#ifndef RARCH_INTERNAL
|
||||
#include "libretro.h"
|
||||
extern retro_get_cpu_features_t perf_get_cpu_features_cb;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
@@ -17,10 +17,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <queues/fifo_queue.h>
|
||||
#include <queues/fifo_buffer.h>
|
||||
#include <rthreads/rthreads.h>
|
||||
|
||||
#include "audio_thread_wrapper.h"
|
||||
#include "../performance.h"
|
||||
#include "../verbosity.h"
|
||||
|
||||
typedef struct audio_thread
|
||||
@@ -35,17 +36,14 @@ typedef struct audio_thread
|
||||
bool stopped;
|
||||
bool stopped_ack;
|
||||
bool is_paused;
|
||||
bool is_shutdown;
|
||||
bool use_float;
|
||||
|
||||
int inited;
|
||||
|
||||
/* Initialization options. */
|
||||
const char *device;
|
||||
unsigned *new_rate;
|
||||
unsigned out_rate;
|
||||
unsigned latency;
|
||||
unsigned block_frames;
|
||||
} audio_thread_t;
|
||||
|
||||
static void audio_thread_loop(void *data)
|
||||
@@ -55,9 +53,8 @@ static void audio_thread_loop(void *data)
|
||||
if (!thr)
|
||||
return;
|
||||
|
||||
thr->driver_data = thr->driver->init(
|
||||
thr->device, thr->out_rate, thr->latency,
|
||||
thr->block_frames, thr->new_rate);
|
||||
RARCH_LOG("[Audio Thread]: Initializing audio driver.\n");
|
||||
thr->driver_data = thr->driver->init(thr->device, thr->out_rate, thr->latency);
|
||||
slock_lock(thr->lock);
|
||||
thr->inited = thr->driver_data ? 1 : -1;
|
||||
if (thr->inited > 0 && thr->driver->use_float)
|
||||
@@ -68,13 +65,15 @@ static void audio_thread_loop(void *data)
|
||||
if (thr->inited < 0)
|
||||
return;
|
||||
|
||||
/* Wait until we start to avoid calling
|
||||
/* Wait until we start to avoid calling
|
||||
* stop immediately after initialization. */
|
||||
slock_lock(thr->lock);
|
||||
while (thr->stopped)
|
||||
scond_wait(thr->cond, thr->lock);
|
||||
slock_unlock(thr->lock);
|
||||
|
||||
RARCH_LOG("[Audio Thread]: Starting audio.\n");
|
||||
|
||||
for (;;)
|
||||
{
|
||||
slock_lock(thr->lock);
|
||||
@@ -82,8 +81,8 @@ static void audio_thread_loop(void *data)
|
||||
if (!thr->alive)
|
||||
{
|
||||
scond_signal(thr->cond);
|
||||
thr->stopped_ack = true;
|
||||
slock_unlock(thr->lock);
|
||||
thr->stopped_ack = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -92,21 +91,21 @@ static void audio_thread_loop(void *data)
|
||||
thr->driver->stop(thr->driver_data);
|
||||
while (thr->stopped)
|
||||
{
|
||||
/* If we stop right after start,
|
||||
* we might not be able to properly ack.
|
||||
/* If we stop right after start, we might not be able to properly ack.
|
||||
* Signal in the loop instead. */
|
||||
thr->stopped_ack = true;
|
||||
scond_signal(thr->cond);
|
||||
|
||||
scond_wait(thr->cond, thr->lock);
|
||||
}
|
||||
thr->driver->start(thr->driver_data, thr->is_shutdown);
|
||||
thr->driver->start(thr->driver_data);
|
||||
}
|
||||
|
||||
slock_unlock(thr->lock);
|
||||
audio_driver_callback();
|
||||
audio_driver_ctl(RARCH_AUDIO_CTL_CALLBACK, NULL);
|
||||
}
|
||||
|
||||
RARCH_LOG("[Audio Thread]: Tearing down driver.\n");
|
||||
thr->driver->free(thr->driver_data);
|
||||
}
|
||||
|
||||
@@ -186,27 +185,26 @@ static bool audio_thread_stop(void *data)
|
||||
audio_thread_t *thr = (audio_thread_t*)data;
|
||||
|
||||
if (!thr)
|
||||
return false;
|
||||
return false;
|
||||
|
||||
audio_thread_block(thr);
|
||||
thr->is_paused = true;
|
||||
|
||||
audio_driver_disable_callback();
|
||||
audio_driver_ctl(RARCH_AUDIO_CTL_SET_CALLBACK_DISABLE, NULL);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool audio_thread_start(void *data, bool is_shutdown)
|
||||
static bool audio_thread_start(void *data)
|
||||
{
|
||||
audio_thread_t *thr = (audio_thread_t*)data;
|
||||
|
||||
if (!thr)
|
||||
return false;
|
||||
|
||||
audio_driver_enable_callback();
|
||||
audio_driver_ctl(RARCH_AUDIO_CTL_SET_CALLBACK_ENABLE, NULL);
|
||||
|
||||
thr->is_paused = false;
|
||||
thr->is_shutdown = is_shutdown;
|
||||
thr->is_paused = false;
|
||||
audio_thread_unblock(thr);
|
||||
|
||||
return true;
|
||||
@@ -262,7 +260,7 @@ static const audio_driver_t audio_thread = {
|
||||
};
|
||||
|
||||
/**
|
||||
* audio_init_thread:
|
||||
* rarch_threaded_audio_init:
|
||||
* @out_driver : output driver
|
||||
* @out_data : output audio data
|
||||
* @device : audio device (optional)
|
||||
@@ -272,15 +270,14 @@ static const audio_driver_t audio_thread = {
|
||||
*
|
||||
* Starts a audio driver in a new thread.
|
||||
* Access to audio driver will be mediated through this driver.
|
||||
* This driver interfaces with audio callback and is
|
||||
* This driver interfaces with audio callback and is
|
||||
* only used in that case.
|
||||
*
|
||||
* Returns: true (1) if successful, otherwise false (0).
|
||||
**/
|
||||
bool audio_init_thread(const audio_driver_t **out_driver,
|
||||
bool rarch_threaded_audio_init(const audio_driver_t **out_driver,
|
||||
void **out_data, const char *device, unsigned audio_out_rate,
|
||||
unsigned *new_rate, unsigned latency,
|
||||
unsigned block_frames, const audio_driver_t *drv)
|
||||
unsigned latency, const audio_driver_t *drv)
|
||||
{
|
||||
audio_thread_t *thr = (audio_thread_t*)calloc(1, sizeof(*thr));
|
||||
if (!thr)
|
||||
@@ -289,17 +286,15 @@ bool audio_init_thread(const audio_driver_t **out_driver,
|
||||
thr->driver = (const audio_driver_t*)drv;
|
||||
thr->device = device;
|
||||
thr->out_rate = audio_out_rate;
|
||||
thr->new_rate = new_rate;
|
||||
thr->latency = latency;
|
||||
thr->block_frames = block_frames;
|
||||
|
||||
if (!(thr->cond = scond_new()))
|
||||
goto error;
|
||||
if (!(thr->lock = slock_new()))
|
||||
goto error;
|
||||
|
||||
thr->alive = true;
|
||||
thr->stopped = true;
|
||||
thr->alive = true;
|
||||
thr->stopped = true;
|
||||
|
||||
if (!(thr->thread = sthread_create(audio_thread_loop, thr)))
|
||||
goto error;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
@@ -19,15 +19,14 @@
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#include "../retroarch.h"
|
||||
#include "audio_driver.h"
|
||||
|
||||
/**
|
||||
* audio_init_thread:
|
||||
* rarch_threaded_audio_init:
|
||||
* @out_driver : output driver
|
||||
* @out_data : output audio data
|
||||
* @device : audio device (optional)
|
||||
* @out_rate : output audio rate
|
||||
* @new_rate : new output audio rate
|
||||
* @latency : audio latency
|
||||
* @driver : audio driver
|
||||
*
|
||||
@@ -37,9 +36,9 @@
|
||||
*
|
||||
* Returns: true (1) if successful, otherwise false (0).
|
||||
**/
|
||||
bool audio_init_thread(const audio_driver_t **out_driver, void **out_data,
|
||||
const char *device, unsigned out_rate, unsigned *new_rate, unsigned latency,
|
||||
unsigned block_frames,
|
||||
bool rarch_threaded_audio_init(const audio_driver_t **out_driver, void **out_data,
|
||||
const char *device, unsigned out_rate, unsigned latency,
|
||||
const audio_driver_t *driver);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,435 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2014-2016 - Ali Bouhlel ( [email protected] )
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <boolean.h>
|
||||
#include "audio_utils.h"
|
||||
|
||||
#if defined(__SSE2__)
|
||||
#include <emmintrin.h>
|
||||
#elif defined(__ALTIVEC__)
|
||||
#include <altivec.h>
|
||||
#endif
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#include "../performance.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* audio_convert_s16_to_float_C:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
* @gain : gain applied to the audio volume
|
||||
*
|
||||
* Converts audio samples from signed integer 16-bit
|
||||
* to floating point.
|
||||
*
|
||||
* C implementation callback function.
|
||||
**/
|
||||
void audio_convert_s16_to_float_C(float *out,
|
||||
const int16_t *in, size_t samples, float gain)
|
||||
{
|
||||
size_t i;
|
||||
gain = gain / 0x8000;
|
||||
for (i = 0; i < samples; i++)
|
||||
out[i] = (float)in[i] * gain;
|
||||
}
|
||||
|
||||
/**
|
||||
* audio_convert_float_to_s16_C:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
*
|
||||
* Converts audio samples from floating point
|
||||
* to signed integer 16-bit.
|
||||
*
|
||||
* C implementation callback function.
|
||||
**/
|
||||
void audio_convert_float_to_s16_C(int16_t *out,
|
||||
const float *in, size_t samples)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < samples; i++)
|
||||
{
|
||||
int32_t val = (int32_t)(in[i] * 0x8000);
|
||||
out[i] = (val > 0x7FFF) ? 0x7FFF :
|
||||
(val < -0x8000 ? -0x8000 : (int16_t)val);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__SSE2__)
|
||||
/**
|
||||
* audio_convert_s16_to_float_SSE2:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
* @gain : gain applied to the audio volume
|
||||
*
|
||||
* Converts audio samples from signed integer 16-bit
|
||||
* to floating point.
|
||||
*
|
||||
* SSE2 implementation callback function.
|
||||
**/
|
||||
void audio_convert_s16_to_float_SSE2(float *out,
|
||||
const int16_t *in, size_t samples, float gain)
|
||||
{
|
||||
size_t i;
|
||||
float fgain = gain / UINT32_C(0x80000000);
|
||||
__m128 factor = _mm_set1_ps(fgain);
|
||||
|
||||
for (i = 0; i + 8 <= samples; i += 8, in += 8, out += 8)
|
||||
{
|
||||
__m128i input = _mm_loadu_si128((const __m128i *)in);
|
||||
__m128i regs_l = _mm_unpacklo_epi16(_mm_setzero_si128(), input);
|
||||
__m128i regs_r = _mm_unpackhi_epi16(_mm_setzero_si128(), input);
|
||||
__m128 output_l = _mm_mul_ps(_mm_cvtepi32_ps(regs_l), factor);
|
||||
__m128 output_r = _mm_mul_ps(_mm_cvtepi32_ps(regs_r), factor);
|
||||
|
||||
_mm_storeu_ps(out + 0, output_l);
|
||||
_mm_storeu_ps(out + 4, output_r);
|
||||
}
|
||||
|
||||
audio_convert_s16_to_float_C(out, in, samples - i, gain);
|
||||
}
|
||||
|
||||
/**
|
||||
* audio_convert_float_to_s16_SSE2:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
*
|
||||
* Converts audio samples from floating point
|
||||
* to signed integer 16-bit.
|
||||
*
|
||||
* SSE2 implementation callback function.
|
||||
**/
|
||||
void audio_convert_float_to_s16_SSE2(int16_t *out,
|
||||
const float *in, size_t samples)
|
||||
{
|
||||
size_t i;
|
||||
__m128 factor = _mm_set1_ps((float)0x8000);
|
||||
|
||||
for (i = 0; i + 8 <= samples; i += 8, in += 8, out += 8)
|
||||
{
|
||||
__m128 input_l = _mm_loadu_ps(in + 0);
|
||||
__m128 input_r = _mm_loadu_ps(in + 4);
|
||||
__m128 res_l = _mm_mul_ps(input_l, factor);
|
||||
__m128 res_r = _mm_mul_ps(input_r, factor);
|
||||
__m128i ints_l = _mm_cvtps_epi32(res_l);
|
||||
__m128i ints_r = _mm_cvtps_epi32(res_r);
|
||||
__m128i packed = _mm_packs_epi32(ints_l, ints_r);
|
||||
|
||||
_mm_storeu_si128((__m128i *)out, packed);
|
||||
}
|
||||
|
||||
audio_convert_float_to_s16_C(out, in, samples - i);
|
||||
}
|
||||
#elif defined(__ALTIVEC__)
|
||||
/**
|
||||
* audio_convert_s16_to_float_altivec:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
* @gain : gain applied to the audio volume
|
||||
*
|
||||
* Converts audio samples from signed integer 16-bit
|
||||
* to floating point.
|
||||
*
|
||||
* AltiVec implementation callback function.
|
||||
**/
|
||||
void audio_convert_s16_to_float_altivec(float *out,
|
||||
const int16_t *in, size_t samples, float gain)
|
||||
{
|
||||
size_t samples_in = samples;
|
||||
|
||||
/* Unaligned loads/store is a bit expensive, so we
|
||||
* optimize for the good path (very likely). */
|
||||
if (((uintptr_t)out & 15) + ((uintptr_t)in & 15) == 0)
|
||||
{
|
||||
size_t i;
|
||||
const vector float gain_vec = { gain, gain , gain, gain };
|
||||
const vector float zero_vec = { 0.0f, 0.0f, 0.0f, 0.0f};
|
||||
|
||||
for (i = 0; i + 8 <= samples; i += 8, in += 8, out += 8)
|
||||
{
|
||||
vector signed short input = vec_ld(0, in);
|
||||
vector signed int hi = vec_unpackh(input);
|
||||
vector signed int lo = vec_unpackl(input);
|
||||
vector float out_hi = vec_madd(vec_ctf(hi, 15), gain_vec, zero_vec);
|
||||
vector float out_lo = vec_madd(vec_ctf(lo, 15), gain_vec, zero_vec);
|
||||
|
||||
vec_st(out_hi, 0, out);
|
||||
vec_st(out_lo, 16, out);
|
||||
}
|
||||
|
||||
samples_in -= i;
|
||||
}
|
||||
audio_convert_s16_to_float_C(out, in, samples_in, gain);
|
||||
}
|
||||
|
||||
/**
|
||||
* audio_convert_float_to_s16_altivec:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
*
|
||||
* Converts audio samples from floating point
|
||||
* to signed integer 16-bit.
|
||||
*
|
||||
* AltiVec implementation callback function.
|
||||
**/
|
||||
void audio_convert_float_to_s16_altivec(int16_t *out,
|
||||
const float *in, size_t samples)
|
||||
{
|
||||
int samples_in = samples;
|
||||
|
||||
/* Unaligned loads/store is a bit expensive,
|
||||
* so we optimize for the good path (very likely). */
|
||||
if (((uintptr_t)out & 15) + ((uintptr_t)in & 15) == 0)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i + 8 <= samples; i += 8, in += 8, out += 8)
|
||||
{
|
||||
vector float input0 = vec_ld( 0, in);
|
||||
vector float input1 = vec_ld(16, in);
|
||||
vector signed int result0 = vec_cts(input0, 15);
|
||||
vector signed int result1 = vec_cts(input1, 15);
|
||||
vec_st(vec_packs(result0, result1), 0, out);
|
||||
}
|
||||
|
||||
samples_in -= i;
|
||||
}
|
||||
audio_convert_float_to_s16_C(out, in, samples_in);
|
||||
}
|
||||
#elif defined(__ARM_NEON__) && !defined(VITA)
|
||||
/* Avoid potential hard-float/soft-float ABI issues. */
|
||||
void audio_convert_s16_float_asm(float *out, const int16_t *in,
|
||||
size_t samples, const float *gain);
|
||||
|
||||
/**
|
||||
* audio_convert_s16_to_float_neon:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
* @gain : gain applied to the audio volume
|
||||
*
|
||||
* Converts audio samples from signed integer 16-bit
|
||||
* to floating point.
|
||||
*
|
||||
* ARM NEON implementation callback function.
|
||||
**/
|
||||
static void audio_convert_s16_to_float_neon(float *out,
|
||||
const int16_t *in, size_t samples, float gain)
|
||||
{
|
||||
size_t aligned_samples = samples & ~7;
|
||||
if (aligned_samples)
|
||||
audio_convert_s16_float_asm(out, in, aligned_samples, &gain);
|
||||
|
||||
/* Could do all conversion in ASM, but keep it simple for now. */
|
||||
audio_convert_s16_to_float_C(out + aligned_samples, in + aligned_samples,
|
||||
samples - aligned_samples, gain);
|
||||
}
|
||||
|
||||
void audio_convert_float_s16_asm(int16_t *out, const float *in, size_t samples);
|
||||
|
||||
/**
|
||||
* audio_convert_float_to_s16_neon:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
*
|
||||
* Converts audio samples from floating point
|
||||
* to signed integer 16-bit.
|
||||
*
|
||||
* ARM NEON implementation callback function.
|
||||
**/
|
||||
static void audio_convert_float_to_s16_neon(int16_t *out,
|
||||
const float *in, size_t samples)
|
||||
{
|
||||
size_t aligned_samples = samples & ~7;
|
||||
if (aligned_samples)
|
||||
audio_convert_float_s16_asm(out, in, aligned_samples);
|
||||
|
||||
audio_convert_float_to_s16_C(out + aligned_samples, in + aligned_samples,
|
||||
samples - aligned_samples);
|
||||
}
|
||||
#elif defined(_MIPS_ARCH_ALLEGREX)
|
||||
|
||||
/**
|
||||
* audio_convert_s16_to_float_ALLEGREX:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
* @gain : gain applied to the audio volume
|
||||
*
|
||||
* Converts audio samples from signed integer 16-bit
|
||||
* to floating point.
|
||||
*
|
||||
* MIPS ALLEGREX implementation callback function.
|
||||
**/
|
||||
void audio_convert_s16_to_float_ALLEGREX(float *out,
|
||||
const int16_t *in, size_t samples, float gain)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
/* Make sure the buffer is 16 byte aligned, this should be the
|
||||
* default behaviour of malloc in the PSPSDK.
|
||||
* Only the output buffer can be assumed to be 16-byte aligned. */
|
||||
retro_assert(((uintptr_t)out & 0xf) == 0);
|
||||
#endif
|
||||
|
||||
size_t i;
|
||||
gain = gain / 0x8000;
|
||||
__asm__ (
|
||||
".set push \n"
|
||||
".set noreorder \n"
|
||||
"mtv %0, s200 \n"
|
||||
".set pop \n"
|
||||
::"r"(gain));
|
||||
|
||||
for (i = 0; i + 16 <= samples; i += 16)
|
||||
{
|
||||
__asm__ (
|
||||
".set push \n"
|
||||
".set noreorder \n"
|
||||
|
||||
"lv.s s100, 0(%0) \n"
|
||||
"lv.s s101, 4(%0) \n"
|
||||
"lv.s s110, 8(%0) \n"
|
||||
"lv.s s111, 12(%0) \n"
|
||||
"lv.s s120, 16(%0) \n"
|
||||
"lv.s s121, 20(%0) \n"
|
||||
"lv.s s130, 24(%0) \n"
|
||||
"lv.s s131, 28(%0) \n"
|
||||
|
||||
"vs2i.p c100, c100 \n"
|
||||
"vs2i.p c110, c110 \n"
|
||||
"vs2i.p c120, c120 \n"
|
||||
"vs2i.p c130, c130 \n"
|
||||
|
||||
"vi2f.q c100, c100, 16 \n"
|
||||
"vi2f.q c110, c110, 16 \n"
|
||||
"vi2f.q c120, c120, 16 \n"
|
||||
"vi2f.q c130, c130, 16 \n"
|
||||
|
||||
"vmscl.q e100, e100, s200 \n"
|
||||
|
||||
"sv.q c100, 0(%1) \n"
|
||||
"sv.q c110, 16(%1) \n"
|
||||
"sv.q c120, 32(%1) \n"
|
||||
"sv.q c130, 48(%1) \n"
|
||||
|
||||
".set pop \n"
|
||||
:: "r"(in + i), "r"(out + i));
|
||||
}
|
||||
|
||||
for (; i < samples; i++)
|
||||
out[i] = (float)in[i] * gain;
|
||||
}
|
||||
|
||||
/**
|
||||
* audio_convert_float_to_s16_ALLEGREX:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
*
|
||||
* Converts audio samples from floating point
|
||||
* to signed integer 16-bit.
|
||||
*
|
||||
* MIPS ALLEGREX implementation callback function.
|
||||
**/
|
||||
void audio_convert_float_to_s16_ALLEGREX(int16_t *out,
|
||||
const float *in, size_t samples)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
#ifdef DEBUG
|
||||
/* Make sure the buffers are 16 byte aligned, this should be
|
||||
* the default behaviour of malloc in the PSPSDK.
|
||||
* Both buffers are allocated by RetroArch, so can assume alignment. */
|
||||
retro_assert(((uintptr_t)in & 0xf) == 0);
|
||||
retro_assert(((uintptr_t)out & 0xf) == 0);
|
||||
#endif
|
||||
|
||||
for (i = 0; i + 8 <= samples; i += 8)
|
||||
{
|
||||
__asm__ (
|
||||
".set push \n"
|
||||
".set noreorder \n"
|
||||
|
||||
"lv.q c100, 0(%0) \n"
|
||||
"lv.q c110, 16(%0) \n"
|
||||
|
||||
"vf2in.q c100, c100, 31 \n"
|
||||
"vf2in.q c110, c110, 31 \n"
|
||||
"vi2s.q c100, c100 \n"
|
||||
"vi2s.q c102, c110 \n"
|
||||
|
||||
"sv.q c100, 0(%1) \n"
|
||||
|
||||
".set pop \n"
|
||||
:: "r"(in + i), "r"(out + i));
|
||||
}
|
||||
|
||||
for (; i < samples; i++)
|
||||
{
|
||||
int32_t val = (int32_t)(in[i] * 0x8000);
|
||||
out[i] = (val > 0x7FFF) ? 0x7FFF :
|
||||
(val < -0x8000 ? -0x8000 : (int16_t)val);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef RARCH_INTERNAL
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
retro_get_cpu_features_t perf_get_cpu_features_cb;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
static unsigned audio_convert_get_cpu_features(void)
|
||||
{
|
||||
#ifdef RARCH_INTERNAL
|
||||
return retro_get_cpu_features();
|
||||
#else
|
||||
return perf_get_cpu_features_cb();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* audio_convert_init_simd:
|
||||
*
|
||||
* Sets up function pointers for audio conversion
|
||||
* functions based on CPU features.
|
||||
**/
|
||||
void audio_convert_init_simd(void)
|
||||
{
|
||||
unsigned cpu = audio_convert_get_cpu_features();
|
||||
|
||||
(void)cpu;
|
||||
#if defined(__ARM_NEON__) && !defined(VITA)
|
||||
audio_convert_s16_to_float_arm = (cpu & RETRO_SIMD_NEON) ?
|
||||
audio_convert_s16_to_float_neon : audio_convert_s16_to_float_C;
|
||||
audio_convert_float_to_s16_arm = (cpu & RETRO_SIMD_NEON) ?
|
||||
audio_convert_float_to_s16_neon : audio_convert_float_to_s16_C;
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef AUDIO_UTILS_H
|
||||
#define AUDIO_UTILS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#if defined(__SSE2__)
|
||||
#define audio_convert_s16_to_float audio_convert_s16_to_float_SSE2
|
||||
#define audio_convert_float_to_s16 audio_convert_float_to_s16_SSE2
|
||||
|
||||
/**
|
||||
* audio_convert_s16_to_float_SSE2:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
* @gain : gain applied to the audio volume
|
||||
*
|
||||
* Converts audio samples from signed integer 16-bit
|
||||
* to floating point.
|
||||
*
|
||||
* SSE2 implementation callback function.
|
||||
**/
|
||||
void audio_convert_s16_to_float_SSE2(float *out,
|
||||
const int16_t *in, size_t samples, float gain);
|
||||
|
||||
/**
|
||||
* audio_convert_float_to_s16_SSE2:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
*
|
||||
* Converts audio samples from floating point
|
||||
* to signed integer 16-bit.
|
||||
*
|
||||
* SSE2 implementation callback function.
|
||||
**/
|
||||
void audio_convert_float_to_s16_SSE2(int16_t *out,
|
||||
const float *in, size_t samples);
|
||||
|
||||
#elif defined(__ALTIVEC__)
|
||||
#define audio_convert_s16_to_float audio_convert_s16_to_float_altivec
|
||||
#define audio_convert_float_to_s16 audio_convert_float_to_s16_altivec
|
||||
|
||||
/**
|
||||
* audio_convert_s16_to_float_altivec:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
* @gain : gain applied to the audio volume
|
||||
*
|
||||
* Converts audio samples from signed integer 16-bit
|
||||
* to floating point.
|
||||
*
|
||||
* AltiVec implementation callback function.
|
||||
**/
|
||||
void audio_convert_s16_to_float_altivec(float *out,
|
||||
const int16_t *in, size_t samples, float gain);
|
||||
|
||||
/**
|
||||
* audio_convert_float_to_s16_altivec:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
*
|
||||
* Converts audio samples from floating point
|
||||
* to signed integer 16-bit.
|
||||
*
|
||||
* AltiVec implementation callback function.
|
||||
**/
|
||||
void audio_convert_float_to_s16_altivec(int16_t *out,
|
||||
const float *in, size_t samples);
|
||||
|
||||
#elif defined(__ARM_NEON__) && !defined(VITA)
|
||||
#define audio_convert_s16_to_float audio_convert_s16_to_float_arm
|
||||
#define audio_convert_float_to_s16 audio_convert_float_to_s16_arm
|
||||
|
||||
void (*audio_convert_s16_to_float_arm)(float *out,
|
||||
const int16_t *in, size_t samples, float gain);
|
||||
|
||||
void (*audio_convert_float_to_s16_arm)(int16_t *out,
|
||||
const float *in, size_t samples);
|
||||
|
||||
#elif defined(_MIPS_ARCH_ALLEGREX)
|
||||
#define audio_convert_s16_to_float audio_convert_s16_to_float_ALLEGREX
|
||||
#define audio_convert_float_to_s16 audio_convert_float_to_s16_ALLEGREX
|
||||
|
||||
/**
|
||||
* audio_convert_s16_to_float_ALLEGREX:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
* @gain : gain applied to the audio volume
|
||||
*
|
||||
* Converts audio samples from signed integer 16-bit
|
||||
* to floating point.
|
||||
*
|
||||
* MIPS ALLEGREX implementation callback function.
|
||||
**/
|
||||
void audio_convert_s16_to_float_ALLEGREX(float *out,
|
||||
const int16_t *in, size_t samples, float gain);
|
||||
|
||||
/**
|
||||
* audio_convert_float_to_s16_ALLEGREX:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
*
|
||||
* Converts audio samples from floating point
|
||||
* to signed integer 16-bit.
|
||||
*
|
||||
* MIPS ALLEGREX implementation callback function.
|
||||
**/
|
||||
void audio_convert_float_to_s16_ALLEGREX(int16_t *out,
|
||||
const float *in, size_t samples);
|
||||
#else
|
||||
#define audio_convert_s16_to_float audio_convert_s16_to_float_C
|
||||
#define audio_convert_float_to_s16 audio_convert_float_to_s16_C
|
||||
#endif
|
||||
|
||||
/**
|
||||
* audio_convert_s16_to_float_C:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
* @gain : gain applied to the audio volume
|
||||
*
|
||||
* Converts audio samples from signed integer 16-bit
|
||||
* to floating point.
|
||||
*
|
||||
* C implementation callback function.
|
||||
**/
|
||||
void audio_convert_s16_to_float_C(float *out,
|
||||
const int16_t *in, size_t samples, float gain);
|
||||
|
||||
/**
|
||||
* audio_convert_float_to_s16_C:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
*
|
||||
* Converts audio samples from floating point
|
||||
* to signed integer 16-bit.
|
||||
*
|
||||
* C implementation callback function.
|
||||
**/
|
||||
void audio_convert_float_to_s16_C(int16_t *out,
|
||||
const float *in, size_t samples);
|
||||
|
||||
/**
|
||||
* audio_convert_init_simd:
|
||||
*
|
||||
* Sets up function pointers for audio conversion
|
||||
* functions based on CPU features.
|
||||
**/
|
||||
void audio_convert_init_simd(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,98 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#if defined(__ARM_NEON__)
|
||||
|
||||
#ifndef __MACH__
|
||||
.arm
|
||||
#endif
|
||||
|
||||
.align 4
|
||||
.globl audio_convert_s16_float_asm
|
||||
.globl _audio_convert_s16_float_asm
|
||||
# audio_convert_s16_float_asm(float *out, const int16_t *in, size_t samples, const float *gain)
|
||||
audio_convert_s16_float_asm:
|
||||
_audio_convert_s16_float_asm:
|
||||
# Hacky way to get a constant of 2^-15.
|
||||
# Might be faster to just load a constant from memory.
|
||||
# It's just done once however ...
|
||||
vmov.f32 q8, #0.25
|
||||
vmul.f32 q8, q8, q8
|
||||
vmul.f32 q8, q8, q8
|
||||
vmul.f32 q8, q8, q8
|
||||
vadd.f32 q8, q8, q8
|
||||
|
||||
# Apply gain
|
||||
vld1.f32 {d6[0]}, [r3]
|
||||
vmul.f32 q8, q8, d6[0]
|
||||
|
||||
1:
|
||||
# Preload here?
|
||||
vld1.s16 {q0}, [r1]!
|
||||
|
||||
# Widen to 32-bit
|
||||
vmovl.s16 q1, d0
|
||||
vmovl.s16 q2, d1
|
||||
|
||||
# Convert to float
|
||||
vcvt.f32.s32 q1, q1
|
||||
vcvt.f32.s32 q2, q2
|
||||
|
||||
vmul.f32 q1, q1, q8
|
||||
vmul.f32 q2, q2, q8
|
||||
|
||||
vst1.f32 {q1-q2}, [r0]!
|
||||
|
||||
# Guaranteed to get samples in multiples of 8.
|
||||
subs r2, r2, #8
|
||||
bne 1b
|
||||
|
||||
bx lr
|
||||
|
||||
.align 4
|
||||
.globl audio_convert_float_s16_asm
|
||||
.globl _audio_convert_float_s16_asm
|
||||
# audio_convert_float_s16_asm(int16_t *out, const float *in, size_t samples)
|
||||
audio_convert_float_s16_asm:
|
||||
_audio_convert_float_s16_asm:
|
||||
# Hacky way to get a constant of 2^15.
|
||||
# ((2^4)^2)^2 * 0.5 = 2^15
|
||||
vmov.f32 q8, #16.0
|
||||
vmov.f32 q9, #0.5
|
||||
vmul.f32 q8, q8, q8
|
||||
vmul.f32 q8, q8, q8
|
||||
vmul.f32 q8, q8, q9
|
||||
|
||||
1:
|
||||
# Preload here?
|
||||
vld1.f32 {q0-q1}, [r1]!
|
||||
|
||||
vmul.f32 q0, q0, q8
|
||||
vmul.f32 q1, q1, q8
|
||||
|
||||
vcvt.s32.f32 q0, q0
|
||||
vcvt.s32.f32 q1, q1
|
||||
|
||||
vqmovn.s32 d4, q0
|
||||
vqmovn.s32 d5, q1
|
||||
|
||||
vst1.f32 {d4-d5}, [r0]!
|
||||
|
||||
# Guaranteed to get samples in multiples of 8.
|
||||
subs r2, r2, #8
|
||||
bne 1b
|
||||
|
||||
bx lr
|
||||
|
||||
#endif
|
||||
@@ -1,136 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <encodings/utf.h>
|
||||
#include <lists/string_list.h>
|
||||
|
||||
#include "mmdevice_common.h"
|
||||
#include "mmdevice_common_inline.h"
|
||||
|
||||
void *mmdevice_list_new(void *u)
|
||||
{
|
||||
HRESULT hr;
|
||||
UINT i;
|
||||
PROPVARIANT prop_var;
|
||||
union string_list_elem_attr attr;
|
||||
IMMDeviceEnumerator *enumerator = NULL;
|
||||
IMMDeviceCollection *collection = NULL;
|
||||
UINT dev_count = 0;
|
||||
IMMDevice *device = NULL;
|
||||
LPWSTR dev_id_wstr = NULL;
|
||||
IPropertyStore *prop_store = NULL;
|
||||
bool br = false;
|
||||
bool prop_var_init = false;
|
||||
char *dev_id_str = NULL;
|
||||
char *dev_name_str = NULL;
|
||||
struct string_list *sl = string_list_new();
|
||||
|
||||
if (!sl)
|
||||
return NULL;
|
||||
|
||||
attr.i = 0;
|
||||
#ifdef __cplusplus
|
||||
hr = CoCreateInstance(CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL,
|
||||
IID_IMMDeviceEnumerator, (void **)&enumerator);
|
||||
#else
|
||||
hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL,
|
||||
&IID_IMMDeviceEnumerator, (void **)&enumerator);
|
||||
#endif
|
||||
if (FAILED(hr))
|
||||
goto error;
|
||||
|
||||
hr = _IMMDeviceEnumerator_EnumAudioEndpoints(enumerator,
|
||||
eRender, DEVICE_STATE_ACTIVE, &collection);
|
||||
if (FAILED(hr))
|
||||
goto error;
|
||||
|
||||
hr = _IMMDeviceCollection_GetCount(collection, &dev_count);
|
||||
if (FAILED(hr))
|
||||
goto error;
|
||||
|
||||
for (i = 0; i < dev_count; ++i)
|
||||
{
|
||||
hr = _IMMDeviceCollection_Item(collection, i, &device);
|
||||
if (FAILED(hr))
|
||||
goto error;
|
||||
|
||||
hr = _IMMDevice_GetId(device, &dev_id_wstr);
|
||||
if (FAILED(hr))
|
||||
goto error;
|
||||
|
||||
if (!(dev_id_str = utf16_to_utf8_string_alloc(dev_id_wstr)))
|
||||
goto error;
|
||||
|
||||
hr = _IMMDevice_OpenPropertyStore(device, STGM_READ, &prop_store);
|
||||
if (FAILED(hr))
|
||||
goto error;
|
||||
|
||||
PropVariantInit(&prop_var);
|
||||
prop_var_init = true;
|
||||
hr = _IPropertyStore_GetValue(
|
||||
prop_store, PKEY_Device_FriendlyName,
|
||||
&prop_var);
|
||||
if (FAILED(hr))
|
||||
goto error;
|
||||
|
||||
if (!(dev_name_str = utf16_to_utf8_string_alloc(prop_var.pwszVal)))
|
||||
goto error;
|
||||
|
||||
br = string_list_append(sl, dev_name_str, attr);
|
||||
if (!br)
|
||||
goto error;
|
||||
if (dev_id_str)
|
||||
sl->elems[sl->size-1].userdata = dev_id_str;
|
||||
|
||||
PropVariantClear(&prop_var);
|
||||
prop_var_init = false;
|
||||
if (dev_id_wstr)
|
||||
CoTaskMemFree(dev_id_wstr);
|
||||
if (dev_name_str)
|
||||
free(dev_name_str);
|
||||
dev_name_str = NULL;
|
||||
dev_id_wstr = NULL;
|
||||
IFACE_RELEASE(prop_store);
|
||||
IFACE_RELEASE(device);
|
||||
}
|
||||
|
||||
IFACE_RELEASE(collection);
|
||||
IFACE_RELEASE(enumerator);
|
||||
|
||||
return sl;
|
||||
|
||||
error:
|
||||
if (dev_id_str)
|
||||
free(dev_id_str);
|
||||
if (dev_name_str)
|
||||
free(dev_name_str);
|
||||
dev_id_str = NULL;
|
||||
dev_name_str = NULL;
|
||||
if (prop_var_init)
|
||||
PropVariantClear(&prop_var);
|
||||
IFACE_RELEASE(prop_store);
|
||||
if (dev_id_wstr)
|
||||
CoTaskMemFree(dev_id_wstr);
|
||||
dev_id_wstr = NULL;
|
||||
IFACE_RELEASE(device);
|
||||
IFACE_RELEASE(collection);
|
||||
IFACE_RELEASE(enumerator);
|
||||
if (sl)
|
||||
string_list_free(sl);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _MMDEVICE_COMMON_H
|
||||
#define _MMDEVICE_COMMON_H
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
void *mmdevice_list_new(void *u);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
@@ -1,114 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _MMDEVICE_COMMON_INLINE_H
|
||||
#define _MMDEVICE_COMMON_INLINE_H
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef _WIN32_WINNT
|
||||
#undef _WIN32_WINNT
|
||||
#endif
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
||||
#include <windows.h>
|
||||
#include <winerror.h>
|
||||
#include <propidl.h>
|
||||
#include <initguid.h>
|
||||
#include <mmdeviceapi.h>
|
||||
#include <mmreg.h>
|
||||
#include <audioclient.h>
|
||||
|
||||
#include <retro_common_api.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
DEFINE_GUID(IID_IAudioClient, 0x1CB9AD4C, 0xDBFA, 0x4C32, 0xB1, 0x78, 0xC2, 0xF5, 0x68, 0xA7, 0x03, 0xB2);
|
||||
DEFINE_GUID(IID_IAudioRenderClient, 0xF294ACFC, 0x3146, 0x4483, 0xA7, 0xBF, 0xAD, 0xDC, 0xA7, 0xC2, 0x60, 0xE2);
|
||||
DEFINE_GUID(IID_IMMDeviceEnumerator, 0xA95664D2, 0x9614, 0x4F35, 0xA7, 0x46, 0xDE, 0x8D, 0xB6, 0x36, 0x17, 0xE6);
|
||||
DEFINE_GUID(CLSID_MMDeviceEnumerator, 0xBCDE0395, 0xE52F, 0x467C, 0x8E, 0x3D, 0xC4, 0x57, 0x92, 0x91, 0x69, 0x2E);
|
||||
#undef KSDATAFORMAT_SUBTYPE_IEEE_FLOAT
|
||||
DEFINE_GUID(KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, 0x00000003, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71);
|
||||
#endif
|
||||
|
||||
DEFINE_PROPERTYKEY(PKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 14); /* DEVPROP_TYPE_STRING */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define _IMMDeviceCollection_Item(This,nDevice,ppdevice) (This)->Item(nDevice,ppdevice)
|
||||
#define _IAudioClient_Start(This) ( (This)->Start() )
|
||||
#define _IAudioClient_Stop(This) ( (This)->Stop() )
|
||||
#define _IAudioClient_GetCurrentPadding(This,pNumPaddingFrames) \
|
||||
( (This)->GetCurrentPadding(pNumPaddingFrames) )
|
||||
#define _IAudioRenderClient_GetBuffer(This,NumFramesRequested,ppData) \
|
||||
( (This)->GetBuffer(NumFramesRequested,ppData) )
|
||||
#define _IAudioRenderClient_ReleaseBuffer(This,NumFramesWritten,dwFlags) \
|
||||
( (This)->ReleaseBuffer(NumFramesWritten,dwFlags) )
|
||||
#define _IAudioClient_GetService(This,riid,ppv) ( (This)->GetService(riid,ppv) )
|
||||
#define _IAudioClient_SetEventHandle(This,eventHandle) ( (This)->SetEventHandle(eventHandle) )
|
||||
#define _IAudioClient_GetBufferSize(This,pNumBufferFrames) ( (This)->GetBufferSize(pNumBufferFrames) )
|
||||
#define _IAudioClient_GetStreamLatency(This,phnsLatency) ( (This)->GetStreamLatency(phnsLatency) )
|
||||
#define _IAudioClient_GetDevicePeriod(This,phnsDefaultDevicePeriod,phnsMinimumDevicePeriod) ( (This)->GetDevicePeriod(phnsDefaultDevicePeriod,phnsMinimumDevicePeriod) )
|
||||
#define _IMMDevice_Activate(This,iid,dwClsCtx,pActivationParams,ppv) ((This)->Activate(iid,(dwClsCtx),pActivationParams,ppv))
|
||||
#define _IMMDeviceEnumerator_EnumAudioEndpoints(This,dataFlow,dwStateMask,ppDevices) (This)->EnumAudioEndpoints(dataFlow,dwStateMask,ppDevices)
|
||||
#define _IMMDeviceEnumerator_GetDefaultAudioEndpoint(This,dataFlow,role,ppEndpoint) (This)->GetDefaultAudioEndpoint(dataFlow,role,ppEndpoint)
|
||||
#define _IMMDevice_OpenPropertyStore(This,stgmAccess,ppProperties) (This)->OpenPropertyStore(stgmAccess,ppProperties)
|
||||
#define _IMMDevice_GetId(This,ppstrId) ((This)->GetId(ppstrId))
|
||||
#define _IPropertyStore_GetValue(This,key,pv) ( (This)->GetValue(key,pv) )
|
||||
#define _IMMDeviceCollection_GetCount(This,cProps) ( (This)->GetCount(cProps) )
|
||||
#else
|
||||
#define _IMMDeviceCollection_Item(This,nDevice,ppdevice) (This)->lpVtbl->Item(This,nDevice,ppdevice)
|
||||
#define _IAudioClient_Start(This) ( (This)->lpVtbl -> Start(This) )
|
||||
#define _IAudioClient_Stop(This) ( (This)->lpVtbl -> Stop(This) )
|
||||
#define _IAudioClient_GetCurrentPadding(This,pNumPaddingFrames) \
|
||||
( (This)->lpVtbl -> GetCurrentPadding(This,pNumPaddingFrames) )
|
||||
#define _IAudioRenderClient_GetBuffer(This,NumFramesRequested,ppData) \
|
||||
( (This)->lpVtbl -> GetBuffer(This,NumFramesRequested,ppData) )
|
||||
#define _IAudioRenderClient_ReleaseBuffer(This,NumFramesWritten,dwFlags) \
|
||||
( (This)->lpVtbl -> ReleaseBuffer(This,NumFramesWritten,dwFlags) )
|
||||
#define _IAudioClient_GetService(This,riid,ppv) ( (This)->lpVtbl -> GetService(This,&(riid),ppv) )
|
||||
#define _IAudioClient_SetEventHandle(This,eventHandle) ( (This)->lpVtbl -> SetEventHandle(This,eventHandle) )
|
||||
#define _IAudioClient_GetBufferSize(This,pNumBufferFrames) ( (This)->lpVtbl -> GetBufferSize(This,pNumBufferFrames) )
|
||||
#define _IAudioClient_GetStreamLatency(This,phnsLatency) ( (This)->lpVtbl -> GetStreamLatency(This,phnsLatency) )
|
||||
#define _IAudioClient_GetDevicePeriod(This,phnsDefaultDevicePeriod,phnsMinimumDevicePeriod) ( (This)->lpVtbl -> GetDevicePeriod(This,phnsDefaultDevicePeriod,phnsMinimumDevicePeriod) )
|
||||
#define _IMMDevice_Activate(This,iid,dwClsCtx,pActivationParams,ppv) ((This)->lpVtbl->Activate(This,&(iid),dwClsCtx,pActivationParams,ppv))
|
||||
#define _IMMDeviceEnumerator_EnumAudioEndpoints(This,dataFlow,dwStateMask,ppDevices) (This)->lpVtbl->EnumAudioEndpoints(This,dataFlow,dwStateMask,ppDevices)
|
||||
#define _IMMDeviceEnumerator_GetDefaultAudioEndpoint(This,dataFlow,role,ppEndpoint) (This)->lpVtbl->GetDefaultAudioEndpoint(This,dataFlow,role,ppEndpoint)
|
||||
#define _IMMDevice_OpenPropertyStore(This,stgmAccess,ppProperties) (This)->lpVtbl->OpenPropertyStore(This,stgmAccess,ppProperties)
|
||||
#define _IMMDevice_GetId(This,ppstrId) (This)->lpVtbl->GetId(This,ppstrId)
|
||||
#define _IPropertyStore_GetValue(This,key,pv) ( (This)->lpVtbl -> GetValue(This,&(key),pv) )
|
||||
#define _IMMDeviceCollection_GetCount(This,cProps) ( (This)->lpVtbl -> GetCount(This,cProps) )
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifndef IFACE_RELEASE
|
||||
#define IFACE_RELEASE(iface) \
|
||||
if (iface) \
|
||||
{ \
|
||||
iface->Release(); \
|
||||
iface = NULL; \
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
#ifndef IFACE_RELEASE
|
||||
#define IFACE_RELEASE(iface) \
|
||||
if (iface) \
|
||||
{ \
|
||||
iface->lpVtbl->Release(iface);\
|
||||
iface = NULL; \
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+79
-171
@@ -1,7 +1,6 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
@@ -16,12 +15,10 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <lists/string_list.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include <alsa/asoundlib.h>
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
typedef struct alsa
|
||||
@@ -29,7 +26,6 @@ typedef struct alsa
|
||||
snd_pcm_t *pcm;
|
||||
size_t buffer_size;
|
||||
bool nonblock;
|
||||
unsigned int frame_bits;
|
||||
bool has_float;
|
||||
bool can_pause;
|
||||
bool is_paused;
|
||||
@@ -47,28 +43,27 @@ static bool find_float_format(snd_pcm_t *pcm, void *data)
|
||||
|
||||
if (snd_pcm_hw_params_test_format(pcm, params, SND_PCM_FORMAT_FLOAT) == 0)
|
||||
{
|
||||
RARCH_LOG("[ALSA]: Using floating point format.\n");
|
||||
RARCH_LOG("ALSA: Using floating point format.\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
RARCH_LOG("[ALSA]: Using signed 16-bit format.\n");
|
||||
RARCH_LOG("ALSA: Using signed 16-bit format.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
static void *alsa_init(const char *device, unsigned rate, unsigned latency,
|
||||
unsigned block_frames,
|
||||
unsigned *new_rate)
|
||||
static void *alsa_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
||||
snd_pcm_format_t format;
|
||||
snd_pcm_uframes_t buffer_size;
|
||||
snd_pcm_hw_params_t *params = NULL;
|
||||
snd_pcm_hw_params_t *params = NULL;
|
||||
snd_pcm_sw_params_t *sw_params = NULL;
|
||||
unsigned latency_usec = latency * 1000;
|
||||
unsigned channels = 2;
|
||||
unsigned periods = 4;
|
||||
unsigned orig_rate = rate;
|
||||
const char *alsa_dev = "default";
|
||||
alsa_t *alsa = (alsa_t*)calloc(1, sizeof(alsa_t));
|
||||
|
||||
unsigned latency_usec = latency * 1000;
|
||||
unsigned channels = 2;
|
||||
unsigned periods = 4;
|
||||
|
||||
const char *alsa_dev = "default";
|
||||
alsa_t *alsa = (alsa_t*)calloc(1, sizeof(alsa_t));
|
||||
|
||||
if (!alsa)
|
||||
return NULL;
|
||||
@@ -93,23 +88,15 @@ static void *alsa_init(const char *device, unsigned rate, unsigned latency,
|
||||
alsa->pcm, params, SND_PCM_ACCESS_RW_INTERLEAVED) < 0)
|
||||
goto error;
|
||||
|
||||
/* channels hardcoded to 2 for now */
|
||||
alsa->frame_bits = snd_pcm_format_physical_width(format) * 2;
|
||||
|
||||
if (snd_pcm_hw_params_set_format(alsa->pcm, params, format) < 0)
|
||||
goto error;
|
||||
|
||||
if (snd_pcm_hw_params_set_channels(alsa->pcm, params, channels) < 0)
|
||||
goto error;
|
||||
|
||||
/* Don't allow rate resampling when probing for the default rate (but ignore if this call fails) */
|
||||
snd_pcm_hw_params_set_rate_resample(alsa->pcm, params, 0 );
|
||||
if (snd_pcm_hw_params_set_rate_near(alsa->pcm, params, &rate, 0) < 0)
|
||||
if (snd_pcm_hw_params_set_rate(alsa->pcm, params, rate, 0) < 0)
|
||||
goto error;
|
||||
|
||||
if (rate != orig_rate)
|
||||
*new_rate = rate;
|
||||
|
||||
if (snd_pcm_hw_params_set_buffer_time_near(
|
||||
alsa->pcm, params, &latency_usec, NULL) < 0)
|
||||
goto error;
|
||||
@@ -121,22 +108,22 @@ static void *alsa_init(const char *device, unsigned rate, unsigned latency,
|
||||
if (snd_pcm_hw_params(alsa->pcm, params) < 0)
|
||||
goto error;
|
||||
|
||||
/* Shouldn't have to bother with this,
|
||||
/* Shouldn't have to bother with this,
|
||||
* but some drivers are apparently broken. */
|
||||
if (snd_pcm_hw_params_get_period_size(params, &buffer_size, NULL))
|
||||
snd_pcm_hw_params_get_period_size_min(params, &buffer_size, NULL);
|
||||
|
||||
RARCH_LOG("[ALSA]: Period size: %d frames\n", (int)buffer_size);
|
||||
RARCH_LOG("ALSA: Period size: %d frames\n", (int)buffer_size);
|
||||
|
||||
if (snd_pcm_hw_params_get_buffer_size(params, &buffer_size))
|
||||
snd_pcm_hw_params_get_buffer_size_max(params, &buffer_size);
|
||||
|
||||
RARCH_LOG("[ALSA]: Buffer size: %d frames\n", (int)buffer_size);
|
||||
RARCH_LOG("ALSA: Buffer size: %d frames\n", (int)buffer_size);
|
||||
|
||||
alsa->buffer_size = snd_pcm_frames_to_bytes(alsa->pcm, buffer_size);
|
||||
alsa->can_pause = snd_pcm_hw_params_can_pause(params);
|
||||
|
||||
RARCH_LOG("[ALSA]: Can pause: %s.\n", alsa->can_pause ? "yes" : "no");
|
||||
RARCH_LOG("ALSA: Can pause: %s.\n", alsa->can_pause ? "yes" : "no");
|
||||
|
||||
if (snd_pcm_sw_params_malloc(&sw_params) < 0)
|
||||
goto error;
|
||||
@@ -157,7 +144,7 @@ static void *alsa_init(const char *device, unsigned rate, unsigned latency,
|
||||
return alsa;
|
||||
|
||||
error:
|
||||
RARCH_ERR("[ALSA]: Failed to initialize...\n");
|
||||
RARCH_ERR("ALSA: Failed to initialize...\n");
|
||||
if (params)
|
||||
snd_pcm_hw_params_free(params);
|
||||
|
||||
@@ -167,99 +154,80 @@ error:
|
||||
if (alsa)
|
||||
{
|
||||
if (alsa->pcm)
|
||||
{
|
||||
snd_pcm_close(alsa->pcm);
|
||||
snd_config_update_free_global();
|
||||
}
|
||||
|
||||
free(alsa);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#define BYTES_TO_FRAMES(bytes, frame_bits) ((bytes) * 8 / frame_bits)
|
||||
#define FRAMES_TO_BYTES(frames, frame_bits) ((frames) * frame_bits / 8)
|
||||
|
||||
static bool alsa_start(void *data, bool is_shutdown);
|
||||
static ssize_t alsa_write(void *data, const void *buf_, size_t size_)
|
||||
{
|
||||
alsa_t *alsa = (alsa_t*)data;
|
||||
const uint8_t *buf = (const uint8_t*)buf_;
|
||||
bool eagain_retry = true;
|
||||
snd_pcm_sframes_t written = 0;
|
||||
snd_pcm_sframes_t size = BYTES_TO_FRAMES(size_, alsa->frame_bits);
|
||||
size_t frames_size = alsa->has_float ? sizeof(float) : sizeof(int16_t);
|
||||
snd_pcm_sframes_t size = snd_pcm_bytes_to_frames(alsa->pcm, size_);
|
||||
|
||||
/* Workaround buggy menu code.
|
||||
* If a write happens while we're paused, we might never progress. */
|
||||
if (alsa->is_paused)
|
||||
if (!alsa_start(alsa, false))
|
||||
return -1;
|
||||
|
||||
if (alsa->nonblock)
|
||||
while (size)
|
||||
{
|
||||
while (size)
|
||||
snd_pcm_sframes_t frames;
|
||||
|
||||
if (!alsa->nonblock)
|
||||
{
|
||||
snd_pcm_sframes_t frames = snd_pcm_writei(alsa->pcm, buf, size);
|
||||
|
||||
if (frames == -EPIPE || frames == -EINTR || frames == -ESTRPIPE)
|
||||
{
|
||||
if (snd_pcm_recover(alsa->pcm, frames, 1) < 0)
|
||||
return -1;
|
||||
|
||||
break;
|
||||
}
|
||||
else if (frames == -EAGAIN)
|
||||
break;
|
||||
else if (frames < 0)
|
||||
return -1;
|
||||
|
||||
written += frames;
|
||||
buf += (frames << 1) * frames_size;
|
||||
size -= frames;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool eagain_retry = true;
|
||||
|
||||
while (size)
|
||||
{
|
||||
snd_pcm_sframes_t frames;
|
||||
int rc = snd_pcm_wait(alsa->pcm, -1);
|
||||
|
||||
if (rc == -EPIPE || rc == -ESTRPIPE || rc == -EINTR)
|
||||
{
|
||||
if (snd_pcm_recover(alsa->pcm, rc, 1) < 0)
|
||||
{
|
||||
RARCH_ERR("[ALSA]: (#1) Failed to recover from error (%s)\n",
|
||||
snd_strerror(rc));
|
||||
return -1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
frames = snd_pcm_writei(alsa->pcm, buf, size);
|
||||
|
||||
if (frames == -EPIPE || frames == -EINTR || frames == -ESTRPIPE)
|
||||
{
|
||||
if (snd_pcm_recover(alsa->pcm, frames, 1) < 0)
|
||||
return -1;
|
||||
|
||||
break;
|
||||
}
|
||||
else if (frames == -EAGAIN)
|
||||
{
|
||||
/* Definitely not supposed to happen. */
|
||||
if (eagain_retry)
|
||||
{
|
||||
eagain_retry = false;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
else if (frames < 0)
|
||||
return -1;
|
||||
|
||||
written += frames;
|
||||
buf += (frames << 1) * frames_size;
|
||||
size -= frames;
|
||||
}
|
||||
|
||||
frames = snd_pcm_writei(alsa->pcm, buf, size);
|
||||
|
||||
if (frames == -EPIPE || frames == -EINTR || frames == -ESTRPIPE)
|
||||
{
|
||||
if (snd_pcm_recover(alsa->pcm, frames, 1) < 0)
|
||||
{
|
||||
RARCH_ERR("[ALSA]: (#2) Failed to recover from error (%s)\n",
|
||||
snd_strerror(frames));
|
||||
return -1;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
else if (frames == -EAGAIN && !alsa->nonblock)
|
||||
{
|
||||
/* Definitely not supposed to happen. */
|
||||
RARCH_WARN("[ALSA]: poll() was signaled, but EAGAIN returned from write.\n"
|
||||
"Your ALSA driver might be subtly broken.\n");
|
||||
|
||||
if (eagain_retry)
|
||||
{
|
||||
eagain_retry = false;
|
||||
continue;
|
||||
}
|
||||
return written;
|
||||
}
|
||||
else if (frames == -EAGAIN) /* Expected if we're running nonblock. */
|
||||
return written;
|
||||
else if (frames < 0)
|
||||
{
|
||||
RARCH_ERR("[ALSA]: Unknown error occured (%s).\n",
|
||||
snd_strerror(frames));
|
||||
return -1;
|
||||
}
|
||||
|
||||
written += frames;
|
||||
buf += (frames << 1) *
|
||||
(alsa->has_float ? sizeof(float) : sizeof(int16_t));
|
||||
size -= frames;
|
||||
}
|
||||
|
||||
return written;
|
||||
@@ -276,8 +244,6 @@ static bool alsa_alive(void *data)
|
||||
static bool alsa_stop(void *data)
|
||||
{
|
||||
alsa_t *alsa = (alsa_t*)data;
|
||||
if (alsa->is_paused)
|
||||
return true;
|
||||
|
||||
if (alsa->can_pause
|
||||
&& !alsa->is_paused)
|
||||
@@ -299,11 +265,9 @@ static void alsa_set_nonblock_state(void *data, bool state)
|
||||
alsa->nonblock = state;
|
||||
}
|
||||
|
||||
static bool alsa_start(void *data, bool is_shutdown)
|
||||
static bool alsa_start(void *data)
|
||||
{
|
||||
alsa_t *alsa = (alsa_t*)data;
|
||||
if (!alsa->is_paused)
|
||||
return true;
|
||||
|
||||
if (alsa->can_pause
|
||||
&& alsa->is_paused)
|
||||
@@ -332,22 +296,26 @@ static void alsa_free(void *data)
|
||||
{
|
||||
snd_pcm_drop(alsa->pcm);
|
||||
snd_pcm_close(alsa->pcm);
|
||||
snd_config_update_free_global();
|
||||
}
|
||||
|
||||
free(alsa);
|
||||
}
|
||||
}
|
||||
|
||||
static size_t alsa_write_avail(void *data)
|
||||
{
|
||||
alsa_t *alsa = (alsa_t*)data;
|
||||
alsa_t *alsa = (alsa_t*)data;
|
||||
snd_pcm_sframes_t avail = snd_pcm_avail(alsa->pcm);
|
||||
|
||||
if (avail < 0)
|
||||
{
|
||||
#if 0
|
||||
RARCH_WARN("[ALSA]: snd_pcm_avail() failed: %s\n",
|
||||
snd_strerror(avail));
|
||||
#endif
|
||||
return alsa->buffer_size;
|
||||
}
|
||||
|
||||
return FRAMES_TO_BYTES(avail, alsa->frame_bits);
|
||||
return snd_pcm_frames_to_bytes(alsa->pcm, avail);
|
||||
}
|
||||
|
||||
static size_t alsa_buffer_size(void *data)
|
||||
@@ -356,64 +324,6 @@ static size_t alsa_buffer_size(void *data)
|
||||
return alsa->buffer_size;
|
||||
}
|
||||
|
||||
static void *alsa_device_list_new(void *data)
|
||||
{
|
||||
void **hints, **n;
|
||||
union string_list_elem_attr attr;
|
||||
struct string_list *s = string_list_new();
|
||||
|
||||
if (!s)
|
||||
return NULL;
|
||||
|
||||
attr.i = 0;
|
||||
|
||||
if (snd_device_name_hint(-1, "pcm", &hints) != 0)
|
||||
goto error;
|
||||
|
||||
n = hints;
|
||||
|
||||
while (*n)
|
||||
{
|
||||
char *name = snd_device_name_get_hint(*n, "NAME");
|
||||
char *io = snd_device_name_get_hint(*n, "IOID");
|
||||
char *desc = snd_device_name_get_hint(*n, "DESC");
|
||||
|
||||
/* description of device IOID - input / output identifcation
|
||||
* ("Input" or "Output"), NULL means both) */
|
||||
|
||||
if (!io || (string_is_equal(io, "Output")))
|
||||
string_list_append(s, name, attr);
|
||||
|
||||
if (name)
|
||||
free(name);
|
||||
if (io)
|
||||
free(io);
|
||||
if (desc)
|
||||
free(desc);
|
||||
|
||||
n++;
|
||||
}
|
||||
|
||||
/* free hint buffer too */
|
||||
snd_device_name_free_hint(hints);
|
||||
|
||||
return s;
|
||||
|
||||
error:
|
||||
string_list_free(s);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void alsa_device_list_free(void *data, void *array_list_data)
|
||||
{
|
||||
struct string_list *s = (struct string_list*)array_list_data;
|
||||
|
||||
if (!s)
|
||||
return;
|
||||
|
||||
string_list_free(s);
|
||||
}
|
||||
|
||||
audio_driver_t audio_alsa = {
|
||||
alsa_init,
|
||||
alsa_write,
|
||||
@@ -424,8 +334,6 @@ audio_driver_t audio_alsa = {
|
||||
alsa_free,
|
||||
alsa_use_float,
|
||||
"alsa",
|
||||
alsa_device_list_new,
|
||||
alsa_device_list_free,
|
||||
alsa_write_avail,
|
||||
alsa_buffer_size,
|
||||
};
|
||||
+30
-30
@@ -1,7 +1,7 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
@@ -17,9 +17,9 @@
|
||||
#define ALSA_PCM_NEW_HW_PARAMS_API
|
||||
#define ALSA_PCM_NEW_SW_PARAMS_API
|
||||
#include <sys/asoundlib.h>
|
||||
#include <retro_math.h>
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
#include "../../configuration.h"
|
||||
|
||||
#define MAX_FRAG_SIZE 3072
|
||||
#define DEFAULT_RATE 48000
|
||||
@@ -41,19 +41,19 @@ typedef struct alsa
|
||||
bool is_paused;
|
||||
unsigned buf_size;
|
||||
unsigned buf_count;
|
||||
} alsa_qsa_t;
|
||||
} alsa_t;
|
||||
|
||||
typedef long snd_pcm_sframes_t;
|
||||
|
||||
static void *alsa_qsa_init(const char *device,
|
||||
unsigned rate, unsigned latency, unsigned block_frames,
|
||||
unsigned *new_rate)
|
||||
unsigned rate, unsigned latency)
|
||||
{
|
||||
int err, card, dev, i;
|
||||
snd_pcm_channel_info_t pi;
|
||||
snd_pcm_channel_params_t params = {0};
|
||||
snd_pcm_channel_setup_t setup = {0};
|
||||
alsa_qsa_t *alsa = (alsa_qsa_t*)calloc(1, sizeof(alsa_qsa_t));
|
||||
snd_pcm_channel_info_t pi;
|
||||
snd_pcm_channel_setup_t setup = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
alsa_t *alsa = (alsa_t*)calloc(1, sizeof(alsa_t));
|
||||
if (!alsa)
|
||||
return NULL;
|
||||
|
||||
@@ -122,8 +122,8 @@ static void *alsa_qsa_init(const char *device,
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (block_frames)
|
||||
alsa->buf_size = block_frames * 4;
|
||||
if (settings->audio.block_frames)
|
||||
alsa->buf_size = settings->audio.block_frames * 4;
|
||||
else
|
||||
alsa->buf_size = next_pow2(32 * latency);
|
||||
|
||||
@@ -164,9 +164,9 @@ error:
|
||||
|
||||
static int check_pcm_status(void *data, int channel_type)
|
||||
{
|
||||
alsa_t *alsa = (alsa_t*)data;
|
||||
snd_pcm_channel_status_t status;
|
||||
alsa_qsa_t *alsa = (alsa_qsa_t*)data;
|
||||
int ret = EOK;
|
||||
int ret = EOK;
|
||||
|
||||
memset(&status, 0, sizeof (status));
|
||||
status.channel = channel_type;
|
||||
@@ -219,9 +219,10 @@ static int check_pcm_status(void *data, int channel_type)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static ssize_t alsa_qsa_write(void *data, const void *buf, size_t size)
|
||||
{
|
||||
alsa_qsa_t *alsa = (alsa_qsa_t*)data;
|
||||
alsa_t *alsa = (alsa_t*)data;
|
||||
snd_pcm_sframes_t written = 0;
|
||||
|
||||
while (size)
|
||||
@@ -230,7 +231,7 @@ static ssize_t alsa_qsa_write(void *data, const void *buf, size_t size)
|
||||
|
||||
if (avail_write)
|
||||
{
|
||||
memcpy(alsa->buffer[alsa->buffer_index] +
|
||||
memcpy(alsa->buffer[alsa->buffer_index] +
|
||||
alsa->buffer_ptr, buf, avail_write);
|
||||
|
||||
alsa->buffer_ptr += avail_write;
|
||||
@@ -268,7 +269,7 @@ static ssize_t alsa_qsa_write(void *data, const void *buf, size_t size)
|
||||
|
||||
static bool alsa_qsa_stop(void *data)
|
||||
{
|
||||
alsa_qsa_t *alsa = (alsa_qsa_t*)data;
|
||||
alsa_t *alsa = (alsa_t*)data;
|
||||
|
||||
if (alsa->can_pause && !alsa->is_paused)
|
||||
{
|
||||
@@ -284,15 +285,15 @@ static bool alsa_qsa_stop(void *data)
|
||||
|
||||
static bool alsa_qsa_alive(void *data)
|
||||
{
|
||||
alsa_qsa_t *alsa = (alsa_qsa_t*)data;
|
||||
alsa_t *alsa = (alsa_t*)data;
|
||||
if (alsa)
|
||||
return !alsa->is_paused;
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool alsa_qsa_start(void *data, bool is_shutdown)
|
||||
static bool alsa_qsa_start(void *data)
|
||||
{
|
||||
alsa_qsa_t *alsa = (alsa_qsa_t*)data;
|
||||
alsa_t *alsa = (alsa_t*)data;
|
||||
|
||||
if (alsa->can_pause && alsa->is_paused)
|
||||
{
|
||||
@@ -313,7 +314,7 @@ static bool alsa_qsa_start(void *data, bool is_shutdown)
|
||||
|
||||
static void alsa_qsa_set_nonblock_state(void *data, bool state)
|
||||
{
|
||||
alsa_qsa_t *alsa = (alsa_qsa_t*)data;
|
||||
alsa_t *alsa = (alsa_t*)data;
|
||||
|
||||
int err;
|
||||
|
||||
@@ -327,15 +328,16 @@ static void alsa_qsa_set_nonblock_state(void *data, bool state)
|
||||
alsa->nonblock = state;
|
||||
}
|
||||
|
||||
|
||||
static bool alsa_qsa_use_float(void *data)
|
||||
{
|
||||
alsa_qsa_t *alsa = (alsa_qsa_t*)data;
|
||||
alsa_t *alsa = (alsa_t*)data;
|
||||
return alsa->has_float;
|
||||
}
|
||||
|
||||
static void alsa_qsa_free(void *data)
|
||||
{
|
||||
alsa_qsa_t *alsa = (alsa_qsa_t*)data;
|
||||
alsa_t *alsa = (alsa_t*)data;
|
||||
|
||||
if (alsa)
|
||||
{
|
||||
@@ -352,17 +354,17 @@ static void alsa_qsa_free(void *data)
|
||||
|
||||
static size_t alsa_qsa_write_avail(void *data)
|
||||
{
|
||||
alsa_qsa_t *alsa = (alsa_qsa_t*)data;
|
||||
size_t avail = (alsa->buf_count -
|
||||
(int)alsa->buffered_blocks - 1) * alsa->buf_size +
|
||||
alsa_t *alsa = (alsa_t*)data;
|
||||
size_t avail = (alsa->buf_count -
|
||||
(int)alsa->buffered_blocks - 1) * alsa->buf_size +
|
||||
(alsa->buf_size - (int)alsa->buffer_ptr);
|
||||
return avail;
|
||||
}
|
||||
|
||||
static size_t alsa_qsa_buffer_size(void *data)
|
||||
{
|
||||
alsa_qsa_t *alsa = (alsa_qsa_t*)data;
|
||||
return alsa->buf_size * alsa->buf_count;
|
||||
alsa_t *alsa = (alsa_t*)data;
|
||||
return alsa->buf_size * alsa->buf_count;
|
||||
}
|
||||
|
||||
audio_driver_t audio_alsa = {
|
||||
@@ -375,8 +377,6 @@ audio_driver_t audio_alsa = {
|
||||
alsa_qsa_free,
|
||||
alsa_qsa_use_float,
|
||||
"alsa",
|
||||
NULL,
|
||||
NULL,
|
||||
alsa_qsa_write_avail,
|
||||
alsa_qsa_buffer_size,
|
||||
};
|
||||
+25
-88
@@ -1,7 +1,7 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2012-2015 - Michael Lelli
|
||||
*
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
@@ -16,19 +16,18 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <lists/string_list.h>
|
||||
|
||||
#include <alsa/asoundlib.h>
|
||||
|
||||
#include <rthreads/rthreads.h>
|
||||
#include <queues/fifo_queue.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <queues/fifo_buffer.h>
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#define TRY_ALSA(x) if (x < 0) \
|
||||
goto error;
|
||||
#define TRY_ALSA(x) if (x < 0) { \
|
||||
goto error; \
|
||||
}
|
||||
|
||||
typedef struct alsa_thread
|
||||
{
|
||||
@@ -52,8 +51,8 @@ typedef struct alsa_thread
|
||||
static void alsa_worker_thread(void *data)
|
||||
{
|
||||
alsa_thread_t *alsa = (alsa_thread_t*)data;
|
||||
uint8_t *buf = (uint8_t *)calloc(1, alsa->period_size);
|
||||
|
||||
uint8_t *buf = (uint8_t *)calloc(1, alsa->period_size);
|
||||
if (!buf)
|
||||
{
|
||||
RARCH_ERR("failed to allocate audio buffer");
|
||||
@@ -77,7 +76,7 @@ static void alsa_worker_thread(void *data)
|
||||
|
||||
frames = snd_pcm_writei(alsa->pcm, buf, alsa->period_frames);
|
||||
|
||||
if (frames == -EPIPE || frames == -EINTR ||
|
||||
if (frames == -EPIPE || frames == -EINTR ||
|
||||
frames == -ESTRPIPE)
|
||||
{
|
||||
if (snd_pcm_recover(alsa->pcm, frames, 1) < 0)
|
||||
@@ -91,7 +90,7 @@ static void alsa_worker_thread(void *data)
|
||||
}
|
||||
else if (frames < 0)
|
||||
{
|
||||
RARCH_ERR("[ALSA]: Unknown error occurred (%s).\n",
|
||||
RARCH_ERR("[ALSA]: Unknown error occured (%s).\n",
|
||||
snd_strerror(frames));
|
||||
break;
|
||||
}
|
||||
@@ -131,9 +130,7 @@ static void alsa_thread_free(void *data)
|
||||
{
|
||||
if (alsa->worker_thread)
|
||||
{
|
||||
slock_lock(alsa->cond_lock);
|
||||
alsa->thread_dead = true;
|
||||
slock_unlock(alsa->cond_lock);
|
||||
sthread_join(alsa->worker_thread);
|
||||
}
|
||||
if (alsa->buffer)
|
||||
@@ -154,20 +151,21 @@ static void alsa_thread_free(void *data)
|
||||
}
|
||||
|
||||
static void *alsa_thread_init(const char *device,
|
||||
unsigned rate, unsigned latency,
|
||||
unsigned block_frames,
|
||||
unsigned *new_rate)
|
||||
unsigned rate, unsigned latency)
|
||||
{
|
||||
alsa_thread_t *alsa = (alsa_thread_t*)calloc(1, sizeof(alsa_thread_t));
|
||||
|
||||
snd_pcm_hw_params_t *params = NULL;
|
||||
snd_pcm_sw_params_t *sw_params = NULL;
|
||||
|
||||
const char *alsa_dev = device ? device : "default";
|
||||
|
||||
unsigned latency_usec = latency * 1000 / 2;
|
||||
|
||||
unsigned channels = 2;
|
||||
unsigned periods = 4;
|
||||
snd_pcm_uframes_t buffer_size;
|
||||
snd_pcm_format_t format;
|
||||
snd_pcm_hw_params_t *params = NULL;
|
||||
snd_pcm_sw_params_t *sw_params = NULL;
|
||||
const char *alsa_dev = device ? device : "default";
|
||||
unsigned latency_usec = latency * 1000 / 2;
|
||||
unsigned channels = 2;
|
||||
unsigned periods = 4;
|
||||
alsa_thread_t *alsa = (alsa_thread_t*)
|
||||
calloc(1, sizeof(alsa_thread_t));
|
||||
|
||||
if (!alsa)
|
||||
return NULL;
|
||||
@@ -192,7 +190,7 @@ static void *alsa_thread_init(const char *device,
|
||||
|
||||
TRY_ALSA(snd_pcm_hw_params(alsa->pcm, params));
|
||||
|
||||
/* Shouldn't have to bother with this,
|
||||
/* Shouldn't have to bother with this,
|
||||
* but some drivers are apparently broken. */
|
||||
if (snd_pcm_hw_params_get_period_size(params, &alsa->period_frames, NULL))
|
||||
snd_pcm_hw_params_get_period_size_min(
|
||||
@@ -284,8 +282,7 @@ static ssize_t alsa_thread_write(void *data, const void *buf, size_t size)
|
||||
else
|
||||
{
|
||||
size_t write_amt = MIN(size - written, avail);
|
||||
fifo_write(alsa->buffer,
|
||||
(const char*)buf + written, write_amt);
|
||||
fifo_write(alsa->buffer, (const char*)buf + written, write_amt);
|
||||
slock_unlock(alsa->fifo_lock);
|
||||
written += write_amt;
|
||||
}
|
||||
@@ -317,7 +314,7 @@ static void alsa_thread_set_nonblock_state(void *data, bool state)
|
||||
alsa->nonblock = state;
|
||||
}
|
||||
|
||||
static bool alsa_thread_start(void *data, bool is_shutdown)
|
||||
static bool alsa_thread_start(void *data)
|
||||
{
|
||||
alsa_thread_t *alsa = (alsa_thread_t*)data;
|
||||
|
||||
@@ -345,64 +342,6 @@ static size_t alsa_thread_buffer_size(void *data)
|
||||
return alsa->buffer_size;
|
||||
}
|
||||
|
||||
static void *alsa_thread_device_list_new(void *data)
|
||||
{
|
||||
void **hints, **n;
|
||||
union string_list_elem_attr attr;
|
||||
struct string_list *s = string_list_new();
|
||||
|
||||
if (!s)
|
||||
return NULL;
|
||||
|
||||
attr.i = 0;
|
||||
|
||||
if (snd_device_name_hint(-1, "pcm", &hints) != 0)
|
||||
goto error;
|
||||
|
||||
n = hints;
|
||||
|
||||
while (*n)
|
||||
{
|
||||
char *name = snd_device_name_get_hint(*n, "NAME");
|
||||
char *io = snd_device_name_get_hint(*n, "IOID");
|
||||
char *desc = snd_device_name_get_hint(*n, "DESC");
|
||||
|
||||
/* description of device IOID - input / output identifcation
|
||||
* ("Input" or "Output"), NULL means both) */
|
||||
|
||||
if (!io || string_is_equal(io,"Output"))
|
||||
string_list_append(s, name, attr);
|
||||
|
||||
if (name)
|
||||
free(name);
|
||||
if (io)
|
||||
free(io);
|
||||
if (desc)
|
||||
free(desc);
|
||||
|
||||
n++;
|
||||
}
|
||||
|
||||
/* free hint buffer too */
|
||||
snd_device_name_free_hint(hints);
|
||||
|
||||
return s;
|
||||
|
||||
error:
|
||||
string_list_free(s);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void alsa_thread_device_list_free(void *data, void *array_list_data)
|
||||
{
|
||||
struct string_list *s = (struct string_list*)array_list_data;
|
||||
|
||||
if (!s)
|
||||
return;
|
||||
|
||||
string_list_free(s);
|
||||
}
|
||||
|
||||
audio_driver_t audio_alsathread = {
|
||||
alsa_thread_init,
|
||||
alsa_thread_write,
|
||||
@@ -413,8 +352,6 @@ audio_driver_t audio_alsathread = {
|
||||
alsa_thread_free,
|
||||
alsa_thread_use_float,
|
||||
"alsathread",
|
||||
alsa_thread_device_list_new,
|
||||
alsa_thread_device_list_free,
|
||||
alsa_thread_write_avail,
|
||||
alsa_thread_buffer_size,
|
||||
};
|
||||
@@ -1,212 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <sys/audioio.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#define DEFAULT_DEV "/dev/audio"
|
||||
|
||||
static void *audioio_init(const char *device, unsigned rate, unsigned latency,
|
||||
unsigned block_frames,
|
||||
unsigned *new_out_rate)
|
||||
{
|
||||
int *fd = (int*)calloc(1, sizeof(int));
|
||||
const char *audiodev = device ? device : DEFAULT_DEV;
|
||||
struct audio_info info;
|
||||
|
||||
if (!fd)
|
||||
return NULL;
|
||||
|
||||
AUDIO_INITINFO(&info);
|
||||
|
||||
#ifdef AUMODE_PLAY_ALL
|
||||
info.mode = AUMODE_PLAY_ALL;
|
||||
#elif defined(AUMODE_PLAY)
|
||||
info.mode = AUMODE_PLAY;
|
||||
#endif
|
||||
info.play.sample_rate = rate;
|
||||
info.play.channels = 2;
|
||||
info.play.precision = 16;
|
||||
#ifdef AUDIO_ENCODING_SLINEAR
|
||||
info.play.encoding = AUDIO_ENCODING_SLINEAR;
|
||||
#else
|
||||
info.play.encoding = AUDIO_ENCODING_LINEAR;
|
||||
#endif
|
||||
|
||||
if ((*fd = open(audiodev, O_WRONLY)) < 0)
|
||||
{
|
||||
free(fd);
|
||||
perror("open");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ioctl(*fd, AUDIO_SETINFO, &info) < 0)
|
||||
goto error;
|
||||
|
||||
if (ioctl(*fd, AUDIO_GETINFO, &info) < 0)
|
||||
goto error;
|
||||
|
||||
*new_out_rate = info.play.sample_rate;
|
||||
|
||||
return fd;
|
||||
error:
|
||||
close(*fd);
|
||||
free(fd);
|
||||
perror("ioctl");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static ssize_t audioio_write(void *data, const void *buf, size_t size)
|
||||
{
|
||||
ssize_t ret;
|
||||
int *fd = (int*)data;
|
||||
|
||||
if (size == 0)
|
||||
return 0;
|
||||
|
||||
if ((ret = write(*fd, buf, size)) < 0)
|
||||
{
|
||||
if (errno == EAGAIN && (fcntl(*fd, F_GETFL) & O_NONBLOCK))
|
||||
return 0;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool audioio_stop(void *data)
|
||||
{
|
||||
struct audio_info info;
|
||||
int *fd = (int*)data;
|
||||
|
||||
#ifdef AUDIO_FLUSH
|
||||
if (ioctl(*fd, AUDIO_FLUSH, NULL) < 0)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
if (ioctl(*fd, AUDIO_GETINFO, &info) < 0)
|
||||
return false;
|
||||
|
||||
info.play.pause = true;
|
||||
|
||||
return ioctl(*fd, AUDIO_SETINFO, &info) == 0;
|
||||
}
|
||||
|
||||
static bool audioio_start(void *data, bool is_shutdown)
|
||||
{
|
||||
struct audio_info info;
|
||||
int *fd = (int*)data;
|
||||
|
||||
#ifdef AUDIO_FLUSH
|
||||
if (ioctl(*fd, AUDIO_FLUSH, NULL) < 0)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
if (ioctl(*fd, AUDIO_GETINFO, &info) < 0)
|
||||
return false;
|
||||
|
||||
info.play.pause = false;
|
||||
|
||||
return ioctl(*fd, AUDIO_SETINFO, &info) == 0;
|
||||
}
|
||||
|
||||
static bool audioio_alive(void *data)
|
||||
{
|
||||
struct audio_info info;
|
||||
int *fd = (int*)data;
|
||||
|
||||
if (ioctl(*fd, AUDIO_GETINFO, &info) < 0)
|
||||
return false;
|
||||
|
||||
return !info.play.pause;
|
||||
}
|
||||
|
||||
static void audioio_set_nonblock_state(void *data, bool state)
|
||||
{
|
||||
int rc;
|
||||
int *fd = (int*)data;
|
||||
|
||||
if (state)
|
||||
rc = fcntl(*fd, F_SETFL, fcntl(*fd, F_GETFL) | O_NONBLOCK);
|
||||
else
|
||||
rc = fcntl(*fd, F_SETFL, fcntl(*fd, F_GETFL) & (~O_NONBLOCK));
|
||||
if (rc != 0)
|
||||
RARCH_WARN("Could not set nonblocking on audio file descriptor. Will not be able to fast-forward.\n");
|
||||
}
|
||||
|
||||
static void audioio_free(void *data)
|
||||
{
|
||||
int *fd = (int*)data;
|
||||
|
||||
#ifdef AUDIO_FLUSH
|
||||
(void)ioctl(*fd, AUDIO_FLUSH, NULL);
|
||||
#endif
|
||||
|
||||
close(*fd);
|
||||
free(fd);
|
||||
}
|
||||
|
||||
static size_t audioio_buffer_size(void *data)
|
||||
{
|
||||
struct audio_info info;
|
||||
int *fd = (int*)data;
|
||||
|
||||
if (ioctl(*fd, AUDIO_GETINFO, &info) < 0)
|
||||
return false;
|
||||
|
||||
return info.play.buffer_size;
|
||||
}
|
||||
|
||||
static size_t audioio_write_avail(void *data)
|
||||
{
|
||||
return audioio_buffer_size(data);
|
||||
}
|
||||
|
||||
static bool audioio_use_float(void *data)
|
||||
{
|
||||
(void)data;
|
||||
return false;
|
||||
}
|
||||
|
||||
audio_driver_t audio_audioio = {
|
||||
audioio_init,
|
||||
audioio_write,
|
||||
audioio_stop,
|
||||
audioio_start,
|
||||
audioio_alive,
|
||||
audioio_set_nonblock_state,
|
||||
audioio_free,
|
||||
audioio_use_float,
|
||||
"audioio",
|
||||
NULL,
|
||||
NULL,
|
||||
audioio_write_avail,
|
||||
audioio_buffer_size,
|
||||
};
|
||||
+63
-78
@@ -1,7 +1,7 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2014 - Chris Moeller
|
||||
*
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
#include <AudioToolbox/AudioToolbox.h>
|
||||
#else
|
||||
@@ -26,20 +27,29 @@
|
||||
#include <AudioUnit/AUComponent.h>
|
||||
|
||||
#include <boolean.h>
|
||||
#include <queues/fifo_queue.h>
|
||||
#include <queues/fifo_buffer.h>
|
||||
#include <rthreads/rthreads.h>
|
||||
#include <retro_endianness.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#if defined(__powerpc__) || defined(__ppc__) || defined(__POWERPC__)
|
||||
|
||||
#ifndef OSX_PPC
|
||||
#define OSX_PPC
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct coreaudio
|
||||
{
|
||||
slock_t *lock;
|
||||
scond_t *cond;
|
||||
|
||||
#if (defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__)))
|
||||
#ifdef OSX_PPC
|
||||
ComponentInstance dev;
|
||||
#else
|
||||
AudioComponentInstance dev;
|
||||
@@ -52,9 +62,7 @@ typedef struct coreaudio
|
||||
size_t buffer_size;
|
||||
} coreaudio_t;
|
||||
|
||||
#if TARGET_OS_IOS
|
||||
static bool g_interrupted;
|
||||
#endif
|
||||
|
||||
static void coreaudio_free(void *data)
|
||||
{
|
||||
@@ -66,7 +74,7 @@ static void coreaudio_free(void *data)
|
||||
if (dev->dev_alive)
|
||||
{
|
||||
AudioOutputUnitStop(dev->dev);
|
||||
#if (defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__)))
|
||||
#ifdef OSX_PPC
|
||||
CloseComponent(dev->dev);
|
||||
#else
|
||||
AudioComponentInstanceDispose(dev->dev);
|
||||
@@ -87,19 +95,21 @@ static OSStatus audio_write_cb(void *userdata,
|
||||
const AudioTimeStamp *time_stamp, UInt32 bus_number,
|
||||
UInt32 number_frames, AudioBufferList *io_data)
|
||||
{
|
||||
void *outbuf;
|
||||
unsigned write_avail;
|
||||
void *outbuf = NULL;
|
||||
coreaudio_t *dev = (coreaudio_t*)userdata;
|
||||
|
||||
(void)time_stamp;
|
||||
(void)bus_number;
|
||||
(void)number_frames;
|
||||
|
||||
if (!io_data || io_data->mNumberBuffers != 1)
|
||||
if (!io_data)
|
||||
return noErr;
|
||||
if (io_data->mNumberBuffers != 1)
|
||||
return noErr;
|
||||
|
||||
write_avail = io_data->mBuffers[0].mDataByteSize;
|
||||
outbuf = io_data->mBuffers[0].mData;
|
||||
outbuf = io_data->mBuffers[0].mData;
|
||||
|
||||
slock_lock(dev->lock);
|
||||
|
||||
@@ -113,7 +123,7 @@ static OSStatus audio_write_cb(void *userdata,
|
||||
slock_unlock(dev->lock);
|
||||
|
||||
/* Technically possible to deadlock without. */
|
||||
scond_signal(dev->cond);
|
||||
scond_signal(dev->cond);
|
||||
return noErr;
|
||||
}
|
||||
|
||||
@@ -127,55 +137,47 @@ static OSStatus audio_write_cb(void *userdata,
|
||||
static void coreaudio_interrupt_listener(void *data, UInt32 interrupt_state)
|
||||
{
|
||||
(void)data;
|
||||
#if TARGET_OS_IOS
|
||||
g_interrupted = (interrupt_state == kAudioSessionBeginInterruption);
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
static void choose_output_device(coreaudio_t *dev, const char* device)
|
||||
{
|
||||
unsigned i;
|
||||
UInt32 deviceCount;
|
||||
AudioObjectPropertyAddress propaddr;
|
||||
AudioDeviceID *devices = NULL;
|
||||
UInt32 size = 0;
|
||||
AudioDeviceID *devices;
|
||||
AudioObjectPropertyAddress propaddr =
|
||||
{
|
||||
kAudioHardwarePropertyDevices,
|
||||
kAudioObjectPropertyScopeGlobal,
|
||||
kAudioObjectPropertyElementMaster
|
||||
};
|
||||
|
||||
propaddr.mSelector = kAudioHardwarePropertyDevices;
|
||||
#if MAC_OS_X_VERSION_10_12
|
||||
propaddr.mScope = kAudioObjectPropertyScopeOutput;
|
||||
#else
|
||||
propaddr.mScope = kAudioObjectPropertyScopeGlobal;
|
||||
#endif
|
||||
propaddr.mElement = kAudioObjectPropertyElementMaster;
|
||||
UInt32 size = 0, deviceCount;
|
||||
|
||||
if (AudioObjectGetPropertyDataSize(kAudioObjectSystemObject,
|
||||
&propaddr, 0, 0, &size) != noErr)
|
||||
return;
|
||||
|
||||
deviceCount = size / sizeof(AudioDeviceID);
|
||||
devices = (AudioDeviceID*)malloc(size);
|
||||
devices = (AudioDeviceID*)malloc(size);
|
||||
|
||||
if (!devices || AudioObjectGetPropertyData(kAudioObjectSystemObject,
|
||||
&propaddr, 0, 0, &size, devices) != noErr)
|
||||
goto done;
|
||||
|
||||
#if MAC_OS_X_VERSION_10_12
|
||||
#else
|
||||
propaddr.mScope = kAudioDevicePropertyScopeOutput;
|
||||
#endif
|
||||
propaddr.mScope = kAudioDevicePropertyScopeOutput;
|
||||
propaddr.mSelector = kAudioDevicePropertyDeviceName;
|
||||
size = 1024;
|
||||
|
||||
for (i = 0; i < deviceCount; i ++)
|
||||
{
|
||||
char device_name[1024];
|
||||
device_name[0] = 0;
|
||||
size = 1024;
|
||||
|
||||
if (AudioObjectGetPropertyData(devices[i],
|
||||
&propaddr, 0, 0, &size, device_name) == noErr
|
||||
&propaddr, 0, 0, &size, device_name) == noErr
|
||||
&& string_is_equal(device_name, device))
|
||||
{
|
||||
AudioUnitSetProperty(dev->dev, kAudioOutputUnitProperty_CurrentDevice,
|
||||
AudioUnitSetProperty(dev->dev, kAudioOutputUnitProperty_CurrentDevice,
|
||||
kAudioUnitScope_Global, 0, &devices[i], sizeof(AudioDeviceID));
|
||||
goto done;
|
||||
}
|
||||
@@ -187,14 +189,12 @@ done:
|
||||
#endif
|
||||
|
||||
static void *coreaudio_init(const char *device,
|
||||
unsigned rate, unsigned latency,
|
||||
unsigned block_frames,
|
||||
unsigned *new_rate)
|
||||
unsigned rate, unsigned latency)
|
||||
{
|
||||
size_t fifo_size;
|
||||
UInt32 i_size;
|
||||
AudioStreamBasicDescription real_desc;
|
||||
#if (defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__)))
|
||||
#ifdef OSX_PPC
|
||||
Component comp;
|
||||
#else
|
||||
AudioComponent comp;
|
||||
@@ -206,23 +206,25 @@ static void *coreaudio_init(const char *device,
|
||||
AudioStreamBasicDescription stream_desc = {0};
|
||||
bool component_unavailable = false;
|
||||
static bool session_initialized = false;
|
||||
#if (defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__)))
|
||||
coreaudio_t *dev = NULL;
|
||||
#ifdef OSX_PPC
|
||||
ComponentDescription desc = {0};
|
||||
#else
|
||||
AudioComponentDescription desc = {0};
|
||||
#endif
|
||||
coreaudio_t *dev = (coreaudio_t*)
|
||||
calloc(1, sizeof(*dev));
|
||||
if (!dev)
|
||||
return NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
(void)session_initialized;
|
||||
(void)device;
|
||||
|
||||
dev = (coreaudio_t*)calloc(1, sizeof(*dev));
|
||||
if (!dev)
|
||||
return NULL;
|
||||
|
||||
dev->lock = slock_new();
|
||||
dev->cond = scond_new();
|
||||
|
||||
#if TARGET_OS_IOS
|
||||
#if TARGET_OS_IPHONE
|
||||
if (!session_initialized)
|
||||
{
|
||||
session_initialized = true;
|
||||
@@ -240,15 +242,15 @@ static void *coreaudio_init(const char *device,
|
||||
#endif
|
||||
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
|
||||
|
||||
#if (defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__)))
|
||||
#ifdef OSX_PPC
|
||||
comp = FindNextComponent(NULL, &desc);
|
||||
#else
|
||||
comp = AudioComponentFindNext(NULL, &desc);
|
||||
#endif
|
||||
if (!comp)
|
||||
if (comp == NULL)
|
||||
goto error;
|
||||
|
||||
#if (defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__)))
|
||||
|
||||
#ifdef OSX_PPC
|
||||
component_unavailable = (OpenAComponent(comp, &dev->dev) != noErr);
|
||||
#else
|
||||
component_unavailable = (AudioComponentInstanceNew(comp, &dev->dev) != noErr);
|
||||
@@ -262,7 +264,7 @@ static void *coreaudio_init(const char *device,
|
||||
choose_output_device(dev, device);
|
||||
#endif
|
||||
|
||||
dev->dev_alive = true;
|
||||
dev->dev_alive = true;
|
||||
|
||||
/* Set audio format */
|
||||
stream_desc.mSampleRate = rate;
|
||||
@@ -272,17 +274,17 @@ static void *coreaudio_init(const char *device,
|
||||
stream_desc.mBytesPerFrame = 2 * sizeof(float);
|
||||
stream_desc.mFramesPerPacket = 1;
|
||||
stream_desc.mFormatID = kAudioFormatLinearPCM;
|
||||
stream_desc.mFormatFlags = kAudioFormatFlagIsFloat |
|
||||
kAudioFormatFlagIsPacked | (is_little_endian() ?
|
||||
stream_desc.mFormatFlags = kAudioFormatFlagIsFloat |
|
||||
kAudioFormatFlagIsPacked | (is_little_endian() ?
|
||||
0 : kAudioFormatFlagIsBigEndian);
|
||||
|
||||
|
||||
if (AudioUnitSetProperty(dev->dev, kAudioUnitProperty_StreamFormat,
|
||||
kAudioUnitScope_Input, 0, &stream_desc, sizeof(stream_desc)) != noErr)
|
||||
goto error;
|
||||
|
||||
|
||||
/* Check returned audio format. */
|
||||
i_size = sizeof(real_desc);
|
||||
if (AudioUnitGetProperty(dev->dev, kAudioUnitProperty_StreamFormat,
|
||||
if (AudioUnitGetProperty(dev->dev, kAudioUnitProperty_StreamFormat,
|
||||
kAudioUnitScope_Input, 0, &real_desc, &i_size) != noErr)
|
||||
goto error;
|
||||
|
||||
@@ -297,7 +299,7 @@ static void *coreaudio_init(const char *device,
|
||||
|
||||
RARCH_LOG("[CoreAudio]: Using output sample rate of %.1f Hz\n",
|
||||
(float)real_desc.mSampleRate);
|
||||
*new_rate = real_desc.mSampleRate;
|
||||
settings->audio.out_rate = real_desc.mSampleRate;
|
||||
|
||||
/* Set channel layout (fails on iOS). */
|
||||
#ifndef TARGET_OS_IPHONE
|
||||
@@ -318,11 +320,11 @@ static void *coreaudio_init(const char *device,
|
||||
if (AudioUnitInitialize(dev->dev) != noErr)
|
||||
goto error;
|
||||
|
||||
fifo_size = (latency * (*new_rate)) / 1000;
|
||||
fifo_size *= 2 * sizeof(float);
|
||||
dev->buffer_size = fifo_size;
|
||||
fifo_size = (latency * settings->audio.out_rate) / 1000;
|
||||
fifo_size *= 2 * sizeof(float);
|
||||
dev->buffer_size = fifo_size;
|
||||
|
||||
dev->buffer = fifo_new(fifo_size);
|
||||
dev->buffer = fifo_new(fifo_size);
|
||||
if (!dev->buffer)
|
||||
goto error;
|
||||
|
||||
@@ -342,15 +344,11 @@ error:
|
||||
|
||||
static ssize_t coreaudio_write(void *data, const void *buf_, size_t size)
|
||||
{
|
||||
coreaudio_t *dev = (coreaudio_t*)data;
|
||||
coreaudio_t *dev = (coreaudio_t*)data;
|
||||
const uint8_t *buf = (const uint8_t*)buf_;
|
||||
size_t written = 0;
|
||||
size_t written = 0;
|
||||
|
||||
#if TARGET_OS_IOS
|
||||
while (!g_interrupted && size > 0)
|
||||
#else
|
||||
while (size > 0)
|
||||
#endif
|
||||
{
|
||||
size_t write_avail;
|
||||
|
||||
@@ -371,7 +369,7 @@ static ssize_t coreaudio_write(void *data, const void *buf_, size_t size)
|
||||
break;
|
||||
}
|
||||
|
||||
#if TARGET_OS_IOS
|
||||
#if TARGET_OS_IPHONE
|
||||
if (write_avail == 0 && !scond_wait_timeout(
|
||||
dev->cond, dev->lock, 3000000))
|
||||
g_interrupted = true;
|
||||
@@ -409,7 +407,7 @@ static bool coreaudio_stop(void *data)
|
||||
return dev->is_paused ? true : false;
|
||||
}
|
||||
|
||||
static bool coreaudio_start(void *data, bool is_shutdown)
|
||||
static bool coreaudio_start(void *data)
|
||||
{
|
||||
coreaudio_t *dev = (coreaudio_t*)data;
|
||||
if (!dev)
|
||||
@@ -442,17 +440,6 @@ static size_t coreaudio_buffer_size(void *data)
|
||||
return dev->buffer_size;
|
||||
}
|
||||
|
||||
static void *coreaudio_device_list_new(void *data)
|
||||
{
|
||||
/* TODO/FIXME */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void coreaudio_device_list_free(void *data, void *array_list_data)
|
||||
{
|
||||
/* TODO/FIXME */
|
||||
}
|
||||
|
||||
audio_driver_t audio_coreaudio = {
|
||||
coreaudio_init,
|
||||
coreaudio_write,
|
||||
@@ -463,8 +450,6 @@ audio_driver_t audio_coreaudio = {
|
||||
coreaudio_free,
|
||||
coreaudio_use_float,
|
||||
"coreaudio",
|
||||
coreaudio_device_list_new,
|
||||
coreaudio_device_list_free,
|
||||
coreaudio_write_avail,
|
||||
coreaudio_buffer_size,
|
||||
};
|
||||
@@ -1,392 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2019 - Stuart Carnie
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <AudioToolbox/AudioToolbox.h>
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdatomic.h>
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
|
||||
#include "../../retroarch.h"
|
||||
|
||||
#pragma mark - ringbuffer
|
||||
|
||||
typedef struct ringbuffer
|
||||
{
|
||||
float *buffer;
|
||||
size_t cap;
|
||||
atomic_int len;
|
||||
size_t writePtr;
|
||||
size_t readPtr;
|
||||
} ringbuffer_t;
|
||||
|
||||
typedef ringbuffer_t * ringbuffer_h;
|
||||
|
||||
static inline size_t rb_len(ringbuffer_h r)
|
||||
{
|
||||
return atomic_load_explicit(&r->len, memory_order_relaxed);
|
||||
}
|
||||
|
||||
static inline size_t rb_cap(ringbuffer_h r)
|
||||
{
|
||||
return (r->readPtr + r->cap - r->writePtr) % r->cap;
|
||||
}
|
||||
|
||||
static inline size_t rb_avail(ringbuffer_h r)
|
||||
{
|
||||
return r->cap - rb_len(r);
|
||||
}
|
||||
|
||||
static inline void rb_advance_write(ringbuffer_h r)
|
||||
{
|
||||
r->writePtr = (r->writePtr + 1) % r->cap;
|
||||
}
|
||||
|
||||
static inline void rb_advance_write_n(ringbuffer_h r, size_t n)
|
||||
{
|
||||
r->writePtr = (r->writePtr + n) % r->cap;
|
||||
}
|
||||
|
||||
static inline void rb_advance_read(ringbuffer_h r)
|
||||
{
|
||||
r->readPtr = (r->readPtr + 1) % r->cap;
|
||||
}
|
||||
|
||||
static inline void rb_len_add(ringbuffer_h r, int n)
|
||||
{
|
||||
atomic_fetch_add(&r->len, n);
|
||||
}
|
||||
|
||||
static inline void rb_len_sub(ringbuffer_h r, int n)
|
||||
{
|
||||
atomic_fetch_sub(&r->len, n);
|
||||
}
|
||||
|
||||
static void rb_init(ringbuffer_h r, size_t cap)
|
||||
{
|
||||
r->buffer = malloc(cap * sizeof(float));
|
||||
r->cap = cap;
|
||||
atomic_init(&r->len, 0);
|
||||
r->writePtr = 0;
|
||||
r->readPtr = 0;
|
||||
}
|
||||
|
||||
static void rb_free(ringbuffer_h r)
|
||||
{
|
||||
free(r->buffer);
|
||||
memset(r, 0, sizeof(*r));
|
||||
}
|
||||
|
||||
#define UNLIKELY(x) __builtin_expect((x), 0)
|
||||
#define LIKELY(x) __builtin_expect((x), 1)
|
||||
|
||||
static void rb_write_data(ringbuffer_h r, const float *data, size_t len)
|
||||
{
|
||||
size_t avail = rb_avail(r);
|
||||
size_t n = MIN(len, avail);
|
||||
size_t first_write = n;
|
||||
size_t rest_write = 0;
|
||||
|
||||
if (r->writePtr + n > r->cap)
|
||||
{
|
||||
first_write = r->cap - r->writePtr;
|
||||
rest_write = n - first_write;
|
||||
}
|
||||
|
||||
memcpy(r->buffer + r->writePtr, data, first_write*sizeof(float));
|
||||
memcpy(r->buffer, data + first_write, rest_write*sizeof(float));
|
||||
|
||||
rb_advance_write_n(r, n);
|
||||
rb_len_add(r, (int)n);
|
||||
}
|
||||
|
||||
static void rb_read_data(ringbuffer_h r,
|
||||
float *d0, float *d1, size_t len)
|
||||
{
|
||||
size_t need = len * 2;
|
||||
|
||||
do {
|
||||
size_t have = rb_len(r);
|
||||
size_t n = MIN(have, need);
|
||||
int i = 0;
|
||||
for (; i < n/2; i++)
|
||||
{
|
||||
d0[i] = r->buffer[r->readPtr];
|
||||
rb_advance_read(r);
|
||||
d1[i] = r->buffer[r->readPtr];
|
||||
rb_advance_read(r);
|
||||
}
|
||||
|
||||
need -= n;
|
||||
rb_len_sub(r, (int)n);
|
||||
|
||||
if (UNLIKELY(need > 0))
|
||||
{
|
||||
const float quiet = 0.0f;
|
||||
size_t fill;
|
||||
|
||||
/* we got more data */
|
||||
if (rb_len(r) > 0)
|
||||
continue;
|
||||
|
||||
/* underflow */
|
||||
fill = (need/2)*sizeof(float);
|
||||
memset_pattern4(&d0[i], &quiet, fill);
|
||||
memset_pattern4(&d1[i], &quiet, fill);
|
||||
}
|
||||
} while (0);
|
||||
}
|
||||
|
||||
#pragma mark - CoreAudio3
|
||||
|
||||
static bool g_interrupted;
|
||||
|
||||
@interface CoreAudio3 : NSObject {
|
||||
ringbuffer_t _rb;
|
||||
dispatch_semaphore_t _sema;
|
||||
AUAudioUnit *_au;
|
||||
size_t _bufferSize;
|
||||
BOOL _nonBlock;
|
||||
}
|
||||
|
||||
@property (nonatomic, readwrite) BOOL nonBlock;
|
||||
@property (nonatomic, readonly) BOOL paused;
|
||||
@property (nonatomic, readonly) size_t writeAvailableInBytes;
|
||||
@property (nonatomic, readonly) size_t bufferSizeInBytes;
|
||||
|
||||
- (instancetype)initWithRate:(NSUInteger)rate
|
||||
latency:(NSUInteger)latency;
|
||||
- (ssize_t)writeFloat:(const float *)data samples:(size_t)samples;
|
||||
- (void)start;
|
||||
- (void)stop;
|
||||
|
||||
@end
|
||||
|
||||
@implementation CoreAudio3
|
||||
|
||||
- (instancetype)initWithRate:(NSUInteger)rate
|
||||
latency:(NSUInteger)latency {
|
||||
if (self = [super init])
|
||||
{
|
||||
NSError *err;
|
||||
AUAudioUnit *au;
|
||||
AudioComponentDescription desc;
|
||||
AVAudioFormat *format, *renderFormat;
|
||||
|
||||
_sema = dispatch_semaphore_create(0);
|
||||
|
||||
_bufferSize = (latency * rate) / 1000;
|
||||
_bufferSize *= 2; /* stereo */
|
||||
rb_init(&_rb, _bufferSize);
|
||||
|
||||
desc.componentType = kAudioUnitType_Output;
|
||||
desc.componentSubType = kAudioUnitSubType_DefaultOutput;
|
||||
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
|
||||
|
||||
au = [[AUAudioUnit alloc] initWithComponentDescription:desc error:&err];
|
||||
if (err != nil)
|
||||
return nil;
|
||||
|
||||
format = au.outputBusses[0].format;
|
||||
if (format.channelCount != 2)
|
||||
return nil;
|
||||
|
||||
renderFormat = [[AVAudioFormat alloc] initStandardFormatWithSampleRate:rate channels:2];
|
||||
[au.inputBusses[0] setFormat:renderFormat error:&err];
|
||||
if (err != nil)
|
||||
return nil;
|
||||
|
||||
ringbuffer_h rb = &_rb;
|
||||
__block dispatch_semaphore_t sema = _sema;
|
||||
au.outputProvider = ^AUAudioUnitStatus(AudioUnitRenderActionFlags * actionFlags, const AudioTimeStamp * timestamp, AUAudioFrameCount frameCount, NSInteger inputBusNumber, AudioBufferList * inputData)
|
||||
{
|
||||
rb_read_data(rb, inputData->mBuffers[0].mData, inputData->mBuffers[1].mData, frameCount);
|
||||
dispatch_semaphore_signal(sema);
|
||||
return 0;
|
||||
};
|
||||
|
||||
[au allocateRenderResourcesAndReturnError:&err];
|
||||
if (err != nil)
|
||||
return nil;
|
||||
|
||||
_au = au;
|
||||
|
||||
RARCH_LOG("[CoreAudio3]: Using buffer size of %u bytes: (latency = %u ms)\n", (unsigned)self.bufferSizeInBytes, latency);
|
||||
|
||||
[self start];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
rb_free(&_rb);
|
||||
}
|
||||
|
||||
- (BOOL)paused {
|
||||
return !_au.running;
|
||||
}
|
||||
|
||||
- (size_t)bufferSizeInBytes {
|
||||
return _bufferSize * sizeof(float);
|
||||
}
|
||||
|
||||
- (size_t)writeAvailableInBytes {
|
||||
return rb_avail(&_rb) * sizeof(float);
|
||||
}
|
||||
|
||||
- (void)start {
|
||||
NSError *err;
|
||||
[_au startHardwareAndReturnError:&err];
|
||||
}
|
||||
|
||||
- (void)stop {
|
||||
[_au stopHardware];
|
||||
}
|
||||
|
||||
- (ssize_t)writeFloat:(const float *)data samples:(size_t)samples {
|
||||
size_t written = 0;
|
||||
while (!g_interrupted && samples > 0)
|
||||
{
|
||||
size_t write_avail = rb_avail(&_rb);
|
||||
if (write_avail > samples)
|
||||
write_avail = samples;
|
||||
|
||||
rb_write_data(&_rb, data, write_avail);
|
||||
data += write_avail;
|
||||
written += write_avail;
|
||||
samples -= write_avail;
|
||||
|
||||
if (_nonBlock)
|
||||
break;
|
||||
|
||||
if (write_avail == 0)
|
||||
dispatch_semaphore_wait(_sema, DISPATCH_TIME_FOREVER);
|
||||
}
|
||||
|
||||
return written;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
static void coreaudio3_free(void *data)
|
||||
{
|
||||
CoreAudio3 *dev = (__bridge_transfer CoreAudio3 *)data;
|
||||
if (dev == nil)
|
||||
return;
|
||||
|
||||
[dev stop];
|
||||
dev = nil;
|
||||
}
|
||||
|
||||
static void *coreaudio3_init(const char *device,
|
||||
unsigned rate, unsigned latency,
|
||||
unsigned block_frames,
|
||||
unsigned *new_rate)
|
||||
{
|
||||
CoreAudio3 *dev = [[CoreAudio3 alloc] initWithRate:rate
|
||||
latency:latency];
|
||||
|
||||
*new_rate = rate;
|
||||
|
||||
return (__bridge_retained void *)dev;
|
||||
}
|
||||
|
||||
static ssize_t coreaudio3_write(void *data,
|
||||
const void *buf_, size_t size)
|
||||
{
|
||||
CoreAudio3 *dev = (__bridge CoreAudio3 *)data;
|
||||
return [dev writeFloat:(const float *)
|
||||
buf_ samples:size/sizeof(float)] * sizeof(float);
|
||||
}
|
||||
|
||||
static void coreaudio3_set_nonblock_state(void *data, bool state)
|
||||
{
|
||||
CoreAudio3 *dev = (__bridge CoreAudio3 *)data;
|
||||
if (dev == nil)
|
||||
return;
|
||||
|
||||
dev.nonBlock = state;
|
||||
}
|
||||
|
||||
static bool coreaudio3_alive(void *data)
|
||||
{
|
||||
CoreAudio3 *dev = (__bridge CoreAudio3 *)data;
|
||||
if (dev == nil)
|
||||
return NO;
|
||||
|
||||
return !dev.paused;
|
||||
}
|
||||
|
||||
static bool coreaudio3_stop(void *data)
|
||||
{
|
||||
CoreAudio3 *dev = (__bridge CoreAudio3 *)data;
|
||||
if (dev == nil)
|
||||
return NO;
|
||||
|
||||
[dev stop];
|
||||
return dev.paused;
|
||||
}
|
||||
|
||||
static bool coreaudio3_start(void *data, bool is_shutdown)
|
||||
{
|
||||
CoreAudio3 *dev = (__bridge CoreAudio3 *)data;
|
||||
if (dev == nil)
|
||||
return NO;
|
||||
|
||||
[dev start];
|
||||
return !dev.paused;
|
||||
}
|
||||
|
||||
static bool coreaudio3_use_float(void *data)
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
static size_t coreaudio3_write_avail(void *data)
|
||||
{
|
||||
CoreAudio3 *dev = (__bridge CoreAudio3 *)data;
|
||||
if (dev == nil)
|
||||
return 0;
|
||||
|
||||
return dev.writeAvailableInBytes;
|
||||
}
|
||||
|
||||
static size_t coreaudio3_buffer_size(void *data)
|
||||
{
|
||||
CoreAudio3 *dev = (__bridge CoreAudio3 *)data;
|
||||
if (dev == nil)
|
||||
return 0;
|
||||
|
||||
return dev.bufferSizeInBytes;
|
||||
}
|
||||
|
||||
audio_driver_t audio_coreaudio3 = {
|
||||
coreaudio3_init,
|
||||
coreaudio3_write,
|
||||
coreaudio3_stop,
|
||||
coreaudio3_start,
|
||||
coreaudio3_alive,
|
||||
coreaudio3_set_nonblock_state,
|
||||
coreaudio3_free,
|
||||
coreaudio3_use_float,
|
||||
"coreaudio3",
|
||||
NULL, /* device_list_new */
|
||||
NULL, /* device_list_free */
|
||||
coreaudio3_write_avail,
|
||||
coreaudio3_buffer_size,
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2014-2017 - Ali Bouhlel
|
||||
* Copyright (C) 2014-2016 - Ali Bouhlel
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
@@ -15,15 +15,15 @@
|
||||
|
||||
#include <3ds.h>
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <retro_timers.h>
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../performance.h"
|
||||
#include "../../runloop.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool nonblock;
|
||||
bool nonblocking;
|
||||
bool playing;
|
||||
int16_t* l;
|
||||
int16_t* r;
|
||||
@@ -48,39 +48,37 @@ typedef struct
|
||||
|
||||
static void ctr_csnd_audio_update_playpos(ctr_csnd_audio_t* ctr)
|
||||
{
|
||||
uint64_t current_tick = svcGetSystemTick();
|
||||
uint32_t samples_played = (current_tick - ctr->cpu_ticks_last)
|
||||
/ CTR_CSND_CPU_TICKS_PER_SAMPLE;
|
||||
uint32_t samples_played;
|
||||
uint64_t current_tick;
|
||||
|
||||
current_tick = svcGetSystemTick();
|
||||
samples_played = (current_tick - ctr->cpu_ticks_last) / CTR_CSND_CPU_TICKS_PER_SAMPLE;
|
||||
ctr->playpos = (ctr->playpos + samples_played) & CTR_CSND_AUDIO_COUNT_MASK;
|
||||
ctr->cpu_ticks_last += samples_played * CTR_CSND_CPU_TICKS_PER_SAMPLE;
|
||||
}
|
||||
|
||||
Result csndPlaySound_custom(int chn, u32 flags, float vol, float pan,
|
||||
void* data0, void* data1, u32 size)
|
||||
{
|
||||
u32 paddr0 = 0;
|
||||
u32 paddr1 = 0;
|
||||
int encoding = (flags >> 12) & 3;
|
||||
int loopMode = (flags >> 10) & 3;
|
||||
|
||||
Result csndPlaySound_custom(int chn, u32 flags, float vol, float pan, void* data0, void* data1, u32 size)
|
||||
{
|
||||
if (!(csndChannels & BIT(chn)))
|
||||
return 1;
|
||||
|
||||
if (!loopMode)
|
||||
flags |= SOUND_ONE_SHOT;
|
||||
u32 paddr0 = 0, paddr1 = 0;
|
||||
|
||||
int encoding = (flags >> 12) & 3;
|
||||
int loopMode = (flags >> 10) & 3;
|
||||
|
||||
if (!loopMode) flags |= SOUND_ONE_SHOT;
|
||||
|
||||
if (encoding != CSND_ENCODING_PSG)
|
||||
{
|
||||
if (data0)
|
||||
paddr0 = osConvertVirtToPhys(data0);
|
||||
if (data1)
|
||||
paddr1 = osConvertVirtToPhys(data1);
|
||||
if (data0) paddr0 = osConvertVirtToPhys(data0);
|
||||
if (data1) paddr1 = osConvertVirtToPhys(data1);
|
||||
|
||||
if (data0 && encoding == CSND_ENCODING_ADPCM)
|
||||
{
|
||||
int adpcmSample = ((s16*)data0)[-2];
|
||||
int adpcmIndex = ((u8*)data0)[-2];
|
||||
int adpcmIndex = ((u8*)data0)[-2];
|
||||
CSND_SetAdpcmState(chn, 0, adpcmSample, adpcmIndex);
|
||||
}
|
||||
}
|
||||
@@ -93,8 +91,7 @@ Result csndPlaySound_custom(int chn, u32 flags, float vol, float pan,
|
||||
|
||||
if (loopMode == CSND_LOOPMODE_NORMAL && paddr1 > paddr0)
|
||||
{
|
||||
/* Now that the first block is playing,
|
||||
* configure the size of the subsequent blocks */
|
||||
// Now that the first block is playing, configure the size of the subsequent blocks
|
||||
size -= paddr1 - paddr0;
|
||||
CSND_SetBlock(chn, 1, paddr1, size);
|
||||
}
|
||||
@@ -102,11 +99,10 @@ Result csndPlaySound_custom(int chn, u32 flags, float vol, float pan,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void *ctr_csnd_audio_init(const char *device, unsigned rate, unsigned latency,
|
||||
unsigned block_frames,
|
||||
unsigned *new_rate)
|
||||
static void *ctr_csnd_audio_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
||||
ctr_csnd_audio_t *ctr = (ctr_csnd_audio_t*)calloc(1, sizeof(ctr_csnd_audio_t));
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!ctr)
|
||||
return NULL;
|
||||
@@ -115,7 +111,7 @@ static void *ctr_csnd_audio_init(const char *device, unsigned rate, unsigned lat
|
||||
(void)rate;
|
||||
(void)latency;
|
||||
|
||||
*new_rate = CTR_CSND_AUDIO_RATE;
|
||||
settings->audio.out_rate = CTR_CSND_AUDIO_RATE;
|
||||
|
||||
ctr->l = linearAlloc(CTR_CSND_AUDIO_SIZE);
|
||||
ctr->r = linearAlloc(CTR_CSND_AUDIO_SIZE);
|
||||
@@ -148,9 +144,7 @@ static void ctr_csnd_audio_free(void *data)
|
||||
{
|
||||
ctr_csnd_audio_t* ctr = (ctr_csnd_audio_t*)data;
|
||||
|
||||
#if 0
|
||||
csndExit();
|
||||
#endif
|
||||
// csndExit();
|
||||
CSND_SetPlayState(0x8, 0);
|
||||
CSND_SetPlayState(0x9, 0);
|
||||
csndExecCmds(false);
|
||||
@@ -164,23 +158,27 @@ static void ctr_csnd_audio_free(void *data)
|
||||
static ssize_t ctr_csnd_audio_write(void *data, const void *buf, size_t size)
|
||||
{
|
||||
int i;
|
||||
uint32_t samples_played = 0;
|
||||
uint64_t current_tick = 0;
|
||||
const uint16_t *src = buf;
|
||||
ctr_csnd_audio_t *ctr = (ctr_csnd_audio_t*)data;
|
||||
uint32_t samples_played = 0;
|
||||
uint64_t current_tick = 0;
|
||||
static struct retro_perf_counter ctraudio_f = {0};
|
||||
const uint16_t *src = buf;
|
||||
ctr_csnd_audio_t *ctr = (ctr_csnd_audio_t*)data;
|
||||
|
||||
(void)data;
|
||||
(void)buf;
|
||||
(void)samples_played;
|
||||
(void)current_tick;
|
||||
|
||||
rarch_perf_init(&ctraudio_f, "ctraudio_f");
|
||||
retro_perf_start(&ctraudio_f);
|
||||
|
||||
ctr_csnd_audio_update_playpos(ctr);
|
||||
|
||||
if((((ctr->playpos - ctr->pos) & CTR_CSND_AUDIO_COUNT_MASK) < (CTR_CSND_AUDIO_COUNT >> 2)) ||
|
||||
(((ctr->pos - ctr->playpos ) & CTR_CSND_AUDIO_COUNT_MASK) < (CTR_CSND_AUDIO_COUNT >> 4)) ||
|
||||
(((ctr->playpos - ctr->pos) & CTR_CSND_AUDIO_COUNT_MASK) < (size >> 2)))
|
||||
{
|
||||
if (ctr->nonblock)
|
||||
if (ctr->nonblocking)
|
||||
ctr->pos = (ctr->playpos + (CTR_CSND_AUDIO_COUNT >> 1)) & CTR_CSND_AUDIO_COUNT_MASK;
|
||||
else
|
||||
{
|
||||
@@ -189,7 +187,7 @@ static ssize_t ctr_csnd_audio_write(void *data, const void *buf, size_t size)
|
||||
retro_sleep(1);
|
||||
ctr_csnd_audio_update_playpos(ctr);
|
||||
}while (((ctr->playpos - ctr->pos) & CTR_CSND_AUDIO_COUNT_MASK) < (CTR_CSND_AUDIO_COUNT >> 1)
|
||||
|| (((ctr->pos - ctr->playpos) & CTR_CSND_AUDIO_COUNT_MASK) < (CTR_CSND_AUDIO_COUNT >> 4)));
|
||||
|| (((ctr->pos - ctr->playpos) & CTR_CSND_AUDIO_COUNT_MASK) < (CTR_CSND_AUDIO_COUNT >> 4)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,11 +202,13 @@ static ssize_t ctr_csnd_audio_write(void *data, const void *buf, size_t size)
|
||||
GSPGPU_FlushDataCache(ctr->l, CTR_CSND_AUDIO_SIZE);
|
||||
GSPGPU_FlushDataCache(ctr->r, CTR_CSND_AUDIO_SIZE);
|
||||
|
||||
retro_perf_stop(&ctraudio_f);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static bool ctr_csnd_audio_stop(void *data)
|
||||
{
|
||||
{
|
||||
ctr_csnd_audio_t* ctr = (ctr_csnd_audio_t*)data;
|
||||
|
||||
/* using SetPlayState would make tracking the playback
|
||||
@@ -237,13 +237,14 @@ static bool ctr_csnd_audio_alive(void *data)
|
||||
return ctr->playing;
|
||||
}
|
||||
|
||||
static bool ctr_csnd_audio_start(void *data, bool is_shutdown)
|
||||
static bool ctr_csnd_audio_start(void *data)
|
||||
{
|
||||
ctr_csnd_audio_t* ctr = (ctr_csnd_audio_t*)data;
|
||||
|
||||
/* Prevents restarting audio when the menu
|
||||
* is toggled off on shutdown */
|
||||
if (is_shutdown)
|
||||
|
||||
if (runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL))
|
||||
return true;
|
||||
|
||||
#if 0
|
||||
@@ -265,7 +266,7 @@ static void ctr_csnd_audio_set_nonblock_state(void *data, bool state)
|
||||
{
|
||||
ctr_csnd_audio_t* ctr = (ctr_csnd_audio_t*)data;
|
||||
if (ctr)
|
||||
ctr->nonblock = state;
|
||||
ctr->nonblocking = state;
|
||||
}
|
||||
|
||||
static bool ctr_csnd_audio_use_float(void *data)
|
||||
@@ -288,6 +289,7 @@ static size_t ctr_csnd_audio_buffer_size(void *data)
|
||||
return CTR_CSND_AUDIO_COUNT;
|
||||
}
|
||||
|
||||
|
||||
audio_driver_t audio_ctr_csnd = {
|
||||
ctr_csnd_audio_init,
|
||||
ctr_csnd_audio_write,
|
||||
@@ -298,8 +300,6 @@ audio_driver_t audio_ctr_csnd = {
|
||||
ctr_csnd_audio_free,
|
||||
ctr_csnd_audio_use_float,
|
||||
"csnd",
|
||||
NULL,
|
||||
NULL,
|
||||
ctr_csnd_audio_write_avail,
|
||||
ctr_csnd_audio_buffer_size
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2014-2017 - Ali Bouhlel
|
||||
* Copyright (C) 2014-2016 - Ali Bouhlel
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
@@ -15,14 +15,16 @@
|
||||
|
||||
#include <3ds.h>
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../audio_driver.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../performance.h"
|
||||
#include "../../runloop.h"
|
||||
#include "../../ctr/ctr_debug.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool nonblock;
|
||||
bool nonblocking;
|
||||
bool playing;
|
||||
int channel;
|
||||
ndspWaveBuf dsp_buf;
|
||||
@@ -35,11 +37,10 @@ typedef struct
|
||||
#define CTR_DSP_AUDIO_SIZE (CTR_DSP_AUDIO_COUNT * sizeof(int16_t) * 2)
|
||||
#define CTR_DSP_AUDIO_SIZE_MASK (CTR_DSP_AUDIO_SIZE - 1u)
|
||||
|
||||
static void *ctr_dsp_audio_init(const char *device, unsigned rate, unsigned latency,
|
||||
unsigned block_frames,
|
||||
unsigned *new_rate)
|
||||
static void *ctr_dsp_audio_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
||||
ctr_dsp_audio_t *ctr = NULL;
|
||||
ctr_dsp_audio_t *ctr;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
(void)device;
|
||||
(void)rate;
|
||||
@@ -53,12 +54,12 @@ static void *ctr_dsp_audio_init(const char *device, unsigned rate, unsigned late
|
||||
if (!ctr)
|
||||
return NULL;
|
||||
|
||||
*new_rate = 32730;
|
||||
settings->audio.out_rate = 32730;
|
||||
|
||||
ctr->channel = 0;
|
||||
|
||||
ndspSetOutputMode(NDSP_OUTPUT_STEREO);
|
||||
ndspSetClippingMode(NDSP_CLIP_SOFT); /* ?? */
|
||||
ndspSetClippingMode(NDSP_CLIP_SOFT); //??
|
||||
ndspSetOutputCount(1);
|
||||
ndspChnReset(ctr->channel);
|
||||
ndspChnSetFormat(ctr->channel, NDSP_FORMAT_STEREO_PCM16);
|
||||
@@ -94,15 +95,16 @@ static void ctr_dsp_audio_free(void *data)
|
||||
|
||||
static ssize_t ctr_dsp_audio_write(void *data, const void *buf, size_t size)
|
||||
{
|
||||
static struct retro_perf_counter ctraudio_dsp_f = {0};
|
||||
ctr_dsp_audio_t* ctr = (ctr_dsp_audio_t*)data;
|
||||
u32 pos;
|
||||
ctr_dsp_audio_t * ctr = (ctr_dsp_audio_t*)data;
|
||||
uint32_t sample_pos = ndspChnGetSamplePos(ctr->channel);
|
||||
uint32_t sample_pos = ndspChnGetSamplePos(ctr->channel);
|
||||
|
||||
if((((sample_pos - ctr->pos) & CTR_DSP_AUDIO_COUNT_MASK) < (CTR_DSP_AUDIO_COUNT >> 2)) ||
|
||||
(((ctr->pos - sample_pos ) & CTR_DSP_AUDIO_COUNT_MASK) < (CTR_DSP_AUDIO_COUNT >> 4)) ||
|
||||
(((sample_pos - ctr->pos) & CTR_DSP_AUDIO_COUNT_MASK) < (size >> 2)))
|
||||
{
|
||||
if (ctr->nonblock)
|
||||
if (ctr->nonblocking)
|
||||
ctr->pos = (sample_pos + (CTR_DSP_AUDIO_COUNT >> 1)) & CTR_DSP_AUDIO_COUNT_MASK;
|
||||
else
|
||||
{
|
||||
@@ -114,6 +116,9 @@ static ssize_t ctr_dsp_audio_write(void *data, const void *buf, size_t size)
|
||||
}
|
||||
}
|
||||
|
||||
rarch_perf_init(&ctraudio_dsp_f, "ctraudio_dsp_f");
|
||||
retro_perf_start(&ctraudio_dsp_f);
|
||||
|
||||
pos = ctr->pos << 2;
|
||||
|
||||
if((pos + size) > CTR_DSP_AUDIO_SIZE)
|
||||
@@ -135,6 +140,8 @@ static ssize_t ctr_dsp_audio_write(void *data, const void *buf, size_t size)
|
||||
ctr->pos += size >> 2;
|
||||
ctr->pos &= CTR_DSP_AUDIO_COUNT_MASK;
|
||||
|
||||
retro_perf_stop(&ctraudio_dsp_f);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
@@ -154,13 +161,14 @@ static bool ctr_dsp_audio_alive(void *data)
|
||||
return ctr->playing;
|
||||
}
|
||||
|
||||
static bool ctr_dsp_audio_start(void *data, bool is_shutdown)
|
||||
static bool ctr_dsp_audio_start(void *data)
|
||||
{
|
||||
ctr_dsp_audio_t* ctr = (ctr_dsp_audio_t*)data;
|
||||
|
||||
/* Prevents restarting audio when the menu
|
||||
* is toggled off on shutdown */
|
||||
if (is_shutdown)
|
||||
|
||||
if (runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL))
|
||||
return true;
|
||||
|
||||
ndspSetMasterVol(1.0);
|
||||
@@ -173,7 +181,7 @@ static void ctr_dsp_audio_set_nonblock_state(void *data, bool state)
|
||||
{
|
||||
ctr_dsp_audio_t* ctr = (ctr_dsp_audio_t*)data;
|
||||
if (ctr)
|
||||
ctr->nonblock = state;
|
||||
ctr->nonblocking = state;
|
||||
}
|
||||
|
||||
static bool ctr_dsp_audio_use_float(void *data)
|
||||
@@ -195,6 +203,7 @@ static size_t ctr_dsp_audio_buffer_size(void *data)
|
||||
return CTR_DSP_AUDIO_COUNT;
|
||||
}
|
||||
|
||||
|
||||
audio_driver_t audio_ctr_dsp = {
|
||||
ctr_dsp_audio_init,
|
||||
ctr_dsp_audio_write,
|
||||
@@ -205,8 +214,7 @@ audio_driver_t audio_ctr_dsp = {
|
||||
ctr_dsp_audio_free,
|
||||
ctr_dsp_audio_use_float,
|
||||
"dsp",
|
||||
NULL,
|
||||
NULL,
|
||||
ctr_dsp_audio_write_avail,
|
||||
ctr_dsp_audio_buffer_size
|
||||
};
|
||||
|
||||
Loaded 100 of 8993 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user