mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-08-01 02:30:12 -06:00
Refactor NDS
and DSi
to be objects (#1893)
* First crack at refactoring NDS and DSi into objects - Remove all global/`static` variables in `NDS` and related classes - Rely more on virtual dispatch when we need to pick methods at runtime - Pass `NDS&` or `DSi&` to its constituent components where necessary - Introduce some headers or move some definitions to break `#include` cycles * Refactor the frontend to accommodate the core's changes * Move up `SchedList`'s declaration - Move it to before the components are initialized so the `map`s inside are initialized - Fields in C++ are initialized in the order they're declared * Fix a crash when allocating memory * Fix JIT-free builds * Fix GDB-free builds * Fix Linux builds - Explicitly qualify some member types in NDS, since they share the same name as their classes * Remove an unnecessary template argument - This was causing the build to fail on macOS * Fix ARM and Android builds * Rename `Constants.h` to `MemConstants.h` * Add `NDS::IsRunning()` * Use an `#include` guard instead of `#pragma once`
This commit is contained in:

committed by
GitHub

parent
c84cb17462
commit
e973236203
@ -26,11 +26,11 @@ namespace melonDS
|
||||
{
|
||||
class DSi_I2CHost;
|
||||
class DSi_Camera;
|
||||
|
||||
class DSi;
|
||||
class DSi_I2CDevice
|
||||
{
|
||||
public:
|
||||
DSi_I2CDevice(DSi_I2CHost* host) : Host(host) {}
|
||||
DSi_I2CDevice(melonDS::DSi& dsi, DSi_I2CHost* host) : DSi(dsi), Host(host) {}
|
||||
virtual ~DSi_I2CDevice() {}
|
||||
virtual void Reset() = 0;
|
||||
virtual void DoSavestate(Savestate* file) = 0;
|
||||
@ -40,6 +40,7 @@ public:
|
||||
virtual void Write(u8 val, bool last) = 0;
|
||||
|
||||
protected:
|
||||
melonDS::DSi& DSi;
|
||||
DSi_I2CHost* Host;
|
||||
};
|
||||
|
||||
@ -80,7 +81,7 @@ public:
|
||||
IRQ_ValidMask = 0x7B,
|
||||
};
|
||||
|
||||
DSi_BPTWL(DSi_I2CHost* host);
|
||||
DSi_BPTWL(melonDS::DSi& dsi, DSi_I2CHost* host);
|
||||
~DSi_BPTWL() override;
|
||||
void Reset() override;
|
||||
void DoSavestate(Savestate* file) override;
|
||||
@ -153,7 +154,7 @@ private:
|
||||
class DSi_I2CHost
|
||||
{
|
||||
public:
|
||||
DSi_I2CHost();
|
||||
DSi_I2CHost(melonDS::DSi& dsi);
|
||||
~DSi_I2CHost();
|
||||
void Reset();
|
||||
void DoSavestate(Savestate* file);
|
||||
@ -169,6 +170,7 @@ public:
|
||||
void WriteData(u8 val);
|
||||
|
||||
private:
|
||||
melonDS::DSi& DSi;
|
||||
u8 Cnt;
|
||||
u8 Data;
|
||||
|
||||
|
Reference in New Issue
Block a user