Skip to content

Commit 2ecbb9d

Browse files
committed
Fixing remaining magic numbers
1 parent 7f1ca0a commit 2ecbb9d

19 files changed

+142
-97
lines changed

src/display/pspdisplay.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,15 @@ enum PspDisplayPixelFormats {
3131
};
3232

3333
enum PspDisplaySetBufSync {
34-
/** Buffer change effective immediately */
35-
PSP_DISPLAY_SETBUF_IMMEDIATE = 0,
36-
/** Buffer change effective next frame */
37-
PSP_DISPLAY_SETBUF_NEXTFRAME = 1
34+
/** Buffer change effective next hsync */
35+
PSP_DISPLAY_SETBUF_NEXTHSYNC = 0,
36+
/** Buffer change effective next vsync */
37+
PSP_DISPLAY_SETBUF_NEXTVSYNC = 1
3838
};
3939

40+
/** Values for retro compatibility */
41+
#define PSP_DISPLAY_SETBUF_IMMEDIATE PSP_DISPLAY_SETBUF_NEXTHSYNC
42+
#define PSP_DISPLAY_SETBUF_NEXTFRAME PSP_DISPLAY_SETBUF_NEXTVSYNC
4043

4144
enum PspDisplayErrorCodes
4245
{

src/gu/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ libpspgu_a_SOURCES = \
5757
sceGuEnable.c \
5858
sceGuEndObject.c \
5959
sceGuFinish.c \
60+
sceGuFinishId.c \
6061
sceGuFog.c \
6162
sceGuFrontFace.c \
6263
sceGuGetAllStatus.c \

src/gu/guInternal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ extern GuLightSettings light_settings[4];
116116

117117
void callbackSig(int id, void *arg);
118118
void callbackFin(int id, void *arg);
119-
void resetValues();
119+
void _sceGuResetGlobalVariables();
120120

121121
typedef enum GECommand
122122
{

src/gu/pspgu.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,10 @@ void sceGuFog(float near, float far, unsigned int color);
433433
* Initalize the GU system
434434
*
435435
* This function MUST be called as the first function, otherwise state is undetermined.
436+
*
437+
* @return 0 for success, < 0 for failure
436438
**/
437-
void sceGuInit(void);
439+
int sceGuInit(void);
438440

439441
/**
440442
* Shutdown the GU system
@@ -1525,8 +1527,8 @@ void sceGuDrawArrayN(int primitive_type, int vertex_type, int vcount, int primco
15251527
* Set how the display should be set
15261528
*
15271529
* Available behaviours are:
1528-
* - PSP_DISPLAY_SETBUF_IMMEDIATE - Display is swapped immediately
1529-
* - PSP_DISPLAY_SETBUF_NEXTFRAME - Display is swapped on the next frame
1530+
* - PSP_DISPLAY_SETBUF_NEXTHSYNC - Display is swapped on the next hsync
1531+
* - PSP_DISPLAY_SETBUF_NEXTVSYNC - Display is swapped on the next vsync
15301532
*
15311533
* Do remember that this swaps the pointers internally, regardless of setting, so be careful to wait until the next
15321534
* vertical blank or use another buffering algorithm (see guSwapBuffersCallback()).

src/gu/resetValues.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#include "guInternal.h"
1010

11-
void resetValues()
11+
void _sceGuResetGlobalVariables()
1212
{
1313
unsigned int i;
1414

@@ -18,7 +18,7 @@ void resetValues()
1818
gu_current_frame = 0;
1919
gu_object_stack_depth = 0;
2020

21-
gu_display_on = 0;
21+
gu_display_on = GU_FALSE;
2222
gu_call_mode = GU_CALL_NORMAL;
2323

2424
gu_draw_buffer.pixel_size = 1;

src/gu/sceGuColor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010

1111
void sceGuColor(unsigned int color)
1212
{
13-
sceGuMaterial(7,color);
13+
sceGuMaterial(GU_AMBIENT | GU_DIFFUSE | GU_SPECULAR, color);
1414
}

src/gu/sceGuDisable.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,6 @@ void sceGuDisable(int state)
8989
break;
9090
}
9191

92-
if (state < 22)
92+
if (state < GU_MAX_STATUS)
9393
gu_states &= ~(1 << state);
9494
}

src/gu/sceGuDispBuffer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ void sceGuDispBuffer(int width, int height, void *dispbp, int dispbw)
3030
sceDisplaySetMode(0, gu_draw_buffer.width, gu_draw_buffer.height);
3131

3232
if (gu_display_on)
33-
sceDisplaySetFrameBuf((void *)(((unsigned int)ge_edram_address) + ((unsigned int)gu_draw_buffer.disp_buffer)), dispbw, gu_draw_buffer.pixel_size, PSP_DISPLAY_SETBUF_NEXTFRAME);
33+
sceDisplaySetFrameBuf((void *)(((unsigned int)ge_edram_address) + ((unsigned int)gu_draw_buffer.disp_buffer)), dispbw, gu_draw_buffer.pixel_size, PSP_DISPLAY_SETBUF_NEXTVSYNC);
3434
}

src/gu/sceGuDisplay.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313

1414
int sceGuDisplay(int state)
1515
{
16-
if (state)
17-
sceDisplaySetFrameBuf((void*)((unsigned int)ge_edram_address+(unsigned int)gu_draw_buffer.disp_buffer),gu_draw_buffer.frame_width,gu_draw_buffer.pixel_size,PSP_DISPLAY_SETBUF_NEXTFRAME);
16+
if (state == GU_TRUE)
17+
sceDisplaySetFrameBuf((void *)((unsigned int)ge_edram_address + (unsigned int)gu_draw_buffer.disp_buffer), gu_draw_buffer.frame_width, gu_draw_buffer.pixel_size, PSP_DISPLAY_SETBUF_NEXTVSYNC);
1818
else
19-
sceDisplaySetFrameBuf(0,0,0,PSP_DISPLAY_SETBUF_NEXTFRAME);
19+
sceDisplaySetFrameBuf(NULL, 0, 0, PSP_DISPLAY_SETBUF_NEXTVSYNC);
2020

2121
gu_display_on = state;
2222
return state;

src/gu/sceGuEnable.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,6 @@ void sceGuEnable(int state)
8989
break;
9090
}
9191

92-
if (state < 22)
92+
if (state < GU_MAX_STATUS)
9393
gu_states |= (1 << state);
9494
}

0 commit comments

Comments
 (0)