I am a very competent c programmer and I'm comfortable with assembly as well. That being said, this is a fairly complex program to dive into
I have a gamepad hooked up that I use with zsnes. What I'd like to do is modify the source such that if the user presses L+R, or Start+Select, or some such combination, then zsnes exits.
I'm not even sure though where the main executive loop occurs at, or where the input is processed. Can someone point me to where I should be modifying, and perhaps give me some pointers on doing the stuff I'm attempting to implement?
really, thank you guys so much for this incredible program and the prompt&awesome support i've gotten from these forums thus far.
detect certain input combination...
Moderator: ZSNES Mods
-
- Rookie
- Posts: 10
- Joined: Sat Dec 27, 2008 5:31 am
-
- Rookie
- Posts: 10
- Joined: Sat Dec 27, 2008 5:31 am
well I dug through the code until I found Main_Proc, and I added this code to the SDL_JOYBUTTONUP case (after some debugging to determine the specific codes for my buttons):
if (pressed[266] && pressed[267] && pressed[262] && pressed[263]) exit(0);
This works, if I press L+R+Select+Start it exits.
Is this call to exit(0) sufficient to properly close out zsnes, or will I leave a bunch of stuff initialized doing that? I did see a number of atexit calls, so i suspect im safe...
if (pressed[266] && pressed[267] && pressed[262] && pressed[263]) exit(0);
This works, if I press L+R+Select+Start it exits.
Is this call to exit(0) sufficient to properly close out zsnes, or will I leave a bunch of stuff initialized doing that? I did see a number of atexit calls, so i suspect im safe...
-
- ZSNES Developer
- Posts: 3904
- Joined: Tue Jul 27, 2004 10:54 pm
- Location: Solar powered park bench
- Contact:
We do stuff via atexit(), so with v1.5x, calling exit() is fine.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
_____________
Insane Coding
-
- ZSNES Shake Shake Prinny
- Posts: 5632
- Joined: Wed Jul 28, 2004 4:15 pm
- Location: PAL50, dood !
Obviously editing sdllink.c makes your change port-unique. If that's not a problem for you, then that's fine.
However, you might want to choose your exit input wisely, as many games use L+R+Select+Start as a soft reset trigger.
However, you might want to choose your exit input wisely, as many games use L+R+Select+Start as a soft reset trigger.
皆黙って俺について来い!!
Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
Code: Select all
<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)