Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

A lot of changes, osk, some networking fixes, changed rsxtest to not …

…need vpcomp. Added move structs and exports.
  • Loading branch information...
commit 2a62404ea05a51846252d9259bb844ca03f862bf 1 parent ae14cae
@Parlane Parlane authored
View
213 psl1ght/include/io/move.h
@@ -0,0 +1,213 @@
+#pragma once
+
+#include <psl1ght/types.h>
+#include <stdlib.h>
+#include <spurs/types.h>
+
+EXTERN_BEGIN
+
+#define MOVE_VERSION 2
+#define MAX_MOVES 4
+#define EXTERNAL_PORT_DATA_SIZE 32
+
+#define GEM_TRACKING_POSITION_TRACKED 1
+#define GEM_TRACKING_VISIBLE 2
+
+#define STATE_CURRENT_TIME 0
+#define STATE_LATEST_IMAGE_TIME 1
+#define STATE_SPECIFY_TIME 2
+
+typedef struct GemExtPortData {
+ u16 isconnected;
+
+ unsigned int : 8; /* reserved */
+ /* Button information */
+ /* 0: UP, 1: DOWN */
+ unsigned int BTN_LEFT : 1;
+ unsigned int BTN_DOWN : 1;
+ unsigned int BTN_RIGHT : 1;
+ unsigned int BTN_UP : 1;
+ unsigned int BTN_START : 1;
+ unsigned int BTN_R3 : 1;
+ unsigned int BTN_L3 : 1;
+ unsigned int BTN_SELECT : 1;
+
+ unsigned int : 8; /* reserved */
+ unsigned int BTN_SQUARE : 1;
+ unsigned int BTN_CROSS : 1;
+ unsigned int BTN_CIRCLE : 1;
+ unsigned int BTN_TRIANGLE : 1;
+ unsigned int BTN_R1 : 1;
+ unsigned int BTN_L1 : 1;
+ unsigned int BTN_R2 : 1;
+ unsigned int BTN_L2 : 1;
+
+ /* Analog nub information */
+ /* 0x0000 - 0x00FF */
+ unsigned int ANA_R_H : 16;
+ unsigned int ANA_R_V : 16;
+ unsigned int ANA_L_H : 16;
+ unsigned int ANA_L_V : 16;
+
+ u8 data[5];
+} GemExtPortData;
+
+typedef struct GemPadData{
+ u16 buttons;
+ u16 ANA_T;
+} GemPadData;
+
+typedef struct GemState {
+ vec_float4 pos;
+ vec_float4 vel;
+ vec_float4 accel;
+ vec_float4 quat;
+ vec_float4 angvel;
+ vec_float4 angaccel;
+ vec_float4 handle_pos;
+ vec_float4 handle_vel;
+ vec_float4 handle_accel;
+ GemPadData paddata;
+ GemExtPortData extportdata;
+ system_time_t time;
+ float temperature;
+ float camera_pitch_angle;
+ u32 tracking;
+} GemState;
+
+typedef struct GemAttribute {
+ u32 version;
+ u32 max;
+ u32 memory; //pointer to memory to use for gem lib, if you specify null it will automatically allocate for you
+ u32 spurs; //pointer to Spurs object
+ u8 spu_priorities[8];
+} GemAttribute;
+
+typedef struct GemCameraState {
+ s32 exposure;
+ float exposure_time;
+ float gain;
+ float pitch_angle;
+ float pitch_angle_estimate;
+} GemCameraState;
+
+typedef struct GemImageState {
+ system_time_t frame_time;
+ system_time_t time;
+ float u;
+ float v;
+ float r;
+ float projectionx;
+ float projectiony;
+ float distance;
+ u8 visible;
+ u8 r_valid;
+} GemImageState;
+
+typedef struct GemInfo
+{
+ u32 max;
+ u32 connected;
+ u32 status[MAX_MOVES];
+ u32 port[MAX_MOVES];
+} GemInfo;
+
+typedef enum
+{
+ GEM_NO_VIDEO_OUTPUT=1,
+ GEM_RGBA_640x480,
+ GEM_YUV_640x480,
+ GEM_YUV422_640x480,
+ GEM_YUV411_640x480,
+ GEM_RGBA_320x240,
+ GEM_BAYER_RESTORED,
+ GEM_BAYER_RESTORED_RGGB,
+ GEM_BAYER_RESTORED_RASTERIZED
+} GemVideoConvertFormatEnum;
+
+#define GEM_AUTO_WHITE_BALANCE 1
+#define GEM_GAMMA_BOOST 2
+#define GEM_COMBINE_PREVIOUS_INPUT_FRAME 4
+#define GEM_FILTER_OUTLIER_PIXELS 8
+
+typedef struct GemVideoConvertAttribute {
+ int version; // set to MOVE_VERSION
+ GemVideoConvertFormatEnum format;
+ int conversion;
+ float gain;
+ float red_gain;
+ float green_gain;
+ float blue_gain;
+ void* buffer_memory;
+ void* video_data_out;
+ u8 alpha;
+} GemVideoConvertAttribute;
+
+#define GEM_INERTIAL_LATEST 0
+#define GEM_INERTIAL_PREVIOUS 1
+#define GEM_INERTIAL_NEXT 2
+
+typedef struct GemInertialState {
+ vec_float4 accelerometer;
+ vec_float4 gyro;
+ vec_float4 accelerometer_bias;
+ vec_float4 gyro_bias;
+ GemPadData pad;
+ GemExtPortData ext;
+ system_time_t time;
+ int counter;
+ float temperature;
+} GemInertialState;
+
+s32 gemGetEnvironmentLightingColor(float* r, float* g, float* b);
+s32 gemUpdateStart(const void* camera_frame, system_time_t timestamp);
+s32 gemInit(const GemAttribute* attr);
+s32 gemGetTrackerHue(u32 num, u32* hue);
+s32 gemConvertVideoFinish();
+s32 gemEnableMagnetometer(u32 num, s32 enable);
+s32 gemGetRGB(u32 num, float* r, float* g, float* b);
+s32 gemWriteExternalPort(u32 num, u8 data[EXTERNAL_PORT_DATA_SIZE]);
+
+//hues points to an array that can hold 360 boolean values, my assumption is 360 bytes or 360 chars.
+s32 gemGetAllTrackableHues(u8* hues);
+s32 gemGetMemorySize(s32 max);
+s32 gemUpdateFinish();
+s32 gemEnableCameraPitchAngleCorrection(s32 enable);
+
+s32 gemGetRumble(u32 num, u8* intensity);
+s32 gemSetRumble(u32 num, u8 intensity);
+
+s32 gemGetState(u32 num, u32 timeflag, system_time_t time, GemState* state);
+
+s32 gemGetAccelerometerPositionInDevice(u32 num, vec_float4* pos);
+s32 gemConvertVideoStart(const void* frame);
+
+s32 gemFilterState(u32 num, u32 enable);
+s32 gemSetYaw(u32 num, vec_float4 zdir);
+s32 gemGetCameraState(GemCameraState* state);
+
+s32 gemTrackHues(const u32* req_hues, u32* res_hues);
+
+s32 gemGetImageState(u32 num, GemImageState* state);
+
+s32 gemClearStatusFlags(u32 num, u64 mask);
+
+s32 gemGetInfo(GemInfo* info);
+
+s32 gemPrepareCamera(s32 maxexposure, float quality);
+
+s32 gemCalibrate(u32 num);
+
+s32 gemGetHuePixels(const void* frame, u32 hue, u8* pixels);
+s32 gemPrepareVideoConvert(const GemVideoConvertAttribute* attr);
+s32 gemHSVtoRGB(float h, float s, float v, float* r, float* g, float* b);
+s32 gemForceRGB(u32 num, float r, float g, float b);
+s32 gemGetInertialState(u32 num, u32 flag, system_time_t time, GemInertialState* inertial);
+s32 gemReset(u32 num);
+s32 gemEnd();
+s32 gemInvalidateCalibration(u32 num);
+s32 gemIsTrackableHue(u32 hue);
+s32 gemGetStatusFlags(u32 num, u64* flags);
+
+
+EXTERN_END
View
20 psl1ght/include/io/msg.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#include <psl1ght/types.h>
+#include <stdlib.h>
+
+EXTERN_BEGIN
+
+
+/*
+EXPORT(msgDialogClose, 0x20543730);
+EXPORT(msgDialogOpenErrorCode, 0x3e22cb4b);
+EXPORT(msgDialogOpen, 0xf81eca25);
+EXPORT(msgDialogProgressBarInc, 0x94862702);
+EXPORT(msgDialogAbort, 0x62b0f803);
+EXPORT(msgDialogOpen2, 0x7603d3db);
+EXPORT(msgDialogProgressBarReset, 0x7bc2c8a8);
+EXPORT(msgDialogProgressBarSetMsg, 0x9d6af72a);
+*/
+
+EXTERN_END
View
157 psl1ght/include/io/osk.h
@@ -0,0 +1,157 @@
+#pragma once
+
+#include <psl1ght/types.h>
+#include <stdlib.h>
+
+EXTERN_BEGIN
+
+#define OSK_10KEY_PANEL 1
+#define OSK_FULLKEY_PANEL 2
+
+typedef enum {
+ OSK_INITIAL_SYSTEM_PANEL,
+ OSK_INITIAL_10KEY_PANEL,
+ OSK_INITIAL_FULLKEY_PANEL
+} oskInitialKeyLayout;
+
+
+
+#define OSK_DEVICE_MASK_PAD 0xFF
+
+typedef enum {
+ OSK_OK,
+ OSK_CANCELED,
+ OSK_ABORT,
+ OSK_NO_TEXT
+} oskInputFieldResult;
+
+typedef struct{
+ oskInputFieldResult result;
+ s32 length;
+ u16 *str;
+} oskCallbackReturnParam;
+
+typedef struct{
+ OSK_DEVICE_PAD,
+ OSK_DEVICE_KB
+} oskInputDevice;
+
+typedef enum {
+ OSK_SINGLELINE,
+ OSK_MULTILINE,
+ OSK_FULLKB_SINGLELINE,
+ OSK_FULLKB_MULTILINE,
+ OSK_SEPARATE_SINGLELINE_WINDOWED,
+ OSK_SEPARATE_MULTILINE_WINDOWED,
+ OSK_SEPARATE_INPUT_PANEL_WINDOWED,
+ OSK_SEPARATE_FULLKB_INPUT_PANEL_WINDOWED,
+ OSK_SEPARATE_CANDIDATE_WINDOWED
+} oskType;
+
+typedef enum {
+ OSK_CONTINUOUS_MODE_NONE,
+ OSK_CONTINUOUS_MODE_REMAIN_OPEN,
+ OSK_CONTINUOUS_MODE_HIDE,
+ OSK_CONTINUOUS_MODE_SHOW
+} oskContinuousMode;
+
+typedef struct{
+ oskContinuousMode continuous;
+ s32 mask;
+ s32 inputWidth;
+ float inputFieldTransparacy;
+ CellOskDialogLayoutInfo *inputFieldLayoutInfo;
+ CellOskDialogLayoutInfo *inputPanelLayoutInfo;
+ u32 reserved;
+} oskSeparateWindowOption;
+
+
+#define OSK_LANG_KOREAN 0x00001000
+#define OSK_LANG_DANISH 0x00020000
+#define OSK_LANG_SWEDISH 0x00040000
+#define OSK_LANG_NORWEGIAN 0x00080000
+#define OSK_LANG_FINNISH 0x00100000
+#define OSK_LANG_TRADITIONAL_CHINESE
+#define OSK_LANG_SIMPLIFIED_CHINESE
+
+
+#define OSK_PANEL_TYPE_DEFAULT 0x00000000
+#define OSK_PANEL_TYPE_DEFAULT_NO_JAPANESE 0x00000200
+#define OSK_PANEL_TYPE_ALPHABET_FULL_WIDTH 0x00800000
+#define OSK_PANEL_TYPE_ALPHABET 0x01000000
+#define OSK_PANEL_TYPE_NUMERAL_FULL_WIDTH 0x04000000
+#define OSK_PANEL_TYPE_NUMERAL 0x08000000
+#define OSK_PANEL_TYPE_JAPANESE 0x00000100
+#define OSK_PANEL_TYPE_JAPANESE_HIRAGANA 0x00200000
+#define OSK_PANEL_TYPE_JAPANESE_KATAKANA 0x00400000
+#define OSK_PANEL_TYPE_ENGLISH 0x00000002
+#define OSK_PANEL_TYPE_FRENCH 0x00000008
+#define OSK_PANEL_TYPE_SPANISH 0x00000004
+#define OSK_PANEL_TYPE_DUTCH 0x00000020
+#define OSK_PANEL_TYPE_GERMAN 0x00000001
+#define OSK_PANEL_TYPE_RUSSIAN 0x00000080
+#define OSK_PANEL_TYPE_ITALIAN 0x00000010
+#define OSK_PANEL_TYPE_PORTUGUESE 0x00000040
+#define OSK_PANEL_TYPE_KOREAN 0x00001000
+#define OSK_PANEL_TYPE_DANISH 0x00020000
+#define OSK_PANEL_TYPE_SWEDISH 0x00040000
+#define OSK_PANEL_TYPE_NORWEGIAN 0x00080000
+#define OSK_PANEL_TYPE_FINNISH 0x00100000
+#define OSK_PANEL_TYPE_TRADITIONAL_CHINESE 0x00004000
+#define OSK_PANEL_TYPE_SIMPLIFIED_CHINESE 0x00008000
+#define OSK_PANEL_TYPE_LATIN 0x02000000
+#define OSK_PANEL_TYPE_URL 0x10000000
+#define OSK_PANEL_TYPE_PASSWORD 0x20000000
+
+
+#define OSK_PROHIBIT_SPACE 0x00000001
+#define OSK_PROHIBIT_RETURN 0x00000002
+#define OSK_PROHIBIT_INPUT_ANALOG 0x00000008
+
+
+typedef struct{
+ float x;
+ float y;
+} oskPoint;
+
+typedef struct{
+ u32 allowedPanels;
+ u32 firstViewPanel;
+ oskPoint controlPoint;
+ s32 prohibitFlags;
+} oskParam;
+
+typedef struct{
+ u16 *message;
+ u16 *startText;
+ s32 maxLength;
+} oskInputFieldInfo;
+
+
+#define OSK_LAYOUTMODE_HORIZONTAL_ALIGN_LEFT 0x00000200
+#define OSK_LAYOUTMODE_HORIZONTAL_ALIGN_CENTER 0x00000400
+#define OSK_LAYOUTMODE_HORIZONTAL_ALIGN_RIGHT 0x00000800
+#define OSK_LAYOUTMODE_VERTICAL_ALIGN_TOP 0x00001000
+#define OSK_LAYOUTMODE_VERTICAL_ALIGN_CENTER 0x00002000
+#define OSK_LAYOUTMODE_VERTICAL_ALIGN_BOTTOM 0x00004000
+
+
+s32 oskSetInitialInputDevice(oskInputDevice input);
+s32 oskGetSize(u16 *width, u16 *height, oskType type);
+s32 oskUnloadAsync(oskCallbackReturnParam *param);
+s32 oskDisableDimmer();
+s32 oskSetKeyLayoutOption(u32 flags);
+s32 oskAbort();
+s32 oskSetDeviceMask(u32 mask);
+s32 oskSetSeparateWindowOption(oskSeparateWindowOption *option);
+s32 oskGetInputText(oskCallbackReturnParam *info);
+s32 oskAddSupportLanguage(u32 lang);
+s32 oskLoadAsync(mem_container_t container, const oskParam *param, const oskInputFieldInfo *inputInfo);
+s32 oskSetInitialKeyLayout(oskInitialKeyLayout layout);
+s32 oskSetLayoutMode (s32 mode);
+
+
+
+
+
+EXTERN_END
View
6 psl1ght/include/net/net.h
@@ -93,7 +93,7 @@ int netBind(int socket, const struct sockaddr* address, net_socklen_t address_le
int netConnect(int socket, const struct sockaddr* address, net_socklen_t address_len);
int netGetPeerName(int socket, struct sockaddr* address, net_socklen_t* address_len);
int netGetSockName(int socket, struct sockaddr* address, net_socklen_t* address_len);
-int netGetSockOpt(int socket, int level, int option_name, void* option_value, net_socklen_t* option_len);
+int netGetSockOpt(int socket, int level, int option_name, void* option_value, socklen_t* option_len);
int netListen(int socket, int backlog);
ssize_t netRecv(int socket, void* buffer, size_t length, int flags);
ssize_t netRecvFrom(int socket, void* buffer, size_t length, int flags, struct sockaddr* address, net_socklen_t* address_len);
@@ -101,9 +101,9 @@ ssize_t netRecvMsg(int socket, struct net_msghdr* message, int flags);
ssize_t netSend(int socket, const void* message, size_t length, int flags);
ssize_t netSendTo(int socket, const void* message, size_t length, int flags, const struct sockaddr* dest_addr, net_socklen_t dest_len);
ssize_t netSendMsg(int socket, const struct net_msghdr* message, int flags);
-int netSetSockOpt(int socket, int level, int option_name, const void* option_value, net_socklen_t option_len);
+int netSetSockOpt(int socket, int level, int option_name, const void* option_value, socklen_t option_len);
int netShutdown(int socket, int how);
-int netSelect(int nfds, net_fd_set* readfds, net_fd_set* writefds, net_fd_set* errorfds, struct timeval* timeout);
+int netSelect(int nfds, fd_set* readfds, fd_set* writefds, fd_set* errorfds, struct timeval_32* timeout);
int netSocket(int domain, int type, int protocol);
int netSocketPair(int domain, int type, int protocol, int socket_vector[2]);
s32 netClose(int socket);
View
2  psl1ght/include/psl1ght/lv2/net.h
@@ -18,4 +18,4 @@ LV2_SYSCALL lv2NetShutdown(int socket, int how) { return Lv2Syscall2(712, socket
LV2_SYSCALL lv2NetSocket(int domain, int type, int protocol) { return Lv2Syscall3(713, domain, type, protocol); }
LV2_SYSCALL lv2NetClose(int socket) { return Lv2Syscall1(714, socket); }
//LV2_SYSCALL lv2NetPoll(struct pollfd fds[], nfds_t nfds, int timeout) { return Lv2Syscall3(715, (u64)fds, nfds, timeout); }
-LV2_SYSCALL lv2NetSelect(int nfds, net_fd_set* readfds, net_fd_set* writefds, net_fd_set* errorfds, struct timeval* timeout) { return Lv2Syscall5(716, nfds, (u64)readfds, (u64)writefds, (u64)errorfds, (u64)timeout); }
+LV2_SYSCALL lv2NetSelect(int nfds, fd_set* readfds, fd_set* writefds, fd_set* errorfds, struct timeval_32* timeout) { return Lv2Syscall5(716, nfds, (u64)readfds, (u64)writefds, (u64)errorfds, (u64)timeout); }
View
9 psl1ght/include/psl1ght/types.h
@@ -44,6 +44,15 @@ typedef u32 mem_container_t;
typedef u32 lv2_void;
typedef u32 lv2_size_t;
+typedef s64 system_time_t;
+
+struct timeval_32 {
+ u32 tv_sec;
+ s32 tv_usec;
+};
+
+#define vec_float4 vector float;
+
#ifdef __cplusplus
#define EXTERN_BEGIN extern "C" {
#define EXTERN_END }
View
14 psl1ght/include/spurs/types.h
@@ -0,0 +1,14 @@
+#pragma once
+
+#include <psl1ght/types.h>
+
+EXTERN_BEGIN
+
+#define SPURS_ALIGN 128
+#define SPURS_SIZE 4096
+
+typedef struct Spurs {
+ unsigned char space[SPURS_SIZE];
+} __attribute__((aligned(SPURS_ALIGN))) Spurs;
+
+EXTERN_END
View
2  psl1ght/include/sys/select.h
@@ -9,7 +9,7 @@
EXTERN_BEGIN
-int select(int, fd_set*, fd_set*, fd_set*, struct timeval*);
+int select(int, fd_set*, fd_set*, fd_set*, struct timeval_32*);
int pselect(int, fd_set*, fd_set*, fd_set*, const struct timespec*, const sigset_t*);
EXTERN_END
View
7 psl1ght/include/sys/socket.h
@@ -89,11 +89,11 @@ struct linger
#define PF_INET AF_INET
#define PF_INET6 AF_INET6
-#define ESHUTDOWN 110
+#define ESHUTDOWN 110
+#define NET_EINPROGRESS 36
#define SOCKET_FD_MASK 0x40000000
-#define SO_NBIO 0x1100
EXTERN_BEGIN
@@ -102,8 +102,7 @@ int bind(int socket, const struct sockaddr* address, socklen_t address_len);
int connect(int socket, const struct sockaddr* address, socklen_t address_len);
int getpeername(int socket, struct sockaddr* address, socklen_t* address_len);
int getsockname(int socket, struct sockaddr* address, socklen_t* address_len);
-int getsockopt(int socket, int level, int option_name, void* option_value,
- socklen_t* option_len);
+int getsockopt(int socket, int level, int option_name, void* option_value, socklen_t* option_len);
int listen(int socket, int backlog);
ssize_t recv(int socket, void* buffer, size_t length, int flags);
ssize_t recvfrom(int socket, void* buffer, size_t length, int flags,
View
7 psl1ght/include/sys/thread.h
@@ -32,6 +32,13 @@ typedef struct sys_lwmutex_attribute_t {
char name[8];
}sys_lwmutex_attribute_t;
+#define MUTEX_PROTOCOL_FIFO 1
+#define MUTEX_PROTOCOL_PRIORITY 2
+#define MUTEX_PROTOCOL_PRIORITY_INHERIT 3
+
+#define MUTEX_RECURSIVE 0x10
+#define MUTEX_NOT_RECURSIVE 0x20
+
#define MUTEX_ATTR_PROTOCOL 0x0002
#define MUTEX_ATTR_RECURSIVE 0x0020
#define MUTEX_ATTR_PSHARED 0x0200
View
2  psl1ght/include/sysmodule/sysmodule.h
@@ -27,6 +27,8 @@ typedef enum
SYSMODULE_CAM = 0x23,
+ SYSMODULE_MOVE = 0x5a,
+
} id_module;
int SysLoadModule(id_module id);
View
65 psl1ght/sprx/libgem/Makefile
@@ -0,0 +1,65 @@
+.SUFFIXES:
+
+-include ../../../Makefile.base
+-include ../../../../Makefile.base
+
+TARGET := $(notdir $(CURDIR))
+BUILD := build
+SOURCE := ../common
+INCLUDE := .
+DATA := data
+LIBS :=
+
+LD := ppu-ld
+
+CFLAGS := -m32
+
+ifneq ($(BUILD),$(notdir $(CURDIR)))
+
+export OUTPUT := $(CURDIR)/$(TARGET)
+export VPATH := $(foreach dir,$(SOURCE),$(CURDIR)/$(dir)) \
+ $(foreach dir,$(DATA),$(CURDIR)/$(dir))
+export BUILDDIR := $(CURDIR)/$(BUILD)
+export DEPSDIR := $(BUILDDIR)
+
+CFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.c)))
+CXXFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.cpp)))
+SFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.S)))
+BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.bin)))
+
+export OFILES := $(CFILES:.c=.o) \
+ $(CXXFILES:.cpp=.o) \
+ $(SFILES:.S=.o)
+
+export BINFILES := $(BINFILES:.bin=.bin.h)
+
+export INCLUDES := $(foreach dir,$(INCLUDE),-I$(CURDIR)/$(dir)) \
+ -I$(CURDIR)/$(BUILD)
+
+.PHONY: $(BUILD) clean
+
+$(BUILD):
+ @[ -d $@ ] || mkdir -p $@
+ @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
+
+clean:
+ @echo Clean...
+ @rm -rf $(BUILD) $(OUTPUT).elf $(OUTPUT).self $(OUTPUT).a
+
+else
+
+DEPENDS := $(OFILES:.o=.d)
+
+$(OUTPUT).a: sprx.o
+
+lib.o: lib.c
+ @echo "[CC] $(notdir $<)"
+ @$(CC) $(DEPSOPTIONS) -S $(CFLAGS) $(INCLUDES) $< -o lib.S
+ @$(CC) $(DEPSOPTIONS) -c lib.S -o $@
+
+sprx.o: stub.o lib.o
+ @$(LD) -r stub.o lib.o -o $@
+
+-include $(DEPENDS)
+
+endif
View
5 psl1ght/sprx/libgem/config.h
@@ -0,0 +1,5 @@
+#define LIBRARY_NAME "libgem"
+#define LIBRARY_SYMBOL libgem
+
+#define LIBRARY_HEADER_1 0x2c000001
+#define LIBRARY_HEADER_2 0x0009
View
36 psl1ght/sprx/libgem/exports.h
@@ -0,0 +1,36 @@
+EXPORT(gemGetEnvironmentLightingColor, 0x02eb41bb);
+EXPORT(gemUpdateStart, 0x0ecd2261);
+EXPORT(gemInit, 0x13ea7c64);
+EXPORT(gemGetTrackerHue, 0x18ea899a);
+EXPORT(gemConvertVideoFinish, 0x1a13d010);
+EXPORT(gemEnableMagnetometer, 0x1a2518a2);
+EXPORT(gemGetRGB, 0x1b30cc22);
+EXPORT(gemWriteExternalPort, 0x1f6328d8);
+EXPORT(gemGetAllTrackableHues, 0x2d2c2764);
+EXPORT(gemGetMemorySize, 0x2e0a170d);
+EXPORT(gemUpdateFinish, 0x41ae9c31);
+EXPORT(gemEnableCameraPitchAngleCorrection, 0x4219de31);
+EXPORT(gemSetRumble, 0x49609306);
+EXPORT(gemGetState, 0x6441d38d);
+EXPORT(gemGetAccelerometerPositionInDevice, 0x6a5b7048);
+EXPORT(gemGetRumble, 0x6db6b007);
+EXPORT(gemConvertVideoStart, 0x6dce048c);
+EXPORT(gemFilterState, 0x6fc4c791);
+EXPORT(gemSetYaw, 0x77e08704);
+EXPORT(gemGetCameraState, 0x8befac67);
+EXPORT(gemTrackHues, 0x928ac5f8);
+EXPORT(gemGetImageState, 0x92cc4b34);
+EXPORT(gemClearStatusFlags, 0x9b9714a4);
+EXPORT(gemGetInfo, 0x9e1dff96);
+EXPORT(gemPrepareCamera, 0xa03ef587);
+EXPORT(gemCalibrate, 0xafa99ead);
+EXPORT(gemGetHuePixels, 0xb8ef56a6);
+EXPORT(gemPrepareVideoConvert, 0xc07896f9);
+EXPORT(gemHSVtoRGB, 0xc7622586);
+EXPORT(gemForceRGB, 0xce6d7791);
+EXPORT(gemGetInertialState, 0xd37b127a);
+EXPORT(gemReset, 0xde54e2fc);
+EXPORT(gemEnd, 0xe1f85a80);
+EXPORT(gemInvalidateCalibration, 0xe3e4f0d6);
+EXPORT(gemIsTrackableHue, 0xfb5887f9);
+EXPORT(gemGetStatusFlags, 0xfee33481);
View
61 psl1ght/sprx/libnet/socket.c
@@ -163,55 +163,15 @@ int closesocket(int socket)
return netErrno(ret);
}
-int select(int nfds, fd_set* readfds, fd_set* writefds, fd_set* errorfds, struct timeval* timeout)
+int select(int nfds, fd_set* readfds, fd_set* writefds, fd_set* errorfds, struct timeval_32* timeout)
{
- net_fd_set* net_readfds = NULL;
- net_fd_set* net_writefds = NULL;
- net_fd_set* net_errorfds = NULL;
-
- size_t fdsize = sizeof(fd_set) * nfds;
-
-#define COPY_NFDS(dest, src, num) { \
- for (size_t i = 0; i < num; i++) { \
- for (size_t j = 0; j < (sizeof(src[i].fds_bits) / sizeof(src[i].fds_bits[0])); j++) \
- dest[i].fds_bits[j] = src[i].fds_bits[j]; \
- } \
-}
-
- if (readfds) {
- net_readfds = (net_fd_set*)malloc(fdsize);
- COPY_NFDS(net_readfds, readfds, nfds);
- }
- if (writefds) {
- net_writefds = (net_fd_set*)malloc(fdsize);
- COPY_NFDS(net_writefds, writefds, nfds);
- }
- if (errorfds) {
- net_errorfds = (net_fd_set*)malloc(fdsize);
- COPY_NFDS(net_errorfds, errorfds, nfds);
- }
-
s32 ret;
- if (LIBNET_INITIALIZED)
- ret = netSelect(nfds, net_readfds, net_writefds, net_errorfds, timeout);
- else
- ret = lv2NetSelect(nfds, net_readfds, net_writefds, net_errorfds, timeout);
-
- if (net_readfds) {
- if (ret >= 0)
- COPY_NFDS(readfds, net_readfds, nfds);
- free(net_readfds);
- }
- if (net_writefds) {
- if (ret >= 0)
- COPY_NFDS(writefds, net_writefds, nfds);
- free(net_writefds);
- }
- if (net_errorfds) {
- if (ret >= 0)
- COPY_NFDS(errorfds, net_errorfds, nfds);
- free(net_errorfds);
+ if (LIBNET_INITIALIZED){
+ ret = netSelect(nfds, readfds, writefds, errorfds, timeout);
+ printf("netSelect(%d) = %08X\n", nfds, ret);
}
+ else
+ ret = lv2NetSelect(nfds, readfds, writefds, errorfds, timeout);
return netErrno(ret);
}
@@ -315,6 +275,15 @@ struct hostent* gethostbyname(const char* name)
return copyhost(ret);
}
+int getsockopt(int socket, int level, int option_name, void* option_value, socklen_t* option_len)
+{
+ if (!LIBNET_INITIALIZED) {
+ errno = ENOSYS;
+ h_errno = TRY_AGAIN;
+ return -1;
+ }
+ return netErrno(netGetSockOpt(FD(socket), level, option_name, option_value, option_len));
+}
int setsockopt(int socket, int level, int option_name, const void* option_value, socklen_t option_len)
{
View
37 psl1ght/sprx/libsysutil/exports.h
@@ -1,6 +1,43 @@
EXPORT(videoGetResolution, 0xe558748d);
EXPORT(videoConfigure, 0x0bae8772);
EXPORT(videoGetState, 0x887572d5);
+
+EXPORT(videoGetDeviceInfo, 0x1e930eef);
+EXPORT(videoGetConfiguration, 0x15b0b0cd);
+EXPORT(videoGetResolutionAvailability, 0xa322db75);
+EXPORT(videoDebugSetMonitorType, 0xcfdf24bb);
+EXPORT(videoRegisterCallback, 0x8e8bc444);
+EXPORT(videoUnregisterCallback, 0x7871bed4);
+EXPORT(videoGetNumberOfDevice, 0x75bbb672);
+EXPORT(videoGetConvertCursorColorInfo, 0x55e425c3);
+
EXPORT(sysRegisterCallback_ex, 0x9d98afa0);
EXPORT(sysCheckCallback, 0x189a74da);
EXPORT(sysUnregisterCallback, 0x02ff3c1b);
+
+
+EXPORT(msgDialogClose, 0x20543730);
+EXPORT(msgDialogOpenErrorCode, 0x3e22cb4b);
+EXPORT(msgDialogOpen, 0xf81eca25);
+EXPORT(msgDialogProgressBarInc, 0x94862702);
+EXPORT(msgDialogAbort, 0x62b0f803);
+EXPORT(msgDialogOpen2, 0x7603d3db);
+EXPORT(msgDialogProgressBarReset, 0x7bc2c8a8);
+EXPORT(msgDialogProgressBarSetMsg, 0x9d6af72a);
+
+EXPORT(oskDialogGetInputText, 0x1d99c3ee);
+EXPORT(oskDialogSetInitialInputDevice, 0xf3b4b43e);
+EXPORT(oskDialogGetSize, 0x35beade0);
+EXPORT(oskDialogUnloadAsync, 0x3d1e1931);
+EXPORT(oskDialogDisableDimmer, 0x41f20828);
+EXPORT(oskDialogSetKeyLayoutOption, 0xb53c54fa);
+EXPORT(oskDialogAbort, 0xb6d84526);
+EXPORT(oskDialogSetDeviceMask, 0xd3790a86);
+EXPORT(oskDialogSetSeparateWindowOption, 0x53e39df3);
+EXPORT(oskDialogAddSupportLanguage, 0x7f21c918);
+EXPORT(oskDialogLoadAsync, 0x7fcfc915);
+EXPORT(oskDialogSetInitialKeyLayout, 0xc427890c);
+EXPORT(oskDialogSetLayoutMode, 0xf0ec3ccc);
+
+
+
View
77 samples/lv2diag/Makefile
@@ -0,0 +1,77 @@
+.SUFFIXES:
+ifeq ($(strip $(PSL1GHT)),)
+$(error "PSL1GHT must be set in the environment.")
+endif
+
+include $(PSL1GHT)/Makefile.base
+
+TARGET := $(notdir $(CURDIR))
+BUILD := build
+SOURCE := source
+INCLUDE := include
+DATA := data
+LIBS :=
+
+TITLE := Template - PSL1GHT
+APPID := TEST00003
+CONTENTID := UP0001-$(APPID)_00-0000000000000000
+
+CFLAGS += -g -O2 -Wall --std=gnu99
+CXXFLAGS += -g -O2 -Wall
+
+ifneq ($(BUILD),$(notdir $(CURDIR)))
+
+export OUTPUT := $(CURDIR)/$(TARGET)
+export VPATH := $(foreach dir,$(SOURCE),$(CURDIR)/$(dir)) \
+ $(foreach dir,$(DATA),$(CURDIR)/$(dir))
+export BUILDDIR := $(CURDIR)/$(BUILD)
+export DEPSDIR := $(BUILDDIR)
+
+CFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.c)))
+CXXFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.cpp)))
+SFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.S)))
+BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.bin)))
+
+export OFILES := $(CFILES:.c=.o) \
+ $(CXXFILES:.cpp=.o) \
+ $(SFILES:.S=.o) \
+ $(BINFILES:.bin=.bin.o)
+
+export BINFILES := $(BINFILES:.bin=.bin.h)
+
+export INCLUDES := $(foreach dir,$(INCLUDE),-I$(CURDIR)/$(dir)) \
+ -I$(CURDIR)/$(BUILD)
+
+.PHONY: $(BUILD) clean pkg run
+
+$(BUILD):
+ @[ -d $@ ] || mkdir -p $@
+ @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
+
+clean:
+ @echo Clean...
+ @rm -rf $(BUILD) $(OUTPUT).elf $(OUTPUT).self $(OUTPUT).a $(OUTPUT).pkg
+
+pkg: $(BUILD)
+ @echo Creating PKG...
+ @mkdir -p $(BUILD)/pkg
+ @mkdir -p $(BUILD)/pkg/USRDIR
+ @cp $(ICON0) $(BUILD)/pkg/
+ @$(FSELF) -n $(BUILD)/$(TARGET).elf $(BUILD)/pkg/USRDIR/EBOOT.BIN
+ @$(SFO) --title "$(TITLE)" --appid "$(APPID)" -f $(SFOXML) $(BUILD)/pkg/PARAM.SFO
+ @$(PKG) --contentid $(CONTENTID) $(BUILD)/pkg/ $(OUTPUT).pkg
+
+run: $(BUILD)
+ @$(PS3LOADAPP) $(OUTPUT).self
+
+else
+
+DEPENDS := $(OFILES:.o=.d)
+
+$(OUTPUT).self: $(OUTPUT).elf
+$(OUTPUT).elf: $(OFILES)
+$(OFILES): $(BINFILES)
+
+-include $(DEPENDS)
+
+endif
View
10 samples/lv2diag/source/main.c
@@ -0,0 +1,10 @@
+#include <psl1ght/lv2.h>
+
+#include <stdio.h>
+#include <malloc.h>
+#include <string.h>
+
+int main(int argc, const char* argv[])
+{
+
+}
View
4 samples/rsxTest/Makefile
@@ -16,8 +16,8 @@ TITLE := Template - PSL1GHT
APPID := TEST00003
CONTENTID := UP0001-$(APPID)_00-0000000000000000
-CFLAGS += -g -O2 -Wall --std=gnu99
-CXXFLAGS += -g -O2 -Wall
+CFLAGS += -O2 -Wall --std=gnu99
+CXXFLAGS += -O2 -Wall
ifneq ($(BUILD),$(notdir $(CURDIR)))
View
BIN  samples/rsxTest/data/dice.bin
Binary file not shown
View
13 samples/rsxTest/include/nv_shaders.h
@@ -3,6 +3,19 @@
#include <rsx/commands.h>
+static realityVertexProgram_old nv40_vp = {
+ .in_reg = 0x00000309,
+ .out_reg = 0x0000c001,
+ .size = (3*4),
+ .data = {
+ /* MOV result.position, vertex.position */
+ 0x40041c6c, 0x0040000d, 0x8106c083, 0x6041ff80,
+ /* MOV result.texcoord[0], vertex.texcoord[0] */
+ 0x401f9c6c, 0x0040080d, 0x8106c083, 0x6041ff9c,
+ /* MOV result.texcoord[1], vertex.texcoord[1] */
+ 0x401f9c6c, 0x0040090d, 0x8106c083, 0x6041ffa1,
+ }
+};
/*******************************************************************************
* NV30/NV40/G70 fragment shaders
View
29 samples/rsxTest/source/main.c
@@ -18,7 +18,7 @@
#include "texture.h"
#include "rsxutil.h"
#include "nv_shaders.h"
-#include "vprogram.vcg.h"
+#include "sysutil/events.h"
int currentBuffer = 0;
//realityTexture *ball; // Texture.
@@ -61,7 +61,7 @@ void drawFrame(int buffer, long frame) {
REALITY_CLEAR_BUFFERS_DEPTH);
// Load shaders, because the rsx won't do anything without them.
- realityLoadVertexProgram(context, (realityVertexProgram*)&vprogram_bin);
+ realityLoadVertexProgram_old(context, &nv40_vp);
realityLoadFragmentProgram(context, &nv30_fp);
// Load texture
@@ -85,14 +85,36 @@ void drawFrame(int buffer, long frame) {
realityVertexEnd(context);
}
+static void eventHandle(u64 status, u64 param, void * userdata) {
+ (void)param;
+ (void)userdata;
+ if(status == EVENT_REQUEST_EXITAPP){
+ printf("Quit game requested\n");
+ exit(0);
+ }else if(status == EVENT_MENU_OPEN){
+ //xmb opened, should prob pause game or something :P
+ }else if(status == EVENT_MENU_CLOSE){
+ //xmb closed, and then resume
+ }else if(status == EVENT_DRAWING_BEGIN){
+ }else if(status == EVENT_DRAWING_END){
+ }else{
+ printf("Unhandled event: %08llX\n", (unsigned long long int)status);
+ }
+}
+void appCleanup(){
+ sysUnregisterCallback(EVENT_SLOT0);
+ printf("Exiting for real.\n");
+}
s32 main(s32 argc, const char* argv[])
{
PadInfo padinfo;
PadData paddata;
int i;
+ atexit(appCleanup);
init_screen();
ioPadInit(7);
+ sysRegisterCallback(EVENT_SLOT0, eventHandle, NULL);
// Load texture
dice = loadPng(dice_bin);
@@ -115,7 +137,7 @@ s32 main(s32 argc, const char* argv[])
if(padinfo.status[i]){
ioPadGetData(i, &paddata);
- if(paddata.BTN_CROSS){
+ if(paddata.BTN_CROSS || paddata.BTN_START){
return 0;
}
}
@@ -126,6 +148,7 @@ s32 main(s32 argc, const char* argv[])
drawFrame(currentBuffer, frame++); // Draw into the unused buffer
flip(currentBuffer); // Flip buffer onto screen
currentBuffer = !currentBuffer;
+ sysCheckCallback();
}
View
26 samples/rsxTest/source/vprogram.vcg
@@ -1,26 +0,0 @@
-struct InputVertex
-{
- float4 vertex : POSITION;
- float2 texcoord : TEXCOORD0;
- float2 texcoord1 : TEXCOORD1;
-};
-
-struct OutputVertex
-{
- float4 vertex : POSITION;
- float2 texcoord : TEXCOORD0;
- float2 texcoord1 : TEXCOORD1;
-};
-
-
-OutputVertex main (InputVertex inputvertex)
-{
- OutputVertex outputvertex;
-
- outputvertex.vertex = inputvertex.vertex;
- outputvertex.texcoord = inputvertex.texcoord;
- outputvertex.texcoord1 = inputvertex.texcoord1;
-
-
- return outputvertex;
-}
Please sign in to comment.
Something went wrong with that request. Please try again.