Auto-Fix DWC_Emulator 60000 EC Bug [Vega]
NOTICE: This code is to fix an DWC-Emulator-specific 60000 EC bug. What is the DWC-Emulator 60000 bug? It occurs when a user makes a brand new FC on a server that uses the DWC Emulator source. After making said new FC, he/she reconnects and instantly gets EC 60000 even though said person did not get any error codes when the FC was first made. This EC 60000 for that license is there forever until the user deletes the license. However, the bug will still occur again and again for every new DWC Emulator FC made. This code has NOTHING to do with getting a standard EC 60000 due to using a Wiimmfi-made FC on a DWC Emulator server.
What this code does:
1. Deletes your Game's Data Save! You have been warned! (too lazy to write extra source to search the Data save and delete the PID of a particular license)
2. Writes a new random generated value to your DWC_Authdata File
3. Returns you back to the Wii Menu
4. Bug is fixed permanently. (You only need to run the code once!)
This code executes the moment you boot the game. A visual glitch + brief pause will occur, then you will be back at the Wii Menu. The Wii Menu return function may not work on Dolphin but the code has still been executed.
Do NOT run any other codes when using this.
NTSC-U
C20095F4 0000001F
3FE08016 4800002D
2F746974 6C652F30
30303130 3030342F
35323464 34333435
2F646174 612F726B
7379732E 64617400
7C6802A6 63ECA6EC
7D8803A6 4E800021
2C030000 408200A0
3FC08000 63C61502
38E00002 38600004
7C6903A6 7C8C42E6
38600000 38A00000
548007FF 40820008
38840001 7C6319D6
7CA42A14 7C632A14
5463843E 4200FFF0
B4660002 34E7FFFF
4082FFC4 4800001D
2F736861 72656432
2F445743 5F415554
48444154 41000000
7C6802A6 38800002
63ECADBC 7D8803A6
4E800021 2C030000
4180001C 7C7D1B78
63C41500 38A00020
63ECB220 7D8803A6
4E800021 3D80801A
618C87B8 7D8803A6
4E800020 00000000
PAL
C2009634 0000001F
3FE08016 4800002D
2F746974 6C652F30
30303130 3030342F
35323464 34333530
2F646174 612F726B
7379732E 64617400
7C6802A6 63ECA78C
7D8803A6 4E800021
2C030000 408200A0
3FC08000 63C61502
38E00002 38600004
7C6903A6 7C8C42E6
38600000 38A00000
548007FF 40820008
38840001 7C6319D6
7CA42A14 7C632A14
5463843E 4200FFF0
B4660002 34E7FFFF
4082FFC4 4800001D
2F736861 72656432
2F445743 5F415554
48444154 41000000
7C6802A6 38800002
63ECAE5C 7D8803A6
4E800021 2C030000
4180001C 7C7D1B78
63C41500 38A00020
63ECB2C0 7D8803A6
4E800021 3D80801A
618C8858 7D8803A6
4E800020 00000000
NTSC-J
C2009590 0000001F
3FE08016 4800002D
2F746974 6C652F30
30303130 3030342F
35323464 34333461
2F646174 612F726B
7379732E 64617400
7C6802A6 63ECA6AC
7D8803A6 4E800021
2C030000 408200A0
3FC08000 63C61502
38E00002 38600004
7C6903A6 7C8C42E6
38600000 38A00000
548007FF 40820008
38840001 7C6319D6
7CA42A14 7C632A14
5463843E 4200FFF0
B4660002 34E7FFFF
4082FFC4 4800001D
2F736861 72656432
2F445743 5F415554
48444154 41000000
7C6802A6 38800002
63ECAD7C 7D8803A6
4E800021 2C030000
4180001C 7C7D1B78
63C41500 38A00020
63ECB1E0 7D8803A6
4E800021 3D80801A
618C8778 7D8803A6
4E800020 00000000
NTSC-K
C200973C 0000001F
3FE08016 4800002D
2F746974 6C652F30
30303130 3030342F
35323464 34333462
2F646174 612F726B
7379732E 64617400
7C6802A6 63ECA828
7D8803A6 4E800021
2C030000 408200A0
3FC08000 63C61502
38E00002 38600004
7C6903A6 7C8C42E6
38600000 38A00000
548007FF 40820008
38840001 7C6319D6
7CA42A14 7C632A14
5463843E 4200FFF0
B4660002 34E7FFFF
4082FFC4 4800001D
2F736861 72656432
2F445743 5F415554
48444154 41000000
7C6802A6 38800002
63ECAEF8 7D8803A6
4E800021 2C030000
4180001C 7C7D1B78
63C41500 38A00020
63ECB35C 7D8803A6
4E800021 3D80801A
618C8BB4 7D8803A6
4E800020 00000000
Code creator: Vega
Code credits: Megazig
Source:
#START ASSEMBLY
#800095F4 = NTSC-U
#80009634 = PAL
#80009590 = NTSC-J
#8000973C = NTSC-K
#Set Code Region
.set region, '' #Fill in E, P, J, or K within the quotes for your region when Compiling! Lowercase letters can also be used.
#Macros and Statements
.macro call_isfs, address
ori r12, r31, \address@l
mtlr r12
blrl
.endm
.macro call_nolink address
lis r12, \address@h
ori r12, r12, \address@l
mtlr r12
blr
.endm
.if (region == 'E' || region == 'e') # RMCE
.set ISFS_Delete, 0xA6EC
.set ISFS_Open, 0xADBC
.set ISFS_Write, 0xB220
.set Wii_Menu, 0x801A87B8
.elseif (region == 'P' || region == 'p') # RMCP
.set ISFS_Delete, 0xA78C
.set ISFS_Open, 0xAE5C
.set ISFS_Write, 0xB2C0
.set Wii_Menu, 0x801A8858
.elseif (region == 'J' || region == 'j') # RMCJ
.set ISFS_Delete, 0xA6AC
.set ISFS_Open, 0xAD7C
.set ISFS_Write, 0xB1E0
.set Wii_Menu, 0x801A8778
.elseif (region == 'K' || region == 'k') # RMCK
.set ISFS_Delete, 0xA828
.set ISFS_Open, 0xAEF8
.set ISFS_Write, 0xB35C
.set Wii_Menu, 0x801A8BB4
.else # Invalid Region
.err
.endif
#Set Upper 16 bits for ISFS Macro
lis r31, 0x8016
#Delete Data Save
bl data_save
.if (region == 'E' || region == 'e') # RMCE
.string "/title/00010004/524d4345/data/rksys.dat"
.elseif (region == 'P' || region == 'p') # RMCP
.string "/title/00010004/524d4350/data/rksys.dat"
.elseif (region == 'J' || region == 'j') # RMCJ
.string "/title/00010004/524d434a/data/rksys.dat"
.elseif (region == 'K' || region == 'k') # RMCK
.string "/title/00010004/524d434b/data/rksys.dat"
.else # Invalid Region
.err
.endif
data_save:
mflr r3
call_isfs ISFS_Delete
cmpwi r3, 0
bne- launch_menu
#Generate Random Halfword Value
lis r30, 0x8000
ori r6, r30, 0x1502
li r7, 2
gen_rando:
li r3, 4
mtctr r3 #LR doesn't need to be backed up for this subroutine
mftbl r4 #Seed register
li r3, 0 #Square-value register, start at 0
li r5, 0 #Starting Weyl variable, start at 0
clrlwi. r0, r4, 31 #Seed needs to be an odd number
bne- weyl_loop
addi r4, r4, 1 #Make seed odd
weyl_loop:
mullw r3, r3, r3 #Square the Value
add r5, r4, r5 #Add the constant seed to Weyl variable. Result is new Weyl variable
add r3, r3, r5 #Add Weyl variable to squared value
srwi r3, r3, 16 #Place upper 16 bits into lower 16 bits, upper 16 bits are now cleared
bdnz+ weyl_loop
sthu r3, 0x2 (r6)
subic. r7, r7, 1
bne+ gen_rando #Final random word is stored at 0x80001504
#Open File
bl dwc_authdata
.string "/shared2/DWC_AUTHDATA"
.align 2
dwc_authdata:
mflr r3
li r4, 2
call_isfs ISFS_Open
cmpwi r3, 0
blt- launch_menu
mr r29, r3
#Write new DWC AUTHDATA; r3 already set
ori r4, r30, 0x1500 #Have null word in front of rando value, makes it 100% impossible to exceed AUTHDATA max value
li r5, 32 #32 bytes to write
call_isfs ISFS_Write
#No need for return check or file close, launch menu function is next anyway
launch_menu:
call_nolink Wii_Menu
#END ASSEMBLY
NOTICE: This code is to fix an DWC-Emulator-specific 60000 EC bug. What is the DWC-Emulator 60000 bug? It occurs when a user makes a brand new FC on a server that uses the DWC Emulator source. After making said new FC, he/she reconnects and instantly gets EC 60000 even though said person did not get any error codes when the FC was first made. This EC 60000 for that license is there forever until the user deletes the license. However, the bug will still occur again and again for every new DWC Emulator FC made. This code has NOTHING to do with getting a standard EC 60000 due to using a Wiimmfi-made FC on a DWC Emulator server.
What this code does:
1. Deletes your Game's Data Save! You have been warned! (too lazy to write extra source to search the Data save and delete the PID of a particular license)
2. Writes a new random generated value to your DWC_Authdata File
3. Returns you back to the Wii Menu
4. Bug is fixed permanently. (You only need to run the code once!)
This code executes the moment you boot the game. A visual glitch + brief pause will occur, then you will be back at the Wii Menu. The Wii Menu return function may not work on Dolphin but the code has still been executed.
Do NOT run any other codes when using this.
NTSC-U
C20095F4 0000001F
3FE08016 4800002D
2F746974 6C652F30
30303130 3030342F
35323464 34333435
2F646174 612F726B
7379732E 64617400
7C6802A6 63ECA6EC
7D8803A6 4E800021
2C030000 408200A0
3FC08000 63C61502
38E00002 38600004
7C6903A6 7C8C42E6
38600000 38A00000
548007FF 40820008
38840001 7C6319D6
7CA42A14 7C632A14
5463843E 4200FFF0
B4660002 34E7FFFF
4082FFC4 4800001D
2F736861 72656432
2F445743 5F415554
48444154 41000000
7C6802A6 38800002
63ECADBC 7D8803A6
4E800021 2C030000
4180001C 7C7D1B78
63C41500 38A00020
63ECB220 7D8803A6
4E800021 3D80801A
618C87B8 7D8803A6
4E800020 00000000
PAL
C2009634 0000001F
3FE08016 4800002D
2F746974 6C652F30
30303130 3030342F
35323464 34333530
2F646174 612F726B
7379732E 64617400
7C6802A6 63ECA78C
7D8803A6 4E800021
2C030000 408200A0
3FC08000 63C61502
38E00002 38600004
7C6903A6 7C8C42E6
38600000 38A00000
548007FF 40820008
38840001 7C6319D6
7CA42A14 7C632A14
5463843E 4200FFF0
B4660002 34E7FFFF
4082FFC4 4800001D
2F736861 72656432
2F445743 5F415554
48444154 41000000
7C6802A6 38800002
63ECAE5C 7D8803A6
4E800021 2C030000
4180001C 7C7D1B78
63C41500 38A00020
63ECB2C0 7D8803A6
4E800021 3D80801A
618C8858 7D8803A6
4E800020 00000000
NTSC-J
C2009590 0000001F
3FE08016 4800002D
2F746974 6C652F30
30303130 3030342F
35323464 34333461
2F646174 612F726B
7379732E 64617400
7C6802A6 63ECA6AC
7D8803A6 4E800021
2C030000 408200A0
3FC08000 63C61502
38E00002 38600004
7C6903A6 7C8C42E6
38600000 38A00000
548007FF 40820008
38840001 7C6319D6
7CA42A14 7C632A14
5463843E 4200FFF0
B4660002 34E7FFFF
4082FFC4 4800001D
2F736861 72656432
2F445743 5F415554
48444154 41000000
7C6802A6 38800002
63ECAD7C 7D8803A6
4E800021 2C030000
4180001C 7C7D1B78
63C41500 38A00020
63ECB1E0 7D8803A6
4E800021 3D80801A
618C8778 7D8803A6
4E800020 00000000
NTSC-K
C200973C 0000001F
3FE08016 4800002D
2F746974 6C652F30
30303130 3030342F
35323464 34333462
2F646174 612F726B
7379732E 64617400
7C6802A6 63ECA828
7D8803A6 4E800021
2C030000 408200A0
3FC08000 63C61502
38E00002 38600004
7C6903A6 7C8C42E6
38600000 38A00000
548007FF 40820008
38840001 7C6319D6
7CA42A14 7C632A14
5463843E 4200FFF0
B4660002 34E7FFFF
4082FFC4 4800001D
2F736861 72656432
2F445743 5F415554
48444154 41000000
7C6802A6 38800002
63ECAEF8 7D8803A6
4E800021 2C030000
4180001C 7C7D1B78
63C41500 38A00020
63ECB35C 7D8803A6
4E800021 3D80801A
618C8BB4 7D8803A6
4E800020 00000000
Code creator: Vega
Code credits: Megazig
Source:
#START ASSEMBLY
#800095F4 = NTSC-U
#80009634 = PAL
#80009590 = NTSC-J
#8000973C = NTSC-K
#Set Code Region
.set region, '' #Fill in E, P, J, or K within the quotes for your region when Compiling! Lowercase letters can also be used.
#Macros and Statements
.macro call_isfs, address
ori r12, r31, \address@l
mtlr r12
blrl
.endm
.macro call_nolink address
lis r12, \address@h
ori r12, r12, \address@l
mtlr r12
blr
.endm
.if (region == 'E' || region == 'e') # RMCE
.set ISFS_Delete, 0xA6EC
.set ISFS_Open, 0xADBC
.set ISFS_Write, 0xB220
.set Wii_Menu, 0x801A87B8
.elseif (region == 'P' || region == 'p') # RMCP
.set ISFS_Delete, 0xA78C
.set ISFS_Open, 0xAE5C
.set ISFS_Write, 0xB2C0
.set Wii_Menu, 0x801A8858
.elseif (region == 'J' || region == 'j') # RMCJ
.set ISFS_Delete, 0xA6AC
.set ISFS_Open, 0xAD7C
.set ISFS_Write, 0xB1E0
.set Wii_Menu, 0x801A8778
.elseif (region == 'K' || region == 'k') # RMCK
.set ISFS_Delete, 0xA828
.set ISFS_Open, 0xAEF8
.set ISFS_Write, 0xB35C
.set Wii_Menu, 0x801A8BB4
.else # Invalid Region
.err
.endif
#Set Upper 16 bits for ISFS Macro
lis r31, 0x8016
#Delete Data Save
bl data_save
.if (region == 'E' || region == 'e') # RMCE
.string "/title/00010004/524d4345/data/rksys.dat"
.elseif (region == 'P' || region == 'p') # RMCP
.string "/title/00010004/524d4350/data/rksys.dat"
.elseif (region == 'J' || region == 'j') # RMCJ
.string "/title/00010004/524d434a/data/rksys.dat"
.elseif (region == 'K' || region == 'k') # RMCK
.string "/title/00010004/524d434b/data/rksys.dat"
.else # Invalid Region
.err
.endif
data_save:
mflr r3
call_isfs ISFS_Delete
cmpwi r3, 0
bne- launch_menu
#Generate Random Halfword Value
lis r30, 0x8000
ori r6, r30, 0x1502
li r7, 2
gen_rando:
li r3, 4
mtctr r3 #LR doesn't need to be backed up for this subroutine
mftbl r4 #Seed register
li r3, 0 #Square-value register, start at 0
li r5, 0 #Starting Weyl variable, start at 0
clrlwi. r0, r4, 31 #Seed needs to be an odd number
bne- weyl_loop
addi r4, r4, 1 #Make seed odd
weyl_loop:
mullw r3, r3, r3 #Square the Value
add r5, r4, r5 #Add the constant seed to Weyl variable. Result is new Weyl variable
add r3, r3, r5 #Add Weyl variable to squared value
srwi r3, r3, 16 #Place upper 16 bits into lower 16 bits, upper 16 bits are now cleared
bdnz+ weyl_loop
sthu r3, 0x2 (r6)
subic. r7, r7, 1
bne+ gen_rando #Final random word is stored at 0x80001504
#Open File
bl dwc_authdata
.string "/shared2/DWC_AUTHDATA"
.align 2
dwc_authdata:
mflr r3
li r4, 2
call_isfs ISFS_Open
cmpwi r3, 0
blt- launch_menu
mr r29, r3
#Write new DWC AUTHDATA; r3 already set
ori r4, r30, 0x1500 #Have null word in front of rando value, makes it 100% impossible to exceed AUTHDATA max value
li r5, 32 #32 bytes to write
call_isfs ISFS_Write
#No need for return check or file close, launch menu function is next anyway
launch_menu:
call_nolink Wii_Menu
#END ASSEMBLY