PixelPerfectEngine v0.11.0-alpha release
https://github.com/ZILtoid1991/pixelperfectengine/releases/tag/v0.11.0-alpha Two major changes are: 1) Implementation of the M2 format. Due to the lack of any proper MIDI2.0 formats, I decided to implement my own, and also added some additional function which allows it to be used for adaptive soundtracks via scripting. Sometimes I call it a "Turing-complete MIDI file" as a joke. Some functions are missing, such as most of the macros that would allow it to function as a de-facto high-level scripting language, with a syntax similar to Lua, alongside with a lot of assembly-like instructions. 2) Removal of the Lua scripting engine. It had hard-to-debug errors, issues I resolved previously reappearing even though the fix were still in place, etc. It'll be replaced with something better, likely a VM that will allow it to execute scripts written in various languages. I'd prefer to use a preexiting VM, with QScript's VM being a potential candidate, especially since I have other things to work on. M2 technically has a VM, and reusing the experiences with it would be useful for implementing my own, but I have limited time and other more important features to implement. The final 0.11.0 version will have: * A better file dialog (a major headache inducing bug were already fixed). * Resizable windows. * Resampling to higher sample rates. * Better path handling (currently it's very fragile, and tries to look for assets in whatever folder the user runs the engine from). * Logging. * I'll try to replace SDL with my own solution, iota. It already has some preliminary x11 support, legacy Windows IO works, but it's really hard to look up stuff, and many instead suggest people to use either some bloated libraries that feature stuff even the C standard library has, and/or has a very legacy-style input/output handling (DirectInput and not rarely DirectAudio use instead of their more modern counterparts, etc). SDL has a lot of issues with documentation, bloat, etc. * I'll also try to finally get the file compression for assets working. I created the format DataPak, with has some tricks to both speed up and lower the size compared to other solutions, by using the dictionary compression mode of ZStandard (requires the use of uncompressed bitmaps: compressing PNGs would be really slow and ineffective, since they're already compressed with the older ZLib algorithm).
Struct value either resets, or not getting passed correctly
https://github.com/ZILtoid1991/pixelperfectengine/blob/ed93bec15deea042516615e73c57d137a2c1f762/pixelperfectengine/src/pixelperfectengine/scripting/lua.d#L98 Struct `LuaVar` seems to work for the most part, however, at certain point, the value seems to be reset to zero, or not being passed to the target function. ```d staticMap!(Unqual,Parameters!Func) params; int stackCounter = 0; try { foreach_reverse(ref param; params) { stackCounter--; param = luaGetFromIndex!(typeof(param))(state, stackCounter); } } ``` My theory is, that if `typeof(param)` is `LuaVar`, I'm missing some extra steps I'm not doing. Other types of data seem to get through, or at least according to me poking around with debuggers.
Re: Visual Studio 2022 no longer debugs D program, need an alternative debugger for Windows
On Saturday, 26 August 2023 at 17:57:22 UTC, jmh530 wrote: You should report this to bugzilla. I'm using it in an unusual way. Since VisualD does not support dub, I have to rely on VSCode as my main editor, then load the executable in an empty C++ project in VS. This worked so far. On the other hand, I'm having some good results with x64dbg, except I don't know how can I get locals to be displayed (which is the x64dbg is capable of, except all tutorials for it is about reverse engineering).
How can I restrict a library to be only included under a certain OS?
I added this line to my SDLang formatted dub build file: ``` dependency "libx11" version="0.0.1" platform="posix" ``` Yet it's included even on Windows, even if I change it to "linux". Since there's a fatal bug in the library that disallows it to be built, I'll be leaving it out for now, and instead move onto something else, or try to issue a correction.
Re: Using Windbg to debug D applications and unittests
On Saturday, 25 February 2023 at 19:55:27 UTC, evilrat wrote: Nothing happens without a reason, check your project settings and make sure that for debugging you have correct paths, command, and arguments. Even with no debug info and no project you can just drop an executable to an empty VS window and start debugging it, at the very least it can show disassembly. If there is .pdb files with debug info next to your executable you can just drag and drop your D source files and then add breakpoints in that source files and it will work. Well, it was that. I'll try to get GDB running, since I got so fed up with MS's own debuggers.
Re: Using Windbg to debug D applications and unittests
On Saturday, 25 February 2023 at 18:08:57 UTC, evilrat wrote: Turn on exception settings panel in top menu bar: Debug->Windows->Exceptions Settings (Crtl+Alt+E) My settings for D is full "D exceptions", under Win32 check "D Exception", or just click "Restore to default settings" in there on top of that panel. Well, VS turned to be even less cooperative than before. Now it only loads and runs a specific old version of an EXE file. I'm asking around for other debuggers, I'm definitely moving to another.
Re: Using Windbg to debug D applications and unittests
On Saturday, 25 February 2023 at 16:22:49 UTC, evilrat wrote: VisualD for Visual Studio provides some extra help with displaying your data in debugger and on Windows is the best you can get for D. You can use Visual Studio Code + code-d to debug, but it is not as good as full Visual Studio counterpart. Anyway you can use LDC with -gc flag to improve this situation a bit as it will mimic C++ debug info that is more compatible with said debuggers than D one. I used to use Visual Studio, but I forgot how to set it up properly to break on handled throws. Now it doesn't do anything if throws are handled in any fashion, and I can't find an option to change it (it was removed maybe?).
Using Windbg to debug D applications and unittests
I had a lot of trouble trying to get Visual Studio to catch handled exceptions, which would have been mandatory for debugging unittests, but I either forgot how to do it, or something have changed in either the newer versions of VS or the D compilers I use (LDC, DMD). So I downloaded the new WinDbg Preview, which is like the older WinDbg but with some new features and a new GUI. This would also allow me (in theory) to get rid of VS in the future or only keep it for other projects. So far I struggle to set up breakpoints that actually work and doesn't just step over them. It also doesn't like templates, especially if there's multiple instances of them. (Also I couldn't find any way to break on exceptions so far.)
PixelPerfectEngine-0.10.0-beta.7 released
https://github.com/ZILtoid1991/pixelperfectengine/releases/tag/v0.10.0-beta.7 This version is okay for production, even if certain functionalities are either untested or unimplemented. For the next version, I'll finish as much of them as possible, as well as try to deprecate SDL2 in favor of my own, D language native solution, iota.
Re: Release of iota 0.3.0-alpha done
On Monday, 14 November 2022 at 22:55:56 UTC, ikelaiah wrote: Thanks and congrats for the latest alpha release. How can I donate to this project? -Ikel Monetary (recurring): https://www.patreon.com/ShapeshiftingLizard Monetary (one time): https://ko-fi.com/shapeshiftinglizard Alternatively, you can donate your own work, either working on implementing features, or even by reporting bugs.
Release of iota 0.3.0-alpha done
https://github.com/ZILtoid1991/iota/releases/tag/v0.3.0-alpha Intended as a D language native replacement for SDL/SFML/GLFW, now is starting to become a minimum viable alternative. Now it can support input polling and some windowing under Windows. OpenGL framebuffer support started but not yet completed (only applicable if your application don't already has one), and Linux support for these haven't yet started. Also I would appreciate some help, especially with Mac (and maybe mobile) support.
Re: How can I get the "owner" of a method?
On Friday, 30 September 2022 at 22:20:06 UTC, Salih Dincer wrote: Maybe this will help you: ```d template Bar(T) { void fun() {} } class Foo(T) { mixin Bar!T b; alias fun = b.fun; void test() { fun(); } } ``` SDB@79 The issue with that is in that case is instead of writing boilerplate I'll have to rewrite already existing functions. Currently, to make objects compatible with Lua in some way, I have to write functions like this: ```d package void scrollLayer(void* target, int x, int y) { Layer l = cast(Layer)target; l.scroll(x, y); } ``` This is very time consuming, and some automated method would be preferred where it can be done (some manual stuff will be done of course), then I can further automate it by using user attributes.
How can I get the "owner" of a method?
Let's say I have a class or an interface with a function, and I want to pass that to a template to generate another function (in this case one that passes it to a scripting engine, and allows it to be called from there). Currently I have the following issues: 1. I have to pass the class/interface type to the template, and I cannot find anything about how to solve this issue. 2. It also doesn't work at the moment, as it wants to call the member `Func` (name of the template argument) rather than the Function described as such. (There's also probably in std.functional I don't know about) Code: ```d extern (C) public int registerDDelegate(alias Func, ClassType)(lua_State* state) nothrow if(isSomeFunction!(Func)) { import std.traits:Parameters, ReturnType; Parameters!Func params; int stackCounter = 0; stackCounter--; ClassType c = luaGetFromIndex!ClassType(state, stackCounter); try { foreach_reverse(ref param; params) { stackCounter--; param = luaGetFromIndex!(typeof(param))(state, stackCounter); } } catch (Exception e) { luaL_error(state, "Argument type mismatch with D functions!"); } try { static if(is(ReturnType!Func == void)) { c.Func(params); return 0; } else static if(is(ReturnType!Func == struct)) { auto retVal = c.Func(params); static foreach (key ; retVal.tupleof) { LuaVar(key).pushToLuaState(state); } return cast(int)retVal.tupleof.length; } else { LuaVar(c.Func(params)).pushToLuaState(state); return 1; } } catch (Exception e) { //luaPushVar(L, null); lastLuaToDException = e; try { luaL_error(state, ("A D function threw: "~e.toString~"!\0").ptr); } catch(Exception e) { luaL_error(state, "D threw when stringifying exception!"); } return 1; } } ```
Why this function just decides to not call another function and do its thing instead?
Code found here: https://github.com/ZILtoid1991/newxml/blob/main/source/newxml/domimpl.d#L1984 Even changing the code to this: ```d auto res = firstAttr; while (res) { if (res.localName != localName || res.namespaceURI != namespaceURI) res = res._nextAttr; else break; } return res; ``` Does not always seem to call this: https://github.com/ZILtoid1991/newxml/blob/main/source/newxml/domstring.d#L252 And then instead just decides that the `localName` and `namespaceURI` pairs are not equal, and in those cases the Visual Studio debugger doesn't detect any entering into any of the `DOMString.equals` overrides, all while the debugger shows those strings are equal.
Is it valid in D to write an opSlice overload that takes no arguments?
Here's this code: ```d auto opSlice() { struct Range { Attr currentAttr; auto front() { return currentAttr; } void popFront() { currentAttr = currentAttr._nextAttr; } bool empty() { return currentAttr is null; } } return Range(firstAttr); } ``` This was originally in std.experimental.xml in `domimpl.d`, and it causes LDC to segfault, but compiles fine under DMD.
Re: Initial release of newxml done!
On Sunday, 11 September 2022 at 07:13:18 UTC, WebFreak001 wrote: awesome! got some documentation or examples anywhere? Can't really seem to find how to use it really, but will definitely be useful when I do stuff with xml. Documentation is a work in progress. I'll try to make some examples with it (especially since I was also in need of an XML library), until then the best I can say is that if you only need DOM, then just use the example in the readme file to generate the document, and rely on the official DOM documentations since it's pretty much the same thing. I'll be slowly going through the code to improve readability and stuff, which will also mean I'm going to add range capabilities and such where it doesn't exist.
Re: Initial release of newxml done!
On Friday, 9 September 2022 at 22:00:42 UTC, solidstate1991 wrote: https://github.com/ZILtoid1991/newxml/releases/tag/v0.2.0 It's a heavily modified `std.experimental.xml` with the following changes: * Many templating have been removed in favor of other forms of setting. This means the allocators have been axed in favor of using `new` and relying on D's automatic garbage collection. * Has a proper DOMString implementation. This might make a few things a bit slower, but also simplified things. * Has way more error handling than the original, and at parsing time (More will be added down the line). * And of course, it's being actively developed. DOM compatibility means that anyone who worked with any other DOM implementation (C++, Java, Python, JS, etc.) will be immediately familiar with it. For SAX, I went after my own head, and before 1.0, I can still change it if I need based on user feedback. I might also port `legacy.d` for those who used to use the old `std.xml` implementation. Just found an error. It crashes the LDC2 compiler while compiling just fine under DMD, likely a compiler bug.
Initial release of newxml done!
https://github.com/ZILtoid1991/newxml/releases/tag/v0.2.0 It's a heavily modified `std.experimental.xml` with the following changes: * Many templating have been removed in favor of other forms of setting. This means the allocators have been axed in favor of using `new` and relying on D's automatic garbage collection. * Has a proper DOMString implementation. This might make a few things a bit slower, but also simplified things. * Has way more error handling than the original, and at parsing time (More will be added down the line). * And of course, it's being actively developed. DOM compatibility means that anyone who worked with any other DOM implementation (C++, Java, Python, JS, etc.) will be immediately familiar with it. For SAX, I went after my own head, and before 1.0, I can still change it if I need based on user feedback. I might also port `legacy.d` for those who used to use the old `std.xml` implementation.
Re: Tracing out error that causes compiler crash
I tried to compile on the Raspberry Pi 400, now I'm getting segmentation fault during compilation with LDC. Still no idea what causes it, nor how to reduce it. Moved the codebase to a new repository, gave it a proper DOMString implementation instead of using it as a template name, and I'm still getting no luck compiling it. Current link: https://github.com/ZILtoid1991/newxml I might try to comment out the bodies of the functions and force them to return an initial value, to see if there's something wrong with the insides of the functions.
Re: Tracing out error that causes compiler crash
On Sunday, 4 September 2022 at 08:17:13 UTC, Nick Treleaven wrote: You may be able to use dustmite to automatically reduce the code to a minimal test case: https://dlang.org/blog/2020/04/13/dustmite-the-general-purpose-data-reduction-tool/ Send my regards to the planet smasher. What do I pass as the tester?
Tracing out error that causes compiler crash
During unittest in my own fork of std.experimental.xml (link: https://github.com/ZILtoid1991/experimental.xml ), potentially an error so severe is present, that it causes to crash the compiler (both DMD and LDC2, on Windows). I was able to separate the issue by commenting out all unittests, then re-enabling them one-by-one seeing when it crashes the compiler, but wasn't able to track down the issues. However, `domimpl.d` is a 2000+ line monster, with a huge templated class that nests multiple other classes. I suspect that there's some leftover from the stripped configurable allocator and/or error handler, that causes the issue. At worst-case scenario, I can just manually rewrite the whole part (I already planned to write a more linear cursor for speed reasons), but that will consume a lot of my time. A lot of part of the code is already undocumented (especially anything non-public), so it's a question whether reimplementing stuff from almost zero, or trying to decipher a legacy code is the easier stuff.
Re: Window created with Windows API is not visible
It seems I solved most of the problems by modifying event handling. I'll continue solving further ones and adding more functionality.
Re: Window created with Windows API is not visible
On Saturday, 18 June 2022 at 22:46:45 UTC, rikki cattermole wrote: registeredClass.style = 32_769; Don't use an integer like that, stick with bit wise ors. LPCWSTR classname = toUTF16z(name); GC owned memory, that could result in surprises. const LPWSTR windowname = toUTF16z(title); Ditto I'm not sure your window callback procedure is right. For instance you are not calling DefWindowProc, and you are not handling WM_PAINT in any form. But one other thing, your approach to the event loop is going to come back to bite you at some point. Windows is based around a push event loop model, not a pull like other system Windowing libraries (such as X11). It can get recursive. I learned this one the hard way. Well, it seems like my window callback wasn't right. Now at least I get whiteness instead of nothing. This is going to be a long match.
Re: Window created with Windows API is not visible
On Saturday, 18 June 2022 at 21:33:31 UTC, Vinod K Chandran wrote: It seems that you are created a layered window. So chances are there to it become translucent. Did not set the flags for the layered window style, so I don't know. Might be an event processing error, since in Windows it's a mess.
Window created with Windows API is not visible
Code: https://github.com/ZILtoid1991/iota/blob/main/inputtest/app.d https://github.com/ZILtoid1991/iota/blob/main/source/iota/window/base.d#L104 Second one contains the constructor that should make the window without any issues. When I try to create a window for testing purposes, I get nothing besides of an icon on the taskbar. Once I was able to get a quite broken window to show up, then it doesn't showed up anymore. Calling the API function `IsWindowVisible` returns true.
Re: A New Game Written in D
On Tuesday, 17 May 2022 at 16:36:34 UTC, Kenny Shields wrote: Hello, I've been building a game engine in D for the past 2 and a half years and have finally reached a point where it's usable in day-to-day game development. Earlier this year I decided to make a simple shooter game to serve as a tech demo for the engine's capabilities, and also just to get a general idea of how well it works when used in a real application. I did an initial release of the game yesterday on itch.io, you can find more information on the product page if you are interested: https://kenny-shields.itch.io/untitled-shooter-game This isn't an open-source project, but I wanted to post this here for anyone who might be interested in seeing D used for cross-platform game development. Any questions/comments about the implementation and design of the game/engine are welcome. On a side note, I'd like to give special thanks to Walter and all of you who who contribute to D to make it what it is today. D is a fantastic language and really can't see myself using anything else for development at this point. Also, shout-out to the LDC developers as well, really great compiler. It's pretty cool, however I can suggest you to improve the controls. It's pretty easy to get struck on walls, character can only go forward (or there's something really wrong on my end), menus are a bit confusing, etc. I'm also a game developer, working on an engine (PixelPerfectEngine) and a lot of open-source libraries intended for game and app development (latest is iota, a D language native input-output handling library, currently stuck with window management). I'm also working on my first game, although a lot of my time and energy getting wasted on an underpaid day-job.
Re: PixelPerfectEngine v0.10.0-beta.5 : Now with a synth
On Thursday, 24 February 2022 at 17:36:49 UTC, Salih Dincer wrote: On Thursday, 24 February 2022 at 13:15:50 UTC, Salih Dincer wrote: Is there anything I can do for this problem? I solved it using the following commands having two parts: * sudo apt-get -y install libasound2-dev * dub build :windowmakerforconcrete --compiler=ldc2 --force `:test1` will give you access to the synth's tester app (currently have a very limited set of features only). Also you might want to check out my editor for the engine, called "PixelPerfectEditor".
PixelPerfectEngine v0.10.0-beta.5 : Now with a synth
https://github.com/ZILtoid1991/pixelperfectengine/releases/tag/v0.10.0-beta.5 After I created my own IO library that has audio features that are easier to interoperate with D code (iota), I decided to finish up my phase modulation (often sold as either frequency modulation or phase distortion too by some brands, with minor tweaks to the underlying math to avoid patent infringement) synthesizer for my game engine. This one uses a simplified math with fixed-length wavetables (can be user supplied too), highly configurable envelops, and has up to 16 voice polyphony if 2 operator mode is used for all channels (8 if channels are combined). It can even do resonant waveforms with some tricks (modulating a sine wave with a triangle wave). Why write a synth when you can just play MP3 and WAV files? 1) The very same teacher whose class I made the original (and very bad) version of the engine for just suggested this to me at the time. 2) Seemed like an easy undertaking, and in some ways it was, except for the fact I needed to work on multiple things too. Hardest was the finetuning of the math with this kind of language. 3) This way, adaptive soundtracks are easier to do if I or someone else using this engine decides so. Future plans include more testing and fixing + implementing functions I didn't have time for, and porting it to VST too as I don't have the capacity to write a fully-featured DAW (someone maybe?) with a real polyphonic mode instead of the current 1-voice-per-channel solution. Maybe I'll even create a more upmarket version that is better suited for musicians if there's demand. Also I'm yet again looking for team members on a gamedev team, but now I have some experience and I plan to "go commercial" with a coop later on.
First release of the iota library have been released (also looking for contributors)
iota, an I/O library that currently only has audio stream support under Windows has been finished. The library itself can be seen as a partial, D language native replacement of SDL, SFML, and other similar libraries. I begun writing it after I got dissatisfied with SDL and libsoundio, then Adam D Ruppe saying it's actually quite easy to write your own audio library. I mostly did it under one week (except for the time I've been waiting my commit on an already existing WASAPI library to be accepted, and instead I had to just put it into my code). I'm also looking for contributors, as it would be nice to add other OSes, APIs, etc, but my capacity is quite limited, and I don't have access to a Mac, some hardware, etc. https://github.com/ZILtoid1991/iota
Re: Thread exits immediately with no reason.
On Tuesday, 21 December 2021 at 19:00:01 UTC, solidstate1991 wrote: Well, it seems like it's an error on the WASAPI side. I totally disabled error handling (including the switch-case thingy), then GetBuffer returns with an error code indicating buffer is too large. The solution was to call `ResetEvent()` on the event handle, then to tinker a little bit with destructors, etc.
Re: Thread exits immediately with no reason.
Well, it seems like it's an error on the WASAPI side. I totally disabled error handling (including the switch-case thingy), then GetBuffer returns with an error code indicating buffer is too large.
Re: Thread exits immediately with no reason.
On Tuesday, 21 December 2021 at 01:13:10 UTC, Ali Çehreli wrote: I bet it's throwing an Error. Call your thread entry function from a try-catch wrapping function to see whether that's the case: // Rename existing function: protected void audioThreadImpl() @nogc nothrow { // ... } // New function protected void audioThread() @nogc nothrow { try { audioThreadImpl(); } catch (Error err) { stderr.writefln!"ERROR: %s"(err); } } That should print a call stack. You can catch Throwable instead of Error but with nothrow, it's guaranteed that it's not an Exception. Note: nothrow means "does not throw Exception". Errors can still be thrown. Ali I couldn't add those lines unfortunately, but I do get an exception in a destructor at line 218 of `wasapi.d`. It's access violation executing a location.
Thread exits immediately with no reason.
Here's this function, which serves as a thread entry point: https://github.com/ZILtoid1991/iota/blob/main/source/iota/audio/wasapi.d#L220 The problem is, that even with disabling all error-handling that would allow to shut down the thread safely, the thread only runs that while loop once. However, if I set my debugger to have a breakpoint right at the loop entry it can kinda loop, however the real-time capabilities cease to work properly. I'm using this handy application to debug my library: https://github.com/ZILtoid1991/iota/blob/main/testsource/app.d#L54 After the referenced line (where I start my audio thread) I also set the main program to wait 10 seconds. At least the audio thread just exits for some reason instead of being suspended by Thread.wait().
How can I check a newly set ref value
Let's say I have something like this: ``` struct Foo { int[] bar; this() { bar.length = 10; } ref int opIndex(size_t i) { return bar[i]; } } void main() { Foo f = Foo(); f[3] = 15; } ``` If I wanted to check whether the assigned value is within a range, and I want to throw a certain exception if outside of it, then how I can do that?
Re: std.format doesn't want to work
On Sunday, 17 October 2021 at 13:03:46 UTC, jfondren wrote: then it's likely that some memory corruption prior to format() has broken the GC, and format's allocation of a string is what's failing. Try sprinkling `@safe` and and see what it complains about; try valgrind; try reducing your problem. I don't think we can help you more without a way to replicate the fault. I ran Valgrind, and I've noticed some possible leakage in a library I've written, but I'll check for it further once I'll have a bit more time.
Re: std.format doesn't want to work
On Sunday, 17 October 2021 at 05:22:17 UTC, russhy wrote: On Saturday, 16 October 2021 at 22:47:09 UTC, solidstate1991 wrote: When I make this call ``` format(" %3.3f"w, avgFPS); ``` my program immediately crashes with an access violation error. The debugger out is different between x86 and x86-64. I've made all sanity checks, so I need some other suggestions. what is the type of avgFPS? I's a double, but I've tried to pass it as real and float too, with the same exact error being generated.
std.format doesn't want to work
When I make this call ``` format(" %3.3f"w, avgFPS); ``` my program immediately crashes with an access violation error. The debugger out is different between x86 and x86-64. I've made all sanity checks, so I need some other suggestions.
Registering-unregistering threads
I'm doing some audio-related work, and one thing I need is to unregister from (and maybe later temporarily re-register to) the GC, since it would cause some issues, and it would be nice if I still could use the GC during disk operations, etc. Info on it is quite scarce and a bit confusing. If I unregister from the RT, will that mean it'll be GC independent, or will have other consequences too?
Re: Unknown bug disallows growth of dynamic arrays
On Monday, 28 June 2021 at 20:55:44 UTC, solidstate1991 wrote: Here's the offending function: https://github.com/ZILtoid1991/collections-d/blob/master/source/collections/sortedlist.d#L38 It causes to throw an exception with `Access violation reading location` and a memory address, int the function `_d_arraysetlengthT`. Variable `ti` is a TypeInfo_Array, `value` of this object is null. Error happens when adding a sprite in this class: https://github.com/ZILtoid1991/pixelperfectengine/blob/master/pixelperfecteditor/src/app.d#L64 However, the same doesn't happen when the editor is being run. Since leaving out any addition of sprites causes errors elsewhere, I was thinking that it might be a memory leakage issue. Could memory leakage cause such errors when attempting to grow or shrink arrays? It seems I could solve the issue with the reserve() function, and it occurred twice so far. I often have to disable bounds checking, since it takes up precious CPU cycles, instead I do it in an "at once" fashion rather than per-index access, and need to be done in such fashion with the graphics rendering functions I made.
Unknown bug disallows growth of dynamic arrays
Here's the offending function: https://github.com/ZILtoid1991/collections-d/blob/master/source/collections/sortedlist.d#L38 It causes to throw an exception with `Access violation reading location` and a memory address, int the function `_d_arraysetlengthT`. Variable `ti` is a TypeInfo_Array, `value` of this object is null. Error happens when adding a sprite in this class: https://github.com/ZILtoid1991/pixelperfectengine/blob/master/pixelperfecteditor/src/app.d#L64 However, the same doesn't happen when the editor is being run. Since leaving out any addition of sprites causes errors elsewhere, I was thinking that it might be a memory leakage issue. Could memory leakage cause such errors when attempting to grow or shrink arrays?
Re: PixelPerfectEngine v0.10.0-beta.1 release + looking for a team
On Tuesday, 18 May 2021 at 09:19:30 UTC, Anton Pastukhov wrote: Does it have a website/docs? Are there any demo games? There's a few demo games in the works, but first I have to fix bugs in the editor. For docs, see the source. Except for stuff I forgot to document for a quite long time, it should be quite well documented. There's also a few .md files there, such as on the mapformat, and I might make a user manual most likely in .md files (I suck at HTML, and even more at HTML5). Maybe I should bring a USB keyboard to work for my phone, so I can do it there.
PixelPerfectEngine v0.10.0-beta.1 release + looking for a team
https://github.com/ZILtoid1991/pixelperfectengine/releases/tag/v0.10.0-beta.1 https://ziltoid1991.itch.io/pixelperfecteditor The new release contains the refactored and cleaned-up GUI subsystem, a new input subsystem, more composing functions, etc. Also, since I got a full-time job, I have limited time to work on my software development projects, especially my engine, which grew pretty complex. I would like to have a few testers at least. I cannot provide any financial compensation, however I do plan to take game development in D to the next level (most likely this very same engine), so I might count you into my project. I also looking for other kind of creatives, mainly pixel artists, but I guess this is not the place for that.
Re: How to specify an exact template?
Well, it's quite complicated to do. I have to manually unwrap each and all function template, then pray for the compile-time optimization gods that they'll be inlined. This is so annoying, that I might issue a DIP...
Re: How to specify an exact template?
On Saturday, 16 January 2021 at 14:18:55 UTC, Tove wrote: probably you can use https://dlang.org/spec/traits.html#getOverloads I don't know how to use it with functions outside of structs/classes.
Re: How to specify an exact template?
On Saturday, 16 January 2021 at 14:13:29 UTC, solidstate1991 wrote: Here's the following line, among many others: return !(ubyte); This generates an error, as this function template matches two instances, but currently I don't know how to choose the one I need, other than write a local function, that looks a bit ugly. Forgot to link the code example: https://github.com/ZILtoid1991/pixelperfectengine/blob/master/pixeperfectengine/src/PixelPerfectEngine/graphics/layers/base.d#L143
How to specify an exact template?
Here's the following line, among many others: return !(ubyte); This generates an error, as this function template matches two instances, but currently I don't know how to choose the one I need, other than write a local function, that looks a bit ugly.
PixelPerfectEngine v0.10.0-beta released - editor is also now on itch.io
https://ziltoid1991.itch.io/pixelperfecteditor https://github.com/ZILtoid1991/pixelperfectengine/releases/tag/v0.10.0-beta My next goal will be refactoring the GUI subsystem (with hopefully fixing many rendering bugs), then add even more features to the editor/engine.
Re: opApply and attributes
On Tuesday, 14 July 2020 at 00:17:14 UTC, solidstate1991 wrote: Something like that, but with @safe, pure, etc. attributes. I've tried to "bruteforce" it by generating functions with combinations of attributes, and it kinda works, but is a very janky solution. I'll brainstorm some DIP to fix this issue.
Re: opApply and attributes
On Tuesday, 7 July 2020 at 20:53:05 UTC, Ali Çehreli wrote: I am not sure whether I understand it correctly but there has been a request for opApply() to gain the attributes of the delegate (or the range?). In other words, "transfer the attributes to opApply". This is needed because I want opApply() to work with any foreach body, attributes of which opApply() cannot know. I am sure I created an issue on Dlang bug tracker for Weka on this topic but I can't find it now. (Aside: The search boxes on the bug tracker are inferior to the automatic search feature that works when creating a bug.) Anyway, this one seems related: https://issues.dlang.org/show_bug.cgi?id=7543 Ali Something like that, but with @safe, pure, etc. attributes.
Re: opApply and attributes
On Tuesday, 7 July 2020 at 13:33:41 UTC, Paul Backus wrote: You can make opApply a template: int opApply(Dg)(Dg dg) if (is(Dg : scope int delegate(ref E))) { // etc. } Because `scope int delegate(ref E) @safe` implicitly converts to `scope int delegate(ref E)`, this version will accept both @safe and non-@safe delegates. (And likewise for the other function attributes.) Unfortunately this doesn't really work, even with explicitly defined foreach arguments.
opApply and attributes
See implementation of data structure here: https://github.com/ZILtoid1991/collections-d/blob/master/source/collections/treemap.d#L565 If I try to compile this code, it'll fail, limiting it's usecase: @safe pure unittest { alias IntMap = TreeMap!(int, int, false); IntMap test; test[5] = 5; test[7] = 7; test[3] = 3; foreach(elem, key; test) { assert(elem == key); } } I know that implementing foreach with other means do exist, and I used them in my other data structures, but it's much more difficult (and potentially slower) to implement that within a binary search tree. Should I change the `opApply` into the `popfront` - `front` - `empty` trinity, or write a template that overrides all the potential attribute combinations? Maybe D needs a template for attributes somehow, or something like that.
Re: Post: Why no one is using your D library
On Thursday, 2 July 2020 at 14:56:09 UTC, aberba wrote: Why no one is using your D library So I decided to write a little something special. Its my love letter to D folks. https://aberba.vercel.app/2020/why-no-one-is-using-your-d-library/ Thanks, I'll try to write better documentation for my packages, maybe even rename my "bindbc" stuff so Mike Parker won't get harassed for my own stuff (bindbc-zstandard and bindbc-jsl).
Re: A custom name for variables
On Thursday, 28 May 2020 at 20:26:55 UTC, Quantium wrote: I need to create a variable with custom name, like this import std; void main() { string name; readf(" %s", ); // some code that generates a variable of type integer and value 0 } Could you help me with that? This might be possible in certain scripting languages, but not in D. Static fields are generated during compile time, and while something like that is possible using template mixins in the code (famous use in D is Phobos's bitfields, which generates properties for a struct or a class), it's impossible during runtime, and - in extension - by reading a value from console.
Re: DIP 1028 "Make @safe the Default" is dead
On Friday, 29 May 2020 at 04:53:07 UTC, Walter Bright wrote: The subject says it all. If you care about memory safety, I recommending adding `safe:` as the first line in all your project modules, and annotate individual functions otherwise as necessary. For modules with C declarations, do as you think best. For everyone else, carry on as before. Can we get a compiler flag that will enable safe by default for people who might want it?
Re: Linker error under Ubuntu
On Friday, 15 May 2020 at 03:46:57 UTC, evilrat wrote: Um, pardon the stupid question, but did you just forgot to link it? I can't see a mention of it anywhere in both the old json and dub.sdl, and I don't see subpackages either. (does it links implicitly by the compiler?) Also if it's digged up somewhere, another possibility is the link order issue(you need to put libs in order that adds linker symbols for previous libs to consume, for circular dependencies you can specify libs multiple times). The MS linker and LLVM linkers(not sure about GNU gold) does some work for you so you don't have to reorder libs most of the time. Dub should do the linking by itself.
Linker error under Ubuntu
When I try to compile my own project under Ubuntu with dub, I get the following linker error: /usr/bin/ld: .dub/obj/pixelperfectengine_pixelperfecteditor.o: undefined reference to symbol 'inflateEnd' //lib/x86_64-linux-gnu/libz.so.1: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status Error: /usr/bin/gcc failed with status: 1 /usr/bin/ldc2 failed with exit code 1. I've checked for zlib and it was already preinstalled. I tried to install LLD, but that didn't help. The latest version of my project found here: https://github.com/ZILtoid1991/pixelperfectengine
Re: Fixing race issues the right way
On Sunday, 5 April 2020 at 22:33:50 UTC, Stefan Koch wrote: Look at your program in a debugger and see if it does spawn threads. If it does find out where and why they are spawned. Thanks for the answer, but it seems the issue was the lack of the ability of unittesting such a large package. So I broke out collections-d similarly to other projects.
Fixing race issues the right way
My game engine is currently broken due to some race issue I don't really know how to resolve. It seems that the compiler tries to skip instructions that are not locked with a `writeln()` or something similar. Usually I can safely remove the writeln after compiling it once with that way. However I've once ran into an issue when a previously working code just started to emit random junk data depending on CPU usage, and in that case the aforementioned workaround only partially worked (delaying crashes, etc). I've heard something about Mutex, however I lack the experience with multithreading.
PixelPerfectEngine 0.9.4 - now with a (barely) working editor
It took me some headaches (especially as some errors were due to hard to spot typos), but finally I got the editor working after a lot of refactoring and no direction. https://github.com/ZILtoid1991/pixelperfectengine/releases/tag/v0.9.4 Future plans: - better version numbering - better planning (with the next step being bugfixes only) - bugfixes (needs a lot of testing, and I'm only a single person) - creating a sample game, and maybe something more serious in the future - either using a preexiting audio plugin system for stuff, or creating a new one with better planning - getting datapak working, so assets can be packed into files
Re: How to debug in vscode Windows?
On Wednesday, 1 January 2020 at 14:46:01 UTC, NaN wrote: You can use visual studio (works in 2019, havent tried earlier versions) to debug any exe you want. You do this... Go to File menu, then Open, then Project/Solution Make sure "all project files" is selected, then find the exe you want to debug, click Open. Now you can debug that exe inside Visual Studio (as long as its been compiled with debug info) You can also save the solution so next time you just open the solution and you're ready to debug. You can drop source files into visual studio and set breakpoints, but it will also automatically pull up the source when it hits an exception. Although you might need adjust VS settings so it breaks on all exceptions IIRC... explains how on this page... https://docs.microsoft.com/en-us/visualstudio/debugger/managing-exceptions-with-the-debugger?view=vs-2019 Its pretty much all working, except you cant see dynamic array contents and occasionally it steps a line out of sync. I never managed to get any debugger working in VSCode. But this way you get the Visual Studio debugger which as good as it gets, and its just a couple of clicks away. Oh I'm using LDC to compile so I'm not sure how well it works with DMD, haven't tried, but should work the same I imagine. I usually just make an empty project and set up the exe file to the one that dub creates instead.
LLD-link doesn't work, how do I change linkers?
I cannot do any work, since LLD-link is broken and doesn't want to link for anything. It just gives me a bunch of errors for missing symbols, that supposed to be in the core libraries. How can I set up the Microsoft linker instead?
"Mixin is not defined" error when trying to use template mixins
There's a template mixin in my dimage project's new version in base.d, and when I try to access it from another file I get two errors: undefined identifier `ChunkyAccess4bit`, did you mean template `ChunkyAccess4Bit()`? and mixin `dimage.tga.TGA.ChunkyAccess4bit!()` is not defined Should I put the template into the base class of TGA (Image) instead of keeping it outside of that?
Re: I've created a binding for an LZW library
On Sunday, 27 October 2019 at 16:19:58 UTC, Andre Pany wrote: That is really great. Side question, did you considered to rewrite a C library (e.g. https://github.com/vapier/liblzw) to D? Kind regards Andre Probably it would be easier than the times I tried to rewrite much more complex C++ libraries/apps to D, however I thought it would be sufficient enough to just write a binding for a library. liblzw's biggest issue was that a) It's output only. b) It directly accesses files, which makes buffer reads and writes impossible to the point you have to pass the file path to a function. Using temp files would probably solve this problem, but it's extremely kludgy when you could just use memory buffers. Not to mention the wear on modern SSDs. One of my plans was to port ncompress to D as a library with memory buffer reads/writes enabled, but before that I asked around and found libncompress, which is that for C. MAybe I'll add some higher level API for it in the fashion of std.zlib, only more stable.
I've created a binding for an LZW library
https://github.com/ZILtoid1991/lzwford The hardest part was to find one that could work with D easily. I guess now Imageformats (and my own dimage) can have GIF and TIFF file support.
Re: Symantec has been sold to Broadcom
On Friday, 9 August 2019 at 02:22:11 UTC, DanielG wrote: Software is a funny thing. I'm old enough to remember when everything was locked down and proprietary, of economic necessity. Nowadays it's almost entirely the opposite, for the same reason. We're definitely well into the Singularity, but because our time perception is keeping up with it, it doesn't *seem* like things are moving as fast as they really are. But whenever I stop to really appreciate what's possible with software now, most of it was nearly or totally inconceivable back in the 90s. Fully expecting to be gunned down by a Boston Dynamics T-800 any day now. Sometimes even middleware was so proprietary that it took the community to reverse engineer how to interface with various hardware, some pieces of hardware were partly a failure thanks to that. An example is Creative's ASP chip for the SB16 and 32, and they learned so well from the events that they bought up OpenAL to make it proprietary. Nowadays I'm thinking on what kind of license should I use on my "open source media franchise" (or whatever I should call it), since I don't want to keep it all for myself, and I would like to encourage other authors to not only write what is essentially glorified fanfiction, but to contribute back so other creators and even I can build upon that. My current candidate is LGPL on the lore, character design, etc, while end products using them can be proprietary.
Any easy way to check if an object have inherited an interface?
It seems that I've to write my own function that searches in the given object's classinfo.interfaces since I couldn't find anything related in Phobos.
Re: std.zlib odd behavior
On Wednesday, 6 March 2019 at 01:50:16 UTC, solidstate1991 wrote: Thanks, it seems I'll have to write my own solution for this, and I really dislike the way streaming compression works in C. I've spotted some other bugs regarding my PNG implementation, but those were unrelated and didn't improve the compression issues. I was finally able to tame the beast, now I can load and save PNG files. Now I probably have issues with standardization, which will require me to read up on the topic, since my output isn't liked by IrfanView, and many other applications.
Datapak: Data storage format with support for multiple compression algorithms
https://github.com/ZILtoid1991/datapak It's primarily function is to store application (such as game) assets in either compressed or uncompressed format, but its extendability enables it to store longer filenames and other OS important data, metadata, etc. Currently it's in a preliminary state, but works with zstd compression (the older zlib to be added soon, lz4 in a later version), and the hash/checksum functions haven't been fully implemented. Goals in the future: * Add support for fully random access of files where it's possible (such as in uncompressed mode and zstd with shared dictionary). * Collect data on what kind of functions I should add in the future (such as finalizing the default extension for file storage). * Making the library @safe compliant, mostly through @trusted wrappers and boundary checks towards low-level functions.
Re: std.zlib odd behavior
On Tuesday, 5 March 2019 at 02:19:26 UTC, Adam D. Ruppe wrote: I haven't found the bug in your code yet, but one thing I suspect from my experience is you might be reusing a buffer. std.zlib actually stores pointers internally across function calls, so if you are trying to compress a stream, you are liable to get corruption. (std.zlib is very bad code, frankly.) I don't know for sure though, my brain is in the compiler tonight... Thanks, it seems I'll have to write my own solution for this, and I really dislike the way streaming compression works in C. I've spotted some other bugs regarding my PNG implementation, but those were unrelated and didn't improve the compression issues.
std.zlib odd behavior
https://github.com/ZILtoid1991/dimage/blob/master/source/dimage/png.d It seems that after a certain point, it doesn't add more data to the compression stream, flushing doesn't help.
Re: Odd behavior of darray.dup
On Saturday, 23 February 2019 at 19:21:10 UTC, Bastiaan Veelo wrote: It works for me: https://run.dlang.io/gist/473b0021487275751accaebeb00be05c -- Bastiaan Still no luck, not even with memcpy. There's even more mystery as I printed out the original static immutable array's content, which is different from the non-immutable one. Instead of the 32bit hex value of the given color in the format of "0x", I get "immutable(Color)(#{overlap raw, colors})". This might be a bug.
Odd behavior of darray.dup
If I want to copy an array of structs with .dup (cannot post the link in question here at the moment due to non-working clipboard, it's Color from pixelperfectengine.graphics.common) I get all zeroes instead of the values from the original array. I haven't disabled post-blit to my knowledge. Is it some kind of a bug, or the .dup function has some behavior that's not currently documented on the site (such as needing a copy constructor)?
Where to start with SafeD?
When I tried to apply to a position at Symmetry, I've got a criticism from Atila Neves that some of my code relied too much on memcpy, thus making it unsafe. After digging into std.array, I found some function that could possibly replace it to emulate writing in the middle of a file, but at least for VFile, I need some type agnostic solution. I don't think it would be an easy task to make CPUBLiT safe, unless I write a high-level wrapper for it that works with either array slices and/or on a per-image basis, but I don't have a need for such thing at the moment.
Should this library binding work?
https://github.com/ZILtoid1991/bindbc-zstandard After looking for alternatives to my megaproject of porting LZHAM to D (since it had several issues, I'll salvaging my tar implementation as well as another archive format meant for application data storage), I found out that zstandard not only has better ratios than DEFLATE, but also faster (LZHAM was a bit below DEFLATE decompression-wise with poor compression rate, probably due to poor implementation). So I thought I'll make a new binding for zstandard instead as the old one is abandoned pretty much at this point. Currently it compiles, I'll write a testcase for it to see if it can load a DLL file tomorrow. I don't really have any real way to test it on OSX, might try to test it under Linux since I have a second machine with it.
I've created two new libraries
https://github.com/ZILtoid1991/dimage https://github.com/ZILtoid1991/vfile The first is a yet another image library for D, but this time it can read and write indexed images, and also have support for some more obscure TGA features such as embedded data (developer area) and the extra fields in the extension area (not fully implemented at the moment). It has issues with RLE generation at the moment, I hope I can resolve that issue in the near future. The second is a virtual file implementation, which is mostly compatible with std.stdio.File meaning it can be swapped with it through a template, and I mainly intend to use it for decompression (thinking on writing a loader for libzstd with BindBC instead of trying to get LZHAM ported to D, since zstandard is superior in every way), but also works well for unittesting, this avoids cleaning up after the test is finished and the possible wear on solid state drives.
Template matches more than one template declaration error when trying to pass function's pointer
After some refactoring, there are four functions sharing the same name (technically four, but LDC didn't complain about them): @nogc void blitter(T)(T* src, T* dest, size_t length){...} and @nogc void blitter(T)(T* src, T* dest, size_t length, T* mask){...} I need the first one, but at compilation time I get the following error: pixelperfectengine\src\PixelPerfectEngine\graphics\layers.d(61,30): Error: template CPUblit.composing.blitter matches more than one template declaration: ..\..\..\AppData\Local\dub\packages\cpublit-0.2.3\cpublit\src\CPUblit\composing.d(2006,19): blitter(T)(T* src, T* dest, size_t length) and ..\..\..\AppData\Local\dub\packages\cpublit-0.2.3\cpublit\src\CPUblit\composing.d(2274,19): blitter(T)(T* src, T* dest, size_t length, T* mask)
Re: Just found this debugger...
On Wednesday, 3 October 2018 at 13:08:50 UTC, Vladimir Panteleev wrote: On Wednesday, 3 October 2018 at 03:25:04 UTC, solidstate1991 wrote: and I don't want to go back to VisualD after VSCode for either a usable mago or VS native debug. Visual Studio makes a decent stand-alone source-level debugger. Just select the .exe file, and right-click it in the project/solution pane to start a debugging session. (Of course, you need to build with -m32mscoff or -m64 as well as -g). VisualD isn't even needed, though VS by itself won't understand D types like arrays/strings. I cannot find that option...
How do I debug externally with Visual Studio?
I use VSCode since it has better D support, however until I make mago-mi usable (it doesn't even support all the commands currently it claims, --args seems to be completely broken) or find again a working copy of LLDB for Windows (doesn't want to compile with Mingw also being installed), I cannot really debug. The only way I can debug programs is to attach to them after they have started, however it's very clunky to use this way, some programs even execute too fast to do this way.
Can opApply be made @nogc?
Since it's a bit difficult to make tree traversal through range (especially if someone wants to make it @nogc), I thought I'll make it through opApply override, however the delegate passed by it doesn't have the @nogc attribute, which would automatically make it incapable to be used in a @nogc context. I also don't know if it would work with structs instead of classes, since they're easier to handle in a @nogc situation.
Re: My statements related to terminating my SAoC relationship
On Tuesday, 16 October 2018 at 02:20:09 UTC, Soulsbane wrote: Have you tried melatonin? My doctor has me take a 1mg tablet and split it in two. So I take 1/2 at bedtime. That is the sweet spot. If you take more than that you will end up groggy. No, but I'll since I used to have this issue even as a child, this might help. I'll ask my doctor again, if she doesn't help I'll just buy the ones that can be used without prescriptions. I hope it's not some melatonin insensitivity, that would require some pretty harsh drugs.
My statements related to terminating my SAoC relationship
I have done two mistakes: I underestimated the scope of the project and overestimated my capabilities. This caused a chain reaction, which in turn made the first milestone unreachable. At the same time, my sleep disorder became even worse. I started to sleep 10-12 hours a day while spending around 4-6 hours in bed just to trying to fall asleep, and since I had to do some housekeeping work it cut the planned 8 hours per day work down to 4-6 at most. I have taped off all the status indicator LEDs on my electronics, I asked my brother and father to refrain from loud TV watching at night, all for nothing. Caffeine intake don't worsen my ability of sleep. I do get tired, but somehow still don't feel myself sleepy. Tried to tell my doctors, but they just told me to do the stuff I've already done plus to refrain from using computers as much as possible and instead look for a job that don't require them. However, thanks to I had to use a "desk" with no leg room, my spine is all busted now, barely able to manage to lift 20kg without screaming in agony. I try to resume my work on improving mago, but on a much smaller scale and lower priority since I have to spend time finding a job, which is a very hard thing in this fascist country called Hungary, while also not supporting said fascist regime. While the state propaganda says there's a big shortage on workforce (to the point that supposedly humanitarians are being reeducated for Java developers), I also see a lot of people being rejected with bogus claims which tells me that there's something fishy, and hearing some controversies of political opponents' families suddenly losing their jobs says me that they're persecuting their political opponents at any means possible. Losing the funds put me in danger of homelessness, since I haven't been able to pay my father for rent and food for years, not to mention my PC is on its deathbed with its dried up CPU VRM capacitors, and USB and LAN ports fried after a thunderstorm and our previous ISP being skeptical with overvoltage protection (we got a direct hit into the antenna, which blew up his equipment, and fried by router, the LAN port, several USB ports, a cheap membrane keyboard, and a Logitech mouse I just have repaired). I think I'll take a few days of doing other stuff, since my sleeping disorder sabotaged my free time too and now I have to find a job, (preferably internship) to calm down a bit.
Interfacing D with C++ functions that take reference values
I need some C++ stuff, but some of the functions take reference values (Stuff&), and I don't know if this feature is emulated on D side with extern(C++) functions. While I don't have to worry about it with functions that are defined in the header, other ones and classes are a different matter.
Just found this debugger...
I wanted to do some work on lzbacon (D port of lzham-codec with some extras such as tarball support), but without a debugger it's pretty hard (I suspect an error in the multithreading when looking up for a value, or some C++ language quirk I missed). The current state of mago-mi is nearly unusable with very limited command support, and I don't want to go back to VisualD after VSCode for either a usable mago or VS native debug. I couldn't find LLDB on my harddrive anymore, and GDB needs DWARF symbols. Then I had a thought: Is there anything usable on the market besides these? After I a quick Google search, I encountered with the "guy she told you to not to worry about": https://x64dbg.com/#start It seems it needs *.pdb files for symbols, which I'll test tomorrow, hopefully I don't have to cook something complicated for my family to waste my time. While I'm still encouraged to improve mago instead (I think alternatives are always a good option and the conversion will be finished by the weekend), maybe it'll be useful for some. Maybe I can use it for mago too.
Re: Quick C bindings
I would also like something, but for the C11 runtime, as it's essential for mago (uses it for unicode strings, rewriting them for Phobos would take too much time, and I've already ran out of time).
Re: A facebook group for D programmers
On Monday, 17 September 2018 at 18:40:21 UTC, Bill Baxter wrote: Here's the link : https://www.facebook.com/dlang.org . ;-) That's the page, not the group. It seems the group is set to secret, it'll make joining very hard, only through invitations.
Will the core.stdc module be updated for newer versions of C?
While for the most part it still works very well, however when porting Mago I found a few functions that are not present in C99 (most notably wcsncpy_s). While I can write my own functions to do the same (already done this with C++'s array since a few classes inherited from std::vector, hopefully I don't need to fiddle too much with it on the Debug engine to limit reliance on GC) I think it would be a good idea to do some updates on the runtime library in this regard, especially as it's a very easily available @nogc library too.
Re: Looking for a mentor for SAoC
On Monday, 27 August 2018 at 20:47:08 UTC, Stefam Koch wrote: I guess I could help you out with coff. generating it is not the problem but linking it on windows currently requires the MS linker. which may not be desired. then again ... I think binutils do support coff as well. I might need you as a mentor. Currently I'm thinking out of the milestones, I probably can fully convert Mago to D by the end of September, in October I'll work on getting the COFF64 support at the same level as 32 bit ones, November and December will be spent with developing a GUI and bug fixes.
Re: D now has a dangerous competitor
On Tuesday, 28 August 2018 at 11:30:20 UTC, JN wrote: On Tuesday, 28 August 2018 at 08:39:20 UTC, bauss wrote: The following language is a dangerous competitor to D. https://github.com/joaomilho/Enterprise I often feel like this kind of 'jokes' are trying too hard. FizzBuzz Enterprise was fun when it first came out, and I know it's popular to hate on OOP programming, especially Java. But the fact is, a very big portion of software was built using OOP, and many of the hated design patterns have a place in programming. Sure, it doesn't provide witty one-liner quicksort examples, but when you have a group of people, having to integrate multiple webservices/databases, these kind of layered code architecture comes in handy. Of course sometimes people go too far, trying to make the code generic and fit every usecase, breaking YAGNI. Most of the hate towards OOP is misdirected. Java will be always slow because it always running in a VM, no structures so you have to rely on reference-type classes for everything. Other times it's on the developer. Thanks to my education, I first wanted to approach every problems in programming from an object-oriented viewpoint, since that was the only one we were taught (and I missed the classes on interfaces due to an incident, so I struggled to keep up). You have to learn where to use what. I personally hate C and C++ precompiler macros more, which made porting LZHAM to D a nightmare sometimes. Some parts of the macros got completely eliminated since Fiber saves most things on the stack.
Looking for a mentor for SAoC
I've chosen to work on Mago, with the following goals: -Porting it to D first and foremost to make code maintenance and expansion easier in the future. -Add better support for Win32-COFF (there's a few more bugs compared to Win32-OMF in my experience) and Win64-COFF. As I read COFF32 needs some manual installation, which will be made easier by either a Powershell script, or even a custom installer, the latter might branch out on its own project. -Fix some general bugs, like the non-working -break-insert -f. -Add some simple GUI for Mago-mi instead of just the GDB compatible text interface. -Make it to work better with LDC if possible. If I'll have time after the main milestones, I might add other functions besides the bug fixes, such as a memory editor, ability to debug programs and codes written in C and other languages for interoperability. Additionally you can help me to work on my college thesis. I still haven't chosen my subject matter, but it'll be either my graphics engine "PixelPerfectEngine", my compression library "lzbacon", or this if it's allowed. I need a mentor/consultant (the latter is what I got for the translation of the word "konzulens"), your main job is to help me out a bit.
LZHAM port to D is live on GitHub
https://github.com/ZILtoid1991/lzbacon Completely untested, no compression or test cases yet, no dub integration, and probably will fail at compilation, however if someone would like to help me out then it would be awesome. - Close to LZMA compression rates with higher decompression speed at the cost of compression speed - Backwards compatibility with deflate - Taking advantage of D's own parallelization (LZHAMDecompress uses Fiber) instead of relying on weird methods that's not supported by D - Future projects include further optimizations, making use of DCompute, readability improvements (original is a macro hell, might or might not be replaced with template mixins), safety improvements, possibly making it fully @nogc
Using fibers
I'm porting LZHAM to D, and the original used some very unusual approach for coroutines: - the whole thing is running inside of a single switch-case block created by C++ macros - the function saves some local values - a macro sets the state variable to the current line number, returns the status (eg. if compression error happened or the decompressor needs more data), then the function can be continued from a new case block labelled by __LINE__ I started to switch out error codes with exceptions, at least they also provide more information besides what happened, but don't know what should the fate of the other status codes be. I probably making them derived from the Throwable class to distinguish them from the error codes, or put delegates in place of them. I hope the Fiber class will eliminate the ugliness of the macro-generated switch-case block, and make the code easier to read and debug.
Casting a pointer and length value as a dynamic array
I need this to port a C++ code to D (a compression algorithm known as LZHAM), and the easiest way to deal with it would be that. The ADLER32 and CRC32 algorithms had to be ditched, and while I could rewrite the former to make sense (used some form of "vectorization") I would like to use the standard library's implementation for the latter.
Re: Weird bugs in DMD 2.81.0
Well, it seems I fixed the AA issue by removing a totally unrelated thing (an undoable event chain system, that got "deprecated"), but now I got another weird issue. Sometimes setting a dynamic array's length causes an access violation. Still only on WindowMaker, and nothing in PixelPerfectEditor. Does somebody have a foolproof method for designing window layouts without an editor? I starting to give up on this piece of crap software, however before that it took me a whole day to figure out where the elements should fall, then another day to debug issues with the layout. My current solution at this point is to type in stuff instead of relying on generated code.
Re: Weird bugs in DMD 2.81.0
On Saturday, 14 July 2018 at 07:01:59 UTC, Seb wrote: Any chance you can make a minimal, reproducible example of this? Would be great because then it can be put on bugzilla and other people can have a look at it too. I might try, but first I'll look at the functions to see if I can fix some of it by myself, fixing pointer overflows. I suspect that the drawing functions overflow due to small typos, once I mixed up the x and y coordinates of something then it resulted in a corrupted image.
Re: Weird bugs in DMD 2.81.0
On Saturday, 14 July 2018 at 00:58:08 UTC, solidstate1991 wrote: I found a temporary workaround. Basically I just save the content of the AA, then reapply it after the application's constructor finished, before that it always generated an exception when I tried to check its content e.g. via printing it to the screen. The program still crashes when I close it, and it seems like it's something GC related, which will be extremely hard to reproduce. I'm going to make a commit soon to Github (maybe even an alpha release), so people can check it out for themselves. The AA issue still happens when I disable the GC. What happens if I accidentally write into the memory space of an AA? Might be a pointer-overflow related issue I messed up, which will be a hell of a ride to find.
Re: Weird bugs in DMD 2.81.0
On Saturday, 7 July 2018 at 02:21:31 UTC, solidstate1991 wrote: I'll upload code tomorrow, but here's the premise: Sometimes elements disappear from associative arrays, causing all sorts of errors down the line, mostly access violations. My engine (PixelPerfectEngine) has a style sheet for its GUI, which generates basic values upon construction. This works mostly fine with PixelPerfectEditor, however WindowMaker crashes instantly when it needs to redraw anything. Both Mago and VS debugger were bit broken (first exception came from KernelBase.dll, then it only showed the caller of a getter function possibly caused the issue), but I managed to get enough information. The AA containing color indexes (ushort[string]) couldn't be accessed properly and when I tried the safe get method on it, a lot of values couldn't be accessed and later on a dynamic array had issues with access violation. I'm thinking on going back to 2.080.0 until this bug gets fixed. I found a temporary workaround. Basically I just save the content of the AA, then reapply it after the application's constructor finished, before that it always generated an exception when I tried to check its content e.g. via printing it to the screen. The program still crashes when I close it, and it seems like it's something GC related, which will be extremely hard to reproduce. I'm going to make a commit soon to Github (maybe even an alpha release), so people can check it out for themselves.
Re: Weird bugs in DMD 2.81.0
On Saturday, 7 July 2018 at 07:31:29 UTC, Seb wrote: I'm sorry but without code there's not much we can do for you. However, one thing we can try is to get your project on the project tester once this regression is fixed. https://github.com/ZILtoid1991/pixelperfectengine Just did a commit recently. PixelPerfectEditor runs as it should (unfinished, but most drawing algorithms work), under WindowMaker, some stuff just disappear from AA. Patching "PixelPerfectEngine.concrete.stylesheet"'s StyleSheet.getColor to the following reveals that some elements may have disappeared from the AA: public ushort getColor(string colorName){ return color.get(colorName,0); } Also tested with an LDC, which is based on 2.80.1, and the same anomaly still happens.
Re: How about implementing SPMD on SIMD for D?
On Saturday, 7 July 2018 at 13:20:53 UTC, Guillaume Piolat wrote: Oh yes, so much this. It would be very nice to have D_SIMD on DMD 32-bit. Does D_SIMD work on LDC?
Weird bugs in DMD 2.81.0
I'll upload code tomorrow, but here's the premise: Sometimes elements disappear from associative arrays, causing all sorts of errors down the line, mostly access violations. My engine (PixelPerfectEngine) has a style sheet for its GUI, which generates basic values upon construction. This works mostly fine with PixelPerfectEditor, however WindowMaker crashes instantly when it needs to redraw anything. Both Mago and VS debugger were bit broken (first exception came from KernelBase.dll, then it only showed the caller of a getter function possibly caused the issue), but I managed to get enough information. The AA containing color indexes (ushort[string]) couldn't be accessed properly and when I tried the safe get method on it, a lot of values couldn't be accessed and later on a dynamic array had issues with access violation. I'm thinking on going back to 2.080.0 until this bug gets fixed.
Re: How about implementing SPMD on SIMD for D?
I think fixing the SIMD support would be also great. 1) Make it compatible with Intel intrinsics. 2) Update it to work with AVX-512. 3) Add some preliminary support for ARM Neon. 4) Optional: Make SIMD to compile for all 32 bit targets, so I don't have to write long-ass assembly code for stuff. Once I even broke LDC with my code (see CPUblit).