It is currently Tue Oct 23, 2018 3:12 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 581 posts ]  Go to page Previous  1 ... 21, 22, 23, 24, 25, 26, 27 ... 39  Next
Author Message
 Post subject: Re: Mesen - NES Emulator
PostPosted: Fri Apr 20, 2018 8:10 pm 
Offline

Joined: Mon Mar 19, 2018 12:44 pm
Posts: 4
It seems like whenever I make significant changes to my rom, that the cheat window adds a new entry for it with the same name. I haven't tested to see if its making a new entry every single time I make any changes, or if it only makes a new entry if I open the cheat window after a change or what...

I'm also not sure if I'm using it correctly. But no matter what exporting or importing I do, I can't get old cheats to show up on a "new" game's entry. I have to manually add them in all over again. So my best guess is its doing the same thing save states were doing, where when loading cheats from a file, it makes a new game entry if the old game entry doesn't match? Perhaps the check for that could be merged with the save state check, if that's not too much trouble.

Anyway its not that big a deal at the moment, just a weird quirk I noticed!


Top
 Profile  
 
 Post subject: Re: Mesen - NES Emulator
PostPosted: Sun Apr 22, 2018 5:10 am 
Offline

Joined: Sun Apr 22, 2018 4:37 am
Posts: 3
Hi!
I want to discuss scripting in emulators (in Mesen, at first, I think it's Lua system is best now).

I know, why authors of emulators choose Lua, it's minimalistic and lightweight, but, in fact, Lua is a language for non-programmers. Game developers use it for very limited scripting inside gaming, but the real power of scripting need more powerful languages like Python (for example, script system in IDA or Maya). But there is heavy language, embedding of python can cost size, so no emulator supports it now.

Other problem with Lua - there is hard to find extension modules and many of them created in c, so script author must compile it, with the right version of Lua developer headers, with 5.1 vs 5.3 difference, C compiler formats, 32 bit vs 64 bit hell - Mesen and Fceux, for example, use different Lua versions. This is definitely not what the author of the script wants to do.

Another way to solve a problem - we can communicate with Python via Lua. I made proof-of-concept example of python server communicate to Fceux (it already has statically linked LuaSocket package with low-level socket wrappers for Lua). I must create simple RPC-system over json - it's only protocol, that I could find a small working implementation on pure Lua. It really VERY simple and not good for real projects.

Now I implemented almost all functions from fceua Lua API except small not significant ones, so I have interactive python server for control fceux via sockets. Callbacks from Lua to python implemented, pause/unpause emulator from python implemented - it use bad documented ability of fceux to update lua sockets when emulator paused via gui.register callback. I'll post demo video after a day or two.

So I think, if Sour will agree to include even just LuaSocket module, I can port Lua-python bridge for Mesen.

Even better, if someone could find some working protocol for serialization for lua - protobuf is good one and some realizations implemented as static compilers from shared .proto files to pure Lua files, so no additional binaries needed to package with emulator, but I not found any solutions, working without any fixes.

P.s. sorry for possible mistakes, my English is poor.


Top
 Profile  
 
 Post subject: Re: Mesen - NES Emulator
PostPosted: Sun Apr 22, 2018 3:25 pm 
Offline

Joined: Sun Apr 22, 2018 4:37 am
Posts: 3
Something like this.
https://www.youtube.com/watch?v=c3D5gljbkO0


Top
 Profile  
 
 Post subject: Re: Mesen - NES Emulator
PostPosted: Mon Apr 23, 2018 7:20 am 
Offline
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 817
Location: New York, NY
spiiin wrote:
Other problem with Lua - there is hard to find extension modules and many of them created in c, so script author must compile it, with the right version of Lua developer headers, with 5.1 vs 5.3 difference, C compiler formats, 32 bit vs 64 bit hell - Mesen and Fceux, for example, use different Lua versions. This is definitely not what the author of the script wants to do.


You might want to check out Nintaco. It provides programmatic control using C, C#, Java, Lua and Python.


Top
 Profile  
 
 Post subject: Re: Mesen - NES Emulator
PostPosted: Mon Apr 23, 2018 3:05 pm 
Offline

Joined: Sun Feb 07, 2016 6:16 pm
Posts: 525
I wasn't even aware that Lua did not support sockets by default, to be perfectly honest. I can look into adding that.

As for Python, you pretty much guessed right - it's just way too big to embed directly into an emulator. I compared a few potential candidates (Lua, JS, Python) before settling on Lua due to its size/simplicity in terms of integration. Python was something like 30x bigger than Lua, if I recall correctly.

But realistically, except for very complex scripts built for a very specific purpose, I imagine Lua is good enough for the majority of use cases. Still, if you do make a Python bridge, I'm more than happy to add it to the built-in scripts I've started adding to the script window, since it could definitely be useful for other people too.

Jiggers wrote:
It seems like whenever I make significant changes to my rom, that the cheat window adds a new entry for it with the same name.
Cheats are stored based on the game's CRC32 (iirc, it only checks the CRC32 for the PRG ROM, so modifications to CHR ROM won't cause any issues). It's done this way mostly because typically if the PRG ROM doesn't match, cheats won't work (if you ignore homebrew dev or rom hacking). I could probably add an option to "match by rom name" if no CRC match is found (or like you said, use the save state option to toggle this behavior)


Top
 Profile  
 
 Post subject: Re: Mesen - NES Emulator
PostPosted: Tue Apr 24, 2018 7:23 am 
Offline

Joined: Sun Apr 22, 2018 4:37 am
Posts: 3
zeroone wrote:
You might want to check out Nintaco. It provides programmatic control using C, C#, Java, Lua and Python.


Thanks, I'll check it and answer to thread about your emulator. I didn't know about it before.

Sour wrote:
Still, if you do make a Python bridge, I'm more than happy to add it to the built-in scripts I've started adding to the script window, since it could definitely be useful for other people too.


Currently, my text rpc-json protocol is only for tests, it's not fast or robust, it's not very useful. But I'll post sources, at least for example for others, it's better than nothing.

Alsoe, if you want some examples to bundle with the emulator, feel free to use and modification my scripts even without mention to me:
https://github.com/spiiin/CadEditor/blo ... rallax.lua
Show lines when game doing horizontal scrolling changes
https://github.com/spiiin/CadEditor/blo ... Screen.lua
Simple "shaders" post-effects for any game, maybe I'll add some other shaders later - it's a good start for make other shaders, but need some fixes to gui press keys notifications.
gif - https://spiiin.dreamwidth.org/file/17583.gif
and video (bad quality :( ) - https://www.youtube.com/watch?v=04KOJmRYwko


Top
 Profile  
 
 Post subject: Re: Mesen - NES Emulator
PostPosted: Tue May 08, 2018 9:55 am 
Offline

Joined: Mon May 30, 2011 9:01 pm
Posts: 204
Sour, please can you add the "frameRange" condition type to the documentation? Also can you clarify which integer values in the conditions need to be in hex format? And what does "disableContours" option do? The description appears to be incomplete. Thank you.


Top
 Profile  
 
 Post subject: Re: Mesen - NES Emulator
PostPosted: Thu May 17, 2018 9:37 am 
Offline
User avatar

Joined: Thu Apr 23, 2009 11:21 pm
Posts: 937
Location: cypress, texas
Hi Sour again,

It would be so helpful to me if you could add a check box on the Trace log file screen that would cause the registers and frame count to appear on the left when the file is generated. That would make them all alligned when using the indent with stack pointer and it would be more convenient to comment.

Thank you for reading my request. :)

edit: if you could just add a line like <SwitchRegistersLeft>false</SwitchRegistersLeft> under the TraceLoggerOptions in your setting.xml file that would be just as helpful for me because I plan to never switch back if you make the change. :)


Top
 Profile  
 
 Post subject: Re: Mesen - NES Emulator
PostPosted: Thu May 17, 2018 3:00 pm 
Offline

Joined: Sun Feb 07, 2016 6:16 pm
Posts: 525
spiiin wrote:
Alsoe, if you want some examples to bundle with the emulator, feel free to use and modification my scripts
Thanks, I've added these to the dropdown. I haven't been able to sit down and take a look at enabling sockets yet, though (did some research a couple of weeks ago but got sidetracked and didn't get back to it yet).

mkwong98 wrote:
can you add the "frameRange" condition type to the documentation? Also can you clarify which integer values in the conditions need to be in hex format? And what does "disableContours" option do? The description appears to be incomplete.
frameRange isn't in there mostly because I couldn't find a suitable way to describe it with words :) It's something kya needed for his HD Pack, and essentially it defines a fraction of frames during which the condition is valid, iirc. So if you put 1 and 3 as the parameters, 1 frame out of every 3 frames, the condition is true.
The fields marked as "integer" as meant to be decimal, and the ones marked as "hex" are supposed to be hex. I messed this up with the memoryCheck* conditions though, which all say "integer" even though it should all be "hex" instead.
disableContours disables a background-color outline around sprites when a HD background is enabled (otherwise sprites that contain transparent pixels that rely on the background being a specific color did not show up properly).
It's a bit of a pain to update the documentation in-between releases without including stuff that's not in 0.9.5, I'll try to get these fixed when the next version is released.

unregistered wrote:
It would be so helpful to me if you could add a check box on the Trace log file screen that would cause the registers and frame count to appear on the left when the file is generated.
Hey, I read your PM, too - I understand you want to customize the trace log's output, but I'd prefer not to add too many options that just change how the information is displayed (rather than what is displayed) since the trace logger is already filled with options to control what's shown. I might be able to add some sort of "templating" that you can use to customize the output to be more or less whatever you want it to be (e.g by writing the format you want to use in a textbox), but I'm unsure how easy this would be considering the trace logger has to output 450+k lines per second to keep the emulation running at 60+fps.


Top
 Profile  
 
 Post subject: Re: Mesen - NES Emulator
PostPosted: Fri May 18, 2018 9:42 pm 
Offline

Joined: Mon May 30, 2011 9:01 pm
Posts: 204
Sour wrote:
frameRange isn't in there mostly because I couldn't find a suitable way to describe it with words :) It's something kya needed for his HD Pack, and essentially it defines a fraction of frames during which the condition is valid, iirc. So if you put 1 and 3 as the parameters, 1 frame out of every 3 frames, the condition is true.

I see something like this in kya's pack:
Code:
<condition>Frame14PlusOf16,frameRange,10,e
<condition>Frame12PlusOf16,frameRange,10,c
<condition>Frame10PlusOf16,frameRange,10,a
<condition>Frame8PlusOf16,frameRange,10,8
<condition>Frame6PlusOf16,frameRange,10,6
<condition>Frame4PlusOf16,frameRange,10,4
<condition>Frame2PlusOf16,frameRange,10,2

It seems "frameRange,x,y" mean:
Code:
result = ((frame % x) >= y);

Is this correct?

Sour wrote:
disableContours disables a background-color outline around sprites when a HD background is enabled (otherwise sprites that contain transparent pixels that rely on the background being a specific color did not show up properly).

Sorry, still can't get me head around this, can you give an example?

The background tag has two optional values, what are the default values? 0.0 or 1.0?

Thanks.


Top
 Profile  
 
 Post subject: Re: Mesen - NES Emulator
PostPosted: Sat May 19, 2018 8:49 am 
Offline
User avatar

Joined: Thu Apr 23, 2009 11:21 pm
Posts: 937
Location: cypress, texas
Sour wrote:
unregistered wrote:
It would be so helpful to me if you could add a check box on the Trace log file screen that would cause the registers and frame count to appear on the left when the file is generated.
Hey, I read your PM, too - I understand you want to customize the trace log's output, but I'd prefer not to add too many options that just change how the information is displayed (rather than what is displayed) since the trace logger is already filled with options to control what's shown. I might be able to add some sort of "templating" that you can use to customize the output to be more or less whatever you want it to be (e.g by writing the format you want to use in a textbox), but I'm unsure how easy this would be considering the trace logger has to output 450+k lines per second to keep the emulation running at 60+fps.
I understand what you are saying. Well, if you do try and add "'templating'", that would be extreemly incredible, just don't worry about your emulator not running at 60fps during the trace log creation because running trace logs at 100% emulation speed isn't helpful, for me at least. Those files become way too big and using them is a huge chore. I usually build trace log files at 1% emulation speed. :)

edit: Hmm... I've never used a condition when making a trace log file; maybe utilizing condition(s) could warrant recording trace log files at 100% emulation speed. That's a really cool feature! :D


Top
 Profile  
 
 Post subject: Re: Mesen - NES Emulator
PostPosted: Mon May 21, 2018 10:23 am 
Offline
User avatar

Joined: Thu Apr 23, 2009 11:21 pm
Posts: 937
Location: cypress, texas
In Mesen's Trace Logger, after selecting "Text" display for the processor Status Flag Format, it appears, to me, that your text is incorrect. It could be nv-bdizc, instead of your nvb-dizc, to make more sense, I think. :) http://wiki.nesdev.com/w/index.php/CPU_status_flag_behavior (see lower B flag section :))

edit.


Top
 Profile  
 
 Post subject: Re: Mesen - NES Emulator
PostPosted: Mon May 21, 2018 4:03 pm 
Offline

Joined: Sun Feb 07, 2016 6:16 pm
Posts: 525
mkwong98 wrote:
Code:
result = ((frame % x) >= y);
Is this correct?
That's how it's implemented in the code, yes.

mkwong98 wrote:
Sorry, still can't get me head around this, can you give an example?
The black outline around the sprites in this screenshot is caused by this:
Image
Otherwise all the black on the sprites would end up showing the background instead - you can tell this solution isn't perfect if you look at the top right sprite's cape, the background's blue shows through it. If disableContours is turned on, the black disappears and the background will be shown for those pixels instead.

mkwong98 wrote:
The background tag has two optional values, what are the default values? 0.0 or 1.0?
0.0 so that the background doesn't scroll - "1.0" would mean the background scrolls at the same speed as the PPU's scrolling registers change.

unregistered wrote:
In Mesen's Trace Logger, after selecting "Text" display for the processor Status Flag Format, it appears, to me, that your text is incorrect. It could be nv-bdizc, instead of your nvb-dizc
It should probably always be "nv--dizc", actually, since the B flag does not exist on the CPU itself. Thanks - I'll fix it along with the other trace logger changes I am slowly working on.


Top
 Profile  
 
 Post subject: Re: Mesen - NES Emulator
PostPosted: Wed May 23, 2018 2:04 pm 
Offline
User avatar

Joined: Thu Apr 23, 2009 11:21 pm
Posts: 937
Location: cypress, texas
Sour wrote:
unregistered wrote:
In Mesen's Trace Logger, after selecting "Text" display for the processor Status Flag Format, it appears, to me, that your text is incorrect. It could be nv-bdizc, instead of your nvb-dizc
It should probably always be "nv--dizc", actually, since the B flag does not exist on the CPU itself. Thanks - I'll fix it along with the other trace logger changes I am slowly working on.
That's a great idea! :D Was unsure about suggesting "nv--dizc" earlier, but now that makes a lot of sense after carefully reading and being blessed with finally understanding this nesdev wiki line:
This is the only time and place where the B flag actually exists: not in the status register itself, but in bit 4 of the copy that is written to the stack.
"... along with the other trace logger changes I am... working on." :mrgreen: :shock: :D


Top
 Profile  
 
 Post subject: Re: Mesen - NES Emulator
PostPosted: Thu May 24, 2018 3:48 pm 
Offline
User avatar

Joined: Thu Apr 23, 2009 11:21 pm
Posts: 937
Location: cypress, texas
Sour, when you have some free time, could you make your blue and black pause logo somewhat transparent? :) (It covers some white text from Lua Script and it would be very nice if I could read that text when Mesen is paused.)

:idea: Maybe think about adding a "Toggle Pause Logo" line under Shortcut Keys instead. Whatever takes the smallest amount of your time. I'm sorry for all of these requests.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 581 posts ]  Go to page Previous  1 ... 21, 22, 23, 24, 25, 26, 27 ... 39  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group