Time |
Nickname |
Message |
04:11
π
|
SketchCow |
I'll be right over |
04:11
π
|
SketchCow |
<airsiren> |
04:14
π
|
db48x |
heh |
04:19
π
|
|
taisel has joined #jsmess |
05:28
π
|
|
taisel has quit IRC (Quit: Leaving) |
05:33
π
|
|
icculus has joined #jsmess |
05:34
π
|
icculus |
hello, Jason Scott sent me. |
05:35
π
|
bai |
oh man, bringing in the big guns :D |
05:36
π
|
bai |
welcome |
05:37
π
|
icculus |
hi. :) |
05:38
π
|
bai |
so how much do you know about what's going on in here? I'm more than happy to get you up to speed |
05:38
π
|
icculus |
Jason said there was some sort of MAME-vs-Emscripten issue, and I should come get technical details from the fine folk in this channel. |
05:38
π
|
icculus |
Something about it using 100% CPU for no good reason |
05:39
π
|
bai |
yeah, so it's been working pretty solid for a while now, but we want it faster and yeah, less cpu burning when idle |
05:39
π
|
bai |
MAME is built using the standard game loop architecture, a tight loop executing as fast as possible, with some calls to a sleep wrapper which calls the appropriate sleep function for the platform |
05:40
π
|
bai |
to control timing of machine chips and ultimately frame output |
05:41
π
|
bai |
but with emscripten...well, how much do you know about that whole thing, specifically its async handler? |
05:41
π
|
icculus |
Iβve gotten a few games running with Emscripten: https://icculus.org/ut99-emscripten/ and some stuff on playonjump.com |
05:41
π
|
icculus |
So Iβm pretty familiar |
05:43
π
|
bai |
cool, yeah I figured. so, we've modified MAME's main game loop to use emscripten_set_main_loop, and as it is now we basically have it hardcoded to assume 60fps, and to advance the machine's internal emulation clock by the appopriate number of ticks |
05:44
π
|
bai |
https://github.com/mamedev/mame/blob/master/src/emu/machine.cpp#L1321-L1360 |
05:45
π
|
bai |
using that code, the cpu profile looks like this https://i.imgur.com/80HgKvk.png |
05:46
π
|
bai |
because scheduler->timeslice(); |
05:46
π
|
bai |
oops |
05:46
π
|
bai |
because scheduler->timeslice() is where all the sleep() magic happens for timing |
05:47
π
|
bai |
and on the emscripten platform it's just doing the naive while (Date.now() < t) {} style sleep implementation |
05:47
π
|
icculus |
So this is just burning the entire ~16 milliseconds, returning so the framebuffer can swap, and then starting again, 60 times a second |
05:47
π
|
bai |
yup |
05:48
π
|
icculus |
This should be solvable, then. |
05:48
π
|
bai |
now, I've got an experimental branch which tries to handle it a bit more intelligently - if the system is asked to sleep() for longer than the amount of time left in this frame, it basically stops processing until the next emcripten main loop call |
05:49
π
|
bai |
this ends up looking like this https://i.imgur.com/YEEbT9b.png - much cleaner |
05:49
π
|
bai |
but it introduces some timing issues |
05:50
π
|
icculus |
How long are these sleeps intended to be, generally? |
05:50
π
|
bai |
because I did it in a pretty hacky way while trying to work through some theories, and my feeble brain turns to mush when I try to consider the delicate timing balance of a system like this |
05:50
π
|
icculus |
are theyβ¦five milliseconds or like 50 milliseconds? |
05:51
π
|
bai |
let me refresh myself on the code. I think the mame functions themselves are in something insane like picoseconds |
05:56
π
|
DFJustin |
attoseconds |
05:59
π
|
bai |
that's right |
06:00
π
|
bai |
sorry dealing with space issues on my vm. I guess a stock ubuntu install chews right through 12 now |
06:00
π
|
bai |
12 gigs* |
06:02
π
|
icculus |
no worries |
06:03
π
|
icculus |
the more direct question: where do I build this from? Is it on mamedev/mame, or is this a separate fork elsewhere? |
06:03
π
|
bai |
it's all part of the official release now, except for my hacks |
06:04
π
|
icculus |
ok, Iβm going to poke at it in the morning, then, and hopefully Iβll make some progress. |
06:04
π
|
bai |
sweet |
06:04
π
|
bai |
I'll dig up my own patches by then to give you a starting point of where in the codebase you'll want to poke things |
06:05
π
|
icculus |
for now, though, Iβm going to sleep. Iβll idle in this channel though, in case anyone wants me to hear any details. |
06:05
π
|
icculus |
ok, thatβs great, thank you! |
06:05
π
|
bai |
sounds good, looking forward to seeing what we can come up with |
06:05
π
|
bai |
been a long-standing issue |
06:45
π
|
Vito` |
Haha |
06:45
π
|
Vito` |
I think my internet is a closed loop now |
06:46
π
|
Vito` |
I need new circles, everyone I know ends up in here |
06:54
π
|
bai |
all roads lead to #jsmess |
07:24
π
|
SketchCow |
I never stop |
07:24
π
|
SketchCow |
You said we needed people, I got people |
07:26
π
|
SketchCow |
icculus: Bai is the main person who was trying this but he got super busy because his company needs him |
07:27
π
|
SketchCow |
icculus: DFJustin has worked in MAME a long time, he can help. A pile of other people are here and can help as well: azakai is the maintainer of Emscripten, db48x has done a bunch of work with all this, and Vito` and devesine also have done massive work in the past. |
12:46
π
|
|
icculus has quit IRC (icculus) |
13:30
π
|
|
icculus has joined #jsmess |
15:15
π
|
icculus |
omg, this thing takes forever to build. Emulate less hardware next time! lol |
15:56
π
|
|
icculus has quit IRC (icculus) |
15:57
π
|
|
icculus has joined #jsmess |
15:57
π
|
|
icculus has quit IRC (Client Quit) |
15:57
π
|
|
icculus has joined #jsmess |
15:58
π
|
|
icculus has quit IRC (Client Quit) |
16:58
π
|
SketchCow |
How's it going for you? |
17:05
π
|
db48x |
:) |
17:07
π
|
SketchCow |
On my side, I've been ripping CD-ROMs all morning. |
17:07
π
|
SketchCow |
Someone sent me 500 |
17:08
π
|
db48x |
nice |
17:32
π
|
SketchCow |
Yeah, it's going to kick ass to get these up |
17:33
π
|
SketchCow |
Then it's time to sort them, and maybe consider breaking some out into emulated chunks. |
17:49
π
|
|
icculus has joined #jsmess |
18:47
π
|
|
icculus_ has joined #jsmess |
18:49
π
|
SketchCow |
By the way, the latest podcast episode is about Emulation |
18:49
π
|
SketchCow |
(and a demo I like that's an emulator) |
18:50
π
|
|
icculus has quit IRC (Read error: Operation timed out) |
18:50
π
|
|
icculus_ is now known as icculus |
18:51
π
|
|
icculus has quit IRC (Client Quit) |
19:31
π
|
|
icculus has joined #jsmess |
19:31
π
|
icculus |
Uh, is it normal to not be able to link this in 16 gigabytes of RAM? https://gist.github.com/rcgordon/d57e1e3fb504cb698edb091543bda27b |
19:31
π
|
icculus |
This was just a git clone, then CC=emcc make |
19:31
π
|
icculus |
which might totally be the wrong way to do this |
19:33
π
|
bai |
icculus: oh, yeah you generally don't want to do a full build of all systems |
19:34
π
|
bai |
we normally do a build per system |
19:34
π
|
icculus |
oh |
19:38
π
|
bai |
I think what you want is something like "emmake make SOURCES=src/mame/drivers/pacman.cpp" |
19:40
π
|
icculus |
yeah, that builds much quicker. :) |
19:49
π
|
bai |
finding the right source file for the system you're targeting is a bit of black magic, mame has a -listsource file but it's....well....it's just dumb and wrong half the time :D |
19:49
π
|
bai |
eg, "mame -listsource pacman" tells you the source is "pacman.c" when really it's "src/mame/drivers/pacman.cpp" |
19:50
π
|
bai |
(plus you need a native build to do it, too) |
19:55
π
|
db48x |
yea, I really want better automation there |
20:07
π
|
|
icculus has quit IRC (icculus) |
20:08
π
|
SketchCow |
Oops, h's gone |
20:08
π
|
SketchCow |
we killed him |
20:08
π
|
SketchCow |
this seems promising |
20:31
π
|
|
azakai has quit IRC (Quit: Ex-Chat) |
21:57
π
|
DFJustin |
-listsource should always be correct although it doesn't specify src/mame/drivers/ |
21:57
π
|
DFJustin |
if there's a mismatch, the mame in your path may be out of date |
22:07
π
|
|
azakai has joined #jsmess |
23:07
π
|
|
icculus has joined #jsmess |
23:11
π
|
bai |
hmm, I suppose that's not impossible, I might have a system-installed binary version |
23:12
π
|
bai |
wonder when they switched from .c to .cpp |
23:13
π
|
* |
db48x recommends running "type mame" |
23:15
π
|
bai |
yeah, it's definitely a system install, just not sure how old we're talking :D |
23:22
π
|
|
icculus has quit IRC (icculus) |