Homebrew Question How to find offsets for IPS / exeFS patches?

lingi

New Member
OP
Newbie
Joined
Dec 7, 2020
Messages
1
Trophies
0
Age
28
XP
57
Country
United States
I am trying to create an exeFS patch for Dark Souls Remastered. I extracted main from the NCAs and then converted it to an ELF with nx2elf.

The problem is, this ELF file is different from the ELF file produced by nsnsotool, hactool, or Ghidra. Which one of these produces the correct file? And do I need to add 0x100 to account for the NSO header?
 

Draxzelex

Well-Known Member
Member
Joined
Aug 6, 2017
Messages
19,012
Trophies
2
Age
29
Location
New York City
XP
13,394
Country
United States
I am trying to create an exeFS patch for Dark Souls Remastered. I extracted main from the NCAs and then converted it to an ELF with nx2elf.

The problem is, this ELF file is different from the ELF file produced by nsnsotool, hactool, or Ghidra. Which one of these produces the correct file? And do I need to add 0x100 to account for the NSO header?
First, you can't bump your threads. Secondly, the first ELF file seems appropriate.
 

masagrator

The patches guy
Developer
Joined
Oct 14, 2018
Messages
6,287
Trophies
3
XP
12,065
Country
Poland
You don't need to convert them to elf (even you shouldn't because some info won't be parsed by standard elf loader). If you are using Ghidra, download ghidra switch loader.
And with main loaded via ghidra switch loader you need to get last 4 bytes of offset and add 0x100, this will be offset to use within ips32
 
Last edited by masagrator,
  • Like
Reactions: 8BitWonder

thethiny

Well-Known Member
Member
Joined
Jun 18, 2009
Messages
137
Trophies
0
XP
253
Country
United States
You don't need to convert them to elf (even you shouldn't because some info won't be parsed by standard elf loader). If you are using Ghidra, download ghidra switch loader.
And with main loaded via ghidra switch loader you need to get last 4 bytes of offset and add 0x100, this will be offset to use within ips32
Hi, sorry to bump a relatively old thread, but I cannot run Ghidra due to multiple JDK & Gradle issues, and also I don't know how to use it at all, as I'm an IDA person. I'm trying to create a pchtxt / ips patch for super mario odyssey, but I noticed that the nso header is actually 0x101 in length, and not 0x100, which is making me confused. I'm using Nintendo Switch Loader for IDA currently. I am wondering how to get the address from IDA into an IPS patch. I know about adding 100 to the offset, but I'm not sure it's the right thing, since I'm intentionally writing bad opcodes and yet the game is still booting. Example: IDA shows that at 0x710020976C there's a function called ShopItem::getPrice(int), and if I create an IPS patch / IPSwitch pchtxt at addresses 0020976C, or 0020986C, or 0020966C, the game still functions normally as if no adjustments were made. I have no way of verifying (in Yuzu) that the patch applied other than the UI showing a ✔ next to it. Any insight on this as I'm currently trying to make a simple mod just to understand how switch mods work.

my current pchtxt file:
pchtxt said:
@nsobid-B424BE150A8E7D78701CBE7A439D9EBF00000000

@flag print_values
@flag offset_shift 0x100

// Free Shop Items @ 710020976C
@enabled
0020966C 000080D2
00209670 C0035FD6
0020976C 000080D2
00209770 C0035FD6
0020986C 000080D2
00209870 C0035FD6
 
  • Like
Reactions: Imancol

Imancol

Otak Productions
Member
Joined
Jun 29, 2017
Messages
1,376
Trophies
0
XP
2,766
Country
Colombia
Hi, sorry to bump a relatively old thread, but I cannot run Ghidra due to multiple JDK & Gradle issues, and also I don't know how to use it at all, as I'm an IDA person. I'm trying to create a pchtxt / ips patch for super mario odyssey, but I noticed that the nso header is actually 0x101 in length, and not 0x100, which is making me confused. I'm using Nintendo Switch Loader for IDA currently. I am wondering how to get the address from IDA into an IPS patch. I know about adding 100 to the offset, but I'm not sure it's the right thing, since I'm intentionally writing bad opcodes and yet the game is still booting. Example: IDA shows that at 0x710020976C there's a function called ShopItem::getPrice(int), and if I create an IPS patch / IPSwitch pchtxt at addresses 0020976C, or 0020986C, or 0020966C, the game still functions normally as if no adjustments were made. I have no way of verifying (in Yuzu) that the patch applied other than the UI showing a ✔ next to it. Any insight on this as I'm currently trying to make a simple mod just to understand how switch mods work.

my current pchtxt file:
I love IDA, for its intuitive interface and the most precise search. But it hurts that the module is so outdated. I am also interested in knowing how to build Main.
 

masagrator

The patches guy
Developer
Joined
Oct 14, 2018
Messages
6,287
Trophies
3
XP
12,065
Country
Poland
but I noticed that the nso header is actually 0x101 in length,
This is wrong. This happens if you are using main decompressed with tool not designed to use its output in disassembler. For example nsnsotool. Use main compressed directly or decompress it with hactool.
I don't know how pchtxt patches are working, so can't help with that.
 

thethiny

Well-Known Member
Member
Joined
Jun 18, 2009
Messages
137
Trophies
0
XP
253
Country
United States
This is wrong. This happens if you are using main decompressed with tool not designed to use its output in disassembler. For example nsnsotool. Use main compressed directly or decompress it with hactool.
I don't know how pchtxt patches are working, so can't help with that.
Yes I am using nsnsotool. Thank you I will use hactool now.
edit: been trying for a while now and cant figure out how to decompress the main using hactool. I extracted everythjing and everything is working but the main is compressed. Can u give me example on how t odecompress using hactool?
 
Last edited by thethiny,

hippy dave

BBMB
Member
Joined
Apr 30, 2012
Messages
9,886
Trophies
2
XP
29,357
Country
United Kingdom
Yes I am using nsnsotool. Thank you I will use hactool now.
edit: been trying for a while now and cant figure out how to decompress the main using hactool. I extracted everythjing and everything is working but the main is compressed. Can u give me example on how t odecompress using hactool?
Not in front of my computer, but looks like it should be something like:

hactool -x -t nso0 --uncompressed=main.uncompressed main
 
  • Like
Reactions: thethiny

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • K3Nv2 @ K3Nv2:
    I think I did then it broke a few months later
  • Psionic Roshambo @ Psionic Roshambo:
    Used it as a web cam for a day for fun, sooo shitty it was hilarious
  • Psionic Roshambo @ Psionic Roshambo:
    I had two Ken one regular black one and a silver special edition one lol
  • K3Nv2 @ K3Nv2:
    Speaking of old stuff those green og Logitech Xbox controllers still being listed around $100
  • The Real Jdbye @ The Real Jdbye:
    eyetoy was fun yeah
  • The Real Jdbye @ The Real Jdbye:
    super basic, but the minigames were well designed
  • The Real Jdbye @ The Real Jdbye:
    i'm sure there's at least 1 emulator out there that works with it
  • Psionic Roshambo @ Psionic Roshambo:
    I had the PS3 one too and The Eye of Judgement game lol was ass
  • The Real Jdbye @ The Real Jdbye:
    i had eye toy play on ps2
  • K3Nv2 @ K3Nv2:
    Microsoft ruined it with kinect
  • Psionic Roshambo @ Psionic Roshambo:
    @The Real Jdbye, PCSX2 works with any web cam and emulates the EyeToy with it
  • K3Nv2 @ K3Nv2:
    I remember mic support for the n64 being janky
  • K3Nv2 @ K3Nv2:
    Emulation wise
  • Psionic Roshambo @ Psionic Roshambo:
    I had a kinnect.... It blew rotting goat balls
  • Psionic Roshambo @ Psionic Roshambo:
    Ken amazingly DraStic microphone support works better than real hardware lol
  • Psionic Roshambo @ Psionic Roshambo:
    On a phone of course
  • Psionic Roshambo @ Psionic Roshambo:
    Also touch is better.... Well at least better than the launch DS, the lite one improved that a ton
  • K3Nv2 @ K3Nv2:
    Touch
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    I really need to dig out my USB Wii sensor bar and experiment with Wii emulation and synching Wii remotes with BT lol
  • Psionic Roshambo @ Psionic Roshambo:
    Sort of redundant since I have a Wii lol
  • Psionic Roshambo @ Psionic Roshambo:
    With HDMI lol
  • K3Nv2 @ K3Nv2:
    I also have a Wii
  • K3Nv2 @ K3Nv2:
    Tomorrow be may 4th
  • Psionic Roshambo @ Psionic Roshambo:
    Getting Wiid from Street Pharmacist Mario?
  • K3Nv2 @ K3Nv2:
    1tb SD card for whatever reason
    K3Nv2 @ K3Nv2: 1tb SD card for whatever reason