@@ -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+
237290void 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