GenDev SpritesMind Website SpritesMind.Net
Sega Megadrive/Genesis development
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Wolf32X - finally in beta!
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    SpritesMind.Net Forum Index -> Demos
View previous topic :: View next topic  
Author Message
Snake
Very interested


Joined: 13 Sep 2008
Posts: 200

PostPosted: Thu Feb 19, 2009 10:20 pm    Post subject: Reply with quote

Chilly Willy wrote:
What's REALLY weird is that the six button code doesn't work on Kega Fusion - I'd REALLY like to know why that fails.

Gens doesn't do this in a hardware accurate way, just in a way that works with games. Looking at the source you posted in another thread I can tell you how to make this work reliably on real hardware.

You shouldn't need, and don't really want, a seperate 3 button/6 button selection, the code should be detecting the pad and using whatever is there. How its supposed to be done is something like this:

Code:

00->a10003, read START, A.
40->a10003, read C,B,R,L,D,U

loop for something like 8 counts:
{
   00->a10003, read, if val&0x0f==0, goto PAD6
   40->a10003
}

PAD3:
set M,X,Y,Z as not pressed.
this is a 3 button pad, done.

PAD6:
40->a10003, read M,X,Y,Z
00->a10003, read to temp
40->a10003.

if temp&0x0f!=0x0f, goto PAD3.
this is a 6 button pad, done.


I.E. you should wait for the extra data to be there, and check afterwards (incase of a broken pad).

I also noticed your code was doing a final move.b #0x40,(a0) in your get_input routine, this might interfere with the timing in the pad. You really want to toggle TH off and on and avoid doing extra writes. Ideally there should be around 16 cycles between TH writes, to make sure everything works fine with third party controllers and the 'arcade stick'.

Eke wrote:
Also, in Gens, the TH cycle counter is reseted at the start of each line AND when a bus request is issued...

Yeah, Stef probably did that because it just worked better in Gens. Of course, a real 6 button pad is not going to know when you issue a bus request.
Back to top
View user's profile Send private message
Chilly Willy
Very interested


Joined: 17 Aug 2007
Posts: 1955

PostPosted: Thu Feb 19, 2009 10:44 pm    Post subject: Reply with quote

That is just weird... according to the SEGA info, a read cycle is supposed to be:

1 - make sure TH is high (0x40)
2 - read the data
3 - set TH low
4 - read the data
5 - make sure TH is high

When reading a six button controller, you can move #5 to the end of the last read cycle. Six button controllers require four read cycles and return the data as my comment show. That is what SEGA says, and is what I verified on my Amiga years back when I added SEGA 6 button pad support to ADoomPPC.

I'll do some experimenting... I'm sure your explanation is more correct than SEGA's example code. Laughing
Back to top
View user's profile Send private message
Snake
Very interested


Joined: 13 Sep 2008
Posts: 200

PostPosted: Fri Feb 20, 2009 12:27 am    Post subject: Reply with quote

Hmm, well I don't think it matters if you set TH HIGH or LOW first, it just makes more sense to me to do it this way for many reasons. There's no reason at all why you'd need to set it high at the start AND end of the code either.

I'm pretty sure the pad will return standard 3-button data for longer than your code suggests, which is the main reason it doesn't work. (I did test against real hardware, but it's been a good few years...) It does this because a lot of pre-6button pad games try to read the pads faster than they should, and this method allows them to work without problems.

Safest method is to check for the data (which is why it returns 0000, usually an 'impossible' value, right before the data) because there is no guarantees, anywhere, than every pad that implements this stuff is going to return the extra data after the same number of TH toggles (or, indeed, that the same pad will do so every single time.)
Back to top
View user's profile Send private message
HardWareMan
Very interested


Joined: 15 Dec 2007
Posts: 542
Location: Kazakhstan, Pavlodar

PostPosted: Fri Feb 20, 2009 2:46 am    Post subject: Reply with quote

Snake wrote:
Safest method is to check for the data (which is why it returns 0000, usually an 'impossible' value, right before the data) because there is no guarantees, anywhere, than every pad that implements this stuff is going to return the extra data after the same number of TH toggles (or, indeed, that the same pad will do so every single time.)

I think it is becouse slow hardware, such joypad. So SEGA recommend do some delay after changing TH line (usually 2 NOP's). And one more thing: 3-button joypad you can read anytime. Becouse it is simple hardware. But 6-button joypad, after entering to read extra buttons, need some time to restore it's state. And every joypad has its own recovery time. There no sure control method to restore joypad state. But, VInt time even at 60Hz will be enought.
Back to top
View user's profile Send private message
Chilly Willy
Very interested


Joined: 17 Aug 2007
Posts: 1955

PostPosted: Fri Feb 20, 2009 5:05 am    Post subject: Reply with quote

And once again, Snake is The Man! Unless he's not. Laughing

Followed his advice and it works fine on everything. Gens, Kega, real hardware... no problemo. So that's one bug squashed for the next release. Thanks Snake!
Back to top
View user's profile Send private message
HardWareMan
Very interested


Joined: 15 Dec 2007
Posts: 542
Location: Kazakhstan, Pavlodar

PostPosted: Fri Feb 20, 2009 5:53 am    Post subject: Reply with quote

And one more thing: SEGA's 6-button joypads are PnP. They return non-pressed direction state when TH=0 (when you read "A" and "Start" buttons). So, if joypad return different direction state when TH=1 fyl TH=0 - it is NOT 3-button joypad. Then you just check out which data it's return. I believe mouse and other attachment use same technique.
Back to top
View user's profile Send private message
haroldoop
Interested


Joined: 29 Apr 2007
Posts: 34
Location: Belo Horizonte, MG, Brazil

PostPosted: Sat Feb 21, 2009 10:58 pm    Post subject: Reply with quote

Really impressive conversion, it actually plays better than Doom 32X.
About the music, aren't most of the registers of the YM2612 (MD) similar to its close cousin, the YM3812 (Adlib)? Maybe simply sending the original register writes to the chip would be enough to get something almost not completely unlike the original music. Razz
Back to top
View user's profile Send private message MSN Messenger
Chilly Willy
Very interested


Joined: 17 Aug 2007
Posts: 1955

PostPosted: Sun Feb 22, 2009 1:57 am    Post subject: Reply with quote

haroldoop wrote:
Really impressive conversion, it actually plays better than Doom 32X.


I'm seriously thinking of trying to make an updated Doom 32X. While I couldn't fit the entire game into a cart, I was thinking I'd make a cart for each level (or two or three... not sure how many would fit) and rely on the save game to allow people to continue with the next cart. Rather than pair down the game to have most of it fit in one cart, I'd rather have the levels be as complete as possible and use multiple carts. With emulators and flash carts, that's not an issue.

Quote:
About the music, aren't most of the registers of the YM2612 (MD) similar to its close cousin, the YM3812 (Adlib)? Maybe simply sending the original register writes to the chip would be enough to get something almost not completely unlike the original music. Razz


I've thought of that too. Using the four operator mode of channel three, you can simulate eight channels of the 3812 fairly accurately. The main thing missing is the ability to select the type of waveform used. I'm not sure how much that's used by the W3D music. Then there's the rhythm mode where I'd have to do the percussion instruments somehow.

Another idea I've had is to convert the music on the fly into something like MIDI and play that. There is dro2midi, which converts AdLib music into MIDI. I need to extract the music from the files and see how it works and what the music is like. But it's something to consider.
Back to top
View user's profile Send private message
Shiru
Very interested


Joined: 07 Apr 2007
Posts: 786
Location: Russia, Moscow

PostPosted: Sun Feb 22, 2009 5:05 am    Post subject: Reply with quote

Chilly Willy wrote:
Another idea I've had is to convert the music on the fly into something like MIDI and play that.

Why not just use the MIDIs which I posted then? Or you want to use only original game data?
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Chilly Willy
Very interested


Joined: 17 Aug 2007
Posts: 1955

PostPosted: Sun Feb 22, 2009 6:40 am    Post subject: Reply with quote

The midis you posted aren't ALL the music, just SOME of the music. Granted, they'd be best since they were done by the guy who wrote the music originally, but what about the other tunes not included?
Back to top
View user's profile Send private message
Shiru
Very interested


Joined: 07 Apr 2007
Posts: 786
Location: Russia, Moscow

PostPosted: Sun Feb 22, 2009 7:47 am    Post subject: Reply with quote

There is some more, all tracks have Prince's copyright too. I don't know how many tracks in game, actually, so if you post complete list, we can try to find all the music. If there no original MIDI's, there is still alternatives - fans covers, or conversion (not on the fly) of the missing tracks.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Chilly Willy
Very interested


Joined: 17 Aug 2007
Posts: 1955

PostPosted: Sun Feb 22, 2009 9:37 am    Post subject: Reply with quote

W3D shareware has:
CORNER.IMF, GETTHEM.IMF, NAZI_NOR.IMF, POW.IMF, SEARCHN.IMF, SUSPENSE.IMF, WONDERIN.IMF, ENDLEVEL.IMF, ROSTER.IMF, and URAHERO.IMF.

The full version has a total of 27 tracks, but I'm not really concerned about it. Barring differences in names, we're still missing some. Also, we're missing a bunch from Spear of Destiny, which uses an almost completely difference score.

I like that midi archive from the link. Pretty nice. Very Happy
Back to top
View user's profile Send private message
Chilly Willy
Very interested


Joined: 17 Aug 2007
Posts: 1955

PostPosted: Mon Mar 09, 2009 9:59 am    Post subject: Reply with quote

Okay, here's beta 3. This is a pretty major update, adding FM sound effects and Load/Save game ability. You only get one save. The Load/Save menu still shows ten, but they all just do the same thing. There's only room in the SRAM for one save game. Since there's no keyboard and I don't want to make the effort to add an on-screen keyboard, the save tag is set to the map name automatically. That way you can at least tell what level you saved on. START + X is now Quick Load, and START + Y is Quick Save. For three button controllers, just use the menu to load/save.

The FM sound effects are synthesized before compiling using the MAME YM3812 OPL emulation. That is the way FM sound effects are played in most ports of Wolf3D, they just do it on the fly. There is a bug in the OPL emulation. Have you seen reports on the PSP version of Wolf3D that certain FM sound effects are missing? They're not missing, just very VERY quiet due to a bug in the OPL emulation. I scale certain sounds while they're being generated so that they are audible in Wolf32X. The volume is probably wrong, but I think they sound like they should. I'll be looking into this more.

Next up, music! Very Happy
Back to top
View user's profile Send private message
Chilly Willy
Very interested


Joined: 17 Aug 2007
Posts: 1955

PostPosted: Thu Mar 12, 2009 1:51 am    Post subject: Reply with quote

Okay, I lied. Music wasn't next. I added an auto-map instead. Very Happy

Read the readme!!
Back to top
View user's profile Send private message
TmEE co.(TM)
Very interested


Joined: 05 Dec 2006
Posts: 1946
Location: Estonia, Mahtra village

PostPosted: Thu Mar 12, 2009 5:08 am    Post subject: Reply with quote

I have still not got around to testing this out and now I'm going to school in a few hours for 3 days and I cannot test it out D:
_________________
Mida sa loed ? Nagunii aru ei saa Wink
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    SpritesMind.Net Forum Index -> Demos All times are GMT
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You can 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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group