|↑back Search ←Prev date Next date→ Show only urls||(Click on time to select a line by its url)|
I apologize for disappearing.
And oscar as well
Had to get bunch of stuff going here at Work
|........... (idle for 50mn)|
|***||SNDTST has quit IRC (Read error: Operation timed out)||[00:54]|
|........ (idle for 37mn)|
|Vito` has joined #jsmess||[01:31]|
|oscar||Yes, likewise. It's been a week.
I think I came here with the same objective as you, SNDTST.
The short answer is: MAME is scriptable through Lua. Most of the internals are exposed through the Lua engine (looks like it's done mostly manually internally in luaengine.cpp).
It should be easy enough to write some simple Lua functions to switch disk images, since all that functionality is exposed. The challenge, I think, is going to be calling those from outside MAME.
|bai||I would say it's not even so much that that part is particularly difficult - it's just a matter of working out the correct magic incantation
this will probably all boil down to a couple one-liners in the end
|oscar||If it were on a local machine, it'd be easy; just open up a local socket or the like, and feed some data back and forth over that.
I was trying to have a think about the ideal mechanism inside the browser, though.
|bai||there's likely some function in mame that basically boils down to execute_lua_script(str)||[01:46]|
|oscar||The magic Lua incantations probably aren't all that magical.||[01:46]|
|bai||we can expose that function, then inject lua scripts from the client||[01:46]|
|oscar||Sure, I think looking at the Lua console plugin probably covers that pretty well; the Lua interpreter is pretty much just a read/evaluate/return/repeat loop.||[01:47]|
|bai||yeah, that seems like the best place to start||[01:48]|
|.... (idle for 16mn)|
|oscar||As for actually switching the floppy, it looks like it's probably pretty well exposed in the machine.images array. Check https://github.com/mamedev/mame/blob/master/src/frontend/mame/luaengine.cpp starting line 1974.
Depending on what machine we're emulating, some combination of load() and unload() for switching disks should work.
Of course, it won't do much for the stuff that's using pce or DOSBox.
But this is a good place to start, I think.
I just need to finish assembling the environment; I'd love to be able to do this without having to modify MAME at all, which might be possible.
What would be helpful is if there were an easy way to bring up the emscripten console... anyone a seasoned hand who knows how to wave the dead chicken just right?
(this was easier in Quake...)
|bai||emscripten doesn't really have a console built in, but ctrl+shift+j (chrome) or ctrl+shift+i (ff) will get you the dev console. from there if you can get a reference to the running emscripten module, that's where the functions that control emscripten execution are defined
in mame I believe you can press ` to get to the mame osd menu, but I'm not sue if the lua stuff is exposed through that or not
|SketchCow||oscar: Good to ask DFJustin or Lord_Nigh about how to do the interface part for you
The framework for making this get called by a key might be a lot easier than that
|***||Ipggi has joined #jsmess||[02:19]|
|oscar||Yeah, I was hoping more for stdin/stdout emulation.
The MAME Lua console extension (which starts if you start it with -console on a regular machine) just uses that.
|bai||there is a way of hooking stdin/stdout from emscripten, so that's one way to consider if injecting scripts via some exposed function doesn't work out||[02:25]|
|oscar||I just wanted it to be able to test things using the Lua console to start with.
But I can do that with the desktop version, worst case.
|.... (idle for 17mn)|
|Console works fine in the desktop version, now to fire that up with some useful ROMs...||[02:42]|
We ALWAYS suggest using the desktop version for your whacky tests
And THEN we see where it blows up in the emscripten
Then you're not wondering which 3-4 layers might have gone boom
So in any case, this works from the Lua console, assuming you have the proper disk image in the current working directory:
That's on machine apple2ee, so disk drive names may vary.
The drives all live in the images table.
There are a few image devices for apple2ee, for example:
for k,v in pairs(manager:machine().images) do print(k); end
That'll give you: floppydisk1, floppydisk2, flop2, flop1, cassette, cass
Presumably the long names are just aliases for the short names, but I'm too lazy to verify right now.
Doing <image object>:load(<filename>) immediately boots the image when the machine is in boot, similar to how it would work if you inserted the disk in the drive while it was in loading mode.
The Apple II doesn't have anything like a drive state sense, so all it knows is whether a valid data stream is coming off the head when the disk is spinning, but other systems might have more state sensing.
In any case, there's a corresponding unload() method for when we want to make the drive empty.
All of this should be relatively compatible with BrowserFS. I'll probably need to wait until after the weekend to assemble my test, though.
|db48x||yes, when we compile MAME we can mark arbitrary C functions as exported
|oscar||Well, that's handy.||[03:11]|
|db48x||the lua engine has a C api, so we should be able to make function calls or inject scripts on demand||[03:11]|
|DFJustin||<oscar> It should be easy enough to write some simple Lua functions to switch disk images, since all that functionality is exposed. The challenge, I think, is going to be calling those from outside MAME.
mame's lua can check for keyboard inputs I believe, so it could be bound to a hotkey?
but I'd want to have a drop-down menu on the screen as well
|oscar||DFJustin: Yes, that's what I was thinking.
The Lua engine also lets you draw UI elements.
|***||SNDTST has joined #jsmess||[03:14]|
but probably not super useful for us, since we're running MAME at such a low resolution
|oscar||I'd say you might want to consider having an HTML drop-down menu for the current image in each drive, but that might be a bit much.
Or it might not, I dunno.
|bai||I think if we just expose the underlying functionality in a good way, then we can handle the ui any number of ways
|SNDTST||I saw the code in emularity for loading an image by index, is this as "simple" as supplying an array of images and then wiring up this function to a UI element? https://github.com/db48x/emularity/blob/master/loader.js#L577||[03:16]|
|bai||SAE is specifically for amiga||[03:17]|
|db48x||SAE has some special sauce that MAME doesn't||[03:17]|
|oscar||I was gonna say, that's sorta along the right lines, but for the wrong emulator.
But the MAME external functions are right above that, and I think that might be where you'd want to lash up the loading/unloading logic.
|db48x||oscar: almost :)
we would want a method or two on the MAMERunner that let you pick an image
|db48x||the MAMELoader would have a method to set the list of images for a device||[03:20]|
|oscar||You probably also want to make methods for unloading (empty drive) and also loading a blank disk?
Well, blank disk is maybe a step too far.
|db48x||no, it's not :D||[03:21]|
|oscar||For images that need a "blank" (but formatted) disk, you probably want to have a default image around for that.
Depends on the program, anyway.
|db48x||we would need different blank disk images for different emulators though, so that would be something we could do later||[03:22]|
|bai||there's no such thing as too much when it comes to this project :D||[03:22]|
|bai||if we can tie a cdrom directly into your system's burner via js, we would do it!||[03:22]|
|oscar||Not even just individual emulators, but given how many low-level variations there are on RWTS on Apple II, even on individual programs.||[03:23]|
|bai||we still want to hook printing in||[03:23]|
|oscar||If I can print to my ImageWriter II via USB->Serial from The Print Shop, I'll be a happy man. :-)||[03:23]|
|bai||print up some nice Print Shop Pro banners and invitations||[03:23]|
|db48x||yea, I've read about the Apple II and the RWTS, but I don't know much about it||[03:24]|
|oscar||I have two whole cases of fanfold and a bunch of ribbons, birthday parties are gonna be lit af at my house for the next decade.||[03:24]|
|db48x||I assume there's a generic type of disk image that will hold any data any RWTS can write||[03:24]|
|oscar||Well, I've seen talk.
The thing about the Apple II is that the Disk II interface is so low-level; it's literally a bunch of control bits plus a simple decoding engine for the GCR formatting.
All the control for the motor, head stepper, and even the spacing and alignment of bits on the track are done in software.
It's not like the C64, where the 1541 is just a serial device that does EVERYTHING for you.
|db48x||yea, I always enjoy reading 4am's notes on how he cracks apple2 software||[03:27]|
|oscar||So a lot of the copy protection regimes do incredibly fancy (or stupid) things with timing, changing the encoding bytes, other stuff. There's no way to make a "standard" blank disk.
But yeah, 4am's Twitter thread on Stupid Disk II Tricks is pretty amazing in terms of the really weird things people got up to.
|db48x||seems like there should be
you can address any quarter track, and you can start and stop writing at any phase angle
and you can use any nibble translation table you want
|oscar||My recollection is that the .DSK format pretty much just contains the encoded nibbles, but that isn't able to preserve the weird low-level variations you can have (like those ones, yes).||[03:29]|
|db48x||it doesn't seem hard to make a file that can hold that information, and let the software format it however it wants||[03:29]|
|oscar||So I know there's been a lot of talk about a new format that goes almost (or maybe actually) all the way down to the flux transition level.||[03:30]|
|db48x||but I agree that there's no universal _formatted_ disk||[03:30]|
But that may not strictly matter, as long as the image format is capable of representing it.
Because most programs that need a weird format for saving data, for example, are going to be able to format their own.
|oscar||The question of disk image formats, obviously, isn't 100% relevant to what we're looking at here; all we need to do is be able to point MAME to new filenames. :-)||[03:32]|
|oscar||I've gotta get to bed soon... does the Lua stuff I pasted above give you enough information to bang on it over the weekend?
We're headed out of town tomorrow, but I'll probably be able to revisit it some Sunday.
|bai||yeah, in the case of disk storage right now we just use browserfs to map localStorage to a directory
so we can store things like high scores, etc. for each user
|oscar||Right, I figured. BrowserFS solves a lot of problems.||[03:34]|
|bai||it's a great project, yeah||[03:34]|
|db48x||time for me to sleep
I'll be around all weekend
|oscar||Sounds good! I'll probably be back Sunday evening, but if not, Monday.||[03:37]|
|........ (idle for 36mn)|
|***||Vito` has quit IRC (Read error: Connection reset by peer)
Ipggi has quit IRC (Read error: Connection reset by peer)
SNDTST has quit IRC (Read error: Operation timed out)
|............... (idle for 1h13mn)|
|SNDTST has joined #jsmess||[05:28]|
|.................. (idle for 1h26mn)|
|SNDTST has quit IRC (Read error: Operation timed out)||[06:54]|
|.................... (idle for 1h38mn)|
|hook54321 has quit IRC (irc.Prison.NET west.us.hub)
oscar has quit IRC (irc.Prison.NET west.us.hub)
BnARobin has quit IRC (irc.Prison.NET west.us.hub)
pfalleno1 has quit IRC (irc.Prison.NET west.us.hub)
DFJustin has quit IRC (irc.Prison.NET west.us.hub)
ted______ has quit IRC (irc.Prison.NET west.us.hub)
arkiver has quit IRC (irc.Prison.NET west.us.hub)
i0npulse has quit IRC (irc.Prison.NET west.us.hub)
decay_ has quit IRC (irc.Prison.NET west.us.hub)
godane has quit IRC (irc.Prison.NET west.us.hub)
Lord_Nigh has quit IRC (irc.Prison.NET west.us.hub)
Rai-chan has quit IRC (irc.Prison.NET west.us.hub)
SketchCow has quit IRC (irc.Prison.NET west.us.hub)
Ash has quit IRC (irc.Prison.NET west.us.hub)
bai has quit IRC (irc.Prison.NET west.us.hub)
datajerk has quit IRC (irc.Prison.NET west.us.hub)
bwn has quit IRC (irc.Prison.NET west.us.hub)
zino has quit IRC (irc.Prison.NET west.us.hub)
balrog has quit IRC (irc.Prison.NET west.us.hub)
azakai has quit IRC (Read error: Operation timed out)
db48x has quit IRC (Read error: Operation timed out)
|..... (idle for 21mn)|
|logchfoo1 starts logging #jsmess at Sat Mar 03 08:55:43 2018
logchfoo1 has joined #jsmess
|..................................................................... (idle for 5h42mn)|
|db48x has joined #jsmess||[14:37]|
|................... (idle for 1h33mn)|
|Vito` has joined #jsmess||[16:10]|
|........... (idle for 52mn)|
|SNDTST has joined #jsmess||[17:02]|
|.................... (idle for 1h37mn)|
|SNDTST has quit IRC (Leaving)||[18:39]|
|...................................... (idle for 3h7mn)|
|azakai_ has quit IRC (Read error: Operation timed out)||[21:46]|
|.............. (idle for 1h8mn)|
|azakai_ has joined #jsmess||[22:54]|
|↑back Search ←Prev date Next date→ Show only urls||(Click on time to select a line by its url)|