mirror of
https://github.com/farisawan-2000/kirby64.git
synced 2024-11-23 13:20:03 +00:00
made ovl1 shiftable
This commit is contained in:
parent
c1eaf4143b
commit
c96c8c9258
96760
asm/ovl1/ovl1_bss.s
Normal file
96760
asm/ovl1/ovl1_bss.s
Normal file
File diff suppressed because it is too large
Load Diff
956
asm/ovl4/ovl4.s
956
asm/ovl4/ovl4.s
File diff suppressed because it is too large
Load Diff
7443
data/kirby.1014F0.s
Normal file
7443
data/kirby.1014F0.s
Normal file
File diff suppressed because it is too large
Load Diff
@ -2,6 +2,10 @@ import sys, os,binascii, struct
|
||||
addr = sys.argv[2]
|
||||
file = open(sys.argv[1],'rb')
|
||||
|
||||
specificOvl = ""
|
||||
|
||||
if len(sys.argv) == 4:
|
||||
specificOvl = sys.argv[3]
|
||||
|
||||
filebuf = file.read()
|
||||
print(".include \"macros.inc\"")
|
||||
@ -9,7 +13,7 @@ print(".section .data")
|
||||
rom = 0
|
||||
while rom < len(filebuf):
|
||||
myData = filebuf[rom:rom+4]
|
||||
print("glabel D_"+ str(hex(int(addr,16)+rom))[2:].upper()+
|
||||
print("glabel D_"+ str(hex(int(addr,16)+rom))[2:].upper()+ specificOvl+
|
||||
"\n.word 0x"+str(binascii.hexlify(filebuf[rom:rom+4]))[2:-1].upper()
|
||||
)
|
||||
testFloat = str(struct.unpack('>f', myData))
|
||||
|
83
include/prevent_bss_reordering.h
Normal file
83
include/prevent_bss_reordering.h
Normal file
@ -0,0 +1,83 @@
|
||||
#ifndef PREVENT_BSS_REORDERING_H
|
||||
#define PREVENT_BSS_REORDERING_H
|
||||
|
||||
/**
|
||||
* To determine variable order for .bss, the compiler sorts variables by their
|
||||
* "name index" mod 256, where name index is something that, with -g, gets
|
||||
* incremented by struct and variable declarations, typedefs, and file markers,
|
||||
* among else. (Without -g, only variable declarations affects the index.)
|
||||
* This file contains enough dummy declarations to bump the index by 128.
|
||||
* Including it, or removing the include, should fix bss reordering problems
|
||||
* for a file, assuming the name index distance between its first and last bss
|
||||
* variable is at most 128.
|
||||
* Note that if a variable is declared "extern" within a header file, the name
|
||||
* index is taken at that point of the extern declaration. Thus, this include
|
||||
* must come before any such header.
|
||||
*/
|
||||
|
||||
struct Dummy0 { int x; };
|
||||
struct Dummy1 { int x; };
|
||||
struct Dummy2 { int x; };
|
||||
struct Dummy3 { int x; };
|
||||
struct Dummy4 { int x; };
|
||||
struct Dummy5 { int x; };
|
||||
struct Dummy6 { int x; };
|
||||
struct Dummy7 { int x; };
|
||||
struct Dummy8 { int x; };
|
||||
struct Dummy9 { int x; };
|
||||
struct Dummy10 { int x; };
|
||||
struct Dummy11 { int x; };
|
||||
struct Dummy12 { int x; };
|
||||
struct Dummy13 { int x; };
|
||||
struct Dummy14 { int x; };
|
||||
struct Dummy15 { int x; };
|
||||
struct Dummy16 { int x; };
|
||||
struct Dummy17 { int x; };
|
||||
struct Dummy18 { int x; };
|
||||
struct Dummy19 { int x; };
|
||||
struct Dummy20 { int x; };
|
||||
struct Dummy21 { int x; };
|
||||
struct Dummy22 { int x; };
|
||||
struct Dummy23 { int x; };
|
||||
struct Dummy24 { int x; };
|
||||
struct Dummy25 { int x; };
|
||||
struct Dummy26 { int x; };
|
||||
struct Dummy27 { int x; };
|
||||
struct Dummy28 { int x; };
|
||||
struct Dummy29 { int x; };
|
||||
struct Dummy30 { int x; };
|
||||
struct Dummy31 { int x; };
|
||||
struct Dummy32 { int x; };
|
||||
struct Dummy33 { int x; };
|
||||
struct Dummy34 { int x; };
|
||||
struct Dummy35 { int x; };
|
||||
struct Dummy36 { int x; };
|
||||
struct Dummy37 { int x; };
|
||||
struct Dummy38 { int x; };
|
||||
struct Dummy39 { int x; };
|
||||
struct Dummy40 { int x; };
|
||||
struct Dummy41 { int x; };
|
||||
struct Dummy42 { int x; };
|
||||
struct Dummy43 { int x; };
|
||||
struct Dummy44 { int x; };
|
||||
struct Dummy45 { int x; };
|
||||
struct Dummy46 { int x; };
|
||||
struct Dummy47 { int x; };
|
||||
struct Dummy48 { int x; };
|
||||
struct Dummy49 { int x; };
|
||||
struct Dummy50 { int x; };
|
||||
struct Dummy51 { int x; };
|
||||
struct Dummy52 { int x; };
|
||||
struct Dummy53 { int x; };
|
||||
struct Dummy54 { int x; };
|
||||
struct Dummy55 { int x; };
|
||||
struct Dummy56 { int x; };
|
||||
struct Dummy57 { int x; };
|
||||
struct Dummy58 { int x; };
|
||||
struct Dummy59 { int x; };
|
||||
struct Dummy60 { int x; };
|
||||
struct Dummy61 { int x; };
|
||||
struct Dummy62 { int x; };
|
||||
typedef int Dummy63;
|
||||
|
||||
#endif // PREVENT_BSS_REORDERING_H
|
@ -80,12 +80,12 @@ SECTIONS
|
||||
BUILD_DIR/asm/ovl1/ovl1_13.o(.text);
|
||||
}
|
||||
END_SEG(ovl1)
|
||||
BEGIN_SEG(ovl1Data, ) {
|
||||
BEGIN_SEG(ovl1Data, 0x800BE3E0) {
|
||||
BUILD_DIR/data/kirby.066630.o(.data);
|
||||
}
|
||||
END_SEG(ovl1Data)
|
||||
BEGIN_NOLOAD(ovl1) {
|
||||
BUILD_DIR/asm/ovl1/ovl1.o(.bss);
|
||||
BUILD_DIR/asm/ovl1/ovl1_bss.o(.bss);
|
||||
}
|
||||
END_NOLOAD(ovl1)
|
||||
|
||||
@ -122,8 +122,13 @@ SECTIONS
|
||||
/* 0x80151100 0F8630-1014F0 [8EC0] */
|
||||
BEGIN_SEG(ovl4, 0x80151100) {
|
||||
BUILD_DIR/asm/ovl4/ovl4.o(.text);
|
||||
BUILD_DIR/data/kirby.1014F0.o(.data);
|
||||
}
|
||||
END_SEG(ovl4)
|
||||
BEGIN_NOLOAD(ovl4) {
|
||||
BUILD_DIR/src/ovl4/ovl4_bss.o(.bss);
|
||||
}
|
||||
END_NOLOAD(ovl4)
|
||||
|
||||
/* 0x8015C740 103BB0-12D410 [29860] */
|
||||
BEGIN_SEG(ovl5, 0x8015C740) {
|
||||
|
89
src/ovl4/ovl4_bss.c
Normal file
89
src/ovl4/ovl4_bss.c
Normal file
@ -0,0 +1,89 @@
|
||||
#include <ultra64.h>
|
||||
u32 D_8015C680;
|
||||
|
||||
u32 D_8015C684;
|
||||
|
||||
u32 D_8015C688;
|
||||
|
||||
u32 D_8015C68C;
|
||||
|
||||
u32 D_8015C690;
|
||||
|
||||
u32 D_8015C694;
|
||||
|
||||
u32 D_8015C698;
|
||||
|
||||
u32 D_8015C69C;
|
||||
|
||||
u32 D_8015C6A0;
|
||||
|
||||
u32 D_8015C6A4;
|
||||
|
||||
u32 D_8015C6A8;
|
||||
|
||||
u32 D_8015C6AC;
|
||||
|
||||
u32 D_8015C6B0;
|
||||
|
||||
u32 D_8015C6B4;
|
||||
|
||||
u32 D_8015C6B8;
|
||||
|
||||
u32 D_8015C6BC;
|
||||
|
||||
u32 D_8015C6C0;
|
||||
|
||||
u32 D_8015C6C4;
|
||||
|
||||
u32 D_8015C6C8;
|
||||
|
||||
u32 D_8015C6CC;
|
||||
|
||||
u32 D_8015C6D0;
|
||||
|
||||
u32 D_8015C6D4;
|
||||
|
||||
u32 D_8015C6D8;
|
||||
|
||||
u32 D_8015C6DC;
|
||||
|
||||
u32 D_8015C6E0;
|
||||
|
||||
u32 D_8015C6E4;
|
||||
|
||||
u32 D_8015C6E8;
|
||||
|
||||
u32 D_8015C6EC;
|
||||
|
||||
u32 D_8015C6F0;
|
||||
|
||||
u32 D_8015C6F4;
|
||||
|
||||
u32 D_8015C6F8;
|
||||
|
||||
u32 D_8015C6FC;
|
||||
|
||||
u32 D_8015C700;
|
||||
|
||||
u32 D_8015C704;
|
||||
|
||||
u32 D_8015C708;
|
||||
|
||||
u32 D_8015C70C;
|
||||
|
||||
u32 D_8015C710;
|
||||
|
||||
u32 D_8015C714;
|
||||
|
||||
u32 D_8015C718;
|
||||
|
||||
u32 D_8015C71C;
|
||||
|
||||
u32 D_8015C720;
|
||||
|
||||
u32 D_8015C724;
|
||||
|
||||
u32 D_8015C728;
|
||||
|
||||
u32 D_8015C72C;
|
||||
|
22
tools/generate_bss.py
Normal file
22
tools/generate_bss.py
Normal file
@ -0,0 +1,22 @@
|
||||
# TODO: make it either gen small files, or cheat with .data lol
|
||||
import sys, os,binascii, struct
|
||||
addrEnd = int(sys.argv[3], 16)
|
||||
addrStart = int(sys.argv[2], 16)
|
||||
|
||||
specificOvl = ""
|
||||
|
||||
|
||||
bssLimit = 0
|
||||
numFiles = 0
|
||||
f = open(sys.argv[1]+"_bss.s", "w+")
|
||||
f.write(".include \"macros.inc\"\n")
|
||||
# f.write("#include \"prevent_bss_reordering.h\"\n")
|
||||
while addrStart < addrEnd:
|
||||
f.write("glabel D_"+ str(hex(addrStart))[2:].upper()+ specificOvl+"\n.word 0x00000000\n\n")
|
||||
addrStart+=4
|
||||
bssLimit+=1
|
||||
# if bssLimit > 125:
|
||||
# numFiles+=1
|
||||
# bssLimit = 0
|
||||
# f.close()
|
||||
# f = open(sys.argv[1]+"_bss"+str(numFiles)+".c", "w+")
|
16
tools/scrub_undefined_syms.py
Normal file
16
tools/scrub_undefined_syms.py
Normal file
@ -0,0 +1,16 @@
|
||||
import sys, os
|
||||
|
||||
f = open("undefined_syms.txt", 'r')
|
||||
fl = f.readlines()
|
||||
f.close()
|
||||
|
||||
with open(sys.argv[1]) as f:
|
||||
for line in f:
|
||||
if len(line.split()) > 0:
|
||||
sym = line.split()[1][:-1]
|
||||
# for usym in fl:
|
||||
# if sym in usym:
|
||||
|
||||
print(sym)
|
||||
|
||||
# print(fl)
|
@ -9,6 +9,8 @@ checking_symbols = [
|
||||
"sw",
|
||||
"sb",
|
||||
"sh",
|
||||
"ld",
|
||||
"sd"
|
||||
]
|
||||
|
||||
stagedRegs = {}
|
||||
@ -90,5 +92,6 @@ for i in sys.argv[1:]: # xargs support lul
|
||||
# print(line[:-1], "bruh", lineList[lineNum])
|
||||
lineNum-=1
|
||||
e = open(sys.argv[1], 'w')
|
||||
print(''.join(lineList[::-1]))
|
||||
e.write(''.join(lineList[::-1]))
|
||||
e.close()
|
||||
stagedRegs = {}
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user