Initial Alloy implementation.
This is a regression in functionality and performance, but a much better foundation for the future of the project (I think). It can run basic apps under an SSA interpreter but doesn't support some of the features required to do real 360 apps yet.
This commit is contained in:
@@ -14,10 +14,9 @@ using namespace xe;
|
||||
using namespace xe::apu;
|
||||
|
||||
|
||||
AudioDriver::AudioDriver(xe_memory_ref memory) {
|
||||
memory_ = xe_memory_retain(memory);
|
||||
AudioDriver::AudioDriver(Memory* memory) :
|
||||
memory_(memory) {
|
||||
}
|
||||
|
||||
AudioDriver::~AudioDriver() {
|
||||
xe_memory_release(memory_);
|
||||
}
|
||||
|
||||
@@ -21,14 +21,14 @@ class AudioDriver {
|
||||
public:
|
||||
virtual ~AudioDriver();
|
||||
|
||||
xe_memory_ref memory() const { return memory_; }
|
||||
Memory* memory() const { return memory_; }
|
||||
|
||||
virtual void Initialize() = 0;
|
||||
|
||||
protected:
|
||||
AudioDriver(xe_memory_ref memory);
|
||||
AudioDriver(Memory* memory);
|
||||
|
||||
xe_memory_ref memory_;
|
||||
Memory* memory_;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -16,14 +16,12 @@
|
||||
|
||||
using namespace xe;
|
||||
using namespace xe::apu;
|
||||
using namespace xe::cpu::ppc;
|
||||
using namespace xe::cpu;
|
||||
|
||||
|
||||
AudioSystem::AudioSystem(Emulator* emulator) :
|
||||
emulator_(emulator),
|
||||
emulator_(emulator), memory_(emulator->memory()),
|
||||
thread_(0), running_(false), driver_(0) {
|
||||
memory_ = xe_memory_retain(emulator->memory());
|
||||
|
||||
// Create the run loop used for any windows/etc.
|
||||
// This must be done on the thread we create the driver.
|
||||
run_loop_ = xe_run_loop_create();
|
||||
@@ -35,7 +33,6 @@ AudioSystem::~AudioSystem() {
|
||||
xe_thread_release(thread_);
|
||||
|
||||
xe_run_loop_release(run_loop_);
|
||||
xe_memory_release(memory_);
|
||||
}
|
||||
|
||||
X_STATUS AudioSystem::Setup() {
|
||||
@@ -101,7 +98,7 @@ void AudioSystem::Initialize() {
|
||||
void AudioSystem::Shutdown() {
|
||||
}
|
||||
|
||||
bool AudioSystem::HandlesRegister(uint32_t addr) {
|
||||
bool AudioSystem::HandlesRegister(uint64_t addr) {
|
||||
return (addr & 0xFFFF0000) == 0x7FEA0000;
|
||||
}
|
||||
|
||||
@@ -109,7 +106,7 @@ bool AudioSystem::HandlesRegister(uint32_t addr) {
|
||||
// piece of hardware:
|
||||
// https://github.com/Free60Project/libxenon/blob/master/libxenon/drivers/xenon_sound/sound.c
|
||||
|
||||
uint64_t AudioSystem::ReadRegister(uint32_t addr) {
|
||||
uint64_t AudioSystem::ReadRegister(uint64_t addr) {
|
||||
uint32_t r = addr & 0xFFFF;
|
||||
XELOGAPU("ReadRegister(%.4X)", r);
|
||||
// 1800h is read on startup and stored -- context? buffers?
|
||||
@@ -117,7 +114,7 @@ uint64_t AudioSystem::ReadRegister(uint32_t addr) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AudioSystem::WriteRegister(uint32_t addr, uint64_t value) {
|
||||
void AudioSystem::WriteRegister(uint64_t addr, uint64_t value) {
|
||||
uint32_t r = addr & 0xFFFF;
|
||||
XELOGAPU("WriteRegister(%.4X, %.8X)", r, value);
|
||||
// 1804h is written to with 0x02000000 and 0x03000000 around a lock operation
|
||||
|
||||
@@ -29,14 +29,14 @@ public:
|
||||
virtual ~AudioSystem();
|
||||
|
||||
Emulator* emulator() const { return emulator_; }
|
||||
xe_memory_ref memory() const { return memory_; }
|
||||
Memory* memory() const { return memory_; }
|
||||
cpu::Processor* processor() const { return processor_; }
|
||||
|
||||
virtual X_STATUS Setup();
|
||||
|
||||
bool HandlesRegister(uint32_t addr);
|
||||
virtual uint64_t ReadRegister(uint32_t addr);
|
||||
virtual void WriteRegister(uint32_t addr, uint64_t value);
|
||||
bool HandlesRegister(uint64_t addr);
|
||||
virtual uint64_t ReadRegister(uint64_t addr);
|
||||
virtual void WriteRegister(uint64_t addr, uint64_t value);
|
||||
|
||||
protected:
|
||||
virtual void Initialize();
|
||||
@@ -49,13 +49,13 @@ private:
|
||||
}
|
||||
void ThreadStart();
|
||||
|
||||
static bool HandlesRegisterThunk(AudioSystem* as, uint32_t addr) {
|
||||
static bool HandlesRegisterThunk(AudioSystem* as, uint64_t addr) {
|
||||
return as->HandlesRegister(addr);
|
||||
}
|
||||
static uint64_t ReadRegisterThunk(AudioSystem* as, uint32_t addr) {
|
||||
static uint64_t ReadRegisterThunk(AudioSystem* as, uint64_t addr) {
|
||||
return as->ReadRegister(addr);
|
||||
}
|
||||
static void WriteRegisterThunk(AudioSystem* as, uint32_t addr,
|
||||
static void WriteRegisterThunk(AudioSystem* as, uint64_t addr,
|
||||
uint64_t value) {
|
||||
as->WriteRegister(addr, value);
|
||||
}
|
||||
@@ -64,7 +64,7 @@ protected:
|
||||
AudioSystem(Emulator* emulator);
|
||||
|
||||
Emulator* emulator_;
|
||||
xe_memory_ref memory_;
|
||||
Memory* memory_;
|
||||
cpu::Processor* processor_;
|
||||
|
||||
xe_run_loop_ref run_loop_;
|
||||
|
||||
@@ -17,7 +17,7 @@ using namespace xe::apu;
|
||||
using namespace xe::apu::nop;
|
||||
|
||||
|
||||
NopAudioDriver::NopAudioDriver(xe_memory_ref memory) :
|
||||
NopAudioDriver::NopAudioDriver(Memory* memory) :
|
||||
AudioDriver(memory) {
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace nop {
|
||||
|
||||
class NopAudioDriver : public AudioDriver {
|
||||
public:
|
||||
NopAudioDriver(xe_memory_ref memory);
|
||||
NopAudioDriver(Memory* memory);
|
||||
virtual ~NopAudioDriver();
|
||||
|
||||
virtual void Initialize();
|
||||
|
||||
Reference in New Issue
Block a user