Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Changing the Stage ID System
#3
(05-26-2014, 01:56 PM)Ikran Ahiyìk Wrote:  2. Always set to the starting sub-stage in the menu [UNSOLVED]
If I change the 0A at 42DEE4 (shown above) to something else, like 0B, the stage id would still be divisible by 10 finally. However, when it comes to the boundary of 60 (see 42DEE7, above), it fails to limit it. Therefore this process is done after the above one.
On the other hand, if I change 0A into 14 instead, which is 20, divisible by 10, the Stage would be 1, 3, 5, 1, 3, 5 ... with pressing Attack.
Here's my finding: once I change the stage id using Cheat Engine, on the menu, it immediately changed back to something divisible by 10, and 42CCF5 is reported for writing to stage id.
    ASM-Code:
0042CCE0   F7E9             IMUL ECX
0042CCE2   C1FA 02          SAR EDX,2
0042CCE5   8BC2             MOV EAX,EDX
0042CCE7   C1E8 1F          SHR EAX,1F
0042CCEA   03C2             ADD EAX,EDX
0042CCEC   8D0480           LEA EAX,DWORD PTR DS:[EAX+EAX*4]
0042CCEF   03C0             ADD EAX,EAX
0042CCF1   2BC8             SUB ECX,EAX
0042CCF3   74 05            JE SHORT lf2hexed.0042CCFA
0042CCF5   A3 940B4500      MOV DWORD PTR DS:[450B94],EAX
0042CCFA   8B0D 78114500    MOV ECX,DWORD PTR DS:[451178]
I need to change "... divisible by 10" into "20", but I can't see anything looks like 10. What should I do?
In terms of CPU-cycles, division is one of the most gruesome basic operations there are. It's likely that the compiler simply "optimized" the code by replacing "divide by 10" by some brainwrecking commands. I actually tried to understand what happens in the code posted above but eventually gave up :p
This thread shows what can be done to optimize exactly this problem, so as you can see, things get messy really fast. My suggestion would be to just JMP out of there, do your own calculations for "division by 20" and JMP back to the end of this block.



(05-28-2014, 08:17 AM)Ikran Ahiyìk Wrote:  Whenever I put a Stage ID >= 60 in Stage mode, LF2 crashes. I've no idea where this limit from and I need help most on this... Please help...!
If I can't solve this, all the other effort would be useless.
I am most definitely sure that in the original code, the stage-array has been allocated as an array with 60 elements (counting from 0 to 59). This means you'll have to enlarge that array (oh boy!). As chances are low that it's right in front of some empty space, you'll probably have to redefine the pointer to the stages-array. I expect that to be some terribly nasty work, similar to enlarging the frame-limit of characters or object-limit of data.txt. Somebody that has more experience in hex than me (so basically, everybody :p) rate the level of effort for this.
Silverthorn / Blue Phoenix
~ Breaking LFE since 2008 ~

"Freeze, you're under vrest!" - Mark, probably.

» Gallery | » Sprites | » DeviantArt
Reply
Thanks given by: Ikran Ahiyìk , darkfiren


Messages In This Thread
Changing the Stage ID System - by Ikran Ahiyìk - 05-26-2014, 01:56 PM
RE: Changing the Stage ID System - by Silverthorn - 05-28-2014, 03:03 PM



Users browsing this thread: 1 Guest(s)