Hacking the ST rom


#572

Dude, if you or anyone ports cps1 audio into ST a reality, I will donate an arcade cab.


#573

Jed is already making room for your cab.
-ud


#574

Not going to happen, unless some one wants to do a hack job of wiring the Kabuki on to your cps2 board. I’ll be using the q-sound still. Probably going to just reuse ST sound programming and samples. Then maybe, switch to HSF2 at a later for the CPS1 character voice samples. But this is way down the line I still need to fix the graphics, get past the ram checks, rewrite memory locations, fix inputs, fix any bugs, then either settings rewrite or sound.


#575

Dah, I forgot about the Kabuki chip. Isn’t that just a custom Z80? I wonder if anyone’s ever sussed out the differences between it and a vanilla Z80.

I figured there would be a lot of nagging manipulation like that. Once you have a game fairly well ported (as a proof of concept), it would be awesome to get some other people on board working on the whole CPS1 library. Especially with Darksoft’s CPS2 flash cart coming soon (I was shocked to discover how far along he is). That would be amazing to have the CPS1 & CPS2 libraries running on the same hardware. And since it will be easily updatable, people will be contributing bug reports & fixes (similar to what we see in the MAME community). Also all sorts of hacks and homebrew will likely pop up. For those of you not following, here’s the interest thread on neo-geo: http://www.neo-geo.com/forums/showthread.php?254247-CPS2-Multi-Game-Cartridge
-ud


#576

Here’s the differences sound hardware wise.
There is more than just the Z80 that is different. Kabuki custom Z80 with encryption, YM-2151 and OKIM6295 for the sound processing. Cps2 uses Z80 with a q-sound chip. CPS1 dash forgoes the Z80 and uses the main 68k and q-sound for sound as well reading q-sound data and ram for protection.


#577

So any idea how I would go about getting my changes into the sfa3.zip (encrypted) romset?

I figured I could just play the decrypted rom on ggpo via the unsupported room but sfa3ud.zip rom isnt supported by ggpofba.


#578

@wazeem: use XCopy to decrypt & re-encrypt the roms - https://www.mediafire.com/folder/tsu2b5ndrl0ut/ST_hacking


#579

@pof‌ I have tried already but no version seems to work.

Does it have to be a specific version or something?


#580

SFA3 I believe is one of those games that got a redump of atleast the encryption key between ggpofba and current version of mame.

So you have to use the custom option for it.
from cps2crpt.c



	// name                 key               upper                  watchdog
	{ "sfa3",     { 0x6abfc8e0,0x2780ddc1 }, 0x100000 },    // 0C80 1C62 F5A8  cmpi.l  #$1C62F5A8,D0
	{ "sfa3u",    { 0xe7bbf0e5,0x67943248 }, 0x100000 },    // 0C80 1C62 F5A8  cmpi.l  #$1C62F5A8,D0
	{ "sfa3ur1",  { 0xe7bbf0e5,0x67943248 }, 0x100000 },    // 0C80 1C62 F5A8  cmpi.l  #$1C62F5A8,D0
	{ "sfa3h",    { 0x8422df8c,0x7b17a361 }, 0x100000 },    // 0C80 1C62 F5A8  cmpi.l  #$1C62F5A8,D0
	{ "sfa3hr1",  { 0x8422df8c,0x7b17a361 }, 0x100000 },    // 0C80 1C62 F5A8  cmpi.l  #$1C62F5A8,D0
	{ "sfa3b",    { 0xd421c0b2,0x8116d296 }, 0x100000 },    // 0C80 1C62 F5A8  cmpi.l  #$1C62F5A8,D0
	{ "sfz3j",    { 0x7d49f803,0x0cbe2d79 }, 0x100000 },    // 0C80 1C62 F5A8  cmpi.l  #$1C62F5A8,D0
	{ "sfz3jr1",  { 0x7d49f803,0x0cbe2d79 }, 0x100000 },    // 0C80 1C62 F5A8  cmpi.l  #$1C62F5A8,D0
	{ "sfz3jr2",  { 0x7d49f803,0x0cbe2d79 }, 0x100000 },    // 0C80 1C62 F5A8  cmpi.l  #$1C62F5A8,D0
	{ "sfz3a",    { 0x990b9301,0xa4e42c7e }, 0x100000 },    // 0C80 1C62 F5A8  cmpi.l  #$1C62F5A8,D0
	{ "sfz3ar1",  { 0x990b9301,0xa4e42c7e }, 0x100000 },    // 0C80 1C62 F5A8  cmpi.l  #$1C62F5A8,D0



#581

SF2HF CPS2 roadmap
Get graphics ported correctly
Pass the ram checks
Fix Inputs
Sound
Add a Settings Menu

I’m still stuck on step 1
So imagine if capcom still used cps1 fonts.

http://i.imgur.com/VuUOfMq.png

http://i.imgur.com/cEnTRVA.png


#582

Break from Hyper Fighting

ST Title screen code a lot of jumps to use of to make a main menu with.



00AA12: btst    #$6, ($7e,A5); Start button is pressed or not
00AA18: bne     $aa5c; branch to jmp $2b1c if not pressed.
00AA1A: tst.b   ($2e3,A5); Service switch
00AA1E: beq     $aa28; if not pressed

00AA28: move.w  ($0,A5), D0
00AA2C: move.w  ($32,PC,D0.w), D1

00AA30: jsr     ($2e,PC,D1.w)
00ABA2: move.b  ($7f,A5), D1
00ABA6: not.b   D1
00ABA8: and.b   ($7e,A5), D1
00ABAC: andi.w  #$30, D1
00ABB0: beq     $abf8; goes to an rts
00ABB4: lea     ($2e9,A5), A1
00ABB8: tst.b   ($344,A5)
00ABBC: bne     $abdc
00ABBE: btst    #$5, D1
00ABC2: beq     $abcc
00ABCC: btst    #$4, D1
00ABD0: beq     $abf8; goes to an rts
00ABD2: moveq   #$1, D2
00ABD4: moveq   #$1, D0
00ABD6: bsr     $ab7e
00AB7E: tst.b   ($2df,A5)
00AB82: bne     $ab9a
00AB84: move.b  (A1), D4
00AB86: moveq   #$0, D3
00AB88: move.b  ($2e0,A5), D3
00AB8C: addq.w  #1, D3
00AB8E: mulu.w  D0, D3
00AB90: andi    #$ef, CCR
00AB94: sbcd    D3, D4
00AB96: bcs     $ab9e
00AB98: move.b  D4, (A1)
00AB9A: moveq   #$0, D3
00AB9C: rts

00ABD8: beq     $abfa
00ABFA: move.b  D2, ($2f0,A5)
00ABFE: move.w  #$a0, D0

00AC02: jsr     $9a8.w
0009A8: trap    #$2
0009AC: lea     (-$8000,A5), A4
0009B0: tst.b   (A4,D0.w)
0009B4: beq     $9ce
0009CE: rte
0009AA: rts


00AC06: jsr     $2c86.w
002C86: moveq   #$0, D0
002C88: move.w  D0, ($20,A5)
002C8C: move.w  D0, ($1e,A5)
002C90: lea     ($aa,A5), A0
002C94: move.w  #$1f, D0
002C98: moveq   #-$1, D1
002C9A: move.l  D1, (A0)+
002C9C: move.l  D1, (A0)+
002C9E: dbra    D0, $2c9a
002C9A: move.l  D1, (A0)+
002C9C: move.l  D1, (A0)+
002C9E: dbra    D0, $2c9a

   (loops for 90 instructions)

002CA2: rts



00AC0A: jsr     $b2a.w
000B2A: trap    #$b
000B2E: lea     (-$7f00,A5), A4
000B32: move.w  #$7, D7
000B36: tst.b   ($0,A4)
000B3A: beq     $b62
000B62: lea     ($20,A4), A4
000B66: dbra    D7, $b36
000B36: tst.b   ($0,A4)
000B3A: beq     $b62
000B62: lea     ($20,A4), A4
000B66: dbra    D7, $b36

   (loops for 24 instructions)

000B6A: rte
000B2C: rts

Then off to clear a bunch of data and go to character select.



#583

Some input hacks i did… all of them were pretty simple, minus the Rh crazy kick which actually demanded some work…

-Zangief’s Green Hand: DP + punch;
-Ken’s Crazy Kicks: QCF + kicks, like in HDR;
-Cammy’s Backfist: QCB, like in HDR (forgot to show it);
-Cammy’s Hooligan “HCF”, or to be more precise, i changed the last direction from up-forward to just forward;
-Fei’s Chicken Wing: same as cammy’s hooligan;


#584

This morning decided to not work on graphics and do preliminary work on program roms.
B950E addi.w #$4000,D1

Get rid of the 4000 and you can use the ssf2 font.

http://i.imgur.com/CG21HQ5.png

Now it branches to itself with this bit of code.
B9178 tst.b ($2d2,A5)
B917C bne $B9178

So switch it to a beq it quickly passes the warning and ascii title screens it boots into this garbled screen and reading the memory it’s the Dev menu and it’s upside down.

http://i.imgur.com/SgOiXWC.png

And since the inputs don’t work I can’t do anything.

Now with Video


#585

Inputs only Directions and Punches



ADR   Change
1D2BC 804001
1D2C8 804000



#586

CPS2 Input notes aka I should of read the Source Code before I wrote this.



Inputs
CPS2 0x804000 
Switches are Inverse 0 = on and 1 = off. Inputs are binary.

0x804000 and 0x804001
Other than location it behaves the same on CPS1.
First byte Player 2 controls 0x804000
0x80 = Return to neutral aka cancel?
0x40 = HP, Shot 3, Shot C
0x20 = MP, Shot 2, Shot B
0x10 = LP, Shot 1, Shot A
0x08 = Up
0x04 = Down
0x02 = Left
0x01 = Right
  
Second byte Player 1 Controls 0x804001
0x80 = Return to neutral aka cancel? 
0x40 = HP, Shot 3, Shot C
0x20 = MP, Shot 2, Shot B
0x10 = LP, Shot 1, Shot A
0x08 = Up
0x04 = Down
0x02 = Left
0x01 = Right

Kick Harness
0x804011
This is where it gets different and weirdly this doesn't use a full byte only these bits.
0x20 = Player 2 MK, Shot 5, Shot E
0x10 = Player 2 LK, Shot 4, Shot D
0x04 = Player 1 HK, Shot 6, Shot F
0x02 = Player 1 MK, Shot 5, Shot E
0x01 = Player 1 LK, Shot 4, Shot D

Kick harness part 2
0x804020
0x40 = Player 2 HK, Shot 6, Shot F



#587

You probably seen this on my twitter.

http://i.imgur.com/JrRF5nt.png

Decided to make the patch available for it.

Patch

Notes



309D10 - 309dfc
"WINNERS DON'T[ 
[][][][][][HARA

309F00
][][][][]
SS WOMEN"


It’s a simple tile edit only visible on us region.


#588

#589

Cadillacs and Dinos?
-ud


#590

Hey Jed
I’m wondering if you ever thought about modifying the ST ROM to make it more tournament friendly? I think a lot of people would like the random stage select as it can get very boring being stuck on the same stage forever (also it’s nicer for the spectators too), so maybe a service menu option to enable/disable that would be great if not too much work.

Also something like a score counter would be amazing. It’s the one thing I miss from Hyper SF2 (perhaps you can copy and paste the code for this?!). It can be troublesome when you have a setup unmanned as sometimes the players are so into it they lose track of the scores haha.

I was wondering how to implement this as easily as possible. You may recall that the score counter increases by 1 each time a new game is started, but this applies for both players. If a player loses and let’s the continue timer count down, it counts as a new game and the score is reset. Obviously letting the timer run down wouldn’t work normally since you wipe out the score for the losing player. Maybe you could do something so the score counter of the player who continues does not increase by 1?

I initially thought that you might be able to mess with the end of round scores, like adding 1 point permanently to the vital and disabling the “new match +1 score” thing entirely, but then I realised that would increase the score each round and not each game.

I imagine there is something you can use to generate a score since the game obviously keeps track of who won the last game due to the character lock. You could even get rid of the score entirely and just have a couple of digits for the win counter. Would make it look a bit cleaner for capture overlays too.

Also I got some replacement ROMs in the end and burned training mode. Works so good :slight_smile:


#591

It’s still SF2:HF just got the intro to start playing sort of.