Jump to content

Question about the cheat function in Raine


ffman1985

Recommended Posts

Well I didn't understand everything here, with this script you start it on the title screen, it works like the on script, normal, then f1 to reset, which stops all the scripts including this one, when you return to the title script it's normal which confirms this script is indeed stopped.

But apparently it's not a problem for you anyway so everything is good.
And that's right, this loop is quite fast, it's probably because the 3 1st instructions of the for are specially evaluated, no function parsing for these 3, the function parsing is used only from the 4th argument. Anyway it works well, so it's good.

Link to comment
Share on other sites

If you want to test the for loop function, you may try the following script on x-men. It should enable on the title screen to remove the Press Start text.

script "Remove 'Press Start' text"
on:
    for counter=0 counter<=$C0 counter=counter+8 poke $924005+counter $00

Link to comment
Share on other sites

Why ? I love the precision of your messages by the way, I had to fetch the short name of the game in the game list... xmcotar1d, copy your script, and test it : everything is fine, so why bother ?

Link to comment
Share on other sites

Hello, Tux. Sorry that I make a typing mistake in my previous post which cause a misunderstanding. I update my message as follows:

When I change your script to the following, it DOES NOT work after reset. (if the script extecutes in the 1st run)

script "test 2 alt"
run:
   poke $FF4BE1 $F3
   poke $FF26AD $71
   for counter=0 counter<=$2ac counter=counter+4 dpoke $90c090+counter $6000

Link to comment
Share on other sites

1 hour ago, ffman1985 said:

Hello, Tux. Sorry that I make a typing mistake in my previous post which cause a misunderstanding. I update my message as follows:

When I change your script to the following, it DOES NOT work after reset. (if the script extecutes in the 1st run)

script "test 2 alt"
run:
   poke $FF4BE1 $F3
   poke $FF26AD $71
   for counter=0 counter<=$2ac counter=counter+4 dpoke $90c090+counter $6000

Ah yes good lesson... !

Well I have a good news and a bad news !

The good news is that it's fixed...

The bad news is that it was very fast because it executed only the 1st time, it was not exactly a bug in the for code, it was because of the recent optimization of the script, now lines are parsed the 1st time they are executed, and then it's some semi compiled code which is executed, and with the inserted instruction starting at argument 4, the instruction itself, it was really not supported ! So after fixing this, it becomes slow as it should have been, I was surprised it was so fast, but didn't care enough to investigate, it was because it was executed only once !

It means that for this loop with quite a fast cpu I get about 55% cpu time in the misc for you run: script
and it's up to 95% if using a debug build (which means 0% in free, and 60 fps can't be maintained anymore).
As I said originally : avoid to have this kind of beast in a run: script, if you do that, either put it inside a if so that it's not executed all the time, or make sure it's short !

Link to comment
Share on other sites

16 hours ago, ffman1985 said:

Hello, Tux. Sorry that I make a typing mistake in my previous post which cause a misunderstanding. I update my message as follows:

When I change your script to the following, it DOES NOT work after reset. (if the script extecutes in the 1st run)

script "test 2 alt"
run:
   poke $FF4BE1 $F3
   poke $FF26AD $71
   for counter=0 counter<=$2ac counter=counter+4 dpoke $90c090+counter $6000

Actually I have just experimented with some lua binding to do this kind of thing, I can get this run script to run at 0% misc on a debug build with a lua binding !

The script becomes this :

script "test 2 alt"
run:
   poke $FF4BE1 $F3
   poke $FF26AD $71
#for counter=0 counter<=$2ac counter=counter+4 dpoke $90c090+counter $6000
   lua for i=0,0x2ac,4 do dpoke(0x90c090+i,0x6000); end

 

The lua for is like the C one in even shorter, you don't even write the test in full, nor the increment. The trick which makes it so much faster than our classic script functions is that here it's allowed to pass numbers directly to functions, so the dpoke here doesn't have to do any string conversion, it's a super short function which writes almost directly to ram !

That's also why you are obliged to use the 0x notation for hex numbers, which I don't like personally, but it's the one officially used by C and lua for numbers and you don't want to convert strings to numbers here, so you have to use their notation.

I tried first to interface lua to our usual do_poke function and I got something around 38% in misc with the debug build, so I tried this direct version with numbers instead -> down to 0% !

Now it's something ultra experimental, on arch I was obliged to use some tricks for the 32 bits package because these morons (I like them usually but here they are morons !) don't provide a 32 bits package for lua53, so you need to build it yourself, which won't be easy for the official package for sure. Plus it uses liblua.so for the 32 bits package, and liblua5.3.so for the 64 bits package, not sure how it will work in mingw... !

But it's interesting nonetheless... It's not pushed to git yet, I'll have to test this in windows first... !

Ah and also : lua knows only about dpoke, this is the only function I added for it !

edit : I had a quick look at mingw32 and actually they don't have any lua-5.3 package, then I found out that finally the same interface can be used with lua-5.4, so I pushed everything to git, just install the latest lua package from mingw32, it should work.

Notice that you can experiment with lua code in the console, you get some nicely displayed error messages from the lua interpreter in the console. I didn't test the compilation in mingw32 yet... !

edit 2 : windows build fixed, mainly memwatch stupid types in windows, and put lua lib in all the builds except dos (no idea if there is a lua for dos, but there is no console in dos !).

Oh yeah by the way lua uses ; sometimes to finish an instruction like here for dpoke, if you remove the ; you get an error, so ; are not recognized as comments anymore !

Edited by Tux
Link to comment
Share on other sites

Returning to your original script, xmcotar1d, it was slow in its time so it's a good candidate to test with lua, I can't navigate the menu in the start screen... 1st it displays press start, you must still insert a coin, contrary to some more recent scripts, then you reach the start screen with your "ARCADE" text printed below, there direction keys should navigate the menu, right ? Because they don't for me... Did I miss something or did we break it at some moment ?

Link to comment
Share on other sites

Happy to hear that you find the way to modify the for loop function which make is so fast now. But there is problem in compiling (check pm), I will test it afterward.

For xmcotar1d, it was a script made in early Feb, there was many new skills not used in that time (like press start button to skip the opening). But the good news is, there will be a update very soon.

 

P.S. The following script should not break anything, it just removes text.

script "Remove 'Press Start' text"
on:
    for counter=0 counter<=$C0 counter=counter+8 poke $924005+counter $00

Link to comment
Share on other sites

18 minutes ago, ffman1985 said:

Happy to hear that you find the way to modify the for loop function which make is so fast now. But there is problem in compiling (check pm), I will test it afterward.

For xmcotar1d, it was a script made in early Feb, there was many new skills not used in that time (like press start button to skip the opening). But the good news is, there will be a update very soon.

 

P.S. The following script should not break anything, it just removes text.

script "Remove 'Press Start' text"
on:
    for counter=0 counter<=$C0 counter=counter+8 poke $924005+counter $00

This one is exactly like the previous one, except poke instead of dpoke. I needed something where you see a heavy misc usage, but it's not an emergency, it can wait. For the pm you cut the message too much, the important part is gone there !

and without looking at the message, if you install lua it should compile without any warning, for the 32 bits mingw32 shell it's pacman -S mingw-w64-i686-lua translate to the equivalent package name for mingw64.

Edited by Tux
Link to comment
Share on other sites

The glorious 1st luascript :

luascript "test 2 alt [lua]"
run:
   poke(0xFF4BE1,0xF3)
   poke(0xFF26AD,0x71)
   for i=0,0x2ac,4 do
      dpoke(0x90c090+i,0x6000)
    end

it's still for mshud, so it's the same syntax as a usual script, except the contents of the sections is directly some lua code.

peek, dpeek, lpeek, poke, dpoke, lpoke are supported, but these are the only functions supported for now in lua, but with this we should be able to convert most of your scripts already !

(notice the ; is actually only useful if you have everything in 1 line, otherwise you can forget it)

This is of course work in progress, if you try to pass a parameter to such a script it will be ignored.

But it's progressing fast anyway ! ;-)

edit : and fixed for windows... !

Edited by Tux
Link to comment
Share on other sites

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...