Locked



Joined: 10/3/2005
Posts: 1332
Much gratitude to nitsujrehtona, mz, and everyone else writing code for this project. :) I have a suggestion for the next release that I think would be useful: a hotkey that reloads the currently running Lua script. Hacking that in was the first thing I did after downloading .26. Having to mouse through the menus every time I tweak something in the script is a pain in the butt.
Joined: 3/17/2007
Posts: 97
Location: Berkeley, CA
Workaround for Shiny: Symlink $HOME/.fceultra/movie/basename.1.fcm (basename being your ROM file's name without the suffix) to the movie file. I'm not sure when I'll be playing with FCEUX... Eventually I'm sure it'll make this easier.
IRC nick: UncombedCoconut
Joined: 11/26/2005
Posts: 285
ShinyDoofy wrote:
the Documentation folder
Speaking of which, I couldn't find any documents on what you can control with Lua and what commands there are to do it (such as frame advance, cheats et cetera). Are there any?
mz
Emulator Coder, Player (79)
Joined: 10/26/2007
Posts: 693
@Swedishmartin: There's only the Snes9x Lua API documentation for now. I think you can use every function listed there, except for those which say "v0.06+ only". Also, you have to replace every "snes9x.*" with "FCEU.*".
You're just fucking stupid, everyone hates you, sorry to tell you the truth. no one likes you, you're someone pretentious and TASes only to be on speed game, but don't have any hope, you won't get there.
Joined: 11/26/2005
Posts: 285
mz wrote:
@Swedishmartin
Thank you :) Also, since I'm ungrateful and demanding, could someone change the Memory Watch, please? There's a 12 symbol limit in the address name field, and it's a bit harsh, since you really have to get creative with naming sometimes. Also, some sort of way to run multiple scripts at once would be rad.
Former player
Joined: 12/5/2007
Posts: 716
nitsujrehtona wrote:
$HOME/.fceultra/movie/basename.1.fcm (basename being your ROM file's name without the suffix) to the movie file.
Works, great! :) Is there a specific reason why there's no sound when watching a run?
Joined: 5/24/2004
Posts: 262
Hi devs, Thanks for all the improvements you guys have been making. I'd like to restate one of the bugs in the first post and also confirm it: *When I select a Fullscreen custom video mode, like 1024x768 4x,3y. And switch to fullscreen mode, FCEU is crashing if a game is loaded or the "DirectDraw: Error creating secondary surface" error message if no game loaded. This has been happening in every version dating back to the official versions. It's definitely at least marginally related to hardware config; I never saw this error on my old machine. I'm running an nVidia GeForce 7900GT on Win XP Pro SP2&3, and have whatever the latest DX9 is: 9c I think. If any of you get a chance, try looking through whatever section of the code that would be in. Thanks much.
Joined: 4/2/2008
Posts: 70
I modified that example script for smb a bit and tried to use it. It seems to play just fine but recording a movie with it makes it desync very, very quickly. I managed to get it to get halfway through 1-3, but when I tried to play the movie back it dies on the first goomba. Any ideas?
Player (121)
Joined: 2/11/2007
Posts: 1522
Will you post your script? I recorded the 1st level with the unmodified script a while ago and it was fine. I'm also curious to see what you wrote :)
I make a comic with no image files and you should read it. While there is a lower class, I am in it, and while there is a criminal element I am of it, and while there is a soul in prison, I am not free. -Eugene Debs
Joined: 4/2/2008
Posts: 70
Beware, there's plenty of things in here I'm sure could be done more elegantly, but I was mostly experimenting.
local buttons = { B = 1, right = 1 }
local safer = savestate.create(5)
local risky = savestate.create(6)
local temp = savestate.create()
savestate.save(safer)
savestate.save(risky)

local frames_alive = 0
local frames_stopped = 0
local lastbutton = 0
local endinglevel = false

--start movie recording to random filename, set speed to maximum
FCEU.speedmode("turbo")
while true do
    joypad.set(1, buttons)
    local mariostate =  memory.readbyte(0x000E)
    local abyssstate =  memory.readbyte(0x07B1)
	local marioxspeed = memory.readbyte(0x57)
	local marioyspeed = memory.readbyte(0x9F)
	local changetimer = memory.readbyte(0x06DE)
	local altcontrol  = memory.readbyte(0x0752)
	local screenflag  = memory.readbyte(0x0774)
	local screentimer = memory.readbyte(0x07A0)
	local demotimer =   memory.readbyte(0x07A2)
	local flagsound =   memory.readbyte(0x0713)
	gui.text(0, 0, "alive: " .. frames_alive .." stopped: " .. frames_stopped);
    gui.text(0, 8, "xs: " .. marioxspeed .. " st: " .. screentimer .. " ct: " .. changetimer .. " ac: " .. altcontrol .. " sf: " .. screenflag);
	
	if flagsound > 0 then
		endinglevel = true
	end
	
	if screentimer > 0 then
		endinglevel = false
	end 
	
    --if mario dies, reload.
    if mariostate == 0x06 or mariostate == 0x0B or abyssstate == 1 or frames_stopped > 40 then
        if math.random(0, 10) == 1 then
            savestate.load(safer)
            frames_alive = 0
        else
            savestate.load(risky)
            frames_alive = 60
        end
		frames_stopped = 0
        --compare input to previous inputs, dump results into a buttons table
    end

    frames_alive = frames_alive + 1
    if frames_alive == 60 then
        savestate.save(risky)
    elseif frames_alive == 180 then
        savestate.save(temp)
        savestate.load(risky)
        savestate.save(safer)
        savestate.load(temp)
        frames_alive = 0
    end

	if marioxspeed < 8 and screentimer == 0 and changetimer == 0 and altcontrol == 0 and screenflag == 0 and not endinglevel then
		frames_stopped = frames_stopped + 1
	else 
		frames_stopped = 0
	end
	
	--TODO: pseudo-randomize input, weighted according to previous attempts, try to jump if we're against a wall
    --but for now, just jump up and down like an idiot
    resetbuttons = math.random(0,20)
	
	if frames_stopped > 0 then
		if lastbutton > 4 and marioyspeed == 0 then
			lastbutton = 0
			buttons.A = nil
		else
			lastbutton = lastbutton + 1
			buttons.A = 1
		end
	elseif resetbuttons == 1 and marioxspeed > 4 then
        buttons.A = math.random(0,2)
        if buttons.A == 0 then buttons.A = nil end
    end

	if demotimer > 0 and math.random(0,1) == 1 then
		buttons.start = 1
		buttons.right = nil
		buttons.B = nil
		buttons.A = nil
	else
		buttons.start = nil
		buttons.right = 1
		buttons.B = 1
	end
	
    --incrementally save every N frames
    --detect instant death
    --detect end of level, drop out of warp
    FCEU.frameadvance()
end
Joined: 3/17/2007
Posts: 97
Location: Berkeley, CA
I'll look into the misbehaviors reported on this page, especially that last one. A bugfix release is already in the works because of other mistakes I made. (I won't fix all the new issues though; sorry in advance.) Shiny: FCEU "remembers" past command-line arguments; is the problem fixed simply by passing "-sound 1"? Anyway, you'll find movies easier to play once I merge (parts of) Bisqwit's patch. UraniumAnchor, thanks for playing with Mario. I'm also working on the SMB scripts, but my new stuff is broken with .27 (because it reads some pointers out of ROM). It can detect and draw (but not react to) tile data:
IRC nick: UncombedCoconut
Former player
Joined: 12/5/2007
Posts: 716
nitsujrehtona wrote:
Shiny: FCEU "remembers" past command-line arguments; is the problem fixed simply by passing "-sound 1"?
It is indeed. Another thing about the sound: Currently FCEU uses OSS (I think), so I only get sound when starting it with "aoss ./fceu [...]". Sound works this way, but it's kind of delayed ("Buffer size: 16384 sample frames(341.333333 ms)"). Is there a way of implementing ALSA support so sound doesn't "lag" anymore?
nitsujrehtona wrote:
Anyway, you'll find movies easier to play once I merge (parts of) Bisqwit's patch.
Looking forward to it :)
Player (121)
Joined: 2/11/2007
Posts: 1522
UraniumAnchor wrote:
I modified that example script for smb a bit and tried to use it. It seems to play just fine but recording a movie with it makes it desync very, very quickly. I managed to get it to get halfway through 1-3, but when I tried to play the movie back it dies on the first goomba. Any ideas?
It desyncs for me too, though not always right away :( I tried messing around to see what might be causing it. My best guess would be that loading/saving states a bunch eventually corrupts them. The original simpler version of the script records fine for me. I tweaked the script a bit and got it to go all the way to the end of 1-4... but something when you meet Toad makes the script think you died :) Here it is if you're curious... still can't make a movie of it though.
I make a comic with no image files and you should read it. While there is a lower class, I am in it, and while there is a criminal element I am of it, and while there is a soul in prison, I am not free. -Eugene Debs
Joined: 4/2/2008
Posts: 70
Yeah, when Mario stops it thinks he got stuck and rewinds. I'll have to find the flag that indicates "hey we're doing the toad sequence". My version managed to make it to 1-4 overnight and when I woke up it was stuck on that exact spot, hah. Edit: Also, that link is geborken.
Player (121)
Joined: 2/11/2007
Posts: 1522
Oops, fixed it :) Look forward to the Toad fix, and then can you think of a clever solution for 2-2? After that, the castles where you have to go through a specific route or it repeats will probably be tricky too. I guess I'm getting a bit off topic here...
I make a comic with no image files and you should read it. While there is a lower class, I am in it, and while there is a criminal element I am of it, and while there is a soul in prison, I am not free. -Eugene Debs
Joined: 3/17/2007
Posts: 97
Location: Berkeley, CA
Agreed; let's take the bots here.
IRC nick: UncombedCoconut
Former player
Joined: 12/5/2007
Posts: 716
I've got another request: configuring my joypad via -inputcfg works great so far (why do I have to push the buttons thrice?), but how is this data saved? Under Linux, the pads (I have two different ones) are "spoken to" via /dev/input/jsN, N usually being 0 for my NES pad and 1 for my N64 pad. But I don't always plug them in in the same order, so from time to time they eventually get each other's Ns and thus swapped. Maybe the data sampled by -inputcfg could be saved by the vendor id (VID) and product id (PID), in case it's a USB joypad?
Skilled player (1827)
Joined: 4/20/2005
Posts: 2161
Location: Norrköping, Sweden
I found a way to crash FCEU 0.98.26: 1. Open FCEU. 2. Open Memory watch. 3. Load a .txt-file with RAM addresses. This makes FCEU crash (at least on my computer). I guess the core of the bug is that no ROM has been loaded when the .txt file is loaded.
Joined: 4/2/2008
Posts: 70
You know I was just about to post that. If you don't have a ROM loaded and you try to enter in an address to memory watch, it crashes.
Joined: 3/17/2007
Posts: 97
Location: Berkeley, CA
FCEU-rerecording 0.98 & source CHANGES bug: movies of script-generated input desync'd bug: dead scripts' graphics overlays persisted bug: argument order for memory.writebyte didn't match API docs bug: Lua's memory functions couldn't read from ROM bug: bot.html was missing from the binary release bug: diagnostics were suppressed when loading a script failed bug: memwatch crashed when given addresses before any ROM was loaded enh: memwatch allows longer labels. (If you save a text file with long labels, don't open it in an earlier version.) enh: HUD font altered by Zeromus so digits are fixed-width. (No old font though--sorry.) enh: hotkey to reload a Lua script (defaults to Shift+L) enh: dumps have their own folder enh: Linux version recognizes the command-line options -playmovie <file>, -loadstate <file>, -readonly <0>, -stopframe <#>, -muteframeadvance <0>. If you need a larger address limit in FCEU .98, I can help you, but I'm not doing it for this version...
IRC nick: UncombedCoconut
Former player
Joined: 12/5/2007
Posts: 716
It's great to see the new features work, but why aren't they printed out when just typing ./fceu? Does -muteframeadvance mute the sound when playing with frame advance instead of giving you chunks of classic 8bit music?
Joined: 3/17/2007
Posts: 97
Location: Berkeley, CA
Please re-download and pretend I never made that mistake. =)
IRC nick: UncombedCoconut
Former player
Joined: 12/5/2007
Posts: 716
Did so, pretending so. Thanks :) Yet another question/request: I found that left Ctrl activates(?) frame advance and has to be pushed over and over again after movie playback finished (unless you provide -stopframe -1) to see the ending (like "bla bla your mission is over, go play outside, you nerd!"). Is there a way of deactivating frame advance? I couldn't find anything in the documentation so far :o Another small thing about the documentation: the latest addest features aren't written down there. Don't wanna annoy you, just wanna make sure somebody else might have a better start using this emulator than I did ;)
Joined: 3/17/2007
Posts: 97
Location: Berkeley, CA
If you worry about annoying me, Shiny, you needn't. I hope you'll also be reporting issues with FCEUX/Linux; it'll need testers. If you worry about annoying anyone else, feel free to PM me or submit bug reports to the sourceforge tracker. Anyway, the usual way to get out of frame-advance is to hit the pause button (probably the backslash key for you). Eventually I will want to make those keys configurable and make the frame-advance key autorepeat! Outdated docs are actually a big deal. Adelikat is working really hard on that issue for FCEUX/Win32; once he's done, it should be straightforward to get the Linux port documented properly.
IRC nick: UncombedCoconut
Editor, Emulator Coder, Expert player (2156)
Joined: 5/22/2007
Posts: 1134
Location: Glitchvania
FCEU 0.98.28 still crashes if you watch any memory values before any ROM is opened....
<klmz> it reminds me of that people used to keep quoting adelikat's IRC statements in the old good days <adelikat> no doubt <adelikat> klmz, they still do

Locked