ThiccFurLizzy

Random tech blog where I post what I have in mind.

TL;DR The header may be NES 2.0 and you need it in iNES, or viceversa.

If you like modding your games to change their difficulty, add quality of life improvements, alter their looks, or have a whole new experience, then you might have found that Tetris for the Nintendo Entertainment System has romhacks which ask for an specific rom which you don't seem to have from your legally dumped cartridge.

The thing is that the NES cartridges use specific wiring and signals to tell the console what to do, since it was designed for only 32k of program rom (program) and 8k of character rom (graphics), totaling 42k (sometimes said to be 41k).

But the cartridges could contain additional chips, colloquially known as “mappers”, which added much needed things like bank switching, allowing for larger, more complex games.

So it was the task of the community to create a way for Emulators to know which additional chips the cartridge game had, and so the iNES header was created, for the aptly named iNES emulator.

Thing is, it was made when the knowledge of the console and it's mappers was still growing, so it was incomplete and lacking in certain areas, which made it so a revision was due, designed to be backwards compatible, NES 2.0

Which brings us to the topic at hand, Tetris has the MMC1 mapper with a SEROM configuration (meaning no program banking, only graphics)

Headers

The iNES Header for Tetris is quite easy actually

4E 45 53 1A 02 02 10 00 00 00 00 00 00 00 00 00

All of that means it's a NES game, 32k program rom, 16k character rom, with the MMC1 mapper chip.

However, the NES 2.0 Header for Tetris adds some info

4E 45 53 1A 02 02 10 08 50 00 00 00 00 00 00 01

That adds the fact it's submapper 5 (SEROM) and that it uses standard NES controllers.

The fix

In order to being able to patch the rom with your ips/bps/xdelta/etc you might have to change the header, or even remove it entirely, it shouldn't make any difference to the gamer, only to very accurate emulators.

rom info

Here I include the hashes of the 3 variants discused here, so you can know if you have the correct one.

Unheadered

Hash Value
CRC32 1394f57e
MD5 5b0e571558c8c796937b96af469561c6
SHA1 fd9079cb5e8479eb06d93c2ae5175bfce871746a
SHA256 2ae5fb18a1bf841077e3872ba05060f030ea0bfc573994b2f8fe2fb570dc7853

iNES

Hash Value
CRC32 6d72c53a
MD5 ec58574d96bee8c8927884ae6e7a2508
SHA1 77747840541bfc62a28a5957692a98c550bd6b2b
SHA256 acab10f2dbad4d4ef5d56b31cd4cea208bb6e2e2c5dba5eb339d711ec04e3535

NES 2.0

Hash Value
CRC32 d16ea396
MD5 886012ac3b3fbf4a244dead999788fe8
SHA1 3026d28b63d94c921fe58364f8b0659d10b5a0ac
SHA256 ddb876c302cfd4ee19fabff8e3ede0b6801ded70c49980d1682a32d352953082

Currently if you want to run The Sims 2 in your new machine, it's likely that you'll be greeted with:

Failed to find any directx 9.0c campatible graphics adapters in this system! please make sure you have a directx 9.0c compatible graphics adapter and have installed the latest drivers provided by the manufacturer. the application will now terminate.

This is due to the game having a whitelist of which GPUs are capable of running the game, completele oblivious to the fact that more recent ones exist (maybe to upsell The Sims 3?)

For many years the best answers have been:

  • Create a shortcut and add -w so it opens in a window.
  • Use Graphics Rule Maker and add your GPU to the list.

But there is actually a better option that only requires dropping one .dll into the game directory, making it fully work out of the box.

You have to download DXVK, a library to convert Direct3D applications to run with Vulkan instead.

Just download the latest release and extract the .tar.gz (You'll need a program like 7-Zip, as Windows can't handle those by default)

Inside there will be a x32 folder, with a d3d9.dll file inside, you have to copy that where Sims2EP9.exe is located, and also where TS2BodyShop.exe is.

Example:

The Sims 2\
└  Mansion and Garden Stuff\
   ├  CSBin\
   │  ├ d3d9.dll (from DXVK)
   │  └ TS2BodyShop.exe
   └  TSBin\
      ├ d3d9.dll (from DXVK)
      └ Sims2EP9.exe

This will make the game think you are using an NVIDIA GeForce 7800 GTX which IS in the whitelist, so you won't have to deal with modifying Mansion and Garden Stuff\TSData\Res\Config\Video Cards.sgr or Graphics Rules.sgr located in the same folder

However, this still leaves the issue of the game using 800x600 resolution, with a maximum of 1600x1200, for which it's easy to just use “Graphics Rule Maker” mentioned above to change them, or you could edit the Graphics Rules.sgr yourself.

But wait, this not only makes it run better and work out of the box, but also fixes some bugs, like the Sims Shadows, so it's not useless, besides, if you change GPUs, you won't have to run GRM again ;)

Sometimes we are using Magisk, trying modules, but we get into a bootloop, it happens.

However, besides entering into safe mode to disable them all, you could try and disable only Zygisk, which although doesn't appear anywhere that you could enable or disable it without using the apk, it is totally posible.

To do this, we simply need SQLite3 installed and a root shell, then just navigate into /data/adb/ and here we will find magisk.db which contains the settings. We change the zygisk value from 1 to 0 and reboot!

su
cd /data/adb/
sqlite3 magisk.db ";UPDATE settings SET value='0' WHERE key='zygisk';";

With that, your device should have a better shot at not bootlooping, happy modding!

Sometimes I find myself trying to execute something at boot, or have it run daily, or after the system has been running for some time.

For that, most Linux distros have the SystemD daemon management system, and this is how to make a very simple service file

We are going to create a text file in /etc/systemd/system/ and add the following

[Unit]
After=multi-user.target

[Service]
ExecStart=/usr/bin/bash -c /root/.scripts/service.sh
Type=exec
Restart=on-failure

[Install]
WantedBy=default.target

What are those lines?

After=multi-user.target
This means that it's going to run after everything else is loaded, and should be what most programs need.

ExecStart=/usr/bin/bash -c /root/.scripts/service.sh
You might notice that we are executing a shell script in root's home folder, that it's the most simple way to run multiple commands in succesion, otherwise we can only run just one thing per service.

Type=exec
The exec type is what most programs need, it waits untill the command is fully running for it to be considered, well, running.

Restart=on-failure
This makes it restart when it exits with a non-zero code, unclean signal, a timeout, or watchdog failure.

WantedBy=default.target
Finally, this means that it should load because the default target wants it, and should ideally start before it.


Finishing

After that we only have to run

sudo systemctl enable name.service

and it should run on next boot, however if we want to have it run right now we can add —now after enable, or simple run it again but with start rather than enable.

A long time ago I was handling a lot of images, and I wanted to properly resize them, and I found out about ImageMagick which is a very powerful tool for all kinds of image manipulation.

I noticed there was the tool called convert which allows you to do many kinds of transformations, resizing included.

NOTE: In Version 7 the convert command is deprecated and you should use magick directly, this post will continue to say convert but will use the proper commands

I delved into the documentation of convert, and looked at all options, trying to see what was relevant for me (being a beginner for image processing).

Here is what I always add to it:

General options

-monitor I want to see it working, and this shows the progress of what it's doing

-virtual-pixel dither Beyond the limits of the image, there is a void, and it's up to you to decide what is there for the purposes of trying to interpolate neighbouring pixels. I prefer to have a dithering pattern based on the image itself.

-interpolate catrom In order to get the intermediate color between two (or four) pixels, you need some formula to get it, by default it's bilinear/triangle, but I like using a more difficult one, the Catmull-Rom Spline

-quality 100 This makes sure the quality is not lost by re-encoding, and any changes are by the resizing.

-colorspace Oklab and -colorspace sRGB In order to more appropiately merge colors together, it's prefered to use another color space, and my pick is for Oklab, since it better represents how the human eye sees colour, and as such any math makes it look better. Afterwards we have to turn it back to sRGB since that's what computers use.

Resizing

There are many ways to resize images, and so here I list a few, which are the ones I use the most

-scale This is a mixture of 'Box' and 'Triangle', which acts like Box for integers and Triangle for fractions. This is much faster than doing either separately.

-magnify This is mostly for pixel art, and by default uses scale2x for making it more round but not blurry.

-resize This allows for many filters to be used, which...

Filter

Filter is a bit more complicated, as it can change a lot for different ones, here are the ones I like

-filter Gaussian -define filter:blur=0.75 This is known as “Gaussian Interpolator” and is a sharper Gaussian filter, which is nice for downsampling.

-filter Lanczos Lanczos is a Windowed Sinc filter, that uses the Sinc function as the window itself. It's recommended for Real Photographs.

-filter Mitchell The Mitchell-Netravali Filter was made after a survey agreed that using a cubic spline with certain values looked good to some experts. When in doubt, you can use this.

-filter Robidoux -distort Resize Distort? Yes, instead of using Orthogonal (up, down, left, right) we have Circles! Nicolas Robidoux noticed Cubic filters looked good in Cylindrical distortions, and created his own filter which is fast and good. Can be used instead of Mitchell-Netravali if you feeling fancy.

Great game, but I've had some issues running it.

The main issue isn't performance, but rather the game just crashing out of the blue, and while there are a few things online, they are mostly the very basic stuff.

So, here is what worked for me: * Disable Windows Game Bar * Restart PC before playing


With that out of the way, here's something more fun, mods!

The main mod that everyone should have is probably “Doom Eternal Advanced Options” available at NexusMods. Link

It adds many features that aren't too invasive, like having both grenades available at all times, rather than having to switch between frag and ice. And some that are nice to have if you don't want to spend much time not playing, like disabling some menus and speeding up animations. Last but not least, some that are more advanced options like changing your HUD, and modifying the enemy AI.

Another mod that is interesting for non-RTX users (so, AMD, Intel, and cheaper NVidia) is OptiScaler. Technically not a mod for this game specifically, but it's for all DLSS2 games.

It allows you to use FSR 2 or 3 for the resolution scaling, which looks better than the default (bilinear?), and could help with performance by literally rendering at a lower resolution. Although I noticed that high contrast areas (bright over dark) look off... Maybe I need to change my settings?

You can use Ultimate ASI Loader to load those mods, here is how my setup looks like:

DOOMEternal\
├  DE_AdvancedOptionsMod\
│  └ DE_ModMainSettings.json
├  AdvancedOptionsMod.asi (renamed from msimg32.dll)
├  amd_fidelityfx_vk.dll
├  nvngx.ini
├  OptiScaler.asi (renamed from nvngx.dll)
└  winmm.dll (renamed from dinput8.dll)

Hello, this is a fresh start for what I'll mostly be uploading ramblings about technology and a few other things.