Removing the last of XEDECLARECLASS.

This commit is contained in:
Ben Vanik 2014-08-20 22:50:10 -07:00
parent 06f5b8cbbf
commit 244e8a8745
15 changed files with 108 additions and 144 deletions

View File

@ -12,14 +12,13 @@
#include <xenia/apu/audio_system.h>
XEDECLARECLASS1(xe, Emulator);
namespace xe {
class Emulator;
} // namespace xe
namespace xe {
namespace apu {
AudioSystem* Create(Emulator* emulator);
AudioSystem* CreateNop(Emulator* emulator);
@ -31,5 +30,4 @@ AudioSystem* CreateXAudio2(Emulator* emulator);
} // namespace apu
} // namespace xe
#endif // XENIA_APU_APU_H_

View File

@ -11,34 +11,26 @@
#define XENIA_APU_AUDIO_DRIVER_H_
#include <xenia/core.h>
#include <xenia/emulator.h>
#include <xenia/xbox.h>
XEDECLARECLASS1(xe, Emulator);
XEDECLARECLASS2(xe, cpu, Processor);
XEDECLARECLASS2(xe, cpu, XenonThreadState);
namespace xe {
namespace apu {
class AudioDriver {
public:
public:
AudioDriver(Emulator* emulator);
virtual ~AudioDriver();
virtual void SubmitFrame(uint32_t samples_ptr) = 0;
protected:
Emulator* emulator_;
Memory* memory_;
cpu::Processor* processor_;
protected:
Emulator* emulator_;
Memory* memory_;
cpu::Processor* processor_;
};
} // namespace apu
} // namespace xe
#endif // XENIA_APU_AUDIO_DRIVER_H_

View File

@ -16,19 +16,16 @@
#include <thread>
#include <xenia/core.h>
#include <xenia/emulator.h>
#include <xenia/xbox.h>
XEDECLARECLASS1(xe, Emulator);
XEDECLARECLASS2(xe, cpu, Processor);
XEDECLARECLASS2(xe, cpu, XenonThreadState);
XEDECLARECLASS2(xe, apu, AudioDriver);
namespace xe {
namespace apu {
class AudioDriver;
class AudioSystem {
public:
public:
virtual ~AudioSystem();
Emulator* emulator() const { return emulator_; }
@ -38,20 +35,22 @@ public:
virtual X_STATUS Setup();
virtual void Shutdown();
X_STATUS RegisterClient(uint32_t callback, uint32_t callback_arg, size_t* out_index);
X_STATUS RegisterClient(uint32_t callback, uint32_t callback_arg,
size_t* out_index);
void UnregisterClient(size_t index);
void SubmitFrame(size_t index, uint32_t samples_ptr);
virtual X_STATUS CreateDriver(size_t index, HANDLE wait_handle, AudioDriver** out_driver) = 0;
virtual X_STATUS CreateDriver(size_t index, HANDLE wait_handle,
AudioDriver** out_driver) = 0;
virtual void DestroyDriver(AudioDriver* driver) = 0;
virtual uint64_t ReadRegister(uint64_t addr);
virtual void WriteRegister(uint64_t addr, uint64_t value);
protected:
protected:
virtual void Initialize();
private:
private:
void ThreadStart();
static uint64_t MMIOReadRegisterThunk(AudioSystem* as, uint64_t addr) {
@ -62,19 +61,19 @@ private:
as->WriteRegister(addr, value);
}
protected:
protected:
AudioSystem(Emulator* emulator);
Emulator* emulator_;
Memory* memory_;
cpu::Processor* processor_;
Emulator* emulator_;
Memory* memory_;
cpu::Processor* processor_;
std::thread thread_;
std::thread thread_;
cpu::XenonThreadState* thread_state_;
uint32_t thread_block_;
uint32_t thread_block_;
std::atomic<bool> running_;
std::mutex lock_;
std::mutex lock_;
static const size_t maximum_client_count_ = 8;
@ -88,9 +87,7 @@ protected:
std::queue<size_t> unused_clients_;
};
} // namespace apu
} // namespace xe
#endif // XENIA_APU_AUDIO_SYSTEM_H_

View File

@ -12,22 +12,19 @@
#include <xenia/core.h>
XEDECLARECLASS1(xe, Emulator);
XEDECLARECLASS2(xe, apu, AudioSystem);
namespace xe {
class Emulator;
} // namespace xe
namespace xe {
namespace apu {
class AudioSystem;
namespace nop {
AudioSystem* Create(Emulator* emulator);
} // namespace nop
} // namespace apu
} // namespace xe
#endif // XENIA_APU_NOP_NOP_APU_H_

View File

@ -14,21 +14,15 @@
#include <vector>
#include <xenia/core.h>
XEDECLARECLASS2(alloy, runtime, Breakpoint);
XEDECLARECLASS1(xe, Emulator);
XEDECLARECLASS1(xe, ExportResolver);
XEDECLARECLASS1(xe, Memory);
XEDECLARECLASS2(xe, cpu, XenonMemory);
XEDECLARECLASS2(xe, cpu, XenonRuntime);
XEDECLARECLASS2(xe, cpu, XenonThreadState);
XEDECLARECLASS2(xe, cpu, XexModule);
#include <xenia/emulator.h>
namespace xe {
namespace cpu {
class XenonMemory;
class XenonRuntime;
class XenonThreadState;
class XexModule;
enum class Irql : uint32_t {
PASSIVE = 0,
@ -37,9 +31,8 @@ enum class Irql : uint32_t {
DPC = 3,
};
class Processor {
public:
public:
Processor(Emulator* emulator);
~Processor();
@ -49,34 +42,30 @@ public:
int Setup();
int Execute(
XenonThreadState* thread_state, uint64_t address);
uint64_t Execute(
XenonThreadState* thread_state, uint64_t address, uint64_t args[],
size_t arg_count);
int Execute(XenonThreadState* thread_state, uint64_t address);
uint64_t Execute(XenonThreadState* thread_state, uint64_t address,
uint64_t args[], size_t arg_count);
Irql RaiseIrql(Irql new_value);
void LowerIrql(Irql old_value);
uint64_t ExecuteInterrupt(
uint32_t cpu, uint64_t address, uint64_t args[], size_t arg_count);
uint64_t ExecuteInterrupt(uint32_t cpu, uint64_t address, uint64_t args[],
size_t arg_count);
private:
Emulator* emulator_;
ExportResolver* export_resolver_;
private:
Emulator* emulator_;
ExportResolver* export_resolver_;
XenonRuntime* runtime_;
Memory* memory_;
XenonRuntime* runtime_;
Memory* memory_;
Irql irql_;
std::mutex interrupt_thread_lock_;
XenonThreadState* interrupt_thread_state_;
uint64_t interrupt_thread_block_;
Irql irql_;
std::mutex interrupt_thread_lock_;
XenonThreadState* interrupt_thread_state_;
uint64_t interrupt_thread_block_;
};
} // namespace cpu
} // namespace xe
#endif // XENIA_CPU_PROCESSOR_H_

View File

@ -14,8 +14,7 @@
#include <xenia/core.h>
#include <xenia/cpu/xenon_thread_state.h>
XEDECLARECLASS1(xe, ExportResolver);
#include <xenia/export_resolver.h>
namespace xe {
namespace cpu {

View File

@ -12,14 +12,13 @@
#include <xenia/gpu/graphics_system.h>
XEDECLARECLASS1(xe, Emulator);
namespace xe {
class Emulator;
} // namespace xe
namespace xe {
namespace gpu {
GraphicsSystem* Create(Emulator* emulator);
GraphicsSystem* CreateNop(Emulator* emulator);
@ -28,9 +27,7 @@ GraphicsSystem* CreateNop(Emulator* emulator);
GraphicsSystem* CreateD3D11(Emulator* emulator);
#endif // WIN32
} // namespace gpu
} // namespace xe
#endif // XENIA_GPU_GPU_H_

View File

@ -14,22 +14,17 @@
#include <thread>
#include <xenia/core.h>
#include <xenia/emulator.h>
#include <xenia/xbox.h>
XEDECLARECLASS1(xe, Emulator);
XEDECLARECLASS2(xe, cpu, Processor);
namespace xe {
namespace gpu {
class CommandProcessor;
class GraphicsDriver;
class GraphicsSystem {
public:
public:
virtual ~GraphicsSystem();
Emulator* emulator() const { return emulator_; }
@ -50,11 +45,11 @@ public:
void DispatchInterruptCallback(uint32_t source, uint32_t cpu = 0xFFFFFFFF);
virtual void Swap() = 0;
protected:
protected:
virtual void Initialize();
virtual void Pump() = 0;
private:
private:
void ThreadStart();
static uint64_t MMIOReadRegisterThunk(GraphicsSystem* gs, uint64_t addr) {
@ -65,28 +60,26 @@ private:
gs->WriteRegister(addr, value);
}
protected:
protected:
GraphicsSystem(Emulator* emulator);
Emulator* emulator_;
Memory* memory_;
cpu::Processor* processor_;
Emulator* emulator_;
Memory* memory_;
cpu::Processor* processor_;
xe_run_loop_ref run_loop_;
std::thread thread_;
xe_run_loop_ref run_loop_;
std::thread thread_;
std::atomic<bool> running_;
GraphicsDriver* driver_;
GraphicsDriver* driver_;
CommandProcessor* command_processor_;
uint32_t interrupt_callback_;
uint32_t interrupt_callback_data_;
HANDLE thread_wait_;
uint32_t interrupt_callback_;
uint32_t interrupt_callback_data_;
HANDLE thread_wait_;
};
} // namespace gpu
} // namespace xe
#endif // XENIA_GPU_GRAPHICS_SYSTEM_H_

View File

@ -12,22 +12,19 @@
#include <xenia/core.h>
XEDECLARECLASS1(xe, Emulator);
XEDECLARECLASS2(xe, gpu, GraphicsSystem);
namespace xe {
class Emulator;
} // namespace xe
namespace xe {
namespace gpu {
class GraphicsSystem;
namespace nop {
GraphicsSystem* Create(Emulator* emulator);
} // namespace nop
} // namespace gpu
} // namespace xe
#endif // XENIA_GPU_NOP_NOP_GPU_H_

View File

@ -12,19 +12,16 @@
#include <xenia/hid/input_system.h>
XEDECLARECLASS1(xe, Emulator);
namespace xe {
class Emulator;
} // namespace xe
namespace xe {
namespace hid {
InputSystem* Create(Emulator* emulator);
} // namespace hid
} // namespace xe
#endif // XENIA_HID_HID_H_

View File

@ -13,11 +13,9 @@
#include <vector>
#include <xenia/core.h>
#include <xenia/emulator.h>
#include <xenia/xbox.h>
XEDECLARECLASS1(xe, Emulator);
XEDECLARECLASS2(xe, cpu, Processor);
namespace xe {
namespace hid {

View File

@ -12,11 +12,10 @@
#include <xenia/core.h>
XEDECLARECLASS2(xe, hid, InputDriver);
XEDECLARECLASS2(xe, hid, InputSystem);
namespace xe {
namespace hid {
class InputDriver;
class InputSystem;
namespace nop {
InputDriver* Create(InputSystem* input_system);

View File

@ -10,11 +10,9 @@
#ifndef XENIA_KERNEL_XBOXKRNL_XKERNEL_MODULE_H_
#define XENIA_KERNEL_XBOXKRNL_XKERNEL_MODULE_H_
#include <xenia/emulator.h>
#include <xenia/kernel/objects/xmodule.h>
XEDECLARECLASS1(xe, Emulator);
XEDECLARECLASS1(xe, ExportResolver);
namespace xe {
namespace kernel {

View File

@ -14,11 +14,10 @@
#include <mutex>
#include <string>
#include <xenia/cpu/xenon_thread_state.h>
#include <xenia/kernel/xobject.h>
#include <xenia/xbox.h>
XEDECLARECLASS2(xe, cpu, XenonThreadState);
namespace xe {
namespace kernel {

View File

@ -10,20 +10,34 @@
#ifndef XENIA_TYPES_H_
#define XENIA_TYPES_H_
#define XEDECLARECLASS1(ns1, name) \
namespace ns1 { class name; }
#define XEDECLARECLASS2(ns1, ns2, name) \
namespace ns1 { namespace ns2 { \
class name; \
} }
#define XEFAIL() goto XECLEANUP
#define XEEXPECT(expr) if (!(expr) ) { goto XECLEANUP; }
#define XEEXPECTTRUE(expr) if (!(expr) ) { goto XECLEANUP; }
#define XEEXPECTFALSE(expr) if ( (expr) ) { goto XECLEANUP; }
#define XEEXPECTZERO(expr) if ( (expr) != 0 ) { goto XECLEANUP; }
#define XEEXPECTNOTZERO(expr) if ( (expr) == 0 ) { goto XECLEANUP; }
#define XEEXPECTNULL(expr) if ( (expr) != NULL ) { goto XECLEANUP; }
#define XEEXPECTNOTNULL(expr) if ( (expr) == NULL ) { goto XECLEANUP; }
#define XEFAIL() goto XECLEANUP
#define XEEXPECT(expr) \
if (!(expr)) { \
goto XECLEANUP; \
}
#define XEEXPECTTRUE(expr) \
if (!(expr)) { \
goto XECLEANUP; \
}
#define XEEXPECTFALSE(expr) \
if ((expr)) { \
goto XECLEANUP; \
}
#define XEEXPECTZERO(expr) \
if ((expr) != 0) { \
goto XECLEANUP; \
}
#define XEEXPECTNOTZERO(expr) \
if ((expr) == 0) { \
goto XECLEANUP; \
}
#define XEEXPECTNULL(expr) \
if ((expr) != NULL) { \
goto XECLEANUP; \
}
#define XEEXPECTNOTNULL(expr) \
if ((expr) == NULL) { \
goto XECLEANUP; \
}
#endif // XENIA_TYPES_H_