What is NALL [bsnes] ✔ [byuu.org] – ?

-> What is the least instrusive solution?

  • Use Nall w/ “Ruby”
  • “Do what you’re doing now”

Remember, the “Audio” class in STD is/should be for/assoc. with Audio Drivers, I think. I have Music_Player class in my head also, and how it relates to “Audio.” That is confusing me. I just want “Audio” to wrap Driver Selection, and involve the following routines:

  1. “Output Device” query – incl. supported samples rates and other assoc. subroutines
  2. Select Output Device
  3. Select Audio Format

2/3 could be one function as well, with persistent settings.

But I really did want to talk about Nall. And ruby. These are “things” made by byuu and co. that I love. Ruby really inspired to write wrappers for my code. It all started when I was about to modify STD to incorporate the newest feature Time_Scrub and it’s been awhile since I’ve been in the project. I realized how convoluted everything was and really deeply involved with the methods the library at hand called for (SDL). And I was writing all the GUI widgets from scratch.. After analyzing Ruby [in fact, I will publish the analysis in my next blog post], I discovered the beauty of the hardware abstraction layer. And now, I aim to find a way to describe STD in a library agnostic manner, accompanied by drivers for some libraries (partially SDL and wholly QT is my aim).

There’s something about Nall – what is it -since byuu is working on his new website, the page for nall is down. We must peruse the web archive of it, thankfully which includes a download. https://web.archive.org/web/20140710210208/http://byuu.org/files/nall_20140107.tar.xz


Here is a relevant complete snippet for archival purposes:

nall is a C++11 header library that implements a large number of containers
and classes. Although at times it does reimplement containers that exist in the
C++ standard library, it primarily only does so to offer greater consistency and
enhanced yet simplified functionality.

For instance, nall/string supports tokenization, string-replace, math
parsing via recursive descent, small-string optimization, a customized string
container with string-group-specific functions, and so on. It provides type-safe
string building and printing functions, can store binary data and transparently
be passed to functions requiring C-style null-terminated strings, and uses a
more intelligent composition method than overriding the shift operators.

nall/vector allows O(1) amortized insert and remove at both the beginning and
end of the queue. Resizing the queue does not always require copying or moving
all objects through placement-new syntax and realloc (yet it still supports
non-POD objects and properly invokes constructors and destructors.) It also has
functions to optionally auto-resize an array when accessing an element out of
bounds, or to return a stock object if the array index is out of bounds.

nall also provides dozens of additional small libraries that do not exist in
the C++ standard library. For instance, rather than needing a 300KB dependency
on zlib or a 400KB dependency on libpng, nall/zip and nall/png provide simple
decompression support for these formats in a mere 10KB of code each.

As a header library, no separate object compilation is necessary. Simply
include the header(s) you want, and you can use it right away.

Some of the primary supported concepts implemented in nall are:

  • string
  • vector
  • set
  • hashset
  • map
  • sort
  • thread
  • unzip
  • png
  • image
  • config
  • markup/bml
  • markup/xml
  • varint
  • sha256
  • crc
  • dsp
  • stream
  • optional
  • file
  • filemap
  • directory
  • dl
  • endian
  • http
  • smtp
  • odbc


nall is available under the ISC license.

I had no prior experience with the ISC license but I was pleasantified to see this text template, nice and simple – https://en.wikipedia.org/wiki/ISC_license

So we might be overwhelmed at all the cool things that nall has to offer, and I would be foolish to not take time to learn it. I’m mostly interested in maintaining its use in Ruby, the hardware abstraction layer, where the nall::any type is used.. I like it’s light-weight flauntiness. I’m going to try it out. 🙂 Nall is also really useful for its “config” capability as I’ve become well accustomed with in my hacking of bsnes-classic – it makes it super easy to have a config file for various features, and extending the configuration is easy. I will make a tutorial on this.

There are some other questions I have on byuu’s libraries .. Such as Phoenix / Hiro and the difference between the two. I have the instinct that Hiro picks up a dead Phoenix. But I’m not sure. For some reason I’m not too interested in the GUI abstraction provided by Phoenix and possibly Hiro(?) .. This may be of use to someone who is : https://github.com/apollolux/hello-phoenix


[off-topic] We are the cells of the Earth

You know how we have a body… What if we are all a part of a larger body, a difference species [I’m aware this is improper terminology], a body that Earth is a part of. Just like we have cells, we may also be the cells of some greater body.

As I rubbed my tongue against the back of my lower front teeth to get the food unstuck [corn], as I’ve done for years since I had a wire installed there, I thought about the slow corrosive effect mother nature has made on places like the Grand Canyon, and that my tongue may be acting her role on the back of my teeth. Once I had that relation between myself and mother nature, I realized the truth – the Earth is a body, or a part of a body, and we are its cells. In some way, by some zoom level of a magnifying glass [or zoom-out glass], I see it like this. And I recall that starry night in Boston, when I felt my inner infinity, along with the outward infinity outside of me.

7z support

Zophar’s Domain is one such popular SPC site that distributes its SPC packages in 7z archives. I love the support I’ve added into SPC Tracker that can load RSN/RAR files, so I would love to go all the way with 7z support. I’ve looked into and made some discoveries quickly:

can use http://www.7-zip.org/sdk.html 15.05 beta package’s 7zDec, a simplified 7z extractor and file lister.

To compile
There are some additions needed to be made to the lzma1505/C/Util/7z/makefile.gcc
I am unsure whether these changes are necessary because I run OS X Yosemite.


--- makefile.gcc.old	2015-07-16 18:18:19.000000000 -0400
+++ makefile.gcc	2015-07-16 18:18:27.000000000 -0400
@@ -4,13 +4,17 @@ LIB =
 RM = rm -f
 CFLAGS = -c -O2 -Wall
-OBJS = 7zMain.o 7zAlloc.o 7zArcIn.o 7zBuf.o 7zBuf2.o 7zCrc.o 7zCrcOpt.o 7zDec.o CpuArch.o LzmaDec.o Lzma2Dec.o Bra.o Bra86.o Bcj2.o Ppmd7.o Ppmd7Dec.o 7zFile.o 7zStream.o
+OBJS = BraIA64.o Delta.o 7zMain.o 7zAlloc.o 7zArcIn.o 7zBuf.o 7zBuf2.o 7zCrc.o 7zCrcOpt.o 7zDec.o CpuArch.o LzmaDec.o Lzma2Dec.o Bra.o Bra86.o Bcj2.o Ppmd7.o Ppmd7Dec.o 7zFile.o 7zStream.o
 all: $(PROG)
 $(PROG): $(OBJS)
 	$(CXX) -o $(PROG) $(LDFLAGS) $(OBJS) $(LIB)
+BraIA64.o: ../../BraIA64.c
+	$(CXX) $(CFLAGS) ../../BraIA64.c
+Delta.o: ../../Delta.c
+	$(CXX) $(CFLAGS) ../../Delta.c
 7zMain.o: 7zMain.c
 	$(CXX) $(CFLAGS) 7zMain.c

We can first inspect the archive for SPC files. If there’s none, don’t load. Then perform similar RSN/RAR duties. (RSN/RAR should perform similar safety check).

Part II

OK 7z support is implemented. In hindsight, additional functionality to 7zDec was required — ability to specify an output directory — and also NFD (NativeFileDialog) had a bug where file extensions < 3 chars were not parsing correctly. That was fixed 🙂 , although no pull request was submitted, I did submit an issue with an explanation and clear solution. Relevant links:

NFD < 3 char file extension bugfix:

Add ability for 7zDec to output extraction to a separate directory

[debugger] Add support for 7z archives loading

I am alive!

Hey yall,

I am alive and well 😀 I just needed some time off the SNES Tracker wagonwheel. ???? Don’t know what’s in store! But I’m hoping to incorporate some GUI libraries or find some help on this project.. There’s a large intimidation factor, plus I don’t have a job, living with fam and hanging with friends. We’ll see where it all goes!!

I’ve been learning about VJing thru my VJ friends and have started maintaining a private wiki for my own knowledge base it’s really useful! I highly recommend you do the same, if you’re like me.. Always working and learning new things, and building new ideas.


Can’t wait to show y’all what I’ve been working on in 2.5 weeks 🙂 It’s actually not SNES Tracker related, but it is SPC related somewhat.. sort of.. a little bit.

Oh, I’m also thinking of keeping SNES Tracker all to myself..

Blargg APU, SPC seek() implementation


Especially with regard to one of STD’s primary functionalities — Transcribing music — it would be essential to have a seek ability, much like any wave file player.. Teh difference is that an SPC is a program, not just data that is read and played like a WAV. An SPC is a living program. Thus, you cannot just seek 20 seconds into a program without actually executing it at an extremely high rate in order to make that change instantaneous. This is the problem with seeking on SPC.

1) Create a second-by-second Savestate Profile

You have your base SPC..
after every second passes, you record down a minimized diff-SPC from the 0:00 one.
repeat until end of song..
you then have a sequence of second-interval diff-SPC’s that can be loaded as the user seeks to different positions in time.

The format of a diff-SPC is contingent on progress being made…will update soon

2) Seek at High-Rate

Seeking at a high rate may be possible, and may [not] be limited to the resolution of the clocks on the SPC700, [and performance of your PC??]..I am not sure if I can run the APU emulator even faster at a high level, but it’s worth looking into. I have sent the creator of the emu, Blargg, an email for his advice on this seek function I am looking to implement. I have not heard back from him yet, and it’s been a few days.

One thing that can be done is

/* Skip several seconds */
error( spc_skip( snes_spc, 60 * spc_sample_rate * 2 ));

This example will take several seconds to skip 60 second. It’s a fair trade at the time being.

I might be able to cheat a little.. See, most SPCs use the same clock and clock value, timer 1. And there are 2 levels of tempo adjustments possible. one at the SNES level, and one at the emulator level.. The stock emulator-level tempo adjustment only allows a speed-up of 4X. The first thing I will check is if this value can be increased further. That’s not at all close to an instantaneous seek speed. But, maybe perhaps by bringing the SNES-level clock down.

MSU-1 && Get SuperRoadBlaster working on Higan / Bsnes > v0.87

This has nothing to do with SNES Tracker.. Well it might.. If for some reason SNES Tracker supports MSU-1 .. which it has no reason to.. they’re unrelated and operate independently of each other.. But anyways it was hard to figure out how to get this thing working correctly on new Higan..

Keep everything the same but add this SuperRoadBlaster.bml file to the SuperRoadBlaster.sfc directory.


cartridge region=NTSC
  rom name=SuperRoadBlaster.sfc size=0x40000
  map id=rom address=00-3f,80-bf:8000-ffff
  map id=rom address=40-7d,c0-ff:0000-ffff

  ram name=SuperRoadBlaster.srm size=0x800
  map id=ram address=20-3f,a0-bf:6000-7fff
  map id=ram address=70-7d:0000-ffff

    map id=io address=00-3f,80-bf:2000-2007
    rom name=SuperRoadBlaster.msu size=0x1eb60169
    track number=0 name=SuperRoadBlaster-0.pcm
    track number=1 name=SuperRoadBlaster-1.pcm
    track number=2 name=SuperRoadBlaster-2.pcm
    track number=3 name=SuperRoadBlaster-3.pcm
    track number=4 name=SuperRoadBlaster-4.pcm
    track number=5 name=SuperRoadBlaster-5.pcm
    track number=6 name=SuperRoadBlaster-6.pcm
    track number=7 name=SuperRoadBlaster-7.pcm
    track number=8 name=SuperRoadBlaster-8.pcm
    track number=9 name=SuperRoadBlaster-9.pcm
    track number=10 name=SuperRoadBlaster-10.pcm
    track number=11 name=SuperRoadBlaster-11.pcm
    track number=12 name=SuperRoadBlaster-12.pcm
    track number=13 name=SuperRoadBlaster-13.pcm
    track number=14 name=SuperRoadBlaster-14.pcm
    track number=15 name=SuperRoadBlaster-15.pcm
    track number=16 name=SuperRoadBlaster-16.pcm
    track number=17 name=SuperRoadBlaster-17.pcm
    track number=18 name=SuperRoadBlaster-18.pcm
    track number=19 name=SuperRoadBlaster-19.pcm
    track number=20 name=SuperRoadBlaster-20.pcm
    track number=21 name=SuperRoadBlaster-21.pcm
    track number=22 name=SuperRoadBlaster-22.pcm
    track number=23 name=SuperRoadBlaster-23.pcm
    track number=24 name=SuperRoadBlaster-24.pcm
    track number=25 name=SuperRoadBlaster-25.pcm
    track number=26 name=SuperRoadBlaster-26.pcm
    track number=27 name=SuperRoadBlaster-27.pcm
    track number=28 name=SuperRoadBlaster-28.pcm
    track number=29 name=SuperRoadBlaster-29.pcm
    track number=30 name=SuperRoadBlaster-30.pcm
    track number=31 name=SuperRoadBlaster-31.pcm
    track number=32 name=SuperRoadBlaster-32.pcm
    track number=33 name=SuperRoadBlaster-33.pcm
    track number=34 name=SuperRoadBlaster-34.pcm
    track number=35 name=SuperRoadBlaster-35.pcm
    track number=36 name=SuperRoadBlaster-36.pcm
    track number=37 name=SuperRoadBlaster-37.pcm
    track number=38 name=SuperRoadBlaster-38.pcm
    track number=39 name=SuperRoadBlaster-39.pcm
    track number=40 name=SuperRoadBlaster-40.pcm
    track number=41 name=SuperRoadBlaster-41.pcm
    track number=42 name=SuperRoadBlaster-42.pcm
    track number=43 name=SuperRoadBlaster-43.pcm
    track number=44 name=SuperRoadBlaster-44.pcm
    track number=45 name=SuperRoadBlaster-45.pcm
    track number=46 name=SuperRoadBlaster-46.pcm
    track number=47 name=SuperRoadBlaster-47.pcm
    track number=48 name=SuperRoadBlaster-48.pcm
    track number=49 name=SuperRoadBlaster-49.pcm
    track number=50 name=SuperRoadBlaster-50.pcm
    track number=51 name=SuperRoadBlaster-51.pcm
    track number=52 name=SuperRoadBlaster-52.pcm
    track number=53 name=SuperRoadBlaster-53.pcm
    track number=54 name=SuperRoadBlaster-54.pcm
    track number=55 name=SuperRoadBlaster-55.pcm
    track number=56 name=SuperRoadBlaster-56.pcm
    track number=57 name=SuperRoadBlaster-57.pcm
    track number=58 name=SuperRoadBlaster-58.pcm
    track number=59 name=SuperRoadBlaster-59.pcm
    track number=60 name=SuperRoadBlaster-60.pcm
    track number=61 name=SuperRoadBlaster-61.pcm
    track number=62 name=SuperRoadBlaster-62.pcm
    track number=63 name=SuperRoadBlaster-63.pcm
    track number=64 name=SuperRoadBlaster-64.pcm
    track number=65 name=SuperRoadBlaster-65.pcm
    track number=66 name=SuperRoadBlaster-66.pcm
    track number=67 name=SuperRoadBlaster-67.pcm
    track number=68 name=SuperRoadBlaster-68.pcm
    track number=69 name=SuperRoadBlaster-69.pcm
    track number=70 name=SuperRoadBlaster-70.pcm
    track number=71 name=SuperRoadBlaster-71.pcm
    track number=72 name=SuperRoadBlaster-72.pcm
    track number=73 name=SuperRoadBlaster-73.pcm
    track number=74 name=SuperRoadBlaster-74.pcm
    track number=75 name=SuperRoadBlaster-75.pcm
    track number=76 name=SuperRoadBlaster-76.pcm
    track number=77 name=SuperRoadBlaster-77.pcm
    track number=78 name=SuperRoadBlaster-78.pcm
    track number=79 name=SuperRoadBlaster-79.pcm
    track number=80 name=SuperRoadBlaster-80.pcm
    track number=81 name=SuperRoadBlaster-81.pcm
    track number=82 name=SuperRoadBlaster-82.pcm
    track number=83 name=SuperRoadBlaster-83.pcm
    track number=84 name=SuperRoadBlaster-84.pcm
    track number=85 name=SuperRoadBlaster-85.pcm
    track number=86 name=SuperRoadBlaster-86.pcm
    track number=87 name=SuperRoadBlaster-87.pcm
    track number=88 name=SuperRoadBlaster-88.pcm
    track number=89 name=SuperRoadBlaster-89.pcm
    track number=90 name=SuperRoadBlaster-90.pcm
    track number=91 name=SuperRoadBlaster-91.pcm
    track number=92 name=SuperRoadBlaster-92.pcm
    track number=93 name=SuperRoadBlaster-93.pcm
    track number=94 name=SuperRoadBlaster-94.pcm
    track number=95 name=SuperRoadBlaster-95.pcm
    track number=96 name=SuperRoadBlaster-96.pcm
    track number=97 name=SuperRoadBlaster-97.pcm
    track number=98 name=SuperRoadBlaster-98.pcm
    track number=99 name=SuperRoadBlaster-99.pcm
    track number=100 name=SuperRoadBlaster-100.pcm
    track number=101 name=SuperRoadBlaster-101.pcm
    track number=102 name=SuperRoadBlaster-102.pcm
    track number=103 name=SuperRoadBlaster-103.pcm
    track number=104 name=SuperRoadBlaster-104.pcm
    track number=105 name=SuperRoadBlaster-105.pcm
    track number=106 name=SuperRoadBlaster-106.pcm
    track number=107 name=SuperRoadBlaster-107.pcm
    track number=108 name=SuperRoadBlaster-108.pcm
    track number=109 name=SuperRoadBlaster-109.pcm
    track number=110 name=SuperRoadBlaster-110.pcm
    track number=111 name=SuperRoadBlaster-111.pcm
    track number=112 name=SuperRoadBlaster-112.pcm
    track number=113 name=SuperRoadBlaster-113.pcm
    track number=114 name=SuperRoadBlaster-114.pcm
    track number=115 name=SuperRoadBlaster-115.pcm
    track number=116 name=SuperRoadBlaster-116.pcm
    track number=117 name=SuperRoadBlaster-117.pcm
    track number=118 name=SuperRoadBlaster-118.pcm
    track number=119 name=SuperRoadBlaster-119.pcm
    track number=120 name=SuperRoadBlaster-120.pcm
    track number=121 name=SuperRoadBlaster-121.pcm

  title:  Super Road Blaster
  name:   Super Road Blaster
  region: NA


Here is some important info I discovered and wrote myself 😛

Super Road Blaster source is obviously a gold mine.

Here's what I discovered tonight.. more details found in Makefile

converting video to png with ffmpeg, snippet from Road Blaster, https://github.com/DocSchoko/SNES-SuperRoadBlaster/blob/master/tools/xmlsceneparser.py: 
os.system("ffmpeg -y -i %s -s 256x192 -pix_fmt rgb8 %s/video_%%06d.gfx_video.png -ss %s -t %s" % (options.get('videofile'), options.get('chapterfolder'), timestart, duration))

Super Blaster has tool to convert png to snes gfx..

this somehow gets compiled in a data file "gamename.msu" by https://github.com/DocSchoko/SNES-SuperRoadBlaster/blob/master/tools/msu1blockwriter.py

now audio
os.system("ffmpeg -y -i %s -acodec pcm_s16le -ar 44100 -ac 2 %s/audio.sfx_video.wav -ss %s -t %s" % (options.get('videofile'), options.get('chapterfolder'), timestart, duration))

https://github.com/DocSchoko/SNES-SuperRoadBlaster/blob/master/tools/msu1blockwriter.py also does the audio pcm file output.. 

it is up to you to follow Super Road Blaster further or create your own file format.. but basically you would be storing sequential frames of tiles, tile map, and color palette data, perhaps along with an audio track

create a skeleton snes program that sets up a BG layer at a certain VRAM address that MSU1 will upload to. and then u learn how to program MSU1 to send the data to VRAM

Good luck, cause there's not much doc on MSU1 that I can see...
Perhaps the original source code behind what we just  watched: http://www.dforce3000.de/pub/SuperRoadBlaster.sfc.7z