WLA Tools and Libraries

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
WLA Tools and Libraries
by on (#231290)
I've been writing some tools based on WLA-DX and wanted to share them with the board (I've been lurking for a while).

First, I've been writing a Java library that can parse WLA projects. It is still a work in progress, but I've been able to get a parse tree of the Oracle of Ages Disassembly. This leads me to my second point : I've begun working on a Visual Studio Code extension for WLA-DX. It includes a Java based language server so it will be able to do some pretty powerful things like renaming labels, refactoring macros, etc. Right now it is a proof of concept and can only provide some basic links to documents (ie from .includes) and certain symbol definitions (IE goto where a macro, struct, etc is defined).

I've made a video demo here :

Video Demo : https://www.youtube.com/watch?v=LOv05pIG0Fc

And here's the links to the parser and the plugin
Parser : https://github.com/secondsun/snes-dev-tools
Plugin : https://github.com/secondsun/wla-language-server
Re: WLA Tools and Libraries
by on (#231326)
This is cool as hell.

Tinkering with a language server for wla and/or asar was definitely on my radar for VS Code shenanigans, so it's super neat to see someone executing on this. I haven't dug into this much, but is the extension is a purely standalone thing? Like, the extension doesn't require any supporting binaries or background services once you get to a point where you're comfortable publishing it on the marketplace?

Also, speaking of, while I'm sure you've got a few TODOs (both in your code and otherwise) I would wonder how much work it'd be to support asar/xkas style assembly, as well? Putting aside my own wants and needs of having a robust debugger as a major dev tool, it seemed that the most prolific SNES work being done is in asar, with stuff like SMW hacks, or the Lttp and/or Metroid 3 randomizer scene, so creating debugging tools that those developers and communities could some day work with is something I found personally satisfying, as well.
Re: WLA Tools and Libraries
by on (#231328)
There are two parts to the extension.

The first part is the extension itself. The extension executes a Java application that is build using java-language-server and the parser library. Because we live in 2019 now the java application is a system specific static binary that is bundled with the extension. Right now it supports linux, but editing the build file for mac or windows is pretty trivial. Eventually this will be a native static binary build using graalVM, but that is both a crazy specific detail and a detail that is probably not really worth getting into ;). (this is https://github.com/secondsun/wla-language-server)

The second part of the extension (and the one I put most of my work into) is a Java library for parsing wla source files. It is what is actually scanning the project and creating the structures that the extension uses to display to the user. For example '.include "includes/constants.s" is parsed and turned into a directive node with arguments. The biggest hurdle was reverse engineering WLA so that I could write a parser that respected enough of the WLA rules for the tooling to be useful. WLA doesn't provide a way to link against it to get information about the structure of its projects, and this basically meant I had to rewrite a LOT of WLA to be able to get this information. (This is https://github.com/secondsun/snes-dev-tools)

I started this because I typed "how to write a SNES game" into google and was pointed to https://en.wikibooks.org/wiki/Super_NES_Programming. That document used WLA so I started from there. I've seen that it looks like asar has more entusiasm/users behind it at the moment, but nothing really has a great all in one tool (as you've mentioned). ASAR looks like it has the same structure as WLA and doesn't provide an API for getting to its source's structures and would need a similar amount of work.
Re: WLA Tools and Libraries
by on (#231329)
Sorry, I may have misspoken, or not been precise enough: What I mean is, when you publish this, is it a one-click solution for individual users to just fetch the thing from the marketplace?

Like, with the VS Code debugging, I have to stipulate that a user needs to get the extension, a specific emulator, and a specific assembler (and even have the assembler be executed in a specific manner). For your solution, would the user experience be to just fetch the extension from the marketplace, reload vscode, and everything works from there?
Re: WLA Tools and Libraries
by on (#231330)
Ahhh right.

Yes you will just reload vscode and everything will "Just work" as long as you are on Windows, Mac, or Linux. One day ;)
Re: WLA Tools and Libraries
by on (#231337)
I thought Microsoft didn't allow emulators on its marketplace. A Visual Studio Code extension that fetches and installs the appropriate emulator would appear to violate rule 10.13.10: "Products that emulate a game system are not allowed on any device family."
Re: WLA Tools and Libraries
by on (#231346)
That is only applicable for the Microsoft Store. Those terms do not apply for the Visual Studio Marketplace.

Trying to suss out exactly what terms apply, it seems that this is the Terms of Use that would be most applicable: https://azure.microsoft.com/en-us/suppo ... ms-of-use/

Quote:
In using the Communication Services, you may not:

Use the Communication Services in connection with surveys or contests (except and to the extent offered by Microsoft, our partners, or our customers through this Website), pyramid schemes, junk email, spamming, or any duplicative or unsolicited messages (commercial or otherwise);

* Upload, or otherwise make available, files that contain images, photographs, software, or other material protected by intellectual property laws, including, by way of example and not as limitation, copyright or trademark laws (or by rights of privacy or publicity) unless you own or control the rights thereto or have received all necessary consent to do the same;

* Use any material or information, including images or photographs, which are made available through the Website Services in any manner that infringes any copyright, trademark, patent, trade secret, or other proprietary right of any party.


...and some other stuff. I forget if emulators are okay in that regard, as being the product of reverse engineering. Offhand I want to say it would be, as long as you avoid company trademarks or cases of clearly copyrighted software like including a BIOS dumped from a PlayStation in a download.

Though, I want to say that's not relevant in this case anyway - there's no emulator code in either repo, it seems?
Re: WLA Tools and Libraries
by on (#231352)
Quote:
Though, I want to say that's not relevant in this case anyway - there's no emulator code in either repo, it seems?


Correct. This is not emulation, it is "only" text parsing.
Re: WLA Tools and Libraries
by on (#231385)
I've done a little more work, it can show you some errors and the parsing is a bit more error tolerant.

https://youtu.be/u8UIorFMHc0