The last thing was yesterday, when I suddenly had a single sceGuSync(0,0) call freeze my application for no apparent reason.
Until I just added a sceGuFinish() call before the sync and it worked as normal, so I dug further into why that would happen.
After some trying, I found that sceGuSync(0,2) would solve my problem without having to finish the current display list.
Other than that, I also fiddled a little with the mipmap level mode function and found about it's first parameter, which sets the mipmap mode to auto, constant or user slope (using sceGuTexSlope). The second parameter, obviously is a mipmap bias.
I also added description to the sceGuClutMode functions second and third parameters, which are a shift and mask (as was already stated somewhere quite some time ago IIRC). Still haven't found out about the last parameter though :/
Well, here's the patch to be applied within src/gu
Code: Select all
Index: sceGuClutMode.c
===================================================================
--- sceGuClutMode.c (revision 2259)
+++ sceGuClutMode.c (working copy)
@@ -8,8 +8,8 @@
#include "guInternal.h"
-void sceGuClutMode(unsigned int cpsm, unsigned int a1, unsigned int a2, unsigned int a3)
+void sceGuClutMode(unsigned int cpsm, unsigned int shift, unsigned int mask, unsigned int a3)
{
- unsigned int argument = (cpsm) | (a1 << 2) | (a2 << 8) | (a3 << 16);
+ unsigned int argument = (cpsm) | (shift << 2) | (mask << 8) | (a3 << 16);
sendCommandi(197,argument);
}
Index: sceGuSync.c
===================================================================
--- sceGuSync.c (revision 2259)
+++ sceGuSync.c (working copy)
@@ -11,11 +11,11 @@
#include <pspkernel.h>
#include <pspge.h>
-int sceGuSync(int mode, int a1)
+int sceGuSync(int mode, int what)
{
switch (mode)
{
- case 0: return sceGeDrawSync(a1); break;
+ case 0: return sceGeDrawSync(what); break;
case 3: return sceGeDrawSync(ge_list_executed[0]);
case 4: return sceGeDrawSync(ge_list_executed[1]);
default: case 1: case 2: return 0;
Index: pspgu.h
===================================================================
--- pspgu.h (revision 2259)
+++ pspgu.h (working copy)
@@ -168,6 +168,11 @@
#define GU_TEXTURE_MATRIX (1)
#define GU_ENVIRONMENT_MAP (2)
+/* Texture Level Mode */
+#define GU_TEXTURE_AUTO (0)
+#define GU_TEXTURE_CONST (1)
+#define GU_TEXTURE_SLOPE (2)
+
/* Texture Projection Map Mode */
#define GU_POSITION (0)
#define GU_UV (1)
@@ -262,6 +267,11 @@
#define GU_TAIL (0)
#define GU_HEAD (1)
+/* Sync behavior */
+#define GU_SYNC_FINISH (0)
+#define GU_SYNC_SIGNAL (1)
+#define GU_SYNC_DONE (2)
+
/* Signals */
#define GU_CALLBACK_SIGNAL (1)
#define GU_CALLBACK_FINISH (4)
@@ -538,7 +548,7 @@
* - GU_TAIL - Place list last in the queue, so it executes in-order
* - GU_HEAD - Place list first in queue so that it executes as soon as possible
*
- * @param mode - Wether to place the list first or last in queue
+ * @param mode - Whether to place the list first or last in queue
* @param list - List to send
* @param context - Temporary storage for the GE context
**/
@@ -559,11 +569,20 @@
* sceGuSync(0,0);
* @endcode
*
- * @param mode - Unknown meaning, pass 0 for now
- * @param a1 - Unknown meaning, pass 0 for now
+ * Available modes are:
+ * - GU_SYNC_WAIT
+ * - GU_SYNC_NOWAIT
+ *
+ * Available what are:
+ * - GU_SYNC_FINISH - Wait until the last sceGuFinish command is reached
+ * - GU_SYNC_SIGNAL - Wait until the last (?) signal is executed
+ * - GU_SYNC_DONE - Wait until all commands currently in list are executed
+ *
+ * @param mode - Whether to wait or not
+ * @param what - What to sync to
* @returns Unknown at this time
**/
-int sceGuSync(int mode, int a1);
+int sceGuSync(int mode, int what);
/**
* Draw array of vertices forming primitives
@@ -1160,9 +1179,21 @@
* @param tbp - Texture buffer pointer (16 byte aligned)
**/
void sceGuTexImage(int mipmap, int width, int height, int tbw, const void* tbp);
-void sceGuTexLevelMode(unsigned int a0, float f12);
/**
+ * Set texture-level mode (mipmapping)
+ *
+ * Available modes are:
+ * - GU_TEXTURE_AUTO
+ * - GU_TEXTURE_CONST
+ * - GU_TEXTURE_SLOPE
+ *
+ * @param mode - Which mode to use
+ * @param bias - Which mipmap bias to use
+**/
+void sceGuTexLevelMode(unsigned int mode, float bias);
+
+/**
* Set the texture-mapping mode
*
* Available modes are:
@@ -1270,11 +1301,11 @@
* - GU_PSM_8888
*
* @param cpsm - Which pixel format to use for the palette
- * @param a1 - Unknown, set to 0
- * @param a2 - Unknown, set to 0
+ * @param shift - Shifts color index by that many bits to the right
+ * @param mask - Masks the color index with this bitmask after the shift (0-0xFF)
* @param a3 - Unknown, set to 0
**/
-void sceGuClutMode(unsigned int cpsm, unsigned int a1, unsigned int a2, unsigned int a3);
+void sceGuClutMode(unsigned int cpsm, unsigned int shift, unsigned int mask, unsigned int a3);
/**
* Set virtual coordinate offset
Index: sceGuTexLevelMode.c
===================================================================
--- sceGuTexLevelMode.c (revision 2259)
+++ sceGuTexLevelMode.c (working copy)
@@ -10,9 +10,9 @@
#include <math.h>
-void sceGuTexLevelMode(unsigned int a0, float f12)
+void sceGuTexLevelMode(unsigned int mode, float bias)
{
- int offset = (int)truncf(f12 * 16.0f);
+ int offset = (int)truncf(bias * 16.0f);
// mip map bias?
if (offset >= 128)
@@ -20,5 +20,5 @@
else if (offset < -128)
offset = -128;
- sendCommandi(200,(((unsigned int)(offset)) << 16) | a0);
+ sendCommandi(200,(((unsigned int)(offset)) << 16) | mode);
}