Tux Posted April 11, 2023 Share Posted April 11, 2023 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 Link to comment Share on other sites More sharing options...
ffman1985 Posted April 11, 2023 Author Share Posted April 11, 2023 (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 April 11, 2023 by ffman1985 Link to comment Share on other sites More sharing options...
Tux Posted April 11, 2023 Share Posted April 11, 2023 ... 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 ! Link to comment Share on other sites More sharing options...
ffman1985 Posted April 11, 2023 Author Share Posted April 11, 2023 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(?).) Link to comment Share on other sites More sharing options...
Tux Posted April 11, 2023 Share Posted April 11, 2023 (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 April 12, 2023 by Tux Link to comment Share on other sites More sharing options...
ffman1985 Posted April 12, 2023 Author Share Posted April 12, 2023 (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 April 12, 2023 by ffman1985 Link to comment Share on other sites More sharing options...
Tux Posted April 12, 2023 Share Posted April 12, 2023 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. Link to comment Share on other sites More sharing options...
ffman1985 Posted April 12, 2023 Author Share Posted April 12, 2023 (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 April 12, 2023 by ffman1985 Link to comment Share on other sites More sharing options...
Tux Posted April 12, 2023 Share Posted April 12, 2023 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... Link to comment Share on other sites More sharing options...
ffman1985 Posted April 12, 2023 Author Share Posted April 12, 2023 At first, i wrongly perceived the $618000, $618002… as unwrittable (since they return to $ff immediately after i change the value). But now i know that to see the effect of changing value, the 3 address should be poke together… And thank you for telling me that both $618000($618001) and $618002($618003) are both related to the sound code. I hope this technique can use on all cps games. Link to comment Share on other sites More sharing options...
Tux Posted April 12, 2023 Share Posted April 12, 2023 Pushed to git, since you didn't explain in detail the changes I have put "mainly sound effects, fixes & improvements". Tested quickly, works perfectly, the shortcut to the service mode without reseting the game when you leave is quite impressive too ! Congratulations ! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now