Skip to content

Commit d0205dc

Browse files
authored
[XCX] Create new XCX
This update introduces enhancements to the graphical settings of Xenoblade Chronicles X by modifying the game's boot configuration file. The following adjustable parameters have been identified to produce noticeable visual differences: * sRGB Mode Toggle: Enables or disables sRGB color mode, affecting color accuracy and vibrancy.​ * Anti-Aliasing Toggle: Turns anti-aliasing on or off, impacting the smoothness of object edges and overall image clarity.​ * Bloom Effect Toggle: Allows the activation or deactivation of the bloom effect, influencing the intensity of light glow and scene brightness.​ * Cloud Height Minimum: Adjusts the minimum altitude at which clouds appear, altering the cloud coverage and atmospheric depth.​ * Cloud Height Maximum: Sets the maximum altitude for cloud rendering, affecting the vertical span of cloud formations in the sky.
1 parent 09207ed commit d0205dc

File tree

5 files changed

+3262
-0
lines changed

5 files changed

+3262
-0
lines changed
Lines changed: 280 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,280 @@
1+
[XCX_libini]
2+
moduleMatches = 0xF882D5CF, 0x30B6E091, 0x7672271D, 0x218F6E07, 0xAB97DE6B, 0x676EB33E, 0x785CA8A9 ; 1.0.1E, 1.0.2U, 1.0.2J, 1.0.0E, 1.0.1U, 1.0.0U, 1.0.0J
3+
.origin = codecave
4+
5+
;allocates memory to back up and restore registers r0-r31
6+
ini_register_backup:
7+
.uint 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
8+
;allocates memory to back up and restore the link register (LR)
9+
ini_linkregister_backup:
10+
.uint 0
11+
12+
;over writes original ini file with 0's
13+
DeleteINI:
14+
addi r30, r22, -4
15+
li r28, 0
16+
_whileLoopDeleteINI:
17+
stwu r28, 4(r30)
18+
lbz r24, 4(r30)
19+
cmpwi r24, 0
20+
bne+ _whileLoopDeleteINI
21+
blr
22+
23+
;passes PrintOnOff into the PrintSettings function wraper
24+
PrintOnOffSettingsINImod:
25+
lis r27, PrintOnOffINImod@hi
26+
ori r27, r27, PrintOnOffINImod@l
27+
b PrintSettingsINImod
28+
29+
;passes PrintStringValue into the PrintSettings function wraper
30+
PrintStringValueSettingsINImod:
31+
lis r27, PrintStringValueINImod@hi
32+
ori r27, r27, PrintStringValueINImod@l
33+
b PrintSettingsINImod
34+
35+
;passes Callsprintf directly into the PrintSettings function wraper
36+
PrintFloatSettingsINImod:
37+
lis r27, CallsprintfINImod@hi
38+
ori r27, r27, CallsprintfINImod@l
39+
b PrintSettingsINImod
40+
41+
;passes PrintAMVP into the PrintSettings function wraper
42+
PrintAMVPSettingsINImod:
43+
lis r27, PrintAMVPINImod@hi
44+
ori r27, r27, PrintAMVPINImod@l
45+
b PrintSettingsINImod
46+
47+
;takes in a pointer to a string(r22), and prints it
48+
PrintSettingNameINImod:
49+
lwzu r29, 4(r22)
50+
addi r29, r29, -1
51+
_whileloopPrintSettingNameINImod:
52+
lbzu r26, 1(r29)
53+
stbu r26, 1(r30)
54+
cmpwi r26, 0
55+
bne+ _whileloopPrintSettingNameINImod
56+
blr
57+
58+
;prints new line character
59+
PrintNewLineINImod:
60+
li r26, 0x0D0A
61+
sth r26, 0(r30)
62+
addi r30, r30, 1
63+
blr
64+
65+
;function wraper that takes in r20 and a function pointer(r27)
66+
;loops the function by the ammount in r20
67+
PrintSettingsINImod:
68+
mflr r31
69+
_forloopPrintSettingsINImod:
70+
bl PrintSettingNameINImod
71+
mtctr r27
72+
bctrl
73+
bl PrintNewLineINImod
74+
addic. r20, r20, -1
75+
bgt+ _forloopPrintSettingsINImod
76+
mtlr r31
77+
blr
78+
79+
;checks if the floating point precision is less than 0 or greater than 9
80+
;if so set precision to 1 to prevent the game from crashing
81+
CheckifPrecisionIsValidINImod:
82+
cmpwi r26, 0x30+0
83+
bge+ _ifPrecisionLessThan0INImod
84+
li r26, 0x30+1
85+
_ifPrecisionLessThan0INImod:
86+
cmpwi r26, 0x30+9
87+
ble+ _ifPrecisionGreaterThan9INImod
88+
li r26, 0x30+1
89+
_ifPrecisionGreaterThan9INImod:
90+
blr
91+
92+
;calls the C function sprintf()
93+
;takes in a pointer to a formating string by r4
94+
;takes in an address to print to by r3
95+
;takes in a float to print by f1
96+
;outputs the last address printed to in r11
97+
CallsprintfINImod:
98+
mflr r29
99+
lfsu f1, 4(r24)
100+
lis r4, str_floating_precision_INImod@hi
101+
ori r4, r4, str_floating_precision_INImod@l
102+
lbzu r26, 1(r21)
103+
addi r26, r26, 0x30
104+
bl CheckifPrecisionIsValidINImod
105+
stb r26, 2(r4)
106+
or r3, r30, r30
107+
CREQV 4*cr1+eq, 4*cr1+eq, 4*cr1+eq ;required for some reason
108+
mtctr r25
109+
bctrl ;bl sprintf
110+
or r30, r11, r11
111+
mtlr r29
112+
blr
113+
114+
;takes in r23 and prints either on or off
115+
PrintOnOffINImod:
116+
lwzu r26, 4(r23)
117+
stw r26, 0(r30)
118+
_whileloopPrintOnOffINImod:
119+
lbzu r26, 1(r30)
120+
cmpwi r26, 0
121+
bne+ _whileloopPrintOnOffINImod
122+
blr
123+
124+
;takes in a string pointer(r18), and hijacks PrintSettingName to print it
125+
PrintStringValueINImod:
126+
mflr r28
127+
addi r30, r30, -1
128+
or r19, r22, r22
129+
or r22, r18, r18
130+
bl PrintSettingNameINImod
131+
or r18, r22, r22
132+
or r22, r19, r19
133+
mtlr r28
134+
blr
135+
136+
;takes in a floating point(r24), and its precision(r21)
137+
;calls sprintf() 3 times to print 3 floats sperated by a comma
138+
PrintAMVPINImod:
139+
mflr r28
140+
lis r19, 0x202C
141+
ori r19, r19, 0x2000
142+
bl CallsprintfINImod
143+
stw r19, 0(r30)
144+
addi r30, r30, 3
145+
addi r21, r21, -1
146+
bl CallsprintfINImod
147+
stw r19, 0(r30)
148+
addi r30, r30, 3
149+
addi r21, r21, -1
150+
bl CallsprintfINImod
151+
mtlr r28
152+
blr
153+
154+
; r22 == 0x23f09100
155+
; registers that do not need to be restored:
156+
; r25 r24 r28 r10
157+
EditINIforinimod:
158+
;back up registers r0-r31
159+
lis r10, ini_register_backup@ha
160+
stmw r0, ini_register_backup@l(r10)
161+
;back up link register
162+
mflr r25
163+
lis r10, ini_linkregister_backup@ha
164+
stw r25, ini_linkregister_backup@l(r10)
165+
;load the function pointer for the C function sprintf() into r25
166+
lis r25, sprintfFunctionPointer@hi
167+
ori r25, r25, sprintfFunctionPointer@l
168+
;deletes the lib.ini file in ram so we can over write it with our own
169+
bl DeleteINI
170+
171+
;r30 will track current position in file
172+
addi r30, r22, -1
173+
;r22 will keep track of the current setting
174+
lis r22, lookuptable_settingname_INImod@ha
175+
addi r22, r22, lookuptable_settingname_INImod@l-4
176+
;r23 will keep track of on/off settings
177+
lis r23, lookuptable_onoff_INImod@ha
178+
addi r23, r23, lookuptable_onoff_INImod@l-4
179+
;r24 will keep track of floating point numbers
180+
lis r24, lookuptable_float_INImod@ha
181+
addi r24, r24, lookuptable_float_INImod@l-4
182+
;r21 will keep track of floating point precision
183+
lis r21, lookuptable_float_precision_INImod@ha
184+
addi r21, r21, lookuptable_float_precision_INImod@l-1
185+
;r18 will keep track of string values (only used for luttex1 & cube)
186+
lis r18, lookuptable_stringvalue_INImod@ha
187+
addi r18, r18, lookuptable_stringvalue_INImod@l-4
188+
;the r20 is how many times the loop executes, aka number of settings to print
189+
190+
;print all the on off settings at the begining of the file
191+
li r20, 9
192+
bl PrintOnOffSettingsINImod
193+
194+
;print luttex1 and cube setting
195+
li r20, 2
196+
bl PrintStringValueSettingsINImod
197+
198+
;print float settings until hitting an on/off setting
199+
li r20, 41
200+
bl PrintFloatSettingsINImod
201+
202+
;print red auto on/off setting
203+
li r20, 1
204+
bl PrintOnOffSettingsINImod
205+
206+
;print float settings until hitting an on/off setting
207+
li r20, 14
208+
bl PrintFloatSettingsINImod
209+
210+
;print blur on/off setting
211+
li r20, 1
212+
bl PrintOnOffSettingsINImod
213+
214+
;print float settings until hitting an on/off setting
215+
li r20, 3
216+
bl PrintFloatSettingsINImod
217+
218+
;print shadow half on/off setting
219+
li r20, 1
220+
bl PrintOnOffSettingsINImod
221+
222+
;print float settings until hitting an on/off setting
223+
li r20, 3
224+
bl PrintFloatSettingsINImod
225+
226+
;print sRGBmode on/off setting
227+
li r20, 1
228+
bl PrintOnOffSettingsINImod
229+
230+
;print float settings until hitting avmp settings
231+
li r20, 11
232+
bl PrintFloatSettingsINImod
233+
234+
;print avmp settings
235+
li r20, 16
236+
bl PrintAMVPSettingsINImod
237+
238+
;print last 2 float settings settings
239+
li r20, 2
240+
bl PrintFloatSettingsINImod
241+
242+
ExitEditINImod:
243+
;restore registers r0-r31 & LR
244+
lis r10, ini_linkregister_backup@ha
245+
lwz r25, ini_linkregister_backup@l(r10)
246+
mtlr r25
247+
lis r10, ini_register_backup@ha
248+
lmw r0, ini_register_backup@l(r10)
249+
;restores line we over wrote and returns to the game
250+
;lwz r22, 0xa0(r31)
251+
addi r25,r1,0x38
252+
blr
253+
254+
255+
[XCX_libini_V101E]
256+
moduleMatches = 0xF882D5CF, 0x218F6E07 ; 1.0.1E, 1.0.0E
257+
;pointer for the C function sprintf()
258+
sprintfFunctionPointer = 0x03B18118
259+
;patches the address with a branch link to the mod
260+
0x02FF94C8 = bla EditINIforinimod
261+
262+
[XCX_libini_V102U]
263+
moduleMatches = 0x30B6E091 ; 1.0.2U
264+
sprintfFunctionPointer = 0x03B18098
265+
0x02FF9468 = bla EditINIforinimod
266+
267+
[XCX_libini_V102J]
268+
moduleMatches = 0x7672271D ; 1.0.2J
269+
sprintfFunctionPointer = 0x03B134B0
270+
0x02FF4990 = bla EditINIforinimod
271+
272+
[XCX_libini_V100U]
273+
moduleMatches = 0xAB97DE6B, 0x676EB33E ; 1.0.1U, 1.0.0U
274+
sprintfFunctionPointer = 0x03B17F18
275+
0x02FF92F0 = bla EditINIforinimod
276+
277+
[XCX_libini_V100J]
278+
moduleMatches = 0x785CA8A9 ; 1.0.0J
279+
sprintfFunctionPointer = 0x03B0DEB0
280+
0x02FEF588 = bla EditINIforinimod

0 commit comments

Comments
 (0)