diff --git a/CodeWalker.Core/Utils/Utils.cs b/CodeWalker.Core/Utils/Utils.cs index bf5748f..f29415f 100644 --- a/CodeWalker.Core/Utils/Utils.cs +++ b/CodeWalker.Core/Utils/Utils.cs @@ -3,7 +3,9 @@ using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Globalization; +using System.IO; using System.Linq; +using System.Reflection; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; @@ -14,6 +16,29 @@ namespace CodeWalker { + public static class PathUtil + { + public static string AppPath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); + public static string WorkPath = Directory.GetCurrentDirectory(); + + public static string GetFilePath(string appRelativePath) + { + var path = Path.Combine(AppPath, appRelativePath); + if (File.Exists(path)) return path; + path = Path.Combine(WorkPath, appRelativePath); + return path; + } + + public static byte[] ReadAllBytes(string appRelativePath) + { + var path = GetFilePath(appRelativePath); + return File.ReadAllBytes(path); + } + + } + + + public static class TextUtil { diff --git a/CodeWalker/Rendering/Shaders/BasicShader.cs b/CodeWalker/Rendering/Shaders/BasicShader.cs index e219448..b01914e 100644 --- a/CodeWalker/Rendering/Shaders/BasicShader.cs +++ b/CodeWalker/Rendering/Shaders/BasicShader.cs @@ -184,34 +184,34 @@ namespace CodeWalker.Rendering public BasicShader(Device device) { - byte[] vspnctbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCT.cso"); - byte[] vspncttbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCTT.cso"); - byte[] vspnctttbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCTTT.cso"); - byte[] vspncctbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCCT.cso"); - byte[] vspnccttbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCCTT.cso"); - byte[] vspncctttbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCCTTT.cso"); - byte[] vspnctxbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCTX.cso"); - byte[] vspncctxbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCCTX.cso"); - byte[] vspncttxbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCTTX.cso"); - byte[] vspnccttxbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCCTTX.cso"); - byte[] vspnctttxbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCTTTX.cso"); - byte[] vspncctttxbytes = File.ReadAllBytes("Shaders\\BasicVS_PNCCTTTX.cso"); + byte[] vspnctbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PNCT.cso"); + byte[] vspncttbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PNCTT.cso"); + byte[] vspnctttbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PNCTTT.cso"); + byte[] vspncctbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PNCCT.cso"); + byte[] vspnccttbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PNCCTT.cso"); + byte[] vspncctttbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PNCCTTT.cso"); + byte[] vspnctxbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PNCTX.cso"); + byte[] vspncctxbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PNCCTX.cso"); + byte[] vspncttxbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PNCTTX.cso"); + byte[] vspnccttxbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PNCCTTX.cso"); + byte[] vspnctttxbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PNCTTTX.cso"); + byte[] vspncctttxbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PNCCTTTX.cso"); - byte[] vspbbnctbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCT.cso"); - byte[] vspbbnctxbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCTX.cso"); - byte[] vspbbncttbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCTT.cso"); - byte[] vspbbnctttbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCTTT.cso"); - byte[] vspbbncctbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCCT.cso"); - byte[] vspbbncctxbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCCTX.cso"); - byte[] vspbbnccttxbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCCTTX.cso"); - byte[] vspbbncttxbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCTTX.cso"); + byte[] vspbbnctbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PBBNCT.cso"); + byte[] vspbbnctxbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PBBNCTX.cso"); + byte[] vspbbncttbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PBBNCTT.cso"); + byte[] vspbbnctttbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PBBNCTTT.cso"); + byte[] vspbbncctbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PBBNCCT.cso"); + byte[] vspbbncctxbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PBBNCCTX.cso"); + byte[] vspbbnccttxbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PBBNCCTTX.cso"); + byte[] vspbbncttxbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_PBBNCTTX.cso"); - byte[] vsboxbytes = File.ReadAllBytes("Shaders\\BasicVS_Box.cso"); - byte[] vsspherebytes = File.ReadAllBytes("Shaders\\BasicVS_Sphere.cso"); - byte[] vscapsulebytes = File.ReadAllBytes("Shaders\\BasicVS_Capsule.cso"); - byte[] vscylinderbytes = File.ReadAllBytes("Shaders\\BasicVS_Cylinder.cso"); - byte[] psbytes = File.ReadAllBytes("Shaders\\BasicPS.cso"); - byte[] psdefbytes = File.ReadAllBytes("Shaders\\BasicPS_Deferred.cso"); + byte[] vsboxbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_Box.cso"); + byte[] vsspherebytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_Sphere.cso"); + byte[] vscapsulebytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_Capsule.cso"); + byte[] vscylinderbytes = PathUtil.ReadAllBytes("Shaders\\BasicVS_Cylinder.cso"); + byte[] psbytes = PathUtil.ReadAllBytes("Shaders\\BasicPS.cso"); + byte[] psdefbytes = PathUtil.ReadAllBytes("Shaders\\BasicPS_Deferred.cso"); basicvspnct = new VertexShader(device, vspnctbytes); basicvspnctt = new VertexShader(device, vspncttbytes); diff --git a/CodeWalker/Rendering/Shaders/BoundsShader.cs b/CodeWalker/Rendering/Shaders/BoundsShader.cs index 33656c4..d1f47f7 100644 --- a/CodeWalker/Rendering/Shaders/BoundsShader.cs +++ b/CodeWalker/Rendering/Shaders/BoundsShader.cs @@ -71,9 +71,9 @@ namespace CodeWalker.Rendering public BoundsShader(Device device) { - byte[] spherevsbytes = File.ReadAllBytes("Shaders\\BoundingSphereVS.cso"); - byte[] boxvsbytes = File.ReadAllBytes("Shaders\\BoundingBoxVS.cso"); - byte[] psbytes = File.ReadAllBytes("Shaders\\BoundsPS.cso"); + byte[] spherevsbytes = PathUtil.ReadAllBytes("Shaders\\BoundingSphereVS.cso"); + byte[] boxvsbytes = PathUtil.ReadAllBytes("Shaders\\BoundingBoxVS.cso"); + byte[] psbytes = PathUtil.ReadAllBytes("Shaders\\BoundsPS.cso"); spherevs = new VertexShader(device, spherevsbytes); boxvs = new VertexShader(device, boxvsbytes); diff --git a/CodeWalker/Rendering/Shaders/CableShader.cs b/CodeWalker/Rendering/Shaders/CableShader.cs index 37ca112..f79ba49 100644 --- a/CodeWalker/Rendering/Shaders/CableShader.cs +++ b/CodeWalker/Rendering/Shaders/CableShader.cs @@ -88,9 +88,9 @@ namespace CodeWalker.Rendering public CableShader(Device device) { - byte[] vsbytes = File.ReadAllBytes("Shaders\\CableVS.cso"); - byte[] psbytes = File.ReadAllBytes("Shaders\\CablePS.cso"); - byte[] psdefbytes = File.ReadAllBytes("Shaders\\CablePS_Deferred.cso"); + byte[] vsbytes = PathUtil.ReadAllBytes("Shaders\\CableVS.cso"); + byte[] psbytes = PathUtil.ReadAllBytes("Shaders\\CablePS.cso"); + byte[] psdefbytes = PathUtil.ReadAllBytes("Shaders\\CablePS_Deferred.cso"); vs = new VertexShader(device, vsbytes); ps = new PixelShader(device, psbytes); diff --git a/CodeWalker/Rendering/Shaders/CloudsShader.cs b/CodeWalker/Rendering/Shaders/CloudsShader.cs index bf680eb..4b90b0d 100644 --- a/CodeWalker/Rendering/Shaders/CloudsShader.cs +++ b/CodeWalker/Rendering/Shaders/CloudsShader.cs @@ -106,8 +106,8 @@ namespace CodeWalker.Rendering public CloudsShader(Device device) { - byte[] vsbytes = File.ReadAllBytes("Shaders\\CloudsVS.cso"); - byte[] psbytes = File.ReadAllBytes("Shaders\\CloudsPS.cso"); + byte[] vsbytes = PathUtil.ReadAllBytes("Shaders\\CloudsVS.cso"); + byte[] psbytes = PathUtil.ReadAllBytes("Shaders\\CloudsPS.cso"); vs = new VertexShader(device, vsbytes); ps = new PixelShader(device, psbytes); diff --git a/CodeWalker/Rendering/Shaders/DeferredScene.cs b/CodeWalker/Rendering/Shaders/DeferredScene.cs index 30a3c14..8a93384 100644 --- a/CodeWalker/Rendering/Shaders/DeferredScene.cs +++ b/CodeWalker/Rendering/Shaders/DeferredScene.cs @@ -128,17 +128,17 @@ namespace CodeWalker.Rendering { var device = dxman.device; - byte[] bDirLightVS = File.ReadAllBytes("Shaders\\DirLightVS.cso"); - byte[] bDirLightPS = File.ReadAllBytes("Shaders\\DirLightPS.cso"); - byte[] bDirLightMSPS = File.ReadAllBytes("Shaders\\DirLightPS_MS.cso"); - byte[] bLodLightVS = File.ReadAllBytes("Shaders\\LodLightsVS.cso"); - byte[] bLodLightPS = File.ReadAllBytes("Shaders\\LodLightsPS.cso"); - byte[] bLodLightMSPS = File.ReadAllBytes("Shaders\\LodLightsPS_MS.cso"); - byte[] bLightVS = File.ReadAllBytes("Shaders\\LightVS.cso"); - byte[] bLightPS = File.ReadAllBytes("Shaders\\LightPS.cso"); - byte[] bLightMSPS = File.ReadAllBytes("Shaders\\LightPS_MS.cso"); - byte[] bFinalVS = File.ReadAllBytes("Shaders\\PPFinalPassVS.cso"); - byte[] bSSAAPS = File.ReadAllBytes("Shaders\\PPSSAAPS.cso"); + byte[] bDirLightVS = PathUtil.ReadAllBytes("Shaders\\DirLightVS.cso"); + byte[] bDirLightPS = PathUtil.ReadAllBytes("Shaders\\DirLightPS.cso"); + byte[] bDirLightMSPS = PathUtil.ReadAllBytes("Shaders\\DirLightPS_MS.cso"); + byte[] bLodLightVS = PathUtil.ReadAllBytes("Shaders\\LodLightsVS.cso"); + byte[] bLodLightPS = PathUtil.ReadAllBytes("Shaders\\LodLightsPS.cso"); + byte[] bLodLightMSPS = PathUtil.ReadAllBytes("Shaders\\LodLightsPS_MS.cso"); + byte[] bLightVS = PathUtil.ReadAllBytes("Shaders\\LightVS.cso"); + byte[] bLightPS = PathUtil.ReadAllBytes("Shaders\\LightPS.cso"); + byte[] bLightMSPS = PathUtil.ReadAllBytes("Shaders\\LightPS_MS.cso"); + byte[] bFinalVS = PathUtil.ReadAllBytes("Shaders\\PPFinalPassVS.cso"); + byte[] bSSAAPS = PathUtil.ReadAllBytes("Shaders\\PPSSAAPS.cso"); DirLightVS = new VertexShader(device, bDirLightVS); DirLightPS = new PixelShader(device, bDirLightPS); diff --git a/CodeWalker/Rendering/Shaders/DistantLightsShader.cs b/CodeWalker/Rendering/Shaders/DistantLightsShader.cs index ffc66e8..d16f225 100644 --- a/CodeWalker/Rendering/Shaders/DistantLightsShader.cs +++ b/CodeWalker/Rendering/Shaders/DistantLightsShader.cs @@ -41,8 +41,8 @@ namespace CodeWalker.Rendering public DistantLightsShader(Device device) { - byte[] vsbytes = File.ReadAllBytes("Shaders\\DistantLightsVS.cso"); - byte[] psbytes = File.ReadAllBytes("Shaders\\DistantLightsPS.cso"); + byte[] vsbytes = PathUtil.ReadAllBytes("Shaders\\DistantLightsVS.cso"); + byte[] psbytes = PathUtil.ReadAllBytes("Shaders\\DistantLightsPS.cso"); lightsvs = new VertexShader(device, vsbytes); lightsps = new PixelShader(device, psbytes); diff --git a/CodeWalker/Rendering/Shaders/MarkerShader.cs b/CodeWalker/Rendering/Shaders/MarkerShader.cs index 6f3df64..bb0e539 100644 --- a/CodeWalker/Rendering/Shaders/MarkerShader.cs +++ b/CodeWalker/Rendering/Shaders/MarkerShader.cs @@ -46,8 +46,8 @@ namespace CodeWalker.Rendering public MarkerShader(Device device) { - byte[] vsbytes = File.ReadAllBytes("Shaders\\MarkerVS.cso"); - byte[] psbytes = File.ReadAllBytes("Shaders\\MarkerPS.cso"); + byte[] vsbytes = PathUtil.ReadAllBytes("Shaders\\MarkerVS.cso"); + byte[] psbytes = PathUtil.ReadAllBytes("Shaders\\MarkerPS.cso"); markervs = new VertexShader(device, vsbytes); markerps = new PixelShader(device, psbytes); diff --git a/CodeWalker/Rendering/Shaders/PathShader.cs b/CodeWalker/Rendering/Shaders/PathShader.cs index 6f7bb1f..94f1020 100644 --- a/CodeWalker/Rendering/Shaders/PathShader.cs +++ b/CodeWalker/Rendering/Shaders/PathShader.cs @@ -46,11 +46,11 @@ namespace CodeWalker.Rendering public PathShader(Device device) { - byte[] boxvsbytes = File.ReadAllBytes("Shaders\\PathBoxVS.cso"); - byte[] boxpsbytes = File.ReadAllBytes("Shaders\\PathBoxPS.cso"); - byte[] dynvsbytes = File.ReadAllBytes("Shaders\\PathDynVS.cso"); - byte[] vsbytes = File.ReadAllBytes("Shaders\\PathVS.cso"); - byte[] psbytes = File.ReadAllBytes("Shaders\\PathPS.cso"); + byte[] boxvsbytes = PathUtil.ReadAllBytes("Shaders\\PathBoxVS.cso"); + byte[] boxpsbytes = PathUtil.ReadAllBytes("Shaders\\PathBoxPS.cso"); + byte[] dynvsbytes = PathUtil.ReadAllBytes("Shaders\\PathDynVS.cso"); + byte[] vsbytes = PathUtil.ReadAllBytes("Shaders\\PathVS.cso"); + byte[] psbytes = PathUtil.ReadAllBytes("Shaders\\PathPS.cso"); boxvs = new VertexShader(device, boxvsbytes); diff --git a/CodeWalker/Rendering/Shaders/PostProcessor.cs b/CodeWalker/Rendering/Shaders/PostProcessor.cs index 7599450..5be578a 100644 --- a/CodeWalker/Rendering/Shaders/PostProcessor.cs +++ b/CodeWalker/Rendering/Shaders/PostProcessor.cs @@ -186,14 +186,14 @@ namespace CodeWalker.Rendering { var device = dxman.device; - byte[] bReduceTo1DCS = File.ReadAllBytes("Shaders\\PPReduceTo1DCS.cso"); - byte[] bReduceTo0DCS = File.ReadAllBytes("Shaders\\PPReduceTo0DCS.cso"); - byte[] bLumBlendCS = File.ReadAllBytes("Shaders\\PPLumBlendCS.cso"); - byte[] bBloomFilterBPHCS = File.ReadAllBytes("Shaders\\PPBloomFilterBPHCS.cso"); - byte[] bBloomFilterVCS = File.ReadAllBytes("Shaders\\PPBloomFilterVCS.cso"); - byte[] bCopyPixelsPS = File.ReadAllBytes("Shaders\\PPCopyPixelsPS.cso"); - byte[] bFinalPassVS = File.ReadAllBytes("Shaders\\PPFinalPassVS.cso"); - byte[] bFinalPassPS = File.ReadAllBytes("Shaders\\PPFinalPassPS.cso"); + byte[] bReduceTo1DCS = PathUtil.ReadAllBytes("Shaders\\PPReduceTo1DCS.cso"); + byte[] bReduceTo0DCS = PathUtil.ReadAllBytes("Shaders\\PPReduceTo0DCS.cso"); + byte[] bLumBlendCS = PathUtil.ReadAllBytes("Shaders\\PPLumBlendCS.cso"); + byte[] bBloomFilterBPHCS = PathUtil.ReadAllBytes("Shaders\\PPBloomFilterBPHCS.cso"); + byte[] bBloomFilterVCS = PathUtil.ReadAllBytes("Shaders\\PPBloomFilterVCS.cso"); + byte[] bCopyPixelsPS = PathUtil.ReadAllBytes("Shaders\\PPCopyPixelsPS.cso"); + byte[] bFinalPassVS = PathUtil.ReadAllBytes("Shaders\\PPFinalPassVS.cso"); + byte[] bFinalPassPS = PathUtil.ReadAllBytes("Shaders\\PPFinalPassPS.cso"); ReduceTo1DCS = new ComputeShader(device, bReduceTo1DCS); ReduceTo0DCS = new ComputeShader(device, bReduceTo0DCS); diff --git a/CodeWalker/Rendering/Shaders/ShadowShader.cs b/CodeWalker/Rendering/Shaders/ShadowShader.cs index aefb574..5ea9141 100644 --- a/CodeWalker/Rendering/Shaders/ShadowShader.cs +++ b/CodeWalker/Rendering/Shaders/ShadowShader.cs @@ -81,9 +81,9 @@ namespace CodeWalker.Rendering public ShadowShader(Device device) { - byte[] vsbytes = File.ReadAllBytes("Shaders\\ShadowVS.cso"); - byte[] vssbytes = File.ReadAllBytes("Shaders\\ShadowVS_Skin.cso"); - byte[] psbytes = File.ReadAllBytes("Shaders\\ShadowPS.cso"); + byte[] vsbytes = PathUtil.ReadAllBytes("Shaders\\ShadowVS.cso"); + byte[] vssbytes = PathUtil.ReadAllBytes("Shaders\\ShadowVS_Skin.cso"); + byte[] psbytes = PathUtil.ReadAllBytes("Shaders\\ShadowPS.cso"); shadowvs = new VertexShader(device, vsbytes); shadowvs_skin = new VertexShader(device, vssbytes); diff --git a/CodeWalker/Rendering/Shaders/SkydomeShader.cs b/CodeWalker/Rendering/Shaders/SkydomeShader.cs index 6a23011..59ad338 100644 --- a/CodeWalker/Rendering/Shaders/SkydomeShader.cs +++ b/CodeWalker/Rendering/Shaders/SkydomeShader.cs @@ -131,12 +131,12 @@ namespace CodeWalker.Rendering public SkydomeShader(Device device) { - byte[] skyvsbytes = File.ReadAllBytes("Shaders\\SkydomeVS.cso"); - byte[] skypsbytes = File.ReadAllBytes("Shaders\\SkydomePS.cso"); - byte[] sunvsbytes = File.ReadAllBytes("Shaders\\SkySunVS.cso"); - byte[] sunpsbytes = File.ReadAllBytes("Shaders\\SkySunPS.cso"); - byte[] moonvsbytes = File.ReadAllBytes("Shaders\\SkyMoonVS.cso"); - byte[] moonpsbytes = File.ReadAllBytes("Shaders\\SkyMoonPS.cso"); + byte[] skyvsbytes = PathUtil.ReadAllBytes("Shaders\\SkydomeVS.cso"); + byte[] skypsbytes = PathUtil.ReadAllBytes("Shaders\\SkydomePS.cso"); + byte[] sunvsbytes = PathUtil.ReadAllBytes("Shaders\\SkySunVS.cso"); + byte[] sunpsbytes = PathUtil.ReadAllBytes("Shaders\\SkySunPS.cso"); + byte[] moonvsbytes = PathUtil.ReadAllBytes("Shaders\\SkyMoonVS.cso"); + byte[] moonpsbytes = PathUtil.ReadAllBytes("Shaders\\SkyMoonPS.cso"); skyvs = new VertexShader(device, skyvsbytes); skyps = new PixelShader(device, skypsbytes); diff --git a/CodeWalker/Rendering/Shaders/TerrainShader.cs b/CodeWalker/Rendering/Shaders/TerrainShader.cs index ef56252..1e89419 100644 --- a/CodeWalker/Rendering/Shaders/TerrainShader.cs +++ b/CodeWalker/Rendering/Shaders/TerrainShader.cs @@ -101,15 +101,15 @@ namespace CodeWalker.Rendering public TerrainShader(Device device) { - byte[] vspncct = File.ReadAllBytes("Shaders\\TerrainVS_PNCCT.cso"); - byte[] vspncctt = File.ReadAllBytes("Shaders\\TerrainVS_PNCCTT.cso"); - byte[] vspnccttx = File.ReadAllBytes("Shaders\\TerrainVS_PNCCTTX.cso"); - byte[] vspncctttx = File.ReadAllBytes("Shaders\\TerrainVS_PNCCTTTX.cso"); - byte[] vspncctx = File.ReadAllBytes("Shaders\\TerrainVS_PNCCTX.cso"); - byte[] vspnctttx = File.ReadAllBytes("Shaders\\TerrainVS_PNCTTTX.cso"); - byte[] vspncttx = File.ReadAllBytes("Shaders\\TerrainVS_PNCTTX.cso"); - byte[] psbytes = File.ReadAllBytes("Shaders\\TerrainPS.cso"); - byte[] psdefbytes = File.ReadAllBytes("Shaders\\TerrainPS_Deferred.cso"); + byte[] vspncct = PathUtil.ReadAllBytes("Shaders\\TerrainVS_PNCCT.cso"); + byte[] vspncctt = PathUtil.ReadAllBytes("Shaders\\TerrainVS_PNCCTT.cso"); + byte[] vspnccttx = PathUtil.ReadAllBytes("Shaders\\TerrainVS_PNCCTTX.cso"); + byte[] vspncctttx = PathUtil.ReadAllBytes("Shaders\\TerrainVS_PNCCTTTX.cso"); + byte[] vspncctx = PathUtil.ReadAllBytes("Shaders\\TerrainVS_PNCCTX.cso"); + byte[] vspnctttx = PathUtil.ReadAllBytes("Shaders\\TerrainVS_PNCTTTX.cso"); + byte[] vspncttx = PathUtil.ReadAllBytes("Shaders\\TerrainVS_PNCTTX.cso"); + byte[] psbytes = PathUtil.ReadAllBytes("Shaders\\TerrainPS.cso"); + byte[] psdefbytes = PathUtil.ReadAllBytes("Shaders\\TerrainPS_Deferred.cso"); pncctvs = new VertexShader(device, vspncct); pnccttvs = new VertexShader(device, vspncctt); diff --git a/CodeWalker/Rendering/Shaders/TreesLodShader.cs b/CodeWalker/Rendering/Shaders/TreesLodShader.cs index ac16b83..dd88412 100644 --- a/CodeWalker/Rendering/Shaders/TreesLodShader.cs +++ b/CodeWalker/Rendering/Shaders/TreesLodShader.cs @@ -77,9 +77,9 @@ namespace CodeWalker.Rendering public TreesLodShader(Device device) { - byte[] vsbytes = File.ReadAllBytes("Shaders\\TreesLodVS.cso"); - byte[] psbytes = File.ReadAllBytes("Shaders\\TreesLodPS.cso"); - byte[] psdefbytes = File.ReadAllBytes("Shaders\\TreesLodPS_Deferred.cso"); + byte[] vsbytes = PathUtil.ReadAllBytes("Shaders\\TreesLodVS.cso"); + byte[] psbytes = PathUtil.ReadAllBytes("Shaders\\TreesLodPS.cso"); + byte[] psdefbytes = PathUtil.ReadAllBytes("Shaders\\TreesLodPS_Deferred.cso"); vs = new VertexShader(device, vsbytes); ps = new PixelShader(device, psbytes); diff --git a/CodeWalker/Rendering/Shaders/WaterShader.cs b/CodeWalker/Rendering/Shaders/WaterShader.cs index 57c32dd..cad949a 100644 --- a/CodeWalker/Rendering/Shaders/WaterShader.cs +++ b/CodeWalker/Rendering/Shaders/WaterShader.cs @@ -121,12 +121,12 @@ namespace CodeWalker.Rendering public WaterShader(Device device) { - byte[] vsptbytes = File.ReadAllBytes("Shaders\\WaterVS_PT.cso"); - byte[] vspctbytes = File.ReadAllBytes("Shaders\\WaterVS_PCT.cso"); - byte[] vspnctbytes = File.ReadAllBytes("Shaders\\WaterVS_PNCT.cso"); - byte[] vspnctxbytes = File.ReadAllBytes("Shaders\\WaterVS_PNCTX.cso"); - byte[] psbytes = File.ReadAllBytes("Shaders\\WaterPS.cso"); - byte[] psdefbytes = File.ReadAllBytes("Shaders\\WaterPS_Deferred.cso"); + byte[] vsptbytes = PathUtil.ReadAllBytes("Shaders\\WaterVS_PT.cso"); + byte[] vspctbytes = PathUtil.ReadAllBytes("Shaders\\WaterVS_PCT.cso"); + byte[] vspnctbytes = PathUtil.ReadAllBytes("Shaders\\WaterVS_PNCT.cso"); + byte[] vspnctxbytes = PathUtil.ReadAllBytes("Shaders\\WaterVS_PNCTX.cso"); + byte[] psbytes = PathUtil.ReadAllBytes("Shaders\\WaterPS.cso"); + byte[] psdefbytes = PathUtil.ReadAllBytes("Shaders\\WaterPS_Deferred.cso"); vspt = new VertexShader(device, vsptbytes); diff --git a/CodeWalker/Rendering/Shaders/WidgetShader.cs b/CodeWalker/Rendering/Shaders/WidgetShader.cs index 00a5852..274ef2a 100644 --- a/CodeWalker/Rendering/Shaders/WidgetShader.cs +++ b/CodeWalker/Rendering/Shaders/WidgetShader.cs @@ -39,8 +39,8 @@ namespace CodeWalker.Rendering public WidgetShader(Device device) { - byte[] vsbytes = File.ReadAllBytes("Shaders\\WidgetVS.cso"); - byte[] psbytes = File.ReadAllBytes("Shaders\\WidgetPS.cso"); + byte[] vsbytes = PathUtil.ReadAllBytes("Shaders\\WidgetVS.cso"); + byte[] psbytes = PathUtil.ReadAllBytes("Shaders\\WidgetPS.cso"); vs = new VertexShader(device, vsbytes); ps = new PixelShader(device, psbytes); diff --git a/CodeWalker/WorldForm.cs b/CodeWalker/WorldForm.cs index d0c03ea..b8e1655 100644 --- a/CodeWalker/WorldForm.cs +++ b/CodeWalker/WorldForm.cs @@ -314,7 +314,7 @@ namespace CodeWalker private MapIcon AddIcon(string name, string filename, int texw, int texh, float centerx, float centery, float scale) { - string filepath = "icons\\" + filename; + string filepath = PathUtil.GetFilePath("icons\\" + filename); try { MapIcon mi = new MapIcon(name, filepath, texw, texh, centerx, centery, scale);