convert AREngine
This commit is contained in:
parent
2bd09eafeb
commit
8f1b0d4a05
|
@ -26,32 +26,17 @@
|
|||
using Platform::Log;
|
||||
using Platform::LogLevel;
|
||||
|
||||
namespace AREngine
|
||||
{
|
||||
|
||||
// AR code file - frontend is responsible for managing this
|
||||
ARCodeFile* CodeFile;
|
||||
|
||||
u8 (*BusRead8)(u32 addr);
|
||||
u16 (*BusRead16)(u32 addr);
|
||||
u32 (*BusRead32)(u32 addr);
|
||||
void (*BusWrite8)(u32 addr, u8 val);
|
||||
void (*BusWrite16)(u32 addr, u16 val);
|
||||
void (*BusWrite32)(u32 addr, u32 val);
|
||||
|
||||
|
||||
bool Init()
|
||||
AREngine::AREngine()
|
||||
{
|
||||
CodeFile = nullptr;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void DeInit()
|
||||
AREngine::~AREngine()
|
||||
{
|
||||
}
|
||||
|
||||
void Reset()
|
||||
void AREngine::Reset()
|
||||
{
|
||||
if (NDS::ConsoleType == 1)
|
||||
{
|
||||
|
@ -74,16 +59,6 @@ void Reset()
|
|||
}
|
||||
|
||||
|
||||
ARCodeFile* GetCodeFile()
|
||||
{
|
||||
return CodeFile;
|
||||
}
|
||||
|
||||
void SetCodeFile(ARCodeFile* file)
|
||||
{
|
||||
CodeFile = file;
|
||||
}
|
||||
|
||||
|
||||
#define case16(x) \
|
||||
case ((x)+0x00): case ((x)+0x01): case ((x)+0x02): case ((x)+0x03): \
|
||||
|
@ -91,7 +66,7 @@ void SetCodeFile(ARCodeFile* file)
|
|||
case ((x)+0x08): case ((x)+0x09): case ((x)+0x0A): case ((x)+0x0B): \
|
||||
case ((x)+0x0C): case ((x)+0x0D): case ((x)+0x0E): case ((x)+0x0F)
|
||||
|
||||
void RunCheat(ARCode& arcode)
|
||||
void AREngine::RunCheat(ARCode& arcode)
|
||||
{
|
||||
u32* code = &arcode.Code[0];
|
||||
|
||||
|
@ -437,7 +412,7 @@ void RunCheat(ARCode& arcode)
|
|||
}
|
||||
}
|
||||
|
||||
void RunCheats()
|
||||
void AREngine::RunCheats()
|
||||
{
|
||||
if (!CodeFile) return;
|
||||
|
||||
|
@ -454,5 +429,3 @@ void RunCheats()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,18 +21,30 @@
|
|||
|
||||
#include "ARCodeFile.h"
|
||||
|
||||
namespace AREngine
|
||||
class AREngine
|
||||
{
|
||||
public:
|
||||
AREngine();
|
||||
~AREngine();
|
||||
void Reset();
|
||||
|
||||
bool Init();
|
||||
void DeInit();
|
||||
void Reset();
|
||||
ARCodeFile* GetCodeFile() { return CodeFile; }
|
||||
void SetCodeFile(ARCodeFile* file) { CodeFile = file; }
|
||||
|
||||
ARCodeFile* GetCodeFile();
|
||||
void SetCodeFile(ARCodeFile* file);
|
||||
void RunCheats();
|
||||
|
||||
void RunCheats();
|
||||
private:
|
||||
ARCodeFile* CodeFile; // AR code file - frontend is responsible for managing this
|
||||
|
||||
}
|
||||
// TEMPORARY
|
||||
u8 (*BusRead8)(u32 addr);
|
||||
u16 (*BusRead16)(u32 addr);
|
||||
u32 (*BusRead32)(u32 addr);
|
||||
void (*BusWrite8)(u32 addr, u8 val);
|
||||
void (*BusWrite16)(u32 addr, u16 val);
|
||||
void (*BusWrite32)(u32 addr, u32 val);
|
||||
|
||||
void RunCheat(ARCode& arcode);
|
||||
};
|
||||
|
||||
#endif // ARENGINE_H
|
||||
|
|
|
@ -590,7 +590,7 @@ void ARM::TriggerIRQ()
|
|||
if (Num == 1)
|
||||
{
|
||||
if ((NDS::IF[1] & NDS::IE[1]) & (1<<NDS::IRQ_VBlank))
|
||||
AREngine::RunCheats();
|
||||
NDS::AREngine->RunCheats();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -183,6 +183,8 @@ class SPIHost* SPI;
|
|||
class RTC* RTC;
|
||||
class Wifi* Wifi;
|
||||
|
||||
class AREngine* AREngine;
|
||||
|
||||
bool Running;
|
||||
|
||||
bool RunningGame;
|
||||
|
@ -231,7 +233,7 @@ bool Init()
|
|||
|
||||
if (!DSi::Init()) return false;
|
||||
|
||||
if (!AREngine::Init()) return false;
|
||||
AREngine = new class AREngine();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -262,7 +264,7 @@ void DeInit()
|
|||
|
||||
DSi::DeInit();
|
||||
|
||||
AREngine::DeInit();
|
||||
delete AREngine; AREngine = nullptr;
|
||||
|
||||
UnregisterEventFunc(Event_Div, 0);
|
||||
UnregisterEventFunc(Event_Sqrt, 0);
|
||||
|
@ -671,7 +673,7 @@ void Reset()
|
|||
|
||||
SPU->SetDegrade10Bit(degradeAudio);
|
||||
|
||||
AREngine::Reset();
|
||||
AREngine->Reset();
|
||||
}
|
||||
|
||||
void Start()
|
||||
|
|
|
@ -35,6 +35,8 @@ class SPIHost;
|
|||
class RTC;
|
||||
class Wifi;
|
||||
|
||||
class AREngine;
|
||||
|
||||
namespace NDS
|
||||
{
|
||||
|
||||
|
@ -256,6 +258,8 @@ extern class SPIHost* SPI;
|
|||
extern class RTC* RTC;
|
||||
extern class Wifi* Wifi;
|
||||
|
||||
extern class AREngine* AREngine;
|
||||
|
||||
const u32 ARM7WRAMSize = 0x10000;
|
||||
extern u8* ARM7WRAM;
|
||||
|
||||
|
|
|
@ -462,7 +462,7 @@ void UnloadCheats()
|
|||
{
|
||||
delete CheatFile;
|
||||
CheatFile = nullptr;
|
||||
AREngine::SetCodeFile(nullptr);
|
||||
NDS::AREngine->SetCodeFile(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -475,7 +475,7 @@ void LoadCheats()
|
|||
// TODO: check for error (malformed cheat file, ...)
|
||||
CheatFile = new ARCodeFile(filename);
|
||||
|
||||
AREngine::SetCodeFile(CheatsOn ? CheatFile : nullptr);
|
||||
NDS::AREngine->SetCodeFile(CheatsOn ? CheatFile : nullptr);
|
||||
}
|
||||
|
||||
void LoadBIOSFiles()
|
||||
|
@ -570,7 +570,7 @@ void EnableCheats(bool enable)
|
|||
{
|
||||
CheatsOn = enable;
|
||||
if (CheatFile)
|
||||
AREngine::SetCodeFile(CheatsOn ? CheatFile : nullptr);
|
||||
NDS::AREngine->SetCodeFile(CheatsOn ? CheatFile : nullptr);
|
||||
}
|
||||
|
||||
ARCodeFile* GetCheatFile()
|
||||
|
|
Loading…
Reference in New Issue