Skip to content

Commit

Permalink
New stuff.
Browse files Browse the repository at this point in the history
- Mod Creator new functions
- UCAutoPatcher
- UCResolutionPatcher
- Fixed configs to work with multiple games now :)
  • Loading branch information
MaxLastBreath committed Oct 5, 2024
1 parent d8381e2 commit 9628407
Show file tree
Hide file tree
Showing 6 changed files with 447 additions and 178 deletions.
236 changes: 236 additions & 0 deletions src/Patches/Breath Of The Wild/Options.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
{
"Keys": {
"freecam": {
"Name": "FreeCam NEW",
"Class": "bool",
"Section": "main",
"Auto": false,
"Default": true,
"Description": "UltraCam Beyond Freecam! NEWLY IMPROVED FREECAM from 2.0\nTurning this off will, not let you trigger freecam with controller.\n",
"Config_Class": [
"UltraCam",
"TriggerWithController"
]
},
"fps": {
"Name": "FPS",
"Class": "scale",
"Section": "main",
"Auto": false,
"Values": [
20,
240
],
"Type": "s32",
"Default": 60,
"Increments": 5,
"Description": "UltraCam Beyond New FPS setting.\nLet's you set to any FPS\nWARNING: SET TO 120 FPS FOR UNCAPPED.\nRecommended 30, 60 FPS caps for best FRAMETIMES.",
"Config_Class": [
"Resolution",
"MaxFramerate"
]
},
"menu fps": {
"Name": "Menu FPS",
"Class": "scale",
"Section": "main",
"Auto": false,
"Values": [
20,
120
],
"Type": "s32",
"Default": 60,
"Increments": 5,
"Description": "UltraCam Beyond NEW MENU FPS CAP. Set to your desire.",
"Config_Class": [
"Features",
"MenuFPSLock"
]
},
"fov": {
"Name": "FOV",
"Class": "scale",
"Section": "main",
"Auto": false,
"Values": [
20,
120
],
"Type": "s32",
"Default": 50,
"Increments": 5,
"Description": "UltraCam Beyond NEW FOV setting, allows you to set FOV to anything\nThis now also scales up everything related to FOV.",
"Config_Class": [
"Features",
"Fov"
]
},
"quality improvements": {
"Name": "Quality Improvements",
"Class": "bool",
"Section": "main",
"Auto": false,
"Default": true,
"Description": "UltraCam Beyond Quality Improvements. This disables FXAA, FSR and Dynamic Resolution\nWARNING: SHOULD ALWAYS BE TURNED ON WITH HIGH RESOLUTION",
"Config_Class": [
"Resolution",
"QualityImprovements"
]
},
"resolution": {
"Name": "Resolution",
"Class": "dropdown",
"Section": "main",
"Auto": false,
"Name_Values": [
"720p",
"900p",
"1080p",
"1152p"
],
"Values": [
"1280x720",
"1600x900",
"1920x1080",
"2048x1152"
],
"Default": 2,
"Description": "UltraCam Beyond NEW Resolution Scaling uses internal resolution\nWARNING: ANYTHING OVER 1440P REQUIRES EXTENDED MEMORY",
"Config_Class": [
"Resolution",
"Width",
"Height"
]
},
"render distance": {
"Name": "Render Distance",
"Class": "dropdown",
"Section": "main",
"Auto": false,
"Name_Values": [
"VERY LOW",
"LOW",
"MEDIUM",
"DEFAULT",
"(EXPERIMENTAL) HAS ISSUES"
],
"Values": [
1000,
5000,
12500,
25000,
35000
],
"Default": 3,
"Description": "UltraCam Beyond Render Distance.\nDefault is 25000. Increased is 50000.\nMay see a small benefit on low, up to 20% fps.\nExpect the game to use fog like rendering Minecraft.",
"Config_Class": [
"Resolution",
"RenderDistance"
]
},
"hide ui": {
"Name": "Auto Hide UI in FreeCam",
"Class": "bool",
"Section": "extra",
"Auto": false,
"Default": true,
"Description": "UltraCam Beyond AUTO Hide UI, this will automatically hide the UI in freecam mode.",
"Config_Class": [
"UltraCam",
"AutoHideUI"
]
},
"freecam sens": {
"Name": "Freecam Sensitivity",
"Class": "scale",
"Section": "extra",
"Auto": false,
"Values": [
10,
100
],
"Type": "s32",
"Default": 30,
"Increments": 5,
"Description": "Increase Freecam Sensitivity.",
"Config_Class": [
"UltraCam",
"CameraSpeed"
]
},
"freecam speed": {
"Name": "Freecam Speed",
"Class": "scale",
"Section": "extra",
"Auto": false,
"Values": [
1,
20
],
"Type": "s32",
"Default": 5,
"Increments": 1,
"Description": "Increase Camera Movement Speed.",
"Config_Class": [
"UltraCam",
"Speed"
]
},
"ani smoothing": {
"Name": "Sequence Smoothing",
"Class": "scale",
"Section": "extra",
"Auto": true,
"Values": [
0.1,
0.5
],
"Type": "f32",
"Default": 0.25,
"Increments": 0.05,
"Description": "Animation Smoothing set to auto for now.",
"Config_Class": [
"UltraCam",
"AnimationSmoothing"
]
},
"animationfadeout": {
"Name": "Last Keyframe Fadeout",
"Class": "bool",
"Section": "extra",
"Auto": false,
"Default": false,
"Description": "Improves the smoothness of the last Keyframe for UltraCam sequencer.",
"Config_Class": [
"UltraCam",
"AnimationFadeout"
]
},
"benchmark": {
"Name": "Benchmark Selection",
"Class": "dropdown",
"Section": "extra",
"Auto": false,
"Name_Values": [
"Kakariko",
"Great Sky Island",
"Lookout Landing",
"Goron City",
"Korok Forest"
],
"Values": [
0,
1,
2,
3
],
"Default": 1,
"Description": "UltraCam Beyond preset default benchmark.\nTrigger when you press G",
"Config_Class": [
"Benchmark",
"Benchmark"
]
}
}
}
4 changes: 2 additions & 2 deletions src/Patches/Breath Of The Wild/PatchInfo.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"Name" : "Breath of The Wild",
"ID" : "0100F2C0115B6000",
"ModName" : "!!!TOTK Optimizer",
"ID" : "01007EF00011E000",
"ModName" : "!!!BOTW Optimizer",
"ModConfig" : "UltraCam/maxlastbreath.ini",
"Config" : "Options.json",
"Versions" : ["1.1.0", "1.1.1", "1.1.2", "1.2.0", "1.2.1"]
Expand Down
4 changes: 2 additions & 2 deletions src/form.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ def __init__(self, window):
def warning(self, e):
messagebox.showwarning(f"{e}")


def LoadNewGameInfo(self):
for item in self.patches:
if (self.PatchName.get() == item.Name):
Expand Down Expand Up @@ -182,6 +181,7 @@ def LoadPatches(self, canvas, pos_dict):
self.BEYOND_Patches[name] = patch_var

def DeletePatches(self):
self.BEYOND_Patches.clear()
self.all_canvas[0].delete("patchinfo")

def create_canvas(self):
Expand Down Expand Up @@ -256,7 +256,7 @@ def onCanvasClick(event):
master=self._window, canvas=canvas,
text="Select Game:",
variable=value[0], values=value,
row=row, cul=340, drop_cul=480,
row=row, cul=340, drop_cul=430,
tags=["text"], tag="GameSelect",
description_name="GameSelect",
command= lambda event: self.LoadNewGameInfo()
Expand Down
82 changes: 5 additions & 77 deletions src/modules/GameManager/FileManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,9 @@ def Create_Mod_Patch(mode=None):
cls.add_list.append("Mod Manager Patch")
cls.add_list.append("UltraCam")


# THIS NEEDS TO BE CHANGED SOON.

ini_file_directory = os.path.join(cls.load_dir, "!!!TOTK Optimizer", "romfs", "UltraCam")
os.makedirs(ini_file_directory, exist_ok=True)
ini_file_path = os.path.join(ini_file_directory, "maxlastbreath.ini")
Expand All @@ -392,83 +395,8 @@ def Create_Mod_Patch(mode=None):
config.read(ini_file_path)

## TOTK UC BEYOND AUTO PATCHER
patch_info = cls._frontend.ultracam_beyond.get("Keys", [""])
for patch in cls._frontend.BEYOND_Patches:
if patch.lower() in ["resolution", "aspect ratio"]:
continue

patch_dict = patch_info[patch]
patch_class = patch_dict["Class"]
patch_Config = patch_dict["Config_Class"]
patch_Default = patch_dict["Default"]

# Ensure we have the section required.
if not config.has_section(patch_Config[0]):
config[patch_Config[0]] = {}

# In case we have an auto patch.
if cls._frontend.BEYOND_Patches[patch] == "auto" or cls._frontend.BEYOND_Patches[patch].get() == "auto":
if patch_class.lower() == "dropdown":
patch_Names = patch_dict["Values"]
config[patch_Config[0]][patch_Config[1]] = str(patch_Names[patch_Default])
else:
config[patch_Config[0]][patch_Config[1]] = str(patch_Default)
continue

if patch_class.lower() == "bool" or patch_class.lower() == "scale":
config[patch_Config[0]][patch_Config[1]] = cls._frontend.BEYOND_Patches[patch].get()

if patch_class.lower() == "dropdown":
# exclusive to dropdown.
patch_Names = patch_dict["Name_Values"]
patch_Values = patch_dict["Values"]
index = patch_Names.index(cls._frontend.BEYOND_Patches[patch].get())
config[patch_Config[0]][patch_Config[1]] = str(patch_Values[index])

resolution = cls._frontend.BEYOND_Patches["resolution"].get()
shadows = int(cls._frontend.BEYOND_Patches["shadow resolution"].get().split("x")[0])

# ARR = cls._frontend.BEYOND_Patches["aspect ratio"].get().split("x")
ARR = [16, 9]
New_Resolution = patch_info["resolution"]["Values"][patch_info["resolution"]["Name_Values"].index(resolution)].split("x")
New_Resolution = convert_resolution(int(New_Resolution[0]), int(New_Resolution[1]), int(ARR[0]), int(ARR[1]))

scale_1080 = 1920*1080
scale_shadows = round(shadows / 1024)
New_Resolution_scale = int(New_Resolution[0]) * int(New_Resolution[1])
new_scale = New_Resolution_scale / scale_1080

if (scale_shadows > new_scale):
new_scale = scale_shadows
log.info(f"scale:{new_scale}")

layout = 0
if(new_scale < 0):
layout = 0
if(new_scale > 1):
layout = 1
if(new_scale > 6):
layout = 2

if cls.mode == "Legacy":
write_Legacy_config(cls._frontend, cls.TOTKconfig, cls._frontend.title_id, "Renderer", "resolution_setup", "2")
write_Legacy_config(cls._frontend, cls.TOTKconfig, cls._frontend.title_id, "Core", "memory_layout_mode", f"{layout}")
write_Legacy_config(cls._frontend, cls.TOTKconfig, cls._frontend.title_id, "System", "use_docked_mode", "true")

if layout > 0:
write_Legacy_config(cls._frontend, cls.TOTKconfig, cls._frontend.title_id, "Renderer", "vram_usage_mode", "1")
else:
write_Legacy_config(cls._frontend, cls.TOTKconfig, cls._frontend.title_id, "Renderer", "vram_usage_mode", "0")

if cls.mode == "Ryujinx":
write_ryujinx_config(cls._frontend, cls.ryujinx_config, "res_scale", 1)
if (layout > 0):
write_ryujinx_config(cls._frontend, cls.ryujinx_config, "expand_ram", True)
else:
write_ryujinx_config(cls._frontend, cls.ryujinx_config, "expand_ram", False)

config["Resolution"]["Width"] = str(New_Resolution[0])
config["Resolution"]["Height"] = str(New_Resolution[1])
ModCreator.UCAutoPatcher(cls._frontend, config)
ModCreator.UCResolutionPatcher(cls._frontend, config)

## WRITE IN CONFIG FILE FOR UC 2.0
with open(ini_file_path, 'w+', encoding="utf-8") as configfile:
Expand Down
Loading

0 comments on commit 9628407

Please sign in to comment.