Skip to content

Instantly share code, notes, and snippets.

Avatar

Pokechu22 Pokechu22

View GitHub Profile
View SkywardSwordMap.md

Preliminaries

The fifolog in question is ss-map, downloadable here. I will be discussing only the green part of the map, but all of the main parts of the map render the same way (with the main configuration happening in object 1). The objects in question are: 1: Brown (pathways); 2: dark brown (rocks?); 3: yellow (sand); 4: green (grass); 6: dark green (unknown, not much uses this); 6: grey (stone); 7: red (roof); 8: brown (roof). Object 9, water, has its own configuration which I haven't investigated, but the water seems to all be at the same elevation anyways.

The border shadows around the map are also dynamically generated; they use EFB copies. The relevant objects are currently numbered 16 and 17 as of Dolphin 5.0-14344, and their vertex data is at offsets 00047466 and 000476d5 respectively.

Texture coordinates

Relevant data
View CoordWrapTest.c
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <math.h>
#include <gccore.h>
#include <fat.h>
#include <time.h>
#include <sys/stat.h>
View AddCoordTest.c
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <math.h>
#include <gccore.h>
#include <fat.h>
#include <time.h>
#include <sys/stat.h>
@Pokechu22
Pokechu22 / IndTest.c
Last active Apr 17, 2021
Dolphin Luigi's Mansion portrait indirect texture issue
View IndTest.c
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <math.h>
#include <gccore.h>
#include <fat.h>
#include <time.h>
#include <sys/stat.h>
View README.md
@Pokechu22
Pokechu22 / Luigi1.md
Last active Apr 17, 2021
(Partically incorrect) notes while investigating the Luigi's Mansion portrait issue (https://bugs.dolphin-emu.org/issues/11462)
View Luigi1.md

The painting texture for Luigi's Mansion in JMC's FIFO on frame 0 is object 373 and 374. Object 373 shows Mario, while Object 374 shows Bowser; a lot of the early objects are rendering either Mario or Bowser (and both are rendered, even though Bowser only shows up in the ending cutscene). This is presumably done by fading BPMEM_TEV_COLOR_RA's alpha from 0xff to 0 for object 373 and from 0 to 0xff for object 374; it is at 0 for 374 in the given frame in any case.

I dumped textures while using playing back the FIFO using the software renderer, and got tar364_stage0_map0_mip0.png, tar365_stage0_map0_mip0.png, and tar364_ind0_map1_mip0.png (and an identical copy as tar365_ind0_map1_mip0.png). Although that last file may appear invisible, it has contents; its

@Pokechu22
Pokechu22 / ARM_Starlet.slaspec
Last active Mar 21, 2021
Ghidra Starlet (Wii IOS) processor spec - place these files in Processors/ARM/data/languages
View ARM_Starlet.slaspec
@define ENDIAN "big"
@define T_VARIANT ""
@define VERSION_5 ""
@define VERSION_5E ""
@include "ARM.sinc"
# Hacky because we can't define a new token for bits 5-15 since sleigh doesn't
# allow adding new fields to the instrArm token
ioscallnum: value is c0507 & c0811 & c1212 & c1313 & c1414=0 & c1515=0
@Pokechu22
Pokechu22 / DebugCubeExperiments.md
Last active Jun 10, 2021
Investigations into the Super Mario Sunshine debug cubes issue
View DebugCubeExperiments.md

This started as a random patch to Dolphin's software renderer that fixed the "debug cubes" in Super Mario Sunshine (issue 8059) without causing the bridge in a custom Mario Kart Wii track to disappear (issue 12379) or breaking the reflections in one Super Monkey Ball stage (issue 12366). The patch itself seems to be wrong on later testing, but I'm still using this gist to document my research here.

Note that this is mostly just personal notes, and there's no guarantee that anything is correct (much of this is speculation that I later prove wrong). I've avoided editing older comments to correct them, and there may be silly mistakes there that I've since found (usually noted in the next update).

View NormalizeTest.c
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <math.h>
#include <gccore.h>
#include <ogc/tpl.h>
@Pokechu22
Pokechu22 / applyEntityCollision.java
Last active Apr 17, 2021
Minecraft entity collision logic (simplified)
View applyEntityCollision.java
public class Entity {
public void applyEntityCollision(Entity other) {
double dx = other.posX - this.posX;
double dz = other.posZ - this.posZ;
double largestDistance = Math.max(Math.abs(dx), Math.abs(dz));
if (largestDistance >= 0.01) {
double vx = dx / 20;
double vz = dz / 20;
if (largestDistance < 1) {