From c0d5fafb98c2c0a172ff828f1abca6c39b930e96 Mon Sep 17 00:00:00 2001
From: Francisco Javier Trujillo Mata <fjtrujy@gmail.com>
Date: Mon, 9 Sep 2024 22:52:22 +0200
Subject: [PATCH 1/5] Remove the usage of gskit

---
 examples/performance/Makefile        | 4 ++--
 examples/performance/performance.cpp | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/examples/performance/Makefile b/examples/performance/Makefile
index 5d04fa7..31f35ec 100644
--- a/examples/performance/Makefile
+++ b/examples/performance/Makefile
@@ -2,8 +2,8 @@ EE_BIN       = performance.elf
 EE_CFLAGS   := -I$(PS2SDK)/ports/include -I../shared_code/ $(EE_CFLAGS)
 EE_CXXFLAGS := -I$(PS2SDK)/ports/include -I../shared_code/ $(EE_CXXFLAGS)
 EE_OBJS      = performance.o ../shared_code/text_stuff.o
-EE_LDFLAGS  += -L$(PS2SDK)/ports/lib -L$(PS2DEV)/gsKit/lib
-EE_LIBS      = -lps2glut -lps2gl -lps2stuff -lpad -ldma -lgs -lpacket -lgraph -lgskit -ldmakit
+EE_LDFLAGS  += -L$(PS2SDK)/ports/lib
+EE_LIBS      = -lps2glut -lps2gl -lps2stuff -lpad -ldma -lgs -lpacket -lgraph
 
 ifeq ($(DEBUG), 1)
     EE_CFLAGS   += -D_DEBUG
diff --git a/examples/performance/performance.cpp b/examples/performance/performance.cpp
index d1399c6..71556c6 100644
--- a/examples/performance/performance.cpp
+++ b/examples/performance/performance.cpp
@@ -571,6 +571,8 @@ void display(void)
     //     printf("\n");
 
     display_ticks = timer1->GetTicks();
+
+    glutSwapBuffers();
 }
 
 void perspective(float fov, float aspect, float nearClip, float farClip)

From e87743f79d0723f53399805c947aa44221cb763a Mon Sep 17 00:00:00 2001
From: Francisco Javier Trujillo Mata <fjtrujy@gmail.com>
Date: Mon, 9 Sep 2024 21:21:54 +0200
Subject: [PATCH 2/5] Fix folders usage

---
 examples/logo/logo.cpp               | 23 ++++++++++-------------
 examples/shared_code/file_ops.h      | 21 ---------------------
 examples/tricked_out/tricked_out.cpp |  3 +--
 3 files changed, 11 insertions(+), 36 deletions(-)
 delete mode 100644 examples/shared_code/file_ops.h

diff --git a/examples/logo/logo.cpp b/examples/logo/logo.cpp
index b8d3705..ee63ae7 100644
--- a/examples/logo/logo.cpp
+++ b/examples/logo/logo.cpp
@@ -14,9 +14,6 @@
 #include "GL/gl.h"
 #include "GL/glut.h"
 
-// in 'shared_code'
-#include "file_ops.h"
-
 #include "ps2glmesh.h"
 
 /********************************************
@@ -128,8 +125,8 @@ void init_models(void)
     // ps2
 
     ps2_list = glGenLists(7);
-    mesh     = LoadMesh(FILE_PREFIX "ps2.gl");
-    LoadRTexFile(FILE_PREFIX "plywd_b.rtx", tex_ids[0]);
+    mesh     = LoadMesh("ps2.gl");
+    LoadRTexFile("plywd_b.rtx", tex_ids[0]);
     glNewList(ps2_list, GL_COMPILE);
     {
         glPushMatrix();
@@ -142,8 +139,8 @@ void init_models(void)
     // gl
 
     gl_list = ps2_list + 1;
-    mesh    = LoadMesh(FILE_PREFIX "gl.gl");
-    LoadRTexFile(FILE_PREFIX "plywd_y.rtx", tex_ids[1]);
+    mesh    = LoadMesh("gl.gl");
+    LoadRTexFile("plywd_y.rtx", tex_ids[1]);
     glNewList(gl_list, GL_COMPILE);
     {
         glBindTexture(GL_TEXTURE_2D, tex_ids[1]);
@@ -154,8 +151,8 @@ void init_models(void)
     // wet paint
 
     wet_list = ps2_list + 2;
-    mesh     = LoadMesh(FILE_PREFIX "note.gl");
-    LoadRTexFile(FILE_PREFIX "wetpaint.rtx", tex_ids[2]);
+    mesh     = LoadMesh("note.gl");
+    LoadRTexFile("wetpaint.rtx", tex_ids[2]);
     glNewList(wet_list, GL_COMPILE);
     {
         glBindTexture(GL_TEXTURE_2D, tex_ids[2]);
@@ -167,7 +164,7 @@ void init_models(void)
     // circle
 
     circle_list = ps2_list + 3;
-    mesh        = LoadMesh(FILE_PREFIX "cir.gl");
+    mesh        = LoadMesh("cir.gl");
     glNewList(circle_list, GL_COMPILE);
     {
         DrawMesh(mesh);
@@ -177,7 +174,7 @@ void init_models(void)
     // square
 
     square_list = ps2_list + 4;
-    mesh        = LoadMesh(FILE_PREFIX "sq.gl");
+    mesh        = LoadMesh("sq.gl");
     glNewList(square_list, GL_COMPILE);
     {
         DrawMesh(mesh);
@@ -187,7 +184,7 @@ void init_models(void)
     // triangle
 
     tri_list = ps2_list + 5;
-    mesh     = LoadMesh(FILE_PREFIX "tri.gl");
+    mesh     = LoadMesh("tri.gl");
     glNewList(tri_list, GL_COMPILE);
     {
         DrawMesh(mesh);
@@ -197,7 +194,7 @@ void init_models(void)
     // x
 
     x_list = ps2_list + 6;
-    mesh   = LoadMesh(FILE_PREFIX "x.gl");
+    mesh   = LoadMesh("x.gl");
     glNewList(x_list, GL_COMPILE);
     {
         DrawMesh(mesh);
diff --git a/examples/shared_code/file_ops.h b/examples/shared_code/file_ops.h
deleted file mode 100644
index 6fc53c8..0000000
--- a/examples/shared_code/file_ops.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*	  Copyright (C) 2000,2001,2002  Sony Computer Entertainment America
-
-       	  This file is subject to the terms and conditions of the GNU Lesser
-	  General Public License Version 2.1. See the file "COPYING" in the
-	  main directory of this archive for more details.                             */
-
-#ifndef file_ops_h
-#define file_ops_h
-
-#include "stdio.h"
-#ifdef CDROM
-#define FILE_PREFIX "cdrom0:"
-#define FILE_SEP '\\'
-#define FILE_TERM ";1"
-#else
-#define FILE_PREFIX "host0:"
-#define FILE_SEP '/'
-#define FILE_TERM ""
-#endif
-
-#endif // file_ops_h
diff --git a/examples/tricked_out/tricked_out.cpp b/examples/tricked_out/tricked_out.cpp
index 0a4718b..06cc93d 100644
--- a/examples/tricked_out/tricked_out.cpp
+++ b/examples/tricked_out/tricked_out.cpp
@@ -18,7 +18,6 @@
 #include "ps2s/eetimer.h"
 #include "ps2s/math.h"
 
-#include "file_ops.h"
 #include "text_stuff.h"
 
 #include "billboard_renderer.h"
@@ -189,7 +188,7 @@ void init_billboards()
 void load_bb_texture()
 {
     // the texture file is just an rgba image with no header info
-    int tex_fd = open(FILE_PREFIX "car.bin", O_RDONLY);
+    int tex_fd = open("car.bin", O_RDONLY);
     assert(tex_fd != -1);
 
     int image_size = 128 * 128 * 4; // 128x128 32-bit image

From df5a5856c91e81081ed0a553c1018ddf051ad00e Mon Sep 17 00:00:00 2001
From: Francisco Javier Trujillo Mata <fjtrujy@gmail.com>
Date: Mon, 9 Sep 2024 21:12:12 +0200
Subject: [PATCH 3/5] Update workflow

---
 .github/workflows/compilation.yml | 7 ++++---
 glut/Makefile                     | 4 ++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/compilation.yml b/.github/workflows/compilation.yml
index a7c3cbe..bbbe344 100644
--- a/.github/workflows/compilation.yml
+++ b/.github/workflows/compilation.yml
@@ -9,9 +9,9 @@ on:
 jobs:
   build:
     runs-on: ubuntu-latest
-    container: ps2dev/ps2sdk-ports:latest
+    container: ps2dev/ps2sdk:latest
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     
     - name: Install dependencies
       run: |
@@ -43,6 +43,7 @@ jobs:
         cd examples
         cd box && make clean all && cd ..
         cd logo && make clean all && cd ..
+        cd performance && make clean all && cd ..
         cd tricked_out && make clean all && cd ..
         cd nehe/lesson02 && make clean all && cd ../..
         cd nehe/lesson03 && make clean all && cd ../..
@@ -51,7 +52,7 @@ jobs:
 
 
     - name: Upload artifacts
-      uses: actions/upload-artifact@v3
+      uses: actions/upload-artifact@v4
       with:
         name: examples
         path: |
diff --git a/glut/Makefile b/glut/Makefile
index 0109b39..7587e6a 100644
--- a/glut/Makefile
+++ b/glut/Makefile
@@ -1,7 +1,7 @@
 EE_LIB = libps2glut.a
 
-EE_LDFLAGS  += -L. -L$(PS2SDK)/ports/lib -L$(PS2DEV)/gsKit/lib
-EE_INCS     += -I./include -I$(PS2SDK)/ports/include -I$(PS2DEV)/gsKit/include
+EE_LDFLAGS  += -L. -L$(PS2SDK)/ports/lib
+EE_INCS     += -I./include -I$(PS2SDK)/ports/include
 
 ifeq ($(DEBUG), 1)
     EE_CFLAGS   += -D_DEBUG

From d5ea6e215e19441cc4c4853fdeeb9ab790e8877d Mon Sep 17 00:00:00 2001
From: Francisco Javier Trujillo Mata <fjtrujy@gmail.com>
Date: Mon, 9 Sep 2024 20:38:53 +0200
Subject: [PATCH 4/5] Avoid passing wrong parameters in logo example to
 glutInit

---
 examples/logo/logo.cpp | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/examples/logo/logo.cpp b/examples/logo/logo.cpp
index ee63ae7..47f3826 100644
--- a/examples/logo/logo.cpp
+++ b/examples/logo/logo.cpp
@@ -76,12 +76,7 @@ GLint ps2_list, gl_list, wet_list, circle_list, tri_list, square_list, x_list;
 
 int main(int argc, char** argv)
 {
-    int dummy_argc         = 1;
-    char iop_module_path[] = "iop_module_path=host0:/usr/local/sce/iop/modules";
-    char* dummy_argv[1];
-    dummy_argv[0] = iop_module_path;
-
-    glutInit(&dummy_argc, (char**)dummy_argv);
+    glutInit(&argc, argv);
     glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
     glutCreateWindow(argv[0]);
 

From edc309b6b8181a4227547f2077fa05fad5643ca5 Mon Sep 17 00:00:00 2001
From: Francisco Javier Trujillo Mata <fjtrujy@gmail.com>
Date: Mon, 9 Sep 2024 22:59:13 +0200
Subject: [PATCH 5/5] Avoid running display twice in idle function

---
 examples/nehe/lesson04/lesson4.cpp | 5 ++++-
 examples/nehe/lesson05/lesson5.cpp | 6 +++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/examples/nehe/lesson04/lesson4.cpp b/examples/nehe/lesson04/lesson4.cpp
index 7923db9..2b44825 100644
--- a/examples/nehe/lesson04/lesson4.cpp
+++ b/examples/nehe/lesson04/lesson4.cpp
@@ -35,6 +35,9 @@ void init(GLvoid) // Create Some Everyday Functions
     glEnable(GL_LIGHT0);
 }
 
+void idle(void) {
+}
+
 void display(void)                                      // Create The Display Function
 {
     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer
@@ -92,7 +95,7 @@ int main(int argc, char **argv)                  // Create Main Function For Bri
     glutCreateWindow("NeHe's OpenGL Framework"); // Window Title (argv[0] for current directory as title)
     glutDisplayFunc(display);                    // Matching Earlier Functions To Their Counterparts
     glutReshapeFunc(reshape);
-    glutIdleFunc(display);
+    glutIdleFunc(idle);
     glutMainLoop(); // Initialize The Main Loop
 
     return 0;
diff --git a/examples/nehe/lesson05/lesson5.cpp b/examples/nehe/lesson05/lesson5.cpp
index 17e0e59..7edaa08 100644
--- a/examples/nehe/lesson05/lesson5.cpp
+++ b/examples/nehe/lesson05/lesson5.cpp
@@ -35,6 +35,10 @@ void InitGL(GLvoid) // Create Some Everyday Functions
     glEnable(GL_LIGHT0);
 }
 
+void idle(void) {
+    
+}
+
 void display(void)                                      // Create The Display Function
 {
     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer
@@ -143,7 +147,7 @@ int main(int argc, char **argv)                   // Create Main Function For Br
     InitGL();
     glutDisplayFunc(display);                     // Matching Earlier Functions To Their Counterparts
     glutReshapeFunc(reshape);
-    glutIdleFunc(display);
+    glutIdleFunc(idle);
     glutMainLoop(); // Initialize The Main Loop
 
     return 0;