Jump to content

Recommended Posts

Posted (edited)

Ok, so here is a slightly improved version of the script, basically less tests in each frame by grouping the tests and the result of all that is that for me I have

peek($ff8050) == $40 as soon as I start the 1st script, well almost, on the phoenix screen it's still ff8050 == 0 but after that something puts $40 in it during all the frames.

Since your test to exit your menu is
       #Start game#
       if (peek($FF8050)>$00) #P1 start game#
          poke $FF8058 $01
          poke $FF817B $01
       endif
it exits as soon as it reaches this point (I don't know what this ff8050 address is supposed to contain, I just know it's in ram).

Actually it occurs all the time now with all the versions, 32 or 64 bits, I even wonder how I could have this menu to stay on screen before, now I can't, it's gone as soon as it appears.

edit : and I finally understood how to get your menu to stay : you must start your script before starting the game ! That is, load the game with the option not to auto start it in the background, then enable the 1st script, then start the game. Then the peek stays at 0 all the time. If you start the script even during the phoenix screen, it's too late, the memory address will get $40 all the time.

sfad.txt

Edited by Tux
Posted

I try to start my script late, i.e. in the title screen, and it still works normally.

The ff8050 is actually about the controller 1 punch buttons and kick buttons. If no button is pressed, ff8050 must be equal to zero. For other cases:

=01 means light punch is pressed, =02 means medium punch, =04 means heavy punch, =10 means light kick, =20 means medium kick, =40 means heavy kick.

It is abnormal that you see $40 for ff8050 all the time. This only happen if you hold the heavy kick button for player 1.

Posted

Much better with some documentation !

So that's because I use alt-c as a keyboard shortcut to call the cheats dialog, I think that's the default shortcut, and since C is also the key for heavy kick, it's seen as always down when you return from the cheats dialog !

At least we found a rare bug here. I'll fix it in git... !

Posted (edited)

Good to find out the rare bug. Since I assign a key to controller to call the cheat menu, I never trigger the bug you mentioned. By the way, is it possible to add the shortcut of combination of buttons in the controller? For example, pressing ABX+start button to reset the emulator. So that I can have more buttons to use for gameplay.

Also I try the modified script, it shows great improvent on the menu (misc 15% decrases to 11%), is the change only involves grouping of other parts into "if dpeek($FFAE18)==$02E7"? 

However, when i group more title parts script under "if dpeek($FFAE18)==$02E7", it shows no improving.

Edit: I find # (dpeek($FFAE18)==$02E7), on line235, is it redundant?

Edited by ffman1985
Posted
5 minutes ago, ffman1985 said:

Good to find out the rare bug. Since I assign a key to controller to call the cheat menu, I never trigger the bug you mentioned. By the way, is it possible to add the shortcut of combination of buttons in the controller? For example, pressing ABX+start button to reset the emulator. So that I can have more buttons to use for gameplay.

I don't think so, because A is used for normal input, so if you start pressing it then the corresponding control is enabled... !

5 minutes ago, ffman1985 said:

Also I try the modified script, it shows great improvent on the menu (misc 15% decrases to 11%), is the change only involves grouping of other parts into "if dpeek($FFAE18)==$02E7"? 

However, when i group more title parts script under "if dpeek($FFAE18)==$02E7", it shows no improving.

There was also the grouping under
if ((peek($FF8051)==$04)or(peek($FF8055)==$04))
instead of all these if which had this very same test in a and

Well you can't win all the time with this kind of optimization, it came obvious to me when reading the script so I did it while looking for the cause of my problem...

Posted

Actually, I am thinking of a function to allow user to freely set a combination of key (controller key not keyboard) for a shoutcut of a particular purpose, eg: ABX+start = reset, select + x = call cheat menu (the key in this example is the xbox controller), etc. I don't think this combination of buttons affect gameplay in most games. If yes, i hope player can change the key combination.

Posted
7 minutes ago, ffman1985 said:

Actually, I am thinking of a function to allow user to freely set a combination of key (controller key not keyboard) for a shoutcut of a particular purpose, eg: ABX+start = reset, select + x = call cheat menu (the key in this example is the xbox controller), etc. I don't think this combination of buttons affect gameplay in most games. If yes, i hope player can change the key combination.

I accept patches... ! on my side I just pushed the fix for alt-c

Posted (edited)

It seems that the optimazation has great effect from the grouping under "if ((peek($FF8051)==$04)or(peek($FF8055)==$04))". I think I should change all of my scripts to this format (although it is more difficult to understand).

(originally, "if (dpeek($FF0000)==$0000)and((peek($FF8051)==$04)or(peek($FF8055)==$04))" means when acrade mode is highlighted, and P1 or P2 press down button.)

Thank you very much for making the changes on my script. It has been a long time that I cannot see any comment on my scripts.

Edited by ffman1985
Posted

... and pushed this script to git too... I didn't test everything, but it can always be updated later, and it's already quite impressive !

Posted

Very happy that my script to include in Raine again. Without big change or serious bug, i will not post a update. The next thing i want to do is to add some sound effect in the menu screen when switching choice. (Want to do since i posted the first console mode script, but still no idea how to do that, except for the coin sound which has different treatment(?).)

Posted (edited)
14 hours ago, ffman1985 said:

Very happy that my script to include in Raine again. Without big change or serious bug, i will not post a update. The next thing i want to do is to add some sound effect in the menu screen when switching choice. (Want to do since i posted the first console mode script, but still no idea how to do that, except for the coin sound which has different treatment(?).)

Actually it's rather very tricky for cps2 because it's qsound, this chip doesn't take a single sound command, it has some shared ram which can be accessed directly by the 68k.

I tracked how songs are played for the sound associations function, so I can explain this, but I didn't try to find how sound effects are played, but apparently it's something different, probably another offset...

Anyway for a song, 1st init the game until you reach at least the copyright screen then go to sound commands / Associations and test one of the proposed sound commands until you find something you like. Here we'll take song number 1, the 1st one.

So you need to 1st zero out the 16 1st addresses of the qsound ram ! And to make things worse this ram is not contiguous so you must access it this way

poke $618000 0 for offset 0
poke $618002 0 for offset 1
...
poke $61801e 0 for offset $f

If you want to experiment with that try that in the console, for a script you would need something like a memset command to clear the whole area in 1 line. Anyway once the whole 16 1st offsets have been cleared :

poke $618000 commnad here the command would be 1 then
poke $61800e 0 (from the console I am not sure this last poke is necessary since you just cleared it, the game always finish any qsound command by writing something to this offset).

If you did things right you can close the console with the ESC key and you should hear something !

Rather complicated, I'd advise to start with neogeo which is much easier than that because there are true sound commands in neogeo !

edit : after testing quickly for the sound effects : they are simply after the musics, but it's on a word, high byte goes to offset 0, low byte goes to offset 1, so I guess in my example you should rather put 1 in $618002 even if putting it in $618000 seems to work.
To experiment with this go to the service mode, sound test and browse the sounds... If you go backwards it goes to sound $2ff (which is nothing), but there are soon real sound effects to be heard close to this value. When you find 1 you like you can check the values in the qsound shared ram using peek($618000) for example. If you really want to try that, I'll add a memset function to clear the area in 1 line.

Edited by Tux
Posted (edited)

Hello, Tux, thank you very much for your information. Although I am not very understand, I can finally add the sound effect (but only in the case of no other music or sound effect).

After knowing the region $618000 is for music/sound, it helps a lot. At first, I found that changing the value in the region $618000 do not have any effect (I don't know if i have anything done wrong). But I found that $618003 is for the sound code of the music or sound effect. So, I try to remove the instruction (rom hack) that write value into this adress, and put in the value of the sound code of the sound effect that I want. The next problem is, only writing a value to $618003 is not enough, it cannot trigger the sound. Luckily, I remember that setting the $FF817B to $01 can produce the coin sound. Since I set the sound code on $618003 in advance, the coin sound becomes other sound. Here is a short script for my test:

script "Sound command test"
run:
lpoke $12B84 $00000000 #Disable sound command#
lpoke $12B88 $00000000
if peek($FF8050)>$00 #When a button is pressed#
  poke $618003 $F8 #Set sound code#
  poke $FF817B $01 #Originally for producing coin sound# 
endif

 

And here is the updated sfad.txt:

https://drive.google.com/file/d/16kFgGdtZGKr7bQn8Qjnj7rCiGM-cjeKO/view?usp=share_link

(edit: after uploaded, i find that the sound effect for game start is wrong, I may update again later. But please have a look on it first.)

 

There are still room for improvement as this method prevent the playing of the original background music and sound effect (and so, it can only use in menu or title screen). But once again, thank you very much for your help, Tux.
 

 

Edited by ffman1985
Posted

writes to $618003 are strictly equivalent to writes to $618002, there is a handler at this address, it takes the offset and divides it by 2, the use it as an index in the qsound shared ram.

Anyway glad it worked for you, I'll take a look later.

Posted (edited)

Finally find a way to play any music or sound effect without rom hack, so it will not affect the music or sound effect that are playing. Here is the test script:

script "music test2"
run:
if peek($FF8050)>$00 #When a button is pressed#
poke $618001 $00
poke $618003 $F8 #set music code#
poke $61801F $00
endif

 

And here is the more updated sfad.txt with the latest method: (EDITED AGAIN)

https://drive.google.com/file/d/1Z-todk1qykH41S_B6am18pOUFroYh6Hm/view?usp=share_link

Here are the area with added sound effect:

1. Pressing start in the title screen, 2. Pressing up/down on menu screen, 3. Pressing punch/kick button on menu screen, 4. Pressing down on the ?box after enable the bosses script.

 

But I totally don't know what the ram address resprsent, except  $618003. And I cannot write thing into $618000 and other addresses which always =$FF. Anyway, this method works without sideeffect.

Now, the street fighter alpha phoenix edition script  is the most advanced script out of my work which is most console-liked.

Edited by ffman1985
Posted

Yeah I know accessing this area is counterintuitive, you can keep $618001 it would be correct for normal ram, here it's the same as a poke to $618000, and poke to $618003 is the same as $618002. To remind you these are high byte of the word code for the music or sound effect to be played ($618000) and low byte in $618002 (or $618003 as you prefer).

For $61801f if it's enough for you with sfad that's good, the song associations clears the whole area, but it works anywhere with any game.

Good I'll test it a little later and update it to git...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...