mirror of
https://github.com/pspdev/pspsdk.git
synced 2025-12-30 12:18:11 +00:00
first commit
This commit is contained in:
17
src/base/Makefile.am
Normal file
17
src/base/Makefile.am
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
pspsdkincludedir = @PSPSDK_INCLUDEDIR@
|
||||
|
||||
pspsdkinclude_HEADERS = \
|
||||
as_reg_compat.h \
|
||||
psptypes.h \
|
||||
pspstub.s \
|
||||
pspimport.s
|
||||
|
||||
## Install the build.mak fragment to $PSPSDK/lib.
|
||||
buildmakdir = @PSPSDK_LIBDIR@
|
||||
buildmak_DATA = build.mak prxspecs
|
||||
|
||||
buildmakprxdir = @PSPSDK_LIBDIR@
|
||||
buildmakprx_DATA = build_prx.mak linkfile.prx
|
||||
|
||||
EXTRA_DIST = build.mak prxspecs build_prx.mak linkfile.prx
|
||||
52
src/base/as_reg_compat.h
Normal file
52
src/base/as_reg_compat.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* PSP Software Development Kit - http://www.pspdev.org
|
||||
* -----------------------------------------------------------------------
|
||||
* Licensed under the BSD license, see LICENSE in PSPSDK root for details.
|
||||
*
|
||||
* as_reg_compat.h - Register name mapping.
|
||||
*
|
||||
* Copyright (c) 2005 Marcus R. Brown <mrbrown@ocgnet.org>
|
||||
* Copyright (c) 2005 James Forshaw <tyranid@gmail.com>
|
||||
* Copyright (c) 2005 John Kelley <ps2dev@kelley.ca>
|
||||
*
|
||||
* $Id: as_reg_compat.h 540 2005-07-08 19:35:10Z warren $
|
||||
*/
|
||||
#ifndef __AS_REG_COMPAT_H__
|
||||
#define __AS_REG_COMPAT_H__
|
||||
|
||||
/* register defines for the GNU assembler */
|
||||
|
||||
#define zero 0
|
||||
#define at 1
|
||||
#define v0 2
|
||||
#define v1 3
|
||||
#define a0 4
|
||||
#define a1 5
|
||||
#define a2 6
|
||||
#define a3 7
|
||||
#define t0 8
|
||||
#define t1 9
|
||||
#define t2 10
|
||||
#define t3 11
|
||||
#define t4 12
|
||||
#define t5 13
|
||||
#define t6 14
|
||||
#define t7 15
|
||||
#define s0 16
|
||||
#define s1 17
|
||||
#define s2 18
|
||||
#define s3 19
|
||||
#define s4 20
|
||||
#define s5 21
|
||||
#define s6 22
|
||||
#define s7 23
|
||||
#define t8 24
|
||||
#define t9 25
|
||||
#define k0 26
|
||||
#define k1 27
|
||||
#define gp 28
|
||||
#define sp 29
|
||||
#define fp 30
|
||||
#define ra 31
|
||||
|
||||
#endif
|
||||
204
src/base/build.mak
Normal file
204
src/base/build.mak
Normal file
@@ -0,0 +1,204 @@
|
||||
# PSP Software Development Kit - http://www.pspdev.org
|
||||
# -----------------------------------------------------------------------
|
||||
# Licensed under the BSD license, see LICENSE in PSPSDK root for details.
|
||||
#
|
||||
# build.mak - Base makefile for projects using PSPSDK.
|
||||
#
|
||||
# Copyright (c) 2005 Marcus R. Brown <mrbrown@ocgnet.org>
|
||||
# Copyright (c) 2005 James Forshaw <tyranid@gmail.com>
|
||||
# Copyright (c) 2005 John Kelley <ps2dev@kelley.ca>
|
||||
#
|
||||
# $Id: build.mak 2333 2007-10-31 19:37:40Z tyranid $
|
||||
|
||||
# Note: The PSPSDK make variable must be defined before this file is included.
|
||||
ifeq ($(PSPSDK),)
|
||||
$(error $$(PSPSDK) is undefined. Use "PSPSDK := $$(shell psp-config --pspsdk-path)" in your Makefile)
|
||||
endif
|
||||
|
||||
CC = psp-gcc
|
||||
CXX = psp-g++
|
||||
AS = psp-gcc
|
||||
LD = psp-gcc
|
||||
AR = psp-ar
|
||||
RANLIB = psp-ranlib
|
||||
STRIP = psp-strip
|
||||
MKSFO = mksfo
|
||||
PACK_PBP = pack-pbp
|
||||
FIXUP = psp-fixup-imports
|
||||
|
||||
# Add in PSPSDK includes and libraries.
|
||||
INCDIR := $(INCDIR) . $(PSPSDK)/include
|
||||
LIBDIR := $(LIBDIR) . $(PSPSDK)/lib
|
||||
|
||||
CFLAGS := $(addprefix -I,$(INCDIR)) $(CFLAGS)
|
||||
CXXFLAGS := $(CFLAGS) $(CXXFLAGS)
|
||||
ASFLAGS := $(CFLAGS) $(ASFLAGS)
|
||||
|
||||
ifeq ($(PSP_LARGE_MEMORY),1)
|
||||
MKSFO = mksfoex -d MEMSIZE=1
|
||||
endif
|
||||
|
||||
ifeq ($(PSP_FW_VERSION),)
|
||||
PSP_FW_VERSION=150
|
||||
endif
|
||||
|
||||
CFLAGS += -D_PSP_FW_VERSION=$(PSP_FW_VERSION)
|
||||
CXXFLAGS += -D_PSP_FW_VERSION=$(PSP_FW_VERSION)
|
||||
|
||||
ifeq ($(BUILD_PRX),1)
|
||||
LDFLAGS := $(addprefix -L,$(LIBDIR)) -specs=$(PSPSDK)/lib/prxspecs -Wl,-q,-T$(PSPSDK)/lib/linkfile.prx $(LDFLAGS)
|
||||
EXTRA_CLEAN += $(TARGET).elf
|
||||
# Setup default exports if needed
|
||||
ifdef PRX_EXPORTS
|
||||
EXPORT_OBJ=$(patsubst %.exp,%.o,$(PRX_EXPORTS))
|
||||
EXTRA_CLEAN += $(EXPORT_OBJ)
|
||||
else
|
||||
EXPORT_OBJ=$(PSPSDK)/lib/prxexports.o
|
||||
endif
|
||||
else
|
||||
LDFLAGS := $(addprefix -L,$(LIBDIR)) $(LDFLAGS)
|
||||
endif
|
||||
|
||||
# Library selection. By default we link with Newlib's libc. Allow the
|
||||
# user to link with PSPSDK's libc if USE_PSPSDK_LIBC is set to 1.
|
||||
|
||||
ifeq ($(USE_KERNEL_LIBC),1)
|
||||
# Use the PSP's kernel libc
|
||||
PSPSDK_LIBC_LIB =
|
||||
CFLAGS := -I$(PSPSDK)/include/libc $(CFLAGS)
|
||||
else
|
||||
ifeq ($(USE_PSPSDK_LIBC),1)
|
||||
# Use the pspsdk libc
|
||||
PSPSDK_LIBC_LIB = -lpsplibc
|
||||
CFLAGS := -I$(PSPSDK)/include/libc $(CFLAGS)
|
||||
else
|
||||
# Use newlib (urgh)
|
||||
PSPSDK_LIBC_LIB = -lc
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
# Link with following default libraries. Other libraries should be specified in the $(LIBS) variable.
|
||||
# TODO: This library list needs to be generated at configure time.
|
||||
#
|
||||
ifeq ($(USE_KERNEL_LIBS),1)
|
||||
PSPSDK_LIBS = -lpspdebug -lpspdisplay_driver -lpspctrl_driver -lpspsdk
|
||||
LIBS := $(LIBS) $(PSPSDK_LIBS) $(PSPSDK_LIBC_LIB) -lpspkernel
|
||||
else
|
||||
ifeq ($(USE_USER_LIBS),1)
|
||||
PSPSDK_LIBS = -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk
|
||||
LIBS := $(LIBS) $(PSPSDK_LIBS) $(PSPSDK_LIBC_LIB) -lpspnet \
|
||||
-lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility \
|
||||
-lpspuser
|
||||
else
|
||||
PSPSDK_LIBS = -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk
|
||||
LIBS := $(LIBS) $(PSPSDK_LIBS) $(PSPSDK_LIBC_LIB) -lpspnet \
|
||||
-lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility \
|
||||
-lpspuser -lpspkernel
|
||||
endif
|
||||
endif
|
||||
|
||||
# Define the overridable parameters for EBOOT.PBP
|
||||
ifndef PSP_EBOOT_TITLE
|
||||
PSP_EBOOT_TITLE = $(TARGET)
|
||||
endif
|
||||
|
||||
ifndef PSP_EBOOT_SFO
|
||||
PSP_EBOOT_SFO = PARAM.SFO
|
||||
endif
|
||||
|
||||
ifndef PSP_EBOOT_ICON
|
||||
PSP_EBOOT_ICON = NULL
|
||||
endif
|
||||
|
||||
ifndef PSP_EBOOT_ICON1
|
||||
PSP_EBOOT_ICON1 = NULL
|
||||
endif
|
||||
|
||||
ifndef PSP_EBOOT_UNKPNG
|
||||
PSP_EBOOT_UNKPNG = NULL
|
||||
endif
|
||||
|
||||
ifndef PSP_EBOOT_PIC1
|
||||
PSP_EBOOT_PIC1 = NULL
|
||||
endif
|
||||
|
||||
ifndef PSP_EBOOT_SND0
|
||||
PSP_EBOOT_SND0 = NULL
|
||||
endif
|
||||
|
||||
ifndef PSP_EBOOT_PSAR
|
||||
PSP_EBOOT_PSAR = NULL
|
||||
endif
|
||||
|
||||
ifndef PSP_EBOOT
|
||||
PSP_EBOOT = EBOOT.PBP
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_PRX),1)
|
||||
ifneq ($(TARGET_LIB),)
|
||||
$(error TARGET_LIB should not be defined when building a prx)
|
||||
else
|
||||
FINAL_TARGET = $(TARGET).prx
|
||||
endif
|
||||
else
|
||||
ifneq ($(TARGET_LIB),)
|
||||
FINAL_TARGET = $(TARGET_LIB)
|
||||
else
|
||||
FINAL_TARGET = $(TARGET).elf
|
||||
endif
|
||||
endif
|
||||
|
||||
all: $(EXTRA_TARGETS) $(FINAL_TARGET)
|
||||
|
||||
kxploit: $(TARGET).elf $(PSP_EBOOT_SFO)
|
||||
mkdir -p "$(TARGET)"
|
||||
$(STRIP) $(TARGET).elf -o $(TARGET)/$(PSP_EBOOT)
|
||||
mkdir -p "$(TARGET)%"
|
||||
$(PACK_PBP) "$(TARGET)%/$(PSP_EBOOT)" $(PSP_EBOOT_SFO) $(PSP_EBOOT_ICON) \
|
||||
$(PSP_EBOOT_ICON1) $(PSP_EBOOT_UNKPNG) $(PSP_EBOOT_PIC1) \
|
||||
$(PSP_EBOOT_SND0) NULL $(PSP_EBOOT_PSAR)
|
||||
|
||||
SCEkxploit: $(TARGET).elf $(PSP_EBOOT_SFO)
|
||||
mkdir -p "__SCE__$(TARGET)"
|
||||
$(STRIP) $(TARGET).elf -o __SCE__$(TARGET)/$(PSP_EBOOT)
|
||||
mkdir -p "%__SCE__$(TARGET)"
|
||||
$(PACK_PBP) "%__SCE__$(TARGET)/$(PSP_EBOOT)" $(PSP_EBOOT_SFO) $(PSP_EBOOT_ICON) \
|
||||
$(PSP_EBOOT_ICON1) $(PSP_EBOOT_UNKPNG) $(PSP_EBOOT_PIC1) \
|
||||
$(PSP_EBOOT_SND0) NULL $(PSP_EBOOT_PSAR)
|
||||
|
||||
$(TARGET).elf: $(OBJS) $(EXPORT_OBJ)
|
||||
$(LINK.c) $^ $(LIBS) -o $@
|
||||
$(FIXUP) $@
|
||||
|
||||
$(TARGET_LIB): $(OBJS)
|
||||
$(AR) cru $@ $(OBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
$(PSP_EBOOT_SFO):
|
||||
$(MKSFO) '$(PSP_EBOOT_TITLE)' $@
|
||||
|
||||
ifeq ($(BUILD_PRX),1)
|
||||
$(PSP_EBOOT): $(TARGET).prx $(PSP_EBOOT_SFO)
|
||||
$(PACK_PBP) $(PSP_EBOOT) $(PSP_EBOOT_SFO) $(PSP_EBOOT_ICON) \
|
||||
$(PSP_EBOOT_ICON1) $(PSP_EBOOT_UNKPNG) $(PSP_EBOOT_PIC1) \
|
||||
$(PSP_EBOOT_SND0) $(TARGET).prx $(PSP_EBOOT_PSAR)
|
||||
else
|
||||
$(PSP_EBOOT): $(TARGET).elf $(PSP_EBOOT_SFO)
|
||||
$(STRIP) $(TARGET).elf -o $(TARGET)_strip.elf
|
||||
$(PACK_PBP) $(PSP_EBOOT) $(PSP_EBOOT_SFO) $(PSP_EBOOT_ICON) \
|
||||
$(PSP_EBOOT_ICON1) $(PSP_EBOOT_UNKPNG) $(PSP_EBOOT_PIC1) \
|
||||
$(PSP_EBOOT_SND0) $(TARGET)_strip.elf $(PSP_EBOOT_PSAR)
|
||||
-rm -f $(TARGET)_strip.elf
|
||||
endif
|
||||
|
||||
%.prx: %.elf
|
||||
psp-prxgen $< $@
|
||||
|
||||
%.c: %.exp
|
||||
psp-build-exports -b $< > $@
|
||||
|
||||
clean:
|
||||
-rm -f $(FINAL_TARGET) $(EXTRA_CLEAN) $(OBJS) $(PSP_EBOOT_SFO) $(PSP_EBOOT) $(EXTRA_TARGETS)
|
||||
|
||||
rebuild: clean all
|
||||
86
src/base/build_prx.mak
Normal file
86
src/base/build_prx.mak
Normal file
@@ -0,0 +1,86 @@
|
||||
# PSP Software Development Kit - http://www.pspdev.org
|
||||
# -----------------------------------------------------------------------
|
||||
# Licensed under the BSD license, see LICENSE in PSPSDK root for details.
|
||||
#
|
||||
# build.mak - Base makefile for projects using PSPSDK.
|
||||
#
|
||||
# Copyright (c) 2005 Marcus R. Brown <mrbrown@ocgnet.org>
|
||||
# Copyright (c) 2005 James Forshaw <tyranid@gmail.com>
|
||||
# Copyright (c) 2005 John Kelley <ps2dev@kelley.ca>
|
||||
#
|
||||
# $Id: build.mak 771 2005-07-24 10:43:54Z tyranid $
|
||||
|
||||
# Note: The PSPSDK make variable must be defined before this file is included.
|
||||
ifeq ($(PSPSDK),)
|
||||
$(error $$(PSPSDK) is undefined. Use "PSPSDK := $$(shell psp-config --pspsdk-path)" in your Makefile)
|
||||
endif
|
||||
|
||||
CC = psp-gcc
|
||||
CXX = psp-g++
|
||||
AS = psp-gcc
|
||||
LD = psp-gcc
|
||||
FIXUP = psp-fixup-imports
|
||||
|
||||
# Add in PSPSDK includes and libraries.
|
||||
INCDIR := $(INCDIR) . $(PSPSDK)/include
|
||||
LIBDIR := $(LIBDIR) . $(PSPSDK)/lib
|
||||
|
||||
CFLAGS := $(addprefix -I,$(INCDIR)) $(CFLAGS)
|
||||
CXXFLAGS := $(CFLAGS) $(CXXFLAGS)
|
||||
ASFLAGS := $(CFLAGS) $(ASFLAGS)
|
||||
|
||||
LDFLAGS := $(addprefix -L,$(LIBDIR)) -Wl,-q,-T$(PSPSDK)/lib/linkfile.prx -mno-crt0 -nostartfiles $(LDFLAGS)
|
||||
|
||||
ifeq ($(PSP_FW_VERSION),)
|
||||
PSP_FW_VERSION=150
|
||||
endif
|
||||
|
||||
CFLAGS += -D_PSP_FW_VERSION=$(PSP_FW_VERSION)
|
||||
|
||||
# Library selection. By default we link with Newlib's libc. Allow the
|
||||
# user to link with PSPSDK's libc if USE_PSPSDK_LIBC is set to 1.
|
||||
|
||||
ifeq ($(USE_KERNEL_LIBC),1)
|
||||
# Use the PSP's kernel libc
|
||||
PSPSDK_LIBC_LIB =
|
||||
CFLAGS := -I$(PSPSDK)/include/libc $(CFLAGS)
|
||||
else
|
||||
ifeq ($(USE_PSPSDK_LIBC),1)
|
||||
# Use the pspsdk libc
|
||||
PSPSDK_LIBC_LIB = -lpsplibc
|
||||
CFLAGS := -I$(PSPSDK)/include/libc $(CFLAGS)
|
||||
else
|
||||
# Use newlib (urgh)
|
||||
PSPSDK_LIBC_LIB = -lc
|
||||
endif
|
||||
endif
|
||||
|
||||
# Link with following default libraries. Other libraries should be specified in the $(LIBS) variable.
|
||||
# TODO: This library list needs to be generated at configure time.
|
||||
|
||||
ifeq ($(USE_KERNEL_LIBS),1)
|
||||
PSPSDK_LIBS = -lpspdebug -lpspdisplay_driver -lpspctrl_driver -lpspsdk
|
||||
LIBS := $(LIBS) $(PSPSDK_LIBS) $(PSPSDK_LIBC_LIB) -lpspkernel
|
||||
else
|
||||
PSPSDK_LIBS = -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk
|
||||
LIBS := $(LIBS) $(PSPSDK_LIBS) $(PSPSDK_LIBC_LIB) -lpsputility -lpspuser -lpspkernel
|
||||
endif
|
||||
|
||||
FINAL_TARGET = $(TARGET).prx
|
||||
|
||||
all: $(FINAL_TARGET)
|
||||
|
||||
$(TARGET).elf: $(OBJS)
|
||||
$(LINK.c) $^ $(LIBS) -o $@
|
||||
$(FIXUP) $@
|
||||
|
||||
%.prx: %.elf
|
||||
psp-prxgen $< $@
|
||||
|
||||
%.c: %.exp
|
||||
psp-build-exports -b $< > $@
|
||||
|
||||
clean: $(EXTRA_CLEAN)
|
||||
-rm -f $(FINAL_TARGET) $(TARGET).elf $(OBJS)
|
||||
|
||||
rebuild: clean all
|
||||
246
src/base/linkfile.prx.in
Normal file
246
src/base/linkfile.prx.in
Normal file
@@ -0,0 +1,246 @@
|
||||
/* Default linker script, for normal executables */
|
||||
OUTPUT_FORMAT("elf32-littlemips", "elf32-bigmips",
|
||||
"elf32-littlemips")
|
||||
OUTPUT_ARCH(mips:allegrex)
|
||||
ENTRY(module_start)
|
||||
SEARCH_DIR("@PSPDEV_LIBDIR@");
|
||||
/* Do we need any of these for elf?
|
||||
__DYNAMIC = 0; */
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
PROVIDE (__executable_start = 0x0); . = 0x0;
|
||||
.interp : { *(.interp) }
|
||||
.dynamic : { *(.dynamic) }
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.gnu.version : { *(.gnu.version) }
|
||||
.gnu.version_d : { *(.gnu.version_d) }
|
||||
.gnu.version_r : { *(.gnu.version_r) }
|
||||
.rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
|
||||
.rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
|
||||
.rel.init : { *(.rel.init) }
|
||||
.rela.init : { *(.rela.init) }
|
||||
.rel.fini : { *(.rel.fini) }
|
||||
.rela.fini : { *(.rela.fini) }
|
||||
/* PSP-specific relocations. */
|
||||
.rel.sceStub.text : { *(.rel.sceStub.text) *(SORT(.rel.sceStub.text.*)) }
|
||||
.rel.lib.ent.top : { *(.rel.lib.ent.top) }
|
||||
.rel.lib.ent : { *(.rel.lib.ent) }
|
||||
.rel.lib.ent.btm : { *(.rel.lib.ent.btm) }
|
||||
.rel.lib.stub.top : { *(.rel.lib.stub.top) }
|
||||
.rel.lib.stub : { *(.rel.lib.stub) }
|
||||
.rel.lib.stub.btm : { *(.rel.lib.stub.btm) }
|
||||
.rel.rodata.sceModuleInfo : { *(.rel.rodata.sceModuleInfo) }
|
||||
.rel.rodata.sceResident : { *(.rel.rodata.sceResident) }
|
||||
.rel.rodata.sceNid : { *(.rel.rodata.sceNid) }
|
||||
.rel.rodata.sceVstub : { *(.rel.rodata.sceVstub) *(SORT(.rel.rodata.sceVstub.*)) }
|
||||
.rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
|
||||
.rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
|
||||
.rel.data.rel.ro : { *(.rel.data.rel.ro*) }
|
||||
.rela.data.rel.ro : { *(.rel.data.rel.ro*) }
|
||||
.rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
|
||||
.rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
|
||||
.rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
|
||||
.rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
|
||||
.rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
|
||||
.rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.sdata : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) }
|
||||
.rela.sdata : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) }
|
||||
.rel.sbss : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) }
|
||||
.rela.sbss : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) }
|
||||
.rel.sdata2 : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) }
|
||||
.rela.sdata2 : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) }
|
||||
.rel.sbss2 : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) }
|
||||
.rela.sbss2 : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) }
|
||||
.rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
|
||||
.rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
.text :
|
||||
{
|
||||
_ftext = . ;
|
||||
*(.text .stub .text.* .gnu.linkonce.t.*)
|
||||
KEEP (*(.text.*personality*))
|
||||
/* .gnu.warning sections are handled specially by elf32.em. */
|
||||
*(.gnu.warning)
|
||||
*(.mips16.fn.*) *(.mips16.call.*)
|
||||
} =0
|
||||
.init :
|
||||
{
|
||||
KEEP (*(.init))
|
||||
} =0
|
||||
.plt : { *(.plt) }
|
||||
.fini :
|
||||
{
|
||||
KEEP (*(.fini))
|
||||
} =0
|
||||
/* PSP library stub functions. */
|
||||
.sceStub.text : { *(.sceStub.text) *(SORT(.sceStub.text.*)) }
|
||||
PROVIDE (__etext = .);
|
||||
PROVIDE (_etext = .);
|
||||
PROVIDE (etext = .);
|
||||
/* PSP library entry table and library stub table. */
|
||||
.lib.ent.top : { *(.lib.ent.top) }
|
||||
.lib.ent : { *(.lib.ent) }
|
||||
.lib.ent.btm : { *(.lib.ent.btm) }
|
||||
.lib.stub.top : { *(.lib.stub.top) }
|
||||
.lib.stub : { *(.lib.stub) }
|
||||
.lib.stub.btm : { *(.lib.stub.btm) }
|
||||
/* PSP read-only data for module info, NIDs, and Vstubs. The
|
||||
.rodata.sceModuleInfo section must appear before the .rodata section
|
||||
otherwise it would get absorbed into .rodata and the PSP bootloader
|
||||
would be unable to locate the module info structure. */
|
||||
.rodata.sceModuleInfo : { *(.rodata.sceModuleInfo) }
|
||||
.rodata.sceResident : { *(.rodata.sceResident) }
|
||||
.rodata.sceNid : { KEEP (*(.rodata.sceNid)) }
|
||||
.rodata.sceVstub : { *(.rodata.sceVstub) *(SORT(.rodata.sceVstub.*)) }
|
||||
.rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
|
||||
.rodata1 : { *(.rodata1) }
|
||||
.sdata2 : { *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) }
|
||||
.sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
|
||||
.eh_frame_hdr : { *(.eh_frame_hdr) }
|
||||
.eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
|
||||
.gcc_except_table : ONLY_IF_RO { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) }
|
||||
/* Adjust the address for the data segment. We want to adjust up to
|
||||
the same address within the page on the next page up. */
|
||||
. = ALIGN(256) + (. & (256 - 1));
|
||||
/* Exception handling */
|
||||
.eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
|
||||
.gcc_except_table : ONLY_IF_RW { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) }
|
||||
/* Thread Local Storage sections */
|
||||
.tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
|
||||
.tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
|
||||
/* Ensure the __preinit_array_start label is properly aligned. We
|
||||
could instead move the label definition inside the section, but
|
||||
the linker would then create the section even if it turns out to
|
||||
be empty, which isn't pretty. */
|
||||
. = ALIGN(32 / 8);
|
||||
PROVIDE (__preinit_array_start = .);
|
||||
.preinit_array : { KEEP (*(.preinit_array)) }
|
||||
PROVIDE (__preinit_array_end = .);
|
||||
PROVIDE (__init_array_start = .);
|
||||
.init_array : { KEEP (*(.init_array)) }
|
||||
PROVIDE (__init_array_end = .);
|
||||
PROVIDE (__fini_array_start = .);
|
||||
.fini_array : { KEEP (*(.fini_array)) }
|
||||
PROVIDE (__fini_array_end = .);
|
||||
.ctors :
|
||||
{
|
||||
/* gcc uses crtbegin.o to find the start of
|
||||
the constructors, so we make sure it is
|
||||
first. Because this is a wildcard, it
|
||||
doesn't matter if the user does not
|
||||
actually link against crtbegin.o; the
|
||||
linker won't look for a file to match a
|
||||
wildcard. The wildcard also means that it
|
||||
doesn't matter which directory crtbegin.o
|
||||
is in. */
|
||||
KEEP (*crtbegin*.o(.ctors))
|
||||
/* We don't want to include the .ctor section from
|
||||
from the crtend.o file until after the sorted ctors.
|
||||
The .ctor section from the crtend file contains the
|
||||
end of ctors marker and it must be last */
|
||||
KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*(.ctors))
|
||||
}
|
||||
.dtors :
|
||||
{
|
||||
KEEP (*crtbegin*.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
}
|
||||
.jcr : { KEEP (*(.jcr)) }
|
||||
.data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro*) }
|
||||
.data :
|
||||
{
|
||||
_fdata = . ;
|
||||
*(.data .data.* .gnu.linkonce.d.*)
|
||||
KEEP (*(.gnu.linkonce.d.*personality*))
|
||||
SORT(CONSTRUCTORS)
|
||||
}
|
||||
.data1 : { *(.data1) }
|
||||
. = .;
|
||||
_gp = ALIGN(16) + 0x7ff0;
|
||||
.got : { *(.got.plt) *(.got) }
|
||||
/* We want the small data sections together, so single-instruction offsets
|
||||
can access them all, and initialized data all before uninitialized, so
|
||||
we can shorten the on-disk segment size. */
|
||||
.sdata :
|
||||
{
|
||||
*(.sdata .sdata.* .gnu.linkonce.s.*)
|
||||
}
|
||||
.lit8 : { *(.lit8) }
|
||||
.lit4 : { *(.lit4) }
|
||||
_edata = .;
|
||||
PROVIDE (edata = .);
|
||||
__bss_start = .;
|
||||
_fbss = .;
|
||||
.sbss :
|
||||
{
|
||||
PROVIDE (__sbss_start = .);
|
||||
PROVIDE (___sbss_start = .);
|
||||
*(.dynsbss)
|
||||
*(.sbss .sbss.* .gnu.linkonce.sb.*)
|
||||
*(.scommon)
|
||||
PROVIDE (__sbss_end = .);
|
||||
PROVIDE (___sbss_end = .);
|
||||
}
|
||||
.bss :
|
||||
{
|
||||
*(.dynbss)
|
||||
*(.bss .bss.* .gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
/* Align here to ensure that the .bss section occupies space up to
|
||||
_end. Align after .bss to ensure correct alignment even if the
|
||||
.bss section disappears because there are no input sections. */
|
||||
. = ALIGN(32 / 8);
|
||||
}
|
||||
. = ALIGN(32 / 8);
|
||||
_end = .;
|
||||
PROVIDE (end = .);
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
/* DWARF debug sections.
|
||||
Symbols in the DWARF debugging sections are relative to the beginning
|
||||
of the section so we begin them at 0. */
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
/DISCARD/ : { *(.comment) *(.pdr) }
|
||||
/DISCARD/ : { *(.note.GNU-stack) }
|
||||
}
|
||||
2
src/base/prxspecs
Normal file
2
src/base/prxspecs
Normal file
@@ -0,0 +1,2 @@
|
||||
*startfile:
|
||||
crt0_prx%O%s crti%O%s crtbegin%O%s
|
||||
68
src/base/pspimport.s
Normal file
68
src/base/pspimport.s
Normal file
@@ -0,0 +1,68 @@
|
||||
|
||||
.macro IMPORT_START module, flags_ver
|
||||
|
||||
.set push
|
||||
.section .rodata.sceResident, "a"
|
||||
.word 0
|
||||
__stub_modulestr_\module:
|
||||
.asciz "\module"
|
||||
.align 2
|
||||
|
||||
.section .lib.stub, "a", @progbits
|
||||
.global __stub_module_\module
|
||||
__stub_module_\module:
|
||||
.word __stub_modulestr_\module
|
||||
.word \flags_ver
|
||||
.word 0x5
|
||||
.word __executable_start
|
||||
.word __executable_start
|
||||
|
||||
.set pop
|
||||
.endm
|
||||
|
||||
.macro IMPORT_FUNC module, funcid, funcname
|
||||
|
||||
.set push
|
||||
.set noreorder
|
||||
|
||||
.extern __stub_module_\module
|
||||
.section .sceStub.text, "ax", @progbits
|
||||
.globl \funcname
|
||||
.type \funcname, @function
|
||||
.ent \funcname, 0
|
||||
\funcname:
|
||||
.word __stub_module_\module
|
||||
.word \funcid
|
||||
.end \funcname
|
||||
.size \funcname, .-\funcname
|
||||
|
||||
.section .rodata.sceNid, "a"
|
||||
.word \funcid
|
||||
|
||||
.set pop
|
||||
.endm
|
||||
|
||||
.macro IMPORT_FUNC_WITH_ALIAS module, funcid, funcname, alias
|
||||
|
||||
.set push
|
||||
.set noreorder
|
||||
|
||||
.extern __stub_module_\module
|
||||
.section .sceStub.text, "ax", @progbits
|
||||
.globl \alias
|
||||
.type \alias, @function
|
||||
\alias:
|
||||
.globl \funcname
|
||||
.type \funcname, @function
|
||||
.ent \funcname, 0
|
||||
\funcname:
|
||||
.word __stub_module_\module
|
||||
.word \funcid
|
||||
.end \funcname
|
||||
.size \funcname, .-\funcname
|
||||
|
||||
.section .rodata.sceNid, "a"
|
||||
.word \funcid
|
||||
|
||||
.set pop
|
||||
.endm
|
||||
83
src/base/pspstub.s
Normal file
83
src/base/pspstub.s
Normal file
@@ -0,0 +1,83 @@
|
||||
# common.s - GAS macros for creating import libraries.
|
||||
#
|
||||
# Use STUB_START to declare the start of an import library. The module parameter
|
||||
# is the name of the library to import, flags_ver is both the import flags and library
|
||||
# version, and stub_len is both the number of stubs to import and the size of the
|
||||
# stub itself (in 32-bit words).
|
||||
# Use the STUB_FUNC macro for each stub you want to import. The funcid parameter is
|
||||
# the 32-bit SHA1-derived NID value, and the funcname is the name you want to call
|
||||
# the imported function.
|
||||
# Use STUB_END to declare the end of your import library.
|
||||
|
||||
.macro STUB_START module, flags_ver, stub_len
|
||||
|
||||
.set push
|
||||
.section .rodata.sceResident, "a"
|
||||
.word 0
|
||||
__stub_modulestr_\module:
|
||||
.asciz "\module"
|
||||
.align 2
|
||||
|
||||
.section .lib.stub, "a", @progbits
|
||||
.word __stub_modulestr_\module
|
||||
.word \flags_ver
|
||||
.word \stub_len
|
||||
.word __stub_idtable_\module
|
||||
.word __stub_text_\module
|
||||
|
||||
.section .rodata.sceNid, "a"
|
||||
__stub_idtable_\module:
|
||||
|
||||
.section .sceStub.text, "ax", @progbits
|
||||
__stub_text_\module:
|
||||
|
||||
.set pop
|
||||
.endm
|
||||
|
||||
.macro STUB_FUNC funcid, funcname
|
||||
|
||||
.set push
|
||||
.set noreorder
|
||||
|
||||
.section .sceStub.text, "ax", @progbits
|
||||
.globl \funcname
|
||||
.type \funcname, @function
|
||||
.ent \funcname, 0
|
||||
\funcname:
|
||||
jr $ra
|
||||
nop
|
||||
.end \funcname
|
||||
.size \funcname, .-\funcname
|
||||
|
||||
.section .rodata.sceNid
|
||||
.word \funcid
|
||||
|
||||
.set pop
|
||||
.endm
|
||||
|
||||
.macro STUB_FUNC_WITH_ALIAS funcid, funcname, alias
|
||||
|
||||
.set push
|
||||
.set noreorder
|
||||
|
||||
.section .sceStub.text, "ax", @progbits
|
||||
.globl \alias
|
||||
.type \alias, @function
|
||||
\alias:
|
||||
.globl \funcname
|
||||
.type \funcname, @function
|
||||
.ent \funcname, 0
|
||||
\funcname:
|
||||
jr $ra
|
||||
nop
|
||||
.end \funcname
|
||||
.size \funcname, .-\funcname
|
||||
|
||||
.section .rodata.sceNid
|
||||
.word \funcid
|
||||
|
||||
.set pop
|
||||
.endm
|
||||
|
||||
.macro STUB_END
|
||||
.endm
|
||||
434
src/base/psptypes.h
Normal file
434
src/base/psptypes.h
Normal file
@@ -0,0 +1,434 @@
|
||||
/*
|
||||
* PSP Software Development Kit - http://www.pspdev.org
|
||||
* -----------------------------------------------------------------------
|
||||
* Licensed under the BSD license, see LICENSE in PSPSDK root for details.
|
||||
*
|
||||
* psptypes.h - Commonly used typedefs.
|
||||
*
|
||||
* Copyright (c) 2005 Marcus R. Brown <mrbrown@ocgnet.org>
|
||||
* Copyright (c) 2005 James Forshaw <tyranid@gmail.com>
|
||||
* Copyright (c) 2005 John Kelley <ps2dev@kelley.ca>
|
||||
*
|
||||
* $Id: psptypes.h 2312 2007-09-09 15:02:23Z chip $
|
||||
*/
|
||||
|
||||
/* Note: Some of the structures, types, and definitions in this file were
|
||||
extrapolated from symbolic debugging information found in the Japanese
|
||||
version of Puzzle Bobble. */
|
||||
|
||||
#ifndef _PSPTYPES_H_
|
||||
#define _PSPTYPES_H_ 1
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#ifdef __cplusplus
|
||||
#define NULL 0
|
||||
#else
|
||||
#define NULL ((void *) 0)
|
||||
#endif /* __cplusplus */
|
||||
#endif
|
||||
|
||||
/* Legacy ps2dev types. */
|
||||
#ifndef PSP_LEGACY_TYPES_DEFINED
|
||||
#define PSP_LEGACY_TYPES_DEFINED
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
|
||||
typedef uint32_t u32;
|
||||
typedef uint64_t u64;
|
||||
|
||||
typedef int8_t s8;
|
||||
typedef int16_t s16;
|
||||
|
||||
typedef int32_t s32;
|
||||
typedef int64_t s64;
|
||||
#endif
|
||||
|
||||
#ifndef PSP_LEGACY_VOLATILE_TYPES_DEFINED
|
||||
#define PSP_LEGACY_VOLATILE_TYPES_DEFINED
|
||||
typedef volatile uint8_t vu8;
|
||||
typedef volatile uint16_t vu16;
|
||||
|
||||
typedef volatile uint32_t vu32;
|
||||
typedef volatile uint64_t vu64;
|
||||
|
||||
typedef volatile int8_t vs8;
|
||||
typedef volatile int16_t vs16;
|
||||
|
||||
typedef volatile int32_t vs32;
|
||||
typedef volatile int64_t vs64;
|
||||
#endif
|
||||
|
||||
/* MIPS-like accessor macros. */
|
||||
static __inline__ u8 _lb(u32 addr) { return *(vu8 *)addr; }
|
||||
static __inline__ u16 _lh(u32 addr) { return *(vu16 *)addr; }
|
||||
static __inline__ u32 _lw(u32 addr) { return *(vu32 *)addr; }
|
||||
static __inline__ u64 _ld(u32 addr) { return *(vu64 *)addr; }
|
||||
|
||||
static __inline__ void _sb(u8 val, u32 addr) { *(vu8 *)addr = val; }
|
||||
static __inline__ void _sh(u16 val, u32 addr) { *(vu16 *)addr = val; }
|
||||
static __inline__ void _sw(u32 val, u32 addr) { *(vu32 *)addr = val; }
|
||||
static __inline__ void _sd(u64 val, u32 addr) { *(vu64 *)addr = val; }
|
||||
|
||||
/* SCE types. */
|
||||
typedef unsigned char SceUChar8;
|
||||
typedef uint16_t SceUShort16;
|
||||
typedef uint32_t SceUInt32;
|
||||
typedef uint64_t SceUInt64;
|
||||
typedef uint64_t SceULong64;
|
||||
/*typedef unsigned int SceULong128 __attribute__((mode(TI)));*/
|
||||
|
||||
typedef char SceChar8;
|
||||
typedef int16_t SceShort16;
|
||||
typedef int32_t SceInt32;
|
||||
typedef int64_t SceInt64;
|
||||
typedef int64_t SceLong64;
|
||||
/*typedef int SceLong128 __attribute__((mode(TI)));*/
|
||||
|
||||
typedef float SceFloat;
|
||||
typedef float SceFloat32;
|
||||
|
||||
typedef short unsigned int SceWChar16;
|
||||
typedef unsigned int SceWChar32;
|
||||
|
||||
typedef int SceBool;
|
||||
|
||||
typedef void SceVoid;
|
||||
typedef void * ScePVoid;
|
||||
|
||||
|
||||
/* PSP types. */
|
||||
|
||||
/* Rectangles. */
|
||||
typedef struct ScePspSRect {
|
||||
short int x;
|
||||
short int y;
|
||||
short int w;
|
||||
short int h;
|
||||
} ScePspSRect;
|
||||
|
||||
typedef struct ScePspIRect {
|
||||
int x;
|
||||
int y;
|
||||
int w;
|
||||
int h;
|
||||
} ScePspIRect;
|
||||
|
||||
typedef struct ScePspL64Rect {
|
||||
SceLong64 x;
|
||||
SceLong64 y;
|
||||
SceLong64 w;
|
||||
SceLong64 h;
|
||||
} ScePspL64Rect;
|
||||
|
||||
typedef struct ScePspFRect {
|
||||
float x;
|
||||
float y;
|
||||
float w;
|
||||
float h;
|
||||
} ScePspFRect;
|
||||
|
||||
/* 2D vectors. */
|
||||
typedef struct ScePspSVector2 {
|
||||
short int x;
|
||||
short int y;
|
||||
} ScePspSVector2;
|
||||
|
||||
typedef struct ScePspIVector2 {
|
||||
int x;
|
||||
int y;
|
||||
} ScePspIVector2;
|
||||
|
||||
typedef struct ScePspL64Vector2 {
|
||||
SceLong64 x;
|
||||
SceLong64 y;
|
||||
} ScePspL64Vector2;
|
||||
|
||||
typedef struct ScePspFVector2 {
|
||||
float x;
|
||||
float y;
|
||||
} ScePspFVector2;
|
||||
|
||||
typedef union ScePspVector2 {
|
||||
ScePspFVector2 fv;
|
||||
ScePspIVector2 iv;
|
||||
float f[2];
|
||||
int i[2];
|
||||
} ScePspVector2;
|
||||
|
||||
/* 3D vectors. */
|
||||
typedef struct ScePspSVector3 {
|
||||
short int x;
|
||||
short int y;
|
||||
short int z;
|
||||
} ScePspSVector3;
|
||||
|
||||
typedef struct ScePspIVector3 {
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
} ScePspIVector3;
|
||||
|
||||
typedef struct ScePspL64Vector3 {
|
||||
SceLong64 x;
|
||||
SceLong64 y;
|
||||
SceLong64 z;
|
||||
} ScePspL64Vector3;
|
||||
|
||||
typedef struct ScePspFVector3 {
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
} ScePspFVector3;
|
||||
|
||||
typedef union ScePspVector3 {
|
||||
ScePspFVector3 fv;
|
||||
ScePspIVector3 iv;
|
||||
float f[3];
|
||||
int i[3];
|
||||
} ScePspVector3;
|
||||
|
||||
/* 4D vectors. */
|
||||
typedef struct ScePspSVector4 {
|
||||
short int x;
|
||||
short int y;
|
||||
short int z;
|
||||
short int w;
|
||||
} ScePspSVector4;
|
||||
|
||||
typedef struct ScePspIVector4 {
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
int w;
|
||||
} ScePspIVector4;
|
||||
|
||||
typedef struct ScePspL64Vector4 {
|
||||
SceLong64 x;
|
||||
SceLong64 y;
|
||||
SceLong64 z;
|
||||
SceLong64 w;
|
||||
} ScePspL64Vector4;
|
||||
|
||||
typedef struct ScePspFVector4 {
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float w;
|
||||
} ScePspFVector4 __attribute__((aligned(16)));
|
||||
|
||||
typedef struct ScePspFVector4Unaligned {
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float w;
|
||||
} ScePspFVector4Unaligned;
|
||||
|
||||
typedef union ScePspVector4 {
|
||||
ScePspFVector4 fv;
|
||||
ScePspIVector4 iv;
|
||||
/* SceULong128 qw;*/ /* Missing compiler support. */
|
||||
float f[4];
|
||||
int i[4];
|
||||
} ScePspVector4 __attribute__((aligned(16)));
|
||||
|
||||
/* 2D matrix types. */
|
||||
typedef struct ScePspIMatrix2 {
|
||||
ScePspIVector2 x;
|
||||
ScePspIVector2 y;
|
||||
} ScePspIMatrix2;
|
||||
|
||||
typedef struct ScePspFMatrix2 {
|
||||
ScePspFVector2 x;
|
||||
ScePspFVector2 y;
|
||||
} ScePspFMatrix2;
|
||||
|
||||
typedef union ScePspMatrix2 {
|
||||
ScePspFMatrix2 fm;
|
||||
ScePspIMatrix2 im;
|
||||
ScePspFVector2 fv[2];
|
||||
ScePspIVector2 iv[2];
|
||||
ScePspVector2 v[2];
|
||||
/* SceULong128 qw[2];*/ /* Missing compiler support. */
|
||||
float f[2][2];
|
||||
int i[2][2];
|
||||
} ScePspMatrix2;
|
||||
|
||||
/* 3D matrix types. */
|
||||
typedef struct ScePspIMatrix3 {
|
||||
ScePspIVector3 x;
|
||||
ScePspIVector3 y;
|
||||
ScePspIVector3 z;
|
||||
} ScePspIMatrix3;
|
||||
|
||||
typedef struct ScePspFMatrix3 {
|
||||
ScePspFVector3 x;
|
||||
ScePspFVector3 y;
|
||||
ScePspFVector3 z;
|
||||
} ScePspFMatrix3;
|
||||
|
||||
typedef union ScePspMatrix3 {
|
||||
ScePspFMatrix3 fm;
|
||||
ScePspIMatrix3 im;
|
||||
ScePspFVector3 fv[3];
|
||||
ScePspIVector3 iv[3];
|
||||
ScePspVector3 v[3];
|
||||
/* SceULong128 qw[3];*/ /* Missing compiler support. */
|
||||
float f[3][3];
|
||||
int i[3][3];
|
||||
} ScePspMatrix3;
|
||||
|
||||
/* 4D matrix types. */
|
||||
typedef struct ScePspIMatrix4 {
|
||||
ScePspIVector4 x;
|
||||
ScePspIVector4 y;
|
||||
ScePspIVector4 z;
|
||||
ScePspIVector4 w;
|
||||
} ScePspIMatrix4 __attribute__((aligned(16)));
|
||||
|
||||
typedef struct ScePspIMatrix4Unaligned {
|
||||
ScePspIVector4 x;
|
||||
ScePspIVector4 y;
|
||||
ScePspIVector4 z;
|
||||
ScePspIVector4 w;
|
||||
} ScePspIMatrix4Unaligned;
|
||||
|
||||
typedef struct ScePspFMatrix4 {
|
||||
ScePspFVector4 x;
|
||||
ScePspFVector4 y;
|
||||
ScePspFVector4 z;
|
||||
ScePspFVector4 w;
|
||||
} ScePspFMatrix4 __attribute__((aligned(16)));
|
||||
|
||||
typedef struct ScePspFMatrix4Unaligned {
|
||||
ScePspFVector4 x;
|
||||
ScePspFVector4 y;
|
||||
ScePspFVector4 z;
|
||||
ScePspFVector4 w;
|
||||
} ScePspFMatrix4Unaligned;
|
||||
|
||||
typedef union ScePspMatrix4 {
|
||||
ScePspFMatrix4 fm;
|
||||
ScePspIMatrix4 im;
|
||||
ScePspFVector4 fv[4];
|
||||
ScePspIVector4 iv[4];
|
||||
ScePspVector4 v[4];
|
||||
/* SceULong128 qw[4];*/ /* Missing compiler support. */
|
||||
float f[4][4];
|
||||
int i[4][4];
|
||||
} ScePspMatrix4;
|
||||
|
||||
/* Quaternions. */
|
||||
typedef struct ScePspFQuaternion {
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float w;
|
||||
} ScePspFQuaternion __attribute__((aligned(16)));
|
||||
|
||||
typedef struct ScePspFQuaternionUnaligned {
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float w;
|
||||
} ScePspFQuaternionUnaligned;
|
||||
|
||||
/* Colors and pixel formats. */
|
||||
typedef struct ScePspFColor {
|
||||
float r;
|
||||
float g;
|
||||
float b;
|
||||
float a;
|
||||
} ScePspFColor __attribute__((aligned(16)));
|
||||
|
||||
typedef struct ScePspFColorUnaligned {
|
||||
float r;
|
||||
float g;
|
||||
float b;
|
||||
float a;
|
||||
} ScePspFColorUnaligned;
|
||||
|
||||
typedef unsigned int ScePspRGBA8888;
|
||||
typedef unsigned short ScePspRGBA4444;
|
||||
typedef unsigned short ScePspRGBA5551;
|
||||
typedef unsigned short ScePspRGB565;
|
||||
|
||||
/* Unions for converting between types. */
|
||||
typedef union ScePspUnion32 {
|
||||
unsigned int ui;
|
||||
int i;
|
||||
unsigned short us[2];
|
||||
short int s[2];
|
||||
unsigned char uc[4];
|
||||
char c[4];
|
||||
float f;
|
||||
ScePspRGBA8888 rgba8888;
|
||||
ScePspRGBA4444 rgba4444[2];
|
||||
ScePspRGBA5551 rgba5551[2];
|
||||
ScePspRGB565 rgb565[2];
|
||||
} ScePspUnion32;
|
||||
|
||||
typedef union ScePspUnion64 {
|
||||
SceULong64 ul;
|
||||
SceLong64 l;
|
||||
unsigned int ui[2];
|
||||
int i[2];
|
||||
unsigned short us[4];
|
||||
short int s[4];
|
||||
unsigned char uc[8];
|
||||
char c[8];
|
||||
float f[2];
|
||||
ScePspSRect sr;
|
||||
ScePspSVector4 sv;
|
||||
ScePspRGBA8888 rgba8888[2];
|
||||
ScePspRGBA4444 rgba4444[4];
|
||||
ScePspRGBA5551 rgba5551[4];
|
||||
ScePspRGB565 rgb565[4];
|
||||
} ScePspUnion64;
|
||||
|
||||
typedef union ScePspUnion128 {
|
||||
/* SceULong128 qw;*/ /* Missing compiler support. */
|
||||
/* SceULong128 uq;*/
|
||||
/* SceLong128 q;*/
|
||||
SceULong64 ul[2];
|
||||
SceLong64 l[2];
|
||||
unsigned int ui[4];
|
||||
int i[4];
|
||||
unsigned short us[8];
|
||||
short int s[8];
|
||||
unsigned char uc[16];
|
||||
char c[16];
|
||||
float f[4];
|
||||
ScePspFRect fr;
|
||||
ScePspIRect ir;
|
||||
ScePspFVector4 fv;
|
||||
ScePspIVector4 iv;
|
||||
ScePspFQuaternion fq;
|
||||
ScePspFColor fc;
|
||||
ScePspRGBA8888 rgba8888[4];
|
||||
ScePspRGBA4444 rgba4444[8];
|
||||
ScePspRGBA5551 rgba5551[8];
|
||||
ScePspRGB565 rgb565[8];
|
||||
} ScePspUnion128 __attribute__((aligned(16)));
|
||||
|
||||
/* Date and time. */
|
||||
typedef struct ScePspDateTime {
|
||||
unsigned short year;
|
||||
unsigned short month;
|
||||
unsigned short day;
|
||||
unsigned short hour;
|
||||
unsigned short minute;
|
||||
unsigned short second;
|
||||
unsigned int microsecond;
|
||||
} ScePspDateTime;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _PSPTYPES_H_ */
|
||||
Reference in New Issue
Block a user