Add dummy CLEAR_ALL_THREAD_WAITS_CB for Mupen64 core in order to support the threaded renderer

This commit is contained in:
Sergey Stepanov 2023-04-04 17:59:24 +03:00
parent 9178dab7dd
commit b5cb33812b
No known key found for this signature in database
GPG key ID: A56B4929BAA8556B
7 changed files with 44 additions and 51 deletions

View file

@ -1,53 +1,14 @@
mupen64plus-169screensize = 480x270
mupen64plus-169screensize = 640x360
mupen64plus-43screensize = 320x240
mupen64plus-alt-map = False
mupen64plus-aspect = 4:3
mupen64plus-astick-deadzone = 15
mupen64plus-astick-sensitivity = 100
mupen64plus-BackgroundMode = OnePiece
mupen64plus-BilinearMode = standard
mupen64plus-CorrectTexrectCoords = Off
mupen64plus-CountPerOp = 0
mupen64plus-cpucore = dynamic_recompiler
mupen64plus-CropMode = Auto
mupen64plus-d-cbutton = C3
mupen64plus-EnableCopyColorToRDRAM = Off
mupen64plus-EnableCopyDepthToRDRAM = Software
mupen64plus-EnableEnhancedHighResStorage = False
mupen64plus-EnableEnhancedTextureStorage = False
mupen64plus-EnableCopyDepthToRDRAM = Off
mupen64plus-EnableEnhancedTextureStorage = True
mupen64plus-EnableFBEmulation = True
mupen64plus-EnableFragmentDepthWrite = False
mupen64plus-EnableHWLighting = False
mupen64plus-EnableLegacyBlending = True
mupen64plus-EnableLODEmulation = True
mupen64plus-EnableNativeResTexrects = Disabled
mupen64plus-EnableOverscan = Enabled
mupen64plus-EnableShadersStorage = True
mupen64plus-EnableTextureCache = True
mupen64plus-ForceDisableExtraMem = False
mupen64plus-FrameDuping = False
mupen64plus-Framerate = Original
mupen64plus-FXAA = 0
mupen64plus-l-cbutton = C2
mupen64plus-MaxTxCacheSize = 8000
mupen64plus-NoiseEmulation = True
mupen64plus-OverscanBottom = 0
mupen64plus-OverscanLeft = 0
mupen64plus-OverscanRight = 0
mupen64plus-OverscanTop = 0
mupen64plus-ThreadedRenderer = False
mupen64plus-cpucore = dynamic_recompiler
mupen64plus-pak1 = memory
mupen64plus-pak2 = none
mupen64plus-pak3 = none
mupen64plus-pak4 = none
mupen64plus-r-cbutton = C1
mupen64plus-rdp-plugin = gliden64
mupen64plus-rsp-plugin = hle
mupen64plus-rspmode = HLE
mupen64plus-txCacheCompression = True
mupen64plus-txEnhancementMode = None
mupen64plus-txFilterIgnoreBG = True
mupen64plus-txFilterMode = None
mupen64plus-txHiresEnable = False
mupen64plus-txHiresFullAlphaChannel = False
mupen64plus-u-cbutton = C4
mupen64plus-virefresh = Auto

View file

@ -205,7 +205,6 @@ emulator:
hasMultitap: true
n64:
lib: mupen64plus_next_libretro
altRepo: true
config: mupen64plus_next_libretro.cfg
roms: [ "n64", "v64", "z64" ]
isGlAllowed: true

View file

@ -19,7 +19,7 @@ func TestLibraryScan(t *testing.T) {
},
}
l := logger.NewConsole(false, "w", true)
l := logger.NewConsole(false, "w", false)
for _, test := range tests {
library := NewLib(Config{
BasePath: test.directory,

View file

@ -6,8 +6,23 @@
//#include <stdlib.h>
//#include <signal.h>
int initialized = 0;
void coreLog(enum retro_log_level level, const char *msg);
static bool on_clear_all_thread_waits_cb(unsigned v, void *data) {
if (v > 0) {
coreLog(RETRO_LOG_DEBUG, "CLEAR_ALL_THREAD_WAITS_CB (1)\n");
} else {
coreLog(RETRO_LOG_DEBUG, "CLEAR_ALL_THREAD_WAITS_CB (0)\n");
void signalStop();
signalStop();
}
return true;
}
void clear_all_thread_waits_cb(void *data) { *(retro_environment_t *)data = on_clear_all_thread_waits_cb; }
void bridge_retro_init(void *f) {
coreLog(RETRO_LOG_INFO, "Initialization...\n");
return ((void (*)(void)) f)();
@ -157,7 +172,6 @@ void deinitVideo_cgo() {
void *function;
pthread_t thread;
int initialized = 0;
pthread_mutex_t run_mutex;
pthread_cond_t run_cv;
pthread_mutex_t done_mutex;
@ -169,11 +183,12 @@ pthread_cond_t done_cv;
//}
void *run_loop(void *unused) {
coreLog(RETRO_LOG_DEBUG, "UnLIBCo run loop start\n");
pthread_mutex_lock(&done_mutex);
pthread_mutex_lock(&run_mutex);
pthread_cond_signal(&done_cv);
pthread_mutex_unlock(&done_mutex);
while (1) {
while (initialized) {
pthread_cond_wait(&run_cv, &run_mutex);
((void (*)(void)) function)();
pthread_mutex_lock(&done_mutex);
@ -181,6 +196,11 @@ void *run_loop(void *unused) {
pthread_mutex_unlock(&done_mutex);
}
pthread_mutex_unlock(&run_mutex);
coreLog(RETRO_LOG_DEBUG, "UnLIBCo run loop stop\n");
}
void stop_run_loop() {
initialized = 0;
}
void bridge_execute(void *f) {

View file

@ -22,6 +22,8 @@ import (
#include "libretro.h"
#include "nanoarch.h"
#include <stdlib.h>
#define RETRO_ENVIRONMENT_GET_CLEAR_ALL_THREAD_WAITS_CB (3 | 0x800000)
*/
import "C"
@ -194,8 +196,8 @@ func coreInputState(port C.unsigned, device C.unsigned, index C.unsigned, id C.u
func audioWrite(buf unsafe.Pointer, frames C.size_t) C.size_t {
if frontend.stopped.Load() {
libretroLogger.Warn().Msgf(">>> skip audio")
return 0
libretroLogger.Warn().Msgf(">>> skip %v audio frames", frames)
return frames
}
samples := int(frames) << 1
@ -338,6 +340,8 @@ func coreEnvironment(cmd C.unsigned, data unsafe.Pointer) C.bool {
}
}
return false
case C.RETRO_ENVIRONMENT_GET_CLEAR_ALL_THREAD_WAITS_CB:
C.clear_all_thread_waits_cb(data)
default:
return false
}
@ -389,6 +393,11 @@ func initVideo() {
}
}
//export signalStop
func signalStop() {
libretroLogger.Debug().Msgf("On UnLibCo stop callback")
}
//export deinitVideo
func deinitVideo() {
C.bridge_context_reset(nano.v.hw.context_destroy)
@ -578,6 +587,7 @@ func nanoarchShutdown() {
if nano.v.isGl {
C.bridge_execute(C.deinitVideo_cgo)
}
C.bridge_execute(C.stop_run_loop)
})
} else {
if nano.v.isGl {

View file

@ -1,6 +1,9 @@
#ifndef FRONTEND_H__
#define FRONTEND_H__
void clear_all_thread_waits_cb(void *data);
void stop_run_loop();
bool bridge_retro_load_game(void *f, struct retro_game_info *gi);
bool bridge_retro_serialize(void *f, void *data, size_t size);
bool bridge_retro_set_environment(void *f, void *callback);

View file

@ -211,7 +211,7 @@ func getRoomMock(cfg roomMockConfig) roomMock {
panic(err)
}
fixEmulators(&conf, cfg.autoGlContext)
l := logger.NewConsole(conf.Worker.Debug, "w", true)
l := logger.NewConsole(conf.Worker.Debug, "w", false)
if cfg.noLog {
logger.SetGlobalLevel(logger.Disabled)
}