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.


Topics - Bgoulette

Pages: [1] 2
1
Scripting / Check if a slot exists?
« on: January 30, 2019, 06:52:27 AM »
This is probably a silly question, but I haven't been able to divine an answer through the Squirrel reference docs or googling.

I'm used to Javascript (Actionscript, really), where I could test for the existence of an object property something like this:

Code: [Select]
if (obj.prop) {
    // Property exists: do stuff:
}
else {
    // Property DOES NOT exist: do something else:
}

If I try something similar with Squirrel (in my layouts), I get an error because the slot doesn't exist. Currently, I have a rat's next of try..catch statements to determine whether a slot exists, but it's messy (even though it works). Is there a cleaner way to handle checking whether a slot exists?

2
Scripting / fe.module_dir doesn't seem to work?
« on: January 24, 2019, 03:28:36 PM »
Hi all. Is there some trick to getting fe.module_dir to work? Is it even a real thing? I don't see any reference to it in the front-end binding section on github, but I've seen it in other people's code. Is it something I have to assign? If so, what kinds of voodoo are involved? I have a shader in a module folder, but whenever I run my layout, I'm told it can't find the relevant file. If I move the shader file to the layout folder, it works, but in my module script, it's effectively ignored. What am I missing? Thanks for any help!

3
Scripting / Vertex shader to address only part of the screen?
« on: January 23, 2019, 03:59:46 PM »
Hey there. I have a few shaders I've "written" (and by "written," I mean largely stolen from shadertoy and tweaked), but they affect the entire screen, and that's not what I'm going for. I want to be able to affect only a specific portion of the screen (or, more specifically, a surface that's smaller than the screen). I think a vertex shader might help, but I have no idea how to write one, and all my googling returns results for Unity or some other 3D-centric environment, and I'm not math-savvy enough to figure out what I need to do.

Has anyone run into anything similar? And come up with a working solution? Would such a person be willing to help a guy out? I appreciate it! Thanks!

(I'm attaching my kinda-sorta-working shaders just for laughs.)

4
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!

5
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!

6
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!

7
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!


8
Emulators / demul full screen improvements
« on: December 26, 2018, 06:31:06 AM »
Edit: I attached the relevant files, as well as made some changes to the akh script: now it stretches a 1x1 black pixel across the screen until demul loads a rom. There's still a brief flash, but it's getting better. A little. Meh. :)

I've written a dirty little AHK script that, in conjunction with a batch file, launches demul with a user-defined rom, and sets it to full screen, as well as enables the Esc key to return to AM. It _works,_ but it could be better; specifically, it exposes the desktop for about 3 seconds while demul loads the rom before entering full screen. And there's a flash of the same when exiting (I think). I'm running Windows 10 on an i5 with a GTX 1050Ti card. Here are the scripts I'm using, as well as the guts of the demul.cfg file:

Batch file (dfs.bat):
Code: [Select]
@echo off
"C:\Program Files\AutoHotkey\AutoHotkey.exe" demul_full_screen.ahk %1

AHK script (demul_full_screen.ahk):
Code: [Select]
#SingleInstance, force
SetTitleMatchMode, 1

; Move the mouse to the bottom right:
MouseMove % A_ScreenWidth, A_ScreenHeight, 0

; Display a single image as a SplashImage:
SplashImage, pixel.gif, b w%A_ScreenWidth% h%A_ScreenHeight% x0 y0 zw%A_ScreenWidth% zh%A_ScreenHeight%

RomName := A_Args[1]
Run %ComSpec% /c "demul.exe -run=naomi -rom=%RomName%", , Hide

; When demul.exe loads a rom, its title changes to a string beginning with gpuDX11hw
WinWaitActive, gpuDX11hw, , 3
Send !{Enter}
SplashImage, Off
return

#IfWinActive, ahk_exe demul.exe
    Esc::
    WinClose, A
    ExitApp

#IfWinActive

demul.cfg:
Code: [Select]
# Generated by Attract-Mode v2.5.1
#
executable           D:\Users\Blake\demul\dfs.bat
args                 [name]
workdir              D:\Users\Blake\demul\.
rompath              D:\Users\Blake\demul\roms
romext               .zip;.7z
system               Arcade
info_source          listxml
exit_hotkey          Escape
pause_hotkey         P
artwork    marquee         $HOME/demul/marquee
artwork    snap            $HOME/demul/video;$HOME/demul/snap

Any thoughts on improving this set up? I'd really like to know if there's a way to launch, say, some big, black screen that hides EVERYTHING until the WinWaitActive command in the ahk script completes, but maybe I'm going about it the wrong way altogether? Thanks for reading!

9
Scripting / Where's the debugger/console window?
« on: December 17, 2018, 02:58:22 PM »
I feel so stupid, but I'll ask anyway: how can I bring up the AM debugger or console window? I swear once upon a time, it was just there, but I'm sure I'm misremembering. I'm trying to create some layouts and a few custom classes, but I'm doing it so spectacularly poorly that I can't see anything, and I'm hoping the debugger/console will point me in the right direction. Thanks for anyone willing to help!

10
General / Windows 10, AM not launching MAME games?
« on: December 16, 2018, 05:27:23 AM »
Hello all.

I've searched the existing posts, but I'm either searching wrong or not finding what I need (or both), so here's what's happening. I have AM installed, and its detected MAME (the only emulator I have installed right now), but when I attempt to launch a game, I see "initializing" (looks like the MAME ui) for a few seconds, then I'm dumped back into AM. Games launch as they should through MAME directly, or through the command line, but not through AM.

Some of the posts I found mentioned mame.ini. The only mame.ini file I see is the one generated via MAME itself. There's a mame.cfg generated by AM, but am I missing something? The rompath is the one AM generated automatically (mame.cfg):

Code: [Select]
# Generated by Attract-Mode v2.5.1
#
executable           D:\Users\Blake\mame\mame64.exe
args                 [name] -skip_gameinfo
workdir              D:\Users\Blake\attract\.
rompath              D:\Users\Blake\mame\roms/
romext               .zip;.7z
system               Arcade
info_source          listxml
artwork    marquee         $HOME/mame/marquee
artwork    snap            $HOME/mame/video;$HOME/mame/snap

(The -skip_gameinfo flag is to bypass MAME warnings. I've tried without it, too.)

Any suggestions? Thanks!

11
Hey everyone,

I recently slapped Attract Mode onto a "new" (old) PC with the following specs:

Core 2 Duo
4 Gb RAM
GeForce 660

I'm running Mame 0.180, and it works as it should, but AM does this thing where when I launch a game, sometimes it'll flash a white screen or the desktop (I think this has been solved by switching to "Fill screen" instead of "Fullscreen"); but when I exit a game, I see the previous state of AM an there's no response to input for about 5 seconds -- then, a white/black flash, the desktop for a moment or two (including the AM console window), then back into AM and the screen has "caught up."

I'm running AM 2.2.1 on Windows 7 Ultimate. Any one else run into this? Solved it? Any advice? Thanks!

12
Emulators / Per-rom snapshot path with zsnes?
« on: December 03, 2015, 02:50:42 PM »
Hi all,

Because I wanted something that actually worked with AM, I ditched higan and am now using zsnes for Super NES emulation. I'm curious to know, though, if there's a way to set up zsnes to store snapshots from a given rom in a rom-specific folder. For example, I have it set to just save whatever in a "snap" folder off my zsnes folder; creatively enough, it looks like this: "zsnes\snap\" :)

Within zsnes, can I do something that has the functional equivalent of, say:

zsnes\snap\[romfilename]

What I've done for my mame titles is run the game, grab a snap of the title screen, and that's what shows up in my layouts. I'd like to do something similar with zsnes. I can set it up manually if necessary, but, well, I don't wanna! :P I guess this is my long-winded way of asking if there's any kind of "token" I could use?

Is this possible? Or am I barking up the wrong snorkel? Thanks!

13
General / Not really an attract mode question, but... higan?
« on: December 02, 2015, 11:22:11 AM »
Hey all,

I have Mame up and running quite nicely in attract mode. Yay! With that success, I wanted to branch out to other emulators, and I came across higan (formerly bsnes, I think). But here's the thing: I have no clue how to get it work! I've got a selection of roms, and I ran the icarus app to generate a manfiest, but I see nothing when I attempt to load a rom. I'm sure I've missed something, but I was just wondering if anyone else had managed to get higan up and running. If so: share your secrets! Please! :)

(Apologies is this post is unwelcome or in the wrong place!)

14
Themes / "Traces" theme (1:1, 4:3, 16:9, and 16:9b variants!)
« on: December 02, 2015, 09:48:39 AM »
Hello all,

Here's a pretty simple theme, really:



It certainly doesn't break any new ground, but within the layout options are a bunch of thingies that let you tweak color variants to match your cab, room, mood, whatever :)

Here are a few examples:





As you can see from the layout options shot above, you can also tweak the opacity of certain "fade" elements. Currently, when run on a non-square monitor (that is, pretty much all of them!), color-matched bars mask things off on the sides (or presumably top and bottom, though I don't have a horizontal setup to test against).

Thanks to liquid8d and omegaman for helping me get a better grasp of Squirrel and the conveyor module (though there's still a lot to learn!).

Anyway, here it is. Enjoy!

Edit: now includes a 16:9 version! Here are some screens:









Edit 2: I added an alternate 16:9 variant that places the conveyor on the far side of the screen (as opposed to the bottom):



Edit 3: I just realized I forgot to include a module used in this theme! It's attached now (fill-artwork-bg.nut). Just place it in AM's modules folder. (This variant isn't as full-featured as the one liquid8d is developing, but it suffices for a barebones implementation. Also, it's not documented terribly well :()

Edit 4: I've done some more housekeeping and added a couple new options. Under the hood, this code...needs some help, but it's functional! (Still need to get a better handle on composition/inheritance with dynamically-typed languages, etc.!) Also, 16:10 aspect ratio:



Edit 5: Added options for different art for the carousel or background (currently only snap or flyer, but I'll probably add marquee soon):


15
Scripting / Assign fe.Text instance charsize property dynamically?
« on: November 28, 2015, 07:41:07 AM »
Hi all,

Here's my (latest) question: if I have a text field that, at a given charsize, would get clipped, is there a flag or property that gets set somewhere that informs me of, say, the number of lines or soft carriage returns? That might not be the right way to phrase it, so here's what I want to happen:

If I have a string of text that wouldn't fit in a text instance (let's say I have a text field 1000 pixels wide; the text I want to assign to its msg property would take up 1200 pixels at a given charsize), is there any way to know, programmatically, when I'm out of bounds, visually? I want to recursively reduce the charsize until all the text fits within the available space, but I'd need to know when I'm back under the maximum width. In the way that fe.Text.width refers to the assigned width of the text instance, is there any internal value that lets me know what the actual width of the text is? Similar, I guess, to fe.Image.texture_width.

Clear as mud? Maybe pictures will help (they help me all the time!):

Uncorrected. This is what an overlong game title would look like:


Corrected. This is what I want to achieve programmatically:


Any thoughts? As always, thanks!

Edit: I just now noticed the scrollingtext module, and buried in there is code that would potentially work. Holy crap there's a lot of stuff under the hood there! :( Wow...

Pages: [1] 2