mirror of
https://github.com/farisawan-2000/kirby64.git
synced 2024-11-23 13:20:03 +00:00
split almost all assets
This commit is contained in:
parent
79d0c21b0f
commit
c5ca4a968a
15
Makefile
15
Makefile
@ -53,7 +53,13 @@ LOADER_FLAGS = -vwf
|
||||
FixPath = $(subst /,/,$1)
|
||||
|
||||
ASM_DIRS := asm data $(wildcard asm/ovl*) asm/ovl0/lib asm/data
|
||||
SRC_DIRS := src $(wildcard src/ovl*) data wildcard actors
|
||||
SRC_DIRS := src $(wildcard src/ovl*) data wildcard
|
||||
|
||||
BIN_DIRS := bin/geo bin/image bin/misc bin/anim
|
||||
|
||||
DATA_DIRS := actors
|
||||
DATA_FILES := $(foreach dir,$(DATA_DIRS),$(wildcard $(dir)/*.c))
|
||||
|
||||
TEXTURES_DIR = textures
|
||||
|
||||
MIPSISET := -mips2 -32
|
||||
@ -70,6 +76,8 @@ BUILD_ASM_DIRS := $(foreach dir,$(ASM_DIRS),$(wildcard $(dir)/**/))
|
||||
O_FILES := $(foreach file,$(C_FILES),$(BUILD_DIR)/$(file:.c=.o)) \
|
||||
$(foreach file,$(S_FILES),$(BUILD_DIR)/$(file:.s=.o))
|
||||
|
||||
ACTOR_FILES := $(foreach file,$(DATA_FILES),$(BUILD_DIR)/$(file:.c=.o))
|
||||
|
||||
|
||||
# FLAGS
|
||||
OPT_FLAGS := -O2
|
||||
@ -108,6 +116,10 @@ clean:
|
||||
$(BUILD_DIR):
|
||||
mkdir $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(SRC_DIRS) $(ASM_DIRS))
|
||||
|
||||
$(BUILD_DIR)/actors/%.o: $(BUILD_DIR)/actors/%.c
|
||||
@$(CC_CHECK) -MMD -MP -MT $@ -MF $(BUILD_DIR)/$*.d $<
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
$(BUILD_DIR)/%.o: %.s
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
|
||||
@ -153,3 +165,4 @@ MAKEFLAGS += --no-builtin-rules
|
||||
|
||||
|
||||
print-% : ; $(info $* is a $(flavor $*) variable set to [$($*)]) @true
|
||||
|
||||
|
11096
assets.json
11096
assets.json
File diff suppressed because it is too large
Load Diff
42208
data/banks.s
Normal file
42208
data/banks.s
Normal file
File diff suppressed because it is too large
Load Diff
@ -2,6 +2,7 @@
|
||||
|
||||
#include "types.h"
|
||||
#include "segments.h"
|
||||
#include "banks.h"
|
||||
#include "src/ovl0/main.h"
|
||||
|
||||
u32 D_80039230 = 0x40055800;
|
||||
@ -12317,6 +12318,8 @@ u32 D_8003F330 = 0x00000000;
|
||||
|
||||
u32 D_8003F334 = 0x00000000;
|
||||
|
||||
|
||||
|
||||
u32 D_8003F338 = 0x00000001;
|
||||
|
||||
u32 D_8003F33C = 0x00000000;
|
||||
@ -12361,7 +12364,7 @@ u32 *D_8003F3A8 = _data_4A0340SegmentRomStart;
|
||||
u32 *D_8003F3AC = _data_4A3B60SegmentRomStart;
|
||||
|
||||
u32 *D_8003F3B0 = _data_4A3B60SegmentRomStart;
|
||||
u32 *D_8003F3B4 = _data_4AA8F0SegmentRomStart;
|
||||
u32 *D_8003F3B4 = &bank_0_index_1_geo;
|
||||
u32 D_8003F3B8 = 0x00000000;
|
||||
u32 D_8003F3BC = 0x00000000;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "types.h"
|
||||
#include "segments.h"
|
||||
#include "banks.h"
|
||||
|
||||
u32 D_800BE3E0 = 0x00000000;
|
||||
|
||||
@ -12510,48 +12511,33 @@ u32 D_800C469C = 0x00000000;
|
||||
|
||||
u32 D_800C46A0 = 0x00000000;
|
||||
|
||||
|
||||
u32 D_800C46A4 = 0x00000000;
|
||||
|
||||
u32 D_800C46A8 = 0x004AA8F0;
|
||||
|
||||
u32 D_800C46AC = 0x004AB360;
|
||||
|
||||
u32 D_800C46B0 = 0x004AB360;
|
||||
u32 D_800C46A8[] = {
|
||||
0x004AA8F0,
|
||||
0x004AB360,
|
||||
0x004AB360,
|
||||
0x004ABED0,
|
||||
0x004ABED0,
|
||||
0x004ACD30,
|
||||
0x004ACD30,
|
||||
0x004AFE80,
|
||||
0x004AFE80,
|
||||
0x004B0750,
|
||||
0x004B0750,
|
||||
0x004B14E0,
|
||||
0x004B14E0,
|
||||
0x004B1BB0,
|
||||
0x004B1BB0,
|
||||
0x004B2280,
|
||||
0x004B2280,
|
||||
0x004B2A70,
|
||||
0x004B2A70,
|
||||
0x004B3260,
|
||||
};
|
||||
|
||||
u32 D_800C46B4 = 0x004ABED0;
|
||||
|
||||
u32 D_800C46B8 = 0x004ABED0;
|
||||
|
||||
u32 D_800C46BC = 0x004ACD30;
|
||||
|
||||
u32 D_800C46C0 = 0x004ACD30;
|
||||
|
||||
u32 D_800C46C4 = 0x004AFE80;
|
||||
|
||||
u32 D_800C46C8 = 0x004AFE80;
|
||||
|
||||
u32 D_800C46CC = 0x004B0750;
|
||||
|
||||
u32 D_800C46D0 = 0x004B0750;
|
||||
|
||||
u32 D_800C46D4 = 0x004B14E0;
|
||||
|
||||
u32 D_800C46D8 = 0x004B14E0;
|
||||
|
||||
u32 D_800C46DC = 0x004B1BB0;
|
||||
|
||||
u32 D_800C46E0 = 0x004B1BB0;
|
||||
|
||||
u32 D_800C46E4 = 0x004B2280;
|
||||
|
||||
u32 D_800C46E8 = 0x004B2280;
|
||||
|
||||
u32 D_800C46EC = 0x004B2A70;
|
||||
|
||||
u32 D_800C46F0 = 0x004B2A70;
|
||||
|
||||
u32 D_800C46F4 = 0x004B3260;
|
||||
|
||||
u32 D_800C46F8 = 0x00000000;
|
||||
|
||||
@ -12683,6 +12669,7 @@ u32 D_800C47F4 = 0x00000000;
|
||||
|
||||
u32 D_800C47F8 = 0x00000000;
|
||||
|
||||
|
||||
u32 D_800C47FC = 0x004FC9A0;
|
||||
|
||||
u32 D_800C4800 = 0x004FD550;
|
||||
@ -18867,6 +18854,7 @@ u32 D_800C7844 = 0x00000000;
|
||||
|
||||
u32 D_800C7848 = 0x00000000;
|
||||
|
||||
|
||||
u32 D_800C784C = 0x007DDF60;
|
||||
|
||||
u32 D_800C7850 = 0x007DE680;
|
||||
@ -21993,6 +21981,7 @@ u32 D_800C90B0 = 0x00000000;
|
||||
|
||||
u32 D_800C90B4 = 0x00000000;
|
||||
|
||||
|
||||
u32 D_800C90B8 = 0x0096C2D0;
|
||||
|
||||
u32 D_800C90BC = 0x0096C750;
|
||||
@ -25845,6 +25834,7 @@ u32 D_800CAEC8 = 0x00006714;
|
||||
|
||||
u32 D_800CAECC = 0x0000795C;
|
||||
|
||||
|
||||
u32 D_800CAED0 = 0x800C90B0;
|
||||
|
||||
u32 D_800CAED4 = 0xFFFFFFFF;
|
||||
@ -25865,6 +25855,7 @@ u32 D_800CAEF0 = 0x00000000;
|
||||
|
||||
u32 D_800CAEF4 = 0x00000000;
|
||||
|
||||
|
||||
u32 D_800CAEF8 = 0x00BDE710;
|
||||
|
||||
u32 D_800CAEFC = 0x00BDE9D0;
|
||||
@ -29029,7 +29020,7 @@ u32 D_800CC7A8 = 0x00EE9780;
|
||||
|
||||
u32 D_800CC7AC = 0x800CC784;
|
||||
|
||||
u32 *D_800CC7B0 = _data_1116010SegmentRomStart;
|
||||
u32 *D_800CC7B0 = bank_4_index_1_misc;
|
||||
|
||||
u32 D_800CC7B4 = 0x00000000;
|
||||
|
||||
@ -29671,6 +29662,7 @@ u32 D_800CCCAC = 0x00000000;
|
||||
|
||||
u32 D_800CCCB0 = 0x00000000;
|
||||
|
||||
|
||||
u32 D_800CCCB4 = 0x800CC7B4;
|
||||
|
||||
u32 D_800CCCB8 = 0xFFFFFFFF;
|
||||
@ -29691,6 +29683,7 @@ u32 D_800CCCD4 = 0x00000000;
|
||||
|
||||
u32 D_800CCCD8 = 0x00000000;
|
||||
|
||||
|
||||
u32 D_800CCCDC = 0x01195E60;
|
||||
|
||||
u32 D_800CCCE0 = 0x01196F40;
|
||||
@ -32433,6 +32426,7 @@ u32 D_800CE240 = 0x00000000;
|
||||
|
||||
u32 D_800CE244 = 0x00000000;
|
||||
|
||||
|
||||
u32 D_800CE248 = 0x0128E770;
|
||||
|
||||
u32 D_800CE24C = 0x012B4420;
|
||||
|
10552
include/banks.h
Normal file
10552
include/banks.h
Normal file
File diff suppressed because it is too large
Load Diff
17
kirby.us.ld
17
kirby.us.ld
@ -6,8 +6,9 @@ OUTPUT_ARCH (mips)
|
||||
_##name##SegmentRomStart = __romPos; \
|
||||
.name addr : AT(__romPos)
|
||||
|
||||
#define MARK(name) \
|
||||
_##name##RomStart = __romPos;
|
||||
#define MARK(name, prevName) \
|
||||
_##name##_RomStart = __romPos; \
|
||||
_##prevName##_RomEnd = __romPos;
|
||||
|
||||
#define END_SEG(name) \
|
||||
_##name##SegmentEnd = ADDR(.name) + SIZEOF(.name); \
|
||||
@ -276,21 +277,21 @@ SECTIONS
|
||||
BUILD_DIR/asm/data/kirby.u.4A3B60.o(.data);
|
||||
}
|
||||
END_SEG(data_4A3B60)
|
||||
BEGIN_SEG(data_4AA8F0, 0) { /*TODO: get a good addr for this*/
|
||||
BUILD_DIR/asm/data/kirby.u.4AA8F0.o(.data);
|
||||
BEGIN_SEG(bank_data, __romPos) { /*TODO: get a good addr for this*/
|
||||
BUILD_DIR/data/banks.o(.data);
|
||||
}
|
||||
END_SEG(data_4AA8F0)
|
||||
END_SEG(bank_data)
|
||||
|
||||
BEGIN_SEG(kirby_and_after, 0) {
|
||||
/*BEGIN_SEG(kirby_and_after, 0) {
|
||||
BUILD_DIR/actors/kirby.o(.rodata);
|
||||
BUILD_DIR/asm/kirby.u.7E2D70.o(.data);
|
||||
}
|
||||
END_SEG(kirby_and_after)
|
||||
|
||||
BEGIN_SEG(data_1116010, 0) { /*TODO: get a good addr for this*/
|
||||
BEGIN_SEG(data_1116010, 0) {
|
||||
BUILD_DIR/asm/data/kirby.u.1116010.o(.data);
|
||||
}
|
||||
END_SEG(data_1116010)
|
||||
END_SEG(data_1116010) */
|
||||
/* TODO: implement this somehow
|
||||
.BEGIN_SEG(leveltextures, 0x07000000) {
|
||||
BUILD_DIR/data/textures_1BD5C80.o(.data);
|
||||
|
@ -16,10 +16,137 @@
|
||||
|
||||
import sys, os
|
||||
|
||||
|
||||
geoBlocks = [
|
||||
"D_800C46A8", # 0
|
||||
"D_800C47FC", # 1
|
||||
"D_800C784C", # 2
|
||||
"D_800C90B8", # 3
|
||||
"D_800CAEF8", # 4
|
||||
"None",
|
||||
"D_800CCCDC", # 6
|
||||
"D_800CE248", # 7
|
||||
]
|
||||
|
||||
|
||||
def getSection(l):
|
||||
return [i for i in l.split("*") if i != ''][0].split()[0].lower()
|
||||
|
||||
def printAsset(n, size, off):
|
||||
print("\""+n+
|
||||
"\": {\"meta\": {\"size\":\""+size+
|
||||
"\"}, \"offsets\":{\"us\":[\""+off+"\",\"0x0\"]}},")
|
||||
|
||||
def printTexture(n, w, h, off, pal=None):
|
||||
if pal is None:
|
||||
print("\""+n+
|
||||
"\": {\"meta\": {\"dims\":["
|
||||
+w+", "+h+"]}, \"offsets\":{\"us\":[\""+off+"\",\"0x0\"]}}")
|
||||
|
||||
def getBank(l):
|
||||
return l.split("Bank")[1].split("ID")[0].strip()
|
||||
def getIndex(l):
|
||||
return l.split("Bank")[1].split("ID")[1].strip()
|
||||
def getAddrs(l):
|
||||
x1 = l.split("start")[1].split("end")[0]
|
||||
x2 = l.split("end")[1].split("Bank")[0]
|
||||
size = int(x2, 16) - int(x1, 16)
|
||||
return x1.strip()
|
||||
|
||||
def printBank(n):
|
||||
print(
|
||||
"u32 "+geoBlocks[n]+"[] = \n"+
|
||||
"\n".join(["\t"+i+"RomStart,\n\t"+i+"RomEnd," for i in banks[n]])+
|
||||
"\n};"
|
||||
)
|
||||
|
||||
def generateLink(b):
|
||||
toReturn = ""
|
||||
print("BEGIN_SEG(bank_"+b+"_index_"+d+", 0) {") # TODO: get RAM addr
|
||||
for i in banks[b]:
|
||||
print("\tBUILD_DIR/bin/")
|
||||
|
||||
path = ""
|
||||
prefix = "bank_"
|
||||
banks = [
|
||||
[],
|
||||
[],
|
||||
[],
|
||||
[],
|
||||
[],
|
||||
[],
|
||||
[],
|
||||
[],
|
||||
]
|
||||
tempIndex = 0;
|
||||
tempBank = 0;
|
||||
|
||||
# def genCFile(x):
|
||||
# print(".include \"macros.inc\"\n")
|
||||
# s = 0
|
||||
# for i in banks[x]:
|
||||
# print("glabel "+i[1:]+"_geo")
|
||||
# y = i[1:].replace("index","").replace("__","_").replace("_","/")
|
||||
# y = y[:4]+"_"+y[5:]
|
||||
# print("\t.incbin \""+y+"/block.inc.c\"")
|
||||
# print()
|
||||
|
||||
# print(".include \"macros.inc\"\n.section .data\n")
|
||||
# f2 = open(sys.argv[2], "w+")
|
||||
# f2.write("#include <ultra64.h>\n")
|
||||
# with open(sys.argv[1]) as f:
|
||||
# for line in f:
|
||||
# if "*" in line:
|
||||
# path = getSection(line)
|
||||
# else:
|
||||
# tempBank = getBank(line)
|
||||
# tempIndex = getIndex(line)
|
||||
# fullPath = "assets/"+path+"/"+prefix+getBank(line)+"/"+getIndex(line)+"/block.bin"
|
||||
# print(".balign 2")
|
||||
# size, offset = getAddrs(line)
|
||||
# print("glabel bank_"+getBank(line)+"_index_"+getIndex(line)+"_"+path+" # "+offset)
|
||||
# f2.write("extern u32 bank_"+getBank(line)+"_index_"+getIndex(line)+"_"+path+"[];\n")
|
||||
# print(".incbin \""+fullPath+"\"\n")
|
||||
# # printAsset(fullPath, size, offset)
|
||||
# if "geo" in path:
|
||||
# banks[int(getBank(line))].append("_"+prefix+getBank(line)+"_index_"+getIndex(line))
|
||||
|
||||
# print(".include \"macros.inc\"\n.section .data\n")
|
||||
# f2 = open(sys.argv[2], "w+")
|
||||
# f2.write("#include <ultra64.h>\n")
|
||||
prevOff = 0
|
||||
fullPath = ""
|
||||
with open(sys.argv[1]) as f:
|
||||
for line in f:
|
||||
if "*" in line:
|
||||
print(getSection(line))
|
||||
path = getSection(line)
|
||||
else:
|
||||
tempBank = getBank(line)
|
||||
tempIndex = getIndex(line)
|
||||
# print(".balign 2")
|
||||
offset = getAddrs(line)
|
||||
# print(str(hex(prevOff)))
|
||||
# if prevOff == 0:
|
||||
# printAsset(fullPath, "0xA70", offset)
|
||||
# prevOff = 0x4AB360
|
||||
# prevOff = 0x4AA8F0
|
||||
# else:
|
||||
cache = prevOff
|
||||
printAsset(fullPath, str(hex(int(offset, 16) - cache)), str(hex(prevOff)))
|
||||
fullPath = "assets/"+path+"/"+prefix+getBank(line)+"/"+getIndex(line)+"/block.bin"
|
||||
prevOff = int(offset, 16)
|
||||
# print("glabel bank_"+getBank(line)+"_index_"+getIndex(line)+"_"+path+" # "+offset)
|
||||
# f2.write("extern u32 bank_"+getBank(line)+"_index_"+getIndex(line)+"_"+path+"[];\n")
|
||||
# print(".incbin \""+fullPath+"\"\n")
|
||||
# printAsset(fullPath, size, offset)
|
||||
if "geo" in path:
|
||||
banks[int(getBank(line))].append("_"+prefix+getBank(line)+"_index_"+getIndex(line))
|
||||
|
||||
# x = open("kirby.us.inc.ld", "w+")
|
||||
# x.write(generateLink())
|
||||
# x.close()
|
||||
print()
|
||||
# for i in range(7):
|
||||
# generateLink(i)
|
||||
# printBank(i)
|
||||
# genCFile(0)
|
Loading…
Reference in New Issue
Block a user