mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-25 07:10:00 -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
@ -25,17 +25,18 @@
|
||||
|
||||
namespace melonDS
|
||||
{
|
||||
class DSi;
|
||||
class DSi_CamModule;
|
||||
|
||||
class DSi_Camera : public DSi_I2CDevice
|
||||
{
|
||||
public:
|
||||
DSi_Camera(DSi_I2CHost* host, u32 num);
|
||||
DSi_Camera(melonDS::DSi& dsi, DSi_I2CHost* host, u32 num);
|
||||
~DSi_Camera();
|
||||
|
||||
void DoSavestate(Savestate* file);
|
||||
void DoSavestate(Savestate* file) override;
|
||||
|
||||
void Reset();
|
||||
void Reset() override;
|
||||
void Stop();
|
||||
bool IsActivated();
|
||||
|
||||
@ -45,9 +46,9 @@ public:
|
||||
// lengths in words
|
||||
int TransferScanline(u32* buffer, int maxlen);
|
||||
|
||||
void Acquire();
|
||||
u8 Read(bool last);
|
||||
void Write(u8 val, bool last);
|
||||
void Acquire() override;
|
||||
u8 Read(bool last) override;
|
||||
void Write(u8 val, bool last) override;
|
||||
|
||||
void InputFrame(u32* data, int width, int height, bool rgb);
|
||||
|
||||
@ -84,7 +85,7 @@ private:
|
||||
class DSi_CamModule
|
||||
{
|
||||
public:
|
||||
DSi_CamModule();
|
||||
DSi_CamModule(melonDS::DSi& dsi);
|
||||
~DSi_CamModule();
|
||||
void Reset();
|
||||
void Stop();
|
||||
@ -105,6 +106,7 @@ public:
|
||||
void Write32(u32 addr, u32 val);
|
||||
|
||||
private:
|
||||
melonDS::DSi& DSi;
|
||||
DSi_Camera* Camera0; // 78 / facing outside
|
||||
DSi_Camera* Camera1; // 7A / selfie cam
|
||||
|
||||
|
Reference in New Issue
Block a user