mirror of
https://github.com/d0k3/GodMode9.git
synced 2025-06-26 13:42:47 +00:00
Indentation fixes
Indentation fixes everywhere (mostly anyway under arm9/source/) And some other tab to spaces
This commit is contained in:
parent
4e04849860
commit
d27cfc71e1
@ -9,8 +9,8 @@
|
||||
#define CART_STATE (~(*(volatile u8*)0x10000010) & 0x1)
|
||||
#define SD_STATE ((*(volatile u16*)0x1000601C) & (0x1<<5))
|
||||
|
||||
#define HID_RAW_TX(t) ((s32)(((t) / (1 << 16)) & 0xFFF))
|
||||
#define HID_RAW_TY(t) ((s32)((t) & 0xFFF))
|
||||
#define HID_RAW_TX(t) ((s32)(((t) / (1 << 16)) & 0xFFF))
|
||||
#define HID_RAW_TY(t) ((s32)((t) & 0xFFF))
|
||||
|
||||
u32 HID_ReadState(void);
|
||||
|
||||
@ -18,8 +18,8 @@ u32 HID_ReadState(void);
|
||||
// the touchscreen at the screen coordinates [screen_x, screen_y]
|
||||
// note: no point can be at the center
|
||||
typedef struct {
|
||||
u32 ts_raw;
|
||||
int screen_x, screen_y;
|
||||
u32 ts_raw;
|
||||
int screen_x, screen_y;
|
||||
} HID_CalibrationData;
|
||||
|
||||
u32 HID_ReadRawTouchState(void);
|
||||
|
@ -16,7 +16,7 @@ typedef struct {
|
||||
u8 bcd_D;
|
||||
u8 bcd_M;
|
||||
u8 bcd_Y;
|
||||
u8 leap_count;
|
||||
u8 leap_count;
|
||||
} PACKED_STRUCT DsTime;
|
||||
|
||||
bool is_valid_dstime(DsTime* dstime);
|
||||
|
@ -101,7 +101,7 @@ void add_ctr(void* ctr, uint32_t carry)
|
||||
int32_t i;
|
||||
|
||||
for(i = 0; i < 4; i++) {
|
||||
//FIXME this assumes alignment...
|
||||
//FIXME this assumes alignment...
|
||||
counter[i] = ((uint32_t)outctr[i*4+0]<<24) | ((uint32_t)outctr[i*4+1]<<16) | ((uint32_t)outctr[i*4+2]<<8) | ((uint32_t)outctr[i*4+3]<<0);
|
||||
}
|
||||
|
||||
@ -307,7 +307,7 @@ void aes_cmac(void* inbuf, void* outbuf, size_t size)
|
||||
char* xorpadb = (void*) xorpad;
|
||||
char finalxor = (xorpadb[0] & 0x80) ? 0x87 : 0x00;
|
||||
for (uint32_t i = 0; i < 15; i++) {
|
||||
xorpadb[i] <<= 1;
|
||||
xorpadb[i] <<= 1;
|
||||
xorpadb[i] |= xorpadb[i+1] >> 7;
|
||||
}
|
||||
xorpadb[15] <<= 1;
|
||||
@ -318,7 +318,7 @@ void aes_cmac(void* inbuf, void* outbuf, size_t size)
|
||||
out[i] = 0;
|
||||
while (size-- > 0) {
|
||||
for (uint32_t i = 0; i < 4; i++)
|
||||
out[i] ^= *(in++);
|
||||
out[i] ^= *(in++);
|
||||
if (!size) { // last block
|
||||
for (uint32_t i = 0; i < 4; i++)
|
||||
out[i] ^= xorpad[i];
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include "crc16.h"
|
||||
|
||||
#define CRC16_TABVAL \
|
||||
0x0000, 0xCC01, 0xD801, 0x1400, 0xF001, 0x3C00, 0x2800, 0xE401, \
|
||||
0xA001, 0x6C00, 0x7800, 0xB401, 0x5000, 0x9C01, 0x8801, 0x4400
|
||||
0x0000, 0xCC01, 0xD801, 0x1400, 0xF001, 0x3C00, 0x2800, 0xE401, \
|
||||
0xA001, 0x6C00, 0x7800, 0xB401, 0x5000, 0x9C01, 0x8801, 0x4400
|
||||
|
||||
|
||||
// see: https://github.com/TASVideos/desmume/blob/master/desmume/src/bios.cpp#L1070tions
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 data[16];
|
||||
u32 data[16];
|
||||
} _sha_block;
|
||||
|
||||
void sha_init(u32 mode)
|
||||
|
@ -54,7 +54,7 @@
|
||||
#define FTYPE_TIKBUILD(tp) (tp&(GAME_TICKET|SYS_TICKDB|BIN_TIKDB))
|
||||
#define FTYPE_KEYBUILD(tp) (tp&(BIN_KEYDB|BIN_LEGKEY))
|
||||
#define FTYPE_TITLEINFO(tp) (tp&(GAME_SMDH|GAME_NCCH|GAME_NCSD|GAME_CIA|GAME_TMD|GAME_NDS|GAME_GBA|GAME_TAD|GAME_3DSX))
|
||||
#define FTYPE_CIACHECK(tp) (tp&GAME_CIA)
|
||||
#define FTYPE_CIACHECK(tp) (tp&GAME_CIA)
|
||||
#define FTYPE_RENAMABLE(tp) (tp&(GAME_NCCH|GAME_NCSD|GAME_CIA|GAME_NDS|GAME_GBA))
|
||||
#define FTYPE_TRIMABLE(tp) (tp&(IMG_NAND|GAME_NCCH|GAME_NCSD|GAME_NDS|SYS_FIRM))
|
||||
#define FTYPE_TRANSFERABLE(tp) ((u64) (tp&(IMG_FAT|FLAG_CTR)) == (u64) (IMG_FAT|FLAG_CTR))
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "ff.h"
|
||||
|
||||
u32 LoadCertFromCertDb(u64 offset, Certificate* cert, u32* mod, u32* exp) {
|
||||
Certificate cert_local;
|
||||
Certificate cert_local;
|
||||
FIL db;
|
||||
UINT bytes_read;
|
||||
|
||||
|
@ -32,24 +32,24 @@ void NTR_CmdEnter16ByteMode(void)
|
||||
|
||||
void NTR_CmdReadHeader (u8* buffer)
|
||||
{
|
||||
REG_NTRCARDROMCNT=0;
|
||||
REG_NTRCARDMCNT=0;
|
||||
ioDelay2(167550);
|
||||
REG_NTRCARDMCNT=NTRCARD_CR1_ENABLE|NTRCARD_CR1_IRQ;
|
||||
REG_NTRCARDROMCNT=NTRCARD_nRESET|NTRCARD_SEC_SEED;
|
||||
while(REG_NTRCARDROMCNT&NTRCARD_BUSY) ;
|
||||
cardReset();
|
||||
while(REG_NTRCARDROMCNT&NTRCARD_BUSY) ;
|
||||
u32 iCardId=cardReadID(NTRCARD_CLK_SLOW);
|
||||
while(REG_NTRCARDROMCNT&NTRCARD_BUSY) ;
|
||||
REG_NTRCARDROMCNT=0;
|
||||
REG_NTRCARDMCNT=0;
|
||||
ioDelay2(167550);
|
||||
REG_NTRCARDMCNT=NTRCARD_CR1_ENABLE|NTRCARD_CR1_IRQ;
|
||||
REG_NTRCARDROMCNT=NTRCARD_nRESET|NTRCARD_SEC_SEED;
|
||||
while(REG_NTRCARDROMCNT&NTRCARD_BUSY) ;
|
||||
cardReset();
|
||||
while(REG_NTRCARDROMCNT&NTRCARD_BUSY) ;
|
||||
u32 iCardId=cardReadID(NTRCARD_CLK_SLOW);
|
||||
while(REG_NTRCARDROMCNT&NTRCARD_BUSY) ;
|
||||
|
||||
u32 iCheapCard=iCardId&0x80000000;
|
||||
u32 iCheapCard=iCardId&0x80000000;
|
||||
|
||||
if(iCheapCard)
|
||||
{
|
||||
//this is magic of wood goblins
|
||||
for(size_t ii=0;ii<8;++ii)
|
||||
cardParamCommand(NTRCARD_CMD_HEADER_READ,ii*0x200,NTRCARD_ACTIVATE|NTRCARD_nRESET|NTRCARD_CLK_SLOW|NTRCARD_BLK_SIZE(1)|NTRCARD_DELAY1(0x1FFF)|NTRCARD_DELAY2(0x3F),(u32*)(void*)(buffer+ii*0x200),0x200/sizeof(u32));
|
||||
//this is magic of wood goblins
|
||||
for(size_t ii=0;ii<8;++ii)
|
||||
cardParamCommand(NTRCARD_CMD_HEADER_READ,ii*0x200,NTRCARD_ACTIVATE|NTRCARD_nRESET|NTRCARD_CLK_SLOW|NTRCARD_BLK_SIZE(1)|NTRCARD_DELAY1(0x1FFF)|NTRCARD_DELAY2(0x3F),(u32*)(void*)(buffer+ii*0x200),0x200/sizeof(u32));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -20,28 +20,28 @@
|
||||
#define vu32 volatile u32
|
||||
#define vu64 volatile u64
|
||||
|
||||
#define REG_ROMCTRL (*(vu32*)0x10164004)
|
||||
#define REG_AUXSPICNT (*(vu16*)0x10164000)
|
||||
#define REG_AUXSPICNTH (*(vu16*)0x10164001)
|
||||
#define REG_AUXSPIDATA (*(vu16*)0x10164002)
|
||||
#define REG_ROMCTRL (*(vu32*)0x10164004)
|
||||
#define REG_AUXSPICNT (*(vu16*)0x10164000)
|
||||
#define REG_AUXSPICNTH (*(vu16*)0x10164001)
|
||||
#define REG_AUXSPIDATA (*(vu16*)0x10164002)
|
||||
|
||||
#define CARD_COMMAND ((vu8*)0x10164008)
|
||||
#define CARD_DATA_RD (*(vu32*)0x1016401C)
|
||||
#define CARD_COMMAND ((vu8*)0x10164008)
|
||||
#define CARD_DATA_RD (*(vu32*)0x1016401C)
|
||||
|
||||
#define CARD_CR1_ENABLE 0x8000u
|
||||
#define CARD_CR1_IRQ 0x4000u
|
||||
|
||||
// SPI EEPROM COMMANDS
|
||||
#define SPI_EEPROM_WRSR 0x01
|
||||
#define SPI_EEPROM_PP 0x02 // Page Program
|
||||
#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_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_RDP 0xab // Release from deep power down
|
||||
#define SPI_EEPROM_DPD 0xb9 // Deep power down
|
||||
|
||||
#define CARD_ACTIVATE (1u<<31) // when writing, get the ball rolling
|
||||
@ -77,24 +77,24 @@
|
||||
#define CARD_CMD_DATA_CHIPID 0xB8u
|
||||
|
||||
//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_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
|
||||
|
||||
#define swiDelay(n) ioDelay(n)
|
||||
|
||||
#define DMA_SRC(n) (*(vu32*)(0x10002004 + (n * 0x1c)))
|
||||
#define DMA_DEST(n) (*(vu32*)(0x10002008 + (n * 0x1c)))
|
||||
#define DMA_CR(n) (*(vu32*)(0x1000201C + (n * 0x1c)))
|
||||
#define DMA_SRC(n) (*(vu32*)(0x10002004 + (n * 0x1c)))
|
||||
#define DMA_DEST(n) (*(vu32*)(0x10002008 + (n * 0x1c)))
|
||||
#define DMA_CR(n) (*(vu32*)(0x1000201C + (n * 0x1c)))
|
||||
|
||||
#define DMA_ENABLE (1u << 31)
|
||||
#define DMA_START_CARD (5u << 27)
|
||||
#define DMA_32_BIT (1u << 26)
|
||||
#define DMA_REPEAT (1u << 25)
|
||||
#define DMA_SRC_FIX (1u << 24)
|
||||
#define DMA_ENABLE (1u << 31)
|
||||
#define DMA_START_CARD (5u << 27)
|
||||
#define DMA_32_BIT (1u << 26)
|
||||
#define DMA_REPEAT (1u << 25)
|
||||
#define DMA_SRC_FIX (1u << 24)
|
||||
|
||||
void cardReset();
|
||||
|
@ -76,8 +76,8 @@ void CTR_SendCommand(const u32 command[4], u32 pageSize, u32 blocks, u32 latency
|
||||
transferLength = 4096;
|
||||
pageParam = CTRCARD_PAGESIZE_4K;
|
||||
break;
|
||||
default:
|
||||
break; //Defaults already set
|
||||
default:
|
||||
break; //Defaults already set
|
||||
}
|
||||
|
||||
REG_CTRCARDBLKCNT = blocks - 1;
|
||||
|
@ -50,8 +50,8 @@ void NTR_SendCommand(const u32 command[2], u32 pageSize, u32 latency, void* buff
|
||||
transferLength = 16384;
|
||||
pageParam = NTRCARD_PAGESIZE_16K;
|
||||
break;
|
||||
default:
|
||||
break; //Using 4K pagesize and transfer length by default
|
||||
default:
|
||||
break; //Using 4K pagesize and transfer length by default
|
||||
}
|
||||
|
||||
// go
|
||||
|
@ -120,22 +120,22 @@ void NTR_ApplyKey (u32* pCardHash, int nCardHash, u32* pKeyCode)
|
||||
|
||||
void NTR_InitKey (u32 aGameCode, u32* pCardHash, int nCardHash, u32* pKeyCode, int level, int iCardDevice)
|
||||
{
|
||||
if(iCardDevice)
|
||||
{
|
||||
const u8* BlowfishTwl = (const u8*)0x01FFD3E0;
|
||||
memcpy (pCardHash, BlowfishTwl, 0x1048);
|
||||
}
|
||||
else
|
||||
if(iCardDevice)
|
||||
{
|
||||
const u8* BlowfishNtr = (const u8*)0x01FFE428;
|
||||
memcpy (pCardHash, BlowfishNtr, 0x1048);
|
||||
}
|
||||
const u8* BlowfishTwl = (const u8*)0x01FFD3E0;
|
||||
memcpy (pCardHash, BlowfishTwl, 0x1048);
|
||||
}
|
||||
else
|
||||
{
|
||||
const u8* BlowfishNtr = (const u8*)0x01FFE428;
|
||||
memcpy (pCardHash, BlowfishNtr, 0x1048);
|
||||
}
|
||||
|
||||
pKeyCode[0] = aGameCode;
|
||||
pKeyCode[1] = aGameCode/2;
|
||||
pKeyCode[2] = aGameCode*2;
|
||||
|
||||
if (level >= 1) NTR_ApplyKey (pCardHash, nCardHash, pKeyCode);
|
||||
if (level >= 1) NTR_ApplyKey (pCardHash, nCardHash, pKeyCode);
|
||||
if (level >= 2) NTR_ApplyKey (pCardHash, nCardHash, pKeyCode);
|
||||
|
||||
pKeyCode[1] = pKeyCode[1]*2;
|
||||
@ -234,7 +234,7 @@ void NTR_CmdSecure (u32 flags, void* buffer, u32 length, u8* pcmd)
|
||||
|
||||
bool NTR_Secure_Init (u8* header, u32 CartID, int iCardDevice)
|
||||
{
|
||||
u32 iGameCode;
|
||||
u32 iGameCode;
|
||||
u32 iCardHash[0x412] = {0};
|
||||
u32 iKeyCode[3] = {0};
|
||||
u32* secureArea=(u32*)(void*)(header + 0x4000);
|
||||
@ -244,10 +244,10 @@ bool NTR_Secure_Init (u8* header, u32 CartID, int iCardDevice)
|
||||
bool iCheapCard = (CartID & 0x80000000) != 0;
|
||||
u32 cardControl13 = *((vu32*)(void*)&header[0x60]);
|
||||
u32 cardControlBF = *((vu32*)(void*)&header[0x64]);
|
||||
u16 readTimeout = *((vu16*)(void*)&header[0x6E]);
|
||||
u16 readTimeout = *((vu16*)(void*)&header[0x6E]);
|
||||
u32 nds9Offset = *((vu32*)(void*)&header[0x20]);
|
||||
u8 deviceType = header[0x13];
|
||||
int nCardHash = sizeof (iCardHash) / sizeof (iCardHash[0]);
|
||||
u8 deviceType = header[0x13];
|
||||
int nCardHash = sizeof (iCardHash) / sizeof (iCardHash[0]);
|
||||
u32 flagsKey1=NTRCARD_ACTIVATE|NTRCARD_nRESET|(cardControl13&(NTRCARD_WR|NTRCARD_CLK_SLOW))|((cardControlBF&(NTRCARD_CLK_SLOW|NTRCARD_DELAY1(0x1FFF)))+((cardControlBF&NTRCARD_DELAY2(0x3F))>>16));
|
||||
u32 flagsSec=(cardControlBF&(NTRCARD_CLK_SLOW|NTRCARD_DELAY1(0x1FFF)|NTRCARD_DELAY2(0x3F)))|NTRCARD_ACTIVATE|NTRCARD_nRESET|NTRCARD_SEC_EN|NTRCARD_SEC_DAT;
|
||||
|
||||
@ -258,7 +258,7 @@ bool NTR_Secure_Init (u8* header, u32 CartID, int iCardDevice)
|
||||
if(!iCheapCard) flagsKey1 |= NTRCARD_SEC_LARGE;
|
||||
//Debug("iCheapCard=%d, readTimeout=%d", iCheapCard, readTimeout);
|
||||
|
||||
NTR_InitKey1 (cmdData, &iKey1, iCardDevice);
|
||||
NTR_InitKey1 (cmdData, &iKey1, iCardDevice);
|
||||
//Debug("cmdData=%02X %02X %02X %02X %02X %02X %02X %02X ", cmdData[0], cmdData[1], cmdData[2], cmdData[3], cmdData[4], cmdData[5], cmdData[6], cmdData[7]);
|
||||
//Debug("iKey1=%08X %08X %08X", iKey1.iii, iKey1. jjj, iKey1. kkkkk);
|
||||
//Debug("iKey1=%08X %08X %08X", iKey1. llll, iKey1. mmm, iKey1. nnn);
|
||||
@ -270,7 +270,7 @@ bool NTR_Secure_Init (u8* header, u32 CartID, int iCardDevice)
|
||||
if(iCheapCard)
|
||||
{
|
||||
NTR_CmdSecure (flagsKey1, NULL, 0, cmdData);
|
||||
NTR_SecureDelay(readTimeout);
|
||||
NTR_SecureDelay(readTimeout);
|
||||
}
|
||||
NTR_CmdSecure (flagsKey1, NULL, 0, cmdData);
|
||||
|
||||
@ -288,7 +288,7 @@ bool NTR_Secure_Init (u8* header, u32 CartID, int iCardDevice)
|
||||
if(iCheapCard)
|
||||
{
|
||||
NTR_CmdSecure (flagsKey1, NULL, 0, cmdData);
|
||||
NTR_SecureDelay(readTimeout);
|
||||
NTR_SecureDelay(readTimeout);
|
||||
}
|
||||
|
||||
//NTR_CmdSecure (flagsKey1, &SecureCartID, sizeof (SecureCartID), cmdData);
|
||||
@ -307,7 +307,7 @@ bool NTR_Secure_Init (u8* header, u32 CartID, int iCardDevice)
|
||||
if (iCheapCard)
|
||||
{
|
||||
NTR_CmdSecure (flagsSec, NULL, 0, cmdData);
|
||||
NTR_SecureDelay(readTimeout);
|
||||
NTR_SecureDelay(readTimeout);
|
||||
for(int ii=8;ii>0;--ii)
|
||||
{
|
||||
NTR_CmdSecure (flagsSec | NTRCARD_BLK_SIZE(1), secureArea + secureAreaOffset, 0x200, cmdData);
|
||||
@ -325,15 +325,15 @@ bool NTR_Secure_Init (u8* header, u32 CartID, int iCardDevice)
|
||||
if(iCheapCard)
|
||||
{
|
||||
NTR_CmdSecure (flagsKey1, NULL, 0, cmdData);
|
||||
NTR_SecureDelay(readTimeout);
|
||||
NTR_SecureDelay(readTimeout);
|
||||
}
|
||||
NTR_CmdSecure (flagsKey1, NULL, 0, cmdData);
|
||||
|
||||
//CycloDS doesn't like the dsi secure area being decrypted
|
||||
if(!iCardDevice && ((nds9Offset != 0x4000) || secureArea[0] || secureArea[1]))
|
||||
{
|
||||
NTR_DecryptSecureArea (iGameCode, iCardHash, nCardHash, iKeyCode, secureArea, iCardDevice);
|
||||
}
|
||||
NTR_DecryptSecureArea (iGameCode, iCardHash, nCardHash, iKeyCode, secureArea, iCardDevice);
|
||||
}
|
||||
|
||||
//Debug("secure area %08X %08X", secureArea[0], secureArea[1]);
|
||||
if(secureArea[0] == 0x72636e65/*'encr'*/ && secureArea[1] == 0x6a624f79/*'yObj'*/)
|
||||
@ -345,7 +345,7 @@ bool NTR_Secure_Init (u8* header, u32 CartID, int iCardDevice)
|
||||
{
|
||||
//Debug("Invalid secure area (%08X %08X)", secureArea[0], secureArea[1]);
|
||||
//dragon quest 5 has invalid secure area. really.
|
||||
//return false;
|
||||
//return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -2049,7 +2049,7 @@ u32 ShowGameFileTitleInfo(const char* path) {
|
||||
}
|
||||
|
||||
u32 ShowCiaCheckerInfo(const char* path) {
|
||||
CiaStub* cia = (CiaStub*) malloc(sizeof(CiaStub));
|
||||
CiaStub* cia = (CiaStub*) malloc(sizeof(CiaStub));
|
||||
if (!cia) return 1;
|
||||
|
||||
// path string
|
||||
@ -2075,11 +2075,11 @@ u32 ShowCiaCheckerInfo(const char* path) {
|
||||
|
||||
// check ticket
|
||||
if (ValidateTicket((Ticket*)&(cia->ticket)) == 0)
|
||||
state_ticket = (ValidateTicketSignature((Ticket*)&(cia->ticket)) == 0) ? 2 : 1;
|
||||
state_ticket = (ValidateTicketSignature((Ticket*)&(cia->ticket)) == 0) ? 2 : 1;
|
||||
|
||||
// check tmd
|
||||
if (ValidateTmd(&(cia->tmd)) == 0)
|
||||
state_tmd = (ValidateTmdSignature(&(cia->tmd)) == 0) ? 2 : 1;
|
||||
state_tmd = (ValidateTmdSignature(&(cia->tmd)) == 0) ? 2 : 1;
|
||||
|
||||
// check for available contents
|
||||
u8* cnt_index = cia->header.content_index;
|
||||
@ -2093,28 +2093,28 @@ u32 ShowCiaCheckerInfo(const char* path) {
|
||||
// CIA type string
|
||||
char typestr[32];
|
||||
if (!state_ticket || !state_tmd || missing_first || (!is_dlc && (content_found != content_count)))
|
||||
snprintf(typestr, 32, "Possibly Broken");
|
||||
snprintf(typestr, 32, "Possibly Broken");
|
||||
else snprintf(typestr, 32, "%s %s%s",
|
||||
console_id ? "Personal" : "Universal",
|
||||
((state_ticket == 2) && (state_tmd == 2)) ? "Legit" :
|
||||
console_id ? "Personal" : "Universal",
|
||||
((state_ticket == 2) && (state_tmd == 2)) ? "Legit" :
|
||||
(state_tmd == 2) ? "Pirate Legit" : "Custom",
|
||||
is_dlc ? " DLC" : "");
|
||||
is_dlc ? " DLC" : "");
|
||||
|
||||
// output results
|
||||
s32 state_verify = -1;
|
||||
while (true) {
|
||||
if (!ShowPrompt(state_verify < 0, "%s\n%s CIA File\n \nTitle ID: %016llX\nConsole ID: %08lX\nContents in CIA: %lu/%lu\nTicket/TMD: %s/%s\nVerification: %s",
|
||||
pathstr, typestr, title_id, console_id,
|
||||
content_found, content_count,
|
||||
(state_ticket == 0) ? "invalid" : (state_ticket == 2) ? "legit" : "illegit",
|
||||
(state_tmd == 0) ? "invalid" : (state_tmd == 2) ? "legit" : "illegit",
|
||||
(state_verify < 0) ? "pending\n \nProceed with verification?" : (state_verify == 0) ? "passed" : "failed") ||
|
||||
(state_verify >= 0)) break;
|
||||
state_verify = VerifyCiaFile(path);
|
||||
}
|
||||
while (true) {
|
||||
if (!ShowPrompt(state_verify < 0, "%s\n%s CIA File\n \nTitle ID: %016llX\nConsole ID: %08lX\nContents in CIA: %lu/%lu\nTicket/TMD: %s/%s\nVerification: %s",
|
||||
pathstr, typestr, title_id, console_id,
|
||||
content_found, content_count,
|
||||
(state_ticket == 0) ? "invalid" : (state_ticket == 2) ? "legit" : "illegit",
|
||||
(state_tmd == 0) ? "invalid" : (state_tmd == 2) ? "legit" : "illegit",
|
||||
(state_verify < 0) ? "pending\n \nProceed with verification?" : (state_verify == 0) ? "passed" : "failed") ||
|
||||
(state_verify >= 0)) break;
|
||||
state_verify = VerifyCiaFile(path);
|
||||
}
|
||||
|
||||
free(cia);
|
||||
return (state_ticket && state_tmd) ? 0 : 1;
|
||||
return (state_ticket && state_tmd) ? 0 : 1;
|
||||
}
|
||||
|
||||
u32 BuildNcchInfoXorpads(const char* destdir, const char* path) {
|
||||
|
@ -4,8 +4,8 @@
|
||||
|
||||
#define ReadFileCmac(path, cmac) ReadWriteFileCmac(path, cmac, false)
|
||||
#define WriteFileCmac(path, cmac) ReadWriteFileCmac(path, cmac, true)
|
||||
#define CheckCmdCmac(path) CheckFixCmdCmac(path, false)
|
||||
#define FixCmdCmac(path) CheckFixCmdCmac(path, true)
|
||||
#define CheckCmdCmac(path) CheckFixCmdCmac(path, false)
|
||||
#define FixCmdCmac(path) CheckFixCmdCmac(path, true)
|
||||
|
||||
u32 CheckCmacPath(const char* path);
|
||||
u32 ReadWriteFileCmac(const char* path, u8* cmac, bool do_write);
|
||||
|
Loading…
x
Reference in New Issue
Block a user