Tux Posted January 14, 2023 Posted January 14, 2023 (edited) 6 hours ago, ffman1985 said: Hello Tux. I delete the hi score file and the problem is gone. Yet, I still don’t know what exactly I have done wrong to damage the hi score file (highly possible that some problems in the process of making my cheat script). I am so sorry that I waste you so much time on testing it. Thank you for your great efforts on this topic. Well raine is full of tricks to try to preserve it as much as possible, normally it survives a game reset, even a game load (loading a save state), and sometimes the test mode (but not always, depending on the way the ram is initialized or not). It's saved only when you quit raine or load another game, so if you go to test mode, and it's not detected because of a fancy ram initialization and then quit or load another game, you destroy the hiscore file. Sorry I can't do much about that... ! edit : all this pushed me to update the very old code for this turbo key, it was still trying to display the fps as an int when returning to limited speed when it's been a double for quite a few years already, so the display was very wrong. Now it's correct, and it also displays the average fps reached while the turbo key was pressed (I reach more than 4000 fps during the sfad demo and with a debug build, but it's the assembler version, but it's really too fast at this level !). And finally it automatically disables the opengl double buffer while the turbo key is pressed, so now you can finally use this key without changing anything in the video settings ! Edited January 14, 2023 by Tux
ffman1985 Posted February 20, 2023 Author Posted February 20, 2023 Hello, Tux, if we have any discussion about the technique in writing the cheat script, let’s continue here.
ffman1985 Posted February 20, 2023 Author Posted February 20, 2023 I have found a new way to optimised my script. The concept is to control the frequency of operation. I use the rnd() function as a controller. Since it is a random number between 0 to 255, if I want to set a frequency of about 50% of original, I can set a condition like this: if rnd()<=127 Here is the optimised version of xmen using this concept. I also add a "Arcade Gameover" part to prevent the text not appear in menu after the Arcade game. https://drive.google.com/file/d/1CIqRmdkJsreB5Fln_zxKXaVBRbstv4-8/view?usp=share_link
Tux Posted February 20, 2023 Posted February 20, 2023 Frequency in a random number ?! Sounds odd to say the least, I'll take a look later... !
ffman1985 Posted February 20, 2023 Author Posted February 20, 2023 The result is more obvious in training mode during character select.
Tux Posted February 20, 2023 Posted February 20, 2023 28 minutes ago, ffman1985 said: The result is more obvious in training mode during character select. Well I tested, and I am not really convinced, you see the effect of rnd(), the %Misc varies now, but it's not really faster... I return to the normal script for now... (I prefer stable numbers which can be read easily, and the numbers are < 10% even in debug mode here, so it's not worth something like that).
ffman1985 Posted February 20, 2023 Author Posted February 20, 2023 It can help to reduce the misc % in my beginning test. However, when I try again without power supply plug into my laptop, the misc % is very high. I don’t know why.
Tux Posted February 20, 2023 Posted February 20, 2023 36 minutes ago, ffman1985 said: It can help to reduce the misc % in my beginning test. However, when I try again without power supply plug into my laptop, the misc % is very high. I don’t know why. I guess without power supply your frequency is lowered to save power, and everything slows down, all easily. Tower here, so stable, but running by default à 1.5 Ghz, the frequency increases only if the cpu load average increases, and raine stays very low on the low average usually, even with your script running it stays at 1.5 GHz.
ffman1985 Posted April 17, 2023 Author Posted April 17, 2023 Hello Tux, I need some help on the script function. I am trying a script to poke values into multipy addresses with regular interval: that is, $90C090, $90C094, 90C098... $90C338, each with a interval of $04. The game I perform the test is Marvel Super Heroes (mshud.zip). The objective is to remove the backgound object on the title screen (the gauntlet). Here is my script: (just focus on the if-endif part, the script is enabled on the title screen) script "test" run: #Shift background# poke $FF4BE1 $F3 poke $FF26AD $71 #Remove gauntlet# if dpeek($FF1020)<=$02AC dpoke $90C090+dpeek($FF1020) $6000 dpoke $FF1020 dpeek($FF1020)+$0004 endif Although it can remove the background, it is super inefficient. (The gauntlet is removed slowly). Then I try to add a variable for $FF1020 (which I use for the purpose of a counter), but the game alway crash. (The following two tests) script "test 2" run: poke $FF4BE1 $F3 poke $FF26AD $71 counter=dpeek($FF1020) if counter<=$02AC dpoke $90C090+counter $6000 dpoke counter counter+$0004 endif script "test 3" run: mode=peek($FF1000) Please advise. Thank you for your kind attention.
Tux Posted April 17, 2023 Posted April 17, 2023 There are 2 parts here : 1) it's not a crash, it's the effect of the recent optimization to make the ifs faster, if you run raine from a console (which is always the case for me in linux, curse windows to make running programs from a console so difficult !), you'll see it prints an error message before exiting without crashing, the message says : no command for counter=dpeek($FF1020) It's not an error from you, it's because the optimization expects to have real commands inside an if, that is a function name and then some parameters, which is not the case here, something I forgot but I thought we would have found this kind of case earlier. Anyway its really easy to fix, I just pushed the fix in git. The script doesn't remove the gauntlet, it keeps the gauntlet alone on the title screen 2) what you really need here is a loop, simply. Well the fact is that these scripts were never meant to be that complex so the notion of block is not really defined for them for now except for the if..elsif|else...endif case. What I could do is a simplified loop without block, like the c for loop, but without block which would look like : for init test increment instruction where init would be the initalization of the loop variable, like i=0 test would be the test to run for each turn like i<=12 increment would be what is executed at the end of the loop, like i=i+4 (the i+=4 from C is not supported by the console !) and finally instruction the optional instruction to run inside the loop, which would replace a whole block, like dpoke adr+i value This would be a good compromise, not too hard to do, and it would simplify quite a lot this kind of problem, plus the loop would execute in 1 frame, here your script runs a lot of frames for its loop. What do you think ?
Tux Posted April 17, 2023 Posted April 17, 2023 Just pushed this simple for loop to git, your script becomes : script "test 2" on: poke $FF4BE1 $F3 poke $FF26AD $71 for counter=0 counter<=$2ac counter=counter+4 dpoke $90c090+counter $6000 it's now a on: script, not a run: because everything executes in just 1 frame.
ffman1985 Posted April 17, 2023 Author Posted April 17, 2023 Updated in git and have copied and pasted the script to my txt file, but it doesn't work. Also, since it is now become on instead of run, is that means it cannot be part of my console mode script which is run?
Tux Posted April 17, 2023 Posted April 17, 2023 (edited) Well it works here so you probably made a mistake somewhere. Of course not you can do whatever you want with it, but be careful if the loop never ends then raine will freeze and the only way to stop it will be to kill it (from the task manager). You can open the console and do a help for to check if for is really inside. And of course if you run a loop such as the one in your example in every frame in a run: script, it will probably be very very slow ! Edited April 17, 2023 by Tux
ffman1985 Posted April 18, 2023 Author Posted April 18, 2023 I just copy and paste the script you provided above. I can execute the script without warning (so it proves that my Raine is updated through git, unlike that there is warning in the old version). However, it seems that the for loop part of the script does not work. After executed, the gauntlet remains on the screen. Then I use the peek function in the console to test the adress $90C090, $90C094..., and it shows that their value are not changed.
Tux Posted April 18, 2023 Posted April 18, 2023 (edited) It's probably something stupid but since I can't guess what it is, here is my mshud.txt file. To be started on the title screen of course. mshud.txt Edited April 18, 2023 by Tux
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