Banner
Views: 852,455,805
Time:
17 users online: AnEvilGhost, bandicoot, cherrybombr, Freitasth, HammerBrother, kyasarintsu,  Maarfy, Milk,  MiniMawile303, Mr. MS, OMEGA48, P-Tux7, Runic_Rain,  Sayuri,  Sinc-X, Skewer, Truxton - Guests: 53 - Bots: 95 Users: 47,003 (2,526 active)
Latest: Audioholiker
Tip: Make a backup of your hack before using any external tools on it.Not logged in.
Telinc1's tutorial on how to apply Xkas patches
Forum Index - SMW Hacking - SMW Hacking Help - Tutorials - Old Tutorials - Telinc1's tutorial on how to apply Xkas patches
Pages: « 1 »
Warning: I have no idea why I didn't add a deprecation warning to this last month, but seeing as it got activity, I will now. xkas is an old and obsolete tool and you should use Asar instead, as it's more stable and way easier to use. The tutorial by itself is also not good (even though that doesn't matter because you shouldn't be using xkas in 2016).

Hello and welcome to my first tutorial! In it, I will show you how to apply Xkas (ASM) patches easily! No more talking. Let's begin!

What will you need?
1. Microsoft Windows XP/Vista/7;
2. A patch;
3. Xkas;
4. Your ROM hack;
5. Lunar Expand;
6. Free Space Logger (Slogger) - Search for it in the tools section.

Wait, wait, what's a patch?
A patch is a custom piece of ASM that goes into the game. A patch can modify anything, starting from the Nintendo Presents screen to the ending credits.

So, how do I apply a "patch"?
1. Make a backup of your ROM.
2. Open Lunar Expand and expand your ROM to 4MB. (OPTIONAL)

If your patch requires freespace...

1. Move the ROM into Slogger's folder.
2. Drag it on "slogger.exe".
3.1. Open the newly created text file.
3.2. Expand Notepad (by using the maximize button)
4. Search for a 0x8000 in the Size field (there should be plenty of them).
5. On the right, there's a section called "LoROM Address". Copy the address of the 0x8000 you chose.
6. Open your patch with a program, such as Notepad and search for a comment telling you that said line is freespace. The line commonly looks like:
Code
1) org $xxxxxx
2) !freespace = $xxxxxx

7. Change the X-es to the copied address.
8. Save the patch.

Global Note: If you expand your ROM to 4MB, you don't need to expand is a second time.
Huge and fat note: NEVER use the LoROM Offsets that end with "(!)". They are SRAM and will crash your game if you use them.

These were the steps you need to do, in order to set the freespace. The steps below are required, no matter if the patch does, or doesn't require freespace.

1. Move your ROM and your patch to the folder where Xkas lies.
2. Create a new file and name it "patch.bat". Windows will ask you do you really want to change the extension. Say yes. Open the newly created file with Notepad. Type in:
Code
xkas.exe PatchName.asm RomFilename.smc
@pause

Note: Replace PatchName.asm with your patch's name and RomFilename.smc with your ROM's filename. Both of these CANNOT contain spaces.
Note 2: To apply something else, just edit the file.
3. Open the batch file and hit any key.
4. Test you ROM!

I hope that was useful!

Further reading
This is a more advanced section. Do not do anything described here UNLESS you got the way to patch stuff. Also, I do recommend knowing a bit of ASM.
Here's the way to see how much bytes a patch has eaten up:
1. Open the main ASM file in a text editor.
2. After "header" and "lorom" make a new line and put "reset bytes", no quotes, on it.
3. At the very end of the patch, on a new line, put "print bytes".
4. Now, every time you patch the certain patch, Xkas will tell you how many bytes it used!

And now, here's an explanation for the two things we added.
reset bytes - Resets a "variable" and starts counting bytes. (Confirmation please)
print bytes - This will print out the counted bytes.
print - A command that will print something out. You can also use quotes to print out text. This is basically the "echo" command in PHP. Here's an example of this command being used:
Code
print "This patch used ",bytes," bytes."


F.A.Q.
Q: I got the Blank Screen of Death (BSoD)!
A: You didn't do something right. Restore your hack with the backup, and try again.

Q: I can't see the author's note in the patch!
A: This means that the patch doesn't require freespace. Patch it as it is.

Q: I don't fully understand step 6 of the freespace part. What's a 'comment'?
A: A comment starts with a semi-colon (;). Anything after it is ignored. (for the current line only)

Q: hwo do ya make a pach im confused this tut dident cover it it sucks
A: This tutorial is on how to apply a patch. Look for another tutorial to learn how to make one.

Edit (7th June 2012): Organized the tutorial a bit more and simplified some steps.

Edit (16th August 2012): Added a new section.
You should add that you don't need to expand your ROM every single time you want to search for freespace, it is fact not necessary to do it even once, unless you're running out of ROM space, and you don't need to make a new .bat file for every single patch you want to apply.

A much more efficient and convenient way to apply patches is, as I have found, to do the following:

First, set up a new folder in the folder your ROM is in, called "Patches" or something, and fill it with your patch(es) (don't forget to set freespace!) and a copy of xkas.
Create and open a .bat file (right click -> edit) and put in these few lines:
@echo off

copy ..\ROM.smc ..\Backup.smc

xkas.exe Patch1.asm ..\ROM.smc
xkas.exe Patch2.asm ..\ROM.smc
Mouse over colour coded parts for additional info.

Change every instance of ROM.smc (marked in the code) to your ROM's name.

--------------------
Your layout has been removed.
Originally posted by leod
You should add that you don't need to expand your ROM every single time you want to search for freespace, it is fact not necessary to do it even once, unless you're running out of ROM space, and you don't need to make a new .bat file for every single patch you want to apply.

A much more efficient and convenient way to apply patches is, as I have found, to do the following:

First, set up a new folder in the folder your ROM is in, called "Patches" or something, and fill it with your patch(es) (don't forget to set freespace!) and a copy of xkas.
Create and open a .bat file (right click -> edit) and put in these few lines:
@echo off

copy ..\ROM.smc ..\Backup.smc

xkas.exe Patch1.asm ..\ROM.smc
xkas.exe Patch2.asm ..\ROM.smc
Mouse over colour coded parts for additional info.

Change every instance of ROM.smc (marked in the code) to your ROM's name.

I will update the tutorial a bit.


Man, I suggest you would add this to your tutorial:

My tips:
1 - You don't really need to search banks with 0x8000 bytes free to put your freespace. Just make sure that your patch + RATS fits in that space (example: I put two HDMA effects - one in $248000 and other in $249000 and worked properly). A way to discover how many bytes you'll use for that patch is simple:
-Open the patch, and search for RATS Tag. BEFORE it, and AFTER the normally found org !Freespace, put reset bytes. And, before the normally found CodeEnd: label (end of code), put print bytes. When xkas apply the patch, it'll show how many bytes you used for that patch. This is useful, since you can apply even 5 or 6 patches in only one bank (some patches only fill 80 bytes - which is 1/256 of a bank!). So, you won't waste entire banks for tiny patches.

2 - This is important: beware if you'll expand your ROM to 4MB and use freespaces in ROM area between $408000 and $6F8000 (DON'T USE banks $7x, because they're SRAM), because they dont support normal addressing modes (such as STZ $19, LDA $14, or even LDA $1230). They support only long addressing patches (long addressing is like this: LDA $7E0019, STA $7E0071, etc.). Make sure your patch has only long addressing (and be aware that, for example, STZ $7E0019 won't work) if you want to apply it in freespaces between $408000 and $6F8000.

3 - And for banks $708000 - ... Don't apply patches in this zone. The only thing you can apply in free areas here is sample banks.

This is all I can say.

--------------------



Dream team (feed them, please):






Originally posted by Fierce Deity Manuz OW Hacker
Man, I suggest you would add this to your tutorial:

My tips:
1 - You don't really need to search banks with 0x8000 bytes free to put your freespace. Just make sure that your patch + RATS fits in that space (example: I put two HDMA effects - one in $248000 and other in $249000 and worked properly). A way to discover how many bytes you'll use for that patch is simple:
-Open the patch, and search for RATS Tag. BEFORE it, and AFTER the normally found org !Freespace, put reset bytes. And, before the normally found CodeEnd: label (end of code), put print bytes. When xkas apply the patch, it'll show how many bytes you used for that patch. This is useful, since you can apply even 5 or 6 patches in only one bank (some patches only fill 80 bytes - which is 1/256 of a bank!). So, you won't waste entire banks for tiny patches.

2 - This is important: beware if you'll expand your ROM to 4MB and use freespaces in ROM area between $408000 and $6F8000 (DON'T USE banks $7x, because they're SRAM), because they dont support normal addressing modes (such as STZ $19, LDA $14, or even LDA $1230). They support only long addressing patches (long addressing is like this: LDA $7E0019, STA $7E0071, etc.). Make sure your patch has only long addressing (and be aware that, for example, STZ $7E0019 won't work) if you want to apply it in freespaces between $408000 and $6F8000.

3 - And for banks $708000 - ... Don't apply patches in this zone. The only thing you can apply in free areas here is sample banks.

This is all I can say.


1. I recommend for people to use 0x8000 banks, as every time I apply a patch in a bank that is smaller, the ROM crashes. even if both patches are small.

2. I used all kinds of freespace and it worked. Well, I will tell users not to use LoROM offsets which have a "(!)", as this always crashes the game, but I don't understand this at all. I'm not an ASMer, so please explain this better to me.

Also, expanding the ROM gives you plenty of banks, so it isn't a problem. Well, it is a problem if someone wants to apply every patch that fixes something, but I don't believe there is such a crazy person.


Well, explaining better:

1 - yes, you can put more than 1 patch in one bank. An example I said in my former post (HDMAs). This works with me, BTW.

2 - Banks $70 -... are ALWAYS marked with (!) because you can't insert patches there, I know. This is because these banks are more related to RAM, I guess (You see, banks $7E and $7F ARE RAM). So I recommend to insert .bnk samples there.

3 - Don't insert patches in ROMs $408000-$6F8000 if they aren't in long addressing, or you game can freeze!

4 - That reset bytes and print bytes are useful to count some bytes you'll need, so you can put many patches in one bank. Like this: If you have patches that occupy less than 0x1000 bytes (in hex, including RATS), you can use banks like this:
$158000 for one patch,$159000 for another, $15A000 for another,etc. etc. etc.

EDIT: telinc, I'm this crazy person, but I use most of my ROM Space in another things, like HDMA things (HDMA Kit). Look at my slogger file:

Code
C:\Documents and Settings\Emanoel\Desktop\Hacks\NewHack\AllUsed\hdmaster.smc
headered
ROM is 0x400000 bytes long

PC offset		LoROM offset		Size

0x08038B		0x10818B		0x0005
0x0874A2		0x10F2A2		0x0004
0x087548		0x10F348		0x0006
0x087586		0x10F386		0x0015
0x0881D5		0x10FFD5		0x0023
0x0915ED		0x1293ED		0x0002
0x0981EC		0x12FFEC		0x0014
0x0A81F4		0x14FFF4		0x000C
0x0AD2F0		0x15D0F0		0x002D
0x0AEA98		0x15E898		0x0022
0x0AEAFB		0x15E8FB		0x0013
0x0AFDD2		0x15FBD2		0x002D
0x0B015D		0x15FF5D		0x00A3
0x0B5B77		0x16D977		0x0021
0x0B5FC0		0x16DDC0		0x0003
0x0B6908		0x16E708		0x006C
0x0B6B5E		0x16E95E		0x0320
0x0B7446		0x16F246		0x00BD
0x0B770D		0x16F50D		0x000D
0x0B7C34		0x16FA34		0x0044
0x0B7F23		0x16FD23		0x017E
0x0B81D8		0x16FFD8		0x0020
0x0C68F4		0x18E6F4		0x0080
0x0C7118		0x18EF18		0x0037
0x0C81E1		0x18FFE1		0x001F
0x0D01FF		0x19FFFF		0x0001
0x0D61A8		0x1ADFA8		0x0032
0x0D69B5		0x1AE7B5		0x001B
0x0D6B83		0x1AE983		0x002C
0x0D6DD7		0x1AEBD7		0x018C
0x0D81B9		0x1AFFB9		0x0047
0x0D8B6F		0x1B896F		0x015A
0x0D9545		0x1B9345		0x00A6
0x0DAFDA		0x1BADDA		0x0123
0x0DB9A3		0x1BB7A3		0x00CA
0x0DC3B6		0x1BC1B6		0x0057
0x0E01C0		0x1BFFC0		0x0038
0x0E546A		0x1CD26A		0x00D4
0x0E76C1		0x1CF4C1		0x01B2
0x0E80E4		0x1CFEE4		0x011C
0x0E9082		0x1D8E82		0x0C77
0x0EA431		0x1DA231		0x0013
0x0EE2D9		0x1DE0D9		0x0011
0x0EE31D		0x1DE11D		0x16D9
0x0EFC23		0x1DFA23		0x05D5
0x0F6600		0x1EE400		0x0218
0x0F769E		0x1EF49E		0x005C
0x0F81AA		0x1EFFAA		0x0056
0x0FEC49		0x1FEA49		0x15B7
0x1080F0		0x20FEF0		0x0110
0x10FC10		0x21FA10		0x05F0
0x111154		0x228F54		0x00AC
0x117E49		0x22FC49		0x03B7
0x118CD5		0x238AD5		0x052B
0x11A0DD		0x239EDD		0x0123
0x11AC62		0x23AA62		0x059E
0x11F52A		0x23F32A		0x0CD6
0x12100F		0x248E0F		0x01F1
0x127F9F		0x24FD9F		0x0261
0x12913C		0x258F3C		0x00C4
0x129E9D		0x259C9D		0x02A0
0x1301D7		0x25FFD7		0x0029
0x136BAA		0x26E9AA		0x03DF
0x138033		0x26FE33		0x01CD
0x13B0FB		0x27AEFB		0x001E
0x13F8A7		0x27F6A7		0x068A
0x1401F7		0x27FFF7		0x0009
0x141139		0x288F39		0x00C7
0x1473A8		0x28F1A8		0x0E58
0x149201		0x299001		0x6FFF
0x151208		0x2A9008		0x6FF8
0x15825B		0x2B805B		0x7FA5
0x160200		0x2C8000		0x8000
0x168221		0x2D8021		0x7FDF
0x17024B		0x2E804B		0x7FB5
0x17821D		0x2F801D		0x7FE3
0x180746		0x308546		0x7ABA
0x1882A2		0x3180A2		0x7F5E
0x190267		0x328067		0x7F99
0x19820C		0x33800C		0x7FF4
0x1A0339		0x348139		0x7EC7
0x1A8340		0x358140		0x7EC0
0x1B0200		0x368000		0x8000
0x1B8200		0x378000		0x8000
0x1C0200		0x388000		0x8000
0x1C8200		0x398000		0x8000
0x1D0200		0x3A8000		0x8000
0x1D8200		0x3B8000		0x8000
0x1E0200		0x3C8000		0x8000
0x1E8200		0x3D8000		0x8000
0x1F0281		0x3E8081		0x0F7F
0x1F1210		0x3E9010		0x0FF0
0x1F241B		0x3EA21B		0x5DE5
0x1F820E		0x3F800E		0x7FF2
0x20022A		0x40802A		0x7FD6
0x208289		0x418089		0x7F77
0x215A08		0x42D808		0x27F8
0x218200		0x438000		0x8000
0x220200		0x448000		0x8000
0x228200		0x458000		0x8000
0x230200		0x468000		0x8000
0x238200		0x478000		0x8000
0x240200		0x488000		0x8000
0x248200		0x498000		0x8000
0x250200		0x4A8000		0x8000
0x258200		0x4B8000		0x8000
0x260200		0x4C8000		0x8000
0x268200		0x4D8000		0x8000
0x270200		0x4E8000		0x8000
0x278200		0x4F8000		0x8000
0x280200		0x508000		0x8000
0x288200		0x518000		0x8000
0x290200		0x528000		0x8000
0x298200		0x538000		0x8000
0x2A0200		0x548000		0x8000
0x2A8200		0x558000		0x8000
0x2B0200		0x568000		0x8000
0x2B8200		0x578000		0x8000
0x2C0200		0x588000		0x8000
0x2C8200		0x598000		0x8000
0x2D0200		0x5A8000		0x8000
0x2D8200		0x5B8000		0x8000
0x2E0200		0x5C8000		0x8000
0x2E8200		0x5D8000		0x8000
0x2F0200		0x5E8000		0x8000
0x2F8200		0x5F8000		0x8000
0x300200		0x608000		0x8000
0x308200		0x618000		0x8000
0x310200		0x628000		0x8000
0x318200		0x638000		0x8000
0x320200		0x648000		0x8000
0x328200		0x658000		0x8000
0x330200		0x668000		0x8000
0x338200		0x678000		0x8000
0x340200		0x688000		0x8000
0x348200		0x698000		0x8000
0x350200		0x6A8000		0x8000
0x358200		0x6B8000		0x8000
0x360200		0x6C8000		0x8000
0x368200		0x6D8000		0x8000
0x370200		0x6E8000		0x8000
0x378200		0x6F8000		0x8000
0x390200		0x728000(!)		0x8000
0x398200		0x738000(!)		0x8000
0x3A0200		0x748000(!)		0x8000
0x3A8200		0x758000(!)		0x8000
0x3B0200		0x768000(!)		0x8000
0x3B8200		0x778000(!)		0x8000
0x3C0200		0x788000(!)		0x8000
0x3C8200		0x798000(!)		0x8000
0x3D0200		0x7A8000(!)		0x8000
0x3E8200		0x7D8000(!)		0x2B7F

A total of 0x2842CB bytes of free space were found
IMPORTANT: The "LoROM Offset" is what is entered in xkas as free space


Look and you'll see that I used more than one patch in bank $24xxxx, for example.

--------------------



Dream team (feed them, please):






Originally posted by Fierce Deity Manuz OW Hacker
Well, explaining better:

1 - yes, you can put more than 1 patch in one bank. An example I said in my former post (HDMAs). This works with me, BTW.

2 - Banks $70 -... are ALWAYS marked with (!) because you can't insert patches there, I know. This is because these banks are more related to RAM, I guess (You see, banks $7E and $7F ARE RAM). So I recommend to insert .bnk samples there.

3 - Don't insert patches in ROMs $408000-$6F8000 if they aren't in long addressing, or you game can freeze!

4 - That reset bytes and print bytes are useful to count some bytes you'll need, so you can put many patches in one bank. Like this: If you have patches that occupy less than 0x1000 bytes (in hex, including RATS), you can use banks like this:
$158000 for one patch,$159000 for another, $15A000 for another,etc. etc. etc.

EDIT: telinc, I'm this crazy person, but I use most of my ROM Space in another things, like HDMA things (HDMA Kit). Look at my slogger file:

-->TeliReplyEditor Message: Long code removed from reply<--

Look and you'll see that I used more than one patch in bank $24xxxx, for example.

This is just my way on inserting patches. Other users can use other ways. I covered the important stuff. Also, I don't want to tell users things that first I don't even know what mean (reset bytes, print bytes) and second don't want to tell users things that have 50% chance to crash the game and 50% chance to work. Sorry.
.....i'm sorry for being stupid...but reading this tutorial made me confused

where do i copy the LoROM offset?

do i copy almost the whole rom's text doc?

i'm just lost and need a more clearer explination.....

once again sorry for being stupid

if you need to know what patches i was planning on using one of them is the extended no sprite limit
Originally posted by smoothrico
.....i'm sorry for being stupid...but reading this tutorial made me confused

where do i copy the LoROM offset?

do i copy almost the whole rom's text doc?

i'm just lost and need a more clearer explination.....

once again sorry for being stupid

if you need to know what patches i was planning on using one of them is the extended no sprite limit

After you find a good address, you copy its LoROM offset. The list should look like this:
Code
0x128200		0x258000		0x8000
0x130200		0x268000		0x8000
0x138200		0x278000		0x8000
0x140200		0x288000		0x8000

If I want to use the bolded address, I will use $268000 for the freespace. It's simple.

And also, I prefer to use Asar. It's very powerful, and it's just better. And it can automatically find freespace for you.

P.S.: Sorry for the late response.
Could you make a separate branch for Windows 10 users? It won't allow us to make a .bat file out of thin air, only WinZip files, .txt files, folders, and shortcuts.

EDIT: Nevermind, I've fully given up on ever trying to apply ASM to SMW.
Open notepad
Write your code
Click 'Save it as'
Save it as yourfilenamehere.bat
Done!
Windows 10 are literally the exact same steps as any other windows. The only possible thing might be that you have to enable file extensions in your folder options so you can actually see the .txt and rename it to .bat
(Or, like Berkay said, just use save file as option.)
Lastly, just use asar instead. You can put ;@xkas at the top (first line) to make asar assemble like xkas.

--------------------
Anime statistic on MyAnimeList:
400 animes completed ✓
6000 episodes completed ✓
100 Days completed ✓
... what even am I doing with my life?
Pages: « 1 »
Forum Index - SMW Hacking - SMW Hacking Help - Tutorials - Old Tutorials - Telinc1's tutorial on how to apply Xkas patches

The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.

Copyright © 2005 - 2020 - SMW Central
Legal Information - Privacy Policy - Link To Us


Menu

Follow Us On

  • YouTube
  • Twitch
  • Twitter

Affiliates

  • Super Mario Bros. X Community
  • ROMhacking.net
  • Mario Fan Games Galaxy