mirror of
https://github.com/n64decomp/perfect_dark.git
synced 2024-11-23 05:49:52 +00:00
Build textures back into the ROM
This commit is contained in:
parent
a59640e34e
commit
78bb8975d2
18
Makefile
18
Makefile
@ -146,7 +146,6 @@ ASSET_FILES := \
|
||||
$(B_DIR)/assets/files/ob/ob_mid.seg.o
|
||||
|
||||
ANIM_FILES := $(shell find src/assets/animations -name '*.bin')
|
||||
SEQ_FILES := $(shell find src/assets/sequences -name '*.seq')
|
||||
|
||||
O_FILES := \
|
||||
$(patsubst src/%.c, $(B_DIR)/%.o, $(C_FILES)) \
|
||||
@ -183,7 +182,8 @@ O_FILES := \
|
||||
$(B_DIR)/assets/sequences.o \
|
||||
$(B_DIR)/assets/sfx.ctl.o \
|
||||
$(B_DIR)/assets/sfx.tbl.o \
|
||||
$(B_DIR)/assets/textures.o \
|
||||
$(B_DIR)/assets/texturesdata.o \
|
||||
$(B_DIR)/assets/textureslist.o \
|
||||
$(B_DIR)/assets/textures/config.o \
|
||||
$(B_DIR)/romheader.o \
|
||||
|
||||
@ -413,12 +413,24 @@ $(B_DIR)/assets/accessingpakZ.o: $(B_DIR)/assets/accessingpakZ
|
||||
$(B_DIR)/assets/copyrightZ.o: $(B_DIR)/assets/copyrightZ
|
||||
TOOLCHAIN=$(TOOLCHAIN) ROMID=$(ROMID) tools/mkrawobject $< $@
|
||||
|
||||
$(B_DIR)/assets/sequences.bin: $(SEQ_FILES) src/assets/sequences/sequences.py
|
||||
$(B_DIR)/assets/sequences.bin: src/assets/sequences/sequences.py
|
||||
tools/mksequences
|
||||
|
||||
$(B_DIR)/assets/sequences.o: $(B_DIR)/assets/sequences.bin
|
||||
TOOLCHAIN=$(TOOLCHAIN) ROMID=$(ROMID) tools/mkrawobject $< $@
|
||||
|
||||
$(B_DIR)/assets/texturesdata.bin: src/assets/textures/textures.py
|
||||
tools/mktextures
|
||||
|
||||
$(B_DIR)/assets/textureslist.bin: src/assets/textures/textures.py
|
||||
tools/mktextures
|
||||
|
||||
$(B_DIR)/assets/texturesdata.o: $(B_DIR)/assets/texturesdata.bin
|
||||
TOOLCHAIN=$(TOOLCHAIN) ROMID=$(ROMID) tools/mkrawobject $< $@
|
||||
|
||||
$(B_DIR)/assets/textureslist.o: $(B_DIR)/assets/textureslist.bin
|
||||
TOOLCHAIN=$(TOOLCHAIN) ROMID=$(ROMID) tools/mkrawobject $< $@
|
||||
|
||||
$(B_DIR)/assets/animations/%.o: src/assets/animations/%.bin
|
||||
@mkdir -p $(dir $@)
|
||||
TOOLCHAIN=$(TOOLCHAIN) ROMID=$(ROMID) tools/mkrawobject $< $@ 0x1
|
||||
|
13
ld/pd.ld
13
ld/pd.ld
@ -568,14 +568,17 @@ SECTIONS
|
||||
|
||||
__rampos = 0;
|
||||
|
||||
BEGIN_SEG(textures)
|
||||
BEGIN_SEG(texturesdata)
|
||||
{
|
||||
build/ROMID/assets/textures.o (.data);
|
||||
build/ROMID/assets/texturesdata.o (.data);
|
||||
}
|
||||
END_SEG(textures)
|
||||
END_SEG(texturesdata)
|
||||
|
||||
_texturesTableRomStart = _texturesSegmentRomEnd - 0x6d80;
|
||||
_texturesTableRomEnd = _texturesSegmentRomEnd;
|
||||
BEGIN_SEG(textureslist)
|
||||
{
|
||||
build/ROMID/assets/textureslist.o (.data);
|
||||
}
|
||||
END_SEG(textureslist)
|
||||
|
||||
/***************************************************************************
|
||||
* copyright
|
||||
|
3514
src/assets/textures/textures.py
Normal file
3514
src/assets/textures/textures.py
Normal file
File diff suppressed because it is too large
Load Diff
@ -14,12 +14,12 @@
|
||||
|
||||
void loadTextureList(void)
|
||||
{
|
||||
extern u8 _texturesTableRomStart;
|
||||
extern u8 _texturesTableRomEnd;
|
||||
extern u8 _textureslistSegmentRomStart;
|
||||
extern u8 _textureslistSegmentRomEnd;
|
||||
|
||||
u32 len = ((&_texturesTableRomEnd - &_texturesTableRomStart) + 15) & -16;
|
||||
u32 len = ((&_textureslistSegmentRomEnd - &_textureslistSegmentRomStart) + 15) & -16;
|
||||
|
||||
g_Textures = malloc(len, MEMPOOL_PERMANENT);
|
||||
|
||||
func0000d410(g_Textures, &_texturesTableRomStart, len);
|
||||
func0000d410(g_Textures, &_textureslistSegmentRomStart, len);
|
||||
}
|
||||
|
@ -5437,8 +5437,8 @@ glabel func0f173010
|
||||
/* f1730f0: 030f3023 */ subu $a2,$t8,$t7
|
||||
/* f1730f4: 24c6001f */ addiu $a2,$a2,0x1f
|
||||
/* f1730f8: 2401fff8 */ addiu $at,$zero,-8
|
||||
/* f1730fc: 3c0a01d6 */ lui $t2,%hi(_texturesSegmentRomStart)
|
||||
/* f173100: 254a5f40 */ addiu $t2,$t2,%lo(_texturesSegmentRomStart)
|
||||
/* f1730fc: 3c0a01d6 */ lui $t2,%hi(_texturesdataSegmentRomStart)
|
||||
/* f173100: 254a5f40 */ addiu $t2,$t2,%lo(_texturesdataSegmentRomStart)
|
||||
/* f173104: 01e1c824 */ and $t9,$t7,$at
|
||||
/* f173108: 00065902 */ srl $t3,$a2,0x4
|
||||
/* f17310c: 000b3100 */ sll $a2,$t3,0x4
|
||||
|
@ -260,7 +260,6 @@ class Extractor:
|
||||
tablepos += 8
|
||||
|
||||
tablepos += 8
|
||||
self.write_asset('textures.bin', self.rom[base:tablepos])
|
||||
|
||||
def extract_textureconfig(self):
|
||||
addr = self.val('textureconfig')
|
||||
|
36
tools/mktextures
Executable file
36
tools/mktextures
Executable file
@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.append('src/assets/textures')
|
||||
from textures import textures
|
||||
|
||||
fdd = open('build/%s/assets/texturesdata.bin' % os.environ['ROMID'], 'wb')
|
||||
fdl = open('build/%s/assets/textureslist.bin' % os.environ['ROMID'], 'wb')
|
||||
|
||||
offset = 0
|
||||
|
||||
for row in textures:
|
||||
name = row[0]
|
||||
flags = row[1]
|
||||
|
||||
filename = 'src/assets/textures/' + name;
|
||||
fd = open(filename, 'rb')
|
||||
data = fd.read()
|
||||
fd.close()
|
||||
|
||||
length = len(data)
|
||||
|
||||
fdl.write(flags.to_bytes(1, 'big'))
|
||||
fdl.write(offset.to_bytes(3, 'big'))
|
||||
fdl.seek(4, os.SEEK_CUR)
|
||||
|
||||
fdd.write(data)
|
||||
|
||||
offset += length
|
||||
|
||||
fdl.write(offset.to_bytes(4, 'big'))
|
||||
fdl.close()
|
||||
|
||||
fdd.close()
|
Loading…
Reference in New Issue
Block a user