Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Bgoulette

Pages: 1 2 [3] 4 5 ... 8
31
Scripting / Re: folders Q:
« on: January 20, 2019, 12:24:24 PM »
You know what's even stranger? I created a folder called assets -- just because that seemed like a good name. Had no idea it was a magic word...

Anyway, I placed a couple of fonts in there, but in my layout.nut, I just reference them like this:

Code: [Select]
local fonts = {
    myFontA = "fontname1.ttf",
    myFontB = "fontname2.ttf"
}

without reference to the assets folder, and my layout still finds them! AM seems perfectly content to render this correctly:

Code: [Select]
local myText = fe.add_text("Text goes here", 0, 0, 500, 100);
myText.font = fonts.myFontA;

Maybe the above can help you (somehow)? Maybe not, but figured I'd mention it!

32
Scripting / Re: Drop shadow layout, may be turned into something useful?
« on: January 20, 2019, 12:20:50 PM »
Looking forward to poking around in this! (Sorry for the banal comment: seems AM forums' don't have a means of bookmarking threads?)

33
Scripting / Know the width of a listbox item when using magic tokens?
« on: January 18, 2019, 02:19:38 PM »
Hey all,

I'm using magic tokens in the entries for a listbox. Mostly just so I can force them to uppercase. But it got me thinking...

I don't want to have to use the smallest common denominator when choosing char_size based on the longest title in my list. Initially, I added a block in my function that chopped off anything over x characters and appended an ellipsis character. It works, but because proportional fonts means, say, a string 50 Ms would be wider than a string of 50 Is (for example), that approach left me with a weird case where an entry with plenty of space left over might get the ellipsis treatment. Clear as mud? Sorry! I'll attach a picture to show what I'm talking about.

I know there's a "msg_width" property for fe.Text instances, but a) is it accessible from fe.Listbox instances, and b) is it accurate? I searched and found another post where the indication was that it wasn't quite up to snuff. If those properties are barking up the wrong tree, does anyone have any other suggestions on how to accurately gauge the width of a non-word-wrapped list item? Thanks!

34
Scripting / Re: shader-module: First official release
« on: January 17, 2019, 05:27:05 PM »
You can have a look at the shaders in my Arcadeflow theme, it works, if you need some guidance let me know

Hey, thanks! I think I managed to trick your set up into working for me! I even tried wrapping up as a module, but it only works once. And that's enough for me. For now. Maybe someday I'll poke around a little more? :) [Something to do with how surfaces are assigned/referenced, I think...]

I'm attaching the blurred-art.nut file just in case anyone's curious. Thanks, zpaolo11x!

35
General / Re: AM hangs on exit from MAME
« on: January 17, 2019, 02:24:16 PM »
Thanks again, progets, but nothing there made a difference in my setup. So I just downloaded AM again and set up a new folder. And now things seem to be working. I must have screwed something up, but I have no idea what! At least it's working again! I appreciate your time.

36
General / Re: AM hangs on exit from MAME
« on: January 17, 2019, 03:19:52 AM »
Thanks, progets. Removing the exit_hotkey line did not fix things: in fact, whether it's because of that or not, removing that line seemed to prevent AM from showing up in Task Manager at all -- I had to restart my machine to get it to close!

I'm using AM 2.5.1, and I'm happy to provide any other files or info that might assist in figuring this out. Thanks again!

37
General / Re: AM hangs on exit from MAME
« on: January 16, 2019, 06:40:15 PM »
Me again. Still no idea what I need to do (or even try next) to fix this constant crashing after exiting from Mame. Has no one else run into this and managed to solve it? Thinking I might have to gut my AM install and start over. Ugh. :(

38
Scripting / Re: A few questions about do_nut and referencing tables
« on: January 15, 2019, 05:40:57 PM »
All right, read the Squirrel docs a little more carefully and discovered I was attempting to assign "slots" (which I still think of as properties or attributes) the wrong way. Changing things up to something like the following seems to work:

Code: [Select]
this.rom_1942 <- { btn1 = "Fire", btn2 = "Loop };

Still have no idea about add_transition_callback :(

Wrapping my function name in quotes. That's what I was missing. Wow. Seems to be working now!

39
Scripting / A few questions about do_nut and referencing tables
« on: January 15, 2019, 06:01:59 AM »
Hey everyone.

Some relevant history: I used to live my life in Flash, particularly ActionScript, so most of my [limited] coding experience stems from that bygone era. I mention that because I'm having some trouble figuring out how to do a few things.

I have a .nut in which I'm placing a bunch of objects -- tables in Squirrel-speak, right? When I place the following in my layout.nut: fe.do_nut(filename.nut), which contains a few tables, if I try to access those tables later in my layout, I get a message saying they don't exist. Am I misunderstanding how do_nut works?

Second, in this external file (and I've tried in the main layout.nut, too), my objects (tables?) have names like rom_1942 or rom_bgaregga. What I'm trying to do is, on transition (that's another bag of fun I haven't figured out), combine the prefix rom_ with the results of fe.game_info(Info.Name) to access the equivalent table and its slots (e.g., rom_1942.btn1). Is there a way to reference a table when its name is composited like that? In javascript, I could do something like this:

Code: [Select]
var rom_1942 = { "btn1": "Fire", "btn2": "Loop" };

var pref = "rom_";
var romname = "1942";

console.log(window[pref + romname].btn1); // Outputs "Fire"

I'm partially thinking out loud here, and I don't have access to my AM machine right now...I guess my question about accessing indeterminate objects is what's the right way to access them? Could I use fe[pref + romname] and read its properties that way?

And since I'm here and rambling, are there any good, initially simple examples of how to get fe.add_transition_callback() to work? I've done something like this with no results:

Code: [Select]
function doStuff (ttype, var, ttime) {
    print ("ttype: " + ttype); // Never fires?
    return false;
}

...

fe.add_transition_callback(doStuff);

Clearly, I don't know what I'm doing. Thanks for any advice or insight!

40
General / Re: AM hangs on exit from MAME
« on: January 14, 2019, 04:40:12 PM »
I tried deleting attract.cfg and letting AM rebuild it, but I still get the hang on exit. Mame works fine when running it through the command line or through the ui: it appears to be something with the way Mame and AM interact.

Any other thoughts? Help, please! Thanks!

41
General / Re: AM hangs on exit from MAME
« on: January 13, 2019, 07:38:13 AM »
Thanks for the suggestion, but that doesn't seem to be it. (Unless there's more to turning it off than unchecking it?) I'm still getting the hang after exiting a game: the system doesn't return me to AM, it just sits there until I manually kill AM from Task Manager. Any other thoughts?

42
General / AM hangs on exit from MAME
« on: January 11, 2019, 09:56:57 AM »
Hey all,

I'm not sure what I did, but whereas AM used to work just fine when exiting from Mame, now, it hangs, and I have to open the task manager and kill AM. I'm almost positive I read something about this previously, but if I did, I can't remember the search terms, because I'm not seeing any results.

I'm running the latest AM with mame64 on Windows 10. AM is running in the default (fillscreen) window mode. But none of the modes work like they should -- even windowed hangs.

I'm attaching my mame.cfg and attract.cfg files, just in case someone can spot something weird in there, but they look pretty standard to me. Thanks for looking!

43
Scripting / Re: shader-module: First official release
« on: January 10, 2019, 11:07:22 PM »
Not sure if there's any use/interest in the following -- or if it's cool to use, since I largely stole it from Shadertoy and modified it to work in AM. (Attribution included in shader file, fwiw.) In any case, it's a simple radial blur filter:

radialBlur.fsh
Code: [Select]
//
// Radial blur (simplified) for AM
//
// Modified for AM based on "Radial Blur (simplified)" by hunter
// (https://www.shadertoy.com/view/4ts3Ws), itself, per hunter's
// comment, "A simplified version of: https://www.shadertoy.com/view/4sfGRn"
//
uniform sampler2D sampleTex;
uniform float amount = float(80.0);      // 80
uniform vec2 start_pos = vec2(0.0, 0.0); // -1.0 to 1.0 for x, y
uniform vec2 rez;                        // typically fe.layout.width. fe.layout.height
uniform float g_punch = float(1.01);     // Subtle gamma boost (use < 1.0 for gamma reduction?) [Currently not user-defineable]

vec3 deform( in vec2 p )
{
    vec2 uv;
    uv.x = sin( 0.0 + 1.0 ) + p.x;
    uv.y = sin( 0.0 + 1.0 ) + p.y;
    return texture( sampleTex, uv * 0.5 ).xyz;
}

void main()
{
    vec2 position = -1.0 + 2.0 * gl_FragCoord.xy / rez.xy;
    vec2 current_step = position;
   
    vec2 direction = ( start_pos - position ) / amount;
   
    vec3 total = vec3( 0.0 );
    for( int i = 0; i < int( amount ); i++ )
    {
        vec3 result = deform( current_step );
        result = smoothstep( 0.0, 1.0, result );
        total += result;
        current_step += direction;
    }
   
    total /= amount;

gl_FragColor.rgb = vec4(total * g_punch, smoothstep(0.0, 1.0, b));
}

I even added a class for keilmillerjr's Shader module:

Code: [Select]
class RadialBlur {
//
// Accepts the following arguments (order matters!) (defaults are listed in parens):
// amount (100)
// origin (0.5, 0.5) [coords are 0, 0, to 1, 1]
// resolution (layout dimensions)
//

shader = null;

constructor(...) {
shader = fe.add_shader(Shader.Fragment, shadersDir + "radialBlur.fsh");
if (vargv.len() == 0) set_default();
if (vargv.len() == 1) set_default(vargv[0]);
if (vargv.len() == 3) set_default(vargv[0], vargv[1], vargv[2]);
if (vargv.len() == 5) set_default(vargv[0], vargv[1], vargv[2], vargv[3], vargv[4]);
}

function set_default(a=100, sx=0.5, sy=0.5, rx=::fe.layout.width, ry=::fe.layout.height) {
// Get normalized coords for blur origin (0.0~1.0 vs. -1.0~1.0):
// (Adjusting center introduces some weird edge stuff sometimes?)
sx=-((2 - (sx * 2)) - 1);
sy=((2 - (sy * 2)) - 1);

shader.set_texture_param("sampleTex");
shader.set_param("amount", a);
shader.set_param("start_pos", sx, sy);
shader.set_param("rez", rx, ry);
}
}

And here's how I'm using it (after loading the Shader module and adding radialBlur.vsh to the shaders folder):

Code: [Select]
local radialBlur = RadialBlur(150, 0.31, 0.37);
paBackground.shader = radialBlur.shader;

I'm attaching the shader and an example image to this post. I'd like to try to introduce some more dynamism: on images (or videos) with large swaths of static content, it's not terribly impressive. Maybe introducing noise or something would spice it up some? The thing is, I only know enough about GLSL to usually muck things up! Part of learning, I guess! ;-) [Full disclosure: I was trying to get a 2-pass Gaussian blur filter to work, but I couldn't trick it into working!]

44
Scripting / Re: "Magic" Tokens and weird results [ toupper() ]
« on: January 09, 2019, 03:23:08 AM »
Something fishy is going on related to "\n" character: look at this simple layout:

I thought that, too, but even ditching the newline produces weird, arbitrary-looking results for me!

Here's the layout I'm working on. It's still a wip, but it exposes everything I'm doing, in case it's me screwing up (attached). Sometimes it looked like something in the expansion just gets tired and spits back the un-magic token. Or even just a part of it. Weird! Thanks for looking!

45
Scripting / "Magic" Tokens and weird results [ toupper() ]
« on: January 08, 2019, 09:18:46 PM »
This is really weird.

I want certain game details returned in uppercase text. I discovered the toupper() function, but when running magic token text through a magic token function (e.g., [!getTitle]), sometimes it looks like it works, other times it returns a bunch of weird junk: an odd mixture of "magic-less" token parts and who knows what else.

Here's what I've coded:

Code: [Select]
function getTitle () { return fe.game_info(Info.Title).toupper(); }
function getMfr () { return fe.game_info(Info.Manufacturer).toupper(); }
function getPlayedTime () { return fe.game_info(Info.PlayedTime).toupper(); }
function getName () { return fe.game_info(Info.Name).toupper(); }
function getEmu () { return fe.game_info(Info.Emulator).toupper(); }

function getStatus () {
    if (fe.game_info(Info.Status).len() < 1) {
        return "";
    }
    else {
        return "; " + fe.game_info(Info.Status).toupper();
    }
}

And here's the line where I'm trying to populate my text instance:

Code: [Select]
local _gameInfo = fe.add_text("[!getTitle]\n© [Year] [!getMfr]\n[Players] PLAYER(S)\nPLAYED FOR [!getPlayedTime]\n[!getName]; [!getEmu][!getStatus]", 228, 880, 704, 136);

I tried adjusting the line breaks, adding whitespace, etc., but the fact is, it just doesn't work as-is. I'm not sure if I'm missing something or if there's a hiccup with getting the "processed" text from the magic token function(s).

If there's a simpler way to do this, I'm all ears. I tried chaining .toupper() directly to my tokenized string, but that just returned an uppercase version of the untranslated tokens. :shrug:

Here's a pic of some of the results (attached). Thanks for any help!


Pages: 1 2 [3] 4 5 ... 8