libultra research
libultra research
I decompiled most of libultra here: https://github.com/ianwal/conker/tree/master_ianwall by using ultralib.
libultra Version
Conker's libultra version must be < VERSION_K. I haven't narrowed it down beyond that.
Symbol Addresses
Here are most of the US symbol addresses for libultra:
__osEnqueueAndYield = 0x100078B4;
__osEnqueueThread = 0x100079D8;
__osPopThread = 0x10007A24;
__osDispatchThread = 0x10007A38;
__osViGetCurrentContext = 0x10024400;
__osSiRawReadIo = 0x10026700;
__osSiRawWriteIo = 0x10026750;
__osPiRawReadIo = 0x100267a0;
osRomBase = 0x80000308;
__osEventStateTab = 0x80042910;
__osPfsPifRam = 0x800429D0;
siAccessBuf = 0x80042AA0;
__osSiAccessQueue = 0x80042AA8;
__osTimerList = 0x8002BD70;
__osSiAccessQueueEnabled = 0x8002BE20;
LeoDiskHandle = 0x80043AC0;
__osDiskHandle = 0x80043B34;
tmp_task = 0x80036B60;
__osPiTable = 0x8002AB6C;
__osHwIntTable = 0x8002AC70;
__OSGlobalIntMask = 0x8002BD1C;
__osThreadTail = 0x8002BDF0;
__osRunQueue = 0x8002BDF8;
__osFaultedThread = 0x8002BE04;
__osViCurr = 0x8002BDE0;
__osViNext = 0x8002BDE4;
__osPiDevMgr = 0x8002AB50;
piAccessBuf = 0x800428F0;
piEventBuf = 0x80036B58;
Mislabeled SP splits
I'm almost certain that sprawread and sprawwrite files are mislabeled in the current US YAML, and they are actually sirawread and sirawwrite. They are very similar functions, except __osSiDeviceBusy is called in the si versions, and __osSpDeviceBusy is called in the sp versions.
I was able to match them as sirawread and sirawwrite.
Compiler Flags
Compiler flags I discovered for matched files. These might be useful in identifying the specific libultra version.
$(BUILD_DIR)/$(SRC_DIR)/libultra/libc/%.c.o: OPT_FLAGS := -O3
# TODO: This file should be -O3, but strchr doesn't match for some reason and asm-processor doesn't work with -O3.
$(BUILD_DIR)/$(SRC_DIR)/libultra/libc/string.c.o: OPT_FLAGS := -O2
$(BUILD_DIR)/$(SRC_DIR)/libultra/libc/ll.c.o: OPT_FLAGS := -O1
# $(BUILD_DIR)/$(SRC_DIR)/libultra/libc/ll.c.o: MIPSBIT := -mips3 -o32
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/ai.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/aigetstat.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/aisetfreq.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/crc.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/contpfs.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/contpfs2.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/epirawdma.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/leodiskinit.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/pfschecker.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/pfsisplug.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/pidma.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/pigetcmdq.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/pigetstat.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/pirawread.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/pirawdma.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/si.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/sp.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/spgetstat.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/siacs.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/sirawdma.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/sirawdma2.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/sirawread.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/sirawwrite.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/sprawdma.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/spsetpc.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/spsetstat.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/sptaskyield.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/sptaskyielded.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/viblack.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/vigetcurrcontext.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/vigetcurrframebuf.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/vigetnextframebuf.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/visetevent.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/visetmode.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/io/viswapbuf.c.o: OPT_FLAGS := -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/os/%.c.o: OPT_FLAGS = -O1
$(BUILD_DIR)/$(SRC_DIR)/libultra/os/createthread.c.o: OPT_FLAGS := -O2 -g3
$(BUILD_DIR)/$(SRC_DIR)/libultra/os/viswapcontext.c.o: OPT_FLAGS := -O1
Thanks for doing this. I have started a rewrite of the yamls from scratch, (init, game, debugger) with the view that a clean slate approach is easier than reworking the existing stuff. Matched functions can be transplanted in. I'm linking against a libultra_rom.a where I can, but there's not a G or H version available as far as I can see (also concur with your < J, actually think it's < I based on trying to use I for some of the functions.
It looks like Rare must have had access to the source for a decent amount of libultra (a handful of functions have been modified and compiled with -O2 -g3, and all the audio is compiled with -g which should make it easier to match as/when someone takes that on).
Other than that I'm hoping I can merge the "init" piece (still plenty of work to do) first, and then look at game and debugger...