Skip to content

Commit

Permalink
initial import 0.3x branch into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Nov 24, 2011
0 parents commit 06ea093
Show file tree
Hide file tree
Showing 58 changed files with 7,952 additions and 0 deletions.
340 changes: 340 additions & 0 deletions COPYING

Large diffs are not rendered by default.

148 changes: 148 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
#---------------------------------------------------------------------------------
# Clear the implicit built in rules
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(PSL1GHT)),)
$(error "Please set PSL1GHT in your environment. export PSL1GHT=<path>")
endif

include $(PSL1GHT)/ppu_rules

TITLE := SACD-Ripper
APPID := SACDRIP01
CONTENTID := UP0001-$(APPID)_00-0000000000000000
SFOXML := ../bin/sfo.xml
ICON0 := ../bin/ICON0.PNG

#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
#---------------------------------------------------------------------------------
TARGET := $(notdir $(CURDIR))
TARGETS := libs tools
BUILD := build
SOURCES := src
DATA :=
INCLUDES := src libs/libunself libs/libpatchutils libs/libsacd libs/libcommon

#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------

CFLAGS = -O2 -Wall -mcpu=cell $(MACHDEP) $(INCLUDE) -DAPPID=$(APPID)
CXXFLAGS = $(CFLAGS)

LDFLAGS = $(MACHDEP) -Wl,-Map,$(notdir $@).map

#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS := -lrsx -lgcm_sys -lio -lsysmodule -lsysutil -lrt -llv2 -lm -lunself -lpatchutils -lsacd -lsysfs -lcommon -lid3 -lz -liconv -lnet

#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(PORTLIBS) ../libs/libunself ../libs/libpatchutils ../libs/libsacd ../libs/libcommon ../libs/libid3

#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------

export OUTPUT := $(CURDIR)/$(TARGET)

export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir))

export DEPSDIR := $(CURDIR)/$(BUILD)

export BUILDDIR := $(CURDIR)/$(BUILD)

#---------------------------------------------------------------------------------
# automatically build a list of object files for our project
#---------------------------------------------------------------------------------
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))

#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
export LD := $(CC)
else
export LD := $(CXX)
endif

export OFILES := $(addsuffix .o,$(BINFILES)) \
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
$(sFILES:.s=.o) $(SFILES:.S=.o)

#---------------------------------------------------------------------------------
# build a list of include paths
#---------------------------------------------------------------------------------
export INCLUDE := $(foreach dir,$(INCLUDES), -I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
$(LIBPSL1GHT_INC) \
-I$(CURDIR)/$(BUILD)

#---------------------------------------------------------------------------------
# build a list of library paths
#---------------------------------------------------------------------------------
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
-L../libs/libiconv/lib/.libs/ \
$(LIBPSL1GHT_LIB)

export OUTPUT := $(CURDIR)/$(TARGET)
.PHONY: $(BUILD) clean

#---------------------------------------------------------------------------------
$(BUILD):
@for TARGET in $(TARGETS); do $(MAKE) --no-print-directory -C $$TARGET; done
@[ -d $@ ] || mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

#---------------------------------------------------------------------------------
clean:
@echo clean ...
@for TARGET in $(TARGETS); do $(MAKE) --no-print-directory -C $$TARGET clean; done
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).self

#---------------------------------------------------------------------------------
run:
ps3load $(OUTPUT).self


#---------------------------------------------------------------------------------
else

DEPENDS := $(OFILES:.o=.d)

#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).pkg: $(OUTPUT).self
$(OUTPUT).self: $(OUTPUT).elf
$(OUTPUT).elf: $(OFILES)

#---------------------------------------------------------------------------------
# This rule links in binary data with the .bin extension
#---------------------------------------------------------------------------------
%.bin.o : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)

-include $(DEPENDS)

#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
Binary file added bin/ICON0.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions bin/sfo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" ?>
<sfo>
<value name="APP_VER" type="string">00.30</value>
<value name="ATTRIBUTE" type="integer">
0
</value>
<value name="BOOTABLE" type="integer">
1
</value>
<value name="CATEGORY" type="string">
HG
</value>
<value name="LICENSE" type="string">
This application was created with the official non-official SDK called PSL1GHT, for more information visit http://www.psl1ght.com/ . This is in no way associated with Sony Computer Entertainment Inc., please do not contact them for help, they will not be able to provide it.
</value>
<value name="PARENTAL_LEVEL" type="integer">
0
</value>
<value name="PS3_SYSTEM_VER" type="string">
03.5500
</value>
<value name="RESOLUTION" type="integer">
63
</value>
<value name="SOUND_FORMAT" type="integer">
279
</value>
<value name="TITLE" type="string">
SACD-Ripper
</value>
<value name="TITLE_ID" type="string">
SACDRIP01
</value>
</sfo>
9 changes: 9 additions & 0 deletions configure
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

## Configure the build.
cd libs/libiconv
CFLAGS="-I$PSL1GHT/ppu/include -I$PS3DEV/portlibs/ppu/include" \
LDFLAGS="-L$PSL1GHT/ppu/lib -L$PS3DEV/portlibs/ppu/lib -lrt -llv2" \
PKG_CONFIG_PATH="$PS3DEV/portlibs/ppu/lib/pkgconfig" \
sh configure --host="ppu" --enable-static --disable-shared || { exit 1; }
cd ../..
Binary file added docs/DSDIFF_1.5_file_format_specification.pdf
Binary file not shown.
Binary file added docs/DSDIFF_1.5_recommended_usage.pdf
Binary file not shown.
Binary file added docs/DSF_file_format_specification_E.pdf
Binary file not shown.
Binary file added docs/Sony_DSD_disk_format_specification.pdf
Binary file not shown.
130 changes: 130 additions & 0 deletions readme
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@

DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.

--- Installation ---

Make sure you have a PS3 model with SACD compatible player. For more information
on what model specifically go to: http://ps3sacd.com/faq.html#_Toc180147566

You need to install a custom firmware to be able to rip SACDs. At this time of
writing the PS3 firmware has not been cracked for firmware 3.56 and upwards. So
in order to install the correct firmware you'll have to make sure your firmware
is lower or equal to 3.55. A downgrade for a firmware higher than 3.55 is NOT
available.

The custom firmware that is needed must be 3.55 and should allow patching. Most
custom firmwares like Kmeaw, Rebug, etc.. all facilitate this. Google for
"kmeaw cfw" and you'll find several download links.

Custom Firmware installation steps:

1: Plug a USB stick into your computer
2: Copy the custom firmware file that you downloaded to a USB memory
stick as /PS3/UPDATE/PS3UPDAT.PUP.
3: Plug the USB stick into your PS3
4: Navigate to Settings Tab
5: Choose System Update
6: Choose Update via Storage Media
7: It will say it found Version 3.55
8: Choose OK
9: Accept Conditions and Follow the instructions

If the steps above did not work for you, then you are probably on 3.55 already.
You will have to do a recovery menu mode installation:

1: Plug a USB stick into your computer
2: Copy the custom firmware file that you downloaded to a USB memory
stick as /PS3/UPDATE/PS3UPDAT.PUP.
3: Plug the USB stick into your PS3
4: Power down the PS3 through the menu
5: Now press and HOLD the power button, the system will startup and shutdown
again
6: Release the power button, then press & HOLD power again, you'll hear one
beep
followed by two consecutive beeps
7: Release power then follow the on-screen instructions. You're now in the
recovery menu
8: Connect the USB device and select "System Update."
9: Accept Conditions and Follow the instructions

-- Installation Instructions --

Now you've completed the firmware upgrade you are ready to install
sacd-ripper.pkg.

In order for the PS3 BluRay player to authenticate the SACD disc and to decode
DST to DSD two SPU isoself modules will be extracted from the system. In order
to do so you must give the SACD-Ripper the PS3 keys so it can extract them
automatically.

Get the PS3 keys from https://github.com/Mamdooh/PS3keys and put these in the
root of an USB disc. They will be asked for during first time installation,
after that you can remove the keys from your USB disc.

-- Build Instructions --

To compile you will need the psl1ght suite. If you want to compile on a windows
environment I advice you to follow the CygWin installation as the MingW
installation is unstable.

When psl1ght has been properly setup you need to configure SACD-Ripper with the
following commands:

1. svn checkout http://sacd-ripper.googlecode.com/svn/trunk/ sacd-ripper
2. cd sacd-ripper
3. sh configure
4. make

SACD-Ripper should compile without errors and warnings. Once completed you
should have the sacd-ripper.pkg package that can be installed on your PS3.

To compile the Windows scarletbook tool:
1. Open the Visual Studio Command prompt
2. Change directory to libs\libiconv
3. run: "nmake -f Makefile.msvc NO_NLS=1"
4. now you can compile using the MSVC project file

-- Information --

SACD-Ripper supports the following output formats:

- 2ch DSDIFF (DSD)
- 2ch DSDIFF (DST) (if already DST encoded)
- 2ch DSF (DSD)
- mch DSDIFF (DSD)
- mch DSDIFF (DST)
- mch DSF (DSD)
- ISO (due to the 4GB FAT32 size limit on the PS3, files will be splitted when
larger)

At this time of writing both Saracon and Audiogate do not support DST encoded
files. Audiogate only supports 2ch files and Saracon does not support DSF
files. Please keep that in mind before selecting your file output.

There seems to be a SACD BluRay read speed limit that sets the maximum read
speed to 2.6MB/sec, yes I agree, this is slow! But DST decoding is even
slower.. The PS3 GameOS has 6 SPUs available for user operations. SACD-Ripper
uses 1 SPU for decryption and the other 5!! for DST decoding. Although this
process is quite optimal the current decoding speed has been measured to
be 0.9MB/sec for a 2 channel rip. So for 2ch DST tracks the write speed to disc
will be around 2.3MB/sec, for a multi-channel the write speed is a bit higher
at 2.4MB.sec but decoding is even slower at 0.6MB/sec.

Big thanks goes to to:

Graf Chokolo
Geoffrey Levand :-)
Max
vfalks
Patrick
70 changes: 70 additions & 0 deletions src/exit_handler.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/**
* SACD Ripper - http://code.google.com/p/sacd-ripper/
*
* Copyright (c) 2010-2011 by respective authors.
*
* This program 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 2 of the License, or
* (at your option) any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/

#include <sysutil/sysutil.h>

#include "rsxutil.h"
#include "exit_handler.h"

static int receive_exit_request = 0;

static void sysutil_exit_callback(u64 status, u64 param, void *usrdata)
{
switch (status)
{
case SYSUTIL_EXIT_GAME:
receive_exit_request = 1;
break;
case SYSUTIL_DRAW_BEGIN:
case SYSUTIL_DRAW_END:
break;
default:
break;
}
}

static void program_exit_callback()
{
sysUtilUnregisterCallback(SYSUTIL_EVENT_SLOT0);

gcmSetWaitFlip(context);
rsxFinish(context, 1);
}

int initialize_exit_handlers()
{
int ret;

ret = atexit(program_exit_callback);
if (ret != 0)
return ret;

ret = sysUtilRegisterCallback(SYSUTIL_EVENT_SLOT0, sysutil_exit_callback, NULL);
if (ret != 0)
return ret;

return 0;
}

int user_requested_exit()
{
return receive_exit_request;
}
Loading

0 comments on commit 06ea093

Please sign in to comment.