BtlCmd_TryImprison matches now; better WSL2 detect

This commit is contained in:
PikalaxALT 2023-08-26 09:42:07 -04:00
parent 0ed1e7c200
commit 61ec9cf40a
2 changed files with 33 additions and 171 deletions

View File

@ -1,38 +1,46 @@
WSLENV ?= no
ifeq ($(WSLENV),no)
NOWINE = 0
NOWINE = 0
else
NOWINE = 1
# As of build 17063, WSLENV is defined in both WSL1 and WSL2
# so we need to use the kernel release to detect between
# the two.
UNAME_R := $(shell uname -r)
ifeq ($(findstring WSL2,$(UNAME_R)),)
NOWINE = 1
else
NOWINE = 0
endif
endif
ifeq ($(OS),Windows_NT)
EXE := .exe
WINE :=
GREP := grep -P
SED := sed -r
SHA1SUM := sha1sum
MKTEMP := mktemp
EXE := .exe
WINE :=
GREP := grep -P
SED := sed -r
SHA1SUM := sha1sum
MKTEMP := mktemp
else
EXE :=
WINE := wine
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
GREP := grep -E
SED := gsed -r
SHA1SUM := shasum
MKTEMP := gmktemp
else
GREP := grep -P
SED := sed -r
SHA1SUM := sha1sum
MKTEMP := mktemp
endif
EXE :=
WINE := wine
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
GREP := grep -E
SED := gsed -r
SHA1SUM := shasum
MKTEMP := gmktemp
else
GREP := grep -P
SED := sed -r
SHA1SUM := sha1sum
MKTEMP := mktemp
endif
endif
ifeq ($(NOWINE),1)
WINE :=
WINPATH := wslpath
WINE :=
WINPATH := wslpath
else
WINPATH := winepath
WINPATH := winepath
endif

View File

@ -4039,8 +4039,6 @@ BOOL BtlCmd_EruptionDamageCalc(BattleSystem *bsys, BattleContext *ctx) {
return FALSE;
}
//Matches in compiler explorer- here some of the variables get stored in the wrong place on the stack pointer
#ifdef NONMATCHING
BOOL BtlCmd_TryImprison(BattleSystem *bsys, BattleContext *ctx) {
int adrs, side, i, j, battlerId, maxBattlers, battlerIdA, battlerIdB;
@ -4085,150 +4083,6 @@ BOOL BtlCmd_TryImprison(BattleSystem *bsys, BattleContext *ctx) {
return FALSE;
}
#else
asm BOOL BtlCmd_TryImprison(BattleSystem *bsys, BattleContext *ctx) {
push {r3, r4, r5, r6, r7, lr}
sub sp, #0x18
add r7, r1, #0
str r0, [sp]
add r0, r7, #0
mov r1, #1
bl BattleScriptIncrementPointer
add r0, r7, #0
bl BattleScriptReadWord
str r0, [sp, #0x14]
ldr r0, [sp]
ldr r1, [r7, #0x64]
mov r2, #0
bl ov12_0223ABB8
add r4, r0, #0
ldr r0, [sp]
ldr r1, [r7, #0x64]
mov r2, #2
bl ov12_0223ABB8
mov r6, #0xb7
add r3, r0, #0
lsl r6, r6, #6
add r1, r4, #0
mov r0, #0xc0
mov r4, #1
add r2, r7, r6
mul r1, r0
ldr r5, [r2, r1]
lsl r4, r4, #0x1e
orr r5, r4
str r5, [r2, r1]
add r1, r3, #0
mul r1, r0
ldr r3, [r2, r1]
orr r3, r4
str r3, [r2, r1]
ldr r1, [r7, #0x64]
mul r0, r1
add r0, r7, r0
ldr r2, [r0, r6]
lsr r0, r4, #0x11
tst r0, r2
beq _02243098
ldr r1, [sp, #0x14]
add r0, r7, #0
bl BattleScriptIncrementPointer
b _0224313C
_02243098:
ldr r0, [sp]
bl BattleSystem_GetFieldSide
str r0, [sp, #0x10]
ldr r0, [sp]
bl BattleSystem_GetMaxBattlers
str r0, [sp, #8]
mov r0, #0
str r0, [sp, #0xc]
ldr r0, [sp, #8]
cmp r0, #0
ble _02243112
str r7, [sp, #4]
_022430B4:
ldr r0, [sp]
ldr r1, [sp, #0xc]
bl BattleSystem_GetFieldSide
ldr r1, [sp, #0x10]
cmp r1, r0
beq _02243100
mov r2, #0
ldr r0, =0x2D4C
add r4, r2, #0
_022430C8:
ldr r1, [r7, #0x64]
mov r6, #0xc0
mul r6, r1
add r1, r7, r6
add r6, r1, r4
ldr r1, =0x2D4C
ldr r5, [sp, #4]
ldrh r6, [r6, r1]
mov r3, #0
_022430DA:
ldrh r1, [r5, r0]
cmp r6, r1
bne _022430E8
cmp r6, #0
beq _022430E8
cmp r1, #0
bne _022430F0
_022430E8:
add r3, r3, #1
add r5, r5, #2
cmp r3, #4
blt _022430DA
_022430F0:
cmp r3, #4
bne _022430FC
add r2, r2, #1
add r4, r4, #2
cmp r2, #4
blt _022430C8
_022430FC:
cmp r3, #4
bne _02243112
_02243100:
ldr r0, [sp, #4]
add r0, #0xc0
str r0, [sp, #4]
ldr r0, [sp, #0xc]
add r1, r0, #1
ldr r0, [sp, #8]
str r1, [sp, #0xc]
cmp r1, r0
blt _022430B4
_02243112:
ldr r1, [sp, #0xc]
ldr r0, [sp, #8]
cmp r1, r0
bne _02243124
ldr r1, [sp, #0x14]
add r0, r7, #0
bl BattleScriptIncrementPointer
b _0224313C
_02243124:
mov r0, #0xb7
ldr r1, [r7, #0x64]
lsl r0, r0, #6
add r3, r7, r0
mov r0, #0xc0
add r2, r1, #0
mul r2, r0
mov r0, #2
ldr r1, [r3, r2]
lsl r0, r0, #0xc
orr r0, r1
str r0, [r3, r2]
_0224313C:
mov r0, #0
add sp, #0x18
pop {r3, r4, r5, r6, r7, pc}
nop
}
#endif
BOOL BtlCmd_TryGrudge(BattleSystem *bsys, BattleContext *ctx) {
int pos;