mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Fixed the modulo operator for negative integers
* this changes the behavior of vanilla modulo operator to use signed integer division to match how the fixed division operator works.
This commit is contained in:
@@ -3305,13 +3305,16 @@ void BugFixes::init() {
|
||||
SafeWriteBatch<WORD>(0x04DB, { // fild 64bit > fild 32bit
|
||||
0x46A3A8, 0x46A3F4, // op_mul_
|
||||
0x46A4E7, 0x46A566, // op_div_
|
||||
0x46A280, 0x46A2CD, // op_sub_
|
||||
0x46A280, 0x46A2CD // op_sub_
|
||||
});
|
||||
|
||||
// Fix for vanilla division operator treating negative integers as unsigned
|
||||
// Fix for vanilla division and modulo operators treating negative integers as unsigned
|
||||
//if (IniReader::GetConfigInt("Misc", "DivisionOperatorFix", 1)) {
|
||||
dlogr("Applying division operator fix.", DL_FIX);
|
||||
SafeWrite32(0x46A51D, 0xFBF79990); // xor edx, edx; div ebx > cdq; idiv ebx
|
||||
SafeWriteBatch<DWORD>(0x90FBF799, { // xor edx, edx; div ebx > cdq; idiv ebx
|
||||
0x46A51D, // op_div_
|
||||
0x46A669 // op_mod_
|
||||
});
|
||||
//}
|
||||
|
||||
//if (IniReader::GetConfigInt("Misc", "SpecialUnarmedAttacksFix", 1)) {
|
||||
|
||||
Reference in New Issue
Block a user