Jump to content
RealModScene
Sign in to follow this  
jdoe91011

How do I Edit the Title ID of an XEX file?

Recommended Posts

Hello,

This is my first post on RealModScene. However, I have been visiting/have been a member for a while. I am a VIP member on the Xecuter forums, so I am not new to this scene.

Anyway, I have been researching and trying to figure out how to edit the Title ID of an XEX file. I am trying to do this because the Title ID of FCE360 (NES Emulator) on my RGH console is 00000000, and thus, does not match the Title ID on Unity.com, so I cannot push different covers to the emulator on my RGH. This is true of other emulators I have as well.

Mainly though, I am extra curious because the solution has alluded me, and I'm hoping someone on here knows how to do it....

 

Share this post


Link to post
Share on other sites

Homebrew can't have TitleID's, they're instead checked by folder name, have it named exactly like the one on unity and it should download the cover for you (and push should thus also work)

Don't post in the Tutorials section again please, it says when you post what this section is for, and it's NOT for asking questions!

Share this post


Link to post
Share on other sites

Homebrew can't have TitleID's, they're instead checked by folder name, have it named exactly like the one on unity and it should download the cover for you (and push should thus also work)

Don't post in the Tutorials section again please, it says when you post what this section is for, and it's NOT for asking questions!

wrong. they can(pcsxr_360, for example). and you can change it. you need to unpack xex with xextool, and then edit it in hex editor. i did this operation with xexmenu 2.1, cause for some reason it have titleid FFFF0055 and acording to xboxunity database this titleid assigned to "360 nand flasher".

 

UPD:xextool isn`t necessary, you can edit without unpacking. You can change title id, but not add(if titleid is 00000000).

Share this post


Link to post
Share on other sites

Don't post in the Tutorials section again please, it says when you post what this section is for, and it's NOT for asking questions!

Sorry about that, I was concerned I might have posted in the wrong place, and sure enough I had. Don't worry, it won't happen again.

Share this post


Link to post
Share on other sites

Homebrew can't have TitleID's, they're instead checked by folder name, have it named exactly like the one on unity and it should download the cover for you (and push should thus also work)

I have all my emulators in a folder titled "emulators" on one of my external hard drives. WIthin that folder, I changed the name of the "FCEUX" folder to "00000171" (the title ID on Unity), and am still unable to "push" my desired cover. I will, however, mention that the emulator has an fce360 cover, just not the one I want, where did this come from? What information is Unity using to send this cover? The title ID of the emulator is "00000000"

 

wrong. they can(pcsxr_360, for example). and you can change it. you need to unpack xex with xextool, and then edit it in hex editor. i did this operation with xexmenu 2.1, cause for some reason it have titleid FFFF0055 and acording to xboxunity database this titleid assigned to "360 nand flasher".

 

UPD:xextool isn`t necessary, you can edit without unpacking. You can change title id, but not add(if titleid is 00000000).

I tried unpacking the fceux.xex file with xextool and then editing it in IDA Pro, but was unable to ascertain where the title Id resided once I had the hex code on-screen. Also, I wasn't sure how to edit it if and when I found it.

Pertaining to your post update, how do I edit an XEX file in order to change the title ID, especially without xextool? You said you used XEX Menu? please explain how...

Thank you

Share this post


Link to post
Share on other sites

I have all my emulators in a folder titled "emulators" on one of my external hard drives. WIthin that folder, I changed the name of the "FCEUX" folder to "00000171" (the title ID on Unity), and am still unable to "push" my desired cover. I will, however, mention that the emulator has an fce360 cover, just not the one I want, where did this come from? What information is Unity using to send this cover? The title ID of the emulator is "00000000"

 

I tried unpacking the fceux.xex file with xextool and then editing it in IDA Pro, but was unable to ascertain where the title Id resided once I had the hex code on-screen. Also, I wasn't sure how to edit it if and when I found it.

Pertaining to your post update, how do I edit an XEX file in order to change the title ID, especially without xextool? You said you used XEX Menu? please explain how...

Thank you

as i said, if titleid=00000000 you cant change it, i tried... 

in other situation you just open your xex in hex editor. and here you can do in two ways:

1 just do the hex search, where value=titleid of xex

2 scroll down till you find hex combination "40<48 zeros>XXXXXXXX", where XXXXXXXX is the titleid.

the you just change hex value to your new titleid and save. done.

i use winhex

0f5c8b7934902085e69de9e1fdd986b2.png

Share this post


Link to post
Share on other sites

as i said, if titleid=00000000 you cant change it, i tried... 

in other situation you just open your xex in hex editor. and here you can do in two ways:

1 just do the hex search, where value=titleid of xex

2 scroll down till you find hex combination "40<48 zeros>XXXXXXXX", where XXXXXXXX is the titleid.

the you just change hex value to your new titleid and save. done.

i use winhex

0f5c8b7934902085e69de9e1fdd986b2.png

The offset can be calculated... and that offset may not be correct for every type, it really depends on the header information

private static void GetFromXex(BinaryReader br, ref ListViewItem ret) {
            namespace x360PackageXexInfoViewer {
    using System;
    using System.IO;
    using System.Text;
    using System.Windows.Forms;

    public static class InfoCreator {
        public static ListViewItem GetListViewItem(string file) {
            var ret = new ListViewItem(file);
            using(var fs = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read)) {
                using(var br = new BinaryReader(fs)) {
                    var magic = br.ReadBytes(4);
                    if(Encoding.ASCII.GetString(magic) == "XEX2")
                        GetFromXex(br, ref ret);
                    else {
                        switch(Swap(BitConverter.ToUInt32(magic, 0))) {
                            case 0x434F4E20: // CONS
                            case 0x4C495645: // LIVE
                                GetFromCon(br, ref ret);
                                break;
                            default:
                                throw new Exception("Incompatible file format!");
                        }
                    }
                }
            }
            return ret;
        }

        private static uint Swap(uint x) { return (x & 0x000000FF) << 24 | (x & 0x0000FF00) << 8 | (x & 0x00FF0000) >> 8 | (x & 0xFF000000) >> 24; }

        private static uint GetUintValue(BinaryReader br, int offset, string name) {
            if(br.BaseStream.Position != offset)
                br.BaseStream.Seek(offset, SeekOrigin.Begin);
            var ret = Swap(BitConverter.ToUInt32(br.ReadBytes(4), 0));
            Console.WriteLine(@"{1}: 0x{0:X}", ret, name);
            return ret;
        }

        private static void GetFromXex(BinaryReader br, ref ListViewItem ret) {
            var codeOffset = GetUintValue(br, 0x8, "CodeOffset");
            if(codeOffset > br.BaseStream.Length)
                throw new Exception("Starting address of the xex code is beyond the size of the xex file!");
            var certOffset = GetUintValue(br, 0x10, "CertOffset");
            if(certOffset > codeOffset)
                throw new Exception("Xex certificate offset is beyond the starting address of the xex code!");
            var infotableNumEntries = GetUintValue(br, 0x14, "infotableNumEntries");
            if(infotableNumEntries * 8 + 24 > codeOffset)
                throw new Exception("Xex general info table has entries that spill over into the Xex code!");
            uint execinfo = 0;
            for(var i = 0; i < infotableNumEntries; i++) {
                var j = i * 8 + 0x18;
                if(GetUintValue(br, j, string.Format("InfoTable Entry 0x{0:X}", i)) != 0x00040006)
                    continue;
                execinfo = GetUintValue(br, j + 4, "Execution Information Offset");
                break;
            }
            if(execinfo == 0)
                throw new Exception("No Execution info found!");
            if(execinfo > br.BaseStream.Length - 19)
                throw new Exception("Invalid Execution info offset!");
            var mid = GetUintValue(br, (int)(execinfo), "MediaID");
            var bv = GetUintValue(br, (int)(execinfo + 8), "Base Version");
            var tid = GetUintValue(br, (int)(execinfo + 12), "TitleID");
            ret.SubItems.Add(tid.ToString("X8"));
            ret.SubItems.Add(mid.ToString("X8"));
            ret.SubItems.Add(bv.ToString("X8"));
            br.BaseStream.Seek(execinfo + 18, SeekOrigin.Begin);
            var num = br.ReadByte();
            ret.SubItems.Add(num + "/" + br.ReadByte());
            ret.SubItems.Add("N/A");
        }

        private static void GetFromCon(BinaryReader br, ref ListViewItem ret) {
            var mid = GetUintValue(br, 0x354, "MediaID");
            var bv = GetUintValue(br, 0x35C, "BaseVer");
            var tid = GetUintValue(br, 0x360, "TitleID");
            ret.SubItems.Add(tid.ToString("X8"));
            ret.SubItems.Add(mid.ToString("X8"));
            ret.SubItems.Add(bv.ToString("X8"));
            br.BaseStream.Seek(0x366, SeekOrigin.Begin);
            var num = br.ReadByte();
            ret.SubItems.Add(num + "/" + br.ReadByte());
            byte tu = 0;
            var istu = false;
            if(GetUintValue(br, 0x344, "Container Type") == 0x000B0000) { // Updater (Title or System)
                if((GetUintValue(br, 0x971A, "Installer Type") == 0x54555044)) { // TUPD
                    istu = true;
                    br.BaseStream.Seek(0x9724, SeekOrigin.Begin);
                    tu = br.ReadByte();
                }
            }
            ret.SubItems.Add(istu ? tu.ToString("D") : "N/A");
        }
    }
}

Above you'll find a snippet of code from my tool that reads the information

  • Like 3

Share this post


Link to post
Share on other sites

as i said, if titleid=00000000 you cant change it, i tried... 

in other situation you just open your xex in hex editor. and here you can do in two ways:

1 just do the hex search, where value=titleid of xex

2 scroll down till you find hex combination "40<48 zeros>XXXXXXXX", where XXXXXXXX is the titleid.

the you just change hex value to your new titleid and save. done.

i use winhex

0f5c8b7934902085e69de9e1fdd986b2.png

Cool, thank you. I tried this, and as you said, I was unable to change the title id for fceux.xex, due to the current title id being 00000000. However, I tried it with pcsxr.xex, and was able to change the title id from 1ced2911 to 00000151 (the title id on unity.com). My only issue now is how do I rehash and resign my now modified xex file in order to get it to work again with it's new title id, on my rgh?

You guys have both been very helpful, thank you

  • Like 1

Share this post


Link to post
Share on other sites

Cool, thank you. I tried this, and as you said, I was unable to change the title id for fceux.xex, due to the current title id being 00000000. However, I tried it with pcsxr.xex, and was able to change the title id from 1ced2911 to 00000151 (the title id on unity.com). My only issue now is how do I rehash and resign my now modified xex file in order to get it to work again with it's new title id, on my rgh?

You guys have both been very helpful, thank you

Xextool should be able to do that

Share this post


Link to post
Share on other sites

The offset can be calculated... and that offset may not be correct for every type, it really depends on the header information

private static void GetFromXex(BinaryReader br, ref ListViewItem ret) {
            namespace x360PackageXexInfoViewer {
    using System;
    using System.IO;
    using System.Text;
    using System.Windows.Forms;

    public static class InfoCreator {
        public static ListViewItem GetListViewItem(string file) {
            var ret = new ListViewItem(file);
            using(var fs = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read)) {
                using(var br = new BinaryReader(fs)) {
                    var magic = br.ReadBytes(4);
                    if(Encoding.ASCII.GetString(magic) == "XEX2")
                        GetFromXex(br, ref ret);
                    else {
                        switch(Swap(BitConverter.ToUInt32(magic, 0))) {
                            case 0x434F4E20: // CONS
                            case 0x4C495645: // LIVE
                                GetFromCon(br, ref ret);
                                break;
                            default:
                                throw new Exception("Incompatible file format!");
                        }
                    }
                }
            }
            return ret;
        }

        private static uint Swap(uint x) { return (x & 0x000000FF) << 24 | (x & 0x0000FF00) << 8 | (x & 0x00FF0000) >> 8 | (x & 0xFF000000) >> 24; }

        private static uint GetUintValue(BinaryReader br, int offset, string name) {
            if(br.BaseStream.Position != offset)
                br.BaseStream.Seek(offset, SeekOrigin.Begin);
            var ret = Swap(BitConverter.ToUInt32(br.ReadBytes(4), 0));
            Console.WriteLine(@"{1}: 0x{0:X}", ret, name);
            return ret;
        }

        private static void GetFromXex(BinaryReader br, ref ListViewItem ret) {
            var codeOffset = GetUintValue(br, 0x8, "CodeOffset");
            if(codeOffset > br.BaseStream.Length)
                throw new Exception("Starting address of the xex code is beyond the size of the xex file!");
            var certOffset = GetUintValue(br, 0x10, "CertOffset");
            if(certOffset > codeOffset)
                throw new Exception("Xex certificate offset is beyond the starting address of the xex code!");
            var infotableNumEntries = GetUintValue(br, 0x14, "infotableNumEntries");
            if(infotableNumEntries * 8 + 24 > codeOffset)
                throw new Exception("Xex general info table has entries that spill over into the Xex code!");
            uint execinfo = 0;
            for(var i = 0; i < infotableNumEntries; i++) {
                var j = i * 8 + 0x18;
                if(GetUintValue(br, j, string.Format("InfoTable Entry 0x{0:X}", i)) != 0x00040006)
                    continue;
                execinfo = GetUintValue(br, j + 4, "Execution Information Offset");
                break;
            }
            if(execinfo == 0)
                throw new Exception("No Execution info found!");
            if(execinfo > br.BaseStream.Length - 19)
                throw new Exception("Invalid Execution info offset!");
            var mid = GetUintValue(br, (int)(execinfo), "MediaID");
            var bv = GetUintValue(br, (int)(execinfo + 8), "Base Version");
            var tid = GetUintValue(br, (int)(execinfo + 12), "TitleID");
            ret.SubItems.Add(tid.ToString("X8"));
            ret.SubItems.Add(mid.ToString("X8"));
            ret.SubItems.Add(bv.ToString("X8"));
            br.BaseStream.Seek(execinfo + 18, SeekOrigin.Begin);
            var num = br.ReadByte();
            ret.SubItems.Add(num + "/" + br.ReadByte());
            ret.SubItems.Add("N/A");
        }

        private static void GetFromCon(BinaryReader br, ref ListViewItem ret) {
            var mid = GetUintValue(br, 0x354, "MediaID");
            var bv = GetUintValue(br, 0x35C, "BaseVer");
            var tid = GetUintValue(br, 0x360, "TitleID");
            ret.SubItems.Add(tid.ToString("X8"));
            ret.SubItems.Add(mid.ToString("X8"));
            ret.SubItems.Add(bv.ToString("X8"));
            br.BaseStream.Seek(0x366, SeekOrigin.Begin);
            var num = br.ReadByte();
            ret.SubItems.Add(num + "/" + br.ReadByte());
            byte tu = 0;
            var istu = false;
            if(GetUintValue(br, 0x344, "Container Type") == 0x000B0000) { // Updater (Title or System)
                if((GetUintValue(br, 0x971A, "Installer Type") == 0x54555044)) { // TUPD
                    istu = true;
                    br.BaseStream.Seek(0x9724, SeekOrigin.Begin);
                    tu = br.ReadByte();
                }
            }
            ret.SubItems.Add(istu ? tu.ToString("D") : "N/A");
        }
    }
}

Above you'll find a snippet of code from my tool that reads the information

 

thank you, Swizzy! i read more about xex file structure, and now i know how to add info about titleid to the header.

so i can say, it`s posible to add/change/remove titleid to/from any xex using just hex editor

Share this post


Link to post
Share on other sites

Xextool should be able to do that

Well, you were absolutetly right. I modifed the title id's for the two xex files used by PCSXR360 2.0.7, using a Hex Editor (HXD), with the method mentioned above by Gualdimar, and then navigated to them in XEXMenu and used the PatchXEX option on both files. This then made them both recognized by Aurora with the their "new", modified TItle ID's (After a fresh content scan on the appropriate path, of course). After having modified the title ID's from 1CED2911 to 00000155 (the title ID on Unity.net), I am able to "push" my desired game cover to my RGH, which I couldn't do before.

Thank you for the help Swizzy.

 

thank you, Swizzy! i read more about xex file structure, and now i know how to add info about titleid to the header.

so i can say, it`s posible to add/change/remove titleid to/from any xex using just hex editor

So, you now know how to change the title ID of even an XEX with a title ID of 00000000? Would you mind sharing with me how you did this? I pulled it off with PCSXR 2.0.7, (see immediate above quote) and would love to be able to do it with even 00000000 xex files.

 

Thank you for your help either way Gualdimar.

 

I hope this thread ends up being useful to anyone attempting this as well.

  • Like 2

Share this post


Link to post
Share on other sites

Well, you were absolutetly right. I modifed the title id's for the two xex files used by PCSXR360 2.0.7, using a Hex Editor (HXD), with the method mentioned above by Gualdimar, and then navigated to them in XEXMenu and used the PatchXEX option on both files. This then made them both recognized by Aurora with the their "new", modified TItle ID's (After a fresh content scan on the appropriate path, of course). After having modified the title ID's from 1CED2911 to 00000155 (the title ID on Unity.net), I am able to "push" my desired game cover to my RGH, which I couldn't do before.

Thank you for the help Swizzy.

 

So, you now know how to change the title ID of even an XEX with a title ID of 00000000? Would you mind sharing with me how you did this? I pulled it off with PCSXR 2.0.7, (see immediate above quote) and would love to be able to do it with even 00000000 xex files.

 

Thank you for your help either way Gualdimar.

 

I hope this thread ends up being useful to anyone attempting this as well.

it`s work of 2 mins, but it`s kinda hard to explain, at least for me. i`m bad at tutorials.

i don`t want to go into details, if you have some interest, check this link: http://www.free60.org/wiki/XEX

i`ll try to show the process in screens, maybe if you understand it, you`ll write normal tutrorial

70b7e9a4ef7083292c7bbc00ff6d3621.png

 

f139cfdf82503f09f6e86b6a4faf1d08.png

 

d28c25e357e4e8e16b638ec6b6c10dde.png

 

1268c283cb1bc8f2ad48726f4261d919.png

  • Like 2

Share this post


Link to post
Share on other sites

Well, you were absolutetly right. I modifed the title id's for the two xex files used by PCSXR360 2.0.7, using a Hex Editor (HXD), with the method mentioned above by Gualdimar, and then navigated to them in XEXMenu and used the PatchXEX option on both files. This then made them both recognized by Aurora with the their "new", modified TItle ID's (After a fresh content scan on the appropriate path, of course). After having modified the title ID's from 1CED2911 to 00000155 (the title ID on Unity.net), I am able to "push" my desired game cover to my RGH, which I couldn't do before.

Thank you for the help Swizzy.

I wouldn't recommend using the XEXMenu patch function, it can cause other problems, i'm fairly certain XEXTool can rehash a xex for you and possibly resign with the keys used when compiling the xex in the first place

it`s work of 2 mins, but it`s kinda hard to explain, at least for me. i`m bad at tutorials.

i don`t want to go into details, if you have some interest, check this link: http://www.free60.org/wiki/XEX

i`ll try to show the process in screens, maybe if you understand it, you`ll write normal tutrorial

70b7e9a4ef7083292c7bbc00ff6d3621.png

f139cfdf82503f09f6e86b6a4faf1d08.png

d28c25e357e4e8e16b638ec6b6c10dde.png

1268c283cb1bc8f2ad48726f4261d919.png

Keep in mind, you must type in offsets in BigEndian format, it's not LittleEndian, basically copy the bytes into Calculator in windows in the order they appear and you should have the correct values

  • Like 2

Share this post


Link to post
Share on other sites

I wouldn't recommend using the XEXMenu patch function, it can cause other problems, i'm fairly certain XEXTool can rehash a xex for you and possibly resign with the keys used when compiling the xex in the first place

Keep in mind, you must type in offsets in BigEndian format, it's not LittleEndian, basically copy the bytes into Calculator in windows in the order they appear and you should have the correct values

forgot to mention, you don`t need to do anything with your xex file after editing. hacked console is made to run unsigned code.

if you didn`t do anything to xex with xextool before editing, you shouldn`t do anything after. if you did, you can ecnÑrypt and compress it, but this isn`t necessary

Share this post


Link to post
Share on other sites

Please could happen that xex default of FCEUX since I also got a cover and I can not change my title from id is 00000000

Edit: I solved by renaming the default.xex (fceux.xex) and put FCEUX.xex then went to xbox unity and could change the cover intenen I wanted to do so with mame also did the same rename the default.xex (mame.xex) and place MAME360.xex then wait 5 minutes and ready.

Share this post


Link to post
Share on other sites

Or, we could try the super crazy thing, and change the titleID in the aurora content db to match the one on unity. Dont know if this would work, but it seems like it would be a logical conclusion that it would.

Share this post


Link to post
Share on other sites

Or, we could try the super crazy thing, and change the titleID in the aurora content db to match the one on unity. Dont know if this would work, but it seems like it would be a logical conclusion that it would.

It would indeed work :)

  • Like 1

Share this post


Link to post
Share on other sites

Should be mentioned, that the titleID in the db is converted from hex to decimal, but anyone running windows can convert that with the scientific calculator, built in to the default calculator. :)

Share this post


Link to post
Share on other sites

Should be mentioned, that the titleID in the db is converted from hex to decimal, but anyone running windows can convert that with the scientific calculator, built in to the default calculator. :)

Correction; Programmers calculator

To access it, start calculator then in the View Menu -> click "Programmer" or press Alt + 3

Share this post


Link to post
Share on other sites

wouldn`t it change after content scan?

No, not unless you delete the game and add it back in again...

The content scan only update NEW entries, not existing ones...

  • Like 1

Share this post


Link to post
Share on other sites

There is another easy way to change the titleID in case there is no information on the app in xboxunity. You have to upload the content.db file from Aurora database folder in sqlite.com or any other database website and then, select the content tab and change the title ID manually. Then, update the content.db file in the Aurora database folder with the new one

db.png

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...