Skip to content

Instantly share code, notes, and snippets.

View TuxSH's full-sized avatar
😼

TuxSH

😼
View GitHub Profile
Result __fastcall KResourceLimit::SetMaxLimit(KResourceLimit *resLimit, LimitableResource resType, u32 resCount)
{
signed int v3; // r10@0
KResourceLimit *v5; // r6@1
KObjectMutex *v6; // r0@1
KObjectMutex *v8; // r4@1
unsigned int v9; // r2@1
bool v10; // zf@1
unsigned int v11; // r3@2
Result result; // r0@8
@TuxSH
TuxSH / mcu.patches.c
Last active January 5, 2017 14:03
mcu sysmodule patches
http://pasteboard.co/iqqVeR2x1.png
02 01 10 E2 00 F0 20 E3 7B 00 00 4A =>
u32 *instr = (u32 *)memsearch(...);
instr -= 1;
// Make the version check always fail (fw up to date, skip flashing)
*instr = 0xE3E00000; // make an error code (r0 = 0xffffffff)
@TuxSH
TuxSH / flaunch.c
Created December 27, 2016 21:07
p9 firm section range checks
if ( arm9entryPoint - 0x8000000 >= 0x100000 )
goto ayy_lmao;
secNum = 0;
do
{
v17 = firmHeader + 0x30 * secNum;
sectionHeader = v17 + 0x40;
sectionSize = *(_DWORD *)(v17 + 0x48);
if ( sectionSize )
{
void __fastcall __noreturn mcuReboot(int mainCore)
{
int currentCore; // r4@1
signed int i; // r5@3
currentCore = __mrc(15, 0, 0, 0, 5) & 3;
flushDataCacheAndL2C();
coreBarrier();
if ( currentCore == mainCore )
{
@TuxSH
TuxSH / twlbg.c
Last active January 18, 2017 21:52
signed int __fastcall sub_300B78(_BYTE *a1, _BYTE *a2, int a3, int screen_mode)
{
signed int result; // r0@8
signed int v5; // r3@9
signed int v6; // r1@10
u16 *v7; // r7@11
signed int v8; // r1@15
signed int v9; // r3@16
u16 v10; // r5@17
u16 *v11; // r6@17
Result __fastcall KClientPort::MakeNewKClientSessionForPort(KClientPort *clientPort, KClientSession **out)
{
signed int v4; // r2@1
unsigned __int16 *v5; // r0@1
unsigned int v6; // r1@2
KSession *v7; // r0@4
KSession *session; // r4@4
KAutoObject *v9; // r0@6
KServerSession *serverSession; // r0@6
KClientSession *clientSession; // r0@6
if ( !levelHighActive_ )
{
LABEL_10:
if ( interruptID == 15 )
{
if ( sub_FFF0D1F8(&stru_FFF2E0A0.threadPairsPerPriority[3].last, 0, 1) )
{
res = 0xD8A007F0;
}
@TuxSH
TuxSH / 110.c
Created November 2, 2016 15:36
insert chunk diff
bool insertMemChunkHeader(RegionDescriptor *region, MemChunkHeader *newChunk, unsigned int nbPages, MemChunkHeader *left, MemChunkHeader *right)
{
// variable declarations ...
result = region;
v5 = nbPages;
left_ = left;
v7 = 0;
newChunk_ = newChunk;
v39 = 0;
@TuxSH
TuxSH / .c
Created November 1, 2016 21:18
System format RE
int __fastcall FSPXI_InitializeCTRFileSystem_internal(int a1, int a2)
{
int v2; // r4@1
int v3; // r2@1
int v4; // r1@1
int *v5; // r5@1
char *v6; // r0@1
_DWORD *v7; // r6@1
int (__fastcall *v8)(_DWORD); // r4@3
int v9; // r4@4
@TuxSH
TuxSH / P9_CMAC.c
Last active July 18, 2016 09:15
Process9 CMAC implementation
#include "aes.h"
static void aes128_processBlock(u8 *dst, const u8 *src, u32 keyslot)
{
u8 zeroes[16] __attribute__((aligned(32))) = {0};
use_aeskey(keyslot);
set_ctr(zeroes);
aes_decrypt(src, dst, 1, (AES_CBC_ENCRYPT_MODE | AES_CNT_INPUT_ORDER | AES_CNT_OUTPUT_ORDER | AES_CNT_INPUT_ENDIAN | AES_CNT_OUTPUT_ENDIAN));
}