Compare commits

..
1 Commits
Author SHA1 Message Date
Brad Parker dd2e73d664 Qt: add fallback path for older versions 2018-09-17 23:12:08 -04:00
4559 changed files with 207728 additions and 673014 deletions

No files matched your search

-12
View File
@@ -1,12 +0,0 @@
# These are supported funding model platforms
github: [twinaphex]
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
+29 -29
View File
@@ -2,34 +2,34 @@
- 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
## 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]
- Compiler: [In case you are running local builds]
+1
View File
@@ -4,6 +4,7 @@
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]
+4 -26
View File
@@ -11,8 +11,6 @@
.tmp
.tmp.c
.tmp.cxx
.moc.h
.moc.cpp
config.log
/.project
/.externalToolBuilders/
@@ -55,6 +53,7 @@ DerivedData
apple/tmp
apple/*.mobileprovision
apple/RetroArch_iOS.xcodeproj/project.xcworkspace/*
menu/driverspzarch.c
/Cg/
/GL/
/SDL/
@@ -62,6 +61,7 @@ apple/RetroArch_iOS.xcodeproj/project.xcworkspace/*
/freetype2/
/ft2build.h
/iconv.h
/libxml2/
/phoenix/
/python/
/rsound.h
@@ -74,12 +74,6 @@ libretro-super
run.sh
convert_rumble.awk
*~
assets
info
content_image_history.lpl
saves
screenshots
# Wii U
*.depend
@@ -91,6 +85,7 @@ wiiu/wut/elf2rpl/elf2rpl
/pkg/wiiu/rpx
/wiiu-devel.properties
# 3ds
/.lst
*.3dsx
@@ -115,10 +110,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,6 +119,7 @@ wiiu/wut/elf2rpl/elf2rpl
/media/libretrodb/
pkg/apple/iOS/build/
pkg/apple/iOS/modules/
pkg/apple/build/
ui/drivers/qt/moc_*
ui/drivers/moc_*
@@ -171,17 +163,3 @@ 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
-8
View File
@@ -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
+48 -134
View File
@@ -1,161 +1,75 @@
# 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: 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++
- os: osx
osx_image: xcode8
addons:
apt:
packages:
- g++-mingw-w64-i686
- mingw-w64-i686-dev
script:
- xcodebuild -target RetroArch -configuration Release -project pkg/apple/RetroArch.xcodeproj
- os: osx
osx_image: xcode10.1
- CROSS_COMPILE=i686-w64-mingw32- CFLAGS="-D_WIN32_WINNT=0x0501" ./configure --disable-d3d8 --disable-d3d9 --disable-d3d10 --disable-d3d11 --disable-d3d12 && make HAVE_ZLIB=1 HAVE_BUILTINZLIB=1 HAVE_RPNG=1
- compiler: mingw-x64
addons:
apt:
packages:
- g++-mingw-w64-x86-64
- mingw-w64-x86-64-dev
script:
- brew update-reset
- CROSS_COMPILE=x86_64-w64-mingw32- CFLAGS="-D_WIN32_WINNT=0x0501" ./configure --disable-d3d8 --disable-d3d9 --disable-d3d10 --disable-d3d11 --disable-d3d12 && make HAVE_ZLIB=1 HAVE_BUILTINZLIB=1 HAVE_RPNG=1
- compiler: gcc
- compiler: clang
addons:
# Install a more recent clang than the default
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8
packages:
- clang-3.8
env: COMPILER_NAME=clang-3.8 CXX=clang++-3.8 CC=clang-3.8
- os: osx
osx_image: xcode7.3
script:
- xcodebuild -target RetroArch -configuration Release -project pkg/apple/RetroArch.xcodeproj
- os: osx
osx_image: xcode9.3
script:
- cd ~/
- brew install --force-bottle qt5
- xcodebuild -target RetroArchQt -configuration Release -project pkg/apple/RetroArch_Metal.xcodeproj
- git clone --depth=50 https://github.com/libretro/libretro-super
- cd libretro-super/travis
- ./build-retroarch-metal.sh
deploy:
skip_cleanup: true
provider: script
script: bash travis_metal_deploy.sh
script: cd ../retroarch; 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
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
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
- ./configure $ARGS
- |
if [ -n "$C89_BUILD" ]; then
make C89_BUILD=1
elif [ -n "$CXX_BUILD" ]; then
make CXX_BUILD=1
else
make
fi
- ./configure
- make
env:
global:
- ARGS=""
- MAKEFLAGS="-j2"
- secure: "qc91ReC3OlzSh2gFaSH6TYzC2qIQvgA2AZff6J13eaH8xijAhuMzttZ0rMQJ0DWCIhPeUb0kIzVyaGoe4MwPALzpw1C1AznIWiZJ53HN+hWCOcS/af7YVPk6HPySnwqrS+Wv3AIIvIKFV2mxv21F/JbT/N+pArlRrp904Xj+KPo="
addons:
apt:
packages:
- libsdl2-dev
- curl
- 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
- libusb-1.0-0-dev
- qtbase5-dev
- qtdeclarative5-dev
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-xenial
coverity_scan:
project:
name: "RetroArch"
@@ -165,4 +79,4 @@ addons:
build_command: "make"
branch_pattern: coverity_scan
notifications:
email: true
email: false
+121 -148
View File
@@ -1,155 +1,128 @@
{
"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}"
"configurations": [
{
"name": "Mac",
"includePath": [
"/usr/include",
"/usr/local/include",
"${workspaceRoot}",
"${workspaceRoot}/libretro-common/include"
],
"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}"
"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}"
],
"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}"
"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}"
],
"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}"
"defines": [
"_DEBUG",
"UNICODE"
],
"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}"
"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}"
],
"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
"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": ""
}
}
],
"version": 4
}
+2 -2
View File
@@ -13,7 +13,7 @@
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "c:\\msys64\\mingw64\\bin\\gdb.exe",
"setupCommands": [
@@ -24,7 +24,7 @@
}
]
},
{
{
"name": "(gdb) Attach",
"type": "cppdbg",
"request": "attach",
+2 -49
View File
@@ -7,7 +7,6 @@
"terminal.integrated.cursorBlinking": true,
"editor.tabSize": 3,
"editor.detectIndentation": false,
"editor.renderWhitespace": "all",
"editor.insertSpaces": true,
"files.associations": {
@@ -20,53 +19,7 @@
"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",
"menu_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",
"menu_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"
"ios": "c"
},
"C_Cpp.dimInactiveRegions": false,
}
}
+10 -47
View File
@@ -4,49 +4,12 @@
"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",
"taskName": "msys2-mingw64 build",
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
},
"isDefault": true },
"command": "./configure; make -j2",
"options": {
@@ -57,9 +20,9 @@
]
}
}
},
}
{
"label": "msys2-mingw64 build with debug symbols",
"taskName": "msys2-mingw64 build with debug symbols",
"type": "shell",
"group": "build",
@@ -73,9 +36,9 @@
]
}
}
},
}
{
"label": "msys2-mingw64 rebuild",
"taskName": "msys2-mingw64 rebuild",
"type": "shell",
"group": "build",
@@ -89,9 +52,9 @@
]
}
}
},
}
{
"label": "msys2-mingw64 clean",
"taskName": "msys2-mingw64 clean",
"type": "shell",
"group": "build",
@@ -105,9 +68,9 @@
]
}
}
},
}
{
"label": "msys2-mingw64 run",
"taskName": "msys2-mingw64 run",
"type": "shell",
"group": {
-96
View File
@@ -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
+14 -62
View File
@@ -5,13 +5,12 @@ acknowledge the following contributors:
1ch (L0sted)
Aaahh Ahh (Aaahh)
Aaron Oneal (aarononeal)
Adam Londero (alondero)
Adam Mechtley (amechtley)
Adolfo Ketzer (reztek)
AdrianoML
ajefr
Alberto Simon (asimonf)
Alcaro
Aleksey Samoilov (Sunderland93)
Alessandro Mangone (Vektor) (zevektor)
Alex Eckhart (alex34567)
Alex Folland (AlexFolland)
@@ -26,18 +25,15 @@ Amiga1200Gamer (amigagamer)
Andre Leiradella (leiradel)
Andrés (fr500)
Anthony J. Bentley (bentley)
Antonio Jose Ramos Marquez (psxdev)
AridRayne
ArnaudFaucher
Arto Vainiolehto (arakerlu)
asako (asakous)
Ash (QuarkTheAwesome)
Ashura (CoalaJoe)
Autechre64
Avton1
ayssia
barbudreadmon
bearoso
benutzer193
blackgur
Boris Timofeev (btimofeev)
bparker06
@@ -50,26 +46,24 @@ 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
cubtekki
cucholix
cudencuden
cxd4
dalter
Dan Weiss (Dwedit)
danieljg
Daniil Zhilin (LaserMoai)
Daniil Zhilin (GeneralFailer)
dankcushions
Danny Glover (DannyGlover)
Dave (freakdave)
Dave Leaver (danzel)
David Demelier (markand)
@@ -84,18 +78,14 @@ Diego Viola (diegoviola)
Diogo Barros (BlueKore)
DogParty
dor3k
driver1998
Dudu Akiva (duduke)
duganchen
dukemiller
duskgao
ekipan
Emmanuel Martin (daliaetnano)
endrift
ensra
erbridge
esoptron
Ethan Lee (flibitijibibo)
Exvat
Ezio-PS
Fabio (Oibaf66)
Fabio Ritrovato (Sephiroth87)
@@ -103,9 +93,7 @@ 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
@@ -113,7 +101,6 @@ Geoffrey Plitt (GeoffreyPlitt)
Glenn Hevey (hevey)
Googer
gouchi
grant2258
Gregor Richards (GregorR)
Gui Andrade (archshift)
Gustavo Maciel Dias Vieira (gmdvieira)
@@ -124,23 +111,17 @@ 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)
Hugo B. (777sha)
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)
@@ -153,7 +134,6 @@ 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)
@@ -161,14 +141,11 @@ 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
@@ -178,26 +155,19 @@ 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)
@@ -206,22 +176,17 @@ 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)
Nikita Vakhrushev (JesterIOS)
Nikola Kocic (nikola-kocic)
Niouby
nosh01
not6 (r-type)
@@ -235,17 +200,13 @@ orbea
OV2
pamapa
Paolo Bonzini (bonzini)
Paul McCarty (notabeatle)
Paul McCarty (a-shark)
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)
@@ -260,7 +221,6 @@ Saggi Mizrahi (ficoos)
SAKUJ0
Sam Pagenkopf (44100hertz)
Sam Stenvall (Jalle19)
Samuel P. (p-sam)
Scheiker
Sebastien Ronsse (sronsse)
Sergi Granell (xerpi)
@@ -269,28 +229,26 @@ sergio-br2 (sergiobenrocha2)
Seth Kingsley (sethk)
Shane Mouton (ismouton)
Shizeeg Unadequatov (shizeeg)
Skarsnik
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)
The Last Cabra (vanfanel)
thedax
theheroGAC
TheMrIron2
TheOfficialFloW
thiolliere
Thomas Lorblanchès (Zlika)
Toad King (ToadKing)
Tobias Jakobi (tobiasjakobi)
Tomáš Kelemen (ToKe79)
Torsten Paul (t-paul)
@@ -301,21 +259,15 @@ 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)
Yarsan Hoessain (hyarsan)
Yongwoon Cho (ssangkong)
yoshisuga
zeromus
zlice
Zoran Vuckovic (casdevel)
Ömercan Kömür (fpscan)
)";
+292 -769
View File
File diff suppressed because it is too large. Load diff
+57 -57
View File
@@ -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 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.
# 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.
-2482
View File
File diff suppressed because it is too large. Load diff
+23 -49
View File
@@ -1,6 +1,6 @@
HAVE_FILE_LOGGER=1
NEED_CXX_LINKER?=0
NEED_GOLD_LINKER?=0
HAVE_CC_RESAMPLER=1
NEED_CXX_LINKER=0
MISSING_DECLS =0
ifneq ($(C90_BUILD),)
@@ -16,47 +16,29 @@ include config.mk
TARGET = retroarch
OBJ :=
LIBS :=
DEF_FLAGS :=
ASFLAGS :=
DEFINES := -DHAVE_CONFIG_H -DRARCH_INTERNAL -D_FILE_OFFSET_BITS=64
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
OBJ :=
LIBS :=
DEFINES := -DHAVE_CONFIG_H -DRARCH_INTERNAL -D_FILE_OFFSET_BITS=64
DEFINES += -DGLOBAL_CONFIG_DIR='"$(GLOBAL_CONFIG_DIR)"'
ifneq ($(findstring BSD,$(OS)),)
DEF_FLAGS += -DBSD
CFLAGS += -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
CFLAGS += -march=i386
LDFLAGS += -lemu
endif
ifneq ($(findstring FPGA,$(OS)),)
DEFINES += -DHAVE_FPGA
endif
ifneq ($(findstring Win32,$(OS)),)
LDFLAGS += -static-libgcc -lwinmm
endif
@@ -93,19 +75,21 @@ ifneq ($(V),1)
Q := @
endif
ifeq ($(HAVE_DRMINGW), 1)
DEF_FLAGS += -DHAVE_DRMINGW
LDFLAGS += $(DRMINGW_LIBS)
ifeq ($(DEBUG), 1)
OPTIMIZE_FLAG = -O0 -g
DEFINES += -DDEBUG -D_DEBUG
else
OPTIMIZE_FLAG = -O3 -ffast-math
endif
ifneq ($(findstring Win32,$(OS)),)
LDFLAGS += -mwindows
endif
DEF_FLAGS += -Wall $(INCLUDE_DIRS) -I. -Ideps -Ideps/stb
CFLAGS += -Wall $(OPTIMIZE_FLAG) $(INCLUDE_DIRS) -I. -Ideps -Ideps/stb
CFLAGS += $(DEF_FLAGS)
CXXFLAGS += $(DEF_FLAGS) -std=c++11 -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)
@@ -180,7 +164,7 @@ 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) $<
$(Q)$(MOC) -o $(MOC_TMP) $<
$(foreach x,$(join $(addsuffix :,$(MOC_SRC)),$(MOC_HEADERS)),$(eval $x))
@@ -194,14 +178,10 @@ 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
retroarch: $(RARCH_OBJ)
@$(if $(Q), $(shell echo echo LD $@),)
@@ -263,18 +243,12 @@ install: $(TARGET)
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 \
@if test -d media/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; \
mkdir -p $(DESTDIR)$(ASSETS_DIR)/assets/xmb; \
mkdir -p $(DESTDIR)$(ASSETS_DIR)/assets/glui; \
cp -r media/assets/xmb/ $(DESTDIR)$(ASSETS_DIR)/assets; \
cp -r media/assets/glui/ $(DESTDIR)$(ASSETS_DIR)/assets; \
cp media/assets/COPYING $(DESTDIR)$(DOC_DIR)/COPYING.assets; \
echo "Asset copying done."; \
fi
+2 -2
View File
@@ -19,6 +19,6 @@ $(foreach x,$(join $(addsuffix :,$(MOC_SRC)),$(MOC_HEADERS)),$(eval $x))
generate: $(MOC_SRC)
@echo $(MOC_SRC)
print-%:
@echo '$*=$($*)'
@echo '$*=$($*)'
-49
View File
@@ -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
-53
View File
@@ -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
+806 -1101
View File
File diff suppressed because it is too large. Load diff
+16 -17
View File
@@ -51,9 +51,9 @@ DEFINES :=
ifeq ($(GRIFFIN_BUILD), 1)
OBJ += griffin/griffin.o
DEFINES += -DHAVE_GRIFFIN=1 -DHAVE_MENU -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
DEFINES += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DWANT_ZLIB
DEFINES += -DHAVE_NETWORKING -DHAVE_CHEEVOS -DHAVE_SOCKET_LEGACY -DHAVE_THREADS
#-DHAVE_SSL -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
else
HAVE_CC_RESAMPLER = 1
@@ -62,25 +62,23 @@ else
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_ZARCH = 0
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
HAVE_NETWORKING = 1
HAVE_CHEEVOS = 1
HAVE_SOCKET_LEGACY = 1
HAVE_THREADS = 1
HAVE_SSL = 1
include Makefile.common
CFLAGS += $(DEF_FLAGS)
BLACKLIST :=
BLACKLIST += input/input_overlay.o
BLACKLIST += tasks/task_overlay.o
@@ -106,6 +104,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,12 +130,7 @@ 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 -Ideps/libz -Ideps/7zip -Ideps/stb -Ilibretro-common/include
CFLAGS += -DRARCH_INTERNAL -DRARCH_CONSOLE
CFLAGS += -DHAVE_FILTERS_BUILTIN $(DEFINES)
@@ -148,6 +142,7 @@ 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)
@@ -156,6 +151,7 @@ else
LIBS += -lctru
endif
ifeq ($(BUILD_3DSX), 1)
TARGET_3DSX := $(TARGET).3dsx $(TARGET).smdh
endif
@@ -265,6 +261,7 @@ $(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 $(TARGET).3dsx
@@ -278,3 +275,5 @@ clean:
rm -f ctr/3dsx_custom_crt0.o
.PHONY: clean
+6 -3
View File
@@ -27,7 +27,6 @@ OBJ := ctr/ctr_system.o \
frontend/drivers/platform_null.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/string/stdstring.o \
libretro-common/lists/string_list.o \
@@ -40,7 +39,7 @@ OBJ := ctr/ctr_system.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 \
@@ -83,7 +82,7 @@ else
CFLAGS += -O3
endif
CFLAGS += -I. -Ideps/7zip -Ideps/stb -Ilibretro-common/include -Ilibretro-common/include/compat/zlib
CFLAGS += -I. -Ideps/libz -Ideps/7zip -Ideps/stb -Ilibretro-common/include
#CFLAGS += -DRARCH_INTERNAL
CFLAGS += -DRARCH_CONSOLE -DIS_SALAMANDER
@@ -95,8 +94,10 @@ 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
@@ -219,3 +220,5 @@ clean:
rm -f ctr/3dsx_custom_crt0.o
.PHONY: clean
+9 -12
View File
@@ -7,43 +7,40 @@ PTHREAD = 0
OS = Emscripten
OBJ :=
DEFINES := -DRARCH_INTERNAL -DHAVE_MAIN -s USE_PTHREADS=$(PTHREAD)
DEFINES += -DHAVE_FILTERS_BUILTIN
DEFINES += -DHAVE_OPENGL -DHAVE_OPENGLES -DHAVE_OPENGLES2 -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_EMSCRIPTEN = 1
HAVE_MENU = 1
HAVE_MENU_WIDGETS = 1
HAVE_RGUI = 1
HAVE_SDL = 0
HAVE_SDL2 = 0
HAVE_ZLIB = 1
WANT_ZLIB = 1
HAVE_SHADERPIPELINE = 1
HAVE_STATIC_VIDEO_FILTERS = 1
HAVE_STATIC_AUDIO_FILTERS = 1
HAVE_STB_FONT = 1
MEMORY = 536870912
PRECISE_F32 = 1
OBJDIR := obj-emscripten
ifneq ($(NATIVE_ZLIB),)
WANT_ZLIB = 0
endif
#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 USE_ZLIB=1 -s TOTAL_MEMORY=$(MEMORY) -s NO_EXIT_RUNTIME=0 -s FULL_ES2=1 \
LDFLAGS := -L. --no-heap-copy -s USE_ZLIB=1 -s TOTAL_MEMORY=$(MEMORY) -s NO_EXIT_RUNTIME=0 -s FULL_ES2=1 -s BINARYEN_TRAP_MODE=\"clamp\" \
-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
--js-library emscripten/library_rwebcam.js
ifneq ($(PTHREAD), 0)
LDFLAGS += -s USE_PTHREADS=$(PTHREAD) -s PTHREAD_POOL_SIZE=2
endif
@@ -59,7 +56,7 @@ endif
include Makefile.common
CFLAGS += $(DEF_FLAGS) -Ideps -Ideps/stb
CFLAGS += -Ideps/libz -Ideps -Ideps/stb
libretro = libretro_emscripten.bc
ifneq ($(V), 1)
+42 -110
View File
@@ -33,13 +33,13 @@ endif
ifeq ($(platform),)
platform = unix
ifeq ($(shell uname -s),)
ifeq ($(shell uname -a),)
platform = win
else ifneq ($(findstring MINGW,$(shell uname -s)),)
else ifneq ($(findstring MINGW,$(shell uname -a)),)
platform = win
else ifneq ($(findstring Darwin,$(shell uname -s)),)
else ifneq ($(findstring Darwin,$(shell uname -a)),)
platform = osx
else ifneq ($(findstring win,$(shell uname -s)),)
else ifneq ($(findstring win,$(shell uname -a)),)
platform = win
endif
endif
@@ -47,12 +47,12 @@ endif
# system platform
system_platform = unix
ifeq ($(shell uname -s),)
ifeq ($(shell uname -a),)
EXE_EXT = .exe
system_platform = win
else ifneq ($(findstring Darwin,$(shell uname -s)),)
else ifneq ($(findstring Darwin,$(shell uname -a)),)
system_platform = osx
else ifneq ($(findstring MINGW,$(shell uname -s)),)
else ifneq ($(findstring MINGW,$(shell uname -a)),)
system_platform = win
endif
@@ -77,13 +77,9 @@ endif
ifneq (,$(findstring msvc,$(platform)))
LIBS := $(WHOLE_START) $(WHOLE_END)
else
ifneq (,$(findstring unix,$(platform)))
LIBS := $(WHOLE_START) $(WHOLE_END)
else
LIBS := $(WHOLE_START) -lretro_$(platform) $(WHOLE_END)
endif
endif
libogc_platform :=
@@ -93,8 +89,6 @@ else ifeq ($(platform), wii)
libogc_platform := 1
endif
HAVE_MENU_WIDGETS := 1
# PS3
ifeq ($(platform), ps3)
#TODO
@@ -117,8 +111,8 @@ else ifeq ($(libogc_platform), 1)
EXT_TARGET := $(TARGET_NAME)_$(platform).dol
EXT_INTER_TARGET := $(TARGET_NAME)_$(platform).elf
INCLUDE += -I. -I$(DEVKITPRO)/libogc/include -Iwii/libogc/include
INCLUDE += -I. -I$(DEVKITPRO)/libogc/include -Ideps/libz -Iwii/libogc/include
ifeq ($(EXTERNAL_LIBOGC), 1)
CFLAGS += -DEXTERNAL_LIBOGC
CXXFLAGS += -DEXTERNAL_LIBOGC
@@ -164,6 +158,8 @@ else ifeq ($(libogc_platform), 1)
endif
endif
LIBS += -logc
ifeq ($(EXTERNAL_LIBOGC), 1)
LIBS += -lfat
endif
@@ -180,11 +176,8 @@ else ifeq ($(libogc_platform), 1)
endif
endif
LIBS += -logc
CFLAGS += -DGEKKO -U__INT32_TYPE__ -U __UINT32_TYPE__ -D__INT32_TYPE__=int
HAVE_AUDIOMIXER := 1
HAVE_RUNAHEAD := 1
HAVE_FILTERS_BUILTIN := 1
HAVE_THREADS := 1
@@ -194,14 +187,13 @@ else ifeq ($(libogc_platform), 1)
HAVE_RTGA := 1
HAVE_IBXM := 1
HAVE_OVERLAY := 1
HAVE_VIDEO_LAYOUT := 0
HAVE_ZLIB := 1
WANT_ZLIB := 1
HAVE_7ZIP := 1
RARCH_CONSOLE = 1
ifeq ($(platform), wii)
HAVE_AUDIOMIXER := 1
#HAVE_LANGEXTRA := 1
HAVE_LANGEXTRA := 1
HAVE_WIIUSB_HID := 1
HAVE_RARCH_EXEC := 1
HAVE_RSOUND := 1
@@ -258,7 +250,7 @@ else ifeq ($(platform), psp1)
HAVE_RBMP := 1
HAVE_RTGA := 1
HAVE_KERNEL_PRX := 1
#HAVE_LANGEXTRA := 1
HAVE_LANGEXTRA := 1
RARCH_CONSOLE = 1
ifeq ($(BUILD_PRX), 1)
@@ -273,11 +265,13 @@ else ifeq ($(platform), vita)
EXT_TARGET := $(TARGET_NAME)_$(platform).velf
EXT_INTER_TARGET := $(TARGET_NAME)_$(platform).elf
MACHDEP := -DVITA
WANT_ZLIB := 1
INCLUDE += -Ideps/libvita2d/include
INCLUDE += -Ideps/libz
PLATCFLAGS := -mfloat-abi=hard -fsingle-precision-constant \
-mword-relocations -fno-unwind-tables -fno-asynchronous-unwind-tables -ftree-vectorize -fno-optimize-sibling-calls
LIBS += -lSceDisplay_stub -lSceGxm_stub -lSceNet_stub -lSceNetCtl_stub\
-lSceSysmodule_stub -lSceCtrl_stub -lSceHid_stub -lSceTouch_stub -lSceAudio_stub -lSceFiber_stub\
-lSceSysmodule_stub -lSceCtrl_stub -lSceTouch_stub -lSceAudio_stub -lSceFiber_stub\
-lScePower_stub -lSceRtc_stub -lSceCommonDialog_stub -lScePgf_stub \
-lSceMotion_stub -lSceAppMgr_stub -lpng -lm -lc
@@ -310,7 +304,6 @@ else ifeq ($(platform), vita)
HAVE_VITA2D := 1
HAVE_NETWORKING := 1
HAVE_OVERLAY := 1
HAVE_VIDEO_LAYOUT := 0
HAVE_MATERIALUI := 1
HAVE_XMB := 1
HAVE_STB_FONT := 1
@@ -323,12 +316,11 @@ else ifeq ($(platform), windows_msvc6_x86)
HAVE_RBMP := 1
HAVE_RTGA := 1
HAVE_ZLIB := 1
WANT_ZLIB := 1
HAVE_7ZIP := 1
HAVE_NETWORKING := 0
HAVE_NETWORK_CMD := 1
HAVE_NETPLAYDISCOVERY := 1
HAVE_OVERLAY := 1
HAVE_VIDEO_LAYOUT := 0
HAVE_MATERIALUI := 1
HAVE_XMB := 1
HAVE_STB_FONT := 1
@@ -360,18 +352,16 @@ else ifeq ($(platform), windows_msvc6_x86)
export INCLUDE := $(INCLUDE);$(INETSDK)\Include;libretro-common\include;libretro-common\include\compat\msvc;gfx\include;deps;deps\stb
export LIB := $(LIB);$(INETSDK)\Lib
else ifeq ($(platform), windows_msvc2003_x86)
HAVE_GDI := 1
HAVE_RPNG := 1
HAVE_RJPEG := 1
HAVE_RBMP := 1
HAVE_RTGA := 1
HAVE_ZLIB := 1
WANT_ZLIB := 1
HAVE_7ZIP := 1
HAVE_NETWORKING := 1
HAVE_NETWORK_CMD := 1
HAVE_NETPLAYDISCOVERY := 1
HAVE_OVERLAY := 1
HAVE_VIDEO_LAYOUT := 0
HAVE_MATERIALUI := 1
HAVE_XMB := 1
HAVE_STB_FONT := 1
@@ -392,7 +382,7 @@ else ifeq ($(platform), windows_msvc2003_x86)
PLATCFLAGS += -D_WIN32 -DWINVER=0x0400 -D_WIN32_WINNT=0x0400 -D__STDC_CONSTANT_MACROS -D_MBCS -D_VC80_UPGRADE=0x0710
LDFLAGS += shell32.lib user32.lib gdi32.lib comdlg32.lib winmm.lib ole32.lib
PATH := $(shell IFS=$$'\n'; cygpath "$(VS71COMNTOOLS)../../Vc7/bin"):$(PATH)
PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS71COMNTOOLS)../IDE")
INCLUDE := $(shell IFS=$$'\n'; cygpath -w "$(VS71COMNTOOLS)../../Vc7/include")
@@ -408,18 +398,16 @@ else ifeq ($(platform), windows_msvc2003_x86)
export LIB := $(LIB);$(INETSDK)\Lib
endif
else ifeq ($(platform), windows_msvc2005_x86)
HAVE_GDI := 1
HAVE_RPNG := 1
HAVE_RJPEG := 1
HAVE_RBMP := 1
HAVE_RTGA := 1
HAVE_ZLIB := 1
WANT_ZLIB := 1
HAVE_7ZIP := 1
HAVE_NETWORKING := 1
HAVE_NETWORK_CMD := 1
HAVE_NETPLAYDISCOVERY := 1
HAVE_OVERLAY := 1
HAVE_VIDEO_LAYOUT := 0
HAVE_MATERIALUI := 1
HAVE_XMB := 1
HAVE_STB_FONT := 1
@@ -439,9 +427,9 @@ else ifeq ($(platform), windows_msvc2005_x86)
CXX = cl.exe
LD = link.exe
PLATCFLAGS += -D_WIN32 -D_WIN32_WINNT=0x0410 -D__STDC_CONSTANT_MACROS -D_MBCS -DHAVE_EASTEREGG -D__MMX__ -D__SSE__ -DHAVE_OPENGL -DHAVE_OPENGL1 -DHAVE_GLSL -DHAVE_SHADERPIPELINE -DHAVE_OZONE
LDFLAGS += shell32.lib user32.lib gdi32.lib comdlg32.lib winmm.lib ole32.lib msimg32.lib
PLATCFLAGS += -D_WIN32 -D_WIN32_WINNT=0x0410 -D__STDC_CONSTANT_MACROS -D_MBCS
LDFLAGS += shell32.lib user32.lib gdi32.lib comdlg32.lib winmm.lib ole32.lib
PATH := $(shell IFS=$$'\n'; cygpath "$(VS80COMNTOOLS)../../VC/bin"):$(PATH)
PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS80COMNTOOLS)../IDE")
INCLUDE := $(shell IFS=$$'\n'; cygpath -w "$(VS80COMNTOOLS)../../VC/include")
@@ -457,19 +445,16 @@ else ifeq ($(platform), windows_msvc2005_x86)
export LIB := $(LIB);$(INETSDK)\Lib
endif
else ifneq (,$(findstring windows_msvc2010,$(platform)))
HAVE_GDI := 1
HAVE_AUDIOMIXER := 1
HAVE_RPNG := 1
HAVE_RJPEG := 1
HAVE_RBMP := 1
HAVE_RTGA := 1
HAVE_ZLIB := 1
WANT_ZLIB := 1
HAVE_7ZIP := 1
HAVE_NETWORKING := 1
HAVE_NETWORK_CMD := 1
HAVE_NETPLAYDISCOVERY := 1
HAVE_OVERLAY := 1
HAVE_VIDEO_LAYOUT := 0
HAVE_MATERIALUI := 1
HAVE_XMB := 1
HAVE_STB_FONT := 1
@@ -481,7 +466,6 @@ else ifneq (,$(findstring windows_msvc2010,$(platform)))
HAVE_DYLIB := 1
HAVE_DYNAMIC := 1
HAVE_GRIFFIN_CPP := 1
HAVE_RUNAHEAD := 1
HAVE_DIRECTX ?= 1
EXT_TARGET := $(TARGET_NAME).exe
@@ -491,8 +475,8 @@ else ifneq (,$(findstring windows_msvc2010,$(platform)))
LD = link.exe
PLATCFLAGS += -D_WIN32 -D__STDC_CONSTANT_MACROS -D_MBCS
PLATCFLAGS += -D__i686__ -D__MMX__ -D__SSE__ -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_WINDOWS -DHAVE_CC_RESAMPLER -DHAVE_GL_SYNC -DHAVE_GLSL -DHAVE_IMAGEVIEWER -DHAVE_LANGEXTRA -DHAVE_OPENGL -DHAVE_SHADERPIPELINE -DHAVE_UPDATE_ASSETS -DWIN32 -DHAVE_EASTEREGG -DHAVE_CDROM
LDFLAGS += shell32.lib user32.lib gdi32.lib comdlg32.lib winmm.lib ole32.lib iphlpapi.lib msimg32.lib
PLATCFLAGS += -D__i686__ -D__SSE__ -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_WINDOWS -DHAVE_CC_RESAMPLER -DHAVE_GL_SYNC -DHAVE_GLSL -DHAVE_IMAGEVIEWER -DHAVE_LANGEXTRA -DHAVE_OPENGL -DHAVE_SHADERPIPELINE -DHAVE_UPDATE_ASSETS -DWIN32
LDFLAGS += shell32.lib user32.lib gdi32.lib comdlg32.lib winmm.lib ole32.lib iphlpapi.lib
PlatformSuffix = $(subst windows_msvc2010_,,$(platform))
@@ -531,19 +515,16 @@ else ifneq (,$(findstring windows_msvc2010,$(platform)))
export LIB := $(LIB);$(WindowsSdkDir)\$(PlatLib)
endif
else ifneq (,$(findstring windows_msvc2012,$(platform)))
HAVE_GDI := 1
HAVE_AUDIOMIXER := 1
HAVE_RPNG := 1
HAVE_RJPEG := 1
HAVE_RBMP := 1
HAVE_RTGA := 1
HAVE_ZLIB := 1
WANT_ZLIB := 1
HAVE_7ZIP := 1
HAVE_NETWORKING := 1
HAVE_NETWORK_CMD := 1
HAVE_NETPLAYDISCOVERY := 1
HAVE_OVERLAY := 1
HAVE_VIDEO_LAYOUT := 0
HAVE_MATERIALUI := 1
HAVE_XMB := 1
HAVE_STB_FONT := 1
@@ -555,7 +536,6 @@ else ifneq (,$(findstring windows_msvc2012,$(platform)))
HAVE_DYLIB := 1
HAVE_DYNAMIC := 1
HAVE_GRIFFIN_CPP := 1
HAVE_RUNAHEAD := 1
HAVE_DIRECTX ?= 1
EXT_TARGET := $(TARGET_NAME).exe
@@ -565,7 +545,7 @@ else ifneq (,$(findstring windows_msvc2012,$(platform)))
LD = link.exe
PLATCFLAGS += -D_WIN32 -D__STDC_CONSTANT_MACROS -D_MBCS
PLATCFLAGS += -D__i686__ -D__MMX__ -D__SSE__ -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_WINDOWS -DHAVE_CC_RESAMPLER -DHAVE_GL_SYNC -DHAVE_GLSL -DHAVE_IMAGEVIEWER -DHAVE_LANGEXTRA -DHAVE_OPENGL -DHAVE_SHADERPIPELINE -DHAVE_UPDATE_ASSETS -DWIN32 -DHAVE_EASTEREGG -DHAVE_CDROM
PLATCFLAGS += -D__i686__ -D__SSE__ -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_WINDOWS -DHAVE_CC_RESAMPLER -DHAVE_GL_SYNC -DHAVE_GLSL -DHAVE_IMAGEVIEWER -DHAVE_LANGEXTRA -DHAVE_OPENGL -DHAVE_SHADERPIPELINE -DHAVE_UPDATE_ASSETS -DWIN32
LDFLAGS += shell32.lib user32.lib gdi32.lib comdlg32.lib winmm.lib ole32.lib iphlpapi.lib
PlatformSuffix = $(subst windows_msvc2012_,,$(platform))
@@ -609,19 +589,16 @@ else ifneq (,$(findstring windows_msvc2012,$(platform)))
export LIB := $(LIB);$(WindowsSdkDir)\$(PlatLib)
endif
else ifneq (,$(findstring windows_msvc2013,$(platform)))
HAVE_GDI := 1
HAVE_AUDIOMIXER := 1
HAVE_RPNG := 1
HAVE_RJPEG := 1
HAVE_RBMP := 1
HAVE_RTGA := 1
HAVE_ZLIB := 1
WANT_ZLIB := 1
HAVE_7ZIP := 1
HAVE_NETWORKING := 1
HAVE_NETWORK_CMD := 1
HAVE_NETPLAYDISCOVERY := 1
HAVE_OVERLAY := 1
HAVE_VIDEO_LAYOUT := 0
HAVE_MATERIALUI := 1
HAVE_XMB := 1
HAVE_STB_FONT := 1
@@ -633,7 +610,6 @@ else ifneq (,$(findstring windows_msvc2013,$(platform)))
HAVE_DYLIB := 1
HAVE_DYNAMIC := 1
HAVE_GRIFFIN_CPP := 1
HAVE_RUNAHEAD := 1
HAVE_DIRECTX ?= 1
EXT_TARGET := $(TARGET_NAME).exe
@@ -643,7 +619,7 @@ else ifneq (,$(findstring windows_msvc2013,$(platform)))
LD = link.exe
PLATCFLAGS += -D_WIN32 -D__STDC_CONSTANT_MACROS -D_MBCS
PLATCFLAGS += -D__i686__ -D__MMX__ -D__SSE__ -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_WINDOWS -DHAVE_CC_RESAMPLER -DHAVE_GL_SYNC -DHAVE_GLSL -DHAVE_IMAGEVIEWER -DHAVE_LANGEXTRA -DHAVE_OPENGL -DHAVE_SHADERPIPELINE -DHAVE_UPDATE_ASSETS -DWIN32 -DHAVE_EASTEREGG -DHAVE_CDROM
PLATCFLAGS += -D__i686__ -D__SSE__ -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_WINDOWS -DHAVE_CC_RESAMPLER -DHAVE_GL_SYNC -DHAVE_GLSL -DHAVE_IMAGEVIEWER -DHAVE_LANGEXTRA -DHAVE_OPENGL -DHAVE_SHADERPIPELINE -DHAVE_UPDATE_ASSETS -DWIN32
LDFLAGS += shell32.lib user32.lib gdi32.lib comdlg32.lib winmm.lib ole32.lib iphlpapi.lib
PlatformSuffix = $(subst windows_msvc2013_,,$(platform))
@@ -687,19 +663,16 @@ else ifneq (,$(findstring windows_msvc2013,$(platform)))
export LIB := $(LIB);$(WindowsSdkDir)\$(PlatLib)
endif
else ifneq (,$(findstring windows_msvc2015,$(platform)))
HAVE_GDI := 1
HAVE_AUDIOMIXER := 1
HAVE_RPNG := 1
HAVE_RJPEG := 1
HAVE_RBMP := 1
HAVE_RTGA := 1
HAVE_ZLIB := 1
WANT_ZLIB := 1
HAVE_7ZIP := 1
HAVE_NETWORKING := 1
HAVE_NETWORK_CMD := 1
HAVE_NETPLAYDISCOVERY := 1
HAVE_OVERLAY := 1
HAVE_VIDEO_LAYOUT := 0
HAVE_MATERIALUI := 1
HAVE_XMB := 1
HAVE_STB_FONT := 1
@@ -711,7 +684,6 @@ else ifneq (,$(findstring windows_msvc2015,$(platform)))
HAVE_DYLIB := 1
HAVE_DYNAMIC := 1
HAVE_GRIFFIN_CPP := 1
HAVE_RUNAHEAD := 1
HAVE_DIRECTX ?= 1
EXT_TARGET := $(TARGET_NAME).exe
@@ -720,9 +692,8 @@ else ifneq (,$(findstring windows_msvc2015,$(platform)))
CXX = cl.exe
LD = link.exe
PLATCFLAGS += -utf-8
PLATCFLAGS += -D_WIN32 -D__STDC_CONSTANT_MACROS -D_MBCS
PLATCFLAGS += -D__i686__ -D__MMX__ -D__SSE__ -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_WINDOWS -DHAVE_CC_RESAMPLER -DHAVE_GL_SYNC -DHAVE_GLSL -DHAVE_IMAGEVIEWER -DHAVE_LANGEXTRA -DHAVE_OPENGL -DHAVE_SHADERPIPELINE -DHAVE_UPDATE_ASSETS -DWIN32 -DHAVE_EASTEREGG -DHAVE_CDROM
PLATCFLAGS += -D__i686__ -D__SSE__ -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_WINDOWS -DHAVE_CC_RESAMPLER -DHAVE_GL_SYNC -DHAVE_GLSL -DHAVE_IMAGEVIEWER -DHAVE_LANGEXTRA -DHAVE_OPENGL -DHAVE_SHADERPIPELINE -DHAVE_UPDATE_ASSETS -DWIN32
LDFLAGS += shell32.lib user32.lib gdi32.lib comdlg32.lib winmm.lib ole32.lib iphlpapi.lib
PlatformSuffix = $(subst windows_msvc2015_,,$(platform))
@@ -780,46 +751,15 @@ else ifneq (,$(findstring windows_msvc2015,$(platform)))
export INCLUDE := $(INCLUDE);libretro-common\include;libretro-common\include\compat\msvc;gfx\include;deps;deps\stb
export LIB := $(LIB)
endif
else ifneq (,$(findstring unix,$(platform)))
HAVE_AUDIOMIXER := 1
HAVE_RPNG := 1
HAVE_RJPEG := 1
HAVE_RBMP := 1
HAVE_RTGA := 1
HAVE_ZLIB := 1
HAVE_7ZIP := 1
HAVE_NETWORKING := 1
HAVE_NETWORK_CMD := 1
HAVE_NETPLAYDISCOVERY := 1
HAVE_OVERLAY := 1
HAVE_VIDEO_LAYOUT := 0
HAVE_MATERIALUI := 1
HAVE_XMB := 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_GRIFFIN_CPP := 1
WANT_GLSLANG := 1
PLATCFLAGS += -DHAVE_EASTEREGG -D__MMX__ -D__SSE__ -DHAVE_OPENGL -DHAVE_OPENGL1 -DHAVE_GLSL -DHAVE_SHADERPIPELINE -DHAVE_OZONE -DHAVE_CC_RESAMPLER -DHAVE_CHEEVOS -DRC_DISABLE_LUA -DHAVE_FBO -DHAVE_GL_SYNC -DHAVE_SLANG -DHAVE_GLSLANG -DHAVE_IMAGEVIEWER -DHAVE_LANGEXTRA -DHAVE_RUNAHEAD -DHAVE_MENU_WIDGETS -DHAVE_SPIRV_CROSS -DHAVE_STB_FONT -DHAVE_UPDATE_ASSETS -DHAVE_VULKAN -DHAVE_XMB -DRARCH_INTERNAL -DWANT_GLSLANG -DHAVE_X11 -DHAVE_XCB -DHAVE_UDEV -DHAVE_PULSE
EXT_TARGET := $(TARGET_NAME)
EXT_INTER_TARGET := $(TARGET_NAME)
INCLUDE += -Ilibretro-common/include -Igfx/include -Ideps -Ideps/stb -Ideps/rcheevos/include -Ideps/SPIRV-Cross -Ideps/glslang -I.
LIBS += -ldl -lm -lpthread -lGL -ludev -lpulse -lX11 -lX11-xcb -lXxf86vm
endif
ifneq (,$(findstring msvc,$(platform)))
CFLAGS += -W3 $(MACHDEP) $(PLATCFLAGS)
CFLAGS += -W2 $(MACHDEP) $(PLATCFLAGS)
else
CFLAGS += -Wall -std=gnu99 $(MACHDEP) $(PLATCFLAGS) $(INCLUDE)
INCLUDE += -I./libretro-common/include \
-Ideps \
-Ideps/stb
-Ideps/stb
endif
OBJ = griffin/griffin.o $(PLATOBJS)
@@ -879,7 +819,10 @@ endif
ifeq ($(HAVE_ZLIB), 1)
CFLAGS += -DHAVE_ZLIB
CFLAGS += -I./libretro-common/include/compat/zlib
endif
ifeq ($(WANT_ZLIB), 1)
CFLAGS += -DWANT_ZLIB
endif
ifeq ($(HAVE_RPNG), 1)
@@ -906,26 +849,14 @@ ifeq ($(HAVE_7ZIP), 1)
CFLAGS += -DHAVE_7ZIP
endif
ifeq ($(HAVE_AUDIOMIXER), 1)
CFLAGS += -DHAVE_AUDIOMIXER
endif
ifeq ($(HAVE_OVERLAY), 1)
CFLAGS += -DHAVE_OVERLAY
endif
ifeq ($(HAVE_VIDEO_LAYOUT), 1)
CFLAGS += -DHAVE_VIDEO_LAYOUT
endif
ifeq ($(HAVE_NETWORKING), 1)
CFLAGS += -DHAVE_NETWORKING
endif
ifeq ($(HAVE_NETPLAYDISCOVERY), 1)
CFLAGS += -DHAVE_NETPLAYDISCOVERY
endif
ifeq ($(RARCH_CONSOLE), 1)
CFLAGS += -DRARCH_CONSOLE
endif
@@ -1031,8 +962,8 @@ ifneq (,$(findstring msvc,$(platform)))
LINKOUT = -out:
LINK = link.exe
else
OBJOUT = -o
LINKOUT = -o
OBJOUT = -o
LINKOUT = -o
LINK = $(CXX)
endif
@@ -1132,6 +1063,7 @@ overlays-checkout:
$(GIT) clone git://github.com/libretro/common-overlays.git $(OVERLAY_DIR); \
fi
clean:
rm -f $(EXT_TARGET)
rm -f $(EXT_INTER_TARGET)
+21 -59
View File
@@ -1,5 +1,3 @@
include version.all
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
@@ -17,62 +15,43 @@ DEBUG ?= 0
WHOLE_ARCHIVE_LINK = 0
GRIFFIN_BUILD = 0
OBJ :=
OBJ :=
DEFINES := -D__SWITCH__=1 -U__linux__ -U__linux -DGLM_FORCE_PURE=1 -DRARCH_CONSOLE -DRARCH_INTERNAL -DGLOBAL_CONFIG_DIR='"/switch"' -DHAVE_STB_VORBIS
# For threading we need to overwrite some vars with global defines because devkitPro's includes
# make it hard for us. This works for the pthread wrapper
DEFINES_THREAD := -Dpthread_t=Thread -Dpthread_mutex_t=Mutex -Dpthread_mutexattr_t='void*' -Dpthread_attr_t=int -Dpthread_cond_t=CondVar -Dpthread_condattr_t='int' -D_SYS__PTHREADTYPES_H_
DEFINES := -U__linux__ -U__linux -DRARCH_INTERNAL -DGLOBAL_CONFIG_DIR='"/switch"' $(DEFINES_THREAD)
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_RGUI = 1
HAVE_ZLIB = 1
HAVE_BUILTINZLIB = 1
HAVE_LIBRETRODB = 1
HAVE_ZARCH = 0
HAVE_MATERIALUI = 0
HAVE_XMB = 0
HAVE_STATIC_VIDEO_FILTERS = 1
HAVE_STATIC_AUDIO_FILTERS = 1
HAVE_MENU = 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_OVERLAY = 0
HAVE_THREADS = 1
HAVE_PTHREADS = 1
HAVE_FREETYPE = 0
HAVE_SWITCH = 1
HAVE_LIBNX = 1
HAVE_OPENGL = 1
HAVE_LANGEXTRA = 1
HAVE_MENU_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 :=
#BLACKLIST += input/input_overlay.o
#BLACKLIST += tasks/task_overlay.o
OBJ := $(filter-out $(BLACKLIST),$(OBJ))
@@ -105,37 +84,26 @@ EXEFS_SRC := exefs_src
#ROMFS := switch/romfs
APP_TITLE := RetroArch
APP_VERSION := $(RARCH_VERSION)
APP_VERSION := 1.0.0
APP_AUTHOR := libretro Team
APP_ICON := pkg/libnx/retroarch.jpg
NO_ICON := 1
#---------------------------------------------------------------------------------
# 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 := -g -Wall -O3 -ffast-math -ffunction-sections \
$(ARCH) $(DEFINES) -Ideps -Ideps/libz -Ilibretro-common/include -Ideps/stb -I$(LIBNX)/include -include $(LIBNX)/include/switch.h #$(shell $(DEVKITPRO)/portlibs/switch/bin/freetype-config --cflags)
CFLAGS += $(INCLUDE) -DSWITCH=1 -DHAVE_LIBNX=1 -DNXLINK=1 -DHAVE_SHADERPIPELINE -DHAVE_UPDATE_ASSETS -DHAVE_STB_FONT #-DHAVE_FREETYPE
ifeq ($(strip $(HAVE_STATIC_DUMMY)),1)
CFLAGS += -DHAVE_STATIC_DUMMY=1
endif
CFLAGS += $(INCLUDE) -DSWITCH=1 -DHAVE_LIBNX=1 -DNXLINK=1
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 -lm
ifeq ($(HAVE_OPENGL), 1)
LIBS := -lEGL -lglapi -ldrm_nouveau $(LIBS)
endif
LIBS := -lnx -lm -lstdc++ -lbz2 -lpng -lz
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
@@ -177,12 +145,7 @@ else
endif
#---------------------------------------------------------------------------------
export OFILES := $(OBJ)
ifeq ($(strip $(HAVE_STATIC_DUMMY)),)
OFILES += libretro_libnx.a
endif
export OFILES := $(OBJ) libretro_switch.a
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
@@ -222,8 +185,7 @@ ifneq ($(ROMFS),)
export NROFLAGS += --romfsdir=$(CURDIR)/$(ROMFS)
endif
DEPENDS_TMP := $(OFILES:.o=.d)
DEPENDS := $(filter-out libretro_libnx.a,$(DEPENDS_TMP))
DEPENDS := $(OFILES:.o=.d)
.PHONY: clean all
@@ -245,7 +207,7 @@ endif
$(OUTPUT).elf : $(OBJ)
clean:
rm -f $(DEPENDS) $(OBJ) $(OUTPUT).pfs0 $(OUTPUT).nro $(OUTPUT).elf
rm -f $(OBJ) $(OUTPUT).pfs0 $(OUTPUT).nro $(OUTPUT).elf
#---------------------------------------------------------------------------------
# you need a rule like this for each extension you use as binary data
+6 -2
View File
@@ -29,7 +29,7 @@ ifneq (,$(findstring Darwin,$(UNAME_S)))
endif
#---------------------------------------------------------------------------------
# path to tools
# path to tools
#---------------------------------------------------------------------------------
export PORTLIBS := $(DEVKITPRO)/portlibs/ppc
export PATH := $(DEVKITPPC)/bin:$(PORTLIBS)/bin:$(PATH)
@@ -45,6 +45,7 @@ export CXX := $(PREFIX)g++
export AR := $(PREFIX)ar
export OBJCOPY := $(PREFIX)objcopy
ISVC=$(or $(VCBUILDHELPER_COMMAND),$(MSBUILDEXTENSIONSPATH32),$(MSBUILDEXTENSIONSPATH))
#---------------------------------------------------------------------------------
@@ -56,7 +57,7 @@ ISVC=$(or $(VCBUILDHELPER_COMMAND),$(MSBUILDEXTENSIONSPATH32),$(MSBUILDEXTENSION
#---------------------------------------------------------------------------------
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
#---------------------------------------------------------------------------------
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
@@ -130,6 +131,7 @@ INCLUDES := $(DEFINCS) \
MACHDEP := -DBIGENDIAN -DGEKKO -mcpu=750 -meabi -msdata=eabi -mhard-float -ffunction-sections -fdata-sections
ifeq ($(PLATFORM),wii)
MACHDEP += -DHW_RVL
endif
@@ -157,6 +159,7 @@ VPATH := $(LWIPDIR) \
$(LIBWIIKEYB) \
$(STUBSDIR)
#---------------------------------------------------------------------------------
SOURCES_LWIP := $(LWIPDIR)/network.c \
$(LWIPDIR)/netio.c \
@@ -261,6 +264,7 @@ SOURCES_OGC_ASM := $(OGCDIR)/cache_asm.S \
$(OGCDIR)/system_asm.S \
$(OGCDIR)/video_asm.S
ifneq ($(BUILD_LITE), 1)
SOURCES_OGC += $(OGCDIR)/dvd.c
endif
+13 -21
View File
@@ -7,11 +7,11 @@ ARCH = amd64
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
@@ -20,8 +20,6 @@ HAVE_D3D11 := 1
HAVE_D3D12 := 1
HAVE_CG := 1
HAVE_OPENGL := 1
HAVE_OPENGL1 := 1
HAVE_MENU_WIDGETS := 1
HAVE_VULKAN := 1
HAVE_XAUDIO := 1
HAVE_XINPUT := 1
@@ -31,7 +29,7 @@ HAVE_WINMM := 1
HAVE_RPNG := 1
HAVE_ZLIB := 1
HAVE_MENU := 1
WANT_ZLIB := 1
HAVE_RGUI := 1
HAVE_XMB := 1
HAVE_MATERIALUI := 1
@@ -54,29 +52,14 @@ 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))
CFLAGS := $(filter-out -Wno-unknown-pragmas,$(CFLAGS))
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))
@@ -107,12 +90,14 @@ 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)
@@ -137,7 +122,7 @@ 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 += -utf-8
#FLAGS += -source-charset:utf-8
CXXFLAGS += $(CFLAGS) -TP -EHsc
@@ -159,6 +144,7 @@ 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
@@ -169,6 +155,7 @@ else
FLAGS += -MD
endif
ifeq ($(DEBUG),1)
BUILD_DIR := $(BUILD_DIR)-debug
endif
@@ -183,6 +170,7 @@ ifneq ($(V), 1)
Q := @
endif
ifeq ($(GRIFFIN_BUILD), 1)
OBJ := griffin/griffin.o griffin/griffin_cpp.o
DEFINES += -DHAVE_GRIFFIN -DUSE_MATH_DEFINES
@@ -200,6 +188,9 @@ 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))
@@ -207,6 +198,7 @@ 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))
+62
View File
@@ -0,0 +1,62 @@
# Hakchi version added to ease confusion amongst Hakchi community due to messy past...
#
# Make sure you have readelf installed (sudo apt-get install readelf) to patch the binary
# Might not be needed for your build but it's a useful tool and for safety it should be
# run anyway to ensure the SDL2 link isn't broken...
HAKCHI_VER := Hakchi_Retroarch_Neo_v1_7_3b
HAKCHI_NAME := "Hakchi RetroArch 'Neo' v1.7.3b
MOD_CREATOR := TheOtherGuys
MOD_CATEGORY := RetroArch
HAKCHI_DIR := hakchi
TARGET := retroarch
GIT_COMMIT := $(shell echo "`git rev-parse --short HEAD``git diff-index --quiet HEAD -- || echo '-dirty'`")
all: $(TARGET)
retroarch:
readelf -v #Check if you have readelf installed... (sudo apt-get install readelf)
./configure --host=arm-linux-gnueabihf --disable-freetype --enable-opengles --enable-udev --enable-alsa --enable-neon --enable-floathard
make -f Makefile -j HAVE_HAKCHI=1
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...
#/usr/bin/arm-linux-gnueabihf-strip retroarch
rm -f $(HAKCHI_DIR)/bin/retroarch
cp retroarch $(HAKCHI_DIR)/bin/retroarch
echo $$(echo "Built by: " $$USER @ $$(date) \\\\\\ Git Commit: $(GIT_COMMIT)) > $(HAKCHI_DIR)/etc/libretro/retroarch_version
cp $(HAKCHI_DIR)/readme.md $(HAKCHI_DIR)/readme_COPY.md
printf "%s\n" \
"---" \
"Name: $(HAKCHI_VER)" \
"Creator: $(MOD_CREATOR)" \
"Category: $(MOD_CATEGORY)" \
"Version: $(HAKCHI_VER)" \
"Built on: $(shell date)" \
"Git commit: $(GIT_COMMIT)" \
"---" > $(HAKCHI_DIR)/readme.md
cat $(HAKCHI_DIR)/readme_COPY.md >> $(HAKCHI_DIR)/readme.md
rm $(HAKCHI_DIR)/readme_COPY.md
@echo "** BUILDING HAKCHI $(HAKCHI_VER) HMOD PACKAGE **"
cd $(HAKCHI_DIR)/; tar -czvf "$(HAKCHI_VER).hmod" *
mv $(HAKCHI_DIR)/$(HAKCHI_VER).hmod .
@echo "** BUILT HAKCHI $(HAKCHI_VER) HMOD PACKAGE **"
clean:
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
rm -f $(HAKCHI_DIR)/bin/retroarch
rm -f $(HAKCHI_VER).hmod
rm -f $(HAKCHI_DIR)/etc/libretro/retroarch_version
+1 -1
View File
@@ -15,7 +15,7 @@ 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 += -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__ -DHAVE_OPENGL -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DHAVE_GLSL -DHAVE_DYNAMIC -DHAVE_RPNG -DHAVE_RJPEG -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
-164
View File
@@ -1,164 +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
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_MENU_WIDGETS := 1
HAVE_GLSL := 1
HAVE_OPENGLES := 1
HAVE_NETWORKING := 0
HAVE_SOCKET_LEGACY := 0
HAVE_MENU := 1
HAVE_MENU_COMMON := 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
View File
@@ -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
View File
@@ -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_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)
+7 -11
View File
@@ -33,13 +33,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/libz -Ilibretro-common/include -Ideps -Ideps/stb
# system platform
system_platform = unix
@@ -69,8 +63,7 @@ endif
PPU_SRCS = griffin/griffin.c
#DEFINES += -DHAVE_VIDEO_LAYOUT
DEFINES += -DHAVE_MENU -DHAVE_MENU_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_MENU -DHAVE_RGUI -DHAVE_XMB -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
ifeq ($(DEX_BUILD), 1)
DEFINES += -DDEX_BUILD
@@ -94,6 +87,9 @@ 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)
@@ -116,7 +112,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_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_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 -DWANT_ZLIB -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
#DEFINES += -DHAVE_IMAGEVIEWER
@@ -163,7 +159,7 @@ create-core:
create-npdrm-salamander:
$(MAKE_FSELF_NPDRM) $(SALAMANDER_TARGET) $(EBOOT_PATH)
create-salamander:
$(MAKE_SELF) $(SALAMANDER_TARGET) $(EBOOT_PATH) $(CONTENT_ID_FULL)
+5 -3
View File
@@ -85,6 +85,9 @@ 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)
@@ -107,8 +110,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_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_RSOUND -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -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
ifeq ($(DEBUG), 1)
PPU_OPTIMIZE_LV := -O0 -g
@@ -153,7 +155,7 @@ create-core:
create-npdrm-salamander:
$(MAKE_FSELF_NPDRM) $(SALAMANDER_TARGET) $(EBOOT_PATH)
create-salamander:
$(MAKE_SELF) $(SALAMANDER_TARGET) $(EBOOT_PATH) $(CONTENT_ID_FULL)
+90 -91
View File
@@ -1,91 +1,90 @@
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 \
frontend/drivers/platform_null.c \
libretro-common/file/file_path.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 = 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 -Ideps/libz
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 \
frontend/drivers/platform_null.c \
libretro-common/file/file_path.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/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
+4 -6
View File
@@ -17,7 +17,7 @@ ELF_TARGET := retroarch_psl1ght.elf
EBOOT_PATH = pkg/ps3/USRDIR/EBOOT.BIN
CORE_PATH = pkg/ps3/USRDIR/cores/CORE.SELF
INCLUDE := -I. -I$(PS3DEV)/ppu/include -Ips3/gcmgl/include/export -Ips3/include -Ideps -Ideps/stb -Ilibretro-common/include/compat/zlib
INCLUDE := -I. -I$(PS3DEV)/ppu/include -Ideps/libz -Ips3/gcmgl/include/export -Ips3/include -Ideps -Ideps/stb
LIBDIRS := -L$(PS3DEV)/ppu/lib -L$(PS3DEV)/portlibs/ppu/lib -L.
MACHDEP := -D__CELLOS_LV2__ -D__PSL1GHT__
@@ -89,17 +89,14 @@ ifeq ($(HAVE_FILE_LOGGER), 1)
CFLAGS += -DHAVE_FILE_LOGGER
endif
SHARED_FLAGS :=
#SHARED_FLAGS += -DHAVE_VIDEO_LAYOUT
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_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
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_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_MOUSE -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -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
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
@@ -131,3 +128,4 @@ clean:
rm -f $(OBJ)
.PHONY: clean
+3 -2
View File
@@ -21,11 +21,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
INCDIR = deps deps/stb deps/libz deps/7zip deps/pthreads deps/pthreads/platform/psp deps/pthreads/platform/helper libretro-common/include
CFLAGS = $(OPTIMIZE_LV) -G0 -std=gnu99 -ffast-math -fsingle-precision-constant
ASFLAGS = $(CFLAGS)
RARCH_DEFINES = -DPSP -D_MIPS_ARCH_ALLEGREX -DHAVE_LANGEXTRA -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_GRIFFIN=1 -DRARCH_INTERNAL -DRARCH_CONSOLE -DHAVE_MENU -DHAVE_RGUI -DHAVE_FILTERS_BUILTIN -DHAVE_7ZIP -DHAVE_CC_RESAMPLER
RARCH_DEFINES = -DPSP -D_MIPS_ARCH_ALLEGREX -DHAVE_LANGEXTRA -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DWANT_ZLIB -DHAVE_GRIFFIN=1 -DRARCH_INTERNAL -DRARCH_CONSOLE -DHAVE_MENU -DHAVE_RGUI -DHAVE_FILTERS_BUILTIN -DHAVE_7ZIP -DHAVE_CC_RESAMPLER
LIBDIR =
LDFLAGS =
@@ -49,6 +49,7 @@ endif
CFLAGS += $(RARCH_DEFINES)
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = RetroArch PSP1
+2 -3
View File
@@ -25,7 +25,7 @@ ifeq ($(HAVE_FILE_LOGGER), 1)
CFLAGS += -DHAVE_FILE_LOGGER
endif
CFLAGS += $(RARCH_DEFINES)
CFLAGS += $(RARCH_DEFINES)
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = RetroArch
@@ -42,7 +42,6 @@ OBJS = frontend/frontend_salamander.o \
libretro-common/lists/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 \
@@ -51,7 +50,7 @@ OBJS = frontend/frontend_salamander.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
+6 -6
View File
@@ -11,10 +11,9 @@ 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_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DWANT_ZLIB
DEFINES += -DHAVE_RUNAHEAD -DHAVE_DYNAMIC
else
HAVE_AUDIOMIXER = 1
HAVE_CC_RESAMPLER = 1
HAVE_MENU_COMMON = 1
HAVE_RTGA = 1
@@ -25,6 +24,7 @@ else
HAVE_ZLIB = 1
HAVE_BUILTINZLIB = 1
HAVE_LIBRETRODB = 1
HAVE_ZARCH = 0
HAVE_MATERIALUI = 0 # enable later?
HAVE_XMB = 0
HAVE_STATIC_VIDEO_FILTERS = 1
@@ -34,20 +34,20 @@ else
HAVE_DYNAMIC = 1
include Makefile.common
CFLAGS += $(DEF_FLAGS)
BLACKLIST :=
BLACKLIST :=
BLACKLIST += input/input_overlay.o
BLACKLIST += tasks/task_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/
INCDIRS := -I. -Ideps -Ideps/libz -Ilibretro-common/include -Ideps/stb -I$(LIBTRANSISTOR_HOME)/build/sdl2_install/include/SDL2/
LIBDIRS := -L.
TARGETS := $(TARGET).nro
+19 -16
View File
@@ -12,17 +12,15 @@ PC_DEVELOPMENT_UDP_PORT =
OBJ :=
DEFINES :=
INCDIRS :=
ifeq ($(GRIFFIN_BUILD), 1)
OBJ += griffin/griffin.o
DEFINES += -DHAVE_GRIFFIN=1
DEFINES += -DHAVE_NEON -DHAVE_MENU -DHAVE_XMB -DHAVE_MATERIALUI -DHAVE_LIBRETRODB DEFINES -DHAVE_KEYMAPPER
DEFINES += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DHAVE_CC_RESAMPLER -DHAVE_UPDATE_ASSETS
DEFINES += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DWANT_ZLIB -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_NEON := 1
@@ -40,7 +38,6 @@ else
HAVE_MENU := 1
HAVE_MENU_COMMON := 1
HAVE_OVERLAY := 1
HAVE_VIDEO_LAYOUT := 0
HAVE_MATERIALUI := 1
HAVE_XMB := 1
HAVE_RGUI := 1
@@ -49,7 +46,6 @@ else
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
@@ -59,12 +55,16 @@ else
endif
include Makefile.common
CFLAGS += $(DEF_FLAGS)
BLACKLIST :=
OBJ := $(filter-out $(BLACKLIST),$(OBJ))
INCDIRS += $(INCLUDE_DIRS)
OBJ += input/drivers/psp_input.o
OBJ += input/drivers_joypad/psp_joypad.o
OBJ += audio/drivers/psp_audio.o
OBJ += frontend/drivers/platform_psp.o
endif
ifeq ($(strip $(VITASDK)),)
$(error "Please set VITASDK in your environment. export VITASDK=<path to>vitasdk")
endif
@@ -82,19 +82,22 @@ STRIP := $(PREFIX)strip
NM := $(PREFIX)nm
LD := $(CXX)
INCDIRS := -I. -Ideps/libz -Ideps/7zip -Ilibretro-common/include -Ideps/stb
LIBDIRS := -L.
ARCHFLAGS := -march=armv7-a -mfpu=neon -mfloat-abi=hard -DVITA
CFLAGS += $(ARCHFLAGS) -mword-relocations -fno-optimize-sibling-calls -O2
CFLAGS += $(ARCHFLAGS) -mword-relocations -fno-optimize-sibling-calls
ifeq ($(DEBUG), 1)
CFLAGS += -g
CFLAGS += -O2 -g
else
CFLAGS += -O3
endif
ASFLAGS := $(CFLAGS)
LDFLAGS := -Wl,-q
CFLAGS += -Wall -ffast-math -g
CFLAGS += -Wall -ffast-math
CFLAGS += -DRARCH_INTERNAL -DRARCH_CONSOLE
CFLAGS += -DHAVE_FILTERS_BUILTIN $(DEFINES)
@@ -112,8 +115,8 @@ ifeq ($(WHOLE_ARCHIVE_LINK), 1)
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 \
VITA_LIBS := -lSceDisplay_stub -lSceGxm_stub -lSceNet_stub -lSceNetCtl_stub \
-lSceSysmodule_stub -lSceCtrl_stub -lSceTouch_stub -lSceAudio_stub \
-lScePower_stub -lSceRtc_stub -lSceCommonDialog_stub -lScePgf_stub \
-lSceFiber_stub -lSceMotion_stub -lSceAppMgr_stub -lpthread -lpng -lz
@@ -124,6 +127,7 @@ TARGETS := $(TARGET).vpk
DEPFLAGS = -MT $@ -MMD -MP -MF $*.Tdepend
POSTCOMPILE = mv -f $*.Tdepend $*.depend
all: $(TARGETS)
%.o: %.cpp
@@ -136,6 +140,7 @@ all: $(TARGETS)
$(CC) -c -o $@ $< $(CFLAGS) $(INCDIRS) $(DEPFLAGS)
$(POSTCOMPILE)
%.o: %.S
%.o: %.S %.depend
$(CC) -c -o $@ $< $(ASFLAGS) $(INCDIRS) $(DEPFLAGS)
@@ -152,19 +157,17 @@ $(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-mksfoex -s TITLE_ID=$(VITA_TITLE_ID) "$(VITA_TITLE_NAME)" 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) $(TARGET).elf $(TARGET).velf $(TARGET).self param.sfo $(TARGET).vpk
rm -f $(OBJ:.o=.depend)
# Useful for developers
+3 -4
View File
@@ -21,8 +21,8 @@ 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\
LIBS = -lSceDisplay_stub -lSceGxm_stub -lSceNet_stub -lSceNetCtl_stub\
-lSceSysmodule_stub -lSceCtrl_stub -lSceAudio_stub -lSceFiber_stub\
-lScePower_stub -lSceRtc_stub -lSceCommonDialog_stub -lScePgf_stub \
-lSceMotion_stub -lSceAppMgr_stub -lfreetype -lpng -lm -lc
@@ -44,7 +44,6 @@ OBJS = frontend/frontend_salamander.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 \
@@ -55,7 +54,7 @@ OBJS = frontend/frontend_salamander.o \
all: $(TARGET).vpk
%.vpk: eboot.bin
vita-mksfoex -s TITLE_ID=$(TITLE_ID) "$(TARGET)" -d ATTRIBUTE2=12 param.sfo
vita-mksfoex -s TITLE_ID=$(TITLE_ID) "$(TARGET)" param.sfo
vita-pack-vpk -s param.sfo -b eboot.bin $@
eboot.bin: $(TARGET).velf
+5 -7
View File
@@ -30,25 +30,24 @@ 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
INCLUDE := -I. -Ilibretro-common/include -Ideps/libz
ifeq ($(EXTERNAL_LIBOGC), 1)
INCLUDE += -I$(DEVKITPRO)/libogc/include
INCLUDE += -I$(DEVKITPRO)/libogc/include
LIBDIRS := -L$(DEVKITPRO)/libogc/lib/wii -L.
else
INCLUDE += -Iwii/libogc/include
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
LIBS := -lwiiuse -logc -lbte
ifeq ($(EXTERNAL_LIBOGC), 1)
LIBS := -lfat
LIBS += -lfat
endif
LIBS += -lwiiuse -logc -lbte
APP_BOOTER_DIR = wii/app_booter
OBJ = frontend/frontend_salamander.o \
@@ -67,7 +66,6 @@ OBJ = frontend/frontend_salamander.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 \
file_path_str.o \
verbosity.o \
+137 -140
View File
@@ -1,4 +1,4 @@
TARGET := retroarch_wiiu
TARGET := retroarch_wiiu
BUILD_HBL_ELF = 1
BUILD_RPX = 1
@@ -10,7 +10,7 @@ WIIU_HID = 1
HAVE_RUNAHEAD = 1
WIIU_LOG_RPX = 0
BUILD_DIR = objs/wiiu
PC_DEVELOPMENT_TCP_PORT ?=
PC_DEVELOPMENT_TCP_PORT ?=
ifeq ($(SALAMANDER_BUILD),1)
BUILD_DIR := $(BUILD_DIR)-salamander
@@ -27,13 +27,7 @@ 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
@@ -43,9 +37,23 @@ 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
DEFINES :=
ifeq ($(WIIU_LOG_RPX),1)
defines += -DWIIU_LOG_RPX
endif
ifeq ($(WIIU_HID),1)
DEFINES += -DWIIU_HID
OBJ += input/drivers_joypad/wiiu/hidpad_driver.o
OBJ += input/drivers_hid/wiiu_hid.o
OBJ += input/connect/joypad_connection.o \
input/common/hid/hid_device_driver.o \
input/common/hid/device_wiiu_gca.o \
input/common/hid/device_ds3.o \
input/common/hid/device_ds4.o \
input/common/hid/device_null.o
endif
ifeq ($(SALAMANDER_BUILD),1)
DEFINES += -DRARCH_CONSOLE -DIS_SALAMANDER
@@ -56,7 +64,6 @@ ifeq ($(SALAMANDER_BUILD),1)
OBJ += frontend/drivers/platform_null.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/string/stdstring.o
OBJ += libretro-common/lists/string_list.o
@@ -69,8 +76,6 @@ ifeq ($(SALAMANDER_BUILD),1)
OBJ += libretro-common/hash/rhash.o
OBJ += file_path_str.o
OBJ += verbosity.o
# $(SALAMANDER_BUILD),0
else
DEFINES += -DRARCH_INTERNAL
DEFINES += -DHAVE_KEYMAPPER
@@ -80,7 +85,7 @@ else
DEFINES += -DHAVE_SHADERPIPELINE
ifeq ($(HAVE_RUNAHEAD),1)
DEFINES += -DHAVE_RUNAHEAD
DEFINES += -DHAVE_RUNAHEAD
endif
OBJ += wiiu/shader_utils.o
@@ -93,139 +98,74 @@ endif
OBJ += gfx/drivers/gx2_shaders/snow.o
OBJ += gfx/drivers/gx2_shaders/snow_simple.o
OBJ += gfx/drivers/gx2_shaders/snowflake.o
OBJ += gfx/drivers_shader/slang_preprocess.o
OBJ += gfx/drivers_shader/glslang_util.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_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
OBJ += griffin/griffin.o
DEFINES += -DHAVE_GRIFFIN=1 -DHAVE_MENU -DHAVE_RGUI -DHAVE_LIBRETRODB
DEFINES += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DWANT_ZLIB -DHAVE_CC_RESAMPLER
DEFINES += -DHAVE_STB_FONT -DHAVE_STB_VORBIS -DHAVE_LANGEXTRA -DHAVE_LIBRETRODB -DHAVE_NETWORKING
# DEFINES += -DWANT_IFADDRS
# DEFINES += -DHAVE_FREETYPE
DEFINES += -DHAVE_XMB -DHAVE_MATERIALUI
else
HAVE_AUDIOMIXER = 1
HAVE_MENU_COMMON = 1
HAVE_RTGA = 1
HAVE_RPNG = 1
HAVE_RJPEG = 1
HAVE_RBMP = 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
HAVE_MENU_COMMON = 1
HAVE_RTGA = 1
HAVE_RPNG = 1
HAVE_RJPEG = 1
HAVE_RBMP = 1
HAVE_RGUI = 1
HAVE_ZLIB = 1
HAVE_7ZIP = 1
HAVE_BUILTINZLIB = 0
HAVE_LIBRETRODB = 1
HAVE_ZARCH = 0
HAVE_MATERIALUI = 1
HAVE_XMB = 1
HAVE_STB_FONT = 1
# HAVE_FREETYPE = 1
HAVE_LANGEXTRA = 1
HAVE_LIBRETRODB = 1
HAVE_NETWORKING = 1
HAVE_CHEEVOS = 1
# WANT_IFADDRS = 1
HAVE_OVERLAY = 1
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)
include Makefile.common
BLACKLIST := $(LIBRETRO_COMM_DIR)/net/net_ifinfo.o
OBJ := $(filter-out $(BLACKLIST),$(OBJ))
OBJ += gfx/drivers/gx2_gfx.o
OBJ += gfx/drivers_font/wiiu_font.o
OBJ += menu/drivers_display/menu_display_wiiu.o
OBJ += input/drivers/wiiu_input.o
OBJ += input/drivers_joypad/wiiu_joypad.o
OBJ += input/drivers_joypad/wiiu/wpad_driver.o
OBJ += input/drivers_joypad/wiiu/kpad_driver.o
OBJ += input/drivers_joypad/wiiu/pad_functions.o
OBJ += audio/drivers/wiiu_audio.o
OBJ += frontend/drivers/platform_wiiu.o
endif
endif
OBJ := $(addprefix $(BUILD_DIR)/,$(OBJ))
#-----------------------------
# Compile flags
DEFINES += -DWIIU -DMSB_FIRST -D__WUT__ -DHW_WUP -D__wiiu__
#todo: remove -DWIIU and use the built-in macros instead (HW_WUP or __wiiu__).
DEFINES += -DWIIU -DMSB_FIRST -D__WUT__
#DEFINES += -D_GNU_SOURCE
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
@@ -233,7 +173,7 @@ ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPRO")
endif
export PATH := $(PATH):$(DEVKITPPC)/bin
export PATH := $(PATH):$(DEVKITPPC)/bin
PREFIX := powerpc-eabi-
@@ -254,8 +194,64 @@ else
ELF2RPL := $(ELF2RPL).exe
endif
#-----------------------------
# Targets and build rules
INCDIRS := -I.
INCDIRS += -Ideps
INCDIRS += -Ideps/stb
INCDIRS += -Ideps/libz
INCDIRS += -Ideps/7zip
INCDIRS += -Ilibretro-common/include
INCDIRS += -Iinput/include
INCDIRS += -Iwiiu
INCDIRS += -Iwiiu/include
INCDIRS += -I$(DEVKITPRO)/portlibs/ppc/include
LIBDIRS := -L. -L$(DEVKITPRO)/portlibs/ppc/lib
CFLAGS := -mwup -mcpu=750 -meabi -mhard-float
LDFLAGS :=
ifeq ($(DEBUG), 1)
CFLAGS += -O0 -g
else
CFLAGS += -O3
endif
LDFLAGS := $(CFLAGS)
ASFLAGS := $(CFLAGS) -mregnames
CFLAGS += -ffast-math -Werror=implicit-function-declaration
#CFLAGS += -fomit-frame-pointer -mword-relocations
#CFLAGS += -Wall
ifeq ($(WHOLE_ARCHIVE_LINK), 1)
WHOLE_START := -Wl,--whole-archive
WHOLE_END := -Wl,--no-whole-archive
endif
CXXFLAGS = $(CFLAGS) -fno-rtti -fno-exceptions
LDFLAGS += -Wl,--gc-sections
LIBS := $(WHOLE_START) -lretro_wiiu $(WHOLE_END) -lm -lpng -lz
ifneq ($(WANT_LIBFAT), 1)
LIBS += -lfat
endif
ifneq ($(WANT_IOSUHAX), 1)
LIBS += -liosuhax
endif
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
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
TARGETS :=
ifeq ($(BUILD_RPX), 1)
@@ -268,11 +264,13 @@ 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 $@)
@@ -319,11 +317,10 @@ $(BUILD_DIR)/$(TARGET).rpx: $(BUILD_DIR)/$(TARGET).rpx.elf $(ELF2RPL) .$(TARGET)
$(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)
rm -f $(OBJ) $(RPX_OBJ) $(HBL_ELF_OBJ) $(TARGET).elf $(TARGET).rpx.elf $(TARGET).rpx
rm -f $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).rpx.elf $(BUILD_DIR)/$(TARGET).rpx
rm -f .$(TARGET).elf.last .$(TARGET).rpx.elf.last .$(TARGET).rpx.last
rm -f $(OBJ:.o=.depend) $(RPX_OBJ:.o=.depend) $(HBL_ELF_OBJ:.o=.depend)
.PHONY: clean all
.PRECIOUS: %.depend %.last
+11 -21
View File
@@ -1,6 +1,5 @@
TARGET = retroarch.exe
HAVE_AUDIOMIXER = 1
HAVE_DINPUT = 1
HAVE_XAUDIO = 1
HAVE_DSOUND = 1
@@ -9,11 +8,9 @@ HAVE_OPENGL = 1
HAVE_DYLIB = 1
HAVE_D3D9 = 1
HAVE_NETWORKING = 1
HAVE_NETPLAYDISCOVERY = 1
HAVE_STDIN_CMD = 1
HAVE_COMMAND = 1
HAVE_THREADS = 1
HAVE_MENU = 1
HAVE_RGUI = 1
HAVE_MATERIALUI = 1
HAVE_7ZIP = 1
@@ -33,7 +30,9 @@ HAVE_FREETYPE := 1
HAVE_FFMPEG := 0
HAVE_CG := 1
HAVE_LIBXML2 := 0
HAVE_ZLIB := 1
WANT_ZLIB := 1
HAVE_CC_RESAMPLER := 1
ifeq ($(HAVE_CG), 1)
@@ -45,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
@@ -56,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
@@ -94,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
@@ -113,6 +101,7 @@ else
WINDRES = windres
endif
libretro ?= -lretro
ifeq ($(DYNAMIC), 1)
@@ -133,7 +122,7 @@ else
CXXFLAGS += -O3 -ffast-math
endif
CFLAGS += $(DEF_FLAGS) -Wall -Wno-unused-result -Wno-unused-variable -I. -Ideps
CFLAGS += -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
ifeq ($(CXX_BUILD), 1)
CFLAGS += -std=c++98 -xc++ -D__STDC_CONSTANT_MACROS
@@ -182,3 +171,4 @@ clean:
rm -f *.d
.PHONY: all install uninstall clean
+9 -9
View File
@@ -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
@@ -19,7 +19,7 @@ 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);
// 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.
+20 -19
View File
@@ -31,7 +31,7 @@ Latest binaries are currently hosted on the [buildbot](http://buildbot.libretro.
## Support
To reach developers, either make an issue here on GitHub, make a thread on the [forum](http://www.libretro.com/forums/), chat on [discord](https://discord.gg/C4amCeV), or visit our IRC channel: #retroarch @ irc.freenode.org.
To reach developers, either make an issue here on GitHub, make a thread on the [forum](http://www.libretro.com/forums/), chat on [Discord](https://discord.gg/C4amCeV), or visit our IRC channel: #retroarch @ irc.freenode.org.
## Documentation
@@ -105,6 +105,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:
@@ -147,7 +148,7 @@ Instructions for compiling and installing RetroArch can be found in the [Libretr
## CRT 15Khz Resolution Switching
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.
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.
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:
@@ -188,46 +189,46 @@ The default super resolution is 2560. It is displayed just under the CRT switch
If native resolutions are activated you will need a whole new set of modelines:
- 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 224 @ 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
- 256 x 240 @ 50.006977 SNESpal
- 256 x 448 @ 50.006977 SNESpal
- 256 x 240 @ 60.098812 SNESntsc
- 256 x 448 @ 60.098812 SNESntsc
- 320 x 240 @ 59.922745 MDntsc
- 320 x 448 @ 59.922745 MDntsc
- 320 x 448 @ 59.922745 MDntp
- 320 x 480 @ 59.922745 MDntsc
- 256 x 192 @ 59.922745 MDntsc
- 320 x 224 @ 59.922745 MDntsc
- 256 x 224 @ 59.922745 MDntsc
- 320 x 288 @ 49.701458 MDpal
- 320 x 576 @ 49.701458 MDpal
- 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 224 @ 49.701458 MDpal
- 256 x 288 @ 49.701458 MSYSpal
- 256 x 240 @ 60.098812 NESntsc
- 256 x 240 @ 50.006977 NESpal
- 640 x 480 @ 60.130001 N64ntsc
- 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
- 640 x 576 @ 50.000000 n64pal
- 640 x 288 @ 50.000000 n64pal
- 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
- 320 x 252 @ 49.759998 PSXpal
- 640 x 252 @ 49.759998 PSXpal
- 384 x 240 @ 59.941002 PSXntsc
- 256 x 480 @ 59.941002 PSXntsc
-88
View File
@@ -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
+1631
View File
File diff suppressed because it is too large. Load diff
+347
View File
@@ -0,0 +1,347 @@
/* 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_DRIVER__H
#define __AUDIO_DRIVER__H
#include <stdint.h>
#include <stddef.h>
#include <sys/types.h>
#include <boolean.h>
#include <audio/audio_mixer.h>
#include <audio/audio_resampler.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
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_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_mixer_stream
{
audio_mixer_sound_t *handle;
audio_mixer_voice_t *voice;
audio_mixer_stop_cb_t stop_cb;
enum audio_mixer_state state;
float volume;
void *buf;
char *name;
size_t bufsize;
} audio_mixer_stream_t;
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;
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, unsigned block_frames, unsigned *new_rate);
/*
* @data : Pointer to audio data handle.
* @buf : Audio buffer data.
* @size : Size of audio buffer.
*
* Write samples to audio driver.
*
* Write data in buffer to audio driver.
* A frame here is defined as one combined sample of left and right
* channels. (I.e. 44.1kHz, 16-bit stereo has 88.2k samples/s, and
* 44.1k frames/s.)
*
* Samples are interleaved in format LRLRLRLRLR ...
* If the driver returns true in use_float(), a floating point
* format will be used, with range [-1.0, 1.0].
* If not, signed 16-bit samples in native byte ordering will be used.
*
* This function returns the number of frames successfully written.
* If an error occurs, -1 should be returned.
* Note that non-blocking behavior that cannot write at this time
* should return 0 as returning -1 will terminate the driver.
*
* Unless said otherwise with set_nonblock_state(), all writes
* are blocking, and it should block till it has written all frames.
*/
ssize_t (*write)(void *data, const void *buf, size_t size);
/* Temporarily pauses the audio driver. */
bool (*stop)(void *data);
/* Resumes audio driver from the paused state. */
bool (*start)(void *data, bool is_shutdown);
/* Is the audio driver currently running? */
bool (*alive)(void *data);
/* Should we care about blocking in audio thread? Fast forwarding.
*
* If state is true, nonblocking operation is assumed.
* This is typically used for fast-forwarding. If driver cannot
* implement nonblocking writes, this can be disregarded, but should
* log a message to stderr.
* */
void (*set_nonblock_state)(void *data, bool toggle);
/* Stops and frees driver data. */
void (*free)(void *data);
/* Defines if driver will take standard floating point samples,
* or int16_t samples.
*
* If true is returned, the audio driver is capable of using
* floating point data. This will likely increase performance as the
* resampler unit uses floating point. The sample range is
* [-1.0, 1.0].
* */
bool (*use_float)(void *data);
/* Human-readable identifier. */
const char *ident;
/* Optional. Get audio device list (allocates, caller has to free this) */
void *(*device_list_new)(void *data);
/* Optional. Frees audio device list */
void (*device_list_free)(void *data, void *data2);
/* Optional. */
size_t (*write_avail)(void *data);
size_t (*buffer_size)(void *data);
} audio_driver_t;
typedef struct audio_mixer_stream_params
{
float volume;
enum audio_mixer_type type;
enum audio_mixer_state state;
void *buf;
char *basename;
size_t bufsize;
audio_mixer_stop_cb_t cb;
} audio_mixer_stream_params_t;
void audio_driver_destroy_data(void);
void audio_driver_set_own_driver(void);
void audio_driver_unset_own_driver(void);
void audio_driver_suspend(void);
bool audio_driver_is_suspended(void);
void audio_driver_resume(void);
void audio_driver_set_active(void);
bool audio_driver_is_active(void);
void audio_driver_destroy(void);
void audio_driver_deinit_resampler(void);
bool audio_driver_free_devices_list(void);
bool audio_driver_new_devices_list(void);
bool audio_driver_enable_callback(void);
bool audio_driver_disable_callback(void);
/**
* 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);
bool audio_driver_mixer_extension_supported(const char *ext);
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);
bool audio_driver_get_devices_list(void **ptr);
void audio_driver_setup_rewind(void);
void audio_driver_monitor_adjust_system_rates(void);
bool audio_driver_set_callback(const void *data);
bool audio_driver_callback(void);
bool audio_driver_has_callback(void);
/* Sets audio monitor rate to new value. */
void audio_driver_monitor_set_rate(void);
bool audio_driver_find_driver(void);
bool audio_driver_toggle_mute(void);
bool audio_driver_start(bool is_shutdown);
bool audio_driver_stop(void);
bool audio_driver_owns_driver(void);
void audio_driver_unset_callback(void);
void audio_driver_frame_is_reverse(void);
void audio_set_float(enum audio_action action, float val);
void audio_set_bool(enum audio_action action, bool val);
void audio_unset_bool(enum audio_action action, bool val);
float *audio_get_float_ptr(enum audio_action action);
bool *audio_get_bool_ptr(enum audio_action action);
bool audio_driver_deinit(void);
bool audio_driver_init(void);
void audio_driver_menu_sample(void);
audio_mixer_stream_t *audio_driver_mixer_get_stream(unsigned i);
bool audio_driver_mixer_add_stream(audio_mixer_stream_params_t *params);
void audio_driver_mixer_play_stream(unsigned i);
void audio_driver_mixer_play_stream_sequential(unsigned i);
void audio_driver_mixer_play_stream_looped(unsigned i);
void audio_driver_mixer_stop_stream(unsigned i);
float audio_driver_mixer_get_stream_volume(unsigned i);
void audio_driver_mixer_set_stream_volume(unsigned i, float vol);
void audio_driver_mixer_remove_stream(unsigned i);
enum resampler_quality audio_driver_get_resampler_quality(void);
enum audio_mixer_state audio_driver_mixer_get_stream_state(unsigned i);
const char *audio_driver_mixer_get_stream_name(unsigned i);
bool compute_audio_buffer_statistics(audio_statistics_t *stats);
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_tinyalsa;
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_wasapi;
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_ax;
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_switch;
extern audio_driver_t audio_switch_thread;
extern audio_driver_t audio_rwebaudio;
extern audio_driver_t audio_null;
RETRO_END_DECLS
#endif
+8 -6
View File
@@ -55,8 +55,8 @@ static void audio_thread_loop(void *data)
if (!thr)
return;
thr->driver_data = thr->driver->init(
thr->device, thr->out_rate, thr->latency,
RARCH_LOG("[Audio Thread]: Initializing audio driver.\n");
thr->driver_data = thr->driver->init(thr->device, thr->out_rate, thr->latency,
thr->block_frames, thr->new_rate);
slock_lock(thr->lock);
thr->inited = thr->driver_data ? 1 : -1;
@@ -75,6 +75,8 @@ static void audio_thread_loop(void *data)
scond_wait(thr->cond, thr->lock);
slock_unlock(thr->lock);
RARCH_LOG("[Audio Thread]: Starting audio.\n");
for (;;)
{
slock_lock(thr->lock);
@@ -92,8 +94,7 @@ 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);
@@ -107,6 +108,7 @@ static void audio_thread_loop(void *data)
audio_driver_callback();
}
RARCH_LOG("[Audio Thread]: Tearing down driver.\n");
thr->driver->free(thr->driver_data);
}
@@ -298,8 +300,8 @@ bool audio_init_thread(const audio_driver_t **out_driver,
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;
+2 -1
View File
@@ -19,7 +19,7 @@
#include <boolean.h>
#include "../retroarch.h"
#include "audio_driver.h"
/**
* audio_init_thread:
@@ -43,3 +43,4 @@ bool audio_init_thread(const audio_driver_t **out_driver, void **out_data,
const audio_driver_t *driver);
#endif
-136
View File
@@ -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;
}
-27
View File
@@ -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
-114
View File
@@ -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
+1 -12
View File
@@ -21,7 +21,7 @@
#include <alsa/asoundlib.h>
#include "../../retroarch.h"
#include "../audio_driver.h"
#include "../../verbosity.h"
typedef struct alsa
@@ -180,7 +180,6 @@ error:
#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;
@@ -189,12 +188,6 @@ static ssize_t alsa_write(void *data, const void *buf_, size_t size_)
snd_pcm_sframes_t size = BYTES_TO_FRAMES(size_, alsa->frame_bits);
size_t frames_size = alsa->has_float ? sizeof(float) : sizeof(int16_t);
/* 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)
@@ -276,8 +269,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)
@@ -302,8 +293,6 @@ static void alsa_set_nonblock_state(void *data, bool state)
static bool alsa_start(void *data, bool is_shutdown)
{
alsa_t *alsa = (alsa_t*)data;
if (!alsa->is_paused)
return true;
if (alsa->can_pause
&& alsa->is_paused)
+16 -14
View File
@@ -19,7 +19,7 @@
#include <sys/asoundlib.h>
#include <retro_math.h>
#include "../../retroarch.h"
#include "../audio_driver.h"
#define MAX_FRAG_SIZE 3072
#define DEFAULT_RATE 48000
@@ -41,7 +41,7 @@ typedef struct alsa
bool is_paused;
unsigned buf_size;
unsigned buf_count;
} alsa_qsa_t;
} alsa_t;
typedef long snd_pcm_sframes_t;
@@ -53,7 +53,7 @@ static void *alsa_qsa_init(const char *device,
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));
alsa_t *alsa = (alsa_t*)calloc(1, sizeof(alsa_t));
if (!alsa)
return NULL;
@@ -165,8 +165,8 @@ error:
static int check_pcm_status(void *data, int channel_type)
{
snd_pcm_channel_status_t status;
alsa_qsa_t *alsa = (alsa_qsa_t*)data;
int ret = EOK;
alsa_t *alsa = (alsa_t*)data;
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)
@@ -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,7 +285,7 @@ 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;
@@ -292,7 +293,7 @@ static bool alsa_qsa_alive(void *data)
static bool alsa_qsa_start(void *data, bool is_shutdown)
{
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,7 +354,7 @@ static void alsa_qsa_free(void *data)
static size_t alsa_qsa_write_avail(void *data)
{
alsa_qsa_t *alsa = (alsa_qsa_t*)data;
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);
@@ -361,7 +363,7 @@ static size_t alsa_qsa_write_avail(void *data)
static size_t alsa_qsa_buffer_size(void *data)
{
alsa_qsa_t *alsa = (alsa_qsa_t*)data;
alsa_t *alsa = (alsa_t*)data;
return alsa->buf_size * alsa->buf_count;
}
+5 -5
View File
@@ -24,7 +24,7 @@
#include <queues/fifo_queue.h>
#include <string/stdstring.h>
#include "../../retroarch.h"
#include "../audio_driver.h"
#include "../../verbosity.h"
#define TRY_ALSA(x) if (x < 0) \
@@ -345,7 +345,7 @@ static size_t alsa_thread_buffer_size(void *data)
return alsa->buffer_size;
}
static void *alsa_thread_device_list_new(void *data)
static void *alsa_device_list_new(void *data)
{
void **hints, **n;
union string_list_elem_attr attr;
@@ -393,7 +393,7 @@ error:
return NULL;
}
static void alsa_thread_device_list_free(void *data, void *array_list_data)
static void alsa_device_list_free(void *data, void *array_list_data)
{
struct string_list *s = (struct string_list*)array_list_data;
@@ -413,8 +413,8 @@ audio_driver_t audio_alsathread = {
alsa_thread_free,
alsa_thread_use_float,
"alsathread",
alsa_thread_device_list_new,
alsa_thread_device_list_free,
alsa_device_list_new,
alsa_device_list_free,
alsa_thread_write_avail,
alsa_thread_buffer_size,
};
-212
View File
@@ -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,
};
+3 -4
View File
@@ -15,6 +15,7 @@
*/
#include <stdlib.h>
#if TARGET_OS_IPHONE
#include <AudioToolbox/AudioToolbox.h>
#else
@@ -31,7 +32,7 @@
#include <retro_endianness.h>
#include <string/stdstring.h>
#include "../../retroarch.h"
#include "../audio_driver.h"
#include "../../verbosity.h"
typedef struct coreaudio
@@ -125,9 +126,7 @@ 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)
@@ -220,7 +219,7 @@ static void *coreaudio_init(const char *device,
dev->lock = slock_new();
dev->cond = scond_new();
#if TARGET_OS_IOS
#if TARGET_OS_IPHONE
if (!session_initialized)
{
session_initialized = true;
-392
View File
@@ -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,
};
+3 -1
View File
@@ -19,7 +19,7 @@
#include <retro_miscellaneous.h>
#include <retro_timers.h>
#include "../../retroarch.h"
#include "../audio_driver.h"
typedef struct
{
@@ -56,6 +56,7 @@ static void ctr_csnd_audio_update_playpos(ctr_csnd_audio_t* ctr)
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)
{
@@ -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,
+3 -1
View File
@@ -17,7 +17,7 @@
#include <string.h>
#include <malloc.h>
#include "../../retroarch.h"
#include "../audio_driver.h"
#include "../../ctr/ctr_debug.h"
typedef struct
@@ -195,6 +195,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,
@@ -210,3 +211,4 @@ audio_driver_t audio_ctr_dsp = {
ctr_dsp_audio_write_avail,
ctr_dsp_audio_buffer_size
};
+69 -125
View File
@@ -35,11 +35,9 @@
#ifdef HAVE_THREADS
#include <rthreads/rthreads.h>
#endif
#include <lists/string_list.h>
#include <queues/fifo_queue.h>
#include <string/stdstring.h>
#include "../../retroarch.h"
#include "../audio_driver.h"
#include "../../verbosity.h"
#ifdef _XBOX
@@ -53,6 +51,7 @@
#pragma comment(lib, "dxguid")
#endif
typedef struct dsound
{
LPDIRECTSOUND ds;
@@ -75,15 +74,17 @@ typedef struct dsound
volatile bool thread_alive;
} dsound_t;
/* Forward declarations */
static void *dsound_list_new(void *u);
static INLINE unsigned write_avail(unsigned read_ptr,
unsigned write_ptr, unsigned buffer_size)
{
return (read_ptr + buffer_size - write_ptr) % buffer_size;
}
static INLINE void get_positions(dsound_t *ds, DWORD *read_ptr, DWORD *write_ptr)
{
IDirectSoundBuffer_GetCurrentPosition(ds->dsb, read_ptr, write_ptr);
}
#define CHUNK_SIZE 256
struct audio_lock
@@ -97,44 +98,51 @@ struct audio_lock
static INLINE bool grab_region(dsound_t *ds, uint32_t write_ptr,
struct audio_lock *region)
{
const char *err = NULL;
HRESULT res = IDirectSoundBuffer_Lock(ds->dsb, write_ptr, CHUNK_SIZE,
&region->chunk1, &region->size1, &region->chunk2, &region->size2, 0);
if (res == DSERR_BUFFERLOST)
{
if ((res = IDirectSoundBuffer_Restore(ds->dsb)) != DS_OK)
res = IDirectSoundBuffer_Restore(ds->dsb);
if (res != DS_OK)
return false;
if ((res = IDirectSoundBuffer_Lock(ds->dsb, write_ptr, CHUNK_SIZE,
&region->chunk1, &region->size1, &region->chunk2, &region->size2, 0)) != DS_OK)
res = IDirectSoundBuffer_Lock(ds->dsb, write_ptr, CHUNK_SIZE,
&region->chunk1, &region->size1, &region->chunk2, &region->size2, 0);
if (res != DS_OK)
return false;
}
if (res == DS_OK)
return true;
#ifdef DEBUG
switch (res)
{
case DSERR_BUFFERLOST:
RARCH_WARN("[DirectSound error]: %s\n", "DSERR_BUFFERLOST");
err = "DSERR_BUFFERLOST";
break;
case DSERR_INVALIDCALL:
RARCH_WARN("[DirectSound error]: %s\n", "DSERR_INVALIDCALL");
err = "DSERR_INVALIDCALL";
break;
case DSERR_INVALIDPARAM:
RARCH_WARN("[DirectSound error]: %s\n", "DSERR_INVALIDPARAM");
err = "DSERR_INVALIDPARAM";
break;
case DSERR_PRIOLEVELNEEDED:
RARCH_WARN("[DirectSound error]: %s\n", "DSERR_PRIOLEVELNEEDED");
err = "DSERR_PRIOLEVELNEEDED";
break;
default:
break;
}
#endif
default:
return true;
}
RARCH_WARN("[DirectSound error]: %s\n", err);
return false;
}
static INLINE void release_region(dsound_t *ds, const struct audio_lock *region)
{
IDirectSoundBuffer_Unlock(ds->dsb, region->chunk1,
region->size1, region->chunk2, region->size2);
}
#ifdef HAVE_THREADS
static void dsound_thread(void *data)
#else
@@ -146,16 +154,15 @@ static DWORD CALLBACK dsound_thread(PVOID data)
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
IDirectSoundBuffer_GetCurrentPosition(ds->dsb, NULL, &write_ptr);
get_positions(ds, NULL, &write_ptr);
write_ptr = (write_ptr + ds->buffer_size / 2) % ds->buffer_size;
while (ds->thread_alive)
{
bool is_pull = false;
struct audio_lock region;
DWORD read_ptr, avail, fifo_avail;
get_positions(ds, &read_ptr, NULL);
IDirectSoundBuffer_GetCurrentPosition(ds->dsb, &read_ptr, NULL);
avail = write_avail(read_ptr, write_ptr, ds->buffer_size);
EnterCriticalSection(&ds->crit);
@@ -167,6 +174,7 @@ static DWORD CALLBACK dsound_thread(PVOID data)
/* No space to write, or we don't have data in our fifo,
* but we can wait some time before it underruns ... */
/* We could opt for using the notification interface,
* but it is not guaranteed to work, so use high
* priority sleeping patterns.
@@ -186,8 +194,12 @@ static DWORD CALLBACK dsound_thread(PVOID data)
{
/* Got space to write, but nothing in FIFO (underrun),
* fill block with silence. */
memset(region.chunk1, 0, region.size1);
memset(region.chunk2, 0, region.size2);
release_region(ds, &region);
write_ptr = (write_ptr + region.size1 + region.size2) % ds->buffer_size;
}
else
{
@@ -200,16 +212,11 @@ static DWORD CALLBACK dsound_thread(PVOID data)
fifo_read(ds->buffer, region.chunk2, region.size2);
LeaveCriticalSection(&ds->crit);
is_pull = true;
}
release_region(ds, &region);
write_ptr = (write_ptr + region.size1 + region.size2) % ds->buffer_size;
IDirectSoundBuffer_Unlock(ds->dsb, region.chunk1,
region.size1, region.chunk2, region.size2);
write_ptr = (write_ptr + region.size1 + region.size2)
% ds->buffer_size;
if (is_pull)
SetEvent(ds->event);
}
}
ExitThread(0);
@@ -303,86 +310,52 @@ static void dsound_free(void *data)
free(ds);
}
struct dsound_dev
{
unsigned device;
unsigned total_count;
LPGUID guid;
};
static BOOL CALLBACK enumerate_cb(LPGUID guid, LPCSTR desc, LPCSTR module, LPVOID context)
{
union string_list_elem_attr attr;
struct string_list *list = (struct string_list*)context;
struct dsound_dev *dev = (struct dsound_dev*)context;
attr.i = 0;
string_list_append(list, desc, attr);
if (guid)
{
unsigned i;
LPGUID guid_copy = (LPGUID)malloc(sizeof(GUID) * 1);
guid_copy->Data1 = guid->Data1;
guid_copy->Data2 = guid->Data2;
guid_copy->Data3 = guid->Data3;
for (i = 0; i < 8; i++)
guid_copy->Data4[i] = guid->Data4[i];
list->elems[list->size-1].userdata = guid_copy;
}
RARCH_LOG("\t%u: %s\n", dev->total_count, desc);
if (dev->device == dev->total_count)
dev->guid = guid;
dev->total_count++;
return TRUE;
}
static void *dsound_init(const char *dev, unsigned rate, unsigned latency,
static void *dsound_init(const char *device, unsigned rate, unsigned latency,
unsigned block_frames,
unsigned *new_rate)
{
LPGUID selected_device = NULL;
WAVEFORMATEX wfx = {0};
DSBUFFERDESC bufdesc = {0};
int32_t idx_found = -1;
struct string_list *list = (struct string_list*)dsound_list_new(NULL);
dsound_t *ds = (dsound_t*)calloc(1, sizeof(*ds));
WAVEFORMATEX wfx = {0};
DSBUFFERDESC bufdesc = {0};
struct dsound_dev dev = {0};
dsound_t *ds = (dsound_t*)calloc(1, sizeof(*ds));
if (!ds)
goto error;
InitializeCriticalSection(&ds->crit);
if (dev)
{
/* Search for device name first */
if (list && list->elems)
{
if (list->elems)
{
unsigned i;
for (i = 0; i < list->size; i++)
{
if (string_is_equal(dev, list->elems[i].data))
{
idx_found = i;
selected_device = (LPGUID)list->elems[idx_found].userdata;
break;
}
}
/* Index was not found yet based on name string,
* just assume id is a one-character number index. */
if (device)
dev.device = strtoul(device, NULL, 0);
if (idx_found == -1 && isdigit(dev[0]))
{
idx_found = strtoul(dev, NULL, 0);
RARCH_LOG("[DirectSound]: Fallback, device index is a single number index instead: %d.\n", idx_found);
RARCH_LOG("DirectSound devices:\n");
#ifndef _XBOX
#ifdef UNICODE
DirectSoundEnumerate((LPDSENUMCALLBACKW)enumerate_cb, &dev);
#else
DirectSoundEnumerate((LPDSENUMCALLBACKA)enumerate_cb, &dev);
#endif
#endif
if (idx_found != -1)
{
if (idx_found < (int32_t)list->size)
{
RARCH_LOG("[DirectSound]: Corresponding name: %s\n", list->elems[idx_found].data);
selected_device = (LPGUID)list->elems[idx_found].userdata;
}
}
}
}
}
}
if (DirectSoundCreate(selected_device, &ds->ds, NULL) != DS_OK)
if (DirectSoundCreate(dev.guid, &ds->ds, NULL) != DS_OK)
goto error;
#ifndef _XBOX
@@ -436,13 +409,10 @@ static void *dsound_init(const char *dev, unsigned rate, unsigned latency,
if (!dsound_start_thread(ds))
goto error;
string_list_free(list);
return ds;
error:
RARCH_ERR("[DirectSound] Error occurred in init.\n");
if (list)
string_list_free(list);
dsound_free(ds);
return NULL;
}
@@ -544,32 +514,6 @@ static bool dsound_use_float(void *data)
return false;
}
static void *dsound_list_new(void *u)
{
struct string_list *sl = string_list_new();
if (!sl)
return NULL;
#ifndef _XBOX
#ifdef UNICODE
DirectSoundEnumerate((LPDSENUMCALLBACKW)enumerate_cb, sl);
#else
DirectSoundEnumerate((LPDSENUMCALLBACKA)enumerate_cb, sl);
#endif
#endif
return sl;
}
static void dsound_device_list_free(void *u, void *slp)
{
struct string_list *sl = (struct string_list*)slp;
if (sl)
string_list_free(sl);
}
audio_driver_t audio_dsound = {
dsound_init,
dsound_write,
@@ -580,8 +524,8 @@ audio_driver_t audio_dsound = {
dsound_free,
dsound_use_float,
"dsound",
dsound_list_new,
dsound_device_list_free,
NULL,
NULL,
dsound_write_avail,
dsound_buffer_size,
};
+12 -2
View File
@@ -27,7 +27,7 @@
#include <boolean.h>
#include <retro_inline.h>
#include "../../retroarch.h"
#include "../audio_driver.h"
#include "../../defines/gx_defines.h"
typedef struct
@@ -39,6 +39,7 @@ typedef struct
volatile unsigned dma_write;
size_t write_ptr;
OSCond cond;
bool nonblock;
bool is_paused;
} gx_audio_t;
@@ -62,6 +63,8 @@ static void dma_callback(void)
DCFlushRange(wa->data[wa->dma_next], CHUNK_SIZE);
AIInitDMA((uint32_t)wa->data[wa->dma_next], CHUNK_SIZE);
OSSignalCond(wa->cond);
}
static void *gx_audio_init(const char *device,
@@ -92,6 +95,8 @@ static void *gx_audio_init(const char *device,
*new_rate = 48000;
}
OSInitThreadQueue(&wa->cond);
wa->dma_write = BLOCKS - 1;
DCFlushRange(wa->data, sizeof(wa->data));
stop_audio = false;
@@ -128,7 +133,8 @@ static ssize_t gx_audio_write(void *data, const void *buf_, size_t size)
/* FIXME: Nonblocking audio should break out of loop
* when it has nothing to write. */
while ((wa->dma_write == wa->dma_next ||
wa->dma_write == wa->dma_busy) && !wa->nonblock);
wa->dma_write == wa->dma_busy) && !wa->nonblock)
OSSleepThread(wa->cond);
copy_swapped(wa->data[wa->dma_write] + wa->write_ptr, buf, to_write);
@@ -199,6 +205,10 @@ static void gx_audio_free(void *data)
AIStopDMA();
AIRegisterDMACallback(NULL);
if (wa->cond)
OSCloseThreadQueue(wa->cond);
wa->cond = 0;
free(data);
}
+1 -1
View File
@@ -25,7 +25,7 @@
#include <boolean.h>
#include <rthreads/rthreads.h>
#include "../../retroarch.h"
#include "../audio_driver.h"
#include "../../configuration.h"
#include "../../verbosity.h"
+2 -2
View File
@@ -14,14 +14,14 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "../../retroarch.h"
#include "../audio_driver.h"
#include "../../verbosity.h"
static void *null_audio_init(const char *device, unsigned rate, unsigned latency,
unsigned block_frames,
unsigned *new_rate)
{
RARCH_ERR("Using the null audio driver. RetroArch will be silent.\n");
RARCH_ERR("Using the null audio driver. RetroArch will be silent.");
(void)device;
(void)rate;
+1 -1
View File
@@ -33,7 +33,7 @@
#include <retro_miscellaneous.h>
#include <retro_timers.h>
#include "../../retroarch.h"
#include "../audio_driver.h"
#include "../../verbosity.h"
#define BUFSIZE 1024
+3 -2
View File
@@ -21,7 +21,7 @@
#include <rthreads/rthreads.h>
#include "../../retroarch.h"
#include "../audio_driver.h"
/* Helper macros, COM-style. */
#define SLObjectItf_Realize(a, ...) ((*(a))->Realize(a, __VA_ARGS__))
@@ -152,7 +152,7 @@ static void *sl_init(const char *device, unsigned rate, unsigned latency,
fmt_pcm.formatType = SL_DATAFORMAT_PCM;
fmt_pcm.numChannels = 2;
fmt_pcm.samplesPerSec = rate * 1000; /* Samplerate is in milli-Hz. */
fmt_pcm.samplesPerSec = rate * 1000; // Samplerate is in milli-Hz.
fmt_pcm.bitsPerSample = 16;
fmt_pcm.containerSize = 16;
fmt_pcm.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT;
@@ -232,6 +232,7 @@ static bool sl_start(void *data, bool is_shutdown)
return sl->is_paused ? false : true;
}
static ssize_t sl_write(void *data, const void *buf_, size_t size)
{
sl_t *sl = (sl_t*)data;
+1 -1
View File
@@ -33,7 +33,7 @@
#include "config.h"
#endif
#include "../../retroarch.h"
#include "../audio_driver.h"
#include "../../verbosity.h"
#ifdef HAVE_OSS_BSD
-174
View File
@@ -1,174 +0,0 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2014-2017 - Francisco Javier Trujillo Mata
*
* 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 <stdint.h>
#include <malloc.h>
#include <stdio.h>
#include <string.h>
#include <kernel.h>
#include <audsrv.h>
#include "../../retroarch.h"
#define AUDIO_BUFFER 128 * 1024
#define AUDIO_CHANNELS 2
#define AUDIO_BITS 16
typedef struct ps2_audio
{
bool nonblocking;
bool running;
} ps2_audio_t;
static void audioConfigure(ps2_audio_t *ps2, unsigned rate)
{
int err;
struct audsrv_fmt_t format;
format.bits = AUDIO_BITS;
format.freq = rate;
format.channels = AUDIO_CHANNELS;
err = audsrv_set_format(&format);
if (err)
{
printf("set format returned %d\n", err);
printf("audsrv returned error string: %s\n", audsrv_get_error_string());
}
audsrv_set_volume(MAX_VOLUME);
}
static void *ps2_audio_init(const char *device,
unsigned rate, unsigned latency,
unsigned block_frames,
unsigned *new_rate)
{
ps2_audio_t *ps2 = (ps2_audio_t*)calloc(1, sizeof(ps2_audio_t));
if (!ps2)
return NULL;
audioConfigure(ps2, rate);
return ps2;
}
static void ps2_audio_free(void *data)
{
ps2_audio_t* ps2 = (ps2_audio_t*)data;
if (!ps2)
return;
ps2->running = false;
audsrv_stop_audio();
free(ps2);
}
static ssize_t ps2_audio_write(void *data, const void *buf, size_t size)
{
int bytes_sent;
ps2_audio_t* ps2 = (ps2_audio_t*)data;
if (!ps2->running)
return -1;
bytes_sent = audsrv_play_audio(buf, size);
return bytes_sent;
}
static bool ps2_audio_alive(void *data)
{
bool alive = false;
ps2_audio_t* ps2 = (ps2_audio_t*)data;
if (ps2)
alive = ps2->running;
return alive;
}
static bool ps2_audio_stop(void *data)
{
bool stop = true;
ps2_audio_t* ps2 = (ps2_audio_t*)data;
if (ps2)
{
audsrv_stop_audio();
ps2->running = false;
}
return stop;
}
static bool ps2_audio_start(void *data, bool is_shutdown)
{
ps2_audio_t* ps2 = (ps2_audio_t*)data;
bool start = true;
if (ps2)
ps2->running = true;
return start;
}
static void ps2_audio_set_nonblock_state(void *data, bool toggle)
{
ps2_audio_t* ps2 = (ps2_audio_t*)data;
if (ps2)
ps2->nonblocking = toggle;
}
static bool ps2_audio_use_float(void *data)
{
return false;
}
static size_t ps2_audio_write_avail(void *data)
{
ps2_audio_t* ps2 = (ps2_audio_t*)data;
if (ps2 && ps2->running)
return AUDIO_BUFFER;
return 0;
}
static size_t ps2_audio_buffer_size(void *data)
{
return AUDIO_BUFFER;
}
audio_driver_t audio_ps2 = {
ps2_audio_init,
ps2_audio_write,
ps2_audio_stop,
ps2_audio_start,
ps2_audio_alive,
ps2_audio_set_nonblock_state,
ps2_audio_free,
ps2_audio_use_float,
"ps2",
NULL,
NULL,
ps2_audio_write_avail,
ps2_audio_buffer_size
};
+1 -1
View File
@@ -19,7 +19,7 @@
#include <queues/fifo_queue.h>
#include "../../retroarch.h"
#include "../audio_driver.h"
#include "../../defines/ps3_defines.h"
+12 -35
View File
@@ -16,31 +16,24 @@
*/
#include <stdint.h>
#if defined(VITA) || defined(PSP)
#include <malloc.h>
#endif
#include <stdio.h>
#include <string.h>
#include <rthreads/rthreads.h>
#include <queues/fifo_queue.h>
#if defined(VITA)
#ifdef VITA
#include <psp2/kernel/processmgr.h>
#include <psp2/kernel/threadmgr.h>
#include <psp2/kernel/sysmem.h>
#include <psp2/audioout.h>
#elif defined(PSP)
#else
#include <pspkernel.h>
#include <pspaudio.h>
#elif defined(ORBIS)
#include <audioout.h>
#define SCE_AUDIO_OUT_PORT_TYPE_MAIN 0
#define SCE_AUDIO_OUT_MODE_STEREO 1
#define SceUID uint32_t
#endif
#include "../../retroarch.h"
#include "../audio_driver.h"
typedef struct psp_audio
{
@@ -71,14 +64,10 @@ static void audioMainLoop(void *data)
{
psp_audio_t* psp = (psp_audio_t*)data;
#if defined(VITA)
#ifdef VITA
int port = sceAudioOutOpenPort(
SCE_AUDIO_OUT_PORT_TYPE_MAIN, AUDIO_OUT_COUNT,
psp->rate, SCE_AUDIO_OUT_MODE_STEREO);
#elif defined(ORBIS)
int port = sceAudioOutOpen(0xff,
SCE_AUDIO_OUT_PORT_TYPE_MAIN, 0, AUDIO_OUT_COUNT,
psp->rate, SCE_AUDIO_OUT_MODE_STEREO);
#else
sceAudioSRCChReserve(AUDIO_OUT_COUNT, psp->rate, 2);
#endif
@@ -106,7 +95,7 @@ static void audioMainLoop(void *data)
scond_signal(psp->cond);
slock_unlock(psp->cond_lock);
#if defined(VITA) || defined(ORBIS)
#ifdef VITA
sceAudioOutOutput(port,
cond ? (psp->zeroBuffer)
: (psp->buffer + read_pos_2));
@@ -116,10 +105,8 @@ static void audioMainLoop(void *data)
#endif
}
#if defined(VITA)
#ifdef VITA
sceAudioOutReleasePort(port);
#elif defined(ORBIS)
sceAudioOutClose(port);
#else
sceAudioSRCChRelease();
#endif
@@ -140,23 +127,12 @@ static void *psp_audio_init(const char *device,
(void)device;
(void)latency;
#ifdef ORBIS
psp->buffer = (uint32_t*)
malloc(AUDIO_BUFFER_SIZE * sizeof(uint32_t));
#else
/* Cache aligned, not necessary but helpful. */
psp->buffer = (uint32_t*)
memalign(64, AUDIO_BUFFER_SIZE * sizeof(uint32_t));
#endif
memset(psp->buffer, 0, AUDIO_BUFFER_SIZE * sizeof(uint32_t));
#ifdef ORBIS
psp->zeroBuffer = (uint32_t*)
malloc(AUDIO_OUT_COUNT * sizeof(uint32_t));
#else
psp->zeroBuffer = (uint32_t*)
memalign(64, AUDIO_OUT_COUNT * sizeof(uint32_t));
#endif
memset(psp->zeroBuffer, 0, AUDIO_OUT_COUNT * sizeof(uint32_t));
psp->read_pos = 0;
@@ -186,7 +162,7 @@ static void psp_audio_free(void *data)
psp->running = false;
sthread_join(psp->worker_thread);
}
if (psp->cond)
scond_free(psp->cond);
if (psp->fifo_lock)
@@ -205,7 +181,7 @@ static ssize_t psp_audio_write(void *data, const void *buf, size_t size)
psp_audio_t* psp = (psp_audio_t*)data;
uint16_t write_pos = psp->write_pos;
uint16_t sampleCount = size / sizeof(uint32_t);
if (!psp->running)
return -1;
@@ -241,6 +217,7 @@ static ssize_t psp_audio_write(void *data, const void *buf, size_t size)
slock_unlock(psp->fifo_lock);
return size;
}
static bool psp_audio_alive(void *data)
@@ -251,6 +228,7 @@ static bool psp_audio_alive(void *data)
return psp->running;
}
static bool psp_audio_stop(void *data)
{
psp_audio_t* psp = (psp_audio_t*)data;
@@ -316,6 +294,7 @@ static size_t psp_buffer_size(void *data)
return AUDIO_BUFFER_SIZE /** sizeof(uint32_t)*/;
}
audio_driver_t audio_psp = {
psp_audio_init,
psp_audio_write,
@@ -325,10 +304,8 @@ audio_driver_t audio_psp = {
psp_audio_set_nonblock_state,
psp_audio_free,
psp_audio_use_float,
#if defined(VITA)
#ifdef VITA
"vita",
#elif defined(ORBIS)
"orbis",
#else
"psp",
#endif
+1 -12
View File
@@ -23,7 +23,7 @@
#include <retro_miscellaneous.h>
#include <retro_endianness.h>
#include "../../retroarch.h"
#include "../audio_driver.h"
#include "../../verbosity.h"
typedef struct
@@ -237,19 +237,12 @@ error:
return NULL;
}
static bool pulse_start(void *data, bool is_shutdown);
static ssize_t pulse_write(void *data, const void *buf_, size_t size)
{
pa_t *pa = (pa_t*)data;
const uint8_t *buf = (const uint8_t*)buf_;
size_t written = 0;
/* Workaround buggy menu code.
* If a write happens while we're paused, we might never progress. */
if (pa->is_paused)
if (!pulse_start(pa, false))
return -1;
pa_threaded_mainloop_lock(pa->mainloop);
while (size)
{
@@ -277,8 +270,6 @@ static bool pulse_stop(void *data)
{
bool ret;
pa_t *pa = (pa_t*)data;
if (pa->is_paused)
return true;
RARCH_LOG("[PulseAudio]: Pausing.\n");
@@ -305,8 +296,6 @@ static bool pulse_start(void *data, bool is_shutdown)
{
bool ret;
pa_t *pa = (pa_t*)data;
if (!pa->is_paused)
return true;
RARCH_LOG("[PulseAudio]: Unpausing.\n");
+1 -1
View File
@@ -23,7 +23,7 @@
#include <boolean.h>
#include "../../retroarch.h"
#include "../audio_driver.h"
#include "../../verbosity.h"
typedef struct
+1 -1
View File
@@ -21,7 +21,7 @@
#include <queues/fifo_queue.h>
#include <rthreads/rthreads.h>
#include "../../retroarch.h"
#include "../audio_driver.h"
#include "rsound.h"
typedef struct rsd
+1 -1
View File
@@ -106,7 +106,7 @@ enum rsd_format
RSD_S32_NE = 0x1000,
RSD_U32_LE = 0x2000,
RSD_U32_BE = 0x4000,
RSD_U32_NE = 0x8000
RSD_U32_NE = 0x8000,
};
/* Defines operations that can be used with rsd_set_param() */
+1 -1
View File
@@ -18,7 +18,7 @@
#include <unistd.h>
#include <boolean.h>
#include "../../retroarch.h"
#include "../audio_driver.h"
/* forward declarations */
unsigned RWebAudioSampleRate(void);
+6 -6
View File
@@ -14,20 +14,20 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <boolean.h>
#include <rthreads/rthreads.h>
#include <queues/fifo_queue.h>
#include <retro_inline.h>
#include <retro_math.h>
#include "../../retroarch.h"
#include "../audio_driver.h"
#include "../../verbosity.h"
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include "SDL.h"
#include "SDL_audio.h"
+6 -4
View File
@@ -20,7 +20,7 @@
#include <stdint.h>
#include "switch_audio_compat.h"
#include "../../retroarch.h"
#include "../audio_driver.h"
#include "../../verbosity.h"
#ifdef HAVE_LIBNX
@@ -94,6 +94,8 @@ static ssize_t switch_audio_write(void *data, const void *buf, size_t size)
{
if (swa->blocking)
{
RARCH_LOG("No buffer, blocking...\n");
while(swa->current_buffer == NULL)
{
uint32_t handle_idx = 0;
@@ -120,7 +122,7 @@ static ssize_t switch_audio_write(void *data, const void *buf, size_t size)
if (to_write > switch_audio_buffer_size(NULL) - swa->current_buffer->data_size)
to_write = switch_audio_buffer_size(NULL) - swa->current_buffer->data_size;
#ifndef HAVE_LIBNX
memcpy(((uint8_t*) swa->current_buffer->sample_data) + swa->current_buffer->data_size, buf, to_write);
#else
@@ -137,7 +139,7 @@ static ssize_t switch_audio_write(void *data, const void *buf, size_t size)
}
swa->last_append = svcGetSystemTick();
return to_write;
}
@@ -328,7 +330,7 @@ static void *switch_audio_init(const char *device,
swa->is_paused = true;
RARCH_LOG("[Audio]: Audio initialized\n");
return swa;
fail_audio_output:
-361
View File
@@ -1,361 +0,0 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2019 - misson20000
* Copyright (C) 2019 - m4xw
* Copyright (C) 2019 - lifajucejo
* Copyright (C) 2019 - p-sam
*
* 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 <string.h>
#include <malloc.h>
#include <stdint.h>
#include <switch.h>
#include "../../retroarch.h"
#include "../../verbosity.h"
#define BUFFER_COUNT 5
static const int sample_rate = 48000;
static const int num_channels = 2;
static const uint8_t sink_channels[] = { 0, 1 };
static const AudioRendererConfig audio_renderer_config =
{
.output_rate = AudioRendererOutputRate_48kHz,
.num_voices = 24,
.num_effects = 0,
.num_sinks = 1,
.num_mix_objs = 1,
.num_mix_buffers = 2,
};
typedef struct {
AudioDriver drv;
void* mempool;
AudioDriverWaveBuf wavebufs[BUFFER_COUNT];
AudioDriverWaveBuf* current_wavebuf;
void* current_pool_ptr;
size_t current_size;
size_t buffer_size;
size_t samples;
Mutex update_lock;
bool nonblocking;
} libnx_audren_t;
static void *libnx_audren_audio_init(const char *device, unsigned rate, unsigned latency,
unsigned block_frames,
unsigned *new_rate)
{
unsigned i, j;
libnx_audren_t *aud;
Result rc;
int mpid;
size_t mempool_size;
unsigned real_latency;
RARCH_LOG("[Audio]: Using libnx_audren driver\n");
aud = (libnx_audren_t*)calloc(1, sizeof(libnx_audren_t));
if (!aud)
{
RARCH_ERR("[Audio]: struct alloc failed\n");
goto fail;
}
real_latency = MAX(5, latency);
RARCH_LOG("[Audio]: real_latency is %u\n", real_latency);
aud->nonblocking = !block_frames;
aud->buffer_size = (real_latency * sample_rate / 1000);
aud->samples = (aud->buffer_size / num_channels / sizeof(int16_t));
aud->current_size = 0;
*new_rate = sample_rate;
mempool_size = (aud->buffer_size * BUFFER_COUNT + (AUDREN_MEMPOOL_ALIGNMENT-1)) &~ (AUDREN_MEMPOOL_ALIGNMENT-1);
aud->mempool = memalign(AUDREN_MEMPOOL_ALIGNMENT, mempool_size);
if (!aud->mempool)
{
RARCH_ERR("[Audio]: mempool alloc failed\n");
goto fail;
}
rc = audrenInitialize(&audio_renderer_config);
if(R_FAILED(rc))
{
RARCH_ERR("[Audio]: audrenInitialize: %x\n", rc);
goto fail;
}
rc = audrvCreate(&aud->drv, &audio_renderer_config, num_channels);
if(R_FAILED(rc))
{
RARCH_ERR("[Audio]: audrvCreate: %x\n", rc);
goto fail_init;
}
for(i = 0; i < BUFFER_COUNT; i++)
{
aud->wavebufs[i].data_raw = aud->mempool;
aud->wavebufs[i].size = mempool_size;
aud->wavebufs[i].start_sample_offset = i * aud->samples;
aud->wavebufs[i].end_sample_offset = aud->wavebufs[i].start_sample_offset + aud->samples;
}
aud->current_wavebuf = NULL;
mpid = audrvMemPoolAdd(&aud->drv, aud->mempool, mempool_size);
audrvMemPoolAttach(&aud->drv, mpid);
audrvDeviceSinkAdd(&aud->drv, AUDREN_DEFAULT_DEVICE_NAME, num_channels, sink_channels);
rc = audrenStartAudioRenderer();
if(R_FAILED(rc))
{
RARCH_ERR("[Audio]: audrenStartAudioRenderer: %x\n", rc);
}
audrvVoiceInit(&aud->drv, 0, num_channels, PcmFormat_Int16, sample_rate);
audrvVoiceSetDestinationMix(&aud->drv, 0, AUDREN_FINAL_MIX_ID);
for(i = 0; i < num_channels; i++)
{
for(j = 0; j < num_channels; j++)
{
audrvVoiceSetMixFactor(&aud->drv, 0, i == j ? 1.0f : 0.0f, i, j);
}
}
mutexInit(&aud->update_lock);
*new_rate = sample_rate;
return aud;
fail_init:
audrenExit();
fail:
if (aud)
{
if (aud->mempool)
{
free(aud->mempool);
}
free(aud);
}
return NULL;
}
static size_t libnx_audren_audio_buffer_size(void *data)
{
libnx_audren_t *aud = (libnx_audren_t*)data;
if (!aud)
return 0;
return aud->buffer_size;
}
static ssize_t libnx_audren_audio_get_free_wavebuf_idx(libnx_audren_t* aud)
{
unsigned i;
for (i = 0; i < BUFFER_COUNT; i++)
{
if (aud->wavebufs[i].state == AudioDriverWaveBufState_Free
|| aud->wavebufs[i].state == AudioDriverWaveBufState_Done)
{
return i;
}
}
return -1;
}
static size_t libnx_audren_audio_append(libnx_audren_t* aud, const void *buf, size_t size)
{
ssize_t free_idx = -1;
if(!aud->current_wavebuf)
{
free_idx = libnx_audren_audio_get_free_wavebuf_idx(aud);
if(free_idx == -1)
return 0;
aud->current_wavebuf = &aud->wavebufs[free_idx];
aud->current_pool_ptr = aud->mempool + (free_idx * aud->buffer_size);
aud->current_size = 0;
}
if(size > aud->buffer_size - aud->current_size)
{
size = aud->buffer_size - aud->current_size;
}
void *dstbuf = aud->current_pool_ptr + aud->current_size;
memcpy(dstbuf, buf, size);
armDCacheFlush(dstbuf, size);
aud->current_size += size;
if(aud->current_size == aud->buffer_size)
{
audrvVoiceAddWaveBuf(&aud->drv, 0, aud->current_wavebuf);
mutexLock(&aud->update_lock);
audrvUpdate(&aud->drv);
mutexUnlock(&aud->update_lock);
if (!audrvVoiceIsPlaying(&aud->drv, 0))
{
audrvVoiceStart(&aud->drv, 0);
}
aud->current_wavebuf = NULL;
}
return size;
}
static ssize_t libnx_audren_audio_write(void *data, const void *buf, size_t size)
{
libnx_audren_t *aud = (libnx_audren_t*)data;
size_t written = 0;
if (!aud)
return -1;
while(written < size)
{
written += libnx_audren_audio_append(aud, buf + written, size - written);
if(written != size)
{
if(aud->nonblocking)
{
break;
}
else
{
mutexLock(&aud->update_lock);
audrvUpdate(&aud->drv);
mutexUnlock(&aud->update_lock);
audrenWaitFrame();
}
}
}
return written;
}
static bool libnx_audren_audio_stop(void *data)
{
libnx_audren_t *aud = (libnx_audren_t*)data;
if (!aud)
return false;
audrvVoiceStop(&aud->drv, 0);
return true;
}
static bool libnx_audren_audio_start(void *data, bool is_shutdown)
{
(void)is_shutdown;
libnx_audren_t *aud = (libnx_audren_t*)data;
if (!aud)
return false;
audrvVoiceStart(&aud->drv, 0);
return true;
}
static bool libnx_audren_audio_alive(void *data)
{
libnx_audren_t *aud = (libnx_audren_t*)data;
if (!aud)
return false;
return true;
}
static void libnx_audren_audio_free(void *data)
{
libnx_audren_t *aud = (libnx_audren_t*)data;
if (!aud)
return;
audrvVoiceStop(&aud->drv, 0);
audrvClose(&aud->drv);
audrenExit();
if (aud->mempool)
{
free(aud->mempool);
}
free(aud);
}
static bool libnx_audren_audio_use_float(void *data)
{
(void)data;
return false; /* force S16 */
}
static size_t libnx_audren_audio_write_avail(void *data)
{
libnx_audren_t *aud = (libnx_audren_t*)data;
size_t avail;
if (!aud || !aud->current_wavebuf)
return 0;
avail = aud->buffer_size - aud->current_size;
return avail;
}
static void libnx_audren_audio_set_nonblock_state(void *data, bool state)
{
libnx_audren_t *aud = (libnx_audren_t*)data;
if (!aud)
return;
aud->nonblocking = state;
}
audio_driver_t audio_switch_libnx_audren = {
libnx_audren_audio_init,
libnx_audren_audio_write,
libnx_audren_audio_stop,
libnx_audren_audio_start,
libnx_audren_audio_alive,
libnx_audren_audio_set_nonblock_state,
libnx_audren_audio_free,
libnx_audren_audio_use_float,
"switch_audren",
NULL, /* device_list_new */
NULL, /* device_list_free */
libnx_audren_audio_write_avail,
libnx_audren_audio_buffer_size,
};
@@ -1,439 +0,0 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2019 - p-sam
*
* 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 <string.h>
#include <malloc.h>
#include <stdint.h>
#include <switch.h>
#include <queues/fifo_queue.h>
#include "../../retroarch.h"
#include "../../verbosity.h"
#include "../../tasks/tasks_internal.h"
#define BUFFER_COUNT 5
static const int sample_rate = 48000;
static const int num_channels = 2;
static const uint8_t sink_channels[] = { 0, 1 };
static const size_t thread_stack_size = 1024 * 8;
static const int thread_preferred_cpu = 2;
static const AudioRendererConfig audio_renderer_config =
{
.output_rate = AudioRendererOutputRate_48kHz,
.num_voices = 24,
.num_effects = 0,
.num_sinks = 1,
.num_mix_objs = 1,
.num_mix_buffers = 2,
};
typedef struct {
AudioDriver drv;
void* mempool;
AudioDriverWaveBuf wavebufs[BUFFER_COUNT];
size_t buffer_size;
size_t samples;
bool nonblocking;
fifo_buffer_t* fifo;
Mutex fifo_lock;
CondVar fifo_condvar;
Mutex fifo_condlock;
Thread thread;
volatile bool running;
volatile bool paused;
} libnx_audren_thread_t;
static void thread_job(void* data)
{
libnx_audren_thread_t *aud = (libnx_audren_thread_t*)data;
size_t available = 0;
size_t current_size = 0;
size_t written_tmp = 0;
AudioDriverWaveBuf* current_wavebuf = NULL;
void* current_pool_ptr = NULL;
void* dstbuf = NULL;
unsigned i;
if (!aud)
return;
while(aud->running)
{
if(!current_wavebuf)
{
for (i = 0; i < BUFFER_COUNT; i++)
{
if (aud->wavebufs[i].state == AudioDriverWaveBufState_Free
|| aud->wavebufs[i].state == AudioDriverWaveBufState_Done)
{
current_wavebuf = &aud->wavebufs[i];
current_pool_ptr = aud->mempool + (i * aud->buffer_size);
current_size = 0;
break;
}
}
}
if(current_wavebuf)
{
mutexLock(&aud->fifo_lock);
available = aud->paused ? 0 : fifo_read_avail(aud->fifo);
written_tmp = MIN(available, aud->buffer_size - current_size);
dstbuf = current_pool_ptr + current_size;
if(written_tmp > 0)
{
fifo_read(aud->fifo, dstbuf, written_tmp);
}
mutexUnlock(&aud->fifo_lock);
if(written_tmp > 0)
{
condvarWakeAll(&aud->fifo_condvar);
current_size += written_tmp;
armDCacheFlush(dstbuf, written_tmp);
}
if(current_size == aud->buffer_size)
{
audrvVoiceAddWaveBuf(&aud->drv, 0, current_wavebuf);
audrvUpdate(&aud->drv);
if (!audrvVoiceIsPlaying(&aud->drv, 0))
{
audrvVoiceStart(&aud->drv, 0);
}
current_wavebuf = NULL;
}
svcSleepThread(1000UL);
}
else
{
audrvUpdate(&aud->drv);
audrenWaitFrame();
}
}
}
static void *libnx_audren_thread_audio_init(const char *device, unsigned rate, unsigned latency,
unsigned block_frames,
unsigned *new_rate)
{
unsigned i, j;
libnx_audren_thread_t *aud;
Result rc;
int mpid;
size_t mempool_size;
unsigned real_latency;
uint32_t thread_priority;
RARCH_LOG("[Audio]: Using libnx_audren_thread driver\n");
aud = (libnx_audren_thread_t*)calloc(1, sizeof(libnx_audren_thread_t));
if (!aud)
{
RARCH_ERR("[Audio]: struct alloc failed\n");
goto fail;
}
real_latency = MAX(latency, 5);
RARCH_LOG("[Audio]: real_latency is %u\n", real_latency);
aud->running = true;
aud->paused = false;
aud->nonblocking = !block_frames;
aud->buffer_size = (real_latency * sample_rate / 1000);
aud->samples = (aud->buffer_size / num_channels / sizeof(int16_t));
mempool_size = (aud->buffer_size * BUFFER_COUNT + (AUDREN_MEMPOOL_ALIGNMENT-1)) &~ (AUDREN_MEMPOOL_ALIGNMENT-1);
aud->mempool = memalign(AUDREN_MEMPOOL_ALIGNMENT, mempool_size);
if (!aud->mempool)
{
RARCH_ERR("[Audio]: mempool alloc failed\n");
goto fail;
}
rc = audrenInitialize(&audio_renderer_config);
if(R_FAILED(rc))
{
RARCH_ERR("[Audio]: audrenInitialize: %x\n", rc);
goto fail;
}
rc = audrvCreate(&aud->drv, &audio_renderer_config, num_channels);
if(R_FAILED(rc))
{
RARCH_ERR("[Audio]: audrvCreate: %x\n", rc);
goto fail_init;
}
for(i = 0; i < BUFFER_COUNT; i++)
{
aud->wavebufs[i].data_raw = aud->mempool;
aud->wavebufs[i].size = mempool_size;
aud->wavebufs[i].start_sample_offset = i * aud->samples;
aud->wavebufs[i].end_sample_offset = aud->wavebufs[i].start_sample_offset + aud->samples;
}
mpid = audrvMemPoolAdd(&aud->drv, aud->mempool, mempool_size);
audrvMemPoolAttach(&aud->drv, mpid);
audrvDeviceSinkAdd(&aud->drv, AUDREN_DEFAULT_DEVICE_NAME, num_channels, sink_channels);
rc = audrenStartAudioRenderer();
if(R_FAILED(rc))
{
RARCH_ERR("[Audio]: audrenStartAudioRenderer: %x\n", rc);
}
audrvVoiceInit(&aud->drv, 0, num_channels, PcmFormat_Int16, sample_rate);
audrvVoiceSetDestinationMix(&aud->drv, 0, AUDREN_FINAL_MIX_ID);
for(i = 0; i < num_channels; i++)
{
for(j = 0; j < num_channels; j++)
{
audrvVoiceSetMixFactor(&aud->drv, 0, i == j ? 1.0f : 0.0f, i, j);
}
}
aud->fifo = fifo_new(aud->buffer_size);
if (!aud->fifo)
{
RARCH_ERR("[Audio]: fifo alloc failed\n");
goto fail_drv;
}
mutexInit(&aud->fifo_lock);
condvarInit(&aud->fifo_condvar);
mutexInit(&aud->fifo_condlock);
svcGetThreadPriority(&thread_priority, CUR_THREAD_HANDLE);
rc = threadCreate(&aud->thread, &thread_job, (void*)aud, thread_stack_size, thread_priority - 1, thread_preferred_cpu);
if(R_FAILED(rc))
{
RARCH_ERR("[Audio]: threadCreate: %x\n", rc);
goto fail_drv;
}
rc = threadStart(&aud->thread);
if(R_FAILED(rc))
{
RARCH_ERR("[Audio]: threadStart: %x\n", rc);
threadClose(&aud->thread);
goto fail_drv;
}
*new_rate = sample_rate;
return aud;
fail_drv:
audrvClose(&aud->drv);
fail_init:
audrenExit();
fail:
if (aud)
{
if (aud->mempool)
{
free(aud->mempool);
}
free(aud);
}
return NULL;
}
static size_t libnx_audren_thread_audio_buffer_size(void *data)
{
libnx_audren_thread_t *aud = (libnx_audren_thread_t*)data;
if (!aud)
return 0;
return aud->buffer_size;
}
static ssize_t libnx_audren_thread_audio_write(void *data, const void *buf, size_t size)
{
libnx_audren_thread_t *aud = (libnx_audren_thread_t*)data;
size_t available, written, written_tmp;
if (!aud || !aud->running)
return -1;
if(aud->paused)
return 0;
if(aud->nonblocking)
{
mutexLock(&aud->fifo_lock);
available = fifo_write_avail(aud->fifo);
written = MIN(available, size);
if(written > 0)
{
fifo_write(aud->fifo, buf, written);
}
mutexUnlock(&aud->fifo_lock);
}
else
{
written = 0;
while (written < size && aud->running)
{
mutexLock(&aud->fifo_lock);
available = fifo_write_avail(aud->fifo);
if(available)
{
written_tmp = MIN(size - written, available);
fifo_write(aud->fifo, (const char*)buf + written, written_tmp);
mutexUnlock(&aud->fifo_lock);
written += written_tmp;
}
else
{
mutexUnlock(&aud->fifo_lock);
mutexLock(&aud->fifo_condlock);
condvarWait(&aud->fifo_condvar, &aud->fifo_condlock);
mutexUnlock(&aud->fifo_condlock);
}
}
}
return written;
}
static bool libnx_audren_thread_audio_stop(void *data)
{
libnx_audren_thread_t *aud = (libnx_audren_thread_t*)data;
if (!aud)
return false;
aud->paused = true;
return true;
}
static bool libnx_audren_thread_audio_start(void *data, bool is_shutdown)
{
(void)is_shutdown;
libnx_audren_thread_t *aud = (libnx_audren_thread_t*)data;
if (!aud)
return false;
aud->paused = false;
return true;
}
static bool libnx_audren_thread_audio_alive(void *data)
{
libnx_audren_thread_t *aud = (libnx_audren_thread_t*)data;
if (!aud)
return false;
return true;
}
static void libnx_audren_thread_audio_free(void *data)
{
libnx_audren_thread_t *aud = (libnx_audren_thread_t*)data;
if (!aud)
return;
aud->running = false;
mutexUnlock(&aud->fifo_lock);
threadWaitForExit(&aud->thread);
threadClose(&aud->thread);
audrvVoiceStop(&aud->drv, 0);
audrvClose(&aud->drv);
audrenExit();
if (aud->mempool)
{
free(aud->mempool);
}
if (aud->fifo)
{
fifo_clear(aud->fifo);
fifo_free(aud->fifo);
}
free(aud);
}
static bool libnx_audren_thread_audio_use_float(void *data)
{
(void)data;
return false; /* force S16 */
}
static size_t libnx_audren_thread_audio_write_avail(void *data)
{
libnx_audren_thread_t *aud = (libnx_audren_thread_t*)data;
size_t available;
if (!aud)
return 0;
mutexLock(&aud->fifo_lock);
available = fifo_write_avail(aud->fifo);
mutexUnlock(&aud->fifo_lock);
return available;
}
static void libnx_audren_thread_audio_set_nonblock_state(void *data, bool state)
{
libnx_audren_thread_t *aud = (libnx_audren_thread_t*)data;
if (!aud)
return;
aud->nonblocking = state;
}
audio_driver_t audio_switch_libnx_audren_thread = {
libnx_audren_thread_audio_init,
libnx_audren_thread_audio_write,
libnx_audren_thread_audio_stop,
libnx_audren_thread_audio_start,
libnx_audren_thread_audio_alive,
libnx_audren_thread_audio_set_nonblock_state,
libnx_audren_thread_audio_free,
libnx_audren_thread_audio_use_float,
"switch_audren_thread",
NULL, /* device_list_new */
NULL, /* device_list_free */
libnx_audren_thread_audio_write_avail,
libnx_audren_thread_audio_buffer_size,
};
+3 -2
View File
@@ -28,7 +28,7 @@
#endif
#include <queues/fifo_queue.h>
#include "../../retroarch.h"
#include "../audio_driver.h"
#include "../../verbosity.h"
#include "../../tasks/tasks_internal.h"
@@ -80,6 +80,7 @@ static void mainLoop(void* data)
RARCH_LOG("[Audio]: start mainLoop cpu %u tid %u\n", svcGetCurrentProcessorNumber(), swa->thread.handle);
while (swa->running)
{
size_t buf_avail, avail, to_write;
@@ -237,7 +238,7 @@ static void *switch_thread_audio_init(const char *device, unsigned rate, unsigne
if (switch_audio_ipc_output_append_buffer(swa, &swa->buffers[i]) != 0)
goto fail_audio_output;
}
compat_mutex_create(&swa->fifoLock);
swa->fifo = fifo_new(swa->fifoSize);
+76 -74
View File
@@ -64,7 +64,7 @@
#include <retro_inline.h>
#include <retro_endianness.h>
#include "../../retroarch.h"
#include "../audio_driver.h"
#include "../../verbosity.h"
/* Implementation tinyalsa pcm */
@@ -174,17 +174,17 @@
#define SNDRV_PCM_IOCTL_LINK _IOW('A', 0x60, int)
#define SNDRV_PCM_IOCTL_UNLINK _IO('A', 0x61)
#define SNDRV_PCM_ACCESS_MMAP_INTERLEAVED (( tinyalsa_snd_pcm_access_t) 0) /* interleaved mmap */
#define SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED (( tinyalsa_snd_pcm_access_t) 1) /* noninterleaved mmap */
#define SNDRV_PCM_ACCESS_MMAP_COMPLEX (( tinyalsa_snd_pcm_access_t) 2) /* complex mmap */
#define SNDRV_PCM_ACCESS_RW_INTERLEAVED (( tinyalsa_snd_pcm_access_t) 3) /* readi/writei */
#define SNDRV_PCM_ACCESS_RW_NONINTERLEAVED (( tinyalsa_snd_pcm_access_t) 4) /* readn/writen */
#define SNDRV_PCM_ACCESS_MMAP_INTERLEAVED (( snd_pcm_access_t) 0) /* interleaved mmap */
#define SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED (( snd_pcm_access_t) 1) /* noninterleaved mmap */
#define SNDRV_PCM_ACCESS_MMAP_COMPLEX (( snd_pcm_access_t) 2) /* complex mmap */
#define SNDRV_PCM_ACCESS_RW_INTERLEAVED (( snd_pcm_access_t) 3) /* readi/writei */
#define SNDRV_PCM_ACCESS_RW_NONINTERLEAVED (( snd_pcm_access_t) 4) /* readn/writen */
#define SNDRV_PCM_ACCESS_LAST SNDRV_PCM_ACCESS_RW_NONINTERLEAVED
#define SNDRV_PCM_SUBFORMAT_STD (( tinyalsa_snd_pcm_subformat_t) 0)
#define SNDRV_PCM_SUBFORMAT_STD (( snd_pcm_subformat_t) 0)
#define SNDRV_PCM_SUBFORMAT_LAST SNDRV_PCM_SUBFORMAT_STD
#define SNDRV_PCM_SUBFORMAT_STD (( tinyalsa_snd_pcm_subformat_t) 0)
#define SNDRV_PCM_SUBFORMAT_STD (( snd_pcm_subformat_t) 0)
#define SNDRV_PCM_SUBFORMAT_LAST SNDRV_PCM_SUBFORMAT_STD
#define SNDRV_PCM_INFO_MMAP 0x00000001 /* hardware supports mmap */
#define SNDRV_PCM_INFO_MMAP_VALID 0x00000002 /* period data are valid during transfer */
@@ -203,15 +203,15 @@
#define SNDRV_PCM_INFO_NO_PERIOD_WAKEUP 0x00800000 /* period wakeup can be disabled */
#define SNDRV_PCM_INFO_HAS_WALL_CLOCK 0x01000000 /* has audio wall clock for audio/system time sync */
#define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000 /* internal kernel flag - FIFO size is in frames */
#define SNDRV_PCM_STATE_OPEN (( tinyalsa_snd_pcm_state_t) 0) /* stream is open */
#define SNDRV_PCM_STATE_SETUP (( tinyalsa_snd_pcm_state_t) 1) /* stream has a setup */
#define SNDRV_PCM_STATE_PREPARED (( tinyalsa_snd_pcm_state_t) 2) /* stream is ready to start */
#define SNDRV_PCM_STATE_RUNNING (( tinyalsa_snd_pcm_state_t) 3) /* stream is running */
#define SNDRV_PCM_STATE_XRUN (( tinyalsa_snd_pcm_state_t) 4) /* stream reached an xrun */
#define SNDRV_PCM_STATE_DRAINING (( tinyalsa_snd_pcm_state_t) 5) /* stream is draining */
#define SNDRV_PCM_STATE_PAUSED (( tinyalsa_snd_pcm_state_t) 6) /* stream is paused */
#define SNDRV_PCM_STATE_SUSPENDED (( tinyalsa_snd_pcm_state_t) 7) /* hardware is suspended */
#define SNDRV_PCM_STATE_DISCONNECTED (( tinyalsa_snd_pcm_state_t) 8) /* hardware is disconnected */
#define SNDRV_PCM_STATE_OPEN (( snd_pcm_state_t) 0) /* stream is open */
#define SNDRV_PCM_STATE_SETUP (( snd_pcm_state_t) 1) /* stream has a setup */
#define SNDRV_PCM_STATE_PREPARED (( snd_pcm_state_t) 2) /* stream is ready to start */
#define SNDRV_PCM_STATE_RUNNING (( snd_pcm_state_t) 3) /* stream is running */
#define SNDRV_PCM_STATE_XRUN (( snd_pcm_state_t) 4) /* stream reached an xrun */
#define SNDRV_PCM_STATE_DRAINING (( snd_pcm_state_t) 5) /* stream is draining */
#define SNDRV_PCM_STATE_PAUSED (( snd_pcm_state_t) 6) /* stream is paused */
#define SNDRV_PCM_STATE_SUSPENDED (( snd_pcm_state_t) 7) /* hardware is suspended */
#define SNDRV_PCM_STATE_DISCONNECTED (( snd_pcm_state_t) 8) /* hardware is disconnected */
#define SNDRV_PCM_STATE_LAST SNDRV_PCM_STATE_DISCONNECTED
#define SNDRV_PCM_HW_PARAM_ACCESS 0 /* Access type */
@@ -237,53 +237,53 @@
#define SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER (1<<1) /* export buffer */
#define SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP (1<<2) /* disable period wakeups */
#define SNDRV_PCM_FORMAT_S8 (( tinyalsa_snd_pcm_format_t) 0)
#define SNDRV_PCM_FORMAT_U8 (( tinyalsa_snd_pcm_format_t) 1)
#define SNDRV_PCM_FORMAT_S16_LE (( tinyalsa_snd_pcm_format_t) 2)
#define SNDRV_PCM_FORMAT_S16_BE (( tinyalsa_snd_pcm_format_t) 3)
#define SNDRV_PCM_FORMAT_U16_LE (( tinyalsa_snd_pcm_format_t) 4)
#define SNDRV_PCM_FORMAT_U16_BE (( tinyalsa_snd_pcm_format_t) 5)
#define SNDRV_PCM_FORMAT_S24_LE (( tinyalsa_snd_pcm_format_t) 6) /* low three bytes */
#define SNDRV_PCM_FORMAT_S24_BE (( tinyalsa_snd_pcm_format_t) 7) /* low three bytes */
#define SNDRV_PCM_FORMAT_U24_LE (( tinyalsa_snd_pcm_format_t) 8) /* low three bytes */
#define SNDRV_PCM_FORMAT_U24_BE (( tinyalsa_snd_pcm_format_t) 9) /* low three bytes */
#define SNDRV_PCM_FORMAT_S32_LE (( tinyalsa_snd_pcm_format_t) 10)
#define SNDRV_PCM_FORMAT_S32_BE (( tinyalsa_snd_pcm_format_t) 11)
#define SNDRV_PCM_FORMAT_U32_LE (( tinyalsa_snd_pcm_format_t) 12)
#define SNDRV_PCM_FORMAT_U32_BE (( tinyalsa_snd_pcm_format_t) 13)
#define SNDRV_PCM_FORMAT_FLOAT_LE (( tinyalsa_snd_pcm_format_t) 14) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
#define SNDRV_PCM_FORMAT_FLOAT_BE (( tinyalsa_snd_pcm_format_t) 15) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
#define SNDRV_PCM_FORMAT_FLOAT64_LE (( tinyalsa_snd_pcm_format_t) 16) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
#define SNDRV_PCM_FORMAT_FLOAT64_BE (( tinyalsa_snd_pcm_format_t) 17) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE (( tinyalsa_snd_pcm_format_t) 18) /* IEC-958 subframe, Little Endian */
#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE (( tinyalsa_snd_pcm_format_t) 19) /* IEC-958 subframe, Big Endian */
#define SNDRV_PCM_FORMAT_MU_LAW (( tinyalsa_snd_pcm_format_t) 20)
#define SNDRV_PCM_FORMAT_A_LAW (( tinyalsa_snd_pcm_format_t) 21)
#define SNDRV_PCM_FORMAT_IMA_ADPCM (( tinyalsa_snd_pcm_format_t) 22)
#define SNDRV_PCM_FORMAT_MPEG (( tinyalsa_snd_pcm_format_t) 23)
#define SNDRV_PCM_FORMAT_GSM (( tinyalsa_snd_pcm_format_t) 24)
#define SNDRV_PCM_FORMAT_SPECIAL (( tinyalsa_snd_pcm_format_t) 31)
#define SNDRV_PCM_FORMAT_S24_3LE (( tinyalsa_snd_pcm_format_t) 32) /* in three bytes */
#define SNDRV_PCM_FORMAT_S24_3BE (( tinyalsa_snd_pcm_format_t) 33) /* in three bytes */
#define SNDRV_PCM_FORMAT_U24_3LE (( tinyalsa_snd_pcm_format_t) 34) /* in three bytes */
#define SNDRV_PCM_FORMAT_U24_3BE (( tinyalsa_snd_pcm_format_t) 35) /* in three bytes */
#define SNDRV_PCM_FORMAT_S20_3LE (( tinyalsa_snd_pcm_format_t) 36) /* in three bytes */
#define SNDRV_PCM_FORMAT_S20_3BE (( tinyalsa_snd_pcm_format_t) 37) /* in three bytes */
#define SNDRV_PCM_FORMAT_U20_3LE (( tinyalsa_snd_pcm_format_t) 38) /* in three bytes */
#define SNDRV_PCM_FORMAT_U20_3BE (( tinyalsa_snd_pcm_format_t) 39) /* in three bytes */
#define SNDRV_PCM_FORMAT_S18_3LE (( tinyalsa_snd_pcm_format_t) 40) /* in three bytes */
#define SNDRV_PCM_FORMAT_S18_3BE (( tinyalsa_snd_pcm_format_t) 41) /* in three bytes */
#define SNDRV_PCM_FORMAT_U18_3LE (( tinyalsa_snd_pcm_format_t) 42) /* in three bytes */
#define SNDRV_PCM_FORMAT_U18_3BE (( tinyalsa_snd_pcm_format_t) 43) /* in three bytes */
#define SNDRV_PCM_FORMAT_G723_24 (( tinyalsa_snd_pcm_format_t) 44) /* 8 samples in 3 bytes */
#define SNDRV_PCM_FORMAT_G723_24_1B (( tinyalsa_snd_pcm_format_t) 45) /* 1 sample in 1 byte */
#define SNDRV_PCM_FORMAT_G723_40 (( tinyalsa_snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */
#define SNDRV_PCM_FORMAT_G723_40_1B (( tinyalsa_snd_pcm_format_t) 47) /* 1 sample in 1 byte */
#define SNDRV_PCM_FORMAT_DSD_U8 (( tinyalsa_snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */
#define SNDRV_PCM_FORMAT_DSD_U16_LE (( tinyalsa_snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */
#define SNDRV_PCM_FORMAT_DSD_U32_LE (( tinyalsa_snd_pcm_format_t) 50) /* DSD, 4-byte samples DSD (x32), little endian */
#define SNDRV_PCM_FORMAT_DSD_U16_BE (( tinyalsa_snd_pcm_format_t) 51) /* DSD, 2-byte samples DSD (x16), big endian */
#define SNDRV_PCM_FORMAT_DSD_U32_BE (( tinyalsa_snd_pcm_format_t) 52) /* DSD, 4-byte samples DSD (x32), big endian */
#define SNDRV_PCM_FORMAT_S8 (( snd_pcm_format_t) 0)
#define SNDRV_PCM_FORMAT_U8 (( snd_pcm_format_t) 1)
#define SNDRV_PCM_FORMAT_S16_LE (( snd_pcm_format_t) 2)
#define SNDRV_PCM_FORMAT_S16_BE (( snd_pcm_format_t) 3)
#define SNDRV_PCM_FORMAT_U16_LE (( snd_pcm_format_t) 4)
#define SNDRV_PCM_FORMAT_U16_BE (( snd_pcm_format_t) 5)
#define SNDRV_PCM_FORMAT_S24_LE (( snd_pcm_format_t) 6) /* low three bytes */
#define SNDRV_PCM_FORMAT_S24_BE (( snd_pcm_format_t) 7) /* low three bytes */
#define SNDRV_PCM_FORMAT_U24_LE (( snd_pcm_format_t) 8) /* low three bytes */
#define SNDRV_PCM_FORMAT_U24_BE (( snd_pcm_format_t) 9) /* low three bytes */
#define SNDRV_PCM_FORMAT_S32_LE (( snd_pcm_format_t) 10)
#define SNDRV_PCM_FORMAT_S32_BE (( snd_pcm_format_t) 11)
#define SNDRV_PCM_FORMAT_U32_LE (( snd_pcm_format_t) 12)
#define SNDRV_PCM_FORMAT_U32_BE (( snd_pcm_format_t) 13)
#define SNDRV_PCM_FORMAT_FLOAT_LE (( snd_pcm_format_t) 14) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
#define SNDRV_PCM_FORMAT_FLOAT_BE (( snd_pcm_format_t) 15) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
#define SNDRV_PCM_FORMAT_FLOAT64_LE (( snd_pcm_format_t) 16) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
#define SNDRV_PCM_FORMAT_FLOAT64_BE (( snd_pcm_format_t) 17) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE (( snd_pcm_format_t) 18) /* IEC-958 subframe, Little Endian */
#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE (( snd_pcm_format_t) 19) /* IEC-958 subframe, Big Endian */
#define SNDRV_PCM_FORMAT_MU_LAW (( snd_pcm_format_t) 20)
#define SNDRV_PCM_FORMAT_A_LAW (( snd_pcm_format_t) 21)
#define SNDRV_PCM_FORMAT_IMA_ADPCM (( snd_pcm_format_t) 22)
#define SNDRV_PCM_FORMAT_MPEG (( snd_pcm_format_t) 23)
#define SNDRV_PCM_FORMAT_GSM (( snd_pcm_format_t) 24)
#define SNDRV_PCM_FORMAT_SPECIAL (( snd_pcm_format_t) 31)
#define SNDRV_PCM_FORMAT_S24_3LE (( snd_pcm_format_t) 32) /* in three bytes */
#define SNDRV_PCM_FORMAT_S24_3BE (( snd_pcm_format_t) 33) /* in three bytes */
#define SNDRV_PCM_FORMAT_U24_3LE (( snd_pcm_format_t) 34) /* in three bytes */
#define SNDRV_PCM_FORMAT_U24_3BE (( snd_pcm_format_t) 35) /* in three bytes */
#define SNDRV_PCM_FORMAT_S20_3LE (( snd_pcm_format_t) 36) /* in three bytes */
#define SNDRV_PCM_FORMAT_S20_3BE (( snd_pcm_format_t) 37) /* in three bytes */
#define SNDRV_PCM_FORMAT_U20_3LE (( snd_pcm_format_t) 38) /* in three bytes */
#define SNDRV_PCM_FORMAT_U20_3BE (( snd_pcm_format_t) 39) /* in three bytes */
#define SNDRV_PCM_FORMAT_S18_3LE (( snd_pcm_format_t) 40) /* in three bytes */
#define SNDRV_PCM_FORMAT_S18_3BE (( snd_pcm_format_t) 41) /* in three bytes */
#define SNDRV_PCM_FORMAT_U18_3LE (( snd_pcm_format_t) 42) /* in three bytes */
#define SNDRV_PCM_FORMAT_U18_3BE (( snd_pcm_format_t) 43) /* in three bytes */
#define SNDRV_PCM_FORMAT_G723_24 (( snd_pcm_format_t) 44) /* 8 samples in 3 bytes */
#define SNDRV_PCM_FORMAT_G723_24_1B (( snd_pcm_format_t) 45) /* 1 sample in 1 byte */
#define SNDRV_PCM_FORMAT_G723_40 (( snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */
#define SNDRV_PCM_FORMAT_G723_40_1B (( snd_pcm_format_t) 47) /* 1 sample in 1 byte */
#define SNDRV_PCM_FORMAT_DSD_U8 (( snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */
#define SNDRV_PCM_FORMAT_DSD_U16_LE (( snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */
#define SNDRV_PCM_FORMAT_DSD_U32_LE (( snd_pcm_format_t) 50) /* DSD, 4-byte samples DSD (x32), little endian */
#define SNDRV_PCM_FORMAT_DSD_U16_BE (( snd_pcm_format_t) 51) /* DSD, 2-byte samples DSD (x16), big endian */
#define SNDRV_PCM_FORMAT_DSD_U32_BE (( snd_pcm_format_t) 52) /* DSD, 4-byte samples DSD (x32), big endian */
#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_BE
#define SNDRV_MASK_MAX 256
@@ -296,6 +296,7 @@
#define SNDRV_PCM_MMAP_OFFSET_STATUS 0x80000000
#define SNDRV_PCM_MMAP_OFFSET_CONTROL 0x81000000
/** Audio sample format of a PCM.
* The first letter specifiers whether the sample is signed or unsigned.
* The letter 'S' means signed. The letter 'U' means unsigned.
@@ -427,10 +428,10 @@ enum
typedef unsigned long snd_pcm_uframes_t;
typedef signed long snd_pcm_sframes_t;
typedef int snd_pcm_hw_param_t;
typedef int __bitwise tinyalsa_snd_pcm_access_t;
typedef int __bitwise tinyalsa_snd_pcm_subformat_t;
typedef int __bitwise tinyalsa_snd_pcm_state_t;
typedef int __bitwise tinyalsa_snd_pcm_format_t;
typedef int __bitwise snd_pcm_access_t;
typedef int __bitwise snd_pcm_subformat_t;
typedef int __bitwise snd_pcm_state_t;
typedef int __bitwise snd_pcm_format_t;
/** A bit mask of 256 bits (32 bytes) that describes some hardware parameters of a PCM */
struct pcm_mask
@@ -448,11 +449,11 @@ union snd_pcm_sync_id
struct snd_pcm_mmap_status
{
tinyalsa_snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */
snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */
int pad1; /* Needed for 64 bit alignment */
snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */
struct timespec tstamp; /* Timestamp */
tinyalsa_snd_pcm_state_t suspended_state; /* RO: suspended stream state */
snd_pcm_state_t suspended_state; /* RO: suspended stream state */
struct timespec audio_tstamp; /* from sample counter or wall clock */
};
@@ -591,7 +592,7 @@ struct snd_xfern
struct snd_pcm_status
{
tinyalsa_snd_pcm_state_t state; /* stream state */
snd_pcm_state_t state; /* stream state */
struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */
struct timespec tstamp; /* reference timestamp */
snd_pcm_uframes_t appl_ptr; /* appl ptr */
@@ -600,7 +601,7 @@ struct snd_pcm_status
snd_pcm_uframes_t avail; /* number of frames available */
snd_pcm_uframes_t avail_max; /* max frames available on hw since last status */
snd_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */
tinyalsa_snd_pcm_state_t suspended_state; /* suspended stream state */
snd_pcm_state_t suspended_state; /* suspended stream state */
__u32 reserved_alignment; /* must be filled with zero */
struct timespec audio_tstamp; /* from sample counter or wall clock */
unsigned char reserved[56-sizeof(struct timespec)]; /* must be filled with zero */
@@ -2169,9 +2170,10 @@ static void * tinyalsa_init(const char *devicestr, unsigned rate,
unsigned int device = 0;
unsigned int frames_per_ms = 0;
unsigned int orig_rate = rate;
unsigned int max_rate, min_rate, buffer_size;
unsigned int max_rate, min_rate;
float initial_latency;
snd_pcm_uframes_t buffer_size;
struct pcm_config config;
tinyalsa_t *tinyalsa = (tinyalsa_t*)calloc(1, sizeof(tinyalsa_t));
@@ -2257,7 +2259,7 @@ static void * tinyalsa_init(const char *devicestr, unsigned rate,
RARCH_LOG("[TINYALSA]: Can pause: %s.\n", tinyalsa->can_pause ? "yes" : "no");
RARCH_LOG("[TINYALSA]: Audio rate: %uHz.\n", config.rate);
RARCH_LOG("[TINYALSA]: Buffer size: %u frames.\n", buffer_size);
RARCH_LOG("[TINYALSA]: Buffer size: %u bytes.\n", (unsigned int)tinyalsa->buffer_size);
RARCH_LOG("[TINYALSA]: Buffer size: %u bytes.\n", tinyalsa->buffer_size);
RARCH_LOG("[TINYALSA]: Frame size: %u bytes.\n", tinyalsa->frame_bits / 8);
RARCH_LOG("[TINYALSA]: Latency: %ums.\n", buffer_size * 1000 / (rate * 4));
+351 -154
View File
@@ -15,17 +15,126 @@
#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 <lists/string_list.h>
#include <queues/fifo_queue.h>
#include <string/stdstring.h>
#include "../common/mmdevice_common.h"
#include "../common/mmdevice_common_inline.h"
#include "../../retroarch.h"
#include "../audio_driver.h"
#include "../../verbosity.h"
#include "../../configuration.h"
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
#define WASAPI_WARN(bool_exp, err_str, warn_exp) \
if (!(bool_exp)) { \
RARCH_WARN("[WASAPI]: %s.\n", err_str); \
warn_exp; }
#define WASAPI_CHECK(bool_exp, err_str, err_exp) \
if (!(bool_exp)) { \
RARCH_ERR("[WASAPI]: %s.\n", err_str); \
err_exp; }
#define WASAPI_HR_CHECK(hr, fun_str, err_exp) \
if (FAILED(hr)) { \
RARCH_ERR("[WASAPI]: %s failed with error 0x%.8X.\n", fun_str, hr); \
err_exp; }
#define WASAPI_HR_WARN(hr, fun_str, warn_exp) \
if (FAILED(hr)) { \
RARCH_WARN("[WASAPI]: %s failed with error 0x%.8X.\n", fun_str, hr); \
warn_exp; }
#define WASAPI_SR_CHECK(bool_exp, fun_str, err_exp) \
if (!(bool_exp)) { \
RARCH_ERR("[WASAPI]: %s failed with error %d.\n", fun_str, GetLastError()); \
err_exp; }
#ifdef __cplusplus
#define WASAPI_RELEASE(iface) \
if(iface) \
{ \
iface->Release(); \
iface = NULL; \
}
#else
#define WASAPI_RELEASE(iface) \
if(iface) \
{ \
iface->lpVtbl->Release(iface);\
iface = NULL; \
}
#endif
#define WASAPI_FREE(ptr)\
if(ptr) {\
free(ptr);\
ptr = NULL; }\
#define WASAPI_CO_FREE(ptr)\
if(ptr) {\
CoTaskMemFree(ptr);\
ptr = NULL; }\
typedef struct
{
bool exclusive;
@@ -40,6 +149,38 @@ typedef struct
fifo_buffer_t *buffer; /* NULL in unbuffered shared mode */
} wasapi_t;
static bool wasapi_check_device_id(IMMDevice *device, const char *id)
{
HRESULT hr;
bool result = false;
LPWSTR dev_id = NULL, dev_cmp_id = NULL;
int id_length = MultiByteToWideChar(CP_ACP, 0, id, -1, NULL, 0);
WASAPI_SR_CHECK(id_length > 0, "MultiByteToWideChar", goto error);
dev_cmp_id = (LPWSTR)malloc(id_length * sizeof(WCHAR));
WASAPI_CHECK(dev_cmp_id, "Out of memory", goto error);
id_length = MultiByteToWideChar(CP_ACP, 0, id, -1, dev_cmp_id, id_length);
WASAPI_SR_CHECK(id_length > 0, "MultiByteToWideChar", goto error);
hr = _IMMDevice_GetId(device, &dev_id);
WASAPI_HR_CHECK(hr, "IMMDevice::GetId", goto error);
result = lstrcmpW(dev_cmp_id, dev_id) == 0 ? true : false;
WASAPI_CO_FREE(dev_id);
WASAPI_FREE(dev_cmp_id);
return result;
error:
WASAPI_CO_FREE(dev_id);
WASAPI_FREE(dev_cmp_id);
return false;
}
static IMMDevice *wasapi_init_device(const char *id)
{
HRESULT hr;
@@ -64,85 +205,48 @@ static IMMDevice *wasapi_init_device(const char *id)
hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL,
&IID_IMMDeviceEnumerator, (void **)&enumerator);
#endif
if (FAILED(hr))
goto error;
WASAPI_HR_CHECK(hr, "CoCreateInstance", goto error);
if (id)
{
int32_t idx_found = -1;
struct string_list *list = (struct string_list*)mmdevice_list_new(NULL);
/* Search for device name first */
if (list)
{
if (list->elems)
{
unsigned i;
for (i = 0; i < list->size; i++)
{
RARCH_LOG("[WASAPI]: %d : %s\n", i, list->elems[i].data);
if (string_is_equal(id, list->elems[i].data))
{
idx_found = i;
break;
}
}
/* Index was not found yet based on name string,
* just assume id is a one-character number index. */
if (idx_found == -1 && isdigit(id[0]))
{
idx_found = strtoul(id, NULL, 0);
RARCH_LOG("[WASAPI]: Fallback, device index is a single number index instead: %d.\n", idx_found);
}
}
string_list_free(list);
}
if (idx_found == -1)
idx_found = 0;
hr = _IMMDeviceEnumerator_EnumAudioEndpoints(enumerator,
eRender, DEVICE_STATE_ACTIVE, &collection);
if (FAILED(hr))
goto error;
WASAPI_HR_CHECK(hr, "IMMDeviceEnumerator::EnumAudioEndpoints",
goto error);
hr = _IMMDeviceCollection_GetCount(collection, &dev_count);
if (FAILED(hr))
goto error;
WASAPI_HR_CHECK(hr, "IMMDeviceCollection::GetCount", goto error);
for (i = 0; i < dev_count; ++i)
{
hr = _IMMDeviceCollection_Item(collection, i, &device);
if (FAILED(hr))
goto error;
WASAPI_HR_CHECK(hr, "IMMDeviceCollection::Item", continue);
if (i == idx_found)
if (wasapi_check_device_id(device, id))
break;
IFACE_RELEASE(device);
WASAPI_RELEASE(device);
}
}
else
{
hr = _IMMDeviceEnumerator_GetDefaultAudioEndpoint(
enumerator, eRender, eConsole, &device);
if (FAILED(hr))
goto error;
WASAPI_HR_CHECK(hr, "IMMDeviceEnumerator::GetDefaultAudioEndpoint",
goto error);
}
if (!device)
goto error;
IFACE_RELEASE(collection);
IFACE_RELEASE(enumerator);
WASAPI_RELEASE(collection);
WASAPI_RELEASE(enumerator);
return device;
error:
IFACE_RELEASE(collection);
IFACE_RELEASE(enumerator);
WASAPI_RELEASE(collection);
WASAPI_RELEASE(enumerator);
if (id)
{
@@ -158,7 +262,7 @@ error:
static unsigned wasapi_pref_rate(unsigned i)
{
const unsigned r[] = { 48000, 44100, 96000, 192000, 32000 };
const unsigned r[] = { 48000, 44100, 96000, 192000 };
if (i >= sizeof(r) / sizeof(unsigned))
return 0;
@@ -204,8 +308,7 @@ static IAudioClient *wasapi_init_client_sh(IMMDevice *device,
HRESULT hr = _IMMDevice_Activate(device,
IID_IAudioClient,
CLSCTX_ALL, NULL, (void**)&client);
if (FAILED(hr))
return NULL;
WASAPI_HR_CHECK(hr, "IMMDevice::Activate", return NULL);
/* once for float, once for pcm (requested first) */
for (i = 0; i < 2; ++i)
@@ -234,12 +337,11 @@ static IAudioClient *wasapi_init_client_sh(IMMDevice *device,
if (hr == AUDCLNT_E_ALREADY_INITIALIZED)
{
HRESULT hr;
IFACE_RELEASE(client);
WASAPI_RELEASE(client);
hr = _IMMDevice_Activate(device,
IID_IAudioClient,
CLSCTX_ALL, NULL, (void**)&client);
if (FAILED(hr))
return NULL;
WASAPI_HR_CHECK(hr, "IMMDevice::Activate", return NULL);
#ifdef __cplusplus
hr = client->Initialize(AUDCLNT_SHAREMODE_SHARED,
@@ -264,8 +366,7 @@ static IAudioClient *wasapi_init_client_sh(IMMDevice *device,
}
}
if (FAILED(hr))
goto error;
WASAPI_HR_CHECK(hr, "IAudioClient::Initialize", goto error);
*float_fmt = float_fmt_res;
*rate = rate_res;
@@ -273,7 +374,7 @@ static IAudioClient *wasapi_init_client_sh(IMMDevice *device,
return client;
error:
IFACE_RELEASE(client);
WASAPI_RELEASE(client);
return NULL;
}
@@ -292,12 +393,10 @@ static IAudioClient *wasapi_init_client_ex(IMMDevice *device,
HRESULT hr = _IMMDevice_Activate(device,
IID_IAudioClient,
CLSCTX_ALL, NULL, (void**)&client);
if (FAILED(hr))
return NULL;
WASAPI_HR_CHECK(hr, "IMMDevice::Activate", return NULL);
hr = _IAudioClient_GetDevicePeriod(client, NULL, &minimum_period);
if (FAILED(hr))
goto error;
WASAPI_HR_CHECK(hr, "IAudioClient::GetDevicePeriod", goto error);
/* buffer_duration is in 100ns units */
buffer_duration = latency * 10000.0;
@@ -330,15 +429,13 @@ static IAudioClient *wasapi_init_client_ex(IMMDevice *device,
if (hr == AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED)
{
hr = _IAudioClient_GetBufferSize(client, &buffer_length);
if (FAILED(hr))
goto error;
WASAPI_HR_CHECK(hr, "IAudioClient::GetBufferSize", goto error);
IFACE_RELEASE(client);
WASAPI_RELEASE(client);
hr = _IMMDevice_Activate(device,
IID_IAudioClient,
CLSCTX_ALL, NULL, (void**)&client);
if (FAILED(hr))
return NULL;
WASAPI_HR_CHECK(hr, "IMMDevice::Activate", return NULL);
buffer_duration = 10000.0 * 1000.0 / rate_res * buffer_length + 0.5;
#ifdef __cplusplus
@@ -353,12 +450,11 @@ static IAudioClient *wasapi_init_client_ex(IMMDevice *device,
}
if (hr == AUDCLNT_E_ALREADY_INITIALIZED)
{
IFACE_RELEASE(client);
WASAPI_RELEASE(client);
hr = _IMMDevice_Activate(device,
IID_IAudioClient,
CLSCTX_ALL, NULL, (void**)&client);
if (FAILED(hr))
return NULL;
WASAPI_HR_CHECK(hr, "IMMDevice::Activate", return NULL);
#ifdef __cplusplus
hr = client->Initialize(AUDCLNT_SHAREMODE_EXCLUSIVE,
@@ -372,11 +468,11 @@ static IAudioClient *wasapi_init_client_ex(IMMDevice *device,
}
if (hr != AUDCLNT_E_UNSUPPORTED_FORMAT)
{
if (hr == AUDCLNT_E_DEVICE_IN_USE)
goto error;
WASAPI_WARN(hr != AUDCLNT_E_DEVICE_IN_USE,
"Device already in use", goto error);
if (hr == AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED)
goto error;
WASAPI_WARN(hr != AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED,
"Exclusive mode disabled", goto error);
i = 2; /* break from outer loop too */
break;
@@ -389,8 +485,7 @@ static IAudioClient *wasapi_init_client_ex(IMMDevice *device,
}
}
if (FAILED(hr))
goto error;
WASAPI_HR_CHECK(hr, "IAudioClient::Initialize", goto error);
*float_fmt = float_fmt_res;
*rate = rate_res;
@@ -398,7 +493,7 @@ static IAudioClient *wasapi_init_client_ex(IMMDevice *device,
return client;
error:
IFACE_RELEASE(client);
WASAPI_RELEASE(client);
return NULL;
}
@@ -434,8 +529,7 @@ static IAudioClient *wasapi_init_client(IMMDevice *device, bool *exclusive,
}
}
if (!client)
return NULL;
WASAPI_CHECK(client, "Failed to initialize client", return NULL);
/* next calls are allowed to fail (we losing info only) */
@@ -486,6 +580,7 @@ static void *wasapi_init(const char *dev_id, unsigned rate, unsigned latency,
unsigned u1, unsigned *u2)
{
HRESULT hr;
bool com_initialized = false;
UINT32 frame_count = 0;
REFERENCE_TIME dev_period = 0;
BYTE *dest = NULL;
@@ -493,12 +588,16 @@ static void *wasapi_init(const char *dev_id, unsigned rate, unsigned latency,
bool float_format = settings->bools.audio_wasapi_float_format;
int sh_buffer_length = settings->ints.audio_wasapi_sh_buffer_length;
wasapi_t *w = (wasapi_t*)calloc(1, sizeof(wasapi_t));
if (!w)
return NULL;
w->exclusive = settings->bools.audio_wasapi_exclusive_mode;
w->device = wasapi_init_device(dev_id);
WASAPI_CHECK(w, "Out of memory", return NULL);
hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
WASAPI_HR_CHECK(hr, "CoInitializeEx", goto error);
com_initialized = true;
w->device = wasapi_init_device(dev_id);
if (!w->device && dev_id)
w->device = wasapi_init_device(NULL);
if (!w->device)
@@ -510,17 +609,14 @@ static void *wasapi_init(const char *dev_id, unsigned rate, unsigned latency,
goto error;
hr = _IAudioClient_GetBufferSize(w->client, &frame_count);
if (FAILED(hr))
goto error;
WASAPI_HR_CHECK(hr, "IAudioClient::GetBufferSize", goto error);
w->frame_size = float_format ? 8 : 4;
w->frame_size = float_format ? 8 : 4;
w->engine_buffer_size = frame_count * w->frame_size;
if (w->exclusive)
{
w->buffer = fifo_new(w->engine_buffer_size);
if (!w->buffer)
goto error;
WASAPI_CHECK(w->buffer, "Out of memory", goto error);
RARCH_LOG("[WASAPI]: Intermediate buffer length is %u frames (%.1fms).\n",
frame_count, (double)frame_count * 1000.0 / rate);
@@ -530,15 +626,13 @@ static void *wasapi_init(const char *dev_id, unsigned rate, unsigned latency,
if (sh_buffer_length < 0)
{
hr = _IAudioClient_GetDevicePeriod(w->client, &dev_period, NULL);
if (FAILED(hr))
goto error;
WASAPI_HR_CHECK(hr, "IAudioClient::GetDevicePeriod", goto error);
sh_buffer_length = dev_period * rate / 10000000;
}
w->buffer = fifo_new(sh_buffer_length * w->frame_size);
if (!w->buffer)
goto error;
WASAPI_CHECK(w->buffer, "Out of memory", goto error);
RARCH_LOG("[WASAPI]: Intermediate buffer length is %u frames (%.1fms).\n",
sh_buffer_length, (double)sh_buffer_length * 1000.0 / rate);
@@ -549,45 +643,41 @@ static void *wasapi_init(const char *dev_id, unsigned rate, unsigned latency,
}
w->write_event = CreateEventA(NULL, FALSE, FALSE, NULL);
if (!w->write_event)
goto error;
WASAPI_SR_CHECK(w->write_event, "CreateEventA", goto error);
hr = _IAudioClient_SetEventHandle(w->client, w->write_event);
if (FAILED(hr))
goto error;
WASAPI_HR_CHECK(hr, "IAudioClient::SetEventHandle", goto error);
hr = _IAudioClient_GetService(w->client,
IID_IAudioRenderClient, (void**)&w->renderer);
if (FAILED(hr))
goto error;
WASAPI_HR_CHECK(hr, "IAudioClient::GetService", goto error);
hr = _IAudioRenderClient_GetBuffer(w->renderer, frame_count, &dest);
if (FAILED(hr))
goto error;
WASAPI_HR_CHECK(hr, "IAudioRenderClient::GetBuffer", goto error);
hr = _IAudioRenderClient_ReleaseBuffer(
w->renderer, frame_count,
AUDCLNT_BUFFERFLAGS_SILENT);
if (FAILED(hr))
goto error;
WASAPI_HR_CHECK(hr, "IAudioRenderClient::ReleaseBuffer", goto error);
hr = _IAudioClient_Start(w->client);
if (FAILED(hr))
goto error;
w->running = true;
WASAPI_HR_CHECK(hr, "IAudioClient::Start", goto error);
w->running = true;
w->blocking = settings->bools.audio_sync;
return w;
error:
IFACE_RELEASE(w->renderer);
IFACE_RELEASE(w->client);
IFACE_RELEASE(w->device);
WASAPI_RELEASE(w->renderer);
WASAPI_RELEASE(w->client);
WASAPI_RELEASE(w->device);
if (w->write_event)
CloseHandle(w->write_event);
if (w->buffer)
fifo_free(w->buffer);
free(w);
if (com_initialized)
CoUninitialize();
return NULL;
}
@@ -598,15 +688,13 @@ static bool wasapi_flush(wasapi_t * w, const void * data, size_t size)
UINT32 frame_count = size / w->frame_size;
HRESULT hr = _IAudioRenderClient_GetBuffer(
w->renderer, frame_count, &dest);
if (FAILED(hr))
return false;
WASAPI_HR_CHECK(hr, "IAudioRenderClient::GetBuffer", return false)
memcpy(dest, data, size);
hr = _IAudioRenderClient_ReleaseBuffer(
w->renderer, frame_count,
0);
if (FAILED(hr))
return false;
WASAPI_HR_CHECK(hr, "IAudioRenderClient::ReleaseBuffer", return false);
return true;
}
@@ -617,15 +705,13 @@ static bool wasapi_flush_buffer(wasapi_t * w, size_t size)
UINT32 frame_count = size / w->frame_size;
HRESULT hr = _IAudioRenderClient_GetBuffer(
w->renderer, frame_count, &dest);
if (FAILED(hr))
return false;
WASAPI_HR_CHECK(hr, "IAudioRenderClient::GetBuffer", return false)
fifo_read(w->buffer, dest, size);
hr = _IAudioRenderClient_ReleaseBuffer(
w->renderer, frame_count,
0);
if (FAILED(hr))
return false;
WASAPI_HR_CHECK(hr, "IAudioRenderClient::ReleaseBuffer", return false);
return true;
}
@@ -648,20 +734,20 @@ static ssize_t wasapi_write_sh(wasapi_t *w, const void * data, size_t size)
if (w->blocking)
{
ir = WaitForSingleObject(w->write_event, INFINITE);
if (!(ir == WAIT_OBJECT_0))
return -1;
WASAPI_SR_CHECK(ir == WAIT_OBJECT_0, "WaitForSingleObject", return -1);
}
hr = _IAudioClient_GetCurrentPadding(w->client, &padding);
if (FAILED(hr))
return -1;
WASAPI_HR_CHECK(hr, "IAudioClient::GetCurrentPadding", return -1);
read_avail = fifo_read_avail(w->buffer);
write_avail = w->engine_buffer_size - padding * w->frame_size;
written = read_avail < write_avail ? read_avail : write_avail;
if (written)
{
if (!wasapi_flush_buffer(w, written))
return -1;
}
}
write_avail = fifo_write_avail(w->buffer);
@@ -674,13 +760,11 @@ static ssize_t wasapi_write_sh(wasapi_t *w, const void * data, size_t size)
if (w->blocking)
{
ir = WaitForSingleObject(w->write_event, INFINITE);
if (!(ir == WAIT_OBJECT_0))
return -1;
WASAPI_SR_CHECK(ir == WAIT_OBJECT_0, "WaitForSingleObject", return -1);
}
hr = _IAudioClient_GetCurrentPadding(w->client, &padding);
if (FAILED(hr))
return -1;
WASAPI_HR_CHECK(hr, "IAudioClient::GetCurrentPadding", return -1);
write_avail = w->engine_buffer_size - padding * w->frame_size;
if (!write_avail)
@@ -688,8 +772,10 @@ static ssize_t wasapi_write_sh(wasapi_t *w, const void * data, size_t size)
written = size < write_avail ? size : write_avail;
if (written)
{
if (!wasapi_flush(w, data, written))
return -1;
}
}
return written;
@@ -697,19 +783,20 @@ static ssize_t wasapi_write_sh(wasapi_t *w, const void * data, size_t size)
static ssize_t wasapi_write_ex(wasapi_t *w, const void * data, size_t size)
{
ssize_t written = 0;
ssize_t writen = 0;
size_t write_avail = fifo_write_avail(w->buffer);
if (!write_avail)
{
DWORD ir = WaitForSingleObject(
w->write_event, w->blocking ? INFINITE : 0);
if (ir != WAIT_OBJECT_0)
if (ir != WAIT_OBJECT_0 && w->blocking)
{
if (w->blocking)
return -1;
return 0;
RARCH_ERR("[WASAPI]: WaitForSingleObject failed with error %d.\n", GetLastError());
return -1;
}
if (ir != WAIT_OBJECT_0)
return 0;
if (!wasapi_flush_buffer(w, w->engine_buffer_size))
return -1;
@@ -717,10 +804,10 @@ static ssize_t wasapi_write_ex(wasapi_t *w, const void * data, size_t size)
write_avail = w->engine_buffer_size;
}
written = size < write_avail ? size : write_avail;
fifo_write(w->buffer, data, written);
writen = size < write_avail ? size : write_avail;
fifo_write(w->buffer, data, writen);
return written;
return writen;
}
static ssize_t wasapi_write(void *wh, const void *data, size_t size)
@@ -753,8 +840,7 @@ static bool wasapi_stop(void *wh)
{
wasapi_t *w = (wasapi_t*)wh;
HRESULT hr = _IAudioClient_Stop(w->client);
if (FAILED(hr))
return !w->running;
WASAPI_HR_CHECK(hr, "IAudioClient::Stop", return !w->running);
w->running = false;
@@ -769,8 +855,7 @@ static bool wasapi_start(void *wh, bool u)
if (hr == AUDCLNT_E_NOT_STOPPED)
return true;
if (FAILED(hr))
return w->running;
WASAPI_HR_CHECK(hr, "IAudioClient::Start", return w->running);
w->running = true;
@@ -799,11 +884,12 @@ static void wasapi_free(void *wh)
wasapi_t *w = (wasapi_t*)wh;
HANDLE write_event = w->write_event;
IFACE_RELEASE(w->renderer);
WASAPI_RELEASE(w->renderer);
if (w->client)
_IAudioClient_Stop(w->client);
IFACE_RELEASE(w->client);
IFACE_RELEASE(w->device);
WASAPI_RELEASE(w->client);
WASAPI_RELEASE(w->device);
CoUninitialize();
if (w->buffer)
fifo_free(w->buffer);
free(w);
@@ -815,8 +901,7 @@ static void wasapi_free(void *wh)
}
/* If event isn't signaled log and leak */
if (!(ir == WAIT_OBJECT_0))
return;
WASAPI_CHECK(ir == WAIT_OBJECT_0, "Memory leak in wasapi_free", return);
CloseHandle(write_event);
}
@@ -828,12 +913,125 @@ static bool wasapi_use_float(void *wh)
return w->frame_size == 8;
}
static void *wasapi_device_list_new(void *u)
{
HRESULT hr;
UINT i;
PROPVARIANT prop_var;
int ir;
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 prop_var_init = false;
bool br = false;
char *dev_id_str = NULL;
char *dev_name_str = NULL;
struct string_list *sl = string_list_new();
WASAPI_CHECK(sl, "string_list_new failed", 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
WASAPI_HR_CHECK(hr, "CoCreateInstance", goto error);
hr = _IMMDeviceEnumerator_EnumAudioEndpoints(enumerator,
eRender, DEVICE_STATE_ACTIVE, &collection);
WASAPI_HR_CHECK(hr, "IMMDeviceEnumerator::EnumAudioEndpoints", goto error);
hr = _IMMDeviceCollection_GetCount(collection, &dev_count);
WASAPI_HR_CHECK(hr, "IMMDeviceCollection::GetCount", goto error);
for (i = 0; i < dev_count; ++i)
{
hr = _IMMDeviceCollection_Item(collection, i, &device);
WASAPI_HR_CHECK(hr, "IMMDeviceCollection::Item", goto error);
hr = _IMMDevice_GetId(device, &dev_id_wstr);
WASAPI_HR_CHECK(hr, "IMMDevice::GetId", goto error);
ir = WideCharToMultiByte(CP_ACP, 0, dev_id_wstr, -1,
NULL, 0, NULL, NULL);
WASAPI_SR_CHECK(ir, "WideCharToMultiByte", goto error);
dev_id_str = (char *)malloc(ir);
WASAPI_CHECK(dev_id_str, "Out of memory", goto error);
ir = WideCharToMultiByte(CP_ACP, 0, dev_id_wstr, -1,
dev_id_str, ir, NULL, NULL);
WASAPI_SR_CHECK(ir, "WideCharToMultiByte", goto error);
hr = _IMMDevice_OpenPropertyStore(device, STGM_READ, &prop_store);
WASAPI_HR_CHECK(hr, "IMMDevice::OpenPropertyStore", goto error);
PropVariantInit(&prop_var);
prop_var_init = true;
hr = _IPropertyStore_GetValue(prop_store, PKEY_Device_FriendlyName,
&prop_var);
WASAPI_HR_CHECK(hr, "IPropertyStore::GetValue", goto error);
ir = WideCharToMultiByte(CP_ACP, 0, prop_var.pwszVal, -1,
NULL, 0, NULL, NULL);
WASAPI_SR_CHECK(ir, "WideCharToMultiByte", goto error);
dev_name_str = (char *)malloc(ir);
WASAPI_CHECK(dev_name_str, "Out of memory", goto error);
ir = WideCharToMultiByte(CP_ACP, 0, prop_var.pwszVal, -1,
dev_name_str, ir, NULL, NULL);
WASAPI_SR_CHECK(ir, "WideCharToMultiByte", goto error);
RARCH_LOG("[WASAPI]: %s %s\n", dev_name_str, dev_id_str);
br = string_list_append(sl, dev_id_str, attr);
WASAPI_CHECK(br, "string_list_append failed", goto error);
PropVariantClear(&prop_var);
prop_var_init = false;
WASAPI_CO_FREE(dev_id_wstr);
WASAPI_FREE(dev_id_str);
WASAPI_FREE(dev_name_str);
WASAPI_RELEASE(prop_store);
WASAPI_RELEASE(device);
}
WASAPI_RELEASE(collection);
WASAPI_RELEASE(enumerator);
return sl;
error:
WASAPI_FREE(dev_id_str);
WASAPI_FREE(dev_name_str);
if (prop_var_init)
PropVariantClear(&prop_var);
WASAPI_RELEASE(prop_store);
WASAPI_CO_FREE(dev_id_wstr);
WASAPI_RELEASE(device);
WASAPI_RELEASE(collection);
WASAPI_RELEASE(enumerator);
if (sl)
string_list_free(sl);
RARCH_ERR("[WASAPI]: Device enumeration failed.\n");
return NULL;
}
static void wasapi_device_list_free(void *u, void *slp)
{
struct string_list *sl = (struct string_list*)slp;
if (sl)
string_list_free(sl);
string_list_free(sl);
}
static size_t wasapi_write_avail(void *wh)
@@ -846,8 +1044,7 @@ static size_t wasapi_write_avail(void *wh)
return fifo_write_avail(w->buffer);
hr = _IAudioClient_GetCurrentPadding(w->client, &padding);
if (FAILED(hr))
return 0;
WASAPI_HR_CHECK(hr, "IAudioClient::GetCurrentPadding", return 0);
return w->engine_buffer_size - padding * w->frame_size;
}
@@ -872,7 +1069,7 @@ audio_driver_t audio_wasapi = {
wasapi_free,
wasapi_use_float,
"wasapi",
mmdevice_list_new,
wasapi_device_list_new,
wasapi_device_list_free,
wasapi_write_avail,
wasapi_buffer_size
+4 -3
View File
@@ -21,10 +21,10 @@
#include <wiiu/os.h>
#include <wiiu/ax.h>
#include "../../wiiu/wiiu_dbg.h"
#include "../../wiiu/system/memory.h"
#include "wiiu/wiiu_dbg.h"
#include "wiiu/system/memory.h"
#include "../../retroarch.h"
#include "audio/audio_driver.h"
typedef struct
{
@@ -318,6 +318,7 @@ static size_t ax_audio_buffer_size(void* data)
return AX_AUDIO_COUNT;
}
audio_driver_t audio_ax =
{
ax_audio_init,
+95 -180
View File
@@ -28,9 +28,6 @@
#include <compat/msvc.h>
#include <retro_miscellaneous.h>
#include <string/stdstring.h>
#include <encodings/utf.h>
#include <lists/string_list.h>
#if defined(_MSC_VER) && (_WIN32_WINNT <= _WIN32_WINNT_WIN2K)
/* needed for CoInitializeEx */
@@ -39,11 +36,7 @@
#include "xaudio.h"
#if (_WIN32_WINNT >= 0x0602 /*_WIN32_WINNT_WIN8*/)
#include "../common/mmdevice_common.h"
#endif
#include "../../retroarch.h"
#include "../audio_driver.h"
#include "../../verbosity.h"
typedef struct xaudio2 xaudio2_t;
@@ -66,9 +59,6 @@ typedef struct
size_t bufsize;
} xa_t;
/* Forward declarations */
static void *xa_list_new(void *u);
#if defined(__cplusplus) && !defined(CINTERFACE)
struct xaudio2 : public IXAudio2VoiceCallback
#else
@@ -136,6 +126,29 @@ const struct IXAudio2VoiceCallbackVtbl voice_vtable = {
};
#endif
#if 0
static void xaudio2_enumerate_devices(xaudio2_t *xa)
{
uint32_t dev_count = 0;
unsigned i = 0;
(void)xa;
(void)i;
(void)dev_count;
#ifndef _XBOX
IXAudio2_GetDeviceCount(xa->pXAudio2, &dev_count);
fprintf(stderr, "XAudio2 devices:\n");
for (i = 0; i < dev_count; i++)
{
XAUDIO2_DEVICE_DETAILS dev_detail;
IXAudio2_GetDeviceDetails(xa->pXAudio2, i, &dev_detail);
fwprintf(stderr, L"\t%u: %s\n", i, dev_detail.DisplayName);
}
#endif
}
#endif
static void xaudio2_set_wavefmt(WAVEFORMATEX *wfx,
unsigned channels, unsigned samplerate)
{
@@ -184,22 +197,24 @@ static void xaudio2_free(xaudio2_t *handle)
}
static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels,
size_t size, const char *device)
size_t size, unsigned device)
{
int32_t idx_found = -1;
WAVEFORMATEX wfx = {0};
struct string_list *list = NULL;
xaudio2_t *handle = NULL;
WAVEFORMATEX wfx = {0};
#ifndef _XBOX
CoInitializeEx(0, COINIT_MULTITHREADED);
#endif
#if defined(__cplusplus) && !defined(CINTERFACE)
xaudio2_t *handle = new xaudio2;
handle = new xaudio2;
#else
xaudio2_t *handle = (xaudio2_t*)calloc(1, sizeof(*handle));
handle = (xaudio2_t*)calloc(1, sizeof(*handle));
#endif
if (!handle)
goto error;
list = (struct string_list*)xa_list_new(NULL);
#if !defined(__cplusplus) || defined(CINTERFACE)
handle->lpVtbl = &voice_vtable;
#endif
@@ -207,58 +222,8 @@ static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels,
if (FAILED(XAudio2Create(&handle->pXAudio2, 0, XAUDIO2_DEFAULT_PROCESSOR)))
goto error;
if (device)
{
/* Search for device name first */
if (list && list->elems)
{
if (list->elems)
{
unsigned i;
for (i = 0; i < list->size; i++)
{
if (string_is_equal(device, list->elems[i].data))
{
idx_found = i;
break;
}
}
/* Index was not found yet based on name string,
* just assume id is a one-character number index. */
if (idx_found == -1)
{
if (isdigit(device[0]))
{
RARCH_LOG("[XAudio2]: Fallback, device index is a single number index instead: %d.\n", idx_found);
idx_found = strtoul(device, NULL, 0);
}
}
}
}
}
if (idx_found == -1)
idx_found = 0;
#if (_WIN32_WINNT >= 0x0602 /*_WIN32_WINNT_WIN8*/)
{
wchar_t *temp = NULL;
if (device)
temp = utf8_to_utf16_string_alloc((const char*)list->elems[idx_found].userdata);
if (FAILED(IXAudio2_CreateMasteringVoice(handle->pXAudio2, &handle->pMasterVoice, channels, samplerate, 0, (LPCWSTR)(uintptr_t)temp, NULL, AudioCategory_GameEffects)))
{
free(temp);
goto error;
}
if (temp)
free(temp);
}
#else
if (FAILED(IXAudio2_CreateMasteringVoice(handle->pXAudio2, &handle->pMasterVoice, channels, samplerate, 0, idx_found, NULL)))
if (FAILED(IXAudio2_CreateMasteringVoice(handle->pXAudio2, &handle->pMasterVoice, channels, samplerate, 0, device, NULL)))
goto error;
#endif
xaudio2_set_wavefmt(&wfx, channels, samplerate);
@@ -281,65 +246,16 @@ static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels,
XAUDIO2_COMMIT_NOW)))
goto error;
if (list)
string_list_free(list);
return handle;
error:
if (list)
string_list_free(list);
xaudio2_free(handle);
return NULL;
}
static void *xa_init(const char *device, unsigned rate, unsigned latency,
unsigned block_frames,
unsigned *new_rate)
static size_t xaudio2_write(xaudio2_t *handle, const uint8_t *buffer, size_t bytes_)
{
size_t bufsize;
xa_t *xa = (xa_t*)calloc(1, sizeof(*xa));
if (!xa)
return NULL;
if (latency < 8)
latency = 8; /* Do not allow shenanigans. */
bufsize = latency * rate / 1000;
RARCH_LOG("[XAudio2]: Requesting %u ms latency, using %d ms latency.\n",
latency, (int)bufsize * 1000 / rate);
xa->bufsize = bufsize * 2 * sizeof(float);
xa->xa = xaudio2_new(rate, 2, xa->bufsize, device);
if (!xa->xa)
{
RARCH_ERR("Failed to init XAudio2.\n");
free(xa);
return NULL;
}
return xa;
}
static ssize_t xa_write(void *data, const void *buf, size_t size)
{
unsigned bytes;
xa_t *xa = (xa_t*)data;
xaudio2_t *handle = xa->xa;
const uint8_t *buffer = (const uint8_t*)buf;
if (xa->nonblock)
{
size_t avail = XAUDIO2_WRITE_AVAILABLE(xa->xa);
if (avail == 0)
return 0;
if (avail < size)
size = avail;
}
bytes = size;
unsigned bytes = bytes_;
while (bytes)
{
@@ -372,11 +288,7 @@ static ssize_t xa_write(void *data, const void *buf, size_t size)
if (FAILED(IXAudio2SourceVoice_SubmitSourceBuffer(
handle->pSourceVoice, &xa2buffer, NULL)))
{
if (size > 0)
return -1;
return 0;
}
InterlockedIncrement((LONG volatile*)&handle->buffers);
handle->bufptr = 0;
@@ -384,7 +296,62 @@ static ssize_t xa_write(void *data, const void *buf, size_t size)
}
}
return size;
return bytes_;
}
static void *xa_init(const char *device, unsigned rate, unsigned latency,
unsigned block_frames,
unsigned *new_rate)
{
size_t bufsize;
unsigned device_index = 0;
xa_t *xa = (xa_t*)calloc(1, sizeof(*xa));
if (!xa)
return NULL;
if (latency < 8)
latency = 8; /* Do not allow shenanigans. */
bufsize = latency * rate / 1000;
RARCH_LOG("XAudio2: Requesting %u ms latency, using %d ms latency.\n",
latency, (int)bufsize * 1000 / rate);
xa->bufsize = bufsize * 2 * sizeof(float);
if (device)
device_index = strtoul(device, NULL, 0);
xa->xa = xaudio2_new(rate, 2, xa->bufsize, device_index);
if (!xa->xa)
{
RARCH_ERR("Failed to init XAudio2.\n");
free(xa);
return NULL;
}
return xa;
}
static ssize_t xa_write(void *data, const void *buf, size_t size)
{
size_t ret;
xa_t *xa = (xa_t*)data;
if (xa->nonblock)
{
size_t avail = XAUDIO2_WRITE_AVAILABLE(xa->xa);
if (avail == 0)
return 0;
if (avail < size)
size = avail;
}
ret = xaudio2_write(xa->xa, (const uint8_t*)buf, size);
if (ret == 0 && size > 0)
return -1;
return ret;
}
static bool xa_stop(void *data)
@@ -446,58 +413,6 @@ static size_t xa_buffer_size(void *data)
return xa->bufsize;
}
static void xa_device_list_free(void *u, void *slp)
{
struct string_list *sl = (struct string_list*)slp;
if (sl)
string_list_free(sl);
}
static void *xa_list_new(void *u)
{
#if defined(_XBOX) || !(_WIN32_WINNT >= 0x0602 /*_WIN32_WINNT_WIN8*/)
unsigned i;
union string_list_elem_attr attr;
uint32_t dev_count = 0;
IXAudio2 *ixa2 = NULL;
struct string_list *sl = string_list_new();
if (!sl)
return NULL;
attr.i = 0;
if (FAILED(XAudio2Create(&ixa2, 0, XAUDIO2_DEFAULT_PROCESSOR)))
return NULL;
IXAudio2_GetDeviceCount(ixa2, &dev_count);
for (i = 0; i < dev_count; i++)
{
XAUDIO2_DEVICE_DETAILS dev_detail;
if (IXAudio2_GetDeviceDetails(ixa2, i, &dev_detail) == S_OK)
{
char *str = utf16_to_utf8_string_alloc(dev_detail.DisplayName);
if (str)
{
string_list_append(sl, str, attr);
free(str);
}
}
}
IXAudio2_Release(ixa2);
return sl;
#elif defined(__WINRT__)
return NULL;
#else
return mmdevice_list_new(u);
#endif
}
audio_driver_t audio_xa = {
xa_init,
xa_write,
@@ -508,8 +423,8 @@ audio_driver_t audio_xa = {
xa_free,
xa_use_float,
"xaudio",
xa_list_new,
xa_device_list_free,
NULL,
NULL,
xa_write_avail,
xa_buffer_size,
};
+348 -10
View File
@@ -1,5 +1,7 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2018 - Krzysztof Haładyn
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2017 - Daniel De Matteis
* Copyright (C) 2010-2014 - OV2
*
* 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-
@@ -13,14 +15,350 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#if (_WIN32_WINNT >= 0x0602 /*_WIN32_WINNT_WIN8*/)
/* XAudio 2.7 it part of the old DirectX SDKs. XAudio 2.8+ is part of the
* Windows OS itself (starting from Windows 8). Since UWP lets you access
* only libraries that are built-in to the OS, the headers had to be
* upgraded to the newer version to get audio support working. */
#include "xaudio29.h"
/* Kinda stripped down. Only contains the bare essentials used in RetroArch. */
#ifndef XAUDIO2_STRIPPED_H
#define XAUDIO2_STRIPPED_H
#include <retro_inline.h>
#include <retro_environment.h>
/* All structures defined in this file use tight field packing */
#pragma pack(push, 1)
#if defined(__cplusplus) && !defined(CINTERFACE)
#define X2DEFAULT(x) = (x)
#else
/* The old version still has to be there since XAudio 2.8 is not available
* on Windows 7 and earlier */
#include "xaudio27.h"
#define X2DEFAULT(x)
#endif
#ifdef _XBOX
#include <xtl.h>
#ifndef __cplusplus
#define OPAQUE interface
#endif
#define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
DEFINE_GUID(CLSID_##className, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8)
#define DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
DEFINE_GUID(IID_##interfaceName, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8)
DEFINE_CLSID(XAudio2, 3eda9b49, 2085, 498b, 9b, b2, 39, a6, 77, 84, 93, de);
DEFINE_CLSID(XAudio2_Debug, 47199894, 7cc2, 444d, 98, 73, ce, d2, 56, 2c, c6, 0e);
DEFINE_IID(IXAudio2, 8bcf1f58, 9fe7, 4583, 8a, c6, e2, ad, c4, 65, c8, bb);
#include <audiodefs.h> /* Basic audio data types and constants */
#else
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <basetyps.h>
#include <objbase.h>
#include <mmreg.h>
#ifndef __cplusplus
#undef OPAQUE
#define OPAQUE struct
#endif
#define DEFINE_GUID_X(n, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
static const GUID n = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
#define DEFINE_CLSID_X(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
DEFINE_GUID_X(CLSID_##className, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8)
#define DEFINE_IID_X(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
DEFINE_GUID_X(IID_##interfaceName, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8)
#ifndef __cplusplus
#ifndef INTERFACE
#define INTERFACE void
#endif
#endif
DEFINE_CLSID_X(XAudio2, 5a508685, a254, 4fba, 9b, 82, 9a, 24, b0, 03, 06, af); /* 2.7 */
DEFINE_IID_X(IXAudio2, 8bcf1f58, 9fe7, 4583, 8a, c6, e2, ad, c4, 65, c8, bb);
#endif
#ifdef _XBOX
#define XAUDIO2_DEFAULT_FREQ_RATIO 2.0f
#else
#define XAUDIO2_DEFAULT_FREQ_RATIO 4.0f
#endif
#define XAUDIO2_COMMIT_NOW 0
#define XAUDIO2_DEFAULT_CHANNELS 0
#define XAUDIO2_DEFAULT_SAMPLERATE 0
#define XAUDIO2_DEBUG_ENGINE 0x0001
#define XAUDIO2_VOICE_NOSRC 0x0004
typedef enum XAUDIO2_DEVICE_ROLE
{
NotDefaultDevice = 0x0,
DefaultConsoleDevice = 0x1,
DefaultMultimediaDevice = 0x2,
DefaultCommunicationsDevice = 0x4,
DefaultGameDevice = 0x8,
GlobalDefaultDevice = 0xf,
InvalidDeviceRole = ~GlobalDefaultDevice
} XAUDIO2_DEVICE_ROLE;
#ifdef _XBOX
typedef enum XAUDIO2_XBOX_HWTHREAD_SPECIFIER
{
XboxThread0 = 0x01,
XboxThread1 = 0x02,
XboxThread2 = 0x04,
XboxThread3 = 0x08,
XboxThread4 = 0x10,
XboxThread5 = 0x20,
XAUDIO2_ANY_PROCESSOR = XboxThread4,
XAUDIO2_DEFAULT_PROCESSOR = XAUDIO2_ANY_PROCESSOR
} XAUDIO2_XBOX_HWTHREAD_SPECIFIER, XAUDIO2_PROCESSOR;
#else
typedef enum XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER
{
#if defined(__STDC_C89__)
XAUDIO2_ANY_PROCESSOR = 0xffff,
#else
XAUDIO2_ANY_PROCESSOR = 0xffffffff,
#endif
XAUDIO2_DEFAULT_PROCESSOR = XAUDIO2_ANY_PROCESSOR
} XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER, XAUDIO2_PROCESSOR;
#endif
typedef enum XAUDIO2_FILTER_TYPE {
LowPassFilter,
BandPassFilter,
HighPassFilter
} XAUDIO2_FILTER_TYPE;
typedef struct XAUDIO2_DEVICE_DETAILS
{
WCHAR DeviceID[256];
WCHAR DisplayName[256];
XAUDIO2_DEVICE_ROLE Role;
WAVEFORMATEXTENSIBLE OutputFormat;
} XAUDIO2_DEVICE_DETAILS;
/* Forward declarations. */
#ifdef __cplusplus
struct XAUDIO2_VOICE_DETAILS;
struct XAUDIO2_VOICE_SENDS;
struct XAUDIO2_EFFECT_DESCRIPTOR;
struct XAUDIO2_EFFECT_CHAIN;
struct XAUDIO2_FILTER_PARAMETERS;
struct XAUDIO2_BUFFER_WMA;
struct XAUDIO2_VOICE_STATE;
struct XAUDIO2_PERFORMANCE_DATA;
struct XAUDIO2_DEBUG_CONFIGURATION;
struct IXAudio2EngineCallback;
struct IXAudio2SubmixVoice;
#else
typedef OPAQUE XAUDIO2_VOICE_DETAILS XAUDIO2_VOICE_DETAILS;
typedef OPAQUE XAUDIO2_VOICE_SENDS XAUDIO2_VOICE_SENDS;
typedef OPAQUE XAUDIO2_EFFECT_DESCRIPTOR XAUDIO2_EFFECT_DESCRIPTOR;
typedef OPAQUE XAUDIO2_EFFECT_CHAIN XAUDIO2_EFFECT_CHAIN;
typedef OPAQUE XAUDIO2_FILTER_PARAMETERS XAUDIO2_FILTER_PARAMETERS;
typedef OPAQUE XAUDIO2_BUFFER_WMA XAUDIO2_BUFFER_WMA;
typedef OPAQUE XAUDIO2_VOICE_STATE XAUDIO2_VOICE_STATE;
typedef OPAQUE XAUDIO2_PERFORMANCE_DATA XAUDIO2_PERFORMANCE_DATA;
typedef OPAQUE XAUDIO2_DEBUG_CONFIGURATION XAUDIO2_DEBUG_CONFIGURATION;
typedef OPAQUE IXAudio2EngineCallback IXAudio2EngineCallback;
typedef OPAQUE IXAudio2SubmixVoice IXAudio2SubmixVoice;
#endif
typedef struct XAUDIO2_BUFFER
{
UINT32 Flags;
UINT32 AudioBytes;
const BYTE* pAudioData;
UINT32 PlayBegin;
UINT32 PlayLength;
UINT32 LoopBegin;
UINT32 LoopLength;
UINT32 LoopCount;
void *pContext;
} XAUDIO2_BUFFER;
#undef INTERFACE
#define INTERFACE IXAudio2VoiceCallback
DECLARE_INTERFACE(IXAudio2VoiceCallback)
{
STDMETHOD_(void, OnVoiceProcessingPassStart) (THIS_ UINT32 BytesRequired) PURE;
STDMETHOD_(void, OnVoiceProcessingPassEnd) (THIS) PURE;
STDMETHOD_(void, OnStreamEnd) (THIS) PURE;
STDMETHOD_(void, OnBufferStart) (THIS_ void *pBufferContext) PURE;
STDMETHOD_(void, OnBufferEnd) (THIS_ void *pBufferContext) PURE;
STDMETHOD_(void, OnLoopEnd) (THIS_ void *pBufferContext) PURE;
STDMETHOD_(void, OnVoiceError) (THIS_ void *pBufferContext, HRESULT Error) PURE;
};
#undef INTERFACE
#define INTERFACE IXAudio2Voice
DECLARE_INTERFACE(IXAudio2Voice)
{
#define Declare_IXAudio2Voice_Methods() \
STDMETHOD_(void, GetVoiceDetails) (THIS_ XAUDIO2_VOICE_DETAILS* pVoiceDetails) PURE; \
STDMETHOD(SetOutputVoices) (THIS_ const XAUDIO2_VOICE_SENDS* pSendList) PURE; \
STDMETHOD(SetEffectChain) (THIS_ const XAUDIO2_EFFECT_CHAIN* pEffectChain) PURE; \
STDMETHOD(EnableEffect) (THIS_ UINT32 EffectIndex, \
UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \
STDMETHOD(DisableEffect) (THIS_ UINT32 EffectIndex, \
UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \
STDMETHOD_(void, GetEffectState) (THIS_ UINT32 EffectIndex, BOOL* pEnabled) PURE; \
STDMETHOD(SetEffectParameters) (THIS_ UINT32 EffectIndex, \
const void *pParameters, \
UINT32 ParametersByteSize, \
UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \
STDMETHOD(GetEffectParameters) (THIS_ UINT32 EffectIndex, void *pParameters, \
UINT32 ParametersByteSize) PURE; \
STDMETHOD(SetFilterParameters) (THIS_ const XAUDIO2_FILTER_PARAMETERS* pParameters, \
UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \
STDMETHOD_(void, GetFilterParameters) (THIS_ XAUDIO2_FILTER_PARAMETERS* pParameters) PURE; \
STDMETHOD_(void, SetOutputFilterParameters) (THIS_ IXAudio2Voice *voice, const XAUDIO2_FILTER_PARAMETERS* param, \
UINT32 op X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \
STDMETHOD_(void, GetOutputFilterParameters) (THIS_ IXAudio2Voice *voice, XAUDIO2_FILTER_PARAMETERS* param) PURE; \
STDMETHOD(SetVolume) (THIS_ float Volume, \
UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \
STDMETHOD_(void, GetVolume) (THIS_ float* pVolume) PURE; \
STDMETHOD(SetChannelVolumes) (THIS_ UINT32 Channels, const float* pVolumes, \
UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \
STDMETHOD_(void, GetChannelVolumes) (THIS_ UINT32 Channels, float* pVolumes) PURE; \
STDMETHOD(SetOutputMatrix) (THIS_ IXAudio2Voice* pDestinationVoice, \
UINT32 SourceChannels, UINT32 DestinationChannels, \
const float* pLevelMatrix, \
UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \
STDMETHOD_(void, GetOutputMatrix) (THIS_ IXAudio2Voice* pDestinationVoice, \
UINT32 SourceChannels, UINT32 DestinationChannels, \
float* pLevelMatrix) PURE; \
STDMETHOD_(void, DestroyVoice) (THIS) PURE
Declare_IXAudio2Voice_Methods();
};
#undef INTERFACE
#define INTERFACE IXAudio2MasteringVoice
DECLARE_INTERFACE_(IXAudio2MasteringVoice, IXAudio2Voice)
{
Declare_IXAudio2Voice_Methods();
};
#undef INTERFACE
#define INTERFACE IXAudio2SourceVoice
DECLARE_INTERFACE_(IXAudio2SourceVoice, IXAudio2Voice)
{
Declare_IXAudio2Voice_Methods();
STDMETHOD(Start) (THIS_ UINT32 Flags, UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE;
STDMETHOD(Stop) (THIS_ UINT32 Flags, UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE;
STDMETHOD(SubmitSourceBuffer) (THIS_ const XAUDIO2_BUFFER* pBuffer, const XAUDIO2_BUFFER_WMA* pBufferWMA X2DEFAULT(NULL)) PURE;
STDMETHOD(FlushSourceBuffers) (THIS) PURE;
STDMETHOD(Discontinuity) (THIS) PURE;
STDMETHOD(ExitLoop) (THIS_ UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE;
STDMETHOD_(void, GetState) (THIS_ XAUDIO2_VOICE_STATE* pVoiceState) PURE;
STDMETHOD(SetFrequencyRatio) (THIS_ float Ratio,
UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE;
STDMETHOD_(void, GetFrequencyRatio) (THIS_ float* pRatio) PURE;
};
#undef INTERFACE
#define INTERFACE IXAudio2
DECLARE_INTERFACE_(IXAudio2, IUnknown)
{
STDMETHOD(QueryInterface) (THIS_ REFIID riid, void** ppvInterface) PURE;
STDMETHOD_(ULONG, AddRef) (THIS) PURE;
STDMETHOD_(ULONG, Release) (THIS) PURE;
STDMETHOD(GetDeviceCount) (THIS_ UINT32* pCount) PURE;
STDMETHOD(GetDeviceDetails) (THIS_ UINT32 Index, XAUDIO2_DEVICE_DETAILS* pDeviceDetails) PURE;
STDMETHOD(Initialize) (THIS_ UINT32 Flags X2DEFAULT(0),
XAUDIO2_PROCESSOR XAudio2Processor X2DEFAULT(XAUDIO2_DEFAULT_PROCESSOR)) PURE;
STDMETHOD(RegisterForCallbacks) (IXAudio2EngineCallback* pCallback) PURE;
STDMETHOD_(void, UnregisterForCallbacks) (IXAudio2EngineCallback* pCallback) PURE;
STDMETHOD(CreateSourceVoice) (THIS_ IXAudio2SourceVoice** ppSourceVoice,
const WAVEFORMATEX* pSourceFormat,
UINT32 Flags X2DEFAULT(0),
float MaxFrequencyRatio X2DEFAULT(XAUDIO2_DEFAULT_FREQ_RATIO),
IXAudio2VoiceCallback* pCallback X2DEFAULT(NULL),
const XAUDIO2_VOICE_SENDS* pSendList X2DEFAULT(NULL),
const XAUDIO2_EFFECT_CHAIN* pEffectChain X2DEFAULT(NULL)) PURE;
STDMETHOD(CreateSubmixVoice) (THIS_ IXAudio2SubmixVoice** ppSubmixVoice,
UINT32 InputChannels, UINT32 InputSampleRate,
UINT32 Flags X2DEFAULT(0), UINT32 ProcessingStage X2DEFAULT(0),
const XAUDIO2_VOICE_SENDS* pSendList X2DEFAULT(NULL),
const XAUDIO2_EFFECT_CHAIN* pEffectChain X2DEFAULT(NULL)) PURE;
STDMETHOD(CreateMasteringVoice) (THIS_ IXAudio2MasteringVoice** ppMasteringVoice,
UINT32 InputChannels X2DEFAULT(XAUDIO2_DEFAULT_CHANNELS),
UINT32 InputSampleRate X2DEFAULT(XAUDIO2_DEFAULT_SAMPLERATE),
UINT32 Flags X2DEFAULT(0), UINT32 DeviceIndex X2DEFAULT(0),
const XAUDIO2_EFFECT_CHAIN* pEffectChain X2DEFAULT(NULL)) PURE;
STDMETHOD(StartEngine) (THIS) PURE;
STDMETHOD_(void, StopEngine) (THIS) PURE;
STDMETHOD(CommitChanges) (THIS_ UINT32 OperationSet) PURE;
STDMETHOD_(void, GetPerformanceData) (THIS_ XAUDIO2_PERFORMANCE_DATA* pPerfData) PURE;
STDMETHOD_(void, SetDebugConfiguration) (THIS_ const XAUDIO2_DEBUG_CONFIGURATION* pDebugConfiguration,
void *pReserved X2DEFAULT(NULL)) PURE;
};
#if defined(__cplusplus) && !defined(CINTERFACE)
/* C++ hooks */
#define IXAudio2_Initialize(handle,a,b) handle->Initialize(a, b)
#define IXAudio2SourceVoice_SubmitSourceBuffer(handle, a, b) handle->SubmitSourceBuffer(a, b)
#define IXAudio2SourceVoice_Stop(handle, a, b) handle->Stop(a, b)
#define IXAudio2SourceVoice_DestroyVoice(handle) handle->DestroyVoice()
#define IXAudio2MasteringVoice_DestroyVoice(handle) handle->DestroyVoice()
#define IXAudio2_Release(handle) handle->Release()
#define IXAudio2_CreateSourceVoice(handle, a, b, c, d, e, f, g) handle->CreateSourceVoice(a, b, c, d, e, f, g)
#define IXAudio2_CreateMasteringVoice(handle, a, b, c, d, e, f) handle->CreateMasteringVoice(a, b, c, d, e, f)
#define IXAudio2SourceVoice_Start(handle, a, b) handle->Start(a, b)
#else
/* C hooks */
#define IXAudio2_Initialize(handle,a,b) (handle)->lpVtbl->Initialize(handle, a, b)
#define IXAudio2_Release(handle) (handle)->lpVtbl->Release(handle)
#define IXAudio2_CreateSourceVoice(handle,ppSourceVoice,pSourceFormat,Flags,MaxFrequencyRatio,pCallback,pSendList,pEffectChain) (handle)->lpVtbl->CreateSourceVoice(handle, ppSourceVoice,pSourceFormat,Flags,MaxFrequencyRatio,pCallback,pSendList,pEffectChain)
#define IXAudio2_CreateMasteringVoice(handle,ppMasteringVoice,InputChannels,InputSampleRate,Flags,DeviceIndex,pEffectChain) (handle)->lpVtbl->CreateMasteringVoice(handle, ppMasteringVoice,InputChannels,InputSampleRate,Flags,DeviceIndex,pEffectChain)
#define IXAudio2_GetDeviceCount(handle, puCount) (handle)->lpVtbl->GetDeviceCount(handle, puCount)
#define IXAudio2_GetDeviceDetails(handle, Index,pDeviceDetails) (handle)->lpVtbl->GetDeviceDetails(handle, Index, pDeviceDetails)
#define IXAudio2SourceVoice_Start(handle, Flags, OperationSet) (handle)->lpVtbl->Start(handle, Flags, OperationSet)
#define IXAudio2SourceVoice_Stop(handle, Flags, OperationSet) (handle)->lpVtbl->Stop(handle, Flags, OperationSet)
#define IXAudio2SourceVoice_SubmitSourceBuffer(handle, pBuffer, pBufferWMA) (handle)->lpVtbl->SubmitSourceBuffer(handle, pBuffer, pBufferWMA)
#define IXAudio2SourceVoice_DestroyVoice(handle) (handle)->lpVtbl->DestroyVoice(handle)
#define IXAudio2MasteringVoice_DestroyVoice(handle) (handle)->lpVtbl->DestroyVoice(handle)
#endif
#ifdef _XBOX
STDAPI XAudio2Create(__deref_out IXAudio2** ppXAudio2, UINT32 Flags X2DEFAULT(0),
XAUDIO2_PROCESSOR XAudio2Processor X2DEFAULT(XAUDIO2_DEFAULT_PROCESSOR));
#else
static INLINE HRESULT XAudio2Create(IXAudio2 **ppXAudio2, UINT32 flags, XAUDIO2_PROCESSOR proc)
{
IXAudio2 *pXAudio2 = NULL;
#ifdef __cplusplus
HRESULT hr = CoCreateInstance(CLSID_XAudio2, NULL, CLSCTX_INPROC_SERVER, IID_IXAudio2, (void**)&pXAudio2);
#else
HRESULT hr = CoCreateInstance(&CLSID_XAudio2, NULL, CLSCTX_INPROC_SERVER, &IID_IXAudio2, (void**)&pXAudio2);
#endif
if (SUCCEEDED(hr))
{
hr = IXAudio2_Initialize(pXAudio2, 0, XAUDIO2_DEFAULT_PROCESSOR);
if (SUCCEEDED(hr))
*ppXAudio2 = pXAudio2;
else
IXAudio2_Release(pXAudio2);
}
return hr;
}
#endif
/* Undo the #pragma pack(push, 1) directive at the top of this file */
#pragma pack(pop)
#endif
-364
View File
@@ -1,364 +0,0 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2017 - Daniel De Matteis
* Copyright (C) 2010-2014 - OV2
*
* 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/>.
*/
/* Kinda stripped down. Only contains the bare essentials used in RetroArch. */
#ifndef XAUDIO2_STRIPPED_H
#define XAUDIO2_STRIPPED_H
#include <retro_inline.h>
#include <retro_environment.h>
/* All structures defined in this file use tight field packing */
#pragma pack(push, 1)
#if defined(__cplusplus) && !defined(CINTERFACE)
#define X2DEFAULT(x) = (x)
#else
#define X2DEFAULT(x)
#endif
#ifdef _XBOX
#include <xtl.h>
#ifndef __cplusplus
#define OPAQUE interface
#endif
#define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
DEFINE_GUID(CLSID_##className, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8)
#define DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
DEFINE_GUID(IID_##interfaceName, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8)
DEFINE_CLSID(XAudio2, 3eda9b49, 2085, 498b, 9b, b2, 39, a6, 77, 84, 93, de);
DEFINE_CLSID(XAudio2_Debug, 47199894, 7cc2, 444d, 98, 73, ce, d2, 56, 2c, c6, 0e);
DEFINE_IID(IXAudio2, 8bcf1f58, 9fe7, 4583, 8a, c6, e2, ad, c4, 65, c8, bb);
#include <audiodefs.h> /* Basic audio data types and constants */
#else
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <basetyps.h>
#include <objbase.h>
#include <mmreg.h>
#ifndef __cplusplus
#undef OPAQUE
#define OPAQUE struct
#endif
#define DEFINE_GUID_X(n, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
static const GUID n = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
#define DEFINE_CLSID_X(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
DEFINE_GUID_X(CLSID_##className, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8)
#define DEFINE_IID_X(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
DEFINE_GUID_X(IID_##interfaceName, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8)
#ifndef __cplusplus
#ifndef INTERFACE
#define INTERFACE void
#endif
#endif
DEFINE_CLSID_X(XAudio2, 5a508685, a254, 4fba, 9b, 82, 9a, 24, b0, 03, 06, af); /* 2.7 */
DEFINE_IID_X(IXAudio2, 8bcf1f58, 9fe7, 4583, 8a, c6, e2, ad, c4, 65, c8, bb);
#endif
#ifdef _XBOX
#define XAUDIO2_DEFAULT_FREQ_RATIO 2.0f
#else
#define XAUDIO2_DEFAULT_FREQ_RATIO 4.0f
#endif
#define XAUDIO2_COMMIT_NOW 0
#define XAUDIO2_DEFAULT_CHANNELS 0
#define XAUDIO2_DEFAULT_SAMPLERATE 0
#define XAUDIO2_DEBUG_ENGINE 0x0001
#define XAUDIO2_VOICE_NOSRC 0x0004
typedef enum XAUDIO2_DEVICE_ROLE
{
NotDefaultDevice = 0x0,
DefaultConsoleDevice = 0x1,
DefaultMultimediaDevice = 0x2,
DefaultCommunicationsDevice = 0x4,
DefaultGameDevice = 0x8,
GlobalDefaultDevice = 0xf,
InvalidDeviceRole = ~GlobalDefaultDevice
} XAUDIO2_DEVICE_ROLE;
#ifdef _XBOX
typedef enum XAUDIO2_XBOX_HWTHREAD_SPECIFIER
{
XboxThread0 = 0x01,
XboxThread1 = 0x02,
XboxThread2 = 0x04,
XboxThread3 = 0x08,
XboxThread4 = 0x10,
XboxThread5 = 0x20,
XAUDIO2_ANY_PROCESSOR = XboxThread4,
XAUDIO2_DEFAULT_PROCESSOR = XAUDIO2_ANY_PROCESSOR
} XAUDIO2_XBOX_HWTHREAD_SPECIFIER, XAUDIO2_PROCESSOR;
#else
typedef enum XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER
{
#if defined(__STDC_C89__)
XAUDIO2_ANY_PROCESSOR = 0xffff,
#else
XAUDIO2_ANY_PROCESSOR = 0xffffffff,
#endif
XAUDIO2_DEFAULT_PROCESSOR = XAUDIO2_ANY_PROCESSOR
} XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER, XAUDIO2_PROCESSOR;
#endif
typedef enum XAUDIO2_FILTER_TYPE {
LowPassFilter,
BandPassFilter,
HighPassFilter
} XAUDIO2_FILTER_TYPE;
typedef struct XAUDIO2_DEVICE_DETAILS
{
WCHAR DeviceID[256];
WCHAR DisplayName[256];
XAUDIO2_DEVICE_ROLE Role;
WAVEFORMATEXTENSIBLE OutputFormat;
} XAUDIO2_DEVICE_DETAILS;
/* Forward declarations. */
#ifdef __cplusplus
struct XAUDIO2_VOICE_DETAILS;
struct XAUDIO2_VOICE_SENDS;
struct XAUDIO2_EFFECT_DESCRIPTOR;
struct XAUDIO2_EFFECT_CHAIN;
struct XAUDIO2_FILTER_PARAMETERS;
struct XAUDIO2_BUFFER_WMA;
struct XAUDIO2_VOICE_STATE;
struct XAUDIO2_PERFORMANCE_DATA;
struct XAUDIO2_DEBUG_CONFIGURATION;
struct IXAudio2EngineCallback;
struct IXAudio2SubmixVoice;
#else
typedef OPAQUE XAUDIO2_VOICE_DETAILS XAUDIO2_VOICE_DETAILS;
typedef OPAQUE XAUDIO2_VOICE_SENDS XAUDIO2_VOICE_SENDS;
typedef OPAQUE XAUDIO2_EFFECT_DESCRIPTOR XAUDIO2_EFFECT_DESCRIPTOR;
typedef OPAQUE XAUDIO2_EFFECT_CHAIN XAUDIO2_EFFECT_CHAIN;
typedef OPAQUE XAUDIO2_FILTER_PARAMETERS XAUDIO2_FILTER_PARAMETERS;
typedef OPAQUE XAUDIO2_BUFFER_WMA XAUDIO2_BUFFER_WMA;
typedef OPAQUE XAUDIO2_VOICE_STATE XAUDIO2_VOICE_STATE;
typedef OPAQUE XAUDIO2_PERFORMANCE_DATA XAUDIO2_PERFORMANCE_DATA;
typedef OPAQUE XAUDIO2_DEBUG_CONFIGURATION XAUDIO2_DEBUG_CONFIGURATION;
typedef OPAQUE IXAudio2EngineCallback IXAudio2EngineCallback;
typedef OPAQUE IXAudio2SubmixVoice IXAudio2SubmixVoice;
#endif
typedef struct XAUDIO2_BUFFER
{
UINT32 Flags;
UINT32 AudioBytes;
const BYTE* pAudioData;
UINT32 PlayBegin;
UINT32 PlayLength;
UINT32 LoopBegin;
UINT32 LoopLength;
UINT32 LoopCount;
void *pContext;
} XAUDIO2_BUFFER;
#undef INTERFACE
#define INTERFACE IXAudio2VoiceCallback
DECLARE_INTERFACE(IXAudio2VoiceCallback)
{
STDMETHOD_(void, OnVoiceProcessingPassStart) (THIS_ UINT32 BytesRequired) PURE;
STDMETHOD_(void, OnVoiceProcessingPassEnd) (THIS) PURE;
STDMETHOD_(void, OnStreamEnd) (THIS) PURE;
STDMETHOD_(void, OnBufferStart) (THIS_ void *pBufferContext) PURE;
STDMETHOD_(void, OnBufferEnd) (THIS_ void *pBufferContext) PURE;
STDMETHOD_(void, OnLoopEnd) (THIS_ void *pBufferContext) PURE;
STDMETHOD_(void, OnVoiceError) (THIS_ void *pBufferContext, HRESULT Error) PURE;
};
#undef INTERFACE
#define INTERFACE IXAudio2Voice
DECLARE_INTERFACE(IXAudio2Voice)
{
#define Declare_IXAudio2Voice_Methods() \
STDMETHOD_(void, GetVoiceDetails) (THIS_ XAUDIO2_VOICE_DETAILS* pVoiceDetails) PURE; \
STDMETHOD(SetOutputVoices) (THIS_ const XAUDIO2_VOICE_SENDS* pSendList) PURE; \
STDMETHOD(SetEffectChain) (THIS_ const XAUDIO2_EFFECT_CHAIN* pEffectChain) PURE; \
STDMETHOD(EnableEffect) (THIS_ UINT32 EffectIndex, \
UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \
STDMETHOD(DisableEffect) (THIS_ UINT32 EffectIndex, \
UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \
STDMETHOD_(void, GetEffectState) (THIS_ UINT32 EffectIndex, BOOL* pEnabled) PURE; \
STDMETHOD(SetEffectParameters) (THIS_ UINT32 EffectIndex, \
const void *pParameters, \
UINT32 ParametersByteSize, \
UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \
STDMETHOD(GetEffectParameters) (THIS_ UINT32 EffectIndex, void *pParameters, \
UINT32 ParametersByteSize) PURE; \
STDMETHOD(SetFilterParameters) (THIS_ const XAUDIO2_FILTER_PARAMETERS* pParameters, \
UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \
STDMETHOD_(void, GetFilterParameters) (THIS_ XAUDIO2_FILTER_PARAMETERS* pParameters) PURE; \
STDMETHOD_(void, SetOutputFilterParameters) (THIS_ IXAudio2Voice *voice, const XAUDIO2_FILTER_PARAMETERS* param, \
UINT32 op X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \
STDMETHOD_(void, GetOutputFilterParameters) (THIS_ IXAudio2Voice *voice, XAUDIO2_FILTER_PARAMETERS* param) PURE; \
STDMETHOD(SetVolume) (THIS_ float Volume, \
UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \
STDMETHOD_(void, GetVolume) (THIS_ float* pVolume) PURE; \
STDMETHOD(SetChannelVolumes) (THIS_ UINT32 Channels, const float* pVolumes, \
UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \
STDMETHOD_(void, GetChannelVolumes) (THIS_ UINT32 Channels, float* pVolumes) PURE; \
STDMETHOD(SetOutputMatrix) (THIS_ IXAudio2Voice* pDestinationVoice, \
UINT32 SourceChannels, UINT32 DestinationChannels, \
const float* pLevelMatrix, \
UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \
STDMETHOD_(void, GetOutputMatrix) (THIS_ IXAudio2Voice* pDestinationVoice, \
UINT32 SourceChannels, UINT32 DestinationChannels, \
float* pLevelMatrix) PURE; \
STDMETHOD_(void, DestroyVoice) (THIS) PURE
Declare_IXAudio2Voice_Methods();
};
#undef INTERFACE
#define INTERFACE IXAudio2MasteringVoice
DECLARE_INTERFACE_(IXAudio2MasteringVoice, IXAudio2Voice)
{
Declare_IXAudio2Voice_Methods();
};
#undef INTERFACE
#define INTERFACE IXAudio2SourceVoice
DECLARE_INTERFACE_(IXAudio2SourceVoice, IXAudio2Voice)
{
Declare_IXAudio2Voice_Methods();
STDMETHOD(Start) (THIS_ UINT32 Flags, UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE;
STDMETHOD(Stop) (THIS_ UINT32 Flags, UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE;
STDMETHOD(SubmitSourceBuffer) (THIS_ const XAUDIO2_BUFFER* pBuffer, const XAUDIO2_BUFFER_WMA* pBufferWMA X2DEFAULT(NULL)) PURE;
STDMETHOD(FlushSourceBuffers) (THIS) PURE;
STDMETHOD(Discontinuity) (THIS) PURE;
STDMETHOD(ExitLoop) (THIS_ UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE;
STDMETHOD_(void, GetState) (THIS_ XAUDIO2_VOICE_STATE* pVoiceState) PURE;
STDMETHOD(SetFrequencyRatio) (THIS_ float Ratio,
UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE;
STDMETHOD_(void, GetFrequencyRatio) (THIS_ float* pRatio) PURE;
};
#undef INTERFACE
#define INTERFACE IXAudio2
DECLARE_INTERFACE_(IXAudio2, IUnknown)
{
STDMETHOD(QueryInterface) (THIS_ REFIID riid, void** ppvInterface) PURE;
STDMETHOD_(ULONG, AddRef) (THIS) PURE;
STDMETHOD_(ULONG, Release) (THIS) PURE;
STDMETHOD(GetDeviceCount) (THIS_ UINT32* pCount) PURE;
STDMETHOD(GetDeviceDetails) (THIS_ UINT32 Index, XAUDIO2_DEVICE_DETAILS* pDeviceDetails) PURE;
STDMETHOD(Initialize) (THIS_ UINT32 Flags X2DEFAULT(0),
XAUDIO2_PROCESSOR XAudio2Processor X2DEFAULT(XAUDIO2_DEFAULT_PROCESSOR)) PURE;
STDMETHOD(RegisterForCallbacks) (IXAudio2EngineCallback* pCallback) PURE;
STDMETHOD_(void, UnregisterForCallbacks) (IXAudio2EngineCallback* pCallback) PURE;
STDMETHOD(CreateSourceVoice) (THIS_ IXAudio2SourceVoice** ppSourceVoice,
const WAVEFORMATEX* pSourceFormat,
UINT32 Flags X2DEFAULT(0),
float MaxFrequencyRatio X2DEFAULT(XAUDIO2_DEFAULT_FREQ_RATIO),
IXAudio2VoiceCallback* pCallback X2DEFAULT(NULL),
const XAUDIO2_VOICE_SENDS* pSendList X2DEFAULT(NULL),
const XAUDIO2_EFFECT_CHAIN* pEffectChain X2DEFAULT(NULL)) PURE;
STDMETHOD(CreateSubmixVoice) (THIS_ IXAudio2SubmixVoice** ppSubmixVoice,
UINT32 InputChannels, UINT32 InputSampleRate,
UINT32 Flags X2DEFAULT(0), UINT32 ProcessingStage X2DEFAULT(0),
const XAUDIO2_VOICE_SENDS* pSendList X2DEFAULT(NULL),
const XAUDIO2_EFFECT_CHAIN* pEffectChain X2DEFAULT(NULL)) PURE;
STDMETHOD(CreateMasteringVoice) (THIS_ IXAudio2MasteringVoice** ppMasteringVoice,
UINT32 InputChannels X2DEFAULT(XAUDIO2_DEFAULT_CHANNELS),
UINT32 InputSampleRate X2DEFAULT(XAUDIO2_DEFAULT_SAMPLERATE),
UINT32 Flags X2DEFAULT(0), UINT32 DeviceIndex X2DEFAULT(0),
const XAUDIO2_EFFECT_CHAIN* pEffectChain X2DEFAULT(NULL)) PURE;
STDMETHOD(StartEngine) (THIS) PURE;
STDMETHOD_(void, StopEngine) (THIS) PURE;
STDMETHOD(CommitChanges) (THIS_ UINT32 OperationSet) PURE;
STDMETHOD_(void, GetPerformanceData) (THIS_ XAUDIO2_PERFORMANCE_DATA* pPerfData) PURE;
STDMETHOD_(void, SetDebugConfiguration) (THIS_ const XAUDIO2_DEBUG_CONFIGURATION* pDebugConfiguration,
void *pReserved X2DEFAULT(NULL)) PURE;
};
#if defined(__cplusplus) && !defined(CINTERFACE)
/* C++ hooks */
#define IXAudio2_Initialize(handle,a,b) handle->Initialize(a, b)
#define IXAudio2SourceVoice_SubmitSourceBuffer(handle, a, b) handle->SubmitSourceBuffer(a, b)
#define IXAudio2SourceVoice_Stop(handle, a, b) handle->Stop(a, b)
#define IXAudio2SourceVoice_DestroyVoice(handle) handle->DestroyVoice()
#define IXAudio2MasteringVoice_DestroyVoice(handle) handle->DestroyVoice()
#define IXAudio2_Release(handle) handle->Release()
#define IXAudio2_CreateSourceVoice(handle, a, b, c, d, e, f, g) handle->CreateSourceVoice(a, b, c, d, e, f, g)
#define IXAudio2_GetDeviceCount(handle, puCount) (handle)->GetDeviceCount(puCount)
#define IXAudio2_GetDeviceDetails(handle, Index,pDeviceDetails) (handle)->GetDeviceDetails(Index, pDeviceDetails)
#define IXAudio2_CreateMasteringVoice(handle, a, b, c, d, e, f) handle->CreateMasteringVoice(a, b, c, d, e, f)
#define IXAudio2SourceVoice_Start(handle, a, b) handle->Start(a, b)
#else
/* C hooks */
#define IXAudio2_Initialize(handle,a,b) (handle)->lpVtbl->Initialize(handle, a, b)
#define IXAudio2_Release(handle) (handle)->lpVtbl->Release(handle)
#define IXAudio2_CreateSourceVoice(handle,ppSourceVoice,pSourceFormat,Flags,MaxFrequencyRatio,pCallback,pSendList,pEffectChain) (handle)->lpVtbl->CreateSourceVoice(handle, ppSourceVoice,pSourceFormat,Flags,MaxFrequencyRatio,pCallback,pSendList,pEffectChain)
#define IXAudio2_CreateMasteringVoice(handle,ppMasteringVoice,InputChannels,InputSampleRate,Flags,DeviceIndex,pEffectChain) (handle)->lpVtbl->CreateMasteringVoice(handle, ppMasteringVoice,InputChannels,InputSampleRate,Flags,DeviceIndex,pEffectChain)
#define IXAudio2_GetDeviceCount(handle, puCount) (handle)->lpVtbl->GetDeviceCount(handle, puCount)
#define IXAudio2_GetDeviceDetails(handle, Index,pDeviceDetails) (handle)->lpVtbl->GetDeviceDetails(handle, Index, pDeviceDetails)
#define IXAudio2SourceVoice_Start(handle, Flags, OperationSet) (handle)->lpVtbl->Start(handle, Flags, OperationSet)
#define IXAudio2SourceVoice_Stop(handle, Flags, OperationSet) (handle)->lpVtbl->Stop(handle, Flags, OperationSet)
#define IXAudio2SourceVoice_SubmitSourceBuffer(handle, pBuffer, pBufferWMA) (handle)->lpVtbl->SubmitSourceBuffer(handle, pBuffer, pBufferWMA)
#define IXAudio2SourceVoice_DestroyVoice(handle) (handle)->lpVtbl->DestroyVoice(handle)
#define IXAudio2MasteringVoice_DestroyVoice(handle) (handle)->lpVtbl->DestroyVoice(handle)
#endif
#ifdef _XBOX
STDAPI XAudio2Create(__deref_out IXAudio2** ppXAudio2, UINT32 Flags X2DEFAULT(0),
XAUDIO2_PROCESSOR XAudio2Processor X2DEFAULT(XAUDIO2_DEFAULT_PROCESSOR));
#else
static INLINE HRESULT XAudio2Create(IXAudio2 **ppXAudio2, UINT32 flags, XAUDIO2_PROCESSOR proc)
{
IXAudio2 *pXAudio2 = NULL;
#ifdef __cplusplus
HRESULT hr = CoCreateInstance(CLSID_XAudio2, NULL, CLSCTX_INPROC_SERVER, IID_IXAudio2, (void**)&pXAudio2);
#else
HRESULT hr = CoCreateInstance(&CLSID_XAudio2, NULL, CLSCTX_INPROC_SERVER, &IID_IXAudio2, (void**)&pXAudio2);
#endif
if (SUCCEEDED(hr))
{
hr = IXAudio2_Initialize(pXAudio2, 0, XAUDIO2_DEFAULT_PROCESSOR);
if (SUCCEEDED(hr))
*ppXAudio2 = pXAudio2;
else
IXAudio2_Release(pXAudio2);
}
return hr;
}
#endif
/* Undo the #pragma pack(push, 1) directive at the top of this file */
#pragma pack(pop)
#endif
-909
View File
@@ -1,909 +0,0 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2018 - Krzysztof Haładyn
*
* 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/>.
*/
/**************************************************************************
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
* File: xaudio2.h
* Content: Declarations for the XAudio2 game audio API.
*
**************************************************************************/
/* Modified slightly to build without requiring the WinRT compiler since that is only available in C++ sources */
#ifdef _MSC_VER
#pragma once
#endif
#ifndef __XAUDIO2_INCLUDED__
#define __XAUDIO2_INCLUDED__
#include <sdkddkver.h>
#include <retro_inline.h>
#if(_WIN32_WINNT < _WIN32_WINNT_WIN8)
#error "This version of XAudio2 is available only in Windows 8 or later. Use the XAudio2 headers and libraries from the DirectX SDK with applications that target Windows 7 and earlier versions."
#endif /* (_WIN32_WINNT < _WIN32_WINNT_WIN8) */
#include <winapifamily.h>
#pragma region Application Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_TV_APP | WINAPI_PARTITION_TV_TITLE)
/* Current name of the DLL shipped in the same SDK as this header.
* The name reflects the current version */
#if(_WIN32_WINNT >= _WIN32_WINNT_WIN10)
#define XAUDIO2_DLL_A "xaudio2_9.dll"
#define XAUDIO2_DLL_W L"xaudio2_9.dll"
#define XAUDIO2D_DLL_A "xaudio2_9d.dll"
#define XAUDIO2D_DLL_W L"xaudio2_9d.dll"
#else
#define XAUDIO2_DLL_A "xaudio2_8.dll"
#define XAUDIO2_DLL_W L"xaudio2_8.dll"
#define XAUDIO2D_DLL_A "xaudio2_8.dll"
#define XAUDIO2D_DLL_W L"xaudio2_8.dll"
#endif
#ifdef UNICODE
#define XAUDIO2_DLL XAUDIO2_DLL_W
#define XAUDIO2D_DLL XAUDIO2D_DLL_W
#else
#define XAUDIO2_DLL XAUDIO2_DLL_A
#define XAUDIO2D_DLL XAUDIO2D_DLL_A
#endif
/**************************************************************************
*
* XAudio2 COM object class and interface IDs.
*
**************************************************************************/
#include <basetyps.h>
#if defined(__cplusplus__) && defined(__WINRT__)
#if(_WIN32_WINNT >= _WIN32_WINNT_WIN10)
/* XAudio 2.9 */
interface __declspec(uuid("2B02E3CF-2E0B-4ec3-BE45-1B2A3FE7210D")) IXAudio2;
#else
/* XAudio 2.8 */
interface __declspec(uuid("60d8dac8-5aa1-4e8e-b597-2f5e2883d484")) IXAudio2;
#endif
#else
/* Modified for C support */
#define DEFINE_GUID_X(n, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
static const GUID n = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
#define DEFINE_CLSID_X(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
DEFINE_GUID_X(CLSID_##className, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8)
#define DEFINE_IID_X(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
DEFINE_GUID_X(IID_##interfaceName, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8)
#if(_WIN32_WINNT >= _WIN32_WINNT_WIN10)
DEFINE_IID_X(IXAudio2, 2B02E3CF, 2E0B, 4ec3, BE, 45, 1B, 2A, 3F, E7, 21, 0D);
#else
DEFINE_IID_X(IXAudio2, 60d8dac8, 5aa1, 4e8e, b5, 97, 2f, 5e, 28, 83, d4, 84);
#endif
#endif
/* Ignore the rest of this header if only the GUID definitions were requested */
#ifndef GUID_DEFS_ONLY
#include <objbase.h> /* Windows COM declarations */
#include <sal.h> /* Markers for documenting API semantics */
#include <mmreg.h> /* Basic data types and constants for audio work */
#include <audiosessiontypes.h> /* For AUDIO_STREAM_CATEGORY */
/* All structures defined in this file use tight field packing */
#pragma pack(push, 1)
/**************************************************************************
*
* XAudio2 constants, flags and error codes.
*
**************************************************************************/
/* Numeric boundary values */
#define XAUDIO2_MAX_BUFFER_BYTES 0x80000000 /* Maximum bytes allowed in a source buffer */
#define XAUDIO2_MAX_QUEUED_BUFFERS 64 /* Maximum buffers allowed in a voice queue */
#define XAUDIO2_MAX_BUFFERS_SYSTEM 2 /* Maximum buffers allowed for system threads (Xbox 360 only) */
#define XAUDIO2_MAX_AUDIO_CHANNELS 64 /* Maximum channels in an audio stream */
#define XAUDIO2_MIN_SAMPLE_RATE 1000 /* Minimum audio sample rate supported */
#define XAUDIO2_MAX_SAMPLE_RATE 200000 /* Maximum audio sample rate supported */
#define XAUDIO2_MAX_VOLUME_LEVEL 16777216.0f /* Maximum acceptable volume level (2^24) */
#define XAUDIO2_MIN_FREQ_RATIO (1/1024.0f) /* Minimum SetFrequencyRatio argument */
#define XAUDIO2_MAX_FREQ_RATIO 1024.0f /* Maximum MaxFrequencyRatio argument */
#define XAUDIO2_DEFAULT_FREQ_RATIO 2.0f /* Default MaxFrequencyRatio argument */
#define XAUDIO2_MAX_FILTER_ONEOVERQ 1.5f /* Maximum XAUDIO2_FILTER_PARAMETERS.OneOverQ */
#define XAUDIO2_MAX_FILTER_FREQUENCY 1.0f /* Maximum XAUDIO2_FILTER_PARAMETERS.Frequency */
#define XAUDIO2_MAX_LOOP_COUNT 254 /* Maximum non-infinite XAUDIO2_BUFFER.LoopCount */
#define XAUDIO2_MAX_INSTANCES 8 /* Maximum simultaneous XAudio2 objects on Xbox 360 */
/* For XMA voices on Xbox 360 there is an additional restriction on the MaxFrequencyRatio
* argument and the voice's sample rate: the product of these numbers cannot exceed 600000
* for one-channel voices or 300000 for voices with more than one channel.
*/
#define XAUDIO2_MAX_RATIO_TIMES_RATE_XMA_MONO 600000
#define XAUDIO2_MAX_RATIO_TIMES_RATE_XMA_MULTICHANNEL 300000
/* Numeric values with special meanings */
#define XAUDIO2_COMMIT_NOW 0 /* Used as an OperationSet argument */
#define XAUDIO2_COMMIT_ALL 0 /* Used in IXAudio2::CommitChanges */
#define XAUDIO2_INVALID_OPSET (UINT32)(-1) /* Not allowed for OperationSet arguments */
#define XAUDIO2_NO_LOOP_REGION 0 /* Used in XAUDIO2_BUFFER.LoopCount */
#define XAUDIO2_LOOP_INFINITE 255 /* Used in XAUDIO2_BUFFER.LoopCount */
#define XAUDIO2_DEFAULT_CHANNELS 0 /* Used in CreateMasteringVoice */
#define XAUDIO2_DEFAULT_SAMPLERATE 0 /* Used in CreateMasteringVoice */
/* Flags */
#define XAUDIO2_DEBUG_ENGINE 0x0001 /* Used in XAudio2Create */
#define XAUDIO2_VOICE_NOPITCH 0x0002 /* Used in IXAudio2::CreateSourceVoice */
#define XAUDIO2_VOICE_NOSRC 0x0004 /* Used in IXAudio2::CreateSourceVoice */
#define XAUDIO2_VOICE_USEFILTER 0x0008 /* Used in IXAudio2::CreateSource/SubmixVoice */
#define XAUDIO2_PLAY_TAILS 0x0020 /* Used in IXAudio2SourceVoice::Stop */
#define XAUDIO2_END_OF_STREAM 0x0040 /* Used in XAUDIO2_BUFFER.Flags */
#define XAUDIO2_SEND_USEFILTER 0x0080 /* Used in XAUDIO2_SEND_DESCRIPTOR.Flags */
#define XAUDIO2_VOICE_NOSAMPLESPLAYED 0x0100 /* Used in IXAudio2SourceVoice::GetState */
#define XAUDIO2_STOP_ENGINE_WHEN_IDLE 0x2000 /* Used in XAudio2Create to force the engine to Stop when no source voices are Started, and Start when a voice is Started */
#define XAUDIO2_1024_QUANTUM 0x8000 /* Used in XAudio2Create to specify nondefault processing quantum of 21.33 ms (1024 samples at 48KHz) */
#define XAUDIO2_NO_VIRTUAL_AUDIO_CLIENT 0x10000 /* Used in CreateMasteringVoice to create a virtual audio client */
/* Default parameters for the built-in filter */
#define XAUDIO2_DEFAULT_FILTER_TYPE LowPassFilter
#define XAUDIO2_DEFAULT_FILTER_FREQUENCY XAUDIO2_MAX_FILTER_FREQUENCY
#define XAUDIO2_DEFAULT_FILTER_ONEOVERQ 1.0f
/* Internal XAudio2 constants */
/* The audio frame quantum can be calculated by reducing the fraction:
* SamplesPerAudioFrame / SamplesPerSecond */
#define XAUDIO2_QUANTUM_NUMERATOR 1 /* On Windows, XAudio2 processes audio */
#define XAUDIO2_QUANTUM_DENOMINATOR 100 /* in 10ms chunks (= 1/100 seconds) */
#define XAUDIO2_QUANTUM_MS (1000.0f * XAUDIO2_QUANTUM_NUMERATOR / XAUDIO2_QUANTUM_DENOMINATOR)
/* XAudio2 error codes */
#define FACILITY_XAUDIO2 0x896
#define XAUDIO2_E_INVALID_CALL 0x88960001 /* An API call or one of its arguments was illegal */
#define XAUDIO2_E_XMA_DECODER_ERROR 0x88960002 /* The XMA hardware suffered an unrecoverable error */
#define XAUDIO2_E_XAPO_CREATION_FAILED 0x88960003 /* XAudio2 failed to initialize an XAPO effect */
#define XAUDIO2_E_DEVICE_INVALIDATED 0x88960004 /* An audio device became unusable (unplugged, etc) */
/**************************************************************************
*
* Forward declarations for the XAudio2 interfaces.
*
**************************************************************************/
#ifdef __cplusplus
#define FWD_DECLARE(x) interface x
#else
#define FWD_DECLARE(x) typedef interface x x
#endif
FWD_DECLARE(IXAudio2);
FWD_DECLARE(IXAudio2Voice);
FWD_DECLARE(IXAudio2SourceVoice);
FWD_DECLARE(IXAudio2SubmixVoice);
FWD_DECLARE(IXAudio2MasteringVoice);
FWD_DECLARE(IXAudio2EngineCallback);
FWD_DECLARE(IXAudio2VoiceCallback);
/**************************************************************************
*
* XAudio2 structures and enumerations.
*
**************************************************************************/
/* Used in XAudio2Create, specifies which CPU(s) to use. */
typedef UINT32 XAUDIO2_PROCESSOR;
#define Processor1 0x00000001
#define Processor2 0x00000002
#define Processor3 0x00000004
#define Processor4 0x00000008
#define Processor5 0x00000010
#define Processor6 0x00000020
#define Processor7 0x00000040
#define Processor8 0x00000080
#define Processor9 0x00000100
#define Processor10 0x00000200
#define Processor11 0x00000400
#define Processor12 0x00000800
#define Processor13 0x00001000
#define Processor14 0x00002000
#define Processor15 0x00004000
#define Processor16 0x00008000
#define Processor17 0x00010000
#define Processor18 0x00020000
#define Processor19 0x00040000
#define Processor20 0x00080000
#define Processor21 0x00100000
#define Processor22 0x00200000
#define Processor23 0x00400000
#define Processor24 0x00800000
#define Processor25 0x01000000
#define Processor26 0x02000000
#define Processor27 0x04000000
#define Processor28 0x08000000
#define Processor29 0x10000000
#define Processor30 0x20000000
#define Processor31 0x40000000
#define Processor32 0x80000000
#define XAUDIO2_ANY_PROCESSOR 0xffffffff
#define XAUDIO2_DEFAULT_PROCESSOR Processor1
/* Returned by IXAudio2Voice::GetVoiceDetails */
typedef struct XAUDIO2_VOICE_DETAILS
{
UINT32 CreationFlags; /* Flags the voice was created with. */
UINT32 ActiveFlags; /* Flags currently active. */
UINT32 InputChannels; /* Channels in the voice's input audio. */
UINT32 InputSampleRate; /* Sample rate of the voice's input audio. */
} XAUDIO2_VOICE_DETAILS;
/* Used in XAUDIO2_VOICE_SENDS below */
typedef struct XAUDIO2_SEND_DESCRIPTOR
{
UINT32 Flags; /* Either 0 or XAUDIO2_SEND_USEFILTER. */
IXAudio2Voice* pOutputVoice; /* This send's destination voice. */
} XAUDIO2_SEND_DESCRIPTOR;
/* Used in the voice creation functions and in IXAudio2Voice::SetOutputVoices */
typedef struct XAUDIO2_VOICE_SENDS
{
UINT32 SendCount; /* Number of sends from this voice. */
XAUDIO2_SEND_DESCRIPTOR* pSends; /* Array of SendCount send descriptors. */
} XAUDIO2_VOICE_SENDS;
/* Used in XAUDIO2_EFFECT_CHAIN below */
typedef struct XAUDIO2_EFFECT_DESCRIPTOR
{
IUnknown* pEffect; /* Pointer to the effect object's IUnknown interface. */
BOOL InitialState; /* TRUE if the effect should begin in the enabled state. */
UINT32 OutputChannels; /* How many output channels the effect should produce. */
} XAUDIO2_EFFECT_DESCRIPTOR;
/* Used in the voice creation functions and in IXAudio2Voice::SetEffectChain */
typedef struct XAUDIO2_EFFECT_CHAIN
{
UINT32 EffectCount; /* Number of effects in this voice's effect chain. */
XAUDIO2_EFFECT_DESCRIPTOR* pEffectDescriptors; /* Array of effect descriptors. */
} XAUDIO2_EFFECT_CHAIN;
/* Used in XAUDIO2_FILTER_PARAMETERS below */
typedef enum XAUDIO2_FILTER_TYPE
{
LowPassFilter, /* Attenuates frequencies above the cutoff frequency (state-variable filter). */
BandPassFilter, /* Attenuates frequencies outside a given range (state-variable filter). */
HighPassFilter, /* Attenuates frequencies below the cutoff frequency (state-variable filter). */
NotchFilter, /* Attenuates frequencies inside a given range (state-variable filter). */
LowPassOnePoleFilter, /* Attenuates frequencies above the cutoff frequency (one-pole filter, XAUDIO2_FILTER_PARAMETERS.OneOverQ has no effect) */
HighPassOnePoleFilter /* Attenuates frequencies below the cutoff frequency (one-pole filter, XAUDIO2_FILTER_PARAMETERS.OneOverQ has no effect) */
} XAUDIO2_FILTER_TYPE;
/* Used in IXAudio2Voice::Set/GetFilterParameters and Set/GetOutputFilterParameters */
typedef struct XAUDIO2_FILTER_PARAMETERS
{
XAUDIO2_FILTER_TYPE Type; /* Filter type. */
float Frequency; /* Filter coefficient. */
/* must be >= 0 and <= XAUDIO2_MAX_FILTER_FREQUENCY */
/* See XAudio2CutoffFrequencyToRadians() for state-variable filter types and */
/* XAudio2CutoffFrequencyToOnePoleCoefficient() for one-pole filter types. */
float OneOverQ; /* Reciprocal of the filter's quality factor Q; */
/* must be > 0 and <= XAUDIO2_MAX_FILTER_ONEOVERQ. */
/* Has no effect for one-pole filters. */
} XAUDIO2_FILTER_PARAMETERS;
/* Used in IXAudio2SourceVoice::SubmitSourceBuffer */
typedef struct XAUDIO2_BUFFER
{
UINT32 Flags; /* Either 0 or XAUDIO2_END_OF_STREAM. */
UINT32 AudioBytes; /* Size of the audio data buffer in bytes. */
const BYTE* pAudioData; /* Pointer to the audio data buffer. */
UINT32 PlayBegin; /* First sample in this buffer to be played. */
UINT32 PlayLength; /* Length of the region to be played in samples, */
/* or 0 to play the whole buffer. */
UINT32 LoopBegin; /* First sample of the region to be looped. */
UINT32 LoopLength; /* Length of the desired loop region in samples, */
/* or 0 to loop the entire buffer. */
UINT32 LoopCount; /* Number of times to repeat the loop region, */
/* or XAUDIO2_LOOP_INFINITE to loop forever. */
void* pContext; /* Context value to be passed back in callbacks. */
} XAUDIO2_BUFFER;
/* Used in IXAudio2SourceVoice::SubmitSourceBuffer when submitting XWMA data.
* NOTE: If an XWMA sound is submitted in more than one buffer, each buffer's
* pDecodedPacketCumulativeBytes[PacketCount-1] value must be subtracted from
* all the entries in the next buffer's pDecodedPacketCumulativeBytes array.
* And whether a sound is submitted in more than one buffer or not, the final
* buffer of the sound should use the XAUDIO2_END_OF_STREAM flag, or else the
* client must call IXAudio2SourceVoice::Discontinuity after submitting it.
*/
typedef struct XAUDIO2_BUFFER_WMA
{
const UINT32* pDecodedPacketCumulativeBytes; /* Decoded packet's cumulative size array.
* Each element is the number of bytes accumulated
* when the corresponding XWMA packet is decoded in
* order. The array must have PacketCount elements. */
UINT32 PacketCount; /* Number of XWMA packets submitted. Must be >= 1 and */
/* divide evenly into XAUDIO2_BUFFER.AudioBytes. */
} XAUDIO2_BUFFER_WMA;
/* Returned by IXAudio2SourceVoice::GetState */
typedef struct XAUDIO2_VOICE_STATE
{
void* pCurrentBufferContext; /* The pContext value provided in the XAUDIO2_BUFFER */
/* that is currently being processed, or NULL if */
/* there are no buffers in the queue. */
UINT32 BuffersQueued; /* Number of buffers currently queued on the voice */
/* (including the one that is being processed). */
UINT64 SamplesPlayed; /* Total number of samples produced by the voice since
* it began processing the current audio stream.
* If XAUDIO2_VOICE_NOSAMPLESPLAYED is specified
* in the call to IXAudio2SourceVoice::GetState,
* this member will not be calculated, saving CPU. */
} XAUDIO2_VOICE_STATE;
/* Returned by IXAudio2::GetPerformanceData */
typedef struct XAUDIO2_PERFORMANCE_DATA
{
/* CPU usage information */
UINT64 AudioCyclesSinceLastQuery; /* CPU cycles spent on audio processing since the
* last call to StartEngine or GetPerformanceData. */
UINT64 TotalCyclesSinceLastQuery; /* Total CPU cycles elapsed since the last call
* (only counts the CPU XAudio2 is running on). */
UINT32 MinimumCyclesPerQuantum; /* Fewest CPU cycles spent processing any one
* audio quantum since the last call. */
UINT32 MaximumCyclesPerQuantum; /* Most CPU cycles spent processing any one
* audio quantum since the last call. */
/* Memory usage information */
UINT32 MemoryUsageInBytes; /* Total heap space currently in use. */
/* Audio latency and glitching information */
UINT32 CurrentLatencyInSamples; /* Minimum delay from when a sample is read from a */
/* source buffer to when it reaches the speakers. */
UINT32 GlitchesSinceEngineStarted; /* Audio dropouts since the engine was started. */
/* Data about XAudio2's current workload */
UINT32 ActiveSourceVoiceCount; /* Source voices currently playing. */
UINT32 TotalSourceVoiceCount; /* Source voices currently existing. */
UINT32 ActiveSubmixVoiceCount; /* Submix voices currently playing/existing. */
UINT32 ActiveResamplerCount; /* Resample xAPOs currently active. */
UINT32 ActiveMatrixMixCount; /* MatrixMix xAPOs currently active. */
/* Usage of the hardware XMA decoder (Xbox 360 only) */
UINT32 ActiveXmaSourceVoices; /* Number of source voices decoding XMA data. */
UINT32 ActiveXmaStreams; /* A voice can use more than one XMA stream. */
} XAUDIO2_PERFORMANCE_DATA;
/* Used in IXAudio2::SetDebugConfiguration */
typedef struct XAUDIO2_DEBUG_CONFIGURATION
{
UINT32 TraceMask; /* Bitmap of enabled debug message types. */
UINT32 BreakMask; /* Message types that will break into the debugger. */
BOOL LogThreadID; /* Whether to log the thread ID with each message. */
BOOL LogFileline; /* Whether to log the source file and line number. */
BOOL LogFunctionName; /* Whether to log the function name. */
BOOL LogTiming; /* Whether to log message timestamps. */
} XAUDIO2_DEBUG_CONFIGURATION;
/* Values for the TraceMask and BreakMask bitmaps. Only ERRORS and WARNINGS
* are valid in BreakMask. WARNINGS implies ERRORS, DETAIL implies INFO, and
* FUNC_CALLS implies API_CALLS. By default, TraceMask is ERRORS and WARNINGS
* and all the other settings are zero. */
#define XAUDIO2_LOG_ERRORS 0x0001 /* For handled errors with serious effects. */
#define XAUDIO2_LOG_WARNINGS 0x0002 /* For handled errors that may be recoverable. */
#define XAUDIO2_LOG_INFO 0x0004 /* Informational chit-chat (e.g. state changes). */
#define XAUDIO2_LOG_DETAIL 0x0008 /* More detailed chit-chat. */
#define XAUDIO2_LOG_API_CALLS 0x0010 /* Public API function entries and exits. */
#define XAUDIO2_LOG_FUNC_CALLS 0x0020 /* Internal function entries and exits. */
#define XAUDIO2_LOG_TIMING 0x0040 /* Delays detected and other timing data. */
#define XAUDIO2_LOG_LOCKS 0x0080 /* Usage of critical sections and mutexes. */
#define XAUDIO2_LOG_MEMORY 0x0100 /* Memory heap usage information. */
#define XAUDIO2_LOG_STREAMING 0x1000 /* Audio streaming information. */
/**************************************************************************
*
* IXAudio2: Top-level XAudio2 COM interface.
*
**************************************************************************/
/* Use default arguments if compiling as C++ */
#ifdef __cplusplus
#define X2DEFAULT(x) =x
#else
#define X2DEFAULT(x)
#endif
#undef INTERFACE
#define INTERFACE IXAudio2
DECLARE_INTERFACE_(IXAudio2, IUnknown)
{
STDMETHOD(QueryInterface) (THIS_ REFIID riid, _Outptr_ void** ppvInterface) PURE;
STDMETHOD_(ULONG, AddRef) (THIS) PURE;
STDMETHOD_(ULONG, Release) (THIS) PURE;
STDMETHOD(RegisterForCallbacks) (_In_ IXAudio2EngineCallback* pCallback) PURE;
STDMETHOD_(void, UnregisterForCallbacks) (_In_ IXAudio2EngineCallback* pCallback) PURE;
STDMETHOD(CreateSourceVoice) (THIS_ _Outptr_ IXAudio2SourceVoice** ppSourceVoice,
_In_ const WAVEFORMATEX* pSourceFormat,
UINT32 Flags X2DEFAULT(0),
float MaxFrequencyRatio X2DEFAULT(XAUDIO2_DEFAULT_FREQ_RATIO),
_In_opt_ IXAudio2VoiceCallback* pCallback X2DEFAULT(NULL),
_In_opt_ const XAUDIO2_VOICE_SENDS* pSendList X2DEFAULT(NULL),
_In_opt_ const XAUDIO2_EFFECT_CHAIN* pEffectChain X2DEFAULT(NULL)) PURE;
STDMETHOD(CreateSubmixVoice) (THIS_ _Outptr_ IXAudio2SubmixVoice** ppSubmixVoice,
UINT32 InputChannels, UINT32 InputSampleRate,
UINT32 Flags X2DEFAULT(0), UINT32 ProcessingStage X2DEFAULT(0),
_In_opt_ const XAUDIO2_VOICE_SENDS* pSendList X2DEFAULT(NULL),
_In_opt_ const XAUDIO2_EFFECT_CHAIN* pEffectChain X2DEFAULT(NULL)) PURE;
STDMETHOD(CreateMasteringVoice) (THIS_ _Outptr_ IXAudio2MasteringVoice** ppMasteringVoice,
UINT32 InputChannels X2DEFAULT(XAUDIO2_DEFAULT_CHANNELS),
UINT32 InputSampleRate X2DEFAULT(XAUDIO2_DEFAULT_SAMPLERATE),
UINT32 Flags X2DEFAULT(0), _In_opt_z_ LPCWSTR szDeviceId X2DEFAULT(NULL),
_In_opt_ const XAUDIO2_EFFECT_CHAIN* pEffectChain X2DEFAULT(NULL),
_In_ AUDIO_STREAM_CATEGORY StreamCategory X2DEFAULT(AudioCategory_GameEffects)) PURE;
STDMETHOD(StartEngine) (THIS) PURE;
STDMETHOD_(void, StopEngine) (THIS) PURE;
STDMETHOD(CommitChanges) (THIS_ UINT32 OperationSet) PURE;
STDMETHOD_(void, GetPerformanceData) (THIS_ _Out_ XAUDIO2_PERFORMANCE_DATA* pPerfData) PURE;
STDMETHOD_(void, SetDebugConfiguration) (THIS_ _In_opt_ const XAUDIO2_DEBUG_CONFIGURATION* pDebugConfiguration,
_Reserved_ void* pReserved X2DEFAULT(NULL)) PURE;
};
/**************************************************************************
*
* IXAudio2Voice: Base voice management interface.
*
**************************************************************************/
#undef INTERFACE
#define INTERFACE IXAudio2Voice
DECLARE_INTERFACE(IXAudio2Voice)
{
#define Declare_IXAudio2Voice_Methods() \
STDMETHOD_(void, GetVoiceDetails) (THIS_ _Out_ XAUDIO2_VOICE_DETAILS* pVoiceDetails) PURE; \
STDMETHOD(SetOutputVoices) (THIS_ _In_opt_ const XAUDIO2_VOICE_SENDS* pSendList) PURE; \
STDMETHOD(SetEffectChain) (THIS_ _In_opt_ const XAUDIO2_EFFECT_CHAIN* pEffectChain) PURE; \
STDMETHOD(EnableEffect) (THIS_ UINT32 EffectIndex, \
UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \
STDMETHOD(DisableEffect) (THIS_ UINT32 EffectIndex, \
UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \
STDMETHOD_(void, GetEffectState) (THIS_ UINT32 EffectIndex, _Out_ BOOL* pEnabled) PURE; \
STDMETHOD(SetEffectParameters) (THIS_ UINT32 EffectIndex, \
_In_reads_bytes_(ParametersByteSize) const void* pParameters, \
UINT32 ParametersByteSize, \
UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \
STDMETHOD(GetEffectParameters) (THIS_ UINT32 EffectIndex, \
_Out_writes_bytes_(ParametersByteSize) void* pParameters, \
UINT32 ParametersByteSize) PURE; \
STDMETHOD(SetFilterParameters) (THIS_ _In_ const XAUDIO2_FILTER_PARAMETERS* pParameters, \
UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \
STDMETHOD_(void, GetFilterParameters) (THIS_ _Out_ XAUDIO2_FILTER_PARAMETERS* pParameters) PURE; \
STDMETHOD(SetOutputFilterParameters) (THIS_ _In_opt_ IXAudio2Voice* pDestinationVoice, \
_In_ const XAUDIO2_FILTER_PARAMETERS* pParameters, \
UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \
STDMETHOD_(void, GetOutputFilterParameters) (THIS_ _In_opt_ IXAudio2Voice* pDestinationVoice, \
_Out_ XAUDIO2_FILTER_PARAMETERS* pParameters) PURE; \
STDMETHOD(SetVolume) (THIS_ float Volume, \
UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \
STDMETHOD_(void, GetVolume) (THIS_ _Out_ float* pVolume) PURE; \
STDMETHOD(SetChannelVolumes) (THIS_ UINT32 Channels, _In_reads_(Channels) const float* pVolumes, \
UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \
STDMETHOD_(void, GetChannelVolumes) (THIS_ UINT32 Channels, _Out_writes_(Channels) float* pVolumes) PURE; \
STDMETHOD(SetOutputMatrix) (THIS_ _In_opt_ IXAudio2Voice* pDestinationVoice, \
UINT32 SourceChannels, UINT32 DestinationChannels, \
_In_reads_(SourceChannels * DestinationChannels) const float* pLevelMatrix, \
UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \
STDMETHOD_(void, GetOutputMatrix) (THIS_ _In_opt_ IXAudio2Voice* pDestinationVoice, \
UINT32 SourceChannels, UINT32 DestinationChannels, \
_Out_writes_(SourceChannels * DestinationChannels) float* pLevelMatrix) PURE; \
STDMETHOD_(void, DestroyVoice) (THIS) PURE
Declare_IXAudio2Voice_Methods();
};
/**************************************************************************
*
* IXAudio2SourceVoice: Source voice management interface.
*
**************************************************************************/
#undef INTERFACE
#define INTERFACE IXAudio2SourceVoice
DECLARE_INTERFACE_(IXAudio2SourceVoice, IXAudio2Voice)
{
Declare_IXAudio2Voice_Methods();
STDMETHOD(Start) (THIS_ UINT32 Flags X2DEFAULT(0), UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE;
STDMETHOD(Stop) (THIS_ UINT32 Flags X2DEFAULT(0), UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE;
STDMETHOD(SubmitSourceBuffer) (THIS_ _In_ const XAUDIO2_BUFFER* pBuffer, _In_opt_ const XAUDIO2_BUFFER_WMA* pBufferWMA X2DEFAULT(NULL)) PURE;
STDMETHOD(FlushSourceBuffers) (THIS) PURE;
STDMETHOD(Discontinuity) (THIS) PURE;
STDMETHOD(ExitLoop) (THIS_ UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE;
STDMETHOD_(void, GetState) (THIS_ _Out_ XAUDIO2_VOICE_STATE* pVoiceState, UINT32 Flags X2DEFAULT(0)) PURE;
STDMETHOD(SetFrequencyRatio) (THIS_ float Ratio,
UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE;
STDMETHOD_(void, GetFrequencyRatio) (THIS_ _Out_ float* pRatio) PURE;
STDMETHOD(SetSourceSampleRate) (THIS_ UINT32 NewSourceSampleRate) PURE;
};
/**************************************************************************
*
* IXAudio2SubmixVoice: Submixing voice management interface.
*
**************************************************************************/
#undef INTERFACE
#define INTERFACE IXAudio2SubmixVoice
DECLARE_INTERFACE_(IXAudio2SubmixVoice, IXAudio2Voice)
{
Declare_IXAudio2Voice_Methods();
};
/**************************************************************************
*
* IXAudio2MasteringVoice: Mastering voice management interface.
*
**************************************************************************/
#undef INTERFACE
#define INTERFACE IXAudio2MasteringVoice
DECLARE_INTERFACE_(IXAudio2MasteringVoice, IXAudio2Voice)
{
Declare_IXAudio2Voice_Methods();
STDMETHOD(GetChannelMask) (THIS_ _Out_ DWORD* pChannelmask) PURE;
};
/**************************************************************************
*
* IXAudio2EngineCallback: Client notification interface for engine events.
*
* REMARKS: Contains methods to notify the client when certain events happen
* in the XAudio2 engine. This interface should be implemented by
* the client. XAudio2 will call these methods via the interface
* pointer provided by the client when it calls
* IXAudio2::RegisterForCallbacks.
*
**************************************************************************/
#undef INTERFACE
#define INTERFACE IXAudio2EngineCallback
DECLARE_INTERFACE(IXAudio2EngineCallback)
{
STDMETHOD_(void, OnProcessingPassStart) (THIS) PURE;
STDMETHOD_(void, OnProcessingPassEnd) (THIS) PURE;
STDMETHOD_(void, OnCriticalError) (THIS_ HRESULT Error) PURE;
};
/**************************************************************************
*
* IXAudio2VoiceCallback: Client notification interface for voice events.
*
* REMARKS: Contains methods to notify the client when certain events happen
* in an XAudio2 voice. This interface should be implemented by the
* client. XAudio2 will call these methods via an interface pointer
* provided by the client in the IXAudio2::CreateSourceVoice call.
*
**************************************************************************/
#undef INTERFACE
#define INTERFACE IXAudio2VoiceCallback
DECLARE_INTERFACE(IXAudio2VoiceCallback)
{
STDMETHOD_(void, OnVoiceProcessingPassStart) (THIS_ UINT32 BytesRequired) PURE;
STDMETHOD_(void, OnVoiceProcessingPassEnd) (THIS) PURE;
STDMETHOD_(void, OnStreamEnd) (THIS) PURE;
STDMETHOD_(void, OnBufferStart) (THIS_ void* pBufferContext) PURE;
STDMETHOD_(void, OnBufferEnd) (THIS_ void* pBufferContext) PURE;
STDMETHOD_(void, OnLoopEnd) (THIS_ void* pBufferContext) PURE;
STDMETHOD_(void, OnVoiceError) (THIS_ void* pBufferContext, HRESULT Error) PURE;
};
/**************************************************************************
*
* Macros to make it easier to use the XAudio2 COM interfaces in C code.
*
**************************************************************************/
#ifndef __cplusplus
/* IXAudio2 */
#define IXAudio2_QueryInterface(This,riid,ppvInterface) ((This)->lpVtbl->QueryInterface(This,riid,ppvInterface))
#define IXAudio2_AddRef(This) ((This)->lpVtbl->AddRef(This))
#define IXAudio2_Release(This) ((This)->lpVtbl->Release(This))
#define IXAudio2_CreateSourceVoice(This,ppSourceVoice,pSourceFormat,Flags,MaxFrequencyRatio,pCallback,pSendList,pEffectChain) ((This)->lpVtbl->CreateSourceVoice(This,ppSourceVoice,pSourceFormat,Flags,MaxFrequencyRatio,pCallback,pSendList,pEffectChain))
#define IXAudio2_CreateSubmixVoice(This,ppSubmixVoice,InputChannels,InputSampleRate,Flags,ProcessingStage,pSendList,pEffectChain) ((This)->lpVtbl->CreateSubmixVoice(This,ppSubmixVoice,InputChannels,InputSampleRate,Flags,ProcessingStage,pSendList,pEffectChain))
#define IXAudio2_CreateMasteringVoice(This,ppMasteringVoice,InputChannels,InputSampleRate,Flags,DeviceId,pEffectChain,StreamCategory) ((This)->lpVtbl->CreateMasteringVoice(This,ppMasteringVoice,InputChannels,InputSampleRate,Flags,DeviceId,pEffectChain,StreamCategory))
#define IXAudio2_StartEngine(This) ((This)->lpVtbl->StartEngine(This))
#define IXAudio2_StopEngine(This) ((This)->lpVtbl->StopEngine(This))
#define IXAudio2_CommitChanges(This,OperationSet) ((This)->lpVtbl->CommitChanges(This,OperationSet))
#define IXAudio2_GetPerformanceData(This,pPerfData) ((This)->lpVtbl->GetPerformanceData(This,pPerfData))
#define IXAudio2_SetDebugConfiguration(This,pDebugConfiguration,pReserved) ((This)->lpVtbl->SetDebugConfiguration(This,pDebugConfiguration,pReserved))
/* IXAudio2Voice */
#define IXAudio2Voice_GetVoiceDetails(This,pVoiceDetails) ((This)->lpVtbl->GetVoiceDetails(This,pVoiceDetails))
#define IXAudio2Voice_SetOutputVoices(This,pSendList) ((This)->lpVtbl->SetOutputVoices(This,pSendList))
#define IXAudio2Voice_SetEffectChain(This,pEffectChain) ((This)->lpVtbl->SetEffectChain(This,pEffectChain))
#define IXAudio2Voice_EnableEffect(This,EffectIndex,OperationSet) ((This)->lpVtbl->EnableEffect(This,EffectIndex,OperationSet))
#define IXAudio2Voice_DisableEffect(This,EffectIndex,OperationSet) ((This)->lpVtbl->DisableEffect(This,EffectIndex,OperationSet))
#define IXAudio2Voice_GetEffectState(This,EffectIndex,pEnabled) ((This)->lpVtbl->GetEffectState(This,EffectIndex,pEnabled))
#define IXAudio2Voice_SetEffectParameters(This,EffectIndex,pParameters,ParametersByteSize, OperationSet) ((This)->lpVtbl->SetEffectParameters(This,EffectIndex,pParameters,ParametersByteSize,OperationSet))
#define IXAudio2Voice_GetEffectParameters(This,EffectIndex,pParameters,ParametersByteSize) ((This)->lpVtbl->GetEffectParameters(This,EffectIndex,pParameters,ParametersByteSize))
#define IXAudio2Voice_SetFilterParameters(This,pParameters,OperationSet) ((This)->lpVtbl->SetFilterParameters(This,pParameters,OperationSet))
#define IXAudio2Voice_GetFilterParameters(This,pParameters) ((This)->lpVtbl->GetFilterParameters(This,pParameters))
#define IXAudio2Voice_SetOutputFilterParameters(This,pDestinationVoice,pParameters,OperationSet) ((This)->lpVtbl->SetOutputFilterParameters(This,pDestinationVoice,pParameters,OperationSet))
#define IXAudio2Voice_GetOutputFilterParameters(This,pDestinationVoice,pParameters) ((This)->lpVtbl->GetOutputFilterParameters(This,pDestinationVoice,pParameters))
#define IXAudio2Voice_SetVolume(This,Volume,OperationSet) ((This)->lpVtbl->SetVolume(This,Volume,OperationSet))
#define IXAudio2Voice_GetVolume(This,pVolume) ((This)->lpVtbl->GetVolume(This,pVolume))
#define IXAudio2Voice_SetChannelVolumes(This,Channels,pVolumes,OperationSet) ((This)->lpVtbl->SetChannelVolumes(This,Channels,pVolumes,OperationSet))
#define IXAudio2Voice_GetChannelVolumes(This,Channels,pVolumes) ((This)->lpVtbl->GetChannelVolumes(This,Channels,pVolumes))
#define IXAudio2Voice_SetOutputMatrix(This,pDestinationVoice,SourceChannels,DestinationChannels,pLevelMatrix,OperationSet) ((This)->lpVtbl->SetOutputMatrix(This,pDestinationVoice,SourceChannels,DestinationChannels,pLevelMatrix,OperationSet))
#define IXAudio2Voice_GetOutputMatrix(This,pDestinationVoice,SourceChannels,DestinationChannels,pLevelMatrix) ((This)->lpVtbl->GetOutputMatrix(This,pDestinationVoice,SourceChannels,DestinationChannels,pLevelMatrix))
#define IXAudio2Voice_DestroyVoice(This) ((This)->lpVtbl->DestroyVoice(This))
/* IXAudio2SourceVoice */
#define IXAudio2SourceVoice_GetVoiceDetails IXAudio2Voice_GetVoiceDetails
#define IXAudio2SourceVoice_SetOutputVoices IXAudio2Voice_SetOutputVoices
#define IXAudio2SourceVoice_SetEffectChain IXAudio2Voice_SetEffectChain
#define IXAudio2SourceVoice_EnableEffect IXAudio2Voice_EnableEffect
#define IXAudio2SourceVoice_DisableEffect IXAudio2Voice_DisableEffect
#define IXAudio2SourceVoice_GetEffectState IXAudio2Voice_GetEffectState
#define IXAudio2SourceVoice_SetEffectParameters IXAudio2Voice_SetEffectParameters
#define IXAudio2SourceVoice_GetEffectParameters IXAudio2Voice_GetEffectParameters
#define IXAudio2SourceVoice_SetFilterParameters IXAudio2Voice_SetFilterParameters
#define IXAudio2SourceVoice_GetFilterParameters IXAudio2Voice_GetFilterParameters
#define IXAudio2SourceVoice_SetOutputFilterParameters IXAudio2Voice_SetOutputFilterParameters
#define IXAudio2SourceVoice_GetOutputFilterParameters IXAudio2Voice_GetOutputFilterParameters
#define IXAudio2SourceVoice_SetVolume IXAudio2Voice_SetVolume
#define IXAudio2SourceVoice_GetVolume IXAudio2Voice_GetVolume
#define IXAudio2SourceVoice_SetChannelVolumes IXAudio2Voice_SetChannelVolumes
#define IXAudio2SourceVoice_GetChannelVolumes IXAudio2Voice_GetChannelVolumes
#define IXAudio2SourceVoice_SetOutputMatrix IXAudio2Voice_SetOutputMatrix
#define IXAudio2SourceVoice_GetOutputMatrix IXAudio2Voice_GetOutputMatrix
#define IXAudio2SourceVoice_DestroyVoice IXAudio2Voice_DestroyVoice
#define IXAudio2SourceVoice_Start(This,Flags,OperationSet) ((This)->lpVtbl->Start(This,Flags,OperationSet))
#define IXAudio2SourceVoice_Stop(This,Flags,OperationSet) ((This)->lpVtbl->Stop(This,Flags,OperationSet))
#define IXAudio2SourceVoice_SubmitSourceBuffer(This,pBuffer,pBufferWMA) ((This)->lpVtbl->SubmitSourceBuffer(This,pBuffer,pBufferWMA))
#define IXAudio2SourceVoice_FlushSourceBuffers(This) ((This)->lpVtbl->FlushSourceBuffers(This))
#define IXAudio2SourceVoice_Discontinuity(This) ((This)->lpVtbl->Discontinuity(This))
#define IXAudio2SourceVoice_ExitLoop(This,OperationSet) ((This)->lpVtbl->ExitLoop(This,OperationSet))
#define IXAudio2SourceVoice_GetState(This,pVoiceState,Flags) ((This)->lpVtbl->GetState(This,pVoiceState,Flags))
#define IXAudio2SourceVoice_SetFrequencyRatio(This,Ratio,OperationSet) ((This)->lpVtbl->SetFrequencyRatio(This,Ratio,OperationSet))
#define IXAudio2SourceVoice_GetFrequencyRatio(This,pRatio) ((This)->lpVtbl->GetFrequencyRatio(This,pRatio))
#define IXAudio2SourceVoice_SetSourceSampleRate(This,NewSourceSampleRate) ((This)->lpVtbl->SetSourceSampleRate(This,NewSourceSampleRate))
/* IXAudio2SubmixVoice */
#define IXAudio2SubmixVoice_GetVoiceDetails IXAudio2Voice_GetVoiceDetails
#define IXAudio2SubmixVoice_SetOutputVoices IXAudio2Voice_SetOutputVoices
#define IXAudio2SubmixVoice_SetEffectChain IXAudio2Voice_SetEffectChain
#define IXAudio2SubmixVoice_EnableEffect IXAudio2Voice_EnableEffect
#define IXAudio2SubmixVoice_DisableEffect IXAudio2Voice_DisableEffect
#define IXAudio2SubmixVoice_GetEffectState IXAudio2Voice_GetEffectState
#define IXAudio2SubmixVoice_SetEffectParameters IXAudio2Voice_SetEffectParameters
#define IXAudio2SubmixVoice_GetEffectParameters IXAudio2Voice_GetEffectParameters
#define IXAudio2SubmixVoice_SetFilterParameters IXAudio2Voice_SetFilterParameters
#define IXAudio2SubmixVoice_GetFilterParameters IXAudio2Voice_GetFilterParameters
#define IXAudio2SubmixVoice_SetOutputFilterParameters IXAudio2Voice_SetOutputFilterParameters
#define IXAudio2SubmixVoice_GetOutputFilterParameters IXAudio2Voice_GetOutputFilterParameters
#define IXAudio2SubmixVoice_SetVolume IXAudio2Voice_SetVolume
#define IXAudio2SubmixVoice_GetVolume IXAudio2Voice_GetVolume
#define IXAudio2SubmixVoice_SetChannelVolumes IXAudio2Voice_SetChannelVolumes
#define IXAudio2SubmixVoice_GetChannelVolumes IXAudio2Voice_GetChannelVolumes
#define IXAudio2SubmixVoice_SetOutputMatrix IXAudio2Voice_SetOutputMatrix
#define IXAudio2SubmixVoice_GetOutputMatrix IXAudio2Voice_GetOutputMatrix
#define IXAudio2SubmixVoice_DestroyVoice IXAudio2Voice_DestroyVoice
/* IXAudio2MasteringVoice */
#define IXAudio2MasteringVoice_GetVoiceDetails IXAudio2Voice_GetVoiceDetails
#define IXAudio2MasteringVoice_SetOutputVoices IXAudio2Voice_SetOutputVoices
#define IXAudio2MasteringVoice_SetEffectChain IXAudio2Voice_SetEffectChain
#define IXAudio2MasteringVoice_EnableEffect IXAudio2Voice_EnableEffect
#define IXAudio2MasteringVoice_DisableEffect IXAudio2Voice_DisableEffect
#define IXAudio2MasteringVoice_GetEffectState IXAudio2Voice_GetEffectState
#define IXAudio2MasteringVoice_SetEffectParameters IXAudio2Voice_SetEffectParameters
#define IXAudio2MasteringVoice_GetEffectParameters IXAudio2Voice_GetEffectParameters
#define IXAudio2MasteringVoice_SetFilterParameters IXAudio2Voice_SetFilterParameters
#define IXAudio2MasteringVoice_GetFilterParameters IXAudio2Voice_GetFilterParameters
#define IXAudio2MasteringVoice_SetOutputFilterParameters IXAudio2Voice_SetOutputFilterParameters
#define IXAudio2MasteringVoice_GetOutputFilterParameters IXAudio2Voice_GetOutputFilterParameters
#define IXAudio2MasteringVoice_SetVolume IXAudio2Voice_SetVolume
#define IXAudio2MasteringVoice_GetVolume IXAudio2Voice_GetVolume
#define IXAudio2MasteringVoice_SetChannelVolumes IXAudio2Voice_SetChannelVolumes
#define IXAudio2MasteringVoice_GetChannelVolumes IXAudio2Voice_GetChannelVolumes
#define IXAudio2MasteringVoice_SetOutputMatrix IXAudio2Voice_SetOutputMatrix
#define IXAudio2MasteringVoice_GetOutputMatrix IXAudio2Voice_GetOutputMatrix
#define IXAudio2MasteringVoice_DestroyVoice IXAudio2Voice_DestroyVoice
#define IXAudio2MasteringVoice_GetChannelMask(This,pChannelMask) ((This)->lpVtbl->GetChannelMask(This,pChannelMask))
#endif /* #ifndef __cplusplus */
/**************************************************************************
*
* Utility functions used to convert from pitch in semitones and volume
* in decibels to the frequency and amplitude ratio units used by XAudio2.
* These are only defined if the client #defines XAUDIO2_HELPER_FUNCTIONS
* prior to #including xaudio2.h.
*
**************************************************************************/
#ifdef XAUDIO2_HELPER_FUNCTIONS
#define _USE_MATH_DEFINES /* Make math.h define M_PI */
#include <math.h> /* For powf, log10f, sinf and asinf */
/* Calculate the argument to SetVolume from a decibel value */
static INLINE float XAudio2DecibelsToAmplitudeRatio(float Decibels)
{
return powf(10.0f, Decibels / 20.0f);
}
/* Recover a volume in decibels from an amplitude factor */
static INLINE float XAudio2AmplitudeRatioToDecibels(float Volume)
{
if (Volume == 0)
return -3.402823466e+38f; /* Smallest float value (-FLT_MAX) */
return 20.0f * log10f(Volume);
}
/* Calculate the argument to SetFrequencyRatio from a semitone value */
static INLINE float XAudio2SemitonesToFrequencyRatio(float Semitones)
{
/* FrequencyRatio = 2 ^ Octaves
* = 2 ^ (Semitones / 12)
*/
return powf(2.0f, Semitones / 12.0f);
}
/* Recover a pitch in semitones from a frequency ratio */
static INLINE float XAudio2FrequencyRatioToSemitones(float FrequencyRatio)
{
/* Semitones = 12 * log2(FrequencyRatio)
* = 12 * log2(10) * log10(FrequencyRatio)
*/
return 39.86313713864835f * log10f(FrequencyRatio);
}
/* Convert from filter cutoff frequencies expressed in Hertz to the radian
* frequency values used in XAUDIO2_FILTER_PARAMETERS.Frequency, state-variable
* filter types only. Use XAudio2CutoffFrequencyToOnePoleCoefficient() for one-pole filter types.
* Note that the highest CutoffFrequency supported is SampleRate/6.
* Higher values of CutoffFrequency will return XAUDIO2_MAX_FILTER_FREQUENCY.
*/
static INLINE float XAudio2CutoffFrequencyToRadians(float CutoffFrequency, UINT32 SampleRate)
{
if ((UINT32)(CutoffFrequency * 6.0f) >= SampleRate)
return XAUDIO2_MAX_FILTER_FREQUENCY;
return 2.0f * sinf((float)M_PI * CutoffFrequency / SampleRate);
}
/* Convert from radian frequencies back to absolute frequencies in Hertz */
static INLINE float XAudio2RadiansToCutoffFrequency(float Radians, float SampleRate)
{
return SampleRate * asinf(Radians / 2.0f) / (float)M_PI;
}
/* Convert from filter cutoff frequencies expressed in Hertz to the filter
* coefficients used with XAUDIO2_FILTER_PARAMETERS.Frequency,
* LowPassOnePoleFilter and HighPassOnePoleFilter filter types only.
* Use XAudio2CutoffFrequencyToRadians() for state-variable filter types.
*/
static INLINE float XAudio2CutoffFrequencyToOnePoleCoefficient(float CutoffFrequency, UINT32 SampleRate)
{
if ((UINT32)CutoffFrequency >= SampleRate)
return XAUDIO2_MAX_FILTER_FREQUENCY;
return (1.0f - powf(1.0f - 2.0f * CutoffFrequency / SampleRate, 2.0f));
}
#endif /* #ifdef XAUDIO2_HELPER_FUNCTIONS */
/**************************************************************************
*
* XAudio2Create: Top-level function that creates an XAudio2 instance.
*
* ARGUMENTS:
*
* Flags - Flags specifying the XAudio2 object's behavior.
*
* XAudio2Processor - An XAUDIO2_PROCESSOR value that specifies the
* hardware threads (Xbox) or processors (Windows) that XAudio2
* will use. Note that XAudio2 supports concurrent processing on
* multiple threads, using any combination of XAUDIO2_PROCESSOR
* flags. The values are platform-specific; platform-independent
* code can use XAUDIO2_DEFAULT_PROCESSOR to use the default on
* each platform.
*
**************************************************************************/
#ifdef __cplusplus__
#if (defined XAUDIO2_EXPORT)
/* We're building xaudio2.dll */
#define XAUDIO2_STDAPI extern "C" __declspec(dllexport) HRESULT __stdcall
#else
/* We're an xaudio2 client */
#define XAUDIO2_STDAPI extern "C" __declspec(dllimport) HRESULT __stdcall
#endif
#else
/* Modified for C support */
#if (defined XAUDIO2_EXPORT)
/* We're building xaudio2.dll */
#define XAUDIO2_STDAPI __declspec(dllexport) HRESULT __stdcall
#else
/* We're an xaudio2 client */
#define XAUDIO2_STDAPI __declspec(dllimport) HRESULT __stdcall
#endif
#endif
#if (NTDDI_VERSION >= NTDDI_WIN10_RS5) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
XAUDIO2_STDAPI XAudio2CreateWithVersionInfo(_Outptr_ IXAudio2** ppXAudio2,
UINT32 Flags X2DEFAULT(0),
XAUDIO2_PROCESSOR XAudio2Processor X2DEFAULT(XAUDIO2_DEFAULT_PROCESSOR),
DWORD ntddiVersion X2DEFAULT(NTDDI_VERSION));
static INLINE HRESULT XAudio2Create(_Outptr_ IXAudio2** ppXAudio2,
UINT32 Flags X2DEFAULT(0),
XAUDIO2_PROCESSOR XAudio2Processor X2DEFAULT(XAUDIO2_DEFAULT_PROCESSOR))
{
/* When compiled for RS5 or later, try to invoke XAudio2CreateWithVersionInfo.
* Need to use LoadLibrary in case the app is running on an older OS. */
typedef HRESULT(__stdcall *XAudio2CreateWithVersionInfoFunc)(_Outptr_ IXAudio2**, UINT32, XAUDIO2_PROCESSOR, DWORD);
typedef HRESULT(__stdcall *XAudio2CreateInfoFunc)(_Outptr_ IXAudio2**, UINT32, XAUDIO2_PROCESSOR);
static HMODULE s_dllInstance = NULL;
static XAudio2CreateWithVersionInfoFunc s_pfnAudio2CreateWithVersion = NULL;
static XAudio2CreateInfoFunc s_pfnAudio2Create = NULL;
if (s_dllInstance == NULL)
{
s_dllInstance = LoadLibraryEx(XAUDIO2_DLL, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
if (s_dllInstance == NULL)
return HRESULT_FROM_WIN32(GetLastError());
s_pfnAudio2CreateWithVersion = (XAudio2CreateWithVersionInfoFunc)(void*)GetProcAddress(s_dllInstance, "XAudio2CreateWithVersionInfo");
if (s_pfnAudio2CreateWithVersion == NULL)
{
s_pfnAudio2Create = (XAudio2CreateInfoFunc)(void*)GetProcAddress(s_dllInstance, "XAudio2Create");
if (s_pfnAudio2Create == NULL)
return HRESULT_FROM_WIN32(GetLastError());
}
}
if (s_pfnAudio2CreateWithVersion != NULL)
return (*s_pfnAudio2CreateWithVersion)(ppXAudio2, Flags, XAudio2Processor, NTDDI_VERSION);
return (*s_pfnAudio2Create)(ppXAudio2, Flags, XAudio2Processor);
}
#else
/* RS4 or older, or not a desktop app */
XAUDIO2_STDAPI XAudio2Create(_Outptr_ IXAudio2** ppXAudio2, UINT32 Flags X2DEFAULT(0),
XAUDIO2_PROCESSOR XAudio2Processor X2DEFAULT(XAUDIO2_DEFAULT_PROCESSOR));
#endif
/* Undo the #pragma pack(push, 1) directive at the top of this file */
#pragma pack(pop)
#endif /* #ifndef GUID_DEFS_ONLY */
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_TV_APP | WINAPI_PARTITION_TV_TITLE) */
#pragma endregion
#endif /* #ifndef __XAUDIO2_INCLUDED__ */
+1 -1
View File
@@ -21,7 +21,7 @@
#include <retro_inline.h>
#include "../../retroarch.h"
#include "../audio_driver.h"
#define SOUND_FREQUENCY 48000
#define MAX_BUFFER 2048
+8 -2
View File
@@ -55,6 +55,7 @@ typedef struct rarch_CC_resampler
void (*process)(void *re, struct resampler_data *data);
} rarch_CC_resampler_t;
#ifdef _MIPS_ARCH_ALLEGREX
static void resampler_CC_process(void *re_, struct resampler_data *data)
{
@@ -114,6 +115,7 @@ static void resampler_CC_process(void *re_, struct resampler_data *data)
"vadd.q c720, c720, c620 \n"
"vadd.s s730, s730, s730[1] \n"
"mfv %0, s730 \n"
@@ -149,7 +151,7 @@ done:
}
static void *resampler_CC_init(const struct resampler_config *config,
double bandwidth_mod,
double bandwidth_mod,
enum resampler_quality quality,
resampler_simd_mask_t mask)
{
@@ -214,6 +216,7 @@ static void resampler_CC_downsample(void *re_, struct resampler_data *data)
vec_ww1 = _mm_mul_ps(vec_w1, vec_w1);
vec_ww2 = _mm_mul_ps(vec_w2, vec_w2);
vec_ww1 = _mm_mul_ps(vec_ww1, _mm_sub_ps(_mm_set_ps1(3.0),vec_ww1));
vec_ww2 = _mm_mul_ps(vec_ww2, _mm_sub_ps(_mm_set_ps1(3.0),vec_ww2));
@@ -304,6 +307,7 @@ static void resampler_CC_upsample(void *re_, struct resampler_data *data)
vec_ww1 = _mm_mul_ps(vec_w1, vec_w1);
vec_ww2 = _mm_mul_ps(vec_w2, vec_w2);
vec_ww1 = _mm_mul_ps(vec_ww1,_mm_sub_ps(_mm_set_ps1(3.0),vec_ww1));
vec_ww2 = _mm_mul_ps(vec_ww2,_mm_sub_ps(_mm_set_ps1(3.0),vec_ww2));
@@ -345,6 +349,7 @@ static void resampler_CC_upsample(void *re_, struct resampler_data *data)
data->output_frames = outp - (audio_frame_float_t*)data->data_out;
}
#elif defined (__ARM_NEON__) && !defined(DONT_WANT_ARM_OPTIMIZATIONS)
#define CC_RESAMPLER_IDENT "NEON"
@@ -487,8 +492,9 @@ static void resampler_CC_process(void *re_, struct resampler_data *data)
re->process(re_, data);
}
static void *resampler_CC_init(const struct resampler_config *config,
double bandwidth_mod,
double bandwidth_mod,
enum resampler_quality quality,
resampler_simd_mask_t mask)
{
@@ -78,6 +78,7 @@
# d23: (temp) # d31: buffer[6]
# (temp) # buffer[7]
resampler_CC_downsample_neon:
_resampler_CC_downsample_neon:
@@ -88,6 +89,7 @@ push {r4}
mov r4, r0
veor q0, q0, q0
vmov.f32 s1, #1.0
vmov.f32 s2, #2.0
@@ -100,15 +102,18 @@ vmov.f32 q5, #1.0
vmov.f32 q6, #3.0
vmov.f32 q7, #0.25
vldr s5, [r2, #32]
vdiv.f32 s6, s20, s4
vadd.f32 s7, s6, s8
vdup.f32 q4, d2[0]
vmin.f32 q4, q4, q5
lsl r3, #3
add r3, r3, r1
cmp r3, r1
beq 3f
1:
@@ -194,6 +199,7 @@ vpop {q4,q5,q6,q7}
bx lr
.align 4
.globl resampler_CC_upsample_neon
#ifndef __MACH__
@@ -250,6 +256,7 @@ bx lr
# d23: (temp) # d31: buffer[6]
# (temp) # buffer[7]
resampler_CC_upsample_neon:
_resampler_CC_upsample_neon:
@@ -260,6 +267,7 @@ push {r4}
mov r4, r0
veor q0, q0, q0
vmov.f32 s0, #1.0
vmov.f32 s2, #-1.0
@@ -272,15 +280,18 @@ vmov.f32 q5, #1.0
vmov.f32 q6, #3.0
vmov.f32 q7, #0.25
vldr s5, [r2, #32]
vdiv.f32 s6, s20, s4
vadd.f32 s7, s6, s8
vdup.f32 q4, d2[0]
vmin.f32 q4, q4, q5
lsl r3, #3
add r3, r3, r1
cmp r3, r1
beq 4f
1:
@@ -345,6 +356,7 @@ vst1.f32 d20, [r4, :64]!
vadd.f32 s5, s5, s6
vcmpe.f32 s5, s20
vmrs APSR_nzcv, fpscr
blt 2b
@@ -356,6 +368,7 @@ vsub.f32 s5, s5, s20
cmp r3, r1
bne 1b
4:
vst1.f32 {q14-q15}, [r2, :256]
vstr s5, [r2, #32]
+8 -4
View File
@@ -46,17 +46,14 @@
#define NETWORK_COMPAT_HEADERS 1
#endif
#ifdef NETWORK_COMPAT_HEADERS
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#ifdef __CELLOS_LV2__
#include <sys/poll.h>
#else
#include <poll.h>
#endif
#endif
#include <fcntl.h>
#ifdef _WIN32
@@ -161,6 +158,7 @@ static int rsnd_poll(struct pollfd *fd, int numfd, int timeout);
static void rsnd_cb_thread(void *thread_data);
static void rsnd_thread(void *thread_data);
/* Determine whether we're running big- or little endian */
static INLINE int rsnd_is_little_endian(void)
{
@@ -244,6 +242,7 @@ static int rsnd_connect_server( rsound_t *rd )
rd->conn_type = RSD_CONN_TCP;
rd->conn.socket = net_socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if ( rd->conn.socket < 0 )
goto error;
@@ -313,6 +312,7 @@ static int rsnd_send_header_info(rsound_t *rd)
#define FRAMESIZE 34
#define FORMAT 42
uint32_t temp_rate = rd->rate;
uint16_t temp_channels = rd->channels;
@@ -980,6 +980,7 @@ static int rsnd_close_ctl(rsound_t *rd)
return 0;
}
// Sends delay info request to server on the ctl socket. This code section isn't critical, and will work if it works.
// It will never block.
static int rsnd_send_info_query(rsound_t *rd)
@@ -1295,6 +1296,7 @@ static int rsnd_reset(rsound_t *rd)
return 0;
}
int rsd_stop(rsound_t *rd)
{
retro_assert(rd != NULL);
@@ -1401,6 +1403,7 @@ int rsd_exec(rsound_t *rsound)
return fd;
}
/* ioctl()-ish param setting :D */
int rsd_set_param(rsound_t *rd, enum rsd_settings option, void* param)
{
@@ -1490,6 +1493,7 @@ void rsd_delay_wait(rsound_t *rd)
/* Latency of stream in ms */
int latency_ms = rsd_delay_ms(rd);
/* Should we sleep for a while to keep the latency low? */
if ( rd->max_latency < latency_ms )
{
+3 -2
View File
@@ -86,7 +86,7 @@ SECTIONS
KEEP (*(.fini))
. = ALIGN(32); /* REQUIRED. LD is flaky without it. */
} = 0
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);
@@ -167,6 +167,7 @@ SECTIONS
.jcr : { KEEP (*(.jcr)) }
.got : { *(.got.plt) *(.got) }
/* We want the small data sections together, so single-instruction offsets
can access them all, and initialized data all before uninitialized, so
we can shorten the on-disk segment size. */
@@ -181,7 +182,7 @@ SECTIONS
_edata = .;
PROVIDE (edata = .);
.sbss :
{
__sbss_start = .;
+3 -2
View File
@@ -97,7 +97,7 @@ SECTIONS
KEEP (*(.fini))
. = ALIGN(32); /* REQUIRED. LD is flaky without it. */
} = 0
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);
@@ -178,6 +178,7 @@ SECTIONS
.jcr : { KEEP (*(.jcr)) }
.got : { *(.got.plt) *(.got) }
/* We want the small data sections together, so single-instruction offsets
can access them all, and initialized data all before uninitialized, so
we can shorten the on-disk segment size. */
@@ -192,7 +193,7 @@ SECTIONS
_edata = .;
PROVIDE (edata = .);
.sbss :
{
__sbss_start = .;
+1 -1
View File
@@ -56,7 +56,7 @@ void exitspawn_kernel(const char *fileName, SceSize args, void *argp)
game_param.unk5 = 0x10000;
int k1 = pspSdkSetK1(0);
//sceKernelSuspendAllUserThreads();
//sceKernelSuspendAllUserThreads();
int ret = sceKernelLoadExecVSHMs2(fileName, &game_param);
pspSdkSetK1(k1);
}
+3 -9
View File
@@ -4,11 +4,9 @@
#include <psp2/kernel/sysmem.h>
#include <psp2/kernel/threadmgr.h>
#define RAM_THRESHOLD 0xA00000 // Memory left to the system for threads and other internal stuffs
static int _newlib_heap_memblock;
static unsigned _newlib_heap_size;
char *_newlib_heap_base, *_newlib_heap_end, *_newlib_heap_cur;
static char *_newlib_heap_base, *_newlib_heap_end, *_newlib_heap_cur;
static char _newlib_sbrk_mutex[32] __attribute__ ((aligned (8)));
static int _newlib_vm_memblock;
@@ -48,20 +46,16 @@ void _init_vita_heap(void) {
_newlib_vm_memblock = 0;
}
// Create a mutex to use inside _sbrk_r
if (sceKernelCreateLwMutex((struct SceKernelLwMutexWork*)_newlib_sbrk_mutex, "sbrk mutex", 0, 0, 0) < 0) {
goto failure;
}
// Always allocating the max avaliable USER_RW mem on the system
SceKernelFreeMemorySizeInfo info;
info.size = sizeof(SceKernelFreeMemorySizeInfo);
sceKernelGetFreeMemorySize(&info);
if (&_newlib_heap_size_user != NULL) {
_newlib_heap_size = _newlib_heap_size_user;
}else{
_newlib_heap_size = info.size_user - RAM_THRESHOLD;
_newlib_heap_size = 192 * 1024 * 1024;
}
_newlib_heap_size -= _newlib_vm_size;
+251
View File
@@ -0,0 +1,251 @@
/* 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 <string.h>
#ifdef HAVE_CONFIG_H
#include "../config.h"
#endif
#include "camera_driver.h"
#include "../configuration.h"
#include "../driver.h"
#include "../retroarch.h"
#include "../list_special.h"
#include "../verbosity.h"
static const camera_driver_t *camera_drivers[] = {
#ifdef HAVE_V4L2
&camera_v4l2,
#endif
#ifdef EMSCRIPTEN
&camera_rwebcam,
#endif
#ifdef ANDROID
&camera_android,
#endif
#if defined(HAVE_AVFOUNDATION)
#if defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH)
&camera_avfoundation,
#endif
#endif
&camera_null,
NULL,
};
static struct retro_camera_callback camera_cb;
static const camera_driver_t *camera_driver = NULL;
static void *camera_data = NULL;
static bool camera_driver_active = false;
static bool camera_driver_data_own = false;
/**
* camera_driver_find_handle:
* @idx : index of driver to get handle to.
*
* Returns: handle to camera driver at index. Can be NULL
* if nothing found.
**/
const void *camera_driver_find_handle(int idx)
{
const void *drv = camera_drivers[idx];
if (!drv)
return NULL;
return drv;
}
/**
* camera_driver_find_ident:
* @idx : index of driver to get handle to.
*
* Returns: Human-readable identifier of camera driver at index. Can be NULL
* if nothing found.
**/
const char *camera_driver_find_ident(int idx)
{
const camera_driver_t *drv = camera_drivers[idx];
if (!drv)
return NULL;
return drv->ident;
}
/**
* config_get_camera_driver_options:
*
* Get an enumerated list of all camera driver names,
* separated by '|'.
*
* Returns: string listing of all camera driver names,
* separated by '|'.
**/
const char* config_get_camera_driver_options(void)
{
return char_list_new_special(STRING_LIST_CAMERA_DRIVERS, NULL);
}
void driver_camera_stop(void)
{
camera_driver_ctl(RARCH_CAMERA_CTL_START, NULL);
}
bool driver_camera_start(void)
{
return camera_driver_ctl(RARCH_CAMERA_CTL_START, NULL);
}
void camera_driver_poll(void)
{
if (!camera_cb.caps)
return;
if (!camera_driver || !camera_driver->poll || !camera_data)
return;
camera_driver->poll(camera_data,
camera_cb.frame_raw_framebuffer,
camera_cb.frame_opengl_texture);
}
bool camera_driver_ctl(enum rarch_camera_ctl_state state, void *data)
{
settings_t *settings = config_get_ptr();
switch (state)
{
case RARCH_CAMERA_CTL_DESTROY:
camera_driver_active = false;
camera_driver_data_own = false;
camera_driver = NULL;
camera_data = NULL;
break;
case RARCH_CAMERA_CTL_SET_OWN_DRIVER:
camera_driver_data_own = true;
break;
case RARCH_CAMERA_CTL_UNSET_OWN_DRIVER:
camera_driver_data_own = false;
break;
case RARCH_CAMERA_CTL_OWNS_DRIVER:
return camera_driver_data_own;
case RARCH_CAMERA_CTL_SET_ACTIVE:
camera_driver_active = true;
break;
case RARCH_CAMERA_CTL_FIND_DRIVER:
{
int i;
driver_ctx_info_t drv;
drv.label = "camera_driver";
drv.s = settings->arrays.camera_driver;
driver_ctl(RARCH_DRIVER_CTL_FIND_INDEX, &drv);
i = (int)drv.len;
if (i >= 0)
camera_driver = (const camera_driver_t*)camera_driver_find_handle(i);
else
{
if (verbosity_is_enabled())
{
unsigned d;
RARCH_ERR("Couldn't find any camera driver named \"%s\"\n",
settings->arrays.camera_driver);
RARCH_LOG_OUTPUT("Available camera drivers are:\n");
for (d = 0; camera_driver_find_handle(d); d++)
RARCH_LOG_OUTPUT("\t%s\n", camera_driver_find_ident(d));
RARCH_WARN("Going to default to first camera driver...\n");
}
camera_driver = (const camera_driver_t*)camera_driver_find_handle(0);
if (!camera_driver)
retroarch_fail(1, "find_camera_driver()");
}
}
break;
case RARCH_CAMERA_CTL_UNSET_ACTIVE:
camera_driver_active = false;
break;
case RARCH_CAMERA_CTL_IS_ACTIVE:
return camera_driver_active;
case RARCH_CAMERA_CTL_DEINIT:
if (camera_data && camera_driver)
{
if (camera_cb.deinitialized)
camera_cb.deinitialized();
if (camera_driver->free)
camera_driver->free(camera_data);
}
camera_data = NULL;
break;
case RARCH_CAMERA_CTL_STOP:
if ( camera_driver
&& camera_driver->stop
&& camera_data)
camera_driver->stop(camera_data);
break;
case RARCH_CAMERA_CTL_START:
if (camera_driver && camera_data && camera_driver->start)
{
if (settings->bools.camera_allow)
return camera_driver->start(camera_data);
runloop_msg_queue_push(
"Camera is explicitly disabled.\n", 1, 180, false);
}
break;
case RARCH_CAMERA_CTL_SET_CB:
{
struct retro_camera_callback *cb =
(struct retro_camera_callback*)data;
camera_cb = *cb;
}
break;
case RARCH_CAMERA_CTL_INIT:
/* Resource leaks will follow if camera is initialized twice. */
if (camera_data)
return false;
camera_driver_ctl(RARCH_CAMERA_CTL_FIND_DRIVER, NULL);
if (!camera_driver)
return false;
camera_data = camera_driver->init(
*settings->arrays.camera_device ? settings->arrays.camera_device : NULL,
camera_cb.caps,
settings->uints.camera_width ?
settings->uints.camera_width : camera_cb.width,
settings->uints.camera_height ?
settings->uints.camera_height : camera_cb.height);
if (!camera_data)
{
RARCH_ERR("Failed to initialize camera driver. Will continue without camera.\n");
camera_driver_ctl(RARCH_CAMERA_CTL_UNSET_ACTIVE, NULL);
}
if (camera_cb.initialized)
camera_cb.initialized();
break;
default:
break;
}
return true;
}
+113
View File
@@ -0,0 +1,113 @@
/* 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 __CAMERA_DRIVER__H
#define __CAMERA_DRIVER__H
#include <stdint.h>
#include <boolean.h>
#include <retro_common_api.h>
#include <libretro.h>
RETRO_BEGIN_DECLS
enum rarch_camera_ctl_state
{
RARCH_CAMERA_CTL_NONE = 0,
RARCH_CAMERA_CTL_DESTROY,
RARCH_CAMERA_CTL_DEINIT,
RARCH_CAMERA_CTL_SET_OWN_DRIVER,
RARCH_CAMERA_CTL_UNSET_OWN_DRIVER,
RARCH_CAMERA_CTL_OWNS_DRIVER,
RARCH_CAMERA_CTL_SET_ACTIVE,
RARCH_CAMERA_CTL_UNSET_ACTIVE,
RARCH_CAMERA_CTL_IS_ACTIVE,
RARCH_CAMERA_CTL_FIND_DRIVER,
RARCH_CAMERA_CTL_SET_CB,
RARCH_CAMERA_CTL_STOP,
RARCH_CAMERA_CTL_START,
RARCH_CAMERA_CTL_INIT
};
typedef struct camera_driver
{
/* FIXME: params for initialization - queries for resolution,
* framerate, color format which might or might not be honored. */
void *(*init)(const char *device, uint64_t buffer_types,
unsigned width, unsigned height);
void (*free)(void *data);
bool (*start)(void *data);
void (*stop)(void *data);
/* Polls the camera driver.
* Will call the appropriate callback if a new frame is ready.
* Returns true if a new frame was handled. */
bool (*poll)(void *data,
retro_camera_frame_raw_framebuffer_t frame_raw_cb,
retro_camera_frame_opengl_texture_t frame_gl_cb);
const char *ident;
} camera_driver_t;
extern camera_driver_t camera_v4l2;
extern camera_driver_t camera_android;
extern camera_driver_t camera_rwebcam;
extern camera_driver_t camera_avfoundation;
extern camera_driver_t camera_null;
/**
* config_get_camera_driver_options:
*
* Get an enumerated list of all camera driver names,
* separated by '|'.
*
* Returns: string listing of all camera driver names,
* separated by '|'.
**/
const char* config_get_camera_driver_options(void);
/**
* camera_driver_find_handle:
* @index : index of driver to get handle to.
*
* Returns: handle to camera driver at index. Can be NULL
* if nothing found.
**/
const void *camera_driver_find_handle(int index);
/**
* camera_driver_find_ident:
* @index : index of driver to get handle to.
*
* Returns: Human-readable identifier of camera driver at index. Can be NULL
* if nothing found.
**/
const char *camera_driver_find_ident(int index);
void driver_camera_stop(void);
bool driver_camera_start(void);
void camera_driver_poll(void);
bool camera_driver_ctl(enum rarch_camera_ctl_state state, void *data);
RETRO_END_DECLS
#endif
+1 -1
View File
@@ -17,7 +17,7 @@
#include <glsym/glsym.h>
#include "../../retroarch.h"
#include "../camera_driver.h"
typedef struct android_camera
{
Loaded 100 of 4559 files, more files were not shown because too many files have changed in this diff. Show more