Skip to content

Commit

Permalink
Add Inferno driver sources
Browse files Browse the repository at this point in the history
  • Loading branch information
codestation committed Jul 9, 2017
1 parent 1753d7d commit e9c7b01
Show file tree
Hide file tree
Showing 19 changed files with 3,573 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cef/Makefile
@@ -1,4 +1,4 @@
all: _payloadex _rebootex _binary _systemctrl _popcorn _vshctrl _satelite _recovery bin2h
all: _payloadex _rebootex _binary _systemctrl _popcorn _vshctrl _inferno _satelite _recovery bin2h

_payloadex:
make -C payloadex clean
Expand Down Expand Up @@ -43,6 +43,14 @@ _vshctrl:
make -C vshctrl clean
bin2c flash0/kd/vshctrl.prx ../user/files/vshctrl.h vshctrl

_inferno:
make -C inferno clean
make -C inferno
psp-packer inferno/inferno.prx
cp "inferno/inferno.prx" "flash0/kd/inferno.prx"
make -C inferno clean
bin2c flash0/kd/inferno.prx ../user/files/inferno.h inferno

_satelite:
make -C satelite clean
make -C satelite
Expand All @@ -63,4 +71,4 @@ bin2h:
bin2c flash0/kd/pspbtknf.bin ../user/files/pspbtknf.h pspbtknf
bin2c flash0/kd/pspbtlnf.bin ../user/files/pspbtlnf.h pspbtlnf
bin2c flash0/kd/pspbtmnf.bin ../user/files/pspbtmnf.h pspbtmnf
bin2c flash0/kd/pspbtrnf.bin ../user/files/pspbtrnf.h pspbtrnf
bin2c flash0/kd/pspbtrnf.bin ../user/files/pspbtrnf.h pspbtrnf
22 changes: 22 additions & 0 deletions cef/inferno/Makefile
@@ -0,0 +1,22 @@
TARGET = inferno
OBJS = main.o iodrv_funcs.o umd.o isoread.o inferno_patch_offset.o isocache.o imports.o utils.o sctrlrand.o exports.o

INCDIR = ../include
CFLAGS = -Os -G0 -Wall -fshort-wchar -fno-pic -mno-check-zero-division
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

CFLAGS += -DCONFIG_661=1
PSP_FW_VERSION = 661

BUILD_PRX = 1
PRX_EXPORTS = exports.exp

USE_KERNEL_LIBC=1
USE_KERNEL_LIBS=1

LIBDIR = ../lib
LIBS = -lpspsystemctrl_kernel -lpspsemaphore

PSPSDK = $(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build_prx.mak
133 changes: 133 additions & 0 deletions cef/inferno/exports.exp
@@ -0,0 +1,133 @@
# Define the exports for the prx
PSP_BEGIN_EXPORTS

PSP_EXPORT_START(syslib, 0, 0x8000)
PSP_EXPORT_FUNC_HASH(module_start)
PSP_EXPORT_FUNC_HASH(module_stop)
PSP_EXPORT_VAR_HASH(module_info)
PSP_EXPORT_END

PSP_EXPORT_START(sceUmd, 0x0011, 0x0001)
# 6.20
PSP_EXPORT_FUNC_NID(sceUmdCheckMedium, 0xE70E8FFB)
PSP_EXPORT_FUNC_NID(sceUmdReplaceProhibit, 0xB1641203)
PSP_EXPORT_FUNC_NID(sceUmdReplacePermit, 0x70D9B731)
PSP_EXPORT_FUNC_NID(sceUmdGetDiscInfo, 0x9F53CFA1)
PSP_EXPORT_FUNC_NID(sceUmdCancelWaitDriveStat, 0x35B13E16)
PSP_EXPORT_FUNC_NID(sceUmdWaitDriveStatWithTimer, 0x6592E954)
PSP_EXPORT_FUNC_NID(sceUmdWaitDriveStatCB, 0x74145046)
PSP_EXPORT_FUNC_NID(sceUmdRegisterUMDCallBack, 0x5083C012)
PSP_EXPORT_FUNC_NID(sceUmdUnRegisterUMDCallBack, 0x51C95C02)
PSP_EXPORT_FUNC_NID(sceUmdGetErrorStatus, 0x1BA5BAFB)
PSP_EXPORT_FUNC_NID(sceUmdSetErrorStatus, 0x7E6182C7)
PSP_EXPORT_FUNC_NID(sceUmdSetDriveStatus, 0xF60013F8)
PSP_EXPORT_FUNC_NID(sceUmdGetDriveStatus, 0x2D5CB292)
PSP_EXPORT_FUNC_NID(sceUmdClearDriveStatus, 0xB826BD59)
PSP_EXPORT_FUNC_NID(sceUmd_004F4BE5, 0x004F4BE5)
PSP_EXPORT_FUNC_NID(sceUmd_107064CC, 0xE9101A0E)
PSP_EXPORT_FUNC_NID(sceUmd_C886430B, 0x259BDD2E)
# 6.35
PSP_EXPORT_FUNC_NID(sceUmdCheckMedium, 0x8213F674)
PSP_EXPORT_FUNC_NID(sceUmdReplaceProhibit, 0xB1E889EB)
PSP_EXPORT_FUNC_NID(sceUmdReplacePermit, 0xE34F613F)
PSP_EXPORT_FUNC_NID(sceUmdGetDiscInfo, 0x47B447E5)
PSP_EXPORT_FUNC_NID(sceUmdCancelWaitDriveStat, 0x145DBD8C)
PSP_EXPORT_FUNC_NID(sceUmdWaitDriveStatWithTimer, 0xF0E95430)
PSP_EXPORT_FUNC_NID(sceUmdWaitDriveStatCB, 0xFAAA2DC6)
PSP_EXPORT_FUNC_NID(sceUmdRegisterUMDCallBack, 0x58708431)
PSP_EXPORT_FUNC_NID(sceUmdUnRegisterUMDCallBack, 0x6E350FE4)
PSP_EXPORT_FUNC_NID(sceUmdGetErrorStatus, 0x749B5538)
PSP_EXPORT_FUNC_NID(sceUmdSetErrorStatus, 0x3F826E9B)
PSP_EXPORT_FUNC_NID(sceUmdSetDriveStatus, 0x7E185F98)
PSP_EXPORT_FUNC_NID(sceUmdGetDriveStatus, 0x7E45DF26)
PSP_EXPORT_FUNC_NID(sceUmdClearDriveStatus, 0x507AB2B8)
PSP_EXPORT_FUNC_NID(sceUmd_004F4BE5, 0x24E838BA)
PSP_EXPORT_FUNC_NID(sceUmd_107064CC, 0x107064CC)
PSP_EXPORT_FUNC_NID(sceUmd_C886430B, 0xC886430B)
# 6.60
PSP_EXPORT_FUNC_NID(sceUmdCheckMedium, 0xA9B5B972)
PSP_EXPORT_FUNC_NID(sceUmdReplaceProhibit, 0x4F017CDE)
PSP_EXPORT_FUNC_NID(sceUmdReplacePermit, 0x0B14CE61)
PSP_EXPORT_FUNC_NID(sceUmdGetDiscInfo, 0xBA3D2A5F)
PSP_EXPORT_FUNC_NID(sceUmdCancelWaitDriveStat, 0x18E225C8)
PSP_EXPORT_FUNC_NID(sceUmdWaitDriveStatWithTimer, 0x8DCFBA06)
PSP_EXPORT_FUNC_NID(sceUmdWaitDriveStatCB, 0x98AFBD10)
PSP_EXPORT_FUNC_NID(sceUmdRegisterUMDCallBack, 0x5EBB491F)
PSP_EXPORT_FUNC_NID(sceUmdUnRegisterUMDCallBack, 0x598EC4DC)
PSP_EXPORT_FUNC_NID(sceUmdGetErrorStatus, 0x666580EA)
PSP_EXPORT_FUNC_NID(sceUmdSetErrorStatus, 0x07E98AF8)
PSP_EXPORT_FUNC_NID(sceUmdSetDriveStatus, 0x982272FE)
PSP_EXPORT_FUNC_NID(sceUmdGetDriveStatus, 0xB7BF4C31)
PSP_EXPORT_FUNC_NID(sceUmdClearDriveStatus, 0x6EDF57F1)
PSP_EXPORT_FUNC_NID(sceUmd_004F4BE5, 0x040A7090)
PSP_EXPORT_FUNC_NID(sceUmd_107064CC, 0x899B5C41)
PSP_EXPORT_FUNC_NID(sceUmd_C886430B, 0x816E656B)
# non-random NID
PSP_EXPORT_FUNC_HASH(sceUmdWaitDriveStat)
PSP_EXPORT_FUNC_HASH(sceUmdActivate)
PSP_EXPORT_FUNC_HASH(sceUmdDeactivate)
PSP_EXPORT_END

PSP_EXPORT_START(sceUmdUser, 0x0011, 0x4001)
PSP_EXPORT_FUNC_HASH(sceUmdGetErrorStat)
PSP_EXPORT_FUNC_HASH(sceUmdGetDiscInfo)
PSP_EXPORT_FUNC_HASH(sceUmdCheckMedium)
PSP_EXPORT_FUNC_HASH(sceUmdWaitDriveStatCB)
PSP_EXPORT_FUNC_HASH(sceUmdWaitDriveStatWithTimer)
PSP_EXPORT_FUNC_HASH(sceUmdCancelWaitDriveStat)
PSP_EXPORT_FUNC_HASH(sceUmdGetDriveStat)
PSP_EXPORT_FUNC_HASH(sceUmdReplaceProhibit)
PSP_EXPORT_FUNC_HASH(sceUmdWaitDriveStat)
PSP_EXPORT_FUNC_HASH(sceUmdRegisterUMDCallBack)
PSP_EXPORT_FUNC_HASH(sceUmdUnRegisterUMDCallBack)
PSP_EXPORT_FUNC_HASH(sceUmdActivate)
PSP_EXPORT_FUNC_HASH(sceUmdReplacePermit)
PSP_EXPORT_FUNC_HASH(sceUmdDeactivate)
PSP_EXPORT_END

PSP_EXPORT_START(sceUmdMan_driver, 0x0011, 0x0001)
# 6.20
PSP_EXPORT_FUNC_NID(sceUmdMan_driver_D37B6422, 0xD37B6422)
PSP_EXPORT_FUNC_NID(sceUmdMan_driver_6A1FB0DD, 0x6A1FB0DD)
PSP_EXPORT_FUNC_NID(sceUmdMan_driver_7DF4C4DA, 0x7DF4C4DA)
PSP_EXPORT_FUNC_NID(sceUmdMan_driver_F7A0D0D9, 0xF7A0D0D9)
PSP_EXPORT_FUNC_NID(sceUmdMan_driver_4FFAB8DA, 0x4FFAB8DA)
# 6.35
PSP_EXPORT_FUNC_NID(sceUmdMan_driver_D37B6422, 0x454E1B06)
PSP_EXPORT_FUNC_NID(sceUmdMan_driver_6A1FB0DD, 0xE52119E7)
PSP_EXPORT_FUNC_NID(sceUmdMan_driver_7DF4C4DA, 0x7AD43944)
PSP_EXPORT_FUNC_NID(sceUmdMan_driver_F7A0D0D9, 0x42D993AC)
PSP_EXPORT_FUNC_NID(sceUmdMan_driver_4FFAB8DA, 0x26C75616)
# 6.60
PSP_EXPORT_FUNC_NID(sceUmdMan_driver_D37B6422, 0x80D31D5D)
PSP_EXPORT_FUNC_NID(sceUmdMan_driver_6A1FB0DD, 0x34375DB0)
PSP_EXPORT_FUNC_NID(sceUmdMan_driver_7DF4C4DA, 0xA7536109)
PSP_EXPORT_FUNC_NID(sceUmdMan_driver_F7A0D0D9, 0x65E2B3E0)
PSP_EXPORT_FUNC_NID(sceUmdMan_driver_4FFAB8DA, 0x3C8C523D)
PSP_EXPORT_END

PSP_EXPORT_START(sceUmd9660_driver, 0x0011, 0x0001)
# 6.20
PSP_EXPORT_FUNC_NID(sceUmd9660_driver_63342C0F, 0x63342C0F)
PSP_EXPORT_FUNC_NID(sceUmd9660_driver_6FFFEE54, 0x6FFFEE54)
PSP_EXPORT_FUNC_NID(sceUmd9660_driver_7CB291E3, 0x7CB291E3)
# 6.35
PSP_EXPORT_FUNC_NID(sceUmd9660_driver_63342C0F, 0x385336B5)
PSP_EXPORT_FUNC_NID(sceUmd9660_driver_6FFFEE54, 0x1D89BD8F)
PSP_EXPORT_FUNC_NID(sceUmd9660_driver_7CB291E3, 0x94ACF219)
# 6.60
PSP_EXPORT_FUNC_NID(sceUmd9660_driver_63342C0F, 0x887C3193)
PSP_EXPORT_FUNC_NID(sceUmd9660_driver_6FFFEE54, 0xC0933C16)
PSP_EXPORT_FUNC_NID(sceUmd9660_driver_7CB291E3, 0x7EB57F56)
PSP_EXPORT_END

PSP_EXPORT_START(inferno_driver, 0x0011, 0x0001)
PSP_EXPORT_FUNC(infernoSetDiscType)
PSP_EXPORT_END

PSP_EXPORT_START(CacheCtrl, 0x0011, 0x0001)
PSP_EXPORT_FUNC(isocache_stat)
PSP_EXPORT_FUNC(infernoCacheSetPolicy)
PSP_EXPORT_END

PSP_END_EXPORTS
17 changes: 17 additions & 0 deletions cef/inferno/imports.S
@@ -0,0 +1,17 @@
.set noreorder

#include "pspstub.s"

STUB_START "SysMemForKernel",0x00000011,0x00050005
STUB_FUNC 0xC7E57B9C,sceKernelSetQTGP3
STUB_FUNC 0xFC114573,sceKernelGetCompiledSdkVersion
STUB_FUNC 0xCF4DE78C,sceKernelGetUIDcontrolBlock
STUB_FUNC 0x3FC9AE6A,sceKernelDevkitVersion
STUB_FUNC 0x6373995D,sceKernelGetModel
STUB_END

STUB_START "InitForKernel",0x00090011,0x00030005
STUB_FUNC 0xEE67E450,sceKernelBootFromGo635
STUB_FUNC 0x977A0F90,sceKernelBootFromGo620
STUB_FUNC 0x7233B5BC,sceKernelApplicationType
STUB_END
76 changes: 76 additions & 0 deletions cef/inferno/inferno.h
@@ -0,0 +1,76 @@
/*
* This file is part of PRO CFW.
* PRO CFW is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* PRO CFW 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.
*
* You should have received a copy of the GNU General Public License
* along with PRO CFW. If not, see <http://www.gnu.org/licenses/ .
*/

#ifndef INFERNO_H
#define INFERNO_H

#include "inferno_patch_offset.h"

#define ISO_SECTOR_SIZE 2048
#define CISO_IDX_BUFFER_SIZE 0x200
#define CISO_DEC_BUFFER_SIZE 0x2000

#define MAX_FILES_NR 8

#define SAFE_FREE(p) \
do { \
if(p != NULL) { \
oe_free(p); \
p = NULL; \
} \
} while ( 0 )

struct IoReadArg {
u32 offset; // 0
u8 *address; // 4
u32 size; // 8
};

extern u32 psp_model;
extern u32 psp_fw_version;
extern PspIoDrv g_iodrv;

extern SceUID g_umd_cbid;
extern int g_umd_error_status;
extern int g_drive_status;

extern const char *g_iso_fn;
extern int g_game_fix_type;
extern SceUID g_drive_status_evf;
extern void *g_sector_buf;
extern SceUID g_umd9660_sema_id;
extern int g_iso_opened;
extern SceUID g_iso_fd;
extern int g_total_sectors;
extern struct IoReadArg g_read_arg;
extern int g_disc_type;

extern void sceUmdSetDriveStatus(int status);

extern int power_event_handler(int ev_id, char *ev_name, void *param, int *result);

extern int iso_open(void);
extern int iso_read(struct IoReadArg *args);
extern int iso_cache_read(struct IoReadArg *args);
extern int iso_read_with_stack(u32 offset, void *ptr, u32 data_len);

extern int infernoSetDiscType(int type);
extern int infernoCacheInit(int cache_size, int cache_num);
extern int infernoCacheAdd(u32 pos, int len);
extern void infernoCacheSetPolicy(int policy);

#endif
112 changes: 112 additions & 0 deletions cef/inferno/inferno_patch_offset.c
@@ -0,0 +1,112 @@
/*
* This file is part of PRO CFW.
* PRO CFW is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* PRO CFW 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.
*
* You should have received a copy of the GNU General Public License
* along with PRO CFW. If not, see <http://www.gnu.org/licenses/ .
*/

#include <pspsdk.h>
#include "inferno_patch_offset.h"

#if !defined(CONFIG_635) && !defined(CONFIG_620) && !defined(CONFIG_639) && !defined(CONFIG_660) && !defined(CONFIG_661)
#error You have to define CONFIG_620 or CONFIG_635 or CONFIG_639 or CONFIG_660 or CONFIG_661
#endif

#if defined(CONFIG_660) || defined(CONFIG_661)
#ifdef CONFIG_660
PatchOffset g_660_offsets = {
.fw_version = FW_660,
#endif
#ifdef CONFIG_661
PatchOffset g_661_offsets = {
.fw_version = FW_661,
#endif
.patches = {
0x00003FEC,
0x00004024,
0x000040D8,
0x000042B4,
},
};
#endif

#ifdef CONFIG_639
PatchOffset g_639_offsets = {
.fw_version = FW_639,
.patches = {
0x00004020,
0x00004058,
0x0000410C,
0x000042E8,
},
};
#endif

#ifdef CONFIG_635
PatchOffset g_635_offsets = {
.fw_version = FW_635,
.patches = {
0x00004020,
0x00004058,
0x0000410C,
0x000042E8,
},
};
#endif

#ifdef CONFIG_620
PatchOffset g_620_offsets = {
.fw_version = FW_620,
.patches = {
0x00004020,
0x00004058,
0x0000410C,
0x000042E8,
},
};
#endif

PatchOffset *g_offs = NULL;

void setup_patch_offset_table(u32 fw_version)
{
#ifdef CONFIG_661
if(fw_version == g_661_offsets.fw_version) {
g_offs = &g_661_offsets;
}
#endif

#ifdef CONFIG_660
if(fw_version == g_660_offsets.fw_version) {
g_offs = &g_660_offsets;
}
#endif

#ifdef CONFIG_639
if(fw_version == g_639_offsets.fw_version) {
g_offs = &g_639_offsets;
}
#endif

#ifdef CONFIG_635
if(fw_version == g_635_offsets.fw_version) {
g_offs = &g_635_offsets;
}
#endif

#ifdef CONFIG_620
if(fw_version == g_620_offsets.fw_version) {
g_offs = &g_620_offsets;
}
#endif
}

0 comments on commit e9c7b01

Please sign in to comment.