Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Lab Assistant
Original Poster
#1 Old 25th Feb 2021 at 7:44 PM
Bodyshop UI Modding - Window Size, Clean UI and More
Forgive me if this is the wrong subforum - I assumed that modding the UI of bodyshop is closer to "modding discussion" than "bodyshop discussion", since that subforum is generally about appearance-changing CC for Sims.

As recorded by Chris Hatch in this WCIF thread, modding the Bodyshop UI is possible.
I spent some time researching the UI data type (http://simswiki.info/wiki.php?title=UI) and attempted minor tweaks to UI files in the CaSIEUI and ui packages - unfortunately, my changes to UI text and box sizes did not appear to be reflected in Bodyshop.

My main goal in modifying the Bodyshop UI is to increase the window size - or at least increase the size of the UI panel.
I think that the window size may be set in the object ID: EECA0005. However, as noted above, my changes were not reflected in Bodyshop. I'm worried that the screen resolution may be hardcoded in the application, since we can only change it by updating the arguments we pass on initializing the program.
I've found that group A99D8A11 corresponds to the 1024x768 resolution and the 08000600 group corresponds to the 800x600 resolution.

Ultimately, I'm interested in adjusting the window size, but as an incremental improvement, I think it would be worthwhile to implement the Clean UI in Body Shop.
I'm planning on setting up a basegame-only copy of TS2 for testing, that way I can rule out a few variables (an Ultimate Collection installation makes it a little too hard to pinpoint which UI packages require modification )

I'd love feedback from anyone who has a background in TS2's UI modding - I'm a software engineer by day, but I haven't modded TS2 in many years, so my domain knowledge is minimal.
In particular, I'm concerned about the possibility that the screen size is hardcoded - if this is a known issue, please let me know so I can stop trying to do it the "nice" way
Advertisement
Mad Poster
#2 Old 25th Feb 2021 at 9:36 PM
You may want to ask Chris Hatch about editing the UI info. Except for him, I don't think there's a lot of people who've edited Bodyshop outside of some simple edits.

It's also possible that you may have to edit the GraphicRules for Bodyshop, in the CSConfig for your latest EP (M&G or whatever is your latest EP in release order). This is (in my knowledge, anyway) the file that controls which resolutions are available. The CSConfig file controls Bodyshop (and Homecrafter), so it's possible some edits are needed there for other/higher resolutions to be available. I'm not srue, but that seems true for the game, at least. I'm not sure exactly where to edit it, but there's probably a guide to where the Bodyshop info is in the file.
Lab Assistant
Original Poster
#3 Old 26th Feb 2021 at 12:44 AM
Quote: Originally posted by simmer22
You may want to ask Chris Hatch about editing the UI info. Except for him, I don't think there's a lot of people who've edited Bodyshop outside of some simple edits.

It's also possible that you may have to edit the GraphicRules for Bodyshop, in the CSConfig for your latest EP (M&G or whatever is your latest EP in release order). This is (in my knowledge, anyway) the file that controls which resolutions are available. The CSConfig file controls Bodyshop (and Homecrafter), so it's possible some edits are needed there for other/higher resolutions to be available. I'm not srue, but that seems true for the game, at least. I'm not sure exactly where to edit it, but there's probably a guide to where the Bodyshop info is in the file.

Thanks, simmer22! I wanted to ask Chris Hatch after seeing some of his work on the UI/his demo on the Bodyshop UI, but I didn't want to PM him until I was sure I'd done my due diligence

I did edit the GraphicRules for Bodyshop, but unfortunately I did not see any significant results.
GraphicsRules.sgr has a segment specifically for CASIE - it looks like it's basically the main game GraphicsRules.sgr with a few lines appended to the bottom:
Code:
# Casie overrides all of the above settings
setOption MaterialDetail $High
setOption ObjectDetail $High
setOption ObjectHiding $Off
[...omitted for space...]
setOption SpecialEventCamera $Off
# Casie disables bumpmapping when accelerator doesn't have enough memory.
if ($textureMemory <= 32)
setOption MaterialDetail $Medium
endif
# When running Casie on Pixomatic, drop a mip level and disable bumps.
if ($useSoftwareRasterizer)
setOption MaterialDetail $Low
endif


The above is from my untouched FreeTime CSConfig folder. I modified the "setOption" block by adding the following line:
Code:
setOption ScreenModeResolution   $High

I also changed the ScreenModeResolution option block to use much higher resolutions. Unfortunately - no luck!

Further research tonight...
On a fresh base game-only install, it looks like the CaSIEUI.data file takes precedence - changing the loading screen JPG in ui.package and CaSIEUI.data showed the image I loaded in CaSIEUI.data. This is good to know
My previous UI edits didn't appear because I attempted to edit the text in the UI scripts - forgetting that text is loaded in a region-specific way! (For Bodyshop, the text can be found in TSData\Res\Text\eCAS.package.)

I experienced some crashes during startup after modifying some UI files. I've experienced few-to-no crashes after using the Compressorizer to compress my modified packages before placing them in the UI folder - I don't know if this is a real phenomenon, but since I'm treading poorly-documented ground I thought it might be worth mentioning.

I'm not sure whether Bodyshop loads all CaSIEUI.data files or whether it only loads Basegame + most recent expansion pack, but I think I want to focus on playing with the base game UI exclusively until I achieve something almost "shippable"
Field Researcher
#4 Old 26th Feb 2021 at 10:54 AM
Quickly trying to change the resolution in the GraphicsRules.sgr resulted in nothing, so it does look like the initial resolution is hard-coded in.
But then I tried resizing the window (Windows won't let you do this, but I use a program called AltDrag that unintentionally lets you do this) and it resulted in the image below.

The UI is obviously all messed up and if the aspect ratio changes the sim will be partially cut off, but the window can be resized.
Now the question remains where the resolution is set and how to make the UI fit properly, both of these might be handled in the executable itself which would make it very difficult to change as you'd have to patch specific bytes in the executable.
Screenshots
Lab Assistant
Original Poster
#5 Old 26th Feb 2021 at 2:16 PM Last edited by Mirablu : 26th Feb 2021 at 2:29 PM.
Quote: Originally posted by SmugTomato
Quickly trying to change the resolution in the GraphicsRules.sgr resulted in nothing, so it does look like the initial resolution is hard-coded in.
But then I tried resizing the window (Windows won't let you do this, but I use a program called AltDrag that unintentionally lets you do this) and it resulted in the image below.

The UI is obviously all messed up and if the aspect ratio changes the sim will be partially cut off, but the window can be resized.
Now the question remains where the resolution is set and how to make the UI fit properly, both of these might be handled in the executable itself which would make it very difficult to change as you'd have to patch specific bytes in the executable.


That's excellent, SmugTomato!
Some fiddling after my last post showed me that the UI can be expanded out of the window bounds. Thanks to your resize test, we know we can still render sims outside of the initial setting.
If we can write an external tool that forces the window to match a certain size, we can simply expand the UI, let it get cut off at 1024x768, and then run the external tool to resize the window by force! I'll look into this after work!

e: http://csharphelper.com/blog/2016/1...-position-in-c/ I'll work with this and probably whip something up over lunch, to be honest
Lab Assistant
Original Poster
#6 Old 26th Feb 2021 at 7:13 PM
Success
I've expanded the window with a tiny standalone tool and expanded the UI. (See attached.)
I still need to update the grid so it's functional, then I'll share my work. It won't be cute, but it will allow anyone to pick this up and customize the bodyshop UI - just in case I get distracted before finishing a CleanUI Bodyshop port.
This is so exciting!
Screenshots
Field Researcher
#7 Old 26th Feb 2021 at 9:21 PM
Nice job, I also decided to give it a try since I wanted to learn more about the Windows API anyway. I've made a simple launcher that will launch BodyShop and apply the resolution given in the 'resizer.cfg' file automatically at startup and centers it as well. Source code is included in case anyone's (rightfully) paranoid about some random executable on the internet.

Simply extract 'TS2BodyShopResizer.exe' and 'resizer.cfg' into the same folder as your 'TS2BodyShop.exe' and run it from the new executable instead.
The config file should never contain spaces, I only implemented a very basic file parser that can't deal with extra whitespace.
width=1280 GOOD
width = 1280 BAD
Attached files:
File Type: 7z  bodyShopResizer.7z (18.1 KB, 66 downloads)
Lab Assistant
Original Poster
#8 Old 26th Feb 2021 at 10:30 PM
Smug, your solution is far more elegant than mine! Unfortunately I don't have a C compiler handy, so I'm unable to modify your parser - but I love it.

I was successfully able to modify the grid for displaying face archetypes - this grid is evidently configured to fill up gracefully, and I'm optimistic that other grids will be equally well-behaved.

It appears to be somewhat important to the default camera angles that we maintain a 3:4 aspect ratio, so I'm going to start off by making a minimalist UI at 1280 x 960.
I think I'll only increase the current viewport width a small amount - I really think that expanding CAS options is more important than expanding the view of the sim.

I'll likely return with pictures late tonight/early tomorrow
Field Researcher
#9 Old 26th Feb 2021 at 10:48 PM Last edited by SmugTomato : 26th Feb 2021 at 11:02 PM.
I completely missed that 1280x1024 is no longer 4:3, I simply copied what I thought the high setting of GraphicsRules.sgr had
Good thing it's a quick edit in the config file.

Another nice initial set of values might be 1376x1032, the extra vertical pixels would be nice, considering almost everyone has at least a 1080p display these days.
Lab Assistant
Original Poster
#10 Old 27th Feb 2021 at 3:23 AM
I thought that the resolution you suggested looked pretty good.

Behold: 1376 x 1032 Bodyshop. Unfortunately I can't attach the CaSIE.data package.
I've only resized the sim selection menu. For now I've eliminated the wavy, 2004-futuristic blue 3D border and the little "The Sims 2" icon in the lower-right corner - the border is just for display, and you can't click on icons that are covered by the image, so away it goes for the time being.

It works in conjunction with either one of our Bodyshop resizing tools.
I'm delighted and I'm looking forward to working on it more this weekend.

Next...
  • Port to M&G bodyshop
  • Resize Sim editor
  • Resize "Create Parts"
  • UI graphics improvements
  • Improve installation process (Download package would be ideal, but it's preferable if we don't have to overwrite game data )
Screenshots
Field Researcher
#11 Old 27th Feb 2021 at 9:31 AM
That's looking very promising for sure!

I've looked through the game files a bit and unfortunately it doesn't seem like there's an options file for the camera inside BodyShop in any sensible place, unless anyone can point me to them.
It looks like the values are once again hard-coded into BodyShop and could only be changed by directly changing the right bytes inside the executable, so a 16:9 window with proper camera would be tricky.
Field Researcher
#12 Old 27th Feb 2021 at 11:51 AM
So I've been poking around BodyShop's memory with Cheat Engine a little bit and so far I've managed to find some interesting things.

In free camera mode it was fairly easy to find the camera's position, zoom and rotation values. In normal camera mode it's a bit more tricky, because the values never change and both modes seem to use different areas in memory.
I have managed to locate to position and rotation of the actual sim(or rather the platform below the sim it seems) in normal camera mode though and managed to move the sim up/down.
I know it's somehow possible to find these values programmatically every time the program loads and change them through dll injection. I'd love to figure out how to do this, but I don't know if I'll be able to.
Field Researcher
#13 Old 27th Feb 2021 at 7:25 PM
Okay, it took me all day, but I've managed to zoom in/out in free camera mode with the up/down keys through dll injection. Now that I know I can do it I just need to manage to find the right variables somehow...
Field Researcher
#14 Old 27th Feb 2021 at 9:29 PM
Wow, this is so cool!!! I have been looking for solutions to this problem and not found much, so I'm very very very excited that people who know things are working on a fix. I only just figured out how to resize the window using this program: http://www.brianapps.net/sizer4/ but it leaves the UI in the middle of the screen. If there was a way to move the UI back into the corner while you're editing a sim so that you have plenty of room to zoom in close on their face and see the changes you are making, that would be amazing!
Lab Assistant
Original Poster
#15 Old 28th Feb 2021 at 4:31 AM
Quote: Originally posted by SmugTomato
Okay, it took me all day, but I've managed to zoom in/out in free camera mode with the up/down keys through dll injection. Now that I know I can do it I just need to manage to find the right variables somehow...

That's incredible! How exciting - Bodyshop is about to enter a new era

SparkySays, you're right that any third-party window resizing application will change the window size but leave the UI untouched - the UI changes I'm working on are mostly to increase the size of the UI to fill the blank space rather than increase the viewport size.
However, SmugTomato, since you're finding ways to adjust the camera - maybe if you can reduce the clipping range, we would be able to make the sim section larger? Not sure, I'm pretty used to using the free camera mode to zoom in on my sim precisely - and the screen resolution you recommended leads to the default 2 camera angles functioning perfectly

At this point I have a functional large UI for Bodyshop's Create-a-Sim counterpart in all categories. I wanted to share it here, but unfortunately the file type is not compatible with MTS's file upload. I've reached out to an admin for help on this, but I'll attach the extracts from SimPE with the main files I've had to modify, that way anyone can compare it to the default UI at these addresses and make inferences.

The most notable things I've found...
  • The GZWinFlatRect with ID 0x00000100 in EECA0005 determines the user's interaction area.
  • Button images are drawn in a peculiar way - you have to adjust the height and width to offset the X and Y position. I'm not sure exactly how this behavior runs under the hood.

I'm quite pleased with this - it's ugly and needs fine-tuning and perhaps a total makeover for the visual elements, but it's perfectly functional
Tomorrow I intend to attempt to fine-tune the object placement (I notice some underutilized vertical space between "Build Sims/Create Parts" and the start of the window, and I'd like to scoot the gender/age/size buttons to the right a bit), and I'd like to see if I can resize the 3D thumbnails.
After everything is placed where I like it, I'll be able to start on the graphic replacements, then it will be ready for prime-time
Screenshots
Attached files:
File Type: 7z  CaSIEUI data extract.7z (5.5 KB, 50 downloads)
Field Researcher
#16 Old 28th Feb 2021 at 5:58 PM Last edited by SmugTomato : 28th Feb 2021 at 8:22 PM.
Quote: Originally posted by Mirablu
However, SmugTomato, since you're finding ways to adjust the camera - maybe if you can reduce the clipping range, we would be able to make the sim section larger? Not sure, I'm pretty used to using the free camera mode to zoom in on my sim precisely - and the screen resolution you recommended leads to the default 2 camera angles functioning perfectly


I've managed to find pointers to the memory containing the camera position values in static camera mode about an hour ago.
I'll need to find yet a few more memory locations to be able to reliably set the camera's position every time you switch between age or free camera mode, but the ones that are left should be easy enough to find

Edit
It looks like I've found all the puzzle pieces I need to make this work, now all that's left is to assemble it into something usable
Field Researcher
#17 Old 28th Feb 2021 at 8:50 PM
@Mirablu that looks amazing. So much less scrolling through cc! For me, I'd want to be able to zoom in pretty close to the sim's face without the UI blocking things when you turn them sideways. Some of the custom sliders are pretty subtle. In the pictures you've showed, if the gender, age, and thin/fat buttons were either scooted over so they start where the square parts window starts, or even placed somewhere else, like up top where you observe there is all that room, that would be the most ideal. But I'm guessing it's probably a lot harder to move things around like that. It's too bad they're in big circles like that instead of stacked vertically where they'd take up a lot less room.

I just messed with it and did a little measuring -- I resized the bodyshop window to 1600x1200 and zoomed in to the distance that feels most ideal to me for editing the face. And came up with 560 pixels as a width of the sim window that seems very comfortable and just about perfect. Less than 525 I think would frustrate me a lot. Anyway if I had your skills that's what I'd want to set up for myself, but you clearly know much more about this than I do so if my commentary isn't helpful please feel free to ignore it!
Field Researcher
#18 Old 28th Feb 2021 at 11:25 PM
Behold, 16:9 Body Shop with adjusted camera!
I still have quite a few things left to polish, but the hardest part is over.

Oh and I also found an anti-aliasing setting in 'TSData\Res\CSConfig\globalProps.xml' and set it to 4, which is why I have nice smooth edges
Screenshots
Lab Assistant
Original Poster
#19 Old 28th Feb 2021 at 11:52 PM
Quote: Originally posted by SmugTomato
Behold, 16:9 Body Shop with adjusted camera!
I still have quite a few things left to polish, but the hardest part is over.

Oh and I also found an anti-aliasing setting in 'TSData\Res\CSConfig\globalProps.xml' and set it to 4, which is why I have nice smooth edges


I have absolute stars in my eyes! Who knew that we'd get here so soon? This is just wonderful. By this time next week, anyone will be able to load up Bodyshop and it will look gorgeous.
Antialiasing too? Goodness! What a dream.

@SparkySays, it's actually fairly easy to move the round buttons to the right. I plan to do so as soon as I finish resizing the UI elements. It may even be possible to stack them vertically to save space when I'm re-skinning the graphics, but I don't want to over-promise.

@SmugTomato, is there any chance you can send details on the 16:9 mods? 1600x900 is much better than 1376x1032 - we need width more than height and it will suit more monitors

I've been able to resize the thumbnails (3D) and swatches (2D images). When we know the final dimensions of the UI, we'll be able to adjust the thumbnail/swatch sizes to create a neat fit with the icons.
Field Researcher
#20 Old 1st Mar 2021 at 12:04 AM
I'll upload the required files tomorrow, it's still very much a work in progress but it should give you an idea of how to space things out.

I was thinking 1600x900 as well, seems like a nice size.
Lab Assistant
Original Poster
#21 Old 1st Mar 2021 at 12:23 AM
Quote: Originally posted by SmugTomato
I'll upload the required files tomorrow, it's still very much a work in progress but it should give you an idea of how to space things out.

I was thinking 1600x900 as well, seems like a nice size.

Great, I'll adjust what I have to fit a 1600x900 window size without moving any elements to the left just yet.
I think I'll also get started on updating the UI to make it more closely resemble CleanUI. Updating the gradients and the auto-resizing images will be a low-impact upgrade
Field Researcher
#22 Old 1st Mar 2021 at 9:55 AM Last edited by SmugTomato : 1st Mar 2021 at 11:07 AM.
Like I promised, here's the required files.
Please make sure to follow the instructions of the messagebox that pops up, or it will happily try to dereference invalid pointers and crash :P

Edit
I forgot to include the Cheat Engine file with all the memory addresses in it, which will be more flexible for now. I'll upload it later.

Edit 2
MTS won't let me upload the file, so I had to upload it elsewhere
CheatEngineFiles.zip
Attached files:
File Type: 7z  bodyShopResizer.7z (11.0 KB, 31 downloads)
Field Researcher
#23 Old 1st Mar 2021 at 8:36 PM Last edited by SmugTomato : 2nd Mar 2021 at 9:04 PM.
I've added some new functionality that should make it a lot easier to adjust the camera position, you can now move around as follows

Left/Right arrows keys: Move the camera along the X axis
Up/Down arrow keys: Move the camera along the Z axis
Insert/Delete keys: Move the camera along the Y axis
Home key: display the current XYZ offsets
End key: Show/Hide the UI without moving the sim to the center of the screen

The camera does not yet adjust to differently aged sims, only adults for now

Edit
I've figured out a way to get rid of an annoying bug that has been in Body Shop for a long time, the UI still being clickable when the UI is invisible.
I didn't think I'd be patching machine code instructions at runtime for a side program of a 15+ year old game this week, but hey...
Attached files:
File Type: 7z  TS2BodyShopHack.7z (8.4 KB, 16 downloads)
Field Researcher
#24 Old 3rd Mar 2021 at 8:03 PM Last edited by SmugTomato : 3rd Mar 2021 at 11:39 PM.
Another update that should make figuring the UI out a bit easier.
- The camera position is now set for every age from toddler through elder, though for now it snaps back to zoomed out view when Body Shop zooms in.
- I've started putting the configuration options in a .ini file, but for now both the .ini and .cfg are required.
- The UI is no longer clickable when it is invisible, can be turned on/off in the config file.
- I've added a debug console that can be toggled on/off in the config file, when enabled you can move the camera around with the arrow keys and insert/delete.
Upon pressing any of these keys the XYZ values will be printed so they can be easily copied over the the config file (fCamStaticOffset values)

It's still very rough around the edges and will require some more work, but it should be an improvement
Attached files:
File Type: 7z  BodyShopHack.7z (9.7 KB, 23 downloads)
Field Researcher
#25 Old 4th Mar 2021 at 11:43 AM
While I was browsing through the strings in the executable which pointed me to a file named CSResources.ini, which I found in TSData/Sys and contains the following:
Code:
[DBSegments]
0x00000000 = 0x086d4a89;%DataDirectory%Res\UI\CaSIEUI.data
0x00000004 = 0x086d4a89;%DataDirectory%Res\Locale\%Language%\UI\CaSIEUI.data

[ResourceFactories]
0x856ddbac = 0xa2ffb5d3
0xebfee33f = 0xebfeec33
0xa2e3d533 = 0x42e411c2

After seeing this I wondered if I could add another file to the list, so I grabbed your extracted files, put them in a new package, placed that in the TSData/Res/UI folder and put it under the [DBSegments] section like so:
Code:
[DBSegments]
0x00000000 = 0x086d4a89;%DataDirectory%Res\UI\CaSIEUI.data
0x00000004 = 0x086d4a89;%DataDirectory%Res\Locale\%Language%\UI\CaSIEUI.data
0x00000008 = 0x086d4a89;%DataDirectory%Res\UI\uiOverride.package

[ResourceFactories]
0x856ddbac = 0xa2ffb5d3
0xebfee33f = 0xebfeec33
0xa2e3d533 = 0x42e411c2

And guess what? the UI changed!
This would make it very easy to package a mod like this instead of having to manually replace resources in a .package file.
Screenshots
Page 1 of 2
Back to top