Dolphin/Wii VC thread
Users browsing this thread: 1 Guest(s)

So for the past few days I've been playing around trying to see what I could do with Virtual Console. Since I don't own a Wii console, I am doing all of my testing with the dolphin emulator. You can create ROM hacks that work with VC; Skelux got SM64 Multiplayer to work with it. However, I have found some limitations that makes it difficult to directly port hacks to VC. Now I have little to no experience with wads and wii hacking, so some of these issues might have an easy fix that I don't know about. I'll update this main post if there is a fix for any of these issues.

There are 3 main issues that I'm having with extended ROMS:
1.) No expansion pack support as far as I know.
2.) 32MB seems to be the maximum ROM size. I don't know if there is a larger .wad file than Sin and Punishment.
3.) Injecting a ROM into the wad seems to cause the dialog text to get messed up. This also happens when I try to inject the 8MB ROM as well. (see screenshots spoiler below)

The biggest issue being the lack of expansion pack support. I thought about using a Majora's Mask wad file, but that seems to have poor support with dolphin. Does anyone have any ideas?

Spoiler: Screenshots
[Image: 7D2cECR.png][Image: gTWpEH5.png]
Spoiler: ASM Code
.include "SM64Functions.txt"

// Reorganize Mario's behavior
.org 0x21CCC0 
hex

00 00 00 00 
10 05 00 00 
11 01 01 00 
11 03 00 01 
23 00 00 00 00 25 00 A0 
08 00 00 00
0C 00 00 00 80 29 CA 58
0C 00 00 00 80 2C B2 64
0C 00 00 00 80 3F 00 00
09 00 00 00 
}


// Overwriting part of the top levelscript to call a custom function
.org 0x108A18
hex
{
11 08 00 00 80 2C B1 C0 
}


//(802CB1C0) Function that will copy data from the ROM to the RAM
.org 0x861C0
ADDIU SP, SP, $FFE8
SW RA, $0014 (SP)
SW A0, $0010 (SP)
// lvl cmd 0x11 safeguard

// Do not remove these following 4 instructions
JAL @osViBlack
MOV A0, R0
LUI T0, 0x8039
SW R0, 0xBE24(T0)
// Set level accumulator to 0

LUI T0, 0x803F
ORI A0, T0, 0x0000
LUI T1, 0x01D0
ORI A1, T1, 0x0000
JAL @DmaCopy
ORI A2, T1, 0x1000

LW V0, $0010 (SP)
// lvl cmd 0x11 safeguard
LW RA, $0014 (SP)
JR RA
ADDIU SP, SP, $0018 

.org 0x1D00A00
.asciiz "Works with dolphin"

// Custom function in Mario's loop
.org 0x1D00000
ADDIU SP, SP, $FFE8
SW RA, $0014 (SP)

LUI A2, 0x803F
ORI A2, A2, 0x0A00
ORI A0, R0, 0x78
JAL @PrintXY
ORI A1, R0, 0x20

LW RA, $0014 (SP)
JR RA
ADDIU SP, SP, $0018 

Inspired by this post, I decided to take a crack at Wii WAD injection of SM64 hacks. With help from David and abitalive, I was able to make some progress. I tried two different programs for injection.

Auto Injectuwad Injector v3
Auto Injectuwad Injector v3 has a nice GUI and appears to work some of the time, but it is very inconsistent. Given the same set of input WAD and ROM files, it produces different output files. This can be seen by the md5sum sum being different and it doesn't respect the region specified, so Dolphin reports varying regions and tries to run it as a PAL WAD. Dolphin screenshot showing two different outputs given same inputs to Injectuwad:
[Image: 0IvtawB.png]

Devilken Injector
Devilken Injector is a bit harder to work with, but once you understand what inputs it's expecting, its outputs are consistent and I've been somewhat satisfied with the results. I was able to successfully inject the SM64 (U) stock ROM and a "Hello World" patched version of the ROM with it.

Devilken Injector Usage:
  1. copy Devilken Injector to a very short path location without space (e.g.: C:\VC\ )
  2. copy .wad file to C:\VC\ and make sure it doesn't have spaces in name
  3. make directory to hold N64 ROM (e.g.: C:\VC\SM64hack\ )
  4. copy .z64 ROM to C:\VC\SM64hack\ and make sure it doesn't have spaces in name
  5. open cmd prompt in C:\VC and run "vc.exe [WADFILE] [ROM_DIR]" (e.g.: "vc.exe OOT.wad SM64hack" )
  6. after dumping osme WAD information, it'll ask for region code, enter "1" for USA
  7. it'll then prompt for 4 character ID, just copy the old ID as prompted
  8. resulting WAD is title.wad

I tried the following WADs:
WADResult
Mario Kart 64Works well, up to 12MB ROMs
Sin & PunishmentWorks ok, with graphic glitches. Supports up to 32MB ROM
Super Mario 64Works well, but only with 8MB ROMs
Zelda: Ocarina of TimeWorks well, up to 32MB ROM

[Image: 8irZ3b1.png]

Spoiler: ASM Code
Code:
// SM64 (U) Hello World example using bass assembler
// overwrite the debug function 80253720/0E720 called from Mario's behavior

arch n64.cpu
endian msb
output "sm64.u.hello.z64", create

include "mips4300.inc"

// definitions
constant PrintXY(0x802D66C0)

origin 0x00000000
insert "sm64.u.z64"

// overwrite 80253720/0E720
origin 0x0E720
base   0x80253720
HelloWorld: {
  // increase stack and store return address
  addiu sp, sp, -0x18
  sw    ra, 0x14(sp)
  la    a2, hello_string // message location
  li    a0, 0xA0         // X position of text
  li    a1, 0x28         // Y position of text
  jal   PrintXY
  nop
  // restore return address and jump back
  lw    ra, 0x14(sp)
  jr    ra
  addiu sp, sp, 0x18
}
// ensure new code isn't too large
if pc() > 0x80253838 {
  error "code + data > 0x80253838"
}
fill 0x80253838-pc()

// store string in data section
origin 0xF1420
hello_string:
db "- Hello World -"


(29-04-2016, 01:29 AM)David Wrote: 2.) 32MB seems to be the maximum ROM size. I don't know if there is a larger .wad file than Sin and Punishment.
ergazoobi mentioned that Ogre Battle 64 is 40MB, so that might be the largest. I also have a sm64compress tool in progress that will compress the SM64 extended ROM by removing all the unused space between scripts and levels, so that may help as well. Its current form is only released as a tool to adjust the DMA offsets for console compatibility.

(29-04-2016, 01:29 AM)David Wrote: 3.) Injecting a ROM into the wad seems to cause the dialog text to get messed up. This also happens when I try to inject the 8MB ROM as well.
I had the same issues for Sin & Punishment. For 32MB, TLOT: Ocarina of Time seems like a better candidate since it doesn't have these text rendering issues.

(29-04-2016, 01:29 AM)David Wrote: 1.) No expansion pack support as far as I know.
The biggest issue being the lack of expansion pack support. I thought about using a Majora's Mask wad file, but that seems to have poor support with dolphin. Does anyone have any ideas?
TLOT: Majora's Mask definitely required the expansion pack on the N64. However, as you mentioned, I cannot even get the WAD to run in Dolphin before injecting so I cannot test it. That's the only WAD I know of that might support it.

ShowMiiWads can also do injection and I've had pretty good results.

(11-08-2016, 11:55 PM)abitalive Wrote: ShowMiiWads can also do injection and I've had pretty good results.

How do you inject the rom into the wad using it?


Also Devilken Injector download links are all dead.


The other injector has too many dependencies and I don't want to bother with all that.

If anyone has Devilken injector please reupload it.

Edit: The Devilken injector is on the last page of the thread in quotes.

[Image: GSpzRhB.gif]

This is what I get when injecting the rom hack into the wad.
(This post was last modified: 15-08-2016, 08:02 PM by Captain Buggy.)

(15-08-2016, 06:59 PM)Captain Buggy Wrote:
(11-08-2016, 11:55 PM)abitalive Wrote: ShowMiiWads can also do injection and I've had pretty good results.

How do you inject the rom into the wad using it?

I have yet to use ShowMiiWads, but this tutorial looks easy enough to follow: https://forums.dolphin-emu.org/Thread-howto-extract-rom-from-a-virtual-console-game

(15-08-2016, 06:59 PM)Captain Buggy Wrote: Also Devilken Injector download links are all dead.

Yeah, that's just not true. Read some of the recent posts in the Devilken Injector thread linked above.

(15-08-2016, 06:59 PM)Captain Buggy Wrote: [Image: GSpzRhB.gif]
This is what I get when injecting the rom hack into the wad.

I've seen stuff like this if the ROM I've injected mixed data in the same RAM regions as code. The ROM would run fine on N64 console, but die in VC WAD injection. Does your ROM hack do anything like this?

Dolphin/Wii VC thread
Users browsing this thread: 1 Guest(s)