Skip to content

Instantly share code, notes, and snippets.

View MBDesu's full-sized avatar

MBDesu

View GitHub Profile
@MBDesu
MBDesu / workflow.md
Last active May 19, 2023 17:15
ROM editing workflow

Prerequisites

  1. Be on Linux or WSL2 (you should really look into WSL2, it's kinda nice now?).
  2. Create this bash script somewhere. I made it. It's good. In the below output, it is named cps2util.sh but you can name it whatever you want. I don't care. Don't forget chmod +x
  3. Install unzip.
  4. Get the MAME Vsav Euro 970519 ROM (vsav.zip).
  5. Have git installed. You probably also want gcc and some other things. I dunno, dev stuff.
  6. Have basic dev skills, but also lots of familiarity with Vsav's code and M68K assembly. So maybe more than basic dev skills.

Editing rahash2 for Vsav

rahash2 is utilized by the script you got in step 2 to encrypt/decrypt CPS2 ROMs. Pof was kind enough to create a CPS2 plugin for rahash2, but its address range is wrong for Vsav. We're gonna have to fix that:

@MBDesu
MBDesu / mame-wsl.md
Last active May 2, 2023 16:20
Short and sweet guide to setting up a MAME build environment in WSL

Setting up a MAME build environment in WSL

In Windows:

  1. Install WSL2
  2. wsl --install Ubuntu and follow the prompts

In WSL:

  1. sudo apt-get update
  2. sudo apt-get install git build-essential python3 libsdl2-dev libsdl2-ttf-dev libfontconfig-dev libpulse-dev qtbase5-dev qtbase5-dev-tools qtchooser qt5-qmake gcc-12 g++-12
  3. sudo ln -sf /usr/bin/gcc-12 /usr/bin/gcc We must use GCC 12 because there's some bug with the custom GCC 11 that Ubuntu has by default that will cause you misery. So we update the symlink for gcc to point to gcc-12.
@MBDesu
MBDesu / vsav_dmg.c
Last active April 22, 2023 18:27
vsav damage calculation
// data tables are at the bottom
ushort Calculate_Damage(byte damage)
{
ushort new_damage;
PlayerData *opponent;
undefined *globals;
PlayerData *player;
short player_offset;
@MBDesu
MBDesu / gist:8df952266be50c020c8dcb891fad2455
Created April 18, 2023 13:52
vsav special move data structure accesses (1 execution)
Read @ 000944E4
0180B4: lea (A3,D0.w), A3
0180B8: move.b ($10,A3), D0
Read @ 000944D4
018124: bsr $19172
019172: move.w (A3), D0
Read @ 000944D8
0191A0: neg.w D1
param([AllowNull()][string] $path, $extension)
If($path -eq $null -or $extension -eq $null) {
echo ""
echo "Usage: .\sort.ps1 -path .\path\containing\files\to\sort\ -extension ext"
echo ""
echo "For example, if you wanted to sort txt files in .\test\, you would run:"
echo ".\sort.ps1 -path .\test\ -extension txt"
echo ""
exit