Detecting...

Discussion of hardware and software development for Super NES and Super Famicom.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Post Reply
LucianoTheWindowsFan
Posts: 28
Joined: Mon Jun 22, 2020 9:39 am

Detecting...

Post by LucianoTheWindowsFan » Sat Aug 29, 2020 4:09 pm

Hi, so I want to do something.
I used ca65 and need to detect if the values are correct, for example, I want to detect the string "Homebrew", if it is changed to something like "ROM Hack", it will not boot up, that forms the basis of an anti-piracy feature (which is unnecessary for homebrews but it is good to prevent people from "ROM hacking" homebrew).

User avatar
dougeff
Posts: 2735
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: Detecting...

Post by dougeff » Sat Aug 29, 2020 5:00 pm

Pointless. Someone can easily disable the code that checks the security tag.
nesdoug.com -- blog/tutorial on programming for the NES

LucianoTheWindowsFan
Posts: 28
Joined: Mon Jun 22, 2020 9:39 am

Re: Detecting...

Post by LucianoTheWindowsFan » Sat Aug 29, 2020 5:05 pm

dougeff wrote:
Sat Aug 29, 2020 5:00 pm
Pointless. Someone can easily disable the code that checks the security tag.
Alright, so I want to detect the header, if the internal name is not correct, then a message appears saying "It looks like you are playing the wrong game, right?".

User avatar
dougeff
Posts: 2735
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: Detecting...

Post by dougeff » Sat Aug 29, 2020 5:08 pm

You could do a checksum. Just add all the values of the header together with a loop, see if it == the correct value. If not, jump to an error screen.
nesdoug.com -- blog/tutorial on programming for the NES

lidnariq
Posts: 9659
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Detecting...

Post by lidnariq » Sat Aug 29, 2020 5:13 pm

Modern debugging emulators are good enough that this won't be a serious barrier to anyone doing a ROM hack.

User avatar
tokumaru
Posts: 11858
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Detecting...

Post by tokumaru » Sat Aug 29, 2020 9:21 pm

If a hacker modifiers your ROM, they'll get the message and will easily disable it in 2 minutes. This is completely pointless.

As far as I'm aware, the only thing you can do to fight piracy/hacking of homebrew games is to shuffle the order of several pieces of code and data in your program for each build that'll be distributed, so that there are no two identical copies of it out there. Then, if a hack or unauthorized copy is found, you can trace it back to whoever distributed the game. But even then you're not "preventing" anything, just identifying who did it.

creaothceann
Posts: 253
Joined: Mon Jan 23, 2006 7:47 am
Location: Germany
Contact:

Re: Detecting...

Post by creaothceann » Sun Aug 30, 2020 12:50 am

You can detect changes and silently alter the gameplay, like Earthbound did.

To make it harder to modify the code you could store it encrypted and only decrypt it in small blocks at runtime, while also using the encrypted code as data. (related)
My current setup:
Super Famicom ("2/1/3" SNS-CPU-GPM-02) → SCART → OSSC → StarTech USB3HDCAP → AmaRecTV 3.10

User avatar
Bregalad
Posts: 7951
Joined: Fri Nov 12, 2004 2:49 pm
Location: Chexbres, VD, Switzerland

Re: Detecting...

Post by Bregalad » Sun Aug 30, 2020 1:08 am

Nasir Gebelli did exactly that in the games he coded : 3D World-Runner, Rad Racer, Final Fantasy, etc... There's a string "by Nasir" or something like that, and if it doesn't match they'd refuse to boot. Not only this does not trigger if the game is modified and the "by Nasir" isn't, but also this "security" it's super-easy to defeat.

And yeah this is super easy to defeat and pointiless, nevertheless, if you want to do this purely for fun, go ahead. But don't expect this to stop any serious romhacker.
Useless, lumbering half-wits don't scare us.

Oziphantom
Posts: 913
Joined: Tue Feb 07, 2017 2:03 am

Re: Detecting...

Post by Oziphantom » Sun Aug 30, 2020 4:36 am

yeah you would need to with the "going to break stuff randomly" tricks and do multiple checks in multiple memory locations in multiple ways. Also using say a custom mapper layout will mess things up.

turboxray
Posts: 104
Joined: Thu Oct 31, 2019 12:56 am

Re: Detecting...

Post by turboxray » Sun Aug 30, 2020 10:43 am

creaothceann wrote:
Sun Aug 30, 2020 12:50 am
You can detect changes and silently alter the gameplay, like Earthbound did.

To make it harder to modify the code you could store it encrypted and only decrypt it in small blocks at runtime, while also using the encrypted code as data. (related)
This. While it's kind of a pain to setup, it needs to behave as if it's random. It'll weed out lesser skilled rom hackers, and will probably deter all but the dedicated. At least make them work for that hacking haha.

Post Reply