![]() |
|||||
Changing the Stage ID System - Printable Version +- Little Fighter Empire - Forums (https://lf-empire.de/forum) +-- Forum: Little Fighter 2 Zone (https://lf-empire.de/forum/forumdisplay.php?fid=7) +--- Forum: [2.0] Exe Editing (https://lf-empire.de/forum/forumdisplay.php?fid=43) +--- Thread: Changing the Stage ID System (/showthread.php?tid=9222) |
|||||
Changing the Stage ID System - Ikran Ahiyìk - 05-26-2014 I was dreaming about this years ago, but impossible as a then-purely-DCer. While after only just several days hanging around here, it seems the green light is out. Not only possible (of course), but I guess it is quite practical. A guess only. Although it only involves some changes in numbers, I seldom find mods that done with the similar things. Still haven't say what I want exactly... it is GOAL: To change the stage id: system such that 20 is recognized as Stage 2, up to 100 as the Survival Stage. Besides, only 19, 39, 59, 79 and 99 are definite finals, so now there will be 20 acts (sub-stages) available for every stage. I hope it is possible to really change it successfully. I've found some related instructions and variables, but not all, because I don't know how to find the rest... I've brainstormed and listed below what the existing system is and what to change to realize my plan. (This is what this thread mainly set up for.) I've thought of 6 elements and listed below, but there might be more. Besides, the address stores the stage id is 450B94. 1. Stage choosing in the menu [CERTAIN] After choosing the characters, players can choose the starting stage - 1, 2, 3, 4, 5 or Survival. It is confirmed that at this moment, no such values 1, 2, 3... exist in the storage, but rather, the stage id 0, 10, 20, ... 50. I've found the related instructions:
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.
SOLUTION for my plan: Currently none. 3. Set backgrounds at stage starts [CERTAIN] I found the instruction set for defining the backgrounds to be loaded at stage starts.
4. Change the stage IDs that are recognized as final acts [UNCERTAIN] This is uncertain because I don't know is this process included somewhere else. I'm not really sure what the actual criteria for a stage end. There may be at least two versions I could come up: If all of the current sub-stage's phases are clear, AND either (1) or (2) is met. // (1) The id after the current one is absent. Version 1: (2) The current stage id is 9, 19, 29, 39 or 49, (or 59). Version 2: (2) The next stage id is out of the range of the current stage (eg. 0-9/10-19/...) It is annoying that they mean the same, but the codes would look quite different... I don't even confirm is the real process one of these, and if yes, which one. SOLUTION for my plan: None. 5. Enable the use of the extra stage id: 60-100 (or -119) [UNCERTAIN] This is uncertain because I don't know is there actually a limit set like this. I just tried using a stage id: 60, found that it would make LF2 crash while loading the stage file. This limit requires more observations, just as basic as why this would occur... 6. Change the calculation of the tag "STAGE %d-%d" [CERTAIN] [UNSOLVED] It is certain that they are calculated based on the stage id. I just don't understand how it calculates the stage and act number in assembly code. By math it would be STAGE = ID div 10 + 1 ACT = ID mod 10 + 1 The related code would probably be:
SOLUTION for my plan: By math change the "10" to "20" would be fine, just don't know the corresponding part in assembly code. Another thing is the 32 at 438722. (Edit) SOLUTION: 438734 SAR EDX,3 // 438741 CALL ??? / ??? ADD EDX,EDX / (???+2) ADD EDX,EDX / (???+4) RET 7. Array size [UNSOLVED] (05-28-2014, 03:03 PM)Blue Phoenix Wrote: 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!). [...]1. Where is it? I know in programming variables need to be defined or declared before being used. This includes arrays, about the data type and its size, but where is it? 2. How to change its size then? ... May 28 edit: For Element 6, I've added some descriptions to the code according to my findings. On the other hand, I see the system makes stage id: 0-19 recognized as Stage 1, 20-39 as 2 etc. if I change 438734 into SAR EDX,3. To tackle the remaining problem, just repeat 438741 once more, making the "10" into "20" would be fine. (Now it is (1+4)*2, I need it (1+4)*2*2.) Element 6 SOLUTION: 438734 SAR EDX,3 // 438741 CALL ??? / ??? ADD EDX,EDX / (???+2) ADD EDX,EDX / (???+4) RET May 29 edit: Added Element 7 as Blue Phoenix has raised. RE: Changing the Stage ID System - Ikran Ahiyìk - 05-28-2014 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. RE: Changing the Stage ID System - Silverthorn - 05-28-2014 (05-26-2014, 01:56 PM)Ikran Ahiyìk Wrote: 2. Always set to the starting sub-stage in the menu [UNSOLVED]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...!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. RE: Changing the Stage ID System - Ikran Ahiyìk - 05-29-2014 (05-28-2014, 03:03 PM)Blue Phoenix Wrote: 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 upI guess I've got something when investigating element 6, that's similar to this one... Maybe I could solve it later, but jumping to a blank area for own calculations is a good suggestion as last resort through. ![]() (05-28-2014, 03:03 PM)Blue Phoenix Wrote: 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, everybodyAh yeah! Never thought of this and thanks for bringing this out! But... I've no idea how to implement this. First off I don't know where the array is defined, and how exactly to enlarge it for the second. Those people who change the frame-limit simply just throw their exe out with little explanation, or did I recalled wrongly? ... Anyway this is the biggest problem now, at least right now I see this has nothing to do with all elements 1-6 I listed above, and I have to add one more. Thanks for insights ![]() |