Want to help out with pspsdk? I mean REALLY help out?

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Want to help out with pspsdk? I mean REALLY help out?

Post by ooPo »

We're always looking for new, good coders. If you would like to join the pspdev community, gain write access to the svn repository and add your own code to pspsdk then all you have to do is ask. How do you ask? Simple.

1) Post a patch to this forum.

Posting a patch shows that you have at least a basic idea of the tools involved in pspdev development, it gives an idea of your coding style and most of all it shows that you are genuinely interested in helping out.

We're not an elite group, just a skilled group. In fact, I'm an asshole and even *I* wasn't turned down. So what are you waiting for?

Post today!
Last edited by ooPo on Sat Jan 06, 2007 2:30 pm, edited 1 time in total.
donour
Posts: 9
Joined: Thu Jun 30, 2005 11:18 am

Post by donour »

Here's a silly patch that removes unused variables from /sdk/samples/gu/cube/cube.c.

--snip--
332,333d331
< unsigned int x,y;
<
--snip--

d
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

I've ported my Savedata Tool to the new PSPSDK:

Code: Select all

$ svn diff
Index&#58; sdk/kernel/pspkernel.h
===================================================================
--- sdk/kernel/pspkernel.h      &#40;revision 408&#41;
+++ sdk/kernel/pspkernel.h      &#40;working copy&#41;
@@ -23,6 +23,7 @@
 #include <pspmodulemgr.h>
 #include <pspthreadman.h>
 #include <psputils.h>
+#include <psputility.h>
 #include <pspumd.h>
 #include <pspge.h>
 #include <pspkerror.h>
Index&#58; sdk/kernel/Makefile.am
===================================================================
--- sdk/kernel/Makefile.am      &#40;revision 408&#41;
+++ sdk/kernel/Makefile.am      &#40;working copy&#41;
@@ -28,6 +28,7 @@
        pspmodulemgr.h          \
        pspthreadman.h          \
        pspumd.h                \
+       psputility.h            \
        psputils.h

 lib_LIBRARIES = libpspkernel.a
Index&#58; sdk/samples/Makefile.am
===================================================================
--- sdk/samples/Makefile.am     &#40;revision 408&#41;
+++ sdk/samples/Makefile.am     &#40;working copy&#41;
@@ -3,7 +3,8 @@

 SAMPLES = \
        sdktest \
-       gu/cube
+       gu/cube \
+       savedata

 all&#58;
sdk/kernel/psputility.h

sdk/samples/savedata/
User avatar
jpadams
Posts: 23
Joined: Sat Jul 02, 2005 1:59 pm
Location: Los Angeles
Contact:

slight error

Post by jpadams »

missing

#include <psputility.h>

in the sample code
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Re: slight error

Post by Shine »

jpadams wrote:missing

#include <psputility.h>

in the sample code
Looks like anything is included in kernel.h (like utils.h) and the function stubs for the savedata-API are already included in the kernel assembler part, so I've added utility.h to kernel.h, too and it is not necessary to include it from the sample code.
User avatar
Shazz
Posts: 244
Joined: Tue Aug 31, 2004 11:42 pm
Location: Somewhere over the rainbow
Contact:

Post by Shazz »

pspiofilemgr_stat.h patch (http://forums.ps2dev.org/viewtopic.php?t=2748)

Code: Select all

--- pspiofilemgr_stat.h   2005-07-20 09&#58;37&#58;12.287260600 +0200
+++ pspiofilemgr_stat2.h   2005-07-25 15&#58;35&#58;39.661769400 +0200
@@ -30,9 +30,9 @@
    /** Symbolic link */
    FIO_S_IFLNK      = 0x4000,
    /** Directory */
-   FIO_S_IFDIR      = 0x2000,
+   FIO_S_IFDIR      = 0x1000,
    /** Regular file */
-   FIO_S_IFREG      = 0x1000,
+   FIO_S_IFREG      = 0x2000,
 
    /** Set UID */
    FIO_S_ISUID      = 0x0800,
- TiTAN Art Division -
http://www.titandemo.org
CyberBill
Posts: 86
Joined: Tue Jul 26, 2005 3:53 pm
Location: Redmond, WA

Post by CyberBill »

If we have whole files, where should we post them??

I've got a working pspwifi.h & pspwifi.c that could be a decent start to getting wifi into PSPSDK. Problem is that I dont know how to compile the .s (from PSPPets demo) and pspwifi.c into a .a for linking.. sorry, I'm a complete GCC nub. I'm used to Visual Studio! :)

-Bill
Warren
Posts: 175
Joined: Sat Jan 24, 2004 8:26 am
Location: San Diego, CA

Post by Warren »

Shazz wrote:pspiofilemgr_stat.h patch (http://forums.ps2dev.org/viewtopic.php?t=2748)

Code: Select all

--- pspiofilemgr_stat.h   2005-07-20 09&#58;37&#58;12.287260600 +0200
+++ pspiofilemgr_stat2.h   2005-07-25 15&#58;35&#58;39.661769400 +0200
@@ -30,9 +30,9 @@
    /** Symbolic link */
    FIO_S_IFLNK      = 0x4000,
    /** Directory */
-   FIO_S_IFDIR      = 0x2000,
+   FIO_S_IFDIR      = 0x1000,
    /** Regular file */
-   FIO_S_IFREG      = 0x1000,
+   FIO_S_IFREG      = 0x2000,
 
    /** Set UID */
    FIO_S_ISUID      = 0x0800,
Applied
Warren
Posts: 175
Joined: Sat Jan 24, 2004 8:26 am
Location: San Diego, CA

Post by Warren »

CyberBill wrote:If we have whole files, where should we post them??

I've got a working pspwifi.h & pspwifi.c that could be a decent start to getting wifi into PSPSDK. Problem is that I dont know how to compile the .s (from PSPPets demo) and pspwifi.c into a .a for linking.. sorry, I'm a complete GCC nub. I'm used to Visual Studio! :)

-Bill
Net connectivity for PSPSDK is being worked on. We're currently trying to figure out a clean way to load the PRXs then it should be almost ready to go in.
Arwin
Posts: 426
Joined: Tue Jul 12, 2005 7:00 pm

Post by Arwin »

See also this topic:

http://forums.ps2dev.org/viewtopic.php?t=3107

I think p-sprint as the default keyboard driver may be a more useful item than what's posted there now (allowing you to press only 8 keys).

Let me know if you agree, then if you give me access I'll upload the files to svn and work on improving it to get a full scancode and modifier emulation up and running (so far looks like I only have to convert the keycodes to the default MW kernel scancodes)
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

p-sprint belongs in a seperate library but not inside of PSPSDK. PSPSDK encompasses the interfaces provided in the PSP's firmware, as well as supporting code. p-sprint, while useful, doesn't really fit there as it doesn't tie into any native or established PSP interfaces.

Of course I don't have any objections to it going into Subversion, just bug Oobles for an account when he's around.
Arwin
Posts: 426
Joined: Tue Jul 12, 2005 7:00 pm

Post by Arwin »

mrbrown wrote:p-sprint belongs in a seperate library but not inside of PSPSDK. PSPSDK encompasses the interfaces provided in the PSP's firmware, as well as supporting code. p-sprint, while useful, doesn't really fit there as it doesn't tie into any native or established PSP interfaces.

Of course I don't have any objections to it going into Subversion, just bug Oobles for an account when he's around.
I agree it doesn't belong in the PSPSDK - I just meant that it would be useful for Microwindows, which happens to be in the SVN repository. Sorry for not being clear enough.

I'll ask Oobles for an account. Thanks for the info.
bumper
Posts: 10
Joined: Thu Oct 06, 2005 5:39 am

Post by bumper »

Code: Select all

void sceGumScale&#40;const ScePspFVector3* v&#41;
&#123;
  ScePspFMatrix4* curr = gum_current_matrix;
  float x,y,z;

  x = v->x; y = v->y; z = v->z; // <- *** NEVER USED ***
  curr->x.x *= x; curr->x.y *= x; curr->x.z *= x;
  curr->y.x *= x; curr->y.y *= x; curr->y.z *= x;
  curr->z.x *= x; curr->z.y *= x; curr->z.z *= x;

  gum_matrix_update&#91;gum_current_mode&#93; = 1;
&#125;
In sceGumScale, only v->x is used, and it is used on all axis.
Could you fix it plz.
Paco
Posts: 54
Joined: Sun Oct 09, 2005 6:53 pm

Post by Paco »

Examples in the header comments for sceIoOpen() are wrong:

Code: Select all

 * if&#40;!&#40;fd = sceIoOpen&#40;"device&#58;/path/to/file", O_RDONLY, 0777&#41;&#41; &#123;
...
 * if&#40;!&#40;fd = sceIoOpen&#40;"device&#58;/path/to/file", O_WRONLY|O_CREAT, 0777&#41;&#41; &#123;
should be

Code: Select all

 * if&#40;&#40;fd = sceIoOpen&#40;"device&#58;/path/to/file", O_RDONLY, 0777&#41; < 0&#41; &#123;
...
 * if&#40;&#40;fd = sceIoOpen&#40;"device&#58;/path/to/file", O_WRONLY|O_CREAT, 0777&#41; < 0&#41; &#123;
And this would be the patch. Well I hope it is :)

Code: Select all

--- pspiofilemgr.h      2005-10-04 09&#58;02&#58;46.546875000 +0200
+++ mypspiofilemgr.h    2005-10-11 00&#58;40&#58;04.859375000 +0200
@@ -44,13 +44,13 @@
  *
  * @par Example1&#58; Open a file for reading
  * @code
- * if&#40;!&#40;fd = sceIoOpen&#40;"device&#58;/path/to/file", O_RDONLY, 0777&#41;&#41; &#123;
+ * if&#40;&#40;fd = sceIoOpen&#40;"device&#58;/path/to/file", O_RDONLY, 0777&#41;<0&#41; &#123;
  *     // error
  * &#125;
  * @endcode
  * @par Example2&#58; Open a file for writing, creating it if it doesnt exist
  * @code
- * if&#40;!&#40;fd = sceIoOpen&#40;"device&#58;/path/to/file", O_WRONLY|O_CREAT, 0777&#41;&#41; &#123;
+ * if&#40;&#40;fd = sceIoOpen&#40;"device&#58;/path/to/file", O_WRONLY|O_CREAT, 0777&#41;<0&#41; &#123;
  *     // error
  * &#125;
  * @endcode
@@ -58,7 +58,7 @@
  * @param file - Pointer to a string holding the name of the file to open
  * @param flags - Libc styled flags that are or'ed together
  * @param mode - File access mode.
- * @return A non-negative integer is a valid fd, anything else an error
+ * @return A non-negative integer is a valid fd, < 0 on error
  */
 SceUID sceIoOpen&#40;const char *file, int flags, SceMode mode&#41;;

@@ -68,7 +68,7 @@
  * @param file - Pointer to a string holding the name of the file to open
  * @param flags - Libc styled flags that are or'ed together
  * @param mode - File access mode.
- * @return A non-negative integer is a valid fd, anything else an error
+ * @return A non-negative integer is a valid fd, < 0 on error
  */
 SceUID sceIoOpenAsync&#40;const char *file, int flags, SceMode mode&#41;;
Paco
Paco
Posts: 54
Joined: Sun Oct 09, 2005 6:53 pm

Post by Paco »

Monkeying around with the fog in Gu, I couldn't get it to work until I negated the near and far parameters. I don't think my math is off but I'm using Left-handed coordinates, so some right-hander might want to double check if the 3d chip has some weirdo requirement from the projection matrix here (like D3D with w-buffering).

Code: Select all

--- sceGuFog.c  2005-10-04 09&#58;02&#58;44.500000000 +0200
+++ mysceGuFog.c        2005-10-12 00&#58;11&#58;43.828125000 +0200
@@ -10,12 +10,12 @@

 void sceGuFog&#40;float near, float far, unsigned int color&#41;
 &#123;
-       float distance = far-near;
+       float distance = near-far;

        if &#40;distance&#41;
                distance = 1.0f / distance;

        sendCommandi&#40;207,color & 0xffffff&#41;;
-       sendCommandf&#40;205,far&#41;;
+       sendCommandf&#40;205,-far&#41;;
        sendCommandf&#40;206,distance&#41;;
 &#125;
or just

Code: Select all

--- sceGuFog.c  2005-10-04 09&#58;02&#58;44.500000000 +0200
+++ mysceGuFog.c        2005-10-12 00&#58;14&#58;24.828125000 +0200
@@ -16,6 +16,6 @@
                distance = 1.0f / distance;

        sendCommandi&#40;207,color & 0xffffff&#41;;
-       sendCommandf&#40;205,far&#41;;
-       sendCommandf&#40;206,distance&#41;;
+       sendCommandf&#40;205,-far&#41;;
+       sendCommandf&#40;206,-distance&#41;;
 &#125;
Paco
Paco
Posts: 54
Joined: Sun Oct 09, 2005 6:53 pm

Post by Paco »

pspaudiolib doesn't support user-specified data for callbacks, which can be a pain for any serious use. Of course this renders existing code unusable, but better now than never. Oh well you lot choose if it's worth it or apps should use a tweaked version of the lib (which is what I do).

Code: Select all

--- pspaudiolib.c	2005-10-04 09&#58;02&#58;18.687500000 +0200
+++ m_pspaudiolib.c	2005-10-12 02&#58;37&#58;33.765625000 +0200
@@ -33,14 +33,17 @@
 
 void pspAudioChannelThreadCallback&#40;int channel, void *buf, unsigned int reqn&#41;
 &#123;
-	void &#40;*callback&#41;&#40;void *buf, unsigned int reqn&#41;;
+	pspAudioCallback_t callback; /* No idea what this is for anyway */
 	callback=AudioStatus&#91;channel&#93;.callback;
 &#125;
 
 
-void pspAudioSetChannelCallback&#40;int channel, void *callback&#41;
+void pspAudioSetChannelCallback&#40;int channel, pspAudioCallback_t callback, void *pdata&#41;
 &#123;
-	AudioStatus&#91;channel&#93;.callback=callback;
+    volatile psp_audio_channelinfo *pci = &AudioStatus&#91;channel&#93;;
+	pci->callback=0;
+	pci->pdata=pdata;
+	pci->callback=callback;
 &#125;
 
 int pspAudioOutBlocking&#40;unsigned int channel, unsigned int vol1, unsigned int vol2, void *buf&#41;
@@ -59,10 +62,10 @@
 	
 	while &#40;audio_terminate==0&#41; &#123;
 		void *bufptr=&audio_sndbuf&#91;channel&#93;&#91;bufidx&#93;;
-		void &#40;*callback&#41;&#40;void *buf, unsigned int reqn&#41;;
+		pspAudioCallback_t callback;
 		callback=AudioStatus&#91;channel&#93;.callback;
 		if &#40;callback&#41; &#123;
-			callback&#40;bufptr, PSP_NUM_AUDIO_SAMPLES&#41;;
+			callback&#40;bufptr, PSP_NUM_AUDIO_SAMPLES, AudioStatus&#91;channel&#93;.pdata&#41;;
 		&#125; else &#123;
 			unsigned int *ptr=bufptr;
 			int i;
@@ -96,6 +99,7 @@
     AudioStatus&#91;i&#93;.volumeright = PSP_VOLUME_MAX;
     AudioStatus&#91;i&#93;.volumeleft  = PSP_VOLUME_MAX;
     AudioStatus&#91;i&#93;.callback = 0;
+    AudioStatus&#91;i&#93;.pdata = 0;
 	&#125;
 	for &#40;i=0; i<PSP_NUM_AUDIO_CHANNELS; i++&#41; &#123;
 		if &#40;&#40;AudioStatus&#91;i&#93;.handle = sceAudioChReserve&#40;-1,PSP_NUM_AUDIO_SAMPLES,0&#41;&#41;<0&#41; 
and

Code: Select all

--- pspaudiolib.h	2005-10-04 09&#58;02&#58;18.546875000 +0200
+++ m_pspaudiolib.h	2005-10-12 02&#58;34&#58;34.500000000 +0200
@@ -22,12 +22,15 @@
 #define PSP_NUM_AUDIO_SAMPLES 1024
 #define PSP_VOLUME_MAX 0x8000
 
+typedef void &#40;* pspAudioCallback_t&#41;&#40;short *buf, unsigned long reqn, void *pdata&#41;;
+
 typedef struct &#123;
   int threadhandle;
   int handle;
   int volumeleft;
   int volumeright;
-  void &#40;*callback&#41;&#40;void *buf, unsigned int reqn&#41;;
+  pspAudioCallback_t callback;
+  void *pdata;
 &#125; psp_audio_channelinfo;
 
 typedef int &#40;* pspAudioThreadfunc_t&#41;&#40;int args, void *argp&#41;;
@@ -38,7 +41,7 @@
 
 void pspAudioSetVolume&#40;int channel, int left, int right&#41;;
 void pspAudioChannelThreadCallback&#40;int channel, void *buf, unsigned int reqn&#41;;
-void pspAudioSetChannelCallback&#40;int channel, void *callback&#41;;
+void pspAudioSetChannelCallback&#40;int channel, pspAudioCallback_t callback, void *pdata&#41;;
 int  pspAudioOutBlocking&#40;unsigned int channel, unsigned int vol1, unsigned int vol2, void *buf&#41;;
 
 #ifdef __cplusplus
Paco
User avatar
Jim
Posts: 476
Joined: Sat Jul 02, 2005 10:06 pm
Location: Sydney
Contact:

Post by Jim »

Can't you add a new call instead of breaking it, eg
void pspAudioSetChannelCallbackEx()

Jim
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

I meant to fix this a long time ago, and the plan was to break pspAudioSetChannelCallback().

Remember PSPSDK is still in beta, so we're allowed to fix mistakes :).

Patch applied. I'll take the heat for anything breaking, and I'll fix what breaks in the immediate vicinity (SVN).
Paco
Posts: 54
Joined: Sun Oct 09, 2005 6:53 pm

Post by Paco »

Cool my first patch! :) I'm curious, why should the callback receive a void* instead of a short*, if the buffer *is* made up of 16-bit signed samples? I ask so I know what the philosophy is and keep it in mind for any further patches. I'm usually quite anal with strong typing and avoiding typecasts whenever I can (10 years of C++ does that to you).

Oh and pspAudioSetChannelCallbackEx() is SO Win32. :)
Paco
Paco
Posts: 54
Joined: Sun Oct 09, 2005 6:53 pm

Post by Paco »

Paco wrote:Monkeying around with the fog in Gu, I couldn't get it to work until I negated the near and far parameters.
When I changed my engine to send right-handed coordinates to the lighting step, fog went back to work as expected. It would seem the arguments to this function are expected to be the negated fognear and fogfar *in view space* (i.e. after modelview and before projection). So if you're using right-handed coordinate system you pass positive values to the original function; if you're using left-handed coordinate system, you need to pass negative values. Most engines expect you to pass *distances* to the fog functions (i.e. positive znear and zfar regardless of your handedness).

As a side note, this would imply that fog is calculated per vertex, not per pixel, and therefore would not be 100% accurate when polygons stride across a fog boundary.

So, again, your choice to change this behaviour. My patched version seems more in line with what the hardware expects of this command, but since the PSP hardware behaves better with right-handed coordinate systems (due to the way it calculates specular lighting, see other thread), the current version of this function would be more intuitive to use. Still, some comment about this in the header might be useful.
Paco
ReJ
Posts: 25
Joined: Sun Apr 04, 2004 12:32 am
Location: Lithuania, Vilnius
Contact:

Post by ReJ »

Fix for signals in pspgu library. GE signals can be used with pspgu API from now on!

Code: Select all

Index&#58; callbackFin.c
===================================================================
--- callbackFin.c	&#40;revision 1157&#41;
+++ callbackFin.c	&#40;working copy&#41;
@@ -10,7 +10,7 @@
 
 void callbackFin&#40;int id, void* arg&#41;
 &#123;
-	GuSettings* settings = &#40;GuSettings*&#41;settings;
+	GuSettings* settings = &#40;GuSettings*&#41;arg;
 	if &#40;settings->fin&#41;
 		settings->fin&#40;id & 0xffff&#41;;
 &#125;
Index&#58; sceGuInit.c
===================================================================
--- sceGuInit.c	&#40;revision 1157&#41;
+++ sceGuInit.c	&#40;working copy&#41;
@@ -52,10 +52,8 @@
 	callback.signal_arg = &gu_settings;
 	callback.finish_func = callbackFin;
 	callback.finish_arg = &gu_settings;
-	gu_settings.ge_callback_id = 0;
-/*
-	gu_settings.ge_callback_id = sceGeSetCallback&#40;&gu_callback&#41;;
-*/
+	gu_settings.ge_callback_id = sceGeSetCallback&#40;&callback&#41;;
+
 	ge_edram_address = sceGeEdramGetAddr&#40;&#41;;
 
 	// initialize graphics hardware
I will update my signals sample with pspgu API support and post it shortly.

EDIT: The sample is here: http://rej.50megs.com/psp/libgu_signals/
Last edited by ReJ on Thu Oct 20, 2005 5:03 am, edited 1 time in total.
chp
Posts: 313
Joined: Wed Jun 23, 2004 7:16 am

Post by chp »

D'oh, what a cheesy mistake I made there. Thanks, I'll patch this asap. :)

EDIT: Ok, changes are in, untested however.
GE Dominator
penfold
Posts: 1
Joined: Thu Jan 19, 2006 6:12 am

Minor typo fix in build.mak and build_prx.mak

Post by penfold »

Doesn't actually fix anything, but hey! ;-)

Code: Select all

Index&#58; src/base/build.mak
===================================================================
--- src/base/build.mak  &#40;revision 1715&#41;
+++ src/base/build.mak  &#40;working copy&#41;
@@ -53,7 +53,7 @@
 
 ifeq &#40;$&#40;USE_KERNEL_LIBC&#41;,1&#41;
 # Use the PSP's kernel libc
-PSPSDL_LIBC_LIB = 
+PSPSDK_LIBC_LIB = 
 CFLAGS &#58;= -I$&#40;PSPSDK&#41;/include/libc $&#40;CFLAGS&#41;
 else
 ifeq &#40;$&#40;USE_PSPSDK_LIBC&#41;,1&#41;


Index&#58; src/base/build_prx.mak
===================================================================
--- src/base/build_prx.mak      &#40;revision 1715&#41;
+++ src/base/build_prx.mak      &#40;working copy&#41;
@@ -36,7 +36,7 @@
 
 ifeq &#40;$&#40;USE_KERNEL_LIBC&#41;,1&#41;
 # Use the PSP's kernel libc
-PSPSDL_LIBC_LIB = 
+PSPSDK_LIBC_LIB = 
 CFLAGS &#58;= -I$&#40;PSPSDK&#41;/include/libc $&#40;CFLAGS&#41;
 else
 ifeq &#40;$&#40;USE_PSPSDK_LIBC&#41;,1&#41;

-penfold
raf
Posts: 57
Joined: Thu Oct 13, 2005 7:38 am

Re: Minor typo fix in build.mak and build_prx.mak

Post by raf »

It was found, as documented in the PRX thread, that the -mno-explicit-relocs CFLAG is required in libraries for PRXs to correctly access global static data (and other?).
For PSPRadio, I patched newlib (absolutely needed to use the flag), pspsdk (not sure if it needs the flag, but it doesn't seem to hurt), zlib, libpng and libmad.

newlib:

Code: Select all

Index&#58; newlib/configure.host
===================================================================
--- newlib/configure.host	&#40;revision 1808&#41;
+++ newlib/configure.host	&#40;working copy&#41;
@@ -574,7 +574,7 @@
 	  mipsallegrex*-psp-*&#41;
 		sys_dir=psp
 		syscall_dir=syscalls
-		newlib_cflags="$&#123;newlib_cflags&#125; -G0 -DCOMPACT_CTYPE -DCLOCK_PROVIDED -DMALLOC_ALIGNMENT=16 -I$&#123;prefix&#125;/psp/sdk/include" ;;
+		newlib_cflags="$&#123;newlib_cflags&#125; -G0 -mno-explicit-relocs -DCOMPACT_CTYPE -DCLOCK_PROVIDED -DMALLOC_ALIGNMENT=16 -I$&#123;prefix&#125;/psp/sdk/include" ;;
 	  *&#41;
 		newlib_cflags="$&#123;newlib_cflags&#125; -DMISSING_SYSCALL_NAMES" ;;
 	esac 
pspsdk:

Code: Select all

Index&#58; pspsdk/configure.ac
===================================================================
--- pspsdk/configure.ac	&#40;revision 1816&#41;
+++ pspsdk/configure.ac	&#40;working copy&#41;
@@ -66,7 +66,7 @@
 AC_SUBST&#40;PSPSDK_LIBDIR&#41;
 
 # CFLAGS and CXXFLAGS used to build pspsdk libraries.
-PSPSDK_CFLAGS="$CFLAGS -G0 -Wall"
+PSPSDK_CFLAGS="$CFLAGS -mno-explicit-relocs -G0 -Wall"
 PSPSDK_CXXFLAGS="$PSPSDK_CFLAGS -fno-exceptions -fno-rtti"
 AC_SUBST&#40;PSPSDK_CFLAGS&#41;
 AC_SUBST&#40;PSPSDK_CXXFLAGS&#41; 
zlib:

Code: Select all

Index&#58; zlib/Makefile
===================================================================
--- zlib/Makefile	&#40;revision 1816&#41;
+++ zlib/Makefile	&#40;working copy&#41;
@@ -4,7 +4,7 @@
 OBJS = 	adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
 	zutil.o inflate.o infback.o inftrees.o inffast.o
 
-CFLAGS = -O2 -G0
+CFLAGS = -O2 -G0 -mno-explicit-relocs
 
 include $&#40;PSPSDK&#41;/lib/build.mak
libpng:

Code: Select all

Index&#58; libpng/Makefile
===================================================================
--- libpng/Makefile	&#40;revision 1816&#41;
+++ libpng/Makefile	&#40;working copy&#41;
@@ -5,7 +5,7 @@
 	pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \
 	pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o
 
-CFLAGS = -O2 -G0
+CFLAGS = -O2 -G0 -mno-explicit-relocs
 
 include $&#40;PSPSDK&#41;/lib/build.mak
libmad: (Also removed 2 compiler warnings by using -DHAVE_ASSERT_H)

Code: Select all

Index&#58; libmad/src/Makefile
===================================================================
--- libmad/src/Makefile	&#40;revision 1816&#41;
+++ libmad/src/Makefile	&#40;working copy&#41;
@@ -5,7 +5,7 @@
 OBJS = bit.o decoder.o fixed.o frame.o huffman.o layer12.o layer3.o \
 	stream.o synth.o timer.o version.o
 
-CFLAGS += -DHAVE_CONFIG_H -DHAVE_SYS_TYPES_H -DHAVE_ERRNO_H -DHAVE_UNISTD_H \
+CFLAGS += -DHAVE_ASSERT_H -G0 -mno-explicit-relocs -DHAVE_CONFIG_H -DHAVE_SYS_TYPES_H -DHAVE_ERRNO_H -DHAVE_UNISTD_H \
 	-DHAVE_FCNTL_H -I$&#40;PSPSDK&#41;/include/sys/  -I../include
 
 include $&#40;PSPSDK&#41;/lib/build.mak 

Hope you can commit these changes, so other developer can start using PRXs. Plus it would relieve me from maintaining patches in PSPRadio.
Other libraries will probably need to be patched as well; I presume.

Thanks!,

Raf.
Renfield
Posts: 2
Joined: Wed Oct 25, 2006 7:33 pm

Patches for SDL_mixer

Post by Renfield »

I hope this is the correct place to post this. Here are two patches that fix SDL_mixer to compile for me.

First, since I already have libmikmod on my system, SDL_mixer's configure finds libmikmod-config and uses that to set up library paths. This patch to configure.in prevents it from using libmikmod-config when host is set to psp.

The second one is to the README.PSP. Since the README.PSP for the SDL package runs configure with --prefix=$(psp-config --psp-prefix), that puts the libSDL library into /usr/local/pspdev/psp/lib, but the SDL_mixer configure line only put /usr/local/pspdev/psp/sdk/lib into LD_FLAGS. Again, for me now SDL_mixer would find the incorrect libSDL in my /usr/lib instead of in the pspdev area.

Code: Select all

58> svn diff configure.in
Index&#58; configure.in
===================================================================
--- configure.in        &#40;revision 2042&#41;
+++ configure.in        &#40;working copy&#41;
@@ -112,7 +112,11 @@
 &#91;  --enable-music-libmikmod  enable MOD music via externl libmikmod &#91;default=yes&#93;&#93;,
               , enable_music_libmikmod=yes&#41;
 if test x$enable_music_libmikmod = xyes; then
-       AC_PATH_PROG&#40;LIBMIKMOD_CONFIG, libmikmod-config, no, &#91;$PATH&#93;&#41;
+       if test x$host_alias = xpsp; then #Don't use the host's libmikmod when building for the PSP.
+               LIBMIKMOD_CONFIG=no
+       else
+               AC_PATH_PROG&#40;LIBMIKMOD_CONFIG, libmikmod-config, no, &#91;$PATH&#93;&#41;
+       fi
        if test "$LIBMIKMOD_CONFIG" = "no" ; then
                no_libmikmod=yes
        else

Code: Select all

61> svn diff README.PSP
Index&#58; README.PSP
===================================================================
--- README.PSP  &#40;revision 2042&#41;
+++ README.PSP  &#40;working copy&#41;
@@ -12,7 +12,7 @@
 To configure&#58;
 
    ./autogen.sh
-   LDFLAGS="-L$&#40;psp-config --pspsdk-path&#41;/lib -lc -lpspuser" \
+   LDFLAGS="-L$&#40;psp-config --pspsdk-path&#41;/lib -L$&#40;psp-config --psp-prefix&#41;/lib -lc -lpspuser" \
      ./configure --host psp --with-sdl-prefix=$&#40;psp-config --psp-prefix&#41; \
      --disable-music-mp3 --prefix=$&#40;psp-config --psp-prefix&#41;
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Re: Patches for SDL_mixer

Post by jimparis »

Renfield wrote:First, since I already have libmikmod on my system, SDL_mixer's configure finds libmikmod-config and uses that to set up library paths. This patch to configure.in prevents it from using libmikmod-config when host is set to psp.
I think the "--enable-music-libmikmod=no" option should have the same effect, could you test that instead? The fewer changes we have to make to the libraries makes it easier if we ever want to update them to newer versions.
The second one is to the README.PSP. Since the README.PSP for the SDL package runs configure with --prefix=$(psp-config --psp-prefix), that puts the libSDL library into /usr/local/pspdev/psp/lib, but the SDL_mixer configure line only put /usr/local/pspdev/psp/sdk/lib into LD_FLAGS. Again, for me now SDL_mixer would find the incorrect libSDL in my /usr/lib instead of in the pspdev area.
Are you sure? The --with-sdl-prefix option should already take care of telling it which SDL to use. Look in acinclude.m4: it uses --with-sdl-prefix to find /usr/local/pspdev/psp/bin/sdl-config, which creates the correct library search path. If that's not working right, could you send a copy of the config.log?
Renfield
Posts: 2
Joined: Wed Oct 25, 2006 7:33 pm

Post by Renfield »

I have found that if I use the --enable-music-libmikmod=no, then nothing is compiled in the mikmod directory. If I use --disable-music-mod, then configure still looks for libmikmod-config, and finds it on my computer. Ultimately I want the MOD functionality for the application I am programming.

I have found also that I need to run --enable-music-wave=no or else when I compile my own application I get this error:

Code: Select all

/usr/local/pspdev/psp/lib/libSDL_mixer.a&#40;wavestream.o&#41;&#58; In function `WAVStream_PlaySome'&#58;
/usr/src/SDL_mixer/wavestream.c&#58;196&#58; undefined reference to `SDL_MixAudio'
/usr/src/SDL_mixer/wavestream.c&#58;196&#58; undefined reference to `SDL_MixAudio'
And finally even after all that when I try to load a mod format audio file from my program I get an error that says "Module format not recognized".

Actually this is probably getting rather off topic. Maybe I should start another topic to address these problems.
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

I just tested it: "--disable-music-libmikmod --enable-music-mod" is the correct way to force use of the included mikmod. I'll add that to the README.PSP.

SDL_MixAudio is defined by libSDL.a. If it's undefined, it's because you have the incorrect link order; verify that -lSDL_mixer comes before the SDL libs on the linker command line.

Yeah, this topic is for submitting new samples, so starting new topics would be more appropriate in the future.
User avatar
Raphael
Posts: 646
Joined: Tue Jan 17, 2006 4:54 pm
Location: Germany
Contact:

Post by Raphael »

Some time ago InsertWittyName noticed some artifacts on fullscreen textures in ortho view. I had some similar problems with some textures in 2D mode too, so we started to wonder what caused that.
After some fiddling with the vertice coordinates and ortho view parameters, that didn't lead to a sufficing solution.
Now IWN found that PSPGL produced correct results with the same ortho setup, so the problem was found pretty soon after: sceGuViewport is wrongly submitting the height parameter.

Here's the patch:

Code: Select all

--- sceGuViewport_old.c	2005-09-28 00&#58;02&#58;16.000000000 +0200
+++ sceGuViewport.c	2006-11-22 21&#58;01&#58;32.281250000 +0100
@@ -11,7 +11,7 @@
 void sceGuViewport&#40;int cx, int cy, int width, int height&#41;
 &#123;
 	sendCommandf&#40;66,&#40;float&#41;&#40;width>>1&#41;&#41;;
-	sendCommandf&#40;67,&#40;float&#41;&#40;&#40;&#40;-height&#41; + &#40;&#40;-height&#41; >> 31&#41;&#41;>>1&#41;&#41;;
+	sendCommandf&#40;67,&#40;float&#41;&#40;&#40;-height&#41;>>1&#41;&#41;;
 	sendCommandf&#40;69,&#40;float&#41;cx&#41;;
 	sendCommandf&#40;70,&#40;float&#41;cy&#41;;
 &#125;
Not sure why chp (?) added that sign bit, maybe a leftover from ps1 coding(?), but it lead to some rare artifacts with textures. Hope the patch is applied soon :)

@chp next time better listen to IWN/Insomniac when he says there's something buggy ;)
<Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki

Alexander Berl
PeterM
Posts: 125
Joined: Sat Dec 31, 2005 7:25 pm
Location: Edinburgh, UK
Contact:

sceGumScale

Post by PeterM »

Hi,

I wanted to check the status of the sceGumScale fix suggested above. I'm using a precompiled SDK for Win32 from http://xorloser.com/ .

AFAIK it uses the SDK from SVN dated 2nd December 2006, but because I don't have the source I can't verify that the above fix is in my version.

The bug I'm seeing is that if I perform the following:

sceGumTranslate
sceGumRotateZ
sceGumRotateY
sceGumRotateX
sceGumScale

The object gets warped and sheared. However if I make up the scaling matrix manually and call sceGumMultMatrix, it's all fine.

I suspect that this is down to sceGumScale either:
1. still having the above bug in it, or
2. being optimised in a way that it doesn't anticipate a rotation being done first.

I hope this post helps anyone who is experiencing the same issue.
http://aaiiee.wordpress.com/

I can no longer do any homebrew PSP development nor discuss PSP specific topics.
Post Reply