diff options
author | Arisotura <thetotalworm@gmail.com> | 2021-08-30 21:42:35 +0200 |
---|---|---|
committer | Arisotura <thetotalworm@gmail.com> | 2021-08-30 21:42:35 +0200 |
commit | e1f3fc75ea8618bfc997f401d64e55eb164d7f99 (patch) | |
tree | 843332739d075caf8313b85f4c6d15bb9704b1df /src | |
parent | e7f0923623da4e83eb94a6a01af4170eba267784 (diff) |
* add TSC shito
* fix possible modcrypt shittiness
Diffstat (limited to 'src')
-rw-r--r-- | src/DSi.cpp | 15 | ||||
-rw-r--r-- | src/DSi_SPI_TSC.cpp | 5 | ||||
-rw-r--r-- | src/DSi_SPI_TSC.h | 3 |
3 files changed, 19 insertions, 4 deletions
diff --git a/src/DSi.cpp b/src/DSi.cpp index 8346a1a..01e501b 100644 --- a/src/DSi.cpp +++ b/src/DSi.cpp @@ -26,6 +26,7 @@ #include "GPU.h" #include "NDSCart.h" #include "SPI.h" +#include "DSi_SPI_TSC.h" #include "Platform.h" #ifdef JIT_ENABLED @@ -89,6 +90,9 @@ u8 ITCMInit[0x8000]; u8 ARM7Init[0x3C00]; +void Set_SCFG_Clock9(u16 val); + + bool Init() { #ifndef JIT_ENABLED @@ -230,13 +234,14 @@ void DecryptModcryptArea(u32 offset, u32 size, u8* iv) // find a matching binary area u32 binaryaddr, binarysize; + u32 roundedsize = (size + 0xF) & ~0xF; // CHECKME: GBAtek says the modcrypt area should be the same size, or bigger, // than the binary area being considered // but I have seen modcrypt areas smaller than the ARM9i binary #define BINARY_GOOD(name) \ ((offset >= NDSCart::Header.name##ROMOffset) && \ - (offset+size) <= (NDSCart::Header.name##ROMOffset+NDSCart::Header.name##Size)) + (offset+roundedsize) <= (NDSCart::Header.name##ROMOffset + ((NDSCart::Header.name##Size + 0xF) & ~0xF))) if (BINARY_GOOD(ARM9)) { @@ -314,7 +319,8 @@ void SetupDirectBoot() NDS::MapSharedWRAM(3); - // TODO: clock speed! + DSi_SPI_TSC::SetMode(0x00); + Set_SCFG_Clock9(0x0000); } else { @@ -363,6 +369,9 @@ void SetupDirectBoot() MBK[1][8] = mbk[11] & 0x00FFFF0F; NDS::MapSharedWRAM(mbk[11] >> 24); + + if (!(NDSCart::Header.AppFlags & (1<<0))) + DSi_SPI_TSC::SetMode(0x00); } u32 arm9start = 0; @@ -489,8 +498,6 @@ void SetupDirectBoot() NDS::ARM7BIOSProt = 0x20; - // TODO: SCFG setup, permissions, etc - SPI_Firmware::SetupDirectBoot(true); } diff --git a/src/DSi_SPI_TSC.cpp b/src/DSi_SPI_TSC.cpp index 24bbde0..061feb1 100644 --- a/src/DSi_SPI_TSC.cpp +++ b/src/DSi_SPI_TSC.cpp @@ -81,6 +81,11 @@ void DoSavestate(Savestate* file) // TODO!! } +void SetMode(u8 mode) +{ + TSCMode = mode; +} + void SetTouchCoords(u16 x, u16 y) { if (TSCMode == 0x00) diff --git a/src/DSi_SPI_TSC.h b/src/DSi_SPI_TSC.h index cf3e317..13b7883 100644 --- a/src/DSi_SPI_TSC.h +++ b/src/DSi_SPI_TSC.h @@ -29,6 +29,9 @@ void DeInit(); void Reset(); void DoSavestate(Savestate* file); +// 00=DS-mode 01=normal +void SetMode(u8 mode); + void SetTouchCoords(u16 x, u16 y); void MicInputFrame(s16* data, int samples); |