Skip to content

Commit

Permalink
fixed all the issues ready for 0.85
Browse files Browse the repository at this point in the history
  • Loading branch information
RShadowhand committed Jun 30, 2016
1 parent 9a7702e commit 394be3e
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 359 deletions.
12 changes: 1 addition & 11 deletions payload_altstage2/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,6 @@
#define A11_PAYLOAD_LOC 0x1FFF4C80 //keep in mind this needs to be changed in the ld script for arm11 too
#define A11_ENTRY 0x1FFFFFF8

// static void ownArm11()
// {
// memcpy((void*)A11_PAYLOAD_LOC, arm11_bin, arm11_bin_size);
// *(vu32 *)A11_ENTRY = 1;
// *(vu32 *)0x1FFAED80 = 0xE51FF004;
// *(vu32 *)0x1FFAED84 = A11_PAYLOAD_LOC;
// *(vu8 *)0x1FFFFFF0 = 2;
// while(*(vu32 *)A11_ENTRY);
// }

static void ownArm11(u32 screenInit)
{
memcpy((void *)A11_PAYLOAD_LOC, arm11_bin, arm11_bin_size);
Expand Down Expand Up @@ -49,7 +39,7 @@ void main()
unsigned int br;

f_mount(&fs, "0:", 0); //This never fails due to deferred mounting
if(f_open(&payload, "homebrew/safe_mode.bin", FA_READ) == FR_OK)
if(f_open(&payload, "homebrew/3ds/bootmgr.bin", FA_READ) == FR_OK)
{
prepareForBoot();
f_read(&payload, (void *)PAYLOAD_ADDRESS, f_size(&payload), &br);
Expand Down
12 changes: 3 additions & 9 deletions payload_stage2/source/buttons.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,11 @@
#include "types.h"

#define HID_PAD (*(vu32 *)0x10146000 ^ 0xFFF)

#define BUTTON_R1 (1 << 8)
#define BUTTON_L1 (1 << 9)
#define BUTTON_A 1
#define BUTTON_B (1 << 1)
#define BUTTON_X (1 << 10)
#define BUTTON_Y (1 << 11)
#define BUTTON_SELECT (1 << 2)
#define BUTTON_START (1 << 3)
#define BUTTON_RIGHT (1 << 4)
#define BUTTON_LEFT (1 << 5)
#define BUTTON_UP (1 << 6)
#define BUTTON_DOWN (1 << 7)
#define BUTTON_L1R1 (BUTTON_R1 | BUTTON_L1)
#define BUTTON_LEFT (1 << 5)

#define SAFE_MODE (BUTTON_R1 | BUTTON_L1 | BUTTON_A | BUTTON_UP)
144 changes: 0 additions & 144 deletions payload_stage2/source/font.h

This file was deleted.

5 changes: 0 additions & 5 deletions payload_stage2/source/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ u32 fileRead(void *dest, const char *path)
return size;
}

u32 fileUnlink(const char *path)
{
return (f_unlink(path) == FR_OK);
}

void firmRead(void *dest)
{
const char *firmFolders[] = { "00000002", "20000002" };
Expand Down
1 change: 0 additions & 1 deletion payload_stage2/source/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ void mountSD(void);
void unmountSD(void);
u32 mountCTRNAND(void);
u32 fileRead(void *dest, const char *path);
u32 fileUnlink(const char *path);
void firmRead(void *dest);
39 changes: 23 additions & 16 deletions payload_stage2/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
#include "fs.h"
#include "firm.h"
#include "../build/bundled.h"
#include "utils.h"
#include "screen.h"
#include "stdio.h"

#define A11_PAYLOAD_LOC 0x1FFF4C80 //Keep in mind this needs to be changed in the ld script for arm11 too
#define A11_ENTRY 0x1FFFFFF8
Expand All @@ -31,33 +28,44 @@ static void ownArm11(u32 screenInit)
while(*(vu32 *)A11_ENTRY);
}

static inline void clearScreens(void)
{
memset32((void *)0x18300000, 0, 0x46500);
memset32((void *)0x18346500, 0, 0x38400);
}

void main(void)
{
mountSD();

u32 payloadFound;

if(HID_PAD == BUTTON_LEFT){
if(fileRead((void *)PAYLOAD_ADDRESS, "homebrew/3ds/a9nc.bin")) // Full A9NC support
{
payloadFound = 1;
ownArm11(1);
clearScreens();
i2cWriteRegister(3, 0x22, 0x2A); //Turn on backlight
f_unlink("homebrew/3ds/a9nc.bin");
}
else{
ownArm11(0);
}

if(fileRead((void *)PAYLOAD_ADDRESS, "homebrew/a9nc.bin"))
else if(fileRead((void *)PAYLOAD_ADDRESS, "homebrew/3ds/boot.bin"))
{
payloadFound = 1;
f_unlink("homebrew/a9nc.bin");
if (HID_PAD != BUTTON_LEFT) // If DPAD_LEFT is not held
{
ownArm11(0); // Don't init the screen
}
else // If DPAD_LEFT is held
{
ownArm11(1); // Init the screen
clearScreens();
i2cWriteRegister(3, 0x22, 0x2A); //Turn on backlight
}
}
else if (fileRead((void *)PAYLOAD_ADDRESS, "homebrew/boot.bin"))
{
payloadFound = 1;
}
else
else //No payload found/no SD inserted
{
payloadFound = 0;
ownArm11(0);
}

//Jump to payload
Expand All @@ -71,7 +79,6 @@ void main(void)
unmountSD();

//If the SAFE_MODE combo is not pressed, try to patch and boot the CTRNAND FIRM
// if(HID_PAD == SAFE_MODE) loadFirm(); DO NOT ENABLE OR YOU WILL BRICK
if(HID_PAD != SAFE_MODE) loadFirm();

flushCaches();
Expand Down
87 changes: 0 additions & 87 deletions payload_stage2/source/screen.c

This file was deleted.

Loading

0 comments on commit 394be3e

Please sign in to comment.