public static void Run() { // Load local mapping database Lumberjack.Log("Loading mapping database..."); _mappingDatabase = new MappingDatabase(Path.Combine(Program.BaseDirConfig, "mappings.db")); var assy = Assembly.GetExecutingAssembly().GetName(); Lumberjack.Info("Fabric Lightweight Obfuscation Remapping Assistant (FLORA)"); Lumberjack.Info($"Version {assy.Version} - parzivail"); Lumberjack.Info($"Source, issues and discussion: {"https://github.com/Parzivail-Modding-Team/FLORA".Pastel(Color.RoyalBlue)}"); Lumberjack.Info("Interactive Mode - \"help\" for commands, \"exit\" to quit."); // Enter read-eval-print loop InteractiveCommand command; do { command = GetCommand(); if (command == null) { Lumberjack.Error("Unknown command"); } else { command.Run(_mappingDatabase); } } while (!(command is ExitCommand)); }
private void OnScriptChanged(object sender, ScriptChangedEventArgs e) { Lumberjack.Info(string.Format(EmbeddedFiles.Info_FileReloaded, e.Filename)); var success = _terrainGenerator.LoadScript(e.ScriptCode); if (!success) { return; } _renderManager.Rebuild(); }
/// <inheritdoc /> public override void PrintAdvancedHelp() { Lumberjack.Log(GetCommandDescription().Usage); Lumberjack.Log(""); Lumberjack.Log("The mapsrc command is used to set which mappings are being used by the interactive"); Lumberjack.Log("environment. As a parameter, you can specify a Tiny v1 mapping file or a Yarn version"); Lumberjack.Log("string. If the latter is specified, the mappings will be saved to a local mapping"); Lumberjack.Log("database (mappings.db) for faster reuse of those mappings. If you do not have an"); Lumberjack.Log("internet connection, you are limited to using mappings in a provided Tiny v1 file or"); Lumberjack.Log("ones already cached in the database."); Lumberjack.Log(""); Lumberjack.Log("Examples:"); Lumberjack.Log(""); Lumberjack.Info("mapsrc 1.15.2+build.7"); Lumberjack.Info("mapsrc my_mappings.tiny"); }
/// <inheritdoc /> public override void PrintAdvancedHelp() { Lumberjack.Log(GetCommandDescription().Usage); Lumberjack.Log(""); Lumberjack.Log("The search command is used to find the mappings associated with the given named,"); Lumberjack.Log("intermediary, or official/obfuscated mapping. Searching by official/obfuscated names"); Lumberjack.Log("is only available for classes, as all classes' fields and methods first obfuscated"); Lumberjack.Log("name is the same, and there's a good chance any given query will return thousands of"); Lumberjack.Log("results."); Lumberjack.Log(""); Lumberjack.Log("Examples:"); Lumberjack.Log(""); Lumberjack.Info("search CowEntity"); Lumberjack.Info("search class_1430"); Lumberjack.Info("search ath"); }
/// <inheritdoc /> public override void PrintAdvancedHelp() { Lumberjack.Log(GetCommandDescription().Usage); Lumberjack.Log(""); Lumberjack.Log("The children command is useful to determine what methods, fields, and classes are"); Lumberjack.Log("defined explicitly as children of the given class. The class can be given in either"); Lumberjack.Log("the mapped form, the intermediate form, or the official/obfuscated form. For example:"); Lumberjack.Log(""); Lumberjack.Info("children MatrixStack"); Lumberjack.Info("children class_4587"); Lumberjack.Info("children cyl"); Lumberjack.Log(""); Lumberjack.Log("are all equivelant. The children listed will only be children that are explicitly"); Lumberjack.Log("defined in the target class. As such, fields, methods, and subclasses that are"); Lumberjack.Log("inherited from a superclass will not be shown unless they are overridden."); }
private void OnLoad(object sender, EventArgs e) { Title = $"{EmbeddedFiles.AppName} | {EmbeddedFiles.Title_Unsaved}"; Icon = EmbeddedFiles.logo; // Set up lights const float diffuse = 0.9f; float[] matDiffuse = { diffuse, diffuse, diffuse }; GL.Material(MaterialFace.FrontAndBack, MaterialParameter.Diffuse, matDiffuse); GL.Light(LightName.Light0, LightParameter.Position, new[] { 0.0f, 0.0f, 0.0f, 10.0f }); GL.Light(LightName.Light0, LightParameter.Diffuse, new[] { diffuse, diffuse, diffuse, diffuse }); // Set up lighting GL.Enable(EnableCap.Lighting); GL.Enable(EnableCap.Light0); GL.ShadeModel(ShadingModel.Smooth); GL.Enable(EnableCap.ColorMaterial); // Set up caps GL.Enable(EnableCap.DepthTest); GL.Enable(EnableCap.RescaleNormal); GL.Disable(EnableCap.Texture2D); GL.Disable(EnableCap.CullFace); // Set up blending GL.Enable(EnableCap.Blend); GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha); // Set background color GL.ClearColor(Color.FromArgb(255, 13, 13, 13)); // Init keyboard to ensure first frame won't NPE _keyboard = Keyboard.GetState(); _terrainGenerator = new CsTerrainGenerator(); _renderManager = new RenderManager(_terrainGenerator); _terrainLayerList = new RenderController(this); _terrainLayerList.Show(); _scriptWatcher = new ScriptWatcher(); _scriptWatcher.FileChanged += OnScriptChanged; Lumberjack.Info(EmbeddedFiles.Info_WindowLoaded); }
/// <inheritdoc /> public override void PrintAdvancedHelp() { Lumberjack.Log(GetCommandDescription().Usage); Lumberjack.Log(""); Lumberjack.Log("The yarnver command is used to determine the yarn versions that are applicable to"); Lumberjack.Log("the given game version. If no game version is provided, then all known yarn versions"); Lumberjack.Log("are shown, grouped by their applicable game version. Next to the Yarn version string,"); Lumberjack.Log("the maven ID is provided, and stable versions are denoted."); Lumberjack.Log(""); Lumberjack.Log("Examples:"); Lumberjack.Log(""); Lumberjack.Info("yarnver"); Lumberjack.Log("\tWill search all mappings"); Lumberjack.Info("yarnver 1.15"); Lumberjack.Log("\tWill search all mappings for 1.15.x"); Lumberjack.Info("yarnver 1.15.1"); Lumberjack.Log("\tWill search all mappings for 1.15.1"); }
public RenderManager(GameWindow window, CsTerrainGenerator generator) { _window = window; _generator = generator; _fgJobs = new ConcurrentQueue <IJob>(); _bgJobs = new ConcurrentQueue <IJob>(); _nvg = GlNanoVg.CreateGl(NvgCreateFlags.StencilStrokes | NvgCreateFlags.AntiAlias); _ui = new KuatWindow(window, new KuatFont("sans", 16)); KuatButton b; KuatKnob k; KuatIndicator i; _ui.Controls.Add(b = new KuatButton("bTest") { Location = new Point(50, 50), Size = new Size(60, 23), Text = "Button" }); b.Click += (sender, args) => { Lumberjack.Info("Click!"); }; _ui.Controls.Add(new KuatCheckbox("cbTest") { Location = new Point(50, 90), Size = new Size(14, 14), Text = "Checkbox" }); _ui.Controls.Add(k = new KuatKnob("kTest") { Location = new Point(50, 130) }); _ui.Controls.Add(i = new KuatIndicator("iTest") { Location = new Point(120, 130) }); k.ValueChanged += (sender, args) => { i.Lit = k.Value > 0; }; _ui.Controls.Add(new KuatTextBox("tbTest") { Location = new Point(170, 90), Size = new Size(120, 23), ForeColor = Color.Black }); var rMono = _nvg.CreateFont("mono", EmbeddedFiles.ibmplexmono); if (rMono == -1) { throw new ApplicationException("Unable to load mono font"); } var rSans = _nvg.CreateFont("sans", EmbeddedFiles.ibmplexsans); if (rSans == -1) { throw new ApplicationException("Unable to load sans font"); } _perfGraphFps = new PerfGraph(GraphRenderStyle.Fps, null, 40); _framebuffer = new Framebuffer(8); _framebuffer.Init(window.Width, window.Height); _framebufferUi = new Framebuffer(1); _framebufferUi.Init(window.Width, window.Height); _texRandom = LoadGlTexture(EmbeddedFiles.random); _shaderModel = new ShaderProgram(EmbeddedFiles.fs_model, EmbeddedFiles.vs_model); _shaderModel.Init(); _shaderScreen = new ShaderProgram(EmbeddedFiles.fs_screen, EmbeddedFiles.vs_screen); _shaderScreen.Init(); _workerHandle = new EventWaitHandle(false, EventResetMode.ManualReset); CreateChunks(); CreateScreenVao(); }
public static void PrintHelp(InteractiveCommandDescAttribute commandDescription) { Lumberjack.Info(commandDescription.Usage); Lumberjack.Log($"\t{commandDescription.QuickHelp}"); }
public BlockAtlas(MappingEngine mappings, int textureResolution) { Lumberjack.Debug("Generating texture atlas"); var pointers = new List <TexturePointer>(); var resolution = new Size(textureResolution, textureResolution); foreach (var set in mappings.Mappings) { if (set.Texture.Count == 0) { continue; } foreach (var texture in set.Texture) { if (texture.Contains(",")) { var subTextures = texture.Split(','); pointers.AddRange(subTextures.Select((subTexture, i) => new TexturePointer($"{set.Name}${i}", Path.Combine(set.TextureDir, subTexture), resolution))); } else { pointers.Add(new TexturePointer(set.Name, Path.Combine(set.TextureDir, texture), resolution)); } } } var size = 1024; var packed = Pack(size, size, pointers); if (!packed) { throw new ArgumentException("Failed to create texture atlas, atlas too small!"); } var srcTexRect = new Rectangle(0, 0, textureResolution, textureResolution); var bmpAtlas = new Bitmap(size, size); using (var gfx = System.Drawing.Graphics.FromImage(bmpAtlas)) { foreach (var pointer in pointers) { using (var bmpTexture = Image.FromFile(pointer.TexturePath)) gfx.DrawImage(bmpTexture, new Rectangle(pointer.Position, pointer.Size), srcTexRect, GraphicsUnit.Pixel); var minU = pointer.Position.X / (float)size; var minV = pointer.Position.Y / (float)size; var maxU = (pointer.Position.X + pointer.Size.Width) / (float)size; var maxV = (pointer.Position.Y + pointer.Size.Height) / (float)size; var blockname = pointer.TextureName.Split('$')[0]; if (!_atlas.ContainsKey(blockname)) { _atlas.Add(blockname, new BlockRenderData(mappings[blockname])); } _atlas[blockname].Textures.Add(new TexCoord(minU, minV, maxU, maxV)); } if (Program.Config.SaveAtlas) { bmpAtlas.Save("debugatlas.png"); Lumberjack.Info("Saved atlas as debugatlas.png"); } Texture = CreateTexture(bmpAtlas); } Lumberjack.Debug($"Packed {pointers.Count} x{textureResolution} textures in a {size}x atlas"); }