Activity

penguinencounter

did you know there’s a 2000 character limit on devlogs? I sure didn’t until after I had written a really big one with code examples and then it rejected me.


tldr: rewrote database wrapper. added SQLite WAL support. tried to fix concurrency. found out the hard way that you really need retries on SQL operations.


the whole thing, for all the storytelling score:
https://gist.github.com/penguinencounter/1ec89dc025b8b400c61517d37467728b


also, the reason why the attachment is weird: https://github.com/hackclub/flavortown/issues/1086
(I have to upload a new copy of that image every time I edit the text :P)

Attachment
0
penguinencounter

Did some database design:

  • profile_meta table; single row, contains schema versioning information

  • sources: source attachments

  • channels: groups that users may want to track, like TICK, or RENDER. could be continuous or not

  • events: collections of steps, like a single tick or frame. instruction count and timing are totaled under a single event to measure overall performance / permission level impact

    • can have a parent event (ex. ITEM_RENDER has RENDER as a parent)
  • steps: individual actions within a script. instructions, function calls, detailed timings

  • Added method to automatically set up a blank database with the current schema version.

  • Added method to apply database migrations in the future.

  • Added method to copy a on-disk database into a temporary database

    • this is done with a RESTORE FROM command, which is not real SQLite and gets intercepted by the JDBC connector. As a result, you can’t do this with a prepared statement, so manual sanitization goes brrrr
newConn.createStatement().use {
    val syntax = when {
        url.contains("\"") && url.contains("\'") -> throw SQLException("Cannot unmount database: no safe quote type for $url")
        url.contains("\'") -> "RESTORE FROM \"$url\""
        else -> "RESTORE FROM '$url'"
    }
    @Suppress("SqlSourceToSinkFlow")
    it.executeUpdate(syntax)
}
Attachment
0
penguinencounter

Project Setup

Created a new project based on https://github.com/FallingColors/hexdummy.
This is a Hex Casting addon template, but it has the best Architectury+Kotlin build system I’ve seen so far, so we’re going to use it for something completely unrelated.

  • tore out all the Hex Casting stuff
    • kept PKPCPBP for the JSON5 preprocessor
  • added Figura dependencies
    • figura itself - figura-common & figura-fabric & figura-forge
    • its transitive dependencies, figura-luaj-core, figura-luaj-jse, nvwebsocketclient, oggus, concentus, and fabricPermissionsApi
  • updated MixinExtras
  • upgraded Loom to 1.13
    • build JDK must be at least 21
    • upgraded kotlin to 2.2.21
  • added SQLite JDBC library (plan is to make profiler files SQLite databases)

Actual Mod Code

  • added hooks for the start and end of function calls, as well as every instruction executed in Lua bytecode
  • found out that LuaJ’s LuaClosure::execute method has bad control flow and causes @Expression from MixinExtras to get stuck in an infinite loop for some reason??
Attachment
Attachment
1

Comments

developergirishgiri

nice plz give me vote also and follow me

penguinencounter

More matching libraries! In this case it’s DotNetNuke.Log4net. Having a quick way to see all the logging calls is nice

Attachment
0
penguinencounter

Found a matching library!

HidLibrary appears to be statically linked into the executable.

Attachment
0
penguinencounter

ILSpy decompilation accuracy is much better than dotPeek’s, so I switched all the sources to that. As a result, I can actually build the application from the decompiled sources! (It doesn’t run ofc but it’s not incorrect at least)

That does mean I lost some of the renames. Though, I am keeping track of the original names of everything now, so in case of some decompiler issues it doesn’t become a pain to track things down.

Attachment
1

Comments

penguinencounter
penguinencounter 25 days ago

why is it so crunchy

penguinencounter

Mapped a bunch of Windows API bindings and names. Also, figured out that C# async is completely fake and is just 2 delegates and 3 methods in a trenchcoat.

Attachment
Attachment
1

Comments

penguinencounter
penguinencounter 26 days ago

This is an example comment

penguinencounter

it works! kind of! (well, it doesn’t crash?)

needs: UI, actual merged output, conflict resolver

Attachment
0
penguinencounter

more untested code! to be tested tomorrow

(it’s like an event loop or something. i am coming to the realization that i will somehow need to write developer documentation for all of this)

in other news I turned full line code completion back on, we’ll see if it actually saves any time

Attachment
Attachment
Attachment
Attachment
1

Comments

penguinencounter
penguinencounter about 1 month ago

why didn’t this show up in the feed channel

penguinencounter

Is it binary? The answer may surprise you.

we have two different kinds of UTF-16 and you have to guess which one is correct

also JS labels are real and you Can use them

Attachment
Attachment
Attachment
0
penguinencounter

built out the planner system a bit. should be able to actually pick the right before transformer by next devlog

also we’re just pretending everything we don’t recognize is text for now. this is a bad idea

Attachment
0
penguinencounter

JavaScript is a good and well-designed language /s
(maps to the rescue)
(this is a bug fix devlog)

Attachment
0
penguinencounter

I made a Meyers diff implementation!

Special thanks to James Coglan for this set of 3 articles which makes the algorithm make sense (or, more sense than I got from reading the original paper) and also providing a Ruby implementation that I adapted to TypeScript:
https://blog.jcoglan.com/2017/02/12/the-myers-diff-algorithm-part-1/
https://blog.jcoglan.com/2017/02/15/the-myers-diff-algorithm-part-2/
https://blog.jcoglan.com/2017/02/17/the-myers-diff-algorithm-part-3/

I wish I could get hackatime time for the hour spent reading math papers to figure out how the hell all these algorithms work. oh well

Next: probably a basic 3-way merge, then a MVP

(Also, Rhythm Doctor OST is carrying me through this)

Attachment
Attachment
1

Comments

penguinencounter
penguinencounter about 1 month ago

oops their name is Myers not Meyers. how did I not notice this

penguinencounter

a bit of polish

(yeah it’s 47 minutes of frontend. time to lock in on backend again)

Attachment
1

Comments

penguinencounter
penguinencounter about 1 month ago

also you can’t see it because it’s a still image but I animated the progress bar

penguinencounter

made a quick browser demo for testing purposes (and finished up getting back to before I deleted everything)

next is probably getting text merges to work

Attachment
0
penguinencounter

Got the project set up and published on GH.

Also, accidentally made a circular dependency when trying to make a Promise wrapper with a progress callback. That was interesting to solve. (Builder to the rescue?)

(There’s not really much to show, because most of this is library stuff - eventually there will be a browser demo, but we’re not there yet)

Attachment
0