Add RNC compression and make cpp preprocess asm

This commit is contained in:
CrashOveride95 committed 2021-01-25 22:21:15 -05:00
1 parent d0e19eaf23
commit 90371f0a8d
15 files changed
+3122 -113

No files matched your search

+13 -30
View File
@@ -58,10 +58,14 @@ else ifeq ($(SAVETYPE),sram)
endif
COMPRESS ?= yay0
$(eval $(call validate-option,COMPRESS,yay0 gzip))
$(eval $(call validate-option,COMPRESS,yay0 gzip rnc1 rnc2))
ifeq ($(COMPRESS),gzip)
DEFINES += GZIP=1
SRC_DIRS += src/gzip
else ifeq ($(COMPRESS),rnc1)
DEFINES += RNC1=1
else ifeq ($(COMPRESS),rnc2)
DEFINES += RNC2=1
else ifeq ($(COMPRESS),yay0)
DEFINES += YAY0=1
endif
@@ -427,6 +431,7 @@ export LANG := C
# N64 tools
YAY0TOOL := $(TOOLS_DIR)/slienc
RNCPACK := $(TOOLS_DIR)/rncpack
ROMALIGN := $(TOOLS_DIR)/romalign
BFSIZE := $(TOOLS_DIR)/bfsize
FILESIZER := $(TOOLS_DIR)/filesizer
@@ -607,35 +612,13 @@ $(BUILD_DIR)/levels/%/leveldata.bin: $(BUILD_DIR)/levels/%/leveldata.elf
$(V)$(EXTRACT_DATA_FOR_MIO) $< $@
ifeq ($(COMPRESS),gzip)
# Compress binary file to gzip
$(BUILD_DIR)/%.gz: $(BUILD_DIR)/%.bin
$(call print,Compressing:,$<,$@)
ifeq ($(GZIPVER),std)
$(V)$(GZIP) -c -9 -n $< > $@
include gziprules.mk
else ifeq ($(COMPRESS),rnc1)
include rnc1rules.mk
else ifeq ($(COMPRESS),rnc2)
include rnc2rules.mk
else
$(V)$(GZIP) -c -12 -n $< > $@
endif
# Strip gzip header
$(BUILD_DIR)/%.szp: $(BUILD_DIR)/%.gz
$(call print,Converting:,$<,$@)
$(V)dd bs=10 skip=1 if=$< of=$@
$(V)$(FILESIZER) $(<:.gz=.bin) $@
# convert binary szp to object file
$(BUILD_DIR)/%.szp.o: $(BUILD_DIR)/%.szp
$(call print,Converting GZIP to ELF:,$<,$@)
$(V)printf ".section .data\n\n.incbin \"$<\"\n" | $(AS) $(ASFLAGS) -o $@
else
# Compress binary file
$(BUILD_DIR)/%.szp: $(BUILD_DIR)/%.bin
$(call print,Compressing:,$<,$@)
$(V)$(YAY0TOOL) $< $@
# convert binary szp to object file
$(BUILD_DIR)/%.szp.o: $(BUILD_DIR)/%.szp
$(call print,Converting YAY0 to ELF:,$<,$@)
$(V)printf ".section .data\n\n.incbin \"$<\"\n" | $(AS) $(ASFLAGS) -o $@
include yay0rules.mk
endif
#==============================================================================#
@@ -807,7 +790,7 @@ endif
# Assemble assembly code
$(BUILD_DIR)/%.o: %.s
$(call print,Assembling:,$<,$@)
$(V)$(AS) $(ASFLAGS) -MD $(BUILD_DIR)/$*.d -o $@ $<
$(V)$(CPP) $(CPPFLAGS) $< | $(AS) $(ASFLAGS) -MD $(BUILD_DIR)/$*.d -o $@
# Assemble RSP assembly code
$(BUILD_DIR)/rsp/%.bin $(BUILD_DIR)/rsp/%_data.bin: rsp/%.s
+9 -3
View File
@@ -23,7 +23,7 @@ I may attempt FlashRAM in the future.
The repository supports targeting the iQue Player in addition to the N64. The iQue libultra is ***NOT*** compatible with N64 in many ways, so it is currently NOT possible to have one build for both consoles.
To target iQue, run make with the ``CONSOLE=BB`` argument.
To target iQue, run make with the ``CONSOLE=bb`` argument.
## Compression
@@ -33,13 +33,19 @@ On average I'd estimate that the bottleneck on decompression is about 1-2 second
To switch to gzip, run make with the ``COMPRESS=gzip`` argument.
Additionally, the repo also supports compressing with ``libdeflate-gzip``. This compresses at a slightly better ratio than standard ``gzip``, with no real downside from a decompression standpoint.
The repo also supports gziping with ``libdeflate-gzip``. This compresses at a slightly better ratio than standard ``gzip``, with no real downside from a decompression standpoint.
To use ``libdeflate-gzip``, first clone the [repo](https://github.com/ebiggers/libdeflate), then make and make install it.
Then run make for sm64 with ``GZIPVER=libdef`` in addition to ``COMPRESS=gzip``
This argument makes the makefile use ``libdeflate`` with it's highest compression setting, ``-12``.
The repo also supports RNC (Rob Northen Compression). RNC has two methods.
Method 1 is designed to compress as small as possible, while method 2 is designed so that decompression is as fast as possible.
Both methods are fast. Method 1 has better compression than 2, so I suggest using method 1 if using RNC.
To switch to RNC, run make with either ``COMPRESS=rnc1`` or ``COMPRESS=rnc2``, depending on preferred method.
## FAQ
Executable
+507
View File
@@ -0,0 +1,507 @@
/*------------------------------------------------------------------------------
* PROPACK Unpack Source Code - Sony PSX, Method 1
*
* Copyright (c) 1991-96 Rob Northen Computing, U.K. All Rights Reserved.
*
* Conversion from 68000 by Brian Watson, Iguana Entertainment Limited.
* Converted to compile with SGI 'as' 10/31/96 by Biscuit
*
* File: rnc1.s
*
* Date: 10.21.96
*------------------------------------------------------------------------------
*/
/*------------------------------------------------------------------------------
* Equates
*------------------------------------------------------------------------------
*/
#define HEADER_LEN 18
#define crc_poly 0xa001
#define RAW_TABLE 0
#define POS_TABLE (RAW_TABLE+16*8)
#define LEN_TABLE (POS_TABLE+16*8)
#define BUFSIZE (16*8*3)
#define ra $31 /* ra */
#define d0 $8 /* t0 */
#define d1 $9 /* t1 */
#define d2 $10 /* t2 */
#define d3 $11 /* t3 */
#define d4 $12 /* t4 */
#define d5 $13 /* t5 */
#define d6 $14 /* t6 */
#define d7 $15 /* t7 */
#define xa0 $16 /* s0 */
#define xa1 $17 /* s1 */
#define xa2 $18 /* s2 */
#define xa3 $19 /* s3 */
#define xa4 $20 /* s4 */
#define xa5 $21 /* s5 */
#define xa6 $22 /* s6 */
#define xa7 $23 /* s7 */
#define TEMP $2 /* v1 */
#define input xa3 /* s3 */
#define output xa4 /* s4 */
#define output_hi xa5 /* s5 */
#define counts d4 /* t4 */
#define bit_buffer d6 /* t6 */
#define bit_count d7 /* t7 */
#define zero $0 /* zero */
#define tmp $1 /* at */
#define tmp2 $2 /* v0 */
#define const_ff $3 /* v1 */
#define const_ff000000 $4 /* a0 */
#define const_80000000 $5 /* a1 */
#define const_ffffff00 $6 /* a2 */
#define const_8000 $7 /* a3 */
#define a0 $4
#define a1 $5
/*------------------------------------------------------------------------------
* Macros
*------------------------------------------------------------------------------
*/
#define pop(reg) lw reg,0($sp) ; add $sp,$sp,8
#define dbra reg,dest bne reg,zero,dest ; sub reg,reg,1
/*------------------------------------------------------------------------------
* PROPACK Unpack Routine (Compact Version) - MC68000, Method 1
*
* on entry,
* a0.l = start address of packed file
* a1.l = start address to unpack file
* (note: a1 cannot be equal to a0)
* stack space required: $1DC bytes
*
* all other registers are preserved
* Note:
* lines with a comment beginning with '*' are delay slot instructions
* beware the delay slot, it can really screw you up!
*------------------------------------------------------------------------------
*/
.text
.set noreorder
.option pic0
.set noat
.globl Propack_UnpackM1
.ent Propack_UnpackM1 2
Propack_UnpackM1:
.frame $sp, 0, $31
/*
Save any registers required here
*/
sub $sp, $sp, 88
sw $4, 0($sp)
sw $5, 4($sp)
sw $6, 8($sp)
sw $7, 12($sp)
sw $8, 16($sp)
sw $9, 20($sp)
sw $10,24($sp)
sw $11,28($sp)
sw $12,32($sp)
sw $13,36($sp)
sw $14,40($sp)
sw $15,44($sp)
sw $16,48($sp)
sw $17,52($sp)
sw $18,56($sp)
sw $19,60($sp)
sw $20,64($sp)
sw $21,68($sp)
sw $22,72($sp)
sw $23,76($sp)
sw $31,80($sp)
/* Set up entry parameters, the RNC code always uses a0, a1 for */
/* the I/O datastream and we must use R3K registers A0,A1 */
move xa0,a0 /* move input,a0 */
move xa1,a1 /* move output,a1 */
jal pp_Unpack /* bsr pp_Unpack */
nop
/*
Restore previously saved registers here
*/
lw $4, 0($sp)
lw $5, 4($sp)
lw $6, 8($sp)
lw $7, 12($sp)
lw $8, 16($sp)
lw $9, 20($sp)
lw $10,24($sp)
lw $11,28($sp)
lw $12,32($sp)
lw $13,36($sp)
lw $14,40($sp)
lw $15,44($sp)
lw $16,48($sp)
lw $17,52($sp)
lw $18,56($sp)
lw $19,60($sp)
lw $20,64($sp)
lw $21,68($sp)
lw $22,72($sp)
lw $23,76($sp)
lw $31,80($sp)
add $sp, $sp, 88
j ra /* rts */
nop
pp_Unpack:
sub const_ff,zero,1 /* Set up constant 0xff */
and const_ff,const_ff,0x00ff
sll const_ff000000,const_ff,24 /* Set up constant 0xff000000 */
sll const_80000000,const_ff,31 /* Set up constant 0x80000000 */
srl const_8000,const_80000000,16 /* Set up constant 0x8000 */
nor const_ffffff00,zero,const_ff /* Set up constant 0xffffff00 */
sub $sp,$sp,BUFSIZE /* sub.w #bufsize,sp */
move xa2,$sp /* move.w sp,a2 */
sub $sp,$sp,8 /* Preserve link address for return*/
sw ra,($sp)
add xa0,xa0,4 /* addq #4,a0 (skip past comp'd length) */
jal read_long /* bsr read_long (get uncomp'd length) */
nop
add input,xa0,HEADER_LEN-8 /* lea HEADER_LEN-8(a0),input (skip past rest of header) */
move output,xa1 /* move.l a1,output */
lbu bit_buffer,1(input) /* move.b 1(input),bit_buffer */
lbu tmp,0(input) /* move.b 0(input),bit_buffer (after bit_buffer is rotated) */
move bit_count,zero /* moveq.l #0,bit_count */
sll bit_buffer,bit_buffer,8 /* " " rotate high byte into position */
or bit_buffer,bit_buffer,tmp /* " " and or it in to the bit_buffer */
add output_hi,output,d0 /* lea (output,d0.l),output_hi */
add d0,zero,2 /* moveq.l #2,d0 */
add d1,zero,2 /* moveq.l #2,d1 */
jal input_bits /* bsr input_bits */
nop
lw ra,($sp) /* Restore from linked jumps */
add $sp,$sp,8
unpack2:
sub $sp,$sp,8 /* Preserve link address for return*/
sw ra,($sp)
/* */
/* Fill the hufftables with a set value so we can see if they work */
/* */
move xa0,xa2 /* move.l a2,a0 */
jal make_huftable /* bsr make_huftable */
nop
add xa0,xa2,POS_TABLE /* lea POS_TABLE(a2),a0 */
jal make_huftable /* bsr make_huftable */
nop
add xa0,xa2,LEN_TABLE /* lea LEN_TABLE(a2),a0 */
jal make_huftable /* bsr make_huftable */
nop
add d0,zero,-1 /* moveq.l #-1,d0 */
add d1,zero,16 /* moveq.l #16,d1 */
jal input_bits /* bsr input_bits */
nop
lw ra,($sp) /* Restore from linked jumps */
add $sp,$sp,8
move counts,d0 /* move.w d0,counts */
sub tmp,zero,1
srl tmp,tmp,16
sub counts,counts,1 /* subq.w #1,counts */
and counts,tmp,counts
j unpack5 /* bra.s unpack5 */
nop
unpack3:
add xa0,xa2,POS_TABLE /* lea POS_TABLE(a2),a0 */
sub $sp,$sp,8 /* Preserve link address for return*/
sw ra,($sp)
move d0,zero /* moveq.l #0,d0 */
jal input_value /* bsr.s input_value */
nop
subu d0,zero,d0 /* neg.l d0 */
add xa1,output,d0 /* lea -1(output,d0.l),a1 */
add xa1,xa1,-1 /* " " */
add xa0,xa2,LEN_TABLE /* lea LEN_TABLE(a2),a0 */
jal input_value /* bsr.s input_value */
nop
lw ra,($sp) /* Restore from linked jumps */
add $sp,$sp,8
add output,output,1 /* move.b (a1)+,(output)+ */
lbu tmp,(xa1) /* " " */
add xa1,xa1,1 /* " " */
sb tmp,-1(output) /* " " */
unpack4:
add output,output,1 /* move.b (a1)+,(output)+ */
lbu tmp,(xa1) /* " " */
add xa1,xa1,1 /* " " */
sb tmp,-1(output) /* " " */
bne d0,zero,unpack4 /* dbra d0,unpack4 */
sub d0,d0,1
unpack5:
sub $sp,$sp,8 /* Preserve link address for return*/
sw ra,($sp)
move xa0,xa2 /* move.l a2,a0 */
jal input_value /* bsr.s input_value */
nop
lw ra,($sp) /* Restore from linked jumps */
add $sp,$sp,8
sub d0,d0,1 /* subq.w #1,d0 */
bltz d0,unpack6 /* bmi.s unpack6 */
nop
sub $sp,$sp,8 /* Preserve link address for return*/
sw ra,($sp)
jal getrawREP /* getrawREP */
nop /* */
lw ra,($sp) /* Restore from linked jumps */
add $sp,$sp,8
lbu tmp,1(input) /* move.b 1(input),d0 */
lbu d0,0(input) /* move.b (input),d0 */
sll tmp,tmp,8 /* rol.w #8,d0 */
or d0,tmp,d0 /* " " */
sll d0,d0,bit_count /* lsl.l bit_count,d0 */
add d1,zero,1 /* moveq.l #1,d1 */
sll d1,d1,bit_count /* lsl.w bit_count,d1 */
subu d1,d1,1 /* subq.w #1,d1 */
and bit_buffer,bit_buffer,d1 /* and.l d1,bit_buffer */
or bit_buffer,d0,bit_buffer /* or.l d0,bit_buffer */
unpack6:
bne counts,zero,unpack3 /* dbra counts,unpack3 */
sub counts,counts,1
sub tmp,output,output_hi /* cmp.l output_hi,output */
bltz tmp,unpack2 /* bcs.s unpack2 */
nop /* " " */
add $sp, $sp, BUFSIZE /* lea BUFSIZE(sp),sp */
jr ra /* rts */
nop
input_value:
lbu d0,0(xa0) /* move.w (a0)+,d0 */
lbu tmp,1(xa0) /* " " */
add xa0,xa0,2 /* " " */
sll d0,d0,8 /* " " */
or d0,tmp,d0 /* " " */
and d0,d0,bit_buffer /* and.w bit_buffer,d0 */
lbu tmp,0(xa0) /* sub.w (a0)+,d0 */
lbu tmp2,1(xa0) /* " " */
add xa0,xa0,2 /* " " */
sll tmp,tmp,8 /* " " */
or tmp,tmp,tmp2 /* " " */
sub d0,d0,tmp /* " " */
bne d0,zero,input_value /* bne.s input_value */
nop
lbu d1,16*4-4(xa0) /* move.b 16*4-4(a0),d1 */
nop
sub bit_count,bit_count,d1 /* sub.b d1,bit_count */
bgez bit_count,input_value2 /* bge.s input_value2 */
nop /*(Delay Slot) */
sub $sp,$sp,8 /* Preserve link address for return*/
sw ra,($sp)
jal input_bits3 /* bsr.s input_bits3 */
nop /* * */
lw ra,($sp) /* Restore from linked jumps */
add $sp,$sp,8
input_value2:
srl bit_buffer,bit_buffer,d1 /* lsr.l d1,bit_buffer */
lbu d0,16*4-3(xa0) /* move.b 16*4-3(a0),d0 */
nop
sub tmp,d0,2 /* cmp.b #2,d0 */
bltz tmp,input_value4 /* blt.s input_value4 */
nop
sub d0,d0,1 /* subq.b #1,d0 */
move d1,d0 /* move.b d0,d1 */
move d2,d0 /* move.b d0,d2 */
lbu tmp,16*4-2(xa0) /* move.w 16*4-2(a0),d0 */
lbu d0,16*4-2+1(xa0) /* " " */
sll tmp,tmp,8
or d0,tmp,d0
and d0,d0,bit_buffer /* and.w bit_buffer,d0 */
sub bit_count,bit_count,d1 /* sub.b d1,bit_count */
bgez bit_count,input_value3 /* bge.s input_value3 */
nop
sub $sp,$sp,8 /* Preserve link address for return*/
sw ra,($sp)
jal input_bits3 /* bsr.s input_bits3 */
nop /* */
lw ra,($sp) /* Restore from linked jumps */
add $sp,$sp,8
input_value3:
srl bit_buffer,bit_buffer,d1 /* lsr.l d1,bit_buffer */
add tmp,zero,1
sll tmp,tmp,d2 /* bset d2,d0 */
or d0,tmp,d0 /* " " */
input_value4:
jr ra
nop /*(Delay Slot) */
/*------------------------------------------------------------------------------
/ input_bits - Entry:
// D0 - Mask to and output data with
// D1 - Number of bits to fetch
// Exit:
// D0 - Value read from buffer
//------------------------------------------------------------------------------
*/
input_bits:
and d0,bit_buffer,d0 /* and.w bit_buffer,d0 */
sub bit_count,bit_count,d1 /* sub.b d1,bit_count */
bgez bit_count,input_bits2 /* bge.s input_bits2 */
nop
sub $sp,$sp,8 /* Preserve link address for return*/
sw ra,($sp)
jal input_bits3 /* bsr.s input_bits3 */
nop
lw ra,($sp) /* Restore from linked jumps */
add $sp,$sp,8
input_bits2:
srl bit_buffer,bit_buffer,d1 /*(Delay Slot)lsr.l d1,bit_buffer */
jr ra /* return */
nop
input_bits3:
add bit_count,bit_count,d1 /* Make sure we have correct # of bits left in buffer */
srl bit_buffer,bit_buffer,bit_count /* lsr.l bit_count,bit_buffer */
add input,input,4 /* jump passed our data for some odd reason */
lbu tmp,-2(input) /* Get our new word to add into bit buffer */
lbu tmp2,-1(input) /* byte at a time..... */
sub input,input,2
sll tmp,tmp,16 /* shift this into the right place */
sll tmp2,tmp2,24
or bit_buffer,bit_buffer,tmp2 /* OR in the 2 new bytes read to the bit buffer */
or bit_buffer,bit_buffer,tmp
sub d1,d1,bit_count /* sub.b bit_count,d1 */
add bit_count,zero,16 /* moveq.l #16,bit_count */
sub bit_count,bit_count,d1 /* sub.b d1,bit_count */
jr ra /* rts */
nop
read_long:
add d1,zero,3 /* moveq.l #3,d1 */
read_long2:
sll d0,d0,8 /* lsl.l #8,d0 */
lbu tmp,0(xa0) /* move.b (a0)+,d0 */
add xa0,xa0,1 /* " " */
or d0,tmp,d0 /* " " */
bne d1,zero,read_long2 /* dbra d1,read_long2 */
sub d1,d1,1
jr ra
nop /*(Delay Slot) */
/*------------------------------------------------------------------------------
// Make_HufTable - Builds huffman decode table
//------------------------------------------------------------------------------
*/
make_huftable:
add d0,zero,0x1f /* moveq.l #$1f,d0 */
add d1,zero,0x5 /* moveq.l #5,d1 */
sub $sp,$sp,8 /* Preserve link address for return*/
sw ra,($sp)
jal input_bits /* bsr.s input_bits */
nop /*(Delay Slot) */
lw ra,($sp) /* Restore from linked jumps */
add $sp,$sp,8
sub d0,d0,1 /* subq.w #1,d0 */
bltz d0,make_huftable8 /* bmi.s make_huftable8 */
nop
move d2,d0 /* move.w d0,d2 */
move d3,d0 /* move.w d0,d3 */
sub $sp,$sp,16 /* lea -16(sp),sp */
move xa1,$sp /* move.l sp,a1 */
make_huftable3:
add d0,zero,15 /* moveq.l #$f,d0 */
add d1,zero,4 /* moveq.l #4,d1 */
sub $sp,$sp,8 /* Preserve link address for return*/
sw ra,($sp)
jal input_bits /* bsr.s input_bits */
nop /*(Delay Slot) */
lw ra,($sp) /* Restore from linked jumps */
add $sp,$sp,8
sb d0,(xa1) /* move.b d0,(a1)+ */
add xa1,xa1,1 /* " " */
bne d2,zero,make_huftable3 /* dbra d2,make_huftable3 */
sub d2,d2,1
move d0,const_80000000 /* moveq.l #1,d0 (with shift == 0x8000000) */
add d1,zero,1 /* moveq.l #1,d1 */
move d2,zero /* moveq.l #0,d2 */
sub $sp,$sp,16 /* movem.l d5-d7,-(sp) */
sw d5,0($sp) /* " " */
sw d6,4($sp) /* " " */
sw d7,8($sp) /* " " */
make_huftable4:
move d4,d3 /* move.w d3,d4 */
add xa1,$sp,16 /* lea 12(sp),a1 */
make_huftable5:
lbu tmp,0(xa1) /* cmp.b (a1)+,d1 */
add xa1,xa1,1 /* " " */
bne d1,tmp,make_huftable7 /* bne.s make_huftable7 */
nop /*(Delay Slot) */
add d5,zero,1 /* moveq.l #1,d5 */
sll d5,d5,d1 /* lsl.w d1,d5 */
sub d5,d5,1 /* subq.w #1,d5 */
sb d5,1(xa0) /* move.w d5,(a0)+ */
srl tmp,d5,8 /* " " */
sb tmp,(xa0) /* " " */
add xa0,xa0,2 /* " " */
move d5,d2 /* move.l d2,d5 */
sll tmp,d5,16 /* swap d5 */
srl d5,d5,16 /* " " */
or d5,d5,tmp /* " " */
move d7,d1 /* move.w d1,d7 */
sub d7,d7,1 /* subq.w #1,d7 */
make_huftable6:
sub tmp,zero,1
srl tmp,tmp,16
and d6,tmp,d6
and tmp,d5,const_8000 /* roxl.w #1,d5 */
sll d5,d5,1 /* " " */
srl d6,d6,1 /* " " */
beq tmp,zero,make_ht6_1 /* roxr.w #1,d6 */
nop
or d6,d6,const_8000 /* " " */
make_ht6_1: bne d7,zero,make_huftable6 /* dbra d7,make_huftable6 */
sub d7,d7,1
add d5,zero,16 /* moveq.l #16,d5 */
sub d5,d5,d1 /* sub.b d1,d5 */
srl d6,d6,d5 /* lsr.w d5,d6 */
sb d6,1(xa0) /* move.w d6,(a0)+ */
srl tmp,d6,8 /* " " */
sb tmp,0(xa0) /* " " */
add xa0,xa0,2 /* " " */
sb d1,16*4-4(xa0) /* move.b d1,16*4-4(a0) */
move d5,d3 /* move.b d3,d5 */
subu d5,d5,d4 /* sub.b d4,d5 */
sb d5,16*4-3(xa0) /* move.b d5,16*4-3(a0) */
add d6,zero,1 /* moveq.l #1,d6 */
subu d5,d5,1 /* subq.b #1,d5 */
sll d6,d6,d5 /* lsl.w d5,d6 */
subu d6,d6,1 /* subq.w #1,d6 */
sb d6,16*4-2+1(xa0)
srl tmp,d6,8
sb tmp,16*4-2(xa0) /* move.w d6,16*4-2(a0) */
addu d2,d2,d0 /* add.l d0,d2 */
make_huftable7:
bne d4,zero,make_huftable5 /* dbra d4,make_huftable5 */
sub d4,d4,1
srl d0,d0,1 /* lsr.l #1,d0 */
add d1,d1,1 /* addq.b #1,d1 */
add tmp,zero,17 /* cmp.b #17,d1 */
bne d1,tmp,make_huftable4 /* bne.s make_huftable4 */
lw d5,0($sp) /* movem.l (sp)+,d5-d7 */
lw d6,4($sp) /* " " */
lw d7,8($sp) /* " " */
add $sp,$sp,16 /* " " */
add $sp,$sp,16 /* lea 16(sp),sp */
make_huftable8:
jr ra
nop /*(Delay Slot) */
getrawREP:
lbu tmp,0(input)
nop
sb tmp,0(output)
add output,output,1
add input,input,1
bne d0,zero,getrawREP /* dbra d0,getrawREP */
sub d0,d0,1
jr ra
nop /*(Delay Slot) */
.end
Executable
+673
View File
@@ -0,0 +1,673 @@
/*------------------------------------------------------------------------------
* PROPACK Unpack Source Code - Sony PSX, Method 2
*
* Copyright (c) 1991-95 Rob Northen Computing, U.K. All Rights Reserved.
*
* Conversion from 68000 by Chris Kirby, Iguana Entertainment Limited.
* Converted to compile with SGI as, 9/13/96 Biscuit
* Beware the commentless void.........
*
* File: rnc2.s
*
* Date: 16.03.95
*------------------------------------------------------------------------------*/
#define header_len 18
#define crc_poly 0xa001
#define r0 $0
#define r4 $4
#define r5 $5
#define input $3
#define input_hi $4
#define output $5
#define output_hi $6
#define len $8
#define pos $9
#define bitbuf $10
#define xsp $11
#define temp $12
#define xd0 $13
#define xa0 $14
#define ext $15
#define xd1 $16
#define xa1 $17
#define temp2 $18
#define postop $19
#define ra $31
#define retval $2
.text
.set noreorder
.option pic0
.globl Propack_UnpackM2
.ent Propack_UnpackM2 2
Propack_UnpackM2:
.frame $sp, 0, $31
sub $sp, $sp, 72
sw $4, 0($sp)
sw $5, 4($sp)
sw $6, 8($sp)
sw $7, 12($sp)
sw $8, 16($sp)
sw $9, 20($sp)
sw $10, 24($sp)
sw $11, 28($sp)
sw $12, 32($sp)
sw $13, 36($sp)
sw $14, 40($sp)
sw $15, 44($sp)
sw $16, 48($sp)
sw $17, 52($sp)
sw $18, 56($sp)
sw $19, 60($sp)
sw $31, 64($sp)
la temp, __PPUnpack
nop
jalr temp
nop
lw $4, 0($sp)
lw $5, 4($sp)
lw $6, 8($sp)
lw $7, 12($sp)
lw $8, 16($sp)
lw $9, 20($sp)
lw $10, 24($sp)
lw $11, 28($sp)
lw $12, 32($sp)
lw $13, 36($sp)
lw $14, 40($sp)
lw $15, 44($sp)
lw $16, 48($sp)
lw $17, 52($sp)
lw $18, 56($sp)
lw $19, 60($sp)
lw $31, 64($sp)
add $sp, $sp, 72
jr ra
__PPUnpack:
/* addi r4,r4,9 - what the hell was this for?*/
move xa0,r4 /* source */
move xa1,r5 /* dest */
li xd0,0
la xsp,mystack
#if 0
lbu temp,0(xa0)
nop
seq xa0,temp, "R"
beq xa0,0, RNC_Error
lbu temp,1(xa0)
nop
seq xa0,temp, "N"
beq xa0,0, RNC_Error
lbu temp,2(xa0)
nop
seq xa0,temp, "C"
beq xa0,0, RNC_Error
lbu temp,3(xa0)
nop
seq xa0, temp, 2
beq xa0, 0, RNC_BadFormat
#endif
addiu xa0,xa0,4
lbu xd0,0(xa0)
lbu temp,1(xa0)
lbu temp2,2(xa0)
lbu ext,3(xa0)
sll xd0,xd0,24
sll temp,temp,16
sll temp2,temp2,8
or xd0,xd0,temp
or xd0,xd0,temp2
or xd0,xd0,ext
addiu xa0,xa0,4
sw xd0,0(xsp)
move input,xa0
addi input,input,header_len-8
move output,xa1
move output_hi,output
addu output_hi,output_hi,xd0
lbu xd0,0(xa0)
lbu temp,1(xa0)
lbu temp2,2(xa0)
lbu ext,3(xa0)
sll xd0,xd0,24
sll temp,temp,16
sll temp2,temp2,8
or xd0,xd0,temp
or xd0,xd0,temp2
or xd0,xd0,ext
addu xa0,xa0,4
move input_hi,input
add input_hi,input_hi,xd0
sub xsp,xsp,2
sh r0,0(xsp)
unpack7:
lui bitbuf,0xffff
ori bitbuf,0xff00
li ext,1
lbu bitbuf,0(input)
addi input,input,1
addu bitbuf,bitbuf,bitbuf
addu bitbuf,bitbuf,ext
addu bitbuf,bitbuf,bitbuf
srl ext,bitbuf,8
j xloop
andi ext,ext,1
RNC_Error:
li retval, -1 /* Error Bad Header */
j ra
nop
RNC_BadFormat:
li retval, -2 /* Error Unknown format */
j ra
nop
fetch0:
lbu bitbuf,0(input)
addi input,input,1
addu bitbuf,bitbuf,bitbuf
addu bitbuf,bitbuf,ext
srl ext,bitbuf,8
j back0
andi ext,ext,1
fetch1:
lbu bitbuf,0(input)
addi input,input,1
addu bitbuf,bitbuf,bitbuf
addu bitbuf,bitbuf,ext
srl ext,bitbuf,8
j back1
andi ext,ext,1
fetch2:
lbu bitbuf,0(input)
addi input,input,1
addu bitbuf,bitbuf,bitbuf
addu bitbuf,bitbuf,ext
srl ext,bitbuf,8
j back2
andi ext,ext,1
fetch3:
lbu bitbuf,0(input)
addi input,input,1
addu bitbuf,bitbuf,bitbuf
addu bitbuf,bitbuf,ext
srl ext,bitbuf,8
j back3
andi ext,ext,1
fetch4:
lbu bitbuf,0(input)
addi input,input,1
addu bitbuf,bitbuf,bitbuf
addu bitbuf,bitbuf,ext
srl ext,bitbuf,8
j back4
andi ext,ext,1
fetch5:
lbu bitbuf,0(input)
addi input,input,1
addu bitbuf,bitbuf,bitbuf
addu bitbuf,bitbuf,ext
srl ext,bitbuf,8
j back5
andi ext,ext,1
fetch6:
lbu bitbuf,0(input)
addi input,input,1
addu bitbuf,bitbuf,bitbuf
addu bitbuf,bitbuf,ext
srl ext,bitbuf,8
j back6
andi ext,ext,1
fetch7:
lbu bitbuf,0(input)
addi input,input,1
addu bitbuf,bitbuf,bitbuf
addu bitbuf,bitbuf,ext
srl ext,bitbuf,8
j back7
andi ext,ext,1
raw:
li len,3
x4bits:
addu bitbuf,bitbuf,bitbuf
srl ext,bitbuf,8
andi ext,ext,1
andi bitbuf,bitbuf,0xff
beq r0,bitbuf,fetch0
nop
back0:
addu pos,pos,pos
addu pos,pos,ext
srl ext,pos,16
andi ext,ext,1
sub len,len,1
bgez len,x4bits
nop
addi pos,pos,2
getrawrep2:
lbu temp,0(input)
lbu temp2,1(input)
sb temp,0(output)
sb temp2,1(output)
lbu temp,2(input)
lbu temp2,3(input)
sb temp,2(output)
sb temp2,3(output)
addiu input,input,4
sub pos,pos,1
bgez pos,getrawrep2
addi output,output,4
j xloop
nop
getlen:
addu bitbuf,bitbuf,bitbuf
srl ext,bitbuf,8
andi ext,ext,1
andi bitbuf,bitbuf,0xff
beq r0,bitbuf,fetch1
nop
back1:
addu len,len,len
addu len,len,ext
addu bitbuf,bitbuf,bitbuf
srl ext,bitbuf,8
andi ext,ext,1
andi bitbuf,bitbuf,0xff
beq r0,bitbuf,fetch2
nop
back2:
beq r0,ext,copy
nop
sub len,len,1
add bitbuf,bitbuf,bitbuf
srl ext,bitbuf,8
andi ext,ext,1
andi bitbuf,bitbuf,0xff
beq r0,bitbuf,fetch3
nop
back3:
addu len,len,len
addu len,len,ext
srl ext,len,16
andi ext,ext,1
sub temp,len,9
beq r0,temp,raw
nop
copy:
addu bitbuf,bitbuf,bitbuf
srl ext,bitbuf,8
andi ext,ext,1
andi bitbuf,bitbuf,0xff
beq r0,bitbuf,fetch4
nop
back4:
beq r0,ext,bytedisp2
nop
addu bitbuf,bitbuf,bitbuf
srl ext,bitbuf,8
andi ext,ext,1
andi bitbuf,bitbuf,0xff
beq r0,bitbuf,fetch5
nop
back5:
addu pos,pos,pos
addu pos,pos,ext
addu bitbuf,bitbuf,bitbuf
srl ext,bitbuf,8
andi ext,ext,1
andi bitbuf,bitbuf,0xff
beq r0,bitbuf,fetch6
nop
back6:
bne r0,ext,bigdisp
nop
bne r0,pos,bytedisp
nop
addi pos,pos,1
another:
addu bitbuf,bitbuf,bitbuf
srl ext,bitbuf,8
andi ext,ext,1
andi bitbuf,bitbuf,0xff
beq r0,bitbuf,fetch7
nop
back7:
addu pos,pos,pos
addu pos,pos,ext
srl ext,pos,16
andi ext,ext,1
bytedisp:
sll temp,pos,8
andi temp,temp,0xff00
srl pos,pos,8
or pos,pos,temp
bytedisp2:
andi postop,pos,0xff00
lbu pos,0(input)
addiu input,input,1
or pos,pos,postop
move xa0,output
sub xa0,xa0,pos
sub xa0,xa0,1
andi ext,len,1
srl len,len,1
beq r0,ext,bytedisp3
nop
lbu temp,0(xa0)
addi xa0,xa0,1
sb temp,0(output)
addi output,output,1
bytedisp3:
sub len,len,1
bne r0,pos,bytedisp5
nop
andi postop,pos,0xff00
lbu pos,0(xa0)
nop
or pos,pos,postop
bytedisp4:
sb pos,0(output)
sub len,len,1
sb pos,1(output)
bgez len,bytedisp4
addi output,output,2
j xloop
nop
bytedisp5:
lbu temp2,1(xa0)
lbu temp,0(xa0)
sb temp2,1(output)
sb temp,0(output)
addi xa0,xa0,2
sub len,len,1
bgez len,bytedisp5
addi output,output,2
j xloop
nop
getbits:
lbu bitbuf,0(input)
addi input,input,1
addu bitbuf,bitbuf,bitbuf
addu bitbuf,bitbuf,ext
srl ext,bitbuf,8
andi ext,ext,1
bne r0,ext,string
nop
xbyte:
lbu temp,0(input)
addi input,input,1
sb temp,0(output)
addi output,output,1
xloop:
addu bitbuf,bitbuf,bitbuf
srl ext,bitbuf,8
andi ext,ext,1
bne r0,ext,chkz
nop
lbu temp,0(input)
addi input,input,1
sb temp,0(output)
addi output,output,1
addu bitbuf,bitbuf,bitbuf
srl ext,bitbuf,8
andi ext,ext,1
beq r0,ext,xbyte
nop
chkz:
andi bitbuf,bitbuf,0xff
beq r0,bitbuf,getbits
nop
string:
li len,2
li pos,0
addu bitbuf,bitbuf,bitbuf
srl ext,bitbuf,8
andi ext,ext,1
andi bitbuf,bitbuf,0xff
beq r0,bitbuf,fetch8
nop
back8:
beq r0,ext,getlen
nop
smalls:
addu bitbuf,bitbuf,bitbuf
srl ext,bitbuf,8
andi ext,ext,1
andi bitbuf,bitbuf,0xff
beq r0,bitbuf,fetch9
nop
back9:
beq r0,ext,bytedisp2
nop
addi len,len,1
add bitbuf,bitbuf,bitbuf
srl ext,bitbuf,8
andi ext,ext,1
andi bitbuf,bitbuf,0xff
beq r0,bitbuf,fetch10
nop
back10:
beq r0,ext,copy
nop
lbu len,0(input)
addi input,input,1
nop
beq r0,len,overnout
addi len,len,8
j copy
nop
bigdisp:
addu bitbuf,bitbuf,bitbuf
srl ext,bitbuf,8
andi ext,ext,1
andi bitbuf,bitbuf,0xff
beq r0,bitbuf,fetch11
nop
back11:
addu pos,pos,pos
addu pos,pos,ext
srl ext,pos,16
andi ext,ext,1
ori pos,pos,4
addu bitbuf,bitbuf,bitbuf
srl ext,bitbuf,8
andi ext,ext,1
andi bitbuf,bitbuf,0xff
beq r0,bitbuf,fetch12
nop
back12:
bne r0,ext,bytedisp
nop
j another
nop
fetch8:
lbu bitbuf,0(input)
addi input,input,1
addu bitbuf,bitbuf,bitbuf
addu bitbuf,bitbuf,ext
srl ext,bitbuf,8
j back8
andi ext,ext,1
fetch9:
lbu bitbuf,0(input)
addi input,input,1
addu bitbuf,bitbuf,bitbuf
addu bitbuf,bitbuf,ext
srl ext,bitbuf,8
j back9
andi ext,ext,1
fetch10:
lbu bitbuf,0(input)
addi input,input,1
addu bitbuf,bitbuf,bitbuf
addu bitbuf,bitbuf,ext
srl ext,bitbuf,8
j back10
andi ext,ext,1
fetch11:
lbu bitbuf,0(input)
addi input,input,1
addu bitbuf,bitbuf,bitbuf
addu bitbuf,bitbuf,ext
srl ext,bitbuf,8
j back11
andi ext,ext,1
fetch12:
lbu bitbuf,0(input)
addi input,input,1
addu bitbuf,bitbuf,bitbuf
addu bitbuf,bitbuf,ext
srl ext,bitbuf,8
j back12
andi ext,ext,1
overnout:
addu bitbuf,bitbuf,bitbuf
srl ext,bitbuf,8
andi ext,ext,1
andi bitbuf,bitbuf,0xff
bne r0,bitbuf,check4end
nop
lbu bitbuf,0(input)
addi input,input,1
addu bitbuf,bitbuf,bitbuf
addu bitbuf,bitbuf,ext
srl ext,bitbuf,8
andi ext,ext,1
check4end:
bne r0,ext,xloop
nop
lhu xd0,0(xsp)
addi xsp,xsp,2
beq r0,xd0,unpack9
nop
unpack8:
lh xd1,0(xsp)
addi xsp,xsp,2
sb xd1,0(output)
addi output,output,1
sub xd0,xd0,1
bne r0,xd0,unpack8
nop
unpack9:
j unpack11
nop
unpack10:
sw xd1,0(xsp)
unpack11:
li retval,0
jr ra
nop
.data
.align 4
.word 0,0,0,0,0,0,0,0,0,0,0,0
mystack:
.word 0
.end
+19
View File
@@ -0,0 +1,19 @@
# Compress binary file to gzip
$(BUILD_DIR)/%.gz: $(BUILD_DIR)/%.bin
$(call print,Compressing:,$<,$@)
ifeq ($(GZIPVER),std)
$(V)$(GZIP) -c -9 -n $< > $@
else
$(V)$(GZIP) -c -12 -n $< > $@
endif
# Strip gzip header
$(BUILD_DIR)/%.szp: $(BUILD_DIR)/%.gz
$(call print,Converting:,$<,$@)
$(V)dd bs=10 skip=1 if=$< of=$@
$(V)$(FILESIZER) $(<:.gz=.bin) $@
# convert binary szp to object file
$(BUILD_DIR)/%.szp.o: $(BUILD_DIR)/%.szp
$(call print,Converting GZIP to ELF:,$<,$@)
$(V)printf ".section .data\n\n.incbin \"$<\"\n" | $(AS) $(ASFLAGS) -o $@
Executable
+24
View File
@@ -0,0 +1,24 @@
#ifndef _IE_PACK_H
#define _IE_PACK_H
typedef struct s_Propack
{
u8 Id[3]; // MUST be RNC
u8 Method; // MUST be 0,1,2 (will have 0x80 added if indexed type)
u32 UnpackedSize;
u32 PackedSize; // Including size of ALL data
u16 BlockCount; // Indexed method block count
u8 BlockSize; // When method is indexed, this gives us the block size in KB.
u8 Reserved[3];
u8 Data[0];
} t_Propack;
/* Prototypes for unpack routines in assembly - Note: these just do the raw unpacking
everything else is done at a level above
*/
extern void Propack_UnpackM1(void *FilePtr, void *OutputBuffer);
extern void Propack_UnpackM2(void *FilePtr, void *OutputBuffer);
#endif // _IE_PACK_H
+79 -79
View File
@@ -1,4 +1,4 @@
.include "macros.inc"
#include "macros.inc"
.set UCODE_SIZE, 0x800
.section .text
@@ -10,34 +10,34 @@ glabel rspbootTextStart
glabel rspbootTextEnd
.balign 16
.ifndef F3DEX_GBI_SHARED
.if SUPER3D_GBI == 1
#ifndef F3DEX_GBI_SHARED
#if SUPER3D_GBI == 1
glabel gspSuper3D_fifoTextStart
.incbin "lib/PR/super3d/Super3D.bin"
glabel gspSuper3D_fifoTextEnd
.else
#else
glabel gspFast3D_fifoTextStart /* Use regular Fast3D bins (default) */
.incbin "rsp/fast3d.bin"
glabel gspFast3D_fifoTextEnd
.endif
#endif
.else /* Use one of the Fast3DEX series grucodes. */
.ifndef F3DZEX_GBI_2
.if F3DEX_GBI_2 == 1
#else /* Use one of the Fast3DEX series grucodes. */
#ifndef F3DZEX_GBI_2
#if F3DEX_GBI_2 == 1
glabel gspF3DEX2_fifoTextStart
.incbin "lib/PR/f3dex2/F3DEX2.bin"
glabel gspF3DEX2_fifoTextEnd
.elseif F3DEX_GBI == 1
#elseif F3DEX_GBI == 1
glabel gspF3DEX_fifoTextStart
.incbin "lib/PR/f3dex/F3DEX.bin"
glabel gspF3DEX_fifoTextEnd
.endif
.else /* Fast3DZEX */
#endif
#else /* Fast3DZEX */
glabel gspF3DZEX2_PosLight_fifoTextStart
.incbin "lib/PR/f3dzex/F3DZEX.bin"
glabel gspF3DZEX2_PosLight_fifoTextEnd
.endif
.endif
#endif
#endif
/* Audio Bins */
@@ -48,11 +48,11 @@ glabel gspFast3D_fifoTextEnd
.balign 16
glabel aspMainTextStart
.if VERSION_SH == 1
#if VERSION_SH == 1
.incbin "rsp/audio.bin"
.else
#else
.incbin "lib/PR/audio/aspMain.bin"
.endif
#endif
glabel aspMainTextEnd
/*
@@ -61,145 +61,145 @@ glabel aspMainTextEnd
*/
/* Fast3DEX NoN Text */
.ifdef F3DEX_NON_GBI
#ifdef F3DEX_NON_GBI
glabel gspF3DEX_NoN_fifoTextStart
.balign 16
.incbin "lib/PR/f3dex/F3DEX_NoN.bin"
glabel gspF3DEX_NoN_fifoTextEnd
.endif
#endif
/* Fast3DLX Text */
.ifdef F3DLX_GBI
#ifdef F3DLX_GBI
glabel gspF3DLX_fifoTextStart
.incbin "lib/PR/f3dex/F3DLX.bin"
glabel gspF3DLX_fifoTextEnd
.endif
#endif
/* Fast3DLX NoN Text */
.ifdef F3DLX_NON_GBI
#ifdef F3DLX_NON_GBI
glabel gspF3DLX_NoN_fifoTextStart
.balign 16
.incbin "lib/PR/f3dex/F3DLX_NoN.bin"
glabel gspF3DLX_NoN_fifoTextEnd
.endif
#endif
/* Fast3DLX Rej Text */
.ifdef F3DLX_REJ_GBI
#ifdef F3DLX_REJ_GBI
glabel gspF3DLX_Rej_fifoTextStart
.balign 16
.incbin "lib/PR/f3dex/F3DLX_Rej.bin"
glabel gspF3DLX_Rej_fifoTextEnd
.endif
#endif
/* Line3DEX Text */
.ifdef L3DEX_GBI
#ifdef L3DEX_GBI
glabel gspL3DEX_fifoTextStart
.balign 16
.incbin "lib/PR/f3dex/L3DEX.bin"
glabel gspL3DEX_fifoTextEnd
.endif
#endif
/* S2DEX Text */
.ifdef S2DEX_GBI
#ifdef S2DEX_GBI
glabel gspS2DEX_fifoTextStart
.balign 16
.incbin "lib/PR/s2dex/S2DEX.bin"
glabel gspS2DEX_fifoTextEnd
.endif
#endif
/* Fast3DEX2 series */
/* Fast3DEX2 NoN Text */
.ifdef F3DEX2_NON_GBI
#ifdef F3DEX2_NON_GBI
.balign 16
glabel gspF3DEX2_NoN_fifoTextStart
.incbin "lib/PR/f3dex2/F3DEX2_NoN.bin"
glabel gspF3DEX2_NoN_fifoTextEnd
.endif
#endif
/* Fast3DZEX NoN Text */
.ifdef F3DZEX_NON_GBI_2
#ifdef F3DZEX_NON_GBI_2
.balign 16
glabel gspF3DZEX2_NoN_PosLight_fifoTextStart
.incbin "lib/PR/f3dzex/F3DZEX_NoN.bin"
glabel gspF3DZEX2_NoN_PosLight_fifoTextEnd
.endif
#endif
/* Fast3DEX2 Rej Text */
.ifdef F3DEX2_REJ_GBI
#ifdef F3DEX2_REJ_GBI
.balign 16
glabel gspF3DEX2_Rej_fifoTextStart
.incbin "lib/PR/f3dex2/F3DEX2_Rej.bin"
glabel gspF3DEX2_Rej_fifoTextEnd
.endif
#endif
/* Line3DEX2 Text */
.ifdef L3DEX2_GBI
#ifdef L3DEX2_GBI
.balign 16
glabel gspL3DEX2_fifoTextStart
.incbin "lib/PR/f3dex2/L3DEX2.bin"
glabel gspL3DEX2_fifoTextEnd
.endif
#endif
/* Line3DZEX Text */
.ifdef L3DZEX_GBI
#ifdef L3DZEX_GBI
.balign 16
glabel gspL3DZEX2_PosLight_fifoTextStart
.incbin "lib/PR/f3dzex/L3DZEX.bin"
glabel gspL3DZEX2_PosLight_fifoTextEnd
.endif
#endif
/* S2DEX2 Text */
.ifdef S2DEX_GBI_2
#ifdef S2DEX_GBI_2
.balign 16
glabel gspS2DEX2_fifoTextStart
.incbin "lib/PR/s2dex2/S2DEX2.bin"
glabel gspS2DEX2_fifoTextEnd
.endif
#endif
/* DATA SECTION START */
.section .rodata
.balign 16
.ifndef F3DEX_GBI_SHARED /* Use regular Fast3D data (default) */
.if SUPER3D_GBI == 1
#ifndef F3DEX_GBI_SHARED /* Use regular Fast3D data (default) */
#if SUPER3D_GBI == 1
glabel gspSuper3D_fifoDataStart
.incbin "lib/PR/super3d/Super3D_data.bin"
glabel gspSuper3D_fifoDataEnd
.else
#else
glabel gspFast3D_fifoDataStart
.incbin "rsp/fast3d_data.bin"
glabel gspFast3D_fifoDataEnd
.endif
#endif
.else /* Using one of the Fast3DEX series grucodes */
.ifndef F3DZEX_GBI_2
.if F3DEX_GBI_2 == 1
#else /* Using one of the Fast3DEX series grucodes */
#ifndef F3DZEX_GBI_2
#if F3DEX_GBI_2 == 1
glabel gspF3DEX2_fifoDataStart
.incbin "lib/PR/f3dex2/F3DEX2_data.bin"
glabel gspF3DEX2_fifoDataEnd
.elseif F3DEX_GBI == 1
#elseif F3DEX_GBI == 1
glabel gspF3DEX_fifoDataStart
.incbin "lib/PR/f3dex/F3DEX_data.bin"
glabel gspF3DEX_fifoDataEnd
.endif
.else /* Fast3DZEX */
#endif
#else /* Fast3DZEX */
glabel gspF3DZEX2_PosLight_fifoDataStart
.incbin "lib/PR/f3dzex/F3DZEX_data.bin"
glabel gspF3DZEX2_PosLight_fifoDataEnd
.endif
.endif
#endif
#endif
/* Audio Data */
.balign 16
glabel aspMainDataStart
.if VERSION_SH == 1
#if VERSION_SH == 1
.incbin "rsp/audio_data.bin"
.else
#else
.incbin "lib/PR/audio/aspMain_data.bin"
.endif
#endif
glabel aspMainDataEnd
/* LESS COMMON MICROCODES */
@@ -207,99 +207,99 @@ glabel aspMainDataEnd
/* Fast3DEX Series */
/* Fast3DEX NoN Data */
.ifdef F3DEX_NON_GBI
#ifdef F3DEX_NON_GBI
.balign 16
glabel gspF3DEX_NoN_fifoDataStart
.incbin "lib/PR/f3dex/F3DEX_NoN_data.bin"
glabel gspF3DEX_NoN_fifoDataEnd
.endif
#endif
/* Fast3DLX Data */
.ifdef F3DLX_GBI
#ifdef F3DLX_GBI
.balign 16
glabel gspF3DLX_fifoDataStart
.incbin "lib/PR/f3dex/F3DLX_data.bin"
glabel gspF3DLX_fifoDataEnd
.endif
#endif
/* Fast3DLX NoN Data */
.ifdef F3DLX_NON_GBI
#ifdef F3DLX_NON_GBI
.balign 16
glabel gspF3DLX_NoN_fifoDataStart
.incbin "lib/PR/f3dex/F3DLX_NoN_data.bin"
glabel gspF3DLX_NoN_fifoDataEnd
.endif
#endif
/* Fast3DLX Rej Data */
.ifdef F3DLX_REJ_GBI
#ifdef F3DLX_REJ_GBI
.balign 16
glabel gspF3DLX_Rej_fifoDataStart
.incbin "lib/PR/f3dex/F3DLX_Rej_data.bin"
glabel gspF3DLX_Rej_fifoDataEnd
.endif
#endif
/* Line3DEX Data */
.ifdef L3DEX_GBI
#ifdef L3DEX_GBI
.balign 16
glabel gspL3DEX_fifoDataStart
.incbin "lib/PR/f3dex/L3DEX_data.bin"
glabel gspL3DEX_fifoDataEnd
.endif
#endif
/* S2DEX Data */
.ifdef S2DEX_GBI
#ifdef S2DEX_GBI
.balign 16
glabel gspS2DEX_fifoDataStart
.incbin "lib/PR/s2dex/S2DEX_data.bin"
glabel gspS2DEX_fifoDataEnd
.endif
#endif
/* Fast3DEX2 Series */
/* Fast3DEX2 NoN Data */
.ifdef F3DEX2_NON_GBI
#ifdef F3DEX2_NON_GBI
.balign 16
glabel gspF3DEX2_NoN_fifoDataStart
.incbin "lib/PR/f3dex2/F3DEX2_NoN_data.bin"
glabel gspF3DEX2_NoN_fifoDataEnd
.endif
#endif
/* Fast3DZEX NoN Data */
.ifdef F3DZEX_NON_GBI_2
#ifdef F3DZEX_NON_GBI_2
.balign 16
glabel gspF3DZEX2_NoN_PosLight_fifoDataStart
.incbin "lib/PR/f3dzex/F3DZEX_NoN_data.bin"
glabel gspF3DZEX2_NoN_PosLight_fifoDataEnd
.endif
#endif
/* Fast3DEX2 Rej Data */
.ifdef F3DEX2_REJ_GBI
#ifdef F3DEX2_REJ_GBI
.balign 16
glabel gspF3DEX2_Rej_fifoDataStart
.incbin "lib/PR/f3dex2/F3DEX2_Rej_data.bin"
glabel gspF3DEX2_Rej_fifoDataEnd
.endif
#endif
/* Line3DEX2 Data */
.ifdef L3DEX2_GBI
#ifdef L3DEX2_GBI
.balign 16
glabel gspL3DEX2_fifoDataStart
.incbin "lib/PR/f3dex2/L3DEX2_data.bin"
glabel gspL3DEX2_fifoDataEnd
.endif
#endif
/* Line3DZEX Text */
.ifdef L3DZEX_GBI
#ifdef L3DZEX_GBI
.balign 16
glabel gspL3DZEX2_PosLight_fifoDataStart
.incbin "lib/PR/f3dzex/L3DZEX_data.bin"
glabel gspL3DZEX2_PosLight_fifoDataEnd
.endif
#endif
/* S2DEX2 Data */
.ifdef S2DEX_GBI_2
#ifdef S2DEX_GBI_2
.balign 16
glabel gspS2DEX2_fifoDataStart
.incbin "lib/PR/s2dex2/S2DEX2_data.bin"
glabel gspS2DEX2_fifoDataEnd
.endif
#endif
+9
View File
@@ -0,0 +1,9 @@
# Compress binary file
$(BUILD_DIR)/%.szp: $(BUILD_DIR)/%.bin
$(call print,Compressing:,$<,$@)
$(V)$(RNCPACK) p $< $@ -m1
# convert binary szp to object file
$(BUILD_DIR)/%.szp.o: $(BUILD_DIR)/%.szp
$(call print,Converting RNC to ELF:,$<,$@)
$(V)printf ".section .data\n\n.incbin \"$<\"\n" | $(AS) $(ASFLAGS) -o $@
+9
View File
@@ -0,0 +1,9 @@
# Compress binary file
$(BUILD_DIR)/%.szp: $(BUILD_DIR)/%.bin
$(call print,Compressing:,$<,$@)
$(V)$(RNCPACK) p $< $@ -m2
# convert binary szp to object file
$(BUILD_DIR)/%.szp.o: $(BUILD_DIR)/%.szp
$(call print,Converting RNC to ELF:,$<,$@)
$(V)printf ".section .data\n\n.incbin \"$<\"\n" | $(AS) $(ASFLAGS) -o $@
+9
View File
@@ -122,6 +122,12 @@ SECTIONS
#endif
#ifdef YAY0
BUILD_DIR/asm/slidec.o(.text);
#endif
#ifdef RNC1
BUILD_DIR/asm/rnc1.o(.text);
#endif
#ifdef RNC2
BUILD_DIR/asm/rnc2.o(.text);
#endif
*/libultra_rom.a:*.o(.text);
*/libnustd.a:*.o(.text);
@@ -160,6 +166,9 @@ SECTIONS
#ifdef GZIP
BUILD_DIR/src/gzip*.o(.data*);
#endif
#ifdef RNC2
BUILD_DIR/asm/rnc2.o(.data*);
#endif
*/libultra_rom.a:*.o(.data*);
*/libultra_rom.a:*.o(.sdata*);
+11
View File
@@ -14,6 +14,9 @@
#ifdef GZIP
#include "gzip/gzip.h"
#endif
#if defined(RNC1) || defined(RNC2)
#include <rnc.h>
#endif
// round up to the next multiple
@@ -345,6 +348,10 @@ void *load_segment_decompress(s32 segment, u8 *srcStart, u8 *srcEnd) {
if (dest != NULL) {
#ifdef GZIP
expand_gzip(compressed, dest, compSize, (u32)size);
#elif RNC1
Propack_UnpackM1(compressed, dest);
#elif RNC2
Propack_UnpackM2(compressed, dest);
#else
slidstart(compressed, dest);
#endif
@@ -374,6 +381,10 @@ void *load_segment_decompress_heap(u32 segment, u8 *srcStart, u8 *srcEnd) {
dma_read(compressed, srcStart, srcEnd);
#ifdef GZIP
expand_gzip(compressed, gDecompressionHeap, compSize, (u32)size);
#elif RNC1
Propack_UnpackM1(compressed, gDecompressionHeap);
#elif RNC2
Propack_UnpackM2(compressed, gDecompressionHeap);
#else
slidstart(compressed, gDecompressionHeap);
#endif
+1
View File
@@ -9,6 +9,7 @@
/n64graphics
/n64graphics_ci
/patch_libultra_math
/rncpack
/skyconv
/tabledesign
/textconv
+3 -1
View File
@@ -7,7 +7,7 @@ CC := gcc
CXX := g++
CFLAGS := -I . -Wall -Wextra -Wno-unused-parameter -pedantic -O2 -s
LDFLAGS := -lm
ALL_PROGRAMS := armips bfsize filesizer n64graphics n64graphics_ci mio0 slienc n64cksum textconv patch_libultra_math aifc_decode aiff_extract_codebook vadpcm_enc tabledesign extract_data_for_mio skyconv
ALL_PROGRAMS := armips bfsize filesizer rncpack n64graphics n64graphics_ci mio0 slienc n64cksum textconv patch_libultra_math aifc_decode aiff_extract_codebook vadpcm_enc tabledesign extract_data_for_mio skyconv
LIBAUDIOFILE := audiofile/libaudiofile.a
# Only build armips from tools if it is not found on the system
@@ -23,6 +23,8 @@ bfsize_SOURCES := bfsize.c
filesizer_SOURCES := filesizer.c
rncpack_SOURCES := rncpack.c
n64graphics_SOURCES := n64graphics.c utils.c
n64graphics_CFLAGS := -DN64GRAPHICS_STANDALONE
+1747
View File
File diff suppressed because it is too large. Load diff
+9
View File
@@ -0,0 +1,9 @@
# Compress binary file
$(BUILD_DIR)/%.szp: $(BUILD_DIR)/%.bin
$(call print,Compressing:,$<,$@)
$(V)$(YAY0TOOL) $< $@
# convert binary szp to object file
$(BUILD_DIR)/%.szp.o: $(BUILD_DIR)/%.szp
$(call print,Converting YAY0 to ELF:,$<,$@)
$(V)printf ".section .data\n\n.incbin \"$<\"\n" | $(AS) $(ASFLAGS) -o $@