
;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ
;                        LOADER FOR PACKED FILES
;                         by  CRAZY NATION !!!!
;ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ


;------------------------
;propacker unpack routine v1.0 WILDFIRE
;------------------------
startdepack     dw      0
continuedepack  dw      0
rncfile         dw      0
unpackdestination        dw      0

rncunpack
        add    s0,a0,0
        or     s1,a1,0
        sub    sp,8
        sw     ra,0(sp)
        JAL    lab708
        NOP
        lw      ra,0(sp)
        addiu   sp,8 
        jr      ra
        nop


lab708
        sub    v1,zero,1

        ANDI   v1,v1,$00ff
        addiu  a0,a0,4
        SLL    a0,v1,$18
        SLL    a1,v1,$1f
        SRL    a3,a1,$10
        NOR    a2,R0,v1
        sub    sp,sp,$180      ;ADDI   sp,sp,$fe80
        OR     s2,sp,R0
        sub    sp,sp,8         ;ADDI   sp,sp,$fff8
        SW     ra,$0000(sp)
        ADDI   s0,s0,$0004
        JAL    laba04
        NOP

        ADDI   s3,s0,$000a
        OR     s4,s1,R0
        LBU    t6,$0001(s3)
        LBU    at,$0000(s3)
        OR     t7,R0,R0
        SLL    t6,t6,08
        OR     t6,t6,at
        ADD    s5,s4,t0
        ADDI   t0,R0,$0002
        ADDI   t1,R0,$0002
        JAL    lab994
        NOP
        LW     ra,$0000(sp)
        ADDI   sp,sp,$0008

lab774
        sub    sp,sp,8
        SW     ra,$0000(sp)
        OR     s0,s2,R0
        JAL    laba28
        NOP
        ADDI   s0,s2,$0080
        JAL    laba28
        NOP
        ADDI   s0,s2,$0100
        JAL    laba28
        NOP
        sub    t0,R0,1
        ADDI   t1,R0,$0010
        JAL    lab994
        NOP
        LW     ra,$0000(sp)
        ADDI   sp,sp,$0008
        OR     t4,t0,R0
        sub    at,R0,1
        SRL    at,at,$10
        sub    t4,t4,1
        AND    t4,at,t4
        J      lab834
        NOP

lab7d4
        ADDI   s0,s2,$0080
        sub    sp,sp,8
        SW     ra,$0000(sp)
        OR     t0,R0,R0
        JAL    lab8bc
        NOP
        SUBU   t0,R0,t0
        ADD    s1,s4,t0
        sub    s1,s1,1
        ADDI   s0,s2,$0100
        JAL    lab8bc
        NOP
        LW     ra,$0000(sp)
        ADDI   sp,sp,$0008
        ADDI   s4,s4,$0001
        LBU    at,$0000(s1)
        ADDI   s1,s1,$0001
        SB     at,-1(s4)  ;??

lab81c
        ADDI   s4,s4,$0001
        LBU    at,$0000(s1)
        ADDI   s1,s1,$0001
        SB     at,-1(s4)       ;??
        BNE    t0,R0,lab81c
        subI   t0,t0,1

lab834
        sub    sp,sp,8
        SW     ra,$0000(sp)
        OR     s0,s2,R0
        JAL    lab8bc
        NOP
        LW     ra,$0000(sp)
        ADDI   sp,sp,$0008
        sub    t0,t0,1
        BLTZ   t0,lab89c
        NOP
        sub    sp,sp,8
        SW     ra,$0000(sp)
        JAL    labba8
        NOP
        LW     ra,$0000(sp)
        ADDI   sp,sp,$0008
        LBU    at,$0001(s3)
        LBU    t0,$0000(s3)
        SLL    at,at,8
        OR     t0,at,t0
        SLLV   t0,t0,t7
        ADDI   t1,R0,$0001
        SLLV   t1,t1,t7
        subu   t1,t1,1
        AND    t6,t6,t1
        OR     t6,t0,t6

lab89c
        BNE    t4,R0,lab7d4
        sub    t4,t4,1
        SUB    at,s4,s5
        BLTZ   at,lab774
        NOP
        ADDI   sp,sp,$0180
        JR     ra
        NOP

lab8bc
        LBU    t0,$0000(s0)
        LBU    at,$0001(s0)
        ADDI   s0,s0,$0002
        SLL    t0,t0,08
        OR     t0,at,t0
        AND    t0,t0,t6
        LBU    at,$0000(s0)
        LBU    v0,$0001(s0)
        ADDI   s0,s0,$0002
        SLL    at,at,08
        OR     at,at,v0
        SUB    t0,t0,at
        BNE    t0,R0,lab8bc
        NOP
        LBU    t1,$003c(s0)
        NOP
        SUB    t7,t7,t1
        BGEZ   t7,lab920
        NOP
        sub    sp,sp,8
        SW     ra,$0000(sp)
        JAL    lab9c8
        NOP
        LW     ra,$0000(sp)
        ADDI   sp,sp,$0008

lab920
        SRLV   t6,t6,t1
        LBU    t0,$003d(s0)
        NOP
        sub    at,t0,2
        BLTZ   at,lab98c
        NOP
        sub    t0,t0,1
        OR     t1,t0,R0
        OR     t2,t0,R0
        LBU    at,$003e(s0)
        LBU    t0,$003f(s0)
        SLL    at,at,8
        OR     t0,at,t0
        AND    t0,t0,t6
        SUB    t7,t7,t1
        BGEZ   t7,lab97c
        NOP
        sub    sp,sp,8
        SW     ra,$0000(sp)
        JAL    lab9c8
        NOP
        LW     ra,$0000(sp)
        ADDI   sp,sp,$0008

lab97c
        SRLV   t6,t6,t1
        ADDI   at,R0,$0001
        SLLV   at,at,t2
        OR     t0,at,t0

lab98c
        JR     ra
        NOP

lab994
        AND    t0,t6,t0
        SUB    t7,t7,t1
        BGEZ   t7,lab9bc
        NOP
        sub    sp,sp,8
        SW     ra,$0000(sp)
        JAL    lab9c8
        NOP
        LW     ra,$0000(sp)
        ADDI   sp,sp,$0008

lab9bc
        SRLV   t6,t6,t1
        JR     ra
        NOP

lab9c8
        ADD    t7,t7,t1
        SRLV   t6,t6,t7
        ADDI   s3,s3,$0004
        LBU    at,-2(s3)
        LBU    v0,-1(s3)
        sub    s3,s3,2
        SLL    at,at,$10
        SLL    v0,v0,$18
        OR     t6,t6,v0
        OR     t6,t6,at
        SUB    t1,t1,t7
        ADDI   t7,R0,$0010
        SUB    t7,t7,t1
        JR     ra
        NOP

laba04
        ADDI   t1,R0,$0003
laba08
        SLL    t0,t0,8
        LBU    at,$0000(s0)
        ADDI   s0,s0,$0001
        OR     t0,at,t0
        BNE    t1,R0,laba08
        sub    t1,1
        JR     ra
        NOP

laba28
        ADDI   t0,R0,$001f
        ADDI   t1,R0,$0005
        sub    sp,sp,8
        SW     ra,$0000(sp)
        JAL    lab994
        NOP
        LW     ra,$0000(sp)
        ADDI   sp,sp,$0008
        sub    t0,t0,1
        BLTZ   t0,labba0
        NOP
        OR     t2,t0,R0
        OR     t3,t0,R0
        sub    sp,sp,$10
        OR     s1,sp,R0

laba64
        ADDI   t0,R0,$000f
        ADDI   t1,R0,$0004
        sub    sp,sp,8
        SW     ra,$0000(sp)
        JAL    lab994
        NOP
        LW     ra,$0000(sp)
        ADDI   sp,sp,$0008
        SB     t0,$0000(s1)
        ADDI   s1,s1,$0001
        BNE    t2,R0,laba64
        sub    t2,t2,1
        OR     t0,a1,R0
        ADDI   t1,R0,$0001
        OR     t2,R0,R0
        sub    sp,sp,$10
        SW     t5,$0000(sp)
        SW     t6,$0004(sp)
        SW     t7,$0008(sp)

labab0
        OR     t4,t3,R0
        ADDI   s1,sp,$0010

labab8
        LBU    at,$0000(s1)
        ADDI   s1,s1,$0001
        BNE    t1,at,labb74
        NOP
        ADDI   t5,R0,$0001
        SLLV   t5,t5,t1
        sub    t5,t5,1
        SB     t5,$0001(s0)
        SRL    at,t5,8
        SB     at,$0000(s0)
        ADDI   s0,s0,$0002
        OR     t5,t2,R0
        SLL    at,t5,$10
        SRL    t5,t5,$10
        OR     t5,t5,at
        OR     t7,t1,R0
        sub    t7,t7,1

labafc
        sub    at,R0,1
        SRL    at,at,$10
        AND    t6,at,t6
        AND    at,t5,a3
        SLL    t5,t5,01
        SRL    t6,t6,01
        BEQ    at,R0,labb20
        NOP
        OR     t6,t6,a3

labb20
        BNE    t7,R0,labafc
        sub    t7,t7,1
        ADDI   t5,R0,$0010
        SUB    t5,t5,t1
        SRLV   t6,t6,t5
        SB     t6,$0001(s0)
        SRL    at,t6,8
        SB     at,$0000(s0)
        ADDI   s0,s0,$0002
        SB     t1,$003c(s0)
        OR     t5,t3,R0
        SUBU   t5,t5,t4
        SB     t5,$003d(s0)
        ADDI   t6,R0,$0001
        subu   t5,t5,1
        SLLV   t6,t6,t5
        subu   t6,t6,1
        SB     t6,$003f(s0)
        SRL    at,t6,8
        SB     at,$003e(s0)
        ADDU   t2,t2,t0

labb74
        BNE    t4,R0,labab8
        sub    t4,t4,1
        SRL    t0,t0,1
        ADDI   t1,t1,$0001
        ADDI   at,R0,$0011
        BNE    t1,at,labab0
        LW     t5,$0000(sp)
        LW     t6,$0004(sp)
        LW     t7,$0008(sp)
        ADDI   sp,sp,$0010
        ADDI   sp,sp,$0010

labba0
        JR     ra
        NOP

labba8
        LBU    at,$0000(s3)
        NOP
        SB     at,$0000(s4)
        ADDI   s4,s4,$0001
        ADDI   s3,s3,$0001
        BNE    t0,R0,labba8
        sub    t0,t0,1
        JR     ra
        NOP


