-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PACKAGE/DEFCONFIG: create&add
libretro-fake08
(#155)
* PACKAGE: add & create `libretro-fake08` pkg * PACKAGE: optimize `libretro-fake08` on uClibc (patch) - disable audio by default here
- Loading branch information
Showing
9 changed files
with
164 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
title=fake08 | ||
description=fake08 libretro core | ||
exec=/mnt/emus/retroarch/fake08.sh | ||
selectordir=/mnt/roms/PICO8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
package/miyoo/retroarch/libretro-fake08/0001-LIBRETRO-add-audio_play-option.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
From fb59413d4d6897ac47862a47e5cf8a9fb30df107 Mon Sep 17 00:00:00 2001 | ||
From: Apaczer <[email protected]> | ||
Date: Thu, 20 Feb 2025 22:52:10 +0100 | ||
Subject: [PATCH] LIBRETRO: add `audio_play` option | ||
|
||
--- | ||
platform/libretro/libretro.cpp | 20 ++++++++++++++++++-- | ||
platform/libretro/libretro_core_options.h | 11 +++++++++++ | ||
2 files changed, 29 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/platform/libretro/libretro.cpp b/platform/libretro/libretro.cpp | ||
index 47fa867..daeb526 100644 | ||
--- a/platform/libretro/libretro.cpp | ||
+++ b/platform/libretro/libretro.cpp | ||
@@ -35,6 +35,7 @@ static retro_log_printf_t log_cb; | ||
const size_t audioBufferSize = SAMPLESPERFRAME * NUM_BUFFERS; | ||
|
||
int16_t audioBuffer[audioBufferSize]; | ||
+int16_t audioBufferNULL[audioBufferSize]; | ||
|
||
const int PicoScreenWidth = 128; | ||
const int PicoScreenHeight = 128; | ||
@@ -45,6 +46,8 @@ static int crop_h_right = 0; | ||
static int crop_v_top = 0; | ||
static int crop_v_bottom = 0; | ||
|
||
+static bool option_audio_fill_buffer = true; | ||
+ | ||
const size_t screenBufferSize = PicoScreenWidth*PicoScreenHeight; | ||
uint16_t screenBuffer[screenBufferSize]; | ||
|
||
@@ -72,6 +75,15 @@ static void check_variables(bool startup) | ||
struct retro_variable var = {0}; | ||
int video_updated = 0; | ||
|
||
+ var.key = "audio_play"; | ||
+ if (enviro_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) | ||
+ { | ||
+ if (!strcmp(var.value, "enabled")) | ||
+ option_audio_fill_buffer = true; | ||
+ else if (!strcmp(var.value, "disabled")) | ||
+ option_audio_fill_buffer = false; | ||
+ } | ||
+ | ||
var.key = "fake08_video_scale"; | ||
if (enviro_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) | ||
{ | ||
@@ -404,8 +416,12 @@ EXPORT void retro_run() | ||
kDown = currKDown; | ||
|
||
if (frame % 2 == 0) { | ||
- _audio->FillAudioBuffer(&audioBuffer, 0, SAMPLESPERFRAME); | ||
- audio_batch_cb(audioBuffer, SAMPLESPERFRAME); | ||
+ if (option_audio_fill_buffer) { | ||
+ _audio->FillAudioBuffer(&audioBuffer, 0, SAMPLESPERFRAME); | ||
+ audio_batch_cb(audioBuffer, SAMPLESPERFRAME); | ||
+ } else { | ||
+ audio_batch_cb(audioBufferNULL, SAMPLESPERFRAME); | ||
+ } | ||
} | ||
|
||
} | ||
diff --git a/platform/libretro/libretro_core_options.h b/platform/libretro/libretro_core_options.h | ||
index 02c3a1a..af05ffc 100644 | ||
--- a/platform/libretro/libretro_core_options.h | ||
+++ b/platform/libretro/libretro_core_options.h | ||
@@ -49,6 +49,17 @@ extern "C" { | ||
* frontend language definition */ | ||
|
||
struct retro_core_option_definition option_defs_us[] = { | ||
+ { | ||
+ "audio_play", | ||
+ "Audio playback", | ||
+ "Enable or disable Audio playback for performance sake", | ||
+ { | ||
+ { "enabled", NULL }, | ||
+ { "disabled", NULL }, | ||
+ { NULL, NULL }, | ||
+ }, | ||
+ "enabled" | ||
+ }, | ||
{ | ||
"fake08_video_scale", | ||
"Video Scale", | ||
-- | ||
2.45.2.windows.1 | ||
|
29 changes: 29 additions & 0 deletions
29
package/miyoo/retroarch/libretro-fake08/0002-LIBRETRO-disable-audio-on-UCLIBC.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
From 9573ce039aa2ea1a9eb730b5b9e215cc7c4a9955 Mon Sep 17 00:00:00 2001 | ||
From: Apaczer <[email protected]> | ||
Date: Sat, 22 Feb 2025 15:02:35 +0100 | ||
Subject: [PATCH] LIBRETRO: disable audio on UCLIBC | ||
|
||
FillAudioBuffer() is botched here | ||
--- | ||
platform/libretro/libretro_core_options.h | 4 ++++ | ||
1 file changed, 4 insertions(+) | ||
|
||
diff --git a/platform/libretro/libretro_core_options.h b/platform/libretro/libretro_core_options.h | ||
index af05ffc..5399c6d 100644 | ||
--- a/platform/libretro/libretro_core_options.h | ||
+++ b/platform/libretro/libretro_core_options.h | ||
@@ -58,7 +58,11 @@ struct retro_core_option_definition option_defs_us[] = { | ||
{ "disabled", NULL }, | ||
{ NULL, NULL }, | ||
}, | ||
+#if !defined(__UCLIBC__) | ||
"enabled" | ||
+#else | ||
+ "disabled" | ||
+#endif | ||
}, | ||
{ | ||
"fake08_video_scale", | ||
-- | ||
2.45.2.windows.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
config BR2_PACKAGE_LIBRETRO_FAKE08 | ||
bool "libretro-fake08" | ||
depends on BR2_PACKAGE_RETROARCH | ||
depends on BR2_INSTALL_LIBSTDCPP | ||
help | ||
A libretro PICO-8 emulator core. | ||
|
||
https://github.com/jtothebell/fake-08 | ||
|
||
comment "LIBRETRO_FAKE08 needs a toolchain w/ C++" | ||
depends on !BR2_INSTALL_LIBSTDCPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Locally calculated | ||
sha256 659d2d522620317eaf57f7cf257c2f68e8bc7baf72654c7ed3887c77571a0572 libretro-fake08-0d26fd59103941e5f95e0ee665c6e0fb8c6b6f03-br1.tar.gz |
28 changes: 28 additions & 0 deletions
28
package/miyoo/retroarch/libretro-fake08/libretro-fake08.mk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
################################################################################ | ||
# | ||
# Fake-08 | ||
# | ||
################################################################################ | ||
|
||
#Commit version of Sep 3, 2024 | ||
LIBRETRO_FAKE08_VERSION = 0d26fd59103941e5f95e0ee665c6e0fb8c6b6f03 | ||
LIBRETRO_FAKE08_SITE = https://github.com/jtothebell/fake-08.git | ||
LIBRETRO_FAKE08_SITE_METHOD = git | ||
LIBRETRO_FAKE08_GIT_SUBMODULES = YES | ||
LIBRETRO_FAKE08_LICENSE = MIT | ||
LIBRETRO_FAKE08_LICENSE_FILES = LICENSE.MD | ||
|
||
define LIBRETRO_FAKE08_BUILD_CMDS | ||
CFLAGS="$(TARGET_CFLAGS) $(COMPILER_COMMONS_CFLAGS) -D_NEED_FULL_PATH_" \ | ||
CXXFLAGS="$(TARGET_CXXFLAGS) $(COMPILER_COMMONS_CXXFLAGS)" \ | ||
LDFLAGS="$(TARGET_LDFLAGS) $(COMPILER_COMMONS_LDFLAGS)" \ | ||
$(MAKE) CXX="$(TARGET_CXX)" CC="$(TARGET_CC)" -C $(@D)/platform/libretro -f Makefile platform="unix" | ||
endef | ||
|
||
define LIBRETRO_FAKE08_INSTALL_TARGET_CMDS | ||
mkdir -p "${BINARIES_DIR}/retroarch/cores" | ||
$(INSTALL) -D $(@D)/platform/libretro/fake08_libretro.so \ | ||
$(TARGET_DIR)/usr/lib/libretro/fake08_libretro.so | ||
endef | ||
|
||
$(eval $(generic-package)) |