diff --git a/Fushigi/Program.cs b/Fushigi/Program.cs index f2836835..d9da47e8 100644 --- a/Fushigi/Program.cs +++ b/Fushigi/Program.cs @@ -35,7 +35,7 @@ if (!Path.Exists("imgui.ini")) { Console.WriteLine("Creating imgui.ini..."); - File.WriteAllText("imgui.ini", File.ReadAllText(Path.Combine("res", "imgui-default.ini"))); + File.WriteAllText("imgui.ini", File.ReadAllText(Path.Combine(AppContext.BaseDirectory, "res", "imgui-default.ini"))); Console.WriteLine("Created!"); }; diff --git a/Fushigi/gl/Bfres/Agl/AglLightmap.cs b/Fushigi/gl/Bfres/Agl/AglLightmap.cs index 2500902f..342736a9 100644 --- a/Fushigi/gl/Bfres/Agl/AglLightmap.cs +++ b/Fushigi/gl/Bfres/Agl/AglLightmap.cs @@ -42,8 +42,8 @@ public static void Init(GL gl) Framebuffer = new GLFramebuffer(gl, FramebufferTarget.Framebuffer); Framebuffer.SetDrawBuffers(buffers); - NormalsTexture = new DDSTextureRender(gl, Path.Combine("res", "bfres", "normals.dds")); - LUTTexture = new DDSTextureRender(gl, Path.Combine("res", "bfres", "gradient.dds")); + NormalsTexture = new DDSTextureRender(gl, Path.Combine(AppContext.BaseDirectory, "res", "bfres", "normals.dds")); + LUTTexture = new DDSTextureRender(gl, Path.Combine(AppContext.BaseDirectory, "res", "bfres", "gradient.dds")); ScreenQuadRender = new ScreenQuad(gl, 1f); } @@ -67,8 +67,8 @@ public void RenderLevel(GL gl, GLTexture output, int mip_level) var size = output.Width / (uint)Math.Pow(2, mip_level); var shader = GLShaderCache.GetShader(gl, "Lightmap", - Path.Combine("res", "shaders", "Lightmap.vert"), - Path.Combine("res", "shaders", "Lightmap.frag")); + Path.Combine(AppContext.BaseDirectory, "res", "shaders", "Lightmap.vert"), + Path.Combine(AppContext.BaseDirectory, "res", "shaders", "Lightmap.frag")); shader.Use(); Framebuffer.Bind(); diff --git a/Fushigi/gl/Bfres/BfresMaterialRender.cs b/Fushigi/gl/Bfres/BfresMaterialRender.cs index 220caff4..3d714e9a 100644 --- a/Fushigi/gl/Bfres/BfresMaterialRender.cs +++ b/Fushigi/gl/Bfres/BfresMaterialRender.cs @@ -31,8 +31,8 @@ public void Init(GL gl, BfresRender.BfresModel modelRender, BfresRender.BfresMes Name = material.Name; Shader = GLShaderCache.GetShader(gl, "Bfres", - Path.Combine("res", "shaders", "Bfres.vert"), - Path.Combine("res", "shaders", "Bfres.frag")); + Path.Combine(AppContext.BaseDirectory, "res", "shaders", "Bfres.vert"), + Path.Combine(AppContext.BaseDirectory, "res", "shaders", "Bfres.frag")); GsysRenderState.Init(material); GsysShaderRender.Init(gl, modelRender, meshRender, shape, material); diff --git a/Fushigi/gl/Bfres/Gsys/GsysResources.cs b/Fushigi/gl/Bfres/Gsys/GsysResources.cs index a81604f9..622f67cc 100644 --- a/Fushigi/gl/Bfres/Gsys/GsysResources.cs +++ b/Fushigi/gl/Bfres/Gsys/GsysResources.cs @@ -122,8 +122,8 @@ public void Init(GL gl) DiffuseLightmap = GLTextureCube.CreateEmpty(gl, 4); SpecularLightmap = GLTextureCube.CreateEmpty(gl, 4); - CubeMap = new DDSTextureRender(gl, Path.Combine("res", "bfres", "CubemapHDR.dds"), TextureTarget.TextureCubeMapArray); - // DiffuseLightmap = new DDSTextureRender(gl, Path.Combine("res", "bfres", "CubemapLightmap.dds"), TextureTarget.TextureCubeMap); + CubeMap = new DDSTextureRender(gl, Path.Combine(AppContext.BaseDirectory, "res", "bfres", "CubemapHDR.dds"), TextureTarget.TextureCubeMapArray); + // DiffuseLightmap = new DDSTextureRender(gl, Path.Combine(AppContext.BaseDirectory, "res", "bfres", "CubemapLightmap.dds"), TextureTarget.TextureCubeMap); DiffuseLightmap.Bind(); DiffuseLightmap.WrapS = TextureWrapMode.ClampToEdge; diff --git a/Fushigi/gl/HDRScreenBuffer.cs b/Fushigi/gl/HDRScreenBuffer.cs index 31d24fd9..3638c598 100644 --- a/Fushigi/gl/HDRScreenBuffer.cs +++ b/Fushigi/gl/HDRScreenBuffer.cs @@ -33,8 +33,8 @@ public void Render(GL gl, int width, int height, GLTexture2D input) gl.Viewport(0, 0, Framebuffer.Width, Framebuffer.Height); var shader = GLShaderCache.GetShader(gl, "PostEffect", - Path.Combine("res", "shaders", "screen.vert"), - Path.Combine("res", "shaders", "screen.frag")); + Path.Combine(AppContext.BaseDirectory, "res", "shaders", "screen.vert"), + Path.Combine(AppContext.BaseDirectory, "res", "shaders", "screen.frag")); shader.Use(); shader.SetTexture("screenTexture", input, 1); diff --git a/Fushigi/gl/Materials/BasicMaterial.cs b/Fushigi/gl/Materials/BasicMaterial.cs index 1637f9f1..d733efa8 100644 --- a/Fushigi/gl/Materials/BasicMaterial.cs +++ b/Fushigi/gl/Materials/BasicMaterial.cs @@ -18,8 +18,8 @@ public class BasicMaterial public void Render(GL gl, Matrix4x4 matrix) { Shader = GLShaderCache.GetShader(gl, "Basic", - Path.Combine("res", "shaders", "Basic.vert"), - Path.Combine("res", "shaders", "Basic.frag")); + Path.Combine(AppContext.BaseDirectory, "res", "shaders", "Basic.vert"), + Path.Combine(AppContext.BaseDirectory, "res", "shaders", "Basic.frag")); Shader.Use(); Shader.SetUniform("mtxCam", matrix); diff --git a/Fushigi/gl/Primitives/Plane2DRenderer.cs b/Fushigi/gl/Primitives/Plane2DRenderer.cs index d752fe35..1b0bc27d 100644 --- a/Fushigi/gl/Primitives/Plane2DRenderer.cs +++ b/Fushigi/gl/Primitives/Plane2DRenderer.cs @@ -26,8 +26,8 @@ public void RenderTest(Camera camera) Image = GLTexture2D.Load(_gl, "Wood.png"); var shader = GLShaderCache.GetShader(_gl, "Basic", - Path.Combine("res", "shaders", "Basic.vert"), - Path.Combine("res", "shaders", "Basic.frag")); + Path.Combine(AppContext.BaseDirectory, "res", "shaders", "Basic.vert"), + Path.Combine(AppContext.BaseDirectory, "res", "shaders", "Basic.frag")); shader.Use(); shader.SetUniform("hasTexture", Image != null ? 1 : 0); diff --git a/Fushigi/gl/Textures/GLImageCache.cs b/Fushigi/gl/Textures/GLImageCache.cs index 954cc073..eac99169 100644 --- a/Fushigi/gl/Textures/GLImageCache.cs +++ b/Fushigi/gl/Textures/GLImageCache.cs @@ -25,7 +25,7 @@ public static GLTexture GetDefaultTexture(GL gl) { //Default texture if (DefaultTexture == null) - DefaultTexture = GLTexture2D.Load(gl, Path.Combine("res", "DefaultTexture.png")); + DefaultTexture = GLTexture2D.Load(gl, Path.Combine(AppContext.BaseDirectory, "res", "DefaultTexture.png")); return DefaultTexture; } diff --git a/Fushigi/param/ParamLoader.cs b/Fushigi/param/ParamLoader.cs index 26e18815..fcda5a1c 100644 --- a/Fushigi/param/ParamLoader.cs +++ b/Fushigi/param/ParamLoader.cs @@ -15,7 +15,7 @@ public static void Load() mParams = new Dictionary(); var nodes = JsonNode.Parse( File.ReadAllText( - Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "res", "AreaParam.json") + Path.Combine(AppContext.BaseDirectory, "res", "AreaParam.json") ) ).AsObject(); ParamHolder areaParms = new ParamHolder(); diff --git a/Fushigi/ui/MainWindow.cs b/Fushigi/ui/MainWindow.cs index 06b9b1da..00781f04 100644 --- a/Fushigi/ui/MainWindow.cs +++ b/Fushigi/ui/MainWindow.cs @@ -56,11 +56,11 @@ public MainWindow() { mDefaultFont = io.Fonts.AddFontFromFileTTF( - Path.Combine("res", "Font.ttf"), + Path.Combine(AppContext.BaseDirectory, "res", "Font.ttf"), size, nativeConfig, io.Fonts.GetGlyphRangesDefault()); io.Fonts.AddFontFromFileTTF( - Path.Combine("res", "NotoSansCJKjp-Medium.otf"), + Path.Combine(AppContext.BaseDirectory, "res", "NotoSansCJKjp-Medium.otf"), size, nativeConfigJP, io.Fonts.GetGlyphRangesJapanese()); //other fonts go here and follow the same schema @@ -68,15 +68,15 @@ public MainWindow() try { io.Fonts.AddFontFromFileTTF( - Path.Combine("res", "la-regular-400.ttf"), + Path.Combine(AppContext.BaseDirectory, "res", "la-regular-400.ttf"), size, iconConfig, rangeHandle.AddrOfPinnedObject()); io.Fonts.AddFontFromFileTTF( - Path.Combine("res", "la-solid-900.ttf"), + Path.Combine(AppContext.BaseDirectory, "res", "la-solid-900.ttf"), size, iconConfig, rangeHandle.AddrOfPinnedObject()); io.Fonts.AddFontFromFileTTF( - Path.Combine("res", "la-brands-400.ttf"), + Path.Combine(AppContext.BaseDirectory, "res", "la-brands-400.ttf"), size, iconConfig, rangeHandle.AddrOfPinnedObject()); io.Fonts.Build(); diff --git a/Fushigi/util/ActorIconLoader.cs b/Fushigi/util/ActorIconLoader.cs index 44b07f0f..99db271c 100644 --- a/Fushigi/util/ActorIconLoader.cs +++ b/Fushigi/util/ActorIconLoader.cs @@ -18,8 +18,8 @@ public class ActorIconLoader public static void Init() { - string folder = Path.Combine("res", "actor_icons"); - string actor_icons_zip = Path.Combine("res", "ActorIcons.zip"); + string folder = Path.Combine(AppContext.BaseDirectory, "res", "actor_icons"); + string actor_icons_zip = Path.Combine(AppContext.BaseDirectory, "res", "ActorIcons.zip"); if (!File.Exists(actor_icons_zip)) return; @@ -38,7 +38,7 @@ public static void Init() public static int GetIcon(GL gl, string gyml, string model) { - string folder = Path.Combine("res", "actor_icons"); + string folder = Path.Combine(AppContext.BaseDirectory, "res", "actor_icons"); string icon_path = Path.Combine(folder, $"{gyml}.bfres_{model}.png"); if (Icons.ContainsKey(icon_path))