@@ -114,8 +114,6 @@ async function checkAndSetupEnvironment() {
114114 saveConfig ( config ) ;
115115 console . log ( 'PlayStation 1 development environment already set up with included tools' ) ;
116116
117- // Ensure the Hello World template is created
118- await createHelloWorldTemplate ( ) ;
119117 return ;
120118 }
121119
@@ -187,9 +185,6 @@ async function setupEnvironment(isManualSetup = false) {
187185 config . tools . gdb = { installed : true } ;
188186 saveConfig ( config ) ;
189187
190- // Ensure the Hello World template is created
191- await createHelloWorldTemplate ( ) ;
192-
193188 vscode . window . showInformationMessage ( 'Tools already included in the plugin. Environment configured successfully!' ) ;
194189 return ;
195190 }
@@ -246,150 +241,13 @@ async function setupEnvironment(isManualSetup = false) {
246241 // Save the configuration
247242 saveConfig ( config ) ;
248243
249- // Create the Hello World template
250- await createHelloWorldTemplate ( ) ;
251-
252244 if ( downloadSuccess ) {
253245 vscode . window . showInformationMessage ( 'PlayStation 1 development environment setup complete!' ) ;
254246 } else {
255247 vscode . window . showErrorMessage ( 'Failed to set up PlayStation 1 development environment. Check the logs for details.' ) ;
256248 }
257249}
258250
259- // Function to create a Hello World template
260- async function createHelloWorldTemplate ( ) {
261- const helloWorldPath = path . join ( templatesPath , 'hello-world' ) ;
262- await ensureDirectoryExists ( helloWorldPath ) ;
263-
264- // Check if the template files already exist
265- const mainCPath = path . join ( helloWorldPath , 'main.c' ) ;
266- const makefilePath = path . join ( helloWorldPath , 'Makefile' ) ;
267- const setupMkPath = path . join ( helloWorldPath , 'setup.mk' ) ;
268-
269- if ( fs . existsSync ( mainCPath ) && fs . existsSync ( makefilePath ) && fs . existsSync ( setupMkPath ) ) {
270- console . log ( 'Hello World template already exists' ) ;
271- return ;
272- }
273-
274- // Create main.c
275- const mainCContent = `
276- #include <stdio.h>
277- #include <stdlib.h>
278- #include <psx.h>
279- #include <sys/types.h>
280- #include <psxgpu.h>
281- #include <psxgte.h>
282- #include <psxpad.h>
283-
284- // Define display/drawing environments
285- DISPENV disp;
286- DRAWENV draw;
287-
288- int main() {
289- // Initialize the PlayStation
290- PSX_Init();
291-
292- // Set up the display and drawing environments for NTSC mode
293- SetDefDispEnv(&disp, 0, 0, 320, 240);
294- SetDefDrawEnv(&draw, 0, 0, 320, 240);
295-
296- // Set the background color to black
297- setRGB0(&draw, 0, 0, 0);
298- draw.isbg = 1;
299-
300- // Apply the environments
301- PutDispEnv(&disp);
302- PutDrawEnv(&draw);
303-
304- // Set the text color to white
305- FntLoad(960, 0);
306- SetDumpFnt(FntOpen(16, 16, 320, 240, 0, 512));
307-
308- // Main loop
309- while(1) {
310- // Clear the display
311- ClearImage(&draw.clip, 0, 0, 0);
312-
313- // Print the Hello World message
314- FntPrint("Hello, PlayStation World!\\n");
315- FntFlush(-1);
316-
317- // Swap buffers
318- DrawSync(0);
319- VSync(0);
320- PutDispEnv(&disp);
321- PutDrawEnv(&draw);
322- }
323-
324- return 0;
325- }
326- ` ;
327- fs . writeFileSync ( mainCPath , mainCContent ) ;
328-
329- // Create Makefile
330- const makefileContent = `
331- # PlayStation 1 Hello World Makefile
332-
333- # Include setup.mk for paths and compiler settings
334- include setup.mk
335-
336- TARGET = hello_world
337-
338- OBJS = main.o
339-
340- all: $(TARGET).ps-exe
341-
342- $(TARGET).ps-exe: $(OBJS)
343- $(CC) $(LIBDIRS) -o $@ $^ -lpsxgpu -lpsxgte -lpsxpad
344-
345- %.o: %.c
346- $(CC) $(INCLUDE) -c $< -o $@
347-
348- clean:
349- rm -f $(OBJS) $(TARGET).ps-exe
350- ` ;
351- fs . writeFileSync ( makefilePath , makefileContent ) ;
352-
353- // Create setup.mk
354- const setupMkContent = `
355- # PSn00bSDK setup file
356- # This file will be automatically updated by the extension with the correct paths
357- # Do not modify the $(GCC_PATH), $(PLUGIN_SDK_PATH), and $(EMULATOR_PATH) variables
358-
359- # Paths - The extension will replace these variables with the correct paths
360- PREFIX = mipsel-none-elf-
361- PSN00B_BASE = $(PLUGIN_SDK_PATH)
362-
363- PSN00B_LIB = $(PSN00B_BASE)/lib
364- PSN00B_INCLUDE = $(PSN00B_BASE)/include
365- GCC_BASE = $(GCC_PATH)
366-
367- LIBDIRS = -L$(PSN00B_LIB)
368- INCLUDE = -I$(PSN00B_INCLUDE)
369-
370- ELF2X = $(PSN00B_BASE)/bin/elf2x
371- MKPSXISO = $(PSN00B_BASE)/bin/mkpsxiso
372- EMULATOR_DIR = $(EMULATOR_PATH)
373-
374- GCC_BIN = $(GCC_BASE)/bin/
375-
376- CC = $(GCC_BIN)$(PREFIX)gcc
377- CXX = $(GCC_BIN)$(PREFIX)g++
378- AS = $(GCC_BIN)$(PREFIX)as
379- AR = $(GCC_BIN)$(PREFIX)ar
380- RANLIB = $(GCC_BIN)$(PREFIX)ranlib
381- LD = $(GCC_BIN)$(PREFIX)ld
382-
383- # Folders - Directories for output files
384- MKPSXISO_XML = cd.xml
385- BIN_FOLDER = bin
386- ISO_FOLDER = iso
387- ` ;
388- fs . writeFileSync ( setupMkPath , setupMkContent ) ;
389-
390- console . log ( 'Hello World template created successfully' ) ;
391- }
392-
393251// Function to create a Hello World project
394252async function createHelloWorld ( ) {
395253 // Get the workspace folder
0 commit comments