Dynamically Load Code from SD Card?

Titan Two general support. Questions, firmware update, feature request.

Dynamically Load Code from SD Card?

Postby PoshLemur » Wed Jun 20, 2018 9:49 am

Memory Slots 4-9 are dedicated to the SD card. I'm assuming this is more of a numeric limitation due to the TITAN 2's single digit LED display.

It would be extremely nice to be able to design a script that can call other scripts based on their filename that are stored on the SD card. We could have a "Script Explorer" pane in Gtuner just like we have the "Macro Explorer"

I was thinking it could work like this maybe.
script_load(battle1.gbc);

Is this at all possible? With this we could chain multiple scripts together that load a script from memory based on context.
My github account: [link]
User avatar
PoshLemur
Sergeant Major
Sergeant Major
 
Posts: 75
Joined: Thu Mar 08, 2018 9:26 am

Re: Dynamically Load Code from SD Card?

Postby glenntidbury » Wed Jun 20, 2018 12:34 pm

This is a really good idea!

If it were implemented, would we still have a limit on script size? I had to cut some elements out of my script (probably partly because I'm new to all this, so there's probably a more optimal way to code things), because it kept telling me it was loaded with an error, byte code limit exceeded.

If I could split the script into sections and then have one main script to call the others from, would the T2 still run ok, or would this same limit apply across multiple scripts?

Really like this idea though!
User avatar
glenntidbury
Sergeant Major
Sergeant Major
 
Posts: 98
Joined: Thu May 24, 2018 4:34 pm

Re: Dynamically Load Code from SD Card?

Postby Scachi » Wed Jun 20, 2018 2:17 pm

The limit will still apply...
if you load the next "part" of the script you'll loose the functions/actions from the previous "part" of the script.

But loading a new script into the same slot at would be great for adding in-game adjustment to scripts.
Like holding down a button combo will enter an "edit mode" (load the other script into the same slot) and I can use all the bytespace for adjustments, accessing the pmem space and writing the values back + leaving "edit mode" after that, loading the "gameplay" part of the script again. All using one slot only.

Or think about games like Streetfighter, that would allow one slot to be used for a lot of characters. The main script just loads the script for the character in use.
Last edited by Scachi on Thu Jun 21, 2018 4:32 pm, edited 1 time in total.
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: Dynamically Load Code from SD Card?

Postby J2Kbr » Thu Jun 21, 2018 4:23 pm

As Scachi pointed out, the bytecode size limit would still apply. This limit is related with the RAM block allocated to run scripts, rather than the storage limitations. Scripts are loaded into RAM for performance reasons.

Nevertheless, the idea of loading a script from the sd-card based on filename is nice. I will be strongly considering this suggestion. Thank you.
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: Dynamically Load Code from SD Card?

Postby PoshLemur » Fri Jun 22, 2018 7:52 am

I do like Scachi's idea very much and if it's possible would be much better than my idea. I imagine though that it would be much simpler to implement a complete script load than to load in chunks of data that could potentially go over the byte size/memory limit.

For myself in particular being primarily a PC gamer using consoles to game with my friends. I use Titan 2 almost exclusively for Mouse/Keyboard style control simulation, much more complex than just mapping inputs. This tends to take up a large amount of the byte size limit. There are occasions where I might want to switch to using my controller on the fly and load up a script better suited for that controller.

I'd make a KBM-centric script and a separate controller-centric script, then I'd have a keyboard button bound to load up my controller script, and a controller button to load up my KBM script. No persistent memory needed for my personal usage.
My github account: [link]
User avatar
PoshLemur
Sergeant Major
Sergeant Major
 
Posts: 75
Joined: Thu Mar 08, 2018 9:26 am


Return to Titan Two Device

Who is online

Users browsing this forum: No registered users and 74 guests