Page 1 of 2

Is it possible to hard code Widescreen code inside an iso?

Posted: Mon Nov 03, 2014 8:40 pm
by DragonBoy
Hi guys! :)
Is it possible to hack/imbed the widescreen cheat code inside an ISO file? :roll:

Thanks

Re: Is it possible to hard code Widescreen code inside an is

Posted: Mon Nov 03, 2014 11:44 pm
by ShadowOne333
DragonBoy wrote:Hi guys! :)
Is it possible to hack/imbed the widescreen cheat code inside an ISO file? :roll:

Thanks
I'm also interested in doing so.

Although, I think the Widescreen codes might be in ASMinstead of HEX, I might be wrong though.

Re: Is it possible to hard code Widescreen code inside an is

Posted: Tue Nov 04, 2014 1:23 am
by novenary
Technically yes, you just need to patch the dol and probably fix a checksum but that's all you need to do. Of course you need to convert the code to a raw patch first.

Re: Is it possible to hard code Widescreen code inside an is

Posted: Tue Nov 04, 2014 2:18 pm
by DragonBoy
I see... So it cannot be done by the average person like me... :( Thanks guys...

Re: Is it possible to hard code Widescreen code inside an is

Posted: Tue Nov 04, 2014 3:29 pm
by novenary
Come on, just do some research. It's just a matter of reading some format specs and messing around in an hex editor. ;)

Re: Is it possible to hard code Widescreen code inside an is

Posted: Tue Nov 04, 2014 5:58 pm
by Ralf@gc-forever
Well, it depends a little bit on the game and widescreen code type. Can you please tell us about which game we are talking here?

Re: Is it possible to hard code Widescreen code inside an is

Posted: Tue Nov 04, 2014 6:43 pm
by DragonBoy
Thanks for your reply... Well, lets say Wind Waker NTSC and Mario Kart NTSC...

Re: Is it possible to hard code Widescreen code inside an is

Posted: Wed Nov 05, 2014 12:58 pm
by Ralf@gc-forever
Okay, here we go.

1. The Legend of Zelda: The Wind Waker (NTSC-U)

Open the Wind Waker ISO with a hex editor of your choice and search for the following byte sequence:

C2480000 453B8000 3EDC28F6 3D3851EC
43660000 00000004 3FAAAAAB 481C4000
7F7FFFFF 00000000 3FB33333 3F8CCCCD
00000000 44200000 43F00000 3F666666
3F000000 40000000 41A00000 3F800000

Change the marked hex value from 3FAAAAAB to 3FE38E39 and save.

C2480000 453B8000 3EDC28F6 3D3851EC
43660000 00000004 3FE38E39 481C4000
7F7FFFFF 00000000 3FB33333 3F8CCCCD
00000000 44200000 43F00000 3F666666
3F000000 40000000 41A00000 3F800000


2. Mario Kart: Double Dash (NTSC-U)

Same here, open the MKDD ISO with a hex editor and search for the following byte sequence:

7C0803A6 38210010 4E800020 3C808033
3C608035 38A46EF8 9421FFF0 38850000
39032A28 C002B6BC 38C50010 C044000C
38650040 C0A40008 38E80000 ECE20032
C082B6C0 EC651024 C0C50000 81850010
38A80020 C0230008 81460008 ED272028
C1040004 ED450032 C003000C 38880040
D06DA9E8 ED6A2028 81260004 38680080
EC010024 8006000C 554BF87E 5406F87E
93E1000C 3806FFFF 3BEBFFFF EC454824
38C60001 396B0001 7CC93214 D0C80000
7D6C5A14 EC68382A D1070004 EC26502A
D0A70008 EC64182A EC24082A D127000C
D0C70010 D0A70018 D127001C D0670014
91880020 91250004 91450008 9005000C
91850010 90C50014 91450018 9005001C
D04DA9EC D0C80040 D1040004 D1640008
D124000C D0240010 D1040014 D1640018
D124001C D0C40020 D0640024 D1640028
D124002C D0240030 D0640034 D1640038
D124003C 91880080 91230004 93E30008
9003000C 91630010 91230014 93E30018
9003001C 91830020 90C30024 93E30028
93E30038 83E1000C 9003002C 91630030
90C30034 9003003C D00DA9F0 38210010
4E800020 9421FFF0 7C0802A6 90010014

Change the marked hex values

9421FFF0 -> 3D203FE3
EC651024 -> 61298E39
D06DA9E8 -> 912DA9E8
93E1000C -> 7FEEFB78
EC454824 -> 3DE04064
D04DA9EC -> 61EF9373
83E1000C -> 7DDF7378
38210010 -> 91EDA9EC

and save.

7C0803A6 38210010 4E800020 3C808033
3C608035 38A46EF8 3D203FE3 38850000
39032A28 C002B6BC 38C50010 C044000C
38650040 C0A40008 38E80000 ECE20032
C082B6C0 61298E39 C0C50000 81850010
38A80020 C0230008 81460008 ED272028
C1040004 ED450032 C003000C 38880040
912DA9E8 ED6A2028 81260004 38680080
EC010024 8006000C 554BF87E 5406F87E
7FEEFB78 3806FFFF 3BEBFFFF 3DE04064
38C60001 396B0001 7CC93214 D0C80000
7D6C5A14 EC68382A D1070004 EC26502A
D0A70008 EC64182A EC24082A D127000C
D0C70010 D0A70018 D127001C D0670014
91880020 91250004 91450008 9005000C
91850010 90C50014 91450018 9005001C
61EF9373 D0C80040 D1040004 D1640008
D124000C D0240010 D1040014 D1640018
D124001C D0C40020 D0640024 D1640028
D124002C D0240030 D0640034 D1640038
D124003C 91880080 91230004 93E30008
9003000C 91630010 91230014 93E30018
9003001C 91830020 90C30024 93E30028
93E30038 7DDF7378 9003002C 91630030
90C30034 9003003C D00DA9F0 91EDA9EC
4E800020 9421FFF0 7C0802A6 90010014

Re: Is it possible to hard code Widescreen code inside an is

Posted: Wed Nov 05, 2014 3:19 pm
by DragonBoy
Thank you so much! :D :D I've tried Wind Waker so far and it works wonderful! You're a legend! :) Quick (and probably stupid) question but I'll try it anyway....

The code for TLOZ - Wind Waker NTSC that you originally provided was this one:

=============================================
The Legend of Zelda: The Wind Waker [GZLE01]

16:9 Aspect Ratio (Widescreen) [Ralf]
043FA998 3FE38E39

=============================================

I noticed that the value we have to change for permanent use is the same, but the code that we have to look for is different.... Why is that? Also If I want to change a few other games, how can I do it myself instead of asking each time...?

Thank you very much again for your help and your hard work! :) :)

EDIT: I just noticed... That's not the case with Mario Kart... The original codes for use with the loaders are different... :?

=============================================
Mario Kart: Double Dash [GM4E01]

16:9 Aspect Ratio (Widescreen) [Ralf]
043CBE08 3FE38E39
043CBE0C 40649373
=============================================

Re: Is it possible to hard code Widescreen code inside an is

Posted: Wed Nov 05, 2014 5:03 pm
by novenary
I think the first word is the address to patch instead of the word to look for. The probability for having two identical words in the same file is pretty high.

Re: Is it possible to hard code Widescreen code inside an is

Posted: Wed Nov 05, 2014 8:35 pm
by MockyLock
Hey Ralf, may I ask you how you do those code tricks ?

Re: Is it possible to hard code Widescreen code inside an is

Posted: Wed Nov 05, 2014 9:12 pm
by DragonBoy
Its magic beyond magic! :D

Re: Is it possible to hard code Widescreen code inside an is

Posted: Thu Nov 06, 2014 4:20 am
by ShadowOne333
Really interesting...
I'm a little interested too in knowing how the code interacts directly with the HEX ROM values in the case of Mario Kart's code.

Re: Is it possible to hard code Widescreen code inside an is

Posted: Thu Nov 06, 2014 12:02 pm
by MockyLock
I'm more interested in the way Ralf can discover how and where you have to do the mod.

Re: Is it possible to hard code Widescreen code inside an is

Posted: Thu Nov 06, 2014 3:46 pm
by Ralf@gc-forever
The Wind Waker game use a predefined single-precision 32-bit IEEE 754 floating-point constant for the aspect ratio:

0x3FAAAAAB = 1.33333333 = 4:3

In the NTSC-U version of the game, this constant is stored at address 0x803FA998 in memory. The WW 16:9 Aspect Ratio code simply replaces the 4:3 aspect ratio constant with an appropriate value for a widescreen aspect ratio:

0x3FE38E39 = 1.77777778 = 16:9

Code: Select all


AR/WiiRD 16:9 Aspect Ratio code
043FA998 3FE38E39

04                = Code type (32-bit RAM write)
  3FA998          = Address
         3FE38E39 = Value


MKDD doesn't use a predefined constant for the aspect ratio. The aspect ratio and culling boundaries are calculated once during game start:

0x3FADB6DB = 1.35714281 = 608:448 (aspect ratio)
0x402E7E47 = 2.72645736 (culling)

In the NTSC-U version of the game, these variables are stored at address 0x803CBE08 & 0C in memory. The MKDD 16:9 Aspect Ratio code replaces these variables with appropriate values for widescreen format.

Unfortunately, there's no predefined constant we can use for an ISO aspect ratio patch. So instead, we need to patch the aspect ratio calculation function directly:

Code: Select all


Original aspect ratio calc function

801D6578:  9421FFF0	stwu	r1,-16(r1)
801D65A4:  EC651024	fdivs	f3,f5,f2		; f5: x res  f2: y res
801D65D0:  D06DA9E8	stfs	f3,-22040(r13)		; aspect ratio (f3 = 0x3FADB6DB = 1.35714281 = 608:448)
801D65F0:  93E1000C	stw	r31,12(r1)
801D65FC:  EC454824	fdivs	f2,f5,f9
801D6660:  D04DA9EC	stfs	f2,-22036(r13)		; culling (f2 = 0x402E7E47 = 2.72645736)
801D66D4:  83E1000C	lwz	r31,12(r1)
801D66EC:  38210010	addi	r1,r1,16

Modified aspect ratio calc function

801D6578:  3D203FE3	lis	r9,0x3FE3
801D65A4:  61298E39	ori	r9,r9,0x8E39
801D65D0:  912DA9E8	stw	r9,-22040(r13)		; aspect ratio (r9 = 0x3FE38E39)
801D65F0:  7FEEFB78	mr	r14,r31
801D65FC:  3DE04064	lis	r15,0x4064
801D6660:  61EF9373	ori	r15,r15,0x9373
801D66D4:  7DDF7378	mr	r31,r14
801D66EC:  91EDA9EC	stw	r15,-22036(r13)		; culling (r15 = 0x40649373)


Re: Is it possible to hard code Widescreen code inside an is

Posted: Thu Nov 06, 2014 6:58 pm
by tueidj
Those replacement numbers are slightly distorted, to convert a 4:3 aspect to 16:9 you should be multiplying by 4/3. 1.35714281 * 4/3 != 1.77777778.

Re: Is it possible to hard code Widescreen code inside an is

Posted: Fri Nov 07, 2014 12:28 pm
by DragonBoy
Thanks for the detailed explanation Ralf! :) It's a bit more complicated for me to do than what I suspected... :(

Re: Is it possible to hard code Widescreen code inside an is

Posted: Fri Nov 07, 2014 12:57 pm
by MockyLock
hey Ralf !
I wanted to do the same mod on the PAL iso.
I used the informations in the Wind Waker Pal thread you created :

16:9 Aspect Ratio (Widescreen) [Ralf]
044021C0 3FE38E39

in a Hex editor, but i don't know how to find the adress "4021C0", and which data i have to change for "3FE38E39".
I'm pretty new in game hacking, so i would appreciate some help :D
Thank you !

Re: Is it possible to hard code Widescreen code inside an is

Posted: Fri Nov 07, 2014 3:31 pm
by Ralf@gc-forever
Search for the following byte sequence in the PAL Wind Waker ISO:

C2480000 453B8000 3EDC28F6 3D3851EC
43660000 00000004 3FAAAAAB 481C4000
7F7FFFFF 00000000 3FE66666 40200000
00000000 44200000 43F00000 3F666666
3F000000 40000000 41A00000 3F800000

3FAAAAAB -> 3FE38E39

Re: Is it possible to hard code Widescreen code inside an is

Posted: Fri Nov 07, 2014 4:57 pm
by MockyLock
Sorry, i was no sure i had to search the same hex sequence.
So i'll try this in the next couple of hours.
Thanks !!

Re: Is it possible to hard code Widescreen code inside an is

Posted: Fri Nov 07, 2014 5:21 pm
by Ralf@gc-forever
It's not the same byte sequence, two floating-point constants are slightly different.

Re: Is it possible to hard code Widescreen code inside an is

Posted: Fri Nov 07, 2014 6:09 pm
by MockyLock
I was meaning the "3FAAAAAB".
Hell, i must study all this !

Re: Is it possible to hard code Widescreen code inside an is

Posted: Fri Nov 07, 2014 6:32 pm
by MockyLock
Me again.
So i tried, and failed.
I've done the swap, using HxD software. I loaded the iso using swiss (r283) but got a black screen (the iso is recognized in swiss).
I'll have to do more tests.
Thank you for your support !

EDIT :
the sequence around the sting i have to check doesn't look like yours.
My iso was ripped by myself from an original.
There must be something i miss in the how-to.

EDIT2 :fu**ing shame on me. I found the sequence you gave. I thought there could be only one per iso. -_-
I'm gona hide somewhere... a Mario's pipe...

Re: Is it possible to hard code Widescreen code inside an is

Posted: Thu Nov 20, 2014 9:24 pm
by DragonBoy
Hello guys... Back again... :)

Ralf... Would it be ok with you if I request 1-2 more games to have their respective widescreen code please...? :)

Re: Is it possible to hard code Widescreen code inside an is

Posted: Fri Nov 21, 2014 12:44 pm
by Ralf@gc-forever
Yep, sure.