Skip to content

Commit

Permalink
PRO-C(CHN)
Browse files Browse the repository at this point in the history
  • Loading branch information
銀の契约者 committed Mar 15, 2015
1 parent 381f705 commit 9d8a1f4
Show file tree
Hide file tree
Showing 506 changed files with 76,319 additions and 0 deletions.
30 changes: 30 additions & 0 deletions CIPL/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

PSP_FW_VERSION = 0

ifeq ($(CONFIG_639), 1)
CFLAGS += -DCONFIG_639=1
PSP_FW_VERSION = 639
endif

ifeq ($(CONFIG_660), 1)
CFLAGS += -DCONFIG_660=1
PSP_FW_VERSION = 660
endif

ifeq ($(CONFIG_661), 1)
CFLAGS += -DCONFIG_661=1
PSP_FW_VERSION = 661
endif

all:
make -C payloadex PSP_FW_VERSION=$(PSP_FW_VERSION) PSP_MODEL=0
make -C payloadex PSP_FW_VERSION=$(PSP_FW_VERSION) PSP_MODEL=1
make -C mainbinex PSP_FW_VERSION=$(PSP_FW_VERSION) PSP_MODEL=0
make -C mainbinex PSP_FW_VERSION=$(PSP_FW_VERSION) PSP_MODEL=1
make -C combine

clean:
make clean -C payloadex
make clean -C mainbinex
make clean -C combine
@rm -f ipl_block_01g.h ipl_block_large.h
1 change: 1 addition & 0 deletions CIPL/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The source of Custom IPL goes here
Binary file added CIPL/btcnf/pspbtcnf_1g_63X_recovery_pro.bin
Binary file not shown.
Binary file added CIPL/btcnf/pspbtcnf_2g_63X_recovery_pro.bin
Binary file not shown.
175 changes: 175 additions & 0 deletions CIPL/btcnf/recovery_btcnf_01g.h

Large diffs are not rendered by default.

175 changes: 175 additions & 0 deletions CIPL/btcnf/recovery_btcnf_02g.h

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions CIPL/combine/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
MODULE_PATH = ..

all:
./combine.py ipl_header_01g.bin ../mainbinex/patch_01g.bin ipl_block_01g.bin
./combine.py -l 0x24000 ipl_header_02g.bin ../mainbinex/patch_02g.bin ipl_block_02g.bin
bin2c ipl_block_01g.bin ipl_block_01g.h ipl_block_01g
bin2c ipl_block_02g.bin ipl_block_large.h ipl_block_large
sed "s/((aligned(16)))/((aligned(64)))/" ipl_block_large.h > $(MODULE_PATH)/ipl_block_large.h
sed "/int/d" ipl_block_01g.h > $(MODULE_PATH)/ipl_block_01g.h

clean:
@rm -f ipl_block_01g.h ipl_block_large.h
@rm -f ipl_block_01g.bin ipl_block_02g.bin
56 changes: 56 additions & 0 deletions CIPL/combine/combine.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/python

import os, sys, getopt

def usage():
print ("Usage: %s [-l size ] basefile input output" % (sys.argv[0]))

def write_file(fn, buf):
fp = open(fn, "wb")
fp.write(buf)
fp.close()

def main():
inputsize = 0

try:
optlist, args = getopt.getopt(sys.argv[1:], 'l:h')
except getopt.GetoptError:
usage()
sys.exit(2)

for o, a in optlist:
if o == "-h":
usage()
sys.exit()
if o == "-l":
inputsize = int(a, 16)

inputsize = max(inputsize, 0x4000);

if len(args) < 3:
usage()
sys.exit(2)

basefile = args[0]
inputfile = args[1]
outputfile = args[2]

fp = open(basefile, "rb")
buf = fp.read(0x1000)
fp.close()

if len(buf) < inputsize:
buf += '\0' * (inputsize - len(buf))

assert(len(buf) == inputsize)

fp = open(inputfile, "rb")
ins = fp.read(0x3000)
fp.close()
buf = buf[0:0x1000] + ins + buf[0x1000+len(ins):]
assert(len(buf) == inputsize)
write_file(outputfile, buf)

if __name__ == "__main__":
main()
14 changes: 14 additions & 0 deletions CIPL/combine/combine_src/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
OUTPUT=combine
OBJS=main.o
CFLAGS=-Wall -I.
LDFLAGS=-L.
LIBS = -lz

all: $(OUTPUT)

clean:
rm -f $(OUTPUT) *.o


$(OUTPUT): $(OBJS)
$(LINK.c) $(LDFLAGS) -o $@ $^ $(LIBS)
122 changes: 122 additions & 0 deletions CIPL/combine/combine_src/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
//#include <zlib.h>

#define u8 unsigned char
#define u16 unsigned short
#define u32 unsigned int

int ReadFile(char *file, void *buf, int size)
{
FILE *f = fopen(file, "rb");

if (!f)
return -1;

int rd = fread(buf, 1, size, f);
fclose(f);

return rd;
}

int WriteFile(char *file, void *buf, int size)
{
FILE *f = fopen(file, "wb");

if (!f)
return -1;

int wt = fwrite(buf, 1, size, f);
fclose(f);

return wt;
}


void usage(char *prog)
{
printf("Usage: %s [-l size ] basefile input output\n", prog);
}

// 0x1000
// 0x4000

int main(int argc, char *argv[])
{
u8 *input, *output;
u32 input_size = 0;
FILE *f;
int res = 0;
char *outfile;

if (argc < 2 || argc > 6)
{
usage(argv[0]);
return -1;
}

if (strcmp(argv[1], "-l") == 0)
{
argv++;
argc--;

input_size = strtol(argv[1], NULL, 16);
printf("Input size: 0x%08X\n", input_size );

argv++;
argc--;
}

if( input_size < 0x4000 )
input_size = 0x4000;

f = fopen(argv[1], "rb");
if (!f)
{
printf("Cannot open %s\n", argv[1]);
return -1;
}

fseek(f, 0, SEEK_SET);

output = malloc( input_size );
if (!output)
{
printf("Cannot allocate memory for output buffer.\n");
return -1;
}

memset( output , 0 , input_size );

fread( output , 1, 0x1000 , f);
fclose(f);

f = fopen(argv[2], "rb");
if (!f)
{
printf("Cannot open %s\n", argv[2]);
free(output);
return -1;
}
fseek(f, 0, SEEK_SET);
fread( output + 0x1000 , 1, 0x3000 , f);
fclose(f);

if (WriteFile( argv[3] , output, input_size ) != input_size )
{
printf("Error writing file %s.\n", outfile);
res = -1;
}

free(output);
return res;
}

Binary file added CIPL/combine/ipl_header_01g.bin
Binary file not shown.
Binary file added CIPL/combine/ipl_header_02g.bin
Binary file not shown.
6 changes: 6 additions & 0 deletions CIPL/credit.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

-- credit --

Team C+D :For PandoraExploit.
Dark_AleX:For his CustomIPL sample.
Booster :For his IPLSDK.
24 changes: 24 additions & 0 deletions CIPL/mainbinex/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
PSPDEV=$(shell psp-config --pspsdk-path)
INCLUDES=-I $(PSPDEV)/include

ifeq ($(PSP_MODEL),1)
TARGET = patch_02g
else
TARGET = patch_01g
endif

CFLAGS=$(INCLUDES) -W -Wall -G0 -Os -DPSP_MODEL=$(PSP_MODEL) -D_PSP_FW_VERSION=$(PSP_FW_VERSION)

all: a.bin

a.bin:
psp-gcc $(CFLAGS) -fno-pic -mno-abicalls -w -S main.c -o main.s
psp-as main.s -o main.o
psp-ld -T linkfile.l main.o -o main.elf
psp-strip -s main.elf
psp-objcopy -O binary main.elf $(TARGET).bin
# bin2c h.bin rebootex.h rebootex
@rm -rf *~ *.o *.elf *.s

clean:
@rm -f *.bin
24 changes: 24 additions & 0 deletions CIPL/mainbinex/linkfile.l
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
OUTPUT_FORMAT("elf32-littlemips")
OUTPUT_ARCH(mips)

ENTRY(Patch_Entry)

SECTIONS
{
. = 0x040e0000;
.text.startup : {
*(.text.startup)
}
.text : {
*(.text)
}
.rodata : {
*(.rodata)
}
.data : {
*(.data)
}
.bss : {
*(.bss)
}
}
Loading

0 comments on commit 9d8a1f4

Please sign in to comment.