XMA: Use a threadsafe bitmap to acquire/release contexts
Support Pausing/Resuming
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include <queue>
|
||||
|
||||
#include "xenia/apu/xma_context.h"
|
||||
#include "xenia/base/bit_map.h"
|
||||
#include "xenia/kernel/xthread.h"
|
||||
#include "xenia/xbox.h"
|
||||
|
||||
@@ -43,6 +44,10 @@ class XmaDecoder {
|
||||
uint32_t ReadRegister(uint32_t addr);
|
||||
void WriteRegister(uint32_t addr, uint32_t value);
|
||||
|
||||
bool is_paused() const { return paused_; }
|
||||
void Pause();
|
||||
void Resume();
|
||||
|
||||
protected:
|
||||
int GetContextId(uint32_t guest_ptr);
|
||||
|
||||
@@ -66,7 +71,9 @@ class XmaDecoder {
|
||||
kernel::object_ref<kernel::XHostThread> worker_thread_;
|
||||
xe::threading::Fence worker_fence_;
|
||||
|
||||
std::mutex lock_;
|
||||
bool paused_ = false;
|
||||
xe::threading::Fence pause_fence_; // Signaled when worker paused.
|
||||
xe::threading::Fence resume_fence_; // Signaled when resume requested.
|
||||
|
||||
// Stored little endian, accessed through 0x7FEA....
|
||||
union {
|
||||
@@ -91,6 +98,7 @@ class XmaDecoder {
|
||||
|
||||
static const uint32_t kContextCount = 320;
|
||||
XmaContext contexts_[kContextCount];
|
||||
BitMap context_bitmap_;
|
||||
|
||||
uint32_t context_data_first_ptr_ = 0;
|
||||
uint32_t context_data_last_ptr_ = 0;
|
||||
|
||||
Reference in New Issue
Block a user