Skip to content

Instantly share code, notes, and snippets.

View TuxSH's full-sized avatar
😼

TuxSH

😼
  • 04:48 (UTC +02:00)
View GitHub Profile
@TuxSH
TuxSH / functions.cpp
Created October 30, 2015 22:09
Pokémon Battle Revolution basic encryption/decryption functions
#define _CRT_SECURE_NO_WARNINGS
#define _SCL_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstdint>
using namespace std;
@TuxSH
TuxSH / salmon.rsf
Created January 20, 2016 21:31
PokéTransporter's exheader
NCCH:
Header: NCCH
Signature: B11E11F9B7557A0B8D7AD262A0F8D7105ED72927DD080527D59B59381AED864E
389EA95A770C3E338511364DBE650603A574C718EFB2276AE455C8BD09151D13
C3BC3A4EE6E7235132B017DA9C9122D483C091AEB5A9C5D09154007425695113
432DA2E6848A3E769F6DBCC149F49908844E19153EC650A48BA970410FFB6320
77A6FDFF5914FA6B5DA2A40D3B8E93F1E33C2E070442F41C4FD36843850DF288
57F7A5D24056E97A0B964A4C202A1ABFBA13484A4C7FEBE3040CC4A180DE26D2
3374D64C4ECFD78BB58B60319DFB84C135A1090EFC1867C557E76E4A6526E64C
@TuxSH
TuxSH / handlers.s
Created April 20, 2016 01:43
ARM9 exception vectors
@ Copyright (C) 2015 The PASTA Team
@
@ This program is free software; you can redistribute it and/or
@ modify it under the terms of the GNU General Public License
@ version 2 as published by the Free Software Foundation
@
@ 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.
@TuxSH
TuxSH / screenshot.c
Created May 6, 2016 20:46
screenshots
// taken from d9wip
#define TOP_SCREEN0 (u8*)(*(u32*)0x23FFFE00)
#define TOP_SCREEN1 (u8*)(*(u32*)0x23FFFE00)
#define BOT_SCREEN0 (u8*)(*(u32*)0x23FFFE08)
void Screenshot(const char* path)
{
u8* buffer = (u8*) 0x21000054; // careful, this area is used by other functions in Decrypt9
u8* buffer_t = buffer + 54 + (400 * 240 * 3);
.section01:1FF82328 svcTable11 DCD 0 ; 0
.section01:1FF82328 ; DATA XREF: .section01:1FF82228o
.section01:1FF82328 DCD 0xFFF03640 ; 1
.section01:1FF82328 DCD 0xFFF03AB4 ; 2
.section01:1FF82328 DCD 0xFFF043F0 ; 3
.section01:1FF82328 DCD 0xFFF05E18 ; 4
.section01:1FF82328 DCD 0xFFF05EBC ; 5
.section01:1FF82328 DCD 0xFFF0390C ; 6
.section01:1FF82328 DCD 0xFFF05F80 ; 7
.section01:1FF82328 DCD 0xFFF037F4 ; 8
@TuxSH
TuxSH / AMPXI_InstallFIRM_diff.c
Created May 10, 2016 11:27
AMPXI_InstallFIRM
/* old */
// ... some code ...
if ( (unsigned int)(v8 << 14) >> 24 != 17 || (v8 & 0x3FF) < 100 || (v8 & 0x3FF) > 179 )
{
if ( v8 < 0 )
goto LABEL_14;
v8 = sub_804A578(&v15);
if ( v8 < 0 )
goto LABEL_14;
@TuxSH
TuxSH / _AMPXI_CanInstall.c
Last active June 15, 2016 10:45
Version check before install
/* ... code ... */
for ( i = 0; i < v4; ++i )
{
sub_2F5F4(&v40, &v34, 8);
v7 = sub_2E72C(v41, v42);
v8 = (*(int (**)(void))(*(_DWORD *)v7 + 4))();
if ( v8 < 0 )
{
v9 = v8;
LABEL_18:
@TuxSH
TuxSH / PXIPS9_GetCTRCardAutoStartupBit.c
Created May 26, 2016 17:18
PXIPS9_GetCTRCardAutoStartupBit
int __fastcall PXIPS9_GetCTRCardAutoStartupBit(int *res)
{
int *v1; // r4@1
unsigned int v2; // r0@2
int v4; // r0@6
int result_cmd51; // [sp+0h] [bp-18h]@3
int result_cmda3; // [sp+4h] [bp-14h]@6
v1 = res;
if ( sub_4B88C() )
@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));
}
@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