Skip to content

Instantly share code, notes, and snippets.

View Pokechu22's full-sized avatar

Pokechu22 Pokechu22

View GitHub Profile
@Pokechu22
Pokechu22 / ARM_Starlet.slaspec
Last active April 18, 2024 22:36
Ghidra Starlet (Wii IOS) processor spec - place these files in Processors/ARM/data/languages
@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 / Setting up MCP without a full MCP release.md
Last active March 31, 2024 21:35
Setting up MCP for newer versions (e.g. 1.12.2)

It's possible to use create an MCP installation for versions of Minecraft where there hasn't been a full MCP release. It takes a little bit of manual setup, but the end result is highly useful.

  1. Download and extract the most recent MCP build from http://www.modcoderpack.com/. (Currently, the latest build is http://www.modcoderpack.com/files/mcp940.zip)

  2. Edit version.cfg in the conf folder, and change ClientVersion and ServerVersion to the version you want (for instance, 1.12.2).

  3. Download the SRG zip for the version you want; these can generally be found at http://mcpbot.bspk.rs/mcp/<version>/mcp-<version>-srg.zip (for example, http://mcpbot.bspk.rs/mcp/1.11.2/mcp-1.11.2-srg.zip) or at http://files.minecraftforge.net/maven/de/oceanlabs/mcp/mcp/<version>/mcp-<version>-srg.zip (for example, http://files.minecraftforge.net/maven/de/oceanlabs/mcp/mcp/1.12.2/mcp-1.12.2-srg.zip). (For 1.12.1 and 1.12.2, only the minecraftforge link works)

  4. Extract that zip into the MCP conf folder, over

@Pokechu22
Pokechu22 / PBR.md
Last active February 21, 2024 12:14
Pokémon Battle Revolution graphical glitch writeup

Pokémon Battle Revolution had an issue where certain effects (those that distort the camera) caused the entire screen to shift slightly.

This writeup mainly analyzes the psycho cut fifolog (from issue 12629, though the actual issue is described in issue 11875).

How the effects render

All of the effects work using indirect textures. First, the game draws the main environment (see ZPBR_Psy_base_new.png and ZPBR_Rain_base_new.png). Then, it makes an EFB copy, and clears the screen (but not the depth buffer). It then draws a second effect, which will serve as an offset to the screen (see ZPBR_Psy_indirect.png and ZPBR_Rain_indirect.png). This might be drawn in 3D space (as with the energy pattern used by Psycho Cut) or it might be drawn in 2D

@Pokechu22
Pokechu22 / gen_rev_list.py
Created December 8, 2022 19:09
Generate list of revision URLs from a mediawiki dump
import sys
with open(sys.argv[1]) as fin:
lines = fin.readlines()
INDEX_URL = sys.argv[2]
TITLE_PREFIX = ' <title>'
TITLE_SUFFIX = '</title>\n'
REV_PREFIX = ' <id>'

Datel titles previously crashed when booting them with Dolphin's skip GameCube menu option was enabled. What exactly caused this crash?

Well, the original bug report from 7 years ago is titled "Datel AGP requires default exception handlers" (where AGP refers to Advance Game Port, but this issue applies to all Datel products), and its full text is this:

The game doesn't install exception handlers on boot like regular games that use the Nintendo SDK.
It instead relies on the handlers that the IPL install upon boot.
It does something odd that involves hitting the exception handlers that needs to be investigated.
Our non-IPL path doesn't install default handlers, but it may end up needing to do so at some point in order to properly support this game.
Since we don't only install a couple exception handlers that only do an rfi the game doesn't continue very far in the boot process withou

@Pokechu22
Pokechu22 / applyEntityCollision.java
Last active June 26, 2022 18:29
Minecraft entity collision logic (simplified)
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) {
@Pokechu22
Pokechu22 / Major Minor 1.md
Last active May 17, 2022 20:10
Messy Major Minor's Majestic March notes

Major minor: at one point in the tutorial, the screen does get greyed out, even with Dolphin's broken rendering. That's a starting point to figure out why things broke.

EID 611 - the scissor region is over the screen in that case, but not in the others. Obj 232, which renders:

BP register BPMEM_SCISSOROFFSET
Scissor X offset: 171
Scissor Y offset: 171
@Pokechu22
Pokechu22 / Alpha.png
Last active May 17, 2022 06:14
Embossing demo (based on lesson08)
Alpha.png
@Pokechu22
Pokechu22 / RS2_BumpMapping1.md
Last active May 4, 2022 01:01
Various notes about the bumpmapping effects in Star Wars Rogue Squadron II: Rogue Leader (and to a lesser extent Rogue Squadron III: Rebel Strike), along with various contemporary sources

RS2 bump, Object 12. (object 11 is zfreeze-related, though I don't think it actually ends up mattering since object 12 doesn't use zfreeze)

CP register ARRAY_BASE Array Position (0)
Base address 01481980
CP register ARRAY_STRIDE Array Position (0)
Stride 0b
CP register ARRAY_BASE Array Color 0 (2)
Base address 01481984
CP register ARRAY_STRIDE Array Color 0 (2)
@Pokechu22
Pokechu22 / Rygar.md
Last active May 2, 2022 21:10
Rygar: The Battle of Argus bloom writeup

Rygar: The Battle of Argus (a port of the PS2 game Rygar: The Legendary Adventure) has a broken bloom effect. In Dolphin, the bloom effect results in the top-left part of the screen being drawn over the entire screen. If the top-left part of the screen is particularly bright, then the whole screen will end up being white.

This writeup analyzes the RygarBloom2.dff fifolog on issue 12763.

First bloom step

EFB copy 4, 5, and 6 are relevant; however, EFB copy 6 is only for restoring the previous screen state and can mostly be ignored. After those EFB copies is object 268, which handles combining the earlier EFB copies and is the start of the bloom logic. EFB copy 7 makes a copy of the area that was drawn to by object 268, which is used for further processing later on.

EFB copy 4 (00045a56)