Skip to content

Commit

Permalink
-corrected CC l/r swap patches
Browse files Browse the repository at this point in the history
-renamed wiimote patch from -vertical to -horizontal to properly reflect what it does
  • Loading branch information
FIX94 committed Oct 27, 2017
1 parent 5c5724a commit b47a6bb
Showing 1 changed file with 25 additions and 14 deletions.
39 changes: 25 additions & 14 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ public static int checkArgs(string[] args)
map_shoulder_to_trigger = true;
break;
case "-wiimote":
horiz_wiimote = true;
break;
case "-vertical":
vert_wiimote = true;
break;
case "-horizontal":
horiz_wiimote = true;
break;
case "-homebrew":
homebrew = true;
break;
Expand All @@ -142,7 +142,7 @@ public static int checkArgs(string[] args)
break;

case "-help":
Console.WriteLine("+++++ NFS2ISO2NFS v0.5.5 +++++");
Console.WriteLine("+++++ NFS2ISO2NFS v0.5.6 +++++");
Console.WriteLine();
Console.WriteLine("-dec Decrypt .nfs files to an .iso file.");
Console.WriteLine("-enc Encrypt an .iso file to .nfs file(s)");
Expand All @@ -155,7 +155,7 @@ public static int checkArgs(string[] args)
Console.WriteLine("-legit Don't patch fw.img to allow fakesigned content");
Console.WriteLine("-lrpatch Map emulated Classic Controller's L & R to Gamepad's ZL & ZR");
Console.WriteLine("-wiimote Emulate a Wii Remote instead of the Classic Controller");
Console.WriteLine("-vertical Remap Wii Remote d-pad for vertical usage (implies -wiimote)");
Console.WriteLine("-horizontal Remap Wii Remote d-pad for horizontal usage (implies -wiimote)");
Console.WriteLine("-homebrew Various patches to enable proper homebrew functionality");
Console.WriteLine("-passthrough Allow homebrew to keep using normal wiimotes with gamepad enabled");
Console.WriteLine("-instantcc Report emulated Classic Controller at the very first check");
Expand Down Expand Up @@ -929,11 +929,14 @@ public static void DoThePatching(string fw_file)
byte[] pattern2 = { 0x1C, 0x05, 0x40, 0x35 };
byte[] patch2 = { 0x25, 0x40, 0x40, 0x05 };

byte[] pattern3 = { 0x46, 0x53, 0x42, 0x18 };
byte[] patch3 = { 0x23, 0x10, 0x40, 0x03 };
byte[] pattern3 = { 0x23, 0x7F, 0x1C, 0x02 };
byte[] patch3 = { 0x46, 0xB1, 0x23, 0x20, 0x40, 0x03 };

byte[] pattern4 = { 0x46, 0x53, 0x42, 0x18 };
byte[] patch4 = { 0x23, 0x10, 0x40, 0x03 };

byte[] pattern4 = { 0x1C, 0x05, 0x80, 0x22 };
byte[] patch4 = { 0x25, 0x40, 0x80, 0x22, 0x40, 0x05 };
byte[] pattern5 = { 0x1C, 0x05, 0x80, 0x22 };
byte[] patch5 = { 0x25, 0x40, 0x80, 0x22, 0x40, 0x05 };

for (int offset = 0; offset < input_ios.Length - 4; offset++)
{
Expand All @@ -959,15 +962,23 @@ public static void DoThePatching(string fw_file)
if (ByteArrayCompare(buffer_4, pattern3)) // see if it matches
{
input_ios.Seek(offset, SeekOrigin.Begin); // seek
input_ios.Write(patch3, 0, 4); // and then patch
input_ios.Write(patch3, 0, 6); // and then patch

patchCount++;
}

if (ByteArrayCompare(buffer_4, pattern4)) // see if it matches
{
input_ios.Seek(offset, SeekOrigin.Begin); // seek
input_ios.Write(patch4, 0, 6); // and then patch
input_ios.Write(patch4, 0, 4); // and then patch

patchCount++;
}

if (ByteArrayCompare(buffer_4, pattern5)) // see if it matches
{
input_ios.Seek(offset, SeekOrigin.Begin); // seek
input_ios.Write(patch5, 0, 6); // and then patch

patchCount++;
}
Expand Down Expand Up @@ -1015,7 +1026,7 @@ public static void DoThePatching(string fw_file)


//enable horizontal wii remote emulation (remap dpad and ab12)
if (vert_wiimote)
if (horiz_wiimote)
{
Array.Clear(buffer_8, 0, 8);
int patchCount = 0;
Expand Down Expand Up @@ -1065,9 +1076,9 @@ public static void DoThePatching(string fw_file)
}

if (patchCount == 0)
Console.WriteLine("Vertical Wii Remote patching: Nothing to patch.");
Console.WriteLine("Horizontal Wii Remote patching: Nothing to patch.");
else
Console.WriteLine("Vertical Wii Remote emulation enabled... (Patches applied: {0})", patchCount);
Console.WriteLine("Horizontal Wii Remote emulation enabled... (Patches applied: {0})", patchCount);

Console.WriteLine();
}
Expand Down

1 comment on commit b47a6bb

@cucholix
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it possible to make the L/R swap ZL/ZR patch the real Classic Controller too?

Please # to comment.