From 820720cffe52450fee9e26af0de20caad324c1c6 Mon Sep 17 00:00:00 2001 From: scawful Date: Sun, 28 Sep 2025 00:37:48 -0400 Subject: [PATCH] Remove obsolete PowerShell script for generating Visual Studio projects and add a new script for testing PowerShell syntax. The new script verifies basic constructs used in build scripts, ensuring proper syntax and functionality. --- scripts/generate-vs-projects-fixed.ps1 | 533 ------------------------- scripts/test-powershell-syntax.ps1 | 31 ++ 2 files changed, 31 insertions(+), 533 deletions(-) delete mode 100644 scripts/generate-vs-projects-fixed.ps1 create mode 100644 scripts/test-powershell-syntax.ps1 diff --git a/scripts/generate-vs-projects-fixed.ps1 b/scripts/generate-vs-projects-fixed.ps1 deleted file mode 100644 index 1ca969f2..00000000 --- a/scripts/generate-vs-projects-fixed.ps1 +++ /dev/null @@ -1,533 +0,0 @@ -# PowerShell script to generate proper Visual Studio project files for YAZE -# This script creates a comprehensive .vcxproj file with all necessary source files - -param( - [string]$ProjectRoot = ".", - [string]$OutputDir = "." -) - -$ErrorActionPreference = "Stop" - -Write-Host "Generating Visual Studio project files for YAZE..." -ForegroundColor Green - -# Source file lists (from CMake files) -$AppCoreSrc = @( - "app/core/controller.cc", - "app/emu/emulator.cc", - "app/core/project.cc", - "app/core/window.cc", - "app/core/asar_wrapper.cc", - "app/core/platform/font_loader.cc", - "app/core/platform/clipboard.cc", - "app/core/platform/file_dialog.cc" -) - -$AppEmuSrc = @( - "app/emu/audio/apu.cc", - "app/emu/audio/spc700.cc", - "app/emu/audio/dsp.cc", - "app/emu/audio/internal/addressing.cc", - "app/emu/audio/internal/instructions.cc", - "app/emu/cpu/internal/addressing.cc", - "app/emu/cpu/internal/instructions.cc", - "app/emu/cpu/cpu.cc", - "app/emu/video/ppu.cc", - "app/emu/memory/dma.cc", - "app/emu/memory/memory.cc", - "app/emu/snes.cc" -) - -$AppEditorSrc = @( - "app/editor/editor_manager.cc", - "app/editor/dungeon/dungeon_editor.cc", - "app/editor/dungeon/dungeon_room_selector.cc", - "app/editor/dungeon/dungeon_canvas_viewer.cc", - "app/editor/dungeon/dungeon_object_selector.cc", - "app/editor/dungeon/dungeon_toolset.cc", - "app/editor/dungeon/dungeon_object_interaction.cc", - "app/editor/dungeon/dungeon_renderer.cc", - "app/editor/dungeon/dungeon_room_loader.cc", - "app/editor/dungeon/dungeon_usage_tracker.cc", - "app/editor/overworld/overworld_editor.cc", - "app/editor/overworld/overworld_editor_manager.cc", - "app/editor/sprite/sprite_editor.cc", - "app/editor/music/music_editor.cc", - "app/editor/message/message_editor.cc", - "app/editor/message/message_data.cc", - "app/editor/message/message_preview.cc", - "app/editor/code/assembly_editor.cc", - "app/editor/graphics/screen_editor.cc", - "app/editor/graphics/graphics_editor.cc", - "app/editor/graphics/palette_editor.cc", - "app/editor/overworld/tile16_editor.cc", - "app/editor/overworld/map_properties.cc", - "app/editor/graphics/gfx_group_editor.cc", - "app/editor/overworld/entity.cc", - "app/editor/system/settings_editor.cc", - "app/editor/system/command_manager.cc", - "app/editor/system/extension_manager.cc", - "app/editor/system/shortcut_manager.cc", - "app/editor/system/popup_manager.cc", - "app/test/test_manager.cc" -) - -$AppGfxSrc = @( - "app/gfx/arena.cc", - "app/gfx/background_buffer.cc", - "app/gfx/bitmap.cc", - "app/gfx/compression.cc", - "app/gfx/scad_format.cc", - "app/gfx/snes_palette.cc", - "app/gfx/snes_tile.cc", - "app/gfx/snes_color.cc", - "app/gfx/tilemap.cc" -) - -$AppZelda3Src = @( - "app/zelda3/hyrule_magic.cc", - "app/zelda3/overworld/overworld_map.cc", - "app/zelda3/overworld/overworld.cc", - "app/zelda3/screen/inventory.cc", - "app/zelda3/screen/title_screen.cc", - "app/zelda3/screen/dungeon_map.cc", - "app/zelda3/sprite/sprite.cc", - "app/zelda3/sprite/sprite_builder.cc", - "app/zelda3/music/tracker.cc", - "app/zelda3/dungeon/room.cc", - "app/zelda3/dungeon/room_object.cc", - "app/zelda3/dungeon/object_parser.cc", - "app/zelda3/dungeon/object_renderer.cc", - "app/zelda3/dungeon/room_layout.cc", - "app/zelda3/dungeon/dungeon_editor_system.cc", - "app/zelda3/dungeon/dungeon_object_editor.cc" -) - -$GuiSrc = @( - "app/gui/modules/asset_browser.cc", - "app/gui/modules/text_editor.cc", - "app/gui/canvas.cc", - "app/gui/canvas_utils.cc", - "app/gui/enhanced_palette_editor.cc", - "app/gui/input.cc", - "app/gui/style.cc", - "app/gui/color.cc", - "app/gui/zeml.cc", - "app/gui/theme_manager.cc", - "app/gui/background_renderer.cc" -) - -$UtilSrc = @( - "util/bps.cc", - "util/flag.cc", - "util/hex.cc" -) - -# Combine all source files -$AllSourceFiles = @( - "yaze.cc", - "app/main.cc", - "app/rom.cc" -) + $AppCoreSrc + $AppEmuSrc + $AppEditorSrc + $AppGfxSrc + $AppZelda3Src + $GuiSrc + $UtilSrc - -# Header files -$HeaderFiles = @( - "incl/yaze.h", - "incl/zelda.h", - "src/yaze_config.h.in" -) - -# Generate the .vcxproj file -$VcxprojContent = @" - - - - - Debug - x64 - - - Debug - x86 - - - Debug - ARM64 - - - Release - x64 - - - Release - x86 - - - Release - ARM64 - - - RelWithDebInfo - x64 - - - RelWithDebInfo - x86 - - - RelWithDebInfo - ARM64 - - - MinSizeRel - x64 - - - MinSizeRel - x86 - - - MinSizeRel - ARM64 - - - - 17.0 - {B2C3D4E5-F6G7-8901-BCDE-F23456789012} - Win32Proj - YAZE - 10.0 - YAZE - true - true - - - - Application - true - v143 - Unicode - - - Application - true - v143 - Unicode - - - Application - true - v143 - Unicode - - - Application - false - v143 - true - Unicode - - - Application - false - v143 - true - Unicode - - - Application - false - v143 - true - Unicode - - - Application - false - v143 - true - Unicode - - - Application - false - v143 - true - Unicode - - - Application - false - v143 - true - Unicode - - - Application - false - v143 - true - Unicode - - - Application - false - v143 - true - Unicode - - - Application - false - v143 - true - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - `$(SolutionDir)build\bin\`$(Configuration)\ - `$(SolutionDir)build\obj\`$(Configuration)\ - - - true - `$(SolutionDir)build\bin\`$(Configuration)\ - `$(SolutionDir)build\obj\`$(Configuration)\ - - - true - `$(SolutionDir)build\bin\`$(Configuration)\ - `$(SolutionDir)build\obj\`$(Configuration)\ - - - false - `$(SolutionDir)build\bin\`$(Configuration)\ - `$(SolutionDir)build\obj\`$(Configuration)\ - - - false - `$(SolutionDir)build\bin\`$(Configuration)\ - `$(SolutionDir)build\obj\`$(Configuration)\ - - - false - `$(SolutionDir)build\bin\`$(Configuration)\ - `$(SolutionDir)build\obj\`$(Configuration)\ - - - false - `$(SolutionDir)build\bin\`$(Configuration)\ - `$(SolutionDir)build\obj\`$(Configuration)\ - - - false - `$(SolutionDir)build\bin\`$(Configuration)\ - `$(SolutionDir)build\obj\`$(Configuration)\ - - - false - `$(SolutionDir)build\bin\`$(Configuration)\ - `$(SolutionDir)build\obj\`$(Configuration)\ - - - false - `$(SolutionDir)build\bin\`$(Configuration)\ - `$(SolutionDir)build\obj\`$(Configuration)\ - - - false - `$(SolutionDir)build\bin\`$(Configuration)\ - `$(SolutionDir)build\obj\`$(Configuration)\ - - - false - `$(SolutionDir)build\bin\`$(Configuration)\ - `$(SolutionDir)build\obj\`$(Configuration)\ - -"@ - -# Add compiler and linker settings for all configurations -$Configurations = @("Debug", "Release", "RelWithDebInfo", "MinSizeRel") -$Platforms = @("x64", "x86", "ARM64") - -foreach ($Config in $Configurations) { - foreach ($Platform in $Platforms) { - $IsDebug = ($Config -eq "Debug") - $DebugFlags = if ($IsDebug) { "_DEBUG;_CONSOLE;%(PreprocessorDefinitions)" } else { "NDEBUG;_CONSOLE;%(PreprocessorDefinitions)" } - $LinkIncremental = if ($IsDebug) { "true" } else { "false" } - $GenerateDebugInfo = if ($Config -eq "MinSizeRel") { "false" } else { "true" } - - $VcxprojContent += @" - - - - Level3 - true - $DebugFlags - true - `$(ProjectDir)src;`$(ProjectDir)incl;`$(ProjectDir)src\lib;`$(ProjectDir)src\lib\asar\src;`$(ProjectDir)src\lib\asar\src\asar;`$(ProjectDir)src\lib\asar\src\asar-dll-bindings\c;`$(ProjectDir)src\lib\imgui;`$(ProjectDir)src\lib\imgui_test_engine;%(AdditionalIncludeDirectories) - stdcpp23 - true - true - MultiThreaded$($IsDebug ? "Debug" : "")DLL - - - Console - $GenerateDebugInfo - $($IsDebug ? "false" : "true") - $($IsDebug ? "false" : "true") - - -"@ - } -} - -# Add source files -$VcxprojContent += @" - - -"@ - -foreach ($Header in $HeaderFiles) { - $VcxprojContent += " `n" -} - -$VcxprojContent += @" - - -"@ - -foreach ($Source in $AllSourceFiles) { - $VcxprojContent += " `n" -} - -$VcxprojContent += @" - - - - - - - - - - - - -"@ - -# Write the .vcxproj file -$VcxprojPath = Join-Path $OutputDir "YAZE.vcxproj" -$VcxprojContent | Out-File -FilePath $VcxprojPath -Encoding UTF8 - -Write-Host "Generated: $VcxprojPath" -ForegroundColor Green - -# Generate a simple solution file -$SolutionContent = @" -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.0.31903.59 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "YAZE", "YAZE.vcxproj", "{B2C3D4E5-F6G7-8901-BCDE-F23456789012}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Debug|ARM64 = Debug|ARM64 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - Release|ARM64 = Release|ARM64 - RelWithDebInfo|x64 = RelWithDebInfo|x64 - RelWithDebInfo|x86 = RelWithDebInfo|x86 - RelWithDebInfo|ARM64 = RelWithDebInfo|ARM64 - MinSizeRel|x64 = MinSizeRel|x64 - MinSizeRel|x86 = MinSizeRel|x86 - MinSizeRel|ARM64 = MinSizeRel|ARM64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B2C3D4E5-F6G7-8901-BCDE-F23456789012}.Debug|x64.ActiveCfg = Debug|x64 - {B2C3D4E5-F6G7-8901-BCDE-F23456789012}.Debug|x64.Build.0 = Debug|x64 - {B2C3D4E5-F6G7-8901-BCDE-F23456789012}.Debug|x86.ActiveCfg = Debug|x86 - {B2C3D4E5-F6G7-8901-BCDE-F23456789012}.Debug|x86.Build.0 = Debug|x86 - {B2C3D4E5-F6G7-8901-BCDE-F23456789012}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {B2C3D4E5-F6G7-8901-BCDE-F23456789012}.Debug|ARM64.Build.0 = Debug|ARM64 - {B2C3D4E5-F6G7-8901-BCDE-F23456789012}.Release|x64.ActiveCfg = Release|x64 - {B2C3D4E5-F6G7-8901-BCDE-F23456789012}.Release|x64.Build.0 = Release|x64 - {B2C3D4E5-F6G7-8901-BCDE-F23456789012}.Release|x86.ActiveCfg = Release|x86 - {B2C3D4E5-F6G7-8901-BCDE-F23456789012}.Release|x86.Build.0 = Release|x86 - {B2C3D4E5-F6G7-8901-BCDE-F23456789012}.Release|ARM64.ActiveCfg = Release|ARM64 - {B2C3D4E5-F6G7-8901-BCDE-F23456789012}.Release|ARM64.Build.0 = Release|ARM64 - {B2C3D4E5-F6G7-8901-BCDE-F23456789012}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 - {B2C3D4E5-F6G7-8901-BCDE-F23456789012}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 - {B2C3D4E5-F6G7-8901-BCDE-F23456789012}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x86 - {B2C3D4E5-F6G7-8901-BCDE-F23456789012}.RelWithDebInfo|x86.Build.0 = RelWithDebInfo|x86 - {B2C3D4E5-F6G7-8901-BCDE-F23456789012}.RelWithDebInfo|ARM64.ActiveCfg = RelWithDebInfo|ARM64 - {B2C3D4E5-F6G7-8901-BCDE-F23456789012}.RelWithDebInfo|ARM64.Build.0 = RelWithDebInfo|ARM64 - {B2C3D4E5-F6G7-8901-BCDE-F23456789012}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64 - {B2C3D4E5-F6G7-8901-BCDE-F23456789012}.MinSizeRel|x64.Build.0 = MinSizeRel|x64 - {B2C3D4E5-F6G7-8901-BCDE-F23456789012}.MinSizeRel|x86.ActiveCfg = MinSizeRel|x86 - {B2C3D4E5-F6G7-8901-BCDE-F23456789012}.MinSizeRel|x86.Build.0 = MinSizeRel|x86 - {B2C3D4E5-F6G7-8901-BCDE-F23456789012}.MinSizeRel|ARM64.ActiveCfg = MinSizeRel|ARM64 - {B2C3D4E5-F6G7-8901-BCDE-F23456789012}.MinSizeRel|ARM64.Build.0 = MinSizeRel|ARM64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {A1B2C3D4-E5F6-7890-ABCD-EF1234567890} - EndGlobalSection -EndGlobal -"@ - -$SolutionPath = Join-Path $OutputDir "YAZE.sln" -$SolutionContent | Out-File -FilePath $SolutionPath -Encoding UTF8 - -Write-Host "Generated: $SolutionPath" -ForegroundColor Green -Write-Host "Visual Studio project files generated successfully!" -ForegroundColor Green -Write-Host "" -Write-Host "To build:" -ForegroundColor Yellow -Write-Host "1. Open YAZE.sln in Visual Studio 2022" -ForegroundColor White -Write-Host "2. Ensure vcpkg is installed and configured" -ForegroundColor White -Write-Host "3. Select your desired configuration (Debug/Release) and platform (x64/x86/ARM64)" -ForegroundColor White -Write-Host "4. Build the solution (Ctrl+Shift+B)" -ForegroundColor White diff --git a/scripts/test-powershell-syntax.ps1 b/scripts/test-powershell-syntax.ps1 new file mode 100644 index 00000000..1b3fb007 --- /dev/null +++ b/scripts/test-powershell-syntax.ps1 @@ -0,0 +1,31 @@ +# Simple test script to verify PowerShell syntax +# This script tests basic PowerShell constructs used in our build scripts + +Write-Host "Testing PowerShell syntax..." -ForegroundColor Green + +# Test try-catch blocks +try { + Write-Host "✓ Try-catch syntax works" -ForegroundColor Green +} catch { + Write-Host "✗ Try-catch syntax failed" -ForegroundColor Red +} + +# Test if-else blocks +if ($true) { + Write-Host "✓ If-else syntax works" -ForegroundColor Green +} else { + Write-Host "✗ If-else syntax failed" -ForegroundColor Red +} + +# Test parameter blocks +param( + [switch]$TestParam = $false +) + +Write-Host "✓ Parameter syntax works" -ForegroundColor Green + +# Test string interpolation +$testVar = "PowerShell" +Write-Host "✓ String interpolation works: $testVar" -ForegroundColor Green + +Write-Host "All syntax tests passed!" -ForegroundColor Green