Want to port openmsx to ps3 running Cfw

By nikodr

Paladin (727)

nikodr's picture

08-07-2016, 02:18

Msxers hello!
After a long time -actually 5 years ago- of having my ps3 updated to firmware 3.55+ and killing hombrew i managed to downgrade it now and i have a console that can run pkg and hombrew.

I have already installed the needed sdk files under windows and can compile and make pkg files for the ps3 system.
I would like to ask if people would be interested for such a port.

my other question has to do with opengl,as i am new to porting apps to ps3,what is the requirement for opengl regarding the source? version 1 or 2 ?

King regards

Login or register to post comments

By Manuel

Ascended (15799)

Manuel's picture

09-07-2016, 09:06

Fyi: openMSX uses opengl 2.

By Vampier

Prophet (2297)

Vampier's picture

10-07-2016, 06:37

hey nikodr welcome back Smile

By nikodr

Paladin (727)

nikodr's picture

11-07-2016, 18:17

Hello vampier!
I hope to find some time the next weeks,to try to compile.
This time it will not be under linux,but as a pkg application to be installed on jailbroken ps3.
The only emulator for ps3 that one can run is from the psp,but it is a little complicated to convert the hombrew app to iso and then repackage it for ps3.
So that's why i want to port openmsx to ps3.Anyway i will post any update Smile

By nikodr

Paladin (727)

nikodr's picture

11-07-2016, 22:43

i used this guide to install sdk of ps3.
http://www.nextgenupdate.com/forums/ps3-mods-cheats/319104-t...

i have all the needed files as g++ gcc and python installed.
however whenever i go to make a make or ./configure it fails.
While i can go to msys and all libraries are ok i get the following error
Probing target system...
Up to date: derived/x86_64-mingw-w64-opt/config/probed_defs.mk
Up to date: derived/x86_64-mingw-w64-opt/config/systemfuncs.hh

No working C++ compiler was found.
Please install a C++ compiler, such as GCC's g++.
If you have a C++ compiler installed and openMSX did not detect it, please set the environment variable CXX to the name of your C++ compiler.
After you have corrected the situation, rerun "configure

but g++ and gcc work ok.
i think that for such ps3 sdk it needs something else.Can someone tell me how to make it see in the correct directories?i

in the sdk file read me it says"

[SCE CONFIDENTIAL DOCUMENT]
PLAYSTATION(R)3 Programmer Tool Runtime Library 192.001
                    Copyright(C) 2006 Sony Computer Entertainment Inc.
                                                   All Rights Reserved.
======================================================================

A

----------------------------------------------------------------------


A commonly styled makefile is described as follows:

  -----------------------------------------
    # (1) Header part
    CELL_MK_DIR ?= $(CELL_SDK)/samples/mk
    include $(CELL_MK_DIR)/sdk.makedef.mk
    
    # (2) Source and target definition part
    
    # (3) Footer part
    include $(CELL_MK_DIR)/sdk.target.mk
  -----------------------------------------

The header part (1) and footer part (3) are basically the same among each makefile, and 
include template files for commonly styled makefiles.

Build operation can be modified by editing the source and target definition part (2).

Note that the above configuration requires the "CELL_SDK" environment variable to be specified 
before executing the build. 
If you already know the SDK to be used, the variable may be added above the header part.

  -----------------------------------------
    CELL_SDK = /usr/local/cell
    CELL_MK_DIR ?= $(CELL_SDK)/samples/mk
    include $(CELL_MK_DIR)/sdk.makedef.mk
    ...
  -----------------------------------------

Targets for build are specified in the source and target definition part (2). 
Basically, one makefile should be prepared for each target.

Single-target case - needed 1 makefile.
Two-target case - needed 2 makefiles for targets and 1 "parent" Makefile.

(example)
  - 1 PPU ELF case
      -> 1 makefile needed (eg. "Makefile")

  - 1 PPU ELF and 1 SPU ELF to build case
      -> 3 makefiles needed (eg. "Makefile", "ppu-elf.mk", "spu-elf.mk")
                                 (parent)      PPU ELF       SPU ELF

"TARGET" and "SRCS" are specified basically in pair in the source and target definition part (2).

----------------------------------------------------------------------


Setup the following variables to specify final build output.

  PPU_TARGET     : PPU ELF target
  PPU_LIB_TARGET : PPU LIB target
  PPU_PRX_TARGET : PPU PRX target
  SPU_TARGET     : SPU ELF target
  SPU_LIB_TARGET : SPU LIB target
  MK_TARGET      : Makefile target

Specifying "PPU_TARGET" or "SPU_TARGET" builds PPU ELF or SPU ELF from corresponding "SRCS", respectively;
and specifying "PPU_LIB_TARGET" or "SPU_LIB_TARGET" builds PPU or SPU archives, respectively;
and specifying "PPU_PRX_TARGET" builds PPU PRX.

Setting makefiles to "MK_TARGET" invokes the makefiles for recursive build.

----------------------------------------------------------------------


Set build sources to "SRCS".
- PPU case: use "PPU_SRCS"
- SPU case: use "SPU_SRCS"
The type of each file in "SRCS" is determined by its extension.

  .c         : C source file
  .cc / .cpp : C++ source file
  .s         : assembler source file
  .bin       : binary file
  .elf       : binary file
  .mk        : Makefile target
  .a         : archive file

[C/C++/Assembler Source File]
C/C++/assembler source files are compiled and their object files are linked.

[Binary File]
A binary file is first converted to a ".o" file with "objcopy" and linked to ELF.
To reference a linked file image from a program, reference the following variables.

  _binary__start    : start address of the file image
  _binary__end      : end   address of the file image
  _binary__size     : byte size of the file image

Specific characters in  will be replaced to comply with the character set for symbols.

  ' ' [space] -> _ [underbar]
  .   [dot]   -> _ [underbar]

===========================================================
eg) Case of "spu.elf" binary file linked

    #ifdef __cplusplus
    extern "C" {
    #endif /* __cplusplus */

    extern char _binary_spu_elf_start[];
    extern char _binary_spu_elf_end[];
    extern unsigned long _binary_spu_elf_size[];

    #ifdef __cplusplus
    }
    #endif /* __cplusplus */
===========================================================

[Makefile Target]
A makefile target works similarly to the "MK_TARGET" case, recursively builds the makefile.

[Archive File]
Archive files are referenced only when building "PPU_LIB_TARGET" or "SPU_LIB_TARGET". 
For example, it is specified to include "libbase.a" when building "libtarget.a" as shown below. 

    PPU_SRCS       = libbase.a ...
    PPU_LIB_TARGET = libtarget.a

This code works to include objects of "libbase.a" into "libtarget.a" when it is built.

----------------------------------------------------------------------


"FPSHADER_SRCS" and "VPSHADER_SRCS" are for source files compiled using cgc (*.cg).
"FPSHADER_SRCS" for FPSHADER,
"VPSHADER_SRCS" for VPSHADER.

Compile profile can be modified using the following variables:
  FPSHADER : FPSHADER_PROFILE (Default: sce_fp_rsx)
  VPSHADER : VPSHADER_PROFILE (Default: sce_vp_rsx)

To add compile options, use the following variables:
  FPSHADER : FPSHADER_FLAGS
  VPSHADER : VPSHADER_FLAGS

----------------------------------------------------------------------


To change warning option settings for C-source compiling, use the following variables:
  PPU : PPU_CWARNFLAGS (Default: CWARNFLAGS_L2)
  SPU : SPU_CWARNFLAGS (Default: CWARNFLAGS_L2)

To change warning option settings for C++-source compiling, use the following variables: 
  SPU : SPU_CXXWARNFLAGS (Default: CXXWARNFLAGS_L2)
  PPU : PPU_CXXWARNFLAGS (Default: CXXWARNFLAGS_L2)

The level of "C**WARNFLAGS" ranges from L1 to L4; 
the greater the level number, the greater the number of warning flags enabled.

As an example of setting an option individually, to handle warning as error, write as follows:
  PPU_CWARNFLAGS += -Werror


----------------------------------------------------------------------


To change optimization setting for compiling source files of C(*.c) and C++(*.cpp/*.cc), 
use the following variables:
  PPU : PPU_OPTIMIZE_LV (Default: -O2)
  SPU : SPU_OPTIMIZE_LV (Default: -O2)


----------------------------------------------------------------------


To add include paths for compiling source files of C(*.c) and C++(*.cpp/*.cc), use the following variables:
  PPU : PPU_INCDIRS
  SPU : SPU_INCDIRS

For example, if you want to add "lib_a/include" and "lib_b/include" directories to the include paths, 
prepend the "-I" string to the directory path like this.

  PPU_INCDIRS = -Ilib_a/include -Ilib_b/include

----------------------------------------------------------------------


To add preprocessor option settings for compiling source files of C(*.c) and C++(*.cpp/*.cc), 
use the following variables:
  PPU : PPU_CPPFLAGS
  SPU : SPU_CPPFLAGS

For example, to set the value of the "CELL" macro to 1 for compiling, write as follows:
  PPU_CPPFLAGS = -DCELL=1

----------------------------------------------------------------------


To change libraries to be linked to ELF when building, use the following variables:
  PPU : PPU_LDLIBDIR, PPU_LDLIBS, PPU_LOADLIBS
  SPU : SPU_LDLIBDIR, SPU_LDLIBS, SPU_LOADLIBS

Libraries to be linked are specified as follows:
"LDLIBS" / "LOADLIBS" : Give *.a filenames or -l options to specify libraries.
"LDLIBDIR"            : Specify lookup paths to be added for use with -l options.

The difference between LDLIBS and LOADLIBS is that LOADLIBS automatically adds some options as follows: 
  PPU_LOADLIBS := -Wl,--start-group $(PPU_LOADLIBS) -Wl,--end-group

We recommend using LOADLIBS basically, because linking libraries involving cyclic symbol referencing 
requires the "start-group/end-group" enclosure.

----------------------------------------------------------------------


You can set up special build process at "EXTRA_TARGET" for additional targets.

For example, to copy two files (foo.elf, bar.elf) to the current directory, write as follows:

"EXTRA_TARGET" for additional target,
"CLEANFILES" for files to be removed with "make clean".
===========================================================
EXTRA_TARGET = foo.elf bar.elf
CLEANFILES   = $(EXTRA_TARGET)
foo.elf: $(CELL_TARGET_PATH)/images/foo.elf
	$(CP) $< $@
bar.elf: $(CELL_TARGET_PATH)/images/bar.elf
	$(CP) $< $@
===========================================================

----------------------------------------------------------------------


To separate debug-build from release-build, and to define a "DEBUG" macro at debug-build,
- prepare a dedicated makefile for each type of build,
- set "OBJS_DIR" to specify separate object-output directory for each makefile, and then
- set "-DDEBUG" to "[P|S]PU_CPPFLAGS" of the debug-build makefile.

The makefiles would then be as follows:
===========================================================
# Makefile.debug

CELL_MK_DIR ?= $(CELL_SDK)/samples/mk
include $(CELL_MK_DIR)/sdk.makedef.mk

OBJS_DIR        = objs/debug
PPU_CPPFLAGS    = -DDEBUG

PPU_SRCS        = ppu_main.c
PPU_TARGET      = main.ppu.debug.elf

include $(CELL_MK_DIR)/sdk.target.mk

===========================================================
# Makefile.release

CELL_MK_DIR ?= $(CELL_SDK)/samples/mk
include $(CELL_MK_DIR)/sdk.makedef.mk

OBJS_DIR        = objs/release

PPU_SRCS        = ppu_main.c
PPU_TARGET      = main.ppu.release.elf

include $(CELL_MK_DIR)/sdk.target.mk

===========================================================

By nikodr

Paladin (727)

nikodr's picture

27-07-2016, 16:11

Ok i think i found something regarding the ps3 dev.
I am using now the psl1ght sdk and ditched sony one.

now i know that openmsx wants these libraries these are installed on my ubuntu dev machine
GLEW: version unknown
libogg: version unknown
libpng: version 1.2.54
libtheora: version unknown
libvorbis: version unknown
OpenGL: version 4.5
SDL: version 1.2.15
SDL_ttf: no
Tcl: version 8.6.5
zlib: version 1.2.8

now regarding the ps3 every application that has to be made has a makefile that has the needed files.
The dev files i have on my ubuntu box they need specific versions for pcc.

i found this for sdl
https://github.com/martell/PS3-PACKAGES/tree/master/ps3-SDL2

the build is like this from the file

# Maintainer: Martell Malone < martell malone at g mail dot com>

_realname=SDL2
pkgname=("${CARCH}-${_realname}")
pkgver=2.0.1
pkgrel=1
pkgdesc="A library for portable low-level access to a video framebuffer, audio output, mouse, and keyboard (Version 2) (ps3)"
arch=('any')
url="http://libsdl.org"
license=("MIT")

options=('staticlibs' '!strip')
source=("http://libsdl.org/release/SDL2-$pkgver.tar.gz"
        "SDL2-2.0.1-PPU.patch")
md5sums=('0eb97039488bf463e775295f7b18b227'
         'SKIP')

prepare() {

  cd ${srcdir}/${_realname}-${pkgver}
  
  patch -p1 -i ${srcdir}/SDL2-2.0.1-PPU.patch

  ./autogen.sh

  export CPPFLAGS=${PPU_CPPFLAGS}
  export CFLAGS=${PPU_CFLAGS}
  export CXXFLAGS=${PPU_CXXFLAGS}
  export LDFLAGS=${PPU_LDFLAGS}
}

build() {
    mkdir -p "${srcdir}/build-${CARCH}"
    cd "${srcdir}/build-${CARCH}"


    CFLAGS="-I${PS3_PREFIX}/${PPU_PREFIX}/include " \
    LDFLAGS="-L${PS3_PREFIX}/${PPU_PREFIX}/lib -lrt -llv2" \
    CHOST=${PPU_PREFIX} \
    "${srcdir}"/SDL2-${pkgver}/configure \
    --host=${PPU_PREFIX} \
    --prefix=${PS3_PREFIX}/${PPU_PREFIX} \
    --enable-static --disable-shared 

    make
}

package() {
    cd "${srcdir}/build-${CARCH}"
    make DESTDIR="$pkgdir" install
}

but it is for version 2 of sdl,i dont know if i can find sdl 1.2 for ps3 patched.It then has this file https://github.com/martell/PS3-PACKAGES/blob/master/ps3-SDL2... that patches for ppc.

So if i find patched devel libraries for all other needed files i could in theory compile it.
My question has to do with sdl.
Is it possible to compile openmsx with sdl2 and not 1.2 ?

By Manuel

Ascended (15799)

Manuel's picture

27-07-2016, 21:42

No, that won't work, sorry. We do have plans to migrate to SDL2 in the future (or to something else).

By nikodr

Paladin (727)

nikodr's picture

28-07-2016, 01:49

Manuel i found a port of sdl 1.3 for ps3 to work with psl1ght sdk.
is 1.3 ok or only 1.2 ?

UPDATE:Found and downloading and compiling sdl 1.2 so i think the big problem is solved now.Now i am trying to check fix other libraries.
Truth is it's not as easy to make ps3 ports for the gameos.Lets hope it goes well Smile
a typical application homebrew for ps3 under psl1ght has this lines

export PATH=$PATH:/usr/bin
export PS3DEV=/opt/ps3dev
export PATH=$PATH:$PS3DEV/bin
export PATH=$PATH:$PS3DEV/ppu/bin
export PATH=$PATH:$PS3DEV/spu/bin
export PSL1GHT=/opt/ps3dev
export PATH=$PATH:$PSL1GHT
export PATH=$PATH:$PS3DEV
#---------------------------------------------------------------------------------
# Clear the implicit built in rules
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(PSL1GHT)),)
$(error "Please set PSL1GHT in your environment. export PSL1GHT=")
endif

include $(PSL1GHT)/ppu_rules

#---------------------------------------------------------------------------------
# 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))
BUILD		:=	build
SOURCES		:=	source
DATA		:=	data
INCLUDES	:=	include

TITLE		:=	Video Test - PSL1GHT
APPID		:=	TEST0VID2
CONTENTID	:=	UP0001-$(APPID)_00-0000000000000000

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

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

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

#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS	:=	-lgcm_sys -lrsx -lsysutil -lio -lcairo -lm -lfreetype -lz -lpixman-1 -lrt -llv2

#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS	:= $(PORTLIBS)

#---------------------------------------------------------------------------------
# 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) \
					$(LIBPSL1GHT_LIB)

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

#---------------------------------------------------------------------------------
$(BUILD):
	@[ -d $@ ] || mkdir -p $@
	@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

#---------------------------------------------------------------------------------
clean:
	@echo clean ...
	@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).self

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


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

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

#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(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
#---------------------------------------------------------------------------------

now i suppose i have to insert that make file to the main.mk somehow to make it able to understand the parameters to create a self file and then link it to a pkg file for ps3.
I think i have all the libraries needed to create it however,the current build.mk under configure sure does not help me.

Any other ways?