Hacking BAGOS the Scriptable Menu replacement!

Do you intend to learn BAGASMI scripting for this?

  • Haven't decided yet.

    Votes: 0 0.0%
  • Nope, waiting for better scripting features

    Votes: 0 0.0%
  • Probably not, scripting isn't my thing.

    Votes: 0 0.0%

  • Total voters
    6

BassAceGold

Testicles
OP
Member
Joined
Aug 14, 2006
Messages
495
Trophies
0
XP
420
Country
Canada
Alright, so as promised in the "Design your own menu thread", I am releasing the current build of what is now being referred to as BAGOS (subject to change in the future).

BAGOS is a menu for the Supercard DS2 which contains its own built in script interpreter (BassAceGold's psuedo-ASM Interpreter) for a language I mashed together called BassAceGold's ASM, or BAGASM for short.
Why is it using my own scripting language? Well, its fast! Really fast. That's about it.

The goal of this menu is quite simple, make everything script-able! So BAGOS is simply just a file browser, with the ability to launch scripts, run multiple scripts at once and run scripts on boot, allowing for users to script their own menu experience.

Currently, menu integration is no where near complete. The target is for scripts to be able to interact with BAGOS's core browsers for things like: Obtaining a directory listing, operating on the currently selected file, etc. The core menu's are essentially the programs terminal, and eventually, scripts will be able to perform more features to flesh out the menu (like fetching cover art and icons, maybe a music playing widget script, or even small games!).

With its current state, BAGOS isn't really suitable for general user consumption. Its just a bare-bones menu at the moment. What it can do is:
  • Load files using .arg files
  • Load nds roms through EOS (No nzip support yet)
  • Load and run scripts
So if you are looking for a fancy menu to replace iMenu/EOS/BAGPlug, then you should probably check back months from now when script integration has been further worked on. In the mean time, for those who wish to just play around with scripting, or want a simple unpolished menu to use, then look no further!

As far as menu updates are concerned, I'm thinking I want to try for bi-weekly updates that improve menu integration, and or, fix whatever bugs/ add requested features that end up in here.

Installation is easy:
  • Unzip BAGMenu.zip
  • Copy _bagMenu folder to the root of your SD card.
(OPTIONAL STEP)​
If you wish to make BAGOS your main menu, then copy the _DSTwo folder to the root of your card.​
This folder contains the newest DSTwo.nds and boot.ini to load the menu on boot.​
If you just want to load BAGOS from BAGPlug or iMenu or whatever, then just load up the .plg file from the _bagMenu folder.​


A couple things to note:
-Some menu options don't work: Rename, create new directory, edit args <- things that require a keyboard​
-Hiding and un-hiding don't work apparently, and there is no favorites menu (This will be a script later on).​
-I recommend looking through the files in _bagMenu, you might find some useful things to tweak.​
When you first boot the menu, you will be on the home screen
  • Pressing L brings up the file
  • Pressing R brings up the directory
  • Holding X while opening the file or directory browser will show all files
  • Pressing B goes back a menu
  • Pressing select on a browser entry will bring up the clipboard options
  • Pressing A on a file will bring up the launch menu option
  • Pressing Start on the home screen will bring up a window displaying the currently running scripts.
  • Pressing A on a script will bring up a list of options to perform on a script
  • L + R + Select should take a screenshot
You can view/change the controls in _bagMenu/scripts/main.asm

On with the download! [Release 2 (2013-05-22)]

**Latest Binary** (2013-06-16)

The wiki for BAGASMI scripting can be found here.

The wiki doesn't cover some advanced topics yet, but soon will!
Obligatory picture: File browser with the launch menu opened.
2013-02-27_203727.png
 

BassAceGold

Testicles
OP
Member
Joined
Aug 14, 2006
Messages
495
Trophies
0
XP
420
Country
Canada
Just had a massive BA-GASM :3

also - areyoushittingme.tiff - I can't believe this is finally released! I was starting to think you had given up on it, which was a tiny bit disappointing. I can't wait to see how this turns out in the coming months.

Well if by released, you mean a binary is out in the wild, then yes. It's going to take many releases to get it up to useable levels. For now, its simply just a testing ground to try and get people playing around with its scripting abilities.

Every 2 weeks, I hope to have mini updates that expand the scripting abilities by some landmark. So over time, the advanced features people want from the other thread should hopefully be able to be scripted in.

Some current ideas I have for scripts if people wanna give them a shot are:
-Passworded menu:
A script that denies menu use until a key combination is entered. This can be done fairly easily, and then set as the first entry in bootscripts.txt so its executed as soon as the menu loads.​
-Language Changer:
The language.ini file only contains English right now, but other languages can be added with no problems. A script could be made to change the language option in settings.ini. This script might have to wait for an update when ini file support is added to BAGASMI. There are some fat operations, but currently they are undocumented on the wiki.​
My other script ideas rely on features that have yet to be added to the interpreter. Perhaps with each new release I could post some ideas that are now possible with each update.
 
  • Like
Reactions: Sicklyboy

Sicklyboy

#JOYCONBOYZFOREVER
Global Moderator
Joined
Jul 15, 2009
Messages
6,271
Trophies
1
Location
[̲̅$̲̅(̲̅ ͡° ͜ʖ ͡°̲̅)̲̅$̲̅]
XP
6,684
Country
United States
BAG, this is, as far as I am aware, the third notable menu aside from EOS. If the binary loads (can't screw with my DSTWO right now, got shit to study for my finals in college), I'll see that as a functional beta, if it's lacking in features at the moment. And that's good enough for me.

Congrats on getting this going, mate. :D
 

VatoLoco

Don't crush that dwarf, hand me the pliers.
Member
Joined
Jan 29, 2008
Messages
2,319
Trophies
0
Age
49
Location
Ya Cant Get There From Here
Website
www.backwoodzstudioz.com
XP
2,153
Country
United States
Cool stuff, Bass=) it's going to take some time for me to wrap my head around learning to make scripts =P

i imported some of my args from bagplug to try out. Noticed that Stella's bottom screen is a corrupt image, although the gameplay works. Using the same arg w/bagplug works fine.
Also, i got this error after direct booting and playing a NeoDS game (which only works on DSL, not dsi or 3ds for some reason). To get teh error to go away I removed NeoGeo from settings.ini/LastDir = /NeoGeo

41542-01.png
 

BassAceGold

Testicles
OP
Member
Joined
Aug 14, 2006
Messages
495
Trophies
0
XP
420
Country
Canada
Cool stuff, Bass=) it's going to take some time for me to wrap my head around learning to make scripts =P

i imported some of my args from bagplug to try out. Noticed that Stella's bottom screen is a corrupt image, although the gameplay works. Using the same arg w/bagplug works fine.
Also, i got this error after direct booting and playing a NeoDS game (which only works on DSL, not dsi or 3ds for some reason). To get teh error to go away I removed NeoGeo from settings.ini/LastDir = /NeoGeo

Does Stella corrupt using the new DSTwo.nds? Or is the only difference BAGPlug and BAGOS? I'll look into that error you're having, it might be a bit difficult to track down the actual problem as the DS2 seems like corrupting its memory quite often.
 

VatoLoco

Don't crush that dwarf, hand me the pliers.
Member
Joined
Jan 29, 2008
Messages
2,319
Trophies
0
Age
49
Location
Ya Cant Get There From Here
Website
www.backwoodzstudioz.com
XP
2,153
Country
United States
Does Stella corrupt using the new DSTwo.nds? Or is the only difference BAGPlug and BAGOS? I'll look into that error you're having, it might be a bit difficult to track down the actual problem as the DS2 seems like corrupting its memory quite often.

ah, i had been using you recently updated DStwo.nds . I switched it for the one provided in the BAGOS download and that fixed the glitchy bottom screen on Stella.
 

BassAceGold

Testicles
OP
Member
Joined
Aug 14, 2006
Messages
495
Trophies
0
XP
420
Country
Canada
ah, i had been using you recently updated DStwo.nds . I switched it for the one provided in the BAGOS download and that fixed the glitchy bottom screen on Stella.

In regard to your previous error, if you manually set settings.ini/LastDir = /NeoGeo, do you still get the errors on boot? Or does that only happen when you direct boot? Does it also happen if settings.ini/OpenLastDir = 0 and you try direct booting?
 

VatoLoco

Don't crush that dwarf, hand me the pliers.
Member
Joined
Jan 29, 2008
Messages
2,319
Trophies
0
Age
49
Location
Ya Cant Get There From Here
Website
www.backwoodzstudioz.com
XP
2,153
Country
United States
In regard to your previous error, if you manually set settings.ini/LastDir = /NeoGeo, do you still get the errors on boot? Or does that only happen when you direct boot? Does it also happen if settings.ini/OpenLastDir = 0 and you try direct booting?

it prolly has to do with the neods moonshell version being extlink and not arg.
Yes, it still errors trying the manual entry and setting OpenLastDir = 0.
I also changed my directory from NeoGeo to NeoDS, and curiously the direct booting on my DSi works, at least on the first boot, but then i need to delete the settings.ini/LastDir = /NeoDS or I get the same [dbg msg] error when i start up the BAGOS.plg.

edit: appy-polly-logies for fixating on neoDS, as its an unofficial mod of the emulator anyhow. And i am impressed by BAGOS so far. just need a script for covers, and one for working mp3 playback=)
 

BassAceGold

Testicles
OP
Member
Joined
Aug 14, 2006
Messages
495
Trophies
0
XP
420
Country
Canada
Updated binary now in the first post.

Changelog:

-Drastically improved script interpreter stability. Hopefully there won't be any more memory corruption affecting other parts of the menu.
-Reduced the memory used per script instance. Instead of each script allocating their own instances of each operation, they now use a common pool of operations allocated at the beginning.
-The menu does a better job at freeing up its own resources when launching a binary

So with this update, one noticeable change is that copy and paste now works properly.
 

BassAceGold

Testicles
OP
Member
Joined
Aug 14, 2006
Messages
495
Trophies
0
XP
420
Country
Canada
Another small update (See first post for link):

-Further improvements to script interpreter stability
-improved script parsing, scripts should load a bit faster now
-Updated CHKKEY operations to include a jump if key is true, rather than having to check on the next line
-updated wiki with improved CHKKEY functions.

I'm not sure if the lack of replies here indicate that no issues have been found with the last build (like the ones presented by VatoLoco) or not. If that is the case (there being no bugs), then I shall continue to work on improvements rather than continuing to check stability.
 
  • Like
Reactions: Sicklyboy

VatoLoco

Don't crush that dwarf, hand me the pliers.
Member
Joined
Jan 29, 2008
Messages
2,319
Trophies
0
Age
49
Location
Ya Cant Get There From Here
Website
www.backwoodzstudioz.com
XP
2,153
Country
United States
Load nds roms through EOS (No nzip support yet)

does this mean no internal loader atm (like bagplug uses hbmenu loader iirc)? Noticed when trying to use the 'internal' option to boot .nds files (commercial and homebrew), it just hangs at the 'booting file' screen. EOS option works fine for me.
 

BassAceGold

Testicles
OP
Member
Joined
Aug 14, 2006
Messages
495
Trophies
0
XP
420
Country
Canada
does this mean no internal loader atm (like bagplug uses hbmenu loader iirc)? Noticed when trying to use the 'internal' option to boot .nds files (commercial and homebrew), it just hangs at the 'booting file' screen. EOS option works fine for me.

The internal loader is still there. I just had to pre-initialize a file handle to NULL to fix the problem:ph34r:. Updated the first post with a fixed binary.
 

BassAceGold

Testicles
OP
Member
Joined
Aug 14, 2006
Messages
495
Trophies
0
XP
420
Country
Canada
I have quite the update this time around. It's mostly just new operations added to the script interpreter.

Operation Name and args Description
----------------------------------------------------------------

GETTIME array - gets the current time and stores in the given array (minimum size of 7 bytes)

Array Index - Time Unit
-------------------------
0 - seconds
1 - minutes
2 - hours
3 - weekday
4 - day
5 - month
6 - year

Example:
;make a 7 byte array
currentTime ARRAY '7

;store time in currentTime array
GETTIME currentTime

;store hours into register 0
LDARYC $R0, currentTime, #2



Added fat operations:

Each system can have 2 open file streams at a time, which are refered to as
file handles. The handles are numbers 0 and 1 when asked for handle_num.

These operations are still a work in progress and are subject to change. Thus, not much
documentation will be available yet.

FATOPEN handle_num, path, mode - An fopen wrapper
FATREAD handle_num, buffer, size, count - An fread wrapper
FATWRITE handle_num, buffer, size, count - An fwrite wrapper
FATGETS handle_num, handle, buffer, maxSize - An fgets wrapper
FATPRINT handle_num, string - An fprintf wrapper
FATCLOSE handle_num - An fclose wrapper
FATFLUSH handle_num - An fflush wrapper
FATREWIND handle_num - A rewind wrapper
FATSEEK handle_num, start, offset - An fseek wrapper
FATOUT handle_num, word - Write a word integer to file stream
FATOUTH handle_num, halfword - Write a half word integer to file stream
FATOUTC handle_num, byte - Print a character to file stream
FATEOF handle_num - An feof wrapper
FATRM filepath - Delete a file specified by filepath
FATRENAME oldName, newName - Rename a file



New video operations:

CLONESPR destSprite_num, srcSprite_num -Clones a src sprite to dest sprite
SPRFRAMEDIM sprite_num, width, height -Sets a sprites frame dimensions
SPRFRAME sprite_num, axis, frame_number -Sets a sprite frame to frame_number. Axis refers to orientation of sprites (1 = horizontal strip, 2 = vertical strip)
SETSPRXY sprite_num, xpos, ypos -Sets a sprite position to x and y pos
SETSPRALPHA sprite_num, alpha -Sets a sprites alpha blending to alpha(0 - 255)

New Menu operations:

MENU_SCREENCAP -Takes a screenshot of the menu in its current state


Proper documentation (the Wiki) will hopefully be updated this weekend with all this new stuff. In the mean time, you can check out some of the new video operations in the new clock script now included in the base download.

2013-05-22_210401.png

(Number sprites taken from AKAIO Blue XMB 1.0 by Cannonfoddr)

One thing to note, the clock script is running on the top screen and redraws itself every frame. If you are running another script on the bottom screen that updates itself every frame as well, your frame-rate will drop in half. This is a limitation of the DS card slot transfer speeds. To fix this, either have your scripts all run on the same screen, or modify the clock script to only redraw itself every minute (This may cause problems if other scripts draw on the top screen, the clock might disappear till the next minute).

Anyway, check out the first post for Release 2.

New possible script ideas:
  • instead of using the physical DS buttons to bring up the menus, someone could make touch screen buttons to do so
  • fancier clocks!
  • calendars (this one could still be a bit challenging)
  • backgrounds that change based on time of day
 
  • Like
Reactions: VatoLoco and Boriar

Boriar

Well-Known Member
Member
Joined
Sep 22, 2008
Messages
316
Trophies
0
Age
50
Location
Spain
XP
653
Country
Why not post on filetrip to archive purpose? Only ask for curiosity
I really like how it evolve. I must to find some time to experiment (:gun: dawn work)
 

BassAceGold

Testicles
OP
Member
Joined
Aug 14, 2006
Messages
495
Trophies
0
XP
420
Country
Canada
Why not post on filetrip to archive purpose? Only ask for curiosity
I really like how it evolve. I must to find some time to experiment (:gun: dawn work)

Filetrip is a pain for rapidly uploading new versions on a whim (which i do quite often). Once the menu gets to a state where its usable for all users rather than its current experimental scripting stages, I'll start putting the legit releases on filetrip.
 

BassAceGold

Testicles
OP
Member
Joined
Aug 14, 2006
Messages
495
Trophies
0
XP
420
Country
Canada
The wiki has now been updated with the sprite and FAT stuff. The GETTIME operation will eventually make its way on a separate page where other system operations (that have yet to be added) will reside. Until then, if you need documentation on GETTIME, you can check out the clock script that is included with the BAGOS download.
 

BassAceGold

Testicles
OP
Member
Joined
Aug 14, 2006
Messages
495
Trophies
0
XP
420
Country
Canada
Sorry for the lack of updates. I just finished writing exams for the semester so now I should have a little time to do things.

The next update is in the works and currently has:
  • ini file opening / reading
  • New sprite drawing system. You can now draw and change a sprite multiple times per frame without using more than one sprite slot. Currently you'll only be able to draw up to 32 objects per frame.
  • Sprite registers SX# and SY# (these were undocumented) are now removed in favor of the SETSPRXY operation
Planned for the update:
  • ini file writing
  • cpu frequency control

What is/will be possible with this update:
  • can make settings files for your own scripts
  • can manipulate the menu's setting files within scripts (scripted option menus?)
  • CPU control scripts, could make a boost button, or attempt at making automatic CPU scaling
Update should be out in a couple days, just need to make sure the ini file support is handled properly which brings me to this topic:

How should errors be handled in BAGASMI?
I'm talking about errors of missing files, as in, you try calling LDSPR to load a sprite and the image file doesn't exist. I've been jumping between two different ways.
  • The first method has the interpreter stop the script and report the error
  • The second method, a zero value is returned that could be detected with a JMPZ call.
With the first method, you don't catch the errors yourself and the script halts immediately, where with the second method, you handle all errors yourself and could attempt to rectify the situation on your own.
 
  • Like
Reactions: VatoLoco
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Xzi @ Xzi:
    lol
    Gift
  • Xzi @ Xzi:
    PS5 games are actually considerably smaller than PS4 games
    +1
    Gift
  • Xzi @ Xzi:
    better compression/optimization i guess
    Gift
  • kenenthk @ kenenthk:
    But it only has like 4 games :tpi:
    Gift
  • Julie_Pilgrim @ Julie_Pilgrim:
    what is something you can say about console homebrew but also in the bedroom
    Gift
  • kenenthk @ kenenthk:
    Time to transfer files
    Gift
  • Julie_Pilgrim @ Julie_Pilgrim:
    "it was so hard the first time"
    +1
    Gift
  • Julie_Pilgrim @ Julie_Pilgrim:
    "Time to transfer files" bro having sex with robots
    +1
    Gift
  • Julie_Pilgrim @ Julie_Pilgrim:
    honestly knowing ken that isn't that unbelievable
    +1
    Gift
  • Xzi @ Xzi:
    arent many ps5 exclusives it's true, but there are a whole lot of ps4 games that got ps5 upgrades
    Gift
  • Xzi @ Xzi:
    and those have to be stored on one of the SSDs
    Gift
  • Xzi @ Xzi:
    "time to smash the stack"
    Gift
  • kenenthk @ kenenthk:
    Uremum does like to call me dadbot
    Gift
  • kenenthk @ kenenthk:
    Nothing beats a midnight shower
    Gift
  • AkiraKurusu @ AkiraKurusu:
    I'd say there would be more PS5 exclusives...if people could actually buy PS5s.
    Gift
  • Gift
  • AkiraKurusu @ AkiraKurusu:
    I mean, if no-one can buy a PS5, and thus is stuck with PS4 (Pros), then companies would still see some profit from developing PS4 games with PS5 upgrades; meanwhile, if they developed a PS5 game, then everyone who can't get that console won't buy that game, especially at launch.
    Gift
  • kenenthk @ kenenthk:
    Nah every console starts early with low libraries
    Gift
  • Xzi @ Xzi:
    well theyre churning them out as fast as they possibly can, not like Xbox or PC are faring much better with the chip shortages
    Gift
  • Xzi @ Xzi:
    and games still take 4-6 years to develop regardless, so its not like sony can conjure up new exclusives out of thin air
    Gift
  • kenenthk @ kenenthk:
    Makes me wonder what they have now and are actually hiding from the public
    Gift
  • kenenthk @ kenenthk:
    I hope in the next 5 years they can move on to even more realistic skin renders and not just make characters look like Shiney clay molds
    Gift
  • Gift
  • Veho @ Veho:
    I'm waiting for the ultimate DLC, "The Most Dangerous Game".
    Gift
  • Veho @ Veho:
    Let me hunt people or GTFO :angry:
    Gift
    Veho @ Veho: Let me hunt people or GTFO :angry: