mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-09 11:41:35 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
28c7ae5007 | ||
|
|
0a613c04a6 | ||
|
|
f12092a09f | ||
|
|
21aa1cdbe6 | ||
|
|
5e18a5513c | ||
|
|
1188650a3f | ||
|
|
f64a01c5d4 | ||
|
|
42e803435f | ||
|
|
5e1486d92a | ||
|
|
f03a0cedca | ||
|
|
75a134a578 | ||
|
|
a9b9435e0b | ||
|
|
b674457671 | ||
|
|
7752c73abc |
No files matched your search
@@ -1,20 +0,0 @@
|
||||
# EditorConfig: http://EditorConfig.org
|
||||
|
||||
# Top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Unix-style newlines with a newline ending every file
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
charset = utf-8
|
||||
|
||||
# 3 space indentation
|
||||
[*.{c,h,js,css,html}]
|
||||
indent_style = space
|
||||
indent_size = 3
|
||||
|
||||
# Tab indentation
|
||||
[Makefile*]
|
||||
indent_style = tab
|
||||
File renamed without changes.
@@ -1,35 +0,0 @@
|
||||
# First and foremost consider this:
|
||||
- Only RetroArch bugs should be filed here. Not core bugs or game bugs
|
||||
- This is not a forum or a help section, this is strictly developer oriented
|
||||
|
||||
## Description
|
||||
|
||||
[Description of the bug]
|
||||
|
||||
### Expected behavior
|
||||
|
||||
[What you expected to happen]
|
||||
|
||||
### Actual behavior
|
||||
|
||||
[What is actually happening]
|
||||
|
||||
### Steps to reproduce the bug
|
||||
|
||||
1. [First step]
|
||||
2. [Second step]
|
||||
3. [and so on...]
|
||||
|
||||
### Bisect Results
|
||||
|
||||
[Try to bisect and tell us when this started happening]
|
||||
|
||||
### Version/Commit
|
||||
You can find this information under Information/System Information
|
||||
|
||||
- RetroArch: [version/commit]
|
||||
|
||||
### Environment information
|
||||
|
||||
- OS: [The operating system you're running]
|
||||
- Compiler: [In case you are running local builds]
|
||||
@@ -1,22 +0,0 @@
|
||||
## Guidelines
|
||||
|
||||
1. Rebase before opening a pull request
|
||||
2. If you are sending several unrelated fixes or features, use a branch and a separate pull request for each
|
||||
3. If possible try squashing everything in a single commit. This is particularly beneficial in the case of feature merges since it allows easy bisecting when a problem arises
|
||||
|
||||
|
||||
## Description
|
||||
|
||||
[Description of the pull request, detail any issues you are fixing or any features you are implementing]
|
||||
|
||||
## Related Issues
|
||||
|
||||
[Any issues this pull request may be addressing]
|
||||
|
||||
## Related Pull Requests
|
||||
|
||||
[Any other PRs from related repositories that might be needed for this pull request to work]
|
||||
|
||||
## Reviewers
|
||||
|
||||
[If possible @mention all the people that should review your pull request]
|
||||
-27
@@ -11,7 +11,6 @@ config.log
|
||||
/retroarch
|
||||
/retroarch.cfg
|
||||
/retroarch.exe
|
||||
/retroarch_debug.exe
|
||||
/config.h
|
||||
/config.mk
|
||||
/tools/retroarch-joyconfig
|
||||
@@ -63,17 +62,9 @@ menu/driverspzarch.c
|
||||
/media/shaders_glsl/
|
||||
/obj-w32/
|
||||
|
||||
# Wii U
|
||||
*.depend
|
||||
*.rpx
|
||||
wiiu/wut/elf2rpl/elf2rpl
|
||||
|
||||
# Ctags
|
||||
/tags
|
||||
|
||||
# CLion
|
||||
/cmake-build-debug/
|
||||
|
||||
# Android
|
||||
/pkg/android/phoenix/obj/
|
||||
/pkg/android/phoenix/assets/
|
||||
@@ -94,21 +85,3 @@ pkg/apple/iOS/modules/
|
||||
|
||||
obj-unix/
|
||||
.vagrant/
|
||||
|
||||
/pkg/msvc/Release Cg/*.exe
|
||||
/pkg/msvc/Release Cg/*.iobj
|
||||
/pkg/msvc/Release Cg/*.ipdb
|
||||
/pkg/msvc/Release Cg/*.pdb
|
||||
/pkg/msvc/Release Cg/*.lpl
|
||||
/pkg/msvc/Release Cg/*.cfg
|
||||
/pkg/msvc/*.db
|
||||
/pkg/msvc/.vs
|
||||
/pkg/msvc/*/.vs
|
||||
/pkg/msvc/msvc-2010/Release Cg/RetroArc.27FF7CE1.tlog/*.tlog
|
||||
/pkg/msvc/msvc-2010/Release Cg/RetroArc.27FF7CE1.tlog/*.lastbuildstate
|
||||
/pkg/msvc/msvc-2010/Release Cg/*.log
|
||||
/pkg/msvc/msvc-2010/Release Cg/*.obj
|
||||
/pkg/msvc/msvc-2010/Release Cg/*.res
|
||||
/pkg/msvc/msvc-2010/Release Cg/*.pdb
|
||||
|
||||
retroarch.cfg
|
||||
@@ -0,0 +1,3 @@
|
||||
[submodule "deps/glslang/glslang"]
|
||||
path = deps/glslang/glslang
|
||||
url = git://github.com/KhronosGroup/glslang.git
|
||||
-66
@@ -1,66 +0,0 @@
|
||||
# Use 'generic' to be able to override CC/CXX for clang
|
||||
language: generic
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- compiler: mingw-x86
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-mingw-w64-i686
|
||||
- mingw-w64-i686-dev
|
||||
script:
|
||||
- CROSS_COMPILE=i686-w64-mingw32- ./configure --disable-d3d9 && 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:
|
||||
- CROSS_COMPILE=x86_64-w64-mingw32- ./configure --disable-d3d9 && 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
|
||||
|
||||
script:
|
||||
- ./configure
|
||||
- make
|
||||
|
||||
env:
|
||||
global:
|
||||
- MAKEFLAGS="-j2"
|
||||
- secure: "qc91ReC3OlzSh2gFaSH6TYzC2qIQvgA2AZff6J13eaH8xijAhuMzttZ0rMQJ0DWCIhPeUb0kIzVyaGoe4MwPALzpw1C1AznIWiZJ53HN+hWCOcS/af7YVPk6HPySnwqrS+Wv3AIIvIKFV2mxv21F/JbT/N+pArlRrp904Xj+KPo="
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- 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
|
||||
coverity_scan:
|
||||
project:
|
||||
name: "RetroArch"
|
||||
description: "RetroArch is the official reference frontend for the libretro API."
|
||||
notification_email: [email protected]
|
||||
build_command_prepend: "./configure; make clean"
|
||||
build_command: "make"
|
||||
branch_pattern: coverity_scan
|
||||
Vendored
-125
@@ -1,125 +0,0 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Mac",
|
||||
"includePath": [
|
||||
"/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}"
|
||||
],
|
||||
"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}"
|
||||
],
|
||||
"defines": [
|
||||
"_DEBUG",
|
||||
"UNICODE"
|
||||
],
|
||||
"intelliSenseMode": "msvc-x64",
|
||||
"browse": {
|
||||
"path": [
|
||||
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/um",
|
||||
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/ucrt",
|
||||
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/shared",
|
||||
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/winrt",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "msys2-mingw32",
|
||||
"includePath": [
|
||||
"C:/msys64/mingw32/include",
|
||||
"C:/msys64/mingw32/i686-w64-mingw32/include",
|
||||
"${workspaceRoot}/libretro-common/include",
|
||||
"${workspaceRoot}/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"defines": [
|
||||
"_DEBUG",
|
||||
"UNICODE"
|
||||
],
|
||||
"intelliSenseMode": "msvc-x64",
|
||||
"browse": {
|
||||
"path": [
|
||||
"C:/msys64/mingw32/include",
|
||||
"C:/msys64/mingw32/i686-w64-mingw32/include",
|
||||
"${workspaceRoot}/libretro-common/include",
|
||||
"${workspaceRoot}/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "msys2-mingw64",
|
||||
"includePath": [
|
||||
"C:/msys64/mingw64/include",
|
||||
"C:/msys64/mingw64/x86_64-w64-mingw32/include",
|
||||
"${workspaceRoot}/libretro-common/include",
|
||||
"${workspaceRoot}/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"defines": [
|
||||
"_DEBUG",
|
||||
"UNICODE"
|
||||
],
|
||||
"intelliSenseMode": "msvc-x64",
|
||||
"browse": {
|
||||
"path": [
|
||||
"C:/msys64/mingw64/include",
|
||||
"C:/msys64/mingw64/x86_64-w64-mingw32/include",
|
||||
"${workspaceRoot}/libretro-common/include",
|
||||
"${workspaceRoot}/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
}
|
||||
}
|
||||
],
|
||||
"version": 3
|
||||
}
|
||||
Vendored
-48
@@ -1,48 +0,0 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "msys2-mingw64 debug",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/retroarch.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": true,
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerPath": "c:\\msys64\\mingw64\\bin\\gdb.exe",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "msys2-mingw32 debug",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/retroarch.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": true,
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerPath": "c:\\msys64\\mingw32\\bin\\gdb.exe",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Vendored
-12
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"terminal.integrated.shell.windows": "C:\\msys64\\usr\\bin\\bash.exe",
|
||||
"terminal.integrated.env.windows": {
|
||||
"PATH": "/mingw64/lib/ccache/bin:/mingw64/lib/ccache/bin:/mingw64/lib/ccache/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:$PATH",
|
||||
"MSYSTEM": "MINGW64",
|
||||
},
|
||||
"terminal.integrated.cursorBlinking": true,
|
||||
|
||||
"editor.tabSize": 3,
|
||||
"editor.renderWhitespace": "all",
|
||||
"editor.insertSpaces": true,
|
||||
}
|
||||
Vendored
-91
@@ -1,91 +0,0 @@
|
||||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"taskName": "msys2-mingw64 build",
|
||||
"type": "shell",
|
||||
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true },
|
||||
|
||||
"command": "./configure; make -j2",
|
||||
"options": {
|
||||
"shell": {
|
||||
"executable": "C:\\msys64\\usr\\bin\\bash.exe",
|
||||
"args": [
|
||||
"-c"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
"taskName": "msys2-mingw64 build with debug symbols",
|
||||
"type": "shell",
|
||||
|
||||
"group": "build",
|
||||
|
||||
"command": "./configure; DEBUG=1 make -j2",
|
||||
"options": {
|
||||
"shell": {
|
||||
"executable": "C:\\msys64\\usr\\bin\\bash.exe",
|
||||
"args": [
|
||||
"-c"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
"taskName": "msys2-mingw64 rebuild",
|
||||
"type": "shell",
|
||||
|
||||
"group": "build",
|
||||
|
||||
"command": "make -j2",
|
||||
"options": {
|
||||
"shell": {
|
||||
"executable": "C:\\msys64\\usr\\bin\\bash.exe",
|
||||
"args": [
|
||||
"-c"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
"taskName": "msys2-mingw64 clean",
|
||||
"type": "shell",
|
||||
|
||||
"group": "build",
|
||||
|
||||
"command": "make clean",
|
||||
"options": {
|
||||
"shell": {
|
||||
"executable": "C:\\msys64\\usr\\bin\\bash.exe",
|
||||
"args": [
|
||||
"-c"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
"taskName": "msys2-mingw64 run",
|
||||
"type": "shell",
|
||||
|
||||
"group": {
|
||||
"kind": "test",
|
||||
"isDefault": true },
|
||||
|
||||
"command": "./retroarch -v",
|
||||
"options": {
|
||||
"shell": {
|
||||
"executable": "C:\\msys64\\usr\\bin\\bash.exe",
|
||||
"args": [
|
||||
"-c"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
-262
@@ -1,262 +0,0 @@
|
||||
# 1.7.0 (future)
|
||||
- CHEEVOS: Add badges for achievements, shows thumbnail images of achievements.
|
||||
- CHEEVOS: Leaderboard support.
|
||||
- CHEEVOS: Only disable savestates on hardcore mode if achievements are not available.
|
||||
- COMMANDLINE: Fix fullscreen toggle switch.
|
||||
- COMMON: Add 'Automatically Load Content To Playlist' feature, enabled by default.
|
||||
- COMMON: Fix slowmotion ratio always being reset back to 1.
|
||||
- COMMON: Optimized NBIO implementations now for Apple, Windows, and Linux. Uses mmap for Linux/Windows/BSD if/when available. File I/O should now be much faster for loading images inside the menu.
|
||||
- COMMON: Native Blissbox support now for latest firmware as of writing (2.0). Implementation through libusb and/or native Windows HID.
|
||||
- COMMON: New lightgun API.
|
||||
- COMMON: New VFS (Virtual File System) API.
|
||||
- COMMON: Fixed some playlist bugs.
|
||||
- COMMON: New snow shader.
|
||||
- COMMON: Fix Quick Menu title.
|
||||
- COMMON: Fix loading cores that require no content one after another.
|
||||
- EMSCRIPTEN: Fix references to browserfs.
|
||||
- FREEBSD: Support libusb HID input driver.
|
||||
- HAIKU: Buildfix.
|
||||
- INPUT: Map clear button to DEL key.
|
||||
- LINUX/X11: Add RetroArch logo to window title bar.
|
||||
- LINUX/X11: Input driver now supports new lightgun code.
|
||||
- LINUX/X11: Support window transparency (requires a compositing window manager).
|
||||
- LOBBIES: Fix for crash on join netplay rooms via touch / glui.
|
||||
- LOCALIZATION: Update Italian translation.
|
||||
- LOCALIZATION: Update Japanese translation.
|
||||
- LOCALIZATION: Update Portuguese-Brazilian translation.
|
||||
- LOCALIZATION: Update Russian translation.
|
||||
- OSX/PPC: Fix the GL2 renderchain, had to use EXT versions of framebuffer/renderbuffer functions.
|
||||
- PS3: HTTP requests / downloads should now work.
|
||||
- PS3: Core Updater now works.
|
||||
- PS3: Improved font rendering, enable STB Unicode font renderer.
|
||||
- PSP: Make it work with Vita's Adrenaline.
|
||||
- PSP: Fix audio sync.
|
||||
- PSP: Fix content loading, port should be functional again.
|
||||
- PSP: Use 64MB when available.
|
||||
- SCANNER: Fix crash from Windows-incompatible format string.
|
||||
- VITA: Improve packaging, installation times.
|
||||
- WIIU: Disabled the controller patcher for now since it was the source of many stability issues.
|
||||
- WINDOWS: Add MSVC 2017 solution.
|
||||
- WINDOWS: Get rid of the empty console window in MSVC 2010 builds.
|
||||
- WINDOWS: Raw input driver now supports new lightgun code.
|
||||
- WINDOWS: Use configured OSD/text message color on GDI driver.
|
||||
- WINDOWS/XINPUT: Populate XInput VID/PID from DInput so autoconfig doesn't rely solely on joypad names
|
||||
- WINDOWS/XINPUT: Fix crash that occurs in some situations with Steam running and a Steam Controller plugged in.
|
||||
- WINDOWS: Improve version reporting under System Information.
|
||||
- WINDOWS: Support window transparency.
|
||||
- WINDOWS: Correct usage of GetWindowPlacement per MS docs, fixes game window position on Win95/98.
|
||||
|
||||
# 1.6.9
|
||||
- COMMON: Small memory leak.
|
||||
- NETPLAY: Fix network command only working once.
|
||||
|
||||
# 1.6.8
|
||||
- Audio: Fix the Audio DSP picker
|
||||
- CHEEVOS: Add support for Atari Lynx cheevos.
|
||||
- CHEEVOS: Add support for RetroAchievements Leaderboards.
|
||||
- GUI: (MaterialUI) Fix crash that happened on context reset with Vulkan.
|
||||
- GUI: (MaterialUI) Skip querying and drawing items that are not visible; Cache content height and bbox calculation.
|
||||
- GUI: (MaterialUI) Fix entry box highlight calculation.
|
||||
- GUI: (XMB) Skip drawing the fading list when it is already transparent. Optimization.
|
||||
- GUI: (XMB) Comment out visible item calculation in xmb_draw_items().
|
||||
- GUI: (RGUI) Prevent crashes when using a non-English language reliant on UTF8.
|
||||
- GUI: Add menu option for OSD background color.
|
||||
- GUI: Add menu option for OSD text color.
|
||||
- GUI: Add menu option to remove frame count from OSD.
|
||||
- GUI: Allow wraparound of int/float settings when pressing the left key
|
||||
- INPUT/LIBRETRO: Add support for more mouse buttons (buttons 4/5)
|
||||
- INPUT/LIBRETRO: Add support for analog buttons
|
||||
- INPUT: Always show the controls menu even if descriptors are not set
|
||||
- INPUT: Fix input descriptors not being set on cores that don't implement the controllers interface
|
||||
- INPUT: Apply descriptors only for the amount of cores the core supports
|
||||
- INPUT: Implement keyboard to gamepad input remapping (limited to one gamepad device for now)
|
||||
- INPUT: Fix absolute mouse move handling on the winraw driver
|
||||
- INPUT: Ignore keyboard input if window is not active on udev driver
|
||||
- INPUT: Sanitize the filenames of autoconfig profiles before saving
|
||||
- LOBBIES: Fix crash on navigating left / right from the lobby menu
|
||||
- LOCALIZATION: Update Dutch translation
|
||||
- LOCALIZATION: Update Italian translation.
|
||||
- LOCALIZATION: Update Japanese translation.
|
||||
- LOCALIZATION: Update Portuguese-Brazilian translation.
|
||||
- LOCALIZATION: Update Russian translation.
|
||||
- LINUX/ARMHF: Set buildbot updater URL to armhf location instead of blank string
|
||||
- LINUX/PI: Broadcom VC4: Add Videocore config option
|
||||
- LINUX/UDEV: Fix - RetroArch reads keyboard input when not focused with the udev input driver.
|
||||
- NETPLAY: Fix disconnection not fully deinitializing Netplay.
|
||||
- NETPLAY: Fix lan rooms when there is more than one room
|
||||
- NETPLAY: Fix lan rooms on systems where all addresses are treated as IPv6
|
||||
- COMMON: Fix clear/free loop conditionals in playlists.
|
||||
- WINDOWS/GDI: Fix flickering of text.
|
||||
- WINDOWS/GDI: Fix graphics corruption on Windows 98
|
||||
- WINDOWS/GDI: Allow compiling without DirectInput8 for NT support
|
||||
- WINDOWS/WGL: Try to use wglSwapLayerBuffers instead of SwapBuffers if possible (for more optimal performance).
|
||||
- WINDOWS: Fix menubar text corruption on Japanese locale systems
|
||||
- WINDOWS: Support Unicode file I/O (can now display CJK characters in file browser for example).
|
||||
- WINDOWS: Support Windows 95, NT3.51, NT4
|
||||
- WINDOWS: add Makefile.griffin targets for msvc6,2003,2005,2010,2012,2013
|
||||
- WII: Use custom, embedded libogc SDK.
|
||||
- WIIU: Initial touchscreen support for WiiU gamepad.
|
||||
- WIIU: Add Cheevos support.
|
||||
- SCANNER: Fix archive scanning.
|
||||
- SCANNER: Support CHD files.
|
||||
- SCANNER: Support Gamecube ISO scanning.
|
||||
- SCANNER: Use primary data track of disc images for CRC lookups rather than cue files. This is slower but finds matches more reliably, and is necessary for CHD files to work at all. Update your databases!
|
||||
- SCANNER: Fall back on looking inside archives when matching MAME/FBA content (most recent cores only). If you had difficulty with content being detected before, you may have better luck now. Update your databases and core info!
|
||||
|
||||
# 1.6.7
|
||||
- SCANNER: Fix directory scanning.
|
||||
- SCANNER: Fix file scanning.
|
||||
- COMMON: Fix 'Disk Image Append' option.
|
||||
- FREEBSD: Compatibility fixes for Video4Linux2 camera driver.
|
||||
- GUI: (MaterialUI) Add disk image append icons.
|
||||
- GUI: (MaterialUI) Improve word wrapping when menu icons are enabled.
|
||||
- GUI: (MaterialUI) Add User Interface -> Appearance -> Menu Icons Enable. You can turn on/off the icons on the lefthand side of the menu entries.
|
||||
- GUI: Performance optimizations for XMB menu driver - only calculates visible items.
|
||||
- LOCALIZATION: Update Italian translation.
|
||||
|
||||
# 1.6.6
|
||||
- 3DS: Fixes serious performance regression that affected every core; rewind was always implicitly enabled.
|
||||
- AUDIO: MOD/S3M/XM sound should now be properly mixed in with the core's sound.
|
||||
- GUI: Visual makeover of MaterialUI.
|
||||
- GUI: Added 'Music', 'Images' and 'Video' collection options to RGUI/MaterialUI.
|
||||
- GUI: Allow the user to add 'Favorites'.
|
||||
- GUI: Allow the user to rename entries.
|
||||
- GUI: Performance optimizations for XMB menu driver.
|
||||
- LOCALIZATION: Update Italian translation
|
||||
- INPUT: Overlay controller response - when we press buttons on the gamepad or keyboard, the corresponding buttons on the overlay will be highlighted as well.
|
||||
- NETBSD: Silence some compilation warnings.
|
||||
- COMMON: Fixed bug 'Deleting an entry from a playlist would not update the list view inside XMB'.
|
||||
- COMMON: Fix inet_ntop_compat on Unix
|
||||
- LOBBY: Add skeleton to add help descriptions to lobbies
|
||||
|
||||
# 1.6.5
|
||||
Skipped this one.
|
||||
|
||||
# 1.6.4
|
||||
|
||||
- ANDROID: Fire Stick & Fire TV remote overrides gamepad port 0 on button press and viceversa like SHIELD devices
|
||||
- ANDROID: Provide default save / system / state / screenshot locations
|
||||
- AUDIO: Audio mixer supports MOD/S3M/XM file types now!
|
||||
- INPUT: input swap override flag (for remotes) is cleared correctly
|
||||
- INPUT: allow specifying libretro device in remap files
|
||||
- INPUT: allow specifying analog dpad mode in remap files
|
||||
- INPUT: allow saving libretro device to remap files
|
||||
- INPUT: allow saving analog dpad mode to remap files
|
||||
- INPUT: allow removing core and game remap files from the menu
|
||||
- COMMON: Cores can now request to set a 'shared context'. You no longer need to explicitly enable 'Shared Hardware Context' for Citra/OpenLara/Dolphin.
|
||||
- COMMON: Add 'Delete Core' option to Core Information menu.
|
||||
- COMMON: Allow Max Timing Skew to be set to 0.
|
||||
- COMMON: Change the "content dir" behavior so it works on either a flag or an empty directory setting, now platform drivers can provide defaults for save / system / state / screenshot dirs and still allow the content dir functionality, these settings are under settings / saving and flagged as advanced
|
||||
- GUI: You can turn on/off 'Horizontal Animation' now for the XMB menu. Turning animations off can result in a performance boost.
|
||||
- GUI: Fix sublabel word-wrapping in XMB where multi-byte languages were cut off too soon
|
||||
- LOCALIZATION: Update Dutch translation
|
||||
- LOCALIZATION: Update Traditional Chinese translation
|
||||
- LOCALIZATION: Update Italian translation
|
||||
- LOCALIZATION: Update Russian translation
|
||||
- WINDOWS: Provide default save / system / state / screenshot locations
|
||||
- LOBBIES: Show what country the host is in
|
||||
- MENU: Enable OSD text rendering for gdi and libcaca drivers
|
||||
- WINDOWS 98/ME/2K: Set default directory for MSVC 2005 RetroArch version.
|
||||
- WII: Better V-Sync handling, backported from SuperrSonic.
|
||||
- WIIU: Exception handler rewritten.
|
||||
|
||||
# 1.6.3
|
||||
- IOS: Fix GL regression - 32bit color format cores were no longer rendering
|
||||
- CHEEVOS: Add support for N64 cheevos and other small fixes.
|
||||
- CHEEVOS: Add 'Achievements -> Achievements Verbose Mode'. Ability to display cheevos related messages in OSD, useful for RetroAchievements users.
|
||||
- AUDIO: Audio mixer's volume can now be independently increased/decreased, and muted.
|
||||
- AUDIO: Mute now no longer disables/enables audio but instead properly mutes the audio volume. Mute is also independent from the audio mixer volume.
|
||||
- INPUT: Add mouse index selection; ability now to select between different mice
|
||||
- INPUT: Fix 'All Users Control Menu' setting
|
||||
- LINUX: Add a tinyalsa audio driver. Doesn't require asoundlib, should be self-contained and lower-level.
|
||||
- LOBBIES: Announce the RetroArch version too
|
||||
- LOCALIZATION: Add Traditional Chinese translation
|
||||
- LOCALIZATION: Update French translation
|
||||
- LOCALIZATION: Update Italian translation
|
||||
- LOCALIZATION: Update Japanese translation
|
||||
- LOCALIZATION: Update Russian translation
|
||||
- MENU: Add 'User Interface -> Views'. Ability to display/hide online updater and core updater options.
|
||||
- NETPLAY: Disconnecting one client shouldn't cause everyone to disconnect anymore
|
||||
- NETWORK: SSL/TLS support, disabled by default
|
||||
- SCANNER: Fix PS1 game scanning
|
||||
- SCANNER: Move content list builder into scanner task with progress, fixes menu freeze with large playlists
|
||||
- SDL2: Fix 'SDL2 driver does not see the hat on wired Xbox 360 controller"
|
||||
- SETTINGS: Fix regression 'Custom Viewport is no longer overridable per-core or per-game'
|
||||
- VITA: Add cheevos support
|
||||
- VITA: Add support for external USB if mounted
|
||||
- WAYLAND: Fix menu mouse input
|
||||
- WII: Add support for single-port 'PS1/PS2 to USB controller adapter
|
||||
|
||||
# 1.6.0
|
||||
- ANDROID: Allow remotes to retain OK/Cancel position when menu_swap_ok_cancel is enabled
|
||||
- ANDROID: Improve autoconf fallback
|
||||
- ANDROID: Improve shield portable/gamepad device grouping workaround
|
||||
- ANDROID: Runtime permission checking
|
||||
- AUDIO: Audio mixer support. Mix up to 8 streams with the game's audio.
|
||||
- AUTOSAVE/SRAM - Fix bug #3829 / #4820 (https://github.com/libretro/RetroArch/issues/3829)
|
||||
- ENDIANNESS: Fixed database scanning. Should fix scanning on PS3/WiiU/Wii, etc.
|
||||
- LOBBIES: Fallback to filename based matching if no CRC matches are found (for people making playlists by hand)
|
||||
- LOBBIES: GUI refinement, show stop hosting when a host has been started, show disconnect when playing as client
|
||||
- LOBBIES: if the game is already loaded it will try to connect directly instead of re-loading content (non-fullpath cores only)
|
||||
- LOBBIES: unify both netplay menus
|
||||
- LOCALIZATION/GUI: Korean font should display properly now with XMB/MaterialUI's default font
|
||||
- LOCALIZATION: Update German translation
|
||||
- LOCALIZATION: Update Japanese translation
|
||||
- LOCALIZATION: Update Russian translation
|
||||
- LOCALIZATION: Update/finish French translation
|
||||
- MENU: Improved rendering for XMB ribbon; using additive blending (Vulkan/GL)
|
||||
- MISC: Various frontend optimizations.
|
||||
- NET: Fix bug #4703 (https://github.com/libretro/RetroArch/issues/4703)
|
||||
- OSX/MACOS: Fixes serious memory leak
|
||||
- THUMBNAILS: Thumbnails show up now in Load Content -> Collection, Information -> Database
|
||||
- VIDEO: Fix threaded video regression; tickering of menu entries would no longer work.
|
||||
- VITA: Fix 30fps menu (poke into input now instead of reading the entire input buffer which apparently is slow)
|
||||
- VITA: Fix frame throttle
|
||||
- VITA: Fix slow I/O
|
||||
- VULKAN: Fix some crashes on loading some thumbnails
|
||||
- VULKAN: Unicode font rendering support. Should fix bad character encoding for French characters, etc.
|
||||
- WII: Fix crashing issues which could occur with the dummy core
|
||||
- WIIU: HID Controller support
|
||||
- WIIU: Initial network/netplay support
|
||||
- WIIU: XMB/MaterialUI menu driver support
|
||||
- WINDOWS: Added RawInput input driver for low-latency, low-level input.
|
||||
- WINDOWS: Added WASAPI audio driver for low-latency audio. Both shared and exclusive mode.
|
||||
- WINDOWS: Core mouse input should be relative again in cores
|
||||
|
||||
# 1.5.0
|
||||
- ANDROID: Autoconf fallback
|
||||
- ANDROID: Mouse support / Emulated mouse support
|
||||
- AUTOCONF: Fix partial matches for pad name
|
||||
- CHEEVOS: Fix crashes in the cheevos description menu
|
||||
- CHEEVOS: WIP leaderboards support
|
||||
- COMMON: 9-slice texture drawing support
|
||||
- COMMON: Threading fixes
|
||||
- CORETEXT/APPLE: Ability to load menu display font drivers and loading of custom font.
|
||||
- DOS: Add keyboard driver
|
||||
- DOS: Improve color accuracy and scaling
|
||||
- GUI: Add a symbol page in the OSK
|
||||
- GUI: Allow changing icon theme on the fly
|
||||
- GUI: Better dialogs for XMB
|
||||
- GUI: Various settings are now only visible when advanced settings is enabled
|
||||
- LOCALIZATION: Add/update Korean translation
|
||||
- LOCALIZATION: Rewrite German translation
|
||||
- LOCALIZATION: Update several English sublabels
|
||||
- LOCALIZATION: Update several Japanese labels
|
||||
- MOBILE: Long-tap a setting to reset to default
|
||||
- MOBILE: Single-tap for menu entry selection
|
||||
- NET: Allow manual netplay content loading
|
||||
- NET: Announcing network games to the public lobby is optional now
|
||||
- NET: Bake in miniupnpc
|
||||
- NET: Fix netplay join for contentless cores
|
||||
- NET: Fix netplay rooms being pushed on the wrong tab
|
||||
- NET: Lan games show next to lobbies with (lan) and connect via the private IP address
|
||||
- NET: Use new lobby system with MITM support
|
||||
- NUKLEAR: Update to current version
|
||||
- SCANNER: Always add 7z & zip to supported extensions
|
||||
- VULKAN: Add snow/bokeh shader pipeline effects - at parity with GL now
|
||||
- VULKAN: Find supported composite alpha in swapchain
|
||||
- WIIU: Keyboard support
|
||||
- WINDOWS: Fix loading of core/content via file menu
|
||||
- WINDOWS: Logging to file no longer spawns an empty window
|
||||
|
||||
# 1.4.1
|
||||
@@ -1,6 +1,4 @@
|
||||
HAVE_FILE_LOGGER=1
|
||||
HAVE_CC_RESAMPLER=1
|
||||
NEED_CXX_LINKER=0
|
||||
MISSING_DECLS =0
|
||||
|
||||
ifneq ($(C90_BUILD),)
|
||||
@@ -13,23 +11,17 @@ TARGET = retroarch
|
||||
|
||||
OBJDIR := obj-unix
|
||||
|
||||
OBJ :=
|
||||
ifeq ($(GLOBAL_CONFIG_DIR),)
|
||||
GLOBAL_CONFIG_DIR = /etc
|
||||
endif
|
||||
|
||||
OBJ :=
|
||||
LIBS :=
|
||||
DEFINES := -DHAVE_CONFIG_H -DRARCH_INTERNAL -DHAVE_OVERLAY
|
||||
DEFINES += -DGLOBAL_CONFIG_DIR='"$(GLOBAL_CONFIG_DIR)"'
|
||||
|
||||
ifneq ($(findstring BSD,$(OS)),)
|
||||
CFLAGS += -DBSD
|
||||
LDFLAGS += -L/usr/local/lib
|
||||
endif
|
||||
|
||||
ifneq ($(findstring DOS,$(OS)),)
|
||||
CFLAGS += -march=i386
|
||||
LDFLAGS += -lemu
|
||||
endif
|
||||
|
||||
ifneq ($(findstring Win32,$(OS)),)
|
||||
LDFLAGS += -static-libgcc -lwinmm
|
||||
LDFLAGS += -static-libgcc
|
||||
endif
|
||||
|
||||
include Makefile.common
|
||||
@@ -38,16 +30,10 @@ ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang"),1)
|
||||
DEFINES += -Wno-invalid-source-encoding
|
||||
endif
|
||||
|
||||
ifeq ($(shell $(CC) -v 2>&1 | grep -c "tcc"),1)
|
||||
MD = -MD
|
||||
else
|
||||
MD = -MMD
|
||||
endif
|
||||
|
||||
HEADERS = $(wildcard */*/*.h) $(wildcard */*.h) $(wildcard *.h)
|
||||
|
||||
ifeq ($(MISSING_DECLS), 1)
|
||||
DEFINES += -Werror=missing-declarations
|
||||
DEFINES += -Werror=missing-declarations
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_DYLIB), 1)
|
||||
@@ -68,13 +54,12 @@ ifeq ($(DEBUG), 1)
|
||||
OPTIMIZE_FLAG = -O0 -g
|
||||
else
|
||||
OPTIMIZE_FLAG = -O3 -ffast-math
|
||||
endif
|
||||
|
||||
ifneq ($(findstring Win32,$(OS)),)
|
||||
LDFLAGS += -mwindows
|
||||
endif
|
||||
endif
|
||||
|
||||
CFLAGS += -Wall $(OPTIMIZE_FLAG) $(INCLUDE_DIRS) $(DEBUG_FLAG) -I. -Ideps -Ideps/stb
|
||||
CFLAGS += -Wall $(OPTIMIZE_FLAG) $(INCLUDE_DIRS) $(DEBUG_FLAG) -I.
|
||||
|
||||
APPEND_CFLAGS := $(CFLAGS)
|
||||
CXXFLAGS += $(APPEND_CFLAGS) -std=c++11 -D__STDC_CONSTANT_MACROS
|
||||
@@ -82,13 +67,9 @@ OBJCFLAGS := $(CFLAGS) -D__STDC_CONSTANT_MACROS
|
||||
|
||||
ifeq ($(CXX_BUILD), 1)
|
||||
LINK = $(CXX)
|
||||
CFLAGS := $(CXXFLAGS) -xc++
|
||||
CFLAGS += -DCXX_BUILD
|
||||
CXXFLAGS += -DCXX_BUILD
|
||||
CFLAGS := $(CXXFLAGS) -xc++
|
||||
else
|
||||
ifeq ($(NEED_CXX_LINKER),1)
|
||||
LINK = $(CXX)
|
||||
else ifeq ($(findstring Win32,$(OS)),)
|
||||
ifeq ($(findstring Win32,$(OS)),)
|
||||
LINK = $(CC)
|
||||
else
|
||||
# directx-related code is c++
|
||||
@@ -119,16 +100,10 @@ endif
|
||||
|
||||
RARCH_OBJ := $(addprefix $(OBJDIR)/,$(OBJ))
|
||||
|
||||
ifneq ($(X86),)
|
||||
CFLAGS += -m32
|
||||
CXXLAGS += -m32
|
||||
LDFLAGS += -m32
|
||||
endif
|
||||
|
||||
ifneq ($(SANITIZER),)
|
||||
CFLAGS := -fsanitize=$(SANITIZER) $(CFLAGS)
|
||||
CXXFLAGS := -fsanitize=$(SANITIZER) $(CXXFLAGS)
|
||||
LDFLAGS := -fsanitize=$(SANITIZER) $(LDFLAGS)
|
||||
CFLAGS := -fsanitize=$(SANITIZER) $(CFLAGS)
|
||||
CXXFLAGS := -fsanitize=$(SANITIZER) $(CXXFLAGS)
|
||||
LDFLAGS := -fsanitize=$(SANITIZER) $(LDLAGS)
|
||||
endif
|
||||
|
||||
ifneq ($(findstring $(GPERFTOOLS),profiler),)
|
||||
@@ -140,14 +115,10 @@ endif
|
||||
|
||||
all: $(TARGET) config.mk
|
||||
|
||||
ifeq ($(MAKECMDGOALS),clean)
|
||||
config.mk:
|
||||
else
|
||||
-include $(RARCH_OBJ:.o=.d)
|
||||
config.mk: configure qb/*
|
||||
@echo "config.mk is outdated or non-existing. Run ./configure again."
|
||||
@exit 1
|
||||
endif
|
||||
|
||||
retroarch: $(RARCH_OBJ)
|
||||
@$(if $(Q), $(shell echo echo LD $@),)
|
||||
@@ -156,12 +127,12 @@ retroarch: $(RARCH_OBJ)
|
||||
$(OBJDIR)/%.o: %.c config.h config.mk
|
||||
@mkdir -p $(dir $@)
|
||||
@$(if $(Q), $(shell echo echo CC $<),)
|
||||
$(Q)$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) $(MD) -c -o $@ $<
|
||||
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -c -o $@ $<
|
||||
|
||||
$(OBJDIR)/%.o: %.cpp config.h config.mk
|
||||
@mkdir -p $(dir $@)
|
||||
@$(if $(Q), $(shell echo echo CXX $<),)
|
||||
$(Q)$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(DEFINES) -MMD -c -o $@ $<
|
||||
$(Q)$(CXX) $(CXXFLAGS) $(DEFINES) -MMD -c -o $@ $<
|
||||
|
||||
$(OBJDIR)/%.o: %.m
|
||||
@mkdir -p $(dir $@)
|
||||
@@ -187,36 +158,27 @@ $(OBJDIR)/%.o: %.rc $(HEADERS)
|
||||
|
||||
install: $(TARGET)
|
||||
rm -f $(OBJDIR)/git_version.o
|
||||
mkdir -p $(DESTDIR)$(BIN_DIR) 2>/dev/null || /bin/true
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/bin 2>/dev/null || /bin/true
|
||||
mkdir -p $(DESTDIR)$(GLOBAL_CONFIG_DIR) 2>/dev/null || /bin/true
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/share/applications 2>/dev/null || /bin/true
|
||||
mkdir -p $(DESTDIR)$(MAN_DIR)/man6 2>/dev/null || /bin/true
|
||||
mkdir -p $(DESTDIR)$(MAN_DIR) 2>/dev/null || /bin/true
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/share/pixmaps 2>/dev/null || /bin/true
|
||||
install -m755 $(TARGET) $(DESTDIR)$(BIN_DIR)
|
||||
install -m755 tools/cg2glsl.py $(DESTDIR)$(BIN_DIR)/retroarch-cg2glsl
|
||||
install -m755 $(TARGET) $(DESTDIR)$(PREFIX)/bin
|
||||
install -m755 tools/cg2glsl.py $(DESTDIR)$(PREFIX)/bin/retroarch-cg2glsl
|
||||
install -m644 retroarch.cfg $(DESTDIR)$(GLOBAL_CONFIG_DIR)/retroarch.cfg
|
||||
install -m644 retroarch.desktop $(DESTDIR)$(PREFIX)/share/applications
|
||||
install -m644 docs/retroarch.6 $(DESTDIR)$(MAN_DIR)/man6
|
||||
install -m644 docs/retroarch-cg2glsl.6 $(DESTDIR)$(MAN_DIR)/man6
|
||||
install -m644 docs/retroarch.1 $(DESTDIR)$(MAN_DIR)
|
||||
install -m644 docs/retroarch-cg2glsl.1 $(DESTDIR)$(MAN_DIR)
|
||||
install -m644 media/retroarch.svg $(DESTDIR)$(PREFIX)/share/pixmaps
|
||||
@if test -d media/assets; then \
|
||||
echo "Installing media assets..."; \
|
||||
mkdir -p $(DESTDIR)$(ASSETS_DIR)/retroarch/assets/xmb; \
|
||||
mkdir -p $(DESTDIR)$(ASSETS_DIR)/retroarch/assets/glui; \
|
||||
cp -r media/assets/xmb/ $(DESTDIR)$(ASSETS_DIR)/retroarch/assets; \
|
||||
cp -r media/assets/glui/ $(DESTDIR)$(ASSETS_DIR)/retroarch/assets; \
|
||||
echo "Asset copying done."; \
|
||||
fi
|
||||
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)$(BIN_DIR)/retroarch
|
||||
rm -f $(DESTDIR)$(BIN_DIR)/retroarch-cg2glsl
|
||||
rm -f $(DESTDIR)$(PREFIX)/bin/retroarch
|
||||
rm -f $(DESTDIR)$(PREFIX)/bin/retroarch-cg2glsl
|
||||
rm -f $(DESTDIR)$(GLOBAL_CONFIG_DIR)/retroarch.cfg
|
||||
rm -f $(DESTDIR)$(PREFIX)/share/applications/retroarch.desktop
|
||||
rm -f $(DESTDIR)$(MAN_DIR)/man6/retroarch.6
|
||||
rm -f $(DESTDIR)$(MAN_DIR)/man6/retroarch-cg2glsl.6
|
||||
rm -f $(DESTDIR)$(MAN_DIR)/retroarch.1
|
||||
rm -f $(DESTDIR)$(MAN_DIR)/retroarch-cg2glsl.1
|
||||
rm -f $(DESTDIR)$(PREFIX)/share/pixmaps/retroarch.svg
|
||||
rm -rf $(DESTDIR)$(ASSETS_DIR)/retroarch
|
||||
|
||||
clean:
|
||||
rm -rf $(OBJDIR)
|
||||
|
||||
+334
-970
File diff suppressed because it is too large.
Load diff
+243
-82
@@ -9,76 +9,236 @@ BUILD_3DS = 1
|
||||
BUILD_CIA = 1
|
||||
LIBCTRU_NO_DEPRECATION = 1
|
||||
|
||||
APP_TITLE = RetroArch 3DS
|
||||
APP_DESCRIPTION = RetroArch 3DS
|
||||
APP_TITLE = Retroarch 3DS
|
||||
APP_DESCRIPTION = Retroarch 3DS
|
||||
APP_AUTHOR = Team Libretro
|
||||
APP_PRODUCT_CODE = RETROARCH-3DS
|
||||
APP_UNIQUE_ID = 0xBAC00
|
||||
APP_ICON = pkg/ctr/assets/default.png
|
||||
APP_BANNER = pkg/ctr/assets/libretro_banner.png
|
||||
APP_AUDIO = pkg/ctr/assets/silent.wav
|
||||
APP_RSF = pkg/ctr/tools/template.rsf
|
||||
APP_ICON = ctr/assets/default.png
|
||||
APP_BANNER = ctr/assets/libretro_banner.png
|
||||
APP_AUDIO = ctr/assets/silent.wav
|
||||
APP_RSF = ctr/tools/template.rsf
|
||||
APP_SYSTEM_MODE = 64MB
|
||||
APP_SYSTEM_MODE_EXT = 124MB
|
||||
APP_BIG_TEXT_SECTION = 0
|
||||
APP_USE_SVCHAX = 0
|
||||
|
||||
include pkg/ctr/Makefile.cores
|
||||
include ctr/Makefile.cores
|
||||
|
||||
OBJ :=
|
||||
OBJ += gfx/drivers/ctr_shaders/ctr_sprite.o
|
||||
OBJ += ctr/ctr_system.o
|
||||
OBJ += ctr/ctr_memory.o
|
||||
OBJ += ctr/ctr_linear.o
|
||||
OBJ += ctr/gpu_old.o
|
||||
OBJS :=
|
||||
OBJS += gfx/drivers/ctr_sprite.o
|
||||
OBJS += ctr/ctr_system.o
|
||||
OBJS += ctr/ctr_memory.o
|
||||
OBJS += ctr/ctr_linear.o
|
||||
OBJS += ctr/ctr_svchax.o
|
||||
|
||||
ifeq ($(APP_BIG_TEXT_SECTION), 1)
|
||||
APP_USE_SVCHAX = 1
|
||||
LDFLAGS += -Wl,--defsym,__ctr_patch_services=__service_ptr
|
||||
endif
|
||||
|
||||
ifeq ($(APP_USE_SVCHAX), 1)
|
||||
OBJ += ctr/ctr_svchax.o
|
||||
endif
|
||||
|
||||
DEFINES :=
|
||||
ifeq ($(GRIFFIN_BUILD), 1)
|
||||
OBJ += griffin/griffin.o
|
||||
DEFINES += -DHAVE_GRIFFIN=1 -DHAVE_MENU -DHAVE_RGUI -DHAVE_XMB -DHAVE_MATERIALUI -DHAVE_LIBRETRODB -DHAVE_CC_RESAMPLER
|
||||
DEFINES += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DWANT_ZLIB
|
||||
OBJS += griffin/griffin.o
|
||||
else
|
||||
HAVE_CC_RESAMPLER = 1
|
||||
HAVE_MENU_COMMON = 1
|
||||
HAVE_RTGA = 1
|
||||
HAVE_RPNG = 1
|
||||
HAVE_RJPEG = 1
|
||||
HAVE_RBMP = 1
|
||||
HAVE_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
|
||||
|
||||
include Makefile.common
|
||||
BLACKLIST :=
|
||||
BLACKLIST += input/input_overlay.o
|
||||
BLACKLIST += tasks/task_overlay.o
|
||||
OBJ := $(filter-out $(BLACKLIST),$(OBJ))
|
||||
OBJS += libretro-common/file/file_extract.o
|
||||
OBJS += verbosity.o
|
||||
OBJS += performance.o
|
||||
OBJS += libretro-common/compat/compat_getopt.o
|
||||
OBJS += libretro-common/compat/compat_strcasestr.o
|
||||
OBJS += libretro-common/compat/compat_strl.o
|
||||
OBJS += libretro-common/compat/compat_fnmatch.o
|
||||
OBJS += libretro-common/memmap/memalign.o
|
||||
OBJS += libretro-common/file/config_file.o
|
||||
OBJS += libretro-common/file/config_file_userdata.o
|
||||
OBJS += core_options.o
|
||||
OBJS += cheats.o
|
||||
OBJS += libretro-common/hash/rhash.o
|
||||
OBJS += gfx/video_context_driver.o
|
||||
OBJS += gfx/drivers_context/gfx_null_ctx.o
|
||||
OBJS += gfx/image/image.o
|
||||
OBJS += libretro-common/formats/tga/rtga.o
|
||||
OBJS += libretro-common/formats/png/rpng.o
|
||||
OBJS += libretro-common/formats/png/rpng_encode.o
|
||||
OBJS += libretro-common/formats/bmp/rbmp_encode.o
|
||||
OBJS += libretro-common/gfx/math/matrix_4x4.o
|
||||
OBJS += libretro-common/gfx/math/matrix_3x3.o
|
||||
OBJS += gfx/drivers/ctr_gfx.o
|
||||
OBJS += gfx/drivers/nullgfx.o
|
||||
OBJS += gfx/font_driver.o
|
||||
OBJS += gfx/drivers_font_renderer/bitmapfont.o
|
||||
OBJS += input/input_autodetect.o
|
||||
OBJS += input/input_joypad_driver.o
|
||||
OBJS += input/input_hid_driver.o
|
||||
OBJS += input/input_config.o
|
||||
OBJS += input/input_keymaps.o
|
||||
OBJS += input/input_remapping.o
|
||||
OBJS += input/input_keyboard.o
|
||||
OBJS += input/drivers/ctr_input.o
|
||||
OBJS += input/drivers_joypad/ctr_joypad.o
|
||||
OBJS += input/autoconf/builtin_ctr.o
|
||||
OBJS += input/drivers/nullinput.o
|
||||
OBJS += input/drivers_joypad/null_joypad.o
|
||||
OBJS += input/drivers_joypad/hid_joypad.o
|
||||
OBJS += input/drivers_hid/null_hid.o
|
||||
OBJS += gfx/video_state_tracker.o
|
||||
OBJS += libretro-common/queues/fifo_buffer.o
|
||||
OBJS += audio/audio_resampler_driver.o
|
||||
OBJS += audio/drivers_resampler/sinc.o
|
||||
OBJS += audio/drivers_resampler/nearest.o
|
||||
OBJS += audio/drivers_resampler/cc_resampler.o
|
||||
OBJS += camera/drivers/nullcamera.o
|
||||
OBJS += location/drivers/nulllocation.o
|
||||
OBJS += audio/drivers/ctr_csnd_audio.o
|
||||
OBJS += audio/drivers/ctr_dsp_audio.o
|
||||
OBJS += audio/drivers/nullaudio.o
|
||||
OBJS += gfx/video_driver.o
|
||||
OBJS += gfx/video_common.o
|
||||
OBJS += input/input_driver.o
|
||||
OBJS += audio/audio_driver.o
|
||||
OBJS += camera/camera_driver.o
|
||||
OBJS += location/location_driver.o
|
||||
OBJS += driver.o
|
||||
OBJS += libretro-common/gfx/scaler/scaler_filter.o
|
||||
OBJS += libretro-common/gfx/scaler/pixconv.o
|
||||
OBJS += libretro-common/gfx/scaler/scaler.o
|
||||
OBJS += libretro-common/gfx/scaler/scaler_int.o
|
||||
OBJS += gfx/video_filters/2xsai.o
|
||||
OBJS += gfx/video_filters/super2xsai.o
|
||||
OBJS += gfx/video_filters/supereagle.o
|
||||
OBJS += gfx/video_filters/2xbr.o
|
||||
OBJS += gfx/video_filters/darken.o
|
||||
OBJS += gfx/video_filters/epx.o
|
||||
OBJS += gfx/video_filters/scale2x.o
|
||||
OBJS += gfx/video_filters/blargg_ntsc_snes.o
|
||||
OBJS += gfx/video_filters/lq2x.o
|
||||
OBJS += gfx/video_filters/phosphor2x.o
|
||||
OBJS += audio/audio_filters/echo.o
|
||||
OBJS += audio/audio_filters/eq.o
|
||||
OBJS += audio/audio_filters/chorus.o
|
||||
OBJS += audio/audio_filters/iir.o
|
||||
OBJS += audio/audio_filters/panning.o
|
||||
OBJS += audio/audio_filters/phaser.o
|
||||
OBJS += audio/audio_filters/reverb.o
|
||||
OBJS += audio/audio_filters/wahwah.o
|
||||
OBJS += libretro-common/dynamic/dylib.o
|
||||
OBJS += dynamic.o
|
||||
OBJS += gfx/video_filter.o
|
||||
OBJS += audio/audio_dsp_filter.o
|
||||
OBJS += cores/dynamic_dummy.o
|
||||
OBJS += content.o
|
||||
OBJS += libretro-common/file/file_path.o
|
||||
OBJS += file_path_special.o
|
||||
OBJS += libretro-common/file/dir_list.o
|
||||
OBJS += libretro-common/file/retro_dirent.o
|
||||
OBJS += libretro-common/file/retro_file.o
|
||||
OBJS += libretro-common/file/retro_stat.o
|
||||
OBJS += dir_list_special.o
|
||||
OBJS += string_list_special.o
|
||||
OBJS += libretro-common/string/string_list.o
|
||||
OBJS += libretro-common/string/stdstring.o
|
||||
OBJS += file_ops.o
|
||||
OBJS += libretro-common/file/nbio/nbio_stdio.o
|
||||
OBJS += libretro-common/file/file_list.o
|
||||
OBJS += libretro-common/queues/message_queue.o
|
||||
OBJS += patch.o
|
||||
OBJS += configuration.o
|
||||
OBJS += rewind.o
|
||||
OBJS += frontend/frontend_driver.o
|
||||
OBJS += frontend/drivers/platform_ctr.o
|
||||
OBJS += frontend/drivers/platform_null.o
|
||||
OBJS += core_info.o
|
||||
OBJS += ui/ui_companion_driver.o
|
||||
OBJS += ui/drivers/ui_null.o
|
||||
OBJS += frontend/frontend.o
|
||||
OBJS += libretro_version_1.o
|
||||
OBJS += retroarch.o
|
||||
OBJS += runloop.o
|
||||
OBJS += tasks/tasks.o
|
||||
OBJS += msg_hash.o
|
||||
OBJS += intl/msg_hash_de.o
|
||||
OBJS += intl/msg_hash_es.o
|
||||
OBJS += intl/msg_hash_eo.o
|
||||
OBJS += intl/msg_hash_fr.o
|
||||
OBJS += intl/msg_hash_it.o
|
||||
OBJS += intl/msg_hash_nl.o
|
||||
OBJS += intl/msg_hash_pt.o
|
||||
OBJS += intl/msg_hash_pl.o
|
||||
OBJS += intl/msg_hash_us.o
|
||||
OBJS += movie.o
|
||||
OBJS += record/record_driver.o
|
||||
OBJS += record/drivers/record_null.o
|
||||
OBJS += tasks/task_decompress.o
|
||||
OBJS += tasks/task_file_transfer.o
|
||||
OBJS += screenshot.o
|
||||
OBJS += playlist.o
|
||||
OBJS += menu/menu_driver.o
|
||||
OBJS += menu/menu_hash.o
|
||||
OBJS += menu/menu_input.o
|
||||
OBJS += menu/menu_entry.o
|
||||
OBJS += menu/menu_entries.o
|
||||
OBJS += menu/menu_setting.o
|
||||
OBJS += menu/menu_cbs.o
|
||||
OBJS += menu/cbs/menu_cbs_ok.o
|
||||
OBJS += menu/cbs/menu_cbs_cancel.o
|
||||
OBJS += menu/cbs/menu_cbs_select.o
|
||||
OBJS += menu/cbs/menu_cbs_start.o
|
||||
OBJS += menu/cbs/menu_cbs_info.o
|
||||
OBJS += menu/cbs/menu_cbs_refresh.o
|
||||
OBJS += menu/cbs/menu_cbs_left.o
|
||||
OBJS += menu/cbs/menu_cbs_right.o
|
||||
OBJS += menu/cbs/menu_cbs_title.o
|
||||
OBJS += menu/cbs/menu_cbs_deferred_push.o
|
||||
OBJS += menu/cbs/menu_cbs_scan.o
|
||||
OBJS += menu/cbs/menu_cbs_get_value.o
|
||||
OBJS += menu/cbs/menu_cbs_up.o
|
||||
OBJS += menu/cbs/menu_cbs_down.o
|
||||
OBJS += menu/cbs/menu_cbs_contentlist_switch.o
|
||||
OBJS += menu/menu_shader.o
|
||||
OBJS += menu/menu_navigation.o
|
||||
OBJS += menu/menu_display.o
|
||||
OBJS += menu/menu_displaylist.o
|
||||
OBJS += menu/menu_animation.o
|
||||
OBJS += menu/intl/menu_hash_de.o
|
||||
OBJS += menu/intl/menu_hash_es.o
|
||||
OBJS += menu/intl/menu_hash_eo.o
|
||||
OBJS += menu/intl/menu_hash_fr.o
|
||||
OBJS += menu/intl/menu_hash_it.o
|
||||
OBJS += menu/intl/menu_hash_nl.o
|
||||
OBJS += menu/intl/menu_hash_pl.o
|
||||
OBJS += menu/intl/menu_hash_pt.o
|
||||
OBJS += menu/intl/menu_hash_us.o
|
||||
OBJS += menu/drivers/null.o
|
||||
OBJS += menu/drivers/menu_generic.o
|
||||
OBJS += menu/drivers_display/menu_display_null.o
|
||||
OBJS += menu/drivers/rgui.o
|
||||
OBJS += command_event.o
|
||||
OBJS += deps/zlib/adler32.o
|
||||
OBJS += deps/zlib/compress.o
|
||||
OBJS += deps/zlib/crc32.o
|
||||
OBJS += deps/zlib/deflate.o
|
||||
OBJS += deps/zlib/gzclose.o
|
||||
OBJS += deps/zlib/gzlib.o
|
||||
OBJS += deps/zlib/gzread.o
|
||||
OBJS += deps/zlib/gzwrite.o
|
||||
OBJS += deps/zlib/inffast.o
|
||||
OBJS += deps/zlib/inflate.o
|
||||
OBJS += deps/zlib/inftrees.o
|
||||
OBJS += deps/zlib/trees.o
|
||||
OBJS += deps/zlib/uncompr.o
|
||||
OBJS += deps/zlib/zutil.o
|
||||
OBJS += deps/zlib/ioapi.o
|
||||
OBJS += deps/zlib/unzip.o
|
||||
OBJS += audio/audio_utils.o
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(DEVKITPRO)),)
|
||||
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitpro")
|
||||
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(CTRULIB)),)
|
||||
CTRULIB = $(DEVKITPRO)/libctru
|
||||
$(error "Please set CTRULIB in your environment. export CTRULIB=<path to>ctrulib")
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(AEMSTRO)),)
|
||||
$(error "Please set AEMSTRO in your environment. export AEMSTRO=<path to>aemstro")
|
||||
endif
|
||||
|
||||
|
||||
APP_TITLE := $(shell echo "$(APP_TITLE)" | cut -c1-128)
|
||||
APP_DESCRIPTION := $(shell echo "$(APP_DESCRIPTION)" | cut -c1-256)
|
||||
APP_AUTHOR := $(shell echo "$(APP_AUTHOR)" | cut -c1-128)
|
||||
@@ -116,15 +276,16 @@ ifeq ($(WHOLE_ARCHIVE_LINK), 1)
|
||||
WHOLE_END := -Wl,--no-whole-archive
|
||||
endif
|
||||
|
||||
CFLAGS += -I. -Ideps -Ideps/libz -Ideps/7zip -Ideps/stb -Ilibretro-common/include
|
||||
CFLAGS += -I. -Ideps/zlib -Ideps/7zip -Ilibretro-common/include
|
||||
|
||||
CFLAGS += -DRARCH_INTERNAL -DRARCH_CONSOLE -DSINC_LOWEST_QUALITY
|
||||
CFLAGS += -DHAVE_FILTERS_BUILTIN $(DEFINES)
|
||||
CFLAGS += -DHAVE_GRIFFIN=1 -DHAVE_FILTERS_BUILTIN -DHAVE_MENU -DHAVE_RGUI
|
||||
CFLAGS += -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -DHAVE_BUILTIN_AUTOCONFIG
|
||||
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
|
||||
|
||||
ASFLAGS := -g $(ARCH) -O3
|
||||
LDFLAGS += -specs=ctr/3dsx_custom.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
LDFLAGS = -specs=ctr/3dsx_custom.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
CFLAGS += -std=gnu99 -ffast-math
|
||||
|
||||
@@ -148,11 +309,16 @@ endif
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(TARGET_3DSX) $(TARGET_3DS) $(TARGET_CIA) $(TARGET).core
|
||||
$(TARGET): $(TARGET_3DSX) $(TARGET_3DS) $(TARGET_CIA)
|
||||
$(TARGET).3dsx: $(TARGET).elf
|
||||
$(TARGET).elf: $(OBJ) libretro_ctr.a
|
||||
$(TARGET).elf: $(OBJS) libretro_ctr.a
|
||||
|
||||
PREFIX := $(DEVKITPRO)/devkitARM/bin/arm-none-eabi-
|
||||
ctr_sprite_shader_shbin.h: gfx/drivers/ctr_sprite.o
|
||||
gfx/drivers/ctr_gfx.c: ctr_sprite_shader_shbin.h
|
||||
griffin/griffin.o: gfx/drivers/ctr_gfx.c
|
||||
|
||||
|
||||
PREFIX := $(DEVKITARM)/bin/arm-none-eabi-
|
||||
|
||||
CC := $(PREFIX)gcc
|
||||
CXX := $(PREFIX)g++
|
||||
@@ -164,25 +330,24 @@ NM := $(PREFIX)nm
|
||||
LD := $(CXX)
|
||||
|
||||
ifneq ($(findstring Linux,$(shell uname -a)),)
|
||||
MAKEROM = pkg/ctr/tools/makerom-linux
|
||||
BANNERTOOL = pkg/ctr/tools/bannertool-linux
|
||||
MAKEROM = ctr/tools/makerom-linux
|
||||
BANNERTOOL = ctr/tools/bannertool-linux
|
||||
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
||||
MAKEROM = pkg/ctr/tools/makerom-mac
|
||||
BANNERTOOL = pkg/ctr/tools/bannertool-mac
|
||||
MAKEROM = ctr/tools/makerom-mac
|
||||
BANNERTOOL = ctr/tools/bannertool-mac
|
||||
else
|
||||
MAKEROM = pkg/ctr/tools/makerom.exe
|
||||
BANNERTOOL = pkg/ctr/tools/bannertool.exe
|
||||
MAKEROM = ctr/tools/makerom.exe
|
||||
BANNERTOOL = ctr/tools/bannertool.exe
|
||||
endif
|
||||
|
||||
%.o: %.vsh %.gsh
|
||||
$(DEVKITPRO)/devkitARM/bin/picasso $^ -o $*.shbin
|
||||
$(DEVKITPRO)/devkitARM/bin/bin2s $*.shbin | $(PREFIX)as -o $@
|
||||
rm $*.shbin
|
||||
%.o: %.shader
|
||||
python $(AEMSTRO)/aemstro_as.py $< $(notdir $<).shbin
|
||||
$(DEVKITARM)/bin/bin2s $(notdir $<).shbin | $(PREFIX)as -o $@
|
||||
echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(notdir $<).shbin | tr . _)`.h
|
||||
echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(notdir $<).shbin | tr . _)`.h
|
||||
echo "extern const u32" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(notdir $<).shbin | tr . _)`.h
|
||||
rm $(notdir $<).shbin
|
||||
|
||||
%.o: %.vsh
|
||||
$(DEVKITPRO)/devkitARM/bin/picasso $^ -o $*.shbin
|
||||
$(DEVKITPRO)/devkitARM/bin/bin2s $*.shbin | $(PREFIX)as -o $@
|
||||
rm $*.shbin
|
||||
|
||||
%.o: %.cpp
|
||||
$(CXX) -c -o $@ $< $(CXXFLAGS) $(INCDIRS)
|
||||
@@ -202,18 +367,18 @@ endif
|
||||
%.vsh:
|
||||
|
||||
$(TARGET).smdh: $(APP_ICON)
|
||||
$(DEVKITPRO)/devkitARM/bin/smdhtool --create "$(APP_TITLE)" "$(APP_DESCRIPTION)" "$(APP_AUTHOR)" $(APP_ICON) $@
|
||||
smdhtool --create "$(APP_TITLE)" "$(APP_DESCRIPTION)" "$(APP_AUTHOR)" $(APP_ICON) $@
|
||||
|
||||
$(TARGET).3dsx: $(TARGET).elf
|
||||
ifeq ($(APP_BIG_TEXT_SECTION), 1)
|
||||
cp pkg/ctr/big_text_section.xml $(TARGET).xml
|
||||
cp ctr/big_text_section.xml $(TARGET).xml
|
||||
else
|
||||
rm -f $(TARGET).xml
|
||||
endif
|
||||
$(DEVKITPRO)/devkitARM/bin/3dsxtool $< $@ $(_3DSXFLAGS)
|
||||
-3dsxtool $< $@ $(_3DSXFLAGS)
|
||||
|
||||
$(TARGET).elf: ctr/3dsx_custom_crt0.o
|
||||
$(LD) $(LDFLAGS) $(OBJ) $(LIBDIRS) $(LIBS) -o $@
|
||||
$(LD) $(LDFLAGS) $(OBJS) $(LIBDIRS) $(LIBS) -o $@
|
||||
$(NM) -CSn $@ > $(notdir $*.lst)
|
||||
|
||||
$(TARGET).bnr: $(APP_BANNER) $(APP_AUDIO)
|
||||
@@ -228,23 +393,19 @@ $(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
|
||||
|
||||
$(TARGET).core: $(TARGET).elf
|
||||
echo $(APP_UNIQUE_ID) > $(TARGET).core
|
||||
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ)
|
||||
rm -f $(OBJS)
|
||||
rm -f $(TARGET).3dsx
|
||||
rm -f $(TARGET).elf
|
||||
rm -f $(TARGET).3ds
|
||||
rm -f $(TARGET).cia
|
||||
rm -f $(TARGET).core
|
||||
rm -f $(TARGET).smdh
|
||||
rm -f $(TARGET).bnr
|
||||
rm -f $(TARGET).icn
|
||||
rm -f *_shader_shbin.h
|
||||
rm -f ctr/ctr_config_*.o
|
||||
rm -f ctr/3dsx_custom_crt0.o
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
|
||||
@@ -1,204 +0,0 @@
|
||||
TARGET := retroarch_3ds_salamander
|
||||
LIBRETRO =
|
||||
|
||||
DEBUG = 0
|
||||
BUILD_3DSX = 0
|
||||
BUILD_3DS = 0
|
||||
BUILD_CIA = 1
|
||||
|
||||
APP_TITLE = Retroarch 3DS
|
||||
APP_DESCRIPTION = Retroarch 3DS
|
||||
APP_AUTHOR = Team Libretro
|
||||
APP_PRODUCT_CODE = RETROARCH-3DS
|
||||
APP_UNIQUE_ID = 0xBAC00
|
||||
APP_ICON = pkg/ctr/assets/default.png
|
||||
APP_BANNER = pkg/ctr/assets/libretro_banner.png
|
||||
APP_AUDIO = pkg/ctr/assets/silent.wav
|
||||
APP_RSF = pkg/ctr/tools/template.rsf
|
||||
APP_SYSTEM_MODE = 64MB
|
||||
APP_SYSTEM_MODE_EXT = 124MB
|
||||
|
||||
OBJ := ctr/ctr_system.o \
|
||||
ctr/ctr_memory.o \
|
||||
ctr/ctr_linear.o \
|
||||
frontend/frontend_salamander.o \
|
||||
frontend/frontend_driver.o \
|
||||
frontend/drivers/platform_ctr.o \
|
||||
frontend/drivers/platform_null.o \
|
||||
libretro-common/encodings/encoding_utf.o \
|
||||
libretro-common/compat/compat_strcasestr.o \
|
||||
libretro-common/file/file_path.o \
|
||||
libretro-common/string/stdstring.o \
|
||||
libretro-common/lists/string_list.o \
|
||||
libretro-common/lists/dir_list.o \
|
||||
libretro-common/file/retro_dirent.o \
|
||||
libretro-common/compat/compat_strl.o \
|
||||
libretro-common/file/config_file.o \
|
||||
libretro-common/streams/file_stream.o \
|
||||
libretro-common/vfs/vfs_implementation.o \
|
||||
libretro-common/hash/rhash.o \
|
||||
file_path_str.o \
|
||||
verbosity.o
|
||||
|
||||
ifeq ($(strip $(DEVKITPRO)),)
|
||||
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitpro")
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(CTRULIB)),)
|
||||
CTRULIB = $(DEVKITPRO)/libctru
|
||||
endif
|
||||
|
||||
APP_TITLE := $(shell echo "$(APP_TITLE)" | cut -c1-128)
|
||||
APP_DESCRIPTION := $(shell echo "$(APP_DESCRIPTION)" | cut -c1-256)
|
||||
APP_AUTHOR := $(shell echo "$(APP_AUTHOR)" | cut -c1-128)
|
||||
APP_PRODUCT_CODE := $(shell echo $(APP_PRODUCT_CODE) | cut -c1-16)
|
||||
APP_UNIQUE_ID := $(shell echo $(APP_UNIQUE_ID) | cut -c1-7)
|
||||
|
||||
MAKEROM_ARGS_COMMON = -rsf $(APP_RSF) -exefslogo -elf $(TARGET).elf -icon $(TARGET).icn -banner $(TARGET).bnr -DAPP_TITLE="$(APP_TITLE)" -DAPP_PRODUCT_CODE="$(APP_PRODUCT_CODE)" -DAPP_UNIQUE_ID=$(APP_UNIQUE_ID) -DAPP_SYSTEM_MODE=$(APP_SYSTEM_MODE) -DAPP_SYSTEM_MODE_EXT=$(APP_SYSTEM_MODE_EXT)
|
||||
|
||||
INCDIRS := -I$(CTRULIB)/include
|
||||
LIBDIRS := -L. -L$(CTRULIB)/lib
|
||||
|
||||
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -marm -mfpu=vfp -mtp=soft
|
||||
|
||||
CFLAGS += -mword-relocations \
|
||||
-fomit-frame-pointer -ffast-math \
|
||||
-Werror=implicit-function-declaration \
|
||||
$(ARCH)
|
||||
|
||||
#CFLAGS += -Wall
|
||||
CFLAGS += -DARM11 -D_3DS
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -O0 -g
|
||||
else
|
||||
CFLAGS += -O3
|
||||
endif
|
||||
|
||||
CFLAGS += -I. -Ideps/libz -Ideps/7zip -Ideps/stb -Ilibretro-common/include
|
||||
|
||||
#CFLAGS += -DRARCH_INTERNAL
|
||||
CFLAGS += -DRARCH_CONSOLE -DIS_SALAMANDER
|
||||
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
|
||||
|
||||
ASFLAGS := -g $(ARCH) -O3
|
||||
LDFLAGS += -specs=ctr/3dsx_custom.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
CFLAGS += -std=gnu99 -ffast-math
|
||||
|
||||
|
||||
LIBS := -lctru -lm
|
||||
|
||||
|
||||
ifeq ($(BUILD_3DSX), 1)
|
||||
TARGET_3DSX := $(TARGET).3dsx $(TARGET).smdh
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_3DS), 1)
|
||||
TARGET_3DS := $(TARGET).3ds
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_CIA), 1)
|
||||
TARGET_CIA := $(TARGET).cia
|
||||
endif
|
||||
|
||||
.PHONY: $(BUILD) clean all
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(TARGET_3DSX) $(TARGET_3DS) $(TARGET_CIA)
|
||||
$(TARGET).3dsx: $(TARGET).elf
|
||||
$(TARGET).elf: $(OBJ)
|
||||
|
||||
PREFIX := $(DEVKITPRO)/devkitARM/bin/arm-none-eabi-
|
||||
|
||||
CC := $(PREFIX)gcc
|
||||
CXX := $(PREFIX)g++
|
||||
AS := $(PREFIX)as
|
||||
AR := $(PREFIX)ar
|
||||
OBJCOPY := $(PREFIX)objcopy
|
||||
STRIP := $(PREFIX)strip
|
||||
NM := $(PREFIX)nm
|
||||
LD := $(CXX)
|
||||
|
||||
ifneq ($(findstring Linux,$(shell uname -a)),)
|
||||
MAKEROM = pkg/ctr/tools/makerom-linux
|
||||
BANNERTOOL = pkg/ctr/tools/bannertool-linux
|
||||
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
||||
MAKEROM = pkg/ctr/tools/makerom-mac
|
||||
BANNERTOOL = pkg/ctr/tools/bannertool-mac
|
||||
else
|
||||
MAKEROM = pkg/ctr/tools/makerom.exe
|
||||
BANNERTOOL = pkg/ctr/tools/bannertool.exe
|
||||
endif
|
||||
|
||||
%.o: %.vsh %.gsh
|
||||
$(DEVKITPRO)/devkitARM/bin/picasso $^ -o $*.shbin
|
||||
$(DEVKITPRO)/devkitARM/bin/bin2s $*.shbin | $(PREFIX)as -o $@
|
||||
rm $*.shbin
|
||||
|
||||
%.o: %.vsh
|
||||
$(DEVKITPRO)/devkitARM/bin/picasso $^ -o $*.shbin
|
||||
$(DEVKITPRO)/devkitARM/bin/bin2s $*.shbin | $(PREFIX)as -o $@
|
||||
rm $*.shbin
|
||||
|
||||
%.o: %.cpp
|
||||
$(CXX) -c -o $@ $< $(CXXFLAGS) $(INCDIRS)
|
||||
|
||||
%.o: %.c
|
||||
$(CC) -c -o $@ $< $(CFLAGS) $(INCDIRS)
|
||||
|
||||
%.o: %.s
|
||||
$(CC) -c -o $@ $< $(ASFLAGS)
|
||||
|
||||
%.o: %.S
|
||||
$(CC) -c -o $@ $< $(ASFLAGS)
|
||||
|
||||
%.a:
|
||||
$(AR) -rc $@ $^
|
||||
|
||||
%.vsh:
|
||||
|
||||
$(TARGET).smdh: $(APP_ICON)
|
||||
$(DEVKITPRO)/devkitARM/bin/smdhtool --create "$(APP_TITLE)" "$(APP_DESCRIPTION)" "$(APP_AUTHOR)" $(APP_ICON) $@
|
||||
|
||||
$(TARGET).3dsx: $(TARGET).elf
|
||||
ifeq ($(APP_BIG_TEXT_SECTION), 1)
|
||||
cp pkg/ctr/big_text_section.xml $(TARGET).xml
|
||||
else
|
||||
rm -f $(TARGET).xml
|
||||
endif
|
||||
-3dsxtool $< $@ $(_3DSXFLAGS)
|
||||
|
||||
$(TARGET).elf: ctr/3dsx_custom_crt0.o
|
||||
$(LD) $(LDFLAGS) $(OBJ) $(LIBDIRS) $(LIBS) -o $@
|
||||
$(NM) -CSn $@ > $(notdir $*.lst)
|
||||
|
||||
$(TARGET).bnr: $(APP_BANNER) $(APP_AUDIO)
|
||||
$(BANNERTOOL) makebanner -i "$(APP_BANNER)" -a "$(APP_AUDIO)" -o $@
|
||||
|
||||
$(TARGET).icn: $(APP_ICON)
|
||||
$(BANNERTOOL) makesmdh -s "$(APP_TITLE)" -l "$(APP_TITLE)" -p "$(APP_AUTHOR)" -i $(APP_ICON) -o $@
|
||||
|
||||
$(TARGET).3ds: $(TARGET).elf $(TARGET).bnr $(TARGET).icn $(APP_RSF)
|
||||
$(MAKEROM) -f cci -o $@ $(MAKEROM_ARGS_COMMON) -DAPP_ENCRYPTED=true
|
||||
|
||||
$(TARGET).cia: $(TARGET).elf $(TARGET).bnr $(TARGET).icn $(APP_RSF)
|
||||
$(MAKEROM) -f cia -o $@ $(MAKEROM_ARGS_COMMON) -DAPP_ENCRYPTED=false
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ)
|
||||
rm -f $(TARGET).3dsx
|
||||
rm -f $(TARGET).elf
|
||||
rm -f $(TARGET).3ds
|
||||
rm -f $(TARGET).cia
|
||||
rm -f $(TARGET).smdh
|
||||
rm -f $(TARGET).bnr
|
||||
rm -f $(TARGET).icn
|
||||
rm -f ctr/ctr_config_*.o
|
||||
rm -f ctr/3dsx_custom_crt0.o
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
|
||||
+34
-35
@@ -1,29 +1,21 @@
|
||||
TARGET := retroarch.js
|
||||
TARGET = retroarch.js
|
||||
|
||||
EOPT = USE_ZLIB=1 USE_SDL=2 # Emscripten specific options
|
||||
EOPTS = $(addprefix -s $(EMPTY), $(EOPT)) # Add '-s ' to each option
|
||||
|
||||
PTHREAD = 0
|
||||
OS = Emscripten
|
||||
OBJ :=
|
||||
DEFINES := -DRARCH_INTERNAL -DHAVE_OVERLAY -DHAVE_MAIN -s USE_PTHREADS=$(PTHREAD)
|
||||
DEFINES := -DRARCH_INTERNAL -DHAVE_OVERLAY -DHAVE_MAIN
|
||||
DEFINES += -DHAVE_OPENGL -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DHAVE_EGL -DHAVE_OVERLAY -DHAVE_GLSL -DHAVE_FILTERS_BUILTIN
|
||||
|
||||
HAVE_CC_RESAMPLER = 1
|
||||
HAVE_EGL = 1
|
||||
HAVE_OPENGLES = 1
|
||||
HAVE_RJPEG = 0
|
||||
HAVE_RPNG = 1
|
||||
HAVE_OPENGL = 1
|
||||
HAVE_GLES = 1
|
||||
HAVE_EMSCRIPTEN = 1
|
||||
HAVE_RGUI = 1
|
||||
HAVE_SDL = 0
|
||||
HAVE_SDL2 = 1
|
||||
HAVE_ZLIB = 1
|
||||
HAVE_FBO = 1
|
||||
WANT_ZLIB = 1
|
||||
HAVE_STATIC_VIDEO_FILTERS = 1
|
||||
HAVE_STATIC_AUDIO_FILTERS = 1
|
||||
MEMORY = 536870912
|
||||
|
||||
MEMORY = 268435456
|
||||
LTO = 0
|
||||
# XXX: setting this to 1/2 currently crashes Firefox nightly
|
||||
PRECISE_F32 = 2
|
||||
|
||||
@@ -31,29 +23,36 @@ ifneq ($(NATIVE_ZLIB),)
|
||||
WANT_ZLIB = 0
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_SDL2), 1)
|
||||
DEFINES += -DHAVE_SDL2
|
||||
endif
|
||||
|
||||
#if you compile with SDL2 flag add this Emscripten flag "-s USE_SDL=2" to LDFLAGS:
|
||||
|
||||
LIBS := -s USE_SDL=2 -s USE_ZLIB=1
|
||||
LDFLAGS := -L. --no-heap-copy -s USE_ZLIB=1 -s TOTAL_MEMORY=$(MEMORY) \
|
||||
LIBS :=
|
||||
LDFLAGS := -L. --no-heap-copy -s USE_ZLIB=1 -s TOTAL_MEMORY=$(MEMORY) -s OUTLINING_LIMIT=50000 \
|
||||
-s EXPORTED_FUNCTIONS="['_main', '_malloc', '_cmd_savefiles', '_cmd_save_state', '_cmd_load_state', '_cmd_take_screenshot']" \
|
||||
--js-library emscripten/library_rwebaudio.js \
|
||||
--js-library emscripten/library_rwebinput.js \
|
||||
--js-library emscripten/library_rwebcam.js
|
||||
ifneq ($(PTHREAD), 0)
|
||||
LDFLAGS += -s USE_PTHREADS=$(PTHREAD) -s PTHREAD_POOL_SIZE=2
|
||||
endif
|
||||
|
||||
ifeq ($(ASYNC), 1)
|
||||
LDFLAGS += -s ASYNCIFY=$(ASYNC)
|
||||
endif
|
||||
|
||||
include Makefile.common
|
||||
|
||||
CFLAGS += -Ideps/libz -Ideps -Ideps/stb
|
||||
OBJ += gfx/video_filters/2xsai.o
|
||||
OBJ += gfx/video_filters/super2xsai.o
|
||||
OBJ += gfx/video_filters/supereagle.o
|
||||
OBJ += gfx/video_filters/2xbr.o
|
||||
OBJ += gfx/video_filters/darken.o
|
||||
OBJ += gfx/video_filters/epx.o
|
||||
OBJ += gfx/video_filters/scale2x.o
|
||||
OBJ += gfx/video_filters/blargg_ntsc_snes.o
|
||||
OBJ += gfx/video_filters/lq2x.o
|
||||
OBJ += gfx/video_filters/phosphor2x.o
|
||||
|
||||
OBJ += audio/audio_filters/echo.o
|
||||
OBJ += audio/audio_filters/eq.o
|
||||
OBJ += audio/audio_filters/chorus.o
|
||||
OBJ += audio/audio_filters/iir.o
|
||||
OBJ += audio/audio_filters/panning.o
|
||||
OBJ += audio/audio_filters/phaser.o
|
||||
OBJ += audio/audio_filters/reverb.o
|
||||
OBJ += audio/audio_filters/wahwah.o
|
||||
|
||||
CFLAGS += -Ideps/zlib/
|
||||
libretro = libretro_emscripten.bc
|
||||
|
||||
ifneq ($(V), 1)
|
||||
@@ -73,7 +72,7 @@ else
|
||||
CFLAGS += -O2
|
||||
endif
|
||||
|
||||
CFLAGS += -DHAVE_RPNG -Wall -Wno-unused-result -Wno-unused-variable -I. -Ilibretro-common/include -std=gnu99 -s USE_ZLIB=1 \
|
||||
CFLAGS += -DWANT_RPNG -Wall -Wno-unused-result -Wno-unused-variable -I. -Ilibretro-common/include -std=gnu99 -s USE_ZLIB=1 \
|
||||
-s EXPORTED_FUNCTIONS="['_main', '_malloc', '_cmd_savefiles', '_cmd_save_state', '_cmd_take_screenshot']"
|
||||
|
||||
all: $(TARGET)
|
||||
@@ -84,15 +83,15 @@ $(TARGET): $(OBJ)
|
||||
|
||||
%.o: %.c
|
||||
@$(if $(Q), $(shell echo echo CC $<),)
|
||||
$(Q)$(CC) $(CFLAGS) $(DEFINES) $(EOPTS) -c -o $@ $<
|
||||
$(Q)$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
|
||||
|
||||
%.o: %.cpp
|
||||
@$(if $(Q), $(shell echo echo CXX $<),)
|
||||
$(Q)$(CXX) $(CXXFLAGS) $(DEFINES) $(EOPTS) -c -o $@ $<
|
||||
$(Q)$(CXX) $(CXXFLAGS) $(DEFINES) -c -o $@ $<
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
rm -f deps/libz/*.o
|
||||
rm -f deps/zlib/*.o
|
||||
rm -f frontend/*.o
|
||||
rm -f menu/*.o
|
||||
rm -f menu/disp/*.o
|
||||
|
||||
+225
-753
File diff suppressed because it is too large.
Load diff
-358
@@ -1,358 +0,0 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
ifeq ($(strip $(DEVKITPRO)),)
|
||||
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro")
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
|
||||
endif
|
||||
|
||||
export PATH := $(DEVKITPPC)/bin:$(PATH)
|
||||
|
||||
ifeq ($(PLATFORM),)
|
||||
PLATFORM=wii
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# change shell on Snow Leopard
|
||||
#---------------------------------------------------------------------------------
|
||||
UNAME_S := $(shell uname -s)
|
||||
UNAME_R := $(shell uname -r)
|
||||
|
||||
ifneq (,$(findstring Darwin,$(UNAME_S)))
|
||||
ifneq (,$(findstring 10.8.0,$(UNAME_R)))
|
||||
export SHELL=/bin/bash
|
||||
endif
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# path to tools
|
||||
#---------------------------------------------------------------------------------
|
||||
export PORTLIBS := $(DEVKITPRO)/portlibs/ppc
|
||||
export PATH := $(DEVKITPPC)/bin:$(PORTLIBS)/bin:$(PATH)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# the prefix on the compiler executables
|
||||
#---------------------------------------------------------------------------------
|
||||
PREFIX := powerpc-eabi-
|
||||
|
||||
export AS := $(PREFIX)as
|
||||
export CC := $(PREFIX)gcc
|
||||
export CXX := $(PREFIX)g++
|
||||
export AR := $(PREFIX)ar
|
||||
export OBJCOPY := $(PREFIX)objcopy
|
||||
|
||||
|
||||
ISVC=$(or $(VCBUILDHELPER_COMMAND),$(MSBUILDEXTENSIONSPATH32),$(MSBUILDEXTENSIONSPATH))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.a:
|
||||
#---------------------------------------------------------------------------------
|
||||
@rm -f $@
|
||||
$(AR) -rc $@ $^
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o: %.cpp
|
||||
$(CXX) $(CXXFLAGS) -c $< -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o: %.m
|
||||
$(CC) $(OBJCFLAGS) -c $< -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o: %.s
|
||||
$(CC) -x assembler-with-cpp $(ASFLAGS) -c $< -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o: %.S
|
||||
$(CC) -x assembler-with-cpp $(ASFLAGS) -c $< -o $@
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# canned command sequence for binary data
|
||||
#---------------------------------------------------------------------------------
|
||||
define bin2o
|
||||
bin2s -a 32 $< | $(AS) -o $(@)
|
||||
echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(<F) | tr . _)`.h
|
||||
echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(<F) | tr . _)`.h
|
||||
echo "extern const u32" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(<F) | tr . _)`.h
|
||||
endef
|
||||
|
||||
BUILD := build
|
||||
|
||||
BUILD_LITE = 1
|
||||
CURDIR = .
|
||||
|
||||
export BASEDIR := $(CURDIR)
|
||||
export DEPSDIR := $(BASEDIR)/wii/libogc/deps
|
||||
export LWIPDIR := $(BASEDIR)/wii/libogc/lwip
|
||||
export OGCDIR := $(BASEDIR)/wii/libogc/libogc
|
||||
export DBDIR := $(BASEDIR)/wii/libogc/libdb
|
||||
export BTEDIR := $(BASEDIR)/wii/libogc/lwbt
|
||||
export WIIUSEDIR := $(BASEDIR)/wii/libogc/wiiuse
|
||||
export LIBWIIKEYB := $(BASEDIR)/wii/libogc/libwiikeyboard
|
||||
export STUBSDIR := $(BASEDIR)/wii/libogc/lockstubs
|
||||
export LIBS := $(BASEDIR)/wii/libogc/libs
|
||||
|
||||
export INCDIR := $(BASEDIR)/wii/libogc/include
|
||||
|
||||
export LIBDIR := $(LIBS)/$(PLATFORM)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
BBALIB := $(LIBDIR)/libbba
|
||||
OGCLIB := $(LIBDIR)/libogc
|
||||
DBLIB := $(LIBDIR)/libdb
|
||||
BTELIB := $(LIBDIR)/libbte
|
||||
WIIUSELIB := $(LIBDIR)/libwiiuse
|
||||
WIIKEYBLIB := $(LIBDIR)/libwiikeyboard
|
||||
STUBSLIB := $(LIBDIR)/libgclibstubs
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
DEFAULTINCDIR := $(BASEDIR)/wii/libogc/include
|
||||
DEFINCS := -I$(DEFAULTINCDIR)
|
||||
INCLUDES := $(DEFINCS) \
|
||||
-I$(BASEDIR)/wii/libogc \
|
||||
-I$(DEFAULTINCDIR)/netif \
|
||||
-I$(DEFAULTINCDIR)/ipv4 \
|
||||
-I$(DEFAULTINCDIR)/sdcard \
|
||||
-I$(DEFAULTINCDIR)/ogc \
|
||||
-I$(DEFAULTINCDIR)/ogc/machine \
|
||||
-I$(DEFAULTINCDIR)/bte \
|
||||
-I$(DEFAULTINCDIR)/sdcard \
|
||||
-I$(DEFAULTINCDIR)/wiikeyboard \
|
||||
-I$(DEFAULTINCDIR)/wiiuse \
|
||||
-I$(DEFAULTINCDIR)/di
|
||||
|
||||
MACHDEP := -DBIGENDIAN -DGEKKO -mcpu=750 -meabi -msdata=eabi -mhard-float -ffunction-sections -fdata-sections
|
||||
|
||||
|
||||
ifeq ($(PLATFORM),wii)
|
||||
MACHDEP += -DHW_RVL
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),cube)
|
||||
MACHDEP += -DHW_DOL
|
||||
endif
|
||||
|
||||
CFLAGS := -DLIBOGC_INTERNAL -DNDEBUG -O2 -fno-strict-aliasing -mregnames -Wall $(MACHDEP) $(INCLUDES)
|
||||
ASFLAGS := $(MACHDEP) -mregnames -D_LANGUAGE_ASSEMBLY $(INCLUDES)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
VPATH := $(LWIPDIR) \
|
||||
$(LWIPDIR)/arch/gc \
|
||||
$(LWIPDIR)/arch/gc/netif \
|
||||
$(LWIPDIR)/core \
|
||||
$(LWIPDIR)/core/ipv4 \
|
||||
$(LWIPDIR)/netif \
|
||||
$(OGCDIR) \
|
||||
$(DBDIR) \
|
||||
$(DBDIR)/uIP \
|
||||
$(BTEDIR) \
|
||||
$(WIIUSEDIR) \
|
||||
$(SDCARDDIR) \
|
||||
$(LIBWIIKEYB) \
|
||||
$(STUBSDIR)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
SOURCES_LWIP := $(LWIPDIR)/network.c \
|
||||
$(LWIPDIR)/netio.c \
|
||||
$(LWIPDIR)/arch/gc/netif/gcif.c \
|
||||
$(LWIPDIR)/core/inet.c \
|
||||
$(LWIPDIR)/core/mem.c \
|
||||
$(LWIPDIR)/core/dhcp.c \
|
||||
$(LWIPDIR)/core/raw.c \
|
||||
$(LWIPDIR)/core/memp.c \
|
||||
$(LWIPDIR)/core/netif.c \
|
||||
$(LWIPDIR)/core/pbuf.c \
|
||||
$(LWIPDIR)/core/stats.c \
|
||||
$(LWIPDIR)/core/sys.c \
|
||||
$(LWIPDIR)/core/tcp.c \
|
||||
$(LWIPDIR)/core/tcp_in.c \
|
||||
$(LWIPDIR)/core/tcp_out.c \
|
||||
$(LWIPDIR)/core/udp.c \
|
||||
$(LWIPDIR)/core/ipv4/icmp.c \
|
||||
$(LWIPDIR)/core/ipv4/ip.c \
|
||||
$(LWIPDIR)/core/ipv4/ip_frag.c \
|
||||
$(LWIPDIR)/core/ipv4/ip_addr.c \
|
||||
$(LWIPDIR)/netif/etharp.c \
|
||||
$(LWIPDIR)/netif/loopif.c
|
||||
|
||||
LWIPOBJ := $(SOURCES_LWIP:.c=.o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
SOURCES_OGC := \
|
||||
$(OGCDIR)/console.c \
|
||||
$(OGCDIR)/lwp_priority.c \
|
||||
$(OGCDIR)/lwp_queue.c \
|
||||
$(OGCDIR)/lwp_threadq.c \
|
||||
$(OGCDIR)/lwp_threads.c \
|
||||
$(OGCDIR)/lwp_sema.c \
|
||||
$(OGCDIR)/lwp_messages.c \
|
||||
$(OGCDIR)/lwp.c \
|
||||
$(OGCDIR)/lwp_stack.c \
|
||||
$(OGCDIR)/lwp_mutex.c \
|
||||
$(OGCDIR)/lwp_watchdog.c \
|
||||
$(OGCDIR)/lwp_wkspace.c \
|
||||
$(OGCDIR)/lwp_objmgr.c \
|
||||
$(OGCDIR)/lwp_heap.c \
|
||||
$(OGCDIR)/sys_state.c \
|
||||
$(OGCDIR)/exception.c \
|
||||
$(OGCDIR)/irq.c \
|
||||
$(OGCDIR)/semaphore.c \
|
||||
$(OGCDIR)/video.c \
|
||||
$(OGCDIR)/pad.c \
|
||||
$(OGCDIR)/exi.c \
|
||||
$(OGCDIR)/mutex.c \
|
||||
$(OGCDIR)/arqueue.c \
|
||||
$(OGCDIR)/arqmgr.c \
|
||||
$(OGCDIR)/system.c \
|
||||
$(OGCDIR)/cond.c \
|
||||
$(OGCDIR)/gx.c \
|
||||
$(OGCDIR)/gu.c \
|
||||
$(OGCDIR)/audio.c \
|
||||
$(OGCDIR)/cache.c \
|
||||
$(OGCDIR)/decrementer.c \
|
||||
$(OGCDIR)/message.c \
|
||||
$(OGCDIR)/card.c \
|
||||
$(OGCDIR)/aram.c \
|
||||
$(OGCDIR)/depackrnc1.c \
|
||||
$(OGCDIR)/dsp.c \
|
||||
$(OGCDIR)/si.c \
|
||||
$(OGCDIR)/tpl.c \
|
||||
$(OGCDIR)/ipc.c \
|
||||
$(OGCDIR)/console_font_8x16.c \
|
||||
$(OGCDIR)/timesupp.c \
|
||||
$(OGCDIR)/lock_supp.c \
|
||||
$(OGCDIR)/newlibc.c \
|
||||
$(OGCDIR)/usbgecko.c \
|
||||
$(OGCDIR)/usbmouse.c \
|
||||
$(OGCDIR)/sbrk.c \
|
||||
$(OGCDIR)/malloc_lock.c \
|
||||
$(OGCDIR)/kprintf.c \
|
||||
$(OGCDIR)/stm.c \
|
||||
$(OGCDIR)/ios.c \
|
||||
$(OGCDIR)/es.c \
|
||||
$(OGCDIR)/isfs.c \
|
||||
$(OGCDIR)/usb.c \
|
||||
$(OGCDIR)/network_common.c \
|
||||
$(OGCDIR)/sdgecko_io.c \
|
||||
$(OGCDIR)/sdgecko_buf.c \
|
||||
$(OGCDIR)/gcsd.c \
|
||||
$(OGCDIR)/argv.c \
|
||||
$(OGCDIR)/network_wii.c \
|
||||
$(OGCDIR)/wiisd.c \
|
||||
$(OGCDIR)/conf.c \
|
||||
$(OGCDIR)/usbstorage.c \
|
||||
$(OGCDIR)/texconv.c \
|
||||
$(OGCDIR)/wiilaunch.c
|
||||
|
||||
SOURCES_OGC_ASM := $(OGCDIR)/cache_asm.S \
|
||||
$(OGCDIR)/decrementer_handler.S \
|
||||
$(OGCDIR)/depackrnc.S \
|
||||
$(OGCDIR)/exception_handler.S \
|
||||
$(OGCDIR)/gu_psasm.S \
|
||||
$(OGCDIR)/irq_handler.S \
|
||||
$(OGCDIR)/lwp_handler.S \
|
||||
$(OGCDIR)/ogc_crt0.S \
|
||||
$(OGCDIR)/system_asm.S \
|
||||
$(OGCDIR)/video_asm.S
|
||||
|
||||
|
||||
ifneq ($(BUILD_LITE), 1)
|
||||
SOURCES_OGC += $(OGCDIR)/dvd.c
|
||||
endif
|
||||
|
||||
OGCOBJ := $(SOURCES_OGC:.c=.o) $(SOURCES_OGC_ASM:.S=.o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
SOURCES_DB := \
|
||||
$(DBDIR)/uIP/uip_ip.c \
|
||||
$(DBDIR)/uIP/uip_tcp.c \
|
||||
$(DBDIR)/uIP/uip_pbuf.c \
|
||||
$(DBDIR)/uIP/uip_netif.c \
|
||||
$(DBDIR)/uIP/uip_arp.c \
|
||||
$(DBDIR)/uIP/uip_arch.c \
|
||||
$(DBDIR)/uIP/uip_icmp.c \
|
||||
$(DBDIR)/uIP/memb.c \
|
||||
$(DBDIR)/uIP/memr.c \
|
||||
$(DBDIR)/uIP/bba.c \
|
||||
$(DBDIR)/tcpip.c \
|
||||
$(DBDIR)/debug.c \
|
||||
$(DBDIR)/debug_handler.c \
|
||||
$(DBDIR)/debug_supp.c \
|
||||
$(DBDIR)/geckousb.c
|
||||
|
||||
DBOBJ := $(SOURCES_DB:.c=.o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
SOURCES_BTE := \
|
||||
$(BTEDIR)/bte.c \
|
||||
$(BTEDIR)/hci.c \
|
||||
$(BTEDIR)/l2cap.c \
|
||||
$(BTEDIR)/btmemb.c \
|
||||
$(BTEDIR)/btmemr.c \
|
||||
$(BTEDIR)/btpbuf.c \
|
||||
$(BTEDIR)/physbusif.c
|
||||
|
||||
BTEOBJ := $(SOURCES_BTE:.c=.o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
SOURCES_WIIUSE := \
|
||||
$(WIIUSEDIR)/classic.c \
|
||||
$(WIIUSEDIR)/dynamics.c \
|
||||
$(WIIUSEDIR)/events.c \
|
||||
$(WIIUSEDIR)/io.c \
|
||||
$(WIIUSEDIR)/io_wii.c \
|
||||
$(WIIUSEDIR)/ir.c \
|
||||
$(WIIUSEDIR)/nunchuk.c \
|
||||
$(WIIUSEDIR)/wiiuse.c \
|
||||
$(WIIUSEDIR)/speaker.c \
|
||||
$(WIIUSEDIR)/wpad.c \
|
||||
$(WIIUSEDIR)/motion_plus.c
|
||||
|
||||
WIIUSEOBJ := $(SOURCES_WIIUSE:.c=.o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
SOURCES_WIIKEYB = $(LIBWIIKEYB)/usbkeyboard.c \
|
||||
$(LIBWIIKEYB)/keyboard.c \
|
||||
$(LIBWIIKEYB)/ukbdmap.c \
|
||||
$(LIBWIIKEYB)/wskbdutil.c
|
||||
|
||||
WIIKEYBLIBOBJ := $(SOURCES_WIIKEYB:.c=.o)
|
||||
|
||||
LIBRARIES := $(OGCLIB).a $(DBLIB).a
|
||||
|
||||
ifeq ($(PLATFORM),cube)
|
||||
LIBRARIES += $(BBALIB).a
|
||||
endif
|
||||
ifeq ($(PLATFORM),wii)
|
||||
LIBRARIES += $(BTELIB).a $(WIIUSELIB).a $(WIIKEYBLIB).a
|
||||
endif
|
||||
|
||||
all: $(LIBRARIES)
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BBALIB).a: $(LWIPOBJ)
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OGCLIB).a: $(OGCOBJ)
|
||||
#---------------------------------------------------------------------------------
|
||||
$(DBLIB).a: $(DBOBJ)
|
||||
#---------------------------------------------------------------------------------
|
||||
$(WIIKEYBLIB).a: $(WIIKEYBLIBOBJ)
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BTELIB).a: $(BTEOBJ)
|
||||
#---------------------------------------------------------------------------------
|
||||
$(WIIUSELIB).a: $(WIIUSEOBJ)
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
#---------------------------------------------------------------------------------
|
||||
rm -fr $(LWIPOBJ) $(OGCOBJ) $(DBOBJ) $(BTEOBJ) $(WIIUSEOBJ) $(WIIKEYBLIBOBJ)
|
||||
rm -f *.map
|
||||
@@ -1,4 +1,4 @@
|
||||
include version.all
|
||||
RARCH_VERSION = "0.9.9.3"
|
||||
|
||||
DEBUG = 0
|
||||
|
||||
@@ -10,12 +10,12 @@ TARGET := retroarch-pandora
|
||||
LDDIRS = -L. -L$(PNDSDK)/usr/lib
|
||||
INCDIRS = -I. -I$(PNDSDK)/usr/include
|
||||
|
||||
OBJ = griffin/griffin.o audio/resamplers/sinc_resampler_neon.o libretro-common/conversion/s16_to_float_neon.o libretro-common/conversion/float_to_s16_neon.o
|
||||
OBJ = griffin/griffin.o audio/resamplers/sinc_resampler_neon.o audio/audio_utils_neon.o
|
||||
LDFLAGS = -L$(PNDSDK)/usr/lib -Wl,-rpath,$(PNDSDK)/usr/lib
|
||||
|
||||
LIBS = -lGLESv2 -lEGL -ldl -lm -lpthread -lrt -lasound
|
||||
DEFINES = -std=gnu99 -DHAVE_THREADS -DHAVE_GETOPT_LONG=1 -DHAVE_GRIFFIN -DRARCH_INTERNAL
|
||||
DEFINES += -D__ARM_ARCH_6__ -DSINC_LOWER_QUALITY -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 += -D__ARM_ARCH_6__ -DSINC_LOWER_QUALITY -DHAVE_OPENGL -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DHAVE_GLSL -DHAVE_DYNAMIC -DWANT_RPNG -DWANT_ZLIB -DHAVE_OVERLAY -DHAVE_ALSA -DHAVE_ZLIB -D__linux__
|
||||
DEFINES += $(INCDIRS)
|
||||
DEFINES += -D__OPENPANDORA__ -DPANDORA
|
||||
DEFINES += -marm -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize
|
||||
|
||||
+13
-22
@@ -1,4 +1,4 @@
|
||||
include version.all
|
||||
RARCH_VERSION = "0.9.9.3"
|
||||
|
||||
#which compiler to build with - GCC or SNC
|
||||
#set to GCC for debug builds for use with debugger
|
||||
@@ -15,6 +15,7 @@ DEBUG = 0
|
||||
HAVE_GCMGL = 0
|
||||
HAVE_LOGGER = 0
|
||||
HAVE_FREETYPE = 0
|
||||
HAVE_RLAUNCH = 0
|
||||
WHOLE_ARCHIVE_LINK = 0
|
||||
|
||||
CONTENT_ID_FULL = UP0001-SSNE10000_00-0000000000000001
|
||||
@@ -33,7 +34,7 @@ EBOOT_PATH = pkg/ps3/USRDIR/EBOOT.BIN
|
||||
CORE_PATH = pkg/ps3/USRDIR/cores/CORE.SELF
|
||||
|
||||
LDDIRS = -L. -L$(CELL_SDK)/target/ppu/lib/PSGL/RSX/ultra-opt
|
||||
INCDIRS = -I. -Idefines -Ideps/libz -Ilibretro-common/include -Ideps -Ideps/stb
|
||||
INCDIRS = -I. -Idefines -Ideps/zlib -Ilibretro-common/include
|
||||
|
||||
# system platform
|
||||
system_platform = unix
|
||||
@@ -63,19 +64,11 @@ endif
|
||||
|
||||
PPU_SRCS = griffin/griffin.c
|
||||
|
||||
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
|
||||
|
||||
ifeq ($(DEX_BUILD), 1)
|
||||
DEFINES += -DDEX_BUILD
|
||||
ifeq ($(HAVE_RLAUNCH), 1)
|
||||
DEFINES += -DHAVE_RLAUNCH
|
||||
endif
|
||||
|
||||
ifeq ($(CEX_BUILD), 1)
|
||||
DEFINES += -DCEX_BUILD
|
||||
endif
|
||||
|
||||
ifeq ($(ODE_BUILD), 1)
|
||||
DEFINES += -DODE_BUILD
|
||||
endif
|
||||
DEFINES += -DHAVE_MENU -DHAVE_RGUI -DRARCH_INTERNAL -DMSB_FIRST -DHAVE_OVERLAY
|
||||
|
||||
ifeq ($(HAVE_GCMGL), 1)
|
||||
DEFINES += -DHAVE_GCMGL
|
||||
@@ -113,9 +106,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 -DWANT_ZLIB -DSINC_LOWER_QUALITY -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
|
||||
|
||||
#DEFINES += -DHAVE_IMAGEVIEWER
|
||||
DEFINES += -DHAVE_THREADS -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_FBO -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_RSOUND -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_7Z -DWANT_ZLIB -DSINC_LOWER_QUALITY -D__CELLOS_LV2__ -DHAVE_NETPLAY=1 -DHAVE_NETWORKING=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_MOUSE -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -DHAVE_FILTERS_BUILTIN -DHAVE_BUILTIN_AUTOCONFIG
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
PPU_OPTIMIZE_LV := -O0 -g
|
||||
@@ -175,20 +166,20 @@ pkg: $(PPU_TARGET) create-shaders copy-media-files create-npdrm-salamander crea
|
||||
$(MAKE_PACKAGE_NPDRM) pkg/ps3/package.conf pkg/ps3
|
||||
|
||||
pkg-signed: $(PPU_TARGET) create-shaders copy-media-files create-salamander create-core
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
|
||||
pkg-signed-standalone: $(PPU_TARGET) create-shaders copy-media-files create-core
|
||||
$(MAKE_SELF) $(PPU_TARGET) $(EBOOT_PATH) $(CONTENT_ID)
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
|
||||
pkg-signed-cfw: $(PPU_TARGET) create-shaders copy-media-files create-salamander create-core
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
|
||||
|
||||
pkg-signed-cfw-standalone: $(PPU_TARGET) create-shaders copy-media-files create-core
|
||||
$(MAKE_SELF) $(PPU_TARGET) $(EBOOT_PATH) $(CONTENT_ID)
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
|
||||
|
||||
clean-selfs:
|
||||
ifeq ($(EBOOT_EXISTS),1)
|
||||
|
||||
+14
-21
@@ -1,4 +1,4 @@
|
||||
include version.all
|
||||
RARCH_VERSION = "0.9.9.3"
|
||||
|
||||
#which compiler to build with - GCC or SNC
|
||||
#set to GCC for debug builds for use with debugger
|
||||
@@ -13,6 +13,7 @@ DEBUG = 0
|
||||
HAVE_GCMGL = 1
|
||||
HAVE_LOGGER = 0
|
||||
HAVE_FREETYPE = 0
|
||||
HAVE_RLAUNCH = 0
|
||||
WHOLE_ARCHIVE_LINK = 0
|
||||
|
||||
CONTENT_ID_FULL = UP0001-SSNE10000_00-0000000000000001
|
||||
@@ -31,7 +32,7 @@ EBOOT_PATH = pkg/ps3/USRDIR/EBOOT.BIN
|
||||
CORE_PATH = pkg/ps3/USRDIR/cores/CORE.SELF
|
||||
|
||||
LDDIRS = -L. -L$(CELL_SDK)/target/ppu/lib/PSGL/RSX/ultra-opt
|
||||
INCDIRS = -I. -Idefines -Ideps -Ideps/stb
|
||||
INCDIRS = -I. -Idefines
|
||||
|
||||
# system platform
|
||||
system_platform = unix
|
||||
@@ -61,20 +62,12 @@ endif
|
||||
|
||||
PPU_SRCS = griffin/griffin.c
|
||||
|
||||
ifeq ($(HAVE_RLAUNCH), 1)
|
||||
DEFINES += -DHAVE_RLAUNCH
|
||||
endif
|
||||
|
||||
DEFINES += -DHAVE_RGUI -DHAVE_MATERIALUI -DHAVE_XMB -DHAVE_MENU -DRARCH_INTERNAL
|
||||
|
||||
ifeq ($(DEX_BUILD), 1)
|
||||
DEFINES += -DDEX_BUILD
|
||||
endif
|
||||
|
||||
ifeq ($(CEX_BUILD), 1)
|
||||
DEFINES += -DCEX_BUILD
|
||||
endif
|
||||
|
||||
ifeq ($(ODE_BUILD), 1)
|
||||
DEFINES += -DODE_BUILD
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_GCMGL), 1)
|
||||
DEFINES += -DHAVE_GCMGL
|
||||
GL_LIBS := -L. -lrgl_ps3
|
||||
@@ -111,7 +104,7 @@ PPU_LDLIBS = $(FONT_LIBS) $(GL_LIBS) $(WHOLE_START) -lretro_ps3 $(WHOLE_END) -l
|
||||
|
||||
PPU_RANLIB = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ranlib.exe
|
||||
|
||||
DEFINES += -DHAVE_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 -DSINC_LOWER_QUALITY -D__CELLOS_LV2__ -DHAVE_NETWORKING=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_MOUSE -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=0 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -DHAVE_STB_VORBIS
|
||||
DEFINES += -DHAVE_THREADS -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_FBO -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_RSOUND -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -DSINC_LOWER_QUALITY -D__CELLOS_LV2__ -DHAVE_NETPLAY=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_MOUSE -DHAVE_GRIFFIN=1 -DHAVE_MULTIMAN=0 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
PPU_OPTIMIZE_LV := -O0 -g
|
||||
@@ -171,20 +164,20 @@ pkg: $(PPU_TARGET) create-shaders copy-media-files create-npdrm-salamander crea
|
||||
$(MAKE_PACKAGE_NPDRM) pkg/ps3/package.conf pkg/ps3
|
||||
|
||||
pkg-signed: $(PPU_TARGET) create-shaders copy-media-files create-salamander create-core
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
|
||||
pkg-signed-standalone: $(PPU_TARGET) create-shaders copy-media-files create-core
|
||||
$(MAKE_SELF) $(PPU_TARGET) $(EBOOT_PATH) $(CONTENT_ID)
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
|
||||
pkg-signed-cfw: $(PPU_TARGET) create-shaders copy-media-files create-salamander create-core
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
|
||||
|
||||
pkg-signed-cfw-standalone: $(PPU_TARGET) create-shaders copy-media-files create-core
|
||||
$(MAKE_SELF) $(PPU_TARGET) $(EBOOT_PATH) $(CONTENT_ID)
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
$(PKG_FINALIZE) retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg
|
||||
|
||||
clean-selfs:
|
||||
ifeq ($(EBOOT_EXISTS),1)
|
||||
|
||||
+8
-34
@@ -16,56 +16,28 @@ 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_CFLAGS += -I. -Ilibretro-common/include -Ideps/zlib -D__CELLOS_LV2__ -DIS_SALAMANDER -DRARCH_CONSOLE -DHAVE_SYSUTILS -DHAVE_SYSMODULES -DHAVE_RARCH_EXEC
|
||||
PPU_SRCS = frontend/frontend_salamander.c \
|
||||
frontend/frontend_driver.c \
|
||||
frontend/drivers/platform_ps3.c \
|
||||
frontend/drivers/platform_null.c \
|
||||
libretro-common/file/file_path.c \
|
||||
libretro-common/lists/dir_list.c \
|
||||
libretro-common/lists/string_list.c \
|
||||
libretro-common/file/dir_list.c \
|
||||
libretro-common/file/retro_dirent.c \
|
||||
libretro-common/file/retro_stat.c \
|
||||
libretro-common/hash/rhash.c \
|
||||
libretro-common/string/stdstring.c \
|
||||
libretro-common/encodings/encoding_utf.c \
|
||||
libretro-common/string/string_list.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/retro_file.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
|
||||
PPU_SRCS += netlogger.c
|
||||
endif
|
||||
|
||||
PPU_TARGET = retroarch-salamander_ps3.elf
|
||||
@@ -85,6 +57,8 @@ endif
|
||||
|
||||
PPU_LDLIBS += -lm -lnet_stub -lnetctl_stub -lio_stub -lsysmodule_stub -lsysutil_stub -lsysutil_game_stub -lfs_stub -lsysutil_np_stub
|
||||
|
||||
PPU_OPTIMIZE_LV := -O2
|
||||
|
||||
MAKE_FSELF = $(CELL_SDK)/host-win32/bin/make_fself.exe
|
||||
|
||||
include $(CELL_MK_DIR)/sdk.target.mk
|
||||
+5
-4
@@ -1,4 +1,4 @@
|
||||
include version.all
|
||||
RARCH_VERSION = "0.9.9.3"
|
||||
|
||||
DEBUG = 0
|
||||
HAVE_LOGGER = 0
|
||||
@@ -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 -Ideps/libz -Ips3/gcmgl/include/export -Ips3/include -Ideps -Ideps/stb
|
||||
INCLUDE := -I. -I$(PS3DEV)/ppu/include -Ideps/zlib -Ips3/gcmgl/include/export -Ips3/include
|
||||
LIBDIRS := -L$(PS3DEV)/ppu/lib -L$(PS3DEV)/portlibs/ppu/lib -L.
|
||||
|
||||
MACHDEP := -D__CELLOS_LV2__ -D__PSL1GHT__
|
||||
@@ -83,13 +83,14 @@ OBJ = griffin/griffin.o
|
||||
|
||||
ifeq ($(HAVE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_LOGGER
|
||||
CFLAGS += -Ilogger/netlogger
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_FILE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_FILE_LOGGER
|
||||
endif
|
||||
|
||||
SHARED_FLAGS := -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
|
||||
SHARED_FLAGS := -DRARCH_CONSOLE -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_HEADSET -DHAVE_OPENGLES -DHAVE_OPENGLES1 -DHAVE_PSGL -DHAVE_CG -DHAVE_CG_RUNTIME_COMPILER -DHAVE_GCMGL -DHAVE_FBO -DHAVE_SYSMODULES -DHAVE_SYSUTILS -DHAVE_RARCH_EXEC -DHAVE_MOUSE -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -DHAVE_GRIFFIN=1 -DHAVE_NETPLAY=1 -DHAVE_SOCKET_LEGACY=1 -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) -Wno-char-subscripts
|
||||
CFLAGS += -std=gnu99 $(SHARED_FLAGS)
|
||||
CXXFLAGS += $(SHARED_FLAGS)
|
||||
|
||||
@@ -121,7 +122,7 @@ pkg: $(ELF_TARGET) create-npdrm-core
|
||||
$(MAKE_PACKAGE_NPDRM) pkg/ps3/package.conf ps3/pkg
|
||||
|
||||
pkg-signed: $(ELF_TARGET) create-core
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg
|
||||
$(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg
|
||||
|
||||
clean:
|
||||
rm -f $(ELF_TARGET)
|
||||
|
||||
+4
-6
@@ -1,8 +1,6 @@
|
||||
BUILD_PRX = 0
|
||||
PSP_LARGE_MEMORY = 1
|
||||
BUILD_PRX = 1
|
||||
DEBUG = 0
|
||||
HAVE_KERNEL_PRX = 1
|
||||
HAVE_LOGGER = 0
|
||||
HAVE_FILE_LOGGER = 0
|
||||
HAVE_THREADS = 0
|
||||
BIG_STACK = 0
|
||||
@@ -13,7 +11,7 @@ TARGET = retroarchpsp
|
||||
ifeq ($(DEBUG), 1)
|
||||
OPTIMIZE_LV := -O0 -g
|
||||
else
|
||||
OPTIMIZE_LV := -O2
|
||||
OPTIMIZE_LV := -O3 -g
|
||||
endif
|
||||
|
||||
ifeq ($(WHOLE_ARCHIVE_LINK), 1)
|
||||
@@ -21,11 +19,11 @@ ifeq ($(WHOLE_ARCHIVE_LINK), 1)
|
||||
WHOLE_END := -Wl,--no-whole-archive
|
||||
endif
|
||||
|
||||
INCDIR = deps deps/stb deps/libz deps/7zip libretro-common/include
|
||||
INCDIR = deps/zlib deps/7zip libretro-common/include
|
||||
CFLAGS = $(OPTIMIZE_LV) -G0 -std=gnu99 -ffast-math
|
||||
ASFLAGS = $(CFLAGS)
|
||||
|
||||
RARCH_DEFINES = -DPSP -D_MIPS_ARCH_ALLEGREX -DHAVE_LANGEXTRA -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DWANT_ZLIB -DHAVE_GRIFFIN=1 -DRARCH_INTERNAL -DRARCH_CONSOLE -DHAVE_MENU -DHAVE_RGUI -DSINC_LOWEST_QUALITY -DHAVE_FILTERS_BUILTIN -DHAVE_7ZIP -DHAVE_CC_RESAMPLER
|
||||
RARCH_DEFINES = -DPSP -D_MIPS_ARCH_ALLEGREX -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -DHAVE_GRIFFIN=1 -DRARCH_INTERNAL -DRARCH_CONSOLE -DHAVE_MENU -DHAVE_RGUI -DWANT_RPNG -DSINC_LOWEST_QUALITY -DHAVE_BUILTIN_AUTOCONFIG -DHAVE_FILTERS_BUILTIN -DHAVE_7ZIP
|
||||
|
||||
LIBDIR =
|
||||
LDFLAGS =
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
BUILD_PRX = 0
|
||||
PSP_LARGE_MEMORY = 1
|
||||
BUILD_PRX = 1
|
||||
HAVE_FILE_LOGGER = 0
|
||||
DEBUG = 0
|
||||
|
||||
@@ -8,7 +7,7 @@ TARGET = retroarchpsp_salamander
|
||||
ifeq ($(DEBUG), 1)
|
||||
OPTIMIZE_LV := -O0 -g
|
||||
else
|
||||
OPTIMIZE_LV := -O2
|
||||
OPTIMIZE_LV := -O2 -g
|
||||
endif
|
||||
|
||||
INCDIR = $(PSPPATH)/include libretro-common/include
|
||||
@@ -25,7 +24,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
|
||||
@@ -38,17 +37,14 @@ OBJS = frontend/frontend_salamander.o \
|
||||
frontend/drivers/platform_null.o \
|
||||
libretro-common/file/file_path.o \
|
||||
libretro-common/string/stdstring.o \
|
||||
libretro-common/lists/string_list.o \
|
||||
libretro-common/lists/dir_list.o \
|
||||
libretro-common/string/string_list.o \
|
||||
libretro-common/file/dir_list.o \
|
||||
libretro-common/file/retro_dirent.o \
|
||||
libretro-common/encodings/encoding_utf.o \
|
||||
libretro-common/compat/compat_strl.o \
|
||||
libretro-common/compat/compat_strcasestr.o \
|
||||
libretro-common/file/config_file.o \
|
||||
libretro-common/streams/file_stream.o \
|
||||
libretro-common/vfs/vfs_implementation.o \
|
||||
libretro-common/file/retro_file.o \
|
||||
libretro-common/file/retro_stat.o \
|
||||
libretro-common/hash/rhash.o \
|
||||
file_path_str.o \
|
||||
verbosity.o \
|
||||
bootstrap/psp1/kernel_functions.o
|
||||
|
||||
|
||||
-183
@@ -1,183 +0,0 @@
|
||||
TARGET := retroarch_vita
|
||||
DEBUG ?= 0
|
||||
GRIFFIN_BUILD = 0
|
||||
WHOLE_ARCHIVE_LINK = 0
|
||||
|
||||
VITA_TITLE_ID := RETROARCH
|
||||
VITA_TITLE_NAME := RetroArch
|
||||
|
||||
PC_DEVELOPMENT_IP_ADDRESS =
|
||||
PC_DEVELOPMENT_UDP_PORT =
|
||||
|
||||
OBJ :=
|
||||
|
||||
DEFINES :=
|
||||
|
||||
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_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DWANT_ZLIB -DHAVE_CC_RESAMPLER
|
||||
ifeq ($(DEBUG), 1)
|
||||
DEFINES += -DHAVE_NETLOGGER
|
||||
endif
|
||||
else
|
||||
|
||||
HAVE_NEON := 1
|
||||
HAVE_FILTERS_BUILTIN := 1
|
||||
HAVE_LANGEXTRA := 1
|
||||
HAVE_RPNG := 1
|
||||
HAVE_RJPEG := 1
|
||||
HAVE_RBMP := 1
|
||||
HAVE_RTGA := 1
|
||||
HAVE_ZLIB := 1
|
||||
HAVE_7ZIP := 1
|
||||
HAVE_VITA2D := 1
|
||||
HAVE_NETWORKING := 1
|
||||
HAVE_SOCKET_LEGACY := 1
|
||||
HAVE_MENU := 1
|
||||
HAVE_MENU_COMMON := 1
|
||||
HAVE_OVERLAY := 1
|
||||
HAVE_MATERIALUI := 1
|
||||
HAVE_XMB := 1
|
||||
HAVE_RGUI := 1
|
||||
HAVE_STB_FONT := 1
|
||||
HAVE_THREADS := 1
|
||||
HAVE_LIBRETRODB := 1
|
||||
HAVE_CC_RESAMPLER := 1
|
||||
HAVE_CHEEVOS := 1
|
||||
RARCH_CONSOLE := 1
|
||||
HAVE_STATIC_VIDEO_FILTERS = 1
|
||||
HAVE_STATIC_AUDIO_FILTERS = 1
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
HAVE_NETLOGGER = 1
|
||||
endif
|
||||
|
||||
include Makefile.common
|
||||
BLACKLIST :=
|
||||
OBJ := $(filter-out $(BLACKLIST),$(OBJ))
|
||||
|
||||
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
|
||||
|
||||
export PATH := $(PATH):$(VITASDK)/bin
|
||||
|
||||
PREFIX := arm-vita-eabi-
|
||||
|
||||
CC := $(PREFIX)gcc
|
||||
CXX := $(PREFIX)g++
|
||||
AS := $(PREFIX)as
|
||||
AR := $(PREFIX)ar
|
||||
OBJCOPY := $(PREFIX)objcopy
|
||||
STRIP := $(PREFIX)strip
|
||||
NM := $(PREFIX)nm
|
||||
LD := $(CXX)
|
||||
|
||||
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
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -O2 -g
|
||||
else
|
||||
CFLAGS += -O3
|
||||
endif
|
||||
|
||||
ASFLAGS := $(CFLAGS)
|
||||
LDFLAGS := -Wl,-q
|
||||
|
||||
CFLAGS += -Wall -ffast-math
|
||||
CFLAGS += -DRARCH_INTERNAL -DRARCH_CONSOLE
|
||||
CFLAGS += -DHAVE_FILTERS_BUILTIN $(DEFINES)
|
||||
|
||||
ifneq ($(PC_DEVELOPMENT_IP_ADDRESS),)
|
||||
CFLAGS += -DPC_DEVELOPMENT_IP_ADDRESS='"$(PC_DEVELOPMENT_IP_ADDRESS)"'
|
||||
endif
|
||||
|
||||
ifneq ($(PC_DEVELOPMENT_UDP_PORT),)
|
||||
CFLAGS += -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
|
||||
endif
|
||||
|
||||
ifeq ($(WHOLE_ARCHIVE_LINK), 1)
|
||||
WHOLE_START := -Wl,--whole-archive
|
||||
WHOLE_END := -Wl,--no-whole-archive
|
||||
endif
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||
|
||||
VITA_LIBS := -lSceDisplay_stub -lSceGxm_stub -lSceNet_stub -lSceNetCtl_stub \
|
||||
-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
|
||||
|
||||
LIBS := $(WHOLE_START) -lretro_vita $(WHOLE_END) $(VITA_LIBS) -lm -lc
|
||||
|
||||
TARGETS := $(TARGET).vpk
|
||||
|
||||
DEPFLAGS = -MT $@ -MMD -MP -MF $*.Tdepend
|
||||
POSTCOMPILE = mv -f $*.Tdepend $*.depend
|
||||
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
%.o: %.cpp
|
||||
%.o: %.cpp %.depend
|
||||
$(CXX) -c -o $@ $< $(CXXFLAGS) $(INCDIRS) $(DEPFLAGS)
|
||||
$(POSTCOMPILE)
|
||||
|
||||
%.o: %.c
|
||||
%.o: %.c %.depend
|
||||
$(CC) -c -o $@ $< $(CFLAGS) $(INCDIRS) $(DEPFLAGS)
|
||||
$(POSTCOMPILE)
|
||||
|
||||
|
||||
%.o: %.S
|
||||
%.o: %.S %.depend
|
||||
$(CC) -c -o $@ $< $(ASFLAGS) $(INCDIRS) $(DEPFLAGS)
|
||||
$(POSTCOMPILE)
|
||||
|
||||
%.o: %.s
|
||||
%.o: %.s %.depend
|
||||
$(CC) -c -o $@ $< $(ASFLAGS) $(INCDIRS) $(DEPFLAGS)
|
||||
$(POSTCOMPILE)
|
||||
|
||||
%.depend: ;
|
||||
|
||||
$(TARGET).elf: $(OBJ) libretro_vita.a
|
||||
$(LD) $(OBJ) $(LDFLAGS) $(LIBDIRS) $(LIBS) -o $@
|
||||
|
||||
%.velf: %.elf
|
||||
vita-elf-create $< $@
|
||||
|
||||
%.self: %.velf
|
||||
vita-make-fself -c -s $< $@
|
||||
|
||||
%.vpk: %.self
|
||||
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).velf $(TARGET).self param.sfo $(TARGET).vpk
|
||||
rm -f $(OBJ:.o=.depend)
|
||||
|
||||
# Useful for developers
|
||||
vpksend: $(TARGET).vpk
|
||||
curl -T $< ftp://$(PSVITAIP):1337/ux0:/
|
||||
|
||||
send: $(TARGET).self
|
||||
curl -T $< ftp://$(PSVITAIP):1337/ux0:/app/$(VITA_TITLE_ID)/eboot.bin
|
||||
|
||||
.PHONY: clean all send vpksend
|
||||
.PRECIOUS: %.depend
|
||||
|
||||
-include $(OBJ:.o=.depend)
|
||||
@@ -1,84 +0,0 @@
|
||||
HAVE_FILE_LOGGER = 0
|
||||
DEBUG = 0
|
||||
|
||||
TARGET = retroarchvita_salamander
|
||||
TITLE_ID = RETROVITA
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
OPTIMIZE_LV := -O0 -g
|
||||
else
|
||||
OPTIMIZE_LV := -O2
|
||||
endif
|
||||
|
||||
PREFIX = arm-vita-eabi
|
||||
CC = $(PREFIX)-gcc
|
||||
|
||||
INCDIR = libretro-common/include
|
||||
CFLAGS = -Wl,-q $(OPTIMIZE_LV) -I$(INCDIR) -std=gnu99 -mfloat-abi=hard -ffast-math -fsingle-precision-constant -mword-relocations
|
||||
ASFLAGS = $(CFLAGS)
|
||||
|
||||
RARCH_DEFINES = -DVITA -DIS_SALAMANDER -DRARCH_CONSOLE
|
||||
|
||||
LIBDIR =
|
||||
LDFLAGS =
|
||||
LIBS = -lSceDisplay_stub -lSceGxm_stub -lSceNet_stub -lSceNetCtl_stub\
|
||||
-lSceSysmodule_stub -lSceCtrl_stub -lSceAudio_stub -lSceFiber_stub\
|
||||
-lScePower_stub -lSceRtc_stub -lSceCommonDialog_stub -lScePgf_stub \
|
||||
-lSceMotion_stub -lSceAppMgr_stub -lfreetype -lpng -lm -lc
|
||||
|
||||
ifeq ($(HAVE_FILE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_FILE_LOGGER
|
||||
endif
|
||||
|
||||
CFLAGS += $(RARCH_DEFINES)
|
||||
|
||||
OBJS = frontend/frontend_salamander.o \
|
||||
frontend/frontend_driver.o \
|
||||
frontend/drivers/platform_psp.o \
|
||||
frontend/drivers/platform_null.o \
|
||||
libretro-common/file/file_path.o \
|
||||
libretro-common/string/stdstring.o \
|
||||
libretro-common/lists/string_list.o \
|
||||
libretro-common/lists/dir_list.o \
|
||||
libretro-common/file/retro_dirent.o \
|
||||
libretro-common/encodings/encoding_utf.o \
|
||||
libretro-common/compat/compat_strl.o \
|
||||
libretro-common/compat/compat_strcasestr.o \
|
||||
libretro-common/file/config_file.o \
|
||||
libretro-common/streams/file_stream.o \
|
||||
libretro-common/vfs/vfs_implementation.o \
|
||||
libretro-common/hash/rhash.o \
|
||||
file_path_str.o \
|
||||
verbosity.o
|
||||
|
||||
all: $(TARGET).vpk
|
||||
|
||||
%.vpk: eboot.bin
|
||||
vita-mksfoex -s TITLE_ID=$(TITLE_ID) "$(TARGET)" param.sfo
|
||||
vita-pack-vpk -s param.sfo -b eboot.bin $@
|
||||
|
||||
eboot.bin: $(TARGET).velf
|
||||
vita-make-fself $< $@
|
||||
|
||||
%.velf: %.elf
|
||||
vita-elf-create $< $@
|
||||
|
||||
$(TARGET).elf: $(OBJS)
|
||||
$(CC) $(CFLAGS) $^ $(LIBS) -o $@
|
||||
|
||||
%.o: %.png
|
||||
$(PREFIX)-ld -r -b binary -o $@ $^
|
||||
|
||||
clean:
|
||||
@rm -rf $(TARGET).vpk $(TARGET).velf $(TARGET).elf $(OBJS) \
|
||||
eboot.bin param.sfo
|
||||
|
||||
vpksend: $(TARGET).vpk
|
||||
curl -T $(TARGET).vpk ftp://$(PSVITAIP):1337/ux0:/
|
||||
@echo "Sent."
|
||||
|
||||
PSVITAIP = 192.168.1.15
|
||||
|
||||
send: eboot.bin
|
||||
curl -T eboot.bin ftp://$(PSVITAIP):1337/ux0:/app/$(TITLE_ID)/
|
||||
@echo "Sent."
|
||||
+7
-37
@@ -6,7 +6,6 @@
|
||||
DEBUG = 0
|
||||
HAVE_LOGGER = 0
|
||||
HAVE_FILE_LOGGER = 0
|
||||
EXTERNAL_LIBOGC = 0
|
||||
|
||||
# system platform
|
||||
system_platform = unix
|
||||
@@ -30,23 +29,13 @@ ELF2DOL = $(DEVKITPPC)/bin/elf2dol$(EXE_EXT)
|
||||
DOL_TARGET := retroarch-salamander_wii.dol
|
||||
ELF_TARGET := retroarch-salamander_wii.elf
|
||||
|
||||
INCLUDE := -I. -Ilibretro-common/include -Ideps/libz
|
||||
ifeq ($(EXTERNAL_LIBOGC), 1)
|
||||
INCLUDE += -I$(DEVKITPRO)/libogc/include
|
||||
INCLUDE := -I. -I$(DEVKITPRO)/libogc/include -Ilibretro-common/include -Ideps/zlib
|
||||
LIBDIRS := -L$(DEVKITPRO)/libogc/lib/wii -L.
|
||||
else
|
||||
INCLUDE += -Iwii/libogc/include
|
||||
LIBDIRS := -Lwii/libogc/libs/wii -L.
|
||||
endif
|
||||
|
||||
MACHDEP := -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float
|
||||
CFLAGS += -Wall -std=gnu99 $(MACHDEP) $(INCLUDE)
|
||||
LDFLAGS := $(MACHDEP) -Wl,-Map,$(notdir $(ELF_TARGET)).map
|
||||
LIBS := -lwiiuse -logc -lbte
|
||||
|
||||
ifeq ($(EXTERNAL_LIBOGC), 1)
|
||||
LIBS += -lfat
|
||||
endif
|
||||
LIBS := -lfat -lwiiuse -logc -lbte
|
||||
|
||||
APP_BOOTER_DIR = wii/app_booter
|
||||
|
||||
@@ -58,39 +47,20 @@ OBJ = frontend/frontend_salamander.o \
|
||||
libretro-common/file/file_path.o \
|
||||
libretro-common/hash/rhash.o \
|
||||
libretro-common/string/stdstring.o \
|
||||
libretro-common/lists/string_list.o \
|
||||
libretro-common/lists/dir_list.o \
|
||||
libretro-common/streams/file_stream.o \
|
||||
libretro-common/vfs/vfs_implementation.o \
|
||||
libretro-common/string/string_list.o \
|
||||
libretro-common/file/dir_list.o \
|
||||
libretro-common/file/retro_file.o \
|
||||
libretro-common/file/retro_dirent.o \
|
||||
libretro-common/encodings/encoding_utf.o \
|
||||
libretro-common/file/retro_stat.o \
|
||||
libretro-common/compat/compat_strl.o \
|
||||
libretro-common/compat/compat_strcasestr.o \
|
||||
libretro-common/file/config_file.o \
|
||||
file_path_str.o \
|
||||
verbosity.o \
|
||||
$(APP_BOOTER_DIR)/app_booter.binobj
|
||||
|
||||
ifeq ($(EXTERNAL_LIBOGC), 1)
|
||||
else
|
||||
OBJ += wii/libogc/libfat/cache.o \
|
||||
wii/libogc/libfat/directory.o \
|
||||
wii/libogc/libfat/disc.o \
|
||||
wii/libogc/libfat/fatdir.o \
|
||||
wii/libogc/libfat/fatfile.o \
|
||||
wii/libogc/libfat/file_allocation_table.o \
|
||||
wii/libogc/libfat/filetime.o \
|
||||
wii/libogc/libfat/libfat.o \
|
||||
wii/libogc/libfat/lock.o \
|
||||
wii/libogc/libfat/partition.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_LOGGER
|
||||
CFLAGS += -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
|
||||
OBJ += network/net_logger.o \
|
||||
libretro-common/net/net_compat.o \
|
||||
libretro-common/net/net_socket.o
|
||||
OBJ += logger/netlogger.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_FILE_LOGGER), 1)
|
||||
|
||||
-261
@@ -1,261 +0,0 @@
|
||||
TARGET := retroarch_wiiu
|
||||
BUILD_HBL_ELF = 1
|
||||
BUILD_RPX = 1
|
||||
DEBUG = 0
|
||||
GRIFFIN_BUILD = 0
|
||||
WHOLE_ARCHIVE_LINK = 0
|
||||
|
||||
ifneq ($(V), 1)
|
||||
Q := @
|
||||
endif
|
||||
|
||||
PC_DEVELOPMENT_IP_ADDRESS ?=
|
||||
PC_DEVELOPMENT_TCP_PORT ?=
|
||||
|
||||
OBJ :=
|
||||
OBJ += wiiu/system/memory.o
|
||||
OBJ += wiiu/system/exception_handler.o
|
||||
OBJ += wiiu/system/missing_libc_functions.o
|
||||
OBJ += wiiu/fs/sd_fat_devoptab.o
|
||||
OBJ += wiiu/fs/fs_utils.o
|
||||
OBJ += wiiu/tex_shader.o
|
||||
OBJ += wiiu/hbl.o
|
||||
|
||||
ifeq ($(ENABLE_CONTROLLER_PATCHER), 1)
|
||||
OBJ += wiiu/controller_patcher/ControllerPatcher.o
|
||||
OBJ += wiiu/controller_patcher/ControllerPatcherWrapper.o
|
||||
OBJ += wiiu/controller_patcher/ConfigReader.o
|
||||
OBJ += wiiu/controller_patcher/config/ConfigParser.o
|
||||
OBJ += wiiu/controller_patcher/config/ConfigValues.o
|
||||
OBJ += wiiu/controller_patcher/network/ControllerPatcherNet.o
|
||||
OBJ += wiiu/controller_patcher/network/TCPServer.o
|
||||
OBJ += wiiu/controller_patcher/network/UDPClient.o
|
||||
OBJ += wiiu/controller_patcher/network/UDPServer.o
|
||||
OBJ += wiiu/controller_patcher/patcher/ControllerPatcherUtils.o
|
||||
OBJ += wiiu/controller_patcher/patcher/ControllerPatcherHID.o
|
||||
OBJ += wiiu/controller_patcher/utils/CPRetainVars.o
|
||||
OBJ += wiiu/controller_patcher/utils/CPStringTools.o
|
||||
OBJ += wiiu/controller_patcher/utils/PadConst.o
|
||||
OBJ += wiiu/controller_patcher/utils/FSHelper.o
|
||||
endif
|
||||
|
||||
DEFINES :=
|
||||
|
||||
ifeq ($(GRIFFIN_BUILD), 1)
|
||||
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_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 = 1
|
||||
HAVE_KEYMAPPER = 1
|
||||
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_STATIC_VIDEO_FILTERS = 1
|
||||
HAVE_STATIC_AUDIO_FILTERS = 1
|
||||
WANT_LIBFAT = 1
|
||||
WANT_IOSUHAX = 1
|
||||
|
||||
include Makefile.common
|
||||
BLACKLIST :=
|
||||
BLACKLIST += input/input_overlay.o
|
||||
BLACKLIST += tasks/task_overlay.o
|
||||
BLACKLIST += $(LIBRETRO_COMM_DIR)/net/net_ifinfo.o
|
||||
OBJ := $(filter-out $(BLACKLIST),$(OBJ))
|
||||
|
||||
OBJ += gfx/drivers/wiiu_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 += audio/drivers/wiiu_audio.o
|
||||
OBJ += frontend/drivers/platform_wiiu.o
|
||||
endif
|
||||
|
||||
DEFINES += -DHAVE_KEYMAPPER
|
||||
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
|
||||
endif
|
||||
ifeq ($(strip $(DEVKITPRO)),)
|
||||
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPRO")
|
||||
endif
|
||||
|
||||
export PATH := $(PATH):$(DEVKITPPC)/bin
|
||||
|
||||
PREFIX := powerpc-eabi-
|
||||
|
||||
CC := $(PREFIX)gcc
|
||||
CXX := $(PREFIX)g++
|
||||
AS := $(PREFIX)as
|
||||
AR := $(PREFIX)ar
|
||||
OBJCOPY := $(PREFIX)objcopy
|
||||
STRIP := $(PREFIX)strip
|
||||
NM := $(PREFIX)nm
|
||||
LD := $(CXX)
|
||||
|
||||
ELF2RPL := wiiu/wut/elf2rpl/elf2rpl
|
||||
|
||||
ifneq ($(findstring Linux,$(shell uname -a)),)
|
||||
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
||||
else
|
||||
ELF2RPL := $(ELF2RPL).exe
|
||||
endif
|
||||
|
||||
|
||||
INCDIRS := -I. -Ideps -Ideps/stb -Ideps/libz -Ideps/7zip -Ilibretro-common/include -Iwiiu -Iwiiu/include -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
|
||||
|
||||
#todo: remove -DWIIU and use the built-in macros instead (HW_WUP or __wiiu__).
|
||||
CFLAGS += -DWIIU -DMSB_FIRST -D__WUT__
|
||||
CFLAGS += -DHAVE_MAIN
|
||||
CFLAGS += -DHAVE_UPDATE_ASSETS
|
||||
CFLAGS += -DRARCH_INTERNAL -DRARCH_CONSOLE
|
||||
ifeq ($(ENABLE_CONTROLLER_PATCHER), 1)
|
||||
CFLAGS += -DENABLE_CONTROLLER_PATCHER
|
||||
endif
|
||||
CFLAGS += -DHAVE_FILTERS_BUILTIN $(DEFINES)
|
||||
|
||||
ifneq ($(PC_DEVELOPMENT_IP_ADDRESS),)
|
||||
CFLAGS += -DPC_DEVELOPMENT_IP_ADDRESS='"$(PC_DEVELOPMENT_IP_ADDRESS)"'
|
||||
endif
|
||||
|
||||
ifneq ($(PC_DEVELOPMENT_TCP_PORT),)
|
||||
CFLAGS += -DPC_DEVELOPMENT_TCP_PORT=$(PC_DEVELOPMENT_TCP_PORT)
|
||||
endif
|
||||
|
||||
ifeq ($(WHOLE_ARCHIVE_LINK), 1)
|
||||
WHOLE_START := -Wl,--whole-archive
|
||||
WHOLE_END := -Wl,--no-whole-archive
|
||||
endif
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -D_GNU_SOURCE
|
||||
|
||||
LDFLAGS += -Wl,--gc-sections
|
||||
|
||||
LIBS := $(WHOLE_START) -lretro_wiiu $(WHOLE_END) -lm
|
||||
|
||||
ifneq ($(WANT_LIBFAT), 1)
|
||||
LIBS += -lfat
|
||||
endif
|
||||
|
||||
ifneq ($(WANT_IOSUHAX), 1)
|
||||
LIBS += -liosuhax
|
||||
endif
|
||||
|
||||
|
||||
RPX_OBJ = wiiu/system/stubs_rpl.o
|
||||
HBL_ELF_OBJ = wiiu/system/dynamic.o 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)
|
||||
TARGETS += $(TARGET).rpx
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_HBL_ELF), 1)
|
||||
TARGETS += $(TARGET).elf
|
||||
endif
|
||||
|
||||
DEPFLAGS = -MT $@ -MMD -MP -MF $*.Tdepend
|
||||
POSTCOMPILE = mv -f $*.Tdepend $*.depend
|
||||
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
%.o: %.cpp
|
||||
%.o: %.cpp %.depend
|
||||
@$(if $(Q), echo CXX $<,)
|
||||
$(Q)$(CXX) -c -o $@ $< $(CXXFLAGS) $(INCDIRS) $(DEPFLAGS)
|
||||
$(Q)$(POSTCOMPILE)
|
||||
|
||||
%.o: %.c
|
||||
%.o: %.c %.depend
|
||||
@$(if $(Q), echo CC $<,)
|
||||
$(Q)$(CC) -c -o $@ $< $(CFLAGS) $(INCDIRS) $(DEPFLAGS)
|
||||
$(Q)$(POSTCOMPILE)
|
||||
|
||||
|
||||
%.o: %.S
|
||||
%.o: %.S %.depend
|
||||
@$(if $(Q), echo AS $<,)
|
||||
$(Q)$(CC) -c -o $@ $< $(ASFLAGS) $(INCDIRS) $(DEPFLAGS)
|
||||
$(Q)$(POSTCOMPILE)
|
||||
|
||||
%.o: %.s
|
||||
%.o: %.s %.depend
|
||||
@$(if $(Q), echo AS $<,)
|
||||
$(Q)$(CC) -c -o $@ $< $(ASFLAGS) $(INCDIRS) $(DEPFLAGS)
|
||||
$(Q)$(POSTCOMPILE)
|
||||
%.a:
|
||||
@$(if $(Q), echo AR $<,)
|
||||
$(Q)$(AR) -rc $@ $^
|
||||
|
||||
%.depend: ;
|
||||
|
||||
|
||||
$(ELF2RPL):
|
||||
@$(if $(Q), echo MAKE $@,)
|
||||
$(Q)$(MAKE) -C wiiu/wut/elf2rpl/
|
||||
|
||||
$(TARGET).elf: $(OBJ) $(HBL_ELF_OBJ) libretro_wiiu.a wiiu/link_elf.ld
|
||||
@$(if $(Q), echo LD $@,)
|
||||
$(Q)$(LD) $(OBJ) $(HBL_ELF_OBJ) $(LDFLAGS) $(HBL_ELF_LDFLAGS) $(LIBDIRS) $(LIBS) -o $@
|
||||
|
||||
$(TARGET).rpx.elf: $(OBJ) $(RPX_OBJ) libretro_wiiu.a wiiu/link_elf.ld
|
||||
@$(if $(Q), echo LD $@,)
|
||||
$(Q)$(LD) $(OBJ) $(RPX_OBJ) $(LDFLAGS) $(RPX_LDFLAGS) $(LIBDIRS) $(LIBS) -o $@
|
||||
|
||||
$(TARGET).rpx: $(TARGET).rpx.elf $(ELF2RPL)
|
||||
@$(if $(Q), echo ELF2RPL $@,)
|
||||
$(Q)-$(ELF2RPL) $(TARGET).rpx.elf $@
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ) $(RPX_OBJ) $(HBL_ELF_OBJ) $(TARGET).elf $(TARGET).rpx.elf $(TARGET).rpx
|
||||
rm -f $(OBJ:.o=.depend) $(RPX_OBJ:.o=.depend) $(HBL_ELF_OBJ:.o=.depend)
|
||||
|
||||
.PHONY: clean all
|
||||
.PRECIOUS: %.depend
|
||||
|
||||
-include $(OBJ:.o=.depend) $(RPX_OBJ:.o=.depend) $(HBL_ELF_OBJ:.o=.depend)
|
||||
@@ -1,177 +0,0 @@
|
||||
TARGET := retroarch_wiiu_salamander
|
||||
BUILD_HBL_ELF = 1
|
||||
BUILD_RPX = 1
|
||||
DEBUG = 0
|
||||
|
||||
PC_DEVELOPMENT_IP_ADDRESS =
|
||||
PC_DEVELOPMENT_TCP_PORT =
|
||||
|
||||
OBJ :=
|
||||
OBJ += wiiu/system/memory.o
|
||||
OBJ += wiiu/system/exception_handler.o
|
||||
OBJ += wiiu/fs/sd_fat_devoptab.o
|
||||
OBJ += wiiu/fs/fs_utils.o
|
||||
OBJ += wiiu/hbl.o
|
||||
OBJ += frontend/frontend_salamander.o
|
||||
OBJ += frontend/frontend_driver.o
|
||||
OBJ += frontend/drivers/platform_wiiu.o
|
||||
OBJ += frontend/drivers/platform_null.o
|
||||
OBJ += libretro-common/encodings/encoding_utf.o
|
||||
OBJ += libretro-common/compat/compat_strcasestr.o
|
||||
OBJ += libretro-common/file/file_path.o
|
||||
OBJ += libretro-common/string/stdstring.o
|
||||
OBJ += libretro-common/lists/string_list.o
|
||||
OBJ += libretro-common/lists/dir_list.o
|
||||
OBJ += libretro-common/file/retro_dirent.o
|
||||
OBJ += libretro-common/compat/compat_strl.o
|
||||
OBJ += libretro-common/file/config_file.o
|
||||
OBJ += libretro-common/streams/file_stream.o
|
||||
OBJ += libretro-common/vfs/vfs_implementation.o
|
||||
OBJ += libretro-common/hash/rhash.o
|
||||
OBJ += file_path_str.o
|
||||
OBJ += verbosity.o
|
||||
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
|
||||
endif
|
||||
ifeq ($(strip $(DEVKITPRO)),)
|
||||
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPRO")
|
||||
endif
|
||||
|
||||
export PATH := $(PATH):$(DEVKITPPC)/bin
|
||||
|
||||
PREFIX := powerpc-eabi-
|
||||
|
||||
CC := $(PREFIX)gcc
|
||||
CXX := $(PREFIX)g++
|
||||
AS := $(PREFIX)as
|
||||
AR := $(PREFIX)ar
|
||||
OBJCOPY := $(PREFIX)objcopy
|
||||
STRIP := $(PREFIX)strip
|
||||
NM := $(PREFIX)nm
|
||||
LD := $(CXX)
|
||||
|
||||
ELF2RPL := wiiu/wut/elf2rpl/elf2rpl
|
||||
|
||||
ifneq ($(findstring Linux,$(shell uname -a)),)
|
||||
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
||||
else
|
||||
ELF2RPL := $(ELF2RPL).exe
|
||||
endif
|
||||
|
||||
|
||||
INCDIRS := -I. -Ideps/libz -Ideps/7zip -Ilibretro-common/include -Iwiiu -Iwiiu/include -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
|
||||
|
||||
#todo: remove -DWIIU and use the built-in macros instead (HW_WUP or __wiiu__).
|
||||
CFLAGS += -DWIIU -DMSB_FIRST
|
||||
CFLAGS += -DHAVE_MAIN
|
||||
CFLAGS += -DRARCH_CONSOLE -DIS_SALAMANDER
|
||||
|
||||
ifneq ($(PC_DEVELOPMENT_IP_ADDRESS),)
|
||||
CFLAGS += -DPC_DEVELOPMENT_IP_ADDRESS='"$(PC_DEVELOPMENT_IP_ADDRESS)"'
|
||||
endif
|
||||
|
||||
ifneq ($(PC_DEVELOPMENT_TCP_PORT),)
|
||||
CFLAGS += -DPC_DEVELOPMENT_TCP_PORT=$(PC_DEVELOPMENT_TCP_PORT)
|
||||
endif
|
||||
|
||||
ifeq ($(WHOLE_ARCHIVE_LINK), 1)
|
||||
WHOLE_START := -Wl,--whole-archive
|
||||
WHOLE_END := -Wl,--no-whole-archive
|
||||
endif
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||
|
||||
LDFLAGS += -Wl,--gc-sections
|
||||
|
||||
LIBS := $(WHOLE_START) -lretro_wiiu $(WHOLE_END) -lm -lfat -liosuhax
|
||||
|
||||
|
||||
RPX_OBJ = wiiu/system/stubs_rpl.o
|
||||
HBL_ELF_OBJ = wiiu/system/dynamic.o 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)
|
||||
TARGETS += $(TARGET).rpx
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_HBL_ELF), 1)
|
||||
TARGETS += $(TARGET).elf
|
||||
endif
|
||||
|
||||
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)
|
||||
%.a:
|
||||
$(AR) -rc $@ $^
|
||||
|
||||
%.depend: ;
|
||||
|
||||
|
||||
$(ELF2RPL):
|
||||
$(MAKE) -C wiiu/wut/elf2rpl/
|
||||
|
||||
$(TARGET).elf: $(OBJ) $(HBL_ELF_OBJ) libretro_wiiu.a wiiu/link_elf.ld
|
||||
$(LD) $(OBJ) $(HBL_ELF_OBJ) $(LDFLAGS) $(HBL_ELF_LDFLAGS) $(LIBDIRS) $(LIBS) -o $@
|
||||
|
||||
$(TARGET).rpx.elf: $(OBJ) $(RPX_OBJ) libretro_wiiu.a wiiu/link_elf.ld
|
||||
$(LD) $(OBJ) $(RPX_OBJ) $(LDFLAGS) $(RPX_LDFLAGS) $(LIBDIRS) $(LIBS) -o $@
|
||||
|
||||
$(TARGET).rpx: $(TARGET).rpx.elf $(ELF2RPL)
|
||||
-$(ELF2RPL) $(TARGET).rpx.elf $@
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ) $(RPX_OBJ) $(HBL_ELF_OBJ) $(TARGET).elf $(TARGET).rpx.elf $(TARGET).rpx
|
||||
rm -f $(OBJ:.o=.depend) $(RPX_OBJ:.o=.depend) $(HBL_ELF_OBJ:.o=.depend)
|
||||
|
||||
.PHONY: clean all
|
||||
.PRECIOUS: %.depend
|
||||
|
||||
-include $(OBJ:.o=.depend) $(RPX_OBJ:.o=.depend) $(HBL_ELF_OBJ:.o=.depend)
|
||||
|
||||
+6
-4
@@ -3,10 +3,11 @@ TARGET = retroarch.exe
|
||||
HAVE_DINPUT = 1
|
||||
HAVE_XAUDIO = 1
|
||||
HAVE_DSOUND = 1
|
||||
HAVE_WASAPI = 1
|
||||
HAVE_OPENGL = 1
|
||||
HAVE_FBO = 1
|
||||
HAVE_DYLIB = 1
|
||||
HAVE_D3D9 = 1
|
||||
HAVE_NETPLAY = 1
|
||||
HAVE_NETWORKING = 1
|
||||
HAVE_STDIN_CMD = 1
|
||||
HAVE_COMMAND = 1
|
||||
@@ -14,6 +15,7 @@ HAVE_THREADS = 1
|
||||
HAVE_RGUI = 1
|
||||
HAVE_MATERIALUI = 1
|
||||
HAVE_7ZIP = 1
|
||||
HAVE_ZLIB_DEFLATE = 1
|
||||
HAVE_PYTHON = 0
|
||||
DYNAMIC = 1
|
||||
|
||||
@@ -32,7 +34,6 @@ HAVE_CG := 1
|
||||
HAVE_LIBXML2 := 0
|
||||
HAVE_ZLIB := 1
|
||||
WANT_ZLIB := 1
|
||||
HAVE_CC_RESAMPLER := 1
|
||||
|
||||
ifeq ($(HAVE_CG), 1)
|
||||
CG_LIBS := -lcg -lcgGL
|
||||
@@ -119,10 +120,11 @@ ifeq ($(DEBUG), 1)
|
||||
else
|
||||
CFLAGS += -O3 -ffast-math
|
||||
CXXFLAGS += -O3 -ffast-math
|
||||
LDCXXFLAGS += -s
|
||||
endif
|
||||
|
||||
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
|
||||
CFLAGS += -Wall -Wno-unused-result -Wno-unused-variable -I.
|
||||
CXXFLAGS += -Wall -Wno-unused-result -Wno-unused-variable -I. -std=c++98 -D__STDC_CONSTANT_MACROS
|
||||
ifeq ($(CXX_BUILD), 1)
|
||||
CFLAGS += -std=c++98 -xc++ -D__STDC_CONSTANT_MACROS
|
||||
else
|
||||
|
||||
@@ -18,7 +18,7 @@ So we will use
|
||||
First we will clone and build the kernel:
|
||||
git clone https://github.com/mireq/linux-sunxi.git -b sunxi-3.4 --depth 1
|
||||
|
||||
Now we edit drivers/video/sunxi/disp/dev_fb.c, and uncomment the line 1074:
|
||||
Now we edit drivers/video/sunxi/disp/dev_fb.c, and uncoment the line 1074:
|
||||
// Fb_wait_for_vsync(info);
|
||||
|
||||
It is assumed you have a cross-compiler installed, so we configure and build the kernel and modules:
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
[](https://travis-ci.org/libretro/RetroArch)
|
||||
[](https://scan.coverity.com/projects/retroarch)
|
||||
|
||||
# RetroArch
|
||||
|
||||
RetroArch is the reference frontend for the libretro API.
|
||||
@@ -8,12 +5,6 @@ Popular examples of implementations for this API includes videogame system emula
|
||||
more generalized 3D programs.
|
||||
These programs are instantiated as dynamic libraries. We refer to these as "libretro cores".
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
## libretro
|
||||
|
||||
[libretro](http://libretro.com) is an API that exposes generic audio/video/input callbacks.
|
||||
@@ -23,29 +14,26 @@ A libretro core written in portable C or C++ can run seamlessly on many platform
|
||||
While RetroArch is the reference frontend for libretro, several other projects have used the libretro
|
||||
interface to include support for emulators and/or game engines. libretro is completely open and free for anyone to use.
|
||||
|
||||
[libretro API header](https://github.com/libretro/RetroArch/blob/master/libretro-common/include/libretro.h)
|
||||
[libretro API header](https://github.com/libretro/RetroArch/blob/master/libretro.h)
|
||||
|
||||
## Binaries
|
||||
|
||||
Latest Windows binaries are currently hosted on the [buildbot](http://buildbot.libretro.com/).
|
||||
Latest Windows binaries are currently hosted on the buildbot -(http://buildbot.libretro.com/).
|
||||
|
||||
## Support
|
||||
|
||||
To reach developers, either make an issue here on GitHub, make a thread on the [forum](http://www.libretro.com/forums/),
|
||||
To reach developers, either make an issue here on Github, make a thread on the [forum](http://www.libretro.com/forums/),
|
||||
or visit our IRC channel: #retroarch @ irc.freenode.org.
|
||||
|
||||
## Documentation
|
||||
|
||||
See our [Documentation Center](https://docs.libretro.com/). On Unix, man-pages are provided.
|
||||
See our [wiki](https://github.com/libretro/RetroArch/wiki). On Unix, man-pages are provided.
|
||||
More developer-centric stuff is found [here](https://github.com/libretro/libretro.github.com/wiki/Documentation-devs).
|
||||
|
||||
## Related projects
|
||||
|
||||
- Cg/HLSL shaders: [common-shaders](https://github.com/libretro/common-shaders)
|
||||
- slang shaders: [slang-shaders](https://github.com/libretro/slang-shaders)
|
||||
- GLSL shaders: [glsl-shaders](https://github.com/libretro/glsl-shaders)
|
||||
- Helper scripts to build libretro implementations: [libretro-super](https://github.com/libretro/libretro-super)
|
||||
- GitHub mirrors of projects, useful for generating diff files: [libretro-mirrors](https://github.com/libretro-mirrors/)
|
||||
|
||||
## Philosophy
|
||||
|
||||
@@ -61,20 +49,12 @@ RetroArch also emphasizes on being easy to integrate into various launcher front
|
||||
|
||||
## Platforms
|
||||
|
||||
RetroArch has been ported to the following platforms:
|
||||
RetroArch has been ported to the following platforms outside PC:
|
||||
|
||||
- DOS
|
||||
- Windows
|
||||
- Linux
|
||||
- FreeBSD
|
||||
- NetBSD
|
||||
- MacOS
|
||||
- PlayStation 3
|
||||
- PlayStation Portable
|
||||
- Original Xbox
|
||||
- PlayStation3
|
||||
- Xbox 360 (Libxenon/XeXDK)
|
||||
- Wii, GameCube (Libogc)
|
||||
- WiiU
|
||||
- Xbox 1
|
||||
- Wii, Gamecube (Libogc)
|
||||
- Nintendo 3DS
|
||||
- Raspberry Pi
|
||||
- Android
|
||||
@@ -133,8 +113,94 @@ A sample configuration file is installed to /etc/retroarch.cfg. This is the syst
|
||||
RetroArch will on startup create a config file in $XDG\_CONFIG\_HOME/retroarch/retroarch.cfg if doesn't exist.
|
||||
Users only need to configure a certain option if the desired value deviates from the value defined in config.def.h.
|
||||
|
||||
To configure joypads, use the built-in menu or the `retroarch-joyconfig` command-line tool.
|
||||
To configure joypads, use the built-in menu or the <tt>retroarch-joyconfig</tt> command-line tool.
|
||||
|
||||
## Compiling and installing
|
||||
<b>Linux</b><br/>
|
||||
- Prerequisites:
|
||||
```bash
|
||||
sudo apt-get install -y make git-core curl g++ pkg-config libglu1-mesa-dev freeglut3-dev mesa-common-dev libsdl1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev
|
||||
```
|
||||
- Compiling:
|
||||
```bash
|
||||
./configure
|
||||
make
|
||||
```
|
||||
|
||||
Instructions for compiling and installing RetroArch can be found in the [Libretro/RetroArch Documentation Center](https://docs.libretro.com/).
|
||||
<b>Mac</b><br/>
|
||||
- Prerequisites: [XCode](https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CB4QFjAA&url=https%3A%2F%2Fitunes.apple.com%2Fus%2Fapp%2Fxcode%2Fid497799835%3Fmt%3D12&ei=ZmfeVNPtIILVoASBnoCYBw&usg=AFQjCNGrxKmVtXUdvUU3MhqZhP4MHT6Gtg&sig2=RIXKsWQ79YTQBt_lK5fdKA&bvm=bv.85970519,d.cGU), [Cg](https://developer.nvidia.com/cg-toolkit-download).
|
||||
- You can open the project (**pkg/apple/RetroArch.xcodeproj**) in the Xcode IDE and build (**⌘-B**) and run (**⌘-R**) it there. Or you can use the command line...
|
||||
- Debug:
|
||||
```bash
|
||||
# Build
|
||||
xcodebuild -target RetroArch -configuration Debug -project pkg/apple/RetroArch.xcodeproj
|
||||
# Run
|
||||
open ./pkg/apple/build/Debug/RetroArch.app/
|
||||
```
|
||||
- Release:
|
||||
```bash
|
||||
# Build
|
||||
xcodebuild -target RetroArch -configuration Release -project pkg/apple/RetroArch.xcodeproj
|
||||
# Run
|
||||
open ./pkg/apple/build/Release/RetroArch.app/
|
||||
```
|
||||
|
||||
<b>PC</b><br/>
|
||||
Instructions for compiling on PC can be found in the [wiki](https://github.com/Themaister/RetroArch/wiki).
|
||||
|
||||
<b>PlayStation3</b><br/>
|
||||
|
||||
RetroArch PS3 needs to be compiled in the following order:
|
||||
|
||||
1) Compile RetroArch Salamander
|
||||
|
||||
<tt>make -f Makefile.ps3.salamander</tt>
|
||||
|
||||
2) Finally, compile RetroArch packed together with the GUI:
|
||||
|
||||
<tt>make -f Makefile.ps3</tt>
|
||||
|
||||
<b>PlayStation3 - Creating a PKG installable file</b><br />
|
||||
|
||||
You can add `pkg` as a parameter in order to make a PKG file - for example:
|
||||
|
||||
<tt>make -f Makefile.ps3 pkg</tt>
|
||||
|
||||
This creates an NPDRM package. This can be installed on debug PS3s.
|
||||
|
||||
To make a non-NPDRM package that can be installed on a jailbroken/CFW PS3 (such as PSGroove or PS3 CFWs and other 3.55 CFW derivatives), do:
|
||||
|
||||
<tt>make -f Makefile.ps3 pkg-signed</tt>
|
||||
|
||||
If you're using Kmeaw 3.55 firmware, the package needs to be signed:
|
||||
|
||||
<tt>make -f Makefile.ps3 pkg-signed-cfw</tt>
|
||||
|
||||
NOTE: A pre-existing libretro library needs to be present in the root directory in order to link RetroArch PS3. This file needs to be called <em><b>`libretro_ps3.a`</b></em>.
|
||||
|
||||
<b> Xbox 360 (XeXDK)</b><br />
|
||||
|
||||
You will need Microsoft Visual Studio 2010 installed (or higher) in order to compile RetroArch 360.
|
||||
|
||||
The solution file can be found at the following location:
|
||||
|
||||
<tt>pkg/msvc-360/RetroArch-360.sln</tt>
|
||||
|
||||
NOTE: A pre-existing libretro library needs to be present in the `pkg/msvc-360/RetroArch-360/Release` directory in order to link RetroArch 360. This file needs to be
|
||||
called <em><b>`libretro_xdk360.lib`</b></em>.
|
||||
|
||||
<b> Xbox 360 (Libxenon)</b><br />
|
||||
|
||||
You will need to have the libxenon libraries and a working Devkit Xenon toolchain installed in order to compile RetroArch 360 Libxenon.
|
||||
|
||||
<tt>make -f Makefile.xenon</tt>
|
||||
|
||||
NOTE: A pre-existing libretro library needs to be present in the root directory in order to link RetroArch 360 Libxenon. This file needs to be called <em><b>`libretro_xenon360.a`</b></em>.
|
||||
|
||||
<b> Wii</b><br >
|
||||
|
||||
You will need to have the libogc libraries and a working Devkit PPC toolchain installed in order to compile RetroArch Wii.
|
||||
|
||||
<tt>make -f Makefile.griffin platform=wii</tt>
|
||||
|
||||
NOTE: A pre-existing libretro library needs to be present in the root directory in order to link RetroArch Wii. This file needs to be called <em><b>`libretro_wii.a`</b></em>.
|
||||
+453
-856
File diff suppressed because it is too large.
Load diff
+50
-152
@@ -1,7 +1,7 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
@@ -20,29 +20,45 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <boolean.h>
|
||||
#include <audio/audio_mixer.h>
|
||||
#include <retro_common_api.h>
|
||||
#include "audio_dsp_filter.h"
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#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
|
||||
|
||||
enum audio_action
|
||||
enum rarch_audio_ctl_state
|
||||
{
|
||||
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
|
||||
RARCH_AUDIO_CTL_NONE = 0,
|
||||
RARCH_AUDIO_CTL_INIT,
|
||||
RARCH_AUDIO_CTL_DEINIT,
|
||||
RARCH_AUDIO_CTL_DESTROY,
|
||||
RARCH_AUDIO_CTL_DESTROY_DATA,
|
||||
RARCH_AUDIO_CTL_START,
|
||||
RARCH_AUDIO_CTL_STOP,
|
||||
RARCH_AUDIO_CTL_FIND_DRIVER,
|
||||
RARCH_AUDIO_CTL_SETUP_REWIND,
|
||||
/* Sets audio monitor refresh rate to new value. */
|
||||
RARCH_AUDIO_CTL_MONITOR_SET_REFRESH_RATE,
|
||||
RARCH_AUDIO_CTL_MONITOR_ADJUST_SYSTEM_RATES,
|
||||
RARCH_AUDIO_CTL_MUTE_TOGGLE,
|
||||
RARCH_AUDIO_CTL_SET_CALLBACK_ENABLE,
|
||||
RARCH_AUDIO_CTL_SET_CALLBACK_DISABLE,
|
||||
RARCH_AUDIO_CTL_SET_CALLBACK,
|
||||
RARCH_AUDIO_CTL_UNSET_CALLBACK,
|
||||
RARCH_AUDIO_CTL_CALLBACK,
|
||||
RARCH_AUDIO_CTL_HAS_CALLBACK,
|
||||
RARCH_AUDIO_CTL_ALIVE,
|
||||
RARCH_AUDIO_CTL_FRAME_IS_REVERSE,
|
||||
RARCH_AUDIO_CTL_SET_OWN_DRIVER,
|
||||
RARCH_AUDIO_CTL_UNSET_OWN_DRIVER,
|
||||
RARCH_AUDIO_CTL_OWNS_DRIVER,
|
||||
RARCH_AUDIO_CTL_SET_ACTIVE,
|
||||
RARCH_AUDIO_CTL_UNSET_ACTIVE,
|
||||
RARCH_AUDIO_CTL_IS_ACTIVE,
|
||||
RARCH_AUDIO_CTL_RESAMPLER_DEINIT,
|
||||
RARCH_AUDIO_CTL_RESAMPLER_INIT,
|
||||
RARCH_AUDIO_CTL_RESAMPLER_PROCESS
|
||||
};
|
||||
|
||||
typedef struct audio_driver
|
||||
@@ -51,8 +67,7 @@ typedef struct 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);
|
||||
void *(*init)(const char *device, unsigned rate, unsigned latency);
|
||||
|
||||
/*
|
||||
* @data : Pointer to audio data handle.
|
||||
@@ -60,110 +75,39 @@ typedef struct audio_driver
|
||||
* @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. */
|
||||
/* Stops driver. */
|
||||
bool (*stop)(void *data);
|
||||
|
||||
/* Resumes audio driver from the paused state. */
|
||||
bool (*start)(void *data, bool is_shutdown);
|
||||
/* Starts driver. */
|
||||
bool (*start)(void *data);
|
||||
|
||||
/* Is the audio driver currently running? */
|
||||
bool (*alive)(void *data);
|
||||
|
||||
/* Should we care about blocking in audio thread? Fast forwarding.
|
||||
*
|
||||
* 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.
|
||||
* */
|
||||
/* Should we care about blocking in audio thread? Fast forwarding. */
|
||||
void (*set_nonblock_state)(void *data, bool toggle);
|
||||
|
||||
/* Stops and frees driver data. */
|
||||
/* 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].
|
||||
* */
|
||||
* or int16_t samples. */
|
||||
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;
|
||||
|
||||
enum audio_mixer_state
|
||||
{
|
||||
AUDIO_STREAM_STATE_NONE = 0,
|
||||
AUDIO_STREAM_STATE_STOPPED,
|
||||
AUDIO_STREAM_STATE_PLAYING,
|
||||
AUDIO_STREAM_STATE_PLAYING_LOOPED
|
||||
};
|
||||
|
||||
typedef struct audio_mixer_stream_params
|
||||
{
|
||||
float volume;
|
||||
enum audio_mixer_type type;
|
||||
enum audio_mixer_state state;
|
||||
void *buf;
|
||||
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_set_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);
|
||||
bool audio_driver_ctl(enum rarch_audio_ctl_state state, void *data);
|
||||
|
||||
/**
|
||||
* audio_driver_find_handle:
|
||||
@@ -202,7 +146,7 @@ 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_set_volume_gain(float gain);
|
||||
|
||||
void audio_driver_dsp_filter_free(void);
|
||||
|
||||
@@ -210,56 +154,10 @@ 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);
|
||||
|
||||
bool audio_driver_mixer_add_stream(audio_mixer_stream_params_t *params);
|
||||
|
||||
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;
|
||||
@@ -268,18 +166,18 @@ 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_rwebaudio;
|
||||
extern audio_driver_t audio_null;
|
||||
|
||||
RETRO_END_DECLS
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,23 +1,17 @@
|
||||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (dsp_filter.c).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Permission is hereby granted, free of charge,
|
||||
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -29,14 +23,16 @@
|
||||
|
||||
#include <file/file_path.h>
|
||||
#include <file/config_file_userdata.h>
|
||||
#include <features/features_cpu.h>
|
||||
#include <lists/string_list.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <libretro_dspfilter.h>
|
||||
#include <file/dir_list.h>
|
||||
|
||||
#include <audio/dsp_filter.h>
|
||||
#include "audio_dsp_filter.h"
|
||||
#include "audio_filters/dspfilter.h"
|
||||
|
||||
struct retro_dsp_plug
|
||||
#include "../frontend/frontend_driver.h"
|
||||
#include "../performance.h"
|
||||
#include "../dynamic.h"
|
||||
|
||||
struct rarch_dsp_plug
|
||||
{
|
||||
#ifdef HAVE_DYLIB
|
||||
dylib_t lib;
|
||||
@@ -44,30 +40,30 @@ struct retro_dsp_plug
|
||||
const struct dspfilter_implementation *impl;
|
||||
};
|
||||
|
||||
struct retro_dsp_instance
|
||||
struct rarch_dsp_instance
|
||||
{
|
||||
const struct dspfilter_implementation *impl;
|
||||
void *impl_data;
|
||||
};
|
||||
|
||||
struct retro_dsp_filter
|
||||
struct rarch_dsp_filter
|
||||
{
|
||||
config_file_t *conf;
|
||||
|
||||
struct retro_dsp_plug *plugs;
|
||||
struct rarch_dsp_plug *plugs;
|
||||
unsigned num_plugs;
|
||||
|
||||
struct retro_dsp_instance *instances;
|
||||
struct rarch_dsp_instance *instances;
|
||||
unsigned num_instances;
|
||||
};
|
||||
|
||||
static const struct dspfilter_implementation *find_implementation(
|
||||
retro_dsp_filter_t *dsp, const char *ident)
|
||||
rarch_dsp_filter_t *dsp, const char *ident)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < dsp->num_plugs; i++)
|
||||
{
|
||||
if (string_is_equal(dsp->plugs[i].impl->short_ident, ident))
|
||||
if (!strcmp(dsp->plugs[i].impl->short_ident, ident))
|
||||
return dsp->plugs[i].impl;
|
||||
}
|
||||
|
||||
@@ -83,32 +79,28 @@ static const struct dspfilter_config dspfilter_config = {
|
||||
config_userdata_free,
|
||||
};
|
||||
|
||||
static bool create_filter_graph(retro_dsp_filter_t *dsp, float sample_rate)
|
||||
static bool create_filter_graph(rarch_dsp_filter_t *dsp, float sample_rate)
|
||||
{
|
||||
unsigned i;
|
||||
struct retro_dsp_instance *instances = NULL;
|
||||
unsigned filters = 0;
|
||||
unsigned i, filters = 0;
|
||||
|
||||
if (!config_get_uint(dsp->conf, "filters", &filters))
|
||||
return false;
|
||||
|
||||
instances = (struct retro_dsp_instance*)calloc(filters, sizeof(*instances));
|
||||
if (!instances)
|
||||
dsp->instances = (struct rarch_dsp_instance*)
|
||||
calloc(filters, sizeof(*dsp->instances));
|
||||
if (!dsp->instances)
|
||||
return false;
|
||||
|
||||
dsp->instances = instances;
|
||||
dsp->num_instances = filters;
|
||||
|
||||
for (i = 0; i < filters; i++)
|
||||
{
|
||||
struct config_file_userdata userdata;
|
||||
struct dspfilter_info info;
|
||||
char key[64];
|
||||
char name[64];
|
||||
char key[64] = {0};
|
||||
char name[64] = {0};
|
||||
|
||||
key[0] = name[0] = '\0';
|
||||
|
||||
info.input_rate = sample_rate;
|
||||
info.input_rate = sample_rate;
|
||||
|
||||
snprintf(key, sizeof(key), "filter%u", i);
|
||||
|
||||
@@ -124,8 +116,7 @@ static bool create_filter_graph(retro_dsp_filter_t *dsp, float sample_rate)
|
||||
userdata.prefix[0] = key;
|
||||
userdata.prefix[1] = dsp->instances[i].impl->short_ident;
|
||||
|
||||
dsp->instances[i].impl_data = dsp->instances[i].impl->init(&info,
|
||||
&dspfilter_config, &userdata);
|
||||
dsp->instances[i].impl_data = dsp->instances[i].impl->init(&info, &dspfilter_config, &userdata);
|
||||
if (!dsp->instances[i].impl_data)
|
||||
return false;
|
||||
}
|
||||
@@ -152,17 +143,18 @@ static const dspfilter_get_implementation_t dsp_plugs_builtin[] = {
|
||||
chorus_dspfilter_get_implementation,
|
||||
};
|
||||
|
||||
static bool append_plugs(retro_dsp_filter_t *dsp, struct string_list *list)
|
||||
static bool append_plugs(rarch_dsp_filter_t *dsp, struct string_list *list)
|
||||
{
|
||||
unsigned i;
|
||||
dspfilter_simd_mask_t mask = (dspfilter_simd_mask_t)cpu_features_get();
|
||||
struct retro_dsp_plug *plugs = (struct retro_dsp_plug*)
|
||||
calloc(ARRAY_SIZE(dsp_plugs_builtin), sizeof(*plugs));
|
||||
dspfilter_simd_mask_t mask = retro_get_cpu_features();
|
||||
|
||||
if (!plugs)
|
||||
(void)list;
|
||||
|
||||
dsp->plugs = (struct rarch_dsp_plug*)
|
||||
calloc(ARRAY_SIZE(dsp_plugs_builtin), sizeof(*dsp->plugs));
|
||||
if (!dsp->plugs)
|
||||
return false;
|
||||
|
||||
dsp->plugs = plugs;
|
||||
dsp->num_plugs = ARRAY_SIZE(dsp_plugs_builtin);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(dsp_plugs_builtin); i++)
|
||||
@@ -175,19 +167,17 @@ static bool append_plugs(retro_dsp_filter_t *dsp, struct string_list *list)
|
||||
return true;
|
||||
}
|
||||
#elif defined(HAVE_DYLIB)
|
||||
static bool append_plugs(retro_dsp_filter_t *dsp, struct string_list *list)
|
||||
static bool append_plugs(rarch_dsp_filter_t *dsp, struct string_list *list)
|
||||
{
|
||||
unsigned i;
|
||||
dspfilter_simd_mask_t mask = cpu_features_get();
|
||||
unsigned list_size = list ? list->size : 0;
|
||||
dspfilter_simd_mask_t mask = retro_get_cpu_features();
|
||||
|
||||
for (i = 0; i < list_size; i++)
|
||||
for (i = 0; i < list->size; i++)
|
||||
{
|
||||
dspfilter_get_implementation_t cb;
|
||||
const struct dspfilter_implementation *impl = NULL;
|
||||
struct retro_dsp_plug *new_plugs = NULL;
|
||||
dylib_t lib =
|
||||
dylib_load(list->elems[i].data);
|
||||
struct rarch_dsp_plug *new_plugs = NULL;
|
||||
dylib_t lib = dylib_load(list->elems[i].data);
|
||||
dspfilter_get_implementation_t cb;
|
||||
|
||||
if (!lib)
|
||||
continue;
|
||||
@@ -212,7 +202,7 @@ static bool append_plugs(retro_dsp_filter_t *dsp, struct string_list *list)
|
||||
continue;
|
||||
}
|
||||
|
||||
new_plugs = (struct retro_dsp_plug*)
|
||||
new_plugs = (struct rarch_dsp_plug*)
|
||||
realloc(dsp->plugs, sizeof(*dsp->plugs) * (dsp->num_plugs + 1));
|
||||
if (!new_plugs)
|
||||
{
|
||||
@@ -221,7 +211,7 @@ static bool append_plugs(retro_dsp_filter_t *dsp, struct string_list *list)
|
||||
}
|
||||
|
||||
/* Found plug. */
|
||||
|
||||
|
||||
dsp->plugs = new_plugs;
|
||||
dsp->plugs[dsp->num_plugs].lib = lib;
|
||||
dsp->plugs[dsp->num_plugs].impl = impl;
|
||||
@@ -232,26 +222,34 @@ static bool append_plugs(retro_dsp_filter_t *dsp, struct string_list *list)
|
||||
}
|
||||
#endif
|
||||
|
||||
retro_dsp_filter_t *retro_dsp_filter_new(
|
||||
const char *filter_config,
|
||||
void *string_data,
|
||||
float sample_rate)
|
||||
rarch_dsp_filter_t *rarch_dsp_filter_new(
|
||||
const char *filter_config, float sample_rate)
|
||||
{
|
||||
config_file_t *conf = NULL;
|
||||
#if !defined(HAVE_FILTERS_BUILTIN) && defined(HAVE_DYLIB)
|
||||
char basedir[PATH_MAX_LENGTH];
|
||||
char ext_name[PATH_MAX_LENGTH];
|
||||
#endif
|
||||
struct string_list *plugs = NULL;
|
||||
retro_dsp_filter_t *dsp = (retro_dsp_filter_t*)calloc(1, sizeof(*dsp));
|
||||
rarch_dsp_filter_t *dsp = NULL;
|
||||
|
||||
dsp = (rarch_dsp_filter_t*)calloc(1, sizeof(*dsp));
|
||||
if (!dsp)
|
||||
return NULL;
|
||||
|
||||
conf = config_file_new(filter_config);
|
||||
if (!conf) /* Did not find config. */
|
||||
dsp->conf = config_file_new(filter_config);
|
||||
if (!dsp->conf) /* Did not find config. */
|
||||
goto error;
|
||||
|
||||
dsp->conf = conf;
|
||||
#if !defined(HAVE_FILTERS_BUILTIN) && defined(HAVE_DYLIB)
|
||||
fill_pathname_basedir(basedir, filter_config, sizeof(basedir));
|
||||
|
||||
if (string_data)
|
||||
plugs = (struct string_list*)string_data;
|
||||
if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
|
||||
goto error;
|
||||
|
||||
plugs = dir_list_new(basedir, ext_name, false, false);
|
||||
if (!plugs)
|
||||
goto error;
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_DYLIB) || defined(HAVE_FILTERS_BUILTIN)
|
||||
if (!append_plugs(dsp, plugs))
|
||||
@@ -270,11 +268,11 @@ retro_dsp_filter_t *retro_dsp_filter_new(
|
||||
error:
|
||||
if (plugs)
|
||||
string_list_free(plugs);
|
||||
retro_dsp_filter_free(dsp);
|
||||
rarch_dsp_filter_free(dsp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void retro_dsp_filter_free(retro_dsp_filter_t *dsp)
|
||||
void rarch_dsp_filter_free(rarch_dsp_filter_t *dsp)
|
||||
{
|
||||
unsigned i;
|
||||
if (!dsp)
|
||||
@@ -302,8 +300,8 @@ void retro_dsp_filter_free(retro_dsp_filter_t *dsp)
|
||||
free(dsp);
|
||||
}
|
||||
|
||||
void retro_dsp_filter_process(retro_dsp_filter_t *dsp,
|
||||
struct retro_dsp_data *data)
|
||||
void rarch_dsp_filter_process(rarch_dsp_filter_t *dsp,
|
||||
struct rarch_dsp_data *data)
|
||||
{
|
||||
unsigned i;
|
||||
struct dspfilter_output output = {0};
|
||||
@@ -1,5 +1,6 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2014-2016 - Ali Bouhlel
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
@@ -13,36 +14,36 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TEX_SHADER_H
|
||||
#define TEX_SHADER_H
|
||||
#include <wiiu/gx2.h>
|
||||
#ifndef __AUDIO_DSP_FILTER_H__
|
||||
#define __AUDIO_DSP_FILTER_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct __attribute__((aligned(GX2_VERTEX_BUFFER_ALIGNMENT)))
|
||||
{
|
||||
GX2VertexShader vs;
|
||||
GX2PixelShader ps;
|
||||
GX2SamplerVar sampler;
|
||||
struct
|
||||
{
|
||||
GX2AttribVar position;
|
||||
GX2AttribVar tex_coord;
|
||||
} attributes;
|
||||
struct
|
||||
{
|
||||
GX2AttribStream position;
|
||||
GX2AttribStream tex_coord;
|
||||
} attribute_stream;
|
||||
GX2FetchShader fs;
|
||||
}tex_shader_t;
|
||||
typedef struct rarch_dsp_filter rarch_dsp_filter_t;
|
||||
|
||||
extern tex_shader_t tex_shader;
|
||||
rarch_dsp_filter_t *rarch_dsp_filter_new(const char *filter_config,
|
||||
float sample_rate);
|
||||
|
||||
void rarch_dsp_filter_free(rarch_dsp_filter_t *dsp);
|
||||
|
||||
struct rarch_dsp_data
|
||||
{
|
||||
float *input;
|
||||
unsigned input_frames;
|
||||
|
||||
/* Set by rarch_dsp_filter_process(). */
|
||||
float *output;
|
||||
unsigned output_frames;
|
||||
};
|
||||
|
||||
void rarch_dsp_filter_process(rarch_dsp_filter_t *dsp,
|
||||
struct rarch_dsp_data *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // TEX_SHADER_H
|
||||
#endif
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -3,8 +3,6 @@ extra_flags :=
|
||||
use_neon := 0
|
||||
build = release
|
||||
DYLIB := so
|
||||
PREFIX := /usr
|
||||
INSTALLDIR := $(PREFIX)/lib/retroarch/filters/audio
|
||||
|
||||
ifeq ($(platform),)
|
||||
platform = unix
|
||||
@@ -59,7 +57,7 @@ endif
|
||||
|
||||
CC := $(compiler) -Wall
|
||||
CXX := $(subst CC,++,$(compiler)) -std=gnu++0x -Wall
|
||||
flags := $(CPPFLAGS) $(CFLAGS) -fPIC $(extra_flags) -I../../include
|
||||
flags := $(CFLAGS) -fPIC $(extra_flags) -I../../libretro-common/include
|
||||
asflags := $(ASFLAGS) -fPIC $(extra_flags)
|
||||
objects :=
|
||||
|
||||
@@ -91,10 +89,3 @@ clean:
|
||||
|
||||
strip:
|
||||
strip -s *.$(DYLIB)
|
||||
|
||||
install:
|
||||
mkdir -p $(DESTDIR)$(INSTALLDIR)
|
||||
cp -t $(DESTDIR)$(INSTALLDIR) $(targets) *.dsp
|
||||
|
||||
test-install:
|
||||
DESTDIR=/tmp/build $(MAKE) install
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,31 +1,24 @@
|
||||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (chorus.c).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Permission is hereby granted, free of charge,
|
||||
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "dspfilter.h"
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <libretro_dspfilter.h>
|
||||
|
||||
#define CHORUS_MAX_DELAY 4096
|
||||
#define CHORUS_DELAY_MASK (CHORUS_MAX_DELAY - 1)
|
||||
@@ -46,20 +39,18 @@ struct chorus_data
|
||||
|
||||
static void chorus_free(void *data)
|
||||
{
|
||||
if (data)
|
||||
free(data);
|
||||
free(data);
|
||||
}
|
||||
|
||||
static void chorus_process(void *data, struct dspfilter_output *output,
|
||||
const struct dspfilter_input *input)
|
||||
{
|
||||
unsigned i;
|
||||
float *out = NULL;
|
||||
struct chorus_data *ch = (struct chorus_data*)data;
|
||||
|
||||
output->samples = input->samples;
|
||||
output->frames = input->frames;
|
||||
out = output->samples;
|
||||
output->samples = input->samples;
|
||||
output->frames = input->frames;
|
||||
float *out = output->samples;
|
||||
|
||||
for (i = 0; i < input->frames; i++, out += 2)
|
||||
{
|
||||
@@ -74,27 +65,24 @@ static void chorus_process(void *data, struct dspfilter_output *output,
|
||||
ch->lfo_ptr = 0;
|
||||
|
||||
delay_int = (unsigned)delay;
|
||||
|
||||
if (delay_int >= CHORUS_MAX_DELAY - 1)
|
||||
delay_int = CHORUS_MAX_DELAY - 2;
|
||||
|
||||
delay_frac = delay - delay_int;
|
||||
|
||||
ch->old[0][ch->old_ptr] = in[0];
|
||||
ch->old[1][ch->old_ptr] = in[1];
|
||||
|
||||
l_a = ch->old[0][(ch->old_ptr - delay_int - 0) & CHORUS_DELAY_MASK];
|
||||
l_b = ch->old[0][(ch->old_ptr - delay_int - 1) & CHORUS_DELAY_MASK];
|
||||
r_a = ch->old[1][(ch->old_ptr - delay_int - 0) & CHORUS_DELAY_MASK];
|
||||
r_b = ch->old[1][(ch->old_ptr - delay_int - 1) & CHORUS_DELAY_MASK];
|
||||
l_a = ch->old[0][(ch->old_ptr - delay_int - 0) & CHORUS_DELAY_MASK];
|
||||
l_b = ch->old[0][(ch->old_ptr - delay_int - 1) & CHORUS_DELAY_MASK];
|
||||
r_a = ch->old[1][(ch->old_ptr - delay_int - 0) & CHORUS_DELAY_MASK];
|
||||
r_b = ch->old[1][(ch->old_ptr - delay_int - 1) & CHORUS_DELAY_MASK];
|
||||
|
||||
/* Lerp introduces aliasing of the chorus component,
|
||||
* but doing full polyphase here is probably overkill. */
|
||||
chorus_l = l_a * (1.0f - delay_frac) + l_b * delay_frac;
|
||||
chorus_r = r_a * (1.0f - delay_frac) + r_b * delay_frac;
|
||||
/* Lerp introduces aliasing of the chorus component, but doing full polyphase here is probably overkill. */
|
||||
chorus_l = l_a * (1.0f - delay_frac) + l_b * delay_frac;
|
||||
chorus_r = r_a * (1.0f - delay_frac) + r_b * delay_frac;
|
||||
|
||||
out[0] = ch->mix_dry * in[0] + ch->mix_wet * chorus_l;
|
||||
out[1] = ch->mix_dry * in[1] + ch->mix_wet * chorus_r;
|
||||
out[0] = ch->mix_dry * in[0] + ch->mix_wet * chorus_l;
|
||||
out[1] = ch->mix_dry * in[1] + ch->mix_wet * chorus_r;
|
||||
|
||||
ch->old_ptr = (ch->old_ptr + 1) & CHORUS_DELAY_MASK;
|
||||
}
|
||||
@@ -150,8 +138,7 @@ static const struct dspfilter_implementation chorus_plug = {
|
||||
#define dspfilter_get_implementation chorus_dspfilter_get_implementation
|
||||
#endif
|
||||
|
||||
const struct dspfilter_implementation *
|
||||
dspfilter_get_implementation(dspfilter_simd_mask_t mask)
|
||||
const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_simd_mask_t mask)
|
||||
{
|
||||
(void)mask;
|
||||
return &chorus_plug;
|
||||
@@ -1,31 +1,26 @@
|
||||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2015 - Daniel De Matteis
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this libretro API header (libretro_dspfilter.h).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Permission is hereby granted, free of charge,
|
||||
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef LIBRETRO_DSPFILTER_API_H__
|
||||
#define LIBRETRO_DSPFILTER_API_H__
|
||||
#ifndef DSPFILTER_API_H__
|
||||
#define DSPFILTER_API_H__
|
||||
|
||||
#include <retro_common_api.h>
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define DSPFILTER_SIMD_SSE (1 << 0)
|
||||
#define DSPFILTER_SIMD_SSE2 (1 << 1)
|
||||
@@ -44,7 +39,7 @@ RETRO_BEGIN_DECLS
|
||||
#define DSPFILTER_SIMD_PS (1 << 14)
|
||||
|
||||
/* A bit-mask of all supported SIMD instruction sets.
|
||||
* Allows an implementation to pick different
|
||||
* Allows an implementation to pick different
|
||||
* dspfilter_implementation structs.
|
||||
*/
|
||||
typedef unsigned dspfilter_simd_mask_t;
|
||||
@@ -53,7 +48,7 @@ typedef unsigned dspfilter_simd_mask_t;
|
||||
typedef const struct dspfilter_implementation *(
|
||||
*dspfilter_get_implementation_t)(dspfilter_simd_mask_t mask);
|
||||
|
||||
/* The same SIMD mask argument is forwarded to create() callback
|
||||
/* The same SIMD mask argument is forwarded to create() callback
|
||||
* as well to avoid having to keep lots of state around. */
|
||||
const struct dspfilter_implementation *dspfilter_get_implementation(
|
||||
dspfilter_simd_mask_t mask);
|
||||
@@ -68,53 +63,53 @@ struct dspfilter_info
|
||||
|
||||
struct dspfilter_output
|
||||
{
|
||||
/* The DSP plugin has to provide the buffering for the
|
||||
/* The DSP plugin has to provide the buffering for the
|
||||
* output samples or reuse the input buffer directly.
|
||||
*
|
||||
* The samples are laid out in interleaving order: LRLRLRLR
|
||||
* The range of the samples are [-1.0, 1.0].
|
||||
* The range of the samples are [-1.0, 1.0].
|
||||
*
|
||||
* It is not necessary to manually clip values. */
|
||||
float *samples;
|
||||
|
||||
/* Frames which the DSP plugin outputted for the current process.
|
||||
*
|
||||
* One frame is here defined as a combined sample of
|
||||
* left and right channels.
|
||||
* One frame is here defined as a combined sample of
|
||||
* left and right channels.
|
||||
*
|
||||
* (I.e. 44.1kHz, 16bit stereo will have
|
||||
* (I.e. 44.1kHz, 16bit stereo will have
|
||||
* 88.2k samples/sec and 44.1k frames/sec.)
|
||||
*/
|
||||
unsigned frames;
|
||||
};
|
||||
|
||||
struct dspfilter_input
|
||||
struct dspfilter_input
|
||||
{
|
||||
/* Input data for the DSP. The samples are interleaved in order: LRLRLRLR
|
||||
*
|
||||
* It is valid for a DSP plug to use this buffer for output as long as
|
||||
* It is valid for a DSP plug to use this buffer for output as long as
|
||||
* the output size is less or equal to the input.
|
||||
*
|
||||
* This is useful for filters which can output one sample for each
|
||||
* This is useful for filters which can output one sample for each
|
||||
* input sample and do not need to maintain its own buffers.
|
||||
*
|
||||
* Block based filters must provide their own buffering scheme.
|
||||
*
|
||||
* The input size is not bound, but it can be safely assumed that it
|
||||
* The input size is not bound, but it can be safely assumed that it
|
||||
* will not exceed ~100ms worth of audio at a time. */
|
||||
float *samples;
|
||||
|
||||
/* Number of frames for input data.
|
||||
* One frame is here defined as a combined sample of
|
||||
* left and right channels.
|
||||
* One frame is here defined as a combined sample of
|
||||
* left and right channels.
|
||||
*
|
||||
* (I.e. 44.1kHz, 16bit stereo will have
|
||||
* (I.e. 44.1kHz, 16bit stereo will have
|
||||
* 88.2k samples/sec and 44.1k frames/sec.)
|
||||
*/
|
||||
unsigned frames;
|
||||
};
|
||||
|
||||
/* Returns true if config key was found. Otherwise,
|
||||
/* Returns true if config key was found. Otherwise,
|
||||
* returns false, and sets value to default value.
|
||||
*/
|
||||
typedef int (*dspfilter_config_get_float_t)(void *userdata,
|
||||
@@ -124,7 +119,7 @@ typedef int (*dspfilter_config_get_int_t)(void *userdata,
|
||||
const char *key, int *value, int default_value);
|
||||
|
||||
/* Allocates an array with values. free() with dspfilter_config_free_t. */
|
||||
typedef int (*dspfilter_config_get_float_array_t)(void *userdata,
|
||||
typedef int (*dspfilter_config_get_float_array_t)(void *userdata,
|
||||
const char *key, float **values, unsigned *out_num_values,
|
||||
const float *default_values, unsigned num_default_values);
|
||||
|
||||
@@ -135,7 +130,7 @@ typedef int (*dspfilter_config_get_int_array_t)(void *userdata,
|
||||
typedef int (*dspfilter_config_get_string_t)(void *userdata,
|
||||
const char *key, char **output, const char *default_output);
|
||||
|
||||
/* Calls free() in host runtime. Sometimes needed on Windows.
|
||||
/* Calls free() in host runtime. Sometimes needed on Windows.
|
||||
* free() on NULL is fine. */
|
||||
typedef void (*dspfilter_config_free_t)(void *ptr);
|
||||
|
||||
@@ -148,9 +143,9 @@ struct dspfilter_config
|
||||
dspfilter_config_get_int_array_t get_int_array;
|
||||
|
||||
dspfilter_config_get_string_t get_string;
|
||||
/* Avoid problems where DSP plug and host are
|
||||
/* Avoid problems where DSP plug and host are
|
||||
* linked against different C runtimes. */
|
||||
dspfilter_config_free_t free;
|
||||
dspfilter_config_free_t free;
|
||||
};
|
||||
|
||||
/* Creates a handle of the plugin. Returns NULL if failed. */
|
||||
@@ -160,7 +155,7 @@ typedef void *(*dspfilter_init_t)(const struct dspfilter_info *info,
|
||||
/* Frees the handle. */
|
||||
typedef void (*dspfilter_free_t)(void *data);
|
||||
|
||||
/* Processes input data.
|
||||
/* Processes input data.
|
||||
* The plugin is allowed to return variable sizes for output data. */
|
||||
typedef void (*dspfilter_process_t)(void *data,
|
||||
struct dspfilter_output *output, const struct dspfilter_input *input);
|
||||
@@ -179,9 +174,11 @@ struct dspfilter_implementation
|
||||
|
||||
/* Computer-friendly short version of ident.
|
||||
* Lower case, no spaces and special characters, etc. */
|
||||
const char *short_ident;
|
||||
const char *short_ident;
|
||||
};
|
||||
|
||||
RETRO_END_DECLS
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,29 +1,23 @@
|
||||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (echo.c).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Permission is hereby granted, free of charge,
|
||||
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <libretro_dspfilter.h>
|
||||
|
||||
#include "dspfilter.h"
|
||||
|
||||
struct echo_channel
|
||||
{
|
||||
@@ -55,13 +49,12 @@ static void echo_process(void *data, struct dspfilter_output *output,
|
||||
const struct dspfilter_input *input)
|
||||
{
|
||||
unsigned i, c;
|
||||
float *out = NULL;
|
||||
struct echo_data *echo = (struct echo_data*)data;
|
||||
|
||||
output->samples = input->samples;
|
||||
output->frames = input->frames;
|
||||
output->samples = input->samples;
|
||||
output->frames = input->frames;
|
||||
|
||||
out = output->samples;
|
||||
float *out = output->samples;
|
||||
|
||||
for (i = 0; i < input->frames; i++, out += 2)
|
||||
{
|
||||
@@ -101,35 +94,25 @@ static void *echo_init(const struct dspfilter_info *info,
|
||||
const struct dspfilter_config *config, void *userdata)
|
||||
{
|
||||
unsigned i, channels;
|
||||
struct echo_channel *echo_channels = NULL;
|
||||
float *delay = NULL;
|
||||
float *feedback = NULL;
|
||||
unsigned num_delay = 0;
|
||||
unsigned num_feedback = 0;
|
||||
float *delay = NULL, *feedback = NULL;
|
||||
unsigned num_delay = 0, num_feedback = 0;
|
||||
|
||||
static const float default_delay[] = { 200.0f };
|
||||
static const float default_delay[] = { 200.0f };
|
||||
static const float default_feedback[] = { 0.5f };
|
||||
struct echo_data *echo = (struct echo_data*)
|
||||
calloc(1, sizeof(*echo));
|
||||
|
||||
struct echo_data *echo = (struct echo_data*)calloc(1, sizeof(*echo));
|
||||
if (!echo)
|
||||
return NULL;
|
||||
|
||||
config->get_float_array(userdata, "delay", &delay,
|
||||
&num_delay, default_delay, 1);
|
||||
config->get_float_array(userdata, "feedback", &feedback,
|
||||
&num_feedback, default_feedback, 1);
|
||||
config->get_float_array(userdata, "delay", &delay, &num_delay, default_delay, 1);
|
||||
config->get_float_array(userdata, "feedback", &feedback, &num_feedback, default_feedback, 1);
|
||||
config->get_float(userdata, "amp", &echo->amp, 0.2f);
|
||||
|
||||
channels = num_feedback = num_delay = MIN(num_delay, num_feedback);
|
||||
|
||||
echo_channels = (struct echo_channel*)calloc(channels,
|
||||
sizeof(*echo_channels));
|
||||
|
||||
if (!echo_channels)
|
||||
echo->channels = (struct echo_channel*)calloc(channels, sizeof(*echo->channels));
|
||||
if (!echo->channels)
|
||||
goto error;
|
||||
|
||||
echo->channels = echo_channels;
|
||||
echo->num_channels = channels;
|
||||
|
||||
for (i = 0; i < channels; i++)
|
||||
@@ -1,25 +1,17 @@
|
||||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (eq.c).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Permission is hereby granted, free of charge,
|
||||
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -27,7 +19,8 @@
|
||||
#include <retro_inline.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <filters.h>
|
||||
#include <libretro_dspfilter.h>
|
||||
|
||||
#include "dspfilter.h"
|
||||
|
||||
#include "fft/fft.c"
|
||||
|
||||
@@ -149,8 +142,7 @@ static void generate_response(fft_complex_t *response,
|
||||
gains++;
|
||||
}
|
||||
|
||||
/* Create a response by linear interpolation between
|
||||
* known frequency sample points. */
|
||||
// Create a response by linear interpolation between known frequency sample points.
|
||||
for (i = 0; i <= samples; i++)
|
||||
{
|
||||
float gain;
|
||||
@@ -212,11 +204,9 @@ static void create_filter(struct eq_data *eq, unsigned size_log2,
|
||||
/* Get equivalent time-domain filter. */
|
||||
fft_process_inverse(fft, time_filter, eq->filter, 1);
|
||||
|
||||
/* ifftshift() to create the correct linear phase filter.
|
||||
* The filter response was designed with zero phase, which
|
||||
* won't work unless we compensate
|
||||
* for the repeating property of the FFT here
|
||||
* by flipping left and right blocks. */
|
||||
// ifftshift() to create the correct linear phase filter.
|
||||
// The filter response was designed with zero phase, which won't work unless we compensate
|
||||
// for the repeating property of the FFT here by flipping left and right blocks.
|
||||
for (i = 0; i < half_block_size; i++)
|
||||
{
|
||||
float tmp = time_filter[i + half_block_size];
|
||||
@@ -1,30 +1,22 @@
|
||||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (fft.c).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Permission is hereby granted, free of charge,
|
||||
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "fft.h"
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "fft.h"
|
||||
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
struct fft
|
||||
@@ -98,12 +90,12 @@ static void resolve_float(float *out, const fft_complex_t *in, unsigned samples,
|
||||
|
||||
fft_t *fft_new(unsigned block_size_log2)
|
||||
{
|
||||
unsigned size;
|
||||
fft_t *fft = (fft_t*)calloc(1, sizeof(*fft));
|
||||
if (!fft)
|
||||
return NULL;
|
||||
|
||||
size = 1 << block_size_log2;
|
||||
unsigned size = 1 << block_size_log2;
|
||||
|
||||
fft->interleave_buffer = (fft_complex_t*)calloc(size, sizeof(*fft->interleave_buffer));
|
||||
fft->bitinverse_buffer = (unsigned*)calloc(size, sizeof(*fft->bitinverse_buffer));
|
||||
fft->phase_lut = (fft_complex_t*)calloc(2 * size + 1, sizeof(*fft->phase_lut));
|
||||
@@ -136,8 +128,8 @@ void fft_free(fft_t *fft)
|
||||
static void butterfly(fft_complex_t *a, fft_complex_t *b, fft_complex_t mod)
|
||||
{
|
||||
mod = fft_complex_mul(mod, *b);
|
||||
*b = fft_complex_sub(*a, mod);
|
||||
*a = fft_complex_add(*a, mod);
|
||||
*b = fft_complex_sub(*a, mod);
|
||||
*a = fft_complex_add(*a, mod);
|
||||
}
|
||||
|
||||
static void butterflies(fft_complex_t *butterfly_buf,
|
||||
@@ -149,8 +141,7 @@ static void butterflies(fft_complex_t *butterfly_buf,
|
||||
{
|
||||
int phase_step = (int)samples * phase_dir / (int)step_size;
|
||||
for (j = i; j < i + step_size; j++)
|
||||
butterfly(&butterfly_buf[j], &butterfly_buf[j + step_size],
|
||||
phase_lut[phase_step * (int)(j - i)]);
|
||||
butterfly(&butterfly_buf[j], &butterfly_buf[j + step_size], phase_lut[phase_step * (int)(j - i)]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,9 +180,7 @@ void fft_process_inverse(fft_t *fft,
|
||||
{
|
||||
unsigned step_size;
|
||||
unsigned samples = fft->size;
|
||||
|
||||
interleave_complex(fft->bitinverse_buffer, fft->interleave_buffer,
|
||||
in, samples, 1);
|
||||
interleave_complex(fft->bitinverse_buffer, fft->interleave_buffer, in, samples, 1);
|
||||
|
||||
for (step_size = 1; step_size < samples; step_size <<= 1)
|
||||
{
|
||||
@@ -0,0 +1,90 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef RARCH_FFT_H__
|
||||
#define RARCH_FFT_H__
|
||||
|
||||
#include <retro_inline.h>
|
||||
|
||||
typedef struct fft fft_t;
|
||||
|
||||
// C99 <complex.h> would be nice.
|
||||
typedef struct
|
||||
{
|
||||
float real;
|
||||
float imag;
|
||||
} fft_complex_t;
|
||||
|
||||
static INLINE fft_complex_t fft_complex_mul(fft_complex_t a,
|
||||
fft_complex_t b)
|
||||
{
|
||||
fft_complex_t out = {
|
||||
a.real * b.real - a.imag * b.imag,
|
||||
a.imag * b.real + a.real * b.imag,
|
||||
};
|
||||
|
||||
return out;
|
||||
|
||||
}
|
||||
|
||||
static INLINE fft_complex_t fft_complex_add(fft_complex_t a,
|
||||
fft_complex_t b)
|
||||
{
|
||||
fft_complex_t out = {
|
||||
a.real + b.real,
|
||||
a.imag + b.imag,
|
||||
};
|
||||
|
||||
return out;
|
||||
|
||||
}
|
||||
|
||||
static INLINE fft_complex_t fft_complex_sub(fft_complex_t a,
|
||||
fft_complex_t b)
|
||||
{
|
||||
fft_complex_t out = {
|
||||
a.real - b.real,
|
||||
a.imag - b.imag,
|
||||
};
|
||||
|
||||
return out;
|
||||
|
||||
}
|
||||
|
||||
static INLINE fft_complex_t fft_complex_conj(fft_complex_t a)
|
||||
{
|
||||
fft_complex_t out = {
|
||||
a.real, -a.imag,
|
||||
};
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
fft_t *fft_new(unsigned block_size_log2);
|
||||
|
||||
void fft_free(fft_t *fft);
|
||||
|
||||
void fft_process_forward_complex(fft_t *fft,
|
||||
fft_complex_t *out, const fft_complex_t *in, unsigned step);
|
||||
|
||||
void fft_process_forward(fft_t *fft,
|
||||
fft_complex_t *out, const float *in, unsigned step);
|
||||
|
||||
void fft_process_inverse(fft_t *fft,
|
||||
float *out, const fft_complex_t *in, unsigned step);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,32 +1,25 @@
|
||||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2014 - Brad Miller
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (iir.c).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Permission is hereby granted, free of charge,
|
||||
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "dspfilter.h"
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <libretro_dspfilter.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#define sqr(a) ((a) * (a))
|
||||
|
||||
@@ -67,29 +60,34 @@ static void iir_free(void *data)
|
||||
static void iir_process(void *data, struct dspfilter_output *output,
|
||||
const struct dspfilter_input *input)
|
||||
{
|
||||
float b0, b1, b2, a0, a1, a2;
|
||||
float xn1_l, xn2_l, yn1_l, yn2_l;
|
||||
float xn1_r, xn2_r, yn1_r, yn2_r;
|
||||
unsigned i;
|
||||
float *out;
|
||||
struct iir_data *iir = (struct iir_data*)data;
|
||||
float *out = output->samples;
|
||||
|
||||
float b0 = iir->b0;
|
||||
float b1 = iir->b1;
|
||||
float b2 = iir->b2;
|
||||
float a0 = iir->a0;
|
||||
float a1 = iir->a1;
|
||||
float a2 = iir->a2;
|
||||
output->samples = input->samples;
|
||||
output->frames = input->frames;
|
||||
|
||||
float xn1_l = iir->l.xn1;
|
||||
float xn2_l = iir->l.xn2;
|
||||
float yn1_l = iir->l.yn1;
|
||||
float yn2_l = iir->l.yn2;
|
||||
out = output->samples;
|
||||
|
||||
float xn1_r = iir->r.xn1;
|
||||
float xn2_r = iir->r.xn2;
|
||||
float yn1_r = iir->r.yn1;
|
||||
float yn2_r = iir->r.yn2;
|
||||
b0 = iir->b0;
|
||||
b1 = iir->b1;
|
||||
b2 = iir->b2;
|
||||
a0 = iir->a0;
|
||||
a1 = iir->a1;
|
||||
a2 = iir->a2;
|
||||
|
||||
output->samples = input->samples;
|
||||
output->frames = input->frames;
|
||||
xn1_l = iir->l.xn1;
|
||||
xn2_l = iir->l.xn2;
|
||||
yn1_l = iir->l.yn1;
|
||||
yn2_l = iir->l.yn2;
|
||||
|
||||
xn1_r = iir->r.xn1;
|
||||
xn2_r = iir->r.xn2;
|
||||
yn1_r = iir->r.yn1;
|
||||
yn2_r = iir->r.yn2;
|
||||
|
||||
for (i = 0; i < input->frames; i++, out += 2)
|
||||
{
|
||||
@@ -99,18 +97,18 @@ static void iir_process(void *data, struct dspfilter_output *output,
|
||||
float l = (b0 * in_l + b1 * xn1_l + b2 * xn2_l - a1 * yn1_l - a2 * yn2_l) / a0;
|
||||
float r = (b0 * in_r + b1 * xn1_r + b2 * xn2_r - a1 * yn1_r - a2 * yn2_r) / a0;
|
||||
|
||||
xn2_l = xn1_l;
|
||||
xn1_l = in_l;
|
||||
yn2_l = yn1_l;
|
||||
yn1_l = l;
|
||||
xn2_l = xn1_l;
|
||||
xn1_l = in_l;
|
||||
yn2_l = yn1_l;
|
||||
yn1_l = l;
|
||||
|
||||
xn2_r = xn1_r;
|
||||
xn1_r = in_r;
|
||||
yn2_r = yn1_r;
|
||||
yn1_r = r;
|
||||
xn2_r = xn1_r;
|
||||
xn1_r = in_r;
|
||||
yn2_r = yn1_r;
|
||||
yn1_r = r;
|
||||
|
||||
out[0] = l;
|
||||
out[1] = r;
|
||||
out[0] = l;
|
||||
out[1] = r;
|
||||
}
|
||||
|
||||
iir->l.xn1 = xn1_l;
|
||||
@@ -124,7 +122,7 @@ static void iir_process(void *data, struct dspfilter_output *output,
|
||||
iir->r.yn2 = yn2_r;
|
||||
}
|
||||
|
||||
#define CHECK(x) if (string_is_equal(str, #x)) return x
|
||||
#define CHECK(x) if (!strcmp(str, #x)) return x
|
||||
static enum IIRFilter str_to_type(const char *str)
|
||||
{
|
||||
CHECK(LPF);
|
||||
@@ -139,8 +137,7 @@ static enum IIRFilter str_to_type(const char *str)
|
||||
CHECK(LSH);
|
||||
CHECK(HSH);
|
||||
CHECK(RIAA_CD);
|
||||
|
||||
return LPF; /* Fallback. */
|
||||
return LPF; // Fallback.
|
||||
}
|
||||
|
||||
static void make_poly_from_roots(
|
||||
@@ -212,7 +209,7 @@ static void iir_filter_init(struct iir_data *iir,
|
||||
a1 = -2.0 * cs;
|
||||
a2 = 1.0 - a1pha;
|
||||
break;
|
||||
case NOTCH:
|
||||
case NOTCH:
|
||||
b0 = 1.0;
|
||||
b1 = -2.0 * cs;
|
||||
b2 = 1.0;
|
||||
@@ -253,7 +250,7 @@ static void iir_filter_init(struct iir_data *iir,
|
||||
make_poly_from_roots(zeros, 2, b);
|
||||
make_poly_from_roots(poles, 2, a);
|
||||
}
|
||||
|
||||
|
||||
b0 = b[0];
|
||||
b1 = b[1];
|
||||
b2 = b[2];
|
||||
@@ -272,15 +269,15 @@ static void iir_filter_init(struct iir_data *iir,
|
||||
b0 *= g; b1 *= g; b2 *= g;
|
||||
break;
|
||||
}
|
||||
case PEQ:
|
||||
case PEQ:
|
||||
b0 = 1.0 + a1pha * A;
|
||||
b1 = -2.0 * cs;
|
||||
b2 = 1.0 - a1pha * A;
|
||||
a0 = 1.0 + a1pha / A;
|
||||
a1 = -2.0 * cs;
|
||||
a2 = 1.0 - a1pha / A;
|
||||
break;
|
||||
case BBOOST:
|
||||
break;
|
||||
case BBOOST:
|
||||
beta = sqrt((A * A + 1) / 1.0 - (pow((A - 1), 2)));
|
||||
b0 = A * ((A + 1) - (A - 1) * cs + beta * sn);
|
||||
b1 = 2 * A * ((A - 1) - (A + 1) * cs);
|
||||
@@ -329,9 +326,9 @@ static void *iir_init(const struct dspfilter_info *info,
|
||||
const struct dspfilter_config *config, void *userdata)
|
||||
{
|
||||
float freq, qual, gain;
|
||||
enum IIRFilter filter = LPF;
|
||||
char *type = NULL;
|
||||
struct iir_data *iir = (struct iir_data*)calloc(1, sizeof(*iir));
|
||||
enum IIRFilter filter;
|
||||
char *type = NULL;
|
||||
struct iir_data *iir = (struct iir_data*)calloc(1, sizeof(*iir));
|
||||
if (!iir)
|
||||
return NULL;
|
||||
|
||||
File renamed without changes.
@@ -0,0 +1,96 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "dspfilter.h"
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
struct panning_data
|
||||
{
|
||||
float left[2];
|
||||
float right[2];
|
||||
};
|
||||
|
||||
static void panning_free(void *data)
|
||||
{
|
||||
free(data);
|
||||
}
|
||||
|
||||
static void panning_process(void *data, struct dspfilter_output *output,
|
||||
const struct dspfilter_input *input)
|
||||
{
|
||||
unsigned i;
|
||||
float *out;
|
||||
struct panning_data *pan = (struct panning_data*)data;
|
||||
|
||||
output->samples = input->samples;
|
||||
output->frames = input->frames;
|
||||
out = output->samples;
|
||||
|
||||
for (i = 0; i < input->frames; i++, out += 2)
|
||||
{
|
||||
float left = out[0];
|
||||
float right = out[1];
|
||||
out[0] = left * pan->left[0] + right * pan->left[1];
|
||||
out[1] = left * pan->right[0] + right * pan->right[1];
|
||||
}
|
||||
}
|
||||
|
||||
static void *panning_init(const struct dspfilter_info *info,
|
||||
const struct dspfilter_config *config, void *userdata)
|
||||
{
|
||||
static const float default_left[] = { 1.0f, 0.0f };
|
||||
static const float default_right[] = { 0.0f, 1.0f };
|
||||
float *left = NULL, *right = NULL;
|
||||
unsigned num_left = 0, num_right = 0;
|
||||
struct panning_data *pan = (struct panning_data*)calloc(1, sizeof(*pan));
|
||||
if (!pan)
|
||||
return NULL;
|
||||
|
||||
config->get_float_array(userdata, "left_mix", &left, &num_left, default_left, 2);
|
||||
config->get_float_array(userdata, "right_mix", &right, &num_right, default_right, 2);
|
||||
|
||||
memcpy(pan->left, (num_left == 2) ? left : default_left, sizeof(pan->left));
|
||||
memcpy(pan->right, (num_right == 2) ? right : default_right, sizeof(pan->right));
|
||||
|
||||
config->free(left);
|
||||
config->free(right);
|
||||
|
||||
return pan;
|
||||
}
|
||||
|
||||
static const struct dspfilter_implementation panning = {
|
||||
panning_init,
|
||||
panning_process,
|
||||
panning_free,
|
||||
|
||||
DSPFILTER_API_VERSION,
|
||||
"Panning",
|
||||
"panning",
|
||||
};
|
||||
|
||||
#ifdef HAVE_FILTERS_BUILTIN
|
||||
#define dspfilter_get_implementation panning_dspfilter_get_implementation
|
||||
#endif
|
||||
|
||||
const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_simd_mask_t mask)
|
||||
{
|
||||
(void)mask;
|
||||
return &panning;
|
||||
}
|
||||
|
||||
#undef dspfilter_get_implementation
|
||||
|
||||
@@ -1,31 +1,25 @@
|
||||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2014 - Brad Miller
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (phaser.c).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Permission is hereby granted, free of charge,
|
||||
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "dspfilter.h"
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <libretro_dspfilter.h>
|
||||
|
||||
#define phaserlfoshape 4.0
|
||||
#define phaserlfoskipsamples 20
|
||||
@@ -57,12 +51,12 @@ static void phaser_process(void *data, struct dspfilter_output *output,
|
||||
{
|
||||
unsigned i, c;
|
||||
int s;
|
||||
float m[2], tmp[2];
|
||||
float m[2], tmp[2], *out;
|
||||
struct phaser_data *ph = (struct phaser_data*)data;
|
||||
float *out = output->samples;
|
||||
|
||||
output->samples = input->samples;
|
||||
output->frames = input->frames;
|
||||
output->samples = input->samples;
|
||||
output->frames = input->frames;
|
||||
out = output->samples;
|
||||
|
||||
for (i = 0; i < input->frames; i++, out += 2)
|
||||
{
|
||||
@@ -1,31 +1,24 @@
|
||||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2014 - Brad Miller
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (reverb.c).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Permission is hereby granted, free of charge,
|
||||
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "dspfilter.h"
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <retro_inline.h>
|
||||
#include <libretro_dspfilter.h>
|
||||
|
||||
struct comb
|
||||
{
|
||||
@@ -48,8 +41,8 @@ struct allpass
|
||||
|
||||
static INLINE float comb_process(struct comb *c, float input)
|
||||
{
|
||||
float output = c->buffer[c->bufidx];
|
||||
c->filterstore = (output * c->damp2) + (c->filterstore * c->damp1);
|
||||
float output = c->buffer[c->bufidx];
|
||||
c->filterstore = (output * c->damp2) + (c->filterstore * c->damp1);
|
||||
|
||||
c->buffer[c->bufidx] = input + (c->filterstore * c->feedback);
|
||||
|
||||
@@ -63,8 +56,8 @@ static INLINE float comb_process(struct comb *c, float input)
|
||||
|
||||
static INLINE float allpass_process(struct allpass *a, float input)
|
||||
{
|
||||
float bufout = a->buffer[a->bufidx];
|
||||
float output = -input + bufout;
|
||||
float bufout = a->buffer[a->bufidx];
|
||||
float output = -input + bufout;
|
||||
a->buffer[a->bufidx] = input + bufout * a->feedback;
|
||||
|
||||
a->bufidx++;
|
||||
@@ -136,9 +129,8 @@ static float revmodel_process(struct revmodel *rev, float in)
|
||||
{
|
||||
int i;
|
||||
float mono_out = 0.0f;
|
||||
float mono_in = in;
|
||||
float input = mono_in * rev->gain;
|
||||
|
||||
float mono_in = in;
|
||||
float input = mono_in * rev->gain;
|
||||
for (i = 0; i < numcombs; i++)
|
||||
mono_out += comb_process(&rev->combL[i], input);
|
||||
|
||||
@@ -212,19 +204,19 @@ static void revmodel_setmode(struct revmodel *rev, float value)
|
||||
|
||||
static void revmodel_init(struct revmodel *rev)
|
||||
{
|
||||
rev->combL[0].buffer = rev->bufcombL1; rev->combL[0].bufsize = combtuningL1;
|
||||
rev->combL[1].buffer = rev->bufcombL2; rev->combL[1].bufsize = combtuningL2;
|
||||
rev->combL[2].buffer = rev->bufcombL3; rev->combL[2].bufsize = combtuningL3;
|
||||
rev->combL[3].buffer = rev->bufcombL4; rev->combL[3].bufsize = combtuningL4;
|
||||
rev->combL[4].buffer = rev->bufcombL5; rev->combL[4].bufsize = combtuningL5;
|
||||
rev->combL[5].buffer = rev->bufcombL6; rev->combL[5].bufsize = combtuningL6;
|
||||
rev->combL[6].buffer = rev->bufcombL7; rev->combL[6].bufsize = combtuningL7;
|
||||
rev->combL[7].buffer = rev->bufcombL8; rev->combL[7].bufsize = combtuningL8;
|
||||
rev->combL[0].buffer = rev->bufcombL1; rev->combL[0].bufsize = combtuningL1;
|
||||
rev->combL[1].buffer = rev->bufcombL2; rev->combL[1].bufsize = combtuningL2;
|
||||
rev->combL[2].buffer = rev->bufcombL3; rev->combL[2].bufsize = combtuningL3;
|
||||
rev->combL[3].buffer = rev->bufcombL4; rev->combL[3].bufsize = combtuningL4;
|
||||
rev->combL[4].buffer = rev->bufcombL5; rev->combL[4].bufsize = combtuningL5;
|
||||
rev->combL[5].buffer = rev->bufcombL6; rev->combL[5].bufsize = combtuningL6;
|
||||
rev->combL[6].buffer = rev->bufcombL7; rev->combL[6].bufsize = combtuningL7;
|
||||
rev->combL[7].buffer = rev->bufcombL8; rev->combL[7].bufsize = combtuningL8;
|
||||
|
||||
rev->allpassL[0].buffer = rev->bufallpassL1; rev->allpassL[0].bufsize = allpasstuningL1;
|
||||
rev->allpassL[1].buffer = rev->bufallpassL2; rev->allpassL[1].bufsize = allpasstuningL2;
|
||||
rev->allpassL[2].buffer = rev->bufallpassL3; rev->allpassL[2].bufsize = allpasstuningL3;
|
||||
rev->allpassL[3].buffer = rev->bufallpassL4; rev->allpassL[3].bufsize = allpasstuningL4;
|
||||
rev->allpassL[0].buffer = rev->bufallpassL1; rev->allpassL[0].bufsize = allpasstuningL1;
|
||||
rev->allpassL[1].buffer = rev->bufallpassL2; rev->allpassL[1].bufsize = allpasstuningL2;
|
||||
rev->allpassL[2].buffer = rev->bufallpassL3; rev->allpassL[2].bufsize = allpasstuningL3;
|
||||
rev->allpassL[3].buffer = rev->bufallpassL4; rev->allpassL[3].bufsize = allpasstuningL4;
|
||||
|
||||
rev->allpassL[0].feedback = 0.5f;
|
||||
rev->allpassL[1].feedback = 0.5f;
|
||||
@@ -1,31 +1,25 @@
|
||||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2014 - Brad Miller
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (wahwah.c).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Permission is hereby granted, free of charge,
|
||||
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "dspfilter.h"
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <libretro_dspfilter.h>
|
||||
|
||||
#define WAHWAH_LFO_SKIP_SAMPLES 30
|
||||
|
||||
@@ -54,11 +48,12 @@ static void wahwah_process(void *data, struct dspfilter_output *output,
|
||||
const struct dspfilter_input *input)
|
||||
{
|
||||
unsigned i;
|
||||
float *out;
|
||||
struct wahwah_data *wah = (struct wahwah_data*)data;
|
||||
float *out = output->samples;
|
||||
|
||||
output->samples = input->samples;
|
||||
output->frames = input->frames;
|
||||
out = output->samples;
|
||||
|
||||
for (i = 0; i < input->frames; i++, out += 2)
|
||||
{
|
||||
@@ -118,7 +113,7 @@ static void *wahwah_init(const struct dspfilter_info *info,
|
||||
config->get_float(userdata, "resonance", &wah->res, 2.5f);
|
||||
|
||||
wah->lfoskip = wah->freq * 2.0 * M_PI / info->input_rate;
|
||||
wah->phase = wah->startphase * M_PI / 180.0;
|
||||
wah->phase = wah->startphase * M_PI / 180.0;
|
||||
|
||||
return wah;
|
||||
}
|
||||
@@ -137,8 +132,7 @@ static const struct dspfilter_implementation wahwah_plug = {
|
||||
#define dspfilter_get_implementation wahwah_dspfilter_get_implementation
|
||||
#endif
|
||||
|
||||
const struct dspfilter_implementation *
|
||||
dspfilter_get_implementation(dspfilter_simd_mask_t mask)
|
||||
const struct dspfilter_implementation *dspfilter_get_implementation(dspfilter_simd_mask_t mask)
|
||||
{
|
||||
(void)mask;
|
||||
return &wahwah_plug;
|
||||
+73
-40
@@ -1,38 +1,35 @@
|
||||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (audio_resampler.c).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* 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.
|
||||
*
|
||||
* Permission is hereby granted, free of charge,
|
||||
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <string/stdstring.h>
|
||||
#include <features/features_cpu.h>
|
||||
#include <file/config_file_userdata.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include <audio/audio_resampler.h>
|
||||
|
||||
static const retro_resampler_t *resampler_drivers[] = {
|
||||
&sinc_resampler,
|
||||
#ifdef HAVE_CC_RESAMPLER
|
||||
&CC_resampler,
|
||||
#include "audio_resampler_driver.h"
|
||||
#ifdef RARCH_INTERNAL
|
||||
#include "../performance.h"
|
||||
#endif
|
||||
#ifndef DONT_HAVE_STRING_LIST
|
||||
#include "../string_list_special.h"
|
||||
#endif
|
||||
|
||||
static const rarch_resampler_t *resampler_drivers[] = {
|
||||
&sinc_resampler,
|
||||
&CC_resampler,
|
||||
&nearest_resampler,
|
||||
&null_resampler,
|
||||
NULL,
|
||||
@@ -90,12 +87,26 @@ const void *audio_resampler_driver_find_handle(int idx)
|
||||
**/
|
||||
const char *audio_resampler_driver_find_ident(int idx)
|
||||
{
|
||||
const retro_resampler_t *drv = resampler_drivers[idx];
|
||||
const rarch_resampler_t *drv = resampler_drivers[idx];
|
||||
if (!drv)
|
||||
return NULL;
|
||||
return drv->ident;
|
||||
}
|
||||
|
||||
#ifndef DONT_HAVE_STRING_LIST
|
||||
/**
|
||||
* config_get_audio_resampler_driver_options:
|
||||
*
|
||||
* Get an enumerated list of all resampler driver names, separated by '|'.
|
||||
*
|
||||
* Returns: string listing of all resampler driver names, separated by '|'.
|
||||
**/
|
||||
const char* config_get_audio_resampler_driver_options(void)
|
||||
{
|
||||
return char_list_new_special(STRING_LIST_AUDIO_RESAMPLER_DRIVERS, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* find_resampler_driver:
|
||||
* @ident : Identifier of resampler driver to find.
|
||||
@@ -105,7 +116,7 @@ const char *audio_resampler_driver_find_ident(int idx)
|
||||
* Returns: resampler driver if resampler driver was found, otherwise
|
||||
* NULL.
|
||||
**/
|
||||
static const retro_resampler_t *find_resampler_driver(const char *ident)
|
||||
static const rarch_resampler_t *find_resampler_driver(const char *ident)
|
||||
{
|
||||
int i = find_resampler_driver_index(ident);
|
||||
|
||||
@@ -115,6 +126,28 @@ static const retro_resampler_t *find_resampler_driver(const char *ident)
|
||||
return resampler_drivers[0];
|
||||
}
|
||||
|
||||
#ifndef RARCH_INTERNAL
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
retro_get_cpu_features_t perf_get_cpu_features_cb;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
static resampler_simd_mask_t resampler_get_cpu_features(void)
|
||||
{
|
||||
#ifdef RARCH_INTERNAL
|
||||
return retro_get_cpu_features();
|
||||
#else
|
||||
return perf_get_cpu_features_cb();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* resampler_append_plugs:
|
||||
* @re : Resampler handle
|
||||
@@ -126,13 +159,12 @@ static const retro_resampler_t *find_resampler_driver(const char *ident)
|
||||
* Returns: true (1) if successfully initialized, otherwise false (0).
|
||||
**/
|
||||
static bool resampler_append_plugs(void **re,
|
||||
const retro_resampler_t **backend,
|
||||
const rarch_resampler_t **backend,
|
||||
double bw_ratio)
|
||||
{
|
||||
resampler_simd_mask_t mask = (resampler_simd_mask_t)cpu_features_get();
|
||||
resampler_simd_mask_t mask = resampler_get_cpu_features();
|
||||
|
||||
if (*backend)
|
||||
*re = (*backend)->init(&resampler_config, bw_ratio, mask);
|
||||
*re = (*backend)->init(&resampler_config, bw_ratio, mask);
|
||||
|
||||
if (!*re)
|
||||
return false;
|
||||
@@ -140,18 +172,18 @@ static bool resampler_append_plugs(void **re,
|
||||
}
|
||||
|
||||
/**
|
||||
* retro_resampler_realloc:
|
||||
* rarch_resampler_realloc:
|
||||
* @re : Resampler handle
|
||||
* @backend : Resampler backend that is about to be set.
|
||||
* @ident : Identifier name for resampler we want.
|
||||
* @bw_ratio : Bandwidth ratio.
|
||||
*
|
||||
* Reallocates resampler. Will free previous handle before
|
||||
* Reallocates resampler. Will free previous handle before
|
||||
* allocating a new one. If ident is NULL, first resampler will be used.
|
||||
*
|
||||
* Returns: true (1) if successful, otherwise false (0).
|
||||
**/
|
||||
bool retro_resampler_realloc(void **re, const retro_resampler_t **backend,
|
||||
bool rarch_resampler_realloc(void **re, const rarch_resampler_t **backend,
|
||||
const char *ident, double bw_ratio)
|
||||
{
|
||||
if (*re && *backend)
|
||||
@@ -161,11 +193,12 @@ bool retro_resampler_realloc(void **re, const retro_resampler_t **backend,
|
||||
*backend = find_resampler_driver(ident);
|
||||
|
||||
if (!resampler_append_plugs(re, backend, bw_ratio))
|
||||
{
|
||||
if (!*re)
|
||||
*backend = NULL;
|
||||
return false;
|
||||
}
|
||||
goto error;
|
||||
|
||||
return true;
|
||||
|
||||
error:
|
||||
if (!*re)
|
||||
*backend = NULL;
|
||||
return false;
|
||||
}
|
||||
@@ -1,35 +1,33 @@
|
||||
/* Copyright (C) 2010-2017 The RetroArch team
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* The following license statement only applies to this file (audio_resampler.h).
|
||||
* ---------------------------------------------------------------------------------------
|
||||
* 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.
|
||||
*
|
||||
* Permission is hereby granted, free of charge,
|
||||
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __LIBRETRO_SDK_AUDIO_RESAMPLER_DRIVER_H
|
||||
#define __LIBRETRO_SDK_AUDIO_RESAMPLER_DRIVER_H
|
||||
|
||||
#include <stdint.h>
|
||||
#ifndef __AUDIO_RESAMPLER_DRIVER_H
|
||||
#define __AUDIO_RESAMPLER_DRIVER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <math.h>
|
||||
#include <boolean.h>
|
||||
#include <retro_common_api.h>
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#define RESAMPLER_SIMD_SSE (1 << 0)
|
||||
#define RESAMPLER_SIMD_SSE2 (1 << 1)
|
||||
@@ -48,7 +46,7 @@ RETRO_BEGIN_DECLS
|
||||
#define RESAMPLER_SIMD_PS (1 << 14)
|
||||
|
||||
/* A bit-mask of all supported SIMD instruction sets.
|
||||
* Allows an implementation to pick different
|
||||
* Allows an implementation to pick different
|
||||
* resampler_implementation structs.
|
||||
*/
|
||||
typedef unsigned resampler_simd_mask_t;
|
||||
@@ -66,7 +64,7 @@ struct resampler_data
|
||||
double ratio;
|
||||
};
|
||||
|
||||
/* Returns true if config key was found. Otherwise,
|
||||
/* Returns true if config key was found. Otherwise,
|
||||
* returns false, and sets value to default value.
|
||||
*/
|
||||
typedef int (*resampler_config_get_float_t)(void *userdata,
|
||||
@@ -76,7 +74,7 @@ typedef int (*resampler_config_get_int_t)(void *userdata,
|
||||
const char *key, int *value, int default_value);
|
||||
|
||||
/* Allocates an array with values. free() with resampler_config_free_t. */
|
||||
typedef int (*resampler_config_get_float_array_t)(void *userdata,
|
||||
typedef int (*resampler_config_get_float_array_t)(void *userdata,
|
||||
const char *key, float **values, unsigned *out_num_values,
|
||||
const float *default_values, unsigned num_default_values);
|
||||
|
||||
@@ -87,7 +85,7 @@ typedef int (*resampler_config_get_int_array_t)(void *userdata,
|
||||
typedef int (*resampler_config_get_string_t)(void *userdata,
|
||||
const char *key, char **output, const char *default_output);
|
||||
|
||||
/* Calls free() in host runtime. Sometimes needed on Windows.
|
||||
/* Calls free() in host runtime. Sometimes needed on Windows.
|
||||
* free() on NULL is fine. */
|
||||
typedef void (*resampler_config_free_t)(void *ptr);
|
||||
|
||||
@@ -100,12 +98,12 @@ struct resampler_config
|
||||
resampler_config_get_int_array_t get_int_array;
|
||||
|
||||
resampler_config_get_string_t get_string;
|
||||
/* Avoid problems where resampler plug and host are
|
||||
/* Avoid problems where resampler plug and host are
|
||||
* linked against different C runtimes. */
|
||||
resampler_config_free_t free;
|
||||
resampler_config_free_t free;
|
||||
};
|
||||
|
||||
/* Bandwidth factor. Will be < 1.0 for downsampling, > 1.0 for upsampling.
|
||||
/* Bandwidth factor. Will be < 1.0 for downsampling, > 1.0 for upsampling.
|
||||
* Corresponds to expected resampling ratio. */
|
||||
typedef void *(*resampler_init_t)(const struct resampler_config *config,
|
||||
double bandwidth_mod, resampler_simd_mask_t mask);
|
||||
@@ -116,7 +114,7 @@ typedef void (*resampler_free_t)(void *data);
|
||||
/* Processes input data. */
|
||||
typedef void (*resampler_process_t)(void *_data, struct resampler_data *data);
|
||||
|
||||
typedef struct retro_resampler
|
||||
typedef struct rarch_resampler
|
||||
{
|
||||
resampler_init_t init;
|
||||
resampler_process_t process;
|
||||
@@ -130,8 +128,8 @@ typedef struct retro_resampler
|
||||
|
||||
/* Computer-friendly short version of ident.
|
||||
* Lower case, no spaces and special characters, etc. */
|
||||
const char *short_ident;
|
||||
} retro_resampler_t;
|
||||
const char *short_ident;
|
||||
} rarch_resampler_t;
|
||||
|
||||
typedef struct audio_frame_float
|
||||
{
|
||||
@@ -139,12 +137,21 @@ typedef struct audio_frame_float
|
||||
float r;
|
||||
} audio_frame_float_t;
|
||||
|
||||
extern retro_resampler_t sinc_resampler;
|
||||
#ifdef HAVE_CC_RESAMPLER
|
||||
extern retro_resampler_t CC_resampler;
|
||||
extern rarch_resampler_t sinc_resampler;
|
||||
extern rarch_resampler_t CC_resampler;
|
||||
extern rarch_resampler_t nearest_resampler;
|
||||
extern rarch_resampler_t null_resampler;
|
||||
|
||||
#ifndef DONT_HAVE_STRING_LIST
|
||||
/**
|
||||
* config_get_audio_resampler_driver_options:
|
||||
*
|
||||
* Get an enumerated list of all resampler driver names, separated by '|'.
|
||||
*
|
||||
* Returns: string listing of all resampler driver names, separated by '|'.
|
||||
**/
|
||||
const char* config_get_audio_resampler_driver_options(void);
|
||||
#endif
|
||||
extern retro_resampler_t nearest_resampler;
|
||||
extern retro_resampler_t null_resampler;
|
||||
|
||||
/**
|
||||
* audio_resampler_driver_find_handle:
|
||||
@@ -165,20 +172,42 @@ const void *audio_resampler_driver_find_handle(int index);
|
||||
const char *audio_resampler_driver_find_ident(int index);
|
||||
|
||||
/**
|
||||
* retro_resampler_realloc:
|
||||
* rarch_resampler_realloc:
|
||||
* @re : Resampler handle
|
||||
* @backend : Resampler backend that is about to be set.
|
||||
* @ident : Identifier name for resampler we want.
|
||||
* @bw_ratio : Bandwidth ratio.
|
||||
*
|
||||
* Reallocates resampler. Will free previous handle before
|
||||
* Reallocates resampler. Will free previous handle before
|
||||
* allocating a new one. If ident is NULL, first resampler will be used.
|
||||
*
|
||||
* Returns: true (1) if successful, otherwise false (0).
|
||||
**/
|
||||
bool retro_resampler_realloc(void **re, const retro_resampler_t **backend,
|
||||
bool rarch_resampler_realloc(void **re, const rarch_resampler_t **backend,
|
||||
const char *ident, double bw_ratio);
|
||||
|
||||
RETRO_END_DECLS
|
||||
/* Convenience macros.
|
||||
* freep makes sure to set handles to NULL to avoid double-free
|
||||
* in rarch_resampler_realloc. */
|
||||
#define rarch_resampler_freep(backend, handle) do { \
|
||||
if (*(backend) && *(handle)) \
|
||||
(*backend)->free(*handle); \
|
||||
*backend = NULL; \
|
||||
*handle = NULL; \
|
||||
} while(0)
|
||||
|
||||
#define rarch_resampler_process(backend, handle, data) do { \
|
||||
(backend)->process(handle, data); \
|
||||
} while(0)
|
||||
|
||||
#ifndef RARCH_INTERNAL
|
||||
#include "libretro.h"
|
||||
extern retro_get_cpu_features_t perf_get_cpu_features_cb;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
@@ -17,10 +17,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <queues/fifo_queue.h>
|
||||
#include <queues/fifo_buffer.h>
|
||||
#include <rthreads/rthreads.h>
|
||||
|
||||
#include "audio_thread_wrapper.h"
|
||||
#include "../performance.h"
|
||||
#include "../verbosity.h"
|
||||
|
||||
typedef struct audio_thread
|
||||
@@ -35,17 +36,14 @@ typedef struct audio_thread
|
||||
bool stopped;
|
||||
bool stopped_ack;
|
||||
bool is_paused;
|
||||
bool is_shutdown;
|
||||
bool use_float;
|
||||
|
||||
int inited;
|
||||
|
||||
/* Initialization options. */
|
||||
const char *device;
|
||||
unsigned *new_rate;
|
||||
unsigned out_rate;
|
||||
unsigned latency;
|
||||
unsigned block_frames;
|
||||
} audio_thread_t;
|
||||
|
||||
static void audio_thread_loop(void *data)
|
||||
@@ -56,8 +54,7 @@ static void audio_thread_loop(void *data)
|
||||
return;
|
||||
|
||||
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);
|
||||
thr->driver_data = thr->driver->init(thr->device, thr->out_rate, thr->latency);
|
||||
slock_lock(thr->lock);
|
||||
thr->inited = thr->driver_data ? 1 : -1;
|
||||
if (thr->inited > 0 && thr->driver->use_float)
|
||||
@@ -68,7 +65,7 @@ static void audio_thread_loop(void *data)
|
||||
if (thr->inited < 0)
|
||||
return;
|
||||
|
||||
/* Wait until we start to avoid calling
|
||||
/* Wait until we start to avoid calling
|
||||
* stop immediately after initialization. */
|
||||
slock_lock(thr->lock);
|
||||
while (thr->stopped)
|
||||
@@ -84,8 +81,8 @@ static void audio_thread_loop(void *data)
|
||||
if (!thr->alive)
|
||||
{
|
||||
scond_signal(thr->cond);
|
||||
thr->stopped_ack = true;
|
||||
slock_unlock(thr->lock);
|
||||
thr->stopped_ack = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -101,11 +98,11 @@ static void audio_thread_loop(void *data)
|
||||
|
||||
scond_wait(thr->cond, thr->lock);
|
||||
}
|
||||
thr->driver->start(thr->driver_data, thr->is_shutdown);
|
||||
thr->driver->start(thr->driver_data);
|
||||
}
|
||||
|
||||
slock_unlock(thr->lock);
|
||||
audio_driver_callback();
|
||||
audio_driver_ctl(RARCH_AUDIO_CTL_CALLBACK, NULL);
|
||||
}
|
||||
|
||||
RARCH_LOG("[Audio Thread]: Tearing down driver.\n");
|
||||
@@ -188,27 +185,26 @@ static bool audio_thread_stop(void *data)
|
||||
audio_thread_t *thr = (audio_thread_t*)data;
|
||||
|
||||
if (!thr)
|
||||
return false;
|
||||
return false;
|
||||
|
||||
audio_thread_block(thr);
|
||||
thr->is_paused = true;
|
||||
|
||||
audio_driver_disable_callback();
|
||||
audio_driver_ctl(RARCH_AUDIO_CTL_SET_CALLBACK_DISABLE, NULL);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool audio_thread_start(void *data, bool is_shutdown)
|
||||
static bool audio_thread_start(void *data)
|
||||
{
|
||||
audio_thread_t *thr = (audio_thread_t*)data;
|
||||
|
||||
if (!thr)
|
||||
return false;
|
||||
|
||||
audio_driver_enable_callback();
|
||||
audio_driver_ctl(RARCH_AUDIO_CTL_SET_CALLBACK_ENABLE, NULL);
|
||||
|
||||
thr->is_paused = false;
|
||||
thr->is_shutdown = is_shutdown;
|
||||
thr->is_paused = false;
|
||||
audio_thread_unblock(thr);
|
||||
|
||||
return true;
|
||||
@@ -264,7 +260,7 @@ static const audio_driver_t audio_thread = {
|
||||
};
|
||||
|
||||
/**
|
||||
* audio_init_thread:
|
||||
* rarch_threaded_audio_init:
|
||||
* @out_driver : output driver
|
||||
* @out_data : output audio data
|
||||
* @device : audio device (optional)
|
||||
@@ -274,15 +270,14 @@ static const audio_driver_t audio_thread = {
|
||||
*
|
||||
* Starts a audio driver in a new thread.
|
||||
* Access to audio driver will be mediated through this driver.
|
||||
* This driver interfaces with audio callback and is
|
||||
* This driver interfaces with audio callback and is
|
||||
* only used in that case.
|
||||
*
|
||||
* Returns: true (1) if successful, otherwise false (0).
|
||||
**/
|
||||
bool audio_init_thread(const audio_driver_t **out_driver,
|
||||
bool rarch_threaded_audio_init(const audio_driver_t **out_driver,
|
||||
void **out_data, const char *device, unsigned audio_out_rate,
|
||||
unsigned *new_rate, unsigned latency,
|
||||
unsigned block_frames, const audio_driver_t *drv)
|
||||
unsigned latency, const audio_driver_t *drv)
|
||||
{
|
||||
audio_thread_t *thr = (audio_thread_t*)calloc(1, sizeof(*thr));
|
||||
if (!thr)
|
||||
@@ -291,9 +286,7 @@ bool audio_init_thread(const audio_driver_t **out_driver,
|
||||
thr->driver = (const audio_driver_t*)drv;
|
||||
thr->device = device;
|
||||
thr->out_rate = audio_out_rate;
|
||||
thr->new_rate = new_rate;
|
||||
thr->latency = latency;
|
||||
thr->block_frames = block_frames;
|
||||
|
||||
if (!(thr->cond = scond_new()))
|
||||
goto error;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
@@ -22,12 +22,11 @@
|
||||
#include "audio_driver.h"
|
||||
|
||||
/**
|
||||
* audio_init_thread:
|
||||
* rarch_threaded_audio_init:
|
||||
* @out_driver : output driver
|
||||
* @out_data : output audio data
|
||||
* @device : audio device (optional)
|
||||
* @out_rate : output audio rate
|
||||
* @new_rate : new output audio rate
|
||||
* @latency : audio latency
|
||||
* @driver : audio driver
|
||||
*
|
||||
@@ -37,9 +36,8 @@
|
||||
*
|
||||
* Returns: true (1) if successful, otherwise false (0).
|
||||
**/
|
||||
bool audio_init_thread(const audio_driver_t **out_driver, void **out_data,
|
||||
const char *device, unsigned out_rate, unsigned *new_rate, unsigned latency,
|
||||
unsigned block_frames,
|
||||
bool rarch_threaded_audio_init(const audio_driver_t **out_driver, void **out_data,
|
||||
const char *device, unsigned out_rate, unsigned latency,
|
||||
const audio_driver_t *driver);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,435 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2014-2016 - Ali Bouhlel ( [email protected] )
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <boolean.h>
|
||||
#include "audio_utils.h"
|
||||
|
||||
#if defined(__SSE2__)
|
||||
#include <emmintrin.h>
|
||||
#elif defined(__ALTIVEC__)
|
||||
#include <altivec.h>
|
||||
#endif
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#include "../performance.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* audio_convert_s16_to_float_C:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
* @gain : gain applied to the audio volume
|
||||
*
|
||||
* Converts audio samples from signed integer 16-bit
|
||||
* to floating point.
|
||||
*
|
||||
* C implementation callback function.
|
||||
**/
|
||||
void audio_convert_s16_to_float_C(float *out,
|
||||
const int16_t *in, size_t samples, float gain)
|
||||
{
|
||||
size_t i;
|
||||
gain = gain / 0x8000;
|
||||
for (i = 0; i < samples; i++)
|
||||
out[i] = (float)in[i] * gain;
|
||||
}
|
||||
|
||||
/**
|
||||
* audio_convert_float_to_s16_C:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
*
|
||||
* Converts audio samples from floating point
|
||||
* to signed integer 16-bit.
|
||||
*
|
||||
* C implementation callback function.
|
||||
**/
|
||||
void audio_convert_float_to_s16_C(int16_t *out,
|
||||
const float *in, size_t samples)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < samples; i++)
|
||||
{
|
||||
int32_t val = (int32_t)(in[i] * 0x8000);
|
||||
out[i] = (val > 0x7FFF) ? 0x7FFF :
|
||||
(val < -0x8000 ? -0x8000 : (int16_t)val);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__SSE2__)
|
||||
/**
|
||||
* audio_convert_s16_to_float_SSE2:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
* @gain : gain applied to the audio volume
|
||||
*
|
||||
* Converts audio samples from signed integer 16-bit
|
||||
* to floating point.
|
||||
*
|
||||
* SSE2 implementation callback function.
|
||||
**/
|
||||
void audio_convert_s16_to_float_SSE2(float *out,
|
||||
const int16_t *in, size_t samples, float gain)
|
||||
{
|
||||
size_t i;
|
||||
float fgain = gain / UINT32_C(0x80000000);
|
||||
__m128 factor = _mm_set1_ps(fgain);
|
||||
|
||||
for (i = 0; i + 8 <= samples; i += 8, in += 8, out += 8)
|
||||
{
|
||||
__m128i input = _mm_loadu_si128((const __m128i *)in);
|
||||
__m128i regs_l = _mm_unpacklo_epi16(_mm_setzero_si128(), input);
|
||||
__m128i regs_r = _mm_unpackhi_epi16(_mm_setzero_si128(), input);
|
||||
__m128 output_l = _mm_mul_ps(_mm_cvtepi32_ps(regs_l), factor);
|
||||
__m128 output_r = _mm_mul_ps(_mm_cvtepi32_ps(regs_r), factor);
|
||||
|
||||
_mm_storeu_ps(out + 0, output_l);
|
||||
_mm_storeu_ps(out + 4, output_r);
|
||||
}
|
||||
|
||||
audio_convert_s16_to_float_C(out, in, samples - i, gain);
|
||||
}
|
||||
|
||||
/**
|
||||
* audio_convert_float_to_s16_SSE2:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
*
|
||||
* Converts audio samples from floating point
|
||||
* to signed integer 16-bit.
|
||||
*
|
||||
* SSE2 implementation callback function.
|
||||
**/
|
||||
void audio_convert_float_to_s16_SSE2(int16_t *out,
|
||||
const float *in, size_t samples)
|
||||
{
|
||||
size_t i;
|
||||
__m128 factor = _mm_set1_ps((float)0x8000);
|
||||
|
||||
for (i = 0; i + 8 <= samples; i += 8, in += 8, out += 8)
|
||||
{
|
||||
__m128 input_l = _mm_loadu_ps(in + 0);
|
||||
__m128 input_r = _mm_loadu_ps(in + 4);
|
||||
__m128 res_l = _mm_mul_ps(input_l, factor);
|
||||
__m128 res_r = _mm_mul_ps(input_r, factor);
|
||||
__m128i ints_l = _mm_cvtps_epi32(res_l);
|
||||
__m128i ints_r = _mm_cvtps_epi32(res_r);
|
||||
__m128i packed = _mm_packs_epi32(ints_l, ints_r);
|
||||
|
||||
_mm_storeu_si128((__m128i *)out, packed);
|
||||
}
|
||||
|
||||
audio_convert_float_to_s16_C(out, in, samples - i);
|
||||
}
|
||||
#elif defined(__ALTIVEC__)
|
||||
/**
|
||||
* audio_convert_s16_to_float_altivec:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
* @gain : gain applied to the audio volume
|
||||
*
|
||||
* Converts audio samples from signed integer 16-bit
|
||||
* to floating point.
|
||||
*
|
||||
* AltiVec implementation callback function.
|
||||
**/
|
||||
void audio_convert_s16_to_float_altivec(float *out,
|
||||
const int16_t *in, size_t samples, float gain)
|
||||
{
|
||||
size_t samples_in = samples;
|
||||
|
||||
/* Unaligned loads/store is a bit expensive, so we
|
||||
* optimize for the good path (very likely). */
|
||||
if (((uintptr_t)out & 15) + ((uintptr_t)in & 15) == 0)
|
||||
{
|
||||
size_t i;
|
||||
const vector float gain_vec = { gain, gain , gain, gain };
|
||||
const vector float zero_vec = { 0.0f, 0.0f, 0.0f, 0.0f};
|
||||
|
||||
for (i = 0; i + 8 <= samples; i += 8, in += 8, out += 8)
|
||||
{
|
||||
vector signed short input = vec_ld(0, in);
|
||||
vector signed int hi = vec_unpackh(input);
|
||||
vector signed int lo = vec_unpackl(input);
|
||||
vector float out_hi = vec_madd(vec_ctf(hi, 15), gain_vec, zero_vec);
|
||||
vector float out_lo = vec_madd(vec_ctf(lo, 15), gain_vec, zero_vec);
|
||||
|
||||
vec_st(out_hi, 0, out);
|
||||
vec_st(out_lo, 16, out);
|
||||
}
|
||||
|
||||
samples_in -= i;
|
||||
}
|
||||
audio_convert_s16_to_float_C(out, in, samples_in, gain);
|
||||
}
|
||||
|
||||
/**
|
||||
* audio_convert_float_to_s16_altivec:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
*
|
||||
* Converts audio samples from floating point
|
||||
* to signed integer 16-bit.
|
||||
*
|
||||
* AltiVec implementation callback function.
|
||||
**/
|
||||
void audio_convert_float_to_s16_altivec(int16_t *out,
|
||||
const float *in, size_t samples)
|
||||
{
|
||||
int samples_in = samples;
|
||||
|
||||
/* Unaligned loads/store is a bit expensive,
|
||||
* so we optimize for the good path (very likely). */
|
||||
if (((uintptr_t)out & 15) + ((uintptr_t)in & 15) == 0)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i + 8 <= samples; i += 8, in += 8, out += 8)
|
||||
{
|
||||
vector float input0 = vec_ld( 0, in);
|
||||
vector float input1 = vec_ld(16, in);
|
||||
vector signed int result0 = vec_cts(input0, 15);
|
||||
vector signed int result1 = vec_cts(input1, 15);
|
||||
vec_st(vec_packs(result0, result1), 0, out);
|
||||
}
|
||||
|
||||
samples_in -= i;
|
||||
}
|
||||
audio_convert_float_to_s16_C(out, in, samples_in);
|
||||
}
|
||||
#elif defined(__ARM_NEON__) && !defined(VITA)
|
||||
/* Avoid potential hard-float/soft-float ABI issues. */
|
||||
void audio_convert_s16_float_asm(float *out, const int16_t *in,
|
||||
size_t samples, const float *gain);
|
||||
|
||||
/**
|
||||
* audio_convert_s16_to_float_neon:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
* @gain : gain applied to the audio volume
|
||||
*
|
||||
* Converts audio samples from signed integer 16-bit
|
||||
* to floating point.
|
||||
*
|
||||
* ARM NEON implementation callback function.
|
||||
**/
|
||||
static void audio_convert_s16_to_float_neon(float *out,
|
||||
const int16_t *in, size_t samples, float gain)
|
||||
{
|
||||
size_t aligned_samples = samples & ~7;
|
||||
if (aligned_samples)
|
||||
audio_convert_s16_float_asm(out, in, aligned_samples, &gain);
|
||||
|
||||
/* Could do all conversion in ASM, but keep it simple for now. */
|
||||
audio_convert_s16_to_float_C(out + aligned_samples, in + aligned_samples,
|
||||
samples - aligned_samples, gain);
|
||||
}
|
||||
|
||||
void audio_convert_float_s16_asm(int16_t *out, const float *in, size_t samples);
|
||||
|
||||
/**
|
||||
* audio_convert_float_to_s16_neon:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
*
|
||||
* Converts audio samples from floating point
|
||||
* to signed integer 16-bit.
|
||||
*
|
||||
* ARM NEON implementation callback function.
|
||||
**/
|
||||
static void audio_convert_float_to_s16_neon(int16_t *out,
|
||||
const float *in, size_t samples)
|
||||
{
|
||||
size_t aligned_samples = samples & ~7;
|
||||
if (aligned_samples)
|
||||
audio_convert_float_s16_asm(out, in, aligned_samples);
|
||||
|
||||
audio_convert_float_to_s16_C(out + aligned_samples, in + aligned_samples,
|
||||
samples - aligned_samples);
|
||||
}
|
||||
#elif defined(_MIPS_ARCH_ALLEGREX)
|
||||
|
||||
/**
|
||||
* audio_convert_s16_to_float_ALLEGREX:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
* @gain : gain applied to the audio volume
|
||||
*
|
||||
* Converts audio samples from signed integer 16-bit
|
||||
* to floating point.
|
||||
*
|
||||
* MIPS ALLEGREX implementation callback function.
|
||||
**/
|
||||
void audio_convert_s16_to_float_ALLEGREX(float *out,
|
||||
const int16_t *in, size_t samples, float gain)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
/* Make sure the buffer is 16 byte aligned, this should be the
|
||||
* default behaviour of malloc in the PSPSDK.
|
||||
* Only the output buffer can be assumed to be 16-byte aligned. */
|
||||
retro_assert(((uintptr_t)out & 0xf) == 0);
|
||||
#endif
|
||||
|
||||
size_t i;
|
||||
gain = gain / 0x8000;
|
||||
__asm__ (
|
||||
".set push \n"
|
||||
".set noreorder \n"
|
||||
"mtv %0, s200 \n"
|
||||
".set pop \n"
|
||||
::"r"(gain));
|
||||
|
||||
for (i = 0; i + 16 <= samples; i += 16)
|
||||
{
|
||||
__asm__ (
|
||||
".set push \n"
|
||||
".set noreorder \n"
|
||||
|
||||
"lv.s s100, 0(%0) \n"
|
||||
"lv.s s101, 4(%0) \n"
|
||||
"lv.s s110, 8(%0) \n"
|
||||
"lv.s s111, 12(%0) \n"
|
||||
"lv.s s120, 16(%0) \n"
|
||||
"lv.s s121, 20(%0) \n"
|
||||
"lv.s s130, 24(%0) \n"
|
||||
"lv.s s131, 28(%0) \n"
|
||||
|
||||
"vs2i.p c100, c100 \n"
|
||||
"vs2i.p c110, c110 \n"
|
||||
"vs2i.p c120, c120 \n"
|
||||
"vs2i.p c130, c130 \n"
|
||||
|
||||
"vi2f.q c100, c100, 16 \n"
|
||||
"vi2f.q c110, c110, 16 \n"
|
||||
"vi2f.q c120, c120, 16 \n"
|
||||
"vi2f.q c130, c130, 16 \n"
|
||||
|
||||
"vmscl.q e100, e100, s200 \n"
|
||||
|
||||
"sv.q c100, 0(%1) \n"
|
||||
"sv.q c110, 16(%1) \n"
|
||||
"sv.q c120, 32(%1) \n"
|
||||
"sv.q c130, 48(%1) \n"
|
||||
|
||||
".set pop \n"
|
||||
:: "r"(in + i), "r"(out + i));
|
||||
}
|
||||
|
||||
for (; i < samples; i++)
|
||||
out[i] = (float)in[i] * gain;
|
||||
}
|
||||
|
||||
/**
|
||||
* audio_convert_float_to_s16_ALLEGREX:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
*
|
||||
* Converts audio samples from floating point
|
||||
* to signed integer 16-bit.
|
||||
*
|
||||
* MIPS ALLEGREX implementation callback function.
|
||||
**/
|
||||
void audio_convert_float_to_s16_ALLEGREX(int16_t *out,
|
||||
const float *in, size_t samples)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
#ifdef DEBUG
|
||||
/* Make sure the buffers are 16 byte aligned, this should be
|
||||
* the default behaviour of malloc in the PSPSDK.
|
||||
* Both buffers are allocated by RetroArch, so can assume alignment. */
|
||||
retro_assert(((uintptr_t)in & 0xf) == 0);
|
||||
retro_assert(((uintptr_t)out & 0xf) == 0);
|
||||
#endif
|
||||
|
||||
for (i = 0; i + 8 <= samples; i += 8)
|
||||
{
|
||||
__asm__ (
|
||||
".set push \n"
|
||||
".set noreorder \n"
|
||||
|
||||
"lv.q c100, 0(%0) \n"
|
||||
"lv.q c110, 16(%0) \n"
|
||||
|
||||
"vf2in.q c100, c100, 31 \n"
|
||||
"vf2in.q c110, c110, 31 \n"
|
||||
"vi2s.q c100, c100 \n"
|
||||
"vi2s.q c102, c110 \n"
|
||||
|
||||
"sv.q c100, 0(%1) \n"
|
||||
|
||||
".set pop \n"
|
||||
:: "r"(in + i), "r"(out + i));
|
||||
}
|
||||
|
||||
for (; i < samples; i++)
|
||||
{
|
||||
int32_t val = (int32_t)(in[i] * 0x8000);
|
||||
out[i] = (val > 0x7FFF) ? 0x7FFF :
|
||||
(val < -0x8000 ? -0x8000 : (int16_t)val);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef RARCH_INTERNAL
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
retro_get_cpu_features_t perf_get_cpu_features_cb;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
static unsigned audio_convert_get_cpu_features(void)
|
||||
{
|
||||
#ifdef RARCH_INTERNAL
|
||||
return retro_get_cpu_features();
|
||||
#else
|
||||
return perf_get_cpu_features_cb();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* audio_convert_init_simd:
|
||||
*
|
||||
* Sets up function pointers for audio conversion
|
||||
* functions based on CPU features.
|
||||
**/
|
||||
void audio_convert_init_simd(void)
|
||||
{
|
||||
unsigned cpu = audio_convert_get_cpu_features();
|
||||
|
||||
(void)cpu;
|
||||
#if defined(__ARM_NEON__) && !defined(VITA)
|
||||
audio_convert_s16_to_float_arm = (cpu & RETRO_SIMD_NEON) ?
|
||||
audio_convert_s16_to_float_neon : audio_convert_s16_to_float_C;
|
||||
audio_convert_float_to_s16_arm = (cpu & RETRO_SIMD_NEON) ?
|
||||
audio_convert_float_to_s16_neon : audio_convert_float_to_s16_C;
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef AUDIO_UTILS_H
|
||||
#define AUDIO_UTILS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#if defined(__SSE2__)
|
||||
#define audio_convert_s16_to_float audio_convert_s16_to_float_SSE2
|
||||
#define audio_convert_float_to_s16 audio_convert_float_to_s16_SSE2
|
||||
|
||||
/**
|
||||
* audio_convert_s16_to_float_SSE2:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
* @gain : gain applied to the audio volume
|
||||
*
|
||||
* Converts audio samples from signed integer 16-bit
|
||||
* to floating point.
|
||||
*
|
||||
* SSE2 implementation callback function.
|
||||
**/
|
||||
void audio_convert_s16_to_float_SSE2(float *out,
|
||||
const int16_t *in, size_t samples, float gain);
|
||||
|
||||
/**
|
||||
* audio_convert_float_to_s16_SSE2:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
*
|
||||
* Converts audio samples from floating point
|
||||
* to signed integer 16-bit.
|
||||
*
|
||||
* SSE2 implementation callback function.
|
||||
**/
|
||||
void audio_convert_float_to_s16_SSE2(int16_t *out,
|
||||
const float *in, size_t samples);
|
||||
|
||||
#elif defined(__ALTIVEC__)
|
||||
#define audio_convert_s16_to_float audio_convert_s16_to_float_altivec
|
||||
#define audio_convert_float_to_s16 audio_convert_float_to_s16_altivec
|
||||
|
||||
/**
|
||||
* audio_convert_s16_to_float_altivec:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
* @gain : gain applied to the audio volume
|
||||
*
|
||||
* Converts audio samples from signed integer 16-bit
|
||||
* to floating point.
|
||||
*
|
||||
* AltiVec implementation callback function.
|
||||
**/
|
||||
void audio_convert_s16_to_float_altivec(float *out,
|
||||
const int16_t *in, size_t samples, float gain);
|
||||
|
||||
/**
|
||||
* audio_convert_float_to_s16_altivec:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
*
|
||||
* Converts audio samples from floating point
|
||||
* to signed integer 16-bit.
|
||||
*
|
||||
* AltiVec implementation callback function.
|
||||
**/
|
||||
void audio_convert_float_to_s16_altivec(int16_t *out,
|
||||
const float *in, size_t samples);
|
||||
|
||||
#elif defined(__ARM_NEON__) && !defined(VITA)
|
||||
#define audio_convert_s16_to_float audio_convert_s16_to_float_arm
|
||||
#define audio_convert_float_to_s16 audio_convert_float_to_s16_arm
|
||||
|
||||
void (*audio_convert_s16_to_float_arm)(float *out,
|
||||
const int16_t *in, size_t samples, float gain);
|
||||
|
||||
void (*audio_convert_float_to_s16_arm)(int16_t *out,
|
||||
const float *in, size_t samples);
|
||||
|
||||
#elif defined(_MIPS_ARCH_ALLEGREX)
|
||||
#define audio_convert_s16_to_float audio_convert_s16_to_float_ALLEGREX
|
||||
#define audio_convert_float_to_s16 audio_convert_float_to_s16_ALLEGREX
|
||||
|
||||
/**
|
||||
* audio_convert_s16_to_float_ALLEGREX:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
* @gain : gain applied to the audio volume
|
||||
*
|
||||
* Converts audio samples from signed integer 16-bit
|
||||
* to floating point.
|
||||
*
|
||||
* MIPS ALLEGREX implementation callback function.
|
||||
**/
|
||||
void audio_convert_s16_to_float_ALLEGREX(float *out,
|
||||
const int16_t *in, size_t samples, float gain);
|
||||
|
||||
/**
|
||||
* audio_convert_float_to_s16_ALLEGREX:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
*
|
||||
* Converts audio samples from floating point
|
||||
* to signed integer 16-bit.
|
||||
*
|
||||
* MIPS ALLEGREX implementation callback function.
|
||||
**/
|
||||
void audio_convert_float_to_s16_ALLEGREX(int16_t *out,
|
||||
const float *in, size_t samples);
|
||||
#else
|
||||
#define audio_convert_s16_to_float audio_convert_s16_to_float_C
|
||||
#define audio_convert_float_to_s16 audio_convert_float_to_s16_C
|
||||
#endif
|
||||
|
||||
/**
|
||||
* audio_convert_s16_to_float_C:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
* @gain : gain applied to the audio volume
|
||||
*
|
||||
* Converts audio samples from signed integer 16-bit
|
||||
* to floating point.
|
||||
*
|
||||
* C implementation callback function.
|
||||
**/
|
||||
void audio_convert_s16_to_float_C(float *out,
|
||||
const int16_t *in, size_t samples, float gain);
|
||||
|
||||
/**
|
||||
* audio_convert_float_to_s16_C:
|
||||
* @out : output buffer
|
||||
* @in : input buffer
|
||||
* @samples : size of samples to be converted
|
||||
*
|
||||
* Converts audio samples from floating point
|
||||
* to signed integer 16-bit.
|
||||
*
|
||||
* C implementation callback function.
|
||||
**/
|
||||
void audio_convert_float_to_s16_C(int16_t *out,
|
||||
const float *in, size_t samples);
|
||||
|
||||
/**
|
||||
* audio_convert_init_simd:
|
||||
*
|
||||
* Sets up function pointers for audio conversion
|
||||
* functions based on CPU features.
|
||||
**/
|
||||
void audio_convert_init_simd(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,98 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#if defined(__ARM_NEON__)
|
||||
|
||||
#ifndef __MACH__
|
||||
.arm
|
||||
#endif
|
||||
|
||||
.align 4
|
||||
.globl audio_convert_s16_float_asm
|
||||
.globl _audio_convert_s16_float_asm
|
||||
# audio_convert_s16_float_asm(float *out, const int16_t *in, size_t samples, const float *gain)
|
||||
audio_convert_s16_float_asm:
|
||||
_audio_convert_s16_float_asm:
|
||||
# Hacky way to get a constant of 2^-15.
|
||||
# Might be faster to just load a constant from memory.
|
||||
# It's just done once however ...
|
||||
vmov.f32 q8, #0.25
|
||||
vmul.f32 q8, q8, q8
|
||||
vmul.f32 q8, q8, q8
|
||||
vmul.f32 q8, q8, q8
|
||||
vadd.f32 q8, q8, q8
|
||||
|
||||
# Apply gain
|
||||
vld1.f32 {d6[0]}, [r3]
|
||||
vmul.f32 q8, q8, d6[0]
|
||||
|
||||
1:
|
||||
# Preload here?
|
||||
vld1.s16 {q0}, [r1]!
|
||||
|
||||
# Widen to 32-bit
|
||||
vmovl.s16 q1, d0
|
||||
vmovl.s16 q2, d1
|
||||
|
||||
# Convert to float
|
||||
vcvt.f32.s32 q1, q1
|
||||
vcvt.f32.s32 q2, q2
|
||||
|
||||
vmul.f32 q1, q1, q8
|
||||
vmul.f32 q2, q2, q8
|
||||
|
||||
vst1.f32 {q1-q2}, [r0]!
|
||||
|
||||
# Guaranteed to get samples in multiples of 8.
|
||||
subs r2, r2, #8
|
||||
bne 1b
|
||||
|
||||
bx lr
|
||||
|
||||
.align 4
|
||||
.globl audio_convert_float_s16_asm
|
||||
.globl _audio_convert_float_s16_asm
|
||||
# audio_convert_float_s16_asm(int16_t *out, const float *in, size_t samples)
|
||||
audio_convert_float_s16_asm:
|
||||
_audio_convert_float_s16_asm:
|
||||
# Hacky way to get a constant of 2^15.
|
||||
# ((2^4)^2)^2 * 0.5 = 2^15
|
||||
vmov.f32 q8, #16.0
|
||||
vmov.f32 q9, #0.5
|
||||
vmul.f32 q8, q8, q8
|
||||
vmul.f32 q8, q8, q8
|
||||
vmul.f32 q8, q8, q9
|
||||
|
||||
1:
|
||||
# Preload here?
|
||||
vld1.f32 {q0-q1}, [r1]!
|
||||
|
||||
vmul.f32 q0, q0, q8
|
||||
vmul.f32 q1, q1, q8
|
||||
|
||||
vcvt.s32.f32 q0, q0
|
||||
vcvt.s32.f32 q1, q1
|
||||
|
||||
vqmovn.s32 d4, q0
|
||||
vqmovn.s32 d5, q1
|
||||
|
||||
vst1.f32 {d4-d5}, [r0]!
|
||||
|
||||
# Guaranteed to get samples in multiples of 8.
|
||||
subs r2, r2, #8
|
||||
bne 1b
|
||||
|
||||
bx lr
|
||||
|
||||
#endif
|
||||
+78
-159
@@ -1,7 +1,6 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
@@ -16,12 +15,10 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <lists/string_list.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include <alsa/asoundlib.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
typedef struct alsa
|
||||
@@ -29,7 +26,6 @@ typedef struct alsa
|
||||
snd_pcm_t *pcm;
|
||||
size_t buffer_size;
|
||||
bool nonblock;
|
||||
unsigned int frame_bits;
|
||||
bool has_float;
|
||||
bool can_pause;
|
||||
bool is_paused;
|
||||
@@ -47,28 +43,27 @@ static bool find_float_format(snd_pcm_t *pcm, void *data)
|
||||
|
||||
if (snd_pcm_hw_params_test_format(pcm, params, SND_PCM_FORMAT_FLOAT) == 0)
|
||||
{
|
||||
RARCH_LOG("[ALSA]: Using floating point format.\n");
|
||||
RARCH_LOG("ALSA: Using floating point format.\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
RARCH_LOG("[ALSA]: Using signed 16-bit format.\n");
|
||||
RARCH_LOG("ALSA: Using signed 16-bit format.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
static void *alsa_init(const char *device, unsigned rate, unsigned latency,
|
||||
unsigned block_frames,
|
||||
unsigned *new_rate)
|
||||
static void *alsa_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
||||
snd_pcm_format_t format;
|
||||
snd_pcm_uframes_t buffer_size;
|
||||
snd_pcm_hw_params_t *params = NULL;
|
||||
snd_pcm_hw_params_t *params = NULL;
|
||||
snd_pcm_sw_params_t *sw_params = NULL;
|
||||
unsigned latency_usec = latency * 1000;
|
||||
unsigned channels = 2;
|
||||
unsigned periods = 4;
|
||||
unsigned orig_rate = rate;
|
||||
const char *alsa_dev = "default";
|
||||
alsa_t *alsa = (alsa_t*)calloc(1, sizeof(alsa_t));
|
||||
|
||||
unsigned latency_usec = latency * 1000;
|
||||
unsigned channels = 2;
|
||||
unsigned periods = 4;
|
||||
|
||||
const char *alsa_dev = "default";
|
||||
alsa_t *alsa = (alsa_t*)calloc(1, sizeof(alsa_t));
|
||||
|
||||
if (!alsa)
|
||||
return NULL;
|
||||
@@ -93,23 +88,15 @@ static void *alsa_init(const char *device, unsigned rate, unsigned latency,
|
||||
alsa->pcm, params, SND_PCM_ACCESS_RW_INTERLEAVED) < 0)
|
||||
goto error;
|
||||
|
||||
/* channels hardcoded to 2 for now */
|
||||
alsa->frame_bits = snd_pcm_format_physical_width(format) * 2;
|
||||
|
||||
if (snd_pcm_hw_params_set_format(alsa->pcm, params, format) < 0)
|
||||
goto error;
|
||||
|
||||
if (snd_pcm_hw_params_set_channels(alsa->pcm, params, channels) < 0)
|
||||
goto error;
|
||||
|
||||
/* Don't allow rate resampling when probing for the default rate (but ignore if this call fails) */
|
||||
snd_pcm_hw_params_set_rate_resample(alsa->pcm, params, 0 );
|
||||
if (snd_pcm_hw_params_set_rate_near(alsa->pcm, params, &rate, 0) < 0)
|
||||
if (snd_pcm_hw_params_set_rate(alsa->pcm, params, rate, 0) < 0)
|
||||
goto error;
|
||||
|
||||
if (rate != orig_rate)
|
||||
*new_rate = rate;
|
||||
|
||||
if (snd_pcm_hw_params_set_buffer_time_near(
|
||||
alsa->pcm, params, &latency_usec, NULL) < 0)
|
||||
goto error;
|
||||
@@ -121,22 +108,22 @@ static void *alsa_init(const char *device, unsigned rate, unsigned latency,
|
||||
if (snd_pcm_hw_params(alsa->pcm, params) < 0)
|
||||
goto error;
|
||||
|
||||
/* Shouldn't have to bother with this,
|
||||
/* Shouldn't have to bother with this,
|
||||
* but some drivers are apparently broken. */
|
||||
if (snd_pcm_hw_params_get_period_size(params, &buffer_size, NULL))
|
||||
snd_pcm_hw_params_get_period_size_min(params, &buffer_size, NULL);
|
||||
|
||||
RARCH_LOG("[ALSA]: Period size: %d frames\n", (int)buffer_size);
|
||||
RARCH_LOG("ALSA: Period size: %d frames\n", (int)buffer_size);
|
||||
|
||||
if (snd_pcm_hw_params_get_buffer_size(params, &buffer_size))
|
||||
snd_pcm_hw_params_get_buffer_size_max(params, &buffer_size);
|
||||
|
||||
RARCH_LOG("[ALSA]: Buffer size: %d frames\n", (int)buffer_size);
|
||||
RARCH_LOG("ALSA: Buffer size: %d frames\n", (int)buffer_size);
|
||||
|
||||
alsa->buffer_size = snd_pcm_frames_to_bytes(alsa->pcm, buffer_size);
|
||||
alsa->can_pause = snd_pcm_hw_params_can_pause(params);
|
||||
|
||||
RARCH_LOG("[ALSA]: Can pause: %s.\n", alsa->can_pause ? "yes" : "no");
|
||||
RARCH_LOG("ALSA: Can pause: %s.\n", alsa->can_pause ? "yes" : "no");
|
||||
|
||||
if (snd_pcm_sw_params_malloc(&sw_params) < 0)
|
||||
goto error;
|
||||
@@ -157,7 +144,7 @@ static void *alsa_init(const char *device, unsigned rate, unsigned latency,
|
||||
return alsa;
|
||||
|
||||
error:
|
||||
RARCH_ERR("[ALSA]: Failed to initialize...\n");
|
||||
RARCH_ERR("ALSA: Failed to initialize...\n");
|
||||
if (params)
|
||||
snd_pcm_hw_params_free(params);
|
||||
|
||||
@@ -167,92 +154,80 @@ error:
|
||||
if (alsa)
|
||||
{
|
||||
if (alsa->pcm)
|
||||
{
|
||||
snd_pcm_close(alsa->pcm);
|
||||
snd_config_update_free_global();
|
||||
}
|
||||
|
||||
free(alsa);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#define BYTES_TO_FRAMES(bytes, frame_bits) ((bytes) * 8 / frame_bits)
|
||||
#define FRAMES_TO_BYTES(frames, frame_bits) ((frames) * frame_bits / 8)
|
||||
|
||||
static ssize_t alsa_write(void *data, const void *buf_, size_t size_)
|
||||
{
|
||||
alsa_t *alsa = (alsa_t*)data;
|
||||
const uint8_t *buf = (const uint8_t*)buf_;
|
||||
bool eagain_retry = true;
|
||||
snd_pcm_sframes_t written = 0;
|
||||
snd_pcm_sframes_t size = BYTES_TO_FRAMES(size_, alsa->frame_bits);
|
||||
size_t frames_size = alsa->has_float ? sizeof(float) : sizeof(int16_t);
|
||||
snd_pcm_sframes_t size = snd_pcm_bytes_to_frames(alsa->pcm, size_);
|
||||
|
||||
if (alsa->nonblock)
|
||||
while (size)
|
||||
{
|
||||
while (size)
|
||||
snd_pcm_sframes_t frames;
|
||||
|
||||
if (!alsa->nonblock)
|
||||
{
|
||||
snd_pcm_sframes_t frames = snd_pcm_writei(alsa->pcm, buf, size);
|
||||
|
||||
if (frames == -EPIPE || frames == -EINTR || frames == -ESTRPIPE)
|
||||
{
|
||||
if (snd_pcm_recover(alsa->pcm, frames, 1) < 0)
|
||||
return -1;
|
||||
|
||||
break;
|
||||
}
|
||||
else if (frames == -EAGAIN)
|
||||
break;
|
||||
else if (frames < 0)
|
||||
return -1;
|
||||
|
||||
written += frames;
|
||||
buf += (frames << 1) * frames_size;
|
||||
size -= frames;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool eagain_retry = true;
|
||||
|
||||
while (size)
|
||||
{
|
||||
snd_pcm_sframes_t frames;
|
||||
int rc = snd_pcm_wait(alsa->pcm, -1);
|
||||
|
||||
if (rc == -EPIPE || rc == -ESTRPIPE || rc == -EINTR)
|
||||
{
|
||||
if (snd_pcm_recover(alsa->pcm, rc, 1) < 0)
|
||||
{
|
||||
RARCH_ERR("[ALSA]: (#1) Failed to recover from error (%s)\n",
|
||||
snd_strerror(rc));
|
||||
return -1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
frames = snd_pcm_writei(alsa->pcm, buf, size);
|
||||
|
||||
if (frames == -EPIPE || frames == -EINTR || frames == -ESTRPIPE)
|
||||
{
|
||||
if (snd_pcm_recover(alsa->pcm, frames, 1) < 0)
|
||||
return -1;
|
||||
|
||||
break;
|
||||
}
|
||||
else if (frames == -EAGAIN)
|
||||
{
|
||||
/* Definitely not supposed to happen. */
|
||||
if (eagain_retry)
|
||||
{
|
||||
eagain_retry = false;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
else if (frames < 0)
|
||||
return -1;
|
||||
|
||||
written += frames;
|
||||
buf += (frames << 1) * frames_size;
|
||||
size -= frames;
|
||||
}
|
||||
|
||||
frames = snd_pcm_writei(alsa->pcm, buf, size);
|
||||
|
||||
if (frames == -EPIPE || frames == -EINTR || frames == -ESTRPIPE)
|
||||
{
|
||||
if (snd_pcm_recover(alsa->pcm, frames, 1) < 0)
|
||||
{
|
||||
RARCH_ERR("[ALSA]: (#2) Failed to recover from error (%s)\n",
|
||||
snd_strerror(frames));
|
||||
return -1;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
else if (frames == -EAGAIN && !alsa->nonblock)
|
||||
{
|
||||
/* Definitely not supposed to happen. */
|
||||
RARCH_WARN("[ALSA]: poll() was signaled, but EAGAIN returned from write.\n"
|
||||
"Your ALSA driver might be subtly broken.\n");
|
||||
|
||||
if (eagain_retry)
|
||||
{
|
||||
eagain_retry = false;
|
||||
continue;
|
||||
}
|
||||
return written;
|
||||
}
|
||||
else if (frames == -EAGAIN) /* Expected if we're running nonblock. */
|
||||
return written;
|
||||
else if (frames < 0)
|
||||
{
|
||||
RARCH_ERR("[ALSA]: Unknown error occured (%s).\n",
|
||||
snd_strerror(frames));
|
||||
return -1;
|
||||
}
|
||||
|
||||
written += frames;
|
||||
buf += (frames << 1) *
|
||||
(alsa->has_float ? sizeof(float) : sizeof(int16_t));
|
||||
size -= frames;
|
||||
}
|
||||
|
||||
return written;
|
||||
@@ -290,7 +265,7 @@ static void alsa_set_nonblock_state(void *data, bool state)
|
||||
alsa->nonblock = state;
|
||||
}
|
||||
|
||||
static bool alsa_start(void *data, bool is_shutdown)
|
||||
static bool alsa_start(void *data)
|
||||
{
|
||||
alsa_t *alsa = (alsa_t*)data;
|
||||
|
||||
@@ -321,22 +296,26 @@ static void alsa_free(void *data)
|
||||
{
|
||||
snd_pcm_drop(alsa->pcm);
|
||||
snd_pcm_close(alsa->pcm);
|
||||
snd_config_update_free_global();
|
||||
}
|
||||
|
||||
free(alsa);
|
||||
}
|
||||
}
|
||||
|
||||
static size_t alsa_write_avail(void *data)
|
||||
{
|
||||
alsa_t *alsa = (alsa_t*)data;
|
||||
alsa_t *alsa = (alsa_t*)data;
|
||||
snd_pcm_sframes_t avail = snd_pcm_avail(alsa->pcm);
|
||||
|
||||
if (avail < 0)
|
||||
{
|
||||
#if 0
|
||||
RARCH_WARN("[ALSA]: snd_pcm_avail() failed: %s\n",
|
||||
snd_strerror(avail));
|
||||
#endif
|
||||
return alsa->buffer_size;
|
||||
}
|
||||
|
||||
return FRAMES_TO_BYTES(avail, alsa->frame_bits);
|
||||
return snd_pcm_frames_to_bytes(alsa->pcm, avail);
|
||||
}
|
||||
|
||||
static size_t alsa_buffer_size(void *data)
|
||||
@@ -345,64 +324,6 @@ static size_t alsa_buffer_size(void *data)
|
||||
return alsa->buffer_size;
|
||||
}
|
||||
|
||||
static void *alsa_device_list_new(void *data)
|
||||
{
|
||||
void **hints, **n;
|
||||
union string_list_elem_attr attr;
|
||||
struct string_list *s = string_list_new();
|
||||
|
||||
if (!s)
|
||||
return NULL;
|
||||
|
||||
attr.i = 0;
|
||||
|
||||
if (snd_device_name_hint(-1, "pcm", &hints) != 0)
|
||||
goto error;
|
||||
|
||||
n = hints;
|
||||
|
||||
while (*n != NULL)
|
||||
{
|
||||
char *name = snd_device_name_get_hint(*n, "NAME");
|
||||
char *io = snd_device_name_get_hint(*n, "IOID");
|
||||
char *desc = snd_device_name_get_hint(*n, "DESC");
|
||||
|
||||
/* description of device IOID - input / output identifcation
|
||||
* ("Input" or "Output"), NULL means both) */
|
||||
|
||||
if (!io || (string_is_equal_fast(io, "Output", 6)))
|
||||
string_list_append(s, name, attr);
|
||||
|
||||
if (name)
|
||||
free(name);
|
||||
if (io)
|
||||
free(io);
|
||||
if (desc)
|
||||
free(desc);
|
||||
|
||||
n++;
|
||||
}
|
||||
|
||||
/* free hint buffer too */
|
||||
snd_device_name_free_hint(hints);
|
||||
|
||||
return s;
|
||||
|
||||
error:
|
||||
string_list_free(s);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void alsa_device_list_free(void *data, void *array_list_data)
|
||||
{
|
||||
struct string_list *s = (struct string_list*)array_list_data;
|
||||
|
||||
if (!s)
|
||||
return;
|
||||
|
||||
string_list_free(s);
|
||||
}
|
||||
|
||||
audio_driver_t audio_alsa = {
|
||||
alsa_init,
|
||||
alsa_write,
|
||||
@@ -413,8 +334,6 @@ audio_driver_t audio_alsa = {
|
||||
alsa_free,
|
||||
alsa_use_float,
|
||||
"alsa",
|
||||
alsa_device_list_new,
|
||||
alsa_device_list_free,
|
||||
alsa_write_avail,
|
||||
alsa_buffer_size,
|
||||
};
|
||||
+17
-19
@@ -1,7 +1,7 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
@@ -17,9 +17,9 @@
|
||||
#define ALSA_PCM_NEW_HW_PARAMS_API
|
||||
#define ALSA_PCM_NEW_SW_PARAMS_API
|
||||
#include <sys/asoundlib.h>
|
||||
#include <retro_math.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../configuration.h"
|
||||
|
||||
#define MAX_FRAG_SIZE 3072
|
||||
#define DEFAULT_RATE 48000
|
||||
@@ -46,14 +46,14 @@ typedef struct alsa
|
||||
typedef long snd_pcm_sframes_t;
|
||||
|
||||
static void *alsa_qsa_init(const char *device,
|
||||
unsigned rate, unsigned latency, unsigned block_frames,
|
||||
unsigned *new_rate)
|
||||
unsigned rate, unsigned latency)
|
||||
{
|
||||
int err, card, dev, i;
|
||||
snd_pcm_channel_info_t pi;
|
||||
snd_pcm_channel_params_t params = {0};
|
||||
snd_pcm_channel_setup_t setup = {0};
|
||||
alsa_t *alsa = (alsa_t*)calloc(1, sizeof(alsa_t));
|
||||
snd_pcm_channel_info_t pi;
|
||||
snd_pcm_channel_setup_t setup = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
alsa_t *alsa = (alsa_t*)calloc(1, sizeof(alsa_t));
|
||||
if (!alsa)
|
||||
return NULL;
|
||||
|
||||
@@ -122,8 +122,8 @@ static void *alsa_qsa_init(const char *device,
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (block_frames)
|
||||
alsa->buf_size = block_frames * 4;
|
||||
if (settings->audio.block_frames)
|
||||
alsa->buf_size = settings->audio.block_frames * 4;
|
||||
else
|
||||
alsa->buf_size = next_pow2(32 * latency);
|
||||
|
||||
@@ -164,9 +164,9 @@ error:
|
||||
|
||||
static int check_pcm_status(void *data, int channel_type)
|
||||
{
|
||||
snd_pcm_channel_status_t status;
|
||||
alsa_t *alsa = (alsa_t*)data;
|
||||
int ret = EOK;
|
||||
snd_pcm_channel_status_t status;
|
||||
int ret = EOK;
|
||||
|
||||
memset(&status, 0, sizeof (status));
|
||||
status.channel = channel_type;
|
||||
@@ -231,7 +231,7 @@ static ssize_t alsa_qsa_write(void *data, const void *buf, size_t size)
|
||||
|
||||
if (avail_write)
|
||||
{
|
||||
memcpy(alsa->buffer[alsa->buffer_index] +
|
||||
memcpy(alsa->buffer[alsa->buffer_index] +
|
||||
alsa->buffer_ptr, buf, avail_write);
|
||||
|
||||
alsa->buffer_ptr += avail_write;
|
||||
@@ -291,7 +291,7 @@ static bool alsa_qsa_alive(void *data)
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool alsa_qsa_start(void *data, bool is_shutdown)
|
||||
static bool alsa_qsa_start(void *data)
|
||||
{
|
||||
alsa_t *alsa = (alsa_t*)data;
|
||||
|
||||
@@ -355,8 +355,8 @@ static void alsa_qsa_free(void *data)
|
||||
static size_t alsa_qsa_write_avail(void *data)
|
||||
{
|
||||
alsa_t *alsa = (alsa_t*)data;
|
||||
size_t avail = (alsa->buf_count -
|
||||
(int)alsa->buffered_blocks - 1) * alsa->buf_size +
|
||||
size_t avail = (alsa->buf_count -
|
||||
(int)alsa->buffered_blocks - 1) * alsa->buf_size +
|
||||
(alsa->buf_size - (int)alsa->buffer_ptr);
|
||||
return avail;
|
||||
}
|
||||
@@ -364,7 +364,7 @@ static size_t alsa_qsa_write_avail(void *data)
|
||||
static size_t alsa_qsa_buffer_size(void *data)
|
||||
{
|
||||
alsa_t *alsa = (alsa_t*)data;
|
||||
return alsa->buf_size * alsa->buf_count;
|
||||
return alsa->buf_size * alsa->buf_count;
|
||||
}
|
||||
|
||||
audio_driver_t audio_alsa = {
|
||||
@@ -377,8 +377,6 @@ audio_driver_t audio_alsa = {
|
||||
alsa_qsa_free,
|
||||
alsa_qsa_use_float,
|
||||
"alsa",
|
||||
NULL,
|
||||
NULL,
|
||||
alsa_qsa_write_avail,
|
||||
alsa_qsa_buffer_size,
|
||||
};
|
||||
+24
-87
@@ -1,7 +1,7 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2012-2015 - Michael Lelli
|
||||
*
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
@@ -16,19 +16,18 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <lists/string_list.h>
|
||||
|
||||
#include <alsa/asoundlib.h>
|
||||
|
||||
#include <rthreads/rthreads.h>
|
||||
#include <queues/fifo_queue.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <queues/fifo_buffer.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#define TRY_ALSA(x) if (x < 0) \
|
||||
goto error;
|
||||
#define TRY_ALSA(x) if (x < 0) { \
|
||||
goto error; \
|
||||
}
|
||||
|
||||
typedef struct alsa_thread
|
||||
{
|
||||
@@ -52,8 +51,8 @@ typedef struct alsa_thread
|
||||
static void alsa_worker_thread(void *data)
|
||||
{
|
||||
alsa_thread_t *alsa = (alsa_thread_t*)data;
|
||||
uint8_t *buf = (uint8_t *)calloc(1, alsa->period_size);
|
||||
|
||||
uint8_t *buf = (uint8_t *)calloc(1, alsa->period_size);
|
||||
if (!buf)
|
||||
{
|
||||
RARCH_ERR("failed to allocate audio buffer");
|
||||
@@ -77,7 +76,7 @@ static void alsa_worker_thread(void *data)
|
||||
|
||||
frames = snd_pcm_writei(alsa->pcm, buf, alsa->period_frames);
|
||||
|
||||
if (frames == -EPIPE || frames == -EINTR ||
|
||||
if (frames == -EPIPE || frames == -EINTR ||
|
||||
frames == -ESTRPIPE)
|
||||
{
|
||||
if (snd_pcm_recover(alsa->pcm, frames, 1) < 0)
|
||||
@@ -91,7 +90,7 @@ static void alsa_worker_thread(void *data)
|
||||
}
|
||||
else if (frames < 0)
|
||||
{
|
||||
RARCH_ERR("[ALSA]: Unknown error occurred (%s).\n",
|
||||
RARCH_ERR("[ALSA]: Unknown error occured (%s).\n",
|
||||
snd_strerror(frames));
|
||||
break;
|
||||
}
|
||||
@@ -131,9 +130,7 @@ static void alsa_thread_free(void *data)
|
||||
{
|
||||
if (alsa->worker_thread)
|
||||
{
|
||||
slock_lock(alsa->cond_lock);
|
||||
alsa->thread_dead = true;
|
||||
slock_unlock(alsa->cond_lock);
|
||||
sthread_join(alsa->worker_thread);
|
||||
}
|
||||
if (alsa->buffer)
|
||||
@@ -154,20 +151,21 @@ static void alsa_thread_free(void *data)
|
||||
}
|
||||
|
||||
static void *alsa_thread_init(const char *device,
|
||||
unsigned rate, unsigned latency,
|
||||
unsigned block_frames,
|
||||
unsigned *new_rate)
|
||||
unsigned rate, unsigned latency)
|
||||
{
|
||||
alsa_thread_t *alsa = (alsa_thread_t*)calloc(1, sizeof(alsa_thread_t));
|
||||
|
||||
snd_pcm_hw_params_t *params = NULL;
|
||||
snd_pcm_sw_params_t *sw_params = NULL;
|
||||
|
||||
const char *alsa_dev = device ? device : "default";
|
||||
|
||||
unsigned latency_usec = latency * 1000 / 2;
|
||||
|
||||
unsigned channels = 2;
|
||||
unsigned periods = 4;
|
||||
snd_pcm_uframes_t buffer_size;
|
||||
snd_pcm_format_t format;
|
||||
snd_pcm_hw_params_t *params = NULL;
|
||||
snd_pcm_sw_params_t *sw_params = NULL;
|
||||
const char *alsa_dev = device ? device : "default";
|
||||
unsigned latency_usec = latency * 1000 / 2;
|
||||
unsigned channels = 2;
|
||||
unsigned periods = 4;
|
||||
alsa_thread_t *alsa = (alsa_thread_t*)
|
||||
calloc(1, sizeof(alsa_thread_t));
|
||||
|
||||
if (!alsa)
|
||||
return NULL;
|
||||
@@ -192,7 +190,7 @@ static void *alsa_thread_init(const char *device,
|
||||
|
||||
TRY_ALSA(snd_pcm_hw_params(alsa->pcm, params));
|
||||
|
||||
/* Shouldn't have to bother with this,
|
||||
/* Shouldn't have to bother with this,
|
||||
* but some drivers are apparently broken. */
|
||||
if (snd_pcm_hw_params_get_period_size(params, &alsa->period_frames, NULL))
|
||||
snd_pcm_hw_params_get_period_size_min(
|
||||
@@ -284,8 +282,7 @@ static ssize_t alsa_thread_write(void *data, const void *buf, size_t size)
|
||||
else
|
||||
{
|
||||
size_t write_amt = MIN(size - written, avail);
|
||||
fifo_write(alsa->buffer,
|
||||
(const char*)buf + written, write_amt);
|
||||
fifo_write(alsa->buffer, (const char*)buf + written, write_amt);
|
||||
slock_unlock(alsa->fifo_lock);
|
||||
written += write_amt;
|
||||
}
|
||||
@@ -317,7 +314,7 @@ static void alsa_thread_set_nonblock_state(void *data, bool state)
|
||||
alsa->nonblock = state;
|
||||
}
|
||||
|
||||
static bool alsa_thread_start(void *data, bool is_shutdown)
|
||||
static bool alsa_thread_start(void *data)
|
||||
{
|
||||
alsa_thread_t *alsa = (alsa_thread_t*)data;
|
||||
|
||||
@@ -345,64 +342,6 @@ static size_t alsa_thread_buffer_size(void *data)
|
||||
return alsa->buffer_size;
|
||||
}
|
||||
|
||||
static void *alsa_device_list_new(void *data)
|
||||
{
|
||||
void **hints, **n;
|
||||
union string_list_elem_attr attr;
|
||||
struct string_list *s = string_list_new();
|
||||
|
||||
if (!s)
|
||||
return NULL;
|
||||
|
||||
attr.i = 0;
|
||||
|
||||
if (snd_device_name_hint(-1, "pcm", &hints) != 0)
|
||||
goto error;
|
||||
|
||||
n = hints;
|
||||
|
||||
while (*n != NULL)
|
||||
{
|
||||
char *name = snd_device_name_get_hint(*n, "NAME");
|
||||
char *io = snd_device_name_get_hint(*n, "IOID");
|
||||
char *desc = snd_device_name_get_hint(*n, "DESC");
|
||||
|
||||
/* description of device IOID - input / output identifcation
|
||||
* ("Input" or "Output"), NULL means both) */
|
||||
|
||||
if (!io || (string_is_equal_fast(io,"Output", 6)))
|
||||
string_list_append(s, name, attr);
|
||||
|
||||
if (name)
|
||||
free(name);
|
||||
if (io)
|
||||
free(io);
|
||||
if (desc)
|
||||
free(desc);
|
||||
|
||||
n++;
|
||||
}
|
||||
|
||||
/* free hint buffer too */
|
||||
snd_device_name_free_hint(hints);
|
||||
|
||||
return s;
|
||||
|
||||
error:
|
||||
string_list_free(s);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void alsa_device_list_free(void *data, void *array_list_data)
|
||||
{
|
||||
struct string_list *s = (struct string_list*)array_list_data;
|
||||
|
||||
if (!s)
|
||||
return;
|
||||
|
||||
string_list_free(s);
|
||||
}
|
||||
|
||||
audio_driver_t audio_alsathread = {
|
||||
alsa_thread_init,
|
||||
alsa_thread_write,
|
||||
@@ -413,8 +352,6 @@ audio_driver_t audio_alsathread = {
|
||||
alsa_thread_free,
|
||||
alsa_thread_use_float,
|
||||
"alsathread",
|
||||
alsa_device_list_new,
|
||||
alsa_device_list_free,
|
||||
alsa_thread_write_avail,
|
||||
alsa_thread_buffer_size,
|
||||
};
|
||||
+58
-66
@@ -1,7 +1,7 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2014 - Chris Moeller
|
||||
*
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
@@ -27,20 +27,29 @@
|
||||
#include <AudioUnit/AUComponent.h>
|
||||
|
||||
#include <boolean.h>
|
||||
#include <queues/fifo_queue.h>
|
||||
#include <queues/fifo_buffer.h>
|
||||
#include <rthreads/rthreads.h>
|
||||
#include <retro_endianness.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#if defined(__powerpc__) || defined(__ppc__) || defined(__POWERPC__)
|
||||
|
||||
#ifndef OSX_PPC
|
||||
#define OSX_PPC
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct coreaudio
|
||||
{
|
||||
slock_t *lock;
|
||||
scond_t *cond;
|
||||
|
||||
#if (defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__)))
|
||||
#ifdef OSX_PPC
|
||||
ComponentInstance dev;
|
||||
#else
|
||||
AudioComponentInstance dev;
|
||||
@@ -65,7 +74,7 @@ static void coreaudio_free(void *data)
|
||||
if (dev->dev_alive)
|
||||
{
|
||||
AudioOutputUnitStop(dev->dev);
|
||||
#if (defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__)))
|
||||
#ifdef OSX_PPC
|
||||
CloseComponent(dev->dev);
|
||||
#else
|
||||
AudioComponentInstanceDispose(dev->dev);
|
||||
@@ -86,19 +95,21 @@ static OSStatus audio_write_cb(void *userdata,
|
||||
const AudioTimeStamp *time_stamp, UInt32 bus_number,
|
||||
UInt32 number_frames, AudioBufferList *io_data)
|
||||
{
|
||||
void *outbuf;
|
||||
unsigned write_avail;
|
||||
void *outbuf = NULL;
|
||||
coreaudio_t *dev = (coreaudio_t*)userdata;
|
||||
|
||||
(void)time_stamp;
|
||||
(void)bus_number;
|
||||
(void)number_frames;
|
||||
|
||||
if (!io_data || io_data->mNumberBuffers != 1)
|
||||
if (!io_data)
|
||||
return noErr;
|
||||
if (io_data->mNumberBuffers != 1)
|
||||
return noErr;
|
||||
|
||||
write_avail = io_data->mBuffers[0].mDataByteSize;
|
||||
outbuf = io_data->mBuffers[0].mData;
|
||||
outbuf = io_data->mBuffers[0].mData;
|
||||
|
||||
slock_lock(dev->lock);
|
||||
|
||||
@@ -112,7 +123,7 @@ static OSStatus audio_write_cb(void *userdata,
|
||||
slock_unlock(dev->lock);
|
||||
|
||||
/* Technically possible to deadlock without. */
|
||||
scond_signal(dev->cond);
|
||||
scond_signal(dev->cond);
|
||||
return noErr;
|
||||
}
|
||||
|
||||
@@ -132,47 +143,41 @@ static void coreaudio_interrupt_listener(void *data, UInt32 interrupt_state)
|
||||
static void choose_output_device(coreaudio_t *dev, const char* device)
|
||||
{
|
||||
unsigned i;
|
||||
UInt32 deviceCount;
|
||||
AudioObjectPropertyAddress propaddr;
|
||||
AudioDeviceID *devices = NULL;
|
||||
UInt32 size = 0;
|
||||
AudioDeviceID *devices;
|
||||
AudioObjectPropertyAddress propaddr =
|
||||
{
|
||||
kAudioHardwarePropertyDevices,
|
||||
kAudioObjectPropertyScopeGlobal,
|
||||
kAudioObjectPropertyElementMaster
|
||||
};
|
||||
|
||||
propaddr.mSelector = kAudioHardwarePropertyDevices;
|
||||
#if MAC_OS_X_VERSION_10_12
|
||||
propaddr.mScope = kAudioObjectPropertyScopeOutput;
|
||||
#else
|
||||
propaddr.mScope = kAudioObjectPropertyScopeGlobal;
|
||||
#endif
|
||||
propaddr.mElement = kAudioObjectPropertyElementMaster;
|
||||
UInt32 size = 0, deviceCount;
|
||||
|
||||
if (AudioObjectGetPropertyDataSize(kAudioObjectSystemObject,
|
||||
&propaddr, 0, 0, &size) != noErr)
|
||||
return;
|
||||
|
||||
deviceCount = size / sizeof(AudioDeviceID);
|
||||
devices = (AudioDeviceID*)malloc(size);
|
||||
devices = (AudioDeviceID*)malloc(size);
|
||||
|
||||
if (!devices || AudioObjectGetPropertyData(kAudioObjectSystemObject,
|
||||
&propaddr, 0, 0, &size, devices) != noErr)
|
||||
goto done;
|
||||
|
||||
#if MAC_OS_X_VERSION_10_12
|
||||
#else
|
||||
propaddr.mScope = kAudioDevicePropertyScopeOutput;
|
||||
#endif
|
||||
propaddr.mScope = kAudioDevicePropertyScopeOutput;
|
||||
propaddr.mSelector = kAudioDevicePropertyDeviceName;
|
||||
size = 1024;
|
||||
|
||||
for (i = 0; i < deviceCount; i ++)
|
||||
{
|
||||
char device_name[1024];
|
||||
device_name[0] = 0;
|
||||
size = 1024;
|
||||
|
||||
if (AudioObjectGetPropertyData(devices[i],
|
||||
&propaddr, 0, 0, &size, device_name) == noErr
|
||||
&propaddr, 0, 0, &size, device_name) == noErr
|
||||
&& string_is_equal(device_name, device))
|
||||
{
|
||||
AudioUnitSetProperty(dev->dev, kAudioOutputUnitProperty_CurrentDevice,
|
||||
AudioUnitSetProperty(dev->dev, kAudioOutputUnitProperty_CurrentDevice,
|
||||
kAudioUnitScope_Global, 0, &devices[i], sizeof(AudioDeviceID));
|
||||
goto done;
|
||||
}
|
||||
@@ -184,14 +189,12 @@ done:
|
||||
#endif
|
||||
|
||||
static void *coreaudio_init(const char *device,
|
||||
unsigned rate, unsigned latency,
|
||||
unsigned block_frames,
|
||||
unsigned *new_rate)
|
||||
unsigned rate, unsigned latency)
|
||||
{
|
||||
size_t fifo_size;
|
||||
UInt32 i_size;
|
||||
AudioStreamBasicDescription real_desc;
|
||||
#if (defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__)))
|
||||
#ifdef OSX_PPC
|
||||
Component comp;
|
||||
#else
|
||||
AudioComponent comp;
|
||||
@@ -203,19 +206,21 @@ static void *coreaudio_init(const char *device,
|
||||
AudioStreamBasicDescription stream_desc = {0};
|
||||
bool component_unavailable = false;
|
||||
static bool session_initialized = false;
|
||||
#if (defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__)))
|
||||
coreaudio_t *dev = NULL;
|
||||
#ifdef OSX_PPC
|
||||
ComponentDescription desc = {0};
|
||||
#else
|
||||
AudioComponentDescription desc = {0};
|
||||
#endif
|
||||
coreaudio_t *dev = (coreaudio_t*)
|
||||
calloc(1, sizeof(*dev));
|
||||
if (!dev)
|
||||
return NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
(void)session_initialized;
|
||||
(void)device;
|
||||
|
||||
dev = (coreaudio_t*)calloc(1, sizeof(*dev));
|
||||
if (!dev)
|
||||
return NULL;
|
||||
|
||||
dev->lock = slock_new();
|
||||
dev->cond = scond_new();
|
||||
|
||||
@@ -237,15 +242,15 @@ static void *coreaudio_init(const char *device,
|
||||
#endif
|
||||
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
|
||||
|
||||
#if (defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__)))
|
||||
#ifdef OSX_PPC
|
||||
comp = FindNextComponent(NULL, &desc);
|
||||
#else
|
||||
comp = AudioComponentFindNext(NULL, &desc);
|
||||
#endif
|
||||
if (comp == NULL)
|
||||
goto error;
|
||||
|
||||
#if (defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__)))
|
||||
|
||||
#ifdef OSX_PPC
|
||||
component_unavailable = (OpenAComponent(comp, &dev->dev) != noErr);
|
||||
#else
|
||||
component_unavailable = (AudioComponentInstanceNew(comp, &dev->dev) != noErr);
|
||||
@@ -259,7 +264,7 @@ static void *coreaudio_init(const char *device,
|
||||
choose_output_device(dev, device);
|
||||
#endif
|
||||
|
||||
dev->dev_alive = true;
|
||||
dev->dev_alive = true;
|
||||
|
||||
/* Set audio format */
|
||||
stream_desc.mSampleRate = rate;
|
||||
@@ -269,17 +274,17 @@ static void *coreaudio_init(const char *device,
|
||||
stream_desc.mBytesPerFrame = 2 * sizeof(float);
|
||||
stream_desc.mFramesPerPacket = 1;
|
||||
stream_desc.mFormatID = kAudioFormatLinearPCM;
|
||||
stream_desc.mFormatFlags = kAudioFormatFlagIsFloat |
|
||||
kAudioFormatFlagIsPacked | (is_little_endian() ?
|
||||
stream_desc.mFormatFlags = kAudioFormatFlagIsFloat |
|
||||
kAudioFormatFlagIsPacked | (is_little_endian() ?
|
||||
0 : kAudioFormatFlagIsBigEndian);
|
||||
|
||||
|
||||
if (AudioUnitSetProperty(dev->dev, kAudioUnitProperty_StreamFormat,
|
||||
kAudioUnitScope_Input, 0, &stream_desc, sizeof(stream_desc)) != noErr)
|
||||
goto error;
|
||||
|
||||
|
||||
/* Check returned audio format. */
|
||||
i_size = sizeof(real_desc);
|
||||
if (AudioUnitGetProperty(dev->dev, kAudioUnitProperty_StreamFormat,
|
||||
if (AudioUnitGetProperty(dev->dev, kAudioUnitProperty_StreamFormat,
|
||||
kAudioUnitScope_Input, 0, &real_desc, &i_size) != noErr)
|
||||
goto error;
|
||||
|
||||
@@ -294,7 +299,7 @@ static void *coreaudio_init(const char *device,
|
||||
|
||||
RARCH_LOG("[CoreAudio]: Using output sample rate of %.1f Hz\n",
|
||||
(float)real_desc.mSampleRate);
|
||||
*new_rate = real_desc.mSampleRate;
|
||||
settings->audio.out_rate = real_desc.mSampleRate;
|
||||
|
||||
/* Set channel layout (fails on iOS). */
|
||||
#ifndef TARGET_OS_IPHONE
|
||||
@@ -315,11 +320,11 @@ static void *coreaudio_init(const char *device,
|
||||
if (AudioUnitInitialize(dev->dev) != noErr)
|
||||
goto error;
|
||||
|
||||
fifo_size = (latency * (*new_rate)) / 1000;
|
||||
fifo_size *= 2 * sizeof(float);
|
||||
dev->buffer_size = fifo_size;
|
||||
fifo_size = (latency * settings->audio.out_rate) / 1000;
|
||||
fifo_size *= 2 * sizeof(float);
|
||||
dev->buffer_size = fifo_size;
|
||||
|
||||
dev->buffer = fifo_new(fifo_size);
|
||||
dev->buffer = fifo_new(fifo_size);
|
||||
if (!dev->buffer)
|
||||
goto error;
|
||||
|
||||
@@ -339,9 +344,9 @@ error:
|
||||
|
||||
static ssize_t coreaudio_write(void *data, const void *buf_, size_t size)
|
||||
{
|
||||
coreaudio_t *dev = (coreaudio_t*)data;
|
||||
coreaudio_t *dev = (coreaudio_t*)data;
|
||||
const uint8_t *buf = (const uint8_t*)buf_;
|
||||
size_t written = 0;
|
||||
size_t written = 0;
|
||||
|
||||
while (!g_interrupted && size > 0)
|
||||
{
|
||||
@@ -402,7 +407,7 @@ static bool coreaudio_stop(void *data)
|
||||
return dev->is_paused ? true : false;
|
||||
}
|
||||
|
||||
static bool coreaudio_start(void *data, bool is_shutdown)
|
||||
static bool coreaudio_start(void *data)
|
||||
{
|
||||
coreaudio_t *dev = (coreaudio_t*)data;
|
||||
if (!dev)
|
||||
@@ -435,17 +440,6 @@ static size_t coreaudio_buffer_size(void *data)
|
||||
return dev->buffer_size;
|
||||
}
|
||||
|
||||
static void *coreaudio_device_list_new(void *data)
|
||||
{
|
||||
/* TODO/FIXME */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void coreaudio_device_list_free(void *data, void *array_list_data)
|
||||
{
|
||||
/* TODO/FIXME */
|
||||
}
|
||||
|
||||
audio_driver_t audio_coreaudio = {
|
||||
coreaudio_init,
|
||||
coreaudio_write,
|
||||
@@ -456,8 +450,6 @@ audio_driver_t audio_coreaudio = {
|
||||
coreaudio_free,
|
||||
coreaudio_use_float,
|
||||
"coreaudio",
|
||||
coreaudio_device_list_new,
|
||||
coreaudio_device_list_free,
|
||||
coreaudio_write_avail,
|
||||
coreaudio_buffer_size,
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2014-2017 - Ali Bouhlel
|
||||
* Copyright (C) 2014-2016 - Ali Bouhlel
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
@@ -15,11 +15,11 @@
|
||||
|
||||
#include <3ds.h>
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <retro_timers.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../performance.h"
|
||||
#include "../../runloop.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -48,40 +48,37 @@ typedef struct
|
||||
|
||||
static void ctr_csnd_audio_update_playpos(ctr_csnd_audio_t* ctr)
|
||||
{
|
||||
uint64_t current_tick = svcGetSystemTick();
|
||||
uint32_t samples_played = (current_tick - ctr->cpu_ticks_last)
|
||||
/ CTR_CSND_CPU_TICKS_PER_SAMPLE;
|
||||
uint32_t samples_played;
|
||||
uint64_t current_tick;
|
||||
|
||||
current_tick = svcGetSystemTick();
|
||||
samples_played = (current_tick - ctr->cpu_ticks_last) / CTR_CSND_CPU_TICKS_PER_SAMPLE;
|
||||
ctr->playpos = (ctr->playpos + samples_played) & CTR_CSND_AUDIO_COUNT_MASK;
|
||||
ctr->cpu_ticks_last += samples_played * CTR_CSND_CPU_TICKS_PER_SAMPLE;
|
||||
}
|
||||
|
||||
|
||||
Result csndPlaySound_custom(int chn, u32 flags, float vol, float pan,
|
||||
void* data0, void* data1, u32 size)
|
||||
Result csndPlaySound_custom(int chn, u32 flags, float vol, float pan, void* data0, void* data1, u32 size)
|
||||
{
|
||||
u32 paddr0 = 0;
|
||||
u32 paddr1 = 0;
|
||||
int encoding = (flags >> 12) & 3;
|
||||
int loopMode = (flags >> 10) & 3;
|
||||
|
||||
if (!(csndChannels & BIT(chn)))
|
||||
return 1;
|
||||
|
||||
if (!loopMode)
|
||||
flags |= SOUND_ONE_SHOT;
|
||||
u32 paddr0 = 0, paddr1 = 0;
|
||||
|
||||
int encoding = (flags >> 12) & 3;
|
||||
int loopMode = (flags >> 10) & 3;
|
||||
|
||||
if (!loopMode) flags |= SOUND_ONE_SHOT;
|
||||
|
||||
if (encoding != CSND_ENCODING_PSG)
|
||||
{
|
||||
if (data0)
|
||||
paddr0 = osConvertVirtToPhys(data0);
|
||||
if (data1)
|
||||
paddr1 = osConvertVirtToPhys(data1);
|
||||
if (data0) paddr0 = osConvertVirtToPhys(data0);
|
||||
if (data1) paddr1 = osConvertVirtToPhys(data1);
|
||||
|
||||
if (data0 && encoding == CSND_ENCODING_ADPCM)
|
||||
{
|
||||
int adpcmSample = ((s16*)data0)[-2];
|
||||
int adpcmIndex = ((u8*)data0)[-2];
|
||||
int adpcmIndex = ((u8*)data0)[-2];
|
||||
CSND_SetAdpcmState(chn, 0, adpcmSample, adpcmIndex);
|
||||
}
|
||||
}
|
||||
@@ -94,8 +91,7 @@ Result csndPlaySound_custom(int chn, u32 flags, float vol, float pan,
|
||||
|
||||
if (loopMode == CSND_LOOPMODE_NORMAL && paddr1 > paddr0)
|
||||
{
|
||||
/* Now that the first block is playing,
|
||||
* configure the size of the subsequent blocks */
|
||||
// Now that the first block is playing, configure the size of the subsequent blocks
|
||||
size -= paddr1 - paddr0;
|
||||
CSND_SetBlock(chn, 1, paddr1, size);
|
||||
}
|
||||
@@ -103,11 +99,10 @@ Result csndPlaySound_custom(int chn, u32 flags, float vol, float pan,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void *ctr_csnd_audio_init(const char *device, unsigned rate, unsigned latency,
|
||||
unsigned block_frames,
|
||||
unsigned *new_rate)
|
||||
static void *ctr_csnd_audio_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
||||
ctr_csnd_audio_t *ctr = (ctr_csnd_audio_t*)calloc(1, sizeof(ctr_csnd_audio_t));
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!ctr)
|
||||
return NULL;
|
||||
@@ -116,7 +111,7 @@ static void *ctr_csnd_audio_init(const char *device, unsigned rate, unsigned lat
|
||||
(void)rate;
|
||||
(void)latency;
|
||||
|
||||
*new_rate = CTR_CSND_AUDIO_RATE;
|
||||
settings->audio.out_rate = CTR_CSND_AUDIO_RATE;
|
||||
|
||||
ctr->l = linearAlloc(CTR_CSND_AUDIO_SIZE);
|
||||
ctr->r = linearAlloc(CTR_CSND_AUDIO_SIZE);
|
||||
@@ -149,9 +144,7 @@ static void ctr_csnd_audio_free(void *data)
|
||||
{
|
||||
ctr_csnd_audio_t* ctr = (ctr_csnd_audio_t*)data;
|
||||
|
||||
#if 0
|
||||
csndExit();
|
||||
#endif
|
||||
// csndExit();
|
||||
CSND_SetPlayState(0x8, 0);
|
||||
CSND_SetPlayState(0x9, 0);
|
||||
csndExecCmds(false);
|
||||
@@ -165,16 +158,20 @@ static void ctr_csnd_audio_free(void *data)
|
||||
static ssize_t ctr_csnd_audio_write(void *data, const void *buf, size_t size)
|
||||
{
|
||||
int i;
|
||||
uint32_t samples_played = 0;
|
||||
uint64_t current_tick = 0;
|
||||
const uint16_t *src = buf;
|
||||
ctr_csnd_audio_t *ctr = (ctr_csnd_audio_t*)data;
|
||||
uint32_t samples_played = 0;
|
||||
uint64_t current_tick = 0;
|
||||
static struct retro_perf_counter ctraudio_f = {0};
|
||||
const uint16_t *src = buf;
|
||||
ctr_csnd_audio_t *ctr = (ctr_csnd_audio_t*)data;
|
||||
|
||||
(void)data;
|
||||
(void)buf;
|
||||
(void)samples_played;
|
||||
(void)current_tick;
|
||||
|
||||
rarch_perf_init(&ctraudio_f, "ctraudio_f");
|
||||
retro_perf_start(&ctraudio_f);
|
||||
|
||||
ctr_csnd_audio_update_playpos(ctr);
|
||||
|
||||
if((((ctr->playpos - ctr->pos) & CTR_CSND_AUDIO_COUNT_MASK) < (CTR_CSND_AUDIO_COUNT >> 2)) ||
|
||||
@@ -205,11 +202,13 @@ static ssize_t ctr_csnd_audio_write(void *data, const void *buf, size_t size)
|
||||
GSPGPU_FlushDataCache(ctr->l, CTR_CSND_AUDIO_SIZE);
|
||||
GSPGPU_FlushDataCache(ctr->r, CTR_CSND_AUDIO_SIZE);
|
||||
|
||||
retro_perf_stop(&ctraudio_f);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static bool ctr_csnd_audio_stop(void *data)
|
||||
{
|
||||
{
|
||||
ctr_csnd_audio_t* ctr = (ctr_csnd_audio_t*)data;
|
||||
|
||||
/* using SetPlayState would make tracking the playback
|
||||
@@ -238,13 +237,14 @@ static bool ctr_csnd_audio_alive(void *data)
|
||||
return ctr->playing;
|
||||
}
|
||||
|
||||
static bool ctr_csnd_audio_start(void *data, bool is_shutdown)
|
||||
static bool ctr_csnd_audio_start(void *data)
|
||||
{
|
||||
ctr_csnd_audio_t* ctr = (ctr_csnd_audio_t*)data;
|
||||
|
||||
/* Prevents restarting audio when the menu
|
||||
* is toggled off on shutdown */
|
||||
if (is_shutdown)
|
||||
|
||||
if (runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL))
|
||||
return true;
|
||||
|
||||
#if 0
|
||||
@@ -300,8 +300,6 @@ audio_driver_t audio_ctr_csnd = {
|
||||
ctr_csnd_audio_free,
|
||||
ctr_csnd_audio_use_float,
|
||||
"csnd",
|
||||
NULL,
|
||||
NULL,
|
||||
ctr_csnd_audio_write_avail,
|
||||
ctr_csnd_audio_buffer_size
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2014-2017 - Ali Bouhlel
|
||||
* Copyright (C) 2014-2016 - Ali Bouhlel
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
@@ -15,9 +15,11 @@
|
||||
|
||||
#include <3ds.h>
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../performance.h"
|
||||
#include "../../runloop.h"
|
||||
#include "../../ctr/ctr_debug.h"
|
||||
|
||||
typedef struct
|
||||
@@ -35,11 +37,10 @@ typedef struct
|
||||
#define CTR_DSP_AUDIO_SIZE (CTR_DSP_AUDIO_COUNT * sizeof(int16_t) * 2)
|
||||
#define CTR_DSP_AUDIO_SIZE_MASK (CTR_DSP_AUDIO_SIZE - 1u)
|
||||
|
||||
static void *ctr_dsp_audio_init(const char *device, unsigned rate, unsigned latency,
|
||||
unsigned block_frames,
|
||||
unsigned *new_rate)
|
||||
static void *ctr_dsp_audio_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
||||
ctr_dsp_audio_t *ctr = NULL;
|
||||
ctr_dsp_audio_t *ctr;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
(void)device;
|
||||
(void)rate;
|
||||
@@ -53,12 +54,12 @@ static void *ctr_dsp_audio_init(const char *device, unsigned rate, unsigned late
|
||||
if (!ctr)
|
||||
return NULL;
|
||||
|
||||
*new_rate = 32730;
|
||||
settings->audio.out_rate = 32730;
|
||||
|
||||
ctr->channel = 0;
|
||||
|
||||
ndspSetOutputMode(NDSP_OUTPUT_STEREO);
|
||||
ndspSetClippingMode(NDSP_CLIP_SOFT); /* ?? */
|
||||
ndspSetClippingMode(NDSP_CLIP_SOFT); //??
|
||||
ndspSetOutputCount(1);
|
||||
ndspChnReset(ctr->channel);
|
||||
ndspChnSetFormat(ctr->channel, NDSP_FORMAT_STEREO_PCM16);
|
||||
@@ -94,9 +95,10 @@ static void ctr_dsp_audio_free(void *data)
|
||||
|
||||
static ssize_t ctr_dsp_audio_write(void *data, const void *buf, size_t size)
|
||||
{
|
||||
static struct retro_perf_counter ctraudio_dsp_f = {0};
|
||||
ctr_dsp_audio_t* ctr = (ctr_dsp_audio_t*)data;
|
||||
u32 pos;
|
||||
ctr_dsp_audio_t * ctr = (ctr_dsp_audio_t*)data;
|
||||
uint32_t sample_pos = ndspChnGetSamplePos(ctr->channel);
|
||||
uint32_t sample_pos = ndspChnGetSamplePos(ctr->channel);
|
||||
|
||||
if((((sample_pos - ctr->pos) & CTR_DSP_AUDIO_COUNT_MASK) < (CTR_DSP_AUDIO_COUNT >> 2)) ||
|
||||
(((ctr->pos - sample_pos ) & CTR_DSP_AUDIO_COUNT_MASK) < (CTR_DSP_AUDIO_COUNT >> 4)) ||
|
||||
@@ -114,6 +116,9 @@ static ssize_t ctr_dsp_audio_write(void *data, const void *buf, size_t size)
|
||||
}
|
||||
}
|
||||
|
||||
rarch_perf_init(&ctraudio_dsp_f, "ctraudio_dsp_f");
|
||||
retro_perf_start(&ctraudio_dsp_f);
|
||||
|
||||
pos = ctr->pos << 2;
|
||||
|
||||
if((pos + size) > CTR_DSP_AUDIO_SIZE)
|
||||
@@ -135,6 +140,8 @@ static ssize_t ctr_dsp_audio_write(void *data, const void *buf, size_t size)
|
||||
ctr->pos += size >> 2;
|
||||
ctr->pos &= CTR_DSP_AUDIO_COUNT_MASK;
|
||||
|
||||
retro_perf_stop(&ctraudio_dsp_f);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
@@ -154,13 +161,14 @@ static bool ctr_dsp_audio_alive(void *data)
|
||||
return ctr->playing;
|
||||
}
|
||||
|
||||
static bool ctr_dsp_audio_start(void *data, bool is_shutdown)
|
||||
static bool ctr_dsp_audio_start(void *data)
|
||||
{
|
||||
ctr_dsp_audio_t* ctr = (ctr_dsp_audio_t*)data;
|
||||
|
||||
/* Prevents restarting audio when the menu
|
||||
* is toggled off on shutdown */
|
||||
if (is_shutdown)
|
||||
|
||||
if (runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL))
|
||||
return true;
|
||||
|
||||
ndspSetMasterVol(1.0);
|
||||
@@ -206,8 +214,6 @@ audio_driver_t audio_ctr_dsp = {
|
||||
ctr_dsp_audio_free,
|
||||
ctr_dsp_audio_use_float,
|
||||
"dsp",
|
||||
NULL,
|
||||
NULL,
|
||||
ctr_dsp_audio_write_avail,
|
||||
ctr_dsp_audio_buffer_size
|
||||
};
|
||||
|
||||
+20
-31
@@ -1,7 +1,7 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
@@ -31,11 +31,11 @@
|
||||
|
||||
#include <retro_inline.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <retro_timers.h>
|
||||
#include <rthreads/rthreads.h>
|
||||
#include <queues/fifo_queue.h>
|
||||
#include <queues/fifo_buffer.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#ifdef _XBOX
|
||||
@@ -68,8 +68,7 @@ typedef struct dsound
|
||||
volatile bool thread_alive;
|
||||
} dsound_t;
|
||||
|
||||
static INLINE unsigned write_avail(unsigned read_ptr,
|
||||
unsigned write_ptr, unsigned buffer_size)
|
||||
static INLINE unsigned write_avail(unsigned read_ptr, unsigned write_ptr, unsigned buffer_size)
|
||||
{
|
||||
return (read_ptr + buffer_size - write_ptr) % buffer_size;
|
||||
}
|
||||
@@ -92,8 +91,8 @@ 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,
|
||||
const char *err;
|
||||
HRESULT res = IDirectSoundBuffer_Lock(ds->dsb, write_ptr, CHUNK_SIZE,
|
||||
®ion->chunk1, ®ion->size1, ®ion->chunk2, ®ion->size2, 0);
|
||||
|
||||
if (res == DSERR_BUFFERLOST)
|
||||
@@ -133,8 +132,7 @@ static INLINE bool grab_region(dsound_t *ds, uint32_t write_ptr,
|
||||
|
||||
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);
|
||||
IDirectSoundBuffer_Unlock(ds->dsb, region->chunk1, region->size1, region->chunk2, region->size2);
|
||||
}
|
||||
|
||||
static void dsound_thread(void *data)
|
||||
@@ -152,7 +150,7 @@ static void dsound_thread(void *data)
|
||||
struct audio_lock region;
|
||||
DWORD read_ptr, avail, fifo_avail;
|
||||
get_positions(ds, &read_ptr, NULL);
|
||||
|
||||
|
||||
avail = write_avail(read_ptr, write_ptr, ds->buffer_size);
|
||||
|
||||
EnterCriticalSection(&ds->crit);
|
||||
@@ -161,12 +159,12 @@ static void dsound_thread(void *data)
|
||||
|
||||
if (avail < CHUNK_SIZE || ((fifo_avail < CHUNK_SIZE) && (avail < ds->buffer_size / 2)))
|
||||
{
|
||||
/* No space to write, or we don't have data in our fifo,
|
||||
/* 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
|
||||
* but it is not guaranteed to work, so use high
|
||||
* priority sleeping patterns.
|
||||
*/
|
||||
retro_sleep(1);
|
||||
@@ -182,7 +180,7 @@ static void dsound_thread(void *data)
|
||||
|
||||
if (fifo_avail < CHUNK_SIZE)
|
||||
{
|
||||
/* Got space to write, but nothing in FIFO (underrun),
|
||||
/* Got space to write, but nothing in FIFO (underrun),
|
||||
* fill block with silence. */
|
||||
|
||||
memset(region.chunk1, 0, region.size1);
|
||||
@@ -191,7 +189,7 @@ static void dsound_thread(void *data)
|
||||
release_region(ds, ®ion);
|
||||
write_ptr = (write_ptr + region.size1 + region.size2) % ds->buffer_size;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
/* All is good. Pull from it and notify FIFO. */
|
||||
|
||||
@@ -238,9 +236,8 @@ static bool dsound_start_thread(dsound_t *ds)
|
||||
|
||||
static void dsound_clear_buffer(dsound_t *ds)
|
||||
{
|
||||
void *ptr;
|
||||
DWORD size;
|
||||
void *ptr = NULL;
|
||||
|
||||
IDirectSoundBuffer_SetCurrentPosition(ds->dsb, 0);
|
||||
|
||||
if (IDirectSoundBuffer_Lock(ds->dsb, 0, 0, &ptr, &size,
|
||||
@@ -303,9 +300,7 @@ static BOOL CALLBACK enumerate_cb(LPGUID guid, LPCSTR desc, LPCSTR module, LPVOI
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void *dsound_init(const char *device, unsigned rate, unsigned latency,
|
||||
unsigned block_frames,
|
||||
unsigned *new_rate)
|
||||
static void *dsound_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
||||
WAVEFORMATEX wfx = {0};
|
||||
DSBUFFERDESC bufdesc = {0};
|
||||
@@ -322,11 +317,7 @@ static void *dsound_init(const char *device, unsigned rate, unsigned latency,
|
||||
|
||||
RARCH_LOG("DirectSound devices:\n");
|
||||
#ifndef _XBOX
|
||||
#ifdef UNICODE
|
||||
DirectSoundEnumerate((LPDSENUMCALLBACKW)enumerate_cb, &dev);
|
||||
#else
|
||||
DirectSoundEnumerate((LPDSENUMCALLBACKA)enumerate_cb, &dev);
|
||||
#endif
|
||||
DirectSoundEnumerate(enumerate_cb, &dev);
|
||||
#endif
|
||||
|
||||
if (DirectSoundCreate(dev.guid, &ds->ds, NULL) != DS_OK)
|
||||
@@ -386,7 +377,7 @@ static void *dsound_init(const char *device, unsigned rate, unsigned latency,
|
||||
return ds;
|
||||
|
||||
error:
|
||||
RARCH_ERR("[DirectSound] Error occurred in init.\n");
|
||||
RARCH_ERR("[DirectSound] Error occured in init.\n");
|
||||
dsound_free(ds);
|
||||
return NULL;
|
||||
}
|
||||
@@ -401,7 +392,7 @@ static bool dsound_stop(void *data)
|
||||
return (ds->is_paused) ? true : false;
|
||||
}
|
||||
|
||||
static bool dsound_start(void *data, bool is_shutdown)
|
||||
static bool dsound_start(void *data)
|
||||
{
|
||||
dsound_t *ds = (dsound_t*)data;
|
||||
|
||||
@@ -433,8 +424,8 @@ static void dsound_set_nonblock_state(void *data, bool state)
|
||||
|
||||
static ssize_t dsound_write(void *data, const void *buf_, size_t size)
|
||||
{
|
||||
size_t written = 0;
|
||||
dsound_t *ds = (dsound_t*)data;
|
||||
size_t written = 0;
|
||||
dsound_t *ds = (dsound_t*)data;
|
||||
const uint8_t *buf = (const uint8_t*)buf_;
|
||||
|
||||
if (!ds->thread_alive)
|
||||
@@ -498,8 +489,6 @@ audio_driver_t audio_dsound = {
|
||||
dsound_free,
|
||||
dsound_use_float,
|
||||
"dsound",
|
||||
NULL,
|
||||
NULL,
|
||||
dsound_write_avail,
|
||||
dsound_buffer_size,
|
||||
};
|
||||
+14
-16
@@ -1,7 +1,7 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <retro_inline.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../defines/gx_defines.h"
|
||||
|
||||
typedef struct
|
||||
@@ -44,8 +45,8 @@ typedef struct
|
||||
bool is_paused;
|
||||
} gx_audio_t;
|
||||
|
||||
static volatile gx_audio_t *gx_audio_data = NULL;
|
||||
static volatile bool stop_audio = false;
|
||||
static volatile gx_audio_t *gx_audio_data;
|
||||
static volatile bool stop_audio;
|
||||
|
||||
static void dma_callback(void)
|
||||
{
|
||||
@@ -68,10 +69,9 @@ static void dma_callback(void)
|
||||
}
|
||||
|
||||
static void *gx_audio_init(const char *device,
|
||||
unsigned rate, unsigned latency,
|
||||
unsigned block_frames,
|
||||
unsigned *new_rate)
|
||||
unsigned rate, unsigned latency)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
gx_audio_t *wa = (gx_audio_t*)memalign(32, sizeof(*wa));
|
||||
if (!wa)
|
||||
return NULL;
|
||||
@@ -86,12 +86,12 @@ static void *gx_audio_init(const char *device,
|
||||
if (rate < 33000)
|
||||
{
|
||||
AISetDSPSampleRate(AI_SAMPLERATE_32KHZ);
|
||||
*new_rate = 32000;
|
||||
settings->audio.out_rate = 32000;
|
||||
}
|
||||
else
|
||||
{
|
||||
AISetDSPSampleRate(AI_SAMPLERATE_48KHZ);
|
||||
*new_rate = 48000;
|
||||
settings->audio.out_rate = 48000;
|
||||
}
|
||||
|
||||
OSInitThreadQueue(&wa->cond);
|
||||
@@ -118,9 +118,9 @@ static INLINE void copy_swapped(uint32_t * restrict dst,
|
||||
|
||||
static ssize_t gx_audio_write(void *data, const void *buf_, size_t size)
|
||||
{
|
||||
size_t frames = size >> 2;
|
||||
size_t frames = size >> 2;
|
||||
const uint32_t *buf = buf_;
|
||||
gx_audio_t *wa = data;
|
||||
gx_audio_t *wa = data;
|
||||
|
||||
while (frames)
|
||||
{
|
||||
@@ -129,9 +129,9 @@ static ssize_t gx_audio_write(void *data, const void *buf_, size_t size)
|
||||
if (frames < to_write)
|
||||
to_write = frames;
|
||||
|
||||
/* FIXME: Nonblocking audio should break out of loop
|
||||
/* FIXME: Nonblocking audio should break out of loop
|
||||
* when it has nothing to write. */
|
||||
while ((wa->dma_write == wa->dma_next ||
|
||||
while ((wa->dma_write == wa->dma_next ||
|
||||
wa->dma_write == wa->dma_busy) && !wa->nonblock)
|
||||
OSSleepThread(wa->cond);
|
||||
|
||||
@@ -173,7 +173,7 @@ static void gx_audio_set_nonblock_state(void *data, bool state)
|
||||
wa->nonblock = state;
|
||||
}
|
||||
|
||||
static bool gx_audio_start(void *data, bool is_shutdown)
|
||||
static bool gx_audio_start(void *data)
|
||||
{
|
||||
gx_audio_t *wa = (gx_audio_t*)data;
|
||||
|
||||
@@ -241,8 +241,6 @@ audio_driver_t audio_gx = {
|
||||
gx_audio_free,
|
||||
gx_audio_use_float,
|
||||
"gx",
|
||||
NULL,
|
||||
NULL,
|
||||
gx_audio_write_avail,
|
||||
gx_audio_buffer_size,
|
||||
};
|
||||
+38
-59
@@ -1,6 +1,6 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
*
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
@@ -13,11 +13,12 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <jack/jack.h>
|
||||
#include <jack/types.h>
|
||||
#include <jack/ringbuffer.h>
|
||||
@@ -40,29 +41,25 @@ typedef struct jack
|
||||
bool nonblock;
|
||||
bool is_paused;
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
scond_t *cond;
|
||||
slock_t *cond_lock;
|
||||
#endif
|
||||
size_t buffer_size;
|
||||
} jack_t;
|
||||
|
||||
static int process_cb(jack_nframes_t nframes, void *data)
|
||||
{
|
||||
int i;
|
||||
jack_nframes_t avail[2], min_avail;
|
||||
jack_nframes_t f, avail[2], min_avail;
|
||||
jack_t *jd = (jack_t*)data;
|
||||
|
||||
if (nframes <= 0)
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
scond_signal(jd->cond);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
avail[0] = jack_ringbuffer_read_space(jd->buffer[0]);
|
||||
avail[1] = jack_ringbuffer_read_space(jd->buffer[1]);
|
||||
avail[0] = jack_ringbuffer_read_space(jd->buffer[0]);
|
||||
avail[1] = jack_ringbuffer_read_space(jd->buffer[1]);
|
||||
min_avail = ((avail[0] < avail[1]) ? avail[0] : avail[1]) / sizeof(jack_default_audio_sample_t);
|
||||
|
||||
if (min_avail > nframes)
|
||||
@@ -70,17 +67,14 @@ static int process_cb(jack_nframes_t nframes, void *data)
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
jack_nframes_t f;
|
||||
jack_default_audio_sample_t *out = (jack_default_audio_sample_t*)jack_port_get_buffer(jd->ports[i], nframes);
|
||||
|
||||
assert(out);
|
||||
jack_ringbuffer_read(jd->buffer[i], (char*)out, min_avail * sizeof(jack_default_audio_sample_t));
|
||||
|
||||
for (f = min_avail; f < nframes; f++)
|
||||
out[f] = 0.0f;
|
||||
}
|
||||
#ifdef HAVE_THREADS
|
||||
scond_signal(jd->cond);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -92,19 +86,16 @@ static void shutdown_cb(void *data)
|
||||
return;
|
||||
|
||||
jd->shutdown = true;
|
||||
#ifdef HAVE_THREADS
|
||||
scond_signal(jd->cond);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int parse_ports(char **dest_ports, const char **jports)
|
||||
{
|
||||
int i;
|
||||
char *save = NULL;
|
||||
int parsed = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
char *audio_device_cpy = strdup(settings->arrays.audio_device);
|
||||
const char *con = strtok_r(audio_device_cpy, ",", &save);
|
||||
char *save = NULL;
|
||||
int parsed = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *con = strtok_r(settings->audio.device, ",", &save);
|
||||
|
||||
if (con)
|
||||
dest_ports[parsed++] = strdup(con);
|
||||
@@ -115,16 +106,15 @@ static int parse_ports(char **dest_ports, const char **jports)
|
||||
for (i = parsed; i < 2; i++)
|
||||
dest_ports[i] = strdup(jports[i]);
|
||||
|
||||
free(audio_device_cpy);
|
||||
return 2;
|
||||
}
|
||||
|
||||
static size_t find_buffersize(jack_t *jd, int latency, unsigned out_rate)
|
||||
static size_t find_buffersize(jack_t *jd, int latency)
|
||||
{
|
||||
jack_latency_range_t range;
|
||||
int i, buffer_frames, min_buffer_frames;
|
||||
int jack_latency = 0;
|
||||
int frames = latency * out_rate / 1000;
|
||||
int i, buffer_frames, min_buffer_frames, jack_latency = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
int frames = latency * settings->audio.out_rate / 1000;
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
@@ -133,12 +123,12 @@ static size_t find_buffersize(jack_t *jd, int latency, unsigned out_rate)
|
||||
jack_latency = range.max;
|
||||
}
|
||||
|
||||
RARCH_LOG("[JACK]: Jack latency is %d frames.\n", jack_latency);
|
||||
RARCH_LOG("JACK: Jack latency is %d frames.\n", jack_latency);
|
||||
|
||||
buffer_frames = frames - jack_latency;
|
||||
buffer_frames = frames - jack_latency;
|
||||
min_buffer_frames = jack_get_buffer_size(jd->client) * 2;
|
||||
|
||||
RARCH_LOG("[JACK]: Minimum buffer size is %d frames.\n", min_buffer_frames);
|
||||
RARCH_LOG("JACK: Minimum buffer size is %d frames.\n", min_buffer_frames);
|
||||
|
||||
if (buffer_frames < min_buffer_frames)
|
||||
buffer_frames = min_buffer_frames;
|
||||
@@ -146,30 +136,27 @@ static size_t find_buffersize(jack_t *jd, int latency, unsigned out_rate)
|
||||
return buffer_frames * sizeof(jack_default_audio_sample_t);
|
||||
}
|
||||
|
||||
static void *ja_init(const char *device, unsigned rate, unsigned latency,
|
||||
unsigned block_frames,
|
||||
unsigned *new_rate)
|
||||
static void *ja_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
||||
int i;
|
||||
char *dest_ports[2];
|
||||
const char **jports = NULL;
|
||||
size_t bufsize = 0;
|
||||
int parsed = 0;
|
||||
jack_t *jd = (jack_t*)calloc(1, sizeof(jack_t));
|
||||
char *dest_ports[2];
|
||||
size_t bufsize = 0;
|
||||
int parsed = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
jack_t *jd = (jack_t*)calloc(1, sizeof(jack_t));
|
||||
|
||||
if (!jd)
|
||||
return NULL;
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
jd->cond = scond_new();
|
||||
jd->cond_lock = slock_new();
|
||||
#endif
|
||||
|
||||
jd->client = jack_client_open("RetroArch", JackNullOption, NULL);
|
||||
if (jd->client == NULL)
|
||||
goto error;
|
||||
|
||||
*new_rate = jack_get_sample_rate(jd->client);
|
||||
settings->audio.out_rate = jack_get_sample_rate(jd->client);
|
||||
|
||||
jack_set_process_callback(jd->client, process_cb, jd);
|
||||
jack_on_shutdown(jd->client, shutdown_cb, jd);
|
||||
@@ -178,27 +165,27 @@ static void *ja_init(const char *device, unsigned rate, unsigned latency,
|
||||
jd->ports[1] = jack_port_register(jd->client, "right", JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
|
||||
if (jd->ports[0] == NULL || jd->ports[1] == NULL)
|
||||
{
|
||||
RARCH_ERR("[JACK]: Failed to register ports.\n");
|
||||
RARCH_ERR("Failed to register ports.\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
||||
jports = jack_get_ports(jd->client, NULL, NULL, JackPortIsPhysical | JackPortIsInput);
|
||||
if (jports == NULL)
|
||||
{
|
||||
RARCH_ERR("[JACK]: Failed to get ports.\n");
|
||||
RARCH_ERR("Failed to get ports.\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
bufsize = find_buffersize(jd, latency, *new_rate);
|
||||
bufsize = find_buffersize(jd, latency);
|
||||
jd->buffer_size = bufsize;
|
||||
|
||||
RARCH_LOG("[JACK]: Internal buffer size: %d frames.\n", (int)(bufsize / sizeof(jack_default_audio_sample_t)));
|
||||
RARCH_LOG("JACK: Internal buffer size: %d frames.\n", (int)(bufsize / sizeof(jack_default_audio_sample_t)));
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
jd->buffer[i] = jack_ringbuffer_create(bufsize);
|
||||
if (jd->buffer[i] == NULL)
|
||||
{
|
||||
RARCH_ERR("[JACK]: Failed to create buffers.\n");
|
||||
RARCH_ERR("Failed to create buffers.\n");
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
@@ -207,7 +194,7 @@ static void *ja_init(const char *device, unsigned rate, unsigned latency,
|
||||
|
||||
if (jack_activate(jd->client) < 0)
|
||||
{
|
||||
RARCH_ERR("[JACK]: Failed to activate Jack...\n");
|
||||
RARCH_ERR("Failed to activate Jack...\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -215,32 +202,30 @@ static void *ja_init(const char *device, unsigned rate, unsigned latency,
|
||||
{
|
||||
if (jack_connect(jd->client, jack_port_name(jd->ports[i]), dest_ports[i]))
|
||||
{
|
||||
RARCH_ERR("[JACK]: Failed to connect to Jack port.\n");
|
||||
RARCH_ERR("Failed to connect to Jack port.\n");
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < parsed; i++)
|
||||
free(dest_ports[i]);
|
||||
|
||||
|
||||
jack_free(jports);
|
||||
return jd;
|
||||
|
||||
error:
|
||||
for (i = 0; i < parsed; i++)
|
||||
free(dest_ports[i]);
|
||||
if (jports != NULL)
|
||||
jack_free(jports);
|
||||
free(jd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static size_t write_buffer(jack_t *jd, const float *buf, size_t size)
|
||||
{
|
||||
int i;
|
||||
size_t j, written = 0;
|
||||
size_t j, frames, written = 0;
|
||||
jack_default_audio_sample_t out_deinterleaved_buffer[2][AUDIO_CHUNK_SIZE_NONBLOCKING * AUDIO_MAX_RATIO];
|
||||
size_t frames = FRAMES(size);
|
||||
|
||||
frames = FRAMES(size);
|
||||
|
||||
/* Avoid buffer overflow if a DSP plugin generated a huge number of frames. */
|
||||
if (frames > AUDIO_CHUNK_SIZE_NONBLOCKING * AUDIO_MAX_RATIO)
|
||||
@@ -273,14 +258,12 @@ static size_t write_buffer(jack_t *jd, const float *buf, size_t size)
|
||||
}
|
||||
written += write_frames;
|
||||
}
|
||||
#ifdef HAVE_THREADS
|
||||
else
|
||||
{
|
||||
slock_lock(jd->cond_lock);
|
||||
scond_wait(jd->cond, jd->cond_lock);
|
||||
slock_unlock(jd->cond_lock);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (jd->nonblock)
|
||||
break;
|
||||
@@ -319,7 +302,7 @@ static void ja_set_nonblock_state(void *data, bool state)
|
||||
jd->nonblock = state;
|
||||
}
|
||||
|
||||
static bool ja_start(void *data, bool is_shutdown)
|
||||
static bool ja_start(void *data)
|
||||
{
|
||||
jack_t *jd = (jack_t*)data;
|
||||
if (jd)
|
||||
@@ -344,12 +327,10 @@ static void ja_free(void *data)
|
||||
if (jd->buffer[i] != NULL)
|
||||
jack_ringbuffer_free(jd->buffer[i]);
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
if (jd->cond_lock)
|
||||
slock_free(jd->cond_lock);
|
||||
if (jd->cond)
|
||||
scond_free(jd->cond);
|
||||
#endif
|
||||
free(jd);
|
||||
}
|
||||
|
||||
@@ -381,8 +362,6 @@ audio_driver_t audio_jack = {
|
||||
ja_free,
|
||||
ja_use_float,
|
||||
"jack",
|
||||
NULL,
|
||||
NULL,
|
||||
ja_write_avail,
|
||||
ja_buffer_size,
|
||||
};
|
||||
@@ -1,7 +1,6 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
@@ -17,16 +16,13 @@
|
||||
#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)
|
||||
static void *null_audio_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
||||
RARCH_ERR("Using the null audio driver. RetroArch will be silent.");
|
||||
|
||||
(void)device;
|
||||
(void)rate;
|
||||
(void)latency;
|
||||
(void)new_rate;
|
||||
return (void*)-1;
|
||||
}
|
||||
|
||||
@@ -55,7 +51,7 @@ static bool null_audio_alive(void *data)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool null_audio_start(void *data, bool is_shutdown)
|
||||
static bool null_audio_start(void *data)
|
||||
{
|
||||
(void)data;
|
||||
return true;
|
||||
@@ -89,8 +85,6 @@ audio_driver_t audio_null = {
|
||||
null_audio_free,
|
||||
null_audio_use_float,
|
||||
"null",
|
||||
NULL,
|
||||
NULL,
|
||||
null_audio_write_avail,
|
||||
NULL
|
||||
};
|
||||
+6
-14
@@ -1,7 +1,6 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
@@ -14,7 +13,6 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
@@ -30,10 +28,8 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <retro_timers.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#define BUFSIZE 1024
|
||||
@@ -82,9 +78,7 @@ static void al_free(void *data)
|
||||
free(al);
|
||||
}
|
||||
|
||||
static void *al_init(const char *device, unsigned rate, unsigned latency,
|
||||
unsigned block_frames,
|
||||
unsigned *new_rate)
|
||||
static void *al_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
||||
al_t *al;
|
||||
|
||||
@@ -176,9 +170,9 @@ static size_t al_fill_internal_buf(al_t *al, const void *buf, size_t size)
|
||||
|
||||
static ssize_t al_write(void *data, const void *buf_, size_t size)
|
||||
{
|
||||
al_t *al = (al_t*)data;
|
||||
al_t *al = (al_t*)data;
|
||||
const uint8_t *buf = (const uint8_t*)buf_;
|
||||
size_t written = 0;
|
||||
size_t written = 0;
|
||||
|
||||
while (size)
|
||||
{
|
||||
@@ -236,7 +230,7 @@ static void al_set_nonblock_state(void *data, bool state)
|
||||
al->nonblock = state;
|
||||
}
|
||||
|
||||
static bool al_start(void *data, bool is_shutdown)
|
||||
static bool al_start(void *data)
|
||||
{
|
||||
al_t *al = (al_t*)data;
|
||||
if (al)
|
||||
@@ -273,8 +267,6 @@ audio_driver_t audio_openal = {
|
||||
al_free,
|
||||
al_use_float,
|
||||
"openal",
|
||||
NULL,
|
||||
NULL,
|
||||
al_write_avail,
|
||||
al_buffer_size,
|
||||
};
|
||||
+52
-52
@@ -1,7 +1,7 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <rthreads/rthreads.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../configuration.h"
|
||||
|
||||
/* Helper macros, COM-style. */
|
||||
#define SLObjectItf_Realize(a, ...) ((*(a))->Realize(a, __VA_ARGS__))
|
||||
@@ -97,26 +98,31 @@ static void sl_free(void *data)
|
||||
free(sl);
|
||||
}
|
||||
|
||||
static void *sl_init(const char *device, unsigned rate, unsigned latency,
|
||||
unsigned block_frames,
|
||||
unsigned *new_rate)
|
||||
static void *sl_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
||||
unsigned i;
|
||||
SLDataFormat_PCM fmt_pcm = {0};
|
||||
SLDataSource audio_src = {0};
|
||||
SLDataSink audio_sink = {0};
|
||||
SLInterfaceID id;
|
||||
SLboolean req;
|
||||
SLresult res;
|
||||
sl_t *sl;
|
||||
SLDataFormat_PCM fmt_pcm = {0};
|
||||
SLDataSource audio_src = {0};
|
||||
SLDataSink audio_sink = {0};
|
||||
SLDataLocator_AndroidSimpleBufferQueue loc_bufq = {0};
|
||||
SLDataLocator_OutputMix loc_outmix = {0};
|
||||
SLresult res = 0;
|
||||
SLInterfaceID id = SL_IID_ANDROIDSIMPLEBUFFERQUEUE;
|
||||
SLboolean req = SL_BOOLEAN_TRUE;
|
||||
sl_t *sl = (sl_t*)calloc(1, sizeof(sl_t));
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
(void)device;
|
||||
|
||||
id = SL_IID_ANDROIDSIMPLEBUFFERQUEUE;
|
||||
req = SL_BOOLEAN_TRUE;
|
||||
|
||||
res = 0;
|
||||
sl = (sl_t*)calloc(1, sizeof(sl_t));
|
||||
if (!sl)
|
||||
goto error;
|
||||
|
||||
RARCH_LOG("[OpenSL]: Requested audio latency: %u ms.", latency);
|
||||
RARCH_LOG("[SLES]: Requested audio latency: %u ms.", latency);
|
||||
|
||||
GOTO_IF_FAIL(slCreateEngine(&sl->engine_object, 0, NULL, 0, NULL, NULL));
|
||||
GOTO_IF_FAIL(SLObjectItf_Realize(sl->engine_object, SL_BOOLEAN_FALSE));
|
||||
@@ -125,15 +131,15 @@ static void *sl_init(const char *device, unsigned rate, unsigned latency,
|
||||
GOTO_IF_FAIL(SLEngineItf_CreateOutputMix(sl->engine, &sl->output_mix, 0, NULL, NULL));
|
||||
GOTO_IF_FAIL(SLObjectItf_Realize(sl->output_mix, SL_BOOLEAN_FALSE));
|
||||
|
||||
if (block_frames)
|
||||
sl->buf_size = block_frames * 4;
|
||||
if (settings->audio.block_frames)
|
||||
sl->buf_size = settings->audio.block_frames * 4;
|
||||
else
|
||||
sl->buf_size = next_pow2(32 * latency);
|
||||
sl->buf_size = next_pow2(32 * latency);
|
||||
|
||||
sl->buf_count = (latency * 4 * rate + 500) / 1000;
|
||||
sl->buf_count = (sl->buf_count + sl->buf_size / 2) / sl->buf_size;
|
||||
sl->buf_count = (latency * 4 * rate + 500) / 1000;
|
||||
sl->buf_count = (sl->buf_count + sl->buf_size / 2) / sl->buf_size;
|
||||
|
||||
sl->buffer = (uint8_t**)calloc(sizeof(uint8_t*), sl->buf_count);
|
||||
sl->buffer = (uint8_t**)calloc(sizeof(uint8_t*), sl->buf_count);
|
||||
if (!sl->buffer)
|
||||
goto error;
|
||||
|
||||
@@ -144,27 +150,27 @@ static void *sl_init(const char *device, unsigned rate, unsigned latency,
|
||||
for (i = 0; i < sl->buf_count; i++)
|
||||
sl->buffer[i] = sl->buffer_chunk + i * sl->buf_size;
|
||||
|
||||
RARCH_LOG("[OpenSL]: Setting audio latency: Block size = %u, Blocks = %u, Total = %u ...\n",
|
||||
RARCH_LOG("[SLES]: Setting audio latency: Block size = %u, Blocks = %u, Total = %u ...\n",
|
||||
sl->buf_size, sl->buf_count, sl->buf_size * sl->buf_count);
|
||||
|
||||
fmt_pcm.formatType = SL_DATAFORMAT_PCM;
|
||||
fmt_pcm.numChannels = 2;
|
||||
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;
|
||||
fmt_pcm.endianness = SL_BYTEORDER_LITTLEENDIAN; /* Android only. */
|
||||
fmt_pcm.formatType = SL_DATAFORMAT_PCM;
|
||||
fmt_pcm.numChannels = 2;
|
||||
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;
|
||||
fmt_pcm.endianness = SL_BYTEORDER_LITTLEENDIAN; /* Android only. */
|
||||
|
||||
audio_src.pLocator = &loc_bufq;
|
||||
audio_src.pFormat = &fmt_pcm;
|
||||
audio_src.pLocator = &loc_bufq;
|
||||
audio_src.pFormat = &fmt_pcm;
|
||||
|
||||
loc_bufq.locatorType = SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE;
|
||||
loc_bufq.numBuffers = sl->buf_count;
|
||||
loc_bufq.locatorType = SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE;
|
||||
loc_bufq.numBuffers = sl->buf_count;
|
||||
|
||||
loc_outmix.locatorType = SL_DATALOCATOR_OUTPUTMIX;
|
||||
loc_outmix.outputMix = sl->output_mix;
|
||||
|
||||
audio_sink.pLocator = &loc_outmix;
|
||||
audio_sink.pLocator = &loc_outmix;
|
||||
|
||||
GOTO_IF_FAIL(SLEngineItf_CreateAudioPlayer(sl->engine, &sl->buffer_queue_object,
|
||||
&audio_src, &audio_sink,
|
||||
@@ -174,15 +180,14 @@ static void *sl_init(const char *device, unsigned rate, unsigned latency,
|
||||
GOTO_IF_FAIL(SLObjectItf_GetInterface(sl->buffer_queue_object, SL_IID_ANDROIDSIMPLEBUFFERQUEUE,
|
||||
&sl->buffer_queue));
|
||||
|
||||
sl->cond = scond_new();
|
||||
sl->lock = slock_new();
|
||||
sl->cond = scond_new();
|
||||
sl->lock = slock_new();
|
||||
|
||||
(*sl->buffer_queue)->RegisterCallback(sl->buffer_queue, opensl_callback, sl);
|
||||
|
||||
/* Enqueue a bit to get stuff rolling. */
|
||||
sl->buffered_blocks = sl->buf_count;
|
||||
sl->buffer_index = 0;
|
||||
|
||||
sl->buffered_blocks = sl->buf_count;
|
||||
sl->buffer_index = 0;
|
||||
for (i = 0; i < sl->buf_count; i++)
|
||||
(*sl->buffer_queue)->Enqueue(sl->buffer_queue, sl->buffer[i], sl->buf_size);
|
||||
|
||||
@@ -192,17 +197,15 @@ static void *sl_init(const char *device, unsigned rate, unsigned latency,
|
||||
return sl;
|
||||
|
||||
error:
|
||||
RARCH_ERR("[OpenSL]: Couldn't initialize OpenSL ES driver, error code: [%d].\n", (int)res);
|
||||
RARCH_ERR("Couldn't initialize OpenSL ES driver, error code: [%d].\n", (int)res);
|
||||
sl_free(sl);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static bool sl_stop(void *data)
|
||||
{
|
||||
sl_t *sl = (sl_t*)data;
|
||||
sl->is_paused = (SLPlayItf_SetPlayState(sl->player, SL_PLAYSTATE_STOPPED)
|
||||
== SL_RESULT_SUCCESS) ? true : false;
|
||||
|
||||
sl_t *sl = (sl_t*)data;
|
||||
sl->is_paused = (SLPlayItf_SetPlayState(sl->player, SL_PLAYSTATE_STOPPED) == SL_RESULT_SUCCESS) ? true : false;
|
||||
return sl->is_paused ? true : false;
|
||||
}
|
||||
|
||||
@@ -221,19 +224,18 @@ static void sl_set_nonblock_state(void *data, bool state)
|
||||
sl->nonblock = state;
|
||||
}
|
||||
|
||||
static bool sl_start(void *data, bool is_shutdown)
|
||||
static bool sl_start(void *data)
|
||||
{
|
||||
sl_t *sl = (sl_t*)data;
|
||||
sl->is_paused = (SLPlayItf_SetPlayState(sl->player, SL_PLAYSTATE_PLAYING)
|
||||
== SL_RESULT_SUCCESS) ? false : true;
|
||||
sl_t *sl = (sl_t*)data;
|
||||
sl->is_paused = (SLPlayItf_SetPlayState(sl->player, SL_PLAYSTATE_PLAYING) == SL_RESULT_SUCCESS) ? false : true;
|
||||
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;
|
||||
size_t written = 0;
|
||||
sl_t *sl = (sl_t*)data;
|
||||
size_t written = 0;
|
||||
const uint8_t *buf = (const uint8_t*)buf_;
|
||||
|
||||
while (size)
|
||||
@@ -266,10 +268,10 @@ static ssize_t sl_write(void *data, const void *buf_, size_t size)
|
||||
|
||||
if (sl->buffer_ptr >= sl->buf_size)
|
||||
{
|
||||
SLresult res = (*sl->buffer_queue)->Enqueue(sl->buffer_queue, sl->buffer[sl->buffer_index], sl->buf_size);
|
||||
SLresult res = (*sl->buffer_queue)->Enqueue(sl->buffer_queue, sl->buffer[sl->buffer_index], sl->buf_size);
|
||||
sl->buffer_index = (sl->buffer_index + 1) % sl->buf_count;
|
||||
__sync_fetch_and_add(&sl->buffered_blocks, 1);
|
||||
sl->buffer_ptr = 0;
|
||||
sl->buffer_ptr = 0;
|
||||
|
||||
if (res != SL_RESULT_SUCCESS)
|
||||
{
|
||||
@@ -311,8 +313,6 @@ audio_driver_t audio_opensl = {
|
||||
sl_free,
|
||||
sl_use_float,
|
||||
"opensl",
|
||||
NULL,
|
||||
NULL,
|
||||
sl_write_avail,
|
||||
sl_buffer_size,
|
||||
};
|
||||
+35
-33
@@ -1,7 +1,6 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
@@ -13,7 +12,6 @@
|
||||
* 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>
|
||||
@@ -34,6 +32,7 @@
|
||||
#endif
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
#ifdef HAVE_OSS_BSD
|
||||
@@ -42,17 +41,17 @@
|
||||
#define DEFAULT_OSS_DEV "/dev/dsp"
|
||||
#endif
|
||||
|
||||
static bool oss_is_paused = false;
|
||||
static bool oss_is_paused;
|
||||
|
||||
static void *oss_init(const char *device, unsigned rate, unsigned latency,
|
||||
unsigned block_frames,
|
||||
unsigned *new_out_rate)
|
||||
static void *oss_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
||||
int frags, frag, channels, format, new_rate;
|
||||
int *fd = (int*)calloc(1, sizeof(int));
|
||||
const char *oss_device = device ? device : DEFAULT_OSS_DEV;
|
||||
int *fd = (int*)calloc(1, sizeof(int));
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!fd)
|
||||
const char *oss_device = device ? device : DEFAULT_OSS_DEV;
|
||||
|
||||
if (fd == NULL)
|
||||
return NULL;
|
||||
|
||||
if ((*fd = open(oss_device, O_WRONLY)) < 0)
|
||||
@@ -63,38 +62,47 @@ static void *oss_init(const char *device, unsigned rate, unsigned latency,
|
||||
}
|
||||
|
||||
frags = (latency * rate * 4) / (1000 * (1 << 10));
|
||||
frag = (frags << 16) | 10;
|
||||
frag = (frags << 16) | 10;
|
||||
|
||||
if (ioctl(*fd, SNDCTL_DSP_SETFRAGMENT, &frag) < 0)
|
||||
RARCH_WARN("Cannot set fragment sizes. Latency might not be as expected ...\n");
|
||||
|
||||
channels = 2;
|
||||
format = is_little_endian() ? AFMT_S16_LE : AFMT_S16_BE;
|
||||
format = is_little_endian() ? AFMT_S16_LE : AFMT_S16_BE;
|
||||
|
||||
if (ioctl(*fd, SNDCTL_DSP_CHANNELS, &channels) < 0)
|
||||
goto error;
|
||||
{
|
||||
close(*fd);
|
||||
free(fd);
|
||||
perror("ioctl");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ioctl(*fd, SNDCTL_DSP_SETFMT, &format) < 0)
|
||||
goto error;
|
||||
{
|
||||
close(*fd);
|
||||
free(fd);
|
||||
perror("ioctl");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
new_rate = rate;
|
||||
|
||||
if (ioctl(*fd, SNDCTL_DSP_SPEED, &new_rate) < 0)
|
||||
goto error;
|
||||
{
|
||||
close(*fd);
|
||||
free(fd);
|
||||
perror("ioctl");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (new_rate != (int)rate)
|
||||
{
|
||||
RARCH_WARN("Requested sample rate not supported. Adjusting output rate to %d Hz.\n", new_rate);
|
||||
*new_out_rate = new_rate;
|
||||
settings->audio.out_rate = new_rate;
|
||||
}
|
||||
|
||||
return fd;
|
||||
|
||||
error:
|
||||
close(*fd);
|
||||
free(fd);
|
||||
perror("ioctl");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static ssize_t oss_write(void *data, const void *buf, size_t size)
|
||||
@@ -120,14 +128,12 @@ static bool oss_stop(void *data)
|
||||
{
|
||||
int *fd = (int*)data;
|
||||
|
||||
if (ioctl(*fd, SNDCTL_DSP_RESET, 0) < 0)
|
||||
return false;
|
||||
|
||||
ioctl(*fd, SNDCTL_DSP_RESET, 0);
|
||||
oss_is_paused = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool oss_start(void *data, bool is_shutdown)
|
||||
static bool oss_start(void *data)
|
||||
{
|
||||
(void)data;
|
||||
oss_is_paused = false;
|
||||
@@ -157,9 +163,7 @@ static void oss_free(void *data)
|
||||
{
|
||||
int *fd = (int*)data;
|
||||
|
||||
if (ioctl(*fd, SNDCTL_DSP_RESET, 0) < 0)
|
||||
return;
|
||||
|
||||
ioctl(*fd, SNDCTL_DSP_RESET, 0);
|
||||
close(*fd);
|
||||
free(fd);
|
||||
}
|
||||
@@ -171,7 +175,7 @@ static size_t oss_write_avail(void *data)
|
||||
|
||||
if (ioctl(*fd, SNDCTL_DSP_GETOSPACE, &info) < 0)
|
||||
{
|
||||
RARCH_ERR("[OSS]: SNDCTL_DSP_GETOSPACE failed ...\n");
|
||||
RARCH_ERR("SNDCTL_DSP_GETOSPACE failed ...\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -185,7 +189,7 @@ static size_t oss_buffer_size(void *data)
|
||||
|
||||
if (ioctl(*fd, SNDCTL_DSP_GETOSPACE, &info) < 0)
|
||||
{
|
||||
RARCH_ERR("[OSS]: SNDCTL_DSP_GETOSPACE failed ...\n");
|
||||
RARCH_ERR("SNDCTL_DSP_GETOSPACE failed ...\n");
|
||||
return 1; /* Return something non-zero to avoid SIGFPE. */
|
||||
}
|
||||
|
||||
@@ -208,8 +212,6 @@ audio_driver_t audio_oss = {
|
||||
oss_free,
|
||||
oss_use_float,
|
||||
"oss",
|
||||
NULL,
|
||||
NULL,
|
||||
oss_write_avail,
|
||||
oss_buffer_size,
|
||||
};
|
||||
+16
-17
@@ -1,7 +1,7 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
@@ -17,9 +17,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <queues/fifo_queue.h>
|
||||
#include <queues/fifo_buffer.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../configuration.h"
|
||||
|
||||
#include "../../defines/ps3_defines.h"
|
||||
|
||||
@@ -51,7 +52,7 @@ static void event_loop(uint64_t data)
|
||||
sys_event_queue_t id;
|
||||
sys_ipc_key_t key;
|
||||
sys_event_t event;
|
||||
ps3_audio_t *aud = (ps3_audio_t*)(uintptr_t)data;
|
||||
ps3_audio_t *aud = data;
|
||||
|
||||
cellAudioCreateNotifyEventQueue(&id, &key);
|
||||
cellAudioSetNotifyEventQueue(key);
|
||||
@@ -77,23 +78,23 @@ static void event_loop(uint64_t data)
|
||||
}
|
||||
|
||||
static void *ps3_audio_init(const char *device,
|
||||
unsigned rate, unsigned latency,
|
||||
unsigned block_frames,
|
||||
unsigned *new_rate)
|
||||
unsigned rate, unsigned latency)
|
||||
{
|
||||
CellAudioPortParam params;
|
||||
ps3_audio_t *data = calloc(1, sizeof(*data));
|
||||
if (!data)
|
||||
return NULL;
|
||||
ps3_audio_t *data = NULL;
|
||||
|
||||
(void)latency;
|
||||
(void)device;
|
||||
(void)rate;
|
||||
|
||||
data = calloc(1, sizeof(*data));
|
||||
if (!data)
|
||||
return NULL;
|
||||
|
||||
cellAudioInit();
|
||||
|
||||
params.numChannels = AUDIO_CHANNELS;
|
||||
params.numBlocks = AUDIO_BLOCKS;
|
||||
params.numBlocks = AUDIO_BLOCKS;
|
||||
#if 0
|
||||
#ifdef HAVE_HEADSET
|
||||
if(global->console.sound.mode == SOUND_MODE_HEADSET)
|
||||
@@ -110,11 +111,11 @@ static void *ps3_audio_init(const char *device,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data->buffer = fifo_new(CELL_AUDIO_BLOCK_SAMPLES *
|
||||
data->buffer = fifo_new(CELL_AUDIO_BLOCK_SAMPLES *
|
||||
AUDIO_CHANNELS * AUDIO_BLOCKS * sizeof(float));
|
||||
|
||||
#ifdef __PSL1GHT__
|
||||
sys_lwmutex_attr_t lock_attr =
|
||||
sys_lwmutex_attr_t lock_attr =
|
||||
{SYS_LWMUTEX_ATTR_PROTOCOL, SYS_LWMUTEX_ATTR_RECURSIVE, "\0"};
|
||||
sys_lwmutex_attr_t cond_lock_attr =
|
||||
{SYS_LWMUTEX_ATTR_PROTOCOL, SYS_LWMUTEX_ATTR_RECURSIVE, "\0"};
|
||||
@@ -177,7 +178,7 @@ static bool ps3_audio_stop(void *data)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ps3_audio_start(void *data, bool is_shutdown)
|
||||
static bool ps3_audio_start(void *data)
|
||||
{
|
||||
ps3_audio_t *aud = data;
|
||||
if (!aud->started)
|
||||
@@ -209,7 +210,7 @@ static void ps3_audio_free(void *data)
|
||||
ps3_audio_t *aud = data;
|
||||
|
||||
aud->quit_thread = true;
|
||||
ps3_audio_start(aud, false);
|
||||
ps3_audio_start(aud);
|
||||
sys_ppu_thread_join(aud->thread, &val);
|
||||
|
||||
ps3_audio_stop(aud);
|
||||
@@ -246,8 +247,6 @@ audio_driver_t audio_ps3 = {
|
||||
ps3_audio_free,
|
||||
ps3_audio_use_float,
|
||||
"ps3",
|
||||
NULL,
|
||||
NULL,
|
||||
ps3_audio_write_avail,
|
||||
NULL
|
||||
};
|
||||
+52
-135
@@ -1,7 +1,7 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
* Copyright (C) 2014-2017 - Ali Bouhlel
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
* Copyright (C) 2014-2016 - Ali Bouhlel
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
@@ -17,8 +17,6 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <malloc.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef VITA
|
||||
#include <psp2/kernel/processmgr.h>
|
||||
@@ -31,29 +29,19 @@
|
||||
#endif
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../configuration.h"
|
||||
|
||||
typedef struct psp_audio
|
||||
{
|
||||
bool nonblocking;
|
||||
|
||||
uint32_t* buffer;
|
||||
uint32_t* zeroBuffer;
|
||||
|
||||
SceUID thread;
|
||||
int rate;
|
||||
|
||||
volatile bool running;
|
||||
volatile uint16_t read_pos;
|
||||
volatile uint16_t write_pos;
|
||||
|
||||
#ifdef VITA
|
||||
char lock[32] __attribute__ ((aligned (8)));
|
||||
char cond_lock[32] __attribute__ ((aligned (8)));
|
||||
char cond[32] __attribute__ ((aligned (8)));
|
||||
#else
|
||||
SceUID lock;
|
||||
SceUID cond;
|
||||
#endif
|
||||
volatile uint16_t readPos;
|
||||
volatile uint16_t writePos;
|
||||
} psp_audio_t;
|
||||
|
||||
#define AUDIO_OUT_COUNT 512u
|
||||
@@ -61,7 +49,7 @@ typedef struct psp_audio
|
||||
#define AUDIO_BUFFER_SIZE_MASK (AUDIO_BUFFER_SIZE-1)
|
||||
|
||||
#ifdef VITA
|
||||
#define PSP_THREAD_STOPPED SCE_THREAD_STOPPED
|
||||
#define PSP_THREAD_STOPPED PSP2_THREAD_STOPPED
|
||||
#else
|
||||
#define SceKernelThreadInfo SceKernelThreadRunStatus
|
||||
#define sceKernelGetThreadInfo sceKernelReferThreadRunStatus
|
||||
@@ -70,66 +58,48 @@ typedef struct psp_audio
|
||||
static int audioMainLoop(SceSize args, void* argp)
|
||||
{
|
||||
psp_audio_t* psp = *((psp_audio_t**)argp);
|
||||
|
||||
#ifdef VITA
|
||||
int port = sceAudioOutOpenPort(
|
||||
SCE_AUDIO_OUT_PORT_TYPE_MAIN, AUDIO_OUT_COUNT,
|
||||
psp->rate, SCE_AUDIO_OUT_MODE_STEREO);
|
||||
int port = sceAudioOutOpenPort(PSP2_AUDIO_OUT_PORT_TYPE_MAIN, AUDIO_OUT_COUNT,
|
||||
psp->rate, PSP2_AUDIO_OUT_MODE_STEREO);
|
||||
#else
|
||||
sceAudioSRCChReserve(AUDIO_OUT_COUNT, psp->rate, 2);
|
||||
#endif
|
||||
|
||||
while (psp->running)
|
||||
{
|
||||
bool cond = false;
|
||||
uint16_t read_pos = psp->read_pos;
|
||||
uint16_t read_pos_2 = psp->read_pos;
|
||||
/* Get a non-volatile copy. */
|
||||
uint16_t readPos = psp->readPos;
|
||||
bool cond = ((uint16_t)(psp->writePos - readPos) & AUDIO_BUFFER_SIZE_MASK)
|
||||
< (AUDIO_OUT_COUNT * 2);
|
||||
|
||||
#ifdef VITA
|
||||
sceKernelLockLwMutex((struct SceKernelLwMutexWork*)&psp->lock, 1, 0);
|
||||
sceAudioOutOutput(port,
|
||||
cond ? psp->zeroBuffer : (psp->buffer + readPos));
|
||||
#else
|
||||
sceKernelWaitSema(psp->lock, 1, 0);
|
||||
sceAudioSRCOutputBlocking(PSP_AUDIO_VOLUME_MAX, cond ? (psp->zeroBuffer)
|
||||
: (psp->buffer + readPos));
|
||||
#endif
|
||||
|
||||
cond = ((uint16_t)(psp->write_pos - read_pos) & AUDIO_BUFFER_SIZE_MASK)
|
||||
< (AUDIO_OUT_COUNT * 2);
|
||||
|
||||
if (!cond)
|
||||
{
|
||||
read_pos += AUDIO_OUT_COUNT;
|
||||
read_pos &= AUDIO_BUFFER_SIZE_MASK;
|
||||
psp->read_pos = read_pos;
|
||||
readPos += AUDIO_OUT_COUNT;
|
||||
readPos &= AUDIO_BUFFER_SIZE_MASK;
|
||||
psp->readPos = readPos;
|
||||
}
|
||||
|
||||
#ifdef VITA
|
||||
sceKernelUnlockLwMutex((struct SceKernelLwMutexWork*)&psp->lock, 1);
|
||||
sceKernelSignalLwCond((struct SceKernelLwCondWork*)&psp->cond);
|
||||
|
||||
sceAudioOutOutput(port,
|
||||
cond ? (psp->zeroBuffer)
|
||||
: (psp->buffer + read_pos_2));
|
||||
#else
|
||||
sceKernelSignalSema(psp->lock, 1);
|
||||
if(!cond){
|
||||
sceKernelSignalSema(psp->cond, 1);
|
||||
}
|
||||
sceAudioSRCOutputBlocking(PSP_AUDIO_VOLUME_MAX, cond ? (psp->zeroBuffer)
|
||||
: (psp->buffer + read_pos));
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef VITA
|
||||
sceAudioOutReleasePort(port);
|
||||
#else
|
||||
sceAudioSRCChRelease();
|
||||
sceKernelExitThread(0);
|
||||
#endif
|
||||
sceKernelExitThread(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void *psp_audio_init(const char *device,
|
||||
unsigned rate, unsigned latency,
|
||||
unsigned block_frames,
|
||||
unsigned *new_rate)
|
||||
unsigned rate, unsigned latency)
|
||||
{
|
||||
psp_audio_t *psp = (psp_audio_t*)calloc(1, sizeof(psp_audio_t));
|
||||
|
||||
@@ -139,33 +109,27 @@ static void *psp_audio_init(const char *device,
|
||||
(void)device;
|
||||
(void)latency;
|
||||
|
||||
|
||||
/* Cache aligned, not necessary but helpful. */
|
||||
psp->buffer = (uint32_t*)
|
||||
memalign(64, AUDIO_BUFFER_SIZE * sizeof(uint32_t));
|
||||
memset(psp->buffer, 0, AUDIO_BUFFER_SIZE * sizeof(uint32_t));
|
||||
|
||||
psp->zeroBuffer = (uint32_t*)
|
||||
memalign(64, AUDIO_OUT_COUNT * sizeof(uint32_t));
|
||||
memset(psp->zeroBuffer, 0, AUDIO_OUT_COUNT * sizeof(uint32_t));
|
||||
|
||||
psp->read_pos = 0;
|
||||
psp->write_pos = 0;
|
||||
psp->readPos = 0;
|
||||
psp->writePos = 0;
|
||||
psp->rate = rate;
|
||||
#if defined(VITA)
|
||||
|
||||
sceKernelCreateLwMutex((struct SceKernelLwMutexWork*)&psp->lock, "audio_get_lock", 0, 0, 0);
|
||||
sceKernelCreateLwMutex((struct SceKernelLwMutexWork*)&psp->cond_lock, "audio_get_cond_lock", 0, 0, 0);
|
||||
sceKernelCreateLwCond((struct SceKernelLwCondWork*)&psp->cond, "audio_get_cond", 0, (struct SceKernelLwMutexWork*)&psp->cond_lock, 0);
|
||||
psp->thread = sceKernelCreateThread
|
||||
("audioMainLoop", audioMainLoop, 0x10000100, 0x10000, 0, 0, NULL);
|
||||
#else
|
||||
psp->cond=sceKernelCreateSema("audio_start_sema", 0, 0, 1, NULL);
|
||||
psp->lock=sceKernelCreateSema("audio_lock_sema", 0, 1, 1, NULL);
|
||||
psp->thread = sceKernelCreateThread
|
||||
("audioMainLoop", audioMainLoop, 0x08, 0x10000, 0, NULL);
|
||||
#endif
|
||||
|
||||
psp->nonblocking = false;
|
||||
|
||||
psp->running = true;
|
||||
sceKernelStartThread(psp->thread, sizeof(psp_audio_t*), &psp);
|
||||
|
||||
@@ -182,72 +146,47 @@ static void psp_audio_free(void *data)
|
||||
psp->running = false;
|
||||
#if defined(VITA)
|
||||
sceKernelWaitThreadEnd(psp->thread, NULL, &timeout);
|
||||
sceKernelDeleteLwMutex((struct SceKernelLwMutexWork*)&psp->lock);
|
||||
sceKernelDeleteLwMutex((struct SceKernelLwMutexWork*)&psp->cond_lock);
|
||||
sceKernelDeleteLwCond((struct SceKernelLwCondWork*)&psp->cond);
|
||||
#else
|
||||
sceKernelWaitThreadEnd(psp->thread, &timeout);
|
||||
sceKernelDeleteSema(psp->lock);
|
||||
sceKernelDeleteSema(psp->cond);
|
||||
#endif
|
||||
free(psp->buffer);
|
||||
sceKernelDeleteThread(psp->thread);
|
||||
|
||||
free(psp->buffer);
|
||||
free(psp->zeroBuffer);
|
||||
free(psp);
|
||||
}
|
||||
|
||||
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);
|
||||
uint16_t sampleCount;
|
||||
psp_audio_t* psp = (psp_audio_t*)data;
|
||||
uint16_t writePos = psp->writePos;
|
||||
|
||||
sampleCount= size / sizeof(uint32_t);
|
||||
|
||||
#if 0
|
||||
if (psp->nonblocking)
|
||||
{
|
||||
//#ifdef VITA
|
||||
if (AUDIO_BUFFER_SIZE - ((uint16_t)
|
||||
(psp->write_pos - psp->read_pos) & AUDIO_BUFFER_SIZE_MASK) < size)
|
||||
return 0;
|
||||
//#endif
|
||||
/* TODO */
|
||||
}
|
||||
|
||||
#ifdef VITA
|
||||
while (AUDIO_BUFFER_SIZE - ((uint16_t)
|
||||
(psp->write_pos - psp->read_pos) & AUDIO_BUFFER_SIZE_MASK) < size)
|
||||
sceKernelWaitLwCond((struct SceKernelLwCondWork*)&psp->cond, 0);
|
||||
|
||||
sceKernelLockLwMutex((struct SceKernelLwMutexWork*)&psp->lock, 1, 0);
|
||||
#else
|
||||
while (AUDIO_BUFFER_SIZE - ((uint16_t)
|
||||
(psp->write_pos - psp->read_pos) & AUDIO_BUFFER_SIZE_MASK) < size)
|
||||
sceKernelWaitSema(psp->cond, 1, 0);
|
||||
sceKernelWaitSema(psp->lock, 1, 0);
|
||||
#endif
|
||||
|
||||
if((write_pos + sampleCount) > AUDIO_BUFFER_SIZE)
|
||||
if((writePos + sampleCount) > AUDIO_BUFFER_SIZE)
|
||||
{
|
||||
memcpy(psp->buffer + write_pos, buf,
|
||||
(AUDIO_BUFFER_SIZE - write_pos) * sizeof(uint32_t));
|
||||
memcpy(psp->buffer + writePos, buf,
|
||||
(AUDIO_BUFFER_SIZE - writePos) * sizeof(uint32_t));
|
||||
memcpy(psp->buffer, (uint32_t*) buf +
|
||||
(AUDIO_BUFFER_SIZE - write_pos),
|
||||
(write_pos + sampleCount - AUDIO_BUFFER_SIZE) * sizeof(uint32_t));
|
||||
(AUDIO_BUFFER_SIZE - writePos),
|
||||
(writePos + sampleCount - AUDIO_BUFFER_SIZE) * sizeof(uint32_t));
|
||||
}
|
||||
else
|
||||
memcpy(psp->buffer + write_pos, buf, size);
|
||||
memcpy(psp->buffer + writePos, buf, size);
|
||||
|
||||
write_pos += sampleCount;
|
||||
write_pos &= AUDIO_BUFFER_SIZE_MASK;
|
||||
psp->write_pos = write_pos;
|
||||
writePos += sampleCount;
|
||||
writePos &= AUDIO_BUFFER_SIZE_MASK;
|
||||
psp->writePos = writePos;
|
||||
|
||||
#ifdef VITA
|
||||
sceKernelUnlockLwMutex((struct SceKernelLwMutexWork*)&psp->lock, 1);
|
||||
|
||||
return size;
|
||||
#else
|
||||
sceKernelSignalSema(psp->lock, 1);
|
||||
|
||||
return size;
|
||||
#endif
|
||||
return sampleCount;
|
||||
}
|
||||
|
||||
static bool psp_audio_alive(void *data)
|
||||
@@ -265,9 +204,6 @@ static bool psp_audio_stop(void *data)
|
||||
SceUInt timeout = 100000;
|
||||
psp_audio_t* psp = (psp_audio_t*)data;
|
||||
|
||||
if(psp && !psp->running)
|
||||
return true;
|
||||
|
||||
info.size = sizeof(SceKernelThreadInfo);
|
||||
|
||||
if (sceKernelGetThreadInfo(
|
||||
@@ -283,17 +219,15 @@ static bool psp_audio_stop(void *data)
|
||||
#else
|
||||
sceKernelWaitThreadEnd(psp->thread, &timeout);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool psp_audio_start(void *data, bool is_shutdown)
|
||||
static bool psp_audio_start(void *data)
|
||||
{
|
||||
SceKernelThreadInfo info;
|
||||
psp_audio_t* psp = (psp_audio_t*)data;
|
||||
|
||||
if(psp && psp->running)
|
||||
return true;
|
||||
|
||||
info.size = sizeof(SceKernelThreadInfo);
|
||||
|
||||
if (sceKernelGetThreadInfo(
|
||||
@@ -325,31 +259,16 @@ static bool psp_audio_use_float(void *data)
|
||||
|
||||
static size_t psp_write_avail(void *data)
|
||||
{
|
||||
size_t val;
|
||||
/* TODO */
|
||||
psp_audio_t* psp = (psp_audio_t*)data;
|
||||
|
||||
#ifdef VITA
|
||||
sceKernelLockLwMutex((struct SceKernelLwMutexWork*)&psp->lock, 1, 0);
|
||||
#else
|
||||
sceKernelWaitSema(psp->lock, 1, 0);
|
||||
#endif
|
||||
|
||||
val = AUDIO_BUFFER_SIZE - ((uint16_t)
|
||||
(psp->write_pos - psp->read_pos) & AUDIO_BUFFER_SIZE_MASK);
|
||||
|
||||
#ifdef VITA
|
||||
sceKernelUnlockLwMutex((struct SceKernelLwMutexWork*)&psp->lock, 1);
|
||||
#else
|
||||
sceKernelSignalSema(psp->lock, 1);
|
||||
#endif
|
||||
|
||||
return val;
|
||||
return AUDIO_BUFFER_SIZE - ((uint16_t)
|
||||
(psp->writePos - psp->readPos) & AUDIO_BUFFER_SIZE_MASK);
|
||||
}
|
||||
|
||||
static size_t psp_buffer_size(void *data)
|
||||
{
|
||||
/* TODO */
|
||||
return AUDIO_BUFFER_SIZE /** sizeof(uint32_t)*/;
|
||||
return AUDIO_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
|
||||
@@ -367,8 +286,6 @@ audio_driver_t audio_psp = {
|
||||
#else
|
||||
"psp",
|
||||
#endif
|
||||
NULL,
|
||||
NULL,
|
||||
psp_write_avail,
|
||||
psp_buffer_size
|
||||
psp_buffer_size,
|
||||
};
|
||||
+23
-32
@@ -1,7 +1,6 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
@@ -23,6 +22,7 @@
|
||||
#include <retro_endianness.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
typedef struct
|
||||
@@ -88,7 +88,7 @@ static void context_state_cb(pa_context *c, void *data)
|
||||
}
|
||||
}
|
||||
|
||||
static void stream_state_cb(pa_stream *s, void *data)
|
||||
static void stream_state_cb(pa_stream *s, void *data)
|
||||
{
|
||||
pa_t *pa = (pa_t*)data;
|
||||
|
||||
@@ -104,7 +104,7 @@ static void stream_state_cb(pa_stream *s, void *data)
|
||||
}
|
||||
}
|
||||
|
||||
static void stream_request_cb(pa_stream *s, size_t length, void *data)
|
||||
static void stream_request_cb(pa_stream *s, size_t length, void *data)
|
||||
{
|
||||
pa_t *pa = (pa_t*)data;
|
||||
|
||||
@@ -114,7 +114,7 @@ static void stream_request_cb(pa_stream *s, size_t length, void *data)
|
||||
pa_threaded_mainloop_signal(pa->mainloop, 0);
|
||||
}
|
||||
|
||||
static void stream_latency_update_cb(pa_stream *s, void *data)
|
||||
static void stream_latency_update_cb(pa_stream *s, void *data)
|
||||
{
|
||||
pa_t *pa = (pa_t*)data;
|
||||
|
||||
@@ -125,7 +125,6 @@ static void stream_latency_update_cb(pa_stream *s, void *data)
|
||||
|
||||
static void underrun_update_cb(pa_stream *s, void *data)
|
||||
{
|
||||
#if 0
|
||||
pa_t *pa = (pa_t*)data;
|
||||
|
||||
(void)s;
|
||||
@@ -133,7 +132,6 @@ static void underrun_update_cb(pa_stream *s, void *data)
|
||||
RARCH_LOG("[PulseAudio]: Underrun (Buffer: %u, Writable size: %u).\n",
|
||||
(unsigned)pa->buffer_size,
|
||||
(unsigned)pa_stream_writable_size(pa->stream));
|
||||
#endif
|
||||
}
|
||||
|
||||
static void buffer_attr_cb(pa_stream *s, void *data)
|
||||
@@ -143,23 +141,19 @@ static void buffer_attr_cb(pa_stream *s, void *data)
|
||||
if (server_attr)
|
||||
pa->buffer_size = server_attr->tlength;
|
||||
|
||||
#if 0
|
||||
RARCH_LOG("[PulseAudio]: Got new buffer size %u.\n", (unsigned)pa->buffer_size);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void *pulse_init(const char *device, unsigned rate,
|
||||
unsigned latency,
|
||||
unsigned block_frames,
|
||||
unsigned *new_rate)
|
||||
static void *pulse_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
||||
pa_sample_spec spec;
|
||||
pa_buffer_attr buffer_attr = {0};
|
||||
pa_sample_spec spec;
|
||||
pa_t *pa;
|
||||
pa_buffer_attr buffer_attr = {0};
|
||||
const pa_buffer_attr *server_attr = NULL;
|
||||
pa_t *pa = (pa_t*)calloc(1, sizeof(*pa));
|
||||
|
||||
memset(&spec, 0, sizeof(spec));
|
||||
|
||||
|
||||
pa = (pa_t*)calloc(1, sizeof(*pa));
|
||||
if (!pa)
|
||||
goto error;
|
||||
|
||||
@@ -185,11 +179,11 @@ static void *pulse_init(const char *device, unsigned rate,
|
||||
if (pa_context_get_state(pa->context) != PA_CONTEXT_READY)
|
||||
goto unlock_error;
|
||||
|
||||
spec.format = is_little_endian() ? PA_SAMPLE_FLOAT32LE : PA_SAMPLE_FLOAT32BE;
|
||||
spec.format = is_little_endian() ? PA_SAMPLE_FLOAT32LE : PA_SAMPLE_FLOAT32BE;
|
||||
spec.channels = 2;
|
||||
spec.rate = rate;
|
||||
spec.rate = rate;
|
||||
|
||||
pa->stream = pa_stream_new(pa->context, "audio", &spec, NULL);
|
||||
pa->stream = pa_stream_new(pa->context, "audio", &spec, NULL);
|
||||
if (!pa->stream)
|
||||
goto unlock_error;
|
||||
|
||||
@@ -200,13 +194,12 @@ static void *pulse_init(const char *device, unsigned rate,
|
||||
pa_stream_set_buffer_attr_callback(pa->stream, buffer_attr_cb, pa);
|
||||
|
||||
buffer_attr.maxlength = -1;
|
||||
buffer_attr.tlength = pa_usec_to_bytes(latency * PA_USEC_PER_MSEC, &spec);
|
||||
buffer_attr.prebuf = -1;
|
||||
buffer_attr.minreq = -1;
|
||||
buffer_attr.fragsize = -1;
|
||||
buffer_attr.tlength = pa_usec_to_bytes(latency * PA_USEC_PER_MSEC, &spec);
|
||||
buffer_attr.prebuf = -1;
|
||||
buffer_attr.minreq = -1;
|
||||
buffer_attr.fragsize = -1;
|
||||
|
||||
if (pa_stream_connect_playback(pa->stream, NULL,
|
||||
&buffer_attr, PA_STREAM_ADJUST_LATENCY, NULL, NULL) < 0)
|
||||
if (pa_stream_connect_playback(pa->stream, NULL, &buffer_attr, PA_STREAM_ADJUST_LATENCY, NULL, NULL) < 0)
|
||||
goto error;
|
||||
|
||||
pa_threaded_mainloop_wait(pa->mainloop);
|
||||
@@ -232,15 +225,15 @@ static void *pulse_init(const char *device, unsigned rate,
|
||||
unlock_error:
|
||||
pa_threaded_mainloop_unlock(pa->mainloop);
|
||||
error:
|
||||
pulse_free(pa);
|
||||
pulse_free(pa);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static ssize_t pulse_write(void *data, const void *buf_, size_t size)
|
||||
{
|
||||
pa_t *pa = (pa_t*)data;
|
||||
pa_t *pa = (pa_t*)data;
|
||||
const uint8_t *buf = (const uint8_t*)buf_;
|
||||
size_t written = 0;
|
||||
size_t written = 0;
|
||||
|
||||
pa_threaded_mainloop_lock(pa->mainloop);
|
||||
while (size)
|
||||
@@ -291,7 +284,7 @@ static bool pulse_alive(void *data)
|
||||
return !pa->is_paused;
|
||||
}
|
||||
|
||||
static bool pulse_start(void *data, bool is_shutdown)
|
||||
static bool pulse_start(void *data)
|
||||
{
|
||||
bool ret;
|
||||
pa_t *pa = (pa_t*)data;
|
||||
@@ -350,8 +343,6 @@ audio_driver_t audio_pulse = {
|
||||
pulse_free,
|
||||
pulse_use_float,
|
||||
"pulse",
|
||||
NULL,
|
||||
NULL,
|
||||
pulse_write_avail,
|
||||
pulse_buffer_size,
|
||||
};
|
||||
+8
-14
@@ -1,7 +1,6 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
@@ -24,21 +23,19 @@
|
||||
#include <boolean.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../verbosity.h"
|
||||
#include "../../configuration.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
roar_vs_t *vss;
|
||||
bool nonblocking;
|
||||
bool is_paused;
|
||||
} roar_t;
|
||||
|
||||
static void *ra_init(const char *device, unsigned rate, unsigned latency,
|
||||
unsigned block_frames, unsigned *new_rate)
|
||||
static void *ra_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
||||
int err;
|
||||
roar_vs_t *vss = NULL;
|
||||
roar_t *roar = (roar_t*)calloc(1, sizeof(roar_t));
|
||||
roar_vs_t *vss;
|
||||
roar_t *roar = (roar_t*)calloc(1, sizeof(roar_t));
|
||||
|
||||
if (!roar)
|
||||
return NULL;
|
||||
@@ -62,7 +59,7 @@ static ssize_t ra_write(void *data, const void *buf, size_t size)
|
||||
{
|
||||
int err;
|
||||
size_t written = 0;
|
||||
roar_t *roar = (roar_t*)data;
|
||||
roar_t *roar = (roar_t*)data;
|
||||
|
||||
if (size == 0)
|
||||
return 0;
|
||||
@@ -72,8 +69,7 @@ static ssize_t ra_write(void *data, const void *buf, size_t size)
|
||||
ssize_t rc;
|
||||
size_t write_amt = size - written;
|
||||
|
||||
if ((rc = roar_vs_write(roar->vss,
|
||||
(const char*)buf + written, write_amt, &err)) < (ssize_t)write_amt)
|
||||
if ((rc = roar_vs_write(roar->vss, (const char*)buf + written, write_amt, &err)) < (ssize_t)write_amt)
|
||||
{
|
||||
if (roar->nonblocking)
|
||||
return rc;
|
||||
@@ -110,7 +106,7 @@ static void ra_set_nonblock_state(void *data, bool state)
|
||||
roar->nonblocking = state;
|
||||
}
|
||||
|
||||
static bool ra_start(void *data, bool is_shutdown)
|
||||
static bool ra_start(void *data)
|
||||
{
|
||||
roar_t *roar = (roar_t*)data;
|
||||
if (roar)
|
||||
@@ -146,8 +142,6 @@ audio_driver_t audio_roar = {
|
||||
ra_free,
|
||||
ra_use_float,
|
||||
"roar",
|
||||
NULL,
|
||||
NULL,
|
||||
ra_write_avail,
|
||||
NULL
|
||||
};
|
||||
+18
-23
@@ -1,7 +1,6 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
@@ -18,7 +17,7 @@
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#include <queues/fifo_queue.h>
|
||||
#include <queues/fifo_buffer.h>
|
||||
#include <rthreads/rthreads.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
@@ -56,26 +55,28 @@ static void err_cb(void *userdata)
|
||||
scond_signal(rsd->cond);
|
||||
}
|
||||
|
||||
static void *rs_init(const char *device, unsigned rate, unsigned latency,
|
||||
unsigned block_frames,
|
||||
unsigned *new_rate)
|
||||
static void *rs_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
||||
int channels, format;
|
||||
rsound_t *rd = NULL;
|
||||
rsd_t *rsd = (rsd_t*)calloc(1, sizeof(rsd_t));
|
||||
rsd_t *rsd = (rsd_t*)calloc(1, sizeof(rsd_t));
|
||||
if (!rsd)
|
||||
return NULL;
|
||||
|
||||
rsound_t *rd;
|
||||
|
||||
if (rsd_init(&rd) < 0)
|
||||
goto error;
|
||||
{
|
||||
free(rsd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rsd->cond_lock = slock_new();
|
||||
rsd->cond = scond_new();
|
||||
rsd->cond = scond_new();
|
||||
|
||||
rsd->buffer = fifo_new(1024 * 4);
|
||||
rsd->buffer = fifo_new(1024 * 4);
|
||||
|
||||
channels = 2;
|
||||
format = RSD_S16_NE;
|
||||
channels = 2;
|
||||
format = RSD_S16_NE;
|
||||
|
||||
rsd_set_param(rd, RSD_CHANNELS, &channels);
|
||||
rsd_set_param(rd, RSD_SAMPLERATE, &rate);
|
||||
@@ -91,15 +92,12 @@ static void *rs_init(const char *device, unsigned rate, unsigned latency,
|
||||
if (rsd_start(rd) < 0)
|
||||
{
|
||||
free(rsd);
|
||||
goto error;
|
||||
rsd_free(rd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rsd->rd = rd;
|
||||
return rsd;
|
||||
|
||||
error:
|
||||
rsd_free(rd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static ssize_t rs_write(void *data, const void *buf, size_t size)
|
||||
@@ -177,7 +175,7 @@ static bool rs_alive(void *data)
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool rs_start(void *data, bool is_shutdown)
|
||||
static bool rs_start(void *data)
|
||||
{
|
||||
rsd_t *rsd = (rsd_t*)data;
|
||||
if (rsd_start(rsd->rd) < 0)
|
||||
@@ -203,13 +201,12 @@ static void rs_free(void *data)
|
||||
|
||||
static size_t rs_write_avail(void *data)
|
||||
{
|
||||
size_t val;
|
||||
rsd_t *rsd = (rsd_t*)data;
|
||||
|
||||
if (rsd->has_error)
|
||||
return 0;
|
||||
rsd_callback_lock(rsd->rd);
|
||||
val = fifo_write_avail(rsd->buffer);
|
||||
size_t val = fifo_write_avail(rsd->buffer);
|
||||
rsd_callback_unlock(rsd->rd);
|
||||
return val;
|
||||
}
|
||||
@@ -236,8 +233,6 @@ audio_driver_t audio_rsound = {
|
||||
rs_free,
|
||||
rs_use_float,
|
||||
"rsound",
|
||||
NULL,
|
||||
NULL,
|
||||
rs_write_avail,
|
||||
rs_buffer_size,
|
||||
};
|
||||
+48
-41
@@ -1,6 +1,6 @@
|
||||
/* RSound - A PCM audio client/server
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
*
|
||||
*
|
||||
* RSound is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
@@ -16,6 +16,14 @@
|
||||
#ifndef __RSOUND_H
|
||||
#define __RSOUND_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#define STANDALONE
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <rthreads/rthreads.h>
|
||||
@@ -24,10 +32,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <retro_common_api.h>
|
||||
#include <queues/fifo_queue.h>
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
#include <queues/fifo_buffer.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#define RSD_DEFAULT_HOST "127.0.0.1" /* Stupid Windows. */
|
||||
@@ -43,7 +48,7 @@ RETRO_BEGIN_DECLS
|
||||
#endif
|
||||
|
||||
/* Feature tests */
|
||||
#define RSD_SAMPLERATE RSD_SAMPLERATE
|
||||
#define RSD_SAMPLERATE RSD_SAMPLERATE
|
||||
#define RSD_CHANNELS RSD_CHANNELS
|
||||
#define RSD_HOST RSD_HOST
|
||||
#define RSD_PORT RSD_PORT
|
||||
@@ -125,7 +130,7 @@ enum rsd_settings
|
||||
/* Audio callback for rsd_set_callback. Return -1 to trigger an error in the stream. */
|
||||
typedef ssize_t (*rsd_audio_callback_t)(void *data, size_t bytes, void *userdata);
|
||||
|
||||
/* Error callback. Signals caller that stream has been stopped,
|
||||
/* Error callback. Signals caller that stream has been stopped,
|
||||
* either by audio callback returning -1 or stream was hung up. */
|
||||
typedef void (*rsd_error_callback_t)(void *userdata);
|
||||
|
||||
@@ -144,7 +149,7 @@ typedef struct rsound
|
||||
int conn_type;
|
||||
|
||||
volatile int buffer_pointer; /* Obsolete, but kept for backwards header compatibility. */
|
||||
size_t buffer_size;
|
||||
size_t buffer_size;
|
||||
fifo_buffer_t *fifo_buffer;
|
||||
|
||||
volatile int thread_active;
|
||||
@@ -196,13 +201,13 @@ typedef struct rsound
|
||||
rsd_set_param(rd, RSD_HOST, "foohost");
|
||||
*sets more params*
|
||||
rsd_start(rd);
|
||||
rsd_write(rd, buf, size);
|
||||
rsd_write(rd, buf, size);
|
||||
rsd_stop(rd);
|
||||
rsd_free(rd);
|
||||
*/
|
||||
int rsd_init (rsound_t **rd);
|
||||
|
||||
/* This is a simpler function that initializes an rsound struct, sets params as given,
|
||||
/* This is a simpler function that initializes an rsound struct, sets params as given,
|
||||
and starts the stream. Should this function fail, the structure will stay uninitialized.
|
||||
Should NULL be passed in either host, port or ident, defaults will be used. */
|
||||
|
||||
@@ -211,29 +216,29 @@ int rsd_simple_start (rsound_t **rd, const char* host, const char* port, const c
|
||||
|
||||
/* Sets params associated with an rsound_t. These options (int options) include:
|
||||
|
||||
RSD_HOST: Server to connect to. Expects (char *) in param.
|
||||
If not set, will default to environmental variable RSD_SERVER or "localhost".
|
||||
RSD_HOST: Server to connect to. Expects (char *) in param.
|
||||
If not set, will default to environmental variable RSD_SERVER or "localhost".
|
||||
|
||||
RSD_PORT: Set port. Expects (char *) in param.
|
||||
RSD_PORT: Set port. Expects (char *) in param.
|
||||
If not set, will default to environmental variable RSD_PORT or "12345".
|
||||
|
||||
RSD_CHANNELS: Set number of audio channels. Expects (int *) in param. Mandatory.
|
||||
|
||||
RSD_SAMPLERATE: Set samplerate of audio stream. Expects (int *) in param. Mandatory.
|
||||
|
||||
RSD_BUFSIZE: Sets internal buffersize for the stream.
|
||||
Might be overridden if too small.
|
||||
RSD_BUFSIZE: Sets internal buffersize for the stream.
|
||||
Might be overridden if too small.
|
||||
Expects (int *) in param. Optional.
|
||||
|
||||
RSD_LATENCY: Sets maximum audio latency in milliseconds,
|
||||
(must be used with rsd_delay_wait() or this will have no effect).
|
||||
Most applications do not need this.
|
||||
Might be overridden if too small.
|
||||
RSD_LATENCY: Sets maximum audio latency in milliseconds,
|
||||
(must be used with rsd_delay_wait() or this will have no effect).
|
||||
Most applications do not need this.
|
||||
Might be overridden if too small.
|
||||
Expects (int *) in param. Optional.
|
||||
|
||||
RSD_FORMAT: Sets sample format.
|
||||
It defaults to S16_LE, so you probably will not use this.
|
||||
Expects (int *) in param, with available values found in the format enum.
|
||||
RSD_FORMAT: Sets sample format.
|
||||
It defaults to S16_LE, so you probably will not use this.
|
||||
Expects (int *) in param, with available values found in the format enum.
|
||||
If invalid format is given, param might be changed to reflect the sample format the library will use.
|
||||
|
||||
RSD_IDENTITY: Sets an identity string associated with the client.
|
||||
@@ -244,14 +249,14 @@ Will be truncated if longer than 256 bytes.
|
||||
|
||||
int rsd_set_param (rsound_t *rd, enum rsd_settings option, void* param);
|
||||
|
||||
/* Enables use of the callback interface. This must be set when stream is not active.
|
||||
When callback is active, use of the blocking interface is disabled.
|
||||
Only valid functions to call after rsd_start() is stopping the stream with either rsd_pause() or rsd_stop(). Calling any other function is undefined.
|
||||
The callback is called at regular intervals and is asynchronous, so thread safety must be ensured by the caller.
|
||||
If not enough data can be given to the callback, librsound will fill the rest of the callback data with silence.
|
||||
/* Enables use of the callback interface. This must be set when stream is not active.
|
||||
When callback is active, use of the blocking interface is disabled.
|
||||
Only valid functions to call after rsd_start() is stopping the stream with either rsd_pause() or rsd_stop(). Calling any other function is undefined.
|
||||
The callback is called at regular intervals and is asynchronous, so thread safety must be ensured by the caller.
|
||||
If not enough data can be given to the callback, librsound will fill the rest of the callback data with silence.
|
||||
librsound will attempt to obey latency information given with RSD_LATENCY as given before calling rsd_start().
|
||||
max_size signifies the maximum size that will ever be requested by librsound. Set this to 0 to let librsound decide the maximum size.
|
||||
Should an error occur to the stream, err_callback will be called, and the stream will be stopped. The stream can be started again.
|
||||
Should an error occur to the stream, err_callback will be called, and the stream will be stopped. The stream can be started again.
|
||||
|
||||
Callbacks can be disabled by setting callbacks to NULL. */
|
||||
|
||||
@@ -260,37 +265,37 @@ void rsd_set_callback (rsound_t *rd, rsd_audio_callback_t callback, rsd_error_ca
|
||||
/* Lock and unlock the callback. When the callback lock is aquired, the callback is guaranteed to not be executing.
|
||||
The lock has to be unlocked afterwards.
|
||||
Attemping to call several rsd_callback_lock() in succession might cause a deadlock.
|
||||
The lock should be held for as short period as possible.
|
||||
The lock should be held for as short period as possible.
|
||||
Try to avoid calling code that may block when holding the lock. */
|
||||
void rsd_callback_lock (rsound_t *rd);
|
||||
|
||||
void rsd_callback_unlock (rsound_t *rd);
|
||||
|
||||
/* Establishes connection to server. Might fail if connection can't be established or that one of
|
||||
/* Establishes connection to server. Might fail if connection can't be established or that one of
|
||||
the mandatory options isn't set in rsd_set_param(). This needs to be called after params have been set
|
||||
with rsd_set_param(), and before rsd_write(). */
|
||||
with rsd_set_param(), and before rsd_write(). */
|
||||
int rsd_start (rsound_t *rd);
|
||||
|
||||
/* Shuts down the rsound data structures, but returns the file descriptor associated with the connection.
|
||||
The control socket will be shut down. If this function returns a negative number, the exec failed,
|
||||
but the data structures will not be teared down.
|
||||
The control socket will be shut down. If this function returns a negative number, the exec failed,
|
||||
but the data structures will not be teared down.
|
||||
Should a valid file descriptor be returned, it will always be blocking.
|
||||
This call will block until all internal buffers have been sent to the network. */
|
||||
int rsd_exec (rsound_t *rd);
|
||||
|
||||
/* Disconnects from server. All audio data still in network buffer and other buffers will be dropped.
|
||||
/* Disconnects from server. All audio data still in network buffer and other buffers will be dropped.
|
||||
To continue playing, you will need to rsd_start() again. */
|
||||
int rsd_stop (rsound_t *rd);
|
||||
|
||||
/* Writes from buf to the internal buffer. Might fail if no connection is established,
|
||||
/* Writes from buf to the internal buffer. Might fail if no connection is established,
|
||||
or there was an unexpected error. This function will block until all data has
|
||||
been written to the buffer. This function will return the number of bytes written to the buffer,
|
||||
or 0 should it fail (disconnection from server). You will have to restart the stream again should this occur. */
|
||||
size_t rsd_write (rsound_t *rd, const void* buf, size_t size);
|
||||
|
||||
/* Gets the position of the buffer pointer.
|
||||
Not really interesting for normal applications.
|
||||
Might be useful for implementing rsound on top of other blocking APIs.
|
||||
/* Gets the position of the buffer pointer.
|
||||
Not really interesting for normal applications.
|
||||
Might be useful for implementing rsound on top of other blocking APIs.
|
||||
*NOTE* This function is deprecated, it should not be used in new applications. */
|
||||
size_t rsd_pointer (rsound_t *rd);
|
||||
|
||||
@@ -306,18 +311,20 @@ size_t rsd_delay_ms (rsound_t *rd);
|
||||
/* Returns bytes per sample */
|
||||
int rsd_samplesize(rsound_t *rd);
|
||||
|
||||
/* Will sleep until latency of stream reaches maximum allowed latency defined earlier by rsd_set_param - RSD_LATENCY
|
||||
/* Will sleep until latency of stream reaches maximum allowed latency defined earlier by rsd_set_param - RSD_LATENCY
|
||||
Useful for hard headed blocking I/O design where user defined latency is needed. If rsd_set_param hasn't been set
|
||||
with RSD_LATENCY, this function will do nothing. */
|
||||
void rsd_delay_wait(rsound_t *rd);
|
||||
|
||||
/* Pauses or unpauses a stream. pause -> enable = 1
|
||||
/* Pauses or unpauses a stream. pause -> enable = 1
|
||||
This function essentially calls on start() and stop(). This behavior might be changed later. */
|
||||
int rsd_pause (rsound_t *rd, int enable);
|
||||
|
||||
/* Frees an rsound_t struct. Make sure that the stream is properly closed down with rsd_stop() before calling rsd_free(). */
|
||||
int rsd_free (rsound_t *rd);
|
||||
|
||||
RETRO_END_DECLS
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+12
-15
@@ -1,7 +1,6 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2015 - Michael Lelli
|
||||
* 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.
|
||||
@@ -19,6 +18,7 @@
|
||||
#include <boolean.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../configuration.h"
|
||||
|
||||
/* forward declarations */
|
||||
unsigned RWebAudioSampleRate(void);
|
||||
@@ -37,17 +37,16 @@ static void rwebaudio_free(void *data)
|
||||
RWebAudioFree();
|
||||
}
|
||||
|
||||
static void *rwebaudio_init(const char *device, unsigned rate, unsigned latency,
|
||||
unsigned block_frames,
|
||||
unsigned *new_rate)
|
||||
static void *rwebaudio_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
void *data = RWebAudioInit(latency);
|
||||
|
||||
(void)device;
|
||||
(void)rate;
|
||||
|
||||
if (data)
|
||||
*new_rate = RWebAudioSampleRate();
|
||||
settings->audio.out_rate = RWebAudioSampleRate();
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -76,13 +75,19 @@ static bool rwebaudio_alive(void *data)
|
||||
return !rwebaudio_is_paused;
|
||||
}
|
||||
|
||||
static bool rwebaudio_start(void *data, bool is_shutdown)
|
||||
static bool rwebaudio_start(void *data)
|
||||
{
|
||||
(void)data;
|
||||
rwebaudio_is_paused = false;
|
||||
return RWebAudioStart();
|
||||
}
|
||||
|
||||
static bool rwebaudio_use_float(void *data)
|
||||
{
|
||||
(void)data;
|
||||
return true;
|
||||
}
|
||||
|
||||
static size_t rwebaudio_write_avail(void *data)
|
||||
{
|
||||
(void)data;
|
||||
@@ -95,12 +100,6 @@ static size_t rwebaudio_buffer_size(void *data)
|
||||
return RWebAudioBufferSize();
|
||||
}
|
||||
|
||||
static bool rwebaudio_use_float(void *data)
|
||||
{
|
||||
(void)data;
|
||||
return true;
|
||||
}
|
||||
|
||||
audio_driver_t audio_rwebaudio = {
|
||||
rwebaudio_init,
|
||||
rwebaudio_write,
|
||||
@@ -111,8 +110,6 @@ audio_driver_t audio_rwebaudio = {
|
||||
rwebaudio_free,
|
||||
rwebaudio_use_float,
|
||||
"rwebaudio",
|
||||
NULL,
|
||||
NULL,
|
||||
rwebaudio_write_avail,
|
||||
rwebaudio_buffer_size,
|
||||
};
|
||||
+26
-43
@@ -1,7 +1,6 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
@@ -24,11 +23,11 @@
|
||||
|
||||
#include <boolean.h>
|
||||
#include <rthreads/rthreads.h>
|
||||
#include <queues/fifo_queue.h>
|
||||
#include <queues/fifo_buffer.h>
|
||||
#include <retro_inline.h>
|
||||
#include <retro_math.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
typedef struct sdl_audio
|
||||
@@ -36,23 +35,19 @@ typedef struct sdl_audio
|
||||
bool nonblock;
|
||||
bool is_paused;
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
slock_t *lock;
|
||||
scond_t *cond;
|
||||
#endif
|
||||
fifo_buffer_t *buffer;
|
||||
} sdl_audio_t;
|
||||
|
||||
static void sdl_audio_cb(void *data, Uint8 *stream, int len)
|
||||
{
|
||||
sdl_audio_t *sdl = (sdl_audio_t*)data;
|
||||
size_t avail = fifo_read_avail(sdl->buffer);
|
||||
sdl_audio_t *sdl = (sdl_audio_t*)data;
|
||||
size_t avail = fifo_read_avail(sdl->buffer);
|
||||
size_t write_size = len > (int)avail ? avail : len;
|
||||
|
||||
fifo_read(sdl->buffer, stream, write_size);
|
||||
#ifdef HAVE_THREADS
|
||||
scond_signal(sdl->cond);
|
||||
#endif
|
||||
|
||||
/* If underrun, fill rest with silence. */
|
||||
memset(stream + write_size, 0, len - write_size);
|
||||
@@ -68,15 +63,14 @@ static INLINE int find_num_frames(int rate, int latency)
|
||||
}
|
||||
|
||||
static void *sdl_audio_init(const char *device,
|
||||
unsigned rate, unsigned latency,
|
||||
unsigned block_frames,
|
||||
unsigned *new_rate)
|
||||
unsigned rate, unsigned latency)
|
||||
{
|
||||
int frames;
|
||||
size_t bufsize;
|
||||
void *tmp;
|
||||
SDL_AudioSpec out;
|
||||
SDL_AudioSpec spec = {0};
|
||||
void *tmp = NULL;
|
||||
SDL_AudioSpec spec = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
sdl_audio_t *sdl = NULL;
|
||||
|
||||
(void)device;
|
||||
@@ -93,38 +87,37 @@ static void *sdl_audio_init(const char *device,
|
||||
if (!sdl)
|
||||
return NULL;
|
||||
|
||||
/* We have to buffer up some data ourselves, so we let SDL
|
||||
/* We have to buffer up some data ourselves, so we let SDL
|
||||
* carry approximately half of the latency.
|
||||
*
|
||||
* SDL double buffers audio and we do as well. */
|
||||
frames = find_num_frames(rate, latency / 4);
|
||||
frames = find_num_frames(rate, latency / 4);
|
||||
|
||||
spec.freq = rate;
|
||||
spec.format = AUDIO_S16SYS;
|
||||
spec.freq = rate;
|
||||
spec.format = AUDIO_S16SYS;
|
||||
spec.channels = 2;
|
||||
spec.samples = frames; /* This is in audio frames, not samples ... :( */
|
||||
spec.samples = frames; /* This is in audio frames, not samples ... :( */
|
||||
spec.callback = sdl_audio_cb;
|
||||
spec.userdata = sdl;
|
||||
|
||||
if (SDL_OpenAudio(&spec, &out) < 0)
|
||||
{
|
||||
RARCH_ERR("[SDL audio]: Failed to open SDL audio: %s\n", SDL_GetError());
|
||||
goto error;
|
||||
RARCH_ERR("Failed to open SDL audio: %s\n", SDL_GetError());
|
||||
free(sdl);
|
||||
return 0;
|
||||
}
|
||||
|
||||
*new_rate = out.freq;
|
||||
settings->audio.out_rate = out.freq;
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
sdl->lock = slock_new();
|
||||
sdl->cond = scond_new();
|
||||
#endif
|
||||
sdl->lock = slock_new();
|
||||
sdl->cond = scond_new();
|
||||
|
||||
RARCH_LOG("[SDL audio]: Requested %u ms latency, got %d ms\n",
|
||||
latency, (int)(out.samples * 4 * 1000 / (*new_rate)));
|
||||
RARCH_LOG("SDL audio: Requested %u ms latency, got %d ms\n",
|
||||
latency, (int)(out.samples * 4 * 1000 / settings->audio.out_rate));
|
||||
|
||||
/* Create a buffer twice as big as needed and prefill the buffer. */
|
||||
bufsize = out.samples * 4 * sizeof(int16_t);
|
||||
tmp = calloc(1, bufsize);
|
||||
bufsize = out.samples * 4 * sizeof(int16_t);
|
||||
tmp = calloc(1, bufsize);
|
||||
sdl->buffer = fifo_new(bufsize);
|
||||
|
||||
if (tmp)
|
||||
@@ -135,15 +128,11 @@ static void *sdl_audio_init(const char *device,
|
||||
|
||||
SDL_PauseAudio(0);
|
||||
return sdl;
|
||||
|
||||
error:
|
||||
free(sdl);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static ssize_t sdl_audio_write(void *data, const void *buf, size_t size)
|
||||
{
|
||||
ssize_t ret = 0;
|
||||
ssize_t ret = 0;
|
||||
sdl_audio_t *sdl = (sdl_audio_t*)data;
|
||||
|
||||
if (sdl->nonblock)
|
||||
@@ -171,11 +160,9 @@ static ssize_t sdl_audio_write(void *data, const void *buf, size_t size)
|
||||
if (avail == 0)
|
||||
{
|
||||
SDL_UnlockAudio();
|
||||
#ifdef HAVE_THREADS
|
||||
slock_lock(sdl->lock);
|
||||
scond_wait(sdl->cond, sdl->lock);
|
||||
slock_unlock(sdl->lock);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -207,7 +194,7 @@ static bool sdl_audio_alive(void *data)
|
||||
return !sdl->is_paused;
|
||||
}
|
||||
|
||||
static bool sdl_audio_start(void *data, bool is_shutdown)
|
||||
static bool sdl_audio_start(void *data)
|
||||
{
|
||||
sdl_audio_t *sdl = (sdl_audio_t*)data;
|
||||
sdl->is_paused = false;
|
||||
@@ -233,10 +220,8 @@ static void sdl_audio_free(void *data)
|
||||
if (sdl)
|
||||
{
|
||||
fifo_free(sdl->buffer);
|
||||
#ifdef HAVE_THREADS
|
||||
slock_free(sdl->lock);
|
||||
scond_free(sdl->cond);
|
||||
#endif
|
||||
}
|
||||
free(sdl);
|
||||
}
|
||||
@@ -268,8 +253,6 @@ audio_driver_t audio_sdl = {
|
||||
#else
|
||||
"sdl",
|
||||
#endif
|
||||
NULL,
|
||||
NULL,
|
||||
sdl_audio_write_avail,
|
||||
NULL
|
||||
};
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,337 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2014-2017 - Ali Bouhlel
|
||||
* Copyright (C) 2016-2017 - FIX94
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <wiiu/os.h>
|
||||
#include <wiiu/ax.h>
|
||||
|
||||
#include "wiiu/wiiu_dbg.h"
|
||||
#include "wiiu/system/memory.h"
|
||||
|
||||
#include "audio/audio_driver.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
AXMVoice* mvoice;
|
||||
uint16_t* buffer_l;
|
||||
uint16_t* buffer_r;
|
||||
bool nonblocking;
|
||||
|
||||
uint32_t pos;
|
||||
uint32_t written;
|
||||
OSSpinLock spinlock;
|
||||
} ax_audio_t;
|
||||
|
||||
/* 3072 samples main buffer, 64ms total */
|
||||
#define AX_AUDIO_COUNT 3072
|
||||
#define AX_AUDIO_SIZE (AX_AUDIO_COUNT << 1u)
|
||||
|
||||
#define AX_AUDIO_SAMPLE_COUNT 144 /* 3ms */
|
||||
#define AX_AUDIO_SAMPLE_MIN (AX_AUDIO_SAMPLE_COUNT * 3) /* 9ms */
|
||||
#define AX_AUDIO_SAMPLE_LOAD (AX_AUDIO_SAMPLE_COUNT * 10)/* 30ms */
|
||||
#define AX_AUDIO_MAX_FREE (AX_AUDIO_COUNT - (AX_AUDIO_SAMPLE_COUNT * 2))
|
||||
#define AX_AUDIO_RATE 48000
|
||||
|
||||
#if 0
|
||||
#define ax_audio_ticks_to_samples(ticks) (((ticks) * 64) / 82875)
|
||||
#define ax_audio_samples_to_ticks(samples) (((samples) * 82875) / 64)
|
||||
#endif
|
||||
|
||||
static volatile ax_audio_t *wiiu_cb_ax = NULL;
|
||||
void wiiu_ax_callback(void)
|
||||
{
|
||||
/*possibly called before unregister */
|
||||
if(wiiu_cb_ax == NULL)
|
||||
return;
|
||||
|
||||
ax_audio_t *ax = (ax_audio_t*)wiiu_cb_ax;
|
||||
if(AXIsMultiVoiceRunning(ax->mvoice))
|
||||
{
|
||||
if(OSUninterruptibleSpinLock_Acquire(&ax->spinlock))
|
||||
{
|
||||
/* Buffer underrun, stop playback to let it fill up */
|
||||
if(ax->written < AX_AUDIO_SAMPLE_MIN)
|
||||
AXSetMultiVoiceState(ax->mvoice, AX_VOICE_STATE_STOPPED);
|
||||
ax->written -= AX_AUDIO_SAMPLE_COUNT;
|
||||
OSUninterruptibleSpinLock_Release(&ax->spinlock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern void AXRegisterFrameCallback(void *cb);
|
||||
|
||||
static void* ax_audio_init(const char* device, unsigned rate, unsigned latency,
|
||||
unsigned block_frames,
|
||||
unsigned *new_rate)
|
||||
{
|
||||
AXVoiceOffsets offsets[2];
|
||||
u16 setup_buf[0x30] = {0};
|
||||
setup_buf[0x25] = 2; /* we request 2 channels */
|
||||
AXInitParams init = {AX_INIT_RENDERER_48KHZ, 0, 0};
|
||||
AXVoiceVeData ve = {0xF000, 0};
|
||||
ax_audio_t* ax = (ax_audio_t*)calloc(1, sizeof(ax_audio_t));
|
||||
|
||||
if (!ax)
|
||||
return NULL;
|
||||
|
||||
AXInitWithParams(&init);
|
||||
|
||||
AXAcquireMultiVoice(31, NULL, 0, setup_buf, &ax->mvoice);
|
||||
|
||||
if (!ax->mvoice || ax->mvoice->channels != 2)
|
||||
{
|
||||
free(ax);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ax->buffer_l = MEM1_alloc(AX_AUDIO_SIZE, 0x100);
|
||||
ax->buffer_r = MEM1_alloc(AX_AUDIO_SIZE, 0x100);
|
||||
memset(ax->buffer_l,0,AX_AUDIO_SIZE);
|
||||
memset(ax->buffer_r,0,AX_AUDIO_SIZE);
|
||||
DCFlushRange(ax->buffer_l,AX_AUDIO_SIZE);
|
||||
DCFlushRange(ax->buffer_r,AX_AUDIO_SIZE);
|
||||
|
||||
/* shared by both voices */
|
||||
offsets[0].currentOffset = 0;
|
||||
offsets[0].loopOffset = 0;
|
||||
offsets[0].endOffset = AX_AUDIO_COUNT - 1;
|
||||
offsets[0].loopingEnabled = AX_VOICE_LOOP_ENABLED;
|
||||
offsets[0].dataType = AX_VOICE_FORMAT_LPCM16;
|
||||
memcpy(&offsets[1], &offsets[0], sizeof(AXVoiceOffsets));
|
||||
|
||||
/* different buffers per voice */
|
||||
offsets[0].data = ax->buffer_l;
|
||||
offsets[1].data = ax->buffer_r;
|
||||
AXSetMultiVoiceOffsets(ax->mvoice, offsets);
|
||||
|
||||
AXSetMultiVoiceSrcType(ax->mvoice, AX_VOICE_SRC_TYPE_NONE);
|
||||
AXSetMultiVoiceSrcRatio(ax->mvoice, 1.0f);
|
||||
|
||||
AXSetMultiVoiceVe(ax->mvoice, &ve);
|
||||
|
||||
AXSetMultiVoiceDeviceMix(ax->mvoice, AX_DEVICE_TYPE_DRC, 0, 0, 0x8000, 0);
|
||||
AXSetMultiVoiceDeviceMix(ax->mvoice, AX_DEVICE_TYPE_TV, 0, 0, 0x8000, 0);
|
||||
|
||||
AXSetMultiVoiceState(ax->mvoice, AX_VOICE_STATE_STOPPED);
|
||||
|
||||
ax->pos = 0;
|
||||
ax->written = 0;
|
||||
*new_rate = AX_AUDIO_RATE;
|
||||
|
||||
OSInitSpinLock(&ax->spinlock);
|
||||
|
||||
wiiu_cb_ax = ax;
|
||||
AXRegisterFrameCallback(wiiu_ax_callback);
|
||||
|
||||
return ax;
|
||||
}
|
||||
|
||||
static void ax_audio_free(void* data)
|
||||
{
|
||||
ax_audio_t* ax = (ax_audio_t*)data;
|
||||
wiiu_cb_ax = NULL;
|
||||
|
||||
AXRegisterFrameCallback(NULL);
|
||||
AXFreeMultiVoice(ax->mvoice);
|
||||
AXQuit();
|
||||
|
||||
MEM1_free(ax->buffer_l);
|
||||
MEM1_free(ax->buffer_r);
|
||||
free(ax);
|
||||
}
|
||||
|
||||
static bool ax_audio_stop(void* data)
|
||||
{
|
||||
ax_audio_t* ax = (ax_audio_t*)data;
|
||||
|
||||
AXSetMultiVoiceState(ax->mvoice, AX_VOICE_STATE_STOPPED);
|
||||
return true;
|
||||
}
|
||||
|
||||
static int ax_audio_limit(int in)
|
||||
{
|
||||
if(in < 0)
|
||||
in += AX_AUDIO_COUNT;
|
||||
else if(in >= AX_AUDIO_COUNT)
|
||||
in -= AX_AUDIO_COUNT;
|
||||
return in;
|
||||
}
|
||||
|
||||
static bool ax_audio_start(void* data, bool is_shutdown)
|
||||
{
|
||||
ax_audio_t* ax = (ax_audio_t*)data;
|
||||
|
||||
/* Prevents restarting audio when the menu
|
||||
* is toggled off on shutdown */
|
||||
if (is_shutdown)
|
||||
return true;
|
||||
|
||||
/* Set back to playing on enough buffered data */
|
||||
if(ax->written > AX_AUDIO_SAMPLE_LOAD)
|
||||
{
|
||||
AXSetMultiVoiceCurrentOffset(ax->mvoice, ax_audio_limit(ax->pos - ax->written));
|
||||
AXSetMultiVoiceState(ax->mvoice, AX_VOICE_STATE_PLAYING);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static ssize_t ax_audio_write(void* data, const void* buf, size_t size)
|
||||
{
|
||||
uint32_t i;
|
||||
size_t countAvail = 0;
|
||||
ax_audio_t* ax = (ax_audio_t*)data;
|
||||
const uint16_t* src = buf;
|
||||
size_t count = size >> 2;
|
||||
|
||||
if(!size || (size & 0x3))
|
||||
return 0;
|
||||
|
||||
if(count > AX_AUDIO_MAX_FREE)
|
||||
count = AX_AUDIO_MAX_FREE;
|
||||
|
||||
countAvail = ((ax->written > AX_AUDIO_MAX_FREE) ? 0 : (AX_AUDIO_MAX_FREE - ax->written));
|
||||
|
||||
if (ax->nonblocking)
|
||||
{
|
||||
/* Not enough available for 3ms of data */
|
||||
if(countAvail < AX_AUDIO_SAMPLE_COUNT)
|
||||
count = 0;
|
||||
}
|
||||
else if(countAvail < count)
|
||||
{
|
||||
/* Sync, wait for free memory */
|
||||
while(AXIsMultiVoiceRunning(ax->mvoice) && (countAvail < count))
|
||||
{
|
||||
OSYieldThread(); /* Gives threads with same priority time to run */
|
||||
countAvail = (ax->written > AX_AUDIO_MAX_FREE ? 0 : (AX_AUDIO_MAX_FREE - ax->written));
|
||||
}
|
||||
}
|
||||
|
||||
/* Over available space, do as much as possible */
|
||||
if(count > countAvail)
|
||||
count = countAvail;
|
||||
|
||||
/* make sure we have input size */
|
||||
if(count > 0)
|
||||
{
|
||||
/* write in new data */
|
||||
size_t startPos = ax->pos;
|
||||
int flushP2needed = 0;
|
||||
int flushP2 = 0;
|
||||
|
||||
for (i = 0; i < (count << 1); i += 2)
|
||||
{
|
||||
ax->buffer_l[ax->pos] = src[i];
|
||||
ax->buffer_r[ax->pos] = src[i + 1];
|
||||
ax->pos = ax_audio_limit(ax->pos + 1);
|
||||
|
||||
/* wrapped around, make sure to store cache */
|
||||
if(ax->pos == 0)
|
||||
{
|
||||
flushP2needed = 1;
|
||||
flushP2 = ((count << 1) - i);
|
||||
DCStoreRangeNoSync(ax->buffer_l+startPos, (AX_AUDIO_COUNT-startPos) << 1);
|
||||
DCStoreRangeNoSync(ax->buffer_r+startPos, (AX_AUDIO_COUNT-startPos) << 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* standard cache store case */
|
||||
if(!flushP2needed)
|
||||
{
|
||||
DCStoreRangeNoSync(ax->buffer_l+startPos, count << 1);
|
||||
DCStoreRange(ax->buffer_r+startPos, count << 1);
|
||||
}
|
||||
/* store the rest after wrap */
|
||||
else if(flushP2 > 0)
|
||||
{
|
||||
DCStoreRangeNoSync(ax->buffer_l, flushP2);
|
||||
DCStoreRange(ax->buffer_r, flushP2);
|
||||
}
|
||||
|
||||
/* add in new audio data */
|
||||
if(OSUninterruptibleSpinLock_Acquire(&ax->spinlock))
|
||||
{
|
||||
ax->written += count;
|
||||
OSUninterruptibleSpinLock_Release(&ax->spinlock);
|
||||
}
|
||||
}
|
||||
|
||||
/* Possibly buffer underrun
|
||||
*
|
||||
* checks if it can be started
|
||||
*/
|
||||
if(!AXIsMultiVoiceRunning(ax->mvoice))
|
||||
ax_audio_start(ax, false);
|
||||
|
||||
/* return what was actually copied */
|
||||
return (count << 2);
|
||||
}
|
||||
|
||||
static bool ax_audio_alive(void* data)
|
||||
{
|
||||
ax_audio_t* ax = (ax_audio_t*)data;
|
||||
return AXIsMultiVoiceRunning(ax->mvoice);
|
||||
}
|
||||
|
||||
static void ax_audio_set_nonblock_state(void* data, bool state)
|
||||
{
|
||||
ax_audio_t* ax = (ax_audio_t*)data;
|
||||
|
||||
if (ax)
|
||||
ax->nonblocking = state;
|
||||
}
|
||||
|
||||
static bool ax_audio_use_float(void* data)
|
||||
{
|
||||
(void)data;
|
||||
return false;
|
||||
}
|
||||
|
||||
static size_t ax_audio_write_avail(void* data)
|
||||
{
|
||||
ax_audio_t* ax = (ax_audio_t*)data;
|
||||
|
||||
size_t ret = AX_AUDIO_COUNT - ax->written;
|
||||
|
||||
return (ret < AX_AUDIO_SAMPLE_COUNT ? 0 : ret);
|
||||
}
|
||||
|
||||
static size_t ax_audio_buffer_size(void* data)
|
||||
{
|
||||
(void)data;
|
||||
return AX_AUDIO_COUNT;
|
||||
}
|
||||
|
||||
|
||||
audio_driver_t audio_ax =
|
||||
{
|
||||
ax_audio_init,
|
||||
ax_audio_write,
|
||||
ax_audio_stop,
|
||||
ax_audio_start,
|
||||
ax_audio_alive,
|
||||
ax_audio_set_nonblock_state,
|
||||
ax_audio_free,
|
||||
ax_audio_use_float,
|
||||
"AX",
|
||||
NULL, /* device_list_new */
|
||||
NULL, /* device_list_free */
|
||||
NULL, /* write_avail */
|
||||
NULL, /* buffer_size */
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
@@ -14,12 +14,6 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(_XBOX) && (_MSC_VER == 1310)
|
||||
#ifndef _WIN32_DCOM
|
||||
#define _WIN32_DCOM
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
@@ -29,14 +23,10 @@
|
||||
#include <compat/msvc.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#if defined(_MSC_VER) && (_WIN32_WINNT <= _WIN32_WINNT_WIN2K)
|
||||
/* needed for CoInitializeEx */
|
||||
#define _WIN32_DCOM
|
||||
#endif
|
||||
|
||||
#include "xaudio.h"
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
typedef struct xaudio2 xaudio2_t;
|
||||
@@ -45,12 +35,6 @@ typedef struct xaudio2 xaudio2_t;
|
||||
|
||||
#define MAX_BUFFERS_MASK (MAX_BUFFERS - 1)
|
||||
|
||||
#ifndef COINIT_MULTITHREADED
|
||||
#define COINIT_MULTITHREADED 0x00
|
||||
#endif
|
||||
|
||||
#define XAUDIO2_WRITE_AVAILABLE(handle) ((handle)->bufsize * (MAX_BUFFERS - (handle)->buffers - 1))
|
||||
|
||||
typedef struct
|
||||
{
|
||||
xaudio2_t *xa;
|
||||
@@ -59,13 +43,8 @@ typedef struct
|
||||
size_t bufsize;
|
||||
} xa_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
struct xaudio2 : public IXAudio2VoiceCallback
|
||||
#else
|
||||
struct xaudio2
|
||||
#endif
|
||||
{
|
||||
#ifdef __cplusplus
|
||||
xaudio2() :
|
||||
buf(0), pXAudio2(0), pMasterVoice(0),
|
||||
pSourceVoice(0), hEvent(0), buffers(0), bufsize(0),
|
||||
@@ -75,7 +54,7 @@ struct xaudio2
|
||||
virtual ~xaudio2() {}
|
||||
|
||||
STDMETHOD_(void, OnBufferStart) (void *) {}
|
||||
STDMETHOD_(void, OnBufferEnd) (void *)
|
||||
STDMETHOD_(void, OnBufferEnd) (void *)
|
||||
{
|
||||
InterlockedDecrement((LONG volatile*)&buffers);
|
||||
SetEvent(hEvent);
|
||||
@@ -85,9 +64,6 @@ struct xaudio2
|
||||
STDMETHOD_(void, OnVoiceError) (void *, HRESULT) {}
|
||||
STDMETHOD_(void, OnVoiceProcessingPassEnd) () {}
|
||||
STDMETHOD_(void, OnVoiceProcessingPassStart) (UINT32) {}
|
||||
#else
|
||||
const IXAudio2VoiceCallbackVtbl *lpVtbl;
|
||||
#endif
|
||||
|
||||
uint8_t *buf;
|
||||
IXAudio2 *pXAudio2;
|
||||
@@ -101,31 +77,6 @@ struct xaudio2
|
||||
unsigned write_buffer;
|
||||
};
|
||||
|
||||
#ifndef __cplusplus
|
||||
static void WINAPI voice_on_buffer_end(void *handle_, void *data)
|
||||
{
|
||||
xaudio2_t *handle = (xaudio2_t*)handle_;
|
||||
(void)data;
|
||||
InterlockedDecrement((LONG volatile*)&handle->buffers);
|
||||
SetEvent(handle->hEvent);
|
||||
}
|
||||
|
||||
static void WINAPI dummy_voidp(void *handle, void *data) { (void)handle; (void)data; }
|
||||
static void WINAPI dummy_nil(void *handle) { (void)handle; }
|
||||
static void WINAPI dummy_uint32(void *handle, UINT32 dummy) { (void)handle; (void)dummy; }
|
||||
static void WINAPI dummy_voidp_hresult(void *handle, void *data, HRESULT dummy) { (void)handle; (void)data; (void)dummy; }
|
||||
|
||||
const struct IXAudio2VoiceCallbackVtbl voice_vtable = {
|
||||
dummy_uint32,
|
||||
dummy_nil,
|
||||
dummy_nil,
|
||||
dummy_voidp,
|
||||
voice_on_buffer_end,
|
||||
dummy_voidp,
|
||||
dummy_voidp_hresult,
|
||||
};
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
static void xaudio2_enumerate_devices(xaudio2_t *xa)
|
||||
{
|
||||
@@ -136,13 +87,13 @@ static void xaudio2_enumerate_devices(xaudio2_t *xa)
|
||||
(void)i;
|
||||
(void)dev_count;
|
||||
#ifndef _XBOX
|
||||
IXAudio2_GetDeviceCount(xa->pXAudio2, &dev_count);
|
||||
xa->pXAudio2->GetDeviceCount(&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);
|
||||
xa->pXAudio2->GetDeviceDetails(i, &dev_detail);
|
||||
fwprintf(stderr, L"\t%u: %s\n", i, dev_detail.DisplayName);
|
||||
}
|
||||
#endif
|
||||
@@ -169,68 +120,47 @@ static void xaudio2_free(xaudio2_t *handle)
|
||||
|
||||
if (handle->pSourceVoice)
|
||||
{
|
||||
IXAudio2SourceVoice_Stop(handle->pSourceVoice,
|
||||
0, XAUDIO2_COMMIT_NOW);
|
||||
IXAudio2SourceVoice_DestroyVoice(handle->pSourceVoice);
|
||||
handle->pSourceVoice->Stop(0, XAUDIO2_COMMIT_NOW);
|
||||
handle->pSourceVoice->DestroyVoice();
|
||||
}
|
||||
|
||||
if (handle->pMasterVoice)
|
||||
{
|
||||
IXAudio2MasteringVoice_DestroyVoice(handle->pMasterVoice);
|
||||
}
|
||||
handle->pMasterVoice->DestroyVoice();
|
||||
|
||||
if (handle->pXAudio2)
|
||||
{
|
||||
IXAudio2_Release(handle->pXAudio2);
|
||||
}
|
||||
handle->pXAudio2->Release();
|
||||
|
||||
if (handle->hEvent)
|
||||
CloseHandle(handle->hEvent);
|
||||
|
||||
free(handle->buf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
delete handle;
|
||||
#else
|
||||
free(handle);
|
||||
#endif
|
||||
}
|
||||
|
||||
static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels,
|
||||
size_t size, unsigned device)
|
||||
{
|
||||
xaudio2_t *handle = NULL;
|
||||
WAVEFORMATEX wfx = {0};
|
||||
xaudio2_t *handle;
|
||||
WAVEFORMATEX wfx = {0};
|
||||
|
||||
#ifndef _XBOX
|
||||
CoInitializeEx(0, COINIT_MULTITHREADED);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
handle = new xaudio2;
|
||||
#else
|
||||
handle = (xaudio2_t*)calloc(1, sizeof(*handle));
|
||||
#endif
|
||||
|
||||
if (!handle)
|
||||
goto error;
|
||||
|
||||
#ifndef __cplusplus
|
||||
handle->lpVtbl = &voice_vtable;
|
||||
#endif
|
||||
|
||||
if (FAILED(XAudio2Create(&handle->pXAudio2, 0, XAUDIO2_DEFAULT_PROCESSOR)))
|
||||
goto error;
|
||||
|
||||
if (FAILED(IXAudio2_CreateMasteringVoice(handle->pXAudio2, &handle->pMasterVoice, channels, samplerate, 0, device, NULL)))
|
||||
if (FAILED(handle->pXAudio2->CreateMasteringVoice(&handle->pMasterVoice,
|
||||
channels, samplerate, 0, device, NULL)))
|
||||
goto error;
|
||||
|
||||
xaudio2_set_wavefmt(&wfx, channels, samplerate);
|
||||
|
||||
if (FAILED(IXAudio2_CreateSourceVoice(handle->pXAudio2,
|
||||
&handle->pSourceVoice, &wfx,
|
||||
if (FAILED(handle->pXAudio2->CreateSourceVoice(&handle->pSourceVoice, &wfx,
|
||||
XAUDIO2_VOICE_NOSRC, XAUDIO2_DEFAULT_FREQ_RATIO,
|
||||
(IXAudio2VoiceCallback*)handle, 0, 0)))
|
||||
handle)))
|
||||
goto error;
|
||||
|
||||
handle->hEvent = CreateEvent(0, FALSE, FALSE, 0);
|
||||
@@ -242,8 +172,7 @@ static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels,
|
||||
if (!handle->buf)
|
||||
goto error;
|
||||
|
||||
if (FAILED(IXAudio2SourceVoice_Start(handle->pSourceVoice, 0,
|
||||
XAUDIO2_COMMIT_NOW)))
|
||||
if (FAILED(handle->pSourceVoice->Start(0)))
|
||||
goto error;
|
||||
|
||||
return handle;
|
||||
@@ -253,16 +182,21 @@ error:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static size_t xaudio2_write(xaudio2_t *handle, const uint8_t *buffer, size_t bytes_)
|
||||
static size_t xaudio2_write_avail(xaudio2_t *handle)
|
||||
{
|
||||
unsigned bytes = bytes_;
|
||||
return handle->bufsize * (MAX_BUFFERS - handle->buffers - 1);
|
||||
}
|
||||
|
||||
static size_t xaudio2_write(xaudio2_t *handle, const void *buf, size_t bytes_)
|
||||
{
|
||||
unsigned bytes = bytes_;
|
||||
const uint8_t *buffer = (const uint8_t*)buf;
|
||||
|
||||
while (bytes)
|
||||
{
|
||||
unsigned need = MIN(bytes, handle->bufsize - handle->bufptr);
|
||||
|
||||
memcpy(handle->buf + handle->write_buffer *
|
||||
handle->bufsize + handle->bufptr,
|
||||
memcpy(handle->buf + handle->write_buffer * handle->bufsize + handle->bufptr,
|
||||
buffer, need);
|
||||
|
||||
handle->bufptr += need;
|
||||
@@ -271,23 +205,15 @@ static size_t xaudio2_write(xaudio2_t *handle, const uint8_t *buffer, size_t byt
|
||||
|
||||
if (handle->bufptr == handle->bufsize)
|
||||
{
|
||||
XAUDIO2_BUFFER xa2buffer;
|
||||
XAUDIO2_BUFFER xa2buffer = {0};
|
||||
|
||||
while (handle->buffers == MAX_BUFFERS - 1)
|
||||
WaitForSingleObject(handle->hEvent, INFINITE);
|
||||
|
||||
xa2buffer.Flags = 0;
|
||||
xa2buffer.AudioBytes = handle->bufsize;
|
||||
xa2buffer.pAudioData = handle->buf + handle->write_buffer * handle->bufsize;
|
||||
xa2buffer.PlayBegin = 0;
|
||||
xa2buffer.PlayLength = 0;
|
||||
xa2buffer.LoopBegin = 0;
|
||||
xa2buffer.LoopLength = 0;
|
||||
xa2buffer.LoopCount = 0;
|
||||
xa2buffer.pContext = NULL;
|
||||
|
||||
if (FAILED(IXAudio2SourceVoice_SubmitSourceBuffer(
|
||||
handle->pSourceVoice, &xa2buffer, NULL)))
|
||||
if (FAILED(handle->pSourceVoice->SubmitSourceBuffer(&xa2buffer, NULL)))
|
||||
return 0;
|
||||
|
||||
InterlockedIncrement((LONG volatile*)&handle->buffers);
|
||||
@@ -299,13 +225,11 @@ static size_t xaudio2_write(xaudio2_t *handle, const uint8_t *buffer, size_t byt
|
||||
return bytes_;
|
||||
}
|
||||
|
||||
static void *xa_init(const char *device, unsigned rate, unsigned latency,
|
||||
unsigned block_frames,
|
||||
unsigned *new_rate)
|
||||
static void *xa_init(const char *device, unsigned rate, unsigned latency)
|
||||
{
|
||||
size_t bufsize;
|
||||
unsigned device_index = 0;
|
||||
xa_t *xa = (xa_t*)calloc(1, sizeof(*xa));
|
||||
xa_t *xa = (xa_t*)calloc(1, sizeof(*xa));
|
||||
if (!xa)
|
||||
return NULL;
|
||||
|
||||
@@ -340,7 +264,7 @@ static ssize_t xa_write(void *data, const void *buf, size_t size)
|
||||
|
||||
if (xa->nonblock)
|
||||
{
|
||||
size_t avail = XAUDIO2_WRITE_AVAILABLE(xa->xa);
|
||||
size_t avail = xaudio2_write_avail(xa->xa);
|
||||
|
||||
if (avail == 0)
|
||||
return 0;
|
||||
@@ -348,7 +272,7 @@ static ssize_t xa_write(void *data, const void *buf, size_t size)
|
||||
size = avail;
|
||||
}
|
||||
|
||||
ret = xaudio2_write(xa->xa, (const uint8_t*)buf, size);
|
||||
ret = xaudio2_write(xa->xa, buf, size);
|
||||
if (ret == 0 && size > 0)
|
||||
return -1;
|
||||
return ret;
|
||||
@@ -376,7 +300,7 @@ static void xa_set_nonblock_state(void *data, bool state)
|
||||
xa->nonblock = state;
|
||||
}
|
||||
|
||||
static bool xa_start(void *data, bool is_shutdown)
|
||||
static bool xa_start(void *data)
|
||||
{
|
||||
xa_t *xa = (xa_t*)data;
|
||||
xa->is_paused = false;
|
||||
@@ -404,7 +328,7 @@ static void xa_free(void *data)
|
||||
static size_t xa_write_avail(void *data)
|
||||
{
|
||||
xa_t *xa = (xa_t*)data;
|
||||
return XAUDIO2_WRITE_AVAILABLE(xa->xa);
|
||||
return xaudio2_write_avail(xa->xa);
|
||||
}
|
||||
|
||||
static size_t xa_buffer_size(void *data)
|
||||
@@ -423,8 +347,6 @@ audio_driver_t audio_xa = {
|
||||
xa_free,
|
||||
xa_use_float,
|
||||
"xaudio",
|
||||
NULL,
|
||||
NULL,
|
||||
xa_write_avail,
|
||||
xa_buffer_size,
|
||||
};
|
||||
+16
-82
@@ -1,8 +1,8 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
* 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.
|
||||
@@ -15,29 +15,20 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* Kinda stripped down. Only contains the bare essentials used in RetroArch. */
|
||||
// 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 */
|
||||
// All structures defined in this file use tight field packing
|
||||
#pragma pack(push, 1)
|
||||
|
||||
#ifdef __cplusplus
|
||||
#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) \
|
||||
@@ -47,7 +38,7 @@ 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 */
|
||||
#include <audiodefs.h> // Basic audio data types and constants
|
||||
|
||||
#else
|
||||
|
||||
@@ -57,11 +48,6 @@ DEFINE_IID(IXAudio2, 8bcf1f58, 9fe7, 4583, 8a, c6, e2, ad, c4, 65, c8, bb);
|
||||
#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) \
|
||||
@@ -69,13 +55,7 @@ DEFINE_IID(IXAudio2, 8bcf1f58, 9fe7, 4583, 8a, c6, e2, ad, c4, 65, c8, bb);
|
||||
#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_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
|
||||
@@ -119,11 +99,7 @@ typedef enum XAUDIO2_XBOX_HWTHREAD_SPECIFIER
|
||||
#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
|
||||
@@ -131,7 +107,7 @@ typedef enum XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER
|
||||
typedef enum XAUDIO2_FILTER_TYPE {
|
||||
LowPassFilter,
|
||||
BandPassFilter,
|
||||
HighPassFilter
|
||||
HighPassFilter
|
||||
} XAUDIO2_FILTER_TYPE;
|
||||
|
||||
typedef struct XAUDIO2_DEVICE_DETAILS
|
||||
@@ -142,8 +118,7 @@ typedef struct XAUDIO2_DEVICE_DETAILS
|
||||
WAVEFORMATEXTENSIBLE OutputFormat;
|
||||
} XAUDIO2_DEVICE_DETAILS;
|
||||
|
||||
/* Forward declarations. */
|
||||
#ifdef __cplusplus
|
||||
// Forward declarations.
|
||||
struct XAUDIO2_VOICE_DETAILS;
|
||||
struct XAUDIO2_VOICE_SENDS;
|
||||
struct XAUDIO2_EFFECT_DESCRIPTOR;
|
||||
@@ -155,20 +130,6 @@ 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
|
||||
{
|
||||
@@ -292,58 +253,31 @@ DECLARE_INTERFACE_(IXAudio2, IUnknown)
|
||||
void *pReserved X2DEFAULT(NULL)) PURE;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
/* 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(THIS,a,b) (THIS)->lpVtbl->Initialize(THIS, a, b)
|
||||
#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_CreateMasteringVoice(THIS,ppMasteringVoice,InputChannels,InputSampleRate,Flags,DeviceIndex,pEffectChain) (THIS)->lpVtbl->CreateMasteringVoice(THIS, ppMasteringVoice,InputChannels,InputSampleRate,Flags,DeviceIndex,pEffectChain)
|
||||
#define IXAudio2_GetDeviceCount(THIS, puCount) (THIS)->lpVtbl->GetDeviceCount(THIS, puCount)
|
||||
#define IXAudio2_GetDeviceDetails(THIS, Index,pDeviceDetails) (THIS)->lpVtbl->GetDeviceDetails(THIS, Index, pDeviceDetails)
|
||||
#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_DestroyVoice(THIS) (THIS)->lpVtbl->DestroyVoice(THIS)
|
||||
#define IXAudio2MasteringVoice_DestroyVoice(THIS) (THIS)->lpVtbl->DestroyVoice(THIS)
|
||||
#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)
|
||||
static INLINE HRESULT XAudio2Create(IXAudio2 **ppXAudio2, UINT32, XAUDIO2_PROCESSOR)
|
||||
{
|
||||
IXAudio2 *pXAudio2 = NULL;
|
||||
#ifdef __cplusplus
|
||||
IXAudio2 *pXAudio2;
|
||||
|
||||
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);
|
||||
//hr = IXAudio2_Initialize(pXAudio2, 0, XAUDIO2_DEFAULT_PROCESSOR);
|
||||
hr = pXAudio2->Initialize(0, XAUDIO2_DEFAULT_PROCESSOR);
|
||||
if (SUCCEEDED(hr))
|
||||
*ppXAudio2 = pXAudio2;
|
||||
else
|
||||
IXAudio2_Release(pXAudio2);
|
||||
//IXAudio2_Release(pXAudio2);
|
||||
pXAudio2->Release();
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Undo the #pragma pack(push, 1) directive at the top of this file */
|
||||
// Undo the #pragma pack(push, 1) directive at the top of this file
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <retro_inline.h>
|
||||
|
||||
#include "../audio_driver.h"
|
||||
#include "../../configuration.h"
|
||||
|
||||
#define SOUND_FREQUENCY 48000
|
||||
#define MAX_BUFFER 2048
|
||||
@@ -34,11 +35,10 @@ typedef struct
|
||||
} xenon_audio_t;
|
||||
|
||||
static void *xenon360_audio_init(const char *device,
|
||||
unsigned rate, unsigned latency,
|
||||
unsigned block_frames,
|
||||
unsigned *new_rate)
|
||||
unsigned rate, unsigned latency)
|
||||
{
|
||||
static bool inited = false;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!inited)
|
||||
{
|
||||
@@ -46,8 +46,7 @@ static void *xenon360_audio_init(const char *device,
|
||||
inited = true;
|
||||
}
|
||||
|
||||
*new_rate = SOUND_FREQUENCY;
|
||||
|
||||
settings->audio.out_rate = SOUND_FREQUENCY;
|
||||
return calloc(1, sizeof(xenon_audio_t));
|
||||
}
|
||||
|
||||
@@ -70,7 +69,7 @@ static ssize_t xenon360_audio_write(void *data, const void *buf, size_t size)
|
||||
{
|
||||
while (xenon_sound_get_unplayed() >= MAX_BUFFER)
|
||||
{
|
||||
/* libxenon doesn't have proper
|
||||
/* libxenon doesn't have proper
|
||||
* synchronization primitives for this... */
|
||||
udelay(50);
|
||||
}
|
||||
@@ -112,7 +111,7 @@ static void xenon360_audio_set_nonblock_state(void *data, bool state)
|
||||
xa->nonblock = state;
|
||||
}
|
||||
|
||||
static bool xenon360_audio_start(void *data, bool is_shutdown)
|
||||
static bool xenon360_audio_start(void *data)
|
||||
{
|
||||
xenon_audio_t *xa = data;
|
||||
xa->is_paused = false;
|
||||
@@ -147,8 +146,6 @@ audio_driver_t audio_xenon360 = {
|
||||
xenon360_audio_free,
|
||||
xenon360_use_float,
|
||||
"xenon360",
|
||||
NULL,
|
||||
NULL,
|
||||
xenon360_write_avail,
|
||||
NULL
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2014-2017 - Ali Bouhlel ( [email protected] )
|
||||
* Copyright (C) 2014-2016 - Ali Bouhlel ( [email protected] )
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
@@ -25,9 +25,8 @@
|
||||
#include <retro_inline.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <memalign.h>
|
||||
#include <math/float_minmax.h>
|
||||
|
||||
#include <audio/audio_resampler.h>
|
||||
#include "../audio_resampler_driver.h"
|
||||
|
||||
/* Since SSE and NEON don't provide support for trigonometric functions
|
||||
* we approximate those with polynoms
|
||||
@@ -60,10 +59,10 @@ typedef struct rarch_CC_resampler
|
||||
static void resampler_CC_process(void *re_, struct resampler_data *data)
|
||||
{
|
||||
float ratio, fraction;
|
||||
audio_frame_float_t *inp = (audio_frame_float_t*)data->data_in;
|
||||
audio_frame_float_t *inp = (audio_frame_float_t*)data->data_in;
|
||||
audio_frame_float_t *inp_max = (audio_frame_float_t*)
|
||||
(inp + data->input_frames);
|
||||
audio_frame_float_t *outp = (audio_frame_float_t*)data->data_out;
|
||||
audio_frame_float_t *outp = (audio_frame_float_t*)data->data_out;
|
||||
|
||||
(void)re_;
|
||||
|
||||
@@ -197,15 +196,15 @@ static void resampler_CC_downsample(void *re_, struct resampler_data *data)
|
||||
__m128 vec_in;
|
||||
__m128 vec_ratio =
|
||||
_mm_mul_ps(_mm_set_ps1(ratio), _mm_set_ps(3.0, 2.0, 1.0, 0.0));
|
||||
__m128 vec_w = _mm_sub_ps(_mm_set_ps1(re->distance), vec_ratio);
|
||||
__m128 vec_w = _mm_sub_ps(_mm_set_ps1(re->distance), vec_ratio);
|
||||
|
||||
__m128 vec_w1 = _mm_add_ps(vec_w , _mm_set_ps1(0.5));
|
||||
__m128 vec_w2 = _mm_sub_ps(vec_w , _mm_set_ps1(0.5));
|
||||
__m128 vec_w1 = _mm_add_ps(vec_w , _mm_set_ps1(0.5));
|
||||
__m128 vec_w2 = _mm_sub_ps(vec_w , _mm_set_ps1(0.5));
|
||||
|
||||
__m128 vec_b = _mm_set_ps1(b);
|
||||
__m128 vec_b = _mm_set_ps1(b);
|
||||
|
||||
vec_w1 = _mm_mul_ps(vec_w1, vec_b);
|
||||
vec_w2 = _mm_mul_ps(vec_w2, vec_b);
|
||||
vec_w1 = _mm_mul_ps(vec_w1, vec_b);
|
||||
vec_w2 = _mm_mul_ps(vec_w2, vec_b);
|
||||
|
||||
(void)vec_ww1;
|
||||
(void)vec_ww2;
|
||||
@@ -272,7 +271,7 @@ static void resampler_CC_upsample(void *re_, struct resampler_data *data)
|
||||
audio_frame_float_t *inp = (audio_frame_float_t*)data->data_in;
|
||||
audio_frame_float_t *inp_max = (audio_frame_float_t*)(inp + data->input_frames);
|
||||
audio_frame_float_t *outp = (audio_frame_float_t*)data->data_out;
|
||||
float b = float_min(data->ratio, 1.00); /* cutoff frequency. */
|
||||
float b = MIN(data->ratio, 1.00); /* cutoff frequency. */
|
||||
float ratio = 1.0 / data->ratio;
|
||||
__m128 vec_previous = _mm_loadu_ps((float*)&re->buffer[0]);
|
||||
__m128 vec_current = _mm_loadu_ps((float*)&re->buffer[2]);
|
||||
@@ -348,7 +347,7 @@ static void resampler_CC_upsample(void *re_, struct resampler_data *data)
|
||||
}
|
||||
|
||||
|
||||
#elif defined (__ARM_NEON__) && !defined(DONT_WANT_ARM_OPTIMIZATIONS)
|
||||
#elif defined (__ARM_NEON__)
|
||||
|
||||
#define CC_RESAMPLER_IDENT "NEON"
|
||||
|
||||
@@ -447,7 +446,7 @@ static void resampler_CC_upsample(void *re_, struct resampler_data *data)
|
||||
audio_frame_float_t *inp_max = (audio_frame_float_t*)
|
||||
(inp + data->input_frames);
|
||||
audio_frame_float_t *outp = (audio_frame_float_t*)data->data_out;
|
||||
float b = float_min(data->ratio, 1.00); /* cutoff frequency. */
|
||||
float b = MIN(data->ratio, 1.00); /* cutoff frequency. */
|
||||
float ratio = 1.0 / data->ratio;
|
||||
|
||||
while (inp != inp_max)
|
||||
@@ -498,12 +497,12 @@ static void *resampler_CC_init(const struct resampler_config *config,
|
||||
rarch_CC_resampler_t *re = (rarch_CC_resampler_t*)
|
||||
memalign_alloc(32, sizeof(rarch_CC_resampler_t));
|
||||
|
||||
/* TODO: lookup if NEON support can be detected at
|
||||
/* TODO: lookup if NEON support can be detected at
|
||||
* runtime and a funcptr set at runtime for either
|
||||
* C codepath or NEON codepath. This will help out
|
||||
* Android. */
|
||||
(void)mask;
|
||||
(void)config;
|
||||
(void)config;
|
||||
if (!re)
|
||||
return NULL;
|
||||
|
||||
@@ -540,7 +539,7 @@ static void resampler_CC_free(void *re_)
|
||||
(void)re_;
|
||||
}
|
||||
|
||||
retro_resampler_t CC_resampler = {
|
||||
rarch_resampler_t CC_resampler = {
|
||||
resampler_CC_init,
|
||||
resampler_CC_process,
|
||||
resampler_CC_free,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2014-2017 - Ali Bouhlel ( aliaspider@gmail.com )
|
||||
* Copyright (C) 2014-2015 - Ali Bouhlel ( aliaspider@gmail.com )
|
||||
*
|
||||
* 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-
|
||||
@@ -24,13 +24,7 @@
|
||||
#endif
|
||||
.align 4
|
||||
.globl resampler_CC_downsample_neon
|
||||
#ifndef __MACH__
|
||||
.type resampler_CC_downsample_neon, %function
|
||||
#endif
|
||||
.globl _resampler_CC_downsample_neon
|
||||
#ifndef __MACH__
|
||||
.type _resampler_CC_downsample_neon, %function
|
||||
#endif
|
||||
|
||||
# size_t resampler_CC_downsample_neon(float *outp, const float *inp,
|
||||
# rarch_CC_resampler_t* re_, size_t input_frames, float ratio);
|
||||
@@ -202,13 +196,7 @@ bx lr
|
||||
|
||||
.align 4
|
||||
.globl resampler_CC_upsample_neon
|
||||
#ifndef __MACH__
|
||||
.type resampler_CC_upsample_neon, %function
|
||||
#endif
|
||||
.globl _resampler_CC_upsample_neon
|
||||
#ifndef __MACH__
|
||||
.type _resampler_CC_upsample_neon, %function
|
||||
#endif
|
||||
|
||||
# size_t resampler_CC_upsample_neon(float *outp, const float *inp,
|
||||
# rarch_CC_resampler_t* re_, size_t input_frames, float ratio);
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2014-2016 - Ali Bouhlel ( [email protected] )
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "../audio_resampler_driver.h"
|
||||
typedef struct rarch_nearest_resampler
|
||||
{
|
||||
float fraction;
|
||||
} rarch_nearest_resampler_t;
|
||||
|
||||
static void resampler_nearest_process(
|
||||
void *re_, struct resampler_data *data)
|
||||
{
|
||||
rarch_nearest_resampler_t *re = (rarch_nearest_resampler_t*)re_;
|
||||
audio_frame_float_t *inp = (audio_frame_float_t*)data->data_in;
|
||||
audio_frame_float_t *inp_max = (audio_frame_float_t*)inp + data->input_frames;
|
||||
audio_frame_float_t *outp = (audio_frame_float_t*)data->data_out;
|
||||
float ratio = 1.0 / data->ratio;
|
||||
|
||||
while(inp != inp_max)
|
||||
{
|
||||
while(re->fraction > 1)
|
||||
{
|
||||
*outp++ = *inp;
|
||||
re->fraction -= ratio;
|
||||
}
|
||||
re->fraction++;
|
||||
inp++;
|
||||
}
|
||||
|
||||
data->output_frames = (outp - (audio_frame_float_t*)data->data_out);
|
||||
}
|
||||
|
||||
static void resampler_nearest_free(void *re_)
|
||||
{
|
||||
rarch_nearest_resampler_t *re = (rarch_nearest_resampler_t*)re_;
|
||||
if (re)
|
||||
free(re);
|
||||
}
|
||||
|
||||
static void *resampler_nearest_init(const struct resampler_config *config,
|
||||
double bandwidth_mod, resampler_simd_mask_t mask)
|
||||
{
|
||||
rarch_nearest_resampler_t *re = (rarch_nearest_resampler_t*)
|
||||
calloc(1, sizeof(rarch_nearest_resampler_t));
|
||||
|
||||
(void)config;
|
||||
(void)mask;
|
||||
|
||||
if (!re)
|
||||
return NULL;
|
||||
|
||||
re->fraction = 0;
|
||||
|
||||
return re;
|
||||
}
|
||||
|
||||
rarch_resampler_t nearest_resampler = {
|
||||
resampler_nearest_init,
|
||||
resampler_nearest_process,
|
||||
resampler_nearest_free,
|
||||
RESAMPLER_API_VERSION,
|
||||
"nearest",
|
||||
"nearest"
|
||||
};
|
||||
Loaded 100 of 3841 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user