mirror of
https://github.com/ApacheThunder/NTR_Launcher.git
synced 2025-06-18 19:15:40 -04:00
v2.7 Release Commit...
* Overhaul using improved bootloader from NitrohaxTWL. * Alternate bootloader removed as it appears uneeded. * Improved debug output using text instead of colored boxes from NitroHax's original bootloader design. Debug mode will now show enhanced status readouts of cart load process. Text displayed in red if an error occurs (visible even when debug mode is off if error occured)
This commit is contained in:
parent
3c1568bbf8
commit
24d84286e6
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,5 @@
|
||||
*.cmd
|
||||
*.app
|
||||
*.exe
|
||||
*.cia
|
||||
*.nds
|
||||
@ -9,6 +11,7 @@ Thumbs.db
|
||||
*.elf
|
||||
*.d
|
||||
*.map
|
||||
title/
|
||||
arm9/data/
|
||||
arm7/build
|
||||
arm9/build/
|
||||
|
@ -22,17 +22,18 @@ SPECS := specs
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -mthumb-interwork -march=armv4t
|
||||
ARCH := -mthumb-interwork -march=armv4t -mtune=arm7tdmi
|
||||
|
||||
CFLAGS := -g -Wall -O2\
|
||||
-mcpu=arm7tdmi -mtune=arm7tdmi -fomit-frame-pointer\
|
||||
CFLAGS := -g -Wall -O2 \
|
||||
-fomit-frame-pointer \
|
||||
-ffast-math \
|
||||
-Wall -Wextra -Werror \
|
||||
$(ARCH)
|
||||
|
||||
CFLAGS += $(INCLUDE) -DARM7 -std=gnu99
|
||||
CFLAGS += $(INCLUDE) -DARM7
|
||||
|
||||
ASFLAGS := -g $(ARCH) $(INCLUDE)
|
||||
LDFLAGS = -nostartfiles -T $(TOPDIR)/load.ld -g $(ARCH) -Wl,--nmagic -Wl,-Map,$(TARGET).map
|
||||
LDFLAGS := -nostartfiles -T $(TOPDIR)/load.ld -g $(ARCH) -Wl,-Map,$(TARGET).map
|
||||
|
||||
LIBS := -lnds7
|
||||
|
||||
|
@ -5,7 +5,8 @@ ENTRY(_start)
|
||||
MEMORY {
|
||||
|
||||
vram : ORIGIN = 0x06020000, LENGTH = 128K
|
||||
arm9ram : ORIGIN = 0x023FE000, LENGTH = 8K /* Used for the ARM9's functions */
|
||||
/* arm9ram : ORIGIN = 0x026FD800, LENGTH = 4K Used for the ARM9's functions */
|
||||
arm9ram : ORIGIN = 0x027FC800, LENGTH = 4K /* Used for the ARM9's functions */
|
||||
}
|
||||
|
||||
__vram_start = ORIGIN(vram);
|
||||
@ -15,15 +16,17 @@ __sp_svc = __sp_irq - 0x100;
|
||||
__sp_usr = __sp_svc - 0x100;
|
||||
|
||||
__irq_flags = __vram_top - 8;
|
||||
__irq_flagsaux = __vram_top - 0x40; /*__irq_flagsaux = 0x04000000 - 0x40;*/
|
||||
__irq_flagsaux = __vram_top - 0x40;
|
||||
__irq_vector = __vram_top - 4;
|
||||
|
||||
|
||||
__arm9ram_start = ORIGIN(arm9ram);
|
||||
__arm9ram_top = ORIGIN(arm9ram)+ LENGTH(arm9ram);
|
||||
__arm9_sp_irq = __arm9ram_top - 0x60;
|
||||
__arm9_sp_svc = __arm9_sp_irq - 0x100;
|
||||
__arm9_sp_usr = __arm9_sp_svc - 0x100;
|
||||
|
||||
/* No IRQs or SVC calls in ARM9 boot code so give them minimal stacks */
|
||||
__arm9_sp_irq = __arm9ram_top;
|
||||
__arm9_sp_svc = __arm9_sp_irq - 0x10;
|
||||
__arm9_sp_usr = __arm9_sp_svc - 0x10;
|
||||
|
||||
|
||||
SECTIONS
|
||||
|
@ -1,43 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------
|
||||
|
||||
Copyright (C) 2009
|
||||
Dave Murphy (WinterMute)
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
---------------------------------------------------------------------------------*/
|
||||
|
||||
.text
|
||||
.align 4
|
||||
|
||||
.arm
|
||||
@---------------------------------------------------------------------------------
|
||||
.global swiSoftResetarm7
|
||||
.type swiSoftResetarm7 STT_FUNC
|
||||
@---------------------------------------------------------------------------------
|
||||
swiSoftResetarm7:
|
||||
@---------------------------------------------------------------------------------
|
||||
REG_IME = 0;
|
||||
|
||||
ldr r0,=0x2FFFE34
|
||||
|
||||
|
||||
ldr r0,[r0]
|
||||
bx r0
|
||||
|
||||
.pool
|
@ -1,56 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------
|
||||
|
||||
Copyright (C) 2009
|
||||
Dave Murphy (WinterMute)
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
---------------------------------------------------------------------------------*/
|
||||
|
||||
.text
|
||||
.align 4
|
||||
|
||||
.arm
|
||||
@---------------------------------------------------------------------------------
|
||||
.global swiSoftResetarm9
|
||||
.type swiSoftResetarm9 STT_FUNC
|
||||
@---------------------------------------------------------------------------------
|
||||
swiSoftResetarm9:
|
||||
@---------------------------------------------------------------------------------
|
||||
REG_IME = 0;
|
||||
|
||||
|
||||
.arch armv5te
|
||||
.cpu arm946e-s
|
||||
ldr r1, =0x00002078 @ disable TCM and protection unit
|
||||
mcr p15, 0, r1, c1, c0
|
||||
@ Disable cache
|
||||
mov r0, #0
|
||||
mcr p15, 0, r0, c7, c5, 0 @ Instruction cache
|
||||
mcr p15, 0, r0, c7, c6, 0 @ Data cache
|
||||
|
||||
@ Wait for write buffer to empty
|
||||
mcr p15, 0, r0, c7, c10, 4
|
||||
|
||||
ldr r0,=0x2FFFE24
|
||||
|
||||
|
||||
ldr r0,[r0]
|
||||
bx r0
|
||||
|
||||
.pool
|
@ -1,167 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------
|
||||
|
||||
Copyright (C) 2005
|
||||
Michael Noland (joat)
|
||||
Jason Rogers (dovoto)
|
||||
Dave Murphy (WinterMute)
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
---------------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef NDS_CARD_INCLUDE
|
||||
#define NDS_CARD_INCLUDE
|
||||
|
||||
|
||||
#include "ndstypes.h"
|
||||
|
||||
// Card bus
|
||||
#define REG_CARD_DATA_RD (*(vu32*)0x04100010)
|
||||
|
||||
#define REG_AUXSPICNT (*(vu16*)0x040001A0)
|
||||
#define REG_AUXSPICNTH (*(vu8*)0x040001A1)
|
||||
#define REG_AUXSPIDATA (*(vu8*)0x040001A2)
|
||||
#define REG_ROMCTRL (*(vu32*)0x040001A4)
|
||||
|
||||
#define REG_CARD_COMMAND ((vu8*)0x040001A8)
|
||||
|
||||
#define REG_CARD_1B0 (*(vu32*)0x040001B0)
|
||||
#define REG_CARD_1B4 (*(vu32*)0x040001B4)
|
||||
#define REG_CARD_1B8 (*(vu16*)0x040001B8)
|
||||
#define REG_CARD_1BA (*(vu16*)0x040001BA)
|
||||
|
||||
#define CARD_CR1_ENABLE 0x80 // in byte 1, i.e. 0x8000
|
||||
#define CARD_CR1_IRQ 0x40 // in byte 1, i.e. 0x4000
|
||||
|
||||
// SPI EEPROM COMMANDS
|
||||
#define SPI_EEPROM_WRSR 0x01
|
||||
#define SPI_EEPROM_PP 0x02 // Page Program
|
||||
#define SPI_EEPROM_READ 0x03
|
||||
#define SPI_EEPROM_WRDI 0x04 // Write disable
|
||||
#define SPI_EEPROM_RDSR 0x05 // Read status register
|
||||
#define SPI_EEPROM_WREN 0x06 // Write enable
|
||||
#define SPI_EEPROM_PW 0x0a // Page Write
|
||||
#define SPI_EEPROM_FAST 0x0b // Fast Read
|
||||
#define SPI_EEPROM_RDID 0x9f
|
||||
#define SPI_EEPROM_RDP 0xab // Release from deep power down
|
||||
#define SPI_EEPROM_DPD 0xb9 // Deep power down
|
||||
|
||||
#define CARD_ACTIVATE (1<<31) // when writing, get the ball rolling
|
||||
#define CARD_WR (1<<30) // Card write enable
|
||||
#define CARD_nRESET (1<<29) // value on the /reset pin (1 = high out, not a reset state, 0 = low out = in reset)
|
||||
#define CARD_SEC_LARGE (1<<28) // Use "other" secure area mode, which tranfers blocks of 0x1000 bytes at a time
|
||||
#define CARD_CLK_SLOW (1<<27) // Transfer clock rate (0 = 6.7MHz, 1 = 4.2MHz)
|
||||
#define CARD_BLK_SIZE(n) (((n)&0x7)<<24) // Transfer block size, (0 = None, 1..6 = (0x100 << n) bytes, 7 = 4 bytes)
|
||||
#define CARD_SEC_CMD (1<<22) // The command transfer will be hardware encrypted (KEY2)
|
||||
#define CARD_DELAY2(n) (((n)&0x3F)<<16) // Transfer delay length part 2
|
||||
#define CARD_SEC_SEED (1<<15) // Apply encryption (KEY2) seed to hardware registers
|
||||
#define CARD_SEC_EN (1<<14) // Security enable
|
||||
#define CARD_SEC_DAT (1<<13) // The data transfer will be hardware encrypted (KEY2)
|
||||
#define CARD_DELAY1(n) ((n)&0x1FFF) // Transfer delay length part 1
|
||||
|
||||
// 3 bits in b10..b8 indicate something
|
||||
// read bits
|
||||
#define CARD_BUSY (1<<31) // when reading, still expecting incomming data?
|
||||
#define CARD_DATA_READY (1<<23) // when reading, CARD_DATA_RD or CARD_DATA has another word of data and is good to go
|
||||
|
||||
// Card commands
|
||||
#define CARD_CMD_DUMMY 0x9F
|
||||
#define CARD_CMD_HEADER_READ 0x00
|
||||
#define CARD_CMD_HEADER_CHIPID 0x90
|
||||
#define CARD_CMD_ACTIVATE_BF 0x3C // Go into blowfish (KEY1) encryption mode
|
||||
#define CARD_CMD_ACTIVATE_SEC 0x40 // Go into hardware (KEY2) encryption mode
|
||||
#define CARD_CMD_SECURE_CHIPID 0x10
|
||||
#define CARD_CMD_SECURE_READ 0x20
|
||||
#define CARD_CMD_DISABLE_SEC 0x60 // Leave hardware (KEY2) encryption mode
|
||||
#define CARD_CMD_DATA_MODE 0xA0
|
||||
#define CARD_CMD_DATA_READ 0xB7
|
||||
#define CARD_CMD_DATA_CHIPID 0xB8
|
||||
|
||||
//REG_AUXSPICNT
|
||||
#define CARD_ENABLE (1<<15)
|
||||
#define CARD_SPI_ENABLE (1<<13)
|
||||
#define CARD_SPI_BUSY (1<<7)
|
||||
#define CARD_SPI_HOLD (1<<6)
|
||||
|
||||
#define CARD_SPICNTH_ENABLE (1<<7) // in byte 1, i.e. 0x8000
|
||||
#define CARD_SPICNTH_IRQ (1<<6) // in byte 1, i.e. 0x4000
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
void enableSlot1();
|
||||
void disableSlot1();
|
||||
|
||||
void cardWriteCommand(const u8 *command);
|
||||
void cardPolledTransfer(u32 flags, u32 *destination, u32 length, const u8 *command);
|
||||
void cardStartTransfer(const u8 *command, u32 *destination, int channel, u32 flags);
|
||||
uint32 cardWriteAndRead(const u8 *command, u32 flags);
|
||||
void cardParamCommand (u8 command, u32 parameter, u32 flags, u32 *destination, u32 length);
|
||||
|
||||
// These commands require the cart to not be initialized yet, which may mean the user
|
||||
// needs to eject and reinsert the cart or they will return random data.
|
||||
void cardReadHeader(u8 *header);
|
||||
u32 cardReadID(u32 flags);
|
||||
void cardReset();
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
static inline void eepromWaitBusy() {
|
||||
//---------------------------------------------------------------------------------
|
||||
while (REG_AUXSPICNT & CARD_SPI_BUSY);
|
||||
}
|
||||
|
||||
// Reads from the EEPROM
|
||||
void cardReadEeprom(u32 address, u8 *data, u32 length, u32 addrtype);
|
||||
|
||||
// Writes to the EEPROM. TYPE 3 EEPROM must be erased first (I think?)
|
||||
void cardWriteEeprom(u32 address, u8 *data, u32 length, u32 addrtype);
|
||||
|
||||
// Returns the ID of the EEPROM chip? Doesn't work well, most chips give ff,ff
|
||||
// i = 0 or 1
|
||||
u32 cardEepromReadID();
|
||||
|
||||
// Sends a command to the EEPROM
|
||||
u8 cardEepromCommand(u8 command);
|
||||
|
||||
/*
|
||||
* -1:no card or no EEPROM
|
||||
* 0:unknown PassMe?
|
||||
* 1:TYPE 1 4Kbit(512Byte) EEPROM
|
||||
* 2:TYPE 2 64Kbit(8KByte)or 512kbit(64Kbyte) EEPROM
|
||||
* 3:TYPE 3 2Mbit(256KByte) FLASH MEMORY (some rare 4Mbit and 8Mbit chips also)
|
||||
*/
|
||||
int cardEepromGetType(void);
|
||||
|
||||
// Returns the size in bytes of EEPROM
|
||||
u32 cardEepromGetSize();
|
||||
|
||||
// Erases the entire chip. TYPE 3 chips MUST be erased before writing to them. (I think?)
|
||||
void cardEepromChipErase(void);
|
||||
|
||||
// Erases a single sector of the TYPE 3 chip
|
||||
void cardEepromSectorErase(u32 address);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -41,28 +41,5 @@ BEGIN_ASM_FUNC arm9_clearCache
|
||||
mcr p15, 0, r3, c7, c6, 0 @ Flush DCache
|
||||
mcr p15, 0, r3, c7, c10, 4 @ empty write buffer
|
||||
|
||||
mcr p15, 0, r3, c3, c0, 0 @ disable write buffer (def = 0)
|
||||
|
||||
mcr p15, 0, r3, c2, c0, 0 @ disable DTCM and protection unit
|
||||
|
||||
mcr p15, 0, r3, c6, c0, 0 @ disable protection unit 0 (def = 0)
|
||||
mcr p15, 0, r3, c6, c1, 0 @ disable protection unit 1 (def = 0)
|
||||
mcr p15, 0, r3, c6, c2, 0 @ disable protection unit 2 (def = 0)
|
||||
mcr p15, 0, r3, c6, c3, 0 @ disable protection unit 3 (def = 0)
|
||||
mcr p15, 0, r3, c6, c4, 0 @ disable protection unit 4 (def = ?)
|
||||
mcr p15, 0, r3, c6, c5, 0 @ disable protection unit 5 (def = ?)
|
||||
mcr p15, 0, r3, c6, c6, 0 @ disable protection unit 6 (def = ?)
|
||||
mcr p15, 0, r3, c6, c7, 0 @ disable protection unit 7 (def = ?)
|
||||
|
||||
mcr p15, 0, r3, c5, c0, 3 @ IAccess
|
||||
mcr p15, 0, r3, c5, c0, 2 @ DAccess
|
||||
|
||||
mov r3, #0x00800000
|
||||
add r3, r3, #0x00A
|
||||
mcr p15, 0, r3, c9, c1, 0 @ DTCM base (def = 0x0080000A) ???
|
||||
|
||||
mov r3, #0x0000000C
|
||||
mcr p15, 0, r3, c9, c1, 1 @ ITCM base (def = 0x0000000C) ???
|
||||
|
||||
bx lr
|
||||
|
||||
|
@ -20,31 +20,61 @@
|
||||
#define _COMMON_H
|
||||
|
||||
#include <nds/dma.h>
|
||||
#include <nds/ipc.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define resetCpu() \
|
||||
__asm volatile("swi 0x000000")
|
||||
|
||||
typedef struct sLauncherSettings {
|
||||
u8 language;
|
||||
u8 scfgUnlock;
|
||||
u8 twlMode;
|
||||
u8 twlCLK;
|
||||
u8 twlVRAM;
|
||||
u8 debugMode;
|
||||
} tLauncherSettings;
|
||||
|
||||
typedef enum { ERR_NONE=0x00, ERR_STS_CLR_MEM=0x01, ERR_STS_LOAD_BIN=0x02, ERR_STS_HOOK_BIN=0x03, ERR_STS_START=0x04,
|
||||
// initCard error codes:
|
||||
ERR_LOAD_NORM=0x11, ERR_LOAD_OTHR=0x12, ERR_SEC_NORM=0x13, ERR_SEC_OTHR=0x14, ERR_LOGO_CRC=0x15, ERR_HEAD_CRC=0x16,
|
||||
// hookARM7Binary error codes:
|
||||
ERR_NOCHEAT=0x21, ERR_HOOK=0x22,
|
||||
} ERROR_CODES;
|
||||
extern volatile tLauncherSettings* tmpData;
|
||||
|
||||
typedef enum {ARM9_BOOT, ARM9_START, ARM9_MEMCLR, ARM9_READY, ARM9_BOOTBIN, ARM9_DISPERR, ARM9_SETSCFG} ARM9_STATE;
|
||||
extern tNDSHeader* ndsHeader;
|
||||
enum ERROR_CODES {
|
||||
ERR_NONE = 0x00,
|
||||
ERR_STS_CLR_MEM = 0x01,
|
||||
ERR_STS_LOAD_BIN = 0x02,
|
||||
ERR_STS_HOOK_BIN = 0x03,
|
||||
ERR_STS_START = 0x04,
|
||||
// initCard error codes:
|
||||
ERR_LOAD_NORM = 0x11,
|
||||
ERR_LOAD_OTHR = 0x12,
|
||||
ERR_SEC_NORM = 0x13,
|
||||
ERR_SEC_OTHR = 0x14,
|
||||
ERR_LOGO_CRC = 0x15,
|
||||
ERR_HEAD_CRC = 0x16,
|
||||
ERR_STS_STARTBIN = 0x21,
|
||||
};
|
||||
|
||||
extern bool arm9_dsiModeConfirmed;
|
||||
extern bool arm9_ExtendRam;
|
||||
extern bool arm9_boostVram;
|
||||
extern bool arm9_scfgUnlock;
|
||||
extern bool arm9_TWLClockSpeeds;
|
||||
extern bool arm9_DebugMode;
|
||||
// Values fixed so they can be shared with ASM code
|
||||
enum ARM9_STATE {
|
||||
ARM9_BOOT = 0,
|
||||
ARM9_START = 1,
|
||||
ARM9_RESET = 2,
|
||||
ARM9_READY = 3,
|
||||
ARM9_MEMCLR = 4
|
||||
};
|
||||
|
||||
enum ARM7_STATE {
|
||||
ARM7_BOOT = 0,
|
||||
ARM7_START = 1,
|
||||
ARM7_RESET = 2,
|
||||
ARM7_READY = 3,
|
||||
ARM7_MEMCLR = 4,
|
||||
ARM7_LOADBIN = 5,
|
||||
ARM7_HOOKBIN = 6,
|
||||
ARM7_BOOTBIN = 7,
|
||||
ARM7_ERR = 8
|
||||
};
|
||||
|
||||
extern volatile int arm9_stateFlag;
|
||||
extern volatile u32 arm9_errorCode;
|
||||
extern volatile bool arm9_errorClearBG;
|
||||
|
||||
static inline void dmaFill(const void* src, void* dest, uint32 size) {
|
||||
DMA_SRC(3) = (uint32)src;
|
||||
@ -54,10 +84,17 @@ static inline void dmaFill(const void* src, void* dest, uint32 size) {
|
||||
}
|
||||
|
||||
static inline void copyLoop (u32* dest, const u32* src, size_t size) {
|
||||
do {
|
||||
*dest++ = *src++;
|
||||
} while (size -= 4);
|
||||
do { *dest++ = *src++; } while (size -= 4);
|
||||
}
|
||||
|
||||
static inline void ipcSendState(uint8_t state) {
|
||||
REG_IPC_SYNC = (state & 0x0f) << 8;
|
||||
}
|
||||
|
||||
static inline uint8_t ipcRecvState(void) {
|
||||
return (uint8_t)(REG_IPC_SYNC & 0x0f);
|
||||
}
|
||||
|
||||
|
||||
#endif // _COMMON_H
|
||||
|
||||
|
@ -1,151 +0,0 @@
|
||||
/*
|
||||
Copyright (C) 2008 somebody
|
||||
Copyright (C) 2009 yellow wood goblin
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <nds/ndstypes.h>
|
||||
#include <nds/memory.h> // tNDSHeader
|
||||
#include <stddef.h>
|
||||
#include "module_params.h"
|
||||
|
||||
/*static void decompressLZ77Backwards(u8* addr, u32 size) {
|
||||
u32 len = *(u32*)(addr + size - 4) + size;
|
||||
|
||||
if(len == size) {
|
||||
size -= 12;
|
||||
}
|
||||
|
||||
len = *(u32*)(addr + size - 4) + size;
|
||||
|
||||
//byte[] Result = new byte[len];
|
||||
//Array.Copy(Data, Result, Data.Length);
|
||||
|
||||
u32 end = *(u32*)(addr + size - 8) & 0xFFFFFF;
|
||||
|
||||
u8* result = addr;
|
||||
|
||||
int Offs = (int)(size - (*(u32*)(addr + size - 8) >> 24));
|
||||
int dstoffs = (int)len;
|
||||
while (true) {
|
||||
u8 header = result[--Offs];
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if ((header & 0x80) == 0) {
|
||||
result[--dstoffs] = result[--Offs];
|
||||
} else {
|
||||
u8 a = result[--Offs];
|
||||
u8 b = result[--Offs];
|
||||
int offs = (((a & 0xF) << 8) | b) + 2;//+ 1;
|
||||
int length = (a >> 4) + 2;
|
||||
do {
|
||||
result[dstoffs - 1] = result[dstoffs + offs];
|
||||
dstoffs--;
|
||||
length--;
|
||||
} while (length >= 0);
|
||||
}
|
||||
|
||||
if (Offs <= size - end) {
|
||||
return;
|
||||
}
|
||||
|
||||
header <<= 1;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
//static u32 iUncompressedSize = 0;
|
||||
static u32 iFixedAddr = 0;
|
||||
static u32 iFixedData = 0;
|
||||
|
||||
static u32 decompressBinary(u8 *aMainMemory, u32 aCodeLength, u32 aMemOffset) {
|
||||
u8 *ADDR1 = NULL;
|
||||
u8 *ADDR1_END = NULL;
|
||||
u8 *ADDR2 = NULL;
|
||||
u8 *ADDR3 = NULL;
|
||||
|
||||
u8 *pBuffer32 = (u8 *)(aMainMemory);
|
||||
u8 *pBuffer32End = (u8 *)(aMainMemory + aCodeLength);
|
||||
|
||||
while (pBuffer32 < pBuffer32End) {
|
||||
if (0xDEC00621 == *(u32 *)pBuffer32 && 0x2106C0DE == *(u32 *)(pBuffer32 + 4)) {
|
||||
ADDR1 = (u8 *)(*(u32 *)(pBuffer32 - 8));
|
||||
iFixedAddr = (u32)(pBuffer32 - 8);
|
||||
iFixedData = *(u32 *)(pBuffer32 - 8);
|
||||
*(u32 *)(pBuffer32 - 8) = 0;
|
||||
break;
|
||||
}
|
||||
pBuffer32 += 4;
|
||||
}
|
||||
if (0 == ADDR1) {
|
||||
iFixedAddr = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 A = *(u32 *)(ADDR1 + aMemOffset - 4);
|
||||
u32 B = *(u32 *)(ADDR1 + aMemOffset - 8);
|
||||
ADDR1_END = ADDR1 + A;
|
||||
ADDR2 = ADDR1 - (B >> 24);
|
||||
B &= ~0xff000000;
|
||||
ADDR3 = ADDR1 - B;
|
||||
u32 uncompressEnd = ((u32)ADDR1_END) - ((u32)aMainMemory);
|
||||
|
||||
while (!(ADDR2 <= ADDR3)) {
|
||||
u32 marku8 = *(--ADDR2 + aMemOffset);
|
||||
//ADDR2-=1;
|
||||
int count = 8;
|
||||
while (true) {
|
||||
count--;
|
||||
if (count < 0)
|
||||
break;
|
||||
if (0 == (marku8 & 0x80)) {
|
||||
*(--ADDR1_END + aMemOffset) = *(--ADDR2 + aMemOffset);
|
||||
} else {
|
||||
int u8_r12 = *(--ADDR2 + aMemOffset);
|
||||
int u8_r7 = *(--ADDR2 + aMemOffset);
|
||||
u8_r7 |= (u8_r12 << 8);
|
||||
u8_r7 &= ~0xf000;
|
||||
u8_r7 += 2;
|
||||
u8_r12 += 0x20;
|
||||
do
|
||||
{
|
||||
u8 realu8 = *(ADDR1_END + aMemOffset + u8_r7);
|
||||
*(--ADDR1_END + aMemOffset) = realu8;
|
||||
u8_r12 -= 0x10;
|
||||
} while (u8_r12 >= 0);
|
||||
}
|
||||
marku8 <<= 1;
|
||||
if (ADDR2 <= ADDR3) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return uncompressEnd;
|
||||
}
|
||||
|
||||
void ensureBinaryDecompressed(const tNDSHeader* ndsHeader, module_params_t* moduleParams) {
|
||||
//const char* romTid = getRomTid(ndsHeader);
|
||||
|
||||
if (
|
||||
moduleParams->compressed_static_end
|
||||
/*|| strcmp(romTid, "YQUJ") == 0 // Chrono Trigger (Japan)
|
||||
|| strcmp(romTid, "YQUE") == 0 // Chrono Trigger (USA)
|
||||
|| strcmp(romTid, "YQUP") == 0 // Chrono Trigger (Europe)*/
|
||||
) {
|
||||
// Compressed
|
||||
//dbg_printf("This rom is compressed\n");
|
||||
//decompressLZ77Backwards((u8*)ndsHeader->arm9destination, ndsHeader->arm9binarySize);
|
||||
decompressBinary((u8*)ndsHeader->arm9destination, ndsHeader->arm9binarySize, 0);
|
||||
moduleParams->compressed_static_end = 0;
|
||||
}/* else {
|
||||
// Not compressed
|
||||
dbg_printf("This rom is not compressed\n");
|
||||
}*/
|
||||
}
|
@ -18,9 +18,7 @@
|
||||
|
||||
#include <string.h>
|
||||
#include "encryption.h"
|
||||
#include "key1.h"
|
||||
#include "key2.h"
|
||||
#include "tonccpy.h"
|
||||
#include "read_bios.h"
|
||||
|
||||
#define KEYSIZE 0x1048
|
||||
|
||||
@ -86,7 +84,7 @@ void apply_keycode (u32 modulo) {
|
||||
|
||||
crypt_64bit_up (&keycode[1]);
|
||||
crypt_64bit_up (&keycode[0]);
|
||||
toncset (scratch, 0, 8);
|
||||
memset (scratch, 0, 8);
|
||||
|
||||
for (i = 0; i < 0x12; i+=1) {
|
||||
keybuf[i] = keybuf[i] ^ bswap_32bit (keycode[i % modulo]);
|
||||
@ -98,8 +96,8 @@ void apply_keycode (u32 modulo) {
|
||||
}
|
||||
}
|
||||
|
||||
void init_keycode (u32 idcode, u32 level, u32 modulo, int iCardDevice) {
|
||||
tonccpy ((u8*)keybuf, (iCardDevice ? gEncrDataTwl : gEncrData), KEYSIZE);
|
||||
void init_keycode (u32 idcode, u32 level, u32 modulo) {
|
||||
readBios ((u8*)keybuf, 0x30, KEYSIZE);
|
||||
keycode[0] = idcode;
|
||||
keycode[1] = idcode/2;
|
||||
keycode[2] = idcode*2;
|
||||
|
@ -20,7 +20,7 @@
|
||||
#define ENCRYPTION_H
|
||||
|
||||
#include <nds/ndstypes.h>
|
||||
void init_keycode (u32 idcode, u32 level, u32 modulo, int iCardDevice);
|
||||
void init_keycode (u32 idcode, u32 level, u32 modulo);
|
||||
void crypt_64bit_down (u32* ptr);
|
||||
void crypt_64bit_up (u32* ptr);
|
||||
|
||||
|
@ -1,32 +0,0 @@
|
||||
#ifndef FIND_H
|
||||
#define FIND_H
|
||||
|
||||
#include <nds/ndstypes.h>
|
||||
#include <nds/memory.h> // tNDSHeader
|
||||
#include "module_params.h"
|
||||
|
||||
// COMMON
|
||||
//u8* memsearch(const u8* start, u32 dataSize, const u8* find, u32 findSize);
|
||||
u32* memsearch32(const u32* start, u32 dataSize, const u32* find, u32 findSize, bool forward);
|
||||
u16* memsearch16(const u16* start, u32 dataSize, const u16* find, u32 findSize, bool forward);
|
||||
|
||||
inline u32* findOffset(const u32* start, u32 dataSize, const u32* find, u32 findLen) {
|
||||
return memsearch32(start, dataSize, find, findLen*sizeof(u32), true);
|
||||
}
|
||||
inline u32* findOffsetBackwards(const u32* start, u32 dataSize, const u32* find, u32 findLen) {
|
||||
return memsearch32(start, dataSize, find, findLen*sizeof(u32), false);
|
||||
}
|
||||
inline u16* findOffsetThumb(const u16* start, u32 dataSize, const u16* find, u32 findLen) {
|
||||
return memsearch16(start, dataSize, find, findLen*sizeof(u16), true);
|
||||
}
|
||||
inline u16* findOffsetBackwardsThumb(const u16* start, u32 dataSize, const u16* find, u32 findLen) {
|
||||
return memsearch16(start, dataSize, find, findLen*sizeof(u16), false);
|
||||
}
|
||||
|
||||
const u32* getMpuInitRegionSignature(u32 patchMpuRegion);
|
||||
u32* findMpuStartOffset(const tNDSHeader* ndsHeader, u32 patchMpuRegion);
|
||||
u32* findMpuDataOffset(const module_params_t* moduleParams, u32 patchMpuRegion, const u32* mpuStartOffset);
|
||||
u32* findMpuInitCacheOffset(const u32* mpuStartOffset);
|
||||
|
||||
#endif // FIND_H
|
||||
|
@ -1,141 +0,0 @@
|
||||
#include <stddef.h> // NULL
|
||||
#include "patch.h"
|
||||
#include "find.h"
|
||||
|
||||
//#define memset __builtin_memset
|
||||
|
||||
//
|
||||
// Subroutine function signatures ARM9
|
||||
//
|
||||
|
||||
// Mpu cache
|
||||
static const u32 mpuInitRegion0Signature[1] = {0xEE060F10};
|
||||
static const u32 mpuInitRegion0Data[1] = {0x4000033};
|
||||
static const u32 mpuInitRegion1Signature[1] = {0xEE060F11};
|
||||
static const u32 mpuInitRegion1Data1[1] = {0x200002D}; // SDK <= 3
|
||||
static const u32 mpuInitRegion1Data4[1] = {0x200002D}; // SDK >= 4
|
||||
//static const u32 mpuInitRegion1DataAlt[1] = {0x200002B};
|
||||
static const u32 mpuInitRegion2Signature[1] = {0xEE060F12};
|
||||
static const u32 mpuInitRegion2Data1[1] = {0x27C0023}; // SDK != 3 (Previously: SDK <= 2)
|
||||
static const u32 mpuInitRegion2Data3[1] = {0x27E0021}; // SDK 3 (Previously: SDK >= 3)
|
||||
static const u32 mpuInitRegion3Signature[1] = {0xEE060F13};
|
||||
static const u32 mpuInitRegion3Data[1] = {0x8000035};
|
||||
|
||||
// Mpu cache init
|
||||
static const u32 mpuInitCache[1] = {0xE3A00042};
|
||||
|
||||
const u32* getMpuInitRegionSignature(u32 patchMpuRegion) {
|
||||
switch (patchMpuRegion) {
|
||||
case 0: return mpuInitRegion0Signature;
|
||||
case 1: return mpuInitRegion1Signature;
|
||||
case 2: return mpuInitRegion2Signature;
|
||||
case 3: return mpuInitRegion3Signature;
|
||||
}
|
||||
return mpuInitRegion1Signature;
|
||||
}
|
||||
|
||||
u32* findMpuStartOffset(const tNDSHeader* ndsHeader, u32 patchMpuRegion) {
|
||||
// dbg_printf("findMpuStartOffset:\n");
|
||||
|
||||
const u32* mpuInitRegionSignature = getMpuInitRegionSignature(patchMpuRegion);
|
||||
|
||||
u32* mpuStartOffset = findOffset(
|
||||
(u32*)ndsHeader->arm9destination, ndsHeader->arm9binarySize,
|
||||
mpuInitRegionSignature, 1
|
||||
);
|
||||
if (mpuStartOffset) {
|
||||
// dbg_printf("Mpu init found: ");
|
||||
} else {
|
||||
// dbg_printf("Mpu init not found\n");
|
||||
}
|
||||
|
||||
if (mpuStartOffset) {
|
||||
// dbg_hexa((u32)mpuStartOffset);
|
||||
// dbg_printf("\n");
|
||||
}
|
||||
|
||||
// dbg_printf("\n");
|
||||
return mpuStartOffset;
|
||||
}
|
||||
|
||||
u32* findMpuDataOffset(const module_params_t* moduleParams, u32 patchMpuRegion, const u32* mpuStartOffset) {
|
||||
if (!mpuStartOffset) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// dbg_printf("findMpuDataOffset:\n");
|
||||
|
||||
const u32* mpuInitRegion1Data = mpuInitRegion1Data1;
|
||||
const u32* mpuInitRegion2Data = mpuInitRegion2Data1;
|
||||
if (moduleParams->sdk_version > 0x3000000 && moduleParams->sdk_version < 0x4000000) {
|
||||
mpuInitRegion2Data = mpuInitRegion2Data3;
|
||||
} else if (moduleParams->sdk_version > 0x4000000) {
|
||||
mpuInitRegion1Data = mpuInitRegion1Data4;
|
||||
}
|
||||
|
||||
const u32* mpuInitRegionData = mpuInitRegion1Data;
|
||||
switch (patchMpuRegion) {
|
||||
case 0:
|
||||
mpuInitRegionData = mpuInitRegion0Data;
|
||||
break;
|
||||
case 1:
|
||||
mpuInitRegionData = mpuInitRegion1Data;
|
||||
break;
|
||||
case 2:
|
||||
mpuInitRegionData = mpuInitRegion2Data;
|
||||
break;
|
||||
case 3:
|
||||
mpuInitRegionData = mpuInitRegion3Data;
|
||||
break;
|
||||
}
|
||||
|
||||
u32* mpuDataOffset = findOffset(
|
||||
mpuStartOffset, 0x100,
|
||||
mpuInitRegionData, 1
|
||||
);
|
||||
if (!mpuDataOffset) {
|
||||
// Try to find it
|
||||
for (int i = 0; i < 0x100; i++) {
|
||||
mpuDataOffset += i;
|
||||
if ((*mpuDataOffset & 0xFFFFFF00) == 0x02000000) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mpuDataOffset) {
|
||||
// dbg_printf("Mpu data found: ");
|
||||
} else {
|
||||
// dbg_printf("Mpu data not found\n");
|
||||
}
|
||||
|
||||
if (mpuDataOffset) {
|
||||
// dbg_hexa((u32)mpuDataOffset);
|
||||
// dbg_printf("\n");
|
||||
}
|
||||
|
||||
// dbg_printf("\n");
|
||||
return mpuDataOffset;
|
||||
}
|
||||
|
||||
u32* findMpuInitCacheOffset(const u32* mpuStartOffset) {
|
||||
// dbg_printf("findMpuInitCacheOffset:\n");
|
||||
|
||||
u32* mpuInitCacheOffset = findOffset(
|
||||
mpuStartOffset, 0x100,
|
||||
mpuInitCache, 1
|
||||
);
|
||||
if (mpuInitCacheOffset) {
|
||||
// dbg_printf("Mpu init cache found: ");
|
||||
} else {
|
||||
// dbg_printf("Mpu init cache not found\n");
|
||||
}
|
||||
|
||||
if (mpuInitCacheOffset) {
|
||||
// dbg_hexa((u32)mpuInitCacheOffset);
|
||||
// dbg_printf("\n");
|
||||
}
|
||||
|
||||
// dbg_printf("\n");
|
||||
return mpuInitCacheOffset;
|
||||
}
|
||||
|
@ -1,117 +0,0 @@
|
||||
//#include <string.h> // memcmp
|
||||
#include <stddef.h> // NULL
|
||||
#include <nds/ndstypes.h>
|
||||
//#include <limits.h>
|
||||
#include "find.h"
|
||||
|
||||
// (memcmp is slower)
|
||||
//#define memcmp __builtin_memcmp
|
||||
|
||||
//#define TABLE_SIZE (UCHAR_MAX + 1) // 256
|
||||
|
||||
extern inline u32* findOffset(const u32* start, u32 dataLen, const u32* find, u32 findLen);
|
||||
extern inline u32* findOffsetBackwards(const u32* start, u32 dataLen, const u32* find, u32 findLen);
|
||||
extern inline u16* findOffsetThumb(const u16* start, u32 dataLen, const u16* find, u32 findLen);
|
||||
extern inline u16* findOffsetBackwardsThumb(const u16* start, u32 dataLen, const u16* find, u32 findLen);
|
||||
|
||||
/*
|
||||
* Look for @find and return the position of it.
|
||||
* Brute Force algorithm
|
||||
*/
|
||||
u32* memsearch32(const u32* start, u32 dataSize, const u32* find, u32 findSize, bool forward) {
|
||||
u32 dataLen = dataSize/sizeof(u32);
|
||||
u32 findLen = findSize/sizeof(u32);
|
||||
|
||||
const u32* end = forward ? (start + dataLen) : (start - dataLen);
|
||||
for (u32* addr = (u32*)start; addr != end; forward ? ++addr : --addr) {
|
||||
bool found = true;
|
||||
for (u32 j = 0; j < findLen; ++j) {
|
||||
if (addr[j] != find[j]) {
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
return (u32*)addr;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
u16* memsearch16(const u16* start, u32 dataSize, const u16* find, u32 findSize, bool forward) {
|
||||
u32 dataLen = dataSize/sizeof(u16);
|
||||
u32 findLen = findSize/sizeof(u16);
|
||||
|
||||
const u16* end = forward ? (start + dataLen) : (start - dataLen);
|
||||
for (u16* addr = (u16*)start; addr != end; forward ? ++addr : --addr) {
|
||||
bool found = true;
|
||||
for (u32 j = 0; j < findLen; ++j) {
|
||||
if (addr[j] != find[j]) {
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
return (u16*)addr;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Boyer-Moore Horspool algorithm
|
||||
*/
|
||||
/*u8* memsearch(const u8* start, u32 dataSize, const u8* find, u32 findSize) {
|
||||
u32 dataLen = dataSize/sizeof(u8);
|
||||
u32 findLen = findSize/sizeof(u8);
|
||||
|
||||
u32 table[TABLE_SIZE];
|
||||
|
||||
// Preprocessing
|
||||
for (u32 i = 0; i < TABLE_SIZE; ++i) {
|
||||
table[i] = findLen;
|
||||
}
|
||||
for (u32 i = 0; i < findLen - 1; ++i) {
|
||||
table[find[i]] = findLen - i - 1;
|
||||
}
|
||||
|
||||
// Searching
|
||||
u32 j = 0;
|
||||
while (j <= dataLen - findLen) {
|
||||
u8 c = start[j + findLen - 1];
|
||||
if (find[findLen - 1] == c && memcmp(find, start + j, findLen - 1) == 0) {
|
||||
return (u8*)start + j;
|
||||
}
|
||||
j += table[c];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}*/
|
||||
|
||||
/*
|
||||
* Quick Search algorithm
|
||||
*/
|
||||
/*u8* memsearch(const u8* start, u32 dataSize, const u8* find, u32 findSize) {
|
||||
u32 dataLen = dataSize/sizeof(u8);
|
||||
u32 findLen = findSize/sizeof(u8);
|
||||
|
||||
u32 table[TABLE_SIZE];
|
||||
|
||||
// Preprocessing
|
||||
for (u32 i = 0; i < TABLE_SIZE; ++i) {
|
||||
table[i] = findLen + 1;
|
||||
}
|
||||
for (u32 i = 0; i < findLen; ++i) {
|
||||
table[find[i]] = findLen - i;
|
||||
}
|
||||
|
||||
// Searching
|
||||
u32 j = 0;
|
||||
while (j <= dataLen - findLen) {
|
||||
if (memcmp(find, start + j, findLen) == 0) {
|
||||
return (u8*)start + j;
|
||||
}
|
||||
j += table[start[j + findLen]];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}*/
|
@ -1,264 +0,0 @@
|
||||
const unsigned char gEncrData[] =
|
||||
{
|
||||
0x99,0xD5,0x20,0x5F,0x57,0x44,0xF5,0xB9,0x6E,0x19,0xA4,0xD9,0x9E,0x6A,0x5A,0x94,
|
||||
0xD8,0xAE,0xF1,0xEB,0x41,0x75,0xE2,0x3A,0x93,0x82,0xD0,0x32,0x33,0xEE,0x31,0xD5,
|
||||
0xCC,0x57,0x61,0x9A,0x37,0x06,0xA2,0x1B,0x79,0x39,0x72,0xF5,0x55,0xAE,0xF6,0xBE,
|
||||
0x5F,0x1B,0x69,0xFB,0xE5,0x9D,0xF1,0xE9,0xCE,0x2C,0xD9,0xA1,0x5E,0x32,0x05,0xE6,
|
||||
0xFE,0xD3,0xFE,0xCF,0xD4,0x62,0x04,0x0D,0x8B,0xF5,0xEC,0xB7,0x2B,0x60,0x79,0xBB,
|
||||
0x12,0x95,0x31,0x0D,0x6E,0x3F,0xDA,0x2B,0x88,0x84,0xF0,0xF1,0x3D,0x12,0x7E,0x25,
|
||||
0x45,0x22,0xF1,0xBB,0x24,0x06,0x1A,0x06,0x11,0xAD,0xDF,0x28,0x8B,0x64,0x81,0x34,
|
||||
0x2B,0xEB,0x33,0x29,0x99,0xAA,0xF2,0xBD,0x9C,0x14,0x95,0x9D,0x9F,0xF7,0xF5,0x8C,
|
||||
0x72,0x97,0xA1,0x29,0x9D,0xD1,0x5F,0xCF,0x66,0x4D,0x07,0x1A,0xDE,0xD3,0x4A,0x4B,
|
||||
0x85,0xC9,0xA7,0xA3,0x17,0x95,0x05,0x3A,0x3D,0x49,0x0A,0xBF,0x0A,0x89,0x8B,0xA2,
|
||||
0x4A,0x82,0x49,0xDD,0x27,0x90,0xF1,0x0B,0xE9,0xEB,0x1C,0x6A,0x83,0x76,0x45,0x05,
|
||||
0xBA,0x81,0x70,0x61,0x17,0x3F,0x4B,0xDE,0xAE,0xCF,0xAB,0x39,0x57,0xF2,0x3A,0x56,
|
||||
0x48,0x11,0xAD,0x8A,0x40,0xE1,0x45,0x3F,0xFA,0x9B,0x02,0x54,0xCA,0xA6,0x93,0xFB,
|
||||
0xEF,0x4D,0xFE,0x6F,0xA3,0xD8,0x87,0x9C,0x08,0xBA,0xD5,0x48,0x6A,0x8D,0x2D,0xFD,
|
||||
0x6E,0x15,0xF8,0x74,0xBD,0xBE,0x52,0x8B,0x18,0x22,0x8A,0x9E,0xFB,0x74,0x37,0x07,
|
||||
0x1B,0x36,0x6C,0x4A,0x19,0xBA,0x42,0x62,0xB9,0x79,0x91,0x10,0x7B,0x67,0x65,0x96,
|
||||
0xFE,0x02,0x23,0xE8,0xEE,0x99,0x8C,0x77,0x3E,0x5C,0x86,0x64,0x4D,0x6D,0x78,0x86,
|
||||
0xA5,0x4F,0x65,0xE2,0x1E,0xB2,0xDF,0x5A,0x0A,0xD0,0x7E,0x08,0x14,0xB0,0x71,0xAC,
|
||||
0xBD,0xDB,0x83,0x1C,0xB9,0xD7,0xA1,0x62,0xCD,0xC6,0x63,0x7C,0x52,0x69,0xC3,0xE6,
|
||||
0xBF,0x75,0xCE,0x12,0x44,0x5D,0x21,0x04,0xFA,0xFB,0xD3,0x3C,0x38,0x11,0x63,0xD4,
|
||||
0x95,0x85,0x41,0x49,0x46,0x09,0xF2,0x08,0x43,0x11,0xDC,0x1F,0x76,0xC0,0x15,0x6D,
|
||||
0x1F,0x3C,0x63,0x70,0xEA,0x87,0x80,0x6C,0xC3,0xBD,0x63,0x8B,0xC2,0x37,0x21,0x37,
|
||||
0xDC,0xEE,0x09,0x23,0x2E,0x37,0x6A,0x4D,0x73,0x90,0xF7,0x50,0x30,0xAC,0x1C,0x92,
|
||||
0x04,0x10,0x23,0x91,0x4F,0xD2,0x07,0xAA,0x68,0x3E,0x4F,0x9A,0xC9,0x64,0x60,0x6A,
|
||||
0xC8,0x14,0x21,0xF3,0xD6,0x22,0x41,0x12,0x44,0x24,0xCF,0xE6,0x8A,0x56,0xDD,0x0D,
|
||||
0x53,0x4D,0xE1,0x85,0x1E,0x8C,0x52,0x5A,0x9C,0x19,0x84,0xC2,0x03,0x57,0xF1,0x6F,
|
||||
0xE3,0x00,0xBE,0x58,0xF6,0x4C,0xED,0xD5,0x21,0x64,0x9C,0x1F,0xBE,0x55,0x03,0x3C,
|
||||
0x4A,0xDC,0xFF,0xAA,0xC9,0xDA,0xE0,0x5D,0x5E,0xBF,0xE6,0xDE,0xF5,0xD8,0xB1,0xF8,
|
||||
0xFF,0x36,0xB3,0xB9,0x62,0x67,0x95,0xDB,0x31,0x5F,0x37,0xED,0x4C,0x70,0x67,0x99,
|
||||
0x90,0xB5,0x18,0x31,0x6C,0x3D,0x99,0x99,0xE4,0x42,0xDA,0xD3,0x25,0x42,0x13,0xA0,
|
||||
0xAE,0xD7,0x70,0x6C,0xB1,0x55,0xCF,0xC7,0xD7,0x46,0xD5,0x43,0x61,0x17,0x3D,0x44,
|
||||
0x28,0xE9,0x33,0x85,0xD5,0xD0,0xA2,0x93,0xAA,0x25,0x12,0x1F,0xFB,0xC5,0x0B,0x46,
|
||||
0xF5,0x97,0x76,0x56,0x45,0xA6,0xBE,0x87,0xB1,0x94,0x6B,0xE8,0xB1,0xFE,0x33,0x99,
|
||||
0xAE,0x1F,0x3E,0x6C,0x39,0x71,0x1D,0x09,0x00,0x90,0x37,0xE4,0x10,0x3E,0x75,0x74,
|
||||
0xFF,0x8C,0x83,0x3B,0xB0,0xF1,0xB0,0xF9,0x01,0x05,0x47,0x42,0x95,0xF1,0xD6,0xAC,
|
||||
0x7E,0x38,0xE6,0x9E,0x95,0x74,0x26,0x3F,0xB4,0x68,0x50,0x18,0xD0,0x43,0x30,0xB4,
|
||||
0x4C,0x4B,0xE3,0x68,0xBF,0xE5,0x4D,0xB6,0x95,0x8B,0x0A,0xA0,0x74,0x25,0x32,0x77,
|
||||
0xCF,0xA1,0xF7,0x2C,0xD8,0x71,0x13,0x5A,0xAB,0xEA,0xC9,0x51,0xE8,0x0D,0xEE,0xEF,
|
||||
0xE9,0x93,0x7E,0x19,0xA7,0x1E,0x43,0x38,0x81,0x16,0x2C,0xA1,0x48,0xE3,0x73,0xCC,
|
||||
0x29,0x21,0x6C,0xD3,0x5D,0xCE,0xA0,0xD9,0x61,0x71,0x43,0xA0,0x15,0x13,0xB5,0x64,
|
||||
0x92,0xCF,0x2A,0x19,0xDC,0xAD,0xB7,0xA5,0x9F,0x86,0x65,0xF8,0x1A,0x9F,0xE7,0xFB,
|
||||
0xF7,0xFD,0xB8,0x13,0x6C,0x27,0xDB,0x6F,0xDF,0x35,0x1C,0xF7,0x8D,0x2C,0x5B,0x9B,
|
||||
0x12,0xAB,0x38,0x64,0x06,0xCC,0xDE,0x31,0xE8,0x4E,0x75,0x11,0x64,0xE3,0xFA,0xEA,
|
||||
0xEB,0x34,0x54,0xC2,0xAD,0x3F,0x34,0xEB,0x93,0x2C,0x7D,0x26,0x36,0x9D,0x56,0xF3,
|
||||
0x5A,0xE1,0xF6,0xB3,0x98,0x63,0x4A,0x9E,0x32,0x83,0xE4,0x9A,0x84,0x60,0x7D,0x90,
|
||||
0x2E,0x13,0x0E,0xEE,0x93,0x4B,0x36,0xA2,0x85,0xEC,0x16,0x38,0xE8,0x88,0x06,0x02,
|
||||
0xBF,0xF0,0xA0,0x3A,0xED,0xD7,0x6A,0x9A,0x73,0xE1,0x57,0xCF,0xF8,0x44,0xB8,0xDC,
|
||||
0x2E,0x23,0x59,0xD1,0xDF,0x95,0x52,0x71,0x99,0x61,0xA0,0x4B,0xD5,0x7F,0x6E,0x78,
|
||||
0xBA,0xA9,0xC5,0x30,0xD3,0x40,0x86,0x32,0x9D,0x32,0x0C,0x9C,0x37,0xB7,0x02,0x2F,
|
||||
0xBA,0x54,0x98,0xA9,0xC4,0x13,0x04,0xC9,0x8D,0xBE,0xC8,0xE7,0x5D,0x97,0x50,0x2E,
|
||||
0x93,0xD6,0x22,0x59,0x0C,0x27,0xBC,0x22,0x92,0xE0,0xA7,0x20,0x0F,0x93,0x6F,0x7F,
|
||||
0x4C,0x9F,0xD3,0xB5,0xA6,0x2A,0x0B,0x74,0x67,0x49,0x7D,0x10,0x26,0xCB,0xD1,0xC5,
|
||||
0x86,0x71,0xE7,0x8C,0xA0,0x9C,0xE9,0x5B,0xB2,0x1A,0xF6,0x01,0xEE,0x8C,0x9E,0x5E,
|
||||
0x83,0xF2,0x1A,0xDB,0xE6,0xE5,0xEA,0x84,0x59,0x76,0xD2,0x7C,0xF6,0x8D,0xA5,0x49,
|
||||
0x36,0x48,0xC2,0x16,0x52,0xBB,0x83,0xA3,0x74,0xB9,0x07,0x0C,0x3B,0xFF,0x61,0x28,
|
||||
0xE1,0x61,0xE9,0xE4,0xEF,0x6E,0x15,0xAA,0x4E,0xBA,0xE8,0x5D,0x05,0x96,0xBB,0x32,
|
||||
0x56,0xB0,0xFB,0x72,0x52,0x0F,0x0E,0xC8,0x42,0x25,0x65,0x76,0x89,0xAF,0xF2,0xDE,
|
||||
0x10,0x27,0xF0,0x01,0x4B,0x74,0xA7,0x97,0x07,0xD5,0x26,0x54,0x54,0x09,0x1F,0x82,
|
||||
0x0A,0x86,0x7D,0x30,0x39,0x0E,0xB3,0x26,0x9B,0x0B,0x57,0xBB,0x36,0x06,0x31,0xAF,
|
||||
0xFD,0x79,0xFC,0xD9,0x30,0x10,0x2B,0x0C,0xB3,0xE1,0x9B,0xD7,0x7B,0xDC,0x5F,0xEF,
|
||||
0xD2,0xF8,0x13,0x45,0x4D,0x47,0x75,0xBD,0x46,0x96,0x3C,0x7E,0x75,0xF3,0x3E,0xB5,
|
||||
0x67,0xC5,0x9A,0x3B,0xB0,0x5B,0x29,0x6B,0xDE,0x80,0x5B,0xC8,0x15,0x05,0xB1,0x31,
|
||||
0xB6,0xCE,0x49,0xDD,0xAD,0x84,0xB5,0xAE,0x60,0xDC,0x67,0x31,0x34,0x30,0xFE,0x4E,
|
||||
0xBD,0x80,0x2F,0xA6,0xBF,0x63,0x39,0x21,0x86,0xD9,0x35,0x7F,0x16,0x68,0x22,0x05,
|
||||
0x54,0xE9,0x90,0x26,0x8C,0x07,0x6C,0x51,0xA4,0x31,0x55,0xD7,0x09,0x07,0xA8,0x3E,
|
||||
0x2E,0x53,0x66,0xC1,0xF8,0xF2,0x7B,0xC4,0xF2,0x58,0xCF,0xF1,0x87,0xC5,0xA2,0xE7,
|
||||
0x27,0x8F,0x30,0x87,0x58,0xA0,0x64,0x62,0x23,0x18,0xB9,0x88,0x7C,0xFA,0xCE,0xC4,
|
||||
0x98,0xAE,0xAD,0x17,0xCC,0x4A,0x5B,0xF3,0xE9,0x48,0xD5,0x56,0xD3,0x0D,0xF2,0xC8,
|
||||
0x92,0x73,0x8C,0xDB,0xD7,0x2F,0x56,0xAC,0x81,0xF9,0x92,0x69,0x4D,0xC6,0x32,0xF6,
|
||||
0xE6,0xC0,0x8D,0x21,0xE2,0x76,0x80,0x61,0x11,0xBC,0xDC,0x6C,0x93,0xAF,0x19,0x69,
|
||||
0x9B,0xD0,0xBF,0xB9,0x31,0x9F,0x02,0x67,0xA3,0x51,0xEE,0x83,0x06,0x22,0x7B,0x0C,
|
||||
0xAB,0x49,0x42,0x40,0xB8,0xD5,0x01,0x7D,0xCE,0x5E,0xF7,0x55,0x53,0x39,0xC5,0x99,
|
||||
0x46,0xD8,0x87,0x9F,0xBA,0xF7,0x64,0xB4,0xE3,0x9A,0xFA,0xA1,0x6D,0x90,0x68,0x10,
|
||||
0x30,0xCA,0x8A,0x54,0xA7,0x9F,0x60,0xC3,0x19,0xF5,0x6B,0x0D,0x7A,0x51,0x98,0xE6,
|
||||
0x98,0x43,0x51,0xB4,0xD6,0x35,0xE9,0x4F,0xC3,0xDF,0x0F,0x7B,0xD6,0x2F,0x5C,0xBD,
|
||||
0x3A,0x15,0x61,0x19,0xF1,0x4B,0xCB,0xAA,0xDC,0x6D,0x64,0xC9,0xD3,0xC6,0x1E,0x56,
|
||||
0xEF,0x38,0x4C,0x50,0x71,0x86,0x75,0xCC,0x0D,0x0D,0x4E,0xE9,0x28,0xF6,0x06,0x5D,
|
||||
0x70,0x1B,0xAA,0xD3,0x45,0xCF,0xA8,0x39,0xAC,0x95,0xA6,0x2E,0xB4,0xE4,0x22,0xD4,
|
||||
0x74,0xA8,0x37,0x5F,0x48,0x7A,0x04,0xCC,0xA5,0x4C,0x40,0xD8,0x28,0xB4,0x28,0x08,
|
||||
0x0D,0x1C,0x72,0x52,0x41,0xF0,0x7D,0x47,0x19,0x3A,0x53,0x4E,0x58,0x84,0x62,0x6B,
|
||||
0x93,0xB5,0x8A,0x81,0x21,0x4E,0x0D,0xDC,0xB4,0x3F,0xA2,0xC6,0xFC,0xC9,0x2B,0x40,
|
||||
0xDA,0x38,0x04,0xE9,0x5E,0x5A,0x86,0x6B,0x0C,0x22,0x25,0x85,0x68,0x11,0x8D,0x7C,
|
||||
0x92,0x1D,0x95,0x55,0x4D,0xAB,0x8E,0xBB,0xDA,0xA6,0xE6,0xB7,0x51,0xB6,0x32,0x5A,
|
||||
0x05,0x41,0xDD,0x05,0x2A,0x0A,0x56,0x50,0x91,0x17,0x47,0xCC,0xC9,0xE6,0x7E,0xB5,
|
||||
0x61,0x4A,0xDB,0x73,0x67,0x51,0xC8,0x33,0xF5,0xDA,0x6E,0x74,0x2E,0x54,0xC3,0x37,
|
||||
0x0D,0x6D,0xAF,0x08,0xE8,0x15,0x8A,0x5F,0xE2,0x59,0x21,0xCD,0xA8,0xDE,0x0C,0x06,
|
||||
0x5A,0x77,0x6B,0x5F,0xDB,0x18,0x65,0x3E,0xC8,0x50,0xDE,0x78,0xE0,0xB8,0x82,0xB3,
|
||||
0x5D,0x4E,0x72,0x32,0x07,0x4F,0xC1,0x34,0x23,0xBA,0x96,0xB7,0x67,0x4E,0xA4,0x28,
|
||||
0x1E,0x34,0x62,0xEB,0x2D,0x6A,0x70,0xE9,0x2F,0x42,0xC4,0x70,0x4E,0x5A,0x31,0x9C,
|
||||
0xF9,0x5B,0x47,0x28,0xAA,0xDA,0x71,0x6F,0x38,0x1F,0xB3,0x78,0xC4,0x92,0x6B,0x1C,
|
||||
0x9E,0xF6,0x35,0x9A,0xB7,0x4D,0x0E,0xBF,0xCC,0x18,0x29,0x41,0x03,0x48,0x35,0x5D,
|
||||
0x55,0xD0,0x2B,0xC6,0x29,0xAF,0x5C,0x60,0x74,0x69,0x8E,0x5E,0x9B,0x7C,0xD4,0xBD,
|
||||
0x7B,0x44,0x64,0x7D,0x3F,0x92,0x5D,0x69,0xB6,0x1F,0x00,0x4B,0xD4,0x83,0x35,0xCF,
|
||||
0x7E,0x64,0x4E,0x17,0xAE,0x8D,0xD5,0x2E,0x9A,0x28,0x12,0x4E,0x2E,0x2B,0x49,0x08,
|
||||
0x5C,0xAE,0xC6,0x46,0x85,0xAE,0x41,0x61,0x1E,0x6F,0x82,0xD2,0x51,0x37,0x16,0x1F,
|
||||
0x0B,0xF6,0x59,0xA4,0x9A,0xCA,0x5A,0xAF,0x0D,0xD4,0x33,0x8B,0x20,0x63,0xF1,0x84,
|
||||
0x80,0x5C,0xCB,0xCF,0x08,0xB4,0xB9,0xD3,0x16,0x05,0xBD,0x62,0x83,0x31,0x9B,0x56,
|
||||
0x51,0x98,0x9F,0xBA,0xB2,0x5B,0xAA,0xB2,0x22,0x6B,0x2C,0xB5,0xD4,0x48,0xFA,0x63,
|
||||
0x2B,0x5F,0x58,0xFA,0x61,0xFA,0x64,0x09,0xBB,0x38,0xE0,0xB8,0x9D,0x92,0x60,0xA8,
|
||||
0x0D,0x67,0x6F,0x0E,0x37,0xF5,0x0D,0x01,0x9F,0xC2,0x77,0xD4,0xFE,0xEC,0xF1,0x73,
|
||||
0x30,0x39,0xE0,0x7D,0xF5,0x61,0x98,0xE4,0x2C,0x28,0x55,0x04,0x56,0x55,0xDB,0x2F,
|
||||
0x6B,0xEC,0xE5,0x58,0x06,0xB6,0x64,0x80,0x6A,0x2A,0x1A,0x4E,0x5B,0x0F,0xD8,0xC4,
|
||||
0x0A,0x2E,0x52,0x19,0xD9,0x62,0xF5,0x30,0x48,0xBE,0x8C,0x7B,0x4F,0x38,0x9B,0xA2,
|
||||
0xC3,0xAF,0xC9,0xD3,0xC7,0xC1,0x62,0x41,0x86,0xB9,0x61,0x21,0x57,0x6F,0x99,0x4F,
|
||||
0xC1,0xBA,0xCE,0x7B,0xB5,0x3B,0x4D,0x5E,0x8A,0x8B,0x44,0x57,0x5F,0x13,0x5F,0x70,
|
||||
0x6D,0x5B,0x29,0x47,0xDC,0x38,0xE2,0xEC,0x04,0x55,0x65,0x12,0x2A,0xE8,0x17,0x43,
|
||||
0xE1,0x8E,0xDD,0x2A,0xB3,0xE2,0x94,0xF7,0x09,0x6E,0x5C,0xE6,0xEB,0x8A,0xF8,0x6D,
|
||||
0x89,0x49,0x54,0x48,0xF5,0x2F,0xAD,0xBF,0xEA,0x94,0x4B,0xCA,0xFC,0x39,0x87,0x82,
|
||||
0x5F,0x8A,0x01,0xF2,0x75,0xF2,0xE6,0x71,0xD6,0xD8,0x42,0xDE,0xF1,0x2D,0x1D,0x28,
|
||||
0xA6,0x88,0x7E,0xA3,0xA0,0x47,0x1D,0x30,0xD9,0xA3,0x71,0xDF,0x49,0x1C,0xCB,0x01,
|
||||
0xF8,0x36,0xB1,0xF2,0xF0,0x22,0x58,0x5D,0x45,0x6B,0xBD,0xA0,0xBB,0xB2,0x88,0x42,
|
||||
0xC7,0x8C,0x28,0xCE,0x93,0xE8,0x90,0x63,0x08,0x90,0x7C,0x89,0x3C,0xF5,0x7D,0xB7,
|
||||
0x04,0x2D,0x4F,0x55,0x51,0x16,0xFD,0x7E,0x79,0xE8,0xBE,0xC1,0xF2,0x12,0xD4,0xF8,
|
||||
0xB4,0x84,0x05,0x23,0xA0,0xCC,0xD2,0x2B,0xFD,0xE1,0xAB,0xAD,0x0D,0xD1,0x55,0x6C,
|
||||
0x23,0x41,0x94,0x4D,0x77,0x37,0x4F,0x05,0x28,0x0C,0xBF,0x17,0xB3,0x12,0x67,0x6C,
|
||||
0x8C,0xC3,0x5A,0xF7,0x41,0x84,0x2A,0x6D,0xD0,0x94,0x12,0x27,0x2C,0xB4,0xED,0x9C,
|
||||
0x4D,0xEC,0x47,0x82,0x97,0xD5,0x67,0xB9,0x1B,0x9D,0xC0,0x55,0x07,0x7E,0xE5,0x8E,
|
||||
0xE2,0xA8,0xE7,0x3E,0x12,0xE4,0x0E,0x3A,0x2A,0x45,0x55,0x34,0xA2,0xF9,0x2D,0x5A,
|
||||
0x1B,0xAB,0x52,0x7C,0x83,0x10,0x5F,0x55,0xD2,0xF1,0x5A,0x43,0x2B,0xC6,0xA7,0xA4,
|
||||
0x89,0x15,0x95,0xE8,0xB4,0x4B,0x9D,0xF8,0x75,0xE3,0x9F,0x60,0x78,0x5B,0xD6,0xE6,
|
||||
0x0D,0x44,0xE6,0x21,0x06,0xBD,0x47,0x22,0x53,0xA4,0x00,0xAD,0x8D,0x43,0x13,0x85,
|
||||
0x39,0xF7,0xAA,0xFC,0x38,0xAF,0x7B,0xED,0xFC,0xE4,0x2B,0x54,0x50,0x98,0x4C,0xFC,
|
||||
0x85,0x80,0xF7,0xDF,0x3C,0x80,0x22,0xE1,0x94,0xDA,0xDE,0x24,0xC6,0xB0,0x7A,0x39,
|
||||
0x38,0xDC,0x0F,0xA1,0xA7,0xF4,0xF9,0x6F,0x63,0x18,0x57,0x8B,0x84,0x41,0x2A,0x2E,
|
||||
0xD4,0x53,0xF2,0xD9,0x00,0x0F,0xD0,0xDD,0x99,0x6E,0x19,0xA6,0x0A,0xD0,0xEC,0x5B,
|
||||
0x58,0x24,0xAB,0xC0,0xCB,0x06,0x65,0xEC,0x1A,0x13,0x38,0x94,0x0A,0x67,0x03,0x2F,
|
||||
0x3F,0xF7,0xE3,0x77,0x44,0x77,0x33,0xC6,0x14,0x39,0xD0,0xE3,0xC0,0xA2,0x08,0x79,
|
||||
0xBB,0x40,0x99,0x57,0x41,0x0B,0x01,0x90,0xCD,0xE1,0xCC,0x48,0x67,0xDB,0xB3,0xAF,
|
||||
0x88,0x74,0xF3,0x4C,0x82,0x8F,0x72,0xB1,0xB5,0x23,0x29,0xC4,0x12,0x6C,0x19,0xFC,
|
||||
0x8E,0x46,0xA4,0x9C,0xC4,0x25,0x65,0x87,0xD3,0x6D,0xBE,0x8A,0x93,0x11,0x03,0x38,
|
||||
0xED,0x83,0x2B,0xF3,0x46,0xA4,0x93,0xEA,0x3B,0x53,0x85,0x1D,0xCE,0xD4,0xF1,0x08,
|
||||
0x83,0x27,0xED,0xFC,0x9B,0x1A,0x18,0xBC,0xF9,0x8B,0xAE,0xDC,0x24,0xAB,0x50,0x38,
|
||||
0xE9,0x72,0x4B,0x10,0x22,0x17,0x7B,0x46,0x5D,0xAB,0x59,0x64,0xF3,0x40,0xAE,0xF8,
|
||||
0xBB,0xE5,0xC8,0xF9,0x26,0x03,0x4E,0x55,0x7D,0xEB,0xEB,0xFE,0xF7,0x39,0xE6,0xE0,
|
||||
0x0A,0x11,0xBE,0x2E,0x28,0xFF,0x98,0xED,0xC0,0xC9,0x42,0x56,0x42,0xC3,0xFD,0x00,
|
||||
0xF6,0xAF,0x87,0xA2,0x5B,0x01,0x3F,0x32,0x92,0x47,0x95,0x9A,0x72,0xA5,0x32,0x3D,
|
||||
0xAE,0x6B,0xD0,0x9B,0x07,0xD2,0x49,0x92,0xE3,0x78,0x4A,0xFA,0xA1,0x06,0x7D,0xF2,
|
||||
0x41,0xCF,0x77,0x74,0x04,0x14,0xB2,0x0C,0x86,0x84,0x64,0x16,0xD5,0xBB,0x51,0xA1,
|
||||
0xE5,0x6F,0xF1,0xD1,0xF2,0xE2,0xF7,0x5F,0x58,0x20,0x4D,0xB8,0x57,0xC7,0xCF,0xDD,
|
||||
0xC5,0xD8,0xBE,0x76,0x3D,0xF6,0x5F,0x7E,0xE7,0x2A,0x8B,0x88,0x24,0x1B,0x38,0x3F,
|
||||
0x0E,0x41,0x23,0x77,0xF5,0xF0,0x4B,0xD4,0x0C,0x1F,0xFA,0xA4,0x0B,0x80,0x5F,0xCF,
|
||||
0x45,0xF6,0xE0,0xDA,0x2F,0x34,0x59,0x53,0xFB,0x20,0x3C,0x52,0x62,0x5E,0x35,0xB5,
|
||||
0x62,0xFE,0x8B,0x60,0x63,0xE3,0x86,0x5A,0x15,0x1A,0x6E,0xD1,0x47,0x45,0xBC,0x32,
|
||||
0xB4,0xEB,0x67,0x38,0xAB,0xE4,0x6E,0x33,0x3A,0xB5,0xED,0xA3,0xAD,0x67,0xE0,0x4E,
|
||||
0x41,0x95,0xEE,0x62,0x62,0x71,0x26,0x1D,0x31,0xEF,0x62,0x30,0xAF,0xD7,0x82,0xAC,
|
||||
0xC2,0xDC,0x05,0x04,0xF5,0x97,0x07,0xBF,0x11,0x59,0x23,0x07,0xC0,0x64,0x02,0xE8,
|
||||
0x97,0xE5,0x3E,0xAF,0x18,0xAC,0x59,0xA6,0x8B,0x4A,0x33,0x90,0x1C,0x6E,0x7C,0x9C,
|
||||
0x20,0x7E,0x4C,0x3C,0x3E,0x61,0x64,0xBB,0xC5,0x6B,0x7C,0x7E,0x3E,0x9F,0xC5,0x4C,
|
||||
0x9F,0xEA,0x73,0xF5,0xD7,0x89,0xC0,0x4C,0xF4,0xFB,0xF4,0x2D,0xEC,0x14,0x1B,0x51,
|
||||
0xD5,0xC1,0x12,0xC8,0x10,0xDF,0x0B,0x4A,0x8B,0x9C,0xBC,0x93,0x45,0x6A,0x3E,0x3E,
|
||||
0x7D,0xC1,0xA9,0xBA,0xCD,0xC1,0xB4,0x07,0xE4,0xE1,0x68,0x86,0x43,0xB2,0x6D,0x38,
|
||||
0xF3,0xFB,0x0C,0x5C,0x66,0x37,0x71,0xDE,0x56,0xEF,0x6E,0xA0,0x10,0x40,0x65,0xA7,
|
||||
0x98,0xF7,0xD0,0xBE,0x0E,0xC8,0x37,0x36,0xEC,0x10,0xCA,0x7C,0x9C,0xAB,0x84,0x1E,
|
||||
0x05,0x17,0x76,0x02,0x1C,0x4F,0x52,0xAA,0x5F,0xC1,0xC6,0xA0,0x56,0xB9,0xD8,0x04,
|
||||
0x84,0x44,0x4D,0xA7,0x59,0xD8,0xDE,0x60,0xE6,0x38,0x0E,0x05,0x8F,0x03,0xE1,0x3B,
|
||||
0x6D,0x81,0x04,0x33,0x6F,0x30,0x0B,0xCE,0x69,0x05,0x21,0x33,0xFB,0x26,0xBB,0x89,
|
||||
0x7D,0xB6,0xAE,0x87,0x7E,0x51,0x07,0xE0,0xAC,0xF7,0x96,0x0A,0x6B,0xF9,0xC4,0x5C,
|
||||
0x1D,0xE4,0x44,0x47,0xB8,0x5E,0xFA,0xE3,0x78,0x84,0x55,0x42,0x4B,0x48,0x5E,0xF7,
|
||||
0x7D,0x47,0x35,0x86,0x1D,0x2B,0x43,0x05,0x03,0xEC,0x8A,0xB8,0x1E,0x06,0x3C,0x76,
|
||||
0x0C,0x48,0x1A,0x43,0xA7,0xB7,0x8A,0xED,0x1E,0x13,0xC6,0x43,0xEE,0x10,0xEF,0xDB,
|
||||
0xEC,0xFB,0x3C,0x83,0xB2,0x95,0x44,0xEF,0xD8,0x54,0x51,0x4E,0x2D,0x11,0x44,0x1D,
|
||||
0xFB,0x36,0x59,0x1E,0x7A,0x34,0xC1,0xC3,0xCA,0x57,0x00,0x61,0xEA,0x67,0xA5,0x16,
|
||||
0x9B,0x55,0xD0,0x55,0xE1,0x7F,0xD9,0x36,0xD2,0x40,0x76,0xAE,0xDC,0x01,0xCE,0xB0,
|
||||
0x7A,0x83,0xD5,0xCB,0x20,0x98,0xEC,0x6B,0xC1,0x72,0x92,0x34,0xF3,0x82,0x57,0x37,
|
||||
0x62,0x8A,0x32,0x36,0x0C,0x90,0x43,0xAE,0xAE,0x5C,0x9B,0x78,0x8E,0x13,0x65,0x02,
|
||||
0xFD,0x68,0x71,0xC1,0xFE,0xB0,0x31,0xA0,0x24,0x82,0xB0,0xC3,0xB1,0x79,0x69,0xA7,
|
||||
0xF5,0xD2,0xEB,0xD0,0x82,0xC0,0x32,0xDC,0x9E,0xC7,0x26,0x3C,0x6D,0x8D,0x98,0xC1,
|
||||
0xBB,0x22,0xD4,0xD0,0x0F,0x33,0xEC,0x3E,0xB9,0xCC,0xE1,0xDC,0x6A,0x4C,0x77,0x36,
|
||||
0x14,0x1C,0xF9,0xBF,0x81,0x9F,0x28,0x5F,0x71,0x85,0x32,0x29,0x90,0x75,0x48,0xC4,
|
||||
0xB3,0x4A,0xCE,0xD8,0x44,0x8F,0x14,0x2F,0xFD,0x40,0x57,0xEF,0xAA,0x08,0x75,0xD9,
|
||||
0x46,0xD1,0xD6,0x6E,0x32,0x55,0x1F,0xC3,0x18,0xFE,0x84,0x1F,0xFC,0x84,0xD5,0xFF,
|
||||
0x71,0x5E,0x1B,0x48,0xC3,0x86,0x95,0x0E,0x28,0x08,0x27,0xD3,0x38,0x83,0x71,0x7B,
|
||||
0x4C,0x80,0x63,0x54,0x9A,0x56,0xB0,0xAC,0xCF,0x80,0xCA,0x31,0x09,0xEF,0xFE,0xF3,
|
||||
0xBE,0xAF,0x24,0x7E,0xA6,0xFE,0x53,0x3F,0xC2,0x8D,0x4A,0x33,0x68,0xD1,0x22,0xA6,
|
||||
0x66,0xAD,0x7B,0xEA,0xDE,0xB6,0x43,0xB0,0xA1,0x25,0x95,0x00,0xA3,0x3F,0x75,0x46,
|
||||
0x14,0x11,0x44,0xEC,0xD7,0x95,0xBC,0x92,0xF0,0x4F,0xA9,0x16,0x53,0x62,0x97,0x60,
|
||||
0x2A,0x0F,0x41,0xF1,0x71,0x24,0xBE,0xEE,0x94,0x7F,0x08,0xCD,0x60,0x93,0xB3,0x85,
|
||||
0x5B,0x07,0x00,0x3F,0xD8,0x0F,0x28,0x83,0x9A,0xD1,0x69,0x9F,0xD1,0xDA,0x2E,0xC3,
|
||||
0x90,0x01,0xA2,0xB9,0x6B,0x4E,0x2A,0x66,0x9D,0xDA,0xAE,0xA6,0xEA,0x2A,0xD3,0x68,
|
||||
0x2F,0x0C,0x0C,0x9C,0xD2,0x8C,0x4A,0xED,0xE2,0x9E,0x57,0x65,0x9D,0x09,0x87,0xA3,
|
||||
0xB4,0xC4,0x32,0x5D,0xC9,0xD4,0x32,0x2B,0xB1,0xE0,0x71,0x1E,0x64,0x4D,0xE6,0x90,
|
||||
0x71,0xE3,0x1E,0x40,0xED,0x7D,0xF3,0x84,0x0E,0xED,0xC8,0x78,0x76,0xAE,0xC0,0x71,
|
||||
0x27,0x72,0xBB,0x05,0xEA,0x02,0x64,0xFB,0xF3,0x48,0x6B,0xB5,0x42,0x93,0x3F,0xED,
|
||||
0x9F,0x13,0x53,0xD2,0xF7,0xFE,0x2A,0xEC,0x1D,0x47,0x25,0xDB,0x3C,0x91,0x86,0xC6,
|
||||
0x8E,0xF0,0x11,0xFD,0x23,0x74,0x36,0xF7,0xA4,0xF5,0x9E,0x7A,0x7E,0x53,0x50,0x44,
|
||||
0xD4,0x47,0xCA,0xD3,0xEB,0x38,0x6D,0xE6,0xD9,0x71,0x94,0x7F,0x4A,0xC6,0x69,0x4B,
|
||||
0x11,0xF4,0x52,0xEA,0x22,0xFE,0x8A,0xB0,0x36,0x67,0x8B,0x59,0xE8,0xE6,0x80,0x2A,
|
||||
0xEB,0x65,0x04,0x13,0xEE,0xEC,0xDC,0x9E,0x5F,0xB1,0xEC,0x05,0x6A,0x59,0xE6,0x9F,
|
||||
0x5E,0x59,0x6B,0x89,0xBF,0xF7,0x1A,0xCA,0x44,0xF9,0x5B,0x6A,0x71,0x85,0x03,0xE4,
|
||||
0x29,0x62,0xE0,0x70,0x6F,0x41,0xC4,0xCF,0xB2,0xB1,0xCC,0xE3,0x7E,0xA6,0x07,0xA8,
|
||||
0x87,0xE7,0x7F,0x84,0x93,0xDB,0x52,0x4B,0x6C,0xEC,0x7E,0xDD,0xD4,0x24,0x48,0x10,
|
||||
0x69,0x9F,0x04,0x60,0x74,0xE6,0x48,0x18,0xF3,0xE4,0x2C,0xB9,0x4F,0x2E,0x50,0x7A,
|
||||
0xDF,0xD4,0x54,0x69,0x2B,0x8B,0xA7,0xF3,0xCE,0xFF,0x1F,0xF3,0x3E,0x26,0x01,0x39,
|
||||
0x17,0x95,0x84,0x89,0xB0,0xF0,0x4C,0x4B,0x82,0x91,0x9F,0xC4,0x4B,0xAC,0x9D,0xA5,
|
||||
0x74,0xAF,0x17,0x25,0xC9,0xCA,0x32,0xD3,0xBC,0x89,0x8A,0x84,0x89,0xCC,0x0D,0xAE,
|
||||
0x7C,0xA2,0xDB,0x9C,0x6A,0x78,0x91,0xEE,0xEA,0x76,0x5D,0x4E,0x87,0x60,0xF5,0x69,
|
||||
0x15,0x67,0xD4,0x02,0xCF,0xAF,0x48,0x36,0x07,0xEA,0xBF,0x6F,0x66,0x2D,0x06,0x8F,
|
||||
0xC4,0x9A,0xFE,0xF9,0xF6,0x90,0x87,0x75,0xB8,0xF7,0xAD,0x0F,0x76,0x10,0x5A,0x3D,
|
||||
0x59,0xB0,0x2E,0xB3,0xC7,0x35,0x2C,0xCC,0x70,0x56,0x2B,0xCB,0xE3,0x37,0x96,0xC5,
|
||||
0x2F,0x46,0x1B,0x8A,0x22,0x46,0xC7,0x88,0xA7,0x26,0x32,0x98,0x61,0xDF,0x86,0x22,
|
||||
0x8A,0xF4,0x1C,0x2F,0x87,0xA1,0x09,0xAA,0xCC,0xA9,0xAE,0xD3,0xBD,0x00,0x45,0x1C,
|
||||
0x9A,0x54,0x87,0x86,0x52,0x87,0xEF,0xFF,0x1E,0x8F,0xA1,0x8F,0xC1,0x89,0x5C,0x35,
|
||||
0x1B,0xDA,0x2D,0x3A,0x2C,0x16,0xB2,0xC2,0xF1,0x56,0xE2,0x78,0xC1,0x6B,0x63,0x97,
|
||||
0xC5,0x56,0x8F,0xC9,0x32,0x7F,0x2C,0xAA,0xAF,0xA6,0xA8,0xAC,0x20,0x91,0x22,0x88,
|
||||
0xDE,0xE4,0x60,0x8B,0xF9,0x4B,0x42,0x25,0x1A,0xE3,0x7F,0x9C,0x2C,0x19,0x89,0x3A,
|
||||
0x7E,0x05,0xD4,0x36,0xCC,0x69,0x58,0xC2,0xC1,0x32,0x8B,0x2F,0x90,0x85,0xEB,0x7A,
|
||||
0x39,0x50,0xA5,0xA1,0x27,0x92,0xC5,0x66,0xB0,0x20,0x4F,0x58,0x7E,0x55,0x83,0x43,
|
||||
0x2B,0x45,0xE2,0x9C,0xE4,0xD8,0x12,0x90,0x2C,0x16,0x83,0x56,0x16,0x79,0x03,0xB3,
|
||||
0xAD,0x2D,0x61,0x18,0x1A,0x13,0x1F,0x37,0xE2,0xE1,0x9C,0x73,0x7B,0x80,0xD5,0xFD,
|
||||
0x2D,0x51,0x87,0xFC,0x7B,0xAA,0xD7,0x1F,0x2C,0x7A,0x8E,0xAF,0xF4,0x8D,0xBB,0xCD,
|
||||
0x95,0x11,0x7C,0x72,0x0B,0xEE,0x6F,0xE2,0xB9,0xAF,0xDE,0x37,0x83,0xDE,0x8C,0x8D,
|
||||
0x62,0x05,0x67,0xB7,0x96,0xC6,0x8D,0x56,0xB6,0x0D,0xD7,0x62,0xBA,0xD6,0x46,0x36,
|
||||
0xBD,0x8E,0xC8,0xE6,0xEA,0x2A,0x6C,0x10,0x14,0xFF,0x6B,0x5B,0xFA,0x82,0x3C,0x46,
|
||||
0xB1,0x30,0x43,0x46,0x51,0x8A,0x7D,0x9B,0x92,0x3E,0x83,0x79,0x5B,0x55,0x5D,0xB2,
|
||||
0x6C,0x5E,0xCE,0x90,0x62,0x8E,0x53,0x98,0xC9,0x0D,0x6D,0xE5,0x2D,0x57,0xCD,0xC5,
|
||||
0x81,0x57,0xBA,0xE1,0xE8,0xB8,0x8F,0x72,0xE5,0x4F,0x13,0xDC,0xEA,0x9D,0x71,0x15,
|
||||
0x10,0xB2,0x11,0x88,0xD5,0x09,0xD4,0x7F,0x5B,0x65,0x7F,0x2C,0x3B,0x38,0x4C,0x11,
|
||||
0x68,0x50,0x8D,0xFB,0x9E,0xB0,0x59,0xBF,0x94,0x80,0x89,0x4A,0xC5,0x1A,0x18,0x12,
|
||||
0x89,0x53,0xD1,0x4A,0x10,0x29,0xE8,0x8C,0x1C,0xEC,0xB6,0xEA,0x46,0xC7,0x17,0x8B,
|
||||
0x25,0x15,0x31,0xA8,0xA2,0x6B,0x43,0xB1,0x9D,0xE2,0xDB,0x0B,0x87,0x9B,0xB0,0x11,
|
||||
0x04,0x0E,0x71,0xD2,0x29,0x77,0x89,0x82,0x0A,0x66,0x41,0x7F,0x1D,0x0B,0x48,0xFF,
|
||||
0x72,0xBB,0x24,0xFD,0xC2,0x48,0xA1,0x9B,0xFE,0x7B,0x7F,0xCE,0x88,0xDB,0x86,0xD9,
|
||||
0x85,0x3B,0x1C,0xB0,0xDC,0xA8,0x33,0x07,0xBF,0x51,0x2E,0xE3,0x0E,0x9A,0x00,0x97,
|
||||
0x1E,0x06,0xC0,0x97,0x43,0x9D,0xD8,0xB6,0x45,0xC4,0x86,0x67,0x5F,0x00,0xF8,0x88,
|
||||
0x9A,0xA4,0x52,0x9E,0xC7,0xAA,0x8A,0x83,0x75,0xEC,0xC5,0x18,0xAE,0xCE,0xC3,0x2F,
|
||||
0x1A,0x2B,0xF9,0x18,0xFF,0xAE,0x1A,0xF5,0x53,0x0B,0xB5,0x33,0x51,0xA7,0xFD,0xE8,
|
||||
0xA8,0xE1,0xA2,0x64,0xB6,0x22,0x17,0x43,0x80,0xCC,0x0A,0xD8,0xAE,0x3B,0xBA,0x40,
|
||||
0xD7,0xD9,0x92,0x4A,0x89,0xDF,0x04,0x10,0xEE,0x9B,0x18,0x2B,0x6A,0x77,0x69,0x8A,
|
||||
0x68,0xF4,0xF9,0xB9,0xA2,0x21,0x15,0x6E,0xE6,0x1E,0x3B,0x03,0x62,0x30,0x9B,0x60,
|
||||
0x41,0x7E,0x25,0x9B,0x9E,0x8F,0xC5,0x52,0x10,0x08,0xF8,0xC2,0x69,0xA1,0x21,0x11,
|
||||
0x88,0x37,0x5E,0x79,0x35,0x66,0xFF,0x10,0x42,0x18,0x6E,0xED,0x97,0xB6,0x6B,0x1C,
|
||||
0x4E,0x36,0xE5,0x6D,0x7D,0xB4,0xE4,0xBF,0x20,0xB9,0xE0,0x05,0x3A,0x69,0xD5,0xB8,
|
||||
0xE3,0xD5,0xDC,0xE0,0xB9,0xAC,0x53,0x3E,0x07,0xA4,0x57,0xAD,0x77,0xFF,0x48,0x18,
|
||||
0x76,0x2A,0xAC,0x49,0x2A,0x8E,0x47,0x75,0x6D,0x9F,0x67,0x63,0x30,0x35,0x8C,0x39,
|
||||
0x05,0x39,0xD5,0x6F,0x64,0x3A,0x5B,0xAD,0xCA,0x0B,0xBB,0x82,0x52,0x99,0x45,0xB1,
|
||||
0x93,0x36,0x36,0x99,0xAF,0x13,0x20,0x44,0x36,0xD8,0x02,0x44,0x09,0x39,0x92,0x85,
|
||||
0xFF,0x4A,0x4A,0x97,0x87,0xA6,0x63,0xD7,0xC7,0xB5,0xB5,0x24,0xED,0x0F,0xB4,0x6F,
|
||||
0x0C,0x58,0x52,0x14,0xD9,0xA6,0x7B,0xD3,0x79,0xBC,0x38,0x58,0xA1,0xBD,0x3B,0x84,
|
||||
0x06,0xD8,0x1A,0x06,0xFD,0x6B,0xA8,0xEA,0x4B,0x69,0x28,0x04,0x37,0xAD,0x82,0x99,
|
||||
0xFB,0x0E,0x1B,0x85,0xBD,0xA8,0x5D,0x73,0xCD,0xDC,0x58,0x75,0x0A,0xBE,0x63,0x6C,
|
||||
0x48,0xE7,0x4C,0xE4,0x30,0x2B,0x04,0x60,0xB9,0x15,0xD8,0xDA,0x86,0x81,0x75,0x8F,
|
||||
0x96,0xD4,0x8D,0x1C,0x5D,0x70,0x85,0x7C,0x1C,0x67,0x7B,0xD5,0x08,0x67,0xA6,0xCE,
|
||||
0x4B,0x0A,0x66,0x70,0xB7,0xE5,0x63,0xD4,0x5B,0x8A,0x82,0xEA,0x10,0x67,0xCA,0xE2,
|
||||
0xF4,0xEF,0x17,0x85,0x2F,0x2A,0x5F,0x8A,0x97,0x82,0xF8,0x6A,0xD6,0x34,0x10,0xEA,
|
||||
0xEB,0xC9,0x5C,0x3C,0xE1,0x49,0xF8,0x46,0xEB,0xDE,0xBD,0xF6,0xA9,0x92,0xF1,0xAA,
|
||||
0xA6,0xA0,0x18,0xB0,0x3A,0xD3,0x0F,0x1F,0xF3,0x6F,0xFF,0x31,0x45,0x43,0x44,0xD3,
|
||||
0x50,0x9A,0xF7,0x88,0x09,0x96,0xC1,0xCE,0x76,0xCC,0xF2,0x2C,0x2C,0xBA,0xAD,0x82,
|
||||
0x77,0x8F,0x18,0x84,0xC0,0xD2,0x07,0x9C,0x36,0x90,0x83,0x4E,0x0B,0xA5,0x4F,0x43,
|
||||
0x3E,0x04,0xAB,0x78,0x4F,0xD6,0xFB,0x09,0x01,0x24,0x90,0xDA,0x6F,0x3C,0x3A,0x61,
|
||||
0x0D,0x7F,0x69,0x4A,0xEB,0x2B,0x30,0x02,0xB4,0xDB,0xE0,0x84,0xA9,0xEC,0xD7,0x35,
|
||||
0xBF,0x37,0x7D,0x85,0x58,0xCE,0xA9,0x4E,0xE4,0x80,0xC7,0xA8,0xD3,0x30,0x67,0x48,
|
||||
0xEB,0x29,0xAF,0x2F,0x74,0x6A,0xB4,0xA7,0x3F,0x0F,0x3F,0x92,0xAF,0xF3,0xCA,0xAC,
|
||||
0xAF,0x4B,0xD9,0x94,0xC0,0x43,0xCA,0x81,0x0D,0x2F,0x48,0xA1,0xB0,0x27,0xD5,0xD2,
|
||||
0xEF,0x4B,0x05,0x85,0xA3,0xDE,0x4D,0x93,0x30,0x3C,0xF0,0xBB,0x4A,0x8F,0x30,0x27,
|
||||
0x4C,0xEB,0xE3,0x3E,0x64,0xED,0x9A,0x2F,0x3B,0xF1,0x82,0xF0,0xBA,0xF4,0xCF,0x7F,
|
||||
0x40,0xCB,0xB0,0xE1,0x7F,0xBC,0xAA,0x57,0xD3,0xC9,0x74,0xF2,0xFA,0x43,0x0D,0x22,
|
||||
0xD0,0xF4,0x77,0x4E,0x93,0xD7,0x85,0x70,0x1F,0x99,0xBF,0xB6,0xDE,0x35,0xF1,0x30,
|
||||
0xA7,0x5E,0x71,0xF0,0x6B,0x01,0x2D,0x7B,0x64,0xF0,0x33,0x53,0x0A,0x39,0x88,0xF3,
|
||||
0x6B,0x3A,0xA6,0x6B,0x35,0xD2,0x2F,0x43,0xCD,0x02,0xFD,0xB5,0xE9,0xBC,0x5B,0xAA,
|
||||
0xD8,0xA4,0x19,0x7E,0x0E,0x5D,0x94,0x81,0x9E,0x6F,0x77,0xAD,0xD6,0x0E,0x74,0x93,
|
||||
0x96,0xE7,0xC4,0x18,0x5F,0xAD,0xF5,0x19,
|
||||
};
|
@ -1,350 +0,0 @@
|
||||
const unsigned char gEncrDataTwl[] = {
|
||||
0x59, 0xaa, 0x56, 0x8e, 0x90, 0xd7, 0x11, 0x55, 0x4d, 0xea, 0xbf, 0xfe,
|
||||
0xbd, 0x0d, 0x75, 0x91, 0xf7, 0x85, 0x39, 0x98, 0xd0, 0x9c, 0xc3, 0x58,
|
||||
0xc4, 0x15, 0x6f, 0xf1, 0x90, 0xf9, 0xe4, 0xc3, 0x8e, 0xc0, 0x9b, 0x0e,
|
||||
0x5d, 0xe1, 0x87, 0x94, 0xb9, 0x07, 0x2c, 0xba, 0xa6, 0x4f, 0x75, 0x74,
|
||||
0xc1, 0xe3, 0x1c, 0x86, 0xe6, 0xed, 0xf8, 0x09, 0x3b, 0xbb, 0x37, 0x7a,
|
||||
0x4e, 0xf0, 0xf0, 0x92, 0xf6, 0x55, 0xfa, 0x47, 0xfb, 0x1b, 0xc5, 0x16,
|
||||
0x06, 0x74, 0x4e, 0x56, 0x20, 0xdd, 0xb6, 0xd1, 0x42, 0xcf, 0xcf, 0xf1,
|
||||
0x55, 0x7e, 0x17, 0x18, 0xa1, 0x93, 0xff, 0x09, 0xda, 0x36, 0xa6, 0x9a,
|
||||
0x43, 0x3d, 0xf4, 0x65, 0xed, 0x40, 0x97, 0x6c, 0xd5, 0xa6, 0xdd, 0x6d,
|
||||
0x6c, 0x23, 0xbf, 0x94, 0xe7, 0x51, 0xa6, 0x68, 0x3c, 0xe8, 0xe6, 0x65,
|
||||
0xd6, 0xbc, 0x9e, 0x92, 0x78, 0x26, 0x46, 0xa1, 0x73, 0xdc, 0xe5, 0x36,
|
||||
0x8e, 0xcd, 0xec, 0xa1, 0xf1, 0xee, 0x8b, 0x68, 0xf4, 0xac, 0xc1, 0xdc,
|
||||
0xc8, 0x84, 0x95, 0x31, 0xe8, 0xed, 0xc7, 0x5e, 0xe4, 0x5a, 0x37, 0xca,
|
||||
0xec, 0x55, 0xbe, 0x2a, 0xfc, 0xf6, 0x45, 0x67, 0xa9, 0xb4, 0x7d, 0x7d,
|
||||
0x9b, 0x6e, 0xe9, 0x2c, 0xff, 0x3f, 0xeb, 0x69, 0xb7, 0x2e, 0x68, 0xa8,
|
||||
0x94, 0xef, 0x7b, 0xbd, 0x88, 0x93, 0x15, 0x66, 0x3a, 0xb7, 0x7f, 0xfe,
|
||||
0x1d, 0xc3, 0x89, 0x08, 0xd7, 0x74, 0x59, 0xfa, 0xaf, 0x91, 0x41, 0x9e,
|
||||
0x57, 0xd5, 0x67, 0x84, 0xba, 0x00, 0xe9, 0x63, 0x58, 0x07, 0x4d, 0xec,
|
||||
0xdf, 0xc6, 0xda, 0x1e, 0x62, 0x52, 0xd9, 0x14, 0xbc, 0x03, 0xc3, 0xb0,
|
||||
0xa5, 0xfd, 0xb7, 0x27, 0xde, 0xb1, 0x6f, 0x1b, 0x7c, 0x72, 0x4a, 0xcd,
|
||||
0x09, 0xe5, 0x82, 0x70, 0xd3, 0x9f, 0xb6, 0xd6, 0xa4, 0x6a, 0x2f, 0xc2,
|
||||
0x32, 0xbd, 0xb5, 0x39, 0xe4, 0xea, 0xb9, 0x71, 0x1c, 0x70, 0x67, 0x21,
|
||||
0x92, 0x21, 0xac, 0xf4, 0x9e, 0x63, 0xe8, 0x5e, 0x83, 0x02, 0xcc, 0x0c,
|
||||
0xf8, 0xf8, 0x9e, 0x87, 0x89, 0xfc, 0x03, 0x85, 0xfa, 0xcc, 0x77, 0x07,
|
||||
0x44, 0x5f, 0x4d, 0xe5, 0x19, 0xd3, 0x12, 0xee, 0xca, 0xe1, 0xe0, 0xbf,
|
||||
0x1e, 0xbe, 0xe7, 0x12, 0x1f, 0x6a, 0x93, 0x1e, 0x38, 0x4b, 0xa7, 0x9f,
|
||||
0x81, 0xa9, 0x77, 0x85, 0x0c, 0xc6, 0x39, 0x02, 0x55, 0xd2, 0x62, 0x56,
|
||||
0x19, 0x85, 0xa6, 0x38, 0x85, 0xe1, 0x2d, 0x3c, 0x38, 0x3b, 0x5b, 0xa0,
|
||||
0x24, 0x18, 0xe9, 0x29, 0x6c, 0x9f, 0xe4, 0x4d, 0x4e, 0x23, 0x5f, 0xb1,
|
||||
0xe2, 0xa0, 0x6f, 0x97, 0xb2, 0x41, 0xd1, 0xea, 0xdb, 0xa7, 0x37, 0x81,
|
||||
0xeb, 0x06, 0x8d, 0x77, 0xc2, 0x68, 0xfc, 0x5a, 0x65, 0x97, 0x33, 0x58,
|
||||
0xa1, 0xb8, 0x35, 0x0f, 0xf4, 0x25, 0xbc, 0x3b, 0x4f, 0x18, 0x0f, 0x0e,
|
||||
0x60, 0x25, 0x3d, 0xd8, 0x77, 0x1a, 0xd0, 0x8a, 0xb0, 0x61, 0x57, 0x16,
|
||||
0x0b, 0x55, 0xf2, 0x58, 0xb9, 0x91, 0x52, 0x30, 0x33, 0xab, 0x29, 0x9b,
|
||||
0x03, 0x62, 0xe5, 0xcc, 0xdf, 0x6e, 0x62, 0x86, 0x9d, 0x76, 0xe5, 0xdd,
|
||||
0x6f, 0xca, 0x3e, 0x75, 0xd8, 0x88, 0x58, 0x06, 0x8d, 0xa4, 0x58, 0xf5,
|
||||
0xaa, 0x7c, 0xce, 0x17, 0xdd, 0xde, 0xca, 0x0a, 0x72, 0x87, 0x6f, 0x29,
|
||||
0x6c, 0x0c, 0xe9, 0xc0, 0x3d, 0x32, 0x2e, 0x55, 0xf3, 0xa7, 0x27, 0xda,
|
||||
0xfc, 0x86, 0x0c, 0x9e, 0x33, 0x83, 0xb5, 0x47, 0xeb, 0xe8, 0xf6, 0xc9,
|
||||
0xf4, 0x24, 0x72, 0xee, 0xaf, 0xf8, 0xb5, 0x59, 0x70, 0x06, 0x85, 0x71,
|
||||
0xbb, 0x3c, 0xbe, 0xbb, 0x2c, 0x24, 0xad, 0x67, 0xba, 0x42, 0xb9, 0xee,
|
||||
0x68, 0xec, 0x0b, 0xe6, 0x5b, 0x26, 0x0f, 0x2b, 0xb6, 0x3a, 0x93, 0x4f,
|
||||
0x9f, 0xe6, 0x9f, 0xb9, 0x1a, 0xa0, 0xb9, 0x51, 0x1c, 0x8d, 0x66, 0x37,
|
||||
0xd2, 0x50, 0xcc, 0xae, 0x10, 0x30, 0x16, 0x60, 0x56, 0x3b, 0x99, 0x0e,
|
||||
0x90, 0x7b, 0x28, 0xde, 0x93, 0xf4, 0x16, 0x87, 0x1f, 0xd0, 0x9b, 0xc2,
|
||||
0x33, 0x42, 0x2c, 0x2c, 0xf1, 0x36, 0xc3, 0x39, 0xf8, 0x4f, 0xa4, 0x1e,
|
||||
0x00, 0x43, 0xb1, 0xac, 0xdf, 0x08, 0xbb, 0xfe, 0x5e, 0x2a, 0xdc, 0x2a,
|
||||
0x10, 0xf3, 0x7b, 0xc5, 0x2f, 0x96, 0xc9, 0x1d, 0x51, 0x4f, 0xc0, 0xde,
|
||||
0x6e, 0x93, 0x9a, 0x35, 0x19, 0xb8, 0x58, 0xb5, 0x19, 0xba, 0xaf, 0x2a,
|
||||
0xb1, 0xb5, 0xb2, 0xff, 0xc1, 0x89, 0xbc, 0x3f, 0xd8, 0x8f, 0x34, 0x07,
|
||||
0x63, 0x60, 0xa5, 0xed, 0xdb, 0xff, 0x9e, 0xf5, 0x5b, 0x23, 0xc0, 0x1b,
|
||||
0x13, 0x96, 0xd4, 0x2f, 0x07, 0x51, 0x1b, 0xac, 0x90, 0x72, 0x71, 0x28,
|
||||
0x65, 0x98, 0xe1, 0xff, 0x6a, 0x9d, 0xe7, 0x30, 0x6d, 0xb1, 0x2c, 0x21,
|
||||
0xfa, 0xcb, 0xbc, 0x6a, 0x3c, 0x25, 0xe8, 0x50, 0x5c, 0x53, 0xd8, 0xd5,
|
||||
0xcb, 0xa2, 0x53, 0x53, 0xa5, 0x64, 0x3f, 0x78, 0x61, 0x77, 0x1d, 0x8d,
|
||||
0x16, 0xe4, 0xe4, 0xa1, 0x32, 0x9c, 0x00, 0x52, 0x5f, 0x2a, 0xd7, 0xf5,
|
||||
0x3c, 0xfd, 0x09, 0xd7, 0x1b, 0x3b, 0x99, 0x01, 0x4d, 0xdc, 0x91, 0xe4,
|
||||
0x6d, 0xe8, 0x9e, 0xa3, 0x18, 0xad, 0x43, 0x27, 0xba, 0xc1, 0x5f, 0x37,
|
||||
0xa6, 0x12, 0x61, 0xf5, 0x1c, 0x63, 0x0c, 0x25, 0x2d, 0x90, 0xf8, 0x52,
|
||||
0xcb, 0x2c, 0x37, 0x4b, 0xde, 0x1e, 0x6c, 0x36, 0x1d, 0x47, 0xf5, 0xdf,
|
||||
0x87, 0xca, 0x79, 0x98, 0x80, 0x09, 0x59, 0xd7, 0x14, 0xfd, 0xf7, 0xf9,
|
||||
0xf4, 0xce, 0x69, 0x23, 0xd2, 0xf8, 0xc4, 0xee, 0xa0, 0x7e, 0xf8, 0x36,
|
||||
0x8e, 0x35, 0x93, 0x45, 0x82, 0xae, 0x0d, 0xfc, 0x65, 0xbc, 0xaa, 0xf5,
|
||||
0x58, 0xa9, 0x65, 0xba, 0xc6, 0x08, 0x4b, 0x63, 0xc3, 0x3f, 0xa6, 0x8a,
|
||||
0xf4, 0xc1, 0x9b, 0x8f, 0x02, 0x45, 0x1b, 0x13, 0x78, 0x28, 0x9f, 0xd6,
|
||||
0x53, 0xb1, 0xc2, 0x7e, 0x4e, 0x71, 0x17, 0xe7, 0x55, 0x09, 0x62, 0xc7,
|
||||
0xad, 0xd5, 0x91, 0x1a, 0xc0, 0xfa, 0x49, 0x4a, 0xef, 0x00, 0xd6, 0xf6,
|
||||
0xf1, 0xd0, 0xc9, 0x40, 0x1b, 0xb1, 0xfd, 0x0e, 0xd3, 0x95, 0xf1, 0xcd,
|
||||
0x95, 0x60, 0x08, 0x73, 0xd2, 0xe0, 0x56, 0xfa, 0xd0, 0x65, 0x51, 0xfd,
|
||||
0xc4, 0x48, 0xd1, 0xaa, 0x5a, 0xba, 0xcb, 0x8f, 0x76, 0x22, 0xe3, 0x60,
|
||||
0x6f, 0x4a, 0x3c, 0x86, 0x35, 0xee, 0xe9, 0x88, 0x9a, 0x4a, 0x36, 0x34,
|
||||
0x74, 0xe3, 0x6d, 0x3f, 0xe4, 0x2a, 0x93, 0x0b, 0xe2, 0xc6, 0x47, 0x4d,
|
||||
0xf2, 0xb6, 0x8e, 0x78, 0x14, 0x91, 0x61, 0xcf, 0xfa, 0xb6, 0x1b, 0x39,
|
||||
0xca, 0x88, 0x0c, 0x04, 0x65, 0xd3, 0x3b, 0xd1, 0xc6, 0xda, 0xe5, 0xf4,
|
||||
0xe9, 0x1a, 0x38, 0x0f, 0xa5, 0xca, 0x32, 0x29, 0x78, 0x6c, 0x91, 0x9d,
|
||||
0xd8, 0xc1, 0x8c, 0x3d, 0x6e, 0x82, 0x49, 0x10, 0x38, 0x4c, 0x95, 0xe3,
|
||||
0xf1, 0x69, 0x30, 0x2e, 0x3e, 0xbf, 0xaf, 0x7d, 0x5e, 0x51, 0x3c, 0x6a,
|
||||
0x15, 0x04, 0xbd, 0x8f, 0xcf, 0xeb, 0x3f, 0xe0, 0xe0, 0xa7, 0xb3, 0x3e,
|
||||
0xf3, 0xf7, 0xd8, 0x1d, 0x15, 0x74, 0xef, 0x4e, 0x5b, 0xa0, 0x1e, 0x3a,
|
||||
0x45, 0xec, 0x98, 0x8b, 0xe4, 0x0c, 0xfb, 0x77, 0xfd, 0xcf, 0xde, 0x88,
|
||||
0x4d, 0x42, 0x18, 0x81, 0x14, 0x0d, 0xe2, 0x20, 0x4e, 0xcf, 0x0d, 0x3b,
|
||||
0xc8, 0x41, 0x36, 0x9d, 0x99, 0xab, 0x47, 0xcb, 0x55, 0xf0, 0x79, 0x77,
|
||||
0x32, 0x85, 0xa4, 0xe4, 0x11, 0x14, 0x42, 0x8d, 0x03, 0x8c, 0x76, 0xba,
|
||||
0x05, 0xcf, 0xe8, 0x40, 0x47, 0xcf, 0xbd, 0xe7, 0x22, 0xe6, 0x72, 0xce,
|
||||
0xa0, 0x13, 0xe4, 0x59, 0x5e, 0x68, 0xc2, 0x53, 0x7a, 0x4d, 0x4b, 0x4c,
|
||||
0xcd, 0xbf, 0xe2, 0xb0, 0xa3, 0x63, 0x77, 0xf2, 0x1e, 0xc3, 0x21, 0xca,
|
||||
0xd2, 0xb6, 0x7b, 0x01, 0x79, 0x02, 0x43, 0xec, 0x6d, 0x98, 0x97, 0x86,
|
||||
0x27, 0x41, 0x67, 0xe7, 0x04, 0xcf, 0x71, 0x0e, 0xfc, 0xc8, 0x3d, 0x32,
|
||||
0x99, 0x35, 0x4d, 0x2c, 0x94, 0xd7, 0x82, 0xb5, 0x2e, 0x20, 0x73, 0xd8,
|
||||
0xa4, 0xf9, 0xae, 0x6c, 0xd6, 0x12, 0x57, 0xe9, 0x44, 0x86, 0x6a, 0x9e,
|
||||
0xe0, 0x72, 0x84, 0x97, 0xb3, 0x8d, 0x56, 0x28, 0x66, 0xdb, 0xec, 0x25,
|
||||
0xbf, 0x01, 0x11, 0x76, 0x9b, 0xe1, 0x43, 0x8d, 0x6d, 0x0b, 0xfa, 0x3d,
|
||||
0x45, 0x15, 0x4a, 0xb4, 0xac, 0x76, 0x2a, 0x4a, 0xfb, 0x8d, 0xa5, 0x03,
|
||||
0xe4, 0x36, 0xe6, 0xd9, 0xfd, 0xc1, 0x20, 0x63, 0xe3, 0x5c, 0x9a, 0x0e,
|
||||
0x0f, 0x99, 0x49, 0xc6, 0x10, 0x9a, 0x08, 0x47, 0xff, 0x3d, 0xaa, 0x0c,
|
||||
0x9f, 0x46, 0x57, 0x5a, 0xe5, 0xc5, 0x24, 0xc5, 0xf1, 0xca, 0x1a, 0xa2,
|
||||
0xb0, 0x29, 0x78, 0xdd, 0x7a, 0x72, 0x49, 0x54, 0xac, 0xc4, 0x22, 0x04,
|
||||
0x97, 0xa2, 0xa1, 0x1a, 0x2f, 0x57, 0xfd, 0x9b, 0xaf, 0xc9, 0x30, 0x10,
|
||||
0x4a, 0xf4, 0x5e, 0x52, 0xf8, 0x25, 0x32, 0x48, 0xcb, 0x02, 0x6c, 0x3b,
|
||||
0xa7, 0xe3, 0xbd, 0xe9, 0x54, 0xd5, 0xbe, 0x46, 0x6b, 0xea, 0x0b, 0x43,
|
||||
0x13, 0x1d, 0x6f, 0x9c, 0xf5, 0xeb, 0x0e, 0xba, 0x28, 0x4f, 0x98, 0x84,
|
||||
0xb2, 0x19, 0x9c, 0xfe, 0xa0, 0x4a, 0xf6, 0x07, 0xcc, 0x0c, 0x8f, 0x75,
|
||||
0x6a, 0x16, 0xa1, 0x1c, 0x4e, 0x42, 0x51, 0xdc, 0x17, 0xb0, 0xa4, 0x2c,
|
||||
0x86, 0x87, 0x55, 0xf5, 0x7a, 0x5a, 0xd0, 0x0d, 0x4b, 0x9f, 0xb9, 0xcb,
|
||||
0xf3, 0x23, 0x5b, 0xaa, 0x81, 0x0e, 0x74, 0x56, 0x96, 0xbb, 0x65, 0x14,
|
||||
0x3e, 0xb2, 0x17, 0x53, 0x7e, 0x71, 0xf1, 0x9b, 0xfd, 0x1c, 0x5c, 0xfe,
|
||||
0xee, 0x6b, 0x58, 0xc7, 0xb5, 0x82, 0xed, 0x14, 0x47, 0xb0, 0x62, 0xe8,
|
||||
0xad, 0x34, 0x9c, 0xe6, 0x12, 0x29, 0x3b, 0x91, 0x2b, 0x83, 0xe6, 0x5c,
|
||||
0xd4, 0xf1, 0x5b, 0x7f, 0xe0, 0x58, 0xc8, 0x29, 0xa4, 0x17, 0x76, 0xa0,
|
||||
0x95, 0x9d, 0xb1, 0xad, 0xa1, 0x01, 0xa2, 0xce, 0xd0, 0xa3, 0x14, 0x1e,
|
||||
0xb7, 0x22, 0x98, 0x9d, 0xcd, 0x7f, 0x8c, 0xb8, 0x0f, 0x5b, 0x5b, 0x36,
|
||||
0x3f, 0xce, 0xca, 0xce, 0x5b, 0x54, 0x8b, 0xbd, 0xde, 0x82, 0x7e, 0xf1,
|
||||
0xf9, 0xa0, 0x30, 0xfe, 0xbd, 0xe7, 0x35, 0x84, 0x29, 0x1e, 0x41, 0x8e,
|
||||
0x55, 0x3f, 0xf7, 0x40, 0x23, 0xaa, 0x2d, 0x5a, 0xe5, 0xc4, 0x32, 0x9e,
|
||||
0xbf, 0x22, 0xb0, 0xc1, 0xe7, 0x8c, 0x7d, 0x5d, 0x0b, 0x28, 0xb4, 0x57,
|
||||
0x8e, 0xe7, 0x56, 0x3d, 0x1f, 0x35, 0x1e, 0x98, 0xa9, 0x0d, 0xd7, 0xb7,
|
||||
0x20, 0xe2, 0x89, 0x90, 0x04, 0xa7, 0x56, 0xea, 0x84, 0x16, 0x6f, 0xff,
|
||||
0xa9, 0x38, 0x5e, 0xa0, 0xaf, 0x2d, 0xc1, 0xb6, 0xc1, 0x77, 0x72, 0xe1,
|
||||
0x21, 0xc7, 0x2f, 0x3f, 0x85, 0x51, 0x4b, 0x83, 0xca, 0x33, 0x50, 0xb1,
|
||||
0x4c, 0x58, 0x0c, 0x54, 0x7c, 0x70, 0xfe, 0x23, 0xef, 0xc7, 0xc7, 0xaf,
|
||||
0xaf, 0xbf, 0xe5, 0x7b, 0x05, 0x90, 0x6c, 0x7a, 0x9f, 0x66, 0xb9, 0xc6,
|
||||
0x44, 0xd5, 0x99, 0x6c, 0xd5, 0xac, 0x74, 0xce, 0x00, 0x49, 0x4b, 0xcf,
|
||||
0x51, 0x01, 0xda, 0x24, 0xc5, 0x42, 0xba, 0x6f, 0x8a, 0x73, 0x20, 0x11,
|
||||
0xbc, 0x4a, 0x4f, 0xdb, 0xa6, 0x40, 0x27, 0xbc, 0x93, 0xa3, 0x30, 0xb2,
|
||||
0xcc, 0x6e, 0x78, 0xa0, 0x28, 0x7d, 0xe7, 0x34, 0x11, 0x4c, 0x00, 0x8b,
|
||||
0x04, 0x3d, 0x93, 0x7f, 0x2a, 0x3c, 0x67, 0x56, 0xad, 0xc5, 0xdd, 0x2a,
|
||||
0x75, 0xe1, 0x96, 0x02, 0x8d, 0x66, 0x0e, 0xd8, 0xc1, 0x83, 0xdf, 0x27,
|
||||
0x42, 0xc4, 0x47, 0x18, 0x24, 0xac, 0x99, 0x8b, 0x22, 0x28, 0x68, 0x74,
|
||||
0xb2, 0x7e, 0x58, 0x19, 0x19, 0xda, 0xd4, 0x96, 0x36, 0x26, 0xc7, 0x53,
|
||||
0x37, 0xdb, 0x53, 0xa5, 0xd3, 0x98, 0xb4, 0x65, 0x80, 0xde, 0x73, 0xcb,
|
||||
0x97, 0x7e, 0x59, 0x80, 0xf6, 0x25, 0x60, 0x6f, 0x77, 0x20, 0x4c, 0xc7,
|
||||
0x35, 0xc6, 0x80, 0xe3, 0x56, 0x2c, 0xba, 0x62, 0xf7, 0x56, 0xf9, 0x63,
|
||||
0x3e, 0xf9, 0x91, 0x7b, 0x9c, 0x35, 0x02, 0x04, 0xd8, 0x3d, 0x35, 0xfd,
|
||||
0xb7, 0x85, 0xba, 0x04, 0x19, 0x7f, 0xb9, 0xe6, 0x6a, 0x65, 0x51, 0x9e,
|
||||
0xde, 0x21, 0xec, 0xf0, 0x6b, 0xfd, 0x41, 0x90, 0xdc, 0x32, 0x08, 0x4d,
|
||||
0x9b, 0x43, 0x2a, 0x61, 0x5b, 0x35, 0x61, 0xc1, 0xfd, 0xa2, 0xde, 0x30,
|
||||
0xd3, 0x93, 0xc6, 0x0d, 0xad, 0x76, 0xac, 0xfb, 0xb0, 0xee, 0x85, 0x5f,
|
||||
0xde, 0x4e, 0x2b, 0xe8, 0x8f, 0x67, 0xa0, 0x12, 0x00, 0x3f, 0xcf, 0x04,
|
||||
0xe4, 0xb1, 0x2b, 0xa0, 0xda, 0xbb, 0x33, 0x5a, 0x58, 0x9b, 0x7c, 0x05,
|
||||
0xea, 0x2b, 0x7b, 0x40, 0x9c, 0xc3, 0xe0, 0x99, 0x9e, 0xe0, 0x91, 0x67,
|
||||
0xa5, 0x63, 0x6b, 0x9f, 0x15, 0xb6, 0x3c, 0xda, 0x17, 0x90, 0x8f, 0x05,
|
||||
0x7e, 0x61, 0x7c, 0xc7, 0x25, 0xdf, 0xbb, 0xd6, 0x96, 0xba, 0x45, 0xa8,
|
||||
0x84, 0xa0, 0x7d, 0x0f, 0x41, 0xdd, 0xba, 0xe5, 0x5a, 0x09, 0x3d, 0xe7,
|
||||
0x20, 0x22, 0xc6, 0x8e, 0x0d, 0xd5, 0xc5, 0x75, 0x38, 0x8c, 0x6e, 0x4f,
|
||||
0xa0, 0x42, 0xf7, 0x5e, 0xb1, 0x35, 0xe5, 0xfc, 0x93, 0x13, 0x58, 0x2b,
|
||||
0xa7, 0xe0, 0xfe, 0xff, 0x1a, 0xdd, 0x30, 0x27, 0x9e, 0x69, 0xdd, 0x05,
|
||||
0x18, 0xf7, 0x23, 0x5d, 0x9c, 0x64, 0xbe, 0x47, 0xf0, 0xa8, 0xe1, 0xf5,
|
||||
0xde, 0x67, 0x8a, 0xcc, 0x18, 0xed, 0x4a, 0x76, 0xa0, 0x23, 0x96, 0x55,
|
||||
0xd0, 0x84, 0x22, 0xce, 0xe1, 0xe2, 0x11, 0x80, 0x95, 0x61, 0x0d, 0x75,
|
||||
0x12, 0x86, 0xb9, 0x3c, 0x10, 0x9d, 0x4d, 0x39, 0x93, 0x42, 0x7d, 0x83,
|
||||
0xa5, 0xf4, 0xe4, 0xaa, 0x9b, 0x59, 0x22, 0x5e, 0xd3, 0xfd, 0xad, 0xf9,
|
||||
0xa0, 0xf2, 0xb2, 0x70, 0x86, 0x29, 0xcd, 0x71, 0x61, 0x98, 0xb8, 0x21,
|
||||
0x15, 0x5d, 0xf5, 0xde, 0x4d, 0x65, 0x27, 0x09, 0x8c, 0xed, 0xd0, 0xc8,
|
||||
0xe7, 0xed, 0x0b, 0x0c, 0x13, 0x9e, 0x78, 0xea, 0xf8, 0x3c, 0x10, 0xda,
|
||||
0xcd, 0xfc, 0xaf, 0x33, 0x96, 0x62, 0x31, 0x9c, 0xb6, 0x9d, 0xc8, 0x7a,
|
||||
0x35, 0xe6, 0xff, 0x75, 0xa8, 0x30, 0x98, 0xd4, 0xaa, 0xcf, 0x9c, 0xef,
|
||||
0xda, 0xb9, 0x64, 0xe8, 0x3b, 0xa6, 0x2f, 0xc1, 0xbd, 0x7e, 0x6b, 0xfc,
|
||||
0x1a, 0xef, 0x62, 0xad, 0x90, 0x5e, 0x7d, 0x29, 0x12, 0x4d, 0x76, 0x86,
|
||||
0x5c, 0x29, 0x7c, 0x61, 0x1d, 0x1e, 0x63, 0x97, 0x21, 0xcd, 0x77, 0xbd,
|
||||
0xc2, 0x32, 0x45, 0xca, 0x7a, 0xdc, 0x0b, 0x16, 0xa4, 0x10, 0xac, 0x37,
|
||||
0xba, 0xf5, 0xf6, 0xbc, 0x26, 0x66, 0x67, 0x2b, 0xb8, 0x2e, 0x22, 0xc0,
|
||||
0xea, 0x90, 0x78, 0xf0, 0x0d, 0x0f, 0x80, 0x69, 0x60, 0xd2, 0x89, 0xa5,
|
||||
0x1a, 0xb0, 0xcf, 0x5e, 0x57, 0x6f, 0x79, 0xdc, 0xd8, 0x2c, 0x51, 0x92,
|
||||
0xd6, 0x62, 0x41, 0xf9, 0xf7, 0x26, 0xf0, 0x59, 0x93, 0xe2, 0x76, 0x82,
|
||||
0x21, 0xf6, 0xab, 0x7a, 0xd2, 0x7b, 0x81, 0xcb, 0x8c, 0xe8, 0x87, 0x77,
|
||||
0x76, 0xce, 0xf2, 0xaa, 0x00, 0xdc, 0xec, 0xd1, 0xc1, 0x8d, 0xf8, 0x42,
|
||||
0x41, 0x8c, 0x35, 0xd1, 0x70, 0x97, 0xf4, 0x82, 0x2f, 0x3a, 0x2f, 0x4a,
|
||||
0x18, 0x8f, 0xac, 0x41, 0xfa, 0x29, 0xc2, 0x9d, 0x0a, 0xfa, 0x0c, 0x44,
|
||||
0xdd, 0xea, 0xc6, 0x2b, 0xd3, 0x2e, 0x28, 0xee, 0xca, 0x6e, 0x84, 0x90,
|
||||
0xec, 0xaf, 0xf4, 0x8f, 0xbd, 0xc7, 0xd1, 0x2d, 0xf6, 0x9a, 0xd2, 0x00,
|
||||
0xaa, 0x5c, 0x38, 0xc5, 0x11, 0x43, 0x7c, 0xf4, 0x0d, 0xbd, 0x57, 0x6d,
|
||||
0x42, 0x62, 0xa5, 0xd8, 0x05, 0xa7, 0xe9, 0x30, 0xc0, 0x81, 0x9b, 0xfc,
|
||||
0x30, 0xda, 0x16, 0x2f, 0x54, 0x61, 0x08, 0xaa, 0xf7, 0xc0, 0x1e, 0x4d,
|
||||
0xf2, 0xd4, 0xed, 0x5c, 0x96, 0x30, 0xad, 0x9f, 0xc5, 0xe3, 0xf0, 0x91,
|
||||
0xff, 0xf0, 0xb1, 0xe4, 0x93, 0x7b, 0x67, 0x11, 0xba, 0xef, 0xb7, 0xf4,
|
||||
0x29, 0x93, 0x6d, 0x32, 0x1f, 0x88, 0xd1, 0x6c, 0x7c, 0x5a, 0x7e, 0x0a,
|
||||
0xef, 0x6a, 0xe9, 0x23, 0x2c, 0xde, 0x4c, 0x68, 0x36, 0xcb, 0xaa, 0x1f,
|
||||
0xd3, 0x71, 0xce, 0x31, 0x8b, 0x2b, 0x51, 0x16, 0xe6, 0x65, 0xd1, 0x30,
|
||||
0xaf, 0xb8, 0xbe, 0x02, 0x21, 0x61, 0x36, 0xbc, 0x19, 0x7c, 0x0e, 0x9d,
|
||||
0x9c, 0xd6, 0xa9, 0xc7, 0x5c, 0x2f, 0xb6, 0x23, 0x4b, 0x64, 0x3b, 0x99,
|
||||
0x74, 0x83, 0x51, 0xda, 0x3e, 0xf8, 0xcf, 0x0f, 0xa3, 0x7a, 0xfb, 0xaa,
|
||||
0xd1, 0xe2, 0x09, 0x05, 0x3a, 0xf5, 0xa8, 0x61, 0x51, 0x59, 0xf6, 0xb3,
|
||||
0x3d, 0xe9, 0xa3, 0xc7, 0x3a, 0xe6, 0xff, 0x2d, 0x96, 0xaf, 0xe4, 0x41,
|
||||
0xb8, 0x7d, 0xca, 0xdf, 0x42, 0x16, 0x5c, 0xee, 0xd0, 0x9d, 0xa3, 0x74,
|
||||
0xa9, 0xae, 0xfd, 0x6d, 0x3b, 0x15, 0xb9, 0x89, 0x19, 0xa8, 0xf8, 0x48,
|
||||
0xfe, 0x3a, 0xf6, 0xd7, 0x44, 0x4b, 0x96, 0x07, 0x37, 0x4b, 0xf9, 0x33,
|
||||
0x62, 0x4f, 0x08, 0x38, 0xfc, 0x02, 0xfc, 0x8d, 0x3d, 0x65, 0x83, 0x02,
|
||||
0xed, 0xd7, 0x48, 0x40, 0x51, 0x99, 0x0a, 0x20, 0xb2, 0xda, 0x9d, 0xca,
|
||||
0xbf, 0xb7, 0xcf, 0xa8, 0x32, 0x67, 0x2f, 0x31, 0xa3, 0x00, 0xe3, 0xcb,
|
||||
0x09, 0x7e, 0x0a, 0xb0, 0x7a, 0x34, 0x7b, 0xfc, 0x1d, 0x97, 0x8c, 0xa6,
|
||||
0x17, 0xcb, 0x62, 0xc7, 0x28, 0xf4, 0xb8, 0x21, 0xdb, 0x51, 0xc9, 0xef,
|
||||
0x69, 0xb6, 0xac, 0x36, 0x90, 0x74, 0x90, 0xb7, 0xdb, 0xcb, 0xfd, 0xdb,
|
||||
0x17, 0x81, 0xed, 0x94, 0x4d, 0xe5, 0x4e, 0xe5, 0xf6, 0x01, 0x4a, 0x99,
|
||||
0x9f, 0x5e, 0xe0, 0x45, 0x70, 0x41, 0x45, 0xa2, 0x2b, 0x4e, 0xd6, 0xab,
|
||||
0xdc, 0x06, 0x15, 0x2d, 0x48, 0x88, 0x17, 0x43, 0x39, 0x94, 0xb4, 0x3a,
|
||||
0x23, 0xce, 0xbb, 0xda, 0x0e, 0xb0, 0x5c, 0x1e, 0x0d, 0x0b, 0x31, 0x8e,
|
||||
0x9b, 0x04, 0x80, 0x78, 0x75, 0x1c, 0x9b, 0x97, 0xac, 0xc7, 0xad, 0xde,
|
||||
0x2b, 0x7f, 0x48, 0xb2, 0x29, 0xae, 0x76, 0x59, 0x27, 0xee, 0x79, 0xb8,
|
||||
0x8e, 0x30, 0xe7, 0xf2, 0x84, 0x44, 0x40, 0x79, 0x25, 0xce, 0x13, 0x87,
|
||||
0x8e, 0xfa, 0x08, 0x18, 0x8d, 0x71, 0xac, 0xeb, 0xf2, 0x7c, 0xa6, 0x69,
|
||||
0x29, 0x1b, 0xd8, 0x02, 0xea, 0x64, 0x40, 0x7d, 0xa1, 0xb2, 0x05, 0xd3,
|
||||
0x2b, 0x9d, 0x98, 0xa4, 0x2c, 0xee, 0xc9, 0x2c, 0x52, 0x5a, 0xd9, 0x3e,
|
||||
0xd4, 0xcc, 0x6b, 0xf5, 0x11, 0x4a, 0x0a, 0x84, 0x4b, 0x6e, 0xa4, 0xab,
|
||||
0x16, 0x46, 0x31, 0xb2, 0x84, 0x32, 0x43, 0x43, 0xe3, 0x21, 0x09, 0x33,
|
||||
0x53, 0x9d, 0x93, 0x60, 0xd4, 0x18, 0xef, 0x71, 0xc8, 0xd1, 0x97, 0x2b,
|
||||
0x2d, 0xa0, 0xe3, 0xc3, 0xb7, 0x54, 0x5b, 0xa2, 0xbf, 0x92, 0xa0, 0x48,
|
||||
0x15, 0xef, 0x8e, 0x25, 0x02, 0x49, 0x35, 0x20, 0x9e, 0x1b, 0x52, 0xfa,
|
||||
0xf9, 0x33, 0x99, 0x31, 0x2c, 0x1b, 0x04, 0x92, 0x8d, 0x19, 0xdb, 0x7d,
|
||||
0xad, 0x61, 0x29, 0xe3, 0x5c, 0xb7, 0x94, 0xa6, 0x8b, 0x2e, 0xc5, 0x2e,
|
||||
0xbd, 0xe0, 0x60, 0xae, 0xea, 0x93, 0x08, 0x64, 0x98, 0x9e, 0x8e, 0xa1,
|
||||
0x2e, 0xf1, 0xe0, 0x31, 0x57, 0x87, 0xd4, 0x77, 0x81, 0x6d, 0xf5, 0xa6,
|
||||
0x4c, 0x9b, 0x89, 0x8d, 0x08, 0x96, 0xc5, 0x96, 0xbe, 0x59, 0xcc, 0xbd,
|
||||
0x58, 0x7b, 0x21, 0x08, 0x19, 0xc0, 0x55, 0x33, 0x80, 0x44, 0x0d, 0x8e,
|
||||
0x59, 0xf9, 0xe8, 0x00, 0x50, 0x98, 0xa2, 0x30, 0xa6, 0xfd, 0xa8, 0x46,
|
||||
0xc5, 0x05, 0x65, 0x59, 0xe7, 0x25, 0x1a, 0x17, 0x32, 0x8a, 0xc0, 0x2a,
|
||||
0x15, 0x7e, 0x69, 0x11, 0xe9, 0x6d, 0xff, 0x96, 0x52, 0x98, 0xa3, 0xfa,
|
||||
0x43, 0x7b, 0x33, 0x79, 0x56, 0xc4, 0xe3, 0x27, 0x40, 0xd6, 0x33, 0xea,
|
||||
0xac, 0x87, 0x4e, 0x74, 0xbb, 0xe0, 0x52, 0xab, 0x56, 0x8a, 0xed, 0x3e,
|
||||
0xd2, 0x25, 0xb2, 0xbe, 0x58, 0x4c, 0xdf, 0x0e, 0x8f, 0xca, 0x57, 0xdc,
|
||||
0x00, 0xfa, 0xb0, 0xc0, 0xf3, 0x7b, 0x6e, 0x41, 0x17, 0x07, 0xcb, 0x08,
|
||||
0xe3, 0xd8, 0xa5, 0x04, 0xdb, 0x42, 0x99, 0x67, 0x73, 0xd5, 0xd7, 0x1f,
|
||||
0x22, 0x9e, 0xea, 0x66, 0x5f, 0x44, 0x7d, 0xf4, 0xbf, 0x50, 0xb2, 0x3e,
|
||||
0x2f, 0x9f, 0x7a, 0xca, 0x80, 0x95, 0x59, 0x83, 0x69, 0x05, 0xec, 0x70,
|
||||
0x71, 0x12, 0x97, 0xaf, 0xdb, 0xfd, 0xe8, 0x11, 0x44, 0x8a, 0x6e, 0x09,
|
||||
0x90, 0xd5, 0x59, 0x8c, 0x6a, 0x65, 0xf9, 0xa9, 0x3d, 0x3c, 0x0c, 0xf3,
|
||||
0x2f, 0xa0, 0xb1, 0x8e, 0xf0, 0x3f, 0x16, 0x63, 0xf6, 0xe8, 0x80, 0x27,
|
||||
0x64, 0x56, 0x99, 0x94, 0x93, 0xc8, 0x36, 0x00, 0x21, 0xeb, 0x7c, 0x41,
|
||||
0x86, 0xae, 0xb2, 0x4b, 0x7d, 0xac, 0xac, 0x90, 0x8b, 0x99, 0x18, 0x25,
|
||||
0xa4, 0x0d, 0x9c, 0x96, 0x53, 0x0c, 0xfa, 0x7e, 0x61, 0xba, 0x7f, 0xca,
|
||||
0x61, 0x7b, 0xba, 0x2f, 0x96, 0x2f, 0x75, 0x29, 0x84, 0xb7, 0x32, 0xca,
|
||||
0x3b, 0x1f, 0xe6, 0x57, 0x34, 0xf3, 0xf1, 0x58, 0x61, 0xc9, 0x04, 0xa2,
|
||||
0x20, 0xea, 0x77, 0xa7, 0x83, 0xed, 0x3e, 0x14, 0x87, 0x8f, 0x82, 0x86,
|
||||
0x88, 0xc3, 0xf9, 0x10, 0x7e, 0x03, 0xa4, 0x33, 0xe0, 0x4e, 0x97, 0xef,
|
||||
0x66, 0x91, 0x9f, 0xce, 0x85, 0xc8, 0xca, 0x04, 0x3a, 0x8b, 0xf6, 0xc7,
|
||||
0xdf, 0xeb, 0x75, 0x31, 0xf4, 0x1a, 0x9a, 0x67, 0xc7, 0xb1, 0xd0, 0x33,
|
||||
0x97, 0xea, 0xd2, 0x52, 0xc3, 0x81, 0xdb, 0x63, 0x64, 0x31, 0x0f, 0x9e,
|
||||
0x75, 0x5f, 0xde, 0xe7, 0x46, 0x01, 0x19, 0x03, 0xe5, 0x0b, 0xf8, 0x9f,
|
||||
0xab, 0x4f, 0x1a, 0x1f, 0xe0, 0xb0, 0x75, 0x96, 0xf2, 0x15, 0x49, 0x63,
|
||||
0xa7, 0xae, 0x26, 0xe5, 0x41, 0x82, 0x1b, 0x1e, 0xd0, 0x8b, 0x2e, 0xcc,
|
||||
0xf7, 0x30, 0xb3, 0xb5, 0x1b, 0xd9, 0xe7, 0x65, 0x1e, 0x60, 0x3b, 0x74,
|
||||
0xfa, 0x52, 0x03, 0xe9, 0x0f, 0x45, 0x87, 0x8c, 0x1a, 0x4d, 0x0d, 0xb9,
|
||||
0x90, 0xec, 0xa3, 0x59, 0xad, 0xa2, 0x33, 0xfb, 0xd3, 0xac, 0xf0, 0x58,
|
||||
0x0c, 0x6f, 0x27, 0xa9, 0x1b, 0x18, 0xcb, 0x5d, 0x70, 0xcd, 0x14, 0xd9,
|
||||
0xe3, 0x9f, 0x42, 0xf7, 0x82, 0x3e, 0x47, 0x39, 0xe4, 0xa2, 0x9e, 0x03,
|
||||
0x7c, 0x2f, 0x5d, 0x18, 0x55, 0x20, 0x63, 0x68, 0x38, 0xc8, 0x0b, 0x3d,
|
||||
0xf3, 0xc7, 0x91, 0x72, 0x70, 0x4c, 0x8a, 0x0d, 0xc0, 0x80, 0x7d, 0xde,
|
||||
0xa3, 0x7f, 0x0a, 0x54, 0xb5, 0xd0, 0x49, 0x42, 0xc3, 0x27, 0x69, 0x19,
|
||||
0x1c, 0xbc, 0xf9, 0x5e, 0x16, 0x19, 0xab, 0xdb, 0x99, 0x1e, 0x90, 0x8c,
|
||||
0x6e, 0xb9, 0x17, 0x95, 0xad, 0xde, 0x70, 0x93, 0x7f, 0x5f, 0x26, 0xb0,
|
||||
0x9f, 0x86, 0xb3, 0x82, 0x9d, 0x30, 0x24, 0x19, 0x83, 0x7d, 0x20, 0x70,
|
||||
0x29, 0xe1, 0xb3, 0x22, 0x99, 0xb5, 0xef, 0x8f, 0x7a, 0x66, 0xbc, 0x86,
|
||||
0x18, 0x85, 0x39, 0x56, 0x9b, 0x5f, 0xf6, 0x63, 0xc8, 0x24, 0xbc, 0x54,
|
||||
0xc3, 0xc3, 0xa3, 0x27, 0xad, 0x80, 0xa9, 0x8f, 0x3b, 0x4b, 0xa0, 0x08,
|
||||
0xcc, 0xf9, 0xde, 0x0b, 0x92, 0xa3, 0x26, 0x79, 0x42, 0xa2, 0xd0, 0x7c,
|
||||
0xd4, 0x2e, 0x8f, 0x63, 0x4b, 0xaf, 0x6b, 0x7a, 0x58, 0x99, 0xb2, 0xb4,
|
||||
0x01, 0x55, 0x75, 0x4a, 0xca, 0x9d, 0xd7, 0x85, 0xa8, 0x28, 0x97, 0x3d,
|
||||
0xa6, 0x3c, 0xd1, 0xf6, 0x97, 0xd4, 0x15, 0x45, 0xc4, 0x25, 0x48, 0xd5,
|
||||
0xa6, 0x10, 0x00, 0xa4, 0x3e, 0xc4, 0xb4, 0x1d, 0x08, 0xf0, 0xf7, 0x6d,
|
||||
0x91, 0xc9, 0xc4, 0x4e, 0xb5, 0xd5, 0x45, 0x07, 0x3e, 0x05, 0x34, 0x44,
|
||||
0x14, 0xe1, 0x11, 0x1e, 0xa2, 0xba, 0x37, 0x18, 0xea, 0x16, 0x78, 0x58,
|
||||
0x83, 0xfd, 0x98, 0x42, 0xd3, 0x83, 0xac, 0x77, 0x65, 0xc9, 0x5b, 0x36,
|
||||
0x8b, 0x9d, 0x76, 0x25, 0x5d, 0xfc, 0x80, 0x21, 0x0e, 0xd8, 0xcb, 0xc4,
|
||||
0xcc, 0x59, 0x4e, 0x85, 0x51, 0x3b, 0xc0, 0xa8, 0x0b, 0x5d, 0x60, 0xa2,
|
||||
0xc3, 0x2f, 0x2e, 0x8a, 0x18, 0x3c, 0x9d, 0x18, 0x0d, 0xd5, 0xa7, 0x32,
|
||||
0x72, 0xf0, 0xef, 0xdf, 0xa4, 0x35, 0x09, 0x75, 0x2f, 0xb0, 0xe0, 0xec,
|
||||
0xb2, 0x2d, 0x54, 0xeb, 0x22, 0x01, 0x67, 0x73, 0x61, 0x2d, 0x00, 0x8e,
|
||||
0x2a, 0x59, 0xc5, 0xa0, 0xf1, 0xb4, 0x20, 0x15, 0xeb, 0xe5, 0x0b, 0x7d,
|
||||
0x6b, 0x70, 0x45, 0x64, 0x3a, 0xc6, 0xbf, 0x34, 0x6a, 0x33, 0x35, 0xf2,
|
||||
0x88, 0x47, 0x4d, 0x95, 0x3d, 0x76, 0x7c, 0x56, 0x7a, 0x6a, 0x72, 0x48,
|
||||
0xa9, 0x28, 0x32, 0xf6, 0x25, 0xf5, 0x2a, 0x52, 0x40, 0x70, 0x46, 0x93,
|
||||
0x4e, 0x86, 0x58, 0xde, 0x11, 0x66, 0x2f, 0xa6, 0x75, 0xbd, 0x24, 0x05,
|
||||
0x3c, 0x5e, 0xf4, 0xbc, 0x88, 0xda, 0x69, 0xd0, 0x9d, 0x7f, 0xfa, 0x6b,
|
||||
0xf4, 0x50, 0x51, 0x03, 0x26, 0xf6, 0xaa, 0x11, 0xa6, 0x3d, 0x2a, 0xa3,
|
||||
0x18, 0x0e, 0xb1, 0x0b, 0x8c, 0x5a, 0x3a, 0xc4, 0x14, 0xd3, 0x9b, 0xea,
|
||||
0x2f, 0xf9, 0x5f, 0xbc, 0x9a, 0x94, 0x92, 0x2b, 0xaa, 0xf7, 0x62, 0x0c,
|
||||
0xf0, 0xf9, 0xcc, 0x20, 0x1b, 0x5b, 0x56, 0xed, 0xe4, 0x5f, 0xef, 0xa0,
|
||||
0x5d, 0xe2, 0xe7, 0x50, 0x0d, 0x13, 0x92, 0x7f, 0x70, 0x68, 0x81, 0x3c,
|
||||
0x5d, 0x71, 0x12, 0x14, 0xba, 0xe9, 0xf1, 0x24, 0x70, 0xc3, 0xea, 0x3a,
|
||||
0x8e, 0x19, 0xab, 0x4f, 0x5f, 0x20, 0x38, 0xcb, 0xd8, 0x91, 0x3d, 0x47,
|
||||
0x8a, 0xb8, 0xe0, 0x81, 0x73, 0x57, 0x19, 0xc4, 0xb6, 0xd7, 0x6e, 0x01,
|
||||
0xad, 0xb7, 0x80, 0xb2, 0x44, 0xe7, 0x77, 0x3a, 0x55, 0x9f, 0x36, 0x77,
|
||||
0x4c, 0x88, 0x69, 0x6b, 0xc6, 0x67, 0x2f, 0xbd, 0x37, 0x0c, 0xf2, 0x9f,
|
||||
0x88, 0x6e, 0xa6, 0xa0, 0xd7, 0x5a, 0x53, 0xf3, 0xc0, 0xaa, 0x7b, 0xca,
|
||||
0xc3, 0x07, 0xf4, 0x08, 0xc9, 0x84, 0x0c, 0x36, 0x49, 0x15, 0x71, 0x8c,
|
||||
0x60, 0x6f, 0xd5, 0x91, 0xc5, 0x3a, 0x33, 0x3b, 0xde, 0x8c, 0xe0, 0xf4,
|
||||
0x08, 0x42, 0x6d, 0xf7, 0x3b, 0xae, 0xd0, 0x06, 0xe5, 0x1b, 0x60, 0x24,
|
||||
0xc4, 0xaa, 0xcf, 0x54, 0x0e, 0x78, 0xa6, 0xf9, 0x40, 0x3b, 0xca, 0xed,
|
||||
0x5f, 0xa4, 0xd3, 0x13, 0x6e, 0x0a, 0x59, 0x3c, 0xda, 0xdb, 0xc6, 0x6f,
|
||||
0x8f, 0x89, 0x31, 0x8c, 0x87, 0x1e, 0xfe, 0x01, 0x16, 0x5b, 0xac, 0x1a,
|
||||
0x62, 0x85, 0x39, 0x61, 0xe1, 0x4c, 0xae, 0xae, 0x85, 0xd9, 0x5d, 0x9c,
|
||||
0x2a, 0x6e, 0x6b, 0xec, 0xef, 0x2b, 0xc6, 0x32, 0xd6, 0x62, 0x7e, 0x46,
|
||||
0x67, 0xe8, 0x6f, 0x4a, 0x50, 0x05, 0x75, 0xda, 0xe0, 0x6b, 0x47, 0xb6,
|
||||
0x2a, 0x48, 0x56, 0x3e, 0x22, 0x18, 0xfb, 0xf5, 0x66, 0xf1, 0x42, 0xd6,
|
||||
0xf3, 0x3d, 0x26, 0xc8, 0x44, 0xea, 0xa7, 0x9f, 0x90, 0xd8, 0x8f, 0xeb,
|
||||
0x45, 0x50, 0x99, 0xf8, 0x86, 0x5f, 0x70, 0x03, 0x89, 0x06, 0x08, 0x92,
|
||||
0x02, 0x6a, 0x93, 0x90, 0xce, 0xf2, 0xb5, 0x06, 0x78, 0x1e, 0x96, 0x1d,
|
||||
0xa2, 0x20, 0x27, 0x90, 0xfc, 0x07, 0x50, 0x84, 0xf8, 0x19, 0xd0, 0xb1,
|
||||
0x0c, 0x75, 0xb6, 0x3b, 0xb2, 0xaa, 0x73, 0x34, 0x49, 0xc9, 0xb2, 0xc2,
|
||||
0x58, 0x7e, 0x40, 0x19, 0xa6, 0x08, 0x6b, 0x9e, 0x87, 0xce, 0x7a, 0x27,
|
||||
0x3d, 0x7e, 0xe3, 0xe4, 0x12, 0x7c, 0x39, 0x24, 0x16, 0x80, 0x97, 0xbb,
|
||||
0x94, 0x9e, 0xa6, 0x0f, 0x5f, 0x42, 0xa1, 0xca, 0x37, 0xa0, 0xbe, 0x1c,
|
||||
0x4f, 0x62, 0x68, 0x6a, 0x50, 0x1e, 0x77, 0xe2, 0xb6, 0xdf, 0xa8, 0x89,
|
||||
0xdf, 0x98, 0x9b, 0x80, 0xc2, 0x00, 0x21, 0x6a, 0xf6, 0x82, 0xb3, 0x5f,
|
||||
0x8b, 0x98, 0x68, 0xe1, 0x76, 0xef, 0x06, 0x8c, 0x24, 0x07, 0xd2, 0xe5,
|
||||
0x86, 0xc1, 0xc0, 0x26, 0x94, 0x2d, 0x96, 0xb1, 0xa4, 0x77, 0x11, 0xcb,
|
||||
0xa9, 0xf9, 0x46, 0xe8, 0xfd, 0x91, 0x61, 0x9d, 0xce, 0xd1, 0x24, 0x27,
|
||||
0xbb, 0xae, 0x68, 0x04, 0x44, 0xc9, 0x44, 0x69, 0x52, 0x05, 0x10, 0x4d,
|
||||
0x96, 0x56, 0x98, 0x69, 0x46, 0x49, 0xc2, 0x75, 0xb9, 0xd8, 0x1c, 0x46,
|
||||
0xdc, 0x71, 0x86, 0x71, 0x07, 0xea, 0x18, 0x5d, 0x7c, 0x3f, 0x81, 0x97,
|
||||
0xfc, 0xc8, 0x88, 0xe4, 0xe7, 0x5e, 0xb2, 0xf8, 0x04, 0x17, 0x14, 0xcf,
|
||||
0x24, 0x4c, 0x35, 0x1e, 0x0d, 0xba, 0xf6, 0x0d, 0x29, 0x1c, 0x3c, 0x5a,
|
||||
0x0f, 0xd0, 0xf8, 0xf8, 0xdb, 0xa6, 0xa5, 0xf2, 0x83, 0x3d, 0xa0, 0x16,
|
||||
0x5d, 0xf4, 0xb7, 0xc0, 0xc5, 0xf1, 0x0f, 0x09, 0x7d, 0x6a, 0x24, 0xf0,
|
||||
0x94, 0x03, 0x7d, 0xc0, 0x96, 0x61, 0xa7, 0x44, 0xe2, 0xa3, 0x40, 0xa5,
|
||||
0x00, 0x06, 0x13, 0x45, 0xba, 0x60, 0xc3, 0x15, 0x75, 0x6a, 0xe6, 0xd9,
|
||||
0x21, 0x37, 0x15, 0x80, 0xfd, 0x68, 0xdf, 0xab, 0x9f, 0xde, 0xcf, 0x4a,
|
||||
0x98, 0xf8, 0xa9, 0x27, 0xd3, 0x2d, 0x3d, 0x5c, 0xdc, 0xff, 0x8c, 0x61,
|
||||
0x4d, 0x25, 0xc8, 0xdf, 0x66, 0xf6, 0xde, 0xf0, 0x21, 0x5a, 0x27, 0x36,
|
||||
0x38, 0x1f, 0xfe, 0x89, 0x33, 0x52, 0x4e, 0x99, 0x55, 0x9b, 0xd0, 0x4f,
|
||||
0x15, 0xba, 0x91, 0xdd, 0x95, 0xeb, 0x57, 0x18, 0xc4, 0x21, 0x86, 0x24,
|
||||
0x67, 0x38, 0xf0, 0x2f, 0xd2, 0x66, 0x0b, 0x92, 0xb9, 0xc3, 0xcb, 0x8e,
|
||||
0x7f, 0x6c, 0x44, 0xbc, 0xcb, 0x45, 0x71, 0x51, 0x61, 0x35, 0xf2, 0x9f,
|
||||
0xbf, 0xf2, 0x8f, 0x5a, 0xdb, 0xaa, 0x54, 0x20, 0x1d, 0x52, 0xce, 0x89,
|
||||
0xd4, 0xe7, 0x79, 0x75, 0xa7, 0xff, 0x1f, 0x6a, 0xfd, 0xb9, 0x56, 0xee,
|
||||
0xca, 0x2c, 0x9f, 0xf3, 0x6d, 0xdf, 0xce, 0x96, 0x0c, 0xaf, 0x2c, 0x2c,
|
||||
0x7d, 0x35, 0x79, 0x5d, 0x43, 0xbb, 0x27, 0xaf, 0x07, 0x17, 0x9a, 0x67,
|
||||
0xde, 0x3b, 0x35, 0xf1, 0xd9, 0x98, 0x92, 0xf8, 0x3d, 0x35, 0xf1, 0x25,
|
||||
0xf8, 0x15, 0xcc, 0x6f, 0x49, 0x9e, 0xba, 0x52, 0xd8, 0x76, 0x71, 0x8d,
|
||||
0x90, 0x2c, 0x73, 0x3f, 0xef, 0xa2, 0xef, 0x43, 0x19, 0x2d, 0x83, 0xb9,
|
||||
0xde, 0xc6, 0x33, 0x00, 0xd9, 0x9d, 0x50, 0x58, 0xa7, 0xaa, 0x07, 0xa6,
|
||||
0x81, 0x8c, 0x1b, 0xe7, 0x9a, 0x3f, 0x11, 0x4c, 0xef, 0x96, 0x07, 0xb3,
|
||||
0x48, 0x3e, 0x95, 0x2e, 0xb1, 0x27, 0x2d, 0xf9, 0x50, 0x49, 0x91, 0x7e,
|
||||
0x91, 0xd2, 0xcc, 0xf0, 0x36, 0xe8, 0xcd, 0x69, 0x05, 0x68, 0x50, 0xe6,
|
||||
0x4d, 0xbe, 0xd7, 0x55, 0xd5, 0xd2, 0xe4, 0x96, 0xd0, 0xa8, 0x1b, 0x4b,
|
||||
0x28, 0x54, 0xcb, 0x95, 0x4c, 0xb5, 0xe7, 0x1c, 0x95, 0x2e, 0x11, 0xda,
|
||||
0x30, 0x0e, 0x87, 0xfe, 0x5e, 0x34, 0x80, 0x59, 0x9d, 0x70, 0x09, 0x48,
|
||||
0x9e, 0xe8, 0x31, 0x12, 0x3f, 0xe2, 0x07, 0x35, 0x74, 0x79, 0x43, 0x68,
|
||||
0x42, 0x85, 0x09, 0x85, 0x42, 0x99, 0x5a, 0x92, 0x8c, 0xe9, 0x14, 0x6c,
|
||||
0xf3, 0x06, 0x50, 0x2a, 0x6d, 0xd8, 0xd5, 0x06, 0xdc, 0x8c, 0x4d, 0x60,
|
||||
0x84, 0x98, 0x6a, 0xf6, 0x30, 0xb9, 0x06, 0xe3, 0xcd, 0x75, 0xd7, 0xaa,
|
||||
0xbc, 0x56, 0x8d, 0x2f, 0x6b, 0x0d, 0x2e, 0x26, 0x40, 0x86, 0x08, 0xf5,
|
||||
0xc6, 0xee, 0x12, 0xd6, 0x06, 0x59, 0x7f, 0xa6, 0xac, 0x3f, 0xef, 0x15,
|
||||
0xd6, 0x20, 0x55, 0x21, 0xa9, 0x29, 0xdb, 0xf4, 0x1f, 0xa6, 0x79, 0x3c,
|
||||
0x13, 0xf0, 0x32, 0x7f, 0x25, 0x27, 0x7a, 0x64, 0xe1, 0x64, 0x3b, 0x86,
|
||||
0x14, 0x4e, 0xfd, 0x29, 0xbc, 0x6e, 0x9f, 0x1b, 0xaa, 0xdf, 0xe3, 0x77,
|
||||
0xd7, 0xb8, 0x7f, 0x61, 0x2f, 0xbc, 0xea, 0xfe, 0x18, 0xc6, 0x54, 0x91,
|
||||
0x85, 0xaa, 0x55, 0xa7, 0xca, 0x00, 0x8f, 0x56, 0xaf, 0xa8, 0x49, 0x02,
|
||||
0xcb, 0xbe, 0x20, 0x5a
|
||||
};
|
@ -1,46 +1,12 @@
|
||||
@---------------------------------------------------------------------------------
|
||||
.section ".init"
|
||||
.global _start
|
||||
.global dsiMode
|
||||
.global language
|
||||
.global sdAccess
|
||||
.global scfgUnlock
|
||||
.global twlMode
|
||||
.global twlClock
|
||||
.global boostVram
|
||||
.global soundFreq
|
||||
.global extendRam
|
||||
.global debugMode
|
||||
@---------------------------------------------------------------------------------
|
||||
.align 4
|
||||
.arm
|
||||
@---------------------------------------------------------------------------------
|
||||
_start:
|
||||
@---------------------------------------------------------------------------------
|
||||
b startUp
|
||||
|
||||
dsiMode:
|
||||
.word 0x00000000
|
||||
language:
|
||||
.word 0x00000000
|
||||
sdAccess:
|
||||
.word 0x00000000
|
||||
scfgUnlock:
|
||||
.word 0x00000000
|
||||
twlMode:
|
||||
.word 0x00000000
|
||||
twlClock:
|
||||
.word 0x00000000
|
||||
boostVram:
|
||||
.word 0x00000000
|
||||
soundFreq:
|
||||
.word 0x00000000
|
||||
extendRam:
|
||||
.word 0x00000000
|
||||
debugMode:
|
||||
.word 0x00000000
|
||||
|
||||
startUp:
|
||||
mov r0, #0x04000000 @ IME = 0;
|
||||
add r0, r0, #0x208
|
||||
strh r0, [r0]
|
||||
@ -70,7 +36,7 @@ startUp:
|
||||
bl CopyMem
|
||||
|
||||
@ Start ARM9 binary
|
||||
ldr r0, =0x02FFFE24
|
||||
ldr r0, =0x027FFE24
|
||||
ldr r1, =_arm9_start
|
||||
str r1, [r0]
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
main.arm7.c
|
||||
|
||||
|
||||
By Michael Chisholm (Chishm)
|
||||
|
||||
All resetMemory and startBinary functions are based
|
||||
|
||||
All resetMemory and startBinary functions are based
|
||||
on the MultiNDS loader by Darkain.
|
||||
Original source available at:
|
||||
http://cvs.sourceforge.net/viewcvs.py/ndslib/ndslib/examples/loader/boot/main.cpp
|
||||
@ -30,237 +30,60 @@
|
||||
# define ARM7
|
||||
#endif
|
||||
#include <nds/ndstypes.h>
|
||||
#include <nds/arm7/codec.h>
|
||||
#include <nds/system.h>
|
||||
#include <nds/interrupts.h>
|
||||
#include <nds/timers.h>
|
||||
#include <nds/dma.h>
|
||||
#include <nds/arm7/audio.h>
|
||||
#include <nds/arm7/codec.h>
|
||||
#include <nds/memory.h>
|
||||
#include <nds/ipc.h>
|
||||
#include <string.h>
|
||||
|
||||
// #include <nds/registers_alt.h>
|
||||
// #include <nds/memory.h>
|
||||
// #include <nds/card.h>
|
||||
// #include <stdio.h>
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#include "common.h"
|
||||
#include "tonccpy.h"
|
||||
#include "read_card.h"
|
||||
#include "module_params.h"
|
||||
// #include "cardengine_arm7_bin.h"
|
||||
// #include "hook.h"
|
||||
#include "find.h"
|
||||
#include "tonccpy.h"
|
||||
/*-------------------------------------------------------------------------
|
||||
External functions
|
||||
--------------------------------------------------------------------------*/
|
||||
extern void arm7_clearmem (void* loc, size_t len);
|
||||
extern void arm7_reset (void);
|
||||
|
||||
static int language = -1;
|
||||
static bool scfgUnlock = false;
|
||||
static bool twlMode = false;
|
||||
static bool twlCLK = false;
|
||||
static bool debugMode = false;
|
||||
|
||||
extern u32 dsiMode;
|
||||
extern u32 language;
|
||||
extern u32 sdAccess;
|
||||
extern u32 scfgUnlock;
|
||||
extern u32 twlMode;
|
||||
extern u32 twlClock;
|
||||
extern u32 boostVram;
|
||||
extern u32 soundFreq;
|
||||
extern u32 extendRam;
|
||||
extern u32 debugMode;
|
||||
static bool useTwlCfg = false;
|
||||
static int twlCfgLang = 0;
|
||||
|
||||
bool useTwlCfg = false;
|
||||
int twlCfgLang = 0;
|
||||
|
||||
// bool gameSoftReset = false;
|
||||
|
||||
void arm7_clearmem (void* loc, size_t len);
|
||||
extern void ensureBinaryDecompressed(const tNDSHeader* ndsHeader, module_params_t* moduleParams);
|
||||
|
||||
// static const u32 cheatDataEndSignature[2] = {0xCF000000, 0x00000000};
|
||||
|
||||
// Module params
|
||||
static const u32 moduleParamsSignature[2] = {0xDEC00621, 0x2106C0DE};
|
||||
|
||||
static u32 chipID;
|
||||
|
||||
static module_params_t* moduleParams;
|
||||
|
||||
u32* findModuleParamsOffset(const tNDSHeader* ndsHeader) {
|
||||
//dbg_printf("findModuleParamsOffset:\n");
|
||||
|
||||
u32* moduleParamsOffset = findOffset(
|
||||
(u32*)ndsHeader->arm9destination, ndsHeader->arm9binarySize,
|
||||
moduleParamsSignature, 2
|
||||
);
|
||||
return moduleParamsOffset;
|
||||
}
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// Important things
|
||||
#define NDS_HEADER 0x027FFE00
|
||||
#define NDS_HEADER_SDK5 0x02FFFE00 // __NDSHeader
|
||||
#define NDS_HEADER_POKEMON 0x027FF000
|
||||
#define NDS_HEADER 0x027FFE00
|
||||
#define NDS_HEADER_POKEMON 0x027FF000
|
||||
#define TWL_HEADER 0x027FE000
|
||||
#define TMP_HEADER 0x027FC000
|
||||
tNDSHeader* ndsHeader;
|
||||
tNDSHeader* tmpHeader;
|
||||
|
||||
#define DSI_HEADER 0x027FE000
|
||||
#define DSI_HEADER_SDK5 0x02FFE000 // __DSiHeader
|
||||
#define REG_GPIO_WIFI *(vu16*)0x4004C04
|
||||
|
||||
// #define ENGINE_LOCATION_ARM7 0x037C0000
|
||||
static u32 chipID;
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// Used for debugging purposes
|
||||
/*static void errorOutput (u32 code) {
|
||||
// Wait until the ARM9 is ready
|
||||
while (arm9_stateFlag != ARM9_READY);
|
||||
// Set the error code, then tell ARM9 to display it
|
||||
arm9_errorCode = code;
|
||||
arm9_errorClearBG = true;
|
||||
arm9_stateFlag = ARM9_DISPERR;
|
||||
// Stop
|
||||
while(1);
|
||||
}*/
|
||||
|
||||
|
||||
static void debugOutput (u32 code) {
|
||||
// Wait until the ARM9 is ready
|
||||
while (arm9_stateFlag != ARM9_READY);
|
||||
// Set the error code, then tell ARM9 to display it
|
||||
arm9_errorCode = code;
|
||||
arm9_errorClearBG = debugMode;
|
||||
arm9_stateFlag = ARM9_DISPERR;
|
||||
// Wait for completion
|
||||
while (arm9_stateFlag != ARM9_READY);
|
||||
}
|
||||
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// Firmware stuff
|
||||
|
||||
static void my_readUserSettings(tNDSHeader* ndsHeader) {
|
||||
PERSONAL_DATA slot1;
|
||||
PERSONAL_DATA slot2;
|
||||
|
||||
short slot1count, slot2count; //u8
|
||||
short slot1CRC, slot2CRC;
|
||||
|
||||
u32 userSettingsBase;
|
||||
|
||||
// Get settings location
|
||||
readFirmware(0x20, &userSettingsBase, 2);
|
||||
|
||||
u32 slot1Address = userSettingsBase * 8;
|
||||
u32 slot2Address = userSettingsBase * 8 + 0x100;
|
||||
|
||||
// Reload DS Firmware settings
|
||||
readFirmware(slot1Address, &slot1, sizeof(PERSONAL_DATA)); //readFirmware(slot1Address, personalData, 0x70);
|
||||
readFirmware(slot2Address, &slot2, sizeof(PERSONAL_DATA)); //readFirmware(slot2Address, personalData, 0x70);
|
||||
readFirmware(slot1Address + 0x70, &slot1count, 2); //readFirmware(slot1Address + 0x70, &slot1count, 1);
|
||||
readFirmware(slot2Address + 0x70, &slot2count, 2); //readFirmware(slot1Address + 0x70, &slot2count, 1);
|
||||
readFirmware(slot1Address + 0x72, &slot1CRC, 2);
|
||||
readFirmware(slot2Address + 0x72, &slot2CRC, 2);
|
||||
|
||||
// Default to slot 1 user settings
|
||||
void *currentSettings = &slot1;
|
||||
|
||||
short calc1CRC = swiCRC16(0xFFFF, &slot1, sizeof(PERSONAL_DATA));
|
||||
short calc2CRC = swiCRC16(0xFFFF, &slot2, sizeof(PERSONAL_DATA));
|
||||
|
||||
// Bail out if neither slot is valid
|
||||
if (calc1CRC != slot1CRC && calc2CRC != slot2CRC) { return; }
|
||||
|
||||
// If both slots are valid pick the most recent
|
||||
if (calc1CRC == slot1CRC && calc2CRC == slot2CRC) {
|
||||
currentSettings = (slot2count == ((slot1count + 1) & 0x7f) ? &slot2 : &slot1); //if ((slot1count & 0x7F) == ((slot2count + 1) & 0x7F)) {
|
||||
} else {
|
||||
if (calc2CRC == slot2CRC) { currentSettings = &slot2; }
|
||||
static tNDSHeader* loadHeader(tDSiHeader* twlHeaderTemp) {
|
||||
tNDSHeader* ntrHeader = (tNDSHeader*)NDS_HEADER;
|
||||
*ntrHeader = twlHeaderTemp->ndshdr;
|
||||
if (ntrHeader->unitCode > 0) {
|
||||
tDSiHeader* dsiHeader = (tDSiHeader*)TWL_HEADER; // __DSiHeader
|
||||
*dsiHeader = *twlHeaderTemp;
|
||||
}
|
||||
|
||||
PERSONAL_DATA* personalData = (PERSONAL_DATA*)((u32)__NDSHeader - (u32)ndsHeader + (u32)PersonalData); //(u8*)((u32)ndsHeader - 0x180)
|
||||
|
||||
tonccpy(PersonalData, currentSettings, sizeof(PERSONAL_DATA));
|
||||
|
||||
if (useTwlCfg && (language == 0xFF || language == -1)) { language = twlCfgLang; }
|
||||
|
||||
if (language >= 0 && language <= 7) {
|
||||
// Change language
|
||||
personalData->language = language; //*(u8*)((u32)ndsHeader - 0x11C) = language;
|
||||
}
|
||||
|
||||
if (personalData->language != 6 && ndsHeader->reserved1[8] == 0x80) {
|
||||
ndsHeader->reserved1[8] = 0; // Patch iQue game to be region-free
|
||||
ndsHeader->headerCRC16 = swiCRC16(0xFFFF, ndsHeader, 0x15E); // Fix CRC
|
||||
}
|
||||
}
|
||||
|
||||
void memset_addrs_arm7(u32 start, u32 end) { toncset((u32*)start, 0, ((int)end - (int)start)); }
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
arm7_resetMemory
|
||||
Clears all of the NDS's RAM that is visible to the ARM7
|
||||
Written by Darkain.
|
||||
Modified by Chishm:
|
||||
* Added STMIA clear mem loop
|
||||
--------------------------------------------------------------------------*/
|
||||
void arm7_resetMemory (void) {
|
||||
int i, reg;
|
||||
|
||||
REG_IME = 0;
|
||||
|
||||
for (i=0; i<16; i++) {
|
||||
SCHANNEL_CR(i) = 0;
|
||||
SCHANNEL_TIMER(i) = 0;
|
||||
SCHANNEL_SOURCE(i) = 0;
|
||||
SCHANNEL_LENGTH(i) = 0;
|
||||
}
|
||||
REG_SOUNDCNT = 0;
|
||||
|
||||
// Clear out ARM7 DMA channels and timers
|
||||
for (i=0; i<4; i++) {
|
||||
DMA_CR(i) = 0;
|
||||
DMA_SRC(i) = 0;
|
||||
DMA_DEST(i) = 0;
|
||||
TIMER_CR(i) = 0;
|
||||
TIMER_DATA(i) = 0;
|
||||
for(reg=0; reg<0x1c; reg+=4)*((u32*)(0x04004104 + ((i*0x1c)+reg))) = 0; //Reset NDMA.
|
||||
}
|
||||
|
||||
// Clear out FIFO
|
||||
REG_IPC_SYNC = 0;
|
||||
REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR;
|
||||
REG_IPC_FIFO_CR = 0;
|
||||
|
||||
// clear IWRAM - 037F:8000 to 0380:FFFF, total 96KiB
|
||||
toncset ((void*)0x037F8000, 0, 96*1024);
|
||||
// arm7_clearmem ((void*)0x037F8000, 96*1024);
|
||||
|
||||
memset_addrs_arm7(0x03000000, 0x0380FFC0);
|
||||
memset_addrs_arm7(0x0380FFD0, 0x03800000 + 0x10000);
|
||||
|
||||
// clear most of EXRAM - except before 0x023F0000, which has the cheat data
|
||||
toncset ((void*)0x02004000, 0, 0x3EC000);
|
||||
|
||||
|
||||
// clear more of EXRAM, skipping the cheat data section
|
||||
toncset ((void*)0x023F8000, 0, 0x6000);
|
||||
|
||||
|
||||
// clear last part of EXRAM
|
||||
toncset ((void*)0x02400000, 0, 0xC00000);
|
||||
|
||||
|
||||
REG_IE = 0;
|
||||
REG_IF = ~0;
|
||||
REG_AUXIE = 0;
|
||||
REG_AUXIF = ~0;
|
||||
(*(vu32*)(0x04000000-4)) = 0; //IRQ_HANDLER ARM7 version
|
||||
(*(vu32*)(0x04000000-8)) = ~0; //VBLANK_INTR_WAIT_FLAGS, ARM7 version
|
||||
REG_POWERCNT = 1; //turn off power to stuffs
|
||||
|
||||
// useTwlCfg = (dsiMode && (*(u8*)0x02000400 & 0x0F) && (*(u8*)0x02000404 == 0));
|
||||
useTwlCfg = (dsiMode && (*(u8*)0x02000400 & 0x0F) && (*(u8*)0x02000401 == 0) && (*(u8*)0x02000402 == 0) && (*(u8*)0x02000404 == 0));
|
||||
twlCfgLang = *(u8*)0x02000406;
|
||||
|
||||
// Load FW header
|
||||
//arm7_readFirmware((u32)0x000000, (u8*)0x027FF830, 0x20);
|
||||
//readFirmware((u32)0x000000, (u8*)0x027FF830, 0x20);
|
||||
return ntrHeader;
|
||||
}
|
||||
|
||||
static void NDSTouchscreenMode(void) {
|
||||
@ -494,28 +317,189 @@ static void NDSTouchscreenMode(void) {
|
||||
writePowerManagement(PM_CONTROL_REG, 0x0D); //*(unsigned char*)0x40001C2 = 0x00, 0x0D; // PWR[0]=0Dh ;<-- also part of TSC !
|
||||
}
|
||||
|
||||
// SDK 5
|
||||
static bool ROMsupportsDSiMode(const tNDSHeader* ndsHeader) { return (ndsHeader->unitCode > 0); }
|
||||
const char* getRomTid(const tNDSHeader* ndsHeader) {
|
||||
static char romTid[5];
|
||||
strncpy(romTid, ndsHeader->gameCode, 4);
|
||||
romTid[4] = '\0';
|
||||
return romTid;
|
||||
}
|
||||
|
||||
// SDK 5
|
||||
static bool ROMisDSiEnhanced(const tNDSHeader* ndsHeader) { return (ndsHeader->unitCode == 0x02); }
|
||||
static void errorOutput (u32 code, bool isError) {
|
||||
arm9_errorCode = code;
|
||||
if (isError) {
|
||||
ipcSendState(ARM7_ERR);
|
||||
while(1); // Stop
|
||||
}
|
||||
}
|
||||
|
||||
// SDK 5
|
||||
static bool ROMisDSiExclusive(const tNDSHeader* ndsHeader) { return (ndsHeader->unitCode == 0x03); }
|
||||
static void arm7_readFirmware(tNDSHeader* ndsHeader) {
|
||||
PERSONAL_DATA slot1;
|
||||
PERSONAL_DATA slot2;
|
||||
|
||||
int arm7_loadBinary (const tDSiHeader* dsiHeaderTemp) {
|
||||
u32 errorCode;
|
||||
short slot1count, slot2count; //u8
|
||||
short slot1CRC, slot2CRC;
|
||||
|
||||
u32 userSettingsBase;
|
||||
|
||||
// Get settings location
|
||||
readFirmware(0x20, &userSettingsBase, 2);
|
||||
|
||||
u32 slot1Address = userSettingsBase * 8;
|
||||
u32 slot2Address = userSettingsBase * 8 + 0x100;
|
||||
|
||||
// Reload DS Firmware settings
|
||||
readFirmware(slot1Address, &slot1, sizeof(PERSONAL_DATA)); //readFirmware(slot1Address, personalData, 0x70);
|
||||
readFirmware(slot2Address, &slot2, sizeof(PERSONAL_DATA)); //readFirmware(slot2Address, personalData, 0x70);
|
||||
readFirmware(slot1Address + 0x70, &slot1count, 2); //readFirmware(slot1Address + 0x70, &slot1count, 1);
|
||||
readFirmware(slot2Address + 0x70, &slot2count, 2); //readFirmware(slot1Address + 0x70, &slot2count, 1);
|
||||
readFirmware(slot1Address + 0x72, &slot1CRC, 2);
|
||||
readFirmware(slot2Address + 0x72, &slot2CRC, 2);
|
||||
|
||||
// Default to slot 1 user settings
|
||||
void *currentSettings = &slot1;
|
||||
|
||||
short calc1CRC = swiCRC16(0xFFFF, &slot1, sizeof(PERSONAL_DATA));
|
||||
short calc2CRC = swiCRC16(0xFFFF, &slot2, sizeof(PERSONAL_DATA));
|
||||
|
||||
// Bail out if neither slot is valid
|
||||
if (calc1CRC != slot1CRC && calc2CRC != slot2CRC) { return; }
|
||||
|
||||
// If both slots are valid pick the most recent
|
||||
if (calc1CRC == slot1CRC && calc2CRC == slot2CRC) {
|
||||
currentSettings = (slot2count == ((slot1count + 1) & 0x7f) ? &slot2 : &slot1); //if ((slot1count & 0x7F) == ((slot2count + 1) & 0x7F)) {
|
||||
} else {
|
||||
if (calc2CRC == slot2CRC) { currentSettings = &slot2; }
|
||||
}
|
||||
|
||||
PERSONAL_DATA* personalData = (PERSONAL_DATA*)((u32)__NDSHeader - (u32)ndsHeader + (u32)PersonalData); //(u8*)((u32)ndsHeader - 0x180)
|
||||
|
||||
tonccpy(PersonalData, currentSettings, sizeof(PERSONAL_DATA));
|
||||
|
||||
if (useTwlCfg && (language == 0xFF || language == -1)) { language = twlCfgLang; }
|
||||
|
||||
if (language >= 0 && language <= 7) {
|
||||
// Change language
|
||||
personalData->language = language; //*(u8*)((u32)ndsHeader - 0x11C) = language;
|
||||
}
|
||||
|
||||
if (personalData->language != 6 && ndsHeader->reserved1[8] == 0x80) {
|
||||
ndsHeader->reserved1[8] = 0; // Patch iQue game to be region-free
|
||||
ndsHeader->headerCRC16 = swiCRC16(0xFFFF, ndsHeader, 0x15E); // Fix CRC
|
||||
}
|
||||
}
|
||||
|
||||
static void arm7_resetMemory (void) {
|
||||
int i, reg;
|
||||
|
||||
REG_IME = 0;
|
||||
|
||||
for (i=0; i<16; i++) {
|
||||
SCHANNEL_CR(i) = 0;
|
||||
SCHANNEL_TIMER(i) = 0;
|
||||
SCHANNEL_SOURCE(i) = 0;
|
||||
SCHANNEL_LENGTH(i) = 0;
|
||||
}
|
||||
REG_SOUNDCNT = 0;
|
||||
|
||||
// Clear out ARM7 DMA channels and timers
|
||||
for (i=0; i<4; i++) {
|
||||
DMA_CR(i) = 0;
|
||||
DMA_SRC(i) = 0;
|
||||
DMA_DEST(i) = 0;
|
||||
TIMER_CR(i) = 0;
|
||||
TIMER_DATA(i) = 0;
|
||||
for(reg=0; reg<0x1c; reg+=4)*((u32*)(0x04004104 + ((i*0x1c)+reg))) = 0; //Reset NDMA.
|
||||
}
|
||||
|
||||
// Clear out FIFO
|
||||
REG_IPC_SYNC = 0;
|
||||
REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR;
|
||||
REG_IPC_FIFO_CR = 0;
|
||||
|
||||
// clear IWRAM - 037F:8000 to 0380:FFFF, total 96KiB
|
||||
arm7_clearmem ((void*)0x037F8000, 96*1024);
|
||||
|
||||
// clear most of EXRAM - except after 0x022FD800, which has the ARM9 code
|
||||
arm7_clearmem ((void*)0x02000000, 0x002FD800);
|
||||
|
||||
// clear last part of EXRAM, skipping the ARM9's section
|
||||
arm7_clearmem ((void*)0x023FE000, 0x2000);
|
||||
|
||||
// Init card
|
||||
errorCode = cardInit((sNDSHeaderExt*)dsiHeaderTemp, &chipID);
|
||||
if (errorCode) { return errorCode; }
|
||||
// Clear tmp header region previously used by custom struct
|
||||
arm7_clearmem ((void*)TMP_HEADER, 0x160);
|
||||
|
||||
REG_IE = 0;
|
||||
REG_IF = ~0;
|
||||
REG_AUXIE = 0;
|
||||
REG_AUXIF = ~0;
|
||||
|
||||
(*(vu32*)(0x04000000-4)) = 0; //IRQ_HANDLER ARM7 version
|
||||
(*(vu32*)(0x04000000-8)) = ~0; //VBLANK_INTR_WAIT_FLAGS, ARM7 version
|
||||
}
|
||||
|
||||
static void setMemoryAddress(const tNDSHeader* ndsHeader) {
|
||||
if (ndsHeader->unitCode > 0) {
|
||||
copyLoop((u32*)0x027FFA80, (u32*)ndsHeader, 0x160); // Make a duplicate of DS header
|
||||
|
||||
*(u32*)(0x027FA680) = 0x02FD4D80;
|
||||
*(u32*)(0x027FA684) = 0x00000000;
|
||||
*(u32*)(0x027FA688) = 0x00001980;
|
||||
|
||||
*(u32*)(0x027FF00C) = 0x0000007F;
|
||||
*(u32*)(0x027FF010) = 0x550E25B8;
|
||||
*(u32*)(0x027FF014) = 0x02FF4000;
|
||||
|
||||
// Set region flag
|
||||
if (strncmp(getRomTid(ndsHeader)+3, "J", 1) == 0) {
|
||||
*(u8*)(0x027FFD70) = 0;
|
||||
} else if (strncmp(getRomTid(ndsHeader)+3, "E", 1) == 0) {
|
||||
*(u8*)(0x027FFD70) = 1;
|
||||
} else if (strncmp(getRomTid(ndsHeader)+3, "P", 1) == 0) {
|
||||
*(u8*)(0x027FFD70) = 2;
|
||||
} else if (strncmp(getRomTid(ndsHeader)+3, "U", 1) == 0) {
|
||||
*(u8*)(0x027FFD70) = 3;
|
||||
} else if (strncmp(getRomTid(ndsHeader)+3, "C", 1) == 0) {
|
||||
*(u8*)(0x027FFD70) = 4;
|
||||
} else if (strncmp(getRomTid(ndsHeader)+3, "K", 1) == 0) {
|
||||
*(u8*)(0x027FFD70) = 5;
|
||||
}
|
||||
}
|
||||
|
||||
// Set memory values expected by loaded NDS
|
||||
// from NitroHax, thanks to Chism
|
||||
*((u32*)0x027FF800) = chipID; // CurrentCardID
|
||||
*((u32*)0x027FF804) = chipID; // Command10CardID
|
||||
*((u16*)0x027FF808) = ndsHeader->headerCRC16; // Header Checksum, CRC-16 of [000h-15Dh]
|
||||
*((u16*)0x027FF80A) = ndsHeader->secureCRC16; // Secure Area Checksum, CRC-16 of [ [20h]..7FFFh]
|
||||
*((u16*)0x027FF850) = 0x5835;
|
||||
// Copies of above
|
||||
*((u32*)0x027FFC00) = chipID; // CurrentCardID
|
||||
*((u32*)0x027FFC04) = chipID; // Command10CardID
|
||||
*((u16*)0x027FFC08) = ndsHeader->headerCRC16; // Header Checksum, CRC-16 of [000h-15Dh]
|
||||
*((u16*)0x027FFC0A) = ndsHeader->secureCRC16; // Secure Area Checksum, CRC-16 of [ [20h]..7FFFh]
|
||||
*((u16*)0x027FFC10) = 0x5835;
|
||||
*((u16*)0x027FFC40) = 0x01; // Boot Indicator -- EXTREMELY IMPORTANT!!! Thanks to cReDiAr
|
||||
}
|
||||
|
||||
static u32 arm7_loadBinary (void) {
|
||||
u32 errorCode;
|
||||
|
||||
tDSiHeader* twlHeaderTemp = (tDSiHeader*)TMP_HEADER; // Use same region cheat engine goes. Cheat engine will replace this later when it's not needed.
|
||||
|
||||
// Init card
|
||||
errorCode = cardInit((sNDSHeaderExt*)twlHeaderTemp, &chipID);
|
||||
if (errorCode)return errorCode;
|
||||
|
||||
ndsHeader = loadHeader(twlHeaderTemp); // copy twlHeaderTemp to ndsHeader location
|
||||
|
||||
cardRead(ndsHeader->arm9romOffset, (u32*)ndsHeader->arm9destination, ndsHeader->arm9binarySize);
|
||||
cardRead(ndsHeader->arm7romOffset, (u32*)ndsHeader->arm7destination, ndsHeader->arm7binarySize);
|
||||
|
||||
// Fix Pokemon games needing header data.
|
||||
tonccpy((u32*)NDS_HEADER_POKEMON, (u32*)NDS_HEADER, 0x170);
|
||||
copyLoop((u32*)NDS_HEADER_POKEMON, (u32*)NDS_HEADER, 0x170);
|
||||
|
||||
char* romTid = (char*)NDS_HEADER_POKEMON+0xC;
|
||||
if (
|
||||
memcmp(romTid, "ADA", 3) == 0 // Diamond
|
||||
if ( memcpy(romTid, "ADA", 3) == 0 // Diamond
|
||||
|| memcmp(romTid, "APA", 3) == 0 // Pearl
|
||||
|| memcmp(romTid, "CPU", 3) == 0 // Platinum
|
||||
|| memcmp(romTid, "IPK", 3) == 0 // HG
|
||||
@ -523,85 +507,37 @@ int arm7_loadBinary (const tDSiHeader* dsiHeaderTemp) {
|
||||
) {
|
||||
// Make the Pokemon game code ADAJ.
|
||||
const char gameCodePokemon[] = { 'A', 'D', 'A', 'J' };
|
||||
tonccpy((char*)NDS_HEADER_POKEMON+0xC, gameCodePokemon, 4);
|
||||
memcpy((char*)NDS_HEADER_POKEMON+0xC, gameCodePokemon, 4);
|
||||
}
|
||||
|
||||
cardRead(dsiHeaderTemp->ndshdr.arm9romOffset, (u32*)dsiHeaderTemp->ndshdr.arm9destination, dsiHeaderTemp->ndshdr.arm9binarySize);
|
||||
cardRead(dsiHeaderTemp->ndshdr.arm7romOffset, (u32*)dsiHeaderTemp->ndshdr.arm7destination, dsiHeaderTemp->ndshdr.arm7binarySize);
|
||||
|
||||
moduleParams = (module_params_t*)findModuleParamsOffset(&dsiHeaderTemp->ndshdr);
|
||||
|
||||
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
static tNDSHeader* loadHeader(tDSiHeader* dsiHeaderTemp) {
|
||||
tNDSHeader* ndsHeader = (tNDSHeader*)(isSdk5(moduleParams) ? NDS_HEADER_SDK5 : NDS_HEADER);
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// Main function
|
||||
void arm7_main (void) {
|
||||
|
||||
*ndsHeader = dsiHeaderTemp->ndshdr;
|
||||
u32 errorCode;
|
||||
|
||||
if (language != 0xFF)language = (int)tmpData->language;
|
||||
if (tmpData->scfgUnlock > 0x00)scfgUnlock = true;
|
||||
if (tmpData->twlMode > 0x00)twlMode = true;
|
||||
if (tmpData->twlCLK > 0x00)twlCLK = true;
|
||||
if (tmpData->debugMode > 0x00)debugMode = true;
|
||||
|
||||
// Synchronise start
|
||||
while (ipcRecvState() != ARM9_START);
|
||||
ipcSendState(ARM7_START);
|
||||
|
||||
// Wait until ARM9 is ready
|
||||
while (ipcRecvState() != ARM9_READY);
|
||||
|
||||
if (twlMode) {
|
||||
tDSiHeader* dsiHeader = (tDSiHeader*)(isSdk5(moduleParams) ? DSI_HEADER_SDK5 : DSI_HEADER); // __DSiHeader
|
||||
*dsiHeader = *dsiHeaderTemp;
|
||||
}
|
||||
|
||||
return ndsHeader;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
arm7_startBinary
|
||||
Jumps to the ARM7 NDS binary in sync with the display and ARM9
|
||||
Written by Darkain, modified by Chishm.
|
||||
--------------------------------------------------------------------------*/
|
||||
void arm7_startBinary (void) {
|
||||
REG_IME = 0;
|
||||
|
||||
// Get the ARM9 to boot
|
||||
arm9_stateFlag = ARM9_BOOTBIN;
|
||||
|
||||
while(REG_VCOUNT!=191);
|
||||
while(REG_VCOUNT==191);
|
||||
|
||||
// Start ARM7
|
||||
VoidFn arm7code = (VoidFn)ndsHeader->arm7executeAddress;
|
||||
|
||||
arm7code();
|
||||
}
|
||||
|
||||
|
||||
void initMBK() {
|
||||
|
||||
if (twlMode) {
|
||||
// give all DSI WRAM to arm7 at boot
|
||||
// this function have no effect with ARM7 SCFG locked
|
||||
|
||||
// arm7 is master of WRAM-A, arm9 of WRAM-B & C
|
||||
// REG_MBK9=0x0300000F; // Disabled. This write is redundent. Already set as result of MBK settings in DSi Extended header of NTR_Launcher's SRL
|
||||
|
||||
// WRAM-A fully mapped to arm7
|
||||
// *((vu32*)REG_MBK1)=0x8185898D; // same as dsiware
|
||||
|
||||
// WRAM-B fully mapped to arm7 // inverted order
|
||||
// *((vu32*)REG_MBK2)=0x9195999D;
|
||||
// *((vu32*)REG_MBK3)=0x8185898D;
|
||||
|
||||
// WRAM-C fully mapped to arm7 // inverted order
|
||||
// *((vu32*)REG_MBK4)=0x9195999D;
|
||||
// *((vu32*)REG_MBK5)=0x8185898D;
|
||||
|
||||
// WRAM mapped to the 0x3700000 - 0x37FFFFF area
|
||||
// WRAM-A mapped to the 0x37C0000 - 0x37FFFFF area : 256k
|
||||
// REG_MBK6=0x080037C0; // same as dsiware
|
||||
// WRAM-B mapped to the 0x3740000 - 0x37BFFFF area : 512k // why? only 256k real memory is there
|
||||
// REG_MBK7=0x07C03740; // same as dsiware
|
||||
// WRAM-C mapped to the 0x3700000 - 0x373FFFF area : 256k
|
||||
// REG_MBK8=0x07403700; // same as dsiware
|
||||
|
||||
*((vu32*)REG_MBK1)=0x8D898581;
|
||||
*((vu32*)REG_MBK2)=0x8C888480;
|
||||
*((vu32*)REG_MBK3)=0x9C989490;
|
||||
*((vu32*)REG_MBK4)=0x8C888480;
|
||||
*((vu32*)REG_MBK5)=0x9C989490;
|
||||
|
||||
REG_MBK6=0x080037C0;
|
||||
REG_MBK7=0x07C03740;
|
||||
REG_MBK8=0x07403700;
|
||||
@ -611,222 +547,60 @@ void initMBK() {
|
||||
*((vu32*)REG_MBK3)=0x9C989490;
|
||||
*((vu32*)REG_MBK4)=0x8C888480;
|
||||
*((vu32*)REG_MBK5)=0x9C989490;
|
||||
|
||||
REG_MBK6=0x09403900;
|
||||
REG_MBK7=0x09803940;
|
||||
REG_MBK8=0x09C03980;
|
||||
REG_MBK9=0xFCFFFF0F;
|
||||
}
|
||||
}
|
||||
|
||||
errorOutput(ERR_STS_CLR_MEM, false);
|
||||
|
||||
/*void fixFlashcardForDSiMode(void) {
|
||||
if ((memcmp(ndsHeader->gameTitle, "PASS", 4) == 0)
|
||||
&& (memcmp(ndsHeader->gameCode, "ASME", 4) == 0)) // CycloDS Evolution
|
||||
{
|
||||
*(u16*)(0x0200197A) = 0xDF02; // LZ77UnCompReadByCallbackWrite16bit
|
||||
*(u16*)(0x020409FA) = 0xDF02; // LZ77UnCompReadByCallbackWrite16bit
|
||||
}
|
||||
}*/
|
||||
|
||||
void fixDSBrowser(void) {
|
||||
extern void patchMpu(const tNDSHeader* ndsHeader, const module_params_t* moduleParams);
|
||||
// patchMpu(ndsHeader, moduleParams);
|
||||
|
||||
patchMpu((tNDSHeader*)NDS_HEADER, moduleParams);
|
||||
|
||||
toncset((char*)0x02400000, 0xFF, 0xC0);
|
||||
*(u8*)0x024000B2 = 0;
|
||||
*(u8*)0x024000B3 = 0;
|
||||
*(u8*)0x024000B4 = 0;
|
||||
*(u8*)0x024000B5 = 0x24;
|
||||
*(u8*)0x024000B6 = 0x24;
|
||||
*(u8*)0x024000B7 = 0x24;
|
||||
*(u16*)0x024000BE = 0x7FFF;
|
||||
*(u16*)0x024000CE = 0x7FFF;
|
||||
|
||||
// Opera RAM patch (ARM9)
|
||||
*(u32*)0x02003D48 = 0x2400000;
|
||||
*(u32*)0x02003D4C = 0x2400004;
|
||||
|
||||
*(u32*)0x02010FF0 = 0x2400000;
|
||||
*(u32*)0x02010FF4 = 0x24000CE;
|
||||
|
||||
*(u32*)0x020112AC = 0x2400080;
|
||||
|
||||
*(u32*)0x020402BC = 0x24000C2;
|
||||
*(u32*)0x020402C0 = 0x24000C0;
|
||||
*(u32*)0x020402CC = 0x2FFFFFE;
|
||||
*(u32*)0x020402D0 = 0x2800000;
|
||||
*(u32*)0x020402D4 = 0x29FFFFF;
|
||||
*(u32*)0x020402D8 = 0x2BFFFFF;
|
||||
*(u32*)0x020402DC = 0x2FFFFFF;
|
||||
*(u32*)0x020402E0 = 0xD7FFFFF; // ???
|
||||
toncset((char*)0x2800000, 0xFF, 0x800000); // Fill fake MEP with FFs
|
||||
|
||||
// Opera RAM patch (ARM7)
|
||||
*(u32*)0x0238C7BC = 0x2400000;
|
||||
*(u32*)0x0238C7C0 = 0x24000CE;
|
||||
|
||||
//*(u32*)0x0238C950 = 0x2400000;
|
||||
}
|
||||
|
||||
|
||||
static void setMemoryAddress(const tNDSHeader* ndsHeader) {
|
||||
|
||||
if (ROMsupportsDSiMode(ndsHeader)) {
|
||||
// u8* deviceListAddr = (u8*)((u8*)0x02FFE1D4);
|
||||
// tonccpy(deviceListAddr, deviceList_bin, deviceList_bin_len);
|
||||
|
||||
// const char *ndsPath = "nand:/dsiware.nds";
|
||||
// tonccpy(deviceListAddr+0x3C0, ndsPath, sizeof(ndsPath));
|
||||
|
||||
//tonccpy((u32*)0x02FFC000, (u32*)DSI_HEADER_SDK5, 0x1000); // Make a duplicate of DSi header
|
||||
tonccpy((u32*)0x02FFFA80, (u32*)NDS_HEADER_SDK5, 0x160); // Make a duplicate of DS header
|
||||
|
||||
*(u32*)(0x02FFA680) = 0x02FD4D80;
|
||||
*(u32*)(0x02FFA684) = 0x00000000;
|
||||
*(u32*)(0x02FFA688) = 0x00001980;
|
||||
|
||||
*(u32*)(0x02FFF00C) = 0x0000007F;
|
||||
*(u32*)(0x02FFF010) = 0x550E25B8;
|
||||
*(u32*)(0x02FFF014) = 0x02FF4000;
|
||||
}
|
||||
|
||||
// Set memory values expected by loaded NDS
|
||||
// from NitroHax, thanks to Chism
|
||||
*((u32*)(isSdk5(moduleParams) ? 0x02fff800 : 0x027ff800)) = chipID; // CurrentCardID
|
||||
*((u32*)(isSdk5(moduleParams) ? 0x02fff804 : 0x027ff804)) = chipID; // Command10CardID
|
||||
*((u16*)(isSdk5(moduleParams) ? 0x02fff808 : 0x027ff808)) = ndsHeader->headerCRC16; // Header Checksum, CRC-16 of [000h-15Dh]
|
||||
*((u16*)(isSdk5(moduleParams) ? 0x02fff80a : 0x027ff80a)) = ndsHeader->secureCRC16; // Secure Area Checksum, CRC-16 of [ [20h]..7FFFh]
|
||||
|
||||
// Copies of above
|
||||
*((u32*)(isSdk5(moduleParams) ? 0x02fffc00 : 0x027ffc00)) = chipID; // CurrentCardID
|
||||
*((u32*)(isSdk5(moduleParams) ? 0x02fffc04 : 0x027ffc04)) = chipID; // Command10CardID
|
||||
*((u16*)(isSdk5(moduleParams) ? 0x02fffc08 : 0x027ffc08)) = ndsHeader->headerCRC16; // Header Checksum, CRC-16 of [000h-15Dh]
|
||||
*((u16*)(isSdk5(moduleParams) ? 0x02fffc0a : 0x027ffc0a)) = ndsHeader->secureCRC16; // Secure Area Checksum, CRC-16 of [ [20h]..7FFFh]
|
||||
|
||||
*((u16*)(isSdk5(moduleParams) ? 0x02fffc40 : 0x027ffc40)) = 0x1; // Boot Indicator (Booted from card for SDK5) -- EXTREMELY IMPORTANT!!! Thanks to cReDiAr
|
||||
}
|
||||
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// Main function
|
||||
|
||||
void arm7_main (void) {
|
||||
|
||||
initMBK();
|
||||
|
||||
arm9_DebugMode = debugMode;
|
||||
|
||||
int errorCode;
|
||||
|
||||
// Wait for ARM9 to at least start
|
||||
while (arm9_stateFlag < ARM9_START);
|
||||
|
||||
debugOutput (ERR_STS_CLR_MEM);
|
||||
|
||||
ipcSendState(ARM7_MEMCLR);
|
||||
|
||||
// Get ARM7 to clear RAM
|
||||
arm7_resetMemory();
|
||||
arm7_resetMemory();
|
||||
|
||||
tmpHeader = (tNDSHeader*)TMP_HEADER;
|
||||
|
||||
if (!twlMode)REG_SCFG_ROM = 0x703;
|
||||
|
||||
debugOutput (ERR_STS_LOAD_BIN);
|
||||
errorOutput(ERR_STS_LOAD_BIN, false);
|
||||
|
||||
if (!twlMode) { REG_SCFG_ROM = 0x703; }
|
||||
|
||||
tDSiHeader* dsiHeaderTemp = (tDSiHeader*)0x02FFC000;
|
||||
ipcSendState(ARM7_LOADBIN);
|
||||
|
||||
// Load the NDS file
|
||||
errorCode = arm7_loadBinary(dsiHeaderTemp);
|
||||
if (errorCode) { debugOutput(errorCode); }
|
||||
errorCode = arm7_loadBinary();
|
||||
if (errorCode)errorOutput(errorCode, true);
|
||||
|
||||
// Override some settings depending on if DSi Enhanced cart or DSi Exclusive cart is inserted
|
||||
if (ROMisDSiEnhanced(&dsiHeaderTemp->ndshdr)) { extendRam = true; } // Required for TWL carts to boot properly. Disabled by default for NTR carts to allow WoodR4 to operate correctly.
|
||||
errorOutput(ERR_STS_STARTBIN, false);
|
||||
|
||||
tonccpy((u32*)0x023FF000, (u32*)0x027FF000, 0x1000);
|
||||
|
||||
arm7_readFirmware(ndsHeader); // Header has to be loaded first
|
||||
|
||||
if (ROMisDSiExclusive(&dsiHeaderTemp->ndshdr)) {
|
||||
twlMode = true;
|
||||
dsiMode = true;
|
||||
// dsiModeConfirmed = true;
|
||||
twlClock = true;
|
||||
extendRam = true;
|
||||
boostVram = true;
|
||||
}
|
||||
|
||||
/*if (dsiMode) {
|
||||
if (twlMode == 2) {
|
||||
dsiModeConfirmed = twlMode;
|
||||
} else {
|
||||
dsiModeConfirmed = twlMode && ROMsupportsDSiMode(&dsiHeaderTemp->ndshdr);
|
||||
}
|
||||
}*/
|
||||
|
||||
if (twlMode) {
|
||||
if (dsiHeaderTemp->arm9ibinarySize > 0) {
|
||||
cardRead((u32)dsiHeaderTemp->arm9iromOffset, (u32*)dsiHeaderTemp->arm9idestination, dsiHeaderTemp->arm9ibinarySize);
|
||||
}
|
||||
if (dsiHeaderTemp->arm7ibinarySize > 0) {
|
||||
cardRead((u32)dsiHeaderTemp->arm7iromOffset, (u32*)dsiHeaderTemp->arm7idestination, dsiHeaderTemp->arm7ibinarySize);
|
||||
REG_SCFG_EXT = 0x92FBFB06;
|
||||
} else {
|
||||
if (cdcReadReg(CDC_SOUND, 0x22) == 0xF0) {
|
||||
// Switch touch mode to NTR
|
||||
*(u16*)0x4004700 = 0x800F;
|
||||
NDSTouchscreenMode();
|
||||
*(u16*)0x4000500 = 0x807F;
|
||||
}
|
||||
REG_GPIO_WIFI |= BIT(8); // Old NDS-Wifi mode
|
||||
REG_SCFG_EXT = 0x92A00000;
|
||||
}
|
||||
|
||||
ndsHeader = loadHeader(dsiHeaderTemp);
|
||||
|
||||
// if (*(u32*)(NDS_HEADER+0xC) == 0x50524255) { fixDSBrowser(); }
|
||||
bool isDSBrowser = (memcmp(ndsHeader->gameCode, "UBRP", 4) == 0);
|
||||
|
||||
bool arm9_extendedMemory = (twlMode || isDSBrowser);
|
||||
|
||||
if (isDSBrowser) { arm9_ExtendRam = true; }
|
||||
|
||||
if (!arm9_extendedMemory) { tonccpy((u32*)0x023FF000, (u32*)(isSdk5(moduleParams) ? 0x02FFF000 : 0x027FF000), 0x1000); }
|
||||
|
||||
my_readUserSettings(ndsHeader); // Header has to be loaded first
|
||||
|
||||
if (!twlMode) {
|
||||
NDSTouchscreenMode();
|
||||
*(u16*)0x4000500 = 0x807F;
|
||||
}
|
||||
|
||||
if (isDSBrowser) { fixDSBrowser(); }
|
||||
/*if ((*(u32*)(NDS_HEADER+0xC) & 0x00FFFFFF) == 0x52544E // Download Play ROMs
|
||||
|| (*(u32*)(NDS_HEADER+0xC) & 0x00FFFFFF) == 0x4D5341 // Super Mario 64 DS
|
||||
|| (*(u32*)(NDS_HEADER+0xC) & 0x00FFFFFF) == 0x434D41 // Mario Kart DS
|
||||
|| (*(u32*)(NDS_HEADER+0xC) & 0x00FFFFFF) == 0x443241 // New Super Mario Bros.
|
||||
|| (*(u32*)(NDS_HEADER+0xC) & 0x00FFFFFF) == 0x5A5241 // Rockman ZX/MegaMan ZX
|
||||
|| (*(u32*)(NDS_HEADER+0xC) & 0x00FFFFFF) == 0x574B41 // Kirby Squeak Squad/Mouse Attack
|
||||
|| (*(u32*)(NDS_HEADER+0xC) & 0x00FFFFFF) == 0x585A59 // Rockman ZX Advent/MegaMan ZX Advent
|
||||
|| (*(u32*)(NDS_HEADER+0xC) & 0x00FFFFFF) == 0x5A3642) // Rockman Zero Collection/MegaMan Zero Collection
|
||||
{
|
||||
gameSoftReset = true;
|
||||
}*/
|
||||
|
||||
toncset ((void*)0x023F0000, 0, 0x8000); // Clear cheat data from main memory
|
||||
|
||||
debugOutput (ERR_STS_START);
|
||||
|
||||
arm9_dsiModeConfirmed = twlMode;
|
||||
arm9_TWLClockSpeeds = twlClock;
|
||||
arm9_boostVram = boostVram;
|
||||
arm9_scfgUnlock = scfgUnlock;
|
||||
arm9_ExtendRam = extendRam;
|
||||
|
||||
if (twlClock) {
|
||||
// if (!sdAccess) { REG_SCFG_CLK = 0x0186; } else { REG_SCFG_CLK = 0x0187; }
|
||||
REG_SCFG_CLK = 0x0185;
|
||||
} else {
|
||||
// if (!sdAccess) { REG_SCFG_CLK = 0x0180; } else { REG_SCFG_CLK = 0x0181; }
|
||||
REG_SCFG_CLK = 0x0101;
|
||||
}
|
||||
|
||||
if (twlMode) { REG_SCFG_EXT = 0x92FBFB06; } else { REG_SCFG_EXT = 0x92A00000; }
|
||||
if (twlCLK) { REG_SCFG_CLK = 0x0185; } else { REG_SCFG_CLK = 0x0101; }
|
||||
if (scfgUnlock) { REG_SCFG_EXT |= BIT(18); } else { REG_SCFG_EXT &= ~(1UL << 31); }
|
||||
|
||||
while (arm9_stateFlag != ARM9_READY);
|
||||
arm9_stateFlag = ARM9_SETSCFG;
|
||||
while (arm9_stateFlag != ARM9_READY);
|
||||
|
||||
setMemoryAddress(ndsHeader);
|
||||
|
||||
arm7_startBinary();
|
||||
|
||||
while (1);
|
||||
ipcSendState(ARM7_BOOTBIN);
|
||||
|
||||
// Moved here to prevent interfering with arm9main's new console
|
||||
REG_POWERCNT = 1; //turn off power to stuffs
|
||||
|
||||
arm7_reset();
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
main.arm9.c
|
||||
|
||||
|
||||
By Michael Chisholm (Chishm)
|
||||
|
||||
All resetMemory and startBinary functions are based
|
||||
|
||||
All resetMemory and startBinary functions are based
|
||||
on the MultiNDS loader by Darkain.
|
||||
Original source available at:
|
||||
http://cvs.sourceforge.net/viewcvs.py/ndslib/ndslib/examples/loader/boot/main.cpp
|
||||
@ -37,194 +37,165 @@
|
||||
#include <nds/system.h>
|
||||
#include <nds/ipc.h>
|
||||
|
||||
#include <nds/dma.h>
|
||||
#include <stddef.h> // NULL
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "miniconsole.h"
|
||||
|
||||
tNDSHeader* ndsHeader = NULL;
|
||||
|
||||
// bool dsiModeConfirmed = false;
|
||||
bool arm9_dsiModeConfirmed = false;
|
||||
bool arm9_boostVram = false;
|
||||
bool arm9_scfgUnlock = false;
|
||||
bool arm9_TWLClockSpeeds = false;
|
||||
bool arm9_ExtendRam = false;
|
||||
bool arm9_DebugMode = false;
|
||||
#define TMP_DATA 0x027FC000
|
||||
|
||||
volatile int arm9_stateFlag = ARM9_BOOT;
|
||||
volatile u32 arm9_errorCode = 0xFFFFFFFF;
|
||||
volatile bool arm9_errorClearBG = false;
|
||||
volatile bool consoleDebugMode = false;
|
||||
volatile u32 arm9_BLANK_RAM = 0;
|
||||
volatile u32 defaultFontPalSlot = 0;
|
||||
volatile tLauncherSettings* tmpData = (tLauncherSettings*)TMP_DATA;
|
||||
|
||||
static bool scfgUnlock = false;
|
||||
static bool TWLMODE = false;
|
||||
static bool TWLVRAM = false;
|
||||
static bool TWLCLK = false;
|
||||
static bool debugMode = false;
|
||||
static bool consoleInit = false;
|
||||
|
||||
static char TXT_STATUS[] = "STATUS: ";
|
||||
static char TXT_ERROR[] = "ERROR: ";
|
||||
static char ERRTXT_NONE[] = "NONE";
|
||||
static char ERRTXT_STS_CLRMEM[] = "CLEAR MEMORY";
|
||||
static char ERRTXT_STS_LOAD_BIN[] = "LOAD CART";
|
||||
static char ERRTXT_STS_STARTBIN[] = "START BINARY";
|
||||
static char ERRTXT_STS_START[] = "BOOTLOADER STARTUP";
|
||||
static char ERRTXT_LOAD_NORM[] = "LOAD NORMAL";
|
||||
static char ERRTXT_LOAD_OTHR[] = "LOAD OTHER";
|
||||
static char ERRTXT_SEC_NORM[] = "SECURE NORMAL";
|
||||
static char ERRTXT_SEC_OTHR[] = "SECURE OTHER";
|
||||
static char ERRTXT_LOGO_CRC[] = "LOGO CRC";
|
||||
static char ERRTXT_HEAD_CRC[] = "HEADER CRC";
|
||||
static char NEW_LINE[] = "\n";
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
External functions
|
||||
--------------------------------------------------------------------------*/
|
||||
extern void arm9_clearCache (void);
|
||||
|
||||
void initMBKARM9() {
|
||||
|
||||
if (arm9_dsiModeConfirmed) {
|
||||
// default dsiware settings
|
||||
|
||||
// WRAM-B fully mapped to arm7 // inverted order
|
||||
// *((vu32*)REG_MBK2)=0x9195999D;
|
||||
// *((vu32*)REG_MBK3)=0x8185898D;
|
||||
|
||||
// WRAM-C fully mapped to arm7 // inverted order
|
||||
// *((vu32*)REG_MBK4)=0x9195999D;
|
||||
// *((vu32*)REG_MBK5)=0x8185898D;
|
||||
|
||||
// WRAM-A not mapped (reserved to arm7)
|
||||
// REG_MBK6=0x00000000;
|
||||
// WRAM-B mapped to the 0x3740000 - 0x37BFFFF area : 512k // why? only 256k real memory is there
|
||||
// REG_MBK7=0x07C03740; // same as dsiware
|
||||
// WRAM-C mapped to the 0x3700000 - 0x373FFFF area : 256k
|
||||
// REG_MBK8=0x07403700; // same as dsiware
|
||||
|
||||
// This gets set on arm7
|
||||
// *((vu32*)REG_MBK1)=0x8D898581;
|
||||
// *((vu32*)REG_MBK2)=0x8C888480;
|
||||
// *((vu32*)REG_MBK3)=0x9C989490;
|
||||
// *((vu32*)REG_MBK4)=0x8C888480;
|
||||
// *((vu32*)REG_MBK5)=0x9C989490;
|
||||
|
||||
REG_MBK6=0x00000000;
|
||||
REG_MBK7=0x07C03740;
|
||||
REG_MBK8=0x07403700;
|
||||
REG_MBK9=0x0300000F;
|
||||
} else {
|
||||
// MBK settings for NTR mode games
|
||||
// *((vu32*)REG_MBK1)=0x8D898581;
|
||||
// *((vu32*)REG_MBK2)=0x91898581;
|
||||
// *((vu32*)REG_MBK3)=0x91999591;
|
||||
// *((vu32*)REG_MBK4)=0x91898581;
|
||||
// *((vu32*)REG_MBK5)=0x91999591;
|
||||
|
||||
REG_MBK6=0x00003000;
|
||||
REG_MBK7=0x00003000;
|
||||
REG_MBK8=0x00003000;
|
||||
REG_MBK9=0xFCFFFF0F;
|
||||
}
|
||||
}
|
||||
|
||||
void SetBrightness(u8 screen, s8 bright) {
|
||||
|
||||
u16 mode = 1 << 14;
|
||||
|
||||
if (bright < 0) {
|
||||
mode = 2 << 14;
|
||||
bright = -bright;
|
||||
}
|
||||
|
||||
if (bright > 31) { bright = 31; }
|
||||
|
||||
*(u16*)(0x0400006C + (0x1000 * screen)) = bright + mode;
|
||||
}
|
||||
extern void arm9_reset (void);
|
||||
extern void Print(char *str);
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
arm9_errorOutput
|
||||
Displays an error code on screen.
|
||||
|
||||
Each box is 2 bits, and left-to-right is most-significant bits to least.
|
||||
Red = 00, Yellow = 01, Green = 10, Blue = 11
|
||||
|
||||
Written by Chishm
|
||||
--------------------------------------------------------------------------*/
|
||||
static void arm9_errorOutput (u32 code, bool clearBG) {
|
||||
int i, j, k;
|
||||
u16 colour;
|
||||
|
||||
REG_POWERCNT = (u16)(POWER_LCD | POWER_2D_A);
|
||||
REG_DISPCNT = MODE_FB0;
|
||||
VRAM_A_CR = VRAM_ENABLE;
|
||||
|
||||
if (clearBG) {
|
||||
// Clear display
|
||||
// for (i = 0; i < 256*192; i++) { VRAM_A[i] = 0x0000; }
|
||||
for (i = 0; i < 256*192; i++) { VRAM_A[i] = 0xFFFF; }
|
||||
static void arm9_errorOutput (u32 code) {
|
||||
Print(NEW_LINE);
|
||||
switch (code) {
|
||||
case (ERR_NONE) : {
|
||||
BG_PALETTE_SUB[defaultFontPalSlot] = 0x8360;
|
||||
Print(TXT_STATUS);
|
||||
Print(ERRTXT_NONE);
|
||||
} break;
|
||||
case (ERR_STS_CLR_MEM) : {
|
||||
BG_PALETTE_SUB[defaultFontPalSlot] = 0x8360;
|
||||
Print(TXT_STATUS);
|
||||
Print(ERRTXT_STS_CLRMEM);
|
||||
} break;
|
||||
case (ERR_STS_LOAD_BIN) : {
|
||||
BG_PALETTE_SUB[defaultFontPalSlot] = 0x8360;
|
||||
Print(TXT_STATUS);
|
||||
Print(ERRTXT_STS_LOAD_BIN);
|
||||
} break;
|
||||
case (ERR_STS_STARTBIN) : {
|
||||
BG_PALETTE_SUB[defaultFontPalSlot] = 0x8360;
|
||||
Print(TXT_STATUS);
|
||||
Print(ERRTXT_STS_STARTBIN);
|
||||
} break;
|
||||
case (ERR_STS_START) : {
|
||||
BG_PALETTE_SUB[defaultFontPalSlot] = 0x8360;
|
||||
Print(TXT_STATUS);
|
||||
Print(ERRTXT_STS_START);
|
||||
} break;
|
||||
case (ERR_LOAD_NORM) : {
|
||||
BG_PALETTE_SUB[defaultFontPalSlot] = 0x801B;
|
||||
Print(TXT_ERROR);
|
||||
Print(ERRTXT_LOAD_NORM);
|
||||
} break;
|
||||
case (ERR_LOAD_OTHR) : {
|
||||
BG_PALETTE_SUB[defaultFontPalSlot] = 0x801B;
|
||||
Print(TXT_ERROR);
|
||||
Print(ERRTXT_LOAD_OTHR);
|
||||
} break;
|
||||
case (ERR_SEC_NORM) : {
|
||||
BG_PALETTE_SUB[defaultFontPalSlot] = 0x801B;
|
||||
Print(TXT_ERROR);
|
||||
Print(ERRTXT_SEC_NORM);
|
||||
} break;
|
||||
case (ERR_SEC_OTHR) : {
|
||||
BG_PALETTE_SUB[defaultFontPalSlot] = 0x801B;
|
||||
Print(TXT_ERROR);
|
||||
Print(ERRTXT_SEC_OTHR);
|
||||
} break;
|
||||
case (ERR_LOGO_CRC) : {
|
||||
BG_PALETTE_SUB[defaultFontPalSlot] = 0x801B;
|
||||
Print(TXT_ERROR);
|
||||
Print(ERRTXT_LOGO_CRC);
|
||||
} break;
|
||||
case (ERR_HEAD_CRC) : {
|
||||
BG_PALETTE_SUB[defaultFontPalSlot] = 0x801B;
|
||||
Print(TXT_ERROR);
|
||||
Print(ERRTXT_HEAD_CRC);
|
||||
} break;
|
||||
}
|
||||
|
||||
// Draw boxes of colour, signifying error codes
|
||||
|
||||
if ((code >> 16) != 0) {
|
||||
// high 16 bits
|
||||
for (i = 0; i < 8; i++) { // Pair of bits to use
|
||||
if (((code>>(30-2*i))&3) == 0) {
|
||||
colour = 0x001F; // Red
|
||||
} else if (((code>>(30-2*i))&3) == 1) {
|
||||
colour = 0x03FF; // Yellow
|
||||
} else if (((code>>(30-2*i))&3) == 2) {
|
||||
colour = 0x03E0; // Green
|
||||
} else {
|
||||
colour = 0x7C00; // Blue
|
||||
}
|
||||
for (j = 71; j < 87; j++) { // Row
|
||||
for (k = 32*i+8; k < 32*i+24; k++) { // Column
|
||||
VRAM_A[j*256+k] = colour;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((code >> 8) != 0) {
|
||||
// Low 16 bits
|
||||
for (i = 0; i < 8; i++) { // Pair of bits to use
|
||||
if (((code>>(14-2*i))&3) == 0) {
|
||||
colour = 0x001F; // Red
|
||||
} else if (((code>>(14-2*i))&3) == 1) {
|
||||
colour = 0x03FF; // Yellow
|
||||
} else if (((code>>(14-2*i))&3) == 2) {
|
||||
colour = 0x03E0; // Green
|
||||
} else {
|
||||
colour = 0x7C00; // Blue
|
||||
}
|
||||
for (j = 103; j < 119; j++) { // Row
|
||||
for (k = 32*i+8; k < 32*i+24; k++) { // Column
|
||||
VRAM_A[j*256+k] = colour;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Low 8 bits
|
||||
for (i = 0; i < 4; i++) { // Pair of bits to use
|
||||
if (((code>>(6-2*i))&3) == 0) {
|
||||
colour = 0x001F; // Red
|
||||
} else if (((code>>(6-2*i))&3) == 1) {
|
||||
colour = 0x03FF; // Yellow
|
||||
} else if (((code>>(6-2*i))&3) == 2) {
|
||||
colour = 0x03E0; // Green
|
||||
} else {
|
||||
colour = 0x7C00; // Blue
|
||||
}
|
||||
for (j = 87; j < 103; j++) { // Row
|
||||
for (k = 32*i+72; k < 32*i+88; k++) { // Column
|
||||
VRAM_A[j*256+k] = colour;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
arm9_main
|
||||
Clears the ARM9's icahce and dcache
|
||||
Clears the ARM9's DMA channels and resets video memory
|
||||
Jumps to the ARM9 NDS binary in sync with the display and ARM7
|
||||
Jumps to the ARM9 NDS binary in sync with the ARM7
|
||||
Written by Darkain, modified by Chishm
|
||||
--------------------------------------------------------------------------*/
|
||||
void __attribute__((target("arm"))) arm9_main (void) {
|
||||
|
||||
initMBKARM9();
|
||||
|
||||
void arm9_main (void) {
|
||||
|
||||
register int i;
|
||||
|
||||
if (tmpData->scfgUnlock == 0x01)scfgUnlock = true;
|
||||
if (tmpData->twlMode == 0x01)TWLMODE = true;
|
||||
if (tmpData->twlVRAM == 0x01)TWLVRAM = true;
|
||||
if (tmpData->twlCLK == 0x01)TWLCLK = true;
|
||||
if (tmpData->debugMode == 0x01)debugMode = true;
|
||||
|
||||
if (TWLMODE) {
|
||||
REG_MBK6=0x00000000;
|
||||
REG_MBK7=0x07C03740;
|
||||
REG_MBK8=0x07403700;
|
||||
REG_MBK9=0x0300000F;
|
||||
} else {
|
||||
// MBK settings for NTR mode games
|
||||
REG_MBK6=0x00003000;
|
||||
REG_MBK7=0x00003000;
|
||||
REG_MBK8=0x00003000;
|
||||
REG_MBK9=0xFCFFFF0F;
|
||||
}
|
||||
|
||||
//set shared ram to ARM7
|
||||
WRAM_CR = 0x03;
|
||||
REG_EXMEMCNT = 0xE880;
|
||||
|
||||
arm9_stateFlag = ARM9_START;
|
||||
|
||||
// Disable interrupts
|
||||
REG_IME = 0;
|
||||
REG_IE = 0;
|
||||
REG_IF = ~0;
|
||||
|
||||
|
||||
if (debugMode)arm9_errorCode = ERR_STS_START;
|
||||
|
||||
// Synchronise start
|
||||
ipcSendState(ARM9_START);
|
||||
while (ipcRecvState() != ARM7_START);
|
||||
|
||||
ipcSendState(ARM9_MEMCLR);
|
||||
|
||||
arm9_clearCache();
|
||||
|
||||
@ -232,17 +203,30 @@ void __attribute__((target("arm"))) arm9_main (void) {
|
||||
(*(vu32*)(i+0x00000000)) = 0x00000000; //clear ITCM
|
||||
(*(vu32*)(i+0x00800000)) = 0x00000000; //clear DTCM
|
||||
}
|
||||
|
||||
|
||||
for (i=16*1024; i<32*1024; i+=4) { //second 16KB
|
||||
(*(vu32*)(i+0x00000000)) = 0x00000000; //clear ITCM
|
||||
}
|
||||
|
||||
arm9_stateFlag = ARM9_MEMCLR;
|
||||
|
||||
(*(vu32*)0x00803FFC) = 0; //IRQ_HANDLER ARM9 version
|
||||
(*(vu32*)0x00803FF8) = ~0; //VBLANK_INTR_WAIT_FLAGS ARM9 version
|
||||
|
||||
//clear out ARM9 DMA channels
|
||||
// Clear out FIFO
|
||||
REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR;
|
||||
REG_IPC_FIFO_CR = 0;
|
||||
|
||||
// Blank out VRAM
|
||||
VRAM_A_CR = 0x80;
|
||||
VRAM_B_CR = 0x80;
|
||||
// Don't mess with the VRAM used for execution
|
||||
// VRAM_D_CR = 0x80;
|
||||
VRAM_E_CR = 0x80;
|
||||
VRAM_F_CR = 0x80;
|
||||
VRAM_G_CR = 0x80;
|
||||
VRAM_H_CR = 0x80;
|
||||
VRAM_I_CR = 0x80;
|
||||
|
||||
// Clear out ARM9 DMA channels
|
||||
for (i=0; i<4; i++) {
|
||||
DMA_CR(i) = 0;
|
||||
DMA_SRC(i) = 0;
|
||||
@ -251,88 +235,74 @@ void __attribute__((target("arm"))) arm9_main (void) {
|
||||
TIMER_DATA(i) = 0;
|
||||
}
|
||||
|
||||
// Clear out FIFO
|
||||
REG_IPC_SYNC = 0;
|
||||
REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR;
|
||||
REG_IPC_FIFO_CR = 0;
|
||||
|
||||
VRAM_A_CR = 0x80;
|
||||
VRAM_B_CR = 0x80;
|
||||
VRAM_C_CR = 0x80;
|
||||
// Don't mess with the VRAM used for execution
|
||||
// VRAM_D_CR = 0x80;
|
||||
VRAM_E_CR = 0x80;
|
||||
VRAM_F_CR = 0x80;
|
||||
VRAM_G_CR = 0x80;
|
||||
VRAM_H_CR = 0x80;
|
||||
VRAM_I_CR = 0x80;
|
||||
BG_PALETTE[0] = 0xFFFF;
|
||||
dmaFill((u16*)&arm9_BLANK_RAM, BG_PALETTE+1, (2*1024)-2);
|
||||
dmaFill((u16*)&arm9_BLANK_RAM, OAM, 2*1024);
|
||||
dmaFill((u16*)&arm9_BLANK_RAM, (u16*)0x04000000, 0x56); // Clear main display registers
|
||||
dmaFill((u16*)&arm9_BLANK_RAM, (u16*)0x04001000, 0x56); // Clear sub display registers
|
||||
dmaFill((u16*)&arm9_BLANK_RAM, VRAM_A, 0x20000*3); // Banks A, B, C
|
||||
dmaFill((u16*)&arm9_BLANK_RAM, VRAM_D, 272*1024); // Banks D (excluded), E, F, G, H, I
|
||||
|
||||
REG_DISPSTAT = 0;
|
||||
//videoSetMode(0);
|
||||
//videoSetModeSub(0);
|
||||
VRAM_A_CR = 0;
|
||||
VRAM_B_CR = 0;
|
||||
VRAM_C_CR = 0;
|
||||
// Don't mess with the ARM7's VRAM
|
||||
//VRAM_D_CR = 0;
|
||||
// Don't mess with the VRAM used for execution
|
||||
// VRAM_D_CR = 0;
|
||||
VRAM_E_CR = 0;
|
||||
VRAM_F_CR = 0;
|
||||
VRAM_G_CR = 0;
|
||||
VRAM_H_CR = 0;
|
||||
VRAM_I_CR = 0;
|
||||
REG_POWERCNT = 0x820F;
|
||||
|
||||
BG_PALETTE[0] = 0xFFFF;
|
||||
|
||||
videoSetMode(0);
|
||||
|
||||
dmaFill((void*)&arm9_BLANK_RAM, VRAM_A, 256*1024); // Banks A, B
|
||||
dmaFill((void*)&arm9_BLANK_RAM, VRAM_E, 128*1024); // Banks E, F, G, H, I
|
||||
|
||||
// set ARM9 state to ready and wait for instructions from ARM7
|
||||
ipcSendState(ARM9_READY);
|
||||
while (ipcRecvState() != ARM7_BOOTBIN) {
|
||||
if (ipcRecvState() == ARM7_ERR) {
|
||||
if (!consoleInit) {
|
||||
BG_PALETTE_SUB[0] = RGB15(31,31,31);
|
||||
BG_PALETTE_SUB[255] = RGB15(0,0,0);
|
||||
defaultFontPalSlot = 31;
|
||||
miniconsoleSetWindow(5, 11, 24, 1); // Set console position for debug text if/when needed.
|
||||
consoleInit = true;
|
||||
}
|
||||
arm9_errorOutput (arm9_errorCode);
|
||||
// Halt after displaying error code
|
||||
while(1);
|
||||
} else if ((arm9_errorCode != ERR_NONE) && debugMode) {
|
||||
if (!consoleInit) {
|
||||
BG_PALETTE_SUB[0] = RGB15(31,31,31);
|
||||
BG_PALETTE_SUB[255] = RGB15(0,0,0);
|
||||
defaultFontPalSlot = 31;
|
||||
miniconsoleSetWindow(5, 11, 24, 1); // Set console position for debug text if/when needed.
|
||||
consoleInit = true;
|
||||
}
|
||||
while(REG_VCOUNT!=191); // Add vblank delay. Arm7 can somtimes go through the status codes pretty quick.
|
||||
while(REG_VCOUNT==191);
|
||||
arm9_errorOutput (arm9_errorCode);
|
||||
arm9_errorCode = ERR_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
VRAM_C_CR = 0x80;
|
||||
// BG_PALETTE_SUB[0] = 0xFFFF;
|
||||
dmaFill((void*)&arm9_BLANK_RAM, BG_PALETTE+1, (2*1024)-2);
|
||||
dmaFill((void*)&arm9_BLANK_RAM, OAM, 2*1024);
|
||||
|
||||
*(u16*)0x0400006C |= BIT(14);
|
||||
*(u16*)0x0400006C &= BIT(15);
|
||||
SetBrightness(0, 0);
|
||||
SetBrightness(1, 0);
|
||||
|
||||
// set ARM9 state to ready and wait for it to change again
|
||||
arm9_stateFlag = ARM9_READY;
|
||||
while (arm9_stateFlag != ARM9_BOOTBIN) {
|
||||
if (arm9_stateFlag == ARM9_DISPERR) {
|
||||
// Re-enable for debugging
|
||||
if (arm9_DebugMode) { arm9_errorOutput(arm9_errorCode, arm9_errorClearBG); }
|
||||
if (arm9_stateFlag == ARM9_DISPERR) { arm9_stateFlag = ARM9_READY; }
|
||||
}
|
||||
|
||||
if (arm9_stateFlag == ARM9_SETSCFG) { arm9_stateFlag = ARM9_READY; }
|
||||
}
|
||||
// Clear out display registers
|
||||
vu16 *mainregs = (vu16*)0x04000000;
|
||||
vu16 *subregs = (vu16*)0x04001000;
|
||||
for (i=0; i<43; i++) { mainregs[i] = 0; subregs[i] = 0; }
|
||||
REG_DISPSTAT = 0;
|
||||
VRAM_C_CR = 0;
|
||||
videoSetModeSub(0);
|
||||
REG_POWERCNT = 0x820F;
|
||||
|
||||
VoidFn arm9code = (VoidFn)ndsHeader->arm9executeAddress;
|
||||
|
||||
while(REG_VCOUNT!=191);
|
||||
while(REG_VCOUNT==191);
|
||||
|
||||
REG_SCFG_CLK = 0x80;
|
||||
if (arm9_TWLClockSpeeds) { REG_SCFG_CLK |= BIT(0); }
|
||||
if (arm9_dsiModeConfirmed) {
|
||||
REG_SCFG_EXT = 0x8207F100;
|
||||
if (!TWLCLK)REG_SCFG_CLK = 0x80;
|
||||
if (TWLMODE) {
|
||||
REG_SCFG_EXT = 0x82073100;
|
||||
REG_SCFG_RST = 1;
|
||||
} else {
|
||||
// REG_SCFG_EXT = 0x8200C000;
|
||||
REG_SCFG_EXT=0x82000000;
|
||||
if (arm9_ExtendRam) {
|
||||
REG_SCFG_EXT |= BIT(14);
|
||||
REG_SCFG_EXT |= BIT(15);
|
||||
}
|
||||
// Extended VRAM Access
|
||||
if (arm9_boostVram)REG_SCFG_EXT |= BIT(13);
|
||||
// lock SCFG
|
||||
if (!arm9_scfgUnlock)REG_SCFG_EXT &= ~(1UL << 31);
|
||||
}
|
||||
if (!TWLVRAM)REG_SCFG_EXT &= ~(1UL << 13);
|
||||
if (!scfgUnlock)REG_SCFG_EXT &= ~(1UL << 31);
|
||||
|
||||
// wait for vblank then boot
|
||||
while(REG_VCOUNT!=191);
|
||||
while(REG_VCOUNT==191);
|
||||
|
||||
arm9code();
|
||||
arm9_reset();
|
||||
}
|
||||
|
||||
|
134
BootLoader/source/miniConsole.h
Normal file
134
BootLoader/source/miniConsole.h
Normal file
@ -0,0 +1,134 @@
|
||||
#define ARM9
|
||||
#undef ARM7
|
||||
|
||||
#ifndef MINICONSOLE_H
|
||||
#define MINICONSOLE_H
|
||||
|
||||
#include <nds/memory.h>
|
||||
#include <nds/arm9/background.h>
|
||||
|
||||
static int windowX = 0;
|
||||
static int windowY = 0;
|
||||
static int windowWidth = 32;
|
||||
static int windowHeight = 24;
|
||||
static int consoleWidth = 32;
|
||||
static int tabSize = 3;
|
||||
static int cursorX = 0;
|
||||
static int cursorY = 0;
|
||||
static u16 fontCurPal = 1;
|
||||
static u16* fontBgMap = BG_MAP_RAM_SUB(4);
|
||||
|
||||
static void miniconsoleSetWindow(int x, int y, int width, int height) {
|
||||
windowX = x;
|
||||
windowY = y;
|
||||
windowWidth = width;
|
||||
windowHeight = height;
|
||||
cursorX = 0;
|
||||
cursorY = 0;
|
||||
}
|
||||
|
||||
void miniNewRow() {
|
||||
cursorY ++;
|
||||
if(cursorY >= windowHeight) {
|
||||
int rowCount;
|
||||
int colCount;
|
||||
cursorY --;
|
||||
for(rowCount = 0; rowCount < windowHeight - 1; rowCount++)
|
||||
for(colCount = 0; colCount < windowWidth; colCount++)
|
||||
fontBgMap[(colCount + windowX) + (rowCount + windowY) * consoleWidth] =
|
||||
fontBgMap[(colCount + windowX) + (rowCount + windowY + 1) * consoleWidth];
|
||||
|
||||
for(colCount = 0; colCount < windowWidth; colCount++)
|
||||
fontBgMap[(colCount + windowX) + (rowCount + windowY) * consoleWidth] =
|
||||
(' ');
|
||||
}
|
||||
}
|
||||
|
||||
void miniconsolePrintChar(char c) {
|
||||
if (c==0) return;
|
||||
if(fontBgMap == 0) return;
|
||||
if(cursorX >= windowWidth) { cursorX = 0; miniNewRow(); }
|
||||
switch(c) {
|
||||
case 8:
|
||||
cursorX--;
|
||||
if(cursorX < 0) {
|
||||
if(cursorY > 0) {
|
||||
cursorX = windowX - 1;
|
||||
cursorY--;
|
||||
} else {
|
||||
cursorX = 0;
|
||||
}
|
||||
}
|
||||
fontBgMap[cursorX + windowX + (cursorY + windowY) * consoleWidth] = (u16)c | fontCurPal << 12;
|
||||
break;
|
||||
case 9:
|
||||
cursorX += tabSize - ((cursorX)%(tabSize));
|
||||
break;
|
||||
case 10:
|
||||
miniNewRow(); // fallthrough
|
||||
case 13:
|
||||
cursorX = 0;
|
||||
break;
|
||||
default:
|
||||
fontBgMap[cursorX + windowX + (cursorY + windowY) * consoleWidth] = (u16)c | fontCurPal << 12;
|
||||
++cursorX;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void miniconsoleCls(char mode) {
|
||||
int i = 0;
|
||||
int colTemp,rowTemp;
|
||||
|
||||
switch (mode) {
|
||||
case '[':
|
||||
case '0':
|
||||
{
|
||||
colTemp = cursorX ;
|
||||
rowTemp = cursorY ;
|
||||
|
||||
while(i++ < ((windowHeight * windowWidth) - (rowTemp * consoleWidth + colTemp)))
|
||||
miniconsolePrintChar(' ');
|
||||
|
||||
cursorX = colTemp;
|
||||
cursorY = rowTemp;
|
||||
break;
|
||||
}
|
||||
case '1':
|
||||
{
|
||||
colTemp = cursorX ;
|
||||
rowTemp = cursorY ;
|
||||
|
||||
cursorY = 0;
|
||||
cursorX = 0;
|
||||
|
||||
while (i++ < (rowTemp * windowWidth + colTemp))
|
||||
miniconsolePrintChar(' ');
|
||||
|
||||
cursorX = colTemp;
|
||||
cursorY = rowTemp;
|
||||
break;
|
||||
}
|
||||
case '2':
|
||||
{
|
||||
cursorY = 0;
|
||||
cursorX = 0;
|
||||
|
||||
while(i++ < windowHeight * windowWidth)
|
||||
miniconsolePrintChar(' ');
|
||||
|
||||
cursorY = 0;
|
||||
cursorX = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Print(char *str) {
|
||||
if (str == 0)return;
|
||||
while(*str)miniconsolePrintChar(*(str++));
|
||||
}
|
||||
|
||||
|
||||
#endif // MINICONSOLE_ARM9_H
|
||||
|
@ -1,23 +0,0 @@
|
||||
#ifndef MODULE_PARAMS_H
|
||||
#define MODULE_PARAMS_H
|
||||
|
||||
#include <nds/ndstypes.h>
|
||||
|
||||
typedef struct {
|
||||
u32 auto_load_list_offset;
|
||||
u32 auto_load_list_end;
|
||||
u32 auto_load_start;
|
||||
u32 static_bss_start;
|
||||
u32 static_bss_end;
|
||||
u32 compressed_static_end;
|
||||
u32 sdk_version;
|
||||
u32 nitro_code_be;
|
||||
u32 nitro_code_le;
|
||||
} module_params_t;
|
||||
|
||||
inline bool isSdk5(const module_params_t* moduleParams) {
|
||||
return (moduleParams->sdk_version > 0x5000000);
|
||||
}
|
||||
|
||||
#endif // MODULE_PARAMS_H
|
||||
|
@ -1,139 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------
|
||||
|
||||
memory.h -- Declaration of memory regions
|
||||
|
||||
|
||||
Copyright (C) 2005 Michael Noland (joat) and Jason Rogers (dovoto)
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
---------------------------------------------------------------------------------*/
|
||||
/*! \file ndsheaderbanner.h
|
||||
\brief Defines the Nintendo DS file header and icon/title structs.
|
||||
*/
|
||||
|
||||
#ifndef NDS_HEADER2
|
||||
#define NDS_HEADER2
|
||||
|
||||
#include <nds.h>
|
||||
|
||||
/*!
|
||||
\brief the NDS file header format
|
||||
See gbatek for more info.
|
||||
*/
|
||||
typedef struct {
|
||||
char gameTitle[12]; //!< 12 characters for the game title.
|
||||
char gameCode[4]; //!< 4 characters for the game code.
|
||||
char makercode[2]; //!< identifies the (commercial) developer.
|
||||
u8 unitCode; //!< identifies the required hardware.
|
||||
u8 deviceType; //!< type of device in the game card
|
||||
u8 deviceSize; //!< capacity of the device (1 << n Mbit)
|
||||
u8 reserved1[9];
|
||||
u8 romversion; //!< version of the ROM.
|
||||
u8 flags; //!< bit 2: auto-boot flag.
|
||||
|
||||
u32 arm9romOffset; //!< offset of the arm9 binary in the nds file.
|
||||
u32 arm9executeAddress; //!< adress that should be executed after the binary has been copied.
|
||||
u32 arm9destination; //!< destination address to where the arm9 binary should be copied.
|
||||
u32 arm9binarySize; //!< size of the arm9 binary.
|
||||
|
||||
u32 arm7romOffset; //!< offset of the arm7 binary in the nds file.
|
||||
u32 arm7executeAddress; //!< adress that should be executed after the binary has been copied.
|
||||
u32 arm7destination; //!< destination address to where the arm7 binary should be copied.
|
||||
u32 arm7binarySize; //!< size of the arm7 binary.
|
||||
|
||||
u32 filenameOffset; //!< File Name Table (FNT) offset.
|
||||
u32 filenameSize; //!< File Name Table (FNT) size.
|
||||
u32 fatOffset; //!< File Allocation Table (FAT) offset.
|
||||
u32 fatSize; //!< File Allocation Table (FAT) size.
|
||||
|
||||
u32 arm9overlaySource; //!< File arm9 overlay offset.
|
||||
u32 arm9overlaySize; //!< File arm9 overlay size.
|
||||
u32 arm7overlaySource; //!< File arm7 overlay offset.
|
||||
u32 arm7overlaySize; //!< File arm7 overlay size.
|
||||
|
||||
u32 cardControl13; //!< Port 40001A4h setting for normal commands (used in modes 1 and 3)
|
||||
u32 cardControlBF; //!< Port 40001A4h setting for KEY1 commands (used in mode 2)
|
||||
u32 bannerOffset; //!< offset to the banner with icon and titles etc.
|
||||
|
||||
u16 secureCRC16; //!< Secure Area Checksum, CRC-16.
|
||||
|
||||
u16 readTimeout; //!< Secure Area Loading Timeout.
|
||||
|
||||
u32 unknownRAM1; //!< ARM9 Auto Load List RAM Address (?)
|
||||
u32 unknownRAM2; //!< ARM7 Auto Load List RAM Address (?)
|
||||
|
||||
u32 bfPrime1; //!< Secure Area Disable part 1.
|
||||
u32 bfPrime2; //!< Secure Area Disable part 2.
|
||||
u32 romSize; //!< total size of the ROM.
|
||||
|
||||
u32 headerSize; //!< ROM header size.
|
||||
u32 zeros88[14];
|
||||
u8 gbaLogo[156]; //!< Nintendo logo needed for booting the game.
|
||||
u16 logoCRC16; //!< Nintendo Logo Checksum, CRC-16.
|
||||
u16 headerCRC16; //!< header checksum, CRC-16.
|
||||
|
||||
u32 debugRomSource; //!< debug ROM offset.
|
||||
u32 debugRomSize; //!< debug size.
|
||||
u32 debugRomDestination; //!< debug RAM destination.
|
||||
u32 offset_0x16C; //reserved?
|
||||
|
||||
u8 zero[0x40];
|
||||
u32 region;
|
||||
u32 accessControl;
|
||||
u32 arm7SCFGSettings;
|
||||
u16 dsi_unk1;
|
||||
u8 dsi_unk2;
|
||||
u8 dsi_flags;
|
||||
|
||||
u32 arm9iromOffset; //!< offset of the arm9 binary in the nds file.
|
||||
u32 arm9iexecuteAddress;
|
||||
u32 arm9idestination; //!< destination address to where the arm9 binary should be copied.
|
||||
u32 arm9ibinarySize; //!< size of the arm9 binary.
|
||||
|
||||
u32 arm7iromOffset; //!< offset of the arm7 binary in the nds file.
|
||||
u32 deviceListDestination;
|
||||
u32 arm7idestination; //!< destination address to where the arm7 binary should be copied.
|
||||
u32 arm7ibinarySize; //!< size of the arm7 binary.
|
||||
|
||||
u8 zero2[0x20];
|
||||
|
||||
// 0x200
|
||||
// TODO: More DSi-specific fields.
|
||||
u32 dsi1[0x10/4];
|
||||
u32 twlRomSize;
|
||||
u32 dsi_unk3;
|
||||
u32 dsi_unk4;
|
||||
u32 dsi_unk5;
|
||||
u8 dsi2[0x10];
|
||||
u32 dsi_tid;
|
||||
u32 dsi_tid2;
|
||||
u32 pubSavSize;
|
||||
u32 prvSavSize;
|
||||
u8 dsi3[0x174];
|
||||
} sNDSHeaderExt;
|
||||
|
||||
//#define __NDSHeader ((tNDSHeader *)0x02FFFE00)
|
||||
|
||||
// Make sure the header size is correct.
|
||||
//static_assert(sizeof(sNDSHeaderExt) == 0x3B4, "sizeof(sNDSHeaderExt) is not 0x3B4 bytes");
|
||||
|
||||
#endif // NDS_HEADER2
|
||||
|
@ -1,48 +0,0 @@
|
||||
/*
|
||||
NitroHax -- Cheat tool for the Nintendo DS
|
||||
Copyright (C) 2008 Michael "Chishm" Chisholm
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PATCH_H
|
||||
#define PATCH_H
|
||||
|
||||
//#include <stddef.h>
|
||||
#include <nds/ndstypes.h>
|
||||
#include <nds/memory.h> // tNDSHeader
|
||||
|
||||
#define PAGE_4K (0b01011 << 1)
|
||||
#define PAGE_8K (0b01100 << 1)
|
||||
#define PAGE_16K (0b01101 << 1)
|
||||
#define PAGE_32K (0b01110 << 1)
|
||||
#define PAGE_64K (0b01111 << 1)
|
||||
#define PAGE_128K (0b10000 << 1)
|
||||
#define PAGE_256K (0b10001 << 1)
|
||||
#define PAGE_512K (0b10010 << 1)
|
||||
#define PAGE_1M (0b10011 << 1)
|
||||
#define PAGE_2M (0b10100 << 1)
|
||||
#define PAGE_4M (0b10101 << 1)
|
||||
#define PAGE_8M (0b10110 << 1)
|
||||
#define PAGE_16M (0b10111 << 1)
|
||||
#define PAGE_32M (0b11000 << 1)
|
||||
#define PAGE_64M (0b11001 << 1)
|
||||
#define PAGE_128M (0b11010 << 1)
|
||||
#define PAGE_256M (0b11011 << 1)
|
||||
#define PAGE_512M (0b11100 << 1)
|
||||
#define PAGE_1G (0b11101 << 1)
|
||||
#define PAGE_2G (0b11110 << 1)
|
||||
#define PAGE_4G (0b11111 << 1)
|
||||
|
||||
#endif // PATCH_H
|
@ -1,94 +0,0 @@
|
||||
#include <string.h>
|
||||
#include <nds/system.h>
|
||||
#include "module_params.h"
|
||||
#include "patch.h"
|
||||
#include "find.h"
|
||||
#include "common.h"
|
||||
|
||||
//#define memcpy __builtin_memcpy // memcpy
|
||||
|
||||
void patchMpu(const tNDSHeader* ndsHeader, const module_params_t* moduleParams) {
|
||||
u32 patchMpuRegion = 0;
|
||||
u32 patchMpuSize = 0;
|
||||
|
||||
// Find the mpu init
|
||||
u32* mpuStartOffset = findMpuStartOffset(ndsHeader, patchMpuRegion);
|
||||
u32* mpuDataOffset = findMpuDataOffset(moduleParams, patchMpuRegion, mpuStartOffset);
|
||||
if (mpuDataOffset) {
|
||||
// Change the region 1 configuration
|
||||
|
||||
u32 mpuInitRegionNewData = PAGE_32M | 0x02000000 | 1;
|
||||
u32 mpuNewDataAccess = 0;
|
||||
u32 mpuNewInstrAccess = 0;
|
||||
int mpuAccessOffset = 0;
|
||||
switch (patchMpuRegion) {
|
||||
case 0:
|
||||
mpuInitRegionNewData = PAGE_128M | 0x00000000 | 1;
|
||||
break;
|
||||
case 2:
|
||||
mpuNewDataAccess = 0x15111111;
|
||||
mpuNewInstrAccess = 0x5111111;
|
||||
mpuAccessOffset = 6;
|
||||
break;
|
||||
case 3:
|
||||
mpuInitRegionNewData = PAGE_8M | 0x03000000 | 1;
|
||||
mpuNewInstrAccess = 0x5111111;
|
||||
mpuAccessOffset = 5;
|
||||
break;
|
||||
}
|
||||
|
||||
*mpuDataOffset = mpuInitRegionNewData;
|
||||
|
||||
if (mpuAccessOffset) {
|
||||
if (mpuNewInstrAccess) {
|
||||
mpuDataOffset[mpuAccessOffset] = mpuNewInstrAccess;
|
||||
}
|
||||
if (mpuNewDataAccess) {
|
||||
mpuDataOffset[mpuAccessOffset + 1] = mpuNewDataAccess;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Find the mpu cache init
|
||||
u32* mpuInitCacheOffset = findMpuInitCacheOffset(mpuStartOffset);
|
||||
if (mpuInitCacheOffset) {
|
||||
*mpuInitCacheOffset = 0xE3A00046;
|
||||
}
|
||||
|
||||
// Patch out all further mpu reconfiguration
|
||||
// dbg_printf("patchMpuSize: ");
|
||||
// dbg_hexa(patchMpuSize);
|
||||
// dbg_printf("\n\n");
|
||||
const u32* mpuInitRegionSignature = getMpuInitRegionSignature(patchMpuRegion);
|
||||
u32* mpuInitOffset = mpuStartOffset;
|
||||
while (mpuInitOffset && patchMpuSize) {
|
||||
u32 patchSize = ndsHeader->arm9binarySize;
|
||||
if (patchMpuSize > 1) {
|
||||
patchSize = patchMpuSize;
|
||||
}
|
||||
mpuInitOffset = findOffset(
|
||||
//(u32*)((u32)mpuStartOffset + 4), patchSize,
|
||||
mpuInitOffset + 1, patchSize,
|
||||
mpuInitRegionSignature, 1
|
||||
);
|
||||
if (mpuInitOffset) {
|
||||
// dbg_printf("Mpu init: ");
|
||||
// dbg_hexa((u32)mpuInitOffset);
|
||||
// dbg_printf("\n\n");
|
||||
|
||||
*mpuInitOffset = 0xE1A00000; // nop
|
||||
|
||||
// Try to find it
|
||||
/*for (int i = 0; i < 0x100; i++) {
|
||||
mpuDataOffset += i;
|
||||
if ((*mpuDataOffset & 0xFFFFFF00) == 0x02000000) {
|
||||
*mpuDataOffset = PAGE_32M | 0x02000000 | 1;
|
||||
break;
|
||||
}
|
||||
if (i == 100) {
|
||||
*mpuStartOffset = 0xE1A00000;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
@ -15,6 +15,7 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <nds/ndstypes.h>
|
||||
|
||||
void readBios (u8* dest, u32 src, u32 size);
|
||||
#include <nds/ndstypes.h>
|
||||
|
||||
void readBios (u8* dest, u32 src, u32 size);
|
||||
|
||||
|
@ -18,27 +18,20 @@
|
||||
|
||||
#include "read_card.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <nds.h>
|
||||
#include <nds/arm9/cache.h>
|
||||
#include <nds/dma.h>
|
||||
#include <nds/card.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "tonccpy.h"
|
||||
#include "encryption.h"
|
||||
#include "common.h"
|
||||
|
||||
typedef union {
|
||||
char title[4];
|
||||
u32 key;
|
||||
} GameCode;
|
||||
typedef union { char title[4]; u32 key; } GameCode;
|
||||
|
||||
static bool twlBlowfish = false;
|
||||
|
||||
static bool normalChip = false; // As defined by GBAtek, normal chip secure area is accessed in blocks of 0x200, other chip in blocks of 0x1000
|
||||
static u32 portFlags = 0;
|
||||
static u32 headerData[0x1000/sizeof(u32)] = {0};
|
||||
static u32 secureArea[CARD_SECURE_AREA_SIZE/sizeof(u32)];
|
||||
static u32 secureAreaData[CARD_SECURE_AREA_SIZE/sizeof(u32)];
|
||||
|
||||
static const u8 cardSeedBytes[] = {0xE8, 0x4D, 0x5A, 0xB1, 0x17, 0x8F, 0x99, 0xD5};
|
||||
|
||||
@ -47,13 +40,12 @@ static u32 getRandomNumber(void) {
|
||||
// guaranteed to be random.
|
||||
}
|
||||
|
||||
static void decryptSecureArea (u32 gameCode, u32* secureArea, int iCardDevice) {
|
||||
init_keycode (gameCode, 2, 8, iCardDevice);
|
||||
static void decryptSecureArea (u32 gameCode, u32* secureArea) {
|
||||
int i;
|
||||
init_keycode (gameCode, 2, 8);
|
||||
crypt_64bit_down (secureArea);
|
||||
|
||||
init_keycode (gameCode, 3, 8, iCardDevice);
|
||||
|
||||
for (int i = 0; i < 0x200; i+= 2) { crypt_64bit_down (secureArea + i); }
|
||||
init_keycode (gameCode, 3, 8);
|
||||
for (i = 0; i < 0x200; i+= 2) { crypt_64bit_down (secureArea + i); }
|
||||
}
|
||||
|
||||
static struct {
|
||||
@ -66,7 +58,7 @@ static struct {
|
||||
} key1data;
|
||||
|
||||
|
||||
static void initKey1Encryption (u8* cmdData, int iCardDevice) {
|
||||
static void initKey1Encryption (u8* cmdData) {
|
||||
key1data.iii = getRandomNumber() & 0x00000fff;
|
||||
key1data.jjj = getRandomNumber() & 0x00000fff;
|
||||
key1data.kkkkk = getRandomNumber() & 0x000fffff;
|
||||
@ -74,12 +66,7 @@ static void initKey1Encryption (u8* cmdData, int iCardDevice) {
|
||||
key1data.mmm = getRandomNumber() & 0x00000fff;
|
||||
key1data.nnn = getRandomNumber() & 0x00000fff;
|
||||
|
||||
if(iCardDevice) { //DSi
|
||||
cmdData[7]=0x3D; // CARD_CMD_ACTIVATE_BF2
|
||||
} else {
|
||||
cmdData[7]=CARD_CMD_ACTIVATE_BF;
|
||||
}
|
||||
|
||||
cmdData[7] = CARD_CMD_ACTIVATE_BF;
|
||||
cmdData[6] = (u8) (key1data.iii >> 4);
|
||||
cmdData[5] = (u8) ((key1data.iii << 4) | (key1data.jjj >> 8));
|
||||
cmdData[4] = (u8) key1data.jjj;
|
||||
@ -93,8 +80,8 @@ static void initKey1Encryption (u8* cmdData, int iCardDevice) {
|
||||
static void createEncryptedCommand (u8 command, u8* cmdData, u32 block) {
|
||||
unsigned long iii, jjj;
|
||||
|
||||
if (command != CARD_CMD_SECURE_READ) { block = key1data.llll; }
|
||||
|
||||
if (command != CARD_CMD_SECURE_READ)block = key1data.llll;
|
||||
|
||||
if (command == CARD_CMD_ACTIVATE_SEC) {
|
||||
iii = key1data.mmm;
|
||||
jjj = key1data.nnn;
|
||||
@ -132,165 +119,40 @@ static void cardDelay (u16 readTimeout) {
|
||||
TIMER_DATA(0) = 0;
|
||||
}
|
||||
|
||||
static void switchToTwlBlowfish(sNDSHeaderExt* ndsHeader) {
|
||||
if (twlBlowfish || ndsHeader->unitCode == 0) return;
|
||||
|
||||
// Used for dumping the DSi arm9i/7i binaries
|
||||
|
||||
u32 portFlagsKey1, portFlagsSecRead;
|
||||
int secureBlockNumber;
|
||||
int i;
|
||||
u8 cmdData[8] __attribute__ ((aligned));
|
||||
GameCode* gameCode;
|
||||
|
||||
// Reset card slot
|
||||
disableSlot1();
|
||||
for(int i = 0; i < 25; i++) {
|
||||
while(REG_VCOUNT!=191);
|
||||
while(REG_VCOUNT==191);
|
||||
}
|
||||
enableSlot1();
|
||||
for(int i = 0; i < 15; i++) {
|
||||
while(REG_VCOUNT!=191);
|
||||
while(REG_VCOUNT==191);
|
||||
}
|
||||
|
||||
// Dummy command sent after card reset
|
||||
cardParamCommand (CARD_CMD_DUMMY, 0,
|
||||
CARD_ACTIVATE | CARD_nRESET | CARD_CLK_SLOW | CARD_BLK_SIZE(1) | CARD_DELAY1(0x1FFF) | CARD_DELAY2(0x3F),
|
||||
NULL, 0);
|
||||
|
||||
//int iCardDevice = 1;
|
||||
|
||||
// Initialise blowfish encryption for KEY1 commands and decrypting the secure area
|
||||
gameCode = (GameCode*)ndsHeader->gameCode;
|
||||
init_keycode (gameCode->key, 1, 8, 1);
|
||||
|
||||
// Port 40001A4h setting for normal reads (command B7)
|
||||
portFlags = ndsHeader->cardControl13 & ~CARD_BLK_SIZE(7);
|
||||
// Port 40001A4h setting for KEY1 commands (usually 001808F8h)
|
||||
portFlagsKey1 = CARD_ACTIVATE | CARD_nRESET | (ndsHeader->cardControl13 & (CARD_WR|CARD_CLK_SLOW)) |
|
||||
((ndsHeader->cardControlBF & (CARD_CLK_SLOW|CARD_DELAY1(0x1FFF))) + ((ndsHeader->cardControlBF & CARD_DELAY2(0x3F)) >> 16));
|
||||
|
||||
// Adjust card transfer method depending on the most significant bit of the chip ID
|
||||
if (!normalChip) { portFlagsKey1 |= CARD_SEC_LARGE; }
|
||||
|
||||
// 3Ciiijjj xkkkkkxx - Activate KEY1 Encryption Mode
|
||||
initKey1Encryption (cmdData, 1);
|
||||
cardPolledTransfer((ndsHeader->cardControl13 & (CARD_WR|CARD_nRESET|CARD_CLK_SLOW)) | CARD_ACTIVATE, NULL, 0, cmdData);
|
||||
|
||||
// 4llllmmm nnnkkkkk - Activate KEY2 Encryption Mode
|
||||
createEncryptedCommand (CARD_CMD_ACTIVATE_SEC, cmdData, 0);
|
||||
|
||||
if (normalChip) {
|
||||
cardPolledTransfer(portFlagsKey1, NULL, 0, cmdData);
|
||||
cardDelay(ndsHeader->readTimeout);
|
||||
}
|
||||
cardPolledTransfer(portFlagsKey1, NULL, 0, cmdData);
|
||||
|
||||
// Set the KEY2 encryption registers
|
||||
REG_ROMCTRL = 0;
|
||||
REG_CARD_1B0 = cardSeedBytes[ndsHeader->deviceType & 0x07] | (key1data.nnn << 15) | (key1data.mmm << 27) | 0x6000;
|
||||
REG_CARD_1B4 = 0x879b9b05;
|
||||
REG_CARD_1B8 = key1data.mmm >> 5;
|
||||
REG_CARD_1BA = 0x5c;
|
||||
REG_ROMCTRL = CARD_nRESET | CARD_SEC_SEED | CARD_SEC_EN | CARD_SEC_DAT;
|
||||
|
||||
// Update the DS card flags to suit KEY2 encryption
|
||||
portFlagsKey1 |= CARD_SEC_EN | CARD_SEC_DAT;
|
||||
|
||||
// 1lllliii jjjkkkkk - 2nd Get ROM Chip ID / Get KEY2 Stream
|
||||
createEncryptedCommand (CARD_CMD_SECURE_CHIPID, cmdData, 0);
|
||||
|
||||
if (normalChip) {
|
||||
cardPolledTransfer(portFlagsKey1, NULL, 0, cmdData);
|
||||
cardDelay(ndsHeader->readTimeout);
|
||||
}
|
||||
cardPolledTransfer(portFlagsKey1 | CARD_BLK_SIZE(7), NULL, 0, cmdData);
|
||||
|
||||
// 2bbbbiii jjjkkkkk - Get Secure Area Block
|
||||
portFlagsSecRead = (ndsHeader->cardControlBF & (CARD_CLK_SLOW|CARD_DELAY1(0x1FFF)|CARD_DELAY2(0x3F)))
|
||||
| CARD_ACTIVATE | CARD_nRESET | CARD_SEC_EN | CARD_SEC_DAT;
|
||||
|
||||
int secureAreaOffset = 0;
|
||||
for (secureBlockNumber = 4; secureBlockNumber < 8; secureBlockNumber++) {
|
||||
createEncryptedCommand (CARD_CMD_SECURE_READ, cmdData, secureBlockNumber);
|
||||
|
||||
if (normalChip) {
|
||||
cardPolledTransfer(portFlagsSecRead, NULL, 0, cmdData);
|
||||
cardDelay(ndsHeader->readTimeout);
|
||||
for (i = 8; i > 0; i--) {
|
||||
cardPolledTransfer(portFlagsSecRead | CARD_BLK_SIZE(1), secureArea + secureAreaOffset, 0x200, cmdData);
|
||||
secureAreaOffset += 0x200/sizeof(u32);
|
||||
}
|
||||
} else {
|
||||
cardPolledTransfer(portFlagsSecRead | CARD_BLK_SIZE(4) | CARD_SEC_LARGE, secureArea + secureAreaOffset, 0x1000, cmdData);
|
||||
secureAreaOffset += 0x1000/sizeof(u32);
|
||||
}
|
||||
}
|
||||
|
||||
// Alllliii jjjkkkkk - Enter Main Data Mode
|
||||
createEncryptedCommand (CARD_CMD_DATA_MODE, cmdData, 0);
|
||||
|
||||
if (normalChip) {
|
||||
cardPolledTransfer(portFlagsKey1, NULL, 0, cmdData);
|
||||
cardDelay(ndsHeader->readTimeout);
|
||||
}
|
||||
cardPolledTransfer(portFlagsKey1, NULL, 0, cmdData);
|
||||
|
||||
// The 0x800 bytes are modcrypted, so this function isn't ran
|
||||
//decryptSecureArea (gameCode->key, secureArea, 1);
|
||||
|
||||
twlBlowfish = true;
|
||||
}
|
||||
|
||||
|
||||
int cardInit (sNDSHeaderExt* ndsHeader, u32* chipID) {
|
||||
u32 portFlagsKey1, portFlagsSecRead;
|
||||
normalChip = false; // As defined by GBAtek, normal chip secure area is accessed in blocks of 0x200, other chip in blocks of 0x1000
|
||||
bool normalChip; // As defined by GBAtek, normal chip secure area is accessed in blocks of 0x200, other chip in blocks of 0x1000
|
||||
u32* secureArea;
|
||||
int secureBlockNumber;
|
||||
int i;
|
||||
u8 cmdData[8] __attribute__ ((aligned));
|
||||
GameCode* gameCode;
|
||||
|
||||
|
||||
// Dummy command sent after card reset
|
||||
cardParamCommand (CARD_CMD_DUMMY, 0,
|
||||
CARD_ACTIVATE | CARD_nRESET | CARD_CLK_SLOW | CARD_BLK_SIZE(1) | CARD_DELAY1(0x1FFF) | CARD_DELAY2(0x3F),
|
||||
NULL, 0);
|
||||
cardParamCommand (CARD_CMD_DUMMY, 0, CARD_ACTIVATE | CARD_nRESET | CARD_CLK_SLOW | CARD_BLK_SIZE(1) | CARD_DELAY1(0x1FFF) | CARD_DELAY2(0x3F), NULL, 0);
|
||||
|
||||
// Verify that the ndsHeader is packed correctly, now that it's no longer __packed__
|
||||
static_assert(sizeof(tNDSHeader) == 0x160, "tNDSHeader not packed properly");
|
||||
|
||||
// Read the header
|
||||
cardParamCommand (CARD_CMD_HEADER_READ, 0,
|
||||
CARD_ACTIVATE | CARD_nRESET | CARD_CLK_SLOW | CARD_BLK_SIZE(1) | CARD_DELAY1(0x1FFF) | CARD_DELAY2(0x3F),
|
||||
(void*)headerData, 0x200/sizeof(u32));
|
||||
|
||||
tonccpy(ndsHeader, headerData, 0x200);
|
||||
|
||||
if ((ndsHeader->unitCode != 0) || (ndsHeader->dsi_flags != 0)) {
|
||||
// Extended header found
|
||||
cardParamCommand (CARD_CMD_HEADER_READ, 0,
|
||||
CARD_ACTIVATE | CARD_nRESET | CARD_CLK_SLOW | CARD_BLK_SIZE(4) | CARD_DELAY1(0x1FFF) | CARD_DELAY2(0x3F),
|
||||
(void*)headerData, 0x1000/sizeof(u32));
|
||||
if (ndsHeader->dsi1[0]==0xFFFFFFFF && ndsHeader->dsi1[1]==0xFFFFFFFF
|
||||
&& ndsHeader->dsi1[2]==0xFFFFFFFF && ndsHeader->dsi1[3]==0xFFFFFFFF)
|
||||
{
|
||||
toncset((u8*)headerData+0x200, 0, 0xE00); // Clear out FFs
|
||||
}
|
||||
tonccpy(ndsHeader, headerData, 0x1000);
|
||||
}
|
||||
(uint32*)ndsHeader, sizeof(tNDSHeader));
|
||||
|
||||
// Check header CRC
|
||||
if (ndsHeader->headerCRC16 != swiCRC16(0xFFFF, (void*)ndsHeader, 0x15E)) { return ERR_HEAD_CRC; }
|
||||
|
||||
/*
|
||||
// Check logo CRC
|
||||
if (ndsHeader->logoCRC16 != 0xCF56) {
|
||||
return ERR_LOGO_CRC;
|
||||
if (ndsHeader->headerCRC16 != swiCRC16(0xFFFF, (void*)ndsHeader, 0x15E)) {
|
||||
return ERR_HEAD_CRC;
|
||||
}
|
||||
*/
|
||||
|
||||
// Check logo CRC
|
||||
/*if (ndsHeader->logoCRC16 != 0xCF56) {
|
||||
return ERR_LOGO_CRC;
|
||||
}*/
|
||||
|
||||
// Initialise blowfish encryption for KEY1 commands and decrypting the secure area
|
||||
gameCode = (GameCode*)ndsHeader->gameCode;
|
||||
init_keycode (gameCode->key, 2, 8, 0);
|
||||
init_keycode (gameCode->key, 2, 8);
|
||||
|
||||
// Port 40001A4h setting for normal reads (command B7)
|
||||
portFlags = ndsHeader->cardControl13 & ~CARD_BLK_SIZE(7);
|
||||
@ -305,10 +167,10 @@ int cardInit (sNDSHeaderExt* ndsHeader, u32* chipID) {
|
||||
|
||||
// Adjust card transfer method depending on the most significant bit of the chip ID
|
||||
normalChip = ((*chipID) & 0x80000000) != 0; // ROM chip ID MSB
|
||||
if (!normalChip) { portFlagsKey1 |= CARD_SEC_LARGE; }
|
||||
if (!normalChip)portFlagsKey1 |= CARD_SEC_LARGE;
|
||||
|
||||
// 3Ciiijjj xkkkkkxx - Activate KEY1 Encryption Mode
|
||||
initKey1Encryption (cmdData, 0);
|
||||
initKey1Encryption (cmdData);
|
||||
cardPolledTransfer((ndsHeader->cardControl13 & (CARD_WR|CARD_nRESET|CARD_CLK_SLOW)) | CARD_ACTIVATE, NULL, 0, cmdData);
|
||||
|
||||
// 4llllmmm nnnkkkkk - Activate KEY2 Encryption Mode
|
||||
@ -317,8 +179,10 @@ int cardInit (sNDSHeaderExt* ndsHeader, u32* chipID) {
|
||||
if (normalChip) {
|
||||
cardPolledTransfer(portFlagsKey1, NULL, 0, cmdData);
|
||||
cardDelay(ndsHeader->readTimeout);
|
||||
cardPolledTransfer(portFlagsKey1, NULL, 0, cmdData);
|
||||
} else {
|
||||
cardPolledTransfer(portFlagsKey1, NULL, 0, cmdData);
|
||||
}
|
||||
cardPolledTransfer(portFlagsKey1, NULL, 0, cmdData);
|
||||
|
||||
// Set the KEY2 encryption registers
|
||||
REG_ROMCTRL = 0;
|
||||
@ -337,27 +201,28 @@ int cardInit (sNDSHeaderExt* ndsHeader, u32* chipID) {
|
||||
if (normalChip) {
|
||||
cardPolledTransfer(portFlagsKey1, NULL, 0, cmdData);
|
||||
cardDelay(ndsHeader->readTimeout);
|
||||
cardPolledTransfer(portFlagsKey1 | CARD_BLK_SIZE(7), NULL, 0, cmdData);
|
||||
} else {
|
||||
cardPolledTransfer(portFlagsKey1 | CARD_BLK_SIZE(7), NULL, 0, cmdData);
|
||||
}
|
||||
cardPolledTransfer(portFlagsKey1 | CARD_BLK_SIZE(7), NULL, 0, cmdData);
|
||||
|
||||
// 2bbbbiii jjjkkkkk - Get Secure Area Block
|
||||
secureArea = secureAreaData;
|
||||
portFlagsSecRead = (ndsHeader->cardControlBF & (CARD_CLK_SLOW|CARD_DELAY1(0x1FFF)|CARD_DELAY2(0x3F)))
|
||||
| CARD_ACTIVATE | CARD_nRESET | CARD_SEC_EN | CARD_SEC_DAT;
|
||||
|
||||
u32* secureAreaOffset = secureArea;
|
||||
for (secureBlockNumber = 4; secureBlockNumber < 8; secureBlockNumber++) {
|
||||
createEncryptedCommand (CARD_CMD_SECURE_READ, cmdData, secureBlockNumber);
|
||||
|
||||
if (normalChip) {
|
||||
cardPolledTransfer(portFlagsSecRead, NULL, 0, cmdData);
|
||||
cardDelay(ndsHeader->readTimeout);
|
||||
for (i = 8; i > 0; i--) {
|
||||
cardPolledTransfer(portFlagsSecRead | CARD_BLK_SIZE(1), secureAreaOffset, 0x200, cmdData);
|
||||
secureAreaOffset += 0x200/sizeof(u32);
|
||||
cardPolledTransfer(portFlagsSecRead | CARD_BLK_SIZE(1), secureArea, 0x200, cmdData);
|
||||
secureArea += 0x200/sizeof(u32);
|
||||
}
|
||||
} else {
|
||||
cardPolledTransfer(portFlagsSecRead | CARD_BLK_SIZE(4) | CARD_SEC_LARGE, secureAreaOffset, 0x1000, cmdData);
|
||||
secureAreaOffset += 0x1000/sizeof(u32);
|
||||
cardPolledTransfer(portFlagsSecRead | CARD_BLK_SIZE(4) | CARD_SEC_LARGE, secureArea, 0x1000, cmdData);
|
||||
secureArea += 0x1000/sizeof(u32);
|
||||
}
|
||||
}
|
||||
|
||||
@ -367,48 +232,40 @@ int cardInit (sNDSHeaderExt* ndsHeader, u32* chipID) {
|
||||
if (normalChip) {
|
||||
cardPolledTransfer(portFlagsKey1, NULL, 0, cmdData);
|
||||
cardDelay(ndsHeader->readTimeout);
|
||||
}
|
||||
cardPolledTransfer(portFlagsKey1, NULL, 0, cmdData);
|
||||
|
||||
//CycloDS doesn't like the dsi secure area being decrypted
|
||||
if((ndsHeader->arm9romOffset != 0x4000) || secureArea[0] || secureArea[1]) {
|
||||
decryptSecureArea (gameCode->key, secureArea, 0);
|
||||
cardPolledTransfer(portFlagsKey1, NULL, 0, cmdData);
|
||||
} else {
|
||||
cardPolledTransfer(portFlagsKey1, NULL, 0, cmdData);
|
||||
}
|
||||
|
||||
// Now deal with secure area decryption and verification
|
||||
decryptSecureArea (gameCode->key, secureAreaData);
|
||||
|
||||
secureArea = secureAreaData;
|
||||
if (secureArea[0] == 0x72636e65 /*'encr'*/ && secureArea[1] == 0x6a624f79 /*'yObj'*/) {
|
||||
// Secure area exists, so just clear the tag
|
||||
secureArea[0] = 0xe7ffdeff;
|
||||
secureArea[1] = 0xe7ffdeff;
|
||||
} else {
|
||||
}/* else {
|
||||
// Secure area tag is not there, so destroy the entire secure area
|
||||
for (i = 0; i < 0x200; i ++) { secureArea[i] = 0xe7ffdeff; }
|
||||
// Disabled error checks on secure area. This was able to boot a DS-Xtreme. May increase flashcart compatiblity drastically.
|
||||
// return normalChip ? ERR_SEC_NORM : ERR_SEC_OTHR;
|
||||
}
|
||||
for (i = 0; i < 0x200; i ++) {
|
||||
*secureArea++ = 0xe7ffdeff;
|
||||
}
|
||||
return normalChip ? ERR_SEC_NORM : ERR_SEC_OTHR;
|
||||
}*/
|
||||
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
void cardRead (u32 src, u32* dest, size_t size) {
|
||||
sNDSHeaderExt* ndsHeader = (sNDSHeaderExt*)headerData;
|
||||
|
||||
void cardRead (u32 src, u32* dest, size_t size)
|
||||
{
|
||||
size_t readSize;
|
||||
|
||||
if (src > ndsHeader->romSize) { switchToTwlBlowfish(ndsHeader); }
|
||||
|
||||
if (src < CARD_SECURE_AREA_OFFSET) {
|
||||
return;
|
||||
} else if (src < CARD_DATA_OFFSET) {
|
||||
// Read data from secure area
|
||||
readSize = src + size < CARD_DATA_OFFSET ? size : CARD_DATA_OFFSET - src;
|
||||
tonccpy (dest, (u8*)secureArea + src - CARD_SECURE_AREA_OFFSET, readSize);
|
||||
src += readSize;
|
||||
dest += readSize/sizeof(*dest);
|
||||
size -= readSize;
|
||||
} else if ((ndsHeader->unitCode != 0) && (src >= ndsHeader->arm9iromOffset) && (src < ndsHeader->arm9iromOffset+CARD_SECURE_AREA_SIZE)) {
|
||||
// Read data from secure area
|
||||
readSize = src + size < (ndsHeader->arm9iromOffset+CARD_SECURE_AREA_SIZE) ? size : (ndsHeader->arm9iromOffset+CARD_SECURE_AREA_SIZE) - src;
|
||||
tonccpy (dest, (u8*)secureArea + src - ndsHeader->arm9iromOffset, readSize);
|
||||
memcpy (dest, (u8*)secureAreaData + src - CARD_SECURE_AREA_OFFSET, readSize);
|
||||
src += readSize;
|
||||
dest += readSize/sizeof(*dest);
|
||||
size -= readSize;
|
||||
@ -417,7 +274,7 @@ void cardRead (u32 src, u32* dest, size_t size) {
|
||||
while (size > 0) {
|
||||
readSize = size < CARD_DATA_BLOCK_SIZE ? size : CARD_DATA_BLOCK_SIZE;
|
||||
cardParamCommand (CARD_CMD_DATA_READ, src,
|
||||
portFlags | CARD_ACTIVATE | CARD_nRESET | CARD_BLK_SIZE(1),
|
||||
(portFlags &~CARD_BLK_SIZE(7)) | CARD_ACTIVATE | CARD_nRESET | CARD_BLK_SIZE(1),
|
||||
dest, readSize);
|
||||
src += readSize;
|
||||
dest += readSize/sizeof(*dest);
|
||||
|
@ -23,14 +23,104 @@
|
||||
#include <nds/memory.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ndsheaderbanner.h"
|
||||
|
||||
#define CARD_NDS_HEADER_SIZE (0x200)
|
||||
#define CARD_SECURE_AREA_OFFSET (0x4000)
|
||||
#define CARD_SECURE_AREA_SIZE (0x4000)
|
||||
#define CARD_DATA_OFFSET (0x8000)
|
||||
#define CARD_DATA_BLOCK_SIZE (0x200)
|
||||
|
||||
typedef struct {
|
||||
char gameTitle[12]; //!< 12 characters for the game title.
|
||||
char gameCode[4]; //!< 4 characters for the game code.
|
||||
char makercode[2]; //!< identifies the (commercial) developer.
|
||||
u8 unitCode; //!< identifies the required hardware.
|
||||
u8 deviceType; //!< type of device in the game card
|
||||
u8 deviceSize; //!< capacity of the device (1 << n Mbit)
|
||||
u8 reserved1[9];
|
||||
u8 romversion; //!< version of the ROM.
|
||||
u8 flags; //!< bit 2: auto-boot flag.
|
||||
|
||||
u32 arm9romOffset; //!< offset of the arm9 binary in the nds file.
|
||||
u32 arm9executeAddress; //!< adress that should be executed after the binary has been copied.
|
||||
u32 arm9destination; //!< destination address to where the arm9 binary should be copied.
|
||||
u32 arm9binarySize; //!< size of the arm9 binary.
|
||||
|
||||
u32 arm7romOffset; //!< offset of the arm7 binary in the nds file.
|
||||
u32 arm7executeAddress; //!< adress that should be executed after the binary has been copied.
|
||||
u32 arm7destination; //!< destination address to where the arm7 binary should be copied.
|
||||
u32 arm7binarySize; //!< size of the arm7 binary.
|
||||
|
||||
u32 filenameOffset; //!< File Name Table (FNT) offset.
|
||||
u32 filenameSize; //!< File Name Table (FNT) size.
|
||||
u32 fatOffset; //!< File Allocation Table (FAT) offset.
|
||||
u32 fatSize; //!< File Allocation Table (FAT) size.
|
||||
|
||||
u32 arm9overlaySource; //!< File arm9 overlay offset.
|
||||
u32 arm9overlaySize; //!< File arm9 overlay size.
|
||||
u32 arm7overlaySource; //!< File arm7 overlay offset.
|
||||
u32 arm7overlaySize; //!< File arm7 overlay size.
|
||||
|
||||
u32 cardControl13; //!< Port 40001A4h setting for normal commands (used in modes 1 and 3)
|
||||
u32 cardControlBF; //!< Port 40001A4h setting for KEY1 commands (used in mode 2)
|
||||
u32 bannerOffset; //!< offset to the banner with icon and titles etc.
|
||||
|
||||
u16 secureCRC16; //!< Secure Area Checksum, CRC-16.
|
||||
|
||||
u16 readTimeout; //!< Secure Area Loading Timeout.
|
||||
|
||||
u32 unknownRAM1; //!< ARM9 Auto Load List RAM Address (?)
|
||||
u32 unknownRAM2; //!< ARM7 Auto Load List RAM Address (?)
|
||||
|
||||
u32 bfPrime1; //!< Secure Area Disable part 1.
|
||||
u32 bfPrime2; //!< Secure Area Disable part 2.
|
||||
u32 romSize; //!< total size of the ROM.
|
||||
|
||||
u32 headerSize; //!< ROM header size.
|
||||
u32 zeros88[14];
|
||||
u8 gbaLogo[156]; //!< Nintendo logo needed for booting the game.
|
||||
u16 logoCRC16; //!< Nintendo Logo Checksum, CRC-16.
|
||||
u16 headerCRC16; //!< header checksum, CRC-16.
|
||||
|
||||
u32 debugRomSource; //!< debug ROM offset.
|
||||
u32 debugRomSize; //!< debug size.
|
||||
u32 debugRomDestination; //!< debug RAM destination.
|
||||
u32 offset_0x16C; //reserved?
|
||||
|
||||
u8 zero[0x40];
|
||||
u32 region;
|
||||
u32 accessControl;
|
||||
u32 arm7SCFGSettings;
|
||||
u16 dsi_unk1;
|
||||
u8 dsi_unk2;
|
||||
u8 dsi_flags;
|
||||
|
||||
u32 arm9iromOffset; //!< offset of the arm9 binary in the nds file.
|
||||
u32 arm9iexecuteAddress;
|
||||
u32 arm9idestination; //!< destination address to where the arm9 binary should be copied.
|
||||
u32 arm9ibinarySize; //!< size of the arm9 binary.
|
||||
|
||||
u32 arm7iromOffset; //!< offset of the arm7 binary in the nds file.
|
||||
u32 deviceListDestination;
|
||||
u32 arm7idestination; //!< destination address to where the arm7 binary should be copied.
|
||||
u32 arm7ibinarySize; //!< size of the arm7 binary.
|
||||
|
||||
u8 zero2[0x20];
|
||||
|
||||
// 0x200
|
||||
// TODO: More DSi-specific fields.
|
||||
u32 dsi1[0x10/4];
|
||||
u32 twlRomSize;
|
||||
u32 dsi_unk3;
|
||||
u32 dsi_unk4;
|
||||
u32 dsi_unk5;
|
||||
u8 dsi2[0x10];
|
||||
u32 dsi_tid;
|
||||
u32 dsi_tid2;
|
||||
u32 pubSavSize;
|
||||
u32 prvSavSize;
|
||||
u8 dsi3[0x174];
|
||||
} sNDSHeaderExt;
|
||||
|
||||
int cardInit (sNDSHeaderExt* ndsHeader, u32* chipID);
|
||||
|
||||
void cardRead (u32 src, u32* dest, size_t size);
|
||||
|
@ -132,5 +132,4 @@ mpu_initial_data:
|
||||
.word 0xffff001d @ p15,0,c6,c6,0,r8 ;PU Protection Unit Data/Unified Region 6
|
||||
.word 0x027ff017 @ p15,0,c6,c7,0,r9 ;PU Protection Unit Data/Unified Region 7 4KB
|
||||
.word 0x0300000a @ p15,0,c9,c1,0,r10 ;TCM Data TCM Base and Virtual Size
|
||||
itcm_reset_code_end:
|
||||
|
||||
itcm_reset_code_end:
|
@ -29,12 +29,13 @@ void tonccpy(void *dst, const void *src, uint size) {
|
||||
count /= 4;
|
||||
|
||||
// Duff's Device, good friend!
|
||||
// Added fall through attribute to silance the compiler about this. ;)
|
||||
switch(tmp) {
|
||||
do { *dst32++ = *src32++;
|
||||
case 3: *dst32++ = *src32++;
|
||||
case 2: *dst32++ = *src32++;
|
||||
case 1: *dst32++ = *src32++;
|
||||
case 0: ; } while(count--);
|
||||
do { *dst32++ = *src32++; // fallthrough
|
||||
case 3: *dst32++ = *src32++; // fallthrough
|
||||
case 2: *dst32++ = *src32++; // fallthrough
|
||||
case 1: *dst32++ = *src32++; // fallthrough
|
||||
case 0: ;} while(count--); // fallthrough
|
||||
}
|
||||
|
||||
// Check for tail
|
||||
@ -105,13 +106,14 @@ void __toncset(void *dst, u32 fill, uint size) {
|
||||
count= size/4;
|
||||
uint tmp= count&3;
|
||||
count /= 4;
|
||||
|
||||
|
||||
// Added fall through attribute to silance the compiler about this. ;)
|
||||
switch(tmp) {
|
||||
do { *dst32++ = fill;
|
||||
case 3: *dst32++ = fill;
|
||||
case 2: *dst32++ = fill;
|
||||
case 1: *dst32++ = fill;
|
||||
case 0: ; } while(count--);
|
||||
do { *dst32++ = fill; // fallthrough
|
||||
case 3: *dst32++ = fill; // fallthrough
|
||||
case 2: *dst32++ = fill; // fallthrough
|
||||
case 1: *dst32++ = fill; // fallthrough
|
||||
case 0: ;} while(count--); // fallthrough
|
||||
}
|
||||
|
||||
// Tail
|
||||
|
@ -12,7 +12,7 @@ extern "C" {
|
||||
|
||||
typedef unsigned int uint;
|
||||
#define BIT_MASK(len) ( (1<<(len))-1 )
|
||||
static inline u32 quad8(u8 x) { x |= x<<8; return x | x<<16; }
|
||||
static inline u32 quad8(u16 x) { x |= x<<8; return x | x<<16; }
|
||||
|
||||
|
||||
//# Declarations and inlines.
|
||||
|
@ -1,125 +0,0 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM)
|
||||
endif
|
||||
|
||||
-include $(DEVKITARM)/ds_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := loadAlt
|
||||
BUILD := build
|
||||
SOURCES := source source/patches
|
||||
INCLUDES := build ../include
|
||||
DATA := ../data
|
||||
SPECS := specs
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -mthumb-interwork -march=armv4t -mtune=arm7tdmi
|
||||
|
||||
CFLAGS := -g -Wall -O2\
|
||||
-mcpu=arm7tdmi -mtune=arm7tdmi -fomit-frame-pointer\
|
||||
-fomit-frame-pointer\
|
||||
-ffast-math \
|
||||
$(ARCH)
|
||||
|
||||
CFLAGS += $(INCLUDE) -DARM7 -std=gnu99
|
||||
|
||||
ASFLAGS := -g $(ARCH) $(INCLUDE)
|
||||
LDFLAGS = -nostartfiles -T $(TOPDIR)/load.ld -g $(ARCH) -Wl,--nmagic -Wl,-Map,$(TARGET).map
|
||||
|
||||
LIBS := -lnds7
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(LIBNDS)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export TOPDIR := $(CURDIR)
|
||||
export LOADBIN := $(CURDIR)/../data/$(TARGET).bin
|
||||
export LOADELF := $(CURDIR)/$(TARGET).elf
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
|
||||
|
||||
export CC := $(PREFIX)gcc
|
||||
export CXX := $(PREFIX)g++
|
||||
export AR := $(PREFIX)ar
|
||||
export OBJCOPY := $(PREFIX)objcopy
|
||||
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
|
||||
export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CC for linking standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
export LD := $(CC)
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
@$(MAKE) -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) *.elf
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(LOADBIN) : $(LOADELF)
|
||||
@$(OBJCOPY) -O binary $< $@
|
||||
@echo built ... $(notdir $@)
|
||||
|
||||
|
||||
$(LOADELF) : $(OFILES)
|
||||
@echo linking $(notdir $@)
|
||||
@$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bin.o : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
$(bin2o)
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
@ -1,224 +0,0 @@
|
||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
|
||||
OUTPUT_ARCH(arm)
|
||||
ENTRY(_start)
|
||||
|
||||
MEMORY {
|
||||
|
||||
vram : ORIGIN = 0x06000000, LENGTH = 64K /* Reserve last 64K for cheats */
|
||||
arm9ram : ORIGIN = 0x027FD800, LENGTH = 2K /* Used for the ARM9's functions */
|
||||
}
|
||||
|
||||
__vram_start = ORIGIN(vram);
|
||||
__vram_top = ORIGIN(vram)+ LENGTH(vram);
|
||||
__sp_irq = __vram_top - 0x60;
|
||||
__sp_svc = __sp_irq - 0x100;
|
||||
__sp_usr = __sp_svc - 0x100;
|
||||
|
||||
__irq_flags = __vram_top - 8;
|
||||
__irq_vector = __vram_top - 4;
|
||||
|
||||
|
||||
__arm9ram_start = ORIGIN(arm9ram);
|
||||
__arm9ram_top = ORIGIN(arm9ram)+ LENGTH(arm9ram);
|
||||
__arm9_sp_irq = __arm9ram_top - 0x60;
|
||||
__arm9_sp_svc = __arm9_sp_irq - 0x100;
|
||||
__arm9_sp_usr = __arm9_sp_svc - 0x100;
|
||||
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.init :
|
||||
{
|
||||
__text_start = . ;
|
||||
KEEP (*(.init))
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >vram = 0xff
|
||||
|
||||
.plt :
|
||||
{
|
||||
*(.plt)
|
||||
} >vram = 0xff
|
||||
|
||||
__arm9_source_start = . ;
|
||||
.arm9 :
|
||||
{
|
||||
__arm9_start = . ;
|
||||
*.arm9.*(.text*)
|
||||
*.arm9.*(.data*)
|
||||
__arm9_bss_start = ABSOLUTE(.);
|
||||
*.arm9.*(.bss*)
|
||||
__arm9_bss_end = ABSOLUTE(.);
|
||||
__arm9_end = . ;
|
||||
} >arm9ram AT>vram =0xff
|
||||
__arm9_source_end = __arm9_source_start + SIZEOF(.arm9);
|
||||
|
||||
. = __arm9_source_end;
|
||||
. = ALIGN(4);
|
||||
|
||||
.text ALIGN(4) : /* ALIGN (4): */
|
||||
{
|
||||
*(.text)
|
||||
*(.stub)
|
||||
*(.text.*)
|
||||
/* .gnu.warning sections are handled specially by elf32.em. */
|
||||
*(.gnu.warning)
|
||||
*(.gnu.linkonce.t*)
|
||||
*(.glue_7)
|
||||
*(.glue_7t)
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >vram = 0xff
|
||||
|
||||
.fini :
|
||||
{
|
||||
KEEP (*(.fini))
|
||||
} >vram =0xff
|
||||
|
||||
__text_end = . ;
|
||||
|
||||
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
*all.rodata*(*)
|
||||
*(.roda)
|
||||
*(.rodata.*)
|
||||
*(.gnu.linkonce.r*)
|
||||
SORT(CONSTRUCTORS)
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >vram = 0xff
|
||||
|
||||
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >vram
|
||||
__exidx_start = .;
|
||||
.ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } >vram
|
||||
__exidx_end = .;
|
||||
|
||||
/* Ensure the __preinit_array_start label is properly aligned. We
|
||||
could instead move the label definition inside the section, but
|
||||
the linker would then create the section even if it turns out to
|
||||
be empty, which isn't pretty. */
|
||||
. = ALIGN(32 / 8);
|
||||
PROVIDE (__preinit_array_start = .);
|
||||
.preinit_array : { KEEP (*(.preinit_array)) } >vram = 0xff
|
||||
PROVIDE (__preinit_array_end = .);
|
||||
PROVIDE (__init_array_start = .);
|
||||
.init_array : { KEEP (*(.init_array)) } >vram = 0xff
|
||||
PROVIDE (__init_array_end = .);
|
||||
PROVIDE (__fini_array_start = .);
|
||||
.fini_array : { KEEP (*(.fini_array)) } >vram = 0xff
|
||||
PROVIDE (__fini_array_end = .);
|
||||
|
||||
.ctors :
|
||||
{
|
||||
/* gcc uses crtbegin.o to find the start of the constructors, so
|
||||
we make sure it is first. Because this is a wildcard, it
|
||||
doesn't matter if the user does not actually link against
|
||||
crtbegin.o; the linker won't look for a file to match a
|
||||
wildcard. The wildcard also means that it doesn't matter which
|
||||
directory crtbegin.o is in. */
|
||||
KEEP (*crtbegin.o(.ctors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*(.ctors))
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >vram = 0xff
|
||||
|
||||
.dtors :
|
||||
{
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >vram = 0xff
|
||||
|
||||
.eh_frame :
|
||||
{
|
||||
KEEP (*(.eh_frame))
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >vram = 0xff
|
||||
|
||||
.gcc_except_table :
|
||||
{
|
||||
*(.gcc_except_table)
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >vram = 0xff
|
||||
.jcr : { KEEP (*(.jcr)) } >vram = 0
|
||||
.got : { *(.got.plt) *(.got) } >vram = 0
|
||||
|
||||
|
||||
.vram ALIGN(4) :
|
||||
{
|
||||
__vram_start = ABSOLUTE(.) ;
|
||||
*(.vram)
|
||||
*vram.*(.text)
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
__vram_end = ABSOLUTE(.) ;
|
||||
} >vram = 0xff
|
||||
|
||||
|
||||
.data ALIGN(4) : {
|
||||
__data_start = ABSOLUTE(.);
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d*)
|
||||
CONSTRUCTORS
|
||||
. = ALIGN(4);
|
||||
__data_end = ABSOLUTE(.) ;
|
||||
} >vram = 0xff
|
||||
|
||||
|
||||
|
||||
.bss ALIGN(4) :
|
||||
{
|
||||
__bss_start = ABSOLUTE(.);
|
||||
__bss_start__ = ABSOLUTE(.);
|
||||
*(.dynbss)
|
||||
*(.gnu.linkonce.b*)
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4); /* REQUIRED. LD is flaky without it. */
|
||||
} >vram
|
||||
|
||||
__bss_end = . ;
|
||||
__bss_end__ = . ;
|
||||
|
||||
_end = . ;
|
||||
__end__ = . ;
|
||||
PROVIDE (end = _end);
|
||||
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
/* DWARF debug sections.
|
||||
Symbols in the DWARF debugging sections are relative to the beginning
|
||||
of the section so we begin them at 0. */
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
.stack 0x80000 : { _stack = .; *(.stack) }
|
||||
/* These must appear regardless of . */
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------
|
||||
|
||||
Copyright (C) 2009
|
||||
Dave Murphy (WinterMute)
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
---------------------------------------------------------------------------------*/
|
||||
|
||||
.text
|
||||
.align 4
|
||||
|
||||
.arm
|
||||
@---------------------------------------------------------------------------------
|
||||
.global swiSoftResetarm7
|
||||
.type swiSoftResetarm7 STT_FUNC
|
||||
@---------------------------------------------------------------------------------
|
||||
swiSoftResetarm7:
|
||||
@---------------------------------------------------------------------------------
|
||||
REG_IME = 0;
|
||||
|
||||
ldr r0,=0x2FFFE34
|
||||
|
||||
|
||||
ldr r0,[r0]
|
||||
bx r0
|
||||
|
||||
.pool
|
@ -1,56 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------
|
||||
|
||||
Copyright (C) 2009
|
||||
Dave Murphy (WinterMute)
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
---------------------------------------------------------------------------------*/
|
||||
|
||||
.text
|
||||
.align 4
|
||||
|
||||
.arm
|
||||
@---------------------------------------------------------------------------------
|
||||
.global swiSoftResetarm9
|
||||
.type swiSoftResetarm9 STT_FUNC
|
||||
@---------------------------------------------------------------------------------
|
||||
swiSoftResetarm9:
|
||||
@---------------------------------------------------------------------------------
|
||||
REG_IME = 0;
|
||||
|
||||
|
||||
.arch armv5te
|
||||
.cpu arm946e-s
|
||||
ldr r1, =0x00002078 @ disable TCM and protection unit
|
||||
mcr p15, 0, r1, c1, c0
|
||||
@ Disable cache
|
||||
mov r0, #0
|
||||
mcr p15, 0, r0, c7, c5, 0 @ Instruction cache
|
||||
mcr p15, 0, r0, c7, c6, 0 @ Data cache
|
||||
|
||||
@ Wait for write buffer to empty
|
||||
mcr p15, 0, r0, c7, c10, 4
|
||||
|
||||
ldr r0,=0x2FFFE24
|
||||
|
||||
|
||||
ldr r0,[r0]
|
||||
bx r0
|
||||
|
||||
.pool
|
@ -1,45 +0,0 @@
|
||||
@ NitroHax -- Cheat tool for the Nintendo DS
|
||||
@ Copyright (C) 2008 Michael "Chishm" Chisholm
|
||||
@
|
||||
@ This program is free software: you can redistribute it and/or modify
|
||||
@ it under the terms of the GNU General Public License as published by
|
||||
@ the Free Software Foundation, either version 3 of the License, or
|
||||
@ (at your option) any later version.
|
||||
@
|
||||
@ This program is distributed in the hope that it will be useful,
|
||||
@ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
@ GNU General Public License for more details.
|
||||
@
|
||||
@ You should have received a copy of the GNU General Public License
|
||||
@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
@ Clears ICache and Dcache, and resets the protection units
|
||||
@ Originally written by Darkain, modified by Chishm
|
||||
|
||||
#include <nds/asminc.h>
|
||||
|
||||
.arm
|
||||
|
||||
BEGIN_ASM_FUNC arm9_clearCache
|
||||
@ Clean and flush cache
|
||||
mov r1, #0
|
||||
outer_loop:
|
||||
mov r0, #0
|
||||
inner_loop:
|
||||
orr r2, r1, r0
|
||||
mcr p15, 0, r2, c7, c14, 2
|
||||
add r0, r0, #0x20
|
||||
cmp r0, #0x400
|
||||
bne inner_loop
|
||||
add r1, r1, #0x40000000
|
||||
cmp r1, #0x0
|
||||
bne outer_loop
|
||||
|
||||
mov r3, #0
|
||||
mcr p15, 0, r3, c7, c5, 0 @ Flush ICache
|
||||
mcr p15, 0, r3, c7, c6, 0 @ Flush DCache
|
||||
mcr p15, 0, r3, c7, c10, 4 @ empty write buffer
|
||||
|
||||
bx lr
|
||||
|
@ -1,44 +0,0 @@
|
||||
@ NitroHax -- Cheat tool for the Nintendo DS
|
||||
@ Copyright (C) 2008 Michael "Chishm" Chisholm
|
||||
@
|
||||
@ This program is free software: you can redistribute it and/or modify
|
||||
@ it under the terms of the GNU General Public License as published by
|
||||
@ the Free Software Foundation, either version 3 of the License, or
|
||||
@ (at your option) any later version.
|
||||
@
|
||||
@ This program is distributed in the hope that it will be useful,
|
||||
@ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
@ GNU General Public License for more details.
|
||||
@
|
||||
@ You should have received a copy of the GNU General Public License
|
||||
@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
@ void arm7_clearmem (void* loc, size_t len);
|
||||
@ Clears memory using an stmia loop
|
||||
|
||||
#include <nds/asminc.h>
|
||||
|
||||
.arm
|
||||
|
||||
|
||||
BEGIN_ASM_FUNC arm7_clearmem
|
||||
add r1, r0, r1
|
||||
stmfd sp!, {r4-r9}
|
||||
mov r2, #0
|
||||
mov r3, #0
|
||||
mov r4, #0
|
||||
mov r5, #0
|
||||
mov r6, #0
|
||||
mov r7, #0
|
||||
mov r8, #0
|
||||
mov r9, #0
|
||||
|
||||
clearmem_loop:
|
||||
stmia r0!, {r2-r9}
|
||||
cmp r0, r1
|
||||
blt clearmem_loop
|
||||
|
||||
ldmfd sp!, {r4-r9}
|
||||
bx lr
|
||||
|
@ -1,83 +0,0 @@
|
||||
/*
|
||||
NitroHax -- Cheat tool for the Nintendo DS
|
||||
Copyright (C) 2008 Michael "Chishm" Chisholm
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _COMMON_H
|
||||
#define _COMMON_H
|
||||
|
||||
#include <nds/dma.h>
|
||||
#include <nds/ipc.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define resetCpu() \
|
||||
__asm volatile("swi 0x000000")
|
||||
|
||||
extern bool arm9_DebugMode;
|
||||
|
||||
typedef enum { ERR_NONE=0x00, ERR_STS_CLR_MEM=0x01, ERR_STS_LOAD_BIN=0x02, ERR_STS_HOOK_BIN=0x03, ERR_STS_START=0x04,
|
||||
// initCard error codes:
|
||||
ERR_LOAD_NORM=0x11, ERR_LOAD_OTHR=0x12, ERR_SEC_NORM=0x13, ERR_SEC_OTHR=0x14, ERR_LOGO_CRC=0x15, ERR_HEAD_CRC=0x16,
|
||||
// hookARM7Binary error codes:
|
||||
ERR_NOCHEAT=0x21, ERR_HOOK=0x22,
|
||||
} ERROR_CODES;
|
||||
|
||||
// Values fixed so they can be shared with ASM code
|
||||
typedef enum {
|
||||
ARM9_BOOT = 0,
|
||||
ARM9_START = 1,
|
||||
ARM9_RESET = 2,
|
||||
ARM9_READY = 3,
|
||||
ARM9_MEMCLR = 4
|
||||
} ARM9_STATE;
|
||||
|
||||
typedef enum {
|
||||
ARM7_BOOT = 0,
|
||||
ARM7_START = 1,
|
||||
ARM7_RESET = 2,
|
||||
ARM7_READY = 3,
|
||||
ARM7_MEMCLR = 4,
|
||||
ARM7_LOADBIN = 5,
|
||||
ARM7_HOOKBIN = 6,
|
||||
ARM7_BOOTBIN = 7,
|
||||
ARM7_ERR = 8
|
||||
} ARM7_STATE;
|
||||
|
||||
extern volatile u32 arm9_errorCode;
|
||||
|
||||
static inline void dmaFill(const void* src, void* dest, uint32 size) {
|
||||
DMA_SRC(3) = (uint32)src;
|
||||
DMA_DEST(3) = (uint32)dest;
|
||||
DMA_CR(3) = DMA_COPY_WORDS | DMA_SRC_FIX | (size>>2);
|
||||
while(DMA_CR(3) & DMA_BUSY);
|
||||
}
|
||||
|
||||
static inline void copyLoop (u32* dest, const u32* src, size_t size) {
|
||||
do {
|
||||
*dest++ = *src++;
|
||||
} while (size -= 4);
|
||||
}
|
||||
|
||||
static inline void ipcSendState(uint8_t state) {
|
||||
REG_IPC_SYNC = (state & 0x0f) << 8;
|
||||
}
|
||||
|
||||
static inline uint8_t ipcRecvState(void) {
|
||||
return (uint8_t)(REG_IPC_SYNC & 0x0f);
|
||||
}
|
||||
|
||||
#endif // _COMMON_H
|
||||
|
@ -1,63 +0,0 @@
|
||||
@---------------------------------------------------------------------------------
|
||||
.global _arm9_start
|
||||
@---------------------------------------------------------------------------------
|
||||
.align 4
|
||||
.arm
|
||||
@---------------------------------------------------------------------------------
|
||||
_arm9_start:
|
||||
@---------------------------------------------------------------------------------
|
||||
mov r0, #0x04000000
|
||||
mov r1, #0
|
||||
str r1, [r0,#0x208] @ REG_IME
|
||||
str r1, [r0,#0x210] @ REG_IE
|
||||
str r1, [r0,#0x218] @ REG_AUXIE
|
||||
|
||||
mov r0, #0x12 @ Switch to IRQ Mode
|
||||
msr cpsr, r0
|
||||
ldr sp, =__arm9_sp_irq @ Set IRQ stack
|
||||
|
||||
mov r0, #0x13 @ Switch to SVC Mode
|
||||
msr cpsr, r0
|
||||
ldr sp, =__arm9_sp_svc @ Set SVC stack
|
||||
|
||||
mov r0, #0x1F @ Switch to System Mode
|
||||
msr cpsr, r0
|
||||
ldr sp, =__arm9_sp_usr @ Set user stack
|
||||
|
||||
ldr r0, =__arm9_bss_start @ Clear BSS section to 0x00
|
||||
ldr r1, =__arm9_bss_end
|
||||
sub r1, r1, r0
|
||||
bl ClearMem
|
||||
|
||||
mov r0, #0 @ int argc
|
||||
mov r1, #0 @ char *argv[]
|
||||
ldr r3, =arm9_main
|
||||
bl _blx_r3_stub @ jump to user code
|
||||
|
||||
@ If the user ever returns, restart
|
||||
b _arm9_start
|
||||
@---------------------------------------------------------------------------------
|
||||
_blx_r3_stub:
|
||||
@---------------------------------------------------------------------------------
|
||||
bx r3
|
||||
|
||||
|
||||
@---------------------------------------------------------------------------------
|
||||
@ Clear memory to 0x00 if length != 0
|
||||
@ r0 = Start Address
|
||||
@ r1 = Length
|
||||
@---------------------------------------------------------------------------------
|
||||
ClearMem:
|
||||
@---------------------------------------------------------------------------------
|
||||
mov r2, #3 @ Round down to nearest word boundary
|
||||
add r1, r1, r2 @ Shouldn't be needed
|
||||
bics r1, r1, r2 @ Clear 2 LSB (and set Z)
|
||||
bxeq lr @ Quit if copy size is 0
|
||||
|
||||
mov r2, #0
|
||||
ClrLoop:
|
||||
stmia r0!, {r2}
|
||||
subs r1, r1, #4
|
||||
bne ClrLoop
|
||||
bx lr
|
||||
|
@ -1,111 +0,0 @@
|
||||
/*
|
||||
NitroHax -- Cheat tool for the Nintendo DS
|
||||
Copyright (C) 2008 Michael "Chishm" Chisholm
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "encryption.h"
|
||||
#include "read_bios.h"
|
||||
#include "key1.h"
|
||||
|
||||
#define KEYSIZE 0x1048
|
||||
|
||||
static u32 keycode [3];
|
||||
static u32 keybuf [KEYSIZE/sizeof(u32)];
|
||||
|
||||
void crypt_64bit_up (u32* ptr) {
|
||||
u32 x = ptr[1];
|
||||
u32 y = ptr[0];
|
||||
u32 z;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 0x10; i++) {
|
||||
z = keybuf[i] ^ x;
|
||||
x = keybuf[0x012 + ((z>>24)&0xff)];
|
||||
x = keybuf[0x112 + ((z>>16)&0xff)] + x;
|
||||
x = keybuf[0x212 + ((z>> 8)&0xff)] ^ x;
|
||||
x = keybuf[0x312 + ((z>> 0)&0xff)] + x;
|
||||
x = y ^ x;
|
||||
y = z;
|
||||
}
|
||||
|
||||
ptr[0] = x ^ keybuf[0x10];
|
||||
ptr[1] = y ^ keybuf[0x11];
|
||||
}
|
||||
|
||||
void crypt_64bit_down (u32* ptr) {
|
||||
u32 x = ptr[1];
|
||||
u32 y = ptr[0];
|
||||
u32 z;
|
||||
int i;
|
||||
|
||||
for (i = 0x11; i > 0x01; i--) {
|
||||
z = keybuf[i] ^ x;
|
||||
x = keybuf[0x012 + ((z>>24)&0xff)];
|
||||
x = keybuf[0x112 + ((z>>16)&0xff)] + x;
|
||||
x = keybuf[0x212 + ((z>> 8)&0xff)] ^ x;
|
||||
x = keybuf[0x312 + ((z>> 0)&0xff)] + x;
|
||||
x = y ^ x;
|
||||
y = z;
|
||||
}
|
||||
|
||||
ptr[0] = x ^ keybuf[0x01];
|
||||
ptr[1] = y ^ keybuf[0x00];
|
||||
}
|
||||
|
||||
static u32 bswap_32bit (u32 in) {
|
||||
u8 a,b,c,d;
|
||||
a = (u8)((in >> 0) & 0xff);
|
||||
b = (u8)((in >> 8) & 0xff);
|
||||
c = (u8)((in >> 16) & 0xff);
|
||||
d = (u8)((in >> 24) & 0xff);
|
||||
|
||||
u32 out = (a << 24) | (b << 16) | (c << 8) | (d << 0);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
void apply_keycode (u32 modulo) {
|
||||
u32 scratch[2];
|
||||
int i;
|
||||
modulo = modulo / sizeof(*keycode);
|
||||
|
||||
crypt_64bit_up (&keycode[1]);
|
||||
crypt_64bit_up (&keycode[0]);
|
||||
memset (scratch, 0, 8);
|
||||
|
||||
for (i = 0; i < 0x12; i+=1) {
|
||||
keybuf[i] = keybuf[i] ^ bswap_32bit (keycode[i % modulo]);
|
||||
}
|
||||
for (i = 0; i < 0x412; i+=2) {
|
||||
crypt_64bit_up (scratch);
|
||||
keybuf[i] = scratch[1];
|
||||
keybuf[i+1] = scratch[0];
|
||||
}
|
||||
}
|
||||
|
||||
void init_keycode (u32 idcode, u32 level, u32 modulo) {
|
||||
memcpy ((u8*)keybuf, gEncrData, KEYSIZE);
|
||||
keycode[0] = idcode;
|
||||
keycode[1] = idcode/2;
|
||||
keycode[2] = idcode*2;
|
||||
|
||||
if (level >= 1) apply_keycode (modulo); // first apply (always)
|
||||
if (level >= 2) apply_keycode (modulo); // second apply (optional)
|
||||
keycode[1] = keycode[1] * 2;
|
||||
keycode[2] = keycode[2] / 2;
|
||||
if (level >= 3) apply_keycode (modulo); // third apply (optional)
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
/*
|
||||
NitroHax -- Cheat tool for the Nintendo DS
|
||||
Copyright (C) 2008 Michael "Chishm" Chisholm
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef ENCRYPTION_H
|
||||
#define ENCRYPTION_H
|
||||
|
||||
#include <nds/ndstypes.h>
|
||||
void init_keycode (u32 idcode, u32 level, u32 modulo);
|
||||
void crypt_64bit_down (u32* ptr);
|
||||
void crypt_64bit_up (u32* ptr);
|
||||
|
||||
#endif
|
@ -1,264 +0,0 @@
|
||||
const unsigned char gEncrData[] =
|
||||
{
|
||||
0x99,0xD5,0x20,0x5F,0x57,0x44,0xF5,0xB9,0x6E,0x19,0xA4,0xD9,0x9E,0x6A,0x5A,0x94,
|
||||
0xD8,0xAE,0xF1,0xEB,0x41,0x75,0xE2,0x3A,0x93,0x82,0xD0,0x32,0x33,0xEE,0x31,0xD5,
|
||||
0xCC,0x57,0x61,0x9A,0x37,0x06,0xA2,0x1B,0x79,0x39,0x72,0xF5,0x55,0xAE,0xF6,0xBE,
|
||||
0x5F,0x1B,0x69,0xFB,0xE5,0x9D,0xF1,0xE9,0xCE,0x2C,0xD9,0xA1,0x5E,0x32,0x05,0xE6,
|
||||
0xFE,0xD3,0xFE,0xCF,0xD4,0x62,0x04,0x0D,0x8B,0xF5,0xEC,0xB7,0x2B,0x60,0x79,0xBB,
|
||||
0x12,0x95,0x31,0x0D,0x6E,0x3F,0xDA,0x2B,0x88,0x84,0xF0,0xF1,0x3D,0x12,0x7E,0x25,
|
||||
0x45,0x22,0xF1,0xBB,0x24,0x06,0x1A,0x06,0x11,0xAD,0xDF,0x28,0x8B,0x64,0x81,0x34,
|
||||
0x2B,0xEB,0x33,0x29,0x99,0xAA,0xF2,0xBD,0x9C,0x14,0x95,0x9D,0x9F,0xF7,0xF5,0x8C,
|
||||
0x72,0x97,0xA1,0x29,0x9D,0xD1,0x5F,0xCF,0x66,0x4D,0x07,0x1A,0xDE,0xD3,0x4A,0x4B,
|
||||
0x85,0xC9,0xA7,0xA3,0x17,0x95,0x05,0x3A,0x3D,0x49,0x0A,0xBF,0x0A,0x89,0x8B,0xA2,
|
||||
0x4A,0x82,0x49,0xDD,0x27,0x90,0xF1,0x0B,0xE9,0xEB,0x1C,0x6A,0x83,0x76,0x45,0x05,
|
||||
0xBA,0x81,0x70,0x61,0x17,0x3F,0x4B,0xDE,0xAE,0xCF,0xAB,0x39,0x57,0xF2,0x3A,0x56,
|
||||
0x48,0x11,0xAD,0x8A,0x40,0xE1,0x45,0x3F,0xFA,0x9B,0x02,0x54,0xCA,0xA6,0x93,0xFB,
|
||||
0xEF,0x4D,0xFE,0x6F,0xA3,0xD8,0x87,0x9C,0x08,0xBA,0xD5,0x48,0x6A,0x8D,0x2D,0xFD,
|
||||
0x6E,0x15,0xF8,0x74,0xBD,0xBE,0x52,0x8B,0x18,0x22,0x8A,0x9E,0xFB,0x74,0x37,0x07,
|
||||
0x1B,0x36,0x6C,0x4A,0x19,0xBA,0x42,0x62,0xB9,0x79,0x91,0x10,0x7B,0x67,0x65,0x96,
|
||||
0xFE,0x02,0x23,0xE8,0xEE,0x99,0x8C,0x77,0x3E,0x5C,0x86,0x64,0x4D,0x6D,0x78,0x86,
|
||||
0xA5,0x4F,0x65,0xE2,0x1E,0xB2,0xDF,0x5A,0x0A,0xD0,0x7E,0x08,0x14,0xB0,0x71,0xAC,
|
||||
0xBD,0xDB,0x83,0x1C,0xB9,0xD7,0xA1,0x62,0xCD,0xC6,0x63,0x7C,0x52,0x69,0xC3,0xE6,
|
||||
0xBF,0x75,0xCE,0x12,0x44,0x5D,0x21,0x04,0xFA,0xFB,0xD3,0x3C,0x38,0x11,0x63,0xD4,
|
||||
0x95,0x85,0x41,0x49,0x46,0x09,0xF2,0x08,0x43,0x11,0xDC,0x1F,0x76,0xC0,0x15,0x6D,
|
||||
0x1F,0x3C,0x63,0x70,0xEA,0x87,0x80,0x6C,0xC3,0xBD,0x63,0x8B,0xC2,0x37,0x21,0x37,
|
||||
0xDC,0xEE,0x09,0x23,0x2E,0x37,0x6A,0x4D,0x73,0x90,0xF7,0x50,0x30,0xAC,0x1C,0x92,
|
||||
0x04,0x10,0x23,0x91,0x4F,0xD2,0x07,0xAA,0x68,0x3E,0x4F,0x9A,0xC9,0x64,0x60,0x6A,
|
||||
0xC8,0x14,0x21,0xF3,0xD6,0x22,0x41,0x12,0x44,0x24,0xCF,0xE6,0x8A,0x56,0xDD,0x0D,
|
||||
0x53,0x4D,0xE1,0x85,0x1E,0x8C,0x52,0x5A,0x9C,0x19,0x84,0xC2,0x03,0x57,0xF1,0x6F,
|
||||
0xE3,0x00,0xBE,0x58,0xF6,0x4C,0xED,0xD5,0x21,0x64,0x9C,0x1F,0xBE,0x55,0x03,0x3C,
|
||||
0x4A,0xDC,0xFF,0xAA,0xC9,0xDA,0xE0,0x5D,0x5E,0xBF,0xE6,0xDE,0xF5,0xD8,0xB1,0xF8,
|
||||
0xFF,0x36,0xB3,0xB9,0x62,0x67,0x95,0xDB,0x31,0x5F,0x37,0xED,0x4C,0x70,0x67,0x99,
|
||||
0x90,0xB5,0x18,0x31,0x6C,0x3D,0x99,0x99,0xE4,0x42,0xDA,0xD3,0x25,0x42,0x13,0xA0,
|
||||
0xAE,0xD7,0x70,0x6C,0xB1,0x55,0xCF,0xC7,0xD7,0x46,0xD5,0x43,0x61,0x17,0x3D,0x44,
|
||||
0x28,0xE9,0x33,0x85,0xD5,0xD0,0xA2,0x93,0xAA,0x25,0x12,0x1F,0xFB,0xC5,0x0B,0x46,
|
||||
0xF5,0x97,0x76,0x56,0x45,0xA6,0xBE,0x87,0xB1,0x94,0x6B,0xE8,0xB1,0xFE,0x33,0x99,
|
||||
0xAE,0x1F,0x3E,0x6C,0x39,0x71,0x1D,0x09,0x00,0x90,0x37,0xE4,0x10,0x3E,0x75,0x74,
|
||||
0xFF,0x8C,0x83,0x3B,0xB0,0xF1,0xB0,0xF9,0x01,0x05,0x47,0x42,0x95,0xF1,0xD6,0xAC,
|
||||
0x7E,0x38,0xE6,0x9E,0x95,0x74,0x26,0x3F,0xB4,0x68,0x50,0x18,0xD0,0x43,0x30,0xB4,
|
||||
0x4C,0x4B,0xE3,0x68,0xBF,0xE5,0x4D,0xB6,0x95,0x8B,0x0A,0xA0,0x74,0x25,0x32,0x77,
|
||||
0xCF,0xA1,0xF7,0x2C,0xD8,0x71,0x13,0x5A,0xAB,0xEA,0xC9,0x51,0xE8,0x0D,0xEE,0xEF,
|
||||
0xE9,0x93,0x7E,0x19,0xA7,0x1E,0x43,0x38,0x81,0x16,0x2C,0xA1,0x48,0xE3,0x73,0xCC,
|
||||
0x29,0x21,0x6C,0xD3,0x5D,0xCE,0xA0,0xD9,0x61,0x71,0x43,0xA0,0x15,0x13,0xB5,0x64,
|
||||
0x92,0xCF,0x2A,0x19,0xDC,0xAD,0xB7,0xA5,0x9F,0x86,0x65,0xF8,0x1A,0x9F,0xE7,0xFB,
|
||||
0xF7,0xFD,0xB8,0x13,0x6C,0x27,0xDB,0x6F,0xDF,0x35,0x1C,0xF7,0x8D,0x2C,0x5B,0x9B,
|
||||
0x12,0xAB,0x38,0x64,0x06,0xCC,0xDE,0x31,0xE8,0x4E,0x75,0x11,0x64,0xE3,0xFA,0xEA,
|
||||
0xEB,0x34,0x54,0xC2,0xAD,0x3F,0x34,0xEB,0x93,0x2C,0x7D,0x26,0x36,0x9D,0x56,0xF3,
|
||||
0x5A,0xE1,0xF6,0xB3,0x98,0x63,0x4A,0x9E,0x32,0x83,0xE4,0x9A,0x84,0x60,0x7D,0x90,
|
||||
0x2E,0x13,0x0E,0xEE,0x93,0x4B,0x36,0xA2,0x85,0xEC,0x16,0x38,0xE8,0x88,0x06,0x02,
|
||||
0xBF,0xF0,0xA0,0x3A,0xED,0xD7,0x6A,0x9A,0x73,0xE1,0x57,0xCF,0xF8,0x44,0xB8,0xDC,
|
||||
0x2E,0x23,0x59,0xD1,0xDF,0x95,0x52,0x71,0x99,0x61,0xA0,0x4B,0xD5,0x7F,0x6E,0x78,
|
||||
0xBA,0xA9,0xC5,0x30,0xD3,0x40,0x86,0x32,0x9D,0x32,0x0C,0x9C,0x37,0xB7,0x02,0x2F,
|
||||
0xBA,0x54,0x98,0xA9,0xC4,0x13,0x04,0xC9,0x8D,0xBE,0xC8,0xE7,0x5D,0x97,0x50,0x2E,
|
||||
0x93,0xD6,0x22,0x59,0x0C,0x27,0xBC,0x22,0x92,0xE0,0xA7,0x20,0x0F,0x93,0x6F,0x7F,
|
||||
0x4C,0x9F,0xD3,0xB5,0xA6,0x2A,0x0B,0x74,0x67,0x49,0x7D,0x10,0x26,0xCB,0xD1,0xC5,
|
||||
0x86,0x71,0xE7,0x8C,0xA0,0x9C,0xE9,0x5B,0xB2,0x1A,0xF6,0x01,0xEE,0x8C,0x9E,0x5E,
|
||||
0x83,0xF2,0x1A,0xDB,0xE6,0xE5,0xEA,0x84,0x59,0x76,0xD2,0x7C,0xF6,0x8D,0xA5,0x49,
|
||||
0x36,0x48,0xC2,0x16,0x52,0xBB,0x83,0xA3,0x74,0xB9,0x07,0x0C,0x3B,0xFF,0x61,0x28,
|
||||
0xE1,0x61,0xE9,0xE4,0xEF,0x6E,0x15,0xAA,0x4E,0xBA,0xE8,0x5D,0x05,0x96,0xBB,0x32,
|
||||
0x56,0xB0,0xFB,0x72,0x52,0x0F,0x0E,0xC8,0x42,0x25,0x65,0x76,0x89,0xAF,0xF2,0xDE,
|
||||
0x10,0x27,0xF0,0x01,0x4B,0x74,0xA7,0x97,0x07,0xD5,0x26,0x54,0x54,0x09,0x1F,0x82,
|
||||
0x0A,0x86,0x7D,0x30,0x39,0x0E,0xB3,0x26,0x9B,0x0B,0x57,0xBB,0x36,0x06,0x31,0xAF,
|
||||
0xFD,0x79,0xFC,0xD9,0x30,0x10,0x2B,0x0C,0xB3,0xE1,0x9B,0xD7,0x7B,0xDC,0x5F,0xEF,
|
||||
0xD2,0xF8,0x13,0x45,0x4D,0x47,0x75,0xBD,0x46,0x96,0x3C,0x7E,0x75,0xF3,0x3E,0xB5,
|
||||
0x67,0xC5,0x9A,0x3B,0xB0,0x5B,0x29,0x6B,0xDE,0x80,0x5B,0xC8,0x15,0x05,0xB1,0x31,
|
||||
0xB6,0xCE,0x49,0xDD,0xAD,0x84,0xB5,0xAE,0x60,0xDC,0x67,0x31,0x34,0x30,0xFE,0x4E,
|
||||
0xBD,0x80,0x2F,0xA6,0xBF,0x63,0x39,0x21,0x86,0xD9,0x35,0x7F,0x16,0x68,0x22,0x05,
|
||||
0x54,0xE9,0x90,0x26,0x8C,0x07,0x6C,0x51,0xA4,0x31,0x55,0xD7,0x09,0x07,0xA8,0x3E,
|
||||
0x2E,0x53,0x66,0xC1,0xF8,0xF2,0x7B,0xC4,0xF2,0x58,0xCF,0xF1,0x87,0xC5,0xA2,0xE7,
|
||||
0x27,0x8F,0x30,0x87,0x58,0xA0,0x64,0x62,0x23,0x18,0xB9,0x88,0x7C,0xFA,0xCE,0xC4,
|
||||
0x98,0xAE,0xAD,0x17,0xCC,0x4A,0x5B,0xF3,0xE9,0x48,0xD5,0x56,0xD3,0x0D,0xF2,0xC8,
|
||||
0x92,0x73,0x8C,0xDB,0xD7,0x2F,0x56,0xAC,0x81,0xF9,0x92,0x69,0x4D,0xC6,0x32,0xF6,
|
||||
0xE6,0xC0,0x8D,0x21,0xE2,0x76,0x80,0x61,0x11,0xBC,0xDC,0x6C,0x93,0xAF,0x19,0x69,
|
||||
0x9B,0xD0,0xBF,0xB9,0x31,0x9F,0x02,0x67,0xA3,0x51,0xEE,0x83,0x06,0x22,0x7B,0x0C,
|
||||
0xAB,0x49,0x42,0x40,0xB8,0xD5,0x01,0x7D,0xCE,0x5E,0xF7,0x55,0x53,0x39,0xC5,0x99,
|
||||
0x46,0xD8,0x87,0x9F,0xBA,0xF7,0x64,0xB4,0xE3,0x9A,0xFA,0xA1,0x6D,0x90,0x68,0x10,
|
||||
0x30,0xCA,0x8A,0x54,0xA7,0x9F,0x60,0xC3,0x19,0xF5,0x6B,0x0D,0x7A,0x51,0x98,0xE6,
|
||||
0x98,0x43,0x51,0xB4,0xD6,0x35,0xE9,0x4F,0xC3,0xDF,0x0F,0x7B,0xD6,0x2F,0x5C,0xBD,
|
||||
0x3A,0x15,0x61,0x19,0xF1,0x4B,0xCB,0xAA,0xDC,0x6D,0x64,0xC9,0xD3,0xC6,0x1E,0x56,
|
||||
0xEF,0x38,0x4C,0x50,0x71,0x86,0x75,0xCC,0x0D,0x0D,0x4E,0xE9,0x28,0xF6,0x06,0x5D,
|
||||
0x70,0x1B,0xAA,0xD3,0x45,0xCF,0xA8,0x39,0xAC,0x95,0xA6,0x2E,0xB4,0xE4,0x22,0xD4,
|
||||
0x74,0xA8,0x37,0x5F,0x48,0x7A,0x04,0xCC,0xA5,0x4C,0x40,0xD8,0x28,0xB4,0x28,0x08,
|
||||
0x0D,0x1C,0x72,0x52,0x41,0xF0,0x7D,0x47,0x19,0x3A,0x53,0x4E,0x58,0x84,0x62,0x6B,
|
||||
0x93,0xB5,0x8A,0x81,0x21,0x4E,0x0D,0xDC,0xB4,0x3F,0xA2,0xC6,0xFC,0xC9,0x2B,0x40,
|
||||
0xDA,0x38,0x04,0xE9,0x5E,0x5A,0x86,0x6B,0x0C,0x22,0x25,0x85,0x68,0x11,0x8D,0x7C,
|
||||
0x92,0x1D,0x95,0x55,0x4D,0xAB,0x8E,0xBB,0xDA,0xA6,0xE6,0xB7,0x51,0xB6,0x32,0x5A,
|
||||
0x05,0x41,0xDD,0x05,0x2A,0x0A,0x56,0x50,0x91,0x17,0x47,0xCC,0xC9,0xE6,0x7E,0xB5,
|
||||
0x61,0x4A,0xDB,0x73,0x67,0x51,0xC8,0x33,0xF5,0xDA,0x6E,0x74,0x2E,0x54,0xC3,0x37,
|
||||
0x0D,0x6D,0xAF,0x08,0xE8,0x15,0x8A,0x5F,0xE2,0x59,0x21,0xCD,0xA8,0xDE,0x0C,0x06,
|
||||
0x5A,0x77,0x6B,0x5F,0xDB,0x18,0x65,0x3E,0xC8,0x50,0xDE,0x78,0xE0,0xB8,0x82,0xB3,
|
||||
0x5D,0x4E,0x72,0x32,0x07,0x4F,0xC1,0x34,0x23,0xBA,0x96,0xB7,0x67,0x4E,0xA4,0x28,
|
||||
0x1E,0x34,0x62,0xEB,0x2D,0x6A,0x70,0xE9,0x2F,0x42,0xC4,0x70,0x4E,0x5A,0x31,0x9C,
|
||||
0xF9,0x5B,0x47,0x28,0xAA,0xDA,0x71,0x6F,0x38,0x1F,0xB3,0x78,0xC4,0x92,0x6B,0x1C,
|
||||
0x9E,0xF6,0x35,0x9A,0xB7,0x4D,0x0E,0xBF,0xCC,0x18,0x29,0x41,0x03,0x48,0x35,0x5D,
|
||||
0x55,0xD0,0x2B,0xC6,0x29,0xAF,0x5C,0x60,0x74,0x69,0x8E,0x5E,0x9B,0x7C,0xD4,0xBD,
|
||||
0x7B,0x44,0x64,0x7D,0x3F,0x92,0x5D,0x69,0xB6,0x1F,0x00,0x4B,0xD4,0x83,0x35,0xCF,
|
||||
0x7E,0x64,0x4E,0x17,0xAE,0x8D,0xD5,0x2E,0x9A,0x28,0x12,0x4E,0x2E,0x2B,0x49,0x08,
|
||||
0x5C,0xAE,0xC6,0x46,0x85,0xAE,0x41,0x61,0x1E,0x6F,0x82,0xD2,0x51,0x37,0x16,0x1F,
|
||||
0x0B,0xF6,0x59,0xA4,0x9A,0xCA,0x5A,0xAF,0x0D,0xD4,0x33,0x8B,0x20,0x63,0xF1,0x84,
|
||||
0x80,0x5C,0xCB,0xCF,0x08,0xB4,0xB9,0xD3,0x16,0x05,0xBD,0x62,0x83,0x31,0x9B,0x56,
|
||||
0x51,0x98,0x9F,0xBA,0xB2,0x5B,0xAA,0xB2,0x22,0x6B,0x2C,0xB5,0xD4,0x48,0xFA,0x63,
|
||||
0x2B,0x5F,0x58,0xFA,0x61,0xFA,0x64,0x09,0xBB,0x38,0xE0,0xB8,0x9D,0x92,0x60,0xA8,
|
||||
0x0D,0x67,0x6F,0x0E,0x37,0xF5,0x0D,0x01,0x9F,0xC2,0x77,0xD4,0xFE,0xEC,0xF1,0x73,
|
||||
0x30,0x39,0xE0,0x7D,0xF5,0x61,0x98,0xE4,0x2C,0x28,0x55,0x04,0x56,0x55,0xDB,0x2F,
|
||||
0x6B,0xEC,0xE5,0x58,0x06,0xB6,0x64,0x80,0x6A,0x2A,0x1A,0x4E,0x5B,0x0F,0xD8,0xC4,
|
||||
0x0A,0x2E,0x52,0x19,0xD9,0x62,0xF5,0x30,0x48,0xBE,0x8C,0x7B,0x4F,0x38,0x9B,0xA2,
|
||||
0xC3,0xAF,0xC9,0xD3,0xC7,0xC1,0x62,0x41,0x86,0xB9,0x61,0x21,0x57,0x6F,0x99,0x4F,
|
||||
0xC1,0xBA,0xCE,0x7B,0xB5,0x3B,0x4D,0x5E,0x8A,0x8B,0x44,0x57,0x5F,0x13,0x5F,0x70,
|
||||
0x6D,0x5B,0x29,0x47,0xDC,0x38,0xE2,0xEC,0x04,0x55,0x65,0x12,0x2A,0xE8,0x17,0x43,
|
||||
0xE1,0x8E,0xDD,0x2A,0xB3,0xE2,0x94,0xF7,0x09,0x6E,0x5C,0xE6,0xEB,0x8A,0xF8,0x6D,
|
||||
0x89,0x49,0x54,0x48,0xF5,0x2F,0xAD,0xBF,0xEA,0x94,0x4B,0xCA,0xFC,0x39,0x87,0x82,
|
||||
0x5F,0x8A,0x01,0xF2,0x75,0xF2,0xE6,0x71,0xD6,0xD8,0x42,0xDE,0xF1,0x2D,0x1D,0x28,
|
||||
0xA6,0x88,0x7E,0xA3,0xA0,0x47,0x1D,0x30,0xD9,0xA3,0x71,0xDF,0x49,0x1C,0xCB,0x01,
|
||||
0xF8,0x36,0xB1,0xF2,0xF0,0x22,0x58,0x5D,0x45,0x6B,0xBD,0xA0,0xBB,0xB2,0x88,0x42,
|
||||
0xC7,0x8C,0x28,0xCE,0x93,0xE8,0x90,0x63,0x08,0x90,0x7C,0x89,0x3C,0xF5,0x7D,0xB7,
|
||||
0x04,0x2D,0x4F,0x55,0x51,0x16,0xFD,0x7E,0x79,0xE8,0xBE,0xC1,0xF2,0x12,0xD4,0xF8,
|
||||
0xB4,0x84,0x05,0x23,0xA0,0xCC,0xD2,0x2B,0xFD,0xE1,0xAB,0xAD,0x0D,0xD1,0x55,0x6C,
|
||||
0x23,0x41,0x94,0x4D,0x77,0x37,0x4F,0x05,0x28,0x0C,0xBF,0x17,0xB3,0x12,0x67,0x6C,
|
||||
0x8C,0xC3,0x5A,0xF7,0x41,0x84,0x2A,0x6D,0xD0,0x94,0x12,0x27,0x2C,0xB4,0xED,0x9C,
|
||||
0x4D,0xEC,0x47,0x82,0x97,0xD5,0x67,0xB9,0x1B,0x9D,0xC0,0x55,0x07,0x7E,0xE5,0x8E,
|
||||
0xE2,0xA8,0xE7,0x3E,0x12,0xE4,0x0E,0x3A,0x2A,0x45,0x55,0x34,0xA2,0xF9,0x2D,0x5A,
|
||||
0x1B,0xAB,0x52,0x7C,0x83,0x10,0x5F,0x55,0xD2,0xF1,0x5A,0x43,0x2B,0xC6,0xA7,0xA4,
|
||||
0x89,0x15,0x95,0xE8,0xB4,0x4B,0x9D,0xF8,0x75,0xE3,0x9F,0x60,0x78,0x5B,0xD6,0xE6,
|
||||
0x0D,0x44,0xE6,0x21,0x06,0xBD,0x47,0x22,0x53,0xA4,0x00,0xAD,0x8D,0x43,0x13,0x85,
|
||||
0x39,0xF7,0xAA,0xFC,0x38,0xAF,0x7B,0xED,0xFC,0xE4,0x2B,0x54,0x50,0x98,0x4C,0xFC,
|
||||
0x85,0x80,0xF7,0xDF,0x3C,0x80,0x22,0xE1,0x94,0xDA,0xDE,0x24,0xC6,0xB0,0x7A,0x39,
|
||||
0x38,0xDC,0x0F,0xA1,0xA7,0xF4,0xF9,0x6F,0x63,0x18,0x57,0x8B,0x84,0x41,0x2A,0x2E,
|
||||
0xD4,0x53,0xF2,0xD9,0x00,0x0F,0xD0,0xDD,0x99,0x6E,0x19,0xA6,0x0A,0xD0,0xEC,0x5B,
|
||||
0x58,0x24,0xAB,0xC0,0xCB,0x06,0x65,0xEC,0x1A,0x13,0x38,0x94,0x0A,0x67,0x03,0x2F,
|
||||
0x3F,0xF7,0xE3,0x77,0x44,0x77,0x33,0xC6,0x14,0x39,0xD0,0xE3,0xC0,0xA2,0x08,0x79,
|
||||
0xBB,0x40,0x99,0x57,0x41,0x0B,0x01,0x90,0xCD,0xE1,0xCC,0x48,0x67,0xDB,0xB3,0xAF,
|
||||
0x88,0x74,0xF3,0x4C,0x82,0x8F,0x72,0xB1,0xB5,0x23,0x29,0xC4,0x12,0x6C,0x19,0xFC,
|
||||
0x8E,0x46,0xA4,0x9C,0xC4,0x25,0x65,0x87,0xD3,0x6D,0xBE,0x8A,0x93,0x11,0x03,0x38,
|
||||
0xED,0x83,0x2B,0xF3,0x46,0xA4,0x93,0xEA,0x3B,0x53,0x85,0x1D,0xCE,0xD4,0xF1,0x08,
|
||||
0x83,0x27,0xED,0xFC,0x9B,0x1A,0x18,0xBC,0xF9,0x8B,0xAE,0xDC,0x24,0xAB,0x50,0x38,
|
||||
0xE9,0x72,0x4B,0x10,0x22,0x17,0x7B,0x46,0x5D,0xAB,0x59,0x64,0xF3,0x40,0xAE,0xF8,
|
||||
0xBB,0xE5,0xC8,0xF9,0x26,0x03,0x4E,0x55,0x7D,0xEB,0xEB,0xFE,0xF7,0x39,0xE6,0xE0,
|
||||
0x0A,0x11,0xBE,0x2E,0x28,0xFF,0x98,0xED,0xC0,0xC9,0x42,0x56,0x42,0xC3,0xFD,0x00,
|
||||
0xF6,0xAF,0x87,0xA2,0x5B,0x01,0x3F,0x32,0x92,0x47,0x95,0x9A,0x72,0xA5,0x32,0x3D,
|
||||
0xAE,0x6B,0xD0,0x9B,0x07,0xD2,0x49,0x92,0xE3,0x78,0x4A,0xFA,0xA1,0x06,0x7D,0xF2,
|
||||
0x41,0xCF,0x77,0x74,0x04,0x14,0xB2,0x0C,0x86,0x84,0x64,0x16,0xD5,0xBB,0x51,0xA1,
|
||||
0xE5,0x6F,0xF1,0xD1,0xF2,0xE2,0xF7,0x5F,0x58,0x20,0x4D,0xB8,0x57,0xC7,0xCF,0xDD,
|
||||
0xC5,0xD8,0xBE,0x76,0x3D,0xF6,0x5F,0x7E,0xE7,0x2A,0x8B,0x88,0x24,0x1B,0x38,0x3F,
|
||||
0x0E,0x41,0x23,0x77,0xF5,0xF0,0x4B,0xD4,0x0C,0x1F,0xFA,0xA4,0x0B,0x80,0x5F,0xCF,
|
||||
0x45,0xF6,0xE0,0xDA,0x2F,0x34,0x59,0x53,0xFB,0x20,0x3C,0x52,0x62,0x5E,0x35,0xB5,
|
||||
0x62,0xFE,0x8B,0x60,0x63,0xE3,0x86,0x5A,0x15,0x1A,0x6E,0xD1,0x47,0x45,0xBC,0x32,
|
||||
0xB4,0xEB,0x67,0x38,0xAB,0xE4,0x6E,0x33,0x3A,0xB5,0xED,0xA3,0xAD,0x67,0xE0,0x4E,
|
||||
0x41,0x95,0xEE,0x62,0x62,0x71,0x26,0x1D,0x31,0xEF,0x62,0x30,0xAF,0xD7,0x82,0xAC,
|
||||
0xC2,0xDC,0x05,0x04,0xF5,0x97,0x07,0xBF,0x11,0x59,0x23,0x07,0xC0,0x64,0x02,0xE8,
|
||||
0x97,0xE5,0x3E,0xAF,0x18,0xAC,0x59,0xA6,0x8B,0x4A,0x33,0x90,0x1C,0x6E,0x7C,0x9C,
|
||||
0x20,0x7E,0x4C,0x3C,0x3E,0x61,0x64,0xBB,0xC5,0x6B,0x7C,0x7E,0x3E,0x9F,0xC5,0x4C,
|
||||
0x9F,0xEA,0x73,0xF5,0xD7,0x89,0xC0,0x4C,0xF4,0xFB,0xF4,0x2D,0xEC,0x14,0x1B,0x51,
|
||||
0xD5,0xC1,0x12,0xC8,0x10,0xDF,0x0B,0x4A,0x8B,0x9C,0xBC,0x93,0x45,0x6A,0x3E,0x3E,
|
||||
0x7D,0xC1,0xA9,0xBA,0xCD,0xC1,0xB4,0x07,0xE4,0xE1,0x68,0x86,0x43,0xB2,0x6D,0x38,
|
||||
0xF3,0xFB,0x0C,0x5C,0x66,0x37,0x71,0xDE,0x56,0xEF,0x6E,0xA0,0x10,0x40,0x65,0xA7,
|
||||
0x98,0xF7,0xD0,0xBE,0x0E,0xC8,0x37,0x36,0xEC,0x10,0xCA,0x7C,0x9C,0xAB,0x84,0x1E,
|
||||
0x05,0x17,0x76,0x02,0x1C,0x4F,0x52,0xAA,0x5F,0xC1,0xC6,0xA0,0x56,0xB9,0xD8,0x04,
|
||||
0x84,0x44,0x4D,0xA7,0x59,0xD8,0xDE,0x60,0xE6,0x38,0x0E,0x05,0x8F,0x03,0xE1,0x3B,
|
||||
0x6D,0x81,0x04,0x33,0x6F,0x30,0x0B,0xCE,0x69,0x05,0x21,0x33,0xFB,0x26,0xBB,0x89,
|
||||
0x7D,0xB6,0xAE,0x87,0x7E,0x51,0x07,0xE0,0xAC,0xF7,0x96,0x0A,0x6B,0xF9,0xC4,0x5C,
|
||||
0x1D,0xE4,0x44,0x47,0xB8,0x5E,0xFA,0xE3,0x78,0x84,0x55,0x42,0x4B,0x48,0x5E,0xF7,
|
||||
0x7D,0x47,0x35,0x86,0x1D,0x2B,0x43,0x05,0x03,0xEC,0x8A,0xB8,0x1E,0x06,0x3C,0x76,
|
||||
0x0C,0x48,0x1A,0x43,0xA7,0xB7,0x8A,0xED,0x1E,0x13,0xC6,0x43,0xEE,0x10,0xEF,0xDB,
|
||||
0xEC,0xFB,0x3C,0x83,0xB2,0x95,0x44,0xEF,0xD8,0x54,0x51,0x4E,0x2D,0x11,0x44,0x1D,
|
||||
0xFB,0x36,0x59,0x1E,0x7A,0x34,0xC1,0xC3,0xCA,0x57,0x00,0x61,0xEA,0x67,0xA5,0x16,
|
||||
0x9B,0x55,0xD0,0x55,0xE1,0x7F,0xD9,0x36,0xD2,0x40,0x76,0xAE,0xDC,0x01,0xCE,0xB0,
|
||||
0x7A,0x83,0xD5,0xCB,0x20,0x98,0xEC,0x6B,0xC1,0x72,0x92,0x34,0xF3,0x82,0x57,0x37,
|
||||
0x62,0x8A,0x32,0x36,0x0C,0x90,0x43,0xAE,0xAE,0x5C,0x9B,0x78,0x8E,0x13,0x65,0x02,
|
||||
0xFD,0x68,0x71,0xC1,0xFE,0xB0,0x31,0xA0,0x24,0x82,0xB0,0xC3,0xB1,0x79,0x69,0xA7,
|
||||
0xF5,0xD2,0xEB,0xD0,0x82,0xC0,0x32,0xDC,0x9E,0xC7,0x26,0x3C,0x6D,0x8D,0x98,0xC1,
|
||||
0xBB,0x22,0xD4,0xD0,0x0F,0x33,0xEC,0x3E,0xB9,0xCC,0xE1,0xDC,0x6A,0x4C,0x77,0x36,
|
||||
0x14,0x1C,0xF9,0xBF,0x81,0x9F,0x28,0x5F,0x71,0x85,0x32,0x29,0x90,0x75,0x48,0xC4,
|
||||
0xB3,0x4A,0xCE,0xD8,0x44,0x8F,0x14,0x2F,0xFD,0x40,0x57,0xEF,0xAA,0x08,0x75,0xD9,
|
||||
0x46,0xD1,0xD6,0x6E,0x32,0x55,0x1F,0xC3,0x18,0xFE,0x84,0x1F,0xFC,0x84,0xD5,0xFF,
|
||||
0x71,0x5E,0x1B,0x48,0xC3,0x86,0x95,0x0E,0x28,0x08,0x27,0xD3,0x38,0x83,0x71,0x7B,
|
||||
0x4C,0x80,0x63,0x54,0x9A,0x56,0xB0,0xAC,0xCF,0x80,0xCA,0x31,0x09,0xEF,0xFE,0xF3,
|
||||
0xBE,0xAF,0x24,0x7E,0xA6,0xFE,0x53,0x3F,0xC2,0x8D,0x4A,0x33,0x68,0xD1,0x22,0xA6,
|
||||
0x66,0xAD,0x7B,0xEA,0xDE,0xB6,0x43,0xB0,0xA1,0x25,0x95,0x00,0xA3,0x3F,0x75,0x46,
|
||||
0x14,0x11,0x44,0xEC,0xD7,0x95,0xBC,0x92,0xF0,0x4F,0xA9,0x16,0x53,0x62,0x97,0x60,
|
||||
0x2A,0x0F,0x41,0xF1,0x71,0x24,0xBE,0xEE,0x94,0x7F,0x08,0xCD,0x60,0x93,0xB3,0x85,
|
||||
0x5B,0x07,0x00,0x3F,0xD8,0x0F,0x28,0x83,0x9A,0xD1,0x69,0x9F,0xD1,0xDA,0x2E,0xC3,
|
||||
0x90,0x01,0xA2,0xB9,0x6B,0x4E,0x2A,0x66,0x9D,0xDA,0xAE,0xA6,0xEA,0x2A,0xD3,0x68,
|
||||
0x2F,0x0C,0x0C,0x9C,0xD2,0x8C,0x4A,0xED,0xE2,0x9E,0x57,0x65,0x9D,0x09,0x87,0xA3,
|
||||
0xB4,0xC4,0x32,0x5D,0xC9,0xD4,0x32,0x2B,0xB1,0xE0,0x71,0x1E,0x64,0x4D,0xE6,0x90,
|
||||
0x71,0xE3,0x1E,0x40,0xED,0x7D,0xF3,0x84,0x0E,0xED,0xC8,0x78,0x76,0xAE,0xC0,0x71,
|
||||
0x27,0x72,0xBB,0x05,0xEA,0x02,0x64,0xFB,0xF3,0x48,0x6B,0xB5,0x42,0x93,0x3F,0xED,
|
||||
0x9F,0x13,0x53,0xD2,0xF7,0xFE,0x2A,0xEC,0x1D,0x47,0x25,0xDB,0x3C,0x91,0x86,0xC6,
|
||||
0x8E,0xF0,0x11,0xFD,0x23,0x74,0x36,0xF7,0xA4,0xF5,0x9E,0x7A,0x7E,0x53,0x50,0x44,
|
||||
0xD4,0x47,0xCA,0xD3,0xEB,0x38,0x6D,0xE6,0xD9,0x71,0x94,0x7F,0x4A,0xC6,0x69,0x4B,
|
||||
0x11,0xF4,0x52,0xEA,0x22,0xFE,0x8A,0xB0,0x36,0x67,0x8B,0x59,0xE8,0xE6,0x80,0x2A,
|
||||
0xEB,0x65,0x04,0x13,0xEE,0xEC,0xDC,0x9E,0x5F,0xB1,0xEC,0x05,0x6A,0x59,0xE6,0x9F,
|
||||
0x5E,0x59,0x6B,0x89,0xBF,0xF7,0x1A,0xCA,0x44,0xF9,0x5B,0x6A,0x71,0x85,0x03,0xE4,
|
||||
0x29,0x62,0xE0,0x70,0x6F,0x41,0xC4,0xCF,0xB2,0xB1,0xCC,0xE3,0x7E,0xA6,0x07,0xA8,
|
||||
0x87,0xE7,0x7F,0x84,0x93,0xDB,0x52,0x4B,0x6C,0xEC,0x7E,0xDD,0xD4,0x24,0x48,0x10,
|
||||
0x69,0x9F,0x04,0x60,0x74,0xE6,0x48,0x18,0xF3,0xE4,0x2C,0xB9,0x4F,0x2E,0x50,0x7A,
|
||||
0xDF,0xD4,0x54,0x69,0x2B,0x8B,0xA7,0xF3,0xCE,0xFF,0x1F,0xF3,0x3E,0x26,0x01,0x39,
|
||||
0x17,0x95,0x84,0x89,0xB0,0xF0,0x4C,0x4B,0x82,0x91,0x9F,0xC4,0x4B,0xAC,0x9D,0xA5,
|
||||
0x74,0xAF,0x17,0x25,0xC9,0xCA,0x32,0xD3,0xBC,0x89,0x8A,0x84,0x89,0xCC,0x0D,0xAE,
|
||||
0x7C,0xA2,0xDB,0x9C,0x6A,0x78,0x91,0xEE,0xEA,0x76,0x5D,0x4E,0x87,0x60,0xF5,0x69,
|
||||
0x15,0x67,0xD4,0x02,0xCF,0xAF,0x48,0x36,0x07,0xEA,0xBF,0x6F,0x66,0x2D,0x06,0x8F,
|
||||
0xC4,0x9A,0xFE,0xF9,0xF6,0x90,0x87,0x75,0xB8,0xF7,0xAD,0x0F,0x76,0x10,0x5A,0x3D,
|
||||
0x59,0xB0,0x2E,0xB3,0xC7,0x35,0x2C,0xCC,0x70,0x56,0x2B,0xCB,0xE3,0x37,0x96,0xC5,
|
||||
0x2F,0x46,0x1B,0x8A,0x22,0x46,0xC7,0x88,0xA7,0x26,0x32,0x98,0x61,0xDF,0x86,0x22,
|
||||
0x8A,0xF4,0x1C,0x2F,0x87,0xA1,0x09,0xAA,0xCC,0xA9,0xAE,0xD3,0xBD,0x00,0x45,0x1C,
|
||||
0x9A,0x54,0x87,0x86,0x52,0x87,0xEF,0xFF,0x1E,0x8F,0xA1,0x8F,0xC1,0x89,0x5C,0x35,
|
||||
0x1B,0xDA,0x2D,0x3A,0x2C,0x16,0xB2,0xC2,0xF1,0x56,0xE2,0x78,0xC1,0x6B,0x63,0x97,
|
||||
0xC5,0x56,0x8F,0xC9,0x32,0x7F,0x2C,0xAA,0xAF,0xA6,0xA8,0xAC,0x20,0x91,0x22,0x88,
|
||||
0xDE,0xE4,0x60,0x8B,0xF9,0x4B,0x42,0x25,0x1A,0xE3,0x7F,0x9C,0x2C,0x19,0x89,0x3A,
|
||||
0x7E,0x05,0xD4,0x36,0xCC,0x69,0x58,0xC2,0xC1,0x32,0x8B,0x2F,0x90,0x85,0xEB,0x7A,
|
||||
0x39,0x50,0xA5,0xA1,0x27,0x92,0xC5,0x66,0xB0,0x20,0x4F,0x58,0x7E,0x55,0x83,0x43,
|
||||
0x2B,0x45,0xE2,0x9C,0xE4,0xD8,0x12,0x90,0x2C,0x16,0x83,0x56,0x16,0x79,0x03,0xB3,
|
||||
0xAD,0x2D,0x61,0x18,0x1A,0x13,0x1F,0x37,0xE2,0xE1,0x9C,0x73,0x7B,0x80,0xD5,0xFD,
|
||||
0x2D,0x51,0x87,0xFC,0x7B,0xAA,0xD7,0x1F,0x2C,0x7A,0x8E,0xAF,0xF4,0x8D,0xBB,0xCD,
|
||||
0x95,0x11,0x7C,0x72,0x0B,0xEE,0x6F,0xE2,0xB9,0xAF,0xDE,0x37,0x83,0xDE,0x8C,0x8D,
|
||||
0x62,0x05,0x67,0xB7,0x96,0xC6,0x8D,0x56,0xB6,0x0D,0xD7,0x62,0xBA,0xD6,0x46,0x36,
|
||||
0xBD,0x8E,0xC8,0xE6,0xEA,0x2A,0x6C,0x10,0x14,0xFF,0x6B,0x5B,0xFA,0x82,0x3C,0x46,
|
||||
0xB1,0x30,0x43,0x46,0x51,0x8A,0x7D,0x9B,0x92,0x3E,0x83,0x79,0x5B,0x55,0x5D,0xB2,
|
||||
0x6C,0x5E,0xCE,0x90,0x62,0x8E,0x53,0x98,0xC9,0x0D,0x6D,0xE5,0x2D,0x57,0xCD,0xC5,
|
||||
0x81,0x57,0xBA,0xE1,0xE8,0xB8,0x8F,0x72,0xE5,0x4F,0x13,0xDC,0xEA,0x9D,0x71,0x15,
|
||||
0x10,0xB2,0x11,0x88,0xD5,0x09,0xD4,0x7F,0x5B,0x65,0x7F,0x2C,0x3B,0x38,0x4C,0x11,
|
||||
0x68,0x50,0x8D,0xFB,0x9E,0xB0,0x59,0xBF,0x94,0x80,0x89,0x4A,0xC5,0x1A,0x18,0x12,
|
||||
0x89,0x53,0xD1,0x4A,0x10,0x29,0xE8,0x8C,0x1C,0xEC,0xB6,0xEA,0x46,0xC7,0x17,0x8B,
|
||||
0x25,0x15,0x31,0xA8,0xA2,0x6B,0x43,0xB1,0x9D,0xE2,0xDB,0x0B,0x87,0x9B,0xB0,0x11,
|
||||
0x04,0x0E,0x71,0xD2,0x29,0x77,0x89,0x82,0x0A,0x66,0x41,0x7F,0x1D,0x0B,0x48,0xFF,
|
||||
0x72,0xBB,0x24,0xFD,0xC2,0x48,0xA1,0x9B,0xFE,0x7B,0x7F,0xCE,0x88,0xDB,0x86,0xD9,
|
||||
0x85,0x3B,0x1C,0xB0,0xDC,0xA8,0x33,0x07,0xBF,0x51,0x2E,0xE3,0x0E,0x9A,0x00,0x97,
|
||||
0x1E,0x06,0xC0,0x97,0x43,0x9D,0xD8,0xB6,0x45,0xC4,0x86,0x67,0x5F,0x00,0xF8,0x88,
|
||||
0x9A,0xA4,0x52,0x9E,0xC7,0xAA,0x8A,0x83,0x75,0xEC,0xC5,0x18,0xAE,0xCE,0xC3,0x2F,
|
||||
0x1A,0x2B,0xF9,0x18,0xFF,0xAE,0x1A,0xF5,0x53,0x0B,0xB5,0x33,0x51,0xA7,0xFD,0xE8,
|
||||
0xA8,0xE1,0xA2,0x64,0xB6,0x22,0x17,0x43,0x80,0xCC,0x0A,0xD8,0xAE,0x3B,0xBA,0x40,
|
||||
0xD7,0xD9,0x92,0x4A,0x89,0xDF,0x04,0x10,0xEE,0x9B,0x18,0x2B,0x6A,0x77,0x69,0x8A,
|
||||
0x68,0xF4,0xF9,0xB9,0xA2,0x21,0x15,0x6E,0xE6,0x1E,0x3B,0x03,0x62,0x30,0x9B,0x60,
|
||||
0x41,0x7E,0x25,0x9B,0x9E,0x8F,0xC5,0x52,0x10,0x08,0xF8,0xC2,0x69,0xA1,0x21,0x11,
|
||||
0x88,0x37,0x5E,0x79,0x35,0x66,0xFF,0x10,0x42,0x18,0x6E,0xED,0x97,0xB6,0x6B,0x1C,
|
||||
0x4E,0x36,0xE5,0x6D,0x7D,0xB4,0xE4,0xBF,0x20,0xB9,0xE0,0x05,0x3A,0x69,0xD5,0xB8,
|
||||
0xE3,0xD5,0xDC,0xE0,0xB9,0xAC,0x53,0x3E,0x07,0xA4,0x57,0xAD,0x77,0xFF,0x48,0x18,
|
||||
0x76,0x2A,0xAC,0x49,0x2A,0x8E,0x47,0x75,0x6D,0x9F,0x67,0x63,0x30,0x35,0x8C,0x39,
|
||||
0x05,0x39,0xD5,0x6F,0x64,0x3A,0x5B,0xAD,0xCA,0x0B,0xBB,0x82,0x52,0x99,0x45,0xB1,
|
||||
0x93,0x36,0x36,0x99,0xAF,0x13,0x20,0x44,0x36,0xD8,0x02,0x44,0x09,0x39,0x92,0x85,
|
||||
0xFF,0x4A,0x4A,0x97,0x87,0xA6,0x63,0xD7,0xC7,0xB5,0xB5,0x24,0xED,0x0F,0xB4,0x6F,
|
||||
0x0C,0x58,0x52,0x14,0xD9,0xA6,0x7B,0xD3,0x79,0xBC,0x38,0x58,0xA1,0xBD,0x3B,0x84,
|
||||
0x06,0xD8,0x1A,0x06,0xFD,0x6B,0xA8,0xEA,0x4B,0x69,0x28,0x04,0x37,0xAD,0x82,0x99,
|
||||
0xFB,0x0E,0x1B,0x85,0xBD,0xA8,0x5D,0x73,0xCD,0xDC,0x58,0x75,0x0A,0xBE,0x63,0x6C,
|
||||
0x48,0xE7,0x4C,0xE4,0x30,0x2B,0x04,0x60,0xB9,0x15,0xD8,0xDA,0x86,0x81,0x75,0x8F,
|
||||
0x96,0xD4,0x8D,0x1C,0x5D,0x70,0x85,0x7C,0x1C,0x67,0x7B,0xD5,0x08,0x67,0xA6,0xCE,
|
||||
0x4B,0x0A,0x66,0x70,0xB7,0xE5,0x63,0xD4,0x5B,0x8A,0x82,0xEA,0x10,0x67,0xCA,0xE2,
|
||||
0xF4,0xEF,0x17,0x85,0x2F,0x2A,0x5F,0x8A,0x97,0x82,0xF8,0x6A,0xD6,0x34,0x10,0xEA,
|
||||
0xEB,0xC9,0x5C,0x3C,0xE1,0x49,0xF8,0x46,0xEB,0xDE,0xBD,0xF6,0xA9,0x92,0xF1,0xAA,
|
||||
0xA6,0xA0,0x18,0xB0,0x3A,0xD3,0x0F,0x1F,0xF3,0x6F,0xFF,0x31,0x45,0x43,0x44,0xD3,
|
||||
0x50,0x9A,0xF7,0x88,0x09,0x96,0xC1,0xCE,0x76,0xCC,0xF2,0x2C,0x2C,0xBA,0xAD,0x82,
|
||||
0x77,0x8F,0x18,0x84,0xC0,0xD2,0x07,0x9C,0x36,0x90,0x83,0x4E,0x0B,0xA5,0x4F,0x43,
|
||||
0x3E,0x04,0xAB,0x78,0x4F,0xD6,0xFB,0x09,0x01,0x24,0x90,0xDA,0x6F,0x3C,0x3A,0x61,
|
||||
0x0D,0x7F,0x69,0x4A,0xEB,0x2B,0x30,0x02,0xB4,0xDB,0xE0,0x84,0xA9,0xEC,0xD7,0x35,
|
||||
0xBF,0x37,0x7D,0x85,0x58,0xCE,0xA9,0x4E,0xE4,0x80,0xC7,0xA8,0xD3,0x30,0x67,0x48,
|
||||
0xEB,0x29,0xAF,0x2F,0x74,0x6A,0xB4,0xA7,0x3F,0x0F,0x3F,0x92,0xAF,0xF3,0xCA,0xAC,
|
||||
0xAF,0x4B,0xD9,0x94,0xC0,0x43,0xCA,0x81,0x0D,0x2F,0x48,0xA1,0xB0,0x27,0xD5,0xD2,
|
||||
0xEF,0x4B,0x05,0x85,0xA3,0xDE,0x4D,0x93,0x30,0x3C,0xF0,0xBB,0x4A,0x8F,0x30,0x27,
|
||||
0x4C,0xEB,0xE3,0x3E,0x64,0xED,0x9A,0x2F,0x3B,0xF1,0x82,0xF0,0xBA,0xF4,0xCF,0x7F,
|
||||
0x40,0xCB,0xB0,0xE1,0x7F,0xBC,0xAA,0x57,0xD3,0xC9,0x74,0xF2,0xFA,0x43,0x0D,0x22,
|
||||
0xD0,0xF4,0x77,0x4E,0x93,0xD7,0x85,0x70,0x1F,0x99,0xBF,0xB6,0xDE,0x35,0xF1,0x30,
|
||||
0xA7,0x5E,0x71,0xF0,0x6B,0x01,0x2D,0x7B,0x64,0xF0,0x33,0x53,0x0A,0x39,0x88,0xF3,
|
||||
0x6B,0x3A,0xA6,0x6B,0x35,0xD2,0x2F,0x43,0xCD,0x02,0xFD,0xB5,0xE9,0xBC,0x5B,0xAA,
|
||||
0xD8,0xA4,0x19,0x7E,0x0E,0x5D,0x94,0x81,0x9E,0x6F,0x77,0xAD,0xD6,0x0E,0x74,0x93,
|
||||
0x96,0xE7,0xC4,0x18,0x5F,0xAD,0xF5,0x19,
|
||||
};
|
@ -1,141 +0,0 @@
|
||||
@---------------------------------------------------------------------------------
|
||||
.section ".init"
|
||||
.global _start
|
||||
.global dsiMode
|
||||
.global language
|
||||
.global sdAccess
|
||||
.global scfgUnlock
|
||||
.global twlMode
|
||||
.global twlClock
|
||||
.global boostVram
|
||||
.global soundFreq
|
||||
.global extendRam
|
||||
.global debugMode
|
||||
@---------------------------------------------------------------------------------
|
||||
.align 4
|
||||
.arm
|
||||
@---------------------------------------------------------------------------------
|
||||
_start:
|
||||
@---------------------------------------------------------------------------------
|
||||
dsiMode:
|
||||
.word 0x00000000
|
||||
language:
|
||||
.word 0x00000000
|
||||
sdAccess:
|
||||
.word 0x00000000
|
||||
scfgUnlock:
|
||||
.word 0x00000000
|
||||
twlMode:
|
||||
.word 0x00000000
|
||||
twlClock:
|
||||
.word 0x00000000
|
||||
boostVram:
|
||||
.word 0x00000000
|
||||
soundFreq:
|
||||
.word 0x00000000
|
||||
extendRam:
|
||||
.word 0x00000000
|
||||
debugMode:
|
||||
.word 0x00000000
|
||||
|
||||
mov r0, #0x04000000
|
||||
mov r1, #0
|
||||
str r1, [r0,#0x208] @ REG_IME
|
||||
str r1, [r0,#0x210] @ REG_IE
|
||||
str r1, [r0,#0x218] @ REG_AUXIE
|
||||
|
||||
mov r0, #0x12 @ Switch to IRQ Mode
|
||||
msr cpsr, r0
|
||||
ldr sp, =__sp_irq @ Set IRQ stack
|
||||
|
||||
mov r0, #0x13 @ Switch to SVC Mode
|
||||
msr cpsr, r0
|
||||
ldr sp, =__sp_svc @ Set SVC stack
|
||||
|
||||
mov r0, #0x1F @ Switch to System Mode
|
||||
msr cpsr, r0
|
||||
ldr sp, =__sp_usr @ Set user stack
|
||||
|
||||
ldr r0, =__bss_start @ Clear BSS section to 0x00
|
||||
ldr r1, =__bss_end
|
||||
sub r1, r1, r0
|
||||
bl ClearMem
|
||||
|
||||
@ Load ARM9 region into main RAM
|
||||
ldr r1, =__arm9_source_start
|
||||
ldr r2, =__arm9_start
|
||||
ldr r3, =__arm9_source_end
|
||||
sub r3, r3, r1
|
||||
bl CopyMem
|
||||
|
||||
@ Start ARM9 binary
|
||||
ldr r0, =0x027FFE24
|
||||
ldr r1, =_arm9_start
|
||||
str r1, [r0]
|
||||
|
||||
mov r0, #0 @ int argc
|
||||
mov r1, #0 @ char *argv[]
|
||||
ldr r3, =arm7_main
|
||||
bl _blx_r3_stub @ jump to user code
|
||||
|
||||
@ If the user ever returns, restart
|
||||
b _start
|
||||
|
||||
@---------------------------------------------------------------------------------
|
||||
_blx_r3_stub:
|
||||
@---------------------------------------------------------------------------------
|
||||
bx r3
|
||||
|
||||
|
||||
@---------------------------------------------------------------------------------
|
||||
@ Clear memory to 0x00 if length != 0
|
||||
@ r0 = Start Address
|
||||
@ r1 = Length
|
||||
@---------------------------------------------------------------------------------
|
||||
ClearMem:
|
||||
@---------------------------------------------------------------------------------
|
||||
mov r2, #3 @ Round down to nearest word boundary
|
||||
add r1, r1, r2 @ Shouldn't be needed
|
||||
bics r1, r1, r2 @ Clear 2 LSB (and set Z)
|
||||
bxeq lr @ Quit if copy size is 0
|
||||
|
||||
mov r2, #0
|
||||
ClrLoop:
|
||||
stmia r0!, {r2}
|
||||
subs r1, r1, #4
|
||||
bne ClrLoop
|
||||
bx lr
|
||||
|
||||
@---------------------------------------------------------------------------------
|
||||
@ Copy memory if length != 0
|
||||
@ r1 = Source Address
|
||||
@ r2 = Dest Address
|
||||
@ r4 = Dest Address + Length
|
||||
@---------------------------------------------------------------------------------
|
||||
CopyMemCheck:
|
||||
@---------------------------------------------------------------------------------
|
||||
sub r3, r4, r2 @ Is there any data to copy?
|
||||
@---------------------------------------------------------------------------------
|
||||
@ Copy memory
|
||||
@ r1 = Source Address
|
||||
@ r2 = Dest Address
|
||||
@ r3 = Length
|
||||
@---------------------------------------------------------------------------------
|
||||
CopyMem:
|
||||
@---------------------------------------------------------------------------------
|
||||
mov r0, #3 @ These commands are used in cases where
|
||||
add r3, r3, r0 @ the length is not a multiple of 4,
|
||||
bics r3, r3, r0 @ even though it should be.
|
||||
bxeq lr @ Length is zero, so exit
|
||||
CIDLoop:
|
||||
ldmia r1!, {r0}
|
||||
stmia r2!, {r0}
|
||||
subs r3, r3, #4
|
||||
bne CIDLoop
|
||||
bx lr
|
||||
|
||||
@---------------------------------------------------------------------------------
|
||||
.align
|
||||
.pool
|
||||
.end
|
||||
@---------------------------------------------------------------------------------
|
@ -1,484 +0,0 @@
|
||||
/*
|
||||
main.arm7.c
|
||||
|
||||
By Michael Chisholm (Chishm)
|
||||
|
||||
All resetMemory and startBinary functions are based
|
||||
on the MultiNDS loader by Darkain.
|
||||
Original source available at:
|
||||
http://cvs.sourceforge.net/viewcvs.py/ndslib/ndslib/examples/loader/boot/main.cpp
|
||||
|
||||
License:
|
||||
NitroHax -- Cheat tool for the Nintendo DS
|
||||
Copyright (C) 2008 Michael "Chishm" Chisholm
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef ARM7
|
||||
# define ARM7
|
||||
#endif
|
||||
#include <nds/ndstypes.h>
|
||||
#include <nds/arm7/codec.h>
|
||||
#include <nds/system.h>
|
||||
#include <nds/interrupts.h>
|
||||
#include <nds/timers.h>
|
||||
#include <nds/dma.h>
|
||||
#include <nds/arm7/audio.h>
|
||||
#include <nds/ipc.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#include "common.h"
|
||||
#include "read_card.h"
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
External functions
|
||||
--------------------------------------------------------------------------*/
|
||||
extern void arm7_clearmem (void* loc, size_t len);
|
||||
extern void arm7_reset (void);
|
||||
|
||||
extern u32 dsiMode;
|
||||
extern u32 language;
|
||||
extern u32 sdAccess;
|
||||
extern u32 scfgUnlock;
|
||||
extern u32 twlMode;
|
||||
extern u32 twlClock;
|
||||
extern u32 boostVram;
|
||||
extern u32 soundFreq;
|
||||
extern u32 extendRam;
|
||||
extern u32 debugMode;
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// Important things
|
||||
#define NDS_HEAD 0x027FFE00
|
||||
tNDSHeader* ndsHeader = (tNDSHeader*)NDS_HEAD;
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// Used for debugging purposes
|
||||
static void errorOutput (u32 code) {
|
||||
// Set the error code, then set our state to "error"
|
||||
arm9_errorCode = code;
|
||||
ipcSendState(ARM7_ERR);
|
||||
// Stop
|
||||
while(1);
|
||||
}
|
||||
|
||||
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// Firmware stuff
|
||||
|
||||
#define FW_READ 0x03
|
||||
|
||||
void arm7_readFirmware (uint32 address, uint8 * buffer, uint32 size) {
|
||||
uint32 index;
|
||||
|
||||
// Read command
|
||||
while (REG_SPICNT & SPI_BUSY);
|
||||
REG_SPICNT = SPI_ENABLE | SPI_CONTINUOUS | SPI_DEVICE_NVRAM;
|
||||
REG_SPIDATA = FW_READ;
|
||||
while (REG_SPICNT & SPI_BUSY);
|
||||
|
||||
// Set the address
|
||||
REG_SPIDATA = (address>>16) & 0xFF;
|
||||
while (REG_SPICNT & SPI_BUSY);
|
||||
REG_SPIDATA = (address>>8) & 0xFF;
|
||||
while (REG_SPICNT & SPI_BUSY);
|
||||
REG_SPIDATA = (address) & 0xFF;
|
||||
while (REG_SPICNT & SPI_BUSY);
|
||||
|
||||
for (index = 0; index < size; index++) {
|
||||
REG_SPIDATA = 0;
|
||||
while (REG_SPICNT & SPI_BUSY);
|
||||
buffer[index] = REG_SPIDATA & 0xFF;
|
||||
}
|
||||
REG_SPICNT = 0;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
arm7_resetMemory
|
||||
Clears all of the NDS's RAM that is visible to the ARM7
|
||||
Written by Darkain.
|
||||
Modified by Chishm:
|
||||
* Added STMIA clear mem loop
|
||||
--------------------------------------------------------------------------*/
|
||||
void arm7_resetMemory (void) {
|
||||
int i;
|
||||
u8 settings1, settings2;
|
||||
|
||||
REG_IME = 0;
|
||||
|
||||
for (i=0; i<16; i++) {
|
||||
SCHANNEL_CR(i) = 0;
|
||||
SCHANNEL_TIMER(i) = 0;
|
||||
SCHANNEL_SOURCE(i) = 0;
|
||||
SCHANNEL_LENGTH(i) = 0;
|
||||
}
|
||||
REG_SOUNDCNT = 0;
|
||||
|
||||
// Clear out ARM7 DMA channels and timers
|
||||
for (i=0; i<4; i++) {
|
||||
DMA_CR(i) = 0;
|
||||
DMA_SRC(i) = 0;
|
||||
DMA_DEST(i) = 0;
|
||||
TIMER_CR(i) = 0;
|
||||
TIMER_DATA(i) = 0;
|
||||
}
|
||||
|
||||
// Clear out FIFO
|
||||
REG_IPC_SYNC = 0;
|
||||
REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR;
|
||||
REG_IPC_FIFO_CR = 0;
|
||||
|
||||
// clear IWRAM - 037F:8000 to 0380:FFFF, total 96KiB
|
||||
arm7_clearmem ((void*)0x037F8000, 96*1024);
|
||||
|
||||
// clear most of EXRAM - except after 0x023FD800, which has the ARM9 code
|
||||
arm7_clearmem ((void*)0x02000000, 0x003FD800);
|
||||
|
||||
// clear last part of EXRAM, skipping the ARM9's section
|
||||
arm7_clearmem ((void*)0x023FE000, 0x2000);
|
||||
|
||||
REG_IE = 0;
|
||||
REG_IF = ~0;
|
||||
(*(vu32*)(0x04000000-4)) = 0; //IRQ_HANDLER ARM7 version
|
||||
(*(vu32*)(0x04000000-8)) = ~0; //VBLANK_INTR_WAIT_FLAGS, ARM7 version
|
||||
REG_POWERCNT = 1; //turn off power to stuffs
|
||||
|
||||
// Reload DS Firmware settings
|
||||
arm7_readFirmware((u32)0x03FE70, &settings1, 0x1);
|
||||
arm7_readFirmware((u32)0x03FF70, &settings2, 0x1);
|
||||
|
||||
if (settings1 > settings2) {
|
||||
arm7_readFirmware((u32)0x03FE00, (u8*)0x027FFC80, 0x70);
|
||||
arm7_readFirmware((u32)0x03FF00, (u8*)0x027FFD80, 0x70);
|
||||
} else {
|
||||
arm7_readFirmware((u32)0x03FF00, (u8*)0x027FFC80, 0x70);
|
||||
arm7_readFirmware((u32)0x03FE00, (u8*)0x027FFD80, 0x70);
|
||||
}
|
||||
|
||||
// Load FW header
|
||||
arm7_readFirmware((u32)0x000000, (u8*)0x027FF830, 0x20);
|
||||
}
|
||||
|
||||
int arm7_loadBinary (void) {
|
||||
u32 chipID;
|
||||
u32 errorCode;
|
||||
|
||||
// Init card
|
||||
errorCode = cardInit(ndsHeader, &chipID);
|
||||
if (errorCode) {
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
// Set memory values expected by loaded NDS
|
||||
*((u32*)0x027ff800) = chipID; // CurrentCardID
|
||||
*((u32*)0x027ff804) = chipID; // Command10CardID
|
||||
*((u32*)0x027ffc00) = chipID; // 3rd chip ID
|
||||
*((u16*)0x027ff808) = ndsHeader->headerCRC16; // Header Checksum, CRC-16 of [000h-15Dh]
|
||||
*((u16*)0x027ff80a) = ndsHeader->secureCRC16; // Secure Area Checksum, CRC-16 of [ [20h]..7FFFh]
|
||||
*((u16*)0x027ffc40) = 0x1; // Booted from card -- EXTREMELY IMPORTANT!!! Thanks to cReDiAr
|
||||
|
||||
cardRead(ndsHeader->arm9romOffset, (u32*)ndsHeader->arm9destination, ndsHeader->arm9binarySize);
cardRead(ndsHeader->arm7romOffset, (u32*)ndsHeader->arm7destination, ndsHeader->arm7binarySize);
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
static void NDSTouchscreenMode(void) {
|
||||
|
||||
bool specialSetting = false;
|
||||
u8 volLevel;
|
||||
|
||||
static const char list[][4] = {
|
||||
"ABX", // NTR-ABXE Bomberman Land Touch!
|
||||
"YO9", // NTR-YO9J Bokura no TV Game Kentei - Pikotto! Udedameshi
|
||||
"ALH", // NTR-ALHE Flushed Away
|
||||
"ACC", // NTR-ACCE Cooking Mama
|
||||
"YCQ", // NTR-YCQE Cooking Mama 2 - Dinner with Friends
|
||||
"YYK", // NTR-YYKE Trauma Center - Under the Knife 2
|
||||
"AZW", // NTR-AZWE WarioWare - Touched!
|
||||
"AKA", // NTR-AKAE Rub Rabbits!, The
|
||||
"AN9", // NTR-AN9E Little Mermaid - Ariel's Undersea Adventure, The
|
||||
"AKE", // NTR-AKEJ Keroro Gunsou - Enshuu da Yo! Zenin Shuugou Part 2
|
||||
"YFS", // NTR-YFSJ Frogman Show - DS Datte, Shouganaijanai, The
|
||||
"YG8", // NTR-YG8E Yu-Gi-Oh! World Championship 2008
|
||||
"AY7", // NTR-AY7E Yu-Gi-Oh! World Championship 2007
|
||||
"YON", // NTR-YONJ Minna no DS Seminar - Kantan Ongakuryoku
|
||||
"A5H", // NTR-A5HE Interactive Storybook DS - Series 2
|
||||
"A5I", // NTR-A5IE Interactive Storybook DS - Series 3
|
||||
"AMH", // NTR-AMHE Metroid Prime Hunters
|
||||
"A3T", // NTR-A3TE Tak - The Great Juju Challenge
|
||||
"YBO", // NTR-YBOE Boogie
|
||||
"ADA", // NTR-ADAE PKMN Diamond
|
||||
"APA", // NTR-APAE PKMN Pearl
|
||||
"CPU", // NTR-CPUE PKMN Platinum
|
||||
"APY", // NTR-APYE Puyo Pop Fever
|
||||
"AWH", // NTR-AWHE Bubble Bobble Double Shot
|
||||
"AXB", // NTR-AXBJ Daigassou! Band Brothers DX
|
||||
"A4U", // NTR-A4UJ Wi-Fi Taiou - Morita Shogi
|
||||
"A8N", // NTR-A8NE Planet Puzzle League
|
||||
"ABJ", // NTR-ABJE Harvest Moon DS - Island of Happiness
|
||||
"ABN", // NTR-ABNE Bomberman Story DS
|
||||
"ACL", // NTR-ACLE Custom Robo Arena
|
||||
"ART", // NTR-ARTJ Shin Lucky Star Moe Drill - Tabidachi
|
||||
"AVT", // NTR-AVTJ Kou Rate Ura Mahjong Retsuden Mukoubuchi - Goburei, Shuuryou desu ne
|
||||
"AWY", // NTR-AWYJ Wi-Fi Taiou - Gensen Table Game DS
|
||||
"AXJ", // NTR-AXJE Dungeon Explorer - Warriors of Ancient Arts
|
||||
"AYK", // NTR-AYKJ Wi-Fi Taiou - Yakuman DS
|
||||
"YB2", // NTR-YB2E Bomberman Land Touch! 2
|
||||
"YB3", // NTR-YB3E Harvest Moon DS - Sunshine Islands
|
||||
"YCH", // NTR-YCHJ Kousoku Card Battle - Card Hero
|
||||
"YFE", // NTR-YFEE Fire Emblem - Shadow Dragon
|
||||
"YGD", // NTR-YGDE Diary Girl
|
||||
"YKR", // NTR-YKRJ Culdcept DS
|
||||
"YRM", // NTR-YRME My Secret World by Imagine
|
||||
"YW2", // NTR-YW2E Advance Wars - Days of Ruin
|
||||
"AJU", // NTR-AJUJ Jump! Ultimate Stars
|
||||
"ACZ", // NTR-ACZE Cars
|
||||
"AHD", // NTR-AHDE Jam Sessions
|
||||
"ANR", // NTR-ANRE Naruto - Saikyou Ninja Daikesshu 3
|
||||
"YT3", // NTR-YT3E Tamagotchi Connection - Corner Shop 3
|
||||
"AVI", // NTR-AVIJ Kodomo no Tame no Yomi Kikase - Ehon de Asobou 1-Kan
|
||||
"AV2", // NTR-AV2J Kodomo no Tame no Yomi Kikase - Ehon de Asobou 2-Kan
|
||||
"AV3", // NTR-AV3J Kodomo no Tame no Yomi Kikase - Ehon de Asobou 3-Kan
|
||||
"AV4", // NTR-AV4J Kodomo no Tame no Yomi Kikase - Ehon de Asobou 4-Kan
|
||||
"AV5", // NTR-AV5J Kodomo no Tame no Yomi Kikase - Ehon de Asobou 5-Kan
|
||||
"AV6", // NTR-AV6J Kodomo no Tame no Yomi Kikase - Ehon de Asobou 6-Kan
|
||||
"YNZ", // NTR-YNZE Petz - Dogz Fashion
|
||||
};
|
||||
|
||||
for (unsigned int i = 0; i < sizeof(list) / sizeof(list[0]); i++) {
|
||||
if (memcmp(ndsHeader->gameCode, list[i], 3) == 0) {
|
||||
// Found a match.
|
||||
specialSetting = true; // Special setting (when found special gamecode)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (specialSetting) {
|
||||
// special setting (when found special gamecode)
|
||||
volLevel = 0xAC;
|
||||
} else {
|
||||
// normal setting (for any other gamecodes)
|
||||
volLevel = 0xA7;
|
||||
}
|
||||
|
||||
// Touchscreen
|
||||
cdcReadReg (0x63, 0x00);
|
||||
cdcWriteReg(CDC_CONTROL, 0x3A, 0x00);
|
||||
cdcReadReg (CDC_CONTROL, 0x51);
|
||||
cdcReadReg (CDC_TOUCHCNT, 0x02);
|
||||
cdcReadReg (CDC_CONTROL, 0x3F);
|
||||
cdcReadReg (CDC_SOUND, 0x28);
|
||||
cdcReadReg (CDC_SOUND, 0x2A);
|
||||
cdcReadReg (CDC_SOUND, 0x2E);
|
||||
cdcWriteReg(CDC_CONTROL, 0x52, 0x80);
|
||||
cdcWriteReg(CDC_CONTROL, 0x40, 0x0C);
|
||||
cdcWriteReg(CDC_SOUND, 0x24, 0xFF);
|
||||
cdcWriteReg(CDC_SOUND, 0x25, 0xFF);
|
||||
cdcWriteReg(CDC_SOUND, 0x26, 0x7F);
|
||||
cdcWriteReg(CDC_SOUND, 0x27, 0x7F);
|
||||
cdcWriteReg(CDC_SOUND, 0x28, 0x4A);
|
||||
cdcWriteReg(CDC_SOUND, 0x29, 0x4A);
|
||||
cdcWriteReg(CDC_SOUND, 0x2A, 0x10);
|
||||
cdcWriteReg(CDC_SOUND, 0x2B, 0x10);
|
||||
cdcWriteReg(CDC_CONTROL, 0x51, 0x00);
|
||||
cdcReadReg (CDC_TOUCHCNT, 0x02);
|
||||
cdcWriteReg(CDC_TOUCHCNT, 0x02, 0x98);
|
||||
cdcWriteReg(CDC_SOUND, 0x23, 0x00);
|
||||
cdcWriteReg(CDC_SOUND, 0x1F, 0x14);
|
||||
cdcWriteReg(CDC_SOUND, 0x20, 0x14);
|
||||
cdcWriteReg(CDC_CONTROL, 0x3F, 0x00);
|
||||
cdcReadReg (CDC_CONTROL, 0x0B);
|
||||
cdcWriteReg(CDC_CONTROL, 0x05, 0x00);
|
||||
cdcWriteReg(CDC_CONTROL, 0x0B, 0x01);
|
||||
cdcWriteReg(CDC_CONTROL, 0x0C, 0x02);
|
||||
cdcWriteReg(CDC_CONTROL, 0x12, 0x01);
|
||||
cdcWriteReg(CDC_CONTROL, 0x13, 0x02);
|
||||
cdcWriteReg(CDC_SOUND, 0x2E, 0x00);
|
||||
cdcWriteReg(CDC_CONTROL, 0x3A, 0x60);
|
||||
cdcWriteReg(CDC_CONTROL, 0x01, 0x01);
|
||||
cdcWriteReg(CDC_CONTROL, 0x39, 0x66);
|
||||
cdcReadReg (CDC_SOUND, 0x20);
|
||||
cdcWriteReg(CDC_SOUND, 0x20, 0x10);
|
||||
cdcWriteReg(CDC_CONTROL, 0x04, 0x00);
|
||||
cdcWriteReg(CDC_CONTROL, 0x12, 0x81);
|
||||
cdcWriteReg(CDC_CONTROL, 0x13, 0x82);
|
||||
cdcWriteReg(CDC_CONTROL, 0x51, 0x82);
|
||||
cdcWriteReg(CDC_CONTROL, 0x51, 0x00);
|
||||
cdcWriteReg(CDC_CONTROL, 0x04, 0x03);
|
||||
cdcWriteReg(CDC_CONTROL, 0x05, 0xA1);
|
||||
cdcWriteReg(CDC_CONTROL, 0x06, 0x15);
|
||||
cdcWriteReg(CDC_CONTROL, 0x0B, 0x87);
|
||||
cdcWriteReg(CDC_CONTROL, 0x0C, 0x83);
|
||||
cdcWriteReg(CDC_CONTROL, 0x12, 0x87);
|
||||
cdcWriteReg(CDC_CONTROL, 0x13, 0x83);
|
||||
cdcReadReg (CDC_TOUCHCNT, 0x10);
|
||||
cdcWriteReg(CDC_TOUCHCNT, 0x10, 0x08);
|
||||
cdcWriteReg(0x04, 0x08, 0x7F);
|
||||
cdcWriteReg(0x04, 0x09, 0xE1);
|
||||
cdcWriteReg(0x04, 0x0A, 0x80);
|
||||
cdcWriteReg(0x04, 0x0B, 0x1F);
|
||||
cdcWriteReg(0x04, 0x0C, 0x7F);
|
||||
cdcWriteReg(0x04, 0x0D, 0xC1);
|
||||
cdcWriteReg(CDC_CONTROL, 0x41, 0x08);
|
||||
cdcWriteReg(CDC_CONTROL, 0x42, 0x08);
|
||||
cdcWriteReg(CDC_CONTROL, 0x3A, 0x00);
|
||||
cdcWriteReg(0x04, 0x08, 0x7F);
|
||||
cdcWriteReg(0x04, 0x09, 0xE1);
|
||||
cdcWriteReg(0x04, 0x0A, 0x80);
|
||||
cdcWriteReg(0x04, 0x0B, 0x1F);
|
||||
cdcWriteReg(0x04, 0x0C, 0x7F);
|
||||
cdcWriteReg(0x04, 0x0D, 0xC1);
|
||||
cdcWriteReg(CDC_SOUND, 0x2F, 0x2B);
|
||||
cdcWriteReg(CDC_SOUND, 0x30, 0x40);
|
||||
cdcWriteReg(CDC_SOUND, 0x31, 0x40);
|
||||
cdcWriteReg(CDC_SOUND, 0x32, 0x60);
|
||||
cdcReadReg (CDC_CONTROL, 0x74);
|
||||
cdcWriteReg(CDC_CONTROL, 0x74, 0x02);
|
||||
cdcReadReg (CDC_CONTROL, 0x74);
|
||||
cdcWriteReg(CDC_CONTROL, 0x74, 0x10);
|
||||
cdcReadReg (CDC_CONTROL, 0x74);
|
||||
cdcWriteReg(CDC_CONTROL, 0x74, 0x40);
|
||||
cdcWriteReg(CDC_SOUND, 0x21, 0x20);
|
||||
cdcWriteReg(CDC_SOUND, 0x22, 0xF0);
|
||||
cdcReadReg (CDC_CONTROL, 0x51);
|
||||
cdcReadReg (CDC_CONTROL, 0x3F);
|
||||
cdcWriteReg(CDC_CONTROL, 0x3F, 0xD4);
|
||||
cdcWriteReg(CDC_SOUND, 0x23, 0x44);
|
||||
cdcWriteReg(CDC_SOUND, 0x1F, 0xD4);
|
||||
cdcWriteReg(CDC_SOUND, 0x28, 0x4E);
|
||||
cdcWriteReg(CDC_SOUND, 0x29, 0x4E);
|
||||
cdcWriteReg(CDC_SOUND, 0x24, 0x9E);
|
||||
cdcWriteReg(CDC_SOUND, 0x25, 0x9E);
|
||||
cdcWriteReg(CDC_SOUND, 0x20, 0xD4);
|
||||
cdcWriteReg(CDC_SOUND, 0x2A, 0x14);
|
||||
cdcWriteReg(CDC_SOUND, 0x2B, 0x14);
|
||||
cdcWriteReg(CDC_SOUND, 0x26, 0xA7);
|
||||
cdcWriteReg(CDC_SOUND, 0x27, 0xA7);
|
||||
cdcWriteReg(CDC_CONTROL, 0x40, 0x00);
|
||||
cdcWriteReg(CDC_CONTROL, 0x3A, 0x60);
|
||||
cdcWriteReg(CDC_SOUND, 0x26, volLevel);
|
||||
cdcWriteReg(CDC_SOUND, 0x27, volLevel);
|
||||
cdcWriteReg(CDC_SOUND, 0x2E, 0x03);
|
||||
cdcWriteReg(CDC_TOUCHCNT, 0x03, 0x00);
|
||||
cdcWriteReg(CDC_SOUND, 0x21, 0x20);
|
||||
cdcWriteReg(CDC_SOUND, 0x22, 0xF0);
|
||||
cdcReadReg (CDC_SOUND, 0x22);
|
||||
cdcWriteReg(CDC_SOUND, 0x22, 0x00);
|
||||
cdcWriteReg(CDC_CONTROL, 0x52, 0x80);
|
||||
cdcWriteReg(CDC_CONTROL, 0x51, 0x00);
|
||||
|
||||
// Set remaining values
|
||||
cdcWriteReg(CDC_CONTROL, 0x03, 0x44);
|
||||
cdcWriteReg(CDC_CONTROL, 0x0D, 0x00);
|
||||
cdcWriteReg(CDC_CONTROL, 0x0E, 0x80);
|
||||
cdcWriteReg(CDC_CONTROL, 0x0F, 0x80);
|
||||
cdcWriteReg(CDC_CONTROL, 0x10, 0x08);
|
||||
cdcWriteReg(CDC_CONTROL, 0x14, 0x80);
|
||||
cdcWriteReg(CDC_CONTROL, 0x15, 0x80);
|
||||
cdcWriteReg(CDC_CONTROL, 0x16, 0x04);
|
||||
cdcWriteReg(CDC_CONTROL, 0x1A, 0x01);
|
||||
cdcWriteReg(CDC_CONTROL, 0x1E, 0x01);
|
||||
cdcWriteReg(CDC_CONTROL, 0x24, 0x80);
|
||||
cdcWriteReg(CDC_CONTROL, 0x33, 0x34);
|
||||
cdcWriteReg(CDC_CONTROL, 0x34, 0x32);
|
||||
cdcWriteReg(CDC_CONTROL, 0x35, 0x12);
|
||||
cdcWriteReg(CDC_CONTROL, 0x36, 0x03);
|
||||
cdcWriteReg(CDC_CONTROL, 0x37, 0x02);
|
||||
cdcWriteReg(CDC_CONTROL, 0x38, 0x03);
|
||||
cdcWriteReg(CDC_CONTROL, 0x3C, 0x19);
|
||||
cdcWriteReg(CDC_CONTROL, 0x3D, 0x05);
|
||||
cdcWriteReg(CDC_CONTROL, 0x44, 0x0F);
|
||||
cdcWriteReg(CDC_CONTROL, 0x45, 0x38);
|
||||
cdcWriteReg(CDC_CONTROL, 0x49, 0x00);
|
||||
cdcWriteReg(CDC_CONTROL, 0x4A, 0x00);
|
||||
cdcWriteReg(CDC_CONTROL, 0x4B, 0xEE);
|
||||
cdcWriteReg(CDC_CONTROL, 0x4C, 0x10);
|
||||
cdcWriteReg(CDC_CONTROL, 0x4D, 0xD8);
|
||||
cdcWriteReg(CDC_CONTROL, 0x4E, 0x7E);
|
||||
cdcWriteReg(CDC_CONTROL, 0x4F, 0xE3);
|
||||
cdcWriteReg(CDC_CONTROL, 0x58, 0x7F);
|
||||
cdcWriteReg(CDC_CONTROL, 0x74, 0xD2);
|
||||
cdcWriteReg(CDC_CONTROL, 0x75, 0x2C);
|
||||
cdcWriteReg(CDC_SOUND, 0x22, 0x70);
|
||||
cdcWriteReg(CDC_SOUND, 0x2C, 0x20);
|
||||
|
||||
// Finish up!
|
||||
cdcReadReg (CDC_TOUCHCNT, 0x02);
|
||||
cdcWriteReg(CDC_TOUCHCNT, 0x02, 0x98);
|
||||
cdcWriteReg(0xFF, 0x05, 0x00); //writeTSC(0x00, 0xFF);
|
||||
|
||||
// Power management
|
||||
writePowerManagement(PM_READ_REGISTER, 0x00); //*(unsigned char*)0x40001C2 = 0x80, 0x00; // read PWR[0] ;<-- also part of TSC !
|
||||
writePowerManagement(PM_CONTROL_REG, 0x0D); //*(unsigned char*)0x40001C2 = 0x00, 0x0D; // PWR[0]=0Dh ;<-- also part of TSC !
|
||||
}
|
||||
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// Main function
|
||||
|
||||
void arm7_main (void) {
|
||||
|
||||
arm9_DebugMode = debugMode;
|
||||
|
||||
NDSTouchscreenMode();
|
||||
*(u16*)0x4000500 = 0x807F;
|
||||
|
||||
*((vu32*)REG_MBK1)=0x8D898581;
|
||||
*((vu32*)REG_MBK2)=0x8C888480;
|
||||
*((vu32*)REG_MBK3)=0x9C989490;
|
||||
*((vu32*)REG_MBK4)=0x8C888480;
|
||||
*((vu32*)REG_MBK5)=0x9C989490;
|
||||
|
||||
REG_MBK6=0x09403900;
|
||||
REG_MBK7=0x09803940;
|
||||
REG_MBK8=0x09C03980;
|
||||
REG_MBK9=0xFCFFFF0F;
|
||||
|
||||
REG_SCFG_ROM = 0x703;
|
||||
REG_SCFG_EXT = 0x92A00000;
|
||||
|
||||
if (twlClock) { REG_SCFG_CLK = 0x0185; } else { REG_SCFG_CLK = 0x0101; }
|
||||
if (scfgUnlock) { REG_SCFG_EXT |= BIT(18); } else { REG_SCFG_EXT &= ~(1UL << 31); }
|
||||
|
||||
int errorCode;
|
||||
|
||||
// Synchronise start
|
||||
while (ipcRecvState() != ARM9_START) { }
|
||||
|
||||
ipcSendState(ARM7_START);
|
||||
|
||||
// Wait until ARM9 is ready
|
||||
while (ipcRecvState() != ARM9_READY) { }
|
||||
|
||||
ipcSendState(ARM7_MEMCLR);
|
||||
|
||||
// Get ARM7 to clear RAM
|
||||
arm7_resetMemory();
|
||||
|
||||
ipcSendState(ARM7_LOADBIN);
|
||||
|
||||
// Load the NDS file
|
||||
|
||||
errorCode = arm7_loadBinary();
|
||||
|
||||
if (errorCode & arm9_DebugMode) errorOutput(errorCode);
|
||||
|
||||
ipcSendState(ARM7_BOOTBIN);
|
||||
|
||||
arm7_reset();
|
||||
}
|
||||
|
@ -1,229 +0,0 @@
|
||||
/*
|
||||
main.arm9.c
|
||||
|
||||
By Michael Chisholm (Chishm)
|
||||
|
||||
All resetMemory and startBinary functions are based
|
||||
on the MultiNDS loader by Darkain.
|
||||
Original source available at:
|
||||
http://cvs.sourceforge.net/viewcvs.py/ndslib/ndslib/examples/loader/boot/main.cpp
|
||||
|
||||
License:
|
||||
NitroHax -- Cheat tool for the Nintendo DS
|
||||
Copyright (C) 2008 Michael "Chishm" Chisholm
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#define ARM9
|
||||
#undef ARM7
|
||||
#include <nds/memory.h>
|
||||
#include <nds/arm9/video.h>
|
||||
#include <nds/arm9/input.h>
|
||||
#include <nds/interrupts.h>
|
||||
#include <nds/dma.h>
|
||||
#include <nds/timers.h>
|
||||
#include <nds/system.h>
|
||||
#include <nds/ipc.h>
|
||||
|
||||
#include <nds/dma.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
bool arm9_DebugMode = false;
|
||||
|
||||
volatile int arm9_stateFlag = ARM9_BOOT;
|
||||
volatile u32 arm9_errorCode = 0xFFFFFFFF;
|
||||
volatile bool arm9_errorClearBG = false;
|
||||
volatile u32 arm9_BLANK_RAM = 0;
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
External functions
|
||||
--------------------------------------------------------------------------*/
|
||||
extern void arm9_clearCache(void);
|
||||
extern void arm9_reset (void);
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
arm9_errorOutput
|
||||
Displays an error code on screen.
|
||||
|
||||
Each box is 2 bits, and left-to-right is most-significant bits to least.
|
||||
Red = 00, Yellow = 01, Green = 10, Blue = 11
|
||||
|
||||
Written by Chishm
|
||||
--------------------------------------------------------------------------*/
|
||||
|
||||
static void arm9_errorOutput (u32 code) {
|
||||
int i, j, k;
|
||||
u16 colour;
|
||||
|
||||
REG_POWERCNT = (u16)(POWER_LCD | POWER_2D_A);
|
||||
REG_DISPCNT = MODE_FB0;
|
||||
VRAM_A_CR = VRAM_ENABLE;
|
||||
|
||||
// Clear display
|
||||
for (i = 0; i < 256*192; i++) { VRAM_A[i] = 0x0000; }
|
||||
|
||||
// Draw boxes of colour, signifying error codes
|
||||
|
||||
if ((code >> 16) != 0) {
|
||||
// high 16 bits
|
||||
for (i = 0; i < 8; i++) { // Pair of bits to use
|
||||
if (((code>>(30-2*i))&3) == 0) {
|
||||
colour = 0x001F; // Red
|
||||
} else if (((code>>(30-2*i))&3) == 1) {
|
||||
colour = 0x03FF; // Yellow
|
||||
} else if (((code>>(30-2*i))&3) == 2) {
|
||||
colour = 0x03E0; // Green
|
||||
} else {
|
||||
colour = 0x7C00; // Blue
|
||||
}
|
||||
for (j = 71; j < 87; j++) { // Row
|
||||
for (k = 32*i+8; k < 32*i+24; k++) { // Column
|
||||
VRAM_A[j*256+k] = colour;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Low 16 bits
|
||||
for (i = 0; i < 8; i++) { // Pair of bits to use
|
||||
if (((code>>(14-2*i))&3) == 0) {
|
||||
colour = 0x001F; // Red
|
||||
} else if (((code>>(14-2*i))&3) == 1) {
|
||||
colour = 0x03FF; // Yellow
|
||||
} else if (((code>>(14-2*i))&3) == 2) {
|
||||
colour = 0x03E0; // Green
|
||||
} else {
|
||||
colour = 0x7C00; // Blue
|
||||
}
|
||||
for (j = 103; j < 119; j++) { // Row
|
||||
for (k = 32*i+8; k < 32*i+24; k++) { // Column
|
||||
VRAM_A[j*256+k] = colour;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
arm9_main
|
||||
Clears the ARM9's icahce and dcache
|
||||
Clears the ARM9's DMA channels and resets video memory
|
||||
Jumps to the ARM9 NDS binary in sync with the ARM7
|
||||
Written by Darkain, modified by Chishm
|
||||
--------------------------------------------------------------------------*/
|
||||
void arm9_main (void) {
|
||||
|
||||
register int i;
|
||||
|
||||
//set shared ram to ARM7
|
||||
WRAM_CR = 0x03;
|
||||
REG_EXMEMCNT = 0xE880;
|
||||
|
||||
// Disable interrupts
|
||||
REG_IME = 0;
|
||||
REG_IE = 0;
|
||||
REG_IF = ~0;
|
||||
|
||||
// Synchronise start
|
||||
ipcSendState(ARM9_START);
|
||||
while (ipcRecvState() != ARM7_START);
|
||||
|
||||
ipcSendState(ARM9_MEMCLR);
|
||||
|
||||
arm9_clearCache();
|
||||
|
||||
for (i=0; i<16*1024; i+=4) { //first 16KB
|
||||
(*(vu32*)(i+0x00000000)) = 0x00000000; //clear ITCM
|
||||
(*(vu32*)(i+0x00800000)) = 0x00000000; //clear DTCM
|
||||
}
|
||||
|
||||
for (i=16*1024; i<32*1024; i+=4) { //second 16KB
|
||||
(*(vu32*)(i+0x00000000)) = 0x00000000; //clear ITCM
|
||||
}
|
||||
|
||||
(*(vu32*)0x00803FFC) = 0; //IRQ_HANDLER ARM9 version
|
||||
(*(vu32*)0x00803FF8) = ~0; //VBLANK_INTR_WAIT_FLAGS ARM9 version
|
||||
|
||||
|
||||
// Clear out FIFO
|
||||
REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR;
|
||||
REG_IPC_FIFO_CR = 0;
|
||||
|
||||
// Blank out VRAM
|
||||
VRAM_A_CR = 0x80;
|
||||
VRAM_B_CR = 0x80;
|
||||
// Don't mess with the VRAM used for execution
|
||||
// VRAM_C_CR = 0;
|
||||
VRAM_D_CR = 0x80;
|
||||
VRAM_E_CR = 0x80;
|
||||
VRAM_F_CR = 0x80;
|
||||
VRAM_G_CR = 0x80;
|
||||
VRAM_H_CR = 0x80;
|
||||
VRAM_I_CR = 0x80;
|
||||
BG_PALETTE[0] = 0xFFFF;
|
||||
dmaFill((void*)&arm9_BLANK_RAM, BG_PALETTE+1, (2*1024)-2);
|
||||
dmaFill((void*)&arm9_BLANK_RAM, OAM, 2*1024);
|
||||
dmaFill((void*)&arm9_BLANK_RAM, VRAM_A, 256*1024); // Banks A, B
|
||||
dmaFill((void*)&arm9_BLANK_RAM, VRAM_D, 272*1024); // Banks D, E, F, G, H, I
|
||||
|
||||
// Clear out display registers
|
||||
vu16 *mainregs = (vu16*)0x04000000;
|
||||
vu16 *subregs = (vu16*)0x04001000;
|
||||
for (i=0; i<43; i++) {
|
||||
mainregs[i] = 0;
|
||||
subregs[i] = 0;
|
||||
}
|
||||
|
||||
// Clear out ARM9 DMA channels
|
||||
for (i=0; i<4; i++) {
|
||||
DMA_CR(i) = 0;
|
||||
DMA_SRC(i) = 0;
|
||||
DMA_DEST(i) = 0;
|
||||
TIMER_CR(i) = 0;
|
||||
TIMER_DATA(i) = 0;
|
||||
}
|
||||
|
||||
REG_DISPSTAT = 0;
|
||||
videoSetMode(0);
|
||||
videoSetModeSub(0);
|
||||
VRAM_A_CR = 0;
|
||||
VRAM_B_CR = 0;
|
||||
// Don't mess with the VRAM used for execution
|
||||
// VRAM_C_CR = 0;
|
||||
VRAM_D_CR = 0;
|
||||
VRAM_E_CR = 0;
|
||||
VRAM_F_CR = 0;
|
||||
VRAM_G_CR = 0;
|
||||
VRAM_H_CR = 0;
|
||||
VRAM_I_CR = 0;
|
||||
REG_POWERCNT = 0x820F;
|
||||
|
||||
// set ARM9 state to ready and wait for instructions from ARM7
|
||||
ipcSendState(ARM9_READY);
|
||||
|
||||
if (arm9_DebugMode) {
|
||||
while (ipcRecvState() != ARM7_BOOTBIN) {
|
||||
if (ipcRecvState() == ARM7_ERR) {
|
||||
arm9_errorOutput (arm9_errorCode);
|
||||
// Halt after displaying error code
|
||||
while(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
arm9_reset();
|
||||
}
|
||||
|
@ -1,54 +0,0 @@
|
||||
#include <nds/asminc.h>
|
||||
|
||||
@This code comes from a post by CaitSith2 at gbadev.org - THANKS!!
|
||||
@
|
||||
@Code to dump the complete Nintendo DS ARM7 bios, including the
|
||||
@first 0x1204 bytes residing in the secure area.
|
||||
@
|
||||
@The ARM7 bios has read protection where 0x(Word)[FFFF(Half word)[FF(Byte)[FF]]]
|
||||
@is returned, if any reads are attempted while PC is outside the arm7 bios range.
|
||||
@
|
||||
@Additionally, if the PC is outside the 0x0000 - 0x1204 range, that range of the bios
|
||||
@is completely locked out from reading.
|
||||
|
||||
|
||||
@ void readBios (u8* dest, u32 src, u32 size)
|
||||
|
||||
.arm
|
||||
|
||||
BEGIN_ASM_FUNC readBios
|
||||
adr r3,bios_dump+1
|
||||
bx r3
|
||||
.thumb
|
||||
|
||||
bios_dump:
|
||||
push {r4-r7,lr} @Even though we don't use R7, the code we are jumping to is going
|
||||
@trash R7, therefore, we must save it.
|
||||
mov r5, r1 @ src
|
||||
sub r1, r2, #1 @ size
|
||||
mov r2, r0 @ dest
|
||||
ldr r0,=0x5ED @The code that will be made to read the full bios resides here.
|
||||
|
||||
loop:
|
||||
mov r6,#0x12 @We Subtract 12 from the location we wish to read
|
||||
sub r3,r1,r6 @because the code at 0x5EC is LDRB R3, [R3,#0x12]
|
||||
add r3, r3, r5
|
||||
adr r6,ret
|
||||
push {r2-r6} @The line of code at 0x5EE is POP {R2,R4,R6,R7,PC}
|
||||
bx r0
|
||||
.align
|
||||
|
||||
ret:
|
||||
strb r3,[r2,r1] @Store the read byte contained in r3, to SRAM.
|
||||
sub r1,#1 @Subtract 1
|
||||
bpl loop @And branch as long as R1 doesn't roll into -1 (0xFFFFFFFF).
|
||||
|
||||
pop {r4-r7} @Restore the saved registers
|
||||
pop {r3} @and return.
|
||||
bx r3
|
||||
|
||||
.END
|
||||
|
||||
@The exact code that resides at 0x5EC (secure area range) of the arm7 bios.
|
||||
@ROM:000005EC 9B 7C LDRB R3, [R3,#0x12]
|
||||
@ROM:000005EE D4 BD POP {R2,R4,R6,R7,PC}
|
@ -1,303 +0,0 @@
|
||||
/*
|
||||
NitroHax -- Cheat tool for the Nintendo DS
|
||||
Copyright (C) 2008 Michael "Chishm" Chisholm
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "read_card.h"
|
||||
|
||||
#include <nds.h>
|
||||
#include <nds/arm9/cache.h>
|
||||
#include <nds/dma.h>
|
||||
#include <nds/card.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "encryption.h"
|
||||
#include "common.h"
|
||||
|
||||
typedef union
|
||||
{
|
||||
char title[4];
|
||||
u32 key;
|
||||
} GameCode;
|
||||
|
||||
static u32 portFlags = 0;
|
||||
static u32 secureAreaData[CARD_SECURE_AREA_SIZE/sizeof(u32)];
|
||||
|
||||
static const u8 cardSeedBytes[] = {0xE8, 0x4D, 0x5A, 0xB1, 0x17, 0x8F, 0x99, 0xD5};
|
||||
|
||||
static u32 getRandomNumber(void) {
|
||||
return 4; // chosen by fair dice roll.
|
||||
// guaranteed to be random.
|
||||
}
|
||||
|
||||
static void decryptSecureArea (u32 gameCode, u32* secureArea)
|
||||
{
|
||||
int i;
|
||||
|
||||
init_keycode (gameCode, 2, 8);
|
||||
crypt_64bit_down (secureArea);
|
||||
|
||||
init_keycode (gameCode, 3, 8);
|
||||
|
||||
for (i = 0; i < 0x200; i+= 2) {
|
||||
crypt_64bit_down (secureArea + i);
|
||||
}
|
||||
}
|
||||
|
||||
static struct {
|
||||
unsigned int iii;
|
||||
unsigned int jjj;
|
||||
unsigned int kkkkk;
|
||||
unsigned int llll;
|
||||
unsigned int mmm;
|
||||
unsigned int nnn;
|
||||
} key1data;
|
||||
|
||||
|
||||
static void initKey1Encryption (u8* cmdData) {
|
||||
key1data.iii = getRandomNumber() & 0x00000fff;
|
||||
key1data.jjj = getRandomNumber() & 0x00000fff;
|
||||
key1data.kkkkk = getRandomNumber() & 0x000fffff;
|
||||
key1data.llll = getRandomNumber() & 0x0000ffff;
|
||||
key1data.mmm = getRandomNumber() & 0x00000fff;
|
||||
key1data.nnn = getRandomNumber() & 0x00000fff;
|
||||
|
||||
cmdData[7] = CARD_CMD_ACTIVATE_BF;
|
||||
cmdData[6] = (u8) (key1data.iii >> 4);
|
||||
cmdData[5] = (u8) ((key1data.iii << 4) | (key1data.jjj >> 8));
|
||||
cmdData[4] = (u8) key1data.jjj;
|
||||
cmdData[3] = (u8) (key1data.kkkkk >> 16);
|
||||
cmdData[2] = (u8) (key1data.kkkkk >> 8);
|
||||
cmdData[1] = (u8) key1data.kkkkk;
|
||||
cmdData[0] = (u8) getRandomNumber();
|
||||
}
|
||||
|
||||
// Note: cmdData must be aligned on a word boundary
|
||||
static void createEncryptedCommand (u8 command, u8* cmdData, u32 block)
|
||||
{
|
||||
unsigned long iii, jjj;
|
||||
|
||||
if (command != CARD_CMD_SECURE_READ) {
|
||||
block = key1data.llll;
|
||||
}
|
||||
|
||||
if (command == CARD_CMD_ACTIVATE_SEC) {
|
||||
iii = key1data.mmm;
|
||||
jjj = key1data.nnn;
|
||||
} else {
|
||||
iii = key1data.iii;
|
||||
jjj = key1data.jjj;
|
||||
}
|
||||
|
||||
cmdData[7] = (u8) (command | (block >> 12));
|
||||
cmdData[6] = (u8) (block >> 4);
|
||||
cmdData[5] = (u8) ((block << 4) | (iii >> 8));
|
||||
cmdData[4] = (u8) iii;
|
||||
cmdData[3] = (u8) (jjj >> 4);
|
||||
cmdData[2] = (u8) ((jjj << 4) | (key1data.kkkkk >> 16));
|
||||
cmdData[1] = (u8) (key1data.kkkkk >> 8);
|
||||
cmdData[0] = (u8) key1data.kkkkk;
|
||||
|
||||
crypt_64bit_up ((u32*)cmdData);
|
||||
|
||||
key1data.kkkkk += 1;
|
||||
}
|
||||
|
||||
static void cardDelay (u16 readTimeout) {
|
||||
/* Using a while loop to check the timeout,
|
||||
so we have to wait until one before overflow.
|
||||
This also requires an extra 1 for the timer data.
|
||||
See GBATek for the normal formula used for card timeout.
|
||||
*/
|
||||
TIMER_DATA(0) = 0 - (((readTimeout & 0x3FFF) + 3));
|
||||
TIMER_CR(0) = TIMER_DIV_256 | TIMER_ENABLE;
|
||||
while (TIMER_DATA(0) != 0xFFFF);
|
||||
|
||||
// Clear out the timer registers
|
||||
TIMER_CR(0) = 0;
|
||||
TIMER_DATA(0) = 0;
|
||||
}
|
||||
|
||||
|
||||
int cardInit (tNDSHeader* ndsHeader, u32* chipID)
|
||||
{
|
||||
u32 portFlagsKey1, portFlagsSecRead;
|
||||
bool normalChip; // As defined by GBAtek, normal chip secure area is accessed in blocks of 0x200, other chip in blocks of 0x1000
|
||||
u32* secureArea;
|
||||
int secureBlockNumber;
|
||||
int i;
|
||||
u8 cmdData[8] __attribute__ ((aligned));
|
||||
GameCode* gameCode;
|
||||
|
||||
// Dummy command sent after card reset
|
||||
cardParamCommand (CARD_CMD_DUMMY, 0,
|
||||
CARD_ACTIVATE | CARD_nRESET | CARD_CLK_SLOW | CARD_BLK_SIZE(1) | CARD_DELAY1(0x1FFF) | CARD_DELAY2(0x3F),
|
||||
NULL, 0);
|
||||
|
||||
// Read the header
|
||||
cardParamCommand (CARD_CMD_HEADER_READ, 0,
|
||||
CARD_ACTIVATE | CARD_nRESET | CARD_CLK_SLOW | CARD_BLK_SIZE(1) | CARD_DELAY1(0x1FFF) | CARD_DELAY2(0x3F),
|
||||
(uint32*)ndsHeader, sizeof(tNDSHeader));
|
||||
|
||||
// Check header CRC
|
||||
if (ndsHeader->headerCRC16 != swiCRC16(0xFFFF, (void*)ndsHeader, 0x15E)) {
|
||||
return ERR_HEAD_CRC;
|
||||
}
|
||||
|
||||
/*
|
||||
// Check logo CRC
|
||||
if (ndsHeader->logoCRC16 != 0xCF56) {
|
||||
return ERR_LOGO_CRC;
|
||||
}
|
||||
*/
|
||||
|
||||
// Initialise blowfish encryption for KEY1 commands and decrypting the secure area
|
||||
gameCode = (GameCode*)ndsHeader->gameCode;
|
||||
init_keycode (gameCode->key, 2, 8);
|
||||
|
||||
// Port 40001A4h setting for normal reads (command B7)
|
||||
portFlags = ndsHeader->cardControl13 & ~CARD_BLK_SIZE(7);
|
||||
// Port 40001A4h setting for KEY1 commands (usually 001808F8h)
|
||||
portFlagsKey1 = CARD_ACTIVATE | CARD_nRESET | (ndsHeader->cardControl13 & (CARD_WR|CARD_CLK_SLOW)) |
|
||||
((ndsHeader->cardControlBF & (CARD_CLK_SLOW|CARD_DELAY1(0x1FFF))) + ((ndsHeader->cardControlBF & CARD_DELAY2(0x3F)) >> 16));
|
||||
|
||||
// 1st Get ROM Chip ID
|
||||
cardParamCommand (CARD_CMD_HEADER_CHIPID, 0,
|
||||
(ndsHeader->cardControl13 & (CARD_WR|CARD_nRESET|CARD_CLK_SLOW)) | CARD_ACTIVATE | CARD_BLK_SIZE(7),
|
||||
chipID, sizeof(u32));
|
||||
|
||||
// Adjust card transfer method depending on the most significant bit of the chip ID
|
||||
normalChip = ((*chipID) & 0x80000000) != 0; // ROM chip ID MSB
|
||||
if (!normalChip) {
|
||||
portFlagsKey1 |= CARD_SEC_LARGE;
|
||||
}
|
||||
|
||||
// 3Ciiijjj xkkkkkxx - Activate KEY1 Encryption Mode
|
||||
initKey1Encryption (cmdData);
|
||||
cardPolledTransfer((ndsHeader->cardControl13 & (CARD_WR|CARD_nRESET|CARD_CLK_SLOW)) | CARD_ACTIVATE, NULL, 0, cmdData);
|
||||
|
||||
// 4llllmmm nnnkkkkk - Activate KEY2 Encryption Mode
|
||||
createEncryptedCommand (CARD_CMD_ACTIVATE_SEC, cmdData, 0);
|
||||
|
||||
if (normalChip) {
|
||||
cardPolledTransfer(portFlagsKey1, NULL, 0, cmdData);
|
||||
cardDelay(ndsHeader->readTimeout);
|
||||
cardPolledTransfer(portFlagsKey1, NULL, 0, cmdData);
|
||||
} else {
|
||||
cardPolledTransfer(portFlagsKey1, NULL, 0, cmdData);
|
||||
}
|
||||
|
||||
// Set the KEY2 encryption registers
|
||||
REG_ROMCTRL = 0;
|
||||
REG_CARD_1B0 = cardSeedBytes[ndsHeader->deviceType & 0x07] | (key1data.nnn << 15) | (key1data.mmm << 27) | 0x6000;
|
||||
REG_CARD_1B4 = 0x879b9b05;
|
||||
REG_CARD_1B8 = key1data.mmm >> 5;
|
||||
REG_CARD_1BA = 0x5c;
|
||||
REG_ROMCTRL = CARD_nRESET | CARD_SEC_SEED | CARD_SEC_EN | CARD_SEC_DAT;
|
||||
|
||||
// Update the DS card flags to suit KEY2 encryption
|
||||
portFlagsKey1 |= CARD_SEC_EN | CARD_SEC_DAT;
|
||||
|
||||
// 1lllliii jjjkkkkk - 2nd Get ROM Chip ID / Get KEY2 Stream
|
||||
createEncryptedCommand (CARD_CMD_SECURE_CHIPID, cmdData, 0);
|
||||
|
||||
if (normalChip) {
|
||||
cardPolledTransfer(portFlagsKey1, NULL, 0, cmdData);
|
||||
cardDelay(ndsHeader->readTimeout);
|
||||
cardPolledTransfer(portFlagsKey1 | CARD_BLK_SIZE(7), NULL, 0, cmdData);
|
||||
} else {
|
||||
cardPolledTransfer(portFlagsKey1 | CARD_BLK_SIZE(7), NULL, 0, cmdData);
|
||||
}
|
||||
|
||||
// 2bbbbiii jjjkkkkk - Get Secure Area Block
|
||||
secureArea = secureAreaData;
|
||||
portFlagsSecRead = (ndsHeader->cardControlBF & (CARD_CLK_SLOW|CARD_DELAY1(0x1FFF)|CARD_DELAY2(0x3F)))
|
||||
| CARD_ACTIVATE | CARD_nRESET | CARD_SEC_EN | CARD_SEC_DAT;
|
||||
|
||||
for (secureBlockNumber = 4; secureBlockNumber < 8; secureBlockNumber++) {
|
||||
createEncryptedCommand (CARD_CMD_SECURE_READ, cmdData, secureBlockNumber);
|
||||
|
||||
if (normalChip) {
|
||||
cardPolledTransfer(portFlagsSecRead, NULL, 0, cmdData);
|
||||
cardDelay(ndsHeader->readTimeout);
|
||||
for (i = 8; i > 0; i--) {
|
||||
cardPolledTransfer(portFlagsSecRead | CARD_BLK_SIZE(1), secureArea, 0x200, cmdData);
|
||||
secureArea += 0x200/sizeof(u32);
|
||||
}
|
||||
} else {
|
||||
cardPolledTransfer(portFlagsSecRead | CARD_BLK_SIZE(4) | CARD_SEC_LARGE, secureArea, 0x1000, cmdData);
|
||||
secureArea += 0x1000/sizeof(u32);
|
||||
}
|
||||
}
|
||||
|
||||
// Alllliii jjjkkkkk - Enter Main Data Mode
|
||||
createEncryptedCommand (CARD_CMD_DATA_MODE, cmdData, 0);
|
||||
|
||||
if (normalChip) {
|
||||
cardPolledTransfer(portFlagsKey1, NULL, 0, cmdData);
|
||||
cardDelay(ndsHeader->readTimeout);
|
||||
cardPolledTransfer(portFlagsKey1, NULL, 0, cmdData);
|
||||
} else {
|
||||
cardPolledTransfer(portFlagsKey1, NULL, 0, cmdData);
|
||||
}
|
||||
|
||||
// Now deal with secure area decryption and verification
|
||||
decryptSecureArea (gameCode->key, secureAreaData);
|
||||
|
||||
secureArea = secureAreaData;
|
||||
if (secureArea[0] == 0x72636e65 /*'encr'*/ && secureArea[1] == 0x6a624f79 /*'yObj'*/) {
|
||||
// Secure area exists, so just clear the tag
|
||||
secureArea[0] = 0xe7ffdeff;
|
||||
secureArea[1] = 0xe7ffdeff;
|
||||
} else {
|
||||
// Secure area tag is not there, so destroy the entire secure area
|
||||
for (i = 0; i < 0x200; i ++) {
|
||||
*secureArea++ = 0xe7ffdeff;
|
||||
}
|
||||
// Disabled error checks on secure area. This was able to boot a DS-Xtreme. May increase flashcart compatiblity drastically.
|
||||
// return normalChip ? ERR_SEC_NORM : ERR_SEC_OTHR;
|
||||
return normalChip ? ERR_NONE : ERR_NONE;
|
||||
}
|
||||
|
||||
return ERR_NONE;
|
||||
}
|
||||
|
||||
void cardRead (u32 src, u32* dest, size_t size)
|
||||
{
|
||||
size_t readSize;
|
||||
|
||||
if (src < CARD_SECURE_AREA_OFFSET) {
|
||||
return;
|
||||
} else if (src < CARD_DATA_OFFSET) {
|
||||
// Read data from secure area
|
||||
readSize = src + size < CARD_DATA_OFFSET ? size : CARD_DATA_OFFSET - src;
|
||||
memcpy (dest, (u8*)secureAreaData + src - CARD_SECURE_AREA_OFFSET, readSize);
|
||||
src += readSize;
|
||||
dest += readSize/sizeof(*dest);
|
||||
size -= readSize;
|
||||
}
|
||||
|
||||
while (size > 0) {
|
||||
readSize = size < CARD_DATA_BLOCK_SIZE ? size : CARD_DATA_BLOCK_SIZE;
|
||||
cardParamCommand (CARD_CMD_DATA_READ, src,
|
||||
(portFlags &~CARD_BLK_SIZE(7)) | CARD_ACTIVATE | CARD_nRESET | CARD_BLK_SIZE(1),
|
||||
dest, readSize);
|
||||
src += readSize;
|
||||
dest += readSize/sizeof(*dest);
|
||||
size -= readSize;
|
||||
}
|
||||
}
|
||||
|
12
Makefile
12
Makefile
@ -13,15 +13,15 @@ export TARGET := NTR_Launcher
|
||||
export TOPDIR := $(CURDIR)
|
||||
|
||||
export VERSION_MAJOR := 2
|
||||
export VERSION_MINOR := 6
|
||||
export VERSION_MINOR := 7
|
||||
export VERSTRING := $(VERSION_MAJOR).$(VERSION_MINOR)
|
||||
|
||||
.PHONY: bootloader bootloaderAlt clean arm7/$(TARGET).elf arm9/$(TARGET).elf
|
||||
.PHONY: bootloader clean arm7/$(TARGET).elf arm9/$(TARGET).elf
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
all: bootloader bootloaderAlt $(TARGET).nds
|
||||
all: bootloader $(TARGET).nds
|
||||
|
||||
dist: all
|
||||
@mkdir -p debug
|
||||
@ -31,7 +31,7 @@ dist: all
|
||||
$(TARGET).nds: $(TARGET).arm7 $(TARGET).arm9
|
||||
ndstool -c $(TARGET).nds -7 $(TARGET).arm7.elf -9 $(TARGET).arm9.elf \
|
||||
-b $(CURDIR)/icon.bmp "NTR Launcher;Slot-1 Launcher;Apache Thunder & RocketRobz" \
|
||||
-g KKGP 01 "NTR Launcher" -z 80040000 -u 00030004 -a 00000038 -p 0001
|
||||
-g KKGP 01 "NTR Launcher" -z 80040000 -u 00030004 -a 00000138 -p 0001
|
||||
@cp $(TARGET).nds 00000000.app
|
||||
|
||||
$(TARGET).arm7 : arm7/$(TARGET).elf
|
||||
@ -57,8 +57,8 @@ clean:
|
||||
@rm -fr $(TARGET).arm9
|
||||
@rm -fr $(TARGET).arm7.elf
|
||||
@rm -fr $(TARGET).arm9.elf
|
||||
@rm -fr 00000000.app
|
||||
@$(MAKE) -C bootloader clean
|
||||
@$(MAKE) -C bootloaderAlt clean
|
||||
@$(MAKE) -C arm9 clean
|
||||
@$(MAKE) -C arm7 clean
|
||||
|
||||
@ -68,5 +68,3 @@ data:
|
||||
bootloader: data
|
||||
@$(MAKE) -C bootloader
|
||||
|
||||
bootloaderAlt: data
|
||||
@$(MAKE) -C bootloaderAlt
|
||||
|
BIN
NTR_Launcher.dsi
Normal file
BIN
NTR_Launcher.dsi
Normal file
Binary file not shown.
@ -1,14 +1,11 @@
|
||||
[NTRLAUNCHER]
|
||||
TWLCLOCK = 0
|
||||
TWLVRAM = 0
|
||||
TWLEXTRAM = 0
|
||||
TWLMODE = 0
|
||||
SOUNDFREQ = 0
|
||||
SCFGUNLOCK = 0
|
||||
ANIMATEDSPLASH = 0
|
||||
NTRSPLASH = 0
|
||||
HEALTHSAFETYSPLASH = 1
|
||||
DEBUGMODE = 0
|
||||
LEGACYMODE = 0
|
||||
LANGUAGE = -1
|
||||
|
||||
|
@ -26,15 +26,7 @@ bool SCFGCLKCheck = false;
|
||||
|
||||
void VcountHandler() { inputGetAndSend(); }
|
||||
|
||||
void VblankHandler(void) {
|
||||
if (!SCFGCLKCheck) {
|
||||
if (fifoCheckValue32(FIFO_USER_01)) {
|
||||
SCFGCLKCheck = true;
|
||||
REG_SCFG_CLK = 0x0180;
|
||||
fifoSendValue32(FIFO_USER_02, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
void VblankHandler(void) { }
|
||||
|
||||
int main(void) {
|
||||
// read User Settings from firmware
|
||||
|
@ -128,18 +128,6 @@ $(ARM9ELF) : $(OFILES)
|
||||
#---------------------------------------------------------------------------------
|
||||
# graphics
|
||||
#---------------------------------------------------------------------------------
|
||||
topLoad.s : ../$(IMAGES)/topLoad.bmp
|
||||
grit $< -gB8 -gzl -fts -gTff00ff -o $@ -q
|
||||
|
||||
subLoad.s : ../$(IMAGES)/subLoad.bmp
|
||||
grit $< -gB8 -gzl -fts -gTff00ff -o $@ -q
|
||||
|
||||
subError.s : ../$(IMAGES)/subError.bmp
|
||||
grit $< -gB8 -gzl -fts -gTff00ff -o $@ -q
|
||||
|
||||
subPrompt.s : ../$(IMAGES)/subPrompt.bmp
|
||||
grit $< -gB8 -gzl -fts -gTff00ff -o $@ -q
|
||||
|
||||
#Cartridge Wait Prompt (bottom screen)
|
||||
# English
|
||||
CartPrompt01.s : ../$(IMAGES)/CartPrompt01.bmp
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 49 KiB |
Binary file not shown.
Before Width: | Height: | Size: 49 KiB |
Binary file not shown.
Before Width: | Height: | Size: 49 KiB |
Binary file not shown.
Before Width: | Height: | Size: 49 KiB |
File diff suppressed because it is too large
Load Diff
@ -23,11 +23,17 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void vramcpy_ui (void* dest, const void* src, int size);
|
||||
void ErrorScreen (bool DebugMode);
|
||||
void CartridgePrompt ();
|
||||
void LoadScreen (bool DebugMode);
|
||||
void BootSplashInit (bool DebugMode);
|
||||
// void vramcpy_ui (void* dest, const void* src, int size);
|
||||
void BootJingle (void);
|
||||
void BootJingleDSi (void);
|
||||
void BootSplashDSi (bool HealthandSafety_MSG, int language);
|
||||
void CartridgePrompt (void);
|
||||
void CartridgePromptDSi (void);
|
||||
void CartridgePromptNoHS (void);
|
||||
void BootSplashDS (bool HealthandSafety_MSG, int language);
|
||||
void FadeFX (void);
|
||||
void ErrorNoCard (void);
|
||||
void BootSplashInit (bool UseNTRSplash, bool HealthandSafety_MSG, int language, bool DisplayErrorSplash);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,43 +0,0 @@
|
||||
/*
|
||||
NitroHax -- Cheat tool for the Nintendo DS
|
||||
Copyright (C) 2008 Michael "Chishm" Chisholm
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef BOOTSPLASH2_H
|
||||
#define BOOTSPLAS2H_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// void vramcpy_ui (void* dest, const void* src, int size);
|
||||
void BootJingle (void);
|
||||
void BootJingleDSi (void);
|
||||
void BootSplashDSi (bool HealthandSafety_MSG, int language);
|
||||
void CartridgePrompt2 (void);
|
||||
void CartridgePromptDSi (void);
|
||||
void CartridgePromptNoHS (void);
|
||||
void BootSplashDS (bool HealthandSafety_MSG, int language);
|
||||
void FadeFX (void);
|
||||
void ErrorNoCard (void);
|
||||
void BootSplashInit2 (bool UseNTRSplash, bool HealthandSafety_MSG, int language, bool DisplayErrorSplash);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // BOOTSPLASH_H
|
||||
|
@ -16,22 +16,18 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef READ_CARD_H
|
||||
#define READ_CARD_H
|
||||
#include <nds.h>
|
||||
|
||||
#include <nds/ndstypes.h>
|
||||
#include <nds/memory.h>
|
||||
#include <stdlib.h>
|
||||
bool ConsoleInit = false;
|
||||
|
||||
#define CARD_NDS_HEADER_SIZE (0x200)
|
||||
#define CARD_SECURE_AREA_OFFSET (0x4000)
|
||||
#define CARD_SECURE_AREA_SIZE (0x4000)
|
||||
#define CARD_DATA_OFFSET (0x8000)
|
||||
#define CARD_DATA_BLOCK_SIZE (0x200)
|
||||
|
||||
int cardInit (tNDSHeader* ndsHeader, u32* chipID);
|
||||
|
||||
void cardRead (u32 src, u32* dest, size_t size);
|
||||
|
||||
#endif // READ_CARD_H
|
||||
void InitConsole() {
|
||||
ConsoleInit = true;
|
||||
// Enable console
|
||||
videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE);
|
||||
vramSetBankC(VRAM_C_SUB_BG_0x06200000);
|
||||
REG_BG0CNT_SUB = BG_MAP_BASE(4) | BG_COLOR_16 | BG_TILE_BASE(6) | BG_PRIORITY(0);
|
||||
consoleInit(NULL, 0, BgType_Text4bpp, BgSize_T_256x256, 4, 6, false, true);
|
||||
BG_PALETTE_SUB[0] = RGB15(31,31,31);
|
||||
BG_PALETTE_SUB[255] = RGB15(0,0,0);
|
||||
}
|
||||
|
@ -15,6 +15,19 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <nds/ndstypes.h>
|
||||
|
||||
void readBios (u8* dest, u32 src, u32 size);
|
||||
|
||||
#ifndef DEBUGCONSOLE_H
|
||||
#define DEBUGCONSOLE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void InitConsole(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -20,27 +20,21 @@
|
||||
#include <nds.h>
|
||||
|
||||
#include "load_bin.h"
|
||||
#include "loadAlt_bin.h"
|
||||
#include "launch_engine.h"
|
||||
#include "debugConsole.h"
|
||||
|
||||
#define LCDC_BANK_C (u16*)0x06840000
|
||||
#define LCDC_BANK_D (u16*)0x06860000
|
||||
|
||||
#define DSIMODE_OFFSET 4
|
||||
#define LANGUAGE_OFFSET 8
|
||||
#define SDACCESS_OFFSET 12
|
||||
#define SCFGUNLOCK_OFFSET 16
|
||||
#define TWLMODE_OFFSET 20
|
||||
#define TWLCLOCK_OFFSET 24
|
||||
#define BOOSTVRAM_OFFSET 28
|
||||
#define SOUNDFREQ_OFFSET 32
|
||||
#define EXTENDRAM_OFFSET 36
|
||||
#define DEBUGMODE_OFFSET 40
|
||||
#define TMP_DATA 0x027FC000
|
||||
|
||||
typedef signed int addr_t;
|
||||
typedef unsigned char data_t;
|
||||
|
||||
static void writeAddr (data_t *mem, addr_t offset, addr_t value) { ((addr_t*)mem)[offset/sizeof(addr_t)] = value; }
|
||||
typedef struct sLauncherSettings {
|
||||
u8 language;
|
||||
u8 scfgUnlock;
|
||||
u8 twlMode;
|
||||
u8 twlCLK;
|
||||
u8 twlVRAM;
|
||||
u8 debugMode;
|
||||
} tLauncherSettings;
|
||||
|
||||
void vramcpy (void* dst, const void* src, int len) {
|
||||
u16* dst16 = (u16*)dst;
|
||||
@ -49,102 +43,51 @@ void vramcpy (void* dst, const void* src, int len) {
|
||||
for ( ; len > 0; len -= 2) { *dst16++ = *src16++; }
|
||||
}
|
||||
|
||||
void runLaunchEngine (bool altBootloader, bool EnableSD, int language, bool scfgUnlock, bool TWLMODE, bool TWLCLK, bool TWLVRAM, bool soundFreq, bool extendRam, bool debugMode) {
|
||||
// nocashMessage("runLaunchEngine");
|
||||
extern void InitConsole();
|
||||
|
||||
extern bool ConsoleInit;
|
||||
|
||||
void runLaunchEngine (int language, bool scfgUnlock, bool TWLMODE, bool TWLCLK, bool TWLVRAM, bool debugMode) {
|
||||
|
||||
// Always init console so bootloader's new console can display error codes if needed.
|
||||
if (!debugMode || !ConsoleInit) { InitConsole(); } else { consoleClear(); }
|
||||
|
||||
irqDisable(IRQ_ALL);
|
||||
// Direct CPU access to VRAM bank D
|
||||
VRAM_D_CR = VRAM_ENABLE | VRAM_D_LCD;
|
||||
|
||||
// Clear VRAM
|
||||
memset (LCDC_BANK_D, 0x00, 128 * 1024);
|
||||
|
||||
// Load the loader/patcher into the correct address
|
||||
vramcpy (LCDC_BANK_D, load_bin, load_bin_size);
|
||||
|
||||
if (!altBootloader) {
|
||||
// Direct CPU access to VRAM bank D
|
||||
VRAM_D_CR = VRAM_ENABLE | VRAM_D_LCD;
|
||||
// Give the VRAM to the ARM7
|
||||
// nocashMessage("Give the VRAM to the ARM7");
|
||||
VRAM_D_CR = VRAM_ENABLE | VRAM_D_ARM7_0x06020000;
|
||||
|
||||
// Clear VRAM
|
||||
memset (LCDC_BANK_D, 0x00, 128 * 1024);
|
||||
|
||||
// Load the loader/patcher into the correct address
|
||||
vramcpy (LCDC_BANK_D, load_bin, load_bin_size);
|
||||
|
||||
// Set the parameters for the loader
|
||||
writeAddr ((data_t*) LCDC_BANK_D, DSIMODE_OFFSET, isDSiMode());
|
||||
writeAddr ((data_t*) LCDC_BANK_D, LANGUAGE_OFFSET, language);
|
||||
writeAddr ((data_t*) LCDC_BANK_D, SDACCESS_OFFSET, EnableSD);
|
||||
writeAddr ((data_t*) LCDC_BANK_D, SCFGUNLOCK_OFFSET, scfgUnlock);
|
||||
writeAddr ((data_t*) LCDC_BANK_D, TWLMODE_OFFSET, TWLMODE);
|
||||
writeAddr ((data_t*) LCDC_BANK_D, TWLCLOCK_OFFSET, TWLCLK);
|
||||
writeAddr ((data_t*) LCDC_BANK_D, BOOSTVRAM_OFFSET, TWLVRAM);
|
||||
writeAddr ((data_t*) LCDC_BANK_D, SOUNDFREQ_OFFSET, soundFreq);
|
||||
writeAddr ((data_t*) LCDC_BANK_D, EXTENDRAM_OFFSET, extendRam);
|
||||
writeAddr ((data_t*) LCDC_BANK_D, DEBUGMODE_OFFSET, debugMode);
|
||||
// Reset into a passme loop
|
||||
nocashMessage("Reset into a passme loop");
|
||||
REG_EXMEMCNT |= ARM7_OWNS_ROM | ARM7_OWNS_CARD;
|
||||
|
||||
// Give the VRAM to the ARM7
|
||||
// nocashMessage("Give the VRAM to the ARM7");
|
||||
VRAM_D_CR = VRAM_ENABLE | VRAM_D_ARM7_0x06020000;
|
||||
|
||||
// Reset into a passme loop
|
||||
nocashMessage("Reset into a passme loop");
|
||||
REG_EXMEMCNT |= ARM7_OWNS_ROM | ARM7_OWNS_CARD;
|
||||
|
||||
} else {
|
||||
// Direct CPU access to VRAM bank C
|
||||
VRAM_C_CR = VRAM_ENABLE | VRAM_C_LCD;
|
||||
REG_SCFG_EXT=0x83002000;
|
||||
|
||||
// Clear VRAM
|
||||
memset (LCDC_BANK_C, 0x00, 128 * 1024);
|
||||
// for (int i = 0; i < 10; i++) { swiWaitForVBlank(); }
|
||||
|
||||
// Load the loader/patcher into the correct address
|
||||
vramcpy (LCDC_BANK_C, loadAlt_bin, loadAlt_bin_size);
|
||||
tLauncherSettings* tmpData = (tLauncherSettings*)TMP_DATA;
|
||||
|
||||
// Set the parameters for the loader
|
||||
writeAddr ((data_t*) LCDC_BANK_C, DSIMODE_OFFSET, isDSiMode());
|
||||
writeAddr ((data_t*) LCDC_BANK_C, LANGUAGE_OFFSET, language);
|
||||
writeAddr ((data_t*) LCDC_BANK_C, SDACCESS_OFFSET, EnableSD);
|
||||
writeAddr ((data_t*) LCDC_BANK_C, SCFGUNLOCK_OFFSET, scfgUnlock);
|
||||
writeAddr ((data_t*) LCDC_BANK_C, TWLMODE_OFFSET, TWLMODE);
|
||||
writeAddr ((data_t*) LCDC_BANK_C, TWLCLOCK_OFFSET, TWLCLK);
|
||||
writeAddr ((data_t*) LCDC_BANK_C, BOOSTVRAM_OFFSET, TWLVRAM);
|
||||
writeAddr ((data_t*) LCDC_BANK_C, SOUNDFREQ_OFFSET, soundFreq);
|
||||
writeAddr ((data_t*) LCDC_BANK_C, EXTENDRAM_OFFSET, extendRam);
|
||||
writeAddr ((data_t*) LCDC_BANK_C, DEBUGMODE_OFFSET, debugMode);
|
||||
|
||||
// Give the VRAM to the ARM7
|
||||
VRAM_C_CR = VRAM_ENABLE | VRAM_C_ARM7_0x06000000;
|
||||
|
||||
// Reset into a passme loop
|
||||
nocashMessage("Reset into a passme loop");
|
||||
REG_EXMEMCNT |= ARM7_OWNS_ROM | ARM7_OWNS_CARD;
|
||||
|
||||
*((vu32*)REG_MBK1)=0x8D898581;
|
||||
*((vu32*)REG_MBK2)=0x91898581;
|
||||
*((vu32*)REG_MBK3)=0x91999591;
|
||||
*((vu32*)REG_MBK4)=0x91898581;
|
||||
*((vu32*)REG_MBK5)=0x91999591;
|
||||
tmpData->language = 0xFF;
|
||||
if (language != -1)tmpData->language = language;
|
||||
if (scfgUnlock)tmpData->scfgUnlock = 0x01;
|
||||
if (TWLMODE)tmpData->twlMode = 0x01;
|
||||
if (TWLCLK)tmpData->twlCLK = 0x01;
|
||||
if (TWLVRAM)tmpData->twlVRAM = 0x01;
|
||||
if (debugMode)tmpData->debugMode = 0x01;
|
||||
|
||||
REG_MBK6=0x00003000;
|
||||
REG_MBK7=0x00003000;
|
||||
REG_MBK8=0x00003000;
|
||||
|
||||
if(TWLCLK) {
|
||||
// REG_SCFG_CLK=0x0080;
|
||||
// REG_SCFG_CLK |= BIT(0);
|
||||
REG_SCFG_CLK=0x81;
|
||||
REG_SCFG_EXT=0x83002000;
|
||||
} else {
|
||||
REG_SCFG_CLK=0x80;
|
||||
REG_SCFG_EXT=0x83000000;
|
||||
}
|
||||
|
||||
if (!scfgUnlock) REG_SCFG_EXT &= ~(1UL << 31);
|
||||
|
||||
// Give the VRAM to the ARM7
|
||||
// nocashMessage("Give the VRAM to the ARM7");
|
||||
VRAM_D_CR = VRAM_ENABLE | VRAM_D_ARM7_0x06020000;
|
||||
}
|
||||
|
||||
// Return to passme loop
|
||||
*(vu32*)0x02FFFFFC = 0;
|
||||
*(vu32*)0x02FFFE04 = (u32)0xE59FF018; // ldr pc, 0x02FFFE24
|
||||
*(vu32*)0x02FFFE24 = (u32)0x02FFFE04; // Set ARM9 Loop address --> resetARM9(0x02FFFE04);
|
||||
|
||||
*(vu32*)0x027FFFFC = 0;
|
||||
*(vu32*)0x027FFE04 = (u32)0xE59FF018; // ldr pc, 0x02FFFE24
|
||||
*(vu32*)0x027FFE24 = (u32)0x02FFFE04; // Set ARM9 Loop address --> resetARM9(0x027FFE04);
|
||||
// Reset ARM7
|
||||
// nocashMessage("resetARM7");
|
||||
resetARM7(0x06020000);
|
||||
|
@ -25,7 +25,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void runLaunchEngine (bool altBootloader, bool EnableSD, int language, bool scfgUnlock, bool TWLMODE, bool TWLCLK, bool TWLVRAM, bool soundFreq, bool extendRam, bool debugMode);
|
||||
void runLaunchEngine (int language, bool scfgUnlock, bool TWLMODE, bool TWLCLK, bool TWLVRAM, bool debugMode);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -17,9 +17,9 @@
|
||||
*/
|
||||
|
||||
#include <nds.h>
|
||||
#include <fat.h>
|
||||
#include <nds/arm9/console.h>
|
||||
#include <nds/fifocommon.h>
|
||||
|
||||
#include <fat.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
@ -27,17 +27,17 @@
|
||||
|
||||
#include "inifile.h"
|
||||
#include "bootsplash.h"
|
||||
#include "bootsplash2.h"
|
||||
#include "launch_engine.h"
|
||||
#include "crc.h"
|
||||
#include "tonccpy.h"
|
||||
#include "read_card.h"
|
||||
#include "debugConsole.h"
|
||||
|
||||
sNDSHeaderExt ndsHeader;
|
||||
char gameTitle[13] = {0};
|
||||
char gameCode[7] = {0};
|
||||
|
||||
const char* PROGVERSION = "2.6";
|
||||
const char* PROGVERSION = "2.7";
|
||||
|
||||
off_t getFileSize(const char *fileName) {
|
||||
FILE* fp = fopen(fileName, "rb");
|
||||
@ -51,14 +51,18 @@ off_t getFileSize(const char *fileName) {
|
||||
return fsize;
|
||||
}
|
||||
|
||||
extern void InitConsole();
|
||||
|
||||
extern bool ConsoleInit;
|
||||
|
||||
void DisplayText(const char* text, bool clear = false, bool clearOnly = false){
|
||||
if (clear | clearOnly) {
|
||||
consoleClear();
|
||||
if (!ConsoleInit)InitConsole();
|
||||
if (clear || clearOnly)consoleClear();
|
||||
if (!clearOnly) {
|
||||
printf("--------------------------------\n");
|
||||
printf("----[NTR Launcher Debug Mode]---\n");
|
||||
printf("----------[Version: 2.6]--------\n");
|
||||
printf("----------[Version: 2.7]--------\n");
|
||||
printf("--------------------------------\n\n");
|
||||
if (clearOnly) return;
|
||||
}
|
||||
printf(text);
|
||||
}
|
||||
@ -95,32 +99,30 @@ void ResetSlot1() {
|
||||
|
||||
void DoSlotCheck(bool DebugMode) {
|
||||
if (REG_SCFG_MC == 0x11) {
|
||||
if (DebugMode) DisplayText("Please insert a cartridge...\n", true);
|
||||
if(!ConsoleInit)InitConsole();
|
||||
if(DebugMode) {
|
||||
DisplayText("Please insert a cartridge...\n", true, false);
|
||||
} else {
|
||||
DisplayText("\n\n\n\n\n\n\n\n\n\n\n Please insert a cartridge... ", true, true);
|
||||
}
|
||||
REDO:
|
||||
swiWaitForVBlank();
|
||||
do {
|
||||
if (!DebugMode) CartridgePrompt();
|
||||
} while (REG_SCFG_MC != 0x10);
|
||||
do { swiWaitForVBlank(); } while (REG_SCFG_MC != 0x10);
|
||||
enableSlot1();
|
||||
DoWait(60);
|
||||
if (REG_SCFG_MC != 0x18) goto REDO;
|
||||
// fifoSendValue32(FIFO_USER_02, 1);
|
||||
} else if (REG_SCFG_MC == 0x10) {
|
||||
enableSlot1();
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
defaultExceptionHandler();
|
||||
|
||||
// bool consoleInited = false;
|
||||
bool scfgUnlock = false;
|
||||
bool TWLMODE = false;
|
||||
bool TWLEXTRAM = false;
|
||||
bool TWLCLK = false; // false == NTR, true == TWL
|
||||
bool TWLVRAM = false;
|
||||
bool soundFreq = false;
|
||||
bool EnableSD = false;
|
||||
// bool slot1Init = false;
|
||||
bool LegacyMode = false;
|
||||
|
||||
bool UseAnimatedSplash = false;
|
||||
bool UseNTRSplash = true;
|
||||
@ -131,104 +133,62 @@ int main() {
|
||||
bool DebugMode = false;
|
||||
|
||||
if (fatInitDefault()) {
|
||||
CIniFile ntrlauncher_config( "sd:/NDS/NTR_Launcher.ini" );
|
||||
CIniFile ntrlauncher_config( "/NDS/NTR_Launcher.ini" );
|
||||
|
||||
TWLCLK = ntrlauncher_config.GetInt("NTRLAUNCHER","TWLCLOCK",0);
|
||||
TWLVRAM = ntrlauncher_config.GetInt("NTRLAUNCHER","TWLVRAM",0);
|
||||
TWLEXTRAM = ntrlauncher_config.GetInt("NTRLAUNCHER","TWLEXTRAM",0);
|
||||
TWLMODE = ntrlauncher_config.GetInt("NTRLAUNCHER","TWLMODE",0);
|
||||
soundFreq = ntrlauncher_config.GetInt("NTRLAUNCHER","SOUNDFREQ",0);
|
||||
// EnableSD = ntrlauncher_config.GetInt("NTRLAUNCHER","SDACCESS",0);
|
||||
EnableSD = true;
|
||||
scfgUnlock = ntrlauncher_config.GetInt("NTRLAUNCHER","SCFGUNLOCK",0);
|
||||
// cardInit() does a slot reset anyways so this feature will be deprecated.
|
||||
// slot1Init = ntrlauncher_config.GetInt("NTRLAUNCHER","RESETSLOT1",0);
|
||||
UseAnimatedSplash = ntrlauncher_config.GetInt("NTRLAUNCHER","ANIMATEDSPLASH",0);
|
||||
UseNTRSplash = ntrlauncher_config.GetInt("NTRLAUNCHER","NTRSPLASH",0);
|
||||
HealthAndSafety_MSG = ntrlauncher_config.GetInt("NTRLAUNCHER","HEALTHSAFETYSPLASH",0);
|
||||
|
||||
DebugMode = ntrlauncher_config.GetInt("NTRLAUNCHER","DEBUGMODE",0);
|
||||
LegacyMode = ntrlauncher_config.GetInt("NTRLAUNCHER", "LEGACYMODE", 0);
|
||||
language = ntrlauncher_config.GetInt("NTRLAUNCHER", "LANGUAGE", -1);
|
||||
|
||||
/*if(slot1Init) {
|
||||
ResetSlot1();
|
||||
}*/
|
||||
}/* else {
|
||||
ResetSlot1();
|
||||
}*/
|
||||
}
|
||||
|
||||
if (DebugMode) UseAnimatedSplash = false;
|
||||
ConsoleInit = DebugMode;
|
||||
|
||||
if (!UseAnimatedSplash) {
|
||||
BootSplashInit(DebugMode);
|
||||
if (DebugMode)UseAnimatedSplash = false;
|
||||
|
||||
if (!UseAnimatedSplash) {
|
||||
if (DebugMode)InitConsole();
|
||||
DoSlotCheck(DebugMode);
|
||||
} else {
|
||||
if (DebugMode) {
|
||||
DoSlotCheck(DebugMode);
|
||||
} else {
|
||||
char *p = (char*)PersonalData->name;
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (p[i*2] == 0x00) {
|
||||
p[i*2/2] = 0;
|
||||
} else {
|
||||
p[i*2/2] = p[i*2];
|
||||
}
|
||||
char *p = (char*)PersonalData->name;
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (p[i*2] == 0x00) {
|
||||
p[i*2/2] = 0;
|
||||
} else {
|
||||
p[i*2/2] = p[i*2];
|
||||
}
|
||||
if (language == -1) language = (PersonalData->language);
|
||||
BootSplashInit2(UseNTRSplash, HealthAndSafety_MSG, language, false);
|
||||
}
|
||||
if (language == -1) language = (PersonalData->language);
|
||||
BootSplashInit(UseNTRSplash, HealthAndSafety_MSG, language, false);
|
||||
}
|
||||
|
||||
if (LegacyMode && !TWLCLK) {
|
||||
fifoSendValue32(FIFO_USER_01, 1);
|
||||
fifoWaitValue32(FIFO_USER_02);
|
||||
}
|
||||
DoWait();
|
||||
sysSetCardOwner (BUS_OWNER_ARM9);
|
||||
|
||||
DoCardInit(DebugMode);
|
||||
|
||||
// Force disable Legacy Mode if a TWL cart is detected. Old cart loader doesn't support TWL carts.
|
||||
if ((ndsHeader.unitCode == 0x03) | (ndsHeader.unitCode == 0x02)) {
|
||||
LegacyMode = false;
|
||||
// Force specific settings needed for proper support for retail TWL carts
|
||||
if (ndsHeader.unitCode == 0x03) {
|
||||
scfgUnlock = false;
|
||||
TWLMODE = true;
|
||||
TWLEXTRAM = true;
|
||||
TWLCLK = true; // false == NTR, true == TWL
|
||||
TWLVRAM = true;
|
||||
soundFreq = true;
|
||||
if (!memcmp(gameCode, "DSYE", 4))LegacyMode = true;
|
||||
} else {
|
||||
TWLCLK = true;
|
||||
}
|
||||
} else if (!memcmp(gameCode, "ASMA", 4) | !memcmp(gameCode, "ACEK", 4) ) {
|
||||
//Original R4 doesn't like new bootloader
|
||||
LegacyMode = true;
|
||||
DoWait(60);
|
||||
} else if (!memcmp(gameTitle, "D!S!XTREME", 9)) {
|
||||
// Force specific settings needed for proper support for retail TWL carts
|
||||
if (!memcmp(gameTitle, "D!S!XTREME", 9)) {
|
||||
// DS-Xtreme does not like running in TWL clock speeds. (write function likely goes too fast and semi-bricks hidden sector region randomly)
|
||||
TWLCLK = false;
|
||||
};
|
||||
}
|
||||
|
||||
while(1) {
|
||||
// If SCFG_MC is returning as zero/null, this means SCFG_EXT registers are locked on arm9 or user attempted to run this while in NTR mode.
|
||||
if((REG_SCFG_MC == 0x00) | (REG_SCFG_MC == 0x11) | (REG_SCFG_MC == 0x10)) {
|
||||
if (UseAnimatedSplash) {
|
||||
BootSplashInit2(false, false, 0, true);
|
||||
BootSplashInit(false, false, 0, true);
|
||||
} else {
|
||||
if (!DebugMode) {
|
||||
ErrorScreen(DebugMode);
|
||||
} else {
|
||||
DisplayText("Error has occured.!\nEither card ejected late,\nor NTR mode detected!\nPress any button to exit...", true);
|
||||
}
|
||||
DisplayText("Error has occured.!\nEither card ejected late,\nor NTR mode detected!\nPress any button to exit...", true);
|
||||
do { swiWaitForVBlank(); scanKeys(); } while (!keysDown());
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
runLaunchEngine (LegacyMode, EnableSD, language, scfgUnlock, TWLMODE, TWLCLK, TWLVRAM, soundFreq, TWLEXTRAM, DebugMode);
|
||||
runLaunchEngine(language, scfgUnlock, TWLMODE, TWLCLK, TWLVRAM, DebugMode);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user