Skip to content

Commit be9540d

Browse files
authored
Merge pull request #301 from fjtrujy/sceGuResetGlobalVariables
Make fully private the `sceGuResetGlobalVariables`
2 parents 86a30fb + b03dd2a commit be9540d

File tree

4 files changed

+54
-65
lines changed

4 files changed

+54
-65
lines changed

src/gu/Makefile.am

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ noinst_HEADERS = guInternal.h
1818

1919
libpspgu_a_SOURCES = \
2020
guInternal.c \
21-
resetValues.c \
2221
sceGuAlphaFunc.c \
2322
sceGuAmbient.c \
2423
sceGuAmbientColor.c \

src/gu/guInternal.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ extern int gu_object_stack_depth;
8282

8383
void callbackSig(int id, void *arg);
8484
void callbackFin(int id, void *arg);
85-
void _sceGuResetGlobalVariables();
8685

8786
typedef enum GECommand
8887
{

src/gu/resetValues.c

Lines changed: 0 additions & 62 deletions
This file was deleted.

src/gu/sceGuInit.c

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,59 @@ static unsigned int __attribute__((aligned(16))) ge_init_list[] = {
234234
ZV(END),
235235
};
236236

237+
static void sceGuResetGlobalVariables(void)
238+
{
239+
unsigned int i;
240+
241+
gu_init = 0;
242+
243+
gu_states = 0;
244+
gu_object_stack_depth = 0;
245+
246+
gu_display_on = GU_DISPLAY_OFF;
247+
gu_call_mode = GU_CALL_NORMAL;
248+
249+
gu_draw_buffer.pixel_size = GU_PSM_5551;
250+
gu_draw_buffer.frame_width = GU_SCR_WIDTH;
251+
gu_draw_buffer.frame_buffer = 0;
252+
gu_draw_buffer.disp_buffer = 0;
253+
gu_draw_buffer.depth_buffer = 0;
254+
gu_draw_buffer.depth_width = 0;
255+
gu_draw_buffer.width = GU_SCR_WIDTH;
256+
gu_draw_buffer.height = GU_SCR_HEIGHT;
257+
258+
for (i = 0; i < 3; ++i)
259+
{
260+
GuContext* context = &gu_contexts[i];
261+
262+
context->scissor_enable = 0;
263+
context->scissor_start[0] = 0;
264+
context->scissor_start[1] = 0;
265+
context->scissor_end[0] = 0;
266+
context->scissor_end[1] = 0;
267+
268+
context->near_plane = 0;
269+
context->far_plane = 1;
270+
271+
context->depth_offset = 0;
272+
context->fragment_2x = 0;
273+
context->texture_function = 0;
274+
context->texture_proj_map_mode = 0;
275+
context->texture_map_mode = 0;
276+
context->sprite_mode[0] = 0;
277+
context->sprite_mode[1] = 0;
278+
context->sprite_mode[2] = 0;
279+
context->sprite_mode[3] = 0;
280+
context->clear_color = 0;
281+
context->clear_stencil = 0;
282+
context->clear_depth = 0xffff;
283+
context->texture_mode = 0;
284+
}
285+
286+
gu_settings.sig = NULL;
287+
gu_settings.fin = NULL;
288+
}
289+
237290
void callbackFin(int id, void *arg)
238291
{
239292
GuSettings *settings = (GuSettings *)arg;
@@ -259,7 +312,7 @@ int sceGuInit(void)
259312
PspGeCallbackData callback;
260313

261314
ge_edram_address = sceGeEdramGetAddr();
262-
_sceGuResetGlobalVariables();
315+
sceGuResetGlobalVariables();
263316

264317
res = sceKernelCreateEventFlag("SceGuSignal", PSP_EVENT_WAITMULTIPLE, 3, 0);
265318
if (res < 0)

0 commit comments

Comments
 (0)